/* 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 FeeCollectorPerTokenPairImplContractJson } from "../examples/FeeCollectorPerTokenPairImpl.ral.json"; import { getContractByCodeHash, registerContract } from "./contracts"; // Custom types for the contract export namespace FeeCollectorPerTokenPairImplTypes { export type Fields = { tokenPairFactory: HexString; tokenPair: HexString; }; export type State = ContractState; export interface CallMethodTable { collectFee: { params: CallContractParams<{ from: Address; amount: bigint }>; result: CallContractResult; }; withdraw: { params: CallContractParams<{ to: Address; amount: bigint }>; result: CallContractResult; }; destroy: { params: CallContractParams<{ to: Address }>; result: CallContractResult; }; collectFeeManually: { params: Omit, "args">; 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 { collectFee: { params: SignExecuteContractMethodParams<{ from: Address; amount: bigint; }>; result: SignExecuteScriptTxResult; }; withdraw: { params: SignExecuteContractMethodParams<{ to: Address; amount: bigint }>; result: SignExecuteScriptTxResult; }; destroy: { params: SignExecuteContractMethodParams<{ to: Address }>; result: SignExecuteScriptTxResult; }; collectFeeManually: { params: Omit, "args">; result: SignExecuteScriptTxResult; }; } export type SignExecuteMethodParams = SignExecuteMethodTable[T]["params"]; export type SignExecuteMethodResult = SignExecuteMethodTable[T]["result"]; } class Factory extends ContractFactory< FeeCollectorPerTokenPairImplInstance, FeeCollectorPerTokenPairImplTypes.Fields > { encodeFields(fields: FeeCollectorPerTokenPairImplTypes.Fields) { return encodeContractFields( addStdIdToFields(this.contract, fields), this.contract.fieldsSig, [] ); } consts = { ErrorCodes: { ReserveOverflow: BigInt("0"), InsufficientInitLiquidity: BigInt("1"), InsufficientLiquidityMinted: BigInt("2"), InsufficientLiquidityBurned: BigInt("3"), InvalidToAddress: BigInt("4"), InsufficientLiquidity: BigInt("5"), InvalidTokenInId: BigInt("6"), InvalidCalleeId: BigInt("7"), InvalidK: BigInt("8"), InsufficientOutputAmount: BigInt("9"), InsufficientInputAmount: BigInt("10"), IdenticalTokenIds: BigInt("11"), Expired: BigInt("12"), InsufficientToken0Amount: BigInt("13"), InsufficientToken1Amount: BigInt("14"), TokenNotExist: BigInt("15"), InvalidCaller: BigInt("16"), FeeCollectorNotEnabled: BigInt("17"), InvalidAccount: BigInt("18"), }, }; at(address: string): FeeCollectorPerTokenPairImplInstance { return new FeeCollectorPerTokenPairImplInstance(address); } tests = { collectFee: async ( params: TestContractParamsWithoutMaps< FeeCollectorPerTokenPairImplTypes.Fields, { from: Address; amount: bigint } > ): Promise> => { return testMethod(this, "collectFee", params, getContractByCodeHash); }, withdraw: async ( params: TestContractParamsWithoutMaps< FeeCollectorPerTokenPairImplTypes.Fields, { to: Address; amount: bigint } > ): Promise> => { return testMethod(this, "withdraw", params, getContractByCodeHash); }, destroy: async ( params: TestContractParamsWithoutMaps< FeeCollectorPerTokenPairImplTypes.Fields, { to: Address } > ): Promise> => { return testMethod(this, "destroy", params, getContractByCodeHash); }, collectFeeManually: async ( params: Omit< TestContractParamsWithoutMaps< FeeCollectorPerTokenPairImplTypes.Fields, never >, "args" > ): Promise> => { return testMethod( this, "collectFeeManually", params, getContractByCodeHash ); }, }; stateForTest( initFields: FeeCollectorPerTokenPairImplTypes.Fields, asset?: Asset, address?: string ) { return this.stateForTest_(initFields, asset, address, undefined); } } // Use this object to test and deploy the contract export const FeeCollectorPerTokenPairImpl = new Factory( Contract.fromJson( FeeCollectorPerTokenPairImplContractJson, "", "a2326c414551281d90194411b00b614c3fc07cb568020e1ed2e1852099e6996e", [] ) ); registerContract(FeeCollectorPerTokenPairImpl); // Use this class to interact with the blockchain export class FeeCollectorPerTokenPairImplInstance extends ContractInstance { constructor(address: Address) { super(address); } async fetchState(): Promise { return fetchContractState(FeeCollectorPerTokenPairImpl, this); } view = { collectFee: async ( params: FeeCollectorPerTokenPairImplTypes.CallMethodParams<"collectFee"> ): Promise< FeeCollectorPerTokenPairImplTypes.CallMethodResult<"collectFee"> > => { return callMethod( FeeCollectorPerTokenPairImpl, this, "collectFee", params, getContractByCodeHash ); }, withdraw: async ( params: FeeCollectorPerTokenPairImplTypes.CallMethodParams<"withdraw"> ): Promise< FeeCollectorPerTokenPairImplTypes.CallMethodResult<"withdraw"> > => { return callMethod( FeeCollectorPerTokenPairImpl, this, "withdraw", params, getContractByCodeHash ); }, destroy: async ( params: FeeCollectorPerTokenPairImplTypes.CallMethodParams<"destroy"> ): Promise< FeeCollectorPerTokenPairImplTypes.CallMethodResult<"destroy"> > => { return callMethod( FeeCollectorPerTokenPairImpl, this, "destroy", params, getContractByCodeHash ); }, collectFeeManually: async ( params?: FeeCollectorPerTokenPairImplTypes.CallMethodParams<"collectFeeManually"> ): Promise< FeeCollectorPerTokenPairImplTypes.CallMethodResult<"collectFeeManually"> > => { return callMethod( FeeCollectorPerTokenPairImpl, this, "collectFeeManually", params === undefined ? {} : params, getContractByCodeHash ); }, }; transact = { collectFee: async ( params: FeeCollectorPerTokenPairImplTypes.SignExecuteMethodParams<"collectFee"> ): Promise< FeeCollectorPerTokenPairImplTypes.SignExecuteMethodResult<"collectFee"> > => { return signExecuteMethod( FeeCollectorPerTokenPairImpl, this, "collectFee", params ); }, withdraw: async ( params: FeeCollectorPerTokenPairImplTypes.SignExecuteMethodParams<"withdraw"> ): Promise< FeeCollectorPerTokenPairImplTypes.SignExecuteMethodResult<"withdraw"> > => { return signExecuteMethod( FeeCollectorPerTokenPairImpl, this, "withdraw", params ); }, destroy: async ( params: FeeCollectorPerTokenPairImplTypes.SignExecuteMethodParams<"destroy"> ): Promise< FeeCollectorPerTokenPairImplTypes.SignExecuteMethodResult<"destroy"> > => { return signExecuteMethod( FeeCollectorPerTokenPairImpl, this, "destroy", params ); }, collectFeeManually: async ( params: FeeCollectorPerTokenPairImplTypes.SignExecuteMethodParams<"collectFeeManually"> ): Promise< FeeCollectorPerTokenPairImplTypes.SignExecuteMethodResult<"collectFeeManually"> > => { return signExecuteMethod( FeeCollectorPerTokenPairImpl, this, "collectFeeManually", params ); }, }; }