https://github.com/raphjaph/ordapi
Typescript library for talking to the `ord` JSON API.
https://github.com/raphjaph/ordapi
api-client bitcoin inscriptions javascript javascript-library ordinals runes typescript
Last synced: about 1 year ago
JSON representation
Typescript library for talking to the `ord` JSON API.
- Host: GitHub
- URL: https://github.com/raphjaph/ordapi
- Owner: raphjaph
- License: cc0-1.0
- Created: 2025-01-28T13:36:53.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-02-13T22:49:18.000Z (over 1 year ago)
- Last Synced: 2025-03-23T09:22:12.680Z (about 1 year ago)
- Topics: api-client, bitcoin, inscriptions, javascript, javascript-library, ordinals, runes, typescript
- Language: TypeScript
- Homepage: https://raphjaph.github.io/ordapi/
- Size: 114 KB
- Stars: 8
- Watchers: 2
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Ord API
Simple TypeScript client for `ord` API.
See the [docs](https://docs.ordinals.com/guides/api).
[](https://www.npmjs.com/package/ordapi)
[](https://www.npmjs.com/package/ordapi)
[](https://github.com/raphjaph/ordapi/blob/master/LICENSE)
[](https://github.com/raphjaph/ordapi/actions)
## 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
```
## Import
Import the client and types depending on your needs:
```typescript
// Using default import
import OrdClient from 'ordapi';
const client = new OrdClient('https://ord-server.com');
const block = await client.getBlock(0);
```
```typescript
// Using both client and types
import OrdClient, { Inscription } from 'ordapi';
async function getInscription(id: string): Promise {
const client = new OrdClient('https://ord-server.com');
return await client.getInscription(id);
}
```
## Usage
```typescript
import OrdClient, { Block } from 'ordapi';
function App() {
const [blockInfo, setBlockInfo] = useState(null);
useEffect(() => {
// Create client instance
const client = new OrdClient('https://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
{blockInfo && (
<>
Height: {blockInfo.height}
Hash: {blockInfo.hash}
Number of transactions: {blockInfo.transactions.length}
>
)}
);
}
```
### Publish release
- update `package.json` version
- update version in `docs/generateHtml.ts`
- update all dependencies (`bun update`)
- prepare the CHANGELOG
- open release PR on github
- `bun publish`