UNPKG

stellar-plus

Version:

beta version of stellar-plus, an all-in-one sdk for the Stellar blockchain

54 lines (53 loc) 2.27 kB
import { Horizon } from '@stellar/stellar-sdk'; import { AccountBasePayload, AccountBase as AccountBaseType } from '../../../stellar-plus/account/base/types'; import { HorizonHandlerClient as HorizonHandler } from '../../../stellar-plus/horizon'; import { NetworkConfig } from '../../../stellar-plus/network'; export declare class AccountBase implements AccountBaseType { protected publicKey: string; protected networkConfig?: NetworkConfig; protected horizonHandler?: HorizonHandler; /** * * @args {} payload - The payload for the account. Additional parameters may be provided to enable different helpers. * @param {string} payload.publicKey The public key of the account. * @param {NetworkConfig=} payload.networkConfig The network config for the target network. * * @description - The base account is used for handling accounts with no management actions. */ constructor(payload: AccountBasePayload); /** * * @returns {string} The public key of the account. * */ getPublicKey(): string; /** * * @returns {void} * @description - Initialize the account with the friendbot and funds it with 10.000 XLM. */ initializeWithFriendbot(): Promise<void>; /** * * @returns {Horizon.BalanceLine[]} A list of the account's balances. * @description - The account's balances are retrieved from the Horizon server and provided in a list, including all assets. */ getBalances(): Promise<(Horizon.HorizonApi.BalanceLineNative | Horizon.HorizonApi.BalanceLineAsset<'credit_alphanum4'> | Horizon.HorizonApi.BalanceLineAsset<'credit_alphanum12'> | Horizon.HorizonApi.BalanceLineLiquidityPool)[]>; /** * * @param {Buffer} data - The data to sign. * @param {Buffer} signature - The signature to verify. * @returns {boolean} True if the signature is valid, false otherwise. */ verifySignature(data: Buffer, signature: Buffer): boolean; /** * * @description - Throws an error if the network is not a test network. */ protected requireTestNetwork(): void; /** * * @description - Throws an error if the horizon handler is not set */ protected requireHorizonHandler(): void; }