@streamflow/common 7.2.0 → 7.2.1
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/solana/utils.js
CHANGED
|
@@ -167,11 +167,15 @@ async function executeTransaction(connection, tx, confirmationParams, throttlePa
|
|
|
167
167
|
* @param throttleParams.sendThrottler - throttler instance
|
|
168
168
|
* @returns Raw Promise Results - should be handled by the consumer and unwrapped accordingly
|
|
169
169
|
*/
|
|
170
|
-
async function executeMultipleTransactions(connection, txs, confirmationParams, { sendRate = 1, sendThrottler }) {
|
|
170
|
+
async function executeMultipleTransactions(connection, txs, confirmationParams, { sendRate = 1, sendThrottler, ...throttlingParams }) {
|
|
171
171
|
if (!sendThrottler) {
|
|
172
172
|
sendThrottler = (0, exports.buildSendThrottler)(sendRate);
|
|
173
173
|
}
|
|
174
|
-
return Promise.allSettled(txs.map((tx) => executeTransaction(connection, tx, confirmationParams, {
|
|
174
|
+
return Promise.allSettled(txs.map((tx) => executeTransaction(connection, tx, confirmationParams, {
|
|
175
|
+
...throttlingParams,
|
|
176
|
+
sendRate: sendRate,
|
|
177
|
+
sendThrottler: sendThrottler,
|
|
178
|
+
})));
|
|
175
179
|
}
|
|
176
180
|
/**
|
|
177
181
|
* Sends and confirm transaction in a loop, constantly re-broadcsting the tx until Blockheight expires.
|
|
@@ -186,7 +190,7 @@ async function executeMultipleTransactions(connection, txs, confirmationParams,
|
|
|
186
190
|
* @param throttleParams.sendRate - rate
|
|
187
191
|
* @param throttleParams.sendThrottler - throttler instance
|
|
188
192
|
*/
|
|
189
|
-
async function sendAndConfirmTransaction(connection, tx, { hash, context, commitment }, { sendRate = 1, sendThrottler }) {
|
|
193
|
+
async function sendAndConfirmTransaction(connection, tx, { hash, context, commitment }, { sendRate = 1, sendThrottler, waitBeforeConfirming }) {
|
|
190
194
|
const isVersioned = isTransactionVersioned(tx);
|
|
191
195
|
let signature;
|
|
192
196
|
if (isVersioned) {
|
|
@@ -221,7 +225,8 @@ async function sendAndConfirmTransaction(connection, tx, { hash, context, commit
|
|
|
221
225
|
}
|
|
222
226
|
throw e;
|
|
223
227
|
}
|
|
224
|
-
|
|
228
|
+
// Wait at least 5 slots (~400ms before confirming)
|
|
229
|
+
await (0, utils_js_1.sleep)(waitBeforeConfirming ?? 2000);
|
|
225
230
|
try {
|
|
226
231
|
const value = await confirmAndEnsureTransaction(connection, signature);
|
|
227
232
|
if (value) {
|
|
@@ -82,7 +82,7 @@ export declare function executeTransaction(connection: Connection, tx: Transacti
|
|
|
82
82
|
* @param throttleParams.sendThrottler - throttler instance
|
|
83
83
|
* @returns Raw Promise Results - should be handled by the consumer and unwrapped accordingly
|
|
84
84
|
*/
|
|
85
|
-
export declare function executeMultipleTransactions(connection: Connection, txs: (Transaction | VersionedTransaction)[], confirmationParams: ConfirmationParams, { sendRate, sendThrottler }: ThrottleParams): Promise<PromiseSettledResult<string>[]>;
|
|
85
|
+
export declare function executeMultipleTransactions(connection: Connection, txs: (Transaction | VersionedTransaction)[], confirmationParams: ConfirmationParams, { sendRate, sendThrottler, ...throttlingParams }: ThrottleParams): Promise<PromiseSettledResult<string>[]>;
|
|
86
86
|
/**
|
|
87
87
|
* Sends and confirm transaction in a loop, constantly re-broadcsting the tx until Blockheight expires.
|
|
88
88
|
* - we add additional 30 bocks to account for validators in an PRC pool divergence
|
|
@@ -96,7 +96,7 @@ export declare function executeMultipleTransactions(connection: Connection, txs:
|
|
|
96
96
|
* @param throttleParams.sendRate - rate
|
|
97
97
|
* @param throttleParams.sendThrottler - throttler instance
|
|
98
98
|
*/
|
|
99
|
-
export declare function sendAndConfirmTransaction(connection: Connection, tx: Transaction | VersionedTransaction, { hash, context, commitment }: ConfirmationParams, { sendRate, sendThrottler }: ThrottleParams): Promise<string>;
|
|
99
|
+
export declare function sendAndConfirmTransaction(connection: Connection, tx: Transaction | VersionedTransaction, { hash, context, commitment }: ConfirmationParams, { sendRate, sendThrottler, waitBeforeConfirming }: ThrottleParams): Promise<string>;
|
|
100
100
|
export declare function simulateTransaction(connection: Connection, tx: Transaction | VersionedTransaction): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>;
|
|
101
101
|
/**
|
|
102
102
|
* Confirms and validates transaction success once
|
package/dist/esm/solana/utils.js
CHANGED
|
@@ -140,11 +140,15 @@ export async function executeTransaction(connection, tx, confirmationParams, thr
|
|
|
140
140
|
* @param throttleParams.sendThrottler - throttler instance
|
|
141
141
|
* @returns Raw Promise Results - should be handled by the consumer and unwrapped accordingly
|
|
142
142
|
*/
|
|
143
|
-
export async function executeMultipleTransactions(connection, txs, confirmationParams, { sendRate = 1, sendThrottler }) {
|
|
143
|
+
export async function executeMultipleTransactions(connection, txs, confirmationParams, { sendRate = 1, sendThrottler, ...throttlingParams }) {
|
|
144
144
|
if (!sendThrottler) {
|
|
145
145
|
sendThrottler = buildSendThrottler(sendRate);
|
|
146
146
|
}
|
|
147
|
-
return Promise.allSettled(txs.map((tx) => executeTransaction(connection, tx, confirmationParams, {
|
|
147
|
+
return Promise.allSettled(txs.map((tx) => executeTransaction(connection, tx, confirmationParams, {
|
|
148
|
+
...throttlingParams,
|
|
149
|
+
sendRate: sendRate,
|
|
150
|
+
sendThrottler: sendThrottler,
|
|
151
|
+
})));
|
|
148
152
|
}
|
|
149
153
|
/**
|
|
150
154
|
* Sends and confirm transaction in a loop, constantly re-broadcsting the tx until Blockheight expires.
|
|
@@ -159,7 +163,7 @@ export async function executeMultipleTransactions(connection, txs, confirmationP
|
|
|
159
163
|
* @param throttleParams.sendRate - rate
|
|
160
164
|
* @param throttleParams.sendThrottler - throttler instance
|
|
161
165
|
*/
|
|
162
|
-
export async function sendAndConfirmTransaction(connection, tx, { hash, context, commitment }, { sendRate = 1, sendThrottler }) {
|
|
166
|
+
export async function sendAndConfirmTransaction(connection, tx, { hash, context, commitment }, { sendRate = 1, sendThrottler, waitBeforeConfirming }) {
|
|
163
167
|
const isVersioned = isTransactionVersioned(tx);
|
|
164
168
|
let signature;
|
|
165
169
|
if (isVersioned) {
|
|
@@ -194,7 +198,8 @@ export async function sendAndConfirmTransaction(connection, tx, { hash, context,
|
|
|
194
198
|
}
|
|
195
199
|
throw e;
|
|
196
200
|
}
|
|
197
|
-
|
|
201
|
+
// Wait at least 5 slots (~400ms before confirming)
|
|
202
|
+
await sleep(waitBeforeConfirming ?? 2000);
|
|
198
203
|
try {
|
|
199
204
|
const value = await confirmAndEnsureTransaction(connection, signature);
|
|
200
205
|
if (value) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamflow/common",
|
|
3
|
-
"version": "7.2.
|
|
3
|
+
"version": "7.2.1",
|
|
4
4
|
"description": "Common utilities and types used by streamflow packages.",
|
|
5
5
|
"homepage": "https://github.com/streamflow-finance/js-sdk/",
|
|
6
6
|
"main": "./dist/esm/index.js",
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"lint-config": "eslint --print-config",
|
|
28
28
|
"prepublishOnly": "npm run lint && npm run build"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "56f65828955f62400c0b2eebaeb53c7f123dca60",
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@streamflow/eslint-config": "7.2.
|
|
32
|
+
"@streamflow/eslint-config": "7.2.1",
|
|
33
33
|
"@types/bn.js": "5.1.1",
|
|
34
34
|
"date-fns": "2.28.0",
|
|
35
35
|
"typescript": "^5.6.3"
|