@rango-dev/queue-manager-rango-preset 0.1.10-next.77 → 0.1.10-next.78
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/helpers.d.ts +2 -2
- package/dist/helpers.d.ts.map +1 -1
- package/dist/queue-manager-rango-preset.cjs.development.js +18 -15
- 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 +13 -10
- package/dist/queue-manager-rango-preset.esm.js.map +1 -1
- package/dist/shared-api.d.ts.map +1 -1
- package/dist/shared.d.ts +2 -2
- 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 -3
- package/src/helpers.ts +213 -182
- package/src/shared-api.ts +10 -13
- package/src/shared-sentry.ts +1 -1
- package/src/shared.ts +5 -8
- package/src/types.ts +2 -3
package/dist/shared-api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-api.d.ts","sourceRoot":"","sources":["src/shared-api.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"shared-api.d.ts","sourceRoot":"","sources":["src/shared-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAe,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAC9D,OAAO,EACL,qBAAqB,EAErB,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,YAAY,EAIb,MAAM,iBAAiB,CAAC;AASzB,wBAAsB,eAAe,CACnC,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CA4BvC;AAED,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,yBAAyB,CAAC,CAoCpC;AAED,wBAAsB,aAAa,CACjC,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,qBAAqB,CAAC,CAmBhC;AAMD,wBAAgB,8BAA8B,CAC5C,SAAS,EAAE,MAAM,GAAG,IAAI,GACvB,YAAY,CAoBd;AAED,wBAAsB,YAAY,CAChC,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,YAAY,EACvB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,GAAG,IAAI,GAC5B,OAAO,CAAC,IAAI,CAAC,CAkBf"}
|
package/dist/shared.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Network,
|
|
2
|
-
import { CosmosTransaction, EvmBlockchainMeta, EvmTransaction, SimulationResult, SolanaTransaction, StarknetTransaction, TronTransaction } from 'rango-sdk';
|
|
1
|
+
import { Network, WalletType } from '@rango-dev/wallets-shared';
|
|
2
|
+
import { CosmosTransaction, EvmBlockchainMeta, EvmTransaction, SimulationResult, SolanaTransaction, StarknetTransaction, Transaction, TronTransaction, Transfer as TransferTransaction } from 'rango-sdk';
|
|
3
3
|
import { BigNumber } from 'bignumber.js';
|
|
4
4
|
import { ErrorDetail } from './shared-errors';
|
|
5
5
|
export declare type SwapperStatusResponse = {
|
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":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EACh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IAC/C,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,OAAO,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,oBAAoB,CAAA;KAAE,CAAC;IAC/C,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,oBAAoB,EAAE,OAAO,CAAC;CAC/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,oBAAoB,QAAS,OAAO,KAAG,WAsBnD,CAAC;AAEF,wBAAgB,WAAW,IAAI,MAAM,CAWpC;AAED,wBAAgB,WAAW,CACzB,IAAI,EAAE,WAAW,EACjB,WAAW,EAAE,eAAe,GAC3B,eAAe,GAAG,IAAI,CASxB;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,QA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CAAC;CAC7B;AAED,MAAM,WAAW,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.78",
|
|
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",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"@rango-dev/queue-manager-core": "*",
|
|
22
22
|
"@rango-dev/wallets-core": "*",
|
|
23
23
|
"@rango-dev/wallets-shared": "*",
|
|
24
|
-
"@sentry/browser": "*",
|
|
25
24
|
"bignumber.js": "*",
|
|
25
|
+
"rango-types": "^0.1.21",
|
|
26
26
|
"uuid": "*"
|
|
27
27
|
},
|
|
28
28
|
"husky": {
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"@types/uuid": "^8.3.4"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
+
"@sentry/browser": "^6.12.0",
|
|
53
54
|
"rango-sdk": "^0.1.17",
|
|
54
55
|
"uuid": "^9.0.0"
|
|
55
56
|
},
|
package/src/helpers.ts
CHANGED
|
@@ -7,12 +7,9 @@ import {
|
|
|
7
7
|
SwapStorage,
|
|
8
8
|
} from './types';
|
|
9
9
|
import {
|
|
10
|
-
EvmBlockchainMeta,
|
|
11
10
|
getBlockChainNameFromId,
|
|
12
11
|
Meta,
|
|
13
12
|
Network,
|
|
14
|
-
Transaction,
|
|
15
|
-
TransactionType,
|
|
16
13
|
WalletState,
|
|
17
14
|
WalletType,
|
|
18
15
|
} from '@rango-dev/wallets-shared';
|
|
@@ -25,6 +22,9 @@ import {
|
|
|
25
22
|
EvmTransaction,
|
|
26
23
|
SolanaTransaction,
|
|
27
24
|
Transfer as TransferTransaction,
|
|
25
|
+
Transaction,
|
|
26
|
+
TransactionType,
|
|
27
|
+
EvmBlockchainMeta,
|
|
28
28
|
} from 'rango-sdk';
|
|
29
29
|
|
|
30
30
|
import {
|
|
@@ -526,7 +526,7 @@ export function getRelatedWallet(
|
|
|
526
526
|
const walletType = wallet?.walletType;
|
|
527
527
|
if (walletType === WalletType.UNKNOWN || wallet === null)
|
|
528
528
|
throw PrettyError.AssertionFailed(
|
|
529
|
-
`Wallet for source ${blockchain} not passed
|
|
529
|
+
`Wallet for source ${blockchain} not passed: walletType: ${walletType}`
|
|
530
530
|
);
|
|
531
531
|
return wallet;
|
|
532
532
|
}
|
|
@@ -764,6 +764,7 @@ export function singTransaction(
|
|
|
764
764
|
transferTransaction,
|
|
765
765
|
} = currentStep;
|
|
766
766
|
const sourceWallet = getRelatedWallet(swap, currentStep);
|
|
767
|
+
const walletAddress = getCurrentAddressOf(swap, currentStep);
|
|
767
768
|
const walletSigners = getSigners(sourceWallet.walletType);
|
|
768
769
|
const onFinish = () => {
|
|
769
770
|
if (actions.context.resetClaimedBy) {
|
|
@@ -799,65 +800,73 @@ export function singTransaction(
|
|
|
799
800
|
});
|
|
800
801
|
|
|
801
802
|
// Execute transaction
|
|
802
|
-
walletSigners
|
|
803
|
-
(
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
...getStorage(),
|
|
821
|
-
swapDetails: swap,
|
|
822
|
-
});
|
|
823
|
-
schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
|
|
824
|
-
next();
|
|
825
|
-
onFinish();
|
|
826
|
-
},
|
|
803
|
+
walletSigners
|
|
804
|
+
.getSigner(TransactionType.EVM)
|
|
805
|
+
.signAndSendTx(evmApprovalTransaction, walletAddress, null)
|
|
806
|
+
.then(
|
|
807
|
+
(hash) => {
|
|
808
|
+
console.debug('transaction of approval minted successfully', hash);
|
|
809
|
+
const approveUrl = getEvmApproveUrl(
|
|
810
|
+
hash,
|
|
811
|
+
getCurrentBlockchainOf(swap, currentStep),
|
|
812
|
+
meta.evmBasedChains
|
|
813
|
+
);
|
|
814
|
+
currentStep.explorerUrl = [
|
|
815
|
+
...(currentStep.explorerUrl || []),
|
|
816
|
+
{
|
|
817
|
+
url: approveUrl,
|
|
818
|
+
description: `approve`,
|
|
819
|
+
},
|
|
820
|
+
];
|
|
827
821
|
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
error?.root?.code &&
|
|
838
|
-
error?.root?.reason
|
|
839
|
-
) {
|
|
840
|
-
logRPCError(error.root, swap, currentStep, sourceWallet?.walletType);
|
|
841
|
-
}
|
|
822
|
+
// `currentStep` has been mutated, let's update storage.
|
|
823
|
+
setStorage({
|
|
824
|
+
...getStorage(),
|
|
825
|
+
swapDetails: swap,
|
|
826
|
+
});
|
|
827
|
+
schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
|
|
828
|
+
next();
|
|
829
|
+
onFinish();
|
|
830
|
+
},
|
|
842
831
|
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
832
|
+
(error) => {
|
|
833
|
+
if (swap.status === 'failed') return;
|
|
834
|
+
console.debug('error in approving', error);
|
|
835
|
+
const { extraMessage, extraMessageDetail, extraMessageErrorCode } =
|
|
836
|
+
prettifyErrorMessage(error);
|
|
837
|
+
if (
|
|
838
|
+
error &&
|
|
839
|
+
error?.root &&
|
|
840
|
+
error?.root?.message &&
|
|
841
|
+
error?.root?.code &&
|
|
842
|
+
error?.root?.reason
|
|
843
|
+
) {
|
|
844
|
+
logRPCError(
|
|
845
|
+
error.root,
|
|
846
|
+
swap,
|
|
847
|
+
currentStep,
|
|
848
|
+
sourceWallet?.walletType
|
|
849
|
+
);
|
|
850
|
+
}
|
|
856
851
|
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
852
|
+
const updateResult = updateSwapStatus({
|
|
853
|
+
getStorage,
|
|
854
|
+
setStorage,
|
|
855
|
+
nextStatus: 'failed',
|
|
856
|
+
nextStepStatus: 'failed',
|
|
857
|
+
message: extraMessage,
|
|
858
|
+
details: extraMessageDetail,
|
|
859
|
+
errorCode: extraMessageErrorCode,
|
|
860
|
+
});
|
|
861
|
+
notifier({
|
|
862
|
+
eventType: 'contract_rejected',
|
|
863
|
+
...updateResult,
|
|
864
|
+
});
|
|
865
|
+
|
|
866
|
+
failed();
|
|
867
|
+
onFinish();
|
|
868
|
+
}
|
|
869
|
+
);
|
|
861
870
|
return;
|
|
862
871
|
}
|
|
863
872
|
|
|
@@ -881,34 +890,37 @@ export function singTransaction(
|
|
|
881
890
|
...updateResult,
|
|
882
891
|
});
|
|
883
892
|
|
|
884
|
-
walletSigners
|
|
885
|
-
(
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
893
|
+
walletSigners
|
|
894
|
+
.getSigner(TransactionType.TRANSFER)
|
|
895
|
+
.signAndSendTx(transferTransaction, walletAddress, null)
|
|
896
|
+
.then(
|
|
897
|
+
(txId) => {
|
|
898
|
+
setStepTransactionIds(actions, txId, 'transfer_confirmed', notifier);
|
|
899
|
+
schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
|
|
900
|
+
next();
|
|
901
|
+
onFinish();
|
|
902
|
+
},
|
|
903
|
+
(error) => {
|
|
904
|
+
if (swap.status === 'failed') return;
|
|
905
|
+
const { extraMessage, extraMessageDetail, extraMessageErrorCode } =
|
|
906
|
+
prettifyErrorMessage(error);
|
|
907
|
+
const updateResult = updateSwapStatus({
|
|
908
|
+
getStorage,
|
|
909
|
+
setStorage,
|
|
910
|
+
nextStatus: 'failed',
|
|
911
|
+
nextStepStatus: 'failed',
|
|
912
|
+
message: extraMessage,
|
|
913
|
+
details: extraMessageDetail,
|
|
914
|
+
errorCode: extraMessageErrorCode,
|
|
915
|
+
});
|
|
916
|
+
notifier({
|
|
917
|
+
eventType: 'transfer_rejected',
|
|
918
|
+
...updateResult,
|
|
919
|
+
});
|
|
920
|
+
failed();
|
|
921
|
+
onFinish();
|
|
922
|
+
}
|
|
923
|
+
);
|
|
912
924
|
} else if (!!evmTransaction) {
|
|
913
925
|
const updateResult = updateSwapStatus({
|
|
914
926
|
getStorage,
|
|
@@ -922,44 +934,52 @@ export function singTransaction(
|
|
|
922
934
|
...updateResult,
|
|
923
935
|
});
|
|
924
936
|
|
|
925
|
-
walletSigners
|
|
926
|
-
(
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
937
|
+
walletSigners
|
|
938
|
+
.getSigner(TransactionType.EVM)
|
|
939
|
+
.signAndSendTx(evmTransaction, walletAddress, null)
|
|
940
|
+
.then(
|
|
941
|
+
(id) => {
|
|
942
|
+
setStepTransactionIds(actions, id, 'smart_contract_called', notifier);
|
|
943
|
+
schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
|
|
944
|
+
next();
|
|
945
|
+
onFinish();
|
|
946
|
+
},
|
|
947
|
+
(error) => {
|
|
948
|
+
if (swap.status === 'failed') return;
|
|
949
|
+
const { extraMessage, extraMessageDetail, extraMessageErrorCode } =
|
|
950
|
+
prettifyErrorMessage(error);
|
|
951
|
+
if (
|
|
952
|
+
error &&
|
|
953
|
+
error?.root &&
|
|
954
|
+
error?.root?.message &&
|
|
955
|
+
error?.root?.code &&
|
|
956
|
+
error?.root?.reason
|
|
957
|
+
) {
|
|
958
|
+
logRPCError(
|
|
959
|
+
error.root,
|
|
960
|
+
swap,
|
|
961
|
+
currentStep,
|
|
962
|
+
sourceWallet?.walletType
|
|
963
|
+
);
|
|
964
|
+
}
|
|
965
|
+
const updateResult = updateSwapStatus({
|
|
966
|
+
getStorage,
|
|
967
|
+
setStorage,
|
|
968
|
+
nextStatus: 'failed',
|
|
969
|
+
nextStepStatus: 'failed',
|
|
970
|
+
message: extraMessage,
|
|
971
|
+
details: extraMessageDetail,
|
|
972
|
+
errorCode: extraMessageErrorCode,
|
|
973
|
+
});
|
|
974
|
+
notifier({
|
|
975
|
+
eventType: 'smart_contract_call_failed',
|
|
976
|
+
...updateResult,
|
|
977
|
+
});
|
|
958
978
|
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
979
|
+
failed();
|
|
980
|
+
onFinish();
|
|
981
|
+
}
|
|
982
|
+
);
|
|
963
983
|
} else if (!!cosmosTransaction) {
|
|
964
984
|
const updateResult = updateSwapStatus({
|
|
965
985
|
getStorage,
|
|
@@ -1005,35 +1025,38 @@ export function singTransaction(
|
|
|
1005
1025
|
return;
|
|
1006
1026
|
}
|
|
1007
1027
|
|
|
1008
|
-
walletSigners
|
|
1009
|
-
|
|
1010
|
-
(
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1028
|
+
walletSigners
|
|
1029
|
+
.getSigner(TransactionType.COSMOS)
|
|
1030
|
+
.signAndSendTx(cosmosTransaction, walletAddress, null)
|
|
1031
|
+
.then(
|
|
1032
|
+
// todo
|
|
1033
|
+
(id: string | null) => {
|
|
1034
|
+
setStepTransactionIds(actions, id, 'smart_contract_called', notifier);
|
|
1035
|
+
schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
|
|
1036
|
+
next();
|
|
1037
|
+
onFinish();
|
|
1038
|
+
},
|
|
1039
|
+
(error: string | null) => {
|
|
1040
|
+
if (swap.status === 'failed') return;
|
|
1041
|
+
const { extraMessage, extraMessageDetail, extraMessageErrorCode } =
|
|
1042
|
+
prettifyErrorMessage(error);
|
|
1043
|
+
const updateResult = updateSwapStatus({
|
|
1044
|
+
getStorage,
|
|
1045
|
+
setStorage,
|
|
1046
|
+
nextStatus: 'failed',
|
|
1047
|
+
nextStepStatus: 'failed',
|
|
1048
|
+
message: extraMessage,
|
|
1049
|
+
details: extraMessageDetail,
|
|
1050
|
+
errorCode: extraMessageErrorCode,
|
|
1051
|
+
});
|
|
1052
|
+
notifier({
|
|
1053
|
+
eventType: 'smart_contract_call_failed',
|
|
1054
|
+
...updateResult,
|
|
1055
|
+
});
|
|
1056
|
+
failed();
|
|
1057
|
+
onFinish();
|
|
1058
|
+
}
|
|
1059
|
+
);
|
|
1037
1060
|
} else if (!!solanaTransaction) {
|
|
1038
1061
|
const updateResult = updateSwapStatus({
|
|
1039
1062
|
getStorage,
|
|
@@ -1048,34 +1071,42 @@ export function singTransaction(
|
|
|
1048
1071
|
});
|
|
1049
1072
|
|
|
1050
1073
|
const tx = solanaTransaction;
|
|
1051
|
-
walletSigners
|
|
1052
|
-
(
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1074
|
+
walletSigners
|
|
1075
|
+
.getSigner(TransactionType.SOLANA)
|
|
1076
|
+
.signAndSendTx(tx, walletAddress, null)
|
|
1077
|
+
.then(
|
|
1078
|
+
(txId) => {
|
|
1079
|
+
setStepTransactionIds(
|
|
1080
|
+
actions,
|
|
1081
|
+
txId,
|
|
1082
|
+
'smart_contract_called',
|
|
1083
|
+
notifier
|
|
1084
|
+
);
|
|
1085
|
+
schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
|
|
1086
|
+
next();
|
|
1087
|
+
onFinish();
|
|
1088
|
+
},
|
|
1089
|
+
(error) => {
|
|
1090
|
+
if (swap.status === 'failed') return;
|
|
1091
|
+
const { extraMessage, extraMessageDetail, extraMessageErrorCode } =
|
|
1092
|
+
prettifyErrorMessage(error);
|
|
1093
|
+
const updateResult = updateSwapStatus({
|
|
1094
|
+
getStorage,
|
|
1095
|
+
setStorage,
|
|
1096
|
+
nextStatus: 'failed',
|
|
1097
|
+
nextStepStatus: 'failed',
|
|
1098
|
+
message: extraMessage,
|
|
1099
|
+
details: extraMessageDetail,
|
|
1100
|
+
errorCode: extraMessageErrorCode,
|
|
1101
|
+
});
|
|
1102
|
+
notifier({
|
|
1103
|
+
eventType: 'smart_contract_call_failed',
|
|
1104
|
+
...updateResult,
|
|
1105
|
+
});
|
|
1106
|
+
failed();
|
|
1107
|
+
onFinish();
|
|
1108
|
+
}
|
|
1109
|
+
);
|
|
1079
1110
|
}
|
|
1080
1111
|
}
|
|
1081
1112
|
|
package/src/shared-api.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
isWalletErrorCode,
|
|
3
|
-
WalletErrorCode,
|
|
4
|
-
WalletType,
|
|
5
|
-
} from '@rango-dev/wallets-shared';
|
|
1
|
+
import { WalletType } from '@rango-dev/wallets-shared';
|
|
6
2
|
import { getCookieId, SwapperStatusResponse } from './shared';
|
|
7
3
|
import {
|
|
8
4
|
CheckApprovalResponse,
|
|
@@ -22,6 +18,7 @@ import {
|
|
|
22
18
|
RANGO_COOKIE_HEADER,
|
|
23
19
|
RANGO_DAPP_ID_QUERY,
|
|
24
20
|
} from './constants';
|
|
21
|
+
import { isSignerErrorCode, SignerErrorCode } from 'rango-types';
|
|
25
22
|
|
|
26
23
|
export async function checkSwapStatus(
|
|
27
24
|
requestId: string,
|
|
@@ -131,14 +128,14 @@ export function mapAppErrorCodesToAPIErrorCode(
|
|
|
131
128
|
try {
|
|
132
129
|
if (!errorCode) return defaultErrorCode;
|
|
133
130
|
if (isAPIErrorCode(errorCode)) return errorCode;
|
|
134
|
-
if (
|
|
135
|
-
const t: { [key in
|
|
136
|
-
[
|
|
137
|
-
[
|
|
138
|
-
[
|
|
139
|
-
[
|
|
140
|
-
[
|
|
141
|
-
[
|
|
131
|
+
if (isSignerErrorCode(errorCode)) {
|
|
132
|
+
const t: { [key in SignerErrorCode]: APIErrorCode } = {
|
|
133
|
+
[SignerErrorCode.REJECTED_BY_USER]: APIErrorCode.USER_REJECT,
|
|
134
|
+
[SignerErrorCode.SIGN_TX_ERROR]: APIErrorCode.CALL_WALLET_FAILED,
|
|
135
|
+
[SignerErrorCode.SEND_TX_ERROR]: APIErrorCode.SEND_TX_FAILED,
|
|
136
|
+
[SignerErrorCode.NOT_IMPLEMENTED]: defaultErrorCode,
|
|
137
|
+
[SignerErrorCode.OPERATION_UNSUPPORTED]: defaultErrorCode,
|
|
138
|
+
[SignerErrorCode.UNEXPECTED_BEHAVIOUR]: defaultErrorCode,
|
|
142
139
|
};
|
|
143
140
|
return t[errorCode];
|
|
144
141
|
}
|