SolTool
Welcome
Fast Api
Local Api

Fast API Guide

This guide explains how to use the Fast API to create wallets and get API keys for trading.

1. Create Wallet

First, you need to create a wallet to get your API key. This API key will be used for all subsequent transactions.

Request

{ "jsonrpc": "2.0", "id": 1, "method": "soltool_createWallet", "params": [] }

Response

{ "jsonrpc": "2.0", "id": 1, "result": { "private_key": "string", // Your wallet's private key (keep this secure!) "public_key": "string", // Your wallet's public key "api_key": "string" // Your API key for future requests } }

Examples

import requests def create_wallet(): # Create a new wallet and get API key response = requests.post( "https://api.soltool.pro/rpc", json={ "jsonrpc": "2.0", "id": 1, "method": "soltool_createWallet", "params": [] } ) # Parse response result = response.json() if "result" in result: data = result["result"] print("Wallet created successfully!") print(f"Public Key: {data['public_key']}") print(f"Private Key: {data['private_key']}") print(f"API Key: {data['api_key']}") # IMPORTANT: Securely save these keys # They cannot be recovered if lost return data else: print("Error:", result.get("error", {}).get("message", "Unknown error")) return None # Create wallet and get API key wallet_data = create_wallet()

Important Notes

1. Security:
  • SECURELY SAVE YOUR PRIVATE KEY: You can restore your wallet at any time via your private key and withdraw funds. Anyone with access to your private key can do the same.
  • SECURELY SAVE YOUR API KEY: Anyone with your API key can trade using the funds in your wallet.
  • Keys cannot be recovered if lost.
2. Wallet Usage:
  • You may create as many wallets as you like
  • If you are building a trading service for multiple users, you will probably want to create a new wallet per user
  • Each wallet comes with its own API key
3. Funding Your Wallet:
  • Send SOL to the wallet's public key address
  • The wallet will be ready to trade once funded
  • You can check the balance using the public key

Error Response Format

{ "jsonrpc": "2.0", "id": 1, "error": { "code": -32602, // Error code "message": "Invalid request", // Error message "data": "Detailed error information" // Optional detailed error information } }

Best Practices

1. Key Storage:
  • Store private keys and API keys securely
  • Use environment variables or secure key management systems
  • Never commit keys to version control
  • Consider encrypting keys at rest
2. Wallet Management:
  • Keep track of which API key corresponds to which wallet
  • Monitor wallet balances regularly
  • Implement proper error handling for failed transactions
  • Consider implementing rate limiting for API calls
3. Security Measures:
  • Use HTTPS for all API calls
  • Implement proper authentication for your application
Remember to:
  • Implement proper error handling in your application
  • Follow security best practices for key management
  • Test with small amounts first before using larger amounts