@shapeshiftoss/hdwallet-coinbase 1.55.4-alpha.1 → 1.55.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/dist/adapter.js +72 -30
- package/dist/adapter.js.map +1 -1
- package/dist/coinbase.js +295 -184
- package/dist/coinbase.js.map +1 -1
- package/dist/ethereum.js +136 -87
- package/dist/ethereum.js.map +1 -1
- package/dist/index.js +18 -2
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/tsconfig.tsbuildinfo +1 -1
package/dist/ethereum.js
CHANGED
|
@@ -1,9 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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.describeETHPath = describeETHPath;
|
|
36
|
+
exports.ethGetAccountPaths = ethGetAccountPaths;
|
|
37
|
+
exports.ethGetAddress = ethGetAddress;
|
|
38
|
+
exports.ethSignTx = ethSignTx;
|
|
39
|
+
exports.ethSendTx = ethSendTx;
|
|
40
|
+
exports.ethVerifyMessage = ethVerifyMessage;
|
|
41
|
+
exports.ethSignTypedData = ethSignTypedData;
|
|
42
|
+
exports.ethSignMessage = ethSignMessage;
|
|
43
|
+
const core = __importStar(require("@shapeshiftoss/hdwallet-core"));
|
|
44
|
+
const utils_1 = require("ethers/lib/utils");
|
|
45
|
+
function describeETHPath(path) {
|
|
4
46
|
return core.describeETHPath(path);
|
|
5
47
|
}
|
|
6
|
-
|
|
48
|
+
function ethGetAccountPaths(msg) {
|
|
7
49
|
const slip44 = core.slip44ByCoin(msg.coin);
|
|
8
50
|
if (slip44 === undefined)
|
|
9
51
|
return [];
|
|
@@ -16,95 +58,102 @@ export function ethGetAccountPaths(msg) {
|
|
|
16
58
|
},
|
|
17
59
|
];
|
|
18
60
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
61
|
+
function ethGetAddress(ethereum) {
|
|
62
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
if (!(ethereum && ethereum.request)) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
try {
|
|
67
|
+
const ethAccounts = yield ethereum.request({
|
|
68
|
+
method: "eth_accounts",
|
|
69
|
+
});
|
|
70
|
+
return ethAccounts[0];
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
console.error(error);
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
33
77
|
}
|
|
34
78
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
export async function ethSendTx(msg, ethereum, from) {
|
|
40
|
-
try {
|
|
41
|
-
const utxBase = {
|
|
42
|
-
from: from,
|
|
43
|
-
to: msg.to,
|
|
44
|
-
value: msg.value,
|
|
45
|
-
data: msg.data,
|
|
46
|
-
chainId: msg.chainId,
|
|
47
|
-
nonce: msg.nonce,
|
|
48
|
-
gas: msg.gasLimit,
|
|
49
|
-
};
|
|
50
|
-
const utx = msg.maxFeePerGas
|
|
51
|
-
? {
|
|
52
|
-
...utxBase,
|
|
53
|
-
maxFeePerGas: msg.maxFeePerGas,
|
|
54
|
-
maxPriorityFeePerGas: msg.maxPriorityFeePerGas,
|
|
55
|
-
}
|
|
56
|
-
: { ...utxBase, gasPrice: msg.gasPrice };
|
|
57
|
-
const signedTx = await ethereum.request({
|
|
58
|
-
method: "eth_sendTransaction",
|
|
59
|
-
params: [utx],
|
|
60
|
-
});
|
|
61
|
-
return {
|
|
62
|
-
hash: signedTx,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
catch (error) {
|
|
66
|
-
console.error(error);
|
|
79
|
+
function ethSignTx(msg, ethereum, from) {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
console.error("Method ethSignTx unsupported for Coinbase wallet");
|
|
67
82
|
return null;
|
|
68
|
-
}
|
|
83
|
+
});
|
|
69
84
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
85
|
+
function ethSendTx(msg, ethereum, from) {
|
|
86
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
try {
|
|
88
|
+
const utxBase = {
|
|
89
|
+
from: from,
|
|
90
|
+
to: msg.to,
|
|
91
|
+
value: msg.value,
|
|
92
|
+
data: msg.data,
|
|
93
|
+
chainId: msg.chainId,
|
|
94
|
+
nonce: msg.nonce,
|
|
95
|
+
gas: msg.gasLimit,
|
|
96
|
+
};
|
|
97
|
+
const utx = msg.maxFeePerGas
|
|
98
|
+
? Object.assign(Object.assign({}, utxBase), { maxFeePerGas: msg.maxFeePerGas, maxPriorityFeePerGas: msg.maxPriorityFeePerGas }) : Object.assign(Object.assign({}, utxBase), { gasPrice: msg.gasPrice });
|
|
99
|
+
const signedTx = yield ethereum.request({
|
|
100
|
+
method: "eth_sendTransaction",
|
|
101
|
+
params: [utx],
|
|
102
|
+
});
|
|
103
|
+
return {
|
|
104
|
+
hash: signedTx,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
console.error(error);
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
});
|
|
74
112
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
params: [address, JSON.stringify(msg.typedData)],
|
|
80
|
-
from: address,
|
|
81
|
-
});
|
|
82
|
-
return {
|
|
83
|
-
address: address,
|
|
84
|
-
signature: signedMsg,
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
catch (error) {
|
|
88
|
-
console.error(error);
|
|
113
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
114
|
+
function ethVerifyMessage(msg, ethereum) {
|
|
115
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
116
|
+
console.error("Method ethVerifyMessage unsupported for Coinbase wallet!");
|
|
89
117
|
return null;
|
|
90
|
-
}
|
|
118
|
+
});
|
|
91
119
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
120
|
+
function ethSignTypedData(msg, ethereum, address) {
|
|
121
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
122
|
+
try {
|
|
123
|
+
const signedMsg = yield ethereum.request({
|
|
124
|
+
method: "eth_signTypedData_v4",
|
|
125
|
+
params: [address, JSON.stringify(msg.typedData)],
|
|
126
|
+
from: address,
|
|
127
|
+
});
|
|
128
|
+
return {
|
|
129
|
+
address: address,
|
|
130
|
+
signature: signedMsg,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
console.error(error);
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
function ethSignMessage(msg, ethereum, address) {
|
|
140
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
141
|
+
try {
|
|
142
|
+
if (!(0, utils_1.isHexString)(msg.message))
|
|
143
|
+
throw new Error("data is not an hex string");
|
|
144
|
+
const signedMsg = yield ethereum.request({
|
|
145
|
+
method: "personal_sign",
|
|
146
|
+
params: [msg, address],
|
|
147
|
+
});
|
|
148
|
+
return {
|
|
149
|
+
address: address,
|
|
150
|
+
signature: signedMsg,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
console.error(error);
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
});
|
|
109
158
|
}
|
|
110
159
|
//# sourceMappingURL=ethereum.js.map
|
package/dist/ethereum.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ethereum.js","sourceRoot":"","sources":["../src/ethereum.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ethereum.js","sourceRoot":"","sources":["../src/ethereum.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,0CAEC;AAED,gDAWC;AAED,sCAaC;AAGD,8BAGC;AAED,8BAgCC;AAGD,4CAGC;AAED,4CAoBC;AAED,wCAoBC;AA5HD,mEAAqD;AAErD,4CAA+C;AAE/C,SAAgB,eAAe,CAAC,IAAoB;IAClD,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AACpC,CAAC;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,UAAU;SACxB;KACF,CAAC;AACJ,CAAC;AAED,SAAsB,aAAa,CAAC,QAAa;;QAC/C,IAAI,CAAC,CAAC,QAAQ,IAAI,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YACpC,OAAO,IAAI,CAAC;QACd,CAAC;QACD,IAAI,CAAC;YACH,MAAM,WAAW,GAAG,MAAM,QAAQ,CAAC,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AC;YACrB,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./adapter"), exports);
|
|
18
|
+
__exportStar(require("./coinbase"), exports);
|
|
3
19
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,6CAA2B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shapeshiftoss/hdwallet-coinbase",
|
|
3
|
-
"version": "1.55.
|
|
3
|
+
"version": "1.55.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@coinbase/wallet-sdk": "^3.6.6",
|
|
18
|
-
"@shapeshiftoss/hdwallet-core": "
|
|
18
|
+
"@shapeshiftoss/hdwallet-core": "1.55.5",
|
|
19
19
|
"eth-rpc-errors": "^4.0.3",
|
|
20
20
|
"lodash": "^4.17.21"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@types/lodash": "^4.14.168"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "451552ac2086a22aabeee80f844fbafafab69576"
|
|
26
26
|
}
|