New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@tonconnect/ui

Package Overview
Dependencies
Maintainers
4
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tonconnect/ui - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1-beta.0

64

lib/index.d.ts

@@ -267,2 +267,41 @@ import { WalletInfoBase, WalletInfoInjectable, WalletInfoRemote, ITonConnect, Wallet, WalletInfo, Account, ConnectAdditionalRequest, TonConnectError, SendTransactionRequest, SendTransactionResponse } from '@tonconnect/sdk';

/**
* Opened modal window state.
*/
declare type SingleWalletModalOpened = {
/**
* Modal window status.
*/
status: 'opened';
/**
* Wallet info.
*/
walletInfo: WalletInfoRemote;
/**
* Always `null` for opened modal window.
*/
closeReason: null;
};
/**
* Closed modal window state.
*/
declare type SingleWalletModalClosed = {
/**
* Modal window status.
*/
status: 'closed';
/**
* Close reason, if the modal window was closed.
*/
closeReason: SingleWalletModalCloseReason | null;
};
/**
* Modal window state.
*/
declare type SingleWalletModalState = SingleWalletModalOpened | SingleWalletModalClosed;
/**
* Modal window close reason.
*/
declare type SingleWalletModalCloseReason = 'action-cancelled' | 'wallet-selected';
declare class TonConnectUI {

@@ -286,2 +325,7 @@ static getWallets(): Promise<WalletInfo[]>;

/**
* Manages the single wallet modal window state.
* TODO: make it public when interface will be ready for external usage.
*/
private readonly singleWalletModal;
/**
* Manages the transaction modal window state.

@@ -347,2 +391,22 @@ * TODO: make it public when interface will be ready for external usage.

/**
* Opens the single wallet modal window, returns a promise that resolves after the modal window is opened.
* @experimental
*/
openSingleWalletModal(wallet: string): Promise<void>;
/**
* Close the single wallet modal window.
* @experimental
*/
closeSingleWalletModal(): void;
/**
* Subscribe to the single wallet modal window state changes, returns a function which has to be called to unsubscribe.
* @experimental
*/
onSingleWalletModalStateChange(onChange: (state: SingleWalletModalState) => void): () => void;
/**
* Returns current single wallet modal window state.
* @experimental
*/
get singleWalletModalState(): SingleWalletModalState;
/**
* @deprecated Use `tonConnectUI.openModal()` instead. Will be removed in the next major version.

@@ -349,0 +413,0 @@ * Opens the modal window and handles a wallet connection.

2

package.json
{
"name": "@tonconnect/ui",
"version": "2.0.0",
"version": "2.0.1-beta.0",
"scripts": {

@@ -5,0 +5,0 @@ "start": "vite --host",

@@ -170,2 +170,36 @@ # TON Connect UI

## Open specific wallet
> The methods described in this section are marked as experimental and are subject to change in future releases.
To open a modal window for a specific wallet, use the `openSingleWalletModal()` method. This method accepts the wallet `app_name` as a parameter (please refer to the [wallets-list.json](https://github.com/ton-blockchain/wallets-list/blob/main/wallets-v2.json)) and opens the corresponding wallet modal. It returns a promise that resolves after the modal window is successfully opened.
```typescript
await tonConnectUI.openSingleWalletModal('wallet_identifier');
````
To close the currently open specific wallet modal, use the `closeSingleWalletModal()` method:
```typescript
tonConnectUI.closeSingleWalletModal();
```
To subscribe to the state changes of the specific wallet modal, use the `onSingleWalletModalStateChange((state) => {})` method. It accepts a callback function that will be called with the current modal state.
```typescript
const unsubscribe = tonConnectUI.onSingleWalletModalStateChange((state) => {
console.log('Modal state changed:', state);
});
// Call `unsubscribe` when you want to stop listening to the state changes
unsubscribe();
````
To get the current state of the specific wallet modal window, use the `singleWalletModalState` property:
```typescript
const currentState = tonConnectUI.singleWalletModalState;
console.log('Current modal state:', currentState);
```
## Get current connected Wallet and WalletInfo

@@ -172,0 +206,0 @@ You can use special getters to read current connection state. Note that this getter only represents current value, so they are not reactive.

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc