thred-app-sdk v0.2.8
Thred App Developer SDK
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.
Installation
Use the package manager npm to install the Thred App Developer SDK.
npm install thred-app-sdk
Import Module
import * as thredSDK from "thred-app-sdk"
// import the module 2 different ways
const thredSDK = require("thred-app-sdk")
Initialize the SDK
const appKey = "..."
thredSDK.initApp(appKey) //Establish a secure connection to the App Store with the App Key passed in the URL.
Call Smart Contract function
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
})
Read Smart Contract function
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'
})
License
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago