@injectivelabs/wallet-trezor 1.16.39-alpha.0 → 1.17.2-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.
@@ -405,6 +405,9 @@ var TrezorBase = class extends __injectivelabs_wallet_base.BaseConcreteStrategy
405
405
  this.derivationPathType = args.derivationPathType;
406
406
  this.baseDerivationPath = __injectivelabs_wallet_base.DEFAULT_BASE_DERIVATION_PATH;
407
407
  }
408
+ setMetadata(metadata) {
409
+ this.metadata = metadata;
410
+ }
408
411
  async getWalletDeviceType() {
409
412
  return Promise.resolve(__injectivelabs_wallet_base.WalletDeviceType.Hardware);
410
413
  }
@@ -414,6 +417,10 @@ var TrezorBase = class extends __injectivelabs_wallet_base.BaseConcreteStrategy
414
417
  async disconnect() {
415
418
  return Promise.resolve();
416
419
  }
420
+ async getDerivationPath(address) {
421
+ var _this$metadata;
422
+ return ((_this$metadata = this.metadata) === null || _this$metadata === void 0 ? void 0 : _this$metadata.derivationPath) ? this.metadata.derivationPath : (await this.getWalletForAddress(address)).derivationPath;
423
+ }
417
424
  async getAddresses() {
418
425
  const { baseDerivationPath, derivationPathType } = this;
419
426
  try {
@@ -483,7 +490,7 @@ var TrezorBase = class extends __injectivelabs_wallet_base.BaseConcreteStrategy
483
490
  });
