Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: ledger thorchain cleanup #660

Merged
merged 2 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.53.0",
"version": "1.53.1",
"license": "MIT",
"private": true,
"browserslist": "> 0.5%, last 2 versions, not dead",
Expand All @@ -11,21 +11,21 @@
},
"dependencies": {
"@metamask/eth-sig-util": "^7.0.0",
"@shapeshiftoss/hdwallet-core": "1.53.0",
"@shapeshiftoss/hdwallet-keepkey-tcp": "1.53.0",
"@shapeshiftoss/hdwallet-keepkey-webusb": "1.53.0",
"@shapeshiftoss/hdwallet-keplr": "1.53.0",
"@shapeshiftoss/hdwallet-ledger": "1.53.0",
"@shapeshiftoss/hdwallet-ledger-webhid": "1.53.0",
"@shapeshiftoss/hdwallet-ledger-webusb": "1.53.0",
"@shapeshiftoss/hdwallet-metamask": "1.53.0",
"@shapeshiftoss/hdwallet-native": "1.53.0",
"@shapeshiftoss/hdwallet-portis": "1.53.0",
"@shapeshiftoss/hdwallet-tallyho": "1.53.0",
"@shapeshiftoss/hdwallet-trezor": "1.53.0",
"@shapeshiftoss/hdwallet-trezor-connect": "1.53.0",
"@shapeshiftoss/hdwallet-walletconnect": "1.53.0",
"@shapeshiftoss/hdwallet-xdefi": "1.53.0",
"@shapeshiftoss/hdwallet-core": "1.53.1",
"@shapeshiftoss/hdwallet-keepkey-tcp": "1.53.1",
"@shapeshiftoss/hdwallet-keepkey-webusb": "1.53.1",
"@shapeshiftoss/hdwallet-keplr": "1.53.1",
"@shapeshiftoss/hdwallet-ledger": "1.53.1",
"@shapeshiftoss/hdwallet-ledger-webhid": "1.53.1",
"@shapeshiftoss/hdwallet-ledger-webusb": "1.53.1",
"@shapeshiftoss/hdwallet-metamask": "1.53.1",
"@shapeshiftoss/hdwallet-native": "1.53.1",
"@shapeshiftoss/hdwallet-portis": "1.53.1",
"@shapeshiftoss/hdwallet-tallyho": "1.53.1",
"@shapeshiftoss/hdwallet-trezor": "1.53.1",
"@shapeshiftoss/hdwallet-trezor-connect": "1.53.1",
"@shapeshiftoss/hdwallet-walletconnect": "1.53.1",
"@shapeshiftoss/hdwallet-xdefi": "1.53.1",
"bip32": "^2.0.4",
"eip-712": "^1.0.0",
"jquery": "^3.7.1",
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.53.0",
"version": "1.53.1",
"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.53.0",
"@shapeshiftoss/hdwallet-keepkey": "1.53.0",
"@shapeshiftoss/hdwallet-keepkey-nodewebusb": "1.53.0",
"@shapeshiftoss/hdwallet-keepkey-tcp": "1.53.0",
"@shapeshiftoss/hdwallet-ledger": "1.53.0",
"@shapeshiftoss/hdwallet-native": "1.53.0",
"@shapeshiftoss/hdwallet-portis": "1.53.0",
"@shapeshiftoss/hdwallet-trezor": "1.53.0",
"@shapeshiftoss/hdwallet-xdefi": "1.53.0",
"@shapeshiftoss/hdwallet-core": "1.53.1",
"@shapeshiftoss/hdwallet-keepkey": "1.53.1",
"@shapeshiftoss/hdwallet-keepkey-nodewebusb": "1.53.1",
"@shapeshiftoss/hdwallet-keepkey-tcp": "1.53.1",
"@shapeshiftoss/hdwallet-ledger": "1.53.1",
"@shapeshiftoss/hdwallet-native": "1.53.1",
"@shapeshiftoss/hdwallet-portis": "1.53.1",
"@shapeshiftoss/hdwallet-trezor": "1.53.1",
"@shapeshiftoss/hdwallet-xdefi": "1.53.1",
"fast-json-stable-stringify": "^2.1.0",
"msw": "^0.27.1",
"whatwg-fetch": "^3.6.2"
Expand Down
15 changes: 7 additions & 8 deletions integration/src/wallets/ledger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,21 +222,20 @@ export class MockTransport extends ledger.LedgerTransport {
);

// Thorchain
const compress_pk = toByteArray("AxUZcTuLQr3DZxEtMxMs8Uzt+SisV3HURLpFm5SXEXuj");
this.memoize(
"Rune",
"getAddressAndPubKey",
"Thorchain",
"getAddress",
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}]}}`
`{"success":true,"coin":"Rune","method":"getAddressAndPubkey","payload":{"address":"thor1ls33ayg26kmltw7jjy55p32ghjna09zp74t4az","publicKey":"031519713b8b42bdc367112d33132cf14cedf928ac5771d444ba459b9497117ba3"}}`
)
);

this.memoize(
"Rune",
"Thorchain",
"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"}]'
'[[2147483692,2147484579,2147483648,0,0],"{\\"account_number\\":\\"17\\",\\"chain_id\\":\\"thorchain-mainnet-v1\\",\\"fee\\":{\\"amount\\":[{\\"amount\\":\\"3000\\",\\"denom\\":\\"rune\\"}],\\"gas\\":\\"200000\\"},\\"memo\\":\\"\\",\\"msgs\\":[{\\"type\\":\\"thorchain/MsgSend\\",\\"value\\":{\\"amount\\":[{\\"amount\\":\\"100\\",\\"denom\\":\\"rune\\"}],\\"from_address\\":\\"thor1ls33ayg26kmltw7jjy55p32ghjna09zp74t4az\\",\\"to_address\\":\\"thor1wy58774wagy4hkljz9mchhqtgk949zdwwe80d5\\"}}],\\"sequence\\":\\"2\\"}"]'
),
{
success: true,
Expand All @@ -251,10 +250,10 @@ export class MockTransport extends ledger.LedgerTransport {
);

this.memoize(
"Rune",
"Thorchain",
"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"}]'
'[[2147483692,2147484579,2147483648,0,0],"{\\"account_number\\":\\"2722\\",\\"chain_id\\":\\"thorchain-mainnet-v1\\",\\"fee\\":{\\"amount\\":[{\\"amount\\":\\"0\\",\\"denom\\":\\"rune\\"}],\\"gas\\":\\"350000\\"},\\"memo\\":\\"\\",\\"msgs\\":[{\\"type\\":\\"thorchain/MsgDeposit\\",\\"value\\":{\\"coins\\":[{\\"amount\\":\\"50994000\\",\\"asset\\":\\"THOR.RUNE\\"}],\\"memo\\":\\"SWAP:BNB.BNB:bnb12splwpg8jenr9pjw3dwc5rr35t8792y8pc4mtf:348953501\\",\\"signer\\":\\"thor1ls33ayg26kmltw7jjy55p32ghjna09zp74t4az\\"}}],\\"sequence\\":\\"4\\"}"]'
),
{
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.53.0",
"version": "1.53.1",
"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.53.0",
"version": "1.53.1",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -15,7 +15,7 @@
},
"dependencies": {
"@coinbase/wallet-sdk": "^3.6.6",
"@shapeshiftoss/hdwallet-core": "1.53.0",
"@shapeshiftoss/hdwallet-core": "1.53.1",
"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.53.0",
"version": "1.53.1",
"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.53.0",
"version": "1.53.1",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -14,7 +14,7 @@
"prepublishOnly": "yarn clean && yarn build"
},
"dependencies": {
"@shapeshiftoss/hdwallet-core": "1.53.0",
"@shapeshiftoss/hdwallet-keepkey": "1.53.0"
"@shapeshiftoss/hdwallet-core": "1.53.1",
"@shapeshiftoss/hdwallet-keepkey": "1.53.1"
}
}
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.53.0",
"version": "1.53.1",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -14,7 +14,7 @@
"prepublishOnly": "yarn clean && yarn build"
},
"dependencies": {
"@shapeshiftoss/hdwallet-keepkey": "1.53.0",
"@shapeshiftoss/hdwallet-keepkey": "1.53.1",
"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.53.0",
"version": "1.53.1",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -14,7 +14,7 @@
"prepublishOnly": "yarn clean && yarn build"
},
"dependencies": {
"@shapeshiftoss/hdwallet-keepkey": "1.53.0"
"@shapeshiftoss/hdwallet-keepkey": "1.53.1"
},
"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.53.0",
"version": "1.53.1",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -14,8 +14,8 @@
"prepublishOnly": "yarn clean && yarn build"
},
"dependencies": {
"@shapeshiftoss/hdwallet-core": "1.53.0",
"@shapeshiftoss/hdwallet-keepkey": "1.53.0"
"@shapeshiftoss/hdwallet-core": "1.53.1",
"@shapeshiftoss/hdwallet-keepkey": "1.53.1"
},
"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.53.0",
"version": "1.53.1",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -14,8 +14,8 @@
"prepublishOnly": "yarn clean && yarn build"
},
"dependencies": {
"@shapeshiftoss/hdwallet-core": "1.53.0",
"@shapeshiftoss/hdwallet-keepkey": "1.53.0",
"@shapeshiftoss/hdwallet-core": "1.53.1",
"@shapeshiftoss/hdwallet-keepkey": "1.53.1",
"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.53.0",
"version": "1.53.1",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -14,8 +14,8 @@
"prepublishOnly": "yarn clean && yarn build"
},
"dependencies": {
"@shapeshiftoss/hdwallet-core": "1.53.0",
"@shapeshiftoss/hdwallet-keepkey": "1.53.0"
"@shapeshiftoss/hdwallet-core": "1.53.1",
"@shapeshiftoss/hdwallet-keepkey": "1.53.1"
},
"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.53.0",
"version": "1.53.1",
"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.53.0",
"@shapeshiftoss/hdwallet-core": "1.53.1",
"@shapeshiftoss/proto-tx-builder": "^0.8.0",
"bignumber.js": "^9.0.1",
"bnb-javascript-sdk-nobroadcast": "^2.16.14",
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.53.0",
"version": "1.53.1",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -15,7 +15,7 @@
},
"dependencies": {
"@shapeshiftoss/caip": "8.15.0",
"@shapeshiftoss/hdwallet-core": "1.53.0",
"@shapeshiftoss/hdwallet-core": "1.53.1",
"@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.53.0",
"version": "1.53.1",
"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.53.0",
"@shapeshiftoss/hdwallet-ledger": "1.53.0",
"@shapeshiftoss/hdwallet-core": "1.53.1",
"@shapeshiftoss/hdwallet-ledger": "1.53.1",
"@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.53.0",
"version": "1.53.1",
"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.53.0",
"@shapeshiftoss/hdwallet-ledger": "1.53.0",
"@shapeshiftoss/hdwallet-core": "1.53.1",
"@shapeshiftoss/hdwallet-ledger": "1.53.1",
"@types/w3c-web-usb": "^1.0.4",
"p-queue": "^7.4.1"
},
Expand Down
14 changes: 7 additions & 7 deletions packages/hdwallet-ledger-webusb/src/transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import getAppAndVersion from "@ledgerhq/live-common/lib/hw/getAppAndVersion";
import getDeviceInfo from "@ledgerhq/live-common/lib/hw/getDeviceInfo";
import openApp from "@ledgerhq/live-common/lib/hw/openApp";
import * as core from "@shapeshiftoss/hdwallet-core";
import * as ledger from "@shapeshiftoss/hdwallet-ledger";
import { LedgerTransport, Thorchain } from "@shapeshiftoss/hdwallet-ledger";
import {
LedgerResponse,
LedgerTransportCoinType,
Expand Down Expand Up @@ -80,11 +80,6 @@ export async function translateCoinAndMethod<T extends LedgerTransportCoinType,
method: U
): Promise<LedgerTransportMethod<T, U>> {
switch (coin) {
case "Rune": {
const thor = new ledger.THORChainApp(transport);
const methodInstance = thor[method as LedgerTransportMethodName<"Rune">].bind(thor);
return methodInstance as LedgerTransportMethod<T, U>;
}
case "Btc": {
const btc = new Btc({ transport });
const methodInstance = btc[method as LedgerTransportMethodName<"Btc">].bind(btc);
Expand All @@ -95,6 +90,11 @@ export async function translateCoinAndMethod<T extends LedgerTransportCoinType,
const methodInstance = eth[method as LedgerTransportMethodName<"Eth">].bind(eth);
return methodInstance as LedgerTransportMethod<T, U>;
}
case "Thorchain": {
const thorchain = new Thorchain(transport);
const methodInstance = thorchain[method as LedgerTransportMethodName<"Thorchain">].bind(thorchain);
return methodInstance as LedgerTransportMethod<T, U>;
}
case "Cosmos": {
const cosmos = new Cosmos(transport);
const methodInstance = cosmos[method as LedgerTransportMethodName<"Cosmos">].bind(cosmos);
Expand Down Expand Up @@ -130,7 +130,7 @@ export async function translateCoinAndMethod<T extends LedgerTransportCoinType,
}
}

export class LedgerWebUsbTransport extends ledger.LedgerTransport {
export class LedgerWebUsbTransport extends LedgerTransport {
device: USBDevice;

constructor(device: USBDevice, transport: TransportWebUSB, keyring: core.Keyring) {
Expand Down
4 changes: 2 additions & 2 deletions packages/hdwallet-ledger/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shapeshiftoss/hdwallet-ledger",
"version": "1.53.0",
"version": "1.53.1",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -19,7 +19,7 @@
"@ethereumjs/tx": "^3.3.0",
"@ledgerhq/hw-app-cosmos": "^6.29.1",
"@shapeshiftoss/bitcoinjs-lib": "5.2.0-shapeshift.2",
"@shapeshiftoss/hdwallet-core": "1.53.0",
"@shapeshiftoss/hdwallet-core": "1.53.1",
"base64-js": "^1.5.1",
"bchaddrjs": "^0.4.4",
"bitcoinjs-message": "^2.0.0",
Expand Down
Loading
Loading