@injectivelabs/wallet-core 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 (41) hide show
  1. package/dist/cjs/broadcaster/MsgBroadcaster.d.ts +137 -0
  2. package/dist/cjs/broadcaster/MsgBroadcaster.js +918 -0
  3. package/dist/cjs/broadcaster/Web3Broadcaster.d.ts +30 -0
  4. package/dist/cjs/broadcaster/Web3Broadcaster.js +32 -0
  5. package/dist/cjs/broadcaster/index.d.ts +3 -0
  6. package/dist/cjs/broadcaster/index.js +19 -0
  7. package/dist/cjs/broadcaster/types.d.ts +56 -0
  8. package/dist/cjs/broadcaster/types.js +13 -0
  9. package/dist/cjs/index.d.ts +3 -0
  10. package/dist/cjs/index.js +19 -0
  11. package/dist/cjs/package.json +2 -2
  12. package/dist/cjs/strategy/BaseWalletStrategy.d.ts +58 -0
  13. package/dist/cjs/strategy/BaseWalletStrategy.js +176 -0
  14. package/dist/cjs/strategy/index.d.ts +2 -0
  15. package/dist/cjs/strategy/index.js +8 -0
  16. package/dist/cjs/utils/index.d.ts +1 -0
  17. package/dist/cjs/utils/index.js +17 -0
  18. package/dist/cjs/utils/tx.d.ts +1 -0
  19. package/dist/cjs/utils/tx.js +11 -0
  20. package/dist/esm/broadcaster/MsgBroadcaster.d.ts +137 -0
  21. package/dist/esm/broadcaster/MsgBroadcaster.js +914 -0
  22. package/dist/esm/broadcaster/Web3Broadcaster.d.ts +30 -0
  23. package/dist/esm/broadcaster/Web3Broadcaster.js +28 -0
  24. package/dist/esm/broadcaster/index.d.ts +3 -0
  25. package/dist/esm/broadcaster/index.js +3 -0
  26. package/dist/esm/broadcaster/types.d.ts +56 -0
  27. package/dist/esm/broadcaster/types.js +10 -0
  28. package/dist/esm/index.d.ts +3 -281
  29. package/dist/esm/index.js +3 -1003
  30. package/dist/esm/package.json +2 -2
  31. package/dist/esm/strategy/BaseWalletStrategy.d.ts +58 -0
  32. package/dist/esm/strategy/BaseWalletStrategy.js +173 -0
  33. package/dist/esm/strategy/index.d.ts +2 -0
  34. package/dist/esm/strategy/index.js +2 -0
  35. package/dist/esm/utils/index.d.ts +1 -0
  36. package/dist/esm/utils/index.js +1 -0
  37. package/dist/esm/utils/tx.d.ts +1 -0
  38. package/dist/esm/utils/tx.js +7 -0
  39. package/package.json +19 -19
  40. package/dist/cjs/index.cjs +0 -1007
  41. package/dist/cjs/index.d.cts +0 -281
