topether21-nosft-core
TypeScript icon, indicating that this package has built-in type declarations

0.0.11 • Public • Published

nosft-core

Tools for developing Nosft clients

Installation

npm install nosft-core # or yarn add nosft-core

Usage

NodeJs & Browser

const nosftCore = require('nosft-core');

or
const { nosft } = require('nosft-core');

or

import { nosft } = require('nosft-core');

Initialize library

Defaults to mainnet config

const { nosft } = require('nosft-core');

(async () => {
    const inscriptions = await nosft.getAddressInscriptions({
        address: process.env.BTC_ADDRESS,
        offset: 0,
        limit: 2,
    });
    console.log(JSON.stringify(inscriptions, undefined, 4));
})();

Configure library

If you want to specify your custom configs, you can do so by:

const nosftCore = require('nosft-core');

(async () => {
    const { nosft } = nosftCore.configure({ nosftBaseUrl: 'http://localhost:3000/api', network: 'testnet' });
    const inscriptions = await nosft.getAddressInscriptions({
        address: process.env.BTC_ADDRESS,
        offset: 0,
        limit: 2,
    });

    console.log(JSON.stringify(inscriptions, undefined, 4));
})();

Getting inscriptions

const { nosft } = require('nosft-core');
const inscriptions = await nosft.getAddressInscriptions({
    address: process.env.BTC_ADDRESS,
    offset: 0,
    limit: 2,
});

Getting OnSale Ordinals

Server Side/Node

import 'websocket-polyfill'; // only for nodejs/server-side
import { NostrRelay } from 'nosft-core';

(async () => {
    const relay = new NostrRelay();
    relay.subscribeOrders({
        limit: 10,
        onOrder: (order) => {
            console.log('new order');
            console.log(order.id);
        },
        onEose: () => {
            console.log('eose');
        },
    });
})();

Developing

  1. Install just
  2. just -l

License

Public domain.

Readme

Keywords

none

Package Sidebar

Install

npm i topether21-nosft-core

Weekly Downloads

19

Version

0.0.11

License

Public domain

Unpacked Size

2.91 MB

Total Files

26

Last publish

Collaborators

  • topether21