@hyperbridge/sdk 1.9.0 → 1.9.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/browser/index.d.ts +8 -6
- package/dist/browser/index.js +18 -14
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.d.ts +8 -6
- package/dist/node/index.js +18 -14
- package/dist/node/index.js.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.d.ts
CHANGED
|
@@ -2980,7 +2980,8 @@ interface SelectBidResult {
|
|
|
2980
2980
|
interface ExecuteIntentOrderOptions {
|
|
2981
2981
|
order: Order;
|
|
2982
2982
|
sessionPrivateKey?: HexString;
|
|
2983
|
-
|
|
2983
|
+
/** Duration in ms to collect bids before selecting the best one. */
|
|
2984
|
+
auctionTimeMs: number;
|
|
2984
2985
|
pollIntervalMs?: number;
|
|
2985
2986
|
/**
|
|
2986
2987
|
* If set, bids are restricted to the given solver until `timeoutMs` elapses,
|
|
@@ -2996,7 +2997,8 @@ interface ExecuteIntentOrderOptions {
|
|
|
2996
2997
|
/** Options for resuming execution of a previously placed intent order */
|
|
2997
2998
|
interface ResumeIntentOrderOptions {
|
|
2998
2999
|
sessionPrivateKey?: HexString;
|
|
2999
|
-
|
|
3000
|
+
/** Duration in ms to collect bids before selecting the best one. */
|
|
3001
|
+
auctionTimeMs: number;
|
|
3000
3002
|
pollIntervalMs?: number;
|
|
3001
3003
|
solver?: {
|
|
3002
3004
|
address: HexString;
|
|
@@ -3986,16 +3988,16 @@ declare class IntentGateway {
|
|
|
3986
3988
|
* @param options - Optional tuning parameters:
|
|
3987
3989
|
* - `maxPriorityFeePerGasBumpPercent` — bump % for the priority fee estimate (default 8).
|
|
3988
3990
|
* - `maxFeePerGasBumpPercent` — bump % for the max fee estimate (default 10).
|
|
3989
|
-
* - `
|
|
3991
|
+
* - `auctionTimeMs` — duration in ms to collect bids before selecting the best one.
|
|
3990
3992
|
* - `pollIntervalMs` — interval between bid-polling attempts.
|
|
3991
3993
|
* @yields {@link IntentOrderStatusUpdate} at each lifecycle stage.
|
|
3992
3994
|
* @throws If the `placeOrder` generator behaves unexpectedly, or if gas
|
|
3993
3995
|
* estimation returns zero.
|
|
3994
3996
|
*/
|
|
3995
|
-
execute(order: Order, graffiti
|
|
3997
|
+
execute(order: Order, graffiti: HexString | undefined, options: {
|
|
3998
|
+
auctionTimeMs: number;
|
|
3996
3999
|
maxPriorityFeePerGasBumpPercent?: number;
|
|
3997
4000
|
maxFeePerGasBumpPercent?: number;
|
|
3998
|
-
minBids?: number;
|
|
3999
4001
|
pollIntervalMs?: number;
|
|
4000
4002
|
solver?: {
|
|
4001
4003
|
address: HexString;
|
|
@@ -4029,7 +4031,7 @@ declare class IntentGateway {
|
|
|
4029
4031
|
* @yields {@link IntentOrderStatusUpdate} at each execution stage.
|
|
4030
4032
|
* @throws If the order is missing required fields for resumption.
|
|
4031
4033
|
*/
|
|
4032
|
-
resume(order: Order, options
|
|
4034
|
+
resume(order: Order, options: ResumeIntentOrderOptions): AsyncGenerator<IntentOrderStatusUpdate, void>;
|
|
4033
4035
|
/**
|
|
4034
4036
|
* Returns both the native token cost and the relayer fee for cancelling an
|
|
4035
4037
|
* order. Use `relayerFee` to approve the ERC-20 spend before submitting.
|
package/dist/browser/index.js
CHANGED
|
@@ -15327,12 +15327,12 @@ var OrderExecutor = class {
|
|
|
15327
15327
|
*/
|
|
15328
15328
|
async *deadlineStream(deadline, commitment) {
|
|
15329
15329
|
const client = this.ctx.dest.client;
|
|
15330
|
-
const
|
|
15330
|
+
const blockTimeMs = client.chain?.blockTime ?? 2e3;
|
|
15331
15331
|
while (true) {
|
|
15332
15332
|
const currentBlock = await client.getBlockNumber();
|
|
15333
15333
|
if (currentBlock >= deadline) break;
|
|
15334
15334
|
const blocksRemaining = Number(deadline - currentBlock);
|
|
15335
|
-
const sleepMs = blocksRemaining *
|
|
15335
|
+
const sleepMs = blocksRemaining * blockTimeMs;
|
|
15336
15336
|
await sleep(sleepMs);
|
|
15337
15337
|
}
|
|
15338
15338
|
yield {
|
|
@@ -15476,7 +15476,7 @@ var OrderExecutor = class {
|
|
|
15476
15476
|
* (terminates — settlement is confirmed async via Hyperbridge)
|
|
15477
15477
|
*/
|
|
15478
15478
|
async *executeOrder(options) {
|
|
15479
|
-
const { order, sessionPrivateKey,
|
|
15479
|
+
const { order, sessionPrivateKey, auctionTimeMs, pollIntervalMs = DEFAULT_POLL_INTERVAL, solver } = options;
|
|
15480
15480
|
const commitment = order.id;
|
|
15481
15481
|
const isSameChain = order.source === order.destination;
|
|
15482
15482
|
if (!this.ctx.intentsCoprocessor) {
|
|
@@ -15496,7 +15496,7 @@ var OrderExecutor = class {
|
|
|
15496
15496
|
order,
|
|
15497
15497
|
sessionPrivateKey,
|
|
15498
15498
|
commitment,
|
|
15499
|
-
|
|
15499
|
+
auctionTimeMs,
|
|
15500
15500
|
pollIntervalMs,
|
|
15501
15501
|
solver,
|
|
15502
15502
|
usedUserOps,
|
|
@@ -15523,7 +15523,7 @@ var OrderExecutor = class {
|
|
|
15523
15523
|
order,
|
|
15524
15524
|
sessionPrivateKey,
|
|
15525
15525
|
commitment,
|
|
15526
|
-
|
|
15526
|
+
auctionTimeMs,
|
|
15527
15527
|
pollIntervalMs,
|
|
15528
15528
|
solver,
|
|
15529
15529
|
usedUserOps,
|
|
@@ -15534,6 +15534,10 @@ var OrderExecutor = class {
|
|
|
15534
15534
|
const solverLockStartTime = Date.now();
|
|
15535
15535
|
yield { status: "AWAITING_BIDS", commitment, totalFilledAssets, remainingAssets };
|
|
15536
15536
|
try {
|
|
15537
|
+
const auctionEnd = Date.now() + auctionTimeMs;
|
|
15538
|
+
while (Date.now() < auctionEnd) {
|
|
15539
|
+
await sleep(Math.min(pollIntervalMs, auctionEnd - Date.now()));
|
|
15540
|
+
}
|
|
15537
15541
|
while (true) {
|
|
15538
15542
|
let freshBids;
|
|
15539
15543
|
try {
|
|
@@ -15543,7 +15547,7 @@ var OrderExecutor = class {
|
|
|
15543
15547
|
await sleep(pollIntervalMs);
|
|
15544
15548
|
continue;
|
|
15545
15549
|
}
|
|
15546
|
-
if (freshBids.length
|
|
15550
|
+
if (freshBids.length === 0) {
|
|
15547
15551
|
await sleep(pollIntervalMs);
|
|
15548
15552
|
continue;
|
|
15549
15553
|
}
|
|
@@ -18774,7 +18778,7 @@ var IntentGateway = class _IntentGateway {
|
|
|
18774
18778
|
* @param options - Optional tuning parameters:
|
|
18775
18779
|
* - `maxPriorityFeePerGasBumpPercent` — bump % for the priority fee estimate (default 8).
|
|
18776
18780
|
* - `maxFeePerGasBumpPercent` — bump % for the max fee estimate (default 10).
|
|
18777
|
-
* - `
|
|
18781
|
+
* - `auctionTimeMs` — duration in ms to collect bids before selecting the best one.
|
|
18778
18782
|
* - `pollIntervalMs` — interval between bid-polling attempts.
|
|
18779
18783
|
* @yields {@link IntentOrderStatusUpdate} at each lifecycle stage.
|
|
18780
18784
|
* @throws If the `placeOrder` generator behaves unexpectedly, or if gas
|
|
@@ -18810,9 +18814,9 @@ var IntentGateway = class _IntentGateway {
|
|
|
18810
18814
|
for await (const status of this.orderExecutor.executeOrder({
|
|
18811
18815
|
order: finalizedOrder,
|
|
18812
18816
|
sessionPrivateKey,
|
|
18813
|
-
|
|
18814
|
-
pollIntervalMs: options
|
|
18815
|
-
solver: options
|
|
18817
|
+
auctionTimeMs: options.auctionTimeMs,
|
|
18818
|
+
pollIntervalMs: options.pollIntervalMs,
|
|
18819
|
+
solver: options.solver
|
|
18816
18820
|
})) {
|
|
18817
18821
|
yield status;
|
|
18818
18822
|
}
|
|
@@ -18856,10 +18860,10 @@ var IntentGateway = class _IntentGateway {
|
|
|
18856
18860
|
this.assertOrderCanResume(order);
|
|
18857
18861
|
for await (const status of this.orderExecutor.executeOrder({
|
|
18858
18862
|
order,
|
|
18859
|
-
sessionPrivateKey: options
|
|
18860
|
-
|
|
18861
|
-
pollIntervalMs: options
|
|
18862
|
-
solver: options
|
|
18863
|
+
sessionPrivateKey: options.sessionPrivateKey,
|
|
18864
|
+
auctionTimeMs: options.auctionTimeMs,
|
|
18865
|
+
pollIntervalMs: options.pollIntervalMs,
|
|
18866
|
+
solver: options.solver
|
|
18863
18867
|
})) {
|
|
18864
18868
|
yield status;
|
|
18865
18869
|
}
|