@keplr-wallet/background 0.13.13 → 0.13.15-rc.0
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/build/chains/convert.d.ts +7 -0
- package/build/chains/convert.js +109 -0
- package/build/chains/convert.js.map +1 -0
- package/build/chains/handler.js +1 -1
- package/build/chains/handler.js.map +1 -1
- package/build/chains/index.d.ts +1 -0
- package/build/chains/index.js +1 -0
- package/build/chains/index.js.map +1 -1
- package/build/chains/messages.d.ts +1 -1
- package/build/chains/service.d.ts +3 -9
- package/build/chains/service.js +45 -79
- package/build/chains/service.js.map +1 -1
- package/build/chains-ui/service.d.ts +2 -2
- package/build/chains-ui/service.js +5 -6
- package/build/chains-ui/service.js.map +1 -1
- package/build/chains-update/service.js +2 -2
- package/build/chains-update/service.js.map +1 -1
- package/build/keyring/handler.js +21 -15
- package/build/keyring/handler.js.map +1 -1
- package/build/keyring/service.d.ts +0 -1
- package/build/keyring/service.js +103 -78
- package/build/keyring/service.js.map +1 -1
- package/build/keyring-bitcoin/service.js +2 -2
- package/build/keyring-bitcoin/service.js.map +1 -1
- package/build/keyring-cosmos/service.js +31 -18
- package/build/keyring-cosmos/service.js.map +1 -1
- package/build/keyring-ethereum/service.js +19 -19
- package/build/keyring-ethereum/service.js.map +1 -1
- package/build/keyring-ledger/service.js +8 -7
- package/build/keyring-ledger/service.js.map +1 -1
- package/build/keyring-starknet/service.js +7 -7
- package/build/keyring-starknet/service.js.map +1 -1
- package/build/manage-view-asset-token/service.d.ts +1 -2
- package/build/manage-view-asset-token/service.js +2 -2
- package/build/manage-view-asset-token/service.js.map +1 -1
- package/build/permission/service.d.ts +1 -2
- package/build/permission/service.js +2 -2
- package/build/permission/service.js.map +1 -1
- package/build/recent-send-history/service.d.ts +4 -4
- package/build/recent-send-history/service.js +101 -73
- package/build/recent-send-history/service.js.map +1 -1
- package/build/secret-wasm/service.d.ts +3 -3
- package/build/secret-wasm/service.js +29 -29
- package/build/secret-wasm/service.js.map +1 -1
- package/build/token-cw20/service.d.ts +6 -6
- package/build/token-cw20/service.js +28 -21
- package/build/token-cw20/service.js.map +1 -1
- package/build/token-erc20/service.d.ts +2 -3
- package/build/token-erc20/service.js +10 -15
- package/build/token-erc20/service.js.map +1 -1
- package/build/token-scan/service.js +27 -23
- package/build/token-scan/service.js.map +1 -1
- package/build/tx/service.d.ts +1 -0
- package/build/tx/service.js +41 -10
- package/build/tx/service.js.map +1 -1
- package/build/tx-ethereum/service.js +5 -9
- package/build/tx-ethereum/service.js.map +1 -1
- package/build/tx-executor/service.js +2 -7
- package/build/tx-executor/service.js.map +1 -1
- package/build/tx-executor/types.d.ts +7 -1
- package/build/tx-executor/types.js.map +1 -1
- package/build/tx-executor/utils/evm.d.ts +2 -2
- package/build/tx-executor/utils/evm.js +75 -26
- package/build/tx-executor/utils/evm.js.map +1 -1
- package/package.json +13 -13
- package/src/chains/convert.ts +126 -0
- package/src/chains/handler.ts +1 -1
- package/src/chains/index.ts +1 -0
- package/src/chains/messages.ts +1 -1
- package/src/chains/service.ts +64 -97
- package/src/chains-ui/service.ts +8 -7
- package/src/chains-update/service.ts +2 -2
- package/src/keyring/handler.ts +34 -19
- package/src/keyring/service.ts +137 -96
- package/src/keyring-bitcoin/service.ts +2 -2
- package/src/keyring-cosmos/service.ts +46 -18
- package/src/keyring-ethereum/service.ts +24 -17
- package/src/keyring-ledger/service.ts +10 -10
- package/src/keyring-starknet/service.ts +7 -7
- package/src/manage-view-asset-token/service.ts +2 -3
- package/src/permission/service.ts +3 -7
- package/src/recent-send-history/service.ts +141 -95
- package/src/secret-wasm/service.ts +39 -45
- package/src/token-cw20/service.ts +36 -30
- package/src/token-erc20/service.ts +15 -18
- package/src/token-scan/service.ts +34 -21
- package/src/tx/service.ts +60 -12
- package/src/tx-ethereum/service.ts +8 -8
- package/src/tx-executor/service.ts +4 -6
- package/src/tx-executor/types.ts +9 -1
- package/src/tx-executor/utils/evm.ts +92 -32
- package/tsconfig.check.json +2 -0
|
@@ -127,8 +127,8 @@ class RecentSendHistoryService {
|
|
|
127
127
|
(0, mobx_1.runInAction)(() => {
|
|
128
128
|
history.notified = true;
|
|
129
129
|
});
|
|
130
|
-
const
|
|
131
|
-
if (
|
|
130
|
+
const modularChainInfo = this.chainsService.getModularChainInfo(history.destinationChainId);
|
|
131
|
+
if (modularChainInfo) {
|
|
132
132
|
if ("swapType" in history) {
|
|
133
133
|
if (history.resAmount.length > 0) {
|
|
134
134
|
const amount = history.resAmount[history.resAmount.length - 1];
|
|
@@ -151,7 +151,7 @@ class RecentSendHistoryService {
|
|
|
151
151
|
this.notification.create({
|
|
152
152
|
iconRelativeUrl: "assets/logo-256.png",
|
|
153
153
|
title: "IBC Swap Succeeded",
|
|
154
|
-
message: `${assetsText.join(", ")} received on ${
|
|
154
|
+
message: `${assetsText.join(", ")} received on ${modularChainInfo.chainName}`,
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
157
|
}
|
|
@@ -176,7 +176,7 @@ class RecentSendHistoryService {
|
|
|
176
176
|
this.notification.create({
|
|
177
177
|
iconRelativeUrl: "assets/logo-256.png",
|
|
178
178
|
title: "IBC Transfer Succeeded",
|
|
179
|
-
message: `${assetsText.join(", ")} sent to ${
|
|
179
|
+
message: `${assetsText.join(", ")} sent to ${modularChainInfo.chainName}`,
|
|
180
180
|
});
|
|
181
181
|
}
|
|
182
182
|
}
|
|
@@ -205,12 +205,12 @@ class RecentSendHistoryService {
|
|
|
205
205
|
};
|
|
206
206
|
this.checkAndTrackSwapTxFulfilledRecursive = (params) => {
|
|
207
207
|
const { chainId, txHash, onSuccess, onPending, onFailed, onError } = params;
|
|
208
|
-
const
|
|
209
|
-
if (!
|
|
208
|
+
const modularChainInfo = this.chainsService.getModularChainInfo(chainId);
|
|
209
|
+
if (!modularChainInfo) {
|
|
210
210
|
onFailed();
|
|
211
211
|
return;
|
|
212
212
|
}
|
|
213
|
-
this.resolveTxExecutionStatus(
|
|
213
|
+
this.resolveTxExecutionStatus(modularChainInfo, chainId, txHash)
|
|
214
214
|
.then((status) => {
|
|
215
215
|
switch (status) {
|
|
216
216
|
case "success":
|
|
@@ -526,8 +526,8 @@ class RecentSendHistoryService {
|
|
|
526
526
|
// ============================================================================
|
|
527
527
|
// Chain removed handler
|
|
528
528
|
// ============================================================================
|
|
529
|
-
this.onChainRemoved = (
|
|
530
|
-
const chainIdentifier = cosmos_1.ChainIdHelper.parse(
|
|
529
|
+
this.onChainRemoved = (chainId) => {
|
|
530
|
+
const chainIdentifier = cosmos_1.ChainIdHelper.parse(chainId).identifier;
|
|
531
531
|
try {
|
|
532
532
|
this.removeIBCHistoriesByChainIdentifier(chainIdentifier);
|
|
533
533
|
this.removeSkipHistoriesByChainIdentifier(chainIdentifier);
|
|
@@ -698,16 +698,24 @@ class RecentSendHistoryService {
|
|
|
698
698
|
sendTxAndRecord(type, sourceChainId, destinationChainId, tx, mode, silent, sender, recipient, amount, memo, ibcChannels, notificationInfo, shouldLegacyTrack = false) {
|
|
699
699
|
var _a, _b;
|
|
700
700
|
return __awaiter(this, void 0, void 0, function* () {
|
|
701
|
-
const
|
|
702
|
-
|
|
703
|
-
|
|
701
|
+
const sourceModularChainInfo = this.chainsService.getModularChainInfoOrThrow(sourceChainId);
|
|
702
|
+
const sourceBech32Prefix = sourceModularChainInfo.type === "cosmos" ||
|
|
703
|
+
sourceModularChainInfo.type === "ethermint"
|
|
704
|
+
? (_a = sourceModularChainInfo.cosmos.bech32Config) === null || _a === void 0 ? void 0 : _a.bech32PrefixAccAddr
|
|
705
|
+
: undefined;
|
|
706
|
+
cosmos_1.Bech32Address.validate(sender, sourceBech32Prefix);
|
|
707
|
+
const destModularChainInfo = this.chainsService.getModularChainInfoOrThrow(destinationChainId);
|
|
704
708
|
if (recipient.startsWith("0x")) {
|
|
705
709
|
if (!recipient.match(/^0x[0-9A-Fa-f]*$/) || recipient.length !== 42) {
|
|
706
710
|
throw new Error("Recipient address is not valid hex address");
|
|
707
711
|
}
|
|
708
712
|
}
|
|
709
713
|
else {
|
|
710
|
-
|
|
714
|
+
const destBech32Prefix = destModularChainInfo.type === "cosmos" ||
|
|
715
|
+
destModularChainInfo.type === "ethermint"
|
|
716
|
+
? (_b = destModularChainInfo.cosmos.bech32Config) === null || _b === void 0 ? void 0 : _b.bech32PrefixAccAddr
|
|
717
|
+
: undefined;
|
|
718
|
+
cosmos_1.Bech32Address.validate(recipient, destBech32Prefix);
|
|
711
719
|
}
|
|
712
720
|
const txHash = yield this.txService.sendTx(sourceChainId, tx, mode, {
|
|
713
721
|
silent,
|
|
@@ -769,9 +777,13 @@ class RecentSendHistoryService {
|
|
|
769
777
|
sendTxAndRecordIBCSwap(swapType, sourceChainId, destinationChainId, tx, mode, silent, sender, amount, memo, ibcChannels, destinationAsset, swapChannelIndex, swapReceiver, notificationInfo, shouldLegacyTrack = false) {
|
|
770
778
|
var _a;
|
|
771
779
|
return __awaiter(this, void 0, void 0, function* () {
|
|
772
|
-
const
|
|
773
|
-
|
|
774
|
-
|
|
780
|
+
const sourceModularChainInfo = this.chainsService.getModularChainInfoOrThrow(sourceChainId);
|
|
781
|
+
const sourceBech32Prefix = sourceModularChainInfo.type === "cosmos" ||
|
|
782
|
+
sourceModularChainInfo.type === "ethermint"
|
|
783
|
+
? (_a = sourceModularChainInfo.cosmos.bech32Config) === null || _a === void 0 ? void 0 : _a.bech32PrefixAccAddr
|
|
784
|
+
: undefined;
|
|
785
|
+
cosmos_1.Bech32Address.validate(sender, sourceBech32Prefix);
|
|
786
|
+
this.chainsService.getModularChainInfoOrThrow(destinationChainId);
|
|
775
787
|
const txHash = yield this.txService.sendTx(sourceChainId, tx, mode, {
|
|
776
788
|
silent,
|
|
777
789
|
onFulfill: (tx) => {
|
|
@@ -865,14 +877,14 @@ class RecentSendHistoryService {
|
|
|
865
877
|
}
|
|
866
878
|
getRecentIBCHistories() {
|
|
867
879
|
return Array.from(this.recentIBCHistoryMap.values()).filter((history) => {
|
|
868
|
-
if (!this.chainsService.
|
|
880
|
+
if (!this.chainsService.hasModularChainInfo(history.chainId)) {
|
|
869
881
|
return false;
|
|
870
882
|
}
|
|
871
|
-
if (!this.chainsService.
|
|
883
|
+
if (!this.chainsService.hasModularChainInfo(history.destinationChainId)) {
|
|
872
884
|
return false;
|
|
873
885
|
}
|
|
874
886
|
if (history.ibcHistory.some((history) => {
|
|
875
|
-
return !this.chainsService.
|
|
887
|
+
return !this.chainsService.hasModularChainInfo(history.counterpartyChainId);
|
|
876
888
|
})) {
|
|
877
889
|
return false;
|
|
878
890
|
}
|
|
@@ -913,15 +925,15 @@ class RecentSendHistoryService {
|
|
|
913
925
|
maxWaitMsAfterError: 5 * 60 * 1000, // 5min
|
|
914
926
|
});
|
|
915
927
|
}
|
|
916
|
-
resolveTxExecutionStatus(
|
|
928
|
+
resolveTxExecutionStatus(modularChainInfo, chainId, txHash) {
|
|
917
929
|
return __awaiter(this, void 0, void 0, function* () {
|
|
918
930
|
if (this.chainsService.isEvmChain(chainId)) {
|
|
919
|
-
|
|
920
|
-
|
|
931
|
+
if (modularChainInfo.type !== "evm" &&
|
|
932
|
+
modularChainInfo.type !== "ethermint") {
|
|
921
933
|
return Promise.resolve("error");
|
|
922
934
|
}
|
|
923
935
|
const res = yield (0, api_1.requestEthTxReceipt)({
|
|
924
|
-
rpc:
|
|
936
|
+
rpc: modularChainInfo.evm.rpc,
|
|
925
937
|
txHash,
|
|
926
938
|
origin,
|
|
927
939
|
});
|
|
@@ -937,7 +949,11 @@ class RecentSendHistoryService {
|
|
|
937
949
|
}
|
|
938
950
|
return "failed";
|
|
939
951
|
}
|
|
940
|
-
|
|
952
|
+
if (modularChainInfo.type !== "cosmos" &&
|
|
953
|
+
modularChainInfo.type !== "ethermint") {
|
|
954
|
+
return Promise.resolve("error");
|
|
955
|
+
}
|
|
956
|
+
const txTracer = new cosmos_1.TendermintTxTracer(modularChainInfo.cosmos.rpc, "/websocket");
|
|
941
957
|
txTracer.addEventListener("error", () => {
|
|
942
958
|
txTracer.close();
|
|
943
959
|
});
|
|
@@ -966,8 +982,8 @@ class RecentSendHistoryService {
|
|
|
966
982
|
}
|
|
967
983
|
trackDestinationAssetAmount(params) {
|
|
968
984
|
const { chainId, txHash, recipient, targetDenom, onResult, onRefund, onFulfill, } = params;
|
|
969
|
-
const
|
|
970
|
-
if (!
|
|
985
|
+
const modularChainInfo = this.chainsService.getModularChainInfo(chainId);
|
|
986
|
+
if (!modularChainInfo) {
|
|
971
987
|
onFulfill();
|
|
972
988
|
return;
|
|
973
989
|
}
|
|
@@ -989,8 +1005,13 @@ class RecentSendHistoryService {
|
|
|
989
1005
|
});
|
|
990
1006
|
return;
|
|
991
1007
|
}
|
|
1008
|
+
if (modularChainInfo.type !== "cosmos" &&
|
|
1009
|
+
modularChainInfo.type !== "ethermint") {
|
|
1010
|
+
onFulfill();
|
|
1011
|
+
return;
|
|
1012
|
+
}
|
|
992
1013
|
this.traceCosmosTransactionResult({
|
|
993
|
-
|
|
1014
|
+
rpc: modularChainInfo.cosmos.rpc,
|
|
994
1015
|
txHash,
|
|
995
1016
|
recipient,
|
|
996
1017
|
onResult,
|
|
@@ -998,8 +1019,8 @@ class RecentSendHistoryService {
|
|
|
998
1019
|
});
|
|
999
1020
|
}
|
|
1000
1021
|
traceCosmosTransactionResult(params) {
|
|
1001
|
-
const {
|
|
1002
|
-
const txTracer = new cosmos_1.TendermintTxTracer(
|
|
1022
|
+
const { rpc, txHash, recipient, onResult, onFulfill } = params;
|
|
1023
|
+
const txTracer = new cosmos_1.TendermintTxTracer(rpc, "/websocket");
|
|
1003
1024
|
txTracer.addEventListener("error", () => onFulfill());
|
|
1004
1025
|
txTracer
|
|
1005
1026
|
.queryTx({
|
|
@@ -1026,25 +1047,20 @@ class RecentSendHistoryService {
|
|
|
1026
1047
|
// CHECK: move tracing logic (requestEthTxReceipt, requestEthTxTrace, parseEVMTxReceiptLogs) to tx-ethereum service
|
|
1027
1048
|
traceEVMTransactionResult(params) {
|
|
1028
1049
|
const { chainId, txHash, recipient, targetDenom, onResult, onFulfill } = params;
|
|
1029
|
-
const
|
|
1030
|
-
if (!
|
|
1050
|
+
const modularChainInfo = this.chainsService.getModularChainInfo(chainId);
|
|
1051
|
+
if (!modularChainInfo) {
|
|
1031
1052
|
onResult({ success: false });
|
|
1032
1053
|
onFulfill();
|
|
1033
1054
|
return;
|
|
1034
1055
|
}
|
|
1035
|
-
if (
|
|
1056
|
+
if (modularChainInfo.type !== "evm" &&
|
|
1057
|
+
modularChainInfo.type !== "ethermint") {
|
|
1036
1058
|
onResult({ success: false, error: "Not an EVM chain" });
|
|
1037
1059
|
onFulfill();
|
|
1038
1060
|
return;
|
|
1039
1061
|
}
|
|
1040
|
-
const evmInfo = chainInfo.evm;
|
|
1041
|
-
if (!evmInfo) {
|
|
1042
|
-
onResult({ success: false });
|
|
1043
|
-
onFulfill();
|
|
1044
|
-
return;
|
|
1045
|
-
}
|
|
1046
1062
|
(0, api_1.requestEthTxReceipt)({
|
|
1047
|
-
rpc:
|
|
1063
|
+
rpc: modularChainInfo.evm.rpc,
|
|
1048
1064
|
txHash,
|
|
1049
1065
|
origin,
|
|
1050
1066
|
})
|
|
@@ -1055,7 +1071,7 @@ class RecentSendHistoryService {
|
|
|
1055
1071
|
return;
|
|
1056
1072
|
}
|
|
1057
1073
|
(0, api_1.requestEthTxTrace)({
|
|
1058
|
-
rpc:
|
|
1074
|
+
rpc: modularChainInfo.evm.rpc,
|
|
1059
1075
|
txHash,
|
|
1060
1076
|
origin,
|
|
1061
1077
|
}).then((traceRes) => {
|
|
@@ -1214,14 +1230,14 @@ class RecentSendHistoryService {
|
|
|
1214
1230
|
}
|
|
1215
1231
|
getRecentSkipHistories() {
|
|
1216
1232
|
return Array.from(this.recentSkipHistoryMap.values()).filter((history) => {
|
|
1217
|
-
if (!this.chainsService.
|
|
1233
|
+
if (!this.chainsService.hasModularChainInfo(history.chainId)) {
|
|
1218
1234
|
return false;
|
|
1219
1235
|
}
|
|
1220
|
-
if (!this.chainsService.
|
|
1236
|
+
if (!this.chainsService.hasModularChainInfo(history.destinationChainId)) {
|
|
1221
1237
|
return false;
|
|
1222
1238
|
}
|
|
1223
1239
|
if (history.simpleRoute.some((route) => {
|
|
1224
|
-
return !this.chainsService.
|
|
1240
|
+
return !this.chainsService.hasModularChainInfo(route.chainId);
|
|
1225
1241
|
})) {
|
|
1226
1242
|
return false;
|
|
1227
1243
|
}
|
|
@@ -1305,8 +1321,8 @@ class RecentSendHistoryService {
|
|
|
1305
1321
|
onFulfill();
|
|
1306
1322
|
return;
|
|
1307
1323
|
}
|
|
1308
|
-
const
|
|
1309
|
-
if (!
|
|
1324
|
+
const modularChainInfo = this.chainsService.getModularChainInfo(history.destinationChainId);
|
|
1325
|
+
if (!modularChainInfo) {
|
|
1310
1326
|
onFulfill();
|
|
1311
1327
|
return;
|
|
1312
1328
|
}
|
|
@@ -1711,8 +1727,8 @@ class RecentSendHistoryService {
|
|
|
1711
1727
|
onFulfill();
|
|
1712
1728
|
return;
|
|
1713
1729
|
}
|
|
1714
|
-
const
|
|
1715
|
-
if (!
|
|
1730
|
+
const modularChainInfo = this.chainsService.getModularChainInfo(targetChainId);
|
|
1731
|
+
if (!modularChainInfo) {
|
|
1716
1732
|
onFulfill();
|
|
1717
1733
|
return;
|
|
1718
1734
|
}
|
|
@@ -1748,14 +1764,14 @@ class RecentSendHistoryService {
|
|
|
1748
1764
|
}
|
|
1749
1765
|
getRecentSwapV2Histories() {
|
|
1750
1766
|
return Array.from(this.recentSwapV2HistoryMap.values()).filter((history) => {
|
|
1751
|
-
if (!this.chainsService.
|
|
1767
|
+
if (!this.chainsService.hasModularChainInfo(history.fromChainId)) {
|
|
1752
1768
|
return false;
|
|
1753
1769
|
}
|
|
1754
|
-
if (!this.chainsService.
|
|
1770
|
+
if (!this.chainsService.hasModularChainInfo(history.toChainId)) {
|
|
1755
1771
|
return false;
|
|
1756
1772
|
}
|
|
1757
1773
|
if (history.simpleRoute.some((route) => {
|
|
1758
|
-
return !this.chainsService.
|
|
1774
|
+
return !this.chainsService.hasModularChainInfo(route.chainId);
|
|
1759
1775
|
})) {
|
|
1760
1776
|
return false;
|
|
1761
1777
|
}
|
|
@@ -1799,8 +1815,8 @@ class RecentSendHistoryService {
|
|
|
1799
1815
|
if (!latestResAmount || latestResAmount.length === 0) {
|
|
1800
1816
|
return;
|
|
1801
1817
|
}
|
|
1802
|
-
const
|
|
1803
|
-
if (!
|
|
1818
|
+
const modularChainInfo = this.chainsService.getModularChainInfo(history.toChainId);
|
|
1819
|
+
if (!modularChainInfo) {
|
|
1804
1820
|
return;
|
|
1805
1821
|
}
|
|
1806
1822
|
const assetsText = latestResAmount
|
|
@@ -1827,7 +1843,7 @@ class RecentSendHistoryService {
|
|
|
1827
1843
|
this.notification.create({
|
|
1828
1844
|
iconRelativeUrl: "assets/logo-256.png",
|
|
1829
1845
|
title: "Swap Succeeded",
|
|
1830
|
-
message: `${assetsText.join(", ")} received on ${
|
|
1846
|
+
message: `${assetsText.join(", ")} received on ${modularChainInfo.chainName}`,
|
|
1831
1847
|
});
|
|
1832
1848
|
}
|
|
1833
1849
|
hideSwapV2History(id) {
|
|
@@ -2105,12 +2121,14 @@ class RecentSendHistoryService {
|
|
|
2105
2121
|
*/
|
|
2106
2122
|
trackIBCTxFulfillment(params) {
|
|
2107
2123
|
const { chainId, txHash, ibcHistory, swapReceiver, onTxFulfilled, onTxError, onFulfill, onClose, onError, } = params;
|
|
2108
|
-
const
|
|
2109
|
-
if (!
|
|
2124
|
+
const modularChainInfo = this.chainsService.getModularChainInfo(chainId);
|
|
2125
|
+
if (!modularChainInfo ||
|
|
2126
|
+
(modularChainInfo.type !== "cosmos" &&
|
|
2127
|
+
modularChainInfo.type !== "ethermint")) {
|
|
2110
2128
|
onFulfill();
|
|
2111
2129
|
return;
|
|
2112
2130
|
}
|
|
2113
|
-
const txTracer = new cosmos_1.TendermintTxTracer(
|
|
2131
|
+
const txTracer = new cosmos_1.TendermintTxTracer(modularChainInfo.cosmos.rpc, "/websocket");
|
|
2114
2132
|
txTracer.addEventListener("close", onClose);
|
|
2115
2133
|
txTracer.addEventListener("error", onError);
|
|
2116
2134
|
txTracer.traceTx(buffer_1.Buffer.from(txHash, "hex")).then((tx) => {
|
|
@@ -2169,18 +2187,22 @@ class RecentSendHistoryService {
|
|
|
2169
2187
|
ibcHistory.indexOf(targetChannel) === swapContext.swapChannelIndex + 1);
|
|
2170
2188
|
if (targetChannel !== undefined && targetChannel.sequence !== undefined) {
|
|
2171
2189
|
const targetSequence = targetChannel.sequence;
|
|
2172
|
-
const
|
|
2190
|
+
const prevChain = (() => {
|
|
2173
2191
|
const targetChannelIndex = ibcHistory.findIndex((h) => h === targetChannel);
|
|
2174
2192
|
if (targetChannelIndex < 0) {
|
|
2175
2193
|
return undefined;
|
|
2176
2194
|
}
|
|
2177
|
-
|
|
2178
|
-
|
|
2195
|
+
const prevChainId = targetChannelIndex === 0
|
|
2196
|
+
? sourceChainId
|
|
2197
|
+
: ibcHistory[targetChannelIndex - 1].counterpartyChainId;
|
|
2198
|
+
const m = this.chainsService.getModularChainInfo(prevChainId);
|
|
2199
|
+
if (m && (m.type === "cosmos" || m.type === "ethermint")) {
|
|
2200
|
+
return { chainId: m.chainId, rpc: m.cosmos.rpc };
|
|
2179
2201
|
}
|
|
2180
|
-
return
|
|
2202
|
+
return undefined;
|
|
2181
2203
|
})();
|
|
2182
|
-
if (
|
|
2183
|
-
const txTracer = new cosmos_1.TendermintTxTracer(
|
|
2204
|
+
if (prevChain) {
|
|
2205
|
+
const txTracer = new cosmos_1.TendermintTxTracer(prevChain.rpc, "/websocket");
|
|
2184
2206
|
txTracer.addEventListener("close", onClose);
|
|
2185
2207
|
txTracer.addEventListener("error", onError);
|
|
2186
2208
|
txTracer
|
|
@@ -2223,7 +2245,7 @@ class RecentSendHistoryService {
|
|
|
2223
2245
|
})(), index)
|
|
2224
2246
|
: this.getIBCSwapResAmountFromTx(tx, swapContext.swapReceiver[swapContext.swapChannelIndex + 1], index);
|
|
2225
2247
|
(_a = swapContext.setSwapRefundInfo) === null || _a === void 0 ? void 0 : _a.call(swapContext, {
|
|
2226
|
-
chainId:
|
|
2248
|
+
chainId: prevChain.chainId,
|
|
2227
2249
|
amount: refunded,
|
|
2228
2250
|
});
|
|
2229
2251
|
targetChannel.rewoundButNextRewindingBlocked = true;
|
|
@@ -2387,8 +2409,10 @@ class RecentSendHistoryService {
|
|
|
2387
2409
|
prevChainId = sourceChainId;
|
|
2388
2410
|
}
|
|
2389
2411
|
if (prevChainId) {
|
|
2390
|
-
const
|
|
2391
|
-
if (
|
|
2412
|
+
const prevModularChainInfo = this.chainsService.getModularChainInfo(prevChainId);
|
|
2413
|
+
if (prevModularChainInfo &&
|
|
2414
|
+
(prevModularChainInfo.type === "cosmos" ||
|
|
2415
|
+
prevModularChainInfo.type === "ethermint")) {
|
|
2392
2416
|
const queryEvents = {
|
|
2393
2417
|
// acknowledge_packet과는 다르게 timeout_packet은 이전의 체인의 이벤트로부터만 알 수 있다.
|
|
2394
2418
|
// 방법이 없기 때문에 여기서 이전의 체인으로부터 subscribe를 해서 이벤트를 받아야 한다.
|
|
@@ -2398,7 +2422,7 @@ class RecentSendHistoryService {
|
|
|
2398
2422
|
"timeout_packet.packet_src_channel": targetChannel.channelId,
|
|
2399
2423
|
"timeout_packet.packet_sequence": targetChannel.sequence,
|
|
2400
2424
|
};
|
|
2401
|
-
const txTracer = new cosmos_1.TendermintTxTracer(
|
|
2425
|
+
const txTracer = new cosmos_1.TendermintTxTracer(prevModularChainInfo.cosmos.rpc, "/websocket");
|
|
2402
2426
|
registerClosable(txTracer);
|
|
2403
2427
|
txTracer.addEventListener("close", onCloseOnce);
|
|
2404
2428
|
txTracer.addEventListener("error", onErrorOnce);
|
|
@@ -2429,8 +2453,10 @@ class RecentSendHistoryService {
|
|
|
2429
2453
|
return;
|
|
2430
2454
|
}
|
|
2431
2455
|
const sequence = targetChannel.sequence;
|
|
2432
|
-
const
|
|
2433
|
-
if (!
|
|
2456
|
+
const counterpartyModularChainInfo = this.chainsService.getModularChainInfo(targetChannel.counterpartyChainId);
|
|
2457
|
+
if (!counterpartyModularChainInfo ||
|
|
2458
|
+
(counterpartyModularChainInfo.type !== "cosmos" &&
|
|
2459
|
+
counterpartyModularChainInfo.type !== "ethermint")) {
|
|
2434
2460
|
onFulfill();
|
|
2435
2461
|
return;
|
|
2436
2462
|
}
|
|
@@ -2439,7 +2465,7 @@ class RecentSendHistoryService {
|
|
|
2439
2465
|
"recv_packet.packet_dst_channel": targetChannel.dstChannelId,
|
|
2440
2466
|
"recv_packet.packet_sequence": targetChannel.sequence,
|
|
2441
2467
|
};
|
|
2442
|
-
const txTracer = new cosmos_1.TendermintTxTracer(
|
|
2468
|
+
const txTracer = new cosmos_1.TendermintTxTracer(counterpartyModularChainInfo.cosmos.rpc, "/websocket");
|
|
2443
2469
|
txTracer.addEventListener("close", onClose);
|
|
2444
2470
|
txTracer.addEventListener("error", onError);
|
|
2445
2471
|
txTracer.traceTx(queryEvents).then((res) => {
|
|
@@ -2456,7 +2482,9 @@ class RecentSendHistoryService {
|
|
|
2456
2482
|
return idx >= 0;
|
|
2457
2483
|
});
|
|
2458
2484
|
const tx = matchedTx || txs[0];
|
|
2459
|
-
|
|
2485
|
+
(0, mobx_1.runInAction)(() => {
|
|
2486
|
+
targetChannel.completed = true;
|
|
2487
|
+
});
|
|
2460
2488
|
let resAmount;
|
|
2461
2489
|
const receiverIndex = targetChannelIndex + 1;
|
|
2462
2490
|
if (tx && swapReceiver && receiverIndex < swapReceiver.length) {
|
|
@@ -2489,12 +2517,12 @@ class RecentSendHistoryService {
|
|
|
2489
2517
|
// 예를 들어, source chain -> osmosis (swap) -> destination chain으로 이동하는 경우,
|
|
2490
2518
|
// osmosis에서 IBC wrapped token이 destination chain으로 전송되고,
|
|
2491
2519
|
// destination chain에서 IBC wrapped token을 unwrap하는 케이스가 있을 수 있다.
|
|
2492
|
-
const
|
|
2493
|
-
if (
|
|
2520
|
+
const destinationModularChainInfo = this.chainsService.getModularChainInfo(destinationAsset.chainId);
|
|
2521
|
+
if (destinationModularChainInfo) {
|
|
2494
2522
|
onDynamicHopDetected({
|
|
2495
2523
|
portId: "transfer",
|
|
2496
2524
|
channelId: lastSendPacket.srcChannel,
|
|
2497
|
-
counterpartyChainId:
|
|
2525
|
+
counterpartyChainId: destinationModularChainInfo.chainId,
|
|
2498
2526
|
sequence: lastSendPacket.sequence,
|
|
2499
2527
|
dstChannelId: lastSendPacket.dstChannel,
|
|
2500
2528
|
packetData: lastSendPacket.packetData,
|