UNPKG

@0xtemple/client

Version:
62 lines (61 loc) 3.01 kB
import { VaraAccountManager } from './libs/varaAccountManager'; import { VaraInteractor } from './libs/varaInteractor'; import { MapMoudleFuncQuery, MapMoudleFuncTx, TemplesParams, VaraFuncType } from './types'; import { GearApi, HexString } from '@gear-js/api'; export declare function isUndefined(value?: unknown): value is undefined; export declare function withMeta<T extends { meta: VaraFuncType; }>(meta: VaraFuncType, creator: Omit<T, 'meta'>): T; /** * @class Temples * @description This class is used to aggregate the tools that used to interact with SUI network. */ export declare class Temples { #private; accountManager: VaraAccountManager; varaInteractor: VaraInteractor; packageId: string | undefined; metadata: string | undefined; /** * Support the following ways to init the TempleClient: * 1. mnemonics * 2. secretKey (base64 or hex) * If none of them is provided, will generate a random mnemonics with 24 words. * * @param mnemonics, 12 or 24 mnemonics words, separated by space * @param secretKey, base64 or hex string, when mnemonics is provided, secretKey will be ignored * @param networkType, 'testnet' | 'mainnet' | 'devnet' | 'localnet', default is 'devnet' * @param fullnodeUrl, the fullnode url, default is the preconfig fullnode url for the given network type * @param packageId */ constructor({ mnemonics, secretKey, networkType, fullnodeUrls, packageId, metadata, connectWs, }?: TemplesParams); get query(): MapMoudleFuncQuery; get tx(): MapMoudleFuncTx; /** * if derivePathParams is not provided or mnemonics is empty, it will return the keypair. * else: * it will generate signer from the mnemonic with the given derivePathParams. * @param derivePathParams, such as { accountIndex: 2, isExternal: false, addressIndex: 10 }, comply with the BIP44 standard */ getKeypair(): Promise<import("@polkadot/keyring/types").KeyringPair>; /** * @description Switch the current account with the given derivePathParams * @param derivePathParams, such as { accountIndex: 2, isExternal: false, addressIndex: 10 }, comply with the BIP44 standard */ switchAccount(): void; /** * @description Get the address of the account for the given derivePathParams * @param derivePathParams, such as { accountIndex: 2, isExternal: false, addressIndex: 10 }, comply with the BIP44 standard */ getAddress(): Promise<string>; currentAddress(): Promise<string>; getPackageId(): string | undefined; getMetaHash(programId: HexString): Promise<`0x${string}`>; getMetadata(): string | undefined; getAllTypes(metadata?: string): any; getBalance(account?: String): Promise<any>; client(): GearApi; wsProvider(): Promise<import("@polkadot/api").ApiPromise> | undefined; entity_key_from_hex_string(hexString: string): Promise<string | undefined>; entity_key_from_u256(x: number): Promise<string>; }