Package Exports
- ordapi
- ordapi/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ordapi) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Ord API
Simple TypeScript client for ord
API.
See the docs.
Installation
Using npm:
$ npm install ordapi
Using yarn:
$ yarn add ordapi
Using pnpm:
$ pnpm add ordapi
Using bun:
$ bun add ordapi
Usage
import { OrdClient, Block } from 'ordapi';
function App() {
const [blockInfo, setBlockInfo] = useState<Block | null>(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 (
<div>
<h1>Genesis Block</h1>
<p>Height: {blockInfo.height}</p>
<p>Hash: {blockInfo.hash}</p>
<p>Number of transactions: {blockInfo.transactions.length}</p>
</div>
);
}