UNPKG

swapable

Version:
145 lines (144 loc) 4.58 kB
/** * This file is part of Swapable shared under AGPL-3.0 * Copyright (C) 2021 Using Blockchain Ltd, Reg No.: 12658136, United Kingdom * * @package Swapable * @author Grégory Saive for Using Blockchain Ltd <greg@ubc.digital> * @license AGPL-3.0 */ /// <reference types="node" /> import { Account, RepositoryFactoryHttp, NetworkType, MosaicId } from 'symbol-sdk'; import { Network, Wallet } from 'symbol-hd-wallets'; import { KeyProvider } from '../contracts/KeyProvider'; import { Reader as BaseReader } from '../contracts/Reader'; /** * @class Reader implements BaseReader * @package Swapable * @subpackage Adapters * @since v1.0.0 * @description Class that describes the blockchain network adapter * for Symbol from NEM compatible network nodes. * @link https://symbolplatform.com */ export declare class Reader implements BaseReader { /** * @description The REST endpoint URL */ gatewayUrl: string; /** * @description The network type */ networkType: NetworkType; /** * @description The network generation hash */ generationHash: string; /** * @description The network epoch adjustment */ epochAdjustment: number; /** * @description The network fee mosaic id */ feeMosaicId: MosaicId; /** * @description (Optional) The node public key */ nodePublicKey?: string | undefined; /** * @description Repository factory (symbol-sdk) */ factoryHttp: RepositoryFactoryHttp; /** * Construct a network configuration object * * @param {string} gatewayUrl * @param {NetworkType} networkType * @param {string} generationHash * @param {number} epochAdjustment * @param {MosaicId} feeMosaicId */ constructor( /** * @description The REST endpoint URL */ gatewayUrl: string, /** * @description The network type */ networkType: NetworkType, /** * @description The network generation hash */ generationHash: string, /** * @description The network epoch adjustment */ epochAdjustment: number, /** * @description The network fee mosaic id */ feeMosaicId: MosaicId, /** * @description (Optional) The node public key */ nodePublicKey?: string | undefined); } /** * @class Signer * @package Swapable * @subpackage Adapters * @since v1.0.0 * @description Class that describes the blockchain adapter for * Symbol from NEM compatible digital signatures. * @link https://symbolplatform.com */ export declare class Signer implements KeyProvider { keyChain: Network; /** * Creates a key provider for the current blockchain network. * * @see symbol-hd-wallets * @param {Buffer} seed The password encrypted mnemonic seed (bip39). * @return {Wallet} Returns a key provider. */ getKeyProvider(seed: Buffer): Wallet; /** * Unlock a key tree for signing. This method returns * a private key. * * :warning: It is important to never reveal the data * returned by this method, to anyone. * * @param {Buffer} seed The password encrypted mnemonic seed (bip39). * @param {string} derivationPath The account derivation path. * @return {Buffer} */ getPrivateKey(seed: Buffer, derivationPath: string): Buffer; } /** * @class Accountable * @package Swapable * @subpackage Adapters * @since v1.0.0 * @description Class that describes the blockchain adapter for * Symbol from NEM compatible child accounts. * @link https://symbolplatform.com */ export declare class Accountable { /** * Derives a child account from a mnemonic \a seed, * and \a derivationPath. By default this method uses * the TESTNET network type. * * @note This method returns sensitive information. * @static * @access public * @param {Buffer} seed The password encrypted mnemonic seed (bip39). * @param {string} derivationPath The account derivation path. * @param {NetworkType} networkType The account network bits (TESTNET/MAINNET). * @param {Signer} provider The signature provider implementation type. * @return {Account} The child account. The returned information shall be secured. */ static derive(seed: Buffer, derivationPath: string, networkType?: NetworkType, provider?: Signer): Account; }