Documentation Index
Fetch the complete documentation index at: https://docs.openformat.tech/llms.txt
Use this file to discover all available pages before exploring further.
Installation
npm install @openformat/sdk ethers@^5
Create a web3 account (Optional)
If you’re new to web3, you’ll need an account to use our SDK. You can easily create one with this simple script:import { ethers } from "ethers";
function createWallet() {
const wallet = ethers.Wallet.createRandom();
console.log(`Wallet Address: ${wallet.address}`);
console.log(`Private Key: ${wallet.privateKey}`);
}
createWallet();
Create an App
The functions in this code snippet require gas.If you need support relating to gas, reach out to us on Discord. import { Chains, OpenFormatSDK } from "@openformat/sdk";
const sdk = new OpenFormatSDK({
network: Chains.arbitrumSepolia,
signer: process.env.PRIVATE_KEY, // Your wallet's private key
});
// Create App
const app = await sdk.factory.createApp({
name: "APP_NAME",
});
// Create XP Token
const xp = await sdk.App.createToken({
name: "XP",
symbol: "XP",
supply: 0,
});
console.log("APP_ID", app.id);
console.log("XP_ADDRESS", xp.address());
Instantiate SDK with your App
import { OpenFormatSDK, Chains } from "@openformat/sdk";
const sdk = new OpenFormatSDK({
network: Chains.arbitrumSepolia,
signer: process.env.PRIVATE_KEY, // Your wallet's private key
appId: "INSERT_APP_ID",
});
Now that you have generated an APP_ID and an XP_ADDRESS, you can either continue with our SDK or use our API to start rewarding your users.