@injectivelabs/wallet-core 1.16.10 → 1.16.11-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,9 @@
1
1
  import { TxRaw, TxResponse, AminoSignResponse, DirectSignResponse } from '@injectivelabs/sdk-ts';
2
- import { Wallet, WalletDeviceType, type WalletMetadata, ConcreteStrategiesArg, SendTransactionOptions, ConcreteWalletStrategy, onAccountChangeCallback, onChainIdChangeCallback, WalletStrategyArguments, CosmosWalletAbstraction, WalletStrategy as WalletStrategyInterface } from '@injectivelabs/wallet-base';
2
+ import { Wallet, WalletDeviceType, type WalletMetadata, ConcreteStrategiesArg, SendTransactionOptions, ConcreteWalletStrategy, onAccountChangeCallback, onChainIdChangeCallback, WalletStrategyArguments, CosmosWalletAbstraction, WalletStrategy as WalletStrategyInterface, Eip1193Provider } from '@injectivelabs/wallet-base';
3
3
  import { ChainId, EvmChainId, AccountAddress } from '@injectivelabs/ts-types';
4
4
  import { StdSignDoc } from '@keplr-wallet/types';
5
5
  import { WalletStrategyEmitter } from '../broadcaster/types.js';
6
+ import { OfflineSigner } from '@cosmjs/proto-signing';
6
7
  export default class BaseWalletStrategy implements WalletStrategyInterface {
7
8
  strategies: ConcreteStrategiesArg;
8
9
  wallet: Wallet;
@@ -48,4 +49,6 @@ export default class BaseWalletStrategy implements WalletStrategyInterface {
48
49
  onChainIdChange(callback: onChainIdChangeCallback): Promise<void>;
49
50
  disconnect(): Promise<void>;
50
51
  getCosmosWallet(chainId: ChainId): CosmosWalletAbstraction;
52
+ getEip1193Provider(): Promise<Eip1193Provider>;
53
+ getOfflineSigner(chainId: string): Promise<OfflineSigner>;
51
54
  }
@@ -160,5 +160,17 @@ class BaseWalletStrategy {
160
160
  }
161
161
  return strategy.getCosmosWallet(chainId);
162
162
  }
163
+ async getEip1193Provider() {
164
+ if (this.getStrategy().getEip1193Provider) {
165
+ return this.getStrategy().getEip1193Provider();
166
+ }
167
+ throw new exceptions_1.WalletException(new Error('EIP1193 provider not found. Please check your wallet strategy.'));
168
+ }
169
+ async getOfflineSigner(chainId) {
170
+ if (this.getStrategy().getOfflineSigner) {
171
+ return this.getStrategy().getOfflineSigner(chainId);
172
+ }
173
+ throw new exceptions_1.WalletException(new Error('Offline signer not found. Please check your wallet strategy.'));
174
+ }
163
175
  }
164
176
  exports.default = BaseWalletStrategy;
@@ -1,8 +1,9 @@
1
1
  import { TxRaw, TxResponse, AminoSignResponse, DirectSignResponse } from '@injectivelabs/sdk-ts';
2
- import { Wallet, WalletDeviceType, type WalletMetadata, ConcreteStrategiesArg, SendTransactionOptions, ConcreteWalletStrategy, onAccountChangeCallback, onChainIdChangeCallback, WalletStrategyArguments, CosmosWalletAbstraction, WalletStrategy as WalletStrategyInterface } from '@injectivelabs/wallet-base';
2
+ import { Wallet, WalletDeviceType, type WalletMetadata, ConcreteStrategiesArg, SendTransactionOptions, ConcreteWalletStrategy, onAccountChangeCallback, onChainIdChangeCallback, WalletStrategyArguments, CosmosWalletAbstraction, WalletStrategy as WalletStrategyInterface, Eip1193Provider } from '@injectivelabs/wallet-base';
3
3
  import { ChainId, EvmChainId, AccountAddress } from '@injectivelabs/ts-types';
4
4
  import { StdSignDoc } from '@keplr-wallet/types';
5
5
  import { WalletStrategyEmitter } from '../broadcaster/types.js';
6
+ import { OfflineSigner } from '@cosmjs/proto-signing';
6
7
  export default class BaseWalletStrategy implements WalletStrategyInterface {
7
8
  strategies: ConcreteStrategiesArg;
8
9
  wallet: Wallet;
@@ -48,4 +49,6 @@ export default class BaseWalletStrategy implements WalletStrategyInterface {
48
49
  onChainIdChange(callback: onChainIdChangeCallback): Promise<void>;
49
50
  disconnect(): Promise<void>;
50
51
  getCosmosWallet(chainId: ChainId): CosmosWalletAbstraction;
52
+ getEip1193Provider(): Promise<Eip1193Provider>;
53
+ getOfflineSigner(chainId: string): Promise<OfflineSigner>;
51
54
  }
@@ -158,4 +158,16 @@ export default class BaseWalletStrategy {
158
158
  }
159
159
  return strategy.getCosmosWallet(chainId);
160
160
  }
161
+ async getEip1193Provider() {
162
+ if (this.getStrategy().getEip1193Provider) {
163
+ return this.getStrategy().getEip1193Provider();
164
+ }
165
+ throw new WalletException(new Error('EIP1193 provider not found. Please check your wallet strategy.'));
166
+ }
167
+ async getOfflineSigner(chainId) {
168
+ if (this.getStrategy().getOfflineSigner) {
169
+ return this.getStrategy().getOfflineSigner(chainId);
170
+ }
171
+ throw new WalletException(new Error('Offline signer not found. Please check your wallet strategy.'));
172
+ }
161
173
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@injectivelabs/wallet-core",
3
3
  "description": "Core wallet strategy",
4
- "version": "1.16.10",
4
+ "version": "1.16.11-alpha.0",
5
5
  "sideEffects": false,
6
6
  "type": "module",
7
7
  "author": {
@@ -56,17 +56,17 @@
56
56
  "start": "node dist/index.js"
57
57
  },
58
58
  "dependencies": {
59
- "@injectivelabs/exceptions": "1.16.10",
60
- "@injectivelabs/networks": "1.16.10",
61
- "@injectivelabs/sdk-ts": "1.16.10",
62
- "@injectivelabs/ts-types": "1.16.10",
63
- "@injectivelabs/utils": "1.16.10",
64
- "@injectivelabs/wallet-base": "1.16.10",
59
+ "@injectivelabs/exceptions": "1.16.11-alpha.0",
60
+ "@injectivelabs/networks": "1.16.11-alpha.0",
61
+ "@injectivelabs/sdk-ts": "1.16.11-alpha.0",
62
+ "@injectivelabs/ts-types": "1.16.11-alpha.0",
63
+ "@injectivelabs/utils": "1.16.11-alpha.0",
64
+ "@injectivelabs/wallet-base": "1.16.11-alpha.0",
65
65
  "@keplr-wallet/types": "^0.12.159",
66
66
  "eventemitter3": "^5.0.1"
67
67
  },
68
68
  "devDependencies": {
69
69
  "shx": "^0.3.3"
70
70
  },
71
- "gitHead": "77a3be1fe388487b0fd4bdc9b2d9179ccff164d3"
71
+ "gitHead": "640edf06e57aa38d3176e38fa03dddfc72e901cf"
72
72
  }