The Server SDK is currently experimental and not ready for production use.
API Reference
This page provides a comprehensive reference for all methods, types, and utilities available in the Phantom Server SDK.ServerSDK Class
Constructor
Parameters
config
(ServerSDKConfig) - Configuration object
ServerSDKConfig Type
Example
Methods
createWallet
Creates a new wallet with addresses for multiple blockchains.Parameters
walletName
(string, optional) - Custom name for the wallet
Returns
Promise<CreateWalletResult>
- Object containing:
walletId
(string) - Unique identifier for the walletaddresses
(WalletAddress[]) - Array of blockchain addresses
Example
getWallets
Lists all wallets in your organization with pagination support.Parameters
limit
(number, optional) - Number of results per page (default: 20, max: 100)offset
(number, optional) - Pagination offset (default: 0)
Returns
Promise<GetWalletsResult>
- Object containing:
wallets
(Wallet[]) - Array of wallet objectstotalCount
(number) - Total number of walletslimit
(number) - Results per pageoffset
(number) - Current offset
Example
getWalletAddresses
Retrieves addresses for a specific wallet.Parameters
walletId
(string) - The wallet IDderivationPaths
(string[], optional) - Custom derivation paths
Returns
Promise<WalletAddress[]>
- Array of wallet addresses
Example
signAndSendTransaction
Signs a transaction and optionally submits it to the network.Parameters
walletId
(string) - The wallet ID to sign withtransaction
(string) - The web3js transactionnetworkId
(NetworkId) - The target network
Returns
Promise<SignedTransaction>
- Object containing:
rawTransaction
(string) - Base64-encoded signed transaction
Example
signMessage
Signs an arbitrary message.Parameters
walletId
(string) - The wallet ID to sign withmessage
(string) - The message to signnetworkId
(NetworkId) - The network context for signing
Returns
Promise<string>
- Base64-encoded signature
Example
Types
CreateWalletResult
WalletAddress
Wallet
GetWalletsResult
SignedTransaction
NetworkId Enum
TheNetworkId
enum specifies which blockchain network to use:
Solana Networks
Ethereum Networks
Other EVM Networks
Future Networks
Utility Functions
Network Information
getNetworkDescription
Get a human-readable description of a network.getSupportedNetworkIds
Get all supported network IDs.getNetworkIdsByChain
Get all networks for a specific blockchain.supportsTransactionSubmission
Check if a network supports automatic transaction submission.Error Handling
The SDK throws errors for various failure scenarios. Always wrap SDK calls in try-catch blocks:Common Errors
Error Types
- Configuration Errors - Missing or invalid configuration
- Authentication Errors - Invalid credentials or unauthorized access
- Validation Errors - Invalid parameters or data
- Network Errors - Connection or timeout issues
- Wallet Errors - Wallet not found or access denied
Rate Limits
The Phantom API implements rate limiting to ensure fair usage:- Wallet Creation: Limited per organization
- Transaction Signing: Limited per wallet
- API Calls: General rate limit per organization