@injectivelabs/wallet-base 1.16.25-alpha.1 → 1.16.26

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.
Files changed (58) hide show
  1. package/dist/cjs/base.d.ts +9 -0
  2. package/dist/cjs/base.js +17 -0
  3. package/dist/cjs/index.d.ts +3 -0
  4. package/dist/cjs/index.js +24 -0
  5. package/dist/cjs/package.json +2 -2
  6. package/dist/cjs/types/enums.d.ts +64 -0
  7. package/dist/cjs/types/enums.js +53 -0
  8. package/dist/cjs/types/index.d.ts +3 -0
  9. package/dist/cjs/types/index.js +18 -0
  10. package/dist/cjs/types/provider.d.ts +38 -0
  11. package/dist/cjs/types/provider.js +2 -0
  12. package/dist/cjs/types/strategy.d.ts +256 -0
  13. package/dist/cjs/types/strategy.js +8 -0
  14. package/dist/cjs/utils/address.d.ts +2 -0
  15. package/dist/cjs/utils/address.js +30 -0
  16. package/dist/cjs/utils/alchemy.d.ts +1 -0
  17. package/dist/cjs/utils/alchemy.js +11 -0
  18. package/dist/cjs/utils/constants.d.ts +6 -0
  19. package/dist/cjs/utils/constants.js +9 -0
  20. package/dist/cjs/utils/cosmos.d.ts +2 -0
  21. package/dist/cjs/utils/cosmos.js +13 -0
  22. package/dist/cjs/utils/index.d.ts +6 -0
  23. package/dist/cjs/utils/index.js +22 -0
  24. package/dist/cjs/utils/tx.d.ts +31 -0
  25. package/dist/cjs/utils/tx.js +14 -0
  26. package/dist/cjs/utils/wallet.d.ts +7 -0
  27. package/dist/cjs/utils/wallet.js +52 -0
  28. package/dist/esm/base.d.ts +9 -0
  29. package/dist/esm/base.js +14 -0
  30. package/dist/esm/index.d.ts +3 -436
  31. package/dist/esm/index.js +3 -1496
  32. package/dist/esm/package.json +2 -2
  33. package/dist/esm/types/enums.d.ts +64 -0
  34. package/dist/esm/types/enums.js +50 -0
  35. package/dist/esm/types/index.d.ts +3 -0
  36. package/dist/esm/types/index.js +2 -0
  37. package/dist/esm/types/provider.d.ts +38 -0
  38. package/dist/esm/types/provider.js +1 -0
  39. package/dist/esm/types/strategy.d.ts +256 -0
  40. package/dist/esm/types/strategy.js +5 -0
  41. package/dist/esm/utils/address.d.ts +2 -0
  42. package/dist/esm/utils/address.js +25 -0
  43. package/dist/esm/utils/alchemy.d.ts +1 -0
  44. package/dist/esm/utils/alchemy.js +7 -0
  45. package/dist/esm/utils/constants.d.ts +6 -0
  46. package/dist/esm/utils/constants.js +6 -0
  47. package/dist/esm/utils/cosmos.d.ts +2 -0
  48. package/dist/esm/utils/cosmos.js +9 -0
  49. package/dist/esm/utils/index.d.ts +6 -0
  50. package/dist/esm/utils/index.js +6 -0
  51. package/dist/esm/utils/tx.d.ts +31 -0
  52. package/dist/esm/utils/tx.js +10 -0
  53. package/dist/esm/utils/wallet.d.ts +7 -0
  54. package/dist/esm/utils/wallet.js +43 -0
  55. package/package.json +17 -17
  56. package/dist/cjs/index.cjs +0 -1805
  57. package/dist/cjs/index.d.cts +0 -436
  58. package/dist/esm/chunk-BIPRnmEv.js +0 -23
