@moonbeam-network/xcm-builder 4.3.0 → 4.4.0
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.d.ts +1217 -57
- package/build/index.mjs +1251 -114
- package/build/index.mjs.map +1 -1
- package/package.json +11 -11
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
|
|
122
|
+
const pallet8 = "assetRegistry";
|
|
120
123
|
return {
|
|
121
124
|
assetMetadatas: () => ({
|
|
122
125
|
build: ({ asset }) => new SubstrateQueryConfig({
|
|
123
|
-
module:
|
|
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:
|
|
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:
|
|
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,888 @@ 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 { EvmChain, 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
|
-
|
|
3098
|
-
|
|
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/fee/gateway/gateway.ts
|
|
3911
|
+
function gateway() {
|
|
3912
|
+
return {
|
|
3913
|
+
quoteSendTokenFee() {
|
|
3914
|
+
return {
|
|
3915
|
+
build: ({ asset, destination, source }) => {
|
|
3916
|
+
if (!asset.address) {
|
|
3917
|
+
throw new Error(`Asset ${asset.key} has no address`);
|
|
3918
|
+
}
|
|
3919
|
+
if (!EvmChain.is(source) || !source.contracts?.Gateway) {
|
|
3920
|
+
throw new Error(
|
|
3921
|
+
"Source must be an EVMChain with the Gateway contract address configured for getting the quote send token fee for Gateway module"
|
|
3922
|
+
);
|
|
3923
|
+
}
|
|
3924
|
+
if (!EvmParachain2.isAnyParachain(destination)) {
|
|
3925
|
+
throw new Error(
|
|
3926
|
+
"Destination must be a Parachain or EvmParachain for getting the quote send token fee for Gateway module"
|
|
3927
|
+
);
|
|
3928
|
+
}
|
|
3929
|
+
return new ContractConfig({
|
|
3930
|
+
address: source.contracts.Gateway,
|
|
3931
|
+
abi: GATEWAY_ABI,
|
|
3932
|
+
args: [asset.address, destination.parachainId, 0n],
|
|
3933
|
+
func: "quoteSendTokenFee",
|
|
3934
|
+
module: "Gateway"
|
|
3935
|
+
});
|
|
3936
|
+
}
|
|
3103
3937
|
};
|
|
3104
3938
|
}
|
|
3105
3939
|
};
|
|
3106
3940
|
}
|
|
3107
3941
|
|
|
3108
|
-
// src/
|
|
3109
|
-
function
|
|
3942
|
+
// src/fee/outboundQueueApi/outboundQueueApi.ts
|
|
3943
|
+
function outboundQueueApi() {
|
|
3110
3944
|
return {
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3945
|
+
calculateFee: () => {
|
|
3946
|
+
return {
|
|
3947
|
+
build: ({ address, balance, feeAsset }) => {
|
|
3948
|
+
const args = [
|
|
3949
|
+
{
|
|
3950
|
+
MintForeignToken: {
|
|
3951
|
+
tokenId: feeAsset.getAssetId(),
|
|
3952
|
+
recipient: address,
|
|
3953
|
+
amount: balance?.amount
|
|
3954
|
+
}
|
|
3955
|
+
},
|
|
3956
|
+
null
|
|
3957
|
+
];
|
|
3958
|
+
return new SubstrateQueryConfig({
|
|
3959
|
+
module: "outboundQueueApi",
|
|
3960
|
+
func: "calculateFee",
|
|
3961
|
+
args,
|
|
3962
|
+
queryType: "call",
|
|
3963
|
+
transform: async (data) => data.local.toBigInt() + data.remote.toBigInt()
|
|
3964
|
+
});
|
|
3965
|
+
}
|
|
3966
|
+
};
|
|
3967
|
+
}
|
|
3116
3968
|
};
|
|
3117
3969
|
}
|
|
3118
3970
|
|
|
3119
3971
|
// src/fee/FeeBuilder.utils.ts
|
|
3120
|
-
import { EvmParachain as
|
|
3972
|
+
import { EvmParachain as EvmParachain3 } from "@moonbeam-network/xcm-types";
|
|
3121
3973
|
import { isEthAddress as isEthAddress2 } from "@moonbeam-network/xcm-utils";
|
|
3122
3974
|
import { u8aToHex as u8aToHex5 } from "@polkadot/util";
|
|
3123
3975
|
import { decodeAddress as decodeAddress5 } from "@polkadot/util-crypto";
|
|
@@ -3138,7 +3990,7 @@ function getWithdrawAssetInstruction(assetTypes) {
|
|
|
3138
3990
|
};
|
|
3139
3991
|
}
|
|
3140
3992
|
function getUniversalOriginInstruction(source) {
|
|
3141
|
-
if (!
|
|
3993
|
+
if (!EvmParachain3.isAnyParachain(source)) {
|
|
3142
3994
|
throw new Error("Source is not a parachain");
|
|
3143
3995
|
}
|
|
3144
3996
|
return {
|
|
@@ -3148,7 +4000,7 @@ function getUniversalOriginInstruction(source) {
|
|
|
3148
4000
|
};
|
|
3149
4001
|
}
|
|
3150
4002
|
function getDescendOriginInstruction(source) {
|
|
3151
|
-
if (!
|
|
4003
|
+
if (!EvmParachain3.isAnyParachain(source)) {
|
|
3152
4004
|
throw new Error("Source is not a parachain");
|
|
3153
4005
|
}
|
|
3154
4006
|
return {
|
|
@@ -3537,35 +4389,39 @@ var createXcmFeeBuilder = ({
|
|
|
3537
4389
|
getVersionedTransferAsset,
|
|
3538
4390
|
options
|
|
3539
4391
|
}) => ({
|
|
3540
|
-
build: (params) =>
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
4392
|
+
build: (params) => {
|
|
4393
|
+
return new SubstrateCallConfig({
|
|
4394
|
+
api: params.api,
|
|
4395
|
+
call: async () => {
|
|
4396
|
+
const [assets3, versionedFeeAssetId] = await getVersionedAssets({
|
|
4397
|
+
getVersionedFeeAsset,
|
|
4398
|
+
getVersionedTransferAsset,
|
|
4399
|
+
options,
|
|
4400
|
+
params
|
|
4401
|
+
});
|
|
4402
|
+
const instructions = getInstructions({
|
|
4403
|
+
isAssetReserveChain: options.isAssetReserveChain,
|
|
4404
|
+
assets: assets3,
|
|
4405
|
+
versionedFeeAssetId,
|
|
4406
|
+
address: params.address,
|
|
4407
|
+
source: params.source,
|
|
4408
|
+
isEcosystemBridge: options.isEcosystemBridge
|
|
4409
|
+
});
|
|
4410
|
+
return getFeeForXcmInstructionsAndAsset(
|
|
4411
|
+
params.api,
|
|
4412
|
+
instructions,
|
|
4413
|
+
versionedFeeAssetId
|
|
4414
|
+
);
|
|
4415
|
+
}
|
|
4416
|
+
});
|
|
4417
|
+
}
|
|
3564
4418
|
});
|
|
3565
4419
|
|
|
3566
4420
|
// src/fee/FeeBuilder.ts
|
|
3567
4421
|
function FeeBuilder() {
|
|
3568
4422
|
return {
|
|
4423
|
+
gateway,
|
|
4424
|
+
outboundQueueApi,
|
|
3569
4425
|
xcmPaymentApi
|
|
3570
4426
|
};
|
|
3571
4427
|
}
|
|
@@ -3827,9 +4683,272 @@ function MonitoringBuilder() {
|
|
|
3827
4683
|
};
|
|
3828
4684
|
}
|
|
3829
4685
|
|
|
4686
|
+
// src/mrl/providers/snowbridge/contract/Gateway/Gateway.ts
|
|
4687
|
+
import {
|
|
4688
|
+
EvmParachain as EvmParachain4
|
|
4689
|
+
} from "@moonbeam-network/xcm-types";
|
|
4690
|
+
|
|
4691
|
+
// src/mrl/MrlBuilder.interfaces.ts
|
|
4692
|
+
var Provider = /* @__PURE__ */ ((Provider2) => {
|
|
4693
|
+
Provider2["Snowbridge"] = "snowbridge";
|
|
4694
|
+
Provider2["Wormhole"] = "wormhole";
|
|
4695
|
+
return Provider2;
|
|
4696
|
+
})(Provider || {});
|
|
4697
|
+
|
|
4698
|
+
// src/mrl/providers/snowbridge/snowbridge/SnowbridgeConfig.ts
|
|
4699
|
+
var SnowbridgeConfig = class _SnowbridgeConfig {
|
|
4700
|
+
args;
|
|
4701
|
+
func;
|
|
4702
|
+
provider = "snowbridge" /* Snowbridge */;
|
|
4703
|
+
static is(obj) {
|
|
4704
|
+
return obj instanceof _SnowbridgeConfig;
|
|
4705
|
+
}
|
|
4706
|
+
constructor({ args, func }) {
|
|
4707
|
+
this.args = args;
|
|
4708
|
+
this.func = func;
|
|
4709
|
+
}
|
|
4710
|
+
};
|
|
4711
|
+
|
|
4712
|
+
// src/mrl/providers/snowbridge/contract/Gateway/Gateway.ts
|
|
4713
|
+
function Gateway() {
|
|
4714
|
+
const provider = "snowbridge" /* Snowbridge */;
|
|
4715
|
+
return {
|
|
4716
|
+
sendToken: () => ({
|
|
4717
|
+
provider,
|
|
4718
|
+
build: ({ asset, destinationAddress, protocolFee, destination }) => callSendToken(asset, protocolFee, destination, destinationAddress)
|
|
4719
|
+
}),
|
|
4720
|
+
approveAndSendToken: () => ({
|
|
4721
|
+
provider,
|
|
4722
|
+
build: ({ asset, destinationAddress, protocolFee, destination }) => {
|
|
4723
|
+
const requiresApproval = protocolFee && !protocolFee.isSame(asset);
|
|
4724
|
+
return callSendToken(
|
|
4725
|
+
asset,
|
|
4726
|
+
protocolFee,
|
|
4727
|
+
destination,
|
|
4728
|
+
destinationAddress,
|
|
4729
|
+
requiresApproval
|
|
4730
|
+
);
|
|
4731
|
+
}
|
|
4732
|
+
})
|
|
4733
|
+
};
|
|
4734
|
+
}
|
|
4735
|
+
function callSendToken(asset, protocolFee, destination, destinationAddress, requiresApproval = false) {
|
|
4736
|
+
if (!protocolFee) {
|
|
4737
|
+
throw new Error("Protocol fee is required for Gateway module");
|
|
4738
|
+
}
|
|
4739
|
+
if (!EvmParachain4.isAnyParachain(destination)) {
|
|
4740
|
+
throw new Error(
|
|
4741
|
+
"Destination must be a Parachain or EvmParachain for sending token with Gateway module"
|
|
4742
|
+
);
|
|
4743
|
+
}
|
|
4744
|
+
return new SnowbridgeConfig({
|
|
4745
|
+
args: {
|
|
4746
|
+
tokenAddress: asset.address,
|
|
4747
|
+
destinationAddress,
|
|
4748
|
+
destinationParaId: destination.parachainId,
|
|
4749
|
+
amount: asset.amount,
|
|
4750
|
+
bridgeFeeAmount: protocolFee.amount,
|
|
4751
|
+
requiresApproval
|
|
4752
|
+
},
|
|
4753
|
+
func: "sendToken"
|
|
4754
|
+
});
|
|
4755
|
+
}
|
|
4756
|
+
|
|
4757
|
+
// src/mrl/providers/snowbridge/contract/index.ts
|
|
4758
|
+
function contract() {
|
|
4759
|
+
return { Gateway };
|
|
4760
|
+
}
|
|
4761
|
+
|
|
4762
|
+
// src/mrl/providers/snowbridge/extrinsic/ethereumTokenTransfer/ethereumTokenTransfers.ts
|
|
4763
|
+
var pallet6 = "ethereumTokenTransfers";
|
|
4764
|
+
function ethereumTokenTransfers() {
|
|
4765
|
+
return {
|
|
4766
|
+
transferNativeToken: () => {
|
|
4767
|
+
const func = "transferNativeToken";
|
|
4768
|
+
const provider = "snowbridge" /* Snowbridge */;
|
|
4769
|
+
return {
|
|
4770
|
+
provider,
|
|
4771
|
+
build: ({ asset, destinationAddress }) => {
|
|
4772
|
+
return new ExtrinsicConfig({
|
|
4773
|
+
module: pallet6,
|
|
4774
|
+
func,
|
|
4775
|
+
getArgs: () => [asset.amount, destinationAddress]
|
|
4776
|
+
});
|
|
4777
|
+
}
|
|
4778
|
+
};
|
|
4779
|
+
}
|
|
4780
|
+
};
|
|
4781
|
+
}
|
|
4782
|
+
|
|
4783
|
+
// src/mrl/providers/snowbridge/extrinsic/xcmPallet/xcmPallet.ts
|
|
4784
|
+
import { EvmChain as EvmChain2 } from "@moonbeam-network/xcm-types";
|
|
4785
|
+
|
|
4786
|
+
// src/mrl/providers/snowbridge/extrinsic/xcmPallet/xcmPallet.utils.ts
|
|
4787
|
+
function getGlobalConsensusArgs({
|
|
4788
|
+
assets: assets3,
|
|
4789
|
+
destination,
|
|
4790
|
+
destinationAddress,
|
|
4791
|
+
func
|
|
4792
|
+
}) {
|
|
4793
|
+
const version = getExtrinsicArgumentVersion(func);
|
|
4794
|
+
const dest = {
|
|
4795
|
+
[version]: {
|
|
4796
|
+
parents: 1,
|
|
4797
|
+
interior: {
|
|
4798
|
+
X1: [
|
|
4799
|
+
{
|
|
4800
|
+
GlobalConsensus: {
|
|
4801
|
+
Ethereum: { chainId: destination.id }
|
|
4802
|
+
}
|
|
4803
|
+
}
|
|
4804
|
+
]
|
|
4805
|
+
}
|
|
4806
|
+
}
|
|
4807
|
+
};
|
|
4808
|
+
const beneficiary = {
|
|
4809
|
+
[version]: {
|
|
4810
|
+
parents: 0,
|
|
4811
|
+
interior: {
|
|
4812
|
+
X1: [
|
|
4813
|
+
{
|
|
4814
|
+
AccountKey20: {
|
|
4815
|
+
network: { Ethereum: { chainId: destination.id } },
|
|
4816
|
+
key: destinationAddress
|
|
4817
|
+
}
|
|
4818
|
+
}
|
|
4819
|
+
]
|
|
4820
|
+
}
|
|
4821
|
+
}
|
|
4822
|
+
};
|
|
4823
|
+
const assetsArg = {
|
|
4824
|
+
[version]: assets3
|
|
4825
|
+
};
|
|
4826
|
+
return [
|
|
4827
|
+
dest,
|
|
4828
|
+
beneficiary,
|
|
4829
|
+
assetsArg,
|
|
4830
|
+
0,
|
|
4831
|
+
// feeAssetItem
|
|
4832
|
+
"Unlimited"
|
|
4833
|
+
];
|
|
4834
|
+
}
|
|
4835
|
+
|
|
4836
|
+
// src/mrl/providers/snowbridge/extrinsic/xcmPallet/xcmPallet.ts
|
|
4837
|
+
var pallet7 = "xcmPallet";
|
|
4838
|
+
function xcmPallet2() {
|
|
4839
|
+
return {
|
|
4840
|
+
transferAssets: () => {
|
|
4841
|
+
const func = "transferAssets";
|
|
4842
|
+
const provider = "snowbridge" /* Snowbridge */;
|
|
4843
|
+
return {
|
|
4844
|
+
globalConsensus: () => ({
|
|
4845
|
+
provider,
|
|
4846
|
+
build: ({ asset, destination, destinationAddress }) => {
|
|
4847
|
+
if (!EvmChain2.is(destination)) {
|
|
4848
|
+
throw new Error(
|
|
4849
|
+
"Destination must be an EVM chain for globalConsensus function"
|
|
4850
|
+
);
|
|
4851
|
+
}
|
|
4852
|
+
return new ExtrinsicConfig({
|
|
4853
|
+
module: pallet7,
|
|
4854
|
+
func,
|
|
4855
|
+
getArgs: (extrinsicFunction) => {
|
|
4856
|
+
const assets3 = [
|
|
4857
|
+
{
|
|
4858
|
+
id: {
|
|
4859
|
+
parents: 1,
|
|
4860
|
+
interior: {
|
|
4861
|
+
X1: [
|
|
4862
|
+
{
|
|
4863
|
+
GlobalConsensus: {
|
|
4864
|
+
Ethereum: { chainId: destination.id }
|
|
4865
|
+
}
|
|
4866
|
+
}
|
|
4867
|
+
]
|
|
4868
|
+
}
|
|
4869
|
+
},
|
|
4870
|
+
fun: { Fungible: asset.amount }
|
|
4871
|
+
}
|
|
4872
|
+
];
|
|
4873
|
+
return getGlobalConsensusArgs({
|
|
4874
|
+
assets: assets3,
|
|
4875
|
+
destination,
|
|
4876
|
+
destinationAddress,
|
|
4877
|
+
func: extrinsicFunction
|
|
4878
|
+
});
|
|
4879
|
+
}
|
|
4880
|
+
});
|
|
4881
|
+
}
|
|
4882
|
+
}),
|
|
4883
|
+
globalConsensusErc20: () => ({
|
|
4884
|
+
provider,
|
|
4885
|
+
build: ({ asset, destination, destinationAddress }) => {
|
|
4886
|
+
if (!EvmChain2.is(destination)) {
|
|
4887
|
+
throw new Error(
|
|
4888
|
+
"Destination must be an EVM chain for globalConsensusErc20 function"
|
|
4889
|
+
);
|
|
4890
|
+
}
|
|
4891
|
+
const assetInDestination = destination.getChainAsset(asset);
|
|
4892
|
+
return new ExtrinsicConfig({
|
|
4893
|
+
module: pallet7,
|
|
4894
|
+
func,
|
|
4895
|
+
getArgs: (extrinsicFunction) => {
|
|
4896
|
+
const assets3 = [
|
|
4897
|
+
{
|
|
4898
|
+
id: {
|
|
4899
|
+
parents: 1,
|
|
4900
|
+
interior: {
|
|
4901
|
+
X2: [
|
|
4902
|
+
{
|
|
4903
|
+
GlobalConsensus: {
|
|
4904
|
+
Ethereum: { chainId: destination.id }
|
|
4905
|
+
}
|
|
4906
|
+
},
|
|
4907
|
+
{
|
|
4908
|
+
AccountKey20: {
|
|
4909
|
+
network: {
|
|
4910
|
+
Ethereum: { chainId: destination.id }
|
|
4911
|
+
},
|
|
4912
|
+
key: assetInDestination.address
|
|
4913
|
+
}
|
|
4914
|
+
}
|
|
4915
|
+
]
|
|
4916
|
+
}
|
|
4917
|
+
},
|
|
4918
|
+
fun: { Fungible: asset.amount }
|
|
4919
|
+
}
|
|
4920
|
+
];
|
|
4921
|
+
return getGlobalConsensusArgs({
|
|
4922
|
+
assets: assets3,
|
|
4923
|
+
destination,
|
|
4924
|
+
destinationAddress,
|
|
4925
|
+
func: extrinsicFunction
|
|
4926
|
+
});
|
|
4927
|
+
}
|
|
4928
|
+
});
|
|
4929
|
+
}
|
|
4930
|
+
})
|
|
4931
|
+
};
|
|
4932
|
+
}
|
|
4933
|
+
};
|
|
4934
|
+
}
|
|
4935
|
+
|
|
4936
|
+
// src/mrl/providers/snowbridge/extrinsic/index.ts
|
|
4937
|
+
function extrinsic() {
|
|
4938
|
+
return { ethereumTokenTransfers, xcmPallet: xcmPallet2 };
|
|
4939
|
+
}
|
|
4940
|
+
|
|
4941
|
+
// src/mrl/providers/snowbridge/index.ts
|
|
4942
|
+
function snowbridge() {
|
|
4943
|
+
return {
|
|
4944
|
+
contract,
|
|
4945
|
+
extrinsic
|
|
4946
|
+
};
|
|
4947
|
+
}
|
|
4948
|
+
|
|
3830
4949
|
// src/mrl/providers/wormhole/contract/Batch/Batch.ts
|
|
3831
4950
|
import {
|
|
3832
|
-
EvmParachain as
|
|
4951
|
+
EvmParachain as EvmParachain5
|
|
3833
4952
|
} from "@moonbeam-network/xcm-types";
|
|
3834
4953
|
import { getMultilocationDerivedAddresses as getMultilocationDerivedAddresses2 } from "@moonbeam-network/xcm-utils";
|
|
3835
4954
|
import { evmToAddress as evmToAddress3 } from "@polkadot/util-crypto";
|
|
@@ -3844,8 +4963,10 @@ import { getMultilocationDerivedAddresses } from "@moonbeam-network/xcm-utils";
|
|
|
3844
4963
|
var BUY_EXECUTION_FEE = 100000000000000000n;
|
|
3845
4964
|
var CROSS_CHAIN_FEE = 100000000000000000n;
|
|
3846
4965
|
function polkadotXcm2() {
|
|
4966
|
+
const provider = "wormhole" /* Wormhole */;
|
|
3847
4967
|
return {
|
|
3848
4968
|
send: () => ({
|
|
4969
|
+
provider,
|
|
3849
4970
|
build: ({
|
|
3850
4971
|
asset,
|
|
3851
4972
|
destination,
|
|
@@ -3853,7 +4974,7 @@ function polkadotXcm2() {
|
|
|
3853
4974
|
fee,
|
|
3854
4975
|
isAutomatic,
|
|
3855
4976
|
moonAsset,
|
|
3856
|
-
|
|
4977
|
+
bridgeChain,
|
|
3857
4978
|
moonApi,
|
|
3858
4979
|
sendOnlyRemoteExecution,
|
|
3859
4980
|
source,
|
|
@@ -3884,7 +5005,7 @@ function polkadotXcm2() {
|
|
|
3884
5005
|
isAutomatic,
|
|
3885
5006
|
moonApi,
|
|
3886
5007
|
moonAsset,
|
|
3887
|
-
|
|
5008
|
+
bridgeChain,
|
|
3888
5009
|
source,
|
|
3889
5010
|
sourceAddress,
|
|
3890
5011
|
sourceApi
|
|
@@ -3897,7 +5018,7 @@ function polkadotXcm2() {
|
|
|
3897
5018
|
fee,
|
|
3898
5019
|
isAutomatic,
|
|
3899
5020
|
moonAsset,
|
|
3900
|
-
|
|
5021
|
+
bridgeChain,
|
|
3901
5022
|
moonApi,
|
|
3902
5023
|
source,
|
|
3903
5024
|
sourceAddress,
|
|
@@ -3917,7 +5038,7 @@ function polkadotXcm2() {
|
|
|
3917
5038
|
function buildSendExtrinsic({
|
|
3918
5039
|
computedOriginAccount,
|
|
3919
5040
|
moonAsset,
|
|
3920
|
-
|
|
5041
|
+
bridgeChain,
|
|
3921
5042
|
sourceApi,
|
|
3922
5043
|
transact
|
|
3923
5044
|
}) {
|
|
@@ -3930,7 +5051,7 @@ function buildSendExtrinsic({
|
|
|
3930
5051
|
[version]: normalizeX1(version, {
|
|
3931
5052
|
parents: 1,
|
|
3932
5053
|
interior: {
|
|
3933
|
-
X1: { Parachain:
|
|
5054
|
+
X1: { Parachain: bridgeChain.parachainId }
|
|
3934
5055
|
}
|
|
3935
5056
|
})
|
|
3936
5057
|
},
|
|
@@ -4013,7 +5134,7 @@ function getAssetTransferTxs({
|
|
|
4013
5134
|
fee,
|
|
4014
5135
|
moonApi,
|
|
4015
5136
|
moonAsset,
|
|
4016
|
-
|
|
5137
|
+
bridgeChain,
|
|
4017
5138
|
source,
|
|
4018
5139
|
sourceAddress,
|
|
4019
5140
|
sourceApi
|
|
@@ -4029,7 +5150,7 @@ function getAssetTransferTxs({
|
|
|
4029
5150
|
// for this we have to add a new concept in the config (Cross Chain Fee), and get the value from there
|
|
4030
5151
|
amount: asset.amount + 10n * CROSS_CHAIN_FEE
|
|
4031
5152
|
}),
|
|
4032
|
-
destination:
|
|
5153
|
+
destination: bridgeChain,
|
|
4033
5154
|
destinationAddress: computedOriginAccount,
|
|
4034
5155
|
destinationApi: moonApi,
|
|
4035
5156
|
fee,
|
|
@@ -4043,7 +5164,7 @@ function getAssetTransferTxs({
|
|
|
4043
5164
|
asset: AssetAmount.fromChainAsset(source.getChainAsset(moonAsset), {
|
|
4044
5165
|
amount: CROSS_CHAIN_FEE + BUY_EXECUTION_FEE
|
|
4045
5166
|
}),
|
|
4046
|
-
destination:
|
|
5167
|
+
destination: bridgeChain,
|
|
4047
5168
|
destinationAddress: computedOriginAccount,
|
|
4048
5169
|
destinationApi: moonApi,
|
|
4049
5170
|
fee,
|
|
@@ -4057,7 +5178,7 @@ function getAssetTransferTxs({
|
|
|
4057
5178
|
const multiCurrenciesTransferTx = transferMulticurrencies(
|
|
4058
5179
|
...transferMulticurrenciesBuilder.build({
|
|
4059
5180
|
asset,
|
|
4060
|
-
destination:
|
|
5181
|
+
destination: bridgeChain,
|
|
4061
5182
|
destinationAddress: computedOriginAccount,
|
|
4062
5183
|
destinationApi: moonApi,
|
|
4063
5184
|
fee: AssetAmount.fromChainAsset(source.getChainAsset(moonAsset), {
|
|
@@ -4613,8 +5734,10 @@ function getAbisForChain(_) {
|
|
|
4613
5734
|
// src/mrl/providers/wormhole/contract/Batch/Batch.ts
|
|
4614
5735
|
var module = "Batch";
|
|
4615
5736
|
function Batch() {
|
|
5737
|
+
const provider = "wormhole" /* Wormhole */;
|
|
4616
5738
|
return {
|
|
4617
5739
|
transferAssetsAndMessage: () => ({
|
|
5740
|
+
provider,
|
|
4618
5741
|
build: ({
|
|
4619
5742
|
asset,
|
|
4620
5743
|
destination,
|
|
@@ -4622,14 +5745,14 @@ function Batch() {
|
|
|
4622
5745
|
fee,
|
|
4623
5746
|
isAutomatic,
|
|
4624
5747
|
moonAsset,
|
|
4625
|
-
|
|
5748
|
+
bridgeChain,
|
|
4626
5749
|
moonApi,
|
|
4627
5750
|
source,
|
|
4628
5751
|
sourceAddress,
|
|
4629
5752
|
sourceApi,
|
|
4630
5753
|
transact
|
|
4631
5754
|
}) => {
|
|
4632
|
-
if (!
|
|
5755
|
+
if (!EvmParachain5.is(source)) {
|
|
4633
5756
|
throw new Error("Source chain needs to be an EVMParachain");
|
|
4634
5757
|
}
|
|
4635
5758
|
if (!sourceApi) {
|
|
@@ -4655,7 +5778,7 @@ function Batch() {
|
|
|
4655
5778
|
fee,
|
|
4656
5779
|
isAutomatic,
|
|
4657
5780
|
moonAsset,
|
|
4658
|
-
|
|
5781
|
+
bridgeChain,
|
|
4659
5782
|
moonApi,
|
|
4660
5783
|
source,
|
|
4661
5784
|
sourceAddress,
|
|
@@ -4663,7 +5786,7 @@ function Batch() {
|
|
|
4663
5786
|
transact
|
|
4664
5787
|
});
|
|
4665
5788
|
const encodedXcmMessage = send.args[1].toHex();
|
|
4666
|
-
const { destinationParachain, destinationParachainAndAddress } = getDestinationInHex(
|
|
5789
|
+
const { destinationParachain, destinationParachainAndAddress } = getDestinationInHex(bridgeChain, computedOriginAccount);
|
|
4667
5790
|
const { currencies, feeItem } = getCurrencies({
|
|
4668
5791
|
source,
|
|
4669
5792
|
moonAsset,
|
|
@@ -4696,15 +5819,15 @@ function Batch() {
|
|
|
4696
5819
|
})
|
|
4697
5820
|
};
|
|
4698
5821
|
}
|
|
4699
|
-
function getDestinationInHex(
|
|
5822
|
+
function getDestinationInHex(bridgeChain, computedOriginAccount) {
|
|
4700
5823
|
const destinationParachain = {
|
|
4701
5824
|
parents: 1,
|
|
4702
|
-
interior: getPrecompileDestinationInterior(
|
|
5825
|
+
interior: getPrecompileDestinationInterior(bridgeChain)
|
|
4703
5826
|
};
|
|
4704
5827
|
const destinationParachainAndAddress = {
|
|
4705
5828
|
parents: 1,
|
|
4706
5829
|
interior: getPrecompileDestinationInterior(
|
|
4707
|
-
|
|
5830
|
+
bridgeChain,
|
|
4708
5831
|
computedOriginAccount
|
|
4709
5832
|
)
|
|
4710
5833
|
};
|
|
@@ -4781,6 +5904,7 @@ var Protocols = /* @__PURE__ */ ((Protocols2) => {
|
|
|
4781
5904
|
var WormholeConfig = class _WormholeConfig {
|
|
4782
5905
|
args;
|
|
4783
5906
|
func;
|
|
5907
|
+
provider = "wormhole" /* Wormhole */;
|
|
4784
5908
|
static is(obj) {
|
|
4785
5909
|
return obj instanceof _WormholeConfig;
|
|
4786
5910
|
}
|
|
@@ -4791,20 +5915,20 @@ var WormholeConfig = class _WormholeConfig {
|
|
|
4791
5915
|
};
|
|
4792
5916
|
|
|
4793
5917
|
// src/mrl/providers/wormhole/wormhole/wormhole.ts
|
|
4794
|
-
import { EvmChain, EvmParachain as
|
|
5918
|
+
import { EvmChain as EvmChain3, EvmParachain as EvmParachain7, Parachain as Parachain3 } from "@moonbeam-network/xcm-types";
|
|
4795
5919
|
import { getMultilocationDerivedAddresses as getMultilocationDerivedAddresses3 } from "@moonbeam-network/xcm-utils";
|
|
4796
5920
|
import { evmToAddress as evmToAddress4 } from "@polkadot/util-crypto/address";
|
|
4797
5921
|
import { Wormhole as Wormhole2 } from "@wormhole-foundation/sdk-connect";
|
|
4798
5922
|
|
|
4799
5923
|
// src/mrl/providers/wormhole/wormhole/wormholeFactory.ts
|
|
4800
|
-
import { EvmParachain as
|
|
5924
|
+
import { EvmParachain as EvmParachain6 } from "@moonbeam-network/xcm-types";
|
|
4801
5925
|
import { Wormhole } from "@wormhole-foundation/sdk-connect";
|
|
4802
5926
|
import { EvmPlatform } from "@wormhole-foundation/sdk-evm";
|
|
4803
5927
|
function wormholeFactory(chain) {
|
|
4804
5928
|
return new Wormhole(
|
|
4805
5929
|
chain.isTestChain ? "Testnet" : "Mainnet",
|
|
4806
5930
|
[EvmPlatform],
|
|
4807
|
-
|
|
5931
|
+
EvmParachain6.isAnyEvmChain(chain) && chain.wh ? {
|
|
4808
5932
|
chains: {
|
|
4809
5933
|
[chain.wh.name]: {
|
|
4810
5934
|
rpc: chain.rpc
|
|
@@ -4816,21 +5940,23 @@ function wormholeFactory(chain) {
|
|
|
4816
5940
|
|
|
4817
5941
|
// src/mrl/providers/wormhole/wormhole/wormhole.ts
|
|
4818
5942
|
function wormhole() {
|
|
5943
|
+
const provider = "wormhole" /* Wormhole */;
|
|
4819
5944
|
return {
|
|
4820
5945
|
tokenTransfer: () => ({
|
|
5946
|
+
provider,
|
|
4821
5947
|
build: ({
|
|
4822
5948
|
asset,
|
|
4823
5949
|
destination,
|
|
4824
5950
|
destinationAddress,
|
|
4825
5951
|
isAutomatic,
|
|
4826
5952
|
moonApi,
|
|
4827
|
-
moonChain,
|
|
5953
|
+
bridgeChain: moonChain,
|
|
4828
5954
|
source,
|
|
4829
5955
|
sourceAddress
|
|
4830
5956
|
}) => {
|
|
4831
5957
|
const isSourceParachain = Parachain3.is(source);
|
|
4832
5958
|
const isDestinationMoonChain = destination.isEqual(moonChain);
|
|
4833
|
-
const isDestinationEvmChain =
|
|
5959
|
+
const isDestinationEvmChain = EvmChain3.is(destination);
|
|
4834
5960
|
const isNativeAsset = asset.isSame(
|
|
4835
5961
|
isDestinationEvmChain ? moonChain.nativeAsset : source.nativeAsset
|
|
4836
5962
|
);
|
|
@@ -4875,12 +6001,12 @@ function getPayload({
|
|
|
4875
6001
|
destination,
|
|
4876
6002
|
destinationAddress
|
|
4877
6003
|
}) {
|
|
4878
|
-
if (!
|
|
6004
|
+
if (!EvmParachain7.isAnyParachain(destination)) {
|
|
4879
6005
|
throw new Error(
|
|
4880
6006
|
`Destination ${destination.name} is not a Parachain or EvmParachain`
|
|
4881
6007
|
);
|
|
4882
6008
|
}
|
|
4883
|
-
const isEvmDestination =
|
|
6009
|
+
const isEvmDestination = EvmParachain7.is(destination);
|
|
4884
6010
|
const version = getExtrinsicArgumentVersion(moonApi.tx.polkadotXcm.send);
|
|
4885
6011
|
const multilocation = moonApi.createType("XcmVersionedLocation", {
|
|
4886
6012
|
[version]: {
|
|
@@ -6096,33 +7222,35 @@ var TOKEN_BRIDGE_ABI = [
|
|
|
6096
7222
|
// src/mrl/providers/wormhole/contract/TokenBridge/TokenBridge.ts
|
|
6097
7223
|
var module3 = "TokenBridge";
|
|
6098
7224
|
function TokenBridge() {
|
|
7225
|
+
const provider = "wormhole" /* Wormhole */;
|
|
6099
7226
|
return {
|
|
6100
7227
|
transferTokens: () => ({
|
|
6101
|
-
|
|
6102
|
-
|
|
7228
|
+
provider,
|
|
7229
|
+
build: ({ asset, destination, destinationAddress, bridgeChain }) => {
|
|
7230
|
+
const wh = wormholeFactory(bridgeChain);
|
|
6103
7231
|
const whDestination = wh.getChain(destination.getWormholeName()).config.chainId;
|
|
6104
|
-
const
|
|
6105
|
-
if (!
|
|
7232
|
+
const tokenAddressOnBridgeChain = bridgeChain.getChainAsset(asset).address;
|
|
7233
|
+
if (!tokenAddressOnBridgeChain) {
|
|
6106
7234
|
throw new Error(
|
|
6107
|
-
`Asset ${asset.symbol} does not have a token address on chain ${
|
|
7235
|
+
`Asset ${asset.symbol} does not have a token address on chain ${bridgeChain.name}`
|
|
6108
7236
|
);
|
|
6109
7237
|
}
|
|
6110
7238
|
const destinationAddress32bytes = convertAddressTo32Bytes(
|
|
6111
7239
|
destinationAddress
|
|
6112
7240
|
);
|
|
6113
|
-
const
|
|
6114
|
-
|
|
7241
|
+
const tokenAmountOnBridgeChain = asset.convertDecimals(
|
|
7242
|
+
bridgeChain.getChainAsset(asset).decimals
|
|
6115
7243
|
).amount;
|
|
6116
7244
|
const contractAddress = wh.getChain("Moonbeam").config.contracts.tokenBridge;
|
|
6117
7245
|
if (!contractAddress) {
|
|
6118
|
-
throw new Error(`Wormhole address not found for ${
|
|
7246
|
+
throw new Error(`Wormhole address not found for ${bridgeChain.name}`);
|
|
6119
7247
|
}
|
|
6120
7248
|
return new ContractConfig({
|
|
6121
7249
|
address: contractAddress,
|
|
6122
7250
|
abi: TOKEN_BRIDGE_ABI,
|
|
6123
7251
|
args: [
|
|
6124
|
-
|
|
6125
|
-
|
|
7252
|
+
tokenAddressOnBridgeChain,
|
|
7253
|
+
tokenAmountOnBridgeChain,
|
|
6126
7254
|
whDestination,
|
|
6127
7255
|
destinationAddress32bytes,
|
|
6128
7256
|
0n,
|
|
@@ -6253,33 +7381,35 @@ var TOKEN_BRIDGE_RELAYER_ABI = [
|
|
|
6253
7381
|
// src/mrl/providers/wormhole/contract/TokenBridgeRelayer/TokenBridgeRelayer.ts
|
|
6254
7382
|
var module4 = "TokenBridgeRelayer";
|
|
6255
7383
|
function TokenBridgeRelayer() {
|
|
7384
|
+
const provider = "wormhole" /* Wormhole */;
|
|
6256
7385
|
return {
|
|
6257
7386
|
transferTokensWithRelay: () => ({
|
|
6258
|
-
|
|
6259
|
-
|
|
7387
|
+
provider,
|
|
7388
|
+
build: ({ asset, destination, destinationAddress, bridgeChain }) => {
|
|
7389
|
+
const wh = wormholeFactory(bridgeChain);
|
|
6260
7390
|
const whDestination = wh.getChain(destination.getWormholeName()).config.chainId;
|
|
6261
|
-
const
|
|
6262
|
-
if (!
|
|
7391
|
+
const tokenAddressOnBridgeChain = bridgeChain.getChainAsset(asset).address;
|
|
7392
|
+
if (!tokenAddressOnBridgeChain) {
|
|
6263
7393
|
throw new Error(
|
|
6264
|
-
`Asset ${asset.symbol} does not have a token address on chain ${
|
|
7394
|
+
`Asset ${asset.symbol} does not have a token address on chain ${bridgeChain.name}`
|
|
6265
7395
|
);
|
|
6266
7396
|
}
|
|
6267
7397
|
const destinationAddress32bytes = convertAddressTo32Bytes2(
|
|
6268
7398
|
destinationAddress
|
|
6269
7399
|
);
|
|
6270
|
-
const
|
|
6271
|
-
|
|
7400
|
+
const tokenAmountOnBridgeChain = asset.convertDecimals(
|
|
7401
|
+
bridgeChain.getChainAsset(asset).decimals
|
|
6272
7402
|
).amount;
|
|
6273
7403
|
const contractAddress = wh.getChain("Moonbeam").config.contracts.tokenBridgeRelayer;
|
|
6274
7404
|
if (!contractAddress) {
|
|
6275
|
-
throw new Error(`Wormhole address not found for ${
|
|
7405
|
+
throw new Error(`Wormhole address not found for ${bridgeChain.name}`);
|
|
6276
7406
|
}
|
|
6277
7407
|
return new ContractConfig({
|
|
6278
7408
|
address: contractAddress,
|
|
6279
7409
|
abi: TOKEN_BRIDGE_RELAYER_ABI,
|
|
6280
7410
|
args: [
|
|
6281
|
-
|
|
6282
|
-
|
|
7411
|
+
tokenAddressOnBridgeChain,
|
|
7412
|
+
tokenAmountOnBridgeChain,
|
|
6283
7413
|
0,
|
|
6284
7414
|
whDestination,
|
|
6285
7415
|
destinationAddress32bytes,
|
|
@@ -6294,7 +7424,7 @@ function TokenBridgeRelayer() {
|
|
|
6294
7424
|
}
|
|
6295
7425
|
|
|
6296
7426
|
// src/mrl/providers/wormhole/contract/index.ts
|
|
6297
|
-
function
|
|
7427
|
+
function contract2() {
|
|
6298
7428
|
return { Batch, Gmp, TokenBridge, TokenBridgeRelayer };
|
|
6299
7429
|
}
|
|
6300
7430
|
|
|
@@ -6420,36 +7550,38 @@ var BATCH_CONTRACT_ABI = [
|
|
|
6420
7550
|
|
|
6421
7551
|
// src/mrl/providers/wormhole/extrinsic/ethereumXcm/ethereumXcm.ts
|
|
6422
7552
|
function ethereumXcm() {
|
|
7553
|
+
const provider = "wormhole" /* Wormhole */;
|
|
6423
7554
|
return {
|
|
6424
7555
|
transact: () => ({
|
|
7556
|
+
provider,
|
|
6425
7557
|
build: (params) => {
|
|
6426
|
-
const { asset, isAutomatic,
|
|
6427
|
-
if (!
|
|
6428
|
-
throw new Error("
|
|
7558
|
+
const { asset, isAutomatic, bridgeChain, bridgeChainGasLimit } = params;
|
|
7559
|
+
if (!bridgeChainGasLimit) {
|
|
7560
|
+
throw new Error("bridgeChainGasLimit must be defined");
|
|
6429
7561
|
}
|
|
6430
|
-
const
|
|
6431
|
-
if (!
|
|
7562
|
+
const tokenAddressOnBridgeChain = bridgeChain.getChainAsset(asset).address;
|
|
7563
|
+
if (!tokenAddressOnBridgeChain) {
|
|
6432
7564
|
throw new Error(
|
|
6433
|
-
`Asset ${asset.symbol} does not have a token address on chain ${
|
|
7565
|
+
`Asset ${asset.symbol} does not have a token address on chain ${bridgeChain.name}`
|
|
6434
7566
|
);
|
|
6435
7567
|
}
|
|
6436
|
-
const
|
|
6437
|
-
|
|
7568
|
+
const tokenAmountOnBridgeChain = asset.convertDecimals(
|
|
7569
|
+
bridgeChain.getChainAsset(asset).decimals
|
|
6438
7570
|
).amount;
|
|
6439
|
-
const
|
|
7571
|
+
const contract3 = isAutomatic ? contract2().TokenBridgeRelayer().transferTokensWithRelay().build(params) : contract2().TokenBridge().transferTokens().build(params);
|
|
6440
7572
|
const approveTx = encodeFunctionData3({
|
|
6441
7573
|
abi: ERC20_ABI,
|
|
6442
7574
|
functionName: "approve",
|
|
6443
|
-
args: [
|
|
7575
|
+
args: [contract3.address, tokenAmountOnBridgeChain]
|
|
6444
7576
|
});
|
|
6445
7577
|
const batchAll = encodeFunctionData3({
|
|
6446
7578
|
abi: BATCH_CONTRACT_ABI,
|
|
6447
7579
|
functionName: "batchAll",
|
|
6448
7580
|
args: [
|
|
6449
|
-
[
|
|
7581
|
+
[tokenAddressOnBridgeChain, contract3.address],
|
|
6450
7582
|
[0n, 0n],
|
|
6451
7583
|
// Value to send for each call
|
|
6452
|
-
[approveTx,
|
|
7584
|
+
[approveTx, contract3.encodeFunctionData()],
|
|
6453
7585
|
// Call data for each call
|
|
6454
7586
|
[]
|
|
6455
7587
|
// Gas limit for each call
|
|
@@ -6461,7 +7593,7 @@ function ethereumXcm() {
|
|
|
6461
7593
|
getArgs: () => [
|
|
6462
7594
|
{
|
|
6463
7595
|
V2: {
|
|
6464
|
-
gasLimit:
|
|
7596
|
+
gasLimit: bridgeChainGasLimit,
|
|
6465
7597
|
action: {
|
|
6466
7598
|
Call: BATCH_CONTRACT_ADDRESS
|
|
6467
7599
|
},
|
|
@@ -6477,15 +7609,15 @@ function ethereumXcm() {
|
|
|
6477
7609
|
}
|
|
6478
7610
|
|
|
6479
7611
|
// src/mrl/providers/wormhole/extrinsic/index.ts
|
|
6480
|
-
function
|
|
7612
|
+
function extrinsic2() {
|
|
6481
7613
|
return { ethereumXcm, polkadotXcm: polkadotXcm2 };
|
|
6482
7614
|
}
|
|
6483
7615
|
|
|
6484
7616
|
// src/mrl/providers/wormhole/index.ts
|
|
6485
7617
|
function wormhole2() {
|
|
6486
7618
|
return {
|
|
6487
|
-
contract,
|
|
6488
|
-
extrinsic,
|
|
7619
|
+
contract: contract2,
|
|
7620
|
+
extrinsic: extrinsic2,
|
|
6489
7621
|
wormhole
|
|
6490
7622
|
};
|
|
6491
7623
|
}
|
|
@@ -6493,6 +7625,7 @@ function wormhole2() {
|
|
|
6493
7625
|
// src/mrl/MrlBuilder.ts
|
|
6494
7626
|
function MrlBuilder() {
|
|
6495
7627
|
return {
|
|
7628
|
+
snowbridge,
|
|
6496
7629
|
wormhole: wormhole2
|
|
6497
7630
|
};
|
|
6498
7631
|
}
|
|
@@ -6508,9 +7641,12 @@ export {
|
|
|
6508
7641
|
ExtrinsicBuilder,
|
|
6509
7642
|
ExtrinsicConfig,
|
|
6510
7643
|
FeeBuilder,
|
|
7644
|
+
GATEWAY_ABI,
|
|
6511
7645
|
MonitoringBuilder,
|
|
6512
7646
|
MrlBuilder,
|
|
6513
7647
|
Protocols,
|
|
7648
|
+
Provider,
|
|
7649
|
+
SnowbridgeConfig,
|
|
6514
7650
|
SubstrateCallConfig,
|
|
6515
7651
|
SubstrateQueryConfig,
|
|
6516
7652
|
TransferType,
|
|
@@ -6518,6 +7654,7 @@ export {
|
|
|
6518
7654
|
XcmVersion,
|
|
6519
7655
|
calculateSystemAccountBalance,
|
|
6520
7656
|
evm,
|
|
7657
|
+
snowbridge,
|
|
6521
7658
|
substrate,
|
|
6522
7659
|
wormhole2 as wormhole,
|
|
6523
7660
|
wormholeFactory
|