Skip to content

Commit

Permalink
Merge pull request #631 from shapeshift/wcv2
Browse files Browse the repository at this point in the history
  • Loading branch information
0xApotheosis authored Sep 25, 2023
2 parents d9701ee + cadc75c commit fcab4e7
Show file tree
Hide file tree
Showing 36 changed files with 1,446 additions and 84 deletions.
3 changes: 3 additions & 0 deletions examples/sandbox/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ <h4>Select</h4>
<button id="tallyHo">Pair Tally Ho</button>
<button id="coinbase">Pair Coinbase</button>
<button id="walletConnect">Pair WalletConnect</button>
<button id="walletConnectV2">Pair WalletConnect V2</button>

<select id="keyring" style="height: 100px" size="4"></select>
</div>
Expand All @@ -145,6 +146,8 @@ <h4>Manage</h4>
<button class="button button-outline" id="doPing">Ping</button>
<button class="button button-outline" id="doWipe">Wipe</button>
<button class="button button-outline" id="doLoadDevice">Load</button>
<button class="button button-outline" id="doClearSession">Clear Session</button>
<button class="button button-outline" id="doDisconnect">Disconnect</button>
<input type="text" id="manageResults" />
</div>
<div class="container">
Expand Down
58 changes: 58 additions & 0 deletions examples/sandbox/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ import * as tallyHo from "@shapeshiftoss/hdwallet-tallyho";
import * as trezorConnect from "@shapeshiftoss/hdwallet-trezor-connect";
import { WalletConnectProviderConfig } from "@shapeshiftoss/hdwallet-walletconnect";
import * as walletConnect from "@shapeshiftoss/hdwallet-walletconnect";
import * as walletConnectv2 from "@shapeshiftoss/hdwallet-walletconnectv2";
import * as xdefi from "@shapeshiftoss/hdwallet-xdefi";
import { EthereumProviderOptions } from "@walletconnect/ethereum-provider/dist/types/EthereumProvider";
import $ from "jquery";
import Web3 from "web3";

Expand Down Expand Up @@ -77,6 +79,21 @@ const walletConnectOptions: WalletConnectProviderConfig = {
1: "https://mainnet.infura.io/v3/d734c7eebcdf400185d7eb67322a7e57",
},
};
const walletConnectV2Options: EthereumProviderOptions = {
projectId: "5abef0455c768644c2bc866f1520374f",
chains: [1],
optionalChains: [100],
optionalMethods: [
"eth_signTypedData",
"eth_signTypedData_v4",
"eth_sign",
"ethVerifyMessage",
"eth_accounts",
"eth_sendTransaction",
"eth_signTransaction",
],
showQrModal: true,
};

const coinbaseOptions: CoinbaseProviderConfig = {
appName: "ShapeShift Sandbox",
Expand Down Expand Up @@ -109,6 +126,7 @@ const portisAdapter = portis.PortisAdapter.useKeyring(keyring, { portisAppId });
const metaMaskAdapter = metaMask.MetaMaskAdapter.useKeyring(keyring);
const tallyHoAdapter = tallyHo.TallyHoAdapter.useKeyring(keyring);
const walletConnectAdapter = walletConnect.WalletConnectAdapter.useKeyring(keyring, walletConnectOptions);
const walletConnectV2Adapter = walletConnectv2.WalletConnectV2Adapter.useKeyring(keyring, walletConnectV2Options);
const xdefiAdapter = xdefi.XDEFIAdapter.useKeyring(keyring);
const keplrAdapter = keplr.KeplrAdapter.useKeyring(keyring);
const nativeAdapter = native.NativeAdapter.useKeyring(keyring);
Expand Down Expand Up @@ -141,6 +159,7 @@ const $metaMask = $("#metaMask");
const $coinbase = $("#coinbase");
const $tallyHo = $("#tallyHo");
const $walletConnect = $("#walletConnect");
const $walletConnectV2 = $("#walletConnectV2");
const $xdefi = $("#xdefi");
const $keplr = $("#keplr");
const $keyring = $("#keyring");
Expand Down Expand Up @@ -283,6 +302,19 @@ $walletConnect.on("click", async (e) => {
}
});

$walletConnectV2.on("click", async (e) => {
e.preventDefault();
try {
wallet = await walletConnectV2Adapter.pairDevice();
window["wallet"] = wallet;
let deviceID = "nothing";
deviceID = await wallet.getDeviceID();
$("#keyring select").val(deviceID);
} catch (error) {
console.error(error);
}
});

