@injectivelabs/wallet-ledger 1.19.11 → 1.19.12
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/cjs/index.cjs +16 -5
- package/dist/esm/index.js +16 -5
- package/package.json +5 -5
package/dist/cjs/index.cjs
CHANGED
|
@@ -170,16 +170,24 @@ var LedgerTransport$1 = class LedgerTransport$1 {
|
|
|
170
170
|
var LedgerEip1193Provider = class {
|
|
171
171
|
ledger;
|
|
172
172
|
derivationPath;
|
|
173
|
+
rpcUrl;
|
|
174
|
+
rpcUrls;
|
|
173
175
|
address;
|
|
174
176
|
chainId;
|
|
175
177
|
constructor(ledger, params) {
|
|
176
178
|
this.ledger = ledger;
|
|
177
179
|
this.derivationPath = params.derivationPath || "m/44'/60'/0'/0/0";
|
|
180
|
+
this.rpcUrl = params.rpcUrl;
|
|
181
|
+
this.rpcUrls = params.rpcUrls;
|
|
178
182
|
this.chainId = parseInt(params.chainId || "1");
|
|
179
183
|
}
|
|
184
|
+
getRpcUrl() {
|
|
185
|
+
return this.rpcUrls?.[this.chainId] || this.rpcUrl;
|
|
186
|
+
}
|
|
180
187
|
async getClient() {
|
|
181
188
|
return (0, __injectivelabs_wallet_base.getViemWalletClient)({
|
|
182
189
|
chainId: this.chainId,
|
|
190
|
+
rpcUrl: this.getRpcUrl(),
|
|
183
191
|
account: await this.getAddress()
|
|
184
192
|
});
|
|
185
193
|
}
|
|
@@ -239,7 +247,7 @@ var LedgerEip1193Provider = class {
|
|
|
239
247
|
if (args.method === "eth_chainId") return `0x${this.chainId.toString(16)}`;
|
|
240
248
|
if (args.method === "wallet_switchEthereumChain") return this.setChainId(args.params[0]?.chainId || "0x1");
|
|
241
249
|
if (args.method === "eth_estimateGas") {
|
|
242
|
-
const client = (0, __injectivelabs_wallet_base.getViemPublicClient)(this.chainId);
|
|
250
|
+
const client = (0, __injectivelabs_wallet_base.getViemPublicClient)(this.chainId, this.getRpcUrl());
|
|
243
251
|
const data = {
|
|
244
252
|
to: args.params[0].to,
|
|
245
253
|
value: args.params[0].value,
|
|
@@ -250,7 +258,7 @@ var LedgerEip1193Provider = class {
|
|
|
250
258
|
}
|
|
251
259
|
if (args.method === "eth_getTransactionCount") {
|
|
252
260
|
if (!args.params) throw new Error("params is required");
|
|
253
|
-
return `0x${(await (0, __injectivelabs_wallet_base.getViemPublicClient)(this.chainId).getTransactionCount({
|
|
261
|
+
return `0x${(await (0, __injectivelabs_wallet_base.getViemPublicClient)(this.chainId, this.getRpcUrl()).getTransactionCount({
|
|
254
262
|
address: await this.getAddress(),
|
|
255
263
|
blockTag: "pending"
|
|
256
264
|
})).toString(16)}`;
|
|
@@ -259,7 +267,8 @@ var LedgerEip1193Provider = class {
|
|
|
259
267
|
const address = await this.getAddress();
|
|
260
268
|
const walletClient = (0, __injectivelabs_wallet_base.getViemWalletClient)({
|
|
261
269
|
chainId: this.chainId,
|
|
262
|
-
account: address
|
|
270
|
+
account: address,
|
|
271
|
+
rpcUrl: this.getRpcUrl()
|
|
263
272
|
});
|
|
264
273
|
const preparedTransaction = await walletClient.prepareTransactionRequest({ ...args.params[0] });
|
|
265
274
|
const signedTransaction = await this.signTransaction(preparedTransaction);
|
|
@@ -596,8 +605,10 @@ var LedgerBase = class extends __injectivelabs_wallet_base.BaseConcreteStrategy
|
|
|
596
605
|
}
|
|
597
606
|
async getEip1193Provider() {
|
|
598
607
|
return new LedgerEip1193Provider(this.ledger, {
|
|
599
|
-
|
|
600
|
-
|
|
608
|
+
rpcUrl: this.evmOptions.rpcUrl,
|
|
609
|
+
rpcUrls: this.evmOptions.rpcUrls,
|
|
610
|
+
derivationPath: this.metadata?.derivationPath,
|
|
611
|
+
chainId: this.evmOptions.evmChainId.toString()
|
|
601
612
|
});
|
|
602
613
|
}
|
|
603
614
|
async getPublicClient(evmChainId) {
|
package/dist/esm/index.js
CHANGED
|
@@ -169,16 +169,24 @@ var LedgerTransport$1 = class LedgerTransport$1 {
|
|
|
169
169
|
var LedgerEip1193Provider = class {
|
|
170
170
|
ledger;
|
|
171
171
|
derivationPath;
|
|
172
|
+
rpcUrl;
|
|
173
|
+
rpcUrls;
|
|
172
174
|
address;
|
|
173
175
|
chainId;
|
|
174
176
|
constructor(ledger, params) {
|
|
175
177
|
this.ledger = ledger;
|
|
176
178
|
this.derivationPath = params.derivationPath || "m/44'/60'/0'/0/0";
|
|
179
|
+
this.rpcUrl = params.rpcUrl;
|
|
180
|
+
this.rpcUrls = params.rpcUrls;
|
|
177
181
|
this.chainId = parseInt(params.chainId || "1");
|
|
178
182
|
}
|
|
183
|
+
getRpcUrl() {
|
|
184
|
+
return this.rpcUrls?.[this.chainId] || this.rpcUrl;
|
|
185
|
+
}
|
|
179
186
|
async getClient() {
|
|
180
187
|
return getViemWalletClient({
|
|
181
188
|
chainId: this.chainId,
|
|
189
|
+
rpcUrl: this.getRpcUrl(),
|
|
182
190
|
account: await this.getAddress()
|
|
183
191
|
});
|
|
184
192
|
}
|
|
@@ -238,7 +246,7 @@ var LedgerEip1193Provider = class {
|
|
|
238
246
|
if (args.method === "eth_chainId") return `0x${this.chainId.toString(16)}`;
|
|
239
247
|
if (args.method === "wallet_switchEthereumChain") return this.setChainId(args.params[0]?.chainId || "0x1");
|
|
240
248
|
if (args.method === "eth_estimateGas") {
|
|
241
|
-
const client = getViemPublicClient(this.chainId);
|
|
249
|
+
const client = getViemPublicClient(this.chainId, this.getRpcUrl());
|
|
242
250
|
const data = {
|
|
243
251
|
to: args.params[0].to,
|
|
244
252
|
value: args.params[0].value,
|
|
@@ -249,7 +257,7 @@ var LedgerEip1193Provider = class {
|
|
|
249
257
|
}
|
|
250
258
|
if (args.method === "eth_getTransactionCount") {
|
|
251
259
|
if (!args.params) throw new Error("params is required");
|
|
252
|
-
return `0x${(await getViemPublicClient(this.chainId).getTransactionCount({
|
|
260
|
+
return `0x${(await getViemPublicClient(this.chainId, this.getRpcUrl()).getTransactionCount({
|
|
253
261
|
address: await this.getAddress(),
|
|
254
262
|
blockTag: "pending"
|
|
255
263
|
})).toString(16)}`;
|
|
@@ -258,7 +266,8 @@ var LedgerEip1193Provider = class {
|
|
|
258
266
|
const address = await this.getAddress();
|
|
259
267
|
const walletClient = getViemWalletClient({
|
|
260
268
|
chainId: this.chainId,
|
|
261
|
-
account: address
|
|
269
|
+
account: address,
|
|
270
|
+
rpcUrl: this.getRpcUrl()
|
|
262
271
|
});
|
|
263
272
|
const preparedTransaction = await walletClient.prepareTransactionRequest({ ...args.params[0] });
|
|
264
273
|
const signedTransaction = await this.signTransaction(preparedTransaction);
|
|
@@ -595,8 +604,10 @@ var LedgerBase = class extends BaseConcreteStrategy {
|
|
|
595
604
|
}
|
|
596
605
|
async getEip1193Provider() {
|
|
597
606
|
return new LedgerEip1193Provider(this.ledger, {
|
|
598
|
-
|
|
599
|
-
|
|
607
|
+
rpcUrl: this.evmOptions.rpcUrl,
|
|
608
|
+
rpcUrls: this.evmOptions.rpcUrls,
|
|
609
|
+
derivationPath: this.metadata?.derivationPath,
|
|
610
|
+
chainId: this.evmOptions.evmChainId.toString()
|
|
600
611
|
});
|
|
601
612
|
}
|
|
602
613
|
async getPublicClient(evmChainId) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@injectivelabs/wallet-ledger",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.12",
|
|
4
4
|
"description": "Ledger wallet strategy for use with @injectivelabs/wallet-core.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
"@ledgerhq/hw-transport-webusb": "^6.29.13",
|
|
50
50
|
"buffer": "^6.0.3",
|
|
51
51
|
"viem": "^2.41.2",
|
|
52
|
-
"@injectivelabs/
|
|
53
|
-
"@injectivelabs/
|
|
54
|
-
"@injectivelabs/ts-types": "1.19.
|
|
55
|
-
"@injectivelabs/wallet-base": "1.19.
|
|
52
|
+
"@injectivelabs/sdk-ts": "1.19.12",
|
|
53
|
+
"@injectivelabs/exceptions": "1.19.12",
|
|
54
|
+
"@injectivelabs/ts-types": "1.19.12",
|
|
55
|
+
"@injectivelabs/wallet-base": "1.19.12"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"@ethersproject/abi": "^5.7.0",
|