@injectivelabs/wallet-ledger 1.14.40 → 1.14.41-alpha.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/README.md +2 -2
- package/dist/cjs/strategy/Ledger/Base.d.ts.map +1 -1
- package/dist/cjs/strategy/Ledger/Base.js +183 -239
- package/dist/cjs/strategy/Ledger/Base.js.map +1 -1
- package/dist/cjs/strategy/Ledger/LedgerLegacy.js +4 -1
- package/dist/cjs/strategy/Ledger/LedgerLegacy.js.map +1 -1
- package/dist/cjs/strategy/Ledger/LedgerLive.js +4 -1
- 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 +44 -58
- 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 +46 -88
- package/dist/cjs/strategy/Ledger/hw/index.js.map +1 -1
- package/dist/cjs/strategy/Ledger/utils.d.ts +2 -4
- 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 +35 -49
- 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 +31 -50
- package/dist/cjs/strategy/LedgerCosmos/hw/index.js.map +1 -1
- package/dist/cjs/strategy/LedgerCosmos/index.js +112 -149
- 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 +2 -4
- 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 +15 -20
package/README.md
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- TODO -->
|
|
4
4
|
|
|
5
|
-
[](https://www.npmjs.com/package/@injectivelabs/wallet-ledger)
|
|
6
|
+
[](https://www.npmjs.com/package/@injectivelabs/wallet-ledger)
|
|
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,CAAA;
|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AM,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;YA+DvB,mBAAmB;YAsCnB,UAAU;CAuBzB"}
|
|
@@ -1,36 +1,4 @@
|
|
|
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
|
-
};
|
|
34
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
4
|
};
|
|
@@ -40,6 +8,7 @@ const ts_types_1 = require("@injectivelabs/ts-types");
|
|
|
40
8
|
const ethereumjs_util_1 = require("ethereumjs-util");
|
|
41
9
|
const common_1 = require("@ethereumjs/common");
|
|
42
10
|
const tx_1 = require("@ethereumjs/tx");
|
|
11
|
+
const hw_app_eth_1 = require("@ledgerhq/hw-app-eth");
|
|
43
12
|
const exceptions_1 = require("@injectivelabs/exceptions");
|
|
44
13
|
const sdk_ts_1 = require("@injectivelabs/sdk-ts");
|
|
45
14
|
const wallet_base_1 = require("@injectivelabs/wallet-base");
|
|
@@ -59,6 +28,11 @@ const getNetworkFromChainId = (chainId) => {
|
|
|
59
28
|
return common_1.Chain.Mainnet;
|
|
60
29
|
};
|
|
61
30
|
class LedgerBase extends wallet_base_1.BaseConcreteStrategy {
|
|
31
|
+
baseDerivationPath;
|
|
32
|
+
derivationPathType;
|
|
33
|
+
ledger;
|
|
34
|
+
ethereumOptions;
|
|
35
|
+
alchemy;
|
|
62
36
|
constructor(args) {
|
|
63
37
|
super(args);
|
|
64
38
|
this.baseDerivationPath = wallet_base_1.DEFAULT_BASE_DERIVATION_PATH;
|
|
@@ -66,236 +40,206 @@ class LedgerBase extends wallet_base_1.BaseConcreteStrategy {
|
|
|
66
40
|
this.ledger = new index_js_1.default();
|
|
67
41
|
this.ethereumOptions = args.ethereumOptions;
|
|
68
42
|
}
|
|
69
|
-
getWalletDeviceType() {
|
|
70
|
-
return
|
|
71
|
-
return Promise.resolve(wallet_base_1.WalletDeviceType.Hardware);
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
enable() {
|
|
75
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
-
return Promise.resolve(true);
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
disconnect() {
|
|
80
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
-
this.ledger = yield this.ledger.refresh();
|
|
82
|
-
});
|
|
43
|
+
async getWalletDeviceType() {
|
|
44
|
+
return Promise.resolve(wallet_base_1.WalletDeviceType.Hardware);
|
|
83
45
|
}
|
|
84
|
-
|
|
85
|
-
return
|
|
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
|
-
});
|
|
46
|
+
async enable() {
|
|
47
|
+
return Promise.resolve(true);
|
|
100
48
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return Promise.resolve(`0x${Buffer.from(`Confirmation for ${address} at time: ${Date.now()}`).toString('hex')}`);
|
|
104
|
-
});
|
|
49
|
+
async disconnect() {
|
|
50
|
+
this.ledger = await this.ledger.refresh();
|
|
105
51
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
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'), {
|
|
52
|
+
async getAddresses() {
|
|
53
|
+
const { baseDerivationPath, derivationPathType } = this;
|
|
54
|
+
try {
|
|
55
|
+
const accountManager = await this.ledger.getAccountManager();
|
|
56
|
+
const wallets = await accountManager.getWallets(baseDerivationPath, derivationPathType);
|
|
57
|
+
return wallets.map((k) => k.address);
|
|
58
|
+
}
|
|
59
|
+
catch (e) {
|
|
60
|
+
throw new exceptions_1.LedgerException(new Error(e.message), {
|
|
61
|
+
code: exceptions_1.UnspecifiedErrorCode,
|
|
62
|
+
type: exceptions_1.ErrorType.WalletError,
|
|
63
|
+
contextModule: wallet_base_1.WalletAction.GetAccounts,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
async getSessionOrConfirm(address) {
|
|
68
|
+
return Promise.resolve(`0x${Buffer.from(`Confirmation for ${address} at time: ${Date.now()}`).toString('hex')}`);
|
|
69
|
+
}
|
|
70
|
+
async sendEthereumTransaction(txData, options) {
|
|
71
|
+
const signedTransaction = await this.signEthereumTransaction(txData, options);
|
|
72
|
+
try {
|
|
73
|
+
const alchemy = await this.getAlchemy();
|
|
74
|
+
const txReceipt = await alchemy.core.sendTransaction((0, ethereumjs_util_1.addHexPrefix)(signedTransaction.serialize().toString('hex')));
|
|
75
|
+
return txReceipt.hash;
|
|
76
|
+
}
|
|
77
|
+
catch (e) {
|
|
78
|
+
throw new exceptions_1.LedgerException(new Error(e.message), {
|
|
163
79
|
code: exceptions_1.UnspecifiedErrorCode,
|
|
164
80
|
type: exceptions_1.ErrorType.WalletError,
|
|
165
|
-
contextModule: wallet_base_1.WalletAction.
|
|
81
|
+
contextModule: wallet_base_1.WalletAction.SendEthereumTransaction,
|
|
166
82
|
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
async sendTransaction(transaction, options) {
|
|
86
|
+
const { endpoints, txTimeout } = options;
|
|
87
|
+
if (!endpoints) {
|
|
88
|
+
throw new exceptions_1.WalletException(new Error('You have to pass endpoints.grpc within the options for using Ethereum native wallets'));
|
|
89
|
+
}
|
|
90
|
+
const txApi = new sdk_ts_1.TxGrpcApi(endpoints.grpc);
|
|
91
|
+
const response = await txApi.broadcast(transaction, { txTimeout });
|
|
92
|
+
if (response.code !== 0) {
|
|
93
|
+
throw new exceptions_1.TransactionException(new Error(response.rawLog), {
|
|
94
|
+
code: exceptions_1.UnspecifiedErrorCode,
|
|
95
|
+
contextCode: response.code,
|
|
96
|
+
contextModule: response.codespace,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
return response;
|
|
100
|
+
}
|
|
101
|
+
async signEip712TypedData(eip712json, address) {
|
|
102
|
+
const { derivationPath } = await this.getWalletForAddress(address);
|
|
103
|
+
const object = JSON.parse(eip712json);
|
|
104
|
+
try {
|
|
105
|
+
const ledger = await this.ledger.getInstance();
|
|
106
|
+
const result = await 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)));
|
|
107
|
+
const combined = `${result.r}${result.s}${result.v.toString(16)}`;
|
|
108
|
+
return combined.startsWith('0x') ? combined : `0x${combined}`;
|
|
109
|
+
}
|
|
110
|
+
catch (e) {
|
|
111
|
+
throw new exceptions_1.LedgerException(new Error(e.message), {
|
|
112
|
+
code: exceptions_1.UnspecifiedErrorCode,
|
|
113
|
+
type: exceptions_1.ErrorType.WalletError,
|
|
114
|
+
contextModule: wallet_base_1.WalletAction.SignTransaction,
|
|
115
|
+
});
|
|
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,
|
|
167
123
|
});
|
|
168
124
|
}
|
|
169
125
|
// eslint-disable-next-line class-methods-use-this
|
|
170
|
-
signCosmosTransaction(_transaction) {
|
|
171
|
-
|
|
172
|
-
|
|
126
|
+
async signCosmosTransaction(_transaction) {
|
|
127
|
+
throw new exceptions_1.WalletException(new Error('This wallet does not support signing Cosmos transactions'), {
|
|
128
|
+
code: exceptions_1.UnspecifiedErrorCode,
|
|
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), {
|
|
173
143
|
code: exceptions_1.UnspecifiedErrorCode,
|
|
174
144
|
type: exceptions_1.ErrorType.WalletError,
|
|
175
|
-
contextModule: wallet_base_1.WalletAction.
|
|
145
|
+
contextModule: wallet_base_1.WalletAction.SignTransaction,
|
|
176
146
|
});
|
|
177
|
-
}
|
|
147
|
+
}
|
|
178
148
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
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
|
-
});
|
|
149
|
+
async getEthereumChainId() {
|
|
150
|
+
const alchemy = await this.getAlchemy();
|
|
151
|
+
const alchemyProvider = await alchemy.config.getProvider();
|
|
152
|
+
return alchemyProvider.network.chainId.toString();
|
|
196
153
|
}
|
|
197
|
-
|
|
198
|
-
return
|
|
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
|
-
});
|
|
154
|
+
async getEthereumTransactionReceipt(txHash) {
|
|
155
|
+
return Promise.resolve(txHash);
|
|
208
156
|
}
|
|
209
157
|
// eslint-disable-next-line class-methods-use-this
|
|
210
|
-
getPubKey() {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
158
|
+
async getPubKey() {
|
|
159
|
+
throw new exceptions_1.WalletException(new Error('You can only fetch PubKey from Cosmos native wallets'));
|
|
160
|
+
}
|
|
161
|
+
async signEthereumTransaction(txData, options) {
|
|
162
|
+
const alchemy = await this.getAlchemy();
|
|
163
|
+
const chainId = parseInt(options.ethereumChainId.toString(), 10);
|
|
164
|
+
const nonce = await alchemy.core.getTransactionCount(options.address);
|
|
165
|
+
const common = new common_1.Common({
|
|
166
|
+
chain: getNetworkFromChainId(chainId),
|
|
167
|
+
hardfork: common_1.Hardfork.London,
|
|
168
|
+
});
|
|
169
|
+
const eip1559TxData = {
|
|
170
|
+
from: txData.from,
|
|
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}`,
|
|
233
193
|
};
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
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
|
-
});
|
|
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,
|
|
203
|
+
});
|
|
204
|
+
}
|
|
257
205
|
}
|
|
258
|
-
getWalletForAddress(address) {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
return (yield accountManager.getWalletForAddress(address));
|
|
268
|
-
}
|
|
206
|
+
async getWalletForAddress(address) {
|
|
207
|
+
try {
|
|
208
|
+
const { baseDerivationPath, derivationPathType } = this;
|
|
209
|
+
const accountManager = await this.ledger.getAccountManager();
|
|
210
|
+
if (!accountManager.hasWalletForAddress(address)) {
|
|
211
|
+
for (let i = 0; i < wallet_base_1.DEFAULT_ADDRESS_SEARCH_LIMIT / wallet_base_1.DEFAULT_NUM_ADDRESSES_TO_FETCH; i += 1) {
|
|
212
|
+
await accountManager.getWallets(baseDerivationPath, derivationPathType);
|
|
213
|
+
if (accountManager.hasWalletForAddress(address)) {
|
|
214
|
+
return (await accountManager.getWalletForAddress(address));
|
|
269
215
|
}
|
|
270
216
|
}
|
|
271
|
-
return (yield accountManager.getWalletForAddress(address));
|
|
272
217
|
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
});
|
|
281
|
-
}
|
|
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,
|
|
218
|
+
return (await accountManager.getWalletForAddress(address));
|
|
219
|
+
}
|
|
220
|
+
catch (e) {
|
|
221
|
+
throw new exceptions_1.LedgerException(new Error(e.message), {
|
|
222
|
+
code: exceptions_1.UnspecifiedErrorCode,
|
|
223
|
+
type: exceptions_1.ErrorType.WalletError,
|
|
224
|
+
contextModule: wallet_base_1.WalletAction.GetAccounts,
|
|
296
225
|
});
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
async getAlchemy() {
|
|
229
|
+
if (this.alchemy) {
|
|
297
230
|
return this.alchemy;
|
|
298
|
-
}
|
|
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;
|
|
299
243
|
}
|
|
300
244
|
}
|
|
301
245
|
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,qDAAoD;AACpD,0DAOkC;AAClC,kDAO8B;AAC9B,4DAcmC;AACnC,6DAAoC;AACpC,yCAAoD;AACpD,6CAAgE;AAGhE,MAAM,qBAAqB,GAAG,CAAC,OAAwB,EAAS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ACL,eAAe,KAAK,0BAAe,CAAC,OAAO;gBACzC,CAAC,CAAC,qBAAc,CAAC,WAAW;gBAC5B,CAAC,CAAC,qBAAc,CAAC,WAAW;SACjC,CAAC,CAAA;QAEF,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;CACF;AA3VD,6BA2VC"}
|
|
@@ -8,7 +8,10 @@ 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(
|
|
11
|
+
super({
|
|
12
|
+
...args,
|
|
13
|
+
derivationPathType: types_js_1.LedgerDerivationPathType.LedgerMew,
|
|
14
|
+
});
|
|
12
15
|
}
|
|
13
16
|
}
|
|
14
17
|
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,CAAC;YACJ,GAAG,IAAI;YACP,kBAAkB,EAAE,mCAAwB,CAAC,SAAS;SACvD,CAAC,CAAA;IACJ,CAAC;CACF;AAPD,oCAOC"}
|
|
@@ -8,7 +8,10 @@ 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(
|
|
11
|
+
super({
|
|
12
|
+
...args,
|
|
13
|
+
derivationPathType: types_js_1.LedgerDerivationPathType.LedgerLive,
|
|
14
|
+
});
|
|
12
15
|
}
|
|
13
16
|
}
|
|
14
17
|
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,CAAC;YACJ,GAAG,IAAI;YACP,kBAAkB,EAAE,mCAAwB,CAAC,UAAU;SACxD,CAAC,CAAA;IACJ,CAAC;CACF;AAPD,gCAOC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AccountAddress } from '@injectivelabs/ts-types';
|
|
2
|
-
import
|
|
2
|
+
import { Eth as 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,EAAE,GAAG,IAAI,WAAW,EAAE,MAAM,sBAAsB,CAAA;AACzD,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,2DAI/B;QACD,sBAAsB,EAAE,MAAM,CAAA;QAC9B,kBAAkB,EAAE,wBAAwB,CAAA;QAC5C,KAAK,EAAE,MAAM,CAAA;KACd,KAAG,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"}
|