Using npm:
$ npm install ordapiUsing yarn:
$ yarn add ordapiUsing pnpm:
$ pnpm add ordapiUsing bun:
$ bun add ordapiImport the client and types depending on your needs:
// Using default importimportOrdClientfrom'ordapi';constclient=newOrdClient('https://ord-server.com');constblock=awaitclient.getBlock(0);// Using both client and typesimportOrdClient,{Inscription}from'ordapi';asyncfunctiongetInscription(id: string): Promise<Inscription>{constclient=newOrdClient('https://ord-server.com');returnawaitclient.getInscription(id);}importOrdClient,{Block}from'ordapi';functionApp(){const[blockInfo,setBlockInfo]=useState<Block|null>(null);useEffect(()=>{// Create client instanceconstclient=newOrdClient('https://ord-server.xyz');// Fetch genesis block infoasyncfunctionfetchBlock(){try{constblock=awaitclient.getBlock(0);setBlockInfo(block);}catch(err){console.error('Failed to fetch block:',err);}}fetchBlock();},[]);return(<div><h1>GenesisBlock</h1>{blockInfo&&(<><p>Height: {blockInfo.height}</p><p>Hash: {blockInfo.hash}</p><p>Numberoftransactions: {blockInfo.transactions.length}</p></>)}</div>);}- update
package.jsonversion - update version in
docs/generateHtml.ts - update all dependencies (
bun update) - prepare the CHANGELOG
- open release PR on github
bun publish