/* 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 TestTokenContractJson } from "../test/TestToken.ral.json"; import { getContractByCodeHash, registerContract } from "./contracts"; // Custom types for the contract export namespace TestTokenTypes { export type Fields = { symbol: HexString; name: HexString; decimals: bigint; totalSupply: bigint; }; export type State = ContractState; export interface CallMethodTable { getSymbol: { params: Omit, "args">; result: CallContractResult; }; getName: { params: Omit, "args">; result: CallContractResult; }; getDecimals: { params: Omit, "args">; result: CallContractResult; }; getTotalSupply: { params: Omit, "args">; result: CallContractResult; }; getToken: { params: CallContractParams<{ sender: Address; amount: 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 { getSymbol: { params: Omit, "args">; result: SignExecuteScriptTxResult; }; getName: { params: Omit, "args">; result: SignExecuteScriptTxResult; }; getDecimals: { params: Omit, "args">; result: SignExecuteScriptTxResult; }; getTotalSupply: { params: Omit, "args">; result: SignExecuteScriptTxResult; }; getToken: { params: SignExecuteContractMethodParams<{ sender: Address; amount: bigint; }>; result: SignExecuteScriptTxResult; }; } export type SignExecuteMethodParams = SignExecuteMethodTable[T]["params"]; export type SignExecuteMethodResult = SignExecuteMethodTable[T]["result"]; } class Factory extends ContractFactory< TestTokenInstance, TestTokenTypes.Fields > { encodeFields(fields: TestTokenTypes.Fields) { return encodeContractFields( addStdIdToFields(this.contract, fields), this.contract.fieldsSig, [] ); } at(address: string): TestTokenInstance { return new TestTokenInstance(address); } tests = { getSymbol: async ( params: Omit< TestContractParamsWithoutMaps, "args" > ): Promise> => { return testMethod(this, "getSymbol", params, getContractByCodeHash); }, getName: async ( params: Omit< TestContractParamsWithoutMaps, "args" > ): Promise> => { return testMethod(this, "getName", params, getContractByCodeHash); }, getDecimals: async ( params: Omit< TestContractParamsWithoutMaps, "args" > ): Promise> => { return testMethod(this, "getDecimals", params, getContractByCodeHash); }, getTotalSupply: async ( params: Omit< TestContractParamsWithoutMaps, "args" > ): Promise> => { return testMethod(this, "getTotalSupply", params, getContractByCodeHash); }, getToken: async ( params: TestContractParamsWithoutMaps< TestTokenTypes.Fields, { sender: Address; amount: bigint } > ): Promise> => { return testMethod(this, "getToken", params, getContractByCodeHash); }, }; stateForTest( initFields: TestTokenTypes.Fields, asset?: Asset, address?: string ) { return this.stateForTest_(initFields, asset, address, undefined); } } // Use this object to test and deploy the contract export const TestToken = new Factory( Contract.fromJson( TestTokenContractJson, "", "f9dac4e7d0bf28a2bc019f43138339e23afadde322d50441cdfe029993bf35f3", [] ) ); registerContract(TestToken); // Use this class to interact with the blockchain export class TestTokenInstance extends ContractInstance { constructor(address: Address) { super(address); } async fetchState(): Promise { return fetchContractState(TestToken, this); } view = { getSymbol: async ( params?: TestTokenTypes.CallMethodParams<"getSymbol"> ): Promise> => { return callMethod( TestToken, this, "getSymbol", params === undefined ? {} : params, getContractByCodeHash ); }, getName: async ( params?: TestTokenTypes.CallMethodParams<"getName"> ): Promise> => { return callMethod( TestToken, this, "getName", params === undefined ? {} : params, getContractByCodeHash ); }, getDecimals: async ( params?: TestTokenTypes.CallMethodParams<"getDecimals"> ): Promise> => { return callMethod( TestToken, this, "getDecimals", params === undefined ? {} : params, getContractByCodeHash ); }, getTotalSupply: async ( params?: TestTokenTypes.CallMethodParams<"getTotalSupply"> ): Promise> => { return callMethod( TestToken, this, "getTotalSupply", params === undefined ? {} : params, getContractByCodeHash ); }, getToken: async ( params: TestTokenTypes.CallMethodParams<"getToken"> ): Promise> => { return callMethod( TestToken, this, "getToken", params, getContractByCodeHash ); }, }; transact = { getSymbol: async ( params: TestTokenTypes.SignExecuteMethodParams<"getSymbol"> ): Promise> => { return signExecuteMethod(TestToken, this, "getSymbol", params); }, getName: async ( params: TestTokenTypes.SignExecuteMethodParams<"getName"> ): Promise> => { return signExecuteMethod(TestToken, this, "getName", params); }, getDecimals: async ( params: TestTokenTypes.SignExecuteMethodParams<"getDecimals"> ): Promise> => { return signExecuteMethod(TestToken, this, "getDecimals", params); }, getTotalSupply: async ( params: TestTokenTypes.SignExecuteMethodParams<"getTotalSupply"> ): Promise> => { return signExecuteMethod(TestToken, this, "getTotalSupply", params); }, getToken: async ( params: TestTokenTypes.SignExecuteMethodParams<"getToken"> ): Promise> => { return signExecuteMethod(TestToken, this, "getToken", params); }, }; async multicall( calls: Calls ): Promise>; async multicall( callss: Narrow ): Promise>; async multicall< Callss extends | TestTokenTypes.MultiCallParams | TestTokenTypes.MultiCallParams[] >(callss: Callss): Promise { return await multicallMethods( TestToken, this, callss, getContractByCodeHash ); } }