Create a Token
from solana.rpc.api import Client
from solders.keypair import Keypair
from solders.keypair import Keypair
import solcoin.create_tokens as create
PUBLIC_KEY = "your_account_pubkey_string" # ex:G3tmXiWmgnhhjb4N12YK7QgmaqtRaCRaL6i4nx2ueKwr
SLIPPAGE_PERCENT = 20
PRIORITY_FEE = .00001
tokensOrSolAmount = .1 # how much you want to buy (initial dev buy)
tokensOrSol = 'sol' # 'token' or 'sol'
client = Client("your_RPC_url") # ex:https://api.mainnet-beta.solana.com
# generates a random mint keypair
mint_keypair = Keypair()
mint_pubkey = mint_keypair.pubkey()
# the token mint's pubkey
print(mint_pubkey)
private_key_base58 = "private_key_base58_string" # your base58 private key string
payer_keypair = Keypair.from_base58_string(private_key_base58)
# metadata about your new token
form_data = {
'name': "token name",
'symbol': "tokenSymbol",
'description': "description of token",
'twitter': 'https://google.com',
'telegram': 'https://google.com',
'website': 'https://google.com',
'showName': 'true'
}
photopath = r"path\to\cover\photo\example.png"
sig, status = create.create_token(mint_pubkey, client, tokensOrSolAmount, tokensOrSol, SLIPPAGE_PERCENT, PUBLIC_KEY, payer_keypair, PRIORITY_FEE, form_data, photopath, mint_keypair)
print(sig)
print(status)Last updated