PHP WebShell
Текущая директория: /opt/BitGoJS/modules/sdk-core/dist/src/account-lib/baseCoin
Просмотр файла: baseTransactionBuilder.d.ts
import BigNumber from 'bignumber.js';
import { BaseCoin as CoinConfig } from '@bitgo/statics';
import { BaseAddress, BaseKey, PublicKey, ValidityWindow } from './iface';
import { BaseTransaction } from './baseTransaction';
/**
* Generic transaction builder to be extended with coin specific logic.
* Provide a set of default steps (i.e. from, sign, build) and enforces mandatory validations.
*/
export declare abstract class BaseTransactionBuilder {
protected _coinConfig: Readonly<CoinConfig>;
/**
* Base constructor.
*
* @param _coinConfig BaseCoin from statics library
*/
protected constructor(_coinConfig: Readonly<CoinConfig>);
/**
* Parse a transaction based on existing data. The input format is determined by the coin
* extending this class. Some examples are hex, base64, or JSON.
*
* @param rawTransaction A raw transaction to be parsed
* @param isFirstSigner Whether the transaction is being signed by the first signer
*/
from(rawTransaction: any, isFirstSigner?: boolean): void;
/**
* Coin specific implementation of {@code from}.
*
* @see {@link from}
* @returns the parsed coin specific transaction object
*/
protected abstract fromImplementation(rawTransaction: any, isFirstSigner?: boolean): BaseTransaction;
/**
* Validate keys and sign the transaction.
*
* @param key One of the keys associated with this transaction
*/
sign(key: BaseKey): void;
/**
* Adds a signature to the transaction.
*
* @param publicKey public key that produced the signature
* @param signature raw signature as a hex encoded Buffer
*/
addSignature(publicKey: PublicKey, signature: Buffer): void;
/**
* Coin specific implementation of {@code sign}.
*
* @see {@link sign}
* @returns coin specific transaction with signature data
*/
protected abstract signImplementation(key: BaseKey): BaseTransaction;
/**
* Finalize the transaction by performing any extra step like calculating hashes, verifying
* integrity, or adding default values.
*
* @returns valid coin specific transaction (signed or unsigned)
*/
build(): Promise<BaseTransaction>;
/**
* Coin specific implementation of {@code build}.
*
* @see {@link build}
* @returns valid coin specific transaction (signed or unsigned)
*/
protected abstract buildImplementation(): Promise<BaseTransaction>;
/**
* Check the private key is present and is valid in the blockchain context, throw otherwise.
*
* @param {BaseKey} key Private key to validate
*/
abstract validateKey(key: BaseKey): void;
/**
* Check the address provided is valid in the blockchain context, throw otherwise.
*
* @param address Address data to be validated
* @param addressFormat The format the address should be in if more than one is supported
*/
abstract validateAddress(address: BaseAddress, addressFormat?: string): void;
/**
* Check the amount provided is valid in the blockchain context, throw otherwise.
*
* @param {BigNumber} value Transaction amount
*/
abstract validateValue(value: BigNumber): void;
/**
* Check the raw transaction has a valid format in the blockchain context, throw otherwise.
*
* @param rawTransaction Transaction in any format
*/
abstract validateRawTransaction(rawTransaction: any): void;
/**
* Check the transaction mandatory fields per transaction type and ensures it is valid, throw
* otherwise.
*
* @param {BaseTransaction} transaction
*/
abstract validateTransaction(transaction?: BaseTransaction): void;
/**
* Get the underlying coin full name as specified in the statics library.
*/
displayName(): string;
/**
* Get the underlying coin full name as specified in the statics library.
*/
coinName(): string;
/**
* Verified validity windows params if them exist and return a valid validity windows.
* Unit param must be specified
* If params are not consistent, default params will be return based on firstValid and minDuration
* @param {ValidityWindow} params validity windows parameters to validate.
* @param {String} params.unit Parameter that could be 'blockheight' or 'timestamp'
* @param {Number} [params.minDuration] Optional - Minimum duration of the window
* @param {Number} [params.maxDuration] Optional - Maximum duration of the window
* @param {Number} [params.firstValid] Optional - First valid value
* @param {Number} [params.lastValid] Optional - Last valid value
* @returns {ValidityWindow} verified validity windows or default values
*/
getValidityWindow(params: ValidityWindow): ValidityWindow;
/**
* Get the transaction being built.
*/
protected abstract get transaction(): BaseTransaction;
/**
* Set the transaction being built.
*/
protected abstract set transaction(transaction: BaseTransaction);
}
//# sourceMappingURL=baseTransactionBuilder.d.ts.mapВыполнить команду
Для локальной разработки. Не используйте в интернете!