@rango-dev/queue-manager-rango-preset 0.22.1-next.11 → 0.22.1-next.12
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/executeTransaction.d.ts.map +1 -1
- package/dist/actions/scheduleNextStep.d.ts +3 -2
- package/dist/actions/scheduleNextStep.d.ts.map +1 -1
- package/dist/helpers.d.ts +3 -3
- package/dist/helpers.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/dist/migration.d.ts.map +1 -1
- package/dist/services/eventEmitter.d.ts +1 -1
- package/dist/services/eventEmitter.d.ts.map +1 -1
- package/dist/shared-sentry.d.ts +2 -2
- package/dist/shared-sentry.d.ts.map +1 -1
- package/dist/shared.d.ts +3 -98
- package/dist/shared.d.ts.map +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/actions/executeTransaction.ts +3 -1
- package/src/actions/scheduleNextStep.ts +13 -10
- package/src/helpers.ts +10 -10
- package/src/index.ts +1 -7
- package/src/migration.ts +11 -11
- package/src/services/eventEmitter.ts +1 -1
- package/src/shared-sentry.ts +3 -2
- package/src/shared.ts +66 -166
- package/src/types.ts +3 -1
package/dist/migration.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../src/migration.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../src/migration.ts"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,iBAAS,QAAQ,IAAI,OAAO,CAE3B;AAYD;;;;;GAKG;AACH,iBAAe,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC,CAsF3C;AAED,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RemoveNameField, RouteExecutionEvents, StepEvent } from '../types';
|
|
2
|
-
import type { PendingSwap, PendingSwapStep } from 'rango-types
|
|
2
|
+
import type { PendingSwap, PendingSwapStep } from 'rango-types';
|
|
3
3
|
type NotifierParams = {
|
|
4
4
|
swap: PendingSwap;
|
|
5
5
|
step: PendingSwapStep | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eventEmitter.d.ts","sourceRoot":"","sources":["../../src/services/eventEmitter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EAGf,oBAAoB,EAEpB,SAAS,EACV,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"eventEmitter.d.ts","sourceRoot":"","sources":["../../src/services/eventEmitter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EAGf,oBAAoB,EAEpB,SAAS,EACV,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAoBhE,KAAK,cAAc,GAAG;IACpB,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,eAAe,GAAG,IAAI,CAAC;CAC9B,GAAG;IACF,KAAK,EAAE,eAAe,CAAC,SAAS,EAAE,SAAS,GAAG,iBAAiB,CAAC,CAAC;CAClE,CAAC;AA+GF,eAAO,MAAM,YAAY,8CAA+B,CAAC;AA2BzD,wBAAgB,QAAQ,CAAC,MAAM,EAAE,cAAc,QAsG9C"}
|
package/dist/shared-sentry.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { WalletType } from '@rango-dev/wallets-shared';
|
|
2
|
+
import type { PendingSwap, PendingSwapStep } from 'rango-types';
|
|
3
3
|
export declare function logRPCError(error: unknown, swap: PendingSwap, currentStep: PendingSwapStep | undefined, walletType: WalletType | undefined): void;
|
|
4
4
|
//# sourceMappingURL=shared-sentry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-sentry.d.ts","sourceRoot":"","sources":["../src/shared-sentry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shared-sentry.d.ts","sourceRoot":"","sources":["../src/shared-sentry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAIhE,wBAAgB,WAAW,CACzB,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,WAAW,EACjB,WAAW,EAAE,eAAe,GAAG,SAAS,EACxC,UAAU,EAAE,UAAU,GAAG,SAAS,GACjC,IAAI,CAcN"}
|
package/dist/shared.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Network, WalletType } from '@rango-dev/wallets-shared';
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
2
|
+
import type { BestRouteResponse, BlockchainMeta, MetaResponse, SwapResult, Token } from 'rango-sdk';
|
|
3
|
+
import type { PendingSwap, PendingSwapStep, SwapSavedSettings, WalletTypeAndAddress } from 'rango-types';
|
|
4
4
|
import BigNumber from 'bignumber.js';
|
|
5
5
|
export interface PendingSwapWithQueueID {
|
|
6
6
|
id: string;
|
|
@@ -34,77 +34,6 @@ export type Wallet = {
|
|
|
34
34
|
blockchains: Blockchain[];
|
|
35
35
|
};
|
|
36
36
|
export type EventType = 'swap_started' | 'confirm_contract' | 'confirm_transfer' | 'task_failed' | 'task_completed' | 'task_canceled' | 'task_paused' | 'contract_confirmed' | 'confirm_approve_contract' | 'contract_rejected' | 'check_tx_status' | 'check_approve_tx_status' | 'transfer_rejected' | 'transfer_failed' | 'calling_smart_contract' | 'smart_contract_called' | 'smart_contract_call_failed' | 'step_completed_with_output' | 'waiting_for_network_change' | 'waiting_for_connecting_wallet' | 'waiting_for_change_wallet_account' | 'network_changed' | 'not_enough_balance' | 'not_enough_approval' | 'waiting_for_queue' | 'check_fee_failed' | 'route_failed_to_find' | 'transaction_expired';
|
|
37
|
-
export type SwapSavedSettings = {
|
|
38
|
-
slippage: string;
|
|
39
|
-
disabledSwappersIds?: string[];
|
|
40
|
-
disabledSwappersGroups?: string[];
|
|
41
|
-
infiniteApprove?: boolean;
|
|
42
|
-
};
|
|
43
|
-
type InternalStepState = 'PENDING' | 'CREATED' | 'WAITING' | 'SIGNED' | 'SUCCESSED' | 'FAILED';
|
|
44
|
-
export type SwapperStatusStep = {
|
|
45
|
-
name: string;
|
|
46
|
-
state: InternalStepState;
|
|
47
|
-
current: boolean;
|
|
48
|
-
};
|
|
49
|
-
export declare enum PendingSwapNetworkStatus {
|
|
50
|
-
WaitingForConnectingWallet = "waitingForConnectingWallet",
|
|
51
|
-
WaitingForQueue = "waitingForQueue",
|
|
52
|
-
WaitingForNetworkChange = "waitingForNetworkChange",
|
|
53
|
-
NetworkChanged = "networkChanged"
|
|
54
|
-
}
|
|
55
|
-
export type SwapExplorerUrl = {
|
|
56
|
-
url: string;
|
|
57
|
-
description: string | null;
|
|
58
|
-
};
|
|
59
|
-
export type StepStatus = 'created' | 'running' | 'failed' | 'success' | 'waitingForApproval' | 'approved';
|
|
60
|
-
export type PendingSwapStep = {
|
|
61
|
-
id: number;
|
|
62
|
-
fromBlockchain: string;
|
|
63
|
-
fromSymbol: string;
|
|
64
|
-
fromSymbolAddress: string | null;
|
|
65
|
-
fromDecimals: number;
|
|
66
|
-
fromAmountPrecision: string | null;
|
|
67
|
-
fromAmountMinValue: string | null;
|
|
68
|
-
fromAmountMaxValue: string | null;
|
|
69
|
-
fromAmountRestrictionType: AmountRestrictionType | null;
|
|
70
|
-
fromLogo: string;
|
|
71
|
-
toBlockchain: string;
|
|
72
|
-
toSymbol: string;
|
|
73
|
-
toSymbolAddress: string | null;
|
|
74
|
-
toDecimals: number;
|
|
75
|
-
toLogo: string;
|
|
76
|
-
swapperId: string;
|
|
77
|
-
expectedOutputAmountHumanReadable: string | null;
|
|
78
|
-
startTransactionTime: number;
|
|
79
|
-
internalSteps: SwapperStatusStep[] | null;
|
|
80
|
-
estimatedTimeInSeconds: number | null;
|
|
81
|
-
status: StepStatus;
|
|
82
|
-
networkStatus: PendingSwapNetworkStatus | null;
|
|
83
|
-
executedTransactionId: string | null;
|
|
84
|
-
executedTransactionTime: string | null;
|
|
85
|
-
explorerUrl: SwapExplorerUrl[] | null;
|
|
86
|
-
diagnosisUrl: string | null;
|
|
87
|
-
outputAmount: string | null;
|
|
88
|
-
cosmosTransaction: CosmosTransaction | null;
|
|
89
|
-
transferTransaction: TransferTransaction | null;
|
|
90
|
-
solanaTransaction: SolanaTransaction | null;
|
|
91
|
-
evmApprovalTransaction: EvmTransaction | null;
|
|
92
|
-
evmTransaction: EvmTransaction | null;
|
|
93
|
-
tronApprovalTransaction: TronTransaction | null;
|
|
94
|
-
tronTransaction: TronTransaction | null;
|
|
95
|
-
starknetApprovalTransaction: StarknetTransaction | null;
|
|
96
|
-
starknetTransaction: StarknetTransaction | null;
|
|
97
|
-
tonTransaction: TonTransaction | null;
|
|
98
|
-
swapperLogo: string | null;
|
|
99
|
-
swapperType: string | null;
|
|
100
|
-
fromBlockchainLogo: string | null;
|
|
101
|
-
toBlockchainLogo: string | null;
|
|
102
|
-
feeInUsd: string | null;
|
|
103
|
-
};
|
|
104
|
-
export type WalletTypeAndAddress = {
|
|
105
|
-
walletType: WalletType;
|
|
106
|
-
address: string;
|
|
107
|
-
};
|
|
108
37
|
export declare enum MessageSeverity {
|
|
109
38
|
error = "error",
|
|
110
39
|
warning = "warning",
|
|
@@ -112,29 +41,6 @@ export declare enum MessageSeverity {
|
|
|
112
41
|
success = "success"
|
|
113
42
|
}
|
|
114
43
|
export type SwapStatus = 'running' | 'failed' | 'success';
|
|
115
|
-
export type PendingSwap = {
|
|
116
|
-
creationTime: string;
|
|
117
|
-
finishTime: string | null;
|
|
118
|
-
requestId: string;
|
|
119
|
-
inputAmount: string;
|
|
120
|
-
status: SwapStatus;
|
|
121
|
-
isPaused: boolean;
|
|
122
|
-
extraMessage: string | null;
|
|
123
|
-
extraMessageSeverity: MessageSeverity | null;
|
|
124
|
-
extraMessageErrorCode: string | null;
|
|
125
|
-
extraMessageDetail: string | null | undefined;
|
|
126
|
-
networkStatusExtraMessage: string | null;
|
|
127
|
-
networkStatusExtraMessageDetail: string | null;
|
|
128
|
-
lastNotificationTime: string | null;
|
|
129
|
-
wallets: {
|
|
130
|
-
[p: string]: WalletTypeAndAddress;
|
|
131
|
-
};
|
|
132
|
-
settings: SwapSavedSettings;
|
|
133
|
-
steps: PendingSwapStep[];
|
|
134
|
-
simulationResult: SimulationResult;
|
|
135
|
-
validateBalanceOrFee: boolean;
|
|
136
|
-
hasAlreadyProceededToSign?: boolean | null;
|
|
137
|
-
};
|
|
138
44
|
export declare const getCurrentBlockchainOfOrNull: (swap: PendingSwap, step: PendingSwapStep) => Network | null;
|
|
139
45
|
export declare const getCurrentBlockchainOf: (swap: PendingSwap, step: PendingSwapStep) => Network;
|
|
140
46
|
export declare const getScannerUrl: (txHash: string, network: Network, blockchainMetaMap: {
|
|
@@ -146,11 +52,10 @@ export declare function getNextStep(swap: PendingSwap, currentStep: PendingSwapS
|
|
|
146
52
|
*/
|
|
147
53
|
export declare const getCurrentAddressOf: (swap: PendingSwap, step: PendingSwapStep) => string;
|
|
148
54
|
export declare function getRelatedWallet(swap: PendingSwap, currentStep: PendingSwapStep): WalletTypeAndAddress;
|
|
149
|
-
export declare function getRelatedWalletOrNull(swap: PendingSwap, currentStep: PendingSwapStep): WalletTypeAndAddress | null;
|
|
55
|
+
export declare function getRelatedWalletOrNull(swap: PendingSwap, currentStep: PendingSwapStep | null): WalletTypeAndAddress | null;
|
|
150
56
|
export declare const getUsdPrice: (blockchain: string, symbol: string, address: string | null, allTokens: Token[]) => number | null;
|
|
151
57
|
export declare function getUsdFeeOfStep(step: SwapResult, allTokens: Token[]): BigNumber;
|
|
152
58
|
export declare function calculatePendingSwap(inputAmount: string, bestRoute: BestRouteResponse, wallets: {
|
|
153
59
|
[p: string]: WalletTypeAndAddress;
|
|
154
60
|
}, settings: SwapSavedSettings, validateBalanceOrFee: boolean, meta: Pick<MetaResponse, 'blockchains' | 'tokens'> | null): PendingSwap;
|
|
155
|
-
export {};
|
|
156
61
|
//# 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,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,UAAU,EACV,KAAK,EACN,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EACV,WAAW,EACX,eAAe,EACf,iBAAiB,EAEjB,oBAAoB,EACrB,MAAM,aAAa,CAAC;AAErB,OAAO,SAAS,MAAM,cAAc,CAAC;AAWrC,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,WAAW,CAAC;CACnB;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf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Z,CAAC;AAEF,eAAO,MAAM,sBAAsB,SAC3B,WAAW,QACX,eAAe,KACpB,OA6BF,CAAC;AAiBF,eAAO,MAAM,aAAa,WAChB,MAAM,WACL,OAAO;;MAEf,MAAM,GAAG,SAUX,CAAC;AAEF,wBAAgB,WAAW,CACzB,IAAI,EAAE,WAAW,EACjB,WAAW,EAAE,eAAe,GAC3B,eAAe,GAAG,IAAI,CASxB;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB,SACxB,WAAW,QACX,eAAe,KACpB,MAmBF,CAAC;AAEF,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,WAAW,EACjB,WAAW,EAAE,eAAe,GAC3B,oBAAoB,CAgBtB;AAED,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,WAAW,EACjB,WAAW,EAAE,eAAe,GAAG,IAAI,GAClC,oBAAoB,GAAG,IAAI,CAS7B;AAED,eAAO,MAAM,WAAW,eACV,MAAM,UACV,MAAM,WACL,MAAM,GAAG,IAAI,aACX,KAAK,EAAE,KACjB,MAAM,GAAG,IAQX,CAAC;AAEF,wBAAgB,eAAe,CAC7B,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE,KAAK,EAAE,GACjB,SAAS,CAoBX;AA6CD,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,iBAAiB,EAC5B,OAAO,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,oBAAoB,CAAA;CAAE,EAC9C,QAAQ,EAAE,iBAAiB,EAC3B,oBAAoB,EAAE,OAAO,EAC7B,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE,aAAa,GAAG,QAAQ,CAAC,GAAG,IAAI,GACxD,WAAW,CAuEb"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Wallet } from './shared';
|
|
2
2
|
import type { QueueContext, QueueDef, QueueStorage } from '@rango-dev/queue-manager-core';
|
|
3
3
|
import type { ConnectResult } from '@rango-dev/wallets-core';
|
|
4
4
|
import type { Meta, Network, Providers, WalletState, WalletType } from '@rango-dev/wallets-shared';
|
|
5
5
|
import type { Transaction } from 'rango-sdk';
|
|
6
|
-
import type { APIErrorCode, EvmBlockchainMeta, SignerFactory } from 'rango-types';
|
|
6
|
+
import type { APIErrorCode, EvmBlockchainMeta, PendingSwap, PendingSwapStep, SignerFactory } from 'rango-types';
|
|
7
7
|
export type RemoveNameField<T, U extends string> = {
|
|
8
8
|
[Property in keyof T as Exclude<Property, U>]: T[Property];
|
|
9
9
|
};
|
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,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EACV,YAAY,EACZ,QAAQ,EACR,YAAY,EACb,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EACV,IAAI,EACJ,OAAO,EACP,SAAS,EACT,WAAW,EACX,UAAU,EACX,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,WAAW,EACX,eAAe,EACf,aAAa,EACd,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,eAAe,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,IAAI;KAChD,QAAQ,IAAI,MAAM,CAAC,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC;CAC3D,CAAC;AAEF,MAAM,MAAM,YAAY,C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Aa,CAAC,oBAAoB,EAClC,uBAAuB,CACxB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;AAErE,MAAM,MAAM,4BAA4B,GACtC,KAAK,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC;AAE7C,MAAM,MAAM,uBAAuB,GAAG,KAAK,CACzC,aAAa,CAAC,eAAe,EAC7B,0BAA0B,CAC3B,CAAC;AAEF,MAAM,MAAM,SAAS,GACjB,gBAAgB,GAChB,kBAAkB,GAClB,eAAe,GACf,2BAA2B,GAC3B,2BAA2B,GAC3B,oBAAoB,GACpB,4BAA4B,GAC5B,uBAAuB,CAAC;AAE5B,MAAM,MAAM,UAAU,GAClB,iBAAiB,GACjB,mBAAmB,GACnB,gBAAgB,CAAC;AAErB,MAAM,MAAM,oBAAoB,GAAG;IACjC,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE;QAAE,KAAK,EAAE,KAAK,CAAC;QAAC,KAAK,EAAE,UAAU,CAAA;KAAE,CAAC;IAC7D,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;QAAE,KAAK,EAAE,KAAK,CAAC;QAAC,IAAI,EAAE,IAAI,CAAC;QAAC,KAAK,EAAE,SAAS,CAAA;KAAE,CAAC;CACxE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/queue-manager-rango-preset",
|
|
3
|
-
"version": "0.22.1-next.
|
|
3
|
+
"version": "0.22.1-next.12",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@sentry/browser": "^6.12.0",
|
|
39
39
|
"mitt": "^3.0.0",
|
|
40
|
-
"rango-types": "^0.1.
|
|
40
|
+
"rango-types": "^0.1.57",
|
|
41
41
|
"uuid": "^9.0.0"
|
|
42
42
|
},
|
|
43
43
|
"publishConfig": {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { SwapActionTypes, SwapQueueContext, SwapStorage } from '../types';
|
|
2
2
|
import type { ExecuterActions } from '@rango-dev/queue-manager-core';
|
|
3
3
|
|
|
4
|
+
import { PendingSwapNetworkStatus } from 'rango-types';
|
|
5
|
+
|
|
4
6
|
import {
|
|
5
7
|
ERROR_MESSAGE_DEPENDS_ON_OTHER_QUEUES,
|
|
6
8
|
ERROR_MESSAGE_WAIT_FOR_CHANGE_NETWORK,
|
|
@@ -18,7 +20,7 @@ import {
|
|
|
18
20
|
signTransaction,
|
|
19
21
|
updateNetworkStatus,
|
|
20
22
|
} from '../helpers';
|
|
21
|
-
import { getCurrentBlockchainOf
|
|
23
|
+
import { getCurrentBlockchainOf } from '../shared';
|
|
22
24
|
import { BlockReason } from '../types';
|
|
23
25
|
|
|
24
26
|
/**
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
SwapQueueContext,
|
|
6
|
-
SwapStorage,
|
|
7
|
-
} from '../types';
|
|
1
|
+
import type { SwapQueueContext, SwapStorage } from '../types';
|
|
2
|
+
import type { ExecuterActions } from '@rango-dev/queue-manager-core';
|
|
3
|
+
import type { PendingSwapStep } from 'rango-types';
|
|
4
|
+
|
|
8
5
|
import {
|
|
9
6
|
getCurrentStep,
|
|
10
7
|
getLastSuccessfulStep,
|
|
11
8
|
isTxAlreadyCreated,
|
|
12
9
|
} from '../helpers';
|
|
13
10
|
import { notifier } from '../services/eventEmitter';
|
|
11
|
+
import { StepEventType, SwapActionTypes } from '../types';
|
|
14
12
|
|
|
15
13
|
/**
|
|
16
14
|
*
|
|
@@ -30,7 +28,9 @@ export function scheduleNextStep({
|
|
|
30
28
|
}: ExecuterActions<SwapStorage, SwapActionTypes, SwapQueueContext>): void {
|
|
31
29
|
const swap = getStorage().swapDetails;
|
|
32
30
|
const currentStep = getCurrentStep(swap);
|
|
33
|
-
const isFailed = swap.steps.find(
|
|
31
|
+
const isFailed = swap.steps.find(
|
|
32
|
+
(step: PendingSwapStep) => step.status === 'failed'
|
|
33
|
+
);
|
|
34
34
|
|
|
35
35
|
if (!!currentStep && !isFailed) {
|
|
36
36
|
if (isTxAlreadyCreated(swap, currentStep)) {
|
|
@@ -84,7 +84,10 @@ export function scheduleNextStep({
|
|
|
84
84
|
step: null,
|
|
85
85
|
});
|
|
86
86
|
|
|
87
|
-
if (isFailed)
|
|
88
|
-
|
|
87
|
+
if (isFailed) {
|
|
88
|
+
failed();
|
|
89
|
+
} else {
|
|
90
|
+
next();
|
|
91
|
+
}
|
|
89
92
|
}
|
|
90
93
|
}
|
package/src/helpers.ts
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
/* eslint-disable destructuring/in-params */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
3
3
|
/* eslint-disable @typescript-eslint/no-floating-promises */
|
|
4
|
-
import type {
|
|
5
|
-
PendingSwap,
|
|
6
|
-
PendingSwapStep,
|
|
7
|
-
StepStatus,
|
|
8
|
-
SwapStatus,
|
|
9
|
-
Wallet,
|
|
10
|
-
} from './shared';
|
|
4
|
+
import type { SwapStatus, Wallet } from './shared';
|
|
11
5
|
import type {
|
|
12
6
|
ArrayElement,
|
|
13
7
|
Step,
|
|
@@ -34,7 +28,13 @@ import type {
|
|
|
34
28
|
EvmBlockchainMeta,
|
|
35
29
|
Transaction,
|
|
36
30
|
} from 'rango-sdk';
|
|
37
|
-
import type {
|
|
31
|
+
import type {
|
|
32
|
+
APIErrorCode,
|
|
33
|
+
PendingSwap,
|
|
34
|
+
PendingSwapStep,
|
|
35
|
+
SignerErrorCode,
|
|
36
|
+
StepStatus,
|
|
37
|
+
} from 'rango-types';
|
|
38
38
|
|
|
39
39
|
import { Status } from '@rango-dev/queue-manager-core';
|
|
40
40
|
import { readAccountAddress } from '@rango-dev/wallets-core';
|
|
@@ -44,6 +44,7 @@ import {
|
|
|
44
44
|
splitWalletNetwork,
|
|
45
45
|
} from '@rango-dev/wallets-shared';
|
|
46
46
|
import { TransactionType } from 'rango-sdk';
|
|
47
|
+
import { PendingSwapNetworkStatus } from 'rango-types';
|
|
47
48
|
|
|
48
49
|
import {
|
|
49
50
|
DEFAULT_ERROR_CODE,
|
|
@@ -61,7 +62,6 @@ import {
|
|
|
61
62
|
getRelatedWalletOrNull,
|
|
62
63
|
getScannerUrl,
|
|
63
64
|
MessageSeverity,
|
|
64
|
-
PendingSwapNetworkStatus,
|
|
65
65
|
} from './shared';
|
|
66
66
|
import {
|
|
67
67
|
mapAppErrorCodesToAPIErrorCode,
|
|
@@ -342,7 +342,7 @@ export function updateSwapStatus({
|
|
|
342
342
|
details && details.includes('Warning')
|
|
343
343
|
? 'Swap canceled by user.'
|
|
344
344
|
: details;
|
|
345
|
-
const walletType = getRelatedWalletOrNull(swap, currentStep
|
|
345
|
+
const walletType = getRelatedWalletOrNull(swap, currentStep)?.walletType;
|
|
346
346
|
swap.extraMessageSeverity = MessageSeverity.error;
|
|
347
347
|
|
|
348
348
|
const failureType = mapAppErrorCodesToAPIErrorCode(errorCode);
|
package/src/index.ts
CHANGED
|
@@ -33,18 +33,12 @@ export {
|
|
|
33
33
|
StepExecutionEventStatus,
|
|
34
34
|
StepExecutionBlockedEventStatus,
|
|
35
35
|
} from './types';
|
|
36
|
-
export type {
|
|
37
|
-
PendingSwapWithQueueID,
|
|
38
|
-
PendingSwapStep,
|
|
39
|
-
PendingSwap,
|
|
40
|
-
EventType,
|
|
41
|
-
} from './shared';
|
|
36
|
+
export type { PendingSwapWithQueueID, EventType } from './shared';
|
|
42
37
|
export {
|
|
43
38
|
getCurrentBlockchainOfOrNull,
|
|
44
39
|
getRelatedWalletOrNull,
|
|
45
40
|
getRelatedWallet,
|
|
46
41
|
MessageSeverity,
|
|
47
|
-
PendingSwapNetworkStatus,
|
|
48
42
|
calculatePendingSwap,
|
|
49
43
|
} from './shared';
|
|
50
44
|
export {
|
package/src/migration.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
DB_NAME,
|
|
6
|
-
} from '@rango-dev/queue-manager-core';
|
|
1
|
+
import type { PersistedQueue } from '@rango-dev/queue-manager-core';
|
|
2
|
+
import type { PendingSwap } from 'rango-types';
|
|
3
|
+
|
|
4
|
+
import { DB_NAME, Persistor, Status } from '@rango-dev/queue-manager-core';
|
|
7
5
|
import { v4 as uuid } from 'uuid';
|
|
8
|
-
|
|
6
|
+
|
|
9
7
|
import { SwapActionTypes } from './types';
|
|
10
8
|
|
|
11
9
|
const MIGRATED_KEY = 'migratedToQueueManager';
|
|
@@ -49,9 +47,9 @@ async function migration(): Promise<boolean> {
|
|
|
49
47
|
const convertedSwaps: PersistedQueue[] = [];
|
|
50
48
|
|
|
51
49
|
swaps.forEach((swap) => {
|
|
52
|
-
/*
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
/*
|
|
51
|
+
*For running task we need to add some more work
|
|
52
|
+
*We need to create a queue task to be run and resume the running task from queue manager.
|
|
55
53
|
*/
|
|
56
54
|
if (swap.status === 'running') {
|
|
57
55
|
const taskId = uuid();
|
|
@@ -112,7 +110,9 @@ async function migration(): Promise<boolean> {
|
|
|
112
110
|
// Getting an instance from persistor, so we can directly put our data inside it.
|
|
113
111
|
const persistor = new Persistor();
|
|
114
112
|
|
|
115
|
-
const promises = convertedSwaps.map((queue) =>
|
|
113
|
+
const promises = convertedSwaps.map(async (queue) =>
|
|
114
|
+
persistor.insertQueue(queue)
|
|
115
|
+
);
|
|
116
116
|
await Promise.all(promises);
|
|
117
117
|
|
|
118
118
|
// Mark as the data has been successfully migrated.
|
package/src/shared-sentry.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { WalletType } from '@rango-dev/wallets-shared';
|
|
2
|
+
import type { PendingSwap, PendingSwapStep } from 'rango-types';
|
|
3
|
+
|
|
1
4
|
import * as Sentry from '@sentry/browser';
|
|
2
|
-
import { PendingSwap, PendingSwapStep } from './shared';
|
|
3
|
-
import { WalletType } from '@rango-dev/wallets-shared';
|
|
4
5
|
|
|
5
6
|
export function logRPCError(
|
|
6
7
|
error: unknown,
|