@injectivelabs/wallet-trezor 1.19.10 → 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.
@@ -241,15 +241,24 @@ var TrezorEip1193Provider = class {
241
241
  constructor(trezor, params) {
242
242
  _defineProperty(this, "trezor", void 0);
243
243
  _defineProperty(this, "derivationPath", void 0);
244
+ _defineProperty(this, "rpcUrl", void 0);
245
+ _defineProperty(this, "rpcUrls", void 0);
244
246
  _defineProperty(this, "address", void 0);
245
247
  _defineProperty(this, "chainId", void 0);
246
248
  this.trezor = trezor;
247
249
  this.derivationPath = params.derivationPath || "m/44'/60'/0'/0/0";
250
+ this.rpcUrl = params.rpcUrl;
251
+ this.rpcUrls = params.rpcUrls;
248
252
  this.chainId = parseInt(params.chainId || "1");
249
253
  }
254
+ getRpcUrl() {
255
+ var _this$rpcUrls;
256
+ return ((_this$rpcUrls = this.rpcUrls) === null || _this$rpcUrls === void 0 ? void 0 : _this$rpcUrls[this.chainId]) || this.rpcUrl;
257
+ }
250
258
  async getClient() {
251
259
  return (0, __injectivelabs_wallet_base.getViemWalletClient)({
252
260
  chainId: this.chainId,
261
+ rpcUrl: this.getRpcUrl(),
253
262
  account: await this.getAddress()
254
263
  });
255
264
  }
@@ -379,7 +388,7 @@ var TrezorEip1193Provider = class {
379
388
  return this.setChainId(((_args$params$ = args.params[0]) === null || _args$params$ === void 0 ? void 0 : _args$params$.chainId) || "0x1");
380
389
  }
381
390
  if (args.method === "eth_estimateGas") {
382
- const client = (0, __injectivelabs_wallet_base.getViemPublicClient)(this.chainId);
391
+ const client = (0, __injectivelabs_wallet_base.getViemPublicClient)(this.chainId, this.getRpcUrl());
383
392
  const data = {
384
393
  to: args.params[0].to,
385
394
  value: args.params[0].value,
@@ -390,7 +399,7 @@ var TrezorEip1193Provider = class {
390
399
  }
391
400
  if (args.method === "eth_getTransactionCount") {
392
401
  if (!args.params) throw new Error("params is required");
393
- return `0x${(await (0, __injectivelabs_wallet_base.getViemPublicClient)(this.chainId).getTransactionCount({
402
+ return `0x${(await (0, __injectivelabs_wallet_base.getViemPublicClient)(this.chainId, this.getRpcUrl()).getTransactionCount({
394
403
  address: await this.getAddress(),
395
404
  blockTag: "pending"
396
405
  })).toString(16)}`;
@@ -399,7 +408,8 @@ var TrezorEip1193Provider = class {
399
408
  const address = await this.getAddress();
400
409
  const walletClient = (0, __injectivelabs_wallet_base.getViemWalletClient)({
401
410
  chainId: this.chainId,
402
- account: address
411
+ account: address,
412
+ rpcUrl: this.getRpcUrl()
403
413
  });
404
414
  const preparedTransaction = await walletClient.prepareTransactionRequest({ ...args.params[0] });
405
415
  const signedTransaction = await this.signTransaction(preparedTransaction);
@@ -681,8 +691,10 @@ var TrezorBase = class extends __injectivelabs_wallet_base.BaseConcreteStrategy
681
691
  async getEip1193Provider() {
682
692
  var _this$metadata2;
683
693
  return new TrezorEip1193Provider(this.trezor, {
684
- chainId: this.evmOptions.evmChainId.toString(),
685
- derivationPath: (_this$metadata2 = this.metadata) === null || _this$metadata2 === void 0 ? void 0 : _this$metadata2.derivationPath
694
+ rpcUrl: this.evmOptions.rpcUrl,
695
+ rpcUrls: this.evmOptions.rpcUrls,
696
+ derivationPath: (_this$metadata2 = this.metadata) === null || _this$metadata2 === void 0 ? void 0 : _this$metadata2.derivationPath,
697
+ chainId: this.evmOptions.evmChainId.toString()
686
698
  });
687
699
  }
688
700
  async getPublicClient(evmChainId) {
package/dist/esm/index.js CHANGED
@@ -241,15 +241,24 @@ var TrezorEip1193Provider = class {
241
241
  constructor(trezor, params) {
242
242
  _defineProperty(this, "trezor", void 0);
243
243
  _defineProperty(this, "derivationPath", void 0);
244
+ _defineProperty(this, "rpcUrl", void 0);
245
+ _defineProperty(this, "rpcUrls", void 0);
244
246
  _defineProperty(this, "address", void 0);
245
247
  _defineProperty(this, "chainId", void 0);
246
248
  this.trezor = trezor;
247
249
  this.derivationPath = params.derivationPath || "m/44'/60'/0'/0/0";
250
+ this.rpcUrl = params.rpcUrl;
251
+ this.rpcUrls = params.rpcUrls;
248
252
  this.chainId = parseInt(params.chainId || "1");
249
253
  }
254
+ getRpcUrl() {
255
+ var _this$rpcUrls;
256
+ return ((_this$rpcUrls = this.rpcUrls) === null || _this$rpcUrls === void 0 ? void 0 : _this$rpcUrls[this.chainId]) || this.rpcUrl;
257
+ }
250
258
  async getClient() {
251
259
  return getViemWalletClient({
252
260
  chainId: this.chainId,
261
+ rpcUrl: this.getRpcUrl(),
253
262
  account: await this.getAddress()
254
263
  });
255
264
  }
@@ -379,7 +388,7 @@ var TrezorEip1193Provider = class {
379
388
  return this.setChainId(((_args$params$ = args.params[0]) === null || _args$params$ === void 0 ? void 0 : _args$params$.chainId) || "0x1");
380
389
  }
381
390
  if (args.method === "eth_estimateGas") {
382
- const client = getViemPublicClient(this.chainId);
391
+ const client = getViemPublicClient(this.chainId, this.getRpcUrl());
383
392
  const data = {
384
393
  to: args.params[0].to,
385
394
  value: args.params[0].value,
@@ -390,7 +399,7 @@ var TrezorEip1193Provider = class {
390
399
  }
391
400
  if (args.method === "eth_getTransactionCount") {
392
401
  if (!args.params) throw new Error("params is required");
393
- return `0x${(await getViemPublicClient(this.chainId).getTransactionCount({
402
+ return `0x${(await getViemPublicClient(this.chainId, this.getRpcUrl()).getTransactionCount({
394
403
  address: await this.getAddress(),
395
404
  blockTag: "pending"
396
405
  })).toString(16)}`;
@@ -399,7 +408,8 @@ var TrezorEip1193Provider = class {
399
408
  const address = await this.getAddress();
400
409
  const walletClient = getViemWalletClient({
401
410
  chainId: this.chainId,
402
- account: address
411
+ account: address,
412
+ rpcUrl: this.getRpcUrl()
403
413
  });
404
414
  const preparedTransaction = await walletClient.prepareTransactionRequest({ ...args.params[0] });
405
415
  const signedTransaction = await this.signTransaction(preparedTransaction);
@@ -681,8 +691,10 @@ var TrezorBase = class extends BaseConcreteStrategy {
681
691
  async getEip1193Provider() {
682
692
  var _this$metadata2;
683
693
  return new TrezorEip1193Provider(this.trezor, {
684
- chainId: this.evmOptions.evmChainId.toString(),
685
- derivationPath: (_this$metadata2 = this.metadata) === null || _this$metadata2 === void 0 ? void 0 : _this$metadata2.derivationPath
694
+ rpcUrl: this.evmOptions.rpcUrl,
695
+ rpcUrls: this.evmOptions.rpcUrls,
696
+ derivationPath: (_this$metadata2 = this.metadata) === null || _this$metadata2 === void 0 ? void 0 : _this$metadata2.derivationPath,
697
+ chainId: this.evmOptions.evmChainId.toString()
686
698
  });
687
699
  }
688
700
  async getPublicClient(evmChainId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@injectivelabs/wallet-trezor",
3
- "version": "1.19.10",
3
+ "version": "1.19.12",
4
4
  "description": "Trezor wallet strategy for use with @injectivelabs/wallet-core.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -45,10 +45,10 @@
45
45
  "@trezor/connect": "^9.6.4",
46
46
  "@trezor/connect-web": "^9.6.4",
47
47
  "viem": "^2.41.2",
48
- "@injectivelabs/exceptions": "1.19.10",
49
- "@injectivelabs/sdk-ts": "1.19.10",
50
- "@injectivelabs/ts-types": "1.19.10",
51
- "@injectivelabs/wallet-base": "1.19.10"
48
+ "@injectivelabs/ts-types": "1.19.12",
49
+ "@injectivelabs/wallet-base": "1.19.12",
50
+ "@injectivelabs/exceptions": "1.19.12",
51
+ "@injectivelabs/sdk-ts": "1.19.12"
52
52
  },
53
53
  "publishConfig": {
54
54
  "access": "public"