/// import { Account } from '@near-js/accounts'; import { KeyPair, PublicKey } from '@near-js/crypto'; import { FinalExecutionOutcome, Finality } from '@near-js/types'; import { NearAccount, TransactionStatus } from './types.js'; import { UnencryptedFileSystemKeyStore } from '@near-js/keystores-node'; import { ConnectConfig, Near } from 'near-api-js'; export declare const ACCOUNT_VERIFIER_ID = "__collabland_verifier_id__"; export declare const ACCOUNT_VERIFIER_CONTRACT = "__collabland_verifier_contract__"; /** * Near service client */ export declare class NearServiceClient { readonly near: Near; constructor(nearConfig: Partial); setKey(accountId: string, keyPair: KeyPair): Promise; getAccount(accountId: string, finality?: Finality): Promise; account(accountId: string): NearAccount; /** * Check if an account has specialized collabland contract id * @param nearAccount - Account id * @param message - A message that is used to create the signature * @param signature - Signature created by the signer for the message * @returns */ verifyAccessKey(nearAccount: NearAccount, contractId: string, methodName: string, chainId: string): Promise; /** * Check if an account is owned by the signer * @param nearAccount - Account id * @param message - A message that is used to create the signature * @param signature - Signature created by the signer for the message * @returns */ verifyAccountOwnership(nearAccount: Account, message: string, signature: string): Promise; /** * Retrieve or create a child account * @param parentAccount - Parent account * @param accountId - Account id for the child * @param publicKey - Public key of the child * @param amount - Sponsored amount (create only) * @param extraPublicKeys - Extra public keys that will be granted full access * of the child account (create only) * @returns */ getOrCreateAccount(parentAccount: NearAccount, accountId: string, publicKey: PublicKey | string, amount?: bigint, extraPublicKeys?: (PublicKey | string)[]): Promise; viewFunction(tokenContract: string, methodName: string, args?: object): Promise; functionCall(account: Account, tokenContract: string, methodName: string, args?: object, gas?: bigint, amount?: bigint): Promise; transactionStatus(txHash: string, accountId: string): Promise<{ status: TransactionStatus; outcome: FinalExecutionOutcome; }>; txStatusWithReceipts(txHash: string, accountId: string): Promise; /** * Check if a transaction is final by inspecting all receipts of the * transaction * @param outcome - Execution outcome * @returns */ isTransactionFinal(outcome: FinalExecutionOutcome): Promise; /** * Poll to await the transaction to reach its finality * @param outcome - Execution outcome * @returns */ waitForTransactionToBeFinal(outcome: FinalExecutionOutcome): Promise; /** * Check the transaction for finality and report failures if they happen * @param result - Execution outcome * @param waitForFinal - A flag to control if we should wait for the finality * @returns */ checkTransaction(result: FinalExecutionOutcome, waitForFinal?: boolean): Promise; private checkExecutionOutcome; static fromLocalKeyStore(networkId: string): NearServiceClient; static localKeyStore(): UnencryptedFileSystemKeyStore; /** * Generate a key pair for the given token account * @param tokenContract - Account id of the token contract * @returns */ static getDeterministic(tokenContract: string, secret: string): { keyPair: KeyPair; implicitAccountId: string; }; getBridgedTokenAddress(erc20SymbolOrAddress: string, nearTokenFactoryAccount?: string): Promise; } /** * Verify a message signature created using ED25519 * @param message - Message * @param signature - Signature (hex or base64 encoded) * @param publicKey - Public key * @returns */ export declare function verifySignature(message: Uint8Array | string, signature: Uint8Array | string, publicKey: string | PublicKey): boolean; /** * Generate a NEAR account id * @param prefix - Prefix * @param size - Number of the chars * @returns */ export declare function generateAccountId(prefix?: string, size?: number): string; /** * Check the transaction status * @param outcome - Execution outcome * @returns */ export declare function getTransactionStatus(outcome: FinalExecutionOutcome): TransactionStatus; /** * Generate a NEAR key pair * @param entropy - A seed * @returns */ export declare function generateNearKeyPair(entropy?: string | Buffer): { seedPhrase: any; keyPair: KeyPair; }; export declare function parseSeedPhrase(seedPhrase: string, derivationPath?: string): { seedPhrase: string; secretKey: string; publicKey: string; };