Create Token
To get a transaction for signing and sending, you need to make a POST request to the REST API entry point
https://pumpzone.fun/api/v2/trade
Include a JSON payload in the body of your request:
- pub_key — Your wallet public key (base58)
- mint — Token address (base58)
- action — «create»
- amount_sol — The amount of SOL to buy a token. It's mutually exclusive with the amount_tokens field
- amount_tokens — The amount of tokens to buy. It's mutually exclusive with the amount_sol field
- slippage — The percent slippage allowed in percent (by default 25%)
- priority_fee — Amount used to enhance transaction speed
- token_meta — Token metadata:
- name — Token name
- symbol — Token symbol
- description — Token description
- twitter — Twitter(X) link
- telegram — Telegram link
- website — Website link
- show_name — «true» or «false»
- image_type — «image/png» or «image/jpeg»
- image_data — Token image (base64 encoded)
Examples
import requests
import json
from solders.keypair import Keypair
from solders.transaction import VersionedTransaction
from solders.message import from_bytes_versioned
from solders.commitment_config import CommitmentLevel
from solders.rpc.requests import SendVersionedTransaction
from solders.rpc.config import RpcSendTransactionConfig
mint_keypair = Keypair()
user_keypair = Keypair.from_base58_string('Your base58 private key here')
image_data = None
with open('image.png', 'rb') as fd:
image_data = b64encode(fd.read()).decode('utf-8')
res = requests.post('https://pumpzone.fun/api/v2/trade',
headers = {"Content-Type": "application/json"},
json = {
'pub_key' : str(user_keypair.pubkey()), # Your Wallet address
'mint' : str(mint_keypair.pubkey()), # Token address
'action' : 'create',
'token_meta' : {
'name' : 'SmileToke',
'symbol' : '😜',
'description' : 'This is an example token created',
'twitter' : 'https://x.com/smiletoken',
'telegram' : 'https://t.me/smiletoken',
'website' : 'https://simpletoken.com',
'show_name' : 'true',
'image_type' : 'image/png', # image/png, image/jpeg
'image_data' : image_data # base64 image
},
'amount_sol' : 0.5, # The amount of SOL (as Dev)
# 'amount_tokens' : 10**6, # or the amount of tokens to buy
'slippage' : 25, # The percent slippage allowed (1 .. 100)
'priority_fee' : 0.0005 # Amount to use as priority fee
})
if res.status_code != 200:
print(res.text)
exit()
response = res.json()
message = from_bytes_versioned(bytes(response['result']['message']))
RPC_ENTRYPOINT = 'https://api.mainnet-beta.solana.com' # Your RPC entrypoint
res = requests.post(RPC_ENTRYPOINT,
headers={"Content-Type": "application/json"},
data = SendVersionedTransaction(
tx = VersionedTransaction(message = message, keypairs = [mint_keypair, user_keypair]),
config = RpcSendTransactionConfig(preflight_commitment = CommitmentLevel.Confirmed)
).to_json()
)
if res.status_code == 200:
signature = res.json()['result']
print(signature)
import { VersionedTransaction, Connection, Keypair, MessageV0 } from '@solana/web3.js';
import fs from 'fs'
import bs58 from 'bs58';
import axios from 'axios';
const RPC_ENDPOINT = "https://api.mainnet-beta.solana.com"; // Your RPC entrypoint
const rpc_client = new Connection(
RPC_ENDPOINT,
'confirmed',
);
async function noncustodial_create_token() {
const mint_keypair = Keypair.generate();
const user_keypair = Keypair.fromSecretKey(bs58.decode('Your base58 private key here'));
const image_blob = await fs.openAsBlob('image.png');
const image_data = Buffer.from(await image_blob.arrayBuffer()).toString('base64');
const res = await axios.post('https://pumpzone.fun/api/v2/trade',
JSON.stringify({
pub_key : user_keypair.publicKey.toString(), // Your wallet address
mint : mint_keypair.publicKey.toString(), // Token address
action : 'create',
token_meta :
{
name : 'SmileToke',
symbol : '😜',
description : 'This is an example token created',
twitter : 'https://x.com/smiletoken',
telegram : 'https://t.me/smiletoken',
website : 'https://simpletoken.com',
show_name : 'true',
image_type : 'image/png', // image/png, image/jpeg
image_data : image_data // base64 image
},
amount_sol : 0.5, // The amount of SOL
// amount_tokens' : 10**6, // or the amount of tokens to buy
slippage : 25, // The percent slippage allowed (1 .. 100)
priority_fee : 0.0005 // Amount to use as priority fee
}),
{headers: { 'Content-Type': 'application/json' }}
);
if(res.status != 200) {
console.log(res.data);
return;
}
const message = MessageV0.deserialize(new Uint8Array(res.data.result.message));
const tx = new VersionedTransaction(message);
tx.sign([mint_keypair, user_keypair]);
const signature = await rpc_client.sendTransaction(tx);
console.log(signature);
}
# status_code == 200
{
"version" : "v2",
"result" : {
"mint" : "HVDjMVwT8mwfLsXYwQwQg2th85vpvCfYfeyxjXLDos13",
"message" : [ byte array... ],
}
}
# status_code != 200
{
"version" : "v2",
"errors" : [ "Internal error, service is unavailable at now moment" ]
}