@keplr-wallet/background 0.12.36-rc.0 → 0.12.36
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/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build/recent-send-history/handler.js +5 -3
- package/build/recent-send-history/handler.js.map +1 -1
- package/build/recent-send-history/messages.d.ts +16 -3
- package/build/recent-send-history/messages.js +6 -4
- package/build/recent-send-history/messages.js.map +1 -1
- package/build/recent-send-history/service.d.ts +17 -6
- package/build/recent-send-history/service.js +181 -18
- package/build/recent-send-history/service.js.map +1 -1
- package/build/recent-send-history/types.d.ts +13 -0
- package/package.json +13 -13
- package/src/index.ts +2 -1
- package/src/recent-send-history/handler.ts +8 -3
- package/src/recent-send-history/messages.ts +15 -4
- package/src/recent-send-history/service.ts +273 -28
- package/src/recent-send-history/types.ts +19 -0
package/build/index.js
CHANGED
|
@@ -118,7 +118,7 @@ privilegedOrigins, analyticsPrivilegedOrigins, msgPrivilegedOrigins, communityCh
|
|
|
118
118
|
const chainsUpdateService = new ChainsUpdate.ChainsUpdateService(storeCreator("chains-update"), chainsService, chainsUIService);
|
|
119
119
|
const secretWasmService = new SecretWasm.SecretWasmService(storeCreator("secretwasm"), chainsService, keyRingCosmosService);
|
|
120
120
|
const tokenScanService = new TokenScan.TokenScanService(storeCreator("token-scan"), chainsService, chainsUIService, vaultService, keyRingV2Service, keyRingCosmosService);
|
|
121
|
-
const recentSendHistoryService = new RecentSendHistory.RecentSendHistoryService(storeCreator("recent-send-history"), chainsService, backgroundTxService);
|
|
121
|
+
const recentSendHistoryService = new RecentSendHistory.RecentSendHistoryService(storeCreator("recent-send-history"), chainsService, backgroundTxService, notification);
|
|
122
122
|
Interaction.init(router, interactionService);
|
|
123
123
|
Permission.init(router, permissionService);
|
|
124
124
|
Chains.init(router, chainsService, permissionService, permissionInteractiveService);
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":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ACjB,MAAM,aAAa,CAAC,IAAI,EAAE,CAAC;YAC3B,MAAM,YAAY,CAAC,IAAI,EAAE,CAAC;YAC1B,MAAM,eAAe,CAAC,IAAI,EAAE,CAAC;YAC7B,MAAM,mBAAmB,CAAC,IAAI,EAAE,CAAC;YACjC,MAAM,gBAAgB,CAAC,IAAI,EAAE,CAAC;YAC9B,MAAM,oBAAoB,CAAC,IAAI,EAAE,CAAC;YAClC,MAAM,sBAAsB,CAAC,IAAI,EAAE,CAAC;YACpC,MAAM,iBAAiB,CAAC,IAAI,EAAE,CAAC;YAC/B,MAAM,gBAAgB,CAAC,IAAI,EAAE,CAAC;YAE9B,MAAM,mBAAmB,CAAC,IAAI,EAAE,CAAC;YACjC,MAAM,mBAAmB,CAAC,IAAI,EAAE,CAAC;YACjC,MAAM,sBAAsB,CAAC,IAAI,EAAE,CAAC;YACpC,MAAM,gBAAgB,CAAC,IAAI,EAAE,CAAC;YAC9B,MAAM,4BAA4B,CAAC,IAAI,EAAE,CAAC;YAE1C,MAAM,iBAAiB,CAAC,IAAI,EAAE,CAAC;YAE/B,MAAM,gBAAgB,CAAC,IAAI,EAAE,CAAC;YAE9B,MAAM,wBAAwB,CAAC,IAAI,EAAE,CAAC;YAEtC,MAAM,aAAa,CAAC,SAAS,EAAE,CAAC;QAClC,CAAC,CAAA;QACD,cAAc,EAAE,gBAAgB;KACjC,CAAC;AACJ,CAAC;AA9ND,oBA8NC"}
|
|
@@ -42,17 +42,19 @@ const handleGetRecentSendHistoriesMsg = (service) => {
|
|
|
42
42
|
};
|
|
43
43
|
const handleSendTxAndRecordMsg = (service) => {
|
|
44
44
|
return (_env, msg) => {
|
|
45
|
-
return service.sendTxAndRecord(msg.historyType, msg.sourceChainId, msg.destinationChainId, msg.tx, msg.mode, msg.silent, msg.sender, msg.recipient, msg.amount, msg.memo, undefined
|
|
45
|
+
return service.sendTxAndRecord(msg.historyType, msg.sourceChainId, msg.destinationChainId, msg.tx, msg.mode, msg.silent, msg.sender, msg.recipient, msg.amount, msg.memo, undefined, {
|
|
46
|
+
currencies: [],
|
|
47
|
+
});
|
|
46
48
|
};
|
|
47
49
|
};
|
|
48
50
|
const handleSendTxAndRecordWithIBCPacketForwardingMsg = (service) => {
|
|
49
51
|
return (_env, msg) => __awaiter(void 0, void 0, void 0, function* () {
|
|
50
|
-
return yield service.sendTxAndRecord(msg.historyType, msg.sourceChainId, msg.destinationChainId, msg.tx, msg.mode, msg.silent, msg.sender, msg.recipient, msg.amount, msg.memo, msg.channels);
|
|
52
|
+
return yield service.sendTxAndRecord(msg.historyType, msg.sourceChainId, msg.destinationChainId, msg.tx, msg.mode, msg.silent, msg.sender, msg.recipient, msg.amount, msg.memo, msg.channels, msg.notificationInfo);
|
|
51
53
|
});
|
|
52
54
|
};
|
|
53
55
|
const handleSendTxAndRecordWithIBCSwapMsg = (service) => {
|
|
54
56
|
return (_env, msg) => __awaiter(void 0, void 0, void 0, function* () {
|
|
55
|
-
return yield service.sendTxAndRecordIBCSwap(msg.swapType, msg.sourceChainId, msg.destinationChainId, msg.tx, msg.mode, msg.silent, msg.sender, msg.amount, msg.memo, msg.channels, msg.destinationAsset, msg.swapChannelIndex, msg.swapReceiver);
|
|
57
|
+
return yield service.sendTxAndRecordIBCSwap(msg.swapType, msg.sourceChainId, msg.destinationChainId, msg.tx, msg.mode, msg.silent, msg.sender, msg.amount, msg.memo, msg.channels, msg.destinationAsset, msg.swapChannelIndex, msg.swapReceiver, msg.notificationInfo);
|
|
56
58
|
});
|
|
57
59
|
};
|
|
58
60
|
const handleGetIBCHistoriesMsg = (service) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../../src/recent-send-history/handler.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iDAM8B;AAC9B,yCAQoB;AAGb,MAAM,UAAU,GAAmD,CACxE,OAAiC,EACjC,EAAE;IACF,OAAO,CAAC,GAAQ,EAAE,GAAqB,EAAE,EAAE;QACzC,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AG,CAAC,WAAW,EACf,GAAG,CAAC,aAAa,EACjB,GAAG,CAAC,kBAAkB,EACtB,GAAG,CAAC,EAAE,EACN,GAAG,CAAC,IAAI,EACR,GAAG,CAAC,MAAM,EACV,GAAG,CAAC,MAAM,EACV,GAAG,CAAC,SAAS,EACb,GAAG,CAAC,MAAM,EACV,GAAG,CAAC,IAAI,EACR,SAAS,
|
|
1
|
+
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../../src/recent-send-history/handler.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iDAM8B;AAC9B,yCAQoB;AAGb,MAAM,UAAU,GAAmD,CACxE,OAAiC,EACjC,EAAE;IACF,OAAO,CAAC,GAAQ,EAAE,GAAqB,EAAE,EAAE;QACzC,QAAQ,GAAG,CAAC,WAAW,EAAE;YACvB,KAAK,oCAAyB;gBAC5B,OAAO,+BAA+B,CAAC,OAAO,CAAC,CAC7C,GAAG,EACH,GAAgC,CACjC,CAAC;YACJ,KAAK,6BAAkB;gBACrB,OAAO,wBAAwB,CAAC,OAAO,CAAC,CACtC,GAAG,EACH,GAAyB,CAC1B,CAAC;YACJ,KAAK,oDAAyC;gBAC5C,OAAO,+CAA+C,CAAC,OAAO,CAAC,CAC7D,GAAG,EACH,GAAgD,CACjD,CAAC;YACJ,KAAK,wCAA6B;gBAChC,OAAO,mCAAmC,CAAC,OAAO,CAAC,CACjD,GAAG,EACH,GAAoC,CACrC,CAAC;YACJ,KAAK,6BAAkB;gBACrB,OAAO,wBAAwB,CAAC,OAAO,CAAC,CACtC,GAAG,EACH,GAAyB,CAC1B,CAAC;YACJ,KAAK,8BAAmB;gBACtB,OAAO,yBAAyB,CAAC,OAAO,CAAC,CACvC,GAAG,EACH,GAA0B,CAC3B,CAAC;YACJ,KAAK,gCAAqB;gBACxB,OAAO,2BAA2B,CAAC,OAAO,CAAC,CACzC,GAAG,EACH,GAA4B,CAC7B,CAAC;YACJ;gBACE,MAAM,IAAI,mBAAU,CAAC,IAAI,EAAE,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";
|
|
3
|
+
import { AppCurrency } from "@keplr-wallet/types";
|
|
3
4
|
export declare class GetRecentSendHistoriesMsg extends Message<RecentSendHistory[]> {
|
|
4
5
|
readonly chainId: string;
|
|
5
6
|
readonly historyType: string;
|
|
@@ -35,7 +36,9 @@ export declare class SendTxAndRecordMsg extends Message<Uint8Array> {
|
|
|
35
36
|
portId: string;
|
|
36
37
|
channelId: string;
|
|
37
38
|
counterpartyChainId: string;
|
|
38
|
-
}[]
|
|
39
|
+
}[], notificationInfo: {
|
|
40
|
+
currencies: AppCurrency[];
|
|
41
|
+
}): SendTxAndRecordWithIBCPacketForwardingMsg;
|
|
39
42
|
}
|
|
40
43
|
export declare class SendTxAndRecordWithIBCPacketForwardingMsg extends Message<Uint8Array> {
|
|
41
44
|
readonly historyType: string;
|
|
@@ -56,6 +59,9 @@ export declare class SendTxAndRecordWithIBCPacketForwardingMsg extends Message<U
|
|
|
56
59
|
readonly denom: string;
|
|
57
60
|
}[];
|
|
58
61
|
readonly memo: string;
|
|
62
|
+
readonly notificationInfo: {
|
|
63
|
+
currencies: AppCurrency[];
|
|
64
|
+
};
|
|
59
65
|
static type(): string;
|
|
60
66
|
constructor(historyType: string, sourceChainId: string, destinationChainId: string, tx: unknown, channels: {
|
|
61
67
|
portId: string;
|
|
@@ -64,7 +70,9 @@ export declare class SendTxAndRecordWithIBCPacketForwardingMsg extends Message<U
|
|
|
64
70
|
}[], mode: "async" | "sync" | "block", silent: boolean, sender: string, recipient: string, amount: {
|
|
65
71
|
readonly amount: string;
|
|
66
72
|
readonly denom: string;
|
|
67
|
-
}[], memo: string
|
|
73
|
+
}[], memo: string, notificationInfo: {
|
|
74
|
+
currencies: AppCurrency[];
|
|
75
|
+
});
|
|
68
76
|
validateBasic(): void;
|
|
69
77
|
route(): string;
|
|
70
78
|
type(): string;
|
|
@@ -93,6 +101,9 @@ export declare class SendTxAndRecordWithIBCSwapMsg extends Message<Uint8Array> {
|
|
|
93
101
|
readonly denom: string;
|
|
94
102
|
}[];
|
|
95
103
|
readonly memo: string;
|
|
104
|
+
readonly notificationInfo: {
|
|
105
|
+
currencies: AppCurrency[];
|
|
106
|
+
};
|
|
96
107
|
static type(): string;
|
|
97
108
|
constructor(swapType: "amount-in" | "amount-out", sourceChainId: string, destinationChainId: string, tx: unknown, channels: {
|
|
98
109
|
portId: string;
|
|
@@ -104,7 +115,9 @@ export declare class SendTxAndRecordWithIBCSwapMsg extends Message<Uint8Array> {
|
|
|
104
115
|
}, swapChannelIndex: number, swapReceiver: string[], mode: "async" | "sync" | "block", silent: boolean, sender: string, amount: {
|
|
105
116
|
readonly amount: string;
|
|
106
117
|
readonly denom: string;
|
|
107
|
-
}[], memo: string
|
|
118
|
+
}[], memo: string, notificationInfo: {
|
|
119
|
+
currencies: AppCurrency[];
|
|
120
|
+
});
|
|
108
121
|
validateBasic(): void;
|
|
109
122
|
route(): string;
|
|
110
123
|
type(): string;
|
|
@@ -75,8 +75,8 @@ class SendTxAndRecordMsg extends router_1.Message {
|
|
|
75
75
|
type() {
|
|
76
76
|
return SendTxAndRecordMsg.type();
|
|
77
77
|
}
|
|
78
|
-
withIBCPacketForwarding(channels) {
|
|
79
|
-
return new SendTxAndRecordWithIBCPacketForwardingMsg(this.historyType, this.sourceChainId, this.destinationChainId, this.tx, channels, this.mode, this.silent, this.sender, this.recipient, this.amount, this.memo);
|
|
78
|
+
withIBCPacketForwarding(channels, notificationInfo) {
|
|
79
|
+
return new SendTxAndRecordWithIBCPacketForwardingMsg(this.historyType, this.sourceChainId, this.destinationChainId, this.tx, channels, this.mode, this.silent, this.sender, this.recipient, this.amount, this.memo, notificationInfo);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
exports.SendTxAndRecordMsg = SendTxAndRecordMsg;
|
|
@@ -84,7 +84,7 @@ class SendTxAndRecordWithIBCPacketForwardingMsg extends router_1.Message {
|
|
|
84
84
|
static type() {
|
|
85
85
|
return "send-tx-and-record-with-ibc-packet-forwarding";
|
|
86
86
|
}
|
|
87
|
-
constructor(historyType, sourceChainId, destinationChainId, tx, channels, mode, silent, sender, recipient, amount, memo) {
|
|
87
|
+
constructor(historyType, sourceChainId, destinationChainId, tx, channels, mode, silent, sender, recipient, amount, memo, notificationInfo) {
|
|
88
88
|
super();
|
|
89
89
|
this.historyType = historyType;
|
|
90
90
|
this.sourceChainId = sourceChainId;
|
|
@@ -97,6 +97,7 @@ class SendTxAndRecordWithIBCPacketForwardingMsg extends router_1.Message {
|
|
|
97
97
|
this.recipient = recipient;
|
|
98
98
|
this.amount = amount;
|
|
99
99
|
this.memo = memo;
|
|
100
|
+
this.notificationInfo = notificationInfo;
|
|
100
101
|
}
|
|
101
102
|
validateBasic() {
|
|
102
103
|
if (!this.historyType) {
|
|
@@ -137,7 +138,7 @@ class SendTxAndRecordWithIBCSwapMsg extends router_1.Message {
|
|
|
137
138
|
static type() {
|
|
138
139
|
return "send-tx-and-record-with-ibc-swap";
|
|
139
140
|
}
|
|
140
|
-
constructor(swapType, sourceChainId, destinationChainId, tx, channels, destinationAsset, swapChannelIndex, swapReceiver, mode, silent, sender, amount, memo) {
|
|
141
|
+
constructor(swapType, sourceChainId, destinationChainId, tx, channels, destinationAsset, swapChannelIndex, swapReceiver, mode, silent, sender, amount, memo, notificationInfo) {
|
|
141
142
|
super();
|
|
142
143
|
this.swapType = swapType;
|
|
143
144
|
this.sourceChainId = sourceChainId;
|
|
@@ -152,6 +153,7 @@ class SendTxAndRecordWithIBCSwapMsg extends router_1.Message {
|
|
|
152
153
|
this.sender = sender;
|
|
153
154
|
this.amount = amount;
|
|
154
155
|
this.memo = memo;
|
|
156
|
+
this.notificationInfo = notificationInfo;
|
|
155
157
|
}
|
|
156
158
|
validateBasic() {
|
|
157
159
|
if (!this.swapType) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/recent-send-history/messages.ts"],"names":[],"mappings":";;;AAAA,iDAA+C;AAC/C,2CAAoC;
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/recent-send-history/messages.ts"],"names":[],"mappings":";;;AAAA,iDAA+C;AAC/C,2CAAoC;AAIpC,MAAa,yBAA0B,SAAQ,gBAA4B;IAClE,MAAM,CAAC,IAAI;QAChB,OAAO,2BAA2B,CAAC;IACrC,CAAC;IAED,YACkB,OAAe,EACf,WAAmB;QAEnC,KAAK,EAAE,CAAC;QAHQ,YAAO,GAAP,OAAO,CAAQ;QACf,gBAAW,GAAX,WAAW,CAAQ;IAGrC,CAAC;IAED,aAAa;QACX,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;SACtC;QAED,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YACrB,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;SAClC;IACH,CAAC;IAED,KAAK;QACH,OAAO,iBAAK,CAAC;IACf,CAAC;IAED,IAAI;QACF,OAAO,yBAAyB,CAAC,IAAI,EAAE,CAAC;IAC1C,CAAC;CACF;AA7BD,8DA6BC;AAED,MAAa,kBAAmB,SAAQ,gBAAmB;IAClD,MAAM,CAAC,IAAI;QAChB,OAAO,oBAAoB,CAAC;IAC9B,CAAC;IAED,YACkB,WAAmB,EACnB,aAAqB,EACrB,kBAA0B,EAC1B,EAAW,EACX,IAAgC,EAChC,MAAe,EACf,MAAc,EACd,SAAiB,EACjB,MAGb,EACa,IAAY;QAE5B,KAAK,EAAE,CAAC;QAdQ,gBAAW,GAAX,WAAW,CAAQ;QACnB,kBAAa,GAAb,aAAa,CAAQ;QACrB,uBAAkB,GAAlB,kBAAkB,CAAQ;QAC1B,OAAE,GAAF,EAAE,CAAS;QACX,SAAI,GAAJ,IAAI,CAA4B;QAChC,WAAM,GAAN,MAAM,CAAS;QACf,WAAM,GAAN,MAAM,CAAQ;QACd,cAAS,GAAT,SAAS,CAAQ;QACjB,WAAM,GAAN,MAAM,CAGnB;QACa,SAAI,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,CAAC;IAED,KAAK;QACH,OAAO,iBAAK,CAAC;IACf,CAAC;IAED,IAAI;QACF,OAAO,kBAAkB,CAAC,IAAI,EAAE,CAAC;IACnC,CAAC;CACF;AApBD,gDAoBC;AAED,MAAa,mBAAoB,SAAQ,gBAAqB;IACrD,MAAM,CAAC,IAAI;QAChB,OAAO,sBAAsB,CAAC;IAChC,CAAC;IAED,YAA4B,EAAU;QACpC,KAAK,EAAE,CAAC;QADkB,OAAE,GAAF,EAAE,CAAQ;IAEtC,CAAC;IAED,aAAa;QACX,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE;YACZ,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;SAChC;IACH,CAAC;IAED,KAAK;QACH,OAAO,iBAAK,CAAC;IACf,CAAC;IAED,IAAI;QACF,OAAO,mBAAmB,CAAC,IAAI,EAAE,CAAC;IACpC,CAAC;CACF;AAtBD,kDAsBC;AAED,MAAa,qBAAsB,SAAQ,gBAAa;IAC/C,MAAM,CAAC,IAAI;QAChB,OAAO,yBAAyB,CAAC;IACnC,CAAC;IAED;QACE,KAAK,EAAE,CAAC;IACV,CAAC;IAED,aAAa;QACX,OAAO;IACT,CAAC;IAED,KAAK;QACH,OAAO,iBAAK,CAAC;IACf,CAAC;IAED,IAAI;QACF,OAAO,qBAAqB,CAAC,IAAI,EAAE,CAAC;IACtC,CAAC;CACF;AApBD,sDAoBC"}
|
|
@@ -2,15 +2,17 @@ import { ChainsService } from "../chains";
|
|
|
2
2
|
import { BackgroundTxService } from "../tx";
|
|
3
3
|
import { KVStore } from "@keplr-wallet/common";
|
|
4
4
|
import { IBCHistory, RecentSendHistory } from "./types";
|
|
5
|
-
import { ChainInfo } from "@keplr-wallet/types";
|
|
5
|
+
import { AppCurrency, ChainInfo } from "@keplr-wallet/types";
|
|
6
|
+
import { Notification } from "../tx";
|
|
6
7
|
export declare class RecentSendHistoryService {
|
|
7
8
|
protected readonly kvStore: KVStore;
|
|
8
9
|
protected readonly chainsService: ChainsService;
|
|
9
10
|
protected readonly txService: BackgroundTxService;
|
|
11
|
+
protected readonly notification: Notification;
|
|
10
12
|
protected readonly recentSendHistoryMap: Map<string, RecentSendHistory[]>;
|
|
11
13
|
protected recentIBCHistorySeq: number;
|
|
12
14
|
protected readonly recentIBCHistoryMap: Map<string, IBCHistory>;
|
|
13
|
-
constructor(kvStore: KVStore, chainsService: ChainsService, txService: BackgroundTxService);
|
|
15
|
+
constructor(kvStore: KVStore, chainsService: ChainsService, txService: BackgroundTxService, notification: Notification);
|
|
14
16
|
init(): Promise<void>;
|
|
15
17
|
sendTxAndRecord(type: string, sourceChainId: string, destinationChainId: string, tx: unknown, mode: "async" | "sync" | "block", silent: boolean, sender: string, recipient: string, amount: {
|
|
16
18
|
amount: string;
|
|
@@ -19,7 +21,9 @@ export declare class RecentSendHistoryService {
|
|
|
19
21
|
portId: string;
|
|
20
22
|
channelId: string;
|
|
21
23
|
counterpartyChainId: string;
|
|
22
|
-
}[] | undefined
|
|
24
|
+
}[] | undefined, notificationInfo: {
|
|
25
|
+
currencies: AppCurrency[];
|
|
26
|
+
}): Promise<Uint8Array>;
|
|
23
27
|
sendTxAndRecordIBCSwap(swapType: "amount-in" | "amount-out", sourceChainId: string, destinationChainId: string, tx: unknown, mode: "async" | "sync" | "block", silent: boolean, sender: string, amount: {
|
|
24
28
|
amount: string;
|
|
25
29
|
denom: string;
|
|
@@ -30,7 +34,9 @@ export declare class RecentSendHistoryService {
|
|
|
30
34
|
}[], destinationAsset: {
|
|
31
35
|
chainId: string;
|
|
32
36
|
denom: string;
|
|
33
|
-
}, swapChannelIndex: number, swapReceiver: string[]
|
|
37
|
+
}, swapChannelIndex: number, swapReceiver: string[], notificationInfo: {
|
|
38
|
+
currencies: AppCurrency[];
|
|
39
|
+
}): Promise<Uint8Array>;
|
|
34
40
|
trackIBCPacketForwardingRecursive(id: string): void;
|
|
35
41
|
protected trackIBCPacketForwardingRecursiveInternal: (id: string, onFulfill: () => void, onClose: () => void, onError: () => void) => void;
|
|
36
42
|
getRecentSendHistories(chainId: string, type: string): RecentSendHistory[];
|
|
@@ -42,7 +48,9 @@ export declare class RecentSendHistoryService {
|
|
|
42
48
|
portId: string;
|
|
43
49
|
channelId: string;
|
|
44
50
|
counterpartyChainId: string;
|
|
45
|
-
}[],
|
|
51
|
+
}[], notificationInfo: {
|
|
52
|
+
currencies: AppCurrency[];
|
|
53
|
+
}, txHash: Uint8Array): string;
|
|
46
54
|
addRecentIBCSwapHistory(swapType: "amount-in" | "amount-out", chainId: string, destinationChainId: string, sender: string, amount: {
|
|
47
55
|
amount: string;
|
|
48
56
|
denom: string;
|
|
@@ -53,7 +61,9 @@ export declare class RecentSendHistoryService {
|
|
|
53
61
|
}[], destinationAsset: {
|
|
54
62
|
chainId: string;
|
|
55
63
|
denom: string;
|
|
56
|
-
}, swapChannelIndex: number, swapReceiver: string[],
|
|
64
|
+
}, swapChannelIndex: number, swapReceiver: string[], notificationInfo: {
|
|
65
|
+
currencies: AppCurrency[];
|
|
66
|
+
}, txHash: Uint8Array): string;
|
|
57
67
|
getRecentIBCHistory(id: string): IBCHistory | undefined;
|
|
58
68
|
getRecentIBCHistories(): IBCHistory[];
|
|
59
69
|
removeRecentIBCHistory(id: string): boolean;
|
|
@@ -63,6 +73,7 @@ export declare class RecentSendHistoryService {
|
|
|
63
73
|
amount: string;
|
|
64
74
|
denom: string;
|
|
65
75
|
}[];
|
|
76
|
+
protected getIBCAcknowledgementPacketIndexFromTx(tx: any, sourcePortId: string, sourceChannelId: string, sequence: string): number;
|
|
66
77
|
protected getIBCRecvPacketIndexFromTx(tx: any, sourcePortId: string, sourceChannelId: string, sequence: string): number;
|
|
67
78
|
protected getIBCPacketSequenceFromTx(tx: any, sourcePortId: string, sourceChannelId: string, startingEventIndex?: number): string;
|
|
68
79
|
protected readonly onChainRemoved: (chainInfo: ChainInfo) => void;
|
|
@@ -20,11 +20,13 @@ const cosmos_1 = require("@keplr-wallet/cosmos");
|
|
|
20
20
|
const mobx_1 = require("mobx");
|
|
21
21
|
const common_1 = require("@keplr-wallet/common");
|
|
22
22
|
const buffer_1 = require("buffer/");
|
|
23
|
+
const unit_1 = require("@keplr-wallet/unit");
|
|
23
24
|
class RecentSendHistoryService {
|
|
24
|
-
constructor(kvStore, chainsService, txService) {
|
|
25
|
+
constructor(kvStore, chainsService, txService, notification) {
|
|
25
26
|
this.kvStore = kvStore;
|
|
26
27
|
this.chainsService = chainsService;
|
|
27
28
|
this.txService = txService;
|
|
29
|
+
this.notification = notification;
|
|
28
30
|
// Key: {chain_identifier}/{type}
|
|
29
31
|
this.recentSendHistoryMap = new Map();
|
|
30
32
|
this.recentIBCHistorySeq = 0;
|
|
@@ -50,7 +52,8 @@ class RecentSendHistoryService {
|
|
|
50
52
|
}
|
|
51
53
|
return history.ibcHistory.find((h) => h.error != null) != null;
|
|
52
54
|
})();
|
|
53
|
-
if (needRewind
|
|
55
|
+
if (needRewind &&
|
|
56
|
+
!history.ibcHistory.find((h) => h.rewoundButNextRewindingBlocked)) {
|
|
54
57
|
const lastRewoundChannelIndex = history.ibcHistory.findIndex((h) => {
|
|
55
58
|
if (h.rewound) {
|
|
56
59
|
return true;
|
|
@@ -65,6 +68,10 @@ class RecentSendHistoryService {
|
|
|
65
68
|
}
|
|
66
69
|
return history.ibcHistory.find((h) => h.error != null);
|
|
67
70
|
})();
|
|
71
|
+
const isSwapTargetChannel = targetChannel &&
|
|
72
|
+
"swapChannelIndex" in history &&
|
|
73
|
+
history.ibcHistory.indexOf(targetChannel) ===
|
|
74
|
+
history.swapChannelIndex + 1;
|
|
68
75
|
if (targetChannel && targetChannel.sequence) {
|
|
69
76
|
const prevChainInfo = (() => {
|
|
70
77
|
const targetChannelIndex = history.ibcHistory.findIndex((h) => h === targetChannel);
|
|
@@ -86,8 +93,32 @@ class RecentSendHistoryService {
|
|
|
86
93
|
"acknowledge_packet.packet_src_channel": targetChannel.channelId,
|
|
87
94
|
"acknowledge_packet.packet_sequence": targetChannel.sequence,
|
|
88
95
|
})
|
|
89
|
-
.then(() => {
|
|
96
|
+
.then((res) => {
|
|
97
|
+
if (!res) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
90
100
|
(0, mobx_1.runInAction)(() => {
|
|
101
|
+
if (isSwapTargetChannel) {
|
|
102
|
+
const txs = res.txs
|
|
103
|
+
? res.txs.map((res) => res.tx_result || res)
|
|
104
|
+
: [res.tx_result || res];
|
|
105
|
+
if (txs && Array.isArray(txs)) {
|
|
106
|
+
for (const tx of txs) {
|
|
107
|
+
if (targetChannel.sequence && "swapReceiver" in history) {
|
|
108
|
+
const index = this.getIBCAcknowledgementPacketIndexFromTx(tx, targetChannel.portId, targetChannel.channelId, targetChannel.sequence);
|
|
109
|
+
if (index >= 0) {
|
|
110
|
+
const refunded = this.getIBCSwapResAmountFromTx(tx, history.swapReceiver[history.swapChannelIndex + 1], index);
|
|
111
|
+
history.swapRefundInfo = {
|
|
112
|
+
chainId: prevChainInfo.chainId,
|
|
113
|
+
amount: refunded,
|
|
114
|
+
};
|
|
115
|
+
targetChannel.rewoundButNextRewindingBlocked = true;
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
91
122
|
targetChannel.rewound = true;
|
|
92
123
|
});
|
|
93
124
|
onFulfill();
|
|
@@ -188,15 +219,79 @@ class RecentSendHistoryService {
|
|
|
188
219
|
// Because a tx can contain multiple messages, it's hard to know exactly which event we want.
|
|
189
220
|
// But logically, the events closest to the recv_packet event is the events we want.
|
|
190
221
|
const index = this.getIBCRecvPacketIndexFromTx(tx, targetChannel.portId, targetChannel.channelId, targetChannel.sequence);
|
|
191
|
-
if (
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
222
|
+
if (index >= 0) {
|
|
223
|
+
if ("swapReceiver" in history) {
|
|
224
|
+
const res = this.getIBCSwapResAmountFromTx(tx, history.swapReceiver[targetChannelIndex + 1], index);
|
|
225
|
+
history.resAmount.push(res);
|
|
226
|
+
}
|
|
227
|
+
if (nextChannel) {
|
|
228
|
+
nextChannel.sequence = this.getIBCPacketSequenceFromTx(tx, nextChannel.portId, nextChannel.channelId, index);
|
|
229
|
+
onFulfill();
|
|
230
|
+
this.trackIBCPacketForwardingRecursive(id);
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
console.log("!!!", (0, mobx_1.toJS)(history));
|
|
235
|
+
// Packet received to destination chain.
|
|
236
|
+
if (history.notificationInfo && !history.notified) {
|
|
237
|
+
(0, mobx_1.runInAction)(() => {
|
|
238
|
+
history.notified = true;
|
|
239
|
+
});
|
|
240
|
+
const chainInfo = this.chainsService.getChainInfo(history.destinationChainId);
|
|
241
|
+
if (chainInfo) {
|
|
242
|
+
if ("swapType" in history) {
|
|
243
|
+
if (history.resAmount.length > 0) {
|
|
244
|
+
const amount = history.resAmount[history.resAmount.length - 1];
|
|
245
|
+
const assetsText = amount
|
|
246
|
+
.filter((amt) => history.notificationInfo.currencies.find((cur) => cur.coinMinimalDenom === amt.denom))
|
|
247
|
+
.map((amt) => {
|
|
248
|
+
const currency = history.notificationInfo.currencies.find((cur) => cur.coinMinimalDenom === amt.denom);
|
|
249
|
+
return new unit_1.CoinPretty(currency, amt.amount)
|
|
250
|
+
.hideIBCMetadata(true)
|
|
251
|
+
.shrink(true)
|
|
252
|
+
.maxDecimals(6)
|
|
253
|
+
.inequalitySymbol(true)
|
|
254
|
+
.trim(true)
|
|
255
|
+
.toString();
|
|
256
|
+
});
|
|
257
|
+
if (assetsText.length > 0) {
|
|
258
|
+
// Notify user
|
|
259
|
+
this.notification.create({
|
|
260
|
+
iconRelativeUrl: "assets/logo-256.png",
|
|
261
|
+
title: "IBC Swap Succeeded",
|
|
262
|
+
message: `${assetsText.join(", ")} received on ${chainInfo.chainName}`,
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
console.log((0, mobx_1.toJS)(history.amount), (0, mobx_1.toJS)(history.notificationInfo));
|
|
269
|
+
const assetsText = history.amount
|
|
270
|
+
.filter((amt) => history.notificationInfo.currencies.find((cur) => cur.coinMinimalDenom === amt.denom))
|
|
271
|
+
.map((amt) => {
|
|
272
|
+
const currency = history.notificationInfo.currencies.find((cur) => cur.coinMinimalDenom === amt.denom);
|
|
273
|
+
return new unit_1.CoinPretty(currency, amt.amount)
|
|
274
|
+
.hideIBCMetadata(true)
|
|
275
|
+
.shrink(true)
|
|
276
|
+
.maxDecimals(6)
|
|
277
|
+
.inequalitySymbol(true)
|
|
278
|
+
.trim(true)
|
|
279
|
+
.toString();
|
|
280
|
+
});
|
|
281
|
+
if (assetsText.length > 0) {
|
|
282
|
+
// Notify user
|
|
283
|
+
this.notification.create({
|
|
284
|
+
iconRelativeUrl: "assets/logo-256.png",
|
|
285
|
+
title: "IBC Transfer Succeeded",
|
|
286
|
+
message: `${assetsText.join(", ")} sent to ${chainInfo.chainName}`,
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
onFulfill();
|
|
293
|
+
break;
|
|
294
|
+
}
|
|
200
295
|
}
|
|
201
296
|
}
|
|
202
297
|
catch (_a) {
|
|
@@ -295,7 +390,7 @@ class RecentSendHistoryService {
|
|
|
295
390
|
this.chainsService.addChainRemovedHandler(this.onChainRemoved);
|
|
296
391
|
});
|
|
297
392
|
}
|
|
298
|
-
sendTxAndRecord(type, sourceChainId, destinationChainId, tx, mode, silent, sender, recipient, amount, memo, ibcChannels) {
|
|
393
|
+
sendTxAndRecord(type, sourceChainId, destinationChainId, tx, mode, silent, sender, recipient, amount, memo, ibcChannels, notificationInfo) {
|
|
299
394
|
return __awaiter(this, void 0, void 0, function* () {
|
|
300
395
|
const sourceChainInfo = this.chainsService.getChainInfoOrThrow(sourceChainId);
|
|
301
396
|
cosmos_1.Bech32Address.validate(sender, sourceChainInfo.bech32Config.bech32PrefixAccAddr);
|
|
@@ -316,13 +411,13 @@ class RecentSendHistoryService {
|
|
|
316
411
|
},
|
|
317
412
|
});
|
|
318
413
|
if (ibcChannels && ibcChannels.length > 0) {
|
|
319
|
-
const id = this.addRecentIBCTransferHistory(sourceChainId, destinationChainId, sender, recipient, amount, memo, ibcChannels, txHash);
|
|
414
|
+
const id = this.addRecentIBCTransferHistory(sourceChainId, destinationChainId, sender, recipient, amount, memo, ibcChannels, notificationInfo, txHash);
|
|
320
415
|
this.trackIBCPacketForwardingRecursive(id);
|
|
321
416
|
}
|
|
322
417
|
return txHash;
|
|
323
418
|
});
|
|
324
419
|
}
|
|
325
|
-
sendTxAndRecordIBCSwap(swapType, sourceChainId, destinationChainId, tx, mode, silent, sender, amount, memo, ibcChannels, destinationAsset, swapChannelIndex, swapReceiver) {
|
|
420
|
+
sendTxAndRecordIBCSwap(swapType, sourceChainId, destinationChainId, tx, mode, silent, sender, amount, memo, ibcChannels, destinationAsset, swapChannelIndex, swapReceiver, notificationInfo) {
|
|
326
421
|
return __awaiter(this, void 0, void 0, function* () {
|
|
327
422
|
const sourceChainInfo = this.chainsService.getChainInfoOrThrow(sourceChainId);
|
|
328
423
|
cosmos_1.Bech32Address.validate(sender, sourceChainInfo.bech32Config.bech32PrefixAccAddr);
|
|
@@ -330,7 +425,7 @@ class RecentSendHistoryService {
|
|
|
330
425
|
const txHash = yield this.txService.sendTx(sourceChainId, tx, mode, {
|
|
331
426
|
silent,
|
|
332
427
|
});
|
|
333
|
-
const id = this.addRecentIBCSwapHistory(swapType, sourceChainId, destinationChainId, sender, amount, memo, ibcChannels, destinationAsset, swapChannelIndex, swapReceiver, txHash);
|
|
428
|
+
const id = this.addRecentIBCSwapHistory(swapType, sourceChainId, destinationChainId, sender, amount, memo, ibcChannels, destinationAsset, swapChannelIndex, swapReceiver, notificationInfo, txHash);
|
|
334
429
|
this.trackIBCPacketForwardingRecursive(id);
|
|
335
430
|
return txHash;
|
|
336
431
|
});
|
|
@@ -373,7 +468,7 @@ class RecentSendHistoryService {
|
|
|
373
468
|
histories = histories.slice(0, 20);
|
|
374
469
|
this.recentSendHistoryMap.set(key, histories);
|
|
375
470
|
}
|
|
376
|
-
addRecentIBCTransferHistory(chainId, destinationChainId, sender, recipient, amount, memo, ibcChannels, txHash) {
|
|
471
|
+
addRecentIBCTransferHistory(chainId, destinationChainId, sender, recipient, amount, memo, ibcChannels, notificationInfo, txHash) {
|
|
377
472
|
const id = (this.recentIBCHistorySeq++).toString();
|
|
378
473
|
const history = {
|
|
379
474
|
id,
|
|
@@ -392,12 +487,13 @@ class RecentSendHistoryService {
|
|
|
392
487
|
completed: false,
|
|
393
488
|
};
|
|
394
489
|
}),
|
|
490
|
+
notificationInfo,
|
|
395
491
|
txHash: buffer_1.Buffer.from(txHash).toString("hex"),
|
|
396
492
|
};
|
|
397
493
|
this.recentIBCHistoryMap.set(id, history);
|
|
398
494
|
return id;
|
|
399
495
|
}
|
|
400
|
-
addRecentIBCSwapHistory(swapType, chainId, destinationChainId, sender, amount, memo, ibcChannels, destinationAsset, swapChannelIndex, swapReceiver, txHash) {
|
|
496
|
+
addRecentIBCSwapHistory(swapType, chainId, destinationChainId, sender, amount, memo, ibcChannels, destinationAsset, swapChannelIndex, swapReceiver, notificationInfo, txHash) {
|
|
401
497
|
const id = (this.recentIBCHistorySeq++).toString();
|
|
402
498
|
const history = {
|
|
403
499
|
id,
|
|
@@ -420,6 +516,7 @@ class RecentSendHistoryService {
|
|
|
420
516
|
swapChannelIndex,
|
|
421
517
|
swapReceiver,
|
|
422
518
|
resAmount: [],
|
|
519
|
+
notificationInfo,
|
|
423
520
|
txHash: buffer_1.Buffer.from(txHash).toString("hex"),
|
|
424
521
|
};
|
|
425
522
|
this.recentIBCHistoryMap.set(id, history);
|
|
@@ -583,6 +680,72 @@ class RecentSendHistoryService {
|
|
|
583
680
|
}
|
|
584
681
|
return [];
|
|
585
682
|
}
|
|
683
|
+
getIBCAcknowledgementPacketIndexFromTx(tx, sourcePortId, sourceChannelId, sequence) {
|
|
684
|
+
const events = tx.events;
|
|
685
|
+
if (!events) {
|
|
686
|
+
throw new Error("Invalid tx");
|
|
687
|
+
}
|
|
688
|
+
if (!Array.isArray(events)) {
|
|
689
|
+
throw new Error("Invalid tx");
|
|
690
|
+
}
|
|
691
|
+
// In injective, events from tendermint rpc is not encoded as base64.
|
|
692
|
+
// I don't know that this is the difference from tendermint version, or just custom from injective.
|
|
693
|
+
const compareStringWithBase64OrPlain = (target, value) => {
|
|
694
|
+
if (target === value) {
|
|
695
|
+
return [true, false];
|
|
696
|
+
}
|
|
697
|
+
if (target === buffer_1.Buffer.from(value).toString("base64")) {
|
|
698
|
+
return [true, true];
|
|
699
|
+
}
|
|
700
|
+
return [false, false];
|
|
701
|
+
};
|
|
702
|
+
const packetEvent = events.find((event) => {
|
|
703
|
+
if (event.type !== "acknowledge_packet") {
|
|
704
|
+
return false;
|
|
705
|
+
}
|
|
706
|
+
const sourcePortAttr = event.attributes.find((attr) => {
|
|
707
|
+
return compareStringWithBase64OrPlain(attr.key, "packet_src_port")[0];
|
|
708
|
+
});
|
|
709
|
+
if (!sourcePortAttr) {
|
|
710
|
+
return false;
|
|
711
|
+
}
|
|
712
|
+
const sourceChannelAttr = event.attributes.find((attr) => {
|
|
713
|
+
return compareStringWithBase64OrPlain(attr.key, "packet_src_channel")[0];
|
|
714
|
+
});
|
|
715
|
+
if (!sourceChannelAttr) {
|
|
716
|
+
return false;
|
|
717
|
+
}
|
|
718
|
+
let isBase64 = false;
|
|
719
|
+
const sequenceAttr = event.attributes.find((attr) => {
|
|
720
|
+
const c = compareStringWithBase64OrPlain(attr.key, "packet_sequence");
|
|
721
|
+
isBase64 = c[1];
|
|
722
|
+
return c[0];
|
|
723
|
+
});
|
|
724
|
+
if (!sequenceAttr) {
|
|
725
|
+
return false;
|
|
726
|
+
}
|
|
727
|
+
if (isBase64) {
|
|
728
|
+
return (buffer_1.Buffer.from(sourcePortAttr.value, "base64").toString() ===
|
|
729
|
+
sourcePortId &&
|
|
730
|
+
buffer_1.Buffer.from(sourceChannelAttr.value, "base64").toString() ===
|
|
731
|
+
sourceChannelId &&
|
|
732
|
+
buffer_1.Buffer.from(sequenceAttr.value, "base64").toString() === sequence);
|
|
733
|
+
}
|
|
734
|
+
else {
|
|
735
|
+
return (sourcePortAttr.value === sourcePortId &&
|
|
736
|
+
sourceChannelAttr.value === sourceChannelId &&
|
|
737
|
+
sequenceAttr.value === sequence);
|
|
738
|
+
}
|
|
739
|
+
});
|
|
740
|
+
if (!packetEvent) {
|
|
741
|
+
throw new Error("Invalid tx");
|
|
742
|
+
}
|
|
743
|
+
const index = events.indexOf(packetEvent);
|
|
744
|
+
if (index < 0) {
|
|
745
|
+
throw new Error("Invalid tx");
|
|
746
|
+
}
|
|
747
|
+
return index;
|
|
748
|
+
}
|
|
586
749
|
getIBCRecvPacketIndexFromTx(tx, sourcePortId, sourceChannelId, sequence) {
|
|
587
750
|
const events = tx.events;
|
|
588
751
|
if (!events) {
|