diff --git a/.changeset/hot-ghosts-mate.md b/.changeset/hot-ghosts-mate.md new file mode 100644 index 000000000..64d78303f --- /dev/null +++ b/.changeset/hot-ghosts-mate.md @@ -0,0 +1,5 @@ +--- +'@celo/dev-utils': patch +--- + +Introduces testWithAnvil that allows testing against a local anvil instance diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 673da782a..00e3a3851 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -204,13 +204,6 @@ jobs: id-token: write contents: read needs: [install-dependencies] - if: | - - github.base_ref == 'master' || contains(github.base_ref, 'release') || - contains(needs.install-dependencies.outputs.all_modified_files, 'packages/sdk') || - contains(needs.install-dependencies.outputs.all_modified_files, ',package.json') || - contains(needs.install-dependencies.outputs.all_modified_files, ',yarn.lock') || - false steps: - uses: actions/checkout@v4 - name: Sync workspace @@ -233,24 +226,20 @@ jobs: id-token: write contents: read needs: [install-dependencies] - if: | - - github.base_ref == 'master' || contains(github.base_ref, 'staging') || contains(github.base_ref, 'production') || - contains(needs.install-dependencies.outputs.all_modified_files, 'packages/cli') || - contains(needs.install-dependencies.outputs.all_modified_files, 'packages/sdk') || - contains(needs.install-dependencies.outputs.all_modified_files, 'packages/typescript') || - contains(needs.install-dependencies.outputs.all_modified_files, ',package.json') || - contains(needs.install-dependencies.outputs.all_modified_files, ',yarn.lock') || - false steps: - uses: actions/checkout@v4 - name: Sync workspace uses: ./.github/actions/sync-workspace with: artifacts_to_cache: ${{ needs.install-dependencies.outputs.artifacts_to_cache }} + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + version: "nightly-f625d0fa7c51e65b4bf1e8f7931cd1c6e2e285e9" + # NODE_OPTIONS="--experimental-vm-modules" is needed because @viem/anvil uses dynamic imports - name: Run tests run: | - yarn workspace @celo/celocli test --coverage + NODE_OPTIONS="--experimental-vm-modules" yarn workspace @celo/celocli test --coverage - name: Verify that a new account can be created run: | yarn workspace @celo/celocli run celocli account:new diff --git a/README.md b/README.md index e2780f6fa..01b7b7934 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Please use GitHub to: πŸ’¬ [Ask a question](https://github.com/celo-org/developer-tooling/discussions) -✨ [Suggest a feature](httpsi//github.com/celo-org/developer-tooling/issues/new/choose) +✨ [Suggest a feature](https://github.com/celo-org/developer-tooling/issues/new/choose) πŸ§‘β€πŸ’» [Contribute!](/CONTRIBUTING.md) @@ -72,4 +72,4 @@ Check out the following places for more developer tooling-related content: - [@aaronmgdr](https://github.com/aaronmgdr) - [@nicolasbrugneaux](https://github.com/nicolasbrugneaux) - [@shazarre](https://github.com/shazarre) -- [@arthurgousset](https://github.com/arthurgousset) \ No newline at end of file +- [@arthurgousset](https://github.com/arthurgousset) diff --git a/docs/sdk/connect/README.md b/docs/sdk/connect/README.md index 74de1afed..09a911fe3 100644 --- a/docs/sdk/connect/README.md +++ b/docs/sdk/connect/README.md @@ -13,7 +13,7 @@ Please use GitHub to: πŸ’¬ [Ask a question](https://github.com/celo-org/developer-tooling/discussions) -✨ [Suggest a feature](httpsi//github.com/celo-org/developer-tooling/issues/new/choose) +✨ [Suggest a feature](https://github.com/celo-org/developer-tooling/issues/new/choose) πŸ§‘β€πŸ’» [Contribute!](/CONTRIBUTING.md) diff --git a/docs/sdk/contractkit/README.md b/docs/sdk/contractkit/README.md index 761b42a03..8761ddb2b 100644 --- a/docs/sdk/contractkit/README.md +++ b/docs/sdk/contractkit/README.md @@ -30,7 +30,7 @@ Please use GitHub to: πŸ’¬ [Ask a question](https://github.com/celo-org/developer-tooling/discussions) -✨ [Suggest a feature](httpsi//github.com/celo-org/developer-tooling/issues/new/choose) +✨ [Suggest a feature](https://github.com/celo-org/developer-tooling/issues/new/choose) πŸ§‘β€πŸ’» [Contribute!](/CONTRIBUTING.md) diff --git a/docs/sdk/cryptographic-utils/README.md b/docs/sdk/cryptographic-utils/README.md index a96c987b7..8092dfd3f 100644 --- a/docs/sdk/cryptographic-utils/README.md +++ b/docs/sdk/cryptographic-utils/README.md @@ -17,7 +17,7 @@ Please use GitHub to: πŸ’¬ [Ask a question](https://github.com/celo-org/developer-tooling/discussions) -✨ [Suggest a feature](httpsi//github.com/celo-org/developer-tooling/issues/new/choose) +✨ [Suggest a feature](https://github.com/celo-org/developer-tooling/issues/new/choose) πŸ§‘β€πŸ’» [Contribute!](/CONTRIBUTING.md) diff --git a/docs/sdk/phone-utils/README.md b/docs/sdk/phone-utils/README.md index 8ed8b2212..dd8898afd 100644 --- a/docs/sdk/phone-utils/README.md +++ b/docs/sdk/phone-utils/README.md @@ -17,7 +17,7 @@ Please use GitHub to: πŸ’¬ [Ask a question](https://github.com/celo-org/developer-tooling/discussions) -✨ [Suggest a feature](httpsi//github.com/celo-org/developer-tooling/issues/new/choose) +✨ [Suggest a feature](https://github.com/celo-org/developer-tooling/issues/new/choose) πŸ§‘β€πŸ’» [Contribute!](/CONTRIBUTING.md) diff --git a/docs/sdk/wallet-base/interfaces/signing_utils.LegacyEncodedTx.md b/docs/sdk/wallet-base/interfaces/signing_utils.LegacyEncodedTx.md new file mode 100644 index 000000000..bc183e40a --- /dev/null +++ b/docs/sdk/wallet-base/interfaces/signing_utils.LegacyEncodedTx.md @@ -0,0 +1,43 @@ +[@celo/wallet-base](../README.md) / [signing-utils](../modules/signing_utils.md) / LegacyEncodedTx + +# Interface: LegacyEncodedTx + +[signing-utils](../modules/signing_utils.md).LegacyEncodedTx + +## Table of contents + +### Properties + +- [rlpEncode](signing_utils.LegacyEncodedTx.md#rlpencode) +- [transaction](signing_utils.LegacyEncodedTx.md#transaction) +- [type](signing_utils.LegacyEncodedTx.md#type) + +## Properties + +### rlpEncode + +β€’ **rlpEncode**: \`0x$\{string}\` + +#### Defined in + +[wallets/wallet-base/src/signing-utils.ts:217](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L217) + +___ + +### transaction + +β€’ **transaction**: `FormattedCeloTx` + +#### Defined in + +[wallets/wallet-base/src/signing-utils.ts:218](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L218) + +___ + +### type + +β€’ **type**: ``"celo-legacy"`` + +#### Defined in + +[wallets/wallet-base/src/signing-utils.ts:216](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L216) diff --git a/docs/sdk/wallet-base/modules/index.md b/docs/sdk/wallet-base/modules/index.md index 23722250b..44c6546cc 100644 --- a/docs/sdk/wallet-base/modules/index.md +++ b/docs/sdk/wallet-base/modules/index.md @@ -6,6 +6,7 @@ ### References +- [LegacyEncodedTx](index.md#legacyencodedtx) - [UnlockableWallet](index.md#unlockablewallet) - [Wallet](index.md#wallet) - [WalletBase](index.md#walletbase) @@ -13,6 +14,7 @@ - [decodeSig](index.md#decodesig) - [determineTXType](index.md#determinetxtype) - [encodeTransaction](index.md#encodetransaction) +- [encode\_deprecated\_celo\_legacy\_type\_only\_for\_temporary\_ledger\_compat](index.md#encode_deprecated_celo_legacy_type_only_for_temporary_ledger_compat) - [extractPublicKeyFromHashAndSignature](index.md#extractpublickeyfromhashandsignature) - [extractSignature](index.md#extractsignature) - [getHashFromEncoded](index.md#gethashfromencoded) @@ -21,6 +23,8 @@ - [handleData](index.md#handledata) - [handleHexString](index.md#handlehexstring) - [handleNumber](index.md#handlenumber) +- [isCIP64](index.md#iscip64) +- [isEIP1559](index.md#iseip1559) - [isPriceToLow](index.md#ispricetolow) - [publicKeyPrefix](index.md#publickeyprefix) - [recoverMessageSigner](index.md#recovermessagesigner) @@ -35,6 +39,12 @@ ## References +### LegacyEncodedTx + +Re-exports [LegacyEncodedTx](../interfaces/signing_utils.LegacyEncodedTx.md) + +___ + ### UnlockableWallet Re-exports [UnlockableWallet](../interfaces/wallet_base.UnlockableWallet.md) @@ -77,6 +87,12 @@ Re-exports [encodeTransaction](signing_utils.md#encodetransaction) ___ +### encode\_deprecated\_celo\_legacy\_type\_only\_for\_temporary\_ledger\_compat + +Re-exports [encode_deprecated_celo_legacy_type_only_for_temporary_ledger_compat](signing_utils.md#encode_deprecated_celo_legacy_type_only_for_temporary_ledger_compat) + +___ + ### extractPublicKeyFromHashAndSignature Re-exports [extractPublicKeyFromHashAndSignature](signing_utils.md#extractpublickeyfromhashandsignature) @@ -125,6 +141,18 @@ Re-exports [handleNumber](signing_utils.md#handlenumber) ___ +### isCIP64 + +Re-exports [isCIP64](signing_utils.md#iscip64) + +___ + +### isEIP1559 + +Re-exports [isEIP1559](signing_utils.md#iseip1559) + +___ + ### isPriceToLow Re-exports [isPriceToLow](signing_utils.md#ispricetolow) diff --git a/docs/sdk/wallet-base/modules/signing_utils.md b/docs/sdk/wallet-base/modules/signing_utils.md index 8992c0309..feae00fce 100644 --- a/docs/sdk/wallet-base/modules/signing_utils.md +++ b/docs/sdk/wallet-base/modules/signing_utils.md @@ -4,6 +4,10 @@ ## Table of contents +### Interfaces + +- [LegacyEncodedTx](../interfaces/signing_utils.LegacyEncodedTx.md) + ### Variables - [publicKeyPrefix](signing_utils.md#publickeyprefix) @@ -16,6 +20,7 @@ - [decodeSig](signing_utils.md#decodesig) - [determineTXType](signing_utils.md#determinetxtype) - [encodeTransaction](signing_utils.md#encodetransaction) +- [encode\_deprecated\_celo\_legacy\_type\_only\_for\_temporary\_ledger\_compat](signing_utils.md#encode_deprecated_celo_legacy_type_only_for_temporary_ledger_compat) - [extractPublicKeyFromHashAndSignature](signing_utils.md#extractpublickeyfromhashandsignature) - [extractSignature](signing_utils.md#extractsignature) - [getHashFromEncoded](signing_utils.md#gethashfromencoded) @@ -24,6 +29,8 @@ - [handleData](signing_utils.md#handledata) - [handleHexString](signing_utils.md#handlehexstring) - [handleNumber](signing_utils.md#handlenumber) +- [isCIP64](signing_utils.md#iscip64) +- [isEIP1559](signing_utils.md#iseip1559) - [isPriceToLow](signing_utils.md#ispricetolow) - [recoverMessageSigner](signing_utils.md#recovermessagesigner) - [recoverTransaction](signing_utils.md#recovertransaction) @@ -41,7 +48,7 @@ #### Defined in -[wallets/wallet-base/src/signing-utils.ts:52](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L52) +[wallets/wallet-base/src/signing-utils.ts:53](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L53) ___ @@ -51,7 +58,7 @@ ___ #### Defined in -[wallets/wallet-base/src/signing-utils.ts:53](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L53) +[wallets/wallet-base/src/signing-utils.ts:54](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L54) ___ @@ -61,7 +68,7 @@ ___ #### Defined in -[wallets/wallet-base/src/signing-utils.ts:54](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L54) +[wallets/wallet-base/src/signing-utils.ts:55](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L55) ## Functions @@ -81,7 +88,7 @@ ___ #### Defined in -[wallets/wallet-base/src/signing-utils.ts:68](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L68) +[wallets/wallet-base/src/signing-utils.ts:69](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L69) ___ @@ -108,7 +115,7 @@ ___ #### Defined in -[wallets/wallet-base/src/signing-utils.ts:748](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L748) +[wallets/wallet-base/src/signing-utils.ts:799](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L799) ___ @@ -128,7 +135,7 @@ ___ #### Defined in -[wallets/wallet-base/src/signing-utils.ts:470](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L470) +[wallets/wallet-base/src/signing-utils.ts:521](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L521) ___ @@ -140,7 +147,7 @@ ___ | Name | Type | | :------ | :------ | -| `rlpEncoded` | `RLPEncodedTx` | +| `rlpEncoded` | `RLPEncodedTx` \| [`LegacyEncodedTx`](../interfaces/signing_utils.LegacyEncodedTx.md) | | `signature` | `Object` | | `signature.r` | `Buffer` | | `signature.s` | `Buffer` | @@ -152,7 +159,27 @@ ___ #### Defined in -[wallets/wallet-base/src/signing-utils.ts:300](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L300) +[wallets/wallet-base/src/signing-utils.ts:349](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L349) + +___ + +### encode\_deprecated\_celo\_legacy\_type\_only\_for\_temporary\_ledger\_compat + +β–Έ **encode_deprecated_celo_legacy_type_only_for_temporary_ledger_compat**(`tx`): [`LegacyEncodedTx`](../interfaces/signing_utils.LegacyEncodedTx.md) + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `tx` | `CeloTx` | + +#### Returns + +[`LegacyEncodedTx`](../interfaces/signing_utils.LegacyEncodedTx.md) + +#### Defined in + +[wallets/wallet-base/src/signing-utils.ts:222](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L222) ___ @@ -178,7 +205,7 @@ ___ #### Defined in -[wallets/wallet-base/src/signing-utils.ts:758](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L758) +[wallets/wallet-base/src/signing-utils.ts:809](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L809) ___ @@ -204,7 +231,7 @@ ___ #### Defined in -[wallets/wallet-base/src/signing-utils.ts:390](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L390) +[wallets/wallet-base/src/signing-utils.ts:441](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L441) ___ @@ -224,7 +251,7 @@ ___ #### Defined in -[wallets/wallet-base/src/signing-utils.ts:72](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L72) +[wallets/wallet-base/src/signing-utils.ts:73](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L73) ___ @@ -244,7 +271,7 @@ ___ #### Defined in -[wallets/wallet-base/src/signing-utils.ts:460](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L460) +[wallets/wallet-base/src/signing-utils.ts:511](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L511) ___ @@ -264,7 +291,7 @@ ___ #### Defined in -[wallets/wallet-base/src/signing-utils.ts:786](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L786) +[wallets/wallet-base/src/signing-utils.ts:837](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L837) ___ @@ -284,7 +311,7 @@ ___ #### Defined in -[wallets/wallet-base/src/signing-utils.ts:800](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L800) +[wallets/wallet-base/src/signing-utils.ts:851](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L851) ___ @@ -304,7 +331,7 @@ ___ #### Defined in -[wallets/wallet-base/src/signing-utils.ts:792](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L792) +[wallets/wallet-base/src/signing-utils.ts:843](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L843) ___ @@ -324,7 +351,47 @@ ___ #### Defined in -[wallets/wallet-base/src/signing-utils.ts:780](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L780) +[wallets/wallet-base/src/signing-utils.ts:831](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L831) + +___ + +### isCIP64 + +β–Έ **isCIP64**(`tx`): `boolean` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `tx` | `CeloTx` | + +#### Returns + +`boolean` + +#### Defined in + +[wallets/wallet-base/src/signing-utils.ts:328](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L328) + +___ + +### isEIP1559 + +β–Έ **isEIP1559**(`tx`): `boolean` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `tx` | `CeloTx` | + +#### Returns + +`boolean` + +#### Defined in + +[wallets/wallet-base/src/signing-utils.ts:324](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L324) ___ @@ -344,7 +411,7 @@ ___ #### Defined in -[wallets/wallet-base/src/signing-utils.ts:261](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L261) +[wallets/wallet-base/src/signing-utils.ts:310](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L310) ___ @@ -365,7 +432,7 @@ ___ #### Defined in -[wallets/wallet-base/src/signing-utils.ts:716](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L716) +[wallets/wallet-base/src/signing-utils.ts:767](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L767) ___ @@ -385,7 +452,7 @@ ___ #### Defined in -[wallets/wallet-base/src/signing-utils.ts:421](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L421) +[wallets/wallet-base/src/signing-utils.ts:472](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L472) ___ @@ -405,7 +472,7 @@ ___ #### Defined in -[wallets/wallet-base/src/signing-utils.ts:130](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L130) +[wallets/wallet-base/src/signing-utils.ts:131](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L131) ___ @@ -433,7 +500,7 @@ ___ #### Defined in -[wallets/wallet-base/src/signing-utils.ts:771](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L771) +[wallets/wallet-base/src/signing-utils.ts:822](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L822) ___ @@ -453,7 +520,7 @@ ___ #### Defined in -[wallets/wallet-base/src/signing-utils.ts:111](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L111) +[wallets/wallet-base/src/signing-utils.ts:112](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L112) ___ @@ -475,7 +542,7 @@ ___ #### Defined in -[wallets/wallet-base/src/signing-utils.ts:726](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L726) +[wallets/wallet-base/src/signing-utils.ts:777](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L777) ___ @@ -497,4 +564,4 @@ ___ #### Defined in -[wallets/wallet-base/src/signing-utils.ts:735](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L735) +[wallets/wallet-base/src/signing-utils.ts:786](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L786) diff --git a/docs/sdk/wallet-ledger/README.md b/docs/sdk/wallet-ledger/README.md index 227f784dc..be7dbb496 100644 --- a/docs/sdk/wallet-ledger/README.md +++ b/docs/sdk/wallet-ledger/README.md @@ -6,6 +6,7 @@ ### Modules +- [data](modules/data.md) - [index](modules/index.md) - [ledger-signer](modules/ledger_signer.md) - [ledger-utils](modules/ledger_utils.md) diff --git a/docs/sdk/wallet-ledger/classes/ledger_signer.LedgerSigner.md b/docs/sdk/wallet-ledger/classes/ledger_signer.LedgerSigner.md index 762a275cd..176b686bc 100644 --- a/docs/sdk/wallet-ledger/classes/ledger_signer.LedgerSigner.md +++ b/docs/sdk/wallet-ledger/classes/ledger_signer.LedgerSigner.md @@ -48,7 +48,7 @@ Signs the EVM transaction with a Ledger device #### Defined in -[wallet-ledger/src/ledger-signer.ts:27](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-signer.ts#L27) +[wallet-ledger/src/ledger-signer.ts:26](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-signer.ts#L26) ## Methods @@ -72,7 +72,7 @@ Signer.computeSharedSecret #### Defined in -[wallet-ledger/src/ledger-signer.ts:201](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-signer.ts#L201) +[wallet-ledger/src/ledger-signer.ts:200](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-signer.ts#L200) ___ @@ -96,7 +96,7 @@ Signer.decrypt #### Defined in -[wallet-ledger/src/ledger-signer.ts:195](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-signer.ts#L195) +[wallet-ledger/src/ledger-signer.ts:194](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-signer.ts#L194) ___ @@ -114,7 +114,7 @@ Signer.getNativeKey #### Defined in -[wallet-ledger/src/ledger-signer.ts:42](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-signer.ts#L42) +[wallet-ledger/src/ledger-signer.ts:41](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-signer.ts#L41) ___ @@ -138,7 +138,7 @@ Signer.signPersonalMessage #### Defined in -[wallet-ledger/src/ledger-signer.ts:90](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-signer.ts#L90) +[wallet-ledger/src/ledger-signer.ts:89](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-signer.ts#L89) ___ @@ -151,7 +151,7 @@ ___ | Name | Type | | :------ | :------ | | `addToV` | `number` | -| `encodedTx` | `RLPEncodedTx` | +| `encodedTx` | `RLPEncodedTx` \| `LegacyEncodedTx` | #### Returns @@ -163,7 +163,7 @@ Signer.signTransaction #### Defined in -[wallet-ledger/src/ledger-signer.ts:46](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-signer.ts#L46) +[wallet-ledger/src/ledger-signer.ts:45](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-signer.ts#L45) ___ @@ -187,4 +187,4 @@ Signer.signTypedData #### Defined in -[wallet-ledger/src/ledger-signer.ts:110](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-signer.ts#L110) +[wallet-ledger/src/ledger-signer.ts:109](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-signer.ts#L109) diff --git a/docs/sdk/wallet-ledger/classes/ledger_wallet.LedgerWallet.md b/docs/sdk/wallet-ledger/classes/ledger_wallet.LedgerWallet.md index ff3d1b249..a61f49844 100644 --- a/docs/sdk/wallet-ledger/classes/ledger_wallet.LedgerWallet.md +++ b/docs/sdk/wallet-ledger/classes/ledger_wallet.LedgerWallet.md @@ -24,10 +24,14 @@ - [baseDerivationPath](ledger_wallet.LedgerWallet.md#basederivationpath) - [derivationPathIndexes](ledger_wallet.LedgerWallet.md#derivationpathindexes) +- [isCel2](ledger_wallet.LedgerWallet.md#iscel2) - [isSetupFinished](ledger_wallet.LedgerWallet.md#issetupfinished) - [ledger](ledger_wallet.LedgerWallet.md#ledger) - [ledgerAddressValidation](ledger_wallet.LedgerWallet.md#ledgeraddressvalidation) - [transport](ledger_wallet.LedgerWallet.md#transport) +- [MIN\_VERSION\_EIP1559](ledger_wallet.LedgerWallet.md#min_version_eip1559) +- [MIN\_VERSION\_SUPPORTED](ledger_wallet.LedgerWallet.md#min_version_supported) +- [MIN\_VERSION\_TOKEN\_DATA](ledger_wallet.LedgerWallet.md#min_version_token_data) ### Methods @@ -37,6 +41,7 @@ - [hasAccount](ledger_wallet.LedgerWallet.md#hasaccount) - [init](ledger_wallet.LedgerWallet.md#init) - [removeAccount](ledger_wallet.LedgerWallet.md#removeaccount) +- [rlpEncodedTxForLedger](ledger_wallet.LedgerWallet.md#rlpencodedtxforledger) - [signPersonalMessage](ledger_wallet.LedgerWallet.md#signpersonalmessage) - [signTransaction](ledger_wallet.LedgerWallet.md#signtransaction) - [signTypedData](ledger_wallet.LedgerWallet.md#signtypeddata) @@ -45,7 +50,7 @@ ### constructor -β€’ **new LedgerWallet**(`derivationPathIndexes?`, `baseDerivationPath?`, `transport?`, `ledgerAddressValidation?`): [`LedgerWallet`](ledger_wallet.LedgerWallet.md) +β€’ **new LedgerWallet**(`derivationPathIndexes?`, `baseDerivationPath?`, `transport?`, `ledgerAddressValidation?`, `isCel2?`): [`LedgerWallet`](ledger_wallet.LedgerWallet.md) #### Parameters @@ -55,6 +60,7 @@ | `baseDerivationPath` | `string` | `CELO_BASE_DERIVATION_PATH` | base derivation path. Default: "44'/52752'/0'/0" | | `transport` | `any` | `{}` | Transport to connect the ledger device | | `ledgerAddressValidation` | [`AddressValidation`](../enums/ledger_wallet.AddressValidation.md) | `AddressValidation.firstTransactionPerAddress` | - | +| `isCel2?` | `boolean` | `undefined` | - | #### Returns @@ -66,7 +72,7 @@ RemoteWallet\<LedgerSigner\>.constructor #### Defined in -[wallet-ledger/src/ledger-wallet.ts:57](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-wallet.ts#L57) +[wallet-ledger/src/ledger-wallet.ts:69](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-wallet.ts#L69) ## Properties @@ -78,7 +84,7 @@ base derivation path. Default: "44'/52752'/0'/0" #### Defined in -[wallet-ledger/src/ledger-wallet.ts:59](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-wallet.ts#L59) +[wallet-ledger/src/ledger-wallet.ts:71](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-wallet.ts#L71) ___ @@ -93,7 +99,17 @@ Example: [3, 99, 53] will retrieve the derivation paths of #### Defined in -[wallet-ledger/src/ledger-wallet.ts:58](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-wallet.ts#L58) +[wallet-ledger/src/ledger-wallet.ts:70](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-wallet.ts#L70) + +___ + +### isCel2 + +β€’ `Optional` `Readonly` **isCel2**: `boolean` + +#### Defined in + +[wallet-ledger/src/ledger-wallet.ts:74](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-wallet.ts#L74) ___ @@ -125,7 +141,7 @@ ___ #### Defined in -[wallet-ledger/src/ledger-wallet.ts:47](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-wallet.ts#L47) +[wallet-ledger/src/ledger-wallet.ts:59](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-wallet.ts#L59) ___ @@ -135,7 +151,7 @@ ___ #### Defined in -[wallet-ledger/src/ledger-wallet.ts:61](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-wallet.ts#L61) +[wallet-ledger/src/ledger-wallet.ts:73](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-wallet.ts#L73) ___ @@ -147,7 +163,37 @@ Transport to connect the ledger device #### Defined in -[wallet-ledger/src/ledger-wallet.ts:60](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-wallet.ts#L60) +[wallet-ledger/src/ledger-wallet.ts:72](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-wallet.ts#L72) + +___ + +### MIN\_VERSION\_EIP1559 + +β–ͺ `Static` **MIN\_VERSION\_EIP1559**: `string` = `'1.2.0'` + +#### Defined in + +[wallet-ledger/src/ledger-wallet.ts:58](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-wallet.ts#L58) + +___ + +### MIN\_VERSION\_SUPPORTED + +β–ͺ `Static` **MIN\_VERSION\_SUPPORTED**: `string` = `'1.0.0'` + +#### Defined in + +[wallet-ledger/src/ledger-wallet.ts:56](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-wallet.ts#L56) + +___ + +### MIN\_VERSION\_TOKEN\_DATA + +β–ͺ `Static` **MIN\_VERSION\_TOKEN\_DATA**: `string` = `'1.0.2'` + +#### Defined in + +[wallet-ledger/src/ledger-wallet.ts:57](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-wallet.ts#L57) ## Methods @@ -316,6 +362,26 @@ wallet-base/lib/wallet-base.d.ts:23 ___ +### rlpEncodedTxForLedger + +β–Έ **rlpEncodedTxForLedger**(`txParams`): `Promise`\<`RLPEncodedTx` \| `LegacyEncodedTx`\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `txParams` | `CeloTx` | + +#### Returns + +`Promise`\<`RLPEncodedTx` \| `LegacyEncodedTx`\> + +#### Defined in + +[wallet-ledger/src/ledger-wallet.ts:98](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-wallet.ts#L98) + +___ + ### signPersonalMessage β–Έ **signPersonalMessage**(`address`, `data`): `Promise`\<`string`\> @@ -371,7 +437,7 @@ RemoteWallet.signTransaction #### Defined in -[wallet-ledger/src/ledger-wallet.ts:72](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-wallet.ts#L72) +[wallet-ledger/src/ledger-wallet.ts:85](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-wallet.ts#L85) ___ diff --git a/docs/sdk/wallet-ledger/enums/ledger_wallet.AddressValidation.md b/docs/sdk/wallet-ledger/enums/ledger_wallet.AddressValidation.md index fac61ee74..ae8621587 100644 --- a/docs/sdk/wallet-ledger/enums/ledger_wallet.AddressValidation.md +++ b/docs/sdk/wallet-ledger/enums/ledger_wallet.AddressValidation.md @@ -21,7 +21,7 @@ #### Defined in -[wallet-ledger/src/ledger-wallet.ts:20](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-wallet.ts#L20) +[wallet-ledger/src/ledger-wallet.ts:28](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-wallet.ts#L28) ___ @@ -31,7 +31,7 @@ ___ #### Defined in -[wallet-ledger/src/ledger-wallet.ts:22](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-wallet.ts#L22) +[wallet-ledger/src/ledger-wallet.ts:30](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-wallet.ts#L30) ___ @@ -41,7 +41,7 @@ ___ #### Defined in -[wallet-ledger/src/ledger-wallet.ts:18](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-wallet.ts#L18) +[wallet-ledger/src/ledger-wallet.ts:26](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-wallet.ts#L26) ___ @@ -51,4 +51,4 @@ ___ #### Defined in -[wallet-ledger/src/ledger-wallet.ts:24](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-wallet.ts#L24) +[wallet-ledger/src/ledger-wallet.ts:32](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-wallet.ts#L32) diff --git a/docs/sdk/wallet-ledger/interfaces/tokens.API.md b/docs/sdk/wallet-ledger/interfaces/tokens.API.md index 05f7e2450..2e89fab38 100644 --- a/docs/sdk/wallet-ledger/interfaces/tokens.API.md +++ b/docs/sdk/wallet-ledger/interfaces/tokens.API.md @@ -33,7 +33,7 @@ #### Defined in -[wallet-ledger/src/tokens.ts:45](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/tokens.ts#L45) +[wallet-ledger/src/tokens.ts:36](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/tokens.ts#L36) ___ @@ -51,4 +51,4 @@ ___ #### Defined in -[wallet-ledger/src/tokens.ts:46](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/tokens.ts#L46) +[wallet-ledger/src/tokens.ts:37](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/tokens.ts#L37) diff --git a/docs/sdk/wallet-ledger/interfaces/tokens.TokenInfo.md b/docs/sdk/wallet-ledger/interfaces/tokens.TokenInfo.md index 4a23bf9b9..31ebb59b4 100644 --- a/docs/sdk/wallet-ledger/interfaces/tokens.TokenInfo.md +++ b/docs/sdk/wallet-ledger/interfaces/tokens.TokenInfo.md @@ -23,7 +23,7 @@ #### Defined in -[wallet-ledger/src/tokens.ts:22](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/tokens.ts#L22) +[wallet-ledger/src/tokens.ts:30](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/tokens.ts#L30) ___ @@ -33,7 +33,7 @@ ___ #### Defined in -[wallet-ledger/src/tokens.ts:19](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/tokens.ts#L19) +[wallet-ledger/src/tokens.ts:27](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/tokens.ts#L27) ___ @@ -43,7 +43,7 @@ ___ #### Defined in -[wallet-ledger/src/tokens.ts:24](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/tokens.ts#L24) +[wallet-ledger/src/tokens.ts:32](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/tokens.ts#L32) ___ @@ -53,7 +53,7 @@ ___ #### Defined in -[wallet-ledger/src/tokens.ts:21](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/tokens.ts#L21) +[wallet-ledger/src/tokens.ts:29](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/tokens.ts#L29) ___ @@ -63,7 +63,7 @@ ___ #### Defined in -[wallet-ledger/src/tokens.ts:23](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/tokens.ts#L23) +[wallet-ledger/src/tokens.ts:31](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/tokens.ts#L31) ___ @@ -73,4 +73,4 @@ ___ #### Defined in -[wallet-ledger/src/tokens.ts:20](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/tokens.ts#L20) +[wallet-ledger/src/tokens.ts:28](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/tokens.ts#L28) diff --git a/docs/sdk/wallet-ledger/modules/data.md b/docs/sdk/wallet-ledger/modules/data.md new file mode 100644 index 000000000..9f1d125b2 --- /dev/null +++ b/docs/sdk/wallet-ledger/modules/data.md @@ -0,0 +1,30 @@ +[@celo/wallet-ledger](../README.md) / data + +# Module: data + +## Table of contents + +### Variables + +- [default](data.md#default) +- [legacyLedgerPublicKeyHex](data.md#legacyledgerpublickeyhex) + +## Variables + +### default + +β€’ **default**: ``"AAAAaARDRUxPRx7ON1DaI3+TuOM5xTaYm4l4pDgAAAASAACk7DBFAiEA5rECRg94+fCoIvoG9/5qWh62zl2C6Y+aFuuZrFe4CtcCIEJbRrkL3gqwT/Jj+7L3neazgpVCCTZZ3HX9JXXg5vleAAAAaARjVVNEdl3oFoRYYedaJfyhIrtomLixKCoAAAASAACk7DBFAiEApwQFHNBKXp+V2jq8BMD2y/5AwC9bhPQ2H4hT/vMl/B4CIFalOVtBFGREUKMU/F5vDlJLeQrTn6GQeDertpB2FpMvAAAAaARjRVVS2HY8uidqNzjm3oW0s79f3tbWynMAAAASAACk7DBFAiEAh2UeP1+SI2Ed5SiAjpJF6MkMrVa94gUwjJztyBlzhWMCIHfaOrEsxdxAGx+P+hxuSNO4zcw6KRLfJkkuic1V/CrHAAAAagZiIENFTE/dyb5X9VP+dXUtYWBrlMvX4CZO+AAAABIAAPNwMEUCIQCi62KsBfuNcfX0MriiRZ7a5DKERhtIz7sZ1SqBT7ruhgIgVrfmavyWzxzDW4AQeHn++A4qPjB1pQKoHvNXo8Hf1SMAAABpBmIgY1VTRGJJKmRKWI/ZBCcL7QatUrmr/qGuAAAAEgAA83AwRAIgGDYx4oB/gkYUqLeXqvEZXx9nOxVHzTe2ajyd2wnehxgCICQBe/rBPcXiaQJj3pdoXxroct/hV6r3G2G7y79EOEAPAAAAaQZiIGNFVVL57OMBJHrSziGJSUGDCiRw9Od0ygAAABIAAPNwMEQCIEdcFWP+HxEUoF1sCGVd34QGS0hL5cVUdrWdqVm3bYTgAiBCMA+Rg3Ubc3xla/35wzZesPlbeSMEPcr4uqL+8PeydwAAAGoGYSBDRUxP8ZSv31CwPmm9fQV8GqnhDJlU5MkAAAASAACu8zBFAiEAk/o0FBus2/QCrunFGEyoneQIRaMRC+y5L6Dvar8MU/kCIByJt2ziRhDG3AAbyXBIuJfZQujSHFcSJL3xF0xIlcPdAAAAaQZhIGNVU0SHQGn6HrFtRNYi8uDKJe6hcjabwQAAABIAAK7zMEQCIClrH2xgE3WMbD+hgQ7t5SiAcVG5WiUZ655voqCszKEoAiA/cO8UVgNY891MNJ5yeDk8w47WO0E1DQecrK71LR8g8gAAAGoGYSBjRVVSEMiSpuxDpT5F0LkWtLfTg7G3jA8AAAASAACu8zBFAiEAgpktbB1ZxyAwMJwKTSbZ30n8zgRuW0twbXoZxlsUAswCIHek4l4CIbjVMG2HVr0Ml9/8kA4F9dr69JBMaoSUkdKl"`` + +#### Defined in + +[wallet-ledger/src/data.ts:1](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/data.ts#L1) + +___ + +### legacyLedgerPublicKeyHex + +β€’ `Const` **legacyLedgerPublicKeyHex**: `string` + +#### Defined in + +[wallet-ledger/src/data.ts:11](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/data.ts#L11) diff --git a/docs/sdk/wallet-ledger/modules/ledger_utils.md b/docs/sdk/wallet-ledger/modules/ledger_utils.md index 3a872213f..586407a4f 100644 --- a/docs/sdk/wallet-ledger/modules/ledger_utils.md +++ b/docs/sdk/wallet-ledger/modules/ledger_utils.md @@ -6,10 +6,35 @@ ### Functions +- [meetsVersionRequirements](ledger_utils.md#meetsversionrequirements) - [transportErrorFriendlyMessage](ledger_utils.md#transporterrorfriendlymessage) ## Functions +### meetsVersionRequirements + +β–Έ **meetsVersionRequirements**(`version`, `Β«destructuredΒ»`): `boolean` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `version` | `string` \| `SemVer` | +| `Β«destructuredΒ»` | `Object` | +| β€ΊΒ `inclusive?` | `boolean` | +| β€ΊΒ `maximum?` | `string` \| `SemVer` | +| β€ΊΒ `minimum?` | `string` \| `SemVer` | + +#### Returns + +`boolean` + +#### Defined in + +[wallet-ledger/src/ledger-utils.ts:17](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-utils.ts#L17) + +___ + ### transportErrorFriendlyMessage β–Έ **transportErrorFriendlyMessage**(`error`): `void` @@ -26,4 +51,4 @@ #### Defined in -[wallet-ledger/src/ledger-utils.ts:5](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-utils.ts#L5) +[wallet-ledger/src/ledger-utils.ts:6](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-utils.ts#L6) diff --git a/docs/sdk/wallet-ledger/modules/ledger_wallet.md b/docs/sdk/wallet-ledger/modules/ledger_wallet.md index cd4e7fee0..d06c44f57 100644 --- a/docs/sdk/wallet-ledger/modules/ledger_wallet.md +++ b/docs/sdk/wallet-ledger/modules/ledger_wallet.md @@ -28,13 +28,13 @@ #### Defined in -[wallet-ledger/src/ledger-wallet.ts:12](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-wallet.ts#L12) +[wallet-ledger/src/ledger-wallet.ts:20](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-wallet.ts#L20) ## Functions ### newLedgerWalletWithSetup -β–Έ **newLedgerWalletWithSetup**(`transport`, `derivationPathIndexes?`, `baseDerivationPath?`, `ledgerAddressValidation?`): `Promise`\<[`LedgerWallet`](../classes/ledger_wallet.LedgerWallet.md)\> +β–Έ **newLedgerWalletWithSetup**(`transport`, `derivationPathIndexes?`, `baseDerivationPath?`, `ledgerAddressValidation?`, `isCel2?`): `Promise`\<[`LedgerWallet`](../classes/ledger_wallet.LedgerWallet.md)\> #### Parameters @@ -44,6 +44,7 @@ | `derivationPathIndexes?` | `number`[] | | `baseDerivationPath?` | `string` | | `ledgerAddressValidation?` | [`AddressValidation`](../enums/ledger_wallet.AddressValidation.md) | +| `isCel2?` | `boolean` | #### Returns @@ -51,4 +52,4 @@ #### Defined in -[wallet-ledger/src/ledger-wallet.ts:27](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-wallet.ts#L27) +[wallet-ledger/src/ledger-wallet.ts:35](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-wallet.ts#L35) diff --git a/docs/sdk/wallet-ledger/modules/tokens.md b/docs/sdk/wallet-ledger/modules/tokens.md index 543ace37a..19e6ce332 100644 --- a/docs/sdk/wallet-ledger/modules/tokens.md +++ b/docs/sdk/wallet-ledger/modules/tokens.md @@ -11,34 +11,31 @@ ### Functions -- [compareLedgerAppVersions](tokens.md#compareledgerappversions) +- [legacyTokenInfoByAddressAndChainId](tokens.md#legacytokeninfobyaddressandchainid) - [list](tokens.md#list) +- [listLegacy](tokens.md#listlegacy) - [tokenInfoByAddressAndChainId](tokens.md#tokeninfobyaddressandchainid) ## Functions -### compareLedgerAppVersions +### legacyTokenInfoByAddressAndChainId -β–Έ **compareLedgerAppVersions**(`version1`, `version2`): `number` +β–Έ **legacyTokenInfoByAddressAndChainId**(`contract`, `chainId`): `undefined` \| ``null`` \| [`TokenInfo`](../interfaces/tokens.TokenInfo.md) #### Parameters | Name | Type | | :------ | :------ | -| `version1` | `string` | -| `version2` | `string` | +| `contract` | `string` | +| `chainId` | `number` | #### Returns -`number` - --1: version1 < version2, - 0: version1 == version2, - 1: version1 > version2 +`undefined` \| ``null`` \| [`TokenInfo`](../interfaces/tokens.TokenInfo.md) #### Defined in -[wallet-ledger/src/tokens.ts:33](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/tokens.ts#L33) +[wallet-ledger/src/tokens.ts:14](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/tokens.ts#L14) ___ @@ -54,7 +51,21 @@ list all the ERC20 tokens informations #### Defined in -[wallet-ledger/src/tokens.ts:16](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/tokens.ts#L16) +[wallet-ledger/src/tokens.ts:23](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/tokens.ts#L23) + +___ + +### listLegacy + +β–Έ **listLegacy**(): [`TokenInfo`](../interfaces/tokens.TokenInfo.md)[] + +#### Returns + +[`TokenInfo`](../interfaces/tokens.TokenInfo.md)[] + +#### Defined in + +[wallet-ledger/src/tokens.ts:24](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/tokens.ts#L24) ___ @@ -77,4 +88,4 @@ Retrieve the token information by a given contract address and chainId if any #### Defined in -[wallet-ledger/src/tokens.ts:8](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/tokens.ts#L8) +[wallet-ledger/src/tokens.ts:9](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/wallets/wallet-ledger/src/tokens.ts#L9) diff --git a/packages/cli/README.md b/packages/cli/README.md index c0350c266..900486dc1 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -23,7 +23,7 @@ Please use GitHub to: πŸ’¬ [Ask a question](https://github.com/celo-org/developer-tooling/discussions) -✨ [Suggest a feature](httpsi//github.com/celo-org/developer-tooling/issues/new/choose) +✨ [Suggest a feature](https://github.com/celo-org/developer-tooling/issues/new/choose) πŸ§‘β€πŸ’» [Contribute!](/CONTRIBUTING.md) @@ -59,6 +59,16 @@ Use `yarn build` to compile the CLI. Use `yarn docs` to populate `packages/docs` with generated documentation. Generated files should be checked in, and CI will fail if CLI modifications cause changes in the docs which were not checked in. +### Testing + +We use both ganache and anvil for testing. You'll need [foundry](https://book.getfoundry.sh/getting-started/installation) installed on your machine. + +To run tests run the following command: + +```bash +yarn workspace @celo/celocli test +``` + ### Known build issues on Linux > I'm getting the follow error: `Cannot find module '@celo/contractkit'`. diff --git a/packages/cli/package.json b/packages/cli/package.json index 98807cb08..695f6cfe5 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -38,6 +38,7 @@ "@celo/connect": "^5.3.0", "@celo/contractkit": "^8.0.0", "@celo/cryptographic-utils": "^5.0.8", + "@celo/devchain-anvil": "^0.0.11007", "@celo/explorer": "^5.0.10", "@celo/governance": "^5.1.1", "@celo/identity": "^5.1.2", diff --git a/packages/cli/src/commands/account/authorize.test.ts b/packages/cli/src/commands/account/authorize.test.ts index 3c5bb899b..82397b61c 100644 --- a/packages/cli/src/commands/account/authorize.test.ts +++ b/packages/cli/src/commands/account/authorize.test.ts @@ -1,165 +1,237 @@ -import { testWithGanache } from '@celo/dev-utils/lib/ganache-test' +import { testWithAnvil } from '@celo/dev-utils/lib/anvil-test' import { addressToPublicKey } from '@celo/utils/lib/signatureUtils' import Web3 from 'web3' -import { testLocally } from '../../test-utils/cliUtils' +import { testLocallyWithWeb3Node } from '../../test-utils/cliUtils' +import { PROOF_OF_POSSESSION_SIGNATURE } from '../../test-utils/constants' import Lock from '../lockedgold/lock' import ValidatorRegister from '../validator/register' import Authorize from './authorize' import Register from './register' process.env.NO_SYNCCHECK = 'true' -testWithGanache('account:authorize cmd', (web3: Web3) => { + +testWithAnvil('account:authorize cmd', (web3: Web3) => { test('can authorize vote signer', async () => { const accounts = await web3.eth.getAccounts() - await testLocally(Register, ['--from', accounts[0]]) - await testLocally(Authorize, [ - '--from', - accounts[0], - '--role', - 'vote', - '--signer', - accounts[1], - '--signature', - '0x1b9fca4bbb5bfb1dbe69ef1cddbd9b4202dcb6b134c5170611e1e36ecfa468d7b46c85328d504934fce6c2a1571603a50ae224d2b32685e84d4d1a1eebad8452eb', - ]) + const notRegisteredAccount = accounts[0] + const signerNotRegisteredAccount = accounts[1] + + await testLocallyWithWeb3Node(Register, ['--from', notRegisteredAccount], web3) + + await testLocallyWithWeb3Node( + Authorize, + [ + '--from', + notRegisteredAccount, + '--role', + 'vote', + '--signer', + signerNotRegisteredAccount, + '--signature', + PROOF_OF_POSSESSION_SIGNATURE, + ], + web3 + ) }) test('can authorize attestation signer', async () => { const accounts = await web3.eth.getAccounts() - await testLocally(Register, ['--from', accounts[0]]) - await testLocally(Authorize, [ - '--from', - accounts[0], - '--role', - 'attestation', - '--signer', - accounts[1], - '--signature', - '0x1b9fca4bbb5bfb1dbe69ef1cddbd9b4202dcb6b134c5170611e1e36ecfa468d7b46c85328d504934fce6c2a1571603a50ae224d2b32685e84d4d1a1eebad8452eb', - ]) + const notRegisteredAccount = accounts[0] + const signerNotRegisteredAccount = accounts[1] + + await testLocallyWithWeb3Node(Register, ['--from', notRegisteredAccount], web3) + await testLocallyWithWeb3Node( + Authorize, + [ + '--from', + notRegisteredAccount, + '--role', + 'attestation', + '--signer', + signerNotRegisteredAccount, + '--signature', + PROOF_OF_POSSESSION_SIGNATURE, + ], + web3 + ) }) test('can authorize validator signer before validator is registered', async () => { const accounts = await web3.eth.getAccounts() - await testLocally(Register, ['--from', accounts[0]]) - await testLocally(Authorize, [ - '--from', - accounts[0], - '--role', - 'validator', - '--signer', - accounts[1], - '--signature', - '0x1b9fca4bbb5bfb1dbe69ef1cddbd9b4202dcb6b134c5170611e1e36ecfa468d7b46c85328d504934fce6c2a1571603a50ae224d2b32685e84d4d1a1eebad8452eb', - ]) + const notRegisteredAccount = accounts[0] + const signerNotRegisteredAccount = accounts[1] + + await testLocallyWithWeb3Node(Register, ['--from', notRegisteredAccount], web3) + await testLocallyWithWeb3Node( + Authorize, + [ + '--from', + notRegisteredAccount, + '--role', + 'validator', + '--signer', + signerNotRegisteredAccount, + '--signature', + PROOF_OF_POSSESSION_SIGNATURE, + ], + web3 + ) }) test('can authorize validator signer after validator is registered', async () => { const accounts = await web3.eth.getAccounts() + const notRegisteredAccount = accounts[0] + const signerNotRegisteredAccount = accounts[1] const newBlsPublicKey = web3.utils.randomHex(96) const newBlsPoP = web3.utils.randomHex(48) - const ecdsaPublicKey = await addressToPublicKey(accounts[0], web3.eth.sign) - await testLocally(Register, ['--from', accounts[0]]) - await testLocally(Lock, ['--from', accounts[0], '--value', '10000000000000000000000']) - await testLocally(ValidatorRegister, [ - '--from', - accounts[0], - '--ecdsaKey', - ecdsaPublicKey, - '--blsKey', - '0x4fa3f67fc913878b068d1fa1cdddc54913d3bf988dbe5a36a20fa888f20d4894c408a6773f3d7bde11154f2a3076b700d345a42fd25a0e5e83f4db5586ac7979ac2053cd95d8f2efd3e959571ceccaa743e02cf4be3f5d7aaddb0b06fc9aff00', - '--blsSignature', - '0xcdb77255037eb68897cd487fdd85388cbda448f617f874449d4b11588b0b7ad8ddc20d9bb450b513bb35664ea3923900', - '--yes', - ]) - await testLocally(Authorize, [ - '--from', - accounts[0], - '--role', - 'validator', - '--signer', - accounts[1], - '--signature', - '0x1b9fca4bbb5bfb1dbe69ef1cddbd9b4202dcb6b134c5170611e1e36ecfa468d7b46c85328d504934fce6c2a1571603a50ae224d2b32685e84d4d1a1eebad8452eb', - '--blsKey', - newBlsPublicKey, - '--blsPop', - newBlsPoP, - ]) - }) - - test('cannot authorize validator signer without BLS after validator is registered', async () => { - const accounts = await web3.eth.getAccounts() - const ecdsaPublicKey = await addressToPublicKey(accounts[0], web3.eth.sign) - await testLocally(Register, ['--from', accounts[0]]) - await testLocally(Lock, ['--from', accounts[0], '--value', '10000000000000000000000']) - await testLocally(ValidatorRegister, [ - '--from', - accounts[0], - '--ecdsaKey', - ecdsaPublicKey, - '--blsKey', - '0x4fa3f67fc913878b068d1fa1cdddc54913d3bf988dbe5a36a20fa888f20d4894c408a6773f3d7bde11154f2a3076b700d345a42fd25a0e5e83f4db5586ac7979ac2053cd95d8f2efd3e959571ceccaa743e02cf4be3f5d7aaddb0b06fc9aff00', - '--blsSignature', - '0xcdb77255037eb68897cd487fdd85388cbda448f617f874449d4b11588b0b7ad8ddc20d9bb450b513bb35664ea3923900', - '--yes', - ]) - await expect( - testLocally(Authorize, [ + const ecdsaPublicKey = await addressToPublicKey(notRegisteredAccount, web3.eth.sign) + await testLocallyWithWeb3Node(Register, ['--from', notRegisteredAccount], web3) + await testLocallyWithWeb3Node( + Lock, + ['--from', notRegisteredAccount, '--value', '10000000000000000000000'], + web3 + ) + await testLocallyWithWeb3Node( + ValidatorRegister, + [ '--from', - accounts[0], + notRegisteredAccount, + '--ecdsaKey', + ecdsaPublicKey, + '--blsKey', + '0x4fa3f67fc913878b068d1fa1cdddc54913d3bf988dbe5a36a20fa888f20d4894c408a6773f3d7bde11154f2a3076b700d345a42fd25a0e5e83f4db5586ac7979ac2053cd95d8f2efd3e959571ceccaa743e02cf4be3f5d7aaddb0b06fc9aff00', + '--blsSignature', + '0xcdb77255037eb68897cd487fdd85388cbda448f617f874449d4b11588b0b7ad8ddc20d9bb450b513bb35664ea3923900', + '--yes', + ], + web3 + ) + await testLocallyWithWeb3Node( + Authorize, + [ + '--from', + notRegisteredAccount, '--role', 'validator', '--signer', - accounts[1], + signerNotRegisteredAccount, '--signature', - '0x1b9fca4bbb5bfb1dbe69ef1cddbd9b4202dcb6b134c5170611e1e36ecfa468d7b46c85328d504934fce6c2a1571603a50ae224d2b32685e84d4d1a1eebad8452eb', - ]) - ).rejects.toThrow() + PROOF_OF_POSSESSION_SIGNATURE, + '--blsKey', + newBlsPublicKey, + '--blsPop', + newBlsPoP, + ], + web3 + ) }) - test('can force authorize validator signer without BLS after validator is registered', async () => { + test('cannot authorize validator signer without BLS after validator is registered', async () => { const accounts = await web3.eth.getAccounts() - const ecdsaPublicKey = await addressToPublicKey(accounts[0], web3.eth.sign) - await testLocally(Register, ['--from', accounts[0]]) - await testLocally(Lock, ['--from', accounts[0], '--value', '10000000000000000000000']) - await testLocally(ValidatorRegister, [ - '--from', - accounts[0], - '--ecdsaKey', - ecdsaPublicKey, - '--blsKey', - '0x4fa3f67fc913878b068d1fa1cdddc54913d3bf988dbe5a36a20fa888f20d4894c408a6773f3d7bde11154f2a3076b700d345a42fd25a0e5e83f4db5586ac7979ac2053cd95d8f2efd3e959571ceccaa743e02cf4be3f5d7aaddb0b06fc9aff00', - '--blsSignature', - '0xcdb77255037eb68897cd487fdd85388cbda448f617f874449d4b11588b0b7ad8ddc20d9bb450b513bb35664ea3923900', - '--yes', - ]) - await testLocally(Authorize, [ - '--from', - accounts[0], - '--role', - 'validator', - '--signer', - accounts[1], - '--signature', - '0x1b9fca4bbb5bfb1dbe69ef1cddbd9b4202dcb6b134c5170611e1e36ecfa468d7b46c85328d504934fce6c2a1571603a50ae224d2b32685e84d4d1a1eebad8452eb', - '--force', - ]) + const notRegisteredAccount = accounts[0] + const signerNotRegisteredAccount = accounts[1] + const ecdsaPublicKey = await addressToPublicKey(notRegisteredAccount, web3.eth.sign) + await testLocallyWithWeb3Node(Register, ['--from', notRegisteredAccount], web3) + await testLocallyWithWeb3Node( + Lock, + ['--from', notRegisteredAccount, '--value', '10000000000000000000000'], + web3 + ) + await testLocallyWithWeb3Node( + ValidatorRegister, + [ + '--from', + notRegisteredAccount, + '--ecdsaKey', + ecdsaPublicKey, + '--blsKey', + '0x4fa3f67fc913878b068d1fa1cdddc54913d3bf988dbe5a36a20fa888f20d4894c408a6773f3d7bde11154f2a3076b700d345a42fd25a0e5e83f4db5586ac7979ac2053cd95d8f2efd3e959571ceccaa743e02cf4be3f5d7aaddb0b06fc9aff00', + '--blsSignature', + '0xcdb77255037eb68897cd487fdd85388cbda448f617f874449d4b11588b0b7ad8ddc20d9bb450b513bb35664ea3923900', + '--yes', + ], + web3 + ) + await expect( + testLocallyWithWeb3Node( + Authorize, + [ + '--from', + notRegisteredAccount, + '--role', + 'validator', + '--signer', + signerNotRegisteredAccount, + '--signature', + PROOF_OF_POSSESSION_SIGNATURE, + ], + web3 + ) + ).rejects.toThrow() }) - test('fails if from is not an account', async () => { + test('can force authorize validator signer without BLS after validator is registered', async () => { const accounts = await web3.eth.getAccounts() - await expect( - testLocally(Authorize, [ + const notRegisteredAccount = accounts[0] + const signerNotRegisteredAccount = accounts[1] + const ecdsaPublicKey = await addressToPublicKey(notRegisteredAccount, web3.eth.sign) + await testLocallyWithWeb3Node(Register, ['--from', notRegisteredAccount], web3) + await testLocallyWithWeb3Node( + Lock, + ['--from', notRegisteredAccount, '--value', '10000000000000000000000'], + web3 + ) + await testLocallyWithWeb3Node( + ValidatorRegister, + [ '--from', - accounts[0], + notRegisteredAccount, + '--ecdsaKey', + ecdsaPublicKey, + '--blsKey', + '0x4fa3f67fc913878b068d1fa1cdddc54913d3bf988dbe5a36a20fa888f20d4894c408a6773f3d7bde11154f2a3076b700d345a42fd25a0e5e83f4db5586ac7979ac2053cd95d8f2efd3e959571ceccaa743e02cf4be3f5d7aaddb0b06fc9aff00', + '--blsSignature', + '0xcdb77255037eb68897cd487fdd85388cbda448f617f874449d4b11588b0b7ad8ddc20d9bb450b513bb35664ea3923900', + '--yes', + ], + web3 + ) + await testLocallyWithWeb3Node( + Authorize, + [ + '--from', + notRegisteredAccount, '--role', 'validator', '--signer', - accounts[1], + signerNotRegisteredAccount, '--signature', - '0x1b9fca4bbb5bfb1dbe69ef1cddbd9b4202dcb6b134c5170611e1e36ecfa468d7b46c85328d504934fce6c2a1571603a50ae224d2b32685e84d4d1a1eebad8452eb', - ]) + PROOF_OF_POSSESSION_SIGNATURE, + '--force', + ], + web3 + ) + }) + + test('fails if from is not an account', async () => { + const accounts = await web3.eth.getAccounts() + const notRegisteredAccount = accounts[0] + const signerNotRegisteredAccount = accounts[1] + await expect( + testLocallyWithWeb3Node( + Authorize, + [ + '--from', + notRegisteredAccount, + '--role', + 'validator', + '--signer', + signerNotRegisteredAccount, + '--signature', + PROOF_OF_POSSESSION_SIGNATURE, + ], + web3 + ) ).rejects.toThrow() }) }) diff --git a/packages/cli/src/commands/account/claims.test.ts b/packages/cli/src/commands/account/claims.test.ts index efe7ba8c8..a0c904fb7 100644 --- a/packages/cli/src/commands/account/claims.test.ts +++ b/packages/cli/src/commands/account/claims.test.ts @@ -1,10 +1,10 @@ import { ContractKit, IdentityMetadataWrapper, newKitFromWeb3 } from '@celo/contractkit' import { ClaimTypes } from '@celo/contractkit/lib/identity' -import { testWithGanache } from '@celo/dev-utils/lib/ganache-test' +import { testWithAnvil } from '@celo/dev-utils/lib/anvil-test' import { readFileSync, writeFileSync } from 'fs' import { tmpdir } from 'os' import Web3 from 'web3' -import { testLocally } from '../../test-utils/cliUtils' +import { testLocallyWithWeb3Node } from '../../test-utils/cliUtils' import ClaimAccount from './claim-account' import ClaimDomain from './claim-domain' import ClaimName from './claim-name' @@ -12,7 +12,7 @@ import CreateMetadata from './create-metadata' import RegisterMetadata from './register-metadata' process.env.NO_SYNCCHECK = 'true' -testWithGanache('account metadata cmds', (web3: Web3) => { +testWithAnvil('account metadata cmds', (web3: Web3) => { let account: string let accounts: string[] let kit: ContractKit @@ -35,7 +35,7 @@ testWithGanache('account metadata cmds', (web3: Web3) => { test('account:create-metadata cmd', async () => { const newFilePath = `${tmpdir()}/newfile.json` - await testLocally(CreateMetadata, ['--from', account, newFilePath]) + await testLocallyWithWeb3Node(CreateMetadata, ['--from', account, newFilePath], web3) const res = JSON.parse(readFileSync(newFilePath).toString()) expect(res.meta.address).toEqual(account) }) @@ -43,7 +43,11 @@ testWithGanache('account metadata cmds', (web3: Web3) => { test('account:claim-name cmd', async () => { generateEmptyMetadataFile() const name = 'myname' - await testLocally(ClaimName, ['--from', account, '--name', name, emptyFilePath]) + await testLocallyWithWeb3Node( + ClaimName, + ['--from', account, '--name', name, emptyFilePath], + web3 + ) const metadata = await readFile() const claim = metadata.findClaim(ClaimTypes.NAME) expect(claim).toBeDefined() @@ -53,7 +57,11 @@ testWithGanache('account metadata cmds', (web3: Web3) => { test('account:claim-domain cmd', async () => { generateEmptyMetadataFile() const domain = 'example.com' - await testLocally(ClaimDomain, ['--from', account, '--domain', domain, emptyFilePath]) + await testLocallyWithWeb3Node( + ClaimDomain, + ['--from', account, '--domain', domain, emptyFilePath], + web3 + ) const metadata = await readFile() const claim = metadata.findClaim(ClaimTypes.DOMAIN) expect(claim).toBeDefined() @@ -63,7 +71,11 @@ testWithGanache('account metadata cmds', (web3: Web3) => { test('account:claim-account cmd', async () => { generateEmptyMetadataFile() const otherAccount = accounts[1] - await testLocally(ClaimAccount, ['--from', account, '--address', otherAccount, emptyFilePath]) + await testLocallyWithWeb3Node( + ClaimAccount, + ['--from', account, '--address', otherAccount, emptyFilePath], + web3 + ) const metadata = await readFile() const claim = metadata.findClaim(ClaimTypes.ACCOUNT) expect(claim).toBeDefined() @@ -79,31 +91,27 @@ testWithGanache('account metadata cmds', (web3: Web3) => { }) test('can register metadata', async () => { - await testLocally(RegisterMetadata, [ - '--force', - '--from', - account, - '--url', - 'https://example.com', - ]) + await testLocallyWithWeb3Node( + RegisterMetadata, + ['--force', '--from', account, '--url', 'https://example.com'], + web3 + ) }) test('fails if url is missing', async () => { - await expect(testLocally(RegisterMetadata, ['--force', '--from', account])).rejects.toThrow( - 'Missing required flag' - ) + await expect( + testLocallyWithWeb3Node(RegisterMetadata, ['--force', '--from', account], web3) + ).rejects.toThrow('Missing required flag') }) }) it('cannot register metadata', async () => { await expect( - testLocally(RegisterMetadata, [ - '--force', - '--from', - account, - '--url', - 'https://example.com', - ]) + testLocallyWithWeb3Node( + RegisterMetadata, + ['--force', '--from', account, '--url', 'https://example.com'], + web3 + ) ).rejects.toThrow("Some checks didn't pass!") }) }) diff --git a/packages/cli/src/commands/account/deauthorize.test.ts b/packages/cli/src/commands/account/deauthorize.test.ts index d3969ecb6..a586d3bca 100644 --- a/packages/cli/src/commands/account/deauthorize.test.ts +++ b/packages/cli/src/commands/account/deauthorize.test.ts @@ -1,49 +1,65 @@ -import { testWithGanache } from '@celo/dev-utils/lib/ganache-test' -import Web3 from 'web3' -import { testLocally } from '../../test-utils/cliUtils' +import { testWithAnvil } from '@celo/dev-utils/lib/anvil-test' +import { testLocallyWithWeb3Node } from '../../test-utils/cliUtils' +import { PROOF_OF_POSSESSION_SIGNATURE } from '../../test-utils/constants' import Authorize from './authorize' import Deauthorize from './deauthorize' import Register from './register' process.env.NO_SYNCCHECK = 'true' -testWithGanache('account:deauthorize cmd', (web3: Web3) => { +testWithAnvil('account:deauthorize cmd', (web3) => { test('can deauthorize attestation signer', async () => { const accounts = await web3.eth.getAccounts() - await testLocally(Register, ['--from', accounts[0]]) - await testLocally(Authorize, [ - '--from', - accounts[0], - '--role', - 'attestation', - '--signer', - accounts[1], - '--signature', - '0x1b9fca4bbb5bfb1dbe69ef1cddbd9b4202dcb6b134c5170611e1e36ecfa468d7b46c85328d504934fce6c2a1571603a50ae224d2b32685e84d4d1a1eebad8452eb', - ]) - await testLocally(Deauthorize, [ - '--from', - accounts[0], - '--role', - 'attestation', - '--signer', - accounts[1], - ]) + const notRegisteredAccount = accounts[0] + const signerNotRegisteredAccount = accounts[1] + await testLocallyWithWeb3Node(Register, ['--from', accounts[0]], web3) + await testLocallyWithWeb3Node( + Authorize, + [ + '--from', + notRegisteredAccount, + '--role', + 'attestation', + '--signer', + signerNotRegisteredAccount, + '--signature', + PROOF_OF_POSSESSION_SIGNATURE, + ], + web3 + ) + await testLocallyWithWeb3Node( + Deauthorize, + [ + '--from', + notRegisteredAccount, + '--role', + 'attestation', + '--signer', + signerNotRegisteredAccount, + ], + web3 + ) }) test('cannot deauthorize a non-authorized signer', async () => { const accounts = await web3.eth.getAccounts() - await testLocally(Register, ['--from', accounts[0]]) + const notRegisteredAccount = accounts[0] + const signerNotRegisteredAccount = accounts[1] + await testLocallyWithWeb3Node(Register, ['--from', notRegisteredAccount], web3) await expect( - testLocally(Deauthorize, [ - '--from', - accounts[0], - '--role', - 'attestation', - '--signer', - accounts[1], - ]) + testLocallyWithWeb3Node( + Deauthorize, + [ + '--from', + notRegisteredAccount, + '--role', + 'attestation', + '--signer', + signerNotRegisteredAccount, + ], + web3 + ) ).rejects.toThrow() }) }) diff --git a/packages/cli/src/commands/account/list.test.ts b/packages/cli/src/commands/account/list.test.ts index 30bc0a992..9ba97489a 100644 --- a/packages/cli/src/commands/account/list.test.ts +++ b/packages/cli/src/commands/account/list.test.ts @@ -1,10 +1,11 @@ import { ContractKit, newKitFromWeb3 } from '@celo/contractkit' -import { testWithGanache } from '@celo/dev-utils/lib/ganache-test' +import { testWithAnvil } from '@celo/dev-utils/lib/anvil-test' import { AddressValidation } from '@celo/wallet-ledger/lib/ledger-wallet' import { LocalWallet } from '@celo/wallet-local' import Web3 from 'web3' -import { testLocally } from '../../test-utils/cliUtils' +import { testLocallyWithWeb3Node } from '../../test-utils/cliUtils' import List from './list' + process.env.NO_SYNCCHECK = 'true' jest.mock('@celo/wallet-ledger', () => { @@ -23,7 +24,7 @@ jest.mock('@celo/wallet-ledger', () => { } }) -testWithGanache('account:list', (web3: Web3) => { +testWithAnvil('account:list', (web3: Web3) => { let account: string let accounts: string[] let kit: ContractKit @@ -36,17 +37,18 @@ testWithGanache('account:list', (web3: Web3) => { const accountsInstance = await kit.contracts.getAccounts() await accountsInstance.createAccount().sendAndWaitForReceipt({ from: account }) }) + test('shows the list of accounts', async () => { const spy = jest.spyOn(console, 'log') - await testLocally(List, []) + await testLocallyWithWeb3Node(List, [], web3) expect(spy).toHaveBeenCalledWith('All Addresses: ', accounts) }) test('shows the list of accounts when --useLedger given', async () => { const spy = jest.spyOn(console, 'log') - await testLocally(List, ['--useLedger']) + await testLocallyWithWeb3Node(List, ['--useLedger'], web3) expect(spy).toHaveBeenCalledWith('Ledger Addresses: ', [ '0x7457d5E02197480Db681D3fdF256c7acA21bDc12', '0x91c987bf62D25945dB517BDAa840A6c661374402', diff --git a/packages/cli/src/commands/account/register.test.ts b/packages/cli/src/commands/account/register.test.ts index 06010198d..949b1fa0b 100644 --- a/packages/cli/src/commands/account/register.test.ts +++ b/packages/cli/src/commands/account/register.test.ts @@ -1,20 +1,30 @@ -import { testWithGanache } from '@celo/dev-utils/lib/ganache-test' +import { newKitFromWeb3 } from '@celo/contractkit' +import { testWithAnvil } from '@celo/dev-utils/lib/anvil-test' import Web3 from 'web3' -import { testLocally } from '../../test-utils/cliUtils' +import { testLocallyWithWeb3Node } from '../../test-utils/cliUtils' import Register from './register' process.env.NO_SYNCCHECK = 'true' -testWithGanache('account:register cmd', (web3: Web3) => { +testWithAnvil('account:register cmd', (web3: Web3) => { test('can register account', async () => { const accounts = await web3.eth.getAccounts() - await testLocally(Register, ['--from', accounts[0], '--name', 'Chapulin Colorado']) + await testLocallyWithWeb3Node( + Register, + ['--from', accounts[0], '--name', 'Chapulin Colorado'], + web3 + ) + + const kit = newKitFromWeb3(web3) + const account = await kit.contracts.getAccounts() + + expect(await account.getName(accounts[0])).toMatchInlineSnapshot(`"Chapulin Colorado"`) }) test('fails if from is missing', async () => { - // const accounts = await web3.eth.getAccounts() - - await expect(testLocally(Register, [])).rejects.toThrow('Missing required flag') + await expect(testLocallyWithWeb3Node(Register, [], web3)).rejects.toThrow( + 'Missing required flag' + ) }) }) diff --git a/packages/cli/src/commands/account/set-name.test.ts b/packages/cli/src/commands/account/set-name.test.ts index 258e02f3a..642501221 100644 --- a/packages/cli/src/commands/account/set-name.test.ts +++ b/packages/cli/src/commands/account/set-name.test.ts @@ -1,28 +1,28 @@ -import { testWithGanache } from '@celo/dev-utils/lib/ganache-test' +import { testWithAnvil } from '@celo/dev-utils/lib/anvil-test' import Web3 from 'web3' -import { testLocally } from '../../test-utils/cliUtils' +import { testLocallyWithWeb3Node } from '../../test-utils/cliUtils' import Register from '../account/register' import SetName from './set-name' process.env.NO_SYNCCHECK = 'true' -testWithGanache('account:set-name cmd', (web3: Web3) => { +testWithAnvil('account:set-name cmd', (web3: Web3) => { test('can set the name of an account', async () => { const accounts = await web3.eth.getAccounts() - await testLocally(Register, ['--from', accounts[0]]) - await testLocally(SetName, ['--account', accounts[0], '--name', 'TestName']) + await testLocallyWithWeb3Node(Register, ['--from', accounts[0]], web3) + await testLocallyWithWeb3Node(SetName, ['--account', accounts[0], '--name', 'TestName'], web3) }) test('fails if account is not registered', async () => { const accounts = await web3.eth.getAccounts() await expect( - testLocally(SetName, ['--account', accounts[0], '--name', 'TestName']) + testLocallyWithWeb3Node(SetName, ['--account', accounts[0], '--name', 'TestName'], web3) ).rejects.toThrow("Some checks didn't pass!") }) test('fails if account is not provided', async () => { - await expect(testLocally(SetName, ['--name', 'TestName'])).rejects.toThrow( + await expect(testLocallyWithWeb3Node(SetName, ['--name', 'TestName'], web3)).rejects.toThrow( 'Missing required flag' ) }) @@ -30,8 +30,8 @@ testWithGanache('account:set-name cmd', (web3: Web3) => { test('fails if name is not provided', async () => { const accounts = await web3.eth.getAccounts() - await expect(testLocally(SetName, ['--account', accounts[0]])).rejects.toThrow( - 'Missing required flag' - ) + await expect( + testLocallyWithWeb3Node(SetName, ['--account', accounts[0]], web3) + ).rejects.toThrow('Missing required flag') }) }) diff --git a/packages/cli/src/commands/config/set.test.ts b/packages/cli/src/commands/config/set.test.ts index 05fdcaf51..c720b459d 100644 --- a/packages/cli/src/commands/config/set.test.ts +++ b/packages/cli/src/commands/config/set.test.ts @@ -1,7 +1,13 @@ import { ux } from '@oclif/core' -import { stripAnsiCodesFromNestedArray, testLocally } from '../../test-utils/cliUtils' +import { + extractHostFromWeb3, + stripAnsiCodesFromNestedArray, + testLocallyWithWeb3Node, +} from '../../test-utils/cliUtils' import * as config from '../../utils/config' import Set from './set' +import { testWithAnvil } from '@celo/dev-utils/lib/anvil-test' +import Web3 from 'web3' process.env.NO_SYNCCHECK = 'true' @@ -10,12 +16,16 @@ afterEach(async () => { jest.restoreAllMocks() }) -describe('config:set cmd', () => { +testWithAnvil('config:set cmd', (web3: Web3) => { it('shows a warning if gasCurrency is passed', async () => { const consoleMock = jest.spyOn(ux, 'warn') const writeMock = jest.spyOn(config, 'writeConfig') - await testLocally(Set, ['--gasCurrency', '0x5315e44798395d4a952530d131249fE00f554565']) + await testLocallyWithWeb3Node( + Set, + ['--gasCurrency', '0xe6774BE4E5f97dB10cAFB4c00C74cFbdCDc434D9'], + web3 + ) expect(stripAnsiCodesFromNestedArray(consoleMock.mock.calls as string[][])) .toMatchInlineSnapshot(` [ @@ -28,7 +38,7 @@ describe('config:set cmd', () => { `) expect(writeMock.mock.calls[0][1]).toMatchInlineSnapshot(` { - "node": "http://localhost:8545", + "node": "${extractHostFromWeb3(web3)}", } `) }) diff --git a/packages/cli/src/commands/governance/propose.test.ts b/packages/cli/src/commands/governance/propose.test.ts index 49cffb85e..6b5f1df78 100644 --- a/packages/cli/src/commands/governance/propose.test.ts +++ b/packages/cli/src/commands/governance/propose.test.ts @@ -193,7 +193,7 @@ testWithGanache('governance:propose cmd', (web3: Web3) => { ).encodeABI() expect(proposal[0].input).toEqual(expectedInput) }, - EXTRA_LONG_TIMEOUT_MS + EXTRA_LONG_TIMEOUT_MS * 2 ) test( diff --git a/packages/cli/src/commands/lockedgold/delegate-info.test.ts b/packages/cli/src/commands/lockedgold/delegate-info.test.ts index 8d82584dc..8c1e240de 100644 --- a/packages/cli/src/commands/lockedgold/delegate-info.test.ts +++ b/packages/cli/src/commands/lockedgold/delegate-info.test.ts @@ -1,24 +1,28 @@ -import { testWithGanache } from '@celo/dev-utils/lib/ganache-test' import Web3 from 'web3' -import { testLocally } from '../../test-utils/cliUtils' +import { testLocallyWithWeb3Node } from '../../test-utils/cliUtils' import Register from '../account/register' import Delegate from './delegate' import DelegateInfo from './delegate-info' import Lock from './lock' +import { testWithAnvil } from '@celo/dev-utils/lib/anvil-test' process.env.NO_SYNCCHECK = 'true' -testWithGanache('lockedgold:delegate-info cmd', (web3: Web3) => { +testWithAnvil('lockedgold:delegate-info cmd', (web3: Web3) => { test('gets the info', async () => { const accounts = await web3.eth.getAccounts() const account = accounts[0] const account2 = accounts[1] - await testLocally(Register, ['--from', account]) - await testLocally(Register, ['--from', account2]) - await testLocally(Lock, ['--from', account, '--value', '200']) + await testLocallyWithWeb3Node(Register, ['--from', account], web3) + await testLocallyWithWeb3Node(Register, ['--from', account2], web3) + await testLocallyWithWeb3Node(Lock, ['--from', account, '--value', '200'], web3) - await testLocally(Delegate, ['--from', account, '--to', account2, '--percent', '100']) + await testLocallyWithWeb3Node( + Delegate, + ['--from', account, '--to', account2, '--percent', '100'], + web3 + ) - await testLocally(DelegateInfo, ['--account', account]) + await testLocallyWithWeb3Node(DelegateInfo, ['--account', account], web3) }) }) diff --git a/packages/cli/src/commands/lockedgold/delegate.test.ts b/packages/cli/src/commands/lockedgold/delegate.test.ts index 2d321477e..d5446ab96 100644 --- a/packages/cli/src/commands/lockedgold/delegate.test.ts +++ b/packages/cli/src/commands/lockedgold/delegate.test.ts @@ -1,30 +1,34 @@ import { newKitFromWeb3 } from '@celo/contractkit' -import { testWithGanache } from '@celo/dev-utils/lib/ganache-test' import Web3 from 'web3' -import { testLocally } from '../../test-utils/cliUtils' +import { testLocallyWithWeb3Node } from '../../test-utils/cliUtils' import Register from '../account/register' import Delegate from './delegate' import Lock from './lock' +import { testWithAnvil } from '@celo/dev-utils/lib/anvil-test' process.env.NO_SYNCCHECK = 'true' -testWithGanache('lockedgold:delegate cmd', (web3: Web3) => { +testWithAnvil('lockedgold:delegate cmd', (web3: Web3) => { test('can delegate', async () => { const accounts = await web3.eth.getAccounts() const account = accounts[0] const account2 = accounts[1] const kit = newKitFromWeb3(web3) const lockedGold = await kit.contracts.getLockedGold() - await testLocally(Register, ['--from', account]) - await testLocally(Register, ['--from', account2]) - await testLocally(Lock, ['--from', account, '--value', '200']) + await testLocallyWithWeb3Node(Register, ['--from', account], web3) + await testLocallyWithWeb3Node(Register, ['--from', account2], web3) + await testLocallyWithWeb3Node(Lock, ['--from', account, '--value', '200'], web3) const account2OriginalVotingPower = await lockedGold.getAccountTotalGovernanceVotingPower( account2 ) expect(account2OriginalVotingPower.toFixed()).toBe('0') - await testLocally(Delegate, ['--from', account, '--to', account2, '--percent', '100']) + await testLocallyWithWeb3Node( + Delegate, + ['--from', account, '--to', account2, '--percent', '100'], + web3 + ) const account2VotingPower = await lockedGold.getAccountTotalGovernanceVotingPower(account2) expect(account2VotingPower.toFixed()).toBe('200') diff --git a/packages/cli/src/commands/lockedgold/lock.test.ts b/packages/cli/src/commands/lockedgold/lock.test.ts index 7e0ca1018..c229872dc 100644 --- a/packages/cli/src/commands/lockedgold/lock.test.ts +++ b/packages/cli/src/commands/lockedgold/lock.test.ts @@ -1,20 +1,20 @@ import { newKitFromWeb3 } from '@celo/contractkit' -import { testWithGanache } from '@celo/dev-utils/lib/ganache-test' import { ux } from '@oclif/core' import BigNumber from 'bignumber.js' import Web3 from 'web3' import { LONG_TIMEOUT_MS, stripAnsiCodesFromNestedArray, - testLocally, + testLocallyWithWeb3Node, } from '../../test-utils/cliUtils' import Register from '../account/register' import Lock from './lock' import Unlock from './unlock' +import { testWithAnvil } from '@celo/dev-utils/lib/anvil-test' process.env.NO_SYNCCHECK = 'true' -testWithGanache('lockedgold:lock cmd', (web3: Web3) => { +testWithAnvil('lockedgold:lock cmd', (web3: Web3) => { test( 'can lock with pending withdrawals', async () => { @@ -22,12 +22,12 @@ testWithGanache('lockedgold:lock cmd', (web3: Web3) => { const account = accounts[0] const kit = newKitFromWeb3(web3) const lockedGold = await kit.contracts.getLockedGold() - await testLocally(Register, ['--from', account]) - await testLocally(Lock, ['--from', account, '--value', '100']) - await testLocally(Unlock, ['--from', account, '--value', '50']) - await testLocally(Lock, ['--from', account, '--value', '75']) - await testLocally(Unlock, ['--from', account, '--value', '50']) - await testLocally(Lock, ['--from', account, '--value', '50']) + await testLocallyWithWeb3Node(Register, ['--from', account], web3) + await testLocallyWithWeb3Node(Lock, ['--from', account, '--value', '100'], web3) + await testLocallyWithWeb3Node(Unlock, ['--from', account, '--value', '50'], web3) + await testLocallyWithWeb3Node(Lock, ['--from', account, '--value', '75'], web3) + await testLocallyWithWeb3Node(Unlock, ['--from', account, '--value', '50'], web3) + await testLocallyWithWeb3Node(Lock, ['--from', account, '--value', '50'], web3) const pendingWithdrawalsTotalValue = await lockedGold.getPendingWithdrawalsTotalValue(account) expect(pendingWithdrawalsTotalValue.toFixed()).toBe('0') }, @@ -47,7 +47,7 @@ testWithGanache('lockedgold:lock cmd', (web3: Web3) => { // pre check expect(await accountsContract.isAccount(eoa)).toBe(false) - await testLocally(Lock, ['--from', eoa, '--value', '100']) + await testLocallyWithWeb3Node(Lock, ['--from', eoa, '--value', '100'], web3) expect(stripAnsiCodesFromNestedArray(logSpy.mock.calls)).toMatchInlineSnapshot(` [ @@ -67,7 +67,7 @@ testWithGanache('lockedgold:lock cmd', (web3: Web3) => { "SendTransaction: register", ], [ - "txHash: 0x9322aba7cf28f466f1377b1da9a1e7ed94c3109aa5fd2f4ea23caab371f1cb0f", + "txHash: 0xcdb8d9e0582bb8d40794116734e2be84d06d644cea2fa32ed673ce9ae2f22f5b", ], [ "Running Checks:", @@ -82,7 +82,7 @@ testWithGanache('lockedgold:lock cmd', (web3: Web3) => { "SendTransaction: lock", ], [ - "txHash: 0x947e5f8c97fdfabf688b3879f5856e1165c3578f2741d2481c3c961aa83bba51", + "txHash: 0xf543d1f5834ef100f647991c620083fd5ae947f0695ff5ff53a0cc8e644e13c0", ], ] `) diff --git a/packages/cli/src/commands/lockedgold/revoke-delegate.test.ts b/packages/cli/src/commands/lockedgold/revoke-delegate.test.ts index 08220b263..3eb022469 100644 --- a/packages/cli/src/commands/lockedgold/revoke-delegate.test.ts +++ b/packages/cli/src/commands/lockedgold/revoke-delegate.test.ts @@ -1,31 +1,39 @@ import { newKitFromWeb3 } from '@celo/contractkit' -import { testWithGanache } from '@celo/dev-utils/lib/ganache-test' import Web3 from 'web3' -import { testLocally } from '../../test-utils/cliUtils' +import { testLocallyWithWeb3Node } from '../../test-utils/cliUtils' import Register from '../account/register' import Delegate from './delegate' import Lock from './lock' import RevokeDelegate from './revoke-delegate' +import { testWithAnvil } from '@celo/dev-utils/lib/anvil-test' process.env.NO_SYNCCHECK = 'true' -testWithGanache('lockedgold:revoke-delegate cmd', (web3: Web3) => { +testWithAnvil('lockedgold:revoke-delegate cmd', (web3: Web3) => { test('can revoke delegate', async () => { const accounts = await web3.eth.getAccounts() const account = accounts[0] const account2 = accounts[1] const kit = newKitFromWeb3(web3) const lockedGold = await kit.contracts.getLockedGold() - await testLocally(Register, ['--from', account]) - await testLocally(Register, ['--from', account2]) - await testLocally(Lock, ['--from', account, '--value', '200']) + await testLocallyWithWeb3Node(Register, ['--from', account], web3) + await testLocallyWithWeb3Node(Register, ['--from', account2], web3) + await testLocallyWithWeb3Node(Lock, ['--from', account, '--value', '200'], web3) - await testLocally(Delegate, ['--from', account, '--to', account2, '--percent', '100']) + await testLocallyWithWeb3Node( + Delegate, + ['--from', account, '--to', account2, '--percent', '100'], + web3 + ) const account2VotingPower = await lockedGold.getAccountTotalGovernanceVotingPower(account2) expect(account2VotingPower.toFixed()).toBe('200') - await testLocally(RevokeDelegate, ['--from', account, '--to', account2, '--percent', '100']) + await testLocallyWithWeb3Node( + RevokeDelegate, + ['--from', account, '--to', account2, '--percent', '100'], + web3 + ) const account2VotingPowerAfterRevoke = await lockedGold.getAccountTotalGovernanceVotingPower( account2 diff --git a/packages/cli/src/commands/lockedgold/unlock.test.ts b/packages/cli/src/commands/lockedgold/unlock.test.ts index f7a6d44b1..fb76c326e 100644 --- a/packages/cli/src/commands/lockedgold/unlock.test.ts +++ b/packages/cli/src/commands/lockedgold/unlock.test.ts @@ -1,8 +1,7 @@ import { newKitFromWeb3 } from '@celo/contractkit' -import { testWithGanache } from '@celo/dev-utils/lib/ganache-test' import { addressToPublicKey } from '@celo/utils/lib/signatureUtils' import Web3 from 'web3' -import { LONG_TIMEOUT_MS, testLocally } from '../../test-utils/cliUtils' +import { LONG_TIMEOUT_MS, testLocallyWithWeb3Node } from '../../test-utils/cliUtils' import Register from '../account/register' import Vote from '../election/vote' import ValidatorAffiliate from '../validator/affiliate' @@ -11,10 +10,11 @@ import ValidatorGroupMember from '../validatorgroup/member' import ValidatorGroupRegister from '../validatorgroup/register' import Lock from './lock' import Unlock from './unlock' +import { testWithAnvil } from '@celo/dev-utils/lib/anvil-test' process.env.NO_SYNCCHECK = 'true' -testWithGanache('lockedgold:unlock cmd', (web3: Web3) => { +testWithAnvil('lockedgold:unlock cmd', (web3: Web3) => { test( 'can unlock correctly from registered validator group', async () => { @@ -23,34 +23,59 @@ testWithGanache('lockedgold:unlock cmd', (web3: Web3) => { const validator = accounts[1] const kit = newKitFromWeb3(web3) const lockedGold = await kit.contracts.getLockedGold() - await testLocally(Register, ['--from', account]) - await testLocally(Lock, ['--from', account, '--value', '20000000000000000000000']) - await testLocally(ValidatorGroupRegister, ['--from', account, '--commission', '0', '--yes']) - await testLocally(Register, ['--from', validator]) - await testLocally(Lock, ['--from', validator, '--value', '20000000000000000000000']) + await testLocallyWithWeb3Node(Register, ['--from', account], web3) + await testLocallyWithWeb3Node( + Lock, + ['--from', account, '--value', '20000000000000000000000'], + web3 + ) + await testLocallyWithWeb3Node( + ValidatorGroupRegister, + ['--from', account, '--commission', '0', '--yes'], + web3 + ) + await testLocallyWithWeb3Node(Register, ['--from', validator], web3) + await testLocallyWithWeb3Node( + Lock, + ['--from', validator, '--value', '20000000000000000000000'], + web3 + ) const ecdsaPublicKey = await addressToPublicKey(validator, web3.eth.sign) - await testLocally(ValidatorRegister, [ - '--from', - validator, - '--ecdsaKey', - ecdsaPublicKey, - '--blsKey', - '0x4fa3f67fc913878b068d1fa1cdddc54913d3bf988dbe5a36a20fa888f20d4894c408a6773f3d7bde11154f2a3076b700d345a42fd25a0e5e83f4db5586ac7979ac2053cd95d8f2efd3e959571ceccaa743e02cf4be3f5d7aaddb0b06fc9aff00', - '--blsSignature', - '0xcdb77255037eb68897cd487fdd85388cbda448f617f874449d4b11588b0b7ad8ddc20d9bb450b513bb35664ea3923900', - '--yes', - ]) - await testLocally(ValidatorAffiliate, ['--yes', '--from', validator, account]) - await testLocally(ValidatorGroupMember, ['--yes', '--from', account, '--accept', validator]) - await testLocally(Vote, [ - '--from', - account, - '--for', - account, - '--value', - '10000000000000000000000', - ]) - await testLocally(Unlock, ['--from', account, '--value', '10000000000000000000000']) + await testLocallyWithWeb3Node( + ValidatorRegister, + [ + '--from', + validator, + '--ecdsaKey', + ecdsaPublicKey, + '--blsKey', + '0x4fa3f67fc913878b068d1fa1cdddc54913d3bf988dbe5a36a20fa888f20d4894c408a6773f3d7bde11154f2a3076b700d345a42fd25a0e5e83f4db5586ac7979ac2053cd95d8f2efd3e959571ceccaa743e02cf4be3f5d7aaddb0b06fc9aff00', + '--blsSignature', + '0xcdb77255037eb68897cd487fdd85388cbda448f617f874449d4b11588b0b7ad8ddc20d9bb450b513bb35664ea3923900', + '--yes', + ], + web3 + ) + await testLocallyWithWeb3Node( + ValidatorAffiliate, + ['--yes', '--from', validator, account], + web3 + ) + await testLocallyWithWeb3Node( + ValidatorGroupMember, + ['--yes', '--from', account, '--accept', validator], + web3 + ) + await testLocallyWithWeb3Node( + Vote, + ['--from', account, '--for', account, '--value', '10000000000000000000000'], + web3 + ) + await testLocallyWithWeb3Node( + Unlock, + ['--from', account, '--value', '10000000000000000000000'], + web3 + ) const pendingWithdrawalsTotalValue = await lockedGold.getPendingWithdrawalsTotalValue(account) expect(pendingWithdrawalsTotalValue.toFixed()).toBe('10000000000000000000000') }, diff --git a/packages/cli/src/commands/lockedgold/update-delegated-amount.test.ts b/packages/cli/src/commands/lockedgold/update-delegated-amount.test.ts index f622c04f2..e0131bbf4 100644 --- a/packages/cli/src/commands/lockedgold/update-delegated-amount.test.ts +++ b/packages/cli/src/commands/lockedgold/update-delegated-amount.test.ts @@ -1,26 +1,34 @@ -import { testWithGanache } from '@celo/dev-utils/lib/ganache-test' import Web3 from 'web3' -import { LONG_TIMEOUT_MS, testLocally } from '../../test-utils/cliUtils' +import { LONG_TIMEOUT_MS, testLocallyWithWeb3Node } from '../../test-utils/cliUtils' import Register from '../account/register' import Delegate from './delegate' import Lock from './lock' import UpdateDelegatedAmount from './update-delegated-amount' +import { testWithAnvil } from '@celo/dev-utils/lib/anvil-test' process.env.NO_SYNCCHECK = 'true' -testWithGanache('lockedgold:update-delegated-amount cmd', (web3: Web3) => { +testWithAnvil('lockedgold:update-delegated-amount cmd', (web3: Web3) => { test( 'can update delegated amount', async () => { const accounts = await web3.eth.getAccounts() const account = accounts[0] const account2 = accounts[1] - await testLocally(Register, ['--from', account]) - await testLocally(Register, ['--from', account2]) - await testLocally(Lock, ['--from', account, '--value', '200']) - await testLocally(Delegate, ['--from', account, '--to', account2, '--percent', '100']) + await testLocallyWithWeb3Node(Register, ['--from', account], web3) + await testLocallyWithWeb3Node(Register, ['--from', account2], web3) + await testLocallyWithWeb3Node(Lock, ['--from', account, '--value', '200'], web3) + await testLocallyWithWeb3Node( + Delegate, + ['--from', account, '--to', account2, '--percent', '100'], + web3 + ) - await testLocally(UpdateDelegatedAmount, ['--from', account, '--to', account2]) + await testLocallyWithWeb3Node( + UpdateDelegatedAmount, + ['--from', account, '--to', account2], + web3 + ) }, LONG_TIMEOUT_MS ) diff --git a/packages/cli/src/commands/transfer/celo.test.ts b/packages/cli/src/commands/transfer/celo.test.ts index 218b6f9ee..28184fa42 100644 --- a/packages/cli/src/commands/transfer/celo.test.ts +++ b/packages/cli/src/commands/transfer/celo.test.ts @@ -1,9 +1,9 @@ import { COMPLIANT_ERROR_RESPONSE, SANCTIONED_ADDRESSES } from '@celo/compliance' import { ContractKit, StableToken, newKitFromWeb3 } from '@celo/contractkit' -import { testWithGanache } from '@celo/dev-utils/lib/ganache-test' import Web3 from 'web3' -import { testLocally } from '../../test-utils/cliUtils' +import { testLocallyWithWeb3Node } from '../../test-utils/cliUtils' import TransferCelo from './celo' +import { testWithGanache } from '@celo/dev-utils/lib/ganache-test' process.env.NO_SYNCCHECK = 'true' @@ -24,32 +24,40 @@ testWithGanache('transfer:celo cmd', (web3: Web3) => { const receiverBalanceBefore = await kit.getTotalBalance(accounts[1]) const amountToTransfer = '500000000000000000000' // Send cUSD to RG contract - await testLocally(TransferCelo, [ - '--from', - accounts[0], - '--to', - accounts[1], - '--value', - amountToTransfer, - '--gasCurrency', - (await kit.contracts.getStableToken(StableToken.cUSD)).address, - ]) + await testLocallyWithWeb3Node( + TransferCelo, + [ + '--from', + accounts[0], + '--to', + accounts[1], + '--value', + amountToTransfer, + '--gasCurrency', + (await kit.contracts.getStableToken(StableToken.cUSD)).address, + ], + web3 + ) // RG cUSD balance should match the amount sent const receiverBalance = await kit.getTotalBalance(accounts[1]) expect(receiverBalance.CELO!.toFixed()).toEqual( receiverBalanceBefore.CELO!.plus(amountToTransfer).toFixed() ) // Attempt to send cUSD back - await testLocally(TransferCelo, [ - '--from', - accounts[1], - '--to', - accounts[0], - '--value', - amountToTransfer, - '--gasCurrency', - (await kit.contracts.getStableToken(StableToken.cUSD)).address, - ]) + await testLocallyWithWeb3Node( + TransferCelo, + [ + '--from', + accounts[1], + '--to', + accounts[0], + '--value', + amountToTransfer, + '--gasCurrency', + (await kit.contracts.getStableToken(StableToken.cUSD)).address, + ], + web3 + ) const balanceAfter = await kit.getTotalBalance(accounts[0]) expect(balanceBefore.CELO).toEqual(balanceAfter.CELO) }) @@ -57,28 +65,22 @@ testWithGanache('transfer:celo cmd', (web3: Web3) => { test('should fail if to address is sanctioned', async () => { const spy = jest.spyOn(console, 'log') await expect( - testLocally(TransferCelo, [ - '--from', - accounts[1], - '--to', - SANCTIONED_ADDRESSES[0], - '--value', - '1', - ]) + testLocallyWithWeb3Node( + TransferCelo, + ['--from', accounts[1], '--to', SANCTIONED_ADDRESSES[0], '--value', '1'], + web3 + ) ).rejects.toThrow() expect(spy).toHaveBeenCalledWith(expect.stringContaining(COMPLIANT_ERROR_RESPONSE)) }) test('should fail if from address is sanctioned', async () => { const spy = jest.spyOn(console, 'log') await expect( - testLocally(TransferCelo, [ - '--from', - SANCTIONED_ADDRESSES[0], - '--to', - accounts[0], - '--value', - '1', - ]) + testLocallyWithWeb3Node( + TransferCelo, + ['--from', SANCTIONED_ADDRESSES[0], '--to', accounts[0], '--value', '1'], + web3 + ) ).rejects.toThrow() expect(spy).toHaveBeenCalledWith(expect.stringContaining(COMPLIANT_ERROR_RESPONSE)) }) @@ -86,16 +88,11 @@ testWithGanache('transfer:celo cmd', (web3: Web3) => { test("should fail if the feeCurrency isn't correctly formatted", async () => { const wrongFee = '0x123' await expect( - testLocally(TransferCelo, [ - '--from', - accounts[0], - '--to', - accounts[1], - '--value', - '1', - '--gasCurrency', - wrongFee, - ]) + testLocallyWithWeb3Node( + TransferCelo, + ['--from', accounts[0], '--to', accounts[1], '--value', '1', '--gasCurrency', wrongFee], + web3 + ) ).rejects.toThrowErrorMatchingInlineSnapshot(` "Parsing --gasCurrency 0x123 is not a valid address @@ -108,16 +105,20 @@ testWithGanache('transfer:celo cmd', (web3: Web3) => { const receiverBalanceBefore = await kit.getTotalBalance(accounts[1]) const amountToTransfer = '1' await expect( - testLocally(TransferCelo, [ - '--from', - accounts[0], - '--to', - accounts[1], - '--value', - amountToTransfer, - '--gasCurrency', - (await kit.contracts.getStableToken(StableToken.cUSD)).address.toUpperCase(), - ]) + testLocallyWithWeb3Node( + TransferCelo, + [ + '--from', + accounts[0], + '--to', + accounts[1], + '--value', + amountToTransfer, + '--gasCurrency', + (await kit.contracts.getStableToken(StableToken.cUSD)).address.toUpperCase(), + ], + web3 + ) ).resolves.toBeUndefined() const balanceAfter = await kit.getTotalBalance(accounts[0]) @@ -133,16 +134,11 @@ testWithGanache('transfer:celo cmd', (web3: Web3) => { test("should fail if the feeCurrency isn't whitelisted", async () => { const wrongFee = '0x1234567890123456789012345678901234567890' await expect( - testLocally(TransferCelo, [ - '--from', - accounts[0], - '--to', - accounts[1], - '--value', - '1', - '--gasCurrency', - wrongFee, - ]) + testLocallyWithWeb3Node( + TransferCelo, + ['--from', accounts[0], '--to', accounts[1], '--value', '1', '--gasCurrency', wrongFee], + web3 + ) ).rejects.toThrowErrorMatchingInlineSnapshot(` "0x1234567890123456789012345678901234567890 is not a valid fee currency. Available currencies: 0x5315e44798395d4a952530d131249fE00f554565 - Celo Dollar (cUSD) diff --git a/packages/cli/src/commands/transfer/dollars.test.ts b/packages/cli/src/commands/transfer/dollars.test.ts index b80cccff7..3c57109b6 100644 --- a/packages/cli/src/commands/transfer/dollars.test.ts +++ b/packages/cli/src/commands/transfer/dollars.test.ts @@ -1,16 +1,18 @@ import { COMPLIANT_ERROR_RESPONSE, SANCTIONED_ADDRESSES } from '@celo/compliance' -import { ContractKit, newKitFromWeb3 } from '@celo/contractkit' -import { testWithGanache } from '@celo/dev-utils/lib/ganache-test' +import { ContractKit, StableToken, newKitFromWeb3 } from '@celo/contractkit' import Web3 from 'web3' -import { testLocally } from '../../test-utils/cliUtils' +import { testLocallyWithWeb3Node } from '../../test-utils/cliUtils' import TransferCUSD from './dollars' +import { testWithAnvil } from '@celo/dev-utils/lib/anvil-test' +import { topUpWithToken } from '../../test-utils/chain-setup' +import BigNumber from 'bignumber.js' process.env.NO_SYNCCHECK = 'true' // Lots of commands, sometimes times out jest.setTimeout(15000) -testWithGanache('transfer:dollars cmd', (web3: Web3) => { +testWithAnvil('transfer:dollars cmd', (web3: Web3) => { let accounts: string[] = [] let kit: ContractKit @@ -20,32 +22,39 @@ testWithGanache('transfer:dollars cmd', (web3: Web3) => { }) test('can transfer cusd', async () => { + await topUpWithToken( + kit, + StableToken.cUSD, + accounts[0], + new BigNumber('1000000000000000000000') + ) + await topUpWithToken( + kit, + StableToken.cUSD, + accounts[1], + new BigNumber('1000000000000000000000') + ) + const balanceBefore = await kit.getTotalBalance(accounts[0]) const receiverBalanceBefore = await kit.getTotalBalance(accounts[1]) const amountToTransfer = '500000000000000000000' // Send cUSD to RG contract - await testLocally(TransferCUSD, [ - '--from', - accounts[0], - '--to', - accounts[1], - '--value', - amountToTransfer, - ]) + await testLocallyWithWeb3Node( + TransferCUSD, + ['--from', accounts[0], '--to', accounts[1], '--value', amountToTransfer], + web3 + ) // RG cUSD balance should match the amount sent const receiverBalance = await kit.getTotalBalance(accounts[1]) expect(receiverBalance.cUSD!.toFixed()).toEqual( receiverBalanceBefore.cUSD!.plus(amountToTransfer).toFixed() ) // Attempt to send cUSD back - await testLocally(TransferCUSD, [ - '--from', - accounts[1], - '--to', - accounts[0], - '--value', - amountToTransfer, - ]) + await testLocallyWithWeb3Node( + TransferCUSD, + ['--from', accounts[1], '--to', accounts[0], '--value', amountToTransfer], + web3 + ) const balanceAfter = await kit.getTotalBalance(accounts[0]) expect(balanceBefore.cUSD).toEqual(balanceAfter.cUSD) }) @@ -53,14 +62,11 @@ testWithGanache('transfer:dollars cmd', (web3: Web3) => { test('should fail if to address is sanctioned', async () => { const spy = jest.spyOn(console, 'log') await expect( - testLocally(TransferCUSD, [ - '--from', - accounts[1], - '--to', - SANCTIONED_ADDRESSES[0], - '--value', - '1', - ]) + testLocallyWithWeb3Node( + TransferCUSD, + ['--from', accounts[1], '--to', SANCTIONED_ADDRESSES[0], '--value', '1'], + web3 + ) ).rejects.toThrow() expect(spy).toHaveBeenCalledWith(expect.stringContaining(COMPLIANT_ERROR_RESPONSE)) }) diff --git a/packages/cli/src/commands/transfer/euros.test.ts b/packages/cli/src/commands/transfer/euros.test.ts index e5beabd02..0947a3697 100644 --- a/packages/cli/src/commands/transfer/euros.test.ts +++ b/packages/cli/src/commands/transfer/euros.test.ts @@ -1,16 +1,18 @@ import { COMPLIANT_ERROR_RESPONSE, SANCTIONED_ADDRESSES } from '@celo/compliance' -import { ContractKit, newKitFromWeb3 } from '@celo/contractkit' -import { testWithGanache } from '@celo/dev-utils/lib/ganache-test' +import { ContractKit, StableToken, newKitFromWeb3 } from '@celo/contractkit' import Web3 from 'web3' -import { testLocally } from '../../test-utils/cliUtils' +import { testLocallyWithWeb3Node } from '../../test-utils/cliUtils' import TransferEURO from './euros' +import { testWithAnvil } from '@celo/dev-utils/lib/anvil-test' +import { topUpWithToken } from '../../test-utils/chain-setup' +import BigNumber from 'bignumber.js' process.env.NO_SYNCCHECK = 'true' // Lots of commands, sometimes times out jest.setTimeout(15000) -testWithGanache('transfer:euros cmd', (web3: Web3) => { +testWithAnvil('transfer:euros cmd', (web3: Web3) => { let accounts: string[] = [] let kit: ContractKit @@ -20,32 +22,39 @@ testWithGanache('transfer:euros cmd', (web3: Web3) => { }) test('can transfer ceur', async () => { + await topUpWithToken( + kit, + StableToken.cEUR, + accounts[0], + new BigNumber('1000000000000000000000') + ) + await topUpWithToken( + kit, + StableToken.cEUR, + accounts[1], + new BigNumber('1000000000000000000000') + ) + const balanceBefore = await kit.getTotalBalance(accounts[0]) const receiverBalanceBefore = await kit.getTotalBalance(accounts[1]) const amountToTransfer = '500000000000000000000' // Send cEUR to RG contract - await testLocally(TransferEURO, [ - '--from', - accounts[0], - '--to', - accounts[1], - '--value', - amountToTransfer, - ]) + await testLocallyWithWeb3Node( + TransferEURO, + ['--from', accounts[0], '--to', accounts[1], '--value', amountToTransfer], + web3 + ) // RG cEUR balance should match the amount sent const receiverBalance = await kit.getTotalBalance(accounts[1]) expect(receiverBalance.cEUR!.toFixed()).toEqual( receiverBalanceBefore.cEUR!.plus(amountToTransfer).toFixed() ) // Attempt to send cEUR back - await testLocally(TransferEURO, [ - '--from', - accounts[1], - '--to', - accounts[0], - '--value', - amountToTransfer, - ]) + await testLocallyWithWeb3Node( + TransferEURO, + ['--from', accounts[1], '--to', accounts[0], '--value', amountToTransfer], + web3 + ) const balanceAfter = await kit.getTotalBalance(accounts[0]) expect(balanceBefore.cEUR).toEqual(balanceAfter.cEUR) }) @@ -53,14 +62,11 @@ testWithGanache('transfer:euros cmd', (web3: Web3) => { test('should fail if to address is sanctioned', async () => { const spy = jest.spyOn(console, 'log') await expect( - testLocally(TransferEURO, [ - '--from', - accounts[1], - '--to', - SANCTIONED_ADDRESSES[0], - '--value', - '1', - ]) + testLocallyWithWeb3Node( + TransferEURO, + ['--from', accounts[1], '--to', SANCTIONED_ADDRESSES[0], '--value', '1'], + web3 + ) ).rejects.toThrow() expect(spy).toHaveBeenCalledWith(expect.stringContaining(COMPLIANT_ERROR_RESPONSE)) }) diff --git a/packages/cli/src/test-utils/chain-setup.test.ts b/packages/cli/src/test-utils/chain-setup.test.ts new file mode 100644 index 000000000..1e3a2156c --- /dev/null +++ b/packages/cli/src/test-utils/chain-setup.test.ts @@ -0,0 +1,19 @@ +import { isCel2 } from '@celo/connect' +import { newKitFromWeb3 } from '@celo/contractkit' +import { testWithAnvil } from '@celo/dev-utils/lib/anvil-test' +import Web3 from 'web3' +import { setupL2 } from './chain-setup' + +testWithAnvil('chain setup', (web3: Web3) => { + describe('setupL2()', () => { + it('sets up L2 context', async () => { + const kit = newKitFromWeb3(web3) + + expect(await isCel2(web3)).toEqual(false) + + await setupL2(kit) + + expect(await isCel2(web3)).toEqual(true) + }) + }) +}) diff --git a/packages/cli/src/test-utils/chain-setup.ts b/packages/cli/src/test-utils/chain-setup.ts index 4d67ea791..b5e84ffcf 100644 --- a/packages/cli/src/test-utils/chain-setup.ts +++ b/packages/cli/src/test-utils/chain-setup.ts @@ -1,8 +1,16 @@ -import { ContractKit } from '@celo/contractkit' +import { PROXY_ADMIN_ADDRESS } from '@celo/connect' +import { ContractKit, StableToken } from '@celo/contractkit' +import { + STABLES_ADDRESS, + impersonateAccount, + setCode, + stopImpersonatingAccount, +} from '@celo/dev-utils/lib/anvil-test' import { mineBlocks } from '@celo/dev-utils/lib/ganache-test' import { addressToPublicKey } from '@celo/utils/lib/signatureUtils' import BigNumber from 'bignumber.js' import Web3 from 'web3' +import { proxyBytecode } from './constants' export const GANACHE_EPOCH_SIZE = 100 export const MIN_LOCKED_CELO_VALUE = new BigNumber(Web3.utils.toWei('10000', 'ether')) // 10k CELO @@ -116,3 +124,25 @@ export const voteForGroupFromAndActivateVotes = async ( export const mineEpoch = async (kit: ContractKit) => { await mineBlocks(100, kit.web3) } + +export const topUpWithToken = async ( + kit: ContractKit, + stableToken: StableToken, + account: string, + amount: BigNumber +) => { + const token = await kit.contracts.getStableToken(stableToken) + + await impersonateAccount(kit.web3, STABLES_ADDRESS) + await token.transfer(account, amount.toFixed()).sendAndWaitForReceipt({ + from: STABLES_ADDRESS, + }) + await stopImpersonatingAccount(kit.web3, STABLES_ADDRESS) +} + +// TODO remove this once no longer needed +export const setupL2 = async (kit: ContractKit) => { + // Temporarily deploying any bytecode, so it's just there, + // isCel2 should hence return true as it just checks for bytecode existence + await setCode(kit.web3, PROXY_ADMIN_ADDRESS, proxyBytecode) +} diff --git a/packages/cli/src/test-utils/cliUtils.ts b/packages/cli/src/test-utils/cliUtils.ts index 7c1bf99b9..6478a8bd2 100644 --- a/packages/cli/src/test-utils/cliUtils.ts +++ b/packages/cli/src/test-utils/cliUtils.ts @@ -1,4 +1,5 @@ import { Interfaces } from '@oclif/core' +import Web3 from 'web3' import { BaseCommand } from '../base' type AbstractConstructor = new (...args: any[]) => T @@ -6,16 +7,42 @@ interface Runner extends AbstractConstructor { run: typeof BaseCommand.run } +export async function testLocallyWithWeb3Node( + command: Runner, + argv: string[], + web3: Web3, + config?: Interfaces.LoadOptions +) { + return testLocally(command, [...argv, '--node', extractHostFromWeb3(web3)], config) +} + +export const extractHostFromWeb3 = (web3: Web3): string => { + if (web3.currentProvider instanceof Web3.providers.HttpProvider) { + return web3.currentProvider.host + } + + // CeloProvider is not exported from @celo/connect, but it's injected into web3 + if (web3.currentProvider !== null && web3.currentProvider.constructor.name === 'CeloProvider') { + return (web3.currentProvider as any).existingProvider.host + } + + throw new Error('Unsupported provider') +} + export async function testLocally( command: Runner, argv: string[], config?: Interfaces.LoadOptions ) { + if (argv.includes('--node')) { + return command.run(argv, config) + } + const extendedArgv = [...argv, '--node', 'local'] return command.run(extendedArgv, config) } -// Removes font-formatting ANSI codes (colors/styles) +// Removes font-formatting ANSI codes (colors/styles) from a string export const stripAnsiCodes = (text: string): string => { return text.replace(/\u001b\[.*?m/g, '') } diff --git a/packages/cli/src/test-utils/constants.ts b/packages/cli/src/test-utils/constants.ts index 65986889c..f2a725b2a 100644 --- a/packages/cli/src/test-utils/constants.ts +++ b/packages/cli/src/test-utils/constants.ts @@ -2,3 +2,18 @@ export const proxyBytecode = '0x608060405234801561001057600080fd5b506100203361002560201b60201c565b610155565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156100c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f6f776e65722063616e6e6f74206265203000000000000000000000000000000081525060200191505060405180910390fd5b6000600160405180807f656970313936372e70726f78792e61646d696e000000000000000000000000008152506013019050604051809103902060001c0360001b90508181558173ffffffffffffffffffffffffffffffffffffffff167f50146d0e3c60aa1d17a70635b05494f864e86144a2201275021014fbf08bafe260405160405180910390a25050565b610a22806101646000396000f3fe60806040526004361061004a5760003560e01c806303386ba3146101e757806342404e0714610280578063bb913f41146102d7578063d29d44ee14610328578063f7e6af8014610379575b6000600160405180807f656970313936372e70726f78792e696d706c656d656e746174696f6e00000000815250601c019050604051809103902060001c0360001b9050600081549050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610136576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f4e6f20496d706c656d656e746174696f6e20736574000000000000000000000081525060200191505060405180910390fd5b61013f816103d0565b6101b1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f496e76616c696420636f6e74726163742061646472657373000000000000000081525060200191505060405180910390fd5b60405136810160405236600082376000803683855af43d604051818101604052816000823e82600081146101e3578282f35b8282fd5b61027e600480360360408110156101fd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019064010000000081111561023a57600080fd5b82018360208201111561024c57600080fd5b8035906020019184600183028401116401000000008311171561026e57600080fd5b909192939192939050505061041b565b005b34801561028c57600080fd5b506102956105c1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156102e357600080fd5b50610326600480360360208110156102fa57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061060d565b005b34801561033457600080fd5b506103776004803603602081101561034b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506107bd565b005b34801561038557600080fd5b5061038e610871565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60008060007fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47060001b9050833f915080821415801561041257506000801b8214155b92505050919050565b610423610871565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146104c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f73656e64657220776173206e6f74206f776e657200000000000000000000000081525060200191505060405180910390fd5b6104cc8361060d565b600060608473ffffffffffffffffffffffffffffffffffffffff168484604051808383808284378083019250505092505050600060405180830381855af49150503d8060008114610539576040519150601f19603f3d011682016040523d82523d6000602084013e61053e565b606091505b508092508193505050816105ba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f696e697469616c697a6174696f6e2063616c6c6261636b206661696c6564000081525060200191505060405180910390fd5b5050505050565b600080600160405180807f656970313936372e70726f78792e696d706c656d656e746174696f6e00000000815250601c019050604051809103902060001c0360001b9050805491505090565b610615610871565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146106b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f73656e64657220776173206e6f74206f776e657200000000000000000000000081525060200191505060405180910390fd5b6000600160405180807f656970313936372e70726f78792e696d706c656d656e746174696f6e00000000815250601c019050604051809103902060001c0360001b9050610701826103d0565b610773576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f496e76616c696420636f6e74726163742061646472657373000000000000000081525060200191505060405180910390fd5b8181558173ffffffffffffffffffffffffffffffffffffffff167fab64f92ab780ecbf4f3866f57cee465ff36c89450dcce20237ca7a8d81fb7d1360405160405180910390a25050565b6107c5610871565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610865576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f73656e64657220776173206e6f74206f776e657200000000000000000000000081525060200191505060405180910390fd5b61086e816108bd565b50565b600080600160405180807f656970313936372e70726f78792e61646d696e000000000000000000000000008152506013019050604051809103902060001c0360001b9050805491505090565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610960576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f6f776e65722063616e6e6f74206265203000000000000000000000000000000081525060200191505060405180910390fd5b6000600160405180807f656970313936372e70726f78792e61646d696e000000000000000000000000008152506013019050604051809103902060001c0360001b90508181558173ffffffffffffffffffffffffffffffffffffffff167f50146d0e3c60aa1d17a70635b05494f864e86144a2201275021014fbf08bafe260405160405180910390a2505056fea265627a7a72315820ddaaedbcde72a50c209acc3d9132e085934b56b89e72a05cc3c769d6941d429064736f6c634300050d0032' export const multiSigBytecode = '0x608060405234801561001057600080fd5b506139f3806100206000396000f3fe6080604052600436106101665760003560e01c80639ace38c2116100d1578063ba51a6df1161008a578063d74f8edd11610064578063d74f8edd14610a2e578063dc8452cd14610a59578063e20056e614610a84578063ee22610b14610af557610166565b8063ba51a6df146108f4578063c01a8c841461092f578063c64274741461096a57610166565b80639ace38c2146105f7578063a0e67e2b146106f0578063a24efcdf1461075c578063a8abe69a14610787578063b5dc40c314610839578063b77bf600146108c957610166565b80633411c81c116101235780633411c81c1461039a578063547415251461040d5780635eae79591461046a5780637065cb4814610504578063784547a7146105555780638b51d13f146105a857610166565b8063025e7c27146101c0578063158ef93e1461023b578063173825d91461026a57806320ea8d86146102bb5780632e6c3721146102f65780632f54bf6e14610331575b60003411156101be573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b3480156101cc57600080fd5b506101f9600480360360208110156101e357600080fd5b8101908080359060200190929190505050610b30565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561024757600080fd5b50610250610b6c565b604051808215151515815260200191505060405180910390f35b34801561027657600080fd5b506102b96004803603602081101561028d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b7e565b005b3480156102c757600080fd5b506102f4600480360360208110156102de57600080fd5b8101908080359060200190929190505050610f1b565b005b34801561030257600080fd5b5061032f6004803603602081101561031957600080fd5b81019080803590602001909291905050506111dc565b005b34801561033d57600080fd5b506103806004803603602081101561035457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611347565b604051808215151515815260200191505060405180910390f35b3480156103a657600080fd5b506103f3600480360360408110156103bd57600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611367565b604051808215151515815260200191505060405180910390f35b34801561041957600080fd5b506104546004803603604081101561043057600080fd5b81019080803515159060200190929190803515159060200190929190505050611396565b6040518082815260200191505060405180910390f35b34801561047657600080fd5b506105026004803603606081101561048d57600080fd5b81019080803590602001906401000000008111156104aa57600080fd5b8201836020820111156104bc57600080fd5b803590602001918460208302840111640100000000831117156104de57600080fd5b90919293919293908035906020019092919080359060200190929190505050611448565b005b34801561051057600080fd5b506105536004803603602081101561052757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061182b565b005b34801561056157600080fd5b5061058e6004803603602081101561057857600080fd5b8101908080359060200190929190505050611bd5565b604051808215151515815260200191505060405180910390f35b3480156105b457600080fd5b506105e1600480360360208110156105cb57600080fd5b8101908080359060200190929190505050611d66565b6040518082815260200191505060405180910390f35b34801561060357600080fd5b506106306004803603602081101561061a57600080fd5b8101908080359060200190929190505050611e4d565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b838110156106b2578082015181840152602081019050610697565b50505050905090810190601f1680156106df5780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b3480156106fc57600080fd5b50610705611f42565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561074857808201518184015260208101905061072d565b505050509050019250505060405180910390f35b34801561076857600080fd5b50610771611fd0565b6040518082815260200191505060405180910390f35b34801561079357600080fd5b506107e2600480360360808110156107aa57600080fd5b810190808035906020019092919080359060200190929190803515159060200190929190803515159060200190929190505050611fd6565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561082557808201518184015260208101905061080a565b505050509050019250505060405180910390f35b34801561084557600080fd5b506108726004803603602081101561085c57600080fd5b8101908080359060200190929190505050612188565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156108b557808201518184015260208101905061089a565b505050509050019250505060405180910390f35b3480156108d557600080fd5b506108de6123e0565b6040518082815260200191505060405180910390f35b34801561090057600080fd5b5061092d6004803603602081101561091757600080fd5b81019080803590602001909291905050506123e6565b005b34801561093b57600080fd5b506109686004803603602081101561095257600080fd5b8101908080359060200190929190505050612551565b005b34801561097657600080fd5b50610a186004803603606081101561098d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001906401000000008111156109d457600080fd5b8201836020820111156109e657600080fd5b80359060200191846001830284011164010000000083111715610a0857600080fd5b909192939192939050505061286d565b6040518082815260200191505060405180910390f35b348015610a3a57600080fd5b50610a436128d1565b6040518082815260200191505060405180910390f35b348015610a6557600080fd5b50610a6e6128d6565b6040518082815260200191505060405180910390f35b348015610a9057600080fd5b50610af360048036036040811015610aa757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506128dc565b005b348015610b0157600080fd5b50610b2e60048036036020811015610b1857600080fd5b8101908080359060200190929190505050612db7565b005b60048181548110610b3d57fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900460ff1681565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c02576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806139716022913960400191505060405180910390fd5b80600360008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610cc2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f6f776e657220646f6573206e6f7420657869737400000000000000000000000081525060200191505060405180910390fd5b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060008090505b610d3960016004805490506131ec90919063ffffffff16565b811015610e70578273ffffffffffffffffffffffffffffffffffffffff1660048281548110610d6457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610e55576004610dc660016004805490506131ec90919063ffffffff16565b81548110610dd057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660048281548110610e0857fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610e70565b610e6960018261323690919063ffffffff16565b9050610d20565b50610e8a60016004805490506131ec90919063ffffffff16565b600481610e97919061376a565b506004805490506005541115610eb657610eb56004805490506123e6565b5b6004805490506006541115610ed457610ed36004805490506111dc565b5b8173ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a25050565b33600360008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610fdb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f6f776e657220646f6573206e6f7420657869737400000000000000000000000081525060200191505060405180910390fd5b81336002600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611090576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602781526020018061394a6027913960400191505060405180910390fd5b836001600082815260200190815260200160002060030160009054906101000a900460ff1615611128576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f7472616e73616374696f6e2077617320657865637574656420616c726561647981525060200191505060405180910390fd5b60006002600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35050505050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611260576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806139716022913960400191505060405180910390fd5b60048054905081603282111580156112785750818111155b8015611285575060008114155b8015611292575060008214155b611304576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f696e76616c696420726571756972656d656e740000000000000000000000000081525060200191505060405180910390fd5b826006819055507fa07eff79ea50418b0e96ff7c01d65eb6c3a5a240ee91cd81c70c89503dd41239836040518082815260200191505060405180910390a1505050565b60036020528060005260406000206000915054906101000a900460ff1681565b60026020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b600080600090505b600754811015611441578380156113d657506001600082815260200190815260200160002060030160009054906101000a900460ff16155b8061140a575082801561140957506001600082815260200190815260200160002060030160009054906101000a900460ff165b5b156114265761142360018361323690919063ffffffff16565b91505b61143a60018261323690919063ffffffff16565b905061139e565b5092915050565b6000809054906101000a900460ff16156114ca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f636f6e747261637420616c726561647920696e697469616c697a65640000000081525060200191505060405180910390fd5b60016000806101000a81548160ff0219169083151502179055508383905082603282111580156114fa5750818111155b8015611507575060008114155b8015611514575060008214155b611586576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f696e76616c696420726571756972656d656e740000000000000000000000000081525060200191505060405180910390fd5b85859050836032821115801561159c5750818111155b80156115a9575060008114155b80156115b6575060008214155b611628576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f696e76616c696420726571756972656d656e740000000000000000000000000081525060200191505060405180910390fd5b60008090505b8888905081101561180057600360008a8a8481811061164957fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156117105750600073ffffffffffffffffffffffffffffffffffffffff168989838181106116da57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b611765576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c815260200180613993602c913960400191505060405180910390fd5b6001600360008b8b8581811061177757fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506117f960018261323690919063ffffffff16565b905061162e565b50878760049190611812929190613796565b5085600581905550846006819055505050505050505050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146118af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806139716022913960400191505060405180910390fd5b80600360008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611970576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f6f776e657220616c72656164792065786973746564000000000000000000000081525060200191505060405180910390fd5b81600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611a14576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f6164647265737320776173206e756c6c0000000000000000000000000000000081525060200191505060405180910390fd5b611a2d600160048054905061323690919063ffffffff16565b60065460328211158015611a415750818111155b8015611a4e575060008114155b8015611a5b575060008214155b611acd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f696e76616c696420726571756972656d656e740000000000000000000000000081525060200191505060405180910390fd5b6001600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060048590806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000905060008090505b600480549050811015611d5a5760026000858152602001908152602001600020600060048381548110611c1157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611ca057611c9d60018361323690919063ffffffff16565b91505b60003073ffffffffffffffffffffffffffffffffffffffff166001600087815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16149050808015611d17575060065483145b80611d2d575080158015611d2c575060055483145b5b15611d3e5760019350505050611d61565b50611d5360018261323690919063ffffffff16565b9050611be2565b5060009150505b919050565b600080600090505b600480549050811015611e475760026000848152602001908152602001600020600060048381548110611d9d57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611e2c57611e2960018361323690919063ffffffff16565b91505b611e4060018261323690919063ffffffff16565b9050611d6e565b50919050565b60016020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806001015490806002018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611f255780601f10611efa57610100808354040283529160200191611f25565b820191906000526020600020905b815481529060010190602001808311611f0857829003601f168201915b5050505050908060030160009054906101000a900460ff16905084565b60606004805480602002602001604051908101604052809291908181526020018280548015611fc657602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611f7c575b5050505050905090565b60065481565b60608060075460405190808252806020026020018201604052801561200a5781602001602082028038833980820191505090505b509050600080905060008090505b6007548110156120d45785801561205057506001600082815260200190815260200160002060030160009054906101000a900460ff16155b80612084575084801561208357506001600082815260200190815260200160002060030160009054906101000a900460ff165b5b156120b9578083838151811061209657fe5b6020026020010181815250506120b660018361323690919063ffffffff16565b91505b6120cd60018261323690919063ffffffff16565b9050612018565b6120e788886131ec90919063ffffffff16565b6040519080825280602002602001820160405280156121155781602001602082028038833980820191505090505b5093508790505b8681101561217d5782818151811061213057fe5b60200260200101518461214c8a846131ec90919063ffffffff16565b8151811061215657fe5b60200260200101818152505061217660018261323690919063ffffffff16565b905061211c565b505050949350505050565b6060806004805490506040519080825280602002602001820160405280156121bf5781602001602082028038833980820191505090505b509050600080905060008090505b60048054905081101561232457600260008681526020019081526020016000206000600483815481106121fc57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615612309576004818154811061228157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168383815181106122b857fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061230660018361323690919063ffffffff16565b91505b61231d60018261323690919063ffffffff16565b90506121cd565b816040519080825280602002602001820160405280156123535781602001602082028038833980820191505090505b509350600090505b818110156123d85782818151811061236f57fe5b602002602001015184828151811061238357fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506123d160018261323690919063ffffffff16565b905061235b565b505050919050565b60075481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461246a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806139716022913960400191505060405180910390fd5b60048054905081603282111580156124825750818111155b801561248f575060008114155b801561249c575060008214155b61250e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f696e76616c696420726571756972656d656e740000000000000000000000000081525060200191505060405180910390fd5b826005819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600360008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16612611576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f6f776e657220646f6573206e6f7420657869737400000000000000000000000081525060200191505060405180910390fd5b81600073ffffffffffffffffffffffffffffffffffffffff166001600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156126eb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f7472616e73616374696f6e20646f6573206e6f7420657869737400000000000081525060200191505060405180910390fd5b82336002600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156127a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b81526020018061391f602b913960400191505060405180910390fd5b60016002600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a361285785611bd5565b156128665761286585612db7565b5b5050505050565b60006128be858585858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506132be565b90506128c981612551565b949350505050565b603281565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612960576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806139716022913960400191505060405180910390fd5b81600360008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16612a20576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f6f776e657220646f6573206e6f7420657869737400000000000000000000000081525060200191505060405180910390fd5b81600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612ac4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f6164647265737320776173206e756c6c0000000000000000000000000000000081525060200191505060405180910390fd5b82600360008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615612b85576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f6f776e657220616c72656164792065786973746564000000000000000000000081525060200191505060405180910390fd5b60008090505b600480549050811015612c79578573ffffffffffffffffffffffffffffffffffffffff1660048281548110612bbc57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415612c5e578460048281548110612c1157fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550612c79565b612c7260018261323690919063ffffffff16565b9050612b8b565b506000600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b33600360008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16612e77576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f6f776e657220646f6573206e6f7420657869737400000000000000000000000081525060200191505060405180910390fd5b81336002600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16612f2c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602781526020018061394a6027913960400191505060405180910390fd5b836001600082815260200190815260200160002060030160009054906101000a900460ff1615612fc4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f7472616e73616374696f6e2077617320657865637574656420616c726561647981525060200191505060405180910390fd5b612fcd85611bd5565b61303f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f5472616e73616374696f6e206e6f7420636f6e6669726d65642e00000000000081525060200191505060405180910390fd5b600060016000878152602001908152602001600020905060018160030160006101000a81548160ff02191690831515021790555060606131448260000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168360010154846002018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561313a5780601f1061310f5761010080835404028352916020019161313a565b820191906000526020600020905b81548152906001019060200180831161311d57829003601f168201915b5050505050613498565b9050867f0c18aae526accb31b01cf9a15bdf435e70632ee31efc4c5c0752c4262ea45d2f826040518080602001828103825283818151815260200191508051906020019080838360005b838110156131a957808201518184015260208101905061318e565b50505050905090810190601f1680156131d65780820380516001836020036101000a031916815260200191505b509250505060405180910390a250505050505050565b600061322e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061365f565b905092915050565b6000808284019050838110156132b4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600083600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415613364576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f6164647265737320776173206e756c6c0000000000000000000000000000000081525060200191505060405180910390fd5b600754915060405180608001604052808673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001600015158152506001600084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101556040820151816002019080519060200190613423929190613836565b5060608201518160030160006101000a81548160ff02191690831515021790555090505061345d600160075461323690919063ffffffff16565b600781905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b6060600082511115613520576134ad8461371f565b61351f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f496e76616c696420636f6e74726163742061646472657373000000000000000081525060200191505060405180910390fd5b5b600060608573ffffffffffffffffffffffffffffffffffffffff1685856040518082805190602001908083835b60208310613570578051825260208201915060208101905060208303925061354d565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146135d2576040519150601f19603f3d011682016040523d82523d6000602084013e6135d7565b606091505b50809250819350505081613653576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f5472616e73616374696f6e20657865637574696f6e206661696c65642e00000081525060200191505060405180910390fd5b80925050509392505050565b600083831115829061370c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156136d15780820151818401526020810190506136b6565b50505050905090810190601f1680156136fe5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60008060007fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47060001b9050833f915080821415801561376157506000801b8214155b92505050919050565b8154818355818111156137915781836000526020600020918201910161379091906138b6565b5b505050565b828054828255906000526020600020908101928215613825579160200282015b8281111561382457823573ffffffffffffffffffffffffffffffffffffffff168260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550916020019190600101906137b6565b5b50905061383291906138db565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061387757805160ff19168380011785556138a5565b828001600101855582156138a5579182015b828111156138a4578251825591602001919060010190613889565b5b5090506138b291906138b6565b5090565b6138d891905b808211156138d45760008160009055506001016138bc565b5090565b90565b61391b91905b8082111561391757600081816101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055506001016138e1565b5090565b9056fe7472616e73616374696f6e2077617320616c726561647920636f6e6669726d656420666f72206f776e65727472616e73616374696f6e20776173206e6f7420636f6e6669726d656420666f72206f776e65726d73672e73656e64657220776173206e6f74206d756c74697369672077616c6c65746f776e657220776173206e756c6c206f7220616c726561647920676976656e206f776e657220737461747573a265627a7a7231582048e9e033be9fab18105a8fd3cc78442bca466a52949036d1e14f806a4205ff6864736f6c634300050d0032' + +/** + * TODO currently doesn't work and fails with "No Signer available" error + * + * Generated by running (need to have foundry and celocli installed): + * + * anvil --load-state=node_modules/@celo/devchain-anvil/devchain.json + * + * and in a new tab: + * + * NO_SYNCCHECK=1 celocli account:proof-of-possession --node local --account 0x5409ED021D9299bf6814279A6A1411A7e866A631 --signer 0x6Ecbe1DB9EF729CBe972C83Fb886247691Fb6beb + */ + +export const PROOF_OF_POSSESSION_SIGNATURE = + '0x1b9fca4bbb5bfb1dbe69ef1cddbd9b4202dcb6b134c5170611e1e36ecfa468d7b46c85328d504934fce6c2a1571603a50ae224d2b32685e84d4d1a1eebad8452eb' diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json index fd35256bb..f9fedecb4 100644 --- a/packages/dev-utils/package.json +++ b/packages/dev-utils/package.json @@ -20,6 +20,7 @@ "prepack": "yarn build" }, "dependencies": { + "@viem/anvil": "^0.0.9", "bignumber.js": "^9.0.0", "fs-extra": "^8.1.0", "ganache": "npm:@celo/ganache@7.8.0-unofficial.0", diff --git a/packages/dev-utils/src/anvil-test.ts b/packages/dev-utils/src/anvil-test.ts new file mode 100644 index 000000000..3cd3c60cb --- /dev/null +++ b/packages/dev-utils/src/anvil-test.ts @@ -0,0 +1,59 @@ +import { Anvil, CreateAnvilOptions, createAnvil } from '@viem/anvil' +import Web3 from 'web3' +import { + TEST_BALANCE, + TEST_GAS_LIMIT, + TEST_GAS_PRICE, + TEST_MNEMONIC, + jsonRpcCall, + testWithWeb3, +} from './test-utils' + +let instance: null | Anvil = null + +const ANVIL_PORT = 8546 + +export const STABLES_ADDRESS = '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266' + +export function createInstance(): Anvil { + // preparation for not needing to have --runInBand for anvil tests + const port = ANVIL_PORT + (process.pid - process.ppid) + const options: CreateAnvilOptions = { + port, + loadState: require.resolve('@celo/devchain-anvil/devchain.json'), + mnemonic: TEST_MNEMONIC, + balance: TEST_BALANCE, + gasPrice: TEST_GAS_PRICE, + gasLimit: TEST_GAS_LIMIT, + } + + instance = createAnvil(options) + + return instance +} + +export function testWithAnvil(name: string, fn: (web3: Web3) => void) { + const anvil = createInstance() + + // for each test case, we start and stop a new anvil instance + return testWithWeb3(name, `http://127.0.0.1:${anvil.port}`, fn, { + beforeAll: () => { + return anvil.start() + }, + afterAll: async () => { + return anvil.stop() + }, + }) +} + +export function impersonateAccount(web3: Web3, address: string) { + return jsonRpcCall(web3, 'anvil_impersonateAccount', [address]) +} + +export function stopImpersonatingAccount(web3: Web3, address: string) { + return jsonRpcCall(web3, 'anvil_stopImpersonatingAccount', [address]) +} + +export function setCode(web3: Web3, address: string, code: string) { + return jsonRpcCall(web3, 'anvil_setCode', [address, code]) +} diff --git a/packages/dev-utils/src/ganache-setup.ts b/packages/dev-utils/src/ganache-setup.ts index c97afaf04..6046cdc60 100644 --- a/packages/dev-utils/src/ganache-setup.ts +++ b/packages/dev-utils/src/ganache-setup.ts @@ -2,9 +2,8 @@ import * as fs from 'fs-extra' import * as ganache from 'ganache' import * as path from 'path' import * as targz from 'targz' +import { TEST_BALANCE, TEST_GAS_LIMIT, TEST_GAS_PRICE, TEST_MNEMONIC } from './test-utils' -/* eslint no-console: 0 */ // --> OFF -const MNEMONIC = 'concert load couple harbor equip island argue ramp clarify fence smart topic' export const ACCOUNT_PRIVATE_KEYS = [ '0xf2f48ee19680706196e2e339e5da3491186e0c4c5030670656b0e0164837257d', '0x5d862464fe9303452126c8bc94274b8c5f9874cbd219789b3eb2128075a76f72', @@ -67,10 +66,10 @@ function launchServer(opts: { verbose?: boolean; from_targz?: boolean }, chain?: } const server = ganache.server({ - wallet: { mnemonic: MNEMONIC, defaultBalance: 1000000 }, + wallet: { mnemonic: TEST_MNEMONIC, defaultBalance: TEST_BALANCE }, logging: { logger: { log: logFn } }, database: { dbPath: chain }, - miner: { blockGasLimit: 20000000, defaultGasPrice: 0 }, + miner: { blockGasLimit: TEST_GAS_LIMIT, defaultGasPrice: TEST_GAS_PRICE }, chain: { networkId: 1101, chainId: 1, allowUnlimitedContractSize: true, hardfork: 'istanbul' }, }) diff --git a/packages/dev-utils/src/ganache-test.ts b/packages/dev-utils/src/ganache-test.ts index 673c02357..6cf253d1f 100644 --- a/packages/dev-utils/src/ganache-test.ts +++ b/packages/dev-utils/src/ganache-test.ts @@ -1,44 +1,9 @@ import Web3 from 'web3' -import { JsonRpcResponse } from 'web3-core-helpers' import migrationOverride from './migration-override.json' +import { jsonRpcCall, testWithWeb3 } from './test-utils' export const NetworkConfig = migrationOverride -export function jsonRpcCall(web3: Web3, method: string, params: any[]): Promise { - return new Promise((resolve, reject) => { - if (web3.currentProvider && typeof web3.currentProvider !== 'string') { - web3.currentProvider.send( - { - id: new Date().getTime(), - jsonrpc: '2.0', - method, - params, - }, - (err: Error | null, res?: JsonRpcResponse) => { - if (err) { - reject(err) - } else if (!res) { - reject(new Error('no response')) - } else if (res.error) { - reject( - new Error( - `Failed JsonRpcResponse: method: ${method} params: ${JSON.stringify( - params - )} error: ${JSON.stringify(res.error)}` - ) - ) - } else { - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - resolve(res.result) - } - } - ) - } else { - reject(new Error('Invalid provider')) - } - }) -} - export async function timeTravel(seconds: number, web3: Web3) { await jsonRpcCall(web3, 'evm_increaseTime', [seconds]) await jsonRpcCall(web3, 'evm_mine', []) @@ -50,35 +15,8 @@ export async function mineBlocks(blocks: number, web3: Web3) { } } -export function evmRevert(web3: Web3, snapId: string): Promise { - return jsonRpcCall(web3, 'evm_revert', [snapId]) -} - -export function evmSnapshot(web3: Web3) { - return jsonRpcCall(web3, 'evm_snapshot', []) -} - export function testWithGanache(name: string, fn: (web3: Web3) => void) { - const web3 = new Web3('http://localhost:8545') - - describe(name, () => { - let snapId: string | null = null - - beforeEach(async () => { - if (snapId != null) { - await evmRevert(web3, snapId) - } - snapId = await evmSnapshot(web3) - }) - - afterAll(async () => { - if (snapId != null) { - await evmRevert(web3, snapId) - } - }) - - fn(web3) - }) + return testWithWeb3(name, 'http://localhost:8545', fn) } /** diff --git a/packages/dev-utils/src/test-utils.ts b/packages/dev-utils/src/test-utils.ts new file mode 100644 index 000000000..c8b14f414 --- /dev/null +++ b/packages/dev-utils/src/test-utils.ts @@ -0,0 +1,95 @@ +import Web3 from 'web3' +import { JsonRpcResponse } from 'web3-core-helpers' +import migrationOverride from './migration-override.json' + +export const TEST_MNEMONIC = + 'concert load couple harbor equip island argue ramp clarify fence smart topic' +export const TEST_BALANCE = 1000000 +export const TEST_GAS_PRICE = 0 +export const TEST_GAS_LIMIT = 20000000 + +export const NetworkConfig = migrationOverride + +export function jsonRpcCall(web3: Web3, method: string, params: any[]): Promise { + return new Promise((resolve, reject) => { + if (web3.currentProvider && typeof web3.currentProvider !== 'string') { + web3.currentProvider.send( + { + id: new Date().getTime(), + jsonrpc: '2.0', + method, + params, + }, + (err: Error | null, res?: JsonRpcResponse) => { + if (err) { + reject(err) + } else if (!res) { + reject(new Error('no response')) + } else if (res.error) { + reject( + new Error( + `Failed JsonRpcResponse: method: ${method} params: ${JSON.stringify( + params + )} error: ${JSON.stringify(res.error)}` + ) + ) + } else { + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + resolve(res.result) + } + } + ) + } else { + reject(new Error('Invalid provider')) + } + }) +} + +export function evmRevert(web3: Web3, snapId: string): Promise { + return jsonRpcCall(web3, 'evm_revert', [snapId]) +} + +export function evmSnapshot(web3: Web3) { + return jsonRpcCall(web3, 'evm_snapshot', []) +} + +type TestWithWeb3Hooks = { + beforeAll?: () => Promise + afterAll?: () => Promise +} + +export function testWithWeb3( + name: string, + rpcUrl: string, + fn: (web3: Web3) => void, + hooks?: TestWithWeb3Hooks +) { + const web3 = new Web3(rpcUrl) + + describe(name, () => { + let snapId: string | null = null + + if (hooks?.beforeAll) { + beforeAll(hooks.beforeAll) + } + + beforeEach(async () => { + if (snapId != null) { + await evmRevert(web3, snapId) + } + snapId = await evmSnapshot(web3) + }) + + afterAll(async () => { + if (snapId != null) { + await evmRevert(web3, snapId) + } + }) + + if (hooks?.afterAll) { + afterAll(hooks.afterAll) + } + + fn(web3) + }) +} diff --git a/packages/dev-utils/tsconfig.json b/packages/dev-utils/tsconfig.json index a11e6de79..8c3f20377 100644 --- a/packages/dev-utils/tsconfig.json +++ b/packages/dev-utils/tsconfig.json @@ -12,5 +12,8 @@ "strict": false, "declaration": true, }, - "include": ["src/**/*", "src/migration-override.json"] + "include": [ + "src/**/*", + "src/migration-override.json" + ] } diff --git a/packages/sdk/base/README.MD b/packages/sdk/base/README.MD index 2fc5f3c25..6ee0b7fc7 100644 --- a/packages/sdk/base/README.MD +++ b/packages/sdk/base/README.MD @@ -12,7 +12,7 @@ Please use GitHub to: πŸ’¬ [Ask a question](https://github.com/celo-org/developer-tooling/discussions) -✨ [Suggest a feature](httpsi//github.com/celo-org/developer-tooling/issues/new/choose) +✨ [Suggest a feature](https://github.com/celo-org/developer-tooling/issues/new/choose) πŸ§‘β€πŸ’» [Contribute!](/CONTRIBUTING.md) diff --git a/packages/sdk/connect/README.md b/packages/sdk/connect/README.md index 6ff7c00ef..7b9ed7071 100644 --- a/packages/sdk/connect/README.md +++ b/packages/sdk/connect/README.md @@ -11,7 +11,7 @@ Please use GitHub to: πŸ’¬ [Ask a question](https://github.com/celo-org/developer-tooling/discussions) -✨ [Suggest a feature](httpsi//github.com/celo-org/developer-tooling/issues/new/choose) +✨ [Suggest a feature](https://github.com/celo-org/developer-tooling/issues/new/choose) πŸ§‘β€πŸ’» [Contribute!](/CONTRIBUTING.md) diff --git a/packages/sdk/contractkit/README.md b/packages/sdk/contractkit/README.md index 6e4e26f5d..765b351c6 100644 --- a/packages/sdk/contractkit/README.md +++ b/packages/sdk/contractkit/README.md @@ -28,7 +28,7 @@ Please use GitHub to: πŸ’¬ [Ask a question](https://github.com/celo-org/developer-tooling/discussions) -✨ [Suggest a feature](httpsi//github.com/celo-org/developer-tooling/issues/new/choose) +✨ [Suggest a feature](https://github.com/celo-org/developer-tooling/issues/new/choose) πŸ§‘β€πŸ’» [Contribute!](/CONTRIBUTING.md) diff --git a/packages/sdk/cryptographic-utils/README.md b/packages/sdk/cryptographic-utils/README.md index de64aaf2b..544c883b6 100644 --- a/packages/sdk/cryptographic-utils/README.md +++ b/packages/sdk/cryptographic-utils/README.md @@ -15,7 +15,7 @@ Please use GitHub to: πŸ’¬ [Ask a question](https://github.com/celo-org/developer-tooling/discussions) -✨ [Suggest a feature](httpsi//github.com/celo-org/developer-tooling/issues/new/choose) +✨ [Suggest a feature](https://github.com/celo-org/developer-tooling/issues/new/choose) πŸ§‘β€πŸ’» [Contribute!](/CONTRIBUTING.md) diff --git a/packages/sdk/explorer/README.md b/packages/sdk/explorer/README.md index b9cc3c7b5..7e5f38a0d 100644 --- a/packages/sdk/explorer/README.md +++ b/packages/sdk/explorer/README.md @@ -11,7 +11,7 @@ Please use GitHub to: πŸ’¬ [Ask a question](https://github.com/celo-org/developer-tooling/discussions) -✨ [Suggest a feature](httpsi//github.com/celo-org/developer-tooling/issues/new/choose) +✨ [Suggest a feature](https://github.com/celo-org/developer-tooling/issues/new/choose) πŸ§‘β€πŸ’» [Contribute!](/CONTRIBUTING.md) diff --git a/packages/sdk/governance/README.md b/packages/sdk/governance/README.md index 11949cdaf..1559a18e2 100644 --- a/packages/sdk/governance/README.md +++ b/packages/sdk/governance/README.md @@ -15,7 +15,7 @@ Please use GitHub to: πŸ’¬ [Ask a question](https://github.com/celo-org/developer-tooling/discussions) -✨ [Suggest a feature](httpsi//github.com/celo-org/developer-tooling/issues/new/choose) +✨ [Suggest a feature](https://github.com/celo-org/developer-tooling/issues/new/choose) πŸ§‘β€πŸ’» [Contribute!](/CONTRIBUTING.md) diff --git a/packages/sdk/keystores/README.md b/packages/sdk/keystores/README.md index d8b3dfac5..0791ae31a 100644 --- a/packages/sdk/keystores/README.md +++ b/packages/sdk/keystores/README.md @@ -9,7 +9,7 @@ Please use GitHub to: πŸ’¬ [Ask a question](https://github.com/celo-org/developer-tooling/discussions) -✨ [Suggest a feature](httpsi//github.com/celo-org/developer-tooling/issues/new/choose) +✨ [Suggest a feature](https://github.com/celo-org/developer-tooling/issues/new/choose) πŸ§‘β€πŸ’» [Contribute!](/CONTRIBUTING.md) diff --git a/packages/sdk/network-utils/README.md b/packages/sdk/network-utils/README.md index aa28866fd..748427646 100644 --- a/packages/sdk/network-utils/README.md +++ b/packages/sdk/network-utils/README.md @@ -11,7 +11,7 @@ Please use GitHub to: πŸ’¬ [Ask a question](https://github.com/celo-org/developer-tooling/discussions) -✨ [Suggest a feature](httpsi//github.com/celo-org/developer-tooling/issues/new/choose) +✨ [Suggest a feature](https://github.com/celo-org/developer-tooling/issues/new/choose) πŸ§‘β€πŸ’» [Contribute!](/CONTRIBUTING.md) diff --git a/packages/sdk/phone-utils/README.md b/packages/sdk/phone-utils/README.md index 95569f4dc..941f00929 100644 --- a/packages/sdk/phone-utils/README.md +++ b/packages/sdk/phone-utils/README.md @@ -15,7 +15,7 @@ Please use GitHub to: πŸ’¬ [Ask a question](https://github.com/celo-org/developer-tooling/discussions) -✨ [Suggest a feature](httpsi//github.com/celo-org/developer-tooling/issues/new/choose) +✨ [Suggest a feature](https://github.com/celo-org/developer-tooling/issues/new/choose) πŸ§‘β€πŸ’» [Contribute!](/CONTRIBUTING.md) diff --git a/packages/sdk/transactions-uri/README.md b/packages/sdk/transactions-uri/README.md index ec3a78a36..9fb056eac 100644 --- a/packages/sdk/transactions-uri/README.md +++ b/packages/sdk/transactions-uri/README.md @@ -11,7 +11,7 @@ Please use GitHub to: πŸ’¬ [Ask a question](https://github.com/celo-org/developer-tooling/discussions) -✨ [Suggest a feature](httpsi//github.com/celo-org/developer-tooling/issues/new/choose) +✨ [Suggest a feature](https://github.com/celo-org/developer-tooling/issues/new/choose) πŸ§‘β€πŸ’» [Contribute!](/CONTRIBUTING.md) diff --git a/packages/sdk/utils/README.md b/packages/sdk/utils/README.md index 618f3aae8..2ddd3342e 100644 --- a/packages/sdk/utils/README.md +++ b/packages/sdk/utils/README.md @@ -11,7 +11,7 @@ Please use GitHub to: πŸ’¬ [Ask a question](https://github.com/celo-org/developer-tooling/discussions) -✨ [Suggest a feature](httpsi//github.com/celo-org/developer-tooling/issues/new/choose) +✨ [Suggest a feature](https://github.com/celo-org/developer-tooling/issues/new/choose) πŸ§‘β€πŸ’» [Contribute!](/CONTRIBUTING.md) diff --git a/packages/sdk/wallets/wallet-base/Readme.md b/packages/sdk/wallets/wallet-base/Readme.md index bff29d2b9..3b03560c7 100644 --- a/packages/sdk/wallets/wallet-base/Readme.md +++ b/packages/sdk/wallets/wallet-base/Readme.md @@ -11,7 +11,7 @@ Please use GitHub to: πŸ’¬ [Ask a question](https://github.com/celo-org/developer-tooling/discussions) -✨ [Suggest a feature](httpsi//github.com/celo-org/developer-tooling/issues/new/choose) +✨ [Suggest a feature](https://github.com/celo-org/developer-tooling/issues/new/choose) πŸ§‘β€πŸ’» [Contribute!](/CONTRIBUTING.md) diff --git a/packages/sdk/wallets/wallet-hsm-aws/README.MD b/packages/sdk/wallets/wallet-hsm-aws/README.MD index 6d99f6f14..92b186d81 100644 --- a/packages/sdk/wallets/wallet-hsm-aws/README.MD +++ b/packages/sdk/wallets/wallet-hsm-aws/README.MD @@ -11,7 +11,7 @@ Please use GitHub to: πŸ’¬ [Ask a question](https://github.com/celo-org/developer-tooling/discussions) -✨ [Suggest a feature](httpsi//github.com/celo-org/developer-tooling/issues/new/choose) +✨ [Suggest a feature](https://github.com/celo-org/developer-tooling/issues/new/choose) πŸ§‘β€πŸ’» [Contribute!](/CONTRIBUTING.md) diff --git a/packages/sdk/wallets/wallet-hsm-azure/README.md b/packages/sdk/wallets/wallet-hsm-azure/README.md index af5dbd5cb..69f3e609c 100644 --- a/packages/sdk/wallets/wallet-hsm-azure/README.md +++ b/packages/sdk/wallets/wallet-hsm-azure/README.md @@ -11,7 +11,7 @@ Please use GitHub to: πŸ’¬ [Ask a question](https://github.com/celo-org/developer-tooling/discussions) -✨ [Suggest a feature](httpsi//github.com/celo-org/developer-tooling/issues/new/choose) +✨ [Suggest a feature](https://github.com/celo-org/developer-tooling/issues/new/choose) πŸ§‘β€πŸ’» [Contribute!](/CONTRIBUTING.md) diff --git a/packages/sdk/wallets/wallet-hsm-gcp/README.md b/packages/sdk/wallets/wallet-hsm-gcp/README.md index 11ba982ee..95c402f26 100644 --- a/packages/sdk/wallets/wallet-hsm-gcp/README.md +++ b/packages/sdk/wallets/wallet-hsm-gcp/README.md @@ -9,7 +9,7 @@ Please use GitHub to: πŸ’¬ [Ask a question](https://github.com/celo-org/developer-tooling/discussions) -✨ [Suggest a feature](httpsi//github.com/celo-org/developer-tooling/issues/new/choose) +✨ [Suggest a feature](https://github.com/celo-org/developer-tooling/issues/new/choose) πŸ§‘β€πŸ’» [Contribute!](/CONTRIBUTING.md) diff --git a/packages/sdk/wallets/wallet-hsm/README.md b/packages/sdk/wallets/wallet-hsm/README.md index 8e5b980e2..3c0aed977 100644 --- a/packages/sdk/wallets/wallet-hsm/README.md +++ b/packages/sdk/wallets/wallet-hsm/README.md @@ -11,7 +11,7 @@ Please use GitHub to: πŸ’¬ [Ask a question](https://github.com/celo-org/developer-tooling/discussions) -✨ [Suggest a feature](httpsi//github.com/celo-org/developer-tooling/issues/new/choose) +✨ [Suggest a feature](https://github.com/celo-org/developer-tooling/issues/new/choose) πŸ§‘β€πŸ’» [Contribute!](/CONTRIBUTING.md) diff --git a/packages/sdk/wallets/wallet-ledger/README.MD b/packages/sdk/wallets/wallet-ledger/README.MD index 7dfee1d86..e609665e0 100644 --- a/packages/sdk/wallets/wallet-ledger/README.MD +++ b/packages/sdk/wallets/wallet-ledger/README.MD @@ -11,7 +11,7 @@ Please use GitHub to: πŸ’¬ [Ask a question](https://github.com/celo-org/developer-tooling/discussions) -✨ [Suggest a feature](httpsi//github.com/celo-org/developer-tooling/issues/new/choose) +✨ [Suggest a feature](https://github.com/celo-org/developer-tooling/issues/new/choose) πŸ§‘β€πŸ’» [Contribute!](/CONTRIBUTING.md) diff --git a/packages/sdk/wallets/wallet-local/Readme.MD b/packages/sdk/wallets/wallet-local/Readme.MD index 1a9127bb8..2a62de427 100644 --- a/packages/sdk/wallets/wallet-local/Readme.MD +++ b/packages/sdk/wallets/wallet-local/Readme.MD @@ -11,7 +11,7 @@ Please use GitHub to: πŸ’¬ [Ask a question](https://github.com/celo-org/developer-tooling/discussions) -✨ [Suggest a feature](httpsi//github.com/celo-org/developer-tooling/issues/new/choose) +✨ [Suggest a feature](https://github.com/celo-org/developer-tooling/issues/new/choose) πŸ§‘β€πŸ’» [Contribute!](/CONTRIBUTING.md) diff --git a/packages/sdk/wallets/wallet-remote/README.md b/packages/sdk/wallets/wallet-remote/README.md index 137e99614..7b1e51cdf 100644 --- a/packages/sdk/wallets/wallet-remote/README.md +++ b/packages/sdk/wallets/wallet-remote/README.md @@ -11,7 +11,7 @@ Please use GitHub to: πŸ’¬ [Ask a question](https://github.com/celo-org/developer-tooling/discussions) -✨ [Suggest a feature](httpsi//github.com/celo-org/developer-tooling/issues/new/choose) +✨ [Suggest a feature](https://github.com/celo-org/developer-tooling/issues/new/choose) πŸ§‘β€πŸ’» [Contribute!](/CONTRIBUTING.md) diff --git a/packages/sdk/wallets/wallet-rpc/README.md b/packages/sdk/wallets/wallet-rpc/README.md index 0c7c9c3a1..e8e1b55fa 100644 --- a/packages/sdk/wallets/wallet-rpc/README.md +++ b/packages/sdk/wallets/wallet-rpc/README.md @@ -11,7 +11,7 @@ Please use GitHub to: πŸ’¬ [Ask a question](https://github.com/celo-org/developer-tooling/discussions) -✨ [Suggest a feature](httpsi//github.com/celo-org/developer-tooling/issues/new/choose) +✨ [Suggest a feature](https://github.com/celo-org/developer-tooling/issues/new/choose) πŸ§‘β€πŸ’» [Contribute!](/CONTRIBUTING.md) diff --git a/yarn.lock b/yarn.lock index 7a0f14e15..0b8e9e5ee 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1612,6 +1612,7 @@ __metadata: "@celo/contractkit": "npm:^8.0.0" "@celo/cryptographic-utils": "npm:^5.0.8" "@celo/dev-utils": "npm:0.0.3" + "@celo/devchain-anvil": "npm:^0.0.11007" "@celo/explorer": "npm:^5.0.10" "@celo/governance": "npm:^5.1.1" "@celo/identity": "npm:^5.1.2" @@ -1793,6 +1794,7 @@ __metadata: "@tsconfig/recommended": "npm:^1.0.3" "@types/fs-extra": "npm:^8.1.0" "@types/targz": "npm:1.0.0" + "@viem/anvil": "npm:^0.0.9" bignumber.js: "npm:^9.0.0" fs-extra: "npm:^8.1.0" ganache: "npm:@celo/ganache@7.8.0-unofficial.0" @@ -1803,6 +1805,13 @@ __metadata: languageName: unknown linkType: soft +"@celo/devchain-anvil@npm:^0.0.11007": + version: 0.0.11007 + resolution: "@celo/devchain-anvil@npm:0.0.11007" + checksum: 08ff1904363969996e5b747781c317c45150a6ddee4868ae6aae6e515114ebb0b953a0abaecce1c2f7550544facc53beaf0081b8dfdfb5757ceece4e1c69e2e1 + languageName: node + linkType: hard + "@celo/explorer@npm:^5.0.10, @celo/explorer@workspace:packages/sdk/explorer": version: 0.0.0-use.local resolution: "@celo/explorer@workspace:packages/sdk/explorer" @@ -6602,6 +6611,18 @@ __metadata: languageName: node linkType: hard +"@viem/anvil@npm:^0.0.9": + version: 0.0.9 + resolution: "@viem/anvil@npm:0.0.9" + dependencies: + execa: "npm:^7.1.1" + get-port: "npm:^6.1.2" + http-proxy: "npm:^1.18.1" + ws: "npm:^8.13.0" + checksum: 69a93778456c2f540b8e86f9a6eb9ef04d6f9953ddca1341499b105b7da4eb7086272ef24a71c064338d20f7bfb9ac1c1d51e4a7e10707bc1acd421a714a6b60 + languageName: node + linkType: hard + "@wagmi/chains@npm:1.6.0": version: 1.6.0 resolution: "@wagmi/chains@npm:1.6.0" @@ -10311,7 +10332,7 @@ __metadata: languageName: node linkType: hard -"eventemitter3@npm:^4.0.4": +"eventemitter3@npm:^4.0.0, eventemitter3@npm:^4.0.4": version: 4.0.7 resolution: "eventemitter3@npm:4.0.7" checksum: 8030029382404942c01d0037079f1b1bc8fed524b5849c237b80549b01e2fc49709e1d0c557fa65ca4498fc9e24cff1475ef7b855121fcc15f9d61f93e282346 @@ -10386,6 +10407,23 @@ __metadata: languageName: node linkType: hard +"execa@npm:^7.1.1": + version: 7.2.0 + resolution: "execa@npm:7.2.0" + dependencies: + cross-spawn: "npm:^7.0.3" + get-stream: "npm:^6.0.1" + human-signals: "npm:^4.3.0" + is-stream: "npm:^3.0.0" + merge-stream: "npm:^2.0.0" + npm-run-path: "npm:^5.1.0" + onetime: "npm:^6.0.0" + signal-exit: "npm:^3.0.7" + strip-final-newline: "npm:^3.0.0" + checksum: 473feff60f9d4dbe799225948de48b5158c1723021d19c4b982afe37bcd111ae84e1b4c9dfe967fae5101b0894b1a62e4dd564a286dfa3e46d7b0cfdbf7fe62b + languageName: node + linkType: hard + "exit@npm:^0.1.2": version: 0.1.2 resolution: "exit@npm:0.1.2" @@ -10809,7 +10847,7 @@ __metadata: languageName: node linkType: hard -"follow-redirects@npm:^1.15.6": +"follow-redirects@npm:^1.0.0, follow-redirects@npm:^1.15.6": version: 1.15.6 resolution: "follow-redirects@npm:1.15.6" peerDependenciesMeta: @@ -11197,6 +11235,13 @@ __metadata: languageName: node linkType: hard +"get-port@npm:^6.1.2": + version: 6.1.2 + resolution: "get-port@npm:6.1.2" + checksum: e3c3d591492a11393455ef220f24c812a28f7da56ec3e4a2512d931a1f196d42850b50ac6138349a44622eda6dc3c0ccd8495cd91376d968e2d9e6f6f849e0a9 + languageName: node + linkType: hard + "get-stream@npm:^5.0.0, get-stream@npm:^5.1.0": version: 5.2.0 resolution: "get-stream@npm:5.2.0" @@ -11852,6 +11897,17 @@ __metadata: languageName: node linkType: hard +"http-proxy@npm:^1.18.1": + version: 1.18.1 + resolution: "http-proxy@npm:1.18.1" + dependencies: + eventemitter3: "npm:^4.0.0" + follow-redirects: "npm:^1.0.0" + requires-port: "npm:^1.0.0" + checksum: 2489e98aba70adbfd8b9d41ed1ff43528be4598c88616c558b109a09eaffe4bb35e551b6c75ac42ed7d948bb7530a22a2be6ef4f0cecacb5927be139f4274594 + languageName: node + linkType: hard + "http-signature@npm:~1.2.0": version: 1.2.0 resolution: "http-signature@npm:1.2.0" @@ -11917,6 +11973,13 @@ __metadata: languageName: node linkType: hard +"human-signals@npm:^4.3.0": + version: 4.3.1 + resolution: "human-signals@npm:4.3.1" + checksum: fa59894c358fe9f2b5549be2fb083661d5e1dff618d3ac70a49ca73495a72e873fbf6c0878561478e521e17d498292746ee391791db95ffe5747bfb5aef8765b + languageName: node + linkType: hard + "humanize-duration@npm:^3.29.0": version: 3.30.0 resolution: "humanize-duration@npm:3.30.0" @@ -12554,6 +12617,13 @@ __metadata: languageName: node linkType: hard +"is-stream@npm:^3.0.0": + version: 3.0.0 + resolution: "is-stream@npm:3.0.0" + checksum: 172093fe99119ffd07611ab6d1bcccfe8bc4aa80d864b15f43e63e54b7abc71e779acd69afdb854c4e2a67fdc16ae710e370eda40088d1cfc956a50ed82d8f16 + languageName: node + linkType: hard + "is-string@npm:^1.0.5, is-string@npm:^1.0.7": version: 1.0.7 resolution: "is-string@npm:1.0.7" @@ -14497,6 +14567,13 @@ __metadata: languageName: node linkType: hard +"mimic-fn@npm:^4.0.0": + version: 4.0.0 + resolution: "mimic-fn@npm:4.0.0" + checksum: 995dcece15ee29aa16e188de6633d43a3db4611bcf93620e7e62109ec41c79c0f34277165b8ce5e361205049766e371851264c21ac64ca35499acb5421c2ba56 + languageName: node + linkType: hard + "mimic-response@npm:^1.0.0": version: 1.0.1 resolution: "mimic-response@npm:1.0.1" @@ -15660,6 +15737,15 @@ __metadata: languageName: node linkType: hard +"npm-run-path@npm:^5.1.0": + version: 5.3.0 + resolution: "npm-run-path@npm:5.3.0" + dependencies: + path-key: "npm:^4.0.0" + checksum: ae8e7a89da9594fb9c308f6555c73f618152340dcaae423e5fb3620026fefbec463618a8b761920382d666fa7a2d8d240b6fe320e8a6cdd54dc3687e2b659d25 + languageName: node + linkType: hard + "npm-user-validate@npm:^2.0.0": version: 2.0.0 resolution: "npm-user-validate@npm:2.0.0" @@ -15971,6 +16057,15 @@ __metadata: languageName: node linkType: hard +"onetime@npm:^6.0.0": + version: 6.0.0 + resolution: "onetime@npm:6.0.0" + dependencies: + mimic-fn: "npm:^4.0.0" + checksum: 0846ce78e440841335d4e9182ef69d5762e9f38aa7499b19f42ea1c4cd40f0b4446094c455c713f9adac3f4ae86f613bb5e30c99e52652764d06a89f709b3788 + languageName: node + linkType: hard + "open@npm:^7.4.2": version: 7.4.2 resolution: "open@npm:7.4.2" @@ -16490,6 +16585,13 @@ __metadata: languageName: node linkType: hard +"path-key@npm:^4.0.0": + version: 4.0.0 + resolution: "path-key@npm:4.0.0" + checksum: 8e6c314ae6d16b83e93032c61020129f6f4484590a777eed709c4a01b50e498822b00f76ceaf94bc64dbd90b327df56ceadce27da3d83393790f1219e07721d7 + languageName: node + linkType: hard + "path-parse@npm:^1.0.7": version: 1.0.7 resolution: "path-parse@npm:1.0.7" @@ -17497,6 +17599,13 @@ __metadata: languageName: node linkType: hard +"requires-port@npm:^1.0.0": + version: 1.0.0 + resolution: "requires-port@npm:1.0.0" + checksum: 878880ee78ccdce372784f62f52a272048e2d0827c29ae31e7f99da18b62a2b9463ea03a75f277352f4697c100183debb0532371ad515a2d49d4bfe596dd4c20 + languageName: node + linkType: hard + "resolve-alpn@npm:^1.0.0, resolve-alpn@npm:^1.2.0": version: 1.2.1 resolution: "resolve-alpn@npm:1.2.1" @@ -18686,6 +18795,13 @@ __metadata: languageName: node linkType: hard +"strip-final-newline@npm:^3.0.0": + version: 3.0.0 + resolution: "strip-final-newline@npm:3.0.0" + checksum: 23ee263adfa2070cd0f23d1ac14e2ed2f000c9b44229aec9c799f1367ec001478469560abefd00c5c99ee6f0b31c137d53ec6029c53e9f32a93804e18c201050 + languageName: node + linkType: hard + "strip-hex-prefix@npm:1.0.0": version: 1.0.0 resolution: "strip-hex-prefix@npm:1.0.0" @@ -20883,6 +20999,21 @@ __metadata: languageName: node linkType: hard +"ws@npm:^8.13.0": + version: 8.16.0 + resolution: "ws@npm:8.16.0" + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: ">=5.0.2" + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + checksum: 7c511c59e979bd37b63c3aea4a8e4d4163204f00bd5633c053b05ed67835481995f61a523b0ad2b603566f9a89b34cb4965cb9fab9649fbfebd8f740cea57f17 + languageName: node + linkType: hard + "xhr-request-promise@npm:^0.1.2": version: 0.1.3 resolution: "xhr-request-promise@npm:0.1.3"