@tonconnect/ui 2.4.0-beta.1 → 2.4.0-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/dist/tonconnect-ui.min.js +239 -239
- package/dist/tonconnect-ui.min.js.map +1 -1
- package/lib/index.cjs +51 -12
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.ts +6 -3
- package/lib/index.mjs +52 -13
- package/lib/index.mjs.map +1 -1
- package/package.json +2 -2
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WalletInfoInjectable, WalletInfoRemote, RequiredFeatures, VersionEvent, ConnectionEvent, ConnectionRestoringEvent, DisconnectionEvent, TransactionSigningEvent, DataSigningEvent, WalletModalOpenedEvent, SelectedWalletEvent, EventDispatcher, SdkActionEvent, ITonConnect, Wallet, OptionalTraceable, FeatureName, WalletInfo, Account, ConnectAdditionalRequest, ChainId, TonConnectError, SendTransactionRequest, SendTransactionResponse, SignDataPayload, SignDataResponse } from '@tonconnect/sdk';
|
|
1
|
+
import { WalletInfoInjectable, WalletInfoRemote, RequiredFeatures, VersionEvent, ConnectionEvent, ConnectionRestoringEvent, DisconnectionEvent, TransactionSigningEvent, DataSigningEvent, WalletModalOpenedEvent, SelectedWalletEvent, EventDispatcher, SdkActionEvent, ITonConnect, WalletInfoBase, Wallet, OptionalTraceable, FeatureName, WalletInfo, Account, ConnectAdditionalRequest, ChainId, TonConnectError, SendTransactionRequest, SendTransactionResponse, SignDataPayload, SignDataResponse } from '@tonconnect/sdk';
|
|
2
2
|
export * from '@tonconnect/sdk';
|
|
3
3
|
import { Property } from 'csstype';
|
|
4
4
|
|
|
@@ -214,10 +214,13 @@ interface TonConnectUiCreateOptionsBase extends TonConnectUiOptions {
|
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
type WalletOpenMethod = 'qrcode' | 'universal-link' | 'custom-deeplink';
|
|
217
|
-
type WalletInfoWithOpenMethod = WalletInfoInjectable | WalletInfoRemoteWithOpenMethod | (WalletInfoInjectable & WalletInfoRemoteWithOpenMethod);
|
|
217
|
+
type WalletInfoWithOpenMethod = WalletInfoInjectable | WalletInfoRemoteWithOpenMethod | WalletInfoWalletConnect | (WalletInfoInjectable & WalletInfoRemoteWithOpenMethod);
|
|
218
218
|
type WalletInfoRemoteWithOpenMethod = WalletInfoRemote & {
|
|
219
219
|
openMethod?: WalletOpenMethod;
|
|
220
220
|
};
|
|
221
|
+
type WalletInfoWalletConnect = WalletInfoBase & {
|
|
222
|
+
type: 'wallet-connect';
|
|
223
|
+
};
|
|
221
224
|
type ConnectedWallet = Wallet & WalletInfoWithOpenMethod;
|
|
222
225
|
|
|
223
226
|
type Loadable<T> = LoadableLoading | LoadableReady<T>;
|
|
@@ -556,4 +559,4 @@ declare class TonConnectUIError extends TonConnectError {
|
|
|
556
559
|
}
|
|
557
560
|
|
|
558
561
|
export { THEME, TonConnectUI, TonConnectUIError };
|
|
559
|
-
export type { ActionConfiguration, BorderRadius, Color, ColorsSet, ConnectedWallet, Loadable, LoadableLoading, LoadableReady, Locales, PartialColorsSet, ReturnStrategy, Theme, TonConnectUiCreateOptions, TonConnectUiCreateOptionsBase, TonConnectUiOptions, TonConnectUiOptionsWithConnector, TonConnectUiOptionsWithManifest, UIPreferences, UIWallet, UserActionEvent, WalletInfoRemoteWithOpenMethod, WalletInfoWithOpenMethod, WalletModalClosed, WalletModalOpened, WalletOpenMethod, WalletsListConfiguration, WalletsModal, WalletsModalCloseReason, WalletsModalState };
|
|
562
|
+
export type { ActionConfiguration, BorderRadius, Color, ColorsSet, ConnectedWallet, Loadable, LoadableLoading, LoadableReady, Locales, PartialColorsSet, ReturnStrategy, Theme, TonConnectUiCreateOptions, TonConnectUiCreateOptionsBase, TonConnectUiOptions, TonConnectUiOptionsWithConnector, TonConnectUiOptionsWithManifest, UIPreferences, UIWallet, UserActionEvent, WalletInfoRemoteWithOpenMethod, WalletInfoWalletConnect, WalletInfoWithOpenMethod, WalletModalClosed, WalletModalOpened, WalletOpenMethod, WalletsListConfiguration, WalletsModal, WalletsModalCloseReason, WalletsModalState };
|
package/lib/index.mjs
CHANGED
|
@@ -50,7 +50,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
50
50
|
});
|
|
51
51
|
};
|
|
52
52
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
53
|
-
import { TonConnectError, isWalletInfoCurrentlyInjected, toUserFriendlyAddress, CHAIN, TonConnect, isTelegramUrl, decodeTelegramUrlParameters, encodeTelegramUrlParameters, WalletMissingRequiredFeaturesError, WalletWrongNetworkError, isWalletInfoRemote, checkRequiredWalletFeatures, isConnectUrl, UUIDv7, isWalletInfoCurrentlyEmbedded, createVersionInfo, createResponseVersionEvent, createRequestVersionEvent, createWalletModalOpenedEvent, createSelectedWalletEvent, createConnectionStartedEvent, createConnectionCompletedEvent, createConnectionErrorEvent, createConnectionRestoringStartedEvent, createConnectionRestoringCompletedEvent, createConnectionRestoringErrorEvent, createDisconnectionEvent, createTransactionSentForSignatureEvent, createTransactionSignedEvent, createTransactionSigningFailedEvent, createDataSentForSignatureEvent, createDataSignedEvent, createDataSigningFailedEvent, BrowserEventDispatcher, WalletNotSupportFeatureError, SessionCrypto } from "@tonconnect/sdk";
|
|
53
|
+
import { TonConnectError, isWalletInfoCurrentlyInjected, toUserFriendlyAddress, CHAIN, TonConnect, isWalletConnectInitialized, isTelegramUrl, decodeTelegramUrlParameters, encodeTelegramUrlParameters, WalletMissingRequiredFeaturesError, WalletWrongNetworkError, isWalletInfoRemote, checkRequiredWalletFeatures, isConnectUrl, UUIDv7, isWalletInfoCurrentlyEmbedded, createVersionInfo, createResponseVersionEvent, createRequestVersionEvent, createWalletModalOpenedEvent, createSelectedWalletEvent, createConnectionStartedEvent, createConnectionCompletedEvent, createConnectionErrorEvent, createConnectionRestoringStartedEvent, createConnectionRestoringCompletedEvent, createConnectionRestoringErrorEvent, createDisconnectionEvent, createTransactionSentForSignatureEvent, createTransactionSignedEvent, createTransactionSigningFailedEvent, createDataSentForSignatureEvent, createDataSignedEvent, createDataSigningFailedEvent, BrowserEventDispatcher, WalletNotSupportFeatureError, SessionCrypto } from "@tonconnect/sdk";
|
|
54
54
|
export * from "@tonconnect/sdk";
|
|
55
55
|
import UAParser from "ua-parser-js";
|
|
56
56
|
import deepmerge from "deepmerge";
|
|
@@ -6314,8 +6314,12 @@ const FourWalletsItem = (props) => {
|
|
|
6314
6314
|
const AT_WALLET_APP_NAME = "telegram-wallet";
|
|
6315
6315
|
const IMG = {
|
|
6316
6316
|
TON: "https://raw.githubusercontent.com/ton-connect/sdk/main/assets/ton-icon-48.png",
|
|
6317
|
-
TG: "https://raw.githubusercontent.com/ton-connect/sdk/main/assets/tg.png"
|
|
6317
|
+
TG: "https://raw.githubusercontent.com/ton-connect/sdk/main/assets/tg.png",
|
|
6318
|
+
WALLET_CONNECT: "https://raw.githubusercontent.com/ton-connect/sdk/main/assets/walletconnect-icon-288.png"
|
|
6318
6319
|
};
|
|
6320
|
+
function isWalletUi(wallet) {
|
|
6321
|
+
return !("type" in wallet) || wallet.type !== "wallet-connect";
|
|
6322
|
+
}
|
|
6319
6323
|
const WalletLabeledItem = (props) => {
|
|
6320
6324
|
const [t2] = useI18n();
|
|
6321
6325
|
const walletsSecondLine = () => {
|
|
@@ -6325,12 +6329,12 @@ const WalletLabeledItem = (props) => {
|
|
|
6325
6329
|
if ("isPreferred" in props.wallet && props.wallet.isPreferred) {
|
|
6326
6330
|
return t2("walletItem.recent", {}, "Recent");
|
|
6327
6331
|
}
|
|
6328
|
-
if (isWalletInfoCurrentlyInjected(props.wallet)) {
|
|
6329
|
-
return t2("walletItem.installed", {}, "Installed");
|
|
6330
|
-
}
|
|
6331
6332
|
if (props.wallet.name === "Tonkeeper") {
|
|
6332
6333
|
return t2("walletItem.popular", {}, "Popular");
|
|
6333
6334
|
}
|
|
6335
|
+
if (isWalletUi(props.wallet) && isWalletInfoCurrentlyInjected(props.wallet)) {
|
|
6336
|
+
return t2("walletItem.installed", {}, "Installed");
|
|
6337
|
+
}
|
|
6334
6338
|
return void 0;
|
|
6335
6339
|
};
|
|
6336
6340
|
return memo(() => memo(() => props.wallet.appName === AT_WALLET_APP_NAME)() ? createComponent(WalletItem, {
|
|
@@ -8720,9 +8724,19 @@ const ExclamationIcon = (props) => {
|
|
|
8720
8724
|
return _el$9;
|
|
8721
8725
|
})() : null);
|
|
8722
8726
|
};
|
|
8727
|
+
const WALLET_CONNECT_APP_NAME = "wallet_connect";
|
|
8728
|
+
const WALLET_CONNECT_WALLET_NAME = "WalletConnect";
|
|
8729
|
+
const WALLET_CONNECT_ABOUT_URL = "https://reown.com/";
|
|
8723
8730
|
var _tmpl$$2 = /* @__PURE__ */ template$1(`<li>`);
|
|
8724
8731
|
const AllWalletsListModal = (props) => {
|
|
8725
8732
|
const maxHeight = () => isMobile() ? void 0 : 510;
|
|
8733
|
+
const connector = appState.connector;
|
|
8734
|
+
const additionalRequest = appState.connectRequestParameters;
|
|
8735
|
+
const connectWalletConnect = () => {
|
|
8736
|
+
connector.connect({
|
|
8737
|
+
type: "wallet-connect"
|
|
8738
|
+
}, (additionalRequest == null ? void 0 : additionalRequest.state) === "ready" ? additionalRequest.value : void 0);
|
|
8739
|
+
};
|
|
8726
8740
|
const [errorSupportOpened, setErrorSupportOpened] = createSignal(null);
|
|
8727
8741
|
let timeoutId = null;
|
|
8728
8742
|
const onErrorClick = (wallet) => {
|
|
@@ -8762,7 +8776,7 @@ const AllWalletsListModal = (props) => {
|
|
|
8762
8776
|
get children() {
|
|
8763
8777
|
return [createComponent(WalletsUl, {
|
|
8764
8778
|
get children() {
|
|
8765
|
-
return createComponent(For, {
|
|
8779
|
+
return [createComponent(For, {
|
|
8766
8780
|
get each() {
|
|
8767
8781
|
return supportedWallets();
|
|
8768
8782
|
},
|
|
@@ -8774,7 +8788,24 @@ const AllWalletsListModal = (props) => {
|
|
|
8774
8788
|
}));
|
|
8775
8789
|
return _el$;
|
|
8776
8790
|
})()
|
|
8777
|
-
})
|
|
8791
|
+
}), createComponent(Show, {
|
|
8792
|
+
get when() {
|
|
8793
|
+
return memo(() => !!!isInTMA())() && isWalletConnectInitialized();
|
|
8794
|
+
},
|
|
8795
|
+
get children() {
|
|
8796
|
+
return createComponent(WalletLabeledItemStyled, {
|
|
8797
|
+
get wallet() {
|
|
8798
|
+
return {
|
|
8799
|
+
type: "wallet-connect",
|
|
8800
|
+
name: WALLET_CONNECT_WALLET_NAME,
|
|
8801
|
+
appName: WALLET_CONNECT_APP_NAME,
|
|
8802
|
+
imageUrl: IMG.WALLET_CONNECT
|
|
8803
|
+
};
|
|
8804
|
+
},
|
|
8805
|
+
onClick: connectWalletConnect
|
|
8806
|
+
});
|
|
8807
|
+
}
|
|
8808
|
+
})];
|
|
8778
8809
|
}
|
|
8779
8810
|
}), createComponent(Show, {
|
|
8780
8811
|
get when() {
|
|
@@ -12740,7 +12771,7 @@ class TonConnectUITracker {
|
|
|
12740
12771
|
}
|
|
12741
12772
|
}
|
|
12742
12773
|
}
|
|
12743
|
-
const tonConnectUiVersion = "2.4.0-beta.
|
|
12774
|
+
const tonConnectUiVersion = "2.4.0-beta.2";
|
|
12744
12775
|
class TonConnectEnvironment {
|
|
12745
12776
|
constructor() {
|
|
12746
12777
|
this.userAgent = getUserAgent();
|
|
@@ -13572,8 +13603,18 @@ class TonConnectUI {
|
|
|
13572
13603
|
if (!lastSelectedWalletInfo2) {
|
|
13573
13604
|
return null;
|
|
13574
13605
|
}
|
|
13575
|
-
let fullLastSelectedWalletInfo;
|
|
13576
13606
|
if (!("name" in lastSelectedWalletInfo2)) {
|
|
13607
|
+
if (wallet.device.appName === WALLET_CONNECT_APP_NAME) {
|
|
13608
|
+
return {
|
|
13609
|
+
type: "wallet-connect",
|
|
13610
|
+
name: WALLET_CONNECT_WALLET_NAME,
|
|
13611
|
+
appName: WALLET_CONNECT_APP_NAME,
|
|
13612
|
+
imageUrl: IMG.WALLET_CONNECT,
|
|
13613
|
+
aboutUrl: WALLET_CONNECT_ABOUT_URL,
|
|
13614
|
+
features: wallet.device.features,
|
|
13615
|
+
platforms: []
|
|
13616
|
+
};
|
|
13617
|
+
}
|
|
13577
13618
|
const walletsList = applyWalletsListConfiguration(
|
|
13578
13619
|
yield this.walletsList,
|
|
13579
13620
|
appState.walletsListConfiguration
|
|
@@ -13584,11 +13625,9 @@ class TonConnectUI {
|
|
|
13584
13625
|
`Cannot find WalletInfo for the '${wallet.device.appName}' wallet`
|
|
13585
13626
|
);
|
|
13586
13627
|
}
|
|
13587
|
-
|
|
13588
|
-
} else {
|
|
13589
|
-
fullLastSelectedWalletInfo = lastSelectedWalletInfo2;
|
|
13628
|
+
return __spreadValues(__spreadValues({}, walletInfo), lastSelectedWalletInfo2);
|
|
13590
13629
|
}
|
|
13591
|
-
return
|
|
13630
|
+
return lastSelectedWalletInfo2;
|
|
13592
13631
|
});
|
|
13593
13632
|
}
|
|
13594
13633
|
updateWalletInfo(wallet) {
|