SDK architecture
How the SDK packages, the white-label app and a typical integration are put together.
This page shows three views: the packages, the white-label app built on them, and the call sequence of a typical integration.
Packages
Figure: The 4thTech SDK packages and what they depend on. Solid arrows are package imports; dotted lines are runtime connections.
ethereum depends on encryption, storage and utils. storage and encryption depend on types and utils. The encryptor package talks to the browser extension and implements the EncryptorExtension interface that ethereum's Encryptor client expects, so you pass it in at runtime.
The white-label app
Figure: How the white-label app is layered, from Nuxt pages down to the SDK, the wallet and the services it talks to.
The app creates its clients when the connected account or network changes. It builds a WalletClient from the connected wallet, a PollinationX storage provider, an EncryptionHandler that holds EncryptorAesEncryption, and then Mail, Chat, Encryptor and User clients. If the active network has no contracts configured for a client, that client is not created. See Run locally.
An integration
Figure: The call sequence of the quickstart: build the clients, listen for new mail, then send one encrypted mail.
Follow the code in the SDK quickstart.
Design notes
No keys in the SDK. Your wallet client signs. The SDK only encodes calls.
Storage is pluggable. Implement
RemoteStorageProviderto use your own storage.Encryption is pluggable. Implement the
Encryptioninterface and add it to the handler.Chains carry their contracts. Each chain exported from
@4thtech-sdk/ethereumincludes the contract addresses the clients need. Addresses are listed on the Deployments page.
Last updated