@@ -0,0 +1,137 @@
1
+ import { EvmChainId } from '@injectivelabs/ts-types';
2
+ import type { NetworkEndpoints } from '@injectivelabs/networks';
3
+ import type BaseWalletStrategy from '../strategy/BaseWalletStrategy.js';
4
+ import type { ChainId as ChainIdType, EvmChainId as EvmChainIdType } from '@injectivelabs/ts-types';
5
+ import type { MsgBroadcasterOptions, MsgBroadcasterTxOptions } from './types.js';
6
+ import type { TxResponse } from '@injectivelabs/sdk-ts';
7
+ /**
8
+ * This class is used to broadcast transactions
9
+ * using the WalletStrategy as a handler
10
+ * for the sign/broadcast flow of the transactions
11
+ *
12
+ * Mainly used for building UI products
13
+ */
14
+ export declare class MsgBroadcaster {
15
+ options: MsgBroadcasterOptions;
16
+ walletStrategy: BaseWalletStrategy;
17
+ endpoints: NetworkEndpoints;
18
+ chainId: ChainIdType;
19
+ txTimeout: number;
20
+ simulateTx: boolean;
21
+ txTimeoutOnFeeDelegation: boolean;
22
+ evmChainId?: EvmChainIdType;
23
+ gasBufferCoefficient: number;
24
+ retriesOnError: {
25
+ [x: string]: {
26
+ retries: number;
27
+ maxRetries: number;
28
+ timeout: number;
29
+ };
30
+ };
31
+ httpHeaders?: Record<string, string>;
32
+ constructor(options: MsgBroadcasterOptions);
33
+ setOptions(options: Partial<MsgBroadcasterOptions>): void;
34
+ getEvmChainId(): Promise<EvmChainId | undefined>;
35
+ /**
36
+ * Broadcasting the transaction using the client
37
+ * side approach for both cosmos and ethereum native wallets
38
+ *
39
+ * @param tx
40
+ * @returns {string} transaction hash
41
+ */
42
+ broadcast(tx: MsgBroadcasterTxOptions): Promise<TxResponse>;
43
+ /**
44
+ * Broadcasting the transaction using the client
45
+ * side approach for both cosmos and ethereum native wallets
46
+ * Note: using EIP712_V2 for Ethereum wallets
47
+ *
48
+ * @param tx
49
+ * @returns {string} transaction hash
50
+ */
51
+ broadcastV2(tx: MsgBroadcasterTxOptions): Promise<TxResponse>;
52
+ /**
53
+ * Broadcasting the transaction using the feeDelegation
54
+ * support approach for both cosmos and ethereum native wallets
55
+ *
56
+ * @param tx
57
+ * @returns {string} transaction hash
58
+ */
59
+ broadcastWithFeeDelegation(tx: MsgBroadcasterTxOptions): Promise<TxResponse>;
60
+ /**
61
+ * Prepare/sign/broadcast transaction using
62
+ * Ethereum native wallets on the client side.
63
+ *
64
+ * Note: Gas estimation not available
65
+ *
66
+ * @param tx The transaction that needs to be broadcasted
67
+ * @returns transaction hash
68
+ */
69
+ private broadcastEip712;
70
+ /**
71
+ * Prepare/sign/broadcast transaction using
72
+ * Ethereum native wallets on the client side.
73
+ *
74
+ * Note: Gas estimation not available
75
+ *
76
+ * @param tx The transaction that needs to be broadcasted
77
+ * @returns transaction hash
78
+ */
79
+ private broadcastEip712V2;
80
+ /**
81
+ * Prepare/sign/broadcast transaction using
82
+ * Ethereum native wallets using the Web3Gateway.
83
+ *
84
+ * @param tx The transaction that needs to be broadcasted
85
+ * @returns transaction hash
86
+ */
87
+ private broadcastEip712WithFeeDelegation;
88
+ /**
89
+ * Prepare/sign/broadcast transaction using
90
+ * Cosmos native wallets on the client side.
91
+ *
92
+ * @param tx The transaction that needs to be broadcasted
93
+ * @returns transaction hash
94
+ */
95
+ private broadcastDirectSign;
96
+ /**
97
+ * We use this method only when we want to broadcast a transaction using Ledger on Keplr/Leap for Injective
98
+ *
99
+ * Note: Gas estimation not available
100
+ * @param tx the transaction that needs to be broadcasted
101
+ */
102
+ private experimentalBroadcastWalletThroughLedger;
103
+ /**
104
+ * Prepare/sign/broadcast transaction using
105
+ * Cosmos native wallets using the Web3Gateway.
106
+ *
107
+ * @param tx The transaction that needs to be broadcasted
108
+ * @returns transaction hash
109
+ */
110
+ private broadcastDirectSignWithFeeDelegation;
111
+ /**
112
+ * Fetch the fee payer's pub key from the web3 gateway
113
+ *
114
+ * Returns a base64 version of it
115
+ */
116
+ private fetchFeePayerPubKey;
117
+ private getStdFeeWithDynamicBaseFee;
118
+ /**
119
+ * In case we don't want to simulate the transaction
120
+ * we get the gas limit based on the message type.
121
+ *
122
+ * If we want to simulate the transaction we set the
123
+ * gas limit based on the simulation and add a small multiplier
124
+ * to be safe (factor of 1.2 as default)
125
+ */
126
+ private getTxWithSignersAndStdFee;
127
+ /**
128
+ * Create TxRaw and simulate it
129
+ */
130
+ private simulateTxRaw;
131
+ /**
132
+ * Create TxRaw and simulate it
133
+ */
134
+ private simulateTxWithSigners;
135
+ private retryOnException;
136
+ private fetchAccountAndBlockDetails;
137
+ }