import * as reExportAllUtils from '@fastnear/utils'; import { NearPublicKeyHandle, NEP413Message, NearAction, NearNonceMode, TransactionSigner, NearPublicKey, NearDelegateAction, SignedDelegateInput } from '@fastnear/utils'; export { MAX_GAS_KEY_NONCES, isGasKeyPermission } from '@fastnear/utils'; interface AccessKeyWithError { result: { nonce: number | string; permission?: AccessKeyPermissionView; error?: string; }; } interface FunctionCallPermissionView { allowance: string | null; receiver_id: string; method_names: string[]; } /** * Gas key (protocol 85+): a prepaid yoctoNEAR `balance` that pays this key's * gas, and `num_nonces` independent nonce lanes (see `queryGasKeyNonces`). */ interface GasKeyInfoView { balance: string; num_nonces: number; } type AccessKeyPermissionView = "FullAccess" | { FunctionCall: FunctionCallPermissionView; } | { GasKeyFullAccess: GasKeyInfoView; } | { GasKeyFunctionCall: GasKeyInfoView & FunctionCallPermissionView; }; /** `query` / `view_gas_key_nonces`: one nonce per lane, in lane order. */ interface GasKeyNoncesResponse { result: { nonces: Array; block_height?: number; block_hash?: string; error?: string; }; } interface AccessKeyInfoView { /** Full classical key, or an ml-dsa-65-hash: handle for ML-DSA-65. */ public_key: NearPublicKeyHandle; access_key: { nonce: number | string; permission: AccessKeyPermissionView; }; } interface AccessKeyListResponse { result: { keys: AccessKeyInfoView[]; /** Pagination cursor: present when truncated; pass it as `afterKey` for the next page. */ last_key?: NearPublicKeyHandle | null; block_height?: number; block_hash?: string; }; } interface RpcStatusResponse { result: { protocol_version: number; latest_protocol_version?: number; [key: string]: any; }; } interface BlockView { result: { header: { hash: string; height: number; timestamp_nanosec: string; }; }; } interface LastKnownBlock { header: { hash: string; timestamp_nanosec: string; }; } interface AccessKeyView { nonce: number; permission: any; } interface FastNearRpcAccountView { amount: string; locked?: string; storage_usage?: number; code_hash?: string; block_height?: number; block_hash?: string; [key: string]: any; } interface FastNearRpcQueryAccountResponse { result: FastNearRpcAccountView; [key: string]: any; } interface FastNearRecipeViewAccountResult extends FastNearRpcAccountView { } interface RecipeViewContractParams { contractId: string; methodName: string; args?: any; argsBase64?: string; blockId?: string; network?: "mainnet" | "testnet"; } interface RecipeViewAccountParams { accountId: string; blockId?: string; network?: "mainnet" | "testnet"; } type RecipeViewAccountInput = string | RecipeViewAccountParams; interface RecipeInspectTransactionParams { txHash: string; accountId?: string; network?: "mainnet" | "testnet"; } type RecipeInspectTransactionInput = string | RecipeInspectTransactionParams; interface RecipeFunctionCallParams { receiverId: string; methodName: string; args?: Record; argsBase64?: string; gas?: string; deposit?: string; waitUntil?: string; network?: "mainnet" | "testnet"; } interface RecipeTransferParams { receiverId: string; amount: string; waitUntil?: string; network?: "mainnet" | "testnet"; } interface RecipeConnectParams { contractId?: string; excludedWallets?: string[]; features?: Record; network?: "mainnet" | "testnet"; signMessageParams?: { message: string; recipient: string; nonce: Uint8Array; }; } interface FastNearRecipeDiscoveryEntry { id: string; api: string; title: string; } interface ExplainedAction { kind: "action"; type: string; params: Record; methodName?: string | null; gas?: string | null; deposit?: string | null; args?: any; argsBase64?: string | null; publicKey?: string | null; stake?: string | null; beneficiaryId?: string | null; accessKey?: any; codeBase64?: string | null; codeLength?: number | null; /** WithdrawFromGasKey. */ amount?: string | null; /** AddKey with a gas-key permission. */ numNonces?: number | null; } interface ExplainedTransaction { kind: "transaction"; signerId?: string | null; receiverId: string; actionCount: number; actions: ExplainedAction[]; } interface ExplainedError { kind: "rpc_error" | "wallet_error" | "transport_error" | "error"; code: string | number | null; name: string | null; message: string; data: any; retryable: boolean; } interface FastNearApiAccountState { balance: string; locked?: string; storage_usage?: number; code_hash?: string; block_height?: number; block_hash?: string; [key: string]: any; } interface FastNearApiTokenBalance { contract_id?: string; ft_id?: string; symbol?: string; balance?: string; balance_yocto?: string; decimals?: number; [key: string]: any; } interface FastNearApiNftContractHolding { contract_id?: string; nft_contract_id?: string; tokens?: any[]; [key: string]: any; } interface FastNearApiStakingPoolPosition { pool_id?: string; contract_id?: string; staked_balance?: string; unstaked_balance?: string; can_withdraw?: boolean; [key: string]: any; } interface FastNearApiPublicKeyAccount { account_id: string; public_key?: string; access_key?: any; [key: string]: any; } interface FastNearApiFtTopAccount { account_id: string; balance?: string; human_balance?: string; [key: string]: any; } interface FastNearApiV1AccountFullResponse { account_id: string; state: FastNearApiAccountState; tokens: FastNearApiTokenBalance[]; nfts: FastNearApiNftContractHolding[]; pools: FastNearApiStakingPoolPosition[]; [key: string]: any; } interface FastNearApiV1AccountFtResponse { account_id?: string; tokens: FastNearApiTokenBalance[]; page_token?: string | null; resume_token?: string | null; [key: string]: any; } interface FastNearApiV1AccountNftResponse { account_id?: string; nfts: FastNearApiNftContractHolding[]; page_token?: string | null; resume_token?: string | null; [key: string]: any; } interface FastNearApiV1AccountStakingResponse { account_id?: string; pools: FastNearApiStakingPoolPosition[]; page_token?: string | null; resume_token?: string | null; [key: string]: any; } interface FastNearApiV1PublicKeyResponse { public_key?: string; accounts: FastNearApiPublicKeyAccount[]; [key: string]: any; } interface FastNearApiV1PublicKeyAllResponse { public_key?: string; accounts: FastNearApiPublicKeyAccount[]; transactions?: any[]; [key: string]: any; } interface FastNearApiV1FtTopResponse { token_id?: string; accounts: FastNearApiFtTopAccount[]; page_token?: string | null; [key: string]: any; } interface FastNearTxExecutionOutcome { block_hash?: string; block_height?: number; id?: string; logs?: string[]; outcome?: any; proof?: any[]; executor_id?: string; status?: any; tokens_burnt?: string; [key: string]: any; } interface FastNearTxTransactionRecord { hash: string; signer_id: string; receiver_id: string; actions?: any[]; /** Present when the transaction was signed with a gas key (TransactionV1). */ nonce_index?: number; /** Present for TransactionV1 in strict mode; omitted when monotonic. */ nonce_mode?: "monotonic" | "strict"; [key: string]: any; } interface FastNearTxReceiptRow { receipt_id?: string; receipt?: any; execution_outcome?: FastNearTxExecutionOutcome; [key: string]: any; } interface FastNearTxTransactionRow { transaction: FastNearTxTransactionRecord; execution_outcome: FastNearTxExecutionOutcome; receipts: FastNearTxReceiptRow[]; [key: string]: any; } interface FastNearTxBlockRow { block_height?: number; block_hash?: string; transactions?: FastNearTxTransactionRow[]; receipts?: FastNearTxReceiptRow[]; [key: string]: any; } interface FastNearTxTransactionsResponse { transactions: FastNearTxTransactionRow[]; resume_token?: string | null; page_token?: string | null; [key: string]: any; } interface FastNearTxReceiptResponse { receipt?: FastNearTxReceiptRow | null; receipts?: FastNearTxReceiptRow[]; transaction?: FastNearTxTransactionRow | null; [key: string]: any; } interface FastNearTxAccountResponse { transactions?: FastNearTxTransactionRow[]; resume_token?: string | null; page_token?: string | null; [key: string]: any; } interface FastNearTxBlockResponse { block?: FastNearTxBlockRow; [key: string]: any; } interface FastNearTxBlocksResponse { blocks: FastNearTxBlockRow[]; resume_token?: string | null; page_token?: string | null; [key: string]: any; } interface FastNearTransfersEntry { account_id?: string; asset_id?: string; human_amount?: string; other_account_id?: string; transfer_type?: string; transaction_id?: string; block_height?: number; [key: string]: any; } interface FastNearTransfersQueryResponse { transfers: FastNearTransfersEntry[]; resume_token?: string | null; [key: string]: any; } interface FastNearNeardataTransaction { hash?: string; signer_id?: string; receiver_id?: string; [key: string]: any; } interface FastNearNeardataBlockHeader { height: number; hash?: string; prev_hash?: string; timestamp_nanosec?: string; [key: string]: any; } interface FastNearNeardataChunk { chunk_hash?: string; shard_id?: number; transactions: FastNearNeardataTransaction[]; [key: string]: any; } interface FastNearNeardataShard { shard_id: number; chunk: FastNearNeardataChunk; [key: string]: any; } interface FastNearNeardataBlock { header: FastNearNeardataBlockHeader; [key: string]: any; } interface FastNearNeardataLastBlockFinalResponse { block: FastNearNeardataBlock; shards: FastNearNeardataShard[]; [key: string]: any; } interface FastNearNeardataLastBlockOptimisticResponse { block: FastNearNeardataBlock; shards: FastNearNeardataShard[]; [key: string]: any; } interface FastNearNeardataBlockResponse { block: FastNearNeardataBlock; shards: FastNearNeardataShard[]; [key: string]: any; } interface FastNearNeardataBlockHeadersResponse { block: FastNearNeardataBlock; shards?: FastNearNeardataShard[]; [key: string]: any; } interface FastNearNeardataBlockShardResponse { block: FastNearNeardataBlock; shard: FastNearNeardataShard; [key: string]: any; } interface FastNearNeardataBlockChunkResponse { block: FastNearNeardataBlock; chunk: FastNearNeardataChunk; [key: string]: any; } interface FastNearNeardataBlockOptimisticResponse { block: FastNearNeardataBlock; shards: FastNearNeardataShard[]; [key: string]: any; } interface FastNearNeardataFirstBlockResponse { block: FastNearNeardataBlock; [key: string]: any; } interface FastNearNeardataHealthResponse { status?: string; ok?: boolean; [key: string]: any; } interface FastNearKvEntry { current_account_id: string; predecessor_id: string; key: string; value: any; block_height?: number; block_hash?: string; timestamp_nanosec?: string; [key: string]: any; } interface FastNearKvEntriesResponse { entries: FastNearKvEntry[]; resume_token?: string | null; page_token?: string | null; [key: string]: any; } interface FastNearKvGetLatestKeyResponse extends FastNearKvEntriesResponse { } interface FastNearKvGetHistoryKeyResponse extends FastNearKvEntriesResponse { } interface FastNearKvLatestByAccountResponse extends FastNearKvEntriesResponse { } interface FastNearKvHistoryByAccountResponse extends FastNearKvEntriesResponse { } interface FastNearKvLatestByPredecessorResponse extends FastNearKvEntriesResponse { } interface FastNearKvHistoryByPredecessorResponse extends FastNearKvEntriesResponse { } interface FastNearKvAllByPredecessorResponse extends FastNearKvEntriesResponse { } interface FastNearKvMultiResult { entries?: FastNearKvEntry[]; [key: string]: any; } interface FastNearKvMultiResponse { results?: FastNearKvMultiResult[]; entries?: FastNearKvEntry[]; [key: string]: any; } type FastNearSignMessageParams = NEP413Message; type IntegerType = "u8" | "u16" | "u32" | "u64" | "u128"; /** How wide integers (u64/u128) come back from deserialize. Default: "string". */ type BigintMode = "string" | "bigint"; interface DeserializeOptions { bigints?: BigintMode; } type StringType = "string"; type OptionType = { option: Schema; }; type ArrayType = { array: { type: Schema; len?: number; }; }; /** * One enum variant. `tag` overrides the wire discriminant (default: the variant's * array position). Lets a schema skip discriminants it does not model. */ type EnumVariant = StructType & { tag?: number; }; type EnumType = { enum: Array; }; type StructType = { struct: { [key: string]: Schema; }; }; type Schema = IntegerType | StringType | OptionType | ArrayType | EnumType | StructType; declare function serialize(schema: Schema, value: unknown): Uint8Array; declare function deserialize(schema: Schema, buffer: Uint8Array, options?: DeserializeOptions): any; type FastNearNetworkId = "mainnet" | "testnet"; interface FastNearServiceConfig { baseUrl?: string | null; } interface FastNearServicesConfig { rpc?: FastNearServiceConfig; archival?: FastNearServiceConfig; api?: FastNearServiceConfig; tx?: FastNearServiceConfig; transfers?: FastNearServiceConfig; neardata?: FastNearServiceConfig; fastdata?: { kvBaseUrl?: string | null; }; } type WritePolicy = "never" | "transport-only" | "all"; interface RetryConfig { enabled?: boolean; maxAttempts?: number; baseBackoffMs?: number; maxBackoffMs?: number; timeoutMs?: number; respectRetryAfter?: boolean; writePolicy?: WritePolicy; } interface ResolvedRetryConfig { enabled: boolean; maxAttempts: number; baseBackoffMs: number; maxBackoffMs: number; timeoutMs: number; respectRetryAfter: boolean; writePolicy: WritePolicy; } interface FastNearBatchConfig { maxConcurrency?: number; } interface NetworkConfig { networkId: FastNearNetworkId; apiKey?: string | null; nodeUrl?: string; walletUrl?: string; helperUrl?: string; explorerUrl?: string; services?: FastNearServicesConfig; retry?: RetryConfig; batch?: FastNearBatchConfig; [key: string]: any; } interface TxStatus { txId: string; updateTimestamp?: number; [key: string]: any; } type TxHistory = Record; interface WalletProvider { connect(options?: { contractId?: string; network?: string; excludedWallets?: string[]; features?: Record; signMessageParams?: { message: string; recipient: string; nonce: Uint8Array; }; }): Promise<{ accountId: string; network?: string; publicKey?: string; signedMessage?: { accountId: string; publicKey: string; signature: string; }; } | null>; restore?(options?: { contractId?: string; network?: string; }): Promise<{ accountId: string; network?: string; } | null>; disconnect(options?: { network?: string; }): Promise; sendTransaction(params: { receiverId: string; actions: any[]; signerId?: string; network?: string; }): Promise; signMessage?(params: { message: string; recipient: string; nonce: Uint8Array; network?: string; }): Promise; accountId(options?: { network?: string; }): string | null; isConnected(options?: { network?: string; }): boolean; } type RpcErrorKind = "transport" | "http" | "rpc" | "contract"; interface FastNearRpcErrorFields { kind?: RpcErrorKind; /** HTTP status when the failure was HTTP-level; null otherwise. */ status?: number | null; /** JSON-RPC error code, or the HTTP status mirrored as a code. */ code?: number | string | null; data?: any; /** Whether this class of failure is transient/retryable. */ retryable?: boolean; } declare class FastNearRpcError extends Error { readonly kind: RpcErrorKind; readonly status: number | null; readonly code: number | string | null; readonly data: any; readonly retryable: boolean; constructor(serializedMessage: string, fields?: FastNearRpcErrorFields); } declare const MaxBlockDelayMs: number; declare function withBlockId(params: Record, blockId?: string): { finality: string; } | { block_id: string; }; interface RpcRouteOptions { /** * Route this call to the archival RPC (`services.archival.baseUrl`) * instead of the default. Useful for queries with a historical * `blockId`. Falls back to the regular RPC if archival isn't configured. */ useArchival?: boolean; /** * Route this call to the override network's RPC instead of the active * `near.config().networkId`. Useful when a page holds parallel * mainnet+testnet sessions and a single read or write needs to target * the non-active network without flipping config back and forth. */ network?: FastNearNetworkId; } declare function sendRpc(method: string, params: Record | any[], options?: RpcRouteOptions): Promise; interface BatchRequest { method: string; params: Record | any[]; useArchival?: boolean; network?: FastNearNetworkId; } type BatchItemResult = { status: "ok"; result: T; } | { status: "error"; kind: RpcErrorKind | "unknown"; error: any; }; /** * Explicit bulk API: run many RPC calls, each as its own retried request, with * at most `batch.maxConcurrency` (default 30) in flight — the lever that curbs * 429s without bursting. (NEAR RPC has no array batching, so calls can't be * collapsed into one request.) Returns settled results in input order — one * failing call never rejects the whole set. Write methods (`send_tx` / * `broadcast_tx_*`) are rejected per-item. */ declare const batch: (requests: BatchRequest[]) => Promise; declare function afterTxSent(txId: string, network?: FastNearNetworkId): void; declare function sendTxToRpc(signedTxBase64: string, waitUntil: string | undefined, txId: string, network?: FastNearNetworkId): Promise; /** * Generates a mock transaction ID. */ declare function generateTxId(): string; declare const accountId: (options?: { network?: FastNearNetworkId; }) => string | null | undefined; declare const publicKey: (options?: { network?: FastNearNetworkId; }) => string | null | undefined; declare const config: (newConfig?: Partial) => NetworkConfig; declare const authStatus: (options?: { network?: FastNearNetworkId; }) => string | Record; declare const getPublicKeyForContract: (options?: { network?: FastNearNetworkId; }) => string | null | undefined; declare const selected: (options?: { network?: FastNearNetworkId; }) => { network: FastNearNetworkId; nodeUrl: string | undefined; walletUrl: string | undefined; helperUrl: string | undefined; explorerUrl: string | undefined; account: string | null | undefined; contract: string | null | undefined; publicKey: string | null | undefined; }; declare const requestSignIn: ({ contractId, excludedWallets, features, network, signMessageParams, }?: { contractId?: string; excludedWallets?: string[]; features?: Record; network?: FastNearNetworkId; signMessageParams?: { message: string; recipient: string; nonce: Uint8Array; }; }) => Promise<{ accountId: string; network?: string; publicKey?: string; signedMessage?: { accountId: string; publicKey: string; signature: string; }; } | undefined>; interface ViewManySpec { contractId: string; methodName: string; args?: any; argsBase64?: string; blockId?: string; useArchival?: boolean; network?: FastNearNetworkId; } declare function viewMany(specs: ViewManySpec[]): Promise; declare const view: (({ contractId, methodName, args, argsBase64, blockId, useArchival, network, }: { contractId: string; methodName: string; args?: any; argsBase64?: string; blockId?: string; useArchival?: boolean; network?: FastNearNetworkId; }) => Promise) & { many: typeof viewMany; }; declare const queryAccount: ({ accountId, blockId, useArchival, network, }: { accountId: string; blockId?: string; useArchival?: boolean; network?: FastNearNetworkId; }) => Promise; declare const queryBlock: ({ blockId, useArchival, network }: { blockId?: string; useArchival?: boolean; network?: FastNearNetworkId; }) => Promise; declare const queryAccessKey: ({ accountId, publicKey, blockId, useArchival, network, }: { accountId: string; publicKey: string; blockId?: string; useArchival?: boolean; network?: FastNearNetworkId; }) => Promise; /** * List an account's access keys. Accounts with more than 100 keys are refused * unpaginated (`TOO_MANY_ACCESS_KEYS`): pass `limit` and page with `afterKey` * set to the last `public_key` of the previous page. */ declare const queryAccessKeyList: ({ accountId, blockId, afterKey, limit, useArchival, network, }: { accountId: string; blockId?: string; /** Resume after this public key (as listed, e.g. an ml-dsa-65-hash: handle). */ afterKey?: string; /** Page size (RPC caps unpaginated lists at 100 keys). */ limit?: number; useArchival?: boolean; network?: FastNearNetworkId; }) => Promise; /** * Per-lane nonces of a gas key (`query` / `view_gas_key_nonces`). A gas key's * `view_access_key` nonce is always 0; these are the values a TransactionV1 * must exceed on its chosen `nonceIndex`. A non-gas key fails with UNKNOWN_GAS_KEY. */ declare const queryGasKeyNonces: ({ accountId, publicKey, blockId, useArchival, network, }: { accountId: string; publicKey: string; blockId?: string; useArchival?: boolean; network?: FastNearNetworkId; }) => Promise; /** What `gasKeyInfoFromPermission` returns for a gas key. */ interface GasKeyPermissionInfo extends GasKeyInfoView { /** Set for GasKeyFunctionCall keys (same rules as a FunctionCall key); null for GasKeyFullAccess. */ functionCall: FunctionCallPermissionView | null; } /** * Pull the gas-key info out of an access-key permission view, or null for a * classical key. Shared by sendTx's signer detection, recipes and smokes. */ declare function gasKeyInfoFromPermission(permission: AccessKeyPermissionView | null | undefined): GasKeyPermissionInfo | null; /** Return the active protocol version reported by the selected RPC. */ declare const queryProtocolVersion: ({ network, }?: { network?: FastNearNetworkId; }) => Promise; declare const queryTx: ({ txHash, accountId, useArchival, network }: { txHash: string; accountId: string; useArchival?: boolean; network?: FastNearNetworkId; }) => Promise; /** Current gas price (yoctoNEAR/gas). Omit `blockId` for the latest block. */ declare const gasPrice: ({ blockId, network }?: { blockId?: string | number; network?: FastNearNetworkId; }) => Promise; /** Full node status envelope (chain id, sync info, protocol version, …). */ declare const status: ({ network }?: { network?: FastNearNetworkId; }) => Promise; /** Validator set for an epoch. Omit `blockId` for the current epoch. */ declare const validators: ({ blockId, network }?: { blockId?: string | number; network?: FastNearNetworkId; }) => Promise; /** * The implicit account id (64-char lowercase hex) for an ed25519 public key — * the account that key controls with no on-chain AddKey. Only ed25519 keys map * to implicit accounts. */ declare const implicitAccountId: (publicKey: string) => string; /** * Create and fund a NEAR **testnet** account through the testnet helper faucet. * Testnet only — there is no mainnet faucet. POSTs `{ newAccountId, newKey }` * to the helper create endpoint and returns its JSON result. */ declare const createFundedTestnetAccount: ({ newAccountId, publicKey, }: { newAccountId: string; publicKey: string; }) => Promise; declare function print(value: unknown): void; declare const tx: { transactions: ({ txHashes, network, ...filters }: { txHashes: string[]; network?: FastNearNetworkId; [key: string]: any; }) => Promise; receipt: ({ receiptId, network, ...filters }: { receiptId: string; network?: FastNearNetworkId; [key: string]: any; }) => Promise; account: ({ accountId, network, ...filters }: { accountId: string; network?: FastNearNetworkId; [key: string]: any; }) => Promise; block: ({ network, ...params }?: { network?: FastNearNetworkId; [key: string]: any; }) => Promise; blocks: ({ network, ...params }?: { network?: FastNearNetworkId; [key: string]: any; }) => Promise; }; declare const api: { v1: { accountFull: ({ accountId, network, ...query }: { accountId: string; network?: FastNearNetworkId; [key: string]: any; }) => Promise; accountFt: ({ accountId, network, ...query }: { accountId: string; network?: FastNearNetworkId; [key: string]: any; }) => Promise; accountNft: ({ accountId, network, ...query }: { accountId: string; network?: FastNearNetworkId; [key: string]: any; }) => Promise; accountStaking: ({ accountId, network, ...query }: { accountId: string; network?: FastNearNetworkId; [key: string]: any; }) => Promise; publicKey: ({ publicKey, network, ...query }: { publicKey: string; network?: FastNearNetworkId; [key: string]: any; }) => Promise; publicKeyAll: ({ publicKey, network, ...query }: { publicKey: string; network?: FastNearNetworkId; [key: string]: any; }) => Promise; ftTop: ({ tokenId, network, ...query }: { tokenId: string; network?: FastNearNetworkId; [key: string]: any; }) => Promise; }; }; declare const transfers: { query: ({ network, ...params }?: { network?: FastNearNetworkId; [key: string]: any; }) => Promise; }; declare const ft: { balance: ({ contractId, accountId, blockId, useArchival, network }: { contractId: string; accountId: string; blockId?: string; useArchival?: boolean; network?: FastNearNetworkId; }) => Promise; metadata: ({ contractId, blockId, useArchival, network }: { contractId: string; blockId?: string; useArchival?: boolean; network?: FastNearNetworkId; }) => Promise; totalSupply: ({ contractId, blockId, useArchival, network }: { contractId: string; blockId?: string; useArchival?: boolean; network?: FastNearNetworkId; }) => Promise; storageBalance: ({ contractId, accountId, blockId, useArchival, network }: { contractId: string; accountId: string; blockId?: string; useArchival?: boolean; network?: FastNearNetworkId; }) => Promise; inventory: ({ accountId, network, ...query }: { accountId: string; network?: FastNearNetworkId; [key: string]: any; }) => Promise; }; declare const nft: { metadata: ({ contractId, blockId, useArchival, network }: { contractId: string; blockId?: string; useArchival?: boolean; network?: FastNearNetworkId; }) => Promise; token: ({ contractId, tokenId, blockId, useArchival, network }: { contractId: string; tokenId: string; blockId?: string; useArchival?: boolean; network?: FastNearNetworkId; }) => Promise; forOwner: ({ contractId, accountId, fromIndex, limit, blockId, useArchival, network }: { contractId: string; accountId: string; fromIndex?: string; limit?: number; blockId?: string; useArchival?: boolean; network?: FastNearNetworkId; }) => Promise; supplyForOwner: ({ contractId, accountId, blockId, useArchival, network }: { contractId: string; accountId: string; blockId?: string; useArchival?: boolean; network?: FastNearNetworkId; }) => Promise; totalSupply: ({ contractId, blockId, useArchival, network }: { contractId: string; blockId?: string; useArchival?: boolean; network?: FastNearNetworkId; }) => Promise; tokens: ({ contractId, fromIndex, limit, blockId, useArchival, network }: { contractId: string; fromIndex?: string; limit?: number; blockId?: string; useArchival?: boolean; network?: FastNearNetworkId; }) => Promise; inventory: ({ accountId, network, ...query }: { accountId: string; network?: FastNearNetworkId; [key: string]: any; }) => Promise; }; declare const neardata: { lastBlockFinal: ({ network, ...query }?: { network?: FastNearNetworkId; [key: string]: any; }) => Promise; lastBlockOptimistic: ({ network, ...query }?: { network?: FastNearNetworkId; [key: string]: any; }) => Promise; block: ({ blockHeight, network, ...query }: { blockHeight: string | number; network?: FastNearNetworkId; [key: string]: any; }) => Promise; blockHeaders: ({ blockHeight, network, ...query }: { blockHeight: string | number; network?: FastNearNetworkId; [key: string]: any; }) => Promise; blockShard: ({ blockHeight, shardId, network, ...query }: { blockHeight: string | number; shardId: string | number; network?: FastNearNetworkId; [key: string]: any; }) => Promise; blockChunk: ({ blockHeight, shardId, network, ...query }: { blockHeight: string | number; shardId: string | number; network?: FastNearNetworkId; [key: string]: any; }) => Promise; blockOptimistic: ({ blockHeight, network, ...query }: { blockHeight: string | number; network?: FastNearNetworkId; [key: string]: any; }) => Promise; firstBlock: ({ network, ...query }?: { network?: FastNearNetworkId; [key: string]: any; }) => Promise; health: ({ network, ...query }?: { network?: FastNearNetworkId; [key: string]: any; }) => Promise; }; declare const fastdata: { kv: { getLatestKey: ({ currentAccountId, predecessorId, key, network, ...query }: { currentAccountId: string; predecessorId: string; key: string; network?: FastNearNetworkId; [key: string]: any; }) => Promise; getHistoryKey: ({ currentAccountId, predecessorId, key, network, ...query }: { currentAccountId: string; predecessorId: string; key: string; network?: FastNearNetworkId; [key: string]: any; }) => Promise; latestByAccount: ({ accountId, network, ...body }: { accountId: string; network?: FastNearNetworkId; [key: string]: any; }) => Promise; historyByAccount: ({ accountId, network, ...body }: { accountId: string; network?: FastNearNetworkId; [key: string]: any; }) => Promise; latestByPredecessor: ({ currentAccountId, predecessorId, network, ...body }: { currentAccountId: string; predecessorId: string; network?: FastNearNetworkId; [key: string]: any; }) => Promise; historyByPredecessor: ({ currentAccountId, predecessorId, network, ...body }: { currentAccountId: string; predecessorId: string; network?: FastNearNetworkId; [key: string]: any; }) => Promise; allByPredecessor: ({ predecessorId, network, ...body }: { predecessorId: string; network?: FastNearNetworkId; [key: string]: any; }) => Promise; multi: ({ network, ...body }: { network?: FastNearNetworkId; [key: string]: any; }) => Promise; }; }; declare const localTxHistory: () => TxHistory; declare const signOut: ({ network, }?: { network?: FastNearNetworkId; }) => Promise; type SendTxCommon = { receiverId: string; actions: NearAction[]; waitUntil?: string; network?: FastNearNetworkId; /** * Gas keys only: which nonce lane (0..numNonces-1) this transaction advances. * Lanes are independent sequences, so sends on different lanes don't wait on * each other. Defaults to 0 when the signer key is a gas key; rejected for a * classical key. Requires local signing (TransactionV1). */ nonceIndex?: number; /** TransactionV1 nonce rule: "monotonic" (default, nonce > stored) or "strict" (exactly stored + 1). */ nonceMode?: NearNonceMode; }; type SendTxParams = SendTxCommon & ({ signer?: never; signerId?: never; } | { signer: TransactionSigner; signerId: string; }); declare const sendTx: ({ receiverId, actions, waitUntil, network, signer: suppliedSigner, signerId: suppliedSignerId, nonceIndex, nonceMode, }: SendTxParams) => Promise; interface SignDelegateParams { receiverId: string; actions: NearAction[]; signerId?: string; signer?: TransactionSigner; blockHeightTtl?: number; maxBlockHeight?: string | number | bigint; network?: FastNearNetworkId; } interface SignedDelegateResult { delegateAction: { senderId: string; receiverId: string; actions: NearAction[]; nonce: string; maxBlockHeight: string; publicKey: NearPublicKey; }; /** Base58 ed25519/secp256k1 signature over the NEP-461 delegate hash. */ signature: string; signatureBytes: Uint8Array; /** Borsh SignedDelegate, base64 — the shape a relayer or wallet transports. */ borshBase64: string; } /** * Sign a NEP-366 delegate action locally (no wallet) so a relayer can submit it * and pay the gas — the gasless / meta-transaction path for servers and agents. * Nonce comes from the sender's access key; `maxBlockHeight` defaults to the * final block height plus `blockHeightTtl`. Hand the result to `near.relayDelegate` * (or any relayer) to broadcast. OUT values are decimal strings per convention. */ declare const signDelegate: ({ receiverId, actions: delegatedActions, signerId: suppliedSignerId, signer: suppliedSigner, blockHeightTtl, maxBlockHeight: suppliedMaxBlockHeight, network, }: SignDelegateParams) => Promise; /** * Submit a signed delegate as a relayer: wrap it in an ordinary transaction sent * to the delegate's sender. Pass a full-access `relayerSigner`/`relayerId` to pay * the gas from a different account; otherwise the active session relays. */ declare const relayDelegate: ({ delegateAction, signature, signedDelegate, relayerSigner, relayerId, waitUntil, network, }: { delegateAction?: NearDelegateAction; signature?: string | Uint8Array; signedDelegate?: SignedDelegateInput; relayerSigner?: TransactionSigner; relayerId?: string; waitUntil?: string; network?: FastNearNetworkId; }) => Promise; /** * Signs a NEP-413 message using the connected wallet. Pass an explicit * `{ network }` to route the signature through that network's wallet * session — useful when a page holds parallel mainnet+testnet sessions. * Without it, the active network's session is used. */ declare const signMessage: (message: NEP413Message, options?: { network?: FastNearNetworkId; }) => Promise; /** * Set the wallet provider used by the API for signing and sending transactions. * Automatically called in IIFE builds when globalThis.nearWallet is present. */ declare const useWallet: (provider: WalletProvider) => void; declare const utils: typeof reExportAllUtils; declare const event: { _eventListeners: { account: Set; tx: Set; }; notifyAccountListeners: (accountId: string) => void; notifyTxListeners: (tx: TxStatus) => void; onAccount: (callback: (accountId: string) => void) => (() => void); offAccount: (callback: (accountId: string) => void) => boolean; onTx: (callback: (tx: TxStatus) => void) => (() => void); offTx: (callback: (tx: TxStatus) => void) => boolean; }; declare const state: Record; declare const exp: { utils: typeof reExportAllUtils; borsh: { serialize: typeof serialize; deserialize: typeof deserialize; }; borshSchema: { Ed25519Signature: Schema; Secp256k1Signature: Schema; MlDsa65Signature: Schema; Signature: Schema; Ed25519Data: Schema; Secp256k1Data: Schema; MlDsa65Data: Schema; PublicKey: Schema; FunctionCallPermission: Schema; FullAccessPermission: Schema; GasKeyInfo: Schema; GasKeyFunctionCallPermission: Schema; AccessKeyPermission: Schema; AccessKey: Schema; CreateAccount: Schema; DeployContract: Schema; FunctionCall: Schema; Transfer: Schema; Stake: Schema; AddKey: Schema; DeleteKey: Schema; DeleteAccount: Schema; TransferToGasKey: Schema; WithdrawFromGasKey: Schema; ClassicAction: Schema; DelegateAction: Schema; SignedDelegate: Schema; Action: Schema; Transaction: Schema; SignedTransaction: Schema; TransactionNonce: Schema; NonceMode: Schema; TransactionV1: Schema; SignedTransactionV1: Schema; }; }; declare const actions: { functionCall: ({ methodName, gas, deposit, args, argsBase64, }: { methodName: string; gas?: string; deposit?: string; args?: Record; argsBase64?: string; }) => { type: "FunctionCall"; methodName: string; args: Record | undefined; argsBase64: string | undefined; gas: string | undefined; deposit: string | undefined; }; transfer: (yoctoAmount: string) => { type: "Transfer"; deposit: string; }; stakeNEAR: ({ amount, publicKey }: { amount: string; publicKey: string; }) => { type: "Stake"; stake: string; publicKey: NearPublicKey; }; addFullAccessKey: ({ publicKey }: { publicKey: string; }) => { type: "AddKey"; publicKey: NearPublicKey; accessKey: { nonce: number; permission: "FullAccess"; }; }; addLimitedAccessKey: ({ publicKey, allowance, accountId, methodNames, }: { publicKey: string; allowance: string; accountId: string; methodNames: string[]; }) => { type: "AddKey"; publicKey: NearPublicKey; accessKey: { nonce: number; permission: { allowance: string; receiverId: string; methodNames: string[]; }; }; }; addFullAccessGasKey: ({ publicKey, numNonces }: { publicKey: string; numNonces: number; }) => { type: "AddKey"; publicKey: NearPublicKey; accessKey: { nonce: number; permission: "GasKeyFullAccess"; numNonces: number; }; }; addLimitedAccessGasKey: ({ publicKey, numNonces, accountId, methodNames, }: { publicKey: string; numNonces: number; accountId: string; methodNames: string[]; }) => { type: "AddKey"; publicKey: NearPublicKey; accessKey: { nonce: number; permission: "GasKeyFunctionCall"; numNonces: number; receiverId: string; methodNames: string[]; }; }; transferToGasKey: ({ publicKey, deposit }: { publicKey: string; deposit: string; }) => { type: "TransferToGasKey"; publicKey: NearPublicKey; deposit: string; }; withdrawFromGasKey: ({ publicKey, amount }: { publicKey: string; amount: string; }) => { type: "WithdrawFromGasKey"; publicKey: NearPublicKey; amount: string; }; deleteKey: ({ publicKey }: { publicKey: string; }) => { type: "DeleteKey"; publicKey: NearPublicKey; }; deleteAccount: ({ beneficiaryId }: { beneficiaryId: string; }) => { type: "DeleteAccount"; beneficiaryId: string; }; createAccount: () => { type: "CreateAccount"; }; deployContract: ({ codeBase64 }: { codeBase64: string; }) => { type: "DeployContract"; codeBase64: string; }; signedDelegate: ({ delegateAction, signature, }: { delegateAction: NearDelegateAction; signature: string | Uint8Array; }) => { type: "SignedDelegate"; delegateAction: NearDelegateAction; signature: string | Uint8Array; }; }; declare const explain: { action: (action: any) => ExplainedAction; tx: ({ signerId, receiverId, actions, }: { signerId?: string; receiverId: string; actions: any[]; }) => ExplainedTransaction; error: (error: unknown) => ExplainedError; }; declare function listRecipes(): FastNearRecipeDiscoveryEntry[]; declare function viewAccountRecipe(input: string): Promise; declare function viewAccountRecipe(input: RecipeViewAccountParams): Promise; declare function inspectTransactionRecipe(input: string): Promise; declare function inspectTransactionRecipe(input: RecipeInspectTransactionParams): Promise; declare const recipes: { viewContract: (params: RecipeViewContractParams) => Promise; viewAccount: typeof viewAccountRecipe; inspectTransaction: typeof inspectTransactionRecipe; functionCall: ({ receiverId, methodName, args, argsBase64, gas, deposit, waitUntil, network, }: RecipeFunctionCallParams) => Promise; transfer: ({ receiverId, amount, waitUntil, network, }: RecipeTransferParams) => Promise; connect: (params?: RecipeConnectParams) => Promise<{ accountId: string; network?: string; publicKey?: string; signedMessage?: { accountId: string; publicKey: string; signature: string; }; } | undefined>; signMessage: (message: NEP413Message, options?: { network?: FastNearNetworkId; }) => Promise; list: typeof listRecipes; toJSON: typeof listRecipes; }; export { type AccessKeyInfoView, type AccessKeyListResponse, type AccessKeyPermissionView, type AccessKeyView, type AccessKeyWithError, type BatchItemResult, type BatchRequest, type BlockView, type ExplainedAction, type ExplainedError, type ExplainedTransaction, type FastNearApiAccountState, type FastNearApiFtTopAccount, type FastNearApiNftContractHolding, type FastNearApiPublicKeyAccount, type FastNearApiStakingPoolPosition, type FastNearApiTokenBalance, type FastNearApiV1AccountFtResponse, type FastNearApiV1AccountFullResponse, type FastNearApiV1AccountNftResponse, type FastNearApiV1AccountStakingResponse, type FastNearApiV1FtTopResponse, type FastNearApiV1PublicKeyAllResponse, type FastNearApiV1PublicKeyResponse, type FastNearBatchConfig, type FastNearKvAllByPredecessorResponse, type FastNearKvEntriesResponse, type FastNearKvEntry, type FastNearKvGetHistoryKeyResponse, type FastNearKvGetLatestKeyResponse, type FastNearKvHistoryByAccountResponse, type FastNearKvHistoryByPredecessorResponse, type FastNearKvLatestByAccountResponse, type FastNearKvLatestByPredecessorResponse, type FastNearKvMultiResponse, type FastNearKvMultiResult, type FastNearNeardataBlock, type FastNearNeardataBlockChunkResponse, type FastNearNeardataBlockHeader, type FastNearNeardataBlockHeadersResponse, type FastNearNeardataBlockOptimisticResponse, type FastNearNeardataBlockResponse, type FastNearNeardataBlockShardResponse, type FastNearNeardataChunk, type FastNearNeardataFirstBlockResponse, type FastNearNeardataHealthResponse, type FastNearNeardataLastBlockFinalResponse, type FastNearNeardataLastBlockOptimisticResponse, type FastNearNeardataShard, type FastNearNeardataTransaction, type FastNearNetworkId, type FastNearRecipeDiscoveryEntry, type FastNearRecipeViewAccountResult, type FastNearRpcAccountView, FastNearRpcError, type FastNearRpcQueryAccountResponse, type FastNearServiceConfig, type FastNearServicesConfig, type FastNearSignMessageParams, type FastNearTransfersEntry, type FastNearTransfersQueryResponse, type FastNearTxAccountResponse, type FastNearTxBlockResponse, type FastNearTxBlockRow, type FastNearTxBlocksResponse, type FastNearTxExecutionOutcome, type FastNearTxReceiptResponse, type FastNearTxReceiptRow, type FastNearTxTransactionRecord, type FastNearTxTransactionRow, type FastNearTxTransactionsResponse, type FunctionCallPermissionView, type GasKeyInfoView, type GasKeyNoncesResponse, type GasKeyPermissionInfo, type LastKnownBlock, MaxBlockDelayMs, type NetworkConfig, type RecipeConnectParams, type RecipeFunctionCallParams, type RecipeInspectTransactionInput, type RecipeInspectTransactionParams, type RecipeTransferParams, type RecipeViewAccountInput, type RecipeViewAccountParams, type RecipeViewContractParams, type ResolvedRetryConfig, type RetryConfig, type RpcErrorKind, type RpcRouteOptions, type RpcStatusResponse, type SendTxParams, type SignDelegateParams, type SignedDelegateResult, type ViewManySpec, type WalletProvider, type WritePolicy, accountId, actions, afterTxSent, api, authStatus, batch, config, createFundedTestnetAccount, event, exp, explain, fastdata, ft, gasKeyInfoFromPermission, gasPrice, generateTxId, getPublicKeyForContract, implicitAccountId, localTxHistory, neardata, nft, print, publicKey, queryAccessKey, queryAccessKeyList, queryAccount, queryBlock, queryGasKeyNonces, queryProtocolVersion, queryTx, recipes, relayDelegate, requestSignIn, selected, sendRpc, sendTx, sendTxToRpc, signDelegate, signMessage, signOut, state, status, transfers, tx, useWallet, utils, validators, view, withBlockId };