@injectivelabs/wallet-core 1.15.0 → 1.15.2

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