Thred is a decentralized App Store Protocol. Using Thred, developers can create installable web3 applications and list them for sale on the Thred App Store. This SDK provides all the functions needed to create web3 applications.
Use the package manager npm to install the Thred App Developer SDK.
npm install thred-app-sdk
import * as thredSDK from "thred-app-sdk"
// import the module 2 different ways
const thredSDK = require("thred-app-sdk")
const appKey = "..."
thredSDK.initApp(appKey) //Establish a secure connection to the App Store with the App Key passed in the URL.
Instead of natively handling the connection to the user's wallet, use the below method to call the Smart Contract with the existing wallet connected to an App Store Client.
const address = '0x.....293' // Address of the contract
const abi = [ [ { "anonymous": false, "inputs": [] } ] .... ] // ABI of the contract
const data = {
address,
abi
}
thredSDK.sendTransaction(data, "mySolidityCallFunction", [param1, param2, param3], (transaction) => {
//Returns the transaction information in the form of an ethers.js Transaction
})
Similarly, read the Smart Contract with the existing wallet connected to an App Store Client.
const address = '0x.....293' // Address of the contract
const abi = [ [ { "anonymous": false, "inputs": [] } ] .... ] // ABI of the contract
const data = {
address,
abi
}
thredSDK.requestFunction(data, "mySolidityViewFunction", [param1, param2, param3], (viewData) => {
//Returns the data in the form of 'any'
})