Developer guidesAPI integration

Deploy and Mint a Bond using the TypeScript Client

Step-by-step guide for creating and minting bond tokens using the ATK TypeScript Client

PREREQUISITES

Before running these commands, you need to:

  1. Platform URL - Know your ATK platform URL (e.g., https://your-platform.example.com)
  2. Deploy ATK - Have a running ATK instance (local or hosted)
  3. Sign up - Create a user account through the ATK UI with email/password
  4. Enable PINCODE - Set up PINCODE during onboarding. Manage it from Account → Wallet.
  5. Admin role - Your account must have admin role to grant system roles (Step 3)
  6. Stablecoin (denomination asset) - Have a deployed stablecoin contract address. You can create one using the Stablecoin Guide or use an existing stablecoin contract address

Note: Your wallet address is available via ATK while signing up, or you can get it from Step 2. You'll need your wallet address and a deployed stablecoin contract address (denomination asset) for this guide.


Quick reference

StepWhatMethod
1Initialize ClientcreateClient
2Get user infoclient.user.me
3Grant system rolesSee Set Up Roles guide
4Create bondclient.token.create (type: "bond")
5Grant token rolesSee Set Up Roles guide
6Unpauseclient.token.unpause
7Mint bondsclient.token.mint
8Verifyclient.token.holders

STEP-BY-STEP COMMANDS

Step 1: Initialize Client

Initialize the ORPC client with your platform URL and authentication token.

Client helper implementation

The createClient helper configures the ORPC client with required serializers and headers. Implementation:


Step 2: check you're logged in

Save your wallet address - you'll need it!


Step 3: set up system roles

REQUIRED: Complete these steps to grant yourself the necessary system roles.

Follow the Set Up Roles guide:

  1. Grant system roles:
    • tokenManager - Required to create tokens

Those sections in the roles guide include the full TypeScript client calls—copy the code snippets directly to satisfy this step.

Note: Only users with admin role can grant system roles. If you don't have admin access, ask your system administrator to grant you the tokenManager role.


Step 4: create bond token

Parameters:

  • type: Must be "bond"
  • name: Bond name (e.g., "Test Corporate Bond")
  • symbol: Bond symbol (e.g., "TCBD")
  • decimals: Usually 18 for bonds
  • countryCode: ISO country code (840 = USA, 056 = Belgium, 276 = Germany)
  • cap: Maximum supply (e.g., 1000000000000000000000000n = 1M bonds with 18 decimals)
  • faceValue: Redemption value per bond (e.g., 1000000000000000000000n = 1000 tokens with 18 decimals)
  • maturityDate: When the bond matures (Date object)
  • denominationAsset: Your stablecoin contract address from the stablecoin guide
  • initialModulePairs: Compliance modules (empty array [] for basic setup)

Expected: Returns bond data with id (contract address)

SAVE THE CONTRACT ADDRESS from the response! You need it for Step 5.


Step 5: grant token roles

REQUIRED: Grant yourself supplyManagement (for minting) and emergency (for unpausing) roles on the bond contract.

Note: When you create a token, you automatically receive the admin role (which allows you to grant other roles) and the governance role. You must grant yourself supplyManagement and emergency roles before minting and unpausing.

Expected: The role grant transaction completes. Wait for transaction confirmation before proceeding to Step 6.


Step 6: unpause the bond

New tokens start paused. Unpause to enable transfers:

Note: This step requires the emergency role from Step 5. Make sure Step 5 completed successfully and the transaction was confirmed before unpausing.


Step 7: mint bonds

Parameters:

  • contract: Your bond contract address
  • recipients: Array of recipient wallet address(es)
  • amounts: Array of amounts in smallest unit (BigInt)
    • To mint X bonds with 18 decimals, use: X * 10^18
    • Example: 100n * 10n**18n = 100 bonds

Expected: Returns transaction hash.

Note: This step requires the supplyManagement role from Step 5.


Step 8: verify the mint

Expected: Shows bond holders with their balances.


FULL SCRIPT


Troubleshooting

"Authentication missing" → Check your auth token in createClient.

"PINCODE_INVALID" → Reconfirm your PINCODE.

"USER_NOT_AUTHORIZED" / "tokenManager required" → Follow the Set Up Roles guide Step 2 to grant the tokenManager role (requires admin access).

"Permission denied" → Follow the Set Up Roles guide Step 4 to grant token roles.

"Token is paused" → Make sure Step 6 (unpause) succeeded and you have emergency role.

"Invalid denomination asset" → Verify your stablecoin contract address from the stablecoin guide.

"Maturity date must be in the future" → Use a future date.

On this page