UNPKG

@neardefi/shade-agent-js

Version:

This library is intended to be used in conjunction with the [shade agent template](https://github.com/NearDeFi/shade-agent-template/).

67 lines (64 loc) 2.59 kB
import { Account } from '@near-js/accounts'; declare const parseNearAmount: (amt: any) => bigint; declare const contractId: string; declare const networkId: string; /** * Sets a key pair for an account in the in-memory keystore * @param {string} accountId - NEAR account ID * @param {string} secretKey - Account's secret key */ declare const setKey: (accountId: any, secretKey: any) => void; /** * Converts a public key string to an implicit account ID * @param {string} pubKeyStr - Public key string * @returns {string} Implicit account ID (hex encoded) */ declare const getImplicit: (pubKeyStr: any) => string; /** * Creates a NEAR Account instance * @param {string} [id=_accountId] - NEAR account ID * @returns {Account} NEAR Account instance */ declare const getAccount: (id?: any) => Account; /** * Returns the current account ID (typically the agent account after setKey has been called in deriveAgentAccount) * @returns {String} Agent Account ID */ declare const getCurrentAccountId: () => any; /** * Gets the balance of a NEAR account * @param {string} accountId - NEAR account ID * @returns {Promise<{available: string}>} Account balance */ declare const getBalance: (accountId: any) => Promise<bigint>; /** * Calls a view method on a NEAR contract * @param {string} [contractId = _contractId] - Contract ID to call, default is the contractId from env, _contractId * @param {string} methodName - Contract method name * @param {Object} args - Method arguments * @returns {Promise<any>} Method result */ declare const contractView: ({ contractId, methodName, args, }: { contractId?: string; methodName: any; args?: {}; }) => Promise<any>; /** * Calls a change method on a NEAR contract * @param {string} methodName - Contract method name * @param {Object} args - Method arguments * @param {string} [accountId = _accountId] - Account ID to use for the call, default is the agent account ID, _accountId * @param {string} [contractId = _contractId] - Contract ID to call, default is the contractId from env, _contractId * @param {bigint} [gas] - gas * @param {bigint} [deposit='0'] - near to attach in yoctoNEAR * @returns {Promise<any>} Transaction result */ declare const contractCall: ({ accountId, contractId, methodName, args, gas, deposit, }: { accountId?: any; contractId?: string; methodName: any; args: any; gas?: bigint; deposit?: bigint; }) => Promise<any>; export { contractCall, contractId, contractView, getAccount, getBalance, getCurrentAccountId, getImplicit, networkId, parseNearAmount, setKey };