@shapeshiftoss/hdwallet-vultisig 1.62.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/dist/adapter.d.ts +22 -0
- package/dist/adapter.d.ts.map +1 -0
- package/dist/adapter.js +84 -0
- package/dist/adapter.js.map +1 -0
- package/dist/bitcoin.d.ts +6 -0
- package/dist/bitcoin.d.ts.map +1 -0
- package/dist/bitcoin.js +184 -0
- package/dist/bitcoin.js.map +1 -0
- package/dist/cosmos.d.ts +6 -0
- package/dist/cosmos.d.ts.map +1 -0
- package/dist/cosmos.js +47 -0
- package/dist/cosmos.js.map +1 -0
- package/dist/ethereum.d.ts +12 -0
- package/dist/ethereum.d.ts.map +1 -0
- package/dist/ethereum.js +193 -0
- package/dist/ethereum.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/solana.d.ts +9 -0
- package/dist/solana.d.ts.map +1 -0
- package/dist/solana.js +55 -0
- package/dist/solana.js.map +1 -0
- package/dist/thorchain.d.ts +6 -0
- package/dist/thorchain.d.ts.map +1 -0
- package/dist/thorchain.js +46 -0
- package/dist/thorchain.js.map +1 -0
- package/dist/types.d.ts +50 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/vultisig.d.ts +123 -0
- package/dist/vultisig.d.ts.map +1 -0
- package/dist/vultisig.js +482 -0
- package/dist/vultisig.js.map +1 -0
- package/package.json +31 -0
- package/src/adapter.ts +72 -0
- package/src/bitcoin.ts +171 -0
- package/src/cosmos.ts +43 -0
- package/src/ethereum.ts +169 -0
- package/src/index.ts +2 -0
- package/src/solana.ts +31 -0
- package/src/thorchain.ts +43 -0
- package/src/types.ts +62 -0
- package/src/vultisig.test.ts +253 -0
- package/src/vultisig.ts +459 -0
- package/tsconfig.json +10 -0
- package/tsconfig.tsbuildinfo +1 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 ShapeShift
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as core from "@shapeshiftoss/hdwallet-core";
|
|
2
|
+
import { VultisigEvmProvider, VultisigGetVault, VultisigOfflineProvider, VultisigSolanaProvider, VultisigUtxoProvider } from "./types";
|
|
3
|
+
import { VultisigHDWallet } from "./vultisig";
|
|
4
|
+
declare global {
|
|
5
|
+
interface Window {
|
|
6
|
+
vultisig?: {
|
|
7
|
+
getVault: () => Promise<VultisigGetVault>;
|
|
8
|
+
ethereum?: VultisigEvmProvider;
|
|
9
|
+
bitcoin?: VultisigUtxoProvider;
|
|
10
|
+
solana?: VultisigSolanaProvider;
|
|
11
|
+
keplr?: VultisigOfflineProvider;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export declare class VultisigAdapter {
|
|
16
|
+
keyring: core.Keyring;
|
|
17
|
+
private constructor();
|
|
18
|
+
static useKeyring(keyring: core.Keyring): VultisigAdapter;
|
|
19
|
+
initialize(): Promise<number>;
|
|
20
|
+
pairDevice(): Promise<VultisigHDWallet | undefined>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,8BAA8B,CAAC;AAErD,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,uBAAuB,EACvB,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,QAAQ,CAAC,EAAE;YACT,QAAQ,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,CAAC;YAC1C,QAAQ,CAAC,EAAE,mBAAmB,CAAC;YAC/B,OAAO,CAAC,EAAE,oBAAoB,CAAC;YAC/B,MAAM,CAAC,EAAE,sBAAsB,CAAC;YAChC,KAAK,CAAC,EAAE,uBAAuB,CAAC;SACjC,CAAC;KACH;CACF;AAED,qBAAa,eAAe;IAC1B,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC;IAEtB,OAAO;WAIO,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO;IAIjC,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAI7B,UAAU,IAAI,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;CAiCjE"}
|
package/dist/adapter.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
exports.VultisigAdapter = void 0;
|
|
36
|
+
const core = __importStar(require("@shapeshiftoss/hdwallet-core"));
|
|
37
|
+
const vultisig_1 = require("./vultisig");
|
|
38
|
+
class VultisigAdapter {
|
|
39
|
+
constructor(keyring) {
|
|
40
|
+
this.keyring = keyring;
|
|
41
|
+
}
|
|
42
|
+
static useKeyring(keyring) {
|
|
43
|
+
return new VultisigAdapter(keyring);
|
|
44
|
+
}
|
|
45
|
+
initialize() {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
return Object.keys(this.keyring.wallets).length;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
pairDevice() {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
var _a, _b, _c, _d, _e;
|
|
53
|
+
const evmProvider = (_a = window.vultisig) === null || _a === void 0 ? void 0 : _a.ethereum;
|
|
54
|
+
const bitcoinProvider = (_b = window.vultisig) === null || _b === void 0 ? void 0 : _b.bitcoin;
|
|
55
|
+
const solanaProvider = (_c = window.vultisig) === null || _c === void 0 ? void 0 : _c.solana;
|
|
56
|
+
const thorchainProvider = (_d = window.vultisig) === null || _d === void 0 ? void 0 : _d.keplr;
|
|
57
|
+
const cosmosProvider = (_e = window.vultisig) === null || _e === void 0 ? void 0 : _e.keplr;
|
|
58
|
+
if (!evmProvider || !bitcoinProvider || !solanaProvider || !thorchainProvider || !cosmosProvider) {
|
|
59
|
+
window.open("https://vultisig.com/", "_blank");
|
|
60
|
+
console.error("Please install Vultisig!");
|
|
61
|
+
throw new Error("Vultisig provider not found");
|
|
62
|
+
}
|
|
63
|
+
// Request authorization before accessing vault
|
|
64
|
+
if (!evmProvider.request) {
|
|
65
|
+
throw new Error("Vultisig EVM provider missing request method");
|
|
66
|
+
}
|
|
67
|
+
yield evmProvider.request({ method: "eth_requestAccounts", params: [] });
|
|
68
|
+
const wallet = new vultisig_1.VultisigHDWallet({
|
|
69
|
+
evmProvider,
|
|
70
|
+
bitcoinProvider,
|
|
71
|
+
solanaProvider,
|
|
72
|
+
thorchainProvider,
|
|
73
|
+
cosmosProvider,
|
|
74
|
+
});
|
|
75
|
+
yield wallet.initialize();
|
|
76
|
+
const deviceID = yield wallet.getDeviceID();
|
|
77
|
+
this.keyring.add(wallet, deviceID);
|
|
78
|
+
this.keyring.emit(["Vultisig", deviceID, core.Events.CONNECT], deviceID);
|
|
79
|
+
return wallet;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
exports.VultisigAdapter = VultisigAdapter;
|
|
84
|
+
//# sourceMappingURL=adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mEAAqD;AASrD,yCAA8C;AAc9C,MAAa,eAAe;IAG1B,YAAoB,OAAqB;QACvC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAEM,MAAM,CAAC,UAAU,CAAC,OAAqB;QAC5C,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAEY,UAAU;;YACrB,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC;QAClD,CAAC;KAAA;IAEY,UAAU;;;YACrB,MAAM,WAAW,GAAG,MAAA,MAAM,CAAC,QAAQ,0CAAE,QAAQ,CAAC;YAC9C,MAAM,eAAe,GAAG,MAAA,MAAM,CAAC,QAAQ,0CAAE,OAAO,CAAC;YACjD,MAAM,cAAc,GAAG,MAAA,MAAM,CAAC,QAAQ,0CAAE,MAAM,CAAC;YAC/C,MAAM,iBAAiB,GAAG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igUtxoProvider } from "./types";
|
|
3
|
+
export declare function btcGetAddress(provider: VultisigUtxoProvider, msg: core.BTCGetAddress): Promise<string | null>;
|
|
4
|
+
export declare const btcGetAccountPaths: (msg: core.BTCGetAccountPaths) => Array<core.BTCAccountPath>;
|
|
5
|
+
export declare function bitcoinSignTx(msg: core.BTCSignTx, provider: VultisigUtxoProvider): Promise<core.BTCSignedTx | null>;
|
|
6
|
+
//# sourceMappingURL=bitcoin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bitcoin.d.ts","sourceRoot":"","sources":["../src/bitcoin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,8BAA8B,CAAC;AAGrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAW/C,wBAAsB,aAAa,CAAC,QAAQ,EAAE,oBAAoB,EAAE,GAAG,EAAE,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAiBnH;AAED,eAAO,MAAM,kBAAkB,QAAS,IAAI,CAAC,kBAAkB,KAAG,KAAK,CAAC,IAAI,CAAC,cAAc,CAmB1F,CAAC;AA6CF,wBAAsB,aAAa,CACjC,GAAG,EAAE,IAAI,CAAC,SAAS,EACnB,QAAQ,EAAE,oBAAoB,GAC7B,OAAO,CAAC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,CAqElC"}
|
package/dist/bitcoin.js
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
exports.btcGetAccountPaths = void 0;
|
|
36
|
+
exports.btcGetAddress = btcGetAddress;
|
|
37
|
+
exports.bitcoinSignTx = bitcoinSignTx;
|
|
38
|
+
const bitcoin = __importStar(require("@shapeshiftoss/bitcoinjs-lib"));
|
|
39
|
+
const core = __importStar(require("@shapeshiftoss/hdwallet-core"));
|
|
40
|
+
const hdwallet_core_1 = require("@shapeshiftoss/hdwallet-core");
|
|
41
|
+
const getNetwork = (coin) => {
|
|
42
|
+
switch (coin.toLowerCase()) {
|
|
43
|
+
case "bitcoin":
|
|
44
|
+
return bitcoin.networks.bitcoin;
|
|
45
|
+
default:
|
|
46
|
+
throw new Error(`Unsupported coin: ${coin}`);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
function btcGetAddress(provider, msg) {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
const value = yield (() => __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
switch (msg.coin.toLowerCase()) {
|
|
53
|
+
case "bitcoin": {
|
|
54
|
+
const accounts = yield provider.request({
|
|
55
|
+
method: "request_accounts",
|
|
56
|
+
params: [],
|
|
57
|
+
});
|
|
58
|
+
return accounts.length > 0 ? accounts[0] : null;
|
|
59
|
+
}
|
|
60
|
+
default:
|
|
61
|
+
throw new Error("Vultisig does not support");
|
|
62
|
+
}
|
|
63
|
+
}))();
|
|
64
|
+
if (!value || typeof value !== "string")
|
|
65
|
+
return null;
|
|
66
|
+
return value;
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
const btcGetAccountPaths = (msg) => {
|
|
70
|
+
const slip44 = core.slip44ByCoin(msg.coin);
|
|
71
|
+
if (slip44 === undefined)
|
|
72
|
+
return [];
|
|
73
|
+
const bip84 = core.segwitNativeAccount(msg.coin, slip44, msg.accountIdx);
|
|
74
|
+
const coinPaths = {
|
|
75
|
+
bitcoin: [bip84],
|
|
76
|
+
};
|
|
77
|
+
let paths = coinPaths[msg.coin.toLowerCase()] || [];
|
|
78
|
+
if (msg.scriptType !== undefined) {
|
|
79
|
+
paths = paths.filter((path) => {
|
|
80
|
+
return path.scriptType === msg.scriptType;
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
return paths;
|
|
84
|
+
};
|
|
85
|
+
exports.btcGetAccountPaths = btcGetAccountPaths;
|
|
86
|
+
function addInput(psbt, input) {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
switch (input.scriptType) {
|
|
89
|
+
case hdwallet_core_1.BTCInputScriptType.SpendWitness: {
|
|
90
|
+
psbt.addInput({
|
|
91
|
+
hash: input.txid,
|
|
92
|
+
index: input.vout,
|
|
93
|
+
nonWitnessUtxo: Buffer.from(input.hex, "hex"),
|
|
94
|
+
});
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
default:
|
|
98
|
+
throw new Error(`Unsupported script type: ${input.scriptType}`);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
function addOutput(provider, psbt, output, coin) {
|
|
103
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
104
|
+
if (!output.amount)
|
|
105
|
+
throw new Error("Invalid output - missing amount.");
|
|
106
|
+
const address = yield (() => __awaiter(this, void 0, void 0, function* () {
|
|
107
|
+
if (output.address)
|
|
108
|
+
return output.address;
|
|
109
|
+
if (output.addressNList) {
|
|
110
|
+
const outputAddress = yield btcGetAddress(provider, {
|
|
111
|
+
addressNList: output.addressNList,
|
|
112
|
+
coin,
|
|
113
|
+
showDisplay: false,
|
|
114
|
+
});
|
|
115
|
+
if (!outputAddress)
|
|
116
|
+
throw new Error("Could not get address from wallet");
|
|
117
|
+
return outputAddress;
|
|
118
|
+
}
|
|
119
|
+
}))();
|
|
120
|
+
if (!address)
|
|
121
|
+
throw new Error("Invalid output - no address");
|
|
122
|
+
psbt.addOutput({ address, value: BigInt(output.amount) });
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function bitcoinSignTx(msg, provider) {
|
|
126
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
127
|
+
var _a;
|
|
128
|
+
try {
|
|
129
|
+
const network = getNetwork(msg.coin);
|
|
130
|
+
const psbt = new bitcoin.Psbt({ network });
|
|
131
|
+
psbt.setVersion((_a = msg.version) !== null && _a !== void 0 ? _a : 2);
|
|
132
|
+
if (msg.locktime) {
|
|
133
|
+
psbt.setLocktime(msg.locktime);
|
|
134
|
+
}
|
|
135
|
+
for (const input of msg.inputs) {
|
|
136
|
+
yield addInput(psbt, input);
|
|
137
|
+
}
|
|
138
|
+
for (const output of msg.outputs) {
|
|
139
|
+
yield addOutput(provider, psbt, output, msg.coin);
|
|
140
|
+
}
|
|
141
|
+
if (msg.opReturnData) {
|
|
142
|
+
const data = Buffer.from(msg.opReturnData, "utf-8");
|
|
143
|
+
const embed = bitcoin.payments.embed({ data: [data] });
|
|
144
|
+
const script = embed.output;
|
|
145
|
+
if (!script)
|
|
146
|
+
throw new Error("unable to build OP_RETURN script");
|
|
147
|
+
// OP_RETURN_DATA output is always 0 value
|
|
148
|
+
psbt.addOutput({ script, value: BigInt(0) });
|
|
149
|
+
}
|
|
150
|
+
const inputsToSign = yield Promise.all(msg.inputs.map((input, index) => __awaiter(this, void 0, void 0, function* () {
|
|
151
|
+
const address = yield btcGetAddress(provider, {
|
|
152
|
+
addressNList: input.addressNList,
|
|
153
|
+
coin: msg.coin,
|
|
154
|
+
showDisplay: false,
|
|
155
|
+
});
|
|
156
|
+
if (!address)
|
|
157
|
+
throw new Error("Could not get address from wallet");
|
|
158
|
+
return {
|
|
159
|
+
address,
|
|
160
|
+
signingIndexes: [index],
|
|
161
|
+
sigHash: bitcoin.Transaction.SIGHASH_ALL,
|
|
162
|
+
};
|
|
163
|
+
})));
|
|
164
|
+
const signedPsbtBuffer = yield provider.signPSBT(psbt.toBuffer(), { inputsToSign }, false);
|
|
165
|
+
const signedPsbt = bitcoin.Psbt.fromBuffer(signedPsbtBuffer, { network });
|
|
166
|
+
signedPsbt.finalizeAllInputs();
|
|
167
|
+
const tx = signedPsbt.extractTransaction();
|
|
168
|
+
// If this is a THORChain transaction, validate the vout ordering
|
|
169
|
+
if (msg.vaultAddress && !core.validateVoutOrdering(msg, tx)) {
|
|
170
|
+
throw new Error("Improper vout ordering for BTC Thorchain transaction");
|
|
171
|
+
}
|
|
172
|
+
const signatures = signedPsbt.data.inputs.map((input) => input.partialSig ? Buffer.from(input.partialSig[0].signature).toString("hex") : "");
|
|
173
|
+
return {
|
|
174
|
+
signatures,
|
|
175
|
+
serializedTx: tx.toHex(),
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
catch (error) {
|
|
179
|
+
console.error("Error signing with Vultisig:", error);
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
//# sourceMappingURL=bitcoin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bitcoin.js","sourceRoot":"","sources":["../src/bitcoin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,sCAiBC;AAkED,sCAwEC;AA1KD,sEAAwD;AACxD,mEAAqD;AACrD,gEAAkE;AAIlE,MAAM,UAAU,GAAG,CAAC,IAAY,EAA4B,EAAE;IAC5D,QAAQ,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;QAC3B,KAAK,SAAS;YACZ,OAAO,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;QAClC;YACE,MAAM,IAAI,KAAK,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAC;IACjD,CAAC;AACH,CAAC,CAAC;AAEF,SAAsB,aAAa,CAAC,QAA8B,EAAE,GAAuB;;QACzF,MAAM,KAAK,GAAG,MAAM,CAAC,GAAS,EAAE;YAC9B,QAAQ,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;gBAC/B,KAAK,SAAS,CAAC,CAAC,CAAC;oBACf,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAqB;wBAC1D,MAAM,EAAE,kBAAkB;wBAC1B,MAAM,EAAE,EAAE;qBACX,CAAC,CAAC;oBACH,OAAO,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;gBAClD,CAAC;gBACD;oBACE,MAAM,I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;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,8BAA8B,EAAE,KAAK,CAAC,CAAC;YACrD,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;CAAA"}
|
package/dist/cosmos.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CosmosAccountPath, CosmosGetAccountPaths, CosmosSignedTx, CosmosSignTx } from "@shapeshiftoss/hdwallet-core";
|
|
2
|
+
import { VultisigOfflineProvider } from "./types";
|
|
3
|
+
export declare function cosmosGetAccountPaths(msg: CosmosGetAccountPaths): Array<CosmosAccountPath>;
|
|
4
|
+
export declare function cosmosGetAddress(provider: VultisigOfflineProvider): Promise<string | undefined>;
|
|
5
|
+
export declare function cosmosSignTx(provider: VultisigOfflineProvider, msg: CosmosSignTx): Promise<CosmosSignedTx>;
|
|
6
|
+
//# sourceMappingURL=cosmos.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cosmos.d.ts","sourceRoot":"","sources":["../src/cosmos.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,cAAc,EACd,YAAY,EAEb,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAIlD,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,qBAAqB,GAAG,KAAK,CAAC,iBAAiB,CAAC,CAM1F;AAED,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,uBAAuB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAIrG;AAED,wBAAsB,YAAY,CAAC,QAAQ,EAAE,uBAAuB,EAAE,GAAG,EAAE,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC,CAahH"}
|
package/dist/cosmos.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.cosmosGetAccountPaths = cosmosGetAccountPaths;
|
|
13
|
+
exports.cosmosGetAddress = cosmosGetAddress;
|
|
14
|
+
exports.cosmosSignTx = cosmosSignTx;
|
|
15
|
+
const hdwallet_core_1 = require("@shapeshiftoss/hdwallet-core");
|
|
16
|
+
const proto_tx_builder_1 = require("@shapeshiftoss/proto-tx-builder");
|
|
17
|
+
const ATOM_CHAIN = "cosmoshub-4";
|
|
18
|
+
function cosmosGetAccountPaths(msg) {
|
|
19
|
+
return [
|
|
20
|
+
{
|
|
21
|
+
addressNList: [0x80000000 + 44, 0x80000000 + (0, hdwallet_core_1.slip44ByCoin)("Atom"), 0x80000000 + msg.accountIdx, 0, 0],
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
}
|
|
25
|
+
function cosmosGetAddress(provider) {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
var _a;
|
|
28
|
+
const offlineSigner = provider.getOfflineSigner(ATOM_CHAIN);
|
|
29
|
+
const accounts = yield offlineSigner.getAccounts();
|
|
30
|
+
return (_a = accounts[0]) === null || _a === void 0 ? void 0 : _a.address;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function cosmosSignTx(provider, msg) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const offlineSigner = provider.getOfflineSigner(ATOM_CHAIN);
|
|
36
|
+
const address = yield cosmosGetAddress(provider);
|
|
37
|
+
if (!address)
|
|
38
|
+
throw new Error("failed to get address");
|
|
39
|
+
const signerData = {
|
|
40
|
+
sequence: Number(msg.sequence),
|
|
41
|
+
accountNumber: Number(msg.account_number),
|
|
42
|
+
chainId: msg.chain_id,
|
|
43
|
+
};
|
|
44
|
+
return yield (0, proto_tx_builder_1.sign)(address, msg.tx, offlineSigner, signerData, "cosmos");
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=cosmos.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cosmos.js","sourceRoot":"","sources":["../src/cosmos.ts"],"names":[],"mappings":";;;;;;;;;;;AAeA,sDAMC;AAED,4CAIC;AAED,oCAaC;AAxCD,gEAMsC;AACtC,sEAAuD;AAIvD,MAAM,UAAU,GAAG,aAAa,CAAC;AAEjC,SAAgB,qBAAqB,CAAC,GAA0B;IAC9D,OAAO;QACL;YACE,YAAY,EAAE,CAAC,UAAU,GAAG,EAAE,EAAE,UAAU,GAAG,IAAA,4BAAY,EAAC,MAAM,CAAC,EAAE,UAAU,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC;SACtG;KACF,CAAC;AACJ,CAAC;AAED,SAAsB,gBAAgB,CAAC,QAAiC;;;QACtE,MAAM,aAAa,GAAG,QAAQ,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;QAC5D,MAAM,QAAQ,GAAG,MAAM,aAAa,CAAC,WAAW,EAAE,CAAC;QACnD,OAAO,MAAA,QAAQ,CAAC,CAAC,CAAC,0CAAE,OAAO,CAAC;IAC9B,CAAC;CAAA;AAED,SAAsB,YAAY,CAAC,QAAiC,EAAE,GAAiB;;QACrF,MAAM,aAAa,GAAG,QAAQ,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;QAE5D,MAAM,OAAO,GAAG,MAAM,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QACjD,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAEvD,MAAM,UAAU,GAAe;YAC7B,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;YAC9B,aAAa,EAAE,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC;YACzC,OAAO,EAAE,GAAG,CAAC,QAAQ;SACtB,CAAC;QAEF,OAAO,MAAM,IAAA,uBAAI,EAAC,OAAO,EAAE,GAAG,CAAC,EAAW,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;IACnF,CAAC;CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as core from "@shapeshiftoss/hdwallet-core";
|
|
2
|
+
import { AddEthereumChainParameter } from "@shapeshiftoss/hdwallet-core";
|
|
3
|
+
import { VultisigEvmProvider } from "./types";
|
|
4
|
+
export declare function ethGetAccountPaths(msg: core.ETHGetAccountPath): Array<core.ETHAccountPath>;
|
|
5
|
+
export declare function ethSendTx(msg: core.ETHSignTx, vultisig: VultisigEvmProvider, from: string): Promise<core.ETHTxHash | null>;
|
|
6
|
+
export declare function ethSignMessage(msg: core.ETHSignMessage, vultisig: VultisigEvmProvider, address: string): Promise<core.ETHSignedMessage | null>;
|
|
7
|
+
export declare function ethSignTypedData(msg: core.ETHSignTypedData, vultisig: VultisigEvmProvider, address: string): Promise<core.ETHSignedMessage | null>;
|
|
8
|
+
export declare function ethGetAddress(vultisig: VultisigEvmProvider): Promise<core.Address | null>;
|
|
9
|
+
export declare function ethGetChainId(evmProvider: VultisigEvmProvider): Promise<number | null>;
|
|
10
|
+
export declare function ethAddChain(evmProvider: VultisigEvmProvider, params: AddEthereumChainParameter): Promise<void>;
|
|
11
|
+
export declare function ethSwitchChain(evmProvider: VultisigEvmProvider, params: AddEthereumChainParameter): Promise<void>;
|
|
12
|
+
//# sourceMappingURL=ethereum.d.ts.map
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,mBAAmB,EAChC,MAAM,EAAE,yBAAyB,GAChC,OAAO,CAAC,IAAI,CAAC,CAmCf"}
|
package/dist/ethereum.js
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
exports.ethGetAccountPaths = ethGetAccountPaths;
|
|
36
|
+
exports.ethSendTx = ethSendTx;
|
|
37
|
+
exports.ethSignMessage = ethSignMessage;
|
|
38
|
+
exports.ethSignTypedData = ethSignTypedData;
|
|
39
|
+
exports.ethGetAddress = ethGetAddress;
|
|
40
|
+
exports.ethGetChainId = ethGetChainId;
|
|
41
|
+
exports.ethAddChain = ethAddChain;
|
|
42
|
+
exports.ethSwitchChain = ethSwitchChain;
|
|
43
|
+
const core = __importStar(require("@shapeshiftoss/hdwallet-core"));
|
|
44
|
+
const eth_rpc_errors_1 = require("eth-rpc-errors");
|
|
45
|
+
const utils_1 = require("ethers/lib/utils");
|
|
46
|
+
function ethGetAccountPaths(msg) {
|
|
47
|
+
const slip44 = core.slip44ByCoin(msg.coin);
|
|
48
|
+
if (slip44 === undefined)
|
|
49
|
+
return [];
|
|
50
|
+
return [
|
|
51
|
+
{
|
|
52
|
+
addressNList: [0x80000000 + 44, 0x80000000 + slip44, 0x80000000 + msg.accountIdx, 0, 0],
|
|
53
|
+
hardenedPath: [0x80000000 + 44, 0x80000000 + slip44, 0x80000000 + msg.accountIdx],
|
|
54
|
+
relPath: [0, 0],
|
|
55
|
+
description: "Vultisig",
|
|
56
|
+
},
|
|
57
|
+
];
|
|
58
|
+
}
|
|
59
|
+
function ethSendTx(msg, vultisig, from) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
var _a;
|
|
62
|
+
try {
|
|
63
|
+
const utxBase = {
|
|
64
|
+
from: from,
|
|
65
|
+
to: msg.to,
|
|
66
|
+
value: msg.value,
|
|
67
|
+
nonce: msg.nonce,
|
|
68
|
+
chainId: msg.chainId,
|
|
69
|
+
data: msg.data,
|
|
70
|
+
gas: msg.gasLimit,
|
|
71
|
+
};
|
|
72
|
+
const utx = msg.maxFeePerGas
|
|
73
|
+
? Object.assign(Object.assign({}, utxBase), { maxFeePerGas: msg.maxFeePerGas, maxPriorityFeePerGas: msg.maxPriorityFeePerGas }) : Object.assign(Object.assign({}, utxBase), { gasPrice: msg.gasPrice });
|
|
74
|
+
const signedTx = yield ((_a = vultisig.request) === null || _a === void 0 ? void 0 : _a.call(vultisig, {
|
|
75
|
+
method: "eth_sendTransaction",
|
|
76
|
+
params: [utx],
|
|
77
|
+
}));
|
|
78
|
+
return { hash: signedTx };
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
console.error(error);
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function ethSignMessage(msg, vultisig, address) {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
var _a;
|
|
89
|
+
try {
|
|
90
|
+
if (!(0, utils_1.isHexString)(msg.message))
|
|
91
|
+
throw new Error("data is not an hex string");
|
|
92
|
+
const signedMsg = yield ((_a = vultisig.request) === null || _a === void 0 ? void 0 : _a.call(vultisig, {
|
|
93
|
+
method: "personal_sign",
|
|
94
|
+
params: [msg.message, address],
|
|
95
|
+
}));
|
|
96
|
+
return {
|
|
97
|
+
address: address,
|
|
98
|
+
signature: signedMsg,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
console.error(error);
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
function ethSignTypedData(msg, vultisig, address) {
|
|
108
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
109
|
+
var _a;
|
|
110
|
+
try {
|
|
111
|
+
const signedMsg = yield ((_a = vultisig.request) === null || _a === void 0 ? void 0 : _a.call(vultisig, {
|
|
112
|
+
method: "eth_signTypedData_v4",
|
|
113
|
+
params: [address, JSON.stringify(msg.typedData)],
|
|
114
|
+
}));
|
|
115
|
+
return {
|
|
116
|
+
address: address,
|
|
117
|
+
signature: signedMsg,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
console.error(error);
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
function ethGetAddress(vultisig) {
|
|
127
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
128
|
+
if (!(vultisig && vultisig.request)) {
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
try {
|
|
132
|
+
const ethAccounts = yield vultisig.request({
|
|
133
|
+
method: "eth_accounts",
|
|
134
|
+
});
|
|
135
|
+
return ethAccounts[0];
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
console.error(error);
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
function ethGetChainId(evmProvider) {
|
|
144
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
145
|
+
var _a;
|
|
146
|
+
try {
|
|
147
|
+
// chainId as hex string
|
|
148
|
+
const chainId = (yield ((_a = evmProvider === null || evmProvider === void 0 ? void 0 : evmProvider.request) === null || _a === void 0 ? void 0 : _a.call(evmProvider, { method: "eth_chainId" }))) || "";
|
|
149
|
+
return parseInt(chainId, 16);
|
|
150
|
+
}
|
|
151
|
+
catch (e) {
|
|
152
|
+
console.error(e);
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
function ethAddChain(evmProvider, params) {
|
|
158
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
159
|
+
var _a;
|
|
160
|
+
// at this point, we know that we're in the context of a valid Coinbase provider
|
|
161
|
+
yield ((_a = evmProvider === null || evmProvider === void 0 ? void 0 : evmProvider.request) === null || _a === void 0 ? void 0 : _a.call(evmProvider, { method: "wallet_addEthereumChain", params: [params] }));
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
function ethSwitchChain(evmProvider, params) {
|
|
165
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
166
|
+
var _a;
|
|
167
|
+
try {
|
|
168
|
+
// at this point, we know that we're in the context of a valid Coinbase provider
|
|
169
|
+
yield ((_a = evmProvider === null || evmProvider === void 0 ? void 0 : evmProvider.request) === null || _a === void 0 ? void 0 : _a.call(evmProvider, { method: "wallet_switchEthereumChain", params: [{ chainId: params.chainId }] }));
|
|
170
|
+
}
|
|
171
|
+
catch (e) {
|
|
172
|
+
const error = (0, eth_rpc_errors_1.serializeError)(e);
|
|
173
|
+
if (error.code === -32603) {
|
|
174
|
+
try {
|
|
175
|
+
yield ethAddChain(evmProvider, params);
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
catch (addChainE) {
|
|
179
|
+
const addChainError = (0, eth_rpc_errors_1.serializeError)(addChainE);
|
|
180
|
+
if (addChainError.code === 4001) {
|
|
181
|
+
throw eth_rpc_errors_1.ethErrors.provider.userRejectedRequest();
|
|
182
|
+
}
|
|
183
|
+
throw addChainError.data.originalError;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
if (error.code === 4001) {
|
|
187
|
+
throw eth_rpc_errors_1.ethErrors.provider.userRejectedRequest();
|
|
188
|
+
}
|
|
189
|
+
throw error.data.originalError;
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
//# sourceMappingURL=ethereum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ethereum.js","sourceRoot":"","sources":["../src/ethereum.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,gDAWC;AAED,8BAkCC;AAED,wCAoBC;AAED,4CAmBC;AAED,sCAaC;AACD,sCASC;AAED,kCAGC;AAED,wCAsCC;AAxKD,mEAAqD;AAGrD,mDAA2D;AAC3D,4CAA+C;AAI/C,SA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