From 041fc926fb59f566462149adcc4401854075cc3f Mon Sep 17 00:00:00 2001 From: Aaron DeRuvo Date: Tue, 12 Dec 2023 13:34:41 +0200 Subject: [PATCH] CLI+ SDK PreRELEASE fixes (#10819) * do registry additions in sequence * do parsing of proposals additions in sequence * add changeset * enter beta mode * Version Packages (beta) (#10816) Co-authored-by: github-actions[bot] * Complete beta mode * add feedback about proposal transaction parsing * ensure we clean before building and that cli is packed properly * Version Packages (beta) (#10820) * do registry additions in sequence * do parsing of proposals additions in sequence * add changeset * enter beta mode * Version Packages (beta) (#10816) Co-authored-by: github-actions[bot] * Complete beta mode * add feedback about proposal transaction parsing * Version Packages (beta) --------- Co-authored-by: Aaron DeRuvo Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] * registry mapping updates are fine to do together * add a minor changeset just so beta gets bump * Version Packages (beta) (#10825) Co-authored-by: github-actions[bot] * should fix pushing tags issue * Revert "Remove granda mento + metatransaction wallet (#10822)" This reverts commit 9ab9d00ebbe6f61d61ddbf3769dd7bc6a7af91e8. * rollback * Version Packages (beta) (#10826) Co-authored-by: github-actions[bot] * remove beta only changeset * Complete beta mode --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] --- .changeset/cold-jobs-pay.md | 5 - .changeset/long-mangos-poke.md | 5 + .changeset/loud-tips-design.md | 6 + .changeset/popular-numbers-fly.md | 5 + .changeset/pre.json | 41 ++ .changeset/tiny-chairs-poke.md | 6 - package.json | 2 +- packages/celotool/CHANGELOG.md | 11 + packages/celotool/package.json | 10 +- packages/cli/CHANGELOG.md | 42 ++ packages/cli/package.json | 8 +- packages/cli/src/commands/governance/show.ts | 1 + .../src/commands/grandamento/cancel.test.ts | 54 +++ .../cli/src/commands/grandamento/cancel.ts | 38 ++ .../src/commands/grandamento/execute.test.ts | 91 ++++ .../cli/src/commands/grandamento/execute.ts | 40 ++ .../grandamento/get-buy-amount.test.ts | 32 ++ .../commands/grandamento/get-buy-amount.ts | 55 +++ .../cli/src/commands/grandamento/list.test.ts | 51 ++ packages/cli/src/commands/grandamento/list.ts | 31 ++ .../src/commands/grandamento/propose.test.ts | 116 +++++ .../cli/src/commands/grandamento/propose.ts | 68 +++ .../cli/src/commands/grandamento/show.test.ts | 48 ++ packages/cli/src/commands/grandamento/show.ts | 29 ++ packages/cli/src/test-utils/grandaMento.ts | 13 + packages/cli/src/utils/checks.ts | 39 ++ .../command-line-interface/grandamento.md | 129 +++++ .../wallet-hsm-gcp/reference/README.md | 151 ------ .../wallet-hsm-gcp/reference/SUMMARY.md | 9 - .../classes/_gcp_hsm_signer_.gcphsmsigner.md | 133 ------ .../classes/_gcp_hsm_wallet_.gcphsmwallet.md | 268 ----------- .../wallet-hsm-gcp/reference/globals.md | 8 - .../reference/modules/_gcp_hsm_signer_.md | 7 - .../reference/modules/_gcp_hsm_wallet_.md | 7 - packages/docs/sdk/docs/base/README.md | 1 + .../sdk/docs/base/classes/_future_.future.md | 2 +- .../base/classes/_result_.jsonparseerror.md | 6 +- .../docs/base/classes/_result_.rooterror.md | 12 +- .../enums/_attestations_.identifiertype.md | 17 + .../_attestations_.attestationsstatus.md | 48 ++ .../_collections_.addresslistitem.md | 2 +- .../_phonenumbers_.parsedphonenumber.md | 10 +- .../base/interfaces/_result_.baseerror.md | 2 +- .../base/interfaces/_result_.errorresult.md | 2 +- .../docs/base/interfaces/_result_.okresult.md | 2 +- .../interfaces/_signatureutils_.signature.md | 6 +- .../interfaces/_task_.retrytaskoptions.md | 2 +- .../interfaces/_task_.runningtaskwithvalue.md | 2 +- .../docs/sdk/docs/base/modules/_address_.md | 47 +- .../docs/sdk/docs/base/modules/_async_.md | 16 +- .../sdk/docs/base/modules/_attestations_.md | 212 +++++++++ .../sdk/docs/base/modules/_collections_.md | 16 +- .../docs/base/modules/_displayformatting_.md | 4 +- .../docs/sdk/docs/base/modules/_future_.md | 4 +- .../sdk/docs/base/modules/_phonenumbers_.md | 49 +- .../docs/sdk/docs/base/modules/_result_.md | 28 +- .../sdk/docs/base/modules/_signatureutils_.md | 12 +- .../docs/sdk/docs/base/modules/_string_.md | 8 +- packages/docs/sdk/docs/base/modules/_task_.md | 2 +- .../classes/_celo_provider_.celoprovider.md | 24 +- .../classes/_connection_.connection.md | 144 ++++-- ...ansaction_object_.celotransactionobject.md | 2 +- .../_utils_rpc_caller_.defaultrpccaller.md | 94 ++++ .../_utils_rpc_caller_.httprpccaller.md | 102 ---- ...x_params_normalizer_.txparamsnormalizer.md | 6 +- .../_connection_.connectionoptions.md | 15 +- .../connect/interfaces/_types_.celoparams.md | 6 +- .../interfaces/_types_.celotxobject.md | 14 +- .../interfaces/_types_.cip42txproperties.md | 184 -------- .../interfaces/_types_.cip64txproperties.md | 166 ------- .../interfaces/_types_.eip1559txproperties.md | 157 ------ .../interfaces/_types_.encodedtransaction.md | 36 +- .../docs/connect/interfaces/_types_.error.md | 39 -- .../interfaces/_types_.formattedcelotx.md | 147 ------ .../interfaces/_types_.httpprovider.md | 38 -- .../interfaces/_types_.jsonrpcpayload.md | 8 +- .../interfaces/_types_.jsonrpcresponse.md | 12 +- .../interfaces/_types_.legacytxproperties.md | 160 ------- .../connect/interfaces/_types_.provider.md | 16 +- .../interfaces/_types_.rlpencodedtx.md | 17 +- .../_utils_rpc_caller_.rpccaller.md | 16 +- .../docs/connect/modules/_celo_provider_.md | 2 +- .../sdk/docs/connect/modules/_connection_.md | 20 - .../docs/sdk/docs/connect/modules/_types_.md | 68 +-- .../docs/connect/modules/_utils_abi_utils_.md | 21 +- .../_utils_celo_transaction_object_.md | 2 +- .../docs/connect/modules/_utils_formatter_.md | 78 +-- .../connect/modules/_utils_provider_utils_.md | 6 +- .../connect/modules/_utils_rpc_caller_.md | 6 +- .../docs/connect/modules/_utils_tx_result_.md | 4 +- ...ionwallet_.metatransactionwalletwrapper.md | 446 ++++++++++++++++++ ...r_.metatransactionwalletdeployerwrapper.md | 160 +++++++ ...s_metatransactionwallet_.rawtransaction.md | 39 ++ ...ctionwallet_.transactionobjectwithvalue.md | 34 ++ .../_wrappers_metatransactionwallet_.md | 117 +++++ ...wrappers_metatransactionwalletdeployer_.md | 21 + .../_node_modules_bls12377js_src_f2_.f2.md | 225 +++++++++ .../_node_modules_bls12377js_src_f_.f.md | 242 ++++++++++ .../_node_modules_bls12377js_src_g1_.g1.md | 182 +++++++ .../_node_modules_bls12377js_src_g2_.g2.md | 182 +++++++ ...ode_modules_bls12377js_src_group_.group.md | 226 +++++++++ .../sdk/docs/cryptographic-utils/globals.md | 15 +- .../_commentencryption_.encryptionstatus.md | 30 -- ..._modules_bls12377js_src_defs_.fieldspec.md | 167 +++++++ ..._modules_bls12377js_src_defs_.groupspec.md | 146 ++++++ ...src_commentencryption_.encryptionstatus.md | 30 ++ .../cryptographic-utils/modules/_account_.md | 403 ---------------- .../docs/cryptographic-utils/modules/_bls_.md | 81 ---- .../modules/_commentencryption_.md | 131 ----- .../modules/_dataencryptionkey_.md | 103 ---- .../_node_modules_bls12377js_src_bls_.md | 320 +++++++++++++ .../_node_modules_bls12377js_src_defs_.md | 106 +++++ .../_node_modules_bls12377js_src_f2_.md | 9 + .../_node_modules_bls12377js_src_f_.md | 9 + .../_node_modules_bls12377js_src_g1_.md | 9 + .../_node_modules_bls12377js_src_g2_.md | 9 + .../_node_modules_bls12377js_src_group_.md | 9 + ...es_sdk_cryptographic_utils_src_account_.md | 403 ++++++++++++++++ ...ckages_sdk_cryptographic_utils_src_bls_.md | 81 ++++ ...ptographic_utils_src_commentencryption_.md | 131 +++++ ...ptographic_utils_src_dataencryptionkey_.md | 103 ++++ .../network-utils/modules/_utils_timezone_.md | 4 +- packages/docs/sdk/docs/phone-utils/globals.md | 1 + .../phone-utils/modules/_getphonehash_.md | 5 + .../phone-utils/modules/_phonenumbers_.md | 40 +- packages/docs/sdk/docs/utils/README.md | 2 + ..._sign_typed_data_utils_.eip712parameter.md | 4 +- ..._sign_typed_data_utils_.eip712typeddata.md | 8 +- ...yped_data_utils_.eip712typeswithprimary.md | 4 +- .../sdk/docs/utils/modules/_attestations_.md | 243 ++++++++++ packages/docs/sdk/docs/utils/modules/_bn_.md | 4 +- .../docs/sdk/docs/utils/modules/_ecdh_.md | 12 +- .../docs/sdk/docs/utils/modules/_ecies_.md | 16 +- packages/docs/sdk/docs/utils/modules/_io_.md | 24 + .../utils/modules/_sign_typed_data_utils_.md | 71 ++- .../docs/utils/modules/_signatureutils_.md | 106 +++-- .../modules/_typed_data_constructors_.md | 63 +-- .../classes/_wallet_base_.walletbase.md | 10 +- .../wallet-base/modules/_signing_utils_.md | 101 ++-- .../classes/_ledger_wallet_.ledgerwallet.md | 12 +- .../wallet-ledger/modules/_ledger_utils_.md | 4 +- .../classes/_remote_wallet_.remotewallet.md | 16 +- packages/env-tests/CHANGELOG.md | 7 + packages/env-tests/package.json | 4 +- packages/env-tests/src/monorepoRun.ts | 2 + packages/env-tests/src/tests/granda-mento.ts | 263 +++++++++++ packages/metadata-crawler/CHANGELOG.md | 7 + packages/metadata-crawler/package.json | 4 +- packages/sdk/contractkit/CHANGELOG.md | 24 + packages/sdk/contractkit/package.json | 2 +- packages/sdk/contractkit/src/base.ts | 10 +- .../sdk/contractkit/src/contract-cache.ts | 24 + packages/sdk/contractkit/src/kit.ts | 3 + packages/sdk/contractkit/src/proxy.ts | 6 + .../contractkit/src/test-utils/grandaMento.ts | 13 + .../src/test-utils/transferownership.ts | 67 +++ .../contractkit/src/web3-contract-cache.ts | 33 +- .../contractkit/src/wrappers/FeeHandler.ts | 11 + .../src/wrappers/GrandaMento.test.ts | 189 ++++++++ .../contractkit/src/wrappers/GrandaMento.ts | 233 +++++++++ .../wrappers/MetaTransactionWallet.test.ts | 266 +++++++++++ .../src/wrappers/MetaTransactionWallet.ts | 313 ++++++++++++ .../MetaTransactionWalletDeployer.test.ts | 91 ++++ .../wrappers/MetaTransactionWalletDeployer.ts | 14 + packages/sdk/explorer/CHANGELOG.md | 7 + packages/sdk/explorer/package.json | 4 +- packages/sdk/governance/CHANGELOG.md | 24 + packages/sdk/governance/package.json | 6 +- packages/sdk/governance/src/proposals.ts | 124 ++--- packages/sdk/transactions-uri/package.json | 2 +- packages/sdk/wallets/wallet-rpc/package.json | 2 +- scripts/hooks/pre-push.js | 8 +- yarn.lock | 20 + 173 files changed, 7290 insertions(+), 3093 deletions(-) delete mode 100644 .changeset/cold-jobs-pay.md create mode 100644 .changeset/long-mangos-poke.md create mode 100644 .changeset/loud-tips-design.md create mode 100644 .changeset/popular-numbers-fly.md create mode 100644 .changeset/pre.json delete mode 100644 .changeset/tiny-chairs-poke.md create mode 100644 packages/cli/src/commands/grandamento/cancel.test.ts create mode 100644 packages/cli/src/commands/grandamento/cancel.ts create mode 100644 packages/cli/src/commands/grandamento/execute.test.ts create mode 100644 packages/cli/src/commands/grandamento/execute.ts create mode 100644 packages/cli/src/commands/grandamento/get-buy-amount.test.ts create mode 100644 packages/cli/src/commands/grandamento/get-buy-amount.ts create mode 100644 packages/cli/src/commands/grandamento/list.test.ts create mode 100644 packages/cli/src/commands/grandamento/list.ts create mode 100644 packages/cli/src/commands/grandamento/propose.test.ts create mode 100644 packages/cli/src/commands/grandamento/propose.ts create mode 100644 packages/cli/src/commands/grandamento/show.test.ts create mode 100644 packages/cli/src/commands/grandamento/show.ts create mode 100644 packages/cli/src/test-utils/grandaMento.ts create mode 100644 packages/docs/command-line-interface/grandamento.md delete mode 100644 packages/docs/developer-resources/wallet-hsm-gcp/reference/README.md delete mode 100644 packages/docs/developer-resources/wallet-hsm-gcp/reference/SUMMARY.md delete mode 100644 packages/docs/developer-resources/wallet-hsm-gcp/reference/classes/_gcp_hsm_signer_.gcphsmsigner.md delete mode 100644 packages/docs/developer-resources/wallet-hsm-gcp/reference/classes/_gcp_hsm_wallet_.gcphsmwallet.md delete mode 100644 packages/docs/developer-resources/wallet-hsm-gcp/reference/globals.md delete mode 100644 packages/docs/developer-resources/wallet-hsm-gcp/reference/modules/_gcp_hsm_signer_.md delete mode 100644 packages/docs/developer-resources/wallet-hsm-gcp/reference/modules/_gcp_hsm_wallet_.md create mode 100644 packages/docs/sdk/docs/base/enums/_attestations_.identifiertype.md create mode 100644 packages/docs/sdk/docs/base/interfaces/_attestations_.attestationsstatus.md create mode 100644 packages/docs/sdk/docs/base/modules/_attestations_.md create mode 100644 packages/docs/sdk/docs/connect/classes/_utils_rpc_caller_.defaultrpccaller.md delete mode 100644 packages/docs/sdk/docs/connect/classes/_utils_rpc_caller_.httprpccaller.md delete mode 100644 packages/docs/sdk/docs/connect/interfaces/_types_.cip42txproperties.md delete mode 100644 packages/docs/sdk/docs/connect/interfaces/_types_.cip64txproperties.md delete mode 100644 packages/docs/sdk/docs/connect/interfaces/_types_.eip1559txproperties.md delete mode 100644 packages/docs/sdk/docs/connect/interfaces/_types_.error.md delete mode 100644 packages/docs/sdk/docs/connect/interfaces/_types_.formattedcelotx.md delete mode 100644 packages/docs/sdk/docs/connect/interfaces/_types_.httpprovider.md delete mode 100644 packages/docs/sdk/docs/connect/interfaces/_types_.legacytxproperties.md create mode 100644 packages/docs/sdk/docs/contractkit/classes/_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md create mode 100644 packages/docs/sdk/docs/contractkit/classes/_wrappers_metatransactionwalletdeployer_.metatransactionwalletdeployerwrapper.md create mode 100644 packages/docs/sdk/docs/contractkit/interfaces/_wrappers_metatransactionwallet_.rawtransaction.md create mode 100644 packages/docs/sdk/docs/contractkit/interfaces/_wrappers_metatransactionwallet_.transactionobjectwithvalue.md create mode 100644 packages/docs/sdk/docs/contractkit/modules/_wrappers_metatransactionwallet_.md create mode 100644 packages/docs/sdk/docs/contractkit/modules/_wrappers_metatransactionwalletdeployer_.md create mode 100644 packages/docs/sdk/docs/cryptographic-utils/classes/_node_modules_bls12377js_src_f2_.f2.md create mode 100644 packages/docs/sdk/docs/cryptographic-utils/classes/_node_modules_bls12377js_src_f_.f.md create mode 100644 packages/docs/sdk/docs/cryptographic-utils/classes/_node_modules_bls12377js_src_g1_.g1.md create mode 100644 packages/docs/sdk/docs/cryptographic-utils/classes/_node_modules_bls12377js_src_g2_.g2.md create mode 100644 packages/docs/sdk/docs/cryptographic-utils/classes/_node_modules_bls12377js_src_group_.group.md delete mode 100644 packages/docs/sdk/docs/cryptographic-utils/interfaces/_commentencryption_.encryptionstatus.md create mode 100644 packages/docs/sdk/docs/cryptographic-utils/interfaces/_node_modules_bls12377js_src_defs_.fieldspec.md create mode 100644 packages/docs/sdk/docs/cryptographic-utils/interfaces/_node_modules_bls12377js_src_defs_.groupspec.md create mode 100644 packages/docs/sdk/docs/cryptographic-utils/interfaces/_packages_sdk_cryptographic_utils_src_commentencryption_.encryptionstatus.md delete mode 100644 packages/docs/sdk/docs/cryptographic-utils/modules/_account_.md delete mode 100644 packages/docs/sdk/docs/cryptographic-utils/modules/_bls_.md delete mode 100644 packages/docs/sdk/docs/cryptographic-utils/modules/_commentencryption_.md delete mode 100644 packages/docs/sdk/docs/cryptographic-utils/modules/_dataencryptionkey_.md create mode 100644 packages/docs/sdk/docs/cryptographic-utils/modules/_node_modules_bls12377js_src_bls_.md create mode 100644 packages/docs/sdk/docs/cryptographic-utils/modules/_node_modules_bls12377js_src_defs_.md create mode 100644 packages/docs/sdk/docs/cryptographic-utils/modules/_node_modules_bls12377js_src_f2_.md create mode 100644 packages/docs/sdk/docs/cryptographic-utils/modules/_node_modules_bls12377js_src_f_.md create mode 100644 packages/docs/sdk/docs/cryptographic-utils/modules/_node_modules_bls12377js_src_g1_.md create mode 100644 packages/docs/sdk/docs/cryptographic-utils/modules/_node_modules_bls12377js_src_g2_.md create mode 100644 packages/docs/sdk/docs/cryptographic-utils/modules/_node_modules_bls12377js_src_group_.md create mode 100644 packages/docs/sdk/docs/cryptographic-utils/modules/_packages_sdk_cryptographic_utils_src_account_.md create mode 100644 packages/docs/sdk/docs/cryptographic-utils/modules/_packages_sdk_cryptographic_utils_src_bls_.md create mode 100644 packages/docs/sdk/docs/cryptographic-utils/modules/_packages_sdk_cryptographic_utils_src_commentencryption_.md create mode 100644 packages/docs/sdk/docs/cryptographic-utils/modules/_packages_sdk_cryptographic_utils_src_dataencryptionkey_.md create mode 100644 packages/docs/sdk/docs/phone-utils/modules/_getphonehash_.md create mode 100644 packages/docs/sdk/docs/utils/modules/_attestations_.md create mode 100644 packages/env-tests/src/tests/granda-mento.ts create mode 100644 packages/sdk/contractkit/src/test-utils/grandaMento.ts create mode 100644 packages/sdk/contractkit/src/test-utils/transferownership.ts create mode 100644 packages/sdk/contractkit/src/wrappers/GrandaMento.test.ts create mode 100644 packages/sdk/contractkit/src/wrappers/GrandaMento.ts create mode 100644 packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.test.ts create mode 100644 packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts create mode 100644 packages/sdk/contractkit/src/wrappers/MetaTransactionWalletDeployer.test.ts create mode 100644 packages/sdk/contractkit/src/wrappers/MetaTransactionWalletDeployer.ts diff --git a/.changeset/cold-jobs-pay.md b/.changeset/cold-jobs-pay.md deleted file mode 100644 index bf7a873a6d6..00000000000 --- a/.changeset/cold-jobs-pay.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@celo/contractkit': major ---- - -Remove Support for deprecated MetaTransactionWallet and MetaTransactionWalletDeployer. IF absolutely needed the contracts can be accessed directly or an alternative such as account abstraction should be used diff --git a/.changeset/long-mangos-poke.md b/.changeset/long-mangos-poke.md new file mode 100644 index 00000000000..b785395392e --- /dev/null +++ b/.changeset/long-mangos-poke.md @@ -0,0 +1,5 @@ +--- +'@celo/governance': patch +--- + +Turn back on parallel registry updating for governance proposal views diff --git a/.changeset/loud-tips-design.md b/.changeset/loud-tips-design.md new file mode 100644 index 00000000000..2abf9caa3bc --- /dev/null +++ b/.changeset/loud-tips-design.md @@ -0,0 +1,6 @@ +--- +'@celo/governance': patch +'@celo/celocli': patch +--- + +Add textual feedback about parsing proposal diff --git a/.changeset/popular-numbers-fly.md b/.changeset/popular-numbers-fly.md new file mode 100644 index 00000000000..a2e72beaff9 --- /dev/null +++ b/.changeset/popular-numbers-fly.md @@ -0,0 +1,5 @@ +--- +'@celo/governance': patch +--- + +Fix Proposal View Regression when it includes proxy updates diff --git a/.changeset/pre.json b/.changeset/pre.json new file mode 100644 index 00000000000..9662e5187a6 --- /dev/null +++ b/.changeset/pre.json @@ -0,0 +1,41 @@ +{ + "mode": "exit", + "tag": "beta", + "initialVersions": { + "@celo/celotool": "2.0.0", + "@celo/celocli": "3.1.1", + "@celo/dev-utils": "0.0.1", + "@celo/env-tests": "1.0.2", + "@celo/metadata-crawler": "0.0.3", + "@celo/protocol": "1.0.2", + "@celo/base": "6.0.0", + "@celo/connect": "5.1.1", + "@celo/contractkit": "5.2.1", + "@celo/cryptographic-utils": "5.0.6", + "@celo/explorer": "5.0.6", + "@celo/governance": "5.0.6", + "@celo/keystores": "5.0.6", + "@celo/network-utils": "5.0.5", + "@celo/phone-utils": "6.0.0", + "@celo/transactions-uri": "5.0.6", + "@celo/utils": "5.0.6", + "@celo/wallet-base": "5.1.1", + "@celo/wallet-hsm": "5.1.1", + "@celo/wallet-hsm-aws": "5.1.1", + "@celo/wallet-hsm-azure": "5.1.1", + "@celo/wallet-hsm-gcp": "5.1.1", + "@celo/wallet-ledger": "5.1.1", + "@celo/wallet-local": "5.1.1", + "@celo/wallet-remote": "5.1.1", + "@celo/wallet-rpc": "5.1.1", + "@celo/typescript": "0.0.1" + }, + "changesets": [ + "cool-waves-switch", + "few-cycles-doubt", + "light-buses-love", + "long-mangos-poke", + "loud-tips-design", + "popular-numbers-fly" + ] +} diff --git a/.changeset/tiny-chairs-poke.md b/.changeset/tiny-chairs-poke.md deleted file mode 100644 index 1d91d499816..00000000000 --- a/.changeset/tiny-chairs-poke.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@celo/contractkit': major -'@celo/celocli': major ---- - -Removes Grandamento from cli and contractkit completely as it has become no op by mento team diff --git a/package.json b/package.json index 55fb70231f5..8d661be539c 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "keys:decrypt": "bash scripts/key_placer.sh decrypt", "keys:encrypt": "bash scripts/key_placer.sh encrypt", "check:packages": "node ./scripts/check-packages.js", - "release": "yarn build && yarn cs publish", + "release": "yarn clean && yarn build && yarn --cwd packages/cli run prepack && yarn cs publish", "beta-enter": "bash scripts/beta-mode.sh", "beta-exit": "yarn changeset pre exit && git commit -am 'Complete beta mode'", "version-and-reinstall": "yarn changeset version && yarn install", diff --git a/packages/celotool/CHANGELOG.md b/packages/celotool/CHANGELOG.md index a404ce1ec74..ae68bc89ada 100644 --- a/packages/celotool/CHANGELOG.md +++ b/packages/celotool/CHANGELOG.md @@ -1,5 +1,16 @@ # @celo/celotool +## 2.0.1-beta.0 + +### Patch Changes + +- Updated dependencies [1c9c844cf] +- Updated dependencies [86bbfddf1] + - @celo/contractkit@6.0.0-beta.0 + - @celo/governance@5.0.7-beta.0 + - @celo/env-tests@1.0.3-beta.0 + - @celo/explorer@5.0.7-beta.0 + ## 2.0.0 ### Major Changes diff --git a/packages/celotool/package.json b/packages/celotool/package.json index bbfe11a5288..c0354c14ab9 100644 --- a/packages/celotool/package.json +++ b/packages/celotool/package.json @@ -1,6 +1,6 @@ { "name": "@celo/celotool", - "version": "2.0.0", + "version": "2.0.1-beta.0", "description": "Celotool is our hub for all scripts that people need to run within the monorepo", "main": "index.js", "author": "Celo", @@ -9,10 +9,10 @@ "@celo/base": "^6.0.0", "@celo/connect": "^5.1.1", "@celo/cryptographic-utils": "^5.0.6", - "@celo/contractkit": "^5.2.0", - "@celo/env-tests": "1.0.2", - "@celo/explorer": "^5.0.6", - "@celo/governance": "^5.0.6", + "@celo/contractkit": "^6.0.0-beta.0", + "@celo/env-tests": "1.0.3-beta.0", + "@celo/explorer": "^5.0.7-beta.0", + "@celo/governance": "^5.0.7-beta.0", "@celo/network-utils": "^5.0.5", "@celo/utils": "^5.0.6", "@ethereumjs/util": "8.0.5", diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index 0e950bedcaa..e7b27d4e3c1 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -1,5 +1,47 @@ # Changelog +## 3.1.2-beta.2 + +### Patch Changes + +- ba27783ae: Revert removal of Contracts +- Updated dependencies [ba27783ae] + - @celo/contractkit@6.0.0-beta.2 + +## 4.0.0-beta.2 + +### Major Changes + +- 9ab9d00eb: Removes Grandamento from cli and contractkit completely as it has become no op by mento team + +### Patch Changes + +- Updated dependencies [9ab9d00eb] +- Updated dependencies [444db6de9] +- Updated dependencies [9ab9d00eb] + - @celo/contractkit@6.0.0-beta.1 + - @celo/governance@5.0.7-beta.2 + +## 3.1.2-beta.1 + +### Patch Changes + +- e4da5a7a8: Add textual feedback about parsing proposal +- Updated dependencies [e4da5a7a8] + - @celo/governance@5.0.7-beta.1 + +## 3.1.2-beta.0 + +### Patch Changes + +- bb3cf9f2e: update terminology: refer to celo not gold. +- bb3cf9f2e: Alias releasecelo to releasegold +- Updated dependencies [1c9c844cf] +- Updated dependencies [86bbfddf1] + - @celo/contractkit@6.0.0-beta.0 + - @celo/governance@5.0.7-beta.0 + - @celo/explorer@5.0.7-beta.0 + ## 3.1.1 ### Patch Changes diff --git a/packages/cli/package.json b/packages/cli/package.json index 4880121bf34..8db943d7208 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,7 +1,7 @@ { "name": "@celo/celocli", "description": "CLI Tool for transacting with the Celo protocol", - "version": "3.1.1", + "version": "3.1.2-beta.2", "author": "Celo", "license": "Apache-2.0", "repository": "celo-org/celo-monorepo", @@ -33,9 +33,9 @@ "@celo/abis": "10.0.0", "@celo/base": "^6.0.0", "@celo/connect": "^5.1.1", - "@celo/contractkit": "^5.2.1", - "@celo/explorer": "^5.0.6", - "@celo/governance": "^5.0.6", + "@celo/contractkit": "^6.0.0-beta.2", + "@celo/explorer": "^5.0.7-beta.0", + "@celo/governance": "^5.0.7-beta.2", "@celo/identity": "^5.1.1", "@celo/phone-utils": "^6.0.0", "@celo/utils": "^5.0.6", diff --git a/packages/cli/src/commands/governance/show.ts b/packages/cli/src/commands/governance/show.ts index f5de87da128..df4ba66a773 100644 --- a/packages/cli/src/commands/governance/show.ts +++ b/packages/cli/src/commands/governance/show.ts @@ -97,6 +97,7 @@ export default class Show extends BaseCommand { await addExistingProposalJSONFileToBuilder(builder, res.flags.afterExecutingProposal) } try { + console.log(chalk.cyanBright(`Parsing ${proposal.length} proposal transactions...`)) const jsonproposal = await proposalToJSON(this.kit, proposal, builder.registryAdditions) record.proposal = jsonproposal as any diff --git a/packages/cli/src/commands/grandamento/cancel.test.ts b/packages/cli/src/commands/grandamento/cancel.test.ts new file mode 100644 index 00000000000..3d5b9cb2175 --- /dev/null +++ b/packages/cli/src/commands/grandamento/cancel.test.ts @@ -0,0 +1,54 @@ +import { Address } from '@celo/base/lib/address' +import { newKitFromWeb3 } from '@celo/contractkit' +import { assumeOwnership } from '@celo/contractkit/lib/test-utils/transferownership' +import { GrandaMentoWrapper } from '@celo/contractkit/lib/wrappers/GrandaMento' +import { testWithGanache } from '@celo/dev-utils/lib/ganache-test' +import BigNumber from 'bignumber.js' +import Web3 from 'web3' +import { testLocally } from '../../test-utils/cliUtils' +import Cancel from './cancel' +import Propose from './propose' + +testWithGanache('grandamento:cancel cmd', (web3: Web3) => { + const kit = newKitFromWeb3(web3) + let grandaMento: GrandaMentoWrapper + const newLimitMin = new BigNumber('1000') + const newLimitMax = new BigNumber('1000000000000') + let accounts: Address[] = [] + + const increaseLimits = async () => { + await grandaMento + .setStableTokenExchangeLimits('StableToken', newLimitMin.toString(), newLimitMax.toString()) + .sendAndWaitForReceipt() + } + + beforeAll(async () => { + accounts = await web3.eth.getAccounts() + kit.defaultAccount = accounts[0] + grandaMento = await kit.contracts.getGrandaMento() + }) + + beforeEach(async () => { + await assumeOwnership(web3, accounts[0]) + await increaseLimits() + // create mock proposal + await testLocally(Propose, [ + '--from', + accounts[0], + '--sellCelo', + 'true', + '--stableToken', + 'cUSD', + '--value', + '10000', + ]) + }) + + describe('cancel', () => { + it('left no proposal', async () => { + await testLocally(Cancel, ['--from', accounts[0], '--proposalID', '1']) + const activeProposals = await grandaMento.getActiveProposalIds() + expect(activeProposals).toEqual([]) + }) + }) +}) diff --git a/packages/cli/src/commands/grandamento/cancel.ts b/packages/cli/src/commands/grandamento/cancel.ts new file mode 100644 index 00000000000..d7292baca8c --- /dev/null +++ b/packages/cli/src/commands/grandamento/cancel.ts @@ -0,0 +1,38 @@ +import { flags } from '@oclif/command' +import { BaseCommand } from '../../base' +import { newCheckBuilder } from '../../utils/checks' +import { displaySendTx } from '../../utils/cli' +import { Flags } from '../../utils/command' + +export default class Cancel extends BaseCommand { + static description = 'Cancels a Granda Mento exchange proposal' + + static flags = { + ...BaseCommand.flags, + from: Flags.address({ + required: true, + description: 'The address allowed to cancel the proposal', + }), + proposalID: flags.string({ + required: true, + exclusive: ['account', 'hotfix'], + description: 'UUID of proposal to view', + }), + } + + async run() { + const grandaMento = await this.kit.contracts.getGrandaMento() + + const res = this.parse(Cancel) + const proposalID = res.flags.proposalID + + await newCheckBuilder(this).grandaMentoProposalExists(proposalID).runChecks() + + await displaySendTx( + 'cancelExchangeProposal', + grandaMento.cancelExchangeProposal(proposalID), + undefined, + 'ExchangeProposalCancelled' + ) + } +} diff --git a/packages/cli/src/commands/grandamento/execute.test.ts b/packages/cli/src/commands/grandamento/execute.test.ts new file mode 100644 index 00000000000..184237a7ce8 --- /dev/null +++ b/packages/cli/src/commands/grandamento/execute.test.ts @@ -0,0 +1,91 @@ +import { Address } from '@celo/base/lib/address' +import { newKitFromWeb3 } from '@celo/contractkit' +import { assumeOwnership } from '@celo/contractkit/lib/test-utils/transferownership' +import { GrandaMentoWrapper } from '@celo/contractkit/lib/wrappers/GrandaMento' +import { testWithGanache, timeTravel } from '@celo/dev-utils/lib/ganache-test' +import BigNumber from 'bignumber.js' +import Web3 from 'web3' +import { testLocally } from '../../test-utils/cliUtils' +import Execute from './execute' +import Propose from './propose' + +testWithGanache('grandamento:execute cmd', (web3: Web3) => { + const kit = newKitFromWeb3(web3) + let grandaMento: GrandaMentoWrapper + const newLimitMin = new BigNumber('1000') + const newLimitMax = new BigNumber('1000000000000') + let accounts: Address[] = [] + const dateNowOriginal = Date.now + let originalNoSyncCheck: string | undefined + + const increaseLimits = () => { + return grandaMento + .setStableTokenExchangeLimits('StableToken', newLimitMin.toString(), newLimitMax.toString()) + .sendAndWaitForReceipt() + } + + const createExchangeProposal = () => { + // create mock proposal + return testLocally(Propose, [ + '--from', + accounts[0], + '--sellCelo', + 'true', + '--stableToken', + 'cUSD', + '--value', + '10000', + ]) + } + + const approveExchangeProposal = async (proposalID: number | string) => { + await grandaMento.setApprover(accounts[0]).sendAndWaitForReceipt() + await grandaMento.approveExchangeProposal(proposalID).sendAndWaitForReceipt() + } + + const timeTravelDateAndChain = async (seconds: number) => { + await timeTravel(seconds, web3) + jest.useFakeTimers().setSystemTime(dateNowOriginal() + seconds * 1000) + // Otherwise contractkit complains there is a difference between Date.now() + // and the timestamp of the last block + process.env.NO_SYNCCHECK = 'true' + } + + beforeAll(async () => { + accounts = await web3.eth.getAccounts() + kit.defaultAccount = accounts[0] + grandaMento = await kit.contracts.getGrandaMento() + originalNoSyncCheck = process.env.NO_SYNCCHECK + }) + + afterEach(() => { + process.env.NO_SYNCCHECK = originalNoSyncCheck + }) + + beforeEach(async () => { + await assumeOwnership(web3, accounts[0]) + await increaseLimits() + await createExchangeProposal() + // Approve it + await approveExchangeProposal(1) + // Wait the veto period plus some extra time to be safe + await timeTravelDateAndChain((await grandaMento.vetoPeriodSeconds()).toNumber() + 1000) + }) + + describe('execute', () => { + it('executes the proposal', async () => { + await testLocally(Execute, ['--from', accounts[0], '--proposalID', '1']) + const activeProposals = await grandaMento.getActiveProposalIds() + expect(activeProposals).toEqual([]) + }) + + it('fails if the exchange proposal is not executable', async () => { + // Create a proposal with proposalID 2, but don't wait the veto period + await createExchangeProposal() + await approveExchangeProposal(2) + await expect( + testLocally(Execute, ['--from', accounts[0], '--proposalID', '2']) + ).rejects.toThrow() + }) + }) +}) diff --git a/packages/cli/src/commands/grandamento/execute.ts b/packages/cli/src/commands/grandamento/execute.ts new file mode 100644 index 00000000000..b719fc6e1a5 --- /dev/null +++ b/packages/cli/src/commands/grandamento/execute.ts @@ -0,0 +1,40 @@ +import { flags } from '@oclif/command' +import { BaseCommand } from '../../base' +import { newCheckBuilder } from '../../utils/checks' +import { displaySendTx } from '../../utils/cli' +import { Flags } from '../../utils/command' + +export default class Execute extends BaseCommand { + static description = 'Executes a Granda Mento exchange proposal' + + static flags = { + ...BaseCommand.flags, + from: Flags.address({ + required: true, + description: 'The address to execute the exchange proposal', + }), + proposalID: flags.string({ + required: true, + description: 'UUID of proposal to view', + }), + } + + async run() { + const grandaMento = await this.kit.contracts.getGrandaMento() + + const res = this.parse(Execute) + const proposalID = res.flags.proposalID + + await newCheckBuilder(this) + .grandaMentoProposalExists(proposalID) + .grandaMentoProposalIsExecutable(proposalID) + .runChecks() + + await displaySendTx( + 'executeExchangeProposal', + grandaMento.executeExchangeProposal(proposalID), + undefined, + 'ExchangeProposalExecuted' + ) + } +} diff --git a/packages/cli/src/commands/grandamento/get-buy-amount.test.ts b/packages/cli/src/commands/grandamento/get-buy-amount.test.ts new file mode 100644 index 00000000000..d115d24df00 --- /dev/null +++ b/packages/cli/src/commands/grandamento/get-buy-amount.test.ts @@ -0,0 +1,32 @@ +import { Address } from '@celo/base/lib/address' +import { newKitFromWeb3 } from '@celo/contractkit' +import { assumeOwnership } from '@celo/contractkit/lib/test-utils/transferownership' +import { testWithGanache } from '@celo/dev-utils/lib/ganache-test' +import Web3 from 'web3' +import { testLocally } from '../../test-utils/cliUtils' +import GetBuyAmount from './get-buy-amount' + +testWithGanache('grandamento:get-buy-amount cmd', (web3: Web3) => { + const kit = newKitFromWeb3(web3) + let accounts: Address[] = [] + + beforeAll(async () => { + accounts = await web3.eth.getAccounts() + kit.defaultAccount = accounts[0] + }) + + beforeEach(async () => { + await assumeOwnership(web3, accounts[0]) + }) + + it('gets the buy amount', async () => { + await testLocally(GetBuyAmount, [ + '--sellCelo', + 'true', + '--stableToken', + 'cusd', + '--value', + '100000000000000000000000', + ]) + }) +}) diff --git a/packages/cli/src/commands/grandamento/get-buy-amount.ts b/packages/cli/src/commands/grandamento/get-buy-amount.ts new file mode 100644 index 00000000000..3bdcbff0870 --- /dev/null +++ b/packages/cli/src/commands/grandamento/get-buy-amount.ts @@ -0,0 +1,55 @@ +import { StableToken } from '@celo/contractkit' +import { toFixed } from '@celo/utils/lib/fixidity' +import { flags } from '@oclif/command' +import { BaseCommand } from '../../base' +import { printValueMap } from '../../utils/cli' +import { Flags } from '../../utils/command' +import { enumEntriesDupWithLowercase } from '../../utils/helpers' + +const stableTokenOptions = enumEntriesDupWithLowercase(Object.entries(StableToken)) + +export default class GetBuyAmount extends BaseCommand { + static description = 'Gets the buy amount for a prospective Granda Mento exchange' + + static flags = { + ...BaseCommand.flags, + value: Flags.wei({ + required: true, + description: 'The value of the tokens to exchange', + }), + stableToken: flags.enum({ + required: true, + options: Object.keys(stableTokenOptions), + description: 'Name of the stable to receive or send', + default: 'cUSD', + }), + sellCelo: flags.enum({ + options: ['true', 'false'], + required: true, + description: 'Sell or buy CELO', + }), + } + + async run() { + const grandaMento = await this.kit.contracts.getGrandaMento() + + const res = this.parse(GetBuyAmount) + const sellAmount = res.flags.value + const stableToken = stableTokenOptions[res.flags.stableToken] + const sellCelo = res.flags.sellCelo === 'true' + + const stableTokenAddress = await this.kit.celoTokens.getAddress(stableToken) + const sortedOracles = await this.kit.contracts.getSortedOracles() + const celoStableTokenOracleRate = (await sortedOracles.medianRate(stableTokenAddress)).rate + + const buyAmount = await grandaMento.getBuyAmount( + toFixed(celoStableTokenOracleRate), + sellAmount, + sellCelo + ) + + printValueMap({ + buyAmount, + }) + } +} diff --git a/packages/cli/src/commands/grandamento/list.test.ts b/packages/cli/src/commands/grandamento/list.test.ts new file mode 100644 index 00000000000..6a6bc9ad2c1 --- /dev/null +++ b/packages/cli/src/commands/grandamento/list.test.ts @@ -0,0 +1,51 @@ +import { Address } from '@celo/base/lib/address' +import { newKitFromWeb3 } from '@celo/contractkit' +import { StableToken } from '@celo/contractkit/lib/celo-tokens' +import { assumeOwnership } from '@celo/contractkit/lib/test-utils/transferownership' +import { GoldTokenWrapper } from '@celo/contractkit/lib/wrappers/GoldTokenWrapper' +import { GrandaMentoWrapper } from '@celo/contractkit/lib/wrappers/GrandaMento' +import { testWithGanache } from '@celo/dev-utils/lib/ganache-test' +import BigNumber from 'bignumber.js' +import Web3 from 'web3' +import { testLocally } from '../../test-utils/cliUtils' +import { setGrandaMentoLimits } from '../../test-utils/grandaMento' +import List from './list' + +testWithGanache('grandamento:list cmd', (web3: Web3) => { + const kit = newKitFromWeb3(web3) + let grandaMento: GrandaMentoWrapper + let accounts: Address[] = [] + let celoToken: GoldTokenWrapper + + beforeAll(async () => { + accounts = await web3.eth.getAccounts() + kit.defaultAccount = accounts[0] + grandaMento = await kit.contracts.getGrandaMento() + + celoToken = await kit.contracts.getGoldToken() + }) + + beforeEach(async () => { + await assumeOwnership(web3, accounts[0]) + await setGrandaMentoLimits(grandaMento) + }) + + it('shows an empty list of proposals', async () => { + await testLocally(List, []) + }) + + it('shows proposals', async () => { + // create mock proposal + const sellAmount = new BigNumber('100000000') + await celoToken.increaseAllowance(grandaMento.address, sellAmount).sendAndWaitForReceipt() + await ( + await grandaMento.createExchangeProposal( + kit.celoTokens.getContract(StableToken.cUSD), + sellAmount, + true + ) + ).sendAndWaitForReceipt() + + await testLocally(List, []) + }) +}) diff --git a/packages/cli/src/commands/grandamento/list.ts b/packages/cli/src/commands/grandamento/list.ts new file mode 100644 index 00000000000..bf81dafcdd5 --- /dev/null +++ b/packages/cli/src/commands/grandamento/list.ts @@ -0,0 +1,31 @@ +import { BaseCommand } from '../../base' +import { printValueMap } from '../../utils/cli' + +export default class List extends BaseCommand { + static description = 'List current active Granda Mento exchange proposals' + + static flags = { + ...BaseCommand.flags, + } + + async run() { + const grandaMento = await this.kit.contracts.getGrandaMento() + const proposals = await grandaMento.getActiveProposalIds() + + if (!proposals.length) { + console.log('No active Granda Mento proposals') + return + } + + console.log('Active proposals:') + + const proposalsDetails = proposals.map((id) => grandaMento.getHumanReadableExchangeProposal(id)) + + const res = await Promise.all(proposalsDetails) + + res.map((proposalJSON) => { + console.log('Proposal ID: ' + proposalJSON.id) + printValueMap(proposalJSON) + }) + } +} diff --git a/packages/cli/src/commands/grandamento/propose.test.ts b/packages/cli/src/commands/grandamento/propose.test.ts new file mode 100644 index 00000000000..4654cde0140 --- /dev/null +++ b/packages/cli/src/commands/grandamento/propose.test.ts @@ -0,0 +1,116 @@ +import { Address } from '@celo/base/lib/address' +import { newKitFromWeb3 } from '@celo/contractkit' +import { assumeOwnership } from '@celo/contractkit/lib/test-utils/transferownership' +import { + ExchangeProposalState, + GrandaMentoWrapper, +} from '@celo/contractkit/lib/wrappers/GrandaMento' +import { testWithGanache } from '@celo/dev-utils/lib/ganache-test' +import BigNumber from 'bignumber.js' +import Web3 from 'web3' +import { testLocally } from '../../test-utils/cliUtils' +import { setGrandaMentoLimits } from '../../test-utils/grandaMento' +import Propose from './propose' + +testWithGanache('grandamento:propose cmd', (web3: Web3) => { + const kit = newKitFromWeb3(web3) + let grandaMento: GrandaMentoWrapper + let accounts: Address[] = [] + + beforeAll(async () => { + accounts = await web3.eth.getAccounts() + kit.defaultAccount = accounts[0] + grandaMento = await kit.contracts.getGrandaMento() + }) + + beforeEach(async () => { + await assumeOwnership(web3, accounts[0]) + await setGrandaMentoLimits(grandaMento) + }) + + describe('proposes', () => { + it('can sell Celo', async () => { + await testLocally(Propose, [ + '--from', + accounts[0], + '--sellCelo', + 'true', + '--stableToken', + 'cUSD', + '--value', + '10000', + ]) + + const activeProposals = await grandaMento.getActiveProposalIds() + + expect(activeProposals).not.toEqual([]) + + const proposal = await grandaMento.getExchangeProposal(activeProposals[0]) + expect(proposal.exchanger).toEqual(accounts[0]) + expect(proposal.stableToken).toEqual((await kit.contracts.getStableToken()).address) + expect(proposal.sellAmount).toEqBigNumber(10000) + expect(proposal.approvalTimestamp).toEqual(new BigNumber(0)) + expect(proposal.state).toEqual(ExchangeProposalState.Proposed) + expect(proposal.sellCelo).toEqual(true) + }) + + it('can buy Celo', async () => { + await testLocally(Propose, [ + '--from', + accounts[0], + '--sellCelo', + 'false', + '--stableToken', + 'cUSD', + '--value', + '10000', + ]) + const activeProposals = await grandaMento.getActiveProposalIds() + + expect(activeProposals).not.toEqual([]) + + const proposal = await grandaMento.getExchangeProposal(activeProposals[0]) + expect(proposal.exchanger).toEqual(accounts[0]) + expect(proposal.stableToken).toEqual((await kit.contracts.getStableToken()).address) + expect(proposal.sellAmount).toEqBigNumber(10000) + expect(proposal.approvalTimestamp).toEqual(new BigNumber(0)) + expect(proposal.state).toEqual(ExchangeProposalState.Proposed) + expect(proposal.sellCelo).toEqual(false) + }) + + it("doesn't work without explicitly setting the sellCelo flag", async () => { + let activeProposals + + await expect( + testLocally(Propose, [ + '--from', + accounts[0], + '--sellCelo', + '--stableToken', + 'cUSD', + '--value', + '10000', + ]) + ).rejects.toThrow() + + activeProposals = await grandaMento.getActiveProposalIds() + expect(activeProposals).toEqual([]) + + await expect( + testLocally(Propose, [ + '--from', + accounts[0], + '--sellCelo', + 'tru', // typo on propose + '--stableToken', + 'cUSD', + '--value', + '10000', + ]) + ).rejects.toThrow() + + activeProposals = await grandaMento.getActiveProposalIds() + expect(activeProposals).toEqual([]) + }) + }) +}) diff --git a/packages/cli/src/commands/grandamento/propose.ts b/packages/cli/src/commands/grandamento/propose.ts new file mode 100644 index 00000000000..eff5e013187 --- /dev/null +++ b/packages/cli/src/commands/grandamento/propose.ts @@ -0,0 +1,68 @@ +import { StableToken } from '@celo/contractkit' +import { flags } from '@oclif/command' +import { BaseCommand } from '../../base' +import { newCheckBuilder } from '../../utils/checks' +import { displaySendTx } from '../../utils/cli' +import { Flags } from '../../utils/command' +import { enumEntriesDupWithLowercase } from '../../utils/helpers' + +const stableTokenOptions = enumEntriesDupWithLowercase(Object.entries(StableToken)) + +export default class Propose extends BaseCommand { + static description = 'Proposes a Granda Mento exchange' + + static flags = { + ...BaseCommand.flags, + from: Flags.address({ required: true, description: 'The address with tokens to exchange' }), + value: Flags.wei({ + required: true, + description: 'The value of the tokens to exchange', + }), + stableToken: flags.enum({ + required: true, + options: Object.keys(stableTokenOptions), + description: 'Name of the stable to receive or send', + default: 'cUSD', + }), + sellCelo: flags.enum({ + options: ['true', 'false'], + required: true, + description: 'Sell or buy CELO', + }), + } + + async run() { + const celoToken = await this.kit.contracts.getGoldToken() + const grandaMento = await this.kit.contracts.getGrandaMento() + + const res = this.parse(Propose) + const signer = res.flags.from + const sellAmount = res.flags.value + const stableToken = stableTokenOptions[res.flags.stableToken] + const sellCelo = res.flags.sellCelo === 'true' + + this.kit.defaultAccount = signer + + const tokenToSell = sellCelo ? celoToken : await this.kit.contracts.getStableToken(stableToken) + + await newCheckBuilder(this, signer) + .hasEnoughErc20(signer, sellAmount, tokenToSell.address) + .runChecks() + + await displaySendTx( + 'increaseAllowance', + tokenToSell.increaseAllowance(grandaMento.address, sellAmount.toFixed()) + ) + + await displaySendTx( + 'createExchangeProposal', + await grandaMento.createExchangeProposal( + this.kit.celoTokens.getContract(stableToken), + sellAmount, + sellCelo + ), + undefined, + 'ExchangeProposalCreated' + ) + } +} diff --git a/packages/cli/src/commands/grandamento/show.test.ts b/packages/cli/src/commands/grandamento/show.test.ts new file mode 100644 index 00000000000..044c82b0fcd --- /dev/null +++ b/packages/cli/src/commands/grandamento/show.test.ts @@ -0,0 +1,48 @@ +import { Address } from '@celo/base/lib/address' +import { newKitFromWeb3 } from '@celo/contractkit' +import { StableToken } from '@celo/contractkit/lib/celo-tokens' +import { assumeOwnership } from '@celo/contractkit/lib/test-utils/transferownership' +import { GoldTokenWrapper } from '@celo/contractkit/lib/wrappers/GoldTokenWrapper' +import { GrandaMentoWrapper } from '@celo/contractkit/lib/wrappers/GrandaMento' +import { testWithGanache } from '@celo/dev-utils/lib/ganache-test' +import BigNumber from 'bignumber.js' +import Web3 from 'web3' +import { testLocally } from '../../test-utils/cliUtils' +import { setGrandaMentoLimits } from '../../test-utils/grandaMento' +import Show from './show' + +testWithGanache('grandamento:show cmd', (web3: Web3) => { + const kit = newKitFromWeb3(web3) + let grandaMento: GrandaMentoWrapper + let accounts: Address[] = [] + let celoToken: GoldTokenWrapper + + beforeAll(async () => { + accounts = await web3.eth.getAccounts() + kit.defaultAccount = accounts[0] + grandaMento = await kit.contracts.getGrandaMento() + + celoToken = await kit.contracts.getGoldToken() + }) + + beforeEach(async () => { + await assumeOwnership(web3, accounts[0]) + await setGrandaMentoLimits(grandaMento) + }) + + it('shows proposals', async () => { + // create mock proposal + const sellAmount = new BigNumber('100000000') + await celoToken.increaseAllowance(grandaMento.address, sellAmount).sendAndWaitForReceipt() + + await ( + await grandaMento.createExchangeProposal( + kit.celoTokens.getContract(StableToken.cUSD), + sellAmount, + true + ) + ).sendAndWaitForReceipt() + + await testLocally(Show, ['--proposalID', '1']) + }) +}) diff --git a/packages/cli/src/commands/grandamento/show.ts b/packages/cli/src/commands/grandamento/show.ts new file mode 100644 index 00000000000..f4a227435f5 --- /dev/null +++ b/packages/cli/src/commands/grandamento/show.ts @@ -0,0 +1,29 @@ +import { flags } from '@oclif/command' +import { BaseCommand } from '../../base' +import { newCheckBuilder } from '../../utils/checks' +import { printValueMap } from '../../utils/cli' + +export default class Show extends BaseCommand { + static description = 'Shows details of a Granda Mento exchange proposal' + + static flags = { + ...BaseCommand.flags, + proposalID: flags.string({ + required: true, + description: 'UUID of proposal to view', + }), + } + + async run() { + const grandaMento = await this.kit.contracts.getGrandaMento() + + const res = this.parse(Show) + const proposalID = res.flags.proposalID + + await newCheckBuilder(this).grandaMentoProposalExists(proposalID).runChecks() + + const proposal = await grandaMento.getHumanReadableExchangeProposal(proposalID) + + printValueMap(proposal) + } +} diff --git a/packages/cli/src/test-utils/grandaMento.ts b/packages/cli/src/test-utils/grandaMento.ts new file mode 100644 index 00000000000..28869b92283 --- /dev/null +++ b/packages/cli/src/test-utils/grandaMento.ts @@ -0,0 +1,13 @@ +import { GrandaMentoWrapper } from '@celo/contractkit/lib/wrappers/GrandaMento' +import BigNumber from 'bignumber.js' + +export const setGrandaMentoLimits = async ( + grandaMento: GrandaMentoWrapper, + newLimitMin: BigNumber = new BigNumber('1000'), + newLimitMax: BigNumber = new BigNumber('1000000000000'), + stableToken: string = 'StableToken' +) => { + await grandaMento + .setStableTokenExchangeLimits(stableToken, newLimitMin.toString(), newLimitMax.toString()) + .sendAndWaitForReceipt() +} diff --git a/packages/cli/src/utils/checks.ts b/packages/cli/src/utils/checks.ts index 02349b3d810..da85f980e6f 100644 --- a/packages/cli/src/utils/checks.ts +++ b/packages/cli/src/utils/checks.ts @@ -3,6 +3,10 @@ import { Address } from '@celo/connect' import { StableToken } from '@celo/contractkit' import { AccountsWrapper } from '@celo/contractkit/lib/wrappers/Accounts' import { GovernanceWrapper, ProposalStage } from '@celo/contractkit/lib/wrappers/Governance' +import { + ExchangeProposalState, + GrandaMentoWrapper, +} from '@celo/contractkit/lib/wrappers/GrandaMento' import { LockedGoldWrapper } from '@celo/contractkit/lib/wrappers/LockedGold' import { MultiSigWrapper } from '@celo/contractkit/lib/wrappers/MultiSig' import { ValidatorsWrapper } from '@celo/contractkit/lib/wrappers/Validators' @@ -93,6 +97,13 @@ class CheckBuilder { } } + withGrandaMento(f: (accounts: GrandaMentoWrapper) => A): () => Promise> { + return async () => { + const accounts = await this.kit.contracts.getGrandaMento() + return f(accounts) as Resolve + } + } + withGovernance( f: (governance: GovernanceWrapper, signer: Address, account: Address, ctx: CheckBuilder) => A ): () => Promise> { @@ -131,6 +142,34 @@ class CheckBuilder { this.withGovernance((governance) => governance.proposalExists(proposalID)) ) + grandaMentoProposalExists = (proposalID: string) => + this.addCheck( + `${proposalID} is an existing proposal`, + this.withGrandaMento((grandaMento) => grandaMento.exchangeProposalExists(proposalID)) + ) + + grandaMentoProposalHasState = (proposalID: string, state: ExchangeProposalState) => + this.addCheck( + `${proposalID} has state ${ExchangeProposalState[state]}`, + this.withGrandaMento(async (grandaMento) => { + const exchangeProposal = await grandaMento.getExchangeProposal(proposalID) + return exchangeProposal.state === state + }) + ) + + grandaMentoProposalIsExecutable = (proposalID: string) => { + this.grandaMentoProposalHasState(proposalID, ExchangeProposalState.Approved) + return this.addCheck( + `${proposalID} veto period has elapsed`, + this.withGrandaMento(async (grandaMento) => { + const exchangeProposal = await grandaMento.getExchangeProposal(proposalID) + return exchangeProposal.approvalTimestamp + .plus(exchangeProposal.vetoPeriodSeconds) + .isLessThanOrEqualTo(Date.now() / 1000) + }) + ) + } + proposalInStage = (proposalID: string, stage: keyof typeof ProposalStage) => this.addCheck( `${proposalID} is in stage ${stage}`, diff --git a/packages/docs/command-line-interface/grandamento.md b/packages/docs/command-line-interface/grandamento.md new file mode 100644 index 00000000000..fe08df44f74 --- /dev/null +++ b/packages/docs/command-line-interface/grandamento.md @@ -0,0 +1,129 @@ +# `celocli grandamento` + +Cancels a Granda Mento exchange proposal + + +## `celocli grandamento:cancel` + +Cancels a Granda Mento exchange proposal + +``` +Cancels a Granda Mento exchange proposal + +USAGE + $ celocli grandamento:cancel + +OPTIONS + --from=0xc1912fEE45d61C87Cc5EA59DaE31190FFFFf232d (required) The address allowed to + cancel the proposal + + --globalHelp View all available global flags + + --proposalID=proposalID (required) UUID of proposal to view +``` + +_See code: [src/commands/grandamento/cancel.ts](https://github.com/celo-org/celo-monorepo/tree/master/packages/cli/src/commands/grandamento/cancel.ts)_ + +## `celocli grandamento:execute` + +Executes a Granda Mento exchange proposal + +``` +Executes a Granda Mento exchange proposal + +USAGE + $ celocli grandamento:execute + +OPTIONS + --from=0xc1912fEE45d61C87Cc5EA59DaE31190FFFFf232d (required) The address to execute + the exchange proposal + + --globalHelp View all available global flags + + --proposalID=proposalID (required) UUID of proposal to view +``` + +_See code: [src/commands/grandamento/execute.ts](https://github.com/celo-org/celo-monorepo/tree/master/packages/cli/src/commands/grandamento/execute.ts)_ + +## `celocli grandamento:get-buy-amount` + +Gets the buy amount for a prospective Granda Mento exchange + +``` +Gets the buy amount for a prospective Granda Mento exchange + +USAGE + $ celocli grandamento:get-buy-amount + +OPTIONS + --globalHelp View all available global flags + --sellCelo=(true|false) (required) Sell or buy CELO + + --stableToken=(cUSD|cusd|cEUR|ceur|cREAL|creal) (required) [default: cUSD] Name of + the stable to receive or send + + --value=10000000000000000000000 (required) The value of the tokens to + exchange +``` + +_See code: [src/commands/grandamento/get-buy-amount.ts](https://github.com/celo-org/celo-monorepo/tree/master/packages/cli/src/commands/grandamento/get-buy-amount.ts)_ + +## `celocli grandamento:list` + +List current active Granda Mento exchange proposals + +``` +List current active Granda Mento exchange proposals + +USAGE + $ celocli grandamento:list + +OPTIONS + --globalHelp View all available global flags +``` + +_See code: [src/commands/grandamento/list.ts](https://github.com/celo-org/celo-monorepo/tree/master/packages/cli/src/commands/grandamento/list.ts)_ + +## `celocli grandamento:propose` + +Proposes a Granda Mento exchange + +``` +Proposes a Granda Mento exchange + +USAGE + $ celocli grandamento:propose + +OPTIONS + --from=0xc1912fEE45d61C87Cc5EA59DaE31190FFFFf232d (required) The address with tokens + to exchange + + --globalHelp View all available global flags + + --sellCelo=(true|false) (required) Sell or buy CELO + + --stableToken=(cUSD|cusd|cEUR|ceur|cREAL|creal) (required) [default: cUSD] Name of + the stable to receive or send + + --value=10000000000000000000000 (required) The value of the tokens + to exchange +``` + +_See code: [src/commands/grandamento/propose.ts](https://github.com/celo-org/celo-monorepo/tree/master/packages/cli/src/commands/grandamento/propose.ts)_ + +## `celocli grandamento:show` + +Shows details of a Granda Mento exchange proposal + +``` +Shows details of a Granda Mento exchange proposal + +USAGE + $ celocli grandamento:show + +OPTIONS + --globalHelp View all available global flags + --proposalID=proposalID (required) UUID of proposal to view +``` + +_See code: [src/commands/grandamento/show.ts](https://github.com/celo-org/celo-monorepo/tree/master/packages/cli/src/commands/grandamento/show.ts)_ diff --git a/packages/docs/developer-resources/wallet-hsm-gcp/reference/README.md b/packages/docs/developer-resources/wallet-hsm-gcp/reference/README.md deleted file mode 100644 index 6ad615763c0..00000000000 --- a/packages/docs/developer-resources/wallet-hsm-gcp/reference/README.md +++ /dev/null @@ -1,151 +0,0 @@ -# @celo/wallet-hsm-gcp - -

- - celo logo - -

- -**Celo Monorepo - Official repository for core projects comprising the Celo platform** - -This repository contains the source code for the Celo core projects including the [smart contracts](https://github.com/celo-org/celo-monorepo/tree/master/packages/protocol), [contractKit](https://github.com/celo-org/celo-monorepo/tree/master/packages/sdk/contractkit), -and other packages. The source code for the Celo Blockchain which operates a node on the Celo Network is kept in a separate repo [here](https://github.com/celo-org/celo-blockchain). - - - -[![GitHub Actions](https://github.com/celo-org/celo-monorepo/actions/workflows/container-all-monorepo.yml/badge.svg)](https://github.com/celo-org/celo-monorepo/actions/workflows/container-all-monorepo.yml) -[![Codecov](https://img.shields.io/codecov/c/github/celo-org/celo-monorepo)](https://codecov.io/gh/celo-org/celo-monorepo) -[![GitHub contributors](https://img.shields.io/github/contributors/celo-org/celo-monorepo)](https://github.com/celo-org/celo-monorepo/graphs/contributors) -[![GitHub commit activity](https://img.shields.io/github/commit-activity/w/celo-org/celo-monorepo)](https://github.com/celo-org/celo-monorepo/graphs/contributors) -[![GitHub Stars](https://img.shields.io/github/stars/celo-org/celo-monorepo.svg)](https://github.com/celo-org/celo-monorepo/stargazers) -![GitHub repo size](https://img.shields.io/github/repo-size/celo-org/celo-monorepo) -[![GitHub](https://img.shields.io/github/license/celo-org/celo-monorepo?color=blue)](https://github.com/celo-org/celo-monorepo/blob/master/LICENSE) - - - -[![Website celo.org](https://img.shields.io/website-up-down-green-red/https/celo.org.svg)](https://celo.org) -[![Blog](https://img.shields.io/badge/blog-up-green)](https://medium.com/celoorg) -[![docs](https://img.shields.io/badge/docs-up-green)](https://docs.celo.org/) -[![Youtube](https://img.shields.io/badge/YouTube%20channel-up-green)](https://www.youtube.com/channel/UCCZgos_YAJSXm5QX5D5Wkcw/videos?view=0&sort=p&flow=grid) -[![forum](https://img.shields.io/badge/forum-up-green)](https://forum.celo.org) -[![Discord](https://img.shields.io/discord/600834479145353243.svg)](https://discord.gg/RfHQKtY) -[![Twitter CeloDevs](https://img.shields.io/twitter/follow/celodevs?style=social)](https://twitter.com/celodevs) -[![Twitter CeloOrg](https://img.shields.io/twitter/follow/celoorg?style=social)](https://twitter.com/CeloOrg) -[![Subreddit subscribers](https://img.shields.io/reddit/subreddit-subscribers/CeloHQ?style=social)](https://www.reddit.com/r/CeloHQ/) - - - -[![GitHub pull requests by-label](https://img.shields.io/github/issues-pr-raw/celo-org/celo-monorepo)](https://github.com/celo-org/celo-monorepo/pulls) -[![GitHub Issues](https://img.shields.io/github/issues-raw/celo-org/celo-monorepo.svg)](https://github.com/celo-org/celo-monorepo/issues) -[![GitHub issues by-label](https://img.shields.io/github/issues/celo-org/celo-monorepo/1%20hour%20tasks)](https://github.com/celo-org/celo-monorepo/issues?q=is%3Aopen+is%3Aissue+label%3A%221+hour+tasks%22) - -Contents: - - - -- [Celo's Mission - Prosperity for All](#mission) -- [The Celo Stack](#stack) -- [Documentation](#docs) -- [Issues](#issues) -- [Repo Structure](#repo) -- [Contributing](#contributing) -- [Ask Questions, Find Answers, Get in Touch](#ask) -- [License](#license) - - -## 🥅 Celo's Mission - Prosperity for All - -Celo, pronounced /ˈtselo/, means ‘purpose’ in Esperanto. In a similar spirit, we are aiming to create a new platform to connect people globally and bring financial stability to those who need it most. We believe blockchain technology is one of the most exciting innovations in recent history and as a community we look to push the boundaries of what is possible with it today. More importantly, we are driven by purpose -- to solve real-world problems such as lack of access to sound currency, or friction for cash-transfer programs aimed to alleviate poverty. Our mission is to build a monetary system that creates the conditions for prosperity for all. - - -

- - Play on Youtube - What if money were beautiful - -
- What if money were beautiful? -

- -## 🧱 The Celo Stack - -Celo is oriented around providing the simplest possible experience for end users, who may have no familiarity with cryptocurrencies, and may be using low cost devices with limited connectivity. To achieve this, the project takes a full-stack approach, where each layer of the stack is designed with the end user in mind whilst considering other stakeholders \(e.g. operators of nodes in the network\) involved in enabling the end user experience. - -The Celo stack is structured into the following logical layers: - - -

- Celo protocol -
- The Celo Blockchain and Celo Core Contracts together comprise the Celo Protocol -

- -- **Celo Blockchain**: An open cryptographic protocol that allows applications to make transactions with and run smart contracts in a secure and decentralized fashion. The Celo Blockchain has shared ancestry with [Ethereum](https://www.ethereum.org), and maintains full EVM compatibility for smart contracts. However it uses a [Byzantine Fault Tolerant](http://pmg.csail.mit.edu/papers/osdi99.pdf) \(BFT\) consensus mechanism rather than Proof of Work, and has different block format, transaction format, client synchronization protocols, and gas payment and pricing mechanisms. The network’s native asset is Celo Gold, exposed via an ERC-20 interface. - -- **Celo Core Contracts**: A set of smart contracts running on the Celo Blockchain that comprise much of the logic of the platform features including ERC-20 stable currencies, identity attestations, Proof of Stake and governance. These smart contracts are upgradeable and managed by the decentralized governance process. - - -

- Celo network -
- Topology of a Celo Network -

- -- **Applications:** Applications for end users built on the Celo platform. The Celo Wallet app, the first of an ecosystem of applications, allows end users to manage accounts and make payments securely and simply by taking advantage of the innovations in the Celo protocol. Applications take the form of external mobile or backend software: they interact with the Celo Blockchain to issue transactions and invoke code that forms the Celo Core Contracts’ API. Third parties can also deploy custom smart contracts that their own applications can invoke, which in turn can leverage Celo Core Contracts. Applications may use centralized cloud services to provide some of their functionality: in the case of the Celo Wallet, push notifications and a transaction activity feed. - -## 📚 Documentation - -Follow the instructions in [SETUP.md](SETUP.md) to get a development environment set up. - -See [Developer's Guide](https://docs.celo.org/developer) for full details about the design of the Celo protocol and other information about running these projects. - -## 🙋 Issues - -See the [issue backlog](https://github.com/celo-org/celo-monorepo/issues) for a list of active or proposed tasks. Feel free to create new issues to report bugs and/or request features. - -## 📂 Repo Structure - -The repository has the following packages (sub projects): - -- [celotool](packages/celotool) - scripts for deploying and managing testnets -- [cli](packages/cli) - tool that uses ContractKit to interact with the Celo protocol ([docs](https://docs.celo.org/command-line-interface/introduction)) -- [dev-utils](packages/dev-utils) - a utils package for use as a dev dependency -- [docs](packages/docs) - technical documentation for the Celo project ([live](https://docs.celo.org/)) -- [helm-charts](packages/helm-charts) - (DEPRECATED) templatized deployments of entire environments to Kubernetes clusters. Check [celo-org/charts](https://github.com/celo-org/charts) instead. -- [protocol](packages/protocol) - identity, stability and other smart contracts for the Celo protocol ([docs](https://docs.celo.org/protocol)) -- [sdk](packages/sdk) - Typescript packages for interacting with Celo, including Contracts, Wallets, Crypto++ -- [contractkit](packages/sdk/contractkit) - library to help developers and validators interact with the protocol and its smart contracts ([docs](https://docs.celo.org/developer/contractkit)) -- [typescript](packages/typescript) - no README available (improve?) - -Code owners for each package can be found in [.github/CODEOWNERS](.github/CODEOWNERS). - -## ✍️ Contributing - -Feel free to jump on the Celo 🚂🚋🚋🚋. Improvements and contributions are highly encouraged! 🙏👊 - -See the [contributing guide](https://docs.celo.org/community/contributing) for details on how to participate. -[![GitHub issues by-label](https://img.shields.io/github/issues/celo-org/celo-monorepo/1%20hour%20tasks)](https://github.com/celo-org/celo-monorepo/issues?q=is%3Aopen+is%3Aissue+label%3A%221+hour+tasks%22) - -All communication and contributions to the Celo project are subject to the [Celo Code of Conduct](https://celo.org/code-of-conduct). - -Not yet ready to contribute but do like the project? Support Celo with a ⭐ or share the love in a [![Twitter URL](https://img.shields.io/twitter/url?style=social&url=https%3A%2F%2Fcelo.org%2F)](https://twitter.com/intent/tweet?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DkKggE5OvyhE&via=celohq&text=Checkout%20celo%21%20Love%20what%20they%20are%20building.&hashtags=celo) - - - -## 💬 Ask Questions, Find Answers, Get in Touch - -- [Website](https://celo.org/) -- [Docs](https://docs.celo.org/) -- [Blog](https://medium.com/celohq) -- [YouTube](https://www.youtube.com/channel/UCCZgos_YAJSXm5QX5D5Wkcw/videos?view=0&sort=p&flow=grid) -- [Forum](https://forum.celo.org) -- [Discord](https://discord.gg/vRbExjv) -- [Twitter](https://twitter.com/CeloDevs) -- [Reddit](https://www.reddit.com/r/CeloHQ/) -- [Community Events](https://celo.org/community) - -## 📜 License - -All packages are licensed under the terms of the [Apache 2.0 License](LICENSE) unless otherwise specified in the LICENSE file at package's root. diff --git a/packages/docs/developer-resources/wallet-hsm-gcp/reference/SUMMARY.md b/packages/docs/developer-resources/wallet-hsm-gcp/reference/SUMMARY.md deleted file mode 100644 index ba0872c0fd1..00000000000 --- a/packages/docs/developer-resources/wallet-hsm-gcp/reference/SUMMARY.md +++ /dev/null @@ -1,9 +0,0 @@ -* [Globals](globals.md) -* [Modules]() - * [gcp-hsm-signer](modules/_gcp_hsm_signer_.md) - * [GcpHsmSigner](classes/_gcp_hsm_signer_.gcphsmsigner.md) - * [gcp-hsm-wallet](modules/_gcp_hsm_wallet_.md) - * [GcpHsmWallet](classes/_gcp_hsm_wallet_.gcphsmwallet.md) -* [Classes]() - * [GcpHsmSigner](classes/_gcp_hsm_signer_.gcphsmsigner.md) - * [GcpHsmWallet](classes/_gcp_hsm_wallet_.gcphsmwallet.md) \ No newline at end of file diff --git a/packages/docs/developer-resources/wallet-hsm-gcp/reference/classes/_gcp_hsm_signer_.gcphsmsigner.md b/packages/docs/developer-resources/wallet-hsm-gcp/reference/classes/_gcp_hsm_signer_.gcphsmsigner.md deleted file mode 100644 index 0708d01dc34..00000000000 --- a/packages/docs/developer-resources/wallet-hsm-gcp/reference/classes/_gcp_hsm_signer_.gcphsmsigner.md +++ /dev/null @@ -1,133 +0,0 @@ -# Class: GcpHsmSigner - -## Hierarchy - -* **GcpHsmSigner** - -## Implements - -* Signer - -## Index - -### Constructors - -* [constructor](_gcp_hsm_signer_.gcphsmsigner.md#constructor) - -### Methods - -* [computeSharedSecret](_gcp_hsm_signer_.gcphsmsigner.md#computesharedsecret) -* [decrypt](_gcp_hsm_signer_.gcphsmsigner.md#decrypt) -* [getNativeKey](_gcp_hsm_signer_.gcphsmsigner.md#getnativekey) -* [signPersonalMessage](_gcp_hsm_signer_.gcphsmsigner.md#signpersonalmessage) -* [signTransaction](_gcp_hsm_signer_.gcphsmsigner.md#signtransaction) -* [signTypedData](_gcp_hsm_signer_.gcphsmsigner.md#signtypeddata) - -## Constructors - -### constructor - -\+ **new GcpHsmSigner**(`client`: KeyManagementServiceClient, `versionName`: string, `publicKey`: BigNumber): *[GcpHsmSigner](_gcp_hsm_signer_.gcphsmsigner.md)* - -*Defined in [wallet-hsm-gcp/src/gcp-hsm-signer.ts:22](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-hsm-gcp/src/gcp-hsm-signer.ts#L22)* - -**Parameters:** - -Name | Type | ------- | ------ | -`client` | KeyManagementServiceClient | -`versionName` | string | -`publicKey` | BigNumber | - -**Returns:** *[GcpHsmSigner](_gcp_hsm_signer_.gcphsmsigner.md)* - -## Methods - -### computeSharedSecret - -▸ **computeSharedSecret**(`_publicKey`: string): *Promise‹Buffer‹››* - -*Defined in [wallet-hsm-gcp/src/gcp-hsm-signer.ts:111](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-hsm-gcp/src/gcp-hsm-signer.ts#L111)* - -**Parameters:** - -Name | Type | ------- | ------ | -`_publicKey` | string | - -**Returns:** *Promise‹Buffer‹››* - -___ - -### decrypt - -▸ **decrypt**(`_ciphertext`: Buffer): *Promise‹Buffer‹››* - -*Defined in [wallet-hsm-gcp/src/gcp-hsm-signer.ts:105](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-hsm-gcp/src/gcp-hsm-signer.ts#L105)* - -**Parameters:** - -Name | Type | ------- | ------ | -`_ciphertext` | Buffer | - -**Returns:** *Promise‹Buffer‹››* - -___ - -### getNativeKey - -▸ **getNativeKey**(): *string* - -*Defined in [wallet-hsm-gcp/src/gcp-hsm-signer.ts:101](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-hsm-gcp/src/gcp-hsm-signer.ts#L101)* - -**Returns:** *string* - -___ - -### signPersonalMessage - -▸ **signPersonalMessage**(`data`: string): *Promise‹Signature›* - -*Defined in [wallet-hsm-gcp/src/gcp-hsm-signer.ts:78](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-hsm-gcp/src/gcp-hsm-signer.ts#L78)* - -**Parameters:** - -Name | Type | ------- | ------ | -`data` | string | - -**Returns:** *Promise‹Signature›* - -___ - -### signTransaction - -▸ **signTransaction**(`addToV`: number, `encodedTx`: RLPEncodedTx): *Promise‹Signature›* - -*Defined in [wallet-hsm-gcp/src/gcp-hsm-signer.ts:66](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-hsm-gcp/src/gcp-hsm-signer.ts#L66)* - -**Parameters:** - -Name | Type | ------- | ------ | -`addToV` | number | -`encodedTx` | RLPEncodedTx | - -**Returns:** *Promise‹Signature›* - -___ - -### signTypedData - -▸ **signTypedData**(`typedData`: EIP712TypedData): *Promise‹Signature›* - -*Defined in [wallet-hsm-gcp/src/gcp-hsm-signer.ts:90](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-hsm-gcp/src/gcp-hsm-signer.ts#L90)* - -**Parameters:** - -Name | Type | ------- | ------ | -`typedData` | EIP712TypedData | - -**Returns:** *Promise‹Signature›* diff --git a/packages/docs/developer-resources/wallet-hsm-gcp/reference/classes/_gcp_hsm_wallet_.gcphsmwallet.md b/packages/docs/developer-resources/wallet-hsm-gcp/reference/classes/_gcp_hsm_wallet_.gcphsmwallet.md deleted file mode 100644 index 33f2bbeb16b..00000000000 --- a/packages/docs/developer-resources/wallet-hsm-gcp/reference/classes/_gcp_hsm_wallet_.gcphsmwallet.md +++ /dev/null @@ -1,268 +0,0 @@ -# Class: GcpHsmWallet - -A Cloud HSM wallet built on GCP. - -## Hierarchy - -* RemoteWallet‹[GcpHsmSigner](_gcp_hsm_signer_.gcphsmsigner.md)› - - ↳ **GcpHsmWallet** - -## Implements - -* ReadOnlyWallet -* ReadOnlyWallet -* ReadOnlyWallet - -## Index - -### Constructors - -* [constructor](_gcp_hsm_wallet_.gcphsmwallet.md#constructor) - -### Properties - -* [isSetupFinished](_gcp_hsm_wallet_.gcphsmwallet.md#issetupfinished) - -### Methods - -* [computeSharedSecret](_gcp_hsm_wallet_.gcphsmwallet.md#computesharedsecret) -* [decrypt](_gcp_hsm_wallet_.gcphsmwallet.md#decrypt) -* [getAccounts](_gcp_hsm_wallet_.gcphsmwallet.md#getaccounts) -* [getAddressFromVersionName](_gcp_hsm_wallet_.gcphsmwallet.md#getaddressfromversionname) -* [hasAccount](_gcp_hsm_wallet_.gcphsmwallet.md#hasaccount) -* [init](_gcp_hsm_wallet_.gcphsmwallet.md#init) -* [removeAccount](_gcp_hsm_wallet_.gcphsmwallet.md#removeaccount) -* [signPersonalMessage](_gcp_hsm_wallet_.gcphsmwallet.md#signpersonalmessage) -* [signTransaction](_gcp_hsm_wallet_.gcphsmwallet.md#signtransaction) -* [signTypedData](_gcp_hsm_wallet_.gcphsmwallet.md#signtypeddata) - -## Constructors - -### constructor - -\+ **new GcpHsmWallet**(`versionName`: string): *[GcpHsmWallet](_gcp_hsm_wallet_.gcphsmwallet.md)* - -*Defined in [wallet-hsm-gcp/src/gcp-hsm-wallet.ts:19](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-hsm-gcp/src/gcp-hsm-wallet.ts#L19)* - -**Parameters:** - -Name | Type | ------- | ------ | -`versionName` | string | - -**Returns:** *[GcpHsmWallet](_gcp_hsm_wallet_.gcphsmwallet.md)* - -## Properties - -### isSetupFinished - -• **isSetupFinished**: *function* - -*Inherited from [GcpHsmWallet](_gcp_hsm_wallet_.gcphsmwallet.md).[isSetupFinished](_gcp_hsm_wallet_.gcphsmwallet.md#issetupfinished)* - -Defined in wallet-remote/lib/remote-wallet.d.ts:51 - -#### Type declaration: - -▸ (): *boolean* - -## Methods - -### computeSharedSecret - -▸ **computeSharedSecret**(`address`: Address, `publicKey`: string): *Promise‹Buffer›* - -*Inherited from [GcpHsmWallet](_gcp_hsm_wallet_.gcphsmwallet.md).[computeSharedSecret](_gcp_hsm_wallet_.gcphsmwallet.md#computesharedsecret)* - -Defined in wallet-base/lib/wallet-base.d.ts:64 - -Computes the shared secret (an ECDH key exchange object) between two accounts - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | Address | -`publicKey` | string | - -**Returns:** *Promise‹Buffer›* - -___ - -### decrypt - -▸ **decrypt**(`address`: string, `ciphertext`: Buffer): *Promise‹Buffer›* - -*Inherited from [GcpHsmWallet](_gcp_hsm_wallet_.gcphsmwallet.md).[decrypt](_gcp_hsm_wallet_.gcphsmwallet.md#decrypt)* - -Defined in wallet-base/lib/wallet-base.d.ts:60 - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | string | -`ciphertext` | Buffer | - -**Returns:** *Promise‹Buffer›* - -___ - -### getAccounts - -▸ **getAccounts**(): *Address[]* - -*Inherited from [GcpHsmWallet](_gcp_hsm_wallet_.gcphsmwallet.md).[getAccounts](_gcp_hsm_wallet_.gcphsmwallet.md#getaccounts)* - -*Overrides void* - -Defined in wallet-remote/lib/remote-wallet.d.ts:27 - -Get a list of accounts in the remote wallet - -**Returns:** *Address[]* - -___ - -### getAddressFromVersionName - -▸ **getAddressFromVersionName**(`versionName`: string): *Promise‹Address›* - -*Defined in [wallet-hsm-gcp/src/gcp-hsm-wallet.ts:78](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-hsm-gcp/src/gcp-hsm-wallet.ts#L78)* - -Returns the EVM address for the given key -Useful for initially getting the 'from' field given a keyName - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`versionName` | string | GCP version name for the HSM | - -**Returns:** *Promise‹Address›* - -___ - -### hasAccount - -▸ **hasAccount**(`address?`: Address): *boolean* - -*Inherited from [GcpHsmWallet](_gcp_hsm_wallet_.gcphsmwallet.md).[hasAccount](_gcp_hsm_wallet_.gcphsmwallet.md#hasaccount)* - -*Overrides void* - -Defined in wallet-remote/lib/remote-wallet.d.ts:32 - -Returns true if account is in the remote wallet - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`address?` | Address | Account to check | - -**Returns:** *boolean* - -___ - -### init - -▸ **init**(): *Promise‹void›* - -*Inherited from [GcpHsmWallet](_gcp_hsm_wallet_.gcphsmwallet.md).[init](_gcp_hsm_wallet_.gcphsmwallet.md#init)* - -Defined in wallet-remote/lib/remote-wallet.d.ts:15 - -Discovers wallet accounts and caches results in memory -Idempotent to ensure multiple calls are benign - -**Returns:** *Promise‹void›* - -___ - -### removeAccount - -▸ **removeAccount**(`_address`: string): *void* - -*Inherited from [GcpHsmWallet](_gcp_hsm_wallet_.gcphsmwallet.md).[removeAccount](_gcp_hsm_wallet_.gcphsmwallet.md#removeaccount)* - -Defined in wallet-base/lib/wallet-base.d.ts:23 - -Removes the account with the given address. Needs to be implemented by subclass, otherwise throws error - -**Parameters:** - -Name | Type | ------- | ------ | -`_address` | string | - -**Returns:** *void* - -___ - -### signPersonalMessage - -▸ **signPersonalMessage**(`address`: Address, `data`: string): *Promise‹string›* - -*Inherited from [GcpHsmWallet](_gcp_hsm_wallet_.gcphsmwallet.md).[signPersonalMessage](_gcp_hsm_wallet_.gcphsmwallet.md#signpersonalmessage)* - -*Overrides void* - -Defined in wallet-remote/lib/remote-wallet.d.ts:43 - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`address` | Address | Address of the account to sign with | -`data` | string | Hex string message to sign | - -**Returns:** *Promise‹string›* - -Signature hex string (order: rsv) - -___ - -### signTransaction - -▸ **signTransaction**(`txParams`: CeloTx): *Promise‹EncodedTransaction›* - -*Inherited from [GcpHsmWallet](_gcp_hsm_wallet_.gcphsmwallet.md).[signTransaction](_gcp_hsm_wallet_.gcphsmwallet.md#signtransaction)* - -*Overrides void* - -Defined in wallet-remote/lib/remote-wallet.d.ts:37 - -Signs the EVM transaction using the signer pulled from the from field - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`txParams` | CeloTx | EVM transaction | - -**Returns:** *Promise‹EncodedTransaction›* - -___ - -### signTypedData - -▸ **signTypedData**(`address`: Address, `typedData`: EIP712TypedData): *Promise‹string›* - -*Inherited from [GcpHsmWallet](_gcp_hsm_wallet_.gcphsmwallet.md).[signTypedData](_gcp_hsm_wallet_.gcphsmwallet.md#signtypeddata)* - -*Overrides void* - -Defined in wallet-remote/lib/remote-wallet.d.ts:49 - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`address` | Address | Address of the account to sign with | -`typedData` | EIP712TypedData | the typed data object | - -**Returns:** *Promise‹string›* - -Signature hex string (order: rsv) diff --git a/packages/docs/developer-resources/wallet-hsm-gcp/reference/globals.md b/packages/docs/developer-resources/wallet-hsm-gcp/reference/globals.md deleted file mode 100644 index 000d5478119..00000000000 --- a/packages/docs/developer-resources/wallet-hsm-gcp/reference/globals.md +++ /dev/null @@ -1,8 +0,0 @@ -# @celo/wallet-hsm-gcp - -## Index - -### Modules - -* ["gcp-hsm-signer"](modules/_gcp_hsm_signer_.md) -* ["gcp-hsm-wallet"](modules/_gcp_hsm_wallet_.md) diff --git a/packages/docs/developer-resources/wallet-hsm-gcp/reference/modules/_gcp_hsm_signer_.md b/packages/docs/developer-resources/wallet-hsm-gcp/reference/modules/_gcp_hsm_signer_.md deleted file mode 100644 index ac95b7f577b..00000000000 --- a/packages/docs/developer-resources/wallet-hsm-gcp/reference/modules/_gcp_hsm_signer_.md +++ /dev/null @@ -1,7 +0,0 @@ -# Module: "gcp-hsm-signer" - -## Index - -### Classes - -* [GcpHsmSigner](../classes/_gcp_hsm_signer_.gcphsmsigner.md) diff --git a/packages/docs/developer-resources/wallet-hsm-gcp/reference/modules/_gcp_hsm_wallet_.md b/packages/docs/developer-resources/wallet-hsm-gcp/reference/modules/_gcp_hsm_wallet_.md deleted file mode 100644 index bafc6670a9b..00000000000 --- a/packages/docs/developer-resources/wallet-hsm-gcp/reference/modules/_gcp_hsm_wallet_.md +++ /dev/null @@ -1,7 +0,0 @@ -# Module: "gcp-hsm-wallet" - -## Index - -### Classes - -* [GcpHsmWallet](../classes/_gcp_hsm_wallet_.gcphsmwallet.md) diff --git a/packages/docs/sdk/docs/base/README.md b/packages/docs/sdk/docs/base/README.md index 55ee2b08235..6d98025438e 100644 --- a/packages/docs/sdk/docs/base/README.md +++ b/packages/docs/sdk/docs/base/README.md @@ -9,6 +9,7 @@ * ["account"](modules/_account_.md) * ["address"](modules/_address_.md) * ["async"](modules/_async_.md) +* ["attestations"](modules/_attestations_.md) * ["collections"](modules/_collections_.md) * ["contacts"](modules/_contacts_.md) * ["currencies"](modules/_currencies_.md) diff --git a/packages/docs/sdk/docs/base/classes/_future_.future.md b/packages/docs/sdk/docs/base/classes/_future_.future.md index eee3eacab1d..f30ca11f35d 100644 --- a/packages/docs/sdk/docs/base/classes/_future_.future.md +++ b/packages/docs/sdk/docs/base/classes/_future_.future.md @@ -1,6 +1,6 @@ [@celo/base](../README.md) › ["future"](../modules/_future_.md) › [Future](_future_.future.md) -# Class: Future ‹**T**› +# Class: Future <**T**> **`internal`** diff --git a/packages/docs/sdk/docs/base/classes/_result_.jsonparseerror.md b/packages/docs/sdk/docs/base/classes/_result_.jsonparseerror.md index d633cffe781..05c5eb19199 100644 --- a/packages/docs/sdk/docs/base/classes/_result_.jsonparseerror.md +++ b/packages/docs/sdk/docs/base/classes/_result_.jsonparseerror.md @@ -72,7 +72,7 @@ ___ *Inherited from [RootError](_result_.rooterror.md).[message](_result_.rooterror.md#message)* -Defined in node_modules/typescript/lib/lib.es5.d.ts:1029 +Defined in node_modules/typescript/lib/lib.es5.d.ts:974 ___ @@ -82,7 +82,7 @@ ___ *Inherited from [RootError](_result_.rooterror.md).[name](_result_.rooterror.md#name)* -Defined in node_modules/typescript/lib/lib.es5.d.ts:1028 +Defined in node_modules/typescript/lib/lib.es5.d.ts:973 ___ @@ -92,4 +92,4 @@ ___ *Inherited from [RootError](_result_.rooterror.md).[stack](_result_.rooterror.md#optional-stack)* -Defined in node_modules/typescript/lib/lib.es5.d.ts:1030 +Defined in node_modules/typescript/lib/lib.es5.d.ts:975 diff --git a/packages/docs/sdk/docs/base/classes/_result_.rooterror.md b/packages/docs/sdk/docs/base/classes/_result_.rooterror.md index 725654c1ef2..c8839b93026 100644 --- a/packages/docs/sdk/docs/base/classes/_result_.rooterror.md +++ b/packages/docs/sdk/docs/base/classes/_result_.rooterror.md @@ -1,6 +1,6 @@ [@celo/base](../README.md) › ["result"](../modules/_result_.md) › [RootError](_result_.rooterror.md) -# Class: RootError ‹**T**› +# Class: RootError <**T**> ## Type parameters @@ -66,7 +66,7 @@ ___ *Inherited from [RootError](_result_.rooterror.md).[message](_result_.rooterror.md#message)* -Defined in node_modules/typescript/lib/lib.es5.d.ts:1029 +Defined in node_modules/typescript/lib/lib.es5.d.ts:974 ___ @@ -76,7 +76,7 @@ ___ *Inherited from [RootError](_result_.rooterror.md).[name](_result_.rooterror.md#name)* -Defined in node_modules/typescript/lib/lib.es5.d.ts:1028 +Defined in node_modules/typescript/lib/lib.es5.d.ts:973 ___ @@ -86,7 +86,9 @@ ___ *Inherited from [RootError](_result_.rooterror.md).[stack](_result_.rooterror.md#optional-stack)* -Defined in node_modules/typescript/lib/lib.es5.d.ts:1030 +*Overrides [RootError](_result_.rooterror.md).[stack](_result_.rooterror.md#optional-stack)* + +Defined in node_modules/typescript/lib/lib.es5.d.ts:975 ___ @@ -94,4 +96,4 @@ ___ ▪ **Error**: *ErrorConstructor* -Defined in node_modules/typescript/lib/lib.es5.d.ts:1039 +Defined in node_modules/typescript/lib/lib.es5.d.ts:984 diff --git a/packages/docs/sdk/docs/base/enums/_attestations_.identifiertype.md b/packages/docs/sdk/docs/base/enums/_attestations_.identifiertype.md new file mode 100644 index 00000000000..668ac2d51c1 --- /dev/null +++ b/packages/docs/sdk/docs/base/enums/_attestations_.identifiertype.md @@ -0,0 +1,17 @@ +[@celo/base](../README.md) › ["attestations"](../modules/_attestations_.md) › [IdentifierType](_attestations_.identifiertype.md) + +# Enumeration: IdentifierType + +## Index + +### Enumeration members + +* [PHONE_NUMBER](_attestations_.identifiertype.md#phone_number) + +## Enumeration members + +### PHONE_NUMBER + +• **PHONE_NUMBER**: = 0 + +*Defined in [packages/sdk/base/src/attestations.ts:8](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/attestations.ts#L8)* diff --git a/packages/docs/sdk/docs/base/interfaces/_attestations_.attestationsstatus.md b/packages/docs/sdk/docs/base/interfaces/_attestations_.attestationsstatus.md new file mode 100644 index 00000000000..4ddca15dde5 --- /dev/null +++ b/packages/docs/sdk/docs/base/interfaces/_attestations_.attestationsstatus.md @@ -0,0 +1,48 @@ +[@celo/base](../README.md) › ["attestations"](../modules/_attestations_.md) › [AttestationsStatus](_attestations_.attestationsstatus.md) + +# Interface: AttestationsStatus + +## Hierarchy + +* **AttestationsStatus** + +## Index + +### Properties + +* [completed](_attestations_.attestationsstatus.md#completed) +* [isVerified](_attestations_.attestationsstatus.md#isverified) +* [numAttestationsRemaining](_attestations_.attestationsstatus.md#numattestationsremaining) +* [total](_attestations_.attestationsstatus.md#total) + +## Properties + +### completed + +• **completed**: *number* + +*Defined in [packages/sdk/base/src/attestations.ts:71](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/attestations.ts#L71)* + +___ + +### isVerified + +• **isVerified**: *boolean* + +*Defined in [packages/sdk/base/src/attestations.ts:68](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/attestations.ts#L68)* + +___ + +### numAttestationsRemaining + +• **numAttestationsRemaining**: *number* + +*Defined in [packages/sdk/base/src/attestations.ts:69](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/attestations.ts#L69)* + +___ + +### total + +• **total**: *number* + +*Defined in [packages/sdk/base/src/attestations.ts:70](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/attestations.ts#L70)* diff --git a/packages/docs/sdk/docs/base/interfaces/_collections_.addresslistitem.md b/packages/docs/sdk/docs/base/interfaces/_collections_.addresslistitem.md index 885bf44a855..87b43cbeebd 100644 --- a/packages/docs/sdk/docs/base/interfaces/_collections_.addresslistitem.md +++ b/packages/docs/sdk/docs/base/interfaces/_collections_.addresslistitem.md @@ -1,6 +1,6 @@ [@celo/base](../README.md) › ["collections"](../modules/_collections_.md) › [AddressListItem](_collections_.addresslistitem.md) -# Interface: AddressListItem ‹**T**› +# Interface: AddressListItem <**T**> ## Type parameters diff --git a/packages/docs/sdk/docs/base/interfaces/_phonenumbers_.parsedphonenumber.md b/packages/docs/sdk/docs/base/interfaces/_phonenumbers_.parsedphonenumber.md index 2133b825a3a..d4836e8439b 100644 --- a/packages/docs/sdk/docs/base/interfaces/_phonenumbers_.parsedphonenumber.md +++ b/packages/docs/sdk/docs/base/interfaces/_phonenumbers_.parsedphonenumber.md @@ -22,7 +22,7 @@ • **countryCode**? : *undefined | number* -*Defined in [packages/sdk/base/src/phoneNumbers.ts:5](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/phoneNumbers.ts#L5)* +*Defined in [packages/sdk/base/src/phoneNumbers.ts:7](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/phoneNumbers.ts#L7)* ___ @@ -30,7 +30,7 @@ ___ • **displayNumber**: *string* -*Defined in [packages/sdk/base/src/phoneNumbers.ts:3](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/phoneNumbers.ts#L3)* +*Defined in [packages/sdk/base/src/phoneNumbers.ts:5](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/phoneNumbers.ts#L5)* ___ @@ -38,7 +38,7 @@ ___ • **displayNumberInternational**: *string* -*Defined in [packages/sdk/base/src/phoneNumbers.ts:4](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/phoneNumbers.ts#L4)* +*Defined in [packages/sdk/base/src/phoneNumbers.ts:6](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/phoneNumbers.ts#L6)* ___ @@ -46,7 +46,7 @@ ___ • **e164Number**: *string* -*Defined in [packages/sdk/base/src/phoneNumbers.ts:2](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/phoneNumbers.ts#L2)* +*Defined in [packages/sdk/base/src/phoneNumbers.ts:4](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/phoneNumbers.ts#L4)* ___ @@ -54,4 +54,4 @@ ___ • **regionCode**? : *undefined | string* -*Defined in [packages/sdk/base/src/phoneNumbers.ts:6](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/phoneNumbers.ts#L6)* +*Defined in [packages/sdk/base/src/phoneNumbers.ts:8](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/phoneNumbers.ts#L8)* diff --git a/packages/docs/sdk/docs/base/interfaces/_result_.baseerror.md b/packages/docs/sdk/docs/base/interfaces/_result_.baseerror.md index 77cedfcbf72..542f7cc4083 100644 --- a/packages/docs/sdk/docs/base/interfaces/_result_.baseerror.md +++ b/packages/docs/sdk/docs/base/interfaces/_result_.baseerror.md @@ -1,6 +1,6 @@ [@celo/base](../README.md) › ["result"](../modules/_result_.md) › [BaseError](_result_.baseerror.md) -# Interface: BaseError ‹**T**› +# Interface: BaseError <**T**> ## Type parameters diff --git a/packages/docs/sdk/docs/base/interfaces/_result_.errorresult.md b/packages/docs/sdk/docs/base/interfaces/_result_.errorresult.md index 3ca3346ebe2..5fc8f8be88a 100644 --- a/packages/docs/sdk/docs/base/interfaces/_result_.errorresult.md +++ b/packages/docs/sdk/docs/base/interfaces/_result_.errorresult.md @@ -1,6 +1,6 @@ [@celo/base](../README.md) › ["result"](../modules/_result_.md) › [ErrorResult](_result_.errorresult.md) -# Interface: ErrorResult ‹**TError**› +# Interface: ErrorResult <**TError**> ## Type parameters diff --git a/packages/docs/sdk/docs/base/interfaces/_result_.okresult.md b/packages/docs/sdk/docs/base/interfaces/_result_.okresult.md index 63d44046fba..fc2974ec482 100644 --- a/packages/docs/sdk/docs/base/interfaces/_result_.okresult.md +++ b/packages/docs/sdk/docs/base/interfaces/_result_.okresult.md @@ -1,6 +1,6 @@ [@celo/base](../README.md) › ["result"](../modules/_result_.md) › [OkResult](_result_.okresult.md) -# Interface: OkResult ‹**TResult**› +# Interface: OkResult <**TResult**> ## Type parameters diff --git a/packages/docs/sdk/docs/base/interfaces/_signatureutils_.signature.md b/packages/docs/sdk/docs/base/interfaces/_signatureutils_.signature.md index ba372476821..3f1d897423f 100644 --- a/packages/docs/sdk/docs/base/interfaces/_signatureutils_.signature.md +++ b/packages/docs/sdk/docs/base/interfaces/_signatureutils_.signature.md @@ -20,7 +20,7 @@ • **r**: *string* -*Defined in [packages/sdk/base/src/signatureUtils.ts:22](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/signatureUtils.ts#L22)* +*Defined in [packages/sdk/base/src/signatureUtils.ts:21](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/signatureUtils.ts#L21)* ___ @@ -28,7 +28,7 @@ ___ • **s**: *string* -*Defined in [packages/sdk/base/src/signatureUtils.ts:23](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/signatureUtils.ts#L23)* +*Defined in [packages/sdk/base/src/signatureUtils.ts:22](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/signatureUtils.ts#L22)* ___ @@ -36,4 +36,4 @@ ___ • **v**: *number* -*Defined in [packages/sdk/base/src/signatureUtils.ts:21](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/signatureUtils.ts#L21)* +*Defined in [packages/sdk/base/src/signatureUtils.ts:20](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/signatureUtils.ts#L20)* diff --git a/packages/docs/sdk/docs/base/interfaces/_task_.retrytaskoptions.md b/packages/docs/sdk/docs/base/interfaces/_task_.retrytaskoptions.md index 580f8b4d016..9f0b4ab11df 100644 --- a/packages/docs/sdk/docs/base/interfaces/_task_.retrytaskoptions.md +++ b/packages/docs/sdk/docs/base/interfaces/_task_.retrytaskoptions.md @@ -1,6 +1,6 @@ [@celo/base](../README.md) › ["task"](../modules/_task_.md) › [RetryTaskOptions](_task_.retrytaskoptions.md) -# Interface: RetryTaskOptions ‹**A**› +# Interface: RetryTaskOptions <**A**> ## Type parameters diff --git a/packages/docs/sdk/docs/base/interfaces/_task_.runningtaskwithvalue.md b/packages/docs/sdk/docs/base/interfaces/_task_.runningtaskwithvalue.md index fe624510633..00df9c89ecd 100644 --- a/packages/docs/sdk/docs/base/interfaces/_task_.runningtaskwithvalue.md +++ b/packages/docs/sdk/docs/base/interfaces/_task_.runningtaskwithvalue.md @@ -1,6 +1,6 @@ [@celo/base](../README.md) › ["task"](../modules/_task_.md) › [RunningTaskWithValue](_task_.runningtaskwithvalue.md) -# Interface: RunningTaskWithValue ‹**A**› +# Interface: RunningTaskWithValue <**A**> ## Type parameters diff --git a/packages/docs/sdk/docs/base/modules/_address_.md b/packages/docs/sdk/docs/base/modules/_address_.md index 9b60c81bb41..51b7994481b 100644 --- a/packages/docs/sdk/docs/base/modules/_address_.md +++ b/packages/docs/sdk/docs/base/modules/_address_.md @@ -7,7 +7,6 @@ ### Type aliases * [Address](_address_.md#address) -* [StrongAddress](_address_.md#strongaddress) ### Variables @@ -37,29 +36,21 @@ *Defined in [packages/sdk/base/src/address.ts:3](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/address.ts#L3)* -___ - -### StrongAddress - -Ƭ **StrongAddress**: *`0x${string}`* - -*Defined in [packages/sdk/base/src/address.ts:5](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/address.ts#L5)* - ## Variables ### `Const` NULL_ADDRESS • **NULL_ADDRESS**: *"0x0000000000000000000000000000000000000000"* = "0x0000000000000000000000000000000000000000" -*Defined in [packages/sdk/base/src/address.ts:31](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/address.ts#L31)* +*Defined in [packages/sdk/base/src/address.ts:28](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/address.ts#L28)* ## Functions ### `Const` bufferToHex -▸ **bufferToHex**(`buf`: Buffer): *`0x${string}`* +▸ **bufferToHex**(`buf`: Buffer): *string* -*Defined in [packages/sdk/base/src/address.ts:29](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/address.ts#L29)* +*Defined in [packages/sdk/base/src/address.ts:26](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/address.ts#L26)* **Parameters:** @@ -67,15 +58,15 @@ Name | Type | ------ | ------ | `buf` | Buffer | -**Returns:** *`0x${string}`* +**Returns:** *string* ___ ### `Const` ensureLeading0x -▸ **ensureLeading0x**(`input`: string): *[StrongAddress](_address_.md#strongaddress)* +▸ **ensureLeading0x**(`input`: string): *string* -*Defined in [packages/sdk/base/src/address.ts:17](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/address.ts#L17)* +*Defined in [packages/sdk/base/src/address.ts:15](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/address.ts#L15)* **Parameters:** @@ -83,7 +74,7 @@ Name | Type | ------ | ------ | `input` | string | -**Returns:** *[StrongAddress](_address_.md#strongaddress)* +**Returns:** *string* ___ @@ -91,7 +82,7 @@ ___ ▸ **eqAddress**(`a`: [Address](_address_.md#address), `b`: [Address](_address_.md#address)): *boolean* -*Defined in [packages/sdk/base/src/address.ts:7](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/address.ts#L7)* +*Defined in [packages/sdk/base/src/address.ts:5](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/address.ts#L5)* **Parameters:** @@ -108,7 +99,7 @@ ___ ▸ **findAddressIndex**(`address`: [Address](_address_.md#address), `addresses`: [Address](_address_.md#address)[]): *number* -*Defined in [packages/sdk/base/src/address.ts:33](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/address.ts#L33)* +*Defined in [packages/sdk/base/src/address.ts:30](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/address.ts#L30)* **Parameters:** @@ -125,7 +116,7 @@ ___ ▸ **getAddressChunks**(`input`: string): *string[]* -*Defined in [packages/sdk/base/src/address.ts:22](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/address.ts#L22)* +*Defined in [packages/sdk/base/src/address.ts:19](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/address.ts#L19)* **Parameters:** @@ -141,7 +132,7 @@ ___ ▸ **hexToBuffer**(`input`: string): *Buffer‹›* -*Defined in [packages/sdk/base/src/address.ts:27](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/address.ts#L27)* +*Defined in [packages/sdk/base/src/address.ts:24](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/address.ts#L24)* **Parameters:** @@ -157,7 +148,7 @@ ___ ▸ **isHexString**(`input`: string): *boolean* -*Defined in [packages/sdk/base/src/address.ts:25](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/address.ts#L25)* +*Defined in [packages/sdk/base/src/address.ts:22](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/address.ts#L22)* **Parameters:** @@ -173,7 +164,7 @@ ___ ▸ **isNullAddress**(`a`: [Address](_address_.md#address)): *boolean* -*Defined in [packages/sdk/base/src/address.ts:11](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/address.ts#L11)* +*Defined in [packages/sdk/base/src/address.ts:9](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/address.ts#L9)* **Parameters:** @@ -187,9 +178,9 @@ ___ ### mapAddressListDataOnto -▸ **mapAddressListDataOnto**‹**T**›(`data`: T[], `oldAddress`: [Address](_address_.md#address)[], `newAddress`: [Address](_address_.md#address)[], `initialValue`: T): *T[]* +▸ **mapAddressListDataOnto**<**T**>(`data`: T[], `oldAddress`: [Address](_address_.md#address)[], `newAddress`: [Address](_address_.md#address)[], `initialValue`: T): *T[]* -*Defined in [packages/sdk/base/src/address.ts:70](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/address.ts#L70)* +*Defined in [packages/sdk/base/src/address.ts:67](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/address.ts#L67)* **Type parameters:** @@ -212,7 +203,7 @@ ___ ▸ **mapAddressListOnto**(`oldAddress`: [Address](_address_.md#address)[], `newAddress`: [Address](_address_.md#address)[]): *any[]* -*Defined in [packages/sdk/base/src/address.ts:37](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/address.ts#L37)* +*Defined in [packages/sdk/base/src/address.ts:34](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/address.ts#L34)* **Parameters:** @@ -229,7 +220,7 @@ ___ ▸ **normalizeAddress**(`a`: [Address](_address_.md#address)): *string* -*Defined in [packages/sdk/base/src/address.ts:9](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/address.ts#L9)* +*Defined in [packages/sdk/base/src/address.ts:7](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/address.ts#L7)* **Parameters:** @@ -245,7 +236,7 @@ ___ ▸ **normalizeAddressWith0x**(`a`: [Address](_address_.md#address)): *string* -*Defined in [packages/sdk/base/src/address.ts:13](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/address.ts#L13)* +*Defined in [packages/sdk/base/src/address.ts:11](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/address.ts#L11)* **Parameters:** @@ -261,7 +252,7 @@ ___ ▸ **trimLeading0x**(`input`: string): *string* -*Defined in [packages/sdk/base/src/address.ts:15](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/address.ts#L15)* +*Defined in [packages/sdk/base/src/address.ts:13](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/address.ts#L13)* **Parameters:** diff --git a/packages/docs/sdk/docs/base/modules/_async_.md b/packages/docs/sdk/docs/base/modules/_async_.md index a34abb223c7..b248e6f6449 100644 --- a/packages/docs/sdk/docs/base/modules/_async_.md +++ b/packages/docs/sdk/docs/base/modules/_async_.md @@ -19,7 +19,7 @@ ### concurrentMap -▸ **concurrentMap**‹**A**, **B**›(`concurrency`: number, `xs`: A[], `mapFn`: function): *Promise‹B[]›* +▸ **concurrentMap**<**A**, **B**>(`concurrency`: number, `xs`: A[], `mapFn`: function): *Promise‹B[]›* *Defined in [packages/sdk/base/src/async.ts:128](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/async.ts#L128)* @@ -60,7 +60,7 @@ ___ ### concurrentValuesMap -▸ **concurrentValuesMap**‹**IN**, **OUT**›(`concurrency`: number, `x`: Record‹string, IN›, `mapFn`: function): *Promise‹Record‹string, OUT››* +▸ **concurrentValuesMap**<**IN**, **OUT**>(`concurrency`: number, `x`: Record‹string, IN›, `mapFn`: function): *Promise‹Record‹string, OUT››* *Defined in [packages/sdk/base/src/async.ts:150](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/async.ts#L150)* @@ -101,7 +101,7 @@ ___ ### `Const` retryAsync -▸ **retryAsync**‹**T**, **U**›(`inFunction`: InFunction‹T, U›, `tries`: number, `params`: T, `delay`: number, `logger`: [Logger](_logger_.md#logger) | null): *Promise‹U›* +▸ **retryAsync**<**T**, **U**>(`inFunction`: InFunction‹T, U›, `tries`: number, `params`: T, `delay`: number, `logger`: [Logger](_logger_.md#logger) | null): *Promise‹U›* *Defined in [packages/sdk/base/src/async.ts:14](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/async.ts#L14)* @@ -127,7 +127,7 @@ ___ ### `Const` retryAsyncWithBackOff -▸ **retryAsyncWithBackOff**‹**T**, **U**›(`inFunction`: InFunction‹T, U›, `tries`: number, `params`: T, `delay`: number, `factor`: number, `logger`: [Logger](_logger_.md#logger) | null): *Promise‹U›* +▸ **retryAsyncWithBackOff**<**T**, **U**>(`inFunction`: InFunction‹T, U›, `tries`: number, `params`: T, `delay`: number, `factor`: number, `logger`: [Logger](_logger_.md#logger) | null): *Promise‹U›* *Defined in [packages/sdk/base/src/async.ts:40](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/async.ts#L40)* @@ -154,7 +154,7 @@ ___ ### `Const` retryAsyncWithBackOffAndTimeout -▸ **retryAsyncWithBackOffAndTimeout**‹**T**, **U**›(`inFunction`: InFunction‹T, U›, `tries`: number, `params`: T, `delayMs`: number, `factor`: number, `timeoutMs`: number, `logger`: [Logger](_logger_.md#logger) | null): *Promise‹U›* +▸ **retryAsyncWithBackOffAndTimeout**<**T**, **U**>(`inFunction`: InFunction‹T, U›, `tries`: number, `params`: T, `delayMs`: number, `factor`: number, `timeoutMs`: number, `logger`: [Logger](_logger_.md#logger) | null): *Promise‹U›* *Defined in [packages/sdk/base/src/async.ts:102](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/async.ts#L102)* @@ -182,7 +182,7 @@ ___ ### `Const` selectiveRetryAsyncWithBackOff -▸ **selectiveRetryAsyncWithBackOff**‹**T**, **U**›(`inFunction`: InFunction‹T, U›, `tries`: number, `dontRetry`: string[], `params`: T, `delay`: number, `factor`: number, `logger`: [Logger](_logger_.md#logger) | null): *Promise‹U›* +▸ **selectiveRetryAsyncWithBackOff**<**T**, **U**>(`inFunction`: InFunction‹T, U›, `tries`: number, `dontRetry`: string[], `params`: T, `delay`: number, `factor`: number, `logger`: [Logger](_logger_.md#logger) | null): *Promise‹U›* *Defined in [packages/sdk/base/src/async.ts:68](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/async.ts#L68)* @@ -228,7 +228,7 @@ ___ ### `Const` timeout -▸ **timeout**‹**T**, **U**›(`inFunction`: InFunction‹T, U›, `params`: T, `timeoutMs`: number, `timeoutError`: any, `timeoutLogMsg`: string | null, `logger`: [Logger](_logger_.md#logger) | null): *Promise‹Awaited‹U››* +▸ **timeout**<**T**, **U**>(`inFunction`: InFunction‹T, U›, `params`: T, `timeoutMs`: number, `timeoutError`: any, `timeoutLogMsg`: string | null, `logger`: [Logger](_logger_.md#logger) | null): *Promise‹U›* *Defined in [packages/sdk/base/src/async.ts:173](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/async.ts#L173)* @@ -251,4 +251,4 @@ Name | Type | Default | Description | `timeoutLogMsg` | string | null | null | - | `logger` | [Logger](_logger_.md#logger) | null | null | - | -**Returns:** *Promise‹Awaited‹U››* +**Returns:** *Promise‹U›* diff --git a/packages/docs/sdk/docs/base/modules/_attestations_.md b/packages/docs/sdk/docs/base/modules/_attestations_.md new file mode 100644 index 00000000000..0fbef3c5d22 --- /dev/null +++ b/packages/docs/sdk/docs/base/modules/_attestations_.md @@ -0,0 +1,212 @@ +[@celo/base](../README.md) › ["attestations"](_attestations_.md) + +# Module: "attestations" + +## Index + +### Enumerations + +* [IdentifierType](../enums/_attestations_.identifiertype.md) + +### Interfaces + +* [AttestationsStatus](../interfaces/_attestations_.attestationsstatus.md) + +### Functions + +* [base64ToHex](_attestations_.md#base64tohex) +* [extractAttestationCodeFromMessage](_attestations_.md#extractattestationcodefrommessage) +* [getIdentifierPrefix](_attestations_.md#getidentifierprefix) +* [hashIdentifier](_attestations_.md#hashidentifier) +* [isAccountConsideredVerified](_attestations_.md#isaccountconsideredverified) +* [messageContainsAttestationCode](_attestations_.md#messagecontainsattestationcode) +* [sanitizeMessageBase64](_attestations_.md#sanitizemessagebase64) + +### Object literals + +* [AttestationBase](_attestations_.md#const-attestationbase) + +## Functions + +### base64ToHex + +▸ **base64ToHex**(`base64String`: string): *string* + +*Defined in [packages/sdk/base/src/attestations.ts:36](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/attestations.ts#L36)* + +**Parameters:** + +Name | Type | +------ | ------ | +`base64String` | string | + +**Returns:** *string* + +___ + +### extractAttestationCodeFromMessage + +▸ **extractAttestationCodeFromMessage**(`message`: string): *null | string* + +*Defined in [packages/sdk/base/src/attestations.ts:53](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/attestations.ts#L53)* + +**Parameters:** + +Name | Type | +------ | ------ | +`message` | string | + +**Returns:** *null | string* + +___ + +### getIdentifierPrefix + +▸ **getIdentifierPrefix**(`type`: [IdentifierType](../enums/_attestations_.identifiertype.md)): *string* + +*Defined in [packages/sdk/base/src/attestations.ts:13](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/attestations.ts#L13)* + +**Parameters:** + +Name | Type | +------ | ------ | +`type` | [IdentifierType](../enums/_attestations_.identifiertype.md) | + +**Returns:** *string* + +___ + +### hashIdentifier + +▸ **hashIdentifier**(`sha3`: function, `identifier`: string, `type`: [IdentifierType](../enums/_attestations_.identifiertype.md), `salt?`: undefined | string): *string* + +*Defined in [packages/sdk/base/src/attestations.ts:22](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/attestations.ts#L22)* + +**Parameters:** + +▪ **sha3**: *function* + +▸ (`a`: string): *string | null* + +**Parameters:** + +Name | Type | +------ | ------ | +`a` | string | + +▪ **identifier**: *string* + +▪ **type**: *[IdentifierType](../enums/_attestations_.identifiertype.md)* + +▪`Optional` **salt**: *undefined | string* + +**Returns:** *string* + +___ + +### isAccountConsideredVerified + +▸ **isAccountConsideredVerified**(`stats`: AttestationStat | undefined, `numAttestationsRequired`: number, `attestationThreshold`: number): *[AttestationsStatus](../interfaces/_attestations_.attestationsstatus.md)* + +*Defined in [packages/sdk/base/src/attestations.ts:88](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/attestations.ts#L88)* + +Returns true if an AttestationStat is considered verified using the given factors, +or defaults if factors are ommited. + +**Parameters:** + +Name | Type | Default | Description | +------ | ------ | ------ | ------ | +`stats` | AttestationStat | undefined | - | AttestationStat of the account's attestation identitifer, retrievable via lookupIdentitfiers | +`numAttestationsRequired` | number | DEFAULT_NUM_ATTESTATIONS_REQUIRED | Optional number of attestations required. Will default to hardcoded value if absent. | +`attestationThreshold` | number | DEFAULT_ATTESTATION_THRESHOLD | Optional threshold for fraction attestations completed. Will default to hardcoded value if absent. | + +**Returns:** *[AttestationsStatus](../interfaces/_attestations_.attestationsstatus.md)* + +___ + +### messageContainsAttestationCode + +▸ **messageContainsAttestationCode**(`message`: string): *boolean* + +*Defined in [packages/sdk/base/src/attestations.ts:49](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/attestations.ts#L49)* + +**Parameters:** + +Name | Type | +------ | ------ | +`message` | string | + +**Returns:** *boolean* + +___ + +### sanitizeMessageBase64 + +▸ **sanitizeMessageBase64**(`base64String`: string): *string* + +*Defined in [packages/sdk/base/src/attestations.ts:40](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/attestations.ts#L40)* + +**Parameters:** + +Name | Type | +------ | ------ | +`base64String` | string | + +**Returns:** *string* + +## Object literals + +### `Const` AttestationBase + +### ▪ **AttestationBase**: *object* + +*Defined in [packages/sdk/base/src/attestations.ts:115](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/attestations.ts#L115)* + +### IdentifierType + +• **IdentifierType**: *[IdentifierType](../enums/_attestations_.identifiertype.md)* + +*Defined in [packages/sdk/base/src/attestations.ts:116](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/attestations.ts#L116)* + +### base64ToHex + +• **base64ToHex**: *[base64ToHex](_attestations_.md#base64tohex)* + +*Defined in [packages/sdk/base/src/attestations.ts:119](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/attestations.ts#L119)* + +### extractAttestationCodeFromMessage + +• **extractAttestationCodeFromMessage**: *[extractAttestationCodeFromMessage](_attestations_.md#extractattestationcodefrommessage)* + +*Defined in [packages/sdk/base/src/attestations.ts:122](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/attestations.ts#L122)* + +### getIdentifierPrefix + +• **getIdentifierPrefix**: *[getIdentifierPrefix](_attestations_.md#getidentifierprefix)* + +*Defined in [packages/sdk/base/src/attestations.ts:117](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/attestations.ts#L117)* + +### hashIdentifier + +• **hashIdentifier**: *[hashIdentifier](_attestations_.md#hashidentifier)* + +*Defined in [packages/sdk/base/src/attestations.ts:118](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/attestations.ts#L118)* + +### isAccountConsideredVerified + +• **isAccountConsideredVerified**: *[isAccountConsideredVerified](_attestations_.md#isaccountconsideredverified)* + +*Defined in [packages/sdk/base/src/attestations.ts:123](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/attestations.ts#L123)* + +### messageContainsAttestationCode + +• **messageContainsAttestationCode**: *[messageContainsAttestationCode](_attestations_.md#messagecontainsattestationcode)* + +*Defined in [packages/sdk/base/src/attestations.ts:121](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/attestations.ts#L121)* + +### sanitizeMessageBase64 + +• **sanitizeMessageBase64**: *[sanitizeMessageBase64](_attestations_.md#sanitizemessagebase64)* + +*Defined in [packages/sdk/base/src/attestations.ts:120](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/attestations.ts#L120)* diff --git a/packages/docs/sdk/docs/base/modules/_collections_.md b/packages/docs/sdk/docs/base/modules/_collections_.md index 9e4a538bf15..d909e3a1864 100644 --- a/packages/docs/sdk/docs/base/modules/_collections_.md +++ b/packages/docs/sdk/docs/base/modules/_collections_.md @@ -45,7 +45,7 @@ Name | Type | ### intersection -▸ **intersection**‹**T**›(`arrays`: T[][]): *T[]* +▸ **intersection**<**T**>(`arrays`: T[][]): *T[]* *Defined in [packages/sdk/base/src/collections.ts:32](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/collections.ts#L32)* @@ -65,7 +65,7 @@ ___ ### linkedListChange -▸ **linkedListChange**‹**T**›(`sortedList`: Array‹[AddressListItem](../interfaces/_collections_.addresslistitem.md)‹T››, `change`: [AddressListItem](../interfaces/_collections_.addresslistitem.md)‹T›, `comparator`: [Comparator](_collections_.md#comparator)‹T›): *object* +▸ **linkedListChange**<**T**>(`sortedList`: Array‹[AddressListItem](../interfaces/_collections_.addresslistitem.md)‹T››, `change`: [AddressListItem](../interfaces/_collections_.addresslistitem.md)‹T›, `comparator`: [Comparator](_collections_.md#comparator)‹T›): *object* *Defined in [packages/sdk/base/src/collections.ts:90](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/collections.ts#L90)* @@ -93,7 +93,7 @@ ___ ### linkedListChanges -▸ **linkedListChanges**‹**T**›(`sortedList`: Array‹[AddressListItem](../interfaces/_collections_.addresslistitem.md)‹T››, `changeList`: Array‹[AddressListItem](../interfaces/_collections_.addresslistitem.md)‹T››, `comparator`: [Comparator](_collections_.md#comparator)‹T›): *object* +▸ **linkedListChanges**<**T**>(`sortedList`: Array‹[AddressListItem](../interfaces/_collections_.addresslistitem.md)‹T››, `changeList`: Array‹[AddressListItem](../interfaces/_collections_.addresslistitem.md)‹T››, `comparator`: [Comparator](_collections_.md#comparator)‹T›): *object* *Defined in [packages/sdk/base/src/collections.ts:100](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/collections.ts#L100)* @@ -121,7 +121,7 @@ ___ ### notEmpty -▸ **notEmpty**‹**TValue**›(`value`: TValue | null | undefined): *value is TValue* +▸ **notEmpty**<**TValue**>(`value`: TValue | null | undefined): *value is TValue* *Defined in [packages/sdk/base/src/collections.ts:28](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/collections.ts#L28)* @@ -157,7 +157,7 @@ ___ ### zip -▸ **zip**‹**A**, **B**, **C**›(`fn`: function, `as`: A[], `bs`: B[]): *[zip](_collections_.md#zip)* +▸ **zip**<**A**, **B**, **C**>(`fn`: function, `as`: A[], `bs`: B[]): *C[]* *Defined in [packages/sdk/base/src/collections.ts:3](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/collections.ts#L3)* @@ -186,13 +186,13 @@ Name | Type | ▪ **bs**: *B[]* -**Returns:** *[zip](_collections_.md#zip)* +**Returns:** *C[]* ___ ### zip3 -▸ **zip3**‹**A**, **B**, **C**›(`as`: A[], `bs`: B[], `cs`: C[]): *[zip3](_collections_.md#zip3)* +▸ **zip3**<**A**, **B**, **C**>(`as`: A[], `bs`: B[], `cs`: C[]): *[A, B, C][]* *Defined in [packages/sdk/base/src/collections.ts:13](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/collections.ts#L13)* @@ -212,4 +212,4 @@ Name | Type | `bs` | B[] | `cs` | C[] | -**Returns:** *[zip3](_collections_.md#zip3)* +**Returns:** *[A, B, C][]* diff --git a/packages/docs/sdk/docs/base/modules/_displayformatting_.md b/packages/docs/sdk/docs/base/modules/_displayformatting_.md index be399293dbf..69c0f999f70 100644 --- a/packages/docs/sdk/docs/base/modules/_displayformatting_.md +++ b/packages/docs/sdk/docs/base/modules/_displayformatting_.md @@ -12,7 +12,7 @@ ### getErrorMessage -▸ **getErrorMessage**(`error`: [Error](../classes/_result_.rooterror.md#static-error)): *[getErrorMessage](_displayformatting_.md#geterrormessage)* +▸ **getErrorMessage**(`error`: [Error](../classes/_result_.rooterror.md#static-error)): *string* *Defined in [packages/sdk/base/src/displayFormatting.ts:2](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/displayFormatting.ts#L2)* @@ -24,4 +24,4 @@ Name | Type | ------ | ------ | `error` | [Error](../classes/_result_.rooterror.md#static-error) | -**Returns:** *[getErrorMessage](_displayformatting_.md#geterrormessage)* +**Returns:** *string* diff --git a/packages/docs/sdk/docs/base/modules/_future_.md b/packages/docs/sdk/docs/base/modules/_future_.md index 5906c886f98..a7fdc2efc2d 100644 --- a/packages/docs/sdk/docs/base/modules/_future_.md +++ b/packages/docs/sdk/docs/base/modules/_future_.md @@ -17,7 +17,7 @@ ### pipeToFuture -▸ **pipeToFuture**‹**A**›(`p`: Promise‹A›, `future`: [Future](../classes/_future_.future.md)‹A›): *[Future](../classes/_future_.future.md)‹A›* +▸ **pipeToFuture**<**A**>(`p`: Promise‹A›, `future`: [Future](../classes/_future_.future.md)‹A›): *[Future](../classes/_future_.future.md)‹A›* *Defined in [packages/sdk/base/src/future.ts:51](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/future.ts#L51)* @@ -40,7 +40,7 @@ ___ ### toFuture -▸ **toFuture**‹**A**›(`p`: Promise‹A›): *[Future](../classes/_future_.future.md)‹A›* +▸ **toFuture**<**A**>(`p`: Promise‹A›): *[Future](../classes/_future_.future.md)‹A›* *Defined in [packages/sdk/base/src/future.ts:46](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/future.ts#L46)* diff --git a/packages/docs/sdk/docs/base/modules/_phonenumbers_.md b/packages/docs/sdk/docs/base/modules/_phonenumbers_.md index 1393669c830..8d4ffef6be9 100644 --- a/packages/docs/sdk/docs/base/modules/_phonenumbers_.md +++ b/packages/docs/sdk/docs/base/modules/_phonenumbers_.md @@ -11,6 +11,7 @@ ### Functions * [anonymizedPhone](_phonenumbers_.md#anonymizedphone) +* [getPhoneHash](_phonenumbers_.md#const-getphonehash) * [isE164Number](_phonenumbers_.md#ise164number) ### Object literals @@ -21,9 +22,9 @@ ### anonymizedPhone -▸ **anonymizedPhone**(`phoneNumber`: string): *[anonymizedPhone](_phonenumbers_.md#anonymizedphone)* +▸ **anonymizedPhone**(`phoneNumber`: string): *string* -*Defined in [packages/sdk/base/src/phoneNumbers.ts:15](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/phoneNumbers.ts#L15)* +*Defined in [packages/sdk/base/src/phoneNumbers.ts:31](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/phoneNumbers.ts#L31)* **Parameters:** @@ -31,15 +32,41 @@ Name | Type | ------ | ------ | `phoneNumber` | string | -**Returns:** *[anonymizedPhone](_phonenumbers_.md#anonymizedphone)* +**Returns:** *string* + +___ + +### `Const` getPhoneHash + +▸ **getPhoneHash**(`sha3`: function, `phoneNumber`: string, `salt?`: undefined | string): *string* + +*Defined in [packages/sdk/base/src/phoneNumbers.ts:14](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/phoneNumbers.ts#L14)* + +**Parameters:** + +▪ **sha3**: *function* + +▸ (`a`: string): *string | null* + +**Parameters:** + +Name | Type | +------ | ------ | +`a` | string | + +▪ **phoneNumber**: *string* + +▪`Optional` **salt**: *undefined | string* + +**Returns:** *string* ___ ### isE164Number -▸ **isE164Number**(`phoneNumber`: string): *[isE164Number](_phonenumbers_.md#ise164number)* +▸ **isE164Number**(`phoneNumber`: string): *boolean* -*Defined in [packages/sdk/base/src/phoneNumbers.ts:11](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/phoneNumbers.ts#L11)* +*Defined in [packages/sdk/base/src/phoneNumbers.ts:27](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/phoneNumbers.ts#L27)* **Parameters:** @@ -47,7 +74,7 @@ Name | Type | ------ | ------ | `phoneNumber` | string | -**Returns:** *[isE164Number](_phonenumbers_.md#ise164number)* +**Returns:** *boolean* ## Object literals @@ -55,10 +82,16 @@ Name | Type | ### ▪ **PhoneNumberBase**: *object* -*Defined in [packages/sdk/base/src/phoneNumbers.ts:19](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/phoneNumbers.ts#L19)* +*Defined in [packages/sdk/base/src/phoneNumbers.ts:35](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/phoneNumbers.ts#L35)* + +### getPhoneHash + +• **getPhoneHash**: *getPhoneHash* + +*Defined in [packages/sdk/base/src/phoneNumbers.ts:36](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/phoneNumbers.ts#L36)* ### isE164Number • **isE164Number**: *[isE164Number](_phonenumbers_.md#ise164number)* -*Defined in [packages/sdk/base/src/phoneNumbers.ts:20](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/phoneNumbers.ts#L20)* +*Defined in [packages/sdk/base/src/phoneNumbers.ts:37](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/phoneNumbers.ts#L37)* diff --git a/packages/docs/sdk/docs/base/modules/_result_.md b/packages/docs/sdk/docs/base/modules/_result_.md index fc1cc74302a..6903d33c62f 100644 --- a/packages/docs/sdk/docs/base/modules/_result_.md +++ b/packages/docs/sdk/docs/base/modules/_result_.md @@ -54,7 +54,7 @@ ### `Const` Err -▸ **Err**‹**TError**›(`error`: TError): *[ErrorResult](../interfaces/_result_.errorresult.md)‹TError›* +▸ **Err**<**TError**>(`error`: TError): *[ErrorResult](../interfaces/_result_.errorresult.md)‹TError›* *Defined in [packages/sdk/base/src/result.ts:16](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/result.ts#L16)* @@ -74,7 +74,7 @@ ___ ### `Const` Ok -▸ **Ok**‹**TResult**›(`result`: TResult): *[OkResult](../interfaces/_result_.okresult.md)‹TResult›* +▸ **Ok**<**TResult**>(`result`: TResult): *[OkResult](../interfaces/_result_.okresult.md)‹TResult›* *Defined in [packages/sdk/base/src/result.ts:12](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/result.ts#L12)* @@ -94,7 +94,7 @@ ___ ### isErr -▸ **isErr**‹**TResult**, **TError**›(`result`: [Result](_result_.md#result)‹TResult, TError›): *result is ErrorResult‹TError›* +▸ **isErr**<**TResult**, **TError**>(`result`: [Result](_result_.md#result)‹TResult, TError›): *result is ErrorResult* *Defined in [packages/sdk/base/src/result.ts:98](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/result.ts#L98)* @@ -110,13 +110,13 @@ Name | Type | ------ | ------ | `result` | [Result](_result_.md#result)‹TResult, TError› | -**Returns:** *result is ErrorResult‹TError›* +**Returns:** *result is ErrorResult* ___ ### isOk -▸ **isOk**‹**TResult**, **TError**›(`result`: [Result](_result_.md#result)‹TResult, TError›): *result is OkResult‹TResult›* +▸ **isOk**<**TResult**, **TError**>(`result`: [Result](_result_.md#result)‹TResult, TError›): *result is OkResult* *Defined in [packages/sdk/base/src/result.ts:92](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/result.ts#L92)* @@ -132,13 +132,13 @@ Name | Type | ------ | ------ | `result` | [Result](_result_.md#result)‹TResult, TError› | -**Returns:** *result is OkResult‹TResult›* +**Returns:** *result is OkResult* ___ ### makeAsyncThrowable -▸ **makeAsyncThrowable**‹**TArgs**, **TResult**, **TError**, **TModifiedError**›(`f`: function, `errorModifier?`: undefined | function): *[makeAsyncThrowable](_result_.md#makeasyncthrowable)* +▸ **makeAsyncThrowable**<**TArgs**, **TResult**, **TError**, **TModifiedError**>(`f`: function, `errorModifier?`: undefined | function): *(Anonymous function)* *Defined in [packages/sdk/base/src/result.ts:47](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/result.ts#L47)* @@ -166,13 +166,13 @@ Name | Type | ▪`Optional` **errorModifier**: *undefined | function* -**Returns:** *[makeAsyncThrowable](_result_.md#makeasyncthrowable)* +**Returns:** *(Anonymous function)* ___ ### makeThrowable -▸ **makeThrowable**‹**TArgs**, **TResult**, **TError**, **TModifiedError**›(`f`: function, `errorModifier?`: undefined | function): *[makeThrowable](_result_.md#makethrowable)* +▸ **makeThrowable**<**TArgs**, **TResult**, **TError**, **TModifiedError**>(`f`: function, `errorModifier?`: undefined | function): *(Anonymous function)* *Defined in [packages/sdk/base/src/result.ts:35](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/result.ts#L35)* @@ -200,13 +200,13 @@ Name | Type | ▪`Optional` **errorModifier**: *undefined | function* -**Returns:** *[makeThrowable](_result_.md#makethrowable)* +**Returns:** *(Anonymous function)* ___ ### parseJsonAsResult -▸ **parseJsonAsResult**(`data`: string): *[parseJsonAsResult](_result_.md#parsejsonasresult)* +▸ **parseJsonAsResult**(`data`: string): *[OkResult](../interfaces/_result_.okresult.md)‹any› | [ErrorResult](../interfaces/_result_.errorresult.md)‹[JSONParseError](../classes/_result_.jsonparseerror.md)‹››* *Defined in [packages/sdk/base/src/result.ts:84](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/result.ts#L84)* @@ -216,13 +216,13 @@ Name | Type | ------ | ------ | `data` | string | -**Returns:** *[parseJsonAsResult](_result_.md#parsejsonasresult)* +**Returns:** *[OkResult](../interfaces/_result_.okresult.md)‹any› | [ErrorResult](../interfaces/_result_.errorresult.md)‹[JSONParseError](../classes/_result_.jsonparseerror.md)‹››* ___ ### throwIfError -▸ **throwIfError**‹**TResult**, **TError**, **TModifiedError**›(`result`: [Result](_result_.md#result)‹TResult, TError›, `errorModifier?`: undefined | function): *[throwIfError](_result_.md#throwiferror)* +▸ **throwIfError**<**TResult**, **TError**, **TModifiedError**>(`result`: [Result](_result_.md#result)‹TResult, TError›, `errorModifier?`: undefined | function): *TResult* *Defined in [packages/sdk/base/src/result.ts:21](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/result.ts#L21)* @@ -241,4 +241,4 @@ Name | Type | `result` | [Result](_result_.md#result)‹TResult, TError› | `errorModifier?` | undefined | function | -**Returns:** *[throwIfError](_result_.md#throwiferror)* +**Returns:** *TResult* diff --git a/packages/docs/sdk/docs/base/modules/_signatureutils_.md b/packages/docs/sdk/docs/base/modules/_signatureutils_.md index 5fcd9bef906..2c06fe910db 100644 --- a/packages/docs/sdk/docs/base/modules/_signatureutils_.md +++ b/packages/docs/sdk/docs/base/modules/_signatureutils_.md @@ -59,9 +59,9 @@ ___ ### serializeSignature -▸ **serializeSignature**(`signature`: [Signature](../interfaces/_signatureutils_.signature.md)): *[serializeSignature](_signatureutils_.md#serializesignature)* +▸ **serializeSignature**(`signature`: [Signature](../interfaces/_signatureutils_.signature.md)): *string* -*Defined in [packages/sdk/base/src/signatureUtils.ts:26](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/signatureUtils.ts#L26)* +*Defined in [packages/sdk/base/src/signatureUtils.ts:25](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/signatureUtils.ts#L25)* **Parameters:** @@ -69,7 +69,7 @@ Name | Type | ------ | ------ | `signature` | [Signature](../interfaces/_signatureutils_.signature.md) | -**Returns:** *[serializeSignature](_signatureutils_.md#serializesignature)* +**Returns:** *string* ## Object literals @@ -77,16 +77,16 @@ Name | Type | ### ▪ **SignatureBase**: *object* -*Defined in [packages/sdk/base/src/signatureUtils.ts:33](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/signatureUtils.ts#L33)* +*Defined in [packages/sdk/base/src/signatureUtils.ts:32](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/signatureUtils.ts#L32)* ### NativeSigner • **NativeSigner**: *[NativeSigner](_signatureutils_.md#nativesigner)* -*Defined in [packages/sdk/base/src/signatureUtils.ts:34](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/signatureUtils.ts#L34)* +*Defined in [packages/sdk/base/src/signatureUtils.ts:33](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/signatureUtils.ts#L33)* ### serializeSignature • **serializeSignature**: *[serializeSignature](_signatureutils_.md#serializesignature)* -*Defined in [packages/sdk/base/src/signatureUtils.ts:35](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/signatureUtils.ts#L35)* +*Defined in [packages/sdk/base/src/signatureUtils.ts:34](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/signatureUtils.ts#L34)* diff --git a/packages/docs/sdk/docs/base/modules/_string_.md b/packages/docs/sdk/docs/base/modules/_string_.md index c03d5325959..ba23bf34722 100644 --- a/packages/docs/sdk/docs/base/modules/_string_.md +++ b/packages/docs/sdk/docs/base/modules/_string_.md @@ -17,7 +17,7 @@ ### appendPath -▸ **appendPath**(`baseUrl`: string, `path`: string): *[appendPath](_string_.md#appendpath)* +▸ **appendPath**(`baseUrl`: string, `path`: string): *string* *Defined in [packages/sdk/base/src/string.ts:1](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/string.ts#L1)* @@ -28,13 +28,13 @@ Name | Type | `baseUrl` | string | `path` | string | -**Returns:** *[appendPath](_string_.md#appendpath)* +**Returns:** *string* ___ ### normalizeAccents -▸ **normalizeAccents**(`str`: string): *[normalizeAccents](_string_.md#normalizeaccents)* +▸ **normalizeAccents**(`str`: string): *string* *Defined in [packages/sdk/base/src/string.ts:10](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/string.ts#L10)* @@ -44,7 +44,7 @@ Name | Type | ------ | ------ | `str` | string | -**Returns:** *[normalizeAccents](_string_.md#normalizeaccents)* +**Returns:** *string* ## Object literals diff --git a/packages/docs/sdk/docs/base/modules/_task_.md b/packages/docs/sdk/docs/base/modules/_task_.md index 1af1d68258d..f8c00f291b7 100644 --- a/packages/docs/sdk/docs/base/modules/_task_.md +++ b/packages/docs/sdk/docs/base/modules/_task_.md @@ -66,7 +66,7 @@ ___ ### tryObtainValueWithRetries -▸ **tryObtainValueWithRetries**‹**A**›(`opts`: [RetryTaskOptions](../interfaces/_task_.retrytaskoptions.md)‹A›): *[RunningTaskWithValue](../interfaces/_task_.runningtaskwithvalue.md)‹A›* +▸ **tryObtainValueWithRetries**<**A**>(`opts`: [RetryTaskOptions](../interfaces/_task_.retrytaskoptions.md)‹A›): *[RunningTaskWithValue](../interfaces/_task_.runningtaskwithvalue.md)‹A›* *Defined in [packages/sdk/base/src/task.ts:128](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/base/src/task.ts#L128)* diff --git a/packages/docs/sdk/docs/connect/classes/_celo_provider_.celoprovider.md b/packages/docs/sdk/docs/connect/classes/_celo_provider_.celoprovider.md index 76430ff7d79..14cd40b8b7a 100644 --- a/packages/docs/sdk/docs/connect/classes/_celo_provider_.celoprovider.md +++ b/packages/docs/sdk/docs/connect/classes/_celo_provider_.celoprovider.md @@ -41,7 +41,7 @@ \+ **new CeloProvider**(`existingProvider`: [Provider](../interfaces/_types_.provider.md), `connection`: [Connection](_connection_.connection.md)): *[CeloProvider](_celo_provider_.celoprovider.md)* -*Defined in [celo-provider.ts:51](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/celo-provider.ts#L51)* +*Defined in [celo-provider.ts:40](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/celo-provider.ts#L40)* **Parameters:** @@ -58,7 +58,7 @@ Name | Type | • **connection**: *[Connection](_connection_.connection.md)* -*Defined in [celo-provider.ts:53](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/celo-provider.ts#L53)* +*Defined in [celo-provider.ts:42](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/celo-provider.ts#L42)* ___ @@ -66,7 +66,7 @@ ___ • **existingProvider**: *[Provider](../interfaces/_types_.provider.md)* -*Defined in [celo-provider.ts:53](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/celo-provider.ts#L53)* +*Defined in [celo-provider.ts:42](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/celo-provider.ts#L42)* ## Accessors @@ -74,7 +74,7 @@ ___ • **get connected**(): *any* -*Defined in [celo-provider.ts:260](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/celo-provider.ts#L260)* +*Defined in [celo-provider.ts:245](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/celo-provider.ts#L245)* **Returns:** *any* @@ -84,7 +84,7 @@ ___ ▸ **addAccount**(`privateKey`: string): *void* -*Defined in [celo-provider.ts:58](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/celo-provider.ts#L58)* +*Defined in [celo-provider.ts:47](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/celo-provider.ts#L47)* **Parameters:** @@ -100,7 +100,7 @@ ___ ▸ **getAccounts**(): *Promise‹string[]›* -*Defined in [celo-provider.ts:68](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/celo-provider.ts#L68)* +*Defined in [celo-provider.ts:57](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/celo-provider.ts#L57)* **Returns:** *Promise‹string[]›* @@ -110,7 +110,7 @@ ___ ▸ **isLocalAccount**(`address?`: undefined | string): *boolean* -*Defined in [celo-provider.ts:72](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/celo-provider.ts#L72)* +*Defined in [celo-provider.ts:61](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/celo-provider.ts#L61)* **Parameters:** @@ -126,7 +126,7 @@ ___ ▸ **removeAccount**(`address`: string): *void* -*Defined in [celo-provider.ts:63](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/celo-provider.ts#L63)* +*Defined in [celo-provider.ts:52](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/celo-provider.ts#L52)* **Parameters:** @@ -142,7 +142,9 @@ ___ ▸ **send**(`payload`: [JsonRpcPayload](../interfaces/_types_.jsonrpcpayload.md), `callback`: [Callback](../modules/_types_.md#callback)‹[JsonRpcResponse](../interfaces/_types_.jsonrpcresponse.md)›): *void* -*Defined in [celo-provider.ts:79](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/celo-provider.ts#L79)* +*Implementation of [Provider](../interfaces/_types_.provider.md)* + +*Defined in [celo-provider.ts:68](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/celo-provider.ts#L68)* Send method as expected by web3.js @@ -161,7 +163,7 @@ ___ ▸ **stop**(): *void* -*Defined in [celo-provider.ts:158](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/celo-provider.ts#L158)* +*Defined in [celo-provider.ts:143](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/celo-provider.ts#L143)* **Returns:** *void* @@ -171,6 +173,6 @@ ___ ▸ **supportsSubscriptions**(): *any* -*Defined in [celo-provider.ts:264](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/celo-provider.ts#L264)* +*Defined in [celo-provider.ts:249](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/celo-provider.ts#L249)* **Returns:** *any* diff --git a/packages/docs/sdk/docs/connect/classes/_connection_.connection.md b/packages/docs/sdk/docs/connect/classes/_connection_.connection.md index 1e1819f7275..965522cae63 100644 --- a/packages/docs/sdk/docs/connect/classes/_connection_.connection.md +++ b/packages/docs/sdk/docs/connect/classes/_connection_.connection.md @@ -32,6 +32,7 @@ Connection is a Class for connecting to Celo, sending Transactions, etc * [defaultAccount](_connection_.connection.md#defaultaccount) * [defaultFeeCurrency](_connection_.connection.md#defaultfeecurrency) * [defaultGasInflationFactor](_connection_.connection.md#defaultgasinflationfactor) +* [defaultGasPrice](_connection_.connection.md#defaultgasprice) ### Methods @@ -40,6 +41,7 @@ Connection is a Class for connecting to Celo, sending Transactions, etc * [coinbase](_connection_.connection.md#coinbase) * [estimateGas](_connection_.connection.md#estimategas) * [estimateGasWithInflationFactor](_connection_.connection.md#estimategaswithinflationfactor) +* [fillGasPrice](_connection_.connection.md#fillgasprice) * [gasPrice](_connection_.connection.md#gasprice) * [getAbiCoder](_connection_.connection.md#getabicoder) * [getAccounts](_connection_.connection.md#getaccounts) @@ -62,7 +64,7 @@ Connection is a Class for connecting to Celo, sending Transactions, etc * [sendSignedTransaction](_connection_.connection.md#sendsignedtransaction) * [sendTransaction](_connection_.connection.md#sendtransaction) * [sendTransactionObject](_connection_.connection.md#sendtransactionobject) -* [setFeeMarketGas](_connection_.connection.md#setfeemarketgas) +* [setGasPriceForCurrency](_connection_.connection.md#setgaspriceforcurrency) * [setProvider](_connection_.connection.md#setprovider) * [sign](_connection_.connection.md#sign) * [signTypedData](_connection_.connection.md#signtypeddata) @@ -74,7 +76,7 @@ Connection is a Class for connecting to Celo, sending Transactions, etc \+ **new Connection**(`web3`: Web3, `wallet?`: [ReadOnlyWallet](../interfaces/_wallet_.readonlywallet.md), `handleRevert`: boolean): *[Connection](_connection_.connection.md)* -*Defined in [connection.ts:60](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L60)* +*Defined in [connection.ts:61](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L61)* **Parameters:** @@ -92,7 +94,7 @@ Name | Type | Default | • **paramsPopulator**: *[TxParamsNormalizer](_utils_tx_params_normalizer_.txparamsnormalizer.md)* -*Defined in [connection.ts:59](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L59)* +*Defined in [connection.ts:57](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L57)* ___ @@ -100,7 +102,7 @@ ___ • **rpcCaller**: *[RpcCaller](../interfaces/_utils_rpc_caller_.rpccaller.md)* -*Defined in [connection.ts:60](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L60)* +*Defined in [connection.ts:58](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L58)* ___ @@ -108,7 +110,7 @@ ___ • **wallet**? : *[ReadOnlyWallet](../interfaces/_wallet_.readonlywallet.md)* -*Defined in [connection.ts:62](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L62)* +*Defined in [connection.ts:63](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L63)* ___ @@ -116,7 +118,7 @@ ___ • **web3**: *Web3* -*Defined in [connection.ts:62](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L62)* +*Defined in [connection.ts:63](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L63)* ## Accessors @@ -124,7 +126,7 @@ ___ • **get defaultAccount**(): *[Address](../modules/_types_.md#address) | undefined* -*Defined in [connection.ts:114](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L114)* +*Defined in [connection.ts:115](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L115)* Default account for generated transactions (eg. tx.from) @@ -132,7 +134,7 @@ Default account for generated transactions (eg. tx.from) • **set defaultAccount**(`address`: [Address](../modules/_types_.md#address) | undefined): *void* -*Defined in [connection.ts:106](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L106)* +*Defined in [connection.ts:107](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L107)* Set default account for generated transactions (eg. tx.from ) @@ -150,7 +152,7 @@ ___ • **get defaultFeeCurrency**(): *undefined | string* -*Defined in [connection.ts:138](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L138)* +*Defined in [connection.ts:147](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L147)* Set the ERC20 address for the token to use to pay for transaction fees. The ERC20 must be whitelisted for gas. @@ -161,7 +163,7 @@ Set to `null` to use CELO • **set defaultFeeCurrency**(`address`: [Address](../modules/_types_.md#address) | undefined): *void* -*Defined in [connection.ts:134](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L134)* +*Defined in [connection.ts:143](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L143)* Set the ERC20 address for the token to use to pay for transaction fees. The ERC20 must be whitelisted for gas. @@ -182,13 +184,13 @@ ___ • **get defaultGasInflationFactor**(): *number* -*Defined in [connection.ts:122](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L122)* +*Defined in [connection.ts:123](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L123)* **Returns:** *number* • **set defaultGasInflationFactor**(`factor`: number): *void* -*Defined in [connection.ts:118](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L118)* +*Defined in [connection.ts:119](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L119)* **Parameters:** @@ -198,13 +200,35 @@ Name | Type | **Returns:** *void* +___ + +### defaultGasPrice + +• **get defaultGasPrice**(): *number* + +*Defined in [connection.ts:131](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L131)* + +**Returns:** *number* + +• **set defaultGasPrice**(`price`: number): *void* + +*Defined in [connection.ts:127](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L127)* + +**Parameters:** + +Name | Type | +------ | ------ | +`price` | number | + +**Returns:** *void* + ## Methods ### addAccount ▸ **addAccount**(`privateKey`: string): *void* -*Defined in [connection.ts:146](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L146)* +*Defined in [connection.ts:155](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L155)* **Parameters:** @@ -220,7 +244,7 @@ ___ ▸ **chainId**(): *Promise‹number›* -*Defined in [connection.ts:404](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L404)* +*Defined in [connection.ts:388](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L388)* **Returns:** *Promise‹number›* @@ -230,7 +254,7 @@ ___ ▸ **coinbase**(): *Promise‹string›* -*Defined in [connection.ts:426](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L426)* +*Defined in [connection.ts:405](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L405)* **Returns:** *Promise‹string›* @@ -240,7 +264,7 @@ ___ ▸ **estimateGas**(`tx`: [CeloTx](../modules/_types_.md#celotx), `gasEstimator`: function, `caller`: function): *Promise‹number›* -*Defined in [connection.ts:356](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L356)* +*Defined in [connection.ts:341](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L341)* **Parameters:** @@ -274,7 +298,7 @@ ___ ▸ **estimateGasWithInflationFactor**(`tx`: [CeloTx](../modules/_types_.md#celotx), `gasEstimator?`: undefined | function, `caller?`: undefined | function): *Promise‹number›* -*Defined in [connection.ts:387](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L387)* +*Defined in [connection.ts:372](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L372)* **Parameters:** @@ -288,11 +312,29 @@ Name | Type | ___ +### fillGasPrice + +▸ **fillGasPrice**(`tx`: [CeloTx](../modules/_types_.md#celotx)): *[CeloTx](../modules/_types_.md#celotx)* + +*Defined in [connection.ts:327](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L327)* + +**`deprecated`** no longer needed since gasPrice is available on node rpc + +**Parameters:** + +Name | Type | +------ | ------ | +`tx` | [CeloTx](../modules/_types_.md#celotx) | + +**Returns:** *[CeloTx](../modules/_types_.md#celotx)* + +___ + ### gasPrice ▸ **gasPrice**(`feeCurrency?`: [Address](../modules/_types_.md#address)): *Promise‹string›* -*Defined in [connection.ts:432](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L432)* +*Defined in [connection.ts:411](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L411)* **Parameters:** @@ -308,7 +350,7 @@ ___ ▸ **getAbiCoder**(): *[AbiCoder](../interfaces/_abi_types_.abicoder.md)* -*Defined in [connection.ts:383](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L383)* +*Defined in [connection.ts:368](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L368)* **Returns:** *[AbiCoder](../interfaces/_abi_types_.abicoder.md)* @@ -318,7 +360,7 @@ ___ ▸ **getAccounts**(): *Promise‹string[]›* -*Defined in [connection.ts:179](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L179)* +*Defined in [connection.ts:188](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L188)* **Returns:** *Promise‹string[]›* @@ -328,7 +370,7 @@ ___ ▸ **getBalance**(`address`: [Address](../modules/_types_.md#address), `defaultBlock?`: [BlockNumber](../modules/_types_.md#blocknumber)): *Promise‹string›* -*Defined in [connection.ts:475](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L475)* +*Defined in [connection.ts:458](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L458)* **Parameters:** @@ -345,7 +387,7 @@ ___ ▸ **getBlock**(`blockHashOrBlockNumber`: [BlockNumber](../modules/_types_.md#blocknumber), `fullTxObjects`: boolean): *Promise‹Block›* -*Defined in [connection.ts:450](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L450)* +*Defined in [connection.ts:430](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L430)* **Parameters:** @@ -362,7 +404,7 @@ ___ ▸ **getBlockHeader**(`blockHashOrBlockNumber`: [BlockNumber](../modules/_types_.md#blocknumber)): *Promise‹BlockHeader›* -*Defined in [connection.ts:463](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L463)* +*Defined in [connection.ts:446](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L446)* **Parameters:** @@ -378,7 +420,7 @@ ___ ▸ **getBlockNumber**(): *Promise‹number›* -*Defined in [connection.ts:441](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L441)* +*Defined in [connection.ts:421](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L421)* **Returns:** *Promise‹number›* @@ -388,7 +430,7 @@ ___ ▸ **getLocalAccounts**(): *string[]* -*Defined in [connection.ts:175](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L175)* +*Defined in [connection.ts:184](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L184)* **Returns:** *string[]* @@ -398,7 +440,7 @@ ___ ▸ **getNodeAccounts**(): *Promise‹string[]›* -*Defined in [connection.ts:170](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L170)* +*Defined in [connection.ts:179](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L179)* **Returns:** *Promise‹string[]›* @@ -408,7 +450,7 @@ ___ ▸ **getTransaction**(`transactionHash`: string): *Promise‹[CeloTxPending](../modules/_types_.md#celotxpending)›* -*Defined in [connection.ts:484](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L484)* +*Defined in [connection.ts:467](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L467)* **Parameters:** @@ -424,7 +466,7 @@ ___ ▸ **getTransactionCount**(`address`: [Address](../modules/_types_.md#address)): *Promise‹number›* -*Defined in [connection.ts:415](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L415)* +*Defined in [connection.ts:394](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L394)* **Parameters:** @@ -440,7 +482,7 @@ ___ ▸ **getTransactionReceipt**(`txhash`: string): *Promise‹[CeloTxReceipt](../modules/_types_.md#celotxreceipt) | null›* -*Defined in [connection.ts:492](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L492)* +*Defined in [connection.ts:475](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L475)* **Parameters:** @@ -456,7 +498,7 @@ ___ ▸ **hexToAscii**(`hex`: string): *string* -*Defined in [connection.ts:99](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L99)* +*Defined in [connection.ts:100](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L100)* **Parameters:** @@ -472,7 +514,7 @@ ___ ▸ **isListening**(): *Promise‹boolean›* -*Defined in [connection.ts:187](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L187)* +*Defined in [connection.ts:196](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L196)* **Returns:** *Promise‹boolean›* @@ -482,7 +524,7 @@ ___ ▸ **isLocalAccount**(`address?`: [Address](../modules/_types_.md#address)): *boolean* -*Defined in [connection.ts:142](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L142)* +*Defined in [connection.ts:151](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L151)* **Parameters:** @@ -498,7 +540,7 @@ ___ ▸ **isSyncing**(): *Promise‹boolean›* -*Defined in [connection.ts:191](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L191)* +*Defined in [connection.ts:200](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L200)* **Returns:** *Promise‹boolean›* @@ -508,7 +550,7 @@ ___ ▸ **keccak256**(`value`: string | BN): *string* -*Defined in [connection.ts:95](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L95)* +*Defined in [connection.ts:96](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L96)* **Parameters:** @@ -524,7 +566,7 @@ ___ ▸ **nonce**(`address`: [Address](../modules/_types_.md#address)): *Promise‹number›* -*Defined in [connection.ts:422](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L422)* +*Defined in [connection.ts:401](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L401)* **Parameters:** @@ -540,7 +582,7 @@ ___ ▸ **removeAccount**(`address`: string): *void* -*Defined in [connection.ts:158](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L158)* +*Defined in [connection.ts:167](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L167)* **Parameters:** @@ -556,7 +598,7 @@ ___ ▸ **sendSignedTransaction**(`signedTransactionData`: string): *Promise‹[TransactionResult](_utils_tx_result_.transactionresult.md)›* -*Defined in [connection.ts:329](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L329)* +*Defined in [connection.ts:322](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L322)* **Parameters:** @@ -572,7 +614,7 @@ ___ ▸ **sendTransaction**(`tx`: [CeloTx](../modules/_types_.md#celotx)): *Promise‹[TransactionResult](_utils_tx_result_.transactionresult.md)›* -*Defined in [connection.ts:215](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L215)* +*Defined in [connection.ts:224](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L224)* Send a transaction to celo-blockchain. @@ -595,7 +637,7 @@ ___ ▸ **sendTransactionObject**(`txObj`: [CeloTxObject](../interfaces/_types_.celotxobject.md)‹any›, `tx?`: Omit‹[CeloTx](../modules/_types_.md#celotx), "data"›): *Promise‹[TransactionResult](_utils_tx_result_.transactionresult.md)›* -*Defined in [connection.ts:231](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L231)* +*Defined in [connection.ts:241](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L241)* **Parameters:** @@ -608,19 +650,22 @@ Name | Type | ___ -### setFeeMarketGas +### setGasPriceForCurrency + +▸ **setGasPriceForCurrency**(`address`: [Address](../modules/_types_.md#address), `gasPrice`: string): *Promise‹void›* -▸ **setFeeMarketGas**(`tx`: [CeloTx](../modules/_types_.md#celotx)): *Promise‹[CeloTx](../modules/_types_.md#celotx)›* +*Defined in [connection.ts:337](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L337)* -*Defined in [connection.ts:333](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L333)* +**`deprecated`** no longer needed since gasPrice is available on node rpc **Parameters:** Name | Type | ------ | ------ | -`tx` | [CeloTx](../modules/_types_.md#celotx) | +`address` | [Address](../modules/_types_.md#address) | +`gasPrice` | string | -**Returns:** *Promise‹[CeloTx](../modules/_types_.md#celotx)›* +**Returns:** *Promise‹void›* ___ @@ -628,7 +673,7 @@ ___ ▸ **setProvider**(`provider`: [Provider](../interfaces/_types_.provider.md)): *boolean* -*Defined in [connection.ts:77](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L77)* +*Defined in [connection.ts:80](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L80)* **Parameters:** @@ -644,7 +689,7 @@ ___ ▸ **sign**(`dataToSign`: string, `address`: [Address](../modules/_types_.md#address) | number): *Promise‹string›* -*Defined in [connection.ts:302](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L302)* +*Defined in [connection.ts:295](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L295)* **Parameters:** @@ -659,9 +704,9 @@ ___ ### signTypedData -▸ **signTypedData**(`signer`: string, `typedData`: EIP712TypedData, `version?`: 1 | 3 | 4 | 5): *Promise‹Signature›* +▸ **signTypedData**(`signer`: string, `typedData`: EIP712TypedData): *Promise‹Signature›* -*Defined in [connection.ts:263](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L263)* +*Defined in [connection.ts:267](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L267)* **Parameters:** @@ -669,7 +714,6 @@ Name | Type | ------ | ------ | `signer` | string | `typedData` | EIP712TypedData | -`version?` | 1 | 3 | 4 | 5 | **Returns:** *Promise‹Signature›* @@ -679,6 +723,6 @@ ___ ▸ **stop**(): *void* -*Defined in [connection.ts:517](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L517)* +*Defined in [connection.ts:501](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L501)* **Returns:** *void* diff --git a/packages/docs/sdk/docs/connect/classes/_utils_celo_transaction_object_.celotransactionobject.md b/packages/docs/sdk/docs/connect/classes/_utils_celo_transaction_object_.celotransactionobject.md index 94325aba3a8..074965bcc3e 100644 --- a/packages/docs/sdk/docs/connect/classes/_utils_celo_transaction_object_.celotransactionobject.md +++ b/packages/docs/sdk/docs/connect/classes/_utils_celo_transaction_object_.celotransactionobject.md @@ -1,6 +1,6 @@ [@celo/connect](../README.md) › [Globals](../globals.md) › ["utils/celo-transaction-object"](../modules/_utils_celo_transaction_object_.md) › [CeloTransactionObject](_utils_celo_transaction_object_.celotransactionobject.md) -# Class: CeloTransactionObject ‹**O**› +# Class: CeloTransactionObject <**O**> ## Type parameters diff --git a/packages/docs/sdk/docs/connect/classes/_utils_rpc_caller_.defaultrpccaller.md b/packages/docs/sdk/docs/connect/classes/_utils_rpc_caller_.defaultrpccaller.md new file mode 100644 index 00000000000..4f2f924288e --- /dev/null +++ b/packages/docs/sdk/docs/connect/classes/_utils_rpc_caller_.defaultrpccaller.md @@ -0,0 +1,94 @@ +[@celo/connect](../README.md) › [Globals](../globals.md) › ["utils/rpc-caller"](../modules/_utils_rpc_caller_.md) › [DefaultRpcCaller](_utils_rpc_caller_.defaultrpccaller.md) + +# Class: DefaultRpcCaller + +## Hierarchy + +* **DefaultRpcCaller** + +## Implements + +* [RpcCaller](../interfaces/_utils_rpc_caller_.rpccaller.md) + +## Index + +### Constructors + +* [constructor](_utils_rpc_caller_.defaultrpccaller.md#constructor) + +### Properties + +* [defaultProvider](_utils_rpc_caller_.defaultrpccaller.md#readonly-defaultprovider) +* [jsonrpcVersion](_utils_rpc_caller_.defaultrpccaller.md#readonly-jsonrpcversion) + +### Methods + +* [call](_utils_rpc_caller_.defaultrpccaller.md#call) +* [send](_utils_rpc_caller_.defaultrpccaller.md#send) + +## Constructors + +### constructor + +\+ **new DefaultRpcCaller**(`defaultProvider`: [Provider](../interfaces/_types_.provider.md), `jsonrpcVersion`: string): *[DefaultRpcCaller](_utils_rpc_caller_.defaultrpccaller.md)* + +*Defined in [utils/rpc-caller.ts:67](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/rpc-caller.ts#L67)* + +**Parameters:** + +Name | Type | Default | +------ | ------ | ------ | +`defaultProvider` | [Provider](../interfaces/_types_.provider.md) | - | +`jsonrpcVersion` | string | "2.0" | + +**Returns:** *[DefaultRpcCaller](_utils_rpc_caller_.defaultrpccaller.md)* + +## Properties + +### `Readonly` defaultProvider + +• **defaultProvider**: *[Provider](../interfaces/_types_.provider.md)* + +*Defined in [utils/rpc-caller.ts:68](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/rpc-caller.ts#L68)* + +___ + +### `Readonly` jsonrpcVersion + +• **jsonrpcVersion**: *string* + +*Defined in [utils/rpc-caller.ts:68](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/rpc-caller.ts#L68)* + +## Methods + +### call + +▸ **call**(`method`: string, `params`: any[]): *Promise‹[JsonRpcResponse](../interfaces/_types_.jsonrpcresponse.md)›* + +*Defined in [utils/rpc-caller.ts:70](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/rpc-caller.ts#L70)* + +**Parameters:** + +Name | Type | +------ | ------ | +`method` | string | +`params` | any[] | + +**Returns:** *Promise‹[JsonRpcResponse](../interfaces/_types_.jsonrpcresponse.md)›* + +___ + +### send + +▸ **send**(`payload`: [JsonRpcPayload](../interfaces/_types_.jsonrpcpayload.md), `callback`: [Callback](../modules/_types_.md#callback)‹[JsonRpcResponse](../interfaces/_types_.jsonrpcresponse.md)›): *void* + +*Defined in [utils/rpc-caller.ts:88](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/rpc-caller.ts#L88)* + +**Parameters:** + +Name | Type | +------ | ------ | +`payload` | [JsonRpcPayload](../interfaces/_types_.jsonrpcpayload.md) | +`callback` | [Callback](../modules/_types_.md#callback)‹[JsonRpcResponse](../interfaces/_types_.jsonrpcresponse.md)› | + +**Returns:** *void* diff --git a/packages/docs/sdk/docs/connect/classes/_utils_rpc_caller_.httprpccaller.md b/packages/docs/sdk/docs/connect/classes/_utils_rpc_caller_.httprpccaller.md deleted file mode 100644 index 08dbe683899..00000000000 --- a/packages/docs/sdk/docs/connect/classes/_utils_rpc_caller_.httprpccaller.md +++ /dev/null @@ -1,102 +0,0 @@ -[@celo/connect](../README.md) › [Globals](../globals.md) › ["utils/rpc-caller"](../modules/_utils_rpc_caller_.md) › [HttpRpcCaller](_utils_rpc_caller_.httprpccaller.md) - -# Class: HttpRpcCaller - -## Hierarchy - -* **HttpRpcCaller** - -## Implements - -* [RpcCaller](../interfaces/_utils_rpc_caller_.rpccaller.md) - -## Index - -### Constructors - -* [constructor](_utils_rpc_caller_.httprpccaller.md#constructor) - -### Properties - -* [httpProvider](_utils_rpc_caller_.httprpccaller.md#readonly-httpprovider) -* [jsonrpcVersion](_utils_rpc_caller_.httprpccaller.md#readonly-jsonrpcversion) - -### Methods - -* [call](_utils_rpc_caller_.httprpccaller.md#call) -* [send](_utils_rpc_caller_.httprpccaller.md#send) - -## Constructors - -### constructor - -\+ **new HttpRpcCaller**(`httpProvider`: [HttpProvider](../interfaces/_types_.httpprovider.md), `jsonrpcVersion`: string): *[HttpRpcCaller](_utils_rpc_caller_.httprpccaller.md)* - -*Defined in [utils/rpc-caller.ts:71](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/rpc-caller.ts#L71)* - -**Parameters:** - -Name | Type | Default | ------- | ------ | ------ | -`httpProvider` | [HttpProvider](../interfaces/_types_.httpprovider.md) | - | -`jsonrpcVersion` | string | "2.0" | - -**Returns:** *[HttpRpcCaller](_utils_rpc_caller_.httprpccaller.md)* - -## Properties - -### `Readonly` httpProvider - -• **httpProvider**: *[HttpProvider](../interfaces/_types_.httpprovider.md)* - -*Defined in [utils/rpc-caller.ts:72](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/rpc-caller.ts#L72)* - -___ - -### `Readonly` jsonrpcVersion - -• **jsonrpcVersion**: *string* - -*Defined in [utils/rpc-caller.ts:72](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/rpc-caller.ts#L72)* - -## Methods - -### call - -▸ **call**(`method`: string, `params`: any[]): *Promise‹[JsonRpcResponse](../interfaces/_types_.jsonrpcresponse.md)›* - -*Defined in [utils/rpc-caller.ts:74](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/rpc-caller.ts#L74)* - -**Parameters:** - -Name | Type | ------- | ------ | -`method` | string | -`params` | any[] | - -**Returns:** *Promise‹[JsonRpcResponse](../interfaces/_types_.jsonrpcresponse.md)›* - -___ - -### send - -▸ **send**(`payload`: [JsonRpcPayload](../interfaces/_types_.jsonrpcpayload.md), `callback`: function): *void* - -*Defined in [utils/rpc-caller.ts:92](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/rpc-caller.ts#L92)* - -**Parameters:** - -▪ **payload**: *[JsonRpcPayload](../interfaces/_types_.jsonrpcpayload.md)* - -▪ **callback**: *function* - -▸ (`error`: [Error](../interfaces/_types_.error.md) | null, `result?`: [JsonRpcResponse](../interfaces/_types_.jsonrpcresponse.md)): *void* - -**Parameters:** - -Name | Type | ------- | ------ | -`error` | [Error](../interfaces/_types_.error.md) | null | -`result?` | [JsonRpcResponse](../interfaces/_types_.jsonrpcresponse.md) | - -**Returns:** *void* diff --git a/packages/docs/sdk/docs/connect/classes/_utils_tx_params_normalizer_.txparamsnormalizer.md b/packages/docs/sdk/docs/connect/classes/_utils_tx_params_normalizer_.txparamsnormalizer.md index f9c09ff3208..6c35330afd7 100644 --- a/packages/docs/sdk/docs/connect/classes/_utils_tx_params_normalizer_.txparamsnormalizer.md +++ b/packages/docs/sdk/docs/connect/classes/_utils_tx_params_normalizer_.txparamsnormalizer.md @@ -26,7 +26,7 @@ \+ **new TxParamsNormalizer**(`connection`: [Connection](_connection_.connection.md)): *[TxParamsNormalizer](_utils_tx_params_normalizer_.txparamsnormalizer.md)* -*Defined in [utils/tx-params-normalizer.ts:20](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/tx-params-normalizer.ts#L20)* +*Defined in [utils/tx-params-normalizer.ts:16](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/tx-params-normalizer.ts#L16)* **Parameters:** @@ -42,7 +42,7 @@ Name | Type | • **connection**: *[Connection](_connection_.connection.md)* -*Defined in [utils/tx-params-normalizer.ts:22](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/tx-params-normalizer.ts#L22)* +*Defined in [utils/tx-params-normalizer.ts:18](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/tx-params-normalizer.ts#L18)* ## Methods @@ -50,7 +50,7 @@ Name | Type | ▸ **populate**(`celoTxParams`: [CeloTx](../modules/_types_.md#celotx)): *Promise‹[CeloTx](../modules/_types_.md#celotx)›* -*Defined in [utils/tx-params-normalizer.ts:24](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/tx-params-normalizer.ts#L24)* +*Defined in [utils/tx-params-normalizer.ts:20](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/tx-params-normalizer.ts#L20)* **Parameters:** diff --git a/packages/docs/sdk/docs/connect/interfaces/_connection_.connectionoptions.md b/packages/docs/sdk/docs/connect/interfaces/_connection_.connectionoptions.md index 43e61012be7..b50879425b4 100644 --- a/packages/docs/sdk/docs/connect/interfaces/_connection_.connectionoptions.md +++ b/packages/docs/sdk/docs/connect/interfaces/_connection_.connectionoptions.md @@ -13,6 +13,7 @@ * [feeCurrency](_connection_.connectionoptions.md#optional-feecurrency) * [from](_connection_.connectionoptions.md#optional-from) * [gasInflationFactor](_connection_.connectionoptions.md#gasinflationfactor) +* [gasPrice](_connection_.connectionoptions.md#gasprice) ## Properties @@ -20,7 +21,7 @@ • **feeCurrency**? : *[Address](../modules/_types_.md#address)* -*Defined in [connection.ts:46](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L46)* +*Defined in [connection.ts:45](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L45)* ___ @@ -28,7 +29,7 @@ ___ • **from**? : *[Address](../modules/_types_.md#address)* -*Defined in [connection.ts:47](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L47)* +*Defined in [connection.ts:46](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L46)* ___ @@ -36,4 +37,12 @@ ___ • **gasInflationFactor**: *number* -*Defined in [connection.ts:45](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L45)* +*Defined in [connection.ts:43](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L43)* + +___ + +### gasPrice + +• **gasPrice**: *string* + +*Defined in [connection.ts:44](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L44)* diff --git a/packages/docs/sdk/docs/connect/interfaces/_types_.celoparams.md b/packages/docs/sdk/docs/connect/interfaces/_types_.celoparams.md index 2f021c2ac10..1b0aade03f3 100644 --- a/packages/docs/sdk/docs/connect/interfaces/_types_.celoparams.md +++ b/packages/docs/sdk/docs/connect/interfaces/_types_.celoparams.md @@ -20,7 +20,7 @@ • **feeCurrency**: *string* -*Defined in [types.ts:13](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L13)* +*Defined in [types.ts:7](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L7)* ___ @@ -28,7 +28,7 @@ ___ • **gatewayFee**: *string* -*Defined in [types.ts:21](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L21)* +*Defined in [types.ts:9](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L9)* ___ @@ -36,4 +36,4 @@ ___ • **gatewayFeeRecipient**: *string* -*Defined in [types.ts:17](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L17)* +*Defined in [types.ts:8](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L8)* diff --git a/packages/docs/sdk/docs/connect/interfaces/_types_.celotxobject.md b/packages/docs/sdk/docs/connect/interfaces/_types_.celotxobject.md index c13ce5f5dcc..8b4444e73be 100644 --- a/packages/docs/sdk/docs/connect/interfaces/_types_.celotxobject.md +++ b/packages/docs/sdk/docs/connect/interfaces/_types_.celotxobject.md @@ -1,6 +1,6 @@ [@celo/connect](../README.md) › [Globals](../globals.md) › ["types"](../modules/_types_.md) › [CeloTxObject](_types_.celotxobject.md) -# Interface: CeloTxObject ‹**T**› +# Interface: CeloTxObject <**T**> ## Type parameters @@ -30,7 +30,7 @@ • **_parent**: *Contract* -*Defined in [types.ts:61](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L61)* +*Defined in [types.ts:20](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L20)* ___ @@ -38,7 +38,7 @@ ___ • **arguments**: *any[]* -*Defined in [types.ts:56](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L56)* +*Defined in [types.ts:15](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L15)* ## Methods @@ -46,7 +46,7 @@ ___ ▸ **call**(`tx?`: [CeloTx](../modules/_types_.md#celotx)): *Promise‹T›* -*Defined in [types.ts:57](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L57)* +*Defined in [types.ts:16](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L16)* **Parameters:** @@ -62,7 +62,7 @@ ___ ▸ **encodeABI**(): *string* -*Defined in [types.ts:60](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L60)* +*Defined in [types.ts:19](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L19)* **Returns:** *string* @@ -72,7 +72,7 @@ ___ ▸ **estimateGas**(`tx?`: [CeloTx](../modules/_types_.md#celotx)): *Promise‹number›* -*Defined in [types.ts:59](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L59)* +*Defined in [types.ts:18](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L18)* **Parameters:** @@ -88,7 +88,7 @@ ___ ▸ **send**(`tx?`: [CeloTx](../modules/_types_.md#celotx)): *PromiEvent‹[CeloTxReceipt](../modules/_types_.md#celotxreceipt)›* -*Defined in [types.ts:58](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L58)* +*Defined in [types.ts:17](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L17)* **Parameters:** diff --git a/packages/docs/sdk/docs/connect/interfaces/_types_.cip42txproperties.md b/packages/docs/sdk/docs/connect/interfaces/_types_.cip42txproperties.md deleted file mode 100644 index 2a61d334003..00000000000 --- a/packages/docs/sdk/docs/connect/interfaces/_types_.cip42txproperties.md +++ /dev/null @@ -1,184 +0,0 @@ -[@celo/connect](../README.md) › [Globals](../globals.md) › ["types"](../modules/_types_.md) › [CIP42TXProperties](_types_.cip42txproperties.md) - -# Interface: CIP42TXProperties - -## Hierarchy - -* FeeMarketAndAccessListTXProperties - - ↳ **CIP42TXProperties** - -## Index - -### Properties - -* [accessList](_types_.cip42txproperties.md#optional-accesslist) -* [feeCurrency](_types_.cip42txproperties.md#feecurrency) -* [gas](_types_.cip42txproperties.md#gas) -* [gatewayFee](_types_.cip42txproperties.md#optional-gatewayfee) -* [gatewayFeeRecipient](_types_.cip42txproperties.md#optional-gatewayfeerecipient) -* [hash](_types_.cip42txproperties.md#hash) -* [input](_types_.cip42txproperties.md#input) -* [maxFeePerGas](_types_.cip42txproperties.md#maxfeepergas) -* [maxPriorityFeePerGas](_types_.cip42txproperties.md#maxpriorityfeepergas) -* [nonce](_types_.cip42txproperties.md#nonce) -* [r](_types_.cip42txproperties.md#r) -* [s](_types_.cip42txproperties.md#s) -* [to](_types_.cip42txproperties.md#to) -* [type](_types_.cip42txproperties.md#type) -* [v](_types_.cip42txproperties.md#v) -* [value](_types_.cip42txproperties.md#value) - -## Properties - -### `Optional` accessList - -• **accessList**? : *AccessList* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[accessList](_types_.eip1559txproperties.md#optional-accesslist)* - -*Defined in [types.ts:86](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L86)* - -___ - -### feeCurrency - -• **feeCurrency**: *string* - -*Defined in [types.ts:99](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L99)* - -___ - -### gas - -• **gas**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[gas](_types_.eip1559txproperties.md#gas)* - -*Defined in [types.ts:72](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L72)* - -___ - -### `Optional` gatewayFee - -• **gatewayFee**? : *undefined | string* - -*Defined in [types.ts:101](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L101)* - -___ - -### `Optional` gatewayFeeRecipient - -• **gatewayFeeRecipient**? : *undefined | string* - -*Defined in [types.ts:100](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L100)* - -___ - -### hash - -• **hash**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[hash](_types_.eip1559txproperties.md#hash)* - -*Defined in [types.ts:79](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L79)* - -___ - -### input - -• **input**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[input](_types_.eip1559txproperties.md#input)* - -*Defined in [types.ts:75](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L75)* - -___ - -### maxFeePerGas - -• **maxFeePerGas**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[maxFeePerGas](_types_.eip1559txproperties.md#maxfeepergas)* - -*Defined in [types.ts:84](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L84)* - -___ - -### maxPriorityFeePerGas - -• **maxPriorityFeePerGas**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[maxPriorityFeePerGas](_types_.eip1559txproperties.md#maxpriorityfeepergas)* - -*Defined in [types.ts:85](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L85)* - -___ - -### nonce - -• **nonce**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[nonce](_types_.eip1559txproperties.md#nonce)* - -*Defined in [types.ts:71](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L71)* - -___ - -### r - -• **r**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[r](_types_.eip1559txproperties.md#r)* - -*Defined in [types.ts:76](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L76)* - -___ - -### s - -• **s**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[s](_types_.eip1559txproperties.md#s)* - -*Defined in [types.ts:77](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L77)* - -___ - -### to - -• **to**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[to](_types_.eip1559txproperties.md#to)* - -*Defined in [types.ts:73](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L73)* - -___ - -### type - -• **type**: *"cip42"* - -*Overrides void* - -*Defined in [types.ts:102](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L102)* - -___ - -### v - -• **v**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[v](_types_.eip1559txproperties.md#v)* - -*Defined in [types.ts:78](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L78)* - -___ - -### value - -• **value**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[value](_types_.eip1559txproperties.md#value)* - -*Defined in [types.ts:74](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L74)* diff --git a/packages/docs/sdk/docs/connect/interfaces/_types_.cip64txproperties.md b/packages/docs/sdk/docs/connect/interfaces/_types_.cip64txproperties.md deleted file mode 100644 index 2610fbc1a5c..00000000000 --- a/packages/docs/sdk/docs/connect/interfaces/_types_.cip64txproperties.md +++ /dev/null @@ -1,166 +0,0 @@ -[@celo/connect](../README.md) › [Globals](../globals.md) › ["types"](../modules/_types_.md) › [CIP64TXProperties](_types_.cip64txproperties.md) - -# Interface: CIP64TXProperties - -## Hierarchy - -* FeeMarketAndAccessListTXProperties - - ↳ **CIP64TXProperties** - -## Index - -### Properties - -* [accessList](_types_.cip64txproperties.md#optional-accesslist) -* [feeCurrency](_types_.cip64txproperties.md#feecurrency) -* [gas](_types_.cip64txproperties.md#gas) -* [hash](_types_.cip64txproperties.md#hash) -* [input](_types_.cip64txproperties.md#input) -* [maxFeePerGas](_types_.cip64txproperties.md#maxfeepergas) -* [maxPriorityFeePerGas](_types_.cip64txproperties.md#maxpriorityfeepergas) -* [nonce](_types_.cip64txproperties.md#nonce) -* [r](_types_.cip64txproperties.md#r) -* [s](_types_.cip64txproperties.md#s) -* [to](_types_.cip64txproperties.md#to) -* [type](_types_.cip64txproperties.md#type) -* [v](_types_.cip64txproperties.md#v) -* [value](_types_.cip64txproperties.md#value) - -## Properties - -### `Optional` accessList - -• **accessList**? : *AccessList* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[accessList](_types_.eip1559txproperties.md#optional-accesslist)* - -*Defined in [types.ts:86](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L86)* - -___ - -### feeCurrency - -• **feeCurrency**: *string* - -*Defined in [types.ts:94](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L94)* - -___ - -### gas - -• **gas**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[gas](_types_.eip1559txproperties.md#gas)* - -*Defined in [types.ts:72](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L72)* - -___ - -### hash - -• **hash**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[hash](_types_.eip1559txproperties.md#hash)* - -*Defined in [types.ts:79](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L79)* - -___ - -### input - -• **input**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[input](_types_.eip1559txproperties.md#input)* - -*Defined in [types.ts:75](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L75)* - -___ - -### maxFeePerGas - -• **maxFeePerGas**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[maxFeePerGas](_types_.eip1559txproperties.md#maxfeepergas)* - -*Defined in [types.ts:84](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L84)* - -___ - -### maxPriorityFeePerGas - -• **maxPriorityFeePerGas**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[maxPriorityFeePerGas](_types_.eip1559txproperties.md#maxpriorityfeepergas)* - -*Defined in [types.ts:85](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L85)* - -___ - -### nonce - -• **nonce**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[nonce](_types_.eip1559txproperties.md#nonce)* - -*Defined in [types.ts:71](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L71)* - -___ - -### r - -• **r**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[r](_types_.eip1559txproperties.md#r)* - -*Defined in [types.ts:76](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L76)* - -___ - -### s - -• **s**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[s](_types_.eip1559txproperties.md#s)* - -*Defined in [types.ts:77](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L77)* - -___ - -### to - -• **to**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[to](_types_.eip1559txproperties.md#to)* - -*Defined in [types.ts:73](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L73)* - -___ - -### type - -• **type**: *"cip64"* - -*Overrides void* - -*Defined in [types.ts:95](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L95)* - -___ - -### v - -• **v**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[v](_types_.eip1559txproperties.md#v)* - -*Defined in [types.ts:78](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L78)* - -___ - -### value - -• **value**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[value](_types_.eip1559txproperties.md#value)* - -*Defined in [types.ts:74](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L74)* diff --git a/packages/docs/sdk/docs/connect/interfaces/_types_.eip1559txproperties.md b/packages/docs/sdk/docs/connect/interfaces/_types_.eip1559txproperties.md deleted file mode 100644 index 81e10785951..00000000000 --- a/packages/docs/sdk/docs/connect/interfaces/_types_.eip1559txproperties.md +++ /dev/null @@ -1,157 +0,0 @@ -[@celo/connect](../README.md) › [Globals](../globals.md) › ["types"](../modules/_types_.md) › [EIP1559TXProperties](_types_.eip1559txproperties.md) - -# Interface: EIP1559TXProperties - -## Hierarchy - -* FeeMarketAndAccessListTXProperties - - ↳ **EIP1559TXProperties** - -## Index - -### Properties - -* [accessList](_types_.eip1559txproperties.md#optional-accesslist) -* [gas](_types_.eip1559txproperties.md#gas) -* [hash](_types_.eip1559txproperties.md#hash) -* [input](_types_.eip1559txproperties.md#input) -* [maxFeePerGas](_types_.eip1559txproperties.md#maxfeepergas) -* [maxPriorityFeePerGas](_types_.eip1559txproperties.md#maxpriorityfeepergas) -* [nonce](_types_.eip1559txproperties.md#nonce) -* [r](_types_.eip1559txproperties.md#r) -* [s](_types_.eip1559txproperties.md#s) -* [to](_types_.eip1559txproperties.md#to) -* [type](_types_.eip1559txproperties.md#type) -* [v](_types_.eip1559txproperties.md#v) -* [value](_types_.eip1559txproperties.md#value) - -## Properties - -### `Optional` accessList - -• **accessList**? : *AccessList* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[accessList](_types_.eip1559txproperties.md#optional-accesslist)* - -*Defined in [types.ts:86](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L86)* - -___ - -### gas - -• **gas**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[gas](_types_.eip1559txproperties.md#gas)* - -*Defined in [types.ts:72](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L72)* - -___ - -### hash - -• **hash**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[hash](_types_.eip1559txproperties.md#hash)* - -*Defined in [types.ts:79](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L79)* - -___ - -### input - -• **input**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[input](_types_.eip1559txproperties.md#input)* - -*Defined in [types.ts:75](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L75)* - -___ - -### maxFeePerGas - -• **maxFeePerGas**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[maxFeePerGas](_types_.eip1559txproperties.md#maxfeepergas)* - -*Defined in [types.ts:84](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L84)* - -___ - -### maxPriorityFeePerGas - -• **maxPriorityFeePerGas**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[maxPriorityFeePerGas](_types_.eip1559txproperties.md#maxpriorityfeepergas)* - -*Defined in [types.ts:85](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L85)* - -___ - -### nonce - -• **nonce**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[nonce](_types_.eip1559txproperties.md#nonce)* - -*Defined in [types.ts:71](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L71)* - -___ - -### r - -• **r**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[r](_types_.eip1559txproperties.md#r)* - -*Defined in [types.ts:76](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L76)* - -___ - -### s - -• **s**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[s](_types_.eip1559txproperties.md#s)* - -*Defined in [types.ts:77](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L77)* - -___ - -### to - -• **to**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[to](_types_.eip1559txproperties.md#to)* - -*Defined in [types.ts:73](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L73)* - -___ - -### type - -• **type**: *"eip1559"* - -*Overrides void* - -*Defined in [types.ts:90](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L90)* - -___ - -### v - -• **v**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[v](_types_.eip1559txproperties.md#v)* - -*Defined in [types.ts:78](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L78)* - -___ - -### value - -• **value**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[value](_types_.eip1559txproperties.md#value)* - -*Defined in [types.ts:74](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L74)* diff --git a/packages/docs/sdk/docs/connect/interfaces/_types_.encodedtransaction.md b/packages/docs/sdk/docs/connect/interfaces/_types_.encodedtransaction.md index 59757778650..9a7f6658358 100644 --- a/packages/docs/sdk/docs/connect/interfaces/_types_.encodedtransaction.md +++ b/packages/docs/sdk/docs/connect/interfaces/_types_.encodedtransaction.md @@ -17,14 +17,42 @@ ### raw -• **raw**: *[Hex](../modules/_types_.md#hex)* +• **raw**: *string* -*Defined in [types.ts:117](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L117)* +*Defined in [types.ts:28](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L28)* ___ ### tx -• **tx**: *[LegacyTXProperties](_types_.legacytxproperties.md) | [CIP42TXProperties](_types_.cip42txproperties.md) | [EIP1559TXProperties](_types_.eip1559txproperties.md) | [CIP64TXProperties](_types_.cip64txproperties.md)* +• **tx**: *object* -*Defined in [types.ts:118](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L118)* +*Defined in [types.ts:29](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L29)* + +#### Type declaration: + +* **feeCurrency**: *string* + +* **gas**: *string* + +* **gasPrice**: *string* + +* **gatewayFee**: *string* + +* **gatewayFeeRecipient**: *string* + +* **hash**: *string* + +* **input**: *string* + +* **nonce**: *string* + +* **r**: *string* + +* **s**: *string* + +* **to**: *string* + +* **v**: *string* + +* **value**: *string* diff --git a/packages/docs/sdk/docs/connect/interfaces/_types_.error.md b/packages/docs/sdk/docs/connect/interfaces/_types_.error.md deleted file mode 100644 index 390bbfe3df3..00000000000 --- a/packages/docs/sdk/docs/connect/interfaces/_types_.error.md +++ /dev/null @@ -1,39 +0,0 @@ -[@celo/connect](../README.md) › [Globals](../globals.md) › ["types"](../modules/_types_.md) › [Error](_types_.error.md) - -# Interface: Error - -## Hierarchy - -* **Error** - -## Index - -### Properties - -* [code](_types_.error.md#optional-readonly-code) -* [data](_types_.error.md#optional-readonly-data) -* [message](_types_.error.md#readonly-message) - -## Properties - -### `Optional` `Readonly` code - -• **code**? : *undefined | number* - -*Defined in [types.ts:152](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L152)* - -___ - -### `Optional` `Readonly` data - -• **data**? : *unknown* - -*Defined in [types.ts:153](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L153)* - -___ - -### `Readonly` message - -• **message**: *string* - -*Defined in [types.ts:154](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L154)* diff --git a/packages/docs/sdk/docs/connect/interfaces/_types_.formattedcelotx.md b/packages/docs/sdk/docs/connect/interfaces/_types_.formattedcelotx.md deleted file mode 100644 index 928b744c2fe..00000000000 --- a/packages/docs/sdk/docs/connect/interfaces/_types_.formattedcelotx.md +++ /dev/null @@ -1,147 +0,0 @@ -[@celo/connect](../README.md) › [Globals](../globals.md) › ["types"](../modules/_types_.md) › [FormattedCeloTx](_types_.formattedcelotx.md) - -# Interface: FormattedCeloTx - -## Hierarchy - -* **FormattedCeloTx** - -## Index - -### Properties - -* [accessList](_types_.formattedcelotx.md#optional-accesslist) -* [chainId](_types_.formattedcelotx.md#chainid) -* [data](_types_.formattedcelotx.md#data) -* [feeCurrency](_types_.formattedcelotx.md#optional-feecurrency) -* [from](_types_.formattedcelotx.md#from) -* [gas](_types_.formattedcelotx.md#gas) -* [gasPrice](_types_.formattedcelotx.md#optional-gasprice) -* [gatewayFee](_types_.formattedcelotx.md#optional-gatewayfee) -* [gatewayFeeRecipient](_types_.formattedcelotx.md#optional-gatewayfeerecipient) -* [maxFeePerGas](_types_.formattedcelotx.md#optional-maxfeepergas) -* [maxPriorityFeePerGas](_types_.formattedcelotx.md#optional-maxpriorityfeepergas) -* [nonce](_types_.formattedcelotx.md#nonce) -* [to](_types_.formattedcelotx.md#to) -* [type](_types_.formattedcelotx.md#type) -* [value](_types_.formattedcelotx.md#value) - -## Properties - -### `Optional` accessList - -• **accessList**? : *[AccessListRaw](../modules/_types_.md#accesslistraw)* - -*Defined in [types.ts:47](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L47)* - -___ - -### chainId - -• **chainId**: *number* - -*Defined in [types.ts:28](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L28)* - -___ - -### data - -• **data**: *string | undefined* - -*Defined in [types.ts:31](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L31)* - -___ - -### `Optional` feeCurrency - -• **feeCurrency**? : *[HexOrMissing](../modules/_types_.md#hexormissing)* - -*Defined in [types.ts:33](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L33)* - -___ - -### from - -• **from**: *[HexOrMissing](../modules/_types_.md#hexormissing)* - -*Defined in [types.ts:29](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L29)* - -___ - -### gas - -• **gas**: *[HexOrMissing](../modules/_types_.md#hexormissing)* - -*Defined in [types.ts:42](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L42)* - -___ - -### `Optional` gasPrice - -• **gasPrice**? : *[Hex](../modules/_types_.md#hex)* - -*Defined in [types.ts:43](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L43)* - -___ - -### `Optional` gatewayFee - -• **gatewayFee**? : *[HexOrMissing](../modules/_types_.md#hexormissing)* - -*Defined in [types.ts:41](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L41)* - -___ - -### `Optional` gatewayFeeRecipient - -• **gatewayFeeRecipient**? : *[HexOrMissing](../modules/_types_.md#hexormissing)* - -*Defined in [types.ts:37](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L37)* - -___ - -### `Optional` maxFeePerGas - -• **maxFeePerGas**? : *[Hex](../modules/_types_.md#hex)* - -*Defined in [types.ts:44](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L44)* - -___ - -### `Optional` maxPriorityFeePerGas - -• **maxPriorityFeePerGas**? : *[Hex](../modules/_types_.md#hex)* - -*Defined in [types.ts:45](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L45)* - -___ - -### nonce - -• **nonce**: *[HexOrMissing](../modules/_types_.md#hexormissing) | number* - -*Defined in [types.ts:46](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L46)* - -___ - -### to - -• **to**: *[HexOrMissing](../modules/_types_.md#hexormissing)* - -*Defined in [types.ts:30](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L30)* - -___ - -### type - -• **type**: *[TransactionTypes](../modules/_types_.md#transactiontypes)* - -*Defined in [types.ts:48](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L48)* - -___ - -### value - -• **value**: *[HexOrMissing](../modules/_types_.md#hexormissing)* - -*Defined in [types.ts:32](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L32)* diff --git a/packages/docs/sdk/docs/connect/interfaces/_types_.httpprovider.md b/packages/docs/sdk/docs/connect/interfaces/_types_.httpprovider.md deleted file mode 100644 index 7267d4f9390..00000000000 --- a/packages/docs/sdk/docs/connect/interfaces/_types_.httpprovider.md +++ /dev/null @@ -1,38 +0,0 @@ -[@celo/connect](../README.md) › [Globals](../globals.md) › ["types"](../modules/_types_.md) › [HttpProvider](_types_.httpprovider.md) - -# Interface: HttpProvider - -## Hierarchy - -* **HttpProvider** - -## Index - -### Methods - -* [send](_types_.httpprovider.md#send) - -## Methods - -### send - -▸ **send**(`payload`: [JsonRpcPayload](_types_.jsonrpcpayload.md), `callback`: function): *void* - -*Defined in [types.ts:158](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L158)* - -**Parameters:** - -▪ **payload**: *[JsonRpcPayload](_types_.jsonrpcpayload.md)* - -▪ **callback**: *function* - -▸ (`error`: [Error](_types_.error.md) | null, `result?`: [JsonRpcResponse](_types_.jsonrpcresponse.md)): *void* - -**Parameters:** - -Name | Type | ------- | ------ | -`error` | [Error](_types_.error.md) | null | -`result?` | [JsonRpcResponse](_types_.jsonrpcresponse.md) | - -**Returns:** *void* diff --git a/packages/docs/sdk/docs/connect/interfaces/_types_.jsonrpcpayload.md b/packages/docs/sdk/docs/connect/interfaces/_types_.jsonrpcpayload.md index bf558246eb5..9745182b944 100644 --- a/packages/docs/sdk/docs/connect/interfaces/_types_.jsonrpcpayload.md +++ b/packages/docs/sdk/docs/connect/interfaces/_types_.jsonrpcpayload.md @@ -21,7 +21,7 @@ • **id**? : *string | number* -*Defined in [types.ts:141](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L141)* +*Defined in [types.ts:62](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L62)* ___ @@ -29,7 +29,7 @@ ___ • **jsonrpc**: *string* -*Defined in [types.ts:138](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L138)* +*Defined in [types.ts:59](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L59)* ___ @@ -37,7 +37,7 @@ ___ • **method**: *string* -*Defined in [types.ts:139](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L139)* +*Defined in [types.ts:60](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L60)* ___ @@ -45,4 +45,4 @@ ___ • **params**: *any[]* -*Defined in [types.ts:140](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L140)* +*Defined in [types.ts:61](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L61)* diff --git a/packages/docs/sdk/docs/connect/interfaces/_types_.jsonrpcresponse.md b/packages/docs/sdk/docs/connect/interfaces/_types_.jsonrpcresponse.md index e8dd3f2eb39..de9b74b3a73 100644 --- a/packages/docs/sdk/docs/connect/interfaces/_types_.jsonrpcresponse.md +++ b/packages/docs/sdk/docs/connect/interfaces/_types_.jsonrpcresponse.md @@ -19,17 +19,17 @@ ### `Optional` error -• **error**? : *undefined | object* +• **error**? : *string | object* -*Defined in [types.ts:130](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L130)* +*Defined in [types.ts:55](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L55)* ___ ### id -• **id**: *string | number* +• **id**: *number* -*Defined in [types.ts:128](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L128)* +*Defined in [types.ts:53](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L53)* ___ @@ -37,7 +37,7 @@ ___ • **jsonrpc**: *string* -*Defined in [types.ts:127](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L127)* +*Defined in [types.ts:52](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L52)* ___ @@ -45,4 +45,4 @@ ___ • **result**? : *any* -*Defined in [types.ts:129](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L129)* +*Defined in [types.ts:54](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L54)* diff --git a/packages/docs/sdk/docs/connect/interfaces/_types_.legacytxproperties.md b/packages/docs/sdk/docs/connect/interfaces/_types_.legacytxproperties.md deleted file mode 100644 index ee1e2686c80..00000000000 --- a/packages/docs/sdk/docs/connect/interfaces/_types_.legacytxproperties.md +++ /dev/null @@ -1,160 +0,0 @@ -[@celo/connect](../README.md) › [Globals](../globals.md) › ["types"](../modules/_types_.md) › [LegacyTXProperties](_types_.legacytxproperties.md) - -# Interface: LegacyTXProperties - -## Hierarchy - -* CommonTXProperties - - ↳ **LegacyTXProperties** - -## Index - -### Properties - -* [feeCurrency](_types_.legacytxproperties.md#feecurrency) -* [gas](_types_.legacytxproperties.md#gas) -* [gasPrice](_types_.legacytxproperties.md#gasprice) -* [gatewayFee](_types_.legacytxproperties.md#gatewayfee) -* [gatewayFeeRecipient](_types_.legacytxproperties.md#gatewayfeerecipient) -* [hash](_types_.legacytxproperties.md#hash) -* [input](_types_.legacytxproperties.md#input) -* [nonce](_types_.legacytxproperties.md#nonce) -* [r](_types_.legacytxproperties.md#r) -* [s](_types_.legacytxproperties.md#s) -* [to](_types_.legacytxproperties.md#to) -* [type](_types_.legacytxproperties.md#type) -* [v](_types_.legacytxproperties.md#v) -* [value](_types_.legacytxproperties.md#value) - -## Properties - -### feeCurrency - -• **feeCurrency**: *string* - -*Defined in [types.ts:110](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L110)* - -___ - -### gas - -• **gas**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[gas](_types_.eip1559txproperties.md#gas)* - -*Defined in [types.ts:72](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L72)* - -___ - -### gasPrice - -• **gasPrice**: *string* - -*Defined in [types.ts:109](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L109)* - -___ - -### gatewayFee - -• **gatewayFee**: *string* - -*Defined in [types.ts:112](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L112)* - -___ - -### gatewayFeeRecipient - -• **gatewayFeeRecipient**: *string* - -*Defined in [types.ts:111](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L111)* - -___ - -### hash - -• **hash**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[hash](_types_.eip1559txproperties.md#hash)* - -*Defined in [types.ts:79](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L79)* - -___ - -### input - -• **input**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[input](_types_.eip1559txproperties.md#input)* - -*Defined in [types.ts:75](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L75)* - -___ - -### nonce - -• **nonce**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[nonce](_types_.eip1559txproperties.md#nonce)* - -*Defined in [types.ts:71](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L71)* - -___ - -### r - -• **r**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[r](_types_.eip1559txproperties.md#r)* - -*Defined in [types.ts:76](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L76)* - -___ - -### s - -• **s**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[s](_types_.eip1559txproperties.md#s)* - -*Defined in [types.ts:77](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L77)* - -___ - -### to - -• **to**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[to](_types_.eip1559txproperties.md#to)* - -*Defined in [types.ts:73](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L73)* - -___ - -### type - -• **type**: *"celo-legacy"* - -*Overrides void* - -*Defined in [types.ts:113](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L113)* - -___ - -### v - -• **v**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[v](_types_.eip1559txproperties.md#v)* - -*Defined in [types.ts:78](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L78)* - -___ - -### value - -• **value**: *string* - -*Inherited from [EIP1559TXProperties](_types_.eip1559txproperties.md).[value](_types_.eip1559txproperties.md#value)* - -*Defined in [types.ts:74](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L74)* diff --git a/packages/docs/sdk/docs/connect/interfaces/_types_.provider.md b/packages/docs/sdk/docs/connect/interfaces/_types_.provider.md index 506caffd9c5..87a5adb2052 100644 --- a/packages/docs/sdk/docs/connect/interfaces/_types_.provider.md +++ b/packages/docs/sdk/docs/connect/interfaces/_types_.provider.md @@ -20,23 +20,15 @@ ### send -▸ **send**(`payload`: [JsonRpcPayload](_types_.jsonrpcpayload.md), `callback`: function): *void* +▸ **send**(`payload`: [JsonRpcPayload](_types_.jsonrpcpayload.md), `callback`: [Callback](../modules/_types_.md#callback)‹[JsonRpcResponse](_types_.jsonrpcresponse.md)›): *void* -*Defined in [types.ts:145](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L145)* - -**Parameters:** - -▪ **payload**: *[JsonRpcPayload](_types_.jsonrpcpayload.md)* - -▪ **callback**: *function* - -▸ (`error`: [Error](_types_.error.md) | null, `result?`: [JsonRpcResponse](_types_.jsonrpcresponse.md)): *void* +*Defined in [types.ts:66](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L66)* **Parameters:** Name | Type | ------ | ------ | -`error` | [Error](_types_.error.md) | null | -`result?` | [JsonRpcResponse](_types_.jsonrpcresponse.md) | +`payload` | [JsonRpcPayload](_types_.jsonrpcpayload.md) | +`callback` | [Callback](../modules/_types_.md#callback)‹[JsonRpcResponse](_types_.jsonrpcresponse.md)› | **Returns:** *void* diff --git a/packages/docs/sdk/docs/connect/interfaces/_types_.rlpencodedtx.md b/packages/docs/sdk/docs/connect/interfaces/_types_.rlpencodedtx.md index 4ea1d89765a..90afe21f1b7 100644 --- a/packages/docs/sdk/docs/connect/interfaces/_types_.rlpencodedtx.md +++ b/packages/docs/sdk/docs/connect/interfaces/_types_.rlpencodedtx.md @@ -12,28 +12,19 @@ * [rlpEncode](_types_.rlpencodedtx.md#rlpencode) * [transaction](_types_.rlpencodedtx.md#transaction) -* [type](_types_.rlpencodedtx.md#type) ## Properties ### rlpEncode -• **rlpEncode**: *[Hex](../modules/_types_.md#hex)* +• **rlpEncode**: *string* -*Defined in [types.ts:166](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L166)* +*Defined in [types.ts:71](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L71)* ___ ### transaction -• **transaction**: *[FormattedCeloTx](_types_.formattedcelotx.md)* +• **transaction**: *[CeloTx](../modules/_types_.md#celotx)* -*Defined in [types.ts:165](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L165)* - -___ - -### type - -• **type**: *[TransactionTypes](../modules/_types_.md#transactiontypes)* - -*Defined in [types.ts:167](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L167)* +*Defined in [types.ts:70](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L70)* diff --git a/packages/docs/sdk/docs/connect/interfaces/_utils_rpc_caller_.rpccaller.md b/packages/docs/sdk/docs/connect/interfaces/_utils_rpc_caller_.rpccaller.md index 50f5ba00571..2641f98ab64 100644 --- a/packages/docs/sdk/docs/connect/interfaces/_utils_rpc_caller_.rpccaller.md +++ b/packages/docs/sdk/docs/connect/interfaces/_utils_rpc_caller_.rpccaller.md @@ -8,7 +8,7 @@ ## Implemented by -* [HttpRpcCaller](../classes/_utils_rpc_caller_.httprpccaller.md) +* [DefaultRpcCaller](../classes/_utils_rpc_caller_.defaultrpccaller.md) ## Index @@ -46,19 +46,11 @@ ___ #### Type declaration: -▸ (`payload`: [JsonRpcPayload](_types_.jsonrpcpayload.md), `callback`: function): *void* - -**Parameters:** - -▪ **payload**: *[JsonRpcPayload](_types_.jsonrpcpayload.md)* - -▪ **callback**: *function* - -▸ (`error`: [Error](_types_.error.md) | null, `result?`: [JsonRpcResponse](_types_.jsonrpcresponse.md)): *void* +▸ (`payload`: [JsonRpcPayload](_types_.jsonrpcpayload.md), `callback`: [Callback](../modules/_types_.md#callback)‹[JsonRpcResponse](_types_.jsonrpcresponse.md)›): *void* **Parameters:** Name | Type | ------ | ------ | -`error` | [Error](_types_.error.md) | null | -`result?` | [JsonRpcResponse](_types_.jsonrpcresponse.md) | +`payload` | [JsonRpcPayload](_types_.jsonrpcpayload.md) | +`callback` | [Callback](../modules/_types_.md#callback)‹[JsonRpcResponse](_types_.jsonrpcresponse.md)› | diff --git a/packages/docs/sdk/docs/connect/modules/_celo_provider_.md b/packages/docs/sdk/docs/connect/modules/_celo_provider_.md index 2e95c6131c6..a4408ad4aad 100644 --- a/packages/docs/sdk/docs/connect/modules/_celo_provider_.md +++ b/packages/docs/sdk/docs/connect/modules/_celo_provider_.md @@ -18,7 +18,7 @@ ▸ **assertIsCeloProvider**(`provider`: any): *asserts provider is CeloProvider* -*Defined in [celo-provider.ts:34](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/celo-provider.ts#L34)* +*Defined in [celo-provider.ts:23](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/celo-provider.ts#L23)* **Parameters:** diff --git a/packages/docs/sdk/docs/connect/modules/_connection_.md b/packages/docs/sdk/docs/connect/modules/_connection_.md index a6ce7a3990f..4577fd7c45e 100644 --- a/packages/docs/sdk/docs/connect/modules/_connection_.md +++ b/packages/docs/sdk/docs/connect/modules/_connection_.md @@ -11,23 +11,3 @@ ### Interfaces * [ConnectionOptions](../interfaces/_connection_.connectionoptions.md) - -### Functions - -* [isPresent](_connection_.md#ispresent) - -## Functions - -### isPresent - -▸ **isPresent**(`value`: string | undefined | number | BN): *[isPresent](_connection_.md#ispresent)* - -*Defined in [connection.ts:534](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L534)* - -**Parameters:** - -Name | Type | ------- | ------ | -`value` | string | undefined | number | BN | - -**Returns:** *[isPresent](_connection_.md#ispresent)* diff --git a/packages/docs/sdk/docs/connect/modules/_types_.md b/packages/docs/sdk/docs/connect/modules/_types_.md index 2df548f5097..1cac1de5ff2 100644 --- a/packages/docs/sdk/docs/connect/modules/_types_.md +++ b/packages/docs/sdk/docs/connect/modules/_types_.md @@ -20,33 +20,21 @@ ### Interfaces -* [CIP42TXProperties](../interfaces/_types_.cip42txproperties.md) -* [CIP64TXProperties](../interfaces/_types_.cip64txproperties.md) * [CeloParams](../interfaces/_types_.celoparams.md) * [CeloTxObject](../interfaces/_types_.celotxobject.md) -* [EIP1559TXProperties](../interfaces/_types_.eip1559txproperties.md) * [EncodedTransaction](../interfaces/_types_.encodedtransaction.md) -* [Error](../interfaces/_types_.error.md) -* [FormattedCeloTx](../interfaces/_types_.formattedcelotx.md) -* [HttpProvider](../interfaces/_types_.httpprovider.md) * [JsonRpcPayload](../interfaces/_types_.jsonrpcpayload.md) * [JsonRpcResponse](../interfaces/_types_.jsonrpcresponse.md) -* [LegacyTXProperties](../interfaces/_types_.legacytxproperties.md) * [Provider](../interfaces/_types_.provider.md) * [RLPEncodedTx](../interfaces/_types_.rlpencodedtx.md) ### Type aliases -* [AccessListRaw](_types_.md#accesslistraw) * [Address](_types_.md#address) * [Callback](_types_.md#callback) * [CeloTx](_types_.md#celotx) * [CeloTxPending](_types_.md#celotxpending) * [CeloTxReceipt](_types_.md#celotxreceipt) -* [CeloTxWithSig](_types_.md#celotxwithsig) -* [Hex](_types_.md#hex) -* [HexOrMissing](_types_.md#hexormissing) -* [TransactionTypes](_types_.md#transactiontypes) ## References @@ -116,19 +104,11 @@ ___ ## Type aliases -### AccessListRaw - -Ƭ **AccessListRaw**: *Array‹[string, string[]]›* - -*Defined in [types.ts:24](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L24)* - -___ - ### Address Ƭ **Address**: *string* -*Defined in [types.ts:9](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L9)* +*Defined in [types.ts:4](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L4)* ___ @@ -136,26 +116,26 @@ ___ Ƭ **Callback**: *function* -*Defined in [types.ts:124](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L124)* +*Defined in [types.ts:49](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L49)* #### Type declaration: -▸ (`error`: [Error](../interfaces/_types_.error.md) | null, `result?`: T): *void* +▸ (`error`: Error | null, `result?`: T): *void* **Parameters:** Name | Type | ------ | ------ | -`error` | [Error](../interfaces/_types_.error.md) | null | +`error` | Error | null | `result?` | T | ___ ### CeloTx -Ƭ **CeloTx**: *TransactionConfig & Partial‹[CeloParams](../interfaces/_types_.celoparams.md)› & object* +Ƭ **CeloTx**: *TransactionConfig & Partial‹[CeloParams](../interfaces/_types_.celoparams.md)›* -*Defined in [types.ts:51](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L51)* +*Defined in [types.ts:12](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L12)* ___ @@ -163,7 +143,7 @@ ___ Ƭ **CeloTxPending**: *Transaction & Partial‹[CeloParams](../interfaces/_types_.celoparams.md)›* -*Defined in [types.ts:121](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L121)* +*Defined in [types.ts:46](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L46)* ___ @@ -171,36 +151,4 @@ ___ Ƭ **CeloTxReceipt**: *TransactionReceipt & Partial‹[CeloParams](../interfaces/_types_.celoparams.md)›* -*Defined in [types.ts:122](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L122)* - -___ - -### CeloTxWithSig - -Ƭ **CeloTxWithSig**: *[CeloTx](_types_.md#celotx) & object* - -*Defined in [types.ts:54](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L54)* - -___ - -### Hex - -Ƭ **Hex**: *`0x${string}`* - -*Defined in [types.ts:11](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L11)* - -___ - -### HexOrMissing - -Ƭ **HexOrMissing**: *[Hex](_types_.md#hex) | undefined* - -*Defined in [types.ts:26](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L26)* - -___ - -### TransactionTypes - -Ƭ **TransactionTypes**: *"eip1559" | "celo-legacy" | "cip42" | "cip64"* - -*Defined in [types.ts:68](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L68)* +*Defined in [types.ts:47](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/types.ts#L47)* diff --git a/packages/docs/sdk/docs/connect/modules/_utils_abi_utils_.md b/packages/docs/sdk/docs/connect/modules/_utils_abi_utils_.md index e01b925b322..8c8ac40bce9 100644 --- a/packages/docs/sdk/docs/connect/modules/_utils_abi_utils_.md +++ b/packages/docs/sdk/docs/connect/modules/_utils_abi_utils_.md @@ -9,7 +9,6 @@ * [decodeStringParameter](_utils_abi_utils_.md#const-decodestringparameter) * [getAbiByName](_utils_abi_utils_.md#const-getabibyname) * [parseDecodedParams](_utils_abi_utils_.md#const-parsedecodedparams) -* [signatureToAbiDefinition](_utils_abi_utils_.md#const-signaturetoabidefinition) ## Functions @@ -17,7 +16,7 @@ ▸ **decodeStringParameter**(`ethAbi`: [AbiCoder](../interfaces/_abi_types_.abicoder.md), `str`: string): *any* -*Defined in [utils/abi-utils.ts:55](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/abi-utils.ts#L55)* +*Defined in [utils/abi-utils.ts:25](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/abi-utils.ts#L25)* **`internal`** @@ -70,21 +69,3 @@ Name | Type | * **args**: *any[]* * **params**: *[DecodedParamsObject](../interfaces/_abi_types_.decodedparamsobject.md)* - -___ - -### `Const` signatureToAbiDefinition - -▸ **signatureToAbiDefinition**(`fnSignature`: string): *[ABIDefinition](../interfaces/_abi_types_.abidefinition.md)* - -*Defined in [utils/abi-utils.ts:25](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/abi-utils.ts#L25)* - -**`internal`** - -**Parameters:** - -Name | Type | ------- | ------ | -`fnSignature` | string | - -**Returns:** *[ABIDefinition](../interfaces/_abi_types_.abidefinition.md)* diff --git a/packages/docs/sdk/docs/connect/modules/_utils_celo_transaction_object_.md b/packages/docs/sdk/docs/connect/modules/_utils_celo_transaction_object_.md index 27df5ec5073..ef705363bbe 100644 --- a/packages/docs/sdk/docs/connect/modules/_utils_celo_transaction_object_.md +++ b/packages/docs/sdk/docs/connect/modules/_utils_celo_transaction_object_.md @@ -28,7 +28,7 @@ ### toTransactionObject -▸ **toTransactionObject**‹**O**›(`connection`: [Connection](../classes/_connection_.connection.md), `txo`: [CeloTxObject](../interfaces/_types_.celotxobject.md)‹O›, `defaultParams?`: [CeloTransactionParams](_utils_celo_transaction_object_.md#celotransactionparams)): *[CeloTransactionObject](../classes/_utils_celo_transaction_object_.celotransactionobject.md)‹O›* +▸ **toTransactionObject**<**O**>(`connection`: [Connection](../classes/_connection_.connection.md), `txo`: [CeloTxObject](../interfaces/_types_.celotxobject.md)‹O›, `defaultParams?`: [CeloTransactionParams](_utils_celo_transaction_object_.md#celotransactionparams)): *[CeloTransactionObject](../classes/_utils_celo_transaction_object_.celotransactionobject.md)‹O›* *Defined in [utils/celo-transaction-object.ts:7](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/celo-transaction-object.ts#L7)* diff --git a/packages/docs/sdk/docs/connect/modules/_utils_formatter_.md b/packages/docs/sdk/docs/connect/modules/_utils_formatter_.md index 64c6657a609..f210f7ed9c2 100644 --- a/packages/docs/sdk/docs/connect/modules/_utils_formatter_.md +++ b/packages/docs/sdk/docs/connect/modules/_utils_formatter_.md @@ -7,7 +7,6 @@ ### Functions * [hexToNumber](_utils_formatter_.md#hextonumber) -* [inputAccessListFormatter](_utils_formatter_.md#inputaccesslistformatter) * [inputAddressFormatter](_utils_formatter_.md#inputaddressformatter) * [inputBlockNumberFormatter](_utils_formatter_.md#inputblocknumberformatter) * [inputCeloTxFormatter](_utils_formatter_.md#inputcelotxformatter) @@ -19,7 +18,6 @@ * [outputCeloTxFormatter](_utils_formatter_.md#outputcelotxformatter) * [outputCeloTxReceiptFormatter](_utils_formatter_.md#outputcelotxreceiptformatter) * [outputLogFormatter](_utils_formatter_.md#outputlogformatter) -* [parseAccessList](_utils_formatter_.md#parseaccesslist) ## Functions @@ -27,7 +25,7 @@ ▸ **hexToNumber**(`hex?`: undefined | string): *number | undefined* -*Defined in [utils/formatter.ts:223](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/formatter.ts#L223)* +*Defined in [utils/formatter.ts:171](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/formatter.ts#L171)* **Parameters:** @@ -39,27 +37,11 @@ Name | Type | ___ -### inputAccessListFormatter - -▸ **inputAccessListFormatter**(`accessList?`: AccessList): *[AccessListRaw](_types_.md#accesslistraw)* - -*Defined in [utils/formatter.ts:303](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/formatter.ts#L303)* - -**Parameters:** - -Name | Type | ------- | ------ | -`accessList?` | AccessList | - -**Returns:** *[AccessListRaw](_types_.md#accesslistraw)* - -___ - ### inputAddressFormatter -▸ **inputAddressFormatter**(`address?`: undefined | string): *StrongAddress | undefined* +▸ **inputAddressFormatter**(`address?`: undefined | string): *string | undefined* -*Defined in [utils/formatter.ts:320](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/formatter.ts#L320)* +*Defined in [utils/formatter.ts:216](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/formatter.ts#L216)* **Parameters:** @@ -67,15 +49,15 @@ Name | Type | ------ | ------ | `address?` | undefined | string | -**Returns:** *StrongAddress | undefined* +**Returns:** *string | undefined* ___ ### inputBlockNumberFormatter -▸ **inputBlockNumberFormatter**(`blockNumber`: [BlockNumber](_types_.md#blocknumber)): *[inputBlockNumberFormatter](_utils_formatter_.md#inputblocknumberformatter)* +▸ **inputBlockNumberFormatter**(`blockNumber`: [BlockNumber](_types_.md#blocknumber)): *undefined | string | number | BN‹› | BigNumber‹›* -*Defined in [utils/formatter.ts:168](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/formatter.ts#L168)* +*Defined in [utils/formatter.ts:117](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/formatter.ts#L117)* **Parameters:** @@ -83,15 +65,15 @@ Name | Type | ------ | ------ | `blockNumber` | [BlockNumber](_types_.md#blocknumber) | -**Returns:** *[inputBlockNumberFormatter](_utils_formatter_.md#inputblocknumberformatter)* +**Returns:** *undefined | string | number | BN‹› | BigNumber‹›* ___ ### inputCeloTxFormatter -▸ **inputCeloTxFormatter**(`tx`: [CeloTx](_types_.md#celotx)): *[FormattedCeloTx](../interfaces/_types_.formattedcelotx.md)* +▸ **inputCeloTxFormatter**(`tx`: [CeloTx](_types_.md#celotx)): *[CeloTx](_types_.md#celotx)* -*Defined in [utils/formatter.ts:23](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/formatter.ts#L23)* +*Defined in [utils/formatter.ts:19](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/formatter.ts#L19)* Formats the input of a transaction and converts all values to HEX @@ -101,15 +83,15 @@ Name | Type | ------ | ------ | `tx` | [CeloTx](_types_.md#celotx) | -**Returns:** *[FormattedCeloTx](../interfaces/_types_.formattedcelotx.md)* +**Returns:** *[CeloTx](_types_.md#celotx)* ___ ### inputDefaultBlockNumberFormatter -▸ **inputDefaultBlockNumberFormatter**(`blockNumber`: [BlockNumber](_types_.md#blocknumber) | null | undefined): *[inputDefaultBlockNumberFormatter](_utils_formatter_.md#inputdefaultblocknumberformatter)* +▸ **inputDefaultBlockNumberFormatter**(`blockNumber`: [BlockNumber](_types_.md#blocknumber) | null | undefined): *undefined | string | number | BN‹› | BigNumber‹›* -*Defined in [utils/formatter.ts:160](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/formatter.ts#L160)* +*Defined in [utils/formatter.ts:109](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/formatter.ts#L109)* **Parameters:** @@ -117,15 +99,15 @@ Name | Type | ------ | ------ | `blockNumber` | [BlockNumber](_types_.md#blocknumber) | null | undefined | -**Returns:** *[inputDefaultBlockNumberFormatter](_utils_formatter_.md#inputdefaultblocknumberformatter)* +**Returns:** *undefined | string | number | BN‹› | BigNumber‹›* ___ ### inputSignFormatter -▸ **inputSignFormatter**(`data`: string): *[inputSignFormatter](_utils_formatter_.md#inputsignformatter)* +▸ **inputSignFormatter**(`data`: string): *string* -*Defined in [utils/formatter.ts:330](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/formatter.ts#L330)* +*Defined in [utils/formatter.ts:226](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/formatter.ts#L226)* **Parameters:** @@ -133,7 +115,7 @@ Name | Type | ------ | ------ | `data` | string | -**Returns:** *[inputSignFormatter](_utils_formatter_.md#inputsignformatter)* +**Returns:** *string* ___ @@ -141,7 +123,7 @@ ___ ▸ **outputBigNumberFormatter**(`hex`: string): *string* -*Defined in [utils/formatter.ts:264](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/formatter.ts#L264)* +*Defined in [utils/formatter.ts:212](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/formatter.ts#L212)* **Parameters:** @@ -157,7 +139,7 @@ ___ ▸ **outputBlockFormatter**(`block`: any): *Block* -*Defined in [utils/formatter.ts:202](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/formatter.ts#L202)* +*Defined in [utils/formatter.ts:150](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/formatter.ts#L150)* **Parameters:** @@ -173,7 +155,7 @@ ___ ▸ **outputBlockHeaderFormatter**(`blockHeader`: any): *BlockHeader* -*Defined in [utils/formatter.ts:187](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/formatter.ts#L187)* +*Defined in [utils/formatter.ts:135](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/formatter.ts#L135)* **Parameters:** @@ -189,7 +171,7 @@ ___ ▸ **outputCeloTxFormatter**(`tx`: any): *[CeloTxPending](_types_.md#celotxpending)* -*Defined in [utils/formatter.ts:85](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/formatter.ts#L85)* +*Defined in [utils/formatter.ts:46](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/formatter.ts#L46)* **Parameters:** @@ -205,7 +187,7 @@ ___ ▸ **outputCeloTxReceiptFormatter**(`receipt`: any): *[CeloTxReceipt](_types_.md#celotxreceipt)* -*Defined in [utils/formatter.ts:131](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/formatter.ts#L131)* +*Defined in [utils/formatter.ts:80](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/formatter.ts#L80)* **Parameters:** @@ -221,7 +203,7 @@ ___ ▸ **outputLogFormatter**(`log`: any): *Log* -*Defined in [utils/formatter.ts:230](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/formatter.ts#L230)* +*Defined in [utils/formatter.ts:178](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/formatter.ts#L178)* **Parameters:** @@ -230,19 +212,3 @@ Name | Type | `log` | any | **Returns:** *Log* - -___ - -### parseAccessList - -▸ **parseAccessList**(`accessListRaw`: [AccessListRaw](_types_.md#accesslistraw) | undefined): *AccessList* - -*Defined in [utils/formatter.ts:272](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/formatter.ts#L272)* - -**Parameters:** - -Name | Type | ------- | ------ | -`accessListRaw` | [AccessListRaw](_types_.md#accesslistraw) | undefined | - -**Returns:** *AccessList* diff --git a/packages/docs/sdk/docs/connect/modules/_utils_provider_utils_.md b/packages/docs/sdk/docs/connect/modules/_utils_provider_utils_.md index 9479bd23d16..8265784ec64 100644 --- a/packages/docs/sdk/docs/connect/modules/_utils_provider_utils_.md +++ b/packages/docs/sdk/docs/connect/modules/_utils_provider_utils_.md @@ -13,7 +13,7 @@ ### hasProperty -▸ **hasProperty**‹**T**›(`object`: any, `property`: string): *object is T* +▸ **hasProperty**<**T**>(`object`: any, `property`: string): *object is T* *Defined in [utils/provider-utils.ts:4](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/provider-utils.ts#L4)* @@ -36,7 +36,7 @@ ___ ### stopProvider -▸ **stopProvider**(`defaultProvider`: [Provider](../interfaces/_types_.provider.md)): *[stopProvider](_utils_provider_utils_.md#stopprovider)* +▸ **stopProvider**(`defaultProvider`: [Provider](../interfaces/_types_.provider.md)): *void* *Defined in [utils/provider-utils.ts:9](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/provider-utils.ts#L9)* @@ -48,4 +48,4 @@ Name | Type | ------ | ------ | `defaultProvider` | [Provider](../interfaces/_types_.provider.md) | -**Returns:** *[stopProvider](_utils_provider_utils_.md#stopprovider)* +**Returns:** *void* diff --git a/packages/docs/sdk/docs/connect/modules/_utils_rpc_caller_.md b/packages/docs/sdk/docs/connect/modules/_utils_rpc_caller_.md index 1bf983e5818..c9466afc588 100644 --- a/packages/docs/sdk/docs/connect/modules/_utils_rpc_caller_.md +++ b/packages/docs/sdk/docs/connect/modules/_utils_rpc_caller_.md @@ -6,7 +6,7 @@ ### Classes -* [HttpRpcCaller](../classes/_utils_rpc_caller_.httprpccaller.md) +* [DefaultRpcCaller](../classes/_utils_rpc_caller_.defaultrpccaller.md) ### Interfaces @@ -31,7 +31,7 @@ ___ ### rpcCallHandler -▸ **rpcCallHandler**(`payload`: [JsonRpcPayload](../interfaces/_types_.jsonrpcpayload.md), `handler`: function, `callback`: [Callback](_types_.md#callback)‹[JsonRpcResponse](../interfaces/_types_.jsonrpcresponse.md)›): *[rpcCallHandler](_utils_rpc_caller_.md#rpccallhandler)* +▸ **rpcCallHandler**(`payload`: [JsonRpcPayload](../interfaces/_types_.jsonrpcpayload.md), `handler`: function, `callback`: [Callback](_types_.md#callback)‹[JsonRpcResponse](../interfaces/_types_.jsonrpcresponse.md)›): *void* *Defined in [utils/rpc-caller.ts:8](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/rpc-caller.ts#L8)* @@ -51,4 +51,4 @@ Name | Type | ▪ **callback**: *[Callback](_types_.md#callback)‹[JsonRpcResponse](../interfaces/_types_.jsonrpcresponse.md)›* -**Returns:** *[rpcCallHandler](_utils_rpc_caller_.md#rpccallhandler)* +**Returns:** *void* diff --git a/packages/docs/sdk/docs/connect/modules/_utils_tx_result_.md b/packages/docs/sdk/docs/connect/modules/_utils_tx_result_.md index 30f0e4611ab..73f65763a5b 100644 --- a/packages/docs/sdk/docs/connect/modules/_utils_tx_result_.md +++ b/packages/docs/sdk/docs/connect/modules/_utils_tx_result_.md @@ -16,7 +16,7 @@ ### toTxResult -▸ **toTxResult**(`pe`: PromiEvent‹any›): *[toTxResult](_utils_tx_result_.md#totxresult)* +▸ **toTxResult**(`pe`: PromiEvent‹any›): *[TransactionResult](../classes/_utils_tx_result_.transactionresult.md)‹›* *Defined in [utils/tx-result.ts:10](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/utils/tx-result.ts#L10)* @@ -28,4 +28,4 @@ Name | Type | ------ | ------ | `pe` | PromiEvent‹any› | -**Returns:** *[toTxResult](_utils_tx_result_.md#totxresult)* +**Returns:** *[TransactionResult](../classes/_utils_tx_result_.transactionresult.md)‹›* diff --git a/packages/docs/sdk/docs/contractkit/classes/_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md b/packages/docs/sdk/docs/contractkit/classes/_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md new file mode 100644 index 00000000000..c43c190f2fa --- /dev/null +++ b/packages/docs/sdk/docs/contractkit/classes/_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md @@ -0,0 +1,446 @@ +[@celo/contractkit](../README.md) › [Globals](../globals.md) › ["wrappers/MetaTransactionWallet"](../modules/_wrappers_metatransactionwallet_.md) › [MetaTransactionWalletWrapper](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md) + +# Class: MetaTransactionWalletWrapper + +Class that wraps the MetaTransactionWallet + +## Hierarchy + +* [BaseWrapper](_wrappers_basewrapper_.basewrapper.md)‹MetaTransactionWallet› + + ↳ **MetaTransactionWalletWrapper** + +## Index + +### Constructors + +* [constructor](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#constructor) + +### Properties + +* [_chainId](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#optional-_chainid) +* [_signer](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#optional-_signer) +* [eip712DomainSeparator](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#eip712domainseparator) +* [eventTypes](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#eventtypes) +* [events](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#events) +* [getMetaTransactionDigest](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#getmetatransactiondigest) +* [getMetaTransactionSigner](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#getmetatransactionsigner) +* [isOwner](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#isowner) +* [methodIds](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#methodids) +* [nonce](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#nonce) +* [setEip712DomainSeparator](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#seteip712domainseparator) +* [setSigner](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#setsigner) +* [transferOwnership](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#transferownership) + +### Accessors + +* [address](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#address) + +### Methods + +* [executeMetaTransaction](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#executemetatransaction) +* [executeTransaction](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#executetransaction) +* [executeTransactions](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#executetransactions) +* [getPastEvents](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#getpastevents) +* [signAndExecuteMetaTransaction](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#signandexecutemetatransaction) +* [signMetaTransaction](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#signmetatransaction) +* [signer](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#signer) +* [version](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md#version) + +## Constructors + +### constructor + +\+ **new MetaTransactionWalletWrapper**(`connection`: Connection, `contract`: MetaTransactionWallet): *[MetaTransactionWalletWrapper](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md)* + +*Inherited from [BaseWrapper](_wrappers_basewrapper_.basewrapper.md).[constructor](_wrappers_basewrapper_.basewrapper.md#constructor)* + +*Defined in [packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:32](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/BaseWrapper.ts#L32)* + +**Parameters:** + +Name | Type | +------ | ------ | +`connection` | Connection | +`contract` | MetaTransactionWallet | + +**Returns:** *[MetaTransactionWalletWrapper](_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md)* + +## Properties + +### `Optional` _chainId + +• **_chainId**? : *undefined | number* + +*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:179](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L179)* + +Get and cache the chain ID -- assume it's static for a kit instance + +**`returns`** chainId + +___ + +### `Optional` _signer + +• **_signer**? : *Address* + +*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:192](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L192)* + +Get an cache the signer - it should be static for a Wallet instance + +**`returns`** signer + +___ + +### eip712DomainSeparator + +• **eip712DomainSeparator**: *function* = proxyCall(this.contract.methods.eip712DomainSeparator) + +*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:155](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L155)* + +#### Type declaration: + +▸ (...`args`: InputArgs): *Promise‹Output›* + +**Parameters:** + +Name | Type | +------ | ------ | +`...args` | InputArgs | + +___ + +### eventTypes + +• **eventTypes**: *EventsEnum‹T›* = Object.keys(this.events).reduce>( + (acc, key) => ({ ...acc, [key]: key }), + {} as any + ) + +*Inherited from [BaseWrapper](_wrappers_basewrapper_.basewrapper.md).[eventTypes](_wrappers_basewrapper_.basewrapper.md#eventtypes)* + +*Defined in [packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:63](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/BaseWrapper.ts#L63)* + +___ + +### events + +• **events**: *MetaTransactionWallet["events"]* = this.contract.events + +*Inherited from [BaseWrapper](_wrappers_basewrapper_.basewrapper.md).[events](_wrappers_basewrapper_.basewrapper.md#events)* + +*Defined in [packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:61](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/BaseWrapper.ts#L61)* + +___ + +### getMetaTransactionDigest + +• **getMetaTransactionDigest**: *function* = proxyCall( + this.contract.methods.getMetaTransactionDigest, + this.getMetaTransactionDigestParams, + stringIdentity + ) + +*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:127](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L127)* + +#### Type declaration: + +▸ (...`args`: InputArgs): *Promise‹Output›* + +**Parameters:** + +Name | Type | +------ | ------ | +`...args` | InputArgs | + +___ + +### getMetaTransactionSigner + +• **getMetaTransactionSigner**: *function* = proxyCall( + this.contract.methods.getMetaTransactionSigner, + this.getMetaTransactionSignerParams, + stringIdentity + ) + +*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:149](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L149)* + +#### Type declaration: + +▸ (...`args`: InputArgs): *Promise‹Output›* + +**Parameters:** + +Name | Type | +------ | ------ | +`...args` | InputArgs | + +___ + +### isOwner + +• **isOwner**: *function* = proxyCall(this.contract.methods.isOwner) + +*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:156](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L156)* + +#### Type declaration: + +▸ (...`args`: InputArgs): *Promise‹Output›* + +**Parameters:** + +Name | Type | +------ | ------ | +`...args` | InputArgs | + +___ + +### methodIds + +• **methodIds**: *Record‹keyof T["methods"], string›* = Object.keys(this.contract.methods).reduce, string>>( + (acc, method: Methods) => { + const methodABI = this.contract.options.jsonInterface.find((item) => item.name === method) + + acc[method] = + methodABI === undefined + ? '0x' + : this.connection.getAbiCoder().encodeFunctionSignature(methodABI) + + return acc + }, + {} as any + ) + +*Inherited from [BaseWrapper](_wrappers_basewrapper_.basewrapper.md).[methodIds](_wrappers_basewrapper_.basewrapper.md#methodids)* + +*Defined in [packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:68](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/BaseWrapper.ts#L68)* + +___ + +### nonce + +• **nonce**: *function* = proxyCall(this.contract.methods.nonce, undefined, valueToInt) + +*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:157](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L157)* + +#### Type declaration: + +▸ (...`args`: InputArgs): *Promise‹Output›* + +**Parameters:** + +Name | Type | +------ | ------ | +`...args` | InputArgs | + +___ + +### setEip712DomainSeparator + +• **setEip712DomainSeparator**: *function* = proxySend( + this.connection, + this.contract.methods.setEip712DomainSeparator + ) + +*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:170](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L170)* + +#### Type declaration: + +▸ (): *CeloTransactionObject‹void›* + +___ + +### setSigner + +• **setSigner**: *function* = proxySend( + this.connection, + this.contract.methods.setSigner + ) + +*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:165](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L165)* + +#### Type declaration: + +▸ (`newSigner`: Address): *CeloTransactionObject‹void›* + +**Parameters:** + +Name | Type | +------ | ------ | +`newSigner` | Address | + +___ + +### transferOwnership + +• **transferOwnership**: *function* = proxySend( + this.connection, + this.contract.methods.transferOwnership + ) + +*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:160](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L160)* + +#### Type declaration: + +▸ (`newOwner`: Address): *CeloTransactionObject‹void›* + +**Parameters:** + +Name | Type | +------ | ------ | +`newOwner` | Address | + +## Accessors + +### address + +• **get address**(): *string* + +*Inherited from [BaseWrapper](_wrappers_basewrapper_.basewrapper.md).[address](_wrappers_basewrapper_.basewrapper.md#address)* + +*Defined in [packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:37](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/BaseWrapper.ts#L37)* + +Contract address + +**Returns:** *string* + +## Methods + +### executeMetaTransaction + +▸ **executeMetaTransaction**(`tx`: [TransactionInput](../modules/_wrappers_metatransactionwallet_.md#transactioninput)‹any›, `signature`: Signature): *CeloTransactionObject‹string›* + +*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:68](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L68)* + +Execute a signed meta transaction +Reverts if meta-tx signer is not a signer for the wallet + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`tx` | [TransactionInput](../modules/_wrappers_metatransactionwallet_.md#transactioninput)‹any› | a TransactionInput | +`signature` | Signature | a Signature | + +**Returns:** *CeloTransactionObject‹string›* + +___ + +### executeTransaction + +▸ **executeTransaction**(`tx`: [TransactionInput](../modules/_wrappers_metatransactionwallet_.md#transactioninput)‹any›): *CeloTransactionObject‹string›* + +*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:38](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L38)* + +Execute a transaction originating from the MTW +Reverts if the caller is not a signer + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`tx` | [TransactionInput](../modules/_wrappers_metatransactionwallet_.md#transactioninput)‹any› | a TransactionInput | + +**Returns:** *CeloTransactionObject‹string›* + +___ + +### executeTransactions + +▸ **executeTransactions**(`txs`: Array‹[TransactionInput](../modules/_wrappers_metatransactionwallet_.md#transactioninput)‹any››): *CeloTransactionObject‹object›* + +*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:51](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L51)* + +Execute a batch of transactions originating from the MTW +Reverts if the caller is not a signer + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`txs` | Array‹[TransactionInput](../modules/_wrappers_metatransactionwallet_.md#transactioninput)‹any›› | An array of TransactionInput | + +**Returns:** *CeloTransactionObject‹object›* + +___ + +### getPastEvents + +▸ **getPastEvents**(`event`: Events‹MetaTransactionWallet›, `options`: PastEventOptions): *Promise‹EventLog[]›* + +*Inherited from [BaseWrapper](_wrappers_basewrapper_.basewrapper.md).[getPastEvents](_wrappers_basewrapper_.basewrapper.md#getpastevents)* + +*Defined in [packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:57](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/BaseWrapper.ts#L57)* + +Contract getPastEvents + +**Parameters:** + +Name | Type | +------ | ------ | +`event` | Events‹MetaTransactionWallet› | +`options` | PastEventOptions | + +**Returns:** *Promise‹EventLog[]›* + +___ + +### signAndExecuteMetaTransaction + +▸ **signAndExecuteMetaTransaction**(`tx`: [TransactionInput](../modules/_wrappers_metatransactionwallet_.md#transactioninput)‹any›): *Promise‹CeloTransactionObject‹string››* + +*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:112](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L112)* + +Execute a signed meta transaction +Reverts if meta-tx signer is not a signer for the wallet + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`tx` | [TransactionInput](../modules/_wrappers_metatransactionwallet_.md#transactioninput)‹any› | a TransactionInput | + +**Returns:** *Promise‹CeloTransactionObject‹string››* + +___ + +### signMetaTransaction + +▸ **signMetaTransaction**(`tx`: [TransactionInput](../modules/_wrappers_metatransactionwallet_.md#transactioninput)‹any›, `nonce?`: undefined | number): *Promise‹Signature›* + +*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:93](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L93)* + +Signs a meta transaction as EIP712 typed data + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`tx` | [TransactionInput](../modules/_wrappers_metatransactionwallet_.md#transactioninput)‹any› | a TransactionWrapper | +`nonce?` | undefined | number | Optional -- will query contract state if not passed | + +**Returns:** *Promise‹Signature›* + +signature a Signature + +___ + +### signer + +▸ **signer**(): *Promise‹string›* + +*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:193](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L193)* + +**Returns:** *Promise‹string›* + +___ + +### version + +▸ **version**(): *Promise‹NonNullable‹T["methods"] extends object ? ContractVersion<> : never››* + +*Inherited from [BaseWrapper](_wrappers_basewrapper_.basewrapper.md).[version](_wrappers_basewrapper_.basewrapper.md#version)* + +*Defined in [packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:41](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/BaseWrapper.ts#L41)* + +**Returns:** *Promise‹NonNullable‹T["methods"] extends object ? ContractVersion<> : never››* diff --git a/packages/docs/sdk/docs/contractkit/classes/_wrappers_metatransactionwalletdeployer_.metatransactionwalletdeployerwrapper.md b/packages/docs/sdk/docs/contractkit/classes/_wrappers_metatransactionwalletdeployer_.metatransactionwalletdeployerwrapper.md new file mode 100644 index 00000000000..65d6a881ef8 --- /dev/null +++ b/packages/docs/sdk/docs/contractkit/classes/_wrappers_metatransactionwalletdeployer_.metatransactionwalletdeployerwrapper.md @@ -0,0 +1,160 @@ +[@celo/contractkit](../README.md) › [Globals](../globals.md) › ["wrappers/MetaTransactionWalletDeployer"](../modules/_wrappers_metatransactionwalletdeployer_.md) › [MetaTransactionWalletDeployerWrapper](_wrappers_metatransactionwalletdeployer_.metatransactionwalletdeployerwrapper.md) + +# Class: MetaTransactionWalletDeployerWrapper + +## Hierarchy + +* [BaseWrapper](_wrappers_basewrapper_.basewrapper.md)‹MetaTransactionWalletDeployer› + + ↳ **MetaTransactionWalletDeployerWrapper** + +## Index + +### Constructors + +* [constructor](_wrappers_metatransactionwalletdeployer_.metatransactionwalletdeployerwrapper.md#constructor) + +### Properties + +* [deploy](_wrappers_metatransactionwalletdeployer_.metatransactionwalletdeployerwrapper.md#deploy) +* [eventTypes](_wrappers_metatransactionwalletdeployer_.metatransactionwalletdeployerwrapper.md#eventtypes) +* [events](_wrappers_metatransactionwalletdeployer_.metatransactionwalletdeployerwrapper.md#events) +* [methodIds](_wrappers_metatransactionwalletdeployer_.metatransactionwalletdeployerwrapper.md#methodids) + +### Accessors + +* [address](_wrappers_metatransactionwalletdeployer_.metatransactionwalletdeployerwrapper.md#address) + +### Methods + +* [getPastEvents](_wrappers_metatransactionwalletdeployer_.metatransactionwalletdeployerwrapper.md#getpastevents) +* [version](_wrappers_metatransactionwalletdeployer_.metatransactionwalletdeployerwrapper.md#version) + +## Constructors + +### constructor + +\+ **new MetaTransactionWalletDeployerWrapper**(`connection`: Connection, `contract`: MetaTransactionWalletDeployer): *[MetaTransactionWalletDeployerWrapper](_wrappers_metatransactionwalletdeployer_.metatransactionwalletdeployerwrapper.md)* + +*Inherited from [BaseWrapper](_wrappers_basewrapper_.basewrapper.md).[constructor](_wrappers_basewrapper_.basewrapper.md#constructor)* + +*Defined in [packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:32](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/BaseWrapper.ts#L32)* + +**Parameters:** + +Name | Type | +------ | ------ | +`connection` | Connection | +`contract` | MetaTransactionWalletDeployer | + +**Returns:** *[MetaTransactionWalletDeployerWrapper](_wrappers_metatransactionwalletdeployer_.metatransactionwalletdeployerwrapper.md)* + +## Properties + +### deploy + +• **deploy**: *function* = proxySend(this.connection, this.contract.methods.deploy) + +*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWalletDeployer.ts:5](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWalletDeployer.ts#L5)* + +#### Type declaration: + +▸ (...`args`: InputArgs): *CeloTransactionObject‹Output›* + +**Parameters:** + +Name | Type | +------ | ------ | +`...args` | InputArgs | + +___ + +### eventTypes + +• **eventTypes**: *EventsEnum‹T›* = Object.keys(this.events).reduce>( + (acc, key) => ({ ...acc, [key]: key }), + {} as any + ) + +*Inherited from [BaseWrapper](_wrappers_basewrapper_.basewrapper.md).[eventTypes](_wrappers_basewrapper_.basewrapper.md#eventtypes)* + +*Defined in [packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:63](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/BaseWrapper.ts#L63)* + +___ + +### events + +• **events**: *MetaTransactionWalletDeployer["events"]* = this.contract.events + +*Inherited from [BaseWrapper](_wrappers_basewrapper_.basewrapper.md).[events](_wrappers_basewrapper_.basewrapper.md#events)* + +*Defined in [packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:61](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/BaseWrapper.ts#L61)* + +___ + +### methodIds + +• **methodIds**: *Record‹keyof T["methods"], string›* = Object.keys(this.contract.methods).reduce, string>>( + (acc, method: Methods) => { + const methodABI = this.contract.options.jsonInterface.find((item) => item.name === method) + + acc[method] = + methodABI === undefined + ? '0x' + : this.connection.getAbiCoder().encodeFunctionSignature(methodABI) + + return acc + }, + {} as any + ) + +*Inherited from [BaseWrapper](_wrappers_basewrapper_.basewrapper.md).[methodIds](_wrappers_basewrapper_.basewrapper.md#methodids)* + +*Defined in [packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:68](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/BaseWrapper.ts#L68)* + +## Accessors + +### address + +• **get address**(): *string* + +*Inherited from [BaseWrapper](_wrappers_basewrapper_.basewrapper.md).[address](_wrappers_basewrapper_.basewrapper.md#address)* + +*Defined in [packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:37](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/BaseWrapper.ts#L37)* + +Contract address + +**Returns:** *string* + +## Methods + +### getPastEvents + +▸ **getPastEvents**(`event`: Events‹MetaTransactionWalletDeployer›, `options`: PastEventOptions): *Promise‹EventLog[]›* + +*Inherited from [BaseWrapper](_wrappers_basewrapper_.basewrapper.md).[getPastEvents](_wrappers_basewrapper_.basewrapper.md#getpastevents)* + +*Defined in [packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:57](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/BaseWrapper.ts#L57)* + +Contract getPastEvents + +**Parameters:** + +Name | Type | +------ | ------ | +`event` | Events‹MetaTransactionWalletDeployer› | +`options` | PastEventOptions | + +**Returns:** *Promise‹EventLog[]›* + +___ + +### version + +▸ **version**(): *Promise‹NonNullable‹T["methods"] extends object ? ContractVersion<> : never››* + +*Inherited from [BaseWrapper](_wrappers_basewrapper_.basewrapper.md).[version](_wrappers_basewrapper_.basewrapper.md#version)* + +*Defined in [packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:41](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/BaseWrapper.ts#L41)* + +**Returns:** *Promise‹NonNullable‹T["methods"] extends object ? ContractVersion<> : never››* diff --git a/packages/docs/sdk/docs/contractkit/interfaces/_wrappers_metatransactionwallet_.rawtransaction.md b/packages/docs/sdk/docs/contractkit/interfaces/_wrappers_metatransactionwallet_.rawtransaction.md new file mode 100644 index 00000000000..7ba726769a5 --- /dev/null +++ b/packages/docs/sdk/docs/contractkit/interfaces/_wrappers_metatransactionwallet_.rawtransaction.md @@ -0,0 +1,39 @@ +[@celo/contractkit](../README.md) › [Globals](../globals.md) › ["wrappers/MetaTransactionWallet"](../modules/_wrappers_metatransactionwallet_.md) › [RawTransaction](_wrappers_metatransactionwallet_.rawtransaction.md) + +# Interface: RawTransaction + +## Hierarchy + +* **RawTransaction** + +## Index + +### Properties + +* [data](_wrappers_metatransactionwallet_.rawtransaction.md#data) +* [destination](_wrappers_metatransactionwallet_.rawtransaction.md#destination) +* [value](_wrappers_metatransactionwallet_.rawtransaction.md#value) + +## Properties + +### data + +• **data**: *string* + +*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:24](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L24)* + +___ + +### destination + +• **destination**: *string* + +*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:22](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L22)* + +___ + +### value + +• **value**: *string* + +*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:23](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L23)* diff --git a/packages/docs/sdk/docs/contractkit/interfaces/_wrappers_metatransactionwallet_.transactionobjectwithvalue.md b/packages/docs/sdk/docs/contractkit/interfaces/_wrappers_metatransactionwallet_.transactionobjectwithvalue.md new file mode 100644 index 00000000000..9a8c6911141 --- /dev/null +++ b/packages/docs/sdk/docs/contractkit/interfaces/_wrappers_metatransactionwallet_.transactionobjectwithvalue.md @@ -0,0 +1,34 @@ +[@celo/contractkit](../README.md) › [Globals](../globals.md) › ["wrappers/MetaTransactionWallet"](../modules/_wrappers_metatransactionwallet_.md) › [TransactionObjectWithValue](_wrappers_metatransactionwallet_.transactionobjectwithvalue.md) + +# Interface: TransactionObjectWithValue <**T**> + +## Type parameters + +▪ **T** + +## Hierarchy + +* **TransactionObjectWithValue** + +## Index + +### Properties + +* [txo](_wrappers_metatransactionwallet_.transactionobjectwithvalue.md#txo) +* [value](_wrappers_metatransactionwallet_.transactionobjectwithvalue.md#value) + +## Properties + +### txo + +• **txo**: *CeloTxObject‹T›* + +*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:17](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L17)* + +___ + +### value + +• **value**: *BigNumber.Value* + +*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:18](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L18)* diff --git a/packages/docs/sdk/docs/contractkit/modules/_wrappers_metatransactionwallet_.md b/packages/docs/sdk/docs/contractkit/modules/_wrappers_metatransactionwallet_.md new file mode 100644 index 00000000000..bca62b0e8cc --- /dev/null +++ b/packages/docs/sdk/docs/contractkit/modules/_wrappers_metatransactionwallet_.md @@ -0,0 +1,117 @@ +[@celo/contractkit](../README.md) › [Globals](../globals.md) › ["wrappers/MetaTransactionWallet"](_wrappers_metatransactionwallet_.md) + +# Module: "wrappers/MetaTransactionWallet" + +## Index + +### Classes + +* [MetaTransactionWalletWrapper](../classes/_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md) + +### Interfaces + +* [RawTransaction](../interfaces/_wrappers_metatransactionwallet_.rawtransaction.md) +* [TransactionObjectWithValue](../interfaces/_wrappers_metatransactionwallet_.transactionobjectwithvalue.md) + +### Type aliases + +* [MetaTransactionWalletWrapperType](_wrappers_metatransactionwallet_.md#metatransactionwalletwrappertype) +* [TransactionInput](_wrappers_metatransactionwallet_.md#transactioninput) + +### Functions + +* [buildMetaTxTypedData](_wrappers_metatransactionwallet_.md#const-buildmetatxtypeddata) +* [toRawTransaction](_wrappers_metatransactionwallet_.md#const-torawtransaction) +* [toTransactionBatch](_wrappers_metatransactionwallet_.md#const-totransactionbatch) + +## Type aliases + +### MetaTransactionWalletWrapperType + +Ƭ **MetaTransactionWalletWrapperType**: *[MetaTransactionWalletWrapper](../classes/_wrappers_metatransactionwallet_.metatransactionwalletwrapper.md)* + +*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:201](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L201)* + +___ + +### TransactionInput + +Ƭ **TransactionInput**: *CeloTxObject‹T› | [TransactionObjectWithValue](../interfaces/_wrappers_metatransactionwallet_.transactionobjectwithvalue.md)‹T› | [RawTransaction](../interfaces/_wrappers_metatransactionwallet_.rawtransaction.md)* + +*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:27](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L27)* + +## Functions + +### `Const` buildMetaTxTypedData + +▸ **buildMetaTxTypedData**(`walletAddress`: Address, `tx`: [RawTransaction](../interfaces/_wrappers_metatransactionwallet_.rawtransaction.md), `nonce`: number, `chainId`: number): *EIP712TypedData* + +*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:257](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L257)* + +**Parameters:** + +Name | Type | +------ | ------ | +`walletAddress` | Address | +`tx` | [RawTransaction](../interfaces/_wrappers_metatransactionwallet_.rawtransaction.md) | +`nonce` | number | +`chainId` | number | + +**Returns:** *EIP712TypedData* + +___ + +### `Const` toRawTransaction + +▸ **toRawTransaction**(`tx`: [TransactionInput](_wrappers_metatransactionwallet_.md#transactioninput)‹any›): *[RawTransaction](../interfaces/_wrappers_metatransactionwallet_.rawtransaction.md)* + +*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:212](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L212)* + +Turns any possible way to pass in a transaction into the raw values +that are actually required. This is used both internally to normalize +ways in which transactions are passed in but also public in order +for one instance of ContractKit to serialize a meta transaction to +send over the wire and be consumed somewhere else. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`tx` | [TransactionInput](_wrappers_metatransactionwallet_.md#transactioninput)‹any› | TransactionInput union of all the ways we expect transactions | + +**Returns:** *[RawTransaction](../interfaces/_wrappers_metatransactionwallet_.rawtransaction.md)* + +a RawTransactions that's serializable + +___ + +### `Const` toTransactionBatch + +▸ **toTransactionBatch**(`txs`: Array‹[TransactionInput](_wrappers_metatransactionwallet_.md#transactioninput)‹any››): *object* + +*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts:240](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts#L240)* + +Turns an array of transaction inputs into the argument that +need to be passed to the executeTransactions call. +Main transformation is that all the `data` parts of each +transaction in the batch are concatenated and an array +of lengths is constructed. +This is a gas optimisation on the contract. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`txs` | Array‹[TransactionInput](_wrappers_metatransactionwallet_.md#transactioninput)‹any›› | Array> array of txs | + +**Returns:** *object* + +Params for the executeTransactions method call + +* **callData**: *string* + +* **callDataLengths**: *number[]* + +* **destinations**: *string[]* + +* **values**: *string[]* diff --git a/packages/docs/sdk/docs/contractkit/modules/_wrappers_metatransactionwalletdeployer_.md b/packages/docs/sdk/docs/contractkit/modules/_wrappers_metatransactionwalletdeployer_.md new file mode 100644 index 00000000000..b8340fc5d5b --- /dev/null +++ b/packages/docs/sdk/docs/contractkit/modules/_wrappers_metatransactionwalletdeployer_.md @@ -0,0 +1,21 @@ +[@celo/contractkit](../README.md) › [Globals](../globals.md) › ["wrappers/MetaTransactionWalletDeployer"](_wrappers_metatransactionwalletdeployer_.md) + +# Module: "wrappers/MetaTransactionWalletDeployer" + +## Index + +### Classes + +* [MetaTransactionWalletDeployerWrapper](../classes/_wrappers_metatransactionwalletdeployer_.metatransactionwalletdeployerwrapper.md) + +### Type aliases + +* [MetaTransactionWalletDeployerWrapperType](_wrappers_metatransactionwalletdeployer_.md#metatransactionwalletdeployerwrappertype) + +## Type aliases + +### MetaTransactionWalletDeployerWrapperType + +Ƭ **MetaTransactionWalletDeployerWrapperType**: *[MetaTransactionWalletDeployerWrapper](../classes/_wrappers_metatransactionwalletdeployer_.metatransactionwalletdeployerwrapper.md)* + +*Defined in [packages/sdk/contractkit/src/wrappers/MetaTransactionWalletDeployer.ts:8](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/contractkit/src/wrappers/MetaTransactionWalletDeployer.ts#L8)* diff --git a/packages/docs/sdk/docs/cryptographic-utils/classes/_node_modules_bls12377js_src_f2_.f2.md b/packages/docs/sdk/docs/cryptographic-utils/classes/_node_modules_bls12377js_src_f2_.f2.md new file mode 100644 index 00000000000..b3bf83aa65b --- /dev/null +++ b/packages/docs/sdk/docs/cryptographic-utils/classes/_node_modules_bls12377js_src_f2_.f2.md @@ -0,0 +1,225 @@ +[@celo/cryptographic-utils](../README.md) › [Globals](../globals.md) › ["node_modules/bls12377js/src/f2"](../modules/_node_modules_bls12377js_src_f2_.md) › [F2](_node_modules_bls12377js_src_f2_.f2.md) + +# Class: F2 + +## Hierarchy + +* **F2** + +## Implements + +* [FieldSpec](../interfaces/_node_modules_bls12377js_src_defs_.fieldspec.md)‹[F2](_node_modules_bls12377js_src_f2_.f2.md)› + +## Index + +### Methods + +* [add](_node_modules_bls12377js_src_f2_.f2.md#add) +* [clone](_node_modules_bls12377js_src_f2_.f2.md#clone) +* [equals](_node_modules_bls12377js_src_f2_.f2.md#equals) +* [inverse](_node_modules_bls12377js_src_f2_.f2.md#inverse) +* [multiply](_node_modules_bls12377js_src_f2_.f2.md#multiply) +* [negate](_node_modules_bls12377js_src_f2_.f2.md#negate) +* [power](_node_modules_bls12377js_src_f2_.f2.md#power) +* [sqrt](_node_modules_bls12377js_src_f2_.f2.md#sqrt) +* [subtract](_node_modules_bls12377js_src_f2_.f2.md#subtract) +* [toFs](_node_modules_bls12377js_src_f2_.f2.md#tofs) +* [toString](_node_modules_bls12377js_src_f2_.f2.md#tostring) +* [fromElements](_node_modules_bls12377js_src_f2_.f2.md#static-fromelements) +* [one](_node_modules_bls12377js_src_f2_.f2.md#static-one) +* [zero](_node_modules_bls12377js_src_f2_.f2.md#static-zero) + +## Methods + +### add + +▸ **add**(`b`: [F2](_node_modules_bls12377js_src_f2_.f2.md)): *[F2](_node_modules_bls12377js_src_f2_.f2.md)* + +Defined in node_modules/bls12377js/src/f2.ts:25 + +**Parameters:** + +Name | Type | +------ | ------ | +`b` | [F2](_node_modules_bls12377js_src_f2_.f2.md) | + +**Returns:** *[F2](_node_modules_bls12377js_src_f2_.f2.md)* + +___ + +### clone + +▸ **clone**(): *[F2](_node_modules_bls12377js_src_f2_.f2.md)* + +*Implementation of [FieldSpec](../interfaces/_node_modules_bls12377js_src_defs_.fieldspec.md)* + +Defined in node_modules/bls12377js/src/f2.ts:110 + +**Returns:** *[F2](_node_modules_bls12377js_src_f2_.f2.md)* + +___ + +### equals + +▸ **equals**(`b`: [F2](_node_modules_bls12377js_src_f2_.f2.md)): *boolean* + +Defined in node_modules/bls12377js/src/f2.ts:21 + +**Parameters:** + +Name | Type | +------ | ------ | +`b` | [F2](_node_modules_bls12377js_src_f2_.f2.md) | + +**Returns:** *boolean* + +___ + +### inverse + +▸ **inverse**(): *[F2](_node_modules_bls12377js_src_f2_.f2.md)* + +*Implementation of [FieldSpec](../interfaces/_node_modules_bls12377js_src_defs_.fieldspec.md)* + +Defined in node_modules/bls12377js/src/f2.ts:117 + +**Returns:** *[F2](_node_modules_bls12377js_src_f2_.f2.md)* + +___ + +### multiply + +▸ **multiply**(`b`: [F2](_node_modules_bls12377js_src_f2_.f2.md)): *[F2](_node_modules_bls12377js_src_f2_.f2.md)* + +Defined in node_modules/bls12377js/src/f2.ts:61 + +**Parameters:** + +Name | Type | +------ | ------ | +`b` | [F2](_node_modules_bls12377js_src_f2_.f2.md) | + +**Returns:** *[F2](_node_modules_bls12377js_src_f2_.f2.md)* + +___ + +### negate + +▸ **negate**(): *[F2](_node_modules_bls12377js_src_f2_.f2.md)* + +*Implementation of [FieldSpec](../interfaces/_node_modules_bls12377js_src_defs_.fieldspec.md)* + +Defined in node_modules/bls12377js/src/f2.ts:121 + +**Returns:** *[F2](_node_modules_bls12377js_src_f2_.f2.md)* + +___ + +### power + +▸ **power**(`e`: BigInteger): *[F2](_node_modules_bls12377js_src_f2_.f2.md)* + +*Implementation of [FieldSpec](../interfaces/_node_modules_bls12377js_src_defs_.fieldspec.md)* + +Defined in node_modules/bls12377js/src/f2.ts:39 + +**Parameters:** + +Name | Type | +------ | ------ | +`e` | BigInteger | + +**Returns:** *[F2](_node_modules_bls12377js_src_f2_.f2.md)* + +___ + +### sqrt + +▸ **sqrt**(): *[F2](_node_modules_bls12377js_src_f2_.f2.md)* + +*Implementation of [FieldSpec](../interfaces/_node_modules_bls12377js_src_defs_.fieldspec.md)* + +Defined in node_modules/bls12377js/src/f2.ts:68 + +**Returns:** *[F2](_node_modules_bls12377js_src_f2_.f2.md)* + +___ + +### subtract + +▸ **subtract**(`b`: [F2](_node_modules_bls12377js_src_f2_.f2.md)): *[F2](_node_modules_bls12377js_src_f2_.f2.md)* + +Defined in node_modules/bls12377js/src/f2.ts:32 + +**Parameters:** + +Name | Type | +------ | ------ | +`b` | [F2](_node_modules_bls12377js_src_f2_.f2.md) | + +**Returns:** *[F2](_node_modules_bls12377js_src_f2_.f2.md)* + +___ + +### toFs + +▸ **toFs**(): *[F](_node_modules_bls12377js_src_f_.f.md)[]* + +Defined in node_modules/bls12377js/src/f2.ts:128 + +**Returns:** *[F](_node_modules_bls12377js_src_f_.f.md)[]* + +___ + +### toString + +▸ **toString**(`base?`: undefined | number): *string* + +*Implementation of [FieldSpec](../interfaces/_node_modules_bls12377js_src_defs_.fieldspec.md)* + +Defined in node_modules/bls12377js/src/f2.ts:132 + +**Parameters:** + +Name | Type | +------ | ------ | +`base?` | undefined | number | + +**Returns:** *string* + +___ + +### `Static` fromElements + +▸ **fromElements**(`c0`: [F](_node_modules_bls12377js_src_f_.f.md), `c1`: [F](_node_modules_bls12377js_src_f_.f.md)): *[F2](_node_modules_bls12377js_src_f2_.f2.md)* + +Defined in node_modules/bls12377js/src/f2.ts:13 + +**Parameters:** + +Name | Type | +------ | ------ | +`c0` | [F](_node_modules_bls12377js_src_f_.f.md) | +`c1` | [F](_node_modules_bls12377js_src_f_.f.md) | + +**Returns:** *[F2](_node_modules_bls12377js_src_f2_.f2.md)* + +___ + +### `Static` one + +▸ **one**(): *[F2](_node_modules_bls12377js_src_f2_.f2.md)* + +Defined in node_modules/bls12377js/src/f2.ts:96 + +**Returns:** *[F2](_node_modules_bls12377js_src_f2_.f2.md)* + +___ + +### `Static` zero + +▸ **zero**(): *[F2](_node_modules_bls12377js_src_f2_.f2.md)* + +Defined in node_modules/bls12377js/src/f2.ts:103 + +**Returns:** *[F2](_node_modules_bls12377js_src_f2_.f2.md)* diff --git a/packages/docs/sdk/docs/cryptographic-utils/classes/_node_modules_bls12377js_src_f_.f.md b/packages/docs/sdk/docs/cryptographic-utils/classes/_node_modules_bls12377js_src_f_.f.md new file mode 100644 index 00000000000..f03ba03faff --- /dev/null +++ b/packages/docs/sdk/docs/cryptographic-utils/classes/_node_modules_bls12377js_src_f_.f.md @@ -0,0 +1,242 @@ +[@celo/cryptographic-utils](../README.md) › [Globals](../globals.md) › ["node_modules/bls12377js/src/f"](../modules/_node_modules_bls12377js_src_f_.md) › [F](_node_modules_bls12377js_src_f_.f.md) + +# Class: F + +## Hierarchy + +* **F** + +## Implements + +* [FieldSpec](../interfaces/_node_modules_bls12377js_src_defs_.fieldspec.md)‹[F](_node_modules_bls12377js_src_f_.f.md)› + +## Index + +### Methods + +* [add](_node_modules_bls12377js_src_f_.f.md#add) +* [clone](_node_modules_bls12377js_src_f_.f.md#clone) +* [equals](_node_modules_bls12377js_src_f_.f.md#equals) +* [inverse](_node_modules_bls12377js_src_f_.f.md#inverse) +* [multiply](_node_modules_bls12377js_src_f_.f.md#multiply) +* [negate](_node_modules_bls12377js_src_f_.f.md#negate) +* [power](_node_modules_bls12377js_src_f_.f.md#power) +* [sqrt](_node_modules_bls12377js_src_f_.f.md#sqrt) +* [subtract](_node_modules_bls12377js_src_f_.f.md#subtract) +* [toBig](_node_modules_bls12377js_src_f_.f.md#tobig) +* [toString](_node_modules_bls12377js_src_f_.f.md#tostring) +* [fromBig](_node_modules_bls12377js_src_f_.f.md#static-frombig) +* [fromString](_node_modules_bls12377js_src_f_.f.md#static-fromstring) +* [one](_node_modules_bls12377js_src_f_.f.md#static-one) +* [zero](_node_modules_bls12377js_src_f_.f.md#static-zero) + +## Methods + +### add + +▸ **add**(`b`: [F](_node_modules_bls12377js_src_f_.f.md)): *[F](_node_modules_bls12377js_src_f_.f.md)* + +Defined in node_modules/bls12377js/src/f.ts:34 + +**Parameters:** + +Name | Type | +------ | ------ | +`b` | [F](_node_modules_bls12377js_src_f_.f.md) | + +**Returns:** *[F](_node_modules_bls12377js_src_f_.f.md)* + +___ + +### clone + +▸ **clone**(): *[F](_node_modules_bls12377js_src_f_.f.md)* + +*Implementation of [FieldSpec](../interfaces/_node_modules_bls12377js_src_defs_.fieldspec.md)* + +Defined in node_modules/bls12377js/src/f.ts:128 + +**Returns:** *[F](_node_modules_bls12377js_src_f_.f.md)* + +___ + +### equals + +▸ **equals**(`b`: [F](_node_modules_bls12377js_src_f_.f.md)): *boolean* + +Defined in node_modules/bls12377js/src/f.ts:30 + +**Parameters:** + +Name | Type | +------ | ------ | +`b` | [F](_node_modules_bls12377js_src_f_.f.md) | + +**Returns:** *boolean* + +___ + +### inverse + +▸ **inverse**(): *[F](_node_modules_bls12377js_src_f_.f.md)* + +*Implementation of [FieldSpec](../interfaces/_node_modules_bls12377js_src_defs_.fieldspec.md)* + +Defined in node_modules/bls12377js/src/f.ts:112 + +**Returns:** *[F](_node_modules_bls12377js_src_f_.f.md)* + +___ + +### multiply + +▸ **multiply**(`b`: [F](_node_modules_bls12377js_src_f_.f.md)): *[F](_node_modules_bls12377js_src_f_.f.md)* + +Defined in node_modules/bls12377js/src/f.ts:42 + +**Parameters:** + +Name | Type | +------ | ------ | +`b` | [F](_node_modules_bls12377js_src_f_.f.md) | + +**Returns:** *[F](_node_modules_bls12377js_src_f_.f.md)* + +___ + +### negate + +▸ **negate**(): *[F](_node_modules_bls12377js_src_f_.f.md)* + +*Implementation of [FieldSpec](../interfaces/_node_modules_bls12377js_src_defs_.fieldspec.md)* + +Defined in node_modules/bls12377js/src/f.ts:116 + +**Returns:** *[F](_node_modules_bls12377js_src_f_.f.md)* + +___ + +### power + +▸ **power**(`e`: BigInteger): *[F](_node_modules_bls12377js_src_f_.f.md)* + +*Implementation of [FieldSpec](../interfaces/_node_modules_bls12377js_src_defs_.fieldspec.md)* + +Defined in node_modules/bls12377js/src/f.ts:46 + +**Parameters:** + +Name | Type | +------ | ------ | +`e` | BigInteger | + +**Returns:** *[F](_node_modules_bls12377js_src_f_.f.md)* + +___ + +### sqrt + +▸ **sqrt**(): *[F](_node_modules_bls12377js_src_f_.f.md)* + +*Implementation of [FieldSpec](../interfaces/_node_modules_bls12377js_src_defs_.fieldspec.md)* + +Defined in node_modules/bls12377js/src/f.ts:65 + +**Returns:** *[F](_node_modules_bls12377js_src_f_.f.md)* + +___ + +### subtract + +▸ **subtract**(`b`: [F](_node_modules_bls12377js_src_f_.f.md)): *[F](_node_modules_bls12377js_src_f_.f.md)* + +Defined in node_modules/bls12377js/src/f.ts:38 + +**Parameters:** + +Name | Type | +------ | ------ | +`b` | [F](_node_modules_bls12377js_src_f_.f.md) | + +**Returns:** *[F](_node_modules_bls12377js_src_f_.f.md)* + +___ + +### toBig + +▸ **toBig**(): *BigInteger* + +Defined in node_modules/bls12377js/src/f.ts:61 + +**Returns:** *BigInteger* + +___ + +### toString + +▸ **toString**(`base?`: undefined | number): *string* + +*Implementation of [FieldSpec](../interfaces/_node_modules_bls12377js_src_defs_.fieldspec.md)* + +Defined in node_modules/bls12377js/src/f.ts:132 + +**Parameters:** + +Name | Type | +------ | ------ | +`base?` | undefined | number | + +**Returns:** *string* + +___ + +### `Static` fromBig + +▸ **fromBig**(`num`: BigInteger): *[F](_node_modules_bls12377js_src_f_.f.md)* + +Defined in node_modules/bls12377js/src/f.ts:20 + +**Parameters:** + +Name | Type | +------ | ------ | +`num` | BigInteger | + +**Returns:** *[F](_node_modules_bls12377js_src_f_.f.md)* + +___ + +### `Static` fromString + +▸ **fromString**(`num`: string, `base?`: undefined | number): *[F](_node_modules_bls12377js_src_f_.f.md)* + +Defined in node_modules/bls12377js/src/f.ts:10 + +**Parameters:** + +Name | Type | +------ | ------ | +`num` | string | +`base?` | undefined | number | + +**Returns:** *[F](_node_modules_bls12377js_src_f_.f.md)* + +___ + +### `Static` one + +▸ **one**(): *[F](_node_modules_bls12377js_src_f_.f.md)* + +Defined in node_modules/bls12377js/src/f.ts:120 + +**Returns:** *[F](_node_modules_bls12377js_src_f_.f.md)* + +___ + +### `Static` zero + +▸ **zero**(): *[F](_node_modules_bls12377js_src_f_.f.md)* + +Defined in node_modules/bls12377js/src/f.ts:124 + +**Returns:** *[F](_node_modules_bls12377js_src_f_.f.md)* diff --git a/packages/docs/sdk/docs/cryptographic-utils/classes/_node_modules_bls12377js_src_g1_.g1.md b/packages/docs/sdk/docs/cryptographic-utils/classes/_node_modules_bls12377js_src_g1_.g1.md new file mode 100644 index 00000000000..16149598c92 --- /dev/null +++ b/packages/docs/sdk/docs/cryptographic-utils/classes/_node_modules_bls12377js_src_g1_.g1.md @@ -0,0 +1,182 @@ +[@celo/cryptographic-utils](../README.md) › [Globals](../globals.md) › ["node_modules/bls12377js/src/g1"](../modules/_node_modules_bls12377js_src_g1_.md) › [G1](_node_modules_bls12377js_src_g1_.g1.md) + +# Class: G1 + +## Hierarchy + +* **G1** + +## Implements + +* [GroupSpec](../interfaces/_node_modules_bls12377js_src_defs_.groupspec.md)‹[F](_node_modules_bls12377js_src_f_.f.md), [G1](_node_modules_bls12377js_src_g1_.g1.md)› + +## Index + +### Methods + +* [add](_node_modules_bls12377js_src_g1_.g1.md#add) +* [dbl](_node_modules_bls12377js_src_g1_.g1.md#dbl) +* [equals](_node_modules_bls12377js_src_g1_.g1.md#equals) +* [negate](_node_modules_bls12377js_src_g1_.g1.md#negate) +* [scalarMult](_node_modules_bls12377js_src_g1_.g1.md#scalarmult) +* [toAffine](_node_modules_bls12377js_src_g1_.g1.md#toaffine) +* [toString](_node_modules_bls12377js_src_g1_.g1.md#tostring) +* [x](_node_modules_bls12377js_src_g1_.g1.md#x) +* [y](_node_modules_bls12377js_src_g1_.g1.md#y) +* [z](_node_modules_bls12377js_src_g1_.g1.md#z) +* [fromElements](_node_modules_bls12377js_src_g1_.g1.md#static-fromelements) + +## Methods + +### add + +▸ **add**(`p2`: [G1](_node_modules_bls12377js_src_g1_.g1.md)): *[G1](_node_modules_bls12377js_src_g1_.g1.md)* + +Defined in node_modules/bls12377js/src/g1.ts:22 + +**Parameters:** + +Name | Type | +------ | ------ | +`p2` | [G1](_node_modules_bls12377js_src_g1_.g1.md) | + +**Returns:** *[G1](_node_modules_bls12377js_src_g1_.g1.md)* + +___ + +### dbl + +▸ **dbl**(): *[G1](_node_modules_bls12377js_src_g1_.g1.md)* + +*Implementation of [GroupSpec](../interfaces/_node_modules_bls12377js_src_defs_.groupspec.md)* + +Defined in node_modules/bls12377js/src/g1.ts:29 + +**Returns:** *[G1](_node_modules_bls12377js_src_g1_.g1.md)* + +___ + +### equals + +▸ **equals**(`p2`: [G1](_node_modules_bls12377js_src_g1_.g1.md)): *boolean* + +Defined in node_modules/bls12377js/src/g1.ts:44 + +**Parameters:** + +Name | Type | +------ | ------ | +`p2` | [G1](_node_modules_bls12377js_src_g1_.g1.md) | + +**Returns:** *boolean* + +___ + +### negate + +▸ **negate**(): *[G1](_node_modules_bls12377js_src_g1_.g1.md)* + +Defined in node_modules/bls12377js/src/g1.ts:48 + +**Returns:** *[G1](_node_modules_bls12377js_src_g1_.g1.md)* + +___ + +### scalarMult + +▸ **scalarMult**(`s`: BigInteger): *[G1](_node_modules_bls12377js_src_g1_.g1.md)* + +*Implementation of [GroupSpec](../interfaces/_node_modules_bls12377js_src_defs_.groupspec.md)* + +Defined in node_modules/bls12377js/src/g1.ts:36 + +**Parameters:** + +Name | Type | +------ | ------ | +`s` | BigInteger | + +**Returns:** *[G1](_node_modules_bls12377js_src_g1_.g1.md)* + +___ + +### toAffine + +▸ **toAffine**(): *[G1](_node_modules_bls12377js_src_g1_.g1.md)* + +*Implementation of [GroupSpec](../interfaces/_node_modules_bls12377js_src_defs_.groupspec.md)* + +Defined in node_modules/bls12377js/src/g1.ts:56 + +**Returns:** *[G1](_node_modules_bls12377js_src_g1_.g1.md)* + +___ + +### toString + +▸ **toString**(`base?`: undefined | number): *string* + +*Implementation of [GroupSpec](../interfaces/_node_modules_bls12377js_src_defs_.groupspec.md)* + +Defined in node_modules/bls12377js/src/g1.ts:74 + +**Parameters:** + +Name | Type | +------ | ------ | +`base?` | undefined | number | + +**Returns:** *string* + +___ + +### x + +▸ **x**(): *[F](_node_modules_bls12377js_src_f_.f.md)* + +*Implementation of [GroupSpec](../interfaces/_node_modules_bls12377js_src_defs_.groupspec.md)* + +Defined in node_modules/bls12377js/src/g1.ts:62 + +**Returns:** *[F](_node_modules_bls12377js_src_f_.f.md)* + +___ + +### y + +▸ **y**(): *[F](_node_modules_bls12377js_src_f_.f.md)* + +*Implementation of [GroupSpec](../interfaces/_node_modules_bls12377js_src_defs_.groupspec.md)* + +Defined in node_modules/bls12377js/src/g1.ts:66 + +**Returns:** *[F](_node_modules_bls12377js_src_f_.f.md)* + +___ + +### z + +▸ **z**(): *[F](_node_modules_bls12377js_src_f_.f.md)* + +*Implementation of [GroupSpec](../interfaces/_node_modules_bls12377js_src_defs_.groupspec.md)* + +Defined in node_modules/bls12377js/src/g1.ts:70 + +**Returns:** *[F](_node_modules_bls12377js_src_f_.f.md)* + +___ + +### `Static` fromElements + +▸ **fromElements**(`x`: [F](_node_modules_bls12377js_src_f_.f.md), `y`: [F](_node_modules_bls12377js_src_f_.f.md)): *[G1](_node_modules_bls12377js_src_g1_.g1.md)* + +Defined in node_modules/bls12377js/src/g1.ts:16 + +**Parameters:** + +Name | Type | +------ | ------ | +`x` | [F](_node_modules_bls12377js_src_f_.f.md) | +`y` | [F](_node_modules_bls12377js_src_f_.f.md) | + +**Returns:** *[G1](_node_modules_bls12377js_src_g1_.g1.md)* diff --git a/packages/docs/sdk/docs/cryptographic-utils/classes/_node_modules_bls12377js_src_g2_.g2.md b/packages/docs/sdk/docs/cryptographic-utils/classes/_node_modules_bls12377js_src_g2_.g2.md new file mode 100644 index 00000000000..87a43eb6070 --- /dev/null +++ b/packages/docs/sdk/docs/cryptographic-utils/classes/_node_modules_bls12377js_src_g2_.g2.md @@ -0,0 +1,182 @@ +[@celo/cryptographic-utils](../README.md) › [Globals](../globals.md) › ["node_modules/bls12377js/src/g2"](../modules/_node_modules_bls12377js_src_g2_.md) › [G2](_node_modules_bls12377js_src_g2_.g2.md) + +# Class: G2 + +## Hierarchy + +* **G2** + +## Implements + +* [GroupSpec](../interfaces/_node_modules_bls12377js_src_defs_.groupspec.md)‹[F2](_node_modules_bls12377js_src_f2_.f2.md), [G2](_node_modules_bls12377js_src_g2_.g2.md)› + +## Index + +### Methods + +* [add](_node_modules_bls12377js_src_g2_.g2.md#add) +* [dbl](_node_modules_bls12377js_src_g2_.g2.md#dbl) +* [equals](_node_modules_bls12377js_src_g2_.g2.md#equals) +* [negate](_node_modules_bls12377js_src_g2_.g2.md#negate) +* [scalarMult](_node_modules_bls12377js_src_g2_.g2.md#scalarmult) +* [toAffine](_node_modules_bls12377js_src_g2_.g2.md#toaffine) +* [toString](_node_modules_bls12377js_src_g2_.g2.md#tostring) +* [x](_node_modules_bls12377js_src_g2_.g2.md#x) +* [y](_node_modules_bls12377js_src_g2_.g2.md#y) +* [z](_node_modules_bls12377js_src_g2_.g2.md#z) +* [fromElements](_node_modules_bls12377js_src_g2_.g2.md#static-fromelements) + +## Methods + +### add + +▸ **add**(`p2`: [G2](_node_modules_bls12377js_src_g2_.g2.md)): *[G2](_node_modules_bls12377js_src_g2_.g2.md)* + +Defined in node_modules/bls12377js/src/g2.ts:26 + +**Parameters:** + +Name | Type | +------ | ------ | +`p2` | [G2](_node_modules_bls12377js_src_g2_.g2.md) | + +**Returns:** *[G2](_node_modules_bls12377js_src_g2_.g2.md)* + +___ + +### dbl + +▸ **dbl**(): *[G2](_node_modules_bls12377js_src_g2_.g2.md)* + +*Implementation of [GroupSpec](../interfaces/_node_modules_bls12377js_src_defs_.groupspec.md)* + +Defined in node_modules/bls12377js/src/g2.ts:33 + +**Returns:** *[G2](_node_modules_bls12377js_src_g2_.g2.md)* + +___ + +### equals + +▸ **equals**(`p2`: [G2](_node_modules_bls12377js_src_g2_.g2.md)): *boolean* + +Defined in node_modules/bls12377js/src/g2.ts:56 + +**Parameters:** + +Name | Type | +------ | ------ | +`p2` | [G2](_node_modules_bls12377js_src_g2_.g2.md) | + +**Returns:** *boolean* + +___ + +### negate + +▸ **negate**(): *[G2](_node_modules_bls12377js_src_g2_.g2.md)* + +Defined in node_modules/bls12377js/src/g2.ts:48 + +**Returns:** *[G2](_node_modules_bls12377js_src_g2_.g2.md)* + +___ + +### scalarMult + +▸ **scalarMult**(`s`: BigInteger): *[G2](_node_modules_bls12377js_src_g2_.g2.md)* + +*Implementation of [GroupSpec](../interfaces/_node_modules_bls12377js_src_defs_.groupspec.md)* + +Defined in node_modules/bls12377js/src/g2.ts:40 + +**Parameters:** + +Name | Type | +------ | ------ | +`s` | BigInteger | + +**Returns:** *[G2](_node_modules_bls12377js_src_g2_.g2.md)* + +___ + +### toAffine + +▸ **toAffine**(): *[G2](_node_modules_bls12377js_src_g2_.g2.md)* + +*Implementation of [GroupSpec](../interfaces/_node_modules_bls12377js_src_defs_.groupspec.md)* + +Defined in node_modules/bls12377js/src/g2.ts:60 + +**Returns:** *[G2](_node_modules_bls12377js_src_g2_.g2.md)* + +___ + +### toString + +▸ **toString**(`base?`: undefined | number): *string* + +*Implementation of [GroupSpec](../interfaces/_node_modules_bls12377js_src_defs_.groupspec.md)* + +Defined in node_modules/bls12377js/src/g2.ts:78 + +**Parameters:** + +Name | Type | +------ | ------ | +`base?` | undefined | number | + +**Returns:** *string* + +___ + +### x + +▸ **x**(): *[F2](_node_modules_bls12377js_src_f2_.f2.md)* + +*Implementation of [GroupSpec](../interfaces/_node_modules_bls12377js_src_defs_.groupspec.md)* + +Defined in node_modules/bls12377js/src/g2.ts:66 + +**Returns:** *[F2](_node_modules_bls12377js_src_f2_.f2.md)* + +___ + +### y + +▸ **y**(): *[F2](_node_modules_bls12377js_src_f2_.f2.md)* + +*Implementation of [GroupSpec](../interfaces/_node_modules_bls12377js_src_defs_.groupspec.md)* + +Defined in node_modules/bls12377js/src/g2.ts:70 + +**Returns:** *[F2](_node_modules_bls12377js_src_f2_.f2.md)* + +___ + +### z + +▸ **z**(): *[F2](_node_modules_bls12377js_src_f2_.f2.md)* + +*Implementation of [GroupSpec](../interfaces/_node_modules_bls12377js_src_defs_.groupspec.md)* + +Defined in node_modules/bls12377js/src/g2.ts:74 + +**Returns:** *[F2](_node_modules_bls12377js_src_f2_.f2.md)* + +___ + +### `Static` fromElements + +▸ **fromElements**(`x`: [F2](_node_modules_bls12377js_src_f2_.f2.md), `y`: [F2](_node_modules_bls12377js_src_f2_.f2.md)): *[G2](_node_modules_bls12377js_src_g2_.g2.md)* + +Defined in node_modules/bls12377js/src/g2.ts:20 + +**Parameters:** + +Name | Type | +------ | ------ | +`x` | [F2](_node_modules_bls12377js_src_f2_.f2.md) | +`y` | [F2](_node_modules_bls12377js_src_f2_.f2.md) | + +**Returns:** *[G2](_node_modules_bls12377js_src_g2_.g2.md)* diff --git a/packages/docs/sdk/docs/cryptographic-utils/classes/_node_modules_bls12377js_src_group_.group.md b/packages/docs/sdk/docs/cryptographic-utils/classes/_node_modules_bls12377js_src_group_.group.md new file mode 100644 index 00000000000..2d11993fff7 --- /dev/null +++ b/packages/docs/sdk/docs/cryptographic-utils/classes/_node_modules_bls12377js_src_group_.group.md @@ -0,0 +1,226 @@ +[@celo/cryptographic-utils](../README.md) › [Globals](../globals.md) › ["node_modules/bls12377js/src/group"](../modules/_node_modules_bls12377js_src_group_.md) › [Group](_node_modules_bls12377js_src_group_.group.md) + +# Class: Group <**T**> + +## Type parameters + +▪ **T**: *[FieldSpec](../interfaces/_node_modules_bls12377js_src_defs_.fieldspec.md)‹T›* + +## Hierarchy + +* **Group** + +## Index + +### Methods + +* [_add](_node_modules_bls12377js_src_group_.group.md#_add) +* [_double](_node_modules_bls12377js_src_group_.group.md#_double) +* [_scalarMult](_node_modules_bls12377js_src_group_.group.md#_scalarmult) +* [clone](_node_modules_bls12377js_src_group_.group.md#clone) +* [equals](_node_modules_bls12377js_src_group_.group.md#equals) +* [equalsProjective](_node_modules_bls12377js_src_group_.group.md#equalsprojective) +* [isInfinity](_node_modules_bls12377js_src_group_.group.md#isinfinity) +* [toAffine](_node_modules_bls12377js_src_group_.group.md#toaffine) +* [toString](_node_modules_bls12377js_src_group_.group.md#tostring) +* [x](_node_modules_bls12377js_src_group_.group.md#x) +* [y](_node_modules_bls12377js_src_group_.group.md#y) +* [z](_node_modules_bls12377js_src_group_.group.md#z) +* [fromElements](_node_modules_bls12377js_src_group_.group.md#static-fromelements) + +## Methods + +### _add + +▸ **_add**(`b`: T, `zero`: T, `one`: T, `p2`: [Group](_node_modules_bls12377js_src_group_.group.md)‹T›): *[Group](_node_modules_bls12377js_src_group_.group.md)‹T›* + +Defined in node_modules/bls12377js/src/group.ts:40 + +**Parameters:** + +Name | Type | +------ | ------ | +`b` | T | +`zero` | T | +`one` | T | +`p2` | [Group](_node_modules_bls12377js_src_group_.group.md)‹T› | + +**Returns:** *[Group](_node_modules_bls12377js_src_group_.group.md)‹T›* + +___ + +### _double + +▸ **_double**(`_`: T, `zero`: T, `one`: T): *[Group](_node_modules_bls12377js_src_group_.group.md)‹T›* + +Defined in node_modules/bls12377js/src/group.ts:70 + +**Parameters:** + +Name | Type | +------ | ------ | +`_` | T | +`zero` | T | +`one` | T | + +**Returns:** *[Group](_node_modules_bls12377js_src_group_.group.md)‹T›* + +___ + +### _scalarMult + +▸ **_scalarMult**(`b`: T, `infinity`: [Group](_node_modules_bls12377js_src_group_.group.md)‹T›, `zero`: T, `one`: T, `s`: BigInteger): *[Group](_node_modules_bls12377js_src_group_.group.md)‹T›* + +Defined in node_modules/bls12377js/src/group.ts:97 + +**Parameters:** + +Name | Type | +------ | ------ | +`b` | T | +`infinity` | [Group](_node_modules_bls12377js_src_group_.group.md)‹T› | +`zero` | T | +`one` | T | +`s` | BigInteger | + +**Returns:** *[Group](_node_modules_bls12377js_src_group_.group.md)‹T›* + +___ + +### clone + +▸ **clone**(): *[Group](_node_modules_bls12377js_src_group_.group.md)‹T›* + +Defined in node_modules/bls12377js/src/group.ts:141 + +**Returns:** *[Group](_node_modules_bls12377js_src_group_.group.md)‹T›* + +___ + +### equals + +▸ **equals**(`p2`: [Group](_node_modules_bls12377js_src_group_.group.md)‹T›): *boolean* + +Defined in node_modules/bls12377js/src/group.ts:128 + +**Parameters:** + +Name | Type | +------ | ------ | +`p2` | [Group](_node_modules_bls12377js_src_group_.group.md)‹T› | + +**Returns:** *boolean* + +___ + +### equalsProjective + +▸ **equalsProjective**(`p2`: [Group](_node_modules_bls12377js_src_group_.group.md)‹T›): *boolean* + +Defined in node_modules/bls12377js/src/group.ts:133 + +**Parameters:** + +Name | Type | +------ | ------ | +`p2` | [Group](_node_modules_bls12377js_src_group_.group.md)‹T› | + +**Returns:** *boolean* + +___ + +### isInfinity + +▸ **isInfinity**(`zero`: T, `one`: T): *boolean* + +Defined in node_modules/bls12377js/src/group.ts:137 + +**Parameters:** + +Name | Type | +------ | ------ | +`zero` | T | +`one` | T | + +**Returns:** *boolean* + +___ + +### toAffine + +▸ **toAffine**(): *[Group](_node_modules_bls12377js_src_group_.group.md)‹T›* + +Defined in node_modules/bls12377js/src/group.ts:118 + +**Returns:** *[Group](_node_modules_bls12377js_src_group_.group.md)‹T›* + +___ + +### toString + +▸ **toString**(`base?`: undefined | number): *string* + +Defined in node_modules/bls12377js/src/group.ts:150 + +**Parameters:** + +Name | Type | +------ | ------ | +`base?` | undefined | number | + +**Returns:** *string* + +___ + +### x + +▸ **x**(): *T* + +Defined in node_modules/bls12377js/src/group.ts:28 + +**Returns:** *T* + +___ + +### y + +▸ **y**(): *T* + +Defined in node_modules/bls12377js/src/group.ts:32 + +**Returns:** *T* + +___ + +### z + +▸ **z**(): *T* + +Defined in node_modules/bls12377js/src/group.ts:36 + +**Returns:** *T* + +___ + +### `Static` fromElements + +▸ **fromElements**<**T**>(`b`: T, `zero`: T, `one`: T, `x`: T, `y`: T, `z`: T): *[Group](_node_modules_bls12377js_src_group_.group.md)‹T›* + +Defined in node_modules/bls12377js/src/group.ts:14 + +**Type parameters:** + +▪ **T**: *[FieldSpec](../interfaces/_node_modules_bls12377js_src_defs_.fieldspec.md)‹T›* + +**Parameters:** + +Name | Type | +------ | ------ | +`b` | T | +`zero` | T | +`one` | T | +`x` | T | +`y` | T | +`z` | T | + +**Returns:** *[Group](_node_modules_bls12377js_src_group_.group.md)‹T›* diff --git a/packages/docs/sdk/docs/cryptographic-utils/globals.md b/packages/docs/sdk/docs/cryptographic-utils/globals.md index ea8a4a86190..953c63aafa1 100644 --- a/packages/docs/sdk/docs/cryptographic-utils/globals.md +++ b/packages/docs/sdk/docs/cryptographic-utils/globals.md @@ -6,7 +6,14 @@ ### Modules -* ["account"](modules/_account_.md) -* ["bls"](modules/_bls_.md) -* ["commentEncryption"](modules/_commentencryption_.md) -* ["dataEncryptionKey"](modules/_dataencryptionkey_.md) +* ["node_modules/bls12377js/src/bls"](modules/_node_modules_bls12377js_src_bls_.md) +* ["node_modules/bls12377js/src/defs"](modules/_node_modules_bls12377js_src_defs_.md) +* ["node_modules/bls12377js/src/f"](modules/_node_modules_bls12377js_src_f_.md) +* ["node_modules/bls12377js/src/f2"](modules/_node_modules_bls12377js_src_f2_.md) +* ["node_modules/bls12377js/src/g1"](modules/_node_modules_bls12377js_src_g1_.md) +* ["node_modules/bls12377js/src/g2"](modules/_node_modules_bls12377js_src_g2_.md) +* ["node_modules/bls12377js/src/group"](modules/_node_modules_bls12377js_src_group_.md) +* ["packages/sdk/cryptographic-utils/src/account"](modules/_packages_sdk_cryptographic_utils_src_account_.md) +* ["packages/sdk/cryptographic-utils/src/bls"](modules/_packages_sdk_cryptographic_utils_src_bls_.md) +* ["packages/sdk/cryptographic-utils/src/commentEncryption"](modules/_packages_sdk_cryptographic_utils_src_commentencryption_.md) +* ["packages/sdk/cryptographic-utils/src/dataEncryptionKey"](modules/_packages_sdk_cryptographic_utils_src_dataencryptionkey_.md) diff --git a/packages/docs/sdk/docs/cryptographic-utils/interfaces/_commentencryption_.encryptionstatus.md b/packages/docs/sdk/docs/cryptographic-utils/interfaces/_commentencryption_.encryptionstatus.md deleted file mode 100644 index 9742d1c6592..00000000000 --- a/packages/docs/sdk/docs/cryptographic-utils/interfaces/_commentencryption_.encryptionstatus.md +++ /dev/null @@ -1,30 +0,0 @@ -[@celo/cryptographic-utils](../README.md) › [Globals](../globals.md) › ["commentEncryption"](../modules/_commentencryption_.md) › [EncryptionStatus](_commentencryption_.encryptionstatus.md) - -# Interface: EncryptionStatus - -## Hierarchy - -* **EncryptionStatus** - -## Index - -### Properties - -* [comment](_commentencryption_.encryptionstatus.md#comment) -* [success](_commentencryption_.encryptionstatus.md#success) - -## Properties - -### comment - -• **comment**: *string* - -*Defined in [commentEncryption.ts:16](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/commentEncryption.ts#L16)* - -___ - -### success - -• **success**: *boolean* - -*Defined in [commentEncryption.ts:15](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/commentEncryption.ts#L15)* diff --git a/packages/docs/sdk/docs/cryptographic-utils/interfaces/_node_modules_bls12377js_src_defs_.fieldspec.md b/packages/docs/sdk/docs/cryptographic-utils/interfaces/_node_modules_bls12377js_src_defs_.fieldspec.md new file mode 100644 index 00000000000..ede00fb4f3c --- /dev/null +++ b/packages/docs/sdk/docs/cryptographic-utils/interfaces/_node_modules_bls12377js_src_defs_.fieldspec.md @@ -0,0 +1,167 @@ +[@celo/cryptographic-utils](../README.md) › [Globals](../globals.md) › ["node_modules/bls12377js/src/defs"](../modules/_node_modules_bls12377js_src_defs_.md) › [FieldSpec](_node_modules_bls12377js_src_defs_.fieldspec.md) + +# Interface: FieldSpec <**T**> + +## Type parameters + +▪ **T** + +## Hierarchy + +* **FieldSpec** + +## Implemented by + +* [F](../classes/_node_modules_bls12377js_src_f_.f.md) +* [F2](../classes/_node_modules_bls12377js_src_f2_.f2.md) + +## Index + +### Methods + +* [add](_node_modules_bls12377js_src_defs_.fieldspec.md#add) +* [clone](_node_modules_bls12377js_src_defs_.fieldspec.md#clone) +* [equals](_node_modules_bls12377js_src_defs_.fieldspec.md#equals) +* [inverse](_node_modules_bls12377js_src_defs_.fieldspec.md#inverse) +* [multiply](_node_modules_bls12377js_src_defs_.fieldspec.md#multiply) +* [negate](_node_modules_bls12377js_src_defs_.fieldspec.md#negate) +* [power](_node_modules_bls12377js_src_defs_.fieldspec.md#power) +* [sqrt](_node_modules_bls12377js_src_defs_.fieldspec.md#sqrt) +* [subtract](_node_modules_bls12377js_src_defs_.fieldspec.md#subtract) +* [toString](_node_modules_bls12377js_src_defs_.fieldspec.md#tostring) + +## Methods + +### add + +▸ **add**(`b`: T): *T* + +Defined in node_modules/bls12377js/src/defs.ts:37 + +**Parameters:** + +Name | Type | +------ | ------ | +`b` | T | + +**Returns:** *T* + +___ + +### clone + +▸ **clone**(): *T* + +Defined in node_modules/bls12377js/src/defs.ts:44 + +**Returns:** *T* + +___ + +### equals + +▸ **equals**(`b`: T): *boolean* + +Defined in node_modules/bls12377js/src/defs.ts:36 + +**Parameters:** + +Name | Type | +------ | ------ | +`b` | T | + +**Returns:** *boolean* + +___ + +### inverse + +▸ **inverse**(): *T* + +Defined in node_modules/bls12377js/src/defs.ts:42 + +**Returns:** *T* + +___ + +### multiply + +▸ **multiply**(`b`: T): *T* + +Defined in node_modules/bls12377js/src/defs.ts:39 + +**Parameters:** + +Name | Type | +------ | ------ | +`b` | T | + +**Returns:** *T* + +___ + +### negate + +▸ **negate**(): *T* + +Defined in node_modules/bls12377js/src/defs.ts:43 + +**Returns:** *T* + +___ + +### power + +▸ **power**(`e`: BigInteger): *T* + +Defined in node_modules/bls12377js/src/defs.ts:40 + +**Parameters:** + +Name | Type | +------ | ------ | +`e` | BigInteger | + +**Returns:** *T* + +___ + +### sqrt + +▸ **sqrt**(): *T* + +Defined in node_modules/bls12377js/src/defs.ts:41 + +**Returns:** *T* + +___ + +### subtract + +▸ **subtract**(`b`: T): *T* + +Defined in node_modules/bls12377js/src/defs.ts:38 + +**Parameters:** + +Name | Type | +------ | ------ | +`b` | T | + +**Returns:** *T* + +___ + +### toString + +▸ **toString**(`base?`: undefined | number): *string* + +Defined in node_modules/bls12377js/src/defs.ts:45 + +**Parameters:** + +Name | Type | +------ | ------ | +`base?` | undefined | number | + +**Returns:** *string* diff --git a/packages/docs/sdk/docs/cryptographic-utils/interfaces/_node_modules_bls12377js_src_defs_.groupspec.md b/packages/docs/sdk/docs/cryptographic-utils/interfaces/_node_modules_bls12377js_src_defs_.groupspec.md new file mode 100644 index 00000000000..c77d318ffe9 --- /dev/null +++ b/packages/docs/sdk/docs/cryptographic-utils/interfaces/_node_modules_bls12377js_src_defs_.groupspec.md @@ -0,0 +1,146 @@ +[@celo/cryptographic-utils](../README.md) › [Globals](../globals.md) › ["node_modules/bls12377js/src/defs"](../modules/_node_modules_bls12377js_src_defs_.md) › [GroupSpec](_node_modules_bls12377js_src_defs_.groupspec.md) + +# Interface: GroupSpec <**T, G**> + +## Type parameters + +▪ **T** + +▪ **G** + +## Hierarchy + +* **GroupSpec** + +## Implemented by + +* [G1](../classes/_node_modules_bls12377js_src_g1_.g1.md) +* [G2](../classes/_node_modules_bls12377js_src_g2_.g2.md) + +## Index + +### Methods + +* [add](_node_modules_bls12377js_src_defs_.groupspec.md#add) +* [dbl](_node_modules_bls12377js_src_defs_.groupspec.md#dbl) +* [equals](_node_modules_bls12377js_src_defs_.groupspec.md#equals) +* [scalarMult](_node_modules_bls12377js_src_defs_.groupspec.md#scalarmult) +* [toAffine](_node_modules_bls12377js_src_defs_.groupspec.md#toaffine) +* [toString](_node_modules_bls12377js_src_defs_.groupspec.md#tostring) +* [x](_node_modules_bls12377js_src_defs_.groupspec.md#x) +* [y](_node_modules_bls12377js_src_defs_.groupspec.md#y) +* [z](_node_modules_bls12377js_src_defs_.groupspec.md#z) + +## Methods + +### add + +▸ **add**(`p2`: G): *G* + +Defined in node_modules/bls12377js/src/defs.ts:49 + +**Parameters:** + +Name | Type | +------ | ------ | +`p2` | G | + +**Returns:** *G* + +___ + +### dbl + +▸ **dbl**(): *G* + +Defined in node_modules/bls12377js/src/defs.ts:50 + +**Returns:** *G* + +___ + +### equals + +▸ **equals**(`p2`: G): *boolean* + +Defined in node_modules/bls12377js/src/defs.ts:52 + +**Parameters:** + +Name | Type | +------ | ------ | +`p2` | G | + +**Returns:** *boolean* + +___ + +### scalarMult + +▸ **scalarMult**(`s`: BigInteger): *G* + +Defined in node_modules/bls12377js/src/defs.ts:51 + +**Parameters:** + +Name | Type | +------ | ------ | +`s` | BigInteger | + +**Returns:** *G* + +___ + +### toAffine + +▸ **toAffine**(): *G* + +Defined in node_modules/bls12377js/src/defs.ts:53 + +**Returns:** *G* + +___ + +### toString + +▸ **toString**(`base?`: undefined | number): *string* + +Defined in node_modules/bls12377js/src/defs.ts:57 + +**Parameters:** + +Name | Type | +------ | ------ | +`base?` | undefined | number | + +**Returns:** *string* + +___ + +### x + +▸ **x**(): *T* + +Defined in node_modules/bls12377js/src/defs.ts:54 + +**Returns:** *T* + +___ + +### y + +▸ **y**(): *T* + +Defined in node_modules/bls12377js/src/defs.ts:55 + +**Returns:** *T* + +___ + +### z + +▸ **z**(): *T* + +Defined in node_modules/bls12377js/src/defs.ts:56 + +**Returns:** *T* diff --git a/packages/docs/sdk/docs/cryptographic-utils/interfaces/_packages_sdk_cryptographic_utils_src_commentencryption_.encryptionstatus.md b/packages/docs/sdk/docs/cryptographic-utils/interfaces/_packages_sdk_cryptographic_utils_src_commentencryption_.encryptionstatus.md new file mode 100644 index 00000000000..619689c1a6e --- /dev/null +++ b/packages/docs/sdk/docs/cryptographic-utils/interfaces/_packages_sdk_cryptographic_utils_src_commentencryption_.encryptionstatus.md @@ -0,0 +1,30 @@ +[@celo/cryptographic-utils](../README.md) › [Globals](../globals.md) › ["packages/sdk/cryptographic-utils/src/commentEncryption"](../modules/_packages_sdk_cryptographic_utils_src_commentencryption_.md) › [EncryptionStatus](_packages_sdk_cryptographic_utils_src_commentencryption_.encryptionstatus.md) + +# Interface: EncryptionStatus + +## Hierarchy + +* **EncryptionStatus** + +## Index + +### Properties + +* [comment](_packages_sdk_cryptographic_utils_src_commentencryption_.encryptionstatus.md#comment) +* [success](_packages_sdk_cryptographic_utils_src_commentencryption_.encryptionstatus.md#success) + +## Properties + +### comment + +• **comment**: *string* + +*Defined in [packages/sdk/cryptographic-utils/src/commentEncryption.ts:16](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/commentEncryption.ts#L16)* + +___ + +### success + +• **success**: *boolean* + +*Defined in [packages/sdk/cryptographic-utils/src/commentEncryption.ts:15](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/commentEncryption.ts#L15)* diff --git a/packages/docs/sdk/docs/cryptographic-utils/modules/_account_.md b/packages/docs/sdk/docs/cryptographic-utils/modules/_account_.md deleted file mode 100644 index b9a3825b617..00000000000 --- a/packages/docs/sdk/docs/cryptographic-utils/modules/_account_.md +++ /dev/null @@ -1,403 +0,0 @@ -[@celo/cryptographic-utils](../README.md) › [Globals](../globals.md) › ["account"](_account_.md) - -# Module: "account" - -## Index - -### References - -* [Bip39](_account_.md#bip39) -* [CELO_DERIVATION_PATH_BASE](_account_.md#celo_derivation_path_base) -* [MnemonicLanguages](_account_.md#mnemoniclanguages) -* [MnemonicStrength](_account_.md#mnemonicstrength) -* [RandomNumberGenerator](_account_.md#randomnumbergenerator) - -### Functions - -* [detectMnemonicLanguage](_account_.md#detectmnemoniclanguage) -* [formatNonAccentedCharacters](_account_.md#formatnonaccentedcharacters) -* [generateDeterministicInviteCode](_account_.md#generatedeterministicinvitecode) -* [generateKeys](_account_.md#generatekeys) -* [generateKeysFromSeed](_account_.md#generatekeysfromseed) -* [generateMnemonic](_account_.md#generatemnemonic) -* [generateSeed](_account_.md#generateseed) -* [getAllLanguages](_account_.md#getalllanguages) -* [invalidMnemonicWords](_account_.md#invalidmnemonicwords) -* [mnemonicLengthFromStrength](_account_.md#mnemoniclengthfromstrength) -* [normalizeMnemonic](_account_.md#normalizemnemonic) -* [suggestMnemonicCorrections](_account_.md#suggestmnemoniccorrections) -* [validateMnemonic](_account_.md#validatemnemonic) - -### Object literals - -* [AccountUtils](_account_.md#const-accountutils) - -## References - -### Bip39 - -• **Bip39**: - -___ - -### CELO_DERIVATION_PATH_BASE - -• **CELO_DERIVATION_PATH_BASE**: - -___ - -### MnemonicLanguages - -• **MnemonicLanguages**: - -___ - -### MnemonicStrength - -• **MnemonicStrength**: - -___ - -### RandomNumberGenerator - -• **RandomNumberGenerator**: - -## Functions - -### detectMnemonicLanguage - -▸ **detectMnemonicLanguage**(`words`: string[], `candidates?`: [MnemonicLanguages](_account_.md#mnemoniclanguages)[]): *[MnemonicLanguages](_account_.md#mnemoniclanguages) | undefined* - -*Defined in [account.ts:233](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L233)* - -Detects the language of tokenized mnemonic phrase by applying a heuristic. - -**`remarks`** Uses a heuristic of returning the language with the most matching words. In practice, we -expect all words to come from a single language, also some may be misspelled or otherwise -malformed. It may occasionally occur that a typo results in word from another language (e.g. bag --> bagr) but this should occur at most once or twice per phrase. - -**Parameters:** - -Name | Type | ------- | ------ | -`words` | string[] | -`candidates?` | [MnemonicLanguages](_account_.md#mnemoniclanguages)[] | - -**Returns:** *[MnemonicLanguages](_account_.md#mnemoniclanguages) | undefined* - -___ - -### formatNonAccentedCharacters - -▸ **formatNonAccentedCharacters**(`mnemonic`: string): *[formatNonAccentedCharacters](_account_.md#formatnonaccentedcharacters)* - -*Defined in [account.ts:159](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L159)* - -**`deprecated`** now an alias for normalizeMnemonic. - -**Parameters:** - -Name | Type | ------- | ------ | -`mnemonic` | string | - -**Returns:** *[formatNonAccentedCharacters](_account_.md#formatnonaccentedcharacters)* - -___ - -### generateDeterministicInviteCode - -▸ **generateDeterministicInviteCode**(`recipientPhoneHash`: string, `recipientPepper`: string, `addressIndex`: number, `changeIndex`: number, `derivationPath`: string): *object* - -*Defined in [account.ts:416](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L416)* - -**Parameters:** - -Name | Type | Default | ------- | ------ | ------ | -`recipientPhoneHash` | string | - | -`recipientPepper` | string | - | -`addressIndex` | number | 0 | -`changeIndex` | number | 0 | -`derivationPath` | string | CELO_DERIVATION_PATH_BASE | - -**Returns:** *object* - -* **privateKey**: *string* - -* **publicKey**: *string* - -___ - -### generateKeys - -▸ **generateKeys**(`mnemonic`: string, `password?`: undefined | string, `changeIndex`: number, `addressIndex`: number, `bip39ToUse`: Bip39, `derivationPath`: string): *Promise‹object›* - -*Defined in [account.ts:403](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L403)* - -**Parameters:** - -Name | Type | Default | ------- | ------ | ------ | -`mnemonic` | string | - | -`password?` | undefined | string | - | -`changeIndex` | number | 0 | -`addressIndex` | number | 0 | -`bip39ToUse` | Bip39 | bip39Wrapper | -`derivationPath` | string | CELO_DERIVATION_PATH_BASE | - -**Returns:** *Promise‹object›* - -___ - -### generateKeysFromSeed - -▸ **generateKeysFromSeed**(`seed`: Buffer, `changeIndex`: number, `addressIndex`: number, `derivationPath`: string): *object* - -*Defined in [account.ts:444](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L444)* - -**Parameters:** - -Name | Type | Default | ------- | ------ | ------ | -`seed` | Buffer | - | -`changeIndex` | number | 0 | -`addressIndex` | number | 0 | -`derivationPath` | string | CELO_DERIVATION_PATH_BASE | - -**Returns:** *object* - -* **address**: *string* - -* **privateKey**: *string* - -* **publicKey**: *string* - -___ - -### generateMnemonic - -▸ **generateMnemonic**(`strength`: [MnemonicStrength](_account_.md#mnemonicstrength), `language?`: [MnemonicLanguages](_account_.md#mnemoniclanguages), `bip39ToUse`: Bip39): *Promise‹string›* - -*Defined in [account.ts:54](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L54)* - -**Parameters:** - -Name | Type | Default | ------- | ------ | ------ | -`strength` | [MnemonicStrength](_account_.md#mnemonicstrength) | MnemonicStrength.s256_24words | -`language?` | [MnemonicLanguages](_account_.md#mnemoniclanguages) | - | -`bip39ToUse` | Bip39 | bip39Wrapper | - -**Returns:** *Promise‹string›* - -___ - -### generateSeed - -▸ **generateSeed**(`mnemonic`: string, `password?`: undefined | string, `bip39ToUse`: Bip39, `keyByteLength`: number): *Promise‹Buffer›* - -*Defined in [account.ts:429](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L429)* - -**Parameters:** - -Name | Type | Default | ------- | ------ | ------ | -`mnemonic` | string | - | -`password?` | undefined | string | - | -`bip39ToUse` | Bip39 | bip39Wrapper | -`keyByteLength` | number | 64 | - -**Returns:** *Promise‹Buffer›* - -___ - -### getAllLanguages - -▸ **getAllLanguages**(): *[MnemonicLanguages](_account_.md#mnemoniclanguages)[]* - -*Defined in [account.ts:188](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L188)* - -**Returns:** *[MnemonicLanguages](_account_.md#mnemoniclanguages)[]* - -___ - -### invalidMnemonicWords - -▸ **invalidMnemonicWords**(`mnemonic`: string, `language?`: [MnemonicLanguages](_account_.md#mnemoniclanguages)): *string[] | undefined* - -*Defined in [account.ts:88](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L88)* - -Return a list of the words in the mnemonic that are not in the list of valid BIP-39 words for the -specified or detected language. - -**`remarks`** Will return undefined if the language cannot be detected (e.g. all the words are -invalid, or half of the valid words are from one language and the other half from another.) - -**Parameters:** - -Name | Type | ------- | ------ | -`mnemonic` | string | -`language?` | [MnemonicLanguages](_account_.md#mnemoniclanguages) | - -**Returns:** *string[] | undefined* - -___ - -### mnemonicLengthFromStrength - -▸ **mnemonicLengthFromStrength**(`strength`: [MnemonicStrength](_account_.md#mnemonicstrength)): *number* - -*Defined in [account.ts:202](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L202)* - -**Parameters:** - -Name | Type | ------- | ------ | -`strength` | [MnemonicStrength](_account_.md#mnemonicstrength) | - -**Returns:** *number* - -___ - -### normalizeMnemonic - -▸ **normalizeMnemonic**(`mnemonic`: string, `language?`: [MnemonicLanguages](_account_.md#mnemoniclanguages)): *string* - -*Defined in [account.ts:109](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L109)* - -Normalize the mnemonic phrase to eliminate a number of inconsistencies with standard BIP-39 -phrases that are likely to arise when a user manually enters a phrase. - -**`remarks`** Note that this does not guarantee that the output is a valid mnemonic phrase, or even -that all the words in the phrase are contained in a valid wordlist. - -**Parameters:** - -Name | Type | ------- | ------ | -`mnemonic` | string | -`language?` | [MnemonicLanguages](_account_.md#mnemoniclanguages) | - -**Returns:** *string* - -___ - -### suggestMnemonicCorrections - -▸ **suggestMnemonicCorrections**(`mnemonic`: string, `language?`: [MnemonicLanguages](_account_.md#mnemoniclanguages), `strength?`: [MnemonicStrength](_account_.md#mnemonicstrength)): *Generator‹string›* - -*Defined in [account.ts:288](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L288)* - -Generates a list of suggested corrections to the mnemonic phrase based on a set of heuristics. - -**`remarks`** -Each yielded suggestion represents an attempt to correct the seed phrase by replacing any invalid -words with the most likely valid words. Returned suggestions phrases are ordered by probability -based on a noisy channel model, described in detail in CIP-39. - -The generated list of suggestions is exponential in size, and effectively infinite. One should -not attempt to generate the entire list. - -All yielded suggestions will have a valid checksum, but are not guaranteed to correspond to any -given wallet. If the phrase is being used to recover a wallet with non-zero balance, it is -suggested that the caller check the balance of the derived wallet address. If the balance is -non-zero, they can be sure that the phrase is correct. If it is zero, then they should continue -and try the next suggestion. - -It is recommended to normalize the mnemonic phrase before inputting to this function. - -**`privateremarks`** -TODO(victor): Include a heuristic rule for phrase-level corrections, such as word ordering swaps. - -**Parameters:** - -Name | Type | ------- | ------ | -`mnemonic` | string | -`language?` | [MnemonicLanguages](_account_.md#mnemoniclanguages) | -`strength?` | [MnemonicStrength](_account_.md#mnemonicstrength) | - -**Returns:** *Generator‹string›* - -___ - -### validateMnemonic - -▸ **validateMnemonic**(`mnemonic`: string, `bip39ToUse`: Bip39, `language?`: [MnemonicLanguages](_account_.md#mnemoniclanguages)): *[validateMnemonic](_account_.md#validatemnemonic)* - -*Defined in [account.ts:62](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L62)* - -**Parameters:** - -Name | Type | Default | ------- | ------ | ------ | -`mnemonic` | string | - | -`bip39ToUse` | Bip39 | bip39Wrapper | -`language?` | [MnemonicLanguages](_account_.md#mnemoniclanguages) | - | - -**Returns:** *[validateMnemonic](_account_.md#validatemnemonic)* - -## Object literals - -### `Const` AccountUtils - -### ▪ **AccountUtils**: *object* - -*Defined in [account.ts:465](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L465)* - -### detectMnemonicLanguage - -• **detectMnemonicLanguage**: *[detectMnemonicLanguage](_account_.md#detectmnemoniclanguage)* - -*Defined in [account.ts:466](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L466)* - -### generateKeys - -• **generateKeys**: *[generateKeys](_account_.md#generatekeys)* - -*Defined in [account.ts:472](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L472)* - -### generateKeysFromSeed - -• **generateKeysFromSeed**: *[generateKeysFromSeed](_account_.md#generatekeysfromseed)* - -*Defined in [account.ts:474](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L474)* - -### generateMnemonic - -• **generateMnemonic**: *[generateMnemonic](_account_.md#generatemnemonic)* - -*Defined in [account.ts:467](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L467)* - -### generateSeed - -• **generateSeed**: *[generateSeed](_account_.md#generateseed)* - -*Defined in [account.ts:473](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L473)* - -### invalidMnemonicWords - -• **invalidMnemonicWords**: *[invalidMnemonicWords](_account_.md#invalidmnemonicwords)* - -*Defined in [account.ts:470](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L470)* - -### normalizeMnemonic - -• **normalizeMnemonic**: *[normalizeMnemonic](_account_.md#normalizemnemonic)* - -*Defined in [account.ts:468](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L468)* - -### suggestMnemonicCorrections - -• **suggestMnemonicCorrections**: *[suggestMnemonicCorrections](_account_.md#suggestmnemoniccorrections)* - -*Defined in [account.ts:471](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L471)* - -### validateMnemonic - -• **validateMnemonic**: *[validateMnemonic](_account_.md#validatemnemonic)* - -*Defined in [account.ts:469](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L469)* diff --git a/packages/docs/sdk/docs/cryptographic-utils/modules/_bls_.md b/packages/docs/sdk/docs/cryptographic-utils/modules/_bls_.md deleted file mode 100644 index a826aa6741f..00000000000 --- a/packages/docs/sdk/docs/cryptographic-utils/modules/_bls_.md +++ /dev/null @@ -1,81 +0,0 @@ -[@celo/cryptographic-utils](../README.md) › [Globals](../globals.md) › ["bls"](_bls_.md) - -# Module: "bls" - -## Index - -### Variables - -* [BLS_POP_SIZE](_bls_.md#const-bls_pop_size) -* [BLS_PUBLIC_KEY_SIZE](_bls_.md#const-bls_public_key_size) - -### Functions - -* [blsPrivateKeyToProcessedPrivateKey](_bls_.md#const-blsprivatekeytoprocessedprivatekey) -* [getBlsPoP](_bls_.md#const-getblspop) -* [getBlsPublicKey](_bls_.md#const-getblspublickey) - -## Variables - -### `Const` BLS_POP_SIZE - -• **BLS_POP_SIZE**: *48* = 48 - -*Defined in [bls.ts:12](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/bls.ts#L12)* - -___ - -### `Const` BLS_PUBLIC_KEY_SIZE - -• **BLS_PUBLIC_KEY_SIZE**: *96* = 96 - -*Defined in [bls.ts:11](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/bls.ts#L11)* - -## Functions - -### `Const` blsPrivateKeyToProcessedPrivateKey - -▸ **blsPrivateKeyToProcessedPrivateKey**(`privateKeyHex`: string): *any* - -*Defined in [bls.ts:14](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/bls.ts#L14)* - -**Parameters:** - -Name | Type | ------- | ------ | -`privateKeyHex` | string | - -**Returns:** *any* - -___ - -### `Const` getBlsPoP - -▸ **getBlsPoP**(`address`: string, `privateKeyHex`: string): *string* - -*Defined in [bls.ts:53](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/bls.ts#L53)* - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | string | -`privateKeyHex` | string | - -**Returns:** *string* - -___ - -### `Const` getBlsPublicKey - -▸ **getBlsPublicKey**(`privateKeyHex`: string): *string* - -*Defined in [bls.ts:48](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/bls.ts#L48)* - -**Parameters:** - -Name | Type | ------- | ------ | -`privateKeyHex` | string | - -**Returns:** *string* diff --git a/packages/docs/sdk/docs/cryptographic-utils/modules/_commentencryption_.md b/packages/docs/sdk/docs/cryptographic-utils/modules/_commentencryption_.md deleted file mode 100644 index 6d36c23b65c..00000000000 --- a/packages/docs/sdk/docs/cryptographic-utils/modules/_commentencryption_.md +++ /dev/null @@ -1,131 +0,0 @@ -[@celo/cryptographic-utils](../README.md) › [Globals](../globals.md) › ["commentEncryption"](_commentencryption_.md) - -# Module: "commentEncryption" - -## Index - -### Interfaces - -* [EncryptionStatus](../interfaces/_commentencryption_.encryptionstatus.md) - -### Functions - -* [decryptComment](_commentencryption_.md#decryptcomment) -* [decryptData](_commentencryption_.md#decryptdata) -* [encryptComment](_commentencryption_.md#encryptcomment) -* [encryptData](_commentencryption_.md#encryptdata) - -### Object literals - -* [CommentEncryptionUtils](_commentencryption_.md#const-commentencryptionutils) - -## Functions - -### decryptComment - -▸ **decryptComment**(`comment`: string, `key`: Buffer, `sender`: boolean): *[EncryptionStatus](../interfaces/_commentencryption_.encryptionstatus.md)* - -*Defined in [commentEncryption.ts:104](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/commentEncryption.ts#L104)* - -Decrypts a comments encrypted by encryptComment. If it cannot decrypt the comment (i.e. comment was -never encrypted in the first place), it returns the comments without any changes. - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`comment` | string | Comment to decrypt. If encrypted, base64 encoded. May be plaintext. | -`key` | Buffer | Private key to decrypt the message with. | -`sender` | boolean | If the decryptor is the sender of the message. | - -**Returns:** *[EncryptionStatus](../interfaces/_commentencryption_.encryptionstatus.md)* - -Decrypted comment if can decrypt, otherwise comment. - -___ - -### decryptData - -▸ **decryptData**(`data`: Buffer, `key`: Buffer, `sender`: boolean): *Buffer* - -*Defined in [commentEncryption.ts:45](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/commentEncryption.ts#L45)* - -Decrypts raw data that was encrypted by encryptData. Throws on error. - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`data` | Buffer | Data to decrypt. | -`key` | Buffer | Private key to decrypt the message with. | -`sender` | boolean | If the decryptor is the sender of the message. | - -**Returns:** *Buffer* - -Decrypted data. - -___ - -### encryptComment - -▸ **encryptComment**(`comment`: string, `pubKeyRecipient`: Buffer, `pubKeySelf`: Buffer): *[EncryptionStatus](../interfaces/_commentencryption_.encryptionstatus.md)* - -*Defined in [commentEncryption.ts:69](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/commentEncryption.ts#L69)* - -Encrypts a comment. If it can encrypt, it returns a base64 string with the following: - ECIES(session key to other) + ECIES(session key to self) + AES(comment) -If it fails to encrypt, it returns the comment without any changes. - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`comment` | string | Comment to encrypt. | -`pubKeyRecipient` | Buffer | Public key of the recipient. May be compressed. | -`pubKeySelf` | Buffer | Public key of the sender. May be compressed. | - -**Returns:** *[EncryptionStatus](../interfaces/_commentencryption_.encryptionstatus.md)* - -base64 string of encrypted comment if can encrypt, otherwise comment. - -___ - -### encryptData - -▸ **encryptData**(`data`: Buffer, `pubKeyRecipient`: Buffer, `pubKeySelf`: Buffer): *Buffer* - -*Defined in [commentEncryption.ts:27](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/commentEncryption.ts#L27)* - -Encrypts a buffer to two recipients. Throws on error. - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`data` | Buffer | Data to encrypt | -`pubKeyRecipient` | Buffer | Public key of the recipient. Uncompressed without leading 0x04. | -`pubKeySelf` | Buffer | Public key of the sender. Uncompressed without leading 0x04. | - -**Returns:** *Buffer* - -Encrypted data to sender and recipient. - -## Object literals - -### `Const` CommentEncryptionUtils - -### ▪ **CommentEncryptionUtils**: *object* - -*Defined in [commentEncryption.ts:115](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/commentEncryption.ts#L115)* - -### decryptComment - -• **decryptComment**: *[decryptComment](_commentencryption_.md#decryptcomment)* - -*Defined in [commentEncryption.ts:117](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/commentEncryption.ts#L117)* - -### encryptComment - -• **encryptComment**: *[encryptComment](_commentencryption_.md#encryptcomment)* - -*Defined in [commentEncryption.ts:116](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/commentEncryption.ts#L116)* diff --git a/packages/docs/sdk/docs/cryptographic-utils/modules/_dataencryptionkey_.md b/packages/docs/sdk/docs/cryptographic-utils/modules/_dataencryptionkey_.md deleted file mode 100644 index 75ef6670ab0..00000000000 --- a/packages/docs/sdk/docs/cryptographic-utils/modules/_dataencryptionkey_.md +++ /dev/null @@ -1,103 +0,0 @@ -[@celo/cryptographic-utils](../README.md) › [Globals](../globals.md) › ["dataEncryptionKey"](_dataencryptionkey_.md) - -# Module: "dataEncryptionKey" - -## Index - -### Functions - -* [compressedPubKey](_dataencryptionkey_.md#compressedpubkey) -* [decompressPublicKey](_dataencryptionkey_.md#decompresspublickey) -* [deriveDek](_dataencryptionkey_.md#derivedek) - -### Object literals - -* [DataEncryptionKeyUtils](_dataencryptionkey_.md#const-dataencryptionkeyutils) - -## Functions - -### compressedPubKey - -▸ **compressedPubKey**(`privateKey`: Buffer): *string* - -*Defined in [dataEncryptionKey.ts:10](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/dataEncryptionKey.ts#L10)* - -Turns a private key to a compressed public key (hex string with hex leader). - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`privateKey` | Buffer | Private key. | - -**Returns:** *string* - -Corresponding compessed public key in hex encoding with '0x' leader. - -___ - -### decompressPublicKey - -▸ **decompressPublicKey**(`publicKey`: Buffer): *Buffer* - -*Defined in [dataEncryptionKey.ts:27](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/dataEncryptionKey.ts#L27)* - -Decompresses a public key and strips out the '0x04' leading constant. This makes -any public key suitable to be used with this ECIES implementation. - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`publicKey` | Buffer | Public key in standard form (with 0x02, 0x03, or 0x04 prefix) | - -**Returns:** *Buffer* - -Decompresssed public key without prefix. - -___ - -### deriveDek - -▸ **deriveDek**(`mnemonic`: string, `bip39ToUse?`: [Bip39](_account_.md#bip39)): *[deriveDek](_dataencryptionkey_.md#derivedek)* - -*Defined in [dataEncryptionKey.ts:42](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/dataEncryptionKey.ts#L42)* - -Derives a data encryption key from the mnemonic - -**Parameters:** - -Name | Type | ------- | ------ | -`mnemonic` | string | -`bip39ToUse?` | [Bip39](_account_.md#bip39) | - -**Returns:** *[deriveDek](_dataencryptionkey_.md#derivedek)* - -Comment Encryption Private key. - -## Object literals - -### `Const` DataEncryptionKeyUtils - -### ▪ **DataEncryptionKeyUtils**: *object* - -*Defined in [dataEncryptionKey.ts:56](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/dataEncryptionKey.ts#L56)* - -### compressedPubKey - -• **compressedPubKey**: *[compressedPubKey](_dataencryptionkey_.md#compressedpubkey)* - -*Defined in [dataEncryptionKey.ts:57](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/dataEncryptionKey.ts#L57)* - -### decompressPublicKey - -• **decompressPublicKey**: *[decompressPublicKey](_dataencryptionkey_.md#decompresspublickey)* - -*Defined in [dataEncryptionKey.ts:58](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/dataEncryptionKey.ts#L58)* - -### deriveDek - -• **deriveDek**: *[deriveDek](_dataencryptionkey_.md#derivedek)* - -*Defined in [dataEncryptionKey.ts:59](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/dataEncryptionKey.ts#L59)* diff --git a/packages/docs/sdk/docs/cryptographic-utils/modules/_node_modules_bls12377js_src_bls_.md b/packages/docs/sdk/docs/cryptographic-utils/modules/_node_modules_bls12377js_src_bls_.md new file mode 100644 index 00000000000..5378f4be84a --- /dev/null +++ b/packages/docs/sdk/docs/cryptographic-utils/modules/_node_modules_bls12377js_src_bls_.md @@ -0,0 +1,320 @@ +[@celo/cryptographic-utils](../README.md) › [Globals](../globals.md) › ["node_modules/bls12377js/src/bls"](_node_modules_bls12377js_src_bls_.md) + +# Module: "node_modules/bls12377js/src/bls" + +## Index + +### Functions + +* [arrayToBuffer](_node_modules_bls12377js_src_bls_.md#arraytobuffer) +* [bigToBuffer](_node_modules_bls12377js_src_bls_.md#bigtobuffer) +* [bufferToArray](_node_modules_bls12377js_src_bls_.md#buffertoarray) +* [bufferToBig](_node_modules_bls12377js_src_bls_.md#buffertobig) +* [compressG1](_node_modules_bls12377js_src_bls_.md#compressg1) +* [compressG2](_node_modules_bls12377js_src_bls_.md#compressg2) +* [decompressG1](_node_modules_bls12377js_src_bls_.md#decompressg1) +* [decompressG2](_node_modules_bls12377js_src_bls_.md#decompressg2) +* [g1Generator](_node_modules_bls12377js_src_bls_.md#g1generator) +* [g2Generator](_node_modules_bls12377js_src_bls_.md#g2generator) +* [getMiddlePoint](_node_modules_bls12377js_src_bls_.md#getmiddlepoint) +* [padBytes](_node_modules_bls12377js_src_bls_.md#padbytes) +* [privateToPublicBytes](_node_modules_bls12377js_src_bls_.md#privatetopublicbytes) +* [reverse](_node_modules_bls12377js_src_bls_.md#reverse) +* [signPoP](_node_modules_bls12377js_src_bls_.md#signpop) +* [signPoPCommon](_node_modules_bls12377js_src_bls_.md#signpopcommon) +* [signPoPNonCompat](_node_modules_bls12377js_src_bls_.md#signpopnoncompat) +* [tryAndIncrement](_node_modules_bls12377js_src_bls_.md#tryandincrement) +* [uint8ArrayToBuffer](_node_modules_bls12377js_src_bls_.md#uint8arraytobuffer) + +## Functions + +### arrayToBuffer + +▸ **arrayToBuffer**(`arr`: number[]): *Buffer* + +Defined in node_modules/bls12377js/src/bls.ts:34 + +**Parameters:** + +Name | Type | +------ | ------ | +`arr` | number[] | + +**Returns:** *Buffer* + +___ + +### bigToBuffer + +▸ **bigToBuffer**(`num`: BigInteger): *Buffer* + +Defined in node_modules/bls12377js/src/bls.ts:43 + +**Parameters:** + +Name | Type | +------ | ------ | +`num` | BigInteger | + +**Returns:** *Buffer* + +___ + +### bufferToArray + +▸ **bufferToArray**(`buf`: Buffer): *number[]* + +Defined in node_modules/bls12377js/src/bls.ts:30 + +**Parameters:** + +Name | Type | +------ | ------ | +`buf` | Buffer | + +**Returns:** *number[]* + +___ + +### bufferToBig + +▸ **bufferToBig**(`buf`: Buffer): *BigInteger* + +Defined in node_modules/bls12377js/src/bls.ts:38 + +**Parameters:** + +Name | Type | +------ | ------ | +`buf` | Buffer | + +**Returns:** *BigInteger* + +___ + +### compressG1 + +▸ **compressG1**(`g`: [G1](../classes/_node_modules_bls12377js_src_g1_.g1.md)): *Buffer* + +Defined in node_modules/bls12377js/src/bls.ts:53 + +**Parameters:** + +Name | Type | +------ | ------ | +`g` | [G1](../classes/_node_modules_bls12377js_src_g1_.g1.md) | + +**Returns:** *Buffer* + +___ + +### compressG2 + +▸ **compressG2**(`g`: [G2](../classes/_node_modules_bls12377js_src_g2_.g2.md)): *Buffer* + +Defined in node_modules/bls12377js/src/bls.ts:90 + +**Parameters:** + +Name | Type | +------ | ------ | +`g` | [G2](../classes/_node_modules_bls12377js_src_g2_.g2.md) | + +**Returns:** *Buffer* + +___ + +### decompressG1 + +▸ **decompressG1**(`bytes`: Buffer): *[G1](../classes/_node_modules_bls12377js_src_g1_.g1.md)* + +Defined in node_modules/bls12377js/src/bls.ts:63 + +**Parameters:** + +Name | Type | +------ | ------ | +`bytes` | Buffer | + +**Returns:** *[G1](../classes/_node_modules_bls12377js_src_g1_.g1.md)* + +___ + +### decompressG2 + +▸ **decompressG2**(`bytes`: Buffer): *[G2](../classes/_node_modules_bls12377js_src_g2_.g2.md)* + +Defined in node_modules/bls12377js/src/bls.ts:111 + +**Parameters:** + +Name | Type | +------ | ------ | +`bytes` | Buffer | + +**Returns:** *[G2](../classes/_node_modules_bls12377js_src_g2_.g2.md)* + +___ + +### g1Generator + +▸ **g1Generator**(): *[G1](../classes/_node_modules_bls12377js_src_g1_.g1.md)* + +Defined in node_modules/bls12377js/src/bls.ts:155 + +**Returns:** *[G1](../classes/_node_modules_bls12377js_src_g1_.g1.md)* + +___ + +### g2Generator + +▸ **g2Generator**(): *[G2](../classes/_node_modules_bls12377js_src_g2_.g2.md)* + +Defined in node_modules/bls12377js/src/bls.ts:162 + +**Returns:** *[G2](../classes/_node_modules_bls12377js_src_g2_.g2.md)* + +___ + +### getMiddlePoint + +▸ **getMiddlePoint**(): *BigInteger* + +Defined in node_modules/bls12377js/src/bls.ts:48 + +**Returns:** *BigInteger* + +___ + +### padBytes + +▸ **padBytes**(`buf`: Buffer, `expectedLength`: number): *Buffer* + +Defined in node_modules/bls12377js/src/bls.ts:175 + +**Parameters:** + +Name | Type | +------ | ------ | +`buf` | Buffer | +`expectedLength` | number | + +**Returns:** *Buffer* + +___ + +### privateToPublicBytes + +▸ **privateToPublicBytes**(`privateKey`: Buffer): *Buffer* + +Defined in node_modules/bls12377js/src/bls.ts:186 + +**Parameters:** + +Name | Type | +------ | ------ | +`privateKey` | Buffer | + +**Returns:** *Buffer* + +___ + +### reverse + +▸ **reverse**(`src`: Buffer): *Buffer‹›* + +Defined in node_modules/bls12377js/src/bls.ts:10 + +**Parameters:** + +Name | Type | +------ | ------ | +`src` | Buffer | + +**Returns:** *Buffer‹›* + +___ + +### signPoP + +▸ **signPoP**(`privateKey`: Buffer, `address`: Buffer): *Buffer* + +Defined in node_modules/bls12377js/src/bls.ts:192 + +**Parameters:** + +Name | Type | +------ | ------ | +`privateKey` | Buffer | +`address` | Buffer | + +**Returns:** *Buffer* + +___ + +### signPoPCommon + +▸ **signPoPCommon**(`privateKey`: Buffer, `address`: Buffer, `compat`: Boolean): *Buffer* + +Defined in node_modules/bls12377js/src/bls.ts:200 + +**Parameters:** + +Name | Type | +------ | ------ | +`privateKey` | Buffer | +`address` | Buffer | +`compat` | Boolean | + +**Returns:** *Buffer* + +___ + +### signPoPNonCompat + +▸ **signPoPNonCompat**(`privateKey`: Buffer, `address`: Buffer): *Buffer* + +Defined in node_modules/bls12377js/src/bls.ts:196 + +**Parameters:** + +Name | Type | +------ | ------ | +`privateKey` | Buffer | +`address` | Buffer | + +**Returns:** *Buffer* + +___ + +### tryAndIncrement + +▸ **tryAndIncrement**(`domain`: Buffer, `message`: Buffer, `compat`: Boolean): *[G1](../classes/_node_modules_bls12377js_src_g1_.g1.md)* + +Defined in node_modules/bls12377js/src/bls.ts:213 + +**Parameters:** + +Name | Type | +------ | ------ | +`domain` | Buffer | +`message` | Buffer | +`compat` | Boolean | + +**Returns:** *[G1](../classes/_node_modules_bls12377js_src_g1_.g1.md)* + +___ + +### uint8ArrayToBuffer + +▸ **uint8ArrayToBuffer**(`src`: Uint8Array): *Buffer* + +Defined in node_modules/bls12377js/src/bls.ts:21 + +**Parameters:** + +Name | Type | +------ | ------ | +`src` | Uint8Array | + +**Returns:** *Buffer* diff --git a/packages/docs/sdk/docs/cryptographic-utils/modules/_node_modules_bls12377js_src_defs_.md b/packages/docs/sdk/docs/cryptographic-utils/modules/_node_modules_bls12377js_src_defs_.md new file mode 100644 index 00000000000..2a487748782 --- /dev/null +++ b/packages/docs/sdk/docs/cryptographic-utils/modules/_node_modules_bls12377js_src_defs_.md @@ -0,0 +1,106 @@ +[@celo/cryptographic-utils](../README.md) › [Globals](../globals.md) › ["node_modules/bls12377js/src/defs"](_node_modules_bls12377js_src_defs_.md) + +# Module: "node_modules/bls12377js/src/defs" + +## Index + +### Interfaces + +* [FieldSpec](../interfaces/_node_modules_bls12377js_src_defs_.fieldspec.md) +* [GroupSpec](../interfaces/_node_modules_bls12377js_src_defs_.groupspec.md) + +### Object literals + +* [Defs](_node_modules_bls12377js_src_defs_.md#const-defs) + +## Object literals + +### `Const` Defs + +### ▪ **Defs**: *object* + +Defined in node_modules/bls12377js/src/defs.ts:3 + +### b + +• **b**: *BigInteger* = bigInt(1) + +Defined in node_modules/bls12377js/src/defs.ts:11 + +### bTwist + +• **bTwist**: *BigInteger[]* = [ + bigInt(0), + bigInt('155198655607781456406391640216936120121836107652948796323930557600032281009004493664981332883744016074664192874906'), + ] + +Defined in node_modules/bls12377js/src/defs.ts:12 + +### blsX + +• **blsX**: *BigInteger* = bigInt('8508c00000000001', 16) + +Defined in node_modules/bls12377js/src/defs.ts:32 + +### fByteSize + +• **fByteSize**: *number* = 48 + +Defined in node_modules/bls12377js/src/defs.ts:10 + +### g1Cofactor + +• **g1Cofactor**: *BigInteger* = bigInt('30631250834960419227450344600217059328') + +Defined in node_modules/bls12377js/src/defs.ts:30 + +### g1Generator + +• **g1Generator**: *BigInteger[]* = [ + bigInt('81937999373150964239938255573465948239988671502647976594219695644855304257327692006745978603320413799295628339695'), + bigInt('241266749859715473739788878240585681733927191168601896383759122102112907357779751001206799952863815012735208165030'), + ] + +Defined in node_modules/bls12377js/src/defs.ts:16 + +### g2Cofactor + +• **g2Cofactor**: *BigInteger* = bigInt('7923214915284317143930293550643874566881017850177945424769256759165301436616933228209277966774092486467289478618404761412630691835764674559376407658497') + +Defined in node_modules/bls12377js/src/defs.ts:31 + +### g2Generator + +• **g2Generator**: *BigInteger[][]* = [ + [ + bigInt('233578398248691099356572568220835526895379068987715365179118596935057653620464273615301663571204657964920925606294'), + bigInt('140913150380207355837477652521042157274541796891053068589147167627541651775299824604154852141315666357241556069118'), + ], + [ + bigInt('63160294768292073209381361943935198908131692476676907196754037919244929611450776219210369229519898517858833747423'), + bigInt('149157405641012693445398062341192467754805999074082136895788947234480009303640899064710353187729182149407503257491'), + ], + ] + +Defined in node_modules/bls12377js/src/defs.ts:20 + +### modulus + +• **modulus**: *BigInteger* = bigInt('258664426012969094010652733694893533536393512754914660539884262666720468348340822774968888139573360124440321458177') + +Defined in node_modules/bls12377js/src/defs.ts:4 + +### nonresidue + +• **nonresidue**: *BigInteger* = bigInt('-5') + +Defined in node_modules/bls12377js/src/defs.ts:5 + +### quadraticNonresidue + +• **quadraticNonresidue**: *BigInteger[]* = [ + bigInt(0), + bigInt(1), + ] + +Defined in node_modules/bls12377js/src/defs.ts:6 diff --git a/packages/docs/sdk/docs/cryptographic-utils/modules/_node_modules_bls12377js_src_f2_.md b/packages/docs/sdk/docs/cryptographic-utils/modules/_node_modules_bls12377js_src_f2_.md new file mode 100644 index 00000000000..e33d7d5df86 --- /dev/null +++ b/packages/docs/sdk/docs/cryptographic-utils/modules/_node_modules_bls12377js_src_f2_.md @@ -0,0 +1,9 @@ +[@celo/cryptographic-utils](../README.md) › [Globals](../globals.md) › ["node_modules/bls12377js/src/f2"](_node_modules_bls12377js_src_f2_.md) + +# Module: "node_modules/bls12377js/src/f2" + +## Index + +### Classes + +* [F2](../classes/_node_modules_bls12377js_src_f2_.f2.md) diff --git a/packages/docs/sdk/docs/cryptographic-utils/modules/_node_modules_bls12377js_src_f_.md b/packages/docs/sdk/docs/cryptographic-utils/modules/_node_modules_bls12377js_src_f_.md new file mode 100644 index 00000000000..020abe6ae61 --- /dev/null +++ b/packages/docs/sdk/docs/cryptographic-utils/modules/_node_modules_bls12377js_src_f_.md @@ -0,0 +1,9 @@ +[@celo/cryptographic-utils](../README.md) › [Globals](../globals.md) › ["node_modules/bls12377js/src/f"](_node_modules_bls12377js_src_f_.md) + +# Module: "node_modules/bls12377js/src/f" + +## Index + +### Classes + +* [F](../classes/_node_modules_bls12377js_src_f_.f.md) diff --git a/packages/docs/sdk/docs/cryptographic-utils/modules/_node_modules_bls12377js_src_g1_.md b/packages/docs/sdk/docs/cryptographic-utils/modules/_node_modules_bls12377js_src_g1_.md new file mode 100644 index 00000000000..7a3618d1b8a --- /dev/null +++ b/packages/docs/sdk/docs/cryptographic-utils/modules/_node_modules_bls12377js_src_g1_.md @@ -0,0 +1,9 @@ +[@celo/cryptographic-utils](../README.md) › [Globals](../globals.md) › ["node_modules/bls12377js/src/g1"](_node_modules_bls12377js_src_g1_.md) + +# Module: "node_modules/bls12377js/src/g1" + +## Index + +### Classes + +* [G1](../classes/_node_modules_bls12377js_src_g1_.g1.md) diff --git a/packages/docs/sdk/docs/cryptographic-utils/modules/_node_modules_bls12377js_src_g2_.md b/packages/docs/sdk/docs/cryptographic-utils/modules/_node_modules_bls12377js_src_g2_.md new file mode 100644 index 00000000000..717d50b111c --- /dev/null +++ b/packages/docs/sdk/docs/cryptographic-utils/modules/_node_modules_bls12377js_src_g2_.md @@ -0,0 +1,9 @@ +[@celo/cryptographic-utils](../README.md) › [Globals](../globals.md) › ["node_modules/bls12377js/src/g2"](_node_modules_bls12377js_src_g2_.md) + +# Module: "node_modules/bls12377js/src/g2" + +## Index + +### Classes + +* [G2](../classes/_node_modules_bls12377js_src_g2_.g2.md) diff --git a/packages/docs/sdk/docs/cryptographic-utils/modules/_node_modules_bls12377js_src_group_.md b/packages/docs/sdk/docs/cryptographic-utils/modules/_node_modules_bls12377js_src_group_.md new file mode 100644 index 00000000000..5a2e718ada6 --- /dev/null +++ b/packages/docs/sdk/docs/cryptographic-utils/modules/_node_modules_bls12377js_src_group_.md @@ -0,0 +1,9 @@ +[@celo/cryptographic-utils](../README.md) › [Globals](../globals.md) › ["node_modules/bls12377js/src/group"](_node_modules_bls12377js_src_group_.md) + +# Module: "node_modules/bls12377js/src/group" + +## Index + +### Classes + +* [Group](../classes/_node_modules_bls12377js_src_group_.group.md) diff --git a/packages/docs/sdk/docs/cryptographic-utils/modules/_packages_sdk_cryptographic_utils_src_account_.md b/packages/docs/sdk/docs/cryptographic-utils/modules/_packages_sdk_cryptographic_utils_src_account_.md new file mode 100644 index 00000000000..19242457fc9 --- /dev/null +++ b/packages/docs/sdk/docs/cryptographic-utils/modules/_packages_sdk_cryptographic_utils_src_account_.md @@ -0,0 +1,403 @@ +[@celo/cryptographic-utils](../README.md) › [Globals](../globals.md) › ["packages/sdk/cryptographic-utils/src/account"](_packages_sdk_cryptographic_utils_src_account_.md) + +# Module: "packages/sdk/cryptographic-utils/src/account" + +## Index + +### References + +* [Bip39](_packages_sdk_cryptographic_utils_src_account_.md#bip39) +* [CELO_DERIVATION_PATH_BASE](_packages_sdk_cryptographic_utils_src_account_.md#celo_derivation_path_base) +* [MnemonicLanguages](_packages_sdk_cryptographic_utils_src_account_.md#mnemoniclanguages) +* [MnemonicStrength](_packages_sdk_cryptographic_utils_src_account_.md#mnemonicstrength) +* [RandomNumberGenerator](_packages_sdk_cryptographic_utils_src_account_.md#randomnumbergenerator) + +### Functions + +* [detectMnemonicLanguage](_packages_sdk_cryptographic_utils_src_account_.md#detectmnemoniclanguage) +* [formatNonAccentedCharacters](_packages_sdk_cryptographic_utils_src_account_.md#formatnonaccentedcharacters) +* [generateDeterministicInviteCode](_packages_sdk_cryptographic_utils_src_account_.md#generatedeterministicinvitecode) +* [generateKeys](_packages_sdk_cryptographic_utils_src_account_.md#generatekeys) +* [generateKeysFromSeed](_packages_sdk_cryptographic_utils_src_account_.md#generatekeysfromseed) +* [generateMnemonic](_packages_sdk_cryptographic_utils_src_account_.md#generatemnemonic) +* [generateSeed](_packages_sdk_cryptographic_utils_src_account_.md#generateseed) +* [getAllLanguages](_packages_sdk_cryptographic_utils_src_account_.md#getalllanguages) +* [invalidMnemonicWords](_packages_sdk_cryptographic_utils_src_account_.md#invalidmnemonicwords) +* [mnemonicLengthFromStrength](_packages_sdk_cryptographic_utils_src_account_.md#mnemoniclengthfromstrength) +* [normalizeMnemonic](_packages_sdk_cryptographic_utils_src_account_.md#normalizemnemonic) +* [suggestMnemonicCorrections](_packages_sdk_cryptographic_utils_src_account_.md#suggestmnemoniccorrections) +* [validateMnemonic](_packages_sdk_cryptographic_utils_src_account_.md#validatemnemonic) + +### Object literals + +* [AccountUtils](_packages_sdk_cryptographic_utils_src_account_.md#const-accountutils) + +## References + +### Bip39 + +• **Bip39**: + +___ + +### CELO_DERIVATION_PATH_BASE + +• **CELO_DERIVATION_PATH_BASE**: + +___ + +### MnemonicLanguages + +• **MnemonicLanguages**: + +___ + +### MnemonicStrength + +• **MnemonicStrength**: + +___ + +### RandomNumberGenerator + +• **RandomNumberGenerator**: + +## Functions + +### detectMnemonicLanguage + +▸ **detectMnemonicLanguage**(`words`: string[], `candidates?`: [MnemonicLanguages](_packages_sdk_cryptographic_utils_src_account_.md#mnemoniclanguages)[]): *[MnemonicLanguages](_packages_sdk_cryptographic_utils_src_account_.md#mnemoniclanguages) | undefined* + +*Defined in [packages/sdk/cryptographic-utils/src/account.ts:230](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L230)* + +Detects the language of tokenized mnemonic phrase by applying a heuristic. + +**`remarks`** Uses a heuristic of returning the language with the most matching words. In practice, we +expect all words to come from a single language, also some may be misspelled or otherwise +malformed. It may occasionally occur that a typo results in word from another language (e.g. bag +-> bagr) but this should occur at most once or twice per phrase. + +**Parameters:** + +Name | Type | +------ | ------ | +`words` | string[] | +`candidates?` | [MnemonicLanguages](_packages_sdk_cryptographic_utils_src_account_.md#mnemoniclanguages)[] | + +**Returns:** *[MnemonicLanguages](_packages_sdk_cryptographic_utils_src_account_.md#mnemoniclanguages) | undefined* + +___ + +### formatNonAccentedCharacters + +▸ **formatNonAccentedCharacters**(`mnemonic`: string): *string* + +*Defined in [packages/sdk/cryptographic-utils/src/account.ts:156](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L156)* + +**`deprecated`** now an alias for normalizeMnemonic. + +**Parameters:** + +Name | Type | +------ | ------ | +`mnemonic` | string | + +**Returns:** *string* + +___ + +### generateDeterministicInviteCode + +▸ **generateDeterministicInviteCode**(`recipientPhoneHash`: string, `recipientPepper`: string, `addressIndex`: number, `changeIndex`: number, `derivationPath`: string): *object* + +*Defined in [packages/sdk/cryptographic-utils/src/account.ts:412](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L412)* + +**Parameters:** + +Name | Type | Default | +------ | ------ | ------ | +`recipientPhoneHash` | string | - | +`recipientPepper` | string | - | +`addressIndex` | number | 0 | +`changeIndex` | number | 0 | +`derivationPath` | string | CELO_DERIVATION_PATH_BASE | + +**Returns:** *object* + +* **privateKey**: *string* + +* **publicKey**: *string* + +___ + +### generateKeys + +▸ **generateKeys**(`mnemonic`: string, `password?`: undefined | string, `changeIndex`: number, `addressIndex`: number, `bip39ToUse`: Bip39, `derivationPath`: string): *Promise‹object›* + +*Defined in [packages/sdk/cryptographic-utils/src/account.ts:400](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L400)* + +**Parameters:** + +Name | Type | Default | +------ | ------ | ------ | +`mnemonic` | string | - | +`password?` | undefined | string | - | +`changeIndex` | number | 0 | +`addressIndex` | number | 0 | +`bip39ToUse` | Bip39 | bip39Wrapper | +`derivationPath` | string | CELO_DERIVATION_PATH_BASE | + +**Returns:** *Promise‹object›* + +___ + +### generateKeysFromSeed + +▸ **generateKeysFromSeed**(`seed`: Buffer, `changeIndex`: number, `addressIndex`: number, `derivationPath`: string): *object* + +*Defined in [packages/sdk/cryptographic-utils/src/account.ts:440](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L440)* + +**Parameters:** + +Name | Type | Default | +------ | ------ | ------ | +`seed` | Buffer | - | +`changeIndex` | number | 0 | +`addressIndex` | number | 0 | +`derivationPath` | string | CELO_DERIVATION_PATH_BASE | + +**Returns:** *object* + +* **address**: *string* + +* **privateKey**: *string* + +* **publicKey**: *string* + +___ + +### generateMnemonic + +▸ **generateMnemonic**(`strength`: [MnemonicStrength](_packages_sdk_cryptographic_utils_src_account_.md#mnemonicstrength), `language?`: [MnemonicLanguages](_packages_sdk_cryptographic_utils_src_account_.md#mnemoniclanguages), `bip39ToUse`: Bip39): *Promise‹string›* + +*Defined in [packages/sdk/cryptographic-utils/src/account.ts:51](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L51)* + +**Parameters:** + +Name | Type | Default | +------ | ------ | ------ | +`strength` | [MnemonicStrength](_packages_sdk_cryptographic_utils_src_account_.md#mnemonicstrength) | MnemonicStrength.s256_24words | +`language?` | [MnemonicLanguages](_packages_sdk_cryptographic_utils_src_account_.md#mnemoniclanguages) | - | +`bip39ToUse` | Bip39 | bip39Wrapper | + +**Returns:** *Promise‹string›* + +___ + +### generateSeed + +▸ **generateSeed**(`mnemonic`: string, `password?`: undefined | string, `bip39ToUse`: Bip39, `keyByteLength`: number): *Promise‹Buffer›* + +*Defined in [packages/sdk/cryptographic-utils/src/account.ts:425](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L425)* + +**Parameters:** + +Name | Type | Default | +------ | ------ | ------ | +`mnemonic` | string | - | +`password?` | undefined | string | - | +`bip39ToUse` | Bip39 | bip39Wrapper | +`keyByteLength` | number | 64 | + +**Returns:** *Promise‹Buffer›* + +___ + +### getAllLanguages + +▸ **getAllLanguages**(): *[MnemonicLanguages](_packages_sdk_cryptographic_utils_src_account_.md#mnemoniclanguages)[]* + +*Defined in [packages/sdk/cryptographic-utils/src/account.ts:185](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L185)* + +**Returns:** *[MnemonicLanguages](_packages_sdk_cryptographic_utils_src_account_.md#mnemoniclanguages)[]* + +___ + +### invalidMnemonicWords + +▸ **invalidMnemonicWords**(`mnemonic`: string, `language?`: [MnemonicLanguages](_packages_sdk_cryptographic_utils_src_account_.md#mnemoniclanguages)): *string[] | undefined* + +*Defined in [packages/sdk/cryptographic-utils/src/account.ts:85](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L85)* + +Return a list of the words in the mnemonic that are not in the list of valid BIP-39 words for the +specified or detected language. + +**`remarks`** Will return undefined if the language cannot be detected (e.g. all the words are +invalid, or half of the valid words are from one language and the other half from another.) + +**Parameters:** + +Name | Type | +------ | ------ | +`mnemonic` | string | +`language?` | [MnemonicLanguages](_packages_sdk_cryptographic_utils_src_account_.md#mnemoniclanguages) | + +**Returns:** *string[] | undefined* + +___ + +### mnemonicLengthFromStrength + +▸ **mnemonicLengthFromStrength**(`strength`: [MnemonicStrength](_packages_sdk_cryptographic_utils_src_account_.md#mnemonicstrength)): *number* + +*Defined in [packages/sdk/cryptographic-utils/src/account.ts:199](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L199)* + +**Parameters:** + +Name | Type | +------ | ------ | +`strength` | [MnemonicStrength](_packages_sdk_cryptographic_utils_src_account_.md#mnemonicstrength) | + +**Returns:** *number* + +___ + +### normalizeMnemonic + +▸ **normalizeMnemonic**(`mnemonic`: string, `language?`: [MnemonicLanguages](_packages_sdk_cryptographic_utils_src_account_.md#mnemoniclanguages)): *string* + +*Defined in [packages/sdk/cryptographic-utils/src/account.ts:106](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L106)* + +Normalize the mnemonic phrase to eliminate a number of inconsistencies with standard BIP-39 +phrases that are likely to arise when a user manually enters a phrase. + +**`remarks`** Note that this does not guarantee that the output is a valid mnemonic phrase, or even +that all the words in the phrase are contained in a valid wordlist. + +**Parameters:** + +Name | Type | +------ | ------ | +`mnemonic` | string | +`language?` | [MnemonicLanguages](_packages_sdk_cryptographic_utils_src_account_.md#mnemoniclanguages) | + +**Returns:** *string* + +___ + +### suggestMnemonicCorrections + +▸ **suggestMnemonicCorrections**(`mnemonic`: string, `language?`: [MnemonicLanguages](_packages_sdk_cryptographic_utils_src_account_.md#mnemoniclanguages), `strength?`: [MnemonicStrength](_packages_sdk_cryptographic_utils_src_account_.md#mnemonicstrength)): *Generator‹string›* + +*Defined in [packages/sdk/cryptographic-utils/src/account.ts:285](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L285)* + +Generates a list of suggested corrections to the mnemonic phrase based on a set of heuristics. + +**`remarks`** +Each yielded suggestion represents an attempt to correct the seed phrase by replacing any invalid +words with the most likely valid words. Returned suggestions phrases are ordered by probability +based on a noisy channel model, described in detail in CIP-39. + +The generated list of suggestions is exponential in size, and effectively infinite. One should +not attempt to generate the entire list. + +All yielded suggestions will have a valid checksum, but are not guaranteed to correspond to any +given wallet. If the phrase is being used to recover a wallet with non-zero balance, it is +suggested that the caller check the balance of the derived wallet address. If the balance is +non-zero, they can be sure that the phrase is correct. If it is zero, then they should continue +and try the next suggestion. + +It is recommended to normalize the mnemonic phrase before inputting to this function. + +**`privateremarks`** +TODO(victor): Include a heuristic rule for phrase-level corrections, such as word ordering swaps. + +**Parameters:** + +Name | Type | +------ | ------ | +`mnemonic` | string | +`language?` | [MnemonicLanguages](_packages_sdk_cryptographic_utils_src_account_.md#mnemoniclanguages) | +`strength?` | [MnemonicStrength](_packages_sdk_cryptographic_utils_src_account_.md#mnemonicstrength) | + +**Returns:** *Generator‹string›* + +___ + +### validateMnemonic + +▸ **validateMnemonic**(`mnemonic`: string, `bip39ToUse`: Bip39, `language?`: [MnemonicLanguages](_packages_sdk_cryptographic_utils_src_account_.md#mnemoniclanguages)): *boolean* + +*Defined in [packages/sdk/cryptographic-utils/src/account.ts:59](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L59)* + +**Parameters:** + +Name | Type | Default | +------ | ------ | ------ | +`mnemonic` | string | - | +`bip39ToUse` | Bip39 | bip39Wrapper | +`language?` | [MnemonicLanguages](_packages_sdk_cryptographic_utils_src_account_.md#mnemoniclanguages) | - | + +**Returns:** *boolean* + +## Object literals + +### `Const` AccountUtils + +### ▪ **AccountUtils**: *object* + +*Defined in [packages/sdk/cryptographic-utils/src/account.ts:461](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L461)* + +### detectMnemonicLanguage + +• **detectMnemonicLanguage**: *[detectMnemonicLanguage](_packages_sdk_cryptographic_utils_src_account_.md#detectmnemoniclanguage)* + +*Defined in [packages/sdk/cryptographic-utils/src/account.ts:462](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L462)* + +### generateKeys + +• **generateKeys**: *[generateKeys](_packages_sdk_cryptographic_utils_src_account_.md#generatekeys)* + +*Defined in [packages/sdk/cryptographic-utils/src/account.ts:468](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L468)* + +### generateKeysFromSeed + +• **generateKeysFromSeed**: *[generateKeysFromSeed](_packages_sdk_cryptographic_utils_src_account_.md#generatekeysfromseed)* + +*Defined in [packages/sdk/cryptographic-utils/src/account.ts:470](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L470)* + +### generateMnemonic + +• **generateMnemonic**: *[generateMnemonic](_packages_sdk_cryptographic_utils_src_account_.md#generatemnemonic)* + +*Defined in [packages/sdk/cryptographic-utils/src/account.ts:463](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L463)* + +### generateSeed + +• **generateSeed**: *[generateSeed](_packages_sdk_cryptographic_utils_src_account_.md#generateseed)* + +*Defined in [packages/sdk/cryptographic-utils/src/account.ts:469](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L469)* + +### invalidMnemonicWords + +• **invalidMnemonicWords**: *[invalidMnemonicWords](_packages_sdk_cryptographic_utils_src_account_.md#invalidmnemonicwords)* + +*Defined in [packages/sdk/cryptographic-utils/src/account.ts:466](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L466)* + +### normalizeMnemonic + +• **normalizeMnemonic**: *[normalizeMnemonic](_packages_sdk_cryptographic_utils_src_account_.md#normalizemnemonic)* + +*Defined in [packages/sdk/cryptographic-utils/src/account.ts:464](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L464)* + +### suggestMnemonicCorrections + +• **suggestMnemonicCorrections**: *[suggestMnemonicCorrections](_packages_sdk_cryptographic_utils_src_account_.md#suggestmnemoniccorrections)* + +*Defined in [packages/sdk/cryptographic-utils/src/account.ts:467](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L467)* + +### validateMnemonic + +• **validateMnemonic**: *[validateMnemonic](_packages_sdk_cryptographic_utils_src_account_.md#validatemnemonic)* + +*Defined in [packages/sdk/cryptographic-utils/src/account.ts:465](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/account.ts#L465)* diff --git a/packages/docs/sdk/docs/cryptographic-utils/modules/_packages_sdk_cryptographic_utils_src_bls_.md b/packages/docs/sdk/docs/cryptographic-utils/modules/_packages_sdk_cryptographic_utils_src_bls_.md new file mode 100644 index 00000000000..c5816514771 --- /dev/null +++ b/packages/docs/sdk/docs/cryptographic-utils/modules/_packages_sdk_cryptographic_utils_src_bls_.md @@ -0,0 +1,81 @@ +[@celo/cryptographic-utils](../README.md) › [Globals](../globals.md) › ["packages/sdk/cryptographic-utils/src/bls"](_packages_sdk_cryptographic_utils_src_bls_.md) + +# Module: "packages/sdk/cryptographic-utils/src/bls" + +## Index + +### Variables + +* [BLS_POP_SIZE](_packages_sdk_cryptographic_utils_src_bls_.md#const-bls_pop_size) +* [BLS_PUBLIC_KEY_SIZE](_packages_sdk_cryptographic_utils_src_bls_.md#const-bls_public_key_size) + +### Functions + +* [blsPrivateKeyToProcessedPrivateKey](_packages_sdk_cryptographic_utils_src_bls_.md#const-blsprivatekeytoprocessedprivatekey) +* [getBlsPoP](_packages_sdk_cryptographic_utils_src_bls_.md#const-getblspop) +* [getBlsPublicKey](_packages_sdk_cryptographic_utils_src_bls_.md#const-getblspublickey) + +## Variables + +### `Const` BLS_POP_SIZE + +• **BLS_POP_SIZE**: *48* = 48 + +*Defined in [packages/sdk/cryptographic-utils/src/bls.ts:12](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/bls.ts#L12)* + +___ + +### `Const` BLS_PUBLIC_KEY_SIZE + +• **BLS_PUBLIC_KEY_SIZE**: *96* = 96 + +*Defined in [packages/sdk/cryptographic-utils/src/bls.ts:11](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/bls.ts#L11)* + +## Functions + +### `Const` blsPrivateKeyToProcessedPrivateKey + +▸ **blsPrivateKeyToProcessedPrivateKey**(`privateKeyHex`: string): *any* + +*Defined in [packages/sdk/cryptographic-utils/src/bls.ts:14](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/bls.ts#L14)* + +**Parameters:** + +Name | Type | +------ | ------ | +`privateKeyHex` | string | + +**Returns:** *any* + +___ + +### `Const` getBlsPoP + +▸ **getBlsPoP**(`address`: string, `privateKeyHex`: string): *string* + +*Defined in [packages/sdk/cryptographic-utils/src/bls.ts:53](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/bls.ts#L53)* + +**Parameters:** + +Name | Type | +------ | ------ | +`address` | string | +`privateKeyHex` | string | + +**Returns:** *string* + +___ + +### `Const` getBlsPublicKey + +▸ **getBlsPublicKey**(`privateKeyHex`: string): *string* + +*Defined in [packages/sdk/cryptographic-utils/src/bls.ts:48](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/bls.ts#L48)* + +**Parameters:** + +Name | Type | +------ | ------ | +`privateKeyHex` | string | + +**Returns:** *string* diff --git a/packages/docs/sdk/docs/cryptographic-utils/modules/_packages_sdk_cryptographic_utils_src_commentencryption_.md b/packages/docs/sdk/docs/cryptographic-utils/modules/_packages_sdk_cryptographic_utils_src_commentencryption_.md new file mode 100644 index 00000000000..9bdb0d0c7f7 --- /dev/null +++ b/packages/docs/sdk/docs/cryptographic-utils/modules/_packages_sdk_cryptographic_utils_src_commentencryption_.md @@ -0,0 +1,131 @@ +[@celo/cryptographic-utils](../README.md) › [Globals](../globals.md) › ["packages/sdk/cryptographic-utils/src/commentEncryption"](_packages_sdk_cryptographic_utils_src_commentencryption_.md) + +# Module: "packages/sdk/cryptographic-utils/src/commentEncryption" + +## Index + +### Interfaces + +* [EncryptionStatus](../interfaces/_packages_sdk_cryptographic_utils_src_commentencryption_.encryptionstatus.md) + +### Functions + +* [decryptComment](_packages_sdk_cryptographic_utils_src_commentencryption_.md#decryptcomment) +* [decryptData](_packages_sdk_cryptographic_utils_src_commentencryption_.md#decryptdata) +* [encryptComment](_packages_sdk_cryptographic_utils_src_commentencryption_.md#encryptcomment) +* [encryptData](_packages_sdk_cryptographic_utils_src_commentencryption_.md#encryptdata) + +### Object literals + +* [CommentEncryptionUtils](_packages_sdk_cryptographic_utils_src_commentencryption_.md#const-commentencryptionutils) + +## Functions + +### decryptComment + +▸ **decryptComment**(`comment`: string, `key`: Buffer, `sender`: boolean): *[EncryptionStatus](../interfaces/_packages_sdk_cryptographic_utils_src_commentencryption_.encryptionstatus.md)* + +*Defined in [packages/sdk/cryptographic-utils/src/commentEncryption.ts:104](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/commentEncryption.ts#L104)* + +Decrypts a comments encrypted by encryptComment. If it cannot decrypt the comment (i.e. comment was +never encrypted in the first place), it returns the comments without any changes. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`comment` | string | Comment to decrypt. If encrypted, base64 encoded. May be plaintext. | +`key` | Buffer | Private key to decrypt the message with. | +`sender` | boolean | If the decryptor is the sender of the message. | + +**Returns:** *[EncryptionStatus](../interfaces/_packages_sdk_cryptographic_utils_src_commentencryption_.encryptionstatus.md)* + +Decrypted comment if can decrypt, otherwise comment. + +___ + +### decryptData + +▸ **decryptData**(`data`: Buffer, `key`: Buffer, `sender`: boolean): *Buffer* + +*Defined in [packages/sdk/cryptographic-utils/src/commentEncryption.ts:45](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/commentEncryption.ts#L45)* + +Decrypts raw data that was encrypted by encryptData. Throws on error. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`data` | Buffer | Data to decrypt. | +`key` | Buffer | Private key to decrypt the message with. | +`sender` | boolean | If the decryptor is the sender of the message. | + +**Returns:** *Buffer* + +Decrypted data. + +___ + +### encryptComment + +▸ **encryptComment**(`comment`: string, `pubKeyRecipient`: Buffer, `pubKeySelf`: Buffer): *[EncryptionStatus](../interfaces/_packages_sdk_cryptographic_utils_src_commentencryption_.encryptionstatus.md)* + +*Defined in [packages/sdk/cryptographic-utils/src/commentEncryption.ts:69](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/commentEncryption.ts#L69)* + +Encrypts a comment. If it can encrypt, it returns a base64 string with the following: + ECIES(session key to other) + ECIES(session key to self) + AES(comment) +If it fails to encrypt, it returns the comment without any changes. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`comment` | string | Comment to encrypt. | +`pubKeyRecipient` | Buffer | Public key of the recipient. May be compressed. | +`pubKeySelf` | Buffer | Public key of the sender. May be compressed. | + +**Returns:** *[EncryptionStatus](../interfaces/_packages_sdk_cryptographic_utils_src_commentencryption_.encryptionstatus.md)* + +base64 string of encrypted comment if can encrypt, otherwise comment. + +___ + +### encryptData + +▸ **encryptData**(`data`: Buffer, `pubKeyRecipient`: Buffer, `pubKeySelf`: Buffer): *Buffer* + +*Defined in [packages/sdk/cryptographic-utils/src/commentEncryption.ts:27](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/commentEncryption.ts#L27)* + +Encrypts a buffer to two recipients. Throws on error. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`data` | Buffer | Data to encrypt | +`pubKeyRecipient` | Buffer | Public key of the recipient. Uncompressed without leading 0x04. | +`pubKeySelf` | Buffer | Public key of the sender. Uncompressed without leading 0x04. | + +**Returns:** *Buffer* + +Encrypted data to sender and recipient. + +## Object literals + +### `Const` CommentEncryptionUtils + +### ▪ **CommentEncryptionUtils**: *object* + +*Defined in [packages/sdk/cryptographic-utils/src/commentEncryption.ts:115](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/commentEncryption.ts#L115)* + +### decryptComment + +• **decryptComment**: *[decryptComment](_packages_sdk_cryptographic_utils_src_commentencryption_.md#decryptcomment)* + +*Defined in [packages/sdk/cryptographic-utils/src/commentEncryption.ts:117](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/commentEncryption.ts#L117)* + +### encryptComment + +• **encryptComment**: *[encryptComment](_packages_sdk_cryptographic_utils_src_commentencryption_.md#encryptcomment)* + +*Defined in [packages/sdk/cryptographic-utils/src/commentEncryption.ts:116](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/commentEncryption.ts#L116)* diff --git a/packages/docs/sdk/docs/cryptographic-utils/modules/_packages_sdk_cryptographic_utils_src_dataencryptionkey_.md b/packages/docs/sdk/docs/cryptographic-utils/modules/_packages_sdk_cryptographic_utils_src_dataencryptionkey_.md new file mode 100644 index 00000000000..4eafcb54926 --- /dev/null +++ b/packages/docs/sdk/docs/cryptographic-utils/modules/_packages_sdk_cryptographic_utils_src_dataencryptionkey_.md @@ -0,0 +1,103 @@ +[@celo/cryptographic-utils](../README.md) › [Globals](../globals.md) › ["packages/sdk/cryptographic-utils/src/dataEncryptionKey"](_packages_sdk_cryptographic_utils_src_dataencryptionkey_.md) + +# Module: "packages/sdk/cryptographic-utils/src/dataEncryptionKey" + +## Index + +### Functions + +* [compressedPubKey](_packages_sdk_cryptographic_utils_src_dataencryptionkey_.md#compressedpubkey) +* [decompressPublicKey](_packages_sdk_cryptographic_utils_src_dataencryptionkey_.md#decompresspublickey) +* [deriveDek](_packages_sdk_cryptographic_utils_src_dataencryptionkey_.md#derivedek) + +### Object literals + +* [DataEncryptionKeyUtils](_packages_sdk_cryptographic_utils_src_dataencryptionkey_.md#const-dataencryptionkeyutils) + +## Functions + +### compressedPubKey + +▸ **compressedPubKey**(`privateKey`: Buffer): *string* + +*Defined in [packages/sdk/cryptographic-utils/src/dataEncryptionKey.ts:10](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/dataEncryptionKey.ts#L10)* + +Turns a private key to a compressed public key (hex string with hex leader). + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`privateKey` | Buffer | Private key. | + +**Returns:** *string* + +Corresponding compessed public key in hex encoding with '0x' leader. + +___ + +### decompressPublicKey + +▸ **decompressPublicKey**(`publicKey`: Buffer): *Buffer* + +*Defined in [packages/sdk/cryptographic-utils/src/dataEncryptionKey.ts:27](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/dataEncryptionKey.ts#L27)* + +Decompresses a public key and strips out the '0x04' leading constant. This makes +any public key suitable to be used with this ECIES implementation. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`publicKey` | Buffer | Public key in standard form (with 0x02, 0x03, or 0x04 prefix) | + +**Returns:** *Buffer* + +Decompresssed public key without prefix. + +___ + +### deriveDek + +▸ **deriveDek**(`mnemonic`: string, `bip39ToUse?`: [Bip39](_packages_sdk_cryptographic_utils_src_account_.md#bip39)): *Promise‹object›* + +*Defined in [packages/sdk/cryptographic-utils/src/dataEncryptionKey.ts:42](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/dataEncryptionKey.ts#L42)* + +Derives a data encryption key from the mnemonic + +**Parameters:** + +Name | Type | +------ | ------ | +`mnemonic` | string | +`bip39ToUse?` | [Bip39](_packages_sdk_cryptographic_utils_src_account_.md#bip39) | + +**Returns:** *Promise‹object›* + +Comment Encryption Private key. + +## Object literals + +### `Const` DataEncryptionKeyUtils + +### ▪ **DataEncryptionKeyUtils**: *object* + +*Defined in [packages/sdk/cryptographic-utils/src/dataEncryptionKey.ts:56](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/dataEncryptionKey.ts#L56)* + +### compressedPubKey + +• **compressedPubKey**: *[compressedPubKey](_packages_sdk_cryptographic_utils_src_dataencryptionkey_.md#compressedpubkey)* + +*Defined in [packages/sdk/cryptographic-utils/src/dataEncryptionKey.ts:57](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/dataEncryptionKey.ts#L57)* + +### decompressPublicKey + +• **decompressPublicKey**: *[decompressPublicKey](_packages_sdk_cryptographic_utils_src_dataencryptionkey_.md#decompresspublickey)* + +*Defined in [packages/sdk/cryptographic-utils/src/dataEncryptionKey.ts:58](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/dataEncryptionKey.ts#L58)* + +### deriveDek + +• **deriveDek**: *[deriveDek](_packages_sdk_cryptographic_utils_src_dataencryptionkey_.md#derivedek)* + +*Defined in [packages/sdk/cryptographic-utils/src/dataEncryptionKey.ts:59](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/cryptographic-utils/src/dataEncryptionKey.ts#L59)* diff --git a/packages/docs/sdk/docs/network-utils/modules/_utils_timezone_.md b/packages/docs/sdk/docs/network-utils/modules/_utils_timezone_.md index 03f8aa7e459..beccd294ef8 100644 --- a/packages/docs/sdk/docs/network-utils/modules/_utils_timezone_.md +++ b/packages/docs/sdk/docs/network-utils/modules/_utils_timezone_.md @@ -18,7 +18,7 @@ ### _testSetTimezoneOverride -▸ **_testSetTimezoneOverride**(`zone`: string | undefined): *[_testSetTimezoneOverride](_utils_timezone_.md#_testsettimezoneoverride)* +▸ **_testSetTimezoneOverride**(`zone`: string | undefined): *void* *Defined in [utils/timezone.ts:7](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/network-utils/src/utils/timezone.ts#L7)* @@ -28,7 +28,7 @@ Name | Type | ------ | ------ | `zone` | string | undefined | -**Returns:** *[_testSetTimezoneOverride](_utils_timezone_.md#_testsettimezoneoverride)* +**Returns:** *void* ___ diff --git a/packages/docs/sdk/docs/phone-utils/globals.md b/packages/docs/sdk/docs/phone-utils/globals.md index 750e32eb07f..9f0a68e72e0 100644 --- a/packages/docs/sdk/docs/phone-utils/globals.md +++ b/packages/docs/sdk/docs/phone-utils/globals.md @@ -9,6 +9,7 @@ * ["countries"](modules/_countries_.md) * ["data/countries/es/country"](modules/_data_countries_es_country_.md) * ["getCountryEmoji"](modules/_getcountryemoji_.md) +* ["getPhoneHash"](modules/_getphonehash_.md) * ["inputValidation"](modules/_inputvalidation_.md) * ["io"](modules/_io_.md) * ["phoneNumbers"](modules/_phonenumbers_.md) diff --git a/packages/docs/sdk/docs/phone-utils/modules/_getphonehash_.md b/packages/docs/sdk/docs/phone-utils/modules/_getphonehash_.md new file mode 100644 index 00000000000..b9bb995061b --- /dev/null +++ b/packages/docs/sdk/docs/phone-utils/modules/_getphonehash_.md @@ -0,0 +1,5 @@ +[@celo/phone-utils](../README.md) › [Globals](../globals.md) › ["getPhoneHash"](_getphonehash_.md) + +# Module: "getPhoneHash" + + diff --git a/packages/docs/sdk/docs/phone-utils/modules/_phonenumbers_.md b/packages/docs/sdk/docs/phone-utils/modules/_phonenumbers_.md index 38fe88fc1e4..adf3d34643d 100644 --- a/packages/docs/sdk/docs/phone-utils/modules/_phonenumbers_.md +++ b/packages/docs/sdk/docs/phone-utils/modules/_phonenumbers_.md @@ -27,7 +27,7 @@ ▸ **getCountryCode**(`e164PhoneNumber`: string): *[getCountryCode](_phonenumbers_.md#getcountrycode)* -*Defined in [phoneNumbers.ts:12](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/phone-utils/src/phoneNumbers.ts#L12)* +*Defined in [phoneNumbers.ts:13](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/phone-utils/src/phoneNumbers.ts#L13)* **Parameters:** @@ -43,7 +43,7 @@ ___ ▸ **getDisplayNumberInternational**(`e164PhoneNumber`: string): *[getDisplayNumberInternational](_phonenumbers_.md#getdisplaynumberinternational)* -*Defined in [phoneNumbers.ts:58](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/phone-utils/src/phoneNumbers.ts#L58)* +*Defined in [phoneNumbers.ts:59](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/phone-utils/src/phoneNumbers.ts#L59)* **Parameters:** @@ -59,7 +59,7 @@ ___ ▸ **getDisplayPhoneNumber**(`phoneNumber`: string, `defaultCountryCode`: string): *[getDisplayPhoneNumber](_phonenumbers_.md#getdisplayphonenumber)* -*Defined in [phoneNumbers.ts:48](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/phone-utils/src/phoneNumbers.ts#L48)* +*Defined in [phoneNumbers.ts:49](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/phone-utils/src/phoneNumbers.ts#L49)* **Parameters:** @@ -76,7 +76,7 @@ ___ ▸ **getE164DisplayNumber**(`e164PhoneNumber`: string): *[getE164DisplayNumber](_phonenumbers_.md#gete164displaynumber)* -*Defined in [phoneNumbers.ts:69](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/phone-utils/src/phoneNumbers.ts#L69)* +*Defined in [phoneNumbers.ts:70](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/phone-utils/src/phoneNumbers.ts#L70)* **Parameters:** @@ -92,7 +92,7 @@ ___ ▸ **getE164Number**(`phoneNumber`: string, `defaultCountryCode`: string): *[getE164Number](_phonenumbers_.md#gete164number)* -*Defined in [phoneNumbers.ts:74](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/phone-utils/src/phoneNumbers.ts#L74)* +*Defined in [phoneNumbers.ts:75](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/phone-utils/src/phoneNumbers.ts#L75)* **Parameters:** @@ -109,7 +109,7 @@ ___ ▸ **getExampleNumber**(`regionCode`: string, `useOnlyZeroes`: boolean, `isInternational`: boolean): *[getExampleNumber](_phonenumbers_.md#getexamplenumber)* -*Defined in [phoneNumbers.ts:211](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/phone-utils/src/phoneNumbers.ts#L211)* +*Defined in [phoneNumbers.ts:212](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/phone-utils/src/phoneNumbers.ts#L212)* **Parameters:** @@ -127,7 +127,7 @@ ___ ▸ **getRegionCode**(`e164PhoneNumber`: string): *[getRegionCode](_phonenumbers_.md#getregioncode)* -*Defined in [phoneNumbers.ts:24](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/phone-utils/src/phoneNumbers.ts#L24)* +*Defined in [phoneNumbers.ts:25](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/phone-utils/src/phoneNumbers.ts#L25)* **Parameters:** @@ -143,7 +143,7 @@ ___ ▸ **getRegionCodeFromCountryCode**(`countryCode`: string): *[getRegionCodeFromCountryCode](_phonenumbers_.md#getregioncodefromcountrycode)* -*Defined in [phoneNumbers.ts:36](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/phone-utils/src/phoneNumbers.ts#L36)* +*Defined in [phoneNumbers.ts:37](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/phone-utils/src/phoneNumbers.ts#L37)* **Parameters:** @@ -159,7 +159,7 @@ ___ ▸ **isE164NumberStrict**(`phoneNumber`: string): *[isE164NumberStrict](_phonenumbers_.md#ise164numberstrict)* -*Defined in [phoneNumbers.ts:84](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/phone-utils/src/phoneNumbers.ts#L84)* +*Defined in [phoneNumbers.ts:85](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/phone-utils/src/phoneNumbers.ts#L85)* **Parameters:** @@ -175,7 +175,7 @@ ___ ▸ **parsePhoneNumber**(`phoneNumberRaw`: string, `defaultCountryCode?`: undefined | string): *ParsedPhoneNumber | null* -*Defined in [phoneNumbers.ts:96](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/phone-utils/src/phoneNumbers.ts#L96)* +*Defined in [phoneNumbers.ts:97](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/phone-utils/src/phoneNumbers.ts#L97)* **Parameters:** @@ -192,40 +192,46 @@ Name | Type | ### ▪ **PhoneNumberUtils**: *object* -*Defined in [phoneNumbers.ts:239](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/phone-utils/src/phoneNumbers.ts#L239)* +*Defined in [phoneNumbers.ts:240](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/phone-utils/src/phoneNumbers.ts#L240)* ### getCountryCode • **getCountryCode**: *[getCountryCode](_phonenumbers_.md#getcountrycode)* -*Defined in [phoneNumbers.ts:240](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/phone-utils/src/phoneNumbers.ts#L240)* +*Defined in [phoneNumbers.ts:242](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/phone-utils/src/phoneNumbers.ts#L242)* ### getDisplayPhoneNumber • **getDisplayPhoneNumber**: *[getDisplayPhoneNumber](_phonenumbers_.md#getdisplayphonenumber)* -*Defined in [phoneNumbers.ts:242](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/phone-utils/src/phoneNumbers.ts#L242)* +*Defined in [phoneNumbers.ts:244](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/phone-utils/src/phoneNumbers.ts#L244)* ### getE164Number • **getE164Number**: *[getE164Number](_phonenumbers_.md#gete164number)* -*Defined in [phoneNumbers.ts:243](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/phone-utils/src/phoneNumbers.ts#L243)* +*Defined in [phoneNumbers.ts:245](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/phone-utils/src/phoneNumbers.ts#L245)* + +### getPhoneHash + +• **getPhoneHash**: *getPhoneHash* + +*Defined in [phoneNumbers.ts:241](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/phone-utils/src/phoneNumbers.ts#L241)* ### getRegionCode • **getRegionCode**: *[getRegionCode](_phonenumbers_.md#getregioncode)* -*Defined in [phoneNumbers.ts:241](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/phone-utils/src/phoneNumbers.ts#L241)* +*Defined in [phoneNumbers.ts:243](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/phone-utils/src/phoneNumbers.ts#L243)* ### isE164Number • **isE164Number**: *isE164Number* -*Defined in [phoneNumbers.ts:244](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/phone-utils/src/phoneNumbers.ts#L244)* +*Defined in [phoneNumbers.ts:246](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/phone-utils/src/phoneNumbers.ts#L246)* ### parsePhoneNumber • **parsePhoneNumber**: *[parsePhoneNumber](_phonenumbers_.md#parsephonenumber)* -*Defined in [phoneNumbers.ts:245](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/phone-utils/src/phoneNumbers.ts#L245)* +*Defined in [phoneNumbers.ts:247](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/phone-utils/src/phoneNumbers.ts#L247)* diff --git a/packages/docs/sdk/docs/utils/README.md b/packages/docs/sdk/docs/utils/README.md index 6439043eb54..e05229b3dce 100644 --- a/packages/docs/sdk/docs/utils/README.md +++ b/packages/docs/sdk/docs/utils/README.md @@ -8,11 +8,13 @@ * ["address"](modules/_address_.md) * ["async"](modules/_async_.md) +* ["attestations"](modules/_attestations_.md) * ["bn"](modules/_bn_.md) * ["celoHistory"](modules/_celohistory_.md) * ["collections"](modules/_collections_.md) * ["contacts"](modules/_contacts_.md) * ["currencies"](modules/_currencies_.md) +* ["dappkit"](modules/_dappkit_.md) * ["displayFormatting"](modules/_displayformatting_.md) * ["ecdh"](modules/_ecdh_.md) * ["ecies"](modules/_ecies_.md) diff --git a/packages/docs/sdk/docs/utils/interfaces/_sign_typed_data_utils_.eip712parameter.md b/packages/docs/sdk/docs/utils/interfaces/_sign_typed_data_utils_.eip712parameter.md index 6afc76fe2d1..6c8e7f2ce19 100644 --- a/packages/docs/sdk/docs/utils/interfaces/_sign_typed_data_utils_.eip712parameter.md +++ b/packages/docs/sdk/docs/utils/interfaces/_sign_typed_data_utils_.eip712parameter.md @@ -19,7 +19,7 @@ • **name**: *string* -*Defined in [sign-typed-data-utils.ts:10](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L10)* +*Defined in [sign-typed-data-utils.ts:8](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L8)* ___ @@ -27,4 +27,4 @@ ___ • **type**: *string* -*Defined in [sign-typed-data-utils.ts:11](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L11)* +*Defined in [sign-typed-data-utils.ts:9](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L9)* diff --git a/packages/docs/sdk/docs/utils/interfaces/_sign_typed_data_utils_.eip712typeddata.md b/packages/docs/sdk/docs/utils/interfaces/_sign_typed_data_utils_.eip712typeddata.md index 9d07d2c0f51..c7c4e0c6cfb 100644 --- a/packages/docs/sdk/docs/utils/interfaces/_sign_typed_data_utils_.eip712typeddata.md +++ b/packages/docs/sdk/docs/utils/interfaces/_sign_typed_data_utils_.eip712typeddata.md @@ -21,7 +21,7 @@ • **domain**: *[EIP712Object](_sign_typed_data_utils_.eip712object.md)* -*Defined in [sign-typed-data-utils.ts:38](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L38)* +*Defined in [sign-typed-data-utils.ts:36](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L36)* ___ @@ -29,7 +29,7 @@ ___ • **message**: *[EIP712Object](_sign_typed_data_utils_.eip712object.md)* -*Defined in [sign-typed-data-utils.ts:39](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L39)* +*Defined in [sign-typed-data-utils.ts:37](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L37)* ___ @@ -37,7 +37,7 @@ ___ • **primaryType**: *string* -*Defined in [sign-typed-data-utils.ts:40](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L40)* +*Defined in [sign-typed-data-utils.ts:38](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L38)* ___ @@ -45,4 +45,4 @@ ___ • **types**: *[EIP712Types](_sign_typed_data_utils_.eip712types.md) & object* -*Defined in [sign-typed-data-utils.ts:37](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L37)* +*Defined in [sign-typed-data-utils.ts:35](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L35)* diff --git a/packages/docs/sdk/docs/utils/interfaces/_sign_typed_data_utils_.eip712typeswithprimary.md b/packages/docs/sdk/docs/utils/interfaces/_sign_typed_data_utils_.eip712typeswithprimary.md index a1d6178cee1..2602ffe3419 100644 --- a/packages/docs/sdk/docs/utils/interfaces/_sign_typed_data_utils_.eip712typeswithprimary.md +++ b/packages/docs/sdk/docs/utils/interfaces/_sign_typed_data_utils_.eip712typeswithprimary.md @@ -19,7 +19,7 @@ • **primaryType**: *string* -*Defined in [sign-typed-data-utils.ts:20](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L20)* +*Defined in [sign-typed-data-utils.ts:18](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L18)* ___ @@ -27,4 +27,4 @@ ___ • **types**: *[EIP712Types](_sign_typed_data_utils_.eip712types.md)* -*Defined in [sign-typed-data-utils.ts:19](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L19)* +*Defined in [sign-typed-data-utils.ts:17](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L17)* diff --git a/packages/docs/sdk/docs/utils/modules/_attestations_.md b/packages/docs/sdk/docs/utils/modules/_attestations_.md new file mode 100644 index 00000000000..7e1d737cd22 --- /dev/null +++ b/packages/docs/sdk/docs/utils/modules/_attestations_.md @@ -0,0 +1,243 @@ +[@celo/utils](../README.md) › ["attestations"](_attestations_.md) + +# Module: "attestations" + +## Index + +### References + +* [AttestationsStatus](_attestations_.md#attestationsstatus) +* [IdentifierType](_attestations_.md#identifiertype) +* [base64ToHex](_attestations_.md#base64tohex) +* [extractAttestationCodeFromMessage](_attestations_.md#extractattestationcodefrommessage) +* [getIdentifierPrefix](_attestations_.md#getidentifierprefix) +* [isAccountConsideredVerified](_attestations_.md#isaccountconsideredverified) +* [messageContainsAttestationCode](_attestations_.md#messagecontainsattestationcode) +* [sanitizeMessageBase64](_attestations_.md#sanitizemessagebase64) + +### Functions + +* [attestToIdentifier](_attestations_.md#attesttoidentifier) +* [extractSecurityCodeWithPrefix](_attestations_.md#extractsecuritycodewithprefix) +* [getAttestationMessageToSignFromIdentifier](_attestations_.md#getattestationmessagetosignfromidentifier) +* [getAttestationMessageToSignFromPhoneNumber](_attestations_.md#getattestationmessagetosignfromphonenumber) +* [hashIdentifier](_attestations_.md#hashidentifier) + +### Object literals + +* [AttestationUtils](_attestations_.md#const-attestationutils) + +## References + +### AttestationsStatus + +• **AttestationsStatus**: + +___ + +### IdentifierType + +• **IdentifierType**: + +___ + +### base64ToHex + +• **base64ToHex**: + +___ + +### extractAttestationCodeFromMessage + +• **extractAttestationCodeFromMessage**: + +___ + +### getIdentifierPrefix + +• **getIdentifierPrefix**: + +___ + +### isAccountConsideredVerified + +• **isAccountConsideredVerified**: + +___ + +### messageContainsAttestationCode + +• **messageContainsAttestationCode**: + +___ + +### sanitizeMessageBase64 + +• **sanitizeMessageBase64**: + +## Functions + +### attestToIdentifier + +▸ **attestToIdentifier**(`identifier`: string, `account`: string, `privateKey`: string): *Signature* + +*Defined in [attestations.ts:52](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/attestations.ts#L52)* + +**Parameters:** + +Name | Type | +------ | ------ | +`identifier` | string | +`account` | string | +`privateKey` | string | + +**Returns:** *Signature* + +___ + +### extractSecurityCodeWithPrefix + +▸ **extractSecurityCodeWithPrefix**(`message`: string): *null | string* + +*Defined in [attestations.ts:66](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/attestations.ts#L66)* + +**Parameters:** + +Name | Type | +------ | ------ | +`message` | string | + +**Returns:** *null | string* + +___ + +### getAttestationMessageToSignFromIdentifier + +▸ **getAttestationMessageToSignFromIdentifier**(`identifier`: string, `account`: string): *string* + +*Defined in [attestations.ts:33](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/attestations.ts#L33)* + +**Parameters:** + +Name | Type | +------ | ------ | +`identifier` | string | +`account` | string | + +**Returns:** *string* + +___ + +### getAttestationMessageToSignFromPhoneNumber + +▸ **getAttestationMessageToSignFromPhoneNumber**(`phoneNumber`: string, `account`: string, `phoneSalt?`: undefined | string): *string* + +*Defined in [attestations.ts:41](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/attestations.ts#L41)* + +**Parameters:** + +Name | Type | +------ | ------ | +`phoneNumber` | string | +`account` | string | +`phoneSalt?` | undefined | string | + +**Returns:** *string* + +___ + +### hashIdentifier + +▸ **hashIdentifier**(`identifier`: string, `type`: [IdentifierType](_attestations_.md#identifiertype), `salt?`: undefined | string): *string* + +*Defined in [attestations.ts:29](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/attestations.ts#L29)* + +**Parameters:** + +Name | Type | +------ | ------ | +`identifier` | string | +`type` | [IdentifierType](_attestations_.md#identifiertype) | +`salt?` | undefined | string | + +**Returns:** *string* + +## Object literals + +### `Const` AttestationUtils + +### ▪ **AttestationUtils**: *object* + +*Defined in [attestations.ts:74](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/attestations.ts#L74)* + +### IdentifierType + +• **IdentifierType**: *IdentifierType* + +*Defined in [attestations.ts:75](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/attestations.ts#L75)* + +### attestToIdentifier + +• **attestToIdentifier**: *[attestToIdentifier](_attestations_.md#attesttoidentifier)* + +*Defined in [attestations.ts:81](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/attestations.ts#L81)* + +### base64ToHex + +• **base64ToHex**: *base64ToHex* + +*Defined in [attestations.ts:80](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/attestations.ts#L80)* + +### extractAttestationCodeFromMessage + +• **extractAttestationCodeFromMessage**: *extractAttestationCodeFromMessage* + +*Defined in [attestations.ts:84](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/attestations.ts#L84)* + +### extractSecurityCodeWithPrefix + +• **extractSecurityCodeWithPrefix**: *[extractSecurityCodeWithPrefix](_attestations_.md#extractsecuritycodewithprefix)* + +*Defined in [attestations.ts:86](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/attestations.ts#L86)* + +### getAttestationMessageToSignFromIdentifier + +• **getAttestationMessageToSignFromIdentifier**: *[getAttestationMessageToSignFromIdentifier](_attestations_.md#getattestationmessagetosignfromidentifier)* + +*Defined in [attestations.ts:78](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/attestations.ts#L78)* + +### getAttestationMessageToSignFromPhoneNumber + +• **getAttestationMessageToSignFromPhoneNumber**: *[getAttestationMessageToSignFromPhoneNumber](_attestations_.md#getattestationmessagetosignfromphonenumber)* + +*Defined in [attestations.ts:79](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/attestations.ts#L79)* + +### getIdentifierPrefix + +• **getIdentifierPrefix**: *getIdentifierPrefix* + +*Defined in [attestations.ts:76](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/attestations.ts#L76)* + +### hashIdentifier + +• **hashIdentifier**: *[hashIdentifier](_attestations_.md#hashidentifier)* + +*Defined in [attestations.ts:77](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/attestations.ts#L77)* + +### isAccountConsideredVerified + +• **isAccountConsideredVerified**: *isAccountConsideredVerified* + +*Defined in [attestations.ts:85](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/attestations.ts#L85)* + +### messageContainsAttestationCode + +• **messageContainsAttestationCode**: *messageContainsAttestationCode* + +*Defined in [attestations.ts:83](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/attestations.ts#L83)* + +### sanitizeMessageBase64 + +• **sanitizeMessageBase64**: *sanitizeMessageBase64* + +*Defined in [attestations.ts:82](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/attestations.ts#L82)* diff --git a/packages/docs/sdk/docs/utils/modules/_bn_.md b/packages/docs/sdk/docs/utils/modules/_bn_.md index 6e87209f29b..a9aa61e1041 100644 --- a/packages/docs/sdk/docs/utils/modules/_bn_.md +++ b/packages/docs/sdk/docs/utils/modules/_bn_.md @@ -12,7 +12,7 @@ ### compareBN -▸ **compareBN**(`a`: BN, `b`: BN): *[compareBN](_bn_.md#comparebn)* +▸ **compareBN**(`a`: BN, `b`: BN): *0 | 1 | -1* *Defined in [bn.ts:3](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/bn.ts#L3)* @@ -23,4 +23,4 @@ Name | Type | `a` | BN | `b` | BN | -**Returns:** *[compareBN](_bn_.md#comparebn)* +**Returns:** *0 | 1 | -1* diff --git a/packages/docs/sdk/docs/utils/modules/_ecdh_.md b/packages/docs/sdk/docs/utils/modules/_ecdh_.md index 3288eb50a87..cd42c92ebf3 100644 --- a/packages/docs/sdk/docs/utils/modules/_ecdh_.md +++ b/packages/docs/sdk/docs/utils/modules/_ecdh_.md @@ -49,7 +49,7 @@ ___ ### ensureUncompressed -▸ **ensureUncompressed**(`publicKey`: string): *[ensureUncompressed](_ecdh_.md#ensureuncompressed)* +▸ **ensureUncompressed**(`publicKey`: string): *any* *Defined in [ecdh.ts:27](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/ecdh.ts#L27)* @@ -59,13 +59,13 @@ Name | Type | ------ | ------ | `publicKey` | string | -**Returns:** *[ensureUncompressed](_ecdh_.md#ensureuncompressed)* +**Returns:** *any* ___ ### isCompressed -▸ **isCompressed**(`publicKey`: string): *[isCompressed](_ecdh_.md#iscompressed)* +▸ **isCompressed**(`publicKey`: string): *boolean* *Defined in [ecdh.ts:10](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/ecdh.ts#L10)* @@ -75,13 +75,13 @@ Name | Type | ------ | ------ | `publicKey` | string | -**Returns:** *[isCompressed](_ecdh_.md#iscompressed)* +**Returns:** *boolean* ___ ### trimUncompressedPrefix -▸ **trimUncompressedPrefix**(`publicKey`: string): *[trimUncompressedPrefix](_ecdh_.md#trimuncompressedprefix)* +▸ **trimUncompressedPrefix**(`publicKey`: string): *string* *Defined in [ecdh.ts:40](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/ecdh.ts#L40)* @@ -91,4 +91,4 @@ Name | Type | ------ | ------ | `publicKey` | string | -**Returns:** *[trimUncompressedPrefix](_ecdh_.md#trimuncompressedprefix)* +**Returns:** *string* diff --git a/packages/docs/sdk/docs/utils/modules/_ecies_.md b/packages/docs/sdk/docs/utils/modules/_ecies_.md index ffb7e1d8a44..f1393566b2d 100644 --- a/packages/docs/sdk/docs/utils/modules/_ecies_.md +++ b/packages/docs/sdk/docs/utils/modules/_ecies_.md @@ -33,7 +33,7 @@ ### AES128Decrypt -▸ **AES128Decrypt**(`encryptionKey`: Buffer, `iv`: Buffer, `ciphertext`: Buffer): *[AES128Decrypt](_ecies_.md#aes128decrypt)* +▸ **AES128Decrypt**(`encryptionKey`: Buffer, `iv`: Buffer, `ciphertext`: Buffer): *Buffer‹›* *Defined in [ecies.ts:96](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/ecies.ts#L96)* @@ -47,7 +47,7 @@ Name | Type | `iv` | Buffer | `ciphertext` | Buffer | -**Returns:** *[AES128Decrypt](_ecies_.md#aes128decrypt)* +**Returns:** *Buffer‹›* plaintext @@ -77,7 +77,7 @@ ___ ### AES128Encrypt -▸ **AES128Encrypt**(`encryptionKey`: Buffer, `iv`: Buffer, `plaintext`: Buffer): *[AES128Encrypt](_ecies_.md#aes128encrypt)* +▸ **AES128Encrypt**(`encryptionKey`: Buffer, `iv`: Buffer, `plaintext`: Buffer): *Buffer‹›* *Defined in [ecies.ts:63](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/ecies.ts#L63)* @@ -91,7 +91,7 @@ Name | Type | `iv` | Buffer | `plaintext` | Buffer | -**Returns:** *[AES128Encrypt](_ecies_.md#aes128encrypt)* +**Returns:** *Buffer‹›* ciphertext @@ -121,7 +121,7 @@ ___ ### Decrypt -▸ **Decrypt**(`privKey`: Buffer, `encrypted`: Buffer): *[Decrypt](_ecies_.md#decrypt)* +▸ **Decrypt**(`privKey`: Buffer, `encrypted`: Buffer): *Buffer‹›* *Defined in [ecies.ts:163](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/ecies.ts#L163)* @@ -134,7 +134,7 @@ Name | Type | Description | `privKey` | Buffer | Ethereum private key, 32 bytes. | `encrypted` | Buffer | Encrypted message, serialized, 113+ bytes | -**Returns:** *[Decrypt](_ecies_.md#decrypt)* +**Returns:** *Buffer‹›* plaintext @@ -142,7 +142,7 @@ ___ ### Encrypt -▸ **Encrypt**(`pubKeyTo`: Buffer, `plaintext`: Buffer): *[Encrypt](_ecies_.md#encrypt)* +▸ **Encrypt**(`pubKeyTo`: Buffer, `plaintext`: Buffer): *Buffer‹›* *Defined in [ecies.ts:134](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/ecies.ts#L134)* @@ -155,7 +155,7 @@ Name | Type | Description | `pubKeyTo` | Buffer | Ethereum pub key, 64 bytes. | `plaintext` | Buffer | Plaintext to be encrypted. | -**Returns:** *[Encrypt](_ecies_.md#encrypt)* +**Returns:** *Buffer‹›* Encrypted message, serialized, 113+ bytes diff --git a/packages/docs/sdk/docs/utils/modules/_io_.md b/packages/docs/sdk/docs/utils/modules/_io_.md index e912175d211..aa33086c33d 100644 --- a/packages/docs/sdk/docs/utils/modules/_io_.md +++ b/packages/docs/sdk/docs/utils/modules/_io_.md @@ -17,6 +17,7 @@ ### Variables * [AddressType](_io_.md#const-addresstype) +* [AttestationServiceStatusResponseType](_io_.md#const-attestationservicestatusresponsetype) * [JSONStringType](_io_.md#const-jsonstringtype) * [PublicKeyType](_io_.md#const-publickeytype) * [SaltType](_io_.md#const-salttype) @@ -71,6 +72,29 @@ ___ ___ +### `Const` AttestationServiceStatusResponseType + +• **AttestationServiceStatusResponseType**: *TypeC‹object›* = t.type({ + status: t.literal('ok'), + smsProviders: t.array(t.string), + blacklistedRegionCodes: t.union([t.array(t.string), t.undefined]), + accountAddress: AddressType, + signature: t.union([SignatureType, t.undefined]), + version: t.string, + latestBlock: t.number, + ageOfLatestBlock: t.number, + isNodeSyncing: t.boolean, + appSignature: t.string, + smsProvidersRandomized: t.boolean, + maxDeliveryAttempts: t.number, + maxRerequestMins: t.number, + twilioVerifySidProvided: t.boolean, +}) + +*Defined in [io.ts:68](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/io.ts#L68)* + +___ + ### `Const` JSONStringType • **JSONStringType**: *Type‹string, string, unknown›* = new t.Type( diff --git a/packages/docs/sdk/docs/utils/modules/_sign_typed_data_utils_.md b/packages/docs/sdk/docs/utils/modules/_sign_typed_data_utils_.md index a4fe0f3035d..607f19ed8c7 100644 --- a/packages/docs/sdk/docs/utils/modules/_sign_typed_data_utils_.md +++ b/packages/docs/sdk/docs/utils/modules/_sign_typed_data_utils_.md @@ -47,7 +47,7 @@ Ƭ **EIP712ObjectValue**: *string | number | BigNumber | boolean | Buffer | [EIP712Object](../interfaces/_sign_typed_data_utils_.eip712object.md) | [EIP712ObjectValue](_sign_typed_data_utils_.md#eip712objectvalue)[]* -*Defined in [sign-typed-data-utils.ts:23](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L23)* +*Defined in [sign-typed-data-utils.ts:21](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L21)* ___ @@ -55,7 +55,7 @@ ___ Ƭ **EIP712Optional**: *object* -*Defined in [sign-typed-data-utils.ts:82](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L82)* +*Defined in [sign-typed-data-utils.ts:70](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L70)* Utility type representing an optional value in a EIP-712 compatible manner, as long as the concrete type T is a subtype of EIP712ObjectValue. @@ -73,24 +73,17 @@ concrete type T is a subtype of EIP712ObjectValue. ### `Const` EIP712_ATOMIC_TYPES • **EIP712_ATOMIC_TYPES**: *string[]* = [ + 'bytes1', + 'bytes32', + 'uint8', + 'uint256', + 'int8', + 'int256', 'bool', 'address', - // bytes types from 1 to 32 bytes - // and uint/int types from 8 to 256 bits - ...(() => { - const result = [] - // Putting "bigger" types first, assuming they are more likely to be used. - // So `EIP712_ATOMIC_TYPES.includes(...)` calls are faster. (likely useless micro-optimization :D) - for (let i = 32; i >= 1; i--) { - result.push('bytes' + i) - result.push('uint' + i * 8) - result.push('int' + i * 8) - } - return result - })(), ] -*Defined in [sign-typed-data-utils.ts:44](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L44)* +*Defined in [sign-typed-data-utils.ts:42](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L42)* Array of all EIP-712 atomic type names. @@ -98,9 +91,9 @@ ___ ### `Const` EIP712_BUILTIN_TYPES -• **EIP712_BUILTIN_TYPES**: *string[]* = EIP712_DYNAMIC_TYPES.concat(EIP712_ATOMIC_TYPES) +• **EIP712_BUILTIN_TYPES**: *string[]* = EIP712_ATOMIC_TYPES.concat(EIP712_DYNAMIC_TYPES) -*Defined in [sign-typed-data-utils.ts:64](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L64)* +*Defined in [sign-typed-data-utils.ts:55](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L55)* ___ @@ -108,15 +101,15 @@ ___ • **EIP712_DYNAMIC_TYPES**: *string[]* = ['bytes', 'string'] -*Defined in [sign-typed-data-utils.ts:62](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L62)* +*Defined in [sign-typed-data-utils.ts:53](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L53)* ## Functions ### `Const` defined -▸ **defined**‹**T**›(`value`: T): *[EIP712Optional](_sign_typed_data_utils_.md#eip712optional)‹T›* +▸ **defined**<**T**>(`value`: T): *[EIP712Optional](_sign_typed_data_utils_.md#eip712optional)‹T›* -*Defined in [sign-typed-data-utils.ts:110](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L110)* +*Defined in [sign-typed-data-utils.ts:98](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L98)* Utility to construct an defined EIP712Optional value with inferred type. @@ -136,9 +129,9 @@ ___ ### `Const` eip712OptionalSchema -▸ **eip712OptionalSchema**‹**S**›(`schema`: S): *TypeC‹object›* +▸ **eip712OptionalSchema**<**S**>(`schema`: S): *TypeC‹object›* -*Defined in [sign-typed-data-utils.ts:103](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L103)* +*Defined in [sign-typed-data-utils.ts:91](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L91)* Utility to build EIP712Optional schemas for encoding and decoding with io-ts. @@ -160,7 +153,7 @@ ___ ▸ **eip712OptionalType**(`typeName`: string): *[EIP712Types](../interfaces/_sign_typed_data_utils_.eip712types.md)* -*Defined in [sign-typed-data-utils.ts:92](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L92)* +*Defined in [sign-typed-data-utils.ts:80](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L80)* Utility to build EIP712Optional types to insert in EIP-712 type arrays. @@ -178,7 +171,7 @@ ___ ▸ **encodeData**(`primaryType`: string, `data`: [EIP712Object](../interfaces/_sign_typed_data_utils_.eip712object.md), `types`: [EIP712Types](../interfaces/_sign_typed_data_utils_.eip712types.md)): *Buffer* -*Defined in [sign-typed-data-utils.ts:251](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L251)* +*Defined in [sign-typed-data-utils.ts:239](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L239)* Constructs the struct encoding of the data as the primary type. @@ -198,7 +191,7 @@ ___ ▸ **encodeType**(`primaryType`: string, `types`: [EIP712Types](../interfaces/_sign_typed_data_utils_.eip712types.md)): *string* -*Defined in [sign-typed-data-utils.ts:184](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L184)* +*Defined in [sign-typed-data-utils.ts:172](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L172)* Creates a string encoding of the primary type, including all dependencies. E.g. "Transaction(Person from,Person to,Asset tx)Asset(address token,uint256 amount)Person(address wallet,string name)" @@ -218,7 +211,7 @@ ___ ▸ **generateTypedDataHash**(`typedData`: [EIP712TypedData](../interfaces/_sign_typed_data_utils_.eip712typeddata.md)): *Buffer* -*Defined in [sign-typed-data-utils.ts:138](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L138)* +*Defined in [sign-typed-data-utils.ts:126](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L126)* Generates the EIP712 Typed Data hash for signing @@ -238,7 +231,7 @@ ___ ▸ **structHash**(`primaryType`: string, `data`: [EIP712Object](../interfaces/_sign_typed_data_utils_.eip712object.md), `types`: [EIP712Types](../interfaces/_sign_typed_data_utils_.eip712types.md)): *Buffer* -*Defined in [sign-typed-data-utils.ts:260](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L260)* +*Defined in [sign-typed-data-utils.ts:248](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L248)* **Parameters:** @@ -256,7 +249,7 @@ ___ ▸ **typeHash**(`primaryType`: string, `types`: [EIP712Types](../interfaces/_sign_typed_data_utils_.eip712types.md)): *Buffer* -*Defined in [sign-typed-data-utils.ts:195](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L195)* +*Defined in [sign-typed-data-utils.ts:183](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L183)* **Parameters:** @@ -273,7 +266,7 @@ ___ ▸ **zeroValue**(`primaryType`: string, `types`: [EIP712Types](../interfaces/_sign_typed_data_utils_.eip712types.md)): *[EIP712ObjectValue](_sign_typed_data_utils_.md#eip712objectvalue)* -*Defined in [sign-typed-data-utils.ts:276](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L276)* +*Defined in [sign-typed-data-utils.ts:264](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L264)* Produce the zero value for a given type. @@ -299,7 +292,7 @@ Name | Type | Default | ### ▪ **noBool**: *object* -*Defined in [sign-typed-data-utils.ts:116](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L116)* +*Defined in [sign-typed-data-utils.ts:104](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L104)* Undefined EIP712Optional type with value type boolean. @@ -307,13 +300,13 @@ Undefined EIP712Optional type with value type boolean. • **defined**: *false* = false -*Defined in [sign-typed-data-utils.ts:117](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L117)* +*Defined in [sign-typed-data-utils.ts:105](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L105)* ### value • **value**: *false* = false -*Defined in [sign-typed-data-utils.ts:118](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L118)* +*Defined in [sign-typed-data-utils.ts:106](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L106)* ___ @@ -321,7 +314,7 @@ ___ ### ▪ **noNumber**: *object* -*Defined in [sign-typed-data-utils.ts:122](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L122)* +*Defined in [sign-typed-data-utils.ts:110](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L110)* Undefined EIP712Optional type with value type number. @@ -329,13 +322,13 @@ Undefined EIP712Optional type with value type number. • **defined**: *false* = false -*Defined in [sign-typed-data-utils.ts:123](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L123)* +*Defined in [sign-typed-data-utils.ts:111](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L111)* ### value • **value**: *number* = 0 -*Defined in [sign-typed-data-utils.ts:124](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L124)* +*Defined in [sign-typed-data-utils.ts:112](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L112)* ___ @@ -343,7 +336,7 @@ ___ ### ▪ **noString**: *object* -*Defined in [sign-typed-data-utils.ts:128](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L128)* +*Defined in [sign-typed-data-utils.ts:116](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L116)* Undefined EIP712Optional type with value type string. @@ -351,10 +344,10 @@ Undefined EIP712Optional type with value type string. • **defined**: *false* = false -*Defined in [sign-typed-data-utils.ts:129](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L129)* +*Defined in [sign-typed-data-utils.ts:117](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L117)* ### value • **value**: *string* = "" -*Defined in [sign-typed-data-utils.ts:130](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L130)* +*Defined in [sign-typed-data-utils.ts:118](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/sign-typed-data-utils.ts#L118)* diff --git a/packages/docs/sdk/docs/utils/modules/_signatureutils_.md b/packages/docs/sdk/docs/utils/modules/_signatureutils_.md index a7590ae0c52..0f63513308b 100644 --- a/packages/docs/sdk/docs/utils/modules/_signatureutils_.md +++ b/packages/docs/sdk/docs/utils/modules/_signatureutils_.md @@ -69,7 +69,7 @@ ___ ▸ **LocalSigner**(`privateKey`: string): *Signer* -*Defined in [signatureUtils.ts:64](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L64)* +*Defined in [signatureUtils.ts:61](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L61)* **Parameters:** @@ -83,9 +83,9 @@ ___ ### addressToPublicKey -▸ **addressToPublicKey**(`signer`: string, `signFn`: function): *[addressToPublicKey](_signatureutils_.md#addresstopublickey)* +▸ **addressToPublicKey**(`signer`: string, `signFn`: function): *Promise‹string›* -*Defined in [signatureUtils.ts:43](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L43)* +*Defined in [signatureUtils.ts:35](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L35)* **Parameters:** @@ -102,7 +102,7 @@ Name | Type | `message` | string | `signer` | string | -**Returns:** *[addressToPublicKey](_signatureutils_.md#addresstopublickey)* +**Returns:** *Promise‹string›* ___ @@ -110,7 +110,7 @@ ___ ▸ **guessSigner**(`message`: string, `signature`: string): *string* -*Defined in [signatureUtils.ts:196](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L196)* +*Defined in [signatureUtils.ts:203](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L203)* **Parameters:** @@ -127,7 +127,7 @@ ___ ▸ **hashMessage**(`message`: string): *string* -*Defined in [signatureUtils.ts:39](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L39)* +*Defined in [signatureUtils.ts:31](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L31)* **Parameters:** @@ -143,7 +143,7 @@ ___ ▸ **hashMessageWithPrefix**(`message`: string): *string* -*Defined in [signatureUtils.ts:34](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L34)* +*Defined in [signatureUtils.ts:26](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L26)* **Parameters:** @@ -157,9 +157,9 @@ ___ ### parseSignature -▸ **parseSignature**(`message`: string, `signature`: string, `signer`: string): *[parseSignature](_signatureutils_.md#parsesignature)* +▸ **parseSignature**(`message`: string, `signature`: string, `signer`: string): *object* -*Defined in [signatureUtils.ts:113](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L113)* +*Defined in [signatureUtils.ts:115](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L115)* **Parameters:** @@ -169,15 +169,21 @@ Name | Type | `signature` | string | `signer` | string | -**Returns:** *[parseSignature](_signatureutils_.md#parsesignature)* +**Returns:** *object* + +* **r**: *string* + +* **s**: *string* + +* **v**: *number* ___ ### parseSignatureWithoutPrefix -▸ **parseSignatureWithoutPrefix**(`messageHash`: string, `signature`: string, `signer`: string): *[parseSignatureWithoutPrefix](_signatureutils_.md#parsesignaturewithoutprefix)* +▸ **parseSignatureWithoutPrefix**(`messageHash`: string, `signature`: string, `signer`: string): *object* -*Defined in [signatureUtils.ts:117](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L117)* +*Defined in [signatureUtils.ts:119](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L119)* **Parameters:** @@ -187,7 +193,13 @@ Name | Type | `signature` | string | `signer` | string | -**Returns:** *[parseSignatureWithoutPrefix](_signatureutils_.md#parsesignaturewithoutprefix)* +**Returns:** *object* + +* **r**: *string* + +* **s**: *string* + +* **v**: *number* ___ @@ -195,7 +207,7 @@ ___ ▸ **recoverEIP712TypedDataSignerRsv**(`typedData`: [EIP712TypedData](../interfaces/_sign_typed_data_utils_.eip712typeddata.md), `signature`: string): *string* -*Defined in [signatureUtils.ts:153](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L153)* +*Defined in [signatureUtils.ts:160](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L160)* Recover signer from RSV-serialized signature over signed typed data. @@ -216,7 +228,7 @@ ___ ▸ **recoverEIP712TypedDataSignerVrs**(`typedData`: [EIP712TypedData](../interfaces/_sign_typed_data_utils_.eip712typeddata.md), `signature`: string): *string* -*Defined in [signatureUtils.ts:166](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L166)* +*Defined in [signatureUtils.ts:173](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L173)* Recover signer from VRS-serialized signature over signed typed data. @@ -235,9 +247,9 @@ ___ ### signMessage -▸ **signMessage**(`message`: string, `privateKey`: string, `address`: string): *[signMessage](_signatureutils_.md#signmessage)* +▸ **signMessage**(`message`: string, `privateKey`: string, `address`: string): *object* -*Defined in [signatureUtils.ts:83](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L83)* +*Defined in [signatureUtils.ts:80](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L80)* **Parameters:** @@ -247,15 +259,21 @@ Name | Type | `privateKey` | string | `address` | string | -**Returns:** *[signMessage](_signatureutils_.md#signmessage)* +**Returns:** *object* + +* **r**: *any* = ethjsutil.bufferToHex(r) + +* **s**: *any* = ethjsutil.bufferToHex(s) + +* **v**: *any* ___ ### signMessageWithoutPrefix -▸ **signMessageWithoutPrefix**(`messageHash`: string, `privateKey`: string, `address`: string): *[signMessageWithoutPrefix](_signatureutils_.md#signmessagewithoutprefix)* +▸ **signMessageWithoutPrefix**(`messageHash`: string, `privateKey`: string, `address`: string): *object* -*Defined in [signatureUtils.ts:91](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L91)* +*Defined in [signatureUtils.ts:88](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L88)* **Parameters:** @@ -265,15 +283,21 @@ Name | Type | `privateKey` | string | `address` | string | -**Returns:** *[signMessageWithoutPrefix](_signatureutils_.md#signmessagewithoutprefix)* +**Returns:** *object* + +* **r**: *any* = ethjsutil.bufferToHex(r) + +* **s**: *any* = ethjsutil.bufferToHex(s) + +* **v**: *any* ___ ### signedMessageToPublicKey -▸ **signedMessageToPublicKey**(`message`: string, `v`: number, `r`: string, `s`: string): *[signedMessageToPublicKey](_signatureutils_.md#signedmessagetopublickey)* +▸ **signedMessageToPublicKey**(`message`: string, `v`: number, `r`: string, `s`: string): *string* -*Defined in [signatureUtils.ts:73](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L73)* +*Defined in [signatureUtils.ts:70](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L70)* **Parameters:** @@ -284,15 +308,15 @@ Name | Type | `r` | string | `s` | string | -**Returns:** *[signedMessageToPublicKey](_signatureutils_.md#signedmessagetopublickey)* +**Returns:** *string* ___ ### verifyEIP712TypedDataSigner -▸ **verifyEIP712TypedDataSigner**(`typedData`: [EIP712TypedData](../interfaces/_sign_typed_data_utils_.eip712typeddata.md), `signature`: string, `signer`: string): *[verifyEIP712TypedDataSigner](_signatureutils_.md#verifyeip712typeddatasigner)* +▸ **verifyEIP712TypedDataSigner**(`typedData`: [EIP712TypedData](../interfaces/_sign_typed_data_utils_.eip712typeddata.md), `signature`: string, `signer`: string): *boolean* -*Defined in [signatureUtils.ts:179](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L179)* +*Defined in [signatureUtils.ts:186](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L186)* **Parameters:** @@ -302,7 +326,7 @@ Name | Type | Description | `signature` | string | VRS or SRV signature of `typedData` by `signer` | `signer` | string | address to verify signed the `typedData` | -**Returns:** *[verifyEIP712TypedDataSigner](_signatureutils_.md#verifyeip712typeddatasigner)* +**Returns:** *boolean* boolean, true if `signer` is a possible signer of `signature` @@ -310,9 +334,9 @@ ___ ### verifySignature -▸ **verifySignature**(`message`: string, `signature`: string, `signer`: string): *[verifySignature](_signatureutils_.md#verifysignature)* +▸ **verifySignature**(`message`: string, `signature`: string, `signer`: string): *boolean* -*Defined in [signatureUtils.ts:104](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L104)* +*Defined in [signatureUtils.ts:106](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L106)* **Parameters:** @@ -322,7 +346,7 @@ Name | Type | `signature` | string | `signer` | string | -**Returns:** *[verifySignature](_signatureutils_.md#verifysignature)* +**Returns:** *boolean* ## Object literals @@ -330,64 +354,64 @@ Name | Type | ### ▪ **SignatureUtils**: *object* -*Defined in [signatureUtils.ts:235](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L235)* +*Defined in [signatureUtils.ts:250](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L250)* ### LocalSigner • **LocalSigner**: *[LocalSigner](_signatureutils_.md#localsigner)* -*Defined in [signatureUtils.ts:237](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L237)* +*Defined in [signatureUtils.ts:252](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L252)* ### NativeSigner • **NativeSigner**: *NativeSigner* -*Defined in [signatureUtils.ts:236](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L236)* +*Defined in [signatureUtils.ts:251](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L251)* ### parseSignature • **parseSignature**: *[parseSignature](_signatureutils_.md#parsesignature)* -*Defined in [signatureUtils.ts:240](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L240)* +*Defined in [signatureUtils.ts:255](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L255)* ### parseSignatureWithoutPrefix • **parseSignatureWithoutPrefix**: *[parseSignatureWithoutPrefix](_signatureutils_.md#parsesignaturewithoutprefix)* -*Defined in [signatureUtils.ts:241](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L241)* +*Defined in [signatureUtils.ts:256](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L256)* ### recoverEIP712TypedDataSignerRsv • **recoverEIP712TypedDataSignerRsv**: *[recoverEIP712TypedDataSignerRsv](_signatureutils_.md#recovereip712typeddatasignerrsv)* -*Defined in [signatureUtils.ts:243](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L243)* +*Defined in [signatureUtils.ts:258](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L258)* ### recoverEIP712TypedDataSignerVrs • **recoverEIP712TypedDataSignerVrs**: *[recoverEIP712TypedDataSignerVrs](_signatureutils_.md#recovereip712typeddatasignervrs)* -*Defined in [signatureUtils.ts:244](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L244)* +*Defined in [signatureUtils.ts:259](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L259)* ### serializeSignature • **serializeSignature**: *serializeSignature* -*Defined in [signatureUtils.ts:242](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L242)* +*Defined in [signatureUtils.ts:257](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L257)* ### signMessage • **signMessage**: *[signMessage](_signatureutils_.md#signmessage)* -*Defined in [signatureUtils.ts:238](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L238)* +*Defined in [signatureUtils.ts:253](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L253)* ### signMessageWithoutPrefix • **signMessageWithoutPrefix**: *[signMessageWithoutPrefix](_signatureutils_.md#signmessagewithoutprefix)* -*Defined in [signatureUtils.ts:239](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L239)* +*Defined in [signatureUtils.ts:254](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L254)* ### verifyEIP712TypedDataSigner • **verifyEIP712TypedDataSigner**: *[verifyEIP712TypedDataSigner](_signatureutils_.md#verifyeip712typeddatasigner)* -*Defined in [signatureUtils.ts:245](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L245)* +*Defined in [signatureUtils.ts:260](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/signatureUtils.ts#L260)* diff --git a/packages/docs/sdk/docs/utils/modules/_typed_data_constructors_.md b/packages/docs/sdk/docs/utils/modules/_typed_data_constructors_.md index e630bc55082..bfb87c78974 100644 --- a/packages/docs/sdk/docs/utils/modules/_typed_data_constructors_.md +++ b/packages/docs/sdk/docs/utils/modules/_typed_data_constructors_.md @@ -6,76 +6,43 @@ ### Functions +* [attestationSecurityCode](_typed_data_constructors_.md#attestationsecuritycode) * [authorizeSigner](_typed_data_constructors_.md#const-authorizesigner) -* [registerAttestation](_typed_data_constructors_.md#const-registerattestation) ## Functions -### `Const` authorizeSigner +### attestationSecurityCode -▸ **authorizeSigner**(`__namedParameters`: object): *[EIP712TypedData](../interfaces/_sign_typed_data_utils_.eip712typeddata.md)* +▸ **attestationSecurityCode**(`code`: string): *[EIP712TypedData](../interfaces/_sign_typed_data_utils_.eip712typeddata.md)* -*Defined in [typed-data-constructors.ts:4](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/typed-data-constructors.ts#L4)* +*Defined in [typed-data-constructors.ts:3](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/typed-data-constructors.ts#L3)* **Parameters:** -▪ **__namedParameters**: *object* - Name | Type | ------ | ------ | -`account` | string | -`accountsContractAddress` | string | -`chainId` | number | -`role` | string | -`signer` | string | +`code` | string | **Returns:** *[EIP712TypedData](../interfaces/_sign_typed_data_utils_.eip712typeddata.md)* ___ -### `Const` registerAttestation +### `Const` authorizeSigner -▸ **registerAttestation**(`chainId`: number, `contractAddress`: [Address](_address_.md#address), `message?`: AttestationDetails): *object* +▸ **authorizeSigner**(`__namedParameters`: object): *[EIP712TypedData](../interfaces/_sign_typed_data_utils_.eip712typeddata.md)* -*Defined in [typed-data-constructors.ts:52](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/typed-data-constructors.ts#L52)* +*Defined in [typed-data-constructors.ts:23](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/utils/src/typed-data-constructors.ts#L23)* **Parameters:** +▪ **__namedParameters**: *object* + Name | Type | ------ | ------ | +`account` | string | +`accountsContractAddress` | string | `chainId` | number | -`contractAddress` | [Address](_address_.md#address) | -`message?` | AttestationDetails | - -**Returns:** *object* - -* **message**: *AttestationDetails | object* = message ? message : {} - -* **primaryType**: *string* = "OwnershipAttestation" - -* ### **domain**: *object* - - * **chainId**: *number* - - * **name**: *string* = "FederatedAttestations" - - * **verifyingContract**: *string* = contractAddress - - * **version**: *string* = "1.0" - -* ### **types**: *object* - - * **EIP712Domain**: *object[]* = [ - { name: 'name', type: 'string' }, - { name: 'version', type: 'string' }, - { name: 'chainId', type: 'uint256' }, - { name: 'verifyingContract', type: 'address' }, - ] +`role` | string | +`signer` | string | - * **OwnershipAttestation**: *object[]* = [ - { name: 'identifier', type: 'bytes32' }, - { name: 'issuer', type: 'address' }, - { name: 'account', type: 'address' }, - { name: 'signer', type: 'address' }, - { name: 'issuedOn', type: 'uint64' }, - ] +**Returns:** *[EIP712TypedData](../interfaces/_sign_typed_data_utils_.eip712typeddata.md)* diff --git a/packages/docs/sdk/docs/wallet-base/classes/_wallet_base_.walletbase.md b/packages/docs/sdk/docs/wallet-base/classes/_wallet_base_.walletbase.md index a439a7783bc..a2d2527b188 100644 --- a/packages/docs/sdk/docs/wallet-base/classes/_wallet_base_.walletbase.md +++ b/packages/docs/sdk/docs/wallet-base/classes/_wallet_base_.walletbase.md @@ -1,6 +1,6 @@ [@celo/wallet-base](../README.md) › ["wallet-base"](../modules/_wallet_base_.md) › [WalletBase](_wallet_base_.walletbase.md) -# Class: WalletBase ‹**TSigner**› +# Class: WalletBase <**TSigner**> ## Type parameters @@ -33,7 +33,7 @@ ▸ **computeSharedSecret**(`address`: Address, `publicKey`: string): *Promise‹Buffer›* -*Defined in [wallets/wallet-base/src/wallet-base.ts:141](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-base/src/wallet-base.ts#L141)* +*Defined in [wallets/wallet-base/src/wallet-base.ts:140](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-base/src/wallet-base.ts#L140)* Computes the shared secret (an ECDH key exchange object) between two accounts @@ -52,7 +52,7 @@ ___ ▸ **decrypt**(`address`: string, `ciphertext`: Buffer): *Promise‹Buffer‹››* -*Defined in [wallets/wallet-base/src/wallet-base.ts:133](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-base/src/wallet-base.ts#L133)* +*Defined in [wallets/wallet-base/src/wallet-base.ts:132](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-base/src/wallet-base.ts#L132)* **Parameters:** @@ -117,7 +117,7 @@ ___ ▸ **signPersonalMessage**(`address`: Address, `data`: string): *Promise‹string›* -*Defined in [wallets/wallet-base/src/wallet-base.ts:97](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-base/src/wallet-base.ts#L97)* +*Defined in [wallets/wallet-base/src/wallet-base.ts:96](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-base/src/wallet-base.ts#L96)* Sign a personal Ethereum signed message. @@ -156,7 +156,7 @@ ___ ▸ **signTypedData**(`address`: Address, `typedData`: EIP712TypedData): *Promise‹string›* -*Defined in [wallets/wallet-base/src/wallet-base.ts:114](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-base/src/wallet-base.ts#L114)* +*Defined in [wallets/wallet-base/src/wallet-base.ts:113](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-base/src/wallet-base.ts#L113)* Sign an EIP712 Typed Data message. diff --git a/packages/docs/sdk/docs/wallet-base/modules/_signing_utils_.md b/packages/docs/sdk/docs/wallet-base/modules/_signing_utils_.md index cd4e96da4c4..85ce30eb71e 100644 --- a/packages/docs/sdk/docs/wallet-base/modules/_signing_utils_.md +++ b/packages/docs/sdk/docs/wallet-base/modules/_signing_utils_.md @@ -17,12 +17,9 @@ * [encodeTransaction](_signing_utils_.md#encodetransaction) * [extractSignature](_signing_utils_.md#extractsignature) * [getHashFromEncoded](_signing_utils_.md#gethashfromencoded) -* [getSignerFromTxEIP2718TX](_signing_utils_.md#getsignerfromtxeip2718tx) -* [isPriceToLow](_signing_utils_.md#ispricetolow) * [recoverMessageSigner](_signing_utils_.md#recovermessagesigner) * [recoverTransaction](_signing_utils_.md#recovertransaction) * [rlpEncodedTx](_signing_utils_.md#rlpencodedtx) -* [stringNumberOrBNToHex](_signing_utils_.md#stringnumberorbntohex) * [verifyEIP712TypedDataSigner](_signing_utils_.md#verifyeip712typeddatasigner) * [verifySignatureWithoutPrefix](_signing_utils_.md#verifysignaturewithoutprefix) @@ -32,7 +29,7 @@ • **publicKeyPrefix**: *number* = 4 -*Defined in [wallets/wallet-base/src/signing-utils.ts:45](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L45)* +*Defined in [wallets/wallet-base/src/signing-utils.ts:18](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L18)* ___ @@ -40,7 +37,7 @@ ___ • **sixtyFour**: *number* = 64 -*Defined in [wallets/wallet-base/src/signing-utils.ts:46](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L46)* +*Defined in [wallets/wallet-base/src/signing-utils.ts:19](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L19)* ___ @@ -48,7 +45,7 @@ ___ • **thirtyTwo**: *number* = 32 -*Defined in [wallets/wallet-base/src/signing-utils.ts:47](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L47)* +*Defined in [wallets/wallet-base/src/signing-utils.ts:20](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L20)* ## Functions @@ -56,7 +53,7 @@ ___ ▸ **chainIdTransformationForSigning**(`chainId`: number): *number* -*Defined in [wallets/wallet-base/src/signing-utils.ts:57](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L57)* +*Defined in [wallets/wallet-base/src/signing-utils.ts:28](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L28)* **Parameters:** @@ -70,9 +67,9 @@ ___ ### decodeSig -▸ **decodeSig**(`sig`: any): *[decodeSig](_signing_utils_.md#decodesig)* +▸ **decodeSig**(`sig`: any): *object* -*Defined in [wallets/wallet-base/src/signing-utils.ts:698](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L698)* +*Defined in [wallets/wallet-base/src/signing-utils.ts:238](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L238)* **Parameters:** @@ -80,7 +77,13 @@ Name | Type | ------ | ------ | `sig` | any | -**Returns:** *[decodeSig](_signing_utils_.md#decodesig)* +**Returns:** *object* + +* **r**: *Buffer‹›* = ethUtil.toBuffer(r) as Buffer + +* **s**: *Buffer‹›* = ethUtil.toBuffer(s) as Buffer + +* **v**: *number* = parseInt(v, 16) ___ @@ -88,7 +91,7 @@ ___ ▸ **encodeTransaction**(`rlpEncoded`: RLPEncodedTx, `signature`: object): *Promise‹EncodedTransaction›* -*Defined in [wallets/wallet-base/src/signing-utils.ts:323](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L323)* +*Defined in [wallets/wallet-base/src/signing-utils.ts:121](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L121)* **Parameters:** @@ -108,9 +111,9 @@ ___ ### extractSignature -▸ **extractSignature**(`rawTx`: string): *[extractSignature](_signing_utils_.md#extractsignature)* +▸ **extractSignature**(`rawTx`: string): *object* -*Defined in [wallets/wallet-base/src/signing-utils.ts:406](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L406)* +*Defined in [wallets/wallet-base/src/signing-utils.ts:155](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L155)* **Parameters:** @@ -118,63 +121,37 @@ Name | Type | ------ | ------ | `rawTx` | string | -**Returns:** *[extractSignature](_signing_utils_.md#extractsignature)* +**Returns:** *object* -___ +* **r**: *Buffer* -### getHashFromEncoded +* **s**: *Buffer* -▸ **getHashFromEncoded**(`rlpEncode`: string): *string* - -*Defined in [wallets/wallet-base/src/signing-utils.ts:61](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L61)* - -**Parameters:** - -Name | Type | ------- | ------ | -`rlpEncode` | string | - -**Returns:** *string* +* **v**: *number* ___ -### getSignerFromTxEIP2718TX +### getHashFromEncoded -▸ **getSignerFromTxEIP2718TX**(`serializedTransaction`: string): *string* +▸ **getHashFromEncoded**(`rlpEncode`: string): *string* -*Defined in [wallets/wallet-base/src/signing-utils.ts:501](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L501)* +*Defined in [wallets/wallet-base/src/signing-utils.ts:32](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L32)* **Parameters:** Name | Type | ------ | ------ | -`serializedTransaction` | string | +`rlpEncode` | string | **Returns:** *string* ___ -### isPriceToLow - -▸ **isPriceToLow**(`tx`: CeloTx): *[isPriceToLow](_signing_utils_.md#ispricetolow)* - -*Defined in [wallets/wallet-base/src/signing-utils.ts:272](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L272)* - -**Parameters:** - -Name | Type | ------- | ------ | -`tx` | CeloTx | - -**Returns:** *[isPriceToLow](_signing_utils_.md#ispricetolow)* - -___ - ### recoverMessageSigner ▸ **recoverMessageSigner**(`signingDataHex`: string, `signedData`: string): *string* -*Defined in [wallets/wallet-base/src/signing-utils.ts:666](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L666)* +*Defined in [wallets/wallet-base/src/signing-utils.ts:205](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L205)* **Parameters:** @@ -191,7 +168,7 @@ ___ ▸ **recoverTransaction**(`rawTx`: string): *[CeloTx, string]* -*Defined in [wallets/wallet-base/src/signing-utils.ts:440](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L440)* +*Defined in [wallets/wallet-base/src/signing-utils.ts:173](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L173)* **Parameters:** @@ -207,7 +184,7 @@ ___ ▸ **rlpEncodedTx**(`tx`: CeloTx): *RLPEncodedTx* -*Defined in [wallets/wallet-base/src/signing-utils.ts:114](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L114)* +*Defined in [wallets/wallet-base/src/signing-utils.ts:70](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L70)* **Parameters:** @@ -219,27 +196,11 @@ Name | Type | ___ -### stringNumberOrBNToHex - -▸ **stringNumberOrBNToHex**(`num?`: number | string | ReturnType‹Web3["utils"]["toBN"]›): *Hex* - -*Defined in [wallets/wallet-base/src/signing-utils.ts:98](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L98)* - -**Parameters:** - -Name | Type | ------- | ------ | -`num?` | number | string | ReturnType‹Web3["utils"]["toBN"]› | - -**Returns:** *Hex* - -___ - ### verifyEIP712TypedDataSigner ▸ **verifyEIP712TypedDataSigner**(`typedData`: EIP712TypedData, `signedData`: string, `expectedAddress`: string): *boolean* -*Defined in [wallets/wallet-base/src/signing-utils.ts:676](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L676)* +*Defined in [wallets/wallet-base/src/signing-utils.ts:215](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L215)* **Parameters:** @@ -255,9 +216,9 @@ ___ ### verifySignatureWithoutPrefix -▸ **verifySignatureWithoutPrefix**(`messageHash`: string, `signature`: string, `signer`: string): *[verifySignatureWithoutPrefix](_signing_utils_.md#verifysignaturewithoutprefix)* +▸ **verifySignatureWithoutPrefix**(`messageHash`: string, `signature`: string, `signer`: string): *boolean* -*Defined in [wallets/wallet-base/src/signing-utils.ts:685](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L685)* +*Defined in [wallets/wallet-base/src/signing-utils.ts:225](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-base/src/signing-utils.ts#L225)* **Parameters:** @@ -267,4 +228,4 @@ Name | Type | `signature` | string | `signer` | string | -**Returns:** *[verifySignatureWithoutPrefix](_signing_utils_.md#verifysignaturewithoutprefix)* +**Returns:** *boolean* diff --git a/packages/docs/sdk/docs/wallet-ledger/classes/_ledger_wallet_.ledgerwallet.md b/packages/docs/sdk/docs/wallet-ledger/classes/_ledger_wallet_.ledgerwallet.md index 2a21be232ca..941d7149ecf 100644 --- a/packages/docs/sdk/docs/wallet-ledger/classes/_ledger_wallet_.ledgerwallet.md +++ b/packages/docs/sdk/docs/wallet-ledger/classes/_ledger_wallet_.ledgerwallet.md @@ -256,15 +256,19 @@ ___ ▸ **signTransaction**(`txParams`: CeloTx): *Promise‹EncodedTransaction›* +*Inherited from [LedgerWallet](_ledger_wallet_.ledgerwallet.md).[signTransaction](_ledger_wallet_.ledgerwallet.md#signtransaction)* + *Overrides void* -*Defined in [wallet-ledger/src/ledger-wallet.ts:70](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-wallet.ts#L70)* +Defined in wallet-remote/lib/remote-wallet.d.ts:37 + +Signs the EVM transaction using the signer pulled from the from field **Parameters:** -Name | Type | ------- | ------ | -`txParams` | CeloTx | +Name | Type | Description | +------ | ------ | ------ | +`txParams` | CeloTx | EVM transaction | **Returns:** *Promise‹EncodedTransaction›* diff --git a/packages/docs/sdk/docs/wallet-ledger/modules/_ledger_utils_.md b/packages/docs/sdk/docs/wallet-ledger/modules/_ledger_utils_.md index 026b9142188..92456bac77b 100644 --- a/packages/docs/sdk/docs/wallet-ledger/modules/_ledger_utils_.md +++ b/packages/docs/sdk/docs/wallet-ledger/modules/_ledger_utils_.md @@ -12,7 +12,7 @@ ### transportErrorFriendlyMessage -▸ **transportErrorFriendlyMessage**(`error`: any): *[transportErrorFriendlyMessage](_ledger_utils_.md#transporterrorfriendlymessage)* +▸ **transportErrorFriendlyMessage**(`error`: any): *void* *Defined in [wallet-ledger/src/ledger-utils.ts:5](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-ledger/src/ledger-utils.ts#L5)* @@ -22,4 +22,4 @@ Name | Type | ------ | ------ | `error` | any | -**Returns:** *[transportErrorFriendlyMessage](_ledger_utils_.md#transporterrorfriendlymessage)* +**Returns:** *void* diff --git a/packages/docs/sdk/docs/wallet-remote/classes/_remote_wallet_.remotewallet.md b/packages/docs/sdk/docs/wallet-remote/classes/_remote_wallet_.remotewallet.md index 898aa87c2dc..feb6f5398ce 100644 --- a/packages/docs/sdk/docs/wallet-remote/classes/_remote_wallet_.remotewallet.md +++ b/packages/docs/sdk/docs/wallet-remote/classes/_remote_wallet_.remotewallet.md @@ -1,6 +1,6 @@ [@celo/wallet-remote](../README.md) › ["remote-wallet"](../modules/_remote_wallet_.md) › [RemoteWallet](_remote_wallet_.remotewallet.md) -# Class: RemoteWallet ‹**TSigner**› +# Class: RemoteWallet <**TSigner**> Abstract class representing a remote wallet that requires async initialization @@ -82,7 +82,7 @@ ___ *Overrides void* -*Defined in [wallet-remote/src/remote-wallet.ts:62](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-remote/src/remote-wallet.ts#L62)* +*Defined in [wallet-remote/src/remote-wallet.ts:61](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-remote/src/remote-wallet.ts#L61)* Get a list of accounts in the remote wallet @@ -96,7 +96,7 @@ ___ *Overrides void* -*Defined in [wallet-remote/src/remote-wallet.ts:71](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-remote/src/remote-wallet.ts#L71)* +*Defined in [wallet-remote/src/remote-wallet.ts:70](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-remote/src/remote-wallet.ts#L70)* Returns true if account is in the remote wallet @@ -114,7 +114,7 @@ ___ ▸ **init**(): *Promise‹void›* -*Defined in [wallet-remote/src/remote-wallet.ts:21](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-remote/src/remote-wallet.ts#L21)* +*Defined in [wallet-remote/src/remote-wallet.ts:20](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-remote/src/remote-wallet.ts#L20)* Discovers wallet accounts and caches results in memory Idempotent to ensure multiple calls are benign @@ -127,7 +127,7 @@ ___ ▸ **isSetupFinished**(): *boolean* -*Defined in [wallet-remote/src/remote-wallet.ts:111](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-remote/src/remote-wallet.ts#L111)* +*Defined in [wallet-remote/src/remote-wallet.ts:110](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-remote/src/remote-wallet.ts#L110)* **Returns:** *boolean* @@ -159,7 +159,7 @@ ___ *Overrides void* -*Defined in [wallet-remote/src/remote-wallet.ts:90](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-remote/src/remote-wallet.ts#L90)* +*Defined in [wallet-remote/src/remote-wallet.ts:89](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-remote/src/remote-wallet.ts#L89)* **Parameters:** @@ -180,7 +180,7 @@ ___ *Overrides void* -*Defined in [wallet-remote/src/remote-wallet.ts:80](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-remote/src/remote-wallet.ts#L80)* +*Defined in [wallet-remote/src/remote-wallet.ts:79](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-remote/src/remote-wallet.ts#L79)* Signs the EVM transaction using the signer pulled from the from field @@ -200,7 +200,7 @@ ___ *Overrides void* -*Defined in [wallet-remote/src/remote-wallet.ts:100](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-remote/src/remote-wallet.ts#L100)* +*Defined in [wallet-remote/src/remote-wallet.ts:99](https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/wallets/wallet-remote/src/remote-wallet.ts#L99)* **Parameters:** diff --git a/packages/env-tests/CHANGELOG.md b/packages/env-tests/CHANGELOG.md index b35c0b38ff4..128d074c410 100644 --- a/packages/env-tests/CHANGELOG.md +++ b/packages/env-tests/CHANGELOG.md @@ -1,5 +1,12 @@ # @celo/env-tests +## 1.0.3-beta.0 + +### Patch Changes + +- Updated dependencies [1c9c844cf] + - @celo/contractkit@6.0.0-beta.0 + ## 1.0.2 ### Patch Changes diff --git a/packages/env-tests/package.json b/packages/env-tests/package.json index a3b1d6b47c9..7e36f315f91 100644 --- a/packages/env-tests/package.json +++ b/packages/env-tests/package.json @@ -1,12 +1,12 @@ { "name": "@celo/env-tests", "private": true, - "version": "1.0.2", + "version": "1.0.3-beta.0", "description": "Environment tests", "main": "index.js", "license": "MIT", "dependencies": { - "@celo/contractkit": "^5.2.0", + "@celo/contractkit": "^6.0.0-beta.0", "@celo/utils": "^5.0.6", "@celo/base": "^6.0.0", "@celo/connect": "^5.1.1", diff --git a/packages/env-tests/src/monorepoRun.ts b/packages/env-tests/src/monorepoRun.ts index 71b263e6091..4cb689f5ab8 100644 --- a/packages/env-tests/src/monorepoRun.ts +++ b/packages/env-tests/src/monorepoRun.ts @@ -4,6 +4,7 @@ import { loadFromEnvFile } from './env' import { rootLogger } from './logger' import { clearAllFundsToRoot, parseStableTokensList } from './scaffold' import { runExchangeTest } from './tests/exchange' +import { runGrandaMentoTest } from './tests/granda-mento' import { runOracleTest } from './tests/oracle' import { runReserveTest } from './tests/reserve' import { runTransfersTest } from './tests/transfer' @@ -39,6 +40,7 @@ function runTests() { runExchangeTest(context, stableTokensToTest) runOracleTest(context) runReserveTest(context) + runGrandaMentoTest(context, stableTokensToTest) // TODO: Governance Proposals // TODO: Validator election + Slashing diff --git a/packages/env-tests/src/tests/granda-mento.ts b/packages/env-tests/src/tests/granda-mento.ts new file mode 100644 index 00000000000..81ef0b2d7c9 --- /dev/null +++ b/packages/env-tests/src/tests/granda-mento.ts @@ -0,0 +1,263 @@ +import { sleep } from '@celo/base' +import { StableToken } from '@celo/contractkit' +import { GoldTokenWrapper } from '@celo/contractkit/lib/wrappers/GoldTokenWrapper' +import { StableTokenWrapper } from '@celo/contractkit/lib/wrappers/StableTokenWrapper' +import { describe, test } from '@jest/globals' +import BigNumber from 'bignumber.js' +import Logger from 'bunyan' +import { EnvTestContext } from '../context' +import { + fundAccountWithCELO, + fundAccountWithStableToken, + getKey, + getValidatorKey, + ONE, + TestAccounts, +} from '../scaffold' + +export function runGrandaMentoTest(context: EnvTestContext, stableTokensToTest: StableToken[]) { + const celoAmountToFund = ONE.times(61000) + const stableTokenAmountToFund = ONE.times(61000) + + const celoAmountToSell = ONE.times(60000) + const stableTokenAmountToSell = ONE.times(60000) + + describe('Granda Mento Test', () => { + beforeAll(async () => { + await fundAccountWithCELO(context, TestAccounts.GrandaMentoExchanger, celoAmountToFund) + }) + + const baseLogger = context.logger.child({ test: 'grandaMento' }) + + for (const sellCelo of [true, false]) { + for (const stableToken of stableTokensToTest) { + const sellTokenStr = sellCelo ? 'CELO' : stableToken + const buyTokenStr = sellCelo ? stableToken : 'CELO' + describe(`selling ${sellTokenStr} for ${buyTokenStr}`, () => { + beforeAll(async () => { + if (!sellCelo) { + await fundAccountWithStableToken( + context, + TestAccounts.GrandaMentoExchanger, + stableTokenAmountToFund, + stableToken + ) + } + }) + + let buyToken: GoldTokenWrapper | StableTokenWrapper + let sellToken: GoldTokenWrapper | StableTokenWrapper + let stableTokenAddress: string + let sellAmount: BigNumber + + beforeEach(async () => { + const goldTokenWrapper = await context.kit.contracts.getGoldToken() + const stableTokenWrapper = await context.kit.celoTokens.getWrapper( + stableToken as StableToken + ) + stableTokenAddress = stableTokenWrapper.address + if (sellCelo) { + buyToken = stableTokenWrapper + sellToken = goldTokenWrapper + sellAmount = celoAmountToSell + } else { + buyToken = goldTokenWrapper + sellToken = stableTokenWrapper + sellAmount = stableTokenAmountToSell + } + }) + + const createExchangeProposal = async (logger: Logger, fromAddress: string) => { + const grandaMento = await context.kit.contracts.getGrandaMento() + const tokenApprovalReceipt = await sellToken + .approve(grandaMento.address, sellAmount.toFixed()) + .sendAndWaitForReceipt({ + from: fromAddress, + }) + logger.debug( + { + sellAmount, + sellTokenStr, + spender: grandaMento.address, + }, + 'Approved GrandaMento to spend sell token' + ) + const minedTokenApprovalTx = await context.kit.web3.eth.getTransaction( + tokenApprovalReceipt.transactionHash + ) + const tokenApprovalCeloFees = new BigNumber(tokenApprovalReceipt.gasUsed).times( + minedTokenApprovalTx.gasPrice + ) + + // Some flakiness has been observed after approving, so we sleep + await sleep(5000) + + const creationTx = await grandaMento.createExchangeProposal( + context.kit.celoTokens.getContract(stableToken as StableToken), + sellAmount, + sellCelo + ) + const creationReceipt = await creationTx.sendAndWaitForReceipt({ + from: fromAddress, + }) + // Some flakiness has been observed after proposing, so we sleep + await sleep(5000) + const proposalId = + creationReceipt.events!.ExchangeProposalCreated.returnValues.proposalId + + logger.debug( + { + sellAmount, + sellCelo, + proposalId, + }, + 'Created exchange proposal' + ) + const minedCreationTx = await context.kit.web3.eth.getTransaction( + creationReceipt.transactionHash + ) + const creationCeloFees = new BigNumber(creationReceipt.gasUsed).times( + minedCreationTx.gasPrice + ) + return { + creationReceipt, + minedCreationTx, + proposalId, + celoFees: tokenApprovalCeloFees.plus(creationCeloFees), + } + } + + test('exchanger creates and cancels an exchange proposal', async () => { + const from = await getKey(context.mnemonic, TestAccounts.GrandaMentoExchanger) + context.kit.connection.addAccount(from.privateKey) + context.kit.defaultAccount = from.address + + const logger = baseLogger.child({ from: from.address }) + const grandaMento = await context.kit.contracts.getGrandaMento() + + const sellTokenBalanceBeforeCreation = await sellToken.balanceOf(from.address) + + const creationInfo = await createExchangeProposal(logger, from.address) + let celoFees = creationInfo.celoFees + + const sellTokenBalanceAfterCreation = await sellToken.balanceOf(from.address) + + // If we are looking at the CELO balance, take the fees spent into consideration. + const expectedBalanceDifference = sellCelo ? sellAmount.plus(celoFees) : sellAmount + + expect( + sellTokenBalanceBeforeCreation.minus(sellTokenBalanceAfterCreation).toString() + ).toBe(expectedBalanceDifference.toString()) + + const cancelReceipt = await grandaMento + .cancelExchangeProposal(creationInfo.proposalId) + .sendAndWaitForReceipt({ + from: from.address, + }) + const minedCancelTx = await context.kit.web3.eth.getTransaction( + cancelReceipt.transactionHash + ) + + logger.debug( + { + proposalId: creationInfo.proposalId, + }, + 'Cancelled exchange proposal' + ) + + celoFees = celoFees.plus( + new BigNumber(cancelReceipt.gasUsed).times(minedCancelTx.gasPrice) + ) + + const sellTokenBalanceAfterCancel = await sellToken.balanceOf(from.address) + // If we are looking at the CELO balance, take the fees spent into consideration. + const expectedBalance = sellCelo + ? sellTokenBalanceBeforeCreation.minus(celoFees) + : sellTokenBalanceBeforeCreation + expect(sellTokenBalanceAfterCancel.toString()).toBe(expectedBalance.toString()) + }) + + test('exchanger creates and executes an approved exchange proposal', async () => { + const from = await getKey(context.mnemonic, TestAccounts.GrandaMentoExchanger) + context.kit.connection.addAccount(from.privateKey) + context.kit.defaultAccount = from.address + + const logger = baseLogger.child({ from: from.address }) + + const grandaMento = await context.kit.contracts.getGrandaMento() + + const sellTokenBalanceBefore = await sellToken.balanceOf(from.address) + const buyTokenBalanceBefore = await buyToken.balanceOf(from.address) + + const creationInfo = await createExchangeProposal(logger, from.address) + + const approver = await getValidatorKey(context.mnemonic, 0) + await grandaMento + .approveExchangeProposal(creationInfo.proposalId) + .sendAndWaitForReceipt({ + from: approver.address, + }) + + const vetoPeriodSeconds = await grandaMento.vetoPeriodSeconds() + // Sleep for the veto period, add 5 seconds for extra measure + const sleepPeriodMs = vetoPeriodSeconds.plus(5).times(1000).toNumber() + logger.debug( + { + sleepPeriodMs, + vetoPeriodSeconds, + }, + 'Sleeping so the veto period elapses' + ) + await sleep(sleepPeriodMs) + + // Executing from the approver to avoid needing to calculate additional gas paid + // by the approver in this test. + await grandaMento + .executeExchangeProposal(creationInfo.proposalId) + .sendAndWaitForReceipt({ + from: approver.address, + }) + + logger.debug( + { + proposalId: creationInfo.proposalId, + }, + 'Executed exchange proposal' + ) + + const sellTokenBalanceAfter = await sellToken.balanceOf(from.address) + let expectedSellTokenBalanceAfter = sellTokenBalanceBefore.minus(sellAmount) + if (sellCelo) { + expectedSellTokenBalanceAfter = expectedSellTokenBalanceAfter.minus( + creationInfo.celoFees + ) + } + expect(sellTokenBalanceAfter.toString()).toBe(expectedSellTokenBalanceAfter.toString()) + + const sortedOracles = await context.kit.contracts.getSortedOracles() + const celoStableTokenRate = (await sortedOracles.medianRate(stableTokenAddress)).rate + + const exchangeRate = sellCelo + ? celoStableTokenRate + : new BigNumber(1).div(celoStableTokenRate) + const buyAmount = getBuyAmount(exchangeRate, sellAmount, await grandaMento.spread()) + + const buyTokenBalanceAfter = await buyToken.balanceOf(from.address) + let expectedBuyTokenBalanceAfter = buyTokenBalanceBefore.plus(buyAmount) + if (!sellCelo) { + expectedBuyTokenBalanceAfter = expectedBuyTokenBalanceAfter.minus( + creationInfo.celoFees + ) + } + expect(buyTokenBalanceAfter.toString()).toBe(expectedBuyTokenBalanceAfter.toString()) + }) + }) + } + } + }) +} + +// exchangeRate is the price of the sell token quoted in buy token +function getBuyAmount(exchangeRate: BigNumber, sellAmount: BigNumber, spread: BigNumber.Value) { + return sellAmount.times(new BigNumber(1).minus(spread)).times(exchangeRate) +} diff --git a/packages/metadata-crawler/CHANGELOG.md b/packages/metadata-crawler/CHANGELOG.md index 65d98431f53..a500e995c1f 100644 --- a/packages/metadata-crawler/CHANGELOG.md +++ b/packages/metadata-crawler/CHANGELOG.md @@ -1,5 +1,12 @@ # @celo/metadata-crawler +## 0.0.4-beta.0 + +### Patch Changes + +- Updated dependencies [1c9c844cf] + - @celo/contractkit@6.0.0-beta.0 + ## 0.0.3 ### Patch Changes diff --git a/packages/metadata-crawler/package.json b/packages/metadata-crawler/package.json index 2c85a8c1a34..eb74780f21c 100644 --- a/packages/metadata-crawler/package.json +++ b/packages/metadata-crawler/package.json @@ -1,6 +1,6 @@ { "name": "@celo/metadata-crawler", - "version": "0.0.3", + "version": "0.0.4-beta.0", "description": "Celo metadata crawler", "main": "index.js", "types": "./lib/index.d.ts", @@ -10,7 +10,7 @@ "repository": "https://github.com/celo-org/celo-monorepo/tree/master/packages/metadata-crawler", "dependencies": { "@celo/connect": "^5.1.1", - "@celo/contractkit": "^5.2.0", + "@celo/contractkit": "^6.0.0-beta.0", "@celo/utils": "^5.0.6", "@types/pg": "^7.14.3", "bunyan": "1.8.12", diff --git a/packages/sdk/contractkit/CHANGELOG.md b/packages/sdk/contractkit/CHANGELOG.md index 5713f855e65..35465ddd33c 100644 --- a/packages/sdk/contractkit/CHANGELOG.md +++ b/packages/sdk/contractkit/CHANGELOG.md @@ -1,5 +1,29 @@ # @celo/contractkit +## 6.0.0-beta.2 + +### Patch Changes + +- ba27783ae: Revert removal of Contracts + +## 6.0.0-beta.1 + +### Major Changes + +- 9ab9d00eb: Remove Support for deprecated MetaTransactionWallet and MetaTransactionWalletDeployer. IF absolutely needed the contracts can be accessed directly or an alternative such as account abstraction should be used +- 9ab9d00eb: Removes Grandamento from cli and contractkit completely as it has become no op by mento team + +## 6.0.0-beta.0 + +### Major Changes + +- 1c9c844cf: Remove contracts from lib/generated. now available in @celo/abis package at @celo/abis/web3 + + If you were directly importing contracts from `@celo/contractkit/lib/generated/*` eg `@celo/lib/generated/Accounts` do a find replace + + find: `@celo/contractkit/lib/generated/` + replace: `@celo/abis/web3/` + ## 5.2.1 ### Patch Changes diff --git a/packages/sdk/contractkit/package.json b/packages/sdk/contractkit/package.json index 271e2612c86..a887341011a 100644 --- a/packages/sdk/contractkit/package.json +++ b/packages/sdk/contractkit/package.json @@ -1,6 +1,6 @@ { "name": "@celo/contractkit", - "version": "5.2.1", + "version": "6.0.0-beta.2", "description": "Celo's ContractKit to interact with Celo network", "main": "./lib/index.js", "types": "./lib/index.d.ts", diff --git a/packages/sdk/contractkit/src/base.ts b/packages/sdk/contractkit/src/base.ts index fa19ddf2efc..ff93fe7b8cc 100644 --- a/packages/sdk/contractkit/src/base.ts +++ b/packages/sdk/contractkit/src/base.ts @@ -18,9 +18,12 @@ export enum CeloContract { GasPriceMinimum = 'GasPriceMinimum', GoldToken = 'GoldToken', Governance = 'Governance', + GrandaMento = 'GrandaMento', LockedGold = 'LockedGold', MentoFeeHandlerSeller = 'MentoFeeHandlerSeller', UniswapFeeHandlerSeller = 'UniswapFeeHandlerSeller', + MetaTransactionWallet = 'MetaTransactionWallet', + MetaTransactionWalletDeployer = 'MetaTransactionWalletDeployer', MultiSig = 'MultiSig', OdisPayments = 'OdisPayments', Random = 'Random', @@ -51,7 +54,12 @@ export type CeloTokenContract = StableTokenContract | CeloContract.GoldToken export type CeloToken = CeloTokenContract export const AllContracts = Object.keys(CeloContract) as CeloContract[] -const AuxiliaryContracts = [CeloContract.MultiSig, CeloContract.ERC20] +const AuxiliaryContracts = [ + CeloContract.MultiSig, + CeloContract.MetaTransactionWalletDeployer, + CeloContract.MetaTransactionWallet, + CeloContract.ERC20, +] export const RegisteredContracts = AllContracts.filter((v) => !AuxiliaryContracts.includes(v)) /** @internal */ diff --git a/packages/sdk/contractkit/src/contract-cache.ts b/packages/sdk/contractkit/src/contract-cache.ts index 306cfa2a0f3..ff7e033e609 100644 --- a/packages/sdk/contractkit/src/contract-cache.ts +++ b/packages/sdk/contractkit/src/contract-cache.ts @@ -20,7 +20,10 @@ import { FreezerWrapper } from './wrappers/Freezer' import { GasPriceMinimumWrapper } from './wrappers/GasPriceMinimum' import { GoldTokenWrapper } from './wrappers/GoldTokenWrapper' import { GovernanceWrapper } from './wrappers/Governance' +import { GrandaMentoWrapper } from './wrappers/GrandaMento' import { LockedGoldWrapper } from './wrappers/LockedGold' +import { MetaTransactionWalletWrapper } from './wrappers/MetaTransactionWallet' +import { MetaTransactionWalletDeployerWrapper } from './wrappers/MetaTransactionWalletDeployer' import { MultiSigWrapper } from './wrappers/MultiSig' import { OdisPaymentsWrapper } from './wrappers/OdisPayments' import { ReserveWrapper } from './wrappers/Reserve' @@ -42,8 +45,11 @@ const WrapperFactories = { [CeloContract.Freezer]: FreezerWrapper, [CeloContract.GasPriceMinimum]: GasPriceMinimumWrapper, [CeloContract.GoldToken]: GoldTokenWrapper, + [CeloContract.GrandaMento]: GrandaMentoWrapper, // [CeloContract.Random]: RandomWrapper, // [CeloContract.Registry]: RegistryWrapper, + [CeloContract.MetaTransactionWallet]: MetaTransactionWalletWrapper, + [CeloContract.MetaTransactionWalletDeployer]: MetaTransactionWalletDeployerWrapper, [CeloContract.MultiSig]: MultiSigWrapper, [CeloContract.OdisPayments]: OdisPaymentsWrapper, [CeloContract.Reserve]: ReserveWrapper, @@ -95,7 +101,10 @@ interface WrapperCacheMap { [CeloContract.GasPriceMinimum]?: GasPriceMinimumWrapper [CeloContract.GoldToken]?: GoldTokenWrapper [CeloContract.Governance]?: GovernanceWrapper + [CeloContract.GrandaMento]?: GrandaMentoWrapper [CeloContract.LockedGold]?: LockedGoldWrapper + [CeloContract.MetaTransactionWallet]?: MetaTransactionWalletWrapper + [CeloContract.MetaTransactionWalletDeployer]?: MetaTransactionWalletDeployerWrapper [CeloContract.MultiSig]?: MultiSigWrapper [CeloContract.OdisPayments]?: OdisPaymentsWrapper // [CeloContract.Random]?: RandomWrapper, @@ -172,9 +181,24 @@ export class WrapperCache implements ContractCacheType { getGovernance() { return this.getContract(CeloContract.Governance) } + getGrandaMento() { + return this.getContract(CeloContract.GrandaMento) + } getLockedGold() { return this.getContract(CeloContract.LockedGold) } + /* + @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 + */ + getMetaTransactionWallet(address: string) { + return this.getContract(CeloContract.MetaTransactionWallet, address) + } + /* + @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 + */ + getMetaTransactionWalletDeployer(address: string) { + return this.getContract(CeloContract.MetaTransactionWalletDeployer, address) + } getMultiSig(address: string) { return this.getContract(CeloContract.MultiSig, address) } diff --git a/packages/sdk/contractkit/src/kit.ts b/packages/sdk/contractkit/src/kit.ts index 8278976361e..5c47fdb22c0 100644 --- a/packages/sdk/contractkit/src/kit.ts +++ b/packages/sdk/contractkit/src/kit.ts @@ -30,6 +30,7 @@ import { ElectionConfig } from './wrappers/Election' import { ExchangeConfig } from './wrappers/Exchange' import { GasPriceMinimumConfig } from './wrappers/GasPriceMinimum' import { GovernanceConfig } from './wrappers/Governance' +import { GrandaMentoConfig } from './wrappers/GrandaMento' import { LockedGoldConfig } from './wrappers/LockedGold' import { ReserveConfig } from './wrappers/Reserve' import { SortedOraclesConfig } from './wrappers/SortedOracles' @@ -80,6 +81,7 @@ export interface NetworkConfig { validators: ValidatorsConfig downtimeSlasher: DowntimeSlasherConfig blockchainParameters: BlockchainParametersConfig + grandaMento: GrandaMentoConfig } interface AccountBalance extends EachCeloToken { @@ -154,6 +156,7 @@ export class ContractKit { CeloContract.DowntimeSlasher, CeloContract.BlockchainParameters, CeloContract.EpochRewards, + CeloContract.GrandaMento, ] const configMethod = async (contract: ValidWrappers) => { diff --git a/packages/sdk/contractkit/src/proxy.ts b/packages/sdk/contractkit/src/proxy.ts index 7ea7257d766..6c57ec4adea 100644 --- a/packages/sdk/contractkit/src/proxy.ts +++ b/packages/sdk/contractkit/src/proxy.ts @@ -18,6 +18,8 @@ import { ABI as GoldTokenABI } from '@celo/abis/web3/GoldToken' import { ABI as GovernanceABI } from '@celo/abis/web3/Governance' import { ABI as LockedGoldABI } from '@celo/abis/web3/LockedGold' import { ABI as MentoFeeHandlerSellerABI } from '@celo/abis/web3/MentoFeeHandlerSeller' +import { ABI as MetaTransactionWalletABI } from '@celo/abis/web3/MetaTransactionWallet' +import { ABI as MetaTransactionWalletDeployerABI } from '@celo/abis/web3/MetaTransactionWalletDeployer' import { ABI as MultiSigABI } from '@celo/abis/web3/MultiSig' import { ABI as OdisPaymentsABI } from '@celo/abis/web3/OdisPayments' import { ABI as ProxyABI } from '@celo/abis/web3/Proxy' @@ -27,6 +29,7 @@ import { ABI as SortedOraclesABI } from '@celo/abis/web3/SortedOracles' import { ABI as UniswapFeeHandlerSellerABI } from '@celo/abis/web3/UniswapFeeHandlerSeller' import { ABI as ValidatorsABI } from '@celo/abis/web3/Validators' import { ABI as ExchangeABI } from '@celo/abis/web3/mento/Exchange' +import { ABI as GrandaMentoABI } from '@celo/abis/web3/mento/GrandaMento' import { ABI as ReserveABI } from '@celo/abis/web3/mento/Reserve' import { ABI as StableTokenABI } from '@celo/abis/web3/mento/StableToken' @@ -115,7 +118,10 @@ const initializeAbiMap = { GasPriceMinimumProxy: findInitializeAbi(GasPriceMinimumABI), GoldTokenProxy: findInitializeAbi(GoldTokenABI), GovernanceProxy: findInitializeAbi(GovernanceABI), + GrandaMentoProxy: findInitializeAbi(GrandaMentoABI), LockedGoldProxy: findInitializeAbi(LockedGoldABI), + MetaTransactionWalletProxy: findInitializeAbi(MetaTransactionWalletABI), + MetaTransactionWalletDeployerProxy: findInitializeAbi(MetaTransactionWalletDeployerABI), MultiSigProxy: findInitializeAbi(MultiSigABI), OdisPaymentsProxy: findInitializeAbi(OdisPaymentsABI), ProxyProxy: findInitializeAbi(ProxyABI), diff --git a/packages/sdk/contractkit/src/test-utils/grandaMento.ts b/packages/sdk/contractkit/src/test-utils/grandaMento.ts new file mode 100644 index 00000000000..c640d040373 --- /dev/null +++ b/packages/sdk/contractkit/src/test-utils/grandaMento.ts @@ -0,0 +1,13 @@ +import BigNumber from 'bignumber.js' +import { GrandaMentoWrapper } from '../wrappers/GrandaMento' + +export const setGrandaMentoLimits = async ( + grandaMento: GrandaMentoWrapper, + newLimitMin: BigNumber = new BigNumber('1000'), + newLimitMax: BigNumber = new BigNumber('1000000000000'), + stableToken: string = 'StableToken' +) => { + await grandaMento + .setStableTokenExchangeLimits(stableToken, newLimitMin.toString(), newLimitMax.toString()) + .sendAndWaitForReceipt() +} diff --git a/packages/sdk/contractkit/src/test-utils/transferownership.ts b/packages/sdk/contractkit/src/test-utils/transferownership.ts new file mode 100644 index 00000000000..a4080d9a2b5 --- /dev/null +++ b/packages/sdk/contractkit/src/test-utils/transferownership.ts @@ -0,0 +1,67 @@ +import { NetworkConfig, timeTravel } from '@celo/dev-utils/lib/ganache-test' +import Web3 from 'web3' +import { newKitFromWeb3 } from '../kit' +import { AccountsWrapper } from '../wrappers/Accounts' +import { Proposal, ProposalTransaction } from '../wrappers/Governance' + +// Implements a transfer ownership function using only contractkit primitives + +const expConfigGovernance = NetworkConfig.governance + +export async function assumeOwnership(web3: Web3, to: string) { + const kit = newKitFromWeb3(web3) + const ONE_CGLD = web3.utils.toWei('1', 'ether') + const accounts = await web3.eth.getAccounts() + let accountWrapper: AccountsWrapper + accountWrapper = await kit.contracts.getAccounts() + const lockedGold = await kit.contracts.getLockedGold() + + try { + await accountWrapper.createAccount().sendAndWaitForReceipt({ from: accounts[0] }) + await lockedGold.lock().sendAndWaitForReceipt({ from: accounts[0], value: ONE_CGLD }) + } catch (error) { + console.log('Account already created') + } + + const grandaMento = await kit._web3Contracts.getGrandaMento() + const governance = await kit.contracts.getGovernance() + const multiSig = await kit.contracts.getMultiSig(await governance.getApprover()) + + const tenMillionCELO = web3.utils.toWei('10000000') + + await lockedGold.lock().sendAndWaitForReceipt({ value: tenMillionCELO }) + + const ownershiptx: ProposalTransaction = { + value: '0', + to: (grandaMento as any)._address, + input: grandaMento.methods.transferOwnership(to).encodeABI(), + } + const proposal: Proposal = [ownershiptx] + + await governance.propose(proposal, 'URL').sendAndWaitForReceipt({ + from: accounts[0], + value: (await governance.getConfig()).minDeposit.toNumber(), + }) + + const proposalReceipt = await governance.propose(proposal, 'URL').sendAndWaitForReceipt({ + from: accounts[0], + value: (await governance.getConfig()).minDeposit.toNumber(), + }) + const proposalId = proposalReceipt.events!.ProposalQueued.returnValues.proposalId + + const tx = await governance.upvote(proposalId, accounts[1]) + await tx.sendAndWaitForReceipt() + await timeTravel(expConfigGovernance.dequeueFrequency, web3) + await governance.dequeueProposalsIfReady().sendAndWaitForReceipt() + + const tx2 = await governance.approve(proposalId) + const multisigTx = await multiSig.submitOrConfirmTransaction(governance.address, tx2.txo) + await multisigTx.sendAndWaitForReceipt({ from: accounts[0] }) + + const tx3 = await governance.vote(proposalId, 'Yes') + await tx3.sendAndWaitForReceipt({ from: accounts[0] }) + await timeTravel(expConfigGovernance.referendumStageDuration, web3) + + const tx4 = await governance.execute(proposalId) + await tx4.sendAndWaitForReceipt() +} diff --git a/packages/sdk/contractkit/src/web3-contract-cache.ts b/packages/sdk/contractkit/src/web3-contract-cache.ts index efaa563d606..c3e31b36549 100644 --- a/packages/sdk/contractkit/src/web3-contract-cache.ts +++ b/packages/sdk/contractkit/src/web3-contract-cache.ts @@ -1,4 +1,8 @@ // tslint:disable: ordered-imports +import debugFactory from 'debug' +import { AddressRegistry } from './address-registry' +import { CeloContract, ProxyContracts } from './base' +import { StableToken } from './celo-tokens' import { newGasPriceMinimum } from '@celo/abis/web3/0.8/GasPriceMinimum' import { newAccounts } from '@celo/abis/web3/Accounts' import { newAttestations } from '@celo/abis/web3/Attestations' @@ -16,6 +20,8 @@ import { newGoldToken } from '@celo/abis/web3/GoldToken' import { newGovernance } from '@celo/abis/web3/Governance' import { newIERC20 } from '@celo/abis/web3/IERC20' import { newLockedGold } from '@celo/abis/web3/LockedGold' +import { newMetaTransactionWallet } from '@celo/abis/web3/MetaTransactionWallet' +import { newMetaTransactionWalletDeployer } from '@celo/abis/web3/MetaTransactionWalletDeployer' import { newMultiSig } from '@celo/abis/web3/MultiSig' import { newOdisPayments } from '@celo/abis/web3/OdisPayments' import { newProxy } from '@celo/abis/web3/Proxy' @@ -26,12 +32,9 @@ import { newValidators } from '@celo/abis/web3/Validators' import { newExchange } from '@celo/abis/web3/mento/Exchange' import { newExchangeBRL } from '@celo/abis/web3/mento/ExchangeBRL' import { newExchangeEUR } from '@celo/abis/web3/mento/ExchangeEUR' +import { newGrandaMento } from '@celo/abis/web3/mento/GrandaMento' import { newReserve } from '@celo/abis/web3/mento/Reserve' import { newStableToken } from '@celo/abis/web3/mento/StableToken' -import debugFactory from 'debug' -import { AddressRegistry } from './address-registry' -import { CeloContract, ProxyContracts } from './base' -import { StableToken } from './celo-tokens' import { newMentoFeeHandlerSeller } from '@celo/abis/web3/MentoFeeHandlerSeller' import { newUniswapFeeHandlerSeller } from '@celo/abis/web3/UniswapFeeHandlerSeller' @@ -60,7 +63,10 @@ export const ContractFactories = { [CeloContract.GasPriceMinimum]: newGasPriceMinimum, [CeloContract.GoldToken]: newGoldToken, [CeloContract.Governance]: newGovernance, + [CeloContract.GrandaMento]: newGrandaMento, [CeloContract.LockedGold]: newLockedGold, + [CeloContract.MetaTransactionWallet]: newMetaTransactionWallet, + [CeloContract.MetaTransactionWalletDeployer]: newMetaTransactionWalletDeployer, [CeloContract.MultiSig]: newMultiSig, [CeloContract.OdisPayments]: newOdisPayments, [CeloContract.Random]: newRandom, @@ -77,13 +83,13 @@ const StableToContract = { [StableToken.cEUR]: CeloContract.StableTokenEUR, [StableToken.cUSD]: CeloContract.StableToken, [StableToken.cREAL]: CeloContract.StableTokenBRL, -} as const +} const StableToExchange = { [StableToken.cEUR]: CeloContract.ExchangeEUR, [StableToken.cUSD]: CeloContract.Exchange, [StableToken.cREAL]: CeloContract.ExchangeBRL, -} as const +} export type CFType = typeof ContractFactories type ContractCacheMap = { [K in keyof CFType]?: ReturnType } @@ -151,9 +157,24 @@ export class Web3ContractCache { getGovernance() { return this.getContract(CeloContract.Governance) } + getGrandaMento() { + return this.getContract(CeloContract.GrandaMento) + } getLockedGold() { return this.getContract(CeloContract.LockedGold) } + /* + @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 + */ + getMetaTransactionWallet(address: string) { + return this.getContract(CeloContract.MetaTransactionWallet, address) + } + /* + @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 + */ + getMetaTransactionWalletDeployer(address: string) { + return this.getContract(CeloContract.MetaTransactionWalletDeployer, address) + } getMultiSig(address: string) { return this.getContract(CeloContract.MultiSig, address) } diff --git a/packages/sdk/contractkit/src/wrappers/FeeHandler.ts b/packages/sdk/contractkit/src/wrappers/FeeHandler.ts index e8dfbe17878..1d90fad4272 100644 --- a/packages/sdk/contractkit/src/wrappers/FeeHandler.ts +++ b/packages/sdk/contractkit/src/wrappers/FeeHandler.ts @@ -1,6 +1,7 @@ import { FeeHandler } from '@celo/abis/web3/FeeHandler' import { Address } from '@celo/connect' import BigNumber from 'bignumber.js' +import { StableTokenContract } from '../base' import { BaseWrapper, proxyCall, proxySend } from './BaseWrapper' export enum ExchangeProposalState { @@ -11,6 +12,14 @@ export enum ExchangeProposalState { Cancelled, } +export interface GrandaMentoConfig { + approver: string + spread: BigNumber + vetoPeriodSeconds: BigNumber + maxApprovalExchangeRateChange: BigNumber + exchangeLimits: AllStableConfig +} + export interface StableTokenExchangeLimits { minExchangeAmount: BigNumber maxExchangeAmount: BigNumber @@ -40,6 +49,8 @@ export interface ExchangeProposalReadable { implictPricePerCelo: BigNumber } +type AllStableConfig = Map + export class FeeHandlerWrapper extends BaseWrapper { owner = proxyCall(this.contract.methods.owner) diff --git a/packages/sdk/contractkit/src/wrappers/GrandaMento.test.ts b/packages/sdk/contractkit/src/wrappers/GrandaMento.test.ts new file mode 100644 index 00000000000..53eeac3cf51 --- /dev/null +++ b/packages/sdk/contractkit/src/wrappers/GrandaMento.test.ts @@ -0,0 +1,189 @@ +import { Address } from '@celo/base/lib/address' +import { NetworkConfig, testWithGanache, timeTravel } from '@celo/dev-utils/lib/ganache-test' +import { toFixed } from '@celo/utils/src/fixidity' +import BigNumber from 'bignumber.js' +import Web3 from 'web3' +import { StableToken } from '../celo-tokens' +import { newKitFromWeb3 } from '../kit' +import { setGrandaMentoLimits } from '../test-utils/grandaMento' +import { assumeOwnership } from '../test-utils/transferownership' +import { GoldTokenWrapper } from './GoldTokenWrapper' +import { ExchangeProposalState, GrandaMentoWrapper } from './GrandaMento' +import { StableTokenWrapper } from './StableTokenWrapper' + +const expConfig = NetworkConfig.grandaMento + +testWithGanache('GrandaMento Wrapper', (web3: Web3) => { + const kit = newKitFromWeb3(web3) + let accounts: Address[] = [] + let grandaMento: GrandaMentoWrapper + let celoToken: GoldTokenWrapper + let stableToken: StableTokenWrapper + const newLimitMin = new BigNumber('1000') + const newLimitMax = new BigNumber('1000000000000') + let sellAmount: BigNumber + + beforeAll(async () => { + accounts = await web3.eth.getAccounts() + kit.defaultAccount = accounts[0] + grandaMento = await kit.contracts.getGrandaMento() + + stableToken = await kit.contracts.getStableToken(StableToken.cUSD) + celoToken = await kit.contracts.getGoldToken() + // Reset limits + await assumeOwnership(web3, accounts[0]) + const zero = new BigNumber(0) + await setLimits('StableToken', zero, zero) + await setLimits('StableTokenEUR', zero, zero) + }) + + const setLimits = async ( + registryId: string = 'StableToken', + min: BigNumber = newLimitMin, + max: BigNumber = newLimitMax + ) => { + await setGrandaMentoLimits(grandaMento, min, max, registryId) + } + + describe('No limits sets', () => { + it('gets the proposals', async () => { + const activeProposals = await grandaMento.getActiveProposalIds() + expect(activeProposals).toEqual([]) + }) + + it('fetches empty limits', async () => { + const limits = await grandaMento.stableTokenExchangeLimits(StableToken.cUSD) + expect(limits.minExchangeAmount).toEqBigNumber(new BigNumber(0)) + expect(limits.maxExchangeAmount).toEqBigNumber(new BigNumber(0)) + }) + }) + + it("fetchs a proposal it doesn't exist", async () => { + await expect(grandaMento.getExchangeProposal(0)).rejects.toThrow("Proposal doesn't exist") + }) + + describe('When Granda Mento is enabled', () => { + beforeEach(async () => { + await setLimits() + }) + + it('updated the config', async () => { + const config = await grandaMento.getConfig() + expect( + config.exchangeLimits.get(kit.celoTokens.getContract(StableToken.cUSD))?.minExchangeAmount + ).toEqBigNumber(new BigNumber(newLimitMin)) + expect( + config.exchangeLimits.get(kit.celoTokens.getContract(StableToken.cUSD))?.maxExchangeAmount + ).toEqBigNumber(new BigNumber(newLimitMax)) + expect( + config.exchangeLimits.get(kit.celoTokens.getContract(StableToken.cEUR))?.minExchangeAmount + ).toEqBigNumber(new BigNumber(0)) + expect( + config.exchangeLimits.get(kit.celoTokens.getContract(StableToken.cEUR))?.maxExchangeAmount + ).toEqBigNumber(new BigNumber(0)) + }) + + it('has new limits', async () => { + const limits = await grandaMento.stableTokenExchangeLimits(StableToken.cUSD) + expect(limits.minExchangeAmount).toEqBigNumber(newLimitMin) + expect(limits.maxExchangeAmount).toEqBigNumber(newLimitMax) + }) + + describe('Has a proposal', () => { + beforeEach(async () => { + sellAmount = new BigNumber('100000000') + await celoToken.increaseAllowance(grandaMento.address, sellAmount).sendAndWaitForReceipt() + + await ( + await grandaMento.createExchangeProposal( + kit.celoTokens.getContract(StableToken.cUSD), + sellAmount, + true + ) + ).sendAndWaitForReceipt() + }) + + it('executes', async () => { + const activeProposals = await grandaMento.getActiveProposalIds() + expect(activeProposals).not.toEqual([]) + + let proposal = await grandaMento.getExchangeProposal(activeProposals[0]) + expect(proposal.exchanger).toEqual(accounts[0]) + expect(proposal.stableToken).toEqual(stableToken.address) + expect(proposal.sellAmount).toEqBigNumber(sellAmount) + expect(proposal.buyAmount).toEqBigNumber(new BigNumber('99000000')) + expect(proposal.approvalTimestamp).toEqual(new BigNumber(0)) + expect(proposal.state).toEqual(ExchangeProposalState.Proposed) + expect(proposal.sellCelo).toEqual(true) + + await grandaMento.approveExchangeProposal(activeProposals[0]).sendAndWaitForReceipt() + + proposal = await grandaMento.getExchangeProposal(activeProposals[0]) + + expect(proposal.state).toEqual(ExchangeProposalState.Approved) + await timeTravel(expConfig.vetoPeriodSeconds, web3) + await grandaMento.executeExchangeProposal(activeProposals[0]).sendAndWaitForReceipt() + + proposal = await grandaMento.getExchangeProposal(activeProposals[0]) + expect(proposal.state).toEqual(ExchangeProposalState.Executed) + }) + + it('displays human format correctly', async () => { + const activeProposals = await grandaMento.getActiveProposalIds() + + const proposal = await grandaMento.getHumanReadableExchangeProposal(activeProposals[0]) + expect(proposal.exchanger).toEqual(accounts[0]) + expect(proposal.stableToken).toEqual(`Celo Dollar (cUSD) at ${stableToken.address}`) + expect(proposal.sellAmount).toEqBigNumber(sellAmount) + expect(proposal.buyAmount).toEqBigNumber(new BigNumber('99000000')) + expect(proposal.approvalTimestamp).toEqual(new BigNumber(0)) + expect(proposal.state).toEqual('Proposed') + expect(proposal.sellCelo).toEqual(true) + expect(proposal.implictPricePerCelo).toEqBigNumber(new BigNumber('0.99')) + }) + + it('cancels proposal', async () => { + await grandaMento.cancelExchangeProposal(1).sendAndWaitForReceipt() + + const proposal = await grandaMento.getExchangeProposal('1') + expect(proposal.state).toEqual(ExchangeProposalState.Cancelled) + }) + }) + }) + + it('#getConfig', async () => { + const config = await grandaMento.getConfig() + expect(config.approver).toBe(expConfig.approver) + expect(config.spread).toEqBigNumber(expConfig.spread) + expect(config.maxApprovalExchangeRateChange).toEqBigNumber( + expConfig.maxApprovalExchangeRateChange + ) + expect(config.vetoPeriodSeconds).toEqBigNumber(expConfig.vetoPeriodSeconds) + expect( + config.exchangeLimits.get(kit.celoTokens.getContract(StableToken.cUSD))?.minExchangeAmount + ).toEqBigNumber(new BigNumber(0)) + expect( + config.exchangeLimits.get(kit.celoTokens.getContract(StableToken.cUSD))?.maxExchangeAmount + ).toEqBigNumber(new BigNumber(0)) + expect( + config.exchangeLimits.get(kit.celoTokens.getContract(StableToken.cEUR))?.minExchangeAmount + ).toEqBigNumber(new BigNumber(0)) + expect( + config.exchangeLimits.get(kit.celoTokens.getContract(StableToken.cEUR))?.maxExchangeAmount + ).toEqBigNumber(new BigNumber(0)) + }) + + describe('#getBuyAmount', () => { + it('gets the buy amount', async () => { + const oracleRate = 1 + const hypotheticalSellAmount = toFixed(1) + expect( + await grandaMento.getBuyAmount(toFixed(oracleRate), hypotheticalSellAmount, true) + ).toEqBigNumber( + hypotheticalSellAmount + .times(oracleRate) + .times(new BigNumber(1).minus(await grandaMento.spread())) + ) + }) + }) +}) diff --git a/packages/sdk/contractkit/src/wrappers/GrandaMento.ts b/packages/sdk/contractkit/src/wrappers/GrandaMento.ts new file mode 100644 index 00000000000..591ef31ae7a --- /dev/null +++ b/packages/sdk/contractkit/src/wrappers/GrandaMento.ts @@ -0,0 +1,233 @@ +import { GrandaMento } from '@celo/abis/web3/mento/GrandaMento' +import { newStableToken } from '@celo/abis/web3/mento/StableToken' +import BigNumber from 'bignumber.js' +import { StableTokenContract } from '../base' +import { StableToken as StableTokenEnum, stableTokenInfos } from '../celo-tokens' +import { + BaseWrapper, + fixidityValueToBigNumber, + proxyCall, + proxySend, + valueToBigNumber, +} from './BaseWrapper' +import { StableTokenWrapper } from './StableTokenWrapper' + +export enum ExchangeProposalState { + None, + Proposed, + Approved, + Executed, + Cancelled, +} + +export interface GrandaMentoConfig { + approver: string + spread: BigNumber + vetoPeriodSeconds: BigNumber + maxApprovalExchangeRateChange: BigNumber + exchangeLimits: AllStableConfig +} + +export interface StableTokenExchangeLimits { + minExchangeAmount: BigNumber + maxExchangeAmount: BigNumber +} + +export interface ExchangeProposal { + exchanger: string + stableToken: string + sellAmount: BigNumber + buyAmount: BigNumber + vetoPeriodSeconds: BigNumber + approvalTimestamp: BigNumber + state: ExchangeProposalState + sellCelo: boolean + id: string | number +} + +export interface ExchangeProposalReadable { + exchanger: string + stableToken: string + sellAmount: BigNumber + buyAmount: BigNumber + approvalTimestamp: BigNumber + state: string + sellCelo: boolean + id: string | number + implictPricePerCelo: BigNumber +} + +type AllStableConfig = Map + +export class GrandaMentoWrapper extends BaseWrapper { + owner = proxyCall(this.contract.methods.owner) + + approver = proxyCall(this.contract.methods.approver) + setApprover = proxySend(this.connection, this.contract.methods.setApprover) + + maxApprovalExchangeRateChange = proxyCall( + this.contract.methods.maxApprovalExchangeRateChange, + undefined, + fixidityValueToBigNumber + ) + setMaxApprovalExchangeRateChange = proxySend( + this.connection, + this.contract.methods.setMaxApprovalExchangeRateChange + ) + + spread = proxyCall(this.contract.methods.spread, undefined, fixidityValueToBigNumber) + setSpread = proxySend(this.connection, this.contract.methods.setSpread) + + vetoPeriodSeconds = proxyCall( + this.contract.methods.vetoPeriodSeconds, + undefined, + valueToBigNumber + ) + setVetoPeriodSeconds = proxySend(this.connection, this.contract.methods.setVetoPeriodSeconds) + + exchangeProposalCount = proxyCall( + this.contract.methods.exchangeProposalCount, + undefined, + valueToBigNumber + ) + + async getActiveProposalIds() { + const unfilteredIds = await this.contract.methods.getActiveProposalIds().call() + // '0' is given to signify an ID that is no longer active, so we filter them out. + return unfilteredIds.filter((id) => id !== '0') + } + + setStableTokenExchangeLimits = proxySend( + this.connection, + this.contract.methods.setStableTokenExchangeLimits + ) + + approveExchangeProposal = proxySend( + this.connection, + this.contract.methods.approveExchangeProposal + ) + + executeExchangeProposal = proxySend( + this.connection, + this.contract.methods.executeExchangeProposal + ) + cancelExchangeProposal = proxySend(this.connection, this.contract.methods.cancelExchangeProposal) + + async createExchangeProposal( + stableTokenRegistryId: StableTokenContract, + sellAmount: BigNumber, + sellCelo: boolean + ) { + const createExchangeProposalInner = proxySend( + this.connection, + this.contract.methods.createExchangeProposal + ) + return createExchangeProposalInner(stableTokenRegistryId, sellAmount.toFixed(), sellCelo) + } + + async exchangeProposalExists(exchangeProposalID: string | number) { + const result = await this.contract.methods.exchangeProposals(exchangeProposalID).call() + const state = parseInt(result.state, 10) + return !(state === ExchangeProposalState.None) + } + + async getExchangeProposal(exchangeProposalID: string | number): Promise { + const result = await this.contract.methods.exchangeProposals(exchangeProposalID).call() + const state = parseInt(result.state, 10) + + if (state === ExchangeProposalState.None) { + throw new Error("Proposal doesn't exist") + } + + return { + exchanger: result.exchanger, + stableToken: result.stableToken, + sellAmount: new BigNumber(result.sellAmount), + buyAmount: new BigNumber(result.buyAmount), + vetoPeriodSeconds: new BigNumber(result.vetoPeriodSeconds), + approvalTimestamp: new BigNumber(result.approvalTimestamp), + sellCelo: result.sellCelo, + state, + id: exchangeProposalID, + } + } + + async getHumanReadableExchangeProposal( + exchangeProposalID: string | number + ): Promise { + const proposal = await this.getExchangeProposal(exchangeProposalID) + + const stableTokenContract = new StableTokenWrapper( + this.connection, + newStableToken(this.connection.web3, proposal.stableToken) + ) + + return { + ...proposal, + stableToken: `${await stableTokenContract.name()} (${await stableTokenContract.symbol()}) at ${ + proposal.stableToken + }`, + implictPricePerCelo: proposal.sellCelo + ? proposal.buyAmount.div(proposal.sellAmount) + : proposal.sellAmount.div(proposal.buyAmount), + state: ExchangeProposalState[proposal.state], + } + } + + async stableTokenExchangeLimits( + stableTokenSymbol: StableTokenEnum + ): Promise { + const stableTokenRegistryId = stableTokenInfos[stableTokenSymbol].contract + const result = await this.contract.methods + .stableTokenExchangeLimits(stableTokenRegistryId.toString()) + .call() + return { + minExchangeAmount: new BigNumber(result.minExchangeAmount), + maxExchangeAmount: new BigNumber(result.maxExchangeAmount), + } + } + + async getAllStableTokenLimits(): Promise { + const out: AllStableConfig = new Map() + + const res = await Promise.all( + Object.values(StableTokenEnum).map((key) => this.stableTokenExchangeLimits(key)) + ) + + Object.values(StableTokenEnum).map((key, index) => + out.set(stableTokenInfos[key].contract, res[index]) + ) + + return out + } + + async getBuyAmount( + celoStableTokenOracleRate: BigNumber, // Note this is intended to be a fixed point number + sellAmount: BigNumber, + sellCelo: boolean + ): Promise { + const result = await this.contract.methods + .getBuyAmount(celoStableTokenOracleRate.toFixed(), sellAmount.toFixed(), sellCelo) + .call() + return new BigNumber(result) + } + + async getConfig(): Promise { + const res = await Promise.all([ + this.approver(), + this.spread(), + this.vetoPeriodSeconds(), + this.maxApprovalExchangeRateChange(), + this.getAllStableTokenLimits(), + ]) + return { + approver: res[0], + spread: res[1], + vetoPeriodSeconds: res[2], + maxApprovalExchangeRateChange: res[3], + exchangeLimits: res[4], + } + } +} + +export type GrandaMentoWrapperType = GrandaMentoWrapper diff --git a/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.test.ts b/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.test.ts new file mode 100644 index 00000000000..a231d601e79 --- /dev/null +++ b/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.test.ts @@ -0,0 +1,266 @@ +import { Address } from '@celo/base/lib/address' +import { Signature } from '@celo/base/lib/signatureUtils' +import MTWContractArtifacts from '@celo/celo-devchain/contracts/contracts-0.5/MetaTransactionWallet.json' +import { testWithGanache } from '@celo/dev-utils/lib/ganache-test' +import { generateTypedDataHash } from '@celo/utils/lib/sign-typed-data-utils' +import { bufferToHex } from '@ethereumjs/util' +import BigNumber from 'bignumber.js' +import { newKitFromWeb3 } from '../kit' +import { GoldTokenWrapper } from './GoldTokenWrapper' +import { + buildMetaTxTypedData, + MetaTransactionWalletWrapper, + RawTransaction, + toRawTransaction, +} from './MetaTransactionWallet' + +const contract = require('@truffle/contract') +const MetaTransactionWallet = contract(MTWContractArtifacts) + +testWithGanache('MetaTransactionWallet Wrapper', (web3) => { + MetaTransactionWallet.setProvider(web3.currentProvider) + + const deployWallet = async (deployer: Address, signer: Address): Promise
=> { + const instance = await MetaTransactionWallet.new(true, { from: deployer }) + await instance.initialize(signer, { from: deployer }) + return instance.address + } + + // Ganache returns 1 in chainId assembly code + const chainId = 1 + const kit = newKitFromWeb3(web3) + let accounts: Address[] + let walletDeployer: Address + let walletSigner: Address + let wallet: MetaTransactionWalletWrapper + let gold: GoldTokenWrapper + let emptyAccounts: Address[] + let rando: Address + + beforeAll(async () => { + accounts = await web3.eth.getAccounts() + walletDeployer = accounts[0] + walletSigner = accounts[1] + kit.defaultAccount = walletSigner + rando = accounts[2] + gold = await kit.contracts.getGoldToken() + }) + + beforeEach(async () => { + const walletAddress = await deployWallet(walletDeployer, walletSigner) + wallet = await kit.contracts.getMetaTransactionWallet(walletAddress) + // Ganache returns 1 in chainId assembly code + // @ts-ignore + wallet.chainId = () => Promise.resolve(chainId) + + // Give the wallet some funds + await gold.transfer(wallet.address, new BigNumber(20e18).toFixed()).sendAndWaitForReceipt() + emptyAccounts = [0, 0, 0, 0, 0].map(() => web3.utils.randomHex(20)) + }) + + describe('#executeTransaction', () => { + describe('as a rando', () => { + it('reverts', async () => { + expect.assertions(1) + await expect( + wallet + .executeTransaction(gold.transfer(emptyAccounts[0], 10000).txo) + .sendAndWaitForReceipt({ from: rando }) + ).rejects.toThrow(/Invalid transaction sender/) + }) + }) + + describe('as the signer', () => { + it('can call contracts', async () => { + const value = new BigNumber(1e18) + const result = await wallet + .executeTransaction(gold.transfer(emptyAccounts[0], value.toFixed()).txo) + .sendAndWaitForReceipt() + expect(result.status).toBe(true) + expect(await gold.balanceOf(emptyAccounts[0])).toEqual(value) + }) + }) + }) + + describe('#executeTransactions', () => { + describe('as a rando', () => { + it('reverts', async () => { + expect.assertions(1) + await expect( + wallet + .executeTransactions([ + gold.transfer(emptyAccounts[0], 1000).txo, + gold.transfer(emptyAccounts[1], 1000).txo, + ]) + .sendAndWaitForReceipt({ from: rando }) + ).rejects.toThrow(/Invalid transaction sender/) + }) + }) + + describe('as the signer', () => { + it('can execute transactions', async () => { + const walletBalanceBefore = await gold.balanceOf(wallet.address) + const value = new BigNumber(1e18) + const result = await wallet + .executeTransactions([ + gold.transfer(emptyAccounts[0], value.toFixed()).txo, + gold.transfer(emptyAccounts[1], value.toFixed()).txo, + ]) + .sendAndWaitForReceipt() + expect(result.status).toBe(true) + + expect(await gold.balanceOf(wallet.address)).toEqual( + walletBalanceBefore.minus(value.times(2)) + ) + expect(await gold.balanceOf(emptyAccounts[0])).toEqual(value) + expect(await gold.balanceOf(emptyAccounts[1])).toEqual(value) + }) + }) + }) + + describe('#getMetaTransactionDigest', () => { + it('should match the digest created off-chain', async () => { + const metaTransfer = gold.transfer(emptyAccounts[0], 1000).txo + const onChainDigest = await wallet.getMetaTransactionDigest(metaTransfer, 0) + const typedData = buildMetaTxTypedData( + wallet.address, + toRawTransaction(metaTransfer), + 0, + chainId + ) + const offChainDigest = bufferToHex(generateTypedDataHash(typedData)) + + expect(onChainDigest).toEqual(offChainDigest) + }) + }) + + describe('#getMetaTransactionSigner', () => { + it('should match what is signed off-chain', async () => { + const metaTransfer = gold.transfer(emptyAccounts[0], 1000000).txo + const signature = await wallet.signMetaTransaction(metaTransfer, 0) + const signer = await wallet.getMetaTransactionSigner(metaTransfer, 0, signature) + expect(signer).toEqual(walletSigner) + }) + }) + + describe('#signMetaTransaction', () => { + describe('with an unlocked account', () => { + it('returns a signature', async () => { + const signature = await wallet.signMetaTransaction( + gold.transfer(emptyAccounts[0], 1000).txo + ) + expect(signature).toBeDefined() + }) + }) + }) + + describe('#executeMetaTransaction', () => { + describe('as a rando', () => { + it('can execute transactions', async () => { + const walletBalanceBefore = await gold.balanceOf(wallet.address) + const value = new BigNumber(1e18) + + const metaTransfer = gold.transfer(emptyAccounts[0], value.toFixed()).txo + const signature = await wallet.signMetaTransaction(metaTransfer) + + const result = await wallet + .executeMetaTransaction(metaTransfer, signature) + .sendAndWaitForReceipt({ from: rando }) + expect(result.status).toBe(true) + + expect(await gold.balanceOf(emptyAccounts[0])).toEqual(value) + expect(await gold.balanceOf(wallet.address)).toEqual(walletBalanceBefore.minus(value)) + }) + + it('can batch transactions as a call to self', async () => { + const walletBalanceBefore = await gold.balanceOf(wallet.address) + const value = new BigNumber(1e18) + const metaBatch = wallet.executeTransactions([ + gold.transfer(emptyAccounts[0], value.toFixed()).txo, + gold.transfer(emptyAccounts[1], value.toFixed()).txo, + gold.transfer(emptyAccounts[2], value.toFixed()).txo, + ]).txo + + const signature = await wallet.signMetaTransaction(metaBatch, 0) + const result = await wallet + .executeMetaTransaction(metaBatch, signature) + .sendAndWaitForReceipt({ from: rando }) + expect(result.status).toBe(true) + + expect(await gold.balanceOf(wallet.address)).toEqual( + walletBalanceBefore.minus(value.times(3)) + ) + for (let i = 0; i < 3; i++) { + expect(await gold.balanceOf(emptyAccounts[i])).toEqual(value) + } + }) + }) + + describe('when passed over the wire', () => { + it('can hydrate and execute directly', async () => { + const walletBalanceBefore = await gold.balanceOf(wallet.address) + const value = new BigNumber(1e18) + const metaTx = wallet.executeTransactions([ + gold.transfer(emptyAccounts[0], value.toFixed()).txo, + gold.transfer(emptyAccounts[1], value.toFixed()).txo, + gold.transfer(emptyAccounts[2], value.toFixed()).txo, + ]).txo + const signature = await wallet.signMetaTransaction(metaTx, 0) + const rawTx = toRawTransaction(metaTx) + const payload = JSON.stringify({ rawTx, signature }) + // Now we're somewhere else: + const resp: { rawTx: RawTransaction; signature: Signature } = JSON.parse(payload) + const result = await wallet + .executeMetaTransaction(resp.rawTx, resp.signature) + .sendAndWaitForReceipt({ from: rando }) + expect(result.status).toBe(true) + + expect(await gold.balanceOf(wallet.address)).toEqual( + walletBalanceBefore.minus(value.times(3)) + ) + for (let i = 0; i < 3; i++) { + expect(await gold.balanceOf(emptyAccounts[i])).toEqual(value) + } + }) + }) + }) + + describe('#signAndExecuteMetaTransaction', () => { + describe('as a rando', () => { + it('can execute transactions', async () => { + const walletBalanceBefore = await gold.balanceOf(wallet.address) + const value = new BigNumber(1e18) + + const metaTransfer = gold.transfer(emptyAccounts[0], value.toFixed()).txo + const tx = await wallet.signAndExecuteMetaTransaction(metaTransfer) + const result = await tx.sendAndWaitForReceipt({ from: rando }) + expect(result.status).toBe(true) + + expect(await gold.balanceOf(emptyAccounts[0])).toEqual(value) + expect(await gold.balanceOf(wallet.address)).toEqual(walletBalanceBefore.minus(value)) + }) + + it('can batch transactions as a call to self', async () => { + const walletBalanceBefore = await gold.balanceOf(wallet.address) + const value = new BigNumber(1e18) + + const tx = await wallet.signAndExecuteMetaTransaction( + wallet.executeTransactions([ + gold.transfer(emptyAccounts[0], value.toFixed()).txo, + gold.transfer(emptyAccounts[1], value.toFixed()).txo, + gold.transfer(emptyAccounts[2], value.toFixed()).txo, + ]).txo + ) + const result = await tx.sendAndWaitForReceipt({ from: rando }) + expect(result.status).toBe(true) + + expect(await gold.balanceOf(wallet.address)).toEqual( + walletBalanceBefore.minus(value.times(3)) + ) + for (let i = 0; i < 3; i++) { + expect(await gold.balanceOf(emptyAccounts[i])).toEqual(value) + } + }) + }) + }) +}) diff --git a/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts b/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts new file mode 100644 index 00000000000..fa38d5d229c --- /dev/null +++ b/packages/sdk/contractkit/src/wrappers/MetaTransactionWallet.ts @@ -0,0 +1,313 @@ +import { MetaTransactionWallet } from '@celo/abis/web3/MetaTransactionWallet' +import { Address, ensureLeading0x, trimLeading0x } from '@celo/base/lib/address' +import { Signature } from '@celo/base/lib/signatureUtils' +import { CeloTransactionObject, CeloTxObject, toTransactionObject } from '@celo/connect' +import { EIP712TypedData } from '@celo/utils/lib/sign-typed-data-utils' +import BigNumber from 'bignumber.js' +import { + BaseWrapper, + proxyCall, + proxySend, + stringIdentity, + valueToInt, + valueToString, +} from './BaseWrapper' + +export interface TransactionObjectWithValue { + txo: CeloTxObject + value: BigNumber.Value +} + +export interface RawTransaction { + destination: string + value: string + data: string +} + +export type TransactionInput = CeloTxObject | TransactionObjectWithValue | RawTransaction + +/** + * Class that wraps the MetaTransactionWallet + * @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 + */ +export class MetaTransactionWalletWrapper extends BaseWrapper { + /** + * Execute a transaction originating from the MTW + * Reverts if the caller is not a signer + * @param tx a TransactionInput + * @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 + */ + public executeTransaction(tx: TransactionInput): CeloTransactionObject { + const rawTx = toRawTransaction(tx) + return toTransactionObject( + this.connection, + this.contract.methods.executeTransaction(rawTx.destination, rawTx.value, rawTx.data) + ) + } + + /** + * Execute a batch of transactions originating from the MTW + * Reverts if the caller is not a signer + * @param txs An array of TransactionInput + * @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 + */ + public executeTransactions( + txs: Array> + ): CeloTransactionObject<{ 0: string; 1: string[] }> { + const { destinations, values, callData, callDataLengths } = toTransactionBatch(txs) + + return toTransactionObject( + this.connection, + this.contract.methods.executeTransactions(destinations, values, callData, callDataLengths) + ) + } + + /** + * Execute a signed meta transaction + * Reverts if meta-tx signer is not a signer for the wallet + * @param tx a TransactionInput + * @param signature a Signature + * @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 + */ + public executeMetaTransaction( + tx: TransactionInput, + signature: Signature + ): CeloTransactionObject { + const rawTx = toRawTransaction(tx) + + return toTransactionObject( + this.connection, + this.contract.methods.executeMetaTransaction( + rawTx.destination, + rawTx.value, + rawTx.data, + signature.v, + signature.r, + signature.s + ) + ) + } + + /** + * Signs a meta transaction as EIP712 typed data + * @param tx a TransactionWrapper + * @param nonce Optional -- will query contract state if not passed + * @returns signature a Signature + * @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 + */ + public async signMetaTransaction(tx: TransactionInput, nonce?: number): Promise { + if (nonce === undefined) { + nonce = await this.nonce() + } + const typedData = buildMetaTxTypedData( + this.address, + toRawTransaction(tx), + nonce, + await this.chainId() + ) + const signer = await this.signer() + return this.connection.signTypedData(signer, typedData) + } + + /** + * Execute a signed meta transaction + * Reverts if meta-tx signer is not a signer for the wallet + * @param tx a TransactionInput + * @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 + */ + public async signAndExecuteMetaTransaction( + tx: TransactionInput + ): Promise> { + const signature = await this.signMetaTransaction(tx) + return this.executeMetaTransaction(tx, signature) + } + + private getMetaTransactionDigestParams = ( + tx: TransactionInput, + nonce: number + ): [string, string, string, number] => { + const rawTx = toRawTransaction(tx) + return [rawTx.destination, rawTx.value, rawTx.data, nonce] + } + /* + * @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 + */ + getMetaTransactionDigest = proxyCall( + this.contract.methods.getMetaTransactionDigest, + this.getMetaTransactionDigestParams, + stringIdentity + ) + + private getMetaTransactionSignerParams = ( + tx: TransactionInput, + nonce: number, + signature: Signature + ): [string, string, string, number, number, string, string] => { + const rawTx = toRawTransaction(tx) + return [ + rawTx.destination, + rawTx.value, + rawTx.data, + nonce, + signature.v, + signature.r, + signature.s, + ] + } + /* + * @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 + */ + getMetaTransactionSigner = proxyCall( + this.contract.methods.getMetaTransactionSigner, + this.getMetaTransactionSignerParams, + stringIdentity + ) + /* + * @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 + */ + eip712DomainSeparator = proxyCall(this.contract.methods.eip712DomainSeparator) + /* + * @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 + */ + isOwner = proxyCall(this.contract.methods.isOwner) + /* + * @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 + */ + nonce = proxyCall(this.contract.methods.nonce, undefined, valueToInt) + private getSigner = proxyCall(this.contract.methods.signer, undefined, stringIdentity) + + /* + * @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 + */ + transferOwnership: (newOwner: Address) => CeloTransactionObject = proxySend( + this.connection, + this.contract.methods.transferOwnership + ) + /* + * @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 + */ + setSigner: (newSigner: Address) => CeloTransactionObject = proxySend( + this.connection, + this.contract.methods.setSigner + ) + /* + * @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 + */ + setEip712DomainSeparator: () => CeloTransactionObject = proxySend( + this.connection, + this.contract.methods.setEip712DomainSeparator + ) + + /** + * Get and cache the chain ID -- assume it's static for a kit instance + * @returns chainId + */ + _chainId?: number + private async chainId(): Promise { + this._chainId = this._chainId ?? (await this.connection.chainId()) + if (this._chainId === undefined) { + this._chainId = await this.connection.chainId() + } + return this._chainId! + } + + /** + * Get an cache the signer - it should be static for a Wallet instance + * @returns signer + */ + _signer?: Address + public async signer() { + if (this._signer === undefined) { + this._signer = await this.getSigner() + } + return this._signer + } +} + +export type MetaTransactionWalletWrapperType = MetaTransactionWalletWrapper + +/** + * Turns any possible way to pass in a transaction into the raw values + * that are actually required. This is used both internally to normalize + * ways in which transactions are passed in but also public in order + * for one instance of ContractKit to serialize a meta transaction to + * send over the wire and be consumed somewhere else. + * @param tx TransactionInput union of all the ways we expect transactions + * @returns a RawTransactions that's serializable + */ +export const toRawTransaction = (tx: TransactionInput): RawTransaction => { + if ('destination' in tx) { + return tx + } else if ('value' in tx) { + return { + destination: tx.txo._parent.options.address, + data: tx.txo.encodeABI(), + value: valueToString(tx.value), + } + } else { + return { + destination: tx._parent.options.address, + data: tx.encodeABI(), + value: '0', + } + } +} + +/** + * Turns an array of transaction inputs into the argument that + * need to be passed to the executeTransactions call. + * Main transformation is that all the `data` parts of each + * transaction in the batch are concatenated and an array + * of lengths is constructed. + * This is a gas optimisation on the contract. + * @param txs Array> array of txs + * @returns Params for the executeTransactions method call + */ +export const toTransactionBatch = ( + txs: Array> +): { + destinations: string[] + values: string[] + callData: string + callDataLengths: number[] +} => { + const rawTxs: RawTransaction[] = txs.map(toRawTransaction) + return { + destinations: rawTxs.map((rtx) => rtx.destination), + values: rawTxs.map((rtx) => rtx.value), + callData: ensureLeading0x(rawTxs.map((rtx) => trimLeading0x(rtx.data)).join('')), + callDataLengths: rawTxs.map((rtx) => trimLeading0x(rtx.data).length / 2), + } +} + +export const buildMetaTxTypedData = ( + walletAddress: Address, + tx: RawTransaction, + nonce: number, + chainId: number +): EIP712TypedData => { + return { + types: { + EIP712Domain: [ + { name: 'name', type: 'string' }, + { name: 'version', type: 'string' }, + { name: 'chainId', type: 'uint256' }, + { name: 'verifyingContract', type: 'address' }, + ], + ExecuteMetaTransaction: [ + { name: 'destination', type: 'address' }, + { name: 'value', type: 'uint256' }, + { name: 'data', type: 'bytes' }, + { name: 'nonce', type: 'uint256' }, + ], + }, + primaryType: 'ExecuteMetaTransaction', + domain: { + name: 'MetaTransactionWallet', + version: '1.1', + chainId, + verifyingContract: walletAddress, + }, + message: tx ? { ...tx, nonce } : {}, + } +} diff --git a/packages/sdk/contractkit/src/wrappers/MetaTransactionWalletDeployer.test.ts b/packages/sdk/contractkit/src/wrappers/MetaTransactionWalletDeployer.test.ts new file mode 100644 index 00000000000..e23271ea481 --- /dev/null +++ b/packages/sdk/contractkit/src/wrappers/MetaTransactionWalletDeployer.test.ts @@ -0,0 +1,91 @@ +import { Address, normalizeAddress } from '@celo/base' +import MTWContractArtifacts from '@celo/celo-devchain/contracts/contracts-0.5/MetaTransactionWallet.json' +import MTWDeployerContractArtifacts from '@celo/celo-devchain/contracts/contracts-0.5/MetaTransactionWalletDeployer.json' +import { CeloTxReceipt, EventLog } from '@celo/connect' +import { testWithGanache } from '@celo/dev-utils/lib/ganache-test' +import { + MetaTransactionWallet, + newMetaTransactionWallet, +} from '@celo/abis/web3/MetaTransactionWallet' +import { newProxy } from '@celo/abis/web3/Proxy' +import { newKitFromWeb3 } from '../kit' +import { MetaTransactionWalletDeployerWrapper } from './MetaTransactionWalletDeployer' + +const contract = require('@truffle/contract') +const MetaTransactionWalletDeployer = contract(MTWDeployerContractArtifacts) +const MetaTransactionWallet = contract(MTWContractArtifacts) + +testWithGanache('MetaTransactionWallet Wrapper', (web3) => { + MetaTransactionWalletDeployer.setProvider(web3.currentProvider) + MetaTransactionWallet.setProvider(web3.currentProvider) + + const deployImplementation = async (from: Address) => { + const impl = await MetaTransactionWallet.new(true, { from }) + return impl.address + } + + const deployWalletDeployer = async (from: Address): Promise
=> { + const instance = await MetaTransactionWalletDeployer.new({ from }) + return instance.address + } + + const kit = newKitFromWeb3(web3) + let accounts: Address[] + let walletDeployerOwner: Address + let walletDeployer: MetaTransactionWalletDeployerWrapper + let implementation: MetaTransactionWallet + let rando: Address + let beneficiary: Address + + beforeAll(async () => { + accounts = await web3.eth.getAccounts() + walletDeployerOwner = accounts[0] + rando = accounts[1] + kit.defaultAccount = walletDeployerOwner + beneficiary = web3.utils.randomHex(20) + implementation = newMetaTransactionWallet(web3, await deployImplementation(accounts[0])) + }) + + beforeEach(async () => { + const walletDeployerAddress = await deployWalletDeployer(walletDeployerOwner) + walletDeployer = await kit.contracts.getMetaTransactionWalletDeployer(walletDeployerAddress) + }) + + describe('#deploy', () => { + let result: CeloTxReceipt + let walletDeployedEvent: EventLog | undefined + + beforeEach(async () => { + result = await walletDeployer + .deploy( + beneficiary, + implementation.options.address, + implementation.methods.initialize(beneficiary).encodeABI() + ) + .sendAndWaitForReceipt({ + from: rando, + }) + + walletDeployedEvent = result.events?.WalletDeployed + }) + + it('deploys a new contract', async () => { + expect(walletDeployedEvent).toBeDefined() + const values: { owner: string; implementation: string } = walletDeployedEvent?.returnValues + expect(values.owner.toLocaleLowerCase()).toEqual(beneficiary) + expect(values.implementation).toEqual(implementation.options.address) + }) + + it('sets the beneficiary as the signer to the wallet', async () => { + const wallet = newMetaTransactionWallet(web3, walletDeployedEvent?.returnValues.wallet) + const signer = await wallet.methods.signer().call() + expect(signer.toLocaleLowerCase()).toEqual(beneficiary) + }) + + it('sets the right implementation', async () => { + const proxy = newProxy(web3, walletDeployedEvent?.returnValues.wallet) + const impl = await proxy.methods._getImplementation().call() + expect(normalizeAddress(impl)).toEqual(normalizeAddress(implementation.options.address)) + }) + }) +}) diff --git a/packages/sdk/contractkit/src/wrappers/MetaTransactionWalletDeployer.ts b/packages/sdk/contractkit/src/wrappers/MetaTransactionWalletDeployer.ts new file mode 100644 index 00000000000..4cbc46da035 --- /dev/null +++ b/packages/sdk/contractkit/src/wrappers/MetaTransactionWalletDeployer.ts @@ -0,0 +1,14 @@ +import { MetaTransactionWalletDeployer } from '@celo/abis/web3/MetaTransactionWalletDeployer' +import { BaseWrapper, proxySend } from './BaseWrapper' + +/* + * @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 + */ +export class MetaTransactionWalletDeployerWrapper extends BaseWrapper { + /* + * @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 + */ + deploy = proxySend(this.connection, this.contract.methods.deploy) +} + +export type MetaTransactionWalletDeployerWrapperType = MetaTransactionWalletDeployerWrapper diff --git a/packages/sdk/explorer/CHANGELOG.md b/packages/sdk/explorer/CHANGELOG.md index 4de2a883dff..7b216095dec 100644 --- a/packages/sdk/explorer/CHANGELOG.md +++ b/packages/sdk/explorer/CHANGELOG.md @@ -1,5 +1,12 @@ # @celo/explorer +## 5.0.7-beta.0 + +### Patch Changes + +- Updated dependencies [1c9c844cf] + - @celo/contractkit@6.0.0-beta.0 + ## 5.0.6 ### Patch Changes diff --git a/packages/sdk/explorer/package.json b/packages/sdk/explorer/package.json index 1022553a2cd..840930013ee 100644 --- a/packages/sdk/explorer/package.json +++ b/packages/sdk/explorer/package.json @@ -1,6 +1,6 @@ { "name": "@celo/explorer", - "version": "5.0.6", + "version": "5.0.7-beta.0", "description": "Celo's block explorer consumer", "main": "./lib/index.js", "types": "./lib/index.d.ts", @@ -24,7 +24,7 @@ "dependencies": { "@celo/base": "^6.0.0", "@celo/connect": "^5.1.1", - "@celo/contractkit": "^5.2.0", + "@celo/contractkit": "^6.0.0-beta.0", "@celo/utils": "^5.0.6", "@types/debug": "^4.1.5", "cross-fetch": "3.0.6", diff --git a/packages/sdk/governance/CHANGELOG.md b/packages/sdk/governance/CHANGELOG.md index 5e0e1926e4a..1c55ab4a0c0 100644 --- a/packages/sdk/governance/CHANGELOG.md +++ b/packages/sdk/governance/CHANGELOG.md @@ -1,5 +1,29 @@ # @celo/governance +## 5.0.7-beta.2 + +### Patch Changes + +- 444db6de9: Turn back on parallel registry updating for governance proposal views +- Updated dependencies [9ab9d00eb] +- Updated dependencies [9ab9d00eb] + - @celo/contractkit@6.0.0-beta.1 + +## 5.0.7-beta.1 + +### Patch Changes + +- e4da5a7a8: Add textual feedback about parsing proposal + +## 5.0.7-beta.0 + +### Patch Changes + +- 86bbfddf1: Fix Proposal View Regression when it includes proxy updates +- Updated dependencies [1c9c844cf] + - @celo/contractkit@6.0.0-beta.0 + - @celo/explorer@5.0.7-beta.0 + ## 5.0.6 ### Patch Changes diff --git a/packages/sdk/governance/package.json b/packages/sdk/governance/package.json index cdac59af85b..82dfa3866d6 100644 --- a/packages/sdk/governance/package.json +++ b/packages/sdk/governance/package.json @@ -1,6 +1,6 @@ { "name": "@celo/governance", - "version": "5.0.6", + "version": "5.0.7-beta.2", "description": "Celo's governance proposals", "main": "./lib/index.js", "types": "./lib/index.d.ts", @@ -25,8 +25,8 @@ "@celo/base": "^6.0.0", "@celo/utils": "^5.0.6", "@celo/connect": "^5.1.1", - "@celo/contractkit": "^5.2.0", - "@celo/explorer": "^5.0.6", + "@celo/contractkit": "^6.0.0-beta.1", + "@celo/explorer": "^5.0.7-beta.0", "@ethereumjs/util": "8.0.5", "@types/debug": "^4.1.5", "@types/inquirer": "^6.5.0", diff --git a/packages/sdk/governance/src/proposals.ts b/packages/sdk/governance/src/proposals.ts index 29d9ba664b7..b3445699c20 100644 --- a/packages/sdk/governance/src/proposals.ts +++ b/packages/sdk/governance/src/proposals.ts @@ -134,10 +134,10 @@ export const proposalToJSON = async ( const updateRegistryMapping = async (name: CeloContract, address: Address) => { debug(`updating registry to reflect ${name} => ${address}`) + // this just sets the mapping in memory not anywhere like on chain or on a server await blockExplorer.updateContractDetailsMapping(stripProxy(name), address) } if (registryAdditions) { - // Update the registry mapping with registry additions prior to processing the proposal. await Promise.all( Object.keys(registryAdditions).map(async (nameStr) => { const name = nameStr as CeloContract @@ -151,75 +151,75 @@ export const proposalToJSON = async ( } const abiCoder = kit.connection.getAbiCoder() - const proposalJson: ProposalTransactionJSON[] = await Promise.all( - proposal.map(async (tx) => { - debug(`decoding tx ${JSON.stringify(tx)}`) - const parsedTx = await blockExplorer.tryParseTx(tx as CeloTxPending) - if (parsedTx == null) { - throw new Error(`Unable to parse ${JSON.stringify(tx)} with block explorer`) - } - if (isRegistryRepointRaw(abiCoder, tx) && parsedTx.callDetails.isCoreContract) { - const args = registryRepointRawArgs(abiCoder, tx) - await updateRegistryMapping(args.name, args.address) - } + const proposalJson: ProposalTransactionJSON[] = [] - const jsonTx: ProposalTransactionJSON = { - contract: parsedTx.callDetails.contract as CeloContract, - address: parsedTx.callDetails.contractAddress, - function: parsedTx.callDetails.function, - args: parsedTx.callDetails.argList, - params: parsedTx.callDetails.paramMap, - value: parsedTx.tx.value, - } + for (const tx of proposal) { + const parsedTx = await blockExplorer.tryParseTx(tx as CeloTxPending) + if (parsedTx == null) { + throw new Error(`Unable to parse ${JSON.stringify(tx)} with block explorer`) + } + if (isRegistryRepointRaw(abiCoder, tx) && parsedTx.callDetails.isCoreContract) { + const args = registryRepointRawArgs(abiCoder, tx) + await updateRegistryMapping(args.name, args.address) + } - if (isProxySetFunction(jsonTx)) { + const jsonTx: ProposalTransactionJSON = { + contract: parsedTx.callDetails.contract as CeloContract, + address: parsedTx.callDetails.contractAddress, + function: parsedTx.callDetails.function, + args: parsedTx.callDetails.argList, + params: parsedTx.callDetails.paramMap, + value: parsedTx.tx.value, + } + + if (isProxySetFunction(jsonTx)) { + jsonTx.contract = suffixProxy(jsonTx.contract) + await blockExplorer.setProxyOverride(tx.to!, jsonTx.args[0]) + } else if (isProxySetAndInitFunction(jsonTx)) { + await blockExplorer.setProxyOverride(tx.to!, jsonTx.args[0]) + let initAbi + if (parsedTx.callDetails.isCoreContract) { jsonTx.contract = suffixProxy(jsonTx.contract) - await blockExplorer.setProxyOverride(tx.to!, jsonTx.args[0]) - } else if (isProxySetAndInitFunction(jsonTx)) { - await blockExplorer.setProxyOverride(tx.to!, jsonTx.args[0]) - let initAbi - if (parsedTx.callDetails.isCoreContract) { - jsonTx.contract = suffixProxy(jsonTx.contract) - initAbi = getInitializeAbiOfImplementation(jsonTx.contract as any) - } else { - const implAddress = jsonTx.args[0] - const metadata = await fetchMetadata(kit.connection, implAddress) - if (metadata && metadata.abi) { - initAbi = metadata?.abiForMethod('initialize')[0] - } + initAbi = getInitializeAbiOfImplementation(jsonTx.contract as any) + } else { + const implAddress = jsonTx.args[0] + const metadata = await fetchMetadata(kit.connection, implAddress) + if (metadata && metadata.abi) { + initAbi = metadata?.abiForMethod('initialize')[0] } + } - if (initAbi !== undefined) { - // Transform delegate call initialize args into a readable params map - // 8 bytes for function sig - const initSig = trimLeading0x(jsonTx.args[1]).slice(0, 8) - const initArgs = trimLeading0x(jsonTx.args[1]).slice(8) + if (initAbi !== undefined) { + // Transform delegate call initialize args into a readable params map + // 8 bytes for function sig + const initSig = trimLeading0x(jsonTx.args[1]).slice(0, 8) + const initArgs = trimLeading0x(jsonTx.args[1]).slice(8) - const { params: initParams } = parseDecodedParams( - kit.connection.getAbiCoder().decodeParameters(initAbi.inputs!, initArgs) - ) - jsonTx.params![`initialize@${initSig}`] = initParams - } - } else if (isGovernanceConstitutionSetter(jsonTx)) { - const [address, functionId, threshold] = jsonTx.args - const contractMapping = await blockExplorer.getContractMappingWithSelector( - address, - functionId + const { params: initParams } = parseDecodedParams( + kit.connection.getAbiCoder().decodeParameters(initAbi.inputs!, initArgs) ) - if (contractMapping === undefined) { - throw new Error( - `Governance.setConstitution targets unknown address ${address} and function id ${functionId}` - ) - } - jsonTx.params![`setConstitution[${address}][${functionId}]`] = { - contract: contractMapping.details.name, - method: contractMapping.fnMapping.get(functionId)?.name, - threshold: fromFixed(new BigNumber(threshold)), - } + jsonTx.params![`initialize@${initSig}`] = initParams } - return jsonTx - }) - ) + } else if (isGovernanceConstitutionSetter(jsonTx)) { + const [address, functionId, threshold] = jsonTx.args + const contractMapping = await blockExplorer.getContractMappingWithSelector( + address, + functionId + ) + if (contractMapping === undefined) { + throw new Error( + `Governance.setConstitution targets unknown address ${address} and function id ${functionId}` + ) + } + jsonTx.params![`setConstitution[${address}][${functionId}]`] = { + contract: contractMapping.details.name, + method: contractMapping.fnMapping.get(functionId)?.name, + threshold: fromFixed(new BigNumber(threshold)), + } + } + console.info('.') + proposalJson.push(jsonTx) + } return proposalJson } diff --git a/packages/sdk/transactions-uri/package.json b/packages/sdk/transactions-uri/package.json index 3734be750a1..fef3af6585f 100644 --- a/packages/sdk/transactions-uri/package.json +++ b/packages/sdk/transactions-uri/package.json @@ -33,7 +33,7 @@ "devDependencies": { "@celo/celo-devchain": "^6.0.3", "@celo/dev-utils": "0.0.1", - "@celo/contractkit": "^5.2.0", + "@celo/contractkit": "^6.0.0-beta.0", "dotenv": "^8.2.0" }, "engines": { diff --git a/packages/sdk/wallets/wallet-rpc/package.json b/packages/sdk/wallets/wallet-rpc/package.json index 7b1afa5e8d7..c6bb66cf4c7 100644 --- a/packages/sdk/wallets/wallet-rpc/package.json +++ b/packages/sdk/wallets/wallet-rpc/package.json @@ -33,7 +33,7 @@ }, "devDependencies": { "@celo/dev-utils": "0.0.1", - "@celo/contractkit": "^5.2.0", + "@celo/contractkit": "^6.0.0-beta.0", "bn.js": "^5.1.0", "web3": "1.10.0" }, diff --git a/scripts/hooks/pre-push.js b/scripts/hooks/pre-push.js index 8596ef2de3a..3451db8a9df 100644 --- a/scripts/hooks/pre-push.js +++ b/scripts/hooks/pre-push.js @@ -63,10 +63,10 @@ function getDateFromFirstCommit(fromSHA, toSHA) { const remoteName = execSync('git remote').toString().trim() // create remote tracking branches to ensure we can compare current to origin/master -const remoteTrackingMasterBranches = execSync('git ls-remote --heads origin master') -if (remoteTrackingMasterBranches.toString().trim() === '') { - execSync('git fetch origin') -} +execSync('git ls-remote --heads origin master') + +execSync('git fetch origin') + const changes = process.env.HUSKY_GIT_STDIN.split('\n') .filter((line) => line !== '') .map((line) => { diff --git a/yarn.lock b/yarn.lock index 2c983b957c2..0065c47e7ba 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1002,6 +1002,26 @@ targz "^1.0.1" tmp "^0.2.1" +"@celo/contractkit@^5.1.0": + version "5.2.1" + resolved "https://registry.yarnpkg.com/@celo/contractkit/-/contractkit-5.2.1.tgz#55c98e0498c3f0b1a16abe0ebd0a7947931c7a9f" + integrity sha512-cqLZdJtstZNnZcD6yUzhAvLgwGJ1XNNT6gu+9ZG740Pda3maFtXzfSo1Sbg2aQ6U5ESCX3FqyWgWXg5EXr9TlA== + dependencies: + "@celo/base" "^6.0.0" + "@celo/connect" "^5.1.1" + "@celo/utils" "^5.0.6" + "@celo/wallet-local" "^5.1.1" + "@types/bn.js" "^5.1.0" + "@types/debug" "^4.1.5" + bignumber.js "^9.0.0" + cross-fetch "3.0.6" + debug "^4.1.1" + fp-ts "2.1.1" + io-ts "2.0.1" + semver "^7.3.5" + web3 "1.10.0" + web3-core-helpers "1.10.0" + "@celo/identity@^5.1.1": version "5.1.1" resolved "https://registry.yarnpkg.com/@celo/identity/-/identity-5.1.1.tgz#e56cea67d820c7deae147e50b353f3c76b3e6d4d"