Skip to main content

A package for Solana transactions token transactions

Project description

Logo

GitHub Python License

Solcoin is a python package with many different solana token transaction
Full Docs: https://solcoin.gitbook.io/docs

Features

Main

  • Buy Tokens
  • Sell Tokens
  • Create Tokens
  • Transfer SOL
  • close accounts
  • WebSocket RPC Listeners

Other

  • find token bonding curve from mint
  • find token prices from bonding curve
  • create pumpfun transaction data

Quickstart

pip install solcoin

More explanation at https://solcoin.gitbook.io/docs/pumpfun-tokens

Buy Tokens

from solders.pubkey import Pubkey
from solana.rpc.api import Client
from solders.keypair import Keypair
​
import solcoin.buy_tokens as buy
​
PUBLIC_KEY = "your_account_pubkey_string" # ex:G3tmXiWmgnhhjb4N12YK7QgmaqtRaCRaL6i4nx2ueKwr
TOKEN_MINT = "token_mint_string" # ex:6oDn2PDvjtKYoWVp9cNNe1WCepjS8VQzhBRS8qmXpump
mint_pubkey = Pubkey.from_string(TOKEN_MINT)
client = Client("your_RPC_url") # ex:https://api.mainnet-beta.solana.com
​
tokensOrSolAmount = .1 # how many tokens or sol you want to purchase
tokensOrSol = 'sol' # either 'token' or 'sol', whichever unit you want to buy in
SLIPPAGE_PERCENT = 20
PRIORITY_FEE = .000001 
​
private_key_base58 = "private_key_base58_string" # your base58 private key string
payer_keypair = Keypair.from_base58_string(private_key_base58)
​
​
sig, status = buy.purchase_token(mint_pubkey, client, tokensOrSolAmount, tokensOrSol, SLIPPAGE_PERCENT, PUBLIC_KEY, payer_keypair, PRIORITY_FEE, allow_analytics=True)
​
print(sig) # prints the signature of the transaction
print(status) # prints the current status of the transaction

Sell Tokens

from solders.pubkey import Pubkey
from solana.rpc.api import Client
from solders.keypair import Keypair

import solcoin.sell_tokens as sell

PUBLIC_KEY = "your_account_pubkey_string" # ex:G3tmXiWmgnhhjb4N12YK7QgmaqtRaCRaL6i4nx2ueKwr
TOKEN_MINT = "token_mint_string" # ex:6oDn2PDvjtKYoWVp9cNNe1WCepjS8VQzhBRS8qmXpump
mint_pubkey = Pubkey.from_string(TOKEN_MINT)
client = Client("your_RPC_url") # ex:https://api.mainnet-beta.solana.com

tokensOrSolAmount = 100 # how many tokens or sol or percent of coins you own you want to purchase
tokensOrSol = 'percent' # either 'token' or 'sol' or 'percent, whichever unit you want to buy in
SLIPPAGE_PERCENT = 20
PRIORITY_FEE = .000001 

private_key_base58 = "private_key_base58_string" # your base58 private key string
payer_keypair = Keypair.from_base58_string(private_key_base58)


sig, status = sell.sell_token(mint_pubkey, client, tokensOrSolAmount, tokensOrSol, SLIPPAGE_PERCENT, PUBLIC_KEY, payer_keypair, PRIORITY_FEE, allow_analytics=True)


print(sig) # prints the signature of the transaction
print(status) # prints the current status of the transaction

Create Tokens

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, allow_analytics=True)
​
print(sig)
print(status)

Fees

0% fee on all transactions

Fee Table

Security

  • Private keys never leave your computer unlike a lot of the competition

  • All transactions created, signed, and sent locally

  • Fully open source and transparent code at https://github.com/bear102/solcoin

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

solcoin-0.2.2.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

solcoin-0.2.2-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file solcoin-0.2.2.tar.gz.

File metadata

  • Download URL: solcoin-0.2.2.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.1

File hashes

Hashes for solcoin-0.2.2.tar.gz
Algorithm Hash digest
SHA256 555616d36dbdd72ba8ff892c24ee2fd67b19b5ce2cdb1591068ca9828b257ecc
MD5 62c0f77a67afa8c88ba556f6c868f262
BLAKE2b-256 251c19144ff5d0bbff31ddd34073b1fc44e7eeeb51e19452241a7bba959a17e3

See more details on using hashes here.

File details

Details for the file solcoin-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: solcoin-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 16.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.1

File hashes

Hashes for solcoin-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8453bf13d28e34306f657ea12f4512b02aa679a24212f7689869e1ebeff7a06a
MD5 e79c71654bd71f732133f78e7755c392
BLAKE2b-256 dd384b2eb032ff8dda2bc5a8046cc43b2eb3c0110c18b6a84f9c13d262bf1375

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page