@injectivelabs/wallet-private-key 1.16.38-alpha.2 → 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,6 +1,8 @@
1
- let __injectivelabs_sdk_ts = require("@injectivelabs/sdk-ts");
2
1
  let __injectivelabs_ts_types = require("@injectivelabs/ts-types");
2
+ let __injectivelabs_sdk_ts_core_accounts = require("@injectivelabs/sdk-ts/core/accounts");
3
+ let __injectivelabs_sdk_ts_core_tx = require("@injectivelabs/sdk-ts/core/tx");
3
4
  let __injectivelabs_wallet_base = require("@injectivelabs/wallet-base");
5
+ let __injectivelabs_sdk_ts_utils = require("@injectivelabs/sdk-ts/utils");
4
6
  let __injectivelabs_exceptions = require("@injectivelabs/exceptions");
5
7
 
6
8
  //#region \0@oxc-project+runtime@0.98.0/helpers/typeof.js
@@ -73,7 +75,7 @@ var PrivateKeyWallet = class extends __injectivelabs_wallet_base.BaseConcreteStr
73
75
  }
74
76
  }
75
77
  async getSessionOrConfirm(address) {
76
- return Promise.resolve(`0x${(0, __injectivelabs_sdk_ts.uint8ArrayToHex)((0, __injectivelabs_sdk_ts.stringToUint8Array)(`Confirmation for ${address} at time: ${Date.now()}`))}`);
78
+ return Promise.resolve(`0x${(0, __injectivelabs_sdk_ts_utils.uint8ArrayToHex)((0, __injectivelabs_sdk_ts_utils.stringToUint8Array)(`Confirmation for ${address} at time: ${Date.now()}`))}`);
77
79
  }
