0.1.5 • Published 6 months ago

confederacy v0.1.5

Weekly downloads
-
License
Open BSV License
Repository
-
Last release
6 months ago

Confederacy API

Confederacy API for UTXO Tracking

Overview

Configure topic managers and lookup service providers. Then, submit transactions that contain tokens that get tracked in the topics. Spend them to update hte tokens, and look up the tokens you need.

Usage

const Confederacy = require('confederacy')
const UMPManager = require('ump-manager')
const UMPLookupService = require('ump-lookup-service')

// Construct a Confederacy with managers and lookup services
const confederacy = new Confederacy({
  managers: {
    ump: new UMPManager()
  },
  lookupServices: {
    ump: new UMPLookupService()
  }
})

// Submit transactions that interact with tokens for a given topic
confederacy.submit({
  rawTx: '...',
  inputs: {},
  mapiResponses: [],
  topics: ['ump']
})

// Look up tokens that are actively in a topic
confederacy.lookup({
  provider: 'ump',
  query: {
    tokenTextContains: '...'
  }
})

// Spend a token to remove it from a topic, optionally replacing it
confederacy.submit({
  rawTx: '...',
  inputs: {},
  mapiResponses: [],
  topics: ['ump']
})

UHRP-Confederacy

Loosely-federated User Management Protocol UTXO tracking

Overview

Configure topic managers and lookup service providers. Then, submit transactions that contain tokens that get tracked in the topics. Spend them to update hte tokens, and look up the tokens you need.

Usage

const Confederacy = require('confederacy')
const UHRPManager = require('uhrp-manager')
const UHRPLookupService = require('uhrp-lookup-service')

// Construct a Confederacy with managers and lookup services
const confederacy = new Confederacy({
  managers: {
    uhrp: new UHRPManager()
  },
  lookupServices: {
    uhrp: new UHRPLookupService()
  }
})

// Submit transactions that interact with tokens for a given topic
confederacy.submit({
  rawTx: '...',
  inputs: {},
  mapiResponses: [],
  topics: ['uhrp']
})

// Look up tokens that are actively in a topic
confederacy.lookup({
  provider: 'uhrp',
  query: {
    tokenTextContains: '...'
  }
})

// Spend a token to remove it from a topic, optionally replacing it
confederacy.submit({
  rawTx: '...',
  inputs: {},
  mapiResponses: [],
  topics: ['uhrp']
})