SDK Integration
Quick guide to integrate the Asset Tokenization Studio SDK in your project.
Installation
npm install @hashgraph/asset-tokenization-sdk
Setup
1. Initialize the Network
import { Network, InitializationRequest } from "@hashgraph/asset-tokenization-sdk";
const initRequest = new InitializationRequest({
network: "testnet",
mirrorNode: {
baseUrl: "https://testnet.mirrornode.hedera.com/api/v1/",
apiKey: "",
headerName: "",
},
rpcNode: {
baseUrl: "https://testnet.hashio.io/api",
apiKey: "",
headerName: "",
},
configuration: {
resolverAddress: "0.0.7707874", // See deployed-addresses.md
factoryAddress: "0.0.7708432",
},
});
await Network.init(initRequest);
2. Connect a Wallet
Hedera WalletConnect 2.0 (HashPack, Blade, and other WC-compatible wallets)
import { ConnectRequest, SupportedWallets } from "@hashgraph/asset-tokenization-sdk";
const connectRequest = new ConnectRequest({
network: "testnet",
mirrorNode: {
baseUrl: "https://testnet.mirrornode.hedera.com/api/v1/",
apiKey: "",
headerName: "",
},
rpcNode: {
baseUrl: "https://testnet.hashio.io/api",
apiKey: "",
headerName: "",
},
wallet: SupportedWallets.HWALLETCONNECT,
hwcSettings: {
projectId: "your_walletconnect_project_id", // from https://cloud.walletconnect.com
dappName: "My ATS App",
dappDescription: "Asset Tokenization Studio dApp",
dappURL: "https://example.com",
dappIcons: ["https://example.com/icon.png"],
},
});
const walletData = await Network.connect(connectRequest);
Note: HashPack and Blade wallets connect via Hedera WalletConnect 2.0 (
SupportedWallets.HWALLETCONNECT). You need a WalletConnectprojectIdfrom cloud.walletconnect.com.
MetaMask
const connectRequest = new ConnectRequest({
// ...network config...
wallet: SupportedWallets.METAMASK,
});
const walletData = await Network.connect(connectRequest);
Basic Usage
Create an Equity Token
import { Equity, CreateEquityRequest } from "@hashgraph/asset-tokenization-sdk";
const request = new CreateEquityRequest({
tokenName: "Acme Corporation Common Stock",
tokenSymbol: "ACME",
tokenDecimals: 0,
tokenTotalSupply: 1000000,
isin: "US9311421039",
});
const response = await Equity.create(request);
console.log("Token created:", response.security.tokenId);
Transfer Tokens
import { Security, TransferRequest } from "@hashgraph/asset-tokenization-sdk";
const transferRequest = new TransferRequest({
tokenId: "0.0.1234567",
targetId: "0.0.7654321",
amount: 100,
});
const success = await Security.transfer(transferRequest);
Grant KYC
import { Kyc, GrantKycRequest } from "@hashgraph/asset-tokenization-sdk";
const grantKycRequest = new GrantKycRequest({
tokenId: "0.0.1234567",
targetId: "0.0.7654321",
vcData: "verifiable_credential_data",
});
await Kyc.grantKyc(grantKycRequest);
Next Steps
- SDK Overview - Learn about SDK architecture and available operations
- Deployed Addresses - Current contract addresses
- Smart Contracts - Understanding the contract structure