🏎️Getting started
Install
yarn yarn add urchin-web3-cms
or npm npm -i urchin-web3-cms
Note: This example below also requires solana/web3js and bs58 as dependencies
Create a simple blog template
import urchin from 'urchin-web3-cms';
import {Keypair, Signer} from "@solana/web3.js";
import bs58 from ‘bs58’;
const handler = async () => {
// associate your wallet
const payer = Keypair.fromSecretKey(
bs58.decode("<funded solana wallet secret key as string>")
);
// init the urchin object
const cms = urchin(
{
payer,
cluster: 'devnet'
});
// create a template
const cms.template.create([
{
title: "blog post"
taxonomies: [],
inputs: [{label: "blog title", type: "string", validation: {type: "text", min: 1, max: 100}}]
}
]);
// publish to blockchain
await cms.process()
// retrieve all templates
const r = await cms.template.getAll();
console.log("Found templates: ", r);
}
Last updated