@hyperbridge/sdk 1.6.7 → 1.7.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.
@@ -4036,7 +4036,8 @@ var RequestKind = /* @__PURE__ */ ((RequestKind2) => {
4036
4036
  return RequestKind2;
4037
4037
  })(RequestKind || {});
4038
4038
  var IntentOrderStatus = Object.freeze({
4039
- ORDER_SUBMITTED: "ORDER_SUBMITTED",
4039
+ AWAITING_PLACE_ORDER: "AWAITING_PLACE_ORDER",
4040
+ ORDER_PLACED: "ORDER_PLACED",
4040
4041
  ORDER_CONFIRMED: "ORDER_CONFIRMED",
4041
4042
  AWAITING_BIDS: "AWAITING_BIDS",
4042
4043
  BIDS_RECEIVED: "BIDS_RECEIVED",
@@ -4044,948 +4045,2116 @@ var IntentOrderStatus = Object.freeze({
4044
4045
  USEROP_SUBMITTED: "USEROP_SUBMITTED",
4045
4046
  FILLED: "FILLED",
4046
4047
  PARTIAL_FILL: "PARTIAL_FILL",
4048
+ PARTIAL_FILL_EXHAUSTED: "PARTIAL_FILL_EXHAUSTED",
4047
4049
  FAILED: "FAILED"
4048
4050
  });
4049
4051
 
4050
4052
  // src/abis/IntentGatewayV2.ts
4051
4053
  var ABI3 = [
4052
4054
  {
4053
- type: "constructor",
4054
- inputs: [{ name: "admin", type: "address", internalType: "address" }],
4055
- stateMutability: "nonpayable"
4055
+ "type": "constructor",
4056
+ "inputs": [
4057
+ {
4058
+ "name": "admin",
4059
+ "type": "address",
4060
+ "internalType": "address"
4061
+ }
4062
+ ],
4063
+ "stateMutability": "nonpayable"
4056
4064
  },
4057
- { type: "receive", stateMutability: "payable" },
4058
4065
  {
4059
- type: "function",
4060
- name: "DOMAIN_SEPARATOR",
4061
- inputs: [],
4062
- outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
4063
- stateMutability: "view"
4066
+ "type": "receive",
4067
+ "stateMutability": "payable"
4064
4068
  },
4065
4069
  {
4066
- type: "function",
4067
- name: "SELECT_SOLVER_TYPEHASH",
4068
- inputs: [],
4069
- outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
4070
- stateMutability: "view"
4070
+ "type": "function",
4071
+ "name": "DOMAIN_SEPARATOR",
4072
+ "inputs": [],
4073
+ "outputs": [
4074
+ {
4075
+ "name": "",
4076
+ "type": "bytes32",
4077
+ "internalType": "bytes32"
4078
+ }
4079
+ ],
4080
+ "stateMutability": "view"
4071
4081
  },
4072
4082
  {
4073
- type: "function",
4074
- name: "_destinationProtocolFees",
4075
- inputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
4076
- outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
4077
- stateMutability: "view"
4083
+ "type": "function",
4084
+ "name": "SELECT_SOLVER_TYPEHASH",
4085
+ "inputs": [],
4086
+ "outputs": [
4087
+ {
4088
+ "name": "",
4089
+ "type": "bytes32",
4090
+ "internalType": "bytes32"
4091
+ }
4092
+ ],
4093
+ "stateMutability": "view"
4078
4094
  },
4079
4095
  {
4080
- type: "function",
4081
- name: "_filled",
4082
- inputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
4083
- outputs: [{ name: "", type: "address", internalType: "address" }],
4084
- stateMutability: "view"
4096
+ "type": "function",
4097
+ "name": "_destinationProtocolFees",
4098
+ "inputs": [
4099
+ {
4100
+ "name": "",
4101
+ "type": "bytes32",
4102
+ "internalType": "bytes32"
4103
+ }
4104
+ ],
4105
+ "outputs": [
4106
+ {
4107
+ "name": "",
4108
+ "type": "uint256",
4109
+ "internalType": "uint256"
4110
+ }
4111
+ ],
4112
+ "stateMutability": "view"
4085
4113
  },
4086
4114
  {
4087
- type: "function",
4088
- name: "_instances",
4089
- inputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
4090
- outputs: [{ name: "", type: "address", internalType: "address" }],
4091
- stateMutability: "view"
4115
+ "type": "function",
4116
+ "name": "_filled",
4117
+ "inputs": [
4118
+ {
4119
+ "name": "",
4120
+ "type": "bytes32",
4121
+ "internalType": "bytes32"
4122
+ }
4123
+ ],
4124
+ "outputs": [
4125
+ {
4126
+ "name": "",
4127
+ "type": "address",
4128
+ "internalType": "address"
4129
+ }
4130
+ ],
4131
+ "stateMutability": "view"
4092
4132
  },
4093
4133
  {
4094
- type: "function",
4095
- name: "_nonce",
4096
- inputs: [],
4097
- outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
4098
- stateMutability: "view"
4134
+ "type": "function",
4135
+ "name": "_instances",
4136
+ "inputs": [
4137
+ {
4138
+ "name": "",
4139
+ "type": "bytes32",
4140
+ "internalType": "bytes32"
4141
+ }
4142
+ ],
4143
+ "outputs": [
4144
+ {
4145
+ "name": "",
4146
+ "type": "address",
4147
+ "internalType": "address"
4148
+ }
4149
+ ],
4150
+ "stateMutability": "view"
4099
4151
  },
4100
4152
  {
4101
- type: "function",
4102
- name: "_orders",
4103
- inputs: [
4104
- { name: "", type: "bytes32", internalType: "bytes32" },
4105
- { name: "", type: "address", internalType: "address" }
4153
+ "type": "function",
4154
+ "name": "_nonce",
4155
+ "inputs": [],
4156
+ "outputs": [
4157
+ {
4158
+ "name": "",
4159
+ "type": "uint256",
4160
+ "internalType": "uint256"
4161
+ }
4106
4162
  ],
4107
- outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
4108
- stateMutability: "view"
4163
+ "stateMutability": "view"
4109
4164
  },
4110
4165
  {
4111
- type: "function",
4112
- name: "_partialFills",
4113
- inputs: [
4114
- { name: "", type: "bytes32", internalType: "bytes32" },
4115
- { name: "", type: "bytes32", internalType: "bytes32" }
4166
+ "type": "function",
4167
+ "name": "_orders",
4168
+ "inputs": [
4169
+ {
4170
+ "name": "",
4171
+ "type": "bytes32",
4172
+ "internalType": "bytes32"
4173
+ },
4174
+ {
4175
+ "name": "",
4176
+ "type": "address",
4177
+ "internalType": "address"
4178
+ }
4116
4179
  ],
4117
- outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
4118
- stateMutability: "view"
4180
+ "outputs": [
4181
+ {
4182
+ "name": "",
4183
+ "type": "uint256",
4184
+ "internalType": "uint256"
4185
+ }
4186
+ ],
4187
+ "stateMutability": "view"
4119
4188
  },
4120
4189
  {
4121
- type: "function",
4122
- name: "calculateCommitmentSlotHash",
4123
- inputs: [{ name: "commitment", type: "bytes32", internalType: "bytes32" }],
4124
- outputs: [{ name: "", type: "bytes", internalType: "bytes" }],
4125
- stateMutability: "pure"
4190
+ "type": "function",
4191
+ "name": "_partialFills",
4192
+ "inputs": [
4193
+ {
4194
+ "name": "",
4195
+ "type": "bytes32",
4196
+ "internalType": "bytes32"
4197
+ },
4198
+ {
4199
+ "name": "",
4200
+ "type": "bytes32",
4201
+ "internalType": "bytes32"
4202
+ }
4203
+ ],
4204
+ "outputs": [
4205
+ {
4206
+ "name": "",
4207
+ "type": "uint256",
4208
+ "internalType": "uint256"
4209
+ }
4210
+ ],
4211
+ "stateMutability": "view"
4126
4212
  },
4127
4213
  {
4128
- type: "function",
4129
- name: "cancelOrder",
4130
- inputs: [
4214
+ "type": "function",
4215
+ "name": "calculateCommitmentSlotHash",
4216
+ "inputs": [
4131
4217
  {
4132
- name: "order",
4133
- type: "tuple",
4134
- internalType: "struct Order",
4135
- components: [
4136
- { name: "user", type: "bytes32", internalType: "bytes32" },
4137
- { name: "source", type: "bytes", internalType: "bytes" },
4138
- { name: "destination", type: "bytes", internalType: "bytes" },
4139
- { name: "deadline", type: "uint256", internalType: "uint256" },
4140
- { name: "nonce", type: "uint256", internalType: "uint256" },
4141
- { name: "fees", type: "uint256", internalType: "uint256" },
4142
- { name: "session", type: "address", internalType: "address" },
4143
- {
4144
- name: "predispatch",
4145
- type: "tuple",
4146
- internalType: "struct DispatchInfo",
4147
- components: [
4218
+ "name": "commitment",
4219
+ "type": "bytes32",
4220
+ "internalType": "bytes32"
4221
+ }
4222
+ ],
4223
+ "outputs": [
4224
+ {
4225
+ "name": "",
4226
+ "type": "bytes",
4227
+ "internalType": "bytes"
4228
+ }
4229
+ ],
4230
+ "stateMutability": "pure"
4231
+ },
4232
+ {
4233
+ "type": "function",
4234
+ "name": "cancelOrder",
4235
+ "inputs": [
4236
+ {
4237
+ "name": "order",
4238
+ "type": "tuple",
4239
+ "internalType": "struct Order",
4240
+ "components": [
4241
+ {
4242
+ "name": "user",
4243
+ "type": "bytes32",
4244
+ "internalType": "bytes32"
4245
+ },
4246
+ {
4247
+ "name": "source",
4248
+ "type": "bytes",
4249
+ "internalType": "bytes"
4250
+ },
4251
+ {
4252
+ "name": "destination",
4253
+ "type": "bytes",
4254
+ "internalType": "bytes"
4255
+ },
4256
+ {
4257
+ "name": "deadline",
4258
+ "type": "uint256",
4259
+ "internalType": "uint256"
4260
+ },
4261
+ {
4262
+ "name": "nonce",
4263
+ "type": "uint256",
4264
+ "internalType": "uint256"
4265
+ },
4266
+ {
4267
+ "name": "fees",
4268
+ "type": "uint256",
4269
+ "internalType": "uint256"
4270
+ },
4271
+ {
4272
+ "name": "session",
4273
+ "type": "address",
4274
+ "internalType": "address"
4275
+ },
4276
+ {
4277
+ "name": "predispatch",
4278
+ "type": "tuple",
4279
+ "internalType": "struct DispatchInfo",
4280
+ "components": [
4148
4281
  {
4149
- name: "assets",
4150
- type: "tuple[]",
4151
- internalType: "struct TokenInfo[]",
4152
- components: [
4153
- { name: "token", type: "bytes32", internalType: "bytes32" },
4154
- { name: "amount", type: "uint256", internalType: "uint256" }
4282
+ "name": "assets",
4283
+ "type": "tuple[]",
4284
+ "internalType": "struct TokenInfo[]",
4285
+ "components": [
4286
+ {
4287
+ "name": "token",
4288
+ "type": "bytes32",
4289
+ "internalType": "bytes32"
4290
+ },
4291
+ {
4292
+ "name": "amount",
4293
+ "type": "uint256",
4294
+ "internalType": "uint256"
4295
+ }
4155
4296
  ]
4156
4297
  },
4157
- { name: "call", type: "bytes", internalType: "bytes" }
4298
+ {
4299
+ "name": "call",
4300
+ "type": "bytes",
4301
+ "internalType": "bytes"
4302
+ }
4158
4303
  ]
4159
4304
  },
4160
4305
  {
4161
- name: "inputs",
4162
- type: "tuple[]",
4163
- internalType: "struct TokenInfo[]",
4164
- components: [
4165
- { name: "token", type: "bytes32", internalType: "bytes32" },
4166
- { name: "amount", type: "uint256", internalType: "uint256" }
4306
+ "name": "inputs",
4307
+ "type": "tuple[]",
4308
+ "internalType": "struct TokenInfo[]",
4309
+ "components": [
4310
+ {
4311
+ "name": "token",
4312
+ "type": "bytes32",
4313
+ "internalType": "bytes32"
4314
+ },
4315
+ {
4316
+ "name": "amount",
4317
+ "type": "uint256",
4318
+ "internalType": "uint256"
4319
+ }
4167
4320
  ]
4168
4321
  },
4169
4322
  {
4170
- name: "output",
4171
- type: "tuple",
4172
- internalType: "struct PaymentInfo",
4173
- components: [
4174
- { name: "beneficiary", type: "bytes32", internalType: "bytes32" },
4323
+ "name": "output",
4324
+ "type": "tuple",
4325
+ "internalType": "struct PaymentInfo",
4326
+ "components": [
4175
4327
  {
4176
- name: "assets",
4177
- type: "tuple[]",
4178
- internalType: "struct TokenInfo[]",
4179
- components: [
4180
- { name: "token", type: "bytes32", internalType: "bytes32" },
4181
- { name: "amount", type: "uint256", internalType: "uint256" }
4328
+ "name": "beneficiary",
4329
+ "type": "bytes32",
4330
+ "internalType": "bytes32"
4331
+ },
4332
+ {
4333
+ "name": "assets",
4334
+ "type": "tuple[]",
4335
+ "internalType": "struct TokenInfo[]",
4336
+ "components": [
4337
+ {
4338
+ "name": "token",
4339
+ "type": "bytes32",
4340
+ "internalType": "bytes32"
4341
+ },
4342
+ {
4343
+ "name": "amount",
4344
+ "type": "uint256",
4345
+ "internalType": "uint256"
4346
+ }
4182
4347
  ]
4183
4348
  },
4184
- { name: "call", type: "bytes", internalType: "bytes" }
4349
+ {
4350
+ "name": "call",
4351
+ "type": "bytes",
4352
+ "internalType": "bytes"
4353
+ }
4185
4354
  ]
4186
4355
  }
4187
4356
  ]
4188
4357
  },
4189
4358
  {
4190
- name: "options",
4191
- type: "tuple",
4192
- internalType: "struct CancelOptions",
4193
- components: [
4194
- { name: "relayerFee", type: "uint256", internalType: "uint256" },
4195
- { name: "height", type: "uint256", internalType: "uint256" }
4359
+ "name": "options",
4360
+ "type": "tuple",
4361
+ "internalType": "struct CancelOptions",
4362
+ "components": [
4363
+ {
4364
+ "name": "relayerFee",
4365
+ "type": "uint256",
4366
+ "internalType": "uint256"
4367
+ },
4368
+ {
4369
+ "name": "height",
4370
+ "type": "uint256",
4371
+ "internalType": "uint256"
4372
+ }
4196
4373
  ]
4197
4374
  }
4198
4375
  ],
4199
- outputs: [],
4200
- stateMutability: "payable"
4376
+ "outputs": [],
4377
+ "stateMutability": "payable"
4201
4378
  },
4202
4379
  {
4203
- type: "function",
4204
- name: "eip712Domain",
4205
- inputs: [],
4206
- outputs: [
4207
- { name: "fields", type: "bytes1", internalType: "bytes1" },
4208
- { name: "name", type: "string", internalType: "string" },
4209
- { name: "version", type: "string", internalType: "string" },
4210
- { name: "chainId", type: "uint256", internalType: "uint256" },
4211
- { name: "verifyingContract", type: "address", internalType: "address" },
4212
- { name: "salt", type: "bytes32", internalType: "bytes32" },
4213
- { name: "extensions", type: "uint256[]", internalType: "uint256[]" }
4380
+ "type": "function",
4381
+ "name": "eip712Domain",
4382
+ "inputs": [],
4383
+ "outputs": [
4384
+ {
4385
+ "name": "fields",
4386
+ "type": "bytes1",
4387
+ "internalType": "bytes1"
4388
+ },
4389
+ {
4390
+ "name": "name",
4391
+ "type": "string",
4392
+ "internalType": "string"
4393
+ },
4394
+ {
4395
+ "name": "version",
4396
+ "type": "string",
4397
+ "internalType": "string"
4398
+ },
4399
+ {
4400
+ "name": "chainId",
4401
+ "type": "uint256",
4402
+ "internalType": "uint256"
4403
+ },
4404
+ {
4405
+ "name": "verifyingContract",
4406
+ "type": "address",
4407
+ "internalType": "address"
4408
+ },
4409
+ {
4410
+ "name": "salt",
4411
+ "type": "bytes32",
4412
+ "internalType": "bytes32"
4413
+ },
4414
+ {
4415
+ "name": "extensions",
4416
+ "type": "uint256[]",
4417
+ "internalType": "uint256[]"
4418
+ }
4214
4419
  ],
4215
- stateMutability: "view"
4420
+ "stateMutability": "view"
4216
4421
  },
4217
4422
  {
4218
- type: "function",
4219
- name: "fillOrder",
4220
- inputs: [
4423
+ "type": "function",
4424
+ "name": "fillOrder",
4425
+ "inputs": [
4221
4426
  {
4222
- name: "order",
4223
- type: "tuple",
4224
- internalType: "struct Order",
4225
- components: [
4226
- { name: "user", type: "bytes32", internalType: "bytes32" },
4227
- { name: "source", type: "bytes", internalType: "bytes" },
4228
- { name: "destination", type: "bytes", internalType: "bytes" },
4229
- { name: "deadline", type: "uint256", internalType: "uint256" },
4230
- { name: "nonce", type: "uint256", internalType: "uint256" },
4231
- { name: "fees", type: "uint256", internalType: "uint256" },
4232
- { name: "session", type: "address", internalType: "address" },
4233
- {
4234
- name: "predispatch",
4235
- type: "tuple",
4236
- internalType: "struct DispatchInfo",
4237
- components: [
4427
+ "name": "order",
4428
+ "type": "tuple",
4429
+ "internalType": "struct Order",
4430
+ "components": [
4431
+ {
4432
+ "name": "user",
4433
+ "type": "bytes32",
4434
+ "internalType": "bytes32"
4435
+ },
4436
+ {
4437
+ "name": "source",
4438
+ "type": "bytes",
4439
+ "internalType": "bytes"
4440
+ },
4441
+ {
4442
+ "name": "destination",
4443
+ "type": "bytes",
4444
+ "internalType": "bytes"
4445
+ },
4446
+ {
4447
+ "name": "deadline",
4448
+ "type": "uint256",
4449
+ "internalType": "uint256"
4450
+ },
4451
+ {
4452
+ "name": "nonce",
4453
+ "type": "uint256",
4454
+ "internalType": "uint256"
4455
+ },
4456
+ {
4457
+ "name": "fees",
4458
+ "type": "uint256",
4459
+ "internalType": "uint256"
4460
+ },
4461
+ {
4462
+ "name": "session",
4463
+ "type": "address",
4464
+ "internalType": "address"
4465
+ },
4466
+ {
4467
+ "name": "predispatch",
4468
+ "type": "tuple",
4469
+ "internalType": "struct DispatchInfo",
4470
+ "components": [
4238
4471
  {
4239
- name: "assets",
4240
- type: "tuple[]",
4241
- internalType: "struct TokenInfo[]",
4242
- components: [
4243
- { name: "token", type: "bytes32", internalType: "bytes32" },
4244
- { name: "amount", type: "uint256", internalType: "uint256" }
4472
+ "name": "assets",
4473
+ "type": "tuple[]",
4474
+ "internalType": "struct TokenInfo[]",
4475
+ "components": [
4476
+ {
4477
+ "name": "token",
4478
+ "type": "bytes32",
4479
+ "internalType": "bytes32"
4480
+ },
4481
+ {
4482
+ "name": "amount",
4483
+ "type": "uint256",
4484
+ "internalType": "uint256"
4485
+ }
4245
4486
  ]
4246
4487
  },
4247
- { name: "call", type: "bytes", internalType: "bytes" }
4488
+ {
4489
+ "name": "call",
4490
+ "type": "bytes",
4491
+ "internalType": "bytes"
4492
+ }
4248
4493
  ]
4249
4494
  },
4250
4495
  {
4251
- name: "inputs",
4252
- type: "tuple[]",
4253
- internalType: "struct TokenInfo[]",
4254
- components: [
4255
- { name: "token", type: "bytes32", internalType: "bytes32" },
4256
- { name: "amount", type: "uint256", internalType: "uint256" }
4496
+ "name": "inputs",
4497
+ "type": "tuple[]",
4498
+ "internalType": "struct TokenInfo[]",
4499
+ "components": [
4500
+ {
4501
+ "name": "token",
4502
+ "type": "bytes32",
4503
+ "internalType": "bytes32"
4504
+ },
4505
+ {
4506
+ "name": "amount",
4507
+ "type": "uint256",
4508
+ "internalType": "uint256"
4509
+ }
4257
4510
  ]
4258
4511
  },
4259
4512
  {
4260
- name: "output",
4261
- type: "tuple",
4262
- internalType: "struct PaymentInfo",
4263
- components: [
4264
- { name: "beneficiary", type: "bytes32", internalType: "bytes32" },
4513
+ "name": "output",
4514
+ "type": "tuple",
4515
+ "internalType": "struct PaymentInfo",
4516
+ "components": [
4265
4517
  {
4266
- name: "assets",
4267
- type: "tuple[]",
4268
- internalType: "struct TokenInfo[]",
4269
- components: [
4270
- { name: "token", type: "bytes32", internalType: "bytes32" },
4271
- { name: "amount", type: "uint256", internalType: "uint256" }
4518
+ "name": "beneficiary",
4519
+ "type": "bytes32",
4520
+ "internalType": "bytes32"
4521
+ },
4522
+ {
4523
+ "name": "assets",
4524
+ "type": "tuple[]",
4525
+ "internalType": "struct TokenInfo[]",
4526
+ "components": [
4527
+ {
4528
+ "name": "token",
4529
+ "type": "bytes32",
4530
+ "internalType": "bytes32"
4531
+ },
4532
+ {
4533
+ "name": "amount",
4534
+ "type": "uint256",
4535
+ "internalType": "uint256"
4536
+ }
4272
4537
  ]
4273
4538
  },
4274
- { name: "call", type: "bytes", internalType: "bytes" }
4539
+ {
4540
+ "name": "call",
4541
+ "type": "bytes",
4542
+ "internalType": "bytes"
4543
+ }
4275
4544
  ]
4276
4545
  }
4277
4546
  ]
4278
4547
  },
4279
4548
  {
4280
- name: "options",
4281
- type: "tuple",
4282
- internalType: "struct FillOptions",
4283
- components: [
4284
- { name: "relayerFee", type: "uint256", internalType: "uint256" },
4285
- { name: "nativeDispatchFee", type: "uint256", internalType: "uint256" },
4549
+ "name": "options",
4550
+ "type": "tuple",
4551
+ "internalType": "struct FillOptions",
4552
+ "components": [
4286
4553
  {
4287
- name: "outputs",
4288
- type: "tuple[]",
4289
- internalType: "struct TokenInfo[]",
4290
- components: [
4291
- { name: "token", type: "bytes32", internalType: "bytes32" },
4292
- { name: "amount", type: "uint256", internalType: "uint256" }
4554
+ "name": "relayerFee",
4555
+ "type": "uint256",
4556
+ "internalType": "uint256"
4557
+ },
4558
+ {
4559
+ "name": "nativeDispatchFee",
4560
+ "type": "uint256",
4561
+ "internalType": "uint256"
4562
+ },
4563
+ {
4564
+ "name": "outputs",
4565
+ "type": "tuple[]",
4566
+ "internalType": "struct TokenInfo[]",
4567
+ "components": [
4568
+ {
4569
+ "name": "token",
4570
+ "type": "bytes32",
4571
+ "internalType": "bytes32"
4572
+ },
4573
+ {
4574
+ "name": "amount",
4575
+ "type": "uint256",
4576
+ "internalType": "uint256"
4577
+ }
4293
4578
  ]
4294
4579
  }
4295
4580
  ]
4296
4581
  }
4297
4582
  ],
4298
- outputs: [],
4299
- stateMutability: "payable"
4583
+ "outputs": [],
4584
+ "stateMutability": "payable"
4300
4585
  },
4301
4586
  {
4302
- type: "function",
4303
- name: "host",
4304
- inputs: [],
4305
- outputs: [{ name: "", type: "address", internalType: "address" }],
4306
- stateMutability: "view"
4587
+ "type": "function",
4588
+ "name": "host",
4589
+ "inputs": [],
4590
+ "outputs": [
4591
+ {
4592
+ "name": "",
4593
+ "type": "address",
4594
+ "internalType": "address"
4595
+ }
4596
+ ],
4597
+ "stateMutability": "view"
4307
4598
  },
4308
4599
  {
4309
- type: "function",
4310
- name: "instance",
4311
- inputs: [{ name: "stateMachineId", type: "bytes", internalType: "bytes" }],
4312
- outputs: [{ name: "", type: "address", internalType: "address" }],
4313
- stateMutability: "view"
4600
+ "type": "function",
4601
+ "name": "instance",
4602
+ "inputs": [
4603
+ {
4604
+ "name": "stateMachineId",
4605
+ "type": "bytes",
4606
+ "internalType": "bytes"
4607
+ }
4608
+ ],
4609
+ "outputs": [
4610
+ {
4611
+ "name": "",
4612
+ "type": "address",
4613
+ "internalType": "address"
4614
+ }
4615
+ ],
4616
+ "stateMutability": "view"
4314
4617
  },
4315
4618
  {
4316
- type: "function",
4317
- name: "onAccept",
4318
- inputs: [
4619
+ "type": "function",
4620
+ "name": "onAccept",
4621
+ "inputs": [
4319
4622
  {
4320
- name: "incoming",
4321
- type: "tuple",
4322
- internalType: "struct IncomingPostRequest",
4323
- components: [
4623
+ "name": "incoming",
4624
+ "type": "tuple",
4625
+ "internalType": "struct IncomingPostRequest",
4626
+ "components": [
4324
4627
  {
4325
- name: "request",
4326
- type: "tuple",
4327
- internalType: "struct PostRequest",
4328
- components: [
4329
- { name: "source", type: "bytes", internalType: "bytes" },
4330
- { name: "dest", type: "bytes", internalType: "bytes" },
4331
- { name: "nonce", type: "uint64", internalType: "uint64" },
4332
- { name: "from", type: "bytes", internalType: "bytes" },
4333
- { name: "to", type: "bytes", internalType: "bytes" },
4334
- { name: "timeoutTimestamp", type: "uint64", internalType: "uint64" },
4335
- { name: "body", type: "bytes", internalType: "bytes" }
4336
- ]
4337
- },
4338
- { name: "relayer", type: "address", internalType: "address" }
4339
- ]
4628
+ "name": "request",
4629
+ "type": "tuple",
4630
+ "internalType": "struct PostRequest",
4631
+ "components": [
4632
+ {
4633
+ "name": "source",
4634
+ "type": "bytes",
4635
+ "internalType": "bytes"
4636
+ },
4637
+ {
4638
+ "name": "dest",
4639
+ "type": "bytes",
4640
+ "internalType": "bytes"
4641
+ },
4642
+ {
4643
+ "name": "nonce",
4644
+ "type": "uint64",
4645
+ "internalType": "uint64"
4646
+ },
4647
+ {
4648
+ "name": "from",
4649
+ "type": "bytes",
4650
+ "internalType": "bytes"
4651
+ },
4652
+ {
4653
+ "name": "to",
4654
+ "type": "bytes",
4655
+ "internalType": "bytes"
4656
+ },
4657
+ {
4658
+ "name": "timeoutTimestamp",
4659
+ "type": "uint64",
4660
+ "internalType": "uint64"
4661
+ },
4662
+ {
4663
+ "name": "body",
4664
+ "type": "bytes",
4665
+ "internalType": "bytes"
4666
+ }
4667
+ ]
4668
+ },
4669
+ {
4670
+ "name": "relayer",
4671
+ "type": "address",
4672
+ "internalType": "address"
4673
+ }
4674
+ ]
4340
4675
  }
4341
4676
  ],
4342
- outputs: [],
4343
- stateMutability: "nonpayable"
4677
+ "outputs": [],
4678
+ "stateMutability": "nonpayable"
4344
4679
  },
4345
4680
  {
4346
- type: "function",
4347
- name: "onGetResponse",
4348
- inputs: [
4681
+ "type": "function",
4682
+ "name": "onGetResponse",
4683
+ "inputs": [
4349
4684
  {
4350
- name: "incoming",
4351
- type: "tuple",
4352
- internalType: "struct IncomingGetResponse",
4353
- components: [
4685
+ "name": "incoming",
4686
+ "type": "tuple",
4687
+ "internalType": "struct IncomingGetResponse",
4688
+ "components": [
4354
4689
  {
4355
- name: "response",
4356
- type: "tuple",
4357
- internalType: "struct GetResponse",
4358
- components: [
4690
+ "name": "response",
4691
+ "type": "tuple",
4692
+ "internalType": "struct GetResponse",
4693
+ "components": [
4359
4694
  {
4360
- name: "request",
4361
- type: "tuple",
4362
- internalType: "struct GetRequest",
4363
- components: [
4364
- { name: "source", type: "bytes", internalType: "bytes" },
4365
- { name: "dest", type: "bytes", internalType: "bytes" },
4366
- { name: "nonce", type: "uint64", internalType: "uint64" },
4367
- { name: "from", type: "address", internalType: "address" },
4368
- { name: "timeoutTimestamp", type: "uint64", internalType: "uint64" },
4369
- { name: "keys", type: "bytes[]", internalType: "bytes[]" },
4370
- { name: "height", type: "uint64", internalType: "uint64" },
4371
- { name: "context", type: "bytes", internalType: "bytes" }
4695
+ "name": "request",
4696
+ "type": "tuple",
4697
+ "internalType": "struct GetRequest",
4698
+ "components": [
4699
+ {
4700
+ "name": "source",
4701
+ "type": "bytes",
4702
+ "internalType": "bytes"
4703
+ },
4704
+ {
4705
+ "name": "dest",
4706
+ "type": "bytes",
4707
+ "internalType": "bytes"
4708
+ },
4709
+ {
4710
+ "name": "nonce",
4711
+ "type": "uint64",
4712
+ "internalType": "uint64"
4713
+ },
4714
+ {
4715
+ "name": "from",
4716
+ "type": "address",
4717
+ "internalType": "address"
4718
+ },
4719
+ {
4720
+ "name": "timeoutTimestamp",
4721
+ "type": "uint64",
4722
+ "internalType": "uint64"
4723
+ },
4724
+ {
4725
+ "name": "keys",
4726
+ "type": "bytes[]",
4727
+ "internalType": "bytes[]"
4728
+ },
4729
+ {
4730
+ "name": "height",
4731
+ "type": "uint64",
4732
+ "internalType": "uint64"
4733
+ },
4734
+ {
4735
+ "name": "context",
4736
+ "type": "bytes",
4737
+ "internalType": "bytes"
4738
+ }
4372
4739
  ]
4373
4740
  },
4374
4741
  {
4375
- name: "values",
4376
- type: "tuple[]",
4377
- internalType: "struct StorageValue[]",
4378
- components: [
4379
- { name: "key", type: "bytes", internalType: "bytes" },
4380
- { name: "value", type: "bytes", internalType: "bytes" }
4742
+ "name": "values",
4743
+ "type": "tuple[]",
4744
+ "internalType": "struct StorageValue[]",
4745
+ "components": [
4746
+ {
4747
+ "name": "key",
4748
+ "type": "bytes",
4749
+ "internalType": "bytes"
4750
+ },
4751
+ {
4752
+ "name": "value",
4753
+ "type": "bytes",
4754
+ "internalType": "bytes"
4755
+ }
4381
4756
  ]
4382
4757
  }
4383
4758
  ]
4384
4759
  },
4385
- { name: "relayer", type: "address", internalType: "address" }
4760
+ {
4761
+ "name": "relayer",
4762
+ "type": "address",
4763
+ "internalType": "address"
4764
+ }
4386
4765
  ]
4387
4766
  }
4388
4767
  ],
4389
- outputs: [],
4390
- stateMutability: "nonpayable"
4768
+ "outputs": [],
4769
+ "stateMutability": "nonpayable"
4391
4770
  },
4392
4771
  {
4393
- type: "function",
4394
- name: "onGetTimeout",
4395
- inputs: [
4772
+ "type": "function",
4773
+ "name": "onGetTimeout",
4774
+ "inputs": [
4396
4775
  {
4397
- name: "",
4398
- type: "tuple",
4399
- internalType: "struct GetRequest",
4400
- components: [
4401
- { name: "source", type: "bytes", internalType: "bytes" },
4402
- { name: "dest", type: "bytes", internalType: "bytes" },
4403
- { name: "nonce", type: "uint64", internalType: "uint64" },
4404
- { name: "from", type: "address", internalType: "address" },
4405
- { name: "timeoutTimestamp", type: "uint64", internalType: "uint64" },
4406
- { name: "keys", type: "bytes[]", internalType: "bytes[]" },
4407
- { name: "height", type: "uint64", internalType: "uint64" },
4408
- { name: "context", type: "bytes", internalType: "bytes" }
4776
+ "name": "",
4777
+ "type": "tuple",
4778
+ "internalType": "struct GetRequest",
4779
+ "components": [
4780
+ {
4781
+ "name": "source",
4782
+ "type": "bytes",
4783
+ "internalType": "bytes"
4784
+ },
4785
+ {
4786
+ "name": "dest",
4787
+ "type": "bytes",
4788
+ "internalType": "bytes"
4789
+ },
4790
+ {
4791
+ "name": "nonce",
4792
+ "type": "uint64",
4793
+ "internalType": "uint64"
4794
+ },
4795
+ {
4796
+ "name": "from",
4797
+ "type": "address",
4798
+ "internalType": "address"
4799
+ },
4800
+ {
4801
+ "name": "timeoutTimestamp",
4802
+ "type": "uint64",
4803
+ "internalType": "uint64"
4804
+ },
4805
+ {
4806
+ "name": "keys",
4807
+ "type": "bytes[]",
4808
+ "internalType": "bytes[]"
4809
+ },
4810
+ {
4811
+ "name": "height",
4812
+ "type": "uint64",
4813
+ "internalType": "uint64"
4814
+ },
4815
+ {
4816
+ "name": "context",
4817
+ "type": "bytes",
4818
+ "internalType": "bytes"
4819
+ }
4409
4820
  ]
4410
4821
  }
4411
4822
  ],
4412
- outputs: [],
4413
- stateMutability: "nonpayable"
4823
+ "outputs": [],
4824
+ "stateMutability": "nonpayable"
4414
4825
  },
4415
4826
  {
4416
- type: "function",
4417
- name: "onPostRequestTimeout",
4418
- inputs: [
4827
+ "type": "function",
4828
+ "name": "onPostRequestTimeout",
4829
+ "inputs": [
4419
4830
  {
4420
- name: "",
4421
- type: "tuple",
4422
- internalType: "struct PostRequest",
4423
- components: [
4424
- { name: "source", type: "bytes", internalType: "bytes" },
4425
- { name: "dest", type: "bytes", internalType: "bytes" },
4426
- { name: "nonce", type: "uint64", internalType: "uint64" },
4427
- { name: "from", type: "bytes", internalType: "bytes" },
4428
- { name: "to", type: "bytes", internalType: "bytes" },
4429
- { name: "timeoutTimestamp", type: "uint64", internalType: "uint64" },
4430
- { name: "body", type: "bytes", internalType: "bytes" }
4831
+ "name": "",
4832
+ "type": "tuple",
4833
+ "internalType": "struct PostRequest",
4834
+ "components": [
4835
+ {
4836
+ "name": "source",
4837
+ "type": "bytes",
4838
+ "internalType": "bytes"
4839
+ },
4840
+ {
4841
+ "name": "dest",
4842
+ "type": "bytes",
4843
+ "internalType": "bytes"
4844
+ },
4845
+ {
4846
+ "name": "nonce",
4847
+ "type": "uint64",
4848
+ "internalType": "uint64"
4849
+ },
4850
+ {
4851
+ "name": "from",
4852
+ "type": "bytes",
4853
+ "internalType": "bytes"
4854
+ },
4855
+ {
4856
+ "name": "to",
4857
+ "type": "bytes",
4858
+ "internalType": "bytes"
4859
+ },
4860
+ {
4861
+ "name": "timeoutTimestamp",
4862
+ "type": "uint64",
4863
+ "internalType": "uint64"
4864
+ },
4865
+ {
4866
+ "name": "body",
4867
+ "type": "bytes",
4868
+ "internalType": "bytes"
4869
+ }
4431
4870
  ]
4432
4871
  }
4433
4872
  ],
4434
- outputs: [],
4435
- stateMutability: "nonpayable"
4873
+ "outputs": [],
4874
+ "stateMutability": "nonpayable"
4436
4875
  },
4437
4876
  {
4438
- type: "function",
4439
- name: "onPostResponse",
4440
- inputs: [
4877
+ "type": "function",
4878
+ "name": "onPostResponse",
4879
+ "inputs": [
4441
4880
  {
4442
- name: "",
4443
- type: "tuple",
4444
- internalType: "struct IncomingPostResponse",
4445
- components: [
4881
+ "name": "",
4882
+ "type": "tuple",
4883
+ "internalType": "struct IncomingPostResponse",
4884
+ "components": [
4446
4885
  {
4447
- name: "response",
4448
- type: "tuple",
4449
- internalType: "struct PostResponse",
4450
- components: [
4886
+ "name": "response",
4887
+ "type": "tuple",
4888
+ "internalType": "struct PostResponse",
4889
+ "components": [
4451
4890
  {
4452
- name: "request",
4453
- type: "tuple",
4454
- internalType: "struct PostRequest",
4455
- components: [
4456
- { name: "source", type: "bytes", internalType: "bytes" },
4457
- { name: "dest", type: "bytes", internalType: "bytes" },
4458
- { name: "nonce", type: "uint64", internalType: "uint64" },
4459
- { name: "from", type: "bytes", internalType: "bytes" },
4460
- { name: "to", type: "bytes", internalType: "bytes" },
4461
- { name: "timeoutTimestamp", type: "uint64", internalType: "uint64" },
4462
- { name: "body", type: "bytes", internalType: "bytes" }
4891
+ "name": "request",
4892
+ "type": "tuple",
4893
+ "internalType": "struct PostRequest",
4894
+ "components": [
4895
+ {
4896
+ "name": "source",
4897
+ "type": "bytes",
4898
+ "internalType": "bytes"
4899
+ },
4900
+ {
4901
+ "name": "dest",
4902
+ "type": "bytes",
4903
+ "internalType": "bytes"
4904
+ },
4905
+ {
4906
+ "name": "nonce",
4907
+ "type": "uint64",
4908
+ "internalType": "uint64"
4909
+ },
4910
+ {
4911
+ "name": "from",
4912
+ "type": "bytes",
4913
+ "internalType": "bytes"
4914
+ },
4915
+ {
4916
+ "name": "to",
4917
+ "type": "bytes",
4918
+ "internalType": "bytes"
4919
+ },
4920
+ {
4921
+ "name": "timeoutTimestamp",
4922
+ "type": "uint64",
4923
+ "internalType": "uint64"
4924
+ },
4925
+ {
4926
+ "name": "body",
4927
+ "type": "bytes",
4928
+ "internalType": "bytes"
4929
+ }
4463
4930
  ]
4464
4931
  },
4465
- { name: "response", type: "bytes", internalType: "bytes" },
4466
- { name: "timeoutTimestamp", type: "uint64", internalType: "uint64" }
4932
+ {
4933
+ "name": "response",
4934
+ "type": "bytes",
4935
+ "internalType": "bytes"
4936
+ },
4937
+ {
4938
+ "name": "timeoutTimestamp",
4939
+ "type": "uint64",
4940
+ "internalType": "uint64"
4941
+ }
4467
4942
  ]
4468
4943
  },
4469
- { name: "relayer", type: "address", internalType: "address" }
4944
+ {
4945
+ "name": "relayer",
4946
+ "type": "address",
4947
+ "internalType": "address"
4948
+ }
4470
4949
  ]
4471
4950
  }
4472
4951
  ],
4473
- outputs: [],
4474
- stateMutability: "nonpayable"
4952
+ "outputs": [],
4953
+ "stateMutability": "nonpayable"
4475
4954
  },
4476
4955
  {
4477
- type: "function",
4478
- name: "onPostResponseTimeout",
4479
- inputs: [
4956
+ "type": "function",
4957
+ "name": "onPostResponseTimeout",
4958
+ "inputs": [
4480
4959
  {
4481
- name: "",
4482
- type: "tuple",
4483
- internalType: "struct PostResponse",
4484
- components: [
4960
+ "name": "",
4961
+ "type": "tuple",
4962
+ "internalType": "struct PostResponse",
4963
+ "components": [
4485
4964
  {
4486
- name: "request",
4487
- type: "tuple",
4488
- internalType: "struct PostRequest",
4489
- components: [
4490
- { name: "source", type: "bytes", internalType: "bytes" },
4491
- { name: "dest", type: "bytes", internalType: "bytes" },
4492
- { name: "nonce", type: "uint64", internalType: "uint64" },
4493
- { name: "from", type: "bytes", internalType: "bytes" },
4494
- { name: "to", type: "bytes", internalType: "bytes" },
4495
- { name: "timeoutTimestamp", type: "uint64", internalType: "uint64" },
4496
- { name: "body", type: "bytes", internalType: "bytes" }
4965
+ "name": "request",
4966
+ "type": "tuple",
4967
+ "internalType": "struct PostRequest",
4968
+ "components": [
4969
+ {
4970
+ "name": "source",
4971
+ "type": "bytes",
4972
+ "internalType": "bytes"
4973
+ },
4974
+ {
4975
+ "name": "dest",
4976
+ "type": "bytes",
4977
+ "internalType": "bytes"
4978
+ },
4979
+ {
4980
+ "name": "nonce",
4981
+ "type": "uint64",
4982
+ "internalType": "uint64"
4983
+ },
4984
+ {
4985
+ "name": "from",
4986
+ "type": "bytes",
4987
+ "internalType": "bytes"
4988
+ },
4989
+ {
4990
+ "name": "to",
4991
+ "type": "bytes",
4992
+ "internalType": "bytes"
4993
+ },
4994
+ {
4995
+ "name": "timeoutTimestamp",
4996
+ "type": "uint64",
4997
+ "internalType": "uint64"
4998
+ },
4999
+ {
5000
+ "name": "body",
5001
+ "type": "bytes",
5002
+ "internalType": "bytes"
5003
+ }
4497
5004
  ]
4498
5005
  },
4499
- { name: "response", type: "bytes", internalType: "bytes" },
4500
- { name: "timeoutTimestamp", type: "uint64", internalType: "uint64" }
5006
+ {
5007
+ "name": "response",
5008
+ "type": "bytes",
5009
+ "internalType": "bytes"
5010
+ },
5011
+ {
5012
+ "name": "timeoutTimestamp",
5013
+ "type": "uint64",
5014
+ "internalType": "uint64"
5015
+ }
4501
5016
  ]
4502
5017
  }
4503
5018
  ],
4504
- outputs: [],
4505
- stateMutability: "nonpayable"
5019
+ "outputs": [],
5020
+ "stateMutability": "nonpayable"
4506
5021
  },
4507
5022
  {
4508
- type: "function",
4509
- name: "params",
4510
- inputs: [],
4511
- outputs: [
5023
+ "type": "function",
5024
+ "name": "params",
5025
+ "inputs": [],
5026
+ "outputs": [
4512
5027
  {
4513
- name: "",
4514
- type: "tuple",
4515
- internalType: "struct Params",
4516
- components: [
4517
- { name: "host", type: "address", internalType: "address" },
4518
- { name: "dispatcher", type: "address", internalType: "address" },
4519
- { name: "solverSelection", type: "bool", internalType: "bool" },
4520
- { name: "surplusShareBps", type: "uint256", internalType: "uint256" },
4521
- { name: "protocolFeeBps", type: "uint256", internalType: "uint256" },
4522
- { name: "priceOracle", type: "address", internalType: "address" }
5028
+ "name": "",
5029
+ "type": "tuple",
5030
+ "internalType": "struct Params",
5031
+ "components": [
5032
+ {
5033
+ "name": "host",
5034
+ "type": "address",
5035
+ "internalType": "address"
5036
+ },
5037
+ {
5038
+ "name": "dispatcher",
5039
+ "type": "address",
5040
+ "internalType": "address"
5041
+ },
5042
+ {
5043
+ "name": "solverSelection",
5044
+ "type": "bool",
5045
+ "internalType": "bool"
5046
+ },
5047
+ {
5048
+ "name": "surplusShareBps",
5049
+ "type": "uint256",
5050
+ "internalType": "uint256"
5051
+ },
5052
+ {
5053
+ "name": "protocolFeeBps",
5054
+ "type": "uint256",
5055
+ "internalType": "uint256"
5056
+ },
5057
+ {
5058
+ "name": "priceOracle",
5059
+ "type": "address",
5060
+ "internalType": "address"
5061
+ }
4523
5062
  ]
4524
5063
  }
4525
5064
  ],
4526
- stateMutability: "view"
5065
+ "stateMutability": "view"
4527
5066
  },
4528
5067
  {
4529
- type: "function",
4530
- name: "placeOrder",
4531
- inputs: [
5068
+ "type": "function",
5069
+ "name": "placeOrder",
5070
+ "inputs": [
4532
5071
  {
4533
- name: "order",
4534
- type: "tuple",
4535
- internalType: "struct Order",
4536
- components: [
4537
- { name: "user", type: "bytes32", internalType: "bytes32" },
4538
- { name: "source", type: "bytes", internalType: "bytes" },
4539
- { name: "destination", type: "bytes", internalType: "bytes" },
4540
- { name: "deadline", type: "uint256", internalType: "uint256" },
4541
- { name: "nonce", type: "uint256", internalType: "uint256" },
4542
- { name: "fees", type: "uint256", internalType: "uint256" },
4543
- { name: "session", type: "address", internalType: "address" },
4544
- {
4545
- name: "predispatch",
4546
- type: "tuple",
4547
- internalType: "struct DispatchInfo",
4548
- components: [
5072
+ "name": "order",
5073
+ "type": "tuple",
5074
+ "internalType": "struct Order",
5075
+ "components": [
5076
+ {
5077
+ "name": "user",
5078
+ "type": "bytes32",
5079
+ "internalType": "bytes32"
5080
+ },
5081
+ {
5082
+ "name": "source",
5083
+ "type": "bytes",
5084
+ "internalType": "bytes"
5085
+ },
5086
+ {
5087
+ "name": "destination",
5088
+ "type": "bytes",
5089
+ "internalType": "bytes"
5090
+ },
5091
+ {
5092
+ "name": "deadline",
5093
+ "type": "uint256",
5094
+ "internalType": "uint256"
5095
+ },
5096
+ {
5097
+ "name": "nonce",
5098
+ "type": "uint256",
5099
+ "internalType": "uint256"
5100
+ },
5101
+ {
5102
+ "name": "fees",
5103
+ "type": "uint256",
5104
+ "internalType": "uint256"
5105
+ },
5106
+ {
5107
+ "name": "session",
5108
+ "type": "address",
5109
+ "internalType": "address"
5110
+ },
5111
+ {
5112
+ "name": "predispatch",
5113
+ "type": "tuple",
5114
+ "internalType": "struct DispatchInfo",
5115
+ "components": [
4549
5116
  {
4550
- name: "assets",
4551
- type: "tuple[]",
4552
- internalType: "struct TokenInfo[]",
4553
- components: [
4554
- { name: "token", type: "bytes32", internalType: "bytes32" },
4555
- { name: "amount", type: "uint256", internalType: "uint256" }
5117
+ "name": "assets",
5118
+ "type": "tuple[]",
5119
+ "internalType": "struct TokenInfo[]",
5120
+ "components": [
5121
+ {
5122
+ "name": "token",
5123
+ "type": "bytes32",
5124
+ "internalType": "bytes32"
5125
+ },
5126
+ {
5127
+ "name": "amount",
5128
+ "type": "uint256",
5129
+ "internalType": "uint256"
5130
+ }
4556
5131
  ]
4557
5132
  },
4558
- { name: "call", type: "bytes", internalType: "bytes" }
5133
+ {
5134
+ "name": "call",
5135
+ "type": "bytes",
5136
+ "internalType": "bytes"
5137
+ }
4559
5138
  ]
4560
5139
  },
4561
5140
  {
4562
- name: "inputs",
4563
- type: "tuple[]",
4564
- internalType: "struct TokenInfo[]",
4565
- components: [
4566
- { name: "token", type: "bytes32", internalType: "bytes32" },
4567
- { name: "amount", type: "uint256", internalType: "uint256" }
5141
+ "name": "inputs",
5142
+ "type": "tuple[]",
5143
+ "internalType": "struct TokenInfo[]",
5144
+ "components": [
5145
+ {
5146
+ "name": "token",
5147
+ "type": "bytes32",
5148
+ "internalType": "bytes32"
5149
+ },
5150
+ {
5151
+ "name": "amount",
5152
+ "type": "uint256",
5153
+ "internalType": "uint256"
5154
+ }
4568
5155
  ]
4569
5156
  },
4570
5157
  {
4571
- name: "output",
4572
- type: "tuple",
4573
- internalType: "struct PaymentInfo",
4574
- components: [
4575
- { name: "beneficiary", type: "bytes32", internalType: "bytes32" },
5158
+ "name": "output",
5159
+ "type": "tuple",
5160
+ "internalType": "struct PaymentInfo",
5161
+ "components": [
4576
5162
  {
4577
- name: "assets",
4578
- type: "tuple[]",
4579
- internalType: "struct TokenInfo[]",
4580
- components: [
4581
- { name: "token", type: "bytes32", internalType: "bytes32" },
4582
- { name: "amount", type: "uint256", internalType: "uint256" }
5163
+ "name": "beneficiary",
5164
+ "type": "bytes32",
5165
+ "internalType": "bytes32"
5166
+ },
5167
+ {
5168
+ "name": "assets",
5169
+ "type": "tuple[]",
5170
+ "internalType": "struct TokenInfo[]",
5171
+ "components": [
5172
+ {
5173
+ "name": "token",
5174
+ "type": "bytes32",
5175
+ "internalType": "bytes32"
5176
+ },
5177
+ {
5178
+ "name": "amount",
5179
+ "type": "uint256",
5180
+ "internalType": "uint256"
5181
+ }
4583
5182
  ]
4584
5183
  },
4585
- { name: "call", type: "bytes", internalType: "bytes" }
5184
+ {
5185
+ "name": "call",
5186
+ "type": "bytes",
5187
+ "internalType": "bytes"
5188
+ }
4586
5189
  ]
4587
5190
  }
4588
5191
  ]
4589
5192
  },
4590
- { name: "graffiti", type: "bytes32", internalType: "bytes32" }
5193
+ {
5194
+ "name": "graffiti",
5195
+ "type": "bytes32",
5196
+ "internalType": "bytes32"
5197
+ }
4591
5198
  ],
4592
- outputs: [],
4593
- stateMutability: "payable"
5199
+ "outputs": [],
5200
+ "stateMutability": "payable"
4594
5201
  },
4595
5202
  {
4596
- type: "function",
4597
- name: "quote",
4598
- inputs: [
5203
+ "type": "function",
5204
+ "name": "quote",
5205
+ "inputs": [
4599
5206
  {
4600
- name: "request",
4601
- type: "tuple",
4602
- internalType: "struct DispatchPost",
4603
- components: [
4604
- { name: "dest", type: "bytes", internalType: "bytes" },
4605
- { name: "to", type: "bytes", internalType: "bytes" },
4606
- { name: "body", type: "bytes", internalType: "bytes" },
4607
- { name: "timeout", type: "uint64", internalType: "uint64" },
4608
- { name: "fee", type: "uint256", internalType: "uint256" },
4609
- { name: "payer", type: "address", internalType: "address" }
5207
+ "name": "request",
5208
+ "type": "tuple",
5209
+ "internalType": "struct DispatchPost",
5210
+ "components": [
5211
+ {
5212
+ "name": "dest",
5213
+ "type": "bytes",
5214
+ "internalType": "bytes"
5215
+ },
5216
+ {
5217
+ "name": "to",
5218
+ "type": "bytes",
5219
+ "internalType": "bytes"
5220
+ },
5221
+ {
5222
+ "name": "body",
5223
+ "type": "bytes",
5224
+ "internalType": "bytes"
5225
+ },
5226
+ {
5227
+ "name": "timeout",
5228
+ "type": "uint64",
5229
+ "internalType": "uint64"
5230
+ },
5231
+ {
5232
+ "name": "fee",
5233
+ "type": "uint256",
5234
+ "internalType": "uint256"
5235
+ },
5236
+ {
5237
+ "name": "payer",
5238
+ "type": "address",
5239
+ "internalType": "address"
5240
+ }
4610
5241
  ]
4611
5242
  }
4612
5243
  ],
4613
- outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
4614
- stateMutability: "view"
5244
+ "outputs": [
5245
+ {
5246
+ "name": "",
5247
+ "type": "uint256",
5248
+ "internalType": "uint256"
5249
+ }
5250
+ ],
5251
+ "stateMutability": "view"
4615
5252
  },
4616
5253
  {
4617
- type: "function",
4618
- name: "quote",
4619
- inputs: [
5254
+ "type": "function",
5255
+ "name": "quote",
5256
+ "inputs": [
4620
5257
  {
4621
- name: "request",
4622
- type: "tuple",
4623
- internalType: "struct DispatchGet",
4624
- components: [
4625
- { name: "dest", type: "bytes", internalType: "bytes" },
4626
- { name: "height", type: "uint64", internalType: "uint64" },
4627
- { name: "keys", type: "bytes[]", internalType: "bytes[]" },
4628
- { name: "timeout", type: "uint64", internalType: "uint64" },
4629
- { name: "fee", type: "uint256", internalType: "uint256" },
4630
- { name: "context", type: "bytes", internalType: "bytes" }
5258
+ "name": "request",
5259
+ "type": "tuple",
5260
+ "internalType": "struct DispatchGet",
5261
+ "components": [
5262
+ {
5263
+ "name": "dest",
5264
+ "type": "bytes",
5265
+ "internalType": "bytes"
5266
+ },
5267
+ {
5268
+ "name": "height",
5269
+ "type": "uint64",
5270
+ "internalType": "uint64"
5271
+ },
5272
+ {
5273
+ "name": "keys",
5274
+ "type": "bytes[]",
5275
+ "internalType": "bytes[]"
5276
+ },
5277
+ {
5278
+ "name": "timeout",
5279
+ "type": "uint64",
5280
+ "internalType": "uint64"
5281
+ },
5282
+ {
5283
+ "name": "fee",
5284
+ "type": "uint256",
5285
+ "internalType": "uint256"
5286
+ },
5287
+ {
5288
+ "name": "context",
5289
+ "type": "bytes",
5290
+ "internalType": "bytes"
5291
+ }
4631
5292
  ]
4632
5293
  }
4633
5294
  ],
4634
- outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
4635
- stateMutability: "view"
5295
+ "outputs": [
5296
+ {
5297
+ "name": "",
5298
+ "type": "uint256",
5299
+ "internalType": "uint256"
5300
+ }
5301
+ ],
5302
+ "stateMutability": "view"
4636
5303
  },
4637
5304
  {
4638
- type: "function",
4639
- name: "quote",
4640
- inputs: [
5305
+ "type": "function",
5306
+ "name": "quote",
5307
+ "inputs": [
4641
5308
  {
4642
- name: "response",
4643
- type: "tuple",
4644
- internalType: "struct DispatchPostResponse",
4645
- components: [
5309
+ "name": "response",
5310
+ "type": "tuple",
5311
+ "internalType": "struct DispatchPostResponse",
5312
+ "components": [
4646
5313
  {
4647
- name: "request",
4648
- type: "tuple",
4649
- internalType: "struct PostRequest",
4650
- components: [
4651
- { name: "source", type: "bytes", internalType: "bytes" },
4652
- { name: "dest", type: "bytes", internalType: "bytes" },
4653
- { name: "nonce", type: "uint64", internalType: "uint64" },
4654
- { name: "from", type: "bytes", internalType: "bytes" },
4655
- { name: "to", type: "bytes", internalType: "bytes" },
4656
- { name: "timeoutTimestamp", type: "uint64", internalType: "uint64" },
4657
- { name: "body", type: "bytes", internalType: "bytes" }
5314
+ "name": "request",
5315
+ "type": "tuple",
5316
+ "internalType": "struct PostRequest",
5317
+ "components": [
5318
+ {
5319
+ "name": "source",
5320
+ "type": "bytes",
5321
+ "internalType": "bytes"
5322
+ },
5323
+ {
5324
+ "name": "dest",
5325
+ "type": "bytes",
5326
+ "internalType": "bytes"
5327
+ },
5328
+ {
5329
+ "name": "nonce",
5330
+ "type": "uint64",
5331
+ "internalType": "uint64"
5332
+ },
5333
+ {
5334
+ "name": "from",
5335
+ "type": "bytes",
5336
+ "internalType": "bytes"
5337
+ },
5338
+ {
5339
+ "name": "to",
5340
+ "type": "bytes",
5341
+ "internalType": "bytes"
5342
+ },
5343
+ {
5344
+ "name": "timeoutTimestamp",
5345
+ "type": "uint64",
5346
+ "internalType": "uint64"
5347
+ },
5348
+ {
5349
+ "name": "body",
5350
+ "type": "bytes",
5351
+ "internalType": "bytes"
5352
+ }
4658
5353
  ]
4659
5354
  },
4660
- { name: "response", type: "bytes", internalType: "bytes" },
4661
- { name: "timeout", type: "uint64", internalType: "uint64" },
4662
- { name: "fee", type: "uint256", internalType: "uint256" },
4663
- { name: "payer", type: "address", internalType: "address" }
5355
+ {
5356
+ "name": "response",
5357
+ "type": "bytes",
5358
+ "internalType": "bytes"
5359
+ },
5360
+ {
5361
+ "name": "timeout",
5362
+ "type": "uint64",
5363
+ "internalType": "uint64"
5364
+ },
5365
+ {
5366
+ "name": "fee",
5367
+ "type": "uint256",
5368
+ "internalType": "uint256"
5369
+ },
5370
+ {
5371
+ "name": "payer",
5372
+ "type": "address",
5373
+ "internalType": "address"
5374
+ }
4664
5375
  ]
4665
5376
  }
4666
5377
  ],
4667
- outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
4668
- stateMutability: "view"
5378
+ "outputs": [
5379
+ {
5380
+ "name": "",
5381
+ "type": "uint256",
5382
+ "internalType": "uint256"
5383
+ }
5384
+ ],
5385
+ "stateMutability": "view"
4669
5386
  },
4670
5387
  {
4671
- type: "function",
4672
- name: "quoteNative",
4673
- inputs: [
5388
+ "type": "function",
5389
+ "name": "quoteNative",
5390
+ "inputs": [
4674
5391
  {
4675
- name: "request",
4676
- type: "tuple",
4677
- internalType: "struct DispatchPost",
4678
- components: [
4679
- { name: "dest", type: "bytes", internalType: "bytes" },
4680
- { name: "to", type: "bytes", internalType: "bytes" },
4681
- { name: "body", type: "bytes", internalType: "bytes" },
4682
- { name: "timeout", type: "uint64", internalType: "uint64" },
4683
- { name: "fee", type: "uint256", internalType: "uint256" },
4684
- { name: "payer", type: "address", internalType: "address" }
5392
+ "name": "request",
5393
+ "type": "tuple",
5394
+ "internalType": "struct DispatchPost",
5395
+ "components": [
5396
+ {
5397
+ "name": "dest",
5398
+ "type": "bytes",
5399
+ "internalType": "bytes"
5400
+ },
5401
+ {
5402
+ "name": "to",
5403
+ "type": "bytes",
5404
+ "internalType": "bytes"
5405
+ },
5406
+ {
5407
+ "name": "body",
5408
+ "type": "bytes",
5409
+ "internalType": "bytes"
5410
+ },
5411
+ {
5412
+ "name": "timeout",
5413
+ "type": "uint64",
5414
+ "internalType": "uint64"
5415
+ },
5416
+ {
5417
+ "name": "fee",
5418
+ "type": "uint256",
5419
+ "internalType": "uint256"
5420
+ },
5421
+ {
5422
+ "name": "payer",
5423
+ "type": "address",
5424
+ "internalType": "address"
5425
+ }
4685
5426
  ]
4686
5427
  }
4687
5428
  ],
4688
- outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
4689
- stateMutability: "view"
5429
+ "outputs": [
5430
+ {
5431
+ "name": "",
5432
+ "type": "uint256",
5433
+ "internalType": "uint256"
5434
+ }
5435
+ ],
5436
+ "stateMutability": "view"
4690
5437
  },
4691
5438
  {
4692
- type: "function",
4693
- name: "quoteNative",
4694
- inputs: [
5439
+ "type": "function",
5440
+ "name": "quoteNative",
5441
+ "inputs": [
4695
5442
  {
4696
- name: "request",
4697
- type: "tuple",
4698
- internalType: "struct DispatchPostResponse",
4699
- components: [
5443
+ "name": "request",
5444
+ "type": "tuple",
5445
+ "internalType": "struct DispatchPostResponse",
5446
+ "components": [
4700
5447
  {
4701
- name: "request",
4702
- type: "tuple",
4703
- internalType: "struct PostRequest",
4704
- components: [
4705
- { name: "source", type: "bytes", internalType: "bytes" },
4706
- { name: "dest", type: "bytes", internalType: "bytes" },
4707
- { name: "nonce", type: "uint64", internalType: "uint64" },
4708
- { name: "from", type: "bytes", internalType: "bytes" },
4709
- { name: "to", type: "bytes", internalType: "bytes" },
4710
- { name: "timeoutTimestamp", type: "uint64", internalType: "uint64" },
4711
- { name: "body", type: "bytes", internalType: "bytes" }
5448
+ "name": "request",
5449
+ "type": "tuple",
5450
+ "internalType": "struct PostRequest",
5451
+ "components": [
5452
+ {
5453
+ "name": "source",
5454
+ "type": "bytes",
5455
+ "internalType": "bytes"
5456
+ },
5457
+ {
5458
+ "name": "dest",
5459
+ "type": "bytes",
5460
+ "internalType": "bytes"
5461
+ },
5462
+ {
5463
+ "name": "nonce",
5464
+ "type": "uint64",
5465
+ "internalType": "uint64"
5466
+ },
5467
+ {
5468
+ "name": "from",
5469
+ "type": "bytes",
5470
+ "internalType": "bytes"
5471
+ },
5472
+ {
5473
+ "name": "to",
5474
+ "type": "bytes",
5475
+ "internalType": "bytes"
5476
+ },
5477
+ {
5478
+ "name": "timeoutTimestamp",
5479
+ "type": "uint64",
5480
+ "internalType": "uint64"
5481
+ },
5482
+ {
5483
+ "name": "body",
5484
+ "type": "bytes",
5485
+ "internalType": "bytes"
5486
+ }
4712
5487
  ]
4713
5488
  },
4714
- { name: "response", type: "bytes", internalType: "bytes" },
4715
- { name: "timeout", type: "uint64", internalType: "uint64" },
4716
- { name: "fee", type: "uint256", internalType: "uint256" },
4717
- { name: "payer", type: "address", internalType: "address" }
5489
+ {
5490
+ "name": "response",
5491
+ "type": "bytes",
5492
+ "internalType": "bytes"
5493
+ },
5494
+ {
5495
+ "name": "timeout",
5496
+ "type": "uint64",
5497
+ "internalType": "uint64"
5498
+ },
5499
+ {
5500
+ "name": "fee",
5501
+ "type": "uint256",
5502
+ "internalType": "uint256"
5503
+ },
5504
+ {
5505
+ "name": "payer",
5506
+ "type": "address",
5507
+ "internalType": "address"
5508
+ }
4718
5509
  ]
4719
5510
  }
4720
5511
  ],
4721
- outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
4722
- stateMutability: "view"
5512
+ "outputs": [
5513
+ {
5514
+ "name": "",
5515
+ "type": "uint256",
5516
+ "internalType": "uint256"
5517
+ }
5518
+ ],
5519
+ "stateMutability": "view"
4723
5520
  },
4724
5521
  {
4725
- type: "function",
4726
- name: "quoteNative",
4727
- inputs: [
5522
+ "type": "function",
5523
+ "name": "quoteNative",
5524
+ "inputs": [
4728
5525
  {
4729
- name: "request",
4730
- type: "tuple",
4731
- internalType: "struct DispatchGet",
4732
- components: [
4733
- { name: "dest", type: "bytes", internalType: "bytes" },
4734
- { name: "height", type: "uint64", internalType: "uint64" },
4735
- { name: "keys", type: "bytes[]", internalType: "bytes[]" },
4736
- { name: "timeout", type: "uint64", internalType: "uint64" },
4737
- { name: "fee", type: "uint256", internalType: "uint256" },
4738
- { name: "context", type: "bytes", internalType: "bytes" }
5526
+ "name": "request",
5527
+ "type": "tuple",
5528
+ "internalType": "struct DispatchGet",
5529
+ "components": [
5530
+ {
5531
+ "name": "dest",
5532
+ "type": "bytes",
5533
+ "internalType": "bytes"
5534
+ },
5535
+ {
5536
+ "name": "height",
5537
+ "type": "uint64",
5538
+ "internalType": "uint64"
5539
+ },
5540
+ {
5541
+ "name": "keys",
5542
+ "type": "bytes[]",
5543
+ "internalType": "bytes[]"
5544
+ },
5545
+ {
5546
+ "name": "timeout",
5547
+ "type": "uint64",
5548
+ "internalType": "uint64"
5549
+ },
5550
+ {
5551
+ "name": "fee",
5552
+ "type": "uint256",
5553
+ "internalType": "uint256"
5554
+ },
5555
+ {
5556
+ "name": "context",
5557
+ "type": "bytes",
5558
+ "internalType": "bytes"
5559
+ }
4739
5560
  ]
4740
5561
  }
4741
5562
  ],
4742
- outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
4743
- stateMutability: "view"
5563
+ "outputs": [
5564
+ {
5565
+ "name": "",
5566
+ "type": "uint256",
5567
+ "internalType": "uint256"
5568
+ }
5569
+ ],
5570
+ "stateMutability": "view"
4744
5571
  },
4745
5572
  {
4746
- type: "function",
4747
- name: "select",
4748
- inputs: [
5573
+ "type": "function",
5574
+ "name": "select",
5575
+ "inputs": [
4749
5576
  {
4750
- name: "options",
4751
- type: "tuple",
4752
- internalType: "struct SelectOptions",
4753
- components: [
4754
- { name: "commitment", type: "bytes32", internalType: "bytes32" },
4755
- { name: "solver", type: "address", internalType: "address" },
4756
- { name: "signature", type: "bytes", internalType: "bytes" }
5577
+ "name": "options",
5578
+ "type": "tuple",
5579
+ "internalType": "struct SelectOptions",
5580
+ "components": [
5581
+ {
5582
+ "name": "commitment",
5583
+ "type": "bytes32",
5584
+ "internalType": "bytes32"
5585
+ },
5586
+ {
5587
+ "name": "solver",
5588
+ "type": "address",
5589
+ "internalType": "address"
5590
+ },
5591
+ {
5592
+ "name": "signature",
5593
+ "type": "bytes",
5594
+ "internalType": "bytes"
5595
+ }
4757
5596
  ]
4758
5597
  }
4759
5598
  ],
4760
- outputs: [{ name: "", type: "address", internalType: "address" }],
4761
- stateMutability: "nonpayable"
5599
+ "outputs": [
5600
+ {
5601
+ "name": "",
5602
+ "type": "address",
5603
+ "internalType": "address"
5604
+ }
5605
+ ],
5606
+ "stateMutability": "nonpayable"
4762
5607
  },
4763
5608
  {
4764
- type: "function",
4765
- name: "setParams",
4766
- inputs: [
5609
+ "type": "function",
5610
+ "name": "setParams",
5611
+ "inputs": [
4767
5612
  {
4768
- name: "p",
4769
- type: "tuple",
4770
- internalType: "struct Params",
4771
- components: [
4772
- { name: "host", type: "address", internalType: "address" },
4773
- { name: "dispatcher", type: "address", internalType: "address" },
4774
- { name: "solverSelection", type: "bool", internalType: "bool" },
4775
- { name: "surplusShareBps", type: "uint256", internalType: "uint256" },
4776
- { name: "protocolFeeBps", type: "uint256", internalType: "uint256" },
4777
- { name: "priceOracle", type: "address", internalType: "address" }
5613
+ "name": "p",
5614
+ "type": "tuple",
5615
+ "internalType": "struct Params",
5616
+ "components": [
5617
+ {
5618
+ "name": "host",
5619
+ "type": "address",
5620
+ "internalType": "address"
5621
+ },
5622
+ {
5623
+ "name": "dispatcher",
5624
+ "type": "address",
5625
+ "internalType": "address"
5626
+ },
5627
+ {
5628
+ "name": "solverSelection",
5629
+ "type": "bool",
5630
+ "internalType": "bool"
5631
+ },
5632
+ {
5633
+ "name": "surplusShareBps",
5634
+ "type": "uint256",
5635
+ "internalType": "uint256"
5636
+ },
5637
+ {
5638
+ "name": "protocolFeeBps",
5639
+ "type": "uint256",
5640
+ "internalType": "uint256"
5641
+ },
5642
+ {
5643
+ "name": "priceOracle",
5644
+ "type": "address",
5645
+ "internalType": "address"
5646
+ }
4778
5647
  ]
4779
5648
  }
4780
5649
  ],
4781
- outputs: [],
4782
- stateMutability: "nonpayable"
5650
+ "outputs": [],
5651
+ "stateMutability": "nonpayable"
4783
5652
  },
4784
5653
  {
4785
- type: "event",
4786
- name: "DestinationProtocolFeeUpdated",
4787
- inputs: [
4788
- { name: "stateMachineId", type: "bytes32", indexed: true, internalType: "bytes32" },
4789
- { name: "feeBps", type: "uint256", indexed: false, internalType: "uint256" }
5654
+ "type": "event",
5655
+ "name": "DestinationProtocolFeeUpdated",
5656
+ "inputs": [
5657
+ {
5658
+ "name": "stateMachineId",
5659
+ "type": "bytes32",
5660
+ "indexed": true,
5661
+ "internalType": "bytes32"
5662
+ },
5663
+ {
5664
+ "name": "feeBps",
5665
+ "type": "uint256",
5666
+ "indexed": false,
5667
+ "internalType": "uint256"
5668
+ }
4790
5669
  ],
4791
- anonymous: false
5670
+ "anonymous": false
4792
5671
  },
4793
5672
  {
4794
- type: "event",
4795
- name: "DustCollected",
4796
- inputs: [
4797
- { name: "token", type: "address", indexed: false, internalType: "address" },
4798
- { name: "amount", type: "uint256", indexed: false, internalType: "uint256" }
5673
+ "type": "event",
5674
+ "name": "DustCollected",
5675
+ "inputs": [
5676
+ {
5677
+ "name": "token",
5678
+ "type": "address",
5679
+ "indexed": false,
5680
+ "internalType": "address"
5681
+ },
5682
+ {
5683
+ "name": "amount",
5684
+ "type": "uint256",
5685
+ "indexed": false,
5686
+ "internalType": "uint256"
5687
+ }
4799
5688
  ],
4800
- anonymous: false
5689
+ "anonymous": false
4801
5690
  },
4802
5691
  {
4803
- type: "event",
4804
- name: "DustSwept",
4805
- inputs: [
4806
- { name: "token", type: "address", indexed: false, internalType: "address" },
4807
- { name: "amount", type: "uint256", indexed: false, internalType: "uint256" },
4808
- { name: "beneficiary", type: "address", indexed: false, internalType: "address" }
5692
+ "type": "event",
5693
+ "name": "DustSwept",
5694
+ "inputs": [
5695
+ {
5696
+ "name": "token",
5697
+ "type": "address",
5698
+ "indexed": false,
5699
+ "internalType": "address"
5700
+ },
5701
+ {
5702
+ "name": "amount",
5703
+ "type": "uint256",
5704
+ "indexed": false,
5705
+ "internalType": "uint256"
5706
+ },
5707
+ {
5708
+ "name": "beneficiary",
5709
+ "type": "address",
5710
+ "indexed": false,
5711
+ "internalType": "address"
5712
+ }
4809
5713
  ],
4810
- anonymous: false
5714
+ "anonymous": false
4811
5715
  },
4812
- { type: "event", name: "EIP712DomainChanged", inputs: [], anonymous: false },
4813
5716
  {
4814
- type: "event",
4815
- name: "EscrowRefunded",
4816
- inputs: [{ name: "commitment", type: "bytes32", indexed: true, internalType: "bytes32" }],
4817
- anonymous: false
5717
+ "type": "event",
5718
+ "name": "EIP712DomainChanged",
5719
+ "inputs": [],
5720
+ "anonymous": false
4818
5721
  },
4819
5722
  {
4820
- type: "event",
4821
- name: "EscrowReleased",
4822
- inputs: [{ name: "commitment", type: "bytes32", indexed: true, internalType: "bytes32" }],
4823
- anonymous: false
5723
+ "type": "event",
5724
+ "name": "EscrowRefunded",
5725
+ "inputs": [
5726
+ {
5727
+ "name": "commitment",
5728
+ "type": "bytes32",
5729
+ "indexed": true,
5730
+ "internalType": "bytes32"
5731
+ }
5732
+ ],
5733
+ "anonymous": false
4824
5734
  },
4825
5735
  {
4826
- type: "event",
4827
- name: "NewDeploymentAdded",
4828
- inputs: [
4829
- { name: "stateMachineId", type: "bytes", indexed: false, internalType: "bytes" },
4830
- { name: "gateway", type: "address", indexed: false, internalType: "address" }
5736
+ "type": "event",
5737
+ "name": "EscrowReleased",
5738
+ "inputs": [
5739
+ {
5740
+ "name": "commitment",
5741
+ "type": "bytes32",
5742
+ "indexed": true,
5743
+ "internalType": "bytes32"
5744
+ }
4831
5745
  ],
4832
- anonymous: false
5746
+ "anonymous": false
4833
5747
  },
4834
5748
  {
4835
- type: "event",
4836
- name: "OrderFilled",
4837
- inputs: [
4838
- { name: "commitment", type: "bytes32", indexed: true, internalType: "bytes32" },
4839
- { name: "filler", type: "address", indexed: false, internalType: "address" }
5749
+ "type": "event",
5750
+ "name": "NewDeploymentAdded",
5751
+ "inputs": [
5752
+ {
5753
+ "name": "stateMachineId",
5754
+ "type": "bytes",
5755
+ "indexed": false,
5756
+ "internalType": "bytes"
5757
+ },
5758
+ {
5759
+ "name": "gateway",
5760
+ "type": "address",
5761
+ "indexed": false,
5762
+ "internalType": "address"
5763
+ }
4840
5764
  ],
4841
- anonymous: false
5765
+ "anonymous": false
4842
5766
  },
4843
5767
  {
4844
- type: "event",
4845
- name: "OrderPlaced",
4846
- inputs: [
4847
- { name: "user", type: "bytes32", indexed: false, internalType: "bytes32" },
4848
- { name: "source", type: "bytes", indexed: false, internalType: "bytes" },
4849
- { name: "destination", type: "bytes", indexed: false, internalType: "bytes" },
4850
- { name: "deadline", type: "uint256", indexed: false, internalType: "uint256" },
4851
- { name: "nonce", type: "uint256", indexed: false, internalType: "uint256" },
4852
- { name: "fees", type: "uint256", indexed: false, internalType: "uint256" },
4853
- { name: "session", type: "address", indexed: false, internalType: "address" },
4854
- { name: "beneficiary", type: "bytes32", indexed: false, internalType: "bytes32" },
4855
- {
4856
- name: "predispatch",
4857
- type: "tuple[]",
4858
- indexed: false,
4859
- internalType: "struct TokenInfo[]",
4860
- components: [
4861
- { name: "token", type: "bytes32", internalType: "bytes32" },
4862
- { name: "amount", type: "uint256", internalType: "uint256" }
5768
+ "type": "event",
5769
+ "name": "OrderFilled",
5770
+ "inputs": [
5771
+ {
5772
+ "name": "commitment",
5773
+ "type": "bytes32",
5774
+ "indexed": true,
5775
+ "internalType": "bytes32"
5776
+ },
5777
+ {
5778
+ "name": "filler",
5779
+ "type": "address",
5780
+ "indexed": false,
5781
+ "internalType": "address"
5782
+ }
5783
+ ],
5784
+ "anonymous": false
5785
+ },
5786
+ {
5787
+ "type": "event",
5788
+ "name": "OrderPlaced",
5789
+ "inputs": [
5790
+ {
5791
+ "name": "user",
5792
+ "type": "bytes32",
5793
+ "indexed": false,
5794
+ "internalType": "bytes32"
5795
+ },
5796
+ {
5797
+ "name": "source",
5798
+ "type": "bytes",
5799
+ "indexed": false,
5800
+ "internalType": "bytes"
5801
+ },
5802
+ {
5803
+ "name": "destination",
5804
+ "type": "bytes",
5805
+ "indexed": false,
5806
+ "internalType": "bytes"
5807
+ },
5808
+ {
5809
+ "name": "deadline",
5810
+ "type": "uint256",
5811
+ "indexed": false,
5812
+ "internalType": "uint256"
5813
+ },
5814
+ {
5815
+ "name": "nonce",
5816
+ "type": "uint256",
5817
+ "indexed": false,
5818
+ "internalType": "uint256"
5819
+ },
5820
+ {
5821
+ "name": "fees",
5822
+ "type": "uint256",
5823
+ "indexed": false,
5824
+ "internalType": "uint256"
5825
+ },
5826
+ {
5827
+ "name": "session",
5828
+ "type": "address",
5829
+ "indexed": false,
5830
+ "internalType": "address"
5831
+ },
5832
+ {
5833
+ "name": "beneficiary",
5834
+ "type": "bytes32",
5835
+ "indexed": false,
5836
+ "internalType": "bytes32"
5837
+ },
5838
+ {
5839
+ "name": "predispatch",
5840
+ "type": "tuple[]",
5841
+ "indexed": false,
5842
+ "internalType": "struct TokenInfo[]",
5843
+ "components": [
5844
+ {
5845
+ "name": "token",
5846
+ "type": "bytes32",
5847
+ "internalType": "bytes32"
5848
+ },
5849
+ {
5850
+ "name": "amount",
5851
+ "type": "uint256",
5852
+ "internalType": "uint256"
5853
+ }
4863
5854
  ]
4864
5855
  },
4865
5856
  {
4866
- name: "inputs",
4867
- type: "tuple[]",
4868
- indexed: false,
4869
- internalType: "struct TokenInfo[]",
4870
- components: [
4871
- { name: "token", type: "bytes32", internalType: "bytes32" },
4872
- { name: "amount", type: "uint256", internalType: "uint256" }
5857
+ "name": "inputs",
5858
+ "type": "tuple[]",
5859
+ "indexed": false,
5860
+ "internalType": "struct TokenInfo[]",
5861
+ "components": [
5862
+ {
5863
+ "name": "token",
5864
+ "type": "bytes32",
5865
+ "internalType": "bytes32"
5866
+ },
5867
+ {
5868
+ "name": "amount",
5869
+ "type": "uint256",
5870
+ "internalType": "uint256"
5871
+ }
4873
5872
  ]
4874
5873
  },
4875
5874
  {
4876
- name: "outputs",
4877
- type: "tuple[]",
4878
- indexed: false,
4879
- internalType: "struct TokenInfo[]",
4880
- components: [
4881
- { name: "token", type: "bytes32", internalType: "bytes32" },
4882
- { name: "amount", type: "uint256", internalType: "uint256" }
5875
+ "name": "outputs",
5876
+ "type": "tuple[]",
5877
+ "indexed": false,
5878
+ "internalType": "struct TokenInfo[]",
5879
+ "components": [
5880
+ {
5881
+ "name": "token",
5882
+ "type": "bytes32",
5883
+ "internalType": "bytes32"
5884
+ },
5885
+ {
5886
+ "name": "amount",
5887
+ "type": "uint256",
5888
+ "internalType": "uint256"
5889
+ }
4883
5890
  ]
4884
5891
  }
4885
5892
  ],
4886
- anonymous: false
5893
+ "anonymous": false
5894
+ },
5895
+ {
5896
+ "type": "event",
5897
+ "name": "ParamsUpdated",
5898
+ "inputs": [
5899
+ {
5900
+ "name": "previous",
5901
+ "type": "tuple",
5902
+ "indexed": false,
5903
+ "internalType": "struct Params",
5904
+ "components": [
5905
+ {
5906
+ "name": "host",
5907
+ "type": "address",
5908
+ "internalType": "address"
5909
+ },
5910
+ {
5911
+ "name": "dispatcher",
5912
+ "type": "address",
5913
+ "internalType": "address"
5914
+ },
5915
+ {
5916
+ "name": "solverSelection",
5917
+ "type": "bool",
5918
+ "internalType": "bool"
5919
+ },
5920
+ {
5921
+ "name": "surplusShareBps",
5922
+ "type": "uint256",
5923
+ "internalType": "uint256"
5924
+ },
5925
+ {
5926
+ "name": "protocolFeeBps",
5927
+ "type": "uint256",
5928
+ "internalType": "uint256"
5929
+ },
5930
+ {
5931
+ "name": "priceOracle",
5932
+ "type": "address",
5933
+ "internalType": "address"
5934
+ }
5935
+ ]
5936
+ },
5937
+ {
5938
+ "name": "current",
5939
+ "type": "tuple",
5940
+ "indexed": false,
5941
+ "internalType": "struct Params",
5942
+ "components": [
5943
+ {
5944
+ "name": "host",
5945
+ "type": "address",
5946
+ "internalType": "address"
5947
+ },
5948
+ {
5949
+ "name": "dispatcher",
5950
+ "type": "address",
5951
+ "internalType": "address"
5952
+ },
5953
+ {
5954
+ "name": "solverSelection",
5955
+ "type": "bool",
5956
+ "internalType": "bool"
5957
+ },
5958
+ {
5959
+ "name": "surplusShareBps",
5960
+ "type": "uint256",
5961
+ "internalType": "uint256"
5962
+ },
5963
+ {
5964
+ "name": "protocolFeeBps",
5965
+ "type": "uint256",
5966
+ "internalType": "uint256"
5967
+ },
5968
+ {
5969
+ "name": "priceOracle",
5970
+ "type": "address",
5971
+ "internalType": "address"
5972
+ }
5973
+ ]
5974
+ }
5975
+ ],
5976
+ "anonymous": false
5977
+ },
5978
+ {
5979
+ "type": "event",
5980
+ "name": "PartialFill",
5981
+ "inputs": [
5982
+ {
5983
+ "name": "commitment",
5984
+ "type": "bytes32",
5985
+ "indexed": true,
5986
+ "internalType": "bytes32"
5987
+ },
5988
+ {
5989
+ "name": "filler",
5990
+ "type": "address",
5991
+ "indexed": false,
5992
+ "internalType": "address"
5993
+ },
5994
+ {
5995
+ "name": "outputs",
5996
+ "type": "tuple[]",
5997
+ "indexed": false,
5998
+ "internalType": "struct TokenInfo[]",
5999
+ "components": [
6000
+ {
6001
+ "name": "token",
6002
+ "type": "bytes32",
6003
+ "internalType": "bytes32"
6004
+ },
6005
+ {
6006
+ "name": "amount",
6007
+ "type": "uint256",
6008
+ "internalType": "uint256"
6009
+ }
6010
+ ]
6011
+ },
6012
+ {
6013
+ "name": "inputs",
6014
+ "type": "tuple[]",
6015
+ "indexed": false,
6016
+ "internalType": "struct TokenInfo[]",
6017
+ "components": [
6018
+ {
6019
+ "name": "token",
6020
+ "type": "bytes32",
6021
+ "internalType": "bytes32"
6022
+ },
6023
+ {
6024
+ "name": "amount",
6025
+ "type": "uint256",
6026
+ "internalType": "uint256"
6027
+ }
6028
+ ]
6029
+ }
6030
+ ],
6031
+ "anonymous": false
6032
+ },
6033
+ {
6034
+ "type": "error",
6035
+ "name": "Cancelled",
6036
+ "inputs": []
6037
+ },
6038
+ {
6039
+ "type": "error",
6040
+ "name": "ECDSAInvalidSignature",
6041
+ "inputs": []
6042
+ },
6043
+ {
6044
+ "type": "error",
6045
+ "name": "ECDSAInvalidSignatureLength",
6046
+ "inputs": [
6047
+ {
6048
+ "name": "length",
6049
+ "type": "uint256",
6050
+ "internalType": "uint256"
6051
+ }
6052
+ ]
6053
+ },
6054
+ {
6055
+ "type": "error",
6056
+ "name": "ECDSAInvalidSignatureS",
6057
+ "inputs": [
6058
+ {
6059
+ "name": "s",
6060
+ "type": "bytes32",
6061
+ "internalType": "bytes32"
6062
+ }
6063
+ ]
6064
+ },
6065
+ {
6066
+ "type": "error",
6067
+ "name": "Expired",
6068
+ "inputs": []
6069
+ },
6070
+ {
6071
+ "type": "error",
6072
+ "name": "Filled",
6073
+ "inputs": []
6074
+ },
6075
+ {
6076
+ "type": "error",
6077
+ "name": "InsufficientNativeToken",
6078
+ "inputs": []
6079
+ },
6080
+ {
6081
+ "type": "error",
6082
+ "name": "InvalidInput",
6083
+ "inputs": []
6084
+ },
6085
+ {
6086
+ "type": "error",
6087
+ "name": "InvalidShortString",
6088
+ "inputs": []
6089
+ },
6090
+ {
6091
+ "type": "error",
6092
+ "name": "NotExpired",
6093
+ "inputs": []
4887
6094
  },
4888
6095
  {
4889
- type: "event",
4890
- name: "ParamsUpdated",
4891
- inputs: [
6096
+ "type": "error",
6097
+ "name": "SafeCastOverflowedUintDowncast",
6098
+ "inputs": [
4892
6099
  {
4893
- name: "previous",
4894
- type: "tuple",
4895
- indexed: false,
4896
- internalType: "struct Params",
4897
- components: [
4898
- { name: "host", type: "address", internalType: "address" },
4899
- { name: "dispatcher", type: "address", internalType: "address" },
4900
- { name: "solverSelection", type: "bool", internalType: "bool" },
4901
- { name: "surplusShareBps", type: "uint256", internalType: "uint256" },
4902
- { name: "protocolFeeBps", type: "uint256", internalType: "uint256" },
4903
- { name: "priceOracle", type: "address", internalType: "address" }
4904
- ]
6100
+ "name": "bits",
6101
+ "type": "uint8",
6102
+ "internalType": "uint8"
4905
6103
  },
4906
6104
  {
4907
- name: "current",
4908
- type: "tuple",
4909
- indexed: false,
4910
- internalType: "struct Params",
4911
- components: [
4912
- { name: "host", type: "address", internalType: "address" },
4913
- { name: "dispatcher", type: "address", internalType: "address" },
4914
- { name: "solverSelection", type: "bool", internalType: "bool" },
4915
- { name: "surplusShareBps", type: "uint256", internalType: "uint256" },
4916
- { name: "protocolFeeBps", type: "uint256", internalType: "uint256" },
4917
- { name: "priceOracle", type: "address", internalType: "address" }
4918
- ]
6105
+ "name": "value",
6106
+ "type": "uint256",
6107
+ "internalType": "uint256"
4919
6108
  }
4920
- ],
4921
- anonymous: false
6109
+ ]
4922
6110
  },
4923
6111
  {
4924
- type: "event",
4925
- name: "PartialFill",
4926
- inputs: [
4927
- { name: "commitment", type: "bytes32", indexed: true, internalType: "bytes32" },
4928
- { name: "filler", type: "address", indexed: false, internalType: "address" },
6112
+ "type": "error",
6113
+ "name": "SafeERC20FailedOperation",
6114
+ "inputs": [
4929
6115
  {
4930
- name: "outputs",
4931
- type: "tuple[]",
4932
- indexed: false,
4933
- internalType: "struct TokenInfo[]",
4934
- components: [
4935
- { name: "token", type: "bytes32", internalType: "bytes32" },
4936
- { name: "amount", type: "uint256", internalType: "uint256" }
4937
- ]
4938
- },
6116
+ "name": "token",
6117
+ "type": "address",
6118
+ "internalType": "address"
6119
+ }
6120
+ ]
6121
+ },
6122
+ {
6123
+ "type": "error",
6124
+ "name": "StringTooLong",
6125
+ "inputs": [
4939
6126
  {
4940
- name: "inputs",
4941
- type: "tuple[]",
4942
- indexed: false,
4943
- internalType: "struct TokenInfo[]",
4944
- components: [
4945
- { name: "token", type: "bytes32", internalType: "bytes32" },
4946
- { name: "amount", type: "uint256", internalType: "uint256" }
4947
- ]
6127
+ "name": "str",
6128
+ "type": "string",
6129
+ "internalType": "string"
4948
6130
  }
4949
- ],
4950
- anonymous: false
6131
+ ]
4951
6132
  },
4952
- { type: "error", name: "Cancelled", inputs: [] },
4953
- { type: "error", name: "ECDSAInvalidSignature", inputs: [] },
4954
6133
  {
4955
- type: "error",
4956
- name: "ECDSAInvalidSignatureLength",
4957
- inputs: [{ name: "length", type: "uint256", internalType: "uint256" }]
6134
+ "type": "error",
6135
+ "name": "Unauthorized",
6136
+ "inputs": []
4958
6137
  },
4959
6138
  {
4960
- type: "error",
4961
- name: "ECDSAInvalidSignatureS",
4962
- inputs: [{ name: "s", type: "bytes32", internalType: "bytes32" }]
6139
+ "type": "error",
6140
+ "name": "UnauthorizedCall",
6141
+ "inputs": []
4963
6142
  },
4964
- { type: "error", name: "Expired", inputs: [] },
4965
- { type: "error", name: "Filled", inputs: [] },
4966
- { type: "error", name: "InsufficientNativeToken", inputs: [] },
4967
- { type: "error", name: "InvalidInput", inputs: [] },
4968
- { type: "error", name: "InvalidShortString", inputs: [] },
4969
- { type: "error", name: "NotExpired", inputs: [] },
4970
6143
  {
4971
- type: "error",
4972
- name: "SafeCastOverflowedUintDowncast",
4973
- inputs: [
4974
- { name: "bits", type: "uint8", internalType: "uint8" },
4975
- { name: "value", type: "uint256", internalType: "uint256" }
4976
- ]
6144
+ "type": "error",
6145
+ "name": "UnexpectedCall",
6146
+ "inputs": []
4977
6147
  },
4978
6148
  {
4979
- type: "error",
4980
- name: "SafeERC20FailedOperation",
4981
- inputs: [{ name: "token", type: "address", internalType: "address" }]
4982
- },
4983
- { type: "error", name: "StringTooLong", inputs: [{ name: "str", type: "string", internalType: "string" }] },
4984
- { type: "error", name: "Unauthorized", inputs: [] },
4985
- { type: "error", name: "UnauthorizedCall", inputs: [] },
4986
- { type: "error", name: "UnexpectedCall", inputs: [] },
4987
- { type: "error", name: "UnknownOrder", inputs: [] },
4988
- { type: "error", name: "WrongChain", inputs: [] }
6149
+ "type": "error",
6150
+ "name": "UnknownOrder",
6151
+ "inputs": []
6152
+ },
6153
+ {
6154
+ "type": "error",
6155
+ "name": "WrongChain",
6156
+ "inputs": []
6157
+ }
4989
6158
  ];
4990
6159
  var IntentGatewayV2_default = { ABI: ABI3 };
4991
6160
  function getPeakPosByHeight(height) {
@@ -5667,6 +6836,7 @@ function bytes32ToBytes20(bytes32Address) {
5667
6836
  return bytesToHex(addressBytes);
5668
6837
  }
5669
6838
  function bytes20ToBytes32(bytes20Address) {
6839
+ if (bytes20Address.length === 66) return bytes20Address;
5670
6840
  return `0x${bytes20Address.slice(2).padStart(64, "0")}`;
5671
6841
  }
5672
6842
  function hexToString(hex) {
@@ -7783,6 +8953,7 @@ var TronChain = class {
7783
8953
  *
7784
8954
  * This mirrors the behavior used in IntentGatewayV2 for Tron chains.
7785
8955
  */
8956
+ // biome-ignore lint/suspicious/noExplicitAny: Tron signed transaction has a different shape from EVM HexString
7786
8957
  async broadcastTransaction(signedTransaction) {
7787
8958
  const tronReceipt = await this.tronWeb.trx.sendRawTransaction(signedTransaction);
7788
8959
  if (!tronReceipt.result) {
@@ -8384,6 +9555,8 @@ var IntentsCoprocessor = class _IntentsCoprocessor {
8384
9555
  this.substratePrivateKey = substratePrivateKey;
8385
9556
  this.ownsConnection = ownsConnection;
8386
9557
  }
9558
+ /** Cached result of whether the node exposes intents_* RPC methods */
9559
+ hasIntentsRpc = null;
8387
9560
  /**
8388
9561
  * Creates and connects an IntentsCoprocessor to a Hyperbridge node.
8389
9562
  * This creates and manages its own API connection.
@@ -8451,6 +9624,20 @@ var IntentsCoprocessor = class _IntentsCoprocessor {
8451
9624
  const seedBytes = Buffer.from(hex, "hex");
8452
9625
  return keyring.addFromSeed(seedBytes);
8453
9626
  }
9627
+ /**
9628
+ * Checks if the connected node exposes intents_* RPC methods.
9629
+ * Result is cached after the first check.
9630
+ */
9631
+ async checkIntentsRpc() {
9632
+ if (this.hasIntentsRpc !== null) return this.hasIntentsRpc;
9633
+ try {
9634
+ const methods = await this.api.rpc.rpc.methods();
9635
+ this.hasIntentsRpc = methods.methods.some((m) => m.toString().startsWith("intent"));
9636
+ } catch {
9637
+ this.hasIntentsRpc = false;
9638
+ }
9639
+ return this.hasIntentsRpc;
9640
+ }
8454
9641
  /**
8455
9642
  * Signs and sends an extrinsic, handling status updates and errors
8456
9643
  * Implements retry logic with progressive tip increases for stuck transactions
@@ -8586,36 +9773,62 @@ var IntentsCoprocessor = class _IntentsCoprocessor {
8586
9773
  /**
8587
9774
  * Fetches all bids for a given order commitment from Hyperbridge.
8588
9775
  *
9776
+ * Uses the custom intents_getBidsForOrder RPC if available on the node
9777
+ * for a single round-trip. Falls back to parallel storage + offchain
9778
+ * lookups otherwise.
9779
+ *
8589
9780
  * @param commitment - The order commitment hash (bytes32)
8590
9781
  * @returns Array of FillerBid objects containing filler address, userOp, and deposit
8591
9782
  */
8592
9783
  async getBidsForOrder(commitment) {
8593
- const storageEntries = await this.getBidStorageEntries(commitment);
8594
- if (storageEntries.length === 0) {
8595
- return [];
9784
+ const hasRpc = await this.checkIntentsRpc();
9785
+ if (hasRpc) {
9786
+ try {
9787
+ return await this.getBidsViaRpc(commitment);
9788
+ } catch (err) {
9789
+ console.warn("intents RPC failed, falling back to storage queries:", err);
9790
+ }
8596
9791
  }
8597
- const bids = [];
8598
- for (const entry of storageEntries) {
9792
+ return await this.getBidsViaStorage(commitment);
9793
+ }
9794
+ /**
9795
+ * Fetches bids using the custom intents_getBidsForOrder RPC.
9796
+ * Single round-trip but does not include deposit amounts.
9797
+ */
9798
+ async getBidsViaRpc(commitment) {
9799
+ const result = await this.api._rpcCore.provider.send("intents_getBidsForOrder", [
9800
+ commitment
9801
+ ]);
9802
+ return result.map((entry) => {
9803
+ const userOp = decodeUserOpScale(entry.user_op);
9804
+ const filler = new Keyring({ type: "sr25519" }).encodeAddress(hexToU8a(entry.filler));
9805
+ return { filler, userOp, deposit: 0n };
9806
+ });
9807
+ }
9808
+ /**
9809
+ * Fetches bids using on-chain storage entries + parallel offchain lookups.
9810
+ * Slower but works on all nodes and includes deposit amounts.
9811
+ */
9812
+ async getBidsViaStorage(commitment) {
9813
+ const entries = await this.api.query.intentsCoprocessor.bids.entries(commitment);
9814
+ if (entries.length === 0) return [];
9815
+ const bidPromises = entries.map(async ([storageKey, depositValue]) => {
8599
9816
  try {
8600
- const { filler, deposit } = entry;
9817
+ const filler = storageKey.args[1].toString();
9818
+ const deposit = BigInt(depositValue.toString());
8601
9819
  const offchainKey = this.buildOffchainBidKey(commitment, filler);
8602
9820
  const offchainKeyHex = u8aToHex(offchainKey);
8603
9821
  const offchainResult = await this.api.rpc.offchain.localStorageGet("PERSISTENT", offchainKeyHex);
8604
- if (!offchainResult || offchainResult.isNone) {
8605
- continue;
8606
- }
9822
+ if (!offchainResult || offchainResult.isNone) return null;
8607
9823
  const bidData = offchainResult.unwrap().toHex();
8608
9824
  const decoded = this.decodeBid(bidData);
8609
- bids.push({
8610
- filler: decoded.filler,
8611
- userOp: decoded.userOp,
8612
- deposit
8613
- });
9825
+ return { filler: decoded.filler, userOp: decoded.userOp, deposit };
8614
9826
  } catch {
8615
- continue;
9827
+ return null;
8616
9828
  }
8617
- }
8618
- return bids;
9829
+ });
9830
+ const results = await Promise.all(bidPromises);
9831
+ return results.filter((b) => b !== null);
8619
9832
  }
8620
9833
  /** Decodes SCALE-encoded Bid struct and SCALE-encoded PackedUserOperation */
8621
9834
  decodeBid(hex) {
@@ -8670,7 +9883,7 @@ async function getSubstrateChain(chainConfig) {
8670
9883
  // src/queries.ts
8671
9884
  var POST_REQUEST_STATUS = `
8672
9885
  query RequestStatusM($hash: String!) {
8673
- requests(
9886
+ requestV2s(
8674
9887
  filter: { commitment: { equalTo: $hash } }
8675
9888
  ) {
8676
9889
  nodes {
@@ -8698,7 +9911,7 @@ var POST_REQUEST_STATUS = `
8698
9911
  `;
8699
9912
  var GET_REQUEST_STATUS = `
8700
9913
  query GetRequestDetails($commitment: String!) {
8701
- getRequests(
9914
+ getRequestV2s(
8702
9915
  filter: { commitment: { equalTo: $commitment } }
8703
9916
  ) {
8704
9917
  nodes {
@@ -8716,7 +9929,6 @@ query GetRequestDetails($commitment: String!) {
8716
9929
  blockHash
8717
9930
  transactionHash
8718
9931
  blockTimestamp
8719
- status
8720
9932
  chain
8721
9933
  commitment
8722
9934
  statusMetadata {
@@ -8834,7 +10046,7 @@ query LatestStateMachineUpdate($statemachineId: String!, $chain: String!) {
8834
10046
  `;
8835
10047
  var ASSET_TELEPORTED_BY_PARAMS = `
8836
10048
  query AssetTeleportedByParams($id: String!) {
8837
- assetTeleported(id: $id) {
10049
+ assetTeleportedV2(id: $id) {
8838
10050
  id
8839
10051
  from
8840
10052
  to
@@ -8901,7 +10113,7 @@ query OrderStatus($commitment: String!) {
8901
10113
  }`;
8902
10114
  var TOKEN_GATEWAY_ASSET_TELEPORTED_STATUS = `
8903
10115
  query TokenGatewayAssetTeleportedStatus($commitment: String!) {
8904
- tokenGatewayAssetTeleporteds(
10116
+ tokenGatewayAssetTeleportedV2s(
8905
10117
  filter: { commitment: { equalTo: $commitment } }
8906
10118
  ) {
8907
10119
  nodes {
@@ -8943,10 +10155,10 @@ async function queryAssetTeleported(params) {
8943
10155
  return await retryPromise(
8944
10156
  async () => {
8945
10157
  const response = await queryClient.request(ASSET_TELEPORTED_BY_PARAMS, { id });
8946
- if (!response?.assetTeleported) {
10158
+ if (!response?.assetTeleportedV2) {
8947
10159
  throw new Error(`AssetTeleportedEvent not found for ${id}`);
8948
10160
  }
8949
- return response.assetTeleported;
10161
+ return response.assetTeleportedV2;
8950
10162
  },
8951
10163
  {
8952
10164
  logMessage: "queryingAssetTeleported",
@@ -8973,7 +10185,7 @@ async function _queryTokenGatewayAssetTeleportedInternal(params) {
8973
10185
  logMessage: `querying 'TokenGatewayAssetTeleported' with Statuses by CommitmentHash(${commitmentHash})`
8974
10186
  }
8975
10187
  );
8976
- const first_record = response.tokenGatewayAssetTeleporteds.nodes[0];
10188
+ const first_record = response.tokenGatewayAssetTeleportedV2s.nodes[0];
8977
10189
  if (!first_record) return;
8978
10190
  logger.trace("`TokenGatewayAssetTeleported` found");
8979
10191
  const { statusMetadata, ...first_node } = first_record;
@@ -9014,7 +10226,7 @@ async function _queryRequestInternal(params) {
9014
10226
  logMessage: `querying 'Request' with Statuses by CommitmentHash(${hash})`
9015
10227
  }
9016
10228
  );
9017
- const first_record = response.requests.nodes[0];
10229
+ const first_record = response.requestV2s.nodes[0];
9018
10230
  if (!first_record) return;
9019
10231
  logger.trace("`Request` found");
9020
10232
  const { statusMetadata, ...first_node } = first_record;
@@ -9053,9 +10265,9 @@ async function _queryGetRequestInternal(params) {
9053
10265
  logMessage: `query \`IGetRequest\` with commitment hash ${commitmentHash}`
9054
10266
  }
9055
10267
  );
9056
- if (!response.getRequests.nodes[0]) return;
10268
+ if (!response.getRequestV2s.nodes[0]) return;
9057
10269
  logger.trace("`Request` found");
9058
- const statuses = response.getRequests.nodes[0].statusMetadata.nodes.map((item) => ({
10270
+ const statuses = response.getRequestV2s.nodes[0].statusMetadata.nodes.map((item) => ({
9059
10271
  status: item.status,
9060
10272
  metadata: {
9061
10273
  blockHash: item.blockHash,
@@ -9067,7 +10279,7 @@ async function _queryGetRequestInternal(params) {
9067
10279
  const sorted = statuses.sort((a, b) => {
9068
10280
  return REQUEST_STATUS_WEIGHTS[a.status] - REQUEST_STATUS_WEIGHTS[b.status];
9069
10281
  });
9070
- const { statusMetadata, ...rest } = response.getRequests.nodes[0];
10282
+ const { statusMetadata, ...rest } = response.getRequestV2s.nodes[0];
9071
10283
  return {
9072
10284
  ...rest,
9073
10285
  commitment: commitmentHash,
@@ -12101,6 +13313,26 @@ var STORAGE_KEYS = Object.freeze({
12101
13313
  sourceProof: (orderId) => `cancel-order:${orderId}:sourceProof`,
12102
13314
  postCommitment: (orderId) => `cancel-order:${orderId}:postCommitment`
12103
13315
  });
13316
+ function createUsedUserOpsStorage(options = {}) {
13317
+ const key = options.env ?? detectEnvironment();
13318
+ const driver = loadDriver({ key}) ?? inMemoryDriver();
13319
+ const baseStorage = createStorage({ driver });
13320
+ const getItem = async (key2) => {
13321
+ const value = await baseStorage.getItem(key2);
13322
+ return value ?? null;
13323
+ };
13324
+ const setItem = async (key2, value) => {
13325
+ await baseStorage.setItem(key2, value);
13326
+ };
13327
+ const removeItem = async (key2) => {
13328
+ await baseStorage.removeItem(key2);
13329
+ };
13330
+ return Object.freeze({
13331
+ getItem,
13332
+ setItem,
13333
+ removeItem
13334
+ });
13335
+ }
12104
13336
  function createSessionKeyStorage(options = {}) {
12105
13337
  const key = options.env ?? detectEnvironment();
12106
13338
  const driver = loadDriver({ key}) ?? inMemoryDriver();
@@ -15162,9 +16394,13 @@ var ORDER_V2_PARAM_TYPE = "(bytes32,bytes,bytes,uint256,uint256,uint256,address,
15162
16394
  var DEFAULT_GRAFFITI2 = "0x0000000000000000000000000000000000000000000000000000000000000000";
15163
16395
  var ERC7821_BATCH_MODE = "0x0100000000000000000000000000000000000000000000000000000000000000";
15164
16396
  var BundlerMethod = {
16397
+ /** Submits a UserOperation to the bundler mempool. */
15165
16398
  ETH_SEND_USER_OPERATION: "eth_sendUserOperation",
16399
+ /** Retrieves the receipt for a previously submitted UserOperation by its hash. */
15166
16400
  ETH_GET_USER_OPERATION_RECEIPT: "eth_getUserOperationReceipt",
16401
+ /** Estimates gas limits for a UserOperation before submission. */
15167
16402
  ETH_ESTIMATE_USER_OPERATION_GAS: "eth_estimateUserOperationGas",
16403
+ /** Pimlico-specific method to fetch recommended EIP-1559 gas prices for UserOperations. */
15168
16404
  PIMLICO_GET_USER_OPERATION_GAS_PRICE: "pimlico_getUserOperationGasPrice"
15169
16405
  };
15170
16406
 
@@ -15179,9 +16415,22 @@ var DOMAIN_TYPEHASH = keccak256(
15179
16415
  toHex("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)")
15180
16416
  );
15181
16417
  var CryptoUtils = class {
16418
+ /**
16419
+ * @param ctx - Shared IntentsV2 context; used to access the bundler URL for
16420
+ * JSON-RPC calls.
16421
+ */
15182
16422
  constructor(ctx) {
15183
16423
  this.ctx = ctx;
15184
16424
  }
16425
+ /**
16426
+ * Computes an EIP-712 domain separator for a given contract.
16427
+ *
16428
+ * @param contractName - Human-readable name of the contract (e.g. `"IntentGateway"`).
16429
+ * @param version - Version string (e.g. `"2"`).
16430
+ * @param chainId - Chain ID of the network the contract is deployed on.
16431
+ * @param contractAddress - Address of the verifying contract.
16432
+ * @returns The 32-byte domain separator as a hex string.
16433
+ */
15185
16434
  getDomainSeparator(contractName, version, chainId, contractAddress) {
15186
16435
  return keccak256(
15187
16436
  encodeAbiParameters(parseAbiParameters("bytes32, bytes32, bytes32, uint256, address"), [
@@ -15193,6 +16442,19 @@ var CryptoUtils = class {
15193
16442
  ])
15194
16443
  );
15195
16444
  }
16445
+ /**
16446
+ * Signs a `SelectSolver` EIP-712 message with a session key.
16447
+ *
16448
+ * The session key authorises the selection of a specific solver for the
16449
+ * given order commitment. The resulting signature is appended to the
16450
+ * solver's UserOperation signature before bundle submission.
16451
+ *
16452
+ * @param commitment - The order commitment (bytes32) being fulfilled.
16453
+ * @param solverAddress - Address of the solver account selected to fill the order.
16454
+ * @param domainSeparator - EIP-712 domain separator for the IntentGatewayV2 contract.
16455
+ * @param privateKey - Hex-encoded private key of the session key that signs the message.
16456
+ * @returns The ECDSA signature as a hex string, or `null` if signing fails.
16457
+ */
15196
16458
  async signSolverSelection(commitment, solverAddress, domainSeparator, privateKey) {
15197
16459
  const account = privateKeyToAccount(privateKey);
15198
16460
  const structHash = keccak256(
@@ -15205,6 +16467,15 @@ var CryptoUtils = class {
15205
16467
  const signature = await account.sign({ hash: digest });
15206
16468
  return signature;
15207
16469
  }
16470
+ /**
16471
+ * Computes the EIP-712 hash of a `PackedUserOperation` as defined by
16472
+ * ERC-4337 EntryPoint v0.8.
16473
+ *
16474
+ * @param userOp - The packed UserOperation to hash.
16475
+ * @param entryPoint - Address of the EntryPoint v0.8 contract.
16476
+ * @param chainId - Chain ID of the network on which the operation will execute.
16477
+ * @returns The UserOperation hash as a hex string.
16478
+ */
15208
16479
  computeUserOpHash(userOp, entryPoint, chainId) {
15209
16480
  const structHash = this.getPackedUserStructHash(userOp);
15210
16481
  const domainSeparator = this.getDomainSeparator("ERC4337", "1", chainId, entryPoint);
@@ -15212,6 +16483,15 @@ var CryptoUtils = class {
15212
16483
  encodePacked(["bytes1", "bytes1", "bytes32", "bytes32"], ["0x19", "0x01", domainSeparator, structHash])
15213
16484
  );
15214
16485
  }
16486
+ /**
16487
+ * Computes the EIP-712 struct hash of a `PackedUserOperation`.
16488
+ *
16489
+ * Hashes dynamic fields (`initCode`, `callData`, `paymasterAndData`) before
16490
+ * ABI-encoding so the final hash is a fixed-length 32-byte value.
16491
+ *
16492
+ * @param userOp - The packed UserOperation to hash.
16493
+ * @returns The struct hash as a 32-byte hex string.
16494
+ */
15215
16495
  getPackedUserStructHash(userOp) {
15216
16496
  return keccak256(
15217
16497
  encodeAbiParameters(
@@ -15230,28 +16510,73 @@ var CryptoUtils = class {
15230
16510
  )
15231
16511
  );
15232
16512
  }
16513
+ /**
16514
+ * Packs `verificationGasLimit` and `callGasLimit` into the ERC-4337
16515
+ * `accountGasLimits` bytes32 field.
16516
+ *
16517
+ * The high 16 bytes hold `verificationGasLimit` and the low 16 bytes hold
16518
+ * `callGasLimit`, matching the EntryPoint v0.8 packed representation.
16519
+ *
16520
+ * @param verificationGasLimit - Gas limit for the account verification step.
16521
+ * @param callGasLimit - Gas limit for the main execution call.
16522
+ * @returns A 32-byte hex string with both limits packed.
16523
+ */
15233
16524
  packGasLimits(verificationGasLimit, callGasLimit) {
15234
16525
  const verificationGasHex = pad(toHex(verificationGasLimit), { size: 16 });
15235
16526
  const callGasHex = pad(toHex(callGasLimit), { size: 16 });
15236
16527
  return concat([verificationGasHex, callGasHex]);
15237
16528
  }
16529
+ /**
16530
+ * Packs `maxPriorityFeePerGas` and `maxFeePerGas` into the ERC-4337
16531
+ * `gasFees` bytes32 field.
16532
+ *
16533
+ * The high 16 bytes hold `maxPriorityFeePerGas` and the low 16 bytes hold
16534
+ * `maxFeePerGas`, matching the EntryPoint v0.8 packed representation.
16535
+ *
16536
+ * @param maxPriorityFeePerGas - Maximum tip per gas (EIP-1559).
16537
+ * @param maxFeePerGas - Maximum total fee per gas (EIP-1559).
16538
+ * @returns A 32-byte hex string with both fee values packed.
16539
+ */
15238
16540
  packGasFees(maxPriorityFeePerGas, maxFeePerGas) {
15239
16541
  const priorityFeeHex = pad(toHex(maxPriorityFeePerGas), { size: 16 });
15240
16542
  const maxFeeHex = pad(toHex(maxFeePerGas), { size: 16 });
15241
16543
  return concat([priorityFeeHex, maxFeeHex]);
15242
16544
  }
16545
+ /**
16546
+ * Unpacks the `accountGasLimits` bytes32 field back into its constituent
16547
+ * gas limits.
16548
+ *
16549
+ * @param accountGasLimits - The packed 32-byte gas limits field from a `PackedUserOperation`.
16550
+ * @returns Object with `verificationGasLimit` and `callGasLimit` as bigints.
16551
+ */
15243
16552
  unpackGasLimits(accountGasLimits) {
15244
16553
  const hex = accountGasLimits.slice(2);
15245
16554
  const verificationGasLimit = BigInt(`0x${hex.slice(0, 32)}`);
15246
16555
  const callGasLimit = BigInt(`0x${hex.slice(32, 64)}`);
15247
16556
  return { verificationGasLimit, callGasLimit };
15248
16557
  }
16558
+ /**
16559
+ * Unpacks the `gasFees` bytes32 field back into its constituent fee values.
16560
+ *
16561
+ * @param gasFees - The packed 32-byte gas fees field from a `PackedUserOperation`.
16562
+ * @returns Object with `maxPriorityFeePerGas` and `maxFeePerGas` as bigints.
16563
+ */
15249
16564
  unpackGasFees(gasFees) {
15250
16565
  const hex = gasFees.slice(2);
15251
16566
  const maxPriorityFeePerGas = BigInt(`0x${hex.slice(0, 32)}`);
15252
16567
  const maxFeePerGas = BigInt(`0x${hex.slice(32, 64)}`);
15253
16568
  return { maxPriorityFeePerGas, maxFeePerGas };
15254
16569
  }
16570
+ /**
16571
+ * Converts a packed `PackedUserOperation` into the JSON object format
16572
+ * expected by ERC-4337 bundler JSON-RPC endpoints.
16573
+ *
16574
+ * Unpacks `accountGasLimits` and `gasFees`, separates optional factory and
16575
+ * paymaster fields, and converts all numeric fields to hex strings.
16576
+ *
16577
+ * @param userOp - The packed UserOperation to convert.
16578
+ * @returns A plain object safe to pass as the first element of bundler RPC params.
16579
+ */
15255
16580
  prepareBundlerCall(userOp) {
15256
16581
  const { verificationGasLimit, callGasLimit } = this.unpackGasLimits(userOp.accountGasLimits);
15257
16582
  const { maxPriorityFeePerGas, maxFeePerGas } = this.unpackGasFees(userOp.gasFees);
@@ -15284,6 +16609,15 @@ var CryptoUtils = class {
15284
16609
  }
15285
16610
  return userOpBundler;
15286
16611
  }
16612
+ /**
16613
+ * Sends a JSON-RPC request to the configured ERC-4337 bundler endpoint.
16614
+ *
16615
+ * @param method - The JSON-RPC method name (one of {@link BundlerMethod}).
16616
+ * @param params - Array of parameters for the RPC call.
16617
+ * @returns Resolves with the `result` field of the bundler's JSON-RPC response,
16618
+ * typed as `T`.
16619
+ * @throws If the bundler URL is not configured or the bundler returns an error.
16620
+ */
15287
16621
  async sendBundler(method, params = []) {
15288
16622
  if (!this.ctx.bundlerUrl) {
15289
16623
  throw new Error("Bundler URL not configured");
@@ -15299,6 +16633,14 @@ var CryptoUtils = class {
15299
16633
  }
15300
16634
  return result.result;
15301
16635
  }
16636
+ /**
16637
+ * Encodes a list of calls into ERC-7821 `execute` calldata using
16638
+ * single-batch mode (`ERC7821_BATCH_MODE`).
16639
+ *
16640
+ * @param calls - Ordered list of calls to batch; each specifies a `target`
16641
+ * address, ETH `value`, and `data`.
16642
+ * @returns ABI-encoded calldata for the ERC-7821 `execute(bytes32,bytes)` function.
16643
+ */
15302
16644
  encodeERC7821Execute(calls) {
15303
16645
  const executionData = encodeAbiParameters(
15304
16646
  [{ type: "tuple[]", components: erc7281_default.ABI[1].components }],
@@ -15310,6 +16652,16 @@ var CryptoUtils = class {
15310
16652
  args: [ERC7821_BATCH_MODE, executionData]
15311
16653
  });
15312
16654
  }
16655
+ /**
16656
+ * Decodes ERC-7821 `execute` calldata back into its constituent calls.
16657
+ *
16658
+ * Returns `null` if the calldata does not match the expected `execute`
16659
+ * function signature or cannot be decoded.
16660
+ *
16661
+ * @param callData - Hex-encoded calldata previously produced by
16662
+ * {@link encodeERC7821Execute} or an equivalent encoder.
16663
+ * @returns Array of decoded {@link ERC7821Call} objects, or `null` on failure.
16664
+ */
15313
16665
  decodeERC7821Execute(callData) {
15314
16666
  try {
15315
16667
  const decoded = decodeFunctionData({
@@ -15370,7 +16722,17 @@ function transformOrderForContract(order) {
15370
16722
  return {
15371
16723
  ...contractOrder,
15372
16724
  source: order.source.startsWith("0x") ? order.source : toHex(order.source),
15373
- destination: order.destination.startsWith("0x") ? order.destination : toHex(order.destination)
16725
+ destination: order.destination.startsWith("0x") ? order.destination : toHex(order.destination),
16726
+ inputs: order.inputs.map((t) => ({ ...t, token: bytes20ToBytes32(t.token) })),
16727
+ predispatch: {
16728
+ ...order.predispatch,
16729
+ assets: order.predispatch.assets.map((t) => ({ ...t, token: bytes20ToBytes32(t.token) }))
16730
+ },
16731
+ output: {
16732
+ ...order.output,
16733
+ beneficiary: bytes20ToBytes32(order.output.beneficiary),
16734
+ assets: order.output.assets.map((t) => ({ ...t, token: bytes20ToBytes32(t.token) }))
16735
+ }
15374
16736
  };
15375
16737
  }
15376
16738
  async function convertGasToFeeToken(ctx, gasEstimate, gasEstimateIn, evmChainID, gasPriceOverride) {
@@ -15410,9 +16772,40 @@ async function convertGasToFeeToken(ctx, gasEstimate, gasEstimateIn, evmChainID,
15410
16772
 
15411
16773
  // src/protocols/intentsV2/OrderPlacer.ts
15412
16774
  var OrderPlacer = class {
16775
+ /**
16776
+ * @param ctx - Shared IntentsV2 context providing the source chain client,
16777
+ * config service, and session-key storage.
16778
+ */
15413
16779
  constructor(ctx) {
15414
16780
  this.ctx = ctx;
15415
16781
  }
16782
+ /**
16783
+ * Bidirectional async generator that orchestrates order placement.
16784
+ *
16785
+ * **Yield/receive protocol:**
16786
+ * 1. Yields `{ to, data, sessionPrivateKey }` — the caller must sign a
16787
+ * transaction sending `data` to `to` and pass the signed transaction back
16788
+ * via `gen.next(signedTx)`.
16789
+ * 2. Returns `{ order, transactionHash }` — the finalized order with its
16790
+ * on-chain `nonce`, `inputs`, and computed `id`, plus the placement
16791
+ * transaction hash.
16792
+ *
16793
+ * A fresh ephemeral session key is generated for every call. The key is
16794
+ * stored immediately (without a commitment) so it can be retrieved by
16795
+ * address, then updated with the commitment once the `OrderPlaced` event
16796
+ * confirms the nonce.
16797
+ *
16798
+ * @param order - The order to place. `order.session` is mutated in-place
16799
+ * with the generated session key address before yielding.
16800
+ * @param graffiti - Optional bytes32 tag for orderflow attribution /
16801
+ * revenue share. Defaults to {@link DEFAULT_GRAFFITI} (bytes32 zero).
16802
+ * @yields `{ to, data, sessionPrivateKey }` — target contract address,
16803
+ * encoded `placeOrder` calldata, and the raw session private key.
16804
+ * @returns `{ order, transactionHash }` after the transaction is confirmed
16805
+ * and the `OrderPlaced` event is parsed.
16806
+ * @throws If the broadcast transaction receipt does not contain an
16807
+ * `OrderPlaced` event.
16808
+ */
15416
16809
  async *placeOrder(order, graffiti = DEFAULT_GRAFFITI2) {
15417
16810
  const privateKey = generatePrivateKey();
15418
16811
  const account = privateKeyToAccount(privateKey);
@@ -15424,16 +16817,20 @@ var OrderPlacer = class {
15424
16817
  address: sessionKeyAddress,
15425
16818
  createdAt
15426
16819
  });
15427
- const calldata = encodeFunctionData({
16820
+ const data = encodeFunctionData({
15428
16821
  abi: ABI3,
15429
16822
  functionName: "placeOrder",
15430
16823
  args: [transformOrderForContract(order), graffiti]
15431
16824
  });
15432
- const signedTransaction = yield { calldata, sessionPrivateKey: privateKey };
15433
- const receipt = await this.ctx.source.broadcastTransaction(signedTransaction);
15434
- console.log(
15435
- `Place order transaction sent to source chain ${hexToString(order.source)} with hash: ${receipt.transactionHash}`
16825
+ const intentGatewayAddress = this.ctx.source.configService.getIntentGatewayV2Address(
16826
+ hexToString(order.source)
15436
16827
  );
16828
+ const signedTransaction = yield {
16829
+ to: intentGatewayAddress,
16830
+ data,
16831
+ sessionPrivateKey: privateKey
16832
+ };
16833
+ const receipt = await this.ctx.source.broadcastTransaction(signedTransaction);
15437
16834
  const events = parseEventLogs({
15438
16835
  abi: ABI3,
15439
16836
  logs: receipt.logs,
@@ -15456,16 +16853,47 @@ var OrderPlacer = class {
15456
16853
  createdAt
15457
16854
  };
15458
16855
  await this.ctx.sessionKeyStorage.setSessionKeyByAddress(sessionKeyAddress, sessionKeyData);
15459
- return order;
16856
+ return { order, transactionHash: receipt.transactionHash };
15460
16857
  }
15461
16858
  };
15462
16859
 
15463
16860
  // src/protocols/intentsV2/OrderExecutor.ts
16861
+ var USED_USEROPS_STORAGE_KEY = (commitment) => `used-userops:${commitment.toLowerCase()}`;
15464
16862
  var OrderExecutor = class {
15465
- constructor(ctx, bidManager) {
16863
+ /**
16864
+ * @param ctx - Shared IntentsV2 context providing the destination chain
16865
+ * client, coprocessor, bundler URL, and storage adapters.
16866
+ * @param bidManager - Handles bid validation, sorting, simulation, and
16867
+ * UserOperation submission.
16868
+ * @param crypto - Crypto utilities used to compute UserOperation hashes for
16869
+ * deduplication.
16870
+ */
16871
+ constructor(ctx, bidManager, crypto) {
15466
16872
  this.ctx = ctx;
15467
16873
  this.bidManager = bidManager;
16874
+ this.crypto = crypto;
15468
16875
  }
16876
+ /**
16877
+ * Async generator that executes an intent order by polling for bids and
16878
+ * submitting UserOperations until the order is filled, partially exhausted,
16879
+ * or an unrecoverable error occurs.
16880
+ *
16881
+ * **Status progression (cross-chain orders):**
16882
+ * `AWAITING_BIDS` → `BIDS_RECEIVED` → `BID_SELECTED` → `USEROP_SUBMITTED`
16883
+ * then terminates (settlement is confirmed off-chain via Hyperbridge).
16884
+ *
16885
+ * **Status progression (same-chain orders):**
16886
+ * `AWAITING_BIDS` → `BIDS_RECEIVED` → `BID_SELECTED` → `USEROP_SUBMITTED`
16887
+ * → (`FILLED` | `PARTIAL_FILL`)* → (`FILLED` | `PARTIAL_FILL_EXHAUSTED`)
16888
+ *
16889
+ * **Error statuses:** `FAILED` (fatal, no fills) or `PARTIAL_FILL_EXHAUSTED`
16890
+ * (deadline reached or no new bids after at least one partial fill).
16891
+ *
16892
+ * @param options - Execution parameters including the placed order, its
16893
+ * session private key, bid collection settings, and poll interval.
16894
+ * @yields {@link IntentOrderStatusUpdate} objects describing each stage.
16895
+ * @throws Never throws directly; all errors are reported as `FAILED` yields.
16896
+ */
15469
16897
  async *executeIntentOrder(options) {
15470
16898
  const {
15471
16899
  order,
@@ -15477,26 +16905,50 @@ var OrderExecutor = class {
15477
16905
  const commitment = order.id;
15478
16906
  const isSameChain = order.source === order.destination;
15479
16907
  if (!this.ctx.intentsCoprocessor) {
15480
- yield {
15481
- status: "FAILED",
15482
- metadata: { error: "IntentsCoprocessor required for order execution" }
15483
- };
16908
+ yield { status: "FAILED", error: "IntentsCoprocessor required for order execution" };
15484
16909
  return;
15485
16910
  }
15486
16911
  if (!this.ctx.bundlerUrl) {
15487
- yield {
15488
- status: "FAILED",
15489
- metadata: { error: "Bundler URL not configured" }
15490
- };
16912
+ yield { status: "FAILED", error: "Bundler URL not configured" };
15491
16913
  return;
15492
16914
  }
16915
+ const usedUserOps = /* @__PURE__ */ new Set();
16916
+ const storageKey = USED_USEROPS_STORAGE_KEY(commitment);
16917
+ const persisted = await this.ctx.usedUserOpsStorage.getItem(storageKey);
16918
+ if (persisted) {
16919
+ try {
16920
+ const parsed = JSON.parse(persisted);
16921
+ for (const key of parsed) {
16922
+ usedUserOps.add(key);
16923
+ }
16924
+ } catch {
16925
+ }
16926
+ }
16927
+ const persistUsedUserOps = async () => {
16928
+ await this.ctx.usedUserOpsStorage.setItem(storageKey, JSON.stringify([...usedUserOps]));
16929
+ };
16930
+ const entryPointAddress = this.ctx.dest.configService.getEntryPointV08Address(hexToString(order.destination));
16931
+ const chainId = BigInt(
16932
+ this.ctx.dest.client.chain?.id ?? Number.parseInt(this.ctx.dest.config.stateMachineId.split("-")[1])
16933
+ );
16934
+ const userOpHashKey = (userOp) => this.crypto.computeUserOpHash(userOp, entryPointAddress, chainId);
16935
+ const targetAmount = order.output.assets.reduce((acc, asset) => acc + asset.amount, 0n);
16936
+ let totalFilledAmount = 0n;
16937
+ let remainingAmount = targetAmount;
15493
16938
  try {
15494
- const usedUserOps = /* @__PURE__ */ new Set();
15495
16939
  while (true) {
15496
- yield {
15497
- status: "AWAITING_BIDS",
15498
- metadata: { commitment }
15499
- };
16940
+ const currentBlock = await this.ctx.dest.client.getBlockNumber();
16941
+ if (currentBlock >= order.deadline) {
16942
+ const isPartiallyFilled = totalFilledAmount > 0n;
16943
+ const deadlineError = `Order deadline reached (block ${currentBlock} >= ${order.deadline})`;
16944
+ if (isPartiallyFilled) {
16945
+ yield { status: "PARTIAL_FILL_EXHAUSTED", commitment, totalFilledAmount, remainingAmount, error: deadlineError };
16946
+ } else {
16947
+ yield { status: "FAILED", commitment, error: deadlineError };
16948
+ }
16949
+ return;
16950
+ }
16951
+ yield { status: "AWAITING_BIDS", commitment, totalFilledAmount, remainingAmount };
15500
16952
  const startTime = Date.now();
15501
16953
  let bids = [];
15502
16954
  while (Date.now() - startTime < bidTimeoutMs) {
@@ -15510,108 +16962,145 @@ var OrderExecutor = class {
15510
16962
  await sleep(pollIntervalMs);
15511
16963
  }
15512
16964
  const freshBids = bids.filter((bid) => {
15513
- const key = `${bid.userOp.sender.toLowerCase()}-${bid.userOp.nonce.toString()}`;
16965
+ const key = userOpHashKey(bid.userOp);
15514
16966
  return !usedUserOps.has(key);
15515
16967
  });
15516
16968
  if (freshBids.length === 0) {
15517
- yield {
15518
- status: "FAILED",
15519
- metadata: {
15520
- commitment,
15521
- error: `No new bids available within ${bidTimeoutMs}ms timeout`
15522
- }
15523
- };
16969
+ const isPartiallyFilled = totalFilledAmount > 0n;
16970
+ const noBidsError = isPartiallyFilled ? `No new bids after partial fill (${totalFilledAmount.toString()} filled, ${remainingAmount.toString()} remaining)` : `No new bids available within ${bidTimeoutMs}ms timeout`;
16971
+ if (isPartiallyFilled) {
16972
+ yield { status: "PARTIAL_FILL_EXHAUSTED", commitment, totalFilledAmount, remainingAmount, error: noBidsError };
16973
+ } else {
16974
+ yield { status: "FAILED", commitment, error: noBidsError };
16975
+ }
15524
16976
  return;
15525
16977
  }
15526
- yield {
15527
- status: "BIDS_RECEIVED",
15528
- metadata: {
15529
- commitment,
15530
- bidCount: freshBids.length,
15531
- bids: freshBids
15532
- }
15533
- };
16978
+ yield { status: "BIDS_RECEIVED", commitment, bidCount: freshBids.length, bids: freshBids };
15534
16979
  let result;
15535
16980
  try {
15536
16981
  result = await this.bidManager.selectBid(order, freshBids, sessionPrivateKey);
15537
16982
  } catch (err) {
15538
16983
  yield {
15539
16984
  status: "FAILED",
15540
- metadata: {
15541
- commitment,
15542
- error: `Failed to select bid and submit: ${err instanceof Error ? err.message : String(err)}`
15543
- }
16985
+ commitment,
16986
+ totalFilledAmount,
16987
+ remainingAmount,
16988
+ error: `Failed to select bid and submit: ${err instanceof Error ? err.message : String(err)}`
15544
16989
  };
15545
16990
  return;
15546
16991
  }
15547
- const usedKey = `${result.userOp.sender.toLowerCase()}-${result.userOp.nonce.toString()}`;
16992
+ const usedKey = userOpHashKey(result.userOp);
15548
16993
  usedUserOps.add(usedKey);
16994
+ await persistUsedUserOps();
15549
16995
  yield {
15550
16996
  status: "BID_SELECTED",
15551
- metadata: {
15552
- commitment,
15553
- selectedSolver: result.solverAddress,
15554
- userOpHash: result.userOpHash,
15555
- userOp: result.userOp
15556
- }
16997
+ commitment,
16998
+ selectedSolver: result.solverAddress,
16999
+ userOpHash: result.userOpHash,
17000
+ userOp: result.userOp
15557
17001
  };
15558
17002
  yield {
15559
17003
  status: "USEROP_SUBMITTED",
15560
- metadata: {
15561
- commitment,
15562
- userOpHash: result.userOpHash,
15563
- selectedSolver: result.solverAddress,
15564
- transactionHash: result.txnHash
15565
- }
17004
+ commitment,
17005
+ userOpHash: result.userOpHash,
17006
+ selectedSolver: result.solverAddress,
17007
+ transactionHash: result.txnHash
15566
17008
  };
15567
17009
  if (!isSameChain) {
15568
17010
  return;
15569
17011
  }
15570
17012
  if (result.fillStatus === "full") {
17013
+ totalFilledAmount = targetAmount;
17014
+ remainingAmount = 0n;
15571
17015
  yield {
15572
17016
  status: "FILLED",
15573
- metadata: {
15574
- commitment,
15575
- userOpHash: result.userOpHash,
15576
- selectedSolver: result.solverAddress,
15577
- transactionHash: result.txnHash
15578
- }
17017
+ commitment,
17018
+ userOpHash: result.userOpHash,
17019
+ selectedSolver: result.solverAddress,
17020
+ transactionHash: result.txnHash,
17021
+ totalFilledAmount,
17022
+ remainingAmount
15579
17023
  };
15580
17024
  return;
15581
17025
  }
15582
17026
  if (result.fillStatus === "partial") {
15583
- yield {
15584
- status: "PARTIAL_FILL",
15585
- metadata: {
17027
+ if (result.filledAmount !== void 0) {
17028
+ totalFilledAmount += result.filledAmount;
17029
+ if (totalFilledAmount >= targetAmount) {
17030
+ totalFilledAmount = targetAmount;
17031
+ remainingAmount = 0n;
17032
+ } else {
17033
+ remainingAmount = targetAmount - totalFilledAmount;
17034
+ }
17035
+ }
17036
+ if (remainingAmount === 0n) {
17037
+ yield {
17038
+ status: "FILLED",
15586
17039
  commitment,
15587
17040
  userOpHash: result.userOpHash,
15588
17041
  selectedSolver: result.solverAddress,
15589
- transactionHash: result.txnHash
15590
- }
17042
+ transactionHash: result.txnHash,
17043
+ totalFilledAmount,
17044
+ remainingAmount
17045
+ };
17046
+ return;
17047
+ }
17048
+ yield {
17049
+ status: "PARTIAL_FILL",
17050
+ commitment,
17051
+ userOpHash: result.userOpHash,
17052
+ selectedSolver: result.solverAddress,
17053
+ transactionHash: result.txnHash,
17054
+ filledAmount: result.filledAmount,
17055
+ totalFilledAmount,
17056
+ remainingAmount
15591
17057
  };
15592
17058
  }
15593
17059
  }
15594
17060
  } catch (err) {
15595
17061
  yield {
15596
17062
  status: "FAILED",
15597
- metadata: {
15598
- commitment,
15599
- error: `Unexpected error: ${err instanceof Error ? err.message : String(err)}`
15600
- }
17063
+ commitment,
17064
+ error: `Unexpected error: ${err instanceof Error ? err.message : String(err)}`
15601
17065
  };
15602
17066
  }
15603
17067
  }
15604
17068
  };
15605
17069
  var OrderCanceller = class {
17070
+ /**
17071
+ * @param ctx - Shared IntentsV2 context providing the source and destination
17072
+ * chain clients, config service, and cancellation storage.
17073
+ */
15606
17074
  constructor(ctx) {
15607
17075
  this.ctx = ctx;
15608
17076
  }
17077
+ /**
17078
+ * Quotes the native token cost of cancelling an order from the given chain.
17079
+ *
17080
+ * For same-chain orders the cost is zero. For cross-chain orders, the
17081
+ * quote covers the ISMP GET/POST dispatch fee.
17082
+ *
17083
+ * @param order - The order to quote a cancellation for.
17084
+ * @param from - Which chain side initiates the cancellation (`"source"` or
17085
+ * `"dest"`). Defaults to `"source"`.
17086
+ * @returns The native token amount required to submit the cancel transaction.
17087
+ */
15609
17088
  async quoteCancelNative(order, from = "source") {
15610
17089
  if (from === "dest") {
15611
17090
  return this.quoteCancelNativeFromDest(order);
15612
17091
  }
15613
17092
  return this.quoteCancelNativeFromSource(order);
15614
17093
  }
17094
+ /**
17095
+ * Quotes the native token cost of a source-initiated cross-chain cancellation.
17096
+ *
17097
+ * Constructs a mock ISMP GET request for the destination commitment slot and
17098
+ * calls `quoteNative` on the source host to obtain the dispatch fee.
17099
+ * Returns 0 for same-chain orders (no ISMP call needed).
17100
+ *
17101
+ * @param order - The order to quote.
17102
+ * @returns The native token dispatch fee in wei.
17103
+ */
15615
17104
  async quoteCancelNativeFromSource(order) {
15616
17105
  if (order.source === order.destination) return 0n;
15617
17106
  const height = order.deadline + 1n;
@@ -15638,6 +17127,21 @@ var OrderCanceller = class {
15638
17127
  };
15639
17128
  return await this.ctx.source.quoteNative(getRequest, 0n);
15640
17129
  }
17130
+ /**
17131
+ * Async generator that cancels an order and streams status events until
17132
+ * cancellation is complete.
17133
+ *
17134
+ * Delegates to `cancelOrderFromSource` or `cancelOrderFromDest` based on
17135
+ * the `from` parameter.
17136
+ *
17137
+ * @param order - The order to cancel.
17138
+ * @param indexerClient - Indexer client used to stream ISMP request status
17139
+ * updates and query state-machine heights.
17140
+ * @param from - Which chain side initiates the cancellation. Defaults to
17141
+ * `"source"`.
17142
+ * @yields {@link CancelEvent} objects describing each stage of the
17143
+ * cancellation lifecycle.
17144
+ */
15641
17145
  async *cancelOrder(order, indexerClient, from = "source") {
15642
17146
  if (from === "dest") {
15643
17147
  yield* this.cancelOrderFromDest(order, indexerClient);
@@ -15645,21 +17149,46 @@ var OrderCanceller = class {
15645
17149
  }
15646
17150
  yield* this.cancelOrderFromSource(order, indexerClient);
15647
17151
  }
17152
+ /**
17153
+ * Async generator that cancels an order by initiating the cancel from the
17154
+ * source chain.
17155
+ *
17156
+ * **Same-chain path:** encodes a direct `cancelOrder` call, yields
17157
+ * `AWAITING_CANCEL_TRANSACTION`, broadcasts the signed transaction, and
17158
+ * yields `CANCELLATION_COMPLETE` after confirming the `EscrowRefunded` event.
17159
+ *
17160
+ * **Cross-chain path:**
17161
+ * 1. Fetches (or resumes from cache) a destination finalization proof.
17162
+ * 2. Yields `AWAITING_CANCEL_TRANSACTION` with the `cancelOrder` calldata
17163
+ * that includes the destination proof height.
17164
+ * 3. Extracts the `GetRequestEvent` from the broadcast receipt and persists
17165
+ * the GET request.
17166
+ * 4. Streams the GET request status through Hyperbridge, fetching and
17167
+ * submitting the source proof once `SOURCE_FINALIZED` is reached.
17168
+ * 5. Cleans up persisted state when `HYPERBRIDGE_FINALIZED` is reached.
17169
+ *
17170
+ * @param order - The order to cancel.
17171
+ * @param indexerClient - Used to stream GET request status and query heights.
17172
+ * @yields {@link CancelEvent} at each lifecycle stage.
17173
+ * @throws If the cancel transaction does not contain the expected on-chain event.
17174
+ */
15648
17175
  async *cancelOrderFromSource(order, indexerClient) {
15649
17176
  const orderId = order.id;
15650
17177
  const isSameChain = order.source === order.destination;
17178
+ const intentGatewayAddress = this.ctx.source.configService.getIntentGatewayV2Address(
17179
+ hexToString(order.source)
17180
+ );
15651
17181
  if (isSameChain) {
15652
- const intentGatewayAddress = this.ctx.source.configService.getIntentGatewayV2Address(
15653
- hexToString(order.source)
15654
- );
15655
- const calldata = encodeFunctionData({
17182
+ const data = encodeFunctionData({
15656
17183
  abi: ABI3,
15657
17184
  functionName: "cancelOrder",
15658
17185
  args: [transformOrderForContract(order), { relayerFee: 0n, height: 0n }]
15659
17186
  });
15660
17187
  const signedTransaction = yield {
15661
17188
  status: "AWAITING_CANCEL_TRANSACTION",
15662
- data: { calldata, to: intentGatewayAddress }
17189
+ data,
17190
+ to: intentGatewayAddress,
17191
+ value: 0n
15663
17192
  };
15664
17193
  const receipt = await this.ctx.source.broadcastTransaction(signedTransaction);
15665
17194
  const refundEvents = parseEventLogs({
@@ -15672,7 +17201,8 @@ var OrderCanceller = class {
15672
17201
  }
15673
17202
  yield {
15674
17203
  status: "CANCELLATION_COMPLETE",
15675
- data: { metadata: { blockNumber: Number(receipt.blockNumber) } }
17204
+ blockNumber: Number(receipt.blockNumber),
17205
+ transactionHash: receipt.transactionHash
15676
17206
  };
15677
17207
  return;
15678
17208
  }
@@ -15684,19 +17214,25 @@ var OrderCanceller = class {
15684
17214
  destIProof = yield* this.fetchDestinationProof(order, indexerClient);
15685
17215
  await this.ctx.cancellationStorage.setItem(STORAGE_KEYS.destProof(orderId), destIProof);
15686
17216
  } else {
15687
- yield { status: "DESTINATION_FINALIZED", data: { proof: destIProof } };
17217
+ yield { status: "DESTINATION_FINALIZED", proof: destIProof };
15688
17218
  }
15689
17219
  let getRequest = await this.ctx.cancellationStorage.getItem(
15690
17220
  STORAGE_KEYS.getRequest(orderId)
15691
17221
  );
15692
17222
  if (!getRequest) {
15693
- const transactionHash = yield {
15694
- status: "AWAITING_GET_REQUEST",
15695
- data: void 0
15696
- };
15697
- const receipt = await this.ctx.source.client.getTransactionReceipt({
15698
- hash: transactionHash
17223
+ const value = await this.quoteCancelNativeFromSource(order);
17224
+ const data = encodeFunctionData({
17225
+ abi: ABI3,
17226
+ functionName: "cancelOrder",
17227
+ args: [transformOrderForContract(order), { relayerFee: 0n, height: destIProof.height }]
15699
17228
  });
17229
+ const signedTransaction = yield {
17230
+ status: "AWAITING_CANCEL_TRANSACTION",
17231
+ data,
17232
+ to: intentGatewayAddress,
17233
+ value
17234
+ };
17235
+ const receipt = await this.ctx.source.broadcastTransaction(signedTransaction);
15700
17236
  const events = parseEventLogs({ abi: evmHost_default.ABI, logs: receipt.logs });
15701
17237
  const request = events.find((e) => e.eventName === "GetRequestEvent");
15702
17238
  if (!request) throw new Error("GetRequest missing");
@@ -15709,61 +17245,72 @@ var OrderCanceller = class {
15709
17245
  });
15710
17246
  const sourceStatusStream = indexerClient.getRequestStatusStream(commitment);
15711
17247
  for await (const statusUpdate of sourceStatusStream) {
15712
- if (statusUpdate.status === RequestStatus.SOURCE_FINALIZED) {
15713
- yield {
15714
- status: "SOURCE_FINALIZED",
15715
- data: { metadata: statusUpdate.metadata }
15716
- };
15717
- const sourceHeight = BigInt(statusUpdate.metadata.blockNumber);
15718
- let sourceIProof = await this.ctx.cancellationStorage.getItem(
15719
- STORAGE_KEYS.sourceProof(orderId)
15720
- );
15721
- if (!sourceIProof) {
15722
- sourceIProof = await fetchSourceProof2(
15723
- commitment,
15724
- this.ctx.source,
15725
- sourceStateMachine,
15726
- sourceConsensusStateId,
15727
- sourceHeight
17248
+ switch (statusUpdate.status) {
17249
+ case RequestStatus.SOURCE_FINALIZED: {
17250
+ yield {
17251
+ status: "SOURCE_FINALIZED",
17252
+ metadata: statusUpdate.metadata
17253
+ };
17254
+ const sourceHeight = BigInt(statusUpdate.metadata.blockNumber);
17255
+ let sourceIProof = await this.ctx.cancellationStorage.getItem(
17256
+ STORAGE_KEYS.sourceProof(orderId)
15728
17257
  );
15729
- await this.ctx.cancellationStorage.setItem(STORAGE_KEYS.sourceProof(orderId), sourceIProof);
15730
- }
15731
- await waitForChallengePeriod(hyperbridge, {
15732
- height: sourceIProof.height,
15733
- id: {
15734
- stateId: parseStateMachineId(sourceStateMachine).stateId,
15735
- consensusStateId: sourceConsensusStateId
17258
+ if (!sourceIProof) {
17259
+ sourceIProof = await fetchSourceProof2(
17260
+ commitment,
17261
+ this.ctx.source,
17262
+ sourceStateMachine,
17263
+ sourceConsensusStateId,
17264
+ sourceHeight
17265
+ );
17266
+ await this.ctx.cancellationStorage.setItem(STORAGE_KEYS.sourceProof(orderId), sourceIProof);
15736
17267
  }
15737
- });
15738
- const getRequestMessage = {
15739
- kind: "GetRequest",
15740
- requests: [getRequest],
15741
- source: sourceIProof,
15742
- response: destIProof,
15743
- signer: pad("0x")
15744
- };
15745
- await this.submitAndConfirmReceipt(hyperbridge, commitment, getRequestMessage);
15746
- continue;
15747
- }
15748
- if (statusUpdate.status === RequestStatus.HYPERBRIDGE_DELIVERED) {
15749
- yield {
15750
- status: "HYPERBRIDGE_DELIVERED",
15751
- data: statusUpdate
15752
- };
15753
- continue;
15754
- }
15755
- if (statusUpdate.status === RequestStatus.HYPERBRIDGE_FINALIZED) {
15756
- yield {
15757
- status: "HYPERBRIDGE_FINALIZED",
15758
- data: statusUpdate
15759
- };
15760
- await this.ctx.cancellationStorage.removeItem(STORAGE_KEYS.destProof(orderId));
15761
- await this.ctx.cancellationStorage.removeItem(STORAGE_KEYS.getRequest(orderId));
15762
- await this.ctx.cancellationStorage.removeItem(STORAGE_KEYS.sourceProof(orderId));
15763
- return;
17268
+ await waitForChallengePeriod(hyperbridge, {
17269
+ height: sourceIProof.height,
17270
+ id: {
17271
+ stateId: parseStateMachineId(sourceStateMachine).stateId,
17272
+ consensusStateId: sourceConsensusStateId
17273
+ }
17274
+ });
17275
+ const getRequestMessage = {
17276
+ kind: "GetRequest",
17277
+ requests: [getRequest],
17278
+ source: sourceIProof,
17279
+ response: destIProof,
17280
+ signer: pad("0x")
17281
+ };
17282
+ await this.submitAndConfirmReceipt(hyperbridge, commitment, getRequestMessage);
17283
+ break;
17284
+ }
17285
+ case RequestStatus.HYPERBRIDGE_DELIVERED:
17286
+ yield {
17287
+ status: "HYPERBRIDGE_DELIVERED",
17288
+ metadata: statusUpdate.metadata
17289
+ };
17290
+ break;
17291
+ case RequestStatus.HYPERBRIDGE_FINALIZED:
17292
+ yield {
17293
+ status: "HYPERBRIDGE_FINALIZED",
17294
+ metadata: statusUpdate.metadata
17295
+ };
17296
+ await this.ctx.cancellationStorage.removeItem(STORAGE_KEYS.destProof(orderId));
17297
+ await this.ctx.cancellationStorage.removeItem(STORAGE_KEYS.getRequest(orderId));
17298
+ await this.ctx.cancellationStorage.removeItem(STORAGE_KEYS.sourceProof(orderId));
17299
+ return;
15764
17300
  }
15765
17301
  }
15766
17302
  }
17303
+ /**
17304
+ * Quotes the native token cost of a destination-initiated cross-chain cancellation.
17305
+ *
17306
+ * Estimates the relayer fee for delivering the refund POST request from the
17307
+ * destination chain back to the source chain, converts it to the destination
17308
+ * fee token, and calls `quoteNative` on the destination host.
17309
+ * Returns 0 for same-chain orders.
17310
+ *
17311
+ * @param order - The order to quote.
17312
+ * @returns The native token dispatch fee in wei.
17313
+ */
15767
17314
  async quoteCancelNativeFromDest(order) {
15768
17315
  if (order.source === order.destination) return 0n;
15769
17316
  const destStateMachine = order.destination.startsWith("0x") ? hexToString(order.destination) : order.destination;
@@ -15783,6 +17330,26 @@ var OrderCanceller = class {
15783
17330
  };
15784
17331
  return await this.ctx.dest.quoteNative(postRequest, relayerFee);
15785
17332
  }
17333
+ /**
17334
+ * Async generator that cancels an order by initiating from the destination
17335
+ * chain and streaming status updates until the source-chain escrow is refunded.
17336
+ *
17337
+ * Throws if called with a same-chain order (use source-side cancellation instead).
17338
+ *
17339
+ * **Steps:**
17340
+ * 1. Yields `AWAITING_CANCEL_TRANSACTION` so the caller can sign and submit
17341
+ * the cancel transaction on the destination chain.
17342
+ * 2. Extracts the `PostRequestEvent` commitment and persists it for resumability.
17343
+ * 3. Streams POST request status through Hyperbridge until `DESTINATION`
17344
+ * (i.e. the source chain processed the refund).
17345
+ * 4. Yields `CANCELLATION_COMPLETE` and cleans up persisted state.
17346
+ *
17347
+ * @param order - The cross-chain order to cancel.
17348
+ * @param indexerClient - Used to stream POST request status updates.
17349
+ * @yields {@link CancelEvent} at each lifecycle stage.
17350
+ * @throws If the order is same-chain, or if the cancel transaction does not
17351
+ * contain a `PostRequestEvent`.
17352
+ */
15786
17353
  async *cancelOrderFromDest(order, indexerClient) {
15787
17354
  const orderId = order.id;
15788
17355
  if (order.source === order.destination) {
@@ -15794,14 +17361,17 @@ var OrderCanceller = class {
15794
17361
  STORAGE_KEYS.postCommitment(orderId)
15795
17362
  );
15796
17363
  if (!commitment) {
15797
- const calldata = encodeFunctionData({
17364
+ const value = await this.quoteCancelNativeFromDest(order);
17365
+ const data = encodeFunctionData({
15798
17366
  abi: ABI3,
15799
17367
  functionName: "cancelOrder",
15800
17368
  args: [transformOrderForContract(order), { relayerFee: 0n, height: 0n }]
15801
17369
  });
15802
17370
  const signedTransaction = yield {
15803
17371
  status: "AWAITING_CANCEL_TRANSACTION",
15804
- data: { calldata, to: intentGatewayAddress }
17372
+ data,
17373
+ to: intentGatewayAddress,
17374
+ value
15805
17375
  };
15806
17376
  const receipt = await this.ctx.dest.broadcastTransaction(signedTransaction);
15807
17377
  const events = parseEventLogs({ abi: evmHost_default.ABI, logs: receipt.logs });
@@ -15813,37 +17383,50 @@ var OrderCanceller = class {
15813
17383
  }
15814
17384
  const statusStream = indexerClient.postRequestStatusStream(commitment);
15815
17385
  for await (const statusUpdate of statusStream) {
15816
- if (statusUpdate.status === RequestStatus.SOURCE_FINALIZED) {
15817
- yield {
15818
- status: "SOURCE_FINALIZED",
15819
- data: { metadata: statusUpdate.metadata }
15820
- };
15821
- continue;
15822
- }
15823
- if (statusUpdate.status === RequestStatus.HYPERBRIDGE_DELIVERED) {
15824
- yield {
15825
- status: "HYPERBRIDGE_DELIVERED",
15826
- data: statusUpdate
15827
- };
15828
- continue;
15829
- }
15830
- if (statusUpdate.status === RequestStatus.HYPERBRIDGE_FINALIZED) {
15831
- yield {
15832
- status: "HYPERBRIDGE_FINALIZED",
15833
- data: statusUpdate
15834
- };
15835
- continue;
15836
- }
15837
- if (statusUpdate.status === RequestStatus.DESTINATION) {
15838
- await this.ctx.cancellationStorage.removeItem(STORAGE_KEYS.postCommitment(orderId));
15839
- yield {
15840
- status: "CANCELLATION_COMPLETE",
15841
- data: { metadata: statusUpdate.metadata }
15842
- };
15843
- return;
17386
+ switch (statusUpdate.status) {
17387
+ case RequestStatus.SOURCE_FINALIZED:
17388
+ yield {
17389
+ status: "SOURCE_FINALIZED",
17390
+ metadata: statusUpdate.metadata
17391
+ };
17392
+ break;
17393
+ case RequestStatus.HYPERBRIDGE_DELIVERED:
17394
+ yield {
17395
+ status: "HYPERBRIDGE_DELIVERED",
17396
+ metadata: statusUpdate.metadata
17397
+ };
17398
+ break;
17399
+ case RequestStatus.HYPERBRIDGE_FINALIZED:
17400
+ yield {
17401
+ status: "HYPERBRIDGE_FINALIZED",
17402
+ metadata: statusUpdate.metadata
17403
+ };
17404
+ break;
17405
+ case RequestStatus.DESTINATION:
17406
+ await this.ctx.cancellationStorage.removeItem(STORAGE_KEYS.postCommitment(orderId));
17407
+ yield {
17408
+ status: "CANCELLATION_COMPLETE",
17409
+ blockNumber: statusUpdate.metadata.blockNumber,
17410
+ transactionHash: statusUpdate.metadata.transactionHash
17411
+ };
17412
+ return;
15844
17413
  }
15845
17414
  }
15846
17415
  }
17416
+ /**
17417
+ * Polls for a finalized destination-chain state proof that demonstrates
17418
+ * the order commitment slot is unset (i.e. the order was not filled before
17419
+ * the deadline).
17420
+ *
17421
+ * Waits until the latest Hyperbridge-tracked state-machine height exceeds
17422
+ * `order.deadline` (or the last failed probe height) before attempting to
17423
+ * fetch the proof, then retries on failure.
17424
+ *
17425
+ * @param order - The order for which to fetch the destination proof.
17426
+ * @param indexerClient - Used to query the latest known state-machine height.
17427
+ * @yields `DESTINATION_FINALIZED` with the proof once it is successfully fetched.
17428
+ * @returns The fetched {@link IProof} (also yielded).
17429
+ */
15847
17430
  async *fetchDestinationProof(order, indexerClient) {
15848
17431
  let latestHeight = 0n;
15849
17432
  let lastFailedHeight = null;
@@ -15876,7 +17459,7 @@ var OrderCanceller = class {
15876
17459
  proof: proofHex,
15877
17460
  stateMachine: this.ctx.dest.config.stateMachineId
15878
17461
  };
15879
- yield { status: "DESTINATION_FINALIZED", data: { proof } };
17462
+ yield { status: "DESTINATION_FINALIZED", proof };
15880
17463
  return proof;
15881
17464
  } catch (e) {
15882
17465
  lastFailedHeight = latestHeight;
@@ -15884,6 +17467,17 @@ var OrderCanceller = class {
15884
17467
  }
15885
17468
  }
15886
17469
  }
17470
+ /**
17471
+ * Submits an unsigned GET request message to Hyperbridge and waits until
17472
+ * the request receipt is confirmed on-chain.
17473
+ *
17474
+ * If the initial submission fails, the method waits 30 seconds and then
17475
+ * retries querying for the receipt up to 10 times with 5-second back-off.
17476
+ *
17477
+ * @param hyperbridge - Hyperbridge Substrate chain client.
17478
+ * @param commitment - The GET request commitment hash used to poll for the receipt.
17479
+ * @param message - The fully constructed GET request message to submit.
17480
+ */
15887
17481
  async submitAndConfirmReceipt(hyperbridge, commitment, message) {
15888
17482
  let storageValue = await hyperbridge.queryRequestReceipt(commitment);
15889
17483
  if (!storageValue) {
@@ -15916,10 +17510,29 @@ var OrderCanceller = class {
15916
17510
  }
15917
17511
  };
15918
17512
  var BidManager = class {
17513
+ /**
17514
+ * @param ctx - Shared IntentsV2 context providing the destination chain
17515
+ * client, coprocessor, bundler URL, and session-key storage.
17516
+ * @param crypto - Crypto utilities used for gas packing, UserOp hashing,
17517
+ * EIP-712 signing, and bundler calls.
17518
+ */
15919
17519
  constructor(ctx, crypto) {
15920
17520
  this.ctx = ctx;
15921
17521
  this.crypto = crypto;
15922
17522
  }
17523
+ /**
17524
+ * Constructs a signed `PackedUserOperation` that a solver can submit to the
17525
+ * Hyperbridge coprocessor as a bid to fill an order.
17526
+ *
17527
+ * The solver's signature covers a hash that binds the UserOperation to the
17528
+ * order commitment and the session key address, so the IntentGatewayV2
17529
+ * contract can verify the solver's intent on-chain.
17530
+ *
17531
+ * @param options - Parameters describing the solver account, gas limits, fee
17532
+ * market values, and pre-built `callData` for the fill operation.
17533
+ * @returns A `PackedUserOperation` with the solver's signature prepended
17534
+ * with the order commitment.
17535
+ */
15923
17536
  async prepareSubmitBid(options) {
15924
17537
  const {
15925
17538
  order,
@@ -15958,6 +17571,30 @@ var BidManager = class {
15958
17571
  const signature = concat([order.id, solverSignature]);
15959
17572
  return { ...userOp, signature };
15960
17573
  }
17574
+ /**
17575
+ * Selects the best available bid, simulates it on-chain, signs the
17576
+ * solver-selection EIP-712 message with the session key, and submits the
17577
+ * UserOperation to the bundler.
17578
+ *
17579
+ * **Selection algorithm:**
17580
+ * 1. Decodes `fillOrder` calldata from each bid's `callData`.
17581
+ * 2. Sorts bids by output value (single-output: amount; all-stables: normalised
17582
+ * USD; mixed: DEX-quoted USD; fallback: raw amount).
17583
+ * 3. Iterates sorted bids, simulating each with `eth_call` until one passes.
17584
+ * 4. Appends the session-key's `SelectSolver` signature to the solver's
17585
+ * existing signature and submits via `eth_sendUserOperation`.
17586
+ * 5. For same-chain orders, waits for the transaction receipt and reads
17587
+ * `OrderFilled` / `PartialFill` events to determine fill status.
17588
+ *
17589
+ * @param order - The placed order for which to select a bid.
17590
+ * @param bids - Raw bids fetched from the Hyperbridge coprocessor.
17591
+ * @param sessionPrivateKey - Optional override; if omitted, the key is
17592
+ * looked up from `sessionKeyStorage` using `order.session`.
17593
+ * @returns A {@link SelectBidResult} containing the submitted UserOperation,
17594
+ * its hash, the winning solver address, transaction hash, and fill status.
17595
+ * @throws If the session key is not found, no valid bids exist, all
17596
+ * simulations fail, or the bundler rejects the UserOperation.
17597
+ */
15961
17598
  async selectBid(order, bids, sessionPrivateKey) {
15962
17599
  const commitment = order.id;
15963
17600
  const sessionKeyAddress = order.session;
@@ -16049,6 +17686,7 @@ var BidManager = class {
16049
17686
  const userOpHash = bundlerResult;
16050
17687
  let txnHash;
16051
17688
  let fillStatus;
17689
+ let filledAmount;
16052
17690
  try {
16053
17691
  const receipt = await retryPromise(
16054
17692
  async () => {
@@ -16063,8 +17701,9 @@ var BidManager = class {
16063
17701
  txnHash = receipt.receipt.transactionHash;
16064
17702
  if (order.source === order.destination) {
16065
17703
  try {
16066
- const chainReceipt = await this.ctx.dest.client.getTransactionReceipt({
16067
- hash: txnHash
17704
+ const chainReceipt = await this.ctx.dest.client.waitForTransactionReceipt({
17705
+ hash: txnHash,
17706
+ confirmations: 1
16068
17707
  });
16069
17708
  const events = parseEventLogs({
16070
17709
  abi: ABI3,
@@ -16082,12 +17721,15 @@ var BidManager = class {
16082
17721
  fillStatus = "full";
16083
17722
  } else if (matched?.eventName === "PartialFill") {
16084
17723
  fillStatus = "partial";
17724
+ const outputs = matched.args.outputs ?? [];
17725
+ filledAmount = outputs.reduce((acc, o) => acc + o.amount, 0n);
16085
17726
  }
16086
17727
  } catch {
16087
17728
  throw new Error("Failed to determine fill status from logs");
16088
17729
  }
16089
17730
  }
16090
- } catch {
17731
+ } catch (err) {
17732
+ throw new Error(`Failed to select bid: ${err instanceof Error ? err.message : String(err)}`);
16091
17733
  }
16092
17734
  return {
16093
17735
  userOp: signedUserOp,
@@ -16095,9 +17737,24 @@ var BidManager = class {
16095
17737
  solverAddress,
16096
17738
  commitment,
16097
17739
  txnHash,
16098
- fillStatus
17740
+ fillStatus,
17741
+ filledAmount
16099
17742
  };
16100
17743
  }
17744
+ /**
17745
+ * Validates and sorts a list of raw bids for the given order.
17746
+ *
17747
+ * Delegates to one of three strategies based on the order's output token
17748
+ * composition:
17749
+ * - Single output token: sort by offered amount descending.
17750
+ * - All stable outputs (USDC/USDT): sort by normalised USD value descending.
17751
+ * - Mixed outputs: sort by DEX-quoted USD value descending, with a raw-amount
17752
+ * fallback if pricing fails.
17753
+ *
17754
+ * @param bids - Raw filler bids from the coprocessor.
17755
+ * @param order - The placed order whose output spec drives sorting logic.
17756
+ * @returns Sorted array of `{ bid, options }` pairs ready for simulation.
17757
+ */
16101
17758
  async validateAndSortBids(bids, order) {
16102
17759
  const outputs = order.output.assets;
16103
17760
  const decodedBids = this.decodeBids(bids);
@@ -16114,6 +17771,15 @@ var BidManager = class {
16114
17771
  console.log(`[BidManager] Using mixed-output sorting (${outputs.length} output assets, some non-stable)`);
16115
17772
  return this.sortMixedOutputs(decodedBids, outputs, chainId);
16116
17773
  }
17774
+ /**
17775
+ * Decodes the `fillOrder` fill-options from each bid's ERC-7821 calldata.
17776
+ *
17777
+ * Bids whose calldata cannot be decoded or do not contain a valid
17778
+ * `fillOrder` call are silently dropped with a warning.
17779
+ *
17780
+ * @param bids - Raw bids to decode.
17781
+ * @returns Array of successfully decoded `{ bid, options }` pairs.
17782
+ */
16117
17783
  decodeBids(bids) {
16118
17784
  const result = [];
16119
17785
  for (const bid of bids) {
@@ -16127,6 +17793,13 @@ var BidManager = class {
16127
17793
  console.log(`[BidManager] Decoded ${result.length}/${bids.length} bid(s) successfully`);
16128
17794
  return result;
16129
17795
  }
17796
+ /**
17797
+ * Extracts the `FillOptionsV2` struct from a single bid's ERC-7821
17798
+ * batch calldata by finding and decoding the inner `fillOrder` call.
17799
+ *
17800
+ * @param bid - A single filler bid.
17801
+ * @returns The decoded `FillOptionsV2`, or `null` if extraction fails.
17802
+ */
16130
17803
  decodeBidFillOptions(bid) {
16131
17804
  try {
16132
17805
  const innerCalls = this.crypto.decodeERC7821Execute(bid.userOp.callData);
@@ -16151,6 +17824,16 @@ var BidManager = class {
16151
17824
  }
16152
17825
  return null;
16153
17826
  }
17827
+ /**
17828
+ * Simulates a bid on-chain by batching the `select` and `fillOrder` calls
17829
+ * via `eth_call` from the solver's account, using the IntentGatewayV2
17830
+ * ERC-7821 batch-execute pattern.
17831
+ *
17832
+ * @param bid - The filler bid to simulate.
17833
+ * @param selectOptions - The signed solver-selection parameters.
17834
+ * @param intentGatewayV2Address - Address of the IntentGatewayV2 contract on the destination chain.
17835
+ * @throws If the `eth_call` simulation reverts or errors.
17836
+ */
16154
17837
  async simulate(bid, selectOptions, intentGatewayV2Address) {
16155
17838
  const solverAddress = bid.userOp.sender;
16156
17839
  const selectCalldata = encodeFunctionData({
@@ -16175,8 +17858,9 @@ var BidManager = class {
16175
17858
  }
16176
17859
  }
16177
17860
  /**
16178
- * Case A: single output token – keep existing behavior.
16179
- * Filter bids whose first output amount < required, sort descending.
17861
+ * Case A: single output token.
17862
+ * Filter bids by token match only, sort descending by amount.
17863
+ * Partial fill bids are allowed — the contract determines fill status.
16180
17864
  */
16181
17865
  sortSingleOutput(decodedBids, requiredAsset) {
16182
17866
  const requiredAmount = new Decimal3(requiredAsset.amount.toString());
@@ -16194,14 +17878,14 @@ var BidManager = class {
16194
17878
  continue;
16195
17879
  }
16196
17880
  if (bidAmount.lt(requiredAmount)) {
16197
- console.warn(
16198
- `[BidManager] Bid from solver=${bid.userOp.sender} REJECTED: amount too low (bid=${bidAmount.toString()}, required=${requiredAmount.toString()}, shortfall=${requiredAmount.minus(bidAmount).toString()})`
17881
+ console.log(
17882
+ `[BidManager] Bid from solver=${bid.userOp.sender}: partial fill candidate (bid=${bidAmount.toString()}, required=${requiredAmount.toString()}, covers=${bidAmount.div(requiredAmount).mul(100).toFixed(2)}%)`
17883
+ );
17884
+ } else {
17885
+ console.log(
17886
+ `[BidManager] Bid from solver=${bid.userOp.sender} ACCEPTED: amount=${bidAmount.toString()} (surplus=${bidAmount.minus(requiredAmount).toString()})`
16199
17887
  );
16200
- continue;
16201
17888
  }
16202
- console.log(
16203
- `[BidManager] Bid from solver=${bid.userOp.sender} ACCEPTED: amount=${bidAmount.toString()} (surplus=${bidAmount.minus(requiredAmount).toString()})`
16204
- );
16205
17889
  validBids.push({ bid, options, amount: bidOutput.amount });
16206
17890
  }
16207
17891
  validBids.sort((a, b) => {
@@ -16213,7 +17897,8 @@ var BidManager = class {
16213
17897
  }
16214
17898
  /**
16215
17899
  * Case B: all outputs are USDC/USDT.
16216
- * Sum normalised USD values (treating each stable as $1) and compare.
17900
+ * Sum normalised USD values (treating each stable as $1) and sort descending.
17901
+ * Partial fill bids are allowed.
16217
17902
  */
16218
17903
  sortAllStables(decodedBids, orderOutputs, chainId) {
16219
17904
  const requiredUsd = this.computeStablesUsdValue(orderOutputs, chainId);
@@ -16221,15 +17906,19 @@ var BidManager = class {
16221
17906
  const validBids = [];
16222
17907
  for (const { bid, options } of decodedBids) {
16223
17908
  const bidUsd = this.computeStablesUsdValue(options.outputs, chainId);
16224
- if (bidUsd === null || bidUsd.lt(requiredUsd)) {
16225
- console.warn(
16226
- `[BidManager] Bid from solver=${bid.userOp.sender} REJECTED: USD value too low (bid=${bidUsd?.toString() ?? "null"}, required=${requiredUsd.toString()})`
16227
- );
17909
+ if (bidUsd === null) {
17910
+ console.warn(`[BidManager] Bid from solver=${bid.userOp.sender} REJECTED: unable to compute USD value`);
16228
17911
  continue;
16229
17912
  }
16230
- console.log(
16231
- `[BidManager] Bid from solver=${bid.userOp.sender} ACCEPTED: USD value=${bidUsd.toString()}`
16232
- );
17913
+ if (bidUsd.lt(requiredUsd)) {
17914
+ console.log(
17915
+ `[BidManager] Bid from solver=${bid.userOp.sender}: partial fill candidate (bid=${bidUsd.toString()}, required=${requiredUsd.toString()}, covers=${bidUsd.div(requiredUsd).mul(100).toFixed(2)}%)`
17916
+ );
17917
+ } else {
17918
+ console.log(
17919
+ `[BidManager] Bid from solver=${bid.userOp.sender} ACCEPTED: USD value=${bidUsd.toString()}`
17920
+ );
17921
+ }
16233
17922
  validBids.push({ bid, options, usdValue: bidUsd });
16234
17923
  }
16235
17924
  validBids.sort((a, b) => b.usdValue.comparedTo(a.usdValue));
@@ -16238,7 +17927,7 @@ var BidManager = class {
16238
17927
  /**
16239
17928
  * Case C: mixed output tokens (at least one non-stable).
16240
17929
  * Price every token via on-chain DEX quotes, fall back to raw amounts
16241
- * if pricing is unavailable.
17930
+ * if pricing is unavailable. Partial fill bids are allowed.
16242
17931
  */
16243
17932
  async sortMixedOutputs(decodedBids, orderOutputs, chainId) {
16244
17933
  const requiredUsd = await this.computeOutputsUsdValue(orderOutputs, chainId);
@@ -16250,15 +17939,21 @@ var BidManager = class {
16250
17939
  const validBids = [];
16251
17940
  for (const { bid, options } of decodedBids) {
16252
17941
  const bidUsd = await this.computeOutputsUsdValue(options.outputs, chainId);
16253
- if (bidUsd === null || bidUsd.lt(requiredUsd)) {
17942
+ if (bidUsd === null) {
16254
17943
  console.warn(
16255
- `[BidManager] Bid from solver=${bid.userOp.sender} REJECTED: mixed USD value too low (bid=${bidUsd?.toString() ?? "unpriceable"}, required=${requiredUsd.toString()})`
17944
+ `[BidManager] Bid from solver=${bid.userOp.sender} REJECTED: unable to price mixed outputs`
16256
17945
  );
16257
17946
  continue;
16258
17947
  }
16259
- console.log(
16260
- `[BidManager] Bid from solver=${bid.userOp.sender} ACCEPTED: mixed USD value=${bidUsd.toString()}`
16261
- );
17948
+ if (bidUsd.lt(requiredUsd)) {
17949
+ console.log(
17950
+ `[BidManager] Bid from solver=${bid.userOp.sender}: partial fill candidate (bid=${bidUsd.toString()}, required=${requiredUsd.toString()}, covers=${bidUsd.div(requiredUsd).mul(100).toFixed(2)}%)`
17951
+ );
17952
+ } else {
17953
+ console.log(
17954
+ `[BidManager] Bid from solver=${bid.userOp.sender} ACCEPTED: mixed USD value=${bidUsd.toString()}`
17955
+ );
17956
+ }
16262
17957
  validBids.push({ bid, options, usdValue: bidUsd });
16263
17958
  }
16264
17959
  validBids.sort((a, b) => b.usdValue.comparedTo(a.usdValue));
@@ -16266,16 +17961,18 @@ var BidManager = class {
16266
17961
  }
16267
17962
  /**
16268
17963
  * Fallback when DEX pricing is unavailable.
16269
- * Computes the total spread (sum of extra amount above required per token)
16270
- * for each bid. Bids that don't meet every token's minimum are discarded.
16271
- * Remaining bids are sorted by total spread descending.
17964
+ * Computes total spread per bid. Bids missing a required token are rejected.
17965
+ * Bids offering less than required for a token are allowed (partial fill).
17966
+ * Sorted by total offered amount descending.
16272
17967
  */
16273
17968
  sortByRawAmountFallback(decodedBids, orderOutputs) {
16274
- console.log(`[BidManager] sortByRawAmountFallback: checking ${decodedBids.length} bid(s) against ${orderOutputs.length} required output(s)`);
17969
+ console.log(
17970
+ `[BidManager] sortByRawAmountFallback: checking ${decodedBids.length} bid(s) against ${orderOutputs.length} required output(s)`
17971
+ );
16275
17972
  const validBids = [];
16276
17973
  for (const { bid, options } of decodedBids) {
16277
17974
  let valid = true;
16278
- let totalSpread = new Decimal3(0);
17975
+ let totalOffered = new Decimal3(0);
16279
17976
  let rejectReason = "";
16280
17977
  for (const required of orderOutputs) {
16281
17978
  const matching = options.outputs.find((o) => o.token.toLowerCase() === required.token.toLowerCase());
@@ -16284,28 +17981,37 @@ var BidManager = class {
16284
17981
  rejectReason = `missing output token=${required.token}`;
16285
17982
  break;
16286
17983
  }
16287
- if (matching.amount < required.amount) {
16288
- valid = false;
16289
- rejectReason = `token=${required.token} amount too low (bid=${matching.amount.toString()}, required=${required.amount.toString()})`;
16290
- break;
16291
- }
16292
- totalSpread = totalSpread.plus(
16293
- new Decimal3(matching.amount.toString()).minus(required.amount.toString())
16294
- );
17984
+ totalOffered = totalOffered.plus(new Decimal3(matching.amount.toString()));
16295
17985
  }
16296
17986
  if (!valid) {
16297
17987
  console.warn(`[BidManager] Bid from solver=${bid.userOp.sender} REJECTED (fallback): ${rejectReason}`);
16298
17988
  continue;
16299
17989
  }
16300
- console.log(
16301
- `[BidManager] Bid from solver=${bid.userOp.sender} ACCEPTED (fallback): totalSpread=${totalSpread.toString()}`
17990
+ const totalRequired = orderOutputs.reduce(
17991
+ (acc, o) => acc.plus(new Decimal3(o.amount.toString())),
17992
+ new Decimal3(0)
16302
17993
  );
16303
- validBids.push({ bid, options, totalSpread });
17994
+ if (totalOffered.lt(totalRequired)) {
17995
+ console.log(
17996
+ `[BidManager] Bid from solver=${bid.userOp.sender}: partial fill candidate (fallback) (offered=${totalOffered.toString()}, required=${totalRequired.toString()}, covers=${totalOffered.div(totalRequired).mul(100).toFixed(2)}%)`
17997
+ );
17998
+ } else {
17999
+ console.log(
18000
+ `[BidManager] Bid from solver=${bid.userOp.sender} ACCEPTED (fallback): totalOffered=${totalOffered.toString()}`
18001
+ );
18002
+ }
18003
+ validBids.push({ bid, options, totalOffered });
16304
18004
  }
16305
- validBids.sort((a, b) => b.totalSpread.comparedTo(a.totalSpread));
16306
- return validBids.map(({ totalSpread: _, ...rest }) => rest);
18005
+ validBids.sort((a, b) => b.totalOffered.comparedTo(a.totalOffered));
18006
+ return validBids.map(({ totalOffered: _, ...rest }) => rest);
16307
18007
  }
16308
18008
  // ── Token classification helpers ──────────────────────────────────
18009
+ /**
18010
+ * Returns `true` if `tokenAddr` is either USDC or USDT on the given chain.
18011
+ *
18012
+ * @param tokenAddr - 20-byte ERC-20 token address (hex).
18013
+ * @param chainId - State-machine ID of the chain to look up token addresses on.
18014
+ */
16309
18015
  isStableToken(tokenAddr, chainId) {
16310
18016
  const configService = this.ctx.dest.configService;
16311
18017
  const usdc = configService.getUsdcAsset(chainId);
@@ -16313,6 +18019,14 @@ var BidManager = class {
16313
18019
  const normalized = tokenAddr.toLowerCase();
16314
18020
  return normalized === usdc.toLowerCase() || normalized === usdt.toLowerCase();
16315
18021
  }
18022
+ /**
18023
+ * Returns the ERC-20 decimal count for a known stable token (USDC or USDT)
18024
+ * on the given chain.
18025
+ *
18026
+ * @param tokenAddr - 20-byte token address (hex).
18027
+ * @param chainId - State-machine ID of the chain.
18028
+ * @returns Decimal count (e.g. 6 for USDC on most chains).
18029
+ */
16316
18030
  getStableDecimals(tokenAddr, chainId) {
16317
18031
  const configService = this.ctx.dest.configService;
16318
18032
  if (tokenAddr.toLowerCase() === configService.getUsdcAsset(chainId).toLowerCase()) {
@@ -16321,6 +18035,14 @@ var BidManager = class {
16321
18035
  return configService.getUsdtDecimals(chainId);
16322
18036
  }
16323
18037
  // ── Basket valuation helpers ──────────────────────────────────────
18038
+ /**
18039
+ * Sums the USD value of a basket of stable tokens (USDC/USDT only),
18040
+ * normalising each amount by its decimal count and treating each token as $1.
18041
+ *
18042
+ * @param outputs - List of token/amount pairs where every token is a stable.
18043
+ * @param chainId - State-machine ID used to look up decimals.
18044
+ * @returns Total USD value as a `Decimal`.
18045
+ */
16324
18046
  computeStablesUsdValue(outputs, chainId) {
16325
18047
  let total = new Decimal3(0);
16326
18048
  for (const output of outputs) {
@@ -16415,10 +18137,40 @@ var BidManager = class {
16415
18137
  }
16416
18138
  };
16417
18139
  var GasEstimator = class {
18140
+ /**
18141
+ * @param ctx - Shared IntentsV2 context providing the source and destination
18142
+ * chain clients, config service, bundler URL, and solver-code cache.
18143
+ * @param crypto - Crypto utilities used for UserOp construction, signing,
18144
+ * gas packing, and bundler calls.
18145
+ */
16418
18146
  constructor(ctx, crypto) {
16419
18147
  this.ctx = ctx;
16420
18148
  this.crypto = crypto;
16421
18149
  }
18150
+ /**
18151
+ * Estimates the gas cost for a solver to fill the given order and returns
18152
+ * a structured estimate with individual gas components and total costs in
18153
+ * both wei and fee-token units.
18154
+ *
18155
+ * **Cross-chain orders:** also estimates the ISMP POST request fee required
18156
+ * for the solver to trigger source-chain escrow redemption after filling, and
18157
+ * includes it in `fillOptions.relayerFee` and `fillOptions.nativeDispatchFee`.
18158
+ *
18159
+ * **Bundler path:** constructs a mock `PackedUserOperation` signed by an
18160
+ * ephemeral keypair, applies state overrides, and calls
18161
+ * `eth_estimateUserOperationGas`. Gas limits are bumped by 5-10% for
18162
+ * headroom. If the bundler is Pimlico, gas prices are refined with
18163
+ * `pimlico_getUserOperationGasPrice`.
18164
+ *
18165
+ * **Fallback path (no bundler):** calls `estimateContractGas` directly on
18166
+ * `fillOrder` with state overrides.
18167
+ *
18168
+ * @param params - Parameters including the order to estimate and optional
18169
+ * percentage bumps for `maxPriorityFeePerGas` and `maxFeePerGas`.
18170
+ * @returns A {@link FillOrderEstimateV2} containing all gas components,
18171
+ * EIP-1559 fee values, total cost in wei, and total cost in the source
18172
+ * chain's fee token.
18173
+ */
16422
18174
  async estimateFillOrderV2(params) {
16423
18175
  const { order } = params;
16424
18176
  const solverPrivateKey = generatePrivateKey();
@@ -16465,7 +18217,7 @@ var GasEstimator = class {
16465
18217
  dest: souceStateMachineId,
16466
18218
  body: constructRedeemEscrowRequestBody({ ...order, id: orderV2Commitment(order) }, MOCK_ADDRESS),
16467
18219
  timeoutTimestamp: 0n,
16468
- nonce: await this.ctx.source.getHostNonce(),
18220
+ nonce: await this.ctx.dest.getHostNonce(),
16469
18221
  from: this.ctx.source.configService.getIntentGatewayV2Address(destStateMachineId),
16470
18222
  to: this.ctx.source.configService.getIntentGatewayV2Address(souceStateMachineId)
16471
18223
  };
@@ -16608,6 +18360,32 @@ var GasEstimator = class {
16608
18360
  fillOptions
16609
18361
  };
16610
18362
  }
18363
+ /**
18364
+ * Builds EVM state override objects for gas estimation of the `fillOrder`
18365
+ * call, granting the solver account sufficient balances, allowances, and
18366
+ * EntryPoint deposits so the estimation does not revert due to missing funds.
18367
+ *
18368
+ * Returns two formats of the same overrides:
18369
+ * - `viem`: array format compatible with viem's `stateOverride` parameter.
18370
+ * - `bundler`: object format compatible with the ERC-4337 bundler's
18371
+ * `eth_estimateUserOperationGas` state-override parameter.
18372
+ *
18373
+ * Optionally injects known solver account bytecode (from `solverCodeCache`)
18374
+ * so the mock EOA used for estimation behaves like a real solver smart account.
18375
+ *
18376
+ * @param params.accountAddress - Address of the mock solver account.
18377
+ * @param params.chain - State-machine ID of the destination chain.
18378
+ * @param params.outputAssets - Token/amount pairs whose balance and allowance
18379
+ * slots should be overridden.
18380
+ * @param params.spenderAddress - Address that needs allowance from the solver
18381
+ * account (i.e. the IntentGatewayV2 contract).
18382
+ * @param params.intentGatewayV2Address - If provided, overrides slot 5 of
18383
+ * IntentGatewayV2 with the call-dispatcher address so dispatch calls
18384
+ * succeed during estimation.
18385
+ * @param params.entryPointAddress - If provided, overrides the EntryPoint
18386
+ * deposit mapping to give the solver account a large deposit.
18387
+ * @returns An object with `viem` and `bundler` state-override collections.
18388
+ */
16611
18389
  async buildStateOverride(params) {
16612
18390
  const { accountAddress, chain, outputAssets, spenderAddress, intentGatewayV2Address, entryPointAddress } = params;
16613
18391
  const testValue = toHex(maxUint256 / 2n, { size: 32 });
@@ -16701,6 +18479,17 @@ var GasEstimator = class {
16701
18479
  }
16702
18480
  return { viem: viemOverrides, bundler: bundlerOverrides };
16703
18481
  }
18482
+ /**
18483
+ * Quotes the native token cost of dispatching an ISMP POST request through
18484
+ * the IntentGateway (v1) `quoteNative` function.
18485
+ *
18486
+ * Uses the v1 IntentGateway ABI (not IntentGatewayV2) because the dispatch
18487
+ * call is routed through the legacy gateway contract.
18488
+ *
18489
+ * @param postRequest - The ISMP POST request to quote.
18490
+ * @param fee - The relayer fee (in dest fee token) to include in the quote.
18491
+ * @returns The native token amount required to dispatch the request.
18492
+ */
16704
18493
  async quoteNative(postRequest, fee) {
16705
18494
  const dispatchPost = {
16706
18495
  dest: toHex(postRequest.dest),
@@ -16719,6 +18508,10 @@ var GasEstimator = class {
16719
18508
  }
16720
18509
  };
16721
18510
  var OrderStatusChecker = class {
18511
+ /**
18512
+ * @param ctx - Shared IntentsV2 context providing the source and destination
18513
+ * chain clients and config service.
18514
+ */
16722
18515
  constructor(ctx) {
16723
18516
  this.ctx = ctx;
16724
18517
  }
@@ -16781,18 +18574,41 @@ var OrderStatusChecker = class {
16781
18574
 
16782
18575
  // src/protocols/intentsV2/IntentsV2.ts
16783
18576
  var IntentsV2 = class _IntentsV2 {
18577
+ /** EVM chain on which orders are placed and escrowed. */
16784
18578
  source;
18579
+ /** EVM chain on which solvers fill orders and deliver outputs. */
16785
18580
  dest;
18581
+ /** Optional Hyperbridge coprocessor client for bid fetching and UserOp submission. */
16786
18582
  intentsCoprocessor;
18583
+ /** Optional ERC-4337 bundler URL for gas estimation and UserOp broadcasting. */
16787
18584
  bundlerUrl;
18585
+ /** Shared context object passed to all sub-modules. */
16788
18586
  ctx;
18587
+ /** Crypto and encoding utilities (EIP-712, gas packing, bundler calls). */
16789
18588
  _crypto;
18589
+ /** Handles `placeOrder` calldata generation and session-key management. */
16790
18590
  orderPlacer;
18591
+ /** Drives the bid-polling and UserOp-submission loop after order placement. */
16791
18592
  orderExecutor;
18593
+ /** Manages source- and destination-initiated order cancellation flows. */
16792
18594
  orderCanceller;
18595
+ /** Reads fill and refund status from on-chain storage. */
16793
18596
  orderStatusChecker;
18597
+ /** Validates, sorts, simulates, and submits solver bids. */
16794
18598
  bidManager;
18599
+ /** Estimates gas costs for filling an order and converts them to fee-token amounts. */
16795
18600
  gasEstimator;
18601
+ /**
18602
+ * Private constructor — use {@link IntentsV2.create} instead.
18603
+ *
18604
+ * Initialises all sub-modules and the shared context, including storage
18605
+ * adapters, fee-token and solver-code caches, and the DEX-quote utility.
18606
+ *
18607
+ * @param source - Source chain client.
18608
+ * @param dest - Destination chain client.
18609
+ * @param intentsCoprocessor - Optional coprocessor for bid fetching.
18610
+ * @param bundlerUrl - Optional ERC-4337 bundler endpoint URL.
18611
+ */
16796
18612
  constructor(source, dest, intentsCoprocessor, bundlerUrl) {
16797
18613
  this.source = source;
16798
18614
  this.dest = dest;
@@ -16800,6 +18616,7 @@ var IntentsV2 = class _IntentsV2 {
16800
18616
  this.bundlerUrl = bundlerUrl;
16801
18617
  const sessionKeyStorage = createSessionKeyStorage();
16802
18618
  const cancellationStorage = createCancellationStorage();
18619
+ const usedUserOpsStorage = createUsedUserOpsStorage();
16803
18620
  const swap = new Swap();
16804
18621
  const feeTokenCache = /* @__PURE__ */ new Map();
16805
18622
  const solverCodeCache = /* @__PURE__ */ new Map();
@@ -16812,13 +18629,14 @@ var IntentsV2 = class _IntentsV2 {
16812
18629
  solverCodeCache,
16813
18630
  sessionKeyStorage,
16814
18631
  cancellationStorage,
18632
+ usedUserOpsStorage,
16815
18633
  swap
16816
18634
  };
16817
18635
  const crypto = new CryptoUtils(this.ctx);
16818
18636
  const bidManager = new BidManager(this.ctx, crypto);
16819
18637
  const gasEstimator = new GasEstimator(this.ctx, crypto);
16820
18638
  this.orderPlacer = new OrderPlacer(this.ctx);
16821
- this.orderExecutor = new OrderExecutor(this.ctx, bidManager);
18639
+ this.orderExecutor = new OrderExecutor(this.ctx, bidManager, crypto);
16822
18640
  this.orderCanceller = new OrderCanceller(this.ctx);
16823
18641
  this.orderStatusChecker = new OrderStatusChecker(this.ctx);
16824
18642
  this.bidManager = bidManager;
@@ -16828,6 +18646,10 @@ var IntentsV2 = class _IntentsV2 {
16828
18646
  /**
16829
18647
  * Creates an initialized IntentsV2 instance.
16830
18648
  *
18649
+ * Fetches the fee tokens for both chains and optionally caches the solver
18650
+ * account bytecode before returning, so the instance is ready for use
18651
+ * without additional warm-up calls.
18652
+ *
16831
18653
  * @param source - Source chain for order placement
16832
18654
  * @param dest - Destination chain for order fulfillment
16833
18655
  * @param intentsCoprocessor - Optional coprocessor for bid fetching and order execution
@@ -16839,6 +18661,12 @@ var IntentsV2 = class _IntentsV2 {
16839
18661
  await instance.init();
16840
18662
  return instance;
16841
18663
  }
18664
+ /**
18665
+ * Pre-warms the fee-token cache for both chains and attempts to load the
18666
+ * solver account bytecode into the solver-code cache.
18667
+ *
18668
+ * Called automatically by {@link IntentsV2.create}; not intended for direct use.
18669
+ */
16842
18670
  async init() {
16843
18671
  const now = Date.now();
16844
18672
  const sourceFeeToken = await this.source.getFeeTokenWithDecimals();
@@ -16856,8 +18684,36 @@ var IntentsV2 = class _IntentsV2 {
16856
18684
  }
16857
18685
  }
16858
18686
  }
18687
+ /**
18688
+ * Bidirectional async generator that orchestrates the full order lifecycle:
18689
+ * placement, fee estimation, bid collection, and execution.
18690
+ *
18691
+ * **Yield/receive protocol:**
18692
+ * 1. If `order.fees` is unset or zero, estimates gas and sets `order.fees`
18693
+ * with a 1% buffer and the wei cost with a 2% buffer for the `value` field.
18694
+ * 2. Yields `AWAITING_PLACE_ORDER` with `{ to, data, value, sessionPrivateKey }`.
18695
+ * The caller must sign the transaction and pass it back via `gen.next(signedTx)`.
18696
+ * 3. Yields `ORDER_PLACED` with the finalised order and transaction hash once
18697
+ * the `OrderPlaced` event is confirmed.
18698
+ * 4. Delegates to {@link OrderExecutor.executeIntentOrder} and forwards all
18699
+ * subsequent status updates until the order is filled, exhausted, or fails.
18700
+ *
18701
+ * @param order - The order to place and execute. `order.fees` may be 0; it
18702
+ * will be estimated automatically if so.
18703
+ * @param graffiti - Optional bytes32 tag for orderflow attribution /
18704
+ * revenue share. Defaults to {@link DEFAULT_GRAFFITI}.
18705
+ * @param options - Optional tuning parameters:
18706
+ * - `maxPriorityFeePerGasBumpPercent` — bump % for the priority fee estimate (default 8).
18707
+ * - `maxFeePerGasBumpPercent` — bump % for the max fee estimate (default 10).
18708
+ * - `minBids` — minimum bids to collect before selecting (default 1).
18709
+ * - `bidTimeoutMs` — how long to poll for bids before giving up (default 60 000 ms).
18710
+ * - `pollIntervalMs` — interval between bid-polling attempts.
18711
+ * @yields {@link IntentOrderStatusUpdate} at each lifecycle stage.
18712
+ * @throws If the `placeOrder` generator behaves unexpectedly, or if gas
18713
+ * estimation returns zero.
18714
+ */
16859
18715
  async *execute(order, graffiti = DEFAULT_GRAFFITI, options) {
16860
- let feesInWei;
18716
+ let value;
16861
18717
  if (!order.fees || order.fees === 0n) {
16862
18718
  const estimate = await this.gasEstimator.estimateFillOrderV2({
16863
18719
  order,
@@ -16867,7 +18723,7 @@ var IntentsV2 = class _IntentsV2 {
16867
18723
  if (estimate.totalGasCostWei === 0n || estimate.totalGasInFeeToken === 0n) {
16868
18724
  throw new Error("Gas estimation failed");
16869
18725
  }
16870
- feesInWei = estimate.totalGasCostWei + estimate.totalGasCostWei * 2n / 100n;
18726
+ value = estimate.totalGasCostWei + estimate.totalGasCostWei * 2n / 100n;
16871
18727
  order.fees = estimate.totalGasInFeeToken + estimate.totalGasInFeeToken * 1n / 100n;
16872
18728
  }
16873
18729
  const placeOrderGen = this.orderPlacer.placeOrder(order, graffiti);
@@ -16875,13 +18731,14 @@ var IntentsV2 = class _IntentsV2 {
16875
18731
  if (placeOrderFirst.done) {
16876
18732
  throw new Error("placeOrder generator completed without yielding");
16877
18733
  }
16878
- const { calldata, sessionPrivateKey } = placeOrderFirst.value;
16879
- const signedTransaction = yield { calldata, feesInWei, sessionPrivateKey };
18734
+ const { to, data, sessionPrivateKey } = placeOrderFirst.value;
18735
+ const signedTransaction = yield { status: "AWAITING_PLACE_ORDER", to, data, value, sessionPrivateKey };
16880
18736
  const placeOrderSecond = await placeOrderGen.next(signedTransaction);
16881
18737
  if (placeOrderSecond.done === false) {
16882
18738
  throw new Error("placeOrder generator yielded unexpectedly after signing");
16883
18739
  }
16884
- const finalizedOrder = placeOrderSecond.value;
18740
+ const { order: finalizedOrder, transactionHash } = placeOrderSecond.value;
18741
+ yield { status: "ORDER_PLACED", order: finalizedOrder, transactionHash };
16885
18742
  for await (const status of this.orderExecutor.executeIntentOrder({
16886
18743
  order: finalizedOrder,
16887
18744
  sessionPrivateKey,
@@ -16891,37 +18748,121 @@ var IntentsV2 = class _IntentsV2 {
16891
18748
  })) {
16892
18749
  yield status;
16893
18750
  }
18751
+ return;
16894
18752
  }
16895
- async *placeOrder(order, graffiti = DEFAULT_GRAFFITI) {
16896
- return yield* this.orderPlacer.placeOrder(order, graffiti);
16897
- }
16898
- async *executeIntentOrder(options) {
16899
- yield* this.orderExecutor.executeIntentOrder(options);
16900
- }
18753
+ /**
18754
+ * Quotes the native token cost for cancelling an order.
18755
+ *
18756
+ * Delegates to {@link OrderCanceller.quoteCancelNative}.
18757
+ *
18758
+ * @param order - The order to quote cancellation for.
18759
+ * @param from - Chain side that initiates the cancel (`"source"` or `"dest"`).
18760
+ * Defaults to `"source"`.
18761
+ * @returns The native token amount required to submit the cancel transaction.
18762
+ */
16901
18763
  async quoteCancelNative(order, from = "source") {
16902
18764
  return this.orderCanceller.quoteCancelNative(order, from);
16903
18765
  }
18766
+ /**
18767
+ * Async generator that cancels an order and streams status events until
18768
+ * cancellation is complete.
18769
+ *
18770
+ * Delegates to {@link OrderCanceller.cancelOrder}.
18771
+ *
18772
+ * @param order - The order to cancel.
18773
+ * @param indexerClient - Indexer client used for ISMP request status streaming.
18774
+ * @param from - Chain side that initiates the cancel. Defaults to `"source"`.
18775
+ * @yields {@link CancelEvent} objects describing each cancellation stage.
18776
+ */
16904
18777
  async *cancelOrder(order, indexerClient, from = "source") {
16905
18778
  yield* this.orderCanceller.cancelOrder(order, indexerClient, from);
16906
18779
  }
18780
+ /**
18781
+ * Constructs a signed `PackedUserOperation` for a solver to submit as a bid.
18782
+ *
18783
+ * Delegates to {@link BidManager.prepareSubmitBid}.
18784
+ *
18785
+ * @param options - Bid parameters including order, solver account, gas limits,
18786
+ * fee market values, and pre-built fill calldata.
18787
+ * @returns A fully signed `PackedUserOperation` ready for submission.
18788
+ */
16907
18789
  async prepareSubmitBid(options) {
16908
18790
  return this.bidManager.prepareSubmitBid(options);
16909
18791
  }
18792
+ /**
18793
+ * Selects the best available bid, simulates it, and submits the UserOperation
18794
+ * to the bundler.
18795
+ *
18796
+ * Delegates to {@link BidManager.selectBid}.
18797
+ *
18798
+ * @param order - The placed order to fill.
18799
+ * @param bids - Raw filler bids fetched from the coprocessor.
18800
+ * @param sessionPrivateKey - Optional session key override; looked up from
18801
+ * storage if omitted.
18802
+ * @returns A {@link SelectBidResult} with the submitted UserOperation, hashes,
18803
+ * and fill status.
18804
+ */
16910
18805
  async selectBid(order, bids, sessionPrivateKey) {
16911
18806
  return this.bidManager.selectBid(order, bids, sessionPrivateKey);
16912
18807
  }
18808
+ /**
18809
+ * Estimates the gas cost for filling the given order, returning individual
18810
+ * gas components and fee-token-denominated totals.
18811
+ *
18812
+ * Delegates to {@link GasEstimator.estimateFillOrderV2}.
18813
+ *
18814
+ * @param params - Estimation parameters including the order and optional
18815
+ * gas-price bump percentages.
18816
+ * @returns A {@link FillOrderEstimateV2} with all gas components.
18817
+ */
16913
18818
  async estimateFillOrderV2(params) {
16914
18819
  return this.gasEstimator.estimateFillOrderV2(params);
16915
18820
  }
18821
+ /**
18822
+ * Encodes a list of calls into ERC-7821 `execute` calldata using
18823
+ * single-batch mode.
18824
+ *
18825
+ * Delegates to {@link CryptoUtils.encodeERC7821Execute}.
18826
+ *
18827
+ * @param calls - Ordered list of calls to batch.
18828
+ * @returns ABI-encoded calldata for the ERC-7821 `execute` function.
18829
+ */
16916
18830
  encodeERC7821Execute(calls) {
16917
18831
  return this._crypto.encodeERC7821Execute(calls);
16918
18832
  }
18833
+ /**
18834
+ * Decodes ERC-7821 `execute` calldata back into its constituent calls.
18835
+ *
18836
+ * Delegates to {@link CryptoUtils.decodeERC7821Execute}.
18837
+ *
18838
+ * @param callData - Hex-encoded calldata to decode.
18839
+ * @returns Array of decoded {@link ERC7821Call} objects, or `null` on failure.
18840
+ */
16919
18841
  decodeERC7821Execute(callData) {
16920
18842
  return this._crypto.decodeERC7821Execute(callData);
16921
18843
  }
18844
+ /**
18845
+ * Checks whether an order has been filled on the destination chain.
18846
+ *
18847
+ * Delegates to {@link OrderStatusChecker.isOrderFilled}.
18848
+ *
18849
+ * @param order - The order to check.
18850
+ * @returns `true` if the order's commitment slot on the destination chain is
18851
+ * non-zero (i.e. `fillOrder` has been called successfully).
18852
+ */
16922
18853
  async isOrderFilled(order) {
16923
18854
  return this.orderStatusChecker.isOrderFilled(order);
16924
18855
  }
18856
+ /**
18857
+ * Checks whether all escrowed inputs for an order have been refunded on the
18858
+ * source chain.
18859
+ *
18860
+ * Delegates to {@link OrderStatusChecker.isOrderRefunded}.
18861
+ *
18862
+ * @param order - The order to check.
18863
+ * @returns `true` if every input token's escrowed amount has been zeroed out
18864
+ * in the `_orders` mapping on the source chain.
18865
+ */
16925
18866
  async isOrderRefunded(order) {
16926
18867
  return this.orderStatusChecker.isOrderRefunded(order);
16927
18868
  }
@@ -17376,6 +19317,6 @@ async function teleportDot(param_) {
17376
19317
  return stream;
17377
19318
  }
17378
19319
 
17379
- export { ADDRESS_ZERO, BundlerMethod, ChainConfigService, Chains, DEFAULT_ADDRESS, DEFAULT_GRAFFITI, DOMAIN_TYPEHASH, DUMMY_PRIVATE_KEY, ERC20Method, ERC7821_BATCH_MODE, EvmChain, EvmLanguage, HyperClientStatus, IndexerClient, IntentGateway, IntentOrderStatus, IntentsCoprocessor, IntentsV2, MOCK_ADDRESS, ORDER_V2_PARAM_TYPE, OrderStatus, OrderStatusChecker, PACKED_USEROP_TYPEHASH, PLACE_ORDER_SELECTOR, REQUEST_COMMITMENTS_SLOT, REQUEST_RECEIPTS_SLOT, RESPONSE_COMMITMENTS_SLOT, RESPONSE_RECEIPTS_SLOT, RequestKind, RequestStatus, SELECT_SOLVER_TYPEHASH, STATE_COMMITMENTS_SLOT, SubstrateChain, Swap, TESTNET_CHAINS, TeleportStatus, TimeoutStatus, TokenGateway, TronChain, USE_ETHERSCAN_CHAINS, __test, adjustDecimals, bytes20ToBytes32, bytes32ToBytes20, calculateAllowanceMappingLocation, calculateBalanceMappingLocation, chainConfigs, constructRedeemEscrowRequestBody, constructRefundEscrowRequestBody, convertCodecToIGetRequest, convertCodecToIProof, convertIGetRequestToCodec, convertIProofToCodec, convertStateIdToStateMachineId, convertStateMachineEnumToString, convertStateMachineIdToEnum, createChain, createEvmChain, createIndexerClient, createQueryClient, decodeUserOpScale, encodeERC7821ExecuteBatch, encodeISMPMessage, encodeUserOpScale, encodeWithdrawalRequest, estimateGasForPost, fetchPrice, fetchSourceProof2 as fetchSourceProof, generateRootWithProof, getChain, getChainId, getConfigByStateMachineId, getContractCallInput, getEvmChain, getGasPriceFromEtherscan, getOrFetchStorageSlot, getOrderPlacedFromTx, getPostRequestEventFromTx, getPostResponseEventFromTx, getRequestCommitment, getStateCommitmentFieldSlot, getStateCommitmentSlot, getStorageSlot, getSubstrateChain, getViemChain, hexToString, hyperbridgeAddress, maxBigInt, orderCommitment, orderV2Commitment, parseStateMachineId, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, requestCommitmentKey, retryPromise, teleport, teleportDot, transformOrderForContract, tronChainIds, tronNile };
19320
+ export { ADDRESS_ZERO, BundlerMethod, ChainConfigService, Chains, DEFAULT_ADDRESS, DEFAULT_GRAFFITI, DOMAIN_TYPEHASH, DUMMY_PRIVATE_KEY, ERC20Method, ERC7821_BATCH_MODE, EvmChain, ABI as EvmHostABI, EvmLanguage, HyperClientStatus, IndexerClient, IntentGateway, ABI3 as IntentGatewayV2ABI, IntentOrderStatus, IntentsCoprocessor, IntentsV2, MOCK_ADDRESS, ORDER_V2_PARAM_TYPE, OrderStatus, OrderStatusChecker, PACKED_USEROP_TYPEHASH, PLACE_ORDER_SELECTOR, REQUEST_COMMITMENTS_SLOT, REQUEST_RECEIPTS_SLOT, RESPONSE_COMMITMENTS_SLOT, RESPONSE_RECEIPTS_SLOT, RequestKind, RequestStatus, SELECT_SOLVER_TYPEHASH, STATE_COMMITMENTS_SLOT, SubstrateChain, Swap, TESTNET_CHAINS, TeleportStatus, TimeoutStatus, TokenGateway, TronChain, USE_ETHERSCAN_CHAINS, __test, adjustDecimals, bytes20ToBytes32, bytes32ToBytes20, calculateAllowanceMappingLocation, calculateBalanceMappingLocation, chainConfigs, constructRedeemEscrowRequestBody, constructRefundEscrowRequestBody, convertCodecToIGetRequest, convertCodecToIProof, convertIGetRequestToCodec, convertIProofToCodec, convertStateIdToStateMachineId, convertStateMachineEnumToString, convertStateMachineIdToEnum, createChain, createEvmChain, createIndexerClient, createQueryClient, decodeUserOpScale, encodeERC7821ExecuteBatch, encodeISMPMessage, encodeUserOpScale, encodeWithdrawalRequest, estimateGasForPost, fetchPrice, fetchSourceProof2 as fetchSourceProof, generateRootWithProof, getChain, getChainId, getConfigByStateMachineId, getContractCallInput, getEvmChain, getGasPriceFromEtherscan, getOrFetchStorageSlot, getOrderPlacedFromTx, getPostRequestEventFromTx, getPostResponseEventFromTx, getRequestCommitment, getStateCommitmentFieldSlot, getStateCommitmentSlot, getStorageSlot, getSubstrateChain, getViemChain, hexToString, hyperbridgeAddress, maxBigInt, orderCommitment, orderV2Commitment, parseStateMachineId, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, requestCommitmentKey, retryPromise, teleport, teleportDot, transformOrderForContract, tronChainIds, tronNile };
17380
19321
  //# sourceMappingURL=index.js.map
17381
19322
  //# sourceMappingURL=index.js.map