484
491
  try {
485
492
  await this.trezor.connect();
486
- const { derivationPath } = await this.getWalletForAddress(address);
493
+ const derivationPath = await this.getDerivationPath(address);
487
494
  const response = await TrezorConnect.ethereumSignTypedData({
488
495
  path: derivationPath,
489
496
  data: {
@@ -528,7 +535,7 @@ var TrezorBase = class extends __injectivelabs_wallet_base.BaseConcreteStrategy
528
535
  const TrezorConnect = await loadTrezorConnect();
529
536
  try {
530
537
  await this.trezor.connect();
531
- const { derivationPath } = await this.getWalletForAddress(signer);
538
+ const derivationPath = await this.getDerivationPath(signer);
532
539
  const response = await TrezorConnect.ethereumSignMessage({
533
540
  path: derivationPath,
534
541
  message: (0, __injectivelabs_sdk_ts_utils.toUtf8)(data)
@@ -591,7 +598,7 @@ var TrezorBase = class extends __injectivelabs_wallet_base.BaseConcreteStrategy
591
598
  };
592
599
  try {
593
600
  await this.trezor.connect();
594
- const { derivationPath } = await this.getWalletForAddress(args.address);
601
+ const derivationPath = await this.getDerivationPath(args.address);
595
602
  const response = await TrezorConnect.ethereumSignTransaction({
596
603
  path: derivationPath,
597
604
  transaction: trezorTxData
@@ -634,10 +641,10 @@ var TrezorBase = class extends __injectivelabs_wallet_base.BaseConcreteStrategy
634
641
  return await accountManager.getWalletForAddress(address);
635
642
  }
636
643
  async getEip1193Provider() {
637
- var _this$metadata;
644
+ var _this$metadata2;
638
645
  return new TrezorEip1193Provider(this.trezor, {
639
646
  chainId: this.evmOptions.evmChainId.toString(),
640
- derivationPath: (_this$metadata = this.metadata) === null || _this$metadata === void 0 ? void 0 : _this$metadata.derivationPath
647
+ derivationPath: (_this$metadata2 = this.metadata) === null || _this$metadata2 === void 0 ? void 0 : _this$metadata2.derivationPath
641
648
  });
642
649
  }
643
650
  async getPublicClient(evmChainId) {
@@ -1,4 +1,4 @@
1
- import { BaseConcreteStrategy, ConcreteEvmWalletStrategyArgs, ConcreteWalletStrategy, Eip1193Provider, SendTransactionOptions, StdSignDoc, WalletDeviceType } from "@injectivelabs/wallet-base";
1
+ import { BaseConcreteStrategy, ConcreteEvmWalletStrategyArgs, ConcreteWalletStrategy, Eip1193Provider, SendTransactionOptions, StdSignDoc, WalletDeviceType, WalletMetadata } from "@injectivelabs/wallet-base";
2
2
  import { AccountAddress, EvmChainId } from "@injectivelabs/ts-types";
3
3
  import { TxResponse } from "@injectivelabs/sdk-ts/core/tx";
4
4
  import { AminoSignResponse, DirectSignResponse, TxRaw } from "@injectivelabs/sdk-ts/types";
@@ -30,9 +30,11 @@ declare class TrezorBase extends BaseConcreteStrategy implements ConcreteWalletS
30
30
  constructor(args: ConcreteEvmWalletStrategyArgs & {
31
31
  derivationPathType: TrezorDerivationPathType;
32
32
  });
33
+ setMetadata(metadata: WalletMetadata): void;
33
34
  getWalletDeviceType(): Promise<WalletDeviceType>;
34
35
  enable(): Promise<boolean>;
35
36
  disconnect(): Promise<void>;
37
+ protected getDerivationPath(address: string): Promise<string>;
36
38
  getAddresses(): Promise<string[]>;
37
39
  getAddressesInfo(): Promise<{
38
40
  address: string;
@@ -1,5 +1,5 @@
1
1
  import { TxResponse } from "@injectivelabs/sdk-ts/core/tx";
2
- import { BaseConcreteStrategy, ConcreteEvmWalletStrategyArgs, ConcreteWalletStrategy, Eip1193Provider, SendTransactionOptions, StdSignDoc, WalletDeviceType } from "@injectivelabs/wallet-base";
2
+ import { BaseConcreteStrategy, ConcreteEvmWalletStrategyArgs, ConcreteWalletStrategy, Eip1193Provider, SendTransactionOptions, StdSignDoc, WalletDeviceType, WalletMetadata } from "@injectivelabs/wallet-base";
3
3
  import { AccountAddress, EvmChainId } from "@injectivelabs/ts-types";
4
4
  import { AminoSignResponse, DirectSignResponse, TxRaw } from "@injectivelabs/sdk-ts/types";
5
5
 
@@ -30,9 +30,11 @@ declare class TrezorBase extends BaseConcreteStrategy implements ConcreteWalletS
30
30
  constructor(args: ConcreteEvmWalletStrategyArgs & {
31
31
  derivationPathType: TrezorDerivationPathType;
32
32
  });
33
+ setMetadata(metadata: WalletMetadata): void;
33
34
  getWalletDeviceType(): Promise<WalletDeviceType>;
34
35
  enable(): Promise<boolean>;
35
36
  disconnect(): Promise<void>;
37
+ protected getDerivationPath(address: string): Promise<string>;
36
38
  getAddresses(): Promise<string[]>;
37
39
  getAddressesInfo(): Promise<{
38
40
  address: string;
package/dist/esm/index.js CHANGED
@@ -405,6 +405,9 @@ var TrezorBase = class extends BaseConcreteStrategy {
405
405
  this.derivationPathType = args.derivationPathType;
406
406
  this.baseDerivationPath = DEFAULT_BASE_DERIVATION_PATH;
407
407
  }
408
+ setMetadata(metadata) {
409
+ this.metadata = metadata;
410
+ }
408
411
  async getWalletDeviceType() {
409
412
  return Promise.resolve(WalletDeviceType.Hardware);
410
413
  }
@@ -414,6 +417,10 @@ var TrezorBase = class extends BaseConcreteStrategy {
414
417
  async disconnect() {
415
418
  return Promise.resolve();
416
419
  }
420
+ async getDerivationPath(address) {
421
+ var _this$metadata;
422
+ return ((_this$metadata = this.metadata) === null || _this$metadata === void 0 ? void 0 : _this$metadata.derivationPath) ? this.metadata.derivationPath : (await this.getWalletForAddress(address)).derivationPath;
423
+ }
417
424
  async getAddresses() {
418
425
  const { baseDerivationPath, derivationPathType } = this;
419
426
  try {
@@ -483,7 +490,7 @@ var TrezorBase = class extends BaseConcreteStrategy {
483
490
  });
484
491
  try {
485
492
  await this.trezor.connect();
486
- const { derivationPath } = await this.getWalletForAddress(address);
493
+ const derivationPath = await this.getDerivationPath(address);
487
494
  const response = await TrezorConnect.ethereumSignTypedData({
488
495
  path: derivationPath,
489
496
  data: {
@@ -528,7 +535,7 @@ var TrezorBase = class extends BaseConcreteStrategy {
528
535
  const TrezorConnect = await loadTrezorConnect();
529
536
  try {
530
537
  await this.trezor.connect();
531
- const { derivationPath } = await this.getWalletForAddress(signer);
538
+ const derivationPath = await this.getDerivationPath(signer);
532
539
  const response = await TrezorConnect.ethereumSignMessage({
533
540
  path: derivationPath,
534
541
  message: toUtf8(data)
@@ -591,7 +598,7 @@ var TrezorBase = class extends BaseConcreteStrategy {
591
598
  };
592
599
  try {
593
600
  await this.trezor.connect();
594
- const { derivationPath } = await this.getWalletForAddress(args.address);
601
+ const derivationPath = await this.getDerivationPath(args.address);
595
602
  const response = await TrezorConnect.ethereumSignTransaction({
596
603
  path: derivationPath,
597
604
  transaction: trezorTxData
@@ -634,10 +641,10 @@ var TrezorBase = class extends BaseConcreteStrategy {
634
641
  return await accountManager.getWalletForAddress(address);
635
642
  }
636
643
  async getEip1193Provider() {
637
- var _this$metadata;
644
+ var _this$metadata2;
638
645
  return new TrezorEip1193Provider(this.trezor, {
639
646
  chainId: this.evmOptions.evmChainId.toString(),
640
- derivationPath: (_this$metadata = this.metadata) === null || _this$metadata === void 0 ? void 0 : _this$metadata.derivationPath
647
+ derivationPath: (_this$metadata2 = this.metadata) === null || _this$metadata2 === void 0 ? void 0 : _this$metadata2.derivationPath
641
648
  });
642
649
  }
643
650
  async getPublicClient(evmChainId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@injectivelabs/wallet-trezor",
3
- "version": "1.16.39-alpha.0",
3
+ "version": "1.17.2-alpha.0",
4
4
  "description": "Trezor wallet strategy for use with @injectivelabs/wallet-core.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -41,10 +41,10 @@
41
41
  "@trezor/connect": "^9.6.4",
42
42
  "@trezor/connect-web": "^9.6.4",
43
43
  "viem": "^2.41.2",
44
- "@injectivelabs/sdk-ts": "1.16.39-alpha.0",
45
- "@injectivelabs/ts-types": "1.16.39-alpha.0",
46
- "@injectivelabs/exceptions": "1.16.39-alpha.0",
47
- "@injectivelabs/wallet-base": "1.16.39-alpha.0"
44
+ "@injectivelabs/exceptions": "1.17.2-alpha.0",
45
+ "@injectivelabs/ts-types": "1.17.2-alpha.0",
46
+ "@injectivelabs/sdk-ts": "1.17.2-alpha.0",
47
+ "@injectivelabs/wallet-base": "1.17.2-alpha.0"
48
48
  },
49
49
  "publishConfig": {
50
50
  "access": "public"