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