@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.
@@ -3986,7 +3986,8 @@ var RequestKind = /* @__PURE__ */ ((RequestKind2) => {
3986
3986
  return RequestKind2;
3987
3987
  })(RequestKind || {});
3988
3988
  var IntentOrderStatus = Object.freeze({
3989
- ORDER_SUBMITTED: "ORDER_SUBMITTED",
3989
+ AWAITING_PLACE_ORDER: "AWAITING_PLACE_ORDER",
3990
+ ORDER_PLACED: "ORDER_PLACED",
3990
3991
  ORDER_CONFIRMED: "ORDER_CONFIRMED",
3991
3992
  AWAITING_BIDS: "AWAITING_BIDS",
3992
3993
  BIDS_RECEIVED: "BIDS_RECEIVED",
@@ -3994,948 +3995,2116 @@ var IntentOrderStatus = Object.freeze({
3994
3995
  USEROP_SUBMITTED: "USEROP_SUBMITTED",
3995
3996
  FILLED: "FILLED",
3996
3997
  PARTIAL_FILL: "PARTIAL_FILL",
3998
+ PARTIAL_FILL_EXHAUSTED: "PARTIAL_FILL_EXHAUSTED",
3997
3999
  FAILED: "FAILED"
3998
4000
  });
3999
4001
 
4000
4002
  // src/abis/IntentGatewayV2.ts
4001
4003
  var ABI3 = [
4002
4004
  {
4003
- type: "constructor",
4004
- inputs: [{ name: "admin", type: "address", internalType: "address" }],
4005
- stateMutability: "nonpayable"
4005
+ "type": "constructor",
4006
+ "inputs": [
4007
+ {
4008
+ "name": "admin",
4009
+ "type": "address",
4010
+ "internalType": "address"
4011
+ }
4012
+ ],
4013
+ "stateMutability": "nonpayable"
4006
4014
  },
4007
- { type: "receive", stateMutability: "payable" },
4008
4015
  {
4009
- type: "function",
4010
- name: "DOMAIN_SEPARATOR",
4011
- inputs: [],
4012
- outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
4013
- stateMutability: "view"
4016
+ "type": "receive",
4017
+ "stateMutability": "payable"
4014
4018
  },
4015
4019
  {
4016
- type: "function",
4017
- name: "SELECT_SOLVER_TYPEHASH",
4018
- inputs: [],
4019
- outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
4020
- stateMutability: "view"
4020
+ "type": "function",
4021
+ "name": "DOMAIN_SEPARATOR",
4022
+ "inputs": [],
4023
+ "outputs": [
4024
+ {
4025
+ "name": "",
4026
+ "type": "bytes32",
4027
+ "internalType": "bytes32"
4028
+ }
4029
+ ],
4030
+ "stateMutability": "view"
4021
4031
  },
4022
4032
  {
4023
- type: "function",
4024
- name: "_destinationProtocolFees",
4025
- inputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
4026
- outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
4027
- stateMutability: "view"
4033
+ "type": "function",
4034
+ "name": "SELECT_SOLVER_TYPEHASH",
4035
+ "inputs": [],
4036
+ "outputs": [
4037
+ {
4038
+ "name": "",
4039
+ "type": "bytes32",
4040
+ "internalType": "bytes32"
4041
+ }
4042
+ ],
4043
+ "stateMutability": "view"
4028
4044
  },
4029
4045
  {
4030
- type: "function",
4031
- name: "_filled",
4032
- inputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
4033
- outputs: [{ name: "", type: "address", internalType: "address" }],
4034
- stateMutability: "view"
4046
+ "type": "function",
4047
+ "name": "_destinationProtocolFees",
4048
+ "inputs": [
4049
+ {
4050
+ "name": "",
4051
+ "type": "bytes32",
4052
+ "internalType": "bytes32"
4053
+ }
4054
+ ],
4055
+ "outputs": [
4056
+ {
4057
+ "name": "",
4058
+ "type": "uint256",
4059
+ "internalType": "uint256"
4060
+ }
4061
+ ],
4062
+ "stateMutability": "view"
4035
4063
  },
4036
4064
  {
4037
- type: "function",
4038
- name: "_instances",
4039
- inputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
4040
- outputs: [{ name: "", type: "address", internalType: "address" }],
4041
- stateMutability: "view"
4065
+ "type": "function",
4066
+ "name": "_filled",
4067
+ "inputs": [
4068
+ {
4069
+ "name": "",
4070
+ "type": "bytes32",
4071
+ "internalType": "bytes32"
4072
+ }
4073
+ ],
4074
+ "outputs": [
4075
+ {
4076
+ "name": "",
4077
+ "type": "address",
4078
+ "internalType": "address"
4079
+ }
4080
+ ],
4081
+ "stateMutability": "view"
4042
4082
  },
4043
4083
  {
4044
- type: "function",
4045
- name: "_nonce",
4046
- inputs: [],
4047
- outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
4048
- stateMutability: "view"
4084
+ "type": "function",
4085
+ "name": "_instances",
4086
+ "inputs": [
4087
+ {
4088
+ "name": "",
4089
+ "type": "bytes32",
4090
+ "internalType": "bytes32"
4091
+ }
4092
+ ],
4093
+ "outputs": [
4094
+ {
4095
+ "name": "",
4096
+ "type": "address",
4097
+ "internalType": "address"
4098
+ }
4099
+ ],
4100
+ "stateMutability": "view"
4049
4101
  },
4050
4102
  {
4051
- type: "function",
4052
- name: "_orders",
4053
- inputs: [
4054
- { name: "", type: "bytes32", internalType: "bytes32" },
4055
- { name: "", type: "address", internalType: "address" }
4103
+ "type": "function",
4104
+ "name": "_nonce",
4105
+ "inputs": [],
4106
+ "outputs": [
4107
+ {
4108
+ "name": "",
4109
+ "type": "uint256",
4110
+ "internalType": "uint256"
4111
+ }
4056
4112
  ],
4057
- outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
4058
- stateMutability: "view"
4113
+ "stateMutability": "view"
4059
4114
  },
4060
4115
  {
4061
- type: "function",
4062
- name: "_partialFills",
4063
- inputs: [
4064
- { name: "", type: "bytes32", internalType: "bytes32" },
4065
- { name: "", type: "bytes32", internalType: "bytes32" }
4116
+ "type": "function",
4117
+ "name": "_orders",
4118
+ "inputs": [
4119
+ {
4120
+ "name": "",
4121
+ "type": "bytes32",
4122
+ "internalType": "bytes32"
4123
+ },
4124
+ {
4125
+ "name": "",
4126
+ "type": "address",
4127
+ "internalType": "address"
4128
+ }
4066
4129
  ],
4067
- outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
4068
- stateMutability: "view"
4130
+ "outputs": [
4131
+ {
4132
+ "name": "",
4133
+ "type": "uint256",
4134
+ "internalType": "uint256"
4135
+ }
4136
+ ],
4137
+ "stateMutability": "view"
4069
4138
  },
4070
4139
  {
4071
- type: "function",
4072
- name: "calculateCommitmentSlotHash",
4073
- inputs: [{ name: "commitment", type: "bytes32", internalType: "bytes32" }],
4074
- outputs: [{ name: "", type: "bytes", internalType: "bytes" }],
4075
- stateMutability: "pure"
4140
+ "type": "function",
4141
+ "name": "_partialFills",
4142
+ "inputs": [
4143
+ {
4144
+ "name": "",
4145
+ "type": "bytes32",
4146
+ "internalType": "bytes32"
4147
+ },
4148
+ {
4149
+ "name": "",
4150
+ "type": "bytes32",
4151
+ "internalType": "bytes32"
4152
+ }
4153
+ ],
4154
+ "outputs": [
4155
+ {
4156
+ "name": "",
4157
+ "type": "uint256",
4158
+ "internalType": "uint256"
4159
+ }
4160
+ ],
4161
+ "stateMutability": "view"
4076
4162
  },
4077
4163
  {
4078
- type: "function",
4079
- name: "cancelOrder",
4080
- inputs: [
4164
+ "type": "function",
4165
+ "name": "calculateCommitmentSlotHash",
4166
+ "inputs": [
4081
4167
  {
4082
- name: "order",
4083
- type: "tuple",
4084
- internalType: "struct Order",
4085
- components: [
4086
- { name: "user", type: "bytes32", internalType: "bytes32" },
4087
- { name: "source", type: "bytes", internalType: "bytes" },
4088
- { name: "destination", type: "bytes", internalType: "bytes" },
4089
- { name: "deadline", type: "uint256", internalType: "uint256" },
4090
- { name: "nonce", type: "uint256", internalType: "uint256" },
4091
- { name: "fees", type: "uint256", internalType: "uint256" },
4092
- { name: "session", type: "address", internalType: "address" },
4093
- {
4094
- name: "predispatch",
4095
- type: "tuple",
4096
- internalType: "struct DispatchInfo",
4097
- components: [
4168
+ "name": "commitment",
4169
+ "type": "bytes32",
4170
+ "internalType": "bytes32"
4171
+ }
4172
+ ],
4173
+ "outputs": [
4174
+ {
4175
+ "name": "",
4176
+ "type": "bytes",
4177
+ "internalType": "bytes"
4178
+ }
4179
+ ],
4180
+ "stateMutability": "pure"
4181
+ },
4182
+ {
4183
+ "type": "function",
4184
+ "name": "cancelOrder",
4185
+ "inputs": [
4186
+ {
4187
+ "name": "order",
4188
+ "type": "tuple",
4189
+ "internalType": "struct Order",
4190
+ "components": [
4191
+ {
4192
+ "name": "user",
4193
+ "type": "bytes32",
4194
+ "internalType": "bytes32"
4195
+ },
4196
+ {
4197
+ "name": "source",
4198
+ "type": "bytes",
4199
+ "internalType": "bytes"
4200
+ },
4201
+ {
4202
+ "name": "destination",
4203
+ "type": "bytes",
4204
+ "internalType": "bytes"
4205
+ },
4206
+ {
4207
+ "name": "deadline",
4208
+ "type": "uint256",
4209
+ "internalType": "uint256"
4210
+ },
4211
+ {
4212
+ "name": "nonce",
4213
+ "type": "uint256",
4214
+ "internalType": "uint256"
4215
+ },
4216
+ {
4217
+ "name": "fees",
4218
+ "type": "uint256",
4219
+ "internalType": "uint256"
4220
+ },
4221
+ {
4222
+ "name": "session",
4223
+ "type": "address",
4224
+ "internalType": "address"
4225
+ },
4226
+ {
4227
+ "name": "predispatch",
4228
+ "type": "tuple",
4229
+ "internalType": "struct DispatchInfo",
4230
+ "components": [
4098
4231
  {
4099
- name: "assets",
4100
- type: "tuple[]",
4101
- internalType: "struct TokenInfo[]",
4102
- components: [
4103
- { name: "token", type: "bytes32", internalType: "bytes32" },
4104
- { name: "amount", type: "uint256", internalType: "uint256" }
4232
+ "name": "assets",
4233
+ "type": "tuple[]",
4234
+ "internalType": "struct TokenInfo[]",
4235
+ "components": [
4236
+ {
4237
+ "name": "token",
4238
+ "type": "bytes32",
4239
+ "internalType": "bytes32"
4240
+ },
4241
+ {
4242
+ "name": "amount",
4243
+ "type": "uint256",
4244
+ "internalType": "uint256"
4245
+ }
4105
4246
  ]
4106
4247
  },
4107
- { name: "call", type: "bytes", internalType: "bytes" }
4248
+ {
4249
+ "name": "call",
4250
+ "type": "bytes",
4251
+ "internalType": "bytes"
4252
+ }
4108
4253
  ]
4109
4254
  },
4110
4255
  {
4111
- name: "inputs",
4112
- type: "tuple[]",
4113
- internalType: "struct TokenInfo[]",
4114
- components: [
4115
- { name: "token", type: "bytes32", internalType: "bytes32" },
4116
- { name: "amount", type: "uint256", internalType: "uint256" }
4256
+ "name": "inputs",
4257
+ "type": "tuple[]",
4258
+ "internalType": "struct TokenInfo[]",
4259
+ "components": [
4260
+ {
4261
+ "name": "token",
4262
+ "type": "bytes32",
4263
+ "internalType": "bytes32"
4264
+ },
4265
+ {
4266
+ "name": "amount",
4267
+ "type": "uint256",
4268
+ "internalType": "uint256"
4269
+ }
4117
4270
  ]
4118
4271
  },
4119
4272
  {
4120
- name: "output",
4121
- type: "tuple",
4122
- internalType: "struct PaymentInfo",
4123
- components: [
4124
- { name: "beneficiary", type: "bytes32", internalType: "bytes32" },
4273
+ "name": "output",
4274
+ "type": "tuple",
4275
+ "internalType": "struct PaymentInfo",
4276
+ "components": [
4125
4277
  {
4126
- name: "assets",
4127
- type: "tuple[]",
4128
- internalType: "struct TokenInfo[]",
4129
- components: [
4130
- { name: "token", type: "bytes32", internalType: "bytes32" },
4131
- { name: "amount", type: "uint256", internalType: "uint256" }
4278
+ "name": "beneficiary",
4279
+ "type": "bytes32",
4280
+ "internalType": "bytes32"
4281
+ },
4282
+ {
4283
+ "name": "assets",
4284
+ "type": "tuple[]",
4285
+ "internalType": "struct TokenInfo[]",
4286
+ "components": [
4287
+ {
4288
+ "name": "token",
4289
+ "type": "bytes32",
4290
+ "internalType": "bytes32"
4291
+ },
4292
+ {
4293
+ "name": "amount",
4294
+ "type": "uint256",
4295
+ "internalType": "uint256"
4296
+ }
4132
4297
  ]
4133
4298
  },
4134
- { name: "call", type: "bytes", internalType: "bytes" }
4299
+ {
4300
+ "name": "call",
4301
+ "type": "bytes",
4302
+ "internalType": "bytes"
4303
+ }
4135
4304
  ]
4136
4305
  }
4137
4306
  ]
4138
4307
  },
4139
4308
  {
4140
- name: "options",
4141
- type: "tuple",
4142
- internalType: "struct CancelOptions",
4143
- components: [
4144
- { name: "relayerFee", type: "uint256", internalType: "uint256" },
4145
- { name: "height", type: "uint256", internalType: "uint256" }
4309
+ "name": "options",
4310
+ "type": "tuple",
4311
+ "internalType": "struct CancelOptions",
4312
+ "components": [
4313
+ {
4314
+ "name": "relayerFee",
4315
+ "type": "uint256",
4316
+ "internalType": "uint256"
4317
+ },
4318
+ {
4319
+ "name": "height",
4320
+ "type": "uint256",
4321
+ "internalType": "uint256"
4322
+ }
4146
4323
  ]
4147
4324
  }
4148
4325
  ],
4149
- outputs: [],
4150
- stateMutability: "payable"
4326
+ "outputs": [],
4327
+ "stateMutability": "payable"
4151
4328
  },
4152
4329
  {
4153
- type: "function",
4154
- name: "eip712Domain",
4155
- inputs: [],
4156
- outputs: [
4157
- { name: "fields", type: "bytes1", internalType: "bytes1" },
4158
- { name: "name", type: "string", internalType: "string" },
4159
- { name: "version", type: "string", internalType: "string" },
4160
- { name: "chainId", type: "uint256", internalType: "uint256" },
4161
- { name: "verifyingContract", type: "address", internalType: "address" },
4162
- { name: "salt", type: "bytes32", internalType: "bytes32" },
4163
- { name: "extensions", type: "uint256[]", internalType: "uint256[]" }
4330
+ "type": "function",
4331
+ "name": "eip712Domain",
4332
+ "inputs": [],
4333
+ "outputs": [
4334
+ {
4335
+ "name": "fields",
4336
+ "type": "bytes1",
4337
+ "internalType": "bytes1"
4338
+ },
4339
+ {
4340
+ "name": "name",
4341
+ "type": "string",
4342
+ "internalType": "string"
4343
+ },
4344
+ {
4345
+ "name": "version",
4346
+ "type": "string",
4347
+ "internalType": "string"
4348
+ },
4349
+ {
4350
+ "name": "chainId",
4351
+ "type": "uint256",
4352
+ "internalType": "uint256"
4353
+ },
4354
+ {
4355
+ "name": "verifyingContract",
4356
+ "type": "address",
4357
+ "internalType": "address"
4358
+ },
4359
+ {
4360
+ "name": "salt",
4361
+ "type": "bytes32",
4362
+ "internalType": "bytes32"
4363
+ },
4364
+ {
4365
+ "name": "extensions",
4366
+ "type": "uint256[]",
4367
+ "internalType": "uint256[]"
4368
+ }
4164
4369
  ],
4165
- stateMutability: "view"
4370
+ "stateMutability": "view"
4166
4371
  },
4167
4372
  {
4168
- type: "function",
4169
- name: "fillOrder",
4170
- inputs: [
4373
+ "type": "function",
4374
+ "name": "fillOrder",
4375
+ "inputs": [
4171
4376
  {
4172
- name: "order",
4173
- type: "tuple",
4174
- internalType: "struct Order",
4175
- components: [
4176
- { name: "user", type: "bytes32", internalType: "bytes32" },
4177
- { name: "source", type: "bytes", internalType: "bytes" },
4178
- { name: "destination", type: "bytes", internalType: "bytes" },
4179
- { name: "deadline", type: "uint256", internalType: "uint256" },
4180
- { name: "nonce", type: "uint256", internalType: "uint256" },
4181
- { name: "fees", type: "uint256", internalType: "uint256" },
4182
- { name: "session", type: "address", internalType: "address" },
4183
- {
4184
- name: "predispatch",
4185
- type: "tuple",
4186
- internalType: "struct DispatchInfo",
4187
- components: [
4377
+ "name": "order",
4378
+ "type": "tuple",
4379
+ "internalType": "struct Order",
4380
+ "components": [
4381
+ {
4382
+ "name": "user",
4383
+ "type": "bytes32",
4384
+ "internalType": "bytes32"
4385
+ },
4386
+ {
4387
+ "name": "source",
4388
+ "type": "bytes",
4389
+ "internalType": "bytes"
4390
+ },
4391
+ {
4392
+ "name": "destination",
4393
+ "type": "bytes",
4394
+ "internalType": "bytes"
4395
+ },
4396
+ {
4397
+ "name": "deadline",
4398
+ "type": "uint256",
4399
+ "internalType": "uint256"
4400
+ },
4401
+ {
4402
+ "name": "nonce",
4403
+ "type": "uint256",
4404
+ "internalType": "uint256"
4405
+ },
4406
+ {
4407
+ "name": "fees",
4408
+ "type": "uint256",
4409
+ "internalType": "uint256"
4410
+ },
4411
+ {
4412
+ "name": "session",
4413
+ "type": "address",
4414
+ "internalType": "address"
4415
+ },
4416
+ {
4417
+ "name": "predispatch",
4418
+ "type": "tuple",
4419
+ "internalType": "struct DispatchInfo",
4420
+ "components": [
4188
4421
  {
4189
- name: "assets",
4190
- type: "tuple[]",
4191
- internalType: "struct TokenInfo[]",
4192
- components: [
4193
- { name: "token", type: "bytes32", internalType: "bytes32" },
4194
- { name: "amount", type: "uint256", internalType: "uint256" }
4422
+ "name": "assets",
4423
+ "type": "tuple[]",
4424
+ "internalType": "struct TokenInfo[]",
4425
+ "components": [
4426
+ {
4427
+ "name": "token",
4428
+ "type": "bytes32",
4429
+ "internalType": "bytes32"
4430
+ },
4431
+ {
4432
+ "name": "amount",
4433
+ "type": "uint256",
4434
+ "internalType": "uint256"
4435
+ }
4195
4436
  ]
4196
4437
  },
4197
- { name: "call", type: "bytes", internalType: "bytes" }
4438
+ {
4439
+ "name": "call",
4440
+ "type": "bytes",
4441
+ "internalType": "bytes"
4442
+ }
4198
4443
  ]
4199
4444
  },
4200
4445
  {
4201
- name: "inputs",
4202
- type: "tuple[]",
4203
- internalType: "struct TokenInfo[]",
4204
- components: [
4205
- { name: "token", type: "bytes32", internalType: "bytes32" },
4206
- { name: "amount", type: "uint256", internalType: "uint256" }
4446
+ "name": "inputs",
4447
+ "type": "tuple[]",
4448
+ "internalType": "struct TokenInfo[]",
4449
+ "components": [
4450
+ {
4451
+ "name": "token",
4452
+ "type": "bytes32",
4453
+ "internalType": "bytes32"
4454
+ },
4455
+ {
4456
+ "name": "amount",
4457
+ "type": "uint256",
4458
+ "internalType": "uint256"
4459
+ }
4207
4460
  ]
4208
4461
  },
4209
4462
  {
4210
- name: "output",
4211
- type: "tuple",
4212
- internalType: "struct PaymentInfo",
4213
- components: [
4214
- { name: "beneficiary", type: "bytes32", internalType: "bytes32" },
4463
+ "name": "output",
4464
+ "type": "tuple",
4465
+ "internalType": "struct PaymentInfo",
4466
+ "components": [
4215
4467
  {
4216
- name: "assets",
4217
- type: "tuple[]",
4218
- internalType: "struct TokenInfo[]",
4219
- components: [
4220
- { name: "token", type: "bytes32", internalType: "bytes32" },
4221
- { name: "amount", type: "uint256", internalType: "uint256" }
4468
+ "name": "beneficiary",
4469
+ "type": "bytes32",
4470
+ "internalType": "bytes32"
4471
+ },
4472
+ {
4473
+ "name": "assets",
4474
+ "type": "tuple[]",
4475
+ "internalType": "struct TokenInfo[]",
4476
+ "components": [
4477
+ {
4478
+ "name": "token",
4479
+ "type": "bytes32",
4480
+ "internalType": "bytes32"
4481
+ },
4482
+ {
4483
+ "name": "amount",
4484
+ "type": "uint256",
4485
+ "internalType": "uint256"
4486
+ }
4222
4487
  ]
4223
4488
  },
4224
- { name: "call", type: "bytes", internalType: "bytes" }
4489
+ {
4490
+ "name": "call",
4491
+ "type": "bytes",
4492
+ "internalType": "bytes"
4493
+ }
4225
4494
  ]
4226
4495
  }
4227
4496
  ]
4228
4497
  },
4229
4498
  {
4230
- name: "options",
4231
- type: "tuple",
4232
- internalType: "struct FillOptions",
4233
- components: [
4234
- { name: "relayerFee", type: "uint256", internalType: "uint256" },
4235
- { name: "nativeDispatchFee", type: "uint256", internalType: "uint256" },
4499
+ "name": "options",
4500
+ "type": "tuple",
4501
+ "internalType": "struct FillOptions",
4502
+ "components": [
4236
4503
  {
4237
- name: "outputs",
4238
- type: "tuple[]",
4239
- internalType: "struct TokenInfo[]",
4240
- components: [
4241
- { name: "token", type: "bytes32", internalType: "bytes32" },
4242
- { name: "amount", type: "uint256", internalType: "uint256" }
4504
+ "name": "relayerFee",
4505
+ "type": "uint256",
4506
+ "internalType": "uint256"
4507
+ },
4508
+ {
4509
+ "name": "nativeDispatchFee",
4510
+ "type": "uint256",
4511
+ "internalType": "uint256"
4512
+ },
4513
+ {
4514
+ "name": "outputs",
4515
+ "type": "tuple[]",
4516
+ "internalType": "struct TokenInfo[]",
4517
+ "components": [
4518
+ {
4519
+ "name": "token",
4520
+ "type": "bytes32",
4521
+ "internalType": "bytes32"
4522
+ },
4523
+ {
4524
+ "name": "amount",
4525
+ "type": "uint256",
4526
+ "internalType": "uint256"
4527
+ }
4243
4528
  ]
4244
4529
  }
4245
4530
  ]
4246
4531
  }
4247
4532
  ],
4248
- outputs: [],
4249
- stateMutability: "payable"
4533
+ "outputs": [],
4534
+ "stateMutability": "payable"
4250
4535
  },
4251
4536
  {
4252
- type: "function",
4253
- name: "host",
4254
- inputs: [],
4255
- outputs: [{ name: "", type: "address", internalType: "address" }],
4256
- stateMutability: "view"
4537
+ "type": "function",
4538
+ "name": "host",
4539
+ "inputs": [],
4540
+ "outputs": [
4541
+ {
4542
+ "name": "",
4543
+ "type": "address",
4544
+ "internalType": "address"
4545
+ }
4546
+ ],
4547
+ "stateMutability": "view"
4257
4548
  },
4258
4549
  {
4259
- type: "function",
4260
- name: "instance",
4261
- inputs: [{ name: "stateMachineId", type: "bytes", internalType: "bytes" }],
4262
- outputs: [{ name: "", type: "address", internalType: "address" }],
4263
- stateMutability: "view"
4550
+ "type": "function",
4551
+ "name": "instance",
4552
+ "inputs": [
4553
+ {
4554
+ "name": "stateMachineId",
4555
+ "type": "bytes",
4556
+ "internalType": "bytes"
4557
+ }
4558
+ ],
4559
+ "outputs": [
4560
+ {
4561
+ "name": "",
4562
+ "type": "address",
4563
+ "internalType": "address"
4564
+ }
4565
+ ],
4566
+ "stateMutability": "view"
4264
4567
  },
4265
4568
  {
4266
- type: "function",
4267
- name: "onAccept",
4268
- inputs: [
4569
+ "type": "function",
4570
+ "name": "onAccept",
4571
+ "inputs": [
4269
4572
  {
4270
- name: "incoming",
4271
- type: "tuple",
4272
- internalType: "struct IncomingPostRequest",
4273
- components: [
4573
+ "name": "incoming",
4574
+ "type": "tuple",
4575
+ "internalType": "struct IncomingPostRequest",
4576
+ "components": [
4274
4577
  {
4275
- name: "request",
4276
- type: "tuple",
4277
- internalType: "struct PostRequest",
4278
- components: [
4279
- { name: "source", type: "bytes", internalType: "bytes" },
4280
- { name: "dest", type: "bytes", internalType: "bytes" },
4281
- { name: "nonce", type: "uint64", internalType: "uint64" },
4282
- { name: "from", type: "bytes", internalType: "bytes" },
4283
- { name: "to", type: "bytes", internalType: "bytes" },
4284
- { name: "timeoutTimestamp", type: "uint64", internalType: "uint64" },
4285
- { name: "body", type: "bytes", internalType: "bytes" }
4286
- ]
4287
- },
4288
- { name: "relayer", type: "address", internalType: "address" }
4289
- ]
4578
+ "name": "request",
4579
+ "type": "tuple",
4580
+ "internalType": "struct PostRequest",
4581
+ "components": [
4582
+ {
4583
+ "name": "source",
4584
+ "type": "bytes",
4585
+ "internalType": "bytes"
4586
+ },
4587
+ {
4588
+ "name": "dest",
4589
+ "type": "bytes",
4590
+ "internalType": "bytes"
4591
+ },
4592
+ {
4593
+ "name": "nonce",
4594
+ "type": "uint64",
4595
+ "internalType": "uint64"
4596
+ },
4597
+ {
4598
+ "name": "from",
4599
+ "type": "bytes",
4600
+ "internalType": "bytes"
4601
+ },
4602
+ {
4603
+ "name": "to",
4604
+ "type": "bytes",
4605
+ "internalType": "bytes"
4606
+ },
4607
+ {
4608
+ "name": "timeoutTimestamp",
4609
+ "type": "uint64",
4610
+ "internalType": "uint64"
4611
+ },
4612
+ {
4613
+ "name": "body",
4614
+ "type": "bytes",
4615
+ "internalType": "bytes"
4616
+ }
4617
+ ]
4618
+ },
4619
+ {
4620
+ "name": "relayer",
4621
+ "type": "address",
4622
+ "internalType": "address"
4623
+ }
4624
+ ]
4290
4625
  }
4291
4626
  ],
4292
- outputs: [],
4293
- stateMutability: "nonpayable"
4627
+ "outputs": [],
4628
+ "stateMutability": "nonpayable"
4294
4629
  },
4295
4630
  {
4296
- type: "function",
4297
- name: "onGetResponse",
4298
- inputs: [
4631
+ "type": "function",
4632
+ "name": "onGetResponse",
4633
+ "inputs": [
4299
4634
  {
4300
- name: "incoming",
4301
- type: "tuple",
4302
- internalType: "struct IncomingGetResponse",
4303
- components: [
4635
+ "name": "incoming",
4636
+ "type": "tuple",
4637
+ "internalType": "struct IncomingGetResponse",
4638
+ "components": [
4304
4639
  {
4305
- name: "response",
4306
- type: "tuple",
4307
- internalType: "struct GetResponse",
4308
- components: [
4640
+ "name": "response",
4641
+ "type": "tuple",
4642
+ "internalType": "struct GetResponse",
4643
+ "components": [
4309
4644
  {
4310
- name: "request",
4311
- type: "tuple",
4312
- internalType: "struct GetRequest",
4313
- components: [
4314
- { name: "source", type: "bytes", internalType: "bytes" },
4315
- { name: "dest", type: "bytes", internalType: "bytes" },
4316
- { name: "nonce", type: "uint64", internalType: "uint64" },
4317
- { name: "from", type: "address", internalType: "address" },
4318
- { name: "timeoutTimestamp", type: "uint64", internalType: "uint64" },
4319
- { name: "keys", type: "bytes[]", internalType: "bytes[]" },
4320
- { name: "height", type: "uint64", internalType: "uint64" },
4321
- { name: "context", type: "bytes", internalType: "bytes" }
4645
+ "name": "request",
4646
+ "type": "tuple",
4647
+ "internalType": "struct GetRequest",
4648
+ "components": [
4649
+ {
4650
+ "name": "source",
4651
+ "type": "bytes",
4652
+ "internalType": "bytes"
4653
+ },
4654
+ {
4655
+ "name": "dest",
4656
+ "type": "bytes",
4657
+ "internalType": "bytes"
4658
+ },
4659
+ {
4660
+ "name": "nonce",
4661
+ "type": "uint64",
4662
+ "internalType": "uint64"
4663
+ },
4664
+ {
4665
+ "name": "from",
4666
+ "type": "address",
4667
+ "internalType": "address"
4668
+ },
4669
+ {
4670
+ "name": "timeoutTimestamp",
4671
+ "type": "uint64",
4672
+ "internalType": "uint64"
4673
+ },
4674
+ {
4675
+ "name": "keys",
4676
+ "type": "bytes[]",
4677
+ "internalType": "bytes[]"
4678
+ },
4679
+ {
4680
+ "name": "height",
4681
+ "type": "uint64",
4682
+ "internalType": "uint64"
4683
+ },
4684
+ {
4685
+ "name": "context",
4686
+ "type": "bytes",
4687
+ "internalType": "bytes"
4688
+ }
4322
4689
  ]
4323
4690
  },
4324
4691
  {
4325
- name: "values",
4326
- type: "tuple[]",
4327
- internalType: "struct StorageValue[]",
4328
- components: [
4329
- { name: "key", type: "bytes", internalType: "bytes" },
4330
- { name: "value", type: "bytes", internalType: "bytes" }
4692
+ "name": "values",
4693
+ "type": "tuple[]",
4694
+ "internalType": "struct StorageValue[]",
4695
+ "components": [
4696
+ {
4697
+ "name": "key",
4698
+ "type": "bytes",
4699
+ "internalType": "bytes"
4700
+ },
4701
+ {
4702
+ "name": "value",
4703
+ "type": "bytes",
4704
+ "internalType": "bytes"
4705
+ }
4331
4706
  ]
4332
4707
  }
4333
4708
  ]
4334
4709
  },
4335
- { name: "relayer", type: "address", internalType: "address" }
4710
+ {
4711
+ "name": "relayer",
4712
+ "type": "address",
4713
+ "internalType": "address"
4714
+ }
4336
4715
  ]
4337
4716
  }
4338
4717
  ],
4339
- outputs: [],
4340
- stateMutability: "nonpayable"
4718
+ "outputs": [],
4719
+ "stateMutability": "nonpayable"
4341
4720
  },
4342
4721
  {
4343
- type: "function",
4344
- name: "onGetTimeout",
4345
- inputs: [
4722
+ "type": "function",
4723
+ "name": "onGetTimeout",
4724
+ "inputs": [
4346
4725
  {
4347
- name: "",
4348
- type: "tuple",
4349
- internalType: "struct GetRequest",
4350
- components: [
4351
- { name: "source", type: "bytes", internalType: "bytes" },
4352
- { name: "dest", type: "bytes", internalType: "bytes" },
4353
- { name: "nonce", type: "uint64", internalType: "uint64" },
4354
- { name: "from", type: "address", internalType: "address" },
4355
- { name: "timeoutTimestamp", type: "uint64", internalType: "uint64" },
4356
- { name: "keys", type: "bytes[]", internalType: "bytes[]" },
4357
- { name: "height", type: "uint64", internalType: "uint64" },
4358
- { name: "context", type: "bytes", internalType: "bytes" }
4726
+ "name": "",
4727
+ "type": "tuple",
4728
+ "internalType": "struct GetRequest",
4729
+ "components": [
4730
+ {
4731
+ "name": "source",
4732
+ "type": "bytes",
4733
+ "internalType": "bytes"
4734
+ },
4735
+ {
4736
+ "name": "dest",
4737
+ "type": "bytes",
4738
+ "internalType": "bytes"
4739
+ },
4740
+ {
4741
+ "name": "nonce",
4742
+ "type": "uint64",
4743
+ "internalType": "uint64"
4744
+ },
4745
+ {
4746
+ "name": "from",
4747
+ "type": "address",
4748
+ "internalType": "address"
4749
+ },
4750
+ {
4751
+ "name": "timeoutTimestamp",
4752
+ "type": "uint64",
4753
+ "internalType": "uint64"
4754
+ },
4755
+ {
4756
+ "name": "keys",
4757
+ "type": "bytes[]",
4758
+ "internalType": "bytes[]"
4759
+ },
4760
+ {
4761
+ "name": "height",
4762
+ "type": "uint64",
4763
+ "internalType": "uint64"
4764
+ },
4765
+ {
4766
+ "name": "context",
4767
+ "type": "bytes",
4768
+ "internalType": "bytes"
4769
+ }
4359
4770
  ]
4360
4771
  }
4361
4772
  ],
4362
- outputs: [],
4363
- stateMutability: "nonpayable"
4773
+ "outputs": [],
4774
+ "stateMutability": "nonpayable"
4364
4775
  },
4365
4776
  {
4366
- type: "function",
4367
- name: "onPostRequestTimeout",
4368
- inputs: [
4777
+ "type": "function",
4778
+ "name": "onPostRequestTimeout",
4779
+ "inputs": [
4369
4780
  {
4370
- name: "",
4371
- type: "tuple",
4372
- internalType: "struct PostRequest",
4373
- components: [
4374
- { name: "source", type: "bytes", internalType: "bytes" },
4375
- { name: "dest", type: "bytes", internalType: "bytes" },
4376
- { name: "nonce", type: "uint64", internalType: "uint64" },
4377
- { name: "from", type: "bytes", internalType: "bytes" },
4378
- { name: "to", type: "bytes", internalType: "bytes" },
4379
- { name: "timeoutTimestamp", type: "uint64", internalType: "uint64" },
4380
- { name: "body", type: "bytes", internalType: "bytes" }
4781
+ "name": "",
4782
+ "type": "tuple",
4783
+ "internalType": "struct PostRequest",
4784
+ "components": [
4785
+ {
4786
+ "name": "source",
4787
+ "type": "bytes",
4788
+ "internalType": "bytes"
4789
+ },
4790
+ {
4791
+ "name": "dest",
4792
+ "type": "bytes",
4793
+ "internalType": "bytes"
4794
+ },
4795
+ {
4796
+ "name": "nonce",
4797
+ "type": "uint64",
4798
+ "internalType": "uint64"
4799
+ },
4800
+ {
4801
+ "name": "from",
4802
+ "type": "bytes",
4803
+ "internalType": "bytes"
4804
+ },
4805
+ {
4806
+ "name": "to",
4807
+ "type": "bytes",
4808
+ "internalType": "bytes"
4809
+ },
4810
+ {
4811
+ "name": "timeoutTimestamp",
4812
+ "type": "uint64",
4813
+ "internalType": "uint64"
4814
+ },
4815
+ {
4816
+ "name": "body",
4817
+ "type": "bytes",
4818
+ "internalType": "bytes"
4819
+ }
4381
4820
  ]
4382
4821
  }
4383
4822
  ],
4384
- outputs: [],
4385
- stateMutability: "nonpayable"
4823
+ "outputs": [],
4824
+ "stateMutability": "nonpayable"
4386
4825
  },
4387
4826
  {
4388
- type: "function",
4389
- name: "onPostResponse",
4390
- inputs: [
4827
+ "type": "function",
4828
+ "name": "onPostResponse",
4829
+ "inputs": [
4391
4830
  {
4392
- name: "",
4393
- type: "tuple",
4394
- internalType: "struct IncomingPostResponse",
4395
- components: [
4831
+ "name": "",
4832
+ "type": "tuple",
4833
+ "internalType": "struct IncomingPostResponse",
4834
+ "components": [
4396
4835
  {
4397
- name: "response",
4398
- type: "tuple",
4399
- internalType: "struct PostResponse",
4400
- components: [
4836
+ "name": "response",
4837
+ "type": "tuple",
4838
+ "internalType": "struct PostResponse",
4839
+ "components": [
4401
4840
  {
4402
- name: "request",
4403
- type: "tuple",
4404
- internalType: "struct PostRequest",
4405
- components: [
4406
- { name: "source", type: "bytes", internalType: "bytes" },
4407
- { name: "dest", type: "bytes", internalType: "bytes" },
4408
- { name: "nonce", type: "uint64", internalType: "uint64" },
4409
- { name: "from", type: "bytes", internalType: "bytes" },
4410
- { name: "to", type: "bytes", internalType: "bytes" },
4411
- { name: "timeoutTimestamp", type: "uint64", internalType: "uint64" },
4412
- { name: "body", type: "bytes", internalType: "bytes" }
4841
+ "name": "request",
4842
+ "type": "tuple",
4843
+ "internalType": "struct PostRequest",
4844
+ "components": [
4845
+ {
4846
+ "name": "source",
4847
+ "type": "bytes",
4848
+ "internalType": "bytes"
4849
+ },
4850
+ {
4851
+ "name": "dest",
4852
+ "type": "bytes",
4853
+ "internalType": "bytes"
4854
+ },
4855
+ {
4856
+ "name": "nonce",
4857
+ "type": "uint64",
4858
+ "internalType": "uint64"
4859
+ },
4860
+ {
4861
+ "name": "from",
4862
+ "type": "bytes",
4863
+ "internalType": "bytes"
4864
+ },
4865
+ {
4866
+ "name": "to",
4867
+ "type": "bytes",
4868
+ "internalType": "bytes"
4869
+ },
4870
+ {
4871
+ "name": "timeoutTimestamp",
4872
+ "type": "uint64",
4873
+ "internalType": "uint64"
4874
+ },
4875
+ {
4876
+ "name": "body",
4877
+ "type": "bytes",
4878
+ "internalType": "bytes"
4879
+ }
4413
4880
  ]
4414
4881
  },
4415
- { name: "response", type: "bytes", internalType: "bytes" },
4416
- { name: "timeoutTimestamp", type: "uint64", internalType: "uint64" }
4882
+ {
4883
+ "name": "response",
4884
+ "type": "bytes",
4885
+ "internalType": "bytes"
4886
+ },
4887
+ {
4888
+ "name": "timeoutTimestamp",
4889
+ "type": "uint64",
4890
+ "internalType": "uint64"
4891
+ }
4417
4892
  ]
4418
4893
  },
4419
- { name: "relayer", type: "address", internalType: "address" }
4894
+ {
4895
+ "name": "relayer",
4896
+ "type": "address",
4897
+ "internalType": "address"
4898
+ }
4420
4899
  ]
4421
4900
  }
4422
4901
  ],
4423
- outputs: [],
4424
- stateMutability: "nonpayable"
4902
+ "outputs": [],
4903
+ "stateMutability": "nonpayable"
4425
4904
  },
4426
4905
  {
4427
- type: "function",
4428
- name: "onPostResponseTimeout",
4429
- inputs: [
4906
+ "type": "function",
4907
+ "name": "onPostResponseTimeout",
4908
+ "inputs": [
4430
4909
  {
4431
- name: "",
4432
- type: "tuple",
4433
- internalType: "struct PostResponse",
4434
- components: [
4910
+ "name": "",
4911
+ "type": "tuple",
4912
+ "internalType": "struct PostResponse",
4913
+ "components": [
4435
4914
  {
4436
- name: "request",
4437
- type: "tuple",
4438
- internalType: "struct PostRequest",
4439
- components: [
4440
- { name: "source", type: "bytes", internalType: "bytes" },
4441
- { name: "dest", type: "bytes", internalType: "bytes" },
4442
- { name: "nonce", type: "uint64", internalType: "uint64" },
4443
- { name: "from", type: "bytes", internalType: "bytes" },
4444
- { name: "to", type: "bytes", internalType: "bytes" },
4445
- { name: "timeoutTimestamp", type: "uint64", internalType: "uint64" },
4446
- { name: "body", type: "bytes", internalType: "bytes" }
4915
+ "name": "request",
4916
+ "type": "tuple",
4917
+ "internalType": "struct PostRequest",
4918
+ "components": [
4919
+ {
4920
+ "name": "source",
4921
+ "type": "bytes",
4922
+ "internalType": "bytes"
4923
+ },
4924
+ {
4925
+ "name": "dest",
4926
+ "type": "bytes",
4927
+ "internalType": "bytes"
4928
+ },
4929
+ {
4930
+ "name": "nonce",
4931
+ "type": "uint64",
4932
+ "internalType": "uint64"
4933
+ },
4934
+ {
4935
+ "name": "from",
4936
+ "type": "bytes",
4937
+ "internalType": "bytes"
4938
+ },
4939
+ {
4940
+ "name": "to",
4941
+ "type": "bytes",
4942
+ "internalType": "bytes"
4943
+ },
4944
+ {
4945
+ "name": "timeoutTimestamp",
4946
+ "type": "uint64",
4947
+ "internalType": "uint64"
4948
+ },
4949
+ {
4950
+ "name": "body",
4951
+ "type": "bytes",
4952
+ "internalType": "bytes"
4953
+ }
4447
4954
  ]
4448
4955
  },
4449
- { name: "response", type: "bytes", internalType: "bytes" },
4450
- { name: "timeoutTimestamp", type: "uint64", internalType: "uint64" }
4956
+ {
4957
+ "name": "response",
4958
+ "type": "bytes",
4959
+ "internalType": "bytes"
4960
+ },
4961
+ {
4962
+ "name": "timeoutTimestamp",
4963
+ "type": "uint64",
4964
+ "internalType": "uint64"
4965
+ }
4451
4966
  ]
4452
4967
  }
4453
4968
  ],
4454
- outputs: [],
4455
- stateMutability: "nonpayable"
4969
+ "outputs": [],
4970
+ "stateMutability": "nonpayable"
4456
4971
  },
4457
4972
  {
4458
- type: "function",
4459
- name: "params",
4460
- inputs: [],
4461
- outputs: [
4973
+ "type": "function",
4974
+ "name": "params",
4975
+ "inputs": [],
4976
+ "outputs": [
4462
4977
  {
4463
- name: "",
4464
- type: "tuple",
4465
- internalType: "struct Params",
4466
- components: [
4467
- { name: "host", type: "address", internalType: "address" },
4468
- { name: "dispatcher", type: "address", internalType: "address" },
4469
- { name: "solverSelection", type: "bool", internalType: "bool" },
4470
- { name: "surplusShareBps", type: "uint256", internalType: "uint256" },
4471
- { name: "protocolFeeBps", type: "uint256", internalType: "uint256" },
4472
- { name: "priceOracle", type: "address", internalType: "address" }
4978
+ "name": "",
4979
+ "type": "tuple",
4980
+ "internalType": "struct Params",
4981
+ "components": [
4982
+ {
4983
+ "name": "host",
4984
+ "type": "address",
4985
+ "internalType": "address"
4986
+ },
4987
+ {
4988
+ "name": "dispatcher",
4989
+ "type": "address",
4990
+ "internalType": "address"
4991
+ },
4992
+ {
4993
+ "name": "solverSelection",
4994
+ "type": "bool",
4995
+ "internalType": "bool"
4996
+ },
4997
+ {
4998
+ "name": "surplusShareBps",
4999
+ "type": "uint256",
5000
+ "internalType": "uint256"
5001
+ },
5002
+ {
5003
+ "name": "protocolFeeBps",
5004
+ "type": "uint256",
5005
+ "internalType": "uint256"
5006
+ },
5007
+ {
5008
+ "name": "priceOracle",
5009
+ "type": "address",
5010
+ "internalType": "address"
5011
+ }
4473
5012
  ]
4474
5013
  }
4475
5014
  ],
4476
- stateMutability: "view"
5015
+ "stateMutability": "view"
4477
5016
  },
4478
5017
  {
4479
- type: "function",
4480
- name: "placeOrder",
4481
- inputs: [
5018
+ "type": "function",
5019
+ "name": "placeOrder",
5020
+ "inputs": [
4482
5021
  {
4483
- name: "order",
4484
- type: "tuple",
4485
- internalType: "struct Order",
4486
- components: [
4487
- { name: "user", type: "bytes32", internalType: "bytes32" },
4488
- { name: "source", type: "bytes", internalType: "bytes" },
4489
- { name: "destination", type: "bytes", internalType: "bytes" },
4490
- { name: "deadline", type: "uint256", internalType: "uint256" },
4491
- { name: "nonce", type: "uint256", internalType: "uint256" },
4492
- { name: "fees", type: "uint256", internalType: "uint256" },
4493
- { name: "session", type: "address", internalType: "address" },
4494
- {
4495
- name: "predispatch",
4496
- type: "tuple",
4497
- internalType: "struct DispatchInfo",
4498
- components: [
5022
+ "name": "order",
5023
+ "type": "tuple",
5024
+ "internalType": "struct Order",
5025
+ "components": [
5026
+ {
5027
+ "name": "user",
5028
+ "type": "bytes32",
5029
+ "internalType": "bytes32"
5030
+ },
5031
+ {
5032
+ "name": "source",
5033
+ "type": "bytes",
5034
+ "internalType": "bytes"
5035
+ },
5036
+ {
5037
+ "name": "destination",
5038
+ "type": "bytes",
5039
+ "internalType": "bytes"
5040
+ },
5041
+ {
5042
+ "name": "deadline",
5043
+ "type": "uint256",
5044
+ "internalType": "uint256"
5045
+ },
5046
+ {
5047
+ "name": "nonce",
5048
+ "type": "uint256",
5049
+ "internalType": "uint256"
5050
+ },
5051
+ {
5052
+ "name": "fees",
5053
+ "type": "uint256",
5054
+ "internalType": "uint256"
5055
+ },
5056
+ {
5057
+ "name": "session",
5058
+ "type": "address",
5059
+ "internalType": "address"
5060
+ },
5061
+ {
5062
+ "name": "predispatch",
5063
+ "type": "tuple",
5064
+ "internalType": "struct DispatchInfo",
5065
+ "components": [
4499
5066
  {
4500
- name: "assets",
4501
- type: "tuple[]",
4502
- internalType: "struct TokenInfo[]",
4503
- components: [
4504
- { name: "token", type: "bytes32", internalType: "bytes32" },
4505
- { name: "amount", type: "uint256", internalType: "uint256" }
5067
+ "name": "assets",
5068
+ "type": "tuple[]",
5069
+ "internalType": "struct TokenInfo[]",
5070
+ "components": [
5071
+ {
5072
+ "name": "token",
5073
+ "type": "bytes32",
5074
+ "internalType": "bytes32"
5075
+ },
5076
+ {
5077
+ "name": "amount",
5078
+ "type": "uint256",
5079
+ "internalType": "uint256"
5080
+ }
4506
5081
  ]
4507
5082
  },
4508
- { name: "call", type: "bytes", internalType: "bytes" }
5083
+ {
5084
+ "name": "call",
5085
+ "type": "bytes",
5086
+ "internalType": "bytes"
5087
+ }
4509
5088
  ]
4510
5089
  },
4511
5090
  {
4512
- name: "inputs",
4513
- type: "tuple[]",
4514
- internalType: "struct TokenInfo[]",
4515
- components: [
4516
- { name: "token", type: "bytes32", internalType: "bytes32" },
4517
- { name: "amount", type: "uint256", internalType: "uint256" }
5091
+ "name": "inputs",
5092
+ "type": "tuple[]",
5093
+ "internalType": "struct TokenInfo[]",
5094
+ "components": [
5095
+ {
5096
+ "name": "token",
5097
+ "type": "bytes32",
5098
+ "internalType": "bytes32"
5099
+ },
5100
+ {
5101
+ "name": "amount",
5102
+ "type": "uint256",
5103
+ "internalType": "uint256"
5104
+ }
4518
5105
  ]
4519
5106
  },
4520
5107
  {
4521
- name: "output",
4522
- type: "tuple",
4523
- internalType: "struct PaymentInfo",
4524
- components: [
4525
- { name: "beneficiary", type: "bytes32", internalType: "bytes32" },
5108
+ "name": "output",
5109
+ "type": "tuple",
5110
+ "internalType": "struct PaymentInfo",
5111
+ "components": [
4526
5112
  {
4527
- name: "assets",
4528
- type: "tuple[]",
4529
- internalType: "struct TokenInfo[]",
4530
- components: [
4531
- { name: "token", type: "bytes32", internalType: "bytes32" },
4532
- { name: "amount", type: "uint256", internalType: "uint256" }
5113
+ "name": "beneficiary",
5114
+ "type": "bytes32",
5115
+ "internalType": "bytes32"
5116
+ },
5117
+ {
5118
+ "name": "assets",
5119
+ "type": "tuple[]",
5120
+ "internalType": "struct TokenInfo[]",
5121
+ "components": [
5122
+ {
5123
+ "name": "token",
5124
+ "type": "bytes32",
5125
+ "internalType": "bytes32"
5126
+ },
5127
+ {
5128
+ "name": "amount",
5129
+ "type": "uint256",
5130
+ "internalType": "uint256"
5131
+ }
4533
5132
  ]
4534
5133
  },
4535
- { name: "call", type: "bytes", internalType: "bytes" }
5134
+ {
5135
+ "name": "call",
5136
+ "type": "bytes",
5137
+ "internalType": "bytes"
5138
+ }
4536
5139
  ]
4537
5140
  }
4538
5141
  ]
4539
5142
  },
4540
- { name: "graffiti", type: "bytes32", internalType: "bytes32" }
5143
+ {
5144
+ "name": "graffiti",
5145
+ "type": "bytes32",
5146
+ "internalType": "bytes32"
5147
+ }
4541
5148
  ],
4542
- outputs: [],
4543
- stateMutability: "payable"
5149
+ "outputs": [],
5150
+ "stateMutability": "payable"
4544
5151
  },
4545
5152
  {
4546
- type: "function",
4547
- name: "quote",
4548
- inputs: [
5153
+ "type": "function",
5154
+ "name": "quote",
5155
+ "inputs": [
4549
5156
  {
4550
- name: "request",
4551
- type: "tuple",
4552
- internalType: "struct DispatchPost",
4553
- components: [
4554
- { name: "dest", type: "bytes", internalType: "bytes" },
4555
- { name: "to", type: "bytes", internalType: "bytes" },
4556
- { name: "body", type: "bytes", internalType: "bytes" },
4557
- { name: "timeout", type: "uint64", internalType: "uint64" },
4558
- { name: "fee", type: "uint256", internalType: "uint256" },
4559
- { name: "payer", type: "address", internalType: "address" }
5157
+ "name": "request",
5158
+ "type": "tuple",
5159
+ "internalType": "struct DispatchPost",
5160
+ "components": [
5161
+ {
5162
+ "name": "dest",
5163
+ "type": "bytes",
5164
+ "internalType": "bytes"
5165
+ },
5166
+ {
5167
+ "name": "to",
5168
+ "type": "bytes",
5169
+ "internalType": "bytes"
5170
+ },
5171
+ {
5172
+ "name": "body",
5173
+ "type": "bytes",
5174
+ "internalType": "bytes"
5175
+ },
5176
+ {
5177
+ "name": "timeout",
5178
+ "type": "uint64",
5179
+ "internalType": "uint64"
5180
+ },
5181
+ {
5182
+ "name": "fee",
5183
+ "type": "uint256",
5184
+ "internalType": "uint256"
5185
+ },
5186
+ {
5187
+ "name": "payer",
5188
+ "type": "address",
5189
+ "internalType": "address"
5190
+ }
4560
5191
  ]
4561
5192
  }
4562
5193
  ],
4563
- outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
4564
- stateMutability: "view"
5194
+ "outputs": [
5195
+ {
5196
+ "name": "",
5197
+ "type": "uint256",
5198
+ "internalType": "uint256"
5199
+ }
5200
+ ],
5201
+ "stateMutability": "view"
4565
5202
  },
4566
5203
  {
4567
- type: "function",
4568
- name: "quote",
4569
- inputs: [
5204
+ "type": "function",
5205
+ "name": "quote",
5206
+ "inputs": [
4570
5207
  {
4571
- name: "request",
4572
- type: "tuple",
4573
- internalType: "struct DispatchGet",
4574
- components: [
4575
- { name: "dest", type: "bytes", internalType: "bytes" },
4576
- { name: "height", type: "uint64", internalType: "uint64" },
4577
- { name: "keys", type: "bytes[]", internalType: "bytes[]" },
4578
- { name: "timeout", type: "uint64", internalType: "uint64" },
4579
- { name: "fee", type: "uint256", internalType: "uint256" },
4580
- { name: "context", type: "bytes", internalType: "bytes" }
5208
+ "name": "request",
5209
+ "type": "tuple",
5210
+ "internalType": "struct DispatchGet",
5211
+ "components": [
5212
+ {
5213
+ "name": "dest",
5214
+ "type": "bytes",
5215
+ "internalType": "bytes"
5216
+ },
5217
+ {
5218
+ "name": "height",
5219
+ "type": "uint64",
5220
+ "internalType": "uint64"
5221
+ },
5222
+ {
5223
+ "name": "keys",
5224
+ "type": "bytes[]",
5225
+ "internalType": "bytes[]"
5226
+ },
5227
+ {
5228
+ "name": "timeout",
5229
+ "type": "uint64",
5230
+ "internalType": "uint64"
5231
+ },
5232
+ {
5233
+ "name": "fee",
5234
+ "type": "uint256",
5235
+ "internalType": "uint256"
5236
+ },
5237
+ {
5238
+ "name": "context",
5239
+ "type": "bytes",
5240
+ "internalType": "bytes"
5241
+ }
4581
5242
  ]
4582
5243
  }
4583
5244
  ],
4584
- outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
4585
- stateMutability: "view"
5245
+ "outputs": [
5246
+ {
5247
+ "name": "",
5248
+ "type": "uint256",
5249
+ "internalType": "uint256"
5250
+ }
5251
+ ],
5252
+ "stateMutability": "view"
4586
5253
  },
4587
5254
  {
4588
- type: "function",
4589
- name: "quote",
4590
- inputs: [
5255
+ "type": "function",
5256
+ "name": "quote",
5257
+ "inputs": [
4591
5258
  {
4592
- name: "response",
4593
- type: "tuple",
4594
- internalType: "struct DispatchPostResponse",
4595
- components: [
5259
+ "name": "response",
5260
+ "type": "tuple",
5261
+ "internalType": "struct DispatchPostResponse",
5262
+ "components": [
4596
5263
  {
4597
- name: "request",
4598
- type: "tuple",
4599
- internalType: "struct PostRequest",
4600
- components: [
4601
- { name: "source", type: "bytes", internalType: "bytes" },
4602
- { name: "dest", type: "bytes", internalType: "bytes" },
4603
- { name: "nonce", type: "uint64", internalType: "uint64" },
4604
- { name: "from", type: "bytes", internalType: "bytes" },
4605
- { name: "to", type: "bytes", internalType: "bytes" },
4606
- { name: "timeoutTimestamp", type: "uint64", internalType: "uint64" },
4607
- { name: "body", type: "bytes", internalType: "bytes" }
5264
+ "name": "request",
5265
+ "type": "tuple",
5266
+ "internalType": "struct PostRequest",
5267
+ "components": [
5268
+ {
5269
+ "name": "source",
5270
+ "type": "bytes",
5271
+ "internalType": "bytes"
5272
+ },
5273
+ {
5274
+ "name": "dest",
5275
+ "type": "bytes",
5276
+ "internalType": "bytes"
5277
+ },
5278
+ {
5279
+ "name": "nonce",
5280
+ "type": "uint64",
5281
+ "internalType": "uint64"
5282
+ },
5283
+ {
5284
+ "name": "from",
5285
+ "type": "bytes",
5286
+ "internalType": "bytes"
5287
+ },
5288
+ {
5289
+ "name": "to",
5290
+ "type": "bytes",
5291
+ "internalType": "bytes"
5292
+ },
5293
+ {
5294
+ "name": "timeoutTimestamp",
5295
+ "type": "uint64",
5296
+ "internalType": "uint64"
5297
+ },
5298
+ {
5299
+ "name": "body",
5300
+ "type": "bytes",
5301
+ "internalType": "bytes"
5302
+ }
4608
5303
  ]
4609
5304
  },
4610
- { name: "response", type: "bytes", internalType: "bytes" },
4611
- { name: "timeout", type: "uint64", internalType: "uint64" },
4612
- { name: "fee", type: "uint256", internalType: "uint256" },
4613
- { name: "payer", type: "address", internalType: "address" }
5305
+ {
5306
+ "name": "response",
5307
+ "type": "bytes",
5308
+ "internalType": "bytes"
5309
+ },
5310
+ {
5311
+ "name": "timeout",
5312
+ "type": "uint64",
5313
+ "internalType": "uint64"
5314
+ },
5315
+ {
5316
+ "name": "fee",
5317
+ "type": "uint256",
5318
+ "internalType": "uint256"
5319
+ },
5320
+ {
5321
+ "name": "payer",
5322
+ "type": "address",
5323
+ "internalType": "address"
5324
+ }
4614
5325
  ]
4615
5326
  }
4616
5327
  ],
4617
- outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
4618
- stateMutability: "view"
5328
+ "outputs": [
5329
+ {
5330
+ "name": "",
5331
+ "type": "uint256",
5332
+ "internalType": "uint256"
5333
+ }
5334
+ ],
5335
+ "stateMutability": "view"
4619
5336
  },
4620
5337
  {
4621
- type: "function",
4622
- name: "quoteNative",
4623
- inputs: [
5338
+ "type": "function",
5339
+ "name": "quoteNative",
5340
+ "inputs": [
4624
5341
  {
4625
- name: "request",
4626
- type: "tuple",
4627
- internalType: "struct DispatchPost",
4628
- components: [
4629
- { name: "dest", type: "bytes", internalType: "bytes" },
4630
- { name: "to", type: "bytes", internalType: "bytes" },
4631
- { name: "body", type: "bytes", internalType: "bytes" },
4632
- { name: "timeout", type: "uint64", internalType: "uint64" },
4633
- { name: "fee", type: "uint256", internalType: "uint256" },
4634
- { name: "payer", type: "address", internalType: "address" }
5342
+ "name": "request",
5343
+ "type": "tuple",
5344
+ "internalType": "struct DispatchPost",
5345
+ "components": [
5346
+ {
5347
+ "name": "dest",
5348
+ "type": "bytes",
5349
+ "internalType": "bytes"
5350
+ },
5351
+ {
5352
+ "name": "to",
5353
+ "type": "bytes",
5354
+ "internalType": "bytes"
5355
+ },
5356
+ {
5357
+ "name": "body",
5358
+ "type": "bytes",
5359
+ "internalType": "bytes"
5360
+ },
5361
+ {
5362
+ "name": "timeout",
5363
+ "type": "uint64",
5364
+ "internalType": "uint64"
5365
+ },
5366
+ {
5367
+ "name": "fee",
5368
+ "type": "uint256",
5369
+ "internalType": "uint256"
5370
+ },
5371
+ {
5372
+ "name": "payer",
5373
+ "type": "address",
5374
+ "internalType": "address"
5375
+ }
4635
5376
  ]
4636
5377
  }
4637
5378
  ],
4638
- outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
4639
- stateMutability: "view"
5379
+ "outputs": [
5380
+ {
5381
+ "name": "",
5382
+ "type": "uint256",
5383
+ "internalType": "uint256"
5384
+ }
5385
+ ],
5386
+ "stateMutability": "view"
4640
5387
  },
4641
5388
  {
4642
- type: "function",
4643
- name: "quoteNative",
4644
- inputs: [
5389
+ "type": "function",
5390
+ "name": "quoteNative",
5391
+ "inputs": [
4645
5392
  {
4646
- name: "request",
4647
- type: "tuple",
4648
- internalType: "struct DispatchPostResponse",
4649
- components: [
5393
+ "name": "request",
5394
+ "type": "tuple",
5395
+ "internalType": "struct DispatchPostResponse",
5396
+ "components": [
4650
5397
  {
4651
- name: "request",
4652
- type: "tuple",
4653
- internalType: "struct PostRequest",
4654
- components: [
4655
- { name: "source", type: "bytes", internalType: "bytes" },
4656
- { name: "dest", type: "bytes", internalType: "bytes" },
4657
- { name: "nonce", type: "uint64", internalType: "uint64" },
4658
- { name: "from", type: "bytes", internalType: "bytes" },
4659
- { name: "to", type: "bytes", internalType: "bytes" },
4660
- { name: "timeoutTimestamp", type: "uint64", internalType: "uint64" },
4661
- { name: "body", type: "bytes", internalType: "bytes" }
5398
+ "name": "request",
5399
+ "type": "tuple",
5400
+ "internalType": "struct PostRequest",
5401
+ "components": [
5402
+ {
5403
+ "name": "source",
5404
+ "type": "bytes",
5405
+ "internalType": "bytes"
5406
+ },
5407
+ {
5408
+ "name": "dest",
5409
+ "type": "bytes",
5410
+ "internalType": "bytes"
5411
+ },
5412
+ {
5413
+ "name": "nonce",
5414
+ "type": "uint64",
5415
+ "internalType": "uint64"
5416
+ },
5417
+ {
5418
+ "name": "from",
5419
+ "type": "bytes",
5420
+ "internalType": "bytes"
5421
+ },
5422
+ {
5423
+ "name": "to",
5424
+ "type": "bytes",
5425
+ "internalType": "bytes"
5426
+ },
5427
+ {
5428
+ "name": "timeoutTimestamp",
5429
+ "type": "uint64",
5430
+ "internalType": "uint64"
5431
+ },
5432
+ {
5433
+ "name": "body",
5434
+ "type": "bytes",
5435
+ "internalType": "bytes"
5436
+ }
4662
5437
  ]
4663
5438
  },
4664
- { name: "response", type: "bytes", internalType: "bytes" },
4665
- { name: "timeout", type: "uint64", internalType: "uint64" },
4666
- { name: "fee", type: "uint256", internalType: "uint256" },
4667
- { name: "payer", type: "address", internalType: "address" }
5439
+ {
5440
+ "name": "response",
5441
+ "type": "bytes",
5442
+ "internalType": "bytes"
5443
+ },
5444
+ {
5445
+ "name": "timeout",
5446
+ "type": "uint64",
5447
+ "internalType": "uint64"
5448
+ },
5449
+ {
5450
+ "name": "fee",
5451
+ "type": "uint256",
5452
+ "internalType": "uint256"
5453
+ },
5454
+ {
5455
+ "name": "payer",
5456
+ "type": "address",
5457
+ "internalType": "address"
5458
+ }
4668
5459
  ]
4669
5460
  }
4670
5461
  ],
4671
- outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
4672
- stateMutability: "view"
5462
+ "outputs": [
5463
+ {
5464
+ "name": "",
5465
+ "type": "uint256",
5466
+ "internalType": "uint256"
5467
+ }
5468
+ ],
5469
+ "stateMutability": "view"
4673
5470
  },
4674
5471
  {
4675
- type: "function",
4676
- name: "quoteNative",
4677
- inputs: [
5472
+ "type": "function",
5473
+ "name": "quoteNative",
5474
+ "inputs": [
4678
5475
  {
4679
- name: "request",
4680
- type: "tuple",
4681
- internalType: "struct DispatchGet",
4682
- components: [
4683
- { name: "dest", type: "bytes", internalType: "bytes" },
4684
- { name: "height", type: "uint64", internalType: "uint64" },
4685
- { name: "keys", type: "bytes[]", internalType: "bytes[]" },
4686
- { name: "timeout", type: "uint64", internalType: "uint64" },
4687
- { name: "fee", type: "uint256", internalType: "uint256" },
4688
- { name: "context", type: "bytes", internalType: "bytes" }
5476
+ "name": "request",
5477
+ "type": "tuple",
5478
+ "internalType": "struct DispatchGet",
5479
+ "components": [
5480
+ {
5481
+ "name": "dest",
5482
+ "type": "bytes",
5483
+ "internalType": "bytes"
5484
+ },
5485
+ {
5486
+ "name": "height",
5487
+ "type": "uint64",
5488
+ "internalType": "uint64"
5489
+ },
5490
+ {
5491
+ "name": "keys",
5492
+ "type": "bytes[]",
5493
+ "internalType": "bytes[]"
5494
+ },
5495
+ {
5496
+ "name": "timeout",
5497
+ "type": "uint64",
5498
+ "internalType": "uint64"
5499
+ },
5500
+ {
5501
+ "name": "fee",
5502
+ "type": "uint256",
5503
+ "internalType": "uint256"
5504
+ },
5505
+ {
5506
+ "name": "context",
5507
+ "type": "bytes",
5508
+ "internalType": "bytes"
5509
+ }
4689
5510
  ]
4690
5511
  }
4691
5512
  ],
4692
- outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
4693
- stateMutability: "view"
5513
+ "outputs": [
5514
+ {
5515
+ "name": "",
5516
+ "type": "uint256",
5517
+ "internalType": "uint256"
5518
+ }
5519
+ ],
5520
+ "stateMutability": "view"
4694
5521
  },
4695
5522
  {
4696
- type: "function",
4697
- name: "select",
4698
- inputs: [
5523
+ "type": "function",
5524
+ "name": "select",
5525
+ "inputs": [
4699
5526
  {
4700
- name: "options",
4701
- type: "tuple",
4702
- internalType: "struct SelectOptions",
4703
- components: [
4704
- { name: "commitment", type: "bytes32", internalType: "bytes32" },
4705
- { name: "solver", type: "address", internalType: "address" },
4706
- { name: "signature", type: "bytes", internalType: "bytes" }
5527
+ "name": "options",
5528
+ "type": "tuple",
5529
+ "internalType": "struct SelectOptions",
5530
+ "components": [
5531
+ {
5532
+ "name": "commitment",
5533
+ "type": "bytes32",
5534
+ "internalType": "bytes32"
5535
+ },
5536
+ {
5537
+ "name": "solver",
5538
+ "type": "address",
5539
+ "internalType": "address"
5540
+ },
5541
+ {
5542
+ "name": "signature",
5543
+ "type": "bytes",
5544
+ "internalType": "bytes"
5545
+ }
4707
5546
  ]
4708
5547
  }
4709
5548
  ],
4710
- outputs: [{ name: "", type: "address", internalType: "address" }],
4711
- stateMutability: "nonpayable"
5549
+ "outputs": [
5550
+ {
5551
+ "name": "",
5552
+ "type": "address",
5553
+ "internalType": "address"
5554
+ }
5555
+ ],
5556
+ "stateMutability": "nonpayable"
4712
5557
  },
4713
5558
  {
4714
- type: "function",
4715
- name: "setParams",
4716
- inputs: [
5559
+ "type": "function",
5560
+ "name": "setParams",
5561
+ "inputs": [
4717
5562
  {
4718
- name: "p",
4719
- type: "tuple",
4720
- internalType: "struct Params",
4721
- components: [
4722
- { name: "host", type: "address", internalType: "address" },
4723
- { name: "dispatcher", type: "address", internalType: "address" },
4724
- { name: "solverSelection", type: "bool", internalType: "bool" },
4725
- { name: "surplusShareBps", type: "uint256", internalType: "uint256" },
4726
- { name: "protocolFeeBps", type: "uint256", internalType: "uint256" },
4727
- { name: "priceOracle", type: "address", internalType: "address" }
5563
+ "name": "p",
5564
+ "type": "tuple",
5565
+ "internalType": "struct Params",
5566
+ "components": [
5567
+ {
5568
+ "name": "host",
5569
+ "type": "address",
5570
+ "internalType": "address"
5571
+ },
5572
+ {
5573
+ "name": "dispatcher",
5574
+ "type": "address",
5575
+ "internalType": "address"
5576
+ },
5577
+ {
5578
+ "name": "solverSelection",
5579
+ "type": "bool",
5580
+ "internalType": "bool"
5581
+ },
5582
+ {
5583
+ "name": "surplusShareBps",
5584
+ "type": "uint256",
5585
+ "internalType": "uint256"
5586
+ },
5587
+ {
5588
+ "name": "protocolFeeBps",
5589
+ "type": "uint256",
5590
+ "internalType": "uint256"
5591
+ },
5592
+ {
5593
+ "name": "priceOracle",
5594
+ "type": "address",
5595
+ "internalType": "address"
5596
+ }
4728
5597
  ]
4729
5598
  }
4730
5599
  ],
4731
- outputs: [],
4732
- stateMutability: "nonpayable"
5600
+ "outputs": [],
5601
+ "stateMutability": "nonpayable"
4733
5602
  },
4734
5603
  {
4735
- type: "event",
4736
- name: "DestinationProtocolFeeUpdated",
4737
- inputs: [
4738
- { name: "stateMachineId", type: "bytes32", indexed: true, internalType: "bytes32" },
4739
- { name: "feeBps", type: "uint256", indexed: false, internalType: "uint256" }
5604
+ "type": "event",
5605
+ "name": "DestinationProtocolFeeUpdated",
5606
+ "inputs": [
5607
+ {
5608
+ "name": "stateMachineId",
5609
+ "type": "bytes32",
5610
+ "indexed": true,
5611
+ "internalType": "bytes32"
5612
+ },
5613
+ {
5614
+ "name": "feeBps",
5615
+ "type": "uint256",
5616
+ "indexed": false,
5617
+ "internalType": "uint256"
5618
+ }
4740
5619
  ],
4741
- anonymous: false
5620
+ "anonymous": false
4742
5621
  },
4743
5622
  {
4744
- type: "event",
4745
- name: "DustCollected",
4746
- inputs: [
4747
- { name: "token", type: "address", indexed: false, internalType: "address" },
4748
- { name: "amount", type: "uint256", indexed: false, internalType: "uint256" }
5623
+ "type": "event",
5624
+ "name": "DustCollected",
5625
+ "inputs": [
5626
+ {
5627
+ "name": "token",
5628
+ "type": "address",
5629
+ "indexed": false,
5630
+ "internalType": "address"
5631
+ },
5632
+ {
5633
+ "name": "amount",
5634
+ "type": "uint256",
5635
+ "indexed": false,
5636
+ "internalType": "uint256"
5637
+ }
4749
5638
  ],
4750
- anonymous: false
5639
+ "anonymous": false
4751
5640
  },
4752
5641
  {
4753
- type: "event",
4754
- name: "DustSwept",
4755
- inputs: [
4756
- { name: "token", type: "address", indexed: false, internalType: "address" },
4757
- { name: "amount", type: "uint256", indexed: false, internalType: "uint256" },
4758
- { name: "beneficiary", type: "address", indexed: false, internalType: "address" }
5642
+ "type": "event",
5643
+ "name": "DustSwept",
5644
+ "inputs": [
5645
+ {
5646
+ "name": "token",
5647
+ "type": "address",
5648
+ "indexed": false,
5649
+ "internalType": "address"
5650
+ },
5651
+ {
5652
+ "name": "amount",
5653
+ "type": "uint256",
5654
+ "indexed": false,
5655
+ "internalType": "uint256"
5656
+ },
5657
+ {
5658
+ "name": "beneficiary",
5659
+ "type": "address",
5660
+ "indexed": false,
5661
+ "internalType": "address"
5662
+ }
4759
5663
  ],
4760
- anonymous: false
5664
+ "anonymous": false
4761
5665
  },
4762
- { type: "event", name: "EIP712DomainChanged", inputs: [], anonymous: false },
4763
5666
  {
4764
- type: "event",
4765
- name: "EscrowRefunded",
4766
- inputs: [{ name: "commitment", type: "bytes32", indexed: true, internalType: "bytes32" }],
4767
- anonymous: false
5667
+ "type": "event",
5668
+ "name": "EIP712DomainChanged",
5669
+ "inputs": [],
5670
+ "anonymous": false
4768
5671
  },
4769
5672
  {
4770
- type: "event",
4771
- name: "EscrowReleased",
4772
- inputs: [{ name: "commitment", type: "bytes32", indexed: true, internalType: "bytes32" }],
4773
- anonymous: false
5673
+ "type": "event",
5674
+ "name": "EscrowRefunded",
5675
+ "inputs": [
5676
+ {
5677
+ "name": "commitment",
5678
+ "type": "bytes32",
5679
+ "indexed": true,
5680
+ "internalType": "bytes32"
5681
+ }
5682
+ ],
5683
+ "anonymous": false
4774
5684
  },
4775
5685
  {
4776
- type: "event",
4777
- name: "NewDeploymentAdded",
4778
- inputs: [
4779
- { name: "stateMachineId", type: "bytes", indexed: false, internalType: "bytes" },
4780
- { name: "gateway", type: "address", indexed: false, internalType: "address" }
5686
+ "type": "event",
5687
+ "name": "EscrowReleased",
5688
+ "inputs": [
5689
+ {
5690
+ "name": "commitment",
5691
+ "type": "bytes32",
5692
+ "indexed": true,
5693
+ "internalType": "bytes32"
5694
+ }
4781
5695
  ],
4782
- anonymous: false
5696
+ "anonymous": false
4783
5697
  },
4784
5698
  {
4785
- type: "event",
4786
- name: "OrderFilled",
4787
- inputs: [
4788
- { name: "commitment", type: "bytes32", indexed: true, internalType: "bytes32" },
4789
- { name: "filler", type: "address", indexed: false, internalType: "address" }
5699
+ "type": "event",
5700
+ "name": "NewDeploymentAdded",
5701
+ "inputs": [
5702
+ {
5703
+ "name": "stateMachineId",
5704
+ "type": "bytes",
5705
+ "indexed": false,
5706
+ "internalType": "bytes"
5707
+ },
5708
+ {
5709
+ "name": "gateway",
5710
+ "type": "address",
5711
+ "indexed": false,
5712
+ "internalType": "address"
5713
+ }
4790
5714
  ],
4791
- anonymous: false
5715
+ "anonymous": false
4792
5716
  },
4793
5717
  {
4794
- type: "event",
4795
- name: "OrderPlaced",
4796
- inputs: [
4797
- { name: "user", type: "bytes32", indexed: false, internalType: "bytes32" },
4798
- { name: "source", type: "bytes", indexed: false, internalType: "bytes" },
4799
- { name: "destination", type: "bytes", indexed: false, internalType: "bytes" },
4800
- { name: "deadline", type: "uint256", indexed: false, internalType: "uint256" },
4801
- { name: "nonce", type: "uint256", indexed: false, internalType: "uint256" },
4802
- { name: "fees", type: "uint256", indexed: false, internalType: "uint256" },
4803
- { name: "session", type: "address", indexed: false, internalType: "address" },
4804
- { name: "beneficiary", type: "bytes32", indexed: false, internalType: "bytes32" },
4805
- {
4806
- name: "predispatch",
4807
- type: "tuple[]",
4808
- indexed: false,
4809
- internalType: "struct TokenInfo[]",
4810
- components: [
4811
- { name: "token", type: "bytes32", internalType: "bytes32" },
4812
- { name: "amount", type: "uint256", internalType: "uint256" }
5718
+ "type": "event",
5719
+ "name": "OrderFilled",
5720
+ "inputs": [
5721
+ {
5722
+ "name": "commitment",
5723
+ "type": "bytes32",
5724
+ "indexed": true,
5725
+ "internalType": "bytes32"
5726
+ },
5727
+ {
5728
+ "name": "filler",
5729
+ "type": "address",
5730
+ "indexed": false,
5731
+ "internalType": "address"
5732
+ }
5733
+ ],
5734
+ "anonymous": false
5735
+ },
5736
+ {
5737
+ "type": "event",
5738
+ "name": "OrderPlaced",
5739
+ "inputs": [
5740
+ {
5741
+ "name": "user",
5742
+ "type": "bytes32",
5743
+ "indexed": false,
5744
+ "internalType": "bytes32"
5745
+ },
5746
+ {
5747
+ "name": "source",
5748
+ "type": "bytes",
5749
+ "indexed": false,
5750
+ "internalType": "bytes"
5751
+ },
5752
+ {
5753
+ "name": "destination",
5754
+ "type": "bytes",
5755
+ "indexed": false,
5756
+ "internalType": "bytes"
5757
+ },
5758
+ {
5759
+ "name": "deadline",
5760
+ "type": "uint256",
5761
+ "indexed": false,
5762
+ "internalType": "uint256"
5763
+ },
5764
+ {
5765
+ "name": "nonce",
5766
+ "type": "uint256",
5767
+ "indexed": false,
5768
+ "internalType": "uint256"
5769
+ },
5770
+ {
5771
+ "name": "fees",
5772
+ "type": "uint256",
5773
+ "indexed": false,
5774
+ "internalType": "uint256"
5775
+ },
5776
+ {
5777
+ "name": "session",
5778
+ "type": "address",
5779
+ "indexed": false,
5780
+ "internalType": "address"
5781
+ },
5782
+ {
5783
+ "name": "beneficiary",
5784
+ "type": "bytes32",
5785
+ "indexed": false,
5786
+ "internalType": "bytes32"
5787
+ },
5788
+ {
5789
+ "name": "predispatch",
5790
+ "type": "tuple[]",
5791
+ "indexed": false,
5792
+ "internalType": "struct TokenInfo[]",
5793
+ "components": [
5794
+ {
5795
+ "name": "token",
5796
+ "type": "bytes32",
5797
+ "internalType": "bytes32"
5798
+ },
5799
+ {
5800
+ "name": "amount",
5801
+ "type": "uint256",
5802
+ "internalType": "uint256"
5803
+ }
4813
5804
  ]
4814
5805
  },
4815
5806
  {
4816
- name: "inputs",
4817
- type: "tuple[]",
4818
- indexed: false,
4819
- internalType: "struct TokenInfo[]",
4820
- components: [
4821
- { name: "token", type: "bytes32", internalType: "bytes32" },
4822
- { name: "amount", type: "uint256", internalType: "uint256" }
5807
+ "name": "inputs",
5808
+ "type": "tuple[]",
5809
+ "indexed": false,
5810
+ "internalType": "struct TokenInfo[]",
5811
+ "components": [
5812
+ {
5813
+ "name": "token",
5814
+ "type": "bytes32",
5815
+ "internalType": "bytes32"
5816
+ },
5817
+ {
5818
+ "name": "amount",
5819
+ "type": "uint256",
5820
+ "internalType": "uint256"
5821
+ }
4823
5822
  ]
4824
5823
  },
4825
5824
  {
4826
- name: "outputs",
4827
- type: "tuple[]",
4828
- indexed: false,
4829
- internalType: "struct TokenInfo[]",
4830
- components: [
4831
- { name: "token", type: "bytes32", internalType: "bytes32" },
4832
- { name: "amount", type: "uint256", internalType: "uint256" }
5825
+ "name": "outputs",
5826
+ "type": "tuple[]",
5827
+ "indexed": false,
5828
+ "internalType": "struct TokenInfo[]",
5829
+ "components": [
5830
+ {
5831
+ "name": "token",
5832
+ "type": "bytes32",
5833
+ "internalType": "bytes32"
5834
+ },
5835
+ {
5836
+ "name": "amount",
5837
+ "type": "uint256",
5838
+ "internalType": "uint256"
5839
+ }
4833
5840
  ]
4834
5841
  }
4835
5842
  ],
4836
- anonymous: false
5843
+ "anonymous": false
5844
+ },
5845
+ {
5846
+ "type": "event",
5847
+ "name": "ParamsUpdated",
5848
+ "inputs": [
5849
+ {
5850
+ "name": "previous",
5851
+ "type": "tuple",
5852
+ "indexed": false,
5853
+ "internalType": "struct Params",
5854
+ "components": [
5855
+ {
5856
+ "name": "host",
5857
+ "type": "address",
5858
+ "internalType": "address"
5859
+ },
5860
+ {
5861
+ "name": "dispatcher",
5862
+ "type": "address",
5863
+ "internalType": "address"
5864
+ },
5865
+ {
5866
+ "name": "solverSelection",
5867
+ "type": "bool",
5868
+ "internalType": "bool"
5869
+ },
5870
+ {
5871
+ "name": "surplusShareBps",
5872
+ "type": "uint256",
5873
+ "internalType": "uint256"
5874
+ },
5875
+ {
5876
+ "name": "protocolFeeBps",
5877
+ "type": "uint256",
5878
+ "internalType": "uint256"
5879
+ },
5880
+ {
5881
+ "name": "priceOracle",
5882
+ "type": "address",
5883
+ "internalType": "address"
5884
+ }
5885
+ ]
5886
+ },
5887
+ {
5888
+ "name": "current",
5889
+ "type": "tuple",
5890
+ "indexed": false,
5891
+ "internalType": "struct Params",
5892
+ "components": [
5893
+ {
5894
+ "name": "host",
5895
+ "type": "address",
5896
+ "internalType": "address"
5897
+ },
5898
+ {
5899
+ "name": "dispatcher",
5900
+ "type": "address",
5901
+ "internalType": "address"
5902
+ },
5903
+ {
5904
+ "name": "solverSelection",
5905
+ "type": "bool",
5906
+ "internalType": "bool"
5907
+ },
5908
+ {
5909
+ "name": "surplusShareBps",
5910
+ "type": "uint256",
5911
+ "internalType": "uint256"
5912
+ },
5913
+ {
5914
+ "name": "protocolFeeBps",
5915
+ "type": "uint256",
5916
+ "internalType": "uint256"
5917
+ },
5918
+ {
5919
+ "name": "priceOracle",
5920
+ "type": "address",
5921
+ "internalType": "address"
5922
+ }
5923
+ ]
5924
+ }
5925
+ ],
5926
+ "anonymous": false
5927
+ },
5928
+ {
5929
+ "type": "event",
5930
+ "name": "PartialFill",
5931
+ "inputs": [
5932
+ {
5933
+ "name": "commitment",
5934
+ "type": "bytes32",
5935
+ "indexed": true,
5936
+ "internalType": "bytes32"
5937
+ },
5938
+ {
5939
+ "name": "filler",
5940
+ "type": "address",
5941
+ "indexed": false,
5942
+ "internalType": "address"
5943
+ },
5944
+ {
5945
+ "name": "outputs",
5946
+ "type": "tuple[]",
5947
+ "indexed": false,
5948
+ "internalType": "struct TokenInfo[]",
5949
+ "components": [
5950
+ {
5951
+ "name": "token",
5952
+ "type": "bytes32",
5953
+ "internalType": "bytes32"
5954
+ },
5955
+ {
5956
+ "name": "amount",
5957
+ "type": "uint256",
5958
+ "internalType": "uint256"
5959
+ }
5960
+ ]
5961
+ },
5962
+ {
5963
+ "name": "inputs",
5964
+ "type": "tuple[]",
5965
+ "indexed": false,
5966
+ "internalType": "struct TokenInfo[]",
5967
+ "components": [
5968
+ {
5969
+ "name": "token",
5970
+ "type": "bytes32",
5971
+ "internalType": "bytes32"
5972
+ },
5973
+ {
5974
+ "name": "amount",
5975
+ "type": "uint256",
5976
+ "internalType": "uint256"
5977
+ }
5978
+ ]
5979
+ }
5980
+ ],
5981
+ "anonymous": false
5982
+ },
5983
+ {
5984
+ "type": "error",
5985
+ "name": "Cancelled",
5986
+ "inputs": []
5987
+ },
5988
+ {
5989
+ "type": "error",
5990
+ "name": "ECDSAInvalidSignature",
5991
+ "inputs": []
5992
+ },
5993
+ {
5994
+ "type": "error",
5995
+ "name": "ECDSAInvalidSignatureLength",
5996
+ "inputs": [
5997
+ {
5998
+ "name": "length",
5999
+ "type": "uint256",
6000
+ "internalType": "uint256"
6001
+ }
6002
+ ]
6003
+ },
6004
+ {
6005
+ "type": "error",
6006
+ "name": "ECDSAInvalidSignatureS",
6007
+ "inputs": [
6008
+ {
6009
+ "name": "s",
6010
+ "type": "bytes32",
6011
+ "internalType": "bytes32"
6012
+ }
6013
+ ]
6014
+ },
6015
+ {
6016
+ "type": "error",
6017
+ "name": "Expired",
6018
+ "inputs": []
6019
+ },
6020
+ {
6021
+ "type": "error",
6022
+ "name": "Filled",
6023
+ "inputs": []
6024
+ },
6025
+ {
6026
+ "type": "error",
6027
+ "name": "InsufficientNativeToken",
6028
+ "inputs": []
6029
+ },
6030
+ {
6031
+ "type": "error",
6032
+ "name": "InvalidInput",
6033
+ "inputs": []
6034
+ },
6035
+ {
6036
+ "type": "error",
6037
+ "name": "InvalidShortString",
6038
+ "inputs": []
6039
+ },
6040
+ {
6041
+ "type": "error",
6042
+ "name": "NotExpired",
6043
+ "inputs": []
4837
6044
  },
4838
6045
  {
4839
- type: "event",
4840
- name: "ParamsUpdated",
4841
- inputs: [
6046
+ "type": "error",
6047
+ "name": "SafeCastOverflowedUintDowncast",
6048
+ "inputs": [
4842
6049
  {
4843
- name: "previous",
4844
- type: "tuple",
4845
- indexed: false,
4846
- internalType: "struct Params",
4847
- components: [
4848
- { name: "host", type: "address", internalType: "address" },
4849
- { name: "dispatcher", type: "address", internalType: "address" },
4850
- { name: "solverSelection", type: "bool", internalType: "bool" },
4851
- { name: "surplusShareBps", type: "uint256", internalType: "uint256" },
4852
- { name: "protocolFeeBps", type: "uint256", internalType: "uint256" },
4853
- { name: "priceOracle", type: "address", internalType: "address" }
4854
- ]
6050
+ "name": "bits",
6051
+ "type": "uint8",
6052
+ "internalType": "uint8"
4855
6053
  },
4856
6054
  {
4857
- name: "current",
4858
- type: "tuple",
4859
- indexed: false,
4860
- internalType: "struct Params",
4861
- components: [
4862
- { name: "host", type: "address", internalType: "address" },
4863
- { name: "dispatcher", type: "address", internalType: "address" },
4864
- { name: "solverSelection", type: "bool", internalType: "bool" },
4865
- { name: "surplusShareBps", type: "uint256", internalType: "uint256" },
4866
- { name: "protocolFeeBps", type: "uint256", internalType: "uint256" },
4867
- { name: "priceOracle", type: "address", internalType: "address" }
4868
- ]
6055
+ "name": "value",
6056
+ "type": "uint256",
6057
+ "internalType": "uint256"
4869
6058
  }
4870
- ],
4871
- anonymous: false
6059
+ ]
4872
6060
  },
4873
6061
  {
4874
- type: "event",
4875
- name: "PartialFill",
4876
- inputs: [
4877
- { name: "commitment", type: "bytes32", indexed: true, internalType: "bytes32" },
4878
- { name: "filler", type: "address", indexed: false, internalType: "address" },
6062
+ "type": "error",
6063
+ "name": "SafeERC20FailedOperation",
6064
+ "inputs": [
4879
6065
  {
4880
- name: "outputs",
4881
- type: "tuple[]",
4882
- indexed: false,
4883
- internalType: "struct TokenInfo[]",
4884
- components: [
4885
- { name: "token", type: "bytes32", internalType: "bytes32" },
4886
- { name: "amount", type: "uint256", internalType: "uint256" }
4887
- ]
4888
- },
6066
+ "name": "token",
6067
+ "type": "address",
6068
+ "internalType": "address"
6069
+ }
6070
+ ]
6071
+ },
6072
+ {
6073
+ "type": "error",
6074
+ "name": "StringTooLong",
6075
+ "inputs": [
4889
6076
  {
4890
- name: "inputs",
4891
- type: "tuple[]",
4892
- indexed: false,
4893
- internalType: "struct TokenInfo[]",
4894
- components: [
4895
- { name: "token", type: "bytes32", internalType: "bytes32" },
4896
- { name: "amount", type: "uint256", internalType: "uint256" }
4897
- ]
6077
+ "name": "str",
6078
+ "type": "string",
6079
+ "internalType": "string"
4898
6080
  }
4899
- ],
4900
- anonymous: false
6081
+ ]
4901
6082
  },
4902
- { type: "error", name: "Cancelled", inputs: [] },
4903
- { type: "error", name: "ECDSAInvalidSignature", inputs: [] },
4904
6083
  {
4905
- type: "error",
4906
- name: "ECDSAInvalidSignatureLength",
4907
- inputs: [{ name: "length", type: "uint256", internalType: "uint256" }]
6084
+ "type": "error",
6085
+ "name": "Unauthorized",
6086
+ "inputs": []
4908
6087
  },
4909
6088
  {
4910
- type: "error",
4911
- name: "ECDSAInvalidSignatureS",
4912
- inputs: [{ name: "s", type: "bytes32", internalType: "bytes32" }]
6089
+ "type": "error",
6090
+ "name": "UnauthorizedCall",
6091
+ "inputs": []
4913
6092
  },
4914
- { type: "error", name: "Expired", inputs: [] },
4915
- { type: "error", name: "Filled", inputs: [] },
4916
- { type: "error", name: "InsufficientNativeToken", inputs: [] },
4917
- { type: "error", name: "InvalidInput", inputs: [] },
4918
- { type: "error", name: "InvalidShortString", inputs: [] },
4919
- { type: "error", name: "NotExpired", inputs: [] },
4920
6093
  {
4921
- type: "error",
4922
- name: "SafeCastOverflowedUintDowncast",
4923
- inputs: [
4924
- { name: "bits", type: "uint8", internalType: "uint8" },
4925
- { name: "value", type: "uint256", internalType: "uint256" }
4926
- ]
6094
+ "type": "error",
6095
+ "name": "UnexpectedCall",
6096
+ "inputs": []
4927
6097
  },
4928
6098
  {
4929
- type: "error",
4930
- name: "SafeERC20FailedOperation",
4931
- inputs: [{ name: "token", type: "address", internalType: "address" }]
4932
- },
4933
- { type: "error", name: "StringTooLong", inputs: [{ name: "str", type: "string", internalType: "string" }] },
4934
- { type: "error", name: "Unauthorized", inputs: [] },
4935
- { type: "error", name: "UnauthorizedCall", inputs: [] },
4936
- { type: "error", name: "UnexpectedCall", inputs: [] },
4937
- { type: "error", name: "UnknownOrder", inputs: [] },
4938
- { type: "error", name: "WrongChain", inputs: [] }
6099
+ "type": "error",
6100
+ "name": "UnknownOrder",
6101
+ "inputs": []
6102
+ },
6103
+ {
6104
+ "type": "error",
6105
+ "name": "WrongChain",
6106
+ "inputs": []
6107
+ }
4939
6108
  ];
4940
6109
  var IntentGatewayV2_default = { ABI: ABI3 };
4941
6110
  function getPeakPosByHeight(height) {
@@ -5617,6 +6786,7 @@ function bytes32ToBytes20(bytes32Address) {
5617
6786
  return bytesToHex(addressBytes);
5618
6787
  }
5619
6788
  function bytes20ToBytes32(bytes20Address) {
6789
+ if (bytes20Address.length === 66) return bytes20Address;
5620
6790
  return `0x${bytes20Address.slice(2).padStart(64, "0")}`;
5621
6791
  }
5622
6792
  function hexToString(hex) {
@@ -7733,6 +8903,7 @@ var TronChain = class {
7733
8903
  *
7734
8904
  * This mirrors the behavior used in IntentGatewayV2 for Tron chains.
7735
8905
  */
8906
+ // biome-ignore lint/suspicious/noExplicitAny: Tron signed transaction has a different shape from EVM HexString
7736
8907
  async broadcastTransaction(signedTransaction) {
7737
8908
  const tronReceipt = await this.tronWeb.trx.sendRawTransaction(signedTransaction);
7738
8909
  if (!tronReceipt.result) {
@@ -8334,6 +9505,8 @@ var IntentsCoprocessor = class _IntentsCoprocessor {
8334
9505
  this.substratePrivateKey = substratePrivateKey;
8335
9506
  this.ownsConnection = ownsConnection;
8336
9507
  }
9508
+ /** Cached result of whether the node exposes intents_* RPC methods */
9509
+ hasIntentsRpc = null;
8337
9510
  /**
8338
9511
  * Creates and connects an IntentsCoprocessor to a Hyperbridge node.
8339
9512
  * This creates and manages its own API connection.
@@ -8401,6 +9574,20 @@ var IntentsCoprocessor = class _IntentsCoprocessor {
8401
9574
  const seedBytes = Buffer.from(hex, "hex");
8402
9575
  return keyring.addFromSeed(seedBytes);
8403
9576
  }
9577
+ /**
9578
+ * Checks if the connected node exposes intents_* RPC methods.
9579
+ * Result is cached after the first check.
9580
+ */
9581
+ async checkIntentsRpc() {
9582
+ if (this.hasIntentsRpc !== null) return this.hasIntentsRpc;
9583
+ try {
9584
+ const methods = await this.api.rpc.rpc.methods();
9585
+ this.hasIntentsRpc = methods.methods.some((m) => m.toString().startsWith("intent"));
9586
+ } catch {
9587
+ this.hasIntentsRpc = false;
9588
+ }
9589
+ return this.hasIntentsRpc;
9590
+ }
8404
9591
  /**
8405
9592
  * Signs and sends an extrinsic, handling status updates and errors
8406
9593
  * Implements retry logic with progressive tip increases for stuck transactions
@@ -8536,36 +9723,62 @@ var IntentsCoprocessor = class _IntentsCoprocessor {
8536
9723
  /**
8537
9724
  * Fetches all bids for a given order commitment from Hyperbridge.
8538
9725
  *
9726
+ * Uses the custom intents_getBidsForOrder RPC if available on the node
9727
+ * for a single round-trip. Falls back to parallel storage + offchain
9728
+ * lookups otherwise.
9729
+ *
8539
9730
  * @param commitment - The order commitment hash (bytes32)
8540
9731
  * @returns Array of FillerBid objects containing filler address, userOp, and deposit
8541
9732
  */
8542
9733
  async getBidsForOrder(commitment) {
8543
- const storageEntries = await this.getBidStorageEntries(commitment);
8544
- if (storageEntries.length === 0) {
8545
- return [];
9734
+ const hasRpc = await this.checkIntentsRpc();
9735
+ if (hasRpc) {
9736
+ try {
9737
+ return await this.getBidsViaRpc(commitment);
9738
+ } catch (err) {
9739
+ console.warn("intents RPC failed, falling back to storage queries:", err);
9740
+ }
8546
9741
  }
8547
- const bids = [];
8548
- for (const entry of storageEntries) {
9742
+ return await this.getBidsViaStorage(commitment);
9743
+ }
9744
+ /**
9745
+ * Fetches bids using the custom intents_getBidsForOrder RPC.
9746
+ * Single round-trip but does not include deposit amounts.
9747
+ */
9748
+ async getBidsViaRpc(commitment) {
9749
+ const result = await this.api._rpcCore.provider.send("intents_getBidsForOrder", [
9750
+ commitment
9751
+ ]);
9752
+ return result.map((entry) => {
9753
+ const userOp = decodeUserOpScale(entry.user_op);
9754
+ const filler = new Keyring({ type: "sr25519" }).encodeAddress(hexToU8a(entry.filler));
9755
+ return { filler, userOp, deposit: 0n };
9756
+ });
9757
+ }
9758
+ /**
9759
+ * Fetches bids using on-chain storage entries + parallel offchain lookups.
9760
+ * Slower but works on all nodes and includes deposit amounts.
9761
+ */
9762
+ async getBidsViaStorage(commitment) {
9763
+ const entries = await this.api.query.intentsCoprocessor.bids.entries(commitment);
9764
+ if (entries.length === 0) return [];
9765
+ const bidPromises = entries.map(async ([storageKey, depositValue]) => {
8549
9766
  try {
8550
- const { filler, deposit } = entry;
9767
+ const filler = storageKey.args[1].toString();
9768
+ const deposit = BigInt(depositValue.toString());
8551
9769
  const offchainKey = this.buildOffchainBidKey(commitment, filler);
8552
9770
  const offchainKeyHex = u8aToHex(offchainKey);
8553
9771
  const offchainResult = await this.api.rpc.offchain.localStorageGet("PERSISTENT", offchainKeyHex);
8554
- if (!offchainResult || offchainResult.isNone) {
8555
- continue;
8556
- }
9772
+ if (!offchainResult || offchainResult.isNone) return null;
8557
9773
  const bidData = offchainResult.unwrap().toHex();
8558
9774
  const decoded = this.decodeBid(bidData);
8559
- bids.push({
8560
- filler: decoded.filler,
8561
- userOp: decoded.userOp,
8562
- deposit
8563
- });
9775
+ return { filler: decoded.filler, userOp: decoded.userOp, deposit };
8564
9776
  } catch {
8565
- continue;
9777
+ return null;
8566
9778
  }
8567
- }
8568
- return bids;
9779
+ });
9780
+ const results = await Promise.all(bidPromises);
9781
+ return results.filter((b) => b !== null);
8569
9782
  }
8570
9783
  /** Decodes SCALE-encoded Bid struct and SCALE-encoded PackedUserOperation */
8571
9784
  decodeBid(hex) {
@@ -8620,7 +9833,7 @@ async function getSubstrateChain(chainConfig) {
8620
9833
  // src/queries.ts
8621
9834
  var POST_REQUEST_STATUS = `
8622
9835
  query RequestStatusM($hash: String!) {
8623
- requests(
9836
+ requestV2s(
8624
9837
  filter: { commitment: { equalTo: $hash } }
8625
9838
  ) {
8626
9839
  nodes {
@@ -8648,7 +9861,7 @@ var POST_REQUEST_STATUS = `
8648
9861
  `;
8649
9862
  var GET_REQUEST_STATUS = `
8650
9863
  query GetRequestDetails($commitment: String!) {
8651
- getRequests(
9864
+ getRequestV2s(
8652
9865
  filter: { commitment: { equalTo: $commitment } }
8653
9866
  ) {
8654
9867
  nodes {
@@ -8666,7 +9879,6 @@ query GetRequestDetails($commitment: String!) {
8666
9879
  blockHash
8667
9880
  transactionHash
8668
9881
  blockTimestamp
8669
- status
8670
9882
  chain
8671
9883
  commitment
8672
9884
  statusMetadata {
@@ -8784,7 +9996,7 @@ query LatestStateMachineUpdate($statemachineId: String!, $chain: String!) {
8784
9996
  `;
8785
9997
  var ASSET_TELEPORTED_BY_PARAMS = `
8786
9998
  query AssetTeleportedByParams($id: String!) {
8787
- assetTeleported(id: $id) {
9999
+ assetTeleportedV2(id: $id) {
8788
10000
  id
8789
10001
  from
8790
10002
  to
@@ -8851,7 +10063,7 @@ query OrderStatus($commitment: String!) {
8851
10063
  }`;
8852
10064
  var TOKEN_GATEWAY_ASSET_TELEPORTED_STATUS = `
8853
10065
  query TokenGatewayAssetTeleportedStatus($commitment: String!) {
8854
- tokenGatewayAssetTeleporteds(
10066
+ tokenGatewayAssetTeleportedV2s(
8855
10067
  filter: { commitment: { equalTo: $commitment } }
8856
10068
  ) {
8857
10069
  nodes {
@@ -8893,10 +10105,10 @@ async function queryAssetTeleported(params) {
8893
10105
  return await retryPromise(
8894
10106
  async () => {
8895
10107
  const response = await queryClient.request(ASSET_TELEPORTED_BY_PARAMS, { id });
8896
- if (!response?.assetTeleported) {
10108
+ if (!response?.assetTeleportedV2) {
8897
10109
  throw new Error(`AssetTeleportedEvent not found for ${id}`);
8898
10110
  }
8899
- return response.assetTeleported;
10111
+ return response.assetTeleportedV2;
8900
10112
  },
8901
10113
  {
8902
10114
  logMessage: "queryingAssetTeleported",
@@ -8923,7 +10135,7 @@ async function _queryTokenGatewayAssetTeleportedInternal(params) {
8923
10135
  logMessage: `querying 'TokenGatewayAssetTeleported' with Statuses by CommitmentHash(${commitmentHash})`
8924
10136
  }
8925
10137
  );
8926
- const first_record = response.tokenGatewayAssetTeleporteds.nodes[0];
10138
+ const first_record = response.tokenGatewayAssetTeleportedV2s.nodes[0];
8927
10139
  if (!first_record) return;
8928
10140
  logger.trace("`TokenGatewayAssetTeleported` found");
8929
10141
  const { statusMetadata, ...first_node } = first_record;
@@ -8964,7 +10176,7 @@ async function _queryRequestInternal(params) {
8964
10176
  logMessage: `querying 'Request' with Statuses by CommitmentHash(${hash})`
8965
10177
  }
8966
10178
  );
8967
- const first_record = response.requests.nodes[0];
10179
+ const first_record = response.requestV2s.nodes[0];
8968
10180
  if (!first_record) return;
8969
10181
  logger.trace("`Request` found");
8970
10182
  const { statusMetadata, ...first_node } = first_record;
@@ -9003,9 +10215,9 @@ async function _queryGetRequestInternal(params) {
9003
10215
  logMessage: `query \`IGetRequest\` with commitment hash ${commitmentHash}`
9004
10216
  }
9005
10217
  );
9006
- if (!response.getRequests.nodes[0]) return;
10218
+ if (!response.getRequestV2s.nodes[0]) return;
9007
10219
  logger.trace("`Request` found");
9008
- const statuses = response.getRequests.nodes[0].statusMetadata.nodes.map((item) => ({
10220
+ const statuses = response.getRequestV2s.nodes[0].statusMetadata.nodes.map((item) => ({
9009
10221
  status: item.status,
9010
10222
  metadata: {
9011
10223
  blockHash: item.blockHash,
@@ -9017,7 +10229,7 @@ async function _queryGetRequestInternal(params) {
9017
10229
  const sorted = statuses.sort((a, b) => {
9018
10230
  return REQUEST_STATUS_WEIGHTS[a.status] - REQUEST_STATUS_WEIGHTS[b.status];
9019
10231
  });
9020
- const { statusMetadata, ...rest } = response.getRequests.nodes[0];
10232
+ const { statusMetadata, ...rest } = response.getRequestV2s.nodes[0];
9021
10233
  return {
9022
10234
  ...rest,
9023
10235
  commitment: commitmentHash,
@@ -12041,6 +13253,26 @@ var STORAGE_KEYS = Object.freeze({
12041
13253
  sourceProof: (orderId) => `cancel-order:${orderId}:sourceProof`,
12042
13254
  postCommitment: (orderId) => `cancel-order:${orderId}:postCommitment`
12043
13255
  });
13256
+ function createUsedUserOpsStorage(options = {}) {
13257
+ options.env ?? detectEnvironment();
13258
+ const driver = loadDriver({ options }) ?? inMemoryDriver();
13259
+ const baseStorage = createStorage({ driver });
13260
+ const getItem = async (key2) => {
13261
+ const value = await baseStorage.getItem(key2);
13262
+ return value ?? null;
13263
+ };
13264
+ const setItem = async (key2, value) => {
13265
+ await baseStorage.setItem(key2, value);
13266
+ };
13267
+ const removeItem = async (key2) => {
13268
+ await baseStorage.removeItem(key2);
13269
+ };
13270
+ return Object.freeze({
13271
+ getItem,
13272
+ setItem,
13273
+ removeItem
13274
+ });
13275
+ }
12044
13276
  function createSessionKeyStorage(options = {}) {
12045
13277
  options.env ?? detectEnvironment();
12046
13278
  const driver = loadDriver({ options }) ?? inMemoryDriver();
@@ -15102,9 +16334,13 @@ var ORDER_V2_PARAM_TYPE = "(bytes32,bytes,bytes,uint256,uint256,uint256,address,
15102
16334
  var DEFAULT_GRAFFITI2 = "0x0000000000000000000000000000000000000000000000000000000000000000";
15103
16335
  var ERC7821_BATCH_MODE = "0x0100000000000000000000000000000000000000000000000000000000000000";
15104
16336
  var BundlerMethod = {
16337
+ /** Submits a UserOperation to the bundler mempool. */
15105
16338
  ETH_SEND_USER_OPERATION: "eth_sendUserOperation",
16339
+ /** Retrieves the receipt for a previously submitted UserOperation by its hash. */
15106
16340
  ETH_GET_USER_OPERATION_RECEIPT: "eth_getUserOperationReceipt",
16341
+ /** Estimates gas limits for a UserOperation before submission. */
15107
16342
  ETH_ESTIMATE_USER_OPERATION_GAS: "eth_estimateUserOperationGas",
16343
+ /** Pimlico-specific method to fetch recommended EIP-1559 gas prices for UserOperations. */
15108
16344
  PIMLICO_GET_USER_OPERATION_GAS_PRICE: "pimlico_getUserOperationGasPrice"
15109
16345
  };
15110
16346
 
@@ -15119,9 +16355,22 @@ var DOMAIN_TYPEHASH = keccak256(
15119
16355
  toHex("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)")
15120
16356
  );
15121
16357
  var CryptoUtils = class {
16358
+ /**
16359
+ * @param ctx - Shared IntentsV2 context; used to access the bundler URL for
16360
+ * JSON-RPC calls.
16361
+ */
15122
16362
  constructor(ctx) {
15123
16363
  this.ctx = ctx;
15124
16364
  }
16365
+ /**
16366
+ * Computes an EIP-712 domain separator for a given contract.
16367
+ *
16368
+ * @param contractName - Human-readable name of the contract (e.g. `"IntentGateway"`).
16369
+ * @param version - Version string (e.g. `"2"`).
16370
+ * @param chainId - Chain ID of the network the contract is deployed on.
16371
+ * @param contractAddress - Address of the verifying contract.
16372
+ * @returns The 32-byte domain separator as a hex string.
16373
+ */
15125
16374
  getDomainSeparator(contractName, version, chainId, contractAddress) {
15126
16375
  return keccak256(
15127
16376
  encodeAbiParameters(parseAbiParameters("bytes32, bytes32, bytes32, uint256, address"), [
@@ -15133,6 +16382,19 @@ var CryptoUtils = class {
15133
16382
  ])
15134
16383
  );
15135
16384
  }
16385
+ /**
16386
+ * Signs a `SelectSolver` EIP-712 message with a session key.
16387
+ *
16388
+ * The session key authorises the selection of a specific solver for the
16389
+ * given order commitment. The resulting signature is appended to the
16390
+ * solver's UserOperation signature before bundle submission.
16391
+ *
16392
+ * @param commitment - The order commitment (bytes32) being fulfilled.
16393
+ * @param solverAddress - Address of the solver account selected to fill the order.
16394
+ * @param domainSeparator - EIP-712 domain separator for the IntentGatewayV2 contract.
16395
+ * @param privateKey - Hex-encoded private key of the session key that signs the message.
16396
+ * @returns The ECDSA signature as a hex string, or `null` if signing fails.
16397
+ */
15136
16398
  async signSolverSelection(commitment, solverAddress, domainSeparator, privateKey) {
15137
16399
  const account = privateKeyToAccount(privateKey);
15138
16400
  const structHash = keccak256(
@@ -15145,6 +16407,15 @@ var CryptoUtils = class {
15145
16407
  const signature = await account.sign({ hash: digest });
15146
16408
  return signature;
15147
16409
  }
16410
+ /**
16411
+ * Computes the EIP-712 hash of a `PackedUserOperation` as defined by
16412
+ * ERC-4337 EntryPoint v0.8.
16413
+ *
16414
+ * @param userOp - The packed UserOperation to hash.
16415
+ * @param entryPoint - Address of the EntryPoint v0.8 contract.
16416
+ * @param chainId - Chain ID of the network on which the operation will execute.
16417
+ * @returns The UserOperation hash as a hex string.
16418
+ */
15148
16419
  computeUserOpHash(userOp, entryPoint, chainId) {
15149
16420
  const structHash = this.getPackedUserStructHash(userOp);
15150
16421
  const domainSeparator = this.getDomainSeparator("ERC4337", "1", chainId, entryPoint);
@@ -15152,6 +16423,15 @@ var CryptoUtils = class {
15152
16423
  encodePacked(["bytes1", "bytes1", "bytes32", "bytes32"], ["0x19", "0x01", domainSeparator, structHash])
15153
16424
  );
15154
16425
  }
16426
+ /**
16427
+ * Computes the EIP-712 struct hash of a `PackedUserOperation`.
16428
+ *
16429
+ * Hashes dynamic fields (`initCode`, `callData`, `paymasterAndData`) before
16430
+ * ABI-encoding so the final hash is a fixed-length 32-byte value.
16431
+ *
16432
+ * @param userOp - The packed UserOperation to hash.
16433
+ * @returns The struct hash as a 32-byte hex string.
16434
+ */
15155
16435
  getPackedUserStructHash(userOp) {
15156
16436
  return keccak256(
15157
16437
  encodeAbiParameters(
@@ -15170,28 +16450,73 @@ var CryptoUtils = class {
15170
16450
  )
15171
16451
  );
15172
16452
  }
16453
+ /**
16454
+ * Packs `verificationGasLimit` and `callGasLimit` into the ERC-4337
16455
+ * `accountGasLimits` bytes32 field.
16456
+ *
16457
+ * The high 16 bytes hold `verificationGasLimit` and the low 16 bytes hold
16458
+ * `callGasLimit`, matching the EntryPoint v0.8 packed representation.
16459
+ *
16460
+ * @param verificationGasLimit - Gas limit for the account verification step.
16461
+ * @param callGasLimit - Gas limit for the main execution call.
16462
+ * @returns A 32-byte hex string with both limits packed.
16463
+ */
15173
16464
  packGasLimits(verificationGasLimit, callGasLimit) {
15174
16465
  const verificationGasHex = pad(toHex(verificationGasLimit), { size: 16 });
15175
16466
  const callGasHex = pad(toHex(callGasLimit), { size: 16 });
15176
16467
  return concat([verificationGasHex, callGasHex]);
15177
16468
  }
16469
+ /**
16470
+ * Packs `maxPriorityFeePerGas` and `maxFeePerGas` into the ERC-4337
16471
+ * `gasFees` bytes32 field.
16472
+ *
16473
+ * The high 16 bytes hold `maxPriorityFeePerGas` and the low 16 bytes hold
16474
+ * `maxFeePerGas`, matching the EntryPoint v0.8 packed representation.
16475
+ *
16476
+ * @param maxPriorityFeePerGas - Maximum tip per gas (EIP-1559).
16477
+ * @param maxFeePerGas - Maximum total fee per gas (EIP-1559).
16478
+ * @returns A 32-byte hex string with both fee values packed.
16479
+ */
15178
16480
  packGasFees(maxPriorityFeePerGas, maxFeePerGas) {
15179
16481
  const priorityFeeHex = pad(toHex(maxPriorityFeePerGas), { size: 16 });
15180
16482
  const maxFeeHex = pad(toHex(maxFeePerGas), { size: 16 });
15181
16483
  return concat([priorityFeeHex, maxFeeHex]);
15182
16484
  }
16485
+ /**
16486
+ * Unpacks the `accountGasLimits` bytes32 field back into its constituent
16487
+ * gas limits.
16488
+ *
16489
+ * @param accountGasLimits - The packed 32-byte gas limits field from a `PackedUserOperation`.
16490
+ * @returns Object with `verificationGasLimit` and `callGasLimit` as bigints.
16491
+ */
15183
16492
  unpackGasLimits(accountGasLimits) {
15184
16493
  const hex = accountGasLimits.slice(2);
15185
16494
  const verificationGasLimit = BigInt(`0x${hex.slice(0, 32)}`);
15186
16495
  const callGasLimit = BigInt(`0x${hex.slice(32, 64)}`);
15187
16496
  return { verificationGasLimit, callGasLimit };
15188
16497
  }
16498
+ /**
16499
+ * Unpacks the `gasFees` bytes32 field back into its constituent fee values.
16500
+ *
16501
+ * @param gasFees - The packed 32-byte gas fees field from a `PackedUserOperation`.
16502
+ * @returns Object with `maxPriorityFeePerGas` and `maxFeePerGas` as bigints.
16503
+ */
15189
16504
  unpackGasFees(gasFees) {
15190
16505
  const hex = gasFees.slice(2);
15191
16506
  const maxPriorityFeePerGas = BigInt(`0x${hex.slice(0, 32)}`);
15192
16507
  const maxFeePerGas = BigInt(`0x${hex.slice(32, 64)}`);
15193
16508
  return { maxPriorityFeePerGas, maxFeePerGas };
15194
16509
  }
16510
+ /**
16511
+ * Converts a packed `PackedUserOperation` into the JSON object format
16512
+ * expected by ERC-4337 bundler JSON-RPC endpoints.
16513
+ *
16514
+ * Unpacks `accountGasLimits` and `gasFees`, separates optional factory and
16515
+ * paymaster fields, and converts all numeric fields to hex strings.
16516
+ *
16517
+ * @param userOp - The packed UserOperation to convert.
16518
+ * @returns A plain object safe to pass as the first element of bundler RPC params.
16519
+ */
15195
16520
  prepareBundlerCall(userOp) {
15196
16521
  const { verificationGasLimit, callGasLimit } = this.unpackGasLimits(userOp.accountGasLimits);
15197
16522
  const { maxPriorityFeePerGas, maxFeePerGas } = this.unpackGasFees(userOp.gasFees);
@@ -15224,6 +16549,15 @@ var CryptoUtils = class {
15224
16549
  }
15225
16550
  return userOpBundler;
15226
16551
  }
16552
+ /**
16553
+ * Sends a JSON-RPC request to the configured ERC-4337 bundler endpoint.
16554
+ *
16555
+ * @param method - The JSON-RPC method name (one of {@link BundlerMethod}).
16556
+ * @param params - Array of parameters for the RPC call.
16557
+ * @returns Resolves with the `result` field of the bundler's JSON-RPC response,
16558
+ * typed as `T`.
16559
+ * @throws If the bundler URL is not configured or the bundler returns an error.
16560
+ */
15227
16561
  async sendBundler(method, params = []) {
15228
16562
  if (!this.ctx.bundlerUrl) {
15229
16563
  throw new Error("Bundler URL not configured");
@@ -15239,6 +16573,14 @@ var CryptoUtils = class {
15239
16573
  }
15240
16574
  return result.result;
15241
16575
  }
16576
+ /**
16577
+ * Encodes a list of calls into ERC-7821 `execute` calldata using
16578
+ * single-batch mode (`ERC7821_BATCH_MODE`).
16579
+ *
16580
+ * @param calls - Ordered list of calls to batch; each specifies a `target`
16581
+ * address, ETH `value`, and `data`.
16582
+ * @returns ABI-encoded calldata for the ERC-7821 `execute(bytes32,bytes)` function.
16583
+ */
15242
16584
  encodeERC7821Execute(calls) {
15243
16585
  const executionData = encodeAbiParameters(
15244
16586
  [{ type: "tuple[]", components: erc7281_default.ABI[1].components }],
@@ -15250,6 +16592,16 @@ var CryptoUtils = class {
15250
16592
  args: [ERC7821_BATCH_MODE, executionData]
15251
16593
  });
15252
16594
  }
16595
+ /**
16596
+ * Decodes ERC-7821 `execute` calldata back into its constituent calls.
16597
+ *
16598
+ * Returns `null` if the calldata does not match the expected `execute`
16599
+ * function signature or cannot be decoded.
16600
+ *
16601
+ * @param callData - Hex-encoded calldata previously produced by
16602
+ * {@link encodeERC7821Execute} or an equivalent encoder.
16603
+ * @returns Array of decoded {@link ERC7821Call} objects, or `null` on failure.
16604
+ */
15253
16605
  decodeERC7821Execute(callData) {
15254
16606
  try {
15255
16607
  const decoded = decodeFunctionData({
@@ -15310,7 +16662,17 @@ function transformOrderForContract(order) {
15310
16662
  return {
15311
16663
  ...contractOrder,
15312
16664
  source: order.source.startsWith("0x") ? order.source : toHex(order.source),
15313
- destination: order.destination.startsWith("0x") ? order.destination : toHex(order.destination)
16665
+ destination: order.destination.startsWith("0x") ? order.destination : toHex(order.destination),
16666
+ inputs: order.inputs.map((t) => ({ ...t, token: bytes20ToBytes32(t.token) })),
16667
+ predispatch: {
16668
+ ...order.predispatch,
16669
+ assets: order.predispatch.assets.map((t) => ({ ...t, token: bytes20ToBytes32(t.token) }))
16670
+ },
16671
+ output: {
16672
+ ...order.output,
16673
+ beneficiary: bytes20ToBytes32(order.output.beneficiary),
16674
+ assets: order.output.assets.map((t) => ({ ...t, token: bytes20ToBytes32(t.token) }))
16675
+ }
15314
16676
  };
15315
16677
  }
15316
16678
  async function convertGasToFeeToken(ctx, gasEstimate, gasEstimateIn, evmChainID, gasPriceOverride) {
@@ -15350,9 +16712,40 @@ async function convertGasToFeeToken(ctx, gasEstimate, gasEstimateIn, evmChainID,
15350
16712
 
15351
16713
  // src/protocols/intentsV2/OrderPlacer.ts
15352
16714
  var OrderPlacer = class {
16715
+ /**
16716
+ * @param ctx - Shared IntentsV2 context providing the source chain client,
16717
+ * config service, and session-key storage.
16718
+ */
15353
16719
  constructor(ctx) {
15354
16720
  this.ctx = ctx;
15355
16721
  }
16722
+ /**
16723
+ * Bidirectional async generator that orchestrates order placement.
16724
+ *
16725
+ * **Yield/receive protocol:**
16726
+ * 1. Yields `{ to, data, sessionPrivateKey }` — the caller must sign a
16727
+ * transaction sending `data` to `to` and pass the signed transaction back
16728
+ * via `gen.next(signedTx)`.
16729
+ * 2. Returns `{ order, transactionHash }` — the finalized order with its
16730
+ * on-chain `nonce`, `inputs`, and computed `id`, plus the placement
16731
+ * transaction hash.
16732
+ *
16733
+ * A fresh ephemeral session key is generated for every call. The key is
16734
+ * stored immediately (without a commitment) so it can be retrieved by
16735
+ * address, then updated with the commitment once the `OrderPlaced` event
16736
+ * confirms the nonce.
16737
+ *
16738
+ * @param order - The order to place. `order.session` is mutated in-place
16739
+ * with the generated session key address before yielding.
16740
+ * @param graffiti - Optional bytes32 tag for orderflow attribution /
16741
+ * revenue share. Defaults to {@link DEFAULT_GRAFFITI} (bytes32 zero).
16742
+ * @yields `{ to, data, sessionPrivateKey }` — target contract address,
16743
+ * encoded `placeOrder` calldata, and the raw session private key.
16744
+ * @returns `{ order, transactionHash }` after the transaction is confirmed
16745
+ * and the `OrderPlaced` event is parsed.
16746
+ * @throws If the broadcast transaction receipt does not contain an
16747
+ * `OrderPlaced` event.
16748
+ */
15356
16749
  async *placeOrder(order, graffiti = DEFAULT_GRAFFITI2) {
15357
16750
  const privateKey = generatePrivateKey();
15358
16751
  const account = privateKeyToAccount(privateKey);
@@ -15364,16 +16757,20 @@ var OrderPlacer = class {
15364
16757
  address: sessionKeyAddress,
15365
16758
  createdAt
15366
16759
  });
15367
- const calldata = encodeFunctionData({
16760
+ const data = encodeFunctionData({
15368
16761
  abi: ABI3,
15369
16762
  functionName: "placeOrder",
15370
16763
  args: [transformOrderForContract(order), graffiti]
15371
16764
  });
15372
- const signedTransaction = yield { calldata, sessionPrivateKey: privateKey };
15373
- const receipt = await this.ctx.source.broadcastTransaction(signedTransaction);
15374
- console.log(
15375
- `Place order transaction sent to source chain ${hexToString(order.source)} with hash: ${receipt.transactionHash}`
16765
+ const intentGatewayAddress = this.ctx.source.configService.getIntentGatewayV2Address(
16766
+ hexToString(order.source)
15376
16767
  );
16768
+ const signedTransaction = yield {
16769
+ to: intentGatewayAddress,
16770
+ data,
16771
+ sessionPrivateKey: privateKey
16772
+ };
16773
+ const receipt = await this.ctx.source.broadcastTransaction(signedTransaction);
15377
16774
  const events = parseEventLogs({
15378
16775
  abi: ABI3,
15379
16776
  logs: receipt.logs,
@@ -15396,16 +16793,47 @@ var OrderPlacer = class {
15396
16793
  createdAt
15397
16794
  };
15398
16795
  await this.ctx.sessionKeyStorage.setSessionKeyByAddress(sessionKeyAddress, sessionKeyData);
15399
- return order;
16796
+ return { order, transactionHash: receipt.transactionHash };
15400
16797
  }
15401
16798
  };
15402
16799
 
15403
16800
  // src/protocols/intentsV2/OrderExecutor.ts
16801
+ var USED_USEROPS_STORAGE_KEY = (commitment) => `used-userops:${commitment.toLowerCase()}`;
15404
16802
  var OrderExecutor = class {
15405
- constructor(ctx, bidManager) {
16803
+ /**
16804
+ * @param ctx - Shared IntentsV2 context providing the destination chain
16805
+ * client, coprocessor, bundler URL, and storage adapters.
16806
+ * @param bidManager - Handles bid validation, sorting, simulation, and
16807
+ * UserOperation submission.
16808
+ * @param crypto - Crypto utilities used to compute UserOperation hashes for
16809
+ * deduplication.
16810
+ */
16811
+ constructor(ctx, bidManager, crypto) {
15406
16812
  this.ctx = ctx;
15407
16813
  this.bidManager = bidManager;
16814
+ this.crypto = crypto;
15408
16815
  }
16816
+ /**
16817
+ * Async generator that executes an intent order by polling for bids and
16818
+ * submitting UserOperations until the order is filled, partially exhausted,
16819
+ * or an unrecoverable error occurs.
16820
+ *
16821
+ * **Status progression (cross-chain orders):**
16822
+ * `AWAITING_BIDS` → `BIDS_RECEIVED` → `BID_SELECTED` → `USEROP_SUBMITTED`
16823
+ * then terminates (settlement is confirmed off-chain via Hyperbridge).
16824
+ *
16825
+ * **Status progression (same-chain orders):**
16826
+ * `AWAITING_BIDS` → `BIDS_RECEIVED` → `BID_SELECTED` → `USEROP_SUBMITTED`
16827
+ * → (`FILLED` | `PARTIAL_FILL`)* → (`FILLED` | `PARTIAL_FILL_EXHAUSTED`)
16828
+ *
16829
+ * **Error statuses:** `FAILED` (fatal, no fills) or `PARTIAL_FILL_EXHAUSTED`
16830
+ * (deadline reached or no new bids after at least one partial fill).
16831
+ *
16832
+ * @param options - Execution parameters including the placed order, its
16833
+ * session private key, bid collection settings, and poll interval.
16834
+ * @yields {@link IntentOrderStatusUpdate} objects describing each stage.
16835
+ * @throws Never throws directly; all errors are reported as `FAILED` yields.
16836
+ */
15409
16837
  async *executeIntentOrder(options) {
15410
16838
  const {
15411
16839
  order,
@@ -15417,26 +16845,50 @@ var OrderExecutor = class {
15417
16845
  const commitment = order.id;
15418
16846
  const isSameChain = order.source === order.destination;
15419
16847
  if (!this.ctx.intentsCoprocessor) {
15420
- yield {
15421
- status: "FAILED",
15422
- metadata: { error: "IntentsCoprocessor required for order execution" }
15423
- };
16848
+ yield { status: "FAILED", error: "IntentsCoprocessor required for order execution" };
15424
16849
  return;
15425
16850
  }
15426
16851
  if (!this.ctx.bundlerUrl) {
15427
- yield {
15428
- status: "FAILED",
15429
- metadata: { error: "Bundler URL not configured" }
15430
- };
16852
+ yield { status: "FAILED", error: "Bundler URL not configured" };
15431
16853
  return;
15432
16854
  }
16855
+ const usedUserOps = /* @__PURE__ */ new Set();
16856
+ const storageKey = USED_USEROPS_STORAGE_KEY(commitment);
16857
+ const persisted = await this.ctx.usedUserOpsStorage.getItem(storageKey);
16858
+ if (persisted) {
16859
+ try {
16860
+ const parsed = JSON.parse(persisted);
16861
+ for (const key of parsed) {
16862
+ usedUserOps.add(key);
16863
+ }
16864
+ } catch {
16865
+ }
16866
+ }
16867
+ const persistUsedUserOps = async () => {
16868
+ await this.ctx.usedUserOpsStorage.setItem(storageKey, JSON.stringify([...usedUserOps]));
16869
+ };
16870
+ const entryPointAddress = this.ctx.dest.configService.getEntryPointV08Address(hexToString(order.destination));
16871
+ const chainId = BigInt(
16872
+ this.ctx.dest.client.chain?.id ?? Number.parseInt(this.ctx.dest.config.stateMachineId.split("-")[1])
16873
+ );
16874
+ const userOpHashKey = (userOp) => this.crypto.computeUserOpHash(userOp, entryPointAddress, chainId);
16875
+ const targetAmount = order.output.assets.reduce((acc, asset) => acc + asset.amount, 0n);
16876
+ let totalFilledAmount = 0n;
16877
+ let remainingAmount = targetAmount;
15433
16878
  try {
15434
- const usedUserOps = /* @__PURE__ */ new Set();
15435
16879
  while (true) {
15436
- yield {
15437
- status: "AWAITING_BIDS",
15438
- metadata: { commitment }
15439
- };
16880
+ const currentBlock = await this.ctx.dest.client.getBlockNumber();
16881
+ if (currentBlock >= order.deadline) {
16882
+ const isPartiallyFilled = totalFilledAmount > 0n;
16883
+ const deadlineError = `Order deadline reached (block ${currentBlock} >= ${order.deadline})`;
16884
+ if (isPartiallyFilled) {
16885
+ yield { status: "PARTIAL_FILL_EXHAUSTED", commitment, totalFilledAmount, remainingAmount, error: deadlineError };
16886
+ } else {
16887
+ yield { status: "FAILED", commitment, error: deadlineError };
16888
+ }
16889
+ return;
16890
+ }
16891
+ yield { status: "AWAITING_BIDS", commitment, totalFilledAmount, remainingAmount };
15440
16892
  const startTime = Date.now();
15441
16893
  let bids = [];
15442
16894
  while (Date.now() - startTime < bidTimeoutMs) {
@@ -15450,108 +16902,145 @@ var OrderExecutor = class {
15450
16902
  await sleep(pollIntervalMs);
15451
16903
  }
15452
16904
  const freshBids = bids.filter((bid) => {
15453
- const key = `${bid.userOp.sender.toLowerCase()}-${bid.userOp.nonce.toString()}`;
16905
+ const key = userOpHashKey(bid.userOp);
15454
16906
  return !usedUserOps.has(key);
15455
16907
  });
15456
16908
  if (freshBids.length === 0) {
15457
- yield {
15458
- status: "FAILED",
15459
- metadata: {
15460
- commitment,
15461
- error: `No new bids available within ${bidTimeoutMs}ms timeout`
15462
- }
15463
- };
16909
+ const isPartiallyFilled = totalFilledAmount > 0n;
16910
+ const noBidsError = isPartiallyFilled ? `No new bids after partial fill (${totalFilledAmount.toString()} filled, ${remainingAmount.toString()} remaining)` : `No new bids available within ${bidTimeoutMs}ms timeout`;
16911
+ if (isPartiallyFilled) {
16912
+ yield { status: "PARTIAL_FILL_EXHAUSTED", commitment, totalFilledAmount, remainingAmount, error: noBidsError };
16913
+ } else {
16914
+ yield { status: "FAILED", commitment, error: noBidsError };
16915
+ }
15464
16916
  return;
15465
16917
  }
15466
- yield {
15467
- status: "BIDS_RECEIVED",
15468
- metadata: {
15469
- commitment,
15470
- bidCount: freshBids.length,
15471
- bids: freshBids
15472
- }
15473
- };
16918
+ yield { status: "BIDS_RECEIVED", commitment, bidCount: freshBids.length, bids: freshBids };
15474
16919
  let result;
15475
16920
  try {
15476
16921
  result = await this.bidManager.selectBid(order, freshBids, sessionPrivateKey);
15477
16922
  } catch (err) {
15478
16923
  yield {
15479
16924
  status: "FAILED",
15480
- metadata: {
15481
- commitment,
15482
- error: `Failed to select bid and submit: ${err instanceof Error ? err.message : String(err)}`
15483
- }
16925
+ commitment,
16926
+ totalFilledAmount,
16927
+ remainingAmount,
16928
+ error: `Failed to select bid and submit: ${err instanceof Error ? err.message : String(err)}`
15484
16929
  };
15485
16930
  return;
15486
16931
  }
15487
- const usedKey = `${result.userOp.sender.toLowerCase()}-${result.userOp.nonce.toString()}`;
16932
+ const usedKey = userOpHashKey(result.userOp);
15488
16933
  usedUserOps.add(usedKey);
16934
+ await persistUsedUserOps();
15489
16935
  yield {
15490
16936
  status: "BID_SELECTED",
15491
- metadata: {
15492
- commitment,
15493
- selectedSolver: result.solverAddress,
15494
- userOpHash: result.userOpHash,
15495
- userOp: result.userOp
15496
- }
16937
+ commitment,
16938
+ selectedSolver: result.solverAddress,
16939
+ userOpHash: result.userOpHash,
16940
+ userOp: result.userOp
15497
16941
  };
15498
16942
  yield {
15499
16943
  status: "USEROP_SUBMITTED",
15500
- metadata: {
15501
- commitment,
15502
- userOpHash: result.userOpHash,
15503
- selectedSolver: result.solverAddress,
15504
- transactionHash: result.txnHash
15505
- }
16944
+ commitment,
16945
+ userOpHash: result.userOpHash,
16946
+ selectedSolver: result.solverAddress,
16947
+ transactionHash: result.txnHash
15506
16948
  };
15507
16949
  if (!isSameChain) {
15508
16950
  return;
15509
16951
  }
15510
16952
  if (result.fillStatus === "full") {
16953
+ totalFilledAmount = targetAmount;
16954
+ remainingAmount = 0n;
15511
16955
  yield {
15512
16956
  status: "FILLED",
15513
- metadata: {
15514
- commitment,
15515
- userOpHash: result.userOpHash,
15516
- selectedSolver: result.solverAddress,
15517
- transactionHash: result.txnHash
15518
- }
16957
+ commitment,
16958
+ userOpHash: result.userOpHash,
16959
+ selectedSolver: result.solverAddress,
16960
+ transactionHash: result.txnHash,
16961
+ totalFilledAmount,
16962
+ remainingAmount
15519
16963
  };
15520
16964
  return;
15521
16965
  }
15522
16966
  if (result.fillStatus === "partial") {
15523
- yield {
15524
- status: "PARTIAL_FILL",
15525
- metadata: {
16967
+ if (result.filledAmount !== void 0) {
16968
+ totalFilledAmount += result.filledAmount;
16969
+ if (totalFilledAmount >= targetAmount) {
16970
+ totalFilledAmount = targetAmount;
16971
+ remainingAmount = 0n;
16972
+ } else {
16973
+ remainingAmount = targetAmount - totalFilledAmount;
16974
+ }
16975
+ }
16976
+ if (remainingAmount === 0n) {
16977
+ yield {
16978
+ status: "FILLED",
15526
16979
  commitment,
15527
16980
  userOpHash: result.userOpHash,
15528
16981
  selectedSolver: result.solverAddress,
15529
- transactionHash: result.txnHash
15530
- }
16982
+ transactionHash: result.txnHash,
16983
+ totalFilledAmount,
16984
+ remainingAmount
16985
+ };
16986
+ return;
16987
+ }
16988
+ yield {
16989
+ status: "PARTIAL_FILL",
16990
+ commitment,
16991
+ userOpHash: result.userOpHash,
16992
+ selectedSolver: result.solverAddress,
16993
+ transactionHash: result.txnHash,
16994
+ filledAmount: result.filledAmount,
16995
+ totalFilledAmount,
16996
+ remainingAmount
15531
16997
  };
15532
16998
  }
15533
16999
  }
15534
17000
  } catch (err) {
15535
17001
  yield {
15536
17002
  status: "FAILED",
15537
- metadata: {
15538
- commitment,
15539
- error: `Unexpected error: ${err instanceof Error ? err.message : String(err)}`
15540
- }
17003
+ commitment,
17004
+ error: `Unexpected error: ${err instanceof Error ? err.message : String(err)}`
15541
17005
  };
15542
17006
  }
15543
17007
  }
15544
17008
  };
15545
17009
  var OrderCanceller = class {
17010
+ /**
17011
+ * @param ctx - Shared IntentsV2 context providing the source and destination
17012
+ * chain clients, config service, and cancellation storage.
17013
+ */
15546
17014
  constructor(ctx) {
15547
17015
  this.ctx = ctx;
15548
17016
  }
17017
+ /**
17018
+ * Quotes the native token cost of cancelling an order from the given chain.
17019
+ *
17020
+ * For same-chain orders the cost is zero. For cross-chain orders, the
17021
+ * quote covers the ISMP GET/POST dispatch fee.
17022
+ *
17023
+ * @param order - The order to quote a cancellation for.
17024
+ * @param from - Which chain side initiates the cancellation (`"source"` or
17025
+ * `"dest"`). Defaults to `"source"`.
17026
+ * @returns The native token amount required to submit the cancel transaction.
17027
+ */
15549
17028
  async quoteCancelNative(order, from = "source") {
15550
17029
  if (from === "dest") {
15551
17030
  return this.quoteCancelNativeFromDest(order);
15552
17031
  }
15553
17032
  return this.quoteCancelNativeFromSource(order);
15554
17033
  }
17034
+ /**
17035
+ * Quotes the native token cost of a source-initiated cross-chain cancellation.
17036
+ *
17037
+ * Constructs a mock ISMP GET request for the destination commitment slot and
17038
+ * calls `quoteNative` on the source host to obtain the dispatch fee.
17039
+ * Returns 0 for same-chain orders (no ISMP call needed).
17040
+ *
17041
+ * @param order - The order to quote.
17042
+ * @returns The native token dispatch fee in wei.
17043
+ */
15555
17044
  async quoteCancelNativeFromSource(order) {
15556
17045
  if (order.source === order.destination) return 0n;
15557
17046
  const height = order.deadline + 1n;
@@ -15578,6 +17067,21 @@ var OrderCanceller = class {
15578
17067
  };
15579
17068
  return await this.ctx.source.quoteNative(getRequest, 0n);
15580
17069
  }
17070
+ /**
17071
+ * Async generator that cancels an order and streams status events until
17072
+ * cancellation is complete.
17073
+ *
17074
+ * Delegates to `cancelOrderFromSource` or `cancelOrderFromDest` based on
17075
+ * the `from` parameter.
17076
+ *
17077
+ * @param order - The order to cancel.
17078
+ * @param indexerClient - Indexer client used to stream ISMP request status
17079
+ * updates and query state-machine heights.
17080
+ * @param from - Which chain side initiates the cancellation. Defaults to
17081
+ * `"source"`.
17082
+ * @yields {@link CancelEvent} objects describing each stage of the
17083
+ * cancellation lifecycle.
17084
+ */
15581
17085
  async *cancelOrder(order, indexerClient, from = "source") {
15582
17086
  if (from === "dest") {
15583
17087
  yield* this.cancelOrderFromDest(order, indexerClient);
@@ -15585,21 +17089,46 @@ var OrderCanceller = class {
15585
17089
  }
15586
17090
  yield* this.cancelOrderFromSource(order, indexerClient);
15587
17091
  }
17092
+ /**
17093
+ * Async generator that cancels an order by initiating the cancel from the
17094
+ * source chain.
17095
+ *
17096
+ * **Same-chain path:** encodes a direct `cancelOrder` call, yields
17097
+ * `AWAITING_CANCEL_TRANSACTION`, broadcasts the signed transaction, and
17098
+ * yields `CANCELLATION_COMPLETE` after confirming the `EscrowRefunded` event.
17099
+ *
17100
+ * **Cross-chain path:**
17101
+ * 1. Fetches (or resumes from cache) a destination finalization proof.
17102
+ * 2. Yields `AWAITING_CANCEL_TRANSACTION` with the `cancelOrder` calldata
17103
+ * that includes the destination proof height.
17104
+ * 3. Extracts the `GetRequestEvent` from the broadcast receipt and persists
17105
+ * the GET request.
17106
+ * 4. Streams the GET request status through Hyperbridge, fetching and
17107
+ * submitting the source proof once `SOURCE_FINALIZED` is reached.
17108
+ * 5. Cleans up persisted state when `HYPERBRIDGE_FINALIZED` is reached.
17109
+ *
17110
+ * @param order - The order to cancel.
17111
+ * @param indexerClient - Used to stream GET request status and query heights.
17112
+ * @yields {@link CancelEvent} at each lifecycle stage.
17113
+ * @throws If the cancel transaction does not contain the expected on-chain event.
17114
+ */
15588
17115
  async *cancelOrderFromSource(order, indexerClient) {
15589
17116
  const orderId = order.id;
15590
17117
  const isSameChain = order.source === order.destination;
17118
+ const intentGatewayAddress = this.ctx.source.configService.getIntentGatewayV2Address(
17119
+ hexToString(order.source)
17120
+ );
15591
17121
  if (isSameChain) {
15592
- const intentGatewayAddress = this.ctx.source.configService.getIntentGatewayV2Address(
15593
- hexToString(order.source)
15594
- );
15595
- const calldata = encodeFunctionData({
17122
+ const data = encodeFunctionData({
15596
17123
  abi: ABI3,
15597
17124
  functionName: "cancelOrder",
15598
17125
  args: [transformOrderForContract(order), { relayerFee: 0n, height: 0n }]
15599
17126
  });
15600
17127
  const signedTransaction = yield {
15601
17128
  status: "AWAITING_CANCEL_TRANSACTION",
15602
- data: { calldata, to: intentGatewayAddress }
17129
+ data,
17130
+ to: intentGatewayAddress,
17131
+ value: 0n
15603
17132
  };
15604
17133
  const receipt = await this.ctx.source.broadcastTransaction(signedTransaction);
15605
17134
  const refundEvents = parseEventLogs({
@@ -15612,7 +17141,8 @@ var OrderCanceller = class {
15612
17141
  }
15613
17142
  yield {
15614
17143
  status: "CANCELLATION_COMPLETE",
15615
- data: { metadata: { blockNumber: Number(receipt.blockNumber) } }
17144
+ blockNumber: Number(receipt.blockNumber),
17145
+ transactionHash: receipt.transactionHash
15616
17146
  };
15617
17147
  return;
15618
17148
  }
@@ -15624,19 +17154,25 @@ var OrderCanceller = class {
15624
17154
  destIProof = yield* this.fetchDestinationProof(order, indexerClient);
15625
17155
  await this.ctx.cancellationStorage.setItem(STORAGE_KEYS.destProof(orderId), destIProof);
15626
17156
  } else {
15627
- yield { status: "DESTINATION_FINALIZED", data: { proof: destIProof } };
17157
+ yield { status: "DESTINATION_FINALIZED", proof: destIProof };
15628
17158
  }
15629
17159
  let getRequest = await this.ctx.cancellationStorage.getItem(
15630
17160
  STORAGE_KEYS.getRequest(orderId)
15631
17161
  );
15632
17162
  if (!getRequest) {
15633
- const transactionHash = yield {
15634
- status: "AWAITING_GET_REQUEST",
15635
- data: void 0
15636
- };
15637
- const receipt = await this.ctx.source.client.getTransactionReceipt({
15638
- hash: transactionHash
17163
+ const value = await this.quoteCancelNativeFromSource(order);
17164
+ const data = encodeFunctionData({
17165
+ abi: ABI3,
17166
+ functionName: "cancelOrder",
17167
+ args: [transformOrderForContract(order), { relayerFee: 0n, height: destIProof.height }]
15639
17168
  });
17169
+ const signedTransaction = yield {
17170
+ status: "AWAITING_CANCEL_TRANSACTION",
17171
+ data,
17172
+ to: intentGatewayAddress,
17173
+ value
17174
+ };
17175
+ const receipt = await this.ctx.source.broadcastTransaction(signedTransaction);
15640
17176
  const events = parseEventLogs({ abi: evmHost_default.ABI, logs: receipt.logs });
15641
17177
  const request = events.find((e) => e.eventName === "GetRequestEvent");
15642
17178
  if (!request) throw new Error("GetRequest missing");
@@ -15649,61 +17185,72 @@ var OrderCanceller = class {
15649
17185
  });
15650
17186
  const sourceStatusStream = indexerClient.getRequestStatusStream(commitment);
15651
17187
  for await (const statusUpdate of sourceStatusStream) {
15652
- if (statusUpdate.status === RequestStatus.SOURCE_FINALIZED) {
15653
- yield {
15654
- status: "SOURCE_FINALIZED",
15655
- data: { metadata: statusUpdate.metadata }
15656
- };
15657
- const sourceHeight = BigInt(statusUpdate.metadata.blockNumber);
15658
- let sourceIProof = await this.ctx.cancellationStorage.getItem(
15659
- STORAGE_KEYS.sourceProof(orderId)
15660
- );
15661
- if (!sourceIProof) {
15662
- sourceIProof = await fetchSourceProof2(
15663
- commitment,
15664
- this.ctx.source,
15665
- sourceStateMachine,
15666
- sourceConsensusStateId,
15667
- sourceHeight
17188
+ switch (statusUpdate.status) {
17189
+ case RequestStatus.SOURCE_FINALIZED: {
17190
+ yield {
17191
+ status: "SOURCE_FINALIZED",
17192
+ metadata: statusUpdate.metadata
17193
+ };
17194
+ const sourceHeight = BigInt(statusUpdate.metadata.blockNumber);
17195
+ let sourceIProof = await this.ctx.cancellationStorage.getItem(
17196
+ STORAGE_KEYS.sourceProof(orderId)
15668
17197
  );
15669
- await this.ctx.cancellationStorage.setItem(STORAGE_KEYS.sourceProof(orderId), sourceIProof);
15670
- }
15671
- await waitForChallengePeriod(hyperbridge, {
15672
- height: sourceIProof.height,
15673
- id: {
15674
- stateId: parseStateMachineId(sourceStateMachine).stateId,
15675
- consensusStateId: sourceConsensusStateId
17198
+ if (!sourceIProof) {
17199
+ sourceIProof = await fetchSourceProof2(
17200
+ commitment,
17201
+ this.ctx.source,
17202
+ sourceStateMachine,
17203
+ sourceConsensusStateId,
17204
+ sourceHeight
17205
+ );
17206
+ await this.ctx.cancellationStorage.setItem(STORAGE_KEYS.sourceProof(orderId), sourceIProof);
15676
17207
  }
15677
- });
15678
- const getRequestMessage = {
15679
- kind: "GetRequest",
15680
- requests: [getRequest],
15681
- source: sourceIProof,
15682
- response: destIProof,
15683
- signer: pad("0x")
15684
- };
15685
- await this.submitAndConfirmReceipt(hyperbridge, commitment, getRequestMessage);
15686
- continue;
15687
- }
15688
- if (statusUpdate.status === RequestStatus.HYPERBRIDGE_DELIVERED) {
15689
- yield {
15690
- status: "HYPERBRIDGE_DELIVERED",
15691
- data: statusUpdate
15692
- };
15693
- continue;
15694
- }
15695
- if (statusUpdate.status === RequestStatus.HYPERBRIDGE_FINALIZED) {
15696
- yield {
15697
- status: "HYPERBRIDGE_FINALIZED",
15698
- data: statusUpdate
15699
- };
15700
- await this.ctx.cancellationStorage.removeItem(STORAGE_KEYS.destProof(orderId));
15701
- await this.ctx.cancellationStorage.removeItem(STORAGE_KEYS.getRequest(orderId));
15702
- await this.ctx.cancellationStorage.removeItem(STORAGE_KEYS.sourceProof(orderId));
15703
- return;
17208
+ await waitForChallengePeriod(hyperbridge, {
17209
+ height: sourceIProof.height,
17210
+ id: {
17211
+ stateId: parseStateMachineId(sourceStateMachine).stateId,
17212
+ consensusStateId: sourceConsensusStateId
17213
+ }
17214
+ });
17215
+ const getRequestMessage = {
17216
+ kind: "GetRequest",
17217
+ requests: [getRequest],
17218
+ source: sourceIProof,
17219
+ response: destIProof,
17220
+ signer: pad("0x")
17221
+ };
17222
+ await this.submitAndConfirmReceipt(hyperbridge, commitment, getRequestMessage);
17223
+ break;
17224
+ }
17225
+ case RequestStatus.HYPERBRIDGE_DELIVERED:
17226
+ yield {
17227
+ status: "HYPERBRIDGE_DELIVERED",
17228
+ metadata: statusUpdate.metadata
17229
+ };
17230
+ break;
17231
+ case RequestStatus.HYPERBRIDGE_FINALIZED:
17232
+ yield {
17233
+ status: "HYPERBRIDGE_FINALIZED",
17234
+ metadata: statusUpdate.metadata
17235
+ };
17236
+ await this.ctx.cancellationStorage.removeItem(STORAGE_KEYS.destProof(orderId));
17237
+ await this.ctx.cancellationStorage.removeItem(STORAGE_KEYS.getRequest(orderId));
17238
+ await this.ctx.cancellationStorage.removeItem(STORAGE_KEYS.sourceProof(orderId));
17239
+ return;
15704
17240
  }
15705
17241
  }
15706
17242
  }
17243
+ /**
17244
+ * Quotes the native token cost of a destination-initiated cross-chain cancellation.
17245
+ *
17246
+ * Estimates the relayer fee for delivering the refund POST request from the
17247
+ * destination chain back to the source chain, converts it to the destination
17248
+ * fee token, and calls `quoteNative` on the destination host.
17249
+ * Returns 0 for same-chain orders.
17250
+ *
17251
+ * @param order - The order to quote.
17252
+ * @returns The native token dispatch fee in wei.
17253
+ */
15707
17254
  async quoteCancelNativeFromDest(order) {
15708
17255
  if (order.source === order.destination) return 0n;
15709
17256
  const destStateMachine = order.destination.startsWith("0x") ? hexToString(order.destination) : order.destination;
@@ -15723,6 +17270,26 @@ var OrderCanceller = class {
15723
17270
  };
15724
17271
  return await this.ctx.dest.quoteNative(postRequest, relayerFee);
15725
17272
  }
17273
+ /**
17274
+ * Async generator that cancels an order by initiating from the destination
17275
+ * chain and streaming status updates until the source-chain escrow is refunded.
17276
+ *
17277
+ * Throws if called with a same-chain order (use source-side cancellation instead).
17278
+ *
17279
+ * **Steps:**
17280
+ * 1. Yields `AWAITING_CANCEL_TRANSACTION` so the caller can sign and submit
17281
+ * the cancel transaction on the destination chain.
17282
+ * 2. Extracts the `PostRequestEvent` commitment and persists it for resumability.
17283
+ * 3. Streams POST request status through Hyperbridge until `DESTINATION`
17284
+ * (i.e. the source chain processed the refund).
17285
+ * 4. Yields `CANCELLATION_COMPLETE` and cleans up persisted state.
17286
+ *
17287
+ * @param order - The cross-chain order to cancel.
17288
+ * @param indexerClient - Used to stream POST request status updates.
17289
+ * @yields {@link CancelEvent} at each lifecycle stage.
17290
+ * @throws If the order is same-chain, or if the cancel transaction does not
17291
+ * contain a `PostRequestEvent`.
17292
+ */
15726
17293
  async *cancelOrderFromDest(order, indexerClient) {
15727
17294
  const orderId = order.id;
15728
17295
  if (order.source === order.destination) {
@@ -15734,14 +17301,17 @@ var OrderCanceller = class {
15734
17301
  STORAGE_KEYS.postCommitment(orderId)
15735
17302
  );
15736
17303
  if (!commitment) {
15737
- const calldata = encodeFunctionData({
17304
+ const value = await this.quoteCancelNativeFromDest(order);
17305
+ const data = encodeFunctionData({
15738
17306
  abi: ABI3,
15739
17307
  functionName: "cancelOrder",
15740
17308
  args: [transformOrderForContract(order), { relayerFee: 0n, height: 0n }]
15741
17309
  });
15742
17310
  const signedTransaction = yield {
15743
17311
  status: "AWAITING_CANCEL_TRANSACTION",
15744
- data: { calldata, to: intentGatewayAddress }
17312
+ data,
17313
+ to: intentGatewayAddress,
17314
+ value
15745
17315
  };
15746
17316
  const receipt = await this.ctx.dest.broadcastTransaction(signedTransaction);
15747
17317
  const events = parseEventLogs({ abi: evmHost_default.ABI, logs: receipt.logs });
@@ -15753,37 +17323,50 @@ var OrderCanceller = class {
15753
17323
  }
15754
17324
  const statusStream = indexerClient.postRequestStatusStream(commitment);
15755
17325
  for await (const statusUpdate of statusStream) {
15756
- if (statusUpdate.status === RequestStatus.SOURCE_FINALIZED) {
15757
- yield {
15758
- status: "SOURCE_FINALIZED",
15759
- data: { metadata: statusUpdate.metadata }
15760
- };
15761
- continue;
15762
- }
15763
- if (statusUpdate.status === RequestStatus.HYPERBRIDGE_DELIVERED) {
15764
- yield {
15765
- status: "HYPERBRIDGE_DELIVERED",
15766
- data: statusUpdate
15767
- };
15768
- continue;
15769
- }
15770
- if (statusUpdate.status === RequestStatus.HYPERBRIDGE_FINALIZED) {
15771
- yield {
15772
- status: "HYPERBRIDGE_FINALIZED",
15773
- data: statusUpdate
15774
- };
15775
- continue;
15776
- }
15777
- if (statusUpdate.status === RequestStatus.DESTINATION) {
15778
- await this.ctx.cancellationStorage.removeItem(STORAGE_KEYS.postCommitment(orderId));
15779
- yield {
15780
- status: "CANCELLATION_COMPLETE",
15781
- data: { metadata: statusUpdate.metadata }
15782
- };
15783
- return;
17326
+ switch (statusUpdate.status) {
17327
+ case RequestStatus.SOURCE_FINALIZED:
17328
+ yield {
17329
+ status: "SOURCE_FINALIZED",
17330
+ metadata: statusUpdate.metadata
17331
+ };
17332
+ break;
17333
+ case RequestStatus.HYPERBRIDGE_DELIVERED:
17334
+ yield {
17335
+ status: "HYPERBRIDGE_DELIVERED",
17336
+ metadata: statusUpdate.metadata
17337
+ };
17338
+ break;
17339
+ case RequestStatus.HYPERBRIDGE_FINALIZED:
17340
+ yield {
17341
+ status: "HYPERBRIDGE_FINALIZED",
17342
+ metadata: statusUpdate.metadata
17343
+ };
17344
+ break;
17345
+ case RequestStatus.DESTINATION:
17346
+ await this.ctx.cancellationStorage.removeItem(STORAGE_KEYS.postCommitment(orderId));
17347
+ yield {
17348
+ status: "CANCELLATION_COMPLETE",
17349
+ blockNumber: statusUpdate.metadata.blockNumber,
17350
+ transactionHash: statusUpdate.metadata.transactionHash
17351
+ };
17352
+ return;
15784
17353
  }
15785
17354
  }
15786
17355
  }
17356
+ /**
17357
+ * Polls for a finalized destination-chain state proof that demonstrates
17358
+ * the order commitment slot is unset (i.e. the order was not filled before
17359
+ * the deadline).
17360
+ *
17361
+ * Waits until the latest Hyperbridge-tracked state-machine height exceeds
17362
+ * `order.deadline` (or the last failed probe height) before attempting to
17363
+ * fetch the proof, then retries on failure.
17364
+ *
17365
+ * @param order - The order for which to fetch the destination proof.
17366
+ * @param indexerClient - Used to query the latest known state-machine height.
17367
+ * @yields `DESTINATION_FINALIZED` with the proof once it is successfully fetched.
17368
+ * @returns The fetched {@link IProof} (also yielded).
17369
+ */
15787
17370
  async *fetchDestinationProof(order, indexerClient) {
15788
17371
  let latestHeight = 0n;
15789
17372
  let lastFailedHeight = null;
@@ -15816,7 +17399,7 @@ var OrderCanceller = class {
15816
17399
  proof: proofHex,
15817
17400
  stateMachine: this.ctx.dest.config.stateMachineId
15818
17401
  };
15819
- yield { status: "DESTINATION_FINALIZED", data: { proof } };
17402
+ yield { status: "DESTINATION_FINALIZED", proof };
15820
17403
  return proof;
15821
17404
  } catch (e) {
15822
17405
  lastFailedHeight = latestHeight;
@@ -15824,6 +17407,17 @@ var OrderCanceller = class {
15824
17407
  }
15825
17408
  }
15826
17409
  }
17410
+ /**
17411
+ * Submits an unsigned GET request message to Hyperbridge and waits until
17412
+ * the request receipt is confirmed on-chain.
17413
+ *
17414
+ * If the initial submission fails, the method waits 30 seconds and then
17415
+ * retries querying for the receipt up to 10 times with 5-second back-off.
17416
+ *
17417
+ * @param hyperbridge - Hyperbridge Substrate chain client.
17418
+ * @param commitment - The GET request commitment hash used to poll for the receipt.
17419
+ * @param message - The fully constructed GET request message to submit.
17420
+ */
15827
17421
  async submitAndConfirmReceipt(hyperbridge, commitment, message) {
15828
17422
  let storageValue = await hyperbridge.queryRequestReceipt(commitment);
15829
17423
  if (!storageValue) {
@@ -15856,10 +17450,29 @@ var OrderCanceller = class {
15856
17450
  }
15857
17451
  };
15858
17452
  var BidManager = class {
17453
+ /**
17454
+ * @param ctx - Shared IntentsV2 context providing the destination chain
17455
+ * client, coprocessor, bundler URL, and session-key storage.
17456
+ * @param crypto - Crypto utilities used for gas packing, UserOp hashing,
17457
+ * EIP-712 signing, and bundler calls.
17458
+ */
15859
17459
  constructor(ctx, crypto) {
15860
17460
  this.ctx = ctx;
15861
17461
  this.crypto = crypto;
15862
17462
  }
17463
+ /**
17464
+ * Constructs a signed `PackedUserOperation` that a solver can submit to the
17465
+ * Hyperbridge coprocessor as a bid to fill an order.
17466
+ *
17467
+ * The solver's signature covers a hash that binds the UserOperation to the
17468
+ * order commitment and the session key address, so the IntentGatewayV2
17469
+ * contract can verify the solver's intent on-chain.
17470
+ *
17471
+ * @param options - Parameters describing the solver account, gas limits, fee
17472
+ * market values, and pre-built `callData` for the fill operation.
17473
+ * @returns A `PackedUserOperation` with the solver's signature prepended
17474
+ * with the order commitment.
17475
+ */
15863
17476
  async prepareSubmitBid(options) {
15864
17477
  const {
15865
17478
  order,
@@ -15898,6 +17511,30 @@ var BidManager = class {
15898
17511
  const signature = concat([order.id, solverSignature]);
15899
17512
  return { ...userOp, signature };
15900
17513
  }
17514
+ /**
17515
+ * Selects the best available bid, simulates it on-chain, signs the
17516
+ * solver-selection EIP-712 message with the session key, and submits the
17517
+ * UserOperation to the bundler.
17518
+ *
17519
+ * **Selection algorithm:**
17520
+ * 1. Decodes `fillOrder` calldata from each bid's `callData`.
17521
+ * 2. Sorts bids by output value (single-output: amount; all-stables: normalised
17522
+ * USD; mixed: DEX-quoted USD; fallback: raw amount).
17523
+ * 3. Iterates sorted bids, simulating each with `eth_call` until one passes.
17524
+ * 4. Appends the session-key's `SelectSolver` signature to the solver's
17525
+ * existing signature and submits via `eth_sendUserOperation`.
17526
+ * 5. For same-chain orders, waits for the transaction receipt and reads
17527
+ * `OrderFilled` / `PartialFill` events to determine fill status.
17528
+ *
17529
+ * @param order - The placed order for which to select a bid.
17530
+ * @param bids - Raw bids fetched from the Hyperbridge coprocessor.
17531
+ * @param sessionPrivateKey - Optional override; if omitted, the key is
17532
+ * looked up from `sessionKeyStorage` using `order.session`.
17533
+ * @returns A {@link SelectBidResult} containing the submitted UserOperation,
17534
+ * its hash, the winning solver address, transaction hash, and fill status.
17535
+ * @throws If the session key is not found, no valid bids exist, all
17536
+ * simulations fail, or the bundler rejects the UserOperation.
17537
+ */
15901
17538
  async selectBid(order, bids, sessionPrivateKey) {
15902
17539
  const commitment = order.id;
15903
17540
  const sessionKeyAddress = order.session;
@@ -15989,6 +17626,7 @@ var BidManager = class {
15989
17626
  const userOpHash = bundlerResult;
15990
17627
  let txnHash;
15991
17628
  let fillStatus;
17629
+ let filledAmount;
15992
17630
  try {
15993
17631
  const receipt = await retryPromise(
15994
17632
  async () => {
@@ -16003,8 +17641,9 @@ var BidManager = class {
16003
17641
  txnHash = receipt.receipt.transactionHash;
16004
17642
  if (order.source === order.destination) {
16005
17643
  try {
16006
- const chainReceipt = await this.ctx.dest.client.getTransactionReceipt({
16007
- hash: txnHash
17644
+ const chainReceipt = await this.ctx.dest.client.waitForTransactionReceipt({
17645
+ hash: txnHash,
17646
+ confirmations: 1
16008
17647
  });
16009
17648
  const events = parseEventLogs({
16010
17649
  abi: ABI3,
@@ -16022,12 +17661,15 @@ var BidManager = class {
16022
17661
  fillStatus = "full";
16023
17662
  } else if (matched?.eventName === "PartialFill") {
16024
17663
  fillStatus = "partial";
17664
+ const outputs = matched.args.outputs ?? [];
17665
+ filledAmount = outputs.reduce((acc, o) => acc + o.amount, 0n);
16025
17666
  }
16026
17667
  } catch {
16027
17668
  throw new Error("Failed to determine fill status from logs");
16028
17669
  }
16029
17670
  }
16030
- } catch {
17671
+ } catch (err) {
17672
+ throw new Error(`Failed to select bid: ${err instanceof Error ? err.message : String(err)}`);
16031
17673
  }
16032
17674
  return {
16033
17675
  userOp: signedUserOp,
@@ -16035,9 +17677,24 @@ var BidManager = class {
16035
17677
  solverAddress,
16036
17678
  commitment,
16037
17679
  txnHash,
16038
- fillStatus
17680
+ fillStatus,
17681
+ filledAmount
16039
17682
  };
16040
17683
  }
17684
+ /**
17685
+ * Validates and sorts a list of raw bids for the given order.
17686
+ *
17687
+ * Delegates to one of three strategies based on the order's output token
17688
+ * composition:
17689
+ * - Single output token: sort by offered amount descending.
17690
+ * - All stable outputs (USDC/USDT): sort by normalised USD value descending.
17691
+ * - Mixed outputs: sort by DEX-quoted USD value descending, with a raw-amount
17692
+ * fallback if pricing fails.
17693
+ *
17694
+ * @param bids - Raw filler bids from the coprocessor.
17695
+ * @param order - The placed order whose output spec drives sorting logic.
17696
+ * @returns Sorted array of `{ bid, options }` pairs ready for simulation.
17697
+ */
16041
17698
  async validateAndSortBids(bids, order) {
16042
17699
  const outputs = order.output.assets;
16043
17700
  const decodedBids = this.decodeBids(bids);
@@ -16054,6 +17711,15 @@ var BidManager = class {
16054
17711
  console.log(`[BidManager] Using mixed-output sorting (${outputs.length} output assets, some non-stable)`);
16055
17712
  return this.sortMixedOutputs(decodedBids, outputs, chainId);
16056
17713
  }
17714
+ /**
17715
+ * Decodes the `fillOrder` fill-options from each bid's ERC-7821 calldata.
17716
+ *
17717
+ * Bids whose calldata cannot be decoded or do not contain a valid
17718
+ * `fillOrder` call are silently dropped with a warning.
17719
+ *
17720
+ * @param bids - Raw bids to decode.
17721
+ * @returns Array of successfully decoded `{ bid, options }` pairs.
17722
+ */
16057
17723
  decodeBids(bids) {
16058
17724
  const result = [];
16059
17725
  for (const bid of bids) {
@@ -16067,6 +17733,13 @@ var BidManager = class {
16067
17733
  console.log(`[BidManager] Decoded ${result.length}/${bids.length} bid(s) successfully`);
16068
17734
  return result;
16069
17735
  }
17736
+ /**
17737
+ * Extracts the `FillOptionsV2` struct from a single bid's ERC-7821
17738
+ * batch calldata by finding and decoding the inner `fillOrder` call.
17739
+ *
17740
+ * @param bid - A single filler bid.
17741
+ * @returns The decoded `FillOptionsV2`, or `null` if extraction fails.
17742
+ */
16070
17743
  decodeBidFillOptions(bid) {
16071
17744
  try {
16072
17745
  const innerCalls = this.crypto.decodeERC7821Execute(bid.userOp.callData);
@@ -16091,6 +17764,16 @@ var BidManager = class {
16091
17764
  }
16092
17765
  return null;
16093
17766
  }
17767
+ /**
17768
+ * Simulates a bid on-chain by batching the `select` and `fillOrder` calls
17769
+ * via `eth_call` from the solver's account, using the IntentGatewayV2
17770
+ * ERC-7821 batch-execute pattern.
17771
+ *
17772
+ * @param bid - The filler bid to simulate.
17773
+ * @param selectOptions - The signed solver-selection parameters.
17774
+ * @param intentGatewayV2Address - Address of the IntentGatewayV2 contract on the destination chain.
17775
+ * @throws If the `eth_call` simulation reverts or errors.
17776
+ */
16094
17777
  async simulate(bid, selectOptions, intentGatewayV2Address) {
16095
17778
  const solverAddress = bid.userOp.sender;
16096
17779
  const selectCalldata = encodeFunctionData({
@@ -16115,8 +17798,9 @@ var BidManager = class {
16115
17798
  }
16116
17799
  }
16117
17800
  /**
16118
- * Case A: single output token – keep existing behavior.
16119
- * Filter bids whose first output amount < required, sort descending.
17801
+ * Case A: single output token.
17802
+ * Filter bids by token match only, sort descending by amount.
17803
+ * Partial fill bids are allowed — the contract determines fill status.
16120
17804
  */
16121
17805
  sortSingleOutput(decodedBids, requiredAsset) {
16122
17806
  const requiredAmount = new Decimal3(requiredAsset.amount.toString());
@@ -16134,14 +17818,14 @@ var BidManager = class {
16134
17818
  continue;
16135
17819
  }
16136
17820
  if (bidAmount.lt(requiredAmount)) {
16137
- console.warn(
16138
- `[BidManager] Bid from solver=${bid.userOp.sender} REJECTED: amount too low (bid=${bidAmount.toString()}, required=${requiredAmount.toString()}, shortfall=${requiredAmount.minus(bidAmount).toString()})`
17821
+ console.log(
17822
+ `[BidManager] Bid from solver=${bid.userOp.sender}: partial fill candidate (bid=${bidAmount.toString()}, required=${requiredAmount.toString()}, covers=${bidAmount.div(requiredAmount).mul(100).toFixed(2)}%)`
17823
+ );
17824
+ } else {
17825
+ console.log(
17826
+ `[BidManager] Bid from solver=${bid.userOp.sender} ACCEPTED: amount=${bidAmount.toString()} (surplus=${bidAmount.minus(requiredAmount).toString()})`
16139
17827
  );
16140
- continue;
16141
17828
  }
16142
- console.log(
16143
- `[BidManager] Bid from solver=${bid.userOp.sender} ACCEPTED: amount=${bidAmount.toString()} (surplus=${bidAmount.minus(requiredAmount).toString()})`
16144
- );
16145
17829
  validBids.push({ bid, options, amount: bidOutput.amount });
16146
17830
  }
16147
17831
  validBids.sort((a, b) => {
@@ -16153,7 +17837,8 @@ var BidManager = class {
16153
17837
  }
16154
17838
  /**
16155
17839
  * Case B: all outputs are USDC/USDT.
16156
- * Sum normalised USD values (treating each stable as $1) and compare.
17840
+ * Sum normalised USD values (treating each stable as $1) and sort descending.
17841
+ * Partial fill bids are allowed.
16157
17842
  */
16158
17843
  sortAllStables(decodedBids, orderOutputs, chainId) {
16159
17844
  const requiredUsd = this.computeStablesUsdValue(orderOutputs, chainId);
@@ -16161,15 +17846,19 @@ var BidManager = class {
16161
17846
  const validBids = [];
16162
17847
  for (const { bid, options } of decodedBids) {
16163
17848
  const bidUsd = this.computeStablesUsdValue(options.outputs, chainId);
16164
- if (bidUsd === null || bidUsd.lt(requiredUsd)) {
16165
- console.warn(
16166
- `[BidManager] Bid from solver=${bid.userOp.sender} REJECTED: USD value too low (bid=${bidUsd?.toString() ?? "null"}, required=${requiredUsd.toString()})`
16167
- );
17849
+ if (bidUsd === null) {
17850
+ console.warn(`[BidManager] Bid from solver=${bid.userOp.sender} REJECTED: unable to compute USD value`);
16168
17851
  continue;
16169
17852
  }
16170
- console.log(
16171
- `[BidManager] Bid from solver=${bid.userOp.sender} ACCEPTED: USD value=${bidUsd.toString()}`
16172
- );
17853
+ if (bidUsd.lt(requiredUsd)) {
17854
+ console.log(
17855
+ `[BidManager] Bid from solver=${bid.userOp.sender}: partial fill candidate (bid=${bidUsd.toString()}, required=${requiredUsd.toString()}, covers=${bidUsd.div(requiredUsd).mul(100).toFixed(2)}%)`
17856
+ );
17857
+ } else {
17858
+ console.log(
17859
+ `[BidManager] Bid from solver=${bid.userOp.sender} ACCEPTED: USD value=${bidUsd.toString()}`
17860
+ );
17861
+ }
16173
17862
  validBids.push({ bid, options, usdValue: bidUsd });
16174
17863
  }
16175
17864
  validBids.sort((a, b) => b.usdValue.comparedTo(a.usdValue));
@@ -16178,7 +17867,7 @@ var BidManager = class {
16178
17867
  /**
16179
17868
  * Case C: mixed output tokens (at least one non-stable).
16180
17869
  * Price every token via on-chain DEX quotes, fall back to raw amounts
16181
- * if pricing is unavailable.
17870
+ * if pricing is unavailable. Partial fill bids are allowed.
16182
17871
  */
16183
17872
  async sortMixedOutputs(decodedBids, orderOutputs, chainId) {
16184
17873
  const requiredUsd = await this.computeOutputsUsdValue(orderOutputs, chainId);
@@ -16190,15 +17879,21 @@ var BidManager = class {
16190
17879
  const validBids = [];
16191
17880
  for (const { bid, options } of decodedBids) {
16192
17881
  const bidUsd = await this.computeOutputsUsdValue(options.outputs, chainId);
16193
- if (bidUsd === null || bidUsd.lt(requiredUsd)) {
17882
+ if (bidUsd === null) {
16194
17883
  console.warn(
16195
- `[BidManager] Bid from solver=${bid.userOp.sender} REJECTED: mixed USD value too low (bid=${bidUsd?.toString() ?? "unpriceable"}, required=${requiredUsd.toString()})`
17884
+ `[BidManager] Bid from solver=${bid.userOp.sender} REJECTED: unable to price mixed outputs`
16196
17885
  );
16197
17886
  continue;
16198
17887
  }
16199
- console.log(
16200
- `[BidManager] Bid from solver=${bid.userOp.sender} ACCEPTED: mixed USD value=${bidUsd.toString()}`
16201
- );
17888
+ if (bidUsd.lt(requiredUsd)) {
17889
+ console.log(
17890
+ `[BidManager] Bid from solver=${bid.userOp.sender}: partial fill candidate (bid=${bidUsd.toString()}, required=${requiredUsd.toString()}, covers=${bidUsd.div(requiredUsd).mul(100).toFixed(2)}%)`
17891
+ );
17892
+ } else {
17893
+ console.log(
17894
+ `[BidManager] Bid from solver=${bid.userOp.sender} ACCEPTED: mixed USD value=${bidUsd.toString()}`
17895
+ );
17896
+ }
16202
17897
  validBids.push({ bid, options, usdValue: bidUsd });
16203
17898
  }
16204
17899
  validBids.sort((a, b) => b.usdValue.comparedTo(a.usdValue));
@@ -16206,16 +17901,18 @@ var BidManager = class {
16206
17901
  }
16207
17902
  /**
16208
17903
  * Fallback when DEX pricing is unavailable.
16209
- * Computes the total spread (sum of extra amount above required per token)
16210
- * for each bid. Bids that don't meet every token's minimum are discarded.
16211
- * Remaining bids are sorted by total spread descending.
17904
+ * Computes total spread per bid. Bids missing a required token are rejected.
17905
+ * Bids offering less than required for a token are allowed (partial fill).
17906
+ * Sorted by total offered amount descending.
16212
17907
  */
16213
17908
  sortByRawAmountFallback(decodedBids, orderOutputs) {
16214
- console.log(`[BidManager] sortByRawAmountFallback: checking ${decodedBids.length} bid(s) against ${orderOutputs.length} required output(s)`);
17909
+ console.log(
17910
+ `[BidManager] sortByRawAmountFallback: checking ${decodedBids.length} bid(s) against ${orderOutputs.length} required output(s)`
17911
+ );
16215
17912
  const validBids = [];
16216
17913
  for (const { bid, options } of decodedBids) {
16217
17914
  let valid = true;
16218
- let totalSpread = new Decimal3(0);
17915
+ let totalOffered = new Decimal3(0);
16219
17916
  let rejectReason = "";
16220
17917
  for (const required of orderOutputs) {
16221
17918
  const matching = options.outputs.find((o) => o.token.toLowerCase() === required.token.toLowerCase());
@@ -16224,28 +17921,37 @@ var BidManager = class {
16224
17921
  rejectReason = `missing output token=${required.token}`;
16225
17922
  break;
16226
17923
  }
16227
- if (matching.amount < required.amount) {
16228
- valid = false;
16229
- rejectReason = `token=${required.token} amount too low (bid=${matching.amount.toString()}, required=${required.amount.toString()})`;
16230
- break;
16231
- }
16232
- totalSpread = totalSpread.plus(
16233
- new Decimal3(matching.amount.toString()).minus(required.amount.toString())
16234
- );
17924
+ totalOffered = totalOffered.plus(new Decimal3(matching.amount.toString()));
16235
17925
  }
16236
17926
  if (!valid) {
16237
17927
  console.warn(`[BidManager] Bid from solver=${bid.userOp.sender} REJECTED (fallback): ${rejectReason}`);
16238
17928
  continue;
16239
17929
  }
16240
- console.log(
16241
- `[BidManager] Bid from solver=${bid.userOp.sender} ACCEPTED (fallback): totalSpread=${totalSpread.toString()}`
17930
+ const totalRequired = orderOutputs.reduce(
17931
+ (acc, o) => acc.plus(new Decimal3(o.amount.toString())),
17932
+ new Decimal3(0)
16242
17933
  );
16243
- validBids.push({ bid, options, totalSpread });
17934
+ if (totalOffered.lt(totalRequired)) {
17935
+ console.log(
17936
+ `[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)}%)`
17937
+ );
17938
+ } else {
17939
+ console.log(
17940
+ `[BidManager] Bid from solver=${bid.userOp.sender} ACCEPTED (fallback): totalOffered=${totalOffered.toString()}`
17941
+ );
17942
+ }
17943
+ validBids.push({ bid, options, totalOffered });
16244
17944
  }
16245
- validBids.sort((a, b) => b.totalSpread.comparedTo(a.totalSpread));
16246
- return validBids.map(({ totalSpread: _, ...rest }) => rest);
17945
+ validBids.sort((a, b) => b.totalOffered.comparedTo(a.totalOffered));
17946
+ return validBids.map(({ totalOffered: _, ...rest }) => rest);
16247
17947
  }
16248
17948
  // ── Token classification helpers ──────────────────────────────────
17949
+ /**
17950
+ * Returns `true` if `tokenAddr` is either USDC or USDT on the given chain.
17951
+ *
17952
+ * @param tokenAddr - 20-byte ERC-20 token address (hex).
17953
+ * @param chainId - State-machine ID of the chain to look up token addresses on.
17954
+ */
16249
17955
  isStableToken(tokenAddr, chainId) {
16250
17956
  const configService = this.ctx.dest.configService;
16251
17957
  const usdc = configService.getUsdcAsset(chainId);
@@ -16253,6 +17959,14 @@ var BidManager = class {
16253
17959
  const normalized = tokenAddr.toLowerCase();
16254
17960
  return normalized === usdc.toLowerCase() || normalized === usdt.toLowerCase();
16255
17961
  }
17962
+ /**
17963
+ * Returns the ERC-20 decimal count for a known stable token (USDC or USDT)
17964
+ * on the given chain.
17965
+ *
17966
+ * @param tokenAddr - 20-byte token address (hex).
17967
+ * @param chainId - State-machine ID of the chain.
17968
+ * @returns Decimal count (e.g. 6 for USDC on most chains).
17969
+ */
16256
17970
  getStableDecimals(tokenAddr, chainId) {
16257
17971
  const configService = this.ctx.dest.configService;
16258
17972
  if (tokenAddr.toLowerCase() === configService.getUsdcAsset(chainId).toLowerCase()) {
@@ -16261,6 +17975,14 @@ var BidManager = class {
16261
17975
  return configService.getUsdtDecimals(chainId);
16262
17976
  }
16263
17977
  // ── Basket valuation helpers ──────────────────────────────────────
17978
+ /**
17979
+ * Sums the USD value of a basket of stable tokens (USDC/USDT only),
17980
+ * normalising each amount by its decimal count and treating each token as $1.
17981
+ *
17982
+ * @param outputs - List of token/amount pairs where every token is a stable.
17983
+ * @param chainId - State-machine ID used to look up decimals.
17984
+ * @returns Total USD value as a `Decimal`.
17985
+ */
16264
17986
  computeStablesUsdValue(outputs, chainId) {
16265
17987
  let total = new Decimal3(0);
16266
17988
  for (const output of outputs) {
@@ -16355,10 +18077,40 @@ var BidManager = class {
16355
18077
  }
16356
18078
  };
16357
18079
  var GasEstimator = class {
18080
+ /**
18081
+ * @param ctx - Shared IntentsV2 context providing the source and destination
18082
+ * chain clients, config service, bundler URL, and solver-code cache.
18083
+ * @param crypto - Crypto utilities used for UserOp construction, signing,
18084
+ * gas packing, and bundler calls.
18085
+ */
16358
18086
  constructor(ctx, crypto) {
16359
18087
  this.ctx = ctx;
16360
18088
  this.crypto = crypto;
16361
18089
  }
18090
+ /**
18091
+ * Estimates the gas cost for a solver to fill the given order and returns
18092
+ * a structured estimate with individual gas components and total costs in
18093
+ * both wei and fee-token units.
18094
+ *
18095
+ * **Cross-chain orders:** also estimates the ISMP POST request fee required
18096
+ * for the solver to trigger source-chain escrow redemption after filling, and
18097
+ * includes it in `fillOptions.relayerFee` and `fillOptions.nativeDispatchFee`.
18098
+ *
18099
+ * **Bundler path:** constructs a mock `PackedUserOperation` signed by an
18100
+ * ephemeral keypair, applies state overrides, and calls
18101
+ * `eth_estimateUserOperationGas`. Gas limits are bumped by 5-10% for
18102
+ * headroom. If the bundler is Pimlico, gas prices are refined with
18103
+ * `pimlico_getUserOperationGasPrice`.
18104
+ *
18105
+ * **Fallback path (no bundler):** calls `estimateContractGas` directly on
18106
+ * `fillOrder` with state overrides.
18107
+ *
18108
+ * @param params - Parameters including the order to estimate and optional
18109
+ * percentage bumps for `maxPriorityFeePerGas` and `maxFeePerGas`.
18110
+ * @returns A {@link FillOrderEstimateV2} containing all gas components,
18111
+ * EIP-1559 fee values, total cost in wei, and total cost in the source
18112
+ * chain's fee token.
18113
+ */
16362
18114
  async estimateFillOrderV2(params) {
16363
18115
  const { order } = params;
16364
18116
  const solverPrivateKey = generatePrivateKey();
@@ -16405,7 +18157,7 @@ var GasEstimator = class {
16405
18157
  dest: souceStateMachineId,
16406
18158
  body: constructRedeemEscrowRequestBody({ ...order, id: orderV2Commitment(order) }, MOCK_ADDRESS),
16407
18159
  timeoutTimestamp: 0n,
16408
- nonce: await this.ctx.source.getHostNonce(),
18160
+ nonce: await this.ctx.dest.getHostNonce(),
16409
18161
  from: this.ctx.source.configService.getIntentGatewayV2Address(destStateMachineId),
16410
18162
  to: this.ctx.source.configService.getIntentGatewayV2Address(souceStateMachineId)
16411
18163
  };
@@ -16548,6 +18300,32 @@ var GasEstimator = class {
16548
18300
  fillOptions
16549
18301
  };
16550
18302
  }
18303
+ /**
18304
+ * Builds EVM state override objects for gas estimation of the `fillOrder`
18305
+ * call, granting the solver account sufficient balances, allowances, and
18306
+ * EntryPoint deposits so the estimation does not revert due to missing funds.
18307
+ *
18308
+ * Returns two formats of the same overrides:
18309
+ * - `viem`: array format compatible with viem's `stateOverride` parameter.
18310
+ * - `bundler`: object format compatible with the ERC-4337 bundler's
18311
+ * `eth_estimateUserOperationGas` state-override parameter.
18312
+ *
18313
+ * Optionally injects known solver account bytecode (from `solverCodeCache`)
18314
+ * so the mock EOA used for estimation behaves like a real solver smart account.
18315
+ *
18316
+ * @param params.accountAddress - Address of the mock solver account.
18317
+ * @param params.chain - State-machine ID of the destination chain.
18318
+ * @param params.outputAssets - Token/amount pairs whose balance and allowance
18319
+ * slots should be overridden.
18320
+ * @param params.spenderAddress - Address that needs allowance from the solver
18321
+ * account (i.e. the IntentGatewayV2 contract).
18322
+ * @param params.intentGatewayV2Address - If provided, overrides slot 5 of
18323
+ * IntentGatewayV2 with the call-dispatcher address so dispatch calls
18324
+ * succeed during estimation.
18325
+ * @param params.entryPointAddress - If provided, overrides the EntryPoint
18326
+ * deposit mapping to give the solver account a large deposit.
18327
+ * @returns An object with `viem` and `bundler` state-override collections.
18328
+ */
16551
18329
  async buildStateOverride(params) {
16552
18330
  const { accountAddress, chain, outputAssets, spenderAddress, intentGatewayV2Address, entryPointAddress } = params;
16553
18331
  const testValue = toHex(maxUint256 / 2n, { size: 32 });
@@ -16641,6 +18419,17 @@ var GasEstimator = class {
16641
18419
  }
16642
18420
  return { viem: viemOverrides, bundler: bundlerOverrides };
16643
18421
  }
18422
+ /**
18423
+ * Quotes the native token cost of dispatching an ISMP POST request through
18424
+ * the IntentGateway (v1) `quoteNative` function.
18425
+ *
18426
+ * Uses the v1 IntentGateway ABI (not IntentGatewayV2) because the dispatch
18427
+ * call is routed through the legacy gateway contract.
18428
+ *
18429
+ * @param postRequest - The ISMP POST request to quote.
18430
+ * @param fee - The relayer fee (in dest fee token) to include in the quote.
18431
+ * @returns The native token amount required to dispatch the request.
18432
+ */
16644
18433
  async quoteNative(postRequest, fee) {
16645
18434
  const dispatchPost = {
16646
18435
  dest: toHex(postRequest.dest),
@@ -16659,6 +18448,10 @@ var GasEstimator = class {
16659
18448
  }
16660
18449
  };
16661
18450
  var OrderStatusChecker = class {
18451
+ /**
18452
+ * @param ctx - Shared IntentsV2 context providing the source and destination
18453
+ * chain clients and config service.
18454
+ */
16662
18455
  constructor(ctx) {
16663
18456
  this.ctx = ctx;
16664
18457
  }
@@ -16721,18 +18514,41 @@ var OrderStatusChecker = class {
16721
18514
 
16722
18515
  // src/protocols/intentsV2/IntentsV2.ts
16723
18516
  var IntentsV2 = class _IntentsV2 {
18517
+ /** EVM chain on which orders are placed and escrowed. */
16724
18518
  source;
18519
+ /** EVM chain on which solvers fill orders and deliver outputs. */
16725
18520
  dest;
18521
+ /** Optional Hyperbridge coprocessor client for bid fetching and UserOp submission. */
16726
18522
  intentsCoprocessor;
18523
+ /** Optional ERC-4337 bundler URL for gas estimation and UserOp broadcasting. */
16727
18524
  bundlerUrl;
18525
+ /** Shared context object passed to all sub-modules. */
16728
18526
  ctx;
18527
+ /** Crypto and encoding utilities (EIP-712, gas packing, bundler calls). */
16729
18528
  _crypto;
18529
+ /** Handles `placeOrder` calldata generation and session-key management. */
16730
18530
  orderPlacer;
18531
+ /** Drives the bid-polling and UserOp-submission loop after order placement. */
16731
18532
  orderExecutor;
18533
+ /** Manages source- and destination-initiated order cancellation flows. */
16732
18534
  orderCanceller;
18535
+ /** Reads fill and refund status from on-chain storage. */
16733
18536
  orderStatusChecker;
18537
+ /** Validates, sorts, simulates, and submits solver bids. */
16734
18538
  bidManager;
18539
+ /** Estimates gas costs for filling an order and converts them to fee-token amounts. */
16735
18540
  gasEstimator;
18541
+ /**
18542
+ * Private constructor — use {@link IntentsV2.create} instead.
18543
+ *
18544
+ * Initialises all sub-modules and the shared context, including storage
18545
+ * adapters, fee-token and solver-code caches, and the DEX-quote utility.
18546
+ *
18547
+ * @param source - Source chain client.
18548
+ * @param dest - Destination chain client.
18549
+ * @param intentsCoprocessor - Optional coprocessor for bid fetching.
18550
+ * @param bundlerUrl - Optional ERC-4337 bundler endpoint URL.
18551
+ */
16736
18552
  constructor(source, dest, intentsCoprocessor, bundlerUrl) {
16737
18553
  this.source = source;
16738
18554
  this.dest = dest;
@@ -16740,6 +18556,7 @@ var IntentsV2 = class _IntentsV2 {
16740
18556
  this.bundlerUrl = bundlerUrl;
16741
18557
  const sessionKeyStorage = createSessionKeyStorage();
16742
18558
  const cancellationStorage = createCancellationStorage();
18559
+ const usedUserOpsStorage = createUsedUserOpsStorage();
16743
18560
  const swap = new Swap();
16744
18561
  const feeTokenCache = /* @__PURE__ */ new Map();
16745
18562
  const solverCodeCache = /* @__PURE__ */ new Map();
@@ -16752,13 +18569,14 @@ var IntentsV2 = class _IntentsV2 {
16752
18569
  solverCodeCache,
16753
18570
  sessionKeyStorage,
16754
18571
  cancellationStorage,
18572
+ usedUserOpsStorage,
16755
18573
  swap
16756
18574
  };
16757
18575
  const crypto = new CryptoUtils(this.ctx);
16758
18576
  const bidManager = new BidManager(this.ctx, crypto);
16759
18577
  const gasEstimator = new GasEstimator(this.ctx, crypto);
16760
18578
  this.orderPlacer = new OrderPlacer(this.ctx);
16761
- this.orderExecutor = new OrderExecutor(this.ctx, bidManager);
18579
+ this.orderExecutor = new OrderExecutor(this.ctx, bidManager, crypto);
16762
18580
  this.orderCanceller = new OrderCanceller(this.ctx);
16763
18581
  this.orderStatusChecker = new OrderStatusChecker(this.ctx);
16764
18582
  this.bidManager = bidManager;
@@ -16768,6 +18586,10 @@ var IntentsV2 = class _IntentsV2 {
16768
18586
  /**
16769
18587
  * Creates an initialized IntentsV2 instance.
16770
18588
  *
18589
+ * Fetches the fee tokens for both chains and optionally caches the solver
18590
+ * account bytecode before returning, so the instance is ready for use
18591
+ * without additional warm-up calls.
18592
+ *
16771
18593
  * @param source - Source chain for order placement
16772
18594
  * @param dest - Destination chain for order fulfillment
16773
18595
  * @param intentsCoprocessor - Optional coprocessor for bid fetching and order execution
@@ -16779,6 +18601,12 @@ var IntentsV2 = class _IntentsV2 {
16779
18601
  await instance.init();
16780
18602
  return instance;
16781
18603
  }
18604
+ /**
18605
+ * Pre-warms the fee-token cache for both chains and attempts to load the
18606
+ * solver account bytecode into the solver-code cache.
18607
+ *
18608
+ * Called automatically by {@link IntentsV2.create}; not intended for direct use.
18609
+ */
16782
18610
  async init() {
16783
18611
  const now = Date.now();
16784
18612
  const sourceFeeToken = await this.source.getFeeTokenWithDecimals();
@@ -16796,8 +18624,36 @@ var IntentsV2 = class _IntentsV2 {
16796
18624
  }
16797
18625
  }
16798
18626
  }
18627
+ /**
18628
+ * Bidirectional async generator that orchestrates the full order lifecycle:
18629
+ * placement, fee estimation, bid collection, and execution.
18630
+ *
18631
+ * **Yield/receive protocol:**
18632
+ * 1. If `order.fees` is unset or zero, estimates gas and sets `order.fees`
18633
+ * with a 1% buffer and the wei cost with a 2% buffer for the `value` field.
18634
+ * 2. Yields `AWAITING_PLACE_ORDER` with `{ to, data, value, sessionPrivateKey }`.
18635
+ * The caller must sign the transaction and pass it back via `gen.next(signedTx)`.
18636
+ * 3. Yields `ORDER_PLACED` with the finalised order and transaction hash once
18637
+ * the `OrderPlaced` event is confirmed.
18638
+ * 4. Delegates to {@link OrderExecutor.executeIntentOrder} and forwards all
18639
+ * subsequent status updates until the order is filled, exhausted, or fails.
18640
+ *
18641
+ * @param order - The order to place and execute. `order.fees` may be 0; it
18642
+ * will be estimated automatically if so.
18643
+ * @param graffiti - Optional bytes32 tag for orderflow attribution /
18644
+ * revenue share. Defaults to {@link DEFAULT_GRAFFITI}.
18645
+ * @param options - Optional tuning parameters:
18646
+ * - `maxPriorityFeePerGasBumpPercent` — bump % for the priority fee estimate (default 8).
18647
+ * - `maxFeePerGasBumpPercent` — bump % for the max fee estimate (default 10).
18648
+ * - `minBids` — minimum bids to collect before selecting (default 1).
18649
+ * - `bidTimeoutMs` — how long to poll for bids before giving up (default 60 000 ms).
18650
+ * - `pollIntervalMs` — interval between bid-polling attempts.
18651
+ * @yields {@link IntentOrderStatusUpdate} at each lifecycle stage.
18652
+ * @throws If the `placeOrder` generator behaves unexpectedly, or if gas
18653
+ * estimation returns zero.
18654
+ */
16799
18655
  async *execute(order, graffiti = DEFAULT_GRAFFITI, options) {
16800
- let feesInWei;
18656
+ let value;
16801
18657
  if (!order.fees || order.fees === 0n) {
16802
18658
  const estimate = await this.gasEstimator.estimateFillOrderV2({
16803
18659
  order,
@@ -16807,7 +18663,7 @@ var IntentsV2 = class _IntentsV2 {
16807
18663
  if (estimate.totalGasCostWei === 0n || estimate.totalGasInFeeToken === 0n) {
16808
18664
  throw new Error("Gas estimation failed");
16809
18665
  }
16810
- feesInWei = estimate.totalGasCostWei + estimate.totalGasCostWei * 2n / 100n;
18666
+ value = estimate.totalGasCostWei + estimate.totalGasCostWei * 2n / 100n;
16811
18667
  order.fees = estimate.totalGasInFeeToken + estimate.totalGasInFeeToken * 1n / 100n;
16812
18668
  }
16813
18669
  const placeOrderGen = this.orderPlacer.placeOrder(order, graffiti);
@@ -16815,13 +18671,14 @@ var IntentsV2 = class _IntentsV2 {
16815
18671
  if (placeOrderFirst.done) {
16816
18672
  throw new Error("placeOrder generator completed without yielding");
16817
18673
  }
16818
- const { calldata, sessionPrivateKey } = placeOrderFirst.value;
16819
- const signedTransaction = yield { calldata, feesInWei, sessionPrivateKey };
18674
+ const { to, data, sessionPrivateKey } = placeOrderFirst.value;
18675
+ const signedTransaction = yield { status: "AWAITING_PLACE_ORDER", to, data, value, sessionPrivateKey };
16820
18676
  const placeOrderSecond = await placeOrderGen.next(signedTransaction);
16821
18677
  if (placeOrderSecond.done === false) {
16822
18678
  throw new Error("placeOrder generator yielded unexpectedly after signing");
16823
18679
  }
16824
- const finalizedOrder = placeOrderSecond.value;
18680
+ const { order: finalizedOrder, transactionHash } = placeOrderSecond.value;
18681
+ yield { status: "ORDER_PLACED", order: finalizedOrder, transactionHash };
16825
18682
  for await (const status of this.orderExecutor.executeIntentOrder({
16826
18683
  order: finalizedOrder,
16827
18684
  sessionPrivateKey,
@@ -16831,37 +18688,121 @@ var IntentsV2 = class _IntentsV2 {
16831
18688
  })) {
16832
18689
  yield status;
16833
18690
  }
18691
+ return;
16834
18692
  }
16835
- async *placeOrder(order, graffiti = DEFAULT_GRAFFITI) {
16836
- return yield* this.orderPlacer.placeOrder(order, graffiti);
16837
- }
16838
- async *executeIntentOrder(options) {
16839
- yield* this.orderExecutor.executeIntentOrder(options);
16840
- }
18693
+ /**
18694
+ * Quotes the native token cost for cancelling an order.
18695
+ *
18696
+ * Delegates to {@link OrderCanceller.quoteCancelNative}.
18697
+ *
18698
+ * @param order - The order to quote cancellation for.
18699
+ * @param from - Chain side that initiates the cancel (`"source"` or `"dest"`).
18700
+ * Defaults to `"source"`.
18701
+ * @returns The native token amount required to submit the cancel transaction.
18702
+ */
16841
18703
  async quoteCancelNative(order, from = "source") {
16842
18704
  return this.orderCanceller.quoteCancelNative(order, from);
16843
18705
  }
18706
+ /**
18707
+ * Async generator that cancels an order and streams status events until
18708
+ * cancellation is complete.
18709
+ *
18710
+ * Delegates to {@link OrderCanceller.cancelOrder}.
18711
+ *
18712
+ * @param order - The order to cancel.
18713
+ * @param indexerClient - Indexer client used for ISMP request status streaming.
18714
+ * @param from - Chain side that initiates the cancel. Defaults to `"source"`.
18715
+ * @yields {@link CancelEvent} objects describing each cancellation stage.
18716
+ */
16844
18717
  async *cancelOrder(order, indexerClient, from = "source") {
16845
18718
  yield* this.orderCanceller.cancelOrder(order, indexerClient, from);
16846
18719
  }
18720
+ /**
18721
+ * Constructs a signed `PackedUserOperation` for a solver to submit as a bid.
18722
+ *
18723
+ * Delegates to {@link BidManager.prepareSubmitBid}.
18724
+ *
18725
+ * @param options - Bid parameters including order, solver account, gas limits,
18726
+ * fee market values, and pre-built fill calldata.
18727
+ * @returns A fully signed `PackedUserOperation` ready for submission.
18728
+ */
16847
18729
  async prepareSubmitBid(options) {
16848
18730
  return this.bidManager.prepareSubmitBid(options);
16849
18731
  }
18732
+ /**
18733
+ * Selects the best available bid, simulates it, and submits the UserOperation
18734
+ * to the bundler.
18735
+ *
18736
+ * Delegates to {@link BidManager.selectBid}.
18737
+ *
18738
+ * @param order - The placed order to fill.
18739
+ * @param bids - Raw filler bids fetched from the coprocessor.
18740
+ * @param sessionPrivateKey - Optional session key override; looked up from
18741
+ * storage if omitted.
18742
+ * @returns A {@link SelectBidResult} with the submitted UserOperation, hashes,
18743
+ * and fill status.
18744
+ */
16850
18745
  async selectBid(order, bids, sessionPrivateKey) {
16851
18746
  return this.bidManager.selectBid(order, bids, sessionPrivateKey);
16852
18747
  }
18748
+ /**
18749
+ * Estimates the gas cost for filling the given order, returning individual
18750
+ * gas components and fee-token-denominated totals.
18751
+ *
18752
+ * Delegates to {@link GasEstimator.estimateFillOrderV2}.
18753
+ *
18754
+ * @param params - Estimation parameters including the order and optional
18755
+ * gas-price bump percentages.
18756
+ * @returns A {@link FillOrderEstimateV2} with all gas components.
18757
+ */
16853
18758
  async estimateFillOrderV2(params) {
16854
18759
  return this.gasEstimator.estimateFillOrderV2(params);
16855
18760
  }
18761
+ /**
18762
+ * Encodes a list of calls into ERC-7821 `execute` calldata using
18763
+ * single-batch mode.
18764
+ *
18765
+ * Delegates to {@link CryptoUtils.encodeERC7821Execute}.
18766
+ *
18767
+ * @param calls - Ordered list of calls to batch.
18768
+ * @returns ABI-encoded calldata for the ERC-7821 `execute` function.
18769
+ */
16856
18770
  encodeERC7821Execute(calls) {
16857
18771
  return this._crypto.encodeERC7821Execute(calls);
16858
18772
  }
18773
+ /**
18774
+ * Decodes ERC-7821 `execute` calldata back into its constituent calls.
18775
+ *
18776
+ * Delegates to {@link CryptoUtils.decodeERC7821Execute}.
18777
+ *
18778
+ * @param callData - Hex-encoded calldata to decode.
18779
+ * @returns Array of decoded {@link ERC7821Call} objects, or `null` on failure.
18780
+ */
16859
18781
  decodeERC7821Execute(callData) {
16860
18782
  return this._crypto.decodeERC7821Execute(callData);
16861
18783
  }
18784
+ /**
18785
+ * Checks whether an order has been filled on the destination chain.
18786
+ *
18787
+ * Delegates to {@link OrderStatusChecker.isOrderFilled}.
18788
+ *
18789
+ * @param order - The order to check.
18790
+ * @returns `true` if the order's commitment slot on the destination chain is
18791
+ * non-zero (i.e. `fillOrder` has been called successfully).
18792
+ */
16862
18793
  async isOrderFilled(order) {
16863
18794
  return this.orderStatusChecker.isOrderFilled(order);
16864
18795
  }
18796
+ /**
18797
+ * Checks whether all escrowed inputs for an order have been refunded on the
18798
+ * source chain.
18799
+ *
18800
+ * Delegates to {@link OrderStatusChecker.isOrderRefunded}.
18801
+ *
18802
+ * @param order - The order to check.
18803
+ * @returns `true` if every input token's escrowed amount has been zeroed out
18804
+ * in the `_orders` mapping on the source chain.
18805
+ */
16865
18806
  async isOrderRefunded(order) {
16866
18807
  return this.orderStatusChecker.isOrderRefunded(order);
16867
18808
  }
@@ -17316,6 +19257,6 @@ async function teleportDot(param_) {
17316
19257
  return stream;
17317
19258
  }
17318
19259
 
17319
- 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 };
19260
+ 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 };
17320
19261
  //# sourceMappingURL=index.js.map
17321
19262
  //# sourceMappingURL=index.js.map