import { IAccount } from './Account'; import { IConnection } from './Connection'; import { Key } from './Key'; import { IAMORole, IEnrichedTransactionParameters, IExportableTransactionParameters, IMultisigAccount, ISignature, ITransactionParameters } from './Transaction'; export interface IModule { address: string; name: string; version: string; } export interface IOwnerInvitationMessageData { txParameters: ITransactionParameters; name?: string; txHash: string; instanceAddress: string; sigs?: ISignature[]; ethereumTxHash?: string; timestamp: number; description: string; } export declare type ProxyData = any; /** * The wallet-class */ export declare class MultisigWallet { connection: IConnection; /** * initializes the class * @param connection The backend connection object. */ constructor(connection: IConnection); /** * Gets the number of owners with the provided role of an IAMO-wallet * @param instanceAddress The multisig address * @param role The IAMO-role * @returns The number of owners with the provided role */ getNumberOfRole(instanceAddress: string, role: IAMORole): Promise; /** * Gets all owners with the provided IAMO_role of the IAMO-wallet * @param instanceAddress The multisig address * @param role The IAMO-role * @returns Array with owner-addresses */ getOwnersWithRole(instanceAddress: string, role: IAMORole): Promise; /** * Gets all owners of the provided IAMO-wallet * @param walletAddress The multisig address * @returns Array of IAccounts with the owners */ getOwners(walletAddress: string): Promise; /** * Checks whether the provided owner-address has the provided IAMO-role within the IAMO-wallet * @param instanceAddress The multisig address * @param owner THe address of the owner * @param role The IAMO-role * @returns True if the owner has the role */ checkRole(instanceAddress: string, owner: string, role: IAMORole): Promise; /** * Gets all IAMO-roles associated of the owner-address for the IAMO-wallet * @param instanceAddress The multisig address * @param owner The address of the owner * @returns THe IAMO-roles of the owner */ getRoles(instanceAddress: string, owner: string): Promise; /** * Creates a new wallet (IAMO safe proxy instance) * @param owners The list of initial owners (default: address of the default private key) * @returns The address of the created proxy-instance */ createWallet(owners?: IMultisigAccount[]): Promise; /** * Calculate wallet (IAMO Safe proxy instance) address with the create2 EVM opcode * @param nonce The nonce used to create the multisig proxy instance (unrelated to the account nonce). * @param owners The list of initial owners (default: address of the default private key) * @param data The additional data to be send during deployment * @returns The eth-address where the wallet would be deployed to */ calcCreate2WalletAddress(nonce: number, owners?: IMultisigAccount[], data?: string): Promise; /** * Creates a new wallet (IAMO Safe proxy instance) with the create2 EVN opcode * @param nonce The nonce used to create the multisig proxy instance (unrelated to the account nonce). * @param owners The list of initial owners (default: address of the default private key) * @param data The additional data to be send during deployment * @returns The eth-address of the deployed proxy-contract */ create2Wallet(nonce: number, owners?: IMultisigAccount[], data?: string): Promise; /** * Creates the transaction parameters to add a new owner. The roles provided must contain the challenge role. * This function allows a custom interval to be set for the challenger. * @param instanceAddress The IAMO Safe instance address * @param newOwner The new owner to add to the instance * @param challengeInterval The challenge interval * @param threshold The threshold for the instance * @returns The prepared transaction parameters */ addChallengerWithThreshold(instanceAddress: string, newOwner: IMultisigAccount, challengeInterval: string, threshold?: number): Promise; /** * Adds a new owner to the IAMO-wallet and sets a new threshold * @param newOwner The address of the new owner * @param walletAddress The address of the multisig proxy instance * @param newThreshold The new threshold '0 < newThreshold <= numberOfOwners` * @returns The prepared transaction parameters */ createAddOwnerTx(newOwner: IMultisigAccount, walletAddress: string, newThreshold?: number): Promise; /** * Returns whether the provided accountAddress is an owner of the IAMO-wallet * @param walletAddress The address of the multisig-proxy instance * @param accountAddress The address of the account whose ownership should be checked * @returns True if the address sis an owner */ isOwner(walletAddress: string, accountAddress: string): Promise; /** * Creates a transaction to deploy and setup the custody-module * @param instanceAddress The IAMO Safe instance address * @param setupParams The initial parameters of the module * @returns The prepared transaction parameters */ deployCustodyModule(instanceAddress: string, setupParams: any): Promise; /** * Returns ether balance in wei for a ethereum account address * @param address The address of account whose balance should be checked. * @returns The ETH-balance of the account */ getEthBalance(address: string): Promise; /** * Returns the ERC20-token balance for the provide ERC20 token contract * @param tokenContractAddress The address of the ERC20 token contract. * @param address The address of account whose ERC20-token balance should be checked. * @returns The ERC20-token-balance of the account */ getErc20Balance(tokenContractAddress: string, address: string): Promise; /** * Returns the threshold of a multisig instance * @param walletAddress The address of the multisig proxy instance. * @returns The threshold */ getThreshold(walletAddress: string): Promise; /** * Creates a transaction, changing the threshold of a wallet * @param newThreshold The new threshold `0 < newThreshold <= numberOfOwners`. * @param walletAddress The address of the multisig proxy instance. * @returns The prepared transaction parameters */ createChangeThresholdTx(newThreshold: number, walletAddress: string): Promise; /** * Creates a transaction, removing a owner from the wallet * @param ownerAddress The address of the owner who should be removed. * @param newThreshold The new threshold `0 < newThreshold <= numberOfOwners`. * @param walletAddress The address of the multisig proxy instance. * @returns The prepared transaction parameters */ createRemoveOwnerTx(ownerAddress: string, newThreshold: number, walletAddress: string): Promise; /** * Creates a transaction, replacing a owner with another address * @param oldOwner The address of the owner who should be replaced. * @param newOwner The address of the new owner. * @param walletAddress The address of the multisig proxy instance. * @returns The prepared transaction parameters */ createSwapOwnerTx(oldOwner: string, newOwner: string, walletAddress: string): Promise; /** * Sets the identity name for an iamo.eth user * @param name The name to set for the subnode owner * @param identityAddress The address to assign the name * @returns The operation-id */ startSetTopLevelName(name: string, identityAddress: string): Promise<{ 'operation-id': string; }>; /** * Checks the registration status of the identity ens registration * @param operationId The operation-id of the initial registration * @returns The operation-state and the array with transaction-hashes */ checkNameRegistration(operationId: string): Promise<{ 'operation-state': string; 'tx-hashes': string[]; }>; /** * Sets the identity name for an iamo.eth user * @param name The identity-name * @param addressToSet The address to set * @param callerAddress The caller-address * @returns The prepared transaction parameters */ finishSetTopLevelName(name: string, addressToSet: string, callerAddress: string): Promise; /** * Creates transaction, setting up the ENS entries for this wallet * @param walletName The name of the wallet. * @param domain The domain under which the wallet should be registered e.g. `alice.iamo.eth`. * @param walletAddress The address of the multisig proxy instance. * @param identityContractAddress The address of the related identity contract. * @returns The prepared transaction parameters */ setupWalletEns(walletName: string, domain: string, walletAddress: string, identityContractAddress: string): Promise; /** * Returns the owner of an ENS name * @param name The domain e.g. `walletA.alice.iamo.eth`. * @returns The owner of the ENS name */ getEnsOwner(name: string): Promise; /** * Returns the address linked to an ENS name * @param name The domain e.g. `walletA.alice.iamo.eth`. * @returns The address linked to an ENS name */ getEnsAddr(name: string): Promise; /** * Returns the ENS name linked to an address * @param address The address * @returns The ENS name of the address */ getEnsName(address: string): Promise; /** * Sets a subnode owner fr an ENS domain * @param walletName The wallet name * @param domain The ENS domain * @param domainOwnerAddress The owner-address of the domain * @param callerAddress The address of the caller * @returns The prepared transaction parameters */ setSubnodeOwner(walletName: string, domain: string, domainOwnerAddress: string, callerAddress?: string): Promise; /** * Sets the ENS name * @param walletName The wallet name * @param domain The domain * @param domainOwnerAddress The owner-address of the domain * @param callerAddress THe address of the caller * @returns The prepared transaction parameters */ setEnsName(walletName: string, domain: string, domainOwnerAddress: string, callerAddress?: string): Promise; /** * Returns the modules of a multisigInstance * @param instanceAddress The address of the multisig proxy instance. * @returns The array with enabled Modules for the wallet */ getModules(instanceAddress: string): Promise; /** * Returns an enabled module with name * @param instanceAddress The address of the multisig proxy instance. * @param name The name of module * @returns The module */ getModuleByName(instanceAddress: string, name: string): Promise; /** * Creates an enable module transaction * @param multisigInstanceAddress The address of the multisig proxy instance. * @param moduleInstanceAddress The address of the module proxy instance * @returns The prepared transaction parameters */ enableModule(multisigInstanceAddress: string, moduleInstanceAddress: string): Promise; /** * Creates a disable module transaction * @param multisigInstanceAddress The address of the multisig proxy instance. * @param moduleInstanceAddress The address of the module proxy instance. * @param prevModuleAddress The address of the previous entry in the enabled modules linked list * @returns The prepared transaction parameters */ disableModule(multisigInstanceAddress: string, moduleInstanceAddress: string, prevModuleAddress?: string): Promise; /** * Returns the module instance address based on a proxyFactory event * @param txHash The ethereum transaction hash of the proxyFactory creation transaction. * @returns THe address of the deployed module */ getModuleAddress(txHash: string): Promise; /** * Sends a notification to import a wallet * @param importingAddress The receiving address * @param privacyWallets An object containing any proxy wallet addresses to import * @param controllerWalletAddress The wallet to import * @param notificationId The notification ID * @param accessTokenRecovery The function called if sync fails */ sendImportWalletNotification(importingAddress: string, privacyWallets: ProxyData[], controllerWalletAddress: string, notificationId: string, accessTokenRecovery: (error: Error) => Promise): Promise; /** * Sends a NewTransaction notification. * @param txParameters The tx-parameters * @param owner The owner address to send the message * @param txnId THe identifier of the notification (e.g. count of sending message, timestamp) * @param accessTokenRecovery The function to be called when sync failed * @param description The description for this notification */ sendNewTransactionNotification(txParameters: IEnrichedTransactionParameters, owner: string, txnId: string, accessTokenRecovery: (error: Error) => Promise, description?: string): Promise; /** * Sends a notification to update a transaction with the attached data * @param data The data to update the transaction * @param owners The owners to notify * @param notificationId The id of the notification * @param accessTokenRecovery The function to be called if the sync fails */ sendUpdateTransactionNotification(data: any, owners: string[], notificationId: string, accessTokenRecovery: (error: Error) => Promise): Promise; /** * Sends a SignRequest to the owners * @param txParameters The transaction-parameters * @param owners The other owner's address to send the message * @param txnId The identifier of the notification (e.g. count of sending message, timestamp) * @param accessTokenRecovery The function to be called when sync failed * @param description The description for this notification */ sendSignRequestNotification(txParameters: IEnrichedTransactionParameters, owners: string[], txnId: string, accessTokenRecovery: (error: Error) => Promise, description?: string): Promise; /** * Sends a Signed-notification * @param txParameters The transaction-parameters * @param owner The owner-address to send the message * @param txnId The identifier of the notification (e.g. count of sending message, timestamp) * @param accessTokenRecovery The function to be called when sync failed */ sendSignedNotification(txParameters: IEnrichedTransactionParameters, owner: string, txnId: string, accessTokenRecovery: (error: Error) => Promise): Promise; /** * Sends a TransactionSend notification to * @param txParameters The transaction-parameters * @param owner The owner-address to send the message * @param txnId The identifier of the notification (e.g. count of sending message, timestamp) * @param accessTokenRecovery The function to be called when sync failed */ sendTransactionSentNotification(txParameters: IEnrichedTransactionParameters, owner: string, txnId: string, accessTokenRecovery: (error: Error) => Promise): Promise; /** * Sends an error notification * @param txParameters The transaction-parameters * @param owner The owner-address to send the message * @param txnId The identifier of the notification (e.g. count of sending message, timestamp) * @param accessTokenRecovery The function to be called when sync failed * @param description The description for this notification */ sendErrorNotification(txParameters: IEnrichedTransactionParameters, owner: string, txnId: string, accessTokenRecovery: (error: Error) => Promise, description?: string): Promise; /** * Sends a new InviteNewOwner notification * @param addOwnerTxParameters The transaction-parameters * @param owner The owner-address to send the message * @param accessTokenRecovery The function to be called when sync failed * @param description The description for this notification */ inviteNewOwner(addOwnerTxParameters: IEnrichedTransactionParameters, owner: string, accessTokenRecovery: (error: Error) => Promise, description?: string): Promise; /** * Allows an address to respond to an external invitation. * @param owner The owner-address to send the message * @param address The new address to add * @param instanceAddress The address of the multisig * @param newAccountIdentityAddress The new owners identity address * @param keyRights The rights of the key * @param accessTokenRecovery The function to be called when sync failed * @param newAccountENSName The ENS name of the new account */ respondToExternalInvite(owner: string, address: string, instanceAddress: string, newAccountIdentityAddress: string, keyRights: string, accessTokenRecovery: (error: Error) => Promise, newAccountENSName?: string): Promise; /** * Sends an answer to an owner invitation * @param invitationMessage The invitation message from the sender * @param owner The owner to answer * @param agreed The response of the invitation * @param accessTokenRecovery The function to be called when sync failed * @param description The description for this notification */ answerOwnerInvitation(invitationMessage: IOwnerInvitationMessageData, owner: string, agreed: boolean, accessTokenRecovery: (error: Error) => Promise, description?: string): Promise; /** * Get all addresses related to 'initialAddress' multisig wallet. (owners, multisig) * @param initialAddress The initial address (multisig) * @param leavesOnly Flag whether to return any leaves * @returns The list with linked address */ getAllLinkedAddress(initialAddress: string, leavesOnly: boolean): Promise; /** * For use with onboarding, creates and setups all modules * @param addresses The address from the onboarding process * @returns The transaction parameters to deploy and setup the Custody module */ createAndSetupAllModules(addresses: string[]): Promise; /** * Gets the transaction parameters to deploy and setup modules. * @param addresses The addresses of the newly deployed wallet objects * @returns The transaction parameters to deploy and setup the Custody module */ getCreateAndSetupAllModulesTransaction(addresses: string[]): Promise; /** * Gets all the accounts associated with an IAMO Safe instance. * @param instanceAddress The IAMO Safe instance address * @returns An array of MultisigAccount objects */ getAllAccounts(instanceAddress: string): Promise; /** * Creates a transaction to add roles to an owner. If the roles * contain the challenge role the default challenge interval * of the IAMO safe will be assigned. * @param instanceAddress The IAMO Safe instance address * @param owner The owner to add roles to * @param roles The roles to add * @returns The prepared transaction parameters to add the roles */ addRole(instanceAddress: string, owner: string, roles: IAMORole[]): Promise; /** * Creates a transaction to add the challenge role and other to * an owner. The roles provided must contain the challenge role. * This function allows a custom interval to be set for the challenger. * @param instanceAddress The IAMO Safe instance address * @param owner The owner to add roles to * @param roles The roles to add * @param challengeInterval The challenge interval to assign the new owner * @returns The prepared transaction parameters to add the the roles */ addChallengeRole(instanceAddress: string, owner: string, roles: IAMORole[], challengeInterval: string): Promise; /** * Creates a notification to inform a user that they have been challenged. * @param challengedOwner The owner who has been challenged (will be the recipient of the notification) * @param nextOwner The owner that will replace the challenged owner * @param challenger The challenger who initiated the challenger * @param accessTokenRecovery The function to be called if the sync fails */ sendChallengedNotification(challengedOwner: string, nextOwner: string, challenger: string, accessTokenRecovery: (error: Error) => Promise): Promise; /** * Creates a notification to inform a owner that they have been removed from wallet * @param oldOwner The owner who has been challenged (will be the recipient of the notification) * @param walletAddress The wallet address that oldOwner removed from * @param ethereumTransactionHash The transaction hash that owner was removed * @param accessTokenRecovery The function to be called if the sync fails */ sendOwnerRemovedNotification(oldOwner: string, walletAddress: string, ethereumTransactionHash: string, accessTokenRecovery: (error: Error) => Promise): Promise; /** * Creates a notification to inform a owner that sign request is rejected * @param txParameters The transaction parameter from sender * @param to The recipient * @param reason The reason why the sign request was rejected * @param txnId The transaction Id * @param accessTokenRecovery The function to be called if the sync fails */ sendSignRequestRejectedNotification(txParameters: IExportableTransactionParameters, to: string, reason: string, txnId: string, accessTokenRecovery: (error: Error) => Promise): Promise; /** * Check signature with threshold. * @param txParameters The transaction to send * @param threshold The threshold * @param originalMessageHash The message hash without the encoding with getMessageHash * @returns true if the signature is valid */ checkSignature(txParameters: IEnrichedTransactionParameters, threshold?: number, originalMessageHash?: string): Promise; /** * Derives the private key for the owner of the privacy wallet at the provided index * @param privacyWalletIndex The privacy index * @param controllerInstanceAddress The controller safe address * @returns The derived key */ derivePrivacyWalletPrivateKey(privacyWalletIndex: number, controllerInstanceAddress: string): Promise; /** * Sends a list of derived addresses to add to privacy wallets * @param recipient The recipient of the notification * @param addresses The list of derived addresses * @param notificationId The notification ID * @param accessTokenRecovery The function to be called if the sync fails */ sendDerivedAddresses(recipient: string, addresses: string[], notificationId: string, accessTokenRecovery: (error: Error) => Promise): Promise; /** * Sends a notification to alert recipient that a new proxy has been created * @param recipient The recipient of the notification * @param privacyWalletAddress The privacy wallet address * @param privacyWalletIndex The privacy wallet index * @param controllerInstance The controller instance address * @param nonce The deployment nonce for the privacy wallet * @param salt The salt for the recovery process on the privacy wallet * @param name The name of the privacy wallet * @param notificationId The notification id * @param accessTokenRecovery The function called if sync fails * @param accountSeparationModuleAddress The module address of the privacy wallet */ sendPrivacyWalletCreatedNotification(recipient: string, privacyWalletAddress: string, privacyWalletIndex: number, controllerInstance: string, nonce: number, salt: string, name: string, notificationId: string, accessTokenRecovery: (error: Error) => Promise, accountSeparationModuleAddress?: string): Promise; /** * Deploys a new privacy wallet * @param nonce The nonce for privacy wallet deployment * @param privacyWalletIndex The privacy wallet index * @param controllerInstanceAddress The controller safe address * @param salt the salt for account separation recovery * @returns The deployed address for the new privacy wallet */ deployPrivacyWallet(nonce: number, privacyWalletIndex: number, controllerInstanceAddress: string, salt: string): Promise; } export default MultisigWallet;