radix-meme-gateway
v0.0.26
Published
Utility to fetch relevant data for radix.meme app directly from the radix ledger
Downloads
911
Readme
Radix Meme Gateway
This package provides a utility to fetch data relevant to the radix.meme app directly from the radix ledger by using public gateway APIs. The APIs are called using axios (not with the GatewayAPI SDK).
Usage
Instal
npm install radix-meme-gateway
Initialize Service
import {
createRadixMemeGateway,
Network,
radixMemeAddressbook
} from "radix-meme-gateway";
// show all stored ledger addresses
console.log(radixMemeAddressbook);
// initialize service
const radixMemeGateway = createRadixMemeGateway(
Network.STOKENET,
radixMemeAddressbook.STOKENET.latest.componentAddress
);
// Show config of an instance
console.log(radixMemeGateway.getConfig());
API endpoints
// Fetch all tokens
const tokens = await radixMemeGateway.getAllTokens();
// Fetch token
const token = await radixMemeGateway.getToken(
"component_tdx_2_1cqcfndu8u4658fw68lu272sm0mwf38ms5p9dchpskn9rxwptpu05k4"
);
// Fetch the last 100 TXs on the radix ledger and filter out all radixMemeEvents
const events = await radixMemeGateway.getLatestRadixMemeTransactions();
REPL test environment
To test the gateway in a JS REPL, you can simply run:
npm run repl
You should see an interactive javascript REPL environment, where you can test the functions in realtime.