import { BaseCoin as CoinConfig } from '@bitgo/statics'; import EthereumCommon from '@ethereumjs/common'; import BigNumber from 'bignumber.js'; import { BaseAddress, BaseKey, BaseTransaction, BaseTransactionBuilder, TransactionType } from '@bitgo/sdk-core'; import { KeyPair } from './keyPair'; import { Fee, TxData } from './iface'; import { ERC1155TransferBuilder } from './transferBuilders/transferBuilderERC1155'; import { ERC721TransferBuilder } from './transferBuilders/transferBuilderERC721'; import { TransferBuilderERC7984 } from './transferBuilders/transferBuilderERC7984'; import { Transaction } from './transaction'; import { TransferBuilder } from './transferBuilder'; /** * EthereumLike transaction builder. */ export declare abstract class TransactionBuilder extends BaseTransactionBuilder { protected _type: TransactionType; protected _common: EthereumCommon; protected _sourceKeyPair: KeyPair; private _transaction; private _counter; private _fee; protected _value: string; private _txSignature; private _walletOwnerAddresses; protected _walletVersion: number; private _forwarderAddress; private _tokenAddress; private _tokenId; private _tokenContractAddress; private _encryptedHandle; private _parentAddress; protected _transfer: TransferBuilder | ERC721TransferBuilder | ERC1155TransferBuilder | TransferBuilderERC7984; private _contractAddress; private _contractCounter; private _forwarderVersion; private _initCode; private _baseAddress; private _feeAddress; private _data; private _salt; protected _walletSimpleByteCode: string; /** * Public constructor. * * @param _coinConfig */ constructor(_coinConfig: Readonly); /** @inheritdoc */ protected buildImplementation(): Promise; protected getTransactionData(): TxData; /** @inheritdoc */ protected fromImplementation(rawTransaction: string, isFirstSigner?: boolean): Transaction; /** * Load the builder data using the deserialized transaction * * @param {TxData} transactionJson the deserialized transaction json * @param {boolean} isFirstSigner if the transaction is being signed by the first signer */ protected loadBuilderInput(transactionJson: TxData, isFirstSigner?: boolean): void; protected setTransactionTypeFields(decodedType: TransactionType, transactionJson: TxData, isFirstSigner?: boolean): void; /** @inheritdoc */ protected signImplementation(key: BaseKey): BaseTransaction; /** @inheritdoc */ validateAddress(address: BaseAddress): void; /** @inheritdoc */ validateKey(key: BaseKey): void; /** * Validate the raw transaction is either a JSON or * a hex encoded transaction * * @param {any} rawTransaction The raw transaction to be validated */ validateRawTransaction(rawTransaction: any): void; private isEip1559Txn; private isRLPDecodable; protected validateBaseTransactionFields(): void; /** @inheritdoc */ validateTransaction(transaction: BaseTransaction): void; /** * Check wallet owner addresses for wallet initialization transactions are valid or throw. */ private validateWalletInitializationFields; /** * Check if a token address for the tx was defined or throw. */ private validateTokenAddress; /** * Check if a forwarder address for the tx was defined or throw. */ private validateForwarderAddress; /** * Check if a contract address for the wallet was defined or throw. */ private validateContractAddress; /** * Checks if a contract call data field was defined or throws otherwise */ private validateDataField; /** * Check if a token contract address for ERC-7984 flush was defined or throw. */ private validateTokenContractAddress; /** * Check if an encrypted handle for ERC-7984 flush was defined or throw. */ private validateEncryptedHandle; /** * Check if a parent address for ERC-7984 flush was defined or throw. */ private validateParentAddress; private setContract; validateValue(value: BigNumber): void; /** * The type of transaction being built. * * @param {TransactionType} type */ type(type: TransactionType): void; /** * Set the transaction fees. Low fees may get a transaction rejected or never picked up by bakers. * * @param {Fee} fee Baker fees. May also include the maximum gas to pay */ fee(fee: Fee): void; /** * Set the transaction counter to prevent submitting repeated transactions. * * @param {number} counter The counter to use */ counter(counter: number): void; /** * The value to send along with this transaction. 0 by default * * @param {string} value The value to send along with this transaction */ value(value: string): void; protected buildBase(data: string): TxData; /** * Set one of the owners of the multisig wallet. * * @param {string} address An Ethereum address */ owner(address: string): void; /** * Build a transaction for a generic multisig contract. * * @returns {TxData} The Ethereum transaction data */ protected buildWalletInitializationTransaction(walletVersion?: number): TxData; /** * Returns the smart contract encoded data * * @param {string[]} addresses - the contract signers * @returns {string} - the smart contract encoded data */ protected getContractData(addresses: string[]): string; contract(address: string): void; /** * Gets the transfer funds builder if exist, or creates a new one for this transaction and returns it * * @param {string} data transfer data to initialize the transfer builder with, empty if none given * @param {boolean} isFirstSigner whether the transaction is being signed by the first signer * @returns {TransferBuilder | ERC721TransferBuilder | ERC1155TransferBuilder | TransferBuilderERC7984} the transfer builder */ abstract transfer(data?: string, isFirstSigner?: boolean): TransferBuilder | ERC721TransferBuilder | ERC1155TransferBuilder | TransferBuilderERC7984; /** * Returns the serialized sendMultiSig contract method data * * @returns {string} serialized sendMultiSig data */ getSendData(): string; /** * Decide if the coin uses non-packed encoding for tx data * * @returns {boolean} true if the coin uses non-packed encoding for tx data */ coinUsesNonPackedEncodingForTxData(): boolean; private buildSendTransaction; /** * Set the contract transaction nonce to calculate the forwarder address. * * @param {number} contractCounter The counter to use */ contractCounter(contractCounter: number): void; /** * Build a transaction to create a forwarder. * * @returns {TxData} The Ethereum transaction data */ private buildAddressInitializationTransaction; /** * Set the forwarder address to flush * * @param {string} address The address to flush */ forwarderAddress(address: string): void; /** * Set the address of the ERC20 token contract that we are flushing tokens for * * @param {string} address the contract address of the token to flush */ tokenAddress(address: string): void; /** * Set the token ID for ERC721/ERC1155 token flush * * @param {string} tokenId the token ID to flush */ tokenId(tokenId: string): void; /** * Build a transaction to flush tokens from a forwarder. * * @returns {TxData} The Ethereum transaction data */ private buildFlushTokensTransaction; /** * Build a transaction to flush tokens from a forwarder. * * @returns {TxData} The Ethereum transaction data */ private buildFlushCoinsTransaction; /** * Build a transaction to flush ERC721 NFTs from a forwarder. * * @returns {TxData} The Ethereum transaction data */ private buildFlushERC721Transaction; /** * Build a transaction to flush ERC1155 tokens from a forwarder. * * @returns {TxData} The Ethereum transaction data */ private buildFlushERC1155Transaction; data(encodedCall: string): void; private buildGenericContractCallTransaction; /** @inheritdoc */ protected get transaction(): Transaction; /** @inheritdoc */ protected set transaction(transaction: Transaction); /** * Get the final v value. Final v is described in EIP-155. * * @protected for internal use when the enableFinalVField flag is true. */ protected getFinalV(): string; /** * Set the forwarder version for address to be initialized * * @param {number} version forwarder version */ forwarderVersion(version: number): void; /** * Set the salt to create the address using create2 * * @param {string} salt The salt to create the address using create2, hex string */ salt(salt: string): void; /** * Take the implementation address for the proxy contract, and get the binary initcode for the associated proxy * * @param {string} implementationAddress The address of the implementation contract */ initCode(implementationAddress: string): void; /** * Set the wallet version for wallet to be initialized * * @param {number} version wallet version */ walletVersion(version: number): void; /** * Set the base address of the wallet * * @param {string} address The wallet contract address */ baseAddress(address: string): void; /** * Set the fee address of the wallet * * @param {string} address The fee address of the wallet */ feeAddress(address: string): void; /** * Get the wallet version for wallet */ getWalletVersion(): number; /** * Set the ERC-7984 token contract address for forwarder flush transactions. * * @param {string} address The ERC-7984 token contract address */ tokenContractAddress(address: string): void; /** * Set the encrypted balance handle (bytes32 hex) for forwarder flush transactions. * This is the opaque handle returned by confidentialBalanceOf() on the ERC-7984 token contract. * * @param {string} handle The bytes32 hex encrypted balance handle */ encryptedHandle(handle: string): void; /** * Set the parent address (root wallet) for ERC-7984 forwarder flush transactions. * The flushed tokens will be transferred to this address. * * @param {string} address The parent wallet address */ parentAddress(address: string): void; /** * Build a transaction to flush ERC-7984 tokens from a V4 forwarder to the parent wallet. * Encodes: callFromParent(tokenContractAddress, 0, confidentialTransfer(parentAddress, encryptedHandle)) * * @returns {TxData} The Ethereum transaction data */ private buildFlushERC7984ForwarderTokenTransaction; } //# sourceMappingURL=transactionBuilder.d.ts.map