$xdefi.on("click", async (e) => {
e.preventDefault();
wallet = await xdefiAdapter.pairDevice();
Expand Down Expand Up @@ -401,6 +433,12 @@ async function deviceConnected(deviceId) {
console.error("Could not initialize WalletConnectAdapter", e);
}

try {
await walletConnectV2Adapter.initialize();
} catch (e) {
console.error("Could not initialize WalletConnectV2Adapter", e);
}

for (const deviceID of Object.keys(keyring.wallets)) {
await deviceConnected(deviceID);
}
Expand Down Expand Up @@ -518,6 +556,8 @@ const $getXpubs = $("#getXpubs");
const $doPing = $("#doPing");
const $doWipe = $("#doWipe");
const $doLoadDevice = $("#doLoadDevice");
const $doDisconnect = $("#doDisconnect");
const $doClearSession = $("#doClearSession");
const $manageResults = $("#manageResults");

$getVendor.on("click", async (e) => {
Expand Down Expand Up @@ -651,6 +691,24 @@ $doLoadDevice.on("click", (e) => {
});
});

$doDisconnect.on("click", (e) => {
e.preventDefault();
if (!wallet) {
$manageResults.val("No wallet?");
return;
}
wallet.disconnect().then(() => $manageResults.val("Disconnected"));
});

$doClearSession.on("click", (e) => {
e.preventDefault();
if (!wallet) {
$manageResults.val("No wallet?");
return;
}
wallet.clearSession().then(() => $manageResults.val("Session Cleared"));
});

const $openApp = $("#openApp");
const $ledgerAppToOpen = $("#ledgerAppToOpen");
const $validateApp = $("#validateApp");
Expand Down
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": "hdwallet-sandbox",
"version": "1.50.5",
"version": "1.50.6",
"license": "MIT",
"private": true,
"browserslist": "> 0.5%, last 2 versions, not dead",
Expand All @@ -10,21 +10,21 @@
"clean": "rm -rf public .parcel-cache"
},
"dependencies": {
"@shapeshiftoss/hdwallet-core": "1.50.5",
"@shapeshiftoss/hdwallet-keepkey-tcp": "1.50.5",
"@shapeshiftoss/hdwallet-keepkey-webusb": "1.50.5",
"@shapeshiftoss/hdwallet-keplr": "1.50.5",
"@shapeshiftoss/hdwallet-ledger": "1.50.5",
"@shapeshiftoss/hdwallet-ledger-webhid": "1.50.5",
"@shapeshiftoss/hdwallet-ledger-webusb": "1.50.5",
"@shapeshiftoss/hdwallet-metamask": "1.50.5",
"@shapeshiftoss/hdwallet-native": "1.50.5",
"@shapeshiftoss/hdwallet-portis": "1.50.5",
"@shapeshiftoss/hdwallet-tallyho": "1.50.5",
"@shapeshiftoss/hdwallet-trezor": "1.50.5",
"@shapeshiftoss/hdwallet-trezor-connect": "1.50.5",
"@shapeshiftoss/hdwallet-walletconnect": "1.50.5",
"@shapeshiftoss/hdwallet-xdefi": "1.50.5",
"@shapeshiftoss/hdwallet-core": "^1.50.6",
"@shapeshiftoss/hdwallet-keepkey-tcp": "^1.50.6",
"@shapeshiftoss/hdwallet-keepkey-webusb": "^1.50.6",
"@shapeshiftoss/hdwallet-keplr": "^1.50.6",
"@shapeshiftoss/hdwallet-ledger": "^1.50.6",
"@shapeshiftoss/hdwallet-ledger-webhid": "^1.50.6",
"@shapeshiftoss/hdwallet-ledger-webusb": "^1.50.6",
"@shapeshiftoss/hdwallet-metamask": "^1.50.6",
"@shapeshiftoss/hdwallet-native": "^1.50.6",
"@shapeshiftoss/hdwallet-portis": "^1.50.6",
"@shapeshiftoss/hdwallet-tallyho": "^1.50.6",
"@shapeshiftoss/hdwallet-trezor": "^1.50.6",
"@shapeshiftoss/hdwallet-trezor-connect": "^1.50.6",
"@shapeshiftoss/hdwallet-walletconnect": "^1.50.6",
"@shapeshiftoss/hdwallet-xdefi": "^1.50.6",
"bip32": "^2.0.4",
"jquery": "^3.4.1",
"json": "^9.0.6",
Expand Down
5 changes: 5 additions & 0 deletions examples/sandbox/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"compilerOptions": {
"resolveJsonModule": true,
}
}
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.5",
"version": "1.50.6",
"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.5",
"@shapeshiftoss/hdwallet-keepkey": "1.50.5",
"@shapeshiftoss/hdwallet-keepkey-nodewebusb": "1.50.5",
"@shapeshiftoss/hdwallet-keepkey-tcp": "1.50.5",
"@shapeshiftoss/hdwallet-ledger": "1.50.5",
"@shapeshiftoss/hdwallet-native": "1.50.5",
"@shapeshiftoss/hdwallet-portis": "1.50.5",
"@shapeshiftoss/hdwallet-trezor": "1.50.5",
"@shapeshiftoss/hdwallet-xdefi": "1.50.5",
"@shapeshiftoss/hdwallet-core": "^1.50.6",
"@shapeshiftoss/hdwallet-keepkey": "^1.50.6",
"@shapeshiftoss/hdwallet-keepkey-nodewebusb": "^1.50.6",
"@shapeshiftoss/hdwallet-keepkey-tcp": "^1.50.6",
"@shapeshiftoss/hdwallet-ledger": "^1.50.6",
"@shapeshiftoss/hdwallet-native": "^1.50.6",
"@shapeshiftoss/hdwallet-portis": "^1.50.6",
"@shapeshiftoss/hdwallet-trezor": "^1.50.6",
"@shapeshiftoss/hdwallet-xdefi": "^1.50.6",
"@types/jest": "^26.0.23",
"fast-json-stable-stringify": "^2.1.0",
"jest": "^26.6.3",
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": "3.22.1",
"version": "1.50.5",
"version": "1.50.6",
"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.5",
"version": "1.50.6",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -15,7 +15,7 @@
},
"dependencies": {
"@coinbase/wallet-sdk": "^3.6.6",
"@shapeshiftoss/hdwallet-core": "1.50.5",
"@shapeshiftoss/hdwallet-core": "^1.50.6",
"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.50.5",
"version": "1.50.6",
"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.50.5",
"version": "1.50.6",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -14,8 +14,8 @@
"prepublishOnly": "yarn clean && yarn build"
},
"dependencies": {
"@shapeshiftoss/hdwallet-core": "1.50.5",
"@shapeshiftoss/hdwallet-keepkey": "1.50.5"
"@shapeshiftoss/hdwallet-core": "^1.50.6",
"@shapeshiftoss/hdwallet-keepkey": "^1.50.6"
},
"devDependencies": {
"typescript": "^4.3.2"
Expand Down
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.5",
"version": "1.50.6",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -14,7 +14,7 @@
"prepublishOnly": "yarn clean && yarn build"
},
"dependencies": {
"@shapeshiftoss/hdwallet-keepkey": "1.50.5",
"@shapeshiftoss/hdwallet-keepkey": "^1.50.6",
"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.5",
"version": "1.50.6",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -14,7 +14,7 @@
"prepublishOnly": "yarn clean && yarn build"
},
"dependencies": {
"@shapeshiftoss/hdwallet-keepkey": "1.50.5"
"@shapeshiftoss/hdwallet-keepkey": "^1.50.6"
},
"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.5",
"version": "1.50.6",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -14,8 +14,8 @@
"prepublishOnly": "yarn clean && yarn build"
},
"dependencies": {
"@shapeshiftoss/hdwallet-core": "1.50.5",
"@shapeshiftoss/hdwallet-keepkey": "1.50.5"
"@shapeshiftoss/hdwallet-core": "^1.50.6",
"@shapeshiftoss/hdwallet-keepkey": "^1.50.6"
},
"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.5",
"version": "1.50.6",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -14,8 +14,8 @@
"prepublishOnly": "yarn clean && yarn build"
},
"dependencies": {
"@shapeshiftoss/hdwallet-core": "1.50.5",
"@shapeshiftoss/hdwallet-keepkey": "1.50.5",
"@shapeshiftoss/hdwallet-core": "^1.50.6",
"@shapeshiftoss/hdwallet-keepkey": "^1.50.6",
"axios": "^0.21.1"
},
"devDependencies": {
Expand Down
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.5",
"version": "1.50.6",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -14,8 +14,8 @@
"prepublishOnly": "yarn clean && yarn build"
},
"dependencies": {
"@shapeshiftoss/hdwallet-core": "1.50.5",
"@shapeshiftoss/hdwallet-keepkey": "1.50.5"
"@shapeshiftoss/hdwallet-core": "^1.50.6",
"@shapeshiftoss/hdwallet-keepkey": "^1.50.6"
},
"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.5",
"version": "1.50.6",
"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.5",
"@shapeshiftoss/hdwallet-core": "^1.50.6",
"@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.50.5",
"version": "1.50.6",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -15,7 +15,7 @@
},
"dependencies": {
"@shapeshiftoss/caip": "3.0.0",
"@shapeshiftoss/hdwallet-core": "1.50.5",
"@shapeshiftoss/hdwallet-core": "^1.50.6",
"@shapeshiftoss/proto-tx-builder": "^0.8.0",
"@shapeshiftoss/types": "3.1.3",
"base64-js": "^1.5.1",
Expand Down
Loading

1 comment on commit fcab4e7

@vercel
Copy link

@vercel vercel bot commented on fcab4e7 Sep 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

hdwallet – ./

hdwallet-shapeshift.vercel.app
hdwallet-git-master-shapeshift.vercel.app

Please sign in to comment.