@rango-dev/queue-manager-rango-preset 0.1.10-next.77 → 0.1.10-next.80
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 +2 -2
- 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 +350 -294
- 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 +345 -286
- 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 +11 -16
- package/dist/shared.d.ts.map +1 -1
- package/dist/types.d.ts +3 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -2
- package/src/actions/checkStatus.ts +14 -12
- package/src/actions/createTransaction.ts +21 -3
- package/src/constants.ts +1 -3
- package/src/helpers.ts +530 -192
- 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-sentry.ts +1 -1
- package/src/shared.ts +62 -35
- package/src/types.ts +2 -3
- package/dist/shared-api.d.ts +0 -10
- package/dist/shared-api.d.ts.map +0 -1
- package/src/shared-api.ts +0 -175
|
@@ -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,mBA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AM,CAAC,aAAa,CAClB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GAAG,MAAM,GAC1B,WAAW;IASd,MAAM,CAAC,iBAAiB,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
|
-
import { Network,
|
|
2
|
-
import { CosmosTransaction, EvmBlockchainMeta, EvmTransaction, SimulationResult, SolanaTransaction, StarknetTransaction, TronTransaction } from 'rango-sdk';
|
|
3
|
-
import { BigNumber } from 'bignumber.js';
|
|
1
|
+
import { Network, WalletType } from '@rango-dev/wallets-shared';
|
|
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,
|
|
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/dist/types.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { QueueStorage, QueueDef } from '@rango-dev/queue-manager-core';
|
|
2
2
|
import { QueueContext } from '@rango-dev/queue-manager-core/dist/queue';
|
|
3
3
|
import { ConnectResult, Providers } from '@rango-dev/wallets-core';
|
|
4
|
-
import {
|
|
4
|
+
import { Meta, Network, WalletState, WalletType } from '@rango-dev/wallets-shared';
|
|
5
5
|
import { PendingSwap, SwapProgressNotification, Wallet } from './shared';
|
|
6
|
+
import { EvmBlockchainMeta, SignerFactory } from 'rango-types';
|
|
6
7
|
export declare type SwapQueueDef = QueueDef<SwapStorage, SwapActionTypes, SwapQueueContext>;
|
|
7
8
|
export interface SwapStorage extends QueueStorage {
|
|
8
9
|
swapDetails: PendingSwap;
|
|
@@ -29,7 +30,7 @@ export interface SwapQueueContext extends QueueContext {
|
|
|
29
30
|
meta: Meta;
|
|
30
31
|
wallets: Wallet | null;
|
|
31
32
|
providers: Providers;
|
|
32
|
-
getSigners: (type: WalletType) =>
|
|
33
|
+
getSigners: (type: WalletType) => SignerFactory;
|
|
33
34
|
switchNetwork: (wallet: WalletType, network: Network) => Promise<ConnectResult> | undefined;
|
|
34
35
|
connect: (wallet: WalletType, network: Network) => Promise<ConnectResult> | undefined;
|
|
35
36
|
state: (type: WalletType) => WalletState;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EACL,IAAI,EACJ,OAAO,EACP,WAAW,EACX,UAAU,EACX,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE/D,oBAAY,YAAY,GAAG,QAAQ,CACjC,WAAW,EACX,eAAe,E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,qBAAqB;IACpC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,kBAAkB,EAAE,UAAU,GAAG,SAAS,CAAC;IAC3C,uBAAuB,EAAE,MAAM,IAAI,CAAC;IACpC,SAAS,EAAE,iBAAiB,EAAE,CAAC;CAChC"}
|
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.80",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"module": "dist/queue-manager-rango-preset.esm.js",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
13
|
"dev": "tsdx watch",
|
|
14
|
-
"build": "tsdx build",
|
|
14
|
+
"build": "tsdx build --tsconfig ./tsconfig.json",
|
|
15
15
|
"test": "tsdx test",
|
|
16
16
|
"lint": "tsdx lint",
|
|
17
17
|
"size": "size-limit",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"@rango-dev/wallets-shared": "*",
|
|
24
24
|
"@sentry/browser": "*",
|
|
25
25
|
"bignumber.js": "*",
|
|
26
|
+
"rango-types": "*",
|
|
26
27
|
"uuid": "*"
|
|
27
28
|
},
|
|
28
29
|
"husky": {
|
|
@@ -50,6 +51,7 @@
|
|
|
50
51
|
"@types/uuid": "^8.3.4"
|
|
51
52
|
},
|
|
52
53
|
"dependencies": {
|
|
54
|
+
"@sentry/browser": "^6.12.0",
|
|
53
55
|
"rango-sdk": "^0.1.17",
|
|
54
56
|
"uuid": "^9.0.0"
|
|
55
57
|
},
|
|
@@ -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';
|
|
@@ -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';
|