@injectivelabs/wallet-ledger 1.16.38-alpha.3 → 1.16.38-alpha.4

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.
@@ -138,42 +138,22 @@ var AccountManager$1 = class {
138
138
  //#region src/strategy/lib.ts
139
139
  let EthType;
140
140
  let CosmosType;
141
- let ledgerServiceType;
142
141
  let TransportWebUSB;
143
142
  let TransportWebHID;
144
143
  async function loadEthType() {
145
- if (!EthType) {
146
- const module$1 = await import("@bangjelkoski/ledgerhq-hw-app-eth");
147
- EthType = module$1.Eth ? module$1.Eth : module$1.default.Eth;
148
- }
144
+ if (!EthType) EthType = (await import("@ledgerhq/hw-app-eth")).default;
149
145
  return EthType;
150
146
  }
151
147
  async function loadCosmosType() {
152
- if (!CosmosType) {
153
- const module$1 = await import("@bangjelkoski/ledgerhq-hw-app-cosmos");
154
- CosmosType = module$1.Cosmos ? module$1.Cosmos : module$1.default.Cosmos;
155
- }
148
+ if (!CosmosType) CosmosType = (await import("@ledgerhq/hw-app-cosmos")).default;
156
149
  return CosmosType;
157
150
  }
158
- async function loadLedgerServiceType() {
159
- if (!ledgerServiceType) {
160
- const module$1 = await import("@bangjelkoski/ledgerhq-hw-app-eth");
161
- ledgerServiceType = module$1.ledgerService || module$1.default.ledgerService;
162
- }
163
- return ledgerServiceType;
164
- }
165
151
  async function loadTransportWebUSB() {
166
- if (!TransportWebUSB) {
167
- const module$1 = await import("@bangjelkoski/ledgerhq-hw-transport-webusb");
168
- TransportWebUSB = module$1.TransportWebUSB || module$1.default.TransportWebUSB;
169
- }
152
+ if (!TransportWebUSB) TransportWebUSB = (await import("@ledgerhq/hw-transport-webusb")).default;
170
153
  return TransportWebUSB;
171
154
  }
172
155
  async function loadTransportWebHIDType() {
173
- if (!TransportWebHID) {
174
- const module$1 = await import("@bangjelkoski/ledgerhq-hw-transport-webhid");
175
- TransportWebHID = module$1.TransportWebHID || module$1.default.TransportWebHID;
176
- }
156
+ if (!TransportWebHID) TransportWebHID = (await import("@ledgerhq/hw-transport-webhid")).default;
177
157
  return TransportWebHID;
178
158
  }
179
159
 
@@ -256,7 +236,7 @@ var LedgerEip1193Provider = class {
256
236
  _defineProperty(this, "address", void 0);
257
237
  _defineProperty(this, "chainId", void 0);
258
238
  this.ledger = ledger;
259
- this.derivationPath = "m/44'/60'/0'/0/0";
239
+ this.derivationPath = params.derivationPath || "m/44'/60'/0'/0/0";
260
240
  this.chainId = parseInt(params.chainId || "1");
261
241
  }
262
242
  async getClient() {
@@ -277,14 +257,18 @@ var LedgerEip1193Provider = class {
277
257
  }
278
258
  async signTypedData(data) {
279
259
  const result = await (await this.ledger.getInstance()).signEIP712Message(this.derivationPath, JSON.parse(data));
280
- const combined = `${result.r}${result.s}${result.v.toString(16)}`;
260
+ const v = result.v.toString(16).padStart(2, "0");
261
+ const combined = `${result.r}${result.s}${v}`;
281
262
  return combined.startsWith("0x") ? combined : `0x${combined}`;
282
263
  }
283
264
  async signTransaction(txData) {
284
265
  const ledgerInstance = await this.ledger.getInstance();
285
266
  const serializedTransaction = (0, viem.serializeTransaction)(txData);
286
- const resolution = await (await loadLedgerServiceType()).resolveTransaction(serializedTransaction.substring(2), {}, {});
287
- const signature = await ledgerInstance.signTransaction(this.derivationPath, serializedTransaction.substring(2), resolution);
267
+ const signature = await ledgerInstance.clearSignTransaction(this.derivationPath, serializedTransaction.substring(2), {
268
+ erc20: true,
269
+ externalPlugins: true,
270
+ nft: true
271
+ });
288
272
  return (0, viem.serializeTransaction)(txData, {
289
273
  r: signature.r,
290
274
  s: signature.s,
@@ -293,7 +277,8 @@ var LedgerEip1193Provider = class {
293
277
  }
294
278
  async signMessage(messageHex) {
295
279
  const result = await (await this.ledger.getInstance()).signPersonalMessage(this.derivationPath, messageHex);
296
- const combined = `${result.r}${result.s}${result.v.toString(16)}`;
280
+ const v = result.v.toString(16).padStart(2, "0");
281
+ const combined = `${result.r}${result.s}${v}`;
297
282
  return combined.startsWith("0x") ? combined : `0x${combined}`;
298
283
  }
299
284
  getChain() {
@@ -400,6 +385,22 @@ var LedgerBase = class extends __injectivelabs_wallet_base.BaseConcreteStrategy
400
385
  });
401
386
  }
402
387
  }
388
+ async getAddressesInfo() {
389
+ const { baseDerivationPath, derivationPathType } = this;
390
+ try {
391
+ return (await (await this.ledger.getAccountManager()).getWallets(baseDerivationPath, derivationPathType)).map((k) => ({
392
+ address: k.address,
393
+ derivationPath: k.derivationPath,
394
+ baseDerivationPath: k.baseDerivationPath
395
+ }));
396
+ } catch (e) {
397
+ throw new __injectivelabs_exceptions.LedgerException(new Error(e.message), {
398
+ code: __injectivelabs_exceptions.UnspecifiedErrorCode,
399
+ type: __injectivelabs_exceptions.ErrorType.WalletError,
400
+ contextModule: __injectivelabs_wallet_base.WalletAction.GetAccounts
401
+ });
402
+ }
403
+ }
403
404
  async getSessionOrConfirm(address) {
404
405
  return Promise.resolve(`0x${(0, __injectivelabs_sdk_ts_utils.uint8ArrayToHex)((0, __injectivelabs_sdk_ts_utils.stringToUint8Array)(`Confirmation for ${address} at time: ${Date.now()}`))}`);
405
406
  }
@@ -431,7 +432,8 @@ var LedgerBase = class extends __injectivelabs_wallet_base.BaseConcreteStrategy
431
432
  const object = JSON.parse(eip712json);
432
433
  try {
433
434
  const result = await (await this.ledger.getInstance()).signEIP712Message(derivationPath, object);
434
- const combined = `${result.r}${result.s}${result.v.toString(16)}`;
435
+ const v = result.v.toString(16).padStart(2, "0");
436
+ const combined = `${result.r}${result.s}${v}`;
435
437
  return combined.startsWith("0x") ? combined : `0x${combined}`;
436
438
  } catch (e) {
437
439
  const errorMessage = e.message;
@@ -442,7 +444,8 @@ var LedgerBase = class extends __injectivelabs_wallet_base.BaseConcreteStrategy
442
444
  });
443
445
  try {
444
446
  const result = await (await this.ledger.getInstance()).signEIP712HashedMessage(derivationPath, domainHash(object), messageHash(object));
445
- const combined = `${result.r}${result.s}${result.v.toString(16)}`;
447
+ const v = result.v.toString(16).padStart(2, "0");
448
+ const combined = `${result.r}${result.s}${v}`;
446
449
  return combined.startsWith("0x") ? combined : `0x${combined}`;
447
450
  } catch (e$1) {
448
451
  throw new __injectivelabs_exceptions.LedgerException(new Error(e$1.message), {
@@ -471,7 +474,8 @@ var LedgerBase = class extends __injectivelabs_wallet_base.BaseConcreteStrategy
471
474
  try {
472
475
  const { derivationPath } = await this.getWalletForAddress(signer);
473
476
  const result = await (await this.ledger.getInstance()).signPersonalMessage(derivationPath, (0, __injectivelabs_sdk_ts_utils.uint8ArrayToHex)((0, __injectivelabs_sdk_ts_utils.stringToUint8Array)((0, __injectivelabs_sdk_ts_utils.toUtf8)(data))));
474
- const combined = `${result.r}${result.s}${result.v.toString(16)}`;
477
+ const v = result.v.toString(16).padStart(2, "0");
478
+ const combined = `${result.r}${result.s}${v}`;
475
479
  return combined.startsWith("0x") ? combined : `0x${combined}`;
476
480
  } catch (e) {
477
481
  throw new __injectivelabs_exceptions.LedgerException(new Error(e.message), {
@@ -501,7 +505,6 @@ var LedgerBase = class extends __injectivelabs_wallet_base.BaseConcreteStrategy
501
505
  throw new __injectivelabs_exceptions.WalletException(/* @__PURE__ */ new Error("You can only fetch PubKey from Cosmos native wallets"));
502
506
  }
503
507
  async signEvmTransaction(txData, args) {
504
- const ledgerService = await loadLedgerServiceType();
505
508
  const publicClient = await this.getPublicClient(args.evmChainId);
506
509
  const chainId = parseInt(args.evmChainId.toString(), 10);
507
510
  const address = args.address.startsWith("0x") ? args.address : `0x${args.address}`;
@@ -528,8 +531,11 @@ var LedgerBase = class extends __injectivelabs_wallet_base.BaseConcreteStrategy
528
531
  try {
529
532
  const ledger = await this.ledger.getInstance();
530
533
  const { derivationPath } = await this.getWalletForAddress(args.address);
531
- const resolution = await ledgerService.resolveTransaction(serializedTxHex, {}, {});
532
- const txSig = await ledger.signTransaction(derivationPath, serializedTxHex, resolution);
534
+ const txSig = await ledger.clearSignTransaction(derivationPath, serializedTxHex, {
535
+ erc20: true,
536
+ externalPlugins: true,
537
+ nft: true
538
+ });
533
539
  return (0, viem.serializeTransaction)({
534
540
  ...eip1559TxData,
535
541
  v: BigInt(`0x${txSig.v}`),
@@ -545,6 +551,12 @@ var LedgerBase = class extends __injectivelabs_wallet_base.BaseConcreteStrategy
545
551
  }
546
552
  }
547
553
  async getWalletForAddress(address) {
554
+ var _this$metadata;
555
+ if ((_this$metadata = this.metadata) === null || _this$metadata === void 0 ? void 0 : _this$metadata.derivationPath) return {
556
+ address,
557
+ baseDerivationPath: this.metadata.baseDerivationPath || this.baseDerivationPath,
558
+ derivationPath: this.metadata.derivationPath
559
+ };
548
560
  try {
549
561
  const { baseDerivationPath, derivationPathType } = this;
550
562
  const accountManager = await this.ledger.getAccountManager();
@@ -562,9 +574,10 @@ var LedgerBase = class extends __injectivelabs_wallet_base.BaseConcreteStrategy
562
574
  }
563
575
  }
564
576
  async getEip1193Provider() {
577
+ var _this$metadata2;
565
578
  return new LedgerEip1193Provider(this.ledger, {
566
579
  chainId: this.evmOptions.evmChainId.toString(),
567
- derivationPath: this.baseDerivationPath
580
+ derivationPath: (_this$metadata2 = this.metadata) === null || _this$metadata2 === void 0 ? void 0 : _this$metadata2.derivationPath
568
581
  });
569
582
  }
570
583
  async getPublicClient(evmChainId) {
@@ -719,6 +732,13 @@ var LedgerCosmos = class extends __injectivelabs_wallet_base.BaseConcreteStrateg
719
732
  });
720
733
  }
721
734
  }
735
+ async getAddressesInfo() {
736
+ throw new __injectivelabs_exceptions.LedgerCosmosException(/* @__PURE__ */ new Error("getAddressesInfo is not implemented"), {
737
+ code: __injectivelabs_exceptions.UnspecifiedErrorCode,
738
+ type: __injectivelabs_exceptions.ErrorType.WalletError,
739
+ contextModule: __injectivelabs_wallet_base.WalletAction.GetAccounts
740
+ });
741
+ }
722
742
  async getSessionOrConfirm(address) {
723
743
  return Promise.resolve(`0x${(0, __injectivelabs_sdk_ts_utils.uint8ArrayToHex)((0, __injectivelabs_sdk_ts_utils.stringToUint8Array)(`Confirmation for ${address} at time: ${Date.now()}`))}`);
724
744
  }
@@ -782,13 +802,13 @@ var LedgerCosmos = class extends __injectivelabs_wallet_base.BaseConcreteStrateg
782
802
  }
783
803
  }
784
804
  async getEthereumChainId() {
785
- throw new __injectivelabs_exceptions.CosmosWalletException(/* @__PURE__ */ new Error("getEthereumChainId is not supported on Keplr"), {
805
+ throw new __injectivelabs_exceptions.CosmosWalletException(/* @__PURE__ */ new Error("getEthereumChainId is not supported on LedgerCosmos"), {
786
806
  code: __injectivelabs_exceptions.UnspecifiedErrorCode,
787
807
  context: __injectivelabs_wallet_base.WalletAction.GetChainId
788
808
  });
789
809
  }
790
810
  async getEvmTransactionReceipt(_txHash) {
791
- throw new __injectivelabs_exceptions.CosmosWalletException(/* @__PURE__ */ new Error("getEvmTransactionReceipt is not supported on Keplr"), {
811
+ throw new __injectivelabs_exceptions.CosmosWalletException(/* @__PURE__ */ new Error("getEvmTransactionReceipt is not supported on LedgerCosmos"), {
792
812
  code: __injectivelabs_exceptions.UnspecifiedErrorCode,
793
813
  context: __injectivelabs_wallet_base.WalletAction.GetEvmTransactionReceipt
794
814
  });
@@ -41,6 +41,11 @@ declare class LedgerBase extends BaseConcreteStrategy implements ConcreteWalletS
41
41
  enable(): Promise<boolean>;
42
42
  disconnect(): Promise<void>;
43
43
  getAddresses(): Promise<string[]>;
44
+ getAddressesInfo(): Promise<{
45
+ address: string;
46
+ derivationPath: string;
47
+ baseDerivationPath: string;
48
+ }[]>;
44
49
  getSessionOrConfirm(address: AccountAddress): Promise<string>;
45
50
  sendEvmTransaction(txData: any, args: {
46
51
  address: string;
@@ -84,6 +89,11 @@ declare class LedgerCosmos extends BaseConcreteStrategy implements ConcreteWalle
84
89
  enable(): Promise<boolean>;
85
90
  disconnect(): Promise<void>;
86
91
  getAddresses(): Promise<string[]>;
92
+ getAddressesInfo(): Promise<{
93
+ address: string;
94
+ derivationPath: string;
95
+ baseDerivationPath: string;
96
+ }[]>;
87
97
  getSessionOrConfirm(address: AccountAddress): Promise<string>;
88
98
  sendEvmTransaction(_txData: any, _options: {
89
99
  address: string;
@@ -41,6 +41,11 @@ declare class LedgerBase extends BaseConcreteStrategy implements ConcreteWalletS
41
41
  enable(): Promise<boolean>;
42
42
  disconnect(): Promise<void>;
43
43
  getAddresses(): Promise<string[]>;
44
+ getAddressesInfo(): Promise<{
45
+ address: string;
46
+ derivationPath: string;
47
+ baseDerivationPath: string;
48
+ }[]>;
44
49
  getSessionOrConfirm(address: AccountAddress): Promise<string>;
45
50
  sendEvmTransaction(txData: any, args: {
46
51
  address: string;
@@ -84,6 +89,11 @@ declare class LedgerCosmos extends BaseConcreteStrategy implements ConcreteWalle
84
89
  enable(): Promise<boolean>;
85
90
  disconnect(): Promise<void>;
86
91
  getAddresses(): Promise<string[]>;
92
+ getAddressesInfo(): Promise<{
93
+ address: string;
94
+ derivationPath: string;
95
+ baseDerivationPath: string;
96
+ }[]>;
87
97
  getSessionOrConfirm(address: AccountAddress): Promise<string>;
88
98
  sendEvmTransaction(_txData: any, _options: {
89
99
  address: string;
package/dist/esm/index.js CHANGED
@@ -138,42 +138,22 @@ var AccountManager$1 = class {
138
138
  //#region src/strategy/lib.ts
139
139
  let EthType;
140
140
  let CosmosType;
141
- let ledgerServiceType;
142
141
  let TransportWebUSB;
143
142
  let TransportWebHID;
144
143
  async function loadEthType() {
145
- if (!EthType) {
146
- const module = await import("@bangjelkoski/ledgerhq-hw-app-eth");
147
- EthType = module.Eth ? module.Eth : module.default.Eth;
148
- }
144
+ if (!EthType) EthType = (await import("@ledgerhq/hw-app-eth")).default;
149
145
  return EthType;
150
146
  }
151
147
  async function loadCosmosType() {
152
- if (!CosmosType) {
153
- const module = await import("@bangjelkoski/ledgerhq-hw-app-cosmos");
154
- CosmosType = module.Cosmos ? module.Cosmos : module.default.Cosmos;
155
- }
148
+ if (!CosmosType) CosmosType = (await import("@ledgerhq/hw-app-cosmos")).default;
156
149
  return CosmosType;
157
150
  }
158
- async function loadLedgerServiceType() {
159
- if (!ledgerServiceType) {
160
- const module = await import("@bangjelkoski/ledgerhq-hw-app-eth");
161
- ledgerServiceType = module.ledgerService || module.default.ledgerService;
162
- }
163
- return ledgerServiceType;
164
- }
165
151
  async function loadTransportWebUSB() {
166
- if (!TransportWebUSB) {
167
- const module = await import("@bangjelkoski/ledgerhq-hw-transport-webusb");
168
- TransportWebUSB = module.TransportWebUSB || module.default.TransportWebUSB;
169
- }
152
+ if (!TransportWebUSB) TransportWebUSB = (await import("@ledgerhq/hw-transport-webusb")).default;
170
153
  return TransportWebUSB;
171
154
  }
172
155
  async function loadTransportWebHIDType() {
173
- if (!TransportWebHID) {
174
- const module = await import("@bangjelkoski/ledgerhq-hw-transport-webhid");
175
- TransportWebHID = module.TransportWebHID || module.default.TransportWebHID;
176
- }
156
+ if (!TransportWebHID) TransportWebHID = (await import("@ledgerhq/hw-transport-webhid")).default;
177
157
  return TransportWebHID;
178
158
  }
179
159
 
@@ -256,7 +236,7 @@ var LedgerEip1193Provider = class {
256
236
  _defineProperty(this, "address", void 0);
257
237
  _defineProperty(this, "chainId", void 0);
258
238
  this.ledger = ledger;
259
- this.derivationPath = "m/44'/60'/0'/0/0";
239
+ this.derivationPath = params.derivationPath || "m/44'/60'/0'/0/0";
260
240
  this.chainId = parseInt(params.chainId || "1");
261
241
  }
262
242
  async getClient() {
@@ -277,14 +257,18 @@ var LedgerEip1193Provider = class {
277
257
  }
278
258
  async signTypedData(data) {
279
259
  const result = await (await this.ledger.getInstance()).signEIP712Message(this.derivationPath, JSON.parse(data));
280
- const combined = `${result.r}${result.s}${result.v.toString(16)}`;
260
+ const v = result.v.toString(16).padStart(2, "0");
261
+ const combined = `${result.r}${result.s}${v}`;
281
262
  return combined.startsWith("0x") ? combined : `0x${combined}`;
282
263
  }
283
264
  async signTransaction(txData) {
284
265
  const ledgerInstance = await this.ledger.getInstance();
285
266
  const serializedTransaction = serializeTransaction(txData);
286
- const resolution = await (await loadLedgerServiceType()).resolveTransaction(serializedTransaction.substring(2), {}, {});
287
- const signature = await ledgerInstance.signTransaction(this.derivationPath, serializedTransaction.substring(2), resolution);
267
+ const signature = await ledgerInstance.clearSignTransaction(this.derivationPath, serializedTransaction.substring(2), {
268
+ erc20: true,
269
+ externalPlugins: true,
270
+ nft: true
271
+ });
288
272
  return serializeTransaction(txData, {
289
273
  r: signature.r,
290
274
  s: signature.s,
@@ -293,7 +277,8 @@ var LedgerEip1193Provider = class {
293
277
  }
294
278
  async signMessage(messageHex) {
295
279
  const result = await (await this.ledger.getInstance()).signPersonalMessage(this.derivationPath, messageHex);
296
- const combined = `${result.r}${result.s}${result.v.toString(16)}`;
280
+ const v = result.v.toString(16).padStart(2, "0");
281
+ const combined = `${result.r}${result.s}${v}`;
297
282
  return combined.startsWith("0x") ? combined : `0x${combined}`;
298
283
  }
299
284
  getChain() {
@@ -400,6 +385,22 @@ var LedgerBase = class extends BaseConcreteStrategy {
400
385
  });
401
386
  }
402
387
  }
388
+ async getAddressesInfo() {
389
+ const { baseDerivationPath, derivationPathType } = this;
390
+ try {
391
+ return (await (await this.ledger.getAccountManager()).getWallets(baseDerivationPath, derivationPathType)).map((k) => ({
392
+ address: k.address,
393
+ derivationPath: k.derivationPath,
394
+ baseDerivationPath: k.baseDerivationPath
395
+ }));
396
+ } catch (e) {
397
+ throw new LedgerException(new Error(e.message), {
398
+ code: UnspecifiedErrorCode,
399
+ type: ErrorType.WalletError,
400
+ contextModule: WalletAction.GetAccounts
401
+ });
402
+ }
403
+ }
403
404
  async getSessionOrConfirm(address) {
404
405
  return Promise.resolve(`0x${uint8ArrayToHex(stringToUint8Array(`Confirmation for ${address} at time: ${Date.now()}`))}`);
405
406
  }
@@ -431,7 +432,8 @@ var LedgerBase = class extends BaseConcreteStrategy {
431
432
  const object = JSON.parse(eip712json);
432
433
  try {
433
434
  const result = await (await this.ledger.getInstance()).signEIP712Message(derivationPath, object);
434
- const combined = `${result.r}${result.s}${result.v.toString(16)}`;
435
+ const v = result.v.toString(16).padStart(2, "0");
436
+ const combined = `${result.r}${result.s}${v}`;
435
437
  return combined.startsWith("0x") ? combined : `0x${combined}`;
436
438
  } catch (e) {
437
439
  const errorMessage = e.message;
@@ -442,7 +444,8 @@ var LedgerBase = class extends BaseConcreteStrategy {
442
444
  });
443
445
  try {
444
446
  const result = await (await this.ledger.getInstance()).signEIP712HashedMessage(derivationPath, domainHash(object), messageHash(object));
445
- const combined = `${result.r}${result.s}${result.v.toString(16)}`;
447
+ const v = result.v.toString(16).padStart(2, "0");
448
+ const combined = `${result.r}${result.s}${v}`;
446
449
  return combined.startsWith("0x") ? combined : `0x${combined}`;
447
450
  } catch (e$1) {
448
451
  throw new LedgerException(new Error(e$1.message), {
@@ -471,7 +474,8 @@ var LedgerBase = class extends BaseConcreteStrategy {
471
474
  try {
472
475
  const { derivationPath } = await this.getWalletForAddress(signer);
473
476
  const result = await (await this.ledger.getInstance()).signPersonalMessage(derivationPath, uint8ArrayToHex(stringToUint8Array(toUtf8(data))));
474
- const combined = `${result.r}${result.s}${result.v.toString(16)}`;
477
+ const v = result.v.toString(16).padStart(2, "0");
478
+ const combined = `${result.r}${result.s}${v}`;
475
479
  return combined.startsWith("0x") ? combined : `0x${combined}`;
476
480
  } catch (e) {
477
481
  throw new LedgerException(new Error(e.message), {
@@ -501,7 +505,6 @@ var LedgerBase = class extends BaseConcreteStrategy {
501
505
  throw new WalletException(/* @__PURE__ */ new Error("You can only fetch PubKey from Cosmos native wallets"));
502
506
  }
503
507
  async signEvmTransaction(txData, args) {
504
- const ledgerService = await loadLedgerServiceType();
505
508
  const publicClient = await this.getPublicClient(args.evmChainId);
506
509
  const chainId = parseInt(args.evmChainId.toString(), 10);
507
510
  const address = args.address.startsWith("0x") ? args.address : `0x${args.address}`;
@@ -528,8 +531,11 @@ var LedgerBase = class extends BaseConcreteStrategy {
528
531
  try {
529
532
  const ledger = await this.ledger.getInstance();
530
533
  const { derivationPath } = await this.getWalletForAddress(args.address);
531
- const resolution = await ledgerService.resolveTransaction(serializedTxHex, {}, {});
532
- const txSig = await ledger.signTransaction(derivationPath, serializedTxHex, resolution);
534
+ const txSig = await ledger.clearSignTransaction(derivationPath, serializedTxHex, {
535
+ erc20: true,
536
+ externalPlugins: true,
537
+ nft: true
538
+ });
533
539
  return serializeTransaction({
534
540
  ...eip1559TxData,
535
541
  v: BigInt(`0x${txSig.v}`),
@@ -545,6 +551,12 @@ var LedgerBase = class extends BaseConcreteStrategy {
545
551
  }
546
552
  }
547
553
  async getWalletForAddress(address) {
554
+ var _this$metadata;
555
+ if ((_this$metadata = this.metadata) === null || _this$metadata === void 0 ? void 0 : _this$metadata.derivationPath) return {
556
+ address,
557
+ baseDerivationPath: this.metadata.baseDerivationPath || this.baseDerivationPath,
558
+ derivationPath: this.metadata.derivationPath
559
+ };
548
560
  try {
549
561
  const { baseDerivationPath, derivationPathType } = this;
550
562
  const accountManager = await this.ledger.getAccountManager();
@@ -562,9 +574,10 @@ var LedgerBase = class extends BaseConcreteStrategy {
562
574
  }
563
575
  }
564
576
  async getEip1193Provider() {
577
+ var _this$metadata2;
565
578
  return new LedgerEip1193Provider(this.ledger, {
566
579
  chainId: this.evmOptions.evmChainId.toString(),
567
- derivationPath: this.baseDerivationPath
580
+ derivationPath: (_this$metadata2 = this.metadata) === null || _this$metadata2 === void 0 ? void 0 : _this$metadata2.derivationPath
568
581
  });
569
582
  }
570
583
  async getPublicClient(evmChainId) {
@@ -719,6 +732,13 @@ var LedgerCosmos = class extends BaseConcreteStrategy {
719
732
  });
720
733
  }
721
734
  }
735
+ async getAddressesInfo() {
736
+ throw new LedgerCosmosException(/* @__PURE__ */ new Error("getAddressesInfo is not implemented"), {
737
+ code: UnspecifiedErrorCode,
738
+ type: ErrorType.WalletError,
739
+ contextModule: WalletAction.GetAccounts
740
+ });
741
+ }
722
742
  async getSessionOrConfirm(address) {
723
743
  return Promise.resolve(`0x${uint8ArrayToHex(stringToUint8Array(`Confirmation for ${address} at time: ${Date.now()}`))}`);
724
744
  }
@@ -782,13 +802,13 @@ var LedgerCosmos = class extends BaseConcreteStrategy {
782
802
  }
783
803
  }
784
804
  async getEthereumChainId() {
785
- throw new CosmosWalletException(/* @__PURE__ */ new Error("getEthereumChainId is not supported on Keplr"), {
805
+ throw new CosmosWalletException(/* @__PURE__ */ new Error("getEthereumChainId is not supported on LedgerCosmos"), {
786
806
  code: UnspecifiedErrorCode,
787
807
  context: WalletAction.GetChainId
788
808
  });
789
809
  }
790
810
  async getEvmTransactionReceipt(_txHash) {
791
- throw new CosmosWalletException(/* @__PURE__ */ new Error("getEvmTransactionReceipt is not supported on Keplr"), {
811
+ throw new CosmosWalletException(/* @__PURE__ */ new Error("getEvmTransactionReceipt is not supported on LedgerCosmos"), {
792
812
  code: UnspecifiedErrorCode,
793
813
  context: WalletAction.GetEvmTransactionReceipt
794
814
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@injectivelabs/wallet-ledger",
3
- "version": "1.16.38-alpha.3",
3
+ "version": "1.16.38-alpha.4",
4
4
  "description": "Ledger wallet strategy for use with @injectivelabs/wallet-core.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -38,19 +38,16 @@
38
38
  "dist"
39
39
  ],
40
40
  "dependencies": {
41
- "@bangjelkoski/ledgerhq-hw-app-cosmos": "6.30.4-beta.0",
42
- "@bangjelkoski/ledgerhq-hw-app-eth": "6.42.6-beta.0",
43
- "@bangjelkoski/ledgerhq-hw-transport": "6.31.4-beta.0",
44
- "@bangjelkoski/ledgerhq-hw-transport-webhid": "6.30.0-beta.0",
45
- "@bangjelkoski/ledgerhq-hw-transport-webusb": "6.29.4-beta.0",
46
- "viem": "^2.40.3",
47
- "@injectivelabs/sdk-ts": "1.16.38-alpha.3",
48
- "@injectivelabs/ts-types": "1.16.38-alpha.1",
49
- "@injectivelabs/exceptions": "1.16.38-alpha.2",
50
- "@injectivelabs/wallet-base": "1.16.38-alpha.3"
51
- },
52
- "devDependencies": {
53
- "@types/ledgerhq__hw-transport-webusb": "^4.70.1"
41
+ "@ledgerhq/hw-app-cosmos": "^6.32.9",
42
+ "@ledgerhq/hw-app-eth": "^6.47.1",
43
+ "@ledgerhq/hw-transport": "^6.31.13",
44
+ "@ledgerhq/hw-transport-webhid": "^6.30.9",
45
+ "@ledgerhq/hw-transport-webusb": "^6.29.13",
46
+ "viem": "^2.41.2",
47
+ "@injectivelabs/exceptions": "1.16.38-alpha.3",
48
+ "@injectivelabs/sdk-ts": "1.16.38-alpha.4",
49
+ "@injectivelabs/ts-types": "1.16.38-alpha.2",
50
+ "@injectivelabs/wallet-base": "1.16.38-alpha.4"
54
51
  },
55
52
  "publishConfig": {
56
53
  "access": "public"