import { pMap } from '@collabland/common'; import { Account, SignAndSendTransactionOptions } from '@near-js/accounts'; import { Action } from '@near-js/transactions'; import { ExecutionError, ExecutionStatusBasic, FinalExecutionOutcome, FinalExecutionStatusBasic } from '@near-js/types'; import BN from 'bn.js'; export declare namespace nep141 { /** * https://github.com/near/NEPs/blob/master/specs/Standards/Tokens/FungibleTokenMetadata.md */ type TokenMetadata = { /** * a string. Should be `ft-1.0.0` to indicate that a Fungible Token contract * adheres to the current versions of this Metadata and the Fungible Token * Core specs. This will allow consumers of the Fungible Token to know if * they support the features of a given contract. */ spec: string; /** * The human-readable name of the token. */ name: string; /** * The abbreviation, like wETH or AMPL. */ symbol: string; /** * Used in front-ends to show the proper significant digits of a token. */ decimals: number; /** * A small image associated with this token. Must be a data URL, to help * consumers display it quickly while protecting user data. Recommendation: * use optimized SVG, which can result in high-resolution images with only * 100s of bytes of storage cost. (Note that these storage costs are incurred * to the token owner/deployer, but that querying these icons is a very cheap * & cacheable read operation for all consumers of the contract and the RPC * nodes that serve the data.) Recommendation: create icons that will work * well with both light-mode and dark-mode websites by either using * middle-tone color schemes, or by embedding media queries in the SVG. */ icon?: string; /** * A link to a valid JSON file containing various keys offering supplementary * details on the token. */ reference?: string; /** * The base64-encoded sha256 hash of the JSON file contained in the reference * field. This is to guard against off-chain tampering. */ reference_hash?: string; }; } export declare namespace nep171 { type Token = { token_id: string; owner_id: string; metadata: TokenMetadata; approved_account_ids: Record; royalty: Record; token_type?: string; }; /** * https://github.com/near/NEPs/blob/master/specs/Standards/NonFungibleToken/Metadata.md#interface */ type ContractMetadata = { /** * required, essentially a version like "nft-1.0.0" */ spec: string; /** * required, ex. "Mochi Rising — Digital Edition" or "Metaverse 3" */ name: string; /** * required, ex. "MOCHI" */ symbol: string; /** * Data URL */ icon?: string; /** * Centralized gateway known to have reliable access to decentralized * storage assets referenced by `reference` or `media` URLs */ base_uri?: string; /** * URL to a JSON file with more info */ reference?: string; /** Base64-encoded sha256 hash of JSON from reference field. Required if * `reference` is included. */ reference_hash?: string; }; type TokenMetadata = { /** * ex. "Arch Nemesis: Mail Carrier" or "Parcel #5055" */ title?: string; /** * free-form description */ description?: string; /** * URL to associated media, preferably to decentralized, content-addressed * storage */ media?: string; /** * Base64-encoded sha256 hash of content referenced by the `media` field. * Required if `media` is included. */ media_hash?: string; /** * number of copies of this set of metadata in existence when token was * minted. */ copies?: string; /** * When token was issued or minted, Unix epoch in milliseconds */ issued_at?: number | string; /** * When token expires, Unix epoch in milliseconds */ expires_at?: number | string; /** * When token starts being valid, Unix epoch in milliseconds */ starts_at?: number | string; /** * When token was last updated, Unix epoch in milliseconds */ updated_at?: number | string; /** * anything extra the NFT wants to store on-chain. Can be stringified JSON. */ extra?: string; /** * URL to an off-chain JSON file with more info. */ reference?: string; /** * Base64-encoded sha256 hash of JSON from reference field. Required if * `reference` is included. */ reference_hash?: string; }; type TokenRequest = { tokenContract: string; tokenId: string; metadata: TokenMetadata; receiverId?: string; royalties?: Record; tokenType?: string; tokenContractVersion?: string; }; } export declare namespace market { type Bid = { owner_id: string; price: string; }; type TokenListing = { nft_contract_id: string; token_id: string; token_type: string; owner_id: string; /** * Maps ft_token_id to price */ sale_conditions: Record; /** * Maps ft_token_id to bids */ bids: Record; created_at: string; }; } /** * A request to call viewFunction */ export type ViewFunctionRequest = { /** * NEAR contract address */ contract: string; /** * View method name */ method: string; /** * Named arguments for the view function call */ args?: Record; }; export type TransactionStatus = { status: ExecutionStatusBasic | FinalExecutionStatusBasic | 'Success'; error?: ExecutionError; }; export type StorageBalance = { total: bigint; available: bigint; }; export type StorageBalanceBounds = { min: bigint; max?: bigint; }; /** * A subclass of NEAR account to expose protected `signAndSendTransaction` */ export declare class NearAccount extends Account { signAndSendTransaction({ receiverId, actions, }: SignAndSendTransactionOptions): Promise; signAndSendTransaction(receiverId: string, actions: Action[]): Promise; } export declare const NEAR_TESTNET_TOKEN_FACTORY = "factory.goerli.testnet"; export declare const NEAR_TESTNET_BRIDGED_TOKENS: { name: string; address: string; }[]; export declare const NEAR_MAINNET_TOKEN_FACTORY = "factory.bridge.near"; export declare const NEAR_MAINNET_BRIDGED_TOKENS: { name: string; address: string; decimals: number; }[]; /** * NEAR balance for an account */ export type NearBalance = { type: 'NEAR' | 'ERC20' | 'NEP141' | 'NEP171'; /** * The address depends on the type: * * - NEAR: near account id * - NEP141: NEP141 contract id * - NEP171: NEP171 contract id * - ERC20: ERC20 symbol or address from Ethereum chain */ address: string; balance: string; }; /** * Convert human readable NEAR amount to internal indivisible units. * @param amount - Number of NEARs (can be fractional) * @returns */ export declare function formatNearAmountAsHumanReadable(amount: string): string; /** * Convert human readable NEAR amount to internal indivisible units. * @param amount - Number of NEARs (can be fractional) * @returns */ export declare function nearAsBN(amount: string): bigint; export declare const DEFAULT_GAS_FOR_FUNCTION_CALL: bigint; export declare const DEFAULT_AMOUNT_FOR_FUNCTION_CALL: bigint; export declare const DEFAULT_AMOUNT_FOR_STORAGE_DEPOSIT: bigint; export declare const DEFAULT_INITIAL_BALANCE_FOR_ACCOUNT: bigint; export declare function fetchAllByPage(size: number, fetchPage: (page: [BN, BN]) => Promise, pageSize?: number, options?: pMap.Options): Promise; export declare namespace nep245 { type MTContractMetadata = { spec: string; name: string; }; type MTBaseTokenMetadata = { name: string; id: string; symbol: string | null; icon: string | null; decimals: string | null; base_uri: string | null; reference: string | null; copies: number | null; reference_hash: string | null; }; type MTTokenMetadata = { title: string | null; description: string | null; media: string | null; media_hash: string | null; issued_at: string | null; expires_at: string | null; starts_at: string | null; updated_at: string | null; extra: string | null; reference: string | null; reference_hash: string | null; }; type MTTokenMetadataAll = { base: MTBaseTokenMetadata; token: MTTokenMetadata; }; type Token = { token_id: string; owner_id: string; token_metadata?: MTTokenMetadata; base_metadata_id: string; }; }