diff --git a/README.md b/README.md index 82db983..34a3377 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,66 @@ # Ord API -Implements some types for talking to the `ord` JSON-API. +Simple TypeScript client for `ord` API. See the [docs](https://docs.ordinals.com/guides/api). + +## Installation + +Using npm: + +```bash +$ npm install ordapi +``` + +Using yarn: + +```bash +$ yarn add ordapi +``` + +Using pnpm: + +```bash +$ pnpm add ordapi +``` + +Using bun: + +```bash +$ bun add ordapi +``` + +## Usage + +```typescript +import { OrdClient, Block } from 'ordapi'; + +function App() { + const [blockInfo, setBlockInfo] = useState(null); + + useEffect(() => { + // Create client instance + const client = new OrdClient('https://your-ord-server.xyz'); + + // Fetch genesis block info + async function fetchBlock() { + try { + const block = await client.getBlock(0); + setBlockInfo(block); + } catch (err) { + console.error('Failed to fetch block:', err); + } + } + + fetchBlock(); + }, []); + + return ( +
+

Genesis Block

+

Height: {blockInfo.height}

+

Hash: {blockInfo.hash}

+

Number of transactions: {blockInfo.transactions.length}

+
+ ); +} +```