@rango-dev/queue-manager-rango-preset 0.1.11-next.2 → 0.1.11-next.4
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 +58 -36
- 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 +58 -36
- 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 +26 -0
- package/src/constants.ts +0 -3
- package/src/helpers.ts +2 -1
- package/src/index.ts +9 -1
- package/src/services/httpService.ts +8 -5
|
@@ -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,26 @@
|
|
|
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
|
+
const RANGO_PUBLIC_API_KEY = 'c6381a79-2817-4602-83bf-6a641a409e32';
|
|
8
|
+
|
|
9
|
+
let configs: Configs = {
|
|
10
|
+
API_KEY: RANGO_PUBLIC_API_KEY,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export function getConfig(name: keyof Configs) {
|
|
14
|
+
return configs[name];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function setConfig(name: keyof Configs, value: any) {
|
|
18
|
+
configs[name] = value;
|
|
19
|
+
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function initConfig(nextConfigs: Configs) {
|
|
24
|
+
configs = structuredClone(nextConfigs);
|
|
25
|
+
return configs;
|
|
26
|
+
}
|
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,
|
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,7 +1,10 @@
|
|
|
1
1
|
import { RangoClient } from 'rango-sdk';
|
|
2
|
-
import {
|
|
2
|
+
import { getConfig } from '../configs';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
);
|
|
4
|
+
let rango: RangoClient | undefined = undefined;
|
|
5
|
+
|
|
6
|
+
export const httpService = () => {
|
|
7
|
+
if (rango) return rango;
|
|
8
|
+
rango = new RangoClient(getConfig('API_KEY'));
|
|
9
|
+
return rango;
|
|
10
|
+
};
|