Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feat_unrug_snaps_in…
Browse files Browse the repository at this point in the history
…tegrity
  • Loading branch information
gomesalexandre committed Oct 3, 2023
2 parents 778b8c0 + b2d5707 commit f21593c
Show file tree
Hide file tree
Showing 50 changed files with 163 additions and 175 deletions.
32 changes: 16 additions & 16 deletions examples/sandbox/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shapeshiftoss/hdwallet-sandbox",
"version": "1.50.10",
"version": "1.51.0",
"license": "MIT",
"private": true,
"browserslist": "> 0.5%, last 2 versions, not dead",
Expand All @@ -10,21 +10,21 @@
"clean": "rm -rf dist node_modules public .parcel-cache"
},
"dependencies": {
"@shapeshiftoss/hdwallet-core": "1.50.10",
"@shapeshiftoss/hdwallet-keepkey-tcp": "1.50.10",
"@shapeshiftoss/hdwallet-keepkey-webusb": "1.50.10",
"@shapeshiftoss/hdwallet-keplr": "1.50.10",
"@shapeshiftoss/hdwallet-ledger": "1.50.10",
"@shapeshiftoss/hdwallet-ledger-webhid": "1.50.10",
"@shapeshiftoss/hdwallet-ledger-webusb": "1.50.10",
"@shapeshiftoss/hdwallet-metamask": "1.50.10",
"@shapeshiftoss/hdwallet-native": "1.50.10",
"@shapeshiftoss/hdwallet-portis": "1.50.10",
"@shapeshiftoss/hdwallet-tallyho": "1.50.10",
"@shapeshiftoss/hdwallet-trezor": "1.50.10",
"@shapeshiftoss/hdwallet-trezor-connect": "1.50.10",
"@shapeshiftoss/hdwallet-walletconnect": "1.50.10",
"@shapeshiftoss/hdwallet-xdefi": "1.50.10",
"@shapeshiftoss/hdwallet-core": "1.51.0",
"@shapeshiftoss/hdwallet-keepkey-tcp": "1.51.0",
"@shapeshiftoss/hdwallet-keepkey-webusb": "1.51.0",
"@shapeshiftoss/hdwallet-keplr": "1.51.0",
"@shapeshiftoss/hdwallet-ledger": "1.51.0",
"@shapeshiftoss/hdwallet-ledger-webhid": "1.51.0",
"@shapeshiftoss/hdwallet-ledger-webusb": "1.51.0",
"@shapeshiftoss/hdwallet-metamask": "1.51.0",
"@shapeshiftoss/hdwallet-native": "1.51.0",
"@shapeshiftoss/hdwallet-portis": "1.51.0",
"@shapeshiftoss/hdwallet-tallyho": "1.51.0",
"@shapeshiftoss/hdwallet-trezor": "1.51.0",
"@shapeshiftoss/hdwallet-trezor-connect": "1.51.0",
"@shapeshiftoss/hdwallet-walletconnect": "1.51.0",
"@shapeshiftoss/hdwallet-xdefi": "1.51.0",
"bip32": "^2.0.4",
"jquery": "^3.4.1",
"json": "^9.0.6",
Expand Down
20 changes: 10 additions & 10 deletions integration/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shapeshiftoss/integration",
"version": "1.50.10",
"version": "1.51.0",
"main": "index.js",
"license": "MIT",
"private": true,
Expand All @@ -10,15 +10,15 @@
"dev": "lerna run test --scope integration --parallel --include-filtered-dependencies"
},
"dependencies": {
"@shapeshiftoss/hdwallet-core": "1.50.10",
"@shapeshiftoss/hdwallet-keepkey": "1.50.10",
"@shapeshiftoss/hdwallet-keepkey-nodewebusb": "1.50.10",
"@shapeshiftoss/hdwallet-keepkey-tcp": "1.50.10",
"@shapeshiftoss/hdwallet-ledger": "1.50.10",
"@shapeshiftoss/hdwallet-native": "1.50.10",
"@shapeshiftoss/hdwallet-portis": "1.50.10",
"@shapeshiftoss/hdwallet-trezor": "1.50.10",
"@shapeshiftoss/hdwallet-xdefi": "1.50.10",
"@shapeshiftoss/hdwallet-core": "1.51.0",
"@shapeshiftoss/hdwallet-keepkey": "1.51.0",
"@shapeshiftoss/hdwallet-keepkey-nodewebusb": "1.51.0",
"@shapeshiftoss/hdwallet-keepkey-tcp": "1.51.0",
"@shapeshiftoss/hdwallet-ledger": "1.51.0",
"@shapeshiftoss/hdwallet-native": "1.51.0",
"@shapeshiftoss/hdwallet-portis": "1.51.0",
"@shapeshiftoss/hdwallet-trezor": "1.51.0",
"@shapeshiftoss/hdwallet-xdefi": "1.51.0",
"fast-json-stable-stringify": "^2.1.0",
"msw": "^0.27.1",
"whatwg-fetch": "^3.6.2"
Expand Down
2 changes: 1 addition & 1 deletion integration/src/ethereum/ethereum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ export function ethereumTests(get: () => { wallet: core.HDWallet; info: core.HDW
if (ledger.isLedger(wallet)) return; // FIXME: Expected failure
const res = await wallet.ethSignMessage({
addressNList: core.bip32ToAddressNList("m/44'/60'/0'/0/0"),
message: "Hello World",
message: "0x48656c6c6f20576f726c64", // "Hello World",
});
expect(res?.address).toEqual("0x3f2329C9ADFbcCd9A84f52c906E936A42dA18CB8");
expect(res?.signature).toEqual(
Expand Down
4 changes: 2 additions & 2 deletions integration/src/wallets/metamask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export async function createWallet(): Promise<core.HDWallet> {
case "personal_sign": {
const [message] = params;

if (message === "48656c6c6f20576f726c64")
if (message === "48656c6c6f20576f726c64" || message === "0x48656c6c6f20576f726c64")
return "0x29f7212ecc1c76cea81174af267b67506f754ea8c73f144afa900a0d85b24b21319621aeb062903e856352f38305710190869c3ce5a1425d65ef4fa558d0fc251b";

throw new Error("unknown message");
Expand Down Expand Up @@ -161,7 +161,7 @@ export function selfTest(get: () => core.HDWallet): void {
if (!wallet) return;
const res = await wallet.ethSignMessage({
addressNList: core.bip32ToAddressNList("m/44'/60'/0'/0/0"),
message: "Hello World",
message: "0x48656c6c6f20576f726c64", // "Hello World"
});
expect(res?.address).toEqual("0x3f2329C9ADFbcCd9A84f52c906E936A42dA18CB8");
expect(res?.signature).toEqual(
Expand Down
2 changes: 1 addition & 1 deletion integration/src/wallets/trezor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class MockTransport extends trezor.TrezorTransport {
"ethereumSignMessage",
{
path: [2147483692, 2147483708, 2147483648, 0, 0],
message: "Hello World",
message: "0x48656c6c6f20576f726c64", // "Hello World"
},
{
success: true,
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"lerna": "5.2.0",
"version": "1.50.10",
"version": "1.51.0",
"npmClient": "yarn",
"useWorkspaces": true,
"command": {
Expand Down
4 changes: 2 additions & 2 deletions packages/hdwallet-coinbase/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shapeshiftoss/hdwallet-coinbase",
"version": "1.50.10",
"version": "1.51.0",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -15,7 +15,7 @@
},
"dependencies": {
"@coinbase/wallet-sdk": "^3.6.6",
"@shapeshiftoss/hdwallet-core": "1.50.10",
"@shapeshiftoss/hdwallet-core": "1.51.0",
"eth-rpc-errors": "^4.0.3",
"lodash": "^4.17.21"
},
Expand Down
6 changes: 3 additions & 3 deletions packages/hdwallet-coinbase/src/coinbase.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe("CoinbaseHDWallet", () => {
}`
),
} as any;
const msg = "super secret message";
const msg = "0x737570657220736563726574206d657373616765"; // super secret message
expect(
await wallet.ethSignMessage({
addressNList: core.bip32ToAddressNList("m/44'/60'/0'/0/0"),
Expand All @@ -73,7 +73,7 @@ describe("CoinbaseHDWallet", () => {
request: jest.fn().mockRejectedValue(new Error("An Error has occurred")),
} as any;

const msg = "super secret message";
const msg = "0x737570657220736563726574206d657373616765"; // super secret message
const sig = await wallet.ethSignMessage({
addressNList: core.bip32ToAddressNList("m/44'/60'/0'/0/0"),
message: msg,
Expand All @@ -87,7 +87,7 @@ describe("CoinbaseHDWallet", () => {
request: jest.fn().mockReturnValue(["0x73d0385F4d8E00C5e6504C6030F47BF6212736A8"]),
} as any;

const msg = "super secret message";
const msg = "0x737570657220736563726574206d657373616765"; // super secret message
const sig = await wallet.ethSignMessage({
addressNList: core.bip32ToAddressNList("m/44'/60'/0'/0/0"),
message: msg,
Expand Down
8 changes: 3 additions & 5 deletions packages/hdwallet-coinbase/src/ethereum.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as core from "@shapeshiftoss/hdwallet-core";
import { ETHSignedMessage } from "@shapeshiftoss/hdwallet-core";
import * as ethers from "ethers";
import { isHexString } from "ethers/lib/utils";

export function describeETHPath(path: core.BIP32Path): core.PathDescription {
return core.describeETHPath(path);
Expand Down Expand Up @@ -86,12 +86,10 @@ export async function ethSignMessage(
address: string
): Promise<core.ETHSignedMessage | null> {
try {
const buffer = ethers.utils.isBytes(msg.message)
? Buffer.from(ethers.utils.arrayify(msg.message))
: Buffer.from(msg.message);
if (!isHexString(msg.message)) throw new Error("data is not an hex string");
const signedMsg = await ethereum.request({
method: "personal_sign",
params: [buffer.toString("hex"), address],
params: [msg, address],
});

return {
Expand Down
2 changes: 1 addition & 1 deletion packages/hdwallet-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shapeshiftoss/hdwallet-core",
"version": "1.50.10",
"version": "1.51.0",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/hdwallet-core/src/ethereum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export interface ETHSignedTx {

export interface ETHSignMessage {
addressNList: BIP32Path;
message: string | Bytes;
message: string;
}

export interface ETHSignedMessage {
Expand Down
6 changes: 3 additions & 3 deletions packages/hdwallet-keepkey-chromeusb/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shapeshiftoss/hdwallet-keepkey-chromeusb",
"version": "1.50.10",
"version": "1.51.0",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -14,7 +14,7 @@
"prepublishOnly": "yarn clean && yarn build"
},
"dependencies": {
"@shapeshiftoss/hdwallet-core": "1.50.10",
"@shapeshiftoss/hdwallet-keepkey": "1.50.10"
"@shapeshiftoss/hdwallet-core": "1.51.0",
"@shapeshiftoss/hdwallet-keepkey": "1.51.0"
}
}
4 changes: 2 additions & 2 deletions packages/hdwallet-keepkey-electron/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shapeshiftoss/hdwallet-keepkey-electron",
"version": "1.50.10",
"version": "1.51.0",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -14,7 +14,7 @@
"prepublishOnly": "yarn clean && yarn build"
},
"dependencies": {
"@shapeshiftoss/hdwallet-keepkey": "1.50.10",
"@shapeshiftoss/hdwallet-keepkey": "1.51.0",
"uuid": "^8.3.2"
},
"peerDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/hdwallet-keepkey-nodehid/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shapeshiftoss/hdwallet-keepkey-nodehid",
"version": "1.50.10",
"version": "1.51.0",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -14,7 +14,7 @@
"prepublishOnly": "yarn clean && yarn build"
},
"dependencies": {
"@shapeshiftoss/hdwallet-keepkey": "1.50.10"
"@shapeshiftoss/hdwallet-keepkey": "1.51.0"
},
"peerDependencies": {
"node-hid": "^2.1.1"
Expand Down
6 changes: 3 additions & 3 deletions packages/hdwallet-keepkey-nodewebusb/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shapeshiftoss/hdwallet-keepkey-nodewebusb",
"version": "1.50.10",
"version": "1.51.0",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -14,8 +14,8 @@
"prepublishOnly": "yarn clean && yarn build"
},
"dependencies": {
"@shapeshiftoss/hdwallet-core": "1.50.10",
"@shapeshiftoss/hdwallet-keepkey": "1.50.10"
"@shapeshiftoss/hdwallet-core": "1.51.0",
"@shapeshiftoss/hdwallet-keepkey": "1.51.0"
},
"peerDependencies": {
"usb": "^2.3.1"
Expand Down
6 changes: 3 additions & 3 deletions packages/hdwallet-keepkey-tcp/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shapeshiftoss/hdwallet-keepkey-tcp",
"version": "1.50.10",
"version": "1.51.0",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -14,8 +14,8 @@
"prepublishOnly": "yarn clean && yarn build"
},
"dependencies": {
"@shapeshiftoss/hdwallet-core": "1.50.10",
"@shapeshiftoss/hdwallet-keepkey": "1.50.10",
"@shapeshiftoss/hdwallet-core": "1.51.0",
"@shapeshiftoss/hdwallet-keepkey": "1.51.0",
"axios": "^0.21.1"
}
}
6 changes: 3 additions & 3 deletions packages/hdwallet-keepkey-webusb/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shapeshiftoss/hdwallet-keepkey-webusb",
"version": "1.50.10",
"version": "1.51.0",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -14,8 +14,8 @@
"prepublishOnly": "yarn clean && yarn build"
},
"dependencies": {
"@shapeshiftoss/hdwallet-core": "1.50.10",
"@shapeshiftoss/hdwallet-keepkey": "1.50.10"
"@shapeshiftoss/hdwallet-core": "1.51.0",
"@shapeshiftoss/hdwallet-keepkey": "1.51.0"
},
"devDependencies": {
"@types/w3c-web-usb": "^1.0.4"
Expand Down
4 changes: 2 additions & 2 deletions packages/hdwallet-keepkey/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shapeshiftoss/hdwallet-keepkey",
"version": "1.50.10",
"version": "1.51.0",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -19,7 +19,7 @@
"@ethereumjs/tx": "^3.3.0",
"@keepkey/device-protocol": "^7.12.2",
"@shapeshiftoss/bitcoinjs-lib": "5.2.0-shapeshift.2",
"@shapeshiftoss/hdwallet-core": "1.50.10",
"@shapeshiftoss/hdwallet-core": "1.51.0",
"@shapeshiftoss/proto-tx-builder": "^0.8.0",
"bignumber.js": "^9.0.1",
"bnb-javascript-sdk-nobroadcast": "^2.16.14",
Expand Down
6 changes: 2 additions & 4 deletions packages/hdwallet-keepkey/src/ethereum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,10 @@ export async function ethGetAddress(transport: Transport, msg: core.ETHGetAddres

export async function ethSignMessage(transport: Transport, msg: core.ETHSignMessage): Promise<core.ETHSignedMessage> {
const { addressNList, message } = msg;
if (!ethers.utils.isHexString(message)) throw new Error("data is not an hex string");
const m = new Ethereum.EthereumSignMessage();
m.setAddressNList(addressNList);
const messageBytes =
typeof message === "string" && !ethers.utils.isHexString(message)
? ethers.utils.toUtf8Bytes(message)
: ethers.utils.arrayify(message);
const messageBytes = ethers.utils.arrayify(message);
m.setMessage(messageBytes);
const response = await transport.call(Messages.MessageType.MESSAGETYPE_ETHEREUMSIGNMESSAGE, m, {
msgTimeout: core.LONG_TIMEOUT,
Expand Down
4 changes: 2 additions & 2 deletions packages/hdwallet-keplr/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shapeshiftoss/hdwallet-keplr",
"version": "1.50.10",
"version": "1.51.0",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -15,7 +15,7 @@
},
"dependencies": {
"@shapeshiftoss/caip": "8.15.0",
"@shapeshiftoss/hdwallet-core": "1.50.10",
"@shapeshiftoss/hdwallet-core": "1.51.0",
"@shapeshiftoss/proto-tx-builder": "^0.8.0",
"@shapeshiftoss/types": "3.1.3",
"base64-js": "^1.5.1",
Expand Down
6 changes: 3 additions & 3 deletions packages/hdwallet-ledger-webhid/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shapeshiftoss/hdwallet-ledger-webhid",
"version": "1.50.10",
"version": "1.51.0",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -19,8 +19,8 @@
"@ledgerhq/hw-transport": "^6.7.0",
"@ledgerhq/hw-transport-webhid": "^6.7.0",
"@ledgerhq/live-common": "^21.8.2",
"@shapeshiftoss/hdwallet-core": "1.50.10",
"@shapeshiftoss/hdwallet-ledger": "1.50.10",
"@shapeshiftoss/hdwallet-core": "1.51.0",
"@shapeshiftoss/hdwallet-ledger": "1.51.0",
"@types/w3c-web-hid": "^1.0.2"
},
"devDependencies": {
Expand Down
Loading

0 comments on commit f21593c

Please sign in to comment.