🌊
Urchin Web3 CMS
  • 🌊What is Urchin?
  • 🛠️How it works
  • 🏎️Getting started
  • 🧱API Reference
    • Core
      • urchin()
      • .preflight()
      • .process()
    • Template
      • .template.create()
      • .template.update()
      • .template.get()
      • .template.getAll()
    • Taxonomy
      • .taxonomy.create()
      • .taxonomy.update()
      • .taxonomy.get()
      • .taxonomy.getAll()
    • Asset
      • .asset.create()
      • .asset.update()
      • .asset.get()
      • .asset.getAll()
    • Entry
      • .entry.create()
      • .entry.update()
      • .entry.get()
      • .entry.getAll()
  • 🤔FAQs
Powered by GitBook
On this page
  • Install
  • Create a simple blog template

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);
}
PreviousHow it worksNextAPI Reference

Last updated 1 year ago

🏎️