@parifi/synthetix-sdk-ts
Version:
A Typescript SDK for interactions with the Synthetix protocol
816 lines (813 loc) • 468 kB
text/typescript
import * as viem_experimental from 'viem/experimental';
import * as viem from 'viem';
import { Address, Hex, Hash, StateOverride, CallParameters, PublicClient, PrivateKeyAccount } from 'viem';
import { PythConfig, AccountConfig, RpcConfig, SdkConfigParams } from './interface/classConfigs.mjs';
import './utils/common.mjs';
import { CoreRepository } from './interface/Core/index.mjs';
import { TransactionData, WriteContractParams, WriteErc7412, OverrideParamsWrite, OverrideParamsRead, WriteReturnType, MarketIdOrName } from './interface/commonTypes.mjs';
import { ABI } from './contracts/v3-contracts/8453/index.mjs';
import { AxiosInstance } from 'axios';
import { EvmPriceServiceConnection, PriceFeed } from '@pythnetwork/pyth-evm-js';
import { MarketData, SpotMarketData, MarketMetadata, MarketSummary, SettlementStrategy, FundingParameters, OrderFees, MaxMarketValue, OrderData, CollateralData, OpenPositionData, OrderQuote, PayDebtAndWithdraw } from './perps/interface.mjs';
import { Call3Value } from './interface/contractTypes.mjs';
import { ModifyCollateral, GetPerpsQuote, CommitOrder, PayDebt, CreateAccountDepositAndCreateOrder, CreateAccountAndDeposit, CreateAccountAndDepositMany, CreateIsolateOrder, GrantPermission, GetPermissions, AccountPermissions } from './interface/Perps/index.mjs';
import { PerpsRepository } from './interface/Perps/repositories.mjs';
import { SpotOrder, SpotSettlementStrategy } from './spot/interface.mjs';
import { GetOrder, GetSettlementStrategy, GetSettlementStrategies, AtomicOrder, Wrap, CommitOrderSpot, SettleOrder, Approve } from './interface/Spot/index.mjs';
import { Logger, ILogObj } from 'tslog';
/**
* Utility class
*
*/
declare class Utils {
sdk: SynthetixSdk;
constructor(synthetixSdk: SynthetixSdk);
isOracleCall(data: TransactionData | Address): Promise<boolean>;
/**
* Returns the Pyth price ids array
* @param oracleQueryData
* @returns Pyth Price IDs array
*/
getPythPriceIdsFromOracleQuery(oracleQueryData: Hex): Hex[];
/**
* Decodes the response from a Smart contract function call
* @param abi Contract ABI
* @param functionName Function name to decode
* @param result Response from function call that needs to be decoded
* @returns Decoded result
*/
decodeResponse(abi: unknown, functionName: string, result: Hex): unknown;
/**
* Determines the type of Error emitted by ERC7412 contract and prepares signed update data
* @param data Error data emitted from ERC7412 contract
* @returns Encoded data for oracle price update transaction
*/
fetchOracleUpdateData(data: Hex): Promise<Hex>;
handleOracleDataRequiredError(parsedError: Hash): Promise<Call3Value>;
/**
* Handles ERC7412 error by creating a price update tx which is prepended to the existing calls
* @param error Error thrown by the call function
* @param calls Multicall call data
* @returns call array with ERC7412 fulfillOracleQuery transaction
*/
handleErc7412Error(parsedError: Hash): Promise<Call3Value[]>;
/**
* Generates Call3Value tx for Price update data of Oracle
* @param oracleContract Oracle Contract address
* @param signedRequiredData Encoded Price Update data
* @returns Transaction Request for Oracle price update
*/
generateDataVerificationTx(_oracleContract: Hex, signedRequiredData: string): Call3Value;
/**
* Calls the `functionName` on `contractAddress` target using the Multicall contract. If the call requires
* a price update, ERC7412 price update tx is prepended to the tx.
* @param contractAddress Target contract address for the call
* @param abi Contract ABI
* @param functionName Function to be called on the contract
* @param args Arguments list for the function call
* @param calls Array of Call3Value calls for Multicall contract
* @returns Response from the contract function call
*/
callErc7412({ contractAddress, abi, args, functionName, calls }: WriteContractParams): Promise<unknown>;
/**
* Calls the `functionName` on `contractAddress` target using the Multicall contract. If the call requires
* a price update, ERC7412 price update tx is prepended to the tx.
* @param contractAddress Target contract address for the call
* @param abi Contract ABI
* @param functionName Function to be called on the contract
* @param argsList Array of arguments list for the function call
* @param calls Array of Call3Value calls for Multicall contract
* @returns Array of responses from the contract function call for the multicalls
*/
multicallErc7412({ contractAddress, abi, functionName, args: argsList, calls, }: WriteContractParams): Promise<unknown[]>;
protected isWriteContractParams(data: WriteErc7412): data is WriteContractParams;
/**
* Simulates the `functionName` on `contractAddress` target using the Multicall contract and returns the
* final transaction call with ERC7412 price update data if required
* @param contractAddress Target contract address for the call
* @param abi Contract ABI
* @param functionName Function to be called on the contract
* @param args Arguments list for the function call
* @param calls Array of Call3Value calls for Multicall contract
* @param override Override parameters for the transaction
* @returns Final transaction call with ERC7412 price update data if required
*/
writeErc7412(data: WriteErc7412, override?: OverrideParamsWrite): Promise<TransactionData>;
/**
* Calls the `functionName` on `contractAddress` target using the Multicall contract. If the call requires
* a price update, ERC7412 price update tx is prepended to the tx.
* @param contractAddress Target contract address for the call
* @param abi Contract ABI
* @param functionNames Function to be called on the contract
* @param argsList Array of arguments list for the function call
* @param calls Array of Call3Value calls for Multicall contract
* @returns Array of responses from the contract function call for the multicalls
*/
multicallMultifunctionErc7412({ contractAddress, abi, functionNames, args: argsList, calls, }: Omit<WriteContractParams, 'functionName'> & {
functionNames: string[];
}, override?: OverrideParamsRead): Promise<unknown[]>;
getMissingOracleCalls(calls: Call3Value[], oracleCalls?: Call3Value[], { attemps, account, stateOverride, }?: {
account?: Address;
attemps?: number;
stateOverride?: StateOverride;
}): Promise<Call3Value[]>;
_fromCall3ToTransactionData(call: Call3Value): TransactionData;
_fromTransactionDataToCall3(data: TransactionData, requireSuccess?: boolean): Call3Value;
_fromCallDataToTransactionData(calls: CallParameters): TransactionData;
_fromTransactionDataToCallData(data: TransactionData): CallParameters;
processTransactions(data: Call3Value[], override: OverrideParamsWrite): Promise<WriteReturnType>;
shouldRetryLogic(error: unknown, attemps?: number): boolean;
isErc7412Error(parsedError: Hash): boolean;
}
/**
* Class for interacting with Synthetix V3 core contracts
* @remarks
*
*/
declare class Core implements CoreRepository {
sdk: SynthetixSdk;
defaultAccountId?: bigint;
accountIds: bigint[];
constructor(synthetixSdk: SynthetixSdk);
initCore(): Promise<void>;
/**
* Returns the Owner wallet address for an account ID
* @param accountId - Account ID
* @returns string - Address of the account owning the accountId
*/
getAccountOwner(accountId: bigint): Promise<Hex>;
/**
* Get the address of the USD stablecoin token
*
* @returns Address of the USD stablecoin token
*/
getUsdToken(): Promise<Hex>;
/**
* Get the core account IDs owned by an address.
* Fetches the account IDs for the given address by checking the balance of
* the AccountProxy contract, which is an NFT owned by the address.
* If no address is provided, uses the connected wallet address.
* @param address The address to get accounts for. Uses connected address if not provided.
* @param defaultAccountId The default account ID to set after fetching.
* @returns A list of account IDs owned by the address
*/
getAccountIds({ address: accountAddress, accountId: defaultAccountId, }?: {
address?: string;
accountId?: bigint;
}): Promise<bigint[]>;
/**
* Get the available collateral for an account for a specified collateral type
* of ``token_address``
* Fetches the amount of undelegated collateral available for withdrawal
* for a given token and account.
* @param tokenAddress The address of the collateral token
* @param accountId The ID of the account to check. Uses default if not provided.
* @returns The available collateral as an ether value.
*/
getAvailableCollateral({ tokenAddress, accountId, }: {
tokenAddress: Address;
accountId?: bigint;
}): Promise<string>;
/**
* Retrieves the unique system preferred pool
* @returns poolId The id of the pool that is currently set as preferred in the system.
*/
getPreferredPool(): Promise<bigint>;
createAccount(accountId?: bigint, override?: Omit<OverrideParamsWrite, 'useOracleCalls'>): Promise<WriteReturnType>;
deposit({ tokenAddress, amount, decimals, accountId, }: {
tokenAddress: string;
amount: number;
decimals: number;
accountId?: bigint;
}, override?: OverrideParamsWrite): Promise<WriteReturnType>;
withdraw({ tokenAddress, amount, decimals, accountId, }: {
tokenAddress: string;
amount: number;
decimals: number;
accountId?: bigint;
}, override?: OverrideParamsWrite): Promise<WriteReturnType>;
delegateCollateral({ tokenAddress, amount, poolId, leverage, accountId, }: {
tokenAddress: string;
amount: number;
poolId: bigint;
leverage: number;
accountId?: bigint;
}, override?: OverrideParamsWrite): Promise<WriteReturnType>;
mintUsd({ tokenAddress, amount, poolId, accountId, }: {
tokenAddress: Address;
amount: number;
poolId: bigint;
accountId?: bigint;
}, override?: OverrideParamsWrite): Promise<WriteReturnType>;
}
declare class Contracts {
sdk: SynthetixSdk;
constructor(synthetixSdk: SynthetixSdk);
/**
* The function returns an instance of the Core Proxy smart contract
* @returns Contract - Instance of Core Proxy smart contract
*/
getMulticallInstance(): Promise<{
read: {
[x: string]: (...parameters: [options?: viem.Prettify<viem.UnionOmit<viem.ReadContractParameters<ABI, string, readonly unknown[]>, "address" | "functionName" | "args" | "abi">> | undefined] | [args: readonly unknown[], options?: viem.Prettify<viem.UnionOmit<viem.ReadContractParameters<ABI, string, readonly unknown[]>, "address" | "functionName" | "args" | "abi">> | undefined]) => Promise<viem.ReadContractReturnType>;
};
estimateGas: {
[x: string]: (...parameters: [options: viem.Prettify<viem.UnionOmit<viem.EstimateContractGasParameters<ABI, string, readonly unknown[], viem.Chain | undefined>, "address" | "functionName" | "args" | "abi">>] | [args: readonly unknown[], options: viem.Prettify<viem.UnionOmit<viem.EstimateContractGasParameters<ABI, string, readonly unknown[], viem.Chain | undefined>, "address" | "functionName" | "args" | "abi">>]) => Promise<viem.EstimateContractGasReturnType>;
} & {
[x: string]: (...parameters: [options: viem.Prettify<viem.UnionOmit<viem.EstimateContractGasParameters<ABI, string, readonly unknown[], viem.Chain | undefined>, "address" | "functionName" | "args" | "abi">>] | [args: readonly unknown[], options: viem.Prettify<viem.UnionOmit<viem.EstimateContractGasParameters<ABI, string, readonly unknown[], viem.Chain | undefined>, "address" | "functionName" | "args" | "abi">>]) => Promise<viem.EstimateContractGasReturnType>;
};
simulate: {
[x: string]: <chainOverride extends viem.Chain | undefined = undefined, accountOverride extends viem.Account | viem.Address | undefined = undefined>(...parameters: [options?: Omit<viem.SimulateContractParameters<ABI, string, readonly unknown[], viem.Chain | undefined, chainOverride, accountOverride>, "address" | "functionName" | "args" | "abi"> | undefined] | [args: readonly unknown[], options?: Omit<viem.SimulateContractParameters<ABI, string, readonly unknown[], viem.Chain | undefined, chainOverride, accountOverride>, "address" | "functionName" | "args" | "abi"> | undefined]) => Promise<viem.SimulateContractReturnType>;
};
createEventFilter: {
[x: string]: <strict extends boolean | undefined = undefined>(...parameters: [options?: ({
fromBlock?: bigint | viem.BlockTag | undefined;
toBlock?: bigint | viem.BlockTag | undefined;
} & {
strict?: strict | undefined;
}) | undefined] | [args: readonly unknown[] | {
[x: string]: unknown;
address?: undefined;
abi?: undefined;
eventName?: undefined;
fromBlock?: undefined;
strict?: undefined;
toBlock?: undefined;
args?: undefined;
}, options?: ({
fromBlock?: bigint | viem.BlockTag | undefined;
toBlock?: bigint | viem.BlockTag | undefined;
} & {
strict?: strict | undefined;
}) | undefined]) => Promise<viem.CreateContractEventFilterReturnType>;
};
getEvents: {
[x: string]: (...parameters: [options?: {
blockHash?: viem.Hash | undefined;
strict?: boolean | undefined;
fromBlock?: bigint | viem.BlockTag | undefined;
toBlock?: bigint | viem.BlockTag | undefined;
} | undefined] | [args?: readonly unknown[] | {
[x: string]: unknown;
address?: undefined;
abi?: undefined;
args?: undefined;
eventName?: undefined;
fromBlock?: undefined;
onError?: undefined;
onLogs?: undefined;
strict?: undefined;
poll?: undefined;
batch?: undefined;
pollingInterval?: undefined;
} | undefined, options?: {
blockHash?: viem.Hash | undefined;
strict?: boolean | undefined;
fromBlock?: bigint | viem.BlockTag | undefined;
toBlock?: bigint | viem.BlockTag | undefined;
} | undefined]) => Promise<viem.GetContractEventsReturnType<ABI, string>>;
};
watchEvent: {
[x: string]: (...parameters: [options?: {
batch?: boolean | undefined;
pollingInterval?: number | undefined;
strict?: boolean | undefined;
fromBlock?: viem.BlockNumber<bigint> | undefined;
onError?: ((error: Error) => void) | undefined;
onLogs: viem.WatchContractEventOnLogsFn<ABI, string, undefined>;
poll?: true | undefined;
} | undefined] | [args: readonly unknown[] | {
[x: string]: unknown;
address?: undefined;
abi?: undefined;
args?: undefined;
eventName?: undefined;
fromBlock?: undefined;
onError?: undefined;
onLogs?: undefined;
strict?: undefined;
poll?: undefined;
batch?: undefined;
pollingInterval?: undefined;
}, options?: {
batch?: boolean | undefined;
pollingInterval?: number | undefined;
strict?: boolean | undefined;
fromBlock?: viem.BlockNumber<bigint> | undefined;
onError?: ((error: Error) => void) | undefined;
onLogs: viem.WatchContractEventOnLogsFn<ABI, string, undefined>;
poll?: true | undefined;
} | undefined]) => viem.WatchContractEventReturnType;
};
write: {
[x: string]: <chainOverride extends viem.Chain | undefined, options extends viem.UnionOmit<viem.WriteContractParameters<ABI, string, readonly unknown[], viem.Chain | undefined, undefined, chainOverride>, "address" | "functionName" | "args" | "abi"> extends infer T ? { [K in keyof T]: viem.UnionOmit<viem.WriteContractParameters<ABI, string, readonly unknown[], viem.Chain | undefined, undefined, chainOverride>, "address" | "functionName" | "args" | "abi">[K]; } : never, Rest extends unknown[] = [options: options]>(...parameters: Rest | [args: readonly unknown[], ...parameters: Rest]) => Promise<viem.WriteContractReturnType>;
};
address: `0x${string}`;
abi: ABI;
}>;
/**
* The function returns an instance of the Core Proxy smart contract
* @returns Contract - Instance of Core Proxy smart contract
*/
getCoreProxyInstance(): Promise<{
read: {
[x: string]: (...parameters: [options?: viem.Prettify<viem.UnionOmit<viem.ReadContractParameters<ABI, string, readonly unknown[]>, "address" | "functionName" | "args" | "abi">> | undefined] | [args: readonly unknown[], options?: viem.Prettify<viem.UnionOmit<viem.ReadContractParameters<ABI, string, readonly unknown[]>, "address" | "functionName" | "args" | "abi">> | undefined]) => Promise<viem.ReadContractReturnType>;
};
estimateGas: {
[x: string]: (...parameters: [options: viem.Prettify<viem.UnionOmit<viem.EstimateContractGasParameters<ABI, string, readonly unknown[], viem.Chain | undefined>, "address" | "functionName" | "args" | "abi">>] | [args: readonly unknown[], options: viem.Prettify<viem.UnionOmit<viem.EstimateContractGasParameters<ABI, string, readonly unknown[], viem.Chain | undefined>, "address" | "functionName" | "args" | "abi">>]) => Promise<viem.EstimateContractGasReturnType>;
} & {
[x: string]: (...parameters: [options: viem.Prettify<viem.UnionOmit<viem.EstimateContractGasParameters<ABI, string, readonly unknown[], viem.Chain | undefined>, "address" | "functionName" | "args" | "abi">>] | [args: readonly unknown[], options: viem.Prettify<viem.UnionOmit<viem.EstimateContractGasParameters<ABI, string, readonly unknown[], viem.Chain | undefined>, "address" | "functionName" | "args" | "abi">>]) => Promise<viem.EstimateContractGasReturnType>;
};
simulate: {
[x: string]: <chainOverride extends viem.Chain | undefined = undefined, accountOverride extends viem.Account | viem.Address | undefined = undefined>(...parameters: [options?: Omit<viem.SimulateContractParameters<ABI, string, readonly unknown[], viem.Chain | undefined, chainOverride, accountOverride>, "address" | "functionName" | "args" | "abi"> | undefined] | [args: readonly unknown[], options?: Omit<viem.SimulateContractParameters<ABI, string, readonly unknown[], viem.Chain | undefined, chainOverride, accountOverride>, "address" | "functionName" | "args" | "abi"> | undefined]) => Promise<viem.SimulateContractReturnType>;
};
createEventFilter: {
[x: string]: <strict extends boolean | undefined = undefined>(...parameters: [options?: ({
fromBlock?: bigint | viem.BlockTag | undefined;
toBlock?: bigint | viem.BlockTag | undefined;
} & {
strict?: strict | undefined;
}) | undefined] | [args: readonly unknown[] | {
[x: string]: unknown;
address?: undefined;
abi?: undefined;
eventName?: undefined;
fromBlock?: undefined;
strict?: undefined;
toBlock?: undefined;
args?: undefined;
}, options?: ({
fromBlock?: bigint | viem.BlockTag | undefined;
toBlock?: bigint | viem.BlockTag | undefined;
} & {
strict?: strict | undefined;
}) | undefined]) => Promise<viem.CreateContractEventFilterReturnType>;
};
getEvents: {
[x: string]: (...parameters: [options?: {
blockHash?: viem.Hash | undefined;
strict?: boolean | undefined;
fromBlock?: bigint | viem.BlockTag | undefined;
toBlock?: bigint | viem.BlockTag | undefined;
} | undefined] | [args?: readonly unknown[] | {
[x: string]: unknown;
address?: undefined;
abi?: undefined;
args?: undefined;
eventName?: undefined;
fromBlock?: undefined;
onError?: undefined;
onLogs?: undefined;
strict?: undefined;
poll?: undefined;
batch?: undefined;
pollingInterval?: undefined;
} | undefined, options?: {
blockHash?: viem.Hash | undefined;
strict?: boolean | undefined;
fromBlock?: bigint | viem.BlockTag | undefined;
toBlock?: bigint | viem.BlockTag | undefined;
} | undefined]) => Promise<viem.GetContractEventsReturnType<ABI, string>>;
};
watchEvent: {
[x: string]: (...parameters: [options?: {
batch?: boolean | undefined;
pollingInterval?: number | undefined;
strict?: boolean | undefined;
fromBlock?: viem.BlockNumber<bigint> | undefined;
onError?: ((error: Error) => void) | undefined;
onLogs: viem.WatchContractEventOnLogsFn<ABI, string, undefined>;
poll?: true | undefined;
} | undefined] | [args: readonly unknown[] | {
[x: string]: unknown;
address?: undefined;
abi?: undefined;
args?: undefined;
eventName?: undefined;
fromBlock?: undefined;
onError?: undefined;
onLogs?: undefined;
strict?: undefined;
poll?: undefined;
batch?: undefined;
pollingInterval?: undefined;
}, options?: {
batch?: boolean | undefined;
pollingInterval?: number | undefined;
strict?: boolean | undefined;
fromBlock?: viem.BlockNumber<bigint> | undefined;
onError?: ((error: Error) => void) | undefined;
onLogs: viem.WatchContractEventOnLogsFn<ABI, string, undefined>;
poll?: true | undefined;
} | undefined]) => viem.WatchContractEventReturnType;
};
write: {
[x: string]: <chainOverride extends viem.Chain | undefined, options extends viem.UnionOmit<viem.WriteContractParameters<ABI, string, readonly unknown[], viem.Chain | undefined, undefined, chainOverride>, "address" | "functionName" | "args" | "abi"> extends infer T ? { [K in keyof T]: viem.UnionOmit<viem.WriteContractParameters<ABI, string, readonly unknown[], viem.Chain | undefined, undefined, chainOverride>, "address" | "functionName" | "args" | "abi">[K]; } : never, Rest extends unknown[] = [options: options]>(...parameters: Rest | [args: readonly unknown[], ...parameters: Rest]) => Promise<viem.WriteContractReturnType>;
};
address: `0x${string}`;
abi: ABI;
}>;
/**
* The function returns an instance of the Account Proxy smart contract
* @returns Contract - Instance of Account Proxy smart contract
*/
getAccountProxyInstance(): Promise<{
read: {
[x: string]: (...parameters: [options?: viem.Prettify<viem.UnionOmit<viem.ReadContractParameters<ABI, string, readonly unknown[]>, "address" | "functionName" | "args" | "abi">> | undefined] | [args: readonly unknown[], options?: viem.Prettify<viem.UnionOmit<viem.ReadContractParameters<ABI, string, readonly unknown[]>, "address" | "functionName" | "args" | "abi">> | undefined]) => Promise<viem.ReadContractReturnType>;
};
estimateGas: {
[x: string]: (...parameters: [options: viem.Prettify<viem.UnionOmit<viem.EstimateContractGasParameters<ABI, string, readonly unknown[], viem.Chain | undefined>, "address" | "functionName" | "args" | "abi">>] | [args: readonly unknown[], options: viem.Prettify<viem.UnionOmit<viem.EstimateContractGasParameters<ABI, string, readonly unknown[], viem.Chain | undefined>, "address" | "functionName" | "args" | "abi">>]) => Promise<viem.EstimateContractGasReturnType>;
} & {
[x: string]: (...parameters: [options: viem.Prettify<viem.UnionOmit<viem.EstimateContractGasParameters<ABI, string, readonly unknown[], viem.Chain | undefined>, "address" | "functionName" | "args" | "abi">>] | [args: readonly unknown[], options: viem.Prettify<viem.UnionOmit<viem.EstimateContractGasParameters<ABI, string, readonly unknown[], viem.Chain | undefined>, "address" | "functionName" | "args" | "abi">>]) => Promise<viem.EstimateContractGasReturnType>;
};
simulate: {
[x: string]: <chainOverride extends viem.Chain | undefined = undefined, accountOverride extends viem.Account | viem.Address | undefined = undefined>(...parameters: [options?: Omit<viem.SimulateContractParameters<ABI, string, readonly unknown[], viem.Chain | undefined, chainOverride, accountOverride>, "address" | "functionName" | "args" | "abi"> | undefined] | [args: readonly unknown[], options?: Omit<viem.SimulateContractParameters<ABI, string, readonly unknown[], viem.Chain | undefined, chainOverride, accountOverride>, "address" | "functionName" | "args" | "abi"> | undefined]) => Promise<viem.SimulateContractReturnType>;
};
createEventFilter: {
[x: string]: <strict extends boolean | undefined = undefined>(...parameters: [options?: ({
fromBlock?: bigint | viem.BlockTag | undefined;
toBlock?: bigint | viem.BlockTag | undefined;
} & {
strict?: strict | undefined;
}) | undefined] | [args: readonly unknown[] | {
[x: string]: unknown;
address?: undefined;
abi?: undefined;
eventName?: undefined;
fromBlock?: undefined;
strict?: undefined;
toBlock?: undefined;
args?: undefined;
}, options?: ({
fromBlock?: bigint | viem.BlockTag | undefined;
toBlock?: bigint | viem.BlockTag | undefined;
} & {
strict?: strict | undefined;
}) | undefined]) => Promise<viem.CreateContractEventFilterReturnType>;
};
getEvents: {
[x: string]: (...parameters: [options?: {
blockHash?: viem.Hash | undefined;
strict?: boolean | undefined;
fromBlock?: bigint | viem.BlockTag | undefined;
toBlock?: bigint | viem.BlockTag | undefined;
} | undefined] | [args?: readonly unknown[] | {
[x: string]: unknown;
address?: undefined;
abi?: undefined;
args?: undefined;
eventName?: undefined;
fromBlock?: undefined;
onError?: undefined;
onLogs?: undefined;
strict?: undefined;
poll?: undefined;
batch?: undefined;
pollingInterval?: undefined;
} | undefined, options?: {
blockHash?: viem.Hash | undefined;
strict?: boolean | undefined;
fromBlock?: bigint | viem.BlockTag | undefined;
toBlock?: bigint | viem.BlockTag | undefined;
} | undefined]) => Promise<viem.GetContractEventsReturnType<ABI, string>>;
};
watchEvent: {
[x: string]: (...parameters: [options?: {
batch?: boolean | undefined;
pollingInterval?: number | undefined;
strict?: boolean | undefined;
fromBlock?: viem.BlockNumber<bigint> | undefined;
onError?: ((error: Error) => void) | undefined;
onLogs: viem.WatchContractEventOnLogsFn<ABI, string, undefined>;
poll?: true | undefined;
} | undefined] | [args: readonly unknown[] | {
[x: string]: unknown;
address?: undefined;
abi?: undefined;
args?: undefined;
eventName?: undefined;
fromBlock?: undefined;
onError?: undefined;
onLogs?: undefined;
strict?: undefined;
poll?: undefined;
batch?: undefined;
pollingInterval?: undefined;
}, options?: {
batch?: boolean | undefined;
pollingInterval?: number | undefined;
strict?: boolean | undefined;
fromBlock?: viem.BlockNumber<bigint> | undefined;
onError?: ((error: Error) => void) | undefined;
onLogs: viem.WatchContractEventOnLogsFn<ABI, string, undefined>;
poll?: true | undefined;
} | undefined]) => viem.WatchContractEventReturnType;
};
write: {
[x: string]: <chainOverride extends viem.Chain | undefined, options extends viem.UnionOmit<viem.WriteContractParameters<ABI, string, readonly unknown[], viem.Chain | undefined, undefined, chainOverride>, "address" | "functionName" | "args" | "abi"> extends infer T ? { [K in keyof T]: viem.UnionOmit<viem.WriteContractParameters<ABI, string, readonly unknown[], viem.Chain | undefined, undefined, chainOverride>, "address" | "functionName" | "args" | "abi">[K]; } : never, Rest extends unknown[] = [options: options]>(...parameters: Rest | [args: readonly unknown[], ...parameters: Rest]) => Promise<viem.WriteContractReturnType>;
};
address: `0x${string}`;
abi: ABI;
}>;
/**
* The function returns an instance of the PerpsMarketProxy smart contract
* @returns Contract - Instance of PerpsMarketProxy smart contract
*/
getPerpsMarketProxyInstance(): Promise<{
read: {
[x: string]: (...parameters: [options?: viem.Prettify<viem.UnionOmit<viem.ReadContractParameters<ABI, string, readonly unknown[]>, "address" | "functionName" | "args" | "abi">> | undefined] | [args: readonly unknown[], options?: viem.Prettify<viem.UnionOmit<viem.ReadContractParameters<ABI, string, readonly unknown[]>, "address" | "functionName" | "args" | "abi">> | undefined]) => Promise<viem.ReadContractReturnType>;
};
estimateGas: {
[x: string]: (...parameters: [options: viem.Prettify<viem.UnionOmit<viem.EstimateContractGasParameters<ABI, string, readonly unknown[], viem.Chain | undefined>, "address" | "functionName" | "args" | "abi">>] | [args: readonly unknown[], options: viem.Prettify<viem.UnionOmit<viem.EstimateContractGasParameters<ABI, string, readonly unknown[], viem.Chain | undefined>, "address" | "functionName" | "args" | "abi">>]) => Promise<viem.EstimateContractGasReturnType>;
} & {
[x: string]: (...parameters: [options: viem.Prettify<viem.UnionOmit<viem.EstimateContractGasParameters<ABI, string, readonly unknown[], viem.Chain | undefined>, "address" | "functionName" | "args" | "abi">>] | [args: readonly unknown[], options: viem.Prettify<viem.UnionOmit<viem.EstimateContractGasParameters<ABI, string, readonly unknown[], viem.Chain | undefined>, "address" | "functionName" | "args" | "abi">>]) => Promise<viem.EstimateContractGasReturnType>;
};
simulate: {
[x: string]: <chainOverride extends viem.Chain | undefined = undefined, accountOverride extends viem.Account | viem.Address | undefined = undefined>(...parameters: [options?: Omit<viem.SimulateContractParameters<ABI, string, readonly unknown[], viem.Chain | undefined, chainOverride, accountOverride>, "address" | "functionName" | "args" | "abi"> | undefined] | [args: readonly unknown[], options?: Omit<viem.SimulateContractParameters<ABI, string, readonly unknown[], viem.Chain | undefined, chainOverride, accountOverride>, "address" | "functionName" | "args" | "abi"> | undefined]) => Promise<viem.SimulateContractReturnType>;
};
createEventFilter: {
[x: string]: <strict extends boolean | undefined = undefined>(...parameters: [options?: ({
fromBlock?: bigint | viem.BlockTag | undefined;
toBlock?: bigint | viem.BlockTag | undefined;
} & {
strict?: strict | undefined;
}) | undefined] | [args: readonly unknown[] | {
[x: string]: unknown;
address?: undefined;
abi?: undefined;
eventName?: undefined;
fromBlock?: undefined;
strict?: undefined;
toBlock?: undefined;
args?: undefined;
}, options?: ({
fromBlock?: bigint | viem.BlockTag | undefined;
toBlock?: bigint | viem.BlockTag | undefined;
} & {
strict?: strict | undefined;
}) | undefined]) => Promise<viem.CreateContractEventFilterReturnType>;
};
getEvents: {
[x: string]: (...parameters: [options?: {
blockHash?: viem.Hash | undefined;
strict?: boolean | undefined;
fromBlock?: bigint | viem.BlockTag | undefined;
toBlock?: bigint | viem.BlockTag | undefined;
} | undefined] | [args?: readonly unknown[] | {
[x: string]: unknown;
address?: undefined;
abi?: undefined;
args?: undefined;
eventName?: undefined;
fromBlock?: undefined;
onError?: undefined;
onLogs?: undefined;
strict?: undefined;
poll?: undefined;
batch?: undefined;
pollingInterval?: undefined;
} | undefined, options?: {
blockHash?: viem.Hash | undefined;
strict?: boolean | undefined;
fromBlock?: bigint | viem.BlockTag | undefined;
toBlock?: bigint | viem.BlockTag | undefined;
} | undefined]) => Promise<viem.GetContractEventsReturnType<ABI, string>>;
};
watchEvent: {
[x: string]: (...parameters: [options?: {
batch?: boolean | undefined;
pollingInterval?: number | undefined;
strict?: boolean | undefined;
fromBlock?: viem.BlockNumber<bigint> | undefined;
onError?: ((error: Error) => void) | undefined;
onLogs: viem.WatchContractEventOnLogsFn<ABI, string, undefined>;
poll?: true | undefined;
} | undefined] | [args: readonly unknown[] | {
[x: string]: unknown;
address?: undefined;
abi?: undefined;
args?: undefined;
eventName?: undefined;
fromBlock?: undefined;
onError?: undefined;
onLogs?: undefined;
strict?: undefined;
poll?: undefined;
batch?: undefined;
pollingInterval?: undefined;
}, options?: {
batch?: boolean | undefined;
pollingInterval?: number | undefined;
strict?: boolean | undefined;
fromBlock?: viem.BlockNumber<bigint> | undefined;
onError?: ((error: Error) => void) | undefined;
onLogs: viem.WatchContractEventOnLogsFn<ABI, string, undefined>;
poll?: true | undefined;
} | undefined]) => viem.WatchContractEventReturnType;
};
write: {
[x: string]: <chainOverride extends viem.Chain | undefined, options extends viem.UnionOmit<viem.WriteContractParameters<ABI, string, readonly unknown[], viem.Chain | undefined, undefined, chainOverride>, "address" | "functionName" | "args" | "abi"> extends infer T ? { [K in keyof T]: viem.UnionOmit<viem.WriteContractParameters<ABI, string, readonly unknown[], viem.Chain | undefined, undefined, chainOverride>, "address" | "functionName" | "args" | "abi">[K]; } : never, Rest extends unknown[] = [options: options]>(...parameters: Rest | [args: readonly unknown[], ...parameters: Rest]) => Promise<viem.WriteContractReturnType>;
};
address: `0x${string}`;
abi: ABI;
}>;
/**
* The function returns an instance of the PerpsAccount Proxy smart contract
* @returns Contract - Instance of PerpsAccount Proxy smart contract
*/
getPerpsAccountProxyInstance(): Promise<{
read: {
[x: string]: (...parameters: [options?: viem.Prettify<viem.UnionOmit<viem.ReadContractParameters<ABI, string, readonly unknown[]>, "address" | "functionName" | "args" | "abi">> | undefined] | [args: readonly unknown[], options?: viem.Prettify<viem.UnionOmit<viem.ReadContractParameters<ABI, string, readonly unknown[]>, "address" | "functionName" | "args" | "abi">> | undefined]) => Promise<viem.ReadContractReturnType>;
};
estimateGas: {
[x: string]: (...parameters: [options: viem.Prettify<viem.UnionOmit<viem.EstimateContractGasParameters<ABI, string, readonly unknown[], viem.Chain | undefined>, "address" | "functionName" | "args" | "abi">>] | [args: readonly unknown[], options: viem.Prettify<viem.UnionOmit<viem.EstimateContractGasParameters<ABI, string, readonly unknown[], viem.Chain | undefined>, "address" | "functionName" | "args" | "abi">>]) => Promise<viem.EstimateContractGasReturnType>;
} & {
[x: string]: (...parameters: [options: viem.Prettify<viem.UnionOmit<viem.EstimateContractGasParameters<ABI, string, readonly unknown[], viem.Chain | undefined>, "address" | "functionName" | "args" | "abi">>] | [args: readonly unknown[], options: viem.Prettify<viem.UnionOmit<viem.EstimateContractGasParameters<ABI, string, readonly unknown[], viem.Chain | undefined>, "address" | "functionName" | "args" | "abi">>]) => Promise<viem.EstimateContractGasReturnType>;
};
simulate: {
[x: string]: <chainOverride extends viem.Chain | undefined = undefined, accountOverride extends viem.Account | viem.Address | undefined = undefined>(...parameters: [options?: Omit<viem.SimulateContractParameters<ABI, string, readonly unknown[], viem.Chain | undefined, chainOverride, accountOverride>, "address" | "functionName" | "args" | "abi"> | undefined] | [args: readonly unknown[], options?: Omit<viem.SimulateContractParameters<ABI, string, readonly unknown[], viem.Chain | undefined, chainOverride, accountOverride>, "address" | "functionName" | "args" | "abi"> | undefined]) => Promise<viem.SimulateContractReturnType>;
};
createEventFilter: {
[x: string]: <strict extends boolean | undefined = undefined>(...parameters: [options?: ({
fromBlock?: bigint | viem.BlockTag | undefined;
toBlock?: bigint | viem.BlockTag | undefined;
} & {
strict?: strict | undefined;
}) | undefined] | [args: readonly unknown[] | {
[x: string]: unknown;
address?: undefined;
abi?: undefined;
eventName?: undefined;
fromBlock?: undefined;
strict?: undefined;
toBlock?: undefined;
args?: undefined;
}, options?: ({
fromBlock?: bigint | viem.BlockTag | undefined;
toBlock?: bigint | viem.BlockTag | undefined;
} & {
strict?: strict | undefined;
}) | undefined]) => Promise<viem.CreateContractEventFilterReturnType>;
};
getEvents: {
[x: string]: (...parameters: [options?: {
blockHash?: viem.Hash | undefined;
strict?: boolean | undefined;
fromBlock?: bigint | viem.BlockTag | undefined;
toBlock?: bigint | viem.BlockTag | undefined;
} | undefined] | [args?: readonly unknown[] | {
[x: string]: unknown;
address?: undefined;
abi?: undefined;
args?: undefined;
eventName?: undefined;
fromBlock?: undefined;
onError?: undefined;
onLogs?: undefined;
strict?: undefined;
poll?: undefined;
batch?: undefined;
pollingInterval?: undefined;
} | undefined, options?: {
blockHash?: viem.Hash | undefined;
strict?: boolean | undefined;
fromBlock?: bigint | viem.BlockTag | undefined;
toBlock?: bigint | viem.BlockTag | undefined;
} | undefined]) => Promise<viem.GetContractEventsReturnType<ABI, string>>;
};
watchEvent: {
[x: string]: (...parameters: [options?: {
batch?: boolean | undefined;
pollingInterval?: number | undefined;
strict?: boolean | undefined;
fromBlock?: viem.BlockNumber<bigint> | undefined;
onError?: ((error: Error) => void) | undefined;
onLogs: viem.WatchContractEventOnLogsFn<ABI, string, undefined>;
poll?: true | undefined;
} | undefined] | [args: readonly unknown[] | {
[x: string]: unknown;
address?: undefined;
abi?: undefined;
args?: undefined;
eventName?: undefined;
fromBlock?: undefined;
onError?: undefined;
onLogs?: undefined;
strict?: undefined;
poll?: undefined;
batch?: undefined;
pollingInterval?: undefined;
}, options?: {
batch?: boolean | undefined;
pollingInterval?: number | undefined;
strict?: boolean | undefined;
fromBlock?: viem.BlockNumber<bigint> | undefined;
onError?: ((error: Error) => void) | undefined;
onLogs: viem.WatchContractEventOnLogsFn<ABI, string, undefined>;
poll?: true | undefined;
} | undefined]) => viem.WatchContractEventReturnType;
};
write: {
[x: string]: <chainOverride extends viem.Chain | undefined, options extends viem.UnionOmit<viem.WriteContractParameters<ABI, string, readonly unknown[], viem.Chain | undefined, undefined, chainOverride>, "address" | "functionName" | "args" | "abi"> extends infer T ? { [K in keyof T]: viem.UnionOmit<viem.WriteContractParameters<ABI, string, readonly unknown[], viem.Chain | undefined, undefined, chainOverride>, "address" | "functionName" | "args" | "abi">[K]; } : never, Rest extends unknown[] = [options: options]>(...parameters: Rest | [args: readonly unknown[], ...parameters: Rest]) => Promise<viem.WriteContractReturnType>;
};
address: `0x${string}`;
abi: ABI;
}>;
/**
* The function returns an instance of the PythERC7412Wrapper smart contract
* @returns Contract - Instance of PythERC7412Wrapper smart contract
*/
getPythErc7412WrapperInstance(): Promise<{
read: {
[x: string]: (...parameters: [options?: viem.Prettify<viem.UnionOmit<viem.ReadContractParameters<ABI, string, readonly unknown[]>, "address" | "functionName" | "args" | "abi">> | undefined] | [args: readonly unknown[], options?: viem.Prettify<viem.UnionOmit<viem.ReadContractParameters<ABI, string, readonly unknown[]>, "address" | "functionName" | "args" | "abi">> | undefined]) => Promise<viem.ReadContractReturnType>;
};
estimateGas: {
[x: string]: (...parameters: [options: viem.Prettify<viem.UnionOmit<viem.EstimateContractGasParameters<ABI, string, readonly unknown[], viem.Chain | undefined>, "address" | "functionName" | "args" | "abi">>] | [args: readonly unknown[], options: viem.Prettify<viem.UnionOmit<viem.EstimateContractGasParameters<ABI, string, readonly unknown[], viem.Chain | undefined>, "address" | "functionName" | "args" | "abi">>]) => Promise<viem.EstimateContractGasReturnType>;
} & {
[x: string]: (...parameters: [options: viem.Prettify<viem.UnionOmit<viem.EstimateContractGasParameters<ABI, string, readonly unknown[], viem.Chain | undefined>, "address" | "functionName" | "args" | "abi">>] | [args: readonly unknown[], options: viem.Prettify<viem.UnionOmit<viem.EstimateContractGasParameters<ABI, string, readonly unknown[], viem.Chain | undefined>, "address" | "functionName" | "args" | "abi">>]) => Promise<viem.EstimateContractGasReturnType>;
};
simulate: {
[x: string]: <chainOverride extends viem.Chain | undefined = undefined, accountOverride extends viem.Account | viem.Address | undefined = undefined>(...parameters: [options?: Omit<viem.SimulateContractParameters<ABI, string, readonly unknown[], viem.Chain | undefined, chainOverride, accountOverride>, "address" | "functionName" | "args" | "abi"> | undefined] | [args: readonly unknown[], options?: Omit<viem.SimulateContractParameters<ABI, string, readonly unknown[], viem.Chain | undefined, chainOverride, accountOverride>, "address" | "functionName" | "args" | "abi"> | undefined]) => Promise<viem.SimulateContractReturnType>;
};
createEventFilter: {
[x: string]: <strict extends boolean | undefined = undefined>(...parameters: [options?: ({
fromBlock?: bigint | viem.BlockTag | undefined;
toBlock?: bigint | viem.BlockTag | undefined;
} & {
strict?: strict | undefined;
}) | undefined] | [args: readonly unknown[] | {
[x: string]: unknown;
address?: undefined;
abi?: undefined;
eventName?: undefined;
fromBlock?: undefined;
strict?: undefined;
toBlock?: undefined;
args?: undefined;
}, options?: ({
fromBlock?: bigint | viem.BlockTag | undefined;
toBlock?: bigint | viem.BlockTag | undefined;
} & {
strict?: strict | undefined;
}) | undefined]) => Promise<viem.CreateContractEventFilterReturnType>;
};
getEvents: {
[x: string]: (...parameters: [options?: {
blockHash?: viem.Hash | undefined;
strict?: boolean | undefined;
fromBlock?: bigint | viem.BlockTag | undefined;
toBlock?: bigint | viem.BlockTag | undefined;
} | undefined] | [args?: readonly unknown[] | {
[x: string]: unknown;
address?: undefined;
abi?: undefined;
args?: undefined;
eventName?: undefined;
fromBlock?: undefined;
onError?: undefined;
onLogs?: undefined;
strict?: undefined;
poll?: undefined;
batch?: undefined;
pollingInterval?: undefined;
} | undefined, options?: {
blockHash?: viem.Hash | undefined;
strict?: boolean | undefined;
fromBlock?: bigint | viem.BlockTag | undefined;
toBlock?: bigint | viem.BlockTag | undefined;
} | undefined]) => Promise<viem.GetContractEventsReturnType<ABI, string>>;
};
watchEvent: {
[x: string]: (...parameters: [options?: {
batch?: boolean | undefined;
pollingInterval?: number | undefined;
strict?: boolean | undefined;
fromBlock?: viem.BlockNumber<bigint> | undefined;
onError?: ((error: Error) => void) | undefined;
onLogs: viem.WatchContractEventOnLogsFn<ABI, string, undefined>;
poll?: true | undefined;
} | undefined] | [args: readonly unknown[] | {
[x: string]: unknown;
address?: undefined;
abi?: undefined;
args?: undefined;
eventName?: undefined;
fromBlock?: undefined;
onError?: undefined;
onLogs?: undefined;
strict?: undefined;
poll?: undefined;
batch?: undefined;
pollingInterval?: undefined;
}, options?: {
batch?: boolean | undefined;
pollingInterval?: number | undefined;
strict?: boolean | undefined;
fromBlock?: viem.BlockNumber<bigint> | undefined;
onError?: ((error: Error) => void) | undefined;
onLogs: viem.WatchContractEventOnLogsFn<ABI, string, undefined>;
poll?: true | undefined;
} | undefined]) => viem.WatchContractEventReturnType;
};
write: {
[x: strin