@paraspell/sdk 11.2.3 → 11.3.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 +7 -1
- package/dist/index.cjs +242 -193
- package/dist/index.mjs +242 -193
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1016,6 +1016,37 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1016
1016
|
dkLen: 32
|
|
1017
1017
|
})));
|
|
1018
1018
|
}
|
|
1019
|
+
}, {
|
|
1020
|
+
key: "hasMethod",
|
|
1021
|
+
value: function () {
|
|
1022
|
+
var _hasMethod = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(pallet, method) {
|
|
1023
|
+
var _t3;
|
|
1024
|
+
return _regenerator().w(function (_context7) {
|
|
1025
|
+
while (1) switch (_context7.p = _context7.n) {
|
|
1026
|
+
case 0:
|
|
1027
|
+
_context7.p = 0;
|
|
1028
|
+
_context7.n = 1;
|
|
1029
|
+
return this.api.getUnsafeApi().tx[pallet][method]().getEncodedData();
|
|
1030
|
+
case 1:
|
|
1031
|
+
return _context7.a(2, true);
|
|
1032
|
+
case 2:
|
|
1033
|
+
_context7.p = 2;
|
|
1034
|
+
_t3 = _context7.v;
|
|
1035
|
+
if (!(_t3 instanceof Error && _t3.message.includes("Runtime entry Tx(".concat(pallet, ".").concat(method, ") not found")))) {
|
|
1036
|
+
_context7.n = 3;
|
|
1037
|
+
break;
|
|
1038
|
+
}
|
|
1039
|
+
return _context7.a(2, false);
|
|
1040
|
+
case 3:
|
|
1041
|
+
return _context7.a(2, true);
|
|
1042
|
+
}
|
|
1043
|
+
}, _callee7, this, [[0, 2]]);
|
|
1044
|
+
}));
|
|
1045
|
+
function hasMethod(_x9, _x0) {
|
|
1046
|
+
return _hasMethod.apply(this, arguments);
|
|
1047
|
+
}
|
|
1048
|
+
return hasMethod;
|
|
1049
|
+
}()
|
|
1019
1050
|
}, {
|
|
1020
1051
|
key: "getMethod",
|
|
1021
1052
|
value: function getMethod(tx) {
|
|
@@ -1024,15 +1055,15 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1024
1055
|
}, {
|
|
1025
1056
|
key: "calculateTransactionFee",
|
|
1026
1057
|
value: function () {
|
|
1027
|
-
var _calculateTransactionFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1028
|
-
return _regenerator().w(function (
|
|
1029
|
-
while (1) switch (
|
|
1058
|
+
var _calculateTransactionFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(tx, address) {
|
|
1059
|
+
return _regenerator().w(function (_context8) {
|
|
1060
|
+
while (1) switch (_context8.n) {
|
|
1030
1061
|
case 0:
|
|
1031
|
-
return
|
|
1062
|
+
return _context8.a(2, tx.getEstimatedFees(address));
|
|
1032
1063
|
}
|
|
1033
|
-
},
|
|
1064
|
+
}, _callee8);
|
|
1034
1065
|
}));
|
|
1035
|
-
function calculateTransactionFee(
|
|
1066
|
+
function calculateTransactionFee(_x1, _x10) {
|
|
1036
1067
|
return _calculateTransactionFee.apply(this, arguments);
|
|
1037
1068
|
}
|
|
1038
1069
|
return calculateTransactionFee;
|
|
@@ -1040,27 +1071,27 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1040
1071
|
}, {
|
|
1041
1072
|
key: "quoteAhPrice",
|
|
1042
1073
|
value: function () {
|
|
1043
|
-
var _quoteAhPrice = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1074
|
+
var _quoteAhPrice = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(fromMl, toMl, amountIn) {
|
|
1044
1075
|
var includeFee,
|
|
1045
1076
|
transformedFromMl,
|
|
1046
1077
|
transformedToMl,
|
|
1047
1078
|
response,
|
|
1048
|
-
|
|
1049
|
-
return _regenerator().w(function (
|
|
1050
|
-
while (1) switch (
|
|
1079
|
+
_args9 = arguments;
|
|
1080
|
+
return _regenerator().w(function (_context9) {
|
|
1081
|
+
while (1) switch (_context9.n) {
|
|
1051
1082
|
case 0:
|
|
1052
|
-
includeFee =
|
|
1083
|
+
includeFee = _args9.length > 3 && _args9[3] !== undefined ? _args9[3] : true;
|
|
1053
1084
|
transformedFromMl = _transform(fromMl);
|
|
1054
1085
|
transformedToMl = _transform(toMl);
|
|
1055
|
-
|
|
1086
|
+
_context9.n = 1;
|
|
1056
1087
|
return this.api.getUnsafeApi().apis.AssetConversionApi.quote_price_exact_tokens_for_tokens(transformedFromMl, transformedToMl, amountIn, includeFee);
|
|
1057
1088
|
case 1:
|
|
1058
|
-
response =
|
|
1059
|
-
return
|
|
1089
|
+
response = _context9.v;
|
|
1090
|
+
return _context9.a(2, response ? BigInt(response) : undefined);
|
|
1060
1091
|
}
|
|
1061
|
-
},
|
|
1092
|
+
}, _callee9, this);
|
|
1062
1093
|
}));
|
|
1063
|
-
function quoteAhPrice(
|
|
1094
|
+
function quoteAhPrice(_x11, _x12, _x13) {
|
|
1064
1095
|
return _quoteAhPrice.apply(this, arguments);
|
|
1065
1096
|
}
|
|
1066
1097
|
return quoteAhPrice;
|
|
@@ -1073,20 +1104,20 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1073
1104
|
}, {
|
|
1074
1105
|
key: "getBalanceNative",
|
|
1075
1106
|
value: function () {
|
|
1076
|
-
var _getBalanceNative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1107
|
+
var _getBalanceNative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(address) {
|
|
1077
1108
|
var res;
|
|
1078
|
-
return _regenerator().w(function (
|
|
1079
|
-
while (1) switch (
|
|
1109
|
+
return _regenerator().w(function (_context0) {
|
|
1110
|
+
while (1) switch (_context0.n) {
|
|
1080
1111
|
case 0:
|
|
1081
|
-
|
|
1112
|
+
_context0.n = 1;
|
|
1082
1113
|
return this.api.getUnsafeApi().query.System.Account.getValue(address);
|
|
1083
1114
|
case 1:
|
|
1084
|
-
res =
|
|
1085
|
-
return
|
|
1115
|
+
res = _context0.v;
|
|
1116
|
+
return _context0.a(2, res.data.free);
|
|
1086
1117
|
}
|
|
1087
|
-
},
|
|
1118
|
+
}, _callee0, this);
|
|
1088
1119
|
}));
|
|
1089
|
-
function getBalanceNative(
|
|
1120
|
+
function getBalanceNative(_x14) {
|
|
1090
1121
|
return _getBalanceNative.apply(this, arguments);
|
|
1091
1122
|
}
|
|
1092
1123
|
return getBalanceNative;
|
|
@@ -1094,20 +1125,20 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1094
1125
|
}, {
|
|
1095
1126
|
key: "getBalanceForeignPolkadotXcm",
|
|
1096
1127
|
value: function () {
|
|
1097
|
-
var _getBalanceForeignPolkadotXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1128
|
+
var _getBalanceForeignPolkadotXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(address, id) {
|
|
1098
1129
|
var res;
|
|
1099
|
-
return _regenerator().w(function (
|
|
1100
|
-
while (1) switch (
|
|
1130
|
+
return _regenerator().w(function (_context1) {
|
|
1131
|
+
while (1) switch (_context1.n) {
|
|
1101
1132
|
case 0:
|
|
1102
|
-
|
|
1133
|
+
_context1.n = 1;
|
|
1103
1134
|
return this.api.getUnsafeApi().query.Assets.Account.getValue(id, address);
|
|
1104
1135
|
case 1:
|
|
1105
|
-
res =
|
|
1106
|
-
return
|
|
1136
|
+
res = _context1.v;
|
|
1137
|
+
return _context1.a(2, res && res.balance ? BigInt(res.balance) : 0n);
|
|
1107
1138
|
}
|
|
1108
|
-
},
|
|
1139
|
+
}, _callee1, this);
|
|
1109
1140
|
}));
|
|
1110
|
-
function getBalanceForeignPolkadotXcm(
|
|
1141
|
+
function getBalanceForeignPolkadotXcm(_x15, _x16) {
|
|
1111
1142
|
return _getBalanceForeignPolkadotXcm.apply(this, arguments);
|
|
1112
1143
|
}
|
|
1113
1144
|
return getBalanceForeignPolkadotXcm;
|
|
@@ -1115,20 +1146,20 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1115
1146
|
}, {
|
|
1116
1147
|
key: "getMythosForeignBalance",
|
|
1117
1148
|
value: function () {
|
|
1118
|
-
var _getMythosForeignBalance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1149
|
+
var _getMythosForeignBalance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(address) {
|
|
1119
1150
|
var res;
|
|
1120
|
-
return _regenerator().w(function (
|
|
1121
|
-
while (1) switch (
|
|
1151
|
+
return _regenerator().w(function (_context10) {
|
|
1152
|
+
while (1) switch (_context10.n) {
|
|
1122
1153
|
case 0:
|
|
1123
|
-
|
|
1154
|
+
_context10.n = 1;
|
|
1124
1155
|
return this.api.getUnsafeApi().query.Balances.Account.getValue(address);
|
|
1125
1156
|
case 1:
|
|
1126
|
-
res =
|
|
1127
|
-
return
|
|
1157
|
+
res = _context10.v;
|
|
1158
|
+
return _context10.a(2, res && res.free ? BigInt(res.free) : 0n);
|
|
1128
1159
|
}
|
|
1129
|
-
},
|
|
1160
|
+
}, _callee10, this);
|
|
1130
1161
|
}));
|
|
1131
|
-
function getMythosForeignBalance(
|
|
1162
|
+
function getMythosForeignBalance(_x17) {
|
|
1132
1163
|
return _getMythosForeignBalance.apply(this, arguments);
|
|
1133
1164
|
}
|
|
1134
1165
|
return getMythosForeignBalance;
|
|
@@ -1136,21 +1167,21 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1136
1167
|
}, {
|
|
1137
1168
|
key: "getBalanceForeignAssetsPallet",
|
|
1138
1169
|
value: function () {
|
|
1139
|
-
var _getBalanceForeignAssetsPallet = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1170
|
+
var _getBalanceForeignAssetsPallet = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(address, location) {
|
|
1140
1171
|
var transformedLocation, res;
|
|
1141
|
-
return _regenerator().w(function (
|
|
1142
|
-
while (1) switch (
|
|
1172
|
+
return _regenerator().w(function (_context11) {
|
|
1173
|
+
while (1) switch (_context11.n) {
|
|
1143
1174
|
case 0:
|
|
1144
1175
|
transformedLocation = _transform(location);
|
|
1145
|
-
|
|
1176
|
+
_context11.n = 1;
|
|
1146
1177
|
return this.api.getUnsafeApi().query.ForeignAssets.Account.getValue(transformedLocation, address);
|
|
1147
1178
|
case 1:
|
|
1148
|
-
res =
|
|
1149
|
-
return
|
|
1179
|
+
res = _context11.v;
|
|
1180
|
+
return _context11.a(2, BigInt(res === undefined ? 0 : res.balance));
|
|
1150
1181
|
}
|
|
1151
|
-
},
|
|
1182
|
+
}, _callee11, this);
|
|
1152
1183
|
}));
|
|
1153
|
-
function getBalanceForeignAssetsPallet(
|
|
1184
|
+
function getBalanceForeignAssetsPallet(_x18, _x19) {
|
|
1154
1185
|
return _getBalanceForeignAssetsPallet.apply(this, arguments);
|
|
1155
1186
|
}
|
|
1156
1187
|
return getBalanceForeignAssetsPallet;
|
|
@@ -1158,20 +1189,20 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1158
1189
|
}, {
|
|
1159
1190
|
key: "getForeignAssetsByIdBalance",
|
|
1160
1191
|
value: function () {
|
|
1161
|
-
var _getForeignAssetsByIdBalance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1192
|
+
var _getForeignAssetsByIdBalance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(address, assetId) {
|
|
1162
1193
|
var res;
|
|
1163
|
-
return _regenerator().w(function (
|
|
1164
|
-
while (1) switch (
|
|
1194
|
+
return _regenerator().w(function (_context12) {
|
|
1195
|
+
while (1) switch (_context12.n) {
|
|
1165
1196
|
case 0:
|
|
1166
|
-
|
|
1197
|
+
_context12.n = 1;
|
|
1167
1198
|
return this.api.getUnsafeApi().query.ForeignAssets.Account.getValue(assetId, address);
|
|
1168
1199
|
case 1:
|
|
1169
|
-
res =
|
|
1170
|
-
return
|
|
1200
|
+
res = _context12.v;
|
|
1201
|
+
return _context12.a(2, BigInt(res === undefined ? 0 : res.balance));
|
|
1171
1202
|
}
|
|
1172
|
-
},
|
|
1203
|
+
}, _callee12, this);
|
|
1173
1204
|
}));
|
|
1174
|
-
function getForeignAssetsByIdBalance(
|
|
1205
|
+
function getForeignAssetsByIdBalance(_x20, _x21) {
|
|
1175
1206
|
return _getForeignAssetsByIdBalance.apply(this, arguments);
|
|
1176
1207
|
}
|
|
1177
1208
|
return getForeignAssetsByIdBalance;
|
|
@@ -1179,23 +1210,23 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1179
1210
|
}, {
|
|
1180
1211
|
key: "getBalanceForeignBifrost",
|
|
1181
1212
|
value: function () {
|
|
1182
|
-
var _getBalanceForeignBifrost = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1213
|
+
var _getBalanceForeignBifrost = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13(address, asset) {
|
|
1183
1214
|
var currencySelection, transformedParameters, response, accountData;
|
|
1184
|
-
return _regenerator().w(function (
|
|
1185
|
-
while (1) switch (
|
|
1215
|
+
return _regenerator().w(function (_context13) {
|
|
1216
|
+
while (1) switch (_context13.n) {
|
|
1186
1217
|
case 0:
|
|
1187
1218
|
currencySelection = getChain('BifrostPolkadot').getCurrencySelection(asset);
|
|
1188
1219
|
transformedParameters = _transform(currencySelection);
|
|
1189
|
-
|
|
1220
|
+
_context13.n = 1;
|
|
1190
1221
|
return this.api.getUnsafeApi().query.Tokens.Accounts.getValue(address, transformedParameters);
|
|
1191
1222
|
case 1:
|
|
1192
|
-
response =
|
|
1223
|
+
response = _context13.v;
|
|
1193
1224
|
accountData = response ? response : null;
|
|
1194
|
-
return
|
|
1225
|
+
return _context13.a(2, accountData ? BigInt(accountData.free.toString()) : 0n);
|
|
1195
1226
|
}
|
|
1196
|
-
},
|
|
1227
|
+
}, _callee13, this);
|
|
1197
1228
|
}));
|
|
1198
|
-
function getBalanceForeignBifrost(
|
|
1229
|
+
function getBalanceForeignBifrost(_x22, _x23) {
|
|
1199
1230
|
return _getBalanceForeignBifrost.apply(this, arguments);
|
|
1200
1231
|
}
|
|
1201
1232
|
return getBalanceForeignBifrost;
|
|
@@ -1203,24 +1234,24 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1203
1234
|
}, {
|
|
1204
1235
|
key: "getBalanceNativeAcala",
|
|
1205
1236
|
value: function () {
|
|
1206
|
-
var _getBalanceNativeAcala = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1237
|
+
var _getBalanceNativeAcala = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(address, symbol) {
|
|
1207
1238
|
var transformedParameters, response, accountData;
|
|
1208
|
-
return _regenerator().w(function (
|
|
1209
|
-
while (1) switch (
|
|
1239
|
+
return _regenerator().w(function (_context14) {
|
|
1240
|
+
while (1) switch (_context14.n) {
|
|
1210
1241
|
case 0:
|
|
1211
1242
|
transformedParameters = _transform({
|
|
1212
1243
|
Token: symbol
|
|
1213
1244
|
});
|
|
1214
|
-
|
|
1245
|
+
_context14.n = 1;
|
|
1215
1246
|
return this.api.getUnsafeApi().query.Tokens.Accounts.getValue(address, transformedParameters);
|
|
1216
1247
|
case 1:
|
|
1217
|
-
response =
|
|
1248
|
+
response = _context14.v;
|
|
1218
1249
|
accountData = response ? response : null;
|
|
1219
|
-
return
|
|
1250
|
+
return _context14.a(2, accountData ? BigInt(accountData.free.toString()) : 0n);
|
|
1220
1251
|
}
|
|
1221
|
-
},
|
|
1252
|
+
}, _callee14, this);
|
|
1222
1253
|
}));
|
|
1223
|
-
function getBalanceNativeAcala(
|
|
1254
|
+
function getBalanceNativeAcala(_x24, _x25) {
|
|
1224
1255
|
return _getBalanceNativeAcala.apply(this, arguments);
|
|
1225
1256
|
}
|
|
1226
1257
|
return getBalanceNativeAcala;
|
|
@@ -1228,30 +1259,30 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1228
1259
|
}, {
|
|
1229
1260
|
key: "getBalanceForeignXTokens",
|
|
1230
1261
|
value: function () {
|
|
1231
|
-
var _getBalanceForeignXTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1262
|
+
var _getBalanceForeignXTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(chain, address, asset) {
|
|
1232
1263
|
var pallet, _response, response, entry;
|
|
1233
|
-
return _regenerator().w(function (
|
|
1234
|
-
while (1) switch (
|
|
1264
|
+
return _regenerator().w(function (_context15) {
|
|
1265
|
+
while (1) switch (_context15.n) {
|
|
1235
1266
|
case 0:
|
|
1236
1267
|
pallet = 'Tokens';
|
|
1237
1268
|
if (chain === 'Centrifuge' || chain === 'Altair') {
|
|
1238
1269
|
pallet = 'OrmlTokens';
|
|
1239
1270
|
}
|
|
1240
1271
|
if (!(chain === 'Hydration')) {
|
|
1241
|
-
|
|
1272
|
+
_context15.n = 2;
|
|
1242
1273
|
break;
|
|
1243
1274
|
}
|
|
1244
1275
|
assertHasId(asset);
|
|
1245
|
-
|
|
1276
|
+
_context15.n = 1;
|
|
1246
1277
|
return this.api.getUnsafeApi().apis.CurrenciesApi.account(asset.assetId, address);
|
|
1247
1278
|
case 1:
|
|
1248
|
-
_response =
|
|
1249
|
-
return
|
|
1279
|
+
_response = _context15.v;
|
|
1280
|
+
return _context15.a(2, _response ? BigInt(_response.free.toString()) : 0n);
|
|
1250
1281
|
case 2:
|
|
1251
|
-
|
|
1282
|
+
_context15.n = 3;
|
|
1252
1283
|
return this.api.getUnsafeApi().query[pallet].Accounts.getEntries(address);
|
|
1253
1284
|
case 3:
|
|
1254
|
-
response =
|
|
1285
|
+
response = _context15.v;
|
|
1255
1286
|
entry = response.find(function (_ref5) {
|
|
1256
1287
|
var _asset$symbol, _asset$assetId, _asset$symbol2, _asset$assetId2;
|
|
1257
1288
|
var keyArgs = _ref5.keyArgs;
|
|
@@ -1260,11 +1291,11 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1260
1291
|
var assetItem = _keyArgs[1];
|
|
1261
1292
|
return assetItem.toString().toLowerCase() === ((_asset$symbol = asset.symbol) === null || _asset$symbol === void 0 ? void 0 : _asset$symbol.toLowerCase()) || isForeignAsset(asset) && assetItem.toString().toLowerCase() === ((_asset$assetId = asset.assetId) === null || _asset$assetId === void 0 ? void 0 : _asset$assetId.toLowerCase()) || _typeof(assetItem) === 'object' && 'value' in assetItem && assetItem.value.toString().toLowerCase() === ((_asset$symbol2 = asset.symbol) === null || _asset$symbol2 === void 0 ? void 0 : _asset$symbol2.toLowerCase()) || _typeof(assetItem) === 'object' && 'value' in assetItem && isForeignAsset(asset) && assetItem.value.toString().toLowerCase() === ((_asset$assetId2 = asset.assetId) === null || _asset$assetId2 === void 0 ? void 0 : _asset$assetId2.toLowerCase());
|
|
1262
1293
|
});
|
|
1263
|
-
return
|
|
1294
|
+
return _context15.a(2, entry !== null && entry !== void 0 && entry.value ? BigInt(entry.value.free.toString()) : 0n);
|
|
1264
1295
|
}
|
|
1265
|
-
},
|
|
1296
|
+
}, _callee15, this);
|
|
1266
1297
|
}));
|
|
1267
|
-
function getBalanceForeignXTokens(
|
|
1298
|
+
function getBalanceForeignXTokens(_x26, _x27, _x28) {
|
|
1268
1299
|
return _getBalanceForeignXTokens.apply(this, arguments);
|
|
1269
1300
|
}
|
|
1270
1301
|
return getBalanceForeignXTokens;
|
|
@@ -1272,20 +1303,20 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1272
1303
|
}, {
|
|
1273
1304
|
key: "getBalanceAssetsPallet",
|
|
1274
1305
|
value: function () {
|
|
1275
|
-
var _getBalanceAssetsPallet = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1306
|
+
var _getBalanceAssetsPallet = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16(address, assetId) {
|
|
1276
1307
|
var response;
|
|
1277
|
-
return _regenerator().w(function (
|
|
1278
|
-
while (1) switch (
|
|
1308
|
+
return _regenerator().w(function (_context16) {
|
|
1309
|
+
while (1) switch (_context16.n) {
|
|
1279
1310
|
case 0:
|
|
1280
|
-
|
|
1311
|
+
_context16.n = 1;
|
|
1281
1312
|
return this.api.getUnsafeApi().query.Assets.Account.getValue(assetId, address);
|
|
1282
1313
|
case 1:
|
|
1283
|
-
response =
|
|
1284
|
-
return
|
|
1314
|
+
response = _context16.v;
|
|
1315
|
+
return _context16.a(2, BigInt(response === undefined ? 0 : response.balance));
|
|
1285
1316
|
}
|
|
1286
|
-
},
|
|
1317
|
+
}, _callee16, this);
|
|
1287
1318
|
}));
|
|
1288
|
-
function getBalanceAssetsPallet(
|
|
1319
|
+
function getBalanceAssetsPallet(_x29, _x30) {
|
|
1289
1320
|
return _getBalanceAssetsPallet.apply(this, arguments);
|
|
1290
1321
|
}
|
|
1291
1322
|
return getBalanceAssetsPallet;
|
|
@@ -1293,21 +1324,21 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1293
1324
|
}, {
|
|
1294
1325
|
key: "getFromRpc",
|
|
1295
1326
|
value: function () {
|
|
1296
|
-
var _getFromRpc = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1327
|
+
var _getFromRpc = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(module, method, key) {
|
|
1297
1328
|
var toSS58, value;
|
|
1298
|
-
return _regenerator().w(function (
|
|
1299
|
-
while (1) switch (
|
|
1329
|
+
return _regenerator().w(function (_context17) {
|
|
1330
|
+
while (1) switch (_context17.n) {
|
|
1300
1331
|
case 0:
|
|
1301
1332
|
toSS58 = AccountId().dec;
|
|
1302
|
-
|
|
1333
|
+
_context17.n = 1;
|
|
1303
1334
|
return this.api._request("".concat(module, "_").concat(method), [module === 'system' && isHex(key) && !isAddress(key) ? toSS58(key) : key]);
|
|
1304
1335
|
case 1:
|
|
1305
|
-
value =
|
|
1306
|
-
return
|
|
1336
|
+
value = _context17.v;
|
|
1337
|
+
return _context17.a(2, isHex(value) ? value : '0x' + value.toString(16).padStart(8, '0'));
|
|
1307
1338
|
}
|
|
1308
|
-
},
|
|
1339
|
+
}, _callee17, this);
|
|
1309
1340
|
}));
|
|
1310
|
-
function getFromRpc(
|
|
1341
|
+
function getFromRpc(_x31, _x32, _x33) {
|
|
1311
1342
|
return _getFromRpc.apply(this, arguments);
|
|
1312
1343
|
}
|
|
1313
1344
|
return getFromRpc;
|
|
@@ -1320,20 +1351,20 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1320
1351
|
}, {
|
|
1321
1352
|
key: "createApiForChain",
|
|
1322
1353
|
value: function () {
|
|
1323
|
-
var _createApiForChain = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1354
|
+
var _createApiForChain = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18(chain) {
|
|
1324
1355
|
var api;
|
|
1325
|
-
return _regenerator().w(function (
|
|
1326
|
-
while (1) switch (
|
|
1356
|
+
return _regenerator().w(function (_context18) {
|
|
1357
|
+
while (1) switch (_context18.n) {
|
|
1327
1358
|
case 0:
|
|
1328
1359
|
api = new PapiApi();
|
|
1329
|
-
|
|
1360
|
+
_context18.n = 1;
|
|
1330
1361
|
return api.init(chain);
|
|
1331
1362
|
case 1:
|
|
1332
|
-
return
|
|
1363
|
+
return _context18.a(2, api);
|
|
1333
1364
|
}
|
|
1334
|
-
},
|
|
1365
|
+
}, _callee18);
|
|
1335
1366
|
}));
|
|
1336
|
-
function createApiForChain(
|
|
1367
|
+
function createApiForChain(_x34) {
|
|
1337
1368
|
return _createApiForChain.apply(this, arguments);
|
|
1338
1369
|
}
|
|
1339
1370
|
return createApiForChain;
|
|
@@ -1341,16 +1372,17 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1341
1372
|
}, {
|
|
1342
1373
|
key: "getDryRunCall",
|
|
1343
1374
|
value: function () {
|
|
1344
|
-
var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1345
|
-
var _this = this
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1375
|
+
var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20(_ref6) {
|
|
1376
|
+
var _this = this,
|
|
1377
|
+
_feeAsset$symbol;
|
|
1378
|
+
var tx, address, chain, asset, feeAsset, _ref6$useRootOrigin, useRootOrigin, supportsDryRunApi, DEFAULT_XCM_VERSION, basePayload, resolvedTx, performDryRunCall, getExecutionSuccessFromResult, extractFailureReasonFromResult, result, isSuccess, failureOutputReason, initialFailureReason, usedSymbol, usedAsset, actualWeight, weight, forwardedXcms, destParaId, executionFee, nativeAsset, hasLocation, xcmFee, fee, _t4;
|
|
1379
|
+
return _regenerator().w(function (_context20) {
|
|
1380
|
+
while (1) switch (_context20.n) {
|
|
1349
1381
|
case 0:
|
|
1350
1382
|
tx = _ref6.tx, address = _ref6.address, chain = _ref6.chain, asset = _ref6.asset, feeAsset = _ref6.feeAsset, _ref6$useRootOrigin = _ref6.useRootOrigin, useRootOrigin = _ref6$useRootOrigin === void 0 ? false : _ref6$useRootOrigin;
|
|
1351
1383
|
supportsDryRunApi = getAssetsObject(chain).supportsDryRunApi;
|
|
1352
1384
|
if (supportsDryRunApi) {
|
|
1353
|
-
|
|
1385
|
+
_context20.n = 1;
|
|
1354
1386
|
break;
|
|
1355
1387
|
}
|
|
1356
1388
|
throw new ChainNotSupportedError("DryRunApi is not available on chain ".concat(chain));
|
|
@@ -1366,35 +1398,35 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1366
1398
|
}
|
|
1367
1399
|
};
|
|
1368
1400
|
if (!useRootOrigin) {
|
|
1369
|
-
|
|
1401
|
+
_context20.n = 3;
|
|
1370
1402
|
break;
|
|
1371
1403
|
}
|
|
1372
|
-
|
|
1404
|
+
_context20.n = 2;
|
|
1373
1405
|
return wrapTxBypass(this, chain, asset, feeAsset, address, tx);
|
|
1374
1406
|
case 2:
|
|
1375
|
-
|
|
1376
|
-
|
|
1407
|
+
_t4 = _context20.v;
|
|
1408
|
+
_context20.n = 4;
|
|
1377
1409
|
break;
|
|
1378
1410
|
case 3:
|
|
1379
|
-
|
|
1411
|
+
_t4 = tx;
|
|
1380
1412
|
case 4:
|
|
1381
|
-
resolvedTx =
|
|
1413
|
+
resolvedTx = _t4;
|
|
1382
1414
|
performDryRunCall = /*#__PURE__*/function () {
|
|
1383
|
-
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1415
|
+
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(includeVersion) {
|
|
1384
1416
|
var _this$api$getUnsafeAp;
|
|
1385
1417
|
var callArgs;
|
|
1386
|
-
return _regenerator().w(function (
|
|
1387
|
-
while (1) switch (
|
|
1418
|
+
return _regenerator().w(function (_context19) {
|
|
1419
|
+
while (1) switch (_context19.n) {
|
|
1388
1420
|
case 0:
|
|
1389
1421
|
callArgs = [basePayload, resolvedTx.decodedCall];
|
|
1390
1422
|
if (includeVersion) {
|
|
1391
1423
|
callArgs.push(DEFAULT_XCM_VERSION);
|
|
1392
1424
|
}
|
|
1393
|
-
return
|
|
1425
|
+
return _context19.a(2, (_this$api$getUnsafeAp = _this.api.getUnsafeApi().apis.DryRunApi).dry_run_call.apply(_this$api$getUnsafeAp, callArgs));
|
|
1394
1426
|
}
|
|
1395
|
-
},
|
|
1427
|
+
}, _callee19);
|
|
1396
1428
|
}));
|
|
1397
|
-
return function performDryRunCall(
|
|
1429
|
+
return function performDryRunCall(_x36) {
|
|
1398
1430
|
return _ref7.apply(this, arguments);
|
|
1399
1431
|
};
|
|
1400
1432
|
}();
|
|
@@ -1422,25 +1454,25 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1422
1454
|
return JSON.stringify((_ref8 = (_result$value4 = result === null || result === void 0 ? void 0 : result.value) !== null && _result$value4 !== void 0 ? _result$value4 : result) !== null && _ref8 !== void 0 ? _ref8 : 'Unknown error structure', replaceBigInt);
|
|
1423
1455
|
};
|
|
1424
1456
|
failureOutputReason = '';
|
|
1425
|
-
|
|
1457
|
+
_context20.n = 5;
|
|
1426
1458
|
return performDryRunCall(false);
|
|
1427
1459
|
case 5:
|
|
1428
|
-
result =
|
|
1460
|
+
result = _context20.v;
|
|
1429
1461
|
isSuccess = getExecutionSuccessFromResult(result);
|
|
1430
1462
|
if (isSuccess) {
|
|
1431
|
-
|
|
1463
|
+
_context20.n = 7;
|
|
1432
1464
|
break;
|
|
1433
1465
|
}
|
|
1434
1466
|
initialFailureReason = extractFailureReasonFromResult(result);
|
|
1435
1467
|
failureOutputReason = initialFailureReason;
|
|
1436
1468
|
if (!(initialFailureReason === 'VersionedConversionFailed')) {
|
|
1437
|
-
|
|
1469
|
+
_context20.n = 7;
|
|
1438
1470
|
break;
|
|
1439
1471
|
}
|
|
1440
|
-
|
|
1472
|
+
_context20.n = 6;
|
|
1441
1473
|
return performDryRunCall(true);
|
|
1442
1474
|
case 6:
|
|
1443
|
-
result =
|
|
1475
|
+
result = _context20.v;
|
|
1444
1476
|
isSuccess = getExecutionSuccessFromResult(result);
|
|
1445
1477
|
if (!isSuccess) {
|
|
1446
1478
|
failureOutputReason = extractFailureReasonFromResult(result);
|
|
@@ -1448,13 +1480,17 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1448
1480
|
failureOutputReason = '';
|
|
1449
1481
|
}
|
|
1450
1482
|
case 7:
|
|
1483
|
+
usedSymbol = (_feeAsset$symbol = feeAsset === null || feeAsset === void 0 ? void 0 : feeAsset.symbol) !== null && _feeAsset$symbol !== void 0 ? _feeAsset$symbol : asset.symbol;
|
|
1484
|
+
usedAsset = feeAsset !== null && feeAsset !== void 0 ? feeAsset : asset;
|
|
1451
1485
|
if (isSuccess) {
|
|
1452
|
-
|
|
1486
|
+
_context20.n = 8;
|
|
1453
1487
|
break;
|
|
1454
1488
|
}
|
|
1455
|
-
return
|
|
1489
|
+
return _context20.a(2, Promise.resolve({
|
|
1456
1490
|
success: false,
|
|
1457
|
-
failureReason: failureOutputReason
|
|
1491
|
+
failureReason: failureOutputReason,
|
|
1492
|
+
currency: usedSymbol,
|
|
1493
|
+
asset: usedAsset
|
|
1458
1494
|
}));
|
|
1459
1495
|
case 8:
|
|
1460
1496
|
actualWeight = result.value.execution_result.value.actual_weight;
|
|
@@ -1464,46 +1500,50 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1464
1500
|
} : undefined;
|
|
1465
1501
|
forwardedXcms = result.value.forwarded_xcms.length > 0 ? result.value.forwarded_xcms[0] : [];
|
|
1466
1502
|
destParaId = forwardedXcms.length === 0 ? undefined : forwardedXcms[0].value.interior.type === 'Here' ? 0 : forwardedXcms[0].value.interior.value.value;
|
|
1467
|
-
|
|
1503
|
+
_context20.n = 9;
|
|
1468
1504
|
return this.calculateTransactionFee(resolvedTx, address);
|
|
1469
1505
|
case 9:
|
|
1470
|
-
executionFee =
|
|
1506
|
+
executionFee = _context20.v;
|
|
1471
1507
|
nativeAsset = findAssetInfo(chain, {
|
|
1472
1508
|
symbol: Native(getNativeAssetSymbol(chain))
|
|
1473
1509
|
}, null);
|
|
1474
1510
|
hasLocation = feeAsset ? Boolean(feeAsset.location) : Boolean(nativeAsset === null || nativeAsset === void 0 ? void 0 : nativeAsset.location);
|
|
1475
1511
|
if (!(hasXcmPaymentApiSupport(chain) && result.value.local_xcm && hasLocation && nativeAsset && chain !== 'AssetHubPolkadot' && chain !== 'Kusama')) {
|
|
1476
|
-
|
|
1512
|
+
_context20.n = 11;
|
|
1477
1513
|
break;
|
|
1478
1514
|
}
|
|
1479
|
-
|
|
1515
|
+
_context20.n = 10;
|
|
1480
1516
|
return this.getXcmPaymentApiFee(chain, result.value.local_xcm, feeAsset !== null && feeAsset !== void 0 ? feeAsset : nativeAsset);
|
|
1481
1517
|
case 10:
|
|
1482
|
-
xcmFee =
|
|
1518
|
+
xcmFee = _context20.v;
|
|
1483
1519
|
if (!(typeof xcmFee === 'bigint')) {
|
|
1484
|
-
|
|
1520
|
+
_context20.n = 11;
|
|
1485
1521
|
break;
|
|
1486
1522
|
}
|
|
1487
|
-
return
|
|
1523
|
+
return _context20.a(2, Promise.resolve({
|
|
1488
1524
|
success: true,
|
|
1489
1525
|
fee: xcmFee,
|
|
1526
|
+
currency: usedSymbol,
|
|
1527
|
+
asset: usedAsset,
|
|
1490
1528
|
weight: weight,
|
|
1491
1529
|
forwardedXcms: forwardedXcms,
|
|
1492
1530
|
destParaId: destParaId
|
|
1493
1531
|
}));
|
|
1494
1532
|
case 11:
|
|
1495
1533
|
fee = computeFeeFromDryRun(result, chain, executionFee, !!feeAsset);
|
|
1496
|
-
return
|
|
1534
|
+
return _context20.a(2, Promise.resolve({
|
|
1497
1535
|
success: true,
|
|
1498
1536
|
fee: fee,
|
|
1537
|
+
currency: usedSymbol,
|
|
1538
|
+
asset: usedAsset,
|
|
1499
1539
|
weight: weight,
|
|
1500
1540
|
forwardedXcms: forwardedXcms,
|
|
1501
1541
|
destParaId: destParaId
|
|
1502
1542
|
}));
|
|
1503
1543
|
}
|
|
1504
|
-
},
|
|
1544
|
+
}, _callee20, this);
|
|
1505
1545
|
}));
|
|
1506
|
-
function getDryRunCall(
|
|
1546
|
+
function getDryRunCall(_x35) {
|
|
1507
1547
|
return _getDryRunCall.apply(this, arguments);
|
|
1508
1548
|
}
|
|
1509
1549
|
return getDryRunCall;
|
|
@@ -1511,24 +1551,24 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1511
1551
|
}, {
|
|
1512
1552
|
key: "getXcmWeight",
|
|
1513
1553
|
value: function () {
|
|
1514
|
-
var _getXcmWeight = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1554
|
+
var _getXcmWeight = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21(xcm) {
|
|
1515
1555
|
var weightResult, _weightResult$value, ref_time, proof_size;
|
|
1516
|
-
return _regenerator().w(function (
|
|
1517
|
-
while (1) switch (
|
|
1556
|
+
return _regenerator().w(function (_context21) {
|
|
1557
|
+
while (1) switch (_context21.n) {
|
|
1518
1558
|
case 0:
|
|
1519
|
-
|
|
1559
|
+
_context21.n = 1;
|
|
1520
1560
|
return this.api.getUnsafeApi().apis.XcmPaymentApi.query_xcm_weight(!xcm.type ? _transform(xcm) : xcm);
|
|
1521
1561
|
case 1:
|
|
1522
|
-
weightResult =
|
|
1562
|
+
weightResult = _context21.v;
|
|
1523
1563
|
_weightResult$value = weightResult.value, ref_time = _weightResult$value.ref_time, proof_size = _weightResult$value.proof_size;
|
|
1524
|
-
return
|
|
1564
|
+
return _context21.a(2, {
|
|
1525
1565
|
refTime: ref_time,
|
|
1526
1566
|
proofSize: proof_size
|
|
1527
1567
|
});
|
|
1528
1568
|
}
|
|
1529
|
-
},
|
|
1569
|
+
}, _callee21, this);
|
|
1530
1570
|
}));
|
|
1531
|
-
function getXcmWeight(
|
|
1571
|
+
function getXcmWeight(_x37) {
|
|
1532
1572
|
return _getXcmWeight.apply(this, arguments);
|
|
1533
1573
|
}
|
|
1534
1574
|
return getXcmWeight;
|
|
@@ -1536,36 +1576,36 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1536
1576
|
}, {
|
|
1537
1577
|
key: "getXcmPaymentApiFee",
|
|
1538
1578
|
value: function () {
|
|
1539
|
-
var _getXcmPaymentApiFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1579
|
+
var _getXcmPaymentApiFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee22(chain, xcm, asset) {
|
|
1540
1580
|
var transformXcm,
|
|
1541
1581
|
weight,
|
|
1542
1582
|
localizedLocation,
|
|
1543
1583
|
transformedLocation,
|
|
1544
1584
|
feeResult,
|
|
1545
|
-
|
|
1546
|
-
return _regenerator().w(function (
|
|
1547
|
-
while (1) switch (
|
|
1585
|
+
_args22 = arguments;
|
|
1586
|
+
return _regenerator().w(function (_context22) {
|
|
1587
|
+
while (1) switch (_context22.n) {
|
|
1548
1588
|
case 0:
|
|
1549
|
-
transformXcm =
|
|
1550
|
-
|
|
1589
|
+
transformXcm = _args22.length > 3 && _args22[3] !== undefined ? _args22[3] : false;
|
|
1590
|
+
_context22.n = 1;
|
|
1551
1591
|
return this.api.getUnsafeApi().apis.XcmPaymentApi.query_xcm_weight(transformXcm ? _transform(xcm) : xcm);
|
|
1552
1592
|
case 1:
|
|
1553
|
-
weight =
|
|
1593
|
+
weight = _context22.v;
|
|
1554
1594
|
assertHasLocation(asset);
|
|
1555
|
-
localizedLocation = chain
|
|
1595
|
+
localizedLocation = chain.startsWith('AssetHub') || isRelayChain(chain) ? localizeLocation(chain, asset.location) : asset.location;
|
|
1556
1596
|
transformedLocation = _transform(localizedLocation);
|
|
1557
|
-
|
|
1597
|
+
_context22.n = 2;
|
|
1558
1598
|
return this.api.getUnsafeApi().apis.XcmPaymentApi.query_weight_to_asset_fee(weight.value, {
|
|
1559
1599
|
type: Version.V4,
|
|
1560
1600
|
value: transformedLocation
|
|
1561
1601
|
});
|
|
1562
1602
|
case 2:
|
|
1563
|
-
feeResult =
|
|
1564
|
-
return
|
|
1603
|
+
feeResult = _context22.v;
|
|
1604
|
+
return _context22.a(2, feeResult.value);
|
|
1565
1605
|
}
|
|
1566
|
-
},
|
|
1606
|
+
}, _callee22, this);
|
|
1567
1607
|
}));
|
|
1568
|
-
function getXcmPaymentApiFee(
|
|
1608
|
+
function getXcmPaymentApiFee(_x38, _x39, _x40) {
|
|
1569
1609
|
return _getXcmPaymentApiFee.apply(this, arguments);
|
|
1570
1610
|
}
|
|
1571
1611
|
return getXcmPaymentApiFee;
|
|
@@ -1573,34 +1613,37 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1573
1613
|
}, {
|
|
1574
1614
|
key: "getDryRunXcm",
|
|
1575
1615
|
value: function () {
|
|
1576
|
-
var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1616
|
+
var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee23(_ref9) {
|
|
1577
1617
|
var _ref0, _processAssetsDeposit, _ref1, _ref10, _ref11, _ref12, _ref13;
|
|
1578
|
-
var originLocation, xcm, chain, origin, asset, feeAsset, originFee, amount, supportsDryRunApi, transformedOriginLocation, result, isSuccess, failureReason, actualWeight, weight, forwardedXcms, destParaId, _fee, emitted, reversedEvents, palletsWithIssued, isFeeAsset, feeAssetFeeEvent, processedAssetsAmount, feeEvent, fee, processedFee;
|
|
1579
|
-
return _regenerator().w(function (
|
|
1580
|
-
while (1) switch (
|
|
1618
|
+
var originLocation, xcm, chain, origin, asset, feeAsset, originFee, amount, supportsDryRunApi, transformedOriginLocation, result, symbol, isSuccess, failureReason, actualWeight, weight, forwardedXcms, destParaId, _fee, emitted, reversedEvents, palletsWithIssued, isFeeAsset, feeAssetFeeEvent, processedAssetsAmount, feeEvent, fee, processedFee;
|
|
1619
|
+
return _regenerator().w(function (_context23) {
|
|
1620
|
+
while (1) switch (_context23.n) {
|
|
1581
1621
|
case 0:
|
|
1582
1622
|
originLocation = _ref9.originLocation, xcm = _ref9.xcm, chain = _ref9.chain, origin = _ref9.origin, asset = _ref9.asset, feeAsset = _ref9.feeAsset, originFee = _ref9.originFee, amount = _ref9.amount;
|
|
1583
1623
|
supportsDryRunApi = getAssetsObject(chain).supportsDryRunApi;
|
|
1584
1624
|
if (supportsDryRunApi) {
|
|
1585
|
-
|
|
1625
|
+
_context23.n = 1;
|
|
1586
1626
|
break;
|
|
1587
1627
|
}
|
|
1588
1628
|
throw new ChainNotSupportedError("DryRunApi is not available on chain ".concat(chain));
|
|
1589
1629
|
case 1:
|
|
1590
1630
|
transformedOriginLocation = _transform(originLocation);
|
|
1591
|
-
|
|
1631
|
+
_context23.n = 2;
|
|
1592
1632
|
return this.api.getUnsafeApi().apis.DryRunApi.dry_run_xcm(transformedOriginLocation, xcm);
|
|
1593
1633
|
case 2:
|
|
1594
|
-
result =
|
|
1634
|
+
result = _context23.v;
|
|
1635
|
+
symbol = asset.symbol;
|
|
1595
1636
|
isSuccess = result.success && result.value.execution_result.type === 'Complete';
|
|
1596
1637
|
if (isSuccess) {
|
|
1597
|
-
|
|
1638
|
+
_context23.n = 3;
|
|
1598
1639
|
break;
|
|
1599
1640
|
}
|
|
1600
1641
|
failureReason = result.value.execution_result.value.error.type;
|
|
1601
|
-
return
|
|
1642
|
+
return _context23.a(2, Promise.resolve({
|
|
1602
1643
|
success: false,
|
|
1603
|
-
failureReason: failureReason
|
|
1644
|
+
failureReason: failureReason,
|
|
1645
|
+
currency: symbol,
|
|
1646
|
+
asset: asset
|
|
1604
1647
|
}));
|
|
1605
1648
|
case 3:
|
|
1606
1649
|
actualWeight = result.value.execution_result.value.used;
|
|
@@ -1611,20 +1654,22 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1611
1654
|
forwardedXcms = result.value.forwarded_xcms.length > 0 ? result.value.forwarded_xcms[0] : [];
|
|
1612
1655
|
destParaId = forwardedXcms.length === 0 ? undefined : forwardedXcms[0].value.interior.type === 'Here' ? 0 : forwardedXcms[0].value.interior.value.value;
|
|
1613
1656
|
if (!(hasXcmPaymentApiSupport(chain) && asset && chain !== 'AssetHubPolkadot' && chain !== 'Polkadot')) {
|
|
1614
|
-
|
|
1657
|
+
_context23.n = 5;
|
|
1615
1658
|
break;
|
|
1616
1659
|
}
|
|
1617
|
-
|
|
1660
|
+
_context23.n = 4;
|
|
1618
1661
|
return this.getXcmPaymentApiFee(chain, xcm, asset);
|
|
1619
1662
|
case 4:
|
|
1620
|
-
_fee =
|
|
1663
|
+
_fee = _context23.v;
|
|
1621
1664
|
if (!(typeof _fee === 'bigint')) {
|
|
1622
|
-
|
|
1665
|
+
_context23.n = 5;
|
|
1623
1666
|
break;
|
|
1624
1667
|
}
|
|
1625
|
-
return
|
|
1668
|
+
return _context23.a(2, {
|
|
1626
1669
|
success: true,
|
|
1627
1670
|
fee: _fee,
|
|
1671
|
+
currency: symbol,
|
|
1672
|
+
asset: asset,
|
|
1628
1673
|
weight: weight,
|
|
1629
1674
|
forwardedXcms: forwardedXcms,
|
|
1630
1675
|
destParaId: destParaId
|
|
@@ -1670,12 +1715,14 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1670
1715
|
return ['Currencies', 'Tokens'].includes(event.type) && event.value.type === 'Deposited';
|
|
1671
1716
|
});
|
|
1672
1717
|
if (feeEvent) {
|
|
1673
|
-
|
|
1718
|
+
_context23.n = 6;
|
|
1674
1719
|
break;
|
|
1675
1720
|
}
|
|
1676
|
-
return
|
|
1721
|
+
return _context23.a(2, Promise.resolve({
|
|
1677
1722
|
success: false,
|
|
1678
|
-
failureReason: 'Cannot determine destination fee. No fee event found'
|
|
1723
|
+
failureReason: 'Cannot determine destination fee. No fee event found',
|
|
1724
|
+
currency: symbol,
|
|
1725
|
+
asset: asset
|
|
1679
1726
|
}));
|
|
1680
1727
|
case 6:
|
|
1681
1728
|
fee = feeEvent.type === 'AssetConversion' ? feeEvent.value.value.amount_in : feeEvent.value.value.amount;
|
|
@@ -1683,17 +1730,19 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1683
1730
|
fee = amount - originFee - feeEvent.value.value.amount;
|
|
1684
1731
|
}
|
|
1685
1732
|
processedFee = (isRelayChain(chain) || chain.includes('AssetHub')) && (asset === null || asset === void 0 ? void 0 : asset.symbol) === 'DOT' ? padFeeBy(fee, 30) : fee;
|
|
1686
|
-
return
|
|
1733
|
+
return _context23.a(2, Promise.resolve({
|
|
1687
1734
|
success: true,
|
|
1688
1735
|
fee: processedFee,
|
|
1736
|
+
currency: symbol,
|
|
1737
|
+
asset: asset,
|
|
1689
1738
|
weight: weight,
|
|
1690
1739
|
forwardedXcms: forwardedXcms,
|
|
1691
1740
|
destParaId: destParaId
|
|
1692
1741
|
}));
|
|
1693
1742
|
}
|
|
1694
|
-
},
|
|
1743
|
+
}, _callee23, this);
|
|
1695
1744
|
}));
|
|
1696
|
-
function getDryRunXcm(
|
|
1745
|
+
function getDryRunXcm(_x41) {
|
|
1697
1746
|
return _getDryRunXcm.apply(this, arguments);
|
|
1698
1747
|
}
|
|
1699
1748
|
return getDryRunXcm;
|
|
@@ -1701,18 +1750,18 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1701
1750
|
}, {
|
|
1702
1751
|
key: "getBridgeStatus",
|
|
1703
1752
|
value: function () {
|
|
1704
|
-
var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1753
|
+
var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee24() {
|
|
1705
1754
|
var outboundOperatingMode;
|
|
1706
|
-
return _regenerator().w(function (
|
|
1707
|
-
while (1) switch (
|
|
1755
|
+
return _regenerator().w(function (_context24) {
|
|
1756
|
+
while (1) switch (_context24.n) {
|
|
1708
1757
|
case 0:
|
|
1709
|
-
|
|
1758
|
+
_context24.n = 1;
|
|
1710
1759
|
return this.api.getUnsafeApi().query.EthereumOutboundQueue.OperatingMode.getValue();
|
|
1711
1760
|
case 1:
|
|
1712
|
-
outboundOperatingMode =
|
|
1713
|
-
return
|
|
1761
|
+
outboundOperatingMode = _context24.v;
|
|
1762
|
+
return _context24.a(2, outboundOperatingMode.type);
|
|
1714
1763
|
}
|
|
1715
|
-
},
|
|
1764
|
+
}, _callee24, this);
|
|
1716
1765
|
}));
|
|
1717
1766
|
function getBridgeStatus() {
|
|
1718
1767
|
return _getBridgeStatus.apply(this, arguments);
|