Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/prdsrm/pumpdotfun-go-sdk
Pump.fun Golang SDK, create, buy/sell tokens on pump.fun in Go!
https://github.com/prdsrm/pumpdotfun-go-sdk
pump-fun solana
Last synced: 2 days ago
JSON representation
Pump.fun Golang SDK, create, buy/sell tokens on pump.fun in Go!
- Host: GitHub
- URL: https://github.com/prdsrm/pumpdotfun-go-sdk
- Owner: prdsrm
- License: bsd-3-clause
- Created: 2024-11-04T23:49:23.000Z (3 days ago)
- Default Branch: main
- Last Pushed: 2024-11-05T00:25:16.000Z (3 days ago)
- Last Synced: 2024-11-05T00:31:07.311Z (3 days ago)
- Topics: pump-fun, solana
- Language: Go
- Homepage:
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Roadmap: ROADMAP.md
Awesome Lists containing this project
README
# Pump.fun Go SDK
[![Go](https://img.shields.io/badge/Go-%2300ADD8.svg?&logo=go&logoColor=white)](#)
A SDK allowing you to create, buy and sell pump.fun tokens in Golang.
## Installation
```bash
go get github.com/prdsrm/pumpdotfun-go-sdk
```## Usage
```go
package mainimport (
"log"
"os"
"context"// General solana packages.
"github.com/gagliardetto/solana-go"
"github.com/gagliardetto/solana-go/rpc"
"github.com/gagliardetto/solana-go/rpc/ws"// Pump.fun Go SDK.
pumpdotfunsdk "github.com/prdsrm/pumpdotfun-go-sdk"
)type Client struct {
RpcClient *rpc.Client
WsClient *ws.Client
}func getClient(rpcUrl string, wsUrl string) *Client {
rpcClient := rpc.New(rpcUrl)
wsClient, err := ws.Connect(context.Background(), wsUrl)
if err != nil {
log.Fatalln("ws connection error: ", err)
}
return &Client{RpcClient: rpcClient, WsClient: wsClient}
}func main() {
privateKey, err := solana.PrivateKeyFromBase58(os.Getenv("PRIVATE_KEY"))
if err != nil {
log.Fatalln("please set PRIVATE_KEY environment variable:", privateKey)
}
rpcURL := rpc.MainNetBeta_RPC
wsURL := rpc.MainNetBeta_WS
c := getClient(rpcURL, wsURL)
mint := solana.NewWallet()
err = pumpdotfunsdk.CreateToken(
c.RpcClient,
c.WsClient,
privateKey,
mint,
"TEST", // symbol
"TEST", // name
"https://example.com", // metadata uri
0.1, // buy 0.1 SOL
0.98, // 2% slippage
)
if err != nil {
log.Fatalln("can't create token:", err)
}
}
```## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
## License
BSD-3-Clause license, because FreeBSD is the best OS