@injectivelabs/wallet-base 1.20.15 → 1.20.17

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.
@@ -0,0 +1,175 @@
1
+ import { C as onAccountChangeCallback, S as WalletStrategyEvmOptions, _ as TurnkeySession, a as ConcreteWalletStrategy, b as WalletStrategy, c as Eip1193Provider, d as SendTransactionOptions, i as ConcreteStrategiesArg, l as MagicMetadata, m as TurnkeyMetadata, n as ConcreteCosmosWalletStrategyArgs, o as ConcreteWalletStrategyArgs, p as StrategyEmitter, r as ConcreteEvmWalletStrategyArgs, s as CosmosWalletAbstraction, t as ConcreteCosmosWalletStrategy, u as PrivateKeyMetadata, v as WalletConnectMetadata, w as onChainIdChangeCallback, x as WalletStrategyArguments, y as WalletMetadata } from "./strategy-CjnVi-ci.cjs";
2
+
3
+ //#region src/runtime-light.d.ts
4
+ declare const BroadcastMode: {
5
+ readonly Block: "block";
6
+ readonly Sync: "sync";
7
+ readonly Async: "async";
8
+ };
9
+ type BroadcastMode = (typeof BroadcastMode)[keyof typeof BroadcastMode];
10
+ declare const Wallet: {
11
+ readonly Leap: "leap";
12
+ readonly Keplr: "keplr";
13
+ readonly Ninji: "ninji";
14
+ readonly Magic: "magic";
15
+ readonly Rabby: "rabby";
16
+ readonly Ledger: "ledger";
17
+ readonly BitGet: "BitGet";
18
+ readonly OWallet: "owallet";
19
+ readonly Phantom: "phantom";
20
+ readonly Rainbow: "rainbow";
21
+ readonly Turnkey: "turnkey";
22
+ readonly Metamask: "metamask";
23
+ readonly KeplrEvm: "keplr-evm";
24
+ readonly OkxWallet: "okx-wallet";
25
+ readonly PrivateKey: "private-key";
26
+ readonly TrustWallet: "trust-wallet";
27
+ readonly TrezorBip32: "trezor-bip32";
28
+ readonly TrezorBip44: "trezor-bip44";
29
+ readonly Cosmostation: "cosmostation";
30
+ readonly LedgerCosmos: "ledger-cosmos";
31
+ readonly LedgerLegacy: "ledger-legacy";
32
+ readonly WalletConnect: "wallet-connect";
33
+ readonly CosmostationEth: "cosmostation-eth";
34
+ readonly PrivateKeyCosmos: "private-key-cosmos";
35
+ };
36
+ type Wallet = (typeof Wallet)[keyof typeof Wallet];
37
+ declare const MagicProvider: {
38
+ readonly Email: "email";
39
+ readonly Apple: "apple";
40
+ readonly Github: "github";
41
+ readonly Google: "google";
42
+ readonly Discord: "discord";
43
+ readonly Twitter: "twitter";
44
+ readonly Facebook: "facebook";
45
+ };
46
+ type MagicProvider = (typeof MagicProvider)[keyof typeof MagicProvider];
47
+ declare const WalletDeviceType: {
48
+ readonly Mobile: "mobile";
49
+ readonly Other: "other";
50
+ readonly Browser: "browser";
51
+ readonly Hardware: "hardware";
52
+ };
53
+ type WalletDeviceType = (typeof WalletDeviceType)[keyof typeof WalletDeviceType];
54
+ declare const WalletEventListener: {
55
+ readonly AccountChange: "account-change";
56
+ readonly ChainIdChange: "chain-id-change";
57
+ };
58
+ type WalletEventListener = (typeof WalletEventListener)[keyof typeof WalletEventListener];
59
+ declare const EvmWalletProviderErrorCode: {
60
+ readonly InternalError: -32603;
61
+ readonly UserRejectedRequest: 4001;
62
+ readonly UnrecognizedChain: 4902;
63
+ };
64
+ type EvmWalletProviderErrorCode = (typeof EvmWalletProviderErrorCode)[keyof typeof EvmWalletProviderErrorCode];
65
+ declare const WalletAction: {
66
+ readonly GetChainId: "get-chain-id";
67
+ readonly GetAccounts: "get-accounts";
68
+ readonly GetNetworkId: "get-network-id";
69
+ readonly SignArbitrary: "sign-arbitrary";
70
+ readonly SignTransaction: "sign-transaction";
71
+ readonly SendTransaction: "send-transaction";
72
+ readonly SendEvmTransaction: "send-evm-transaction";
73
+ readonly SignEvmTransaction: "sign-evm-transaction";
74
+ readonly GetEvmTransactionReceipt: "get-evm-transaction-receipt";
75
+ };
76
+ type WalletAction = (typeof WalletAction)[keyof typeof WalletAction];
77
+ declare const DEFAULT_BASE_DERIVATION_PATH = "m/44'/60'";
78
+ declare const DEFAULT_NUM_ADDRESSES_TO_FETCH = 5;
79
+ declare const DEFAULT_ADDRESS_SEARCH_LIMIT = 100;
80
+ declare const TurnkeyProvider: {
81
+ readonly Sms: "sms";
82
+ readonly Apple: "apple";
83
+ readonly Email: "email";
84
+ readonly Google: "google";
85
+ readonly Twitter: "twitter";
86
+ };
87
+ type TurnkeyProvider = (typeof TurnkeyProvider)[keyof typeof TurnkeyProvider];
88
+ type TurnkeyOAuthProvider = typeof TurnkeyProvider.Apple | typeof TurnkeyProvider.Google | typeof TurnkeyProvider.Twitter;
89
+ declare const StrategyEventType: {
90
+ readonly ConnectionEnd: "connection-end";
91
+ readonly ConnectionStart: "connection-start";
92
+ readonly WalletSigningEnd: "wallet-signing-end";
93
+ readonly WalletSigningStart: "wallet-signing-start";
94
+ };
95
+ declare const WalletConnectStrategyEventType: {
96
+ readonly WalletConnectSigningWithTxTimeout: "signing-with-tx-timeout";
97
+ };
98
+ declare const WalletStrategyEmitterEventType: {
99
+ readonly TransactionFail: "transaction-fail";
100
+ readonly TransactionSigned: "transaction-signed";
101
+ readonly TransactionSignStart: "transaction-sign-start";
102
+ readonly TransactionBroadcastEnd: "transaction-broadcast-end";
103
+ readonly TransactionBroadcastStart: "transaction-broadcast-start";
104
+ readonly TransactionBroadcastSynced: "transaction-broadcast-synced";
105
+ readonly TransactionPreparationEnd: "transaction-preparation-end";
106
+ readonly TransactionPreparationStart: "transaction-preparation-start";
107
+ readonly WalletStrategyDisconnect: "wallet-strategy-disconnect";
108
+ };
109
+ type StrategyEventType = (typeof StrategyEventType)[keyof typeof StrategyEventType] | (typeof WalletConnectStrategyEventType)[keyof typeof WalletConnectStrategyEventType];
110
+ type WalletStrategyEmitterEventType = (typeof WalletStrategyEmitterEventType)[keyof typeof WalletStrategyEmitterEventType] | StrategyEventType;
111
+ type WalletStrategyEmitterEvents = { [K in WalletStrategyEmitterEventType]: Record<string, any> };
112
+ interface WalletStrategyEmitter {
113
+ on(event: WalletStrategyEmitterEventType, listener: (...args: any[]) => void): this;
114
+ off(event: WalletStrategyEmitterEventType, listener: (...args: any[]) => void): this;
115
+ emit(event: WalletStrategyEmitterEventType, ...args: any[]): boolean;
116
+ }
117
+ interface BrowserEip1193Provider {
118
+ removeAllListeners(): void;
119
+ request(args: {
120
+ method: string;
121
+ params?: unknown[];
122
+ }): Promise<unknown>;
123
+ on(event: string, listener: (...args: unknown[]) => void): void;
124
+ removeListener(event: string, listener: (...args: unknown[]) => void): void;
125
+ providers?: BrowserEip1193Provider[];
126
+ isTrust: boolean;
127
+ isKeplr: boolean;
128
+ isRabby: boolean;
129
+ isRainbow: boolean;
130
+ isPhantom: boolean;
131
+ isBitGet?: boolean;
132
+ isBitKeep?: boolean;
133
+ isMetaMask: boolean;
134
+ isOkxWallet: boolean;
135
+ isTrustWallet: boolean;
136
+ }
137
+ type BrowserEip1993Provider = BrowserEip1193Provider;
138
+ interface WindowWithEip1193Provider extends Omit<Window, 'ethereum' | 'keplr'> {
139
+ rainbow: BrowserEip1193Provider;
140
+ rabby: BrowserEip1193Provider;
141
+ ethereum: BrowserEip1193Provider;
142
+ okxwallet: BrowserEip1193Provider;
143
+ providers: BrowserEip1193Provider[];
144
+ trustWallet?: BrowserEip1193Provider;
145
+ bitkeep: {
146
+ ethereum: BrowserEip1193Provider;
147
+ };
148
+ phantom?: {
149
+ ethereum?: BrowserEip1193Provider;
150
+ };
151
+ keplr?: {
152
+ ethereum?: BrowserEip1193Provider;
153
+ };
154
+ }
155
+ interface EIP6963ProviderInfo {
156
+ rdns: string;
157
+ uuid: string;
158
+ name: string;
159
+ icon: string;
160
+ }
161
+ interface EIP6963ProviderDetail {
162
+ info: EIP6963ProviderInfo;
163
+ provider: BrowserEip1193Provider;
164
+ }
165
+ type EIP6963AnnounceProviderEvent = {
166
+ detail: EIP6963ProviderDetail;
167
+ };
168
+ declare const isEvmWallet: (wallet: Wallet) => boolean;
169
+ declare const isCosmosWallet: (wallet: Wallet) => boolean;
170
+ declare const isEvmBrowserWallet: (wallet: Wallet) => boolean;
171
+ declare const isCosmosBrowserWallet: (wallet: Wallet) => boolean;
172
+ declare const isEip712V2OnlyWallet: (wallet: Wallet) => boolean;
173
+ declare const isCosmosAminoOnlyWallet: (wallet: Wallet) => boolean;
174
+ //#endregion
175
+ export { BroadcastMode, BrowserEip1193Provider, BrowserEip1993Provider, type ConcreteCosmosWalletStrategy, type ConcreteCosmosWalletStrategyArgs, type ConcreteEvmWalletStrategyArgs, type ConcreteStrategiesArg, type ConcreteWalletStrategy, type ConcreteWalletStrategyArgs, type CosmosWalletAbstraction, DEFAULT_ADDRESS_SEARCH_LIMIT, DEFAULT_BASE_DERIVATION_PATH, DEFAULT_NUM_ADDRESSES_TO_FETCH, EIP6963AnnounceProviderEvent, EIP6963ProviderDetail, EIP6963ProviderInfo, type Eip1193Provider, EvmWalletProviderErrorCode, type MagicMetadata, MagicProvider, type PrivateKeyMetadata, type SendTransactionOptions, type StrategyEmitter, StrategyEventType, type TurnkeyMetadata, TurnkeyOAuthProvider, TurnkeyProvider, type TurnkeySession, Wallet, WalletAction, type WalletConnectMetadata, WalletConnectStrategyEventType, WalletDeviceType, WalletEventListener, type WalletMetadata, type WalletStrategy, type WalletStrategy as WalletStrategyInterface, type WalletStrategyArguments, WalletStrategyEmitter, WalletStrategyEmitterEventType, WalletStrategyEmitterEvents, type WalletStrategyEvmOptions, WindowWithEip1193Provider, isCosmosAminoOnlyWallet, isCosmosBrowserWallet, isCosmosWallet, isEip712V2OnlyWallet, isEvmBrowserWallet, isEvmWallet, type onAccountChangeCallback, type onChainIdChangeCallback };
@@ -1,9 +1,8 @@
1
1
  import { StdSignDoc } from "@keplr-wallet/types";
2
2
  import { OfflineSigner } from "@cosmjs/proto-signing";
3
- import { AccountAddress, ChainId, CosmosChainId, EvmChainId } from "@injectivelabs/ts-types";
3
+ import { AccountAddress, ChainId, EvmChainId } from "@injectivelabs/ts-types";
4
4
  import { TxClientInclusionOptions, TxResponse } from "@injectivelabs/sdk-ts/core/tx";
5
5
  import { AminoSignResponse, DirectSignResponse, TxRaw } from "@injectivelabs/sdk-ts/types";
6
- import { EIP1193Provider } from "eip1193-provider";
7
6
 
8
7
  //#region src/types/events.d.ts
9
8
  declare const StrategyEventType: {
@@ -98,16 +97,17 @@ declare const EvmWalletProviderErrorCode: {
98
97
  };
99
98
  type EvmWalletProviderErrorCode = (typeof EvmWalletProviderErrorCode)[keyof typeof EvmWalletProviderErrorCode];
100
99
  declare const WalletAction: {
101
- GetChainId: "get-chain-id";
102
- GetAccounts: "get-accounts";
103
- GetNetworkId: "get-network-id";
104
- SignArbitrary: "sign-arbitrary";
105
- SignTransaction: "sign-transaction";
106
- SendTransaction: "send-transaction";
107
- SendEvmTransaction: "send-evm-transaction";
108
- SignEvmTransaction: "sign-evm-transaction";
109
- GetEvmTransactionReceipt: "get-evm-transaction-receipt";
100
+ readonly GetChainId: "get-chain-id";
101
+ readonly GetAccounts: "get-accounts";
102
+ readonly GetNetworkId: "get-network-id";
103
+ readonly SignArbitrary: "sign-arbitrary";
104
+ readonly SignTransaction: "sign-transaction";
105
+ readonly SendTransaction: "send-transaction";
106
+ readonly SendEvmTransaction: "send-evm-transaction";
107
+ readonly SignEvmTransaction: "sign-evm-transaction";
108
+ readonly GetEvmTransactionReceipt: "get-evm-transaction-receipt";
110
109
  };
110
+ type WalletAction = (typeof WalletAction)[keyof typeof WalletAction];
111
111
  //#endregion
112
112
  //#region src/types/strategy.d.ts
113
113
  interface StrategyEmitter {
@@ -400,78 +400,4 @@ interface WalletStrategy {
400
400
  }>;
401
401
  }
402
402
  //#endregion
403
- //#region src/types/provider.d.ts
404
- interface BrowserEip1993Provider extends EIP1193Provider {
405
- removeAllListeners(): void;
406
- providers?: BrowserEip1993Provider[];
407
- isTrust: boolean;
408
- isKeplr: boolean;
409
- isRabby: boolean;
410
- isRainbow: boolean;
411
- isPhantom: boolean;
412
- isBitGet?: boolean;
413
- isBitKeep?: boolean;
414
- isMetaMask: boolean;
415
- isOkxWallet: boolean;
416
- isTrustWallet: boolean;
417
- }
418
- interface WindowWithEip1193Provider extends Omit<Window, 'ethereum' | 'keplr'> {
419
- rainbow: BrowserEip1993Provider;
420
- rabby: BrowserEip1993Provider;
421
- ethereum: BrowserEip1993Provider;
422
- okxwallet: BrowserEip1993Provider;
423
- providers: BrowserEip1993Provider[];
424
- trustWallet?: BrowserEip1993Provider;
425
- bitkeep: {
426
- ethereum: BrowserEip1993Provider;
427
- };
428
- phantom?: {
429
- ethereum?: BrowserEip1993Provider;
430
- };
431
- keplr?: {
432
- ethereum?: BrowserEip1993Provider;
433
- };
434
- }
435
- interface EIP6963ProviderInfo {
436
- rdns: string;
437
- uuid: string;
438
- name: string;
439
- icon: string;
440
- }
441
- interface EIP6963ProviderDetail {
442
- info: EIP6963ProviderInfo;
443
- provider: BrowserEip1993Provider;
444
- }
445
- type EIP6963AnnounceProviderEvent = {
446
- detail: EIP6963ProviderDetail;
447
- };
448
- //#endregion
449
- //#region src/utils/wallet.d.ts
450
- declare const isEvmWallet: (wallet: Wallet) => boolean;
451
- declare const isCosmosWallet: (wallet: Wallet) => boolean;
452
- declare const isEvmBrowserWallet: (wallet: Wallet) => boolean;
453
- declare const isCosmosBrowserWallet: (wallet: Wallet) => boolean;
454
- declare const isEip712V2OnlyWallet: (wallet: Wallet) => boolean;
455
- declare const isCosmosAminoOnlyWallet: (wallet: Wallet) => boolean;
456
- //#endregion
457
- //#region src/base.d.ts
458
- declare abstract class BaseConcreteStrategy {
459
- protected chainId: ChainId | CosmosChainId;
460
- protected evmChainId?: EvmChainId;
461
- protected listeners: Partial<Record<WalletEventListener, any>>;
462
- metadata?: WalletMetadata;
463
- /**
464
- * Optional emitter passed from parent WalletStrategy.
465
- * When provided, strategies emit events directly on the parent's emitter.
466
- */
467
- protected emitter?: StrategyEmitter;
468
- constructor(args: ConcreteWalletStrategyArgs | ConcreteEvmWalletStrategyArgs | ConcreteCosmosWalletStrategyArgs);
469
- setMetadata(metadata?: WalletMetadata): void;
470
- /**
471
- * Emit an event from this strategy.
472
- * If emitter was provided from parent, events go directly to parent.
473
- */
474
- protected emit(event: WalletStrategyEmitterEventType, data?: Record<string, any>): void;
475
- }
476
- //#endregion
477
- export { WalletConnectMetadata as A, Wallet as B, SendTransactionOptions as C, TurnkeyOAuthProvider as D, TurnkeyMetadata as E, onAccountChangeCallback as F, WalletConnectStrategyEventType as G, WalletDeviceType as H, onChainIdChangeCallback as I, WalletStrategyEmitterEvents as J, WalletStrategyEmitter as K, BroadcastMode as L, WalletStrategy as M, WalletStrategyArguments as N, TurnkeyProvider as O, WalletStrategyEvmOptions as P, EvmWalletProviderErrorCode as R, PrivateKeyMetadata as S, StrategyEmitter as T, WalletEventListener as U, WalletAction as V, StrategyEventType as W, ConcreteWalletStrategy as _, isEip712V2OnlyWallet as a, Eip1193Provider as b, BrowserEip1993Provider as c, EIP6963ProviderInfo as d, WindowWithEip1193Provider as f, ConcreteStrategiesArg as g, ConcreteEvmWalletStrategyArgs as h, isCosmosWallet as i, WalletMetadata as j, TurnkeySession as k, EIP6963AnnounceProviderEvent as l, ConcreteCosmosWalletStrategyArgs as m, isCosmosAminoOnlyWallet as n, isEvmBrowserWallet as o, ConcreteCosmosWalletStrategy as p, WalletStrategyEmitterEventType as q, isCosmosBrowserWallet as r, isEvmWallet as s, BaseConcreteStrategy as t, EIP6963ProviderDetail as u, ConcreteWalletStrategyArgs as v, StdSignDoc as w, MagicMetadata as x, CosmosWalletAbstraction as y, MagicProvider as z };
403
+ export { WalletDeviceType as A, onAccountChangeCallback as C, MagicProvider as D, EvmWalletProviderErrorCode as E, WalletStrategyEmitterEventType as F, WalletStrategyEmitterEvents as I, StrategyEventType as M, WalletConnectStrategyEventType as N, Wallet as O, WalletStrategyEmitter as P, WalletStrategyEvmOptions as S, BroadcastMode as T, TurnkeySession as _, ConcreteWalletStrategy as a, WalletStrategy as b, Eip1193Provider as c, SendTransactionOptions as d, StdSignDoc as f, TurnkeyProvider as g, TurnkeyOAuthProvider as h, ConcreteStrategiesArg as i, WalletEventListener as j, WalletAction as k, MagicMetadata as l, TurnkeyMetadata as m, ConcreteCosmosWalletStrategyArgs as n, ConcreteWalletStrategyArgs as o, StrategyEmitter as p, ConcreteEvmWalletStrategyArgs as r, CosmosWalletAbstraction as s, ConcreteCosmosWalletStrategy as t, PrivateKeyMetadata as u, WalletConnectMetadata as v, onChainIdChangeCallback as w, WalletStrategyArguments as x, WalletMetadata as y };
@@ -1,10 +1,57 @@
1
- import { A as WalletConnectMetadata, B as Wallet, C as SendTransactionOptions, D as TurnkeyOAuthProvider, E as TurnkeyMetadata, F as onAccountChangeCallback, G as WalletConnectStrategyEventType, H as WalletDeviceType, I as onChainIdChangeCallback, J as WalletStrategyEmitterEvents, K as WalletStrategyEmitter, L as BroadcastMode, M as WalletStrategy, N as WalletStrategyArguments, O as TurnkeyProvider, P as WalletStrategyEvmOptions, R as EvmWalletProviderErrorCode, S as PrivateKeyMetadata, T as StrategyEmitter, U as WalletEventListener, V as WalletAction, W as StrategyEventType, _ as ConcreteWalletStrategy, a as isEip712V2OnlyWallet, b as Eip1193Provider, c as BrowserEip1993Provider, d as EIP6963ProviderInfo, f as WindowWithEip1193Provider, g as ConcreteStrategiesArg, h as ConcreteEvmWalletStrategyArgs, i as isCosmosWallet, j as WalletMetadata, k as TurnkeySession, l as EIP6963AnnounceProviderEvent, m as ConcreteCosmosWalletStrategyArgs, n as isCosmosAminoOnlyWallet, o as isEvmBrowserWallet, p as ConcreteCosmosWalletStrategy, q as WalletStrategyEmitterEventType, r as isCosmosBrowserWallet, s as isEvmWallet, t as BaseConcreteStrategy, u as EIP6963ProviderDetail, v as ConcreteWalletStrategyArgs, w as StdSignDoc, x as MagicMetadata, y as CosmosWalletAbstraction, z as MagicProvider } from "./base-CBGzsBZK.js";
1
+ import { A as WalletDeviceType, C as onAccountChangeCallback, D as MagicProvider, E as EvmWalletProviderErrorCode, F as WalletStrategyEmitterEventType, I as WalletStrategyEmitterEvents, M as StrategyEventType, N as WalletConnectStrategyEventType, O as Wallet, P as WalletStrategyEmitter, S as WalletStrategyEvmOptions, T as BroadcastMode, _ as TurnkeySession, a as ConcreteWalletStrategy, b as WalletStrategy, c as Eip1193Provider, d as SendTransactionOptions, f as StdSignDoc, g as TurnkeyProvider, h as TurnkeyOAuthProvider, i as ConcreteStrategiesArg, j as WalletEventListener, k as WalletAction, l as MagicMetadata, m as TurnkeyMetadata, n as ConcreteCosmosWalletStrategyArgs, o as ConcreteWalletStrategyArgs, p as StrategyEmitter, r as ConcreteEvmWalletStrategyArgs, s as CosmosWalletAbstraction, t as ConcreteCosmosWalletStrategy, u as PrivateKeyMetadata, v as WalletConnectMetadata, w as onChainIdChangeCallback, x as WalletStrategyArguments, y as WalletMetadata } from "./strategy-BGAy7FJw.js";
2
2
  import { BigNumber } from "@injectivelabs/utils";
3
- import { ChainId, EvmChainId } from "@injectivelabs/ts-types";
3
+ import { ChainId, CosmosChainId, EvmChainId } from "@injectivelabs/ts-types";
4
4
  import { Account, Chain, LocalAccount, PublicClient, WalletClient } from "viem";
5
5
  import { CosmosTxV1Beta1TxPb } from "@injectivelabs/sdk-ts/proto/cosmos-tx";
6
+ import { EIP1193Provider } from "eip1193-provider";
6
7
  import { Msgs } from "@injectivelabs/sdk-ts/core/modules";
7
8
 
9
+ //#region src/types/provider.d.ts
10
+ interface BrowserEip1993Provider extends EIP1193Provider {
11
+ removeAllListeners(): void;
12
+ providers?: BrowserEip1993Provider[];
13
+ isTrust: boolean;
14
+ isKeplr: boolean;
15
+ isRabby: boolean;
16
+ isRainbow: boolean;
17
+ isPhantom: boolean;
18
+ isBitGet?: boolean;
19
+ isBitKeep?: boolean;
20
+ isMetaMask: boolean;
21
+ isOkxWallet: boolean;
22
+ isTrustWallet: boolean;
23
+ }
24
+ interface WindowWithEip1193Provider extends Omit<Window, 'ethereum' | 'keplr'> {
25
+ rainbow: BrowserEip1993Provider;
26
+ rabby: BrowserEip1993Provider;
27
+ ethereum: BrowserEip1993Provider;
28
+ okxwallet: BrowserEip1993Provider;
29
+ providers: BrowserEip1993Provider[];
30
+ trustWallet?: BrowserEip1993Provider;
31
+ bitkeep: {
32
+ ethereum: BrowserEip1993Provider;
33
+ };
34
+ phantom?: {
35
+ ethereum?: BrowserEip1993Provider;
36
+ };
37
+ keplr?: {
38
+ ethereum?: BrowserEip1993Provider;
39
+ };
40
+ }
41
+ interface EIP6963ProviderInfo {
42
+ rdns: string;
43
+ uuid: string;
44
+ name: string;
45
+ icon: string;
46
+ }
47
+ interface EIP6963ProviderDetail {
48
+ info: EIP6963ProviderInfo;
49
+ provider: BrowserEip1993Provider;
50
+ }
51
+ type EIP6963AnnounceProviderEvent = {
52
+ detail: EIP6963ProviderDetail;
53
+ };
54
+ //#endregion
8
55
  //#region src/utils/tx.d.ts
9
56
  declare const createEip712StdSignDoc: ({
10
57
  memo,
@@ -58,6 +105,14 @@ declare const getViemWalletClient: ({
58
105
  }) => WalletClient;
59
106
  declare const getViemPublicClientFromEip1193Provider: (chainId: EvmChainId | number, provider: BrowserEip1993Provider) => PublicClient;
60
107
  //#endregion
108
+ //#region src/utils/wallet.d.ts
109
+ declare const isEvmWallet: (wallet: Wallet) => boolean;
110
+ declare const isCosmosWallet: (wallet: Wallet) => boolean;
111
+ declare const isEvmBrowserWallet: (wallet: Wallet) => boolean;
112
+ declare const isCosmosBrowserWallet: (wallet: Wallet) => boolean;
113
+ declare const isEip712V2OnlyWallet: (wallet: Wallet) => boolean;
114
+ declare const isCosmosAminoOnlyWallet: (wallet: Wallet) => boolean;
115
+ //#endregion
61
116
  //#region src/utils/cosmos.d.ts
62
117
  declare const createCosmosSignDocFromSignDoc: (signDoc: CosmosTxV1Beta1TxPb.SignDoc) => any;
63
118
  //#endregion
@@ -72,4 +127,24 @@ declare const DEFAULT_BASE_DERIVATION_PATH = "m/44'/60'";
72
127
  declare const DEFAULT_NUM_ADDRESSES_TO_FETCH = 5;
73
128
  declare const DEFAULT_ADDRESS_SEARCH_LIMIT = 100;
74
129
  //#endregion
130
+ //#region src/base.d.ts
131
+ declare abstract class BaseConcreteStrategy {
132
+ protected chainId: ChainId | CosmosChainId;
133
+ protected evmChainId?: EvmChainId;
134
+ protected listeners: Partial<Record<WalletEventListener, any>>;
135
+ metadata?: WalletMetadata;
136
+ /**
137
+ * Optional emitter passed from parent WalletStrategy.
138
+ * When provided, strategies emit events directly on the parent's emitter.
139
+ */
140
+ protected emitter?: StrategyEmitter;
141
+ constructor(args: ConcreteWalletStrategyArgs | ConcreteEvmWalletStrategyArgs | ConcreteCosmosWalletStrategyArgs);
142
+ setMetadata(metadata?: WalletMetadata): void;
143
+ /**
144
+ * Emit an event from this strategy.
145
+ * If emitter was provided from parent, events go directly to parent.
146
+ */
147
+ protected emit(event: WalletStrategyEmitterEventType, data?: Record<string, any>): void;
148
+ }
149
+ //#endregion
75
150
  export { BaseConcreteStrategy, BroadcastMode, BrowserEip1993Provider, ConcreteCosmosWalletStrategy, ConcreteCosmosWalletStrategyArgs, ConcreteEvmWalletStrategyArgs, ConcreteStrategiesArg, ConcreteWalletStrategy, ConcreteWalletStrategyArgs, CosmosWalletAbstraction, DEFAULT_ADDRESS_SEARCH_LIMIT, DEFAULT_BASE_DERIVATION_PATH, DEFAULT_NUM_ADDRESSES_TO_FETCH, EIP6963AnnounceProviderEvent, EIP6963ProviderDetail, EIP6963ProviderInfo, Eip1193Provider, EvmWalletProviderErrorCode, GWEI_IN_WEI, MagicMetadata, MagicProvider, PrivateKeyMetadata, SendTransactionOptions, StdSignDoc, StrategyEmitter, StrategyEventType, TIP_IN_GWEI, TurnkeyMetadata, TurnkeyOAuthProvider, TurnkeyProvider, TurnkeySession, Wallet, WalletAction, WalletConnectMetadata, WalletConnectStrategyEventType, WalletDeviceType, WalletEventListener, WalletMetadata, WalletStrategy, WalletStrategyArguments, WalletStrategyEmitter, WalletStrategyEmitterEventType, WalletStrategyEmitterEvents, WalletStrategyEvmOptions, WindowWithEip1193Provider, createCosmosSignDocFromSignDoc, createEip712StdSignDoc, getEthereumSignerAddress, getEvmChainConfig, getInjectiveSignerAddress, getViemPublicClient, getViemPublicClientFromEip1193Provider, getViemWalletClient, isCosmosAminoOnlyWallet, isCosmosBrowserWallet, isCosmosWallet, isEip712V2OnlyWallet, isEvmBrowserWallet, isEvmWallet, onAccountChangeCallback, onChainIdChangeCallback };
package/dist/esm/index.js CHANGED
@@ -1,4 +1,3 @@
1
- import { _ as WalletConnectStrategyEventType, a as isEip712V2OnlyWallet, c as TurnkeyProvider, d as MagicProvider, f as Wallet, g as StrategyEventType, h as WalletEventListener, i as isCosmosWallet, l as BroadcastMode, m as WalletDeviceType, n as isCosmosAminoOnlyWallet, o as isEvmBrowserWallet, p as WalletAction, r as isCosmosBrowserWallet, s as isEvmWallet, t as BaseConcreteStrategy, u as EvmWalletProviderErrorCode, v as WalletStrategyEmitterEventType } from "./base-peAgOWO4.js";
2
1
  import { getStdFee, toBigNumber } from "@injectivelabs/utils";
3
2
  import * as viemChains from "viem/chains";
4
3
  import { injective } from "viem/chains";
@@ -7,6 +6,106 @@ import { createPublicClient, createWalletClient, custom, extractChain, http } fr
7
6
  import { CosmosTxV1Beta1TxPb } from "@injectivelabs/sdk-ts/proto/cosmos-tx";
8
7
  import { getEthereumAddress, getInjectiveAddress } from "@injectivelabs/sdk-ts/utils";
9
8
 
9
+ //#region src/types/events.ts
10
+ const StrategyEventType = {
11
+ ConnectionEnd: "connection-end",
12
+ ConnectionStart: "connection-start",
13
+ WalletSigningEnd: "wallet-signing-end",
14
+ WalletSigningStart: "wallet-signing-start"
15
+ };
16
+ const WalletConnectStrategyEventType = { WalletConnectSigningWithTxTimeout: "signing-with-tx-timeout" };
17
+ const WalletStrategyEmitterEventType = {
18
+ TransactionFail: "transaction-fail",
19
+ TransactionSigned: "transaction-signed",
20
+ TransactionSignStart: "transaction-sign-start",
21
+ TransactionBroadcastEnd: "transaction-broadcast-end",
22
+ TransactionBroadcastStart: "transaction-broadcast-start",
23
+ TransactionBroadcastSynced: "transaction-broadcast-synced",
24
+ TransactionPreparationEnd: "transaction-preparation-end",
25
+ TransactionPreparationStart: "transaction-preparation-start",
26
+ WalletStrategyDisconnect: "wallet-strategy-disconnect"
27
+ };
28
+
29
+ //#endregion
30
+ //#region src/types/enums.ts
31
+ const BroadcastMode = {
32
+ Block: "block",
33
+ Sync: "sync",
34
+ Async: "async"
35
+ };
36
+ const Wallet = {
37
+ Leap: "leap",
38
+ Keplr: "keplr",
39
+ Ninji: "ninji",
40
+ Magic: "magic",
41
+ Rabby: "rabby",
42
+ Ledger: "ledger",
43
+ BitGet: "BitGet",
44
+ OWallet: "owallet",
45
+ Phantom: "phantom",
46
+ Rainbow: "rainbow",
47
+ Turnkey: "turnkey",
48
+ Metamask: "metamask",
49
+ KeplrEvm: "keplr-evm",
50
+ OkxWallet: "okx-wallet",
51
+ PrivateKey: "private-key",
52
+ TrustWallet: "trust-wallet",
53
+ TrezorBip32: "trezor-bip32",
54
+ TrezorBip44: "trezor-bip44",
55
+ Cosmostation: "cosmostation",
56
+ LedgerCosmos: "ledger-cosmos",
57
+ LedgerLegacy: "ledger-legacy",
58
+ WalletConnect: "wallet-connect",
59
+ CosmostationEth: "cosmostation-eth",
60
+ PrivateKeyCosmos: "private-key-cosmos"
61
+ };
62
+ const MagicProvider = {
63
+ Email: "email",
64
+ Apple: "apple",
65
+ Github: "github",
66
+ Google: "google",
67
+ Discord: "discord",
68
+ Twitter: "twitter",
69
+ Facebook: "facebook"
70
+ };
71
+ const WalletDeviceType = {
72
+ Mobile: "mobile",
73
+ Other: "other",
74
+ Browser: "browser",
75
+ Hardware: "hardware"
76
+ };
77
+ const WalletEventListener = {
78
+ AccountChange: "account-change",
79
+ ChainIdChange: "chain-id-change"
80
+ };
81
+ const EvmWalletProviderErrorCode = {
82
+ InternalError: -32603,
83
+ UserRejectedRequest: 4001,
84
+ UnrecognizedChain: 4902
85
+ };
86
+ const WalletAction = {
87
+ GetChainId: "get-chain-id",
88
+ GetAccounts: "get-accounts",
89
+ GetNetworkId: "get-network-id",
90
+ SignArbitrary: "sign-arbitrary",
91
+ SignTransaction: "sign-transaction",
92
+ SendTransaction: "send-transaction",
93
+ SendEvmTransaction: "send-evm-transaction",
94
+ SignEvmTransaction: "sign-evm-transaction",
95
+ GetEvmTransactionReceipt: "get-evm-transaction-receipt"
96
+ };
97
+
98
+ //#endregion
99
+ //#region src/types/strategy.ts
100
+ const TurnkeyProvider = {
101
+ Sms: "sms",
102
+ Apple: "apple",
103
+ Email: "email",
104
+ Google: "google",
105
+ Twitter: "twitter"
106
+ };
107
+
108
+ //#endregion
10
109
  //#region src/utils/tx.ts
11
110
  const createEip712StdSignDoc = ({ memo, chainId, accountNumber, timeoutHeight, sequence, gas, msgs }) => ({
12
111
  chain_id: chainId,
@@ -87,6 +186,53 @@ const getViemPublicClientFromEip1193Provider = (chainId, provider) => {
87
186
  });
88
187
  };
89
188
 
189
+ //#endregion
190
+ //#region src/utils/wallet.ts
191
+ const isEvmWallet = (wallet) => [
192
+ Wallet.Magic,
193
+ Wallet.Rabby,
194
+ Wallet.BitGet,
195
+ Wallet.Ledger,
196
+ Wallet.Phantom,
197
+ Wallet.Rainbow,
198
+ Wallet.Turnkey,
199
+ Wallet.Metamask,
200
+ Wallet.KeplrEvm,
201
+ Wallet.OkxWallet,
202
+ Wallet.PrivateKey,
203
+ Wallet.TrezorBip32,
204
+ Wallet.TrezorBip44,
205
+ Wallet.TrustWallet,
206
+ Wallet.LedgerLegacy,
207
+ Wallet.WalletConnect,
208
+ Wallet.CosmostationEth
209
+ ].includes(wallet);
210
+ const isCosmosWallet = (wallet) => !isEvmWallet(wallet);
211
+ const isEvmBrowserWallet = (wallet) => [
212
+ Wallet.Rabby,
213
+ Wallet.BitGet,
214
+ Wallet.Phantom,
215
+ Wallet.Rainbow,
216
+ Wallet.Metamask,
217
+ Wallet.KeplrEvm,
218
+ Wallet.OkxWallet,
219
+ Wallet.TrustWallet
220
+ ].includes(wallet);
221
+ const isCosmosBrowserWallet = (wallet) => [
222
+ Wallet.Leap,
223
+ Wallet.Keplr,
224
+ Wallet.Ninji,
225
+ Wallet.OWallet,
226
+ Wallet.Cosmostation
227
+ ].includes(wallet);
228
+ const isEip712V2OnlyWallet = (wallet) => [
229
+ Wallet.Magic,
230
+ Wallet.Phantom,
231
+ Wallet.Metamask,
232
+ Wallet.WalletConnect
233
+ ].includes(wallet);
234
+ const isCosmosAminoOnlyWallet = (wallet) => [Wallet.LedgerCosmos].includes(wallet);
235
+
90
236
  //#endregion
91
237
  //#region src/utils/cosmos.ts
92
238
  const createCosmosSignDocFromSignDoc = (signDoc) => {
@@ -121,5 +267,74 @@ const DEFAULT_BASE_DERIVATION_PATH = "m/44'/60'";
121
267
  const DEFAULT_NUM_ADDRESSES_TO_FETCH = 5;
122
268
  const DEFAULT_ADDRESS_SEARCH_LIMIT = 100;
123
269
 
270
+ //#endregion
271
+ //#region \0@oxc-project+runtime@0.99.0/helpers/typeof.js
272
+ function _typeof(o) {
273
+ "@babel/helpers - typeof";
274
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
275
+ return typeof o$1;
276
+ } : function(o$1) {
277
+ return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
278
+ }, _typeof(o);
279
+ }
280
+
281
+ //#endregion
282
+ //#region \0@oxc-project+runtime@0.99.0/helpers/toPrimitive.js
283
+ function toPrimitive(t, r) {
284
+ if ("object" != _typeof(t) || !t) return t;
285
+ var e = t[Symbol.toPrimitive];
286
+ if (void 0 !== e) {
287
+ var i = e.call(t, r || "default");
288
+ if ("object" != _typeof(i)) return i;
289
+ throw new TypeError("@@toPrimitive must return a primitive value.");
290
+ }
291
+ return ("string" === r ? String : Number)(t);
292
+ }
293
+
294
+ //#endregion
295
+ //#region \0@oxc-project+runtime@0.99.0/helpers/toPropertyKey.js
296
+ function toPropertyKey(t) {
297
+ var i = toPrimitive(t, "string");
298
+ return "symbol" == _typeof(i) ? i : i + "";
299
+ }
300
+
301
+ //#endregion
302
+ //#region \0@oxc-project+runtime@0.99.0/helpers/defineProperty.js
303
+ function _defineProperty(e, r, t) {
304
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
305
+ value: t,
306
+ enumerable: !0,
307
+ configurable: !0,
308
+ writable: !0
309
+ }) : e[r] = t, e;
310
+ }
311
+
312
+ //#endregion
313
+ //#region src/base.ts
314
+ var BaseConcreteStrategy = class {
315
+ constructor(args) {
316
+ _defineProperty(this, "chainId", void 0);
317
+ _defineProperty(this, "evmChainId", void 0);
318
+ _defineProperty(this, "listeners", {});
319
+ _defineProperty(this, "metadata", void 0);
320
+ _defineProperty(this, "emitter", void 0);
321
+ this.evmChainId = "evmOptions" in args && args.evmOptions ? args.evmOptions.evmChainId : void 0;
322
+ this.chainId = args.chainId;
323
+ this.metadata = args.metadata;
324
+ this.emitter = args.emitter;
325
+ }
326
+ setMetadata(metadata) {
327
+ this.metadata = metadata;
328
+ }
329
+ /**
330
+ * Emit an event from this strategy.
331
+ * If emitter was provided from parent, events go directly to parent.
332
+ */
333
+ emit(event, data) {
334
+ var _this$emitter;
335
+ (_this$emitter = this.emitter) === null || _this$emitter === void 0 || _this$emitter.emit(event, data);
336
+ }
337
+ };
338
+
124
339
  //#endregion
125
340
  export { BaseConcreteStrategy, BroadcastMode, DEFAULT_ADDRESS_SEARCH_LIMIT, DEFAULT_BASE_DERIVATION_PATH, DEFAULT_NUM_ADDRESSES_TO_FETCH, EvmWalletProviderErrorCode, GWEI_IN_WEI, MagicProvider, StrategyEventType, TIP_IN_GWEI, TurnkeyProvider, Wallet, WalletAction, WalletConnectStrategyEventType, WalletDeviceType, WalletEventListener, WalletStrategyEmitterEventType, createCosmosSignDocFromSignDoc, createEip712StdSignDoc, getEthereumSignerAddress, getEvmChainConfig, getInjectiveSignerAddress, getViemPublicClient, getViemPublicClientFromEip1193Provider, getViemWalletClient, isCosmosAminoOnlyWallet, isCosmosBrowserWallet, isCosmosWallet, isEip712V2OnlyWallet, isEvmBrowserWallet, isEvmWallet };