Build with fund tokens
The app is one way to use the funds. Our TypeScript library builds the same transactions it does, and each network's registry lists the verified funds, so your app or wallet can create, mint, redeem and show fund tokens too.
Get started
@fundtokens/builders holds the transaction builders for every fund type, and a client for the registry. It works with CashScript (opens in a new tab)'s network providers.
It is published to npm, which lists every release and pre-release (opens in a new tab). The source of the docs and contracts is on GitHub.
npm install @fundtokens/builders cashscriptimport { ElectrumNetworkProvider, Network } from 'cashscript';
import { FundTokensRegistry, FundTypeResolver, FixedBasket } from '@fundtokens/builders';
const provider = new ElectrumNetworkProvider(Network.CHIPNET);
// Reads chipnet's registry, unless you pass a url
const registry = new FundTokensRegistry({ network: 'chipnet' });
const resolver = new FundTypeResolver({ provider });
// The current fixed basket instance, ready to build with
const tb = resolver.resolve(await registry.getCurrentInstance(FixedBasket));Documentation
Guides to the contracts, the fund types and the library, kept with the code on GitHub.
Overview
How it works: instances, fund types, contract versions, threads and fees.
Read on GitHub (opens in a new tab)Integration guide
Step by step: creating a fund, minting, redeeming and finding funds, with examples.
Read on GitHub (opens in a new tab)Library API
The registry client, the fund type resolver and the errors the library throws.
Read on GitHub (opens in a new tab)Fund types
Every fund type and contract version, with its contracts, tokens and builders.
Read on GitHub (opens in a new tab)
Networks
Each network has its own app and its own registry. Build and test on a test network, where coins have no value, before you go to mainnet. More test networks may be added.
Chipnet
Test network- Registry
https://chipnet-registry.fundtokens.cash
Mainnet
Main network- App
- Registry
https://mainnet-registry.fundtokens.cash
Registry API
A registry watches its network for funds created through the trusted instances and publishes them. These endpoints are public and read-only, need no key, and return JSON. Add each path to a network's registry URL, such as https://chipnet-registry.fundtokens.cash/api/funds.
| GET | Returns |
|---|---|
/.well-known/bitcoin-cash-metadata-registry.json | The BCMR document: the verified funds and system tokens, with their names, icons and history. |
/api/funds | The verified funds. Query: limit (1 to 500, default 100), offset and includeBurned. |
/api/funds/:category | One fund by its token category, with its authchain and identity history. |
/api/instances | The deployed instances, and the current one for each fund type. Query: type. |
/api/network | The network the registry serves, and the last block height it has seen. |
Wallets and explorers that read BCMR can use a registry's BCMR document to show each fund's name and icon. The library reads its network's registry by default.
Contracts you can rely on
- Frozen versions. A released contract version never changes. Improvements ship as new versions, and a fund keeps the contracts it was created with.
- Resolved for you. The registry says which instance is current for each fund type, and the library picks the builders for its version.
- Audited. The contracts have been audited by Sighash Labs and NexOps.
Questions?
Building on fund tokens and stuck, or want to tell us what you're making? Email us.
developers@fundtokens.cash