@rango-dev/queue-manager-rango-preset 0.1.10-next.93 → 0.1.10-next.95
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/dist/helpers.d.ts.map +1 -1
- package/dist/queue-manager-rango-preset.cjs.development.js +96 -72
- package/dist/queue-manager-rango-preset.cjs.development.js.map +1 -1
- package/dist/queue-manager-rango-preset.cjs.production.min.js +1 -1
- package/dist/queue-manager-rango-preset.cjs.production.min.js.map +1 -1
- package/dist/queue-manager-rango-preset.esm.js +96 -72
- package/dist/queue-manager-rango-preset.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/helpers.ts +140 -102
- package/src/migration.ts +2 -2
package/package.json
CHANGED
package/src/helpers.ts
CHANGED
|
@@ -1107,7 +1107,10 @@ export function singTransaction(
|
|
|
1107
1107
|
const notification = getSwapNotitfication('confirm_transfer', updateResult);
|
|
1108
1108
|
notifier(notification);
|
|
1109
1109
|
|
|
1110
|
-
if (notification.eventType
|
|
1110
|
+
if (notification.eventType === 'transaction_expired') {
|
|
1111
|
+
failed();
|
|
1112
|
+
onFinish();
|
|
1113
|
+
} else {
|
|
1111
1114
|
walletSigners
|
|
1112
1115
|
.getSigner(TransactionType.TRANSFER)
|
|
1113
1116
|
.signAndSendTx(transferTransaction, walletAddress, null)
|
|
@@ -1161,7 +1164,10 @@ export function singTransaction(
|
|
|
1161
1164
|
);
|
|
1162
1165
|
notifier(notification);
|
|
1163
1166
|
|
|
1164
|
-
if (notification.eventType
|
|
1167
|
+
if (notification.eventType === 'transaction_expired') {
|
|
1168
|
+
failed();
|
|
1169
|
+
onFinish();
|
|
1170
|
+
} else {
|
|
1165
1171
|
walletSigners
|
|
1166
1172
|
.getSigner(TransactionType.EVM)
|
|
1167
1173
|
.signAndSendTx(evmTransaction, walletAddress, null)
|
|
@@ -1230,7 +1236,10 @@ export function singTransaction(
|
|
|
1230
1236
|
);
|
|
1231
1237
|
notifier(notification);
|
|
1232
1238
|
|
|
1233
|
-
if (notification.eventType
|
|
1239
|
+
if (notification.eventType === 'transaction_expired') {
|
|
1240
|
+
failed();
|
|
1241
|
+
onFinish();
|
|
1242
|
+
} else {
|
|
1234
1243
|
// If keplr wallet is executing contracts on terra, throw error. keplr doesn't support transfer or execute contracts. only IBC messages are supported
|
|
1235
1244
|
if (
|
|
1236
1245
|
(currentStep?.swapperId.toString() === 'TerraSwap' ||
|
|
@@ -1317,7 +1326,10 @@ export function singTransaction(
|
|
|
1317
1326
|
);
|
|
1318
1327
|
notifier(notification);
|
|
1319
1328
|
|
|
1320
|
-
if (notification.eventType
|
|
1329
|
+
if (notification.eventType === 'transaction_expired') {
|
|
1330
|
+
failed();
|
|
1331
|
+
onFinish();
|
|
1332
|
+
} else {
|
|
1321
1333
|
const tx = solanaTransaction;
|
|
1322
1334
|
walletSigners
|
|
1323
1335
|
.getSigner(TransactionType.SOLANA)
|
|
@@ -1360,120 +1372,146 @@ export function singTransaction(
|
|
|
1360
1372
|
const updateResult = updateSwapStatus({
|
|
1361
1373
|
getStorage,
|
|
1362
1374
|
setStorage,
|
|
1363
|
-
nextStepStatus: 'running',
|
|
1375
|
+
nextStepStatus: hasAlreadyProceededToSign ? 'failed' : 'running',
|
|
1376
|
+
nextStatus: hasAlreadyProceededToSign ? 'failed' : 'running',
|
|
1364
1377
|
message: executeMessage,
|
|
1365
1378
|
details: executeDetails,
|
|
1379
|
+
hasAlreadyProceededToSign,
|
|
1366
1380
|
});
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1381
|
+
const notification = getSwapNotitfication(
|
|
1382
|
+
'calling_smart_contract',
|
|
1383
|
+
updateResult
|
|
1384
|
+
);
|
|
1385
|
+
notifier(notification);
|
|
1371
1386
|
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
if (
|
|
1387
|
-
error &&
|
|
1388
|
-
error?.root &&
|
|
1389
|
-
error?.root?.message &&
|
|
1390
|
-
error?.root?.code &&
|
|
1391
|
-
error?.root?.reason
|
|
1392
|
-
) {
|
|
1393
|
-
logRPCError(
|
|
1394
|
-
error.root,
|
|
1395
|
-
swap,
|
|
1396
|
-
currentStep,
|
|
1397
|
-
sourceWallet?.walletType
|
|
1387
|
+
if (notification.eventType === 'transaction_expired') {
|
|
1388
|
+
failed();
|
|
1389
|
+
onFinish();
|
|
1390
|
+
} else {
|
|
1391
|
+
walletSigners
|
|
1392
|
+
.getSigner(TransactionType.TRON)
|
|
1393
|
+
.signAndSendTx(tronTransaction, walletAddress, null)
|
|
1394
|
+
.then(
|
|
1395
|
+
(id) => {
|
|
1396
|
+
setStepTransactionIds(
|
|
1397
|
+
actions,
|
|
1398
|
+
id,
|
|
1399
|
+
'smart_contract_called',
|
|
1400
|
+
notifier
|
|
1398
1401
|
);
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1402
|
+
schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
|
|
1403
|
+
next();
|
|
1404
|
+
onFinish();
|
|
1405
|
+
},
|
|
1406
|
+
(error) => {
|
|
1407
|
+
if (swap.status === 'failed') return;
|
|
1408
|
+
const { extraMessage, extraMessageDetail, extraMessageErrorCode } =
|
|
1409
|
+
prettifyErrorMessage(error);
|
|
1410
|
+
if (
|
|
1411
|
+
error &&
|
|
1412
|
+
error?.root &&
|
|
1413
|
+
error?.root?.message &&
|
|
1414
|
+
error?.root?.code &&
|
|
1415
|
+
error?.root?.reason
|
|
1416
|
+
) {
|
|
1417
|
+
logRPCError(
|
|
1418
|
+
error.root,
|
|
1419
|
+
swap,
|
|
1420
|
+
currentStep,
|
|
1421
|
+
sourceWallet?.walletType
|
|
1422
|
+
);
|
|
1423
|
+
}
|
|
1424
|
+
const updateResult = updateSwapStatus({
|
|
1425
|
+
getStorage,
|
|
1426
|
+
setStorage,
|
|
1427
|
+
nextStatus: 'failed',
|
|
1428
|
+
nextStepStatus: 'failed',
|
|
1429
|
+
message: extraMessage,
|
|
1430
|
+
details: extraMessageDetail,
|
|
1431
|
+
errorCode: extraMessageErrorCode,
|
|
1432
|
+
});
|
|
1433
|
+
notifier({
|
|
1434
|
+
eventType: 'smart_contract_call_failed',
|
|
1435
|
+
...updateResult,
|
|
1436
|
+
});
|
|
1413
1437
|
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1438
|
+
failed();
|
|
1439
|
+
onFinish();
|
|
1440
|
+
}
|
|
1441
|
+
);
|
|
1442
|
+
}
|
|
1418
1443
|
} else if (!!starknetTransaction) {
|
|
1419
1444
|
const updateResult = updateSwapStatus({
|
|
1420
1445
|
getStorage,
|
|
1421
1446
|
setStorage,
|
|
1422
|
-
nextStepStatus: 'running',
|
|
1447
|
+
nextStepStatus: hasAlreadyProceededToSign ? 'failed' : 'running',
|
|
1448
|
+
nextStatus: hasAlreadyProceededToSign ? 'failed' : 'running',
|
|
1423
1449
|
message: executeMessage,
|
|
1424
1450
|
details: executeDetails,
|
|
1451
|
+
hasAlreadyProceededToSign,
|
|
1425
1452
|
});
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1453
|
+
const notification = getSwapNotitfication(
|
|
1454
|
+
'calling_smart_contract',
|
|
1455
|
+
updateResult
|
|
1456
|
+
);
|
|
1457
|
+
notifier(notification);
|
|
1430
1458
|
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
if (
|
|
1446
|
-
error &&
|
|
1447
|
-
error?.root &&
|
|
1448
|
-
error?.root?.message &&
|
|
1449
|
-
error?.root?.code &&
|
|
1450
|
-
error?.root?.reason
|
|
1451
|
-
) {
|
|
1452
|
-
logRPCError(
|
|
1453
|
-
error.root,
|
|
1454
|
-
swap,
|
|
1455
|
-
currentStep,
|
|
1456
|
-
sourceWallet?.walletType
|
|
1459
|
+
if (notification.eventType === 'transaction_expired') {
|
|
1460
|
+
failed();
|
|
1461
|
+
onFinish();
|
|
1462
|
+
} else {
|
|
1463
|
+
walletSigners
|
|
1464
|
+
.getSigner(TransactionType.STARKNET)
|
|
1465
|
+
.signAndSendTx(starknetTransaction, walletAddress, null)
|
|
1466
|
+
.then(
|
|
1467
|
+
(id) => {
|
|
1468
|
+
setStepTransactionIds(
|
|
1469
|
+
actions,
|
|
1470
|
+
id,
|
|
1471
|
+
'smart_contract_called',
|
|
1472
|
+
notifier
|
|
1457
1473
|
);
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1474
|
+
schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
|
|
1475
|
+
next();
|
|
1476
|
+
onFinish();
|
|
1477
|
+
},
|
|
1478
|
+
(error) => {
|
|
1479
|
+
if (swap.status === 'failed') return;
|
|
1480
|
+
const { extraMessage, extraMessageDetail, extraMessageErrorCode } =
|
|
1481
|
+
prettifyErrorMessage(error);
|
|
1482
|
+
if (
|
|
1483
|
+
error &&
|
|
1484
|
+
error?.root &&
|
|
1485
|
+
error?.root?.message &&
|
|
1486
|
+
error?.root?.code &&
|
|
1487
|
+
error?.root?.reason
|
|
1488
|
+
) {
|
|
1489
|
+
logRPCError(
|
|
1490
|
+
error.root,
|
|
1491
|
+
swap,
|
|
1492
|
+
currentStep,
|
|
1493
|
+
sourceWallet?.walletType
|
|
1494
|
+
);
|
|
1495
|
+
}
|
|
1496
|
+
const updateResult = updateSwapStatus({
|
|
1497
|
+
getStorage,
|
|
1498
|
+
setStorage,
|
|
1499
|
+
nextStatus: 'failed',
|
|
1500
|
+
nextStepStatus: 'failed',
|
|
1501
|
+
message: extraMessage,
|
|
1502
|
+
details: extraMessageDetail,
|
|
1503
|
+
errorCode: extraMessageErrorCode,
|
|
1504
|
+
});
|
|
1505
|
+
notifier({
|
|
1506
|
+
eventType: 'smart_contract_call_failed',
|
|
1507
|
+
...updateResult,
|
|
1508
|
+
});
|
|
1472
1509
|
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1510
|
+
failed();
|
|
1511
|
+
onFinish();
|
|
1512
|
+
}
|
|
1513
|
+
);
|
|
1514
|
+
}
|
|
1477
1515
|
}
|
|
1478
1516
|
}
|
|
1479
1517
|
|
package/src/migration.ts
CHANGED
|
@@ -57,7 +57,7 @@ async function migration(): Promise<boolean> {
|
|
|
57
57
|
const taskId = uuid();
|
|
58
58
|
|
|
59
59
|
const convertedSwap: PersistedQueue = {
|
|
60
|
-
id:
|
|
60
|
+
id: swap.requestId,
|
|
61
61
|
createdAt: Number(swap.creationTime),
|
|
62
62
|
name: 'swap',
|
|
63
63
|
status: Status.RUNNING,
|
|
@@ -90,7 +90,7 @@ async function migration(): Promise<boolean> {
|
|
|
90
90
|
const status = swap.status === 'success' ? Status.SUCCESS : Status.FAILED;
|
|
91
91
|
|
|
92
92
|
const convertedSwap: PersistedQueue = {
|
|
93
|
-
id:
|
|
93
|
+
id: swap.requestId,
|
|
94
94
|
createdAt: Number(swap.creationTime),
|
|
95
95
|
name: 'swap',
|
|
96
96
|
status,
|