@shapeshiftoss/hdwallet-metamask-multichain 1.55.10-mipd.0
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 +11 -0
- package/dist/adapter.d.ts.map +1 -0
- package/dist/adapter.js +95 -0
- package/dist/adapter.js.map +1 -0
- package/dist/bitcoin.d.ts +8 -0
- package/dist/bitcoin.d.ts.map +1 -0
- package/dist/bitcoin.js +43 -0
- package/dist/bitcoin.js.map +1 -0
- package/dist/bitcoincash.d.ts +8 -0
- package/dist/bitcoincash.d.ts.map +1 -0
- package/dist/bitcoincash.js +43 -0
- package/dist/bitcoincash.js.map +1 -0
- package/dist/common.d.ts +2 -0
- package/dist/common.d.ts.map +1 -0
- package/dist/common.js +6 -0
- package/dist/common.js.map +1 -0
- package/dist/cosmos.d.ts +7 -0
- package/dist/cosmos.d.ts.map +1 -0
- package/dist/cosmos.js +64 -0
- package/dist/cosmos.js.map +1 -0
- package/dist/dogecoin.d.ts +8 -0
- package/dist/dogecoin.d.ts.map +1 -0
- package/dist/dogecoin.js +43 -0
- package/dist/dogecoin.js.map +1 -0
- package/dist/ethereum.d.ts +9 -0
- package/dist/ethereum.d.ts.map +1 -0
- package/dist/ethereum.js +159 -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/litecoin.d.ts +8 -0
- package/dist/litecoin.d.ts.map +1 -0
- package/dist/litecoin.js +43 -0
- package/dist/litecoin.js.map +1 -0
- package/dist/shapeshift-multichain.d.ts +203 -0
- package/dist/shapeshift-multichain.d.ts.map +1 -0
- package/dist/shapeshift-multichain.js +883 -0
- package/dist/shapeshift-multichain.js.map +1 -0
- package/dist/thorchain.d.ts +7 -0
- package/dist/thorchain.d.ts.map +1 -0
- package/dist/thorchain.js +64 -0
- package/dist/thorchain.js.map +1 -0
- package/dist/utxo.d.ts +6 -0
- package/dist/utxo.d.ts.map +1 -0
- package/dist/utxo.js +205 -0
- package/dist/utxo.js.map +1 -0
- package/package.json +32 -0
- package/src/adapter.ts +62 -0
- package/src/bitcoin.ts +32 -0
- package/src/bitcoincash.ts +32 -0
- package/src/common.ts +2 -0
- package/src/cosmos.ts +30 -0
- package/src/dogecoin.ts +32 -0
- package/src/ethereum.ts +125 -0
- package/src/index.ts +2 -0
- package/src/litecoin.ts +31 -0
- package/src/shapeshift-multichain.test.ts +170 -0
- package/src/shapeshift-multichain.ts +871 -0
- package/src/thorchain.ts +30 -0
- package/src/utxo.ts +201 -0
- package/tsconfig.json +10 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/yarn-error.log +18555 -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,11 @@
|
|
|
1
|
+
import * as core from "@shapeshiftoss/hdwallet-core";
|
|
2
|
+
import { MetaMaskShapeShiftMultiChainHDWallet } from "./shapeshift-multichain";
|
|
3
|
+
export declare class MetaMaskAdapter {
|
|
4
|
+
keyring: core.Keyring;
|
|
5
|
+
providerRdns: string;
|
|
6
|
+
private constructor();
|
|
7
|
+
static useKeyring(keyring: core.Keyring, providerRdns: string): MetaMaskAdapter;
|
|
8
|
+
initialize(): Promise<number>;
|
|
9
|
+
pairDevice(): Promise<MetaMaskShapeShiftMultiChainHDWallet | undefined>;
|
|
10
|
+
}
|
|
11
|
+
//# 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;AAKrD,OAAO,EAAE,oCAAoC,EAAE,MAAM,yBAAyB,CAAC;AAI/E,qBAAa,eAAe;IAC1B,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IAErB,OAAO;WAKO,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM;IAIvD,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAI7B,UAAU,IAAI,OAAO,CAAC,oCAAoC,GAAG,SAAS,CAAC;CAmCrF"}
|
package/dist/adapter.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
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.MetaMaskAdapter = void 0;
|
|
36
|
+
const core = __importStar(require("@shapeshiftoss/hdwallet-core"));
|
|
37
|
+
const metamask_snaps_adapter_1 = require("@shapeshiftoss/metamask-snaps-adapter");
|
|
38
|
+
const mipd_1 = require("mipd");
|
|
39
|
+
const common_1 = require("./common");
|
|
40
|
+
const shapeshift_multichain_1 = require("./shapeshift-multichain");
|
|
41
|
+
const store = (0, mipd_1.createStore)();
|
|
42
|
+
class MetaMaskAdapter {
|
|
43
|
+
constructor(keyring, providerRdns) {
|
|
44
|
+
this.keyring = keyring;
|
|
45
|
+
this.providerRdns = providerRdns;
|
|
46
|
+
}
|
|
47
|
+
static useKeyring(keyring, providerRdns) {
|
|
48
|
+
return new MetaMaskAdapter(keyring, providerRdns);
|
|
49
|
+
}
|
|
50
|
+
initialize() {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
return Object.keys(this.keyring.wallets).length;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
pairDevice() {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
var _a;
|
|
58
|
+
const maybeEip6963Provider = store.findProvider({ rdns: this.providerRdns });
|
|
59
|
+
if (!maybeEip6963Provider)
|
|
60
|
+
throw new Error("EIP-6963 provider not found");
|
|
61
|
+
const eip1193Provider = maybeEip6963Provider.provider;
|
|
62
|
+
// Checks if the EIP-6963 provider is *akschual* MetaMask
|
|
63
|
+
// This assumes that the wallet supports EIP-6963, which all major wallets do
|
|
64
|
+
const isMetaMask = maybeEip6963Provider.info.rdns === "io.metamask";
|
|
65
|
+
if (isMetaMask && !(0, metamask_snaps_adapter_1.shapeShiftSnapInstalled)(common_1.SNAP_ID)) {
|
|
66
|
+
console.info("ShapeShift Multichain snap not found. Prompting user to install.");
|
|
67
|
+
const result = yield (0, metamask_snaps_adapter_1.enableShapeShiftSnap)(common_1.SNAP_ID);
|
|
68
|
+
if (result.success === false) {
|
|
69
|
+
throw new Error("Could not install ShapeShift Multichain snap");
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
try {
|
|
73
|
+
yield ((_a = eip1193Provider.request) === null || _a === void 0 ? void 0 : _a.call(eip1193Provider, { method: "eth_requestAccounts" }).catch(() => {
|
|
74
|
+
var _a;
|
|
75
|
+
return (_a = eip1193Provider.request) === null || _a === void 0 ? void 0 : _a.call(eip1193Provider, {
|
|
76
|
+
method: "wallet_requestPermissions",
|
|
77
|
+
params: [{ eth_accounts: {} }],
|
|
78
|
+
});
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
console.error("Could not get MetaMask accounts. ");
|
|
83
|
+
throw error;
|
|
84
|
+
}
|
|
85
|
+
const wallet = new shapeshift_multichain_1.MetaMaskShapeShiftMultiChainHDWallet(eip1193Provider);
|
|
86
|
+
yield wallet.initialize();
|
|
87
|
+
const deviceID = yield wallet.getDeviceID();
|
|
88
|
+
this.keyring.add(wallet, deviceID);
|
|
89
|
+
this.keyring.emit(["MetaMask(ShapeShift Multichain)", deviceID, core.Events.CONNECT], deviceID);
|
|
90
|
+
return wallet;
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.MetaMaskAdapter = MetaMaskAdapter;
|
|
95
|
+
//# sourceMappingURL=adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mEAAqD;AACrD,kFAAsG;AACtG,+BAAmC;AAEnC,qCAAmC;AACnC,mEAA+E;AAE/E,MAAM,KAAK,GAAG,IAAA,kBAAW,GAAE,CAAC;AAE5B,MAAa,eAAe;IAI1B,YAAoB,OAAqB,EAAE,YAAoB;QAC7D,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAEM,MAAM,CAAC,UAAU,CAAC,OAAqB,EAAE,YAAoB;QAClE,OAAO,IA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CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;gBACnD,MAAM,KAAK,CAAC;YACd,CAAC;YACD,MAAM,MAAM,GAAG,IAAI,4DAAoC,CAAC,eAAe,CAAC,CAAC;YACzE,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC;YAC1B,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,WAAW,EAAE,CAAC;YAC5C,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YACnC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,iCAAiC,EAAE,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAC;YAEhG,OAAO,MAAM,CAAC;QAChB,CAAC;KAAA;CACF;AApDD,0CAoDC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as core from "@shapeshiftoss/hdwallet-core";
|
|
2
|
+
import { BitcoinGetAddressResponse, BitcoinGetPublicKeysResponse } from "@shapeshiftoss/metamask-snaps-types";
|
|
3
|
+
export declare function bitcoinGetAccountPaths(msg: core.BTCGetAccountPaths): Array<core.BTCAccountPath>;
|
|
4
|
+
export declare function bitcoinNextAccountPath(msg: core.BTCAccountPath): core.BTCAccountPath | undefined;
|
|
5
|
+
export declare function bitcoinGetPublicKeys(msg: core.BTCGetAddress): Promise<BitcoinGetPublicKeysResponse>;
|
|
6
|
+
export declare function bitcoinGetAddress(msg: core.BTCGetAddress): Promise<BitcoinGetAddressResponse>;
|
|
7
|
+
export declare function bitcoinSignTx(msg: core.BTCSignTx): Promise<core.BTCSignedTx | null>;
|
|
8
|
+
//# sourceMappingURL=bitcoin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bitcoin.d.ts","sourceRoot":"","sources":["../src/bitcoin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,8BAA8B,CAAC;AAMrD,OAAO,EAAE,yBAAyB,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AAK9G,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAE/F;AAGD,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,GAAG,SAAS,CAGhG;AAED,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAEzG;AAED,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAEnG;AAED,wBAAsB,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,CAEzF"}
|
package/dist/bitcoin.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
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.bitcoinGetAccountPaths = bitcoinGetAccountPaths;
|
|
13
|
+
exports.bitcoinNextAccountPath = bitcoinNextAccountPath;
|
|
14
|
+
exports.bitcoinGetPublicKeys = bitcoinGetPublicKeys;
|
|
15
|
+
exports.bitcoinGetAddress = bitcoinGetAddress;
|
|
16
|
+
exports.bitcoinSignTx = bitcoinSignTx;
|
|
17
|
+
const metamask_snaps_adapter_1 = require("@shapeshiftoss/metamask-snaps-adapter");
|
|
18
|
+
const common_1 = require("./common");
|
|
19
|
+
const utxo_1 = require("./utxo");
|
|
20
|
+
function bitcoinGetAccountPaths(msg) {
|
|
21
|
+
return (0, utxo_1.utxoGetAccountPaths)(msg);
|
|
22
|
+
}
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
24
|
+
function bitcoinNextAccountPath(msg) {
|
|
25
|
+
// Only support one account for now (like portis).
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
function bitcoinGetPublicKeys(msg) {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
return yield (0, metamask_snaps_adapter_1.BTCGetPublicKeys)({ snapId: common_1.SNAP_ID, addressParams: msg });
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function bitcoinGetAddress(msg) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
return yield (0, metamask_snaps_adapter_1.BTCGetAddress)({ snapId: common_1.SNAP_ID, addressParams: msg });
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function bitcoinSignTx(msg) {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
return yield (0, metamask_snaps_adapter_1.BTCSignTransaction)({ snapId: common_1.SNAP_ID, transaction: msg });
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=bitcoin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bitcoin.js","sourceRoot":"","sources":["../src/bitcoin.ts"],"names":[],"mappings":";;;;;;;;;;;AAWA,wDAEC;AAGD,wDAGC;AAED,oDAEC;AAED,8CAEC;AAED,sCAEC;AA9BD,kFAI+C;AAG/C,qCAAmC;AACnC,iCAA6C;AAE7C,SAAgB,sBAAsB,CAAC,GAA4B;IACjE,OAAO,IAAA,0BAAmB,EAAC,GAAG,CAAC,CAAC;AAClC,CAAC;AAED,6DAA6D;AAC7D,SAAgB,sBAAsB,CAAC,GAAwB;IAC7D,kDAAkD;IAClD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAsB,oBAAoB,CAAC,GAAuB;;QAChE,OAAO,MAAM,IAAA,yCAAwB,EAAC,EAAE,MAAM,EAAE,gBAAO,EAAE,aAAa,EAAE,GAAG,EAAE,CAAC,CAAC;IACjF,CAAC;CAAA;AAED,SAAsB,iBAAiB,CAAC,GAAuB;;QAC7D,OAAO,MAAM,IAAA,sCAAqB,EAAC,EAAE,MAAM,EAAE,gBAAO,EAAE,aAAa,EAAE,GAAG,EAAE,CAAC,CAAC;IAC9E,CAAC;CAAA;AAED,SAAsB,aAAa,CAAC,GAAmB;;QACrD,OAAO,MAAM,IAAA,2CAA0B,EAAC,EAAE,MAAM,EAAE,gBAAO,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC;IACjF,CAAC;CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as core from "@shapeshiftoss/hdwallet-core";
|
|
2
|
+
import { BitcoinCashGetAddressResponse, BitcoinGetPublicKeysResponse } from "@shapeshiftoss/metamask-snaps-types";
|
|
3
|
+
export declare function bitcoinCashGetAccountPaths(msg: core.BTCGetAccountPaths): Array<core.BTCAccountPath>;
|
|
4
|
+
export declare function bitcoinCashNextAccountPath(msg: core.BTCAccountPath): core.BTCAccountPath | undefined;
|
|
5
|
+
export declare function bitcoinCashGetAddress(msg: core.BTCGetAddress): Promise<BitcoinCashGetAddressResponse>;
|
|
6
|
+
export declare function bitcoinCashGetPublicKeys(msg: core.BTCGetAddress): Promise<BitcoinGetPublicKeysResponse>;
|
|
7
|
+
export declare function bitcoinCashSignTx(msg: core.BTCSignTx): Promise<core.BTCSignedTx | null>;
|
|
8
|
+
//# sourceMappingURL=bitcoincash.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bitcoincash.d.ts","sourceRoot":"","sources":["../src/bitcoincash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,8BAA8B,CAAC;AAMrD,OAAO,EAAE,6BAA6B,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AAKlH,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAEnG;AAGD,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,GAAG,SAAS,CAGpG;AAED,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAE3G;AAED,wBAAsB,wBAAwB,CAAC,GAAG,EAAE,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAE7G;AAED,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,CAE7F"}
|
|
@@ -0,0 +1,43 @@
|
|
|
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.bitcoinCashGetAccountPaths = bitcoinCashGetAccountPaths;
|
|
13
|
+
exports.bitcoinCashNextAccountPath = bitcoinCashNextAccountPath;
|
|
14
|
+
exports.bitcoinCashGetAddress = bitcoinCashGetAddress;
|
|
15
|
+
exports.bitcoinCashGetPublicKeys = bitcoinCashGetPublicKeys;
|
|
16
|
+
exports.bitcoinCashSignTx = bitcoinCashSignTx;
|
|
17
|
+
const metamask_snaps_adapter_1 = require("@shapeshiftoss/metamask-snaps-adapter");
|
|
18
|
+
const common_1 = require("./common");
|
|
19
|
+
const utxo_1 = require("./utxo");
|
|
20
|
+
function bitcoinCashGetAccountPaths(msg) {
|
|
21
|
+
return (0, utxo_1.utxoGetAccountPaths)(msg);
|
|
22
|
+
}
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
24
|
+
function bitcoinCashNextAccountPath(msg) {
|
|
25
|
+
// Only support one account for now (like portis).
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
function bitcoinCashGetAddress(msg) {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
return yield (0, metamask_snaps_adapter_1.BCHGetAddress)({ snapId: common_1.SNAP_ID, addressParams: msg });
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function bitcoinCashGetPublicKeys(msg) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
return yield (0, metamask_snaps_adapter_1.BCHGetPublicKeys)({ snapId: common_1.SNAP_ID, addressParams: msg });
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function bitcoinCashSignTx(msg) {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
return yield (0, metamask_snaps_adapter_1.BCHSignTransaction)({ snapId: common_1.SNAP_ID, transaction: msg });
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=bitcoincash.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bitcoincash.js","sourceRoot":"","sources":["../src/bitcoincash.ts"],"names":[],"mappings":";;;;;;;;;;;AAWA,gEAEC;AAGD,gEAGC;AAED,sDAEC;AAED,4DAEC;AAED,8CAEC;AA9BD,kFAI+C;AAG/C,qCAAmC;AACnC,iCAA6C;AAE7C,SAAgB,0BAA0B,CAAC,GAA4B;IACrE,OAAO,IAAA,0BAAmB,EAAC,GAAG,CAAC,CAAC;AAClC,CAAC;AAED,6DAA6D;AAC7D,SAAgB,0BAA0B,CAAC,GAAwB;IACjE,kDAAkD;IAClD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAsB,qBAAqB,CAAC,GAAuB;;QACjE,OAAO,MAAM,IAAA,sCAAyB,EAAC,EAAE,MAAM,EAAE,gBAAO,EAAE,aAAa,EAAE,GAAG,EAAE,CAAC,CAAC;IAClF,CAAC;CAAA;AAED,SAAsB,wBAAwB,CAAC,GAAuB;;QACpE,OAAO,MAAM,IAAA,yCAA4B,EAAC,EAAE,MAAM,EAAE,gBAAO,EAAE,aAAa,EAAE,GAAG,EAAE,CAAC,CAAC;IACrF,CAAC;CAAA;AAED,SAAsB,iBAAiB,CAAC,GAAmB;;QACzD,OAAO,MAAM,IAAA,2CAA8B,EAAC,EAAE,MAAM,EAAE,gBAAO,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC;IACrF,CAAC;CAAA"}
|
package/dist/common.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,sCAAsC,CAAC"}
|
package/dist/common.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,mCAAmC,CAAC;AAC3D,wDAAwD"}
|
package/dist/cosmos.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as core from "@shapeshiftoss/hdwallet-core";
|
|
2
|
+
import { CosmosGetAddressResponse } from "@shapeshiftoss/metamask-snaps-types";
|
|
3
|
+
export declare function cosmosGetAccountPaths(msg: core.CosmosGetAccountPaths): Array<core.CosmosAccountPath>;
|
|
4
|
+
export declare function cosmosNextAccountPath(msg: core.CosmosAccountPath): core.CosmosAccountPath | undefined;
|
|
5
|
+
export declare function cosmosGetAddress(msg: core.CosmosGetAddress): Promise<CosmosGetAddressResponse>;
|
|
6
|
+
export declare function cosmosSignTx(msg: core.CosmosSignTx): Promise<core.CosmosSignedTx | null>;
|
|
7
|
+
//# sourceMappingURL=cosmos.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cosmos.d.ts","sourceRoot":"","sources":["../src/cosmos.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,8BAA8B,CAAC;AAKrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAI/E,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,IAAI,CAAC,qBAAqB,GAAG,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAMpG;AAGD,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,GAAG,SAAS,CAGrG;AAED,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAEpG;AAED,wBAAsB,YAAY,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,CAE9F"}
|
package/dist/cosmos.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
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.cosmosGetAccountPaths = cosmosGetAccountPaths;
|
|
36
|
+
exports.cosmosNextAccountPath = cosmosNextAccountPath;
|
|
37
|
+
exports.cosmosGetAddress = cosmosGetAddress;
|
|
38
|
+
exports.cosmosSignTx = cosmosSignTx;
|
|
39
|
+
const core = __importStar(require("@shapeshiftoss/hdwallet-core"));
|
|
40
|
+
const metamask_snaps_adapter_1 = require("@shapeshiftoss/metamask-snaps-adapter");
|
|
41
|
+
const common_1 = require("./common");
|
|
42
|
+
function cosmosGetAccountPaths(msg) {
|
|
43
|
+
return [
|
|
44
|
+
{
|
|
45
|
+
addressNList: [0x80000000 + 44, 0x80000000 + core.slip44ByCoin("Atom"), 0x80000000 + msg.accountIdx, 0, 0],
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
}
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
50
|
+
function cosmosNextAccountPath(msg) {
|
|
51
|
+
// Only support one account for now (like portis).
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
function cosmosGetAddress(msg) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
return yield (0, metamask_snaps_adapter_1.cosmosGetAddress)({ snapId: common_1.SNAP_ID, addressParams: { addressNList: msg.addressNList } });
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function cosmosSignTx(msg) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
return yield (0, metamask_snaps_adapter_1.cosmosSignTransaction)({ snapId: common_1.SNAP_ID, transaction: msg });
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=cosmos.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cosmos.js","sourceRoot":"","sources":["../src/cosmos.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,sDAMC;AAGD,sDAGC;AAED,4CAEC;AAED,oCAEC;AA7BD,mEAAqD;AACrD,kFAG+C;AAG/C,qCAAmC;AAEnC,SAAgB,qBAAqB,CAAC,GAA+B;IACnE,OAAO;QACL;YACE,YAAY,EAAE,CAAC,UAAU,GAAG,EAAE,EAAE,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC;SAC3G;KACF,CAAC;AACJ,CAAC;AAED,6DAA6D;AAC7D,SAAgB,qBAAqB,CAAC,GAA2B;IAC/D,kDAAkD;IAClD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAsB,gBAAgB,CAAC,GAA0B;;QAC/D,OAAO,MAAM,IAAA,yCAAoB,EAAC,EAAE,MAAM,EAAE,gBAAO,EAAE,aAAa,EAAE,EAAE,YAAY,EAAE,GAAG,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;IAC5G,CAAC;CAAA;AAED,SAAsB,YAAY,CAAC,GAAsB;;QACvD,OAAO,MAAM,IAAA,8CAAyB,EAAC,EAAE,MAAM,EAAE,gBAAO,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC;IAChF,CAAC;CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as core from "@shapeshiftoss/hdwallet-core";
|
|
2
|
+
import { BitcoinGetPublicKeysResponse, DogecoinGetAddressResponse } from "@shapeshiftoss/metamask-snaps-types";
|
|
3
|
+
export declare function dogecoinGetAccountPaths(msg: core.BTCGetAccountPaths): Array<core.BTCAccountPath>;
|
|
4
|
+
export declare function dogecoinNextAccountPath(msg: core.BTCAccountPath): core.BTCAccountPath | undefined;
|
|
5
|
+
export declare function dogecoinGetAddress(msg: core.BTCGetAddress): Promise<DogecoinGetAddressResponse>;
|
|
6
|
+
export declare function dogecoinGetPublicKeys(msg: core.BTCGetAddress): Promise<BitcoinGetPublicKeysResponse>;
|
|
7
|
+
export declare function dogecoinSignTx(msg: core.BTCSignTx): Promise<core.BTCSignedTx | null>;
|
|
8
|
+
//# sourceMappingURL=dogecoin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dogecoin.d.ts","sourceRoot":"","sources":["../src/dogecoin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,8BAA8B,CAAC;AAMrD,OAAO,EAAE,4BAA4B,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAK/G,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAEhG;AAGD,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,GAAG,SAAS,CAGjG;AAED,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAErG;AAED,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAE1G;AAED,wBAAsB,cAAc,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,CAE1F"}
|
package/dist/dogecoin.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
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.dogecoinGetAccountPaths = dogecoinGetAccountPaths;
|
|
13
|
+
exports.dogecoinNextAccountPath = dogecoinNextAccountPath;
|
|
14
|
+
exports.dogecoinGetAddress = dogecoinGetAddress;
|
|
15
|
+
exports.dogecoinGetPublicKeys = dogecoinGetPublicKeys;
|
|
16
|
+
exports.dogecoinSignTx = dogecoinSignTx;
|
|
17
|
+
const metamask_snaps_adapter_1 = require("@shapeshiftoss/metamask-snaps-adapter");
|
|
18
|
+
const common_1 = require("./common");
|
|
19
|
+
const utxo_1 = require("./utxo");
|
|
20
|
+
function dogecoinGetAccountPaths(msg) {
|
|
21
|
+
return (0, utxo_1.utxoGetAccountPaths)(msg);
|
|
22
|
+
}
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
24
|
+
function dogecoinNextAccountPath(msg) {
|
|
25
|
+
// Only support one account for now (like portis).
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
function dogecoinGetAddress(msg) {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
return yield (0, metamask_snaps_adapter_1.dogecoinGetAddress)({ snapId: common_1.SNAP_ID, addressParams: msg });
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function dogecoinGetPublicKeys(msg) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
return yield (0, metamask_snaps_adapter_1.dogecoinGetPublicKeys)({ snapId: common_1.SNAP_ID, addressParams: msg });
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function dogecoinSignTx(msg) {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
return yield (0, metamask_snaps_adapter_1.dogecoinSignTransaction)({ snapId: common_1.SNAP_ID, transaction: msg });
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=dogecoin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dogecoin.js","sourceRoot":"","sources":["../src/dogecoin.ts"],"names":[],"mappings":";;;;;;;;;;;AAWA,0DAEC;AAGD,0DAGC;AAED,gDAEC;AAED,sDAEC;AAED,wCAEC;AA9BD,kFAI+C;AAG/C,qCAAmC;AACnC,iCAA6C;AAE7C,SAAgB,uBAAuB,CAAC,GAA4B;IAClE,OAAO,IAAA,0BAAmB,EAAC,GAAG,CAAC,CAAC;AAClC,CAAC;AAED,6DAA6D;AAC7D,SAAgB,uBAAuB,CAAC,GAAwB;IAC9D,kDAAkD;IAClD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAsB,kBAAkB,CAAC,GAAuB;;QAC9D,OAAO,MAAM,IAAA,2CAAsB,EAAC,EAAE,MAAM,EAAE,gBAAO,EAAE,aAAa,EAAE,GAAG,EAAE,CAAC,CAAC;IAC/E,CAAC;CAAA;AAED,SAAsB,qBAAqB,CAAC,GAAuB;;QACjE,OAAO,MAAM,IAAA,8CAAyB,EAAC,EAAE,MAAM,EAAE,gBAAO,EAAE,aAAa,EAAE,GAAG,EAAE,CAAC,CAAC;IAClF,CAAC;CAAA;AAED,SAAsB,cAAc,CAAC,GAAmB;;QACtD,OAAO,MAAM,IAAA,gDAA2B,EAAC,EAAE,MAAM,EAAE,gBAAO,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC;IAClF,CAAC;CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as core from "@shapeshiftoss/hdwallet-core";
|
|
2
|
+
export declare function ethVerifyMessage(msg: core.ETHVerifyMessage, ethereum: any): Promise<boolean | null>;
|
|
3
|
+
export declare function ethGetAccountPaths(msg: core.ETHGetAccountPath): Array<core.ETHAccountPath>;
|
|
4
|
+
export declare function ethSignTx(msg: core.ETHSignTx, ethereum: any, from: string): Promise<core.ETHSignedTx | null>;
|
|
5
|
+
export declare function ethSendTx(msg: core.ETHSignTx, ethereum: any, from: string): Promise<core.ETHTxHash | null>;
|
|
6
|
+
export declare function ethSignMessage(msg: core.ETHSignMessage, ethereum: any, address: string): Promise<core.ETHSignedMessage | null>;
|
|
7
|
+
export declare function ethSignTypedData(msg: core.ETHSignTypedData, ethereum: any, address: string): Promise<core.ETHSignedMessage | null>;
|
|
8
|
+
export declare function ethGetAddress(ethereum: any): Promise<string | null>;
|
|
9
|
+
//# sourceMappingURL=ethereum.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ethereum.d.ts","sourceRoot":"","sources":["../src/ethereum.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,8BAA8B,CAAC;AAKrD,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,IAAI,CAAC,gBAAgB,EAAE,QAAQ,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAGzG;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAW1F;AAGD,wBAAsB,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,CAGlH;AAED,wBAAsB,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,CAoChH;AAED,wBAAsB,cAAc,CAClC,GAAG,EAAE,IAAI,CAAC,cAAc,EACxB,QAAQ,EAAE,GAAG,EACb,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAgBvC;AAED,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,IAAI,CAAC,gBAAgB,EAC1B,QAAQ,EAAE,GAAG,EACb,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAgBvC;AAED,wBAAsB,aAAa,CAAC,QAAQ,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAazE"}
|
package/dist/ethereum.js
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
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.ethVerifyMessage = ethVerifyMessage;
|
|
36
|
+
exports.ethGetAccountPaths = ethGetAccountPaths;
|
|
37
|
+
exports.ethSignTx = ethSignTx;
|
|
38
|
+
exports.ethSendTx = ethSendTx;
|
|
39
|
+
exports.ethSignMessage = ethSignMessage;
|
|
40
|
+
exports.ethSignTypedData = ethSignTypedData;
|
|
41
|
+
exports.ethGetAddress = ethGetAddress;
|
|
42
|
+
const core = __importStar(require("@shapeshiftoss/hdwallet-core"));
|
|
43
|
+
const utils_1 = require("ethers/lib/utils");
|
|
44
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
45
|
+
function ethVerifyMessage(msg, ethereum) {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
console.error("Method ethVerifyMessage unsupported for MetaMask wallet!");
|
|
48
|
+
return null;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function ethGetAccountPaths(msg) {
|
|
52
|
+
const slip44 = core.slip44ByCoin(msg.coin);
|
|
53
|
+
if (slip44 === undefined)
|
|
54
|
+
return [];
|
|
55
|
+
return [
|
|
56
|
+
{
|
|
57
|
+
addressNList: [0x80000000 + 44, 0x80000000 + slip44, 0x80000000 + msg.accountIdx, 0, 0],
|
|
58
|
+
hardenedPath: [0x80000000 + 44, 0x80000000 + slip44, 0x80000000 + msg.accountIdx],
|
|
59
|
+
relPath: [0, 0],
|
|
60
|
+
description: "MetaMask(Shapeshift Multichain)",
|
|
61
|
+
},
|
|
62
|
+
];
|
|
63
|
+
}
|
|
64
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
65
|
+
function ethSignTx(msg, ethereum, from) {
|
|
66
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
console.error("Method ethSignTx unsupported for MetaMask wallet!");
|
|
68
|
+
return null;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function ethSendTx(msg, ethereum, from) {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
try {
|
|
74
|
+
const utxBase = {
|
|
75
|
+
from: from,
|
|
76
|
+
to: msg.to,
|
|
77
|
+
value: msg.value,
|
|
78
|
+
data: msg.data,
|
|
79
|
+
chainId: msg.chainId,
|
|
80
|
+
nonce: msg.nonce,
|
|
81
|
+
// MetaMask, like other Web3 libraries, derives its transaction schema from Ethereum's official JSON-RPC API specification
|
|
82
|
+
// (https://github.com/ethereum/execution-apis/blob/d63d2a02bcd2a8cef54ae2fc5bbff8b4fac944eb/src/schemas/transaction.json).
|
|
83
|
+
// That schema defines the use of the label `gas` to set the transaction's gas limit and not `gasLimit` as used in other
|
|
84
|
+
// libraries and as stated in the official yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf).
|
|
85
|
+
gas: msg.gasLimit,
|
|
86
|
+
};
|
|
87
|
+
const utx = msg.maxFeePerGas
|
|
88
|
+
? Object.assign(Object.assign({}, utxBase), { maxFeePerGas: msg.maxFeePerGas, maxPriorityFeePerGas: msg.maxPriorityFeePerGas }) : Object.assign(Object.assign({}, utxBase), { gasPrice: msg.gasPrice });
|
|
89
|
+
const signedTx = yield ethereum.request({
|
|
90
|
+
method: "eth_sendTransaction",
|
|
91
|
+
params: [utx],
|
|
92
|
+
});
|
|
93
|
+
return {
|
|
94
|
+
hash: signedTx,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
console.error(error);
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
function ethSignMessage(msg, ethereum, address) {
|
|
104
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
105
|
+
try {
|
|
106
|
+
if (!(0, utils_1.isHexString)(msg.message))
|
|
107
|
+
throw new Error("data is not an hex string");
|
|
108
|
+
const signedMsg = yield ethereum.request({
|
|
109
|
+
method: "personal_sign",
|
|
110
|
+
params: [msg.message, address],
|
|
111
|
+
});
|
|
112
|
+
return {
|
|
113
|
+
address: address,
|
|
114
|
+
signature: signedMsg,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
console.error(error);
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
function ethSignTypedData(msg, ethereum, address) {
|
|
124
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
125
|
+
try {
|
|
126
|
+
const signedMsg = yield ethereum.request({
|
|
127
|
+
method: "eth_signTypedData_v4",
|
|
128
|
+
params: [address, JSON.stringify(msg.typedData)],
|
|
129
|
+
from: address,
|
|
130
|
+
});
|
|
131
|
+
return {
|
|
132
|
+
address: address,
|
|
133
|
+
signature: signedMsg,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
catch (error) {
|
|
137
|
+
console.error(error);
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
function ethGetAddress(ethereum) {
|
|
143
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
144
|
+
if (!(ethereum && ethereum.request)) {
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
try {
|
|
148
|
+
const ethAccounts = yield ethereum.request({
|
|
149
|
+
method: "eth_accounts",
|
|
150
|
+
});
|
|
151
|
+
return ethAccounts[0];
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
console.error(error);
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=ethereum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ethereum.js","sourceRoot":"","sources":["../src/ethereum.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,4CAGC;AAED,gDAWC;AAGD,8BAGC;AAED,8BAoCC;AAED,wCAoBC;AAED,4CAoBC;AAED,sCAaC;AA5HD,mEAAqD;AAErD,4CAA+C;AAE/C,6DAA6D;AAC7D,SAAsB,gBAAgB,CAAC,GAA0B,EAAE,QAAa;;QAC9E,OAAO,CAAC,KAAK,CAAC,0DAA0D,CAAC,CAAC;QAC1E,OAAO,IAAI,CAAC;IACd,CAAC;CAAA;AAED,SAAgB,kBAAkB,CAAC,GAA2B;IAC5D,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC3C,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IACpC,OAAO;QACL;YACE,YAAY,EAAE,CAAC,UAAU,GAAG,EAAE,EAAE,UAAU,GAAG,MAAM,EAAE,UAAU,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC;YACvF,YAAY,EAAE,CAAC,UAAU,GAAG,EAAE,EAAE,UAAU,GAAG,MAAM,EAAE,UAAU,GAAG,GAAG,CAAC,UAAU,CAAC;YACjF,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;YACf,WAAW,EAAE,iCAAiC;SAC/C;KACF,CAAC;AACJ,CAAC;AAED,6DAA6D;AAC7D,SAAsB,SAAS,CAAC,GAAmB,EAAE,QAAa,EAAE,IAAY;;QAC9E,OAAO,CAAC,KAAK,CAAC,mDAAmD,CAAC,CAAC;QACnE,OAAO,IAAI,CAAC;IACd,CAAC;CAAA;AAED,SAAsB,SAAS,CAAC,GAAmB,EA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