@injectivelabs/wallet-trezor 1.16.13-alpha.4 → 1.16.13-alpha.6

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.
@@ -1,3 +1,4 @@
1
+ import { EvmChainId } from '@injectivelabs/ts-types';
1
2
  import { WalletDeviceType, BaseConcreteStrategy } from '@injectivelabs/wallet-base';
2
3
  import type { TrezorDerivationPathType } from '../types.js';
3
4
  import type { AccountAddress, EvmChainId as EvmChainIdType } from '@injectivelabs/ts-types';
@@ -35,7 +36,7 @@ export default class TrezorBase extends BaseConcreteStrategy implements Concrete
35
36
  }): Promise<DirectSignResponse>;
36
37
  signArbitrary(signer: AccountAddress, data: string | Uint8Array): Promise<string>;
37
38
  getEthereumChainId(): Promise<string>;
38
- getEvmTransactionReceipt(txHash: string): Promise<string>;
39
+ getEvmTransactionReceipt(txHash: string, evmChainId?: EvmChainId): Promise<string>;
39
40
  getPubKey(): Promise<string>;
40
41
  private signEvmTransaction;
41
42
  private getWalletForAddress;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("@injectivelabs/utils");
3
4
  const viem_1 = require("viem");
4
5
  const ts_types_1 = require("@injectivelabs/ts-types");
5
6
  const sdk_ts_1 = require("@injectivelabs/sdk-ts");
@@ -167,8 +168,26 @@ class TrezorBase extends wallet_base_1.BaseConcreteStrategy {
167
168
  const alchemyProvider = await alchemy.config.getProvider();
168
169
  return alchemyProvider.network.chainId.toString();
169
170
  }
170
- async getEvmTransactionReceipt(txHash) {
171
- return Promise.resolve(txHash);
171
+ async getEvmTransactionReceipt(txHash, evmChainId) {
172
+ const alchemy = await this.getAlchemy(evmChainId);
173
+ const provider = await alchemy.config.getProvider();
174
+ const interval = 3000;
175
+ const maxAttempts = 10;
176
+ let attempts = 0;
177
+ while (attempts < maxAttempts) {
178
+ attempts++;
179
+ await (0, utils_1.sleep)(interval);
180
+ try {
181
+ const receipt = await provider.send('eth_getTransactionReceipt', [
182
+ txHash,
183
+ ]);
184
+ if (receipt) {
185
+ return txHash;
186
+ }
187
+ }
188
+ catch { }
189
+ }
190
+ throw new Error(`Failed to retrieve transaction receipt for txHash: ${txHash}`);
172
191
  }
173
192
  async getPubKey() {
174
193
  throw new exceptions_1.WalletException(new Error('You can only fetch PubKey from Cosmos native wallets'));
@@ -1,3 +1,4 @@
1
+ import { EvmChainId } from '@injectivelabs/ts-types';
1
2
  import { WalletDeviceType, BaseConcreteStrategy } from '@injectivelabs/wallet-base';
2
3
  import type { TrezorDerivationPathType } from '../types.js';
3
4
  import type { AccountAddress, EvmChainId as EvmChainIdType } from '@injectivelabs/ts-types';
@@ -35,7 +36,7 @@ export default class TrezorBase extends BaseConcreteStrategy implements Concrete
35
36
  }): Promise<DirectSignResponse>;
36
37
  signArbitrary(signer: AccountAddress, data: string | Uint8Array): Promise<string>;
37
38
  getEthereumChainId(): Promise<string>;
38
- getEvmTransactionReceipt(txHash: string): Promise<string>;
39
+ getEvmTransactionReceipt(txHash: string, evmChainId?: EvmChainId): Promise<string>;
39
40
  getPubKey(): Promise<string>;
40
41
  private signEvmTransaction;
41
42
  private getWalletForAddress;
@@ -1,3 +1,4 @@
1
+ import { sleep } from '@injectivelabs/utils';
1
2
  import { toHex, serializeTransaction } from 'viem';
2
3
  import { EvmChainId } from '@injectivelabs/ts-types';
3
4
  import { toUtf8, TxGrpcApi } from '@injectivelabs/sdk-ts';
@@ -165,8 +166,26 @@ export default class TrezorBase extends BaseConcreteStrategy {
165
166
  const alchemyProvider = await alchemy.config.getProvider();
166
167
  return alchemyProvider.network.chainId.toString();
167
168
  }
168
- async getEvmTransactionReceipt(txHash) {
169
- return Promise.resolve(txHash);
169
+ async getEvmTransactionReceipt(txHash, evmChainId) {
170
+ const alchemy = await this.getAlchemy(evmChainId);
171
+ const provider = await alchemy.config.getProvider();
172
+ const interval = 3000;
173
+ const maxAttempts = 10;
174
+ let attempts = 0;
175
+ while (attempts < maxAttempts) {
176
+ attempts++;
177
+ await sleep(interval);
178
+ try {
179
+ const receipt = await provider.send('eth_getTransactionReceipt', [
180
+ txHash,
181
+ ]);
182
+ if (receipt) {
183
+ return txHash;
184
+ }
185
+ }
186
+ catch { }
187
+ }
188
+ throw new Error(`Failed to retrieve transaction receipt for txHash: ${txHash}`);
170
189
  }
171
190
  async getPubKey() {
172
191
  throw new WalletException(new Error('You can only fetch PubKey from Cosmos native wallets'));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@injectivelabs/wallet-trezor",
3
3
  "description": "Trezor wallet strategy for use with @injectivelabs/wallet-core.",
4
- "version": "1.16.13-alpha.4",
4
+ "version": "1.16.13-alpha.6",
5
5
  "sideEffects": false,
6
6
  "type": "module",
7
7
  "author": {
@@ -57,15 +57,15 @@
57
57
  },
58
58
  "dependencies": {
59
59
  "@bangjelkoski/trezor-connect-web": "^9.4.7-beta.1",
60
- "@injectivelabs/exceptions": "1.16.13-alpha.4",
61
- "@injectivelabs/sdk-ts": "1.16.13-alpha.4",
62
- "@injectivelabs/ts-types": "1.16.13-alpha.4",
63
- "@injectivelabs/wallet-base": "1.16.13-alpha.4",
60
+ "@injectivelabs/exceptions": "1.16.13-alpha.6",
61
+ "@injectivelabs/sdk-ts": "1.16.13-alpha.6",
62
+ "@injectivelabs/ts-types": "1.16.13-alpha.6",
63
+ "@injectivelabs/wallet-base": "1.16.13-alpha.6",
64
64
  "alchemy-sdk": "^3.4.7",
65
65
  "viem": "^2.33.2"
66
66
  },
67
67
  "devDependencies": {
68
68
  "shx": "^0.3.3"
69
69
  },
70
- "gitHead": "38872f985bdce134a3e6f9f7b7e0e3e5c5cd36b1"
70
+ "gitHead": "4239109ab41807561f8ed8fcb98339387bfc8547"
71
71
  }