@paraspell/sdk 7.0.0 → 7.1.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/README.md +16 -13
- package/dist/index.cjs +671 -292
- package/dist/index.d.ts +103 -57
- package/dist/index.mjs +671 -293
- package/dist/papi/index.cjs +670 -295
- package/dist/papi/index.d.ts +92 -46
- package/dist/papi/index.mjs +670 -296
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -506,11 +506,11 @@ function _toPrimitive(t, r) {
|
|
|
506
506
|
if ("object" != typeof t || !t) return t;
|
|
507
507
|
var e = t[Symbol.toPrimitive];
|
|
508
508
|
if (void 0 !== e) {
|
|
509
|
-
var i = e.call(t, r);
|
|
509
|
+
var i = e.call(t, r || "default");
|
|
510
510
|
if ("object" != typeof i) return i;
|
|
511
511
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
512
512
|
}
|
|
513
|
-
return (String )(t);
|
|
513
|
+
return ("string" === r ? String : Number)(t);
|
|
514
514
|
}
|
|
515
515
|
function _toPropertyKey(t) {
|
|
516
516
|
var i = _toPrimitive(t, "string");
|
|
@@ -2066,22 +2066,22 @@ var Moonbeam$3 = {
|
|
|
2066
2066
|
otherAssets: [
|
|
2067
2067
|
{
|
|
2068
2068
|
assetId: "78407957940239408223554844611219482002",
|
|
2069
|
-
symbol: "
|
|
2069
|
+
symbol: "xcibcMOVR",
|
|
2070
2070
|
decimals: 18
|
|
2071
2071
|
},
|
|
2072
2072
|
{
|
|
2073
2073
|
assetId: "150874409661081770150564009349448205842",
|
|
2074
|
-
symbol: "
|
|
2074
|
+
symbol: "xcZTG",
|
|
2075
2075
|
decimals: 10
|
|
2076
2076
|
},
|
|
2077
2077
|
{
|
|
2078
2078
|
assetId: "283870493414747423842723289889816153538",
|
|
2079
|
-
symbol: "
|
|
2079
|
+
symbol: "xcUNQ",
|
|
2080
2080
|
decimals: 18
|
|
2081
2081
|
},
|
|
2082
2082
|
{
|
|
2083
2083
|
assetId: "90225766094594282577230355136633846906",
|
|
2084
|
-
symbol: "
|
|
2084
|
+
symbol: "xcPDEX",
|
|
2085
2085
|
decimals: 12
|
|
2086
2086
|
},
|
|
2087
2087
|
{
|
|
@@ -2091,27 +2091,27 @@ var Moonbeam$3 = {
|
|
|
2091
2091
|
},
|
|
2092
2092
|
{
|
|
2093
2093
|
assetId: "314077021455772878282433861213184736939",
|
|
2094
|
-
symbol: "
|
|
2094
|
+
symbol: "xcPEAQ",
|
|
2095
2095
|
decimals: 18
|
|
2096
2096
|
},
|
|
2097
2097
|
{
|
|
2098
2098
|
assetId: "144012926827374458669278577633504620722",
|
|
2099
|
-
symbol: "
|
|
2099
|
+
symbol: "xcFIL",
|
|
2100
2100
|
decimals: 18
|
|
2101
2101
|
},
|
|
2102
2102
|
{
|
|
2103
2103
|
assetId: "125699734534028342599692732320197985871",
|
|
2104
|
-
symbol: "
|
|
2104
|
+
symbol: "xcRING",
|
|
2105
2105
|
decimals: 18
|
|
2106
2106
|
},
|
|
2107
2107
|
{
|
|
2108
2108
|
assetId: "91372035960551235635465443179559840483",
|
|
2109
|
-
symbol: "
|
|
2109
|
+
symbol: "xcCFG",
|
|
2110
2110
|
decimals: 18
|
|
2111
2111
|
},
|
|
2112
2112
|
{
|
|
2113
2113
|
assetId: "187224307232923873519830480073807488153",
|
|
2114
|
-
symbol: "
|
|
2114
|
+
symbol: "xcEQD",
|
|
2115
2115
|
decimals: 9
|
|
2116
2116
|
},
|
|
2117
2117
|
{
|
|
@@ -2121,37 +2121,37 @@ var Moonbeam$3 = {
|
|
|
2121
2121
|
},
|
|
2122
2122
|
{
|
|
2123
2123
|
assetId: "69606720909260275826784788104880799692",
|
|
2124
|
-
symbol: "
|
|
2124
|
+
symbol: "xcHDX",
|
|
2125
2125
|
decimals: 12
|
|
2126
2126
|
},
|
|
2127
2127
|
{
|
|
2128
2128
|
assetId: "133307414193833606001516599592873928539",
|
|
2129
|
-
symbol: "
|
|
2129
|
+
symbol: "xcibcTIA",
|
|
2130
2130
|
decimals: 6
|
|
2131
2131
|
},
|
|
2132
2132
|
{
|
|
2133
2133
|
assetId: "190590555344745888270686124937537713878",
|
|
2134
|
-
symbol: "
|
|
2134
|
+
symbol: "xcEQ",
|
|
2135
2135
|
decimals: 9
|
|
2136
2136
|
},
|
|
2137
2137
|
{
|
|
2138
2138
|
assetId: "61295607754960722617854661686514597014",
|
|
2139
|
-
symbol: "
|
|
2139
|
+
symbol: "xcWIFD",
|
|
2140
2140
|
decimals: 10
|
|
2141
2141
|
},
|
|
2142
2142
|
{
|
|
2143
2143
|
assetId: "141196559012917796508928734717797136690",
|
|
2144
|
-
symbol: "
|
|
2144
|
+
symbol: "xcibcIST",
|
|
2145
2145
|
decimals: 6
|
|
2146
2146
|
},
|
|
2147
2147
|
{
|
|
2148
2148
|
assetId: "29085784439601774464560083082574142143",
|
|
2149
|
-
symbol: "
|
|
2149
|
+
symbol: "xcvDOT",
|
|
2150
2150
|
decimals: 10
|
|
2151
2151
|
},
|
|
2152
2152
|
{
|
|
2153
2153
|
assetId: "225719522181998468294117309041779353812",
|
|
2154
|
-
symbol: "
|
|
2154
|
+
symbol: "xcLDOT",
|
|
2155
2155
|
decimals: 10
|
|
2156
2156
|
},
|
|
2157
2157
|
{
|
|
@@ -2161,142 +2161,142 @@ var Moonbeam$3 = {
|
|
|
2161
2161
|
},
|
|
2162
2162
|
{
|
|
2163
2163
|
assetId: "124463719055550872076363892993240202694",
|
|
2164
|
-
symbol: "
|
|
2164
|
+
symbol: "xcDED",
|
|
2165
2165
|
decimals: 10
|
|
2166
2166
|
},
|
|
2167
2167
|
{
|
|
2168
2168
|
assetId: "224077081838586484055667086558292981199",
|
|
2169
|
-
symbol: "
|
|
2169
|
+
symbol: "xcASTR",
|
|
2170
2170
|
decimals: 18
|
|
2171
2171
|
},
|
|
2172
2172
|
{
|
|
2173
2173
|
assetId: "199907282886248358976504623107230837230",
|
|
2174
|
-
symbol: "
|
|
2174
|
+
symbol: "xcibcBLD",
|
|
2175
2175
|
decimals: 6
|
|
2176
2176
|
},
|
|
2177
2177
|
{
|
|
2178
2178
|
assetId: "166377000701797186346254371275954761085",
|
|
2179
|
-
symbol: "
|
|
2179
|
+
symbol: "xcUSDC",
|
|
2180
2180
|
decimals: 6
|
|
2181
2181
|
},
|
|
2182
2182
|
{
|
|
2183
2183
|
assetId: "142155548796783636521833385094843759961",
|
|
2184
|
-
symbol: "
|
|
2184
|
+
symbol: "xcBNCS",
|
|
2185
2185
|
decimals: 12
|
|
2186
2186
|
},
|
|
2187
2187
|
{
|
|
2188
2188
|
assetId: "89994634370519791027168048838578580624",
|
|
2189
|
-
symbol: "
|
|
2189
|
+
symbol: "xcSUB",
|
|
2190
2190
|
decimals: 10
|
|
2191
2191
|
},
|
|
2192
2192
|
{
|
|
2193
2193
|
assetId: "138280378441551394289980644963240827219",
|
|
2194
|
-
symbol: "
|
|
2194
|
+
symbol: "xcibcATOM",
|
|
2195
2195
|
decimals: 6
|
|
2196
2196
|
},
|
|
2197
2197
|
{
|
|
2198
2198
|
assetId: "228510780171552721666262089780561563481",
|
|
2199
|
-
symbol: "
|
|
2199
|
+
symbol: "xcibcPICA",
|
|
2200
2200
|
decimals: 12
|
|
2201
2201
|
},
|
|
2202
2202
|
{
|
|
2203
2203
|
assetId: "204507659831918931608354793288110796652",
|
|
2204
|
-
symbol: "
|
|
2204
|
+
symbol: "xcvGLMR",
|
|
2205
2205
|
decimals: 18
|
|
2206
2206
|
},
|
|
2207
2207
|
{
|
|
2208
2208
|
assetId: "184218609779515850660274730699350567246",
|
|
2209
|
-
symbol: "
|
|
2209
|
+
symbol: "xcNCTR",
|
|
2210
2210
|
decimals: 18
|
|
2211
2211
|
},
|
|
2212
2212
|
{
|
|
2213
2213
|
assetId: "289989900872525819559124583375550296953",
|
|
2214
|
-
symbol: "
|
|
2214
|
+
symbol: "xcvMANTA",
|
|
2215
2215
|
decimals: 18
|
|
2216
2216
|
},
|
|
2217
2217
|
{
|
|
2218
2218
|
assetId: "110021739665376159354538090254163045594",
|
|
2219
|
-
symbol: "
|
|
2219
|
+
symbol: "xcaUSD",
|
|
2220
2220
|
decimals: 12
|
|
2221
2221
|
},
|
|
2222
2222
|
{
|
|
2223
2223
|
assetId: "311091173110107856861649819128533077277",
|
|
2224
|
-
symbol: "
|
|
2224
|
+
symbol: "xcUSDT",
|
|
2225
2225
|
decimals: 6
|
|
2226
2226
|
},
|
|
2227
2227
|
{
|
|
2228
2228
|
assetId: "64174511183114006009298114091987195453",
|
|
2229
|
-
symbol: "
|
|
2229
|
+
symbol: "xcPINK",
|
|
2230
2230
|
decimals: 10
|
|
2231
2231
|
},
|
|
2232
2232
|
{
|
|
2233
2233
|
assetId: "309163521958167876851250718453738106865",
|
|
2234
|
-
symbol: "
|
|
2234
|
+
symbol: "xcNODL",
|
|
2235
2235
|
decimals: 11
|
|
2236
2236
|
},
|
|
2237
2237
|
{
|
|
2238
2238
|
assetId: "120637696315203257380661607956669368914",
|
|
2239
|
-
symbol: "
|
|
2239
|
+
symbol: "xcIBTC",
|
|
2240
2240
|
decimals: 8
|
|
2241
2241
|
},
|
|
2242
2242
|
{
|
|
2243
2243
|
assetId: "166446646689194205559791995948102903873",
|
|
2244
|
-
symbol: "
|
|
2244
|
+
symbol: "xcMANTA",
|
|
2245
2245
|
decimals: 18
|
|
2246
2246
|
},
|
|
2247
2247
|
{
|
|
2248
2248
|
assetId: "101170542313601871197860408087030232491",
|
|
2249
|
-
symbol: "
|
|
2249
|
+
symbol: "xcINTR",
|
|
2250
2250
|
decimals: 10
|
|
2251
2251
|
},
|
|
2252
2252
|
{
|
|
2253
2253
|
assetId: "165823357460190568952172802245839421906",
|
|
2254
|
-
symbol: "
|
|
2254
|
+
symbol: "xcBNC",
|
|
2255
2255
|
decimals: 12
|
|
2256
2256
|
},
|
|
2257
2257
|
{
|
|
2258
2258
|
assetId: "32615670524745285411807346420584982855",
|
|
2259
|
-
symbol: "
|
|
2259
|
+
symbol: "xcPARA",
|
|
2260
2260
|
decimals: 12
|
|
2261
2261
|
},
|
|
2262
2262
|
{
|
|
2263
2263
|
assetId: "42259045809535163221576417993425387648",
|
|
2264
|
-
symbol: "
|
|
2264
|
+
symbol: "xcDOT",
|
|
2265
2265
|
decimals: 10
|
|
2266
2266
|
},
|
|
2267
2267
|
{
|
|
2268
2268
|
assetId: "45647473099451451833602657905356404688",
|
|
2269
|
-
symbol: "
|
|
2269
|
+
symbol: "xcPEN",
|
|
2270
2270
|
decimals: 12
|
|
2271
2271
|
},
|
|
2272
2272
|
{
|
|
2273
2273
|
assetId: "224821240862170613278369189818311486111",
|
|
2274
|
-
symbol: "
|
|
2274
|
+
symbol: "xcACA",
|
|
2275
2275
|
decimals: 12
|
|
2276
2276
|
},
|
|
2277
2277
|
{
|
|
2278
2278
|
assetId: "272547899416482196831721420898811311297",
|
|
2279
|
-
symbol: "
|
|
2279
|
+
symbol: "xcvFIL",
|
|
2280
2280
|
decimals: 18
|
|
2281
2281
|
},
|
|
2282
2282
|
{
|
|
2283
2283
|
assetId: "114018676402354620972806895487280206446",
|
|
2284
|
-
symbol: "
|
|
2284
|
+
symbol: "xcvASTR",
|
|
2285
2285
|
decimals: 18
|
|
2286
2286
|
},
|
|
2287
2287
|
{
|
|
2288
2288
|
assetId: "238111524681612888331172110363070489924",
|
|
2289
|
-
symbol: "
|
|
2289
|
+
symbol: "xcNEURO",
|
|
2290
2290
|
decimals: 12
|
|
2291
2291
|
},
|
|
2292
2292
|
{
|
|
2293
2293
|
assetId: "112679793397406599376365943185137098326",
|
|
2294
|
-
symbol: "
|
|
2294
|
+
symbol: "xcSTINK",
|
|
2295
2295
|
decimals: 10
|
|
2296
2296
|
},
|
|
2297
2297
|
{
|
|
2298
2298
|
assetId: "132685552157663328694213725410064821485",
|
|
2299
|
-
symbol: "
|
|
2299
|
+
symbol: "xcPHA",
|
|
2300
2300
|
decimals: 12
|
|
2301
2301
|
}
|
|
2302
2302
|
]
|
|
@@ -5471,122 +5471,122 @@ var Moonriver$3 = {
|
|
|
5471
5471
|
otherAssets: [
|
|
5472
5472
|
{
|
|
5473
5473
|
assetId: "108457044225666871745333730479173774551",
|
|
5474
|
-
symbol: "
|
|
5474
|
+
symbol: "xcCSM",
|
|
5475
5475
|
decimals: 12
|
|
5476
5476
|
},
|
|
5477
5477
|
{
|
|
5478
5478
|
assetId: "16797826370226091782818345603793389938",
|
|
5479
|
-
symbol: "
|
|
5479
|
+
symbol: "xcSDN",
|
|
5480
5480
|
decimals: 18
|
|
5481
5481
|
},
|
|
5482
5482
|
{
|
|
5483
5483
|
assetId: "76100021443485661246318545281171740067",
|
|
5484
|
-
symbol: "
|
|
5484
|
+
symbol: "xcHKO",
|
|
5485
5485
|
decimals: 12
|
|
5486
5486
|
},
|
|
5487
5487
|
{
|
|
5488
5488
|
assetId: "138512078356357941985706694377215053953",
|
|
5489
|
-
symbol: "
|
|
5489
|
+
symbol: "xcTNKR",
|
|
5490
5490
|
decimals: 12
|
|
5491
5491
|
},
|
|
5492
5492
|
{
|
|
5493
5493
|
assetId: "328179947973504579459046439826496046832",
|
|
5494
|
-
symbol: "
|
|
5494
|
+
symbol: "xcKBTC",
|
|
5495
5495
|
decimals: 8
|
|
5496
5496
|
},
|
|
5497
5497
|
{
|
|
5498
5498
|
assetId: "108036400430056508975016746969135344601",
|
|
5499
|
-
symbol: "
|
|
5499
|
+
symbol: "xcXRT",
|
|
5500
5500
|
decimals: 9
|
|
5501
5501
|
},
|
|
5502
5502
|
{
|
|
5503
5503
|
assetId: "133300872918374599700079037156071917454",
|
|
5504
|
-
symbol: "
|
|
5504
|
+
symbol: "xcTUR",
|
|
5505
5505
|
decimals: 10
|
|
5506
5506
|
},
|
|
5507
5507
|
{
|
|
5508
5508
|
assetId: "213357169630950964874127107356898319277",
|
|
5509
|
-
symbol: "
|
|
5509
|
+
symbol: "xcKMA",
|
|
5510
5510
|
decimals: 12
|
|
5511
5511
|
},
|
|
5512
5512
|
{
|
|
5513
5513
|
assetId: "65216491554813189869575508812319036608",
|
|
5514
|
-
symbol: "
|
|
5514
|
+
symbol: "xcLIT",
|
|
5515
5515
|
decimals: 12
|
|
5516
5516
|
},
|
|
5517
5517
|
{
|
|
5518
5518
|
assetId: "173481220575862801646329923366065693029",
|
|
5519
|
-
symbol: "
|
|
5519
|
+
symbol: "xcCRAB",
|
|
5520
5520
|
decimals: 18
|
|
5521
5521
|
},
|
|
5522
5522
|
{
|
|
5523
5523
|
assetId: "189307976387032586987344677431204943363",
|
|
5524
|
-
symbol: "
|
|
5524
|
+
symbol: "xcPHA",
|
|
5525
5525
|
decimals: 12
|
|
5526
5526
|
},
|
|
5527
5527
|
{
|
|
5528
5528
|
assetId: "264344629840762281112027368930249420542",
|
|
5529
|
-
symbol: "
|
|
5529
|
+
symbol: "xcvKSM",
|
|
5530
5530
|
decimals: 12
|
|
5531
5531
|
},
|
|
5532
5532
|
{
|
|
5533
5533
|
assetId: "72145018963825376852137222787619937732",
|
|
5534
|
-
symbol: "
|
|
5534
|
+
symbol: "xcvBNC",
|
|
5535
5535
|
decimals: 12
|
|
5536
5536
|
},
|
|
5537
5537
|
{
|
|
5538
5538
|
assetId: "214920334981412447805621250067209749032",
|
|
5539
|
-
symbol: "
|
|
5539
|
+
symbol: "xcaSeed",
|
|
5540
5540
|
decimals: 12
|
|
5541
5541
|
},
|
|
5542
5542
|
{
|
|
5543
5543
|
assetId: "175400718394635817552109270754364440562",
|
|
5544
|
-
symbol: "
|
|
5544
|
+
symbol: "xcKINT",
|
|
5545
5545
|
decimals: 12
|
|
5546
5546
|
},
|
|
5547
5547
|
{
|
|
5548
5548
|
assetId: "167283995827706324502761431814209211090",
|
|
5549
|
-
symbol: "
|
|
5549
|
+
symbol: "xcPICA",
|
|
5550
5550
|
decimals: 12
|
|
5551
5551
|
},
|
|
5552
5552
|
{
|
|
5553
5553
|
assetId: "105075627293246237499203909093923548958",
|
|
5554
|
-
symbol: "
|
|
5554
|
+
symbol: "xcTEER",
|
|
5555
5555
|
decimals: 12
|
|
5556
5556
|
},
|
|
5557
5557
|
{
|
|
5558
5558
|
assetId: "118095707745084482624853002839493125353",
|
|
5559
|
-
symbol: "
|
|
5559
|
+
symbol: "xcMGX",
|
|
5560
5560
|
decimals: 18
|
|
5561
5561
|
},
|
|
5562
5562
|
{
|
|
5563
5563
|
assetId: "203223821023327994093278529517083736593",
|
|
5564
|
-
symbol: "
|
|
5564
|
+
symbol: "xcvMOVR",
|
|
5565
5565
|
decimals: 18
|
|
5566
5566
|
},
|
|
5567
5567
|
{
|
|
5568
5568
|
assetId: "311091173110107856861649819128533077277",
|
|
5569
|
-
symbol: "
|
|
5569
|
+
symbol: "xcUSDT",
|
|
5570
5570
|
decimals: 6
|
|
5571
5571
|
},
|
|
5572
5572
|
{
|
|
5573
5573
|
assetId: "182365888117048807484804376330534607370",
|
|
5574
|
-
symbol: "
|
|
5574
|
+
symbol: "xcRMRK",
|
|
5575
5575
|
decimals: 10
|
|
5576
5576
|
},
|
|
5577
5577
|
{
|
|
5578
5578
|
assetId: "42259045809535163221576417993425387648",
|
|
5579
|
-
symbol: "
|
|
5579
|
+
symbol: "xcKSM",
|
|
5580
5580
|
decimals: 12
|
|
5581
5581
|
},
|
|
5582
5582
|
{
|
|
5583
5583
|
assetId: "10810581592933651521121702237638664357",
|
|
5584
|
-
symbol: "
|
|
5584
|
+
symbol: "xcKAR",
|
|
5585
5585
|
decimals: 12
|
|
5586
5586
|
},
|
|
5587
5587
|
{
|
|
5588
5588
|
assetId: "319623561105283008236062145480775032445",
|
|
5589
|
-
symbol: "
|
|
5589
|
+
symbol: "xcBNC",
|
|
5590
5590
|
decimals: 12
|
|
5591
5591
|
}
|
|
5592
5592
|
]
|
|
@@ -8617,6 +8617,14 @@ var findParachainJunction = function findParachainJunction(multilocation) {
|
|
|
8617
8617
|
};
|
|
8618
8618
|
|
|
8619
8619
|
var DEFAULT_FEE_ASSET = 0;
|
|
8620
|
+
var ETH_CHAIN_ID = BigInt(1);
|
|
8621
|
+
var ETHEREUM_JUNCTION = {
|
|
8622
|
+
GlobalConsensus: {
|
|
8623
|
+
Ethereum: {
|
|
8624
|
+
chain_id: ETH_CHAIN_ID
|
|
8625
|
+
}
|
|
8626
|
+
}
|
|
8627
|
+
};
|
|
8620
8628
|
|
|
8621
8629
|
var constructRelayToParaParameters = function constructRelayToParaParameters(_ref, version) {
|
|
8622
8630
|
var api = _ref.api,
|
|
@@ -8774,82 +8782,103 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
8774
8782
|
}, {
|
|
8775
8783
|
key: "transfer",
|
|
8776
8784
|
value: function transfer(options) {
|
|
8777
|
-
|
|
8778
|
-
|
|
8779
|
-
|
|
8780
|
-
|
|
8781
|
-
|
|
8782
|
-
|
|
8783
|
-
|
|
8784
|
-
|
|
8785
|
-
|
|
8786
|
-
|
|
8787
|
-
|
|
8788
|
-
|
|
8789
|
-
|
|
8790
|
-
|
|
8791
|
-
|
|
8792
|
-
|
|
8793
|
-
|
|
8794
|
-
|
|
8795
|
-
|
|
8796
|
-
|
|
8797
|
-
|
|
8798
|
-
|
|
8799
|
-
|
|
8800
|
-
|
|
8801
|
-
|
|
8802
|
-
|
|
8803
|
-
|
|
8804
|
-
|
|
8805
|
-
|
|
8806
|
-
|
|
8807
|
-
|
|
8808
|
-
|
|
8809
|
-
|
|
8810
|
-
|
|
8811
|
-
|
|
8812
|
-
|
|
8813
|
-
|
|
8814
|
-
|
|
8815
|
-
|
|
8816
|
-
|
|
8817
|
-
|
|
8818
|
-
|
|
8819
|
-
|
|
8820
|
-
|
|
8821
|
-
|
|
8822
|
-
|
|
8823
|
-
|
|
8824
|
-
|
|
8825
|
-
|
|
8826
|
-
|
|
8827
|
-
|
|
8828
|
-
|
|
8829
|
-
|
|
8830
|
-
|
|
8831
|
-
|
|
8832
|
-
|
|
8833
|
-
|
|
8834
|
-
|
|
8835
|
-
|
|
8836
|
-
|
|
8837
|
-
|
|
8838
|
-
|
|
8839
|
-
|
|
8840
|
-
|
|
8841
|
-
|
|
8842
|
-
|
|
8843
|
-
|
|
8844
|
-
|
|
8845
|
-
|
|
8846
|
-
|
|
8785
|
+
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
8786
|
+
var api, currencySymbol, currencyId, amount, address, destination, paraIdTo, overridedCurrencyMultiLocation, feeAsset, version, ahAddress, _options$serializedAp, serializedApiCallEnabled, scenario, paraId, versionOrDefault;
|
|
8787
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
8788
|
+
while (1) switch (_context.prev = _context.next) {
|
|
8789
|
+
case 0:
|
|
8790
|
+
api = options.api, currencySymbol = options.currencySymbol, currencyId = options.currencyId, amount = options.amount, address = options.address, destination = options.destination, paraIdTo = options.paraIdTo, overridedCurrencyMultiLocation = options.overridedCurrencyMultiLocation, feeAsset = options.feeAsset, version = options.version, ahAddress = options.ahAddress, _options$serializedAp = options.serializedApiCallEnabled, serializedApiCallEnabled = _options$serializedAp === void 0 ? false : _options$serializedAp;
|
|
8791
|
+
scenario = destination !== undefined ? 'ParaToPara' : 'ParaToRelay';
|
|
8792
|
+
paraId = destination !== undefined && _typeof(destination) !== 'object' && destination !== 'Ethereum' ? paraIdTo !== null && paraIdTo !== void 0 ? paraIdTo : getParaId(destination) : undefined;
|
|
8793
|
+
if (!(destination === 'Polimec' && this.node !== 'AssetHubPolkadot')) {
|
|
8794
|
+
_context.next = 5;
|
|
8795
|
+
break;
|
|
8796
|
+
}
|
|
8797
|
+
throw new Error('Sending assets to Polimec is supported only from AssetHubPolkadot');
|
|
8798
|
+
case 5:
|
|
8799
|
+
versionOrDefault = version !== null && version !== void 0 ? version : this.version;
|
|
8800
|
+
if (!(supportsXTokens(this) && this.canUseXTokens(options))) {
|
|
8801
|
+
_context.next = 10;
|
|
8802
|
+
break;
|
|
8803
|
+
}
|
|
8804
|
+
return _context.abrupt("return", this.transferXTokens({
|
|
8805
|
+
api: api,
|
|
8806
|
+
currency: currencySymbol,
|
|
8807
|
+
currencyID: currencyId,
|
|
8808
|
+
amount: amount,
|
|
8809
|
+
addressSelection: generateAddressPayload(api, scenario, 'XTokens', address, versionOrDefault, paraId),
|
|
8810
|
+
fees: getFees(scenario),
|
|
8811
|
+
origin: this.node,
|
|
8812
|
+
scenario: scenario,
|
|
8813
|
+
paraIdTo: paraId,
|
|
8814
|
+
destination: destination,
|
|
8815
|
+
overridedCurrencyMultiLocation: overridedCurrencyMultiLocation,
|
|
8816
|
+
feeAsset: feeAsset,
|
|
8817
|
+
serializedApiCallEnabled: serializedApiCallEnabled
|
|
8818
|
+
}));
|
|
8819
|
+
case 10:
|
|
8820
|
+
if (!supportsXTransfer(this)) {
|
|
8821
|
+
_context.next = 14;
|
|
8822
|
+
break;
|
|
8823
|
+
}
|
|
8824
|
+
return _context.abrupt("return", this.transferXTransfer({
|
|
8825
|
+
api: api,
|
|
8826
|
+
currency: currencySymbol,
|
|
8827
|
+
currencyID: currencyId,
|
|
8828
|
+
amount: amount,
|
|
8829
|
+
recipientAddress: address,
|
|
8830
|
+
paraId: paraId,
|
|
8831
|
+
origin: this.node,
|
|
8832
|
+
destination: destination,
|
|
8833
|
+
overridedCurrencyMultiLocation: overridedCurrencyMultiLocation,
|
|
8834
|
+
serializedApiCallEnabled: serializedApiCallEnabled
|
|
8835
|
+
}));
|
|
8836
|
+
case 14:
|
|
8837
|
+
if (!supportsPolkadotXCM(this)) {
|
|
8838
|
+
_context.next = 22;
|
|
8839
|
+
break;
|
|
8840
|
+
}
|
|
8841
|
+
if (!(isTMultiLocation(overridedCurrencyMultiLocation) && !verifyMultiLocation(this.node, overridedCurrencyMultiLocation))) {
|
|
8842
|
+
_context.next = 17;
|
|
8843
|
+
break;
|
|
8844
|
+
}
|
|
8845
|
+
throw new InvalidCurrencyError('Provided Multi-location is not a valid currency.');
|
|
8846
|
+
case 17:
|
|
8847
|
+
_context.next = 19;
|
|
8848
|
+
return this.transferPolkadotXCM({
|
|
8849
|
+
api: api,
|
|
8850
|
+
header: this.createPolkadotXcmHeader(scenario, versionOrDefault, destination, paraId),
|
|
8851
|
+
addressSelection: generateAddressPayload(api, scenario, 'PolkadotXcm', address, versionOrDefault, paraId),
|
|
8852
|
+
address: address,
|
|
8853
|
+
amount: amount,
|
|
8854
|
+
currencySelection: this.createCurrencySpec(amount, scenario, versionOrDefault, currencyId, overridedCurrencyMultiLocation),
|
|
8855
|
+
currencyId: currencyId,
|
|
8856
|
+
scenario: scenario,
|
|
8857
|
+
currencySymbol: currencySymbol,
|
|
8858
|
+
feeAsset: feeAsset,
|
|
8859
|
+
destination: destination,
|
|
8860
|
+
paraIdTo: paraId,
|
|
8861
|
+
overridedCurrency: overridedCurrencyMultiLocation,
|
|
8862
|
+
serializedApiCallEnabled: serializedApiCallEnabled,
|
|
8863
|
+
version: version,
|
|
8864
|
+
ahAddress: ahAddress
|
|
8865
|
+
});
|
|
8866
|
+
case 19:
|
|
8867
|
+
return _context.abrupt("return", _context.sent);
|
|
8868
|
+
case 22:
|
|
8869
|
+
throw new NoXCMSupportImplementedError(this._node);
|
|
8870
|
+
case 23:
|
|
8871
|
+
case "end":
|
|
8872
|
+
return _context.stop();
|
|
8873
|
+
}
|
|
8874
|
+
}, _callee, this);
|
|
8875
|
+
}));
|
|
8847
8876
|
}
|
|
8848
8877
|
}, {
|
|
8849
8878
|
key: "transferRelayToPara",
|
|
8850
8879
|
value: function transferRelayToPara(options) {
|
|
8851
|
-
var _options$
|
|
8852
|
-
version = _options$
|
|
8880
|
+
var _options$version = options.version,
|
|
8881
|
+
version = _options$version === void 0 ? exports.Version.V3 : _options$version;
|
|
8853
8882
|
return {
|
|
8854
8883
|
module: 'XcmPallet',
|
|
8855
8884
|
section: 'reserve_transfer_assets',
|
|
@@ -8864,21 +8893,21 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
8864
8893
|
}, {
|
|
8865
8894
|
key: "createApiInstance",
|
|
8866
8895
|
value: function createApiInstance(api) {
|
|
8867
|
-
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
8868
|
-
return _regeneratorRuntime().wrap(function
|
|
8869
|
-
while (1) switch (
|
|
8896
|
+
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
8897
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
8898
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
8870
8899
|
case 0:
|
|
8871
|
-
return
|
|
8900
|
+
return _context2.abrupt("return", api.createApiInstance(this.getProvider()));
|
|
8872
8901
|
case 1:
|
|
8873
8902
|
case "end":
|
|
8874
|
-
return
|
|
8903
|
+
return _context2.stop();
|
|
8875
8904
|
}
|
|
8876
|
-
},
|
|
8905
|
+
}, _callee2, this);
|
|
8877
8906
|
}));
|
|
8878
8907
|
}
|
|
8879
8908
|
}, {
|
|
8880
8909
|
key: "createCurrencySpec",
|
|
8881
|
-
value: function createCurrencySpec$1(amount, scenario, version,
|
|
8910
|
+
value: function createCurrencySpec$1(amount, scenario, version, _currencyId, overridedMultiLocation) {
|
|
8882
8911
|
return createCurrencySpec(amount, version, scenario === 'ParaToRelay' ? exports.Parents.ONE : exports.Parents.ZERO, overridedMultiLocation);
|
|
8883
8912
|
}
|
|
8884
8913
|
}, {
|
|
@@ -8962,6 +8991,7 @@ var XTokensTransferImpl = /*#__PURE__*/function () {
|
|
|
8962
8991
|
value: function transferXTokens(input, currencySelection) {
|
|
8963
8992
|
var fees = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'Unlimited';
|
|
8964
8993
|
var api = input.api,
|
|
8994
|
+
origin = input.origin,
|
|
8965
8995
|
amount = input.amount,
|
|
8966
8996
|
addressSelection = input.addressSelection,
|
|
8967
8997
|
destination = input.destination,
|
|
@@ -8971,10 +9001,12 @@ var XTokensTransferImpl = /*#__PURE__*/function () {
|
|
|
8971
9001
|
if (isMultiLocationDestination) {
|
|
8972
9002
|
throw new Error('Multilocation destinations are not supported for specific transfer you are trying to create. In special cases such as xTokens or xTransfer pallet try using address multilocation instead (for both destination and address in same multilocation set (eg. X2 - Parachain, Address). For further assistance please open issue in our repository.');
|
|
8973
9003
|
}
|
|
8974
|
-
var
|
|
8975
|
-
var
|
|
8976
|
-
var
|
|
8977
|
-
var
|
|
9004
|
+
var isBifrostOrigin = origin === 'BifrostPolkadot' || origin === 'BifrostKusama';
|
|
9005
|
+
var isAssetHubDest = destination === 'AssetHubPolkadot' || destination === 'AssetHubKusama';
|
|
9006
|
+
var shouldUseMultiasset = isAssetHubDest && !isBifrostOrigin;
|
|
9007
|
+
var modifiedCurrencySelection = getCurrencySelection(input, shouldUseMultiasset, currencySelection);
|
|
9008
|
+
var section = shouldUseMultiasset ? feeAsset ? 'transfer_multiassets' : 'transfer_multiasset' : 'transfer';
|
|
9009
|
+
var parameters = getXTokensParameters(shouldUseMultiasset, modifiedCurrencySelection, addressSelection, amount, fees, feeAsset);
|
|
8978
9010
|
var call = {
|
|
8979
9011
|
module: 'XTokens',
|
|
8980
9012
|
section: section,
|
|
@@ -9064,6 +9096,45 @@ var Crust$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
9064
9096
|
}]);
|
|
9065
9097
|
}(ParachainNode);
|
|
9066
9098
|
|
|
9099
|
+
var PolkadotXCMTransferImpl = /*#__PURE__*/function () {
|
|
9100
|
+
function PolkadotXCMTransferImpl() {
|
|
9101
|
+
_classCallCheck(this, PolkadotXCMTransferImpl);
|
|
9102
|
+
}
|
|
9103
|
+
return _createClass(PolkadotXCMTransferImpl, null, [{
|
|
9104
|
+
key: "transferPolkadotXCM",
|
|
9105
|
+
value: function transferPolkadotXCM(_ref, section) {
|
|
9106
|
+
var api = _ref.api,
|
|
9107
|
+
header = _ref.header,
|
|
9108
|
+
addressSelection = _ref.addressSelection,
|
|
9109
|
+
currencySelection = _ref.currencySelection,
|
|
9110
|
+
_ref$feeAsset = _ref.feeAsset,
|
|
9111
|
+
feeAsset = _ref$feeAsset === void 0 ? DEFAULT_FEE_ASSET : _ref$feeAsset,
|
|
9112
|
+
serializedApiCallEnabled = _ref.serializedApiCallEnabled;
|
|
9113
|
+
var fees = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
|
|
9114
|
+
var module = 'PolkadotXcm';
|
|
9115
|
+
var call = {
|
|
9116
|
+
module: module,
|
|
9117
|
+
section: section,
|
|
9118
|
+
parameters: Object.assign({
|
|
9119
|
+
dest: header,
|
|
9120
|
+
beneficiary: addressSelection,
|
|
9121
|
+
assets: currencySelection,
|
|
9122
|
+
fee_asset_item: feeAsset
|
|
9123
|
+
}, fees !== undefined ? {
|
|
9124
|
+
weight_limit: fees
|
|
9125
|
+
} : {})
|
|
9126
|
+
};
|
|
9127
|
+
if (serializedApiCallEnabled === true) {
|
|
9128
|
+
// Keep compatible with old serialized call type
|
|
9129
|
+
return Object.assign(Object.assign({}, call), {
|
|
9130
|
+
parameters: Object.values(call.parameters)
|
|
9131
|
+
});
|
|
9132
|
+
}
|
|
9133
|
+
return api.callTxMethod(call);
|
|
9134
|
+
}
|
|
9135
|
+
}]);
|
|
9136
|
+
}();
|
|
9137
|
+
|
|
9067
9138
|
var BifrostPolkadot$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
9068
9139
|
function BifrostPolkadot() {
|
|
9069
9140
|
_classCallCheck(this, BifrostPolkadot);
|
|
@@ -9111,6 +9182,31 @@ var BifrostPolkadot$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
9111
9182
|
var currencySelection = this.getCurrencySelection(currency, currencyID);
|
|
9112
9183
|
return XTokensTransferImpl.transferXTokens(input, currencySelection);
|
|
9113
9184
|
}
|
|
9185
|
+
// Handles DOT, WETH transfers to AssetHubPolkadot
|
|
9186
|
+
}, {
|
|
9187
|
+
key: "transferPolkadotXCM",
|
|
9188
|
+
value: function transferPolkadotXCM(input) {
|
|
9189
|
+
var _a;
|
|
9190
|
+
var amount = input.amount,
|
|
9191
|
+
overridedCurrency = input.overridedCurrency,
|
|
9192
|
+
currencySymbol = input.currencySymbol;
|
|
9193
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(Object.assign(Object.assign({}, input), {
|
|
9194
|
+
currencySelection: createCurrencySpec(amount, this.version, currencySymbol === 'DOT' ? exports.Parents.ONE : exports.Parents.TWO, overridedCurrency, currencySymbol === 'WETH' ? {
|
|
9195
|
+
X2: [ETHEREUM_JUNCTION, {
|
|
9196
|
+
AccountKey20: {
|
|
9197
|
+
key: (_a = getAssetId('Ethereum', 'WETH')) !== null && _a !== void 0 ? _a : ''
|
|
9198
|
+
}
|
|
9199
|
+
}]
|
|
9200
|
+
} : undefined)
|
|
9201
|
+
}), 'transfer_assets', 'Unlimited'));
|
|
9202
|
+
}
|
|
9203
|
+
}, {
|
|
9204
|
+
key: "canUseXTokens",
|
|
9205
|
+
value: function canUseXTokens(_ref) {
|
|
9206
|
+
var currencySymbol = _ref.currencySymbol,
|
|
9207
|
+
destination = _ref.destination;
|
|
9208
|
+
return currencySymbol !== 'WETH' && currencySymbol !== 'DOT' || destination !== 'AssetHubPolkadot';
|
|
9209
|
+
}
|
|
9114
9210
|
}]);
|
|
9115
9211
|
}(ParachainNode);
|
|
9116
9212
|
|
|
@@ -9157,18 +9253,195 @@ var ComposableFinance$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
9157
9253
|
}]);
|
|
9158
9254
|
}(ParachainNode);
|
|
9159
9255
|
|
|
9256
|
+
var calculateFee = function calculateFee(api) {
|
|
9257
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
9258
|
+
var DEFAULT_FEE, ahApi, feeStorageItem, leFeeHex, leFee, transfer_bridge_fee, transfer_assethub_execution_fee;
|
|
9259
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
9260
|
+
while (1) switch (_context.prev = _context.next) {
|
|
9261
|
+
case 0:
|
|
9262
|
+
DEFAULT_FEE = BigInt(2750872500000);
|
|
9263
|
+
_context.next = 3;
|
|
9264
|
+
return api.createApiForNode('AssetHubPolkadot');
|
|
9265
|
+
case 3:
|
|
9266
|
+
ahApi = _context.sent;
|
|
9267
|
+
_context.next = 6;
|
|
9268
|
+
return ahApi.getFromStorage('0x5fbc5c7ba58845ad1f1a9a7c5bc12fad');
|
|
9269
|
+
case 6:
|
|
9270
|
+
feeStorageItem = _context.sent;
|
|
9271
|
+
leFeeHex = feeStorageItem.replace('0x', '');
|
|
9272
|
+
leFee = BigInt('0x' + leFeeHex.split('').reverse().join(''));
|
|
9273
|
+
transfer_bridge_fee = leFee === BigInt(0) ? DEFAULT_FEE : BigInt(leFee.toString());
|
|
9274
|
+
transfer_assethub_execution_fee = BigInt(2200000000);
|
|
9275
|
+
return _context.abrupt("return", (transfer_bridge_fee + transfer_assethub_execution_fee).toString());
|
|
9276
|
+
case 12:
|
|
9277
|
+
case "end":
|
|
9278
|
+
return _context.stop();
|
|
9279
|
+
}
|
|
9280
|
+
}, _callee);
|
|
9281
|
+
}));
|
|
9282
|
+
};
|
|
9283
|
+
var createEthereumTokenLocation = function createEthereumTokenLocation(currencyId) {
|
|
9284
|
+
return {
|
|
9285
|
+
parents: exports.Parents.TWO,
|
|
9286
|
+
interior: {
|
|
9287
|
+
X2: [ETHEREUM_JUNCTION, {
|
|
9288
|
+
AccountKey20: {
|
|
9289
|
+
key: currencyId
|
|
9290
|
+
}
|
|
9291
|
+
}]
|
|
9292
|
+
}
|
|
9293
|
+
};
|
|
9294
|
+
};
|
|
9295
|
+
var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, versionOrDefault) {
|
|
9296
|
+
var api = _ref.api,
|
|
9297
|
+
address = _ref.address,
|
|
9298
|
+
currencyId = _ref.currencyId,
|
|
9299
|
+
scenario = _ref.scenario,
|
|
9300
|
+
ahAddress = _ref.ahAddress;
|
|
9301
|
+
return _defineProperty({}, versionOrDefault, [{
|
|
9302
|
+
SetAppendix: [{
|
|
9303
|
+
DepositAsset: {
|
|
9304
|
+
assets: {
|
|
9305
|
+
Wild: 'All'
|
|
9306
|
+
},
|
|
9307
|
+
beneficiary: Object.values(generateAddressPayload(api, scenario, 'PolkadotXcm', ahAddress !== null && ahAddress !== void 0 ? ahAddress : '', versionOrDefault, undefined))[0]
|
|
9308
|
+
}
|
|
9309
|
+
}]
|
|
9310
|
+
}, {
|
|
9311
|
+
InitiateReserveWithdraw: {
|
|
9312
|
+
assets: {
|
|
9313
|
+
Wild: {
|
|
9314
|
+
AllOf: {
|
|
9315
|
+
id: createEthereumTokenLocation(currencyId !== null && currencyId !== void 0 ? currencyId : ''),
|
|
9316
|
+
fun: 'Fungible'
|
|
9317
|
+
}
|
|
9318
|
+
}
|
|
9319
|
+
},
|
|
9320
|
+
reserve: {
|
|
9321
|
+
parents: exports.Parents.TWO,
|
|
9322
|
+
interior: {
|
|
9323
|
+
X1: [ETHEREUM_JUNCTION]
|
|
9324
|
+
}
|
|
9325
|
+
},
|
|
9326
|
+
xcm: [{
|
|
9327
|
+
BuyExecution: {
|
|
9328
|
+
fees: {
|
|
9329
|
+
id: {
|
|
9330
|
+
parents: exports.Parents.ZERO,
|
|
9331
|
+
interior: {
|
|
9332
|
+
X1: [{
|
|
9333
|
+
AccountKey20: {
|
|
9334
|
+
network: null,
|
|
9335
|
+
key: currencyId
|
|
9336
|
+
}
|
|
9337
|
+
}]
|
|
9338
|
+
}
|
|
9339
|
+
},
|
|
9340
|
+
fun: {
|
|
9341
|
+
Fungible: BigInt(1)
|
|
9342
|
+
}
|
|
9343
|
+
},
|
|
9344
|
+
weight_limit: 'Unlimited'
|
|
9345
|
+
}
|
|
9346
|
+
}, {
|
|
9347
|
+
DepositAsset: {
|
|
9348
|
+
assets: {
|
|
9349
|
+
Wild: {
|
|
9350
|
+
AllCounted: 1
|
|
9351
|
+
}
|
|
9352
|
+
},
|
|
9353
|
+
beneficiary: {
|
|
9354
|
+
parents: exports.Parents.ZERO,
|
|
9355
|
+
interior: {
|
|
9356
|
+
X1: [{
|
|
9357
|
+
AccountKey20: {
|
|
9358
|
+
network: null,
|
|
9359
|
+
key: address
|
|
9360
|
+
}
|
|
9361
|
+
}]
|
|
9362
|
+
}
|
|
9363
|
+
}
|
|
9364
|
+
}
|
|
9365
|
+
}]
|
|
9366
|
+
}
|
|
9367
|
+
}]);
|
|
9368
|
+
};
|
|
9160
9369
|
var Hydration$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
9161
9370
|
function Hydration() {
|
|
9162
9371
|
_classCallCheck(this, Hydration);
|
|
9163
9372
|
return _callSuper(this, Hydration, ['Hydration', 'hydradx', 'polkadot', exports.Version.V3]);
|
|
9164
9373
|
}
|
|
9374
|
+
// Handles WETH Ethereum transfers
|
|
9165
9375
|
_inherits(Hydration, _ParachainNode);
|
|
9166
9376
|
return _createClass(Hydration, [{
|
|
9377
|
+
key: "transferPolkadotXCM",
|
|
9378
|
+
value: function transferPolkadotXCM(input) {
|
|
9379
|
+
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
9380
|
+
var api, address, currencySymbol, scenario, version, destination, amount, currencyId, ahAddress, versionOrDefault, ethMultiAsset, fee, call;
|
|
9381
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
9382
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
9383
|
+
case 0:
|
|
9384
|
+
api = input.api, address = input.address, currencySymbol = input.currencySymbol, scenario = input.scenario, version = input.version, destination = input.destination, amount = input.amount, currencyId = input.currencyId, ahAddress = input.ahAddress;
|
|
9385
|
+
if (ethers.ethers.isAddress(address)) {
|
|
9386
|
+
_context2.next = 3;
|
|
9387
|
+
break;
|
|
9388
|
+
}
|
|
9389
|
+
throw new Error('Only Ethereum addresses are supported for Ethereum transfers');
|
|
9390
|
+
case 3:
|
|
9391
|
+
if (!((currencySymbol === null || currencySymbol === void 0 ? void 0 : currencySymbol.toUpperCase()) !== 'WETH')) {
|
|
9392
|
+
_context2.next = 5;
|
|
9393
|
+
break;
|
|
9394
|
+
}
|
|
9395
|
+
throw new InvalidCurrencyError("Currency ".concat(currencySymbol, " is not supported for Ethereum transfers from Hydration"));
|
|
9396
|
+
case 5:
|
|
9397
|
+
if (!(ahAddress === undefined)) {
|
|
9398
|
+
_context2.next = 7;
|
|
9399
|
+
break;
|
|
9400
|
+
}
|
|
9401
|
+
throw new Error('AssetHub address is required for Ethereum transfers');
|
|
9402
|
+
case 7:
|
|
9403
|
+
versionOrDefault = version !== null && version !== void 0 ? version : exports.Version.V4;
|
|
9404
|
+
ethMultiAsset = Object.values(createCurrencySpec(amount, versionOrDefault, exports.Parents.TWO, createEthereumTokenLocation(currencyId !== null && currencyId !== void 0 ? currencyId : '')))[0][0];
|
|
9405
|
+
_context2.next = 11;
|
|
9406
|
+
return calculateFee(api);
|
|
9407
|
+
case 11:
|
|
9408
|
+
fee = _context2.sent;
|
|
9409
|
+
call = {
|
|
9410
|
+
module: 'PolkadotXcm',
|
|
9411
|
+
section: 'transfer_assets_using_type_and_then',
|
|
9412
|
+
parameters: {
|
|
9413
|
+
dest: this.createPolkadotXcmHeader(scenario, versionOrDefault, destination, getParaId('AssetHubPolkadot')),
|
|
9414
|
+
assets: _defineProperty({}, versionOrDefault, [Object.values(this.createCurrencySpec(fee, 'ParaToRelay', versionOrDefault))[0][0], ethMultiAsset]),
|
|
9415
|
+
assets_transfer_type: 'DestinationReserve',
|
|
9416
|
+
remote_fees_id: _defineProperty({}, versionOrDefault, {
|
|
9417
|
+
parents: exports.Parents.ONE,
|
|
9418
|
+
interior: 'Here'
|
|
9419
|
+
}),
|
|
9420
|
+
fees_transfer_type: 'DestinationReserve',
|
|
9421
|
+
custom_xcm_on_dest: createCustomXcmOnDest(input, versionOrDefault),
|
|
9422
|
+
weight_limit: 'Unlimited'
|
|
9423
|
+
}
|
|
9424
|
+
};
|
|
9425
|
+
return _context2.abrupt("return", api.callTxMethod(call));
|
|
9426
|
+
case 14:
|
|
9427
|
+
case "end":
|
|
9428
|
+
return _context2.stop();
|
|
9429
|
+
}
|
|
9430
|
+
}, _callee2, this);
|
|
9431
|
+
}));
|
|
9432
|
+
}
|
|
9433
|
+
}, {
|
|
9167
9434
|
key: "transferXTokens",
|
|
9168
9435
|
value: function transferXTokens(input) {
|
|
9169
9436
|
var currencyID = input.currencyID;
|
|
9170
9437
|
return XTokensTransferImpl.transferXTokens(input, currencyID);
|
|
9171
9438
|
}
|
|
9439
|
+
}, {
|
|
9440
|
+
key: "canUseXTokens",
|
|
9441
|
+
value: function canUseXTokens(_ref3) {
|
|
9442
|
+
var destination = _ref3.destination;
|
|
9443
|
+
return destination !== 'Ethereum';
|
|
9444
|
+
}
|
|
9172
9445
|
}]);
|
|
9173
9446
|
}(ParachainNode);
|
|
9174
9447
|
|
|
@@ -9594,45 +9867,6 @@ var Karura$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
9594
9867
|
}]);
|
|
9595
9868
|
}(ParachainNode);
|
|
9596
9869
|
|
|
9597
|
-
var PolkadotXCMTransferImpl = /*#__PURE__*/function () {
|
|
9598
|
-
function PolkadotXCMTransferImpl() {
|
|
9599
|
-
_classCallCheck(this, PolkadotXCMTransferImpl);
|
|
9600
|
-
}
|
|
9601
|
-
return _createClass(PolkadotXCMTransferImpl, null, [{
|
|
9602
|
-
key: "transferPolkadotXCM",
|
|
9603
|
-
value: function transferPolkadotXCM(_ref, section) {
|
|
9604
|
-
var api = _ref.api,
|
|
9605
|
-
header = _ref.header,
|
|
9606
|
-
addressSelection = _ref.addressSelection,
|
|
9607
|
-
currencySelection = _ref.currencySelection,
|
|
9608
|
-
_ref$feeAsset = _ref.feeAsset,
|
|
9609
|
-
feeAsset = _ref$feeAsset === void 0 ? DEFAULT_FEE_ASSET : _ref$feeAsset,
|
|
9610
|
-
serializedApiCallEnabled = _ref.serializedApiCallEnabled;
|
|
9611
|
-
var fees = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
|
|
9612
|
-
var module = 'PolkadotXcm';
|
|
9613
|
-
var call = {
|
|
9614
|
-
module: module,
|
|
9615
|
-
section: section,
|
|
9616
|
-
parameters: Object.assign({
|
|
9617
|
-
dest: header,
|
|
9618
|
-
beneficiary: addressSelection,
|
|
9619
|
-
assets: currencySelection,
|
|
9620
|
-
fee_asset_item: feeAsset
|
|
9621
|
-
}, fees !== undefined ? {
|
|
9622
|
-
weight_limit: fees
|
|
9623
|
-
} : {})
|
|
9624
|
-
};
|
|
9625
|
-
if (serializedApiCallEnabled === true) {
|
|
9626
|
-
// Keep compatible with old serialized call type
|
|
9627
|
-
return Object.assign(Object.assign({}, call), {
|
|
9628
|
-
parameters: Object.values(call.parameters)
|
|
9629
|
-
});
|
|
9630
|
-
}
|
|
9631
|
-
return api.callTxMethod(call);
|
|
9632
|
-
}
|
|
9633
|
-
}]);
|
|
9634
|
-
}();
|
|
9635
|
-
|
|
9636
9870
|
var AssetHubPolkadot$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
9637
9871
|
function AssetHubPolkadot() {
|
|
9638
9872
|
_classCallCheck(this, AssetHubPolkadot);
|
|
@@ -9678,21 +9912,13 @@ var AssetHubPolkadot$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
9678
9912
|
if (!ethAsset) {
|
|
9679
9913
|
throw new InvalidCurrencyError("Currency ".concat(currencySymbol, " is not supported for Ethereum transfers"));
|
|
9680
9914
|
}
|
|
9681
|
-
var ETH_CHAIN_ID = BigInt(1);
|
|
9682
|
-
var ethJunction = {
|
|
9683
|
-
GlobalConsensus: {
|
|
9684
|
-
Ethereum: {
|
|
9685
|
-
chain_id: ETH_CHAIN_ID
|
|
9686
|
-
}
|
|
9687
|
-
}
|
|
9688
|
-
};
|
|
9689
9915
|
var modifiedInput = Object.assign(Object.assign({}, input), {
|
|
9690
|
-
header: createPolkadotXcmHeader(scenario, this.version, destination, paraIdTo,
|
|
9916
|
+
header: createPolkadotXcmHeader(scenario, this.version, destination, paraIdTo, ETHEREUM_JUNCTION, exports.Parents.TWO),
|
|
9691
9917
|
addressSelection: generateAddressPayload(api, scenario, 'PolkadotXcm', address, this.version, paraIdTo),
|
|
9692
9918
|
currencySelection: createCurrencySpec(input.amount, exports.Version.V3, exports.Parents.TWO, {
|
|
9693
9919
|
parents: exports.Parents.TWO,
|
|
9694
9920
|
interior: {
|
|
9695
|
-
X2: [
|
|
9921
|
+
X2: [ETHEREUM_JUNCTION, {
|
|
9696
9922
|
AccountKey20: {
|
|
9697
9923
|
key: ethAsset.assetId
|
|
9698
9924
|
}
|
|
@@ -9733,17 +9959,18 @@ var AssetHubPolkadot$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
9733
9959
|
}, {
|
|
9734
9960
|
key: "transferPolkadotXCM",
|
|
9735
9961
|
value: function transferPolkadotXCM(input) {
|
|
9962
|
+
var _a;
|
|
9736
9963
|
var scenario = input.scenario,
|
|
9737
9964
|
currencySymbol = input.currencySymbol,
|
|
9738
9965
|
currencyId = input.currencyId;
|
|
9739
9966
|
if (input.destination === 'AssetHubKusama') {
|
|
9740
|
-
return this.handleBridgeTransfer(input, 'Kusama');
|
|
9967
|
+
return Promise.resolve(this.handleBridgeTransfer(input, 'Kusama'));
|
|
9741
9968
|
}
|
|
9742
9969
|
if (input.destination === 'Ethereum') {
|
|
9743
|
-
return this.handleEthBridgeTransfer(input);
|
|
9970
|
+
return Promise.resolve(this.handleEthBridgeTransfer(input));
|
|
9744
9971
|
}
|
|
9745
9972
|
if (input.destination === 'Mythos') {
|
|
9746
|
-
return this.handleMythosTransfer(input);
|
|
9973
|
+
return Promise.resolve(this.handleMythosTransfer(input));
|
|
9747
9974
|
}
|
|
9748
9975
|
if (scenario === 'ParaToPara' && currencySymbol === 'DOT' && currencyId === undefined) {
|
|
9749
9976
|
throw new ScenarioNotSupportedError(this.node, scenario, 'Para to Para scenarios for DOT transfer from AssetHub are not supported, you have to transfer DOT to Relay chain and transfer to destination chain from Relay chain.');
|
|
@@ -9752,7 +9979,19 @@ var AssetHubPolkadot$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
9752
9979
|
throw new ScenarioNotSupportedError(this.node, scenario, 'Bridged KSM cannot currently be transfered from AssetHubPolkadot, if you are sending different KSM asset, please specify {id: <KSMID>}.');
|
|
9753
9980
|
}
|
|
9754
9981
|
var section = scenario === 'ParaToPara' ? 'limited_reserve_transfer_assets' : 'limited_teleport_assets';
|
|
9755
|
-
|
|
9982
|
+
var api = input.api,
|
|
9983
|
+
destination = input.destination,
|
|
9984
|
+
paraIdTo = input.paraIdTo,
|
|
9985
|
+
address = input.address,
|
|
9986
|
+
amount = input.amount,
|
|
9987
|
+
overridedCurrency = input.overridedCurrency;
|
|
9988
|
+
var versionOrDefault = (_a = input.version) !== null && _a !== void 0 ? _a : exports.Version.V2;
|
|
9989
|
+
var modifiedInput = ((currencySymbol === null || currencySymbol === void 0 ? void 0 : currencySymbol.toUpperCase()) === 'USDT' || (currencySymbol === null || currencySymbol === void 0 ? void 0 : currencySymbol.toUpperCase()) === 'USDC') && destination === 'BifrostPolkadot' ? Object.assign(Object.assign({}, input), {
|
|
9990
|
+
header: this.createPolkadotXcmHeader(scenario, versionOrDefault, destination, paraIdTo),
|
|
9991
|
+
addressSelection: generateAddressPayload(api, scenario, 'PolkadotXcm', address, versionOrDefault, paraIdTo),
|
|
9992
|
+
currencySelection: this.createCurrencySpec(amount, scenario, versionOrDefault, currencyId, overridedCurrency)
|
|
9993
|
+
}) : input;
|
|
9994
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(modifiedInput, section, 'Unlimited'));
|
|
9756
9995
|
}
|
|
9757
9996
|
}, {
|
|
9758
9997
|
key: "transferRelayToPara",
|
|
@@ -9801,7 +10040,7 @@ var AssetHubKusama$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
9801
10040
|
// TESTED https://kusama.subscan.io/xcm_message/kusama-ddc2a48f0d8e0337832d7aae26f6c3053e1f4ffd
|
|
9802
10041
|
// TESTED https://kusama.subscan.io/xcm_message/kusama-8e423130a4d8b61679af95dbea18a55124f99672
|
|
9803
10042
|
if (destination === 'AssetHubPolkadot') {
|
|
9804
|
-
return getNode('AssetHubPolkadot').handleBridgeTransfer(input, 'Polkadot');
|
|
10043
|
+
return Promise.resolve(getNode('AssetHubPolkadot').handleBridgeTransfer(input, 'Polkadot'));
|
|
9805
10044
|
}
|
|
9806
10045
|
if (scenario === 'ParaToPara' && currencySymbol === 'KSM' && currencyId === undefined) {
|
|
9807
10046
|
throw new ScenarioNotSupportedError(this.node, scenario, 'Para to Para scenarios for KSM transfer from AssetHub are not supported, you have to transfer KSM to Relay chain and transfer to destination chain from Relay chain.');
|
|
@@ -9810,7 +10049,7 @@ var AssetHubKusama$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
9810
10049
|
throw new ScenarioNotSupportedError(this.node, scenario, 'Bridged DOT cannot currently be transfered from AssetHubKusama, if you are sending different DOT asset, please specify {id: <DOTID>}.');
|
|
9811
10050
|
}
|
|
9812
10051
|
var section = scenario === 'ParaToPara' ? 'limited_reserve_transfer_assets' : 'limited_teleport_assets';
|
|
9813
|
-
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited');
|
|
10052
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited'));
|
|
9814
10053
|
}
|
|
9815
10054
|
}, {
|
|
9816
10055
|
key: "transferRelayToPara",
|
|
@@ -9846,7 +10085,7 @@ var CoretimeKusama$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
9846
10085
|
// TESTED block hash on Rococo: 0x78ace0f1bf7cac9a42e56143321b617d98327e2750f795efb0abb833025c9082
|
|
9847
10086
|
var scenario = input.scenario;
|
|
9848
10087
|
var section = scenario === 'ParaToPara' ? 'limited_reserve_transfer_assets' : 'limited_teleport_assets';
|
|
9849
|
-
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited');
|
|
10088
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited'));
|
|
9850
10089
|
}
|
|
9851
10090
|
}, {
|
|
9852
10091
|
key: "transferRelayToPara",
|
|
@@ -9878,7 +10117,7 @@ var CoretimePolkadot$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
9878
10117
|
value: function transferPolkadotXCM(input) {
|
|
9879
10118
|
var scenario = input.scenario;
|
|
9880
10119
|
var section = scenario === 'ParaToPara' ? 'limited_reserve_transfer_assets' : 'limited_teleport_assets';
|
|
9881
|
-
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited');
|
|
10120
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited'));
|
|
9882
10121
|
}
|
|
9883
10122
|
}, {
|
|
9884
10123
|
key: "transferRelayToPara",
|
|
@@ -9906,7 +10145,7 @@ var Encointer$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
9906
10145
|
// NO PARA TO PARA SCENARIOS ON SUBSCAN
|
|
9907
10146
|
// TESTED https://encointer.subscan.io/xcm_message/kusama-418501e86e947b16c4e4e9040694017e64f9b162
|
|
9908
10147
|
if (input.scenario === 'ParaToRelay') {
|
|
9909
|
-
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_teleport_assets', 'Unlimited');
|
|
10148
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_teleport_assets', 'Unlimited'));
|
|
9910
10149
|
}
|
|
9911
10150
|
throw new ScenarioNotSupportedError(this.node, input.scenario);
|
|
9912
10151
|
}
|
|
@@ -9933,7 +10172,7 @@ var RobonomicsKusama$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
9933
10172
|
return _createClass(RobonomicsKusama, [{
|
|
9934
10173
|
key: "transferPolkadotXCM",
|
|
9935
10174
|
value: function transferPolkadotXCM(input) {
|
|
9936
|
-
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_reserve_transfer_assets', 'Unlimited');
|
|
10175
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_reserve_transfer_assets', 'Unlimited'));
|
|
9937
10176
|
}
|
|
9938
10177
|
}]);
|
|
9939
10178
|
}(ParachainNode);
|
|
@@ -9947,7 +10186,7 @@ var RobonomicsPolkadot$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
9947
10186
|
return _createClass(RobonomicsPolkadot, [{
|
|
9948
10187
|
key: "transferPolkadotXCM",
|
|
9949
10188
|
value: function transferPolkadotXCM(input) {
|
|
9950
|
-
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_reserve_transfer_assets', 'Unlimited');
|
|
10189
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_reserve_transfer_assets', 'Unlimited'));
|
|
9951
10190
|
}
|
|
9952
10191
|
}]);
|
|
9953
10192
|
}(ParachainNode);
|
|
@@ -9966,7 +10205,7 @@ var PeoplePolkadot$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
9966
10205
|
throw new ScenarioNotSupportedError(this.node, scenario);
|
|
9967
10206
|
}
|
|
9968
10207
|
var section = 'limited_teleport_assets';
|
|
9969
|
-
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited');
|
|
10208
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited'));
|
|
9970
10209
|
}
|
|
9971
10210
|
}, {
|
|
9972
10211
|
key: "transferRelayToPara",
|
|
@@ -9996,7 +10235,7 @@ var PeopleKusama$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
9996
10235
|
throw new ScenarioNotSupportedError(this.node, scenario);
|
|
9997
10236
|
}
|
|
9998
10237
|
var section = 'limited_teleport_assets';
|
|
9999
|
-
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited');
|
|
10238
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited'));
|
|
10000
10239
|
}
|
|
10001
10240
|
}, {
|
|
10002
10241
|
key: "transferRelayToPara",
|
|
@@ -10023,7 +10262,7 @@ var Astar$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
10023
10262
|
value: function transferPolkadotXCM(input) {
|
|
10024
10263
|
// TESTED https://polkadot.subscan.io/xcm_message/polkadot-f2b697df74ebe4b62853fe81b8b7d0522464972d
|
|
10025
10264
|
var section = input.scenario === 'ParaToPara' ? 'reserve_transfer_assets' : 'reserve_withdraw_assets';
|
|
10026
|
-
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section);
|
|
10265
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, section));
|
|
10027
10266
|
}
|
|
10028
10267
|
}, {
|
|
10029
10268
|
key: "transferXTokens",
|
|
@@ -10095,7 +10334,7 @@ var Crab$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
10095
10334
|
value: function transferPolkadotXCM(input) {
|
|
10096
10335
|
// TESTED https://kusama.subscan.io/xcm_message/kusama-ce7396ec470ba0c6516a50075046ee65464572dc
|
|
10097
10336
|
if (input.scenario === 'ParaToPara') {
|
|
10098
|
-
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'reserve_transfer_assets');
|
|
10337
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'reserve_transfer_assets'));
|
|
10099
10338
|
}
|
|
10100
10339
|
throw new ScenarioNotSupportedError(this.node, input.scenario);
|
|
10101
10340
|
}
|
|
@@ -10210,7 +10449,7 @@ var NeuroWeb$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
10210
10449
|
return _createClass(NeuroWeb, [{
|
|
10211
10450
|
key: "transferPolkadotXCM",
|
|
10212
10451
|
value: function transferPolkadotXCM(input) {
|
|
10213
|
-
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_reserve_transfer_assets', 'Unlimited');
|
|
10452
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_reserve_transfer_assets', 'Unlimited'));
|
|
10214
10453
|
}
|
|
10215
10454
|
}]);
|
|
10216
10455
|
}(ParachainNode);
|
|
@@ -10288,7 +10527,7 @@ var Collectives$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
10288
10527
|
if (scenario === 'ParaToPara') {
|
|
10289
10528
|
throw new ScenarioNotSupportedError(this.node, scenario);
|
|
10290
10529
|
}
|
|
10291
|
-
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_teleport_assets', 'Unlimited');
|
|
10530
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_teleport_assets', 'Unlimited'));
|
|
10292
10531
|
}
|
|
10293
10532
|
}, {
|
|
10294
10533
|
key: "transferRelayToPara",
|
|
@@ -10450,7 +10689,7 @@ var Subsocial$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
10450
10689
|
if (currencySymbol !== this.getNativeAssetSymbol()) {
|
|
10451
10690
|
throw new InvalidCurrencyError("Asset ".concat(currencySymbol, " is not supported by node ").concat(this.node, "."));
|
|
10452
10691
|
}
|
|
10453
|
-
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_reserve_transfer_assets', 'Unlimited');
|
|
10692
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_reserve_transfer_assets', 'Unlimited'));
|
|
10454
10693
|
}
|
|
10455
10694
|
}]);
|
|
10456
10695
|
}(ParachainNode);
|
|
@@ -10467,7 +10706,7 @@ var KiltSpiritnet$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
10467
10706
|
if (input.scenario !== 'ParaToPara') {
|
|
10468
10707
|
throw new ScenarioNotSupportedError(this.node, input.scenario);
|
|
10469
10708
|
}
|
|
10470
|
-
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'reserve_transfer_assets');
|
|
10709
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'reserve_transfer_assets'));
|
|
10471
10710
|
}
|
|
10472
10711
|
}, {
|
|
10473
10712
|
key: "transferRelayToPara",
|
|
@@ -10521,7 +10760,7 @@ var BridgeHubPolkadot$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
10521
10760
|
throw new ScenarioNotSupportedError(this.node, scenario, 'Unable to use bridge hub for transfers to other Parachains. Please move your currency to AssetHub to transfer to other Parachains.');
|
|
10522
10761
|
}
|
|
10523
10762
|
var section = 'limited_teleport_assets';
|
|
10524
|
-
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited');
|
|
10763
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited'));
|
|
10525
10764
|
}
|
|
10526
10765
|
}, {
|
|
10527
10766
|
key: "transferRelayToPara",
|
|
@@ -10554,7 +10793,7 @@ var BridgeHubKusama$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
10554
10793
|
throw new ScenarioNotSupportedError(this.node, scenario, 'Unable to use bridge hub for transfers to other Parachains. Please move your currency to AssetHub to transfer to other Parachains.');
|
|
10555
10794
|
}
|
|
10556
10795
|
var section = 'limited_teleport_assets';
|
|
10557
|
-
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited');
|
|
10796
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited'));
|
|
10558
10797
|
}
|
|
10559
10798
|
}, {
|
|
10560
10799
|
key: "transferRelayToPara",
|
|
@@ -10598,7 +10837,7 @@ var Mythos$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
10598
10837
|
if (currencySymbol !== nativeSymbol) {
|
|
10599
10838
|
throw new InvalidCurrencyError("Node ".concat(this.node, " does not support currency ").concat(currencySymbol));
|
|
10600
10839
|
}
|
|
10601
|
-
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, destination === 'AssetHubPolkadot' ? 'limited_teleport_assets' : 'limited_reserve_transfer_assets', 'Unlimited');
|
|
10840
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, destination === 'AssetHubPolkadot' ? 'limited_teleport_assets' : 'limited_reserve_transfer_assets', 'Unlimited'));
|
|
10602
10841
|
}
|
|
10603
10842
|
}, {
|
|
10604
10843
|
key: "transferRelayToPara",
|
|
@@ -11286,21 +11525,63 @@ var getSupportedPallets = function getSupportedPallets(node) {
|
|
|
11286
11525
|
|
|
11287
11526
|
// Contains function for getting Asset ID or Symbol used in XCM call creation
|
|
11288
11527
|
var findAssetBySymbol = function findAssetBySymbol(node, destination, otherAssets, nativeAssets, combinedAssets, symbol, isRelayDestination) {
|
|
11528
|
+
var lowerSymbol = symbol.toLowerCase();
|
|
11289
11529
|
if (destination === 'Ethereum') {
|
|
11290
11530
|
return combinedAssets.find(function (_ref) {
|
|
11291
11531
|
var assetSymbol = _ref.symbol;
|
|
11292
|
-
return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) ===
|
|
11532
|
+
return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === lowerSymbol;
|
|
11293
11533
|
});
|
|
11294
11534
|
}
|
|
11295
11535
|
var otherAssetsMatches = otherAssets.filter(function (_ref2) {
|
|
11296
11536
|
var assetSymbol = _ref2.symbol;
|
|
11297
|
-
return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) ===
|
|
11537
|
+
return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === lowerSymbol;
|
|
11298
11538
|
});
|
|
11299
11539
|
var nativeAssetsMatches = nativeAssets.filter(function (_ref3) {
|
|
11300
11540
|
var assetSymbol = _ref3.symbol;
|
|
11301
|
-
return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) ===
|
|
11541
|
+
return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === lowerSymbol;
|
|
11302
11542
|
});
|
|
11303
11543
|
var isPolkadotXcm = !isRelayChain(node) && node !== 'Ethereum' && getDefaultPallet(node) === 'PolkadotXcm';
|
|
11544
|
+
if (otherAssetsMatches.length === 0 && nativeAssetsMatches.length === 0) {
|
|
11545
|
+
if (lowerSymbol.startsWith('xc')) {
|
|
11546
|
+
// No exact matches found, and symbol starts with 'xc', try stripping 'xc'
|
|
11547
|
+
var strippedSymbol = symbol.substring(2);
|
|
11548
|
+
var strippedLowerSymbol = strippedSymbol.toLowerCase();
|
|
11549
|
+
otherAssetsMatches = otherAssets.filter(function (_ref4) {
|
|
11550
|
+
var assetSymbol = _ref4.symbol;
|
|
11551
|
+
return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === strippedLowerSymbol;
|
|
11552
|
+
});
|
|
11553
|
+
nativeAssetsMatches = nativeAssets.filter(function (_ref5) {
|
|
11554
|
+
var assetSymbol = _ref5.symbol;
|
|
11555
|
+
return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === strippedLowerSymbol;
|
|
11556
|
+
});
|
|
11557
|
+
if (node === 'Astar' || node === 'Shiden' || isPolkadotXcm) {
|
|
11558
|
+
return nativeAssetsMatches[0] || otherAssetsMatches[0] || null;
|
|
11559
|
+
}
|
|
11560
|
+
var totalMatches = otherAssetsMatches.length + nativeAssetsMatches.length;
|
|
11561
|
+
if (totalMatches > 1) {
|
|
11562
|
+
throw new InvalidCurrencyError("Multiple assets found for symbol ".concat(symbol, " after stripping 'xc' prefix. Please specify by ID."));
|
|
11563
|
+
}
|
|
11564
|
+
} else {
|
|
11565
|
+
// No matches found, and symbol does not start with 'xc', try adding 'xc' prefix
|
|
11566
|
+
var prefixedSymbol = "xc".concat(symbol);
|
|
11567
|
+
var prefixedLowerSymbol = prefixedSymbol.toLowerCase();
|
|
11568
|
+
otherAssetsMatches = otherAssets.filter(function (_ref6) {
|
|
11569
|
+
var assetSymbol = _ref6.symbol;
|
|
11570
|
+
return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === prefixedLowerSymbol;
|
|
11571
|
+
});
|
|
11572
|
+
nativeAssetsMatches = nativeAssets.filter(function (_ref7) {
|
|
11573
|
+
var assetSymbol = _ref7.symbol;
|
|
11574
|
+
return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === prefixedLowerSymbol;
|
|
11575
|
+
});
|
|
11576
|
+
if (node === 'Astar' || node === 'Shiden' || isPolkadotXcm) {
|
|
11577
|
+
return nativeAssetsMatches[0] || otherAssetsMatches[0] || null;
|
|
11578
|
+
}
|
|
11579
|
+
var _totalMatches = otherAssetsMatches.length + nativeAssetsMatches.length;
|
|
11580
|
+
if (_totalMatches > 1) {
|
|
11581
|
+
throw new InvalidCurrencyError("Multiple assets found for symbol ".concat(symbol, " after adding 'xc' prefix. Please specify by ID."));
|
|
11582
|
+
}
|
|
11583
|
+
}
|
|
11584
|
+
}
|
|
11304
11585
|
if (node === 'Astar' || node === 'Shiden' || isPolkadotXcm) {
|
|
11305
11586
|
return nativeAssetsMatches[0] || otherAssetsMatches[0] || null;
|
|
11306
11587
|
}
|
|
@@ -11310,15 +11591,15 @@ var findAssetBySymbol = function findAssetBySymbol(node, destination, otherAsset
|
|
|
11310
11591
|
return otherAssetsMatches[0] || nativeAssetsMatches[0] || null;
|
|
11311
11592
|
};
|
|
11312
11593
|
var findAssetById = function findAssetById(assets, assetId) {
|
|
11313
|
-
var otherAssetsMatches = assets.filter(function (
|
|
11314
|
-
var currentAssetId =
|
|
11594
|
+
var otherAssetsMatches = assets.filter(function (_ref8) {
|
|
11595
|
+
var currentAssetId = _ref8.assetId;
|
|
11315
11596
|
return currentAssetId === assetId.toString();
|
|
11316
11597
|
});
|
|
11317
11598
|
if (otherAssetsMatches.length > 1) {
|
|
11318
11599
|
throw new DuplicateAssetIdError(assetId.toString());
|
|
11319
11600
|
}
|
|
11320
|
-
return assets.find(function (
|
|
11321
|
-
var currentAssetId =
|
|
11601
|
+
return assets.find(function (_ref9) {
|
|
11602
|
+
var currentAssetId = _ref9.assetId;
|
|
11322
11603
|
return currentAssetId === assetId.toString();
|
|
11323
11604
|
});
|
|
11324
11605
|
};
|
|
@@ -11463,9 +11744,20 @@ var getNativeAssetSymbol = function getNativeAssetSymbol(node) {
|
|
|
11463
11744
|
* @returns True if the asset is supported; otherwise, false.
|
|
11464
11745
|
*/
|
|
11465
11746
|
var hasSupportForAsset = function hasSupportForAsset(node, symbol) {
|
|
11466
|
-
|
|
11747
|
+
var lowerSymbol = symbol.toLowerCase();
|
|
11748
|
+
var symbolsToCheck = new Set();
|
|
11749
|
+
symbolsToCheck.add(lowerSymbol);
|
|
11750
|
+
if (lowerSymbol.startsWith('xc')) {
|
|
11751
|
+
symbolsToCheck.add(lowerSymbol.substring(2));
|
|
11752
|
+
} else {
|
|
11753
|
+
symbolsToCheck.add("xc".concat(lowerSymbol));
|
|
11754
|
+
}
|
|
11755
|
+
var nodeSymbols = getAllAssetsSymbols(node).map(function (s) {
|
|
11467
11756
|
return s.toLowerCase();
|
|
11468
|
-
})
|
|
11757
|
+
});
|
|
11758
|
+
return nodeSymbols.some(function (nodeSymbol) {
|
|
11759
|
+
return symbolsToCheck.has(nodeSymbol);
|
|
11760
|
+
});
|
|
11469
11761
|
};
|
|
11470
11762
|
/**
|
|
11471
11763
|
* Retrieves the number of decimals for an asset with the given symbol on a specified node.
|
|
@@ -12197,8 +12489,9 @@ var ParaToParaBuilder = /*#__PURE__*/function () {
|
|
|
12197
12489
|
*/
|
|
12198
12490
|
}, {
|
|
12199
12491
|
key: "address",
|
|
12200
|
-
value: function address(_address) {
|
|
12492
|
+
value: function address(_address, ahAddress) {
|
|
12201
12493
|
this._address = _address;
|
|
12494
|
+
this._ahAddress = ahAddress;
|
|
12202
12495
|
return this;
|
|
12203
12496
|
}
|
|
12204
12497
|
/**
|
|
@@ -12238,7 +12531,8 @@ var ParaToParaBuilder = /*#__PURE__*/function () {
|
|
|
12238
12531
|
paraIdTo: this.paraIdTo,
|
|
12239
12532
|
feeAsset: this._feeAsset,
|
|
12240
12533
|
destApiForKeepAlive: this._destApi,
|
|
12241
|
-
version: this._version
|
|
12534
|
+
version: this._version,
|
|
12535
|
+
ahAddress: this._ahAddress
|
|
12242
12536
|
};
|
|
12243
12537
|
}
|
|
12244
12538
|
/**
|
|
@@ -13103,12 +13397,16 @@ var createTx$1 = function createTx(originApi, address, amount, currency, originN
|
|
|
13103
13397
|
}, _callee);
|
|
13104
13398
|
}));
|
|
13105
13399
|
};
|
|
13106
|
-
var getOriginFeeDetails = function getOriginFeeDetails(
|
|
13107
|
-
|
|
13108
|
-
|
|
13109
|
-
|
|
13110
|
-
|
|
13111
|
-
|
|
13400
|
+
var getOriginFeeDetails$1 = function getOriginFeeDetails(_a) {
|
|
13401
|
+
return __awaiter(void 0, [_a], void 0, function (_ref) {
|
|
13402
|
+
var api = _ref.api,
|
|
13403
|
+
account = _ref.account,
|
|
13404
|
+
amount = _ref.amount,
|
|
13405
|
+
currency = _ref.currency,
|
|
13406
|
+
origin = _ref.origin,
|
|
13407
|
+
destination = _ref.destination,
|
|
13408
|
+
_ref$feeMarginPercent = _ref.feeMarginPercentage,
|
|
13409
|
+
feeMarginPercentage = _ref$feeMarginPercent === void 0 ? 10 : _ref$feeMarginPercent;
|
|
13112
13410
|
return /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
13113
13411
|
var nativeBalance, minTransferableAmount, tx, xcmFee, xcmFeeWithMargin, sufficientForXCM;
|
|
13114
13412
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
@@ -13172,7 +13470,14 @@ var getTransferInfo$1 = function getTransferInfo(_a) {
|
|
|
13172
13470
|
case 4:
|
|
13173
13471
|
originBalance = _context.sent;
|
|
13174
13472
|
_context.next = 7;
|
|
13175
|
-
return getOriginFeeDetails(
|
|
13473
|
+
return getOriginFeeDetails$1({
|
|
13474
|
+
origin: origin,
|
|
13475
|
+
destination: destination,
|
|
13476
|
+
currency: currency,
|
|
13477
|
+
amount: amount,
|
|
13478
|
+
account: accountOrigin,
|
|
13479
|
+
api: originApi
|
|
13480
|
+
});
|
|
13176
13481
|
case 7:
|
|
13177
13482
|
_yield$getOriginFeeDe = _context.sent;
|
|
13178
13483
|
destXcmFee = _yield$getOriginFeeDe.xcmFee;
|
|
@@ -13213,7 +13518,14 @@ var getTransferInfo$1 = function getTransferInfo(_a) {
|
|
|
13213
13518
|
_context.t4 = _context.sent;
|
|
13214
13519
|
_context.t5 = expectedBalanceAfterXCMDelivery;
|
|
13215
13520
|
_context.next = 25;
|
|
13216
|
-
return getOriginFeeDetails(
|
|
13521
|
+
return getOriginFeeDetails$1({
|
|
13522
|
+
origin: origin,
|
|
13523
|
+
destination: destination,
|
|
13524
|
+
currency: currency,
|
|
13525
|
+
amount: amount,
|
|
13526
|
+
account: accountOrigin,
|
|
13527
|
+
api: originApi
|
|
13528
|
+
});
|
|
13217
13529
|
case 25:
|
|
13218
13530
|
_context.t6 = _context.sent;
|
|
13219
13531
|
_context.t7 = BigInt((_d = getExistentialDeposit(origin)) !== null && _d !== void 0 ? _d : 0);
|
|
@@ -13262,6 +13574,17 @@ var getTransferInfo$1 = function getTransferInfo(_a) {
|
|
|
13262
13574
|
});
|
|
13263
13575
|
};
|
|
13264
13576
|
|
|
13577
|
+
/**
|
|
13578
|
+
* Normalizes an asset symbol by stripping the 'xc' prefix (if present) and converting it to lowercase.
|
|
13579
|
+
*
|
|
13580
|
+
* @param symbol - The symbol to normalize.
|
|
13581
|
+
* @returns The normalized symbol.
|
|
13582
|
+
*/
|
|
13583
|
+
var normalizeSymbol = function normalizeSymbol(symbol) {
|
|
13584
|
+
if (!symbol) return '';
|
|
13585
|
+
var lowerSymbol = symbol.toLowerCase();
|
|
13586
|
+
return lowerSymbol.startsWith('xc') ? lowerSymbol.substring(2) : lowerSymbol;
|
|
13587
|
+
};
|
|
13265
13588
|
/**
|
|
13266
13589
|
* Retrieves the list of assets that are supported for transfers between two specified nodes.
|
|
13267
13590
|
*
|
|
@@ -13284,20 +13607,20 @@ var getSupportedAssets = function getSupportedAssets(origin, destination) {
|
|
|
13284
13607
|
});
|
|
13285
13608
|
return [].concat(_toConsumableArray(polkadotAsset ? [polkadotAsset] : []), _toConsumableArray(kusamaAsset ? [kusamaAsset] : []));
|
|
13286
13609
|
}
|
|
13287
|
-
|
|
13610
|
+
var isBifrost = origin === 'BifrostPolkadot' || origin === 'BifrostKusama';
|
|
13611
|
+
if (!isRelayChain(origin) && getDefaultPallet(origin) === 'XTokens' && (destination === 'AssetHubPolkadot' || destination === 'AssetHubKusama') && !isBifrost) {
|
|
13288
13612
|
return getOtherAssets(destination).filter(function (asset) {
|
|
13289
13613
|
return originAssets.some(function (a) {
|
|
13290
|
-
|
|
13291
|
-
return ((_a = a.symbol) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === ((_b = asset.symbol) === null || _b === void 0 ? void 0 : _b.toLowerCase());
|
|
13614
|
+
return normalizeSymbol(a.symbol) === normalizeSymbol(asset.symbol);
|
|
13292
13615
|
}) && asset.assetId !== '';
|
|
13293
13616
|
});
|
|
13294
13617
|
}
|
|
13295
|
-
|
|
13618
|
+
var supportedAssets = originAssets.filter(function (asset) {
|
|
13296
13619
|
return destinationAssets.some(function (a) {
|
|
13297
|
-
|
|
13298
|
-
return ((_a = a.symbol) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === ((_b = asset.symbol) === null || _b === void 0 ? void 0 : _b.toLowerCase());
|
|
13620
|
+
return normalizeSymbol(a.symbol) === normalizeSymbol(asset.symbol);
|
|
13299
13621
|
});
|
|
13300
13622
|
});
|
|
13623
|
+
return supportedAssets;
|
|
13301
13624
|
};
|
|
13302
13625
|
|
|
13303
13626
|
var createTx = function createTx(originApi, destApi, address, amount, currencySymbol, originNode, destNode) {
|
|
@@ -13442,11 +13765,11 @@ var sendCommon = function sendCommon(options_1) {
|
|
|
13442
13765
|
return __awaiter(void 0, [options_1].concat(args_1), void 0, function (options) {
|
|
13443
13766
|
var serializedApiCallEnabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
13444
13767
|
return /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
13445
|
-
var _a, _b, api, origin, currency, amount, address, destination, paraIdTo, destApiForKeepAlive, feeAsset, version, isMultiLocationDestination, isBridge, isRelayDestination, originRelayChainSymbol, destinationRelayChainSymbol, originNode, assetCheckEnabled, isDestAssetHub, pallet, asset, amountStr, currencyStr;
|
|
13768
|
+
var _a, _b, api, origin, currency, amount, address, destination, paraIdTo, destApiForKeepAlive, feeAsset, version, ahAddress, isMultiLocationDestination, isBridge, isRelayDestination, originRelayChainSymbol, destinationRelayChainSymbol, originNode, assetCheckEnabled, isDestAssetHub, pallet, isBifrost, asset, amountStr, currencyStr;
|
|
13446
13769
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
13447
13770
|
while (1) switch (_context.prev = _context.next) {
|
|
13448
13771
|
case 0:
|
|
13449
|
-
api = options.api, origin = options.origin, currency = options.currency, amount = options.amount, address = options.address, destination = options.destination, paraIdTo = options.paraIdTo, destApiForKeepAlive = options.destApiForKeepAlive, feeAsset = options.feeAsset, version = options.version;
|
|
13772
|
+
api = options.api, origin = options.origin, currency = options.currency, amount = options.amount, address = options.address, destination = options.destination, paraIdTo = options.paraIdTo, destApiForKeepAlive = options.destApiForKeepAlive, feeAsset = options.feeAsset, version = options.version, ahAddress = options.ahAddress;
|
|
13450
13773
|
if (!((!('multiasset' in currency) || 'multilocation' in currency) && amount === null)) {
|
|
13451
13774
|
_context.next = 3;
|
|
13452
13775
|
break;
|
|
@@ -13496,11 +13819,11 @@ var sendCommon = function sendCommon(options_1) {
|
|
|
13496
13819
|
}
|
|
13497
13820
|
throw new InvalidCurrencyError('Fee asset index is out of bounds. Please provide a valid index.');
|
|
13498
13821
|
case 17:
|
|
13499
|
-
if (!(destination === 'Ethereum' && origin !== 'AssetHubPolkadot')) {
|
|
13822
|
+
if (!(destination === 'Ethereum' && origin !== 'AssetHubPolkadot' && origin !== 'Hydration')) {
|
|
13500
13823
|
_context.next = 19;
|
|
13501
13824
|
break;
|
|
13502
13825
|
}
|
|
13503
|
-
throw new IncompatibleNodesError('Transfers to Ethereum are only supported from AssetHubPolkadot.');
|
|
13826
|
+
throw new IncompatibleNodesError('Transfers to Ethereum are only supported from AssetHubPolkadot and Hydration.');
|
|
13504
13827
|
case 19:
|
|
13505
13828
|
isMultiLocationDestination = _typeof(destination) === 'object';
|
|
13506
13829
|
isBridge = origin === 'AssetHubPolkadot' && destination === 'AssetHubKusama' || origin === 'AssetHubKusama' && destination === 'AssetHubPolkadot';
|
|
@@ -13521,84 +13844,85 @@ var sendCommon = function sendCommon(options_1) {
|
|
|
13521
13844
|
assetCheckEnabled = 'multilocation' in currency || 'multiasset' in currency || isBridge ? false : originNode.assetCheckEnabled;
|
|
13522
13845
|
isDestAssetHub = destination === 'AssetHubPolkadot' || destination === 'AssetHubKusama';
|
|
13523
13846
|
pallet = getDefaultPallet(origin);
|
|
13524
|
-
|
|
13525
|
-
|
|
13847
|
+
isBifrost = origin === 'BifrostPolkadot' || origin === 'BifrostKusama';
|
|
13848
|
+
if (!(!isBridge && isDestAssetHub && pallet === 'XTokens' && !isBifrost)) {
|
|
13849
|
+
_context.next = 42;
|
|
13526
13850
|
break;
|
|
13527
13851
|
}
|
|
13528
13852
|
asset = getAssetBySymbolOrId(destination, currency, false, destination);
|
|
13529
13853
|
if (!('symbol' in currency && getNativeAssets(destination).some(function (nativeAsset) {
|
|
13530
13854
|
return nativeAsset.symbol.toLowerCase() === currency.symbol.toLowerCase();
|
|
13531
13855
|
}))) {
|
|
13532
|
-
_context.next =
|
|
13856
|
+
_context.next = 36;
|
|
13533
13857
|
break;
|
|
13534
13858
|
}
|
|
13535
13859
|
throw new InvalidCurrencyError("".concat(currency.symbol, " is not supported for transfers to ").concat(destination, "."));
|
|
13536
|
-
case
|
|
13860
|
+
case 36:
|
|
13537
13861
|
if (!(assetCheckEnabled && asset === null)) {
|
|
13538
|
-
_context.next =
|
|
13862
|
+
_context.next = 38;
|
|
13539
13863
|
break;
|
|
13540
13864
|
}
|
|
13541
13865
|
throw new InvalidCurrencyError("Destination node ".concat(destination, " does not support currency ").concat(JSON.stringify(currency), "."));
|
|
13542
|
-
case
|
|
13866
|
+
case 38:
|
|
13543
13867
|
if (!((asset === null || asset === void 0 ? void 0 : asset.symbol) && !hasSupportForAsset(origin, asset.symbol))) {
|
|
13544
|
-
_context.next =
|
|
13868
|
+
_context.next = 40;
|
|
13545
13869
|
break;
|
|
13546
13870
|
}
|
|
13547
13871
|
throw new InvalidCurrencyError("Origin node ".concat(origin, " does not support currency ").concat(asset.symbol, "."));
|
|
13548
|
-
case
|
|
13549
|
-
_context.next =
|
|
13872
|
+
case 40:
|
|
13873
|
+
_context.next = 47;
|
|
13550
13874
|
break;
|
|
13551
|
-
case
|
|
13875
|
+
case 42:
|
|
13552
13876
|
asset = assetCheckEnabled ? getAssetBySymbolOrId(origin, currency, isRelayDestination, isTMultiLocation(destination) ? undefined : destination) : null;
|
|
13553
13877
|
if (!(!isBridge && asset === null && assetCheckEnabled)) {
|
|
13554
|
-
_context.next =
|
|
13878
|
+
_context.next = 45;
|
|
13555
13879
|
break;
|
|
13556
13880
|
}
|
|
13557
13881
|
throw new InvalidCurrencyError("Origin node ".concat(origin, " does not support currency ").concat(JSON.stringify(currency), "."));
|
|
13558
|
-
case
|
|
13882
|
+
case 45:
|
|
13559
13883
|
if (!(!isBridge && !isRelayDestination && !isMultiLocationDestination && (asset === null || asset === void 0 ? void 0 : asset.symbol) !== undefined && assetCheckEnabled && !('id' in currency) && !hasSupportForAsset(destination, asset.symbol))) {
|
|
13560
|
-
_context.next =
|
|
13884
|
+
_context.next = 47;
|
|
13561
13885
|
break;
|
|
13562
13886
|
}
|
|
13563
13887
|
throw new InvalidCurrencyError("Destination node ".concat(destination, " does not support currency ").concat(JSON.stringify(currency), "."));
|
|
13564
|
-
case
|
|
13565
|
-
_context.next =
|
|
13888
|
+
case 47:
|
|
13889
|
+
_context.next = 49;
|
|
13566
13890
|
return api.init(origin);
|
|
13567
|
-
case
|
|
13891
|
+
case 49:
|
|
13568
13892
|
amountStr = amount === null || amount === void 0 ? void 0 : amount.toString();
|
|
13569
13893
|
if (!('multilocation' in currency || 'multiasset' in currency)) {
|
|
13570
|
-
_context.next =
|
|
13894
|
+
_context.next = 54;
|
|
13571
13895
|
break;
|
|
13572
13896
|
}
|
|
13573
13897
|
console.warn('Keep alive check is not supported when using MultiLocation as currency.');
|
|
13574
|
-
_context.next =
|
|
13898
|
+
_context.next = 68;
|
|
13575
13899
|
break;
|
|
13576
|
-
case
|
|
13900
|
+
case 54:
|
|
13577
13901
|
if (!(_typeof(address) === 'object')) {
|
|
13578
|
-
_context.next =
|
|
13902
|
+
_context.next = 58;
|
|
13579
13903
|
break;
|
|
13580
13904
|
}
|
|
13581
13905
|
console.warn('Keep alive check is not supported when using MultiLocation as address.');
|
|
13582
|
-
_context.next =
|
|
13906
|
+
_context.next = 68;
|
|
13583
13907
|
break;
|
|
13584
|
-
case
|
|
13908
|
+
case 58:
|
|
13585
13909
|
if (!(_typeof(destination) === 'object')) {
|
|
13586
|
-
_context.next =
|
|
13910
|
+
_context.next = 62;
|
|
13587
13911
|
break;
|
|
13588
13912
|
}
|
|
13589
13913
|
console.warn('Keep alive check is not supported when using MultiLocation as destination.');
|
|
13590
|
-
_context.next =
|
|
13914
|
+
_context.next = 68;
|
|
13591
13915
|
break;
|
|
13592
|
-
case
|
|
13916
|
+
case 62:
|
|
13593
13917
|
if (!(origin === 'Ethereum' || destination === 'Ethereum')) {
|
|
13594
|
-
_context.next =
|
|
13918
|
+
_context.next = 66;
|
|
13595
13919
|
break;
|
|
13596
13920
|
}
|
|
13597
13921
|
console.warn('Keep alive check is not supported when using Ethereum as origin or destination.');
|
|
13598
|
-
_context.next =
|
|
13922
|
+
_context.next = 68;
|
|
13599
13923
|
break;
|
|
13600
|
-
case
|
|
13601
|
-
_context.next =
|
|
13924
|
+
case 66:
|
|
13925
|
+
_context.next = 68;
|
|
13602
13926
|
return checkKeepAlive({
|
|
13603
13927
|
originApi: api,
|
|
13604
13928
|
address: address,
|
|
@@ -13608,7 +13932,7 @@ var sendCommon = function sendCommon(options_1) {
|
|
|
13608
13932
|
currencySymbol: (_a = asset === null || asset === void 0 ? void 0 : asset.symbol) !== null && _a !== void 0 ? _a : 'symbol' in currency ? currency.symbol : undefined,
|
|
13609
13933
|
destNode: destination
|
|
13610
13934
|
});
|
|
13611
|
-
case
|
|
13935
|
+
case 68:
|
|
13612
13936
|
currencyStr = 'symbol' in currency ? currency.symbol : 'id' in currency ? currency.id.toString() : undefined;
|
|
13613
13937
|
return _context.abrupt("return", originNode.transfer({
|
|
13614
13938
|
api: api,
|
|
@@ -13622,9 +13946,10 @@ var sendCommon = function sendCommon(options_1) {
|
|
|
13622
13946
|
feeAsset: feeAsset,
|
|
13623
13947
|
version: version,
|
|
13624
13948
|
destApiForKeepAlive: destApiForKeepAlive,
|
|
13625
|
-
serializedApiCallEnabled: serializedApiCallEnabled
|
|
13949
|
+
serializedApiCallEnabled: serializedApiCallEnabled,
|
|
13950
|
+
ahAddress: ahAddress
|
|
13626
13951
|
}));
|
|
13627
|
-
case
|
|
13952
|
+
case 70:
|
|
13628
13953
|
case "end":
|
|
13629
13954
|
return _context.stop();
|
|
13630
13955
|
}
|
|
@@ -13799,21 +14124,32 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
13799
14124
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
13800
14125
|
while (1) switch (_context.prev = _context.next) {
|
|
13801
14126
|
case 0:
|
|
14127
|
+
if (!(typeof this._api === 'string')) {
|
|
14128
|
+
_context.next = 6;
|
|
14129
|
+
break;
|
|
14130
|
+
}
|
|
14131
|
+
_context.next = 3;
|
|
14132
|
+
return this.createApiInstance(this._api);
|
|
14133
|
+
case 3:
|
|
14134
|
+
this.api = _context.sent;
|
|
14135
|
+
_context.next = 14;
|
|
14136
|
+
break;
|
|
14137
|
+
case 6:
|
|
13802
14138
|
if (!((_a = this._api) !== null && _a !== void 0)) {
|
|
13803
|
-
_context.next =
|
|
14139
|
+
_context.next = 10;
|
|
13804
14140
|
break;
|
|
13805
14141
|
}
|
|
13806
14142
|
_context.t0 = _a;
|
|
13807
|
-
_context.next =
|
|
14143
|
+
_context.next = 13;
|
|
13808
14144
|
break;
|
|
13809
|
-
case
|
|
13810
|
-
_context.next =
|
|
14145
|
+
case 10:
|
|
14146
|
+
_context.next = 12;
|
|
13811
14147
|
return createApiInstanceForNode$1(this, node);
|
|
13812
|
-
case
|
|
14148
|
+
case 12:
|
|
13813
14149
|
_context.t0 = _context.sent;
|
|
13814
|
-
case
|
|
14150
|
+
case 13:
|
|
13815
14151
|
this.api = _context.t0;
|
|
13816
|
-
case
|
|
14152
|
+
case 14:
|
|
13817
14153
|
case "end":
|
|
13818
14154
|
return _context.stop();
|
|
13819
14155
|
}
|
|
@@ -14017,11 +14353,51 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
14017
14353
|
}, _callee9, this);
|
|
14018
14354
|
}));
|
|
14019
14355
|
}
|
|
14356
|
+
}, {
|
|
14357
|
+
key: "getFromStorage",
|
|
14358
|
+
value: function getFromStorage(key) {
|
|
14359
|
+
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
14360
|
+
var response;
|
|
14361
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
14362
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
14363
|
+
case 0:
|
|
14364
|
+
_context10.next = 2;
|
|
14365
|
+
return this.api.rpc.state.getStorage(key);
|
|
14366
|
+
case 2:
|
|
14367
|
+
response = _context10.sent;
|
|
14368
|
+
return _context10.abrupt("return", response.toHex());
|
|
14369
|
+
case 4:
|
|
14370
|
+
case "end":
|
|
14371
|
+
return _context10.stop();
|
|
14372
|
+
}
|
|
14373
|
+
}, _callee10, this);
|
|
14374
|
+
}));
|
|
14375
|
+
}
|
|
14020
14376
|
}, {
|
|
14021
14377
|
key: "clone",
|
|
14022
14378
|
value: function clone() {
|
|
14023
14379
|
return new PolkadotJsApi();
|
|
14024
14380
|
}
|
|
14381
|
+
}, {
|
|
14382
|
+
key: "createApiForNode",
|
|
14383
|
+
value: function createApiForNode(node) {
|
|
14384
|
+
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
14385
|
+
var api;
|
|
14386
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
14387
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
14388
|
+
case 0:
|
|
14389
|
+
api = new PolkadotJsApi();
|
|
14390
|
+
_context11.next = 3;
|
|
14391
|
+
return api.init(node);
|
|
14392
|
+
case 3:
|
|
14393
|
+
return _context11.abrupt("return", api);
|
|
14394
|
+
case 4:
|
|
14395
|
+
case "end":
|
|
14396
|
+
return _context11.stop();
|
|
14397
|
+
}
|
|
14398
|
+
}, _callee11);
|
|
14399
|
+
}));
|
|
14400
|
+
}
|
|
14025
14401
|
}]);
|
|
14026
14402
|
}();
|
|
14027
14403
|
|
|
@@ -14195,6 +14571,7 @@ var getAssetBalance = createPolkadotJsApiCall(getAssetBalance$1);
|
|
|
14195
14571
|
* @returns An extrinsic representing the claim transaction.
|
|
14196
14572
|
*/
|
|
14197
14573
|
var claimAssets = createPolkadotJsApiCall(claimAssets$1);
|
|
14574
|
+
var getOriginFeeDetails = createPolkadotJsApiCall(getOriginFeeDetails$1);
|
|
14198
14575
|
|
|
14199
14576
|
var assets = /*#__PURE__*/Object.freeze({
|
|
14200
14577
|
__proto__: null,
|
|
@@ -14210,6 +14587,7 @@ var assets = /*#__PURE__*/Object.freeze({
|
|
|
14210
14587
|
getExistentialDeposit: getExistentialDeposit$1,
|
|
14211
14588
|
getNativeAssetSymbol: getNativeAssetSymbol,
|
|
14212
14589
|
getNativeAssets: getNativeAssets,
|
|
14590
|
+
getOriginFeeDetails: getOriginFeeDetails,
|
|
14213
14591
|
getOtherAssets: getOtherAssets,
|
|
14214
14592
|
getParaId: getParaId,
|
|
14215
14593
|
getRelayChainSymbol: getRelayChainSymbol,
|
|
@@ -14269,6 +14647,7 @@ exports.getNativeAssets = getNativeAssets;
|
|
|
14269
14647
|
exports.getNode = getNode;
|
|
14270
14648
|
exports.getNodeEndpointOption = getNodeEndpointOption;
|
|
14271
14649
|
exports.getNodeProvider = getNodeProvider;
|
|
14650
|
+
exports.getOriginFeeDetails = getOriginFeeDetails;
|
|
14272
14651
|
exports.getOtherAssets = getOtherAssets;
|
|
14273
14652
|
exports.getParaId = getParaId;
|
|
14274
14653
|
exports.getRelayChainSymbol = getRelayChainSymbol;
|