///
import { IConnection } from "./Connection";
import BigNumber from 'bignumber.js';
export declare enum Operation {
Call = 0,
DelegateCall = 1
}
export declare enum Executor {
NotSet = 0,
SafeDirectly = 1,
SafeOverRelay = 2,
AllowlistModule = 3,
LimitModule = 4
}
export declare enum SignatureType {
ECDSA = 0,
EIP1271 = 1,
PreValidated = 2
}
export declare enum IAMORole {
NoRole = 0,
Challenger = 1,
Initiator = 2,
Approver = 3
}
export interface IMultisigAccount {
address: string;
roles: IAMORole[];
consent?: IBunkerConsent;
}
export declare enum TransactionState {
Uninitialized = 0,
InsufficientSigned = 1,
SufficientSigned = 2,
Pending = 3,
MinedWithSuccess = 4,
Error = 5
}
export interface ITransactionParameters {
to: string;
value: string;
data: string;
operation: Operation;
safeTxGas: string;
baseGas: string;
gasPrice: string;
gasToken: string;
refundReceiver: string;
}
export interface ISignature {
address: string;
sigData: any;
}
/**
* Data structure of contract signature.
* This data will be set to ISignature.sigData
*
* https://docs.gnosis.io/safe/docs/contracts_signatures/#contract-signature-eip-1271
*/
export interface IContractSignatureData {
v: number;
r: Buffer;
s: Buffer;
contractSignatures: Buffer;
}
export interface ITransactionError {
description: string;
preErrorTransactionState: TransactionState;
errorObject?: any;
}
export interface IExportableTransactionParameters {
txParameters: ITransactionParameters;
executor?: Executor;
name?: string;
txHash?: string;
instanceAddress?: string;
nonce?: string;
initiatorSig?: ISignature;
sigs?: ISignature[];
ethereumTxHash?: string;
error?: ITransactionError;
relatedLogs?: string[];
transactionState: TransactionState;
privacyWalletTx?: IExportableTransactionParameters;
}
export interface IEnrichedTransactionParameters extends IExportableTransactionParameters {
connection: IConnection;
multisigInstance: any;
signatureType: SignatureType;
signerInstance?: any;
events?: any[];
privacyWalletTx?: IExportableTransactionParameters;
}
export interface ISignatureOptions {
signatureType: SignatureType;
signerAddress?: string;
signerContract?: {
abi: any;
bytecode: any;
};
}
export interface IBunkerConsent {
'challenge-response'?: string;
'policy-id'?: string;
signature?: {
value: any;
timestamp: any;
};
}
export interface IBunkerConsentParams {
key: string;
secret: string;
consent: IBunkerConsent;
}
/**
* The transaction-class of the wallet
*/
export declare class Transaction {
connection: IConnection;
/**
* initializes the class
* @param connection The backend connection object.
*/
constructor(connection: IConnection);
/**
* Updated the state of an existing transaction
* @param enrichedTxParams The object, representing the transaction
* @returns The updated enriched transaction-parameters
*/
updateState(enrichedTxParams: IEnrichedTransactionParameters): Promise;
/**
* Signs a transaction with the keys held in the local memory wallet.
* @param enrichedTxParams The object, representing the transaction
* @returns The updated enriched transaction-parameters
*/
signWithLocalKeys(enrichedTxParams: IEnrichedTransactionParameters): Promise;
/**
* Still not fully implemented
* @param enrichedTxParams The object representing the transaction.
* @param consentParams The bunker key, secret, consent to sign with
* @returns The updated enriched transaction-parameters
*/
sign(enrichedTxParams: IEnrichedTransactionParameters, consentParams?: IBunkerConsentParams): Promise;
/**
* Sends a transaction to the selected chain
*
* Note: If a privacy wallet tx is provided without the privacy connection
* the controller connection will send the tx breaking the privacy link
* @param enrichedTxParams The object, representing the transaction.
* @param privacyConnection The privacy wallet connection to send the transaction from
* @returns The updated enriched transaction-parameters
*/
send(enrichedTxParams: IEnrichedTransactionParameters, privacyWalletConnection?: IConnection): Promise;
/**
* Factory function for a generic transaction object.
* Calculates the gas values and the transaction parameter hash (that's not the ethereum tx hash).
* @param instanceAddress The ethereum address of the wallet (multisig proxy instance).
* @param txData The encoded transaction data.
* @param to The ethereum address which should be called.
* @param value The ether value in wei.
* @param operation The type of operaion (default: `Operaion.Call`).
* @returns The updated enriched transaction-parameters
*/
createGenericTransaction(instanceAddress: string, txData: string, to: string, value: string, operation?: Operation): Promise;
/**
* Factory function for a value transaction object.
* Calculates the gas values and the transaction parameter hash (that's not the ethereum tx hash).
* @param instanceAddress The ethereum address of the wallet (multisig proxy instance).
* @param to The ethereum address which should be called.
* @param value The ether value in wei.
* @returns The updated enriched transaction-parameters
*/
createValueTransaction(instanceAddress: string, to: string, value: string): Promise;
/**
* Imports threshold signatures to an existing object
* @param thresholdSignatures The threshold signatures to import.
* @param enrichedTxParams The object, representing the transaction.
* @returns The updated enriched transaction-parameters
*/
importThresholdSignatures(thresholdSignatures: ISignature[], enrichedTxParams: IEnrichedTransactionParameters): Promise;
/**
* Imports the initiator signature to an existing object
* @param initiatorSig The initiator-signature to import
* @param enrichedTxParams The object, representing the transaction
* @returns The updated enriched transaction-parameters
*/
importInitiatorSignature(initiatorSig: ISignature, enrichedTxParams: IEnrichedTransactionParameters): Promise;
/**
* Exports all threshold signatures
* @param enrichedTxParams The object, representing the transaction.
* @returns The exported signatures
*/
exportThresholdSignatures(enrichedTxParams: IEnrichedTransactionParameters): ISignature[];
/**
* Exports the initiator-signature
* @param enrichedTxParams The object, representing the transaction.
* @returns The exported signatures
*/
exportInitiatorSignature(enrichedTxParams: IEnrichedTransactionParameters): ISignature;
/**
* Exports a transaction
* @param enrichedTxParams The object, representing the transaction.
* @returns The exported transaction parameters
*/
exportTransaction(enrichedTxParams: IEnrichedTransactionParameters): IExportableTransactionParameters;
/**
* Gets the contractAddress's incoming transactions.
*
* Note: this implementation is temporary - this feature should be in the bunker with dedicated database.
* @param contractAddress The contract address to fetch transaction history
* @param tokenAddresses The ERC20-token-address to check
* @param fromBlock The starting-blocknumber for the check
* @param toBlock The ending-blocknumber for the check
* @returns The incoming transactions
*/
getIncomingTransfer(contractAddress: string, tokenAddresses: string[], fromBlock: number, toBlock: number): Promise>;
/**
* Creates a safe transaction to execute all the transactions provided
* @param transactions An array of the objects representing transactions.
* @returns The updated enriched transaction-parameters
*/
batchSafeTransactions(transactions: IEnrichedTransactionParameters[]): Promise;
/**
* Imports a transaction
* @param exportableTxParams The exported transaction parameters
* @returns The updated enriched transaction-parameters
*/
importTransaction(exportableTxParams: IExportableTransactionParameters): Promise;
/**
* Sign as a contract with the contract signature format
* @param enrichedTxParams The object representing the transaction.
* @param signerContractAddress The signer's contract address
* @returns The updated enriched transaction-parameters
*/
signAsContractSignature(enrichedTxParams: IEnrichedTransactionParameters, signerContractAddress: string): Promise;
/**
* Creates the prepared transaction for a controller wallet given a privacy wallet transaction
* @param controllerWalletAddress The address of the controller wallet address
* @param privacyWalletTransaction The privacy wallet transaction
* @returns The prepared transaction for a controller wallet
*/
createControllerTransactionFromPrivacyTransaction(controllerWalletAddress: string, privacyWalletTransaction: IEnrichedTransactionParameters): Promise;
}
export default Transaction;