@airgap/aeternity
Version:
The @airgap/aeternity is an Aeternity implementation of the ICoinProtocol interface from @airgap/coinlib-core.
104 lines (103 loc) • 6.05 kB
TypeScript
import { IAirGapSignedTransaction } from '@airgap/coinlib-core/interfaces/IAirGapSignedTransaction';
import { AirGapTransactionStatus, IAirGapTransaction } from '@airgap/coinlib-core/interfaces/IAirGapTransaction';
import { CurrencyUnit, FeeDefaults, ICoinProtocol } from '@airgap/coinlib-core/protocols/ICoinProtocol';
import { ICoinSubProtocol } from '@airgap/coinlib-core/protocols/ICoinSubProtocol';
import { NonExtendedProtocol } from '@airgap/coinlib-core/protocols/NonExtendedProtocol';
import { ProtocolSymbols } from '@airgap/coinlib-core/utils/ProtocolSymbols';
import { SignedAeternityTransaction } from '../types/signed-transaction-aeternity';
import { RawAeternityTransaction } from '../types/transaction-aeternity';
import { UnsignedAeternityTransaction } from '../types/unsigned-transaction-aeternity';
import { AeternityCryptoClient } from './AeternityCryptoClient';
import { AeternityProtocolOptions } from './AeternityProtocolOptions';
import { AeternityAddressCursor, AeternityAddressResult, AeternityTransactionCursor, AeternityTransactionResult } from './AeternityTypes';
export declare class AeternityProtocol extends NonExtendedProtocol implements ICoinProtocol {
readonly options: AeternityProtocolOptions;
symbol: string;
name: string;
marketSymbol: string;
feeSymbol: string;
decimals: number;
feeDecimals: number;
identifier: ProtocolSymbols;
feeDefaults: FeeDefaults;
units: CurrencyUnit[];
supportsHD: boolean;
standardDerivationPath: string;
addressIsCaseSensitive: boolean;
addressValidationPattern: string;
addressPlaceholder: string;
defaultNetworkId: string;
private readonly feesURL;
readonly cryptoClient: AeternityCryptoClient;
constructor(options?: AeternityProtocolOptions);
getSymbol(): Promise<string>;
getName(): Promise<string>;
getMarketSymbol(): Promise<string>;
getAssetSymbol(): Promise<string | undefined>;
getFeeSymbol(): Promise<string>;
getDecimals(): Promise<number>;
getFeeDecimals(): Promise<number>;
getIdentifier(): Promise<ProtocolSymbols>;
getFeeDefaults(): Promise<FeeDefaults>;
getUnits(): Promise<CurrencyUnit[]>;
getSupportsHD(): Promise<boolean>;
getStandardDerivationPath(): Promise<string>;
getAddressIsCaseSensitive(): Promise<boolean>;
getAddressValidationPattern(): Promise<string>;
getAddressPlaceholder(): Promise<string>;
getOptions(): Promise<AeternityProtocolOptions>;
getBlockExplorerLinkForAddress(address: string): Promise<string>;
getBlockExplorerLinkForTxId(txId: string): Promise<string>;
getPublicKeyFromMnemonic(mnemonic: string, derivationPath: string, password?: string): Promise<string>;
getPrivateKeyFromMnemonic(mnemonic: string, derivationPath: string, password?: string): Promise<string>;
/**
* Returns the PublicKey as String, derived from a supplied hex-string
* @param secret HEX-Secret from BIP39
* @param derivationPath DerivationPath for Key
*/
getPublicKeyFromHexSecret(secret: string, derivationPath: string): Promise<string>;
/**
* Returns the PrivateKey as Buffer, derived from a supplied hex-string
* @param secret HEX-Secret from BIP39
* @param derivationPath DerivationPath for Key
*/
getPrivateKeyFromHexSecret(secret: string, derivationPath: string): Promise<string>;
getAddressFromPublicKey(publicKey: string, cursor?: AeternityAddressCursor): Promise<AeternityAddressResult>;
getAddressesFromPublicKey(publicKey: string, cursor?: AeternityAddressCursor): Promise<AeternityAddressResult[]>;
getTransactionsFromPublicKey(publicKey: string, limit: number, cursor?: AeternityTransactionCursor): Promise<AeternityTransactionResult>;
getTransactionsFromAddresses(addresses: string[], limit: number, cursor?: AeternityTransactionCursor): Promise<AeternityTransactionResult>;
protected getPageNumber(limit: number, offset: number): number;
signWithPrivateKey(privateKey: string, transaction: RawAeternityTransaction): Promise<IAirGapSignedTransaction>;
private decodeTx;
getTransactionDetails(unsignedTx: UnsignedAeternityTransaction): Promise<IAirGapTransaction[]>;
getTransactionDetailsFromSigned(signedTx: SignedAeternityTransaction): Promise<IAirGapTransaction[]>;
getBalanceOfAddresses(addresses: string[]): Promise<string>;
getBalanceOfPublicKey(publicKey: string): Promise<string>;
getBalanceOfPublicKeyForSubProtocols(publicKey: string, subProtocols: ICoinSubProtocol[]): Promise<string[]>;
getAvailableBalanceOfAddresses(addresses: string[]): Promise<string>;
estimateMaxTransactionValueFromPublicKey(publicKey: string, recipients: string[], fee?: string): Promise<string>;
estimateFeeDefaultsFromPublicKey(publicKey: string, recipients: string[], values: string[], data?: any): Promise<FeeDefaults>;
prepareTransactionFromPublicKey(publicKey: string, recipients: string[], values: string[], fee: string, data?: {
payload?: string;
}): Promise<RawAeternityTransaction>;
/**
* This is a function that we only use to fix incompatibilitis with old vault versions that are unable to understand b64 encoded Txs.
*
* @deprecated
* @param preparedTx
*/
convertTxToBase58(preparedTx: RawAeternityTransaction): RawAeternityTransaction;
broadcastTransaction(rawTransaction: string): Promise<string>;
signMessage(message: string, keypair: {
privateKey: string;
}): Promise<string>;
verifyMessage(message: string, signature: string, publicKey: string): Promise<boolean>;
encryptAsymmetric(message: string, publicKey: string): Promise<string>;
decryptAsymmetric(message: string, keypair: {
publicKey: string;
privateKey: string;
}): Promise<string>;
encryptAES(message: string, privateKey: string): Promise<string>;
decryptAES(message: string, privateKey: string): Promise<string>;
getTransactionStatuses(transactionHashes: string[]): Promise<AirGapTransactionStatus[]>;
}