ChainPortalChainPortal Docs
SDK Reference
SDK Reference

SDK Services

Low-level service classes for direct contract interaction across all ecosystems.

SDK Services

Services are the low-level building blocks of the ChainPortal SDK. They handle direct contract interaction, transaction building, and state management for each ecosystem.

Most developers should use hooks instead. Services are for advanced use cases where you need direct contract access, custom transaction flows, or non-React environments.

EVM Services

EVMEVM

TokenService

Creates and manages ERC20 tokens via factory contracts.

import { TokenService } from '@chainportal/sdk';
 
const tokenService = new TokenService(publicClient, walletClient);
 
// Create a new token
const tx = await tokenService.createToken({
  name: 'My Token',
  symbol: 'MTK',
  initialSupply: '1000000',
  decimals: 18,
  features: {
    mintable: true,
    burnable: true,
    pausable: false,
    taxable: false,
  },
});
 
// Manage existing token
await tokenService.mint(tokenAddress, recipientAddress, amount);
await tokenService.burn(tokenAddress, amount);
await tokenService.transfer(tokenAddress, to, amount);

Key methods:

MethodDescription
createToken(params)Deploy new ERC20 via factory
mint(token, to, amount)Mint tokens (if mintable)
burn(token, amount)Burn tokens (if burnable)
pause(token) / unpause(token)Pause/unpause transfers
setTax(token, buyTax, sellTax)Configure transaction tax
setAntiBot(token, config)Configure anti-bot protection

NFTService

Creates and manages ERC721 and ERC1155 collections.

import { NFTService } from '@chainportal/sdk';
 
const nftService = new NFTService(publicClient, walletClient);
 
// Create ERC721 collection
const tx = await nftService.createCollection({
  name: 'My NFT',
  symbol: 'MNFT',
  baseURI: 'ipfs://Qm.../metadata/',
  maxSupply: 10000,
  mintPrice: '0.05',
  royaltyBps: 500, // 5%
});
 
// Mint NFTs
await nftService.mint(collectionAddress, to, quantity);
await nftService.setMintPhase(collectionAddress, 'public');

AirdropService

Batch distribute tokens to multiple addresses.

import { AirdropService } from '@chainportal/sdk';
 
const airdropService = new AirdropService(publicClient, walletClient);
 
// Batch transfer with custom amounts
await airdropService.batchTransfer(tokenAddress, [
  { address: '0x...', amount: '1000' },
  { address: '0x...', amount: '2500' },
]);
 
// Equal distribution
await airdropService.airdropEqual(tokenAddress, addresses, '100');
 
// Parse CSV file
const rows = AirdropService.parseCSV(csvContent);

Solana Services

SolanaSolana

SolanaTokenService

Creates SPL tokens using the native Token Program.

import { SolanaTokenService } from '@chainportal/sdk';
 
const service = new SolanaTokenService(connection, wallet);
 
// Create SPL token
const { mint, tx } = await service.createToken({
  name: 'My SPL Token',
  symbol: 'MSPL',
  decimals: 9,
  initialSupply: 1_000_000,
  uri: 'https://arweave.net/metadata.json',
});
 
// Mint additional tokens
await service.mintTo(mintAddress, destinationAta, amount);

SolanaNFTService

Creates NFT collections using Metaplex.

import { SolanaNFTService } from '@chainportal/sdk';
 
const service = new SolanaNFTService(connection, wallet);
 
// Create collection
const { collectionMint } = await service.createCollection({
  name: 'My Collection',
  symbol: 'MCOL',
  uri: 'https://arweave.net/collection.json',
  sellerFeeBasisPoints: 500,
});
 
// Mint NFT into collection
await service.mintNFT({
  collection: collectionMint,
  name: 'NFT #1',
  uri: 'https://arweave.net/nft1.json',
});

Cosmos Services

CosmosCosmos

CosmosTokenService

Creates CW20 tokens on CosmWasm chains.

import { CosmosTokenService } from '@chainportal/sdk';
 
const service = new CosmosTokenService(signingClient, senderAddress);
 
// Instantiate CW20 token
const { contractAddress } = await service.createToken({
  name: 'Cosmos Token',
  symbol: 'CTK',
  decimals: 6,
  initialSupply: '1000000000000',
  mintable: true,
});
 
// CW20 operations
await service.transfer(contractAddress, recipient, amount);
await service.mint(contractAddress, recipient, amount);

CosmosNFTService

Creates CW721 NFT collections.

import { CosmosNFTService } from '@chainportal/sdk';
 
const service = new CosmosNFTService(signingClient, senderAddress);
 
const { contractAddress } = await service.createCollection({
  name: 'Cosmos NFTs',
  symbol: 'CNFT',
  minter: senderAddress,
});
 
await service.mint(contractAddress, {
  tokenId: '1',
  owner: recipient,
  tokenUri: 'ipfs://...',
});

Aptos Services

AptosAptos

AptosTokenService

Creates Fungible Assets using Move modules.

import { AptosTokenService } from '@chainportal/sdk';
 
const service = new AptosTokenService(aptosClient);
 
const tx = await service.createFungibleAsset({
  name: 'Aptos Token',
  symbol: 'APT',
  decimals: 8,
  initialSupply: '100000000',
  iconUri: 'https://...',
  projectUri: 'https://...',
});

AptosNFTService

Creates Digital Assets (NFT collections).

import { AptosNFTService } from '@chainportal/sdk';
 
const service = new AptosNFTService(aptosClient);
 
const tx = await service.createCollection({
  name: 'Aptos NFTs',
  description: 'A collection on Aptos',
  uri: 'https://...',
  maxSupply: 10000,
  royaltyBps: 500,
});

SUI Services

SUISUI

SuiTokenService

Creates coins using the SUI Move framework.

import { SuiTokenService } from '@chainportal/sdk';
 
const service = new SuiTokenService(suiClient);
 
// Register existing coin (SUI requires module deployment first)
const tx = await service.registerCoin({
  coinMetadataId: '0x...',
  name: 'SUI Coin',
  symbol: 'SC',
  decimals: 9,
});

SuiNFTService

Creates NFT objects on SUI.

import { SuiNFTService } from '@chainportal/sdk';
 
const service = new SuiNFTService(suiClient);
 
const tx = await service.createCollection({
  name: 'SUI NFTs',
  description: 'NFT collection on SUI',
  imageUrl: 'https://...',
  royaltyBps: 500,
});

NEAR Services

NEARNEAR

NearTokenService

Creates NEP-141 fungible tokens.

import { NearTokenService } from '@chainportal/sdk';
 
const service = new NearTokenService(nearConnection, accountId);
 
const tx = await service.createToken({
  name: 'NEAR Token',
  symbol: 'NTK',
  decimals: 24,
  totalSupply: '1000000000000000000000000000000',
  icon: 'data:image/svg+xml,...',
});

NearNFTService

Creates NEP-171 NFT collections.

import { NearNFTService } from '@chainportal/sdk';
 
const service = new NearNFTService(nearConnection, accountId);
 
const tx = await service.createCollection({
  name: 'NEAR NFTs',
  symbol: 'NNFT',
  baseUri: 'https://...',
});
 
await service.mint('1', recipientId, {
  title: 'NFT #1',
  description: 'First NFT',
  media: 'https://...',
});