import { Schema } from 'borsh'; import { P as PublicKey, a as KeyType, K as KeyPairString } from './public_key-2MzNRk5k.cjs'; import { aK as BlockHeight, aH as BlockHash, aW as MerklePath, T as TxExecutionStatus, aJ as BlockHeaderInnerLiteView, aT as FinalityReference, A as AccessKeyList$1, C as CryptoHash, B as BlockReference, V as ViewStateResult$1, a as CallResult, R as RpcBlockResponse, b as ChunkId, c as RpcChunkResponse, d as BlockId, e as RpcGasPriceResponse, f as RpcStatusResponse, g as RpcValidatorResponse, h as RpcTransactionResponse, i as RpcReceiptResponse, j as RpcQueryResponse, k as RpcQueryRequest, l as RpcStateChangesInBlockByTypeResponse, m as RpcProtocolConfigResponse, n as RpcLightClientExecutionProofResponse, o as RpcLightClientNextBlockResponse, p as RpcStateChangesInBlockResponse, q as AccessKeyWithPublicKey } from './types.gen-LgOaxt6w.cjs'; declare abstract class Enum { abstract enum: string; constructor(properties: any); } /** * NEAR RPC API request types and responses * @module */ type SerializedReturnValue = string | number | boolean | object; declare enum ExecutionStatusBasic { Unknown = "Unknown", Pending = "Pending", Failure = "Failure" } interface ExecutionStatus { SuccessValue?: string; SuccessReceiptId?: string; Failure?: ExecutionError; } declare enum FinalExecutionStatusBasic { NotStarted = "NotStarted", Started = "Started", Failure = "Failure" } interface ExecutionError { error_message: string; error_type: string; } interface FinalExecutionStatus { SuccessValue?: string; Failure?: ExecutionError; } interface ExecutionOutcomeWithId { id: string; outcome: ExecutionOutcome; } interface ExecutionOutcome { logs: string[]; receipt_ids: string[]; gas_burnt: number; tokens_burnt: string; executor_id: string; status: ExecutionStatus | ExecutionStatusBasic; } type ReceiptAction = { Transfer: { deposit: string; }; }; interface ExecutionOutcomeReceiptDetail { predecessor_id: string; receipt: { Action: ExecutionOutcomeReceiptAction; }; receipt_id: string; receiver_id: string; } interface ExecutionOutcomeReceiptAction { actions: ReceiptAction[]; gas_price: string; input_data_ids: string[]; output_data_receivers: string[]; signer_id: string; signer_public_key: string; } interface ExecutionOutcomeWithIdView { proof: MerklePath; block_hash: string; id: string; outcome: ExecutionOutcome; } interface FinalExecutionOutcome { final_execution_status: TxExecutionStatus; status: FinalExecutionStatus | FinalExecutionStatusBasic; transaction: any; transaction_outcome: ExecutionOutcomeWithId; receipts_outcome: ExecutionOutcomeWithId[]; receipts?: ExecutionOutcomeReceiptDetail[]; } interface QueryResponseKind { block_height: BlockHeight; block_hash: BlockHash; } interface AccountViewRaw extends QueryResponseKind { amount: string; locked: string; code_hash: string; storage_usage: number; storage_paid_at: BlockHeight; } interface AccountView extends QueryResponseKind { amount: bigint; locked: bigint; code_hash: string; storage_usage: number; storage_paid_at?: BlockHeight; } interface AccountBalanceInfo { total: bigint; usedOnStorage: bigint; locked: bigint; available: bigint; } interface StateItem { key: string; value: string; proof: string[]; } interface ViewStateResult extends QueryResponseKind { values: StateItem[]; proof: string[]; } interface CodeResult extends QueryResponseKind { result: number[]; logs: string[]; } interface CallContractViewFunctionResultRaw extends QueryResponseKind { result: number[]; logs: string[]; } interface StateItemView { key: string; value: string; proof: string[]; } interface ContractStateView extends QueryResponseKind { values: StateItemView[]; } interface ContractCodeViewRaw extends QueryResponseKind { code_base64: string; hash: string; } interface ContractCodeView extends QueryResponseKind { code: Uint8Array; hash: string; } interface FunctionCallPermissionView { FunctionCall: { allowance?: string | null; receiver_id: string; method_names: string[]; }; } interface AccessKeyViewRaw extends QueryResponseKind { nonce: number; permission: 'FullAccess' | FunctionCallPermissionView; } interface AccessKeyView extends QueryResponseKind { nonce: bigint; permission: 'FullAccess' | FunctionCallPermissionView; } interface AccessKeyList extends QueryResponseKind { keys: AccessKeyInfoView[]; } interface AccessKeyInfoView { public_key: string; access_key: AccessKeyView; } interface AccessKeyInfoView { public_key: string; access_key: AccessKeyView; } /** * NEAR RPC API request types and responses * @module */ interface CurrentEpochValidatorInfo { account_id: string; public_key: string; is_slashed: boolean; stake: string; shards: number[]; num_produced_blocks: number; num_expected_blocks: number; } interface NextEpochValidatorInfo { account_id: string; public_key: string; stake: string; shards: number[]; } interface ValidatorStakeView { account_id: string; public_key: string; stake: string; validator_stake_struct_version: string; } interface EpochValidatorInfo { next_validators: NextEpochValidatorInfo[]; current_validators: CurrentEpochValidatorInfo[]; next_fisherman: ValidatorStakeView[]; current_fisherman: ValidatorStakeView[]; current_proposals: ValidatorStakeView[]; prev_epoch_kickout: ValidatorStakeView[]; epoch_start_height: number; } interface StakedAccount { account_id: string; unstaked_balance: string; staked_balance: string; can_withdraw: boolean; } /** * NEAR RPC API request types and responses * @module */ interface LightClientBlockLiteView { prev_block_hash: string; inner_rest_hash: string; inner_lite: BlockHeaderInnerLiteView; } interface LightClientProof { outcome_proof: ExecutionOutcomeWithIdView; outcome_root_proof: MerklePath; block_header_lite: LightClientBlockLiteView; block_proof: MerklePath; } declare enum IdType { Transaction = "transaction", Receipt = "receipt" } interface LightClientProofRequest { type: IdType; light_client_head: string; transaction_hash?: string; sender_id?: string; receipt_id?: string; receiver_id?: string; } interface NextLightClientBlockResponse { prev_block_hash: string; next_block_inner_hash: string; inner_lite: BlockHeaderInnerLiteView; inner_rest_hash: string; next_bps?: ValidatorStakeView[]; approvals_after_next: (string | null)[]; } interface NextLightClientBlockRequest { last_block_hash: string; } declare class DelegateAction { senderId: string; receiverId: string; actions: Array; nonce: bigint; maxBlockHeight: bigint; publicKey: PublicKey; constructor({ senderId, receiverId, actions, nonce, maxBlockHeight, publicKey, }: { senderId: string; receiverId: string; actions: Action[]; nonce: bigint; maxBlockHeight: bigint; publicKey: PublicKey; }); } /** * Compose a delegate action for inclusion with a meta transaction signed on the sender's behalf * @param options Delegate action options * @param options.actions The set of actions to be included in the meta transaction * @param options.maxBlockHeight The maximum block height for which this action can be executed as part of a transaction * @param options.nonce Current nonce on the access key used to sign the delegate action * @param options.publicKey Public key for the access key used to sign the delegate action * @param options.receiverId Account ID for the intended receiver of the meta transaction * @param options.senderId Account ID for the intended signer of the delegate action */ declare function buildDelegateAction({ actions, maxBlockHeight, nonce, publicKey, receiverId, senderId, }: DelegateAction): DelegateAction; declare class ED25519Signature { keyType: KeyType; data: Uint8Array; } declare class SECP256K1Signature { keyType: KeyType; data: Uint8Array; } declare class MLDSA65Signature { keyType: KeyType; data: Uint8Array; } declare class Signature extends Enum { enum: string; ed25519Signature?: ED25519Signature; secp256k1Signature?: SECP256K1Signature; mlDsa65Signature?: MLDSA65Signature; constructor(signature: { keyType: KeyType; data: Uint8Array; }); get signature(): ED25519Signature | SECP256K1Signature | MLDSA65Signature | undefined; get signatureType(): KeyType; get data(): Uint8Array; } declare class FunctionCallPermission { allowance?: bigint; receiverId: string; methodNames: string[]; constructor({ allowance, receiverId, methodNames, }: { allowance?: bigint; receiverId: string; methodNames: string[]; }); } declare class FullAccessPermission { } declare class AccessKeyPermission extends Enum { enum: string; functionCall?: FunctionCallPermission; fullAccess?: FullAccessPermission; constructor(props: any); } declare class AccessKey { nonce: bigint; permission: AccessKeyPermission; constructor({ nonce, permission }: { nonce: bigint; permission: AccessKeyPermission; }); } declare class CreateAccount { } declare class DeployContract { code: Uint8Array; constructor({ code }: { code: Uint8Array; }); } declare class FunctionCall { methodName: string; args: Uint8Array; gas: bigint; deposit: bigint; constructor({ methodName, args, gas, deposit, }: { methodName: string; args: Uint8Array; gas: bigint; deposit: bigint; }); } declare class GlobalContractDeployMode extends Enum { enum: string; CodeHash?: null; AccountId?: null; constructor(props: { CodeHash?: null; AccountId?: null; }); } declare class GlobalContractIdentifier extends Enum { enum: string; CodeHash?: Uint8Array; AccountId?: string; constructor(props: { CodeHash?: Uint8Array; AccountId?: string; }); } declare class DeployGlobalContract { code: Uint8Array; deployMode: GlobalContractDeployMode; constructor({ code, deployMode }: { code: Uint8Array; deployMode: GlobalContractDeployMode; }); } declare class UseGlobalContract { contractIdentifier: GlobalContractIdentifier; constructor({ contractIdentifier }: { contractIdentifier: GlobalContractIdentifier; }); } declare class Transfer { deposit: bigint; constructor({ deposit }: { deposit: bigint; }); } declare class Stake { stake: bigint; publicKey: PublicKey; constructor({ stake, publicKey }: { stake: bigint; publicKey: PublicKey; }); } declare class AddKey { publicKey: PublicKey; accessKey: AccessKey; constructor({ publicKey, accessKey }: { publicKey: PublicKey; accessKey: AccessKey; }); } declare class DeleteKey { publicKey: PublicKey; constructor({ publicKey }: { publicKey: PublicKey; }); } declare class DeleteAccount { beneficiaryId: string; constructor({ beneficiaryId }: { beneficiaryId: string; }); } declare class SignedDelegate { delegateAction: DelegateAction; signature: Signature; constructor({ delegateAction, signature }: { delegateAction: DelegateAction; signature: Signature; }); } /** * Contains a list of the valid transaction Actions available with this API * @see {@link https://nomicon.io/RuntimeSpec/Actions.html | Actions Spec} */ declare class Action extends Enum { enum: string; createAccount?: CreateAccount; deployContract?: DeployContract; functionCall?: FunctionCall; transfer?: Transfer; stake?: Stake; addKey?: AddKey; deleteKey?: DeleteKey; deleteAccount?: DeleteAccount; signedDelegate?: SignedDelegate; deployGlobalContract?: DeployGlobalContract; useGlobalContract?: UseGlobalContract; constructor(props: any); } /** * Borsh-encode a delegate action for inclusion as an action within a meta transaction * NB per NEP-461 this requires a Borsh-serialized prefix specific to delegate actions, ensuring * signed delegate actions may never be identical to signed transactions with the same fields * @param delegateAction Delegate action to be signed by the meta transaction sender */ declare function encodeDelegateAction(delegateAction: DelegateAction): Uint8Array; /** * Borsh-encode a signed delegate for validation and execution by a relayer * @param signedDelegate Signed delegate to be executed in a meta transaction */ declare function encodeSignedDelegate(signedDelegate: SignedDelegate): Uint8Array; /** * Borsh-encode a transaction or signed transaction into a serialized form. * @param transaction The transaction or signed transaction object to be encoded. * @returns A serialized representation of the input transaction. */ declare function encodeTransaction(transaction: Transaction | SignedTransaction): Uint8Array; /** * Borsh-decode a Transaction instance from a buffer * @param bytes Uint8Array data to be decoded */ declare function decodeTransaction(bytes: Uint8Array): Transaction; /** * Borsh-decode a SignedTransaction instance from a buffer * @param bytes Uint8Array data to be decoded */ declare function decodeSignedTransaction(bytes: Uint8Array): SignedTransaction; declare class Transaction { signerId: string; publicKey: PublicKey; nonce: bigint; receiverId: string; actions: Action[]; blockHash: Uint8Array; constructor({ signerId, publicKey, nonce, receiverId, actions, blockHash, }: { signerId: string; publicKey: PublicKey; nonce: bigint; receiverId: string; actions: Action[]; blockHash: Uint8Array; }); encode(): Uint8Array; static decode(bytes: Uint8Array): Transaction; } declare class SignedTransaction { transaction: Transaction; signature: Signature; constructor({ transaction, signature }: { transaction: Transaction; signature: Signature; }); encode(): Uint8Array; static decode(bytes: Uint8Array): SignedTransaction; } declare const SCHEMA: { Ed25519Signature: Schema; Secp256k1Signature: Schema; MlDsa65Signature: Schema; Signature: Schema; Ed25519Data: Schema; Secp256k1Data: Schema; MlDsa65Data: Schema; PublicKey: Schema; FunctionCallPermission: Schema; FullAccessPermission: Schema; AccessKeyPermission: Schema; AccessKey: Schema; CreateAccount: Schema; DeployContract: Schema; FunctionCall: Schema; Transfer: Schema; Stake: Schema; AddKey: Schema; DeleteKey: Schema; DeleteAccount: Schema; GlobalContractDeployMode: Schema; GlobalContractIdentifier: Schema; DeployGlobalContract: Schema; UseGlobalContract: Schema; DelegateActionPrefix: Schema; /** @todo: get rid of "ClassicActions" and keep only "Action" schema to be consistent with "nearcore" */ ClassicActions: Schema; DelegateAction: Schema; SignedDelegate: Schema; Action: Schema; Transaction: Schema; SignedTransaction: Schema; }; /** * NEAR RPC API request types and responses * @module */ type Prettify = { [K in keyof T]: T[K]; } & {}; interface FinalityQuery { finalityQuery?: FinalityReference; } interface BlockQuery { blockQuery?: BlockReference; } interface TransactionExecutionReference { waitUntil?: TxExecutionStatus; } type ViewAccessKeyArgs = Prettify<{ accountId: string; publicKey: PublicKey | string; } & FinalityQuery>; type ViewAccessKeyListArgs = Prettify<{ accountId: string; } & FinalityQuery>; type ViewAccountArgs = Prettify<{ accountId: string; } & BlockQuery>; type ViewContractCodeArgs = Prettify<{ contractId: string; } & BlockQuery>; type ViewGlobalContractCodeArgs = Prettify<{ identifier: { codeHash: CryptoHash | Uint8Array; } | { accountId: string; }; } & BlockQuery>; type ViewContractStateArgs = Prettify<{ contractId: string; prefix?: string; } & BlockQuery>; type CallFunctionArgs$1 = Prettify<{ contractId: string; method: string; args: Record | Uint8Array; } & BlockQuery>; type ViewValidatorsArgs = { blockId: BlockId; } | { epochId: string; }; type ViewTransactionStatusArgs = Prettify<{ txHash: Uint8Array | string; accountId: string; } & TransactionExecutionReference>; /** @hidden */ interface Provider { getNetworkId(): Promise; viewAccessKey(params: ViewAccessKeyArgs): Promise; viewAccessKeyList(params: ViewAccessKeyListArgs): Promise; viewAccount(params: ViewAccountArgs): Promise; viewContractCode(params: ViewContractCodeArgs): Promise; viewGlobalContractCode(params: ViewGlobalContractCodeArgs): Promise; viewContractState(params: ViewContractStateArgs): Promise; callFunction(params: CallFunctionArgs$1): Promise; callFunctionRaw(params: CallFunctionArgs$1): Promise; viewBlock(blockQuery: BlockReference): Promise; viewChunk(chunkId: ChunkId): Promise; viewGasPrice(blockId?: BlockId): Promise; viewNodeStatus(): Promise; viewValidators(params?: ViewValidatorsArgs): Promise; viewTransactionStatus(params: ViewTransactionStatusArgs): Promise; viewTransactionStatusWithReceipts(params: ViewTransactionStatusArgs): Promise; viewTransactionReceipt(receiptId: string): Promise; sendTransactionUntil(signedTransaction: SignedTransaction, waitUntil: TxExecutionStatus): Promise; sendTransaction(signedTransaction: SignedTransaction): Promise; sendTransactionAsync(signedTransaction: SignedTransaction): Promise; query>(params: RpcQueryRequest): Promise; blockChanges(blockQuery: BlockId | BlockReference): Promise; experimental_protocolConfig(blockReference: BlockReference | { sync_checkpoint: 'genesis'; }): Promise; lightClientProof(request: LightClientProofRequest): Promise; nextLightClientBlock(request: NextLightClientBlockRequest): Promise; accessKeyChanges(accountIdArray: string[], BlockQuery: BlockId | BlockReference): Promise; singleAccessKeyChanges(accessKeyArray: AccessKeyWithPublicKey[], BlockQuery: BlockId | BlockReference): Promise; accountChanges(accountIdArray: string[], BlockQuery: BlockId | BlockReference): Promise; contractStateChanges(accountIdArray: string[], BlockQuery: BlockId | BlockReference, keyPrefix: string): Promise; contractCodeChanges(accountIdArray: string[], BlockQuery: BlockId | BlockReference): Promise; getCurrentEpochSeatPrice(): Promise; getNextEpochSeatPrice(): Promise; } interface MessagePayload { message: string; recipient: string; nonce: Uint8Array; callbackUrl?: string; } interface SignedMessage { accountId: string; publicKey: PublicKey; signature: Uint8Array; state?: string; } interface SignTransactionReturn { txHash: Uint8Array; signedTransaction: SignedTransaction; } interface SignDelegateActionReturn { delegateHash: Uint8Array; signedDelegate: SignedDelegate; } /** * General signing interface, can be used for in memory signing, RPC singing, external wallet, HSM, etc. * * The signer must return a valid PublicKey from `getPublicKey()`, and must implement raw byte signing * that can be verified with the corresponding public key. (To verify the signature, serialize and hash transaction/delegate action, * or get payload hash for NEP-413 message from `utils.ts` and verify with the public key). */ declare abstract class Signer { /** * Returns public key for given signer */ abstract getPublicKey(): Promise; /** * Implement this method to sign given bytes payload. * @param bytes - The payload to sign. * @returns {Promise} - Promise of the bytes representation of the signature. */ protected abstract signBytes(bytes: Uint8Array): Promise; /** * Signs given message according to NEP-413 requirements * @see https://github.com/near/NEPs/blob/master/neps/nep-0413.md * * @param accountId - The account name to which the public key corresponds (e.g. "alice.near"). * @param params - The parameters including message, recipient, nonce, and optional callbackUrl. */ signNep413Message(accountId: string, params: MessagePayload): Promise; /** * Signs given transaction. * @param transaction - The transaction to sign. * @returns {Promise<[Uint8Array, SignedTransaction]>} - Promise of the hash that can be verified and signed transaction. */ signTransaction(transaction: Transaction): Promise; /** * Signs given delegate action. * @param delegateAction - The delegate action to sign. * @returns {Promise<[Uint8Array, SignedDelegate]>} - Promise of the hash that can be verified and signed delegate action. */ signDelegateAction(delegateAction: DelegateAction): Promise; } interface FTMetadata { spec?: string; name: string; decimals: number; symbol: string; icon?: string; } declare abstract class BaseFT { readonly metadata: FTMetadata; constructor(metadata: FTMetadata); /** * Converts a decimal number to indivisible units * * @param amount The amount in decimal format (e.g. "1.234") * @returns The amount in indivisible units (e.g. "1234") */ toUnits(amount: string | number): bigint; /** * Converts indivisible units to a decimal number (represented as a string) * * @param amount The amount in indivisible units (e.g. "1234") * @param precision (optional) number of digits shown to the right of the decimal point - rounded down * @returns The amount as a decimal string (e.g. "1.234") */ toDecimal(amount: bigint | string | number, precision?: number): string; /** * Get the available balance of an account in indivisible units * * @param account The account to get the balance of * @returns */ abstract getBalance(account: Account): Promise; /** * Transfer tokens from one account to another * * @param param * @param param.from The Account that will transfer the tokens * @param param.receiverId The AccountID that will receive the tokens * @param param.amount The amount of tokens to transfer in the smallest unit */ abstract transfer({ from, receiverId, amount, }: { from: Account; receiverId: string; amount: string | number | bigint; }): Promise; } declare class NativeToken extends BaseFT { transfer({ from, receiverId, amount, }: { from: Account; receiverId: string; amount: string | number | bigint; }): Promise; getBalance(account: Account): Promise; } declare class FungibleToken extends BaseFT { readonly accountId: string; constructor(accountId: string, metadata: FTMetadata); transfer({ from, receiverId, amount, }: { from: Account; receiverId: string; amount: string | number | bigint; }): Promise; getBalance({ accountId, provider }: { accountId: string; provider: Provider; }): Promise; /** * Transfer tokens and call a function on the receiver contract, * only works if the receiver implements the `ft_on_transfer` method * * @param param Transfer call parameters * @param param.from The Account that will transfer the tokens * @param param.receiverId The AccountID that will receive the tokens * @param param.amount The amount of tokens to transfer in the smallest unit * @param param.msg The message to send to the `ft_on_transfer` method */ transferCall({ from, receiverId, amount, msg, }: { from: Account; receiverId: string; amount: bigint; msg: string; }): Promise; /** * Register an account to the fungible token contract by paying a storage deposit * * @param param * @param param.accountIdToRegister The AccountID to register * @param param.fundingAccount The Account that will fund the registration */ registerAccount({ accountIdToRegister, fundingAccount, }: { accountIdToRegister: string; fundingAccount: Account; }): Promise; /** * Unregister an account from the fungible token contract by paying a storage deposit * * @param param * @param param.account The Account to unregister * @param param.force Whether to remove the account without claiming the storage deposit */ unregisterAccount({ account, force }: { account: Account; force: boolean; }): Promise; /** * Checks if an account is registered to the fungible token contract * * @param param * @param param.accountId The AccountID to check * @param param.provider A Provider to use for the query * @returns Whether the account is registered */ isAccountRegistered({ accountId, provider, }: { accountId: string; provider: Provider; }): Promise; } /** * The NEAR token is the native token of the NEAR blockchain */ declare const NEAR: NativeToken; interface AccountState { balance: { total: bigint; usedOnStorage: bigint; locked: bigint; available: bigint; }; storageUsage: number; codeHash: string; } interface CreateTransactionArgs { receiverId: string; actions: Action[]; publicKey: string | PublicKey; } interface CreateSignedTransactionArgs { receiverId: string; actions: Action[]; signer?: Signer; } interface CreateMetaTransactionArgs { receiverId: string; actions: Action[]; blockHeightTtl?: number; publicKey: PublicKey | string; } interface CreateSignedMetaTransactionArgs { receiverId: string; actions: Action[]; blockHeightTtl?: number; signer?: Signer; } interface SignAndSendTransactionArgs { receiverId: string; actions: Action[]; waitUntil?: TxExecutionStatus; throwOnFailure?: boolean; signer?: Signer; retries?: number; } interface SignAndSendTransactionsArgs { transactions: Array<{ receiverId: string; actions: Action[]; }>; waitUntil?: TxExecutionStatus; throwOnFailure?: boolean; signer?: Signer; } interface CreateAccountArgs { newAccountId: string; publicKey: PublicKey | string; nearToTransfer?: bigint | string | number; } interface CreateSubAccountArgs { accountOrPrefix: string; publicKey: PublicKey | string; nearToTransfer?: bigint | string | number; } interface AddFunctionAccessKeyArgs { publicKey: PublicKey | string; contractId: string; methodNames?: string[]; allowance?: bigint | string | number; } interface CallFunctionArgs { contractId: string; methodName: string; args?: Uint8Array | Record; deposit?: bigint | string | number; gas?: bigint | string | number; waitUntil?: TxExecutionStatus; } interface SignNep413MessageArgs { message: string; recipient: string; nonce: Uint8Array; callbackUrl?: string; } interface TransferArgs { receiverId: string; amount: bigint | string | number; token?: NativeToken | FungibleToken; } /** * This class allows to access common account information. * If a {@link Signer} is provider, then the account can * be used to perform all common actions such as * transferring tokens and calling functions */ declare class Account { readonly accountId: string; readonly provider: Provider; private signer?; private readonly nonceManager; constructor(accountId: string, provider: Provider | string, signer?: Signer | KeyPairString); /** * Allows to set the signer used to control the account * * @param signer holds the private key and can sign Transactions */ setSigner(signer: Signer): void; getSigner(): Signer | undefined; /** * Returns an overview of the account's state, including the account's * balance, storage usage, and code hash */ getState(): Promise; /** * Calls {@link Provider.viewAccessKey} to retrieve information for a * specific key in the account */ getAccessKey(publicKey: PublicKey | string): Promise; /** * Calls {@link Provider.viewAccessKeyList} to retrieve the account's keys */ getAccessKeyList(): Promise; /** * Calls {@link Provider.viewContractCode} to retrieve the account's * contract code and its hash */ getContractCode(): Promise; /** * Calls {@link Provider.viewContractState} to retrieve the keys and values * stored on the account's contract */ getContractState(prefix?: string): Promise; /** * Create a transaction that can be later signed with a {@link Signer} * * @param options Transaction options * @param options.receiverId Account against which to perform the actions * @param options.actions Actions to perform * @param options.publicKey The public part of the key that will be used to sign the transaction */ createTransaction({ receiverId, actions, publicKey }: CreateTransactionArgs): Promise; /** * Create a signed transaction ready to be broadcast by a {@link Provider} */ createSignedTransaction({ receiverId, actions, signer, }: CreateSignedTransactionArgs): Promise; /** * Create a meta transaction ready to be signed by a {@link Signer} * * @param options Meta transaction options * @param options.receiverId NEAR account receiving the transaction * @param options.actions list of actions to perform as part of the meta transaction * @param options.blockHeightTtl number of blocks after which a meta transaction will expire if not processed */ createMetaTransaction({ receiverId, actions, blockHeightTtl, publicKey, }: CreateMetaTransactionArgs): Promise; /** * Create a signed MetaTransaction that can be broadcasted to a relayer * * @param options Signed meta transaction options * @param options.receiverId NEAR account receiving the transaction * @param options.actions list of actions to perform as part of the meta transaction * @param options.blockHeightTtl number of blocks after which a meta transaction will expire if not processed */ createSignedMetaTransaction({ receiverId, actions, blockHeightTtl, signer, }: CreateSignedMetaTransactionArgs): Promise; /** * Creates a transaction, signs it and broadcast it to the network * * @param options Sign and send transaction options * @param options.receiverId The NEAR account ID of the transaction receiver. * @param options.actions The list of actions to be performed in the transaction. * @param options.throwOnFailure Whether to throw an error if the transaction fails. * */ signAndSendTransaction({ receiverId, actions, waitUntil, throwOnFailure, signer, retries, }: SignAndSendTransactionArgs): Promise; signAndSendTransactions({ transactions, waitUntil, throwOnFailure, signer, }: SignAndSendTransactionsArgs): Promise; /** * Creates a new NEAR account with a given ID and public key. * * This method can create two types of accounts: * * 1. Top-level accounts of the form `name.tla` (e.g., `bob.near`): * * 2. Sub-accounts of the current account (e.g., `sub.ana.near`): * - The new account ID must end with the current account ID * - Example: If your account is `ana.near`, you can create `sub.ana.near` * * @param options Account creation options * @param options.newAccountId the new account to create (e.g. bob.near or sub.ana.near) * @param options.publicKey the public part of the key that will control the account * @param options.nearToTransfer how much NEAR to transfer to the account in yoctoNEAR (default: 0) * */ createAccount({ newAccountId, publicKey, nearToTransfer }: CreateAccountArgs): Promise; /** * Creates a sub account of this account. For example, if the account is * ana.near, you can create sub.ana.near. * * @param options Sub-account creation options * @param options.accountOrPrefix a prefix (e.g. `sub`) or the full sub-account (`sub.ana.near`) * @param options.publicKey the public part of the key that will control the account * @param options.nearToTransfer how much NEAR to transfer to the account (default: 0) * */ createSubAccount({ accountOrPrefix, publicKey, nearToTransfer }: CreateSubAccountArgs): Promise; /** * Deletes the account, transferring all remaining NEAR to a beneficiary * account * * Important: Deleting an account does not transfer FTs or NFTs * * @param beneficiaryId Will receive the account's remaining balance */ deleteAccount(beneficiaryId: string): Promise; /** * Deploy a smart contract in the account * * @param code The compiled contract code bytes */ deployContract(code: Uint8Array): Promise; /** * Deploy a global contract that can be reused by multiple accounts * * @param code The compiled contract code bytes * @param deployMode Deploy mode - "codeHash" for immutable contracts, "accountId" for updateable contracts */ deployGlobalContract(code: Uint8Array, deployMode: 'codeHash' | 'accountId'): Promise; /** * Use a previously deployed global contract on this account * * @param contractIdentifier The global contract identifier - either { accountId: string } or { codeHash: string | Uint8Array } */ useGlobalContract(contractIdentifier: { accountId: string; } | { codeHash: string | Uint8Array; }): Promise; /** * * @param options * @param options.publicKey The key to add to the account * @param options.contractId The contract that this key can call * @param options.methodNames The methods this key is allowed to call * @param options.allowance The amount of NEAR this key can expend in gas * @returns */ addFunctionCallAccessKey({ publicKey, contractId, methodNames, allowance, }: AddFunctionAccessKeyArgs): Promise; /** * Add a full access key to the account * * @param publicKey The public key to be added */ addFullAccessKey(publicKey: PublicKey | string): Promise; /** * @param publicKey The public key to be deleted */ deleteKey(publicKey: PublicKey | string): Promise; /** * Call a function on a smart contract and return parsed transaction result * * @param params Call function parameters * @param params.contractId The contract in which to call the function * @param params.methodName The method that will be called * @param params.args Arguments, either as a valid JSON Object or a raw Uint8Array * @param params.deposit (optional) Amount of NEAR Tokens to attach to the call (default 0) * @param params.gas (optional) Amount of GAS to use attach to the call (default 30TGas) * @param params.waitUntil (optional) Transaction finality to wait for (default INCLUDED_FINAL) * @returns */ callFunction(params: CallFunctionArgs): Promise; /** * Call a function on a smart contract and return raw transaction outcome * * @param params Call function parameters * @param params.contractId The contract in which to call the function * @param params.methodName The method that will be called * @param params.args Arguments, either as a valid JSON Object or a raw Uint8Array * @param params.deposit (optional) Amount of NEAR Tokens to attach to the call (default 0) * @param params.gas (optional) Amount of GAS to use attach to the call (default 30TGas) * @param params.waitUntil (optional) Transaction finality to wait for (default INCLUDED_FINAL) */ callFunctionRaw({ contractId, methodName, args, deposit, gas, waitUntil, }: CallFunctionArgs): Promise; /** * This function simply calls the `signNep413Message` method of the Signer * * @deprecated This method is deprecated and will be removed in future versions. Please use `signMessage` from `near-api-js/nep413` to sign NEP-413 messages. * * @param args Nep413 message signing arguments * @param args.message The message to be signed (e.g. "authenticating") * @param args.recipient Who will receive the message (e.g. auth.app.com) * @param args.nonce A challenge sent by the recipient * @param args.callbackUrl (optional) Deprecated parameter used only by browser wallets * @returns */ signNep413Message({ message, recipient, nonce, callbackUrl, }: SignNep413MessageArgs): Promise; /** * * @param token The token to check the balance of. Defaults to Native NEAR. * @returns The available balance of the account in units (e.g. yoctoNEAR). */ getBalance(token?: NativeToken | FungibleToken): Promise; /** * Relay a meta-transaction signed by a different account * * @param signedDelegate The signed delegate action to relay * @returns The transaction response from the relayed meta-transaction */ relayMetaTransaction(signedDelegate: SignedDelegate): Promise; /** * Transfers a token to the specified receiver. * * Supports sending either the native NEAR token or any supported Fungible Token (FT). * * @param options Transfer options * @param options.amount - The amount of tokens to transfer in units (e.g. yoctoNEAR). * @param options.receiverId - The NEAR account ID of the receiver. * @param options.token - The token to transfer. Defaults to Native NEAR. * */ transfer({ receiverId, amount, token }: TransferArgs): Promise; } export { type ExecutionOutcomeWithIdView as $, Action as A, AddKey as B, type ContractCodeView as C, DelegateAction as D, type CallContractViewFunctionResultRaw as E, type FinalExecutionOutcome as F, type CodeResult as G, type ContractCodeViewRaw as H, type ContractStateView as I, CreateAccount as J, DeleteAccount as K, type LightClientProofRequest as L, type MessagePayload as M, type NextLightClientBlockRequest as N, DeleteKey as O, type Provider as P, DeployContract as Q, DeployGlobalContract as R, Signature as S, Transaction as T, Enum as U, type ViewAccessKeyArgs as V, type EpochValidatorInfo as W, type ExecutionError as X, type ExecutionOutcome as Y, type ExecutionOutcomeReceiptDetail as Z, type ExecutionOutcomeWithId as _, AccessKey as a, type ExecutionStatus as a0, ExecutionStatusBasic as a1, type FinalExecutionStatus as a2, FinalExecutionStatusBasic as a3, FullAccessPermission as a4, FunctionCall as a5, FunctionCallPermission as a6, type FunctionCallPermissionView as a7, GlobalContractDeployMode as a8, GlobalContractIdentifier as a9, IdType as aa, type LightClientBlockLiteView as ab, type LightClientProof as ac, type NextLightClientBlockResponse as ad, type QueryResponseKind as ae, SCHEMA as af, SignedDelegate as ag, Stake as ah, type StakedAccount as ai, Transfer as aj, UseGlobalContract as ak, type ValidatorStakeView as al, type ViewStateResult as am, buildDelegateAction as an, decodeSignedTransaction as ao, decodeTransaction as ap, encodeDelegateAction as aq, encodeSignedDelegate as ar, encodeTransaction as as, FungibleToken as at, NEAR as au, NativeToken as av, type AccessKeyView as b, type ViewAccessKeyListArgs as c, type ViewAccountArgs as d, type AccountView as e, type ViewContractCodeArgs as f, type ViewGlobalContractCodeArgs as g, type ViewContractStateArgs as h, type SerializedReturnValue as i, type CallFunctionArgs$1 as j, type ViewTransactionStatusArgs as k, SignedTransaction as l, type ViewValidatorsArgs as m, Signer as n, type SignedMessage as o, type SignTransactionReturn as p, type SignDelegateActionReturn as q, Account as r, type CurrentEpochValidatorInfo as s, type NextEpochValidatorInfo as t, type AccessKeyInfoView as u, type AccessKeyList as v, AccessKeyPermission as w, type AccessKeyViewRaw as x, type AccountBalanceInfo as y, type AccountViewRaw as z };