From 416ed00824866f8fdc9449f396ca956294e4f915 Mon Sep 17 00:00:00 2001 From: Aaron DeRuvo Date: Tue, 1 Oct 2024 14:57:39 +0200 Subject: [PATCH] remove @celo/rpc-wallet (#342) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### Description As described[ in this form post](https://forum.celo.org/t/deprecation-of-celo-wallet-rpc/8452) the @celo/wallet-rpc package is being removed. `personal_` namespace is deprecated in geth. and already not supported in testing environments like anvil. ### Other changes nope ### Tested n/a ### Related issues - Fixes #257 - fixes https://github.com/celo-org/celo-blockchain-planning/issues/431 ### Backwards compatibility nope ### Documentation docs updated --- ## PR-Codex overview This PR focuses on the deletion of various files and directories related to the `wallet-rpc` module in the SDK, indicating a significant removal of components from the project. ### Detailed summary - Deleted the entire `docs/sdk/wallet-rpc` directory, including `README.md` and multiple module documentation files. - Removed the `wallet-rpc` directory from `packages/sdk/wallets`, including its `README.md`, configuration files, and source files. - Eliminated test utility files related to `ganache` in `src/test-utils`. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` --- README.md | 1 - docs/sdk/wallet-rpc/README.md | 13 - .../classes/rpc_signer.RpcSigner.md | 268 ----------- .../classes/rpc_wallet.RpcWallet.md | 448 ------------------ .../enums/rpc_wallet.RpcWalletErrors.md | 32 -- docs/sdk/wallet-rpc/modules/index.md | 29 -- docs/sdk/wallet-rpc/modules/rpc_signer.md | 9 - docs/sdk/wallet-rpc/modules/rpc_wallet.md | 13 - .../modules/test_utils_ganache_setup.md | 23 - .../modules/test_utils_ganache_teardown.md | 23 - packages/sdk/wallets/wallet-rpc/.eslintrc.js | 3 - packages/sdk/wallets/wallet-rpc/.gitignore | 1 - packages/sdk/wallets/wallet-rpc/.npmignore | 24 - packages/sdk/wallets/wallet-rpc/CHANGELOG.md | 197 -------- packages/sdk/wallets/wallet-rpc/README.md | 23 - .../wallets/wallet-rpc/eslint.tsconfig.json | 4 - .../sdk/wallets/wallet-rpc/jest.config.js | 7 - packages/sdk/wallets/wallet-rpc/package.json | 45 -- packages/sdk/wallets/wallet-rpc/src/index.ts | 2 - .../sdk/wallets/wallet-rpc/src/rpc-signer.ts | 178 ------- .../wallets/wallet-rpc/src/rpc-wallet.test.ts | 256 ---------- .../sdk/wallets/wallet-rpc/src/rpc-wallet.ts | 72 --- .../src/test-utils/ganache.setup.ts | 9 - .../src/test-utils/ganache.teardown.ts | 2 - packages/sdk/wallets/wallet-rpc/tsconfig.json | 9 - packages/sdk/wallets/wallet-rpc/typedoc.json | 19 - 26 files changed, 1710 deletions(-) delete mode 100644 docs/sdk/wallet-rpc/README.md delete mode 100644 docs/sdk/wallet-rpc/classes/rpc_signer.RpcSigner.md delete mode 100644 docs/sdk/wallet-rpc/classes/rpc_wallet.RpcWallet.md delete mode 100644 docs/sdk/wallet-rpc/enums/rpc_wallet.RpcWalletErrors.md delete mode 100644 docs/sdk/wallet-rpc/modules/index.md delete mode 100644 docs/sdk/wallet-rpc/modules/rpc_signer.md delete mode 100644 docs/sdk/wallet-rpc/modules/rpc_wallet.md delete mode 100644 docs/sdk/wallet-rpc/modules/test_utils_ganache_setup.md delete mode 100644 docs/sdk/wallet-rpc/modules/test_utils_ganache_teardown.md delete mode 100644 packages/sdk/wallets/wallet-rpc/.eslintrc.js delete mode 100644 packages/sdk/wallets/wallet-rpc/.gitignore delete mode 100644 packages/sdk/wallets/wallet-rpc/.npmignore delete mode 100644 packages/sdk/wallets/wallet-rpc/CHANGELOG.md delete mode 100644 packages/sdk/wallets/wallet-rpc/README.md delete mode 100644 packages/sdk/wallets/wallet-rpc/eslint.tsconfig.json delete mode 100644 packages/sdk/wallets/wallet-rpc/jest.config.js delete mode 100644 packages/sdk/wallets/wallet-rpc/package.json delete mode 100644 packages/sdk/wallets/wallet-rpc/src/index.ts delete mode 100644 packages/sdk/wallets/wallet-rpc/src/rpc-signer.ts delete mode 100644 packages/sdk/wallets/wallet-rpc/src/rpc-wallet.test.ts delete mode 100644 packages/sdk/wallets/wallet-rpc/src/rpc-wallet.ts delete mode 100644 packages/sdk/wallets/wallet-rpc/src/test-utils/ganache.setup.ts delete mode 100644 packages/sdk/wallets/wallet-rpc/src/test-utils/ganache.teardown.ts delete mode 100644 packages/sdk/wallets/wallet-rpc/tsconfig.json delete mode 100644 packages/sdk/wallets/wallet-rpc/typedoc.json diff --git a/README.md b/README.md index 01b7b7934..3ebfc8cdc 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,6 @@ This repository contains source code for: - [`@celo/wallet-ledger`](https://www.npmjs.com/package/@celo/wallet-ledger) - [`@celo/wallet-local`](https://www.npmjs.com/package/@celo/wallet-local) - [`@celo/wallet-remote`](https://www.npmjs.com/package/@celo/wallet-remote) - - [`@celo/wallet-rpc`](https://www.npmjs.com/package/@celo/wallet-rpc) ## Contributing diff --git a/docs/sdk/wallet-rpc/README.md b/docs/sdk/wallet-rpc/README.md deleted file mode 100644 index 4277c1cbd..000000000 --- a/docs/sdk/wallet-rpc/README.md +++ /dev/null @@ -1,13 +0,0 @@ -@celo/wallet-rpc - -# @celo/wallet-rpc - -## Table of contents - -### Modules - -- [index](modules/index.md) -- [rpc-signer](modules/rpc_signer.md) -- [rpc-wallet](modules/rpc_wallet.md) -- [test-utils/ganache.setup](modules/test_utils_ganache_setup.md) -- [test-utils/ganache.teardown](modules/test_utils_ganache_teardown.md) diff --git a/docs/sdk/wallet-rpc/classes/rpc_signer.RpcSigner.md b/docs/sdk/wallet-rpc/classes/rpc_signer.RpcSigner.md deleted file mode 100644 index 8affc0b25..000000000 --- a/docs/sdk/wallet-rpc/classes/rpc_signer.RpcSigner.md +++ /dev/null @@ -1,268 +0,0 @@ -[@celo/wallet-rpc](../README.md) / [rpc-signer](../modules/rpc_signer.md) / RpcSigner - -# Class: RpcSigner - -[rpc-signer](../modules/rpc_signer.md).RpcSigner - -Implements the signer interface on top of the JSON-RPC interface. - -**`Deprecated`** - -https://forum.celo.org/t/deprecation-of-celo-wallet-rpc/8452 - -## Implements - -- `Signer` - -## Table of contents - -### Constructors - -- [constructor](rpc_signer.RpcSigner.md#constructor) - -### Methods - -- [computeSharedSecret](rpc_signer.RpcSigner.md#computesharedsecret) -- [decrypt](rpc_signer.RpcSigner.md#decrypt) -- [getNativeKey](rpc_signer.RpcSigner.md#getnativekey) -- [init](rpc_signer.RpcSigner.md#init) -- [isUnlocked](rpc_signer.RpcSigner.md#isunlocked) -- [signPersonalMessage](rpc_signer.RpcSigner.md#signpersonalmessage) -- [signRawTransaction](rpc_signer.RpcSigner.md#signrawtransaction) -- [signTransaction](rpc_signer.RpcSigner.md#signtransaction) -- [signTypedData](rpc_signer.RpcSigner.md#signtypeddata) -- [unlock](rpc_signer.RpcSigner.md#unlock) - -## Constructors - -### constructor - -• **new RpcSigner**(`rpc`, `account`, `unlockBufferSeconds?`, `unlockTime?`, `unlockDuration?`): [`RpcSigner`](rpc_signer.RpcSigner.md) - -Construct a new instance of the RPC signer - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `rpc` | `RpcCaller` | `undefined` | RPC caller instance | -| `account` | `string` | `undefined` | Account address derived from the private key to be called in init | -| `unlockBufferSeconds` | `number` | `5` | Number of seconds to shrink the unlocked duration by to account for latency and timing inconsistencies on the node | -| `unlockTime?` | `number` | `undefined` | Timestamp in seconds when the signer was last unlocked | -| `unlockDuration?` | `number` | `undefined` | Number of seconds that the signer was last unlocked for | - -#### Returns - -[`RpcSigner`](rpc_signer.RpcSigner.md) - -#### Defined in - -[sdk/wallets/wallet-rpc/src/rpc-signer.ts:65](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-rpc/src/rpc-signer.ts#L65) - -## Methods - -### computeSharedSecret - -▸ **computeSharedSecret**(`_publicKey`): `Promise`\<`Buffer`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `_publicKey` | `string` | - -#### Returns - -`Promise`\<`Buffer`\> - -#### Implementation of - -Signer.computeSharedSecret - -#### Defined in - -[sdk/wallets/wallet-rpc/src/rpc-signer.ts:174](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-rpc/src/rpc-signer.ts#L174) - -___ - -### decrypt - -▸ **decrypt**(`ciphertext`): `Promise`\<`Buffer`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `ciphertext` | `Buffer` | - -#### Returns - -`Promise`\<`Buffer`\> - -#### Implementation of - -Signer.decrypt - -#### Defined in - -[sdk/wallets/wallet-rpc/src/rpc-signer.ts:165](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-rpc/src/rpc-signer.ts#L165) - -___ - -### getNativeKey - -▸ **getNativeKey**(): `string` - -#### Returns - -`string` - -#### Implementation of - -Signer.getNativeKey - -#### Defined in - -[sdk/wallets/wallet-rpc/src/rpc-signer.ts:123](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-rpc/src/rpc-signer.ts#L123) - -___ - -### init - -▸ **init**(`privateKey`, `passphrase`): `Promise`\<`string`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `privateKey` | `string` | -| `passphrase` | `string` | - -#### Returns - -`Promise`\<`string`\> - -#### Defined in - -[sdk/wallets/wallet-rpc/src/rpc-signer.ts:73](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-rpc/src/rpc-signer.ts#L73) - -___ - -### isUnlocked - -▸ **isUnlocked**(): `boolean` - -#### Returns - -`boolean` - -#### Defined in - -[sdk/wallets/wallet-rpc/src/rpc-signer.ts:147](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-rpc/src/rpc-signer.ts#L147) - -___ - -### signPersonalMessage - -▸ **signPersonalMessage**(`data`): `Promise`\<\{ `r`: `Buffer` ; `s`: `Buffer` ; `v`: `number` }\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `data` | `string` | - -#### Returns - -`Promise`\<\{ `r`: `Buffer` ; `s`: `Buffer` ; `v`: `number` }\> - -#### Implementation of - -Signer.signPersonalMessage - -#### Defined in - -[sdk/wallets/wallet-rpc/src/rpc-signer.ts:115](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-rpc/src/rpc-signer.ts#L115) - -___ - -### signRawTransaction - -▸ **signRawTransaction**(`tx`): `Promise`\<`EncodedTransaction`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `tx` | `CeloTx` | - -#### Returns - -`Promise`\<`EncodedTransaction`\> - -#### Defined in - -[sdk/wallets/wallet-rpc/src/rpc-signer.ts:79](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-rpc/src/rpc-signer.ts#L79) - -___ - -### signTransaction - -▸ **signTransaction**(): `Promise`\<\{ `r`: `Buffer` ; `s`: `Buffer` ; `v`: `number` }\> - -#### Returns - -`Promise`\<\{ `r`: `Buffer` ; `s`: `Buffer` ; `v`: `number` }\> - -#### Implementation of - -Signer.signTransaction - -#### Defined in - -[sdk/wallets/wallet-rpc/src/rpc-signer.ts:102](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-rpc/src/rpc-signer.ts#L102) - -___ - -### signTypedData - -▸ **signTypedData**(`typedData`): `Promise`\<\{ `r`: `Buffer` ; `s`: `Buffer` ; `v`: `number` }\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `typedData` | `EIP712TypedData` | - -#### Returns - -`Promise`\<\{ `r`: `Buffer` ; `s`: `Buffer` ; `v`: `number` }\> - -#### Implementation of - -Signer.signTypedData - -#### Defined in - -[sdk/wallets/wallet-rpc/src/rpc-signer.ts:106](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-rpc/src/rpc-signer.ts#L106) - -___ - -### unlock - -▸ **unlock**(`passphrase`, `duration`): `Promise`\<`boolean`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `passphrase` | `string` | -| `duration` | `number` | - -#### Returns - -`Promise`\<`boolean`\> - -#### Defined in - -[sdk/wallets/wallet-rpc/src/rpc-signer.ts:125](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-rpc/src/rpc-signer.ts#L125) diff --git a/docs/sdk/wallet-rpc/classes/rpc_wallet.RpcWallet.md b/docs/sdk/wallet-rpc/classes/rpc_wallet.RpcWallet.md deleted file mode 100644 index 887d9e14c..000000000 --- a/docs/sdk/wallet-rpc/classes/rpc_wallet.RpcWallet.md +++ /dev/null @@ -1,448 +0,0 @@ -[@celo/wallet-rpc](../README.md) / [rpc-wallet](../modules/rpc_wallet.md) / RpcWallet - -# Class: RpcWallet - -[rpc-wallet](../modules/rpc_wallet.md).RpcWallet - -WARNING: This class should only be used with well-permissioned providers (ie IPC) - to avoid sensitive user 'privateKey' and 'passphrase' information being exposed - -**`Deprecated`** - -https://forum.celo.org/t/deprecation-of-celo-wallet-rpc/8452 - -## Hierarchy - -- `RemoteWallet`\<[`RpcSigner`](rpc_signer.RpcSigner.md)\> - - ↳ **`RpcWallet`** - -## Implements - -- `UnlockableWallet` - -## Table of contents - -### Constructors - -- [constructor](rpc_wallet.RpcWallet.md#constructor) - -### Properties - -- [isSetupFinished](rpc_wallet.RpcWallet.md#issetupfinished) - -### Methods - -- [addAccount](rpc_wallet.RpcWallet.md#addaccount) -- [computeSharedSecret](rpc_wallet.RpcWallet.md#computesharedsecret) -- [decrypt](rpc_wallet.RpcWallet.md#decrypt) -- [getAccounts](rpc_wallet.RpcWallet.md#getaccounts) -- [hasAccount](rpc_wallet.RpcWallet.md#hasaccount) -- [init](rpc_wallet.RpcWallet.md#init) -- [isAccountUnlocked](rpc_wallet.RpcWallet.md#isaccountunlocked) -- [loadAccountSigners](rpc_wallet.RpcWallet.md#loadaccountsigners) -- [removeAccount](rpc_wallet.RpcWallet.md#removeaccount) -- [signPersonalMessage](rpc_wallet.RpcWallet.md#signpersonalmessage) -- [signTransaction](rpc_wallet.RpcWallet.md#signtransaction) -- [signTypedData](rpc_wallet.RpcWallet.md#signtypeddata) -- [unlockAccount](rpc_wallet.RpcWallet.md#unlockaccount) - -## Constructors - -### constructor - -• **new RpcWallet**(`_provider`): [`RpcWallet`](rpc_wallet.RpcWallet.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `_provider` | `Provider` | - -#### Returns - -[`RpcWallet`](rpc_wallet.RpcWallet.md) - -#### Overrides - -RemoteWallet\<RpcSigner\>.constructor - -#### Defined in - -[sdk/wallets/wallet-rpc/src/rpc-wallet.ts:22](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-rpc/src/rpc-wallet.ts#L22) - -## Properties - -### isSetupFinished - -• **isSetupFinished**: () => `boolean` - -#### Type declaration - -▸ (): `boolean` - -##### Returns - -`boolean` - -#### Inherited from - -RemoteWallet.isSetupFinished - -#### Defined in - -sdk/wallets/wallet-remote/lib/remote-wallet.d.ts:51 - -## Methods - -### addAccount - -▸ **addAccount**(`privateKey`, `passphrase`): `Promise`\<`string`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `privateKey` | `string` | -| `passphrase` | `string` | - -#### Returns - -`Promise`\<`string`\> - -#### Implementation of - -UnlockableWallet.addAccount - -#### Defined in - -[sdk/wallets/wallet-rpc/src/rpc-wallet.ts:40](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-rpc/src/rpc-wallet.ts#L40) - -___ - -### computeSharedSecret - -▸ **computeSharedSecret**(`address`, `publicKey`): `Promise`\<`Buffer`\> - -Computes the shared secret (an ECDH key exchange object) between two accounts - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `string` | -| `publicKey` | `string` | - -#### Returns - -`Promise`\<`Buffer`\> - -#### Implementation of - -UnlockableWallet.computeSharedSecret - -#### Inherited from - -RemoteWallet.computeSharedSecret - -#### Defined in - -sdk/wallets/wallet-base/lib/wallet-base.d.ts:64 - -___ - -### decrypt - -▸ **decrypt**(`address`, `ciphertext`): `Promise`\<`Buffer`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `string` | -| `ciphertext` | `Buffer` | - -#### Returns - -`Promise`\<`Buffer`\> - -#### Implementation of - -UnlockableWallet.decrypt - -#### Inherited from - -RemoteWallet.decrypt - -#### Defined in - -sdk/wallets/wallet-base/lib/wallet-base.d.ts:60 - -___ - -### getAccounts - -▸ **getAccounts**(): `string`[] - -Get a list of accounts in the remote wallet - -#### Returns - -`string`[] - -#### Implementation of - -UnlockableWallet.getAccounts - -#### Inherited from - -RemoteWallet.getAccounts - -#### Defined in - -sdk/wallets/wallet-remote/lib/remote-wallet.d.ts:27 - -___ - -### hasAccount - -▸ **hasAccount**(`address?`): `boolean` - -Returns true if account is in the remote wallet - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `address?` | `string` | Account to check | - -#### Returns - -`boolean` - -#### Implementation of - -UnlockableWallet.hasAccount - -#### Inherited from - -RemoteWallet.hasAccount - -#### Defined in - -sdk/wallets/wallet-remote/lib/remote-wallet.d.ts:32 - -___ - -### init - -▸ **init**(): `Promise`\<`void`\> - -Discovers wallet accounts and caches results in memory -Idempotent to ensure multiple calls are benign - -#### Returns - -`Promise`\<`void`\> - -#### Inherited from - -RemoteWallet.init - -#### Defined in - -sdk/wallets/wallet-remote/lib/remote-wallet.d.ts:15 - -___ - -### isAccountUnlocked - -▸ **isAccountUnlocked**(`address`): `boolean` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `string` | - -#### Returns - -`boolean` - -#### Implementation of - -UnlockableWallet.isAccountUnlocked - -#### Defined in - -[sdk/wallets/wallet-rpc/src/rpc-wallet.ts:56](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-rpc/src/rpc-wallet.ts#L56) - -___ - -### loadAccountSigners - -▸ **loadAccountSigners**(): `Promise`\<`Map`\<`string`, [`RpcSigner`](rpc_signer.RpcSigner.md)\>\> - -#### Returns - -`Promise`\<`Map`\<`string`, [`RpcSigner`](rpc_signer.RpcSigner.md)\>\> - -#### Overrides - -RemoteWallet.loadAccountSigners - -#### Defined in - -[sdk/wallets/wallet-rpc/src/rpc-wallet.ts:27](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-rpc/src/rpc-wallet.ts#L27) - -___ - -### removeAccount - -▸ **removeAccount**(`_address`): `void` - -Removes the account with the given address. Needs to be implemented by subclass, otherwise throws error - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `_address` | `string` | - -#### Returns - -`void` - -#### Implementation of - -UnlockableWallet.removeAccount - -#### Inherited from - -RemoteWallet.removeAccount - -#### Defined in - -sdk/wallets/wallet-base/lib/wallet-base.d.ts:23 - -___ - -### signPersonalMessage - -▸ **signPersonalMessage**(`address`, `data`): `Promise`\<`string`\> - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `string` | Address of the account to sign with | -| `data` | `string` | Hex string message to sign | - -#### Returns - -`Promise`\<`string`\> - -Signature hex string (order: rsv) - -#### Implementation of - -UnlockableWallet.signPersonalMessage - -#### Inherited from - -RemoteWallet.signPersonalMessage - -#### Defined in - -sdk/wallets/wallet-remote/lib/remote-wallet.d.ts:43 - -___ - -### signTransaction - -▸ **signTransaction**(`txParams`): `Promise`\<`EncodedTransaction`\> - -Gets the signer based on the 'from' field in the tx body - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `txParams` | `CeloTx` | Transaction to sign | - -#### Returns - -`Promise`\<`EncodedTransaction`\> - -**`Dev`** - -overrides WalletBase.signTransaction - -#### Implementation of - -UnlockableWallet.signTransaction - -#### Overrides - -RemoteWallet.signTransaction - -#### Defined in - -[sdk/wallets/wallet-rpc/src/rpc-wallet.ts:66](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-rpc/src/rpc-wallet.ts#L66) - -___ - -### signTypedData - -▸ **signTypedData**(`address`, `typedData`): `Promise`\<`string`\> - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `string` | Address of the account to sign with | -| `typedData` | `EIP712TypedData` | the typed data object | - -#### Returns - -`Promise`\<`string`\> - -Signature hex string (order: rsv) - -#### Implementation of - -UnlockableWallet.signTypedData - -#### Inherited from - -RemoteWallet.signTypedData - -#### Defined in - -sdk/wallets/wallet-remote/lib/remote-wallet.d.ts:49 - -___ - -### unlockAccount - -▸ **unlockAccount**(`address`, `passphrase`, `duration`): `Promise`\<`boolean`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `string` | -| `passphrase` | `string` | -| `duration` | `number` | - -#### Returns - -`Promise`\<`boolean`\> - -#### Implementation of - -UnlockableWallet.unlockAccount - -#### Defined in - -[sdk/wallets/wallet-rpc/src/rpc-wallet.ts:51](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-rpc/src/rpc-wallet.ts#L51) diff --git a/docs/sdk/wallet-rpc/enums/rpc_wallet.RpcWalletErrors.md b/docs/sdk/wallet-rpc/enums/rpc_wallet.RpcWalletErrors.md deleted file mode 100644 index a43e6687e..000000000 --- a/docs/sdk/wallet-rpc/enums/rpc_wallet.RpcWalletErrors.md +++ /dev/null @@ -1,32 +0,0 @@ -[@celo/wallet-rpc](../README.md) / [rpc-wallet](../modules/rpc_wallet.md) / RpcWalletErrors - -# Enumeration: RpcWalletErrors - -[rpc-wallet](../modules/rpc_wallet.md).RpcWalletErrors - -## Table of contents - -### Enumeration Members - -- [AccountAlreadyExists](rpc_wallet.RpcWalletErrors.md#accountalreadyexists) -- [FetchAccounts](rpc_wallet.RpcWalletErrors.md#fetchaccounts) - -## Enumeration Members - -### AccountAlreadyExists - -• **AccountAlreadyExists** = ``"RpcWallet: account already exists"`` - -#### Defined in - -[sdk/wallets/wallet-rpc/src/rpc-wallet.ts:10](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-rpc/src/rpc-wallet.ts#L10) - -___ - -### FetchAccounts - -• **FetchAccounts** = ``"RpcWallet: failed to fetch accounts from server"`` - -#### Defined in - -[sdk/wallets/wallet-rpc/src/rpc-wallet.ts:9](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-rpc/src/rpc-wallet.ts#L9) diff --git a/docs/sdk/wallet-rpc/modules/index.md b/docs/sdk/wallet-rpc/modules/index.md deleted file mode 100644 index c97688f59..000000000 --- a/docs/sdk/wallet-rpc/modules/index.md +++ /dev/null @@ -1,29 +0,0 @@ -[@celo/wallet-rpc](../README.md) / index - -# Module: index - -## Table of contents - -### References - -- [RpcSigner](index.md#rpcsigner) -- [RpcWallet](index.md#rpcwallet) -- [RpcWalletErrors](index.md#rpcwalleterrors) - -## References - -### RpcSigner - -Re-exports [RpcSigner](../classes/rpc_signer.RpcSigner.md) - -___ - -### RpcWallet - -Re-exports [RpcWallet](../classes/rpc_wallet.RpcWallet.md) - -___ - -### RpcWalletErrors - -Re-exports [RpcWalletErrors](../enums/rpc_wallet.RpcWalletErrors.md) diff --git a/docs/sdk/wallet-rpc/modules/rpc_signer.md b/docs/sdk/wallet-rpc/modules/rpc_signer.md deleted file mode 100644 index af5626462..000000000 --- a/docs/sdk/wallet-rpc/modules/rpc_signer.md +++ /dev/null @@ -1,9 +0,0 @@ -[@celo/wallet-rpc](../README.md) / rpc-signer - -# Module: rpc-signer - -## Table of contents - -### Classes - -- [RpcSigner](../classes/rpc_signer.RpcSigner.md) diff --git a/docs/sdk/wallet-rpc/modules/rpc_wallet.md b/docs/sdk/wallet-rpc/modules/rpc_wallet.md deleted file mode 100644 index 665f32636..000000000 --- a/docs/sdk/wallet-rpc/modules/rpc_wallet.md +++ /dev/null @@ -1,13 +0,0 @@ -[@celo/wallet-rpc](../README.md) / rpc-wallet - -# Module: rpc-wallet - -## Table of contents - -### Enumerations - -- [RpcWalletErrors](../enums/rpc_wallet.RpcWalletErrors.md) - -### Classes - -- [RpcWallet](../classes/rpc_wallet.RpcWallet.md) diff --git a/docs/sdk/wallet-rpc/modules/test_utils_ganache_setup.md b/docs/sdk/wallet-rpc/modules/test_utils_ganache_setup.md deleted file mode 100644 index ee63449fb..000000000 --- a/docs/sdk/wallet-rpc/modules/test_utils_ganache_setup.md +++ /dev/null @@ -1,23 +0,0 @@ -[@celo/wallet-rpc](../README.md) / test-utils/ganache.setup - -# Module: test-utils/ganache.setup - -## Table of contents - -### Functions - -- [default](test_utils_ganache_setup.md#default) - -## Functions - -### default - -▸ **default**(): `Promise`\<`void`\> - -#### Returns - -`Promise`\<`void`\> - -#### Defined in - -[sdk/wallets/wallet-rpc/src/test-utils/ganache.setup.ts:4](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-rpc/src/test-utils/ganache.setup.ts#L4) diff --git a/docs/sdk/wallet-rpc/modules/test_utils_ganache_teardown.md b/docs/sdk/wallet-rpc/modules/test_utils_ganache_teardown.md deleted file mode 100644 index b0fbc4919..000000000 --- a/docs/sdk/wallet-rpc/modules/test_utils_ganache_teardown.md +++ /dev/null @@ -1,23 +0,0 @@ -[@celo/wallet-rpc](../README.md) / test-utils/ganache.teardown - -# Module: test-utils/ganache.teardown - -## Table of contents - -### Functions - -- [default](test_utils_ganache_teardown.md#default) - -## Functions - -### default - -▸ **default**(): `any` - -#### Returns - -`any` - -#### Defined in - -dev-utils/lib/ganache-teardown.d.ts:1 diff --git a/packages/sdk/wallets/wallet-rpc/.eslintrc.js b/packages/sdk/wallets/wallet-rpc/.eslintrc.js deleted file mode 100644 index 8586cb7e2..000000000 --- a/packages/sdk/wallets/wallet-rpc/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - extends: '../../../../.eslintrc.js', -} diff --git a/packages/sdk/wallets/wallet-rpc/.gitignore b/packages/sdk/wallets/wallet-rpc/.gitignore deleted file mode 100644 index c3af85790..000000000 --- a/packages/sdk/wallets/wallet-rpc/.gitignore +++ /dev/null @@ -1 +0,0 @@ -lib/ diff --git a/packages/sdk/wallets/wallet-rpc/.npmignore b/packages/sdk/wallets/wallet-rpc/.npmignore deleted file mode 100644 index 616d8322f..000000000 --- a/packages/sdk/wallets/wallet-rpc/.npmignore +++ /dev/null @@ -1,24 +0,0 @@ -/.devchain/ -/.devchain.tar.gz -/coverage/ -/node_modules/ -/src/ -/tmp/ -/.tmp/ - -/tsconfig.* -/jest.config.* -*.tgz - -/src - -/lib/**/*.test.* -/lib/test-utils - - -# exclude ts files and sourcemaps -*.map -*.ts - -# include the .d.ts files -!lib/**/*.d.ts \ No newline at end of file diff --git a/packages/sdk/wallets/wallet-rpc/CHANGELOG.md b/packages/sdk/wallets/wallet-rpc/CHANGELOG.md deleted file mode 100644 index cb76b2371..000000000 --- a/packages/sdk/wallets/wallet-rpc/CHANGELOG.md +++ /dev/null @@ -1,197 +0,0 @@ -# @celo/wallet-rpc - -## 6.0.1 - -### Patch Changes - -- [#313](https://github.com/celo-org/developer-tooling/pull/313) [`7715590`](https://github.com/celo-org/developer-tooling/commit/7715590b3efda1eb39a2600ffc858905265f5d12) Thanks [@aaronmgdr](https://github.com/aaronmgdr)! - chore: Deprecate @celo/wallet-rpc see https://forum.celo.org/t/deprecation-of-celo-wallet-rpc/8452 - -- Updated dependencies [[`d245703`](https://github.com/celo-org/developer-tooling/commit/d245703fa71ad24c88982fc6566e4d2865f586a4)]: - - @celo/connect@6.0.1 - - @celo/wallet-base@6.0.1 - - @celo/wallet-remote@6.0.1 - -## 6.0.1-beta.0 - -### Patch Changes - -- [#313](https://github.com/celo-org/developer-tooling/pull/313) [`7715590`](https://github.com/celo-org/developer-tooling/commit/7715590b3efda1eb39a2600ffc858905265f5d12) Thanks [@aaronmgdr](https://github.com/aaronmgdr)! - Deprecate @celo/wallet-rpc see https://forum.celo.org/t/deprecation-of-celo-wallet-rpc/8452 - -- Updated dependencies [[`d245703`](https://github.com/celo-org/developer-tooling/commit/d245703fa71ad24c88982fc6566e4d2865f586a4)]: - - @celo/connect@6.0.1-beta.0 - - @celo/wallet-base@6.0.1-beta.0 - - @celo/wallet-remote@6.0.1-beta.0 - -## 6.0.0 - -### Minor Changes - -- [#264](https://github.com/celo-org/developer-tooling/pull/264) [`59f4b42`](https://github.com/celo-org/developer-tooling/commit/59f4b42029699861e91dd2214c40173f70de279e) Thanks [@nicolasbrugneaux](https://github.com/nicolasbrugneaux)! - Add support for serializing, sending, parsing and deserializing cip66 transactions. This tx type is preffered over cip64 when paying for gas with tokens. Like eip1559 maxFeePerGass and maxPriorityFeePerGas are denominated in CELO. To create an cip66 transaction with Contractkit call the `kit.populateMaxFeeInToken` method with your transaction and then send it. - -### Patch Changes - -- [#59](https://github.com/celo-org/developer-tooling/pull/59) [`38b2631`](https://github.com/celo-org/developer-tooling/commit/38b26316d615e836e21bbfe2f44853f7e8220e03) Thanks [@nicolasbrugneaux](https://github.com/nicolasbrugneaux)! - CHANGE - Update the code to match @celo/wallet-base changes - -- Updated dependencies [[`38b2631`](https://github.com/celo-org/developer-tooling/commit/38b26316d615e836e21bbfe2f44853f7e8220e03), [`38b2631`](https://github.com/celo-org/developer-tooling/commit/38b26316d615e836e21bbfe2f44853f7e8220e03), [`59f4b42`](https://github.com/celo-org/developer-tooling/commit/59f4b42029699861e91dd2214c40173f70de279e), [`182bf73`](https://github.com/celo-org/developer-tooling/commit/182bf73209e6b7de0d9ea1fedaf91c9ec80299f5), [`38b2631`](https://github.com/celo-org/developer-tooling/commit/38b26316d615e836e21bbfe2f44853f7e8220e03), [`7b93642`](https://github.com/celo-org/developer-tooling/commit/7b93642803261b37971dd3c07f8748b6bc8f3378), [`38b2631`](https://github.com/celo-org/developer-tooling/commit/38b26316d615e836e21bbfe2f44853f7e8220e03), [`66972eb`](https://github.com/celo-org/developer-tooling/commit/66972ebf0dfabc845ae309c2f794fe015ac49a86)]: - - @celo/wallet-base@6.0.0 - - @celo/utils@7.0.0 - - @celo/connect@6.0.0 - - @celo/base@6.1.0 - - @celo/wallet-remote@6.0.0 - -## 6.0.0-beta.3 - -### Patch Changes - -- Updated dependencies []: - - @celo/wallet-base@6.0.0-beta.3 - - @celo/wallet-remote@6.0.0-beta.3 - -## 6.0.0-beta.2 - -### Minor Changes - -- [#264](https://github.com/celo-org/developer-tooling/pull/264) [`59f4b42`](https://github.com/celo-org/developer-tooling/commit/59f4b42029699861e91dd2214c40173f70de279e) Thanks [@nicolasbrugneaux](https://github.com/nicolasbrugneaux)! - Add support for serializing, sending, parsing and deserializing cip66 transactions. This tx type is preffered over cip64 when paying for gas with tokens. Like eip1559 maxFeePerGass and maxPriorityFeePerGas are denominated in CELO. To create an cip66 transaction with Contractkit call the `kit.populateMaxFeeInToken` method with your transaction and then send it. - -### Patch Changes - -- Updated dependencies [[`59f4b42`](https://github.com/celo-org/developer-tooling/commit/59f4b42029699861e91dd2214c40173f70de279e)]: - - @celo/wallet-base@6.0.0-beta.2 - - @celo/connect@6.0.0-beta.1 - - @celo/wallet-remote@6.0.0-beta.2 - -## 6.0.0-beta.1 - -### Patch Changes - -- Updated dependencies []: - - @celo/wallet-base@6.0.0-beta.1 - - @celo/wallet-remote@6.0.0-beta.1 - -## 6.0.0-beta.0 - -### Patch Changes - -- [#59](https://github.com/celo-org/developer-tooling/pull/59) [`38b2631`](https://github.com/celo-org/developer-tooling/commit/38b26316d615e836e21bbfe2f44853f7e8220e03) Thanks [@nicolasbrugneaux](https://github.com/nicolasbrugneaux)! - CHANGE - Update the code to match @celo/wallet-base changes - -- Updated dependencies [[`38b2631`](https://github.com/celo-org/developer-tooling/commit/38b26316d615e836e21bbfe2f44853f7e8220e03), [`38b2631`](https://github.com/celo-org/developer-tooling/commit/38b26316d615e836e21bbfe2f44853f7e8220e03), [`182bf73`](https://github.com/celo-org/developer-tooling/commit/182bf73209e6b7de0d9ea1fedaf91c9ec80299f5), [`38b2631`](https://github.com/celo-org/developer-tooling/commit/38b26316d615e836e21bbfe2f44853f7e8220e03), [`7b93642`](https://github.com/celo-org/developer-tooling/commit/7b93642803261b37971dd3c07f8748b6bc8f3378), [`38b2631`](https://github.com/celo-org/developer-tooling/commit/38b26316d615e836e21bbfe2f44853f7e8220e03), [`66972eb`](https://github.com/celo-org/developer-tooling/commit/66972ebf0dfabc845ae309c2f794fe015ac49a86)]: - - @celo/wallet-base@6.0.0-beta.0 - - @celo/utils@7.0.0-beta.0 - - @celo/connect@6.0.0-beta.0 - - @celo/base@6.1.0-beta.0 - - @celo/wallet-remote@6.0.0-beta.0 - -## 5.2.0 - -### Patch Changes - -- [#200](https://github.com/celo-org/developer-tooling/pull/200) [`6e3372f`](https://github.com/celo-org/developer-tooling/commit/6e3372f5ada20bb59d88e275170be4dae1e99f01) Thanks [@nicolasbrugneaux](https://github.com/nicolasbrugneaux)! - Bump web3-\* to 1.10.4 -- Some consumers may be forced to upgrade their web3 instance to the same version - -- Updated dependencies [[`6e3372f`](https://github.com/celo-org/developer-tooling/commit/6e3372f5ada20bb59d88e275170be4dae1e99f01), [`6e3372f`](https://github.com/celo-org/developer-tooling/commit/6e3372f5ada20bb59d88e275170be4dae1e99f01), [`6e3372f`](https://github.com/celo-org/developer-tooling/commit/6e3372f5ada20bb59d88e275170be4dae1e99f01), [`6e3372f`](https://github.com/celo-org/developer-tooling/commit/6e3372f5ada20bb59d88e275170be4dae1e99f01), [`6e3372f`](https://github.com/celo-org/developer-tooling/commit/6e3372f5ada20bb59d88e275170be4dae1e99f01)]: - - @celo/wallet-remote@5.2.0 - - @celo/wallet-base@5.2.0 - - @celo/connect@5.3.0 - - @celo/utils@6.0.1 - - @celo/base@6.0.1 - -## 5.2.0-beta.0 - -### Patch Changes - -- [#168](https://github.com/celo-org/developer-tooling/pull/168) [`c42682d`](https://github.com/celo-org/developer-tooling/commit/c42682d8a7e582f0adaa63c833a4c83a0a649f20) Thanks [@renovate](https://github.com/apps/renovate)! - Bump web3-\* to 1.10.4 -- Some consumers may be forced to upgrade their web3 instance to the same version - -- Updated dependencies [[`c42682d`](https://github.com/celo-org/developer-tooling/commit/c42682d8a7e582f0adaa63c833a4c83a0a649f20), [`08b0d6a`](https://github.com/celo-org/developer-tooling/commit/08b0d6a18b73b01c162f6ba4f97d73f3e3708160), [`5335af5`](https://github.com/celo-org/developer-tooling/commit/5335af5808a892c95245624e676cd1952a0cfb42), [`08b0d6a`](https://github.com/celo-org/developer-tooling/commit/08b0d6a18b73b01c162f6ba4f97d73f3e3708160), [`08b0d6a`](https://github.com/celo-org/developer-tooling/commit/08b0d6a18b73b01c162f6ba4f97d73f3e3708160)]: - - @celo/wallet-remote@5.2.0-beta.0 - - @celo/wallet-base@5.2.0-beta.0 - - @celo/connect@5.3.0-beta.0 - - @celo/utils@6.0.1-beta.0 - - @celo/base@6.0.1-beta.0 - -## 5.1.3 - -### Patch Changes - -- Updated dependencies [[`28cd8f8`](https://github.com/celo-org/developer-tooling/commit/28cd8f8c8dd62ecafa01ef7a7fb89117e6db9b56)]: - - @celo/connect@5.2.0 - - @celo/wallet-base@5.1.3 - - @celo/wallet-remote@5.1.3 - -## 5.1.3-beta.0 - -### Patch Changes - -- Updated dependencies [[`28cd8f8`](https://github.com/celo-org/developer-tooling/commit/28cd8f8c8dd62ecafa01ef7a7fb89117e6db9b56)]: - - @celo/connect@5.2.0-beta.0 - - @celo/wallet-base@5.1.3-beta.0 - - @celo/wallet-remote@5.1.3-beta.0 - -## 5.1.2 - -### Patch Changes - -- Updated dependencies [[`6b2e34c`](https://github.com/celo-org/developer-tooling/commit/6b2e34c973290da221aaabdc2bf4c6654ef9f99c)]: - - @celo/utils@6.0.0 - - @celo/wallet-base@5.1.2 - - @celo/wallet-remote@5.1.2 - - @celo/connect@5.1.2 - -## 5.1.2-beta.0 - -### Patch Changes - -- Updated dependencies [[`6b2e34c`](https://github.com/celo-org/developer-tooling/commit/6b2e34c973290da221aaabdc2bf4c6654ef9f99c)]: - - @celo/utils@6.0.0-beta.0 - - @celo/connect@5.1.2-beta.0 - - @celo/wallet-base@5.1.2-beta.0 - - @celo/wallet-remote@5.1.2-beta.0 - -## 5.1.1 - -### Patch Changes - -- Updated dependencies [679ef0c60] -- Updated dependencies [97d5ccf43] - - @celo/connect@5.1.1 - - @celo/base@6.0.0 - - @celo/utils@5.0.6 - - @celo/wallet-base@5.1.1 - - @celo/wallet-remote@5.1.1 - -## 5.1.1-beta.0 - -### Patch Changes - -- Updated dependencies [97d5ccf43] - - @celo/base@6.0.0-beta.0 - - @celo/connect@5.1.1-beta.0 - - @celo/utils@5.0.6-beta.0 - - @celo/wallet-base@5.1.1-beta.0 - - @celo/wallet-remote@5.1.1-beta.0 - -## 5.1.0 - -### Patch Changes - -- 53bbd4958: Note celo sdk packages will no longer be fix bumped (ie will not share the same version always) and will now use ^range when depending on each other -- Updated dependencies [d48c68afc] -- Updated dependencies [53bbd4958] -- Updated dependencies [53bbd4958] - - @celo/connect@5.1.0 - - @celo/wallet-remote@5.1.0 - - @celo/wallet-base@5.1.0 - - @celo/utils@5.0.5 - - @celo/base@5.0.5 - -## 5.1.0-beta.0 - -### Patch Changes - -- 53bbd4958: Note celo sdk packages will no longer be fix bumped (ie will not share the same version always) and will now use ^range when depending on each other -- Updated dependencies [d48c68afc] -- Updated dependencies [53bbd4958] -- Updated dependencies [53bbd4958] - - @celo/connect@5.1.0-beta.0 - - @celo/wallet-remote@5.1.0-beta.0 - - @celo/wallet-base@5.1.0-beta.0 - - @celo/utils@5.0.5-beta.0 - - @celo/base@5.0.5-beta.0 diff --git a/packages/sdk/wallets/wallet-rpc/README.md b/packages/sdk/wallets/wallet-rpc/README.md deleted file mode 100644 index e8e1b55fa..000000000 --- a/packages/sdk/wallets/wallet-rpc/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# @celo/wallet-rpc - -Wallet-rpc provides utilities for performing wallet functions via RPC. - -## How we work - -We are a GitHub-first team, wihich means we have a strong preference for communicating via GitHub. -Please use GitHub to: - -🐞 [File a bug report](https://github.com/celo-org/developer-tooling/issues/new/choose) - -💬 [Ask a question](https://github.com/celo-org/developer-tooling/discussions) - -✨ [Suggest a feature](https://github.com/celo-org/developer-tooling/issues/new/choose) - -🧑‍💻 [Contribute!](/CONTRIBUTING.md) - -🚔 [Report a security vulnerability](https://github.com/celo-org/developer-tooling/issues/new/choose) - -> [!TIP] -> -> Please avoid messaging us via Slack, Telegram, or email. We are more likely to respond to you on -> GitHub than if you message us anywhere else. We actively monitor GitHub, and will get back to you shortly 🌟 \ No newline at end of file diff --git a/packages/sdk/wallets/wallet-rpc/eslint.tsconfig.json b/packages/sdk/wallets/wallet-rpc/eslint.tsconfig.json deleted file mode 100644 index a8d4317b4..000000000 --- a/packages/sdk/wallets/wallet-rpc/eslint.tsconfig.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./tsconfig.json", - "exclude": [] -} diff --git a/packages/sdk/wallets/wallet-rpc/jest.config.js b/packages/sdk/wallets/wallet-rpc/jest.config.js deleted file mode 100644 index 16600517d..000000000 --- a/packages/sdk/wallets/wallet-rpc/jest.config.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = { - preset: 'ts-jest', - testEnvironment: 'node', - testMatch: ['/src/**/?(*.)+(spec|test).ts?(x)'], - globalSetup: '/src/test-utils/ganache.setup.ts', - globalTeardown: '/src/test-utils/ganache.teardown.ts', -} diff --git a/packages/sdk/wallets/wallet-rpc/package.json b/packages/sdk/wallets/wallet-rpc/package.json deleted file mode 100644 index db5cc3dd2..000000000 --- a/packages/sdk/wallets/wallet-rpc/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "@celo/wallet-rpc", - "version": "6.0.1", - "description": "Geth RPC wallet implementation", - "author": "Celo", - "license": "Apache-2.0", - "repository": "https://github.com/celo-org/developer-tooling/tree/master/packages/sdk/wallets/", - "homepage": "https://docs.celo.org", - "main": "./lib/index.js", - "types": "./lib/index.d.ts", - "keywords": [ - "celo", - "blockchain", - "sdk" - ], - "scripts": { - "build": "yarn run --top-level tsc -b .", - "clean": "yarn run --top-level tsc -b . --clean", - "docs": "yarn run --top-level typedoc", - "test": "yarn run --top-level jest --runInBand --forceExit", - "lint": "yarn run --top-level eslint -c .eslintrc.js ", - "prepublishOnly": "yarn build" - }, - "dependencies": { - "@celo/base": "^6.1.0", - "@celo/connect": "^6.0.1", - "@celo/utils": "^7.0.0", - "@celo/wallet-base": "^6.0.1", - "@celo/wallet-remote": "^6.0.1", - "@types/bn.js": "^5.1.0", - "bignumber.js": "^9.0.0", - "debug": "^4.1.1" - }, - "devDependencies": { - "@celo/contractkit": "^8.1.1", - "@celo/dev-utils": "0.0.5", - "@celo/typescript": "workspace:^", - "@types/debug": "^4.1.12", - "bn.js": "^5.1.0", - "web3": "1.10.4" - }, - "engines": { - "node": ">=8.14.2" - } -} diff --git a/packages/sdk/wallets/wallet-rpc/src/index.ts b/packages/sdk/wallets/wallet-rpc/src/index.ts deleted file mode 100644 index 015275834..000000000 --- a/packages/sdk/wallets/wallet-rpc/src/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './rpc-signer' -export * from './rpc-wallet' diff --git a/packages/sdk/wallets/wallet-rpc/src/rpc-signer.ts b/packages/sdk/wallets/wallet-rpc/src/rpc-signer.ts deleted file mode 100644 index 10fe63ef6..000000000 --- a/packages/sdk/wallets/wallet-rpc/src/rpc-signer.ts +++ /dev/null @@ -1,178 +0,0 @@ -import { ensureLeading0x, normalizeAddressWith0x, trimLeading0x } from '@celo/base/lib/address' -import { CeloTx, EncodedTransaction, Hex, RpcCaller, Signer } from '@celo/connect' -import { EIP712TypedData } from '@celo/utils/lib/sign-typed-data-utils' -import { decodeSig } from '@celo/wallet-base' -import BigNumber from 'bignumber.js' -import type BN from 'bn.js' - -const INCORRECT_PASSWORD_ERROR = 'could not decrypt key with given password' -const currentTimeInSeconds = () => Math.floor(Date.now() / 1000) - -const toRpcHex = (val: string | number | BN | undefined) => { - if (typeof val === 'number' || val instanceof BigNumber) { - return ensureLeading0x(val.toString(16)) - } else if (typeof val === 'string') { - return ensureLeading0x(val) - } else { - return '0x0' - } -} - -// TODO(yorke): move this into rpc-caller and generate typings from RPC spec -enum RpcSignerEndpoint { - ImportAccount = 'personal_importRawKey', - UnlockAccount = 'personal_unlockAccount', - SignTransaction = 'eth_signTransaction', - SignBytes = 'eth_sign', - SignTypedData = 'eth_signTypedData', - Decrypt = 'personal_decrypt', -} - -type RpcSignerEndpointInputs = { - personal_importRawKey: [string, string] - personal_unlockAccount: [string, string, number] - eth_signTransaction: [any] // RpcTx doesn't match Tx because of nonce as string instead of number - eth_sign: [string, string] - eth_signTypedData: [string, EIP712TypedData] - personal_decrypt: [string, string] -} - -type RpcSignerEndpointResult = { - personal_importRawKey: string - personal_unlockAccount: boolean - eth_signTransaction: EncodedTransaction - eth_sign: string - eth_signTypedData: string - personal_decrypt: string -} - -/** - * Implements the signer interface on top of the JSON-RPC interface. - * @deprecated https://forum.celo.org/t/deprecation-of-celo-wallet-rpc/8452 - */ -export class RpcSigner implements Signer { - /** - * Construct a new instance of the RPC signer - * - * @param rpc RPC caller instance - * @param account Account address derived from the private key to be called in init - * @param unlockBufferSeconds Number of seconds to shrink the unlocked duration by to account for - * latency and timing inconsistencies on the node - * @param unlockTime Timestamp in seconds when the signer was last unlocked - * @param unlockDuration Number of seconds that the signer was last unlocked for - * - */ - constructor( - protected rpc: RpcCaller, - protected account: string, - protected unlockBufferSeconds = 5, - protected unlockTime?: number, - protected unlockDuration?: number - ) {} - - init = (privateKey: string, passphrase: string) => - this.callAndCheckResponse(RpcSignerEndpoint.ImportAccount, [ - ensureLeading0x(privateKey), - passphrase, - ]) - - async signRawTransaction(tx: CeloTx) { - if (normalizeAddressWith0x(tx.from! as string) !== this.account) { - throw new Error(`RpcSigner cannot sign tx with 'from' ${tx.from}`) - } - // see geth SendTxArgs type - // https://github.com/celo-org/celo-blockchain/blob/fc20d6921478cda68fc88797078f20053bae8866/internal/ethapi/api.go#L1241C6-L1241C20 - const rpcTx = { - ...tx, - nonce: toRpcHex(tx.nonce), - value: toRpcHex(tx.value), - gas: toRpcHex(tx.gas), - ...(tx.gasPrice - ? { - gasPrice: toRpcHex(tx.gasPrice), - } - : { - maxPriorityFeePerGas: toRpcHex(tx.maxPriorityFeePerGas), - maxFeePerGas: toRpcHex(tx.maxFeePerGas), - }), - } - return this.callAndCheckResponse(RpcSignerEndpoint.SignTransaction, [rpcTx]) - } - - async signTransaction(): Promise<{ v: number; r: Buffer; s: Buffer }> { - throw new Error('signTransaction unimplemented; use signRawTransaction') - } - - async signTypedData(typedData: EIP712TypedData): Promise<{ v: number; r: Buffer; s: Buffer }> { - const result = await this.callAndCheckResponse(RpcSignerEndpoint.SignTypedData, [ - this.account, - typedData, - ]) - - return decodeSig(result as Hex) - } - - async signPersonalMessage(data: string): Promise<{ v: number; r: Buffer; s: Buffer }> { - const result = await this.callAndCheckResponse(RpcSignerEndpoint.SignBytes, [ - this.account, - data, - ]) - return decodeSig(result as Hex) - } - - getNativeKey = () => this.account - - async unlock(passphrase: string, duration: number): Promise { - try { - await this.callAndCheckResponse(RpcSignerEndpoint.UnlockAccount, [ - this.account, - passphrase, - duration, - ]) - } catch (error: any) { - // The callAndCheckResponse will throw an error if the passphrase is incorrect - if (error?.message?.toLowerCase()?.includes(INCORRECT_PASSWORD_ERROR)) { - return false - } - - // Re-throw otherwise - throw error - } - - this.unlockTime = currentTimeInSeconds() - this.unlockDuration = duration - return true - } - - isUnlocked() { - if (this.unlockDuration === undefined || this.unlockTime === undefined) { - return false - } - return this.unlockTime + this.unlockDuration - this.unlockBufferSeconds > currentTimeInSeconds() - } - - private async callAndCheckResponse( - endpoint: T, - params: RpcSignerEndpointInputs[T] - ): Promise { - const response = await this.rpc.call(endpoint, params) - if (response.error) { - throw new Error(`RpcSigner@${endpoint} failed with \n'${(response.error as any).message}'`) - } - return response.result! as RpcSignerEndpointResult[typeof endpoint] - } - - async decrypt(ciphertext: Buffer) { - const resp = await this.callAndCheckResponse(RpcSignerEndpoint.Decrypt, [ - this.account, - ensureLeading0x(ciphertext.toString('hex')), - ]) - - return Buffer.from(trimLeading0x(resp), 'hex') - } - - computeSharedSecret(_publicKey: string) { - throw new Error('Not implemented') - return Promise.resolve(Buffer.from([])) - } -} diff --git a/packages/sdk/wallets/wallet-rpc/src/rpc-wallet.test.ts b/packages/sdk/wallets/wallet-rpc/src/rpc-wallet.test.ts deleted file mode 100644 index dc1e7c051..000000000 --- a/packages/sdk/wallets/wallet-rpc/src/rpc-wallet.test.ts +++ /dev/null @@ -1,256 +0,0 @@ -import { CeloTx, Connection, Provider } from '@celo/connect' -import { testWithGanache } from '@celo/dev-utils/lib/ganache-test' -import { normalizeAddressWith0x, privateKeyToAddress } from '@celo/utils/lib/address' -import { verifySignature } from '@celo/utils/lib/signatureUtils' -import { recoverTransaction, verifyEIP712TypedDataSigner } from '@celo/wallet-base' -import net from 'net' -import Web3 from 'web3' -import { RpcWallet } from './rpc-wallet' - -export const CHAIN_ID = 44378 - -// Sample data from the official EIP-712 example: -// https://github.com/ethereum/EIPs/blob/master/assets/eip-712/Example.js -export const TYPED_DATA = { - types: { - EIP712Domain: [ - { name: 'name', type: 'string' }, - { name: 'version', type: 'string' }, - { name: 'chainId', type: 'uint256' }, - { name: 'verifyingContract', type: 'address' }, - ], - Person: [ - { name: 'name', type: 'string' }, - { name: 'wallet', type: 'address' }, - ], - Mail: [ - { name: 'from', type: 'Person' }, - { name: 'to', type: 'Person' }, - { name: 'contents', type: 'string' }, - ], - }, - primaryType: 'Mail', - domain: { - name: 'Ether Mail', - version: '1', - chainId: 1, - verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', - }, - message: { - from: { - name: 'Cow', - wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', - }, - to: { - name: 'Bob', - wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', - }, - contents: 'Hello, Bob!', - }, -} - -export const PRIVATE_KEY1 = '1234567890abcdef1234567890abcdef1234567890abcdef1234567890abbdef' -export const ACCOUNT_ADDRESS1 = normalizeAddressWith0x(privateKeyToAddress(PRIVATE_KEY1)) -export const PRIVATE_KEY2 = '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890fdeccc' -export const ACCOUNT_ADDRESS2 = normalizeAddressWith0x(privateKeyToAddress(PRIVATE_KEY2)) - -const PASSPHRASE = 'ce10' -const DURATION = 10000 - -// ./build/bin/geth --datadir=./envs/alfajoresstaging --syncmode=lightest --rpcapi=net,eth,web3,personal --networkid=1101 -describe.skip('rpc-wallet', () => { - it('should work against local geth ipc', async () => { - const ipcUrl = '/Users/yorhodes/celo/blockchain/envs/alfajoresstaging/geth.ipc' - const ipcProvider = new Web3.providers.IpcProvider(ipcUrl, net) - const wallet = new RpcWallet(ipcProvider) - await wallet.init() - - const account = await wallet.addAccount(PRIVATE_KEY1, PASSPHRASE) - await wallet.unlockAccount(account, PASSPHRASE, DURATION) - - const tx = { - from: ACCOUNT_ADDRESS1, - to: ACCOUNT_ADDRESS2, - value: 1000, - } - - const result = await wallet.signTransaction(tx) - console.log(result) - - const connection = new Connection(new Web3(ipcUrl), wallet) - const txResult = await connection.sendSignedTransaction(result.raw) - console.log(txResult) - }) -}) - -// It uses personal_importKey RPC call which is not supported in anvil -testWithGanache('rpc-wallet', (web3) => { - const provider = web3.currentProvider - const rpcWallet = new RpcWallet(provider as Provider) - - describe('with ganache web3 provider', () => { - let ganacheAccounts: string[] - beforeAll(async () => { - await rpcWallet.init() - ganacheAccounts = await web3.eth.getAccounts() - ganacheAccounts = ganacheAccounts.map(normalizeAddressWith0x) - }) - - test('initalizes with provider accounts', async () => { - const accounts = rpcWallet.getAccounts() - expect(accounts).toEqual(ganacheAccounts) - }) - - test('fails if you add an invalid private key', async () => { - try { - await rpcWallet.addAccount('this is not a valid private key', PASSPHRASE) - throw new Error('Expected exception to be thrown') - } catch (e: any) { - expect(e.message).toBe('Expected 32 bytes of private key') - } - }) - - test('succeeds if you add a private key without 0x', async () => { - await rpcWallet.addAccount(PRIVATE_KEY1, PASSPHRASE) - expect(rpcWallet.hasAccount(ACCOUNT_ADDRESS1)).toBeTruthy() - }) - - test('fails if you add a private key twice', async () => { - try { - await rpcWallet.addAccount(PRIVATE_KEY1, PASSPHRASE) - throw new Error('Expected exception to be thrown') - } catch (e: any) { - expect(e.message).toBe(`RpcWallet: account already exists`) - } - }) - - test('succeeds if you add a private key with 0x', async () => { - await rpcWallet.addAccount(PRIVATE_KEY2, PASSPHRASE) - expect(rpcWallet.hasAccount(ACCOUNT_ADDRESS2)).toBeTruthy() - }) - - describe('with added accounts', () => { - test('all addresses can be retrieved', () => { - expect(rpcWallet.getAccounts()).toEqual( - ganacheAccounts.concat([ACCOUNT_ADDRESS1, ACCOUNT_ADDRESS2]) - ) - }) - - describe('unlocking', () => { - test('fails if you use an invalid passphrase', async () => { - try { - await rpcWallet.unlockAccount(ACCOUNT_ADDRESS1, 'wrong_passphrase', DURATION) - } catch (e: any) { - expect(e.message).toContain('could not decrypt key with given passphrase') - } - }) - - test('succeeds if you use the correct passphrase', async () => { - await rpcWallet.unlockAccount(ACCOUNT_ADDRESS1, PASSPHRASE, DURATION) - const unlocked = rpcWallet.isAccountUnlocked(ACCOUNT_ADDRESS1) - expect(unlocked).toBeTruthy() - }) - }) - - describe('signing', () => { - describe('using an unlocked address', () => { - beforeAll(async () => { - await rpcWallet.unlockAccount(ACCOUNT_ADDRESS1, PASSPHRASE, DURATION) - }) - - describe('when calling signTransaction', () => { - let celoTransaction: CeloTx - - beforeEach(() => { - celoTransaction = { - from: ACCOUNT_ADDRESS1, - to: ACCOUNT_ADDRESS2, - chainId: CHAIN_ID, - value: web3.utils.toWei('1', 'ether'), - nonce: 0, - gas: '10', - gasPrice: '99', - feeCurrency: '0x', - data: '0xabcdef', - } - }) - - test('succeeds with old school pricing', async () => { - await expect( - rpcWallet.signTransaction(celoTransaction) - ).resolves.toMatchInlineSnapshot( - `"0xf86b8081991094588e4b68193001e4d10928660ab4165b813717c08a0100000000000000000083abcdef25a073bb7eaa60c810af1fad0f68fa15d4714f9990d0202b62797f6134493ec9f6fba046c13e92017228c2c8f0fae74ddd735021817f2f9757cd66debed078daf4070e"` - ) - }) - - test('succeeds with with FeeMarketFields', async () => { - const feeMarketTransaction = { - ...celoTransaction, - gasPrice: undefined, - maxFeePerGas: '1500000000', - maxPriorityFeePerGas: '1500000000', - } - await expect( - rpcWallet.signTransaction(feeMarketTransaction) - ).resolves.toMatchInlineSnapshot( - `"0xf86a80801094588e4b68193001e4d10928660ab4165b813717c08a0100000000000000000083abcdef26a05e9c1e7690d05f3e1433c824fbd948643ff6c618e347ea8c23a6363f3b17cdffa072dc1c22d6147be7b4b7b3cf51eb73b8bedd7940d7b668dcd7ef688a2354a631"` - ) - }) - - // TODO(yorke): enable once fixed: https://github.com/celo-org/celo-monorepo/issues/4077 - test.skip('with same signer', async () => { - const signedTx = await rpcWallet.signTransaction(celoTransaction) - const [, recoveredSigner] = recoverTransaction(signedTx.raw) - expect(normalizeAddressWith0x(recoveredSigner)).toBe( - normalizeAddressWith0x(ACCOUNT_ADDRESS1) - ) - }) - - // https://github.com/ethereum/go-ethereum/blob/38aab0aa831594f31d02c9f02bfacc0bef48405d/rlp/decode.go#L664 - test.skip('signature with 0x00 prefix is canonicalized', async () => { - // This tx is carefully constructed to produce an S value with the first byte as 0x00 - const celoTransactionZeroPrefix = { - from: ACCOUNT_ADDRESS1, - to: ACCOUNT_ADDRESS2, - chainId: CHAIN_ID, - value: web3.utils.toWei('1', 'ether'), - nonce: 65, - gas: '10', - gasPrice: '99', - feeCurrency: '0x' as const, - data: '0xabcdef', - } - - const signedTx = await rpcWallet.signTransaction(celoTransactionZeroPrefix) - expect(signedTx.tx.s.startsWith('0x00')).toBeFalsy() - const [, recoveredSigner] = recoverTransaction(signedTx.raw) - expect(normalizeAddressWith0x(recoveredSigner)).toBe( - normalizeAddressWith0x(ACCOUNT_ADDRESS1) - ) - }) - }) - - // ganache - describe.skip('when calling signPersonalMessage', () => { - test('succeeds', async () => { - const hexStr: string = ACCOUNT_ADDRESS2 - const signedMessage = await rpcWallet.signPersonalMessage(ACCOUNT_ADDRESS1, hexStr) - expect(signedMessage).not.toBeUndefined() - const valid = verifySignature(hexStr, signedMessage, ACCOUNT_ADDRESS1) - expect(valid).toBeTruthy() - }) - }) - - describe.skip('when calling signTypedData', () => { - test('succeeds', async () => { - const signedMessage = await rpcWallet.signTypedData(ACCOUNT_ADDRESS1, TYPED_DATA) - expect(signedMessage).not.toBeUndefined() - const valid = verifyEIP712TypedDataSigner(TYPED_DATA, signedMessage, ACCOUNT_ADDRESS1) - expect(valid).toBeTruthy() - }) - }) - }) - }) - }) - }) -}) diff --git a/packages/sdk/wallets/wallet-rpc/src/rpc-wallet.ts b/packages/sdk/wallets/wallet-rpc/src/rpc-wallet.ts deleted file mode 100644 index 8a98b59aa..000000000 --- a/packages/sdk/wallets/wallet-rpc/src/rpc-wallet.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { ensureLeading0x, normalizeAddressWith0x } from '@celo/base/lib/address' -import { CeloTx, HttpRpcCaller, Provider, RpcCaller } from '@celo/connect' -import { privateKeyToAddress } from '@celo/utils/lib/address' -import { UnlockableWallet } from '@celo/wallet-base' -import { RemoteWallet } from '@celo/wallet-remote' -import { RpcSigner } from './rpc-signer' - -export enum RpcWalletErrors { - FetchAccounts = 'RpcWallet: failed to fetch accounts from server', - AccountAlreadyExists = 'RpcWallet: account already exists', -} - -/** - * WARNING: This class should only be used with well-permissioned providers (ie IPC) - * to avoid sensitive user 'privateKey' and 'passphrase' information being exposed - * - * @deprecated https://forum.celo.org/t/deprecation-of-celo-wallet-rpc/8452 - */ -export class RpcWallet extends RemoteWallet implements UnlockableWallet { - protected readonly rpc: RpcCaller - - constructor(protected _provider: Provider) { - super() - this.rpc = new HttpRpcCaller(_provider) - } - - async loadAccountSigners(): Promise> { - const addressToSigner = new Map() - const resp = await this.rpc.call('eth_accounts', []) - if (resp.error) { - throw new Error(RpcWalletErrors.FetchAccounts) - } - const accounts: string[] = resp.result! - accounts.forEach((account) => { - addressToSigner.set(account, new RpcSigner(this.rpc, account)) - }) - return addressToSigner - } - - async addAccount(privateKey: string, passphrase: string): Promise { - const address = normalizeAddressWith0x(privateKeyToAddress(ensureLeading0x(privateKey))) - if (this.hasAccount(address)) { - throw new Error(RpcWalletErrors.AccountAlreadyExists) - } - const signer = new RpcSigner(this.rpc, address) - const resultantAddress = await signer.init(privateKey, passphrase) - this.addSigner(resultantAddress, signer) - return resultantAddress - } - - async unlockAccount(address: string, passphrase: string, duration: number) { - const signer = this.getSigner(address) - return signer.unlock(passphrase, duration) - } - - isAccountUnlocked(address: string) { - const signer = this.getSigner(address) - return signer.isUnlocked() - } - - /** - * Gets the signer based on the 'from' field in the tx body - * @param txParams Transaction to sign - * @dev overrides WalletBase.signTransaction - */ - async signTransaction(txParams: CeloTx) { - // Get the signer from the 'from' field - const fromAddress = txParams.from!.toString() - const signer = this.getSigner(fromAddress) - return signer.signRawTransaction(txParams) - } -} diff --git a/packages/sdk/wallets/wallet-rpc/src/test-utils/ganache.setup.ts b/packages/sdk/wallets/wallet-rpc/src/test-utils/ganache.setup.ts deleted file mode 100644 index cad7a5e9f..000000000 --- a/packages/sdk/wallets/wallet-rpc/src/test-utils/ganache.setup.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { emptySetup } from '@celo/dev-utils/lib/ganache-setup' -import { waitForPortOpen } from '@celo/dev-utils/lib/network' - -export default async function setup() { - console.log('\nstarting ganache...') - await emptySetup({}) - await waitForPortOpen('localhost', 8545, 60) - console.log('...ganache started') -} diff --git a/packages/sdk/wallets/wallet-rpc/src/test-utils/ganache.teardown.ts b/packages/sdk/wallets/wallet-rpc/src/test-utils/ganache.teardown.ts deleted file mode 100644 index c37e9bb00..000000000 --- a/packages/sdk/wallets/wallet-rpc/src/test-utils/ganache.teardown.ts +++ /dev/null @@ -1,2 +0,0 @@ -import teardown from '@celo/dev-utils/lib/ganache-teardown' -export default teardown diff --git a/packages/sdk/wallets/wallet-rpc/tsconfig.json b/packages/sdk/wallets/wallet-rpc/tsconfig.json deleted file mode 100644 index 5e02869e3..000000000 --- a/packages/sdk/wallets/wallet-rpc/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "@celo/typescript/tsconfig.library.json", - "compilerOptions": { - "rootDir": "src", - "outDir": "lib" - }, - "include": ["src", "src/test-utils"], - "references": [{ "path": "../../utils" }] -} diff --git a/packages/sdk/wallets/wallet-rpc/typedoc.json b/packages/sdk/wallets/wallet-rpc/typedoc.json deleted file mode 100644 index 421adcff9..000000000 --- a/packages/sdk/wallets/wallet-rpc/typedoc.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "exclude": [ - "**/*+(index|.test).ts" - ], - "excludePrivate": true, - "excludeProtected": true, - "hideGenerator": true, - "out": "../../../../docs/sdk/wallet-rpc", - "gitRevision": "master", - "readme": "none", - "entryPoints": [ - "./src" - ], - "githubPages": false, - "plugin": [ - "typedoc-plugin-markdown" - ], - "entryPointStrategy": "expand" -} \ No newline at end of file