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

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,5 +1,6 @@
1
1
  let viem = require("viem");
2
- let __injectivelabs_sdk_ts = require("@injectivelabs/sdk-ts");
2
+ let __injectivelabs_sdk_ts_core_tx = require("@injectivelabs/sdk-ts/core/tx");
3
+ let __injectivelabs_sdk_ts_utils = require("@injectivelabs/sdk-ts/utils");
3
4
  let __injectivelabs_exceptions = require("@injectivelabs/exceptions");
4
5
  let __injectivelabs_wallet_base = require("@injectivelabs/wallet-base");
5
6
 
@@ -61,7 +62,7 @@ function _defineProperty(e, r, t) {
61
62
  const addressOfHDKey = (hdKey) => {
62
63
  const shouldSanitizePublicKey = true;
63
64
  const derivedPublicKey = hdKey.publicKey;
64
- return (0, __injectivelabs_sdk_ts.addHexPrefix)((0, __injectivelabs_sdk_ts.uint8ArrayToHex)((0, __injectivelabs_sdk_ts.publicKeyToAddress)(derivedPublicKey, shouldSanitizePublicKey)));
65
+ return (0, __injectivelabs_sdk_ts_utils.addHexPrefix)((0, __injectivelabs_sdk_ts_utils.uint8ArrayToHex)((0, __injectivelabs_sdk_ts_utils.publicKeyToAddress)(derivedPublicKey, shouldSanitizePublicKey)));
65
66
  };
66
67
  var AccountManager$1 = class {
67
68
  constructor(ledger) {
@@ -97,8 +98,8 @@ var AccountManager$1 = class {
97
98
  });
98
99
  const result = await this.ledger.getAddress(path);
99
100
  const hdKey = {
100
- publicKey: (0, __injectivelabs_sdk_ts.hexToUint8Array)(result.publicKey),
101
- chainCode: (0, __injectivelabs_sdk_ts.hexToUint8Array)(result.chainCode || "")
101
+ publicKey: (0, __injectivelabs_sdk_ts_utils.hexToUint8Array)(result.publicKey),
102
+ chainCode: (0, __injectivelabs_sdk_ts_utils.hexToUint8Array)(result.chainCode || "")
102
103
  };
103
104
  const address = result.address || addressOfHDKey(hdKey);
104
105
  this.wallets.push({
@@ -400,7 +401,7 @@ var LedgerBase = class extends __injectivelabs_wallet_base.BaseConcreteStrategy
400
401
  }
401
402
  }
402
403
  async getSessionOrConfirm(address) {
403
- return Promise.resolve(`0x${(0, __injectivelabs_sdk_ts.uint8ArrayToHex)((0, __injectivelabs_sdk_ts.stringToUint8Array)(`Confirmation for ${address} at time: ${Date.now()}`))}`);
404
+ return Promise.resolve(`0x${(0, __injectivelabs_sdk_ts_utils.uint8ArrayToHex)((0, __injectivelabs_sdk_ts_utils.stringToUint8Array)(`Confirmation for ${address} at time: ${Date.now()}`))}`);
404
405
  }
405
406
  async sendEvmTransaction(txData, args) {
406
407
  const signedTransaction = await this.signEvmTransaction(txData, args);
@@ -417,7 +418,7 @@ var LedgerBase = class extends __injectivelabs_wallet_base.BaseConcreteStrategy
417
418
  async sendTransaction(transaction, options) {
418
419
  const { endpoints, txTimeout } = options;
419
420
  if (!endpoints) throw new __injectivelabs_exceptions.WalletException(/* @__PURE__ */ new Error("You have to pass endpoints.grpc within the options for using Ethereum native wallets"));
420
- const response = await new __injectivelabs_sdk_ts.TxGrpcApi(endpoints.grpc).broadcast(transaction, { txTimeout });
421
+ const response = await new __injectivelabs_sdk_ts_core_tx.TxGrpcApi(endpoints.grpc).broadcast(transaction, { txTimeout });
421
422
  if (response.code !== 0) throw new __injectivelabs_exceptions.TransactionException(new Error(response.rawLog), {
422
423
  code: __injectivelabs_exceptions.UnspecifiedErrorCode,
423
424
  contextCode: response.code,
@@ -469,7 +470,7 @@ var LedgerBase = class extends __injectivelabs_wallet_base.BaseConcreteStrategy
469
470
  async signArbitrary(signer, data) {
470
471
  try {
471
472
  const { derivationPath } = await this.getWalletForAddress(signer);
472
- const result = await (await this.ledger.getInstance()).signPersonalMessage(derivationPath, (0, __injectivelabs_sdk_ts.uint8ArrayToHex)((0, __injectivelabs_sdk_ts.stringToUint8Array)((0, __injectivelabs_sdk_ts.toUtf8)(data))));
473
+ 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))));
473
474
  const combined = `${result.r}${result.s}${result.v.toString(16)}`;
474
475
  return combined.startsWith("0x") ? combined : `0x${combined}`;
475
476
  } catch (e) {
@@ -719,7 +720,7 @@ var LedgerCosmos = class extends __injectivelabs_wallet_base.BaseConcreteStrateg
719
720
  }
720
721
  }
721
722
  async getSessionOrConfirm(address) {
722
- return Promise.resolve(`0x${(0, __injectivelabs_sdk_ts.uint8ArrayToHex)((0, __injectivelabs_sdk_ts.stringToUint8Array)(`Confirmation for ${address} at time: ${Date.now()}`))}`);
723
+ return Promise.resolve(`0x${(0, __injectivelabs_sdk_ts_utils.uint8ArrayToHex)((0, __injectivelabs_sdk_ts_utils.stringToUint8Array)(`Confirmation for ${address} at time: ${Date.now()}`))}`);
723
724
  }
724
725
  async sendEvmTransaction(_txData, _options) {
725
726
  throw new __injectivelabs_exceptions.CosmosWalletException(/* @__PURE__ */ new Error("sendEvmTransaction is not supported. LedgerCosmos only supports sending cosmos transactions"), {
@@ -730,7 +731,7 @@ var LedgerCosmos = class extends __injectivelabs_wallet_base.BaseConcreteStrateg
730
731
  async sendTransaction(transaction, options) {
731
732
  const { endpoints, txTimeout } = options;
732
733
  if (!endpoints) throw new __injectivelabs_exceptions.WalletException(/* @__PURE__ */ new Error("You have to pass endpoints.grpc within the options for using LedgerCosmos wallet"));
733
- const response = await new __injectivelabs_sdk_ts.TxGrpcApi(endpoints.grpc).broadcast(transaction, { txTimeout });
734
+ const response = await new __injectivelabs_sdk_ts_core_tx.TxGrpcApi(endpoints.grpc).broadcast(transaction, { txTimeout });
734
735
  if (response.code !== 0) throw new __injectivelabs_exceptions.TransactionException(new Error(response.rawLog), {
735
736
  code: __injectivelabs_exceptions.UnspecifiedErrorCode,
736
737
  contextCode: response.code,
@@ -744,7 +745,7 @@ var LedgerCosmos = class extends __injectivelabs_wallet_base.BaseConcreteStrateg
744
745
  return {
745
746
  signed: void 0,
746
747
  signature: {
747
- signature: (0, __injectivelabs_sdk_ts.uint8ArrayToBase64)((await (await this.ledger.getInstance()).sign(derivationPath, JSON.stringify((0, __injectivelabs_sdk_ts.sortObjectByKeys)(transaction.signDoc)))).signature),
748
+ signature: (0, __injectivelabs_sdk_ts_utils.uint8ArrayToBase64)((await (await this.ledger.getInstance()).sign(derivationPath, JSON.stringify((0, __injectivelabs_sdk_ts_utils.sortObjectByKeys)(transaction.signDoc)))).signature),
748
749
  pub_key: void 0
749
750
  }
750
751
  };
@@ -771,7 +772,7 @@ var LedgerCosmos = class extends __injectivelabs_wallet_base.BaseConcreteStrateg
771
772
  async signArbitrary(signer, data) {
772
773
  try {
773
774
  const { derivationPath } = await this.getWalletForAddress(signer);
774
- return (0, __injectivelabs_sdk_ts.uint8ArrayToBase64)((await (await this.ledger.getInstance()).sign(derivationPath, (0, __injectivelabs_sdk_ts.toUtf8)(data))).signature);
775
+ return (0, __injectivelabs_sdk_ts_utils.uint8ArrayToBase64)((await (await this.ledger.getInstance()).sign(derivationPath, (0, __injectivelabs_sdk_ts_utils.toUtf8)(data))).signature);
775
776
  } catch (e) {
776
777
  throw new __injectivelabs_exceptions.LedgerCosmosException(new Error(e.message), {
777
778
  code: __injectivelabs_exceptions.UnspecifiedErrorCode,
@@ -794,7 +795,7 @@ var LedgerCosmos = class extends __injectivelabs_wallet_base.BaseConcreteStrateg
794
795
  }
795
796
  async getPubKey(address) {
796
797
  if (!address) throw new __injectivelabs_exceptions.WalletException(/* @__PURE__ */ new Error("You can only fetch PubKey corresponding to an address"));
797
- return (0, __injectivelabs_sdk_ts.uint8ArrayToBase64)((0, __injectivelabs_sdk_ts.hexToUint8Array)((await this.getWalletForAddress(address)).publicKey || ""));
798
+ return (0, __injectivelabs_sdk_ts_utils.uint8ArrayToBase64)((0, __injectivelabs_sdk_ts_utils.hexToUint8Array)((await this.getWalletForAddress(address)).publicKey || ""));
798
799
  }
799
800
  async getWalletForAddress(address) {
800
801
  try {
@@ -1,6 +1,7 @@
1
1
  import { BaseConcreteStrategy, ConcreteEvmWalletStrategyArgs, ConcreteWalletStrategy, Eip1193Provider, SendTransactionOptions, StdSignDoc, WalletDeviceType } from "@injectivelabs/wallet-base";
2
2
  import { AccountAddress, ChainId, EvmChainId } from "@injectivelabs/ts-types";
3
- import { AminoSignResponse, DirectSignResponse, TxRaw, TxResponse } from "@injectivelabs/sdk-ts";
3
+ import { TxResponse } from "@injectivelabs/sdk-ts/core/tx";
4
+ import { AminoSignResponse, DirectSignResponse, TxRaw } from "@injectivelabs/sdk-ts/types";
4
5
 
5
6
  //#region src/types.d.ts
6
7
  interface HDNodeLike {
@@ -1,6 +1,7 @@
1
- import { AminoSignResponse, DirectSignResponse, TxRaw, TxResponse } from "@injectivelabs/sdk-ts";
1
+ import { TxResponse } from "@injectivelabs/sdk-ts/core/tx";
2
2
  import { BaseConcreteStrategy, ConcreteEvmWalletStrategyArgs, ConcreteWalletStrategy, Eip1193Provider, SendTransactionOptions, StdSignDoc, WalletDeviceType } from "@injectivelabs/wallet-base";
3
3
  import { AccountAddress, ChainId, EvmChainId } from "@injectivelabs/ts-types";
4
+ import { AminoSignResponse, DirectSignResponse, TxRaw } from "@injectivelabs/sdk-ts/types";
4
5
 
5
6
  //#region src/types.d.ts
6
7
  interface HDNodeLike {
package/dist/esm/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { hashDomain, hashStruct, serializeTransaction } from "viem";
2
- import { TxGrpcApi, addHexPrefix, hexToUint8Array, publicKeyToAddress, sortObjectByKeys, stringToUint8Array, toUtf8, uint8ArrayToBase64, uint8ArrayToHex } from "@injectivelabs/sdk-ts";
2
+ import { TxGrpcApi } from "@injectivelabs/sdk-ts/core/tx";
3
+ import { addHexPrefix, hexToUint8Array, publicKeyToAddress, sortObjectByKeys, stringToUint8Array, toUtf8, uint8ArrayToBase64, uint8ArrayToHex } from "@injectivelabs/sdk-ts/utils";
3
4
  import { CosmosWalletException, ErrorType, GeneralException, LedgerCosmosException, LedgerException, TransactionException, UnspecifiedErrorCode, WalletException } from "@injectivelabs/exceptions";
4
5
  import { BaseConcreteStrategy, DEFAULT_ADDRESS_SEARCH_LIMIT, DEFAULT_BASE_DERIVATION_PATH, DEFAULT_NUM_ADDRESSES_TO_FETCH, WalletAction, WalletDeviceType, getEvmChainConfig, getViemPublicClient, getViemWalletClient } from "@injectivelabs/wallet-base";
5
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@injectivelabs/wallet-ledger",
3
- "version": "1.16.38-alpha.1",
3
+ "version": "1.16.38-alpha.3",
4
4
  "description": "Ledger wallet strategy for use with @injectivelabs/wallet-core.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -37,32 +37,17 @@
37
37
  "files": [
38
38
  "dist"
39
39
  ],
40
- "scripts": {
41
- "build": "pnpm type-check && tsdown",
42
- "build:fast": "tsdown",
43
- "build:watch": "tsdown --watch",
44
- "clean": "shx rm -rf dist coverage *.log junit.xml && shx mkdir -p dist",
45
- "type-check": "tsc --noEmit",
46
- "test": "vitest",
47
- "test:watch": "vitest --watch",
48
- "test:ci": "vitest run --coverage --reporter=verbose",
49
- "coverage": "vitest run --coverage",
50
- "coverage:show": "live-server coverage",
51
- "dev": "ts-node -r tsconfig-paths/register src/index.ts",
52
- "start": "node dist/index.js",
53
- "lint": "eslint . --ext .ts,.js"
54
- },
55
40
  "dependencies": {
56
41
  "@bangjelkoski/ledgerhq-hw-app-cosmos": "6.30.4-beta.0",
57
42
  "@bangjelkoski/ledgerhq-hw-app-eth": "6.42.6-beta.0",
58
43
  "@bangjelkoski/ledgerhq-hw-transport": "6.31.4-beta.0",
59
44
  "@bangjelkoski/ledgerhq-hw-transport-webhid": "6.30.0-beta.0",
60
45
  "@bangjelkoski/ledgerhq-hw-transport-webusb": "6.29.4-beta.0",
61
- "@injectivelabs/exceptions": "1.16.38-alpha.0",
62
- "@injectivelabs/sdk-ts": "1.16.38-alpha.1",
63
- "@injectivelabs/ts-types": "1.16.38-alpha.0",
64
- "@injectivelabs/wallet-base": "1.16.38-alpha.1",
65
- "viem": "catalog:"
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"
66
51
  },
67
52
  "devDependencies": {
68
53
  "@types/ledgerhq__hw-transport-webusb": "^4.70.1"
@@ -73,5 +58,19 @@
73
58
  "_moduleAliases": {
74
59
  "~wallet-ledger": "dist"
75
60
  },
76
- "gitHead": "35dab975c20dbf43d52a85fb161cf810c46d8f6f"
77
- }
61
+ "scripts": {
62
+ "build": "pnpm type-check && tsdown",
63
+ "build:fast": "tsdown",
64
+ "build:watch": "tsdown --watch",
65
+ "clean": "shx rm -rf dist coverage *.log junit.xml && shx mkdir -p dist",
66
+ "type-check": "tsc --noEmit",
67
+ "test": "vitest",
68
+ "test:watch": "vitest --watch",
69
+ "test:ci": "vitest run --coverage --reporter=verbose",
70
+ "coverage": "vitest run --coverage",
71
+ "coverage:show": "live-server coverage",
72
+ "dev": "ts-node -r tsconfig-paths/register src/index.ts",
73
+ "start": "node dist/index.js",
74
+ "lint": "eslint . --ext .ts,.js"
75
+ }
76
+ }