UNPKG

@near-js/accounts

Version:

Classes encapsulating account-specific functionality

65 lines (61 loc) 2.11 kB
import { Signer } from '@near-js/signers'; import { Provider } from '@near-js/providers'; import { BlockReference } from '@near-js/types'; interface IntoConnection { getConnection(): Connection; } /** * Options used to initiate a function call (especially a change function call) * @see {@link Account#viewFunction | viewFunction} to initiate a view function call */ interface FunctionCallOptions { /** The NEAR account id where the contract is deployed */ contractId: string; /** The name of the method to invoke */ methodName: string; /** * named arguments to pass the method `{ messageText: 'my message' }` */ args?: object; /** max amount of gas that method call can use */ gas?: bigint; /** amount of NEAR (in yoctoNEAR) to send together with the call */ attachedDeposit?: bigint; /** * Convert input arguments into bytes array. */ stringify?: (input: any) => Buffer; } interface ChangeFunctionCallOptions extends FunctionCallOptions { /** * Metadata to send the NEAR Wallet if using it to sign transactions. * @see RequestSignTransactionsOptions */ walletMeta?: string; /** * Callback url to send the NEAR Wallet if using it to sign transactions. * @see RequestSignTransactionsOptions */ walletCallbackUrl?: string; } interface ViewFunctionCallOptions extends FunctionCallOptions { parse?: (response: Uint8Array) => any; blockQuery?: BlockReference; } /** * @deprecated * * Connects an account to a given network via a given provider */ declare class Connection implements IntoConnection { readonly networkId: string; readonly provider: Provider; readonly signer: Signer; constructor(networkId: string, provider: Provider, signer: Signer); getConnection(): Connection; /** * @param config Contains connection info details */ static fromConfig(config: any): Connection; } export { Connection as C, type FunctionCallOptions as F, type IntoConnection as I, type ViewFunctionCallOptions as V, type ChangeFunctionCallOptions as a };