@injectivelabs/wallet-cosmostation 1.16.12 → 1.16.13-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.
@@ -1,8 +1,10 @@
1
- import { TxResponse, AminoSignResponse, DirectSignResponse } from '@injectivelabs/sdk-ts';
2
- import { ChainId, EvmChainId, CosmosChainId, AccountAddress } from '@injectivelabs/ts-types';
3
- import { StdSignDoc, WalletDeviceType, BaseConcreteStrategy, ConcreteWalletStrategy } from '@injectivelabs/wallet-base';
1
+ import { CosmosChainId } from '@injectivelabs/ts-types';
4
2
  import { CosmosTxV1Beta1Tx } from '@injectivelabs/sdk-ts';
5
- import { OfflineSigner } from '@cosmjs/proto-signing';
3
+ import { WalletDeviceType, BaseConcreteStrategy } from '@injectivelabs/wallet-base';
4
+ import type { OfflineSigner } from '@cosmjs/proto-signing';
5
+ import type { ChainId, EvmChainId, AccountAddress } from '@injectivelabs/ts-types';
6
+ import type { StdSignDoc, ConcreteWalletStrategy } from '@injectivelabs/wallet-base';
7
+ import type { TxResponse, AminoSignResponse, DirectSignResponse } from '@injectivelabs/sdk-ts';
6
8
  export declare class Cosmostation extends BaseConcreteStrategy implements ConcreteWalletStrategy {
7
9
  private cosmostationWallet?;
8
10
  chainName: string;
@@ -1,17 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Cosmostation = void 0;
4
- /* eslint-disable class-methods-use-this */
5
- const sdk_ts_1 = require("@injectivelabs/sdk-ts");
4
+ const proto_signing_1 = require("@cosmjs/proto-signing");
6
5
  const ts_types_1 = require("@injectivelabs/ts-types");
7
- const exceptions_1 = require("@injectivelabs/exceptions");
8
- const wallet_base_1 = require("@injectivelabs/wallet-base");
9
- const sdk_ts_2 = require("@injectivelabs/sdk-ts");
6
+ const sdk_ts_1 = require("@injectivelabs/sdk-ts");
10
7
  const extension_client_1 = require("@cosmostation/extension-client");
11
- const proto_signing_1 = require("@cosmjs/proto-signing");
8
+ const cosmos_client_1 = require("@cosmostation/cosmos-client");
12
9
  const cosmos_js_1 = require("@cosmostation/extension-client/cosmos.js");
10
+ const sdk_ts_2 = require("@injectivelabs/sdk-ts");
11
+ const exceptions_1 = require("@injectivelabs/exceptions");
12
+ const wallet_base_1 = require("@injectivelabs/wallet-base");
13
13
  const wallet_js_1 = require("./../wallet.js");
14
- const cosmos_client_1 = require("@cosmostation/cosmos-client");
15
14
  const getChainNameFromChainId = (chainId) => {
16
15
  const [chainName] = chainId.split('-');
17
16
  if (chainName.includes('cosmoshub')) {
@@ -64,7 +63,6 @@ class Cosmostation extends wallet_base_1.BaseConcreteStrategy {
64
63
  async getSessionOrConfirm(address) {
65
64
  return Promise.resolve(`0x${Buffer.from(`Confirmation for ${address} at time: ${Date.now()}`).toString('hex')}`);
66
65
  }
67
- // eslint-disable-next-line class-methods-use-this
68
66
  async sendEvmTransaction(_transaction, _options) {
69
67
  throw new exceptions_1.CosmosWalletException(new Error('sendEvmTransaction is not supported. Cosmostation only supports sending cosmos transactions'), {
70
68
  code: exceptions_1.UnspecifiedErrorCode,
@@ -73,9 +71,9 @@ class Cosmostation extends wallet_base_1.BaseConcreteStrategy {
73
71
  }
74
72
  async sendTransaction(transaction, _options) {
75
73
  const cosmostationWallet = await this.getCosmostationWallet();
76
- const txRaw = (0, sdk_ts_1.createTxRawFromSigResponse)(transaction);
74
+ const txRaw = (0, sdk_ts_2.createTxRawFromSigResponse)(transaction);
77
75
  try {
78
- const response = await cosmostationWallet.sendTransaction(this.chainName, sdk_ts_2.CosmosTxV1Beta1Tx.TxRaw.encode(txRaw).finish(), cosmos_js_1.SEND_TRANSACTION_MODE.SYNC);
76
+ const response = await cosmostationWallet.sendTransaction(this.chainName, sdk_ts_1.CosmosTxV1Beta1Tx.TxRaw.encode(txRaw).finish(), cosmos_js_1.SEND_TRANSACTION_MODE.SYNC);
79
77
  return {
80
78
  ...response.tx_response,
81
79
  gasUsed: parseInt((response.tx_response.gas_used || '0'), 10),
@@ -104,7 +102,7 @@ class Cosmostation extends wallet_base_1.BaseConcreteStrategy {
104
102
  async signCosmosTransaction(transaction) {
105
103
  const { chainId } = this;
106
104
  const cosmostationWallet = await this.getCosmostationWallet();
107
- const signDoc = (0, sdk_ts_1.createSignDocFromTransaction)(transaction);
105
+ const signDoc = (0, sdk_ts_2.createSignDocFromTransaction)(transaction);
108
106
  try {
109
107
  /* Sign the transaction */
110
108
  const signDirectResponse = await cosmostationWallet.signDirect(this.chainName, {
@@ -155,7 +153,7 @@ class Cosmostation extends wallet_base_1.BaseConcreteStrategy {
155
153
  async signArbitrary(signer, data) {
156
154
  try {
157
155
  const cosmostationWallet = await this.getCosmostationWallet();
158
- const signature = await cosmostationWallet.signMessage(this.chainName, signer, (0, sdk_ts_1.toUtf8)(data));
156
+ const signature = await cosmostationWallet.signMessage(this.chainName, signer, (0, sdk_ts_2.toUtf8)(data));
159
157
  return signature.signature;
160
158
  }
161
159
  catch (e) {
@@ -1,4 +1,4 @@
1
- import { ChainId, CosmosChainId, TestnetCosmosChainId } from '@injectivelabs/ts-types';
1
+ import type { ChainId, CosmosChainId, TestnetCosmosChainId } from '@injectivelabs/ts-types';
2
2
  export declare class CosmostationWallet {
3
3
  private chainId;
4
4
  constructor(chainId: CosmosChainId | TestnetCosmosChainId | ChainId);
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CosmostationWallet = void 0;
4
- const exceptions_1 = require("@injectivelabs/exceptions");
5
4
  const extension_client_1 = require("@cosmostation/extension-client");
5
+ const exceptions_1 = require("@injectivelabs/exceptions");
6
6
  class CosmostationWallet {
7
7
  chainId;
8
8
  constructor(chainId) {
@@ -19,7 +19,7 @@ class CosmostationWallet {
19
19
  const supportedChainIds = await provider.getSupportedChainIds();
20
20
  return !!supportedChainIds.official.find((chainId) => chainId === actualChainId);
21
21
  }
22
- catch (e) {
22
+ catch {
23
23
  throw new exceptions_1.CosmosWalletException(new Error(`Cosmostation doesn't support ${chainName[0] || actualChainId} network. Please use another Cosmos wallet`));
24
24
  }
25
25
  }
@@ -1,8 +1,10 @@
1
- import { TxResponse, AminoSignResponse, DirectSignResponse } from '@injectivelabs/sdk-ts';
2
- import { ChainId, EvmChainId, CosmosChainId, AccountAddress } from '@injectivelabs/ts-types';
3
- import { StdSignDoc, WalletDeviceType, BaseConcreteStrategy, ConcreteWalletStrategy } from '@injectivelabs/wallet-base';
1
+ import { CosmosChainId } from '@injectivelabs/ts-types';
4
2
  import { CosmosTxV1Beta1Tx } from '@injectivelabs/sdk-ts';
5
- import { OfflineSigner } from '@cosmjs/proto-signing';
3
+ import { WalletDeviceType, BaseConcreteStrategy } from '@injectivelabs/wallet-base';
4
+ import type { OfflineSigner } from '@cosmjs/proto-signing';
5
+ import type { ChainId, EvmChainId, AccountAddress } from '@injectivelabs/ts-types';
6
+ import type { StdSignDoc, ConcreteWalletStrategy } from '@injectivelabs/wallet-base';
7
+ import type { TxResponse, AminoSignResponse, DirectSignResponse } from '@injectivelabs/sdk-ts';
6
8
  export declare class Cosmostation extends BaseConcreteStrategy implements ConcreteWalletStrategy {
7
9
  private cosmostationWallet?;
8
10
  chainName: string;
@@ -1,14 +1,13 @@
1
- /* eslint-disable class-methods-use-this */
2
- import { toUtf8, createTxRawFromSigResponse, createSignDocFromTransaction, } from '@injectivelabs/sdk-ts';
3
- import { CosmosChainId, } from '@injectivelabs/ts-types';
4
- import { ErrorType, UnspecifiedErrorCode, CosmosWalletException, TransactionException, } from '@injectivelabs/exceptions';
5
- import { WalletAction, WalletDeviceType, BaseConcreteStrategy, } from '@injectivelabs/wallet-base';
1
+ import { makeSignDoc } from '@cosmjs/proto-signing';
2
+ import { CosmosChainId } from '@injectivelabs/ts-types';
6
3
  import { CosmosTxV1Beta1Tx } from '@injectivelabs/sdk-ts';
7
4
  import { InstallError } from '@cosmostation/extension-client';
8
- import { makeSignDoc } from '@cosmjs/proto-signing';
5
+ import { getOfflineSigner } from '@cosmostation/cosmos-client';
9
6
  import { SEND_TRANSACTION_MODE } from '@cosmostation/extension-client/cosmos.js';
7
+ import { toUtf8, createTxRawFromSigResponse, createSignDocFromTransaction, } from '@injectivelabs/sdk-ts';
8
+ import { ErrorType, UnspecifiedErrorCode, CosmosWalletException, TransactionException, } from '@injectivelabs/exceptions';
9
+ import { WalletAction, WalletDeviceType, BaseConcreteStrategy, } from '@injectivelabs/wallet-base';
10
10
  import { CosmostationWallet } from './../wallet.js';
11
- import { getOfflineSigner } from '@cosmostation/cosmos-client';
12
11
  const getChainNameFromChainId = (chainId) => {
13
12
  const [chainName] = chainId.split('-');
14
13
  if (chainName.includes('cosmoshub')) {
@@ -61,7 +60,6 @@ export class Cosmostation extends BaseConcreteStrategy {
61
60
  async getSessionOrConfirm(address) {
62
61
  return Promise.resolve(`0x${Buffer.from(`Confirmation for ${address} at time: ${Date.now()}`).toString('hex')}`);
63
62
  }
64
- // eslint-disable-next-line class-methods-use-this
65
63
  async sendEvmTransaction(_transaction, _options) {
66
64
  throw new CosmosWalletException(new Error('sendEvmTransaction is not supported. Cosmostation only supports sending cosmos transactions'), {
67
65
  code: UnspecifiedErrorCode,
@@ -1,4 +1,4 @@
1
- import { ChainId, CosmosChainId, TestnetCosmosChainId } from '@injectivelabs/ts-types';
1
+ import type { ChainId, CosmosChainId, TestnetCosmosChainId } from '@injectivelabs/ts-types';
2
2
  export declare class CosmostationWallet {
3
3
  private chainId;
4
4
  constructor(chainId: CosmosChainId | TestnetCosmosChainId | ChainId);
@@ -1,5 +1,5 @@
1
- import { ErrorType, UnspecifiedErrorCode, CosmosWalletException, } from '@injectivelabs/exceptions';
2
1
  import { cosmos, InstallError } from '@cosmostation/extension-client';
2
+ import { ErrorType, UnspecifiedErrorCode, CosmosWalletException, } from '@injectivelabs/exceptions';
3
3
  export class CosmostationWallet {
4
4
  chainId;
5
5
  constructor(chainId) {
@@ -16,7 +16,7 @@ export class CosmostationWallet {
16
16
  const supportedChainIds = await provider.getSupportedChainIds();
17
17
  return !!supportedChainIds.official.find((chainId) => chainId === actualChainId);
18
18
  }
19
- catch (e) {
19
+ catch {
20
20
  throw new CosmosWalletException(new Error(`Cosmostation doesn't support ${chainName[0] || actualChainId} network. Please use another Cosmos wallet`));
21
21
  }
22
22
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@injectivelabs/wallet-cosmostation",
3
3
  "description": "Cosmostation strategy for use with @injectivelabs/wallet-core.",
4
- "version": "1.16.12",
4
+ "version": "1.16.13-alpha.0",
5
5
  "sideEffects": false,
6
6
  "type": "module",
7
7
  "author": {
@@ -59,17 +59,17 @@
59
59
  "@cosmjs/proto-signing": "^0.32.3",
60
60
  "@cosmostation/cosmos-client": "^0.0.5",
61
61
  "@cosmostation/extension-client": "^0.1.15",
62
- "@injectivelabs/exceptions": "1.16.12",
63
- "@injectivelabs/sdk-ts": "1.16.12",
64
- "@injectivelabs/ts-types": "1.16.12",
65
- "@injectivelabs/utils": "1.16.12",
66
- "@injectivelabs/wallet-base": "1.16.12",
62
+ "@injectivelabs/exceptions": "1.16.13-alpha.0",
63
+ "@injectivelabs/sdk-ts": "1.16.13-alpha.0",
64
+ "@injectivelabs/ts-types": "1.16.13-alpha.0",
65
+ "@injectivelabs/utils": "1.16.13-alpha.0",
66
+ "@injectivelabs/wallet-base": "1.16.13-alpha.0",
67
67
  "@walletconnect/ethereum-provider": "2.18.1"
68
68
  },
69
69
  "devDependencies": {
70
70
  "shx": "^0.3.4"
71
71
  },
72
- "gitHead": "11a4cd78ffb176786df6c4aff98476f90f0b354b",
72
+ "gitHead": "bb71ac9147c0a2f0946ea0c316caf094fbbe2f2c",
73
73
  "typedoc": {
74
74
  "entryPoint": "./src/index.ts",
75
75
  "readmeFile": "./README.md",