@tgmarinho
Back to Blog
web3

Basic Wax blockchain

Useful links, sample code about how to interact with

April 18, 20223 min read

Useful links to learn about Wax Blockchain.

  • Welcome Wax Blockchain - DAaps Developers 💻 *

Basic concepts

MainNet

It's a network when the real tokens and data live - Production

TestNet

It's a network when the fake tokens and test data live - Staging

Make sure to use wallet main net in the mainnet blockchain, and test net wallet to testnet blockchain, both do not communicate with each other, you can't sign the mainnet transaction in testnet.

Wallet Setup

Marketplace

Buy, create nft, sell, auction, drop, inventory, etc...

Dashboard Wax

Link to see the transactions on the wax blockchain

https://wax-test.bloks.io/ (test)

https://wax.bloks.io/ (main)

Basic contract to create assets: https://wax-test.bloks.io/account/atomicassets

Documentation

Wax is a fork from EOS, so you can learn deeply about wax reading this

Articles

VG Guide - Creating NFTs on the WAX Blockchain

Complete Guide To NFT Drops On WAX

concept structure of collection → schema → template | asset (mint)

API s

Swagger API Atomicassets / Atomicmarket - Mainnet

https://wax.api.atomicassets.io/docs/#/

Swagger UI

Swagger API Atomicassets / Atomicmarket - Testnet

Swagger UI

Developers - Code

Sample API Atomic Assets Call

import { explorerApi } from "../services/apisSetup";

export const Collection = async (collectionName) => {
	return explorerApi.getCollection(collectionName);
};

Sample of RPC call:

import { jsonRpc } from "./apisSetup";


export async function getBalance(account: string) {
	const { core_liquid_balance } = await jsonRpc.get_account(account);

	let text = "0.00000000 WAX";
	let number = "0.00";

	if (!!core_liquid_balance) {
		text = String(core_liquid_balance);

		const onlyNumbers = text.replace(/( WAX)/g, "");
		number = Number(onlyNumbers).toFixed(2);
	}

	return { text, number };
}

Sample Hooks to sign transaction and handle with contract:

import { UALContext } from "ual-reactjs-renderer";

const ual: any = useContext(UALContext);

async function sendActions(actions: Action[]) {
		const tx: Record<string, unknown> = await ual.activeUser.signTransaction(
			{ actions },
			defaultTxOptions,
		);
		return tx;
	}


async function createCollection(
		author,
		collectionName,
		allowNotify,
		authorizedAccounts,
		notifyAccounts,
		marketFee,
		data,
	) {
		return sendActions([
			createAction("atomicassets", "createcol", {
				author: author,
				collection_name: collectionName,
				allow_notify: allowNotify,
				authorized_accounts: authorizedAccounts,
				notify_accounts: notifyAccounts,
				market_fee: marketFee,
				data: data,
			}),
		]);
}

Sample of .env:

# TESTNET
# NEXT_PUBLIC_UAL_CHAIN_ID=f16b1833c747c43682f4386fca9cbb327929334a762755ebec17f6f23c9b8a12
# NEXT_PUBLIC_UAL_CHAIN_HOST=testnet.wax.pink.gg
# NEXT_PUBLIC_EXPLORER_API_ENDPOINT=https://test.wax.api.atomicassets.io
 
# MAINNET
NEXT_PUBLIC_UAL_CHAIN_ID=1064487b3cd1a897ce03ae5b6a865651747e2e152090f99c1d19d44e01aea5a4
NEXT_PUBLIC_UAL_CHAIN_HOST=wax.greymass.com
NEXT_PUBLIC_EXPLORER_API_ENDPOINT=https://wax.api.atomicassets.io

You can find some content on youtube:

Search like: how to create NFT atomic hub, how to create drop atomic hub