@injectivelabs/wallet-ledger 1.14.41-alpha.0 → 1.14.41-alpha.3
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/README.md +2 -2
- package/dist/cjs/strategy/Ledger/Base.d.ts.map +1 -1
- package/dist/cjs/strategy/Ledger/Base.js +239 -183
- package/dist/cjs/strategy/Ledger/Base.js.map +1 -1
- package/dist/cjs/strategy/Ledger/LedgerLegacy.js +1 -4
- package/dist/cjs/strategy/Ledger/LedgerLegacy.js.map +1 -1
- package/dist/cjs/strategy/Ledger/LedgerLive.js +1 -4
- package/dist/cjs/strategy/Ledger/LedgerLive.js.map +1 -1
- package/dist/cjs/strategy/Ledger/hw/AccountManager.d.ts +1 -1
- package/dist/cjs/strategy/Ledger/hw/AccountManager.d.ts.map +1 -1
- package/dist/cjs/strategy/Ledger/hw/AccountManager.js +58 -44
- package/dist/cjs/strategy/Ledger/hw/AccountManager.js.map +1 -1
- package/dist/cjs/strategy/Ledger/hw/index.d.ts +2 -2
- package/dist/cjs/strategy/Ledger/hw/index.d.ts.map +1 -1
- package/dist/cjs/strategy/Ledger/hw/index.js +88 -46
- package/dist/cjs/strategy/Ledger/hw/index.js.map +1 -1
- package/dist/cjs/strategy/Ledger/utils.d.ts +4 -2
- package/dist/cjs/strategy/Ledger/utils.d.ts.map +1 -1
- package/dist/cjs/strategy/LedgerCosmos/hw/AccountManager.d.ts +1 -1
- package/dist/cjs/strategy/LedgerCosmos/hw/AccountManager.d.ts.map +1 -1
- package/dist/cjs/strategy/LedgerCosmos/hw/AccountManager.js +49 -35
- package/dist/cjs/strategy/LedgerCosmos/hw/AccountManager.js.map +1 -1
- package/dist/cjs/strategy/LedgerCosmos/hw/index.d.ts +2 -2
- package/dist/cjs/strategy/LedgerCosmos/hw/index.d.ts.map +1 -1
- package/dist/cjs/strategy/LedgerCosmos/hw/index.js +50 -31
- package/dist/cjs/strategy/LedgerCosmos/hw/index.js.map +1 -1
- package/dist/cjs/strategy/LedgerCosmos/index.js +149 -112
- package/dist/cjs/strategy/LedgerCosmos/index.js.map +1 -1
- package/dist/esm/strategy/Ledger/Base.d.ts.map +1 -1
- package/dist/esm/strategy/Ledger/Base.js +2 -2
- package/dist/esm/strategy/Ledger/Base.js.map +1 -1
- package/dist/esm/strategy/Ledger/hw/AccountManager.d.ts +1 -1
- package/dist/esm/strategy/Ledger/hw/AccountManager.d.ts.map +1 -1
- package/dist/esm/strategy/Ledger/hw/index.d.ts +2 -2
- package/dist/esm/strategy/Ledger/hw/index.d.ts.map +1 -1
- package/dist/esm/strategy/Ledger/hw/index.js +4 -4
- package/dist/esm/strategy/Ledger/hw/index.js.map +1 -1
- package/dist/esm/strategy/Ledger/utils.d.ts +4 -2
- package/dist/esm/strategy/Ledger/utils.d.ts.map +1 -1
- package/dist/esm/strategy/LedgerCosmos/hw/AccountManager.d.ts +1 -1
- package/dist/esm/strategy/LedgerCosmos/hw/AccountManager.d.ts.map +1 -1
- package/dist/esm/strategy/LedgerCosmos/hw/index.d.ts +2 -2
- package/dist/esm/strategy/LedgerCosmos/hw/index.d.ts.map +1 -1
- package/dist/esm/strategy/LedgerCosmos/hw/index.js +3 -3
- package/dist/esm/strategy/LedgerCosmos/hw/index.js.map +1 -1
- package/package.json +20 -15
package/README.md
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- TODO -->
|
|
4
4
|
|
|
5
|
-
[](https://www.npmjs.com/package/@injectivelabs/wallet-ts)
|
|
6
|
+
[](https://www.npmjs.com/package/@injectivelabs/wallet-ts)
|
|
7
7
|
[]()
|
|
8
8
|
|
|
9
9
|
_Package to use Ledger Wallets on Injective via the wallet strategy._
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Base.d.ts","sourceRoot":"","sources":["../../../../src/strategy/Ledger/Base.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAA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AE,MAAM,EAClB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,MAAM,CAAC;IAwBZ,0BAA0B,CAAC,YAAY,EAAE;QAC7C,OAAO,EAAE,MAAM,CAAA;QACf,OAAO,EAAE,UAAU,CAAA;KACpB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAYxB,qBAAqB,CAAC,YAAY,EAAE;QACxC,KAAK,EAAE,KAAK,CAAA;QACZ,aAAa,EAAE,MAAM,CAAA;QACrB,OAAO,EAAE,MAAM,CAAA;QACf,OAAO,EAAE,MAAM,CAAA;KAChB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAWzB,aAAa,CACjB,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,MAAM,GAAG,UAAU,GACxB,OAAO,CAAC,MAAM,CAAC;IAsBZ,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC;IAOrC,6BAA6B,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAK9D,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC;YAMpB,uBAAuB;YAkEvB,mBAAmB;YAsCnB,UAAU;CAuBzB"}
|
|
@@ -1,4 +1,36 @@
|
|
|
1
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
|
+
};
|
|
2
34
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
35
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
36
|
};
|
|
@@ -8,7 +40,6 @@ const ts_types_1 = require("@injectivelabs/ts-types");
|
|
|
8
40
|
const ethereumjs_util_1 = require("ethereumjs-util");
|
|
9
41
|
const common_1 = require("@ethereumjs/common");
|
|
10
42
|
const tx_1 = require("@ethereumjs/tx");
|
|
11
|
-
const hw_app_eth_1 = require("@ledgerhq/hw-app-eth");
|
|
12
43
|
const exceptions_1 = require("@injectivelabs/exceptions");
|
|
13
44
|
const sdk_ts_1 = require("@injectivelabs/sdk-ts");
|
|
14
45
|
const wallet_base_1 = require("@injectivelabs/wallet-base");
|
|
@@ -28,11 +59,6 @@ const getNetworkFromChainId = (chainId) => {
|
|
|
28
59
|
return common_1.Chain.Mainnet;
|
|
29
60
|
};
|
|
30
61
|
class LedgerBase extends wallet_base_1.BaseConcreteStrategy {
|
|
31
|
-
baseDerivationPath;
|
|
32
|
-
derivationPathType;
|
|
33
|
-
ledger;
|
|
34
|
-
ethereumOptions;
|
|
35
|
-
alchemy;
|
|
36
62
|
constructor(args) {
|
|
37
63
|
super(args);
|
|
38
64
|
this.baseDerivationPath = wallet_base_1.DEFAULT_BASE_DERIVATION_PATH;
|
|
@@ -40,206 +66,236 @@ class LedgerBase extends wallet_base_1.BaseConcreteStrategy {
|
|
|
40
66
|
this.ledger = new index_js_1.default();
|
|
41
67
|
this.ethereumOptions = args.ethereumOptions;
|
|
42
68
|
}
|
|
43
|
-
|
|
44
|
-
return
|
|
69
|
+
getWalletDeviceType() {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
return Promise.resolve(wallet_base_1.WalletDeviceType.Hardware);
|
|
72
|
+
});
|
|
45
73
|
}
|
|
46
|
-
|
|
47
|
-
return
|
|
74
|
+
enable() {
|
|
75
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
return Promise.resolve(true);
|
|
77
|
+
});
|
|
48
78
|
}
|
|
49
|
-
|
|
50
|
-
this
|
|
79
|
+
disconnect() {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
this.ledger = yield this.ledger.refresh();
|
|
82
|
+
});
|
|
51
83
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
84
|
+
getAddresses() {
|
|
85
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
86
|
+
const { baseDerivationPath, derivationPathType } = this;
|
|
87
|
+
try {
|
|
88
|
+
const accountManager = yield this.ledger.getAccountManager();
|
|
89
|
+
const wallets = yield accountManager.getWallets(baseDerivationPath, derivationPathType);
|
|
90
|
+
return wallets.map((k) => k.address);
|
|
91
|
+
}
|
|
92
|
+
catch (e) {
|
|
93
|
+
throw new exceptions_1.LedgerException(new Error(e.message), {
|
|
94
|
+
code: exceptions_1.UnspecifiedErrorCode,
|
|
95
|
+
type: exceptions_1.ErrorType.WalletError,
|
|
96
|
+
contextModule: wallet_base_1.WalletAction.GetAccounts,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
getSessionOrConfirm(address) {
|
|
102
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
103
|
+
return Promise.resolve(`0x${Buffer.from(`Confirmation for ${address} at time: ${Date.now()}`).toString('hex')}`);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
sendEthereumTransaction(txData, options) {
|
|
107
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
108
|
+
const signedTransaction = yield this.signEthereumTransaction(txData, options);
|
|
109
|
+
try {
|
|
110
|
+
const alchemy = yield this.getAlchemy();
|
|
111
|
+
const txReceipt = yield alchemy.core.sendTransaction((0, ethereumjs_util_1.addHexPrefix)(signedTransaction.serialize().toString('hex')));
|
|
112
|
+
return txReceipt.hash;
|
|
113
|
+
}
|
|
114
|
+
catch (e) {
|
|
115
|
+
throw new exceptions_1.LedgerException(new Error(e.message), {
|
|
116
|
+
code: exceptions_1.UnspecifiedErrorCode,
|
|
117
|
+
type: exceptions_1.ErrorType.WalletError,
|
|
118
|
+
contextModule: wallet_base_1.WalletAction.SendEthereumTransaction,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
sendTransaction(transaction, options) {
|
|
124
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
125
|
+
const { endpoints, txTimeout } = options;
|
|
126
|
+
if (!endpoints) {
|
|
127
|
+
throw new exceptions_1.WalletException(new Error('You have to pass endpoints.grpc within the options for using Ethereum native wallets'));
|
|
128
|
+
}
|
|
129
|
+
const txApi = new sdk_ts_1.TxGrpcApi(endpoints.grpc);
|
|
130
|
+
const response = yield txApi.broadcast(transaction, { txTimeout });
|
|
131
|
+
if (response.code !== 0) {
|
|
132
|
+
throw new exceptions_1.TransactionException(new Error(response.rawLog), {
|
|
133
|
+
code: exceptions_1.UnspecifiedErrorCode,
|
|
134
|
+
contextCode: response.code,
|
|
135
|
+
contextModule: response.codespace,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
return response;
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
signEip712TypedData(eip712json, address) {
|
|
142
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
143
|
+
const { derivationPath } = yield this.getWalletForAddress(address);
|
|
144
|
+
const object = JSON.parse(eip712json);
|
|
145
|
+
try {
|
|
146
|
+
const ledger = yield this.ledger.getInstance();
|
|
147
|
+
const result = yield ledger.signEIP712HashedMessage(derivationPath, (0, ethereumjs_util_1.bufferToHex)((0, utils_js_1.domainHash)(object)), (0, ethereumjs_util_1.bufferToHex)((0, utils_js_1.messageHash)(object)));
|
|
148
|
+
const combined = `${result.r}${result.s}${result.v.toString(16)}`;
|
|
149
|
+
return combined.startsWith('0x') ? combined : `0x${combined}`;
|
|
150
|
+
}
|
|
151
|
+
catch (e) {
|
|
152
|
+
throw new exceptions_1.LedgerException(new Error(e.message), {
|
|
153
|
+
code: exceptions_1.UnspecifiedErrorCode,
|
|
154
|
+
type: exceptions_1.ErrorType.WalletError,
|
|
155
|
+
contextModule: wallet_base_1.WalletAction.SignTransaction,
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
signAminoCosmosTransaction(_transaction) {
|
|
161
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
162
|
+
throw new exceptions_1.WalletException(new Error('This wallet does not support signing Cosmos transactions'), {
|
|
112
163
|
code: exceptions_1.UnspecifiedErrorCode,
|
|
113
164
|
type: exceptions_1.ErrorType.WalletError,
|
|
114
|
-
contextModule: wallet_base_1.WalletAction.
|
|
165
|
+
contextModule: wallet_base_1.WalletAction.SendTransaction,
|
|
115
166
|
});
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
async signAminoCosmosTransaction(_transaction) {
|
|
119
|
-
throw new exceptions_1.WalletException(new Error('This wallet does not support signing Cosmos transactions'), {
|
|
120
|
-
code: exceptions_1.UnspecifiedErrorCode,
|
|
121
|
-
type: exceptions_1.ErrorType.WalletError,
|
|
122
|
-
contextModule: wallet_base_1.WalletAction.SendTransaction,
|
|
123
167
|
});
|
|
124
168
|
}
|
|
125
169
|
// eslint-disable-next-line class-methods-use-this
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
type: exceptions_1.ErrorType.WalletError,
|
|
130
|
-
contextModule: wallet_base_1.WalletAction.SendTransaction,
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
async signArbitrary(signer, data) {
|
|
134
|
-
try {
|
|
135
|
-
const { derivationPath } = await this.getWalletForAddress(signer);
|
|
136
|
-
const ledger = await this.ledger.getInstance();
|
|
137
|
-
const result = await ledger.signPersonalMessage(derivationPath, Buffer.from((0, sdk_ts_1.toUtf8)(data), 'utf8').toString('hex'));
|
|
138
|
-
const combined = `${result.r}${result.s}${result.v.toString(16)}`;
|
|
139
|
-
return combined.startsWith('0x') ? combined : `0x${combined}`;
|
|
140
|
-
}
|
|
141
|
-
catch (e) {
|
|
142
|
-
throw new exceptions_1.LedgerException(new Error(e.message), {
|
|
170
|
+
signCosmosTransaction(_transaction) {
|
|
171
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
172
|
+
throw new exceptions_1.WalletException(new Error('This wallet does not support signing Cosmos transactions'), {
|
|
143
173
|
code: exceptions_1.UnspecifiedErrorCode,
|
|
144
174
|
type: exceptions_1.ErrorType.WalletError,
|
|
145
|
-
contextModule: wallet_base_1.WalletAction.
|
|
175
|
+
contextModule: wallet_base_1.WalletAction.SendTransaction,
|
|
146
176
|
});
|
|
147
|
-
}
|
|
177
|
+
});
|
|
148
178
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
179
|
+
signArbitrary(signer, data) {
|
|
180
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
181
|
+
try {
|
|
182
|
+
const { derivationPath } = yield this.getWalletForAddress(signer);
|
|
183
|
+
const ledger = yield this.ledger.getInstance();
|
|
184
|
+
const result = yield ledger.signPersonalMessage(derivationPath, Buffer.from((0, sdk_ts_1.toUtf8)(data), 'utf8').toString('hex'));
|
|
185
|
+
const combined = `${result.r}${result.s}${result.v.toString(16)}`;
|
|
186
|
+
return combined.startsWith('0x') ? combined : `0x${combined}`;
|
|
187
|
+
}
|
|
188
|
+
catch (e) {
|
|
189
|
+
throw new exceptions_1.LedgerException(new Error(e.message), {
|
|
190
|
+
code: exceptions_1.UnspecifiedErrorCode,
|
|
191
|
+
type: exceptions_1.ErrorType.WalletError,
|
|
192
|
+
contextModule: wallet_base_1.WalletAction.SignTransaction,
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
});
|
|
153
196
|
}
|
|
154
|
-
|
|
155
|
-
return
|
|
197
|
+
getEthereumChainId() {
|
|
198
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
199
|
+
const alchemy = yield this.getAlchemy();
|
|
200
|
+
const alchemyProvider = yield alchemy.config.getProvider();
|
|
201
|
+
return alchemyProvider.network.chainId.toString();
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
getEthereumTransactionReceipt(txHash) {
|
|
205
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
206
|
+
return Promise.resolve(txHash);
|
|
207
|
+
});
|
|
156
208
|
}
|
|
157
209
|
// eslint-disable-next-line class-methods-use-this
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
data: txData.data,
|
|
172
|
-
to: txData.to,
|
|
173
|
-
nonce: (0, ethereumjs_util_1.addHexPrefix)(nonce.toString(16)),
|
|
174
|
-
gas: (0, ethereumjs_util_1.addHexPrefix)(txData.gas),
|
|
175
|
-
gasLimit: (0, ethereumjs_util_1.addHexPrefix)(txData.gas),
|
|
176
|
-
maxFeePerGas: (0, ethereumjs_util_1.addHexPrefix)(txData.gasPrice || txData.maxFeePerGas),
|
|
177
|
-
maxPriorityFeePerGas: (0, ethereumjs_util_1.addHexPrefix)(txData.maxPriorityFeePerGas || wallet_base_1.TIP_IN_GWEI.toString(16)),
|
|
178
|
-
};
|
|
179
|
-
const tx = tx_1.FeeMarketEIP1559Transaction.fromTxData(eip1559TxData, { common });
|
|
180
|
-
const msg = tx.getMessageToSign(false);
|
|
181
|
-
// const encodedMessage = msg
|
|
182
|
-
const encodedMessageHex = msg.toString('hex');
|
|
183
|
-
try {
|
|
184
|
-
const ledger = await this.ledger.getInstance();
|
|
185
|
-
const { derivationPath } = await this.getWalletForAddress(options.address);
|
|
186
|
-
const resolution = await hw_app_eth_1.ledgerService.resolveTransaction(encodedMessageHex, {}, {});
|
|
187
|
-
const txSig = await ledger.signTransaction(derivationPath, encodedMessageHex, resolution);
|
|
188
|
-
const signedTxData = {
|
|
189
|
-
...eip1559TxData,
|
|
190
|
-
v: `0x${txSig.v}`,
|
|
191
|
-
r: `0x${txSig.r}`,
|
|
192
|
-
s: `0x${txSig.s}`,
|
|
193
|
-
};
|
|
194
|
-
return tx_1.FeeMarketEIP1559Transaction.fromTxData(signedTxData, {
|
|
195
|
-
common,
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
catch (e) {
|
|
199
|
-
throw new exceptions_1.LedgerException(new Error(e.message), {
|
|
200
|
-
code: exceptions_1.UnspecifiedErrorCode,
|
|
201
|
-
type: exceptions_1.ErrorType.WalletError,
|
|
202
|
-
contextModule: wallet_base_1.WalletAction.SignEthereumTransaction,
|
|
210
|
+
getPubKey() {
|
|
211
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
212
|
+
throw new exceptions_1.WalletException(new Error('You can only fetch PubKey from Cosmos native wallets'));
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
signEthereumTransaction(txData, options) {
|
|
216
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
217
|
+
const alchemy = yield this.getAlchemy();
|
|
218
|
+
const chainId = parseInt(options.ethereumChainId.toString(), 10);
|
|
219
|
+
const nonce = yield alchemy.core.getTransactionCount(options.address);
|
|
220
|
+
const common = new common_1.Common({
|
|
221
|
+
chain: getNetworkFromChainId(chainId),
|
|
222
|
+
hardfork: common_1.Hardfork.London,
|
|
203
223
|
});
|
|
204
|
-
|
|
224
|
+
const eip1559TxData = {
|
|
225
|
+
from: txData.from,
|
|
226
|
+
data: txData.data,
|
|
227
|
+
to: txData.to,
|
|
228
|
+
nonce: (0, ethereumjs_util_1.addHexPrefix)(nonce.toString(16)),
|
|
229
|
+
gas: (0, ethereumjs_util_1.addHexPrefix)(txData.gas),
|
|
230
|
+
gasLimit: (0, ethereumjs_util_1.addHexPrefix)(txData.gas),
|
|
231
|
+
maxFeePerGas: (0, ethereumjs_util_1.addHexPrefix)(txData.gasPrice || txData.maxFeePerGas),
|
|
232
|
+
maxPriorityFeePerGas: (0, ethereumjs_util_1.addHexPrefix)(txData.maxPriorityFeePerGas || wallet_base_1.TIP_IN_GWEI.toString(16)),
|
|
233
|
+
};
|
|
234
|
+
const tx = tx_1.FeeMarketEIP1559Transaction.fromTxData(eip1559TxData, { common });
|
|
235
|
+
const msg = tx.getMessageToSign(false);
|
|
236
|
+
// const encodedMessage = msg
|
|
237
|
+
const encodedMessageHex = msg.toString('hex');
|
|
238
|
+
try {
|
|
239
|
+
const ledger = yield this.ledger.getInstance();
|
|
240
|
+
const { derivationPath } = yield this.getWalletForAddress(options.address);
|
|
241
|
+
const ledgerService = yield Promise.resolve().then(() => __importStar(require('@ledgerhq/hw-app-eth/lib/services/ledger/index.js')));
|
|
242
|
+
const resolution = yield ledgerService.default.resolveTransaction(encodedMessageHex, {}, {});
|
|
243
|
+
const txSig = yield ledger.signTransaction(derivationPath, encodedMessageHex, resolution);
|
|
244
|
+
const signedTxData = Object.assign(Object.assign({}, eip1559TxData), { v: `0x${txSig.v}`, r: `0x${txSig.r}`, s: `0x${txSig.s}` });
|
|
245
|
+
return tx_1.FeeMarketEIP1559Transaction.fromTxData(signedTxData, {
|
|
246
|
+
common,
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
catch (e) {
|
|
250
|
+
throw new exceptions_1.LedgerException(new Error(e.message), {
|
|
251
|
+
code: exceptions_1.UnspecifiedErrorCode,
|
|
252
|
+
type: exceptions_1.ErrorType.WalletError,
|
|
253
|
+
contextModule: wallet_base_1.WalletAction.SignEthereumTransaction,
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
});
|
|
205
257
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
258
|
+
getWalletForAddress(address) {
|
|
259
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
260
|
+
try {
|
|
261
|
+
const { baseDerivationPath, derivationPathType } = this;
|
|
262
|
+
const accountManager = yield this.ledger.getAccountManager();
|
|
263
|
+
if (!accountManager.hasWalletForAddress(address)) {
|
|
264
|
+
for (let i = 0; i < wallet_base_1.DEFAULT_ADDRESS_SEARCH_LIMIT / wallet_base_1.DEFAULT_NUM_ADDRESSES_TO_FETCH; i += 1) {
|
|
265
|
+
yield accountManager.getWallets(baseDerivationPath, derivationPathType);
|
|
266
|
+
if (accountManager.hasWalletForAddress(address)) {
|
|
267
|
+
return (yield accountManager.getWalletForAddress(address));
|
|
268
|
+
}
|
|
215
269
|
}
|
|
216
270
|
}
|
|
271
|
+
return (yield accountManager.getWalletForAddress(address));
|
|
217
272
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
}
|
|
273
|
+
catch (e) {
|
|
274
|
+
throw new exceptions_1.LedgerException(new Error(e.message), {
|
|
275
|
+
code: exceptions_1.UnspecifiedErrorCode,
|
|
276
|
+
type: exceptions_1.ErrorType.WalletError,
|
|
277
|
+
contextModule: wallet_base_1.WalletAction.GetAccounts,
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
});
|
|
227
281
|
}
|
|
228
|
-
|
|
229
|
-
|
|
282
|
+
getAlchemy() {
|
|
283
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
284
|
+
if (this.alchemy) {
|
|
285
|
+
return this.alchemy;
|
|
286
|
+
}
|
|
287
|
+
const { rpcUrl, ethereumChainId } = this.ethereumOptions;
|
|
288
|
+
if (!rpcUrl) {
|
|
289
|
+
throw new exceptions_1.GeneralException(new Error('Please pass rpcUrl within the ethereumOptions'));
|
|
290
|
+
}
|
|
291
|
+
this.alchemy = new alchemy_sdk_1.Alchemy({
|
|
292
|
+
apiKey: (0, wallet_base_1.getKeyFromRpcUrl)(rpcUrl),
|
|
293
|
+
network: ethereumChainId === ts_types_1.EthereumChainId.Mainnet
|
|
294
|
+
? alchemy_sdk_1.Network.ETH_MAINNET
|
|
295
|
+
: alchemy_sdk_1.Network.ETH_SEPOLIA,
|
|
296
|
+
});
|
|
230
297
|
return this.alchemy;
|
|
231
|
-
}
|
|
232
|
-
const { rpcUrl, ethereumChainId } = this.ethereumOptions;
|
|
233
|
-
if (!rpcUrl) {
|
|
234
|
-
throw new exceptions_1.GeneralException(new Error('Please pass rpcUrl within the ethereumOptions'));
|
|
235
|
-
}
|
|
236
|
-
this.alchemy = new alchemy_sdk_1.Alchemy({
|
|
237
|
-
apiKey: (0, wallet_base_1.getKeyFromRpcUrl)(rpcUrl),
|
|
238
|
-
network: ethereumChainId === ts_types_1.EthereumChainId.Mainnet
|
|
239
|
-
? alchemy_sdk_1.Network.ETH_MAINNET
|
|
240
|
-
: alchemy_sdk_1.Network.ETH_SEPOLIA,
|
|
241
|
-
});
|
|
242
|
-
return this.alchemy;
|
|
298
|
+
});
|
|
243
299
|
}
|
|
244
300
|
}
|
|
245
301
|
exports.default = LedgerBase;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Base.js","sourceRoot":"","sources":["../../../../src/strategy/Ledger/Base.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Base.js","sourceRoot":"","sources":["../../../../src/strategy/Ledger/Base.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA2C;AAC3C,sDAAyE;AACzE,qDAA2D;AAC3D,+CAA4D;AAC5D,uCAA4D;AAC5D,0DAOkC;AAClC,kDAO8B;AAC9B,4DAcmC;AACnC,6DAAoC;AACpC,yCAAoD;AACpD,6CAAgE;AAGhE,MAAM,qBAAqB,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;oBACzC,CAAC,CAAC,qBAAc,CAAC,WAAW;oBAC5B,CAAC,CAAC,qBAAc,CAAC,WAAW;aACjC,CAAC,CAAA;YAEF,OAAO,IAAI,CAAC,OAAO,CAAA;QACrB,CAAC;KAAA;CACF;AA9VD,6BA8VC"}
|
|
@@ -8,10 +8,7 @@ const types_js_1 = require("../../types.js");
|
|
|
8
8
|
const Base_js_1 = __importDefault(require("./Base.js"));
|
|
9
9
|
class LedgerLegacy extends Base_js_1.default {
|
|
10
10
|
constructor(args) {
|
|
11
|
-
super({
|
|
12
|
-
...args,
|
|
13
|
-
derivationPathType: types_js_1.LedgerDerivationPathType.LedgerMew,
|
|
14
|
-
});
|
|
11
|
+
super(Object.assign(Object.assign({}, args), { derivationPathType: types_js_1.LedgerDerivationPathType.LedgerMew }));
|
|
15
12
|
}
|
|
16
13
|
}
|
|
17
14
|
exports.LedgerLegacy = LedgerLegacy;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LedgerLegacy.js","sourceRoot":"","sources":["../../../../src/strategy/Ledger/LedgerLegacy.ts"],"names":[],"mappings":";;;;;;AAEA,6CAAyD;AACzD,wDAAkC;AAElC,MAAa,YAAa,SAAQ,iBAAU;IAC1C,YAAY,IAAwC;QAClD,KAAK,
|
|
1
|
+
{"version":3,"file":"LedgerLegacy.js","sourceRoot":"","sources":["../../../../src/strategy/Ledger/LedgerLegacy.ts"],"names":[],"mappings":";;;;;;AAEA,6CAAyD;AACzD,wDAAkC;AAElC,MAAa,YAAa,SAAQ,iBAAU;IAC1C,YAAY,IAAwC;QAClD,KAAK,iCACA,IAAI,KACP,kBAAkB,EAAE,mCAAwB,CAAC,SAAS,IACtD,CAAA;IACJ,CAAC;CACF;AAPD,oCAOC"}
|
|
@@ -8,10 +8,7 @@ const types_js_1 = require("../../types.js");
|
|
|
8
8
|
const Base_js_1 = __importDefault(require("./Base.js"));
|
|
9
9
|
class LedgerLive extends Base_js_1.default {
|
|
10
10
|
constructor(args) {
|
|
11
|
-
super({
|
|
12
|
-
...args,
|
|
13
|
-
derivationPathType: types_js_1.LedgerDerivationPathType.LedgerLive,
|
|
14
|
-
});
|
|
11
|
+
super(Object.assign(Object.assign({}, args), { derivationPathType: types_js_1.LedgerDerivationPathType.LedgerLive }));
|
|
15
12
|
}
|
|
16
13
|
}
|
|
17
14
|
exports.LedgerLive = LedgerLive;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LedgerLive.js","sourceRoot":"","sources":["../../../../src/strategy/Ledger/LedgerLive.ts"],"names":[],"mappings":";;;;;;AAEA,6CAAyD;AACzD,wDAAkC;AAElC,MAAa,UAAW,SAAQ,iBAAU;IACxC,YAAY,IAAwC;QAClD,KAAK,
|
|
1
|
+
{"version":3,"file":"LedgerLive.js","sourceRoot":"","sources":["../../../../src/strategy/Ledger/LedgerLive.ts"],"names":[],"mappings":";;;;;;AAEA,6CAAyD;AACzD,wDAAkC;AAElC,MAAa,UAAW,SAAQ,iBAAU;IACxC,YAAY,IAAwC;QAClD,KAAK,iCACA,IAAI,KACP,kBAAkB,EAAE,mCAAwB,CAAC,UAAU,IACvD,CAAA;IACJ,CAAC;CACF;AAPD,gCAOC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AccountAddress } from '@injectivelabs/ts-types';
|
|
2
|
-
import
|
|
2
|
+
import type EthereumApp from '@ledgerhq/hw-app-eth';
|
|
3
3
|
import { LedgerDerivationPathType, LedgerWalletInfo } from '../../../types.js';
|
|
4
4
|
export default class AccountManager {
|
|
5
5
|
private wallets;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountManager.d.ts","sourceRoot":"","sources":["../../../../../src/strategy/Ledger/hw/AccountManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAGxD,OAAO,
|
|
1
|
+
{"version":3,"file":"AccountManager.d.ts","sourceRoot":"","sources":["../../../../../src/strategy/Ledger/hw/AccountManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAGxD,OAAO,KAAK,WAAW,MAAM,sBAAsB,CAAA;AACnD,OAAO,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAe9E,MAAM,CAAC,OAAO,OAAO,cAAc;IACjC,OAAO,CAAC,OAAO,CAAyB;IAExC,OAAO,CAAC,MAAM,CAAa;gBAEf,MAAM,EAAE,WAAW;IAKzB,UAAU,CACd,kBAAkB,EAAE,MAAM,EAC1B,kBAAkB,EAAE,wBAAwB,GAC3C,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAmB9B,kCAAkC;gCAKR,MAAM;4BACV,wBAAwB;eACrC,MAAM;UACX,MAAM,CAMT;YAEa,sBAAsB;IAiCpC,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,SAAS;IAWjB,mBAAmB,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO;IAQ/C,mBAAmB,CACvB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;IAMxC,KAAK;CAGN"}
|