@startale/app-sdk
v1.3.0
Published
Superapp SDK
Downloads
405
Readme
Startale App SDK
Startale App SDK allows dapps to connect to the Startale App
This repository uses
pnpm. The examples below show thepnpmcommand first, followed by annpmalternative when helpful.
Installing Startale App SDK
Check available versions:
# pnpm pnpm view @startale/app-sdk versions # npm npm view @startale/app-sdk versionsInstall latest version:
# pnpm pnpm add @startale/app-sdk # npm npm install @startale/app-sdkCheck installed version:
# pnpm pnpm list @startale/app-sdk # npm npm list @startale/app-sdk
Upgrading Startale App SDK
Compare the installed version with the latest:
# pnpm pnpm outdated @startale/app-sdk # npm npm outdated @startale/app-sdkUpdate to latest:
# pnpm pnpm update @startale/app-sdk # npm npm update @startale/app-sdk
Basic Usage
Initialize Startale App SDK
const sdk = createStartaleAccountSDK({ appName: 'SDK Playground', });Make Startale App Provider
const provider = sdk.getProvider();Request accounts to initialize a connection to wallet
const addresses = provider.request({ method: 'eth_requestAccounts', });Make more requests
provider.request('personal_sign', [ `0x${Buffer.from('test message', 'utf8').toString('hex')}`, addresses[0], ]);Handle provider events
provider.on('connect', (info) => { setConnect(info); }); provider.on('disconnect', (error) => { setDisconnect({ code: error.code, message: error.message }); }); provider.on('accountsChanged', (accounts) => { setAccountsChanged(accounts); }); provider.on('chainChanged', (chainId) => { setChainChanged(chainId); }); provider.on('message', (message) => { setMessage(message); });
