@rango-dev/queue-manager-rango-preset 0.1.10-next.90 → 0.1.10-next.92
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/actions/createTransaction.d.ts.map +1 -1
- package/dist/helpers.d.ts +2 -1
- package/dist/helpers.d.ts.map +1 -1
- package/dist/queue-manager-rango-preset.cjs.development.js +41 -4
- 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 +41 -4
- package/dist/queue-manager-rango-preset.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/actions/createTransaction.ts +5 -1
- package/src/helpers.ts +21 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/queue-manager-rango-preset",
|
|
3
|
-
"version": "0.1.10-next.
|
|
3
|
+
"version": "0.1.10-next.92",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"module": "dist/queue-manager-rango-preset.esm.js",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@sentry/browser": "^6.12.0",
|
|
56
|
-
"rango-sdk": "^0.1.
|
|
56
|
+
"rango-sdk": "^0.1.19",
|
|
57
57
|
"uuid": "^9.0.0"
|
|
58
58
|
},
|
|
59
59
|
"publishConfig": {
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
isStarknetTransaction,
|
|
10
10
|
isTronTransaction,
|
|
11
11
|
updateSwapStatus,
|
|
12
|
+
throwOnOK,
|
|
12
13
|
} from '../helpers';
|
|
13
14
|
import { APIErrorCode } from '../shared-errors';
|
|
14
15
|
import { prettifyErrorMessage } from '../shared';
|
|
@@ -67,7 +68,10 @@ export async function createTransaction(
|
|
|
67
68
|
};
|
|
68
69
|
try {
|
|
69
70
|
// Getting transcation from server.
|
|
70
|
-
|
|
71
|
+
|
|
72
|
+
const { transaction } = await throwOnOK(
|
|
73
|
+
httpService.createTransaction(request)
|
|
74
|
+
);
|
|
71
75
|
|
|
72
76
|
if (transaction) {
|
|
73
77
|
if (isEvmTransaction(transaction)) {
|
package/src/helpers.ts
CHANGED
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
Transaction,
|
|
26
26
|
TransactionType,
|
|
27
27
|
EvmBlockchainMeta,
|
|
28
|
+
CreateTransactionResponse,
|
|
28
29
|
} from 'rango-sdk';
|
|
29
30
|
|
|
30
31
|
import {
|
|
@@ -1647,3 +1648,23 @@ export function isNeedBlockQueueForParallel(step: PendingSwapStep): boolean {
|
|
|
1647
1648
|
!!step.cosmosTransaction
|
|
1648
1649
|
);
|
|
1649
1650
|
}
|
|
1651
|
+
|
|
1652
|
+
/*
|
|
1653
|
+
Create transaction endpoint doesn't return error code on http status code,
|
|
1654
|
+
For backward compatibilty with server and sdk, we use this wrapper to reject the promise.
|
|
1655
|
+
*/
|
|
1656
|
+
export async function throwOnOK(
|
|
1657
|
+
rawResponse: Promise<CreateTransactionResponse>
|
|
1658
|
+
): Promise<CreateTransactionResponse> {
|
|
1659
|
+
try {
|
|
1660
|
+
const responseBody = await rawResponse;
|
|
1661
|
+
if (!responseBody.ok || !responseBody.transaction) {
|
|
1662
|
+
throw PrettyError.CreateTransaction(
|
|
1663
|
+
responseBody.error || 'bad response from create tx endpoint'
|
|
1664
|
+
);
|
|
1665
|
+
}
|
|
1666
|
+
return responseBody;
|
|
1667
|
+
} catch (e) {
|
|
1668
|
+
throw e;
|
|
1669
|
+
}
|
|
1670
|
+
}
|