Skip to content
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
7 changes: 7 additions & 0 deletions examples/sandbox/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ <h4>Xpubs</h4>
<button class="button button-outline getXpubs coin-Litecoin">Litecoin</button>
<button class="button button-outline getXpubs coin-BitcoinCash">Bitcoin Cash</button>
<button class="button button-outline getXpubs coin-Ethereum">Ethereum</button>
<button class="button button-outline getXpubs coin-Zcash">Zcash</button>
<input type="text" class="xpubResults" />
</div>
<div class="container">
Expand Down Expand Up @@ -387,6 +388,12 @@ <h4>DigiByte</h4>
<button class="button button-outline" id="dgbTx">Tx</button>
<input type="text" id="dgbResults" />
</div>
<div class="container">
<h4>Zcash</h4>
<button class="button button-outline" id="zecAddr">Address</button>
<button class="button button-outline" id="zecTx">Tx</button>
<input type="text" id="zecResults" />
</div>

<div id="#pinModal" class="modal" aria-hidden="true">
<div class="modal-dialog">
Expand Down
87 changes: 87 additions & 0 deletions examples/sandbox/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,15 @@ $getXpubs.each(function () {
scriptType: core.BTCInputScriptType.SpendAddress,
},
];
const zcashGetPublicKeysInput = [
{
addressNList: [0x80000000 + 44, 0x80000000 + 133, 0x80000000 + 0],
curve: "secp256k1",
showDisplay: true,
coin: "Zcash",
scriptType: core.BTCInputScriptType.SpendAddress,
},
];
const hardenedPathGetPublicKeysInput = [
{
addressNList: hardenedPath,
Expand All @@ -741,6 +750,7 @@ $getXpubs.each(function () {
...ltcGetPublicKeysInput,
...bchGetPublicKeysInput,
...dogeGetPublicKeysInput,
...zcashGetPublicKeysInput,
...hardenedPathGetPublicKeysInput,
];

Expand Down Expand Up @@ -3661,3 +3671,80 @@ $btcTxSegWitNative.on("click", async (e) => {
// set mnemonic back to alcohol abuse
await wallet.loadDevice({ mnemonic });
});

/**
* Zcash
*/

const $zecAddr = $("#zecAddr");
const $zecTx = $("#zecTx");
const $zecResults = $("#zecResults");

const zecBip44 = {
scriptType: core.BTCInputScriptType.SpendAddress,
addressNList: [0x80000000 + 44, 0x80000000 + 133, 0x80000000 + 0],
};

$zecAddr.on("click", async (e) => {
e.preventDefault();
if (!wallet) {
$zecResults.val("No wallet?");
return;
}
if (core.supportsBTC(wallet)) {
const res = await wallet.btcGetAddress({
addressNList: zecBip44.addressNList.concat([0, 0]),
coin: "Zcash",
scriptType: zecBip44.scriptType,
showDisplay: true,
});
$zecResults.val(res);
} else {
const label = await wallet.getLabel();
$zecResults.val(label + " does not support Zcash");
}
});

$zecTx.on("click", async (e) => {
e.preventDefault();
if (!wallet) {
$zecResults.val("No wallet?");
return;
}
if (core.supportsBTC(wallet)) {
const txid = "3fdf3bdc14a24c02a1ba3b5610fe3d743fc27ad7b99b5a15577f290378b8a441";
const hex =
"050000800a27a7265510e7c80000000000000000017650edf257e6a63c8c30681a2cc074d1103486e8d8b69ef9169da7d6380c0ad2020000006b483045022100edf80562e29a877913297ec485801e7c29f2c2a2d87d6b4870df3eea14e7861902206b4c0cff78c3b29f75a8e5e1703f7b07c2f91dd87b2883cd29017a268d4fbbe8012102ef453a67db8d3a36ad12899b54899dd5d54f5c01cfb7d5f9b763ada476ae9e5effffffff03d28d0900000000001976a914c995b4ce5c3f15426c947b53e69a2d18e1a6cfbd88ac0000000000000000466a444f55543a423841444145304445463836373743303644323042363031453132374637343133444532423534413332304346363932353645354538384239424136323135439984270b9d0000001976a914fb39a8f9d044d4bb941d6c559f81cb144bf683dc88ac000000";

const inputs = [
{
addressNList: zecBip44.addressNList.concat([0, 0]),
scriptType: core.BTCInputScriptType.SpendAddress,
amount: String(626130),
vout: 0,
txid: txid,
hex,
},
];

const outputs = [
{
address: "t1cFVAfga6NfFJGLYgUyCijxXHmu7ir7BPE",
addressType: core.BTCOutputAddressType.Spend,
scriptType: core.BTCOutputScriptType.PayToAddress,
amount: String(625130),
isChange: false,
},
];

const res = await wallet.btcSignTx({
coin: "Zcash",
inputs,
outputs,
});
$zecResults.val(res.serializedTx);
} else {
const label = await wallet.getLabel();
$zecResults.val(label + " does not support Zcash");
}
});
38 changes: 19 additions & 19 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.62.22",
"version": "1.62.23",
"license": "MIT",
"private": true,
"browserslist": "> 0.5%, last 2 versions, not dead",
Expand All @@ -12,24 +12,24 @@
"dependencies": {
"@esm2cjs/p-queue": "^7.3.0",
"@metamask/eth-sig-util": "^7.0.0",
"@shapeshiftoss/hdwallet-coinbase": "1.62.22",
"@shapeshiftoss/hdwallet-core": "1.62.22",
"@shapeshiftoss/hdwallet-keepkey": "1.62.22",
"@shapeshiftoss/hdwallet-keepkey-tcp": "1.62.22",
"@shapeshiftoss/hdwallet-keepkey-webusb": "1.62.22",
"@shapeshiftoss/hdwallet-keplr": "1.62.22",
"@shapeshiftoss/hdwallet-ledger": "1.62.22",
"@shapeshiftoss/hdwallet-ledger-webhid": "1.62.22",
"@shapeshiftoss/hdwallet-ledger-webusb": "1.62.22",
"@shapeshiftoss/hdwallet-metamask-multichain": "1.62.22",
"@shapeshiftoss/hdwallet-native": "1.62.22",
"@shapeshiftoss/hdwallet-phantom": "1.62.22",
"@shapeshiftoss/hdwallet-portis": "1.62.22",
"@shapeshiftoss/hdwallet-trezor": "1.62.22",
"@shapeshiftoss/hdwallet-trezor-connect": "1.62.22",
"@shapeshiftoss/hdwallet-vultisig": "1.62.22",
"@shapeshiftoss/hdwallet-walletconnect": "1.62.22",
"@shapeshiftoss/hdwallet-walletconnectv2": "1.62.22",
"@shapeshiftoss/hdwallet-coinbase": "1.62.23",
"@shapeshiftoss/hdwallet-core": "1.62.23",
"@shapeshiftoss/hdwallet-keepkey": "1.62.23",
"@shapeshiftoss/hdwallet-keepkey-tcp": "1.62.23",
"@shapeshiftoss/hdwallet-keepkey-webusb": "1.62.23",
"@shapeshiftoss/hdwallet-keplr": "1.62.23",
"@shapeshiftoss/hdwallet-ledger": "1.62.23",
"@shapeshiftoss/hdwallet-ledger-webhid": "1.62.23",
"@shapeshiftoss/hdwallet-ledger-webusb": "1.62.23",
"@shapeshiftoss/hdwallet-metamask-multichain": "1.62.23",
"@shapeshiftoss/hdwallet-native": "1.62.23",
"@shapeshiftoss/hdwallet-phantom": "1.62.23",
"@shapeshiftoss/hdwallet-portis": "1.62.23",
"@shapeshiftoss/hdwallet-trezor": "1.62.23",
"@shapeshiftoss/hdwallet-trezor-connect": "1.62.23",
"@shapeshiftoss/hdwallet-vultisig": "1.62.23",
"@shapeshiftoss/hdwallet-walletconnect": "1.62.23",
"@shapeshiftoss/hdwallet-walletconnectv2": "1.62.23",
"bip32": "^2.0.4",
"eip-712": "^1.0.0",
"jquery": "^3.7.1",
Expand Down
22 changes: 11 additions & 11 deletions integration/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shapeshiftoss/integration",
"version": "1.62.22",
"version": "1.62.23",
"main": "index.js",
"license": "MIT",
"private": true,
Expand All @@ -11,16 +11,16 @@
},
"dependencies": {
"@bitcoinerlab/secp256k1": "^1.1.1",
"@shapeshiftoss/hdwallet-core": "1.62.22",
"@shapeshiftoss/hdwallet-keepkey": "1.62.22",
"@shapeshiftoss/hdwallet-keepkey-nodewebusb": "1.62.22",
"@shapeshiftoss/hdwallet-keepkey-tcp": "1.62.22",
"@shapeshiftoss/hdwallet-ledger": "1.62.22",
"@shapeshiftoss/hdwallet-metamask-multichain": "1.62.22",
"@shapeshiftoss/hdwallet-native": "1.62.22",
"@shapeshiftoss/hdwallet-portis": "1.62.22",
"@shapeshiftoss/hdwallet-trezor": "1.62.22",
"@shapeshiftoss/hdwallet-vultisig": "1.62.22",
"@shapeshiftoss/hdwallet-core": "1.62.23",
"@shapeshiftoss/hdwallet-keepkey": "1.62.23",
"@shapeshiftoss/hdwallet-keepkey-nodewebusb": "1.62.23",
"@shapeshiftoss/hdwallet-keepkey-tcp": "1.62.23",
"@shapeshiftoss/hdwallet-ledger": "1.62.23",
"@shapeshiftoss/hdwallet-metamask-multichain": "1.62.23",
"@shapeshiftoss/hdwallet-native": "1.62.23",
"@shapeshiftoss/hdwallet-portis": "1.62.23",
"@shapeshiftoss/hdwallet-trezor": "1.62.23",
"@shapeshiftoss/hdwallet-vultisig": "1.62.23",
"fast-json-stable-stringify": "^2.1.0",
"msw": "^0.27.1",
"whatwg-fetch": "^3.6.2"
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.62.22",
"version": "1.62.23",
"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.62.22",
"version": "1.62.23",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -15,7 +15,7 @@
},
"dependencies": {
"@coinbase/wallet-sdk": "^3.6.6",
"@shapeshiftoss/hdwallet-core": "1.62.22",
"@shapeshiftoss/hdwallet-core": "1.62.23",
"eth-rpc-errors": "^4.0.3",
"lodash": "^4.17.21"
},
Expand Down
4 changes: 2 additions & 2 deletions 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.62.22",
"version": "1.62.23",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -14,7 +14,7 @@
"prepublishOnly": "yarn clean && yarn build"
},
"dependencies": {
"@shapeshiftoss/bitcoinjs-lib": "7.0.0-shapeshift.0",
"@shapeshiftoss/bitcoinjs-lib": "7.0.0-shapeshift.2",
"@shapeshiftoss/proto-tx-builder": "0.10.0",
"@solana/web3.js": "1.95.8",
"eip-712": "^1.0.0",
Expand Down
5 changes: 4 additions & 1 deletion packages/hdwallet-core/src/bitcoin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,10 @@ export function validateVoutOrdering(msg: BTCSignTxNative, tx: bitcoin.Transacti
}
// Check and make sure vout:2 has OP_RETURN data
const opcode = bitcoin.script.decompile(tx.outs[2].script)?.[0];
if (Object.keys(bitcoin.script.OPS).find((k) => bitcoin.script.OPS[k] === opcode) != "OP_RETURN") {
if (
Object.keys(bitcoin.script.OPS).find((k) => bitcoin.script.OPS[k as keyof typeof bitcoin.script.OPS] === opcode) !=
"OP_RETURN"
) {
console.error("OP_RETURN output not found for transaction.");
return false;
}
Expand Down
21 changes: 21 additions & 0 deletions packages/hdwallet-core/src/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,27 @@ const networks: Networks = {
},
p2wpkh: bip32BTC.p2wpkh,
},
zcash: {
base: {
messagePrefix: "\x19Zcash Signed Message:\n",
bech32: "",
pubKeyHash: 0x1cb8,
scriptHash: 0x1cbd,
wif: 0x80,
},
p2sh: {
bip32: {
public: 0x0488b21e,
private: 0x0488ade4,
},
},
p2pkh: {
bip32: {
public: 0x0488b21e,
private: 0x0488ade4,
},
},
},
testnet: {
base: {
messagePrefix: "\x18Bitcoin Signed Message:\n",
Expand Down
1 change: 1 addition & 0 deletions packages/hdwallet-core/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ export const slip44Table = Object.freeze({
DigiByte: 20,
Dogecoin: 3,
BitcoinSV: 236,
Zcash: 133,
Atom: 118,
Osmo: 118,
Arkeo: 118,
Expand Down
4 changes: 2 additions & 2 deletions packages/hdwallet-gridplus/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shapeshiftoss/hdwallet-gridplus",
"version": "1.62.22",
"version": "1.62.23",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -20,7 +20,7 @@
"@ethereumjs/rlp": "5.0.2",
"@ethereumjs/tx": "5.4.0",
"@metamask/eth-sig-util": "^7.0.0",
"@shapeshiftoss/hdwallet-core": "1.62.22",
"@shapeshiftoss/hdwallet-core": "1.62.23",
"bech32": "^1.1.4",
"bs58": "^5.0.0",
"crypto-js": "^4.2.0",
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.62.22",
"version": "1.62.23",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -14,7 +14,7 @@
"prepublishOnly": "yarn clean && yarn build"
},
"dependencies": {
"@shapeshiftoss/hdwallet-core": "1.62.22",
"@shapeshiftoss/hdwallet-keepkey": "1.62.22"
"@shapeshiftoss/hdwallet-core": "1.62.23",
"@shapeshiftoss/hdwallet-keepkey": "1.62.23"
}
}
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.62.22",
"version": "1.62.23",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -14,7 +14,7 @@
"prepublishOnly": "yarn clean && yarn build"
},
"dependencies": {
"@shapeshiftoss/hdwallet-keepkey": "1.62.22",
"@shapeshiftoss/hdwallet-keepkey": "1.62.23",
"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.62.22",
"version": "1.62.23",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -14,7 +14,7 @@
"prepublishOnly": "yarn clean && yarn build"
},
"dependencies": {
"@shapeshiftoss/hdwallet-keepkey": "1.62.22"
"@shapeshiftoss/hdwallet-keepkey": "1.62.23"
},
"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.62.22",
"version": "1.62.23",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -14,8 +14,8 @@
"prepublishOnly": "yarn clean && yarn build"
},
"dependencies": {
"@shapeshiftoss/hdwallet-core": "1.62.22",
"@shapeshiftoss/hdwallet-keepkey": "1.62.22"
"@shapeshiftoss/hdwallet-core": "1.62.23",
"@shapeshiftoss/hdwallet-keepkey": "1.62.23"
},
"peerDependencies": {
"usb": "^2.3.1"
Expand Down
Loading