@tonconnect/ui 2.0.3-beta.0 → 2.0.3-beta.2
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/README.md +48 -0
- package/dist/tonconnect-ui.min.js +209 -209
- package/dist/tonconnect-ui.min.js.map +1 -1
- package/lib/index.cjs +80 -147
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.ts +20 -232
- package/lib/index.mjs +71 -138
- package/lib/index.mjs.map +1 -1
- package/package.json +2 -2
package/lib/index.cjs
CHANGED
|
@@ -10036,18 +10036,26 @@ const WalletsModal = () => {
|
|
|
10036
10036
|
return (_a2 = appState.connectRequestParameters) == null ? void 0 : _a2.value;
|
|
10037
10037
|
});
|
|
10038
10038
|
const onClose = (closeReason) => {
|
|
10039
|
-
|
|
10040
|
-
status: "closed",
|
|
10041
|
-
closeReason
|
|
10042
|
-
});
|
|
10043
|
-
setSelectedWalletInfo(null);
|
|
10044
|
-
setInfoTab(false);
|
|
10039
|
+
tonConnectUI.closeModal(closeReason);
|
|
10045
10040
|
};
|
|
10046
10041
|
const unsubscribe = connector.onStatusChange((wallet) => {
|
|
10047
10042
|
if (wallet) {
|
|
10048
10043
|
onClose("wallet-selected");
|
|
10049
10044
|
}
|
|
10050
10045
|
});
|
|
10046
|
+
const onSelectAllWallets = () => {
|
|
10047
|
+
setSelectedTab("all-wallets");
|
|
10048
|
+
};
|
|
10049
|
+
const onSelectUniversal = () => {
|
|
10050
|
+
setSelectedTab("universal");
|
|
10051
|
+
};
|
|
10052
|
+
const clearSelectedWalletInfo = () => {
|
|
10053
|
+
setSelectedWalletInfo(null);
|
|
10054
|
+
};
|
|
10055
|
+
onCleanup(() => {
|
|
10056
|
+
setSelectedWalletInfo(null);
|
|
10057
|
+
setInfoTab(false);
|
|
10058
|
+
});
|
|
10051
10059
|
onCleanup(unsubscribe);
|
|
10052
10060
|
return createComponent(StyledModal, {
|
|
10053
10061
|
get opened() {
|
|
@@ -10112,7 +10120,7 @@ const WalletsModal = () => {
|
|
|
10112
10120
|
get additionalRequest() {
|
|
10113
10121
|
return additionalRequest();
|
|
10114
10122
|
},
|
|
10115
|
-
onBackClick:
|
|
10123
|
+
onBackClick: clearSelectedWalletInfo
|
|
10116
10124
|
});
|
|
10117
10125
|
}
|
|
10118
10126
|
}), createComponent(Match, {
|
|
@@ -10131,7 +10139,7 @@ const WalletsModal = () => {
|
|
|
10131
10139
|
get additionalRequest() {
|
|
10132
10140
|
return additionalRequest();
|
|
10133
10141
|
},
|
|
10134
|
-
onSelectAllWallets
|
|
10142
|
+
onSelectAllWallets
|
|
10135
10143
|
});
|
|
10136
10144
|
}
|
|
10137
10145
|
}), createComponent(Match, {
|
|
@@ -10143,7 +10151,7 @@ const WalletsModal = () => {
|
|
|
10143
10151
|
get walletsList() {
|
|
10144
10152
|
return walletsList();
|
|
10145
10153
|
},
|
|
10146
|
-
onBack:
|
|
10154
|
+
onBack: onSelectUniversal,
|
|
10147
10155
|
onSelect: setSelectedWalletInfo
|
|
10148
10156
|
});
|
|
10149
10157
|
}
|
|
@@ -10398,6 +10406,7 @@ const SingleWalletModal = () => {
|
|
|
10398
10406
|
}
|
|
10399
10407
|
});
|
|
10400
10408
|
const connector = useContext(ConnectorContext);
|
|
10409
|
+
const tonConnectUI = useContext(TonConnectUiContext);
|
|
10401
10410
|
const [infoTab, setInfoTab] = createSignal(false);
|
|
10402
10411
|
const additionalRequestLoading = () => {
|
|
10403
10412
|
var _a2;
|
|
@@ -10411,11 +10420,7 @@ const SingleWalletModal = () => {
|
|
|
10411
10420
|
return (_a2 = appState.connectRequestParameters) == null ? void 0 : _a2.value;
|
|
10412
10421
|
});
|
|
10413
10422
|
const onClose = (closeReason) => {
|
|
10414
|
-
|
|
10415
|
-
status: "closed",
|
|
10416
|
-
closeReason
|
|
10417
|
-
});
|
|
10418
|
-
setInfoTab(false);
|
|
10423
|
+
tonConnectUI.closeSingleWalletModal(closeReason);
|
|
10419
10424
|
};
|
|
10420
10425
|
const unsubscribe = connector.onStatusChange((wallet) => {
|
|
10421
10426
|
if (wallet) {
|
|
@@ -10423,6 +10428,9 @@ const SingleWalletModal = () => {
|
|
|
10423
10428
|
}
|
|
10424
10429
|
});
|
|
10425
10430
|
onCleanup(unsubscribe);
|
|
10431
|
+
onCleanup(() => {
|
|
10432
|
+
setInfoTab(false);
|
|
10433
|
+
});
|
|
10426
10434
|
return createComponent(StyledModal, {
|
|
10427
10435
|
get opened() {
|
|
10428
10436
|
return getSingleWalletModalIsOpened();
|
|
@@ -10572,8 +10580,10 @@ class WalletsModalManager {
|
|
|
10572
10580
|
__publicField(this, "connector");
|
|
10573
10581
|
__publicField(this, "setConnectRequestParametersCallback");
|
|
10574
10582
|
__publicField(this, "consumers", []);
|
|
10583
|
+
__publicField(this, "tracker");
|
|
10575
10584
|
__publicField(this, "state", walletsModalState());
|
|
10576
10585
|
this.connector = options.connector;
|
|
10586
|
+
this.tracker = options.tracker;
|
|
10577
10587
|
this.setConnectRequestParametersCallback = options.setConnectRequestParametersCallback;
|
|
10578
10588
|
createEffect(() => {
|
|
10579
10589
|
const state = walletsModalState();
|
|
@@ -10583,6 +10593,7 @@ class WalletsModalManager {
|
|
|
10583
10593
|
}
|
|
10584
10594
|
open() {
|
|
10585
10595
|
return __async(this, null, function* () {
|
|
10596
|
+
this.tracker.trackConnectionStarted();
|
|
10586
10597
|
const walletsList = yield this.connector.getWallets();
|
|
10587
10598
|
const embeddedWallet = walletsList.find(sdk.isWalletInfoCurrentlyEmbedded);
|
|
10588
10599
|
if (embeddedWallet) {
|
|
@@ -10592,8 +10603,11 @@ class WalletsModalManager {
|
|
|
10592
10603
|
}
|
|
10593
10604
|
});
|
|
10594
10605
|
}
|
|
10595
|
-
close() {
|
|
10596
|
-
|
|
10606
|
+
close(reason = "action-cancelled") {
|
|
10607
|
+
if (reason === "action-cancelled") {
|
|
10608
|
+
this.tracker.trackConnectionError("Connection was cancelled");
|
|
10609
|
+
}
|
|
10610
|
+
widgetController.closeWalletsModal(reason);
|
|
10597
10611
|
}
|
|
10598
10612
|
onStateChange(onChange) {
|
|
10599
10613
|
this.consumers.push(onChange);
|
|
@@ -10653,8 +10667,10 @@ class SingleWalletModalManager {
|
|
|
10653
10667
|
__publicField(this, "connector");
|
|
10654
10668
|
__publicField(this, "setConnectRequestParametersCallback");
|
|
10655
10669
|
__publicField(this, "consumers", []);
|
|
10670
|
+
__publicField(this, "tracker");
|
|
10656
10671
|
__publicField(this, "state", singleWalletModalState());
|
|
10657
10672
|
this.connector = options.connector;
|
|
10673
|
+
this.tracker = options.tracker;
|
|
10658
10674
|
this.setConnectRequestParametersCallback = options.setConnectRequestParametersCallback;
|
|
10659
10675
|
createEffect(() => {
|
|
10660
10676
|
const state = singleWalletModalState();
|
|
@@ -10664,6 +10680,7 @@ class SingleWalletModalManager {
|
|
|
10664
10680
|
}
|
|
10665
10681
|
open(wallet) {
|
|
10666
10682
|
return __async(this, null, function* () {
|
|
10683
|
+
this.tracker.trackConnectionStarted();
|
|
10667
10684
|
const fetchedWalletsList = yield this.connector.getWallets();
|
|
10668
10685
|
const walletsList = applyWalletsListConfiguration(
|
|
10669
10686
|
fetchedWalletsList,
|
|
@@ -10680,10 +10697,15 @@ class SingleWalletModalManager {
|
|
|
10680
10697
|
if (isExternalWalletExist) {
|
|
10681
10698
|
return this.openSingleWalletModal(externalWallet);
|
|
10682
10699
|
}
|
|
10683
|
-
|
|
10700
|
+
const error = `Trying to open modal window with unknown wallet "${wallet}".`;
|
|
10701
|
+
this.tracker.trackConnectionError(error);
|
|
10702
|
+
throw new TonConnectUIError(error);
|
|
10684
10703
|
});
|
|
10685
10704
|
}
|
|
10686
|
-
close() {
|
|
10705
|
+
close(reason = "action-cancelled") {
|
|
10706
|
+
if (reason === "action-cancelled") {
|
|
10707
|
+
this.tracker.trackConnectionError("Connection was cancelled");
|
|
10708
|
+
}
|
|
10687
10709
|
widgetController.closeSingleWalletModal("action-cancelled");
|
|
10688
10710
|
}
|
|
10689
10711
|
onStateChange(onChange) {
|
|
@@ -10722,181 +10744,86 @@ class SingleWalletModalManager {
|
|
|
10722
10744
|
});
|
|
10723
10745
|
}
|
|
10724
10746
|
}
|
|
10725
|
-
|
|
10726
|
-
|
|
10727
|
-
let authType = null;
|
|
10728
|
-
if ((_a2 = wallet == null ? void 0 : wallet.connectItems) == null ? void 0 : _a2.tonProof) {
|
|
10729
|
-
authType = "proof" in wallet.connectItems.tonProof ? "ton_proof" : null;
|
|
10730
|
-
} else if (wallet == null ? void 0 : wallet.connectItems) {
|
|
10731
|
-
authType = "ton_addr";
|
|
10732
|
-
}
|
|
10733
|
-
return {
|
|
10734
|
-
address: (_c2 = (_b2 = wallet == null ? void 0 : wallet.account) == null ? void 0 : _b2.address) != null ? _c2 : null,
|
|
10735
|
-
chainId: (_e2 = (_d2 = wallet == null ? void 0 : wallet.account) == null ? void 0 : _d2.chain) != null ? _e2 : null,
|
|
10736
|
-
provider: (_f2 = wallet == null ? void 0 : wallet.provider) != null ? _f2 : null,
|
|
10737
|
-
walletType: (_g2 = wallet == null ? void 0 : wallet.device.appName) != null ? _g2 : null,
|
|
10738
|
-
walletVersion: (_h2 = wallet == null ? void 0 : wallet.device.appVersion) != null ? _h2 : null,
|
|
10739
|
-
authType
|
|
10740
|
-
};
|
|
10741
|
-
}
|
|
10742
|
-
function createConnectionStartedEvent() {
|
|
10743
|
-
return {
|
|
10744
|
-
type: "connection-started"
|
|
10745
|
-
};
|
|
10746
|
-
}
|
|
10747
|
-
function createConnectionCompletedEvent(wallet) {
|
|
10748
|
-
return {
|
|
10749
|
-
type: "connection-completed",
|
|
10750
|
-
connectionInfo: createConnnectionInfo(wallet)
|
|
10751
|
-
};
|
|
10752
|
-
}
|
|
10753
|
-
function createConnectionErrorEvent(reason) {
|
|
10754
|
-
return {
|
|
10755
|
-
type: "connection-error",
|
|
10756
|
-
reason
|
|
10757
|
-
};
|
|
10758
|
-
}
|
|
10759
|
-
function createConnectionRestoringStartedEvent() {
|
|
10760
|
-
return {
|
|
10761
|
-
type: "connection-restoring-started"
|
|
10762
|
-
};
|
|
10763
|
-
}
|
|
10764
|
-
function createConnectionRestoringCompletedEvent(wallet) {
|
|
10765
|
-
return {
|
|
10766
|
-
type: "connection-restoring-completed",
|
|
10767
|
-
connectionInfo: createConnnectionInfo(wallet)
|
|
10768
|
-
};
|
|
10769
|
-
}
|
|
10770
|
-
function createConnectionRestoringErrorEvent(reason) {
|
|
10771
|
-
return {
|
|
10772
|
-
type: "connection-restoring-error",
|
|
10773
|
-
reason
|
|
10774
|
-
};
|
|
10775
|
-
}
|
|
10776
|
-
function createTransactionInfo(transaction) {
|
|
10777
|
-
var _a2, _b2;
|
|
10778
|
-
return {
|
|
10779
|
-
validUntil: (_a2 = transaction.validUntil) != null ? _a2 : null,
|
|
10780
|
-
from: (_b2 = transaction.from) != null ? _b2 : null,
|
|
10781
|
-
messages: transaction.messages.map((message) => {
|
|
10782
|
-
var _a3, _b3;
|
|
10783
|
-
return {
|
|
10784
|
-
address: (_a3 = message.address) != null ? _a3 : null,
|
|
10785
|
-
amount: (_b3 = message.amount) != null ? _b3 : null
|
|
10786
|
-
};
|
|
10787
|
-
})
|
|
10788
|
-
};
|
|
10789
|
-
}
|
|
10790
|
-
function createTransactionSentForSignatureEvent(wallet, transaction) {
|
|
10791
|
-
return {
|
|
10792
|
-
type: "transaction-sent-for-signature",
|
|
10793
|
-
connectionInfo: createConnnectionInfo(wallet),
|
|
10794
|
-
transactionInfo: createTransactionInfo(transaction)
|
|
10795
|
-
};
|
|
10796
|
-
}
|
|
10797
|
-
function createTransactionSignedEvent(wallet, transaction, signedTransaction) {
|
|
10798
|
-
return {
|
|
10799
|
-
type: "transaction-signed",
|
|
10800
|
-
connectionInfo: createConnnectionInfo(wallet),
|
|
10801
|
-
transactionInfo: createTransactionInfo(transaction),
|
|
10802
|
-
signedTransaction: signedTransaction.boc
|
|
10803
|
-
};
|
|
10804
|
-
}
|
|
10805
|
-
function createTransactionSigningFailedEvent(wallet, transaction, reason) {
|
|
10806
|
-
return {
|
|
10807
|
-
type: "transaction-signing-failed",
|
|
10808
|
-
connectionInfo: createConnnectionInfo(wallet),
|
|
10809
|
-
transactionInfo: createTransactionInfo(transaction),
|
|
10810
|
-
reason
|
|
10811
|
-
};
|
|
10812
|
-
}
|
|
10813
|
-
function createDisconnectionEvent(wallet, scope) {
|
|
10814
|
-
return {
|
|
10815
|
-
type: "disconnection",
|
|
10816
|
-
connectionInfo: createConnnectionInfo(wallet),
|
|
10817
|
-
scope
|
|
10818
|
-
};
|
|
10819
|
-
}
|
|
10820
|
-
class TonConnectTracker {
|
|
10821
|
-
constructor() {
|
|
10747
|
+
class TonConnectUITracker {
|
|
10748
|
+
constructor(eventDispatcher) {
|
|
10822
10749
|
__publicField(this, "eventPrefix", "ton-connect-ui-");
|
|
10823
|
-
__publicField(this, "
|
|
10750
|
+
__publicField(this, "eventDispatcher");
|
|
10751
|
+
this.eventDispatcher = eventDispatcher != null ? eventDispatcher : new sdk.BrowserEventDispatcher();
|
|
10824
10752
|
}
|
|
10825
10753
|
dispatchUserActionEvent(eventDetails) {
|
|
10826
10754
|
var _a2;
|
|
10827
10755
|
try {
|
|
10828
10756
|
const eventName = `${this.eventPrefix}${eventDetails.type}`;
|
|
10829
|
-
|
|
10830
|
-
(_a2 = this.window) == null ? void 0 : _a2.dispatchEvent(event);
|
|
10757
|
+
(_a2 = this.eventDispatcher) == null ? void 0 : _a2.dispatchEvent(eventName, eventDetails).catch();
|
|
10831
10758
|
} catch (e2) {
|
|
10832
10759
|
}
|
|
10833
10760
|
}
|
|
10834
10761
|
trackConnectionStarted(...args) {
|
|
10835
10762
|
try {
|
|
10836
|
-
const event = createConnectionStartedEvent(...args);
|
|
10763
|
+
const event = sdk.createConnectionStartedEvent(...args);
|
|
10837
10764
|
this.dispatchUserActionEvent(event);
|
|
10838
10765
|
} catch (e2) {
|
|
10839
10766
|
}
|
|
10840
10767
|
}
|
|
10841
10768
|
trackConnectionCompleted(...args) {
|
|
10842
10769
|
try {
|
|
10843
|
-
const event = createConnectionCompletedEvent(...args);
|
|
10770
|
+
const event = sdk.createConnectionCompletedEvent(...args);
|
|
10844
10771
|
this.dispatchUserActionEvent(event);
|
|
10845
10772
|
} catch (e2) {
|
|
10846
10773
|
}
|
|
10847
10774
|
}
|
|
10848
10775
|
trackConnectionError(...args) {
|
|
10849
10776
|
try {
|
|
10850
|
-
const event = createConnectionErrorEvent(...args);
|
|
10777
|
+
const event = sdk.createConnectionErrorEvent(...args);
|
|
10851
10778
|
this.dispatchUserActionEvent(event);
|
|
10852
10779
|
} catch (e2) {
|
|
10853
10780
|
}
|
|
10854
10781
|
}
|
|
10855
10782
|
trackConnectionRestoringStarted(...args) {
|
|
10856
10783
|
try {
|
|
10857
|
-
const event = createConnectionRestoringStartedEvent(...args);
|
|
10784
|
+
const event = sdk.createConnectionRestoringStartedEvent(...args);
|
|
10858
10785
|
this.dispatchUserActionEvent(event);
|
|
10859
10786
|
} catch (e2) {
|
|
10860
10787
|
}
|
|
10861
10788
|
}
|
|
10862
10789
|
trackConnectionRestoringCompleted(...args) {
|
|
10863
10790
|
try {
|
|
10864
|
-
const event = createConnectionRestoringCompletedEvent(...args);
|
|
10791
|
+
const event = sdk.createConnectionRestoringCompletedEvent(...args);
|
|
10865
10792
|
this.dispatchUserActionEvent(event);
|
|
10866
10793
|
} catch (e2) {
|
|
10867
10794
|
}
|
|
10868
10795
|
}
|
|
10869
10796
|
trackConnectionRestoringError(...args) {
|
|
10870
10797
|
try {
|
|
10871
|
-
const event = createConnectionRestoringErrorEvent(...args);
|
|
10798
|
+
const event = sdk.createConnectionRestoringErrorEvent(...args);
|
|
10872
10799
|
this.dispatchUserActionEvent(event);
|
|
10873
10800
|
} catch (e2) {
|
|
10874
10801
|
}
|
|
10875
10802
|
}
|
|
10876
10803
|
trackDisconnection(...args) {
|
|
10877
10804
|
try {
|
|
10878
|
-
const event = createDisconnectionEvent(...args);
|
|
10805
|
+
const event = sdk.createDisconnectionEvent(...args);
|
|
10879
10806
|
this.dispatchUserActionEvent(event);
|
|
10880
10807
|
} catch (e2) {
|
|
10881
10808
|
}
|
|
10882
10809
|
}
|
|
10883
10810
|
trackTransactionSentForSignature(...args) {
|
|
10884
10811
|
try {
|
|
10885
|
-
const event = createTransactionSentForSignatureEvent(...args);
|
|
10812
|
+
const event = sdk.createTransactionSentForSignatureEvent(...args);
|
|
10886
10813
|
this.dispatchUserActionEvent(event);
|
|
10887
10814
|
} catch (e2) {
|
|
10888
10815
|
}
|
|
10889
10816
|
}
|
|
10890
10817
|
trackTransactionSigned(...args) {
|
|
10891
10818
|
try {
|
|
10892
|
-
const event = createTransactionSignedEvent(...args);
|
|
10819
|
+
const event = sdk.createTransactionSignedEvent(...args);
|
|
10893
10820
|
this.dispatchUserActionEvent(event);
|
|
10894
10821
|
} catch (e2) {
|
|
10895
10822
|
}
|
|
10896
10823
|
}
|
|
10897
10824
|
trackTransactionSigningFailed(...args) {
|
|
10898
10825
|
try {
|
|
10899
|
-
const event = createTransactionSigningFailedEvent(...args);
|
|
10826
|
+
const event = sdk.createTransactionSigningFailedEvent(...args);
|
|
10900
10827
|
this.dispatchUserActionEvent(event);
|
|
10901
10828
|
} catch (e2) {
|
|
10902
10829
|
}
|
|
@@ -10906,7 +10833,7 @@ class TonConnectUI {
|
|
|
10906
10833
|
constructor(options) {
|
|
10907
10834
|
__publicField(this, "walletInfoStorage", new WalletInfoStorage());
|
|
10908
10835
|
__publicField(this, "preferredWalletStorage", new PreferredWalletStorage());
|
|
10909
|
-
__publicField(this, "tracker"
|
|
10836
|
+
__publicField(this, "tracker");
|
|
10910
10837
|
__publicField(this, "walletInfo", null);
|
|
10911
10838
|
__publicField(this, "systemThemeChangeUnsubscribe", null);
|
|
10912
10839
|
__publicField(this, "actionsConfiguration");
|
|
@@ -10920,20 +10847,26 @@ class TonConnectUI {
|
|
|
10920
10847
|
if (options && "connector" in options && options.connector) {
|
|
10921
10848
|
this.connector = options.connector;
|
|
10922
10849
|
} else if (options && "manifestUrl" in options && options.manifestUrl) {
|
|
10923
|
-
this.connector = new sdk.TonConnect({
|
|
10850
|
+
this.connector = new sdk.TonConnect({
|
|
10851
|
+
manifestUrl: options.manifestUrl,
|
|
10852
|
+
eventDispatcher: options == null ? void 0 : options.eventDispatcher
|
|
10853
|
+
});
|
|
10924
10854
|
} else {
|
|
10925
10855
|
throw new TonConnectUIError(
|
|
10926
10856
|
"You have to specify a `manifestUrl` or a `connector` in the options."
|
|
10927
10857
|
);
|
|
10928
10858
|
}
|
|
10859
|
+
this.tracker = new TonConnectUITracker(options == null ? void 0 : options.eventDispatcher);
|
|
10929
10860
|
this.modal = new WalletsModalManager({
|
|
10930
10861
|
connector: this.connector,
|
|
10862
|
+
tracker: this.tracker,
|
|
10931
10863
|
setConnectRequestParametersCallback: (callback) => {
|
|
10932
10864
|
this.connectRequestParametersCallback = callback;
|
|
10933
10865
|
}
|
|
10934
10866
|
});
|
|
10935
10867
|
this.singleWalletModal = new SingleWalletModalManager({
|
|
10936
10868
|
connector: this.connector,
|
|
10869
|
+
tracker: this.tracker,
|
|
10937
10870
|
setConnectRequestParametersCallback: (callback) => {
|
|
10938
10871
|
this.connectRequestParametersCallback = callback;
|
|
10939
10872
|
}
|
|
@@ -11048,13 +10981,11 @@ class TonConnectUI {
|
|
|
11048
10981
|
}
|
|
11049
10982
|
openModal() {
|
|
11050
10983
|
return __async(this, null, function* () {
|
|
11051
|
-
this.tracker.trackConnectionStarted();
|
|
11052
10984
|
return this.modal.open();
|
|
11053
10985
|
});
|
|
11054
10986
|
}
|
|
11055
|
-
closeModal() {
|
|
11056
|
-
this.
|
|
11057
|
-
this.modal.close();
|
|
10987
|
+
closeModal(reason) {
|
|
10988
|
+
this.modal.close(reason);
|
|
11058
10989
|
}
|
|
11059
10990
|
onModalStateChange(onChange) {
|
|
11060
10991
|
return this.modal.onStateChange(onChange);
|
|
@@ -11064,13 +10995,11 @@ class TonConnectUI {
|
|
|
11064
10995
|
}
|
|
11065
10996
|
openSingleWalletModal(wallet) {
|
|
11066
10997
|
return __async(this, null, function* () {
|
|
11067
|
-
this.tracker.trackConnectionStarted();
|
|
11068
10998
|
return this.singleWalletModal.open(wallet);
|
|
11069
10999
|
});
|
|
11070
11000
|
}
|
|
11071
|
-
closeSingleWalletModal() {
|
|
11072
|
-
this.
|
|
11073
|
-
this.singleWalletModal.close();
|
|
11001
|
+
closeSingleWalletModal(closeReason) {
|
|
11002
|
+
this.singleWalletModal.close(closeReason);
|
|
11074
11003
|
}
|
|
11075
11004
|
onSingleWalletModalStateChange(onChange) {
|
|
11076
11005
|
return this.singleWalletModal.onStateChange(onChange);
|
|
@@ -11170,7 +11099,6 @@ class TonConnectUI {
|
|
|
11170
11099
|
});
|
|
11171
11100
|
return result;
|
|
11172
11101
|
} catch (e2) {
|
|
11173
|
-
this.tracker.trackTransactionSigningFailed(this.wallet, tx, e2.message);
|
|
11174
11102
|
widgetController.setAction({
|
|
11175
11103
|
name: "transaction-canceled",
|
|
11176
11104
|
showNotification: notifications2.includes("error"),
|
|
@@ -11277,6 +11205,7 @@ class TonConnectUI {
|
|
|
11277
11205
|
return new Promise((resolve, reject) => {
|
|
11278
11206
|
const { transaction, signal } = options;
|
|
11279
11207
|
if (signal.aborted) {
|
|
11208
|
+
this.tracker.trackTransactionSigningFailed(this.wallet, transaction, "Transaction was cancelled");
|
|
11280
11209
|
return reject(new TonConnectUIError("Transaction was not sent"));
|
|
11281
11210
|
}
|
|
11282
11211
|
const onTransactionHandler = (transaction2) => __async(this, null, function* () {
|
|
@@ -11285,14 +11214,18 @@ class TonConnectUI {
|
|
|
11285
11214
|
const onErrorsHandler = (reason) => {
|
|
11286
11215
|
reject(reason);
|
|
11287
11216
|
};
|
|
11288
|
-
|
|
11289
|
-
|
|
11290
|
-
"
|
|
11291
|
-
|
|
11292
|
-
|
|
11293
|
-
|
|
11294
|
-
|
|
11295
|
-
|
|
11217
|
+
const onCanceledHandler = () => {
|
|
11218
|
+
this.tracker.trackTransactionSigningFailed(this.wallet, transaction, "Transaction was cancelled");
|
|
11219
|
+
reject(new TonConnectUIError("Transaction was not sent"));
|
|
11220
|
+
};
|
|
11221
|
+
signal.addEventListener("abort", onCanceledHandler, { once: true });
|
|
11222
|
+
this.connector.sendTransaction(transaction, { onRequestSent, signal }).then((result) => {
|
|
11223
|
+
signal.removeEventListener("abort", onCanceledHandler);
|
|
11224
|
+
return onTransactionHandler(result);
|
|
11225
|
+
}).catch((reason) => {
|
|
11226
|
+
signal.removeEventListener("abort", onCanceledHandler);
|
|
11227
|
+
return onErrorsHandler(reason);
|
|
11228
|
+
});
|
|
11296
11229
|
});
|
|
11297
11230
|
});
|
|
11298
11231
|
}
|