The basic kit initialization consists of creating a corresponding object by passing it a minimal set of necessary arguments. Pick a TON network to operate on, a wallet manifest, and feature configurations.Here is an example of a minimal configuration:
Copy
Ask AI
import TONWalletKit// URL of the wallet's implementation of the HTTP bridge:// https://github.com/ton-connect/docs/blob/main/bridge.md#http-bridge//// Can be different, e.g., https://bridge.tonapi.io/bridgelet bridgeURL = "https://connect.ton.org/bridge"let features: [TONWalletKitConfiguration.Feature] = [ // Wallet can send transactions. TONWalletKitConfiguration.SendTransactionFeature( // Max number of messages that can be sent in a single transaction. // Depends on the TON wallet used, because different kinds can handle // different number of messages. maxMessages: 1, // Are messages sending extra-currencies supported? extraCurrencySupported: false ), TONWalletKitConfiguration.SignDataFeature(types: [ // Types of data to sign. .text, .binary, .cell ]),]let configuration = TONWalletKitConfiguration( network: .mainnet, /* or .testnet */ walletManifest: TONWalletKitConfiguration.Manifest( name: "Name of your wallet service", appName: "your_wallet_service_id", /* e.g. best_ton_wallet_service */ imageUrl: "https://<YOUR_WALLET_SERVICE_URL>/image.png", aboutUrl: "https://<YOUR_WALLET_SERVICE_URL>/about", universalLink: "https://<YOUR_WALLET_SERVICE_URL>/universal-link", bridgeUrl: bridgeURL ), features: features)
Once you have a configuration, create an instance of the kit:
Copy
Ask AI
import TONWalletKit// Instructs how to store intermediate events and other data from the WalletKit.let storage: TONWalletKitStorageType = .memory // .keychain or .custom(/* custom storage */)// Instancelet walletKit = try await TONWalletKit.initialize( configuration: configuration, storage: storage)