@moonbeam-network/xcm-builder 1.0.0-dev.263 → 1.0.0-dev.265

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.mjs CHANGED
@@ -92,6 +92,7 @@ var BaseConfig = class {
92
92
  // src/types/substrate/SubstrateQueryConfig.ts
93
93
  var SubstrateQueryConfig = class _SubstrateQueryConfig extends BaseConfig {
94
94
  args;
95
+ queryType;
95
96
  transform;
96
97
  static is(obj) {
97
98
  return obj instanceof _SubstrateQueryConfig;
@@ -99,10 +100,12 @@ var SubstrateQueryConfig = class _SubstrateQueryConfig extends BaseConfig {
99
100
  constructor({
100
101
  args = [],
101
102
  transform,
103
+ queryType = "query",
102
104
  ...other
103
105
  }) {
104
106
  super({ ...other });
105
107
  this.args = args;
108
+ this.queryType = queryType;
106
109
  this.transform = transform;
107
110
  }
108
111
  };
@@ -116,11 +119,11 @@ function AssetMinBuilder() {
116
119
  };
117
120
  }
118
121
  function assetRegistry() {
119
- const pallet6 = "assetRegistry";
122
+ const pallet8 = "assetRegistry";
120
123
  return {
121
124
  assetMetadatas: () => ({
122
125
  build: ({ asset }) => new SubstrateQueryConfig({
123
- module: pallet6,
126
+ module: pallet8,
124
127
  func: "assetMetadatas",
125
128
  args: [asset],
126
129
  // biome-ignore lint/suspicious/noExplicitAny: not sure how to fix this
@@ -129,7 +132,7 @@ function assetRegistry() {
129
132
  }),
130
133
  currencyMetadatas: () => ({
131
134
  build: ({ asset }) => new SubstrateQueryConfig({
132
- module: pallet6,
135
+ module: pallet8,
133
136
  func: "currencyMetadatas",
134
137
  args: [asset],
135
138
  // biome-ignore lint/suspicious/noExplicitAny: not sure how to fix this
@@ -138,7 +141,7 @@ function assetRegistry() {
138
141
  }),
139
142
  metadata: () => ({
140
143
  build: ({ asset }) => new SubstrateQueryConfig({
141
- module: pallet6,
144
+ module: pallet8,
142
145
  func: "metadata",
143
146
  args: [asset],
144
147
  // biome-ignore lint/suspicious/noExplicitAny: not sure how to fix this
@@ -202,8 +205,8 @@ import { encodeFunctionData } from "viem";
202
205
  var ContractConfig = class _ContractConfig extends BaseConfig {
203
206
  address;
204
207
  abi;
205
- // biome-ignore lint/suspicious/noExplicitAny: not sure how to fix this
206
208
  args;
209
+ value;
207
210
  static is(obj) {
208
211
  return obj instanceof _ContractConfig;
209
212
  }
@@ -211,12 +214,14 @@ var ContractConfig = class _ContractConfig extends BaseConfig {
211
214
  address,
212
215
  abi,
213
216
  args,
217
+ value,
214
218
  ...other
215
219
  }) {
216
220
  super({ ...other });
217
221
  this.address = address;
218
222
  this.abi = abi;
219
223
  this.args = args;
224
+ this.value = value;
220
225
  }
221
226
  encodeFunctionData() {
222
227
  return encodeFunctionData({
@@ -3083,41 +3088,887 @@ function xTransfer() {
3083
3088
  }
3084
3089
  },
3085
3090
  {
3086
- parents: 1,
3087
- interior: {
3088
- X2: [
3089
- {
3090
- Parachain: destination.parachainId
3091
- },
3092
- getExtrinsicAccount(destinationAddress)
3093
- ]
3094
- }
3091
+ parents: 1,
3092
+ interior: {
3093
+ X2: [
3094
+ {
3095
+ Parachain: destination.parachainId
3096
+ },
3097
+ getExtrinsicAccount(destinationAddress)
3098
+ ]
3099
+ }
3100
+ },
3101
+ {
3102
+ refTime: 5e9,
3103
+ proofSize: 0
3104
+ }
3105
+ ]
3106
+ })
3107
+ })
3108
+ };
3109
+ }
3110
+ };
3111
+ }
3112
+
3113
+ // src/extrinsic/ExtrinsicBuilder.ts
3114
+ function ExtrinsicBuilder() {
3115
+ return {
3116
+ eqBalances,
3117
+ xTokens,
3118
+ xTransfer,
3119
+ polkadotXcm,
3120
+ xcmPallet
3121
+ };
3122
+ }
3123
+
3124
+ // src/fee/gateway/gateway.ts
3125
+ import { EvmParachain as EvmParachain2 } from "@moonbeam-network/xcm-types";
3126
+
3127
+ // src/mrl/providers/snowbridge/contract/Gateway/GatewayAbi.ts
3128
+ var GATEWAY_ABI = [
3129
+ {
3130
+ inputs: [
3131
+ { internalType: "address", name: "beefyClient", type: "address" },
3132
+ { internalType: "address", name: "agentExecutor", type: "address" },
3133
+ { internalType: "ParaID", name: "bridgeHubParaID", type: "uint32" },
3134
+ { internalType: "bytes32", name: "bridgeHubAgentID", type: "bytes32" },
3135
+ { internalType: "uint8", name: "foreignTokenDecimals", type: "uint8" },
3136
+ { internalType: "uint128", name: "maxDestinationFee", type: "uint128" }
3137
+ ],
3138
+ stateMutability: "nonpayable",
3139
+ type: "constructor"
3140
+ },
3141
+ { inputs: [], name: "AgentAlreadyCreated", type: "error" },
3142
+ { inputs: [], name: "AgentDoesNotExist", type: "error" },
3143
+ { inputs: [], name: "CantSetMiddlewareToSameAddress", type: "error" },
3144
+ { inputs: [], name: "CantSetMiddlewareToZeroAddress", type: "error" },
3145
+ { inputs: [], name: "ChannelAlreadyCreated", type: "error" },
3146
+ { inputs: [], name: "ChannelDoesNotExist", type: "error" },
3147
+ { inputs: [], name: "Disabled", type: "error" },
3148
+ {
3149
+ inputs: [
3150
+ { internalType: "uint256", name: "epoch", type: "uint256" },
3151
+ { internalType: "uint256", name: "eraIndex", type: "uint256" },
3152
+ { internalType: "address", name: "tokenAddress", type: "address" },
3153
+ { internalType: "uint256", name: "totalPointsToken", type: "uint256" },
3154
+ { internalType: "uint256", name: "totalTokensInflated", type: "uint256" },
3155
+ { internalType: "bytes32", name: "rewardsRoot", type: "bytes32" },
3156
+ { internalType: "bytes", name: "errorBytes", type: "bytes" }
3157
+ ],
3158
+ name: "EUnableToProcessRewardsB",
3159
+ type: "error"
3160
+ },
3161
+ {
3162
+ inputs: [
3163
+ { internalType: "uint256", name: "epoch", type: "uint256" },
3164
+ { internalType: "uint256", name: "eraIndex", type: "uint256" },
3165
+ { internalType: "address", name: "tokenAddress", type: "address" },
3166
+ { internalType: "uint256", name: "totalPointsToken", type: "uint256" },
3167
+ { internalType: "uint256", name: "totalTokensInflated", type: "uint256" },
3168
+ { internalType: "bytes32", name: "rewardsRoot", type: "bytes32" },
3169
+ { internalType: "string", name: "errorString", type: "string" }
3170
+ ],
3171
+ name: "EUnableToProcessRewardsS",
3172
+ type: "error"
3173
+ },
3174
+ { inputs: [], name: "FeePaymentToLow", type: "error" },
3175
+ { inputs: [], name: "InvalidAgentExecutionPayload", type: "error" },
3176
+ { inputs: [], name: "InvalidChannelUpdate", type: "error" },
3177
+ { inputs: [], name: "InvalidCodeHash", type: "error" },
3178
+ { inputs: [], name: "InvalidConstructorParams", type: "error" },
3179
+ { inputs: [], name: "InvalidContract", type: "error" },
3180
+ { inputs: [], name: "InvalidNonce", type: "error" },
3181
+ { inputs: [], name: "InvalidProof", type: "error" },
3182
+ { inputs: [], name: "MiddlewareNotSet", type: "error" },
3183
+ { inputs: [], name: "NativeTransferFailed", type: "error" },
3184
+ { inputs: [], name: "NotEnoughGas", type: "error" },
3185
+ { inputs: [], name: "Operators__OperatorsKeysCannotBeEmpty", type: "error" },
3186
+ { inputs: [], name: "Operators__OperatorsLengthTooLong", type: "error" },
3187
+ {
3188
+ inputs: [
3189
+ { internalType: "uint256", name: "x", type: "uint256" },
3190
+ { internalType: "uint256", name: "y", type: "uint256" }
3191
+ ],
3192
+ name: "PRBMath_MulDiv18_Overflow",
3193
+ type: "error"
3194
+ },
3195
+ {
3196
+ inputs: [
3197
+ { internalType: "uint256", name: "x", type: "uint256" },
3198
+ { internalType: "uint256", name: "y", type: "uint256" },
3199
+ { internalType: "uint256", name: "denominator", type: "uint256" }
3200
+ ],
3201
+ name: "PRBMath_MulDiv_Overflow",
3202
+ type: "error"
3203
+ },
3204
+ {
3205
+ inputs: [{ internalType: "uint256", name: "x", type: "uint256" }],
3206
+ name: "PRBMath_UD60x18_Convert_Overflow",
3207
+ type: "error"
3208
+ },
3209
+ {
3210
+ inputs: [{ internalType: "UD60x18", name: "x", type: "uint256" }],
3211
+ name: "PRBMath_UD60x18_Exp2_InputTooBig",
3212
+ type: "error"
3213
+ },
3214
+ {
3215
+ inputs: [{ internalType: "UD60x18", name: "x", type: "uint256" }],
3216
+ name: "PRBMath_UD60x18_Log_InputTooSmall",
3217
+ type: "error"
3218
+ },
3219
+ { inputs: [], name: "TokenNotRegistered", type: "error" },
3220
+ { inputs: [], name: "Unauthorized", type: "error" },
3221
+ {
3222
+ anonymous: false,
3223
+ inputs: [
3224
+ {
3225
+ indexed: false,
3226
+ internalType: "bytes32",
3227
+ name: "agentID",
3228
+ type: "bytes32"
3229
+ },
3230
+ {
3231
+ indexed: false,
3232
+ internalType: "address",
3233
+ name: "agent",
3234
+ type: "address"
3235
+ }
3236
+ ],
3237
+ name: "AgentCreated",
3238
+ type: "event"
3239
+ },
3240
+ {
3241
+ anonymous: false,
3242
+ inputs: [
3243
+ {
3244
+ indexed: true,
3245
+ internalType: "bytes32",
3246
+ name: "agentID",
3247
+ type: "bytes32"
3248
+ },
3249
+ {
3250
+ indexed: true,
3251
+ internalType: "address",
3252
+ name: "recipient",
3253
+ type: "address"
3254
+ },
3255
+ {
3256
+ indexed: false,
3257
+ internalType: "uint256",
3258
+ name: "amount",
3259
+ type: "uint256"
3260
+ }
3261
+ ],
3262
+ name: "AgentFundsWithdrawn",
3263
+ type: "event"
3264
+ },
3265
+ {
3266
+ anonymous: false,
3267
+ inputs: [
3268
+ {
3269
+ indexed: true,
3270
+ internalType: "ChannelID",
3271
+ name: "channelID",
3272
+ type: "bytes32"
3273
+ }
3274
+ ],
3275
+ name: "ChannelCreated",
3276
+ type: "event"
3277
+ },
3278
+ {
3279
+ anonymous: false,
3280
+ inputs: [
3281
+ {
3282
+ indexed: true,
3283
+ internalType: "ChannelID",
3284
+ name: "channelID",
3285
+ type: "bytes32"
3286
+ }
3287
+ ],
3288
+ name: "ChannelUpdated",
3289
+ type: "event"
3290
+ },
3291
+ {
3292
+ anonymous: false,
3293
+ inputs: [
3294
+ {
3295
+ indexed: true,
3296
+ internalType: "bytes32",
3297
+ name: "tokenID",
3298
+ type: "bytes32"
3299
+ },
3300
+ {
3301
+ indexed: false,
3302
+ internalType: "address",
3303
+ name: "token",
3304
+ type: "address"
3305
+ }
3306
+ ],
3307
+ name: "ForeignTokenRegistered",
3308
+ type: "event"
3309
+ },
3310
+ {
3311
+ anonymous: false,
3312
+ inputs: [
3313
+ {
3314
+ indexed: true,
3315
+ internalType: "ChannelID",
3316
+ name: "channelID",
3317
+ type: "bytes32"
3318
+ },
3319
+ { indexed: false, internalType: "uint64", name: "nonce", type: "uint64" },
3320
+ {
3321
+ indexed: true,
3322
+ internalType: "bytes32",
3323
+ name: "messageID",
3324
+ type: "bytes32"
3325
+ },
3326
+ { indexed: false, internalType: "bool", name: "success", type: "bool" }
3327
+ ],
3328
+ name: "InboundMessageDispatched",
3329
+ type: "event"
3330
+ },
3331
+ {
3332
+ anonymous: false,
3333
+ inputs: [
3334
+ {
3335
+ indexed: true,
3336
+ internalType: "address",
3337
+ name: "previousMiddleware",
3338
+ type: "address"
3339
+ },
3340
+ {
3341
+ indexed: true,
3342
+ internalType: "address",
3343
+ name: "newMiddleware",
3344
+ type: "address"
3345
+ }
3346
+ ],
3347
+ name: "MiddlewareChanged",
3348
+ type: "event"
3349
+ },
3350
+ {
3351
+ anonymous: false,
3352
+ inputs: [
3353
+ {
3354
+ indexed: false,
3355
+ internalType: "enum OperatingMode",
3356
+ name: "mode",
3357
+ type: "uint8"
3358
+ }
3359
+ ],
3360
+ name: "OperatingModeChanged",
3361
+ type: "event"
3362
+ },
3363
+ {
3364
+ anonymous: false,
3365
+ inputs: [
3366
+ {
3367
+ indexed: true,
3368
+ internalType: "uint256",
3369
+ name: "validatorsCount",
3370
+ type: "uint256"
3371
+ },
3372
+ { indexed: false, internalType: "bytes", name: "payload", type: "bytes" }
3373
+ ],
3374
+ name: "OperatorsDataCreated",
3375
+ type: "event"
3376
+ },
3377
+ {
3378
+ anonymous: false,
3379
+ inputs: [
3380
+ {
3381
+ indexed: true,
3382
+ internalType: "ChannelID",
3383
+ name: "channelID",
3384
+ type: "bytes32"
3385
+ },
3386
+ { indexed: false, internalType: "uint64", name: "nonce", type: "uint64" },
3387
+ {
3388
+ indexed: true,
3389
+ internalType: "bytes32",
3390
+ name: "messageID",
3391
+ type: "bytes32"
3392
+ },
3393
+ { indexed: false, internalType: "bytes", name: "payload", type: "bytes" }
3394
+ ],
3395
+ name: "OutboundMessageAccepted",
3396
+ type: "event"
3397
+ },
3398
+ {
3399
+ anonymous: false,
3400
+ inputs: [
3401
+ {
3402
+ indexed: true,
3403
+ internalType: "address",
3404
+ name: "previousOwner",
3405
+ type: "address"
3406
+ },
3407
+ {
3408
+ indexed: true,
3409
+ internalType: "address",
3410
+ name: "newOwner",
3411
+ type: "address"
3412
+ }
3413
+ ],
3414
+ name: "OwnershipTransferred",
3415
+ type: "event"
3416
+ },
3417
+ {
3418
+ anonymous: false,
3419
+ inputs: [],
3420
+ name: "PricingParametersChanged",
3421
+ type: "event"
3422
+ },
3423
+ {
3424
+ anonymous: false,
3425
+ inputs: [
3426
+ {
3427
+ indexed: false,
3428
+ internalType: "address",
3429
+ name: "token",
3430
+ type: "address"
3431
+ }
3432
+ ],
3433
+ name: "TokenRegistrationSent",
3434
+ type: "event"
3435
+ },
3436
+ {
3437
+ anonymous: false,
3438
+ inputs: [
3439
+ {
3440
+ indexed: true,
3441
+ internalType: "address",
3442
+ name: "token",
3443
+ type: "address"
3444
+ },
3445
+ {
3446
+ indexed: true,
3447
+ internalType: "address",
3448
+ name: "sender",
3449
+ type: "address"
3450
+ },
3451
+ {
3452
+ indexed: true,
3453
+ internalType: "ParaID",
3454
+ name: "destinationChain",
3455
+ type: "uint32"
3456
+ },
3457
+ {
3458
+ components: [
3459
+ { internalType: "enum Kind", name: "kind", type: "uint8" },
3460
+ { internalType: "bytes", name: "data", type: "bytes" }
3461
+ ],
3462
+ indexed: false,
3463
+ internalType: "struct MultiAddress",
3464
+ name: "destinationAddress",
3465
+ type: "tuple"
3466
+ },
3467
+ {
3468
+ indexed: false,
3469
+ internalType: "uint128",
3470
+ name: "amount",
3471
+ type: "uint128"
3472
+ }
3473
+ ],
3474
+ name: "TokenSent",
3475
+ type: "event"
3476
+ },
3477
+ {
3478
+ anonymous: false,
3479
+ inputs: [],
3480
+ name: "TokenTransferFeesChanged",
3481
+ type: "event"
3482
+ },
3483
+ {
3484
+ anonymous: false,
3485
+ inputs: [
3486
+ {
3487
+ indexed: true,
3488
+ internalType: "bytes32",
3489
+ name: "operatorKey",
3490
+ type: "bytes32"
3491
+ },
3492
+ {
3493
+ indexed: false,
3494
+ internalType: "uint256",
3495
+ name: "slashFranction",
3496
+ type: "uint256"
3497
+ },
3498
+ {
3499
+ indexed: true,
3500
+ internalType: "uint256",
3501
+ name: "epoch",
3502
+ type: "uint256"
3503
+ },
3504
+ { indexed: false, internalType: "bytes", name: "error", type: "bytes" }
3505
+ ],
3506
+ name: "UnableToProcessIndividualSlashB",
3507
+ type: "event"
3508
+ },
3509
+ {
3510
+ anonymous: false,
3511
+ inputs: [
3512
+ {
3513
+ indexed: true,
3514
+ internalType: "bytes32",
3515
+ name: "operatorKey",
3516
+ type: "bytes32"
3517
+ },
3518
+ {
3519
+ indexed: false,
3520
+ internalType: "uint256",
3521
+ name: "slashFranction",
3522
+ type: "uint256"
3523
+ },
3524
+ {
3525
+ indexed: true,
3526
+ internalType: "uint256",
3527
+ name: "epoch",
3528
+ type: "uint256"
3529
+ },
3530
+ { indexed: false, internalType: "string", name: "error", type: "string" }
3531
+ ],
3532
+ name: "UnableToProcessIndividualSlashS",
3533
+ type: "event"
3534
+ },
3535
+ {
3536
+ anonymous: false,
3537
+ inputs: [
3538
+ { indexed: false, internalType: "bytes", name: "error", type: "bytes" }
3539
+ ],
3540
+ name: "UnableToProcessRewardsMessageB",
3541
+ type: "event"
3542
+ },
3543
+ {
3544
+ anonymous: false,
3545
+ inputs: [
3546
+ { indexed: false, internalType: "string", name: "error", type: "string" }
3547
+ ],
3548
+ name: "UnableToProcessRewardsMessageS",
3549
+ type: "event"
3550
+ },
3551
+ {
3552
+ anonymous: false,
3553
+ inputs: [
3554
+ { indexed: false, internalType: "bytes", name: "error", type: "bytes" }
3555
+ ],
3556
+ name: "UnableToProcessSlashMessageB",
3557
+ type: "event"
3558
+ },
3559
+ {
3560
+ anonymous: false,
3561
+ inputs: [
3562
+ { indexed: false, internalType: "string", name: "error", type: "string" }
3563
+ ],
3564
+ name: "UnableToProcessSlashMessageS",
3565
+ type: "event"
3566
+ },
3567
+ {
3568
+ anonymous: false,
3569
+ inputs: [
3570
+ {
3571
+ indexed: true,
3572
+ internalType: "address",
3573
+ name: "implementation",
3574
+ type: "address"
3575
+ }
3576
+ ],
3577
+ name: "Upgraded",
3578
+ type: "event"
3579
+ },
3580
+ {
3581
+ inputs: [],
3582
+ name: "AGENT_EXECUTOR",
3583
+ outputs: [{ internalType: "address", name: "", type: "address" }],
3584
+ stateMutability: "view",
3585
+ type: "function"
3586
+ },
3587
+ {
3588
+ inputs: [],
3589
+ name: "BEEFY_CLIENT",
3590
+ outputs: [{ internalType: "address", name: "", type: "address" }],
3591
+ stateMutability: "view",
3592
+ type: "function"
3593
+ },
3594
+ {
3595
+ inputs: [{ internalType: "bytes", name: "data", type: "bytes" }],
3596
+ name: "agentExecute",
3597
+ outputs: [],
3598
+ stateMutability: "nonpayable",
3599
+ type: "function"
3600
+ },
3601
+ {
3602
+ inputs: [{ internalType: "bytes32", name: "agentID", type: "bytes32" }],
3603
+ name: "agentOf",
3604
+ outputs: [{ internalType: "address", name: "", type: "address" }],
3605
+ stateMutability: "view",
3606
+ type: "function"
3607
+ },
3608
+ {
3609
+ inputs: [{ internalType: "ChannelID", name: "channelID", type: "bytes32" }],
3610
+ name: "channelNoncesOf",
3611
+ outputs: [
3612
+ { internalType: "uint64", name: "", type: "uint64" },
3613
+ { internalType: "uint64", name: "", type: "uint64" }
3614
+ ],
3615
+ stateMutability: "view",
3616
+ type: "function"
3617
+ },
3618
+ {
3619
+ inputs: [{ internalType: "ChannelID", name: "channelID", type: "bytes32" }],
3620
+ name: "channelOperatingModeOf",
3621
+ outputs: [{ internalType: "enum OperatingMode", name: "", type: "uint8" }],
3622
+ stateMutability: "view",
3623
+ type: "function"
3624
+ },
3625
+ {
3626
+ inputs: [{ internalType: "bytes", name: "data", type: "bytes" }],
3627
+ name: "createAgent",
3628
+ outputs: [],
3629
+ stateMutability: "nonpayable",
3630
+ type: "function"
3631
+ },
3632
+ {
3633
+ inputs: [{ internalType: "bytes", name: "data", type: "bytes" }],
3634
+ name: "createChannel",
3635
+ outputs: [],
3636
+ stateMutability: "nonpayable",
3637
+ type: "function"
3638
+ },
3639
+ {
3640
+ inputs: [],
3641
+ name: "implementation",
3642
+ outputs: [{ internalType: "address", name: "", type: "address" }],
3643
+ stateMutability: "view",
3644
+ type: "function"
3645
+ },
3646
+ {
3647
+ inputs: [{ internalType: "bytes", name: "data", type: "bytes" }],
3648
+ name: "initialize",
3649
+ outputs: [],
3650
+ stateMutability: "nonpayable",
3651
+ type: "function"
3652
+ },
3653
+ {
3654
+ inputs: [{ internalType: "address", name: "token", type: "address" }],
3655
+ name: "isTokenRegistered",
3656
+ outputs: [{ internalType: "bool", name: "", type: "bool" }],
3657
+ stateMutability: "view",
3658
+ type: "function"
3659
+ },
3660
+ {
3661
+ inputs: [{ internalType: "bytes", name: "data", type: "bytes" }],
3662
+ name: "mintForeignToken",
3663
+ outputs: [],
3664
+ stateMutability: "nonpayable",
3665
+ type: "function"
3666
+ },
3667
+ {
3668
+ inputs: [],
3669
+ name: "operatingMode",
3670
+ outputs: [{ internalType: "enum OperatingMode", name: "", type: "uint8" }],
3671
+ stateMutability: "view",
3672
+ type: "function"
3673
+ },
3674
+ {
3675
+ inputs: [],
3676
+ name: "pricingParameters",
3677
+ outputs: [
3678
+ { internalType: "UD60x18", name: "", type: "uint256" },
3679
+ { internalType: "uint128", name: "", type: "uint128" }
3680
+ ],
3681
+ stateMutability: "view",
3682
+ type: "function"
3683
+ },
3684
+ {
3685
+ inputs: [{ internalType: "address", name: "token", type: "address" }],
3686
+ name: "queryForeignTokenID",
3687
+ outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
3688
+ stateMutability: "view",
3689
+ type: "function"
3690
+ },
3691
+ {
3692
+ inputs: [],
3693
+ name: "quoteRegisterTokenFee",
3694
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
3695
+ stateMutability: "view",
3696
+ type: "function"
3697
+ },
3698
+ {
3699
+ inputs: [
3700
+ { internalType: "address", name: "token", type: "address" },
3701
+ { internalType: "ParaID", name: "destinationChain", type: "uint32" },
3702
+ { internalType: "uint128", name: "destinationFee", type: "uint128" }
3703
+ ],
3704
+ name: "quoteSendTokenFee",
3705
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
3706
+ stateMutability: "view",
3707
+ type: "function"
3708
+ },
3709
+ {
3710
+ inputs: [{ internalType: "bytes", name: "data", type: "bytes" }],
3711
+ name: "registerForeignToken",
3712
+ outputs: [],
3713
+ stateMutability: "nonpayable",
3714
+ type: "function"
3715
+ },
3716
+ {
3717
+ inputs: [{ internalType: "address", name: "token", type: "address" }],
3718
+ name: "registerToken",
3719
+ outputs: [],
3720
+ stateMutability: "payable",
3721
+ type: "function"
3722
+ },
3723
+ {
3724
+ inputs: [{ internalType: "bytes", name: "data", type: "bytes" }],
3725
+ name: "reportSlashes",
3726
+ outputs: [],
3727
+ stateMutability: "nonpayable",
3728
+ type: "function"
3729
+ },
3730
+ {
3731
+ inputs: [],
3732
+ name: "s_middleware",
3733
+ outputs: [{ internalType: "address", name: "", type: "address" }],
3734
+ stateMutability: "view",
3735
+ type: "function"
3736
+ },
3737
+ {
3738
+ inputs: [
3739
+ { internalType: "bytes32[]", name: "data", type: "bytes32[]" },
3740
+ { internalType: "uint48", name: "epoch", type: "uint48" }
3741
+ ],
3742
+ name: "sendOperatorsData",
3743
+ outputs: [],
3744
+ stateMutability: "nonpayable",
3745
+ type: "function"
3746
+ },
3747
+ {
3748
+ inputs: [{ internalType: "bytes", name: "data", type: "bytes" }],
3749
+ name: "sendRewards",
3750
+ outputs: [],
3751
+ stateMutability: "nonpayable",
3752
+ type: "function"
3753
+ },
3754
+ {
3755
+ inputs: [
3756
+ { internalType: "address", name: "token", type: "address" },
3757
+ { internalType: "ParaID", name: "destinationChain", type: "uint32" },
3758
+ {
3759
+ components: [
3760
+ { internalType: "enum Kind", name: "kind", type: "uint8" },
3761
+ { internalType: "bytes", name: "data", type: "bytes" }
3762
+ ],
3763
+ internalType: "struct MultiAddress",
3764
+ name: "destinationAddress",
3765
+ type: "tuple"
3766
+ },
3767
+ { internalType: "uint128", name: "destinationFee", type: "uint128" },
3768
+ { internalType: "uint128", name: "amount", type: "uint128" }
3769
+ ],
3770
+ name: "sendToken",
3771
+ outputs: [],
3772
+ stateMutability: "payable",
3773
+ type: "function"
3774
+ },
3775
+ {
3776
+ inputs: [{ internalType: "address", name: "middleware", type: "address" }],
3777
+ name: "setMiddleware",
3778
+ outputs: [],
3779
+ stateMutability: "nonpayable",
3780
+ type: "function"
3781
+ },
3782
+ {
3783
+ inputs: [{ internalType: "bytes", name: "data", type: "bytes" }],
3784
+ name: "setOperatingMode",
3785
+ outputs: [],
3786
+ stateMutability: "nonpayable",
3787
+ type: "function"
3788
+ },
3789
+ {
3790
+ inputs: [{ internalType: "bytes", name: "data", type: "bytes" }],
3791
+ name: "setPricingParameters",
3792
+ outputs: [],
3793
+ stateMutability: "nonpayable",
3794
+ type: "function"
3795
+ },
3796
+ {
3797
+ inputs: [{ internalType: "bytes", name: "data", type: "bytes" }],
3798
+ name: "setTokenTransferFees",
3799
+ outputs: [],
3800
+ stateMutability: "nonpayable",
3801
+ type: "function"
3802
+ },
3803
+ {
3804
+ inputs: [
3805
+ {
3806
+ components: [
3807
+ { internalType: "ChannelID", name: "channelID", type: "bytes32" },
3808
+ { internalType: "uint64", name: "nonce", type: "uint64" },
3809
+ { internalType: "enum Command", name: "command", type: "uint8" },
3810
+ { internalType: "bytes", name: "params", type: "bytes" },
3811
+ { internalType: "uint64", name: "maxDispatchGas", type: "uint64" },
3812
+ { internalType: "uint256", name: "maxFeePerGas", type: "uint256" },
3813
+ { internalType: "uint256", name: "reward", type: "uint256" },
3814
+ { internalType: "bytes32", name: "id", type: "bytes32" }
3815
+ ],
3816
+ internalType: "struct InboundMessage",
3817
+ name: "message",
3818
+ type: "tuple"
3819
+ },
3820
+ { internalType: "bytes32[]", name: "leafProof", type: "bytes32[]" },
3821
+ {
3822
+ components: [
3823
+ {
3824
+ components: [
3825
+ { internalType: "uint8", name: "version", type: "uint8" },
3826
+ { internalType: "uint32", name: "parentNumber", type: "uint32" },
3827
+ { internalType: "bytes32", name: "parentHash", type: "bytes32" },
3828
+ {
3829
+ internalType: "uint64",
3830
+ name: "nextAuthoritySetID",
3831
+ type: "uint64"
3832
+ },
3833
+ {
3834
+ internalType: "uint32",
3835
+ name: "nextAuthoritySetLen",
3836
+ type: "uint32"
3095
3837
  },
3096
3838
  {
3097
- refTime: 5e9,
3098
- proofSize: 0
3839
+ internalType: "bytes32",
3840
+ name: "nextAuthoritySetRoot",
3841
+ type: "bytes32"
3099
3842
  }
3100
- ]
3101
- })
3102
- })
3843
+ ],
3844
+ internalType: "struct Verification.MMRLeafPartial",
3845
+ name: "leafPartial",
3846
+ type: "tuple"
3847
+ },
3848
+ { internalType: "bytes32[]", name: "leafProof", type: "bytes32[]" },
3849
+ {
3850
+ internalType: "bytes32",
3851
+ name: "parachainHeadsRoot",
3852
+ type: "bytes32"
3853
+ },
3854
+ { internalType: "uint256", name: "leafProofOrder", type: "uint256" }
3855
+ ],
3856
+ internalType: "struct Verification.Proof",
3857
+ name: "headerProof",
3858
+ type: "tuple"
3859
+ }
3860
+ ],
3861
+ name: "submitV1",
3862
+ outputs: [],
3863
+ stateMutability: "nonpayable",
3864
+ type: "function"
3865
+ },
3866
+ {
3867
+ inputs: [{ internalType: "bytes32", name: "tokenID", type: "bytes32" }],
3868
+ name: "tokenAddressOf",
3869
+ outputs: [{ internalType: "address", name: "", type: "address" }],
3870
+ stateMutability: "view",
3871
+ type: "function"
3872
+ },
3873
+ {
3874
+ inputs: [{ internalType: "bytes", name: "data", type: "bytes" }],
3875
+ name: "transferNativeFromAgent",
3876
+ outputs: [],
3877
+ stateMutability: "nonpayable",
3878
+ type: "function"
3879
+ },
3880
+ {
3881
+ inputs: [{ internalType: "bytes", name: "data", type: "bytes" }],
3882
+ name: "transferNativeToken",
3883
+ outputs: [],
3884
+ stateMutability: "nonpayable",
3885
+ type: "function"
3886
+ },
3887
+ {
3888
+ inputs: [{ internalType: "address", name: "newOwner", type: "address" }],
3889
+ name: "transferOwnership",
3890
+ outputs: [],
3891
+ stateMutability: "nonpayable",
3892
+ type: "function"
3893
+ },
3894
+ {
3895
+ inputs: [{ internalType: "bytes", name: "data", type: "bytes" }],
3896
+ name: "updateChannel",
3897
+ outputs: [],
3898
+ stateMutability: "nonpayable",
3899
+ type: "function"
3900
+ },
3901
+ {
3902
+ inputs: [{ internalType: "bytes", name: "data", type: "bytes" }],
3903
+ name: "upgrade",
3904
+ outputs: [],
3905
+ stateMutability: "nonpayable",
3906
+ type: "function"
3907
+ }
3908
+ ];
3909
+
3910
+ // src/mrl/providers/snowbridge/snowbridge/SnowbridgeConstants.ts
3911
+ var GATEWAY_CONTRACT_ADDRESS = "0x503B4D684074888EB7fe82D4c5AB25E57de0e85c";
3912
+ var GATEWAY_ABI2 = GATEWAY_ABI;
3913
+
3914
+ // src/fee/gateway/gateway.ts
3915
+ function gateway() {
3916
+ return {
3917
+ quoteSendTokenFee() {
3918
+ return {
3919
+ build: ({ asset, destination }) => {
3920
+ if (!asset.address) {
3921
+ throw new Error(`Asset ${asset.key} has no address`);
3922
+ }
3923
+ if (!EvmParachain2.isAnyParachain(destination)) {
3924
+ throw new Error(
3925
+ "Destination must be a Parachain or EvmParachain for getting the quote send token fee for Gateway module"
3926
+ );
3927
+ }
3928
+ return new ContractConfig({
3929
+ address: GATEWAY_CONTRACT_ADDRESS,
3930
+ abi: GATEWAY_ABI2,
3931
+ args: [asset.address, destination.parachainId, 0n],
3932
+ func: "quoteSendTokenFee",
3933
+ module: "Gateway"
3934
+ });
3935
+ }
3103
3936
  };
3104
3937
  }
3105
3938
  };
3106
3939
  }
3107
3940
 
3108
- // src/extrinsic/ExtrinsicBuilder.ts
3109
- function ExtrinsicBuilder() {
3941
+ // src/fee/outboundQueueApi/outboundQueueApi.ts
3942
+ function outboundQueueApi() {
3110
3943
  return {
3111
- eqBalances,
3112
- xTokens,
3113
- xTransfer,
3114
- polkadotXcm,
3115
- xcmPallet
3944
+ calculateFee: () => {
3945
+ return {
3946
+ build: ({ address, asset, balance }) => {
3947
+ const args = [
3948
+ {
3949
+ MintForeignToken: {
3950
+ tokenId: asset.getAssetId(),
3951
+ recipient: address,
3952
+ amount: balance?.amount
3953
+ }
3954
+ },
3955
+ null
3956
+ ];
3957
+ return new SubstrateQueryConfig({
3958
+ module: "outboundQueueApi",
3959
+ func: "calculateFee",
3960
+ args,
3961
+ queryType: "call",
3962
+ transform: async (data) => data.local.toBigInt() + data.remote.toBigInt()
3963
+ });
3964
+ }
3965
+ };
3966
+ }
3116
3967
  };
3117
3968
  }
3118
3969
 
3119
3970
  // src/fee/FeeBuilder.utils.ts
3120
- import { EvmParachain as EvmParachain2 } from "@moonbeam-network/xcm-types";
3971
+ import { EvmParachain as EvmParachain3 } from "@moonbeam-network/xcm-types";
3121
3972
  import { isEthAddress as isEthAddress2 } from "@moonbeam-network/xcm-utils";
3122
3973
  import { u8aToHex as u8aToHex5 } from "@polkadot/util";
3123
3974
  import { decodeAddress as decodeAddress5 } from "@polkadot/util-crypto";
@@ -3138,7 +3989,7 @@ function getWithdrawAssetInstruction(assetTypes) {
3138
3989
  };
3139
3990
  }
3140
3991
  function getUniversalOriginInstruction(source) {
3141
- if (!EvmParachain2.isAnyParachain(source)) {
3992
+ if (!EvmParachain3.isAnyParachain(source)) {
3142
3993
  throw new Error("Source is not a parachain");
3143
3994
  }
3144
3995
  return {
@@ -3148,7 +3999,7 @@ function getUniversalOriginInstruction(source) {
3148
3999
  };
3149
4000
  }
3150
4001
  function getDescendOriginInstruction(source) {
3151
- if (!EvmParachain2.isAnyParachain(source)) {
4002
+ if (!EvmParachain3.isAnyParachain(source)) {
3152
4003
  throw new Error("Source is not a parachain");
3153
4004
  }
3154
4005
  return {
@@ -3537,35 +4388,39 @@ var createXcmFeeBuilder = ({
3537
4388
  getVersionedTransferAsset,
3538
4389
  options
3539
4390
  }) => ({
3540
- build: (params) => new SubstrateCallConfig({
3541
- api: params.api,
3542
- call: async () => {
3543
- const [assets3, versionedFeeAssetId] = await getVersionedAssets({
3544
- getVersionedFeeAsset,
3545
- getVersionedTransferAsset,
3546
- options,
3547
- params
3548
- });
3549
- const instructions = getInstructions({
3550
- isAssetReserveChain: options.isAssetReserveChain,
3551
- assets: assets3,
3552
- versionedFeeAssetId,
3553
- address: params.address,
3554
- source: params.source,
3555
- isEcosystemBridge: options.isEcosystemBridge
3556
- });
3557
- return getFeeForXcmInstructionsAndAsset(
3558
- params.api,
3559
- instructions,
3560
- versionedFeeAssetId
3561
- );
3562
- }
3563
- })
4391
+ build: (params) => {
4392
+ return new SubstrateCallConfig({
4393
+ api: params.api,
4394
+ call: async () => {
4395
+ const [assets3, versionedFeeAssetId] = await getVersionedAssets({
4396
+ getVersionedFeeAsset,
4397
+ getVersionedTransferAsset,
4398
+ options,
4399
+ params
4400
+ });
4401
+ const instructions = getInstructions({
4402
+ isAssetReserveChain: options.isAssetReserveChain,
4403
+ assets: assets3,
4404
+ versionedFeeAssetId,
4405
+ address: params.address,
4406
+ source: params.source,
4407
+ isEcosystemBridge: options.isEcosystemBridge
4408
+ });
4409
+ return getFeeForXcmInstructionsAndAsset(
4410
+ params.api,
4411
+ instructions,
4412
+ versionedFeeAssetId
4413
+ );
4414
+ }
4415
+ });
4416
+ }
3564
4417
  });
3565
4418
 
3566
4419
  // src/fee/FeeBuilder.ts
3567
4420
  function FeeBuilder() {
3568
4421
  return {
4422
+ gateway,
4423
+ outboundQueueApi,
3569
4424
  xcmPaymentApi
3570
4425
  };
3571
4426
  }
@@ -3827,9 +4682,265 @@ function MonitoringBuilder() {
3827
4682
  };
3828
4683
  }
3829
4684
 
4685
+ // src/mrl/providers/snowbridge/contract/Gateway/Gateway.ts
4686
+ import {
4687
+ EvmParachain as EvmParachain4
4688
+ } from "@moonbeam-network/xcm-types";
4689
+
4690
+ // src/mrl/providers/snowbridge/snowbridge/SnowbridgeConfig.ts
4691
+ var SnowbridgeConfig = class _SnowbridgeConfig {
4692
+ args;
4693
+ func;
4694
+ provider = "snowbridge";
4695
+ static is(obj) {
4696
+ return obj instanceof _SnowbridgeConfig;
4697
+ }
4698
+ constructor({ args, func }) {
4699
+ this.args = args;
4700
+ this.func = func;
4701
+ }
4702
+ };
4703
+
4704
+ // src/mrl/providers/snowbridge/contract/Gateway/Gateway.ts
4705
+ function Gateway() {
4706
+ const provider = "snowbridge";
4707
+ return {
4708
+ sendToken: () => ({
4709
+ provider,
4710
+ build: ({ asset, destinationAddress, protocolFee, destination }) => callSendToken(asset, protocolFee, destination, destinationAddress)
4711
+ }),
4712
+ approveAndSendToken: () => ({
4713
+ provider,
4714
+ build: ({ asset, destinationAddress, protocolFee, destination }) => {
4715
+ const requiresApproval = protocolFee && !protocolFee.isSame(asset);
4716
+ return callSendToken(
4717
+ asset,
4718
+ protocolFee,
4719
+ destination,
4720
+ destinationAddress,
4721
+ requiresApproval
4722
+ );
4723
+ }
4724
+ })
4725
+ };
4726
+ }
4727
+ function callSendToken(asset, protocolFee, destination, destinationAddress, requiresApproval = false) {
4728
+ if (!protocolFee) {
4729
+ throw new Error("Protocol fee is required for Gateway module");
4730
+ }
4731
+ if (!EvmParachain4.isAnyParachain(destination)) {
4732
+ throw new Error(
4733
+ "Destination must be a Parachain or EvmParachain for sending token with Gateway module"
4734
+ );
4735
+ }
4736
+ return new SnowbridgeConfig({
4737
+ args: {
4738
+ tokenAddress: asset.address,
4739
+ destinationAddress,
4740
+ destinationParaId: destination.parachainId,
4741
+ amount: asset.amount,
4742
+ bridgeFeeAmount: protocolFee.amount,
4743
+ requiresApproval
4744
+ },
4745
+ func: "sendToken"
4746
+ });
4747
+ }
4748
+
4749
+ // src/mrl/providers/snowbridge/contract/index.ts
4750
+ function contract() {
4751
+ return { Gateway };
4752
+ }
4753
+
4754
+ // src/mrl/providers/snowbridge/extrinsic/ethereumTokenTransfer/ethereumTokenTransfers.ts
4755
+ var pallet6 = "ethereumTokenTransfers";
4756
+ function ethereumTokenTransfers() {
4757
+ return {
4758
+ transferNativeToken: () => {
4759
+ const func = "transferNativeToken";
4760
+ const provider = "snowbridge";
4761
+ return {
4762
+ provider,
4763
+ build: ({ asset, destinationAddress }) => {
4764
+ return new ExtrinsicConfig({
4765
+ module: pallet6,
4766
+ func,
4767
+ getArgs: () => [asset.amount, destinationAddress]
4768
+ });
4769
+ }
4770
+ };
4771
+ }
4772
+ };
4773
+ }
4774
+
4775
+ // src/mrl/providers/snowbridge/extrinsic/xcmPallet/xcmPallet.ts
4776
+ import { EvmChain } from "@moonbeam-network/xcm-types";
4777
+
4778
+ // src/mrl/providers/snowbridge/extrinsic/xcmPallet/xcmPallet.utils.ts
4779
+ function getGlobalConsensusArgs({
4780
+ assets: assets3,
4781
+ destination,
4782
+ destinationAddress,
4783
+ func
4784
+ }) {
4785
+ const version = getExtrinsicArgumentVersion(func);
4786
+ const dest = {
4787
+ [version]: {
4788
+ parents: 1,
4789
+ interior: {
4790
+ X1: [
4791
+ {
4792
+ GlobalConsensus: {
4793
+ Ethereum: { chainId: destination.id }
4794
+ }
4795
+ }
4796
+ ]
4797
+ }
4798
+ }
4799
+ };
4800
+ const beneficiary = {
4801
+ [version]: {
4802
+ parents: 0,
4803
+ interior: {
4804
+ X1: [
4805
+ {
4806
+ AccountKey20: {
4807
+ network: { Ethereum: { chainId: destination.id } },
4808
+ key: destinationAddress
4809
+ }
4810
+ }
4811
+ ]
4812
+ }
4813
+ }
4814
+ };
4815
+ const assetsArg = {
4816
+ [version]: assets3
4817
+ };
4818
+ return [
4819
+ dest,
4820
+ beneficiary,
4821
+ assetsArg,
4822
+ 0,
4823
+ // feeAssetItem
4824
+ "Unlimited"
4825
+ ];
4826
+ }
4827
+
4828
+ // src/mrl/providers/snowbridge/extrinsic/xcmPallet/xcmPallet.ts
4829
+ var pallet7 = "xcmPallet";
4830
+ function xcmPallet2() {
4831
+ return {
4832
+ transferAssets: () => {
4833
+ const func = "transferAssets";
4834
+ const provider = "snowbridge";
4835
+ return {
4836
+ globalConsensus: () => ({
4837
+ provider,
4838
+ build: ({ asset, destination, destinationAddress }) => {
4839
+ if (!EvmChain.is(destination)) {
4840
+ throw new Error(
4841
+ "Destination must be an EVM chain for globalConsensus function"
4842
+ );
4843
+ }
4844
+ return new ExtrinsicConfig({
4845
+ module: pallet7,
4846
+ func,
4847
+ getArgs: (extrinsicFunction) => {
4848
+ const assets3 = [
4849
+ {
4850
+ id: {
4851
+ parents: 1,
4852
+ interior: {
4853
+ X1: [
4854
+ {
4855
+ GlobalConsensus: {
4856
+ Ethereum: { chainId: destination.id }
4857
+ }
4858
+ }
4859
+ ]
4860
+ }
4861
+ },
4862
+ fun: { Fungible: asset.amount }
4863
+ }
4864
+ ];
4865
+ return getGlobalConsensusArgs({
4866
+ assets: assets3,
4867
+ destination,
4868
+ destinationAddress,
4869
+ func: extrinsicFunction
4870
+ });
4871
+ }
4872
+ });
4873
+ }
4874
+ }),
4875
+ globalConsensusErc20: () => ({
4876
+ provider,
4877
+ build: ({ asset, destination, destinationAddress }) => {
4878
+ if (!EvmChain.is(destination)) {
4879
+ throw new Error(
4880
+ "Destination must be an EVM chain for globalConsensusErc20 function"
4881
+ );
4882
+ }
4883
+ const assetInDestination = destination.getChainAsset(asset);
4884
+ return new ExtrinsicConfig({
4885
+ module: pallet7,
4886
+ func,
4887
+ getArgs: (extrinsicFunction) => {
4888
+ const assets3 = [
4889
+ {
4890
+ id: {
4891
+ parents: 1,
4892
+ interior: {
4893
+ X2: [
4894
+ {
4895
+ GlobalConsensus: {
4896
+ Ethereum: { chainId: destination.id }
4897
+ }
4898
+ },
4899
+ {
4900
+ AccountKey20: {
4901
+ network: {
4902
+ Ethereum: { chainId: destination.id }
4903
+ },
4904
+ key: assetInDestination.address
4905
+ }
4906
+ }
4907
+ ]
4908
+ }
4909
+ },
4910
+ fun: { Fungible: asset.amount }
4911
+ }
4912
+ ];
4913
+ return getGlobalConsensusArgs({
4914
+ assets: assets3,
4915
+ destination,
4916
+ destinationAddress,
4917
+ func: extrinsicFunction
4918
+ });
4919
+ }
4920
+ });
4921
+ }
4922
+ })
4923
+ };
4924
+ }
4925
+ };
4926
+ }
4927
+
4928
+ // src/mrl/providers/snowbridge/extrinsic/index.ts
4929
+ function extrinsic() {
4930
+ return { ethereumTokenTransfers, xcmPallet: xcmPallet2 };
4931
+ }
4932
+
4933
+ // src/mrl/providers/snowbridge/index.ts
4934
+ function snowbridge() {
4935
+ return {
4936
+ contract,
4937
+ extrinsic
4938
+ };
4939
+ }
4940
+
3830
4941
  // src/mrl/providers/wormhole/contract/Batch/Batch.ts
3831
4942
  import {
3832
- EvmParachain as EvmParachain3
4943
+ EvmParachain as EvmParachain5
3833
4944
  } from "@moonbeam-network/xcm-types";
3834
4945
  import { getMultilocationDerivedAddresses as getMultilocationDerivedAddresses2 } from "@moonbeam-network/xcm-utils";
3835
4946
  import { evmToAddress as evmToAddress3 } from "@polkadot/util-crypto";
@@ -3844,8 +4955,10 @@ import { getMultilocationDerivedAddresses } from "@moonbeam-network/xcm-utils";
3844
4955
  var BUY_EXECUTION_FEE = 100000000000000000n;
3845
4956
  var CROSS_CHAIN_FEE = 100000000000000000n;
3846
4957
  function polkadotXcm2() {
4958
+ const provider = "wormhole";
3847
4959
  return {
3848
4960
  send: () => ({
4961
+ provider,
3849
4962
  build: ({
3850
4963
  asset,
3851
4964
  destination,
@@ -3853,7 +4966,7 @@ function polkadotXcm2() {
3853
4966
  fee,
3854
4967
  isAutomatic,
3855
4968
  moonAsset,
3856
- moonChain,
4969
+ bridgeChain,
3857
4970
  moonApi,
3858
4971
  sendOnlyRemoteExecution,
3859
4972
  source,
@@ -3884,7 +4997,7 @@ function polkadotXcm2() {
3884
4997
  isAutomatic,
3885
4998
  moonApi,
3886
4999
  moonAsset,
3887
- moonChain,
5000
+ bridgeChain,
3888
5001
  source,
3889
5002
  sourceAddress,
3890
5003
  sourceApi
@@ -3897,7 +5010,7 @@ function polkadotXcm2() {
3897
5010
  fee,
3898
5011
  isAutomatic,
3899
5012
  moonAsset,
3900
- moonChain,
5013
+ bridgeChain,
3901
5014
  moonApi,
3902
5015
  source,
3903
5016
  sourceAddress,
@@ -3917,7 +5030,7 @@ function polkadotXcm2() {
3917
5030
  function buildSendExtrinsic({
3918
5031
  computedOriginAccount,
3919
5032
  moonAsset,
3920
- moonChain,
5033
+ bridgeChain,
3921
5034
  sourceApi,
3922
5035
  transact
3923
5036
  }) {
@@ -3930,7 +5043,7 @@ function buildSendExtrinsic({
3930
5043
  [version]: normalizeX1(version, {
3931
5044
  parents: 1,
3932
5045
  interior: {
3933
- X1: { Parachain: moonChain.parachainId }
5046
+ X1: { Parachain: bridgeChain.parachainId }
3934
5047
  }
3935
5048
  })
3936
5049
  },
@@ -4013,7 +5126,7 @@ function getAssetTransferTxs({
4013
5126
  fee,
4014
5127
  moonApi,
4015
5128
  moonAsset,
4016
- moonChain,
5129
+ bridgeChain,
4017
5130
  source,
4018
5131
  sourceAddress,
4019
5132
  sourceApi
@@ -4029,7 +5142,7 @@ function getAssetTransferTxs({
4029
5142
  // for this we have to add a new concept in the config (Cross Chain Fee), and get the value from there
4030
5143
  amount: asset.amount + 10n * CROSS_CHAIN_FEE
4031
5144
  }),
4032
- destination: moonChain,
5145
+ destination: bridgeChain,
4033
5146
  destinationAddress: computedOriginAccount,
4034
5147
  destinationApi: moonApi,
4035
5148
  fee,
@@ -4043,7 +5156,7 @@ function getAssetTransferTxs({
4043
5156
  asset: AssetAmount.fromChainAsset(source.getChainAsset(moonAsset), {
4044
5157
  amount: CROSS_CHAIN_FEE + BUY_EXECUTION_FEE
4045
5158
  }),
4046
- destination: moonChain,
5159
+ destination: bridgeChain,
4047
5160
  destinationAddress: computedOriginAccount,
4048
5161
  destinationApi: moonApi,
4049
5162
  fee,
@@ -4057,7 +5170,7 @@ function getAssetTransferTxs({
4057
5170
  const multiCurrenciesTransferTx = transferMulticurrencies(
4058
5171
  ...transferMulticurrenciesBuilder.build({
4059
5172
  asset,
4060
- destination: moonChain,
5173
+ destination: bridgeChain,
4061
5174
  destinationAddress: computedOriginAccount,
4062
5175
  destinationApi: moonApi,
4063
5176
  fee: AssetAmount.fromChainAsset(source.getChainAsset(moonAsset), {
@@ -4613,8 +5726,10 @@ function getAbisForChain(_) {
4613
5726
  // src/mrl/providers/wormhole/contract/Batch/Batch.ts
4614
5727
  var module = "Batch";
4615
5728
  function Batch() {
5729
+ const provider = "wormhole";
4616
5730
  return {
4617
5731
  transferAssetsAndMessage: () => ({
5732
+ provider,
4618
5733
  build: ({
4619
5734
  asset,
4620
5735
  destination,
@@ -4622,14 +5737,14 @@ function Batch() {
4622
5737
  fee,
4623
5738
  isAutomatic,
4624
5739
  moonAsset,
4625
- moonChain,
5740
+ bridgeChain,
4626
5741
  moonApi,
4627
5742
  source,
4628
5743
  sourceAddress,
4629
5744
  sourceApi,
4630
5745
  transact
4631
5746
  }) => {
4632
- if (!EvmParachain3.is(source)) {
5747
+ if (!EvmParachain5.is(source)) {
4633
5748
  throw new Error("Source chain needs to be an EVMParachain");
4634
5749
  }
4635
5750
  if (!sourceApi) {
@@ -4655,7 +5770,7 @@ function Batch() {
4655
5770
  fee,
4656
5771
  isAutomatic,
4657
5772
  moonAsset,
4658
- moonChain,
5773
+ bridgeChain,
4659
5774
  moonApi,
4660
5775
  source,
4661
5776
  sourceAddress,
@@ -4663,7 +5778,7 @@ function Batch() {
4663
5778
  transact
4664
5779
  });
4665
5780
  const encodedXcmMessage = send.args[1].toHex();
4666
- const { destinationParachain, destinationParachainAndAddress } = getDestinationInHex(moonChain, computedOriginAccount);
5781
+ const { destinationParachain, destinationParachainAndAddress } = getDestinationInHex(bridgeChain, computedOriginAccount);
4667
5782
  const { currencies, feeItem } = getCurrencies({
4668
5783
  source,
4669
5784
  moonAsset,
@@ -4696,15 +5811,15 @@ function Batch() {
4696
5811
  })
4697
5812
  };
4698
5813
  }
4699
- function getDestinationInHex(moonChain, computedOriginAccount) {
5814
+ function getDestinationInHex(bridgeChain, computedOriginAccount) {
4700
5815
  const destinationParachain = {
4701
5816
  parents: 1,
4702
- interior: getPrecompileDestinationInterior(moonChain)
5817
+ interior: getPrecompileDestinationInterior(bridgeChain)
4703
5818
  };
4704
5819
  const destinationParachainAndAddress = {
4705
5820
  parents: 1,
4706
5821
  interior: getPrecompileDestinationInterior(
4707
- moonChain,
5822
+ bridgeChain,
4708
5823
  computedOriginAccount
4709
5824
  )
4710
5825
  };
@@ -4781,6 +5896,7 @@ var Protocols = /* @__PURE__ */ ((Protocols2) => {
4781
5896
  var WormholeConfig = class _WormholeConfig {
4782
5897
  args;
4783
5898
  func;
5899
+ provider = "wormhole";
4784
5900
  static is(obj) {
4785
5901
  return obj instanceof _WormholeConfig;
4786
5902
  }
@@ -4791,20 +5907,20 @@ var WormholeConfig = class _WormholeConfig {
4791
5907
  };
4792
5908
 
4793
5909
  // src/mrl/providers/wormhole/wormhole/wormhole.ts
4794
- import { EvmChain, EvmParachain as EvmParachain5, Parachain as Parachain3 } from "@moonbeam-network/xcm-types";
5910
+ import { EvmChain as EvmChain2, EvmParachain as EvmParachain7, Parachain as Parachain3 } from "@moonbeam-network/xcm-types";
4795
5911
  import { getMultilocationDerivedAddresses as getMultilocationDerivedAddresses3 } from "@moonbeam-network/xcm-utils";
4796
5912
  import { evmToAddress as evmToAddress4 } from "@polkadot/util-crypto/address";
4797
5913
  import { Wormhole as Wormhole2 } from "@wormhole-foundation/sdk-connect";
4798
5914
 
4799
5915
  // src/mrl/providers/wormhole/wormhole/wormholeFactory.ts
4800
- import { EvmParachain as EvmParachain4 } from "@moonbeam-network/xcm-types";
5916
+ import { EvmParachain as EvmParachain6 } from "@moonbeam-network/xcm-types";
4801
5917
  import { Wormhole } from "@wormhole-foundation/sdk-connect";
4802
5918
  import { EvmPlatform } from "@wormhole-foundation/sdk-evm";
4803
5919
  function wormholeFactory(chain) {
4804
5920
  return new Wormhole(
4805
5921
  chain.isTestChain ? "Testnet" : "Mainnet",
4806
5922
  [EvmPlatform],
4807
- EvmParachain4.isAnyEvmChain(chain) && chain.wh ? {
5923
+ EvmParachain6.isAnyEvmChain(chain) && chain.wh ? {
4808
5924
  chains: {
4809
5925
  [chain.wh.name]: {
4810
5926
  rpc: chain.rpc
@@ -4816,21 +5932,23 @@ function wormholeFactory(chain) {
4816
5932
 
4817
5933
  // src/mrl/providers/wormhole/wormhole/wormhole.ts
4818
5934
  function wormhole() {
5935
+ const provider = "wormhole";
4819
5936
  return {
4820
5937
  tokenTransfer: () => ({
5938
+ provider,
4821
5939
  build: ({
4822
5940
  asset,
4823
5941
  destination,
4824
5942
  destinationAddress,
4825
5943
  isAutomatic,
4826
5944
  moonApi,
4827
- moonChain,
5945
+ bridgeChain: moonChain,
4828
5946
  source,
4829
5947
  sourceAddress
4830
5948
  }) => {
4831
5949
  const isSourceParachain = Parachain3.is(source);
4832
5950
  const isDestinationMoonChain = destination.isEqual(moonChain);
4833
- const isDestinationEvmChain = EvmChain.is(destination);
5951
+ const isDestinationEvmChain = EvmChain2.is(destination);
4834
5952
  const isNativeAsset = asset.isSame(
4835
5953
  isDestinationEvmChain ? moonChain.nativeAsset : source.nativeAsset
4836
5954
  );
@@ -4875,12 +5993,12 @@ function getPayload({
4875
5993
  destination,
4876
5994
  destinationAddress
4877
5995
  }) {
4878
- if (!EvmParachain5.isAnyParachain(destination)) {
5996
+ if (!EvmParachain7.isAnyParachain(destination)) {
4879
5997
  throw new Error(
4880
5998
  `Destination ${destination.name} is not a Parachain or EvmParachain`
4881
5999
  );
4882
6000
  }
4883
- const isEvmDestination = EvmParachain5.is(destination);
6001
+ const isEvmDestination = EvmParachain7.is(destination);
4884
6002
  const version = getExtrinsicArgumentVersion(moonApi.tx.polkadotXcm.send);
4885
6003
  const multilocation = moonApi.createType("XcmVersionedLocation", {
4886
6004
  [version]: {
@@ -6096,26 +7214,28 @@ var TOKEN_BRIDGE_ABI = [
6096
7214
  // src/mrl/providers/wormhole/contract/TokenBridge/TokenBridge.ts
6097
7215
  var module3 = "TokenBridge";
6098
7216
  function TokenBridge() {
7217
+ const provider = "wormhole";
6099
7218
  return {
6100
7219
  transferTokens: () => ({
6101
- build: ({ asset, destination, destinationAddress, moonChain }) => {
6102
- const wh = wormholeFactory(moonChain);
7220
+ provider,
7221
+ build: ({ asset, destination, destinationAddress, bridgeChain }) => {
7222
+ const wh = wormholeFactory(bridgeChain);
6103
7223
  const whDestination = wh.getChain(destination.getWormholeName()).config.chainId;
6104
- const tokenAddressOnMoonChain = moonChain.getChainAsset(asset).address;
7224
+ const tokenAddressOnMoonChain = bridgeChain.getChainAsset(asset).address;
6105
7225
  if (!tokenAddressOnMoonChain) {
6106
7226
  throw new Error(
6107
- `Asset ${asset.symbol} does not have a token address on chain ${moonChain.name}`
7227
+ `Asset ${asset.symbol} does not have a token address on chain ${bridgeChain.name}`
6108
7228
  );
6109
7229
  }
6110
7230
  const destinationAddress32bytes = convertAddressTo32Bytes(
6111
7231
  destinationAddress
6112
7232
  );
6113
7233
  const tokenAmountOnMoonChain = asset.convertDecimals(
6114
- moonChain.getChainAsset(asset).decimals
7234
+ bridgeChain.getChainAsset(asset).decimals
6115
7235
  ).amount;
6116
7236
  const contractAddress = wh.getChain("Moonbeam").config.contracts.tokenBridge;
6117
7237
  if (!contractAddress) {
6118
- throw new Error(`Wormhole address not found for ${moonChain.name}`);
7238
+ throw new Error(`Wormhole address not found for ${bridgeChain.name}`);
6119
7239
  }
6120
7240
  return new ContractConfig({
6121
7241
  address: contractAddress,
@@ -6253,26 +7373,28 @@ var TOKEN_BRIDGE_RELAYER_ABI = [
6253
7373
  // src/mrl/providers/wormhole/contract/TokenBridgeRelayer/TokenBridgeRelayer.ts
6254
7374
  var module4 = "TokenBridgeRelayer";
6255
7375
  function TokenBridgeRelayer() {
7376
+ const provider = "wormhole";
6256
7377
  return {
6257
7378
  transferTokensWithRelay: () => ({
6258
- build: ({ asset, destination, destinationAddress, moonChain }) => {
6259
- const wh = wormholeFactory(moonChain);
7379
+ provider,
7380
+ build: ({ asset, destination, destinationAddress, bridgeChain }) => {
7381
+ const wh = wormholeFactory(bridgeChain);
6260
7382
  const whDestination = wh.getChain(destination.getWormholeName()).config.chainId;
6261
- const tokenAddressOnMoonChain = moonChain.getChainAsset(asset).address;
7383
+ const tokenAddressOnMoonChain = bridgeChain.getChainAsset(asset).address;
6262
7384
  if (!tokenAddressOnMoonChain) {
6263
7385
  throw new Error(
6264
- `Asset ${asset.symbol} does not have a token address on chain ${moonChain.name}`
7386
+ `Asset ${asset.symbol} does not have a token address on chain ${bridgeChain.name}`
6265
7387
  );
6266
7388
  }
6267
7389
  const destinationAddress32bytes = convertAddressTo32Bytes2(
6268
7390
  destinationAddress
6269
7391
  );
6270
7392
  const tokenAmountOnMoonChain = asset.convertDecimals(
6271
- moonChain.getChainAsset(asset).decimals
7393
+ bridgeChain.getChainAsset(asset).decimals
6272
7394
  ).amount;
6273
7395
  const contractAddress = wh.getChain("Moonbeam").config.contracts.tokenBridgeRelayer;
6274
7396
  if (!contractAddress) {
6275
- throw new Error(`Wormhole address not found for ${moonChain.name}`);
7397
+ throw new Error(`Wormhole address not found for ${bridgeChain.name}`);
6276
7398
  }
6277
7399
  return new ContractConfig({
6278
7400
  address: contractAddress,
@@ -6294,7 +7416,7 @@ function TokenBridgeRelayer() {
6294
7416
  }
6295
7417
 
6296
7418
  // src/mrl/providers/wormhole/contract/index.ts
6297
- function contract() {
7419
+ function contract2() {
6298
7420
  return { Batch, Gmp, TokenBridge, TokenBridgeRelayer };
6299
7421
  }
6300
7422
 
@@ -6420,36 +7542,38 @@ var BATCH_CONTRACT_ABI = [
6420
7542
 
6421
7543
  // src/mrl/providers/wormhole/extrinsic/ethereumXcm/ethereumXcm.ts
6422
7544
  function ethereumXcm() {
7545
+ const provider = "wormhole";
6423
7546
  return {
6424
7547
  transact: () => ({
7548
+ provider,
6425
7549
  build: (params) => {
6426
- const { asset, isAutomatic, moonChain, moonGasLimit } = params;
6427
- if (!moonGasLimit) {
6428
- throw new Error("moonGasLimit must be defined");
7550
+ const { asset, isAutomatic, bridgeChain, bridgeChainGasLimit } = params;
7551
+ if (!bridgeChainGasLimit) {
7552
+ throw new Error("bridgeChainGasLimit must be defined");
6429
7553
  }
6430
- const tokenAddressOnMoonChain = moonChain.getChainAsset(asset).address;
7554
+ const tokenAddressOnMoonChain = bridgeChain.getChainAsset(asset).address;
6431
7555
  if (!tokenAddressOnMoonChain) {
6432
7556
  throw new Error(
6433
- `Asset ${asset.symbol} does not have a token address on chain ${moonChain.name}`
7557
+ `Asset ${asset.symbol} does not have a token address on chain ${bridgeChain.name}`
6434
7558
  );
6435
7559
  }
6436
7560
  const tokenAmountOnMoonChain = asset.convertDecimals(
6437
- moonChain.getChainAsset(asset).decimals
7561
+ bridgeChain.getChainAsset(asset).decimals
6438
7562
  ).amount;
6439
- const contract2 = isAutomatic ? contract().TokenBridgeRelayer().transferTokensWithRelay().build(params) : contract().TokenBridge().transferTokens().build(params);
7563
+ const contract3 = isAutomatic ? contract2().TokenBridgeRelayer().transferTokensWithRelay().build(params) : contract2().TokenBridge().transferTokens().build(params);
6440
7564
  const approveTx = encodeFunctionData3({
6441
7565
  abi: ERC20_ABI,
6442
7566
  functionName: "approve",
6443
- args: [contract2.address, tokenAmountOnMoonChain]
7567
+ args: [contract3.address, tokenAmountOnMoonChain]
6444
7568
  });
6445
7569
  const batchAll = encodeFunctionData3({
6446
7570
  abi: BATCH_CONTRACT_ABI,
6447
7571
  functionName: "batchAll",
6448
7572
  args: [
6449
- [tokenAddressOnMoonChain, contract2.address],
7573
+ [tokenAddressOnMoonChain, contract3.address],
6450
7574
  [0n, 0n],
6451
7575
  // Value to send for each call
6452
- [approveTx, contract2.encodeFunctionData()],
7576
+ [approveTx, contract3.encodeFunctionData()],
6453
7577
  // Call data for each call
6454
7578
  []
6455
7579
  // Gas limit for each call
@@ -6461,7 +7585,7 @@ function ethereumXcm() {
6461
7585
  getArgs: () => [
6462
7586
  {
6463
7587
  V2: {
6464
- gasLimit: moonGasLimit,
7588
+ gasLimit: bridgeChainGasLimit,
6465
7589
  action: {
6466
7590
  Call: BATCH_CONTRACT_ADDRESS
6467
7591
  },
@@ -6477,15 +7601,15 @@ function ethereumXcm() {
6477
7601
  }
6478
7602
 
6479
7603
  // src/mrl/providers/wormhole/extrinsic/index.ts
6480
- function extrinsic() {
7604
+ function extrinsic2() {
6481
7605
  return { ethereumXcm, polkadotXcm: polkadotXcm2 };
6482
7606
  }
6483
7607
 
6484
7608
  // src/mrl/providers/wormhole/index.ts
6485
7609
  function wormhole2() {
6486
7610
  return {
6487
- contract,
6488
- extrinsic,
7611
+ contract: contract2,
7612
+ extrinsic: extrinsic2,
6489
7613
  wormhole
6490
7614
  };
6491
7615
  }
@@ -6493,6 +7617,7 @@ function wormhole2() {
6493
7617
  // src/mrl/MrlBuilder.ts
6494
7618
  function MrlBuilder() {
6495
7619
  return {
7620
+ snowbridge,
6496
7621
  wormhole: wormhole2
6497
7622
  };
6498
7623
  }
@@ -6508,9 +7633,12 @@ export {
6508
7633
  ExtrinsicBuilder,
6509
7634
  ExtrinsicConfig,
6510
7635
  FeeBuilder,
7636
+ GATEWAY_ABI2 as GATEWAY_ABI,
7637
+ GATEWAY_CONTRACT_ADDRESS,
6511
7638
  MonitoringBuilder,
6512
7639
  MrlBuilder,
6513
7640
  Protocols,
7641
+ SnowbridgeConfig,
6514
7642
  SubstrateCallConfig,
6515
7643
  SubstrateQueryConfig,
6516
7644
  TransferType,
@@ -6518,6 +7646,7 @@ export {
6518
7646
  XcmVersion,
6519
7647
  calculateSystemAccountBalance,
6520
7648
  evm,
7649
+ snowbridge,
6521
7650
  substrate,
6522
7651
  wormhole2 as wormhole,
6523
7652
  wormholeFactory