Skip to content
Open
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
2 changes: 0 additions & 2 deletions examples/sandbox/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,13 @@ <h4>Select</h4>
<button id="trezor">Pair Trezor</button>
<button id="ledgerwebusb">Pair Ledger (webUSB)</button>
<button id="ledgerwebhid">Pair Ledger (webHID)</button>
<button id="portis">Pair Portis</button>
<button id="native">Pair Native</button>
<button id="gridplus">Pair GridPlus</button>
<button id="metaMask">Pair MetaMask</button>
<button id="phantom">Pair Phantom</button>
<button id="vultisig">Pair Vultisig</button>
<button id="keplr">Pair Keplr</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>
Expand Down
57 changes: 3 additions & 54 deletions examples/sandbox/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@ import * as ledgerWebUSB from "@shapeshiftoss/hdwallet-ledger-webusb";
import * as metaMask from "@shapeshiftoss/hdwallet-metamask-multichain";
import * as native from "@shapeshiftoss/hdwallet-native";
import * as phantom from "@shapeshiftoss/hdwallet-phantom";
import * as portis from "@shapeshiftoss/hdwallet-portis";
import * as trezorConnect from "@shapeshiftoss/hdwallet-trezor-connect";
import * as vultisig from "@shapeshiftoss/hdwallet-vultisig";
import { WalletConnectProviderConfig } from "@shapeshiftoss/hdwallet-walletconnect";
import * as walletConnect from "@shapeshiftoss/hdwallet-walletconnect";
import * as walletConnectv2 from "@shapeshiftoss/hdwallet-walletconnectv2";
import { EthereumProviderOptions } from "@walletconnect/ethereum-provider/dist/types/EthereumProvider";
import { EthereumProviderOptions } from "@walletconnect/ethereum-provider";
import { TypedData } from "eip-712";
import $, { noop } from "jquery";
import Web3 from "web3";
Expand Down Expand Up @@ -76,13 +73,8 @@ import {

const keyring = new core.Keyring();

const portisAppId = "ff763d3d-9e34-45a1-81d1-caa39b9c64f9";
const mnemonic = "alcohol woman abuse must during monitor noble actual mixed trade anger aisle";
const walletConnectOptions: WalletConnectProviderConfig = {
rpc: {
1: "https://mainnet.infura.io/v3/d734c7eebcdf400185d7eb67322a7e57",
},
};

const walletConnectV2Options: EthereumProviderOptions = {
projectId: "5abef0455c768644c2bc866f1520374f",
chains: [1],
Expand Down Expand Up @@ -126,11 +118,9 @@ const coinbaseAdapter = coinbase.CoinbaseAdapter.useKeyring(keyring, coinbaseOpt
const keepkeyAdapter = keepkeyWebUSB.WebUSBKeepKeyAdapter.useKeyring(keyring);
const kkbridgeAdapter = keepkeyTcp.TCPKeepKeyAdapter.useKeyring(keyring);
const kkemuAdapter = keepkeyTcp.TCPKeepKeyAdapter.useKeyring(keyring);
const portisAdapter = portis.PortisAdapter.useKeyring(keyring, { portisAppId });
const metaMaskAdapter = metaMask.MetaMaskAdapter.useKeyring(keyring, "io.metamask");
const phantomAdapter = phantom.PhantomAdapter.useKeyring(keyring);
const vultisigAdapter = vultisig.VultisigAdapter.useKeyring(keyring);
const walletConnectAdapter = walletConnect.WalletConnectAdapter.useKeyring(keyring, walletConnectOptions);
const walletConnectV2Adapter = walletConnectv2.WalletConnectV2Adapter.useKeyring(keyring, walletConnectV2Options);
const keplrAdapter = keplr.KeplrAdapter.useKeyring(keyring);
const nativeAdapter = native.NativeAdapter.useKeyring(keyring);
Expand Down Expand Up @@ -158,14 +148,12 @@ const $kkemu = $("#kkemu");
const $trezor = $("#trezor");
const $ledgerwebusb = $("#ledgerwebusb");
const $ledgerwebhid = $("#ledgerwebhid");
const $portis = $("#portis");
const $native = $("#native");
const $gridplus = $("#gridplus");
const $metaMask = $("#metaMask");
const $phantom = $("#phantom");
const $vultisig = $("#vultisig");
const $coinbase = $("#coinbase");
const $walletConnect = $("#walletConnect");
const $walletConnectV2 = $("#walletConnectV2");
const $keplr = $("#keplr");
const $keyring = $("#keyring");
Expand Down Expand Up @@ -212,20 +200,6 @@ $ledgerwebhid.on("click", async (e) => {
$("#keyring select").val(await wallet.getDeviceID());
});

$portis.on("click", async (e) => {
e.preventDefault();
wallet = await portisAdapter.pairDevice();
window["wallet"] = wallet;

let deviceId = "nothing";
try {
deviceId = await wallet.getDeviceID();
} catch (error) {
console.error(error);
}
$("#keyring select").val(deviceId);
});

$native.on("click", async (e) => {
e.preventDefault();
wallet = await nativeAdapter.pairDevice("testid");
Expand Down Expand Up @@ -326,19 +300,6 @@ $keplr.on("click", async (e) => {
}
});

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

$walletConnectV2.on("click", async (e) => {
e.preventDefault();
try {
Expand Down Expand Up @@ -418,12 +379,6 @@ async function deviceConnected(deviceId) {
console.error("Could not initialize LedgerWebHIDAdapter", e);
}

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

try {
await nativeAdapter.initialize();
} catch (e) {
Expand Down Expand Up @@ -460,12 +415,6 @@ async function deviceConnected(deviceId) {
console.error("Could not initialize CoinbaseAdapter", e);
}

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

try {
await walletConnectV2Adapter.initialize();
} catch (e) {
Expand Down Expand Up @@ -731,7 +680,7 @@ $getXpubs.each(function () {
addressNList: hardenedPath,
curve: "secp256k1",
showDisplay: true, // Not supported by TrezorConnect or Ledger, but KeepKey should do it
coin: portis.isPortis(wallet) ? "Bitcoin" : "Ethereum",
coin: "Ethereum",
},
];

Expand Down
26 changes: 5 additions & 21 deletions integration/src/bitcoin/bitcoin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import * as ledger from "@shapeshiftoss/hdwallet-ledger";
import * as metamask from "@shapeshiftoss/hdwallet-metamask-multichain";
import * as native from "@shapeshiftoss/hdwallet-native";
import * as phantom from "@shapeshiftoss/hdwallet-phantom";
import * as portis from "@shapeshiftoss/hdwallet-portis";
import * as trezor from "@shapeshiftoss/hdwallet-trezor";
import * as vultisig from "@shapeshiftoss/hdwallet-vultisig";

Expand Down Expand Up @@ -63,7 +62,7 @@ export function bitcoinTests(get: () => { wallet: core.HDWallet; info: core.HDWa
test(
"btcSupportsCoin()",
async () => {
if (!wallet || portis.isPortis(wallet)) return;
if (!wallet) return;
// Non-EVM things are a pain to test with snaps on test env, this wasn't tested before and still isn't
if (metamask.isMetaMask(wallet)) return;
expect(wallet.btcSupportsCoin("Bitcoin")).toBeTruthy();
Expand All @@ -75,14 +74,7 @@ export function bitcoinTests(get: () => { wallet: core.HDWallet; info: core.HDWa
test(
"btcSupportsCoin() - Testnet",
async () => {
if (
!wallet ||
portis.isPortis(wallet) ||
phantom.isPhantom(wallet) ||
metamask.isMetaMask(wallet) ||
vultisig.isVultisig(wallet)
)
return;
if (!wallet || phantom.isPhantom(wallet) || metamask.isMetaMask(wallet) || vultisig.isVultisig(wallet)) return;
expect(wallet.btcSupportsCoin("Testnet")).toBeTruthy();
expect(await info.btcSupportsCoin("Testnet")).toBeTruthy();
},
Expand All @@ -94,7 +86,6 @@ export function bitcoinTests(get: () => { wallet: core.HDWallet; info: core.HDWa
!wallet ||
ledger.isLedger(wallet) ||
trezor.isTrezor(wallet) ||
portis.isPortis(wallet) ||
phantom.isPhantom(wallet) ||
vultisig.isVultisig(wallet)
)
Expand Down Expand Up @@ -179,7 +170,7 @@ export function bitcoinTests(get: () => { wallet: core.HDWallet; info: core.HDWa
test(
"btcGetAddress()",
async () => {
if (!wallet || portis.isPortis(wallet)) return;
if (!wallet) return;
await each(
[
[
Expand Down Expand Up @@ -249,7 +240,7 @@ export function bitcoinTests(get: () => { wallet: core.HDWallet; info: core.HDWa
test(
"btcSignTx() - p2pkh",
async () => {
if (!wallet || portis.isPortis(wallet) || phantom.isPhantom(wallet) || metamask.isMetaMask(wallet)) return;
if (!wallet || phantom.isPhantom(wallet) || metamask.isMetaMask(wallet)) return;
if (ledger.isLedger(wallet)) return; // FIXME: Expected failure
const tx: core.BitcoinTx = {
version: 1,
Expand Down Expand Up @@ -324,7 +315,7 @@ export function bitcoinTests(get: () => { wallet: core.HDWallet; info: core.HDWa
test(
"btcSignTx() - thorchain swap",
async () => {
if (!wallet || portis.isPortis(wallet) || phantom.isPhantom(wallet) || metamask.isMetaMask(wallet)) return;
if (!wallet || phantom.isPhantom(wallet) || metamask.isMetaMask(wallet)) return;
if (ledger.isLedger(wallet)) return; // FIXME: Expected failure
if (trezor.isTrezor(wallet)) return; //TODO: Add trezor support for op return data passed at top level
const tx: core.BitcoinTx = {
Expand Down Expand Up @@ -430,13 +421,6 @@ export function bitcoinTests(get: () => { wallet: core.HDWallet; info: core.HDWa
message: "Hello World",
});

// not implemented on portis
if (portis.isPortis(wallet)) {
// eslint-disable-next-line jest/no-conditional-expect
await expect(res).rejects.toThrowError("not supported");
return;
}

await expect(res).resolves.toEqual({
address: "1FH6ehAd5ZFXCM1cLGzHxK1s4dGdq1JusM",
signature:
Expand Down
5 changes: 2 additions & 3 deletions integration/src/bitcoin/testnet.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as core from "@shapeshiftoss/hdwallet-core";
import * as ledger from "@shapeshiftoss/hdwallet-ledger";
import * as metamask from "@shapeshiftoss/hdwallet-metamask-multichain";
import * as portis from "@shapeshiftoss/hdwallet-portis";

const MNEMONIC12_ALLALL = "all all all all all all all all all all all all";

Expand Down Expand Up @@ -32,7 +31,7 @@ export function testnetTests(get: () => { wallet: core.HDWallet; info: core.HDWa
test(
"btcSignTx() - p2sh-p2wpkh",
async () => {
if (!wallet || portis.isPortis(wallet)) return;
if (!wallet) return;
// Non-EVM things are a pain to test with snaps on test env, this wasn't tested before and still isn't
if (metamask.isMetaMask(wallet)) return;
if (ledger.isLedger(wallet)) return; // FIXME: Expected failure
Expand Down Expand Up @@ -77,7 +76,7 @@ export function testnetTests(get: () => { wallet: core.HDWallet; info: core.HDWa
);

test("btcSignTx() - p2wpkh", async () => {
if (!wallet || portis.isPortis(wallet)) return;
if (!wallet) return;
// Non-EVM things are a pain to test with snaps on test env, this wasn't tested before and still isn't
if (metamask.isMetaMask(wallet)) return;
if (ledger.isLedger(wallet)) return; // FIXME: Expected failure
Expand Down
3 changes: 0 additions & 3 deletions integration/src/ethereum/ethereum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as core from "@shapeshiftoss/hdwallet-core";
import { ETHSignTx } from "@shapeshiftoss/hdwallet-core";
import * as ledger from "@shapeshiftoss/hdwallet-ledger";
import * as metamask from "@shapeshiftoss/hdwallet-metamask-multichain";
import * as portis from "@shapeshiftoss/hdwallet-portis";
import * as trezor from "@shapeshiftoss/hdwallet-trezor";

const MNEMONIC12_NOPIN_NOPASSPHRASE = "alcohol woman abuse must during monitor noble actual mixed trade anger aisle";
Expand Down Expand Up @@ -259,7 +258,6 @@ export function ethereumTests(get: () => { wallet: core.HDWallet; info: core.HDW

if (ledger.isLedger(wallet)) return; // FIXME: just test kk and native for now
if (trezor.isTrezor(wallet)) return; // FIXME: just test kk and native for now
if (portis.isPortis(wallet)) return; // FIXME: just test kk and native for now

const txToSign = {
addressNList: core.bip32ToAddressNList("m/44'/60'/0'/0/0"),
Expand Down Expand Up @@ -306,7 +304,6 @@ export function ethereumTests(get: () => { wallet: core.HDWallet; info: core.HDW
if (!wallet) return;
if (ledger.isLedger(wallet)) return; // FIXME: just test kk for now
if (trezor.isTrezor(wallet)) return; // FIXME: just test kk for now
if (portis.isPortis(wallet)) return; // FIXME: just test kk for now

const txToSign = {
addressNList: core.bip32ToAddressNList("m/44'/60'/0'/0/0"),
Expand Down
4 changes: 0 additions & 4 deletions integration/src/integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ import * as ledger from "@shapeshiftoss/hdwallet-ledger";
import * as metamask from "@shapeshiftoss/hdwallet-metamask-multichain";
import * as native from "@shapeshiftoss/hdwallet-native";
import * as phantom from "@shapeshiftoss/hdwallet-phantom";
import * as portis from "@shapeshiftoss/hdwallet-portis";
import * as trezor from "@shapeshiftoss/hdwallet-trezor";
import * as vultisig from "@shapeshiftoss/hdwallet-vultisig";
import * as walletconnect from "@shapeshiftoss/hdwallet-walletconnect";

import { binanceTests } from "./binance";
import { btcTests } from "./bitcoin";
Expand Down Expand Up @@ -53,10 +51,8 @@ export function integration(suite: WalletSuite): void {
(keepkey.isKeepKey(wallet) ? 1 : 0) +
(trezor.isTrezor(wallet) ? 1 : 0) +
(ledger.isLedger(wallet) ? 1 : 0) +
(portis.isPortis(wallet) ? 1 : 0) +
(native.isNative(wallet) ? 1 : 0) +
(metamask.isMetaMask(wallet) ? 1 : 0) +
(walletconnect.isWalletConnect(wallet) ? 1 : 0) +
(phantom.isPhantom(wallet) ? 1 : 0) +
(vultisig.isVultisig(wallet) ? 1 : 0)
).toEqual(1);
Expand Down
3 changes: 0 additions & 3 deletions integration/src/portis.test.ts

This file was deleted.

Loading