/** * @prettier */ import { AddressCoinSpecific, BitGoBase, BuildNftTransferDataOptions, FeeEstimateOptions, FullySignedTransaction, HalfSignedTransaction, IWallet, KeyPair, MPCSweepRecoveryOptions, MPCSweepTxs, MPCTxs, ParsedTransaction, ParseTransactionOptions, PrebuildTransactionResult, PresignTransactionOptions as BasePresignTransactionOptions, Recipient, SignTransactionOptions as BaseSignTransactionOptions, TransactionParams, TransactionPrebuild as BaseTransactionPrebuild, TransactionRecipient, TypedData, UnsignedTransactionTss, VerifyAddressOptions as BaseVerifyAddressOptions, VerifyTransactionOptions, Wallet, TssVerifyAddressOptions, DeriveAddressOptions, DeriveAddressResult } from '@bitgo/sdk-core'; import { BaseCoin as StaticsBaseCoin, EthereumNetwork as EthLikeNetwork } from '@bitgo/statics'; import type * as EthLikeCommon from '@ethereumjs/common'; import type * as EthLikeTxLib from '@ethereumjs/tx'; import BN from 'bn.js'; import { AbstractEthLikeCoin } from './abstractEthLikeCoin'; import { SendCrossChainRecoveryOptions } from './types'; /** * The prebuilt hop transaction returned from the HSM */ interface HopPrebuild { tx: string; id: string; signature: string; paymentId: string; gasPrice: number; gasLimit: number; amount: number; recipient: string; nonce: number; userReqSig: string; gasPriceMax: number; } /** * The extra parameters to send to platform build route for hop transactions */ interface HopParams { hopParams: { gasPriceMax: number; userReqSig: string; paymentId: string; gasLimit: number; }; } export interface EIP1559 { maxPriorityFeePerGas: number; maxFeePerGas: number; } export interface ReplayProtectionOptions { chain: string | number; hardfork: string; } export interface TransactionPrebuild extends BaseTransactionPrebuild { hopTransaction?: HopPrebuild; buildParams: { recipients: Recipient[]; }; recipients: TransactionRecipient[]; nextContractSequenceId: number; gasPrice: number; gasLimit: number; isBatch: boolean; coin: string; token?: string; } export interface SignFinalOptions { txPrebuild: { eip1559?: EIP1559; replayProtectionOptions?: ReplayProtectionOptions; gasPrice?: string; gasLimit?: string; recipients?: Recipient[]; halfSigned?: { expireTime: number; contractSequenceId: number; backupKeyNonce?: number; signature: string; txHex?: string; }; nextContractSequenceId?: number; hopTransaction?: string; backupKeyNonce?: number; isBatch?: boolean; txHex?: string; expireTime?: number; }; signingKeyNonce?: number; walletContractAddress?: string; prv: string; recipients?: Recipient[]; common?: EthLikeCommon.default; } export interface SignTransactionOptions extends BaseSignTransactionOptions, SignFinalOptions { isLastSignature?: boolean; expireTime?: number; sequenceId?: number; gasLimit?: number; gasPrice?: number; custodianTransactionId?: string; common?: EthLikeCommon.default; walletVersion?: number; } export type SignedTransaction = HalfSignedTransaction | FullySignedTransaction; export interface FeesUsed { gasPrice: number; gasLimit: number; } interface PrecreateBitGoOptions { enterprise?: string; newFeeAddress?: string; } export interface OfflineVaultTxInfo { nextContractSequenceId?: string; contractSequenceId?: string; tx?: string; txHex?: string; userKey?: string; backupKey?: string; coin: string; gasPrice: number; gasLimit: number; recipients: Recipient[]; walletContractAddress: string; amount: string; backupKeyNonce: number; eip1559?: EIP1559; replayProtectionOptions?: ReplayProtectionOptions; halfSigned?: HalfSignedTransaction; feesUsed?: FeesUsed; isEvmBasedCrossChainRecovery?: boolean; walletVersion?: number; } interface UnformattedTxInfo { recipient: Recipient; } export type UnsignedSweepTxMPCv2 = { txRequests: { transactions: [ { unsignedTx: UnsignedTransactionTss; nonce: number; signatureShares: []; } ]; walletCoin: string; }[]; }; export type UnsignedBuilConsolidation = { transactions: MPCSweepTxs[] | UnsignedSweepTxMPCv2[] | RecoveryInfo[] | OfflineVaultTxInfo[]; lastScanIndex: number; }; export type RecoverOptionsWithBytes = { isTss: true; /** * @deprecated this is no longer used */ openSSLBytes?: Uint8Array; }; export type NonTSSRecoverOptions = { isTss?: false | undefined; }; export type TSSRecoverOptions = RecoverOptionsWithBytes | NonTSSRecoverOptions; export type RecoverOptions = { userKey: string; backupKey: string; walletPassphrase?: string; walletContractAddress: string; recoveryDestination: string; krsProvider?: string; gasPrice?: number; gasLimit?: number; eip1559?: EIP1559; replayProtectionOptions?: ReplayProtectionOptions; bitgoFeeAddress?: string; bitgoDestinationAddress?: string; tokenContractAddress?: string; intendedChain?: string; common?: EthLikeCommon.default; derivationSeed?: string; apiKey?: string; isUnsignedSweep?: boolean; } & TSSRecoverOptions; export type GetBatchExecutionInfoRT = { values: [string[], string[]]; totalAmount: string; }; export interface BuildTransactionParams { to: string; nonce?: number; value: number; data?: Buffer; gasPrice?: number; gasLimit?: number; eip1559?: EIP1559; replayProtectionOptions?: ReplayProtectionOptions; } export interface RecoveryInfo { id: string; tx: string; backupKey?: string; coin?: string; } export interface RecoverTokenTransaction { halfSigned: { recipient: Recipient; expireTime: number; contractSequenceId: number; operationHash: string; signature: string; gasLimit: number; gasPrice: number; tokenContractAddress: string; walletId: string; }; } export interface RecoverTokenOptions { tokenContractAddress: string; wallet: Wallet; recipient: string; broadcast?: boolean; walletPassphrase?: string; prv?: string; } export interface GetSendMethodArgsOptions { recipient: Recipient; expireTime: number; contractSequenceId: number; signature: string; } export interface SendMethodArgs { name: string; type: string; value: any; } interface HopTransactionBuildOptions { wallet: Wallet; recipients: Recipient[]; walletPassphrase: string; } export interface BuildOptions { hop?: boolean; wallet?: Wallet; recipients?: Recipient[]; walletPassphrase?: string; [index: string]: unknown; } interface FeeEstimate { gasLimitEstimate: number; feeEstimate: number; } interface EthTransactionParams extends TransactionParams { gasPrice?: number; gasLimit?: number; hopParams?: HopParams; hop?: boolean; prebuildTx?: PrebuildTransactionResult; tokenName?: string; feeToken?: string; } export interface VerifyEthTransactionOptions extends VerifyTransactionOptions { txPrebuild: TransactionPrebuild; txParams: EthTransactionParams; } interface PresignTransactionOptions extends TransactionPrebuild, BasePresignTransactionOptions { wallet: Wallet; } interface EthAddressCoinSpecifics extends AddressCoinSpecific { forwarderVersion: number; salt?: string; feeAddress?: string; } export declare const DEFAULT_SCAN_FACTOR = 20; export interface EthConsolidationRecoveryOptions { coinName?: string; walletContractAddress?: string; apiKey?: string; isTss?: boolean; userKey?: string; backupKey?: string; walletPassphrase?: string; recoveryDestination?: string; krsProvider?: string; gasPrice?: number; gasLimit?: number; eip1559?: EIP1559; replayProtectionOptions?: ReplayProtectionOptions; bitgoFeeAddress?: string; bitgoDestinationAddress?: string; tokenContractAddress?: string; intendedChain?: string; common?: EthLikeCommon.default; derivationSeed?: string; bitgoKey?: string; startingScanIndex?: number; endingScanIndex?: number; ignoreAddressTypes?: unknown; } export interface VerifyEthAddressOptions extends BaseVerifyAddressOptions { baseAddress: string; coinSpecific: EthAddressCoinSpecifics; forwarderVersion?: number; walletVersion?: number; } export type TssVerifyEthAddressOptions = TssVerifyAddressOptions & VerifyEthAddressOptions; /** * Keychain with ethAddress for BIP32 wallet verification (V1, V2, V4) * Used for wallets that derive addresses using Ethereum addresses from keychains */ export interface KeychainWithEthAddress { ethAddress: string; pub: string; } /** * BIP32 wallet base address verification options * Supports V1, V2, and V4 wallets that use ethAddress-based derivation */ export interface VerifyContractBaseAddressOptions extends VerifyEthAddressOptions { walletVersion: number; keychains: KeychainWithEthAddress[]; } /** * Type guard to check if params are for BIP32 base address verification (V1, V2, V4) * These wallet versions use ethAddress for address derivation */ export declare function isVerifyContractBaseAddressOptions(params: VerifyEthAddressOptions | TssVerifyEthAddressOptions): params is VerifyContractBaseAddressOptions; export declare const optionalDeps: { readonly ethAbi: any; readonly ethUtil: any; readonly EthTx: typeof EthLikeTxLib; readonly EthCommon: typeof EthLikeCommon; }; export declare abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin { static hopTransactionSalt: string; protected readonly sendMethodName: 'sendMultiSig' | 'sendMultiSigToken'; readonly staticsCoin?: Readonly; protected constructor(bitgo: BitGoBase, staticsCoin?: Readonly); /** * Method to return the coin's network object * @returns {EthLikeNetwork | undefined} */ getNetwork(): EthLikeNetwork | undefined; /** * Evaluates whether an address string is valid for this coin * @param {string} address * @returns {boolean} True if address is the valid ethlike adderss */ isValidAddress(address: string): boolean; /** * Flag for sending data along with transactions * @returns {boolean} True if okay to send tx data (ETH), false otherwise */ transactionDataAllowed(): boolean; /** @inheritDoc */ supportsMessageSigning(): boolean; /** @inheritDoc */ supportsSigningTypedData(): boolean; /** * Default expire time for a contract call (1 week) * @returns {number} Time in seconds */ getDefaultExpireTime(): number; /** * Method to get the custom chain common object based on params from recovery * @param {number} chainId - the chain id of the custom chain * @returns {EthLikeCommon.default} */ static getCustomChainCommon(chainId: number): EthLikeCommon.default; /** * Gets correct Eth Common object based on params from either recovery or tx building * @param {EIP1559} eip1559 - configs that specify whether we should construct an eip1559 tx * @param {ReplayProtectionOptions} replayProtectionOptions - check if chain id supports replay protection * @returns {EthLikeCommon.default} */ private static getEthLikeCommon; /** * Method to build the tx object * @param {BuildTransactionParams} params - params to build transaction * @returns {EthLikeTxLib.FeeMarketEIP1559Transaction | EthLikeTxLib.Transaction} */ static buildTransaction(params: BuildTransactionParams): EthLikeTxLib.FeeMarketEIP1559Transaction | EthLikeTxLib.Transaction; /** * Query explorer for the balance of an address * @param {String} address - the ETHLike address * @param {String} apiKey - optional API key to use instead of the one from the environment * @returns {BigNumber} address balance */ queryAddressBalance(address: string, apiKey?: string): Promise; /** * @param {Recipient[]} recipients - the recipients of the transaction * @param {number} expireTime - the expire time of the transaction * @param {number} contractSequenceId - the contract sequence id of the transaction * @returns {string} */ getOperationSha3ForExecuteAndConfirm(recipients: Recipient[], expireTime: number, contractSequenceId: number): string; /** * Get transfer operation for coin * @param {Recipient} recipient - recipient info * @param {number} expireTime - expiry time * @param {number} contractSequenceId - sequence id * @returns {Array} operation array */ getOperation(recipient: Recipient, expireTime: number, contractSequenceId: number): (string | Buffer)[][]; /** * Queries the contract (via explorer API) for the next sequence ID * @param {String} address - address of the contract * @param {String} apiKey - optional API key to use instead of the one from the environment * @returns {Promise} sequence ID */ querySequenceId(address: string, apiKey?: string): Promise; /** * Recover an unsupported token from a BitGo multisig wallet * This builds a half-signed transaction, for which there will be an admin route to co-sign and broadcast. Optionally * the user can set params.broadcast = true and the half-signed tx will be sent to BitGo for cosigning and broadcasting * @param {RecoverTokenOptions} params * @param {Wallet} params.wallet - the wallet to recover the token from * @param {string} params.tokenContractAddress - the contract address of the unsupported token * @param {string} params.recipient - the destination address recovered tokens should be sent to * @param {string} params.walletPassphrase - the wallet passphrase * @param {string} params.prv - the xprv * @param {boolean} params.broadcast - if true, we will automatically submit the half-signed tx to BitGo for cosigning and broadcasting * @returns {Promise} */ recoverToken(params: RecoverTokenOptions): Promise; /** * Ensure either enterprise or newFeeAddress is passed, to know whether to create new key or use enterprise key * @param {PrecreateBitGoOptions} params * @param {string} params.enterprise {String} the enterprise id to associate with this key * @param {string} params.newFeeAddress {Boolean} create a new fee address (enterprise not needed in this case) * @returns {void} */ preCreateBitGo(params: PrecreateBitGoOptions): void; /** * Queries public block explorer to get the next ETHLike coin's nonce that should be used for the given ETH address * @param {string} address * @param {string} apiKey - optional API key to use instead of the one from the environment * @returns {Promise} */ getAddressNonce(address: string, apiKey?: string): Promise; /** * Helper function for recover() * This transforms the unsigned transaction information into a format the BitGo offline vault expects * @param {UnformattedTxInfo} txInfo - tx info * @param {EthLikeTxLib.Transaction | EthLikeTxLib.FeeMarketEIP1559Transaction} ethTx - the ethereumjs tx object * @param {string} userKey - the user's key * @param {string} backupKey - the backup key * @param {Buffer} gasPrice - gas price for the tx * @param {number} gasLimit - gas limit for the tx * @param {EIP1559} eip1559 - eip1559 params * @param {ReplayProtectionOptions} replayProtectionOptions - replay protection options * @param {apiKey} apiKey - optional apiKey to use when retrieving block chain data * @returns {Promise} */ formatForOfflineVault(txInfo: UnformattedTxInfo, ethTx: EthLikeTxLib.Transaction | EthLikeTxLib.FeeMarketEIP1559Transaction, userKey: string, backupKey: string, gasPrice: Buffer, gasLimit: number, eip1559?: EIP1559, replayProtectionOptions?: ReplayProtectionOptions, apiKey?: string): Promise; /** * Helper function for recover() * This transforms the unsigned transaction information into a format the BitGo offline vault expects * @param {UnformattedTxInfo} txInfo - tx info * @param {EthLikeTxLib.Transaction | EthLikeTxLib.FeeMarketEIP1559Transaction} ethTx - the ethereumjs tx object * @param {string} userKey - the user's key * @param {string} backupKey - the backup key * @param {Buffer} gasPrice - gas price for the tx * @param {number} gasLimit - gas limit for the tx * @param {number} backupKeyNonce - the nonce of the backup key address * @param {EIP1559} eip1559 - eip1559 params * @param {ReplayProtectionOptions} replayProtectionOptions - replay protection options * @returns {Promise} */ formatForOfflineVaultTSS(txInfo: UnformattedTxInfo, ethTx: EthLikeTxLib.Transaction | EthLikeTxLib.FeeMarketEIP1559Transaction, userKey: string, backupKey: string, gasPrice: Buffer, gasLimit: number, backupKeyNonce: number, eip1559?: EIP1559, replayProtectionOptions?: ReplayProtectionOptions): OfflineVaultTxInfo; /** * Check whether the gas price passed in by user are within our max and min bounds * If they are not set, set them to the defaults * @param {number} userGasPrice - user defined gas price * @returns {number} the gas price to use for this transaction */ setGasPrice(userGasPrice?: number): number; /** * Check whether gas limit passed in by user are within our max and min bounds * If they are not set, set them to the defaults * @param {number} userGasLimit user defined gas limit * @returns {number} the gas limit to use for this transaction */ setGasLimit(userGasLimit?: number): number; /** * Helper function for signTransaction for the rare case that SDK is doing the second signature * Note: we are expecting this to be called from the offline vault * @param {SignFinalOptions.txPrebuild} params.txPrebuild * @param {string} params.prv * @returns {{txHex: string}} */ signFinalEthLike(params: SignFinalOptions): Promise; /** * Assemble half-sign prebuilt transaction * @param {SignTransactionOptions} params */ signTransaction(params: SignTransactionOptions): Promise; /** * Method to validate recovery params * @param {RecoverOptions} params * @returns {void} */ validateRecoveryParams(params: RecoverOptions): void; /** * Helper which Adds signatures to tx object and re-serializes tx * @param {EthLikeCommon.default} ethCommon * @param {EthLikeTxLib.FeeMarketEIP1559Transaction | EthLikeTxLib.Transaction} tx * @param {ECDSAMethodTypes.Signature} signature * @returns {EthLikeTxLib.FeeMarketEIP1559Transaction | EthLikeTxLib.Transaction} */ private getSignedTxFromSignature; /** * Builds a funds recovery transaction without BitGo * @param params * @param {string} params.userKey - [encrypted] xprv * @param {string} params.backupKey - [encrypted] xprv or xpub if the xprv is held by a KRS provider * @param {string} params.walletPassphrase - used to decrypt userKey and backupKey * @param {string} params.walletContractAddress - the ETH address of the wallet contract * @param {string} params.krsProvider - necessary if backup key is held by KRS * @param {string} params.recoveryDestination - target address to send recovered funds to * @param {string} params.bitgoFeeAddress - wrong chain wallet fee address for evm based cross chain recovery txn * @param {string} params.bitgoDestinationAddress - target bitgo address where fee will be sent for evm based cross chain recovery txn */ recover(params: RecoverOptions): Promise; generateForwarderAddress(baseAddress: string, feeAddress: string, forwarderFactoryAddress: string, forwarderImplementationAddress: string, index: number): string; deriveAddressFromPublicKey(commonKeychain: string, index: number): string; getConsolidationAddress(params: EthConsolidationRecoveryOptions, index: number): string[]; recoverConsolidations(params: EthConsolidationRecoveryOptions): Promise; /** * Builds a funds recovery transaction without BitGo for non-TSS transaction * @param params * @param {string} params.userKey [encrypted] xprv or xpub * @param {string} params.backupKey [encrypted] xprv or xpub if the xprv is held by a KRS provider * @param {string} params.walletPassphrase used to decrypt userKey and backupKey * @param {string} params.walletContractAddress the EthLike address of the wallet contract * @param {string} params.krsProvider necessary if backup key is held by KRS * @param {string} params.recoveryDestination target address to send recovered funds to * @param {string} params.bitgoFeeAddress wrong chain wallet fee address for evm based cross chain recovery txn * @param {string} params.bitgoDestinationAddress target bitgo address where fee will be sent for evm based cross chain recovery txn * @returns {Promise} */ protected recoverEthLike(params: RecoverOptions): Promise; /** * Extract recipients from transaction hex * @param txHex - The transaction hex string * @returns Array of recipients with address and amount */ private extractRecipientsFromTxHex; sendCrossChainRecoveryTransaction(params: SendCrossChainRecoveryOptions): Promise<{ coin: string; txHex?: string; txid: string; }>; buildCrossChainRecoveryTransaction(recoveryId: string): Promise<{ coin: string; txHex: string; txid: string; walletVersion?: number; recipients: Array<{ address: string; amount: string; }>; }>; /** * Builds a unsigned (for cold, custody wallet) or * half-signed (for hot wallet) evm cross chain recovery transaction with * same expected arguments as recover method. * This helps recover funds from evm based wrong chain. * @param {RecoverOptions} params * @returns {Promise} */ protected recoverEthLikeforEvmBasedRecovery(params: RecoverOptions): Promise; /** * Query explorer for the balance of an address for a token * @param {string} tokenContractAddress - address where the token smart contract is hosted * @param {string} walletContractAddress - address of the wallet * @param {string} apiKey - optional API key to use instead of the one from the environment * @returns {BigNumber} token balaance in base units */ queryAddressTokenBalance(tokenContractAddress: string, walletContractAddress: string, apiKey?: string): Promise; recoverEthLikeTokenforEvmBasedRecovery(params: RecoverOptions, bitgoFeeAddressNonce: number, gasLimit: any, gasPrice: any, userKey: any, userSigningKey: any, apiKey?: string): Promise; /** * Validate evm based cross chain recovery params * @param params {RecoverOptions} * @returns {void} */ validateEvmBasedRecoveryParams(params: RecoverOptions): void; /** * Return types, values, and total amount in wei to send in a batch transaction, using the method signature * `distributeBatch(address[], uint256[])` * @param {Recipient[]} recipients - transaction recipients * @returns {GetBatchExecutionInfoRT} information needed to execute the batch transaction */ getBatchExecutionInfo(recipients: Recipient[]): GetBatchExecutionInfoRT; /** * Get the data required to make an ETH function call defined by the given types and values * * @param {string} functionName - The name of the function being called, e.g. transfer * @param types The types of the function call in order * @param values The values of the function call in order * @return {Buffer} The combined data for the function call */ getMethodCallData: (functionName: any, types: any, values: any) => Buffer; /** * Build arguments to call the send method on the wallet contract * @param txInfo */ getSendMethodArgs(txInfo: GetSendMethodArgsOptions): SendMethodArgs[]; /** * Recovers a tx with TSS key shares * same expected arguments as recover method, but with TSS key shares */ protected recoverTSS(params: RecoverOptions): Promise; private getGasValues; protected buildUnsignedSweepTxnTSS(params: RecoverOptions): Promise; protected buildUnsignedSweepTxnMPCv2(params: RecoverOptions): Promise; createBroadcastableSweepTransaction(params: MPCSweepRecoveryOptions): Promise; /** * Method to validate recovery params * @param {RecoverOptions} params * @returns {void} */ private validateUnsignedSweepTSSParams; /** * Helper function for recover() * This transforms the unsigned transaction information into a format the BitGo offline vault expects * @param {UnformattedTxInfo} txInfo - tx info * @param {LegacyTransaction | FeeMarketEIP1559Transaction} ethTx - the ethereumjs tx object * @param {string} derivationPath - the derivationPath * @param {number} nonce - the nonce of the backup key address * @param {Buffer} gasPrice - gas price for the tx * @param {number} gasLimit - gas limit for the tx * @param {EIP1559} eip1559 - eip1559 params * @param replayProtectionOptions * @param commonKeyChain * @returns {Promise} */ private buildTxRequestForOfflineVaultMPCv2; private buildTssRecoveryTxn; validateBalanceAndGetTxAmount(baseAddress: string, gasPrice: BN, gasLimit: BN, apiKey?: string): Promise; /** * Make a query to blockchain explorer for information such as balance, token balance, solidity calls * @param query {Object} key-value pairs of parameters to append after /api * @param apiKey {string} optional API key to use instead of the one from the environment * @returns {Object} response from the blockchain explorer */ recoveryBlockchainExplorerQuery(query: Record, apiKey?: string): Promise; /** * Creates the extra parameters needed to build a hop transaction * @param buildParams The original build parameters * @returns extra parameters object to merge with the original build parameters object and send to the platform */ createHopTransactionParams(buildParams: HopTransactionBuildOptions): Promise; /** * Validates that the hop prebuild from the HSM is valid and correct * @param {IWallet} wallet - The wallet that the prebuild is for * @param {HopPrebuild} hopPrebuild - The prebuild to validate * @param {Object} originalParams - The original parameters passed to prebuildTransaction * @param {Recipient[]} originalParams.recipients - The original recipients array * @returns {void} * @throws Error if The prebuild is invalid */ validateHopPrebuild(wallet: IWallet, hopPrebuild: HopPrebuild, originalParams?: { recipients: Recipient[]; }): Promise; /** * Gets the hop digest for the user to sign. This is validated in the HSM to prove that the user requested this tx * @param {string[]} paramsArr - The parameters to hash together for the digest * @returns {Buffer} */ static getHopDigest(paramsArr: string[]): Buffer; /** * Modify prebuild before sending it to the server. Add things like hop transaction params * @param {BuildOptions} buildParams - The whitelisted parameters for this prebuild * @param {boolean} buildParams.hop - True if this should prebuild a hop tx, else false * @param {Recipient[]} buildParams.recipients - The recipients array of this transaction * @param {Wallet} buildParams.wallet - The wallet sending this tx * @param {string} buildParams.walletPassphrase - the passphrase for this wallet * @returns {Promise} */ getExtraPrebuildParams(buildParams: BuildOptions): Promise; /** * Modify prebuild after receiving it from the server. Add things like nlocktime * @param {TransactionPrebuild} params - The prebuild to modify * @returns {TransactionPrebuild} The modified prebuild */ postProcessPrebuild(params: TransactionPrebuild): Promise; /** * Coin-specific things done before signing a transaction, i.e. verification * @param {PresignTransactionOptions} params * @returns {Promise} */ presignTransaction(params: PresignTransactionOptions): Promise; /** * Fetch fee estimate information from the server * @param {Object} params - The params passed into the function * @param {boolean} [params.hop] - True if we should estimate fee for a hop transaction * @param {string} [params.recipient] - The recipient of the transaction to estimate a send to * @param {string} [params.data] - The ETH tx data to estimate a send for * @returns {Object} The fee info returned from the server */ feeEstimate(params: FeeEstimateOptions): Promise; /** * Generate secp256k1 key pair * * @param {Buffer} seed * @returns {KeyPair} object with generated pub and prv */ generateKeyPair(seed: Buffer): KeyPair; parseTransaction(params: ParseTransactionOptions): Promise; /** * Get forwarder factory and implementation addresses for deposit address verification. * Forwarders are smart contracts that forward funds to the base wallet address. * * @param {number | undefined} forwarderVersion - The wallet version * @returns {object} Factory and implementation addresses for forwarders */ getForwarderFactoryAddressesAndForwarderImplementationAddress(forwarderVersion: number | undefined): { forwarderFactoryAddress: string; forwarderImplementationAddress: string; }; /** * Get wallet base address factory and implementation addresses. * This is used for base address verification for V1, V2, V4, and V5 wallets. * The base address is the main wallet contract deployed via CREATE2. * * @param {number} walletVersion - The wallet version (1, 2, 4, or 5) * @returns {object} Factory and implementation addresses for the wallet base address * @throws {Error} if wallet version addresses are not configured */ getWalletAddressFactoryAddressesAndImplementationAddress(walletVersion: number): { walletFactoryAddress: string; walletImplementationAddress: string; }; /** * Helper method to create a salt buffer from hex string. * Converts a hex salt string to a 32-byte buffer. * * @param {string} salt - The hex salt string * @returns {Buffer} 32-byte salt buffer */ private createSaltBuffer; /** * Verify BIP32 wallet base address (V1, V2, V4). * These wallets use a wallet factory to deploy base addresses with CREATE2. * The address is derived from the keychains' ethAddresses and a salt. * * @param {VerifyBip32BaseAddressOptions} params - Verification parameters * @returns {object} Expected and actual addresses for comparison */ private verifyCreate2BaseAddress; /** * Verify forwarder receive address (deposit address). * Forwarder addresses are derived using CREATE2 from the base address and salt. * * @param {VerifyEthAddressOptions} params - Verification parameters * @param {number} forwarderVersion - The forwarder version * @returns {object} Expected and actual addresses for comparison */ private verifyForwarderAddress; /** * Make sure an address is a wallet address and throw an error if it's not. * @param {Object} params * @param {string} params.address - The derived address string on the network * @param {Object} params.coinSpecific - Coin-specific details for the address such as a forwarderVersion * @param {string} params.baseAddress - The base address of the wallet on the network * @throws {InvalidAddressError} * @throws {InvalidAddressVerificationObjectPropertyError} * @throws {UnexpectedAddressError} * @returns {boolean} True iff address is a wallet address */ isWalletAddress(params: VerifyEthAddressOptions | TssVerifyEthAddressOptions): Promise; /** * Locally derive an ETH wallet receive address from a derivation path, using the wallet's * commonKeychain only (no private keys, no network access). The inverse of * {@link isWalletAddress}: it *produces* the address via the same secp256k1 MPC derivation * that isWalletAddress checks against (`deriveMPCWalletAddress` + `KeyPair.getAddress()`), * so derive and verify can never diverge. * * Supports MPC/TSS wallets only (wallet versions 3, 5, 6). Legacy BIP32 forwarder wallets * (versions 1, 2, 4) derive per-index forwarder contract addresses and are handled separately. * @param params keychains (commonKeychain), derivation index, walletVersion, and optional SMC seed * @returns the derived address, the index used, and the HD derivation path */ deriveAddress(params: DeriveAddressOptions): Promise; /** * * @param {TransactionPrebuild} txPrebuild * @returns {boolean} */ verifyCoin(txPrebuild: TransactionPrebuild): boolean; /** * Generate transaction explanation for error reporting * @param txPrebuild - Transaction prebuild containing txHex and fee info * @returns Stringified JSON explanation */ private getTxExplanation; /** * Verify if a tss transaction is valid * * @param {VerifyEthTransactionOptions} params * @param {TransactionParams} params.txParams - params object passed to send * @param {TransactionPrebuild} params.txPrebuild - prebuild object returned by server * @param {Wallet} params.wallet - Wallet object to obtain keys to verify against * @returns {boolean} * @throws {TxIntentMismatchRecipientError} if transaction recipients don't match user intent */ verifyTssTransaction(params: VerifyEthTransactionOptions): Promise; /** * Verify that a transaction prebuild complies with the original intention * * @param {VerifyEthTransactionOptions} params * @param {TransactionParams} params.txParams - params object passed to send * @param {TransactionPrebuild} params.txPrebuild - prebuild object returned by server * @param {Wallet} params.wallet - Wallet object to obtain keys to verify against * @returns {boolean} * @throws {TxIntentMismatchError} if transaction validation fails * @throws {TxIntentMismatchRecipientError} if transaction recipients don't match user intent */ verifyTransaction(params: VerifyEthTransactionOptions): Promise; /** * Check if address is valid eth address * @param address * @returns {boolean} */ /** * Verifies an ERC-7984 token enablement (decryption delegation) transaction for multisig wallets. * * Two wallet shapes are supported: * * Base-address wallet — txPrebuild targets the Zama ACL contract directly: * txParams.recipients : one entry per token, all with the wallet base address, amount '0' * txPrebuild.recipients[0] : the Zama ACL contract address * * Forwarder wallet — txPrebuild targets the forwarder which calls the ACL via callFromParent: * txParams.recipients : one entry per token, all with the forwarder address, amount '0' * txPrebuild.recipients[0] : the forwarder address (matches txParams recipients) * * In both cases all amounts must be 0 and all txParams recipients must share the same address. */ private verifyMultisigEnableTokenTransaction; private isETHAddress; /** * Transform message to accommodate specific blockchain requirements. * @param {string} message - the message to prepare * @return {string} the prepared message as a hex encoded string. */ encodeMessage(message: string): string; /** * Transform the Typed data to accomodate the blockchain requirements (EIP-712) * @param {TypedData} typedData - the typed data to prepare * @return {Buffer} a buffer of the result */ encodeTypedData(typedData: TypedData): Buffer; /** * Build the data to transfer an ERC-721 or ERC-1155 token to another address * @param params */ buildNftTransferData(params: BuildNftTransferDataOptions): string; /** * Fetch the gas price from the explorer * @param {string} wrongChainCoin - the coin that we're getting gas price for * @param {string} apiKey - optional API key to use instead of the one from the environment */ getGasPriceFromExternalAPI(wrongChainCoin: string, apiKey?: string): Promise; /** * Fetch the gas limit from the explorer * @param intendedChain * @param from * @param to * @param data * @param {string} apiKey - optional API key to use instead of the one from the environment */ getGasLimitFromExternalAPI(intendedChain: string, from: string, to: string, data: string, apiKey?: string): Promise; /** * Get the balance of bitgoFeeAddress to ensure funds are available to pay fees * @param bitgoFeeAddress * @param gasPrice * @param gasLimit * @param apiKey - optional API key to use instead of the one from the environment */ ensureSufficientBalance(bitgoFeeAddress: string, gasPrice: BN, gasLimit: BN, apiKey?: string): Promise; } export {}; //# sourceMappingURL=abstractEthLikeNewCoins.d.ts.map