From 2c0f6052eb3d470ad0c86882c52b658fd7f0540c Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Mon, 19 Feb 2024 15:14:44 -0800 Subject: [PATCH 01/10] wip: wip --- packages/hdwallet-coinbase/src/ethereum.ts | 2 +- packages/hdwallet-core/src/ethereum.ts | 4 +- packages/hdwallet-keepkey/src/ethereum.ts | 4 +- packages/hdwallet-ledger/src/ethereum.ts | 4 +- .../src/ethereum.ts | 2 +- packages/hdwallet-metamask/src/adapter.ts | 4 +- packages/hdwallet-metamask/src/ethereum.ts | 2 +- packages/hdwallet-native/package.json | 2 +- packages/hdwallet-native/src/ethereum.test.ts | 2 +- packages/hdwallet-native/src/util.ts | 18 +- packages/hdwallet-portis/src/ethereum.ts | 2 +- .../hdwallet-tallyho/src/ethereum.test.ts | 20 +- packages/hdwallet-tallyho/src/ethereum.ts | 2 +- packages/hdwallet-trezor/src/ethereum.ts | 2 +- packages/hdwallet-walletconnect/package.json | 2 +- .../hdwallet-walletconnect/src/ethereum.ts | 5 +- .../hdwallet-walletconnectV2/package.json | 2 +- .../hdwallet-walletconnectV2/src/ethereum.ts | 2 +- packages/hdwallet-xdefi/src/ethereum.ts | 2 +- yarn.lock | 502 +++--------------- 20 files changed, 124 insertions(+), 461 deletions(-) diff --git a/packages/hdwallet-coinbase/src/ethereum.ts b/packages/hdwallet-coinbase/src/ethereum.ts index 16bf4edce..348ce50e3 100644 --- a/packages/hdwallet-coinbase/src/ethereum.ts +++ b/packages/hdwallet-coinbase/src/ethereum.ts @@ -1,6 +1,6 @@ import * as core from "@shapeshiftoss/hdwallet-core"; import { ETHSignedMessage } from "@shapeshiftoss/hdwallet-core"; -import { isHexString } from "ethers/lib/utils"; +import { isHexString } from "ethers"; export function describeETHPath(path: core.BIP32Path): core.PathDescription { return core.describeETHPath(path); diff --git a/packages/hdwallet-core/src/ethereum.ts b/packages/hdwallet-core/src/ethereum.ts index a54e829a9..fe34782d5 100644 --- a/packages/hdwallet-core/src/ethereum.ts +++ b/packages/hdwallet-core/src/ethereum.ts @@ -1,5 +1,5 @@ -import { Bytes } from "@ethersproject/bytes"; import { TypedData } from "eip-712"; +import { BytesLike } from "ethers"; import { addressNListToBIP32, slip44ByCoin } from "./utils"; import { BIP32Path, HDWallet, HDWalletInfo, PathDescription } from "./wallet"; @@ -114,7 +114,7 @@ export interface ETHSignedTypedData { export interface ETHVerifyMessage { address: string; - message: string | Bytes; + message: BytesLike; signature: string; } diff --git a/packages/hdwallet-keepkey/src/ethereum.ts b/packages/hdwallet-keepkey/src/ethereum.ts index 4062cdfe1..797f8f61a 100644 --- a/packages/hdwallet-keepkey/src/ethereum.ts +++ b/packages/hdwallet-keepkey/src/ethereum.ts @@ -6,7 +6,7 @@ import * as Types from "@keepkey/device-protocol/lib/types_pb"; import { SignTypedDataVersion, TypedDataUtils } from "@metamask/eth-sig-util"; import * as core from "@shapeshiftoss/hdwallet-core"; import * as eip55 from "eip55"; -import { arrayify, isBytes, isHexString } from "ethers/lib/utils.js"; +import { getBytes, isBytes, isHexString } from "ethers"; import { Transport } from "./transport"; import { toUTF8Array } from "./utils"; @@ -176,7 +176,7 @@ export async function ethSignMessage(transport: Transport, msg: core.ETHSignMess if (!isHexString(message)) throw new Error("data is not an hex string"); const m = new Ethereum.EthereumSignMessage(); m.setAddressNList(addressNList); - const messageBytes = arrayify(message); + const messageBytes = getBytes(message); m.setMessage(messageBytes); const response = await transport.call(Messages.MessageType.MESSAGETYPE_ETHEREUMSIGNMESSAGE, m, { msgTimeout: core.LONG_TIMEOUT, diff --git a/packages/hdwallet-ledger/src/ethereum.ts b/packages/hdwallet-ledger/src/ethereum.ts index bb7ff5a2b..10a481b24 100644 --- a/packages/hdwallet-ledger/src/ethereum.ts +++ b/packages/hdwallet-ledger/src/ethereum.ts @@ -6,7 +6,7 @@ import EthereumTx from "ethereumjs-tx"; // @ts-ignore // TODO: fix ts-ignore import * as ethereumUtil from "ethereumjs-util"; -import { arrayify, isBytes } from "ethers/lib/utils.js"; +import { getBytes, isBytesLike } from "ethers"; import { isHexString } from "ethjs-util"; import { LedgerTransport } from "./transport"; @@ -189,7 +189,7 @@ export async function ethVerifyMessage(msg: core.ETHVerifyMessage): Promise { diff --git a/packages/hdwallet-metamask/src/adapter.ts b/packages/hdwallet-metamask/src/adapter.ts index a8f206bbc..5d4125b8e 100644 --- a/packages/hdwallet-metamask/src/adapter.ts +++ b/packages/hdwallet-metamask/src/adapter.ts @@ -1,7 +1,7 @@ import detectEthereumProvider from "@metamask/detect-provider"; import MetaMaskOnboarding from "@metamask/onboarding"; import * as core from "@shapeshiftoss/hdwallet-core"; -import { providers } from "ethers"; +import { Eip1193Provider } from "ethers"; import { MetaMaskHDWallet } from "./metamask"; @@ -27,7 +27,7 @@ export class MetaMaskAdapter { mustBeMetaMask: true, silent: false, timeout: 3000, - })) as providers.ExternalProvider | null; + })) as Eip1193Provider | null; if (!provider) { const onboarding = new MetaMaskOnboarding(); onboarding.startOnboarding(); diff --git a/packages/hdwallet-metamask/src/ethereum.ts b/packages/hdwallet-metamask/src/ethereum.ts index 3a6734e84..ed9f27adc 100644 --- a/packages/hdwallet-metamask/src/ethereum.ts +++ b/packages/hdwallet-metamask/src/ethereum.ts @@ -1,6 +1,6 @@ import * as core from "@shapeshiftoss/hdwallet-core"; import { ETHSignedMessage } from "@shapeshiftoss/hdwallet-core"; -import { isHexString } from "ethers/lib/utils"; +import { isHexString } from "ethers"; export function describeETHPath(path: core.BIP32Path): core.PathDescription { const pathStr = core.addressNListToBIP32(path); diff --git a/packages/hdwallet-native/package.json b/packages/hdwallet-native/package.json index 122d20de1..ed389d6fc 100644 --- a/packages/hdwallet-native/package.json +++ b/packages/hdwallet-native/package.json @@ -27,7 +27,7 @@ "bnb-javascript-sdk-nobroadcast": "^2.16.14", "crypto-js": "^4.0.0", "eip-712": "^1.0.0", - "ethers": "5.7.2", + "ethers": "^6.11.1", "eventemitter2": "^5.0.1", "funtypes": "^3.0.1", "lodash": "^4.17.21", diff --git a/packages/hdwallet-native/src/ethereum.test.ts b/packages/hdwallet-native/src/ethereum.test.ts index b96aa587f..bdc421b0b 100644 --- a/packages/hdwallet-native/src/ethereum.test.ts +++ b/packages/hdwallet-native/src/ethereum.test.ts @@ -1,5 +1,5 @@ import * as core from "@shapeshiftoss/hdwallet-core"; -import { parseTransaction } from "ethers/lib/utils.js"; +import { parseTransaction } from "ethers"; import * as native from "./native"; diff --git a/packages/hdwallet-native/src/util.ts b/packages/hdwallet-native/src/util.ts index 1a7c7862f..c19053d7d 100644 --- a/packages/hdwallet-native/src/util.ts +++ b/packages/hdwallet-native/src/util.ts @@ -1,5 +1,6 @@ import * as core from "@shapeshiftoss/hdwallet-core"; -import { ethers } from "ethers"; +import type { BytesLike } from "ethers"; +import { concat, getBytes, isHexString, toUtf8Bytes } from "ethers"; import { BTCScriptType } from "./bitcoin"; import * as Isolation from "./crypto/isolation"; @@ -17,15 +18,10 @@ export async function getKeyPair( return await wallet.derivePath(path); } -export function buildMessage(message: ethers.utils.BytesLike): Uint8Array { - const messageBytes = - typeof message === "string" && !ethers.utils.isHexString(message) - ? ethers.utils.toUtf8Bytes(message) - : ethers.utils.arrayify(message); +export function buildMessage(message: BytesLike): Uint8Array { + const messageBytes = typeof message === "string" && !isHexString(message) ? toUtf8Bytes(message) : getBytes(message); - return ethers.utils.concat([ - ethers.utils.toUtf8Bytes("\x19Ethereum Signed Message:\n"), - ethers.utils.toUtf8Bytes(String(messageBytes.length)), - messageBytes, - ]); + return getBytes( + concat([toUtf8Bytes("\x19Ethereum Signed Message:\n"), toUtf8Bytes(String(messageBytes.length)), messageBytes]) + ); } diff --git a/packages/hdwallet-portis/src/ethereum.ts b/packages/hdwallet-portis/src/ethereum.ts index 449adbe22..fd7c1cd2f 100644 --- a/packages/hdwallet-portis/src/ethereum.ts +++ b/packages/hdwallet-portis/src/ethereum.ts @@ -1,5 +1,5 @@ import * as core from "@shapeshiftoss/hdwallet-core"; -import { isHexString } from "ethers/lib/utils"; +import { isHexString } from "ethers"; export function describeETHPath(path: core.BIP32Path): core.PathDescription { const pathStr = core.addressNListToBIP32(path); diff --git a/packages/hdwallet-tallyho/src/ethereum.test.ts b/packages/hdwallet-tallyho/src/ethereum.test.ts index 9ccaada1b..13c23ecc3 100644 --- a/packages/hdwallet-tallyho/src/ethereum.test.ts +++ b/packages/hdwallet-tallyho/src/ethereum.test.ts @@ -1,11 +1,11 @@ import * as core from "@shapeshiftoss/hdwallet-core"; -import { providers } from "ethers"; +import { Eip1193Provider } from "ethers"; import * as ethereum from "./ethereum"; describe("Tally Ho - Ethereum Adapter", () => { it("ethVerifyMessage returns null as its not implemented", async () => { - const ethereumProvider: providers.ExternalProvider = { + const ethereumProvider: Eip1193Provider = { request: jest.fn().mockReturnValue("0x3f2329C9ADFbcCd9A84f52c906E936A42dA18CB8"), }; expect( @@ -36,7 +36,7 @@ describe("Tally Ho - Ethereum Adapter", () => { expect(paths).toMatchObject([]); }); it("ethSignTx returns null as its not implemented", async () => { - const ethereumProvider: providers.ExternalProvider = { + const ethereumProvider: Eip1193Provider = { request: jest.fn().mockReturnValue({ r: "0x63db3dd3bf3e1fe7dde1969c0fc8850e34116d0b501c0483a0e08c0f77b8ce0a", s: "0x28297d012cccf389f6332415e96ee3fc0bbf8474d05f646e029cd281a031464b", @@ -63,7 +63,7 @@ describe("Tally Ho - Ethereum Adapter", () => { ).toEqual(null); }); it("ethSendTx returns a valid hash", async () => { - const ethereumProvider: providers.ExternalProvider = { + const ethereumProvider: Eip1193Provider = { request: jest.fn().mockReturnValue("0x123"), }; @@ -85,7 +85,7 @@ describe("Tally Ho - Ethereum Adapter", () => { expect(hash).toMatchObject({ hash: "0x123" }); }); it("ethSendTx returns a valid hash if maxFeePerGas is present in msg", async () => { - const ethereumProvider: providers.ExternalProvider = { + const ethereumProvider: Eip1193Provider = { request: jest.fn().mockReturnValue("0x123"), }; @@ -107,7 +107,7 @@ describe("Tally Ho - Ethereum Adapter", () => { expect(hash).toMatchObject({ hash: "0x123" }); }); it("ethSendTx returns null on error", async () => { - const ethereumProvider: providers.ExternalProvider = { + const ethereumProvider: Eip1193Provider = { request: jest.fn().mockRejectedValue(new Error("An Error has occurred")), }; @@ -130,7 +130,7 @@ describe("Tally Ho - Ethereum Adapter", () => { }); it("ethSignMessage returns a valid signature object", async () => { - const ethereumProvider: providers.ExternalProvider = { + const ethereumProvider: Eip1193Provider = { request: jest.fn().mockReturnValue( `Object { "address": "0x73d0385F4d8E00C5e6504C6030F47BF6212736A8", @@ -201,7 +201,7 @@ describe("Tally Ho - Ethereum Adapter", () => { }); it("ethSignMessage returns null on error", async () => { - const ethereumProvider: providers.ExternalProvider = { + const ethereumProvider: Eip1193Provider = { request: jest.fn().mockRejectedValue(new Error("An Error has occurred")), }; @@ -219,7 +219,7 @@ describe("Tally Ho - Ethereum Adapter", () => { }); it("ethGetAddress returns a valid address", async () => { - const ethereumProvider: providers.ExternalProvider = { + const ethereumProvider: Eip1193Provider = { request: jest.fn().mockReturnValue(["0x73d0385F4d8E00C5e6504C6030F47BF6212736A8"]), }; @@ -228,7 +228,7 @@ describe("Tally Ho - Ethereum Adapter", () => { expect(address).toBe("0x73d0385F4d8E00C5e6504C6030F47BF6212736A8"); }); it("ethGetAddress returns null on error", async () => { - const ethereumProvider: providers.ExternalProvider = { + const ethereumProvider: Eip1193Provider = { request: jest.fn().mockRejectedValue(new Error("An error has occurred")), }; diff --git a/packages/hdwallet-tallyho/src/ethereum.ts b/packages/hdwallet-tallyho/src/ethereum.ts index cc264ec7c..2b5ba0132 100644 --- a/packages/hdwallet-tallyho/src/ethereum.ts +++ b/packages/hdwallet-tallyho/src/ethereum.ts @@ -1,5 +1,5 @@ import * as core from "@shapeshiftoss/hdwallet-core"; -import { isHexString } from "ethers/lib/utils"; +import { isHexString } from "ethers"; export function describeETHPath(path: core.BIP32Path): core.PathDescription { const pathStr = core.addressNListToBIP32(path); diff --git a/packages/hdwallet-trezor/src/ethereum.ts b/packages/hdwallet-trezor/src/ethereum.ts index cf8a99667..65fb8a342 100644 --- a/packages/hdwallet-trezor/src/ethereum.ts +++ b/packages/hdwallet-trezor/src/ethereum.ts @@ -1,7 +1,7 @@ import Common from "@ethereumjs/common"; import { Transaction } from "@ethereumjs/tx"; import * as core from "@shapeshiftoss/hdwallet-core"; -import { isHexString } from "ethers/lib/utils"; +import { isHexString } from "ethers"; import { TrezorTransport } from "./transport"; import { handleError } from "./utils"; diff --git a/packages/hdwallet-walletconnect/package.json b/packages/hdwallet-walletconnect/package.json index 324ad0cfa..217090fbc 100644 --- a/packages/hdwallet-walletconnect/package.json +++ b/packages/hdwallet-walletconnect/package.json @@ -18,6 +18,6 @@ "@shapeshiftoss/hdwallet-core": "1.53.4", "@walletconnect/qrcode-modal": "^1.7.8", "@walletconnect/web3-provider": "^1.7.8", - "ethers": "^5.6.5" + "ethers": "^6.11.1" } } diff --git a/packages/hdwallet-walletconnect/src/ethereum.ts b/packages/hdwallet-walletconnect/src/ethereum.ts index 4c32a1807..1b5cab3d2 100644 --- a/packages/hdwallet-walletconnect/src/ethereum.ts +++ b/packages/hdwallet-walletconnect/src/ethereum.ts @@ -1,6 +1,5 @@ import * as core from "@shapeshiftoss/hdwallet-core"; -import type { Bytes } from "ethers"; -import { isHexString } from "ethers/lib/utils"; +import { BytesLike, isHexString } from "ethers"; export function describeETHPath(path: core.BIP32Path): core.PathDescription { const pathStr = core.addressNListToBIP32(path); @@ -52,7 +51,7 @@ export async function ethSendTx( } export async function ethSignMessage( - args: { data: string | Bytes; fromAddress: string }, + args: { data: BytesLike; fromAddress: string }, provider: any ): Promise { if (!isHexString(args.data)) throw new Error("data is not an hex string"); diff --git a/packages/hdwallet-walletconnectV2/package.json b/packages/hdwallet-walletconnectV2/package.json index 83b4e089c..e59fc09d2 100644 --- a/packages/hdwallet-walletconnectV2/package.json +++ b/packages/hdwallet-walletconnectV2/package.json @@ -18,6 +18,6 @@ "@shapeshiftoss/hdwallet-core": "1.53.4", "@walletconnect/ethereum-provider": "^2.10.1", "@walletconnect/modal": "^2.6.2", - "ethers": "^5.6.5" + "ethers": "^6.11.1" } } diff --git a/packages/hdwallet-walletconnectV2/src/ethereum.ts b/packages/hdwallet-walletconnectV2/src/ethereum.ts index 1875f3147..d9e739ef3 100644 --- a/packages/hdwallet-walletconnectV2/src/ethereum.ts +++ b/packages/hdwallet-walletconnectV2/src/ethereum.ts @@ -9,7 +9,7 @@ import type { } from "@shapeshiftoss/hdwallet-core"; import { addressNListToBIP32, slip44ByCoin } from "@shapeshiftoss/hdwallet-core"; import EthereumProvider from "@walletconnect/ethereum-provider"; -import { isHexString } from "ethers/lib/utils"; +import { isHexString } from "ethers"; const getUnsignedTxFromMessage = (msg: ETHSignTx & { from: string }) => { const utxBase = { diff --git a/packages/hdwallet-xdefi/src/ethereum.ts b/packages/hdwallet-xdefi/src/ethereum.ts index 43ed76973..5d91e7b36 100644 --- a/packages/hdwallet-xdefi/src/ethereum.ts +++ b/packages/hdwallet-xdefi/src/ethereum.ts @@ -1,6 +1,6 @@ import * as core from "@shapeshiftoss/hdwallet-core"; import { ETHSignedMessage } from "@shapeshiftoss/hdwallet-core"; -import { isHexString } from "ethers/lib/utils"; +import { isHexString } from "ethers"; export async function ethVerifyMessage(msg: core.ETHVerifyMessage, ethereum: any): Promise { const recoveredAddress = await ethereum.request({ diff --git a/yarn.lock b/yarn.lock index 7a7c7df77..b23add6bd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,11 @@ # yarn lockfile v1 +"@adraffy/ens-normalize@1.10.1": + version "1.10.1" + resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz#63430d04bd8c5e74f8d7d049338f1cd9d4f02069" + integrity sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw== + "@ampproject/remapping@^2.2.0": version "2.2.1" resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.2.1.tgz#99e8e11851128b8702cd57c33684f1d0f260b630" @@ -1274,21 +1279,6 @@ "@ethersproject/properties" "^5.4.0" "@ethersproject/strings" "^5.4.0" -"@ethersproject/abi@5.6.4", "@ethersproject/abi@^5.6.3": - version "5.6.4" - resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.6.4.tgz#f6e01b6ed391a505932698ecc0d9e7a99ee60362" - integrity sha512-TTeZUlCeIHG6527/2goZA6gW5F8Emoc7MrZDC7hhP84aRGvW3TEdTnZR08Ls88YXM1m2SuK42Osw/jSi3uO8gg== - dependencies: - "@ethersproject/address" "^5.6.1" - "@ethersproject/bignumber" "^5.6.2" - "@ethersproject/bytes" "^5.6.1" - "@ethersproject/constants" "^5.6.1" - "@ethersproject/hash" "^5.6.1" - "@ethersproject/keccak256" "^5.6.1" - "@ethersproject/logger" "^5.6.0" - "@ethersproject/properties" "^5.6.0" - "@ethersproject/strings" "^5.6.1" - "@ethersproject/abi@5.7.0", "@ethersproject/abi@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.7.0.tgz#b3f3e045bbbeed1af3947335c247ad625a44e449" @@ -1332,19 +1322,6 @@ "@ethersproject/transactions" "^5.4.0" "@ethersproject/web" "^5.4.0" -"@ethersproject/abstract-provider@5.6.1", "@ethersproject/abstract-provider@^5.6.1": - version "5.6.1" - resolved "https://registry.yarnpkg.com/@ethersproject/abstract-provider/-/abstract-provider-5.6.1.tgz#02ddce150785caf0c77fe036a0ebfcee61878c59" - integrity sha512-BxlIgogYJtp1FS8Muvj8YfdClk3unZH0vRMVX791Z9INBNT/kuACZ9GzaY1Y4yFq+YSy6/w4gzj3HCRKrK9hsQ== - dependencies: - "@ethersproject/bignumber" "^5.6.2" - "@ethersproject/bytes" "^5.6.1" - "@ethersproject/logger" "^5.6.0" - "@ethersproject/networks" "^5.6.3" - "@ethersproject/properties" "^5.6.0" - "@ethersproject/transactions" "^5.6.2" - "@ethersproject/web" "^5.6.1" - "@ethersproject/abstract-provider@5.7.0", "@ethersproject/abstract-provider@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/abstract-provider/-/abstract-provider-5.7.0.tgz#b0a8550f88b6bf9d51f90e4795d48294630cb9ef" @@ -1382,17 +1359,6 @@ "@ethersproject/logger" "^5.4.0" "@ethersproject/properties" "^5.4.0" -"@ethersproject/abstract-signer@5.6.2", "@ethersproject/abstract-signer@^5.6.2": - version "5.6.2" - resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.6.2.tgz#491f07fc2cbd5da258f46ec539664713950b0b33" - integrity sha512-n1r6lttFBG0t2vNiI3HoWaS/KdOt8xyDjzlP2cuevlWLG6EX0OwcKLyG/Kp/cuwNxdy/ous+R/DEMdTUwWQIjQ== - dependencies: - "@ethersproject/abstract-provider" "^5.6.1" - "@ethersproject/bignumber" "^5.6.2" - "@ethersproject/bytes" "^5.6.1" - "@ethersproject/logger" "^5.6.0" - "@ethersproject/properties" "^5.6.0" - "@ethersproject/abstract-signer@5.7.0", "@ethersproject/abstract-signer@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.7.0.tgz#13f4f32117868452191a4649723cb086d2b596b2" @@ -1437,17 +1403,6 @@ "@ethersproject/logger" "^5.4.0" "@ethersproject/rlp" "^5.4.0" -"@ethersproject/address@5.6.1", "@ethersproject/address@^5.6.1": - version "5.6.1" - resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.6.1.tgz#ab57818d9aefee919c5721d28cd31fd95eff413d" - integrity sha512-uOgF0kS5MJv9ZvCz7x6T2EXJSzotiybApn4XlOgoTX0xdtyVIJ7pF+6cGPxiEq/dpBiTfMiw7Yc81JcwhSYA0Q== - dependencies: - "@ethersproject/bignumber" "^5.6.2" - "@ethersproject/bytes" "^5.6.1" - "@ethersproject/keccak256" "^5.6.1" - "@ethersproject/logger" "^5.6.0" - "@ethersproject/rlp" "^5.6.1" - "@ethersproject/address@5.7.0", "@ethersproject/address@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.7.0.tgz#19b56c4d74a3b0a46bfdbb6cfcc0a153fc697f37" @@ -1477,13 +1432,6 @@ dependencies: "@ethersproject/bytes" "^5.4.0" -"@ethersproject/base64@5.6.1", "@ethersproject/base64@^5.6.1": - version "5.6.1" - resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.6.1.tgz#2c40d8a0310c9d1606c2c37ae3092634b41d87cb" - integrity sha512-qB76rjop6a0RIYYMiB4Eh/8n+Hxu2NIZm8S/Q7kNo5pmZfXhHGHmS4MinUainiBC54SCyRnwzL+KZjj8zbsSsw== - dependencies: - "@ethersproject/bytes" "^5.6.1" - "@ethersproject/base64@5.7.0", "@ethersproject/base64@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.7.0.tgz#ac4ee92aa36c1628173e221d0d01f53692059e1c" @@ -1499,14 +1447,6 @@ "@ethersproject/bytes" "^5.4.0" "@ethersproject/properties" "^5.4.0" -"@ethersproject/basex@5.6.1", "@ethersproject/basex@^5.6.1": - version "5.6.1" - resolved "https://registry.yarnpkg.com/@ethersproject/basex/-/basex-5.6.1.tgz#badbb2f1d4a6f52ce41c9064f01eab19cc4c5305" - integrity sha512-a52MkVz4vuBXR06nvflPMotld1FJWSj2QT0985v7P/emPZO00PucFAkbcmq2vpVU7Ts7umKiSI6SppiLykVWsA== - dependencies: - "@ethersproject/bytes" "^5.6.1" - "@ethersproject/properties" "^5.6.0" - "@ethersproject/basex@5.7.0", "@ethersproject/basex@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/basex/-/basex-5.7.0.tgz#97034dc7e8938a8ca943ab20f8a5e492ece4020b" @@ -1524,15 +1464,6 @@ "@ethersproject/logger" "^5.4.0" bn.js "^4.11.9" -"@ethersproject/bignumber@5.6.2", "@ethersproject/bignumber@^5.6.2": - version "5.6.2" - resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.6.2.tgz#72a0717d6163fab44c47bcc82e0c550ac0315d66" - integrity sha512-v7+EEUbhGqT3XJ9LMPsKvXYHFc8eHxTowFCG/HgJErmq4XHJ2WR7aeyICg3uTOAQ7Icn0GFHAohXEhxQHq4Ubw== - dependencies: - "@ethersproject/bytes" "^5.6.1" - "@ethersproject/logger" "^5.6.0" - bn.js "^5.2.1" - "@ethersproject/bignumber@5.7.0", "@ethersproject/bignumber@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.7.0.tgz#e2f03837f268ba655ffba03a57853e18a18dc9c2" @@ -1567,13 +1498,6 @@ dependencies: "@ethersproject/logger" "^5.4.0" -"@ethersproject/bytes@5.6.1", "@ethersproject/bytes@^5.6.1": - version "5.6.1" - resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.6.1.tgz#24f916e411f82a8a60412344bf4a813b917eefe7" - integrity sha512-NwQt7cKn5+ZE4uDn+X5RAXLp46E1chXoaMmrxAyA0rblpxz8t58lVkrHXoRIn0lz1joQElQ8410GqhTqMOwc6g== - dependencies: - "@ethersproject/logger" "^5.6.0" - "@ethersproject/bytes@5.7.0", "@ethersproject/bytes@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.7.0.tgz#a00f6ea8d7e7534d6d87f47188af1148d71f155d" @@ -1595,13 +1519,6 @@ dependencies: "@ethersproject/bignumber" "^5.4.0" -"@ethersproject/constants@5.6.1", "@ethersproject/constants@^5.6.1": - version "5.6.1" - resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.6.1.tgz#e2e974cac160dd101cf79fdf879d7d18e8cb1370" - integrity sha512-QSq9WVnZbxXYFftrjSjZDUshp6/eKp6qrtdBtUCm0QxCV5z1fG/w3kdlcsjMCQuQHUnAclKoK7XpXMezhRDOLg== - dependencies: - "@ethersproject/bignumber" "^5.6.2" - "@ethersproject/constants@5.7.0", "@ethersproject/constants@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.7.0.tgz#df80a9705a7e08984161f09014ea012d1c75295e" @@ -1632,22 +1549,6 @@ "@ethersproject/properties" "^5.4.0" "@ethersproject/transactions" "^5.4.0" -"@ethersproject/contracts@5.6.2": - version "5.6.2" - resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.6.2.tgz#20b52e69ebc1b74274ff8e3d4e508de971c287bc" - integrity sha512-hguUA57BIKi6WY0kHvZp6PwPlWF87MCeB4B7Z7AbUpTxfFXFdn/3b0GmjZPagIHS+3yhcBJDnuEfU4Xz+Ks/8g== - dependencies: - "@ethersproject/abi" "^5.6.3" - "@ethersproject/abstract-provider" "^5.6.1" - "@ethersproject/abstract-signer" "^5.6.2" - "@ethersproject/address" "^5.6.1" - "@ethersproject/bignumber" "^5.6.2" - "@ethersproject/bytes" "^5.6.1" - "@ethersproject/constants" "^5.6.1" - "@ethersproject/logger" "^5.6.0" - "@ethersproject/properties" "^5.6.0" - "@ethersproject/transactions" "^5.6.2" - "@ethersproject/contracts@5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.7.0.tgz#c305e775abd07e48aa590e1a877ed5c316f8bd1e" @@ -1678,20 +1579,6 @@ "@ethersproject/properties" "^5.4.0" "@ethersproject/strings" "^5.4.0" -"@ethersproject/hash@5.6.1", "@ethersproject/hash@^5.6.1": - version "5.6.1" - resolved "https://registry.yarnpkg.com/@ethersproject/hash/-/hash-5.6.1.tgz#224572ea4de257f05b4abf8ae58b03a67e99b0f4" - integrity sha512-L1xAHurbaxG8VVul4ankNX5HgQ8PNCTrnVXEiFnE9xoRnaUcgfD12tZINtDinSllxPLCtGwguQxJ5E6keE84pA== - dependencies: - "@ethersproject/abstract-signer" "^5.6.2" - "@ethersproject/address" "^5.6.1" - "@ethersproject/bignumber" "^5.6.2" - "@ethersproject/bytes" "^5.6.1" - "@ethersproject/keccak256" "^5.6.1" - "@ethersproject/logger" "^5.6.0" - "@ethersproject/properties" "^5.6.0" - "@ethersproject/strings" "^5.6.1" - "@ethersproject/hash@5.7.0", "@ethersproject/hash@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/hash/-/hash-5.7.0.tgz#eb7aca84a588508369562e16e514b539ba5240a7" @@ -1739,24 +1626,6 @@ "@ethersproject/transactions" "^5.4.0" "@ethersproject/wordlists" "^5.4.0" -"@ethersproject/hdnode@5.6.2", "@ethersproject/hdnode@^5.6.2": - version "5.6.2" - resolved "https://registry.yarnpkg.com/@ethersproject/hdnode/-/hdnode-5.6.2.tgz#26f3c83a3e8f1b7985c15d1db50dc2903418b2d2" - integrity sha512-tERxW8Ccf9CxW2db3WsN01Qao3wFeRsfYY9TCuhmG0xNpl2IO8wgXU3HtWIZ49gUWPggRy4Yg5axU0ACaEKf1Q== - dependencies: - "@ethersproject/abstract-signer" "^5.6.2" - "@ethersproject/basex" "^5.6.1" - "@ethersproject/bignumber" "^5.6.2" - "@ethersproject/bytes" "^5.6.1" - "@ethersproject/logger" "^5.6.0" - "@ethersproject/pbkdf2" "^5.6.1" - "@ethersproject/properties" "^5.6.0" - "@ethersproject/sha2" "^5.6.1" - "@ethersproject/signing-key" "^5.6.2" - "@ethersproject/strings" "^5.6.1" - "@ethersproject/transactions" "^5.6.2" - "@ethersproject/wordlists" "^5.6.1" - "@ethersproject/hdnode@5.7.0", "@ethersproject/hdnode@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/hdnode/-/hdnode-5.7.0.tgz#e627ddc6b466bc77aebf1a6b9e47405ca5aef9cf" @@ -1794,25 +1663,6 @@ aes-js "3.0.0" scrypt-js "3.0.1" -"@ethersproject/json-wallets@5.6.1", "@ethersproject/json-wallets@^5.6.1": - version "5.6.1" - resolved "https://registry.yarnpkg.com/@ethersproject/json-wallets/-/json-wallets-5.6.1.tgz#3f06ba555c9c0d7da46756a12ac53483fe18dd91" - integrity sha512-KfyJ6Zwz3kGeX25nLihPwZYlDqamO6pfGKNnVMWWfEVVp42lTfCZVXXy5Ie8IZTN0HKwAngpIPi7gk4IJzgmqQ== - dependencies: - "@ethersproject/abstract-signer" "^5.6.2" - "@ethersproject/address" "^5.6.1" - "@ethersproject/bytes" "^5.6.1" - "@ethersproject/hdnode" "^5.6.2" - "@ethersproject/keccak256" "^5.6.1" - "@ethersproject/logger" "^5.6.0" - "@ethersproject/pbkdf2" "^5.6.1" - "@ethersproject/properties" "^5.6.0" - "@ethersproject/random" "^5.6.1" - "@ethersproject/strings" "^5.6.1" - "@ethersproject/transactions" "^5.6.2" - aes-js "3.0.0" - scrypt-js "3.0.1" - "@ethersproject/json-wallets@5.7.0", "@ethersproject/json-wallets@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/json-wallets/-/json-wallets-5.7.0.tgz#5e3355287b548c32b368d91014919ebebddd5360" @@ -1840,14 +1690,6 @@ "@ethersproject/bytes" "^5.4.0" js-sha3 "0.5.7" -"@ethersproject/keccak256@5.6.1", "@ethersproject/keccak256@^5.6.1": - version "5.6.1" - resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.6.1.tgz#b867167c9b50ba1b1a92bccdd4f2d6bd168a91cc" - integrity sha512-bB7DQHCTRDooZZdL3lk9wpL0+XuG3XLGHLh3cePnybsO3V0rdCAOQGpn/0R3aODmnTOOkCATJiD2hnL+5bwthA== - dependencies: - "@ethersproject/bytes" "^5.6.1" - js-sha3 "0.8.0" - "@ethersproject/keccak256@5.7.0", "@ethersproject/keccak256@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.7.0.tgz#3186350c6e1cd6aba7940384ec7d6d9db01f335a" @@ -1869,11 +1711,6 @@ resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.4.1.tgz#503bd33683538b923c578c07d1c2c0dd18672054" integrity sha512-DZ+bRinnYLPw1yAC64oRl0QyVZj43QeHIhVKfD/+YwSz4wsv1pfwb5SOFjz+r710YEWzU6LrhuSjpSO+6PeE4A== -"@ethersproject/logger@5.6.0", "@ethersproject/logger@^5.6.0": - version "5.6.0" - resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.6.0.tgz#d7db1bfcc22fd2e4ab574cba0bb6ad779a9a3e7a" - integrity sha512-BiBWllUROH9w+P21RzoxJKzqoqpkyM1pRnEKG69bulE9TSQD8SAIvTQqIMZmmCO8pUNkgLP1wndX1gKghSpBmg== - "@ethersproject/logger@5.7.0", "@ethersproject/logger@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.7.0.tgz#6ce9ae168e74fecf287be17062b590852c311892" @@ -1896,13 +1733,6 @@ dependencies: "@ethersproject/logger" "^5.4.0" -"@ethersproject/networks@5.6.4", "@ethersproject/networks@^5.6.3": - version "5.6.4" - resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.6.4.tgz#51296d8fec59e9627554f5a8a9c7791248c8dc07" - integrity sha512-KShHeHPahHI2UlWdtDMn2lJETcbtaJge4k7XSjDR9h79QTd6yQJmv6Cp2ZA4JdqWnhszAOLSuJEd9C0PRw7hSQ== - dependencies: - "@ethersproject/logger" "^5.6.0" - "@ethersproject/networks@5.7.1", "@ethersproject/networks@^5.7.0": version "5.7.1" resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.7.1.tgz#118e1a981d757d45ccea6bb58d9fd3d9db14ead6" @@ -1925,14 +1755,6 @@ "@ethersproject/bytes" "^5.4.0" "@ethersproject/sha2" "^5.4.0" -"@ethersproject/pbkdf2@5.6.1", "@ethersproject/pbkdf2@^5.6.1": - version "5.6.1" - resolved "https://registry.yarnpkg.com/@ethersproject/pbkdf2/-/pbkdf2-5.6.1.tgz#f462fe320b22c0d6b1d72a9920a3963b09eb82d1" - integrity sha512-k4gRQ+D93zDRPNUfmduNKq065uadC2YjMP/CqwwX5qG6R05f47boq6pLZtV/RnC4NZAYOPH1Cyo54q0c9sshRQ== - dependencies: - "@ethersproject/bytes" "^5.6.1" - "@ethersproject/sha2" "^5.6.1" - "@ethersproject/pbkdf2@5.7.0", "@ethersproject/pbkdf2@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/pbkdf2/-/pbkdf2-5.7.0.tgz#d2267d0a1f6e123f3771007338c47cccd83d3102" @@ -1948,13 +1770,6 @@ dependencies: "@ethersproject/logger" "^5.4.0" -"@ethersproject/properties@5.6.0", "@ethersproject/properties@^5.6.0": - version "5.6.0" - resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.6.0.tgz#38904651713bc6bdd5bdd1b0a4287ecda920fa04" - integrity sha512-szoOkHskajKePTJSZ46uHUWWkbv7TzP2ypdEK6jGMqJaEt2sb0jCgfBo0gH0m2HBpRixMuJ6TBRaQCF7a9DoCg== - dependencies: - "@ethersproject/logger" "^5.6.0" - "@ethersproject/properties@5.7.0", "@ethersproject/properties@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.7.0.tgz#a6e12cb0439b878aaf470f1902a176033067ed30" @@ -2001,32 +1816,6 @@ bech32 "1.1.4" ws "7.4.6" -"@ethersproject/providers@5.6.8": - version "5.6.8" - resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.6.8.tgz#22e6c57be215ba5545d3a46cf759d265bb4e879d" - integrity sha512-Wf+CseT/iOJjrGtAOf3ck9zS7AgPmr2fZ3N97r4+YXN3mBePTG2/bJ8DApl9mVwYL+RpYbNxMEkEp4mPGdwG/w== - dependencies: - "@ethersproject/abstract-provider" "^5.6.1" - "@ethersproject/abstract-signer" "^5.6.2" - "@ethersproject/address" "^5.6.1" - "@ethersproject/base64" "^5.6.1" - "@ethersproject/basex" "^5.6.1" - "@ethersproject/bignumber" "^5.6.2" - "@ethersproject/bytes" "^5.6.1" - "@ethersproject/constants" "^5.6.1" - "@ethersproject/hash" "^5.6.1" - "@ethersproject/logger" "^5.6.0" - "@ethersproject/networks" "^5.6.3" - "@ethersproject/properties" "^5.6.0" - "@ethersproject/random" "^5.6.1" - "@ethersproject/rlp" "^5.6.1" - "@ethersproject/sha2" "^5.6.1" - "@ethersproject/strings" "^5.6.1" - "@ethersproject/transactions" "^5.6.2" - "@ethersproject/web" "^5.6.1" - bech32 "1.1.4" - ws "7.4.6" - "@ethersproject/providers@5.7.2", "@ethersproject/providers@^5.7.0", "@ethersproject/providers@^5.7.2": version "5.7.2" resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.7.2.tgz#f8b1a4f275d7ce58cf0a2eec222269a08beb18cb" @@ -2061,14 +1850,6 @@ "@ethersproject/bytes" "^5.4.0" "@ethersproject/logger" "^5.4.0" -"@ethersproject/random@5.6.1", "@ethersproject/random@^5.6.1": - version "5.6.1" - resolved "https://registry.yarnpkg.com/@ethersproject/random/-/random-5.6.1.tgz#66915943981bcd3e11bbd43733f5c3ba5a790255" - integrity sha512-/wtPNHwbmng+5yi3fkipA8YBT59DdkGRoC2vWk09Dci/q5DlgnMkhIycjHlavrvrjJBkFjO/ueLyT+aUDfc4lA== - dependencies: - "@ethersproject/bytes" "^5.6.1" - "@ethersproject/logger" "^5.6.0" - "@ethersproject/random@5.7.0", "@ethersproject/random@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/random/-/random-5.7.0.tgz#af19dcbc2484aae078bb03656ec05df66253280c" @@ -2085,14 +1866,6 @@ "@ethersproject/bytes" "^5.4.0" "@ethersproject/logger" "^5.4.0" -"@ethersproject/rlp@5.6.1", "@ethersproject/rlp@^5.6.1": - version "5.6.1" - resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.6.1.tgz#df8311e6f9f24dcb03d59a2bac457a28a4fe2bd8" - integrity sha512-uYjmcZx+DKlFUk7a5/W9aQVaoEC7+1MOBgNtvNg13+RnuUwT4F0zTovC0tmay5SmRslb29V1B7Y5KCri46WhuQ== - dependencies: - "@ethersproject/bytes" "^5.6.1" - "@ethersproject/logger" "^5.6.0" - "@ethersproject/rlp@5.7.0", "@ethersproject/rlp@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.7.0.tgz#de39e4d5918b9d74d46de93af80b7685a9c21304" @@ -2118,15 +1891,6 @@ "@ethersproject/logger" "^5.4.0" hash.js "1.1.7" -"@ethersproject/sha2@5.6.1", "@ethersproject/sha2@^5.6.1": - version "5.6.1" - resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.6.1.tgz#211f14d3f5da5301c8972a8827770b6fd3e51656" - integrity sha512-5K2GyqcW7G4Yo3uenHegbXRPDgARpWUiXc6RiF7b6i/HXUoWlb7uCARh7BAHg7/qT/Q5ydofNwiZcim9qpjB6g== - dependencies: - "@ethersproject/bytes" "^5.6.1" - "@ethersproject/logger" "^5.6.0" - hash.js "1.1.7" - "@ethersproject/sha2@5.7.0", "@ethersproject/sha2@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.7.0.tgz#9a5f7a7824ef784f7f7680984e593a800480c9fb" @@ -2148,18 +1912,6 @@ elliptic "6.5.4" hash.js "1.1.7" -"@ethersproject/signing-key@5.6.2", "@ethersproject/signing-key@^5.6.2": - version "5.6.2" - resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.6.2.tgz#8a51b111e4d62e5a62aee1da1e088d12de0614a3" - integrity sha512-jVbu0RuP7EFpw82vHcL+GP35+KaNruVAZM90GxgQnGqB6crhBqW/ozBfFvdeImtmb4qPko0uxXjn8l9jpn0cwQ== - dependencies: - "@ethersproject/bytes" "^5.6.1" - "@ethersproject/logger" "^5.6.0" - "@ethersproject/properties" "^5.6.0" - bn.js "^5.2.1" - elliptic "6.5.4" - hash.js "1.1.7" - "@ethersproject/signing-key@5.7.0", "@ethersproject/signing-key@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.7.0.tgz#06b2df39411b00bc57c7c09b01d1e41cf1b16ab3" @@ -2195,18 +1947,6 @@ "@ethersproject/sha2" "^5.4.0" "@ethersproject/strings" "^5.4.0" -"@ethersproject/solidity@5.6.1": - version "5.6.1" - resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.6.1.tgz#5845e71182c66d32e6ec5eefd041fca091a473e2" - integrity sha512-KWqVLkUUoLBfL1iwdzUVlkNqAUIFMpbbeH0rgCfKmJp0vFtY4AsaN91gHKo9ZZLkC4UOm3cI3BmMV4N53BOq4g== - dependencies: - "@ethersproject/bignumber" "^5.6.2" - "@ethersproject/bytes" "^5.6.1" - "@ethersproject/keccak256" "^5.6.1" - "@ethersproject/logger" "^5.6.0" - "@ethersproject/sha2" "^5.6.1" - "@ethersproject/strings" "^5.6.1" - "@ethersproject/solidity@5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.7.0.tgz#5e9c911d8a2acce2a5ebb48a5e2e0af20b631cb8" @@ -2228,15 +1968,6 @@ "@ethersproject/constants" "^5.4.0" "@ethersproject/logger" "^5.4.0" -"@ethersproject/strings@5.6.1", "@ethersproject/strings@^5.6.1": - version "5.6.1" - resolved "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.6.1.tgz#dbc1b7f901db822b5cafd4ebf01ca93c373f8952" - integrity sha512-2X1Lgk6Jyfg26MUnsHiT456U9ijxKUybz8IM1Vih+NJxYtXhmvKBcHOmvGqpFSVJ0nQ4ZCoIViR8XlRw1v/+Cw== - dependencies: - "@ethersproject/bytes" "^5.6.1" - "@ethersproject/constants" "^5.6.1" - "@ethersproject/logger" "^5.6.0" - "@ethersproject/strings@5.7.0", "@ethersproject/strings@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.7.0.tgz#54c9d2a7c57ae8f1205c88a9d3a56471e14d5ed2" @@ -2270,21 +2001,6 @@ "@ethersproject/rlp" "^5.4.0" "@ethersproject/signing-key" "^5.4.0" -"@ethersproject/transactions@5.6.2", "@ethersproject/transactions@^5.6.2": - version "5.6.2" - resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.6.2.tgz#793a774c01ced9fe7073985bb95a4b4e57a6370b" - integrity sha512-BuV63IRPHmJvthNkkt9G70Ullx6AcM+SDc+a8Aw/8Yew6YwT51TcBKEp1P4oOQ/bP25I18JJr7rcFRgFtU9B2Q== - dependencies: - "@ethersproject/address" "^5.6.1" - "@ethersproject/bignumber" "^5.6.2" - "@ethersproject/bytes" "^5.6.1" - "@ethersproject/constants" "^5.6.1" - "@ethersproject/keccak256" "^5.6.1" - "@ethersproject/logger" "^5.6.0" - "@ethersproject/properties" "^5.6.0" - "@ethersproject/rlp" "^5.6.1" - "@ethersproject/signing-key" "^5.6.2" - "@ethersproject/transactions@5.7.0", "@ethersproject/transactions@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.7.0.tgz#91318fc24063e057885a6af13fdb703e1f993d3b" @@ -2324,15 +2040,6 @@ "@ethersproject/constants" "^5.4.0" "@ethersproject/logger" "^5.4.0" -"@ethersproject/units@5.6.1": - version "5.6.1" - resolved "https://registry.yarnpkg.com/@ethersproject/units/-/units-5.6.1.tgz#ecc590d16d37c8f9ef4e89e2005bda7ddc6a4e6f" - integrity sha512-rEfSEvMQ7obcx3KWD5EWWx77gqv54K6BKiZzKxkQJqtpriVsICrktIQmKl8ReNToPeIYPnFHpXvKpi068YFZXw== - dependencies: - "@ethersproject/bignumber" "^5.6.2" - "@ethersproject/constants" "^5.6.1" - "@ethersproject/logger" "^5.6.0" - "@ethersproject/units@5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/units/-/units-5.7.0.tgz#637b563d7e14f42deeee39245275d477aae1d8b1" @@ -2363,27 +2070,6 @@ "@ethersproject/transactions" "^5.4.0" "@ethersproject/wordlists" "^5.4.0" -"@ethersproject/wallet@5.6.2": - version "5.6.2" - resolved "https://registry.yarnpkg.com/@ethersproject/wallet/-/wallet-5.6.2.tgz#cd61429d1e934681e413f4bc847a5f2f87e3a03c" - integrity sha512-lrgh0FDQPuOnHcF80Q3gHYsSUODp6aJLAdDmDV0xKCN/T7D99ta1jGVhulg3PY8wiXEngD0DfM0I2XKXlrqJfg== - dependencies: - "@ethersproject/abstract-provider" "^5.6.1" - "@ethersproject/abstract-signer" "^5.6.2" - "@ethersproject/address" "^5.6.1" - "@ethersproject/bignumber" "^5.6.2" - "@ethersproject/bytes" "^5.6.1" - "@ethersproject/hash" "^5.6.1" - "@ethersproject/hdnode" "^5.6.2" - "@ethersproject/json-wallets" "^5.6.1" - "@ethersproject/keccak256" "^5.6.1" - "@ethersproject/logger" "^5.6.0" - "@ethersproject/properties" "^5.6.0" - "@ethersproject/random" "^5.6.1" - "@ethersproject/signing-key" "^5.6.2" - "@ethersproject/transactions" "^5.6.2" - "@ethersproject/wordlists" "^5.6.1" - "@ethersproject/wallet@5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/wallet/-/wallet-5.7.0.tgz#4e5d0790d96fe21d61d38fb40324e6c7ef350b2d" @@ -2416,17 +2102,6 @@ "@ethersproject/properties" "^5.4.0" "@ethersproject/strings" "^5.4.0" -"@ethersproject/web@5.6.1", "@ethersproject/web@^5.6.1": - version "5.6.1" - resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.6.1.tgz#6e2bd3ebadd033e6fe57d072db2b69ad2c9bdf5d" - integrity sha512-/vSyzaQlNXkO1WV+RneYKqCJwualcUdx/Z3gseVovZP0wIlOFcCE1hkRhKBH8ImKbGQbMl9EAAyJFrJu7V0aqA== - dependencies: - "@ethersproject/base64" "^5.6.1" - "@ethersproject/bytes" "^5.6.1" - "@ethersproject/logger" "^5.6.0" - "@ethersproject/properties" "^5.6.0" - "@ethersproject/strings" "^5.6.1" - "@ethersproject/web@5.7.1", "@ethersproject/web@^5.7.0": version "5.7.1" resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.7.1.tgz#de1f285b373149bee5928f4eb7bcb87ee5fbb4ae" @@ -2449,17 +2124,6 @@ "@ethersproject/properties" "^5.4.0" "@ethersproject/strings" "^5.4.0" -"@ethersproject/wordlists@5.6.1", "@ethersproject/wordlists@^5.6.1": - version "5.6.1" - resolved "https://registry.yarnpkg.com/@ethersproject/wordlists/-/wordlists-5.6.1.tgz#1e78e2740a8a21e9e99947e47979d72e130aeda1" - integrity sha512-wiPRgBpNbNwCQFoCr8bcWO8o5I810cqO6mkdtKfLKFlLxeCWcnzDi4Alu8iyNzlhYuS9npCwivMbRWF19dyblw== - dependencies: - "@ethersproject/bytes" "^5.6.1" - "@ethersproject/hash" "^5.6.1" - "@ethersproject/logger" "^5.6.0" - "@ethersproject/properties" "^5.6.0" - "@ethersproject/strings" "^5.6.1" - "@ethersproject/wordlists@5.7.0", "@ethersproject/wordlists@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/wordlists/-/wordlists-5.7.0.tgz#8fb2c07185d68c3e09eb3bfd6e779ba2774627f5" @@ -4232,6 +3896,13 @@ dependencies: "@noble/hashes" "1.3.1" +"@noble/curves@1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.2.0.tgz#92d7e12e4e49b23105a2555c6984d41733d65c35" + integrity sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw== + dependencies: + "@noble/hashes" "1.3.2" + "@noble/curves@^1.0.0": version "1.0.0" resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.0.0.tgz#e40be8c7daf088aaf291887cbc73f43464a92932" @@ -4254,16 +3925,16 @@ resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.1.tgz#8831ef002114670c603c458ab8b11328406953a9" integrity sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA== +"@noble/hashes@1.3.2", "@noble/hashes@^1.1.3", "@noble/hashes@^1.3.1", "@noble/hashes@~1.3.0", "@noble/hashes@~1.3.1": + version "1.3.2" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.2.tgz#6f26dbc8fbc7205873ce3cee2f690eba0d421b39" + integrity sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ== + "@noble/hashes@^1", "@noble/hashes@^1.0.0": version "1.0.0" resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.0.0.tgz#d5e38bfbdaba174805a4e649f13be9a9ed3351ae" integrity sha512-DZVbtY62kc3kkBtMHqwCOfXrT/hnoORy5BJ4+HU1IR59X0KWAOqsfzQPcUl/lQLlG7qXbe/fZ3r/emxtAl+sqg== -"@noble/hashes@^1.1.3", "@noble/hashes@^1.3.1", "@noble/hashes@~1.3.0", "@noble/hashes@~1.3.1": - version "1.3.2" - resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.2.tgz#6f26dbc8fbc7205873ce3cee2f690eba0d421b39" - integrity sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ== - "@noble/hashes@~1.1.1": version "1.1.5" resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.1.5.tgz#1a0377f3b9020efe2fae03290bd2a12140c95c11" @@ -6346,6 +6017,11 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-11.11.6.tgz#df929d1bb2eee5afdda598a41930fe50b43eaa6a" integrity sha512-Exw4yUWMBXM3X+8oqzJNRqZSwUAaS4+7NdvHqQuFi/d+synz++xmX3QIf+BFqneW8N31R8Ky+sikfZUXq07ggQ== +"@types/node@18.15.13": + version "18.15.13" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.15.13.tgz#f64277c341150c979e42b00e4ac289290c9df469" + integrity sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q== + "@types/node@>=13.7.0": version "16.11.0" resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.0.tgz#4b95f2327bacd1ef8f08d8ceda193039c5d7f52e" @@ -7373,6 +7049,11 @@ aes-js@3.0.0: resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d" integrity sha1-4h3xCtbCBTKVvLuNq0Cwnb6ofk0= +aes-js@4.0.0-beta.5: + version "4.0.0-beta.5" + resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-4.0.0-beta.5.tgz#8d2452c52adedebc3a3e28465d858c11ca315873" + integrity sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q== + aes-js@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.1.2.tgz#db9aabde85d5caabbfc0d4f2a4446960f627146a" @@ -11155,42 +10836,6 @@ ethereumjs-vm@^2.3.4: rustbn.js "~0.2.0" safe-buffer "^5.1.1" -ethers@5.7.2, ethers@^5.5.3: - version "5.7.2" - resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e" - integrity sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg== - dependencies: - "@ethersproject/abi" "5.7.0" - "@ethersproject/abstract-provider" "5.7.0" - "@ethersproject/abstract-signer" "5.7.0" - "@ethersproject/address" "5.7.0" - "@ethersproject/base64" "5.7.0" - "@ethersproject/basex" "5.7.0" - "@ethersproject/bignumber" "5.7.0" - "@ethersproject/bytes" "5.7.0" - "@ethersproject/constants" "5.7.0" - "@ethersproject/contracts" "5.7.0" - "@ethersproject/hash" "5.7.0" - "@ethersproject/hdnode" "5.7.0" - "@ethersproject/json-wallets" "5.7.0" - "@ethersproject/keccak256" "5.7.0" - "@ethersproject/logger" "5.7.0" - "@ethersproject/networks" "5.7.1" - "@ethersproject/pbkdf2" "5.7.0" - "@ethersproject/properties" "5.7.0" - "@ethersproject/providers" "5.7.2" - "@ethersproject/random" "5.7.0" - "@ethersproject/rlp" "5.7.0" - "@ethersproject/sha2" "5.7.0" - "@ethersproject/signing-key" "5.7.0" - "@ethersproject/solidity" "5.7.0" - "@ethersproject/strings" "5.7.0" - "@ethersproject/transactions" "5.7.0" - "@ethersproject/units" "5.7.0" - "@ethersproject/wallet" "5.7.0" - "@ethersproject/web" "5.7.1" - "@ethersproject/wordlists" "5.7.0" - ethers@^5.4.7: version "5.4.7" resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.4.7.tgz#0fd491a5da7c9793de2d6058d76b41b1e7efba8f" @@ -11227,41 +10872,54 @@ ethers@^5.4.7: "@ethersproject/web" "5.4.0" "@ethersproject/wordlists" "5.4.0" -ethers@^5.6.5: - version "5.6.9" - resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.6.9.tgz#4e12f8dfcb67b88ae7a78a9519b384c23c576a4d" - integrity sha512-lMGC2zv9HC5EC+8r429WaWu3uWJUCgUCt8xxKCFqkrFuBDZXDYIdzDUECxzjf2BMF8IVBByY1EBoGSL3RTm8RA== - dependencies: - "@ethersproject/abi" "5.6.4" - "@ethersproject/abstract-provider" "5.6.1" - "@ethersproject/abstract-signer" "5.6.2" - "@ethersproject/address" "5.6.1" - "@ethersproject/base64" "5.6.1" - "@ethersproject/basex" "5.6.1" - "@ethersproject/bignumber" "5.6.2" - "@ethersproject/bytes" "5.6.1" - "@ethersproject/constants" "5.6.1" - "@ethersproject/contracts" "5.6.2" - "@ethersproject/hash" "5.6.1" - "@ethersproject/hdnode" "5.6.2" - "@ethersproject/json-wallets" "5.6.1" - "@ethersproject/keccak256" "5.6.1" - "@ethersproject/logger" "5.6.0" - "@ethersproject/networks" "5.6.4" - "@ethersproject/pbkdf2" "5.6.1" - "@ethersproject/properties" "5.6.0" - "@ethersproject/providers" "5.6.8" - "@ethersproject/random" "5.6.1" - "@ethersproject/rlp" "5.6.1" - "@ethersproject/sha2" "5.6.1" - "@ethersproject/signing-key" "5.6.2" - "@ethersproject/solidity" "5.6.1" - "@ethersproject/strings" "5.6.1" - "@ethersproject/transactions" "5.6.2" - "@ethersproject/units" "5.6.1" - "@ethersproject/wallet" "5.6.2" - "@ethersproject/web" "5.6.1" - "@ethersproject/wordlists" "5.6.1" +ethers@^5.5.3: + version "5.7.2" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e" + integrity sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg== + dependencies: + "@ethersproject/abi" "5.7.0" + "@ethersproject/abstract-provider" "5.7.0" + "@ethersproject/abstract-signer" "5.7.0" + "@ethersproject/address" "5.7.0" + "@ethersproject/base64" "5.7.0" + "@ethersproject/basex" "5.7.0" + "@ethersproject/bignumber" "5.7.0" + "@ethersproject/bytes" "5.7.0" + "@ethersproject/constants" "5.7.0" + "@ethersproject/contracts" "5.7.0" + "@ethersproject/hash" "5.7.0" + "@ethersproject/hdnode" "5.7.0" + "@ethersproject/json-wallets" "5.7.0" + "@ethersproject/keccak256" "5.7.0" + "@ethersproject/logger" "5.7.0" + "@ethersproject/networks" "5.7.1" + "@ethersproject/pbkdf2" "5.7.0" + "@ethersproject/properties" "5.7.0" + "@ethersproject/providers" "5.7.2" + "@ethersproject/random" "5.7.0" + "@ethersproject/rlp" "5.7.0" + "@ethersproject/sha2" "5.7.0" + "@ethersproject/signing-key" "5.7.0" + "@ethersproject/solidity" "5.7.0" + "@ethersproject/strings" "5.7.0" + "@ethersproject/transactions" "5.7.0" + "@ethersproject/units" "5.7.0" + "@ethersproject/wallet" "5.7.0" + "@ethersproject/web" "5.7.1" + "@ethersproject/wordlists" "5.7.0" + +ethers@^6.11.1: + version "6.11.1" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-6.11.1.tgz#96aae00b627c2e35f9b0a4d65c7ab658259ee6af" + integrity sha512-mxTAE6wqJQAbp5QAe/+o+rXOID7Nw91OZXvgpjDa1r4fAbq2Nu314oEZSbjoRLacuCzs7kUC3clEvkCQowffGg== + dependencies: + "@adraffy/ens-normalize" "1.10.1" + "@noble/curves" "1.2.0" + "@noble/hashes" "1.3.2" + "@types/node" "18.15.13" + aes-js "4.0.0-beta.5" + tslib "2.4.0" + ws "8.5.0" ethjs-unit@0.1.6, ethjs-unit@^0.1.6: version "0.1.6" @@ -19388,6 +19046,11 @@ tslib@1.14.1, tslib@^1.10.0, tslib@^1.8.1, tslib@^1.9.0: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== +tslib@2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" + integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== + tslib@^2.0.0, tslib@^2.1.0: version "2.3.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.0.tgz#803b8cdab3e12ba581a4ca41c8839bbb0dacb09e" @@ -20669,6 +20332,11 @@ ws@7.5.3, ws@^7.0.0, ws@^7.4.5: resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.3.tgz#160835b63c7d97bfab418fc1b8a9fced2ac01a74" integrity sha512-kQ/dHIzuLrS6Je9+uv81ueZomEwH0qVYstcAQ4/Z93K8zeko9gtAbttJWzoC5ukqXY1PpoouV3+VSOqEAFt5wg== +ws@8.5.0: + version "8.5.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.5.0.tgz#bfb4be96600757fe5382de12c670dab984a1ed4f" + integrity sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg== + ws@^3.0.0, ws@^3.2.0: version "3.3.3" resolved "https://registry.yarnpkg.com/ws/-/ws-3.3.3.tgz#f1cf84fe2d5e901ebce94efaece785f187a228f2" From ee1ecd6e6c57636418e96b6def01eb1c1e4cb534 Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Mon, 19 Feb 2024 15:52:39 -0800 Subject: [PATCH 02/10] wip: wip --- packages/hdwallet-keepkey/src/ethereum.ts | 4 +- .../src/adapter.ts | 4 +- .../src/crypto/isolation/adapters/ethereum.ts | 57 ++++++++++--------- .../crypto/isolation/core/secp256k1/types.ts | 3 +- packages/hdwallet-native/src/ethereum.ts | 2 +- packages/hdwallet-tallyho/src/adapter.ts | 4 +- packages/hdwallet-xdefi/src/adapter.ts | 4 +- 7 files changed, 42 insertions(+), 36 deletions(-) diff --git a/packages/hdwallet-keepkey/src/ethereum.ts b/packages/hdwallet-keepkey/src/ethereum.ts index 797f8f61a..64edd804f 100644 --- a/packages/hdwallet-keepkey/src/ethereum.ts +++ b/packages/hdwallet-keepkey/src/ethereum.ts @@ -6,7 +6,7 @@ import * as Types from "@keepkey/device-protocol/lib/types_pb"; import { SignTypedDataVersion, TypedDataUtils } from "@metamask/eth-sig-util"; import * as core from "@shapeshiftoss/hdwallet-core"; import * as eip55 from "eip55"; -import { getBytes, isBytes, isHexString } from "ethers"; +import { getBytes, isBytesLike, isHexString } from "ethers"; import { Transport } from "./transport"; import { toUTF8Array } from "./utils"; @@ -241,7 +241,7 @@ export async function ethVerifyMessage(transport: Transport, msg: core.ETHVerify const m = new Ethereum.EthereumVerifyMessage(); m.setAddress(core.arrayify(msg.address)); m.setSignature(core.arrayify(msg.signature)); - m.setMessage(isBytes(msg.message) ? arrayify(msg.message) : toUTF8Array(msg.message)); + m.setMessage(isBytesLike(msg.message) ? getBytes(msg.message) : toUTF8Array(msg.message)); let event: core.Event; try { event = await transport.call(Messages.MessageType.MESSAGETYPE_ETHEREUMVERIFYMESSAGE, m, { diff --git a/packages/hdwallet-metamask-shapeshift-multichain/src/adapter.ts b/packages/hdwallet-metamask-shapeshift-multichain/src/adapter.ts index 11e0546cc..1e53565cd 100644 --- a/packages/hdwallet-metamask-shapeshift-multichain/src/adapter.ts +++ b/packages/hdwallet-metamask-shapeshift-multichain/src/adapter.ts @@ -2,7 +2,7 @@ import detectEthereumProvider from "@metamask/detect-provider"; import MetaMaskOnboarding from "@metamask/onboarding"; import * as core from "@shapeshiftoss/hdwallet-core"; import { enableShapeShiftSnap, shapeShiftSnapInstalled } from "@shapeshiftoss/metamask-snaps-adapter"; -import { providers } from "ethers"; +import { Eip1193Provider } from "ethers"; import { SNAP_ID } from "./common"; import { MetaMaskShapeShiftMultiChainHDWallet } from "./shapeshift-multichain"; @@ -94,7 +94,7 @@ export class MetaMaskAdapter { mustBeMetaMask: true, silent: false, timeout: 3000, - })) as providers.ExternalProvider | null; + })) as Eip1193Provider | null; if (!provider) { const onboarding = new MetaMaskOnboarding(); onboarding.startOnboarding(); diff --git a/packages/hdwallet-native/src/crypto/isolation/adapters/ethereum.ts b/packages/hdwallet-native/src/crypto/isolation/adapters/ethereum.ts index f6e4c284a..0cb159788 100644 --- a/packages/hdwallet-native/src/crypto/isolation/adapters/ethereum.ts +++ b/packages/hdwallet-native/src/crypto/isolation/adapters/ethereum.ts @@ -1,16 +1,19 @@ import * as core from "@shapeshiftoss/hdwallet-core"; import { getMessage, TypedData } from "eip-712"; -import { BigNumber, BytesLike, providers, Signature, UnsignedTransaction } from "ethers"; import { - arrayify, + BytesLike, computeAddress, - Deferrable, getAddress, - joinSignature, + getBytes, + Provider, resolveProperties, - serializeTransaction, - splitSignature, -} from "ethers/lib/utils.js"; + Signature, + SigningKey, + toQuantity, + Transaction, + TransactionLike, + TransactionRequest, +} from "ethers"; import { buildMessage } from "../../../util"; import { Isolation } from "../.."; @@ -19,14 +22,14 @@ import { SecP256K1 } from "../core"; function ethSigFromRecoverableSig(x: SecP256K1.RecoverableSignature): Signature { const sig = SecP256K1.RecoverableSignature.sig(x); const recoveryParam = SecP256K1.RecoverableSignature.recoveryParam(x); - return splitSignature(core.compatibleBufferConcat([sig, Buffer.from([recoveryParam])])); + return Signature.from(toQuantity(core.compatibleBufferConcat([sig, Buffer.from([recoveryParam])]))); } export class SignerAdapter { protected readonly nodeAdapter: Isolation.Adapters.BIP32; - readonly provider?: providers.Provider; + readonly provider?: Provider; - constructor(nodeAdapter: Isolation.Adapters.BIP32, provider?: providers.Provider) { + constructor(nodeAdapter: Isolation.Adapters.BIP32, provider?: Provider) { this.nodeAdapter = nodeAdapter; this.provider = provider; } @@ -36,13 +39,13 @@ export class SignerAdapter { // wrapper that deferred its initialization and awaited it before calling through to a "real" method, but that's // a lot of complexity just to implement this one method we don't actually use. // eslint-disable-next-line @typescript-eslint/no-unused-vars - connect(_provider: providers.Provider): never { + connect(_provider: Provider): never { throw new Error("changing providers on a SignerAdapter is unsupported"); } async getAddress(addressNList: core.BIP32Path): Promise { const nodeAdapter = await this.nodeAdapter.derivePath(core.addressNListToBIP32(addressNList)); - return computeAddress(SecP256K1.UncompressedPoint.from(nodeAdapter.getPublicKey())); + return computeAddress(new SigningKey(SecP256K1.UncompressedPoint.from(nodeAdapter.getPublicKey()))); } async signDigest(digest: BytesLike, addressNList: core.BIP32Path): Promise { @@ -50,40 +53,42 @@ export class SignerAdapter { const recoverableSig = await SecP256K1.RecoverableSignature.signCanonically( nodeAdapter.node, null, - digest instanceof Uint8Array ? digest : arrayify(digest) + digest instanceof Uint8Array ? digest : getBytes(digest) ); const sig = SecP256K1.RecoverableSignature.sig(recoverableSig); const recoveryParam = SecP256K1.RecoverableSignature.recoveryParam(recoverableSig); - return splitSignature(core.compatibleBufferConcat([sig, Buffer.from([recoveryParam])])); + return Signature.from(toQuantity(core.compatibleBufferConcat([sig, Buffer.from([recoveryParam])]))); } - async signTransaction( - transaction: Deferrable, - addressNList: core.BIP32Path - ): Promise { + async signTransaction(transaction: TransactionRequest, addressNList: core.BIP32Path): Promise { const tx = await resolveProperties(transaction); if (tx.from != null) { - if (getAddress(tx.from) !== (await this.getAddress(addressNList))) { + // This can be string | Addressable, where Addressable is an object containing getAddress() + // for ENS names. We can safely narrow it down to a string, as we do not instantiate contracts with an ens name. + if (getAddress(tx.from as string) !== (await this.getAddress(addressNList))) { throw new Error("transaction from address mismatch"); } delete tx.from; } - const unsignedTx: UnsignedTransaction = { + const unsignedTx = { ...tx, - nonce: tx.nonce !== undefined ? BigNumber.from(tx.nonce).toNumber() : undefined, - }; + nonce: tx?.nonce !== undefined ? tx!.nonce : undefined, + } as TransactionLike; const nodeAdapter = await this.nodeAdapter.derivePath(core.addressNListToBIP32(addressNList)); - const txBuf = arrayify(serializeTransaction(unsignedTx)); + const txBuf = getBytes(Transaction.from(unsignedTx).serialized); const rawSig = await SecP256K1.RecoverableSignature.signCanonically(nodeAdapter.node, "keccak256", txBuf); - return serializeTransaction(unsignedTx, ethSigFromRecoverableSig(rawSig)); + return Transaction.from({ + ...unsignedTx, + signature: ethSigFromRecoverableSig(rawSig), + }).serialized; } async signMessage(messageData: BytesLike, addressNList: core.BIP32Path): Promise { const messageBuf = buildMessage(messageData); const nodeAdapter = await this.nodeAdapter.derivePath(core.addressNListToBIP32(addressNList)); const rawSig = await SecP256K1.RecoverableSignature.signCanonically(nodeAdapter.node, "keccak256", messageBuf); - return joinSignature(ethSigFromRecoverableSig(rawSig)); + return Signature.from(ethSigFromRecoverableSig(rawSig)).serialized; } async signTypedData(typedData: TypedData, addressNList: core.BIP32Path): Promise { @@ -91,7 +96,7 @@ export class SignerAdapter { const messageArray = getMessage(typedData); const nodeAdapter = await this.nodeAdapter.derivePath(core.addressNListToBIP32(addressNList)); const rawSig = await SecP256K1.RecoverableSignature.signCanonically(nodeAdapter.node, "keccak256", messageArray); - const signature = joinSignature(ethSigFromRecoverableSig(rawSig)); + const signature = Signature.from(ethSigFromRecoverableSig(rawSig)).serialized; return { address, signature }; } } diff --git a/packages/hdwallet-native/src/crypto/isolation/core/secp256k1/types.ts b/packages/hdwallet-native/src/crypto/isolation/core/secp256k1/types.ts index 160ac9211..c896977a3 100644 --- a/packages/hdwallet-native/src/crypto/isolation/core/secp256k1/types.ts +++ b/packages/hdwallet-native/src/crypto/isolation/core/secp256k1/types.ts @@ -1,4 +1,5 @@ import * as core from "@shapeshiftoss/hdwallet-core"; +import { toQuantity } from "ethers"; import { Literal, Object as Obj, Static, Union } from "funtypes"; import PLazy from "p-lazy"; import * as tinyecc from "tiny-secp256k1"; @@ -296,7 +297,7 @@ const _recoverableSignatureStatic = { const ethSig = core.compatibleBufferConcat([sig, Buffer.from([recoveryParam])]); const ethRecovered = (await ethers).utils.recoverPublicKey( msgOrDigest, - (await ethers).utils.splitSignature(ethSig) + (await ethers).Signature.from(toQuantity(ethSig)) ); return checkType(UncompressedPoint, Buffer.from(ethRecovered.slice(2), "hex")); }, diff --git a/packages/hdwallet-native/src/ethereum.ts b/packages/hdwallet-native/src/ethereum.ts index ff35ea5ff..f0587ca6a 100644 --- a/packages/hdwallet-native/src/ethereum.ts +++ b/packages/hdwallet-native/src/ethereum.ts @@ -1,5 +1,5 @@ import * as core from "@shapeshiftoss/hdwallet-core"; -import { keccak256, parseTransaction, recoverAddress } from "ethers/lib/utils.js"; +import { keccak256, recoverAddress } from "ethers"; import * as Isolation from "./crypto/isolation"; import SignerAdapter from "./crypto/isolation/adapters/ethereum"; diff --git a/packages/hdwallet-tallyho/src/adapter.ts b/packages/hdwallet-tallyho/src/adapter.ts index 06edd9b5e..edfdbf280 100644 --- a/packages/hdwallet-tallyho/src/adapter.ts +++ b/packages/hdwallet-tallyho/src/adapter.ts @@ -1,10 +1,10 @@ import * as core from "@shapeshiftoss/hdwallet-core"; -import { providers } from "ethers"; +import { Eip1193Provider } from "ethers"; import TallyHoOnboarding from "tallyho-onboarding"; import { TallyHoHDWallet } from "./tallyho"; -interface TallyHoEthereumProvider extends providers.ExternalProvider { +interface TallyHoEthereumProvider extends Eip1193Provider { isTally?: boolean; } diff --git a/packages/hdwallet-xdefi/src/adapter.ts b/packages/hdwallet-xdefi/src/adapter.ts index df3d710e4..ba692158b 100644 --- a/packages/hdwallet-xdefi/src/adapter.ts +++ b/packages/hdwallet-xdefi/src/adapter.ts @@ -1,5 +1,5 @@ import * as core from "@shapeshiftoss/hdwallet-core"; -import { providers } from "ethers"; +import { Eip1193Provider } from "ethers"; import { XDEFIHDWallet } from "./xdefi"; @@ -7,7 +7,7 @@ declare global { // https://stackoverflow.com/questions/59459312/using-globalthis-in-typescript // Global declarations require the use of var // eslint-disable-next-line no-var - var xfi: { ethereum: providers.ExternalProvider } | null; + var xfi: { ethereum: Eip1193Provider } | null; } export class XDEFIAdapter { From babe8d91a3072cf8f9420891a25eedb99155481d Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Tue, 20 Feb 2024 10:22:59 -0800 Subject: [PATCH 03/10] feat: make it compile --- .../src/crypto/isolation/core/secp256k1/types.ts | 7 ++----- packages/hdwallet-native/src/ethereum.ts | 12 ++++++------ 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/packages/hdwallet-native/src/crypto/isolation/core/secp256k1/types.ts b/packages/hdwallet-native/src/crypto/isolation/core/secp256k1/types.ts index c896977a3..2d9c19249 100644 --- a/packages/hdwallet-native/src/crypto/isolation/core/secp256k1/types.ts +++ b/packages/hdwallet-native/src/crypto/isolation/core/secp256k1/types.ts @@ -1,5 +1,5 @@ import * as core from "@shapeshiftoss/hdwallet-core"; -import { toQuantity } from "ethers"; +import { SigningKey, toQuantity } from "ethers"; import { Literal, Object as Obj, Static, Union } from "funtypes"; import PLazy from "p-lazy"; import * as tinyecc from "tiny-secp256k1"; @@ -295,10 +295,7 @@ const _recoverableSignatureStatic = { const sig = RecoverableSignature.sig(x); const recoveryParam = RecoverableSignature.recoveryParam(x); const ethSig = core.compatibleBufferConcat([sig, Buffer.from([recoveryParam])]); - const ethRecovered = (await ethers).utils.recoverPublicKey( - msgOrDigest, - (await ethers).Signature.from(toQuantity(ethSig)) - ); + const ethRecovered = SigningKey.recoverPublicKey(msgOrDigest, (await ethers).Signature.from(toQuantity(ethSig))); return checkType(UncompressedPoint, Buffer.from(ethRecovered.slice(2), "hex")); }, r: (x: RecoverableSignature): FieldElement => Signature.r(RecoverableSignature.sig(x)), diff --git a/packages/hdwallet-native/src/ethereum.ts b/packages/hdwallet-native/src/ethereum.ts index f0587ca6a..3308b0676 100644 --- a/packages/hdwallet-native/src/ethereum.ts +++ b/packages/hdwallet-native/src/ethereum.ts @@ -1,5 +1,5 @@ import * as core from "@shapeshiftoss/hdwallet-core"; -import { keccak256, recoverAddress } from "ethers"; +import { keccak256, recoverAddress, toNumber, Transaction } from "ethers"; import * as Isolation from "./crypto/isolation"; import SignerAdapter from "./crypto/isolation/adapters/ethereum"; @@ -84,7 +84,7 @@ export function MixinNativeETHWallet Date: Thu, 22 Feb 2024 12:45:19 -0700 Subject: [PATCH 04/10] feat: more Eip1193 provider fixes --- packages/hdwallet-xdefi/src/ethereum.test.ts | 22 ++++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/hdwallet-xdefi/src/ethereum.test.ts b/packages/hdwallet-xdefi/src/ethereum.test.ts index a615e6e4a..bb86f3b97 100644 --- a/packages/hdwallet-xdefi/src/ethereum.test.ts +++ b/packages/hdwallet-xdefi/src/ethereum.test.ts @@ -1,11 +1,11 @@ import * as core from "@shapeshiftoss/hdwallet-core"; -import { providers } from "ethers"; +import { Eip1193Provider } from "ethers"; import * as ethereum from "./ethereum"; describe("XDEFI - Ethereum Adapter", () => { it("ethVerifyMessage returns null as its not implemented", async () => { - const ethereumProvider: providers.ExternalProvider = { + const ethereumProvider: Eip1193Provider = { request: jest.fn().mockReturnValue("0x3f2329C9ADFbcCd9A84f52c906E936A42dA18CB8"), }; expect( @@ -36,7 +36,7 @@ describe("XDEFI - Ethereum Adapter", () => { expect(paths).toMatchObject([]); }); it("ethSignTx returns null as its not implemented", async () => { - const ethereumProvider: providers.ExternalProvider = { + const ethereumProvider: Eip1193Provider = { request: jest.fn().mockReturnValue({ r: "0x63db3dd3bf3e1fe7dde1969c0fc8850e34116d0b501c0483a0e08c0f77b8ce0a", s: "0x28297d012cccf389f6332415e96ee3fc0bbf8474d05f646e029cd281a031464b", @@ -69,7 +69,7 @@ describe("XDEFI - Ethereum Adapter", () => { }); }); it("ethSendTx returns a valid hash", async () => { - const ethereumProvider: providers.ExternalProvider = { + const ethereumProvider: Eip1193Provider = { request: jest.fn().mockReturnValue("0x123"), }; @@ -91,7 +91,7 @@ describe("XDEFI - Ethereum Adapter", () => { expect(hash).toMatchObject({ hash: "0x123" }); }); it("ethSendTx returns a valid hash if maxFeePerGas is present in msg", async () => { - const ethereumProvider: providers.ExternalProvider = { + const ethereumProvider: Eip1193Provider = { request: jest.fn().mockReturnValue("0x123"), }; @@ -114,7 +114,7 @@ describe("XDEFI - Ethereum Adapter", () => { expect(hash).toMatchObject({ hash: "0x123" }); }); it("ethSendTx returns null on error", async () => { - const ethereumProvider: providers.ExternalProvider = { + const ethereumProvider: Eip1193Provider = { request: jest.fn().mockRejectedValue(new Error("An Error has occurred")), }; @@ -179,7 +179,7 @@ describe("XDEFI - Ethereum Adapter", () => { }); it("ethSignMessage returns a valid signature object", async () => { - const ethereumProvider: providers.ExternalProvider = { + const ethereumProvider: Eip1193Provider = { request: jest.fn().mockReturnValue( `Object { "address": "0x73d0385F4d8E00C5e6504C6030F47BF6212736A8", @@ -210,7 +210,7 @@ describe("XDEFI - Ethereum Adapter", () => { }); it("ethSignMessage returns null on error", async () => { - const ethereumProvider: providers.ExternalProvider = { + const ethereumProvider: Eip1193Provider = { request: jest.fn().mockRejectedValue(new Error("An Error has occurred")), }; @@ -228,7 +228,7 @@ describe("XDEFI - Ethereum Adapter", () => { }); it("ethGetAddress returns a valid address", async () => { - const ethereumProvider: providers.ExternalProvider = { + const ethereumProvider: Eip1193Provider = { request: jest.fn().mockReturnValue(["0x73d0385F4d8E00C5e6504C6030F47BF6212736A8"]), }; @@ -237,7 +237,7 @@ describe("XDEFI - Ethereum Adapter", () => { expect(address).toBe("0x73d0385F4d8E00C5e6504C6030F47BF6212736A8"); }); it("ethGetAddress returns null on error", async () => { - const ethereumProvider: providers.ExternalProvider = { + const ethereumProvider: Eip1193Provider = { request: jest.fn().mockRejectedValue(new Error("An error has occurred")), }; @@ -246,7 +246,7 @@ describe("XDEFI - Ethereum Adapter", () => { expect(address).toBe(null); }); it("ethGetAddress returns null if no provider", async () => { - const ethereumProvider: providers.ExternalProvider = {}; + const ethereumProvider = {} as Eip1193Provider; const address = await ethereum.ethGetAddress(ethereumProvider); From 2e71c994aca9cf7eda726151dabcd7764654b676 Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Thu, 22 Feb 2024 16:09:16 -0700 Subject: [PATCH 05/10] feat: parseTransaction -> Transaction.from --- packages/hdwallet-native/src/ethereum.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/hdwallet-native/src/ethereum.test.ts b/packages/hdwallet-native/src/ethereum.test.ts index bdc421b0b..fd5ef00e7 100644 --- a/packages/hdwallet-native/src/ethereum.test.ts +++ b/packages/hdwallet-native/src/ethereum.test.ts @@ -1,5 +1,5 @@ import * as core from "@shapeshiftoss/hdwallet-core"; -import { parseTransaction } from "ethers"; +import { Transaction } from "ethers"; import * as native from "./native"; @@ -152,7 +152,7 @@ describe("NativeETHWallet", () => { "v": 38, } `);*/ - expect(parseTransaction(sig!.serialized).from).toEqual("0x73d0385F4d8E00C5e6504C6030F47BF6212736A8"); + expect(Transaction.from(sig!.serialized).from).toEqual("0x73d0385F4d8E00C5e6504C6030F47BF6212736A8"); }); it("should sign a EIP-1559 transaction correctly", async () => { @@ -186,7 +186,7 @@ describe("NativeETHWallet", () => { "v": 38, } `);*/ - expect(parseTransaction(sig!.serialized).from).toEqual("0x73d0385F4d8E00C5e6504C6030F47BF6212736A8"); + expect(Transaction.from(sig!.serialized).from).toEqual("0x73d0385F4d8E00C5e6504C6030F47BF6212736A8"); }); describe("sign and verify message", () => { From b053d3ceb1d08d4751c6664166d2ac7d0ce95f5d Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Mon, 26 Feb 2024 09:14:09 -0700 Subject: [PATCH 06/10] feat: add viem to hdwallet-native --- packages/hdwallet-native/package.json | 1 + yarn.lock | 60 ++++++++++++++++++++++++--- 2 files changed, 55 insertions(+), 6 deletions(-) diff --git a/packages/hdwallet-native/package.json b/packages/hdwallet-native/package.json index ed389d6fc..034ce93e7 100644 --- a/packages/hdwallet-native/package.json +++ b/packages/hdwallet-native/package.json @@ -36,6 +36,7 @@ "scrypt-js": "^3.0.1", "tendermint-tx-builder": "^1.0.9", "tiny-secp256k1": "^1.1.6", + "viem": "^1.16.6", "web-encoding": "^1.1.0" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index b23add6bd..3510ead00 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,11 @@ # yarn lockfile v1 +"@adraffy/ens-normalize@1.10.0": + version "1.10.0" + resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.10.0.tgz#d2a39395c587e092d77cbbc80acf956a54f38bf7" + integrity sha512-nA9XHtlAkYfJxY7bce8DcN7eKxWWCWkU+1GR9d+U6MbNpfwQp8TI7vqOsBsMcHoT4mBu2kypKoSKnghEzOOq5Q== + "@adraffy/ens-normalize@1.10.1": version "1.10.1" resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz#63430d04bd8c5e74f8d7d049338f1cd9d4f02069" @@ -3896,7 +3901,7 @@ dependencies: "@noble/hashes" "1.3.1" -"@noble/curves@1.2.0": +"@noble/curves@1.2.0", "@noble/curves@~1.2.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.2.0.tgz#92d7e12e4e49b23105a2555c6984d41733d65c35" integrity sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw== @@ -3940,6 +3945,11 @@ resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.1.5.tgz#1a0377f3b9020efe2fae03290bd2a12140c95c11" integrity sha512-LTMZiiLc+V4v1Yi16TD6aX2gmtKszNye0pQgbaLqkvhIqP7nVsSaJsWloGQjJfJ8offaoP5GtX3yY5swbcJxxQ== +"@noble/hashes@~1.3.2": + version "1.3.3" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.3.tgz#39908da56a4adc270147bb07968bf3b16cfe1699" + integrity sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA== + "@noble/secp256k1@^1.5.5", "@noble/secp256k1@^1.7.1": version "1.7.1" resolved "https://registry.yarnpkg.com/@noble/secp256k1/-/secp256k1-1.7.1.tgz#b251c70f824ce3ca7f8dc3df08d58f005cc0507c" @@ -5119,6 +5129,11 @@ resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.3.tgz#8584115565228290a6c6c4961973e0903bb3df2f" integrity sha512-/+SgoRjLq7Xlf0CWuLHq2LUZeL/w65kfzAPG5NH9pcmBhs+nunQTn4gvdwgMTIXnt9b2C/1SeL2XiysZEyIC9Q== +"@scure/base@~1.1.2": + version "1.1.5" + resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.5.tgz#1d85d17269fe97694b9c592552dd9e5e33552157" + integrity sha512-Brj9FiG2W1MRQSTB212YVPRrcbjkv48FoZi/u4l/zds/ieRrqsh7aUf6CLwkAq61oKXr/ZlTzlY66gLIj3TFTQ== + "@scure/bip32@1.3.1": version "1.3.1" resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.3.1.tgz#7248aea723667f98160f593d621c47e208ccbb10" @@ -5128,6 +5143,15 @@ "@noble/hashes" "~1.3.1" "@scure/base" "~1.1.0" +"@scure/bip32@1.3.2": + version "1.3.2" + resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.3.2.tgz#90e78c027d5e30f0b22c1f8d50ff12f3fb7559f8" + integrity sha512-N1ZhksgwD3OBlwTv3R6KFEcPojl/W4ElJOeCZdi+vuI5QmTFwLq3OFf2zd2ROpKvxFdgZ6hUpb0dx9bVNEwYCA== + dependencies: + "@noble/curves" "~1.2.0" + "@noble/hashes" "~1.3.2" + "@scure/base" "~1.1.2" + "@scure/bip39@1.2.1": version "1.2.1" resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.2.1.tgz#5cee8978656b272a917b7871c981e0541ad6ac2a" @@ -6961,6 +6985,11 @@ abbrev@1, abbrev@^1.0.0: resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== +abitype@0.9.8: + version "0.9.8" + resolved "https://registry.yarnpkg.com/abitype/-/abitype-0.9.8.tgz#1f120b6b717459deafd213dfbf3a3dd1bf10ae8c" + integrity sha512-puLifILdm+8sjyss4S+fsUN09obiT1g2YW6CtcQF+QDzxR0euzgEB29MZujC6zMk2a6SVmtttq1fc6+YFA7WYQ== + abortcontroller-polyfill@^1.1.9: version "1.7.3" resolved "https://registry.yarnpkg.com/abortcontroller-polyfill/-/abortcontroller-polyfill-1.7.3.tgz#1b5b487bd6436b5b764fd52a612509702c3144b5" @@ -13092,6 +13121,11 @@ isomorphic-ws@^4.0.1: resolved "https://registry.yarnpkg.com/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz#55fd4cd6c5e6491e76dc125938dd863f5cd4f2dc" integrity sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w== +isows@1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/isows/-/isows-1.0.3.tgz#93c1cf0575daf56e7120bab5c8c448b0809d0d74" + integrity sha512-2cKei4vlmg2cxEjm3wVSqn8pcoRF/LX/wpifuuNquFO4SQmPwarClT+SUCA2lt+l581tTeZIPIZuIDo2jWN1fg== + isstream@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" @@ -19682,6 +19716,20 @@ verror@1.10.0: core-util-is "1.0.2" extsprintf "^1.2.0" +viem@^1.16.6: + version "1.21.4" + resolved "https://registry.yarnpkg.com/viem/-/viem-1.21.4.tgz#883760e9222540a5a7e0339809202b45fe6a842d" + integrity sha512-BNVYdSaUjeS2zKQgPs+49e5JKocfo60Ib2yiXOWBT6LuVxY1I/6fFX3waEtpXvL1Xn4qu+BVitVtMh9lyThyhQ== + dependencies: + "@adraffy/ens-normalize" "1.10.0" + "@noble/curves" "1.2.0" + "@noble/hashes" "1.3.2" + "@scure/bip32" "1.3.2" + "@scure/bip39" "1.2.1" + abitype "0.9.8" + isows "1.0.3" + ws "8.13.0" + vscode-textmate@5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-5.2.0.tgz#01f01760a391e8222fe4f33fbccbd1ad71aed74e" @@ -20332,6 +20380,11 @@ ws@7.5.3, ws@^7.0.0, ws@^7.4.5: resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.3.tgz#160835b63c7d97bfab418fc1b8a9fced2ac01a74" integrity sha512-kQ/dHIzuLrS6Je9+uv81ueZomEwH0qVYstcAQ4/Z93K8zeko9gtAbttJWzoC5ukqXY1PpoouV3+VSOqEAFt5wg== +ws@8.13.0, ws@^8.5.0: + version "8.13.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.13.0.tgz#9a9fb92f93cf41512a0735c8f4dd09b8a1211cd0" + integrity sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA== + ws@8.5.0: version "8.5.0" resolved "https://registry.yarnpkg.com/ws/-/ws-8.5.0.tgz#bfb4be96600757fe5382de12c670dab984a1ed4f" @@ -20368,11 +20421,6 @@ ws@^8.3.0, ws@^8.8.0: resolved "https://registry.yarnpkg.com/ws/-/ws-8.14.2.tgz#6c249a806eb2db7a20d26d51e7709eab7b2e6c7f" integrity sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g== -ws@^8.5.0: - version "8.13.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.13.0.tgz#9a9fb92f93cf41512a0735c8f4dd09b8a1211cd0" - integrity sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA== - xhr-request-promise@^0.1.2: version "0.1.3" resolved "https://registry.yarnpkg.com/xhr-request-promise/-/xhr-request-promise-0.1.3.tgz#2d5f4b16d8c6c893be97f1a62b0ed4cf3ca5f96c" From a61fda0682fb011bdce760fdb08a71bac43e70b8 Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Mon, 26 Feb 2024 09:23:38 -0700 Subject: [PATCH 07/10] feat: use viem signing utils --- .../src/crypto/isolation/adapters/ethereum.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/hdwallet-native/src/crypto/isolation/adapters/ethereum.ts b/packages/hdwallet-native/src/crypto/isolation/adapters/ethereum.ts index 0cb159788..2cdfa58ac 100644 --- a/packages/hdwallet-native/src/crypto/isolation/adapters/ethereum.ts +++ b/packages/hdwallet-native/src/crypto/isolation/adapters/ethereum.ts @@ -7,13 +7,13 @@ import { getBytes, Provider, resolveProperties, - Signature, SigningKey, toQuantity, Transaction, TransactionLike, TransactionRequest, } from "ethers"; +import { hexToSignature, Signature, signatureToHex, toHex } from "viem"; import { buildMessage } from "../../../util"; import { Isolation } from "../.."; @@ -22,7 +22,7 @@ import { SecP256K1 } from "../core"; function ethSigFromRecoverableSig(x: SecP256K1.RecoverableSignature): Signature { const sig = SecP256K1.RecoverableSignature.sig(x); const recoveryParam = SecP256K1.RecoverableSignature.recoveryParam(x); - return Signature.from(toQuantity(core.compatibleBufferConcat([sig, Buffer.from([recoveryParam])]))); + return hexToSignature(toHex(core.compatibleBufferConcat([sig, Buffer.from([recoveryParam])]))); } export class SignerAdapter { @@ -57,7 +57,7 @@ export class SignerAdapter { ); const sig = SecP256K1.RecoverableSignature.sig(recoverableSig); const recoveryParam = SecP256K1.RecoverableSignature.recoveryParam(recoverableSig); - return Signature.from(toQuantity(core.compatibleBufferConcat([sig, Buffer.from([recoveryParam])]))); + return hexToSignature(toHex(core.compatibleBufferConcat([sig, Buffer.from([recoveryParam])]))); } async signTransaction(transaction: TransactionRequest, addressNList: core.BIP32Path): Promise { @@ -88,7 +88,7 @@ export class SignerAdapter { const messageBuf = buildMessage(messageData); const nodeAdapter = await this.nodeAdapter.derivePath(core.addressNListToBIP32(addressNList)); const rawSig = await SecP256K1.RecoverableSignature.signCanonically(nodeAdapter.node, "keccak256", messageBuf); - return Signature.from(ethSigFromRecoverableSig(rawSig)).serialized; + return signatureToHex(ethSigFromRecoverableSig(rawSig)); } async signTypedData(typedData: TypedData, addressNList: core.BIP32Path): Promise { @@ -96,7 +96,7 @@ export class SignerAdapter { const messageArray = getMessage(typedData); const nodeAdapter = await this.nodeAdapter.derivePath(core.addressNListToBIP32(addressNList)); const rawSig = await SecP256K1.RecoverableSignature.signCanonically(nodeAdapter.node, "keccak256", messageArray); - const signature = Signature.from(ethSigFromRecoverableSig(rawSig)).serialized; + const signature = signatureToHex(ethSigFromRecoverableSig(rawSig)); return { address, signature }; } } From 9fc699ecd7b58806c48baad48fe9f800f3f7c80f Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Mon, 26 Feb 2024 09:35:17 -0700 Subject: [PATCH 08/10] fix: lint --- .../hdwallet-native/src/crypto/isolation/adapters/ethereum.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/hdwallet-native/src/crypto/isolation/adapters/ethereum.ts b/packages/hdwallet-native/src/crypto/isolation/adapters/ethereum.ts index 2cdfa58ac..f079b3560 100644 --- a/packages/hdwallet-native/src/crypto/isolation/adapters/ethereum.ts +++ b/packages/hdwallet-native/src/crypto/isolation/adapters/ethereum.ts @@ -8,7 +8,6 @@ import { Provider, resolveProperties, SigningKey, - toQuantity, Transaction, TransactionLike, TransactionRequest, From 769253686d1b4df1798728de3767ef3a6c28db82 Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Mon, 26 Feb 2024 09:39:19 -0700 Subject: [PATCH 09/10] feat: isHexString -> isHex --- packages/hdwallet-coinbase/src/ethereum.ts | 4 ++-- packages/hdwallet-keepkey/src/ethereum.ts | 5 +++-- packages/hdwallet-ledger/src/ethereum.ts | 4 ++-- .../hdwallet-metamask-shapeshift-multichain/src/ethereum.ts | 4 ++-- packages/hdwallet-metamask/src/ethereum.ts | 4 ++-- packages/hdwallet-native/src/util.ts | 5 +++-- packages/hdwallet-portis/src/ethereum.ts | 4 ++-- packages/hdwallet-tallyho/src/ethereum.ts | 4 ++-- packages/hdwallet-trezor/src/ethereum.ts | 4 ++-- packages/hdwallet-walletconnect/src/ethereum.ts | 5 +++-- packages/hdwallet-walletconnectV2/src/ethereum.ts | 4 ++-- packages/hdwallet-xdefi/src/ethereum.ts | 4 ++-- 12 files changed, 27 insertions(+), 24 deletions(-) diff --git a/packages/hdwallet-coinbase/src/ethereum.ts b/packages/hdwallet-coinbase/src/ethereum.ts index 348ce50e3..6337ec8a8 100644 --- a/packages/hdwallet-coinbase/src/ethereum.ts +++ b/packages/hdwallet-coinbase/src/ethereum.ts @@ -1,6 +1,6 @@ import * as core from "@shapeshiftoss/hdwallet-core"; import { ETHSignedMessage } from "@shapeshiftoss/hdwallet-core"; -import { isHexString } from "ethers"; +import { isHex } from "viem"; export function describeETHPath(path: core.BIP32Path): core.PathDescription { return core.describeETHPath(path); @@ -86,7 +86,7 @@ export async function ethSignMessage( address: string ): Promise { try { - if (!isHexString(msg.message)) throw new Error("data is not an hex string"); + if (!isHex(msg.message)) throw new Error("data is not an hex string"); const signedMsg = await ethereum.request({ method: "personal_sign", params: [msg, address], diff --git a/packages/hdwallet-keepkey/src/ethereum.ts b/packages/hdwallet-keepkey/src/ethereum.ts index 64edd804f..989e1cfbb 100644 --- a/packages/hdwallet-keepkey/src/ethereum.ts +++ b/packages/hdwallet-keepkey/src/ethereum.ts @@ -6,7 +6,8 @@ import * as Types from "@keepkey/device-protocol/lib/types_pb"; import { SignTypedDataVersion, TypedDataUtils } from "@metamask/eth-sig-util"; import * as core from "@shapeshiftoss/hdwallet-core"; import * as eip55 from "eip55"; -import { getBytes, isBytesLike, isHexString } from "ethers"; +import { getBytes, isBytesLike } from "ethers"; +import { isHex } from "viem"; import { Transport } from "./transport"; import { toUTF8Array } from "./utils"; @@ -173,7 +174,7 @@ export async function ethGetAddress(transport: Transport, msg: core.ETHGetAddres export async function ethSignMessage(transport: Transport, msg: core.ETHSignMessage): Promise { const { addressNList, message } = msg; - if (!isHexString(message)) throw new Error("data is not an hex string"); + if (!isHex(message)) throw new Error("data is not an hex string"); const m = new Ethereum.EthereumSignMessage(); m.setAddressNList(addressNList); const messageBytes = getBytes(message); diff --git a/packages/hdwallet-ledger/src/ethereum.ts b/packages/hdwallet-ledger/src/ethereum.ts index 10a481b24..9fc16b17c 100644 --- a/packages/hdwallet-ledger/src/ethereum.ts +++ b/packages/hdwallet-ledger/src/ethereum.ts @@ -7,7 +7,7 @@ import EthereumTx from "ethereumjs-tx"; // TODO: fix ts-ignore import * as ethereumUtil from "ethereumjs-util"; import { getBytes, isBytesLike } from "ethers"; -import { isHexString } from "ethjs-util"; +import { isHex } from "viem"; import { LedgerTransport } from "./transport"; import { compressPublicKey, createXpub, handleError, networksUtil } from "./utils"; @@ -159,7 +159,7 @@ export async function ethSignMessage( ): Promise { const bip32path = core.addressNListToBIP32(msg.addressNList); - if (!isHexString(msg.message)) throw new Error("data is not an hex string"); + if (!isHex(msg.message)) throw new Error("data is not an hex string"); // Ledger's inner implementation does a Buffer.from(messageHex, "hex").length on our message // However, Buffer.from method with the "hex" encoding expects a valid hexadecimal string without the 0x prefix diff --git a/packages/hdwallet-metamask-shapeshift-multichain/src/ethereum.ts b/packages/hdwallet-metamask-shapeshift-multichain/src/ethereum.ts index e6dd048d6..3399848a5 100644 --- a/packages/hdwallet-metamask-shapeshift-multichain/src/ethereum.ts +++ b/packages/hdwallet-metamask-shapeshift-multichain/src/ethereum.ts @@ -1,6 +1,6 @@ import * as core from "@shapeshiftoss/hdwallet-core"; import { ETHSignedMessage } from "@shapeshiftoss/hdwallet-core"; -import { isHexString } from "ethers"; +import { isHex } from "viem"; // eslint-disable-next-line @typescript-eslint/no-unused-vars export async function ethVerifyMessage(msg: core.ETHVerifyMessage, ethereum: any): Promise { @@ -71,7 +71,7 @@ export async function ethSignMessage( address: string ): Promise { try { - if (!isHexString(msg.message)) throw new Error("data is not an hex string"); + if (!isHex(msg.message)) throw new Error("data is not an hex string"); const signedMsg = await ethereum.request({ method: "personal_sign", params: [msg.message, address], diff --git a/packages/hdwallet-metamask/src/ethereum.ts b/packages/hdwallet-metamask/src/ethereum.ts index ed9f27adc..bb8285b4d 100644 --- a/packages/hdwallet-metamask/src/ethereum.ts +++ b/packages/hdwallet-metamask/src/ethereum.ts @@ -1,6 +1,6 @@ import * as core from "@shapeshiftoss/hdwallet-core"; import { ETHSignedMessage } from "@shapeshiftoss/hdwallet-core"; -import { isHexString } from "ethers"; +import { isHex } from "viem"; export function describeETHPath(path: core.BIP32Path): core.PathDescription { const pathStr = core.addressNListToBIP32(path); @@ -101,7 +101,7 @@ export async function ethSignMessage( address: string ): Promise { try { - if (!isHexString(msg.message)) throw new Error("data is not an hex string"); + if (!isHex(msg.message)) throw new Error("data is not an hex string"); const signedMsg = await ethereum.request({ method: "personal_sign", params: [msg.message, address], diff --git a/packages/hdwallet-native/src/util.ts b/packages/hdwallet-native/src/util.ts index c19053d7d..0fcbf1cd4 100644 --- a/packages/hdwallet-native/src/util.ts +++ b/packages/hdwallet-native/src/util.ts @@ -1,6 +1,7 @@ import * as core from "@shapeshiftoss/hdwallet-core"; import type { BytesLike } from "ethers"; -import { concat, getBytes, isHexString, toUtf8Bytes } from "ethers"; +import { concat, getBytes, toUtf8Bytes } from "ethers"; +import { isHex } from "viem"; import { BTCScriptType } from "./bitcoin"; import * as Isolation from "./crypto/isolation"; @@ -19,7 +20,7 @@ export async function getKeyPair( } export function buildMessage(message: BytesLike): Uint8Array { - const messageBytes = typeof message === "string" && !isHexString(message) ? toUtf8Bytes(message) : getBytes(message); + const messageBytes = typeof message === "string" && !isHex(message) ? toUtf8Bytes(message) : getBytes(message); return getBytes( concat([toUtf8Bytes("\x19Ethereum Signed Message:\n"), toUtf8Bytes(String(messageBytes.length)), messageBytes]) diff --git a/packages/hdwallet-portis/src/ethereum.ts b/packages/hdwallet-portis/src/ethereum.ts index fd7c1cd2f..50983f111 100644 --- a/packages/hdwallet-portis/src/ethereum.ts +++ b/packages/hdwallet-portis/src/ethereum.ts @@ -1,5 +1,5 @@ import * as core from "@shapeshiftoss/hdwallet-core"; -import { isHexString } from "ethers"; +import { isHex } from "viem"; export function describeETHPath(path: core.BIP32Path): core.PathDescription { const pathStr = core.addressNListToBIP32(path); @@ -72,7 +72,7 @@ export async function ethSignMessage( web3: any, address: string ): Promise { - if (!isHexString(msg.message)) throw new Error("data is not an hex string"); + if (!isHex(msg.message)) throw new Error("data is not an hex string"); const result = await web3.eth.sign(msg.message, address); return { address, diff --git a/packages/hdwallet-tallyho/src/ethereum.ts b/packages/hdwallet-tallyho/src/ethereum.ts index 2b5ba0132..cb8139787 100644 --- a/packages/hdwallet-tallyho/src/ethereum.ts +++ b/packages/hdwallet-tallyho/src/ethereum.ts @@ -1,5 +1,5 @@ import * as core from "@shapeshiftoss/hdwallet-core"; -import { isHexString } from "ethers"; +import { isHex } from "viem"; export function describeETHPath(path: core.BIP32Path): core.PathDescription { const pathStr = core.addressNListToBIP32(path); @@ -100,7 +100,7 @@ export async function ethSignMessage( address: string ): Promise { try { - if (!isHexString(msg.message)) throw new Error("data is not an hex string"); + if (!isHex(msg.message)) throw new Error("data is not an hex string"); const signedMsg = await ethereum.request({ method: "personal_sign", params: [msg.message, address], diff --git a/packages/hdwallet-trezor/src/ethereum.ts b/packages/hdwallet-trezor/src/ethereum.ts index 65fb8a342..0e2f6548c 100644 --- a/packages/hdwallet-trezor/src/ethereum.ts +++ b/packages/hdwallet-trezor/src/ethereum.ts @@ -1,7 +1,7 @@ import Common from "@ethereumjs/common"; import { Transaction } from "@ethereumjs/tx"; import * as core from "@shapeshiftoss/hdwallet-core"; -import { isHexString } from "ethers"; +import { isHex } from "viem"; import { TrezorTransport } from "./transport"; import { handleError } from "./utils"; @@ -74,7 +74,7 @@ export async function ethSignMessage( transport: TrezorTransport, msg: core.ETHSignMessage ): Promise { - if (!isHexString(msg.message)) throw new Error("data is not an hex string"); + if (!isHex(msg.message)) throw new Error("data is not an hex string"); const res = await transport.call("ethereumSignMessage", { path: msg.addressNList, message: msg.message, diff --git a/packages/hdwallet-walletconnect/src/ethereum.ts b/packages/hdwallet-walletconnect/src/ethereum.ts index 1b5cab3d2..5dbb4c74f 100644 --- a/packages/hdwallet-walletconnect/src/ethereum.ts +++ b/packages/hdwallet-walletconnect/src/ethereum.ts @@ -1,5 +1,6 @@ import * as core from "@shapeshiftoss/hdwallet-core"; -import { BytesLike, isHexString } from "ethers"; +import { BytesLike } from "ethers"; +import { isHex } from "viem"; export function describeETHPath(path: core.BIP32Path): core.PathDescription { const pathStr = core.addressNListToBIP32(path); @@ -54,7 +55,7 @@ export async function ethSignMessage( args: { data: BytesLike; fromAddress: string }, provider: any ): Promise { - if (!isHexString(args.data)) throw new Error("data is not an hex string"); + if (!isHex(args.data)) throw new Error("data is not an hex string"); return await provider.wc.signMessage([args.data, args.fromAddress]); } diff --git a/packages/hdwallet-walletconnectV2/src/ethereum.ts b/packages/hdwallet-walletconnectV2/src/ethereum.ts index d9e739ef3..27e35fb46 100644 --- a/packages/hdwallet-walletconnectV2/src/ethereum.ts +++ b/packages/hdwallet-walletconnectV2/src/ethereum.ts @@ -9,7 +9,7 @@ import type { } from "@shapeshiftoss/hdwallet-core"; import { addressNListToBIP32, slip44ByCoin } from "@shapeshiftoss/hdwallet-core"; import EthereumProvider from "@walletconnect/ethereum-provider"; -import { isHexString } from "ethers"; +import { isHex } from "viem"; const getUnsignedTxFromMessage = (msg: ETHSignTx & { from: string }) => { const utxBase = { @@ -86,7 +86,7 @@ export async function ethSignMessage( args: { data: string; fromAddress: string }, provider: EthereumProvider ): Promise { - if (!isHexString(args.data)) throw new Error("data is not an hex string"); + if (!isHex(args.data)) throw new Error("data is not an hex string"); const signedMsg: string = await provider.request({ method: "personal_sign", diff --git a/packages/hdwallet-xdefi/src/ethereum.ts b/packages/hdwallet-xdefi/src/ethereum.ts index 5d91e7b36..43bda921c 100644 --- a/packages/hdwallet-xdefi/src/ethereum.ts +++ b/packages/hdwallet-xdefi/src/ethereum.ts @@ -1,6 +1,6 @@ import * as core from "@shapeshiftoss/hdwallet-core"; import { ETHSignedMessage } from "@shapeshiftoss/hdwallet-core"; -import { isHexString } from "ethers"; +import { isHex } from "viem"; export async function ethVerifyMessage(msg: core.ETHVerifyMessage, ethereum: any): Promise { const recoveredAddress = await ethereum.request({ @@ -72,7 +72,7 @@ export async function ethSignMessage( address: string ): Promise { try { - if (!isHexString(msg.message)) throw new Error("data is not an hex string"); + if (!isHex(msg.message)) throw new Error("data is not an hex string"); const signedMsg = await ethereum.request({ method: "personal_sign", params: [msg.message, address], From 3597335821a102c38384f744fa40cb2bf6e7b22f Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Mon, 26 Feb 2024 09:51:39 -0700 Subject: [PATCH 10/10] chore: trigger CI