UNPKG

@mysten/sui

Version:
650 lines (649 loc) 27.2 kB
import { CheckpointId, DevInspectArgs, DynamicFieldName, EventId, ExecuteTransactionRequestType, GetPastObjectRequest, RPCTransactionRequestParams, SuiEventFilter, SuiObjectDataOptions, SuiObjectResponseQuery, SuiTransactionBlockBuilderMode, SuiTransactionBlockResponseOptions, SuiTransactionBlockResponseQuery, TransactionFilter, ZkLoginIntentScope } from "./generated.mjs"; import { Transaction } from "../../transactions/Transaction.mjs"; import "../../transactions/index.mjs"; //#region src/jsonRpc/types/params.d.ts /** * Runs the transaction in dev-inspect mode. Which allows for nearly any transaction (or Move call) * with any arguments. Detailed results are provided, including both the transaction effects and any * return values. */ interface DevInspectTransactionBlockParams { sender: string; /** BCS encoded TransactionKind(as opposed to TransactionData, which include gasBudget and gasPrice) */ transactionBlock: Transaction | Uint8Array | string; /** Gas is not charged, but gas usage is still calculated. Default to use reference gas price */ gasPrice?: bigint | number | null | undefined; /** The epoch to perform the call. Will be set from the system state object if not provided */ epoch?: string | null | undefined; /** Additional arguments including gas_budget, gas_objects, gas_sponsor and skip_checks. */ additionalArgs?: DevInspectArgs | null | undefined; signal?: AbortSignal; } /** * Return transaction execution effects including the gas cost summary, while the effects are not * committed to the chain. */ interface DryRunTransactionBlockParams { transactionBlock: Uint8Array | string; signal?: AbortSignal; } /** * Execute the transaction and wait for results if desired. Request types: 1. WaitForEffectsCert: waits * for TransactionEffectsCert and then return to client. This mode is a proxy for transaction * finality. 2. WaitForLocalExecution: waits for TransactionEffectsCert and make sure the node executed * the transaction locally before returning the client. The local execution makes sure this node is * aware of this transaction when client fires subsequent queries. However if the node fails to execute * the transaction locally in a timely manner, a bool type in the response is set to false to indicated * the case. request_type is default to be `WaitForEffectsCert` unless options.show_events or * options.show_effects is true */ interface ExecuteTransactionBlockParams { /** BCS serialized transaction data bytes without its type tag, as base-64 encoded string. */ transactionBlock: Uint8Array | string; /** * A list of signatures (`flag || signature || pubkey` bytes, as base-64 encoded string). Signature is * committed to the intent message of the transaction data, as base-64 encoded string. */ signature: string | string[]; /** options for specifying the content to be returned */ options?: SuiTransactionBlockResponseOptions | null | undefined; /** @deprecated requestType will be ignored by JSON RPC in the future */ requestType?: ExecuteTransactionRequestType | null | undefined; signal?: AbortSignal; } /** Return the first four bytes of the chain's genesis checkpoint digest. */ interface GetChainIdentifierParams { signal?: AbortSignal; } /** Return a checkpoint */ interface GetCheckpointParams { /** Checkpoint identifier, can use either checkpoint digest, or checkpoint sequence number as input. */ id: CheckpointId; signal?: AbortSignal; } /** Return paginated list of checkpoints */ interface GetCheckpointsParams { /** * An optional paging cursor. If provided, the query will start from the next item after the specified * cursor. Default to start from the first item if not specified. */ cursor?: string | null | undefined; /** Maximum item returned per page, default to [QUERY_MAX_RESULT_LIMIT_CHECKPOINTS] if not specified. */ limit?: number | null | undefined; /** query result ordering, default to false (ascending order), oldest record first. */ descendingOrder: boolean; signal?: AbortSignal; } /** Return transaction events. */ interface GetEventsParams { /** the event query criteria. */ transactionDigest: string; signal?: AbortSignal; } /** Return the sequence number of the latest checkpoint that has been executed */ interface GetLatestCheckpointSequenceNumberParams { signal?: AbortSignal; } /** Return the argument types of a Move function, based on normalized Type. */ interface GetMoveFunctionArgTypesParams { package: string; module: string; function: string; signal?: AbortSignal; } /** Return a structured representation of Move function */ interface GetNormalizedMoveFunctionParams { package: string; module: string; function: string; signal?: AbortSignal; } /** Return a structured representation of Move module */ interface GetNormalizedMoveModuleParams { package: string; module: string; signal?: AbortSignal; } /** Return structured representations of all modules in the given package */ interface GetNormalizedMoveModulesByPackageParams { package: string; signal?: AbortSignal; } /** Return a structured representation of Move struct */ interface GetNormalizedMoveStructParams { package: string; module: string; struct: string; signal?: AbortSignal; } /** Return the object information for a specified object */ interface GetObjectParams { /** the ID of the queried object */ id: string; /** options for specifying the content to be returned */ options?: SuiObjectDataOptions | null | undefined; signal?: AbortSignal; } /** * Return the protocol config table for the given version number. If the version number is not * specified, If none is specified, the node uses the version of the latest epoch it has processed. */ interface GetProtocolConfigParams { /** * An optional protocol version specifier. If omitted, the latest protocol config table for the node * will be returned. */ version?: string | null | undefined; signal?: AbortSignal; } /** Return the total number of transaction blocks known to the server. */ interface GetTotalTransactionBlocksParams { signal?: AbortSignal; } /** Return the transaction response object. */ interface GetTransactionBlockParams { /** the digest of the queried transaction */ digest: string; /** options for specifying the content to be returned */ options?: SuiTransactionBlockResponseOptions | null | undefined; signal?: AbortSignal; } /** Return the object data for a list of objects */ interface MultiGetObjectsParams { /** the IDs of the queried objects */ ids: string[]; /** options for specifying the content to be returned */ options?: SuiObjectDataOptions | null | undefined; signal?: AbortSignal; } /** * Returns an ordered list of transaction responses The method will throw an error if the input * contains any duplicate or the input size exceeds QUERY_MAX_RESULT_LIMIT */ interface MultiGetTransactionBlocksParams { /** A list of transaction digests. */ digests: string[]; /** config options to control which fields to fetch */ options?: SuiTransactionBlockResponseOptions | null | undefined; signal?: AbortSignal; } /** * Note there is no software-level guarantee/SLA that objects with past versions can be retrieved by * this API, even if the object and version exists/existed. The result may vary across nodes depending * on their pruning policies. Return the object information for a specified version */ interface TryGetPastObjectParams { /** the ID of the queried object */ id: string; /** the version of the queried object. If None, default to the latest known version */ version: number; /** options for specifying the content to be returned */ options?: SuiObjectDataOptions | null | undefined; signal?: AbortSignal; } /** * Note there is no software-level guarantee/SLA that objects with past versions can be retrieved by * this API, even if the object and version exists/existed. The result may vary across nodes depending * on their pruning policies. Return the object information for a specified version */ interface TryMultiGetPastObjectsParams { /** a vector of object and versions to be queried */ pastObjects: GetPastObjectRequest[]; /** options for specifying the content to be returned */ options?: SuiObjectDataOptions | null | undefined; signal?: AbortSignal; } /** Verify a zklogin signature for the given bytes, intent scope and author. */ interface VerifyZkLoginSignatureParams { /** * The Base64 string of bcs bytes for raw transaction data or personal message indicated by * intent_scope. */ bytes: string; /** The Base64 string of the zklogin signature to verify. */ signature: string; /** The intent scope, either transaction data or personal message. Used to parse bytes. */ intentScope: ZkLoginIntentScope; /** The author of the signature. */ author: string; signal?: AbortSignal; } /** Return the total coin balance for all coin type, owned by the address owner. */ interface GetAllBalancesParams { /** the owner's Sui address */ owner: string; signal?: AbortSignal; } /** Return all Coin objects owned by an address. */ interface GetAllCoinsParams { /** the owner's Sui address */ owner: string; /** optional paging cursor */ cursor?: string | null | undefined; /** maximum number of items per page */ limit?: number | null | undefined; signal?: AbortSignal; } /** Return the total coin balance for one coin type, owned by the address owner. */ interface GetBalanceParams { /** the owner's Sui address */ owner: string; /** * optional type names for the coin (e.g., 0x168da5bf1f48dafc111b0a488fa454aca95e0b5e::usdc::USDC), * default to 0x2::sui::SUI if not specified. */ coinType?: string | null | undefined; signal?: AbortSignal; } /** * Return metadata (e.g., symbol, decimals) for a coin. Note that if the coin's metadata was wrapped in * the transaction that published its marker type, or the latest version of the metadata object is * wrapped or deleted, it will not be found. */ interface GetCoinMetadataParams { /** type name for the coin (e.g., 0x168da5bf1f48dafc111b0a488fa454aca95e0b5e::usdc::USDC) */ coinType: string; signal?: AbortSignal; } /** Return all Coin<`coin_type`> objects owned by an address. */ interface GetCoinsParams { /** the owner's Sui address */ owner: string; /** * optional type name for the coin (e.g., 0x168da5bf1f48dafc111b0a488fa454aca95e0b5e::usdc::USDC), * default to 0x2::sui::SUI if not specified. */ coinType?: string | null | undefined; /** optional paging cursor */ cursor?: string | null | undefined; /** maximum number of items per page */ limit?: number | null | undefined; signal?: AbortSignal; } /** Return the committee information for the asked `epoch`. */ interface GetCommitteeInfoParams { /** The epoch of interest. If None, default to the latest epoch */ epoch?: string | null | undefined; signal?: AbortSignal; } /** Return the dynamic field object information for a specified object */ interface GetDynamicFieldObjectParams { /** The ID of the queried parent object */ parentId: string; /** The Name of the dynamic field */ name: DynamicFieldName; signal?: AbortSignal; } /** Return the list of dynamic field objects owned by an object. */ interface GetDynamicFieldsParams { /** The ID of the parent object */ parentId: string; /** * An optional paging cursor. If provided, the query will start from the next item after the specified * cursor. Default to start from the first item if not specified. */ cursor?: string | null | undefined; /** Maximum item returned per page, default to [QUERY_MAX_RESULT_LIMIT] if not specified. */ limit?: number | null | undefined; signal?: AbortSignal; } /** Return the latest SUI system state object on-chain. */ interface GetLatestSuiSystemStateParams { signal?: AbortSignal; } /** * Return the list of objects owned by an address. Note that if the address owns more than * `QUERY_MAX_RESULT_LIMIT` objects, the pagination is not accurate, because previous page may have * been updated when the next page is fetched. Please use suix_queryObjects if this is a concern. */ type GetOwnedObjectsParams = { /** the owner's Sui address */owner: string; /** * An optional paging cursor. If provided, the query will start from the next item after the specified * cursor. Default to start from the first item if not specified. */ cursor?: string | null | undefined; /** Max number of items returned per page, default to [QUERY_MAX_RESULT_LIMIT] if not specified. */ limit?: number | null | undefined; signal?: AbortSignal; } & SuiObjectResponseQuery; /** Return the reference gas price for the network */ interface GetReferenceGasPriceParams { signal?: AbortSignal; } /** Return all [DelegatedStake]. */ interface GetStakesParams { owner: string; signal?: AbortSignal; } /** Return one or more [DelegatedStake]. If a Stake was withdrawn its status will be Unstaked. */ interface GetStakesByIdsParams { stakedSuiIds: string[]; signal?: AbortSignal; } /** Return total supply for a coin */ interface GetTotalSupplyParams { /** type name for the coin (e.g., 0x168da5bf1f48dafc111b0a488fa454aca95e0b5e::usdc::USDC) */ coinType: string; signal?: AbortSignal; } /** Return the validator APY */ interface GetValidatorsApyParams { signal?: AbortSignal; } /** Return list of events for a specified query criteria. */ interface QueryEventsParams { /** * The event query criteria. See [Event filter](https://docs.sui.io/build/event_api#event-filters) * documentation for examples. */ query: SuiEventFilter; /** optional paging cursor */ cursor?: EventId | null | undefined; /** maximum number of items per page, default to [QUERY_MAX_RESULT_LIMIT] if not specified. */ limit?: number | null | undefined; /** query result ordering, default to false (ascending order), oldest record first. */ order?: 'ascending' | 'descending' | null | undefined; signal?: AbortSignal; } /** Return list of transactions for a specified query criteria. */ type QueryTransactionBlocksParams = { /** * An optional paging cursor. If provided, the query will start from the next item after the specified * cursor. Default to start from the first item if not specified. */ cursor?: string | null | undefined; /** Maximum item returned per page, default to QUERY_MAX_RESULT_LIMIT if not specified. */ limit?: number | null | undefined; /** query result ordering, default to false (ascending order), oldest record first. */ order?: 'ascending' | 'descending' | null | undefined; signal?: AbortSignal; } & SuiTransactionBlockResponseQuery; /** Return the resolved address given resolver and name */ interface ResolveNameServiceAddressParams { /** The name to resolve */ name: string; signal?: AbortSignal; } /** * Return the resolved names given address, if multiple names are resolved, the first one is the * primary name. */ interface ResolveNameServiceNamesParams { /** The address to resolve */ address: string; cursor?: string | null | undefined; limit?: number | null | undefined; signal?: AbortSignal; } /** Subscribe to a stream of Sui event */ interface SubscribeEventParams { /** * The filter criteria of the event stream. See * [Event filter](https://docs.sui.io/build/event_api#event-filters) documentation for examples. */ filter: SuiEventFilter; signal?: AbortSignal; } /** Subscribe to a stream of Sui transaction effects */ interface SubscribeTransactionParams { filter: TransactionFilter; signal?: AbortSignal; } /** Create an unsigned batched transaction. */ interface UnsafeBatchTransactionParams { /** the transaction signer's Sui address */ signer: string; /** list of transaction request parameters */ singleTransactionParams: RPCTransactionRequestParams[]; /** * gas object to be used in this transaction, node will pick one from the signer's possession if not * provided */ gas?: string | null | undefined; /** the gas budget, the transaction will fail if the gas cost exceed the budget */ gasBudget: string; /** Whether this is a regular transaction or a Dev Inspect Transaction */ txnBuilderMode?: SuiTransactionBlockBuilderMode | null | undefined; signal?: AbortSignal; } /** Create an unsigned transaction to merge multiple coins into one coin. */ interface UnsafeMergeCoinsParams { /** the transaction signer's Sui address */ signer: string; /** the coin object to merge into, this coin will remain after the transaction */ primaryCoin: string; /** * the coin object to be merged, this coin will be destroyed, the balance will be added to * `primary_coin` */ coinToMerge: string; /** * gas object to be used in this transaction, node will pick one from the signer's possession if not * provided */ gas?: string | null | undefined; /** the gas budget, the transaction will fail if the gas cost exceed the budget */ gasBudget: string; signal?: AbortSignal; } /** * Create an unsigned transaction to execute a Move call on the network, by calling the specified * function in the module of a given package. */ interface UnsafeMoveCallParams { /** the transaction signer's Sui address */ signer: string; /** the Move package ID, e.g. `0x2` */ packageObjectId: string; /** the Move module name, e.g. `pay` */ module: string; /** the move function name, e.g. `split` */ function: string; /** the type arguments of the Move function */ typeArguments: string[]; /** * the arguments to be passed into the Move function, in [SuiJson](https://docs.sui.io/build/sui-json) * format */ arguments: unknown[]; /** * gas object to be used in this transaction, node will pick one from the signer's possession if not * provided */ gas?: string | null | undefined; /** the gas budget, the transaction will fail if the gas cost exceed the budget */ gasBudget: string; /** * Whether this is a Normal transaction or a Dev Inspect Transaction. Default to be * `SuiTransactionBlockBuilderMode::Commit` when it's None. */ executionMode?: SuiTransactionBlockBuilderMode | null | undefined; signal?: AbortSignal; } /** * Send `Coin<T>` to a list of addresses, where `T` can be any coin type, following a list of amounts, * The object specified in the `gas` field will be used to pay the gas fee for the transaction. The gas * object can not appear in `input_coins`. If the gas object is not specified, the RPC server will * auto-select one. */ interface UnsafePayParams { /** the transaction signer's Sui address */ signer: string; /** the Sui coins to be used in this transaction */ inputCoins: string[]; /** the recipients' addresses, the length of this vector must be the same as amounts. */ recipients: string[]; /** the amounts to be transferred to recipients, following the same order */ amounts: string[]; /** * gas object to be used in this transaction, node will pick one from the signer's possession if not * provided */ gas?: string | null | undefined; /** the gas budget, the transaction will fail if the gas cost exceed the budget */ gasBudget: string; signal?: AbortSignal; } /** * Send all SUI coins to one recipient. This is for SUI coin only and does not require a separate gas * coin object. Specifically, what pay_all_sui does are: 1. accumulate all SUI from input coins and * deposit all SUI to the first input coin 2. transfer the updated first coin to the recipient and also * use this first coin as gas coin object. 3. the balance of the first input coin after tx is * sum(input_coins) - actual_gas_cost. 4. all other input coins other than the first are deleted. */ interface UnsafePayAllSuiParams { /** the transaction signer's Sui address */ signer: string; /** the Sui coins to be used in this transaction, including the coin for gas payment. */ inputCoins: string[]; /** the recipient address, */ recipient: string; /** the gas budget, the transaction will fail if the gas cost exceed the budget */ gasBudget: string; signal?: AbortSignal; } /** * Send SUI coins to a list of addresses, following a list of amounts. This is for SUI coin only and * does not require a separate gas coin object. Specifically, what pay_sui does are: 1. debit each * input_coin to create new coin following the order of amounts and assign it to the corresponding * recipient. 2. accumulate all residual SUI from input coins left and deposit all SUI to the first * input coin, then use the first input coin as the gas coin object. 3. the balance of the first input * coin after tx is sum(input_coins) - sum(amounts) - actual_gas_cost 4. all other input coints other * than the first one are deleted. */ interface UnsafePaySuiParams { /** the transaction signer's Sui address */ signer: string; /** the Sui coins to be used in this transaction, including the coin for gas payment. */ inputCoins: string[]; /** the recipients' addresses, the length of this vector must be the same as amounts. */ recipients: string[]; /** the amounts to be transferred to recipients, following the same order */ amounts: string[]; /** the gas budget, the transaction will fail if the gas cost exceed the budget */ gasBudget: string; signal?: AbortSignal; } /** Create an unsigned transaction to publish a Move package. */ interface UnsafePublishParams { /** the transaction signer's Sui address */ sender: string; /** the compiled bytes of a Move package */ compiledModules: string[]; /** a list of transitive dependency addresses that this set of modules depends on. */ dependencies: string[]; /** * gas object to be used in this transaction, node will pick one from the signer's possession if not * provided */ gas?: string | null | undefined; /** the gas budget, the transaction will fail if the gas cost exceed the budget */ gasBudget: string; signal?: AbortSignal; } /** Add stake to a validator's staking pool using multiple coins and amount. */ interface UnsafeRequestAddStakeParams { /** the transaction signer's Sui address */ signer: string; /** Coin<SUI> object to stake */ coins: string[]; /** stake amount */ amount?: string | null | undefined; /** the validator's Sui address */ validator: string; /** * gas object to be used in this transaction, node will pick one from the signer's possession if not * provided */ gas?: string | null | undefined; /** the gas budget, the transaction will fail if the gas cost exceed the budget */ gasBudget: string; signal?: AbortSignal; } /** Withdraw stake from a validator's staking pool. */ interface UnsafeRequestWithdrawStakeParams { /** the transaction signer's Sui address */ signer: string; /** StakedSui object ID */ stakedSui: string; /** * gas object to be used in this transaction, node will pick one from the signer's possession if not * provided */ gas?: string | null | undefined; /** the gas budget, the transaction will fail if the gas cost exceed the budget */ gasBudget: string; signal?: AbortSignal; } /** Create an unsigned transaction to split a coin object into multiple coins. */ interface UnsafeSplitCoinParams { /** the transaction signer's Sui address */ signer: string; /** the coin object to be spilt */ coinObjectId: string; /** the amounts to split out from the coin */ splitAmounts: string[]; /** * gas object to be used in this transaction, node will pick one from the signer's possession if not * provided */ gas?: string | null | undefined; /** the gas budget, the transaction will fail if the gas cost exceed the budget */ gasBudget: string; signal?: AbortSignal; } /** Create an unsigned transaction to split a coin object into multiple equal-size coins. */ interface UnsafeSplitCoinEqualParams { /** the transaction signer's Sui address */ signer: string; /** the coin object to be spilt */ coinObjectId: string; /** the number of coins to split into */ splitCount: string; /** * gas object to be used in this transaction, node will pick one from the signer's possession if not * provided */ gas?: string | null | undefined; /** the gas budget, the transaction will fail if the gas cost exceed the budget */ gasBudget: string; signal?: AbortSignal; } /** * Create an unsigned transaction to transfer an object from one address to another. The object's type * must allow public transfers */ interface UnsafeTransferObjectParams { /** the transaction signer's Sui address */ signer: string; /** the ID of the object to be transferred */ objectId: string; /** * gas object to be used in this transaction, node will pick one from the signer's possession if not * provided */ gas?: string | null | undefined; /** the gas budget, the transaction will fail if the gas cost exceed the budget */ gasBudget: string; /** the recipient's Sui address */ recipient: string; signal?: AbortSignal; } /** * Create an unsigned transaction to send SUI coin object to a Sui address. The SUI object is also used * as the gas object. */ interface UnsafeTransferSuiParams { /** the transaction signer's Sui address */ signer: string; /** the Sui coin object to be used in this transaction */ suiObjectId: string; /** the gas budget, the transaction will fail if the gas cost exceed the budget */ gasBudget: string; /** the recipient's Sui address */ recipient: string; /** the amount to be split out and transferred */ amount?: string | null | undefined; signal?: AbortSignal; } //#endregion export { DevInspectTransactionBlockParams, DryRunTransactionBlockParams, ExecuteTransactionBlockParams, GetAllBalancesParams, GetAllCoinsParams, GetBalanceParams, GetChainIdentifierParams, GetCheckpointParams, GetCheckpointsParams, GetCoinMetadataParams, GetCoinsParams, GetCommitteeInfoParams, GetDynamicFieldObjectParams, GetDynamicFieldsParams, GetEventsParams, GetLatestCheckpointSequenceNumberParams, GetLatestSuiSystemStateParams, GetMoveFunctionArgTypesParams, GetNormalizedMoveFunctionParams, GetNormalizedMoveModuleParams, GetNormalizedMoveModulesByPackageParams, GetNormalizedMoveStructParams, GetObjectParams, GetOwnedObjectsParams, GetProtocolConfigParams, GetReferenceGasPriceParams, GetStakesByIdsParams, GetStakesParams, GetTotalSupplyParams, GetTotalTransactionBlocksParams, GetTransactionBlockParams, GetValidatorsApyParams, MultiGetObjectsParams, MultiGetTransactionBlocksParams, QueryEventsParams, QueryTransactionBlocksParams, ResolveNameServiceAddressParams, ResolveNameServiceNamesParams, SubscribeEventParams, SubscribeTransactionParams, TryGetPastObjectParams, TryMultiGetPastObjectsParams, UnsafeBatchTransactionParams, UnsafeMergeCoinsParams, UnsafeMoveCallParams, UnsafePayAllSuiParams, UnsafePayParams, UnsafePaySuiParams, UnsafePublishParams, UnsafeRequestAddStakeParams, UnsafeRequestWithdrawStakeParams, UnsafeSplitCoinEqualParams, UnsafeSplitCoinParams, UnsafeTransferObjectParams, UnsafeTransferSuiParams, VerifyZkLoginSignatureParams }; //# sourceMappingURL=params.d.mts.map