Types Reference
Exported TypeScript interfaces and types for @chainportal/sdk -- token/NFT configs, results, adapters, and transactions.
Types Reference
Every public type in @chainportal/sdk is exported from the package root, so you can import
them directly alongside the hooks and services that use them:
Numeric vs string chain IDs: EVM chains use a numeric chainId (e.g. 1); Solana, Cosmos,
Aptos, SUI, and NEAR use a string id (e.g. 'mainnet-beta'). Types that span ecosystems use
number | string accordingly.
Wallet & connection
WalletConnection
Current state of a wallet connection for any ecosystem.
| Field | Type | Description |
|---|---|---|
address | string | Connected wallet address |
chainId | number | string | Active chain ID (numeric for EVM, string otherwise) |
ecosystem | ChainEcosystem | Ecosystem this connection belongs to |
walletName | string | Display name of the wallet (e.g. "MetaMask", "Phantom") |
isConnected | boolean | Whether the wallet is currently connected |
Token creation
TokenConfig
Configuration for creating a new token via the factory contract.
| Field | Type | Description |
|---|---|---|
name | string | Token display name |
symbol | string | Token ticker symbol |
decimals | number | Number of decimal places (0–18) |
initialSupply | bigint | Initial supply minted to the creator (base units) |
maxSupply? | bigint | Maximum supply cap; 0/undefined means uncapped |
mintable? | boolean | Supports post-deployment minting |
burnable? | boolean | Holders can burn their tokens |
pausable? | boolean | Owner can pause all transfers |
description? | string | Human-readable description (not stored on-chain) |
logoUri? | string | URI to the token logo image |
antiBotProtection? | boolean | Enable anti-bot protection features |
maxTxPercent? | bigint | Max % of total supply per transaction (anti-bot) |
maxWalletPercent? | bigint | Max % of total supply per wallet (anti-bot) |
tradingCooldown? | bigint | Cooldown between trades, seconds (anti-bot) |
protectionDuration? | bigint | Anti-bot protection duration, seconds |
maxBlockPercent? | bigint | Max % of total supply traded per block (anti-bot) |
TokenCreationResult
Returned after a token creation transaction confirms.
| Field | Type | Description |
|---|---|---|
success | boolean | Whether the creation succeeded |
tokenAddress | string | Deployed token contract address |
transactionHash | string | On-chain transaction hash |
chainId | number | string | Chain the token was created on |
explorerUrl? | string | Block explorer URL for the transaction |
NFT creation
NFTAttribute
A single OpenSea-compatible trait attribute.
| Field | Type | Description |
|---|---|---|
trait_type | string | Trait category (e.g. "Background") |
value | string | number | Trait value |
display_type? | 'number' | 'date' | 'boost_number' | 'boost_percentage' | Display hint for numeric values |
NFTCollectionConfig
Configuration for creating an NFT collection (ERC-721 or ERC-1155).
| Field | Type | Description |
|---|---|---|
name | string | Collection display name |
symbol | string | Collection ticker symbol |
description? | string | Human-readable description |
baseUri? | string | Base URI for token metadata (tokens append their ID) |
maxSupply? | number | Max mintable tokens (0 = unlimited) |
royaltyBps? | number | Royalty fee in basis points (e.g. 250 = 2.5%) |
royaltyRecipient? | string | Address that receives royalties |
NFTItemConfig
Configuration for minting a single NFT within a collection.
| Field | Type | Description |
|---|---|---|
name | string | Display name of the NFT |
description | string | Human-readable description |
image | string | IPFS or HTTP URL to the image |
externalUrl? | string | External link for more details |
attributes? | NFTAttribute[] | Trait attributes |
animationUrl? | string | URL to a video/audio animation |
NFTCreationResult
Returned after a collection creation or mint confirms.
| Field | Type | Description |
|---|---|---|
success | boolean | Whether the operation succeeded |
collectionAddress? | string | Deployed collection address (collection creation) |
tokenId? | string | number | Minted token ID (mint operations) |
transactionHash | string | On-chain transaction hash |
chainId | number | string | Chain the operation occurred on |
metadataUri? | string | IPFS metadata URI for the minted token |
explorerUrl? | string | Block explorer URL for the transaction |
Transactions & gas
TransactionStatus
The persisted transaction store uses a richer status set — 'pending' | 'confirming' | 'success' | 'failed' — see the State Stores page. This TransactionStatus
is the adapter-level result type.
TransactionResult
Result of waiting for a transaction to confirm on-chain.
| Field | Type | Description |
|---|---|---|
hash | string | On-chain transaction hash |
status | TransactionStatus | Final status |
chainId | number | string | Chain the transaction ran on |
blockNumber? | number | Block the transaction was included in |
gasUsed? | bigint | Gas consumed |
explorerUrl? | string | Block explorer URL |
GasEstimate
Result of estimating gas for a transaction.
| Field | Type | Description |
|---|---|---|
gasLimit | bigint | Max gas units the transaction may consume |
gasPrice? | bigint | Legacy gas price (pre-EIP-1559 chains) |
maxFeePerGas? | bigint | EIP-1559 max fee per gas |
maxPriorityFeePerGas? | bigint | EIP-1559 max priority fee (tip) |
estimatedCost | bigint | Estimated total cost in native currency (wei) |
Adapters
All ecosystem adapters implement a common interface, giving you a unified API regardless of chain. Most apps use hooks rather than adapters directly.
IChainAdapter
| Member | Signature | Description |
|---|---|---|
ecosystem | ChainEcosystem | Adapter's ecosystem (readonly) |
chain | ChainConfig | Current chain config (readonly) |
connect() | () => Promise<WalletConnection> | Connect the wallet |
disconnect() | () => Promise<void> | Disconnect the wallet |
isConnected() | () => boolean | Whether a wallet is connected |
getAddress() | () => string | null | Connected address, or null |
switchChain() | (chainId) => Promise<void> | Switch chain within the ecosystem |
getNativeBalance() | (address) => Promise<bigint> | Native balance (ETH, SOL, …) |
getTokenBalance() | (address, tokenAddress) => Promise<bigint> | Token balance |
createToken() | (config: TokenConfig) => Promise<TokenCreationResult> | Create a token |
createNFTCollection() | (config: NFTCollectionConfig) => Promise<NFTCreationResult> | Create a collection |
mintNFT() | (collectionAddress, config: NFTItemConfig) => Promise<NFTCreationResult> | Mint into a collection |
waitForTransaction() | (hash) => Promise<TransactionResult> | Wait for confirmation |
estimateGas() | (to, data, value?) => Promise<GasEstimate> | Estimate gas |
IEVMAdapter / ISolanaAdapter
Narrowed variants of IChainAdapter that fix ecosystem to 'evm' / 'solana' and use the
ecosystem-specific chain config (EVMChainConfig / SolanaChainConfig).
See also
- Services — classes that consume these types
- Hooks — React hooks that return these result types
- State Stores — the persisted
Transactionshape