///
///
///
import { ChainIdType as ChainIdType$1 } from '@/common';
import Sockette from 'sockette';
import { WalletType as WalletType$1, WalletNameType as WalletNameType$1, UnsafeWallet as UnsafeWallet$1, iHDWalletIndex as iHDWalletIndex$1, ExportChainsX as ExportChainsX$1, ExportChainsP as ExportChainsP$1, ExportChainsC as ExportChainsC$1 } from '@/Wallet/types';
import * as ethers from 'ethers';
import { ethers as ethers$1 } from 'ethers';
import { XVMWebSocketProvider as XVMWebSocketProvider$1 } from '@/Network/providers/XVMWebSocketProvider';
import { EVMWebSocketProvider as EVMWebSocketProvider$1 } from '@/Network/providers/EVMWebSocketProvider';
import { NetworkConfig as NetworkConfig$1 } from '@/Network/types';
import * as luxnet_dist_apis_platformvm from 'luxnet/dist/apis/platformvm';
import { UnsignedTx as UnsignedTx$1, Tx as Tx$1, BaseTx as BaseTx$1, KeyChain as KeyChain$2, KeyPair as KeyPair$3, UTXOSet as UTXOSet$1 } from 'luxnet/dist/apis/platformvm';
import { Lux } from 'luxnet/dist';
import { XVMAPI, UnsignedTx, Tx, BaseTx, KeyPair, UTXOSet as UTXOSet$2, UTXO } from 'luxnet/dist/apis/xvm';
import { InfoAPI } from 'luxnet/dist/apis/info';
import * as luxnet_dist_apis_evm from 'luxnet/dist/apis/evm';
import { EVMAPI, UnsignedTx as UnsignedTx$2, Tx as Tx$2, EVMBaseTx, KeyChain, KeyPair as KeyPair$1 } from 'luxnet/dist/apis/evm';
import Web3 from 'web3';
import { HttpClient as HttpClient$1 } from '@/helpers/http_client';
import { Erc20Store as Erc20Store$1, Erc20TokenData as Erc20TokenData$1, iAssetDescriptionClean as iAssetDescriptionClean$1 } from '@/Asset/types';
import { Erc20Token as Erc20Token$1 } from '@/Asset/Erc20Token';
import { BN, Buffer as Buffer$1, BinTools, Lux as Lux$1 } from 'luxnet';
export { BN, Buffer } from 'luxnet';
import { Contract } from 'web3-eth-contract';
import { MnemonicWallet as MnemonicWallet$1 } from '@/Wallet/MnemonicWallet';
import { SingletonWallet as SingletonWallet$1 } from '@/Wallet/SingletonWallet';
import bippath, { Bip32Path } from 'bip32-path';
import Transport from '@ledgerhq/hw-transport';
import AppLux from '@luxfi/hw-app-lux';
import AppZondax from '@luxfi/hw-app-luxz';
import * as _ethereumjs_tx from '@ethereumjs/tx';
import { Transaction, FeeMarketEIP1559Transaction } from '@ethereumjs/tx';
import { Credential } from 'luxnet/dist/common';
import { Buffer as Buffer$2 } from 'buffer';
import { PublicMnemonicWallet as PublicMnemonicWallet$1 } from '@/Wallet/PublicMnemonicWallet';
import * as __Wallet_Ledger_provider from '@/Wallet/Ledger/provider';
import { LedgerProviderType as LedgerProviderType$1 } from '@/Wallet/Ledger/provider';
import Eth from '@ledgerhq/hw-app-eth';
import { UnsignedTx as UnsignedTx$3 } from 'luxnet/dist/apis/xvm/tx';
import { UnsignedTx as UnsignedTx$4 } from 'luxnet/dist/apis/platformvm/tx';
import { UnsignedTx as UnsignedTx$5 } from 'luxnet/dist/apis/evm/tx';
import { LedgerProvider as LedgerProvider$1 } from '@/Wallet/Ledger/provider/models';
import { LedgerWallet as LedgerWallet$1 } from '@/Wallet/Ledger';
import { EvmWalletReadonly as EvmWalletReadonly$1 } from '@/Wallet/EVM/EvmWalletReadonly';
import { SignTypedDataVersion, MessageTypes, TypedDataV1, TypedMessage } from '@metamask/eth-sig-util';
import { HDWalletAbstract as HDWalletAbstract$1 } from '@/Wallet/HDWalletAbstract';
import { WalletProvider } from './Wallet/Wallet';
import { EvmWallet as EvmWallet$1 } from '@/Wallet/EVM/EvmWallet';
import { BTCNetworkType as BTCNetworkType$1 } from '@/Wallet';
import * as bip32 from 'bip32';
import { KeyChain as KeyChain$1, KeyPair as KeyPair$2 } from 'luxnet/dist/apis/xvm/keychain';
import { HdScanner as HdScanner$1 } from '@/Wallet/HdScanner';
import { UTXOSet } from 'luxnet/dist/apis/xvm/utxos';
import { NetworkConfig as NetworkConfig$2 } from '@/Network';
import { ExplorerErc20Tx as ExplorerErc20Tx$1, ExplorerNormalTx as ExplorerNormalTx$1, ExplorerResponse as ExplorerResponse$1 } from '@/Explorer/explorer/types';
import * as __Explorer from '@/Explorer';
import { ExplorerErc20Tx as ExplorerErc20Tx$2, ExplorerNormalTx as ExplorerNormalTx$2, IndexerEvmTx as IndexerEvmTx$1, IndexerLuxTx as IndexerLuxTx$1, IndexerUTXO as IndexerUTXO$1, IndexerTransactionType as IndexerTransactionType$1 } from '@/Explorer';
import * as _luxfi_cloud from '@luxfi/cloud';
import { XChainLinearTransaction, XChainNonLinearTransaction, BlockchainId, Network, SortOrder, PChainId, PChainTransaction, CChainImportTransaction, CChainExportTransaction, Utxo } from '@luxfi/cloud';
import { iHistoryNftFamilyBalance as iHistoryNftFamilyBalance$1, iHistoryEVMTx as iHistoryEVMTx$1 } from '@/History/types';
import { HistoryItemType as HistoryItemType$1, iHistoryStaking as iHistoryStaking$1 } from '@/History';
import { PayloadBase } from 'luxnet/dist/utils';
import Big from 'big.js';
export { default as Big } from 'big.js';
import { UTXOSet as UTXOSet$3 } from 'luxnet/dist/apis/platformvm/utxos';
import { UTXOSet as UTXOSet$4 } from 'luxnet/dist/apis/evm/utxos';
import { GetStakeResponse } from 'luxnet/dist/apis/platformvm/interfaces';
import { UniversalTx as UniversalTx$1 } from '@/UniversalTx/types';
import UniversalNodeX from '@/UniversalTx/UniversalNodeX';
import UniversalNodeP from '@/UniversalTx/UniversalNodeP';
import UniversalNodeC from '@/UniversalTx/UniversalNodeC';
/**
* Given the chain ID returns the chain alias
* @param id Chain id
*/
declare function idToChainAlias(id: string): ChainIdType$1;
/**
* Given a chain alias, returns the chain id.
* @param alias `X`, `P` or `C`
*/
declare function chainIdFromAlias(alias: ChainIdType$1): string;
type NetworkProtocolType = 'http' | 'https';
interface NetworkConfigRpc {
c: string;
x: string;
p: string;
}
interface NetworkConfig {
rawUrl: string;
apiProtocol: NetworkProtocolType;
apiIp: string;
apiPort: number;
explorerURL?: string;
explorerSiteURL?: string;
networkID: number;
evmChainID: number;
xChainID: string;
pChainID: string;
cChainID: string;
luxID: string;
rpcUrl: NetworkConfigRpc;
}
declare function getRpcC(conf: NetworkConfig): string;
declare function getRpcX(conf: NetworkConfig): string;
declare function getRpcP(conf: NetworkConfig): string;
declare class XVMWebSocketProvider {
isConnected: boolean;
socket: Sockette;
wallets: WalletType$1[];
boundHandler: any;
constructor(wsUrl: string);
/**
* Starts watching for transactions on this wallet.
* @param wallet The wallet instance to track
*/
trackWallet(wallet: WalletType$1): void;
onWalletAddressChange(): void;
removeWallet(w: WalletType$1): void;
setEndpoint(wsUrl: string): void;
clearFilter(): void;
/**
* Creates a bloom filter from the addresses of the tracked wallets and subscribes to
* transactions on the node.
*/
updateFilterAddresses(): void;
private updateWalletBalanceX;
private onOpen;
private onMessage;
private onClose;
private onError;
}
declare class EVMWebSocketProvider {
provider: ethers$1.providers.WebSocketProvider;
wsUrl: string;
wallets: WalletType$1[];
constructor(wsUrl: string);
setEndpoint(wsUrl: string): void;
trackWallet(wallet: WalletType$1): void;
removeWallet(wallet: WalletType$1): void;
destroyConnection(): Promise;
reconnect(): Promise;
private addListeners;
private removeListeners;
private onBlock;
}
declare class WebsocketProvider {
xvmProvider: XVMWebSocketProvider$1;
evmProvider: EVMWebSocketProvider$1;
constructor(xvmEndpoint: string, evmEndpoint: string);
static fromActiveNetwork(): WebsocketProvider;
static fromNetworkConfig(config: NetworkConfig$1): WebsocketProvider;
setEndpoints(xvmEndpoint: string, evmEndpoint: string): void;
setNetwork(config: NetworkConfig$1): void;
trackWallet(wallet: WalletType$1): void;
removeWallet(wallet: WalletType$1): void;
}
declare const MainnetConfig: NetworkConfig;
declare const TestnetConfig: NetworkConfig;
declare const LocalnetConfig: NetworkConfig;
declare const DefaultConfig: NetworkConfig;
declare const luxnet: Lux;
declare const xChain: XVMAPI;
declare const cChain: EVMAPI;
declare const pChain: luxnet_dist_apis_platformvm.PlatformVMAPI;
declare const infoApi: InfoAPI;
declare const web3: Web3;
declare let ethersProvider: ethers$1.providers.JsonRpcProvider;
declare let explorer_api: HttpClient$1 | null;
declare let activeNetwork: NetworkConfig;
/**
* Returns the evm chain ID of the active network
*/
declare function getEvmChainID(): number;
/**
* Similar to `setRpcNetwork`, but checks if credentials can be used with the api.
* @param config
*/
declare function setRpcNetworkAsync(config: NetworkConfig): Promise;
/**
* Changes the connected network of the SDK.
* This is a synchronous call that does not do any network requests.
* @param conf
* @param credentials
*/
declare function setRpcNetwork(conf: NetworkConfig, credentials?: boolean): void;
/**
* Given the base url for an Lux API, returns a NetworkConfig object.
* @param url A string including protocol, base domain, and ports (if any). Ex: `http://localhost:9650`
*/
declare function getConfigFromUrl(url: string): Promise;
declare function setNetwork(conf: NetworkConfig$1): void;
/**
* Unlike `setNetwork` this function will fail if the network is not available.
* @param conf
*/
declare function setNetworkAsync(conf: NetworkConfig$1): Promise;
declare function isTestnetNetwork(activeNetwork: NetworkConfig$1): boolean;
declare function isTestnetNetworkId(id: number): boolean;
declare function isMainnetNetwork(activeNetwork: NetworkConfig$1): boolean;
declare function isMainnetNetworkId(id: number): boolean;
declare function isLocalNetwork(activeNetwork: NetworkConfig$1): boolean;
declare function getLuxAssetID(): string;
declare function getActiveNetworkConfig(): NetworkConfig$1;
declare function getEthersJsonRpcProvider(config: NetworkConfig$1): ethers$1.providers.JsonRpcProvider;
declare let erc20Cache: Erc20Store$1;
declare function getErc20Cache(): Erc20Store$1;
/**
* Clears the internal erc20 cache.
*/
declare function bustErc20Cache(): void;
/**
* Initates and caches an erc20 token from the given data.
* @param data Information such as name, symbol, and address about the ERC20 token.
*/
declare function addErc20TokenFromData(data: Erc20TokenData$1): Erc20Token$1;
declare function getContractDataErc20(address: string): Promise;
declare function getErc20Token(address: string): Promise;
declare function getAssetDescriptionSync(assetId: string): iAssetDescriptionClean$1;
/**
* Uses the node api to get meta data given an asset ID. Saves the result to cache.
* @param assetId
*/
declare function getAssetDescription(assetId: string): Promise;
declare class Erc20Token {
contract: Contract;
address: string;
name: string;
symbol: string;
decimals: number;
chainId: number;
data: Erc20TokenData$1;
constructor(data: Erc20TokenData$1);
toData(): Erc20TokenData$1;
static getData(address: string): Promise;
balanceOf(address: string): Promise;
}
interface iAssetCache {
[assetId: string]: iAssetDescriptionClean;
}
interface iAssetDescriptionRaw {
name: string;
symbol: string;
assetID: Buffer$1;
denomination: number;
}
interface iAssetDescriptionClean {
name: string;
symbol: string;
assetID: string;
denomination: number;
}
interface Erc20TokenData {
chainId: number;
address: string;
decimals: number;
name: string;
symbol: string;
}
interface Erc20Store {
[address: string]: Erc20Token$1;
}
/**
* Returns an ethers ERC721 Contract
* @param address
*/
declare function getErc721TokenEthers(address: string): ethers.Contract;
declare const bintools: BinTools;
type ChainIdType = 'X' | 'P' | 'C';
type KeystoreFileKeyType = 'mnemonic' | 'singleton';
type AllKeyFileTypes = KeyFileV2 | KeyFileV3 | KeyFileV4 | KeyFileV5 | KeyFileV6;
type AllKeyFileDecryptedTypes = KeyFileDecryptedV2 | KeyFileDecryptedV3 | KeyFileDecryptedV4 | KeyFileDecryptedV5 | KeyFileDecryptedV6;
interface KeyFileV2 {
salt: string;
keys: KeyFileKeyV2[];
pass_hash: string;
version: string;
}
interface KeyFileKeyV2 {
key: string;
iv: string;
address: string;
}
interface KeyFileDecryptedV2 {
version: string;
keys: KeyFileKeyDecryptedV2[];
activeIndex: number;
}
interface KeyFileKeyDecryptedV2 {
key: string;
}
interface KeyFileV3 {
salt: string;
keys: KeyFileKeyV3[];
pass_hash: string;
version: string;
warnings: string[];
}
interface KeyFileKeyV3 {
key: string;
iv: string;
address: string;
}
interface KeyFileDecryptedV3 {
version: string;
keys: KeyFileKeyDecryptedV3[];
activeIndex: number;
}
interface KeyFileKeyDecryptedV3 {
key: string;
}
interface KeyFileV4 {
salt: string;
keys: KeyFileKeyV4[];
pass_hash: string;
version: string;
}
interface KeyFileKeyV4 {
key: string;
iv: string;
}
interface KeyFileDecryptedV4 {
version: string;
keys: KeyFileKeyDecryptedV4[];
activeIndex: number;
}
interface KeyFileKeyDecryptedV4 {
key: string;
}
interface KeyFileV5 {
salt: string;
keys: KeyFileKeyV5[];
pass_hash: string;
version: string;
}
interface KeyFileKeyV5 {
key: string;
iv: string;
}
interface KeyFileDecryptedV5 {
version: string;
keys: KeyFileKeyDecryptedV5[];
activeIndex: number;
}
interface KeyFileKeyDecryptedV5 {
key: string;
}
interface KeyFileV6 {
salt: string;
keys: KeyFileKeyV6[];
version: string;
activeIndex: number;
}
interface KeyFileKeyV6 {
key: string;
iv: string;
type: KeystoreFileKeyType;
}
interface KeyFileDecryptedV6 {
activeIndex: number;
version: string;
keys: KeyFileKeyDecryptedV6[];
}
interface KeyFileKeyDecryptedV6 {
key: string;
type: KeystoreFileKeyType;
}
interface AccessWalletMultipleInput {
type: Extract<'mnemonic' | 'singleton', WalletNameType$1>;
key: string;
}
declare function readV2(data: KeyFileV2, pass: string): Promise<{
version: string;
activeIndex: number;
keys: KeyFileKeyDecryptedV2[];
}>;
declare function readV3(data: KeyFileV3, pass: string): Promise<{
version: string;
activeIndex: number;
keys: KeyFileKeyDecryptedV3[];
}>;
declare function readV4(data: KeyFileV4, pass: string): Promise;
declare function readV5(data: KeyFileV5, pass: string): Promise;
declare function readV6(data: KeyFileV6, pass: string): Promise;
/**
* Will decrypt and return the keys of the encrypted wallets in the given json file
* @param data A JSON file of encrypted wallet keys
* @param pass The password to decrypt the keys
*/
declare function readKeyFile(data: AllKeyFileTypes, pass: string): Promise;
declare function extractKeysV2(file: KeyFileDecryptedV2 | KeyFileDecryptedV3 | KeyFileDecryptedV4): AccessWalletMultipleInput[];
declare function extractKeysV5(file: KeyFileDecryptedV5): AccessWalletMultipleInput[];
declare function extractKeysV6(file: KeyFileDecryptedV6): AccessWalletMultipleInput[];
declare function extractKeysFromDecryptedFile(file: AllKeyFileDecryptedTypes): AccessWalletMultipleInput[];
/**
* Given an array of wallets, the active index, and a password, return an encrypted JSON object that is the keystore file
* @param wallets An array of wallet to encrypt
* @param pass Password used in encryption
* @param activeIndex Index of the active wallet in the `wallets` array
* @return Returns a JSON object that can later be decrypted with `readKeyfile` and the given password
*/
declare function makeKeyfile(wallets: (MnemonicWallet$1 | SingletonWallet$1)[], pass: string, activeIndex: number): Promise;
interface LedgerProvider {
type: LedgerProviderType;
getApp(t: Transport): AppLux | AppZondax;
getAddress(t: Transport, path: Bip32Path, config: {
show: boolean;
hrp: string;
chainId?: string;
}): Promise<{
publicKey: Buffer;
}>;
getXPUB(t: Transport, path: string, config?: {
show?: boolean;
hrp?: string;
chainId?: string;
}): Promise<{
pubKey: Buffer;
chainCode: Buffer;
}>;
signHash(t: Transport, hash: Buffer, accountPath: Bip32Path, signers: Bip32Path[]): Promise<{
hash: Buffer;
signatures: Map;
}>;
/**
*
* @param tx
* @param accountPath eg. m/44'/9000'/0'
* @param signers eg. [0/0, 1/0]
* @param changePaths eg. [0/0, 1/0]
*/
signTx(t: Transport, tx: Buffer, accountPath: Bip32Path, signers: Bip32Path[], changePaths?: Bip32Path[]): Promise<{
signatures: Map;
}>;
getVersion(t: Transport): Promise;
canParseTx(txSize: number, signersSize: number, changePathsSize: number): boolean;
}
type LedgerProviderType = 'lux' | 'zondax';
declare const LuxProvider: LedgerProvider$1;
declare const ZondaxProvider: LedgerProvider$1;
declare class LedgerWallet extends PublicMnemonicWallet$1 {
type: WalletNameType$1;
static transport: Transport | undefined;
static version: string | undefined;
static provider: LedgerProviderType | undefined;
accountIndex: number;
/**
*
* @param xpubXVM of derivation path m/44'/9000'/n' where `n` is the account index
* @param xpubEVM of derivation path m/44'/60'/0'/0/n where `n` is the account index
* @param accountIndex The given xpubs must match this index
*/
constructor(xpubXVM: string, xpubEVM: string, accountIndex: number);
static setTransport(transport: Transport): Promise;
/**
* Create a new ledger wallet instance from the given transport
* @param transport
* @param accountIndex
*/
static fromTransport(transport: Transport, accountIndex?: number): Promise;
/**
* Returns the extended public key used by C chain for address derivation.
* @remarks Returns the extended public key for path `m/44'/60'/0'`. This key can be used to derive C chain addresses.
* @param transport
*/
static getExtendedPublicKeyEthAccount(transport: Transport): Promise;
/**
* Get the extended public key for a specific C chain address.
* @returns The xpub of HD node m/44'/60'/0'/0/n where `n` is `accountIndex`
* @param transport
* @param accountIndex
*/
static getExtendedPublicKeyEthAddress(transport: Transport, accountIndex: number): Promise;
/**
* Returns the extended public key used by X and P chains for address derivation.
* @remarks Returns the extended public key for path `m/44'/90000'/n'` where `n` is the account index.
* @param transport
* @param accountIndex Which account's public key to derive
*/
static getExtendedPublicKeyLuxAccount(transport: Transport, accountIndex?: number): Promise;
static getProvider(): LedgerProvider;
signEvm(_tx: Transaction): Promise;
getTransactionPaths(unsignedTx: UnsignedTx, chainId: ChainIdType$1): Promise<{
paths: string[];
isLuxOnly: boolean;
}>;
getAddressPaths(addresses: string[]): bippath.Bip32Path[];
getPathFromAddress(address: string): Promise;
signX(unsignedTx: UnsignedTx): Promise;
signTransactionParsable(unsignedTx: UnsignedTx, paths: string[], chainId: ChainIdType$1): Promise;
/**
*
* @param accountPath `m/44'/9000'/0'` For X/P Chains, `m/44'/60'/0'` for C Chain
* @param bip32Paths an array of paths to sign with `['0/0','0/1'..]`
* @param hash A buffer of the hash to sign
* @remarks Never sign untrusted hashes. This can lead to loss of funds.
*/
signHash(accountPath: any, bip32Paths: any, hash: globalThis.Buffer): Promise<{
hash: Buffer$2;
signatures: Map;
}>;
signTransactionHash(unsignedTx: UnsignedTx, paths: string[], chainId: ChainIdType$1): Promise;
pathsToUniqueBipPaths(paths: string[]): bippath.Bip32Path[];
getCredentials(unsignedTx: UnsignedTx, paths: string[], sigMap: Map, chainId: ChainIdType$1): Credential[];
signP(unsignedTx: UnsignedTx$1): Promise;
signC(unsignedTx: UnsignedTx$2): Promise;
}
/**
*
* @param xpub Extended public key for m/44'/60'/0'
* @param index Index of the Eth address
* @returns Extended public key for m/44'/60'/0'/0/n where `n` is the address index
*/
declare function getEthAddressKeyFromAccountKey(xpub: string, index: number): string;
declare function getAppLux(transport: Transport, provider: LedgerProviderType$1): AppLux | AppZondax;
declare function getAppEth(transport: Transport): Eth;
declare function getLedgerProvider(transport: Transport): Promise<__Wallet_Ledger_provider.LedgerProvider>;
declare function isLuxApp(t: Transport): Promise;
/**
* Returns an array of unique addresses that are found on stake outputs of a tx.
* @param tx
*/
declare function getStakeOutAddresses(tx: BaseTx | BaseTx$1 | EVMBaseTx): string[];
declare function getOutputAddresses(tx: BaseTx | BaseTx$1): string[];
/**
* Returns every output address for the given transaction.
* @param unsignedTx
*/
declare function getTxOutputAddresses(unsignedTx: UnsignedTx): string[];
interface IIndexKeyCache {
[index: number]: KeyPair;
}
type ChainAlias = 'X' | 'P';
type ExportChainsX = 'P' | 'C';
type ExportChainsP = 'X' | 'C';
type ExportChainsC = 'X' | 'P';
type HdChainType = 'X' | 'P';
type WalletNameType = 'mnemonic' | 'ledger' | 'singleton' | 'xpub';
type WalletType = MnemonicWallet$1 | SingletonWallet$1 | LedgerWallet$1;
interface WalletBalanceX {
[assetId: string]: AssetBalanceX;
}
interface WalletCollectiblesX {
[familyId: string]: WalletCollectiblesXFamily;
}
interface WalletCollectiblesXFamily {
groups: {
[groupID: number]: WalletCollectiblesXGroup;
};
}
interface WalletCollectiblesXGroup {
payload: string;
quantity: number;
id: number;
}
interface iLuxBalance {
X: AssetBalanceRawX;
P: AssetBalanceP;
C: BN;
}
interface AssetBalanceRawX {
/**
* UTXOs with locktime in the future
*/
locked: BN;
unlocked: BN;
/**
* UTXOs with threshold > 1
*/
multisig: BN;
}
interface AssetBalanceX extends AssetBalanceRawX {
meta: iAssetDescriptionClean$1;
}
interface AssetBalanceP {
locked: BN;
unlocked: BN;
multisig: BN;
lockedStakeable: BN;
}
interface WalletBalanceERC20 {
[address: string]: ERC20Balance;
}
interface ERC20Balance {
balance: BN;
balanceParsed: string;
name: string;
symbol: string;
denomination: number;
address: string;
}
interface ILedgerAppConfig {
version: string;
commit: string;
name: 'Lux';
}
type WalletEventType = 'addressChanged' | 'balanceChangedX' | 'balanceChangedP' | 'balanceChangedC' | 'hd_ready';
type WalletEventArgsType = iWalletAddressChanged | WalletBalanceX | AssetBalanceP | BN | iHDWalletIndex;
interface iWalletAddressChanged {
X: string;
P: string;
changeX: string;
}
interface iHDWalletIndex {
external: number;
internal: number;
}
type BTCNetworkType = 'bitcoin' | 'testnet' | 'regtest';
/**
* Used by wallets which can access their private keys
*/
interface UnsafeWallet {
getEvmPrivateKeyHex(): string;
}
declare class EvmWallet extends EvmWalletReadonly$1 {
private privateKey;
private btcPair;
constructor(key: Buffer);
static fromPrivateKey(key: string): EvmWallet;
private getPrivateKeyBech;
getKeyChain(): KeyChain;
getKeyPair(): KeyPair$1;
signEVM(tx: Transaction | FeeMarketEIP1559Transaction): Transaction | FeeMarketEIP1559Transaction;
signBTCHash(hash: Buffer): Buffer;
signC(tx: UnsignedTx$2): Tx$2;
getPrivateKeyHex(): string;
personalSign(data: string): string;
signTypedData(data: V extends 'V1' ? TypedDataV1 : TypedMessage, version: V): string;
signTypedData_V1(data: TypedDataV1): string;
signTypedData_V3(data: TypedMessage): string;
signTypedData_V4(data: TypedMessage): string;
}
type AllowedTransactions = Transaction | FeeMarketEIP1559Transaction;
declare class MnemonicWallet extends HDWalletAbstract$1 implements UnsafeWallet {
evmWallet: EvmWallet;
type: WalletNameType;
private mnemonicCypher;
accountIndex: number;
private ethAccountKey;
constructor(mnemonic: string, account?: number);
/**
* Returns the derived private key used by the EVM wallet.
*/
getEvmPrivateKeyHex(): string;
/**
* Return the mnemonic phrase for this wallet.
*/
getMnemonic(): string;
/**
* Generates a 24 word mnemonic phrase and initializes a wallet instance with it.
* @return Returns the initialized wallet.
*/
static create(): MnemonicWallet;
/**
* Returns a new 24 word mnemonic key phrase.
*/
static generateMnemonicPhrase(): string;
/**
* Returns a new instance of a Mnemonic wallet from the given key phrase.
* @param mnemonic The 24 word mnemonic phrase of the wallet
*/
static fromMnemonic(mnemonic: string): MnemonicWallet;
/**
* Validates the given string is a valid mnemonic.
* @param mnemonic
*/
static validateMnemonic(mnemonic: string): boolean;
/**
* Signs an EVM transaction on the C chain.
* @param tx The unsigned transaction
*/
signEvm(tx: AllowedTransactions): Promise;
/**
* Signs an XVM transaction.
* @param tx The unsigned transaction
*/
signX(tx: UnsignedTx): Promise;
/**
* Signs a PlatformVM transaction.
* @param tx The unsigned transaction
*/
signP(tx: UnsignedTx$1): Promise;
/**
* Signs a C chain transaction
* @remarks
* Used for Import and Export transactions on the C chain. For everything else, use `this.signEvm()`
* @param tx The unsigned transaction
*/
signC(tx: UnsignedTx$2): Promise;
/**
* Returns a keychain with the keys of every derived X chain address.
* @private
*/
private getKeyChainX;
/**
* Returns a keychain with the keys of every derived P chain address.
* @private
*/
private getKeyChainP;
signMessage(msgStr: string, index: number): string;
/**
* This function is equivalent to the eth_sign Ethereum JSON-RPC method as specified in EIP-1417,
* as well as the MetaMask's personal_sign method.
* @remarks Signs using the C chain address.
* @param data The hex data to sign
*/
personalSign(data: string): Promise;
/**
* V1 is based upon an early version of EIP-712 that lacked some later security improvements, and should generally be neglected in favor of later versions.
* @param data The typed data to sign.
* */
signTypedData_V1(data: TypedDataV1): Promise;
/**
* V3 is based on EIP-712, except that arrays and recursive data structures are not supported.
* @param data The typed data to sign.
*/
signTypedData_V3(data: TypedMessage): Promise;
/**
* V4 is based on EIP-712, and includes full support of arrays and recursive data structures.
* @param data The typed data to sign.
*/
signTypedData_V4(data: TypedMessage): Promise;
}
declare class SingletonWallet extends WalletProvider implements UnsafeWallet$1 {
type: WalletNameType$1;
key: string;
keyBuff: Buffer$1;
evmWallet: EvmWallet$1;
/**
*
* @param privateKey An luxnet private key, starts with `PrivateKey-`
*/
constructor(privateKey: string);
static fromPrivateKey(key: string): SingletonWallet;
static fromEvmKey(key: string): SingletonWallet;
private getKeyChainX;
private getKeyChainP;
/**
* Returns the derived private key used by the EVM wallet.
*/
getEvmPrivateKeyHex(): string;
getAddressP(): string;
getAddressX(): string;
getAllAddressesP(): Promise;
getAllAddressesPSync(): string[];
getAllAddressesX(): Promise;
getAllAddressesXSync(): string[];
getChangeAddressX(): string;
getExternalAddressesP(): Promise;
getExternalAddressesPSync(): string[];
getExternalAddressesX(): Promise;
getExternalAddressesXSync(): string[];
getInternalAddressesX(): Promise;
getInternalAddressesXSync(): string[];
signC(tx: UnsignedTx$2): Promise;
signEvm(tx: Transaction | FeeMarketEIP1559Transaction): Promise;
signP(tx: UnsignedTx$1): Promise;
signX(tx: UnsignedTx): Promise;
/**
* This function is equivalent to the eth_sign Ethereum JSON-RPC method as specified in EIP-1417,
* as well as the MetaMask's personal_sign method.
* @param data The hex data to sign
*/
personalSign(data: string): Promise;
/**
* V1 is based upon an early version of EIP-712 that lacked some later security improvements, and should generally be neglected in favor of later versions.
* @param data The typed data to sign.
* */
signTypedData_V1(data: TypedDataV1): Promise;
/**
* V3 is based on EIP-712, except that arrays and recursive data structures are not supported.
* @param data The typed data to sign.
*/
signTypedData_V3(data: TypedMessage): Promise;
/**
* V4 is based on EIP-712, and includes full support of arrays and recursive data structures.
* @param data The typed data to sign.
*/
signTypedData_V4(data: TypedMessage): Promise;
}
declare class PublicMnemonicWallet extends HDWalletAbstract$1 {
/**
*
* @param xpubXVM of derivation path m/44'/9000'/n' where `n` is the account index
* @param xpubEVM of derivation path m/44'/60'/0'/0/n where `n` is the account index
*/
constructor(xpubXVM: string, xpubEVM: string);
evmWallet: EvmWallet$1 | EvmWalletReadonly$1;
type: WalletNameType$1;
signC(tx: UnsignedTx$2): Promise;
signEvm(tx: Transaction): Promise;
signP(tx: UnsignedTx$1): Promise;
signX(tx: UnsignedTx): Promise;
personalSign(data: string): Promise;
/**
* V1 is based upon an early version of EIP-712 that lacked some later security improvements, and should generally be neglected in favor of later versions.
* @param data The typed data to sign.
* */
signTypedData_V1(data: TypedDataV1): Promise;
/**
* V3 is based on EIP-712, except that arrays and recursive data structures are not supported.
* @param data The typed data to sign.
*/
signTypedData_V3(data: TypedMessage): Promise;
/**
* V4 is based on EIP-712, and includes full support of arrays and recursive data structures.
* @param data The typed data to sign.
*/
signTypedData_V4(data: TypedMessage): Promise;
}
declare const LUX_TOKEN_INDEX: string;
declare const LUX_TOKEN_PATH: string;
declare const LUX_ACCOUNT_PATH: string;
declare const ETH_ACCOUNT_PATH: string;
declare const LEDGER_ETH_ACCOUNT_PATH: string;
declare const HD_SCAN_GAP_SIZE: number;
declare const SCAN_SIZE: number;
declare const HD_SCAN_LOOK_UP_WINDOW: number;
declare const SCAN_RANGE: number;
declare const LEDGER_EXCHANGE_TIMEOUT = 90000;
declare const MIN_EVM_SUPPORT_V = "0.5.3";
/**
* In order to free the thread when deriving addresses, the execution will sleep every N address derived
*/
declare const DERIVATION_SLEEP_INTERVAL = 200;
declare class EvmWalletReadonly {
balance: BN;
address: string;
publicKey: string;
publicKeyBuff: Buffer;
/**
*
* @param publicKey 64 byte uncompressed public key. Starts with `0x`.
*/
constructor(publicKey: string);
getBalance(): BN;
getAddress(): string;
getCompressedPublicKey(): string;
getAddressBech32(): string;
/**
* Returns a native P2WPKH address with the prefix `bc1q`. This bitcoin address is
* derived from the same public key of the C chain address.
*/
getAddressBTC(networkType?: BTCNetworkType$1): string;
updateBalance(): Promise;
/**
* Builds an unsigned ERC721 transfer transaction from this wallet.
* @param contract The ERC721 Contract address
* @param tokenID Token ID
* @param to Recipient hex address.
* @param gasPrice Gas price in `BN`
* @param gasLimit Gas limit
*/
buildErc721TransferTx(contract: string, tokenID: number, to: string, gasPrice: BN, gasLimit: number): Promise<_ethereumjs_tx.FeeMarketEIP1559Transaction | _ethereumjs_tx.LegacyTransaction | _ethereumjs_tx.AccessListEIP2930Transaction | _ethereumjs_tx.BlobEIP4844Transaction>;
estimateErc721TransferGasLimit(contract: string, to: string, tokenID: number): Promise;
}
type AddressCache = {
[index: string]: bip32.BIP32Interface;
};
type KeyCacheX = {
[index: string]: KeyPair$2;
};
type KeyCacheP = {
[index: string]: KeyPair$3;
};
declare class HdScanner {
protected index: number;
protected addressCache: AddressCache;
protected keyCacheX: KeyCacheX;
protected keyCacheP: KeyCacheP;
readonly changePath: string;
private xvmAddrFactory;
readonly accountKey: bip32.BIP32Interface;
constructor(accountKey: bip32.BIP32Interface, isInternal?: boolean);
getIndex(): number;
setIndex(index: number): void;
increment(): number;
getAddressX(): string;
getAddressP(): string;
/**
* Returns every address up to and including the current index.
* @param chainId Either X or P
*/
getAllAddresses(chainId?: HdChainType): Promise;
/**
* Returns every address up to and including the current index synchronously.
* @param chainId Either X or P
*/
getAllAddressesSync(chainId?: HdChainType): string[];
/**
* Returns addresses in the given range
* @param start Start index
* @param end End index, exclusive
* @param chainId `X` or `P` optional, returns X by default
*/
getAddressesInRange(start: number, end: number, chainId?: HdChainType): Promise;
/**
* Returns addresses in the given range
* @param start Start index
* @param end End index, exclusive
* @param chainId `X` or `P` optional, returns X by default
*/
getAddressesInRangeSync(start: number, end: number, chainId?: HdChainType): string[];
getKeyChainX(): KeyChain$1;
getKeyChainP(): KeyChain$2;
getKeyForIndexX(index: number): KeyPair$2;
getKeyForIndexP(index: number): KeyPair$3;
private getHdKeyForIndex;
getAddressForIndex(index: number, chainId?: HdChainType): string;
resetIndex(startIndex?: number): Promise;
private findAvailableIndexExplorer;
private findAvailableIndexNode;
}
declare abstract class HDWalletAbstract extends WalletProvider {
protected internalScan: HdScanner$1;
protected externalScan: HdScanner$1;
protected accountKey: bip32.BIP32Interface;
isHdReady: boolean;
/**
*
* @param accountKey The bip32 HD node for path `m/44'/9000'/n'` where n is the desired account index.
* @protected
*/
protected constructor(accountKey: bip32.BIP32Interface);
protected onNetworkChange(config: NetworkConfig$2): void;
/**
* Returns current index used for external address derivation.
*/
getExternalIndex(): number;
/**
* Returns current index used for internal address derivation.
*/
getInternalIndex(): number;
/**
* Gets the active external address on the X chain
* - The X address will change after every deposit.
*/
getAddressX(): string;
/**
* Gets the active change address on the X chain
* - The change address will change after every transaction on the X chain.
*/
getChangeAddressX(): string;
/**
* Gets the active address on the P chain
*/
getAddressP(): string;
/**
* Returns every external X chain address used by the wallet up to now.
*/
getExternalAddressesX(): Promise;
/**
* Returns every external X chain address used by the wallet up to now.
*/
getExternalAddressesXSync(): string[];
/**
* Returns every internal X chain address used by the wallet up to now.
*/
getInternalAddressesX(): Promise;
/**
* Returns every internal X chain address used by the wallet up to now.
*/
getInternalAddressesXSync(): string[];
/**
* Returns every X chain address used by the wallet up to now (internal + external).
*/
getAllAddressesX(): Promise;
/**
* Returns every X chain address used by the wallet up to now (internal + external).
*/
getAllAddressesXSync(): string[];
getExternalAddressesP(): Promise;
getExternalAddressesPSync(): string[];
/**
* Returns every P chain address used by the wallet up to now.
*/
getAllAddressesP(): Promise;
/**
* Returns every P chain address used by the wallet up to now.
*/
getAllAddressesPSync(): string[];
/**
* Scans the network and initializes internal and external addresses on P and X chains.
* - Heavy operation
* - MUST use the explorer api to find the last used address
* - If explorer is not available it will use the connected node. This may result in invalid balances.
*/
resetHdIndices(externalStart?: number, internalStart?: number): Promise;
setHdIndices(external: number, internal: number): void;
/**
* Emits an event to indicate the wallet has finishing calculating its last use address
* @protected
*/
protected emitHdReady(): void;
updateUtxosX(): Promise;
private incrementExternal;
private incrementInternal;
updateUtxosP(): Promise;
getAddressAtIndexExternalX(index: number): string;
getAddressAtIndexInternalX(index: number): string;
getAddressAtIndexExternalP(index: number): string;
}
declare const EXPLORER_MAINNET = "https://api.explorer.io";
declare const EXPLORER_TESTNET = "https://api-testnet.explorer.io";
declare function getErc20History(address: string, networkConfig: NetworkConfig$2, page?: number, offset?: number, contractAddress?: string): Promise;
declare function getNormalHistory(address: string, networkConfig: NetworkConfig$2, page?: number, offset?: number): Promise;
/**
* https://docs.etherscan.io/api-endpoints/contracts#get-contract-abi-for-verified-contract-source-codes
*
* @param address
* @param networkConfig
* @returns string array, the first index is the ABI
*/
declare function getABIForContract(address: string, networkConfig: NetworkConfig$2): Promise>;
type ExplorerTx = ExplorerNormalTx | ExplorerErc20Tx;
interface ExplorerErc20Tx {
blockNumber: string;
timeStamp: string;
hash: string;
nonce: string;
blockHash: string;
from: string;
contractAddress: string;
to: string;
value: string;
tokenName: string;
tokenSymbol: string;
tokenDecimal: string;
transactionIndex: string;
gas: string;
gasPrice: string;
gasUsed: string;
cumulativeGasUsed: string;
input: string;
confirmations: string;
}
interface ExplorerNormalTx {
blockNumber: string;
timeStamp: string;
hash: string;
nonce: string;
blockHash: string;
transactionIndex: string;
from: string;
to: string;
value: string;
gas: string;
gasPrice: string;
isError: string;
txreceipt_status: string;
input: string;
contractAddress: string;
cumulativeGasUsed: string;
gasUsed: string;
confirmations: string;
}
/**
* Type guard for ExplorerErc20Tx
* @param tx
*/
declare function isExplorerErc20Tx(tx: ExplorerNormalTx | ExplorerErc20Tx): tx is ExplorerErc20Tx;
/**
* Type guard for ExplorerNormalTx
* @param tx
*/
declare function isExplorerNormalTx(tx: ExplorerNormalTx | ExplorerErc20Tx): tx is ExplorerNormalTx;
interface ExplorerResponse {
status: string;
message: string;
result: ResponseType[];
}
/**
* Filter duplicate Explorer transactions
* @param txs
*/
declare function filterDuplicateTransactions(txs: Tx[]): Tx[];
/**
* Returns transactions FROM and TO the address given
* @param addr The address to get historic transactions for.
*/
declare function getAddressHistoryEVM(addr: string): Promise;
/**
* Returns the indexer data from the given tx id.
* @param txID
*/
declare function getTx(txID: string): Promise;
/**
* Returns indexer data for a transaction hash on C chain EVM,
* @param txHash
*/
declare function getTxEvm(txHash: string): Promise;
/**
* Returns, X or P chain transactions belonging to the given address array.
* @param addrs Addresses to check for.
* @param limit
* @param chainID The blockchain ID of X or P chain
* @param endTime
*/
declare function getAddressHistory(addrs: string[], limit: number | undefined, chainID: string, endTime?: string): Promise;
/**
* Given an array of addresses, checks which chain each address was already used on
* @param addrs
*/
declare function getAddressChains(addrs: string[]): Promise;
declare function getAddressDetailX(addr: string): Promise;
/**
* Data coming from explorer for C chain
*/
interface IndexerEvmTx {
block: string;
hash: string;
createdAt: string;
nonce: number;
gasPrice: string;
gasLimit: number;
blockGasUsed: number;
blockGasLimit: number;
blockNonce: number;
blockHash: string;
recipient: string;
value: string;
toAddr: string;
fromAddr: string;
input?: string;
v: string;
r: string;
s: string;
traces: [
{
callType: string;
to: string;
from: string;
type: string;
gasUsed: string;
gas: string;
value: string;
}
];
}
/**
* Data coming from the explorer for X,P chain
*/
interface IndexerLuxTx {
chainID: string;
id: string;
inputTotals: {
[key: string]: string;
};
inputs: IndexerTxInput[] | null;
memo: string;
outputTotals: {
[key: string]: string;
};
outputs: IndexerUTXO[] | null;
reusedAddressTotals: null;
rewarded: boolean;
rewardedTime: string;
timestamp: string;
txFee: number;
type: IndexerTransactionType;
validatorStart: number;
validatorEnd: number;
validatorNodeID: string;
}
interface IndexerTxInput {
credentials: IndexerTxCredential[];
output: IndexerUTXO;
}
interface IndexerTxCredential {
address: string;
public_key: string;
signature: string;
}
interface IndexerUTXO {
addresses: string[] | null;
caddresses?: string[];
amount: string;
assetID: string;
chainID: string;
groupID: number;
id: string;
locktime: number;
payload?: string;
outputIndex: number;
outputType: number;
redeemingTransactionID: string;
stake?: boolean;
inChainID: string;
outChainID: string;
threshold: number;
timestamp: string;
transactionID: string;
rewardUtxo: boolean;
}
type IndexerTransactionType = 'base' | 'create_asset' | 'operation' | 'import' | 'export' | 'add_validator' | 'add_subnet_validator' | 'add_delegator' | 'create_chain' | 'create_subnet' | 'pvm_import' | 'pvm_export' | 'atomic_import_tx' | 'atomic_export_tx' | 'advance_time' | 'reward_validator';
/**
* Given an array of transactions from the explorer, filter out duplicate transactions
* @param txs
*/
declare function filterDuplicateIndexer(txs: IndexerLuxTx$1[]): IndexerLuxTx$1[];
/**
* Returns the source chain id.
* @param tx Tx data from the explorer.
*/
declare function findSourceChain(tx: IndexerLuxTx$1): string;
/**
* Returns the destination chain id.
* @param tx Tx data from the explorer.
*/
declare function findDestinationChain(tx: IndexerLuxTx$1): string;
declare function getStakeAmount(tx: IndexerLuxTx$1): BN;
/**
* Fetches the current LUX price using Coin Gecko.
* @remarks
* You might get rate limited if you use this function frequently.
*
* @return
* Current price of 1 LUX vs a currency (default USD)
*/
declare function getLuxPrice(currentCurrency?: string): Promise;
/**
* Gets daily price history using Coin Gecko.
* @param currency
*/
declare function getLuxPriceHistory(currency?: string): Promise<[timestamp: number, price: number][]>;
type CoinGeckoPriceHistoryResponse = {
prices: [timestamp: number, price: number][];
};
type XChainTransaction = XChainLinearTransaction | XChainNonLinearTransaction;
interface GetBalancesParams {
addresses: string[];
blockchainId: BlockchainId;
network: Network;
}
interface ListStakingParams {
addresses: string[];
pageSize: number;
pageToken?: string;
sortOrder: SortOrder;
blockchainId: PChainId;
network: Network;
}
type TransactionTypeName = 'AddDelegatorTx' | `AddPermissionlessValidatorTx` | `AddSubnetValidatorTx` | `AddValidatorTx` | 'AdvanceTimeTx' | 'BaseTx' | 'CreateAssetTx' | 'CreateChainTx' | 'CreateSubnetTx' | 'ExportTx' | 'ImportTx' | 'OperationTx' | 'RemoveSubnetValidatorTx' | 'RewardValidatorTx' | string;
type TransactionType = XChainTransaction | PChainTransaction | CChainImportTransaction | CChainExportTransaction;
type UtxoType = Utxo;
declare function isTransactionX(tx: TransactionType): tx is XChainTransaction;
declare function isTransactionP(tx: TransactionType): tx is PChainTransaction;
declare function isCChainImportTransaction(tx: TransactionType): tx is CChainImportTransaction;
declare function isCChainExportTransaction(tx: TransactionType): tx is CChainExportTransaction;
declare function isTransactionC(tx: TransactionType): tx is CChainExportTransaction | CChainImportTransaction;
type CChainTransaction = CChainImportTransaction | CChainExportTransaction;
interface GetTransactionsParams {
addresses: string[];
blockchainId: BlockchainId;
network: Network;
pageSize?: number;
pageToken?: string;
sortOrder?: SortOrder;
}
declare function isUtxo(utxo: UtxoType): utxo is Utxo;
declare function filterDuplicateCloudTxs(txs: TransactionType[]): TransactionType[];
declare function getBalancesForAddresses(config: GetBalancesParams): Promise<{
unlockedUnstaked: BN;
unlockedStaked: BN;
lockedUnstaked: BN;
lockedStaked: BN;
}>;
/**
*
* @param config
* @param limit Max number of transactions to fetch. If undefined will fetch all.
*/
declare function getTransactionsForAddresses(config: GetTransactionsParams, limit?: number): Promise;
/**
* Return Javascript UNIX timestamp of the given transaction
* @param tx
*/
declare function getTxTimestamp(tx: TransactionType): number;
/**
* Check if the UTXO is owned by one of the given addresses
* @param utxo
* @param ownedAddresses
*/
declare function isOwnedUTXO(utxo: Utxo, ownedAddresses: string[]): boolean;
declare function listChainsForAddresses(addrs: string[], netID: number): Promise<_luxfi_cloud.ChainAddressChainIdMap[]>;
declare function listStakingForAddresses(addrs: string[], netID: number): Promise;
declare function sortCloudTxs(txs: TransactionType[], sortOrder?: SortOrder): TransactionType[];
declare function cleanAddrs(addresses: string[]): string[];
declare function splitToParts(array: ArrayType[], size: number): ArrayType[][];
/**
* Parse the raw memo field to readable text.
* @param raw
*/
declare function parseMemo(raw: string): string;
declare function getNFTBalanceFromUTXOs(utxos: IndexerUTXO$1[], addresses: string[], assetID: string): iHistoryNftFamilyBalance$1;
declare function getTransactionSummary(tx: IndexerLuxTx$1, walletAddrs: string[], evmAddress: string): Promise;
declare function getTransactionSummaryEVM(tx: IndexerEvmTx$1, walletAddress: string): iHistoryEVMTx$1;
type HistoryItemType = XVMHistoryItemType | PVMHistoryItemType | EVMHistoryITemType | iHistoryItem;
type XVMHistoryItemType = iHistoryBaseTx | iHistoryImportExport;
type PVMHistoryItemType = iHistoryStaking;
type EVMHistoryITemType = iHistoryEVMTx;
type HistoryImportExportTypeName = 'import' | 'export';
type HistoryItemTypeName = HistoryImportExportTypeName | 'transaction' | 'transaction_evm' | 'add_delegator' | 'add_validator' | 'delegation_fee' | 'validation_fee' | 'not_supported';
interface iHistoryItem {
id: string;
type: HistoryItemTypeName;
timestamp: Date;
fee: BN;
memo?: string;
tx: IndexerEvmTx$1 | IndexerLuxTx$1;
luxPrice?: number;
}
/**
* Parsed interface for Import and Export transactions.
*/
interface iHistoryImportExport extends iHistoryItem {
amount: BN;
type: HistoryImportExportTypeName;
amountDisplayValue: string;
destination: ChainIdType$1;
source: ChainIdType$1;
tx: IndexerLuxTx$1;
}
/**
* Typeguard for `iHistoryImportExport` interface
* @param tx The parsed history object
*/
declare function isHistoryImportExportTx(tx: HistoryItemType): tx is iHistoryImportExport;
/**
* Parsed interface for Validation, Validation Fee, Delegation and Delegation Fee transactions.
*/
interface iHistoryStaking extends iHistoryItem {
nodeID: string;
stakeStart: Date;
stakeEnd: Date;
amount: BN;
amountDisplayValue: string;
isRewarded: boolean;
rewardAmount?: BN;
rewardAmountDisplayValue?: string;
tx: IndexerLuxTx$1;
}
/**
* Typeguard for `iHistoryStaking` interface
* @param tx The parsed history object
*/
declare function isHistoryStakingTx(tx: HistoryItemType): tx is iHistoryStaking;
/**
* Interface for parsed X chain base transactions.
*/
interface iHistoryBaseTx extends iHistoryItem {
tokens: iHistoryBaseTxToken[];
tx: IndexerLuxTx$1;
}
/**
* Typeguard for `iHistoryBaseTx` interface
* @param tx The parsed history object
*/
declare function isHistoryBaseTx(tx: HistoryItemType): tx is iHistoryBaseTx;
/**
* Interface for parsed EVM transactions.
*/
interface iHistoryEVMTx extends iHistoryItem {
block: string;
gasLimit: number;
gasPrice: string;
from: string;
to: string;
amount: BN;
amountDisplayValue: string;
isSender: boolean;
input?: string;
tx: IndexerEvmTx$1;
}
declare function isHistoryEVMTx(tx: HistoryItemType): tx is iHistoryEVMTx;
interface iHistoryBaseTxToken {
amount: BN;
amountDisplayValue: string;
addresses: string[];
asset: iAssetDescriptionClean$1;
}
interface iHistoryBaseTxNFTs {
sent: iHistoryBaseTxNFTsSent;
received: iHistoryBaseTxNFTsReceived;
}
interface iHistoryBaseTxTokenLossGain {
[assetId: string]: BN;
}
interface iHistoryBaseTxTokenOwners {
[assetId: string]: string[];
}
interface iHistoryNftFamilyBalance {
[groupNum: number]: {
payload: string;
amount: number;
};
}
interface iHistoryBaseTxNFTsReceivedRaw {
[assetID: string]: iHistoryNftFamilyBalance;
}
interface iHistoryBaseTxNFTsSentRaw {
[assetID: string]: iHistoryNftFamilyBalance;
}
interface iHistoryBaseTxNFTsSent {
[assetID: string]: {
groups: iHistoryNftFamilyBalance;
to: string[];
asset: iAssetDescriptionClean$1;
};
}
interface iHistoryBaseTxNFTsReceived {
[assetID: string]: {
groups: iHistoryNftFamilyBalance;
from: string[];
asset: iAssetDescriptionClean$1;
};
}
declare function getHistoryX(addrs: string[], limit?: number): Promise;
declare function getHistoryP(addrs: string[], limit?: number): Promise;
/**
* Returns atomic history for this wallet on the C chain.
* @remarks Excludes EVM transactions.
* @param limit
*/
declare function getHistoryC(addrC: string, addrsX: string[], limit?: number): Promise;
/**
* Returns history for this wallet on the C chain.
* @remarks Excludes atomic C chain import/export transactions.
*/
declare function getHistoryEVM(addr: string): Promise<__Explorer.IndexerEvmTx[]>;
/**
*
* @param xAddresses A list of owned X chain addresses
* @param pAddresses A list of owned P chain addresses
* @param cAddress Bech32 C chain address
* @param evmAddress Hex C chain address
* @param limit
*/
declare function getHistoryForOwnedAddresses(xAddresses: string[], pAddresses: string[], cAddress: string, evmAddress: string, limit?: number): Promise;
/**
* Returns sorted history data from Indexer for X, P, and C chains.
* @param xAddresses A list of owned X chain addresses
* @param pAddresses A list of owned P chain addresses
* @param cAddress Bech32 C chain address
* @param limit Number of transactions to fetch, undefined or 0 for all history
*/
declare function getHistoryForOwnedAddressesRaw(xAddresses: string[], pAddresses: string[], cAddress: string, limit?: number): Promise;
/**
* Checks if address is valid.
*
* @return
* boolean if address is valid, error message if not valid.
*/
declare function isValidAddress(address: string): boolean;
declare function digestMessage(msgStr: string): Buffer;
declare function parseNftPayload(rawPayload: string): PayloadBase;
/**
* rename Network.
*/
declare const NetworkValues: {
MAINNET: Network;
TESTNET: Network;
};
/**
* rename SortOrder.
*/
declare const SortOrderValues: {
ASC: SortOrder;
DESC: SortOrder;
};
/**
* rename P_CHAINV.
*/
declare const P_CHAINValues: {
P_CHAIN: PChainId;
LPO_YY: PChainId;
};
declare module 'big.js' {
interface Big {
toLocaleString(toFixed?: number): string;
}
}
/**
* @param val the amount to parse
* @param denomination number of decimal places to parse with
*/
declare function bnToBig(val: BN, denomination?: number): Big;
/**
* Converts a BN amount of 18 decimals to 9.
* Used for LUX C <-> X,P conversions
* @param amount
*/
declare function luxCtoX(amount: BN): BN;
declare function luxXtoC(amount: BN): BN;
declare function luxPtoC(amount: BN): BN;
declare function bnToBigLuxX(val: BN): Big;
declare function bnToBigLuxP(val: BN): Big;
declare function bnToBigLuxC(val: BN): Big;
/**
* Parses the value using a denomination of 18
*
* @param val the amount to parse given in WEI
*
* @example
* ```
* bnToLuxC(new BN('22500000000000000000')
* // will return 22.5
*```
*
*/
declare function bnToLuxC(val: BN): string;
/**
* Parses the value using a denomination of 9
*
* @param val the amount to parse given in nLUX
*/
declare function bnToLuxX(val: BN): string;
/**
* Parses the value using a denomination of 9
*
* @param val the amount to parse given in nLUX
*/
declare function bnToLuxP(val: BN): string;
/**
*
* @param val the number to parse
* @param decimals number of decimal places used to parse the number
*/
declare function numberToBN(val: number | string, decimals: number): BN;
declare function numberToBNLuxX(val: number | string): BN;
declare function numberToBNLuxP(val: number | string): BN;
declare function numberToBNLuxC(val: number | string): BN;
/**
* @Remarks
* A helper method to convert BN numbers to human readable strings.
*
* @param val The amount to convert
* @param decimals Number of decimal places to parse the amount with
*
* @example
* ```
* bnToLocaleString(new BN(100095),2)
* // will return '1,000.95'
* ```
*/
declare function bnToLocaleString(val: BN, decimals?: number): string;
declare function bigToLocaleString(bigVal: Big, decimals?: number): string;
/**
* Converts a string to a BN value of the given denomination.
* @param value The string value of the
* @param decimals
*
* @example
* ```
* stringToBN('1.32', 5) // is same as BN(132000)
* ```
*/
declare function stringToBN(value: string, decimals: number): BN;
declare function bigToBN(val: Big, denom: number): BN;
/**
* Returns the transaction fee for X chain.
*/
declare function getTxFeeX(): BN;
/**
* Returns the transaction fee for P chain.
*/
declare function getTxFeeP(): BN;
/**
* Waits until the given tx id is accepted on X chain
* @param txId Tx ID to wait for
* @param tryCount Number of attempts until timeout
*/
declare function waitTxX(txId: string, tryCount?: number): Promise;
declare function waitTxP(txId: string, tryCount?: number): Promise;
declare function waitTxEvm(txHash: string, tryCount?: number): Promise;
declare function waitTxC(txId: string, tryCount?: number): Promise;
declare function sleep(durMs: number): Promise;
/**
* A helper class to obfuscate strings when storing in memory. Used as a helper rather than secure encryption.
* @Remarks Do NOT use this class for actual secure encryption needs.
*/
declare class CypherAES {
private pass;
private encrypted;
constructor(value: string);
getValue(): string;
}
declare function strip0x(addr: string): string;
declare const validateAddress: (address: string) => boolean | string;
declare function validateAddressX(address: string): boolean;
declare function validateAddressC(address: string): boolean;
declare function validateAddressP(address: string): boolean;
declare function validateAddressEVM(address: string): boolean;
/**
* Returns the human readable part of a X or P bech32 address.
* @param address
*/
declare function getAddressHRP(address: string): string;
/**
* Given an address, return which Chain it belongs to
* @param address
*/
declare function getAddressChain(address: string): ChainIdType$1;
declare const address_helper_d_getAddressChain: typeof getAddressChain;
declare const address_helper_d_getAddressHRP: typeof getAddressHRP;
declare const address_helper_d_validateAddress: typeof validateAddress;
declare const address_helper_d_validateAddressC: typeof validateAddressC;
declare const address_helper_d_validateAddressEVM: typeof validateAddressEVM;
declare const address_helper_d_validateAddressP: typeof validateAddressP;
declare const address_helper_d_validateAddressX: typeof validateAddressX;
declare namespace address_helper_d {
export { address_helper_d_getAddressChain as getAddressChain, address_helper_d_getAddressHRP as getAddressHRP, address_helper_d_validateAddress as validateAddress, address_helper_d_validateAddressC as validateAddressC, address_helper_d_validateAddressEVM as validateAddressEVM, address_helper_d_validateAddressP as validateAddressP, address_helper_d_validateAddressX as validateAddressX };
}
declare function buildCreateNftFamilyTx(name: string, symbol: string, groupNum: number, fromAddrs: string[], minterAddr: string, changeAddr: string, utxoSet: UTXOSet$2): Promise;
declare function buildMintNftTx(mintUtxo: UTXO, payload: PayloadBase, quantity: number, ownerAddress: string, changeAddress: string, fromAddresses: string[], utxoSet: UTXOSet$2): Promise;
declare function buildXvmExportTransaction(destinationChain: ExportChainsX$1, utxoSet: UTXOSet$2, fromAddresses: string[], toAddress: string, amount: BN, // export amount + fee
sourceChangeAddress: string): Promise;
declare function buildPlatformExportTransaction(utxoSet: UTXOSet$1, fromAddresses: string[], toAddress: string, amount: BN, // export amount + fee
sourceChangeAddress: string, destinationChain: ExportChainsP$1): Promise;
/**
*
* @param fromAddresses
* @param toAddress
* @param amount
* @param fromAddressBech
* @param destinationChain Either `X` or `P`
* @param fee Export fee in nLUX
*/
declare function buildEvmExportTransaction(fromAddresses: string[], toAddress: string, amount: BN, // export amount + fee
fromAddressBech: string, destinationChain: ExportChainsC$1, fee: BN): Promise;
declare function buildEvmTransferEIP1559Tx(from: string, to: string, amount: BN, // in wei
priorityFee: BN, maxFee: BN, gasLimit: number): Promise;
declare function buildEvmTransferNativeTx(from: string, to: string, amount: BN, // in wei
gasPrice: BN, gasLimit: number): Promise;
declare function buildCustomEvmTx(from: string, gasPrice: BN, gasLimit: number, data?: string, to?: string, value?: string, nonce?: number): Promise;
declare function buildEvmTransferErc20Tx(from: string, to: string, amount: BN, // in wei
gasPrice: BN, gasLimit: number, contractAddress: string): Promise;
declare function buildEvmTransferErc721Tx(from: string, to: string, gasPrice: BN, gasLimit: number, tokenContract: string, tokenId: number): Promise;
declare function estimateErc20Gas(tokenContract: string, from: string, to: string, value: BN): Promise;
/**
* Estimate the gas limit for the ERC721 `safeTransferFrom(address,address,uint256)` method.
* @param contract
* @param from
* @param to
* @param tokenID
*/
declare function estimateErc721TransferGas(contract: string, from: string, to: string, tokenID: number): Promise;
/**
* Estimates the gas needed to send LUX
* @param to Destination address
* @param amount Amount of LUX to send, given in WEI
* @param gasPrice Given in WEI
*/
declare function estimateLuxGas(from: string, to: string, amount: BN, gasPrice: BN): Promise;
declare enum XvmTxNameEnum {
'Transaction',
'Mint',
'Operation',
'Import',
'Export'
}
declare enum PlatfromTxNameEnum {
'Transaction',
'Add Validator',
'Add Delegator',
'Import',
'Export',
'Add Subnet Validator',
'Create Chain',
'Create Subnet',
'Advance Time',
'Reward Validator'
}
declare enum ParseableXvmTxEnum {
'Transaction',
'Import',
'Export'
}
declare enum ParseablePlatformEnum {
'Transaction',
'Add Validator',
'Add Delegator',
'Import',
'Export'
}
declare enum ParseableEvmTxEnum {
'Import',
'Export'
}
type tx_helper_d_ParseableEvmTxEnum = ParseableEvmTxEnum;
declare const tx_helper_d_ParseableEvmTxEnum: typeof ParseableEvmTxEnum;
type tx_helper_d_ParseablePlatformEnum = ParseablePlatformEnum;
declare const tx_helper_d_ParseablePlatformEnum: typeof ParseablePlatformEnum;
type tx_helper_d_ParseableXvmTxEnum = ParseableXvmTxEnum;
declare const tx_helper_d_ParseableXvmTxEnum: typeof ParseableXvmTxEnum;
type tx_helper_d_PlatfromTxNameEnum = PlatfromTxNameEnum;
declare const tx_helper_d_PlatfromTxNameEnum: typeof PlatfromTxNameEnum;
type tx_helper_d_XvmTxNameEnum = XvmTxNameEnum;
declare const tx_helper_d_XvmTxNameEnum: typeof XvmTxNameEnum;
declare const tx_helper_d_buildCreateNftFamilyTx: typeof buildCreateNftFamilyTx;
declare const tx_helper_d_buildCustomEvmTx: typeof buildCustomEvmTx;
declare const tx_helper_d_buildEvmExportTransaction: typeof buildEvmExportTransaction;
declare const tx_helper_d_buildEvmTransferEIP1559Tx: typeof buildEvmTransferEIP1559Tx;
declare const tx_helper_d_buildEvmTransferErc20Tx: typeof buildEvmTransferErc20Tx;
declare const tx_helper_d_buildEvmTransferErc721Tx: typeof buildEvmTransferErc721Tx;
declare const tx_helper_d_buildEvmTransferNativeTx: typeof buildEvmTransferNativeTx;
declare const tx_helper_d_buildMintNftTx: typeof buildMintNftTx;
declare const tx_helper_d_buildPlatformExportTransaction: typeof buildPlatformExportTransaction;
declare const tx_helper_d_buildXvmExportTransaction: typeof buildXvmExportTransaction;
declare const tx_helper_d_estimateErc20Gas: typeof estimateErc20Gas;
declare const tx_helper_d_estimateErc721TransferGas: typeof estimateErc721TransferGas;
declare const tx_helper_d_estimateLuxGas: typeof estimateLuxGas;
declare namespace tx_helper_d {
export { tx_helper_d_ParseableEvmTxEnum as ParseableEvmTxEnum, tx_helper_d_ParseablePlatformEnum as ParseablePlatformEnum, tx_helper_d_ParseableXvmTxEnum as ParseableXvmTxEnum, tx_helper_d_PlatfromTxNameEnum as PlatfromTxNameEnum, tx_helper_d_XvmTxNameEnum as XvmTxNameEnum, tx_helper_d_buildCreateNftFamilyTx as buildCreateNftFamilyTx, tx_helper_d_buildCustomEvmTx as buildCustomEvmTx, tx_helper_d_buildEvmExportTransaction as buildEvmExportTransaction, tx_helper_d_buildEvmTransferEIP1559Tx as buildEvmTransferEIP1559Tx, tx_helper_d_buildEvmTransferErc20Tx as buildEvmTransferErc20Tx, tx_helper_d_buildEvmTransferErc721Tx as buildEvmTransferErc721Tx, tx_helper_d_buildEvmTransferNativeTx as buildEvmTransferNativeTx, tx_helper_d_buildMintNftTx as buildMintNftTx, tx_helper_d_buildPlatformExportTransaction as buildPlatformExportTransaction, tx_helper_d_buildXvmExportTransaction as buildXvmExportTransaction, tx_helper_d_estimateErc20Gas as estimateErc20Gas, tx_helper_d_estimateErc721TransferGas as estimateErc721TransferGas, tx_helper_d_estimateLuxGas as estimateLuxGas };
}
/**
*
* @param addrs an array of X chain addresses to get the atomic utxos of
* @param sourceChain Which chain to check against, either `P` or `C`
*/
declare function xvmGetAtomicUTXOs(addrs: string[], sourceChain: ExportChainsX$1): Promise;
declare function platformGetAtomicUTXOs(addrs: string[], sourceChain: ExportChainsP$1): Promise;
declare function evmGetAtomicUTXOs(addrs: string[], sourceChain: ExportChainsC$1): Promise;
declare function getStakeForAddresses(addrs: string[]): Promise;
declare function xvmGetAllUTXOs(addrs: string[]): Promise;
declare function xvmGetAllUTXOsForAddresses(addrs: string[], endIndex?: any): Promise;
declare function platformGetAllUTXOs(addrs: string[]): Promise;
declare function platformGetAllUTXOsForAddresses(addrs: string[], endIndex?: any): Promise;
declare const utxo_helper_d_evmGetAtomicUTXOs: typeof evmGetAtomicUTXOs;
declare const utxo_helper_d_getStakeForAddresses: typeof getStakeForAddresses;
declare const utxo_helper_d_platformGetAllUTXOs: typeof platformGetAllUTXOs;
declare const utxo_helper_d_platformGetAllUTXOsForAddresses: typeof platformGetAllUTXOsForAddresses;
declare const utxo_helper_d_platformGetAtomicUTXOs: typeof platformGetAtomicUTXOs;
declare const utxo_helper_d_xvmGetAllUTXOs: typeof xvmGetAllUTXOs;
declare const utxo_helper_d_xvmGetAllUTXOsForAddresses: typeof xvmGetAllUTXOsForAddresses;
declare const utxo_helper_d_xvmGetAtomicUTXOs: typeof xvmGetAtomicUTXOs;
declare namespace utxo_helper_d {
export { utxo_helper_d_evmGetAtomicUTXOs as evmGetAtomicUTXOs, utxo_helper_d_getStakeForAddresses as getStakeForAddresses, utxo_helper_d_platformGetAllUTXOs as platformGetAllUTXOs, utxo_helper_d_platformGetAllUTXOsForAddresses as platformGetAllUTXOsForAddresses, utxo_helper_d_platformGetAtomicUTXOs as platformGetAtomicUTXOs, utxo_helper_d_xvmGetAllUTXOs as xvmGetAllUTXOs, utxo_helper_d_xvmGetAllUTXOsForAddresses as xvmGetAllUTXOsForAddresses, utxo_helper_d_xvmGetAtomicUTXOs as xvmGetAtomicUTXOs };
}
declare class HttpClient {
private baseURL;
private TIMEOUT;
constructor(baseURL: string);
get(path: string, params?: Record): Promise;
post(path: string, data: Record): Promise;
private handleResponse;
private fetchWithTimeout;
}
declare function wsUrlFromConfigX(config: NetworkConfig$1): string;
declare function wsUrlFromConfigEVM(config: NetworkConfig$1): string;
/**
* Given the base url of an Lux API, requests the Network ID
* @param url The base url for the Lux API
*/
declare function getNetworkIdFromURL(url: string): Promise;
declare function createLuxProvider(config: NetworkConfig$1): Lux$1;
/**
* Given a network configuration returns an HttpClient instance connected to the explorer
*/
declare function createExplorerApi(networkConfig: NetworkConfig$1): HttpClient;
/**
* Checks if the given network accepts credentials.
* This must be true to use cookies.
*/
declare function canUseCredentials(config: NetworkConfig$1): Promise;
declare const network_helper_d_canUseCredentials: typeof canUseCredentials;
declare const network_helper_d_createExplorerApi: typeof createExplorerApi;
declare const network_helper_d_createLuxProvider: typeof createLuxProvider;
declare const network_helper_d_getNetworkIdFromURL: typeof getNetworkIdFromURL;
declare const network_helper_d_wsUrlFromConfigEVM: typeof wsUrlFromConfigEVM;
declare const network_helper_d_wsUrlFromConfigX: typeof wsUrlFromConfigX;
declare namespace network_helper_d {
export { network_helper_d_canUseCredentials as canUseCredentials, network_helper_d_createExplorerApi as createExplorerApi, network_helper_d_createLuxProvider as createLuxProvider, network_helper_d_getNetworkIdFromURL as getNetworkIdFromURL, network_helper_d_wsUrlFromConfigEVM as wsUrlFromConfigEVM, network_helper_d_wsUrlFromConfigX as wsUrlFromConfigX };
}
/**
* Returns the current gas price in WEI from the network
*/
declare function getGasPrice(): Promise;
/**
* Returns the gas price + 25%, or max gas
*/
declare function getAdjustedGasPrice(): Promise;
/**
*
* @param val
* @param perc What percentage to adjust with
*/
declare function adjustValue(val: BN, perc: number): BN;
/**
* Returns the base fee from the network.
*/
declare function getBaseFee(): Promise;
/**
* Returns the current base fee + 25%
*/
declare function getBaseFeeRecommended(): Promise;
/**
* Returns the base max priority fee from the network.
*/
declare function getMaxPriorityFee(): Promise;
/**
* Calculate max fee for EIP 1559 transactions given baseFee and maxPriorityFee.
* According to https://www.blocknative.com/blog/eip-1559-fees
* @param baseFee in WEI
* @param maxPriorityFee in WEI
*/
declare function calculateMaxFee(baseFee: BN, maxPriorityFee: BN): BN;
/**
* Creates a mock import transaction and estimates the gas required for it. Returns fee in units of gas.
* @param numIns Number of inputs for the import transaction.
* @param numSigs Number of signatures used in the import transactions. This value is the sum of owner addresses in every UTXO.
*/
declare function estimateImportGasFeeFromMockTx(numIns: number | undefined, numSigs: number): number;
/**
* Estimates the gas fee using a mock ExportTx built from the passed values.
* @param destinationChain `X` or `P`
* @param amount in nLUX
* @param from The C chain hex address exported from
* @param to The destination X or P address
*/
declare function estimateExportGasFeeFromMockTx(destinationChain: ExportChainsC$1, amount: BN, from: string, to: string): number;
/**
* Returns the estimated gas for the export transaction.
* @param destinationChain Either `X` or `P`
* @param amount The amount to export. In nLUX.
* @param from The C chain hex address exporting the asset
* @param fromBech The C chain bech32 address exporting the asset
* @param to The destination address on the destination chain
*/
declare function estimateExportGasFee(destinationChain: ExportChainsC$1, from: string, fromBech: string, to: string, amount: BN): Promise;
declare const gas_helper_d_adjustValue: typeof adjustValue;
declare const gas_helper_d_calculateMaxFee: typeof calculateMaxFee;
declare const gas_helper_d_estimateExportGasFee: typeof estimateExportGasFee;
declare const gas_helper_d_estimateExportGasFeeFromMockTx: typeof estimateExportGasFeeFromMockTx;
declare const gas_helper_d_estimateImportGasFeeFromMockTx: typeof estimateImportGasFeeFromMockTx;
declare const gas_helper_d_getAdjustedGasPrice: typeof getAdjustedGasPrice;
declare const gas_helper_d_getBaseFee: typeof getBaseFee;
declare const gas_helper_d_getBaseFeeRecommended: typeof getBaseFeeRecommended;
declare const gas_helper_d_getGasPrice: typeof getGasPrice;
declare const gas_helper_d_getMaxPriorityFee: typeof getMaxPriorityFee;
declare namespace gas_helper_d {
export { gas_helper_d_adjustValue as adjustValue, gas_helper_d_calculateMaxFee as calculateMaxFee, gas_helper_d_estimateExportGasFee as estimateExportGasFee, gas_helper_d_estimateExportGasFeeFromMockTx as estimateExportGasFeeFromMockTx, gas_helper_d_estimateImportGasFeeFromMockTx as estimateImportGasFeeFromMockTx, gas_helper_d_getAdjustedGasPrice as getAdjustedGasPrice, gas_helper_d_getBaseFee as getBaseFee, gas_helper_d_getBaseFeeRecommended as getBaseFeeRecommended, gas_helper_d_getGasPrice as getGasPrice, gas_helper_d_getMaxPriorityFee as getMaxPriorityFee };
}
type UniversalTxActionExportC = 'export_c_x' | 'export_c_p';
type UniversalTxActionImportC = 'import_x_c' | 'import_p_c';
type UniversalTxActionExportX = 'export_x_p' | 'export_x_c';
type UniversalTxActionImportX = 'import_p_x' | 'import_c_x';
type UniversalTxActionExportP = 'export_p_x' | 'export_p_c';
type UniversalTxActionImportP = 'import_x_p' | 'import_c_p';
type UniversalTxActionExport = UniversalTxActionExportC | UniversalTxActionExportX | UniversalTxActionExportP;
type UniversalTxActionImport = UniversalTxActionImportC | UniversalTxActionImportX | UniversalTxActionImportP;
interface UniversalTxExport {
action: UniversalTxActionExport;
amount: BN;
fee: BN;
}
interface UniversalTxImport {
action: UniversalTxActionImport;
fee: BN;
}
type UniversalTxActionTypesX = UniversalTxActionExportX | UniversalTxActionImportX;
type UniversalTxActionTypesC = UniversalTxActionExportC | UniversalTxActionImportC;
type UniversalTxActionTypesP = UniversalTxActionExportP | UniversalTxActionImportP;
type UniversalTxActionType = UniversalTxActionTypesX | UniversalTxActionTypesC | UniversalTxActionTypesP;
type UniversalTx = UniversalTxsX | UniversalTxsP | UniversalTxsC;
type UniversalTxsX = UniversalTxExportX | UniversalTxImportX;
type UniversalTxsP = UniversalTxExportP | UniversalTxImportP;
type UniversalTxsC = UniversalTxExportC | UniversalTxImportC;
interface UniversalTxExportC extends UniversalTxExport {
action: UniversalTxActionExportC;
}
interface UniversalTxExportX extends UniversalTxExport {
action: UniversalTxActionExportX;
}
interface UniversalTxExportP extends UniversalTxExport {
action: UniversalTxActionExportP;
}
interface UniversalTxImportC extends UniversalTxImport {
action: UniversalTxActionImportC;
fee: BN;
}
interface UniversalTxImportX extends UniversalTxImport {
action: UniversalTxActionImportX;
}
interface UniversalTxImportP extends UniversalTxImport {
action: UniversalTxActionImportP;
}
declare function createGraphForP(balX: BN, balP: BN, balC: BN, atomicFeeXP: BN, atomicFeeC: BN): UniversalNodeP;
declare function createGraphForC(balX: BN, balP: BN, balC: BN, atomicFeeXP: BN, atomicFeeC: BN): UniversalNodeC;
declare function createGraphForX(balX: BN, balP: BN, balC: BN, atomicFeeXP: BN, atomicFeeC: BN): UniversalNodeX;
declare function canHaveBalanceOnX(balX: BN, balP: BN, balC: BN, targetAmount: BN, atomicFeeXP: BN, atomicFeeC: BN): boolean;
declare function canHaveBalanceOnP(balX: BN, balP: BN, balC: BN, targetAmount: BN, atomicFeeXP: BN, atomicFeeC: BN): boolean;
/**
* Will return true if `targetAmount` can exist on C chain
*/
declare function canHaveBalanceOnC(balX: BN, balP: BN, balC: BN, targetAmount: BN, atomicFeeXP: BN, atomicFeeC: BN): boolean;
declare function getStepsForBalanceP(balX: BN, balP: BN, balC: BN, targetAmount: BN, atomicFeeXP: BN, atomicFeeC: BN): UniversalTx$1[];
declare function getStepsForBalanceC(balX: BN, balP: BN, balC: BN, targetAmount: BN, atomicFeeXP: BN, atomicFeeC: BN): UniversalTx$1[];
declare function getStepsForBalanceX(balX: BN, balP: BN, balC: BN, targetAmount: BN, atomicFeeXP: BN, atomicFeeC: BN): UniversalTx$1[];
declare abstract class UniversalNodeAbstract {
parents: UniversalNodeAbstract[];
child: UniversalNodeAbstract | null;
balance: BN;
chain: ChainIdType$1;
feeExport: BN;
feeImport: BN;
protected constructor(balance: BN, chain: ChainIdType$1, feeExport: BN, feeImport: BN);
reduceTotalBalanceFromParents(): BN;
/**
* Returns the export action type from this node to its child
* @param to
*/
abstract getExportMethod(to: ChainIdType$1): UniversalTxActionExport;
/**
* Returns the import action type from this node to its child
* @param from Which chain are we importing from
*/
abstract getImportMethod(from: ChainIdType$1): UniversalTxActionImport;
buildExportTx(destChain: ChainIdType$1, amount: BN): UniversalTxExport;
buildImportTx(sourceChain: ChainIdType$1): UniversalTxImport;
/***
* Assumes there is enough balance on node tree
* Returns empty array even if transaction not possible!
* What steps to take to have the target balance on this node.
* @param target Amount of nLUX needed on this node.
*/
getStepsForTargetBalance(target: BN): UniversalTx[];
addParent(node: UniversalNodeAbstract): void;
setChild(node: UniversalNodeAbstract): void;
}
declare const stakingHeaders: string[];
declare const normalHeaders: string[];
declare function createCSVContent(rows: string[][]): string;
/**
* Given an array of history transactions, filter the staking txs and returns the body of a csv file.
* @remarks You can download the returned string as a CSV file.
* @param txs An array of transactions made by a wallet.
*/
declare function createCsvStaking(txs: HistoryItemType$1[]): string;
/**
* Parses each staking transaction according to the headers defined in constants and returns an array of strings for
* each cell in the CSV.
* @param txs
*/
declare function parseStakingTxs(txs: iHistoryStaking$1[]): string[][];
/**
* Given an array of history transactions, filter the base and export/import txs and returns the body of a csv file.
* @remarks You can download the returned string as a CSV file.
* @param txs An array of transactions made by a wallet.
*/
declare function createCsvNormal(txs: HistoryItemType$1[]): string;
declare function parseNormalTxs(txs: HistoryItemType$1[]): string[][];
interface ParsedTxUtxos {
txID: string;
timeStamp: Date;
unixTime: string;
txType: IndexerTransactionType$1;
chain: ChainIdType$1;
isInput: boolean;
isOwner: boolean;
amount: string;
owners: string[];
locktime: number;
threshold: number;
assetID: string;
}
/**
* Given an array of Indexer transaction data return input and outputs as a single unified array
* @param txs
* @param ownedAddresses
*/
declare function parseTxUtxos(txs: IndexerLuxTx$1[], ownedAddresses: string[]): ParsedTxUtxos[];
/**
* Create CSV file contents from the given Indexer transactions.
* @param txs Array of Indexer Transactions
* @param ownedAddresses Addresses owned by the wallet.
*/
declare function createCsvFileIndexer(txs: IndexerLuxTx$1[], ownedAddresses: string[]): string;
export { type AccessWalletMultipleInput, address_helper_d as AddressHelper, type AllKeyFileDecryptedTypes, type AllKeyFileTypes, type AssetBalanceP, type AssetBalanceRawX, type AssetBalanceX, type BTCNetworkType, type CChainTransaction, type ChainAlias, type ChainIdType, type CoinGeckoPriceHistoryResponse, CypherAES, DERIVATION_SLEEP_INTERVAL, DefaultConfig, type ERC20Balance, ETH_ACCOUNT_PATH, type EVMHistoryITemType, EVMWebSocketProvider, EXPLORER_MAINNET, EXPLORER_TESTNET, type Erc20Store, Erc20Token, type Erc20TokenData, EvmWallet, EvmWalletReadonly, type ExplorerErc20Tx, type ExplorerNormalTx, type ExplorerResponse, type ExplorerTx, type ExportChainsC, type ExportChainsP, type ExportChainsX, gas_helper_d as GasHelper, type GetBalancesParams, type GetTransactionsParams, HDWalletAbstract, HD_SCAN_GAP_SIZE, HD_SCAN_LOOK_UP_WINDOW, type HdChainType, HdScanner, type HistoryImportExportTypeName, type HistoryItemType, type HistoryItemTypeName, type IIndexKeyCache, type ILedgerAppConfig, type IndexerEvmTx, type IndexerLuxTx, type IndexerTransactionType, type IndexerUTXO, type KeyFileDecryptedV2, type KeyFileDecryptedV3, type KeyFileDecryptedV4, type KeyFileDecryptedV5, type KeyFileDecryptedV6, type KeyFileKeyDecryptedV2, type KeyFileKeyDecryptedV3, type KeyFileKeyDecryptedV4, type KeyFileKeyDecryptedV5, type KeyFileKeyDecryptedV6, type KeyFileKeyV2, type KeyFileKeyV3, type KeyFileKeyV4, type KeyFileKeyV5, type KeyFileKeyV6, type KeyFileV2, type KeyFileV3, type KeyFileV4, type KeyFileV5, type KeyFileV6, type KeystoreFileKeyType, LEDGER_ETH_ACCOUNT_PATH, LEDGER_EXCHANGE_TIMEOUT, LUX_ACCOUNT_PATH, LUX_TOKEN_INDEX, LUX_TOKEN_PATH, type LedgerProvider, type LedgerProviderType, LedgerWallet, type ListStakingParams, LocalnetConfig, LuxProvider, MIN_EVM_SUPPORT_V, MainnetConfig, MnemonicWallet, type NetworkConfig, type NetworkConfigRpc, network_helper_d as NetworkHelper, type NetworkProtocolType, NetworkValues, type PVMHistoryItemType, P_CHAINValues, PublicMnemonicWallet, SCAN_RANGE, SCAN_SIZE, SingletonWallet, SortOrderValues, TestnetConfig, type TransactionType, type TransactionTypeName, tx_helper_d as TxHelper, UniversalNodeAbstract, type UniversalTx, type UniversalTxActionExport, type UniversalTxActionExportC, type UniversalTxActionExportP, type UniversalTxActionExportX, type UniversalTxActionImport, type UniversalTxActionImportC, type UniversalTxActionImportP, type UniversalTxActionImportX, type UniversalTxActionType, type UniversalTxExport, type UniversalTxExportC, type UniversalTxExportP, type UniversalTxExportX, type UniversalTxImport, type UniversalTxImportC, type UniversalTxImportP, type UniversalTxImportX, type UnsafeWallet, utxo_helper_d as UtxoHelper, type UtxoType, type WalletBalanceERC20, type WalletBalanceX, type WalletCollectiblesX, type WalletCollectiblesXFamily, type WalletCollectiblesXGroup, type WalletEventArgsType, type WalletEventType, type WalletNameType, type WalletType, WebsocketProvider, type XChainTransaction, type XVMHistoryItemType, XVMWebSocketProvider, ZondaxProvider, activeNetwork, addErc20TokenFromData, bigToBN, bigToLocaleString, bintools, bnToBig, bnToBigLuxC, bnToBigLuxP, bnToBigLuxX, bnToLocaleString, bnToLuxC, bnToLuxP, bnToLuxX, bustErc20Cache, cChain, canHaveBalanceOnC, canHaveBalanceOnP, canHaveBalanceOnX, chainIdFromAlias, cleanAddrs, createCSVContent, createCsvFileIndexer, createCsvNormal, createCsvStaking, createGraphForC, createGraphForP, createGraphForX, digestMessage, erc20Cache, ethersProvider, explorer_api, extractKeysFromDecryptedFile, extractKeysV2, extractKeysV5, extractKeysV6, filterDuplicateCloudTxs, filterDuplicateIndexer, filterDuplicateTransactions, findDestinationChain, findSourceChain, getABIForContract, getActiveNetworkConfig, getAddressChains, getAddressDetailX, getAddressHistory, getAddressHistoryEVM, getAppEth, getAppLux, getAssetDescription, getAssetDescriptionSync, getBalancesForAddresses, getConfigFromUrl, getContractDataErc20, getErc20Cache, getErc20History, getErc20Token, getErc721TokenEthers, getEthAddressKeyFromAccountKey, getEthersJsonRpcProvider, getEvmChainID, getHistoryC, getHistoryEVM, getHistoryForOwnedAddresses, getHistoryForOwnedAddressesRaw, getHistoryP, getHistoryX, getLedgerProvider, getLuxAssetID, getLuxPrice, getLuxPriceHistory, getNFTBalanceFromUTXOs, getNormalHistory, getOutputAddresses, getRpcC, getRpcP, getRpcX, getStakeAmount, getStakeOutAddresses, getStepsForBalanceC, getStepsForBalanceP, getStepsForBalanceX, getTransactionSummary, getTransactionSummaryEVM, getTransactionsForAddresses, getTx, getTxEvm, getTxFeeP, getTxFeeX, getTxOutputAddresses, getTxTimestamp, type iAssetCache, type iAssetDescriptionClean, type iAssetDescriptionRaw, type iHDWalletIndex, type iHistoryBaseTx, type iHistoryBaseTxNFTs, type iHistoryBaseTxNFTsReceived, type iHistoryBaseTxNFTsReceivedRaw, type iHistoryBaseTxNFTsSent, type iHistoryBaseTxNFTsSentRaw, type iHistoryBaseTxToken, type iHistoryBaseTxTokenLossGain, type iHistoryBaseTxTokenOwners, type iHistoryEVMTx, type iHistoryImportExport, type iHistoryItem, type iHistoryNftFamilyBalance, type iHistoryStaking, type iLuxBalance, type iWalletAddressChanged, idToChainAlias, infoApi, isCChainExportTransaction, isCChainImportTransaction, isExplorerErc20Tx, isExplorerNormalTx, isHistoryBaseTx, isHistoryEVMTx, isHistoryImportExportTx, isHistoryStakingTx, isLocalNetwork, isLuxApp, isMainnetNetwork, isMainnetNetworkId, isOwnedUTXO, isTestnetNetwork, isTestnetNetworkId, isTransactionC, isTransactionP, isTransactionX, isUtxo, isValidAddress, listChainsForAddresses, listStakingForAddresses, luxCtoX, luxPtoC, luxXtoC, luxnet, makeKeyfile, normalHeaders, numberToBN, numberToBNLuxC, numberToBNLuxP, numberToBNLuxX, pChain, parseMemo, parseNftPayload, parseNormalTxs, parseStakingTxs, parseTxUtxos, readKeyFile, readV2, readV3, readV4, readV5, readV6, setNetwork, setNetworkAsync, setRpcNetwork, setRpcNetworkAsync, sleep, sortCloudTxs, splitToParts, stakingHeaders, stringToBN, strip0x, waitTxC, waitTxEvm, waitTxP, waitTxX, web3, xChain };