78
80
  async sendEvmTransaction(_transaction, _options) {
79
81
  throw new __injectivelabs_exceptions.WalletException(/* @__PURE__ */ new Error("This wallet does not support sending Evm transactions"), {
@@ -85,7 +87,7 @@ var PrivateKeyWallet = class extends __injectivelabs_wallet_base.BaseConcreteStr
85
87
  async sendTransaction(transaction, options) {
86
88
  const { endpoints, txTimeout } = options;
87
89
  if (!endpoints) throw new __injectivelabs_exceptions.WalletException(/* @__PURE__ */ new Error("You have to pass endpoints within the options for using Ethereum native wallets"));
88
- const response = await new __injectivelabs_sdk_ts.TxGrpcApi(endpoints.grpc).broadcast(transaction, { txTimeout });
90
+ const response = await new __injectivelabs_sdk_ts_core_tx.TxGrpcApi(endpoints.grpc).broadcast(transaction, { txTimeout });
89
91
  if (response.code !== 0) throw new __injectivelabs_exceptions.TransactionException(new Error(response.rawLog), {
90
92
  code: __injectivelabs_exceptions.UnspecifiedErrorCode,
91
93
  contextCode: response.code,
@@ -95,13 +97,13 @@ var PrivateKeyWallet = class extends __injectivelabs_wallet_base.BaseConcreteStr
95
97
  }
96
98
  async signEip712TypedData(eip712json, address) {
97
99
  const pk = this.getPrivateKey();
98
- if ((0, __injectivelabs_sdk_ts.getInjectiveSignerAddress)(address) !== pk.toAddress().toBech32()) throw new __injectivelabs_exceptions.WalletException(/* @__PURE__ */ new Error("Signer address does not match the private key address"), {
100
+ if ((0, __injectivelabs_sdk_ts_core_tx.getInjectiveSignerAddress)(address) !== pk.toAddress().toBech32()) throw new __injectivelabs_exceptions.WalletException(/* @__PURE__ */ new Error("Signer address does not match the private key address"), {
99
101
  code: __injectivelabs_exceptions.UnspecifiedErrorCode,
100
102
  type: __injectivelabs_exceptions.ErrorType.WalletError,
101
103
  contextModule: __injectivelabs_wallet_base.WalletAction.SignTransaction
102
104
  });
103
105
  try {
104
- return `0x${(0, __injectivelabs_sdk_ts.uint8ArrayToHex)(await pk.signTypedData(JSON.parse(eip712json)))}`;
106
+ return `0x${(0, __injectivelabs_sdk_ts_utils.uint8ArrayToHex)(await pk.signTypedData(JSON.parse(eip712json)))}`;
105
107
  } catch (e) {
106
108
  throw new __injectivelabs_exceptions.MetamaskException(new Error(e.message), {
107
109
  code: __injectivelabs_exceptions.UnspecifiedErrorCode,
@@ -126,13 +128,13 @@ var PrivateKeyWallet = class extends __injectivelabs_wallet_base.BaseConcreteStr
126
128
  }
127
129
  async signArbitrary(signer, data) {
128
130
  const pk = this.getPrivateKey();
129
- if ((0, __injectivelabs_sdk_ts.getInjectiveSignerAddress)(signer) !== pk.toAddress().toBech32()) throw new __injectivelabs_exceptions.WalletException(/* @__PURE__ */ new Error("Signer address does not match the private key address"), {
131
+ if ((0, __injectivelabs_sdk_ts_core_tx.getInjectiveSignerAddress)(signer) !== pk.toAddress().toBech32()) throw new __injectivelabs_exceptions.WalletException(/* @__PURE__ */ new Error("Signer address does not match the private key address"), {
130
132
  code: __injectivelabs_exceptions.UnspecifiedErrorCode,
131
133
  type: __injectivelabs_exceptions.ErrorType.WalletError,
132
134
  contextModule: __injectivelabs_wallet_base.WalletAction.SignArbitrary
133
135
  });
134
136
  try {
135
- return `0x${(0, __injectivelabs_sdk_ts.uint8ArrayToBase64)(await pk.signHashed((0, __injectivelabs_sdk_ts.stringToUint8Array)((0, __injectivelabs_sdk_ts.toUtf8)(data))))}`;
137
+ return `0x${(0, __injectivelabs_sdk_ts_utils.uint8ArrayToBase64)(await pk.signHashed((0, __injectivelabs_sdk_ts_utils.stringToUint8Array)((0, __injectivelabs_sdk_ts_utils.toUtf8)(data))))}`;
136
138
  } catch (e) {
137
139
  throw new __injectivelabs_exceptions.MetamaskException(new Error(e.message), {
138
140
  code: __injectivelabs_exceptions.UnspecifiedErrorCode,
@@ -168,7 +170,7 @@ var PrivateKeyWallet = class extends __injectivelabs_wallet_base.BaseConcreteStr
168
170
  type: __injectivelabs_exceptions.ErrorType.WalletNotInstalledError,
169
171
  contextModule: __injectivelabs_wallet_base.WalletAction.GetAccounts
170
172
  });
171
- this.privateKey = __injectivelabs_sdk_ts.PrivateKey.fromHex(this.metadata.privateKey.privateKey);
173
+ this.privateKey = __injectivelabs_sdk_ts_core_accounts.PrivateKey.fromHex(this.metadata.privateKey.privateKey);
172
174
  }
173
175
  return this.privateKey;
174
176
  }
@@ -1,6 +1,7 @@
1
1
  import { AccountAddress, EvmChainId } from "@injectivelabs/ts-types";
2
2
  import { BaseConcreteStrategy, ConcreteWalletStrategy, SendTransactionOptions, StdSignDoc, WalletDeviceType } from "@injectivelabs/wallet-base";
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/strategy/strategy.d.ts
6
7
  declare class PrivateKeyWallet extends BaseConcreteStrategy implements ConcreteWalletStrategy {
@@ -1,6 +1,7 @@
1
- import { AminoSignResponse, DirectSignResponse, TxRaw, TxResponse } from "@injectivelabs/sdk-ts";
2
1
  import { AccountAddress, EvmChainId } from "@injectivelabs/ts-types";
2
+ import { TxResponse } from "@injectivelabs/sdk-ts/core/tx";
3
3
  import { BaseConcreteStrategy, ConcreteWalletStrategy, SendTransactionOptions, StdSignDoc, WalletDeviceType } from "@injectivelabs/wallet-base";
4
+ import { AminoSignResponse, DirectSignResponse, TxRaw } from "@injectivelabs/sdk-ts/types";
4
5
 
5
6
  //#region src/strategy/strategy.d.ts
6
7
  declare class PrivateKeyWallet extends BaseConcreteStrategy implements ConcreteWalletStrategy {
package/dist/esm/index.js CHANGED
@@ -1,6 +1,8 @@
1
- import { PrivateKey, TxGrpcApi, getInjectiveSignerAddress, stringToUint8Array, toUtf8, uint8ArrayToBase64, uint8ArrayToHex } from "@injectivelabs/sdk-ts";
2
1
  import { ChainId, EvmChainId } from "@injectivelabs/ts-types";
2
+ import { PrivateKey } from "@injectivelabs/sdk-ts/core/accounts";
3
+ import { TxGrpcApi, getInjectiveSignerAddress } from "@injectivelabs/sdk-ts/core/tx";
3
4
  import { BaseConcreteStrategy, WalletAction, WalletDeviceType } from "@injectivelabs/wallet-base";
5
+ import { stringToUint8Array, toUtf8, uint8ArrayToBase64, uint8ArrayToHex } from "@injectivelabs/sdk-ts/utils";
4
6
  import { ErrorType, MetamaskException, TransactionException, UnspecifiedErrorCode, WalletException } from "@injectivelabs/exceptions";
5
7
 
6
8
  //#region \0@oxc-project+runtime@0.98.0/helpers/typeof.js
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@injectivelabs/wallet-private-key",
3
- "version": "1.16.38-alpha.2",
3
+ "version": "1.16.38-alpha.3",
4
4
  "description": "Private key wallet strategy for use with @injectivelabs/wallet-core.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -38,10 +38,10 @@
38
38
  "dist"
39
39
  ],
40
40
  "dependencies": {
41
- "@injectivelabs/exceptions": "1.16.38-alpha.1",
42
- "@injectivelabs/sdk-ts": "1.16.38-alpha.2",
41
+ "@injectivelabs/exceptions": "1.16.38-alpha.2",
42
+ "@injectivelabs/sdk-ts": "1.16.38-alpha.3",
43
43
  "@injectivelabs/ts-types": "1.16.38-alpha.1",
44
- "@injectivelabs/wallet-base": "1.16.38-alpha.2"
44
+ "@injectivelabs/wallet-base": "1.16.38-alpha.3"
45
45
  },
46
46
  "publishConfig": {
47
47
  "access": "public"