@rango-dev/queue-manager-rango-preset 0.1.10-next.78 → 0.1.10-next.81
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/checkStatus.d.ts.map +1 -1
- package/dist/actions/createTransaction.d.ts.map +1 -1
- package/dist/constants.d.ts +1 -3
- package/dist/constants.d.ts.map +1 -1
- package/dist/helpers.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/queue-manager-rango-preset.cjs.development.js +337 -282
- 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 +340 -282
- package/dist/queue-manager-rango-preset.esm.js.map +1 -1
- package/dist/services/httpService.d.ts +3 -0
- package/dist/services/httpService.d.ts.map +1 -0
- package/dist/services/index.d.ts +2 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/shared-errors.d.ts +1 -0
- package/dist/shared-errors.d.ts.map +1 -1
- package/dist/shared.d.ts +10 -15
- package/dist/shared.d.ts.map +1 -1
- package/package.json +3 -2
- package/src/actions/checkStatus.ts +16 -12
- package/src/actions/createTransaction.ts +21 -3
- package/src/constants.ts +1 -3
- package/src/helpers.ts +318 -11
- package/src/index.ts +3 -0
- package/src/services/httpService.ts +4 -0
- package/src/services/index.ts +1 -0
- package/src/shared-errors.ts +28 -1
- package/src/shared.ts +58 -28
- package/dist/shared-api.d.ts +0 -10
- package/dist/shared-api.d.ts.map +0 -1
- package/src/shared-api.ts +0 -172
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpService.d.ts","sourceRoot":"","sources":["../src/services/httpService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAGxC,eAAO,MAAM,WAAW,aAA4C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/services/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/shared-errors.d.ts
CHANGED
|
@@ -52,5 +52,6 @@ export declare class PrettyError extends Error {
|
|
|
52
52
|
export declare const ERROR_GETTING_BEST_ROUTE: (status: number | string) => string;
|
|
53
53
|
export declare const ERROR_CONFIRM_SWAP: (status?: string | number | undefined) => string;
|
|
54
54
|
export declare const WARNING_STARKNET_FOUND = "StarknNet blockchain is still an ALPHA version. As such, delays may occur, and catastrophic bugs may lurk.";
|
|
55
|
+
export declare function mapAppErrorCodesToAPIErrorCode(errorCode: string | null): APIErrorCode;
|
|
55
56
|
export {};
|
|
56
57
|
//# sourceMappingURL=shared-errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-errors.d.ts","sourceRoot":"","sources":["src/shared-errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"shared-errors.d.ts","sourceRoot":"","sources":["src/shared-errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAGvD,oBAAY,WAAW,GAAG;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC/C,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAC;CACtC,CAAC;AAEF,oBAAY,YAAY;IACtB,OAAO,YAAY;IACnB,eAAe,oBAAoB;IACnC,WAAW,gBAAgB;IAC3B,kBAAkB,uBAAuB;IACzC,cAAc,mBAAmB;IACjC,mBAAmB,wBAAwB;IAC3C,WAAW,gBAAgB;IAC3B,2BAA2B,gCAAgC;CAC5D;AAED,oBAAY,aAAa;IACvB,yBAAyB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,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW;IASrD,MAAM,CAAC,aAAa,IAAI,WAAW;IASnC,MAAM,CAAC,iBAAiB,IAAI,WAAW;CAQxC;AAED,eAAO,MAAM,wBAAwB,WAAY,MAAM,GAAG,MAAM,KAAG,MACA,CAAC;AAEpE,eAAO,MAAM,kBAAkB,4CAA+B,MAGtC,CAAC;AAEzB,eAAO,MAAM,sBAAsB,+GAC2E,CAAC;AAM/G,wBAAgB,8BAA8B,CAC5C,SAAS,EAAE,MAAM,GAAG,IAAI,GACvB,YAAY,CAoBd"}
|
package/dist/shared.d.ts
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
import { Network, WalletType } from '@rango-dev/wallets-shared';
|
|
2
|
-
import { CosmosTransaction, EvmBlockchainMeta, EvmTransaction, SimulationResult, SolanaTransaction, StarknetTransaction,
|
|
3
|
-
import { BigNumber } from 'bignumber.js';
|
|
2
|
+
import { CosmosTransaction, EvmBlockchainMeta, EvmTransaction, SimulationResult, SolanaTransaction, StarknetTransaction, TronTransaction, Transfer as TransferTransaction } from 'rango-sdk';
|
|
4
3
|
import { ErrorDetail } from './shared-errors';
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
outputAmount: BigNumber | null;
|
|
10
|
-
explorerUrl: SwapExplorerUrl[] | null;
|
|
11
|
-
trackingCode: string;
|
|
12
|
-
newTx: Transaction | null;
|
|
13
|
-
diagnosisUrl: string | null;
|
|
14
|
-
steps: SwapperStatusStep[] | null;
|
|
15
|
-
};
|
|
4
|
+
export interface PendingSwapWithQueueID {
|
|
5
|
+
id: string;
|
|
6
|
+
swap: PendingSwap;
|
|
7
|
+
}
|
|
16
8
|
export declare type SwapProgressNotification = {
|
|
17
9
|
eventType: EventType;
|
|
18
10
|
swap: PendingSwap | null;
|
|
@@ -36,7 +28,7 @@ export declare type Account = {
|
|
|
36
28
|
walletType: WalletType;
|
|
37
29
|
error: boolean;
|
|
38
30
|
explorerUrl: string | null;
|
|
39
|
-
isConnected
|
|
31
|
+
isConnected?: boolean;
|
|
40
32
|
};
|
|
41
33
|
export declare type Blockchain = {
|
|
42
34
|
name: string;
|
|
@@ -141,9 +133,12 @@ export declare type PendingSwap = {
|
|
|
141
133
|
export declare const getCurrentBlockchainOfOrNull: (swap: PendingSwap, step: PendingSwapStep) => Network | null;
|
|
142
134
|
export declare const getCurrentBlockchainOf: (swap: PendingSwap, step: PendingSwapStep) => Network;
|
|
143
135
|
export declare const getEvmApproveUrl: (tx: string, network: Network, evmBasedBlockchains: EvmBlockchainMeta[]) => string;
|
|
136
|
+
export declare const getStarknetApproveUrl: (tx: string) => string;
|
|
137
|
+
export declare const getTronApproveUrl: (tx: string) => string;
|
|
144
138
|
export declare const prettifyErrorMessage: (obj: unknown) => ErrorDetail;
|
|
145
|
-
export declare function getCookieId(): string;
|
|
146
139
|
export declare function getNextStep(swap: PendingSwap, currentStep: PendingSwapStep): PendingSwapStep | null;
|
|
140
|
+
export declare const getCurrentAddressOf: (swap: PendingSwap, step: PendingSwapStep) => string;
|
|
141
|
+
export declare function getRelatedWallet(swap: PendingSwap, currentStep: PendingSwapStep): WalletTypeAndAddress;
|
|
147
142
|
export declare function getRelatedWalletOrNull(swap: PendingSwap, currentStep: PendingSwapStep): WalletTypeAndAddress | null;
|
|
148
143
|
export {};
|
|
149
144
|
//# sourceMappingURL=shared.d.ts.map
|
package/dist/shared.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["src/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["src/shared.ts"],"names":[],"mappings":"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B,CAAC;AAEF,eAAO,MAAM,4BAA4B,SACjC,WAAW,QACX,eAAe,KACpB,OAAO,GAAG,IAMZ,CAAC;AAEF,eAAO,MAAM,sBAAsB,SAC3B,WAAW,QACX,eAAe,KACpB,OAuBF,CAAC;AAEF,eAAO,MAAM,gBAAgB,OACvB,MAAM,WACD,OAAO,uBACK,iBAAiB,EAAE,KACvC,MAgBF,CAAC;AAEF,eAAO,MAAM,qBAAqB,OAAQ,MAAM,KAAG,MAKlD,CAAC;AAEF,eAAO,MAAM,iBAAiB,OAAQ,MAAM,KAAG,MAK9C,CAAC;AAEF,eAAO,MAAM,oBAAoB,QAAS,OAAO,KAAG,WAsBnD,CAAC;AAEF,wBAAgB,WAAW,CACzB,IAAI,EAAE,WAAW,EACjB,WAAW,EAAE,eAAe,GAC3B,eAAe,GAAG,IAAI,CASxB;AAGD,eAAO,MAAM,mBAAmB,SACxB,WAAW,QACX,eAAe,KACpB,MAYF,CAAC;AAGF,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,WAAW,EACjB,WAAW,EAAE,eAAe,GAC3B,oBAAoB,CAetB;AAED,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,WAAW,EACjB,WAAW,EAAE,eAAe,GAC3B,oBAAoB,GAAG,IAAI,CAM7B"}
|
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.81",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"module": "dist/queue-manager-rango-preset.esm.js",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -21,8 +21,9 @@
|
|
|
21
21
|
"@rango-dev/queue-manager-core": "*",
|
|
22
22
|
"@rango-dev/wallets-core": "*",
|
|
23
23
|
"@rango-dev/wallets-shared": "*",
|
|
24
|
+
"@sentry/browser": "*",
|
|
24
25
|
"bignumber.js": "*",
|
|
25
|
-
"rango-types": "
|
|
26
|
+
"rango-types": "*",
|
|
26
27
|
"uuid": "*"
|
|
27
28
|
},
|
|
28
29
|
"husky": {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import BigNumber from 'bignumber.js';
|
|
2
1
|
import { ExecuterActions } from '@rango-dev/queue-manager-core';
|
|
3
2
|
import {
|
|
4
3
|
delay,
|
|
@@ -12,8 +11,9 @@ import {
|
|
|
12
11
|
resetNetworkStatus,
|
|
13
12
|
} from '../helpers';
|
|
14
13
|
import { SwapActionTypes, SwapQueueContext, SwapStorage } from '../types';
|
|
15
|
-
import { getNextStep, MessageSeverity
|
|
16
|
-
import {
|
|
14
|
+
import { getNextStep, MessageSeverity } from '../shared';
|
|
15
|
+
import { TransactionStatusResponse } from 'rango-sdk';
|
|
16
|
+
import { httpService } from '../services';
|
|
17
17
|
|
|
18
18
|
const INTERVAL_FOR_CHECK = 2000;
|
|
19
19
|
|
|
@@ -38,21 +38,23 @@ async function checkTransactionStatus({
|
|
|
38
38
|
const currentStep = getCurrentStep(swap)!;
|
|
39
39
|
const txId = currentStep.executedTransactionId;
|
|
40
40
|
|
|
41
|
-
let status:
|
|
41
|
+
let status: TransactionStatusResponse | null = null;
|
|
42
42
|
try {
|
|
43
43
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
44
|
-
status = await
|
|
44
|
+
status = await httpService.checkStatus({
|
|
45
|
+
requestId: swap.requestId,
|
|
46
|
+
txId: txId!,
|
|
47
|
+
step: currentStep.id,
|
|
48
|
+
});
|
|
45
49
|
} catch (e) {
|
|
46
50
|
await delay(INTERVAL_FOR_CHECK);
|
|
47
51
|
retry();
|
|
48
52
|
return;
|
|
49
53
|
}
|
|
50
54
|
|
|
51
|
-
const outputAmount:
|
|
55
|
+
const outputAmount: string | null =
|
|
52
56
|
status?.outputAmount ||
|
|
53
|
-
(!!currentStep.outputAmount
|
|
54
|
-
? new BigNumber(currentStep.outputAmount)
|
|
55
|
-
: null);
|
|
57
|
+
(!!currentStep.outputAmount ? currentStep.outputAmount : null);
|
|
56
58
|
const prevOutputAmount = currentStep.outputAmount;
|
|
57
59
|
swap.extraMessage = status?.extraMessage || swap.extraMessage;
|
|
58
60
|
swap.extraMessageSeverity = MessageSeverity.info;
|
|
@@ -61,8 +63,7 @@ async function checkTransactionStatus({
|
|
|
61
63
|
currentStep.status = status?.status || currentStep.status;
|
|
62
64
|
currentStep.diagnosisUrl =
|
|
63
65
|
status?.diagnosisUrl || currentStep.diagnosisUrl || null;
|
|
64
|
-
currentStep.outputAmount =
|
|
65
|
-
outputAmount?.toFixed() || currentStep.outputAmount;
|
|
66
|
+
currentStep.outputAmount = outputAmount || currentStep.outputAmount;
|
|
66
67
|
currentStep.explorerUrl = status?.explorerUrl || currentStep.explorerUrl;
|
|
67
68
|
currentStep.internalSteps = status?.steps || null;
|
|
68
69
|
|
|
@@ -154,10 +155,11 @@ async function checkApprovalStatus({
|
|
|
154
155
|
const currentStep = getCurrentStep(swap)!;
|
|
155
156
|
let isApproved = false;
|
|
156
157
|
try {
|
|
157
|
-
const response = await
|
|
158
|
+
const response = await httpService.checkApproval(swap.requestId);
|
|
158
159
|
isApproved = response.isApproved;
|
|
159
160
|
} catch (e) {
|
|
160
161
|
console.error('Failed to check getApprovedAmount', e);
|
|
162
|
+
isApproved = false;
|
|
161
163
|
}
|
|
162
164
|
if (isApproved) {
|
|
163
165
|
currentStep.status = 'approved';
|
|
@@ -166,6 +168,8 @@ async function checkApprovalStatus({
|
|
|
166
168
|
swap.extraMessageSeverity = MessageSeverity.success;
|
|
167
169
|
currentStep.evmApprovalTransaction = null;
|
|
168
170
|
currentStep.executedTransactionId = null;
|
|
171
|
+
currentStep.starknetApprovalTransaction = null;
|
|
172
|
+
currentStep.tronApprovalTransaction = null;
|
|
169
173
|
|
|
170
174
|
setStorage({
|
|
171
175
|
...getStorage(),
|
|
@@ -6,12 +6,14 @@ import {
|
|
|
6
6
|
isEvmTransaction,
|
|
7
7
|
isSolanaTransaction,
|
|
8
8
|
isTrasnferTransaction,
|
|
9
|
+
isStarknetTransaction,
|
|
10
|
+
isTronTransaction,
|
|
9
11
|
updateSwapStatus,
|
|
10
12
|
} from '../helpers';
|
|
11
|
-
import { createTransaction as requestTransaction } from '../shared-api';
|
|
12
13
|
import { APIErrorCode } from '../shared-errors';
|
|
13
14
|
import { prettifyErrorMessage } from '../shared';
|
|
14
15
|
import { CreateTransactionRequest } from 'rango-sdk';
|
|
16
|
+
import { httpService } from '../services';
|
|
15
17
|
|
|
16
18
|
/**
|
|
17
19
|
*
|
|
@@ -34,13 +36,21 @@ export async function createTransaction(
|
|
|
34
36
|
transferTransaction,
|
|
35
37
|
evmApprovalTransaction,
|
|
36
38
|
solanaTransaction,
|
|
39
|
+
tronTransaction,
|
|
40
|
+
tronApprovalTransaction,
|
|
41
|
+
starknetTransaction,
|
|
42
|
+
starknetApprovalTransaction,
|
|
37
43
|
} = currentStep;
|
|
38
44
|
|
|
39
45
|
if (
|
|
40
46
|
!evmTransaction &&
|
|
47
|
+
!evmApprovalTransaction &&
|
|
48
|
+
!tronTransaction &&
|
|
49
|
+
!tronApprovalTransaction &&
|
|
50
|
+
!starknetTransaction &&
|
|
51
|
+
!starknetApprovalTransaction &&
|
|
41
52
|
!cosmosTransaction &&
|
|
42
53
|
!transferTransaction &&
|
|
43
|
-
!evmApprovalTransaction &&
|
|
44
54
|
!solanaTransaction
|
|
45
55
|
) {
|
|
46
56
|
const request: CreateTransactionRequest = {
|
|
@@ -57,7 +67,7 @@ export async function createTransaction(
|
|
|
57
67
|
};
|
|
58
68
|
try {
|
|
59
69
|
// Getting transcation from server.
|
|
60
|
-
const { transaction } = await
|
|
70
|
+
const { transaction } = await httpService.createTransaction(request);
|
|
61
71
|
|
|
62
72
|
if (transaction) {
|
|
63
73
|
if (isEvmTransaction(transaction)) {
|
|
@@ -70,6 +80,14 @@ export async function createTransaction(
|
|
|
70
80
|
currentStep.solanaTransaction = transaction;
|
|
71
81
|
} else if (isTrasnferTransaction(transaction)) {
|
|
72
82
|
currentStep.transferTransaction = transaction;
|
|
83
|
+
} else if (isStarknetTransaction(transaction)) {
|
|
84
|
+
if (transaction.isApprovalTx)
|
|
85
|
+
currentStep.starknetApprovalTransaction = transaction;
|
|
86
|
+
else currentStep.starknetTransaction = transaction;
|
|
87
|
+
} else if (isTronTransaction(transaction)) {
|
|
88
|
+
if (transaction.isApprovalTx)
|
|
89
|
+
currentStep.tronApprovalTransaction = transaction;
|
|
90
|
+
else currentStep.tronTransaction = transaction;
|
|
73
91
|
}
|
|
74
92
|
}
|
|
75
93
|
|
package/src/constants.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
export const
|
|
2
|
-
export const BASE_URL = process.env.REACT_APP_BASE_URL;
|
|
3
|
-
export const RANGO_COOKIE_HEADER = 'X-Rango-Id';
|
|
1
|
+
export const RANGO_DAPP_API_KEY = process.env.REACT_API_KEY;
|
|
4
2
|
|
|
5
3
|
export const ERROR_MESSAGE_DEPENDS_ON_OTHER_QUEUES =
|
|
6
4
|
'Waiting for other running tasks to be finished';
|
package/src/helpers.ts
CHANGED
|
@@ -39,6 +39,8 @@ import {
|
|
|
39
39
|
getCurrentBlockchainOf,
|
|
40
40
|
getCurrentBlockchainOfOrNull,
|
|
41
41
|
getEvmApproveUrl,
|
|
42
|
+
getStarknetApproveUrl,
|
|
43
|
+
getTronApproveUrl,
|
|
42
44
|
getRelatedWalletOrNull,
|
|
43
45
|
MessageSeverity,
|
|
44
46
|
PendingSwap,
|
|
@@ -51,8 +53,8 @@ import {
|
|
|
51
53
|
WalletTypeAndAddress,
|
|
52
54
|
} from './shared';
|
|
53
55
|
import { logRPCError } from './shared-sentry';
|
|
54
|
-
import { PrettyError } from './shared-errors';
|
|
55
|
-
import {
|
|
56
|
+
import { PrettyError, mapAppErrorCodesToAPIErrorCode } from './shared-errors';
|
|
57
|
+
import { httpService } from './services';
|
|
56
58
|
|
|
57
59
|
type WhenTaskBlocked = Parameters<NonNullable<SwapQueueDef['whenTaskBlocked']>>;
|
|
58
60
|
type WhenTaskBlockedEvent = WhenTaskBlocked[0];
|
|
@@ -144,16 +146,18 @@ export function updateSwapStatus({
|
|
|
144
146
|
details && details.includes('Warning')
|
|
145
147
|
? 'Swap canceled by user.'
|
|
146
148
|
: details;
|
|
149
|
+
const walletType = getRelatedWalletOrNull(swap, currentStep!)?.walletType;
|
|
147
150
|
swap.extraMessageSeverity = MessageSeverity.error;
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
?
|
|
155
|
-
|
|
156
|
-
|
|
151
|
+
httpService
|
|
152
|
+
.reportFailure({
|
|
153
|
+
requestId: swap.requestId,
|
|
154
|
+
step: currentStep?.id || 1,
|
|
155
|
+
eventType: mapAppErrorCodesToAPIErrorCode(errorCode),
|
|
156
|
+
reason: errorReason || '',
|
|
157
|
+
data: walletType ? { wallet: walletType } : undefined,
|
|
158
|
+
})
|
|
159
|
+
.then()
|
|
160
|
+
.catch();
|
|
157
161
|
} else if (!!nextStepStatus && ['running'].includes(nextStepStatus))
|
|
158
162
|
swap.extraMessageSeverity = MessageSeverity.info;
|
|
159
163
|
else if (!!nextStepStatus && ['success', 'approved'].includes(nextStepStatus))
|
|
@@ -456,6 +460,8 @@ export async function isNetworkMatchedForTransaction(
|
|
|
456
460
|
WalletType.COSMOSTATION,
|
|
457
461
|
WalletType.CLOVER,
|
|
458
462
|
WalletType.BRAVE,
|
|
463
|
+
WalletType.FRONTIER,
|
|
464
|
+
WalletType.KUCOIN,
|
|
459
465
|
].includes(sourceWallet.walletType)
|
|
460
466
|
) {
|
|
461
467
|
const provider = getEvmProvider(providers, sourceWallet.walletType);
|
|
@@ -500,6 +506,10 @@ export const getCurrentAddressOf = (
|
|
|
500
506
|
const result =
|
|
501
507
|
swap.wallets[step.evmTransaction?.blockChain || ''] ||
|
|
502
508
|
swap.wallets[step.evmApprovalTransaction?.blockChain || ''] ||
|
|
509
|
+
swap.wallets[step.tronTransaction?.blockChain || ''] ||
|
|
510
|
+
swap.wallets[step.tronApprovalTransaction?.blockChain || ''] ||
|
|
511
|
+
swap.wallets[step.starknetTransaction?.blockChain || ''] ||
|
|
512
|
+
swap.wallets[step.starknetApprovalTransaction?.blockChain || ''] ||
|
|
503
513
|
swap.wallets[step.cosmosTransaction?.blockChain || ''] ||
|
|
504
514
|
swap.wallets[step.solanaTransaction?.blockChain || ''] ||
|
|
505
515
|
(step.transferTransaction?.fromWalletAddress
|
|
@@ -538,6 +548,10 @@ export const isTxAlreadyCreated = (
|
|
|
538
548
|
const result =
|
|
539
549
|
swap.wallets[step.evmTransaction?.blockChain || ''] ||
|
|
540
550
|
swap.wallets[step.evmApprovalTransaction?.blockChain || ''] ||
|
|
551
|
+
swap.wallets[step.tronTransaction?.blockChain || ''] ||
|
|
552
|
+
swap.wallets[step.tronApprovalTransaction?.blockChain || ''] ||
|
|
553
|
+
swap.wallets[step.starknetTransaction?.blockChain || ''] ||
|
|
554
|
+
swap.wallets[step.starknetApprovalTransaction?.blockChain || ''] ||
|
|
541
555
|
swap.wallets[step.cosmosTransaction?.blockChain || ''] ||
|
|
542
556
|
swap.wallets[step.solanaTransaction?.blockChain || ''] ||
|
|
543
557
|
step.transferTransaction?.fromWalletAddress ||
|
|
@@ -762,10 +776,15 @@ export function singTransaction(
|
|
|
762
776
|
cosmosTransaction,
|
|
763
777
|
solanaTransaction,
|
|
764
778
|
transferTransaction,
|
|
779
|
+
tronTransaction,
|
|
780
|
+
tronApprovalTransaction,
|
|
781
|
+
starknetTransaction,
|
|
782
|
+
starknetApprovalTransaction,
|
|
765
783
|
} = currentStep;
|
|
766
784
|
const sourceWallet = getRelatedWallet(swap, currentStep);
|
|
767
785
|
const walletAddress = getCurrentAddressOf(swap, currentStep);
|
|
768
786
|
const walletSigners = getSigners(sourceWallet.walletType);
|
|
787
|
+
|
|
769
788
|
const onFinish = () => {
|
|
770
789
|
if (actions.context.resetClaimedBy) {
|
|
771
790
|
actions.context.resetClaimedBy();
|
|
@@ -829,6 +848,176 @@ export function singTransaction(
|
|
|
829
848
|
onFinish();
|
|
830
849
|
},
|
|
831
850
|
|
|
851
|
+
(error) => {
|
|
852
|
+
if (swap.status === 'failed') return;
|
|
853
|
+
console.debug('error in approving', error);
|
|
854
|
+
const { extraMessage, extraMessageDetail, extraMessageErrorCode } =
|
|
855
|
+
prettifyErrorMessage(error);
|
|
856
|
+
if (
|
|
857
|
+
error &&
|
|
858
|
+
error?.root &&
|
|
859
|
+
error?.root?.message &&
|
|
860
|
+
error?.root?.code &&
|
|
861
|
+
error?.root?.reason
|
|
862
|
+
) {
|
|
863
|
+
logRPCError(
|
|
864
|
+
error.root,
|
|
865
|
+
swap,
|
|
866
|
+
currentStep,
|
|
867
|
+
sourceWallet?.walletType
|
|
868
|
+
);
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
const updateResult = updateSwapStatus({
|
|
872
|
+
getStorage,
|
|
873
|
+
setStorage,
|
|
874
|
+
nextStatus: 'failed',
|
|
875
|
+
nextStepStatus: 'failed',
|
|
876
|
+
message: extraMessage,
|
|
877
|
+
details: extraMessageDetail,
|
|
878
|
+
errorCode: extraMessageErrorCode,
|
|
879
|
+
});
|
|
880
|
+
notifier({
|
|
881
|
+
eventType: 'contract_rejected',
|
|
882
|
+
...updateResult,
|
|
883
|
+
});
|
|
884
|
+
|
|
885
|
+
failed();
|
|
886
|
+
onFinish();
|
|
887
|
+
}
|
|
888
|
+
);
|
|
889
|
+
return;
|
|
890
|
+
} else if (!!tronApprovalTransaction) {
|
|
891
|
+
// Update swap status
|
|
892
|
+
const message = `waiting for approval of ${currentStep?.fromSymbol} coin ${
|
|
893
|
+
sourceWallet.walletType === WalletType.WALLET_CONNECT
|
|
894
|
+
? 'on your mobile phone'
|
|
895
|
+
: ''
|
|
896
|
+
}`;
|
|
897
|
+
const updateResult = updateSwapStatus({
|
|
898
|
+
getStorage,
|
|
899
|
+
setStorage,
|
|
900
|
+
nextStepStatus: 'waitingForApproval',
|
|
901
|
+
message,
|
|
902
|
+
details:
|
|
903
|
+
'Waiting for approve transaction to be mined and confirmed successfully',
|
|
904
|
+
});
|
|
905
|
+
notifier({
|
|
906
|
+
eventType: 'confirm_contract',
|
|
907
|
+
...updateResult,
|
|
908
|
+
});
|
|
909
|
+
|
|
910
|
+
// Execute transaction
|
|
911
|
+
walletSigners
|
|
912
|
+
.getSigner(TransactionType.TRON)
|
|
913
|
+
.signAndSendTx(tronApprovalTransaction, walletAddress, null)
|
|
914
|
+
.then(
|
|
915
|
+
(hash) => {
|
|
916
|
+
console.debug('transaction of approval minted successfully', hash);
|
|
917
|
+
const approveUrl = getTronApproveUrl(hash);
|
|
918
|
+
currentStep.explorerUrl = [
|
|
919
|
+
...(currentStep.explorerUrl || []),
|
|
920
|
+
{
|
|
921
|
+
url: approveUrl,
|
|
922
|
+
description: `approve`,
|
|
923
|
+
},
|
|
924
|
+
];
|
|
925
|
+
|
|
926
|
+
// `currentStep` has been mutated, let's update storage.
|
|
927
|
+
setStorage({
|
|
928
|
+
...getStorage(),
|
|
929
|
+
swapDetails: swap,
|
|
930
|
+
});
|
|
931
|
+
schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
|
|
932
|
+
next();
|
|
933
|
+
onFinish();
|
|
934
|
+
},
|
|
935
|
+
|
|
936
|
+
(error) => {
|
|
937
|
+
if (swap.status === 'failed') return;
|
|
938
|
+
console.debug('error in approving', error);
|
|
939
|
+
const { extraMessage, extraMessageDetail, extraMessageErrorCode } =
|
|
940
|
+
prettifyErrorMessage(error);
|
|
941
|
+
if (
|
|
942
|
+
error &&
|
|
943
|
+
error?.root &&
|
|
944
|
+
error?.root?.message &&
|
|
945
|
+
error?.root?.code &&
|
|
946
|
+
error?.root?.reason
|
|
947
|
+
) {
|
|
948
|
+
logRPCError(
|
|
949
|
+
error.root,
|
|
950
|
+
swap,
|
|
951
|
+
currentStep,
|
|
952
|
+
sourceWallet?.walletType
|
|
953
|
+
);
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
const updateResult = updateSwapStatus({
|
|
957
|
+
getStorage,
|
|
958
|
+
setStorage,
|
|
959
|
+
nextStatus: 'failed',
|
|
960
|
+
nextStepStatus: 'failed',
|
|
961
|
+
message: extraMessage,
|
|
962
|
+
details: extraMessageDetail,
|
|
963
|
+
errorCode: extraMessageErrorCode,
|
|
964
|
+
});
|
|
965
|
+
notifier({
|
|
966
|
+
eventType: 'contract_rejected',
|
|
967
|
+
...updateResult,
|
|
968
|
+
});
|
|
969
|
+
|
|
970
|
+
failed();
|
|
971
|
+
onFinish();
|
|
972
|
+
}
|
|
973
|
+
);
|
|
974
|
+
return;
|
|
975
|
+
} else if (!!starknetApprovalTransaction) {
|
|
976
|
+
// Update swap status
|
|
977
|
+
const message = `waiting for approval of ${currentStep?.fromSymbol} coin ${
|
|
978
|
+
sourceWallet.walletType === WalletType.WALLET_CONNECT
|
|
979
|
+
? 'on your mobile phone'
|
|
980
|
+
: ''
|
|
981
|
+
}`;
|
|
982
|
+
const updateResult = updateSwapStatus({
|
|
983
|
+
getStorage,
|
|
984
|
+
setStorage,
|
|
985
|
+
nextStepStatus: 'waitingForApproval',
|
|
986
|
+
message,
|
|
987
|
+
details:
|
|
988
|
+
'Waiting for approve transaction to be mined and confirmed successfully',
|
|
989
|
+
});
|
|
990
|
+
notifier({
|
|
991
|
+
eventType: 'confirm_contract',
|
|
992
|
+
...updateResult,
|
|
993
|
+
});
|
|
994
|
+
|
|
995
|
+
// Execute transaction
|
|
996
|
+
walletSigners
|
|
997
|
+
.getSigner(TransactionType.STARKNET)
|
|
998
|
+
.signAndSendTx(starknetApprovalTransaction, walletAddress, null)
|
|
999
|
+
.then(
|
|
1000
|
+
(hash) => {
|
|
1001
|
+
console.debug('transaction of approval minted successfully', hash);
|
|
1002
|
+
const approveUrl = getStarknetApproveUrl(hash);
|
|
1003
|
+
currentStep.explorerUrl = [
|
|
1004
|
+
...(currentStep.explorerUrl || []),
|
|
1005
|
+
{
|
|
1006
|
+
url: approveUrl,
|
|
1007
|
+
description: `approve`,
|
|
1008
|
+
},
|
|
1009
|
+
];
|
|
1010
|
+
|
|
1011
|
+
// `currentStep` has been mutated, let's update storage.
|
|
1012
|
+
setStorage({
|
|
1013
|
+
...getStorage(),
|
|
1014
|
+
swapDetails: swap,
|
|
1015
|
+
});
|
|
1016
|
+
schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
|
|
1017
|
+
next();
|
|
1018
|
+
onFinish();
|
|
1019
|
+
},
|
|
1020
|
+
|
|
832
1021
|
(error) => {
|
|
833
1022
|
if (swap.status === 'failed') return;
|
|
834
1023
|
console.debug('error in approving', error);
|
|
@@ -1103,6 +1292,124 @@ export function singTransaction(
|
|
|
1103
1292
|
eventType: 'smart_contract_call_failed',
|
|
1104
1293
|
...updateResult,
|
|
1105
1294
|
});
|
|
1295
|
+
failed();
|
|
1296
|
+
onFinish();
|
|
1297
|
+
}
|
|
1298
|
+
);
|
|
1299
|
+
} else if (!!tronTransaction) {
|
|
1300
|
+
const updateResult = updateSwapStatus({
|
|
1301
|
+
getStorage,
|
|
1302
|
+
setStorage,
|
|
1303
|
+
nextStepStatus: 'running',
|
|
1304
|
+
message: executeMessage,
|
|
1305
|
+
details: executeDetails,
|
|
1306
|
+
});
|
|
1307
|
+
notifier({
|
|
1308
|
+
eventType: 'calling_smart_contract',
|
|
1309
|
+
...updateResult,
|
|
1310
|
+
});
|
|
1311
|
+
|
|
1312
|
+
walletSigners
|
|
1313
|
+
.getSigner(TransactionType.TRON)
|
|
1314
|
+
.signAndSendTx(tronTransaction, walletAddress, null)
|
|
1315
|
+
.then(
|
|
1316
|
+
(id) => {
|
|
1317
|
+
setStepTransactionIds(actions, id, 'smart_contract_called', notifier);
|
|
1318
|
+
schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
|
|
1319
|
+
next();
|
|
1320
|
+
onFinish();
|
|
1321
|
+
},
|
|
1322
|
+
(error) => {
|
|
1323
|
+
if (swap.status === 'failed') return;
|
|
1324
|
+
const { extraMessage, extraMessageDetail, extraMessageErrorCode } =
|
|
1325
|
+
prettifyErrorMessage(error);
|
|
1326
|
+
if (
|
|
1327
|
+
error &&
|
|
1328
|
+
error?.root &&
|
|
1329
|
+
error?.root?.message &&
|
|
1330
|
+
error?.root?.code &&
|
|
1331
|
+
error?.root?.reason
|
|
1332
|
+
) {
|
|
1333
|
+
logRPCError(
|
|
1334
|
+
error.root,
|
|
1335
|
+
swap,
|
|
1336
|
+
currentStep,
|
|
1337
|
+
sourceWallet?.walletType
|
|
1338
|
+
);
|
|
1339
|
+
}
|
|
1340
|
+
const updateResult = updateSwapStatus({
|
|
1341
|
+
getStorage,
|
|
1342
|
+
setStorage,
|
|
1343
|
+
nextStatus: 'failed',
|
|
1344
|
+
nextStepStatus: 'failed',
|
|
1345
|
+
message: extraMessage,
|
|
1346
|
+
details: extraMessageDetail,
|
|
1347
|
+
errorCode: extraMessageErrorCode,
|
|
1348
|
+
});
|
|
1349
|
+
notifier({
|
|
1350
|
+
eventType: 'smart_contract_call_failed',
|
|
1351
|
+
...updateResult,
|
|
1352
|
+
});
|
|
1353
|
+
|
|
1354
|
+
failed();
|
|
1355
|
+
onFinish();
|
|
1356
|
+
}
|
|
1357
|
+
);
|
|
1358
|
+
} else if (!!starknetTransaction) {
|
|
1359
|
+
const updateResult = updateSwapStatus({
|
|
1360
|
+
getStorage,
|
|
1361
|
+
setStorage,
|
|
1362
|
+
nextStepStatus: 'running',
|
|
1363
|
+
message: executeMessage,
|
|
1364
|
+
details: executeDetails,
|
|
1365
|
+
});
|
|
1366
|
+
notifier({
|
|
1367
|
+
eventType: 'calling_smart_contract',
|
|
1368
|
+
...updateResult,
|
|
1369
|
+
});
|
|
1370
|
+
|
|
1371
|
+
walletSigners
|
|
1372
|
+
.getSigner(TransactionType.STARKNET)
|
|
1373
|
+
.signAndSendTx(starknetTransaction, walletAddress, null)
|
|
1374
|
+
.then(
|
|
1375
|
+
(id) => {
|
|
1376
|
+
setStepTransactionIds(actions, id, 'smart_contract_called', notifier);
|
|
1377
|
+
schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
|
|
1378
|
+
next();
|
|
1379
|
+
onFinish();
|
|
1380
|
+
},
|
|
1381
|
+
(error) => {
|
|
1382
|
+
if (swap.status === 'failed') return;
|
|
1383
|
+
const { extraMessage, extraMessageDetail, extraMessageErrorCode } =
|
|
1384
|
+
prettifyErrorMessage(error);
|
|
1385
|
+
if (
|
|
1386
|
+
error &&
|
|
1387
|
+
error?.root &&
|
|
1388
|
+
error?.root?.message &&
|
|
1389
|
+
error?.root?.code &&
|
|
1390
|
+
error?.root?.reason
|
|
1391
|
+
) {
|
|
1392
|
+
logRPCError(
|
|
1393
|
+
error.root,
|
|
1394
|
+
swap,
|
|
1395
|
+
currentStep,
|
|
1396
|
+
sourceWallet?.walletType
|
|
1397
|
+
);
|
|
1398
|
+
}
|
|
1399
|
+
const updateResult = updateSwapStatus({
|
|
1400
|
+
getStorage,
|
|
1401
|
+
setStorage,
|
|
1402
|
+
nextStatus: 'failed',
|
|
1403
|
+
nextStepStatus: 'failed',
|
|
1404
|
+
message: extraMessage,
|
|
1405
|
+
details: extraMessageDetail,
|
|
1406
|
+
errorCode: extraMessageErrorCode,
|
|
1407
|
+
});
|
|
1408
|
+
notifier({
|
|
1409
|
+
eventType: 'smart_contract_call_failed',
|
|
1410
|
+
...updateResult,
|
|
1411
|
+
});
|
|
1412
|
+
|
|
1106
1413
|
failed();
|
|
1107
1414
|
onFinish();
|
|
1108
1415
|
}
|