/* 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 TickContractJson } from "../Tick.ral.json"; import { getContractByCodeHash, registerContract } from "./contracts"; import * as types from "./types"; // Custom types for the contract export namespace TickTypes { export type Fields = { parent: Address; tick: bigint; liquidityGross: bigint; liquidityNet: bigint; feeGrowthsOutside: [bigint, bigint, bigint]; }; export type State = ContractState; export interface CallMethodTable { update: { params: CallContractParams<{ maxLiquidity: bigint; liquidityDelta: bigint; upper: boolean; }>; result: CallContractResult; }; feeGrowthBelow: { params: CallContractParams<{ tickCurrent: bigint; globalGrowths: [bigint, bigint, bigint]; }>; result: CallContractResult<[bigint, bigint, bigint]>; }; feeGrowthAbove: { params: CallContractParams<{ tickCurrent: bigint; globalGrowths: [bigint, bigint, bigint]; }>; result: CallContractResult<[bigint, bigint, bigint]>; }; clear: { params: CallContractParams<{ payer: Address }>; result: CallContractResult; }; cross: { params: CallContractParams<{ globalGrowths: [bigint, bigint, bigint]; zeroForOne: boolean; feeGrowthGlobalX128: bigint; }>; result: CallContractResult; }; getLiquidityNet: { 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 { update: { params: SignExecuteContractMethodParams<{ maxLiquidity: bigint; liquidityDelta: bigint; upper: boolean; }>; result: SignExecuteScriptTxResult; }; feeGrowthBelow: { params: SignExecuteContractMethodParams<{ tickCurrent: bigint; globalGrowths: [bigint, bigint, bigint]; }>; result: SignExecuteScriptTxResult; }; feeGrowthAbove: { params: SignExecuteContractMethodParams<{ tickCurrent: bigint; globalGrowths: [bigint, bigint, bigint]; }>; result: SignExecuteScriptTxResult; }; clear: { params: SignExecuteContractMethodParams<{ payer: Address }>; result: SignExecuteScriptTxResult; }; cross: { params: SignExecuteContractMethodParams<{ globalGrowths: [bigint, bigint, bigint]; zeroForOne: boolean; feeGrowthGlobalX128: bigint; }>; result: SignExecuteScriptTxResult; }; getLiquidityNet: { params: Omit, "args">; result: SignExecuteScriptTxResult; }; } export type SignExecuteMethodParams = SignExecuteMethodTable[T]["params"]; export type SignExecuteMethodResult = SignExecuteMethodTable[T]["result"]; } class Factory extends ContractFactory { encodeFields(fields: TickTypes.Fields) { return encodeContractFields( addStdIdToFields(this.contract, fields), this.contract.fieldsSig, types.AllStructs ); } consts = { TickError: { NotParent: BigInt("801"), LO: BigInt("802"), LS: BigInt("803"), }, }; at(address: string): TickInstance { return new TickInstance(address); } tests = { update: async ( params: TestContractParamsWithoutMaps< TickTypes.Fields, { maxLiquidity: bigint; liquidityDelta: bigint; upper: boolean } > ): Promise> => { return testMethod(this, "update", params, getContractByCodeHash); }, feeGrowthBelow: async ( params: TestContractParamsWithoutMaps< TickTypes.Fields, { tickCurrent: bigint; globalGrowths: [bigint, bigint, bigint] } > ): Promise> => { return testMethod(this, "feeGrowthBelow", params, getContractByCodeHash); }, feeGrowthAbove: async ( params: TestContractParamsWithoutMaps< TickTypes.Fields, { tickCurrent: bigint; globalGrowths: [bigint, bigint, bigint] } > ): Promise> => { return testMethod(this, "feeGrowthAbove", params, getContractByCodeHash); }, clear: async ( params: TestContractParamsWithoutMaps< TickTypes.Fields, { payer: Address } > ): Promise> => { return testMethod(this, "clear", params, getContractByCodeHash); }, cross: async ( params: TestContractParamsWithoutMaps< TickTypes.Fields, { globalGrowths: [bigint, bigint, bigint]; zeroForOne: boolean; feeGrowthGlobalX128: bigint; } > ): Promise> => { return testMethod(this, "cross", params, getContractByCodeHash); }, getLiquidityNet: async ( params: Omit< TestContractParamsWithoutMaps, "args" > ): Promise> => { return testMethod(this, "getLiquidityNet", params, getContractByCodeHash); }, }; stateForTest(initFields: TickTypes.Fields, asset?: Asset, address?: string) { return this.stateForTest_(initFields, asset, address, undefined); } } // Use this object to test and deploy the contract export const Tick = new Factory( Contract.fromJson( TickContractJson, "", "1373551ca890d886980b8d33277d7ed7a2c9f7665d77a1e893a1f2554d10d4b1", types.AllStructs ) ); registerContract(Tick); // Use this class to interact with the blockchain export class TickInstance extends ContractInstance { constructor(address: Address) { super(address); } async fetchState(): Promise { return fetchContractState(Tick, this); } view = { update: async ( params: TickTypes.CallMethodParams<"update"> ): Promise> => { return callMethod(Tick, this, "update", params, getContractByCodeHash); }, feeGrowthBelow: async ( params: TickTypes.CallMethodParams<"feeGrowthBelow"> ): Promise> => { return callMethod( Tick, this, "feeGrowthBelow", params, getContractByCodeHash ); }, feeGrowthAbove: async ( params: TickTypes.CallMethodParams<"feeGrowthAbove"> ): Promise> => { return callMethod( Tick, this, "feeGrowthAbove", params, getContractByCodeHash ); }, clear: async ( params: TickTypes.CallMethodParams<"clear"> ): Promise> => { return callMethod(Tick, this, "clear", params, getContractByCodeHash); }, cross: async ( params: TickTypes.CallMethodParams<"cross"> ): Promise> => { return callMethod(Tick, this, "cross", params, getContractByCodeHash); }, getLiquidityNet: async ( params?: TickTypes.CallMethodParams<"getLiquidityNet"> ): Promise> => { return callMethod( Tick, this, "getLiquidityNet", params === undefined ? {} : params, getContractByCodeHash ); }, }; transact = { update: async ( params: TickTypes.SignExecuteMethodParams<"update"> ): Promise> => { return signExecuteMethod(Tick, this, "update", params); }, feeGrowthBelow: async ( params: TickTypes.SignExecuteMethodParams<"feeGrowthBelow"> ): Promise> => { return signExecuteMethod(Tick, this, "feeGrowthBelow", params); }, feeGrowthAbove: async ( params: TickTypes.SignExecuteMethodParams<"feeGrowthAbove"> ): Promise> => { return signExecuteMethod(Tick, this, "feeGrowthAbove", params); }, clear: async ( params: TickTypes.SignExecuteMethodParams<"clear"> ): Promise> => { return signExecuteMethod(Tick, this, "clear", params); }, cross: async ( params: TickTypes.SignExecuteMethodParams<"cross"> ): Promise> => { return signExecuteMethod(Tick, this, "cross", params); }, getLiquidityNet: async ( params: TickTypes.SignExecuteMethodParams<"getLiquidityNet"> ): Promise> => { return signExecuteMethod(Tick, this, "getLiquidityNet", params); }, }; async multicall( calls: Calls ): Promise>; async multicall( callss: Narrow ): Promise>; async multicall< Callss extends TickTypes.MultiCallParams | TickTypes.MultiCallParams[] >(callss: Callss): Promise { return await multicallMethods(Tick, this, callss, getContractByCodeHash); } }