@injectivelabs/wallet-core 1.20.7 → 1.20.9
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.
- package/dist/cjs/BaseWalletStrategy-Bvs5nQRI.d.cts +71 -0
- package/dist/cjs/broadcaster-CPCJe4Al.cjs +1076 -0
- package/dist/cjs/broadcaster.cjs +5 -0
- package/dist/cjs/broadcaster.d.cts +3 -0
- package/dist/cjs/defineProperty-CImP5zIM.cjs +49 -0
- package/dist/cjs/index-DLoAMD9J.d.cts +1 -0
- package/dist/cjs/index-NsR1NUse.d.cts +246 -0
- package/dist/cjs/index.cjs +8 -1248
- package/dist/cjs/index.d.cts +3 -309
- package/dist/cjs/strategy-D8mmr647.cjs +167 -0
- package/dist/cjs/strategy.cjs +4 -0
- package/dist/cjs/strategy.d.cts +3 -0
- package/dist/esm/BaseWalletStrategy-D2xNJmzo.d.ts +71 -0
- package/dist/esm/broadcaster-CA8Ix8IA.js +1059 -0
- package/dist/esm/broadcaster.d.ts +3 -0
- package/dist/esm/broadcaster.js +4 -0
- package/dist/esm/defineProperty-D4YE9KXX.js +43 -0
- package/dist/esm/index-B98CLRUl.d.ts +246 -0
- package/dist/esm/index-DRYular4.d.ts +1 -0
- package/dist/esm/index.d.ts +3 -309
- package/dist/esm/index.js +3 -1243
- package/dist/esm/strategy-DU-V-GfI.js +162 -0
- package/dist/esm/strategy.d.ts +3 -0
- package/dist/esm/strategy.js +4 -0
- package/package.json +47 -7
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import "./BaseWalletStrategy-Bvs5nQRI.cjs";
|
|
2
|
+
import { a as MsgBroadcasterTxOptionsWithAddresses, i as MsgBroadcasterTxOptions, n as MsgBroadcaster, r as MsgBroadcasterOptions, t as Web3Broadcaster } from "./index-NsR1NUse.cjs";
|
|
3
|
+
export { MsgBroadcaster, MsgBroadcasterOptions, MsgBroadcasterTxOptions, MsgBroadcasterTxOptionsWithAddresses, Web3Broadcaster };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
|
|
2
|
+
//#region \0@oxc-project+runtime@0.99.0/helpers/typeof.js
|
|
3
|
+
function _typeof(o) {
|
|
4
|
+
"@babel/helpers - typeof";
|
|
5
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
|
|
6
|
+
return typeof o$1;
|
|
7
|
+
} : function(o$1) {
|
|
8
|
+
return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
|
|
9
|
+
}, _typeof(o);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region \0@oxc-project+runtime@0.99.0/helpers/toPrimitive.js
|
|
14
|
+
function toPrimitive(t, r) {
|
|
15
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
16
|
+
var e = t[Symbol.toPrimitive];
|
|
17
|
+
if (void 0 !== e) {
|
|
18
|
+
var i = e.call(t, r || "default");
|
|
19
|
+
if ("object" != _typeof(i)) return i;
|
|
20
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
21
|
+
}
|
|
22
|
+
return ("string" === r ? String : Number)(t);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region \0@oxc-project+runtime@0.99.0/helpers/toPropertyKey.js
|
|
27
|
+
function toPropertyKey(t) {
|
|
28
|
+
var i = toPrimitive(t, "string");
|
|
29
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region \0@oxc-project+runtime@0.99.0/helpers/defineProperty.js
|
|
34
|
+
function _defineProperty(e, r, t) {
|
|
35
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
36
|
+
value: t,
|
|
37
|
+
enumerable: !0,
|
|
38
|
+
configurable: !0,
|
|
39
|
+
writable: !0
|
|
40
|
+
}) : e[r] = t, e;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
Object.defineProperty(exports, '_defineProperty', {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function () {
|
|
47
|
+
return _defineProperty;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { t as BaseWalletStrategy } from "./BaseWalletStrategy-Bvs5nQRI.cjs";
|
|
2
|
+
import { Msgs } from "@injectivelabs/sdk-ts/core/modules";
|
|
3
|
+
import { ChainId, EvmChainId } from "@injectivelabs/ts-types";
|
|
4
|
+
import { Network, NetworkEndpoints } from "@injectivelabs/networks";
|
|
5
|
+
import { AuthBaseAccount } from "@injectivelabs/sdk-ts/client/chain";
|
|
6
|
+
import { TxClientInclusionOptions, TxResponse } from "@injectivelabs/sdk-ts/core/tx";
|
|
7
|
+
|
|
8
|
+
//#region src/broadcaster/types.d.ts
|
|
9
|
+
interface MsgBroadcasterTxOptions {
|
|
10
|
+
memo?: string;
|
|
11
|
+
msgs: Msgs | Msgs[];
|
|
12
|
+
ethereumAddress?: string;
|
|
13
|
+
injectiveAddress?: string;
|
|
14
|
+
accountDetails?: AuthBaseAccount;
|
|
15
|
+
txTimeoutInBlocks?: number;
|
|
16
|
+
txInclusion?: TxClientInclusionOptions;
|
|
17
|
+
gas?: {
|
|
18
|
+
gasPrice?: string;
|
|
19
|
+
gas?: number; /** gas limit */
|
|
20
|
+
feePayer?: string;
|
|
21
|
+
granter?: string;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
interface MsgBroadcasterTxOptionsWithAddresses extends MsgBroadcasterTxOptions {
|
|
25
|
+
ethereumAddress: string;
|
|
26
|
+
injectiveAddress: string;
|
|
27
|
+
}
|
|
28
|
+
interface MsgBroadcasterOptions {
|
|
29
|
+
network: Network;
|
|
30
|
+
endpoints?: NetworkEndpoints;
|
|
31
|
+
chainId?: ChainId;
|
|
32
|
+
evmChainId?: EvmChainId;
|
|
33
|
+
feePayerPubKey?: string;
|
|
34
|
+
simulateTx?: boolean;
|
|
35
|
+
txTimeoutOnFeeDelegation?: boolean;
|
|
36
|
+
txTimeout?: number;
|
|
37
|
+
txInclusion?: TxClientInclusionOptions;
|
|
38
|
+
walletStrategy: BaseWalletStrategy;
|
|
39
|
+
gasBufferCoefficient?: number;
|
|
40
|
+
httpHeaders?: Record<string, string>;
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/broadcaster/MsgBroadcaster.d.ts
|
|
44
|
+
/**
|
|
45
|
+
* This class is used to broadcast transactions
|
|
46
|
+
* using the WalletStrategy as a handler
|
|
47
|
+
* for the sign/broadcast flow of the transactions
|
|
48
|
+
*
|
|
49
|
+
* Mainly used for building UI products
|
|
50
|
+
*/
|
|
51
|
+
declare class MsgBroadcaster {
|
|
52
|
+
options: MsgBroadcasterOptions;
|
|
53
|
+
walletStrategy: BaseWalletStrategy;
|
|
54
|
+
endpoints: NetworkEndpoints;
|
|
55
|
+
chainId: ChainId;
|
|
56
|
+
txTimeout: number;
|
|
57
|
+
simulateTx: boolean;
|
|
58
|
+
txTimeoutOnFeeDelegation: boolean;
|
|
59
|
+
evmChainId?: EvmChainId;
|
|
60
|
+
gasBufferCoefficient: number;
|
|
61
|
+
retriesOnError: {
|
|
62
|
+
[x: string]: {
|
|
63
|
+
retries: number;
|
|
64
|
+
maxRetries: number;
|
|
65
|
+
timeout: number;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
httpHeaders?: Record<string, string>;
|
|
69
|
+
txInclusion?: TxClientInclusionOptions;
|
|
70
|
+
constructor(options: MsgBroadcasterOptions);
|
|
71
|
+
setOptions(options: Partial<MsgBroadcasterOptions>): void;
|
|
72
|
+
getEvmChainId(): Promise<EvmChainId | undefined>;
|
|
73
|
+
/**
|
|
74
|
+
* Broadcasting the transaction using the client
|
|
75
|
+
* side approach for both cosmos and ethereum native wallets
|
|
76
|
+
*
|
|
77
|
+
* @param tx
|
|
78
|
+
* @returns {string} transaction hash
|
|
79
|
+
*/
|
|
80
|
+
broadcast(tx: MsgBroadcasterTxOptions): Promise<TxResponse>;
|
|
81
|
+
/**
|
|
82
|
+
* Broadcasting the transaction using the client
|
|
83
|
+
* side approach for both cosmos and ethereum native wallets
|
|
84
|
+
* Note: using EIP712_V2 for Ethereum wallets
|
|
85
|
+
*
|
|
86
|
+
* @param tx
|
|
87
|
+
* @returns {string} transaction hash
|
|
88
|
+
*/
|
|
89
|
+
broadcastV2(tx: MsgBroadcasterTxOptions): Promise<TxResponse>;
|
|
90
|
+
/**
|
|
91
|
+
* Broadcasting the transaction using the feeDelegation
|
|
92
|
+
* support approach for both cosmos and ethereum native wallets
|
|
93
|
+
*
|
|
94
|
+
* @param tx
|
|
95
|
+
* @returns {string} transaction hash
|
|
96
|
+
*/
|
|
97
|
+
broadcastWithFeeDelegation(tx: MsgBroadcasterTxOptions): Promise<TxResponse>;
|
|
98
|
+
/**
|
|
99
|
+
* Sign and broadcast a pre-built transaction whose fee payer signature
|
|
100
|
+
* is already provided (e.g. from the RFQ executor / web3-gw `prepare`
|
|
101
|
+
* endpoint). The taker is signed locally with the supplied private key.
|
|
102
|
+
*
|
|
103
|
+
* Autosign-only: the caller passes the autosign private key directly
|
|
104
|
+
* (e.g. `sharedWalletStore.autoSign.privateKey`). We don't go through
|
|
105
|
+
* `walletStrategy.signCosmosTransaction` because the PK strategy stubs
|
|
106
|
+
* that out — and going through the wallet strategy would defeat the
|
|
107
|
+
* point of autosign (no popups).
|
|
108
|
+
*
|
|
109
|
+
* @param tx Base64-encoded or raw `TxRaw` bytes returned by the prepare endpoint
|
|
110
|
+
* @param feePayerSig Hex (`0x...`) or base64 fee payer signature
|
|
111
|
+
* @param accountNumber Account number of the taker
|
|
112
|
+
* @param privateKey Taker (autosign) private key — hex, with or without `0x`
|
|
113
|
+
* @returns transaction response with txHash
|
|
114
|
+
*/
|
|
115
|
+
broadcastWithFeePayerSig({
|
|
116
|
+
tx,
|
|
117
|
+
privateKey,
|
|
118
|
+
feePayerSig,
|
|
119
|
+
accountNumber,
|
|
120
|
+
txInclusion,
|
|
121
|
+
txTimeoutInBlocks: txTimeoutInBlocksParam
|
|
122
|
+
}: {
|
|
123
|
+
privateKey: string;
|
|
124
|
+
feePayerSig: string;
|
|
125
|
+
accountNumber: number;
|
|
126
|
+
tx: Uint8Array | string;
|
|
127
|
+
txInclusion?: TxClientInclusionOptions;
|
|
128
|
+
txTimeoutInBlocks?: number;
|
|
129
|
+
}): Promise<TxResponse>;
|
|
130
|
+
/**
|
|
131
|
+
* Prepare/sign/broadcast transaction using
|
|
132
|
+
* Ethereum native wallets on the client side.
|
|
133
|
+
*
|
|
134
|
+
* Note: Gas estimation not available
|
|
135
|
+
*
|
|
136
|
+
* @param tx The transaction that needs to be broadcasted
|
|
137
|
+
* @returns transaction hash
|
|
138
|
+
*/
|
|
139
|
+
private broadcastEip712;
|
|
140
|
+
/**
|
|
141
|
+
* Prepare/sign/broadcast transaction using
|
|
142
|
+
* Ethereum native wallets on the client side.
|
|
143
|
+
*
|
|
144
|
+
* Note: Gas estimation not available
|
|
145
|
+
*
|
|
146
|
+
* @param tx The transaction that needs to be broadcasted
|
|
147
|
+
* @returns transaction hash
|
|
148
|
+
*/
|
|
149
|
+
private broadcastEip712V2;
|
|
150
|
+
/**
|
|
151
|
+
* Prepare/sign/broadcast transaction using
|
|
152
|
+
* Ethereum native wallets using the Web3Gateway.
|
|
153
|
+
*
|
|
154
|
+
* @param tx The transaction that needs to be broadcasted
|
|
155
|
+
* @returns transaction hash
|
|
156
|
+
*/
|
|
157
|
+
private broadcastEip712WithFeeDelegation;
|
|
158
|
+
/**
|
|
159
|
+
* Prepare/sign/broadcast transaction using
|
|
160
|
+
* Cosmos native wallets on the client side.
|
|
161
|
+
*
|
|
162
|
+
* @param tx The transaction that needs to be broadcasted
|
|
163
|
+
* @returns transaction hash
|
|
164
|
+
*/
|
|
165
|
+
private broadcastDirectSign;
|
|
166
|
+
/**
|
|
167
|
+
* We use this method only when we want to broadcast a transaction using Ledger on Keplr/Leap for Injective
|
|
168
|
+
*
|
|
169
|
+
* Note: Gas estimation not available
|
|
170
|
+
* @param tx the transaction that needs to be broadcasted
|
|
171
|
+
*/
|
|
172
|
+
private experimentalBroadcastWalletThroughLedger;
|
|
173
|
+
/**
|
|
174
|
+
* Prepare/sign/broadcast transaction using
|
|
175
|
+
* Cosmos native wallets using the Web3Gateway.
|
|
176
|
+
*
|
|
177
|
+
* @param tx The transaction that needs to be broadcasted
|
|
178
|
+
* @returns transaction hash
|
|
179
|
+
*/
|
|
180
|
+
private broadcastDirectSignWithFeeDelegation;
|
|
181
|
+
/**
|
|
182
|
+
* Fetch the fee payer's pub key from the web3 gateway
|
|
183
|
+
*
|
|
184
|
+
* Returns a base64 version of it
|
|
185
|
+
*/
|
|
186
|
+
private fetchFeePayerPubKey;
|
|
187
|
+
private getStdFeeWithDynamicBaseFee;
|
|
188
|
+
/**
|
|
189
|
+
* In case we don't want to simulate the transaction
|
|
190
|
+
* we get the gas limit based on the message type.
|
|
191
|
+
*
|
|
192
|
+
* If we want to simulate the transaction we set the
|
|
193
|
+
* gas limit based on the simulation and add a small multiplier
|
|
194
|
+
* to be safe (factor of 1.2 as default)
|
|
195
|
+
*/
|
|
196
|
+
private getTxWithSignersAndStdFee;
|
|
197
|
+
/**
|
|
198
|
+
* Create TxRaw and simulate it
|
|
199
|
+
*/
|
|
200
|
+
private simulateTxRaw;
|
|
201
|
+
/**
|
|
202
|
+
* Create TxRaw and simulate it
|
|
203
|
+
*/
|
|
204
|
+
private simulateTxWithSigners;
|
|
205
|
+
private retryOnException;
|
|
206
|
+
private fetchAccountAndBlockDetails;
|
|
207
|
+
private resolveTimeoutInBlocks;
|
|
208
|
+
private resolveTxInclusionOptions;
|
|
209
|
+
private createTxGrpcApi;
|
|
210
|
+
private waitForTxInclusion;
|
|
211
|
+
private prepareTxInclusionWaiter;
|
|
212
|
+
private waitForPreparedTxInclusion;
|
|
213
|
+
}
|
|
214
|
+
//#endregion
|
|
215
|
+
//#region src/broadcaster/Web3Broadcaster.d.ts
|
|
216
|
+
interface SendTransactionOptions {
|
|
217
|
+
tx: {
|
|
218
|
+
from: string;
|
|
219
|
+
to: string;
|
|
220
|
+
gas: string;
|
|
221
|
+
maxFeePerGas: string;
|
|
222
|
+
maxPriorityFeePerGas: string | null;
|
|
223
|
+
data: any;
|
|
224
|
+
};
|
|
225
|
+
address: string;
|
|
226
|
+
evmChainId?: EvmChainId;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Preparing and broadcasting
|
|
230
|
+
* Ethereum transactions
|
|
231
|
+
*/
|
|
232
|
+
declare class Web3Broadcaster {
|
|
233
|
+
private walletStrategy;
|
|
234
|
+
private evmChainId;
|
|
235
|
+
constructor({
|
|
236
|
+
walletStrategy,
|
|
237
|
+
evmChainId
|
|
238
|
+
}: {
|
|
239
|
+
walletStrategy: BaseWalletStrategy;
|
|
240
|
+
evmChainId: EvmChainId;
|
|
241
|
+
network: Network;
|
|
242
|
+
});
|
|
243
|
+
sendTransaction(args: SendTransactionOptions): Promise<string>;
|
|
244
|
+
}
|
|
245
|
+
//#endregion
|
|
246
|
+
export { MsgBroadcasterTxOptionsWithAddresses as a, MsgBroadcasterTxOptions as i, MsgBroadcaster as n, MsgBroadcasterOptions as r, Web3Broadcaster as t };
|