/* Autogenerated file. Do not edit manually. */ /* tslint:disable */ /* eslint-disable */ import { Address, Contract, ContractState, TestContractResult, HexString, ContractFactory, EventSubscribeOptions, EventSubscription, CallContractParams, CallContractResult, TestContractParams, ContractEvent, subscribeContractEvent, subscribeContractEvents, testMethod, callMethod, multicallMethods, fetchContractState, Asset, ContractInstance, getContractEventsCurrentCount, TestContractParamsWithoutMaps, TestContractResultWithoutMaps, SignExecuteContractMethodParams, SignExecuteScriptTxResult, signExecuteMethod, addStdIdToFields, encodeContractFields, Narrow, } from "@alephium/web3"; import { default as BitmapWordContractJson } from "../BitmapWord.ral.json"; import { getContractByCodeHash, registerContract } from "./contracts"; import * as types from "./types"; // Custom types for the contract export namespace BitmapWordTypes { export type Fields = { parent: Address; value: bigint; }; export type State = ContractState; export interface CallMethodTable { mostSignificantBit: { params: CallContractParams<{ x: bigint }>; result: CallContractResult; }; leastSignificantBit: { params: CallContractParams<{ x: bigint }>; result: CallContractResult; }; flip: { params: CallContractParams<{ tick: bigint }>; result: CallContractResult; }; getNext: { params: CallContractParams<{ compressed: bigint; zeroForOne: boolean; tickSpacing: bigint; }>; result: CallContractResult<[bigint, boolean]>; }; getBitPos: { params: CallContractParams<{ tick: bigint }>; result: CallContractResult; }; } export type CallMethodParams = CallMethodTable[T]["params"]; export type CallMethodResult = CallMethodTable[T]["result"]; export type MultiCallParams = Partial<{ [Name in keyof CallMethodTable]: CallMethodTable[Name]["params"]; }>; export type MultiCallResults = { [MaybeName in keyof T]: MaybeName extends keyof CallMethodTable ? CallMethodTable[MaybeName]["result"] : undefined; }; export type MulticallReturnType = { [index in keyof Callss]: MultiCallResults; }; export interface SignExecuteMethodTable { mostSignificantBit: { params: SignExecuteContractMethodParams<{ x: bigint }>; result: SignExecuteScriptTxResult; }; leastSignificantBit: { params: SignExecuteContractMethodParams<{ x: bigint }>; result: SignExecuteScriptTxResult; }; flip: { params: SignExecuteContractMethodParams<{ tick: bigint }>; result: SignExecuteScriptTxResult; }; getNext: { params: SignExecuteContractMethodParams<{ compressed: bigint; zeroForOne: boolean; tickSpacing: bigint; }>; result: SignExecuteScriptTxResult; }; getBitPos: { params: SignExecuteContractMethodParams<{ tick: bigint }>; result: SignExecuteScriptTxResult; }; } export type SignExecuteMethodParams = SignExecuteMethodTable[T]["params"]; export type SignExecuteMethodResult = SignExecuteMethodTable[T]["result"]; } class Factory extends ContractFactory< BitmapWordInstance, BitmapWordTypes.Fields > { encodeFields(fields: BitmapWordTypes.Fields) { return encodeContractFields( addStdIdToFields(this.contract, fields), this.contract.fieldsSig, types.AllStructs ); } consts = { BitMathError: { NoMostSignificantBit: BigInt("150"), NoLeastSignificantBit: BigInt("151"), }, }; at(address: string): BitmapWordInstance { return new BitmapWordInstance(address); } tests = { mostSignificantBit: async ( params: TestContractParamsWithoutMaps< BitmapWordTypes.Fields, { x: bigint } > ): Promise> => { return testMethod( this, "mostSignificantBit", params, getContractByCodeHash ); }, leastSignificantBit: async ( params: TestContractParamsWithoutMaps< BitmapWordTypes.Fields, { x: bigint } > ): Promise> => { return testMethod( this, "leastSignificantBit", params, getContractByCodeHash ); }, flip: async ( params: TestContractParamsWithoutMaps< BitmapWordTypes.Fields, { tick: bigint } > ): Promise> => { return testMethod(this, "flip", params, getContractByCodeHash); }, getNext: async ( params: TestContractParamsWithoutMaps< BitmapWordTypes.Fields, { compressed: bigint; zeroForOne: boolean; tickSpacing: bigint } > ): Promise> => { return testMethod(this, "getNext", params, getContractByCodeHash); }, getBitPos: async ( params: TestContractParamsWithoutMaps< BitmapWordTypes.Fields, { tick: bigint } > ): Promise> => { return testMethod(this, "getBitPos", params, getContractByCodeHash); }, }; stateForTest( initFields: BitmapWordTypes.Fields, asset?: Asset, address?: string ) { return this.stateForTest_(initFields, asset, address, undefined); } } // Use this object to test and deploy the contract export const BitmapWord = new Factory( Contract.fromJson( BitmapWordContractJson, "", "69fd344eb51899a9bdc30ae94beeb2dcfeb2fc312d39116ebe9d208a55293edd", types.AllStructs ) ); registerContract(BitmapWord); // Use this class to interact with the blockchain export class BitmapWordInstance extends ContractInstance { constructor(address: Address) { super(address); } async fetchState(): Promise { return fetchContractState(BitmapWord, this); } view = { mostSignificantBit: async ( params: BitmapWordTypes.CallMethodParams<"mostSignificantBit"> ): Promise> => { return callMethod( BitmapWord, this, "mostSignificantBit", params, getContractByCodeHash ); }, leastSignificantBit: async ( params: BitmapWordTypes.CallMethodParams<"leastSignificantBit"> ): Promise> => { return callMethod( BitmapWord, this, "leastSignificantBit", params, getContractByCodeHash ); }, flip: async ( params: BitmapWordTypes.CallMethodParams<"flip"> ): Promise> => { return callMethod( BitmapWord, this, "flip", params, getContractByCodeHash ); }, getNext: async ( params: BitmapWordTypes.CallMethodParams<"getNext"> ): Promise> => { return callMethod( BitmapWord, this, "getNext", params, getContractByCodeHash ); }, getBitPos: async ( params: BitmapWordTypes.CallMethodParams<"getBitPos"> ): Promise> => { return callMethod( BitmapWord, this, "getBitPos", params, getContractByCodeHash ); }, }; transact = { mostSignificantBit: async ( params: BitmapWordTypes.SignExecuteMethodParams<"mostSignificantBit"> ): Promise< BitmapWordTypes.SignExecuteMethodResult<"mostSignificantBit"> > => { return signExecuteMethod(BitmapWord, this, "mostSignificantBit", params); }, leastSignificantBit: async ( params: BitmapWordTypes.SignExecuteMethodParams<"leastSignificantBit"> ): Promise< BitmapWordTypes.SignExecuteMethodResult<"leastSignificantBit"> > => { return signExecuteMethod(BitmapWord, this, "leastSignificantBit", params); }, flip: async ( params: BitmapWordTypes.SignExecuteMethodParams<"flip"> ): Promise> => { return signExecuteMethod(BitmapWord, this, "flip", params); }, getNext: async ( params: BitmapWordTypes.SignExecuteMethodParams<"getNext"> ): Promise> => { return signExecuteMethod(BitmapWord, this, "getNext", params); }, getBitPos: async ( params: BitmapWordTypes.SignExecuteMethodParams<"getBitPos"> ): Promise> => { return signExecuteMethod(BitmapWord, this, "getBitPos", params); }, }; async multicall( calls: Calls ): Promise>; async multicall( callss: Narrow ): Promise>; async multicall< Callss extends | BitmapWordTypes.MultiCallParams | BitmapWordTypes.MultiCallParams[] >(callss: Callss): Promise { return await multicallMethods( BitmapWord, this, callss, getContractByCodeHash ); } }