Skip to content

Commit

Permalink
Merge branch 'master' into fix_kk_ethSignTypedData
Browse files Browse the repository at this point in the history
  • Loading branch information
BitHighlander authored Oct 23, 2023
2 parents c4766cf + c0dddd4 commit d1ab981
Show file tree
Hide file tree
Showing 41 changed files with 909 additions and 217 deletions.
33 changes: 16 additions & 17 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.52.5",
"version": "1.52.8",
"license": "MIT",
"private": true,
"browserslist": "> 0.5%, last 2 versions, not dead",
Expand All @@ -10,22 +10,21 @@
"clean": "rm -rf dist node_modules public .parcel-cache"
},
"dependencies": {
"@metamask/eth-sig-util": "^7.0.0",
"@shapeshiftoss/hdwallet-core": "1.52.5",
"@shapeshiftoss/hdwallet-keepkey-tcp": "1.52.5",
"@shapeshiftoss/hdwallet-keepkey-webusb": "1.52.5",
"@shapeshiftoss/hdwallet-keplr": "1.52.5",
"@shapeshiftoss/hdwallet-ledger": "1.52.5",
"@shapeshiftoss/hdwallet-ledger-webhid": "1.52.5",
"@shapeshiftoss/hdwallet-ledger-webusb": "1.52.5",
"@shapeshiftoss/hdwallet-metamask": "1.52.5",
"@shapeshiftoss/hdwallet-native": "1.52.5",
"@shapeshiftoss/hdwallet-portis": "1.52.5",
"@shapeshiftoss/hdwallet-tallyho": "1.52.5",
"@shapeshiftoss/hdwallet-trezor": "1.52.5",
"@shapeshiftoss/hdwallet-trezor-connect": "1.52.5",
"@shapeshiftoss/hdwallet-walletconnect": "1.52.5",
"@shapeshiftoss/hdwallet-xdefi": "1.52.5",
"@shapeshiftoss/hdwallet-core": "1.52.8",
"@shapeshiftoss/hdwallet-keepkey-tcp": "1.52.8",
"@shapeshiftoss/hdwallet-keepkey-webusb": "1.52.8",
"@shapeshiftoss/hdwallet-keplr": "1.52.8",
"@shapeshiftoss/hdwallet-ledger": "1.52.8",
"@shapeshiftoss/hdwallet-ledger-webhid": "1.52.8",
"@shapeshiftoss/hdwallet-ledger-webusb": "1.52.8",
"@shapeshiftoss/hdwallet-metamask": "1.52.8",
"@shapeshiftoss/hdwallet-native": "1.52.8",
"@shapeshiftoss/hdwallet-portis": "1.52.8",
"@shapeshiftoss/hdwallet-tallyho": "1.52.8",
"@shapeshiftoss/hdwallet-trezor": "1.52.8",
"@shapeshiftoss/hdwallet-trezor-connect": "1.52.8",
"@shapeshiftoss/hdwallet-walletconnect": "1.52.8",
"@shapeshiftoss/hdwallet-xdefi": "1.52.8",
"bip32": "^2.0.4",
"eip-712": "^1.0.0",
"ethereumjs-util": "^7.1.5",
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.52.5",
"version": "1.52.8",
"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.52.5",
"@shapeshiftoss/hdwallet-keepkey": "1.52.5",
"@shapeshiftoss/hdwallet-keepkey-nodewebusb": "1.52.5",
"@shapeshiftoss/hdwallet-keepkey-tcp": "1.52.5",
"@shapeshiftoss/hdwallet-ledger": "1.52.5",
"@shapeshiftoss/hdwallet-native": "1.52.5",
"@shapeshiftoss/hdwallet-portis": "1.52.5",
"@shapeshiftoss/hdwallet-trezor": "1.52.5",
"@shapeshiftoss/hdwallet-xdefi": "1.52.5",
"@shapeshiftoss/hdwallet-core": "1.52.8",
"@shapeshiftoss/hdwallet-keepkey": "1.52.8",
"@shapeshiftoss/hdwallet-keepkey-nodewebusb": "1.52.8",
"@shapeshiftoss/hdwallet-keepkey-tcp": "1.52.8",
"@shapeshiftoss/hdwallet-ledger": "1.52.8",
"@shapeshiftoss/hdwallet-native": "1.52.8",
"@shapeshiftoss/hdwallet-portis": "1.52.8",
"@shapeshiftoss/hdwallet-trezor": "1.52.8",
"@shapeshiftoss/hdwallet-xdefi": "1.52.8",
"fast-json-stable-stringify": "^2.1.0",
"msw": "^0.27.1",
"whatwg-fetch": "^3.6.2"
Expand Down
3 changes: 2 additions & 1 deletion integration/src/thorchain/thorchain.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as core from "@shapeshiftoss/hdwallet-core";
import * as keepkey from "@shapeshiftoss/hdwallet-keepkey";
import * as ledger from "@shapeshiftoss/hdwallet-ledger";

import tx_unsigned_swap_amino from "./tx01.mainnet.thorchain.swap.amino.json";
import tx_unsigned_swap from "./tx01.mainnet.thorchain.swap.json";
Expand All @@ -25,7 +26,7 @@ export function thorchainTests(get: () => { wallet: core.HDWallet; info: core.HD
beforeAll(async () => {
const { wallet: w } = get();
if (core.supportsThorchain(w)) wallet = w;
useAmino = w instanceof keepkey.KeepKeyHDWallet;
useAmino = w instanceof keepkey.KeepKeyHDWallet || w instanceof ledger.LedgerHDWallet;
});

beforeEach(async () => {
Expand Down
56 changes: 56 additions & 0 deletions integration/src/wallets/ledger.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as core from "@shapeshiftoss/hdwallet-core";
import * as ledger from "@shapeshiftoss/hdwallet-ledger";
import { toByteArray } from "base64-js";

export class MockTransport extends ledger.LedgerTransport {
memoized = new Map();
Expand Down Expand Up @@ -212,6 +213,61 @@ export class MockTransport extends ledger.LedgerTransport {
'{"success":true,"coin":"Btc","method":"getWalletPublicKey","payload":{"bitcoinAddress":"1FH6ehAd5ZFXCM1cLGzHxK1s4dGdq1JusM","chainCode":"fixme","publicKey":"fixme"}}'
)
);

// Thorchain
const compress_pk = toByteArray("AxUZcTuLQr3DZxEtMxMs8Uzt+SisV3HURLpFm5SXEXuj");
this.memoize(
"Rune",
"getAddressAndPubKey",
JSON.parse(`[[${core.bip32ToAddressNList("m/44'/931'/0'/0/0")}], "thor"]`),
JSON.parse(
`{"success":true,"coin":"Rune","method":"getAddressAndPubkey","payload":{"bech32_address":"thor1ls33ayg26kmltw7jjy55p32ghjna09zp74t4az","compressed_pk":[${compress_pk}]}}`
)
);

const sig1 = toByteArray(
"1s+0FVJ5R8O+ewGq5yNbTQuVG5MJZppFDqVJ4cd5D68ogOb2GMVHvYCH2dvQXo/uK/fT6Rk6dLGhK8tgW/HqtA=="
);
const r1 = sig1.slice(0, 32);
const s1 = sig1.slice(32, 64);
const rawSig1 = Uint8Array.from([48, 68, 2, 32, ...r1, 2, 32, ...s1]);
this.memoize(
"Rune",
"sign",
JSON.parse(
'[{"tx":{"account_number":"17","chain_id":"thorchain-mainnet-v1","sequence":"2","fee":{"amount":[{"amount":"3000","denom":"rune"}],"gas":"200000"},"memo":"","msg":[{"type":"thorchain/MsgSend","value":{"amount":[{"amount":"100","denom":"rune"}],"from_address":"thor1ls33ayg26kmltw7jjy55p32ghjna09zp74t4az","to_address":"thor1wy58774wagy4hkljz9mchhqtgk949zdwwe80d5"}}],"signatures":[]},"addressNList":[2147483692,2147484579,2147483648,0,0],"chain_id":"thorchain-mainnet-v1","account_number":"17","sequence":"2"}]'
),
{
success: true,
coin: "Rune",
method: "sign",
payload: {
signature: rawSig1,
},
}
);

const sig2 = toByteArray(
"0Bjk7npdUw/Qa4MQTS4PH8sw8jM4JSzpd7G2DsF3DMVoYgdpO2fjHh/DUq6v30nghxUSJj0jNm0VIq9viPB+tQ=="
);
const r2 = sig2.slice(0, 32);
const s2 = sig2.slice(32, 64);
const rawSig2 = Uint8Array.from([48, 68, 2, 32, ...r2, 2, 32, ...s2]);
this.memoize(
"Rune",
"sign",
JSON.parse(
'[{"tx":{"account_number":"2722","chain_id":"thorchain-mainnet-v1","sequence":"4","fee":{"amount":[{"amount":"0","denom":"rune"}],"gas":"350000"},"memo":"","msg":[{"type":"thorchain/MsgDeposit","value":{"coins":[{"asset":"THOR.RUNE","amount":"50994000"}],"memo":"SWAP:BNB.BNB:bnb12splwpg8jenr9pjw3dwc5rr35t8792y8pc4mtf:348953501","signer":"thor1ls33ayg26kmltw7jjy55p32ghjna09zp74t4az"}}],"signatures":[]},"addressNList":[2147483692,2147484579,2147483648,0,0],"chain_id":"thorchain-mainnet-v1","account_number":"2722","sequence":"4"}]'
),
{
success: true,
coin: "Rune",
method: "sign",
payload: {
signature: rawSig2,
},
}
);
} catch (e) {
console.error(e);
}
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.52.5",
"version": "1.52.8",
"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.52.5",
"version": "1.52.8",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -15,7 +15,7 @@
},
"dependencies": {
"@coinbase/wallet-sdk": "^3.6.6",
"@shapeshiftoss/hdwallet-core": "1.52.5",
"@shapeshiftoss/hdwallet-core": "1.52.8",
"eth-rpc-errors": "^4.0.3",
"lodash": "^4.17.21"
},
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.52.5",
"version": "1.52.8",
"license": "MIT",
"publishConfig": {
"access": "public"
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.52.5",
"version": "1.52.8",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -14,7 +14,7 @@
"prepublishOnly": "yarn clean && yarn build"
},
"dependencies": {
"@shapeshiftoss/hdwallet-core": "1.52.5",
"@shapeshiftoss/hdwallet-keepkey": "1.52.5"
"@shapeshiftoss/hdwallet-core": "1.52.8",
"@shapeshiftoss/hdwallet-keepkey": "1.52.8"
}
}
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.52.5",
"version": "1.52.8",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -14,7 +14,7 @@
"prepublishOnly": "yarn clean && yarn build"
},
"dependencies": {
"@shapeshiftoss/hdwallet-keepkey": "1.52.5",
"@shapeshiftoss/hdwallet-keepkey": "1.52.8",
"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.52.5",
"version": "1.52.8",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -14,7 +14,7 @@
"prepublishOnly": "yarn clean && yarn build"
},
"dependencies": {
"@shapeshiftoss/hdwallet-keepkey": "1.52.5"
"@shapeshiftoss/hdwallet-keepkey": "1.52.8"
},
"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.52.5",
"version": "1.52.8",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -14,8 +14,8 @@
"prepublishOnly": "yarn clean && yarn build"
},
"dependencies": {
"@shapeshiftoss/hdwallet-core": "1.52.5",
"@shapeshiftoss/hdwallet-keepkey": "1.52.5"
"@shapeshiftoss/hdwallet-core": "1.52.8",
"@shapeshiftoss/hdwallet-keepkey": "1.52.8"
},
"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.52.5",
"version": "1.52.8",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -14,8 +14,8 @@
"prepublishOnly": "yarn clean && yarn build"
},
"dependencies": {
"@shapeshiftoss/hdwallet-core": "1.52.5",
"@shapeshiftoss/hdwallet-keepkey": "1.52.5",
"@shapeshiftoss/hdwallet-core": "1.52.8",
"@shapeshiftoss/hdwallet-keepkey": "1.52.8",
"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.52.5",
"version": "1.52.8",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -14,8 +14,8 @@
"prepublishOnly": "yarn clean && yarn build"
},
"dependencies": {
"@shapeshiftoss/hdwallet-core": "1.52.5",
"@shapeshiftoss/hdwallet-keepkey": "1.52.5"
"@shapeshiftoss/hdwallet-core": "1.52.8",
"@shapeshiftoss/hdwallet-keepkey": "1.52.8"
},
"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.52.5",
"version": "1.52.8",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -20,7 +20,7 @@
"@keepkey/device-protocol": "^7.12.2",
"@metamask/eth-sig-util": "^7.0.0",
"@shapeshiftoss/bitcoinjs-lib": "5.2.0-shapeshift.2",
"@shapeshiftoss/hdwallet-core": "1.52.5",
"@shapeshiftoss/hdwallet-core": "1.52.8",
"@shapeshiftoss/proto-tx-builder": "^0.8.0",
"bignumber.js": "^9.0.1",
"bnb-javascript-sdk-nobroadcast": "^2.16.14",
Expand Down
6 changes: 3 additions & 3 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.52.5",
"version": "1.52.8",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -15,7 +15,7 @@
},
"dependencies": {
"@shapeshiftoss/caip": "8.15.0",
"@shapeshiftoss/hdwallet-core": "1.52.5",
"@shapeshiftoss/hdwallet-core": "1.52.8",
"@shapeshiftoss/proto-tx-builder": "^0.8.0",
"@shapeshiftoss/types": "3.1.3",
"base64-js": "^1.5.1",
Expand All @@ -24,7 +24,7 @@
"devDependencies": {
"@cosmjs/amino": "^0.28.13",
"@cosmjs/stargate": "^0.28.13",
"@keplr-wallet/types": "^0.9.10",
"@keplr-wallet/types": "^0.12.35",
"@types/lodash": "^4.14.168"
}
}
2 changes: 1 addition & 1 deletion packages/hdwallet-keplr/src/keplr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export class KeplrHDWallet implements core.HDWallet, core.CosmosWallet, core.Osm

initialized = false;
provider: any = {};
supportedNetworks: ChainReference[] = [CHAIN_REFERENCE.CosmosHubMainnet, CHAIN_REFERENCE.OsmosisMainnet];
supportedNetworks: ChainReference[] = [CHAIN_REFERENCE.CosmosHubMainnet];

constructor() {
this.info = new KeplrHDWalletInfo();
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.52.5",
"version": "1.52.8",
"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.52.5",
"@shapeshiftoss/hdwallet-ledger": "1.52.5",
"@shapeshiftoss/hdwallet-core": "1.52.8",
"@shapeshiftoss/hdwallet-ledger": "1.52.8",
"@types/w3c-web-hid": "^1.0.2"
},
"devDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions packages/hdwallet-ledger-webusb/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shapeshiftoss/hdwallet-ledger-webusb",
"version": "1.52.5",
"version": "1.52.8",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -20,8 +20,8 @@
"@ledgerhq/hw-transport-webusb": "^6.7.0",
"@ledgerhq/live-common": "^21.8.2",
"@ledgerhq/logs": "^6.10.1",
"@shapeshiftoss/hdwallet-core": "1.52.5",
"@shapeshiftoss/hdwallet-ledger": "1.52.5",
"@shapeshiftoss/hdwallet-core": "1.52.8",
"@shapeshiftoss/hdwallet-ledger": "1.52.8",
"@types/w3c-web-usb": "^1.0.4",
"p-queue": "^7.4.1"
},
Expand Down
Loading

0 comments on commit d1ab981

Please sign in to comment.