@@ -1,3 +1,3 @@
1
1
  {
2
- "type": "module"
3
- }
2
+ "type": "module"
3
+ }
@@ -0,0 +1,64 @@
1
+ export declare const BroadcastMode: {
2
+ readonly Block: "block";
3
+ readonly Sync: "sync";
4
+ readonly Async: "async";
5
+ };
6
+ export type BroadcastMode = (typeof BroadcastMode)[keyof typeof BroadcastMode];
7
+ export declare const Wallet: {
8
+ readonly Leap: "leap";
9
+ readonly Keplr: "keplr";
10
+ readonly Ninji: "ninji";
11
+ readonly Magic: "magic";
12
+ readonly Rabby: "rabby";
13
+ readonly Ledger: "ledger";
14
+ readonly BitGet: "BitGet";
15
+ readonly OWallet: "owallet";
16
+ readonly Phantom: "phantom";
17
+ readonly Rainbow: "rainbow";
18
+ readonly Turnkey: "turnkey";
19
+ readonly Metamask: "metamask";
20
+ readonly OkxWallet: "okx-wallet";
21
+ readonly PrivateKey: "private-key";
22
+ readonly TrustWallet: "trust-wallet";
23
+ readonly TrezorBip32: "trezor-bip32";
24
+ readonly TrezorBip44: "trezor-bip44";
25
+ readonly Cosmostation: "cosmostation";
26
+ readonly LedgerCosmos: "ledger-cosmos";
27
+ readonly LedgerLegacy: "ledger-legacy";
28
+ readonly WalletConnect: "wallet-connect";
29
+ readonly CosmostationEth: "cosmostation-eth";
30
+ };
31
+ export type Wallet = (typeof Wallet)[keyof typeof Wallet];
32
+ export declare const MagicProvider: {
33
+ readonly Email: "email";
34
+ readonly Apple: "apple";
35
+ readonly Github: "github";
36
+ readonly Google: "google";
37
+ readonly Discord: "discord";
38
+ readonly Twitter: "twitter";
39
+ readonly Facebook: "facebook";
40
+ };
41
+ export type MagicProvider = (typeof MagicProvider)[keyof typeof MagicProvider];
42
+ export declare const WalletDeviceType: {
43
+ readonly Mobile: "mobile";
44
+ readonly Other: "other";
45
+ readonly Browser: "browser";
46
+ readonly Hardware: "hardware";
47
+ };
48
+ export type WalletDeviceType = (typeof WalletDeviceType)[keyof typeof WalletDeviceType];
49
+ export declare const WalletEventListener: {
50
+ readonly AccountChange: "account-change";
51
+ readonly ChainIdChange: "chain-id-change";
52
+ };
53
+ export type WalletEventListener = (typeof WalletEventListener)[keyof typeof WalletEventListener];
54
+ export declare const WalletAction: {
55
+ GetChainId: "get-chain-id";
56
+ GetAccounts: "get-accounts";
57
+ GetNetworkId: "get-network-id";
58
+ SignArbitrary: "sign-arbitrary";
59
+ SignTransaction: "sign-transaction";
60
+ SendTransaction: "send-transaction";
61
+ SendEvmTransaction: "send-evm-transaction";
62
+ SignEvmTransaction: "sign-evm-transaction";
63
+ GetEvmTransactionReceipt: "get-evm-transaction-receipt";
64
+ };
@@ -0,0 +1,50 @@
1
+ import { WalletErrorActionModule } from '@injectivelabs/exceptions';
2
+ export const BroadcastMode = {
3
+ Block: 'block',
4
+ Sync: 'sync',
5
+ Async: 'async',
6
+ };
7
+ export const Wallet = {
8
+ Leap: 'leap',
9
+ Keplr: 'keplr',
10
+ Ninji: 'ninji',
11
+ Magic: 'magic',
12
+ Rabby: 'rabby',
13
+ Ledger: 'ledger',
14
+ BitGet: 'BitGet',
15
+ OWallet: 'owallet',
16
+ Phantom: 'phantom',
17
+ Rainbow: 'rainbow',
18
+ Turnkey: 'turnkey',
19
+ Metamask: 'metamask',
20
+ OkxWallet: 'okx-wallet',
21
+ PrivateKey: 'private-key',
22
+ TrustWallet: 'trust-wallet',
23
+ TrezorBip32: 'trezor-bip32',
24
+ TrezorBip44: 'trezor-bip44',
25
+ Cosmostation: 'cosmostation',
26
+ LedgerCosmos: 'ledger-cosmos',
27
+ LedgerLegacy: 'ledger-legacy',
28
+ WalletConnect: 'wallet-connect',
29
+ CosmostationEth: 'cosmostation-eth',
30
+ };
31
+ export const MagicProvider = {
32
+ Email: 'email',
33
+ Apple: 'apple',
34
+ Github: 'github',
35
+ Google: 'google',
36
+ Discord: 'discord',
37
+ Twitter: 'twitter',
38
+ Facebook: 'facebook',
39
+ };
40
+ export const WalletDeviceType = {
41
+ Mobile: 'mobile',
42
+ Other: 'other',
43
+ Browser: 'browser',
44
+ Hardware: 'hardware',
45
+ };
46
+ export const WalletEventListener = {
47
+ AccountChange: 'account-change',
48
+ ChainIdChange: 'chain-id-change',
49
+ };
50
+ export const WalletAction = { ...WalletErrorActionModule };
@@ -0,0 +1,3 @@
1
+ export * from './enums.js';
2
+ export * from './strategy.js';
3
+ export type * from './provider.js';
@@ -0,0 +1,2 @@
1
+ export * from './enums.js';
2
+ export * from './strategy.js';
@@ -0,0 +1,38 @@
1
+ import type { EIP1193Provider } from 'eip1193-provider';
2
+ export interface BrowserEip1993Provider extends EIP1193Provider {
3
+ removeAllListeners(): void;
4
+ isTrust: boolean;
5
+ isRabby: boolean;
6
+ isRainbow: boolean;
7
+ isPhantom: boolean;
8
+ isMetaMask: boolean;
9
+ isOkxWallet: boolean;
10
+ isTrustWallet: boolean;
11
+ }
12
+ export interface WindowWithEip1193Provider extends Window {
13
+ rainbow: BrowserEip1993Provider;
14
+ rabby: BrowserEip1993Provider;
15
+ ethereum: BrowserEip1993Provider;
16
+ okxwallet: BrowserEip1993Provider;
17
+ providers: BrowserEip1993Provider[];
18
+ trustWallet?: BrowserEip1993Provider;
19
+ bitkeep: {
20
+ ethereum: BrowserEip1993Provider;
21
+ };
22
+ phantom?: {
23
+ ethereum?: BrowserEip1993Provider;
24
+ };
25
+ }
26
+ export interface EIP6963ProviderInfo {
27
+ rdns: string;
28
+ uuid: string;
29
+ name: string;
30
+ icon: string;
31
+ }
32
+ export interface EIP6963ProviderDetail {
33
+ info: EIP6963ProviderInfo;
34
+ provider: BrowserEip1993Provider;
35
+ }
36
+ export type EIP6963AnnounceProviderEvent = {
37
+ detail: EIP6963ProviderDetail;
38
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,256 @@
1
+ import type { StdSignDoc } from '@keplr-wallet/types';
2
+ import type { WalletDeviceType, Wallet } from './enums.js';
3
+ import type { OfflineSigner } from '@cosmjs/proto-signing';
4
+ import type { ChainId, EvmChainId, AccountAddress } from '@injectivelabs/ts-types';
5
+ import type { TxRaw, TxResponse, AminoSignResponse, DirectSignResponse } from '@injectivelabs/sdk-ts';
6
+ export type onAccountChangeCallback = (account: string | string[]) => void;
7
+ export type onChainIdChangeCallback = () => void;
8
+ export type Eip1193Provider = {
9
+ request: (args: {
10
+ method: string;
11
+ params: any[];
12
+ }) => Promise<any>;
13
+ on: (event: string, listener: (...args: any[]) => void) => void;
14
+ removeListener: (event: string, listener: (...args: any[]) => void) => void;
15
+ };
16
+ export type CosmosWalletAbstraction = {
17
+ enableGasCheck?(chainId: ChainId): Promise<void> | void;
18
+ disableGasCheck?(chainId: ChainId): Promise<void> | void;
19
+ signEIP712CosmosTx(args: {
20
+ signDoc: StdSignDoc;
21
+ eip712: any;
22
+ }): Promise<AminoSignResponse>;
23
+ };
24
+ export type MagicMetadata = {
25
+ apiKey?: string;
26
+ rpcEndpoint?: string;
27
+ };
28
+ export type PrivateKeyMetadata = {
29
+ privateKey: string;
30
+ };
31
+ export type WalletConnectMetadata = {
32
+ projectId?: string;
33
+ };
34
+ export interface WalletStrategyEvmOptions {
35
+ evmChainId: EvmChainId;
36
+ rpcUrl?: string;
37
+ rpcUrls?: Partial<Record<EvmChainId, string>>;
38
+ }
39
+ export interface SendTransactionOptions {
40
+ address: string;
41
+ chainId: ChainId;
42
+ txTimeout?: number;
43
+ endpoints: {
44
+ rest: string;
45
+ grpc: string;
46
+ tm?: string;
47
+ };
48
+ }
49
+ export declare const TurnkeyProvider: {
50
+ readonly Email: "email";
51
+ readonly Google: "google";
52
+ readonly Apple: "apple";
53
+ };
54
+ export type TurnkeyProvider = (typeof TurnkeyProvider)[keyof typeof TurnkeyProvider];
55
+ export type TurnkeySession = {
56
+ sessionType: any;
57
+ userId: string;
58
+ organizationId: string;
59
+ expiry: number;
60
+ token: string;
61
+ };
62
+ export interface TurnkeyMetadata {
63
+ apiBaseUrl: string;
64
+ otpInitPath?: string;
65
+ otpVerifyPath?: string;
66
+ googleClientId?: string;
67
+ oauthLoginPath?: string;
68
+ session?: TurnkeySession;
69
+ apiServerEndpoint: string;
70
+ credentialBundle?: string;
71
+ googleRedirectUri?: string;
72
+ expirationSeconds?: string;
73
+ defaultOrganizationId: string;
74
+ }
75
+ export interface WalletMetadata {
76
+ magic?: MagicMetadata;
77
+ turnkey?: Partial<TurnkeyMetadata>;
78
+ walletConnect?: WalletConnectMetadata;
79
+ privateKey?: PrivateKeyMetadata;
80
+ }
81
+ export interface ConcreteWalletStrategyArgs {
82
+ chainId: ChainId;
83
+ metadata?: WalletMetadata;
84
+ }
85
+ export interface ConcreteEvmWalletStrategyArgs extends ConcreteWalletStrategyArgs {
86
+ evmOptions: WalletStrategyEvmOptions;
87
+ }
88
+ export interface ConcreteCosmosWalletStrategyArgs extends ConcreteWalletStrategyArgs {
89
+ wallet?: Wallet;
90
+ }
91
+ export interface ConcreteCosmosWalletStrategy {
92
+ metadata?: WalletMetadata;
93
+ setMetadata?(metadata?: WalletMetadata): void;
94
+ /**
95
+ * The accounts from the wallet (addresses)
96
+ */
97
+ getAddresses(args?: unknown): Promise<string[]>;
98
+ /**
99
+ * Return the WalletDeviceType connected on the
100
+ * wallet provider (extension, mobile, hardware wallet)
101
+ */
102
+ getWalletDeviceType(): Promise<WalletDeviceType>;
103
+ /**
104
+ * Get the PubKey from the wallet
105
+ * in base64 for Cosmos native wallets
106
+ */
107
+ getPubKey(address?: string): Promise<string>;
108
+ /**
109
+ * Perform validations and checks
110
+ * for the wallet (if the chain is supported, etc)
111
+ */
112
+ enable(args?: unknown): Promise<boolean>;
113
+ /**
114
+ * Sends Cosmos transaction. Returns a transaction hash
115
+ * @param transaction should implement TransactionConfig
116
+ * @param options
117
+ */
118
+ sendTransaction(transaction: DirectSignResponse | TxRaw, options: SendTransactionOptions): Promise<TxResponse>;
119
+ signCosmosTransaction(transaction: {
120
+ txRaw: TxRaw;
121
+ chainId: string;
122
+ accountNumber: number;
123
+ address: string;
124
+ }): Promise<DirectSignResponse>;
125
+ signAminoTransaction(transaction: {
126
+ stdSignDoc: StdSignDoc;
127
+ address: string;
128
+ }): Promise<AminoSignResponse>;
129
+ }
130
+ export type ConcreteStrategiesArg = {
131
+ [key in Wallet]?: ConcreteWalletStrategy;
132
+ };
133
+ export interface WalletStrategyArguments {
134
+ chainId: ChainId;
135
+ metadata?: WalletMetadata;
136
+ evmOptions?: WalletStrategyEvmOptions;
137
+ disabledWallets?: Wallet[];
138
+ wallet?: Wallet;
139
+ strategies: ConcreteStrategiesArg;
140
+ }
141
+ export interface ConcreteWalletStrategy extends Omit<ConcreteCosmosWalletStrategy, 'sendTransaction' | 'isChainIdSupported' | 'signAminoTransaction'> {
142
+ /**
143
+ * Sends Cosmos transaction. Returns a transaction hash
144
+ * @param transaction should implement TransactionConfig
145
+ * @param options
146
+ */
147
+ sendTransaction(transaction: DirectSignResponse | TxRaw, options: {
148
+ address: string;
149
+ chainId: ChainId;
150
+ txTimeout?: number;
151
+ endpoints?: {
152
+ rest: string;
153
+ grpc: string;
154
+ tm?: string;
155
+ };
156
+ }): Promise<TxResponse>;
157
+ /**
158
+ * Confirm the address on the wallet
159
+ * @param address address
160
+ */
161
+ getSessionOrConfirm(address?: string): Promise<string>;
162
+ /**
163
+ * Sends Ethereum transaction. Returns a transaction hash
164
+ * @param transaction should implement TransactionConfig
165
+ * @param options
166
+ */
167
+ sendEvmTransaction(transaction: unknown, options: {
168
+ address: string;
169
+ evmChainId: EvmChainId;
170
+ }): Promise<string>;
171
+ /**
172
+ * Sign a cosmos transaction using the wallet provider
173
+ *
174
+ * @param transaction
175
+ * @param address - injective address
176
+ */
177
+ signCosmosTransaction(transaction: {
178
+ txRaw: TxRaw;
179
+ accountNumber: number;
180
+ chainId: string;
181
+ address: string;
182
+ }): Promise<DirectSignResponse>;
183
+ /**
184
+ * Sign an amino sign doc using the wallet provider
185
+ *
186
+ * @param transaction
187
+ * @param address - injective address
188
+ */
189
+ signAminoCosmosTransaction(transaction: {
190
+ signDoc: StdSignDoc;
191
+ address: string;
192
+ }): Promise<AminoSignResponse>;
193
+ /**
194
+ * Sign EIP712 TypedData using the wallet provider
195
+ * @param eip712TypedData
196
+ * @param address - ethereum address
197
+ */
198
+ signEip712TypedData(eip712TypedData: string, address: string, options?: {
199
+ txTimeout?: number;
200
+ }): Promise<string>;
201
+ signArbitrary(signer: string, data: string | Uint8Array): Promise<string>;
202
+ getEthereumChainId(): Promise<string>;
203
+ getEvmTransactionReceipt(txHash: string, evmChainId?: EvmChainId): void;
204
+ onAccountChange?(callback: onAccountChangeCallback): Promise<void> | void;
205
+ onChainIdChange?(callback: onChainIdChangeCallback): Promise<void> | void;
206
+ disconnect?(): Promise<void> | void;
207
+ getCosmosWallet?(chainId: ChainId): CosmosWalletAbstraction;
208
+ getWalletClient?<T>(): Promise<T>;
209
+ getEip1193Provider?(): Promise<Eip1193Provider>;
210
+ getOfflineSigner?(chainId: string): Promise<OfflineSigner>;
211
+ }
212
+ export interface WalletStrategy {
213
+ strategies: ConcreteStrategiesArg;
214
+ wallet: Wallet;
215
+ args: WalletStrategyArguments;
216
+ metadata?: WalletMetadata;
217
+ getWallet(): Wallet;
218
+ getWalletClient?<T>(): Promise<T>;
219
+ setWallet(wallet: Wallet): void;
220
+ setMetadata(metadata?: WalletMetadata): void;
221
+ getStrategy(): ConcreteWalletStrategy;
222
+ getAddresses(args?: unknown): Promise<AccountAddress[]>;
223
+ getWalletDeviceType(): Promise<WalletDeviceType>;
224
+ getPubKey(address?: string): Promise<string>;
225
+ enable(args?: unknown): Promise<boolean>;
226
+ enableAndGetAddresses(args?: unknown): Promise<AccountAddress[]>;
227
+ getEthereumChainId(): Promise<string>;
228
+ getEvmTransactionReceipt(txHash: string, evmChainId?: EvmChainId): Promise<void>;
229
+ getSessionOrConfirm(address?: AccountAddress): Promise<string>;
230
+ sendTransaction(tx: DirectSignResponse | TxRaw, options: SendTransactionOptions): Promise<TxResponse>;
231
+ sendEvmTransaction(tx: any, options: {
232
+ address: AccountAddress;
233
+ evmChainId: EvmChainId;
234
+ }): Promise<string>;
235
+ signEip712TypedData(eip712TypedData: string, address: AccountAddress, options?: {
236
+ txTimeout?: number;
237
+ }): Promise<string>;
238
+ signAminoCosmosTransaction(transaction: {
239
+ signDoc: StdSignDoc;
240
+ address: string;
241
+ }): Promise<AminoSignResponse>;
242
+ signCosmosTransaction(transaction: {
243
+ txRaw: TxRaw;
244
+ accountNumber: number;
245
+ chainId: string;
246
+ address: string;
247
+ }): Promise<DirectSignResponse>;
248
+ signArbitrary(signer: string, data: string | Uint8Array): Promise<string | void>;
249
+ onAccountChange(callback: onAccountChangeCallback): Promise<void>;
250
+ onChainIdChange(callback: onChainIdChangeCallback): Promise<void>;
251
+ disconnect(): Promise<void>;
252
+ getCosmosWallet?(chainId: ChainId): CosmosWalletAbstraction;
253
+ getEip1193Provider?(): Promise<Eip1193Provider>;
254
+ getOfflineSigner?(chainId: string): Promise<OfflineSigner>;
255
+ }
256
+ export type { StdSignDoc };
@@ -0,0 +1,5 @@
1
+ export const TurnkeyProvider = {
2
+ Email: 'email',
3
+ Google: 'google',
4
+ Apple: 'apple',
5
+ };
@@ -0,0 +1,2 @@
1
+ export declare const getInjectiveSignerAddress: (address: string | undefined) => string;
2
+ export declare const getEthereumSignerAddress: (address: string | undefined) => string;
@@ -0,0 +1,25 @@
1
+ import { getEthereumAddress, getInjectiveAddress } from '@injectivelabs/sdk-ts';
2
+ export const getInjectiveSignerAddress = (address) => {
3
+ if (!address) {
4
+ return '';
5
+ }
6
+ if (address.startsWith('inj')) {
7
+ return address;
8
+ }
9
+ if (address.startsWith('0x')) {
10
+ return getInjectiveAddress(address);
11
+ }
12
+ return '';
13
+ };
14
+ export const getEthereumSignerAddress = (address) => {
15
+ if (!address) {
16
+ return '';
17
+ }
18
+ if (address.startsWith('0x')) {
19
+ return address;
20
+ }
21
+ if (address.startsWith('inj')) {
22
+ return getEthereumAddress(address);
23
+ }
24
+ return '';
25
+ };
@@ -0,0 +1 @@
1
+ export declare const getKeyFromRpcUrl: (rpcUrl: string) => string;
@@ -0,0 +1,7 @@
1
+ export const getKeyFromRpcUrl = (rpcUrl) => {
2
+ if (!rpcUrl.includes('alchemyapi.io') && !rpcUrl.includes('alchemy.com')) {
3
+ return rpcUrl;
4
+ }
5
+ const [key] = rpcUrl.split('/').reverse();
6
+ return key;
7
+ };
@@ -0,0 +1,6 @@
1
+ import type { BigNumber } from '@injectivelabs/utils';
2
+ export declare const GWEI_IN_WEI: BigNumber;
3
+ export declare const TIP_IN_GWEI: BigNumber;
4
+ export declare const DEFAULT_BASE_DERIVATION_PATH = "m/44'/60'";
5
+ export declare const DEFAULT_NUM_ADDRESSES_TO_FETCH = 5;
6
+ export declare const DEFAULT_ADDRESS_SEARCH_LIMIT = 100;
@@ -0,0 +1,6 @@
1
+ import { toBigNumber } from '@injectivelabs/utils';
2
+ export const GWEI_IN_WEI = toBigNumber(1000000000);
3
+ export const TIP_IN_GWEI = toBigNumber(2).times(GWEI_IN_WEI);
4
+ export const DEFAULT_BASE_DERIVATION_PATH = "m/44'/60'";
5
+ export const DEFAULT_NUM_ADDRESSES_TO_FETCH = 5;
6
+ export const DEFAULT_ADDRESS_SEARCH_LIMIT = 100;
@@ -0,0 +1,2 @@
1
+ import { CosmosTxV1Beta1Tx } from '@injectivelabs/sdk-ts';
2
+ export declare const createCosmosSignDocFromSignDoc: (signDoc: CosmosTxV1Beta1Tx.SignDoc) => any;
@@ -0,0 +1,9 @@
1
+ import { CosmosTxV1Beta1Tx } from '@injectivelabs/sdk-ts';
2
+ export const createCosmosSignDocFromSignDoc = (signDoc) => {
3
+ return CosmosTxV1Beta1Tx.SignDoc.fromPartial({
4
+ bodyBytes: signDoc.bodyBytes,
5
+ authInfoBytes: signDoc.authInfoBytes,
6
+ accountNumber: BigInt(signDoc.accountNumber).toString(),
7
+ chainId: signDoc.chainId,
8
+ });
9
+ };
@@ -0,0 +1,6 @@
1
+ export * from './address.js';
2
+ export * from './tx.js';
3
+ export * from './wallet.js';
4
+ export * from './constants.js';
5
+ export * from './alchemy.js';
6
+ export * from './cosmos.js';
@@ -0,0 +1,6 @@
1
+ export * from './address.js';
2
+ export * from './tx.js';
3
+ export * from './wallet.js';
4
+ export * from './constants.js';
5
+ export * from './alchemy.js';
6
+ export * from './cosmos.js';
@@ -0,0 +1,31 @@
1
+ import type { Msgs } from '@injectivelabs/sdk-ts';
2
+ import type { ChainId } from '@injectivelabs/ts-types';
3
+ export declare const createEip712StdSignDoc: ({ memo, chainId, accountNumber, timeoutHeight, sequence, gas, msgs, }: {
4
+ memo?: string;
5
+ chainId: ChainId;
6
+ timeoutHeight?: string;
7
+ accountNumber: number;
8
+ sequence: number;
9
+ gas?: string;
10
+ msgs: Msgs[];
11
+ }) => {
12
+ chain_id: ChainId;
13
+ timeout_height: string;
14
+ account_number: string;
15
+ sequence: string;
16
+ fee: {
17
+ amount: {
18
+ denom: string;
19
+ amount: string;
20
+ }[];
21
+ gas: string;
22
+ payer: string | undefined;
23
+ granter: string | undefined;
24
+ feePayer: string | undefined;
25
+ };
26
+ msgs: {
27
+ type: string;
28
+ value: any;
29
+ }[];
30
+ memo: string;
31
+ };
@@ -0,0 +1,10 @@
1
+ import { getStdFee } from '@injectivelabs/utils';
2
+ export const createEip712StdSignDoc = ({ memo, chainId, accountNumber, timeoutHeight, sequence, gas, msgs, }) => ({
3
+ chain_id: chainId,
4
+ timeout_height: timeoutHeight || '',
5
+ account_number: accountNumber.toString(),
6
+ sequence: sequence.toString(),
7
+ fee: getStdFee({ gas }),
8
+ msgs: msgs.map((m) => m.toEip712()),
9
+ memo: memo || '',
10
+ });
@@ -0,0 +1,7 @@
1
+ import { Wallet } from './../types/enums.js';
2
+ export declare const isEvmWallet: (wallet: Wallet) => boolean;
3
+ export declare const isCosmosWallet: (wallet: Wallet) => boolean;
4
+ export declare const isEvmBrowserWallet: (wallet: Wallet) => boolean;
5
+ export declare const isCosmosBrowserWallet: (wallet: Wallet) => boolean;
6
+ export declare const isEip712V2OnlyWallet: (wallet: Wallet) => boolean;
7
+ export declare const isCosmosAminoOnlyWallet: (wallet: Wallet) => boolean;
@@ -0,0 +1,43 @@
1
+ import { Wallet } from './../types/enums.js';
2
+ export const isEvmWallet = (wallet) => [
3
+ Wallet.Magic,
4
+ Wallet.Rabby,
5
+ Wallet.BitGet,
6
+ Wallet.Ledger,
7
+ Wallet.Phantom,
8
+ Wallet.Rainbow,
9
+ Wallet.Turnkey,
10
+ Wallet.Metamask,
11
+ Wallet.OkxWallet,
12
+ Wallet.PrivateKey,
13
+ Wallet.TrezorBip32,
14
+ Wallet.TrezorBip44,
15
+ Wallet.TrustWallet,
16
+ Wallet.LedgerLegacy,
17
+ Wallet.WalletConnect,
18
+ Wallet.CosmostationEth,
19
+ ].includes(wallet);
20
+ export const isCosmosWallet = (wallet) => !isEvmWallet(wallet);
21
+ export const isEvmBrowserWallet = (wallet) => [
22
+ Wallet.Rabby,
23
+ Wallet.BitGet,
24
+ Wallet.Phantom,
25
+ Wallet.Rainbow,
26
+ Wallet.Metamask,
27
+ Wallet.OkxWallet,
28
+ Wallet.TrustWallet,
29
+ ].includes(wallet);
30
+ export const isCosmosBrowserWallet = (wallet) => [
31
+ Wallet.Leap,
32
+ Wallet.Keplr,
33
+ Wallet.Ninji,
34
+ Wallet.OWallet,
35
+ Wallet.Cosmostation,
36
+ ].includes(wallet);
37
+ export const isEip712V2OnlyWallet = (wallet) => [
38
+ Wallet.Magic,
39
+ Wallet.Phantom,
40
+ Wallet.Metamask,
41
+ Wallet.WalletConnect,
42
+ ].includes(wallet);
43
+ export const isCosmosAminoOnlyWallet = (wallet) => [Wallet.LedgerCosmos].includes(wallet);