From 8fb6c76e4fada71c91f516ed151c4519ff2fe0fd Mon Sep 17 00:00:00 2001 From: Aaron DeRuvo Date: Thu, 11 Jan 2024 19:59:39 +0200 Subject: [PATCH] Reremove MetaTranactionWallet contracts (#57) Co-authored-by: Aaron --- .changeset/curly-pianos-applaud.md | 7 + packages/docs/sdk/docs/contractkit/README.md | 2 - .../classes/_contract_cache_.wrappercache.md | 35 +- ..._web3_contract_cache_.web3contractcache.md | 40 +- .../_wrappers_basewrapper_.basewrapper.md | 3 - ...ionwallet_.metatransactionwalletwrapper.md | 446 ------------------ ...r_.metatransactionwalletdeployerwrapper.md | 160 ------- packages/docs/sdk/docs/contractkit/globals.md | 2 - .../modules/_web3_contract_cache_.md | 12 - .../_wrappers_metatransactionwallet_.md | 117 ----- ...wrappers_metatransactionwalletdeployer_.md | 21 - packages/sdk/contractkit/README.md | 2 - packages/sdk/contractkit/src/base.ts | 9 +- .../sdk/contractkit/src/contract-cache.ts | 18 - packages/sdk/contractkit/src/proxy.ts | 4 - .../contractkit/src/web3-contract-cache.ts | 16 - .../wrappers/MetaTransactionWallet.test.ts | 266 ----------- .../src/wrappers/MetaTransactionWallet.ts | 313 ------------ .../MetaTransactionWalletDeployer.test.ts | 91 ---- .../wrappers/MetaTransactionWalletDeployer.ts | 14 - 20 files changed, 13 insertions(+), 1565 deletions(-) create mode 100644 .changeset/curly-pianos-applaud.md delete mode 100644 packages/docs/sdk/docs/contractkit/classes/_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md delete mode 100644 packages/docs/sdk/docs/contractkit/classes/_wrappers_metatransactionwalletdeployer_.metatransactionwalletdeployerwrapper.md delete mode 100644 packages/docs/sdk/docs/contractkit/modules/_wrappers_metatransactionwallet_.md delete mode 100644 packages/docs/sdk/docs/contractkit/modules/_wrappers_metatransactionwalletdeployer_.md delete mode 100644 packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.test.ts delete mode 100644 packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts delete mode 100644 packages/sdk/contractkit/src/wrappers/MetaTransactionWalletDeployer.test.ts delete mode 100644 packages/sdk/contractkit/src/wrappers/MetaTransactionWalletDeployer.ts diff --git a/.changeset/curly-pianos-applaud.md b/.changeset/curly-pianos-applaud.md new file mode 100644 index 000000000..e212eec04 --- /dev/null +++ b/.changeset/curly-pianos-applaud.md @@ -0,0 +1,7 @@ +--- +'@celo/contractkit': patch +--- + +Re-removes MetaTransaction wallets (as previously removed in 6.0) + +*previous messsage for removal* - 9ab9d00eb: Remove Support for deprecated MetaTransactionWallet and MetaTransactionWalletDeployer. IF absolutely needed the contracts can be accessed directly or an alternative such as account abstraction should be used diff --git a/packages/docs/sdk/docs/contractkit/README.md b/packages/docs/sdk/docs/contractkit/README.md index bc3426c45..742dd0d4b 100644 --- a/packages/docs/sdk/docs/contractkit/README.md +++ b/packages/docs/sdk/docs/contractkit/README.md @@ -154,8 +154,6 @@ There are many core contracts. - GovernanceWrapper - GrandaMentoWrapper - LockedGoldWrapper -- MetaTransactionWalletWrapper -- MetaTransactionWalletDeployerWrapper - MultiSigWrapper - ReserveWrapper - SortedOraclesWrapper diff --git a/packages/docs/sdk/docs/contractkit/classes/_contract_cache_.wrappercache.md b/packages/docs/sdk/docs/contractkit/classes/_contract_cache_.wrappercache.md index b8948ff69..379c0d651 100644 --- a/packages/docs/sdk/docs/contractkit/classes/_contract_cache_.wrappercache.md +++ b/packages/docs/sdk/docs/contractkit/classes/_contract_cache_.wrappercache.md @@ -6,7 +6,7 @@ Kit ContractWrappers factory & cache. Provides access to all contract wrappers for celo core contracts -**`remarks`** +**`remarks`** Because it provides access to all contract wrappers it must load all wrappers and the contract ABIs for them Consider Using {@link MiniWrapperCache}, building your own, or if you only need one Wrapper using it directly @@ -50,8 +50,6 @@ Consider Using {@link MiniWrapperCache}, building your own, or if you only need * [getGovernance](_contract_cache_.wrappercache.md#getgovernance) * [getGrandaMento](_contract_cache_.wrappercache.md#getgrandamento) * [getLockedGold](_contract_cache_.wrappercache.md#getlockedgold) -* [getMetaTransactionWallet](_contract_cache_.wrappercache.md#getmetatransactionwallet) -* [getMetaTransactionWalletDeployer](_contract_cache_.wrappercache.md#getmetatransactionwalletdeployer) * [getMultiSig](_contract_cache_.wrappercache.md#getmultisig) * [getReserve](_contract_cache_.wrappercache.md#getreserve) * [getSortedOracles](_contract_cache_.wrappercache.md#getsortedoracles) @@ -304,37 +302,6 @@ ___ ___ -### getMetaTransactionWallet - -▸ **getMetaTransactionWallet**(`address`: string): *Promise‹[MetaTransactionWalletWrapper](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md)‹››* - -*Defined in [packages/sdk/contractkit/src/contract-cache.ts:184](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L184)* - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | string | - -**Returns:** *Promise‹[MetaTransactionWalletWrapper](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md)‹››* - -___ - -### getMetaTransactionWalletDeployer - -▸ **getMetaTransactionWalletDeployer**(`address`: string): *Promise‹[MetaTransactionWalletDeployerWrapper](_wrappers_metatransactionwalletdeployer_.metatransactionwalletdeployerwrapper.md)‹››* - -*Defined in [packages/sdk/contractkit/src/contract-cache.ts:187](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L187)* - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | string | - -**Returns:** *Promise‹[MetaTransactionWalletDeployerWrapper](_wrappers_metatransactionwalletdeployer_.metatransactionwalletdeployerwrapper.md)‹››* - -___ ### getMultiSig diff --git a/packages/docs/sdk/docs/contractkit/classes/_web3_contract_cache_.web3contractcache.md b/packages/docs/sdk/docs/contractkit/classes/_web3_contract_cache_.web3contractcache.md index ff6717833..4bf5c3453 100644 --- a/packages/docs/sdk/docs/contractkit/classes/_web3_contract_cache_.web3contractcache.md +++ b/packages/docs/sdk/docs/contractkit/classes/_web3_contract_cache_.web3contractcache.md @@ -43,8 +43,6 @@ a contract wrapper * [getGovernance](_web3_contract_cache_.web3contractcache.md#getgovernance) * [getGrandaMento](_web3_contract_cache_.web3contractcache.md#getgrandamento) * [getLockedGold](_web3_contract_cache_.web3contractcache.md#getlockedgold) -* [getMetaTransactionWallet](_web3_contract_cache_.web3contractcache.md#getmetatransactionwallet) -* [getMetaTransactionWalletDeployer](_web3_contract_cache_.web3contractcache.md#getmetatransactionwalletdeployer) * [getMultiSig](_web3_contract_cache_.web3contractcache.md#getmultisig) * [getRandom](_web3_contract_cache_.web3contractcache.md#getrandom) * [getRegistry](_web3_contract_cache_.web3contractcache.md#getregistry) @@ -204,7 +202,7 @@ ___ ### getExchange -▸ **getExchange**(`stableToken`: [StableToken](../enums/_base_.celocontract.md#stabletoken)): *Promise‹Registry‹› | Accounts‹› | Exchange‹› | Ierc20‹› | GoldToken‹› | StableToken‹› | Attestations‹› | BlockchainParameters‹› | DoubleSigningSlasher‹› | DowntimeSlasher‹› | Election‹› | EpochRewards‹› | Escrow‹› | ExchangeEur‹› | ExchangeBrl‹› | FeeCurrencyWhitelist‹› | Freezer‹› | GasPriceMinimum‹› | Governance‹› | GrandaMento‹› | LockedGold‹› | MetaTransactionWallet‹› | MetaTransactionWalletDeployer‹› | MultiSig‹› | Random‹› | Reserve‹› | SortedOracles‹› | TransferWhitelist‹› | Validators‹››* +▸ **getExchange**(`stableToken`: [StableToken](../enums/_base_.celocontract.md#stabletoken)): *Promise‹Registry‹› | Accounts‹› | Exchange‹› | Ierc20‹› | GoldToken‹› | StableToken‹› | Attestations‹› | BlockchainParameters‹› | DoubleSigningSlasher‹› | DowntimeSlasher‹› | Election‹› | EpochRewards‹› | Escrow‹› | ExchangeEur‹› | ExchangeBrl‹› | FeeCurrencyWhitelist‹› | Freezer‹› | GasPriceMinimum‹› | Governance‹› | GrandaMento‹› | LockedGold‹› | MultiSig‹› | Random‹› | Reserve‹› | SortedOracles‹› | TransferWhitelist‹› | Validators‹››* *Defined in [packages/sdk/contractkit/src/web3-contract-cache.ts:126](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/web3-contract-cache.ts#L126)* @@ -214,7 +212,7 @@ Name | Type | Default | ------ | ------ | ------ | `stableToken` | [StableToken](../enums/_base_.celocontract.md#stabletoken) | StableToken.cUSD | -**Returns:** *Promise‹Registry‹› | Accounts‹› | Exchange‹› | Ierc20‹› | GoldToken‹› | StableToken‹› | Attestations‹› | BlockchainParameters‹› | DoubleSigningSlasher‹› | DowntimeSlasher‹› | Election‹› | EpochRewards‹› | Escrow‹› | ExchangeEur‹› | ExchangeBrl‹› | FeeCurrencyWhitelist‹› | Freezer‹› | GasPriceMinimum‹› | Governance‹› | GrandaMento‹› | LockedGold‹› | MetaTransactionWallet‹› | MetaTransactionWalletDeployer‹› | MultiSig‹› | Random‹› | Reserve‹› | SortedOracles‹› | TransferWhitelist‹› | Validators‹››* +**Returns:** *Promise‹Registry‹› | Accounts‹› | Exchange‹› | Ierc20‹› | GoldToken‹› | StableToken‹› | Attestations‹› | BlockchainParameters‹› | DoubleSigningSlasher‹› | DowntimeSlasher‹› | Election‹› | EpochRewards‹› | Escrow‹› | ExchangeEur‹› | ExchangeBrl‹› | FeeCurrencyWhitelist‹› | Freezer‹› | GasPriceMinimum‹› | Governance‹› | GrandaMento‹› | LockedGold‹› | MultiSig‹› | Random‹› | Reserve‹› | SortedOracles‹› | TransferWhitelist‹› | Validators‹››* ___ @@ -288,36 +286,6 @@ ___ ___ -### getMetaTransactionWallet - -▸ **getMetaTransactionWallet**(`address`: string): *Promise‹MetaTransactionWallet‹››* - -*Defined in [packages/sdk/contractkit/src/web3-contract-cache.ts:150](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/web3-contract-cache.ts#L150)* - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | string | - -**Returns:** *Promise‹MetaTransactionWallet‹››* - -___ - -### getMetaTransactionWalletDeployer - -▸ **getMetaTransactionWalletDeployer**(`address`: string): *Promise‹MetaTransactionWalletDeployer‹››* - -*Defined in [packages/sdk/contractkit/src/web3-contract-cache.ts:153](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/web3-contract-cache.ts#L153)* - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | string | - -**Returns:** *Promise‹MetaTransactionWalletDeployer‹››* - ___ ### getMultiSig @@ -378,7 +346,7 @@ ___ ### getStableToken -▸ **getStableToken**(`stableToken`: [StableToken](../enums/_base_.celocontract.md#stabletoken)): *Promise‹Registry‹› | Accounts‹› | Exchange‹› | Ierc20‹› | GoldToken‹› | StableToken‹› | Attestations‹› | BlockchainParameters‹› | DoubleSigningSlasher‹› | DowntimeSlasher‹› | Election‹› | EpochRewards‹› | Escrow‹› | ExchangeEur‹› | ExchangeBrl‹› | FeeCurrencyWhitelist‹› | Freezer‹› | GasPriceMinimum‹› | Governance‹› | GrandaMento‹› | LockedGold‹› | MetaTransactionWallet‹› | MetaTransactionWalletDeployer‹› | MultiSig‹› | Random‹› | Reserve‹› | SortedOracles‹› | TransferWhitelist‹› | Validators‹››* +▸ **getStableToken**(`stableToken`: [StableToken](../enums/_base_.celocontract.md#stabletoken)): *Promise‹Registry‹› | Accounts‹› | Exchange‹› | Ierc20‹› | GoldToken‹› | StableToken‹› | Attestations‹› | BlockchainParameters‹› | DoubleSigningSlasher‹› | DowntimeSlasher‹› | Election‹› | EpochRewards‹› | Escrow‹› | ExchangeEur‹› | ExchangeBrl‹› | FeeCurrencyWhitelist‹› | Freezer‹› | GasPriceMinimum‹› | Governance‹› | GrandaMento‹› | LockedGold‹› | MultiSig‹› | Random‹› | Reserve‹› | SortedOracles‹› | TransferWhitelist‹› | Validators‹››* *Defined in [packages/sdk/contractkit/src/web3-contract-cache.ts:171](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/web3-contract-cache.ts#L171)* @@ -388,7 +356,7 @@ Name | Type | Default | ------ | ------ | ------ | `stableToken` | [StableToken](../enums/_base_.celocontract.md#stabletoken) | StableToken.cUSD | -**Returns:** *Promise‹Registry‹› | Accounts‹› | Exchange‹› | Ierc20‹› | GoldToken‹› | StableToken‹› | Attestations‹› | BlockchainParameters‹› | DoubleSigningSlasher‹› | DowntimeSlasher‹› | Election‹› | EpochRewards‹› | Escrow‹› | ExchangeEur‹› | ExchangeBrl‹› | FeeCurrencyWhitelist‹› | Freezer‹› | GasPriceMinimum‹› | Governance‹› | GrandaMento‹› | LockedGold‹› | MetaTransactionWallet‹› | MetaTransactionWalletDeployer‹› | MultiSig‹› | Random‹› | Reserve‹› | SortedOracles‹› | TransferWhitelist‹› | Validators‹››* +**Returns:** *Promise‹Registry‹› | Accounts‹› | Exchange‹› | Ierc20‹› | GoldToken‹› | StableToken‹› | Attestations‹› | BlockchainParameters‹› | DoubleSigningSlasher‹› | DowntimeSlasher‹› | Election‹› | EpochRewards‹› | Escrow‹› | ExchangeEur‹› | ExchangeBrl‹› | FeeCurrencyWhitelist‹› | Freezer‹› | GasPriceMinimum‹› | Governance‹› | GrandaMento‹› | LockedGold‹› | MultiSig‹› | Random‹› | Reserve‹› | SortedOracles‹› | TransferWhitelist‹› | Validators‹››* ___ diff --git a/packages/docs/sdk/docs/contractkit/classes/_wrappers_basewrapper_.basewrapper.md b/packages/docs/sdk/docs/contractkit/classes/_wrappers_basewrapper_.basewrapper.md index c3181f503..3e576e74c 100644 --- a/packages/docs/sdk/docs/contractkit/classes/_wrappers_basewrapper_.basewrapper.md +++ b/packages/docs/sdk/docs/contractkit/classes/_wrappers_basewrapper_.basewrapper.md @@ -40,9 +40,6 @@ ↳ [FreezerWrapper](_wrappers_freezer_.freezerwrapper.md) - ↳ [MetaTransactionWalletWrapper](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md) - - ↳ [MetaTransactionWalletDeployerWrapper](_wrappers_metatransactionwalletdeployer_.metatransactionwalletdeployerwrapper.md) ## Index diff --git a/packages/docs/sdk/docs/contractkit/classes/_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md b/packages/docs/sdk/docs/contractkit/classes/_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md deleted file mode 100644 index c43c190f2..000000000 --- a/packages/docs/sdk/docs/contractkit/classes/_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md +++ /dev/null @@ -1,446 +0,0 @@ -[@celo/contractkit](../README.md) › [Globals](../globals.md) › ["wrappers/MetaTransactionWallet"](../modules/_wrappers_metatransactionwallet_.md) › [MetaTransactionWalletWrapper](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md) - -# Class: MetaTransactionWalletWrapper - -Class that wraps the MetaTransactionWallet - -## Hierarchy - -* [BaseWrapper](_wrappers_basewrapper_.basewrapper.md)‹MetaTransactionWallet› - - ↳ **MetaTransactionWalletWrapper** - -## Index - -### Constructors - -* [constructor](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#constructor) - -### Properties - -* [_chainId](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#optional-_chainid) -* [_signer](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#optional-_signer) -* [eip712DomainSeparator](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#eip712domainseparator) -* [eventTypes](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#eventtypes) -* [events](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#events) -* [getMetaTransactionDigest](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#getmetatransactiondigest) -* [getMetaTransactionSigner](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#getmetatransactionsigner) -* [isOwner](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#isowner) -* [methodIds](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#methodids) -* [nonce](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#nonce) -* [setEip712DomainSeparator](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#seteip712domainseparator) -* [setSigner](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#setsigner) -* [transferOwnership](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#transferownership) - -### Accessors - -* [address](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#address) - -### Methods - -* [executeMetaTransaction](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#executemetatransaction) -* [executeTransaction](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#executetransaction) -* [executeTransactions](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#executetransactions) -* [getPastEvents](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#getpastevents) -* [signAndExecuteMetaTransaction](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#signandexecutemetatransaction) -* [signMetaTransaction](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#signmetatransaction) -* [signer](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#signer) -* [version](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#version) - -## Constructors - -### constructor - -\+ **new MetaTransactionWalletWrapper**(`connection`: Connection, `contract`: MetaTransactionWallet): *[MetaTransactionWalletWrapper](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md)* - -*Inherited from [BaseWrapper](_wrappers_basewrapper_.basewrapper.md).[constructor](_wrappers_basewrapper_.basewrapper.md#constructor)* - -*Defined in [packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:32](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/BaseWrapper.ts#L32)* - -**Parameters:** - -Name | Type | ------- | ------ | -`connection` | Connection | -`contract` | MetaTransactionWallet | - -**Returns:** *[MetaTransactionWalletWrapper](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md)* - -## Properties - -### `Optional` _chainId - -• **_chainId**? : *undefined | number* - -*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:179](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L179)* - -Get and cache the chain ID -- assume it's static for a kit instance - -**`returns`** chainId - -___ - -### `Optional` _signer - -• **_signer**? : *Address* - -*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:192](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L192)* - -Get an cache the signer - it should be static for a Wallet instance - -**`returns`** signer - -___ - -### eip712DomainSeparator - -• **eip712DomainSeparator**: *function* = proxyCall(this.contract.methods.eip712DomainSeparator) - -*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:155](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L155)* - -#### Type declaration: - -▸ (...`args`: InputArgs): *Promise‹Output›* - -**Parameters:** - -Name | Type | ------- | ------ | -`...args` | InputArgs | - -___ - -### eventTypes - -• **eventTypes**: *EventsEnum‹T›* = Object.keys(this.events).reduce>( - (acc, key) => ({ ...acc, [key]: key }), - {} as any - ) - -*Inherited from [BaseWrapper](_wrappers_basewrapper_.basewrapper.md).[eventTypes](_wrappers_basewrapper_.basewrapper.md#eventtypes)* - -*Defined in [packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:63](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/BaseWrapper.ts#L63)* - -___ - -### events - -• **events**: *MetaTransactionWallet["events"]* = this.contract.events - -*Inherited from [BaseWrapper](_wrappers_basewrapper_.basewrapper.md).[events](_wrappers_basewrapper_.basewrapper.md#events)* - -*Defined in [packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:61](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/BaseWrapper.ts#L61)* - -___ - -### getMetaTransactionDigest - -• **getMetaTransactionDigest**: *function* = proxyCall( - this.contract.methods.getMetaTransactionDigest, - this.getMetaTransactionDigestParams, - stringIdentity - ) - -*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:127](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L127)* - -#### Type declaration: - -▸ (...`args`: InputArgs): *Promise‹Output›* - -**Parameters:** - -Name | Type | ------- | ------ | -`...args` | InputArgs | - -___ - -### getMetaTransactionSigner - -• **getMetaTransactionSigner**: *function* = proxyCall( - this.contract.methods.getMetaTransactionSigner, - this.getMetaTransactionSignerParams, - stringIdentity - ) - -*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:149](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L149)* - -#### Type declaration: - -▸ (...`args`: InputArgs): *Promise‹Output›* - -**Parameters:** - -Name | Type | ------- | ------ | -`...args` | InputArgs | - -___ - -### isOwner - -• **isOwner**: *function* = proxyCall(this.contract.methods.isOwner) - -*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:156](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L156)* - -#### Type declaration: - -▸ (...`args`: InputArgs): *Promise‹Output›* - -**Parameters:** - -Name | Type | ------- | ------ | -`...args` | InputArgs | - -___ - -### methodIds - -• **methodIds**: *Record‹keyof T["methods"], string›* = Object.keys(this.contract.methods).reduce, string>>( - (acc, method: Methods) => { - const methodABI = this.contract.options.jsonInterface.find((item) => item.name === method) - - acc[method] = - methodABI === undefined - ? '0x' - : this.connection.getAbiCoder().encodeFunctionSignature(methodABI) - - return acc - }, - {} as any - ) - -*Inherited from [BaseWrapper](_wrappers_basewrapper_.basewrapper.md).[methodIds](_wrappers_basewrapper_.basewrapper.md#methodids)* - -*Defined in [packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:68](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/BaseWrapper.ts#L68)* - -___ - -### nonce - -• **nonce**: *function* = proxyCall(this.contract.methods.nonce, undefined, valueToInt) - -*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:157](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L157)* - -#### Type declaration: - -▸ (...`args`: InputArgs): *Promise‹Output›* - -**Parameters:** - -Name | Type | ------- | ------ | -`...args` | InputArgs | - -___ - -### setEip712DomainSeparator - -• **setEip712DomainSeparator**: *function* = proxySend( - this.connection, - this.contract.methods.setEip712DomainSeparator - ) - -*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:170](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L170)* - -#### Type declaration: - -▸ (): *CeloTransactionObject‹void›* - -___ - -### setSigner - -• **setSigner**: *function* = proxySend( - this.connection, - this.contract.methods.setSigner - ) - -*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:165](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L165)* - -#### Type declaration: - -▸ (`newSigner`: Address): *CeloTransactionObject‹void›* - -**Parameters:** - -Name | Type | ------- | ------ | -`newSigner` | Address | - -___ - -### transferOwnership - -• **transferOwnership**: *function* = proxySend( - this.connection, - this.contract.methods.transferOwnership - ) - -*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:160](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L160)* - -#### Type declaration: - -▸ (`newOwner`: Address): *CeloTransactionObject‹void›* - -**Parameters:** - -Name | Type | ------- | ------ | -`newOwner` | Address | - -## Accessors - -### address - -• **get address**(): *string* - -*Inherited from [BaseWrapper](_wrappers_basewrapper_.basewrapper.md).[address](_wrappers_basewrapper_.basewrapper.md#address)* - -*Defined in [packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:37](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/BaseWrapper.ts#L37)* - -Contract address - -**Returns:** *string* - -## Methods - -### executeMetaTransaction - -▸ **executeMetaTransaction**(`tx`: [TransactionInput](../modules/_wrappers_metatransactionwallet_.md#transactioninput)‹any›, `signature`: Signature): *CeloTransactionObject‹string›* - -*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:68](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L68)* - -Execute a signed meta transaction -Reverts if meta-tx signer is not a signer for the wallet - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`tx` | [TransactionInput](../modules/_wrappers_metatransactionwallet_.md#transactioninput)‹any› | a TransactionInput | -`signature` | Signature | a Signature | - -**Returns:** *CeloTransactionObject‹string›* - -___ - -### executeTransaction - -▸ **executeTransaction**(`tx`: [TransactionInput](../modules/_wrappers_metatransactionwallet_.md#transactioninput)‹any›): *CeloTransactionObject‹string›* - -*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:38](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L38)* - -Execute a transaction originating from the MTW -Reverts if the caller is not a signer - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`tx` | [TransactionInput](../modules/_wrappers_metatransactionwallet_.md#transactioninput)‹any› | a TransactionInput | - -**Returns:** *CeloTransactionObject‹string›* - -___ - -### executeTransactions - -▸ **executeTransactions**(`txs`: Array‹[TransactionInput](../modules/_wrappers_metatransactionwallet_.md#transactioninput)‹any››): *CeloTransactionObject‹object›* - -*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:51](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L51)* - -Execute a batch of transactions originating from the MTW -Reverts if the caller is not a signer - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`txs` | Array‹[TransactionInput](../modules/_wrappers_metatransactionwallet_.md#transactioninput)‹any›› | An array of TransactionInput | - -**Returns:** *CeloTransactionObject‹object›* - -___ - -### getPastEvents - -▸ **getPastEvents**(`event`: Events‹MetaTransactionWallet›, `options`: PastEventOptions): *Promise‹EventLog[]›* - -*Inherited from [BaseWrapper](_wrappers_basewrapper_.basewrapper.md).[getPastEvents](_wrappers_basewrapper_.basewrapper.md#getpastevents)* - -*Defined in [packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:57](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/BaseWrapper.ts#L57)* - -Contract getPastEvents - -**Parameters:** - -Name | Type | ------- | ------ | -`event` | Events‹MetaTransactionWallet› | -`options` | PastEventOptions | - -**Returns:** *Promise‹EventLog[]›* - -___ - -### signAndExecuteMetaTransaction - -▸ **signAndExecuteMetaTransaction**(`tx`: [TransactionInput](../modules/_wrappers_metatransactionwallet_.md#transactioninput)‹any›): *Promise‹CeloTransactionObject‹string››* - -*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:112](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L112)* - -Execute a signed meta transaction -Reverts if meta-tx signer is not a signer for the wallet - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`tx` | [TransactionInput](../modules/_wrappers_metatransactionwallet_.md#transactioninput)‹any› | a TransactionInput | - -**Returns:** *Promise‹CeloTransactionObject‹string››* - -___ - -### signMetaTransaction - -▸ **signMetaTransaction**(`tx`: [TransactionInput](../modules/_wrappers_metatransactionwallet_.md#transactioninput)‹any›, `nonce?`: undefined | number): *Promise‹Signature›* - -*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:93](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L93)* - -Signs a meta transaction as EIP712 typed data - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`tx` | [TransactionInput](../modules/_wrappers_metatransactionwallet_.md#transactioninput)‹any› | a TransactionWrapper | -`nonce?` | undefined | number | Optional -- will query contract state if not passed | - -**Returns:** *Promise‹Signature›* - -signature a Signature - -___ - -### signer - -▸ **signer**(): *Promise‹string›* - -*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:193](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L193)* - -**Returns:** *Promise‹string›* - -___ - -### version - -▸ **version**(): *Promise‹NonNullable‹T["methods"] extends object ? ContractVersion<> : never››* - -*Inherited from [BaseWrapper](_wrappers_basewrapper_.basewrapper.md).[version](_wrappers_basewrapper_.basewrapper.md#version)* - -*Defined in [packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:41](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/BaseWrapper.ts#L41)* - -**Returns:** *Promise‹NonNullable‹T["methods"] extends object ? ContractVersion<> : never››* diff --git a/packages/docs/sdk/docs/contractkit/classes/_wrappers_metatransactionwalletdeployer_.metatransactionwalletdeployerwrapper.md b/packages/docs/sdk/docs/contractkit/classes/_wrappers_metatransactionwalletdeployer_.metatransactionwalletdeployerwrapper.md deleted file mode 100644 index 65d6a881e..000000000 --- a/packages/docs/sdk/docs/contractkit/classes/_wrappers_metatransactionwalletdeployer_.metatransactionwalletdeployerwrapper.md +++ /dev/null @@ -1,160 +0,0 @@ -[@celo/contractkit](../README.md) › [Globals](../globals.md) › ["wrappers/MetaTransactionWalletDeployer"](../modules/_wrappers_metatransactionwalletdeployer_.md) › [MetaTransactionWalletDeployerWrapper](_wrappers_metatransactionwalletdeployer_.metatransactionwalletdeployerwrapper.md) - -# Class: MetaTransactionWalletDeployerWrapper - -## Hierarchy - -* [BaseWrapper](_wrappers_basewrapper_.basewrapper.md)‹MetaTransactionWalletDeployer› - - ↳ **MetaTransactionWalletDeployerWrapper** - -## Index - -### Constructors - -* [constructor](_wrappers_metatransactionwalletdeployer_.metatransactionwalletdeployerwrapper.md#constructor) - -### Properties - -* [deploy](_wrappers_metatransactionwalletdeployer_.metatransactionwalletdeployerwrapper.md#deploy) -* [eventTypes](_wrappers_metatransactionwalletdeployer_.metatransactionwalletdeployerwrapper.md#eventtypes) -* [events](_wrappers_metatransactionwalletdeployer_.metatransactionwalletdeployerwrapper.md#events) -* [methodIds](_wrappers_metatransactionwalletdeployer_.metatransactionwalletdeployerwrapper.md#methodids) - -### Accessors - -* [address](_wrappers_metatransactionwalletdeployer_.metatransactionwalletdeployerwrapper.md#address) - -### Methods - -* [getPastEvents](_wrappers_metatransactionwalletdeployer_.metatransactionwalletdeployerwrapper.md#getpastevents) -* [version](_wrappers_metatransactionwalletdeployer_.metatransactionwalletdeployerwrapper.md#version) - -## Constructors - -### constructor - -\+ **new MetaTransactionWalletDeployerWrapper**(`connection`: Connection, `contract`: MetaTransactionWalletDeployer): *[MetaTransactionWalletDeployerWrapper](_wrappers_metatransactionwalletdeployer_.metatransactionwalletdeployerwrapper.md)* - -*Inherited from [BaseWrapper](_wrappers_basewrapper_.basewrapper.md).[constructor](_wrappers_basewrapper_.basewrapper.md#constructor)* - -*Defined in [packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:32](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/BaseWrapper.ts#L32)* - -**Parameters:** - -Name | Type | ------- | ------ | -`connection` | Connection | -`contract` | MetaTransactionWalletDeployer | - -**Returns:** *[MetaTransactionWalletDeployerWrapper](_wrappers_metatransactionwalletdeployer_.metatransactionwalletdeployerwrapper.md)* - -## Properties - -### deploy - -• **deploy**: *function* = proxySend(this.connection, this.contract.methods.deploy) - -*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWalletDeployer.ts:5](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWalletDeployer.ts#L5)* - -#### Type declaration: - -▸ (...`args`: InputArgs): *CeloTransactionObject‹Output›* - -**Parameters:** - -Name | Type | ------- | ------ | -`...args` | InputArgs | - -___ - -### eventTypes - -• **eventTypes**: *EventsEnum‹T›* = Object.keys(this.events).reduce>( - (acc, key) => ({ ...acc, [key]: key }), - {} as any - ) - -*Inherited from [BaseWrapper](_wrappers_basewrapper_.basewrapper.md).[eventTypes](_wrappers_basewrapper_.basewrapper.md#eventtypes)* - -*Defined in [packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:63](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/BaseWrapper.ts#L63)* - -___ - -### events - -• **events**: *MetaTransactionWalletDeployer["events"]* = this.contract.events - -*Inherited from [BaseWrapper](_wrappers_basewrapper_.basewrapper.md).[events](_wrappers_basewrapper_.basewrapper.md#events)* - -*Defined in [packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:61](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/BaseWrapper.ts#L61)* - -___ - -### methodIds - -• **methodIds**: *Record‹keyof T["methods"], string›* = Object.keys(this.contract.methods).reduce, string>>( - (acc, method: Methods) => { - const methodABI = this.contract.options.jsonInterface.find((item) => item.name === method) - - acc[method] = - methodABI === undefined - ? '0x' - : this.connection.getAbiCoder().encodeFunctionSignature(methodABI) - - return acc - }, - {} as any - ) - -*Inherited from [BaseWrapper](_wrappers_basewrapper_.basewrapper.md).[methodIds](_wrappers_basewrapper_.basewrapper.md#methodids)* - -*Defined in [packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:68](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/BaseWrapper.ts#L68)* - -## Accessors - -### address - -• **get address**(): *string* - -*Inherited from [BaseWrapper](_wrappers_basewrapper_.basewrapper.md).[address](_wrappers_basewrapper_.basewrapper.md#address)* - -*Defined in [packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:37](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/BaseWrapper.ts#L37)* - -Contract address - -**Returns:** *string* - -## Methods - -### getPastEvents - -▸ **getPastEvents**(`event`: Events‹MetaTransactionWalletDeployer›, `options`: PastEventOptions): *Promise‹EventLog[]›* - -*Inherited from [BaseWrapper](_wrappers_basewrapper_.basewrapper.md).[getPastEvents](_wrappers_basewrapper_.basewrapper.md#getpastevents)* - -*Defined in [packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:57](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/BaseWrapper.ts#L57)* - -Contract getPastEvents - -**Parameters:** - -Name | Type | ------- | ------ | -`event` | Events‹MetaTransactionWalletDeployer› | -`options` | PastEventOptions | - -**Returns:** *Promise‹EventLog[]›* - -___ - -### version - -▸ **version**(): *Promise‹NonNullable‹T["methods"] extends object ? ContractVersion<> : never››* - -*Inherited from [BaseWrapper](_wrappers_basewrapper_.basewrapper.md).[version](_wrappers_basewrapper_.basewrapper.md#version)* - -*Defined in [packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:41](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/BaseWrapper.ts#L41)* - -**Returns:** *Promise‹NonNullable‹T["methods"] extends object ? ContractVersion<> : never››* diff --git a/packages/docs/sdk/docs/contractkit/globals.md b/packages/docs/sdk/docs/contractkit/globals.md index 02977b1f7..1cb84f077 100644 --- a/packages/docs/sdk/docs/contractkit/globals.md +++ b/packages/docs/sdk/docs/contractkit/globals.md @@ -50,8 +50,6 @@ * ["wrappers/Governance"](modules/_wrappers_governance_.md) * ["wrappers/GrandaMento"](modules/_wrappers_grandamento_.md) * ["wrappers/LockedGold"](modules/_wrappers_lockedgold_.md) -* ["wrappers/MetaTransactionWallet"](modules/_wrappers_metatransactionwallet_.md) -* ["wrappers/MetaTransactionWalletDeployer"](modules/_wrappers_metatransactionwalletdeployer_.md) * ["wrappers/MultiSig"](modules/_wrappers_multisig_.md) * ["wrappers/ReleaseGold"](modules/_wrappers_releasegold_.md) * ["wrappers/Reserve"](modules/_wrappers_reserve_.md) diff --git a/packages/docs/sdk/docs/contractkit/modules/_web3_contract_cache_.md b/packages/docs/sdk/docs/contractkit/modules/_web3_contract_cache_.md index d1a27945c..843bd914f 100644 --- a/packages/docs/sdk/docs/contractkit/modules/_web3_contract_cache_.md +++ b/packages/docs/sdk/docs/contractkit/modules/_web3_contract_cache_.md @@ -146,18 +146,6 @@ *Defined in [packages/sdk/contractkit/src/web3-contract-cache.ts:57](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/web3-contract-cache.ts#L57)* -### [CeloContract.MetaTransactionWalletDeployer] - -• **[CeloContract.MetaTransactionWalletDeployer]**: *newMetaTransactionWalletDeployer* = newMetaTransactionWalletDeployer - -*Defined in [packages/sdk/contractkit/src/web3-contract-cache.ts:59](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/web3-contract-cache.ts#L59)* - -### [CeloContract.MetaTransactionWallet] - -• **[CeloContract.MetaTransactionWallet]**: *newMetaTransactionWallet* = newMetaTransactionWallet - -*Defined in [packages/sdk/contractkit/src/web3-contract-cache.ts:58](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/web3-contract-cache.ts#L58)* - ### [CeloContract.MultiSig] • **[CeloContract.MultiSig]**: *newMultiSig* = newMultiSig diff --git a/packages/docs/sdk/docs/contractkit/modules/_wrappers_metatransactionwallet_.md b/packages/docs/sdk/docs/contractkit/modules/_wrappers_metatransactionwallet_.md deleted file mode 100644 index bca62b0e8..000000000 --- a/packages/docs/sdk/docs/contractkit/modules/_wrappers_metatransactionwallet_.md +++ /dev/null @@ -1,117 +0,0 @@ -[@celo/contractkit](../README.md) › [Globals](../globals.md) › ["wrappers/MetaTransactionWallet"](_wrappers_metatransactionwallet_.md) - -# Module: "wrappers/MetaTransactionWallet" - -## Index - -### Classes - -* [MetaTransactionWalletWrapper](../classes/_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md) - -### Interfaces - -* [RawTransaction](../interfaces/_wrappers_metatransactionwallet_.rawtransaction.md) -* [TransactionObjectWithValue](../interfaces/_wrappers_metatransactionwallet_.transactionobjectwithvalue.md) - -### Type aliases - -* [MetaTransactionWalletWrapperType](_wrappers_metatransactionwallet_.md#metatransactionwalletwrappertype) -* [TransactionInput](_wrappers_metatransactionwallet_.md#transactioninput) - -### Functions - -* [buildMetaTxTypedData](_wrappers_metatransactionwallet_.md#const-buildmetatxtypeddata) -* [toRawTransaction](_wrappers_metatransactionwallet_.md#const-torawtransaction) -* [toTransactionBatch](_wrappers_metatransactionwallet_.md#const-totransactionbatch) - -## Type aliases - -### MetaTransactionWalletWrapperType - -Ƭ **MetaTransactionWalletWrapperType**: *[MetaTransactionWalletWrapper](../classes/_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md)* - -*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:201](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L201)* - -___ - -### TransactionInput - -Ƭ **TransactionInput**: *CeloTxObject‹T› | [TransactionObjectWithValue](../interfaces/_wrappers_metatransactionwallet_.transactionobjectwithvalue.md)‹T› | [RawTransaction](../interfaces/_wrappers_metatransactionwallet_.rawtransaction.md)* - -*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:27](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L27)* - -## Functions - -### `Const` buildMetaTxTypedData - -▸ **buildMetaTxTypedData**(`walletAddress`: Address, `tx`: [RawTransaction](../interfaces/_wrappers_metatransactionwallet_.rawtransaction.md), `nonce`: number, `chainId`: number): *EIP712TypedData* - -*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:257](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L257)* - -**Parameters:** - -Name | Type | ------- | ------ | -`walletAddress` | Address | -`tx` | [RawTransaction](../interfaces/_wrappers_metatransactionwallet_.rawtransaction.md) | -`nonce` | number | -`chainId` | number | - -**Returns:** *EIP712TypedData* - -___ - -### `Const` toRawTransaction - -▸ **toRawTransaction**(`tx`: [TransactionInput](_wrappers_metatransactionwallet_.md#transactioninput)‹any›): *[RawTransaction](../interfaces/_wrappers_metatransactionwallet_.rawtransaction.md)* - -*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:212](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L212)* - -Turns any possible way to pass in a transaction into the raw values -that are actually required. This is used both internally to normalize -ways in which transactions are passed in but also public in order -for one instance of ContractKit to serialize a meta transaction to -send over the wire and be consumed somewhere else. - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`tx` | [TransactionInput](_wrappers_metatransactionwallet_.md#transactioninput)‹any› | TransactionInput union of all the ways we expect transactions | - -**Returns:** *[RawTransaction](../interfaces/_wrappers_metatransactionwallet_.rawtransaction.md)* - -a RawTransactions that's serializable - -___ - -### `Const` toTransactionBatch - -▸ **toTransactionBatch**(`txs`: Array‹[TransactionInput](_wrappers_metatransactionwallet_.md#transactioninput)‹any››): *object* - -*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:240](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L240)* - -Turns an array of transaction inputs into the argument that -need to be passed to the executeTransactions call. -Main transformation is that all the `data` parts of each -transaction in the batch are concatenated and an array -of lengths is constructed. -This is a gas optimisation on the contract. - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`txs` | Array‹[TransactionInput](_wrappers_metatransactionwallet_.md#transactioninput)‹any›› | Array> array of txs | - -**Returns:** *object* - -Params for the executeTransactions method call - -* **callData**: *string* - -* **callDataLengths**: *number[]* - -* **destinations**: *string[]* - -* **values**: *string[]* diff --git a/packages/docs/sdk/docs/contractkit/modules/_wrappers_metatransactionwalletdeployer_.md b/packages/docs/sdk/docs/contractkit/modules/_wrappers_metatransactionwalletdeployer_.md deleted file mode 100644 index b8340fc5d..000000000 --- a/packages/docs/sdk/docs/contractkit/modules/_wrappers_metatransactionwalletdeployer_.md +++ /dev/null @@ -1,21 +0,0 @@ -[@celo/contractkit](../README.md) › [Globals](../globals.md) › ["wrappers/MetaTransactionWalletDeployer"](_wrappers_metatransactionwalletdeployer_.md) - -# Module: "wrappers/MetaTransactionWalletDeployer" - -## Index - -### Classes - -* [MetaTransactionWalletDeployerWrapper](../classes/_wrappers_metatransactionwalletdeployer_.metatransactionwalletdeployerwrapper.md) - -### Type aliases - -* [MetaTransactionWalletDeployerWrapperType](_wrappers_metatransactionwalletdeployer_.md#metatransactionwalletdeployerwrappertype) - -## Type aliases - -### MetaTransactionWalletDeployerWrapperType - -Ƭ **MetaTransactionWalletDeployerWrapperType**: *[MetaTransactionWalletDeployerWrapper](../classes/_wrappers_metatransactionwalletdeployer_.metatransactionwalletdeployerwrapper.md)* - -*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWalletDeployer.ts:8](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWalletDeployer.ts#L8)* diff --git a/packages/sdk/contractkit/README.md b/packages/sdk/contractkit/README.md index e18079e1c..9501b2959 100644 --- a/packages/sdk/contractkit/README.md +++ b/packages/sdk/contractkit/README.md @@ -152,8 +152,6 @@ There are many core contracts. - GovernanceWrapper - GrandaMentoWrapper - LockedGoldWrapper -- MetaTransactionWalletWrapper -- MetaTransactionWalletDeployerWrapper - MultiSigWrapper - ReserveWrapper - SortedOraclesWrapper diff --git a/packages/sdk/contractkit/src/base.ts b/packages/sdk/contractkit/src/base.ts index ff93fe7b8..72847915d 100644 --- a/packages/sdk/contractkit/src/base.ts +++ b/packages/sdk/contractkit/src/base.ts @@ -22,8 +22,6 @@ export enum CeloContract { LockedGold = 'LockedGold', MentoFeeHandlerSeller = 'MentoFeeHandlerSeller', UniswapFeeHandlerSeller = 'UniswapFeeHandlerSeller', - MetaTransactionWallet = 'MetaTransactionWallet', - MetaTransactionWalletDeployer = 'MetaTransactionWalletDeployer', MultiSig = 'MultiSig', OdisPayments = 'OdisPayments', Random = 'Random', @@ -54,12 +52,7 @@ export type CeloTokenContract = StableTokenContract | CeloContract.GoldToken export type CeloToken = CeloTokenContract export const AllContracts = Object.keys(CeloContract) as CeloContract[] -const AuxiliaryContracts = [ - CeloContract.MultiSig, - CeloContract.MetaTransactionWalletDeployer, - CeloContract.MetaTransactionWallet, - CeloContract.ERC20, -] +const AuxiliaryContracts = [CeloContract.MultiSig, CeloContract.ERC20] export const RegisteredContracts = AllContracts.filter((v) => !AuxiliaryContracts.includes(v)) /** @internal */ diff --git a/packages/sdk/contractkit/src/contract-cache.ts b/packages/sdk/contractkit/src/contract-cache.ts index ff7e033e6..f3f889546 100644 --- a/packages/sdk/contractkit/src/contract-cache.ts +++ b/packages/sdk/contractkit/src/contract-cache.ts @@ -22,8 +22,6 @@ import { GoldTokenWrapper } from './wrappers/GoldTokenWrapper' import { GovernanceWrapper } from './wrappers/Governance' import { GrandaMentoWrapper } from './wrappers/GrandaMento' import { LockedGoldWrapper } from './wrappers/LockedGold' -import { MetaTransactionWalletWrapper } from './wrappers/MetaTransactionWallet' -import { MetaTransactionWalletDeployerWrapper } from './wrappers/MetaTransactionWalletDeployer' import { MultiSigWrapper } from './wrappers/MultiSig' import { OdisPaymentsWrapper } from './wrappers/OdisPayments' import { ReserveWrapper } from './wrappers/Reserve' @@ -48,8 +46,6 @@ const WrapperFactories = { [CeloContract.GrandaMento]: GrandaMentoWrapper, // [CeloContract.Random]: RandomWrapper, // [CeloContract.Registry]: RegistryWrapper, - [CeloContract.MetaTransactionWallet]: MetaTransactionWalletWrapper, - [CeloContract.MetaTransactionWalletDeployer]: MetaTransactionWalletDeployerWrapper, [CeloContract.MultiSig]: MultiSigWrapper, [CeloContract.OdisPayments]: OdisPaymentsWrapper, [CeloContract.Reserve]: ReserveWrapper, @@ -103,8 +99,6 @@ interface WrapperCacheMap { [CeloContract.Governance]?: GovernanceWrapper [CeloContract.GrandaMento]?: GrandaMentoWrapper [CeloContract.LockedGold]?: LockedGoldWrapper - [CeloContract.MetaTransactionWallet]?: MetaTransactionWalletWrapper - [CeloContract.MetaTransactionWalletDeployer]?: MetaTransactionWalletDeployerWrapper [CeloContract.MultiSig]?: MultiSigWrapper [CeloContract.OdisPayments]?: OdisPaymentsWrapper // [CeloContract.Random]?: RandomWrapper, @@ -187,18 +181,6 @@ export class WrapperCache implements ContractCacheType { getLockedGold() { return this.getContract(CeloContract.LockedGold) } - /* - @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 - */ - getMetaTransactionWallet(address: string) { - return this.getContract(CeloContract.MetaTransactionWallet, address) - } - /* - @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 - */ - getMetaTransactionWalletDeployer(address: string) { - return this.getContract(CeloContract.MetaTransactionWalletDeployer, address) - } getMultiSig(address: string) { return this.getContract(CeloContract.MultiSig, address) } diff --git a/packages/sdk/contractkit/src/proxy.ts b/packages/sdk/contractkit/src/proxy.ts index 6c57ec4ad..3373654df 100644 --- a/packages/sdk/contractkit/src/proxy.ts +++ b/packages/sdk/contractkit/src/proxy.ts @@ -18,8 +18,6 @@ import { ABI as GoldTokenABI } from '@celo/abis/web3/GoldToken' import { ABI as GovernanceABI } from '@celo/abis/web3/Governance' import { ABI as LockedGoldABI } from '@celo/abis/web3/LockedGold' import { ABI as MentoFeeHandlerSellerABI } from '@celo/abis/web3/MentoFeeHandlerSeller' -import { ABI as MetaTransactionWalletABI } from '@celo/abis/web3/MetaTransactionWallet' -import { ABI as MetaTransactionWalletDeployerABI } from '@celo/abis/web3/MetaTransactionWalletDeployer' import { ABI as MultiSigABI } from '@celo/abis/web3/MultiSig' import { ABI as OdisPaymentsABI } from '@celo/abis/web3/OdisPayments' import { ABI as ProxyABI } from '@celo/abis/web3/Proxy' @@ -120,8 +118,6 @@ const initializeAbiMap = { GovernanceProxy: findInitializeAbi(GovernanceABI), GrandaMentoProxy: findInitializeAbi(GrandaMentoABI), LockedGoldProxy: findInitializeAbi(LockedGoldABI), - MetaTransactionWalletProxy: findInitializeAbi(MetaTransactionWalletABI), - MetaTransactionWalletDeployerProxy: findInitializeAbi(MetaTransactionWalletDeployerABI), MultiSigProxy: findInitializeAbi(MultiSigABI), OdisPaymentsProxy: findInitializeAbi(OdisPaymentsABI), ProxyProxy: findInitializeAbi(ProxyABI), diff --git a/packages/sdk/contractkit/src/web3-contract-cache.ts b/packages/sdk/contractkit/src/web3-contract-cache.ts index c3e31b365..f8ed75c3e 100644 --- a/packages/sdk/contractkit/src/web3-contract-cache.ts +++ b/packages/sdk/contractkit/src/web3-contract-cache.ts @@ -20,8 +20,6 @@ import { newGoldToken } from '@celo/abis/web3/GoldToken' import { newGovernance } from '@celo/abis/web3/Governance' import { newIERC20 } from '@celo/abis/web3/IERC20' import { newLockedGold } from '@celo/abis/web3/LockedGold' -import { newMetaTransactionWallet } from '@celo/abis/web3/MetaTransactionWallet' -import { newMetaTransactionWalletDeployer } from '@celo/abis/web3/MetaTransactionWalletDeployer' import { newMultiSig } from '@celo/abis/web3/MultiSig' import { newOdisPayments } from '@celo/abis/web3/OdisPayments' import { newProxy } from '@celo/abis/web3/Proxy' @@ -65,8 +63,6 @@ export const ContractFactories = { [CeloContract.Governance]: newGovernance, [CeloContract.GrandaMento]: newGrandaMento, [CeloContract.LockedGold]: newLockedGold, - [CeloContract.MetaTransactionWallet]: newMetaTransactionWallet, - [CeloContract.MetaTransactionWalletDeployer]: newMetaTransactionWalletDeployer, [CeloContract.MultiSig]: newMultiSig, [CeloContract.OdisPayments]: newOdisPayments, [CeloContract.Random]: newRandom, @@ -163,18 +159,6 @@ export class Web3ContractCache { getLockedGold() { return this.getContract(CeloContract.LockedGold) } - /* - @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 - */ - getMetaTransactionWallet(address: string) { - return this.getContract(CeloContract.MetaTransactionWallet, address) - } - /* - @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 - */ - getMetaTransactionWalletDeployer(address: string) { - return this.getContract(CeloContract.MetaTransactionWalletDeployer, address) - } getMultiSig(address: string) { return this.getContract(CeloContract.MultiSig, address) } diff --git a/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.test.ts b/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.test.ts deleted file mode 100644 index a231d601e..000000000 --- a/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.test.ts +++ /dev/null @@ -1,266 +0,0 @@ -import { Address } from '@celo/base/lib/address' -import { Signature } from '@celo/base/lib/signatureUtils' -import MTWContractArtifacts from '@celo/celo-devchain/contracts/contracts-0.5/MetaTransactionWallet.json' -import { testWithGanache } from '@celo/dev-utils/lib/ganache-test' -import { generateTypedDataHash } from '@celo/utils/lib/sign-typed-data-utils' -import { bufferToHex } from '@ethereumjs/util' -import BigNumber from 'bignumber.js' -import { newKitFromWeb3 } from '../kit' -import { GoldTokenWrapper } from './GoldTokenWrapper' -import { - buildMetaTxTypedData, - MetaTransactionWalletWrapper, - RawTransaction, - toRawTransaction, -} from './MetaTransactionWallet' - -const contract = require('@truffle/contract') -const MetaTransactionWallet = contract(MTWContractArtifacts) - -testWithGanache('MetaTransactionWallet Wrapper', (web3) => { - MetaTransactionWallet.setProvider(web3.currentProvider) - - const deployWallet = async (deployer: Address, signer: Address): Promise
=> { - const instance = await MetaTransactionWallet.new(true, { from: deployer }) - await instance.initialize(signer, { from: deployer }) - return instance.address - } - - // Ganache returns 1 in chainId assembly code - const chainId = 1 - const kit = newKitFromWeb3(web3) - let accounts: Address[] - let walletDeployer: Address - let walletSigner: Address - let wallet: MetaTransactionWalletWrapper - let gold: GoldTokenWrapper - let emptyAccounts: Address[] - let rando: Address - - beforeAll(async () => { - accounts = await web3.eth.getAccounts() - walletDeployer = accounts[0] - walletSigner = accounts[1] - kit.defaultAccount = walletSigner - rando = accounts[2] - gold = await kit.contracts.getGoldToken() - }) - - beforeEach(async () => { - const walletAddress = await deployWallet(walletDeployer, walletSigner) - wallet = await kit.contracts.getMetaTransactionWallet(walletAddress) - // Ganache returns 1 in chainId assembly code - // @ts-ignore - wallet.chainId = () => Promise.resolve(chainId) - - // Give the wallet some funds - await gold.transfer(wallet.address, new BigNumber(20e18).toFixed()).sendAndWaitForReceipt() - emptyAccounts = [0, 0, 0, 0, 0].map(() => web3.utils.randomHex(20)) - }) - - describe('#executeTransaction', () => { - describe('as a rando', () => { - it('reverts', async () => { - expect.assertions(1) - await expect( - wallet - .executeTransaction(gold.transfer(emptyAccounts[0], 10000).txo) - .sendAndWaitForReceipt({ from: rando }) - ).rejects.toThrow(/Invalid transaction sender/) - }) - }) - - describe('as the signer', () => { - it('can call contracts', async () => { - const value = new BigNumber(1e18) - const result = await wallet - .executeTransaction(gold.transfer(emptyAccounts[0], value.toFixed()).txo) - .sendAndWaitForReceipt() - expect(result.status).toBe(true) - expect(await gold.balanceOf(emptyAccounts[0])).toEqual(value) - }) - }) - }) - - describe('#executeTransactions', () => { - describe('as a rando', () => { - it('reverts', async () => { - expect.assertions(1) - await expect( - wallet - .executeTransactions([ - gold.transfer(emptyAccounts[0], 1000).txo, - gold.transfer(emptyAccounts[1], 1000).txo, - ]) - .sendAndWaitForReceipt({ from: rando }) - ).rejects.toThrow(/Invalid transaction sender/) - }) - }) - - describe('as the signer', () => { - it('can execute transactions', async () => { - const walletBalanceBefore = await gold.balanceOf(wallet.address) - const value = new BigNumber(1e18) - const result = await wallet - .executeTransactions([ - gold.transfer(emptyAccounts[0], value.toFixed()).txo, - gold.transfer(emptyAccounts[1], value.toFixed()).txo, - ]) - .sendAndWaitForReceipt() - expect(result.status).toBe(true) - - expect(await gold.balanceOf(wallet.address)).toEqual( - walletBalanceBefore.minus(value.times(2)) - ) - expect(await gold.balanceOf(emptyAccounts[0])).toEqual(value) - expect(await gold.balanceOf(emptyAccounts[1])).toEqual(value) - }) - }) - }) - - describe('#getMetaTransactionDigest', () => { - it('should match the digest created off-chain', async () => { - const metaTransfer = gold.transfer(emptyAccounts[0], 1000).txo - const onChainDigest = await wallet.getMetaTransactionDigest(metaTransfer, 0) - const typedData = buildMetaTxTypedData( - wallet.address, - toRawTransaction(metaTransfer), - 0, - chainId - ) - const offChainDigest = bufferToHex(generateTypedDataHash(typedData)) - - expect(onChainDigest).toEqual(offChainDigest) - }) - }) - - describe('#getMetaTransactionSigner', () => { - it('should match what is signed off-chain', async () => { - const metaTransfer = gold.transfer(emptyAccounts[0], 1000000).txo - const signature = await wallet.signMetaTransaction(metaTransfer, 0) - const signer = await wallet.getMetaTransactionSigner(metaTransfer, 0, signature) - expect(signer).toEqual(walletSigner) - }) - }) - - describe('#signMetaTransaction', () => { - describe('with an unlocked account', () => { - it('returns a signature', async () => { - const signature = await wallet.signMetaTransaction( - gold.transfer(emptyAccounts[0], 1000).txo - ) - expect(signature).toBeDefined() - }) - }) - }) - - describe('#executeMetaTransaction', () => { - describe('as a rando', () => { - it('can execute transactions', async () => { - const walletBalanceBefore = await gold.balanceOf(wallet.address) - const value = new BigNumber(1e18) - - const metaTransfer = gold.transfer(emptyAccounts[0], value.toFixed()).txo - const signature = await wallet.signMetaTransaction(metaTransfer) - - const result = await wallet - .executeMetaTransaction(metaTransfer, signature) - .sendAndWaitForReceipt({ from: rando }) - expect(result.status).toBe(true) - - expect(await gold.balanceOf(emptyAccounts[0])).toEqual(value) - expect(await gold.balanceOf(wallet.address)).toEqual(walletBalanceBefore.minus(value)) - }) - - it('can batch transactions as a call to self', async () => { - const walletBalanceBefore = await gold.balanceOf(wallet.address) - const value = new BigNumber(1e18) - const metaBatch = wallet.executeTransactions([ - gold.transfer(emptyAccounts[0], value.toFixed()).txo, - gold.transfer(emptyAccounts[1], value.toFixed()).txo, - gold.transfer(emptyAccounts[2], value.toFixed()).txo, - ]).txo - - const signature = await wallet.signMetaTransaction(metaBatch, 0) - const result = await wallet - .executeMetaTransaction(metaBatch, signature) - .sendAndWaitForReceipt({ from: rando }) - expect(result.status).toBe(true) - - expect(await gold.balanceOf(wallet.address)).toEqual( - walletBalanceBefore.minus(value.times(3)) - ) - for (let i = 0; i < 3; i++) { - expect(await gold.balanceOf(emptyAccounts[i])).toEqual(value) - } - }) - }) - - describe('when passed over the wire', () => { - it('can hydrate and execute directly', async () => { - const walletBalanceBefore = await gold.balanceOf(wallet.address) - const value = new BigNumber(1e18) - const metaTx = wallet.executeTransactions([ - gold.transfer(emptyAccounts[0], value.toFixed()).txo, - gold.transfer(emptyAccounts[1], value.toFixed()).txo, - gold.transfer(emptyAccounts[2], value.toFixed()).txo, - ]).txo - const signature = await wallet.signMetaTransaction(metaTx, 0) - const rawTx = toRawTransaction(metaTx) - const payload = JSON.stringify({ rawTx, signature }) - // Now we're somewhere else: - const resp: { rawTx: RawTransaction; signature: Signature } = JSON.parse(payload) - const result = await wallet - .executeMetaTransaction(resp.rawTx, resp.signature) - .sendAndWaitForReceipt({ from: rando }) - expect(result.status).toBe(true) - - expect(await gold.balanceOf(wallet.address)).toEqual( - walletBalanceBefore.minus(value.times(3)) - ) - for (let i = 0; i < 3; i++) { - expect(await gold.balanceOf(emptyAccounts[i])).toEqual(value) - } - }) - }) - }) - - describe('#signAndExecuteMetaTransaction', () => { - describe('as a rando', () => { - it('can execute transactions', async () => { - const walletBalanceBefore = await gold.balanceOf(wallet.address) - const value = new BigNumber(1e18) - - const metaTransfer = gold.transfer(emptyAccounts[0], value.toFixed()).txo - const tx = await wallet.signAndExecuteMetaTransaction(metaTransfer) - const result = await tx.sendAndWaitForReceipt({ from: rando }) - expect(result.status).toBe(true) - - expect(await gold.balanceOf(emptyAccounts[0])).toEqual(value) - expect(await gold.balanceOf(wallet.address)).toEqual(walletBalanceBefore.minus(value)) - }) - - it('can batch transactions as a call to self', async () => { - const walletBalanceBefore = await gold.balanceOf(wallet.address) - const value = new BigNumber(1e18) - - const tx = await wallet.signAndExecuteMetaTransaction( - wallet.executeTransactions([ - gold.transfer(emptyAccounts[0], value.toFixed()).txo, - gold.transfer(emptyAccounts[1], value.toFixed()).txo, - gold.transfer(emptyAccounts[2], value.toFixed()).txo, - ]).txo - ) - const result = await tx.sendAndWaitForReceipt({ from: rando }) - expect(result.status).toBe(true) - - expect(await gold.balanceOf(wallet.address)).toEqual( - walletBalanceBefore.minus(value.times(3)) - ) - for (let i = 0; i < 3; i++) { - expect(await gold.balanceOf(emptyAccounts[i])).toEqual(value) - } - }) - }) - }) -}) diff --git a/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts b/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts deleted file mode 100644 index ef148ab07..000000000 --- a/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts +++ /dev/null @@ -1,313 +0,0 @@ -import { MetaTransactionWallet } from '@celo/abis/web3/MetaTransactionWallet' -import { Address, ensureLeading0x, trimLeading0x } from '@celo/base/lib/address' -import { Signature } from '@celo/base/lib/signatureUtils' -import { CeloTransactionObject, CeloTxObject, toTransactionObject } from '@celo/connect' -import { EIP712TypedData } from '@celo/utils/lib/sign-typed-data-utils' -import BigNumber from 'bignumber.js' -import { - BaseWrapper, - proxyCall, - proxySend, - stringIdentity, - valueToInt, - valueToString, -} from './BaseWrapper' - -export interface TransactionObjectWithValue { - txo: CeloTxObject - value: BigNumber.Value -} - -export interface RawTransaction { - destination: string - value: string - data: string -} - -export type TransactionInput = CeloTxObject | TransactionObjectWithValue | RawTransaction - -/** - * Class that wraps the MetaTransactionWallet - * @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 - */ -export class MetaTransactionWalletWrapper extends BaseWrapper { - /** - * Execute a transaction originating from the MTW - * Reverts if the caller is not a signer - * @param tx a TransactionInput - * @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 - */ - public executeTransaction(tx: TransactionInput): CeloTransactionObject { - const rawTx = toRawTransaction(tx) - return toTransactionObject( - this.connection, - this.contract.methods.executeTransaction(rawTx.destination, rawTx.value, rawTx.data) - ) - } - - /** - * Execute a batch of transactions originating from the MTW - * Reverts if the caller is not a signer - * @param txs An array of TransactionInput - * @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 - */ - public executeTransactions( - txs: TransactionInput[] - ): CeloTransactionObject<{ 0: string; 1: string[] }> { - const { destinations, values, callData, callDataLengths } = toTransactionBatch(txs) - - return toTransactionObject( - this.connection, - this.contract.methods.executeTransactions(destinations, values, callData, callDataLengths) - ) - } - - /** - * Execute a signed meta transaction - * Reverts if meta-tx signer is not a signer for the wallet - * @param tx a TransactionInput - * @param signature a Signature - * @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 - */ - public executeMetaTransaction( - tx: TransactionInput, - signature: Signature - ): CeloTransactionObject { - const rawTx = toRawTransaction(tx) - - return toTransactionObject( - this.connection, - this.contract.methods.executeMetaTransaction( - rawTx.destination, - rawTx.value, - rawTx.data, - signature.v, - signature.r, - signature.s - ) - ) - } - - /** - * Signs a meta transaction as EIP712 typed data - * @param tx a TransactionWrapper - * @param nonce Optional -- will query contract state if not passed - * @returns signature a Signature - * @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 - */ - public async signMetaTransaction(tx: TransactionInput, nonce?: number): Promise { - if (nonce === undefined) { - nonce = await this.nonce() - } - const typedData = buildMetaTxTypedData( - this.address, - toRawTransaction(tx), - nonce, - await this.chainId() - ) - const signer = await this.signer() - return this.connection.signTypedData(signer, typedData) - } - - /** - * Execute a signed meta transaction - * Reverts if meta-tx signer is not a signer for the wallet - * @param tx a TransactionInput - * @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 - */ - public async signAndExecuteMetaTransaction( - tx: TransactionInput - ): Promise> { - const signature = await this.signMetaTransaction(tx) - return this.executeMetaTransaction(tx, signature) - } - - private getMetaTransactionDigestParams = ( - tx: TransactionInput, - nonce: number - ): [string, string, string, number] => { - const rawTx = toRawTransaction(tx) - return [rawTx.destination, rawTx.value, rawTx.data, nonce] - } - /* - * @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 - */ - getMetaTransactionDigest = proxyCall( - this.contract.methods.getMetaTransactionDigest, - this.getMetaTransactionDigestParams, - stringIdentity - ) - - private getMetaTransactionSignerParams = ( - tx: TransactionInput, - nonce: number, - signature: Signature - ): [string, string, string, number, number, string, string] => { - const rawTx = toRawTransaction(tx) - return [ - rawTx.destination, - rawTx.value, - rawTx.data, - nonce, - signature.v, - signature.r, - signature.s, - ] - } - /* - * @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 - */ - getMetaTransactionSigner = proxyCall( - this.contract.methods.getMetaTransactionSigner, - this.getMetaTransactionSignerParams, - stringIdentity - ) - /* - * @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 - */ - eip712DomainSeparator = proxyCall(this.contract.methods.eip712DomainSeparator) - /* - * @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 - */ - isOwner = proxyCall(this.contract.methods.isOwner) - /* - * @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 - */ - nonce = proxyCall(this.contract.methods.nonce, undefined, valueToInt) - private getSigner = proxyCall(this.contract.methods.signer, undefined, stringIdentity) - - /* - * @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 - */ - transferOwnership: (newOwner: Address) => CeloTransactionObject = proxySend( - this.connection, - this.contract.methods.transferOwnership - ) - /* - * @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 - */ - setSigner: (newSigner: Address) => CeloTransactionObject = proxySend( - this.connection, - this.contract.methods.setSigner - ) - /* - * @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 - */ - setEip712DomainSeparator: () => CeloTransactionObject = proxySend( - this.connection, - this.contract.methods.setEip712DomainSeparator - ) - - /** - * Get and cache the chain ID -- assume it's static for a kit instance - * @returns chainId - */ - _chainId?: number - private async chainId(): Promise { - this._chainId = this._chainId ?? (await this.connection.chainId()) - if (this._chainId === undefined) { - this._chainId = await this.connection.chainId() - } - return this._chainId! - } - - /** - * Get an cache the signer - it should be static for a Wallet instance - * @returns signer - */ - _signer?: Address - public async signer() { - if (this._signer === undefined) { - this._signer = await this.getSigner() - } - return this._signer - } -} - -export type MetaTransactionWalletWrapperType = MetaTransactionWalletWrapper - -/** - * Turns any possible way to pass in a transaction into the raw values - * that are actually required. This is used both internally to normalize - * ways in which transactions are passed in but also public in order - * for one instance of ContractKit to serialize a meta transaction to - * send over the wire and be consumed somewhere else. - * @param tx TransactionInput union of all the ways we expect transactions - * @returns a RawTransactions that's serializable - */ -export const toRawTransaction = (tx: TransactionInput): RawTransaction => { - if ('destination' in tx) { - return tx - } else if ('value' in tx) { - return { - destination: tx.txo._parent.options.address, - data: tx.txo.encodeABI(), - value: valueToString(tx.value), - } - } else { - return { - destination: tx._parent.options.address, - data: tx.encodeABI(), - value: '0', - } - } -} - -/** - * Turns an array of transaction inputs into the argument that - * need to be passed to the executeTransactions call. - * Main transformation is that all the `data` parts of each - * transaction in the batch are concatenated and an array - * of lengths is constructed. - * This is a gas optimisation on the contract. - * @param txs Array> array of txs - * @returns Params for the executeTransactions method call - */ -export const toTransactionBatch = ( - txs: TransactionInput[] -): { - destinations: string[] - values: string[] - callData: string - callDataLengths: number[] -} => { - const rawTxs: RawTransaction[] = txs.map(toRawTransaction) - return { - destinations: rawTxs.map((rtx) => rtx.destination), - values: rawTxs.map((rtx) => rtx.value), - callData: ensureLeading0x(rawTxs.map((rtx) => trimLeading0x(rtx.data)).join('')), - callDataLengths: rawTxs.map((rtx) => trimLeading0x(rtx.data).length / 2), - } -} - -export const buildMetaTxTypedData = ( - walletAddress: Address, - tx: RawTransaction, - nonce: number, - chainId: number -): EIP712TypedData => { - return { - types: { - EIP712Domain: [ - { name: 'name', type: 'string' }, - { name: 'version', type: 'string' }, - { name: 'chainId', type: 'uint256' }, - { name: 'verifyingContract', type: 'address' }, - ], - ExecuteMetaTransaction: [ - { name: 'destination', type: 'address' }, - { name: 'value', type: 'uint256' }, - { name: 'data', type: 'bytes' }, - { name: 'nonce', type: 'uint256' }, - ], - }, - primaryType: 'ExecuteMetaTransaction', - domain: { - name: 'MetaTransactionWallet', - version: '1.1', - chainId, - verifyingContract: walletAddress, - }, - message: tx ? { ...tx, nonce } : {}, - } -} diff --git a/packages/sdk/contractkit/src/wrappers/MetaTransactionWalletDeployer.test.ts b/packages/sdk/contractkit/src/wrappers/MetaTransactionWalletDeployer.test.ts deleted file mode 100644 index e23271ea4..000000000 --- a/packages/sdk/contractkit/src/wrappers/MetaTransactionWalletDeployer.test.ts +++ /dev/null @@ -1,91 +0,0 @@ -import { Address, normalizeAddress } from '@celo/base' -import MTWContractArtifacts from '@celo/celo-devchain/contracts/contracts-0.5/MetaTransactionWallet.json' -import MTWDeployerContractArtifacts from '@celo/celo-devchain/contracts/contracts-0.5/MetaTransactionWalletDeployer.json' -import { CeloTxReceipt, EventLog } from '@celo/connect' -import { testWithGanache } from '@celo/dev-utils/lib/ganache-test' -import { - MetaTransactionWallet, - newMetaTransactionWallet, -} from '@celo/abis/web3/MetaTransactionWallet' -import { newProxy } from '@celo/abis/web3/Proxy' -import { newKitFromWeb3 } from '../kit' -import { MetaTransactionWalletDeployerWrapper } from './MetaTransactionWalletDeployer' - -const contract = require('@truffle/contract') -const MetaTransactionWalletDeployer = contract(MTWDeployerContractArtifacts) -const MetaTransactionWallet = contract(MTWContractArtifacts) - -testWithGanache('MetaTransactionWallet Wrapper', (web3) => { - MetaTransactionWalletDeployer.setProvider(web3.currentProvider) - MetaTransactionWallet.setProvider(web3.currentProvider) - - const deployImplementation = async (from: Address) => { - const impl = await MetaTransactionWallet.new(true, { from }) - return impl.address - } - - const deployWalletDeployer = async (from: Address): Promise
=> { - const instance = await MetaTransactionWalletDeployer.new({ from }) - return instance.address - } - - const kit = newKitFromWeb3(web3) - let accounts: Address[] - let walletDeployerOwner: Address - let walletDeployer: MetaTransactionWalletDeployerWrapper - let implementation: MetaTransactionWallet - let rando: Address - let beneficiary: Address - - beforeAll(async () => { - accounts = await web3.eth.getAccounts() - walletDeployerOwner = accounts[0] - rando = accounts[1] - kit.defaultAccount = walletDeployerOwner - beneficiary = web3.utils.randomHex(20) - implementation = newMetaTransactionWallet(web3, await deployImplementation(accounts[0])) - }) - - beforeEach(async () => { - const walletDeployerAddress = await deployWalletDeployer(walletDeployerOwner) - walletDeployer = await kit.contracts.getMetaTransactionWalletDeployer(walletDeployerAddress) - }) - - describe('#deploy', () => { - let result: CeloTxReceipt - let walletDeployedEvent: EventLog | undefined - - beforeEach(async () => { - result = await walletDeployer - .deploy( - beneficiary, - implementation.options.address, - implementation.methods.initialize(beneficiary).encodeABI() - ) - .sendAndWaitForReceipt({ - from: rando, - }) - - walletDeployedEvent = result.events?.WalletDeployed - }) - - it('deploys a new contract', async () => { - expect(walletDeployedEvent).toBeDefined() - const values: { owner: string; implementation: string } = walletDeployedEvent?.returnValues - expect(values.owner.toLocaleLowerCase()).toEqual(beneficiary) - expect(values.implementation).toEqual(implementation.options.address) - }) - - it('sets the beneficiary as the signer to the wallet', async () => { - const wallet = newMetaTransactionWallet(web3, walletDeployedEvent?.returnValues.wallet) - const signer = await wallet.methods.signer().call() - expect(signer.toLocaleLowerCase()).toEqual(beneficiary) - }) - - it('sets the right implementation', async () => { - const proxy = newProxy(web3, walletDeployedEvent?.returnValues.wallet) - const impl = await proxy.methods._getImplementation().call() - expect(normalizeAddress(impl)).toEqual(normalizeAddress(implementation.options.address)) - }) - }) -}) diff --git a/packages/sdk/contractkit/src/wrappers/MetaTransactionWalletDeployer.ts b/packages/sdk/contractkit/src/wrappers/MetaTransactionWalletDeployer.ts deleted file mode 100644 index 4cbc46da0..000000000 --- a/packages/sdk/contractkit/src/wrappers/MetaTransactionWalletDeployer.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { MetaTransactionWalletDeployer } from '@celo/abis/web3/MetaTransactionWalletDeployer' -import { BaseWrapper, proxySend } from './BaseWrapper' - -/* - * @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 - */ -export class MetaTransactionWalletDeployerWrapper extends BaseWrapper { - /* - * @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 - */ - deploy = proxySend(this.connection, this.contract.methods.deploy) -} - -export type MetaTransactionWalletDeployerWrapperType = MetaTransactionWalletDeployerWrapper