@rango-dev/queue-manager-rango-preset 0.1.11-next.3 → 0.1.11-next.6
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/configs.d.ts +7 -0
- package/dist/configs.d.ts.map +1 -0
- package/dist/constants.d.ts +0 -2
- package/dist/constants.d.ts.map +1 -1
- package/dist/helpers.d.ts.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/queue-manager-rango-preset.cjs.development.js +61 -42
- 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 +61 -42
- package/dist/queue-manager-rango-preset.esm.js.map +1 -1
- package/dist/services/httpService.d.ts +1 -1
- package/dist/services/httpService.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/actions/checkStatus.ts +2 -2
- package/src/actions/createTransaction.ts +1 -1
- package/src/configs.ts +27 -0
- package/src/constants.ts +0 -3
- package/src/helpers.ts +5 -4
- package/src/index.ts +9 -1
- package/src/services/httpService.ts +7 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpService.d.ts","sourceRoot":"","sources":["../src/services/httpService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"httpService.d.ts","sourceRoot":"","sources":["../src/services/httpService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAKxC,eAAO,MAAM,WAAW,mBAIvB,CAAC"}
|
package/package.json
CHANGED
|
@@ -42,7 +42,7 @@ async function checkTransactionStatus({
|
|
|
42
42
|
let status: TransactionStatusResponse | null = null;
|
|
43
43
|
try {
|
|
44
44
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
45
|
-
status = await httpService.checkStatus({
|
|
45
|
+
status = await httpService().checkStatus({
|
|
46
46
|
requestId: swap.requestId,
|
|
47
47
|
txId: txId!,
|
|
48
48
|
step: currentStep.id,
|
|
@@ -177,7 +177,7 @@ async function checkApprovalStatus({
|
|
|
177
177
|
const currentStep = getCurrentStep(swap)!;
|
|
178
178
|
let isApproved = false;
|
|
179
179
|
try {
|
|
180
|
-
const response = await httpService.checkApproval(
|
|
180
|
+
const response = await httpService().checkApproval(
|
|
181
181
|
swap.requestId,
|
|
182
182
|
currentStep.executedTransactionId || ''
|
|
183
183
|
);
|
package/src/configs.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface Configs {
|
|
2
|
+
API_KEY: string;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
// this API key is limited and
|
|
6
|
+
// it is only for test purpose
|
|
7
|
+
|
|
8
|
+
const RANGO_PUBLIC_API_KEY = 'c6381a79-2817-4602-83bf-6a641a409e32';
|
|
9
|
+
|
|
10
|
+
let configs: Configs = {
|
|
11
|
+
API_KEY: RANGO_PUBLIC_API_KEY,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export function getConfig(name: keyof Configs) {
|
|
15
|
+
return configs[name];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function setConfig(name: keyof Configs, value: any) {
|
|
19
|
+
configs[name] = value;
|
|
20
|
+
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function initConfig(nextConfigs: Configs) {
|
|
25
|
+
configs = structuredClone(nextConfigs);
|
|
26
|
+
return configs;
|
|
27
|
+
}
|
package/src/constants.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
export const RANGO_DAPP_API_KEY = process.env.REACT_APP_API_KEY;
|
|
2
|
-
export const RANGO_DAPP_API_BASE_URL = process.env.REACT_APP_API_BASE_URL;
|
|
3
|
-
|
|
4
1
|
export const ERROR_MESSAGE_DEPENDS_ON_OTHER_QUEUES =
|
|
5
2
|
'Waiting for other swaps to complete';
|
|
6
3
|
export const ERROR_MESSAGE_WAIT_FOR_WALLET = 'Waiting for connecting wallet';
|
package/src/helpers.ts
CHANGED
|
@@ -186,7 +186,8 @@ export function updateSwapStatus({
|
|
|
186
186
|
: details;
|
|
187
187
|
const walletType = getRelatedWalletOrNull(swap, currentStep!)?.walletType;
|
|
188
188
|
swap.extraMessageSeverity = MessageSeverity.error;
|
|
189
|
-
|
|
189
|
+
|
|
190
|
+
httpService()
|
|
190
191
|
.reportFailure({
|
|
191
192
|
requestId: swap.requestId,
|
|
192
193
|
step: currentStep?.id || 1,
|
|
@@ -846,7 +847,7 @@ export function singTransaction(
|
|
|
846
847
|
);
|
|
847
848
|
|
|
848
849
|
// Update swap status
|
|
849
|
-
const message = `
|
|
850
|
+
const message = `Waiting for approval of ${currentStep?.fromSymbol} coin ${
|
|
850
851
|
sourceWallet.walletType === WalletType.WALLET_CONNECT
|
|
851
852
|
? 'on your mobile phone'
|
|
852
853
|
: ''
|
|
@@ -928,7 +929,7 @@ export function singTransaction(
|
|
|
928
929
|
return;
|
|
929
930
|
} else if (!!tronApprovalTransaction) {
|
|
930
931
|
// Update swap status
|
|
931
|
-
const message = `
|
|
932
|
+
const message = `Waiting for approval of ${currentStep?.fromSymbol} coin ${
|
|
932
933
|
sourceWallet.walletType === WalletType.WALLET_CONNECT
|
|
933
934
|
? 'on your mobile phone'
|
|
934
935
|
: ''
|
|
@@ -1006,7 +1007,7 @@ export function singTransaction(
|
|
|
1006
1007
|
return;
|
|
1007
1008
|
} else if (!!starknetApprovalTransaction) {
|
|
1008
1009
|
// Update swap status
|
|
1009
|
-
const message = `
|
|
1010
|
+
const message = `Waiting for approval of ${currentStep?.fromSymbol} coin ${
|
|
1010
1011
|
sourceWallet.walletType === WalletType.WALLET_CONNECT
|
|
1011
1012
|
? 'on your mobile phone'
|
|
1012
1013
|
: ''
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { Configs, initConfig } from './configs';
|
|
2
|
+
import { SwapQueueDef } from './types';
|
|
3
|
+
import { swapQueueDef } from './queueDef';
|
|
4
|
+
|
|
1
5
|
export { PrettyError, prettifyErrorMessage } from './shared-errors';
|
|
2
6
|
export { SwapQueueContext, SwapStorage } from './types';
|
|
3
7
|
export {
|
|
@@ -24,5 +28,9 @@ export {
|
|
|
24
28
|
splitWalletNetwork,
|
|
25
29
|
resetRunningSwapNotifsOnPageLoad,
|
|
26
30
|
} from './helpers';
|
|
27
|
-
export { swapQueueDef } from './queueDef';
|
|
28
31
|
export { useMigration, useQueueManager } from './hooks';
|
|
32
|
+
|
|
33
|
+
export function makeQueueDefinition(configs: Configs): SwapQueueDef {
|
|
34
|
+
initConfig(configs);
|
|
35
|
+
return swapQueueDef;
|
|
36
|
+
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { RangoClient } from 'rango-sdk';
|
|
2
|
-
import {
|
|
2
|
+
import { getConfig } from '../configs';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
// it is only for test purpose
|
|
6
|
-
const RANGO_PUBLIC_API_KEY = 'c6381a79-2817-4602-83bf-6a641a409e32';
|
|
4
|
+
let rango: RangoClient | undefined = undefined;
|
|
7
5
|
|
|
8
|
-
export const httpService =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
export const httpService = () => {
|
|
7
|
+
if (rango) return rango;
|
|
8
|
+
rango = new RangoClient(getConfig('API_KEY'));
|
|
9
|
+
return rango;
|
|
10
|
+
};
|