├── .gitignore ├── README.md ├── data ├── data.go ├── pumpfunIDL.json └── transactionData.go ├── generated └── pump │ ├── Buy.go │ ├── Buy_test.go │ ├── Create.go │ ├── Create_test.go │ ├── Initialize.go │ ├── Initialize_test.go │ ├── Sell.go │ ├── Sell_test.go │ ├── SetParams.go │ ├── SetParams_test.go │ ├── Withdraw.go │ ├── Withdraw_test.go │ ├── accounts.go │ ├── instructions.go │ ├── testing_utils.go │ └── types.go ├── go.mod ├── go.sum ├── main.go ├── token └── token.go └── transaction └── transaction.go /.gitignore: -------------------------------------------------------------------------------- 1 | /wallet/* -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | This code builds and sends a buy transtation to the pump.fun contract. 2 | 3 | Parameters: 4 | * --helius-rpc-api-key="" // REQUIRED(string): helius rpc key or solana free rpc endpoint 5 | * --helius-websocket-api-key="" // REQUIRED(string): helius websocket key or solana free websocket endpoint 6 | * --wallet-path="" // REQUIRED(string): relative path to wallet private key in JSON format 7 | * --Solana-amount="" // REQUIRED(string): Solana amount to be used for buying token 8 | * --test="" // OPTIONAL(bool): test denotes whether the transaction is sent to the mainnet or simulated. 9 | 10 | Example call: 11 | 12 | > go run all --helius-rpc-api-key="https://api.mainnet-beta.solana.com" --helius-websocket-api-key="ws://api.mainnet-beta.solana.com" --wallet-path="./path/to/wallet/private/key/wallet.json" --solana-amount=0.001 --test=true 13 | 14 | General Logic: 15 | 16 | 1. subscribe tp the pump.fun mint contract 17 | 2. parse mint events to pump.fun 18 | 3. Extract mint data 19 | 4. Build pump.fun buy transaction 20 | 5. Send pump.fun buy transaction 21 | 22 | > NOTE: This bot continously buys the amount speciffied in the flag --solana-amount for each mint created in pump.fun. To stop buying, you must kill the program. 23 | 24 | Please file bugs for any desired added features! 25 | 26 | To support my dev work: 27 | 28 | - Sol Addr: 9hTDxXAsHsJtVfhZJsfzprv74VPYpVxxRmvV1jUgToEp 29 | 30 | -------------------------------------------------------------------------------- /data/data.go: -------------------------------------------------------------------------------- 1 | package data 2 | 3 | import "github.com/gagliardetto/solana-go" 4 | 5 | type Err struct { 6 | Code int `json:"code"` 7 | Message string `json:"message"` 8 | } 9 | 10 | type GetParsedTransactionFromSignatureResponse struct { 11 | Jsonrpc string `json:"jsonrpc"` 12 | Result struct { 13 | BlockTime int `json:"blockTime"` 14 | Meta struct { 15 | ComputeUnitsConsumed int `json:"computeUnitsConsumed"` 16 | Err Err `json:"err,omitempty"` 17 | Fee int `json:"fee"` 18 | InnerInstructions []struct { 19 | Index int `json:"index"` 20 | Instructions []struct { 21 | Accounts []string `json:"accounts,omitempty"` 22 | Data string `json:"data,omitempty"` 23 | ProgramID string `json:"programId"` 24 | StackHeight int `json:"stackHeight"` 25 | Parsed struct { 26 | Info struct { 27 | Amount string `json:"amount"` 28 | Authority string `json:"authority"` 29 | Destination string `json:"destination"` 30 | Source string `json:"source"` 31 | Lamports int64 `json:"lamports,omitempty"` 32 | Mint string `json:"mint,omitempty"` 33 | MintAuthority string `json:"mintAuthority,omitempty"` 34 | Account string `json:"account,omitempty"` 35 | } `json:"info"` 36 | Type string `json:"type"` 37 | } `json:"parsed,omitempty"` 38 | Program string `json:"program,omitempty"` 39 | } `json:"instructions"` 40 | } `json:"innerInstructions"` 41 | LogMessages []string `json:"logMessages"` 42 | PostBalances []interface{} `json:"postBalances"` 43 | PostTokenBalances []struct { 44 | AccountIndex int `json:"accountIndex"` 45 | Mint string `json:"mint"` 46 | Owner string `json:"owner"` 47 | ProgramID string `json:"programId"` 48 | UITokenAmount struct { 49 | Amount string `json:"amount"` 50 | Decimals int `json:"decimals"` 51 | UIAmount float64 `json:"uiAmount"` 52 | UIAmountString string `json:"uiAmountString"` 53 | } `json:"uiTokenAmount"` 54 | } `json:"postTokenBalances"` 55 | PreBalances []interface{} `json:"preBalances"` 56 | PreTokenBalances []struct { 57 | AccountIndex int `json:"accountIndex"` 58 | Mint string `json:"mint"` 59 | Owner string `json:"owner"` 60 | ProgramID string `json:"programId"` 61 | UITokenAmount struct { 62 | Amount string `json:"amount"` 63 | Decimals int `json:"decimals"` 64 | UIAmount float64 `json:"uiAmount"` 65 | UIAmountString string `json:"uiAmountString"` 66 | } `json:"uiTokenAmount"` 67 | } `json:"preTokenBalances"` 68 | Rewards []interface{} `json:"rewards"` 69 | Status struct { 70 | Ok interface{} `json:"Ok"` 71 | } `json:"status"` 72 | } `json:"meta"` 73 | Slot int `json:"slot"` 74 | Transaction struct { 75 | Message struct { 76 | AccountKeys []struct { 77 | Pubkey string `json:"pubkey"` 78 | Signer bool `json:"signer"` 79 | Source string `json:"source"` 80 | Writable bool `json:"writable"` 81 | } `json:"accountKeys"` 82 | AddressTableLookups []struct { 83 | AccountKey string `json:"accountKey"` 84 | ReadonlyIndexes []int `json:"readonlyIndexes"` 85 | WritableIndexes []int `json:"writableIndexes"` 86 | } `json:"addressTableLookups"` 87 | Instructions []struct { 88 | Accounts []interface{} `json:"accounts"` 89 | Data string `json:"data"` 90 | ProgramID string `json:"programId"` 91 | StackHeight interface{} `json:"stackHeight"` 92 | } `json:"instructions"` 93 | RecentBlockhash string `json:"recentBlockhash"` 94 | } `json:"message"` 95 | Signatures []string `json:"signatures"` 96 | } `json:"transaction"` 97 | Version int `json:"version"` 98 | } `json:"result"` 99 | ID int `json:"id"` 100 | } 101 | 102 | type LogsNotificationResponse struct { 103 | Jsonrpc string `json:"jsonrpc"` 104 | Method string `json:"method"` 105 | Params struct { 106 | Result struct { 107 | Context struct { 108 | Slot int `json:"slot"` 109 | } `json:"context"` 110 | Value struct { 111 | Signature string `json:"signature"` 112 | Err interface{} `json:"err"` 113 | Logs []string `json:"logs"` 114 | } `json:"value"` 115 | } `json:"result"` 116 | Subscription int `json:"subscription"` 117 | } `json:"params"` 118 | } 119 | 120 | type MintData struct { 121 | Info *MintInfo 122 | Type string 123 | TokenAmount uint64 124 | DevSupply float64 125 | TokenPriceInSol float64 126 | CreationHash string 127 | } 128 | 129 | type MintInfo struct { 130 | MintAddress solana.PublicKey 131 | MintAuthority string 132 | TotalSupply string 133 | MarketCapInSol string 134 | } 135 | -------------------------------------------------------------------------------- /data/pumpfunIDL.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.1.0", 3 | "name": "pump", 4 | "instructions": [ 5 | { 6 | "name": "initialize", 7 | "docs": [ 8 | "Creates the global state." 9 | ], 10 | "accounts": [ 11 | { 12 | "name": "global", 13 | "isMut": true, 14 | "isSigner": false 15 | }, 16 | { 17 | "name": "user", 18 | "isMut": true, 19 | "isSigner": true 20 | }, 21 | { 22 | "name": "systemProgram", 23 | "isMut": false, 24 | "isSigner": false 25 | } 26 | ], 27 | "args": [] 28 | }, 29 | { 30 | "name": "setParams", 31 | "docs": [ 32 | "Sets the global state parameters." 33 | ], 34 | "accounts": [ 35 | { 36 | "name": "global", 37 | "isMut": true, 38 | "isSigner": false 39 | }, 40 | { 41 | "name": "user", 42 | "isMut": true, 43 | "isSigner": true 44 | }, 45 | { 46 | "name": "systemProgram", 47 | "isMut": false, 48 | "isSigner": false 49 | }, 50 | { 51 | "name": "eventAuthority", 52 | "isMut": false, 53 | "isSigner": false 54 | }, 55 | { 56 | "name": "program", 57 | "isMut": false, 58 | "isSigner": false 59 | } 60 | ], 61 | "args": [ 62 | { 63 | "name": "feeRecipient", 64 | "type": "publicKey" 65 | }, 66 | { 67 | "name": "initialVirtualTokenReserves", 68 | "type": "u64" 69 | }, 70 | { 71 | "name": "initialVirtualSolReserves", 72 | "type": "u64" 73 | }, 74 | { 75 | "name": "initialRealTokenReserves", 76 | "type": "u64" 77 | }, 78 | { 79 | "name": "tokenTotalSupply", 80 | "type": "u64" 81 | }, 82 | { 83 | "name": "feeBasisPoints", 84 | "type": "u64" 85 | } 86 | ] 87 | }, 88 | { 89 | "name": "create", 90 | "docs": [ 91 | "Creates a new coin and bonding curve." 92 | ], 93 | "accounts": [ 94 | { 95 | "name": "mint", 96 | "isMut": true, 97 | "isSigner": true 98 | }, 99 | { 100 | "name": "mintAuthority", 101 | "isMut": false, 102 | "isSigner": false 103 | }, 104 | { 105 | "name": "bondingCurve", 106 | "isMut": true, 107 | "isSigner": false 108 | }, 109 | { 110 | "name": "associatedBondingCurve", 111 | "isMut": true, 112 | "isSigner": false 113 | }, 114 | { 115 | "name": "global", 116 | "isMut": false, 117 | "isSigner": false 118 | }, 119 | { 120 | "name": "mplTokenMetadata", 121 | "isMut": false, 122 | "isSigner": false 123 | }, 124 | { 125 | "name": "metadata", 126 | "isMut": true, 127 | "isSigner": false 128 | }, 129 | { 130 | "name": "user", 131 | "isMut": true, 132 | "isSigner": true 133 | }, 134 | { 135 | "name": "systemProgram", 136 | "isMut": false, 137 | "isSigner": false 138 | }, 139 | { 140 | "name": "tokenProgram", 141 | "isMut": false, 142 | "isSigner": false 143 | }, 144 | { 145 | "name": "associatedTokenProgram", 146 | "isMut": false, 147 | "isSigner": false 148 | }, 149 | { 150 | "name": "rent", 151 | "isMut": false, 152 | "isSigner": false 153 | }, 154 | { 155 | "name": "eventAuthority", 156 | "isMut": false, 157 | "isSigner": false 158 | }, 159 | { 160 | "name": "program", 161 | "isMut": false, 162 | "isSigner": false 163 | } 164 | ], 165 | "args": [ 166 | { 167 | "name": "name", 168 | "type": "string" 169 | }, 170 | { 171 | "name": "symbol", 172 | "type": "string" 173 | }, 174 | { 175 | "name": "uri", 176 | "type": "string" 177 | } 178 | ] 179 | }, 180 | { 181 | "name": "buy", 182 | "docs": [ 183 | "Buys tokens from a bonding curve." 184 | ], 185 | "accounts": [ 186 | { 187 | "name": "global", 188 | "isMut": false, 189 | "isSigner": false 190 | }, 191 | { 192 | "name": "feeRecipient", 193 | "isMut": true, 194 | "isSigner": false 195 | }, 196 | { 197 | "name": "mint", 198 | "isMut": false, 199 | "isSigner": false 200 | }, 201 | { 202 | "name": "bondingCurve", 203 | "isMut": true, 204 | "isSigner": false 205 | }, 206 | { 207 | "name": "associatedBondingCurve", 208 | "isMut": true, 209 | "isSigner": false 210 | }, 211 | { 212 | "name": "associatedUser", 213 | "isMut": true, 214 | "isSigner": false 215 | }, 216 | { 217 | "name": "user", 218 | "isMut": true, 219 | "isSigner": true 220 | }, 221 | { 222 | "name": "systemProgram", 223 | "isMut": false, 224 | "isSigner": false 225 | }, 226 | { 227 | "name": "tokenProgram", 228 | "isMut": false, 229 | "isSigner": false 230 | }, 231 | { 232 | "name": "rent", 233 | "isMut": false, 234 | "isSigner": false 235 | }, 236 | { 237 | "name": "eventAuthority", 238 | "isMut": false, 239 | "isSigner": false 240 | }, 241 | { 242 | "name": "program", 243 | "isMut": false, 244 | "isSigner": false 245 | } 246 | ], 247 | "args": [ 248 | { 249 | "name": "amount", 250 | "type": "u64" 251 | }, 252 | { 253 | "name": "maxSolCost", 254 | "type": "u64" 255 | } 256 | ] 257 | }, 258 | { 259 | "name": "sell", 260 | "docs": [ 261 | "Sells tokens into a bonding curve." 262 | ], 263 | "accounts": [ 264 | { 265 | "name": "global", 266 | "isMut": false, 267 | "isSigner": false 268 | }, 269 | { 270 | "name": "feeRecipient", 271 | "isMut": true, 272 | "isSigner": false 273 | }, 274 | { 275 | "name": "mint", 276 | "isMut": false, 277 | "isSigner": false 278 | }, 279 | { 280 | "name": "bondingCurve", 281 | "isMut": true, 282 | "isSigner": false 283 | }, 284 | { 285 | "name": "associatedBondingCurve", 286 | "isMut": true, 287 | "isSigner": false 288 | }, 289 | { 290 | "name": "associatedUser", 291 | "isMut": true, 292 | "isSigner": false 293 | }, 294 | { 295 | "name": "user", 296 | "isMut": true, 297 | "isSigner": true 298 | }, 299 | { 300 | "name": "systemProgram", 301 | "isMut": false, 302 | "isSigner": false 303 | }, 304 | { 305 | "name": "associatedTokenProgram", 306 | "isMut": false, 307 | "isSigner": false 308 | }, 309 | { 310 | "name": "tokenProgram", 311 | "isMut": false, 312 | "isSigner": false 313 | }, 314 | { 315 | "name": "eventAuthority", 316 | "isMut": false, 317 | "isSigner": false 318 | }, 319 | { 320 | "name": "program", 321 | "isMut": false, 322 | "isSigner": false 323 | } 324 | ], 325 | "args": [ 326 | { 327 | "name": "amount", 328 | "type": "u64" 329 | }, 330 | { 331 | "name": "minSolOutput", 332 | "type": "u64" 333 | } 334 | ] 335 | }, 336 | { 337 | "name": "withdraw", 338 | "docs": [ 339 | "Allows the admin to withdraw liquidity for a migration once the bonding curve completes" 340 | ], 341 | "accounts": [ 342 | { 343 | "name": "global", 344 | "isMut": false, 345 | "isSigner": false 346 | }, 347 | { 348 | "name": "mint", 349 | "isMut": false, 350 | "isSigner": false 351 | }, 352 | { 353 | "name": "bondingCurve", 354 | "isMut": true, 355 | "isSigner": false 356 | }, 357 | { 358 | "name": "associatedBondingCurve", 359 | "isMut": true, 360 | "isSigner": false 361 | }, 362 | { 363 | "name": "associatedUser", 364 | "isMut": true, 365 | "isSigner": false 366 | }, 367 | { 368 | "name": "user", 369 | "isMut": true, 370 | "isSigner": true 371 | }, 372 | { 373 | "name": "systemProgram", 374 | "isMut": false, 375 | "isSigner": false 376 | }, 377 | { 378 | "name": "tokenProgram", 379 | "isMut": false, 380 | "isSigner": false 381 | }, 382 | { 383 | "name": "rent", 384 | "isMut": false, 385 | "isSigner": false 386 | }, 387 | { 388 | "name": "eventAuthority", 389 | "isMut": false, 390 | "isSigner": false 391 | }, 392 | { 393 | "name": "program", 394 | "isMut": false, 395 | "isSigner": false 396 | } 397 | ], 398 | "args": [] 399 | } 400 | ], 401 | "accounts": [ 402 | { 403 | "name": "Global", 404 | "type": { 405 | "kind": "struct", 406 | "fields": [ 407 | { 408 | "name": "initialized", 409 | "type": "bool" 410 | }, 411 | { 412 | "name": "authority", 413 | "type": "publicKey" 414 | }, 415 | { 416 | "name": "feeRecipient", 417 | "type": "publicKey" 418 | }, 419 | { 420 | "name": "initialVirtualTokenReserves", 421 | "type": "u64" 422 | }, 423 | { 424 | "name": "initialVirtualSolReserves", 425 | "type": "u64" 426 | }, 427 | { 428 | "name": "initialRealTokenReserves", 429 | "type": "u64" 430 | }, 431 | { 432 | "name": "tokenTotalSupply", 433 | "type": "u64" 434 | }, 435 | { 436 | "name": "feeBasisPoints", 437 | "type": "u64" 438 | } 439 | ] 440 | } 441 | }, 442 | { 443 | "name": "BondingCurve", 444 | "type": { 445 | "kind": "struct", 446 | "fields": [ 447 | { 448 | "name": "virtualTokenReserves", 449 | "type": "u64" 450 | }, 451 | { 452 | "name": "virtualSolReserves", 453 | "type": "u64" 454 | }, 455 | { 456 | "name": "realTokenReserves", 457 | "type": "u64" 458 | }, 459 | { 460 | "name": "realSolReserves", 461 | "type": "u64" 462 | }, 463 | { 464 | "name": "tokenTotalSupply", 465 | "type": "u64" 466 | }, 467 | { 468 | "name": "complete", 469 | "type": "bool" 470 | } 471 | ] 472 | } 473 | } 474 | ], 475 | "events": [ 476 | { 477 | "name": "CreateEvent", 478 | "fields": [ 479 | { 480 | "name": "name", 481 | "type": "string", 482 | "index": false 483 | }, 484 | { 485 | "name": "symbol", 486 | "type": "string", 487 | "index": false 488 | }, 489 | { 490 | "name": "uri", 491 | "type": "string", 492 | "index": false 493 | }, 494 | { 495 | "name": "mint", 496 | "type": "publicKey", 497 | "index": false 498 | }, 499 | { 500 | "name": "bondingCurve", 501 | "type": "publicKey", 502 | "index": false 503 | }, 504 | { 505 | "name": "user", 506 | "type": "publicKey", 507 | "index": false 508 | } 509 | ] 510 | }, 511 | { 512 | "name": "TradeEvent", 513 | "fields": [ 514 | { 515 | "name": "mint", 516 | "type": "publicKey", 517 | "index": false 518 | }, 519 | { 520 | "name": "solAmount", 521 | "type": "u64", 522 | "index": false 523 | }, 524 | { 525 | "name": "tokenAmount", 526 | "type": "u64", 527 | "index": false 528 | }, 529 | { 530 | "name": "isBuy", 531 | "type": "bool", 532 | "index": false 533 | }, 534 | { 535 | "name": "user", 536 | "type": "publicKey", 537 | "index": false 538 | }, 539 | { 540 | "name": "timestamp", 541 | "type": "i64", 542 | "index": false 543 | }, 544 | { 545 | "name": "virtualSolReserves", 546 | "type": "u64", 547 | "index": false 548 | }, 549 | { 550 | "name": "virtualTokenReserves", 551 | "type": "u64", 552 | "index": false 553 | } 554 | ] 555 | }, 556 | { 557 | "name": "CompleteEvent", 558 | "fields": [ 559 | { 560 | "name": "user", 561 | "type": "publicKey", 562 | "index": false 563 | }, 564 | { 565 | "name": "mint", 566 | "type": "publicKey", 567 | "index": false 568 | }, 569 | { 570 | "name": "bondingCurve", 571 | "type": "publicKey", 572 | "index": false 573 | }, 574 | { 575 | "name": "timestamp", 576 | "type": "i64", 577 | "index": false 578 | } 579 | ] 580 | }, 581 | { 582 | "name": "SetParamsEvent", 583 | "fields": [ 584 | { 585 | "name": "feeRecipient", 586 | "type": "publicKey", 587 | "index": false 588 | }, 589 | { 590 | "name": "initialVirtualTokenReserves", 591 | "type": "u64", 592 | "index": false 593 | }, 594 | { 595 | "name": "initialVirtualSolReserves", 596 | "type": "u64", 597 | "index": false 598 | }, 599 | { 600 | "name": "initialRealTokenReserves", 601 | "type": "u64", 602 | "index": false 603 | }, 604 | { 605 | "name": "tokenTotalSupply", 606 | "type": "u64", 607 | "index": false 608 | }, 609 | { 610 | "name": "feeBasisPoints", 611 | "type": "u64", 612 | "index": false 613 | } 614 | ] 615 | } 616 | ], 617 | "errors": [ 618 | { 619 | "code": 6000, 620 | "name": "NotAuthorized", 621 | "msg": "The given account is not authorized to execute this instruction." 622 | }, 623 | { 624 | "code": 6001, 625 | "name": "AlreadyInitialized", 626 | "msg": "The program is already initialized." 627 | }, 628 | { 629 | "code": 6002, 630 | "name": "TooMuchSolRequired", 631 | "msg": "slippage: Too much SOL required to buy the given amount of tokens." 632 | }, 633 | { 634 | "code": 6003, 635 | "name": "TooLittleSolReceived", 636 | "msg": "slippage: Too little SOL received to sell the given amount of tokens." 637 | }, 638 | { 639 | "code": 6004, 640 | "name": "MintDoesNotMatchBondingCurve", 641 | "msg": "The mint does not match the bonding curve." 642 | }, 643 | { 644 | "code": 6005, 645 | "name": "BondingCurveComplete", 646 | "msg": "The bonding curve has completed and liquidity migrated to raydium." 647 | }, 648 | { 649 | "code": 6006, 650 | "name": "BondingCurveNotComplete", 651 | "msg": "The bonding curve has not completed." 652 | }, 653 | { 654 | "code": 6007, 655 | "name": "NotInitialized", 656 | "msg": "The program is not initialized." 657 | } 658 | ], 659 | "metadata": { 660 | "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" 661 | } 662 | } -------------------------------------------------------------------------------- /data/transactionData.go: -------------------------------------------------------------------------------- 1 | package data 2 | 3 | var GetBondingCurveData string = `{ 4 | "jsonrpc": "2.0", 5 | "result": { 6 | "blockTime": 1717642161, 7 | "meta": { 8 | "computeUnitsConsumed": 181543, 9 | "err": null, 10 | "fee": 72500, 11 | "innerInstructions": [ 12 | { 13 | "index": 3, 14 | "instructions": [ 15 | { 16 | "parsed": { 17 | "info": { 18 | "lamports": 1461600, 19 | "newAccount": "825fFpXB57QZcMZRMjTxCfgh5P55aBAMB1QKCgHepump", 20 | "owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 21 | "source": "HdDmAPDqqt4JCNdxHUh1SzKZxyf97AMWFB7k5nStGVia", 22 | "space": 82 23 | }, 24 | "type": "createAccount" 25 | }, 26 | "program": "system", 27 | "programId": "11111111111111111111111111111111", 28 | "stackHeight": 2 29 | }, 30 | { 31 | "parsed": { 32 | "info": { 33 | "decimals": 6, 34 | "mint": "825fFpXB57QZcMZRMjTxCfgh5P55aBAMB1QKCgHepump", 35 | "mintAuthority": "TSLvdd1pWpHVjahSpsvCXUbgwsL3JAcvokwaKt1eokM" 36 | }, 37 | "type": "initializeMint2" 38 | }, 39 | "program": "spl-token", 40 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 41 | "stackHeight": 2 42 | }, 43 | { 44 | "parsed": { 45 | "info": { 46 | "lamports": 1231920, 47 | "newAccount": "GSJ7gix2Q7k81quBYfH9ceD7Vz2bC8Bfim9JJBiKWtKE", 48 | "owner": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P", 49 | "source": "HdDmAPDqqt4JCNdxHUh1SzKZxyf97AMWFB7k5nStGVia", 50 | "space": 49 51 | }, 52 | "type": "createAccount" 53 | }, 54 | "program": "system", 55 | "programId": "11111111111111111111111111111111", 56 | "stackHeight": 2 57 | }, 58 | { 59 | "parsed": { 60 | "info": { 61 | "account": "GpLkLfLzrfq7oCMkbezcQ2LseTFZ6GJbuA2Qtjp5Xm9X", 62 | "mint": "825fFpXB57QZcMZRMjTxCfgh5P55aBAMB1QKCgHepump", 63 | "source": "HdDmAPDqqt4JCNdxHUh1SzKZxyf97AMWFB7k5nStGVia", 64 | "systemProgram": "11111111111111111111111111111111", 65 | "tokenProgram": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 66 | "wallet": "GSJ7gix2Q7k81quBYfH9ceD7Vz2bC8Bfim9JJBiKWtKE" 67 | }, 68 | "type": "create" 69 | }, 70 | "program": "spl-associated-token-account", 71 | "programId": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL", 72 | "stackHeight": 2 73 | }, 74 | { 75 | "parsed": { 76 | "info": { 77 | "extensionTypes": [ 78 | "immutableOwner" 79 | ], 80 | "mint": "825fFpXB57QZcMZRMjTxCfgh5P55aBAMB1QKCgHepump" 81 | }, 82 | "type": "getAccountDataSize" 83 | }, 84 | "program": "spl-token", 85 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 86 | "stackHeight": 3 87 | }, 88 | { 89 | "parsed": { 90 | "info": { 91 | "lamports": 2039280, 92 | "newAccount": "GpLkLfLzrfq7oCMkbezcQ2LseTFZ6GJbuA2Qtjp5Xm9X", 93 | "owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 94 | "source": "HdDmAPDqqt4JCNdxHUh1SzKZxyf97AMWFB7k5nStGVia", 95 | "space": 165 96 | }, 97 | "type": "createAccount" 98 | }, 99 | "program": "system", 100 | "programId": "11111111111111111111111111111111", 101 | "stackHeight": 3 102 | }, 103 | { 104 | "parsed": { 105 | "info": { 106 | "account": "GpLkLfLzrfq7oCMkbezcQ2LseTFZ6GJbuA2Qtjp5Xm9X" 107 | }, 108 | "type": "initializeImmutableOwner" 109 | }, 110 | "program": "spl-token", 111 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 112 | "stackHeight": 3 113 | }, 114 | { 115 | "parsed": { 116 | "info": { 117 | "account": "GpLkLfLzrfq7oCMkbezcQ2LseTFZ6GJbuA2Qtjp5Xm9X", 118 | "mint": "825fFpXB57QZcMZRMjTxCfgh5P55aBAMB1QKCgHepump", 119 | "owner": "GSJ7gix2Q7k81quBYfH9ceD7Vz2bC8Bfim9JJBiKWtKE" 120 | }, 121 | "type": "initializeAccount3" 122 | }, 123 | "program": "spl-token", 124 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 125 | "stackHeight": 3 126 | }, 127 | { 128 | "accounts": [ 129 | "EJAehdqwfgnfnRFgWA6KJE8FbfsqM1myPUEMu7LBKYf4", 130 | "825fFpXB57QZcMZRMjTxCfgh5P55aBAMB1QKCgHepump", 131 | "TSLvdd1pWpHVjahSpsvCXUbgwsL3JAcvokwaKt1eokM", 132 | "HdDmAPDqqt4JCNdxHUh1SzKZxyf97AMWFB7k5nStGVia", 133 | "TSLvdd1pWpHVjahSpsvCXUbgwsL3JAcvokwaKt1eokM", 134 | "11111111111111111111111111111111" 135 | ], 136 | "data": "3pi7oPgjFViUCwMMPR4wDy1QiYHGXh2fxLwix9CS1BX9GwbfV6d96fwkt1GuggnGhtVHqWofMbXm1b9qcJMeEg8jazyKSqDVS7ts8oaV34TPhQZRC5qSdPGssUoh92wd7nsABWq8Mek8GEPwM", 137 | "programId": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s", 138 | "stackHeight": 2 139 | }, 140 | { 141 | "parsed": { 142 | "info": { 143 | "destination": "EJAehdqwfgnfnRFgWA6KJE8FbfsqM1myPUEMu7LBKYf4", 144 | "lamports": 15616720, 145 | "source": "HdDmAPDqqt4JCNdxHUh1SzKZxyf97AMWFB7k5nStGVia" 146 | }, 147 | "type": "transfer" 148 | }, 149 | "program": "system", 150 | "programId": "11111111111111111111111111111111", 151 | "stackHeight": 3 152 | }, 153 | { 154 | "parsed": { 155 | "info": { 156 | "account": "EJAehdqwfgnfnRFgWA6KJE8FbfsqM1myPUEMu7LBKYf4", 157 | "space": 679 158 | }, 159 | "type": "allocate" 160 | }, 161 | "program": "system", 162 | "programId": "11111111111111111111111111111111", 163 | "stackHeight": 3 164 | }, 165 | { 166 | "parsed": { 167 | "info": { 168 | "account": "EJAehdqwfgnfnRFgWA6KJE8FbfsqM1myPUEMu7LBKYf4", 169 | "owner": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s" 170 | }, 171 | "type": "assign" 172 | }, 173 | "program": "system", 174 | "programId": "11111111111111111111111111111111", 175 | "stackHeight": 3 176 | }, 177 | { 178 | "parsed": { 179 | "info": { 180 | "account": "GpLkLfLzrfq7oCMkbezcQ2LseTFZ6GJbuA2Qtjp5Xm9X", 181 | "amount": "1000000000000000", 182 | "mint": "825fFpXB57QZcMZRMjTxCfgh5P55aBAMB1QKCgHepump", 183 | "mintAuthority": "TSLvdd1pWpHVjahSpsvCXUbgwsL3JAcvokwaKt1eokM" 184 | }, 185 | "type": "mintTo" 186 | }, 187 | "program": "spl-token", 188 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 189 | "stackHeight": 2 190 | }, 191 | { 192 | "parsed": { 193 | "info": { 194 | "authority": "TSLvdd1pWpHVjahSpsvCXUbgwsL3JAcvokwaKt1eokM", 195 | "authorityType": "mintTokens", 196 | "mint": "825fFpXB57QZcMZRMjTxCfgh5P55aBAMB1QKCgHepump", 197 | "newAuthority": null 198 | }, 199 | "type": "setAuthority" 200 | }, 201 | "program": "spl-token", 202 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 203 | "stackHeight": 2 204 | }, 205 | { 206 | "accounts": [ 207 | "Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1" 208 | ], 209 | "data": "NtV67dfxFQmXY5YsanxggpGdxRb4joMbDU5RG1eG77xvpb6e3Ztn86WauBihRbS1y6N3ELkVxfYkUutZLNVvymnSN4h6tXRyDrUiRhBKHU4VdhSsXhXhGyCqk1c3LS1arU24yQyiULjLJ1KQptqobAfgGEHZjkcYtdzp25UeKQYxNPLHr1TeKsXRhgvdbgQsfUNbpeRyVnhSRPoGJJjUNkyZgiTdXNEcZpQEYRPKXfDTigQWtRpJ7pJ7PPk2uhCzVPC1CNnWDeRFAVKHriccaD9qPW9p4yp", 210 | "programId": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P", 211 | "stackHeight": 2 212 | } 213 | ] 214 | }, 215 | { 216 | "index": 4, 217 | "instructions": [ 218 | { 219 | "parsed": { 220 | "info": { 221 | "extensionTypes": [ 222 | "immutableOwner" 223 | ], 224 | "mint": "825fFpXB57QZcMZRMjTxCfgh5P55aBAMB1QKCgHepump" 225 | }, 226 | "type": "getAccountDataSize" 227 | }, 228 | "program": "spl-token", 229 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 230 | "stackHeight": 2 231 | }, 232 | { 233 | "parsed": { 234 | "info": { 235 | "lamports": 2039280, 236 | "newAccount": "ARK76xJyuS9kEJqVQtxPBtXct1D9wnufoJjwf5onyaQh", 237 | "owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 238 | "source": "HdDmAPDqqt4JCNdxHUh1SzKZxyf97AMWFB7k5nStGVia", 239 | "space": 165 240 | }, 241 | "type": "createAccount" 242 | }, 243 | "program": "system", 244 | "programId": "11111111111111111111111111111111", 245 | "stackHeight": 2 246 | }, 247 | { 248 | "parsed": { 249 | "info": { 250 | "account": "ARK76xJyuS9kEJqVQtxPBtXct1D9wnufoJjwf5onyaQh" 251 | }, 252 | "type": "initializeImmutableOwner" 253 | }, 254 | "program": "spl-token", 255 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 256 | "stackHeight": 2 257 | }, 258 | { 259 | "parsed": { 260 | "info": { 261 | "account": "ARK76xJyuS9kEJqVQtxPBtXct1D9wnufoJjwf5onyaQh", 262 | "mint": "825fFpXB57QZcMZRMjTxCfgh5P55aBAMB1QKCgHepump", 263 | "owner": "HdDmAPDqqt4JCNdxHUh1SzKZxyf97AMWFB7k5nStGVia" 264 | }, 265 | "type": "initializeAccount3" 266 | }, 267 | "program": "spl-token", 268 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 269 | "stackHeight": 2 270 | } 271 | ] 272 | }, 273 | { 274 | "index": 5, 275 | "instructions": [ 276 | { 277 | "parsed": { 278 | "info": { 279 | "amount": "2497838377120", 280 | "authority": "GSJ7gix2Q7k81quBYfH9ceD7Vz2bC8Bfim9JJBiKWtKE", 281 | "destination": "ARK76xJyuS9kEJqVQtxPBtXct1D9wnufoJjwf5onyaQh", 282 | "source": "GpLkLfLzrfq7oCMkbezcQ2LseTFZ6GJbuA2Qtjp5Xm9X" 283 | }, 284 | "type": "transfer" 285 | }, 286 | "program": "spl-token", 287 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 288 | "stackHeight": 2 289 | }, 290 | { 291 | "parsed": { 292 | "info": { 293 | "destination": "GSJ7gix2Q7k81quBYfH9ceD7Vz2bC8Bfim9JJBiKWtKE", 294 | "lamports": 70000000, 295 | "source": "HdDmAPDqqt4JCNdxHUh1SzKZxyf97AMWFB7k5nStGVia" 296 | }, 297 | "type": "transfer" 298 | }, 299 | "program": "system", 300 | "programId": "11111111111111111111111111111111", 301 | "stackHeight": 2 302 | }, 303 | { 304 | "parsed": { 305 | "info": { 306 | "destination": "CebN5WGQ4jvEPvsVU4EoHEpgzq1VV7AbicfhtW4xC9iM", 307 | "lamports": 700000, 308 | "source": "HdDmAPDqqt4JCNdxHUh1SzKZxyf97AMWFB7k5nStGVia" 309 | }, 310 | "type": "transfer" 311 | }, 312 | "program": "system", 313 | "programId": "11111111111111111111111111111111", 314 | "stackHeight": 2 315 | }, 316 | { 317 | "accounts": [ 318 | "Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1" 319 | ], 320 | "data": "2K7nL28PxCW8ejnyCeuMpbWfvtmao7KNwSoKhM5tpqJmsXuXB8bFsZwfCXS6r1TXbobh6MRtcj8nauL3iJXttgvogPA9iBwTWDcoZDyQitDUKhifLQRKPofNbjXp6NXr7b3Px6eEJtpmDkb2rxup36D7FGbckAHaASR2HFEd6FcVGRjJs6VoQrXJ1qWX", 321 | "programId": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P", 322 | "stackHeight": 2 323 | } 324 | ] 325 | } 326 | ], 327 | "logMessages": [ 328 | "Program ComputeBudget111111111111111111111111111111 invoke [1]", 329 | "Program ComputeBudget111111111111111111111111111111 success", 330 | "Program 11111111111111111111111111111111 invoke [1]", 331 | "Program 11111111111111111111111111111111 success", 332 | "Program ComputeBudget111111111111111111111111111111 invoke [1]", 333 | "Program ComputeBudget111111111111111111111111111111 success", 334 | "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P invoke [1]", 335 | "Program log: Instruction: Create", 336 | "Program 11111111111111111111111111111111 invoke [2]", 337 | "Program 11111111111111111111111111111111 success", 338 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]", 339 | "Program log: Instruction: InitializeMint2", 340 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 2780 of 238060 compute units", 341 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 342 | "Program 11111111111111111111111111111111 invoke [2]", 343 | "Program 11111111111111111111111111111111 success", 344 | "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL invoke [2]", 345 | "Program log: Create", 346 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [3]", 347 | "Program log: Instruction: GetAccountDataSize", 348 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 1595 of 214164 compute units", 349 | "Program return: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA pQAAAAAAAAA=", 350 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 351 | "Program 11111111111111111111111111111111 invoke [3]", 352 | "Program 11111111111111111111111111111111 success", 353 | "Program log: Initialize the associated token account", 354 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [3]", 355 | "Program log: Instruction: InitializeImmutableOwner", 356 | "Program log: Please upgrade to SPL Token 2022 for immutable owner support", 357 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 1405 of 207551 compute units", 358 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 359 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [3]", 360 | "Program log: Instruction: InitializeAccount3", 361 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4214 of 203667 compute units", 362 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 363 | "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL consumed 20490 of 219639 compute units", 364 | "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL success", 365 | "Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s invoke [2]", 366 | "Program log: IX: Create Metadata Accounts v3", 367 | "Program 11111111111111111111111111111111 invoke [3]", 368 | "Program 11111111111111111111111111111111 success", 369 | "Program log: Allocate space for the account", 370 | "Program 11111111111111111111111111111111 invoke [3]", 371 | "Program 11111111111111111111111111111111 success", 372 | "Program log: Assign the account to the owning program", 373 | "Program 11111111111111111111111111111111 invoke [3]", 374 | "Program 11111111111111111111111111111111 success", 375 | "Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s consumed 34527 of 185410 compute units", 376 | "Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s success", 377 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]", 378 | "Program log: Instruction: MintTo", 379 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4492 of 148368 compute units", 380 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 381 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]", 382 | "Program log: Instruction: SetAuthority", 383 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 2911 of 141729 compute units", 384 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 385 | "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P invoke [2]", 386 | "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P consumed 2003 of 134597 compute units", 387 | "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P success", 388 | "Program data: G3KpTd7rY3YLAAAAQUxETzJTV0FHR1kEAAAAQUxET0cAAABodHRwczovL2NmLWlwZnMuY29tL2lwZnMvUW1WY2YyZ0pYcTh4M3NUUFA2U1NFb2NjY016RnpXU0RSNlQzeE5OaVg2WHZ2N2hIqGvLguM+zS/5Xz4TwhjNmU9dOrXlEYIHrYTxiN9f5VotKNib9lRA+93ObqWtTKo3xPMPHFgC47IQxVF7hJX3AlROWq2eUWPi9OiKYkTwRIugwYDqrIyFsiyiqmVKww==", 389 | "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P consumed 118834 of 249550 compute units", 390 | "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P success", 391 | "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL invoke [1]", 392 | "Program log: Create", 393 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]", 394 | "Program log: Instruction: GetAccountDataSize", 395 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 1569 of 120853 compute units", 396 | "Program return: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA pQAAAAAAAAA=", 397 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 398 | "Program 11111111111111111111111111111111 invoke [2]", 399 | "Program 11111111111111111111111111111111 success", 400 | "Program log: Initialize the associated token account", 401 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]", 402 | "Program log: Instruction: InitializeImmutableOwner", 403 | "Program log: Please upgrade to SPL Token 2022 for immutable owner support", 404 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 1405 of 114266 compute units", 405 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 406 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]", 407 | "Program log: Instruction: InitializeAccount3", 408 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4188 of 110386 compute units", 409 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 410 | "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL consumed 24801 of 130716 compute units", 411 | "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL success", 412 | "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P invoke [1]", 413 | "Program log: Instruction: Buy", 414 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]", 415 | "Program log: Instruction: Transfer", 416 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4645 of 84273 compute units", 417 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 418 | "Program 11111111111111111111111111111111 invoke [2]", 419 | "Program 11111111111111111111111111111111 success", 420 | "Program 11111111111111111111111111111111 invoke [2]", 421 | "Program 11111111111111111111111111111111 success", 422 | "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P invoke [2]", 423 | "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P consumed 2003 of 72185 compute units", 424 | "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P success", 425 | "Program data: vdt/007mYe5oSKhry4LjPs0v+V8+E8IYzZlPXTq15RGCB62E8YjfX4AdLAQAAAAAoOjEkkUCAAAB9wJUTlqtnlFj4vToimJE8ESLoMGA6qyMhbIsoqplSsOxI2FmAAAAAIDJTwAHAAAAYCcTtZ3NAwCAHSwEAAAAAGCPAGkMzwIA", 426 | "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P consumed 37458 of 105915 compute units", 427 | "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P success" 428 | ], 429 | "postBalances": [ 430 | 12718400, 431 | 1461600, 432 | 6403220517, 433 | 71231920, 434 | 2039280, 435 | 15616720, 436 | 2039280, 437 | 105592907298382, 438 | 1, 439 | 1, 440 | 1141440, 441 | 312790900, 442 | 1677360, 443 | 1141440, 444 | 934087680, 445 | 731913600, 446 | 1009200, 447 | 0 448 | ], 449 | "postTokenBalances": [ 450 | { 451 | "accountIndex": 4, 452 | "mint": "825fFpXB57QZcMZRMjTxCfgh5P55aBAMB1QKCgHepump", 453 | "owner": "GSJ7gix2Q7k81quBYfH9ceD7Vz2bC8Bfim9JJBiKWtKE", 454 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 455 | "uiTokenAmount": { 456 | "amount": "997502161622880", 457 | "decimals": 6, 458 | "uiAmount": 997502161.62288, 459 | "uiAmountString": "997502161.62288" 460 | } 461 | }, 462 | { 463 | "accountIndex": 6, 464 | "mint": "825fFpXB57QZcMZRMjTxCfgh5P55aBAMB1QKCgHepump", 465 | "owner": "HdDmAPDqqt4JCNdxHUh1SzKZxyf97AMWFB7k5nStGVia", 466 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 467 | "uiTokenAmount": { 468 | "amount": "2497838377120", 469 | "decimals": 6, 470 | "uiAmount": 2497838.37712, 471 | "uiAmountString": "2497838.37712" 472 | } 473 | } 474 | ], 475 | "preBalances": [ 476 | 109879700, 477 | 0, 478 | 6399220517, 479 | 0, 480 | 0, 481 | 0, 482 | 0, 483 | 105592906598382, 484 | 1, 485 | 1, 486 | 1141440, 487 | 312790900, 488 | 1677360, 489 | 1141440, 490 | 934087680, 491 | 731913600, 492 | 1009200, 493 | 0 494 | ], 495 | "preTokenBalances": [], 496 | "rewards": [], 497 | "status": { 498 | "Ok": null 499 | } 500 | }, 501 | "slot": 270141532, 502 | "transaction": { 503 | "message": { 504 | "accountKeys": [ 505 | { 506 | "pubkey": "HdDmAPDqqt4JCNdxHUh1SzKZxyf97AMWFB7k5nStGVia", 507 | "signer": true, 508 | "source": "transaction", 509 | "writable": true 510 | }, 511 | { 512 | "pubkey": "825fFpXB57QZcMZRMjTxCfgh5P55aBAMB1QKCgHepump", 513 | "signer": true, 514 | "source": "transaction", 515 | "writable": true 516 | }, 517 | { 518 | "pubkey": "HWEoBxYs7ssKuudEjzjmpfJVX7Dvi7wescFsVx2L5yoY", 519 | "signer": false, 520 | "source": "transaction", 521 | "writable": true 522 | }, 523 | { 524 | "pubkey": "GSJ7gix2Q7k81quBYfH9ceD7Vz2bC8Bfim9JJBiKWtKE", 525 | "signer": false, 526 | "source": "transaction", 527 | "writable": true 528 | }, 529 | { 530 | "pubkey": "GpLkLfLzrfq7oCMkbezcQ2LseTFZ6GJbuA2Qtjp5Xm9X", 531 | "signer": false, 532 | "source": "transaction", 533 | "writable": true 534 | }, 535 | { 536 | "pubkey": "EJAehdqwfgnfnRFgWA6KJE8FbfsqM1myPUEMu7LBKYf4", 537 | "signer": false, 538 | "source": "transaction", 539 | "writable": true 540 | }, 541 | { 542 | "pubkey": "ARK76xJyuS9kEJqVQtxPBtXct1D9wnufoJjwf5onyaQh", 543 | "signer": false, 544 | "source": "transaction", 545 | "writable": true 546 | }, 547 | { 548 | "pubkey": "CebN5WGQ4jvEPvsVU4EoHEpgzq1VV7AbicfhtW4xC9iM", 549 | "signer": false, 550 | "source": "transaction", 551 | "writable": true 552 | }, 553 | { 554 | "pubkey": "ComputeBudget111111111111111111111111111111", 555 | "signer": false, 556 | "source": "transaction", 557 | "writable": false 558 | }, 559 | { 560 | "pubkey": "11111111111111111111111111111111", 561 | "signer": false, 562 | "source": "transaction", 563 | "writable": false 564 | }, 565 | { 566 | "pubkey": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P", 567 | "signer": false, 568 | "source": "transaction", 569 | "writable": false 570 | }, 571 | { 572 | "pubkey": "TSLvdd1pWpHVjahSpsvCXUbgwsL3JAcvokwaKt1eokM", 573 | "signer": false, 574 | "source": "transaction", 575 | "writable": false 576 | }, 577 | { 578 | "pubkey": "4wTV1YmiEkRvAtNtsSGPtUrqRYQMe5SKy2uB4Jjaxnjf", 579 | "signer": false, 580 | "source": "transaction", 581 | "writable": false 582 | }, 583 | { 584 | "pubkey": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s", 585 | "signer": false, 586 | "source": "transaction", 587 | "writable": false 588 | }, 589 | { 590 | "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 591 | "signer": false, 592 | "source": "transaction", 593 | "writable": false 594 | }, 595 | { 596 | "pubkey": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL", 597 | "signer": false, 598 | "source": "transaction", 599 | "writable": false 600 | }, 601 | { 602 | "pubkey": "SysvarRent111111111111111111111111111111111", 603 | "signer": false, 604 | "source": "transaction", 605 | "writable": false 606 | }, 607 | { 608 | "pubkey": "Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1", 609 | "signer": false, 610 | "source": "transaction", 611 | "writable": false 612 | } 613 | ], 614 | "addressTableLookups": [], 615 | "instructions": [ 616 | { 617 | "accounts": [], 618 | "data": "HnkkG7", 619 | "programId": "ComputeBudget111111111111111111111111111111", 620 | "stackHeight": null 621 | }, 622 | { 623 | "parsed": { 624 | "info": { 625 | "destination": "HWEoBxYs7ssKuudEjzjmpfJVX7Dvi7wescFsVx2L5yoY", 626 | "lamports": 4000000, 627 | "source": "HdDmAPDqqt4JCNdxHUh1SzKZxyf97AMWFB7k5nStGVia" 628 | }, 629 | "type": "transfer" 630 | }, 631 | "program": "system", 632 | "programId": "11111111111111111111111111111111", 633 | "stackHeight": null 634 | }, 635 | { 636 | "accounts": [], 637 | "data": "3dgRf8s6ueV5", 638 | "programId": "ComputeBudget111111111111111111111111111111", 639 | "stackHeight": null 640 | }, 641 | { 642 | "accounts": [ 643 | "825fFpXB57QZcMZRMjTxCfgh5P55aBAMB1QKCgHepump", 644 | "TSLvdd1pWpHVjahSpsvCXUbgwsL3JAcvokwaKt1eokM", 645 | "GSJ7gix2Q7k81quBYfH9ceD7Vz2bC8Bfim9JJBiKWtKE", 646 | "GpLkLfLzrfq7oCMkbezcQ2LseTFZ6GJbuA2Qtjp5Xm9X", 647 | "4wTV1YmiEkRvAtNtsSGPtUrqRYQMe5SKy2uB4Jjaxnjf", 648 | "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s", 649 | "EJAehdqwfgnfnRFgWA6KJE8FbfsqM1myPUEMu7LBKYf4", 650 | "HdDmAPDqqt4JCNdxHUh1SzKZxyf97AMWFB7k5nStGVia", 651 | "11111111111111111111111111111111", 652 | "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 653 | "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL", 654 | "SysvarRent111111111111111111111111111111111", 655 | "Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1", 656 | "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" 657 | ], 658 | "data": "34W7WH8F9TH6ThL77KTQCrKWSvS2AfLvtQepAHTy3RLEtKAUwjhkrYUrMmCexJfUAH15k613UkBvuDJyWcmTfLwN8GTYasEPS26QUNSEFjUDGMVKVXXzqAXPxq6qU95nepGfX4r7rrCvm61nW", 659 | "programId": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P", 660 | "stackHeight": null 661 | }, 662 | { 663 | "parsed": { 664 | "info": { 665 | "account": "ARK76xJyuS9kEJqVQtxPBtXct1D9wnufoJjwf5onyaQh", 666 | "mint": "825fFpXB57QZcMZRMjTxCfgh5P55aBAMB1QKCgHepump", 667 | "source": "HdDmAPDqqt4JCNdxHUh1SzKZxyf97AMWFB7k5nStGVia", 668 | "systemProgram": "11111111111111111111111111111111", 669 | "tokenProgram": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 670 | "wallet": "HdDmAPDqqt4JCNdxHUh1SzKZxyf97AMWFB7k5nStGVia" 671 | }, 672 | "type": "create" 673 | }, 674 | "program": "spl-associated-token-account", 675 | "programId": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL", 676 | "stackHeight": null 677 | }, 678 | { 679 | "accounts": [ 680 | "4wTV1YmiEkRvAtNtsSGPtUrqRYQMe5SKy2uB4Jjaxnjf", 681 | "CebN5WGQ4jvEPvsVU4EoHEpgzq1VV7AbicfhtW4xC9iM", 682 | "825fFpXB57QZcMZRMjTxCfgh5P55aBAMB1QKCgHepump", 683 | "GSJ7gix2Q7k81quBYfH9ceD7Vz2bC8Bfim9JJBiKWtKE", 684 | "GpLkLfLzrfq7oCMkbezcQ2LseTFZ6GJbuA2Qtjp5Xm9X", 685 | "ARK76xJyuS9kEJqVQtxPBtXct1D9wnufoJjwf5onyaQh", 686 | "HdDmAPDqqt4JCNdxHUh1SzKZxyf97AMWFB7k5nStGVia", 687 | "11111111111111111111111111111111", 688 | "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 689 | "SysvarRent111111111111111111111111111111111", 690 | "Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1", 691 | "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" 692 | ], 693 | "data": "AJTQ2h9DXrBy1bwKHWeYG1LSarC1qeQfZ", 694 | "programId": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P", 695 | "stackHeight": null 696 | } 697 | ], 698 | "recentBlockhash": "Fq1WwsxbmwhQxaFyahn6rWjgN1GEo3H5F5y4wc2kqacM" 699 | }, 700 | "signatures": [ 701 | "2zcP2CkxE14L1CG6hHfw6emU7rcxsLVg19swyuxbHKJ7MXj3GYmXAD4289MzJUdV759wk4QfF4odTwEgPWwd49vh", 702 | "4MrkAkon65djWJP7N6KsZd5Sour9evh7SUKnfWbEKXod3C5b1LQ9fzu4izUwBvo4yGp4mPMQn6nPHeRgb8SzZcd9" 703 | ] 704 | }, 705 | "version": 0 706 | }, 707 | "id": 1 708 | }` 709 | -------------------------------------------------------------------------------- /generated/pump/Buy.go: -------------------------------------------------------------------------------- 1 | // Code generated by https://github.com/gagliardetto/anchor-go. DO NOT EDIT. 2 | 3 | package pump 4 | 5 | import ( 6 | "errors" 7 | ag_binary "github.com/gagliardetto/binary" 8 | ag_solanago "github.com/gagliardetto/solana-go" 9 | ag_format "github.com/gagliardetto/solana-go/text/format" 10 | ag_treeout "github.com/gagliardetto/treeout" 11 | ) 12 | 13 | // Buys tokens from a bonding curve. 14 | type Buy struct { 15 | Amount *uint64 16 | MaxSolCost *uint64 17 | 18 | // [0] = [] global 19 | // 20 | // [1] = [WRITE] feeRecipient 21 | // 22 | // [2] = [] mint 23 | // 24 | // [3] = [WRITE] bondingCurve 25 | // 26 | // [4] = [WRITE] associatedBondingCurve 27 | // 28 | // [5] = [WRITE] associatedUser 29 | // 30 | // [6] = [WRITE, SIGNER] user 31 | // 32 | // [7] = [] systemProgram 33 | // 34 | // [8] = [] tokenProgram 35 | // 36 | // [9] = [] rent 37 | // 38 | // [10] = [] eventAuthority 39 | // 40 | // [11] = [] program 41 | ag_solanago.AccountMetaSlice `bin:"-"` 42 | } 43 | 44 | // NewBuyInstructionBuilder creates a new `Buy` instruction builder. 45 | func NewBuyInstructionBuilder() *Buy { 46 | nd := &Buy{ 47 | AccountMetaSlice: make(ag_solanago.AccountMetaSlice, 12), 48 | } 49 | return nd 50 | } 51 | 52 | // SetAmount sets the "amount" parameter. 53 | func (inst *Buy) SetAmount(amount uint64) *Buy { 54 | inst.Amount = &amount 55 | return inst 56 | } 57 | 58 | // SetMaxSolCost sets the "maxSolCost" parameter. 59 | func (inst *Buy) SetMaxSolCost(maxSolCost uint64) *Buy { 60 | inst.MaxSolCost = &maxSolCost 61 | return inst 62 | } 63 | 64 | // SetGlobalAccount sets the "global" account. 65 | func (inst *Buy) SetGlobalAccount(global ag_solanago.PublicKey) *Buy { 66 | inst.AccountMetaSlice[0] = ag_solanago.Meta(global) 67 | return inst 68 | } 69 | 70 | // GetGlobalAccount gets the "global" account. 71 | func (inst *Buy) GetGlobalAccount() *ag_solanago.AccountMeta { 72 | return inst.AccountMetaSlice.Get(0) 73 | } 74 | 75 | // SetFeeRecipientAccount sets the "feeRecipient" account. 76 | func (inst *Buy) SetFeeRecipientAccount(feeRecipient ag_solanago.PublicKey) *Buy { 77 | inst.AccountMetaSlice[1] = ag_solanago.Meta(feeRecipient).WRITE() 78 | return inst 79 | } 80 | 81 | // GetFeeRecipientAccount gets the "feeRecipient" account. 82 | func (inst *Buy) GetFeeRecipientAccount() *ag_solanago.AccountMeta { 83 | return inst.AccountMetaSlice.Get(1) 84 | } 85 | 86 | // SetMintAccount sets the "mint" account. 87 | func (inst *Buy) SetMintAccount(mint ag_solanago.PublicKey) *Buy { 88 | inst.AccountMetaSlice[2] = ag_solanago.Meta(mint) 89 | return inst 90 | } 91 | 92 | // GetMintAccount gets the "mint" account. 93 | func (inst *Buy) GetMintAccount() *ag_solanago.AccountMeta { 94 | return inst.AccountMetaSlice.Get(2) 95 | } 96 | 97 | // SetBondingCurveAccount sets the "bondingCurve" account. 98 | func (inst *Buy) SetBondingCurveAccount(bondingCurve ag_solanago.PublicKey) *Buy { 99 | inst.AccountMetaSlice[3] = ag_solanago.Meta(bondingCurve).WRITE() 100 | return inst 101 | } 102 | 103 | // GetBondingCurveAccount gets the "bondingCurve" account. 104 | func (inst *Buy) GetBondingCurveAccount() *ag_solanago.AccountMeta { 105 | return inst.AccountMetaSlice.Get(3) 106 | } 107 | 108 | // SetAssociatedBondingCurveAccount sets the "associatedBondingCurve" account. 109 | func (inst *Buy) SetAssociatedBondingCurveAccount(associatedBondingCurve ag_solanago.PublicKey) *Buy { 110 | inst.AccountMetaSlice[4] = ag_solanago.Meta(associatedBondingCurve).WRITE() 111 | return inst 112 | } 113 | 114 | // GetAssociatedBondingCurveAccount gets the "associatedBondingCurve" account. 115 | func (inst *Buy) GetAssociatedBondingCurveAccount() *ag_solanago.AccountMeta { 116 | return inst.AccountMetaSlice.Get(4) 117 | } 118 | 119 | // SetAssociatedUserAccount sets the "associatedUser" account. 120 | func (inst *Buy) SetAssociatedUserAccount(associatedUser ag_solanago.PublicKey) *Buy { 121 | inst.AccountMetaSlice[5] = ag_solanago.Meta(associatedUser).WRITE() 122 | return inst 123 | } 124 | 125 | // GetAssociatedUserAccount gets the "associatedUser" account. 126 | func (inst *Buy) GetAssociatedUserAccount() *ag_solanago.AccountMeta { 127 | return inst.AccountMetaSlice.Get(5) 128 | } 129 | 130 | // SetUserAccount sets the "user" account. 131 | func (inst *Buy) SetUserAccount(user ag_solanago.PublicKey) *Buy { 132 | inst.AccountMetaSlice[6] = ag_solanago.Meta(user).WRITE().SIGNER() 133 | return inst 134 | } 135 | 136 | // GetUserAccount gets the "user" account. 137 | func (inst *Buy) GetUserAccount() *ag_solanago.AccountMeta { 138 | return inst.AccountMetaSlice.Get(6) 139 | } 140 | 141 | // SetSystemProgramAccount sets the "systemProgram" account. 142 | func (inst *Buy) SetSystemProgramAccount(systemProgram ag_solanago.PublicKey) *Buy { 143 | inst.AccountMetaSlice[7] = ag_solanago.Meta(systemProgram) 144 | return inst 145 | } 146 | 147 | // GetSystemProgramAccount gets the "systemProgram" account. 148 | func (inst *Buy) GetSystemProgramAccount() *ag_solanago.AccountMeta { 149 | return inst.AccountMetaSlice.Get(7) 150 | } 151 | 152 | // SetTokenProgramAccount sets the "tokenProgram" account. 153 | func (inst *Buy) SetTokenProgramAccount(tokenProgram ag_solanago.PublicKey) *Buy { 154 | inst.AccountMetaSlice[8] = ag_solanago.Meta(tokenProgram) 155 | return inst 156 | } 157 | 158 | // GetTokenProgramAccount gets the "tokenProgram" account. 159 | func (inst *Buy) GetTokenProgramAccount() *ag_solanago.AccountMeta { 160 | return inst.AccountMetaSlice.Get(8) 161 | } 162 | 163 | // SetRentAccount sets the "rent" account. 164 | func (inst *Buy) SetRentAccount(rent ag_solanago.PublicKey) *Buy { 165 | inst.AccountMetaSlice[9] = ag_solanago.Meta(rent) 166 | return inst 167 | } 168 | 169 | // GetRentAccount gets the "rent" account. 170 | func (inst *Buy) GetRentAccount() *ag_solanago.AccountMeta { 171 | return inst.AccountMetaSlice.Get(9) 172 | } 173 | 174 | // SetEventAuthorityAccount sets the "eventAuthority" account. 175 | func (inst *Buy) SetEventAuthorityAccount(eventAuthority ag_solanago.PublicKey) *Buy { 176 | inst.AccountMetaSlice[10] = ag_solanago.Meta(eventAuthority) 177 | return inst 178 | } 179 | 180 | // GetEventAuthorityAccount gets the "eventAuthority" account. 181 | func (inst *Buy) GetEventAuthorityAccount() *ag_solanago.AccountMeta { 182 | return inst.AccountMetaSlice.Get(10) 183 | } 184 | 185 | // SetProgramAccount sets the "program" account. 186 | func (inst *Buy) SetProgramAccount(program ag_solanago.PublicKey) *Buy { 187 | inst.AccountMetaSlice[11] = ag_solanago.Meta(program) 188 | return inst 189 | } 190 | 191 | // GetProgramAccount gets the "program" account. 192 | func (inst *Buy) GetProgramAccount() *ag_solanago.AccountMeta { 193 | return inst.AccountMetaSlice.Get(11) 194 | } 195 | 196 | func (inst Buy) Build() *Instruction { 197 | return &Instruction{BaseVariant: ag_binary.BaseVariant{ 198 | Impl: inst, 199 | TypeID: Instruction_Buy, 200 | }} 201 | } 202 | 203 | // ValidateAndBuild validates the instruction parameters and accounts; 204 | // if there is a validation error, it returns the error. 205 | // Otherwise, it builds and returns the instruction. 206 | func (inst Buy) ValidateAndBuild() (*Instruction, error) { 207 | if err := inst.Validate(); err != nil { 208 | return nil, err 209 | } 210 | return inst.Build(), nil 211 | } 212 | 213 | func (inst *Buy) Validate() error { 214 | // Check whether all (required) parameters are set: 215 | { 216 | if inst.Amount == nil { 217 | return errors.New("Amount parameter is not set") 218 | } 219 | if inst.MaxSolCost == nil { 220 | return errors.New("MaxSolCost parameter is not set") 221 | } 222 | } 223 | 224 | // Check whether all (required) accounts are set: 225 | { 226 | if inst.AccountMetaSlice[0] == nil { 227 | return errors.New("accounts.Global is not set") 228 | } 229 | if inst.AccountMetaSlice[1] == nil { 230 | return errors.New("accounts.FeeRecipient is not set") 231 | } 232 | if inst.AccountMetaSlice[2] == nil { 233 | return errors.New("accounts.Mint is not set") 234 | } 235 | if inst.AccountMetaSlice[3] == nil { 236 | return errors.New("accounts.BondingCurve is not set") 237 | } 238 | if inst.AccountMetaSlice[4] == nil { 239 | return errors.New("accounts.AssociatedBondingCurve is not set") 240 | } 241 | if inst.AccountMetaSlice[5] == nil { 242 | return errors.New("accounts.AssociatedUser is not set") 243 | } 244 | if inst.AccountMetaSlice[6] == nil { 245 | return errors.New("accounts.User is not set") 246 | } 247 | if inst.AccountMetaSlice[7] == nil { 248 | return errors.New("accounts.SystemProgram is not set") 249 | } 250 | if inst.AccountMetaSlice[8] == nil { 251 | return errors.New("accounts.TokenProgram is not set") 252 | } 253 | if inst.AccountMetaSlice[9] == nil { 254 | return errors.New("accounts.Rent is not set") 255 | } 256 | if inst.AccountMetaSlice[10] == nil { 257 | return errors.New("accounts.EventAuthority is not set") 258 | } 259 | if inst.AccountMetaSlice[11] == nil { 260 | return errors.New("accounts.Program is not set") 261 | } 262 | } 263 | return nil 264 | } 265 | 266 | func (inst *Buy) EncodeToTree(parent ag_treeout.Branches) { 267 | parent.Child(ag_format.Program(ProgramName, ProgramID)). 268 | // 269 | ParentFunc(func(programBranch ag_treeout.Branches) { 270 | programBranch.Child(ag_format.Instruction("Buy")). 271 | // 272 | ParentFunc(func(instructionBranch ag_treeout.Branches) { 273 | 274 | // Parameters of the instruction: 275 | instructionBranch.Child("Params[len=2]").ParentFunc(func(paramsBranch ag_treeout.Branches) { 276 | paramsBranch.Child(ag_format.Param(" Amount", *inst.Amount)) 277 | paramsBranch.Child(ag_format.Param("MaxSolCost", *inst.MaxSolCost)) 278 | }) 279 | 280 | // Accounts of the instruction: 281 | instructionBranch.Child("Accounts[len=12]").ParentFunc(func(accountsBranch ag_treeout.Branches) { 282 | accountsBranch.Child(ag_format.Meta(" global", inst.AccountMetaSlice.Get(0))) 283 | accountsBranch.Child(ag_format.Meta(" feeRecipient", inst.AccountMetaSlice.Get(1))) 284 | accountsBranch.Child(ag_format.Meta(" mint", inst.AccountMetaSlice.Get(2))) 285 | accountsBranch.Child(ag_format.Meta(" bondingCurve", inst.AccountMetaSlice.Get(3))) 286 | accountsBranch.Child(ag_format.Meta("associatedBondingCurve", inst.AccountMetaSlice.Get(4))) 287 | accountsBranch.Child(ag_format.Meta(" associatedUser", inst.AccountMetaSlice.Get(5))) 288 | accountsBranch.Child(ag_format.Meta(" user", inst.AccountMetaSlice.Get(6))) 289 | accountsBranch.Child(ag_format.Meta(" systemProgram", inst.AccountMetaSlice.Get(7))) 290 | accountsBranch.Child(ag_format.Meta(" tokenProgram", inst.AccountMetaSlice.Get(8))) 291 | accountsBranch.Child(ag_format.Meta(" rent", inst.AccountMetaSlice.Get(9))) 292 | accountsBranch.Child(ag_format.Meta(" eventAuthority", inst.AccountMetaSlice.Get(10))) 293 | accountsBranch.Child(ag_format.Meta(" program", inst.AccountMetaSlice.Get(11))) 294 | }) 295 | }) 296 | }) 297 | } 298 | 299 | func (obj Buy) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error) { 300 | // Serialize `Amount` param: 301 | err = encoder.Encode(obj.Amount) 302 | if err != nil { 303 | return err 304 | } 305 | // Serialize `MaxSolCost` param: 306 | err = encoder.Encode(obj.MaxSolCost) 307 | if err != nil { 308 | return err 309 | } 310 | return nil 311 | } 312 | func (obj *Buy) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error) { 313 | // Deserialize `Amount`: 314 | err = decoder.Decode(&obj.Amount) 315 | if err != nil { 316 | return err 317 | } 318 | // Deserialize `MaxSolCost`: 319 | err = decoder.Decode(&obj.MaxSolCost) 320 | if err != nil { 321 | return err 322 | } 323 | return nil 324 | } 325 | 326 | // NewBuyInstruction declares a new Buy instruction with the provided parameters and accounts. 327 | func NewBuyInstruction( 328 | // Parameters: 329 | amount uint64, 330 | maxSolCost uint64, 331 | // Accounts: 332 | global ag_solanago.PublicKey, 333 | feeRecipient ag_solanago.PublicKey, 334 | mint ag_solanago.PublicKey, 335 | bondingCurve ag_solanago.PublicKey, 336 | associatedBondingCurve ag_solanago.PublicKey, 337 | associatedUser ag_solanago.PublicKey, 338 | user ag_solanago.PublicKey, 339 | systemProgram ag_solanago.PublicKey, 340 | tokenProgram ag_solanago.PublicKey, 341 | rent ag_solanago.PublicKey, 342 | eventAuthority ag_solanago.PublicKey, 343 | program ag_solanago.PublicKey) *Buy { 344 | return NewBuyInstructionBuilder(). 345 | SetAmount(amount). 346 | SetMaxSolCost(maxSolCost). 347 | SetGlobalAccount(global). 348 | SetFeeRecipientAccount(feeRecipient). 349 | SetMintAccount(mint). 350 | SetBondingCurveAccount(bondingCurve). 351 | SetAssociatedBondingCurveAccount(associatedBondingCurve). 352 | SetAssociatedUserAccount(associatedUser). 353 | SetUserAccount(user). 354 | SetSystemProgramAccount(systemProgram). 355 | SetTokenProgramAccount(tokenProgram). 356 | SetRentAccount(rent). 357 | SetEventAuthorityAccount(eventAuthority). 358 | SetProgramAccount(program) 359 | } 360 | -------------------------------------------------------------------------------- /generated/pump/Buy_test.go: -------------------------------------------------------------------------------- 1 | // Code generated by https://github.com/gagliardetto/anchor-go. DO NOT EDIT. 2 | 3 | package pump 4 | 5 | import ( 6 | "bytes" 7 | ag_gofuzz "github.com/gagliardetto/gofuzz" 8 | ag_require "github.com/stretchr/testify/require" 9 | "strconv" 10 | "testing" 11 | ) 12 | 13 | func TestEncodeDecode_Buy(t *testing.T) { 14 | fu := ag_gofuzz.New().NilChance(0) 15 | for i := 0; i < 1; i++ { 16 | t.Run("Buy"+strconv.Itoa(i), func(t *testing.T) { 17 | { 18 | params := new(Buy) 19 | fu.Fuzz(params) 20 | params.AccountMetaSlice = nil 21 | buf := new(bytes.Buffer) 22 | err := encodeT(*params, buf) 23 | ag_require.NoError(t, err) 24 | got := new(Buy) 25 | err = decodeT(got, buf.Bytes()) 26 | got.AccountMetaSlice = nil 27 | ag_require.NoError(t, err) 28 | ag_require.Equal(t, params, got) 29 | } 30 | }) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /generated/pump/Create.go: -------------------------------------------------------------------------------- 1 | // Code generated by https://github.com/gagliardetto/anchor-go. DO NOT EDIT. 2 | 3 | package pump 4 | 5 | import ( 6 | "errors" 7 | ag_binary "github.com/gagliardetto/binary" 8 | ag_solanago "github.com/gagliardetto/solana-go" 9 | ag_format "github.com/gagliardetto/solana-go/text/format" 10 | ag_treeout "github.com/gagliardetto/treeout" 11 | ) 12 | 13 | // Creates a new coin and bonding curve. 14 | type Create struct { 15 | Name *string 16 | Symbol *string 17 | Uri *string 18 | 19 | // [0] = [WRITE, SIGNER] mint 20 | // 21 | // [1] = [] mintAuthority 22 | // 23 | // [2] = [WRITE] bondingCurve 24 | // 25 | // [3] = [WRITE] associatedBondingCurve 26 | // 27 | // [4] = [] global 28 | // 29 | // [5] = [] mplTokenMetadata 30 | // 31 | // [6] = [WRITE] metadata 32 | // 33 | // [7] = [WRITE, SIGNER] user 34 | // 35 | // [8] = [] systemProgram 36 | // 37 | // [9] = [] tokenProgram 38 | // 39 | // [10] = [] associatedTokenProgram 40 | // 41 | // [11] = [] rent 42 | // 43 | // [12] = [] eventAuthority 44 | // 45 | // [13] = [] program 46 | ag_solanago.AccountMetaSlice `bin:"-"` 47 | } 48 | 49 | // NewCreateInstructionBuilder creates a new `Create` instruction builder. 50 | func NewCreateInstructionBuilder() *Create { 51 | nd := &Create{ 52 | AccountMetaSlice: make(ag_solanago.AccountMetaSlice, 14), 53 | } 54 | return nd 55 | } 56 | 57 | // SetName sets the "name" parameter. 58 | func (inst *Create) SetName(name string) *Create { 59 | inst.Name = &name 60 | return inst 61 | } 62 | 63 | // SetSymbol sets the "symbol" parameter. 64 | func (inst *Create) SetSymbol(symbol string) *Create { 65 | inst.Symbol = &symbol 66 | return inst 67 | } 68 | 69 | // SetUri sets the "uri" parameter. 70 | func (inst *Create) SetUri(uri string) *Create { 71 | inst.Uri = &uri 72 | return inst 73 | } 74 | 75 | // SetMintAccount sets the "mint" account. 76 | func (inst *Create) SetMintAccount(mint ag_solanago.PublicKey) *Create { 77 | inst.AccountMetaSlice[0] = ag_solanago.Meta(mint).WRITE().SIGNER() 78 | return inst 79 | } 80 | 81 | // GetMintAccount gets the "mint" account. 82 | func (inst *Create) GetMintAccount() *ag_solanago.AccountMeta { 83 | return inst.AccountMetaSlice.Get(0) 84 | } 85 | 86 | // SetMintAuthorityAccount sets the "mintAuthority" account. 87 | func (inst *Create) SetMintAuthorityAccount(mintAuthority ag_solanago.PublicKey) *Create { 88 | inst.AccountMetaSlice[1] = ag_solanago.Meta(mintAuthority) 89 | return inst 90 | } 91 | 92 | // GetMintAuthorityAccount gets the "mintAuthority" account. 93 | func (inst *Create) GetMintAuthorityAccount() *ag_solanago.AccountMeta { 94 | return inst.AccountMetaSlice.Get(1) 95 | } 96 | 97 | // SetBondingCurveAccount sets the "bondingCurve" account. 98 | func (inst *Create) SetBondingCurveAccount(bondingCurve ag_solanago.PublicKey) *Create { 99 | inst.AccountMetaSlice[2] = ag_solanago.Meta(bondingCurve).WRITE() 100 | return inst 101 | } 102 | 103 | // GetBondingCurveAccount gets the "bondingCurve" account. 104 | func (inst *Create) GetBondingCurveAccount() *ag_solanago.AccountMeta { 105 | return inst.AccountMetaSlice.Get(2) 106 | } 107 | 108 | // SetAssociatedBondingCurveAccount sets the "associatedBondingCurve" account. 109 | func (inst *Create) SetAssociatedBondingCurveAccount(associatedBondingCurve ag_solanago.PublicKey) *Create { 110 | inst.AccountMetaSlice[3] = ag_solanago.Meta(associatedBondingCurve).WRITE() 111 | return inst 112 | } 113 | 114 | // GetAssociatedBondingCurveAccount gets the "associatedBondingCurve" account. 115 | func (inst *Create) GetAssociatedBondingCurveAccount() *ag_solanago.AccountMeta { 116 | return inst.AccountMetaSlice.Get(3) 117 | } 118 | 119 | // SetGlobalAccount sets the "global" account. 120 | func (inst *Create) SetGlobalAccount(global ag_solanago.PublicKey) *Create { 121 | inst.AccountMetaSlice[4] = ag_solanago.Meta(global) 122 | return inst 123 | } 124 | 125 | // GetGlobalAccount gets the "global" account. 126 | func (inst *Create) GetGlobalAccount() *ag_solanago.AccountMeta { 127 | return inst.AccountMetaSlice.Get(4) 128 | } 129 | 130 | // SetMplTokenMetadataAccount sets the "mplTokenMetadata" account. 131 | func (inst *Create) SetMplTokenMetadataAccount(mplTokenMetadata ag_solanago.PublicKey) *Create { 132 | inst.AccountMetaSlice[5] = ag_solanago.Meta(mplTokenMetadata) 133 | return inst 134 | } 135 | 136 | // GetMplTokenMetadataAccount gets the "mplTokenMetadata" account. 137 | func (inst *Create) GetMplTokenMetadataAccount() *ag_solanago.AccountMeta { 138 | return inst.AccountMetaSlice.Get(5) 139 | } 140 | 141 | // SetMetadataAccount sets the "metadata" account. 142 | func (inst *Create) SetMetadataAccount(metadata ag_solanago.PublicKey) *Create { 143 | inst.AccountMetaSlice[6] = ag_solanago.Meta(metadata).WRITE() 144 | return inst 145 | } 146 | 147 | // GetMetadataAccount gets the "metadata" account. 148 | func (inst *Create) GetMetadataAccount() *ag_solanago.AccountMeta { 149 | return inst.AccountMetaSlice.Get(6) 150 | } 151 | 152 | // SetUserAccount sets the "user" account. 153 | func (inst *Create) SetUserAccount(user ag_solanago.PublicKey) *Create { 154 | inst.AccountMetaSlice[7] = ag_solanago.Meta(user).WRITE().SIGNER() 155 | return inst 156 | } 157 | 158 | // GetUserAccount gets the "user" account. 159 | func (inst *Create) GetUserAccount() *ag_solanago.AccountMeta { 160 | return inst.AccountMetaSlice.Get(7) 161 | } 162 | 163 | // SetSystemProgramAccount sets the "systemProgram" account. 164 | func (inst *Create) SetSystemProgramAccount(systemProgram ag_solanago.PublicKey) *Create { 165 | inst.AccountMetaSlice[8] = ag_solanago.Meta(systemProgram) 166 | return inst 167 | } 168 | 169 | // GetSystemProgramAccount gets the "systemProgram" account. 170 | func (inst *Create) GetSystemProgramAccount() *ag_solanago.AccountMeta { 171 | return inst.AccountMetaSlice.Get(8) 172 | } 173 | 174 | // SetTokenProgramAccount sets the "tokenProgram" account. 175 | func (inst *Create) SetTokenProgramAccount(tokenProgram ag_solanago.PublicKey) *Create { 176 | inst.AccountMetaSlice[9] = ag_solanago.Meta(tokenProgram) 177 | return inst 178 | } 179 | 180 | // GetTokenProgramAccount gets the "tokenProgram" account. 181 | func (inst *Create) GetTokenProgramAccount() *ag_solanago.AccountMeta { 182 | return inst.AccountMetaSlice.Get(9) 183 | } 184 | 185 | // SetAssociatedTokenProgramAccount sets the "associatedTokenProgram" account. 186 | func (inst *Create) SetAssociatedTokenProgramAccount(associatedTokenProgram ag_solanago.PublicKey) *Create { 187 | inst.AccountMetaSlice[10] = ag_solanago.Meta(associatedTokenProgram) 188 | return inst 189 | } 190 | 191 | // GetAssociatedTokenProgramAccount gets the "associatedTokenProgram" account. 192 | func (inst *Create) GetAssociatedTokenProgramAccount() *ag_solanago.AccountMeta { 193 | return inst.AccountMetaSlice.Get(10) 194 | } 195 | 196 | // SetRentAccount sets the "rent" account. 197 | func (inst *Create) SetRentAccount(rent ag_solanago.PublicKey) *Create { 198 | inst.AccountMetaSlice[11] = ag_solanago.Meta(rent) 199 | return inst 200 | } 201 | 202 | // GetRentAccount gets the "rent" account. 203 | func (inst *Create) GetRentAccount() *ag_solanago.AccountMeta { 204 | return inst.AccountMetaSlice.Get(11) 205 | } 206 | 207 | // SetEventAuthorityAccount sets the "eventAuthority" account. 208 | func (inst *Create) SetEventAuthorityAccount(eventAuthority ag_solanago.PublicKey) *Create { 209 | inst.AccountMetaSlice[12] = ag_solanago.Meta(eventAuthority) 210 | return inst 211 | } 212 | 213 | // GetEventAuthorityAccount gets the "eventAuthority" account. 214 | func (inst *Create) GetEventAuthorityAccount() *ag_solanago.AccountMeta { 215 | return inst.AccountMetaSlice.Get(12) 216 | } 217 | 218 | // SetProgramAccount sets the "program" account. 219 | func (inst *Create) SetProgramAccount(program ag_solanago.PublicKey) *Create { 220 | inst.AccountMetaSlice[13] = ag_solanago.Meta(program) 221 | return inst 222 | } 223 | 224 | // GetProgramAccount gets the "program" account. 225 | func (inst *Create) GetProgramAccount() *ag_solanago.AccountMeta { 226 | return inst.AccountMetaSlice.Get(13) 227 | } 228 | 229 | func (inst Create) Build() *Instruction { 230 | return &Instruction{BaseVariant: ag_binary.BaseVariant{ 231 | Impl: inst, 232 | TypeID: Instruction_Create, 233 | }} 234 | } 235 | 236 | // ValidateAndBuild validates the instruction parameters and accounts; 237 | // if there is a validation error, it returns the error. 238 | // Otherwise, it builds and returns the instruction. 239 | func (inst Create) ValidateAndBuild() (*Instruction, error) { 240 | if err := inst.Validate(); err != nil { 241 | return nil, err 242 | } 243 | return inst.Build(), nil 244 | } 245 | 246 | func (inst *Create) Validate() error { 247 | // Check whether all (required) parameters are set: 248 | { 249 | if inst.Name == nil { 250 | return errors.New("Name parameter is not set") 251 | } 252 | if inst.Symbol == nil { 253 | return errors.New("Symbol parameter is not set") 254 | } 255 | if inst.Uri == nil { 256 | return errors.New("Uri parameter is not set") 257 | } 258 | } 259 | 260 | // Check whether all (required) accounts are set: 261 | { 262 | if inst.AccountMetaSlice[0] == nil { 263 | return errors.New("accounts.Mint is not set") 264 | } 265 | if inst.AccountMetaSlice[1] == nil { 266 | return errors.New("accounts.MintAuthority is not set") 267 | } 268 | if inst.AccountMetaSlice[2] == nil { 269 | return errors.New("accounts.BondingCurve is not set") 270 | } 271 | if inst.AccountMetaSlice[3] == nil { 272 | return errors.New("accounts.AssociatedBondingCurve is not set") 273 | } 274 | if inst.AccountMetaSlice[4] == nil { 275 | return errors.New("accounts.Global is not set") 276 | } 277 | if inst.AccountMetaSlice[5] == nil { 278 | return errors.New("accounts.MplTokenMetadata is not set") 279 | } 280 | if inst.AccountMetaSlice[6] == nil { 281 | return errors.New("accounts.Metadata is not set") 282 | } 283 | if inst.AccountMetaSlice[7] == nil { 284 | return errors.New("accounts.User is not set") 285 | } 286 | if inst.AccountMetaSlice[8] == nil { 287 | return errors.New("accounts.SystemProgram is not set") 288 | } 289 | if inst.AccountMetaSlice[9] == nil { 290 | return errors.New("accounts.TokenProgram is not set") 291 | } 292 | if inst.AccountMetaSlice[10] == nil { 293 | return errors.New("accounts.AssociatedTokenProgram is not set") 294 | } 295 | if inst.AccountMetaSlice[11] == nil { 296 | return errors.New("accounts.Rent is not set") 297 | } 298 | if inst.AccountMetaSlice[12] == nil { 299 | return errors.New("accounts.EventAuthority is not set") 300 | } 301 | if inst.AccountMetaSlice[13] == nil { 302 | return errors.New("accounts.Program is not set") 303 | } 304 | } 305 | return nil 306 | } 307 | 308 | func (inst *Create) EncodeToTree(parent ag_treeout.Branches) { 309 | parent.Child(ag_format.Program(ProgramName, ProgramID)). 310 | // 311 | ParentFunc(func(programBranch ag_treeout.Branches) { 312 | programBranch.Child(ag_format.Instruction("Create")). 313 | // 314 | ParentFunc(func(instructionBranch ag_treeout.Branches) { 315 | 316 | // Parameters of the instruction: 317 | instructionBranch.Child("Params[len=3]").ParentFunc(func(paramsBranch ag_treeout.Branches) { 318 | paramsBranch.Child(ag_format.Param(" Name", *inst.Name)) 319 | paramsBranch.Child(ag_format.Param("Symbol", *inst.Symbol)) 320 | paramsBranch.Child(ag_format.Param(" Uri", *inst.Uri)) 321 | }) 322 | 323 | // Accounts of the instruction: 324 | instructionBranch.Child("Accounts[len=14]").ParentFunc(func(accountsBranch ag_treeout.Branches) { 325 | accountsBranch.Child(ag_format.Meta(" mint", inst.AccountMetaSlice.Get(0))) 326 | accountsBranch.Child(ag_format.Meta(" mintAuthority", inst.AccountMetaSlice.Get(1))) 327 | accountsBranch.Child(ag_format.Meta(" bondingCurve", inst.AccountMetaSlice.Get(2))) 328 | accountsBranch.Child(ag_format.Meta("associatedBondingCurve", inst.AccountMetaSlice.Get(3))) 329 | accountsBranch.Child(ag_format.Meta(" global", inst.AccountMetaSlice.Get(4))) 330 | accountsBranch.Child(ag_format.Meta(" mplTokenMetadata", inst.AccountMetaSlice.Get(5))) 331 | accountsBranch.Child(ag_format.Meta(" metadata", inst.AccountMetaSlice.Get(6))) 332 | accountsBranch.Child(ag_format.Meta(" user", inst.AccountMetaSlice.Get(7))) 333 | accountsBranch.Child(ag_format.Meta(" systemProgram", inst.AccountMetaSlice.Get(8))) 334 | accountsBranch.Child(ag_format.Meta(" tokenProgram", inst.AccountMetaSlice.Get(9))) 335 | accountsBranch.Child(ag_format.Meta("associatedTokenProgram", inst.AccountMetaSlice.Get(10))) 336 | accountsBranch.Child(ag_format.Meta(" rent", inst.AccountMetaSlice.Get(11))) 337 | accountsBranch.Child(ag_format.Meta(" eventAuthority", inst.AccountMetaSlice.Get(12))) 338 | accountsBranch.Child(ag_format.Meta(" program", inst.AccountMetaSlice.Get(13))) 339 | }) 340 | }) 341 | }) 342 | } 343 | 344 | func (obj Create) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error) { 345 | // Serialize `Name` param: 346 | err = encoder.Encode(obj.Name) 347 | if err != nil { 348 | return err 349 | } 350 | // Serialize `Symbol` param: 351 | err = encoder.Encode(obj.Symbol) 352 | if err != nil { 353 | return err 354 | } 355 | // Serialize `Uri` param: 356 | err = encoder.Encode(obj.Uri) 357 | if err != nil { 358 | return err 359 | } 360 | return nil 361 | } 362 | func (obj *Create) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error) { 363 | // Deserialize `Name`: 364 | err = decoder.Decode(&obj.Name) 365 | if err != nil { 366 | return err 367 | } 368 | // Deserialize `Symbol`: 369 | err = decoder.Decode(&obj.Symbol) 370 | if err != nil { 371 | return err 372 | } 373 | // Deserialize `Uri`: 374 | err = decoder.Decode(&obj.Uri) 375 | if err != nil { 376 | return err 377 | } 378 | return nil 379 | } 380 | 381 | // NewCreateInstruction declares a new Create instruction with the provided parameters and accounts. 382 | func NewCreateInstruction( 383 | // Parameters: 384 | name string, 385 | symbol string, 386 | uri string, 387 | // Accounts: 388 | mint ag_solanago.PublicKey, 389 | mintAuthority ag_solanago.PublicKey, 390 | bondingCurve ag_solanago.PublicKey, 391 | associatedBondingCurve ag_solanago.PublicKey, 392 | global ag_solanago.PublicKey, 393 | mplTokenMetadata ag_solanago.PublicKey, 394 | metadata ag_solanago.PublicKey, 395 | user ag_solanago.PublicKey, 396 | systemProgram ag_solanago.PublicKey, 397 | tokenProgram ag_solanago.PublicKey, 398 | associatedTokenProgram ag_solanago.PublicKey, 399 | rent ag_solanago.PublicKey, 400 | eventAuthority ag_solanago.PublicKey, 401 | program ag_solanago.PublicKey) *Create { 402 | return NewCreateInstructionBuilder(). 403 | SetName(name). 404 | SetSymbol(symbol). 405 | SetUri(uri). 406 | SetMintAccount(mint). 407 | SetMintAuthorityAccount(mintAuthority). 408 | SetBondingCurveAccount(bondingCurve). 409 | SetAssociatedBondingCurveAccount(associatedBondingCurve). 410 | SetGlobalAccount(global). 411 | SetMplTokenMetadataAccount(mplTokenMetadata). 412 | SetMetadataAccount(metadata). 413 | SetUserAccount(user). 414 | SetSystemProgramAccount(systemProgram). 415 | SetTokenProgramAccount(tokenProgram). 416 | SetAssociatedTokenProgramAccount(associatedTokenProgram). 417 | SetRentAccount(rent). 418 | SetEventAuthorityAccount(eventAuthority). 419 | SetProgramAccount(program) 420 | } 421 | -------------------------------------------------------------------------------- /generated/pump/Create_test.go: -------------------------------------------------------------------------------- 1 | // Code generated by https://github.com/gagliardetto/anchor-go. DO NOT EDIT. 2 | 3 | package pump 4 | 5 | import ( 6 | "bytes" 7 | ag_gofuzz "github.com/gagliardetto/gofuzz" 8 | ag_require "github.com/stretchr/testify/require" 9 | "strconv" 10 | "testing" 11 | ) 12 | 13 | func TestEncodeDecode_Create(t *testing.T) { 14 | fu := ag_gofuzz.New().NilChance(0) 15 | for i := 0; i < 1; i++ { 16 | t.Run("Create"+strconv.Itoa(i), func(t *testing.T) { 17 | { 18 | params := new(Create) 19 | fu.Fuzz(params) 20 | params.AccountMetaSlice = nil 21 | buf := new(bytes.Buffer) 22 | err := encodeT(*params, buf) 23 | ag_require.NoError(t, err) 24 | got := new(Create) 25 | err = decodeT(got, buf.Bytes()) 26 | got.AccountMetaSlice = nil 27 | ag_require.NoError(t, err) 28 | ag_require.Equal(t, params, got) 29 | } 30 | }) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /generated/pump/Initialize.go: -------------------------------------------------------------------------------- 1 | // Code generated by https://github.com/gagliardetto/anchor-go. DO NOT EDIT. 2 | 3 | package pump 4 | 5 | import ( 6 | "errors" 7 | ag_binary "github.com/gagliardetto/binary" 8 | ag_solanago "github.com/gagliardetto/solana-go" 9 | ag_format "github.com/gagliardetto/solana-go/text/format" 10 | ag_treeout "github.com/gagliardetto/treeout" 11 | ) 12 | 13 | // Creates the global state. 14 | type Initialize struct { 15 | 16 | // [0] = [WRITE] global 17 | // 18 | // [1] = [WRITE, SIGNER] user 19 | // 20 | // [2] = [] systemProgram 21 | ag_solanago.AccountMetaSlice `bin:"-"` 22 | } 23 | 24 | // NewInitializeInstructionBuilder creates a new `Initialize` instruction builder. 25 | func NewInitializeInstructionBuilder() *Initialize { 26 | nd := &Initialize{ 27 | AccountMetaSlice: make(ag_solanago.AccountMetaSlice, 3), 28 | } 29 | return nd 30 | } 31 | 32 | // SetGlobalAccount sets the "global" account. 33 | func (inst *Initialize) SetGlobalAccount(global ag_solanago.PublicKey) *Initialize { 34 | inst.AccountMetaSlice[0] = ag_solanago.Meta(global).WRITE() 35 | return inst 36 | } 37 | 38 | // GetGlobalAccount gets the "global" account. 39 | func (inst *Initialize) GetGlobalAccount() *ag_solanago.AccountMeta { 40 | return inst.AccountMetaSlice.Get(0) 41 | } 42 | 43 | // SetUserAccount sets the "user" account. 44 | func (inst *Initialize) SetUserAccount(user ag_solanago.PublicKey) *Initialize { 45 | inst.AccountMetaSlice[1] = ag_solanago.Meta(user).WRITE().SIGNER() 46 | return inst 47 | } 48 | 49 | // GetUserAccount gets the "user" account. 50 | func (inst *Initialize) GetUserAccount() *ag_solanago.AccountMeta { 51 | return inst.AccountMetaSlice.Get(1) 52 | } 53 | 54 | // SetSystemProgramAccount sets the "systemProgram" account. 55 | func (inst *Initialize) SetSystemProgramAccount(systemProgram ag_solanago.PublicKey) *Initialize { 56 | inst.AccountMetaSlice[2] = ag_solanago.Meta(systemProgram) 57 | return inst 58 | } 59 | 60 | // GetSystemProgramAccount gets the "systemProgram" account. 61 | func (inst *Initialize) GetSystemProgramAccount() *ag_solanago.AccountMeta { 62 | return inst.AccountMetaSlice.Get(2) 63 | } 64 | 65 | func (inst Initialize) Build() *Instruction { 66 | return &Instruction{BaseVariant: ag_binary.BaseVariant{ 67 | Impl: inst, 68 | TypeID: Instruction_Initialize, 69 | }} 70 | } 71 | 72 | // ValidateAndBuild validates the instruction parameters and accounts; 73 | // if there is a validation error, it returns the error. 74 | // Otherwise, it builds and returns the instruction. 75 | func (inst Initialize) ValidateAndBuild() (*Instruction, error) { 76 | if err := inst.Validate(); err != nil { 77 | return nil, err 78 | } 79 | return inst.Build(), nil 80 | } 81 | 82 | func (inst *Initialize) Validate() error { 83 | // Check whether all (required) accounts are set: 84 | { 85 | if inst.AccountMetaSlice[0] == nil { 86 | return errors.New("accounts.Global is not set") 87 | } 88 | if inst.AccountMetaSlice[1] == nil { 89 | return errors.New("accounts.User is not set") 90 | } 91 | if inst.AccountMetaSlice[2] == nil { 92 | return errors.New("accounts.SystemProgram is not set") 93 | } 94 | } 95 | return nil 96 | } 97 | 98 | func (inst *Initialize) EncodeToTree(parent ag_treeout.Branches) { 99 | parent.Child(ag_format.Program(ProgramName, ProgramID)). 100 | // 101 | ParentFunc(func(programBranch ag_treeout.Branches) { 102 | programBranch.Child(ag_format.Instruction("Initialize")). 103 | // 104 | ParentFunc(func(instructionBranch ag_treeout.Branches) { 105 | 106 | // Parameters of the instruction: 107 | instructionBranch.Child("Params[len=0]").ParentFunc(func(paramsBranch ag_treeout.Branches) {}) 108 | 109 | // Accounts of the instruction: 110 | instructionBranch.Child("Accounts[len=3]").ParentFunc(func(accountsBranch ag_treeout.Branches) { 111 | accountsBranch.Child(ag_format.Meta(" global", inst.AccountMetaSlice.Get(0))) 112 | accountsBranch.Child(ag_format.Meta(" user", inst.AccountMetaSlice.Get(1))) 113 | accountsBranch.Child(ag_format.Meta("systemProgram", inst.AccountMetaSlice.Get(2))) 114 | }) 115 | }) 116 | }) 117 | } 118 | 119 | func (obj Initialize) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error) { 120 | return nil 121 | } 122 | func (obj *Initialize) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error) { 123 | return nil 124 | } 125 | 126 | // NewInitializeInstruction declares a new Initialize instruction with the provided parameters and accounts. 127 | func NewInitializeInstruction( 128 | // Accounts: 129 | global ag_solanago.PublicKey, 130 | user ag_solanago.PublicKey, 131 | systemProgram ag_solanago.PublicKey) *Initialize { 132 | return NewInitializeInstructionBuilder(). 133 | SetGlobalAccount(global). 134 | SetUserAccount(user). 135 | SetSystemProgramAccount(systemProgram) 136 | } 137 | -------------------------------------------------------------------------------- /generated/pump/Initialize_test.go: -------------------------------------------------------------------------------- 1 | // Code generated by https://github.com/gagliardetto/anchor-go. DO NOT EDIT. 2 | 3 | package pump 4 | 5 | import ( 6 | "bytes" 7 | ag_gofuzz "github.com/gagliardetto/gofuzz" 8 | ag_require "github.com/stretchr/testify/require" 9 | "strconv" 10 | "testing" 11 | ) 12 | 13 | func TestEncodeDecode_Initialize(t *testing.T) { 14 | fu := ag_gofuzz.New().NilChance(0) 15 | for i := 0; i < 1; i++ { 16 | t.Run("Initialize"+strconv.Itoa(i), func(t *testing.T) { 17 | { 18 | params := new(Initialize) 19 | fu.Fuzz(params) 20 | params.AccountMetaSlice = nil 21 | buf := new(bytes.Buffer) 22 | err := encodeT(*params, buf) 23 | ag_require.NoError(t, err) 24 | got := new(Initialize) 25 | err = decodeT(got, buf.Bytes()) 26 | got.AccountMetaSlice = nil 27 | ag_require.NoError(t, err) 28 | ag_require.Equal(t, params, got) 29 | } 30 | }) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /generated/pump/Sell.go: -------------------------------------------------------------------------------- 1 | // Code generated by https://github.com/gagliardetto/anchor-go. DO NOT EDIT. 2 | 3 | package pump 4 | 5 | import ( 6 | "errors" 7 | ag_binary "github.com/gagliardetto/binary" 8 | ag_solanago "github.com/gagliardetto/solana-go" 9 | ag_format "github.com/gagliardetto/solana-go/text/format" 10 | ag_treeout "github.com/gagliardetto/treeout" 11 | ) 12 | 13 | // Sells tokens into a bonding curve. 14 | type Sell struct { 15 | Amount *uint64 16 | MinSolOutput *uint64 17 | 18 | // [0] = [] global 19 | // 20 | // [1] = [WRITE] feeRecipient 21 | // 22 | // [2] = [] mint 23 | // 24 | // [3] = [WRITE] bondingCurve 25 | // 26 | // [4] = [WRITE] associatedBondingCurve 27 | // 28 | // [5] = [WRITE] associatedUser 29 | // 30 | // [6] = [WRITE, SIGNER] user 31 | // 32 | // [7] = [] systemProgram 33 | // 34 | // [8] = [] associatedTokenProgram 35 | // 36 | // [9] = [] tokenProgram 37 | // 38 | // [10] = [] eventAuthority 39 | // 40 | // [11] = [] program 41 | ag_solanago.AccountMetaSlice `bin:"-"` 42 | } 43 | 44 | // NewSellInstructionBuilder creates a new `Sell` instruction builder. 45 | func NewSellInstructionBuilder() *Sell { 46 | nd := &Sell{ 47 | AccountMetaSlice: make(ag_solanago.AccountMetaSlice, 12), 48 | } 49 | return nd 50 | } 51 | 52 | // SetAmount sets the "amount" parameter. 53 | func (inst *Sell) SetAmount(amount uint64) *Sell { 54 | inst.Amount = &amount 55 | return inst 56 | } 57 | 58 | // SetMinSolOutput sets the "minSolOutput" parameter. 59 | func (inst *Sell) SetMinSolOutput(minSolOutput uint64) *Sell { 60 | inst.MinSolOutput = &minSolOutput 61 | return inst 62 | } 63 | 64 | // SetGlobalAccount sets the "global" account. 65 | func (inst *Sell) SetGlobalAccount(global ag_solanago.PublicKey) *Sell { 66 | inst.AccountMetaSlice[0] = ag_solanago.Meta(global) 67 | return inst 68 | } 69 | 70 | // GetGlobalAccount gets the "global" account. 71 | func (inst *Sell) GetGlobalAccount() *ag_solanago.AccountMeta { 72 | return inst.AccountMetaSlice.Get(0) 73 | } 74 | 75 | // SetFeeRecipientAccount sets the "feeRecipient" account. 76 | func (inst *Sell) SetFeeRecipientAccount(feeRecipient ag_solanago.PublicKey) *Sell { 77 | inst.AccountMetaSlice[1] = ag_solanago.Meta(feeRecipient).WRITE() 78 | return inst 79 | } 80 | 81 | // GetFeeRecipientAccount gets the "feeRecipient" account. 82 | func (inst *Sell) GetFeeRecipientAccount() *ag_solanago.AccountMeta { 83 | return inst.AccountMetaSlice.Get(1) 84 | } 85 | 86 | // SetMintAccount sets the "mint" account. 87 | func (inst *Sell) SetMintAccount(mint ag_solanago.PublicKey) *Sell { 88 | inst.AccountMetaSlice[2] = ag_solanago.Meta(mint) 89 | return inst 90 | } 91 | 92 | // GetMintAccount gets the "mint" account. 93 | func (inst *Sell) GetMintAccount() *ag_solanago.AccountMeta { 94 | return inst.AccountMetaSlice.Get(2) 95 | } 96 | 97 | // SetBondingCurveAccount sets the "bondingCurve" account. 98 | func (inst *Sell) SetBondingCurveAccount(bondingCurve ag_solanago.PublicKey) *Sell { 99 | inst.AccountMetaSlice[3] = ag_solanago.Meta(bondingCurve).WRITE() 100 | return inst 101 | } 102 | 103 | // GetBondingCurveAccount gets the "bondingCurve" account. 104 | func (inst *Sell) GetBondingCurveAccount() *ag_solanago.AccountMeta { 105 | return inst.AccountMetaSlice.Get(3) 106 | } 107 | 108 | // SetAssociatedBondingCurveAccount sets the "associatedBondingCurve" account. 109 | func (inst *Sell) SetAssociatedBondingCurveAccount(associatedBondingCurve ag_solanago.PublicKey) *Sell { 110 | inst.AccountMetaSlice[4] = ag_solanago.Meta(associatedBondingCurve).WRITE() 111 | return inst 112 | } 113 | 114 | // GetAssociatedBondingCurveAccount gets the "associatedBondingCurve" account. 115 | func (inst *Sell) GetAssociatedBondingCurveAccount() *ag_solanago.AccountMeta { 116 | return inst.AccountMetaSlice.Get(4) 117 | } 118 | 119 | // SetAssociatedUserAccount sets the "associatedUser" account. 120 | func (inst *Sell) SetAssociatedUserAccount(associatedUser ag_solanago.PublicKey) *Sell { 121 | inst.AccountMetaSlice[5] = ag_solanago.Meta(associatedUser).WRITE() 122 | return inst 123 | } 124 | 125 | // GetAssociatedUserAccount gets the "associatedUser" account. 126 | func (inst *Sell) GetAssociatedUserAccount() *ag_solanago.AccountMeta { 127 | return inst.AccountMetaSlice.Get(5) 128 | } 129 | 130 | // SetUserAccount sets the "user" account. 131 | func (inst *Sell) SetUserAccount(user ag_solanago.PublicKey) *Sell { 132 | inst.AccountMetaSlice[6] = ag_solanago.Meta(user).WRITE().SIGNER() 133 | return inst 134 | } 135 | 136 | // GetUserAccount gets the "user" account. 137 | func (inst *Sell) GetUserAccount() *ag_solanago.AccountMeta { 138 | return inst.AccountMetaSlice.Get(6) 139 | } 140 | 141 | // SetSystemProgramAccount sets the "systemProgram" account. 142 | func (inst *Sell) SetSystemProgramAccount(systemProgram ag_solanago.PublicKey) *Sell { 143 | inst.AccountMetaSlice[7] = ag_solanago.Meta(systemProgram) 144 | return inst 145 | } 146 | 147 | // GetSystemProgramAccount gets the "systemProgram" account. 148 | func (inst *Sell) GetSystemProgramAccount() *ag_solanago.AccountMeta { 149 | return inst.AccountMetaSlice.Get(7) 150 | } 151 | 152 | // SetAssociatedTokenProgramAccount sets the "associatedTokenProgram" account. 153 | func (inst *Sell) SetAssociatedTokenProgramAccount(associatedTokenProgram ag_solanago.PublicKey) *Sell { 154 | inst.AccountMetaSlice[8] = ag_solanago.Meta(associatedTokenProgram) 155 | return inst 156 | } 157 | 158 | // GetAssociatedTokenProgramAccount gets the "associatedTokenProgram" account. 159 | func (inst *Sell) GetAssociatedTokenProgramAccount() *ag_solanago.AccountMeta { 160 | return inst.AccountMetaSlice.Get(8) 161 | } 162 | 163 | // SetTokenProgramAccount sets the "tokenProgram" account. 164 | func (inst *Sell) SetTokenProgramAccount(tokenProgram ag_solanago.PublicKey) *Sell { 165 | inst.AccountMetaSlice[9] = ag_solanago.Meta(tokenProgram) 166 | return inst 167 | } 168 | 169 | // GetTokenProgramAccount gets the "tokenProgram" account. 170 | func (inst *Sell) GetTokenProgramAccount() *ag_solanago.AccountMeta { 171 | return inst.AccountMetaSlice.Get(9) 172 | } 173 | 174 | // SetEventAuthorityAccount sets the "eventAuthority" account. 175 | func (inst *Sell) SetEventAuthorityAccount(eventAuthority ag_solanago.PublicKey) *Sell { 176 | inst.AccountMetaSlice[10] = ag_solanago.Meta(eventAuthority) 177 | return inst 178 | } 179 | 180 | // GetEventAuthorityAccount gets the "eventAuthority" account. 181 | func (inst *Sell) GetEventAuthorityAccount() *ag_solanago.AccountMeta { 182 | return inst.AccountMetaSlice.Get(10) 183 | } 184 | 185 | // SetProgramAccount sets the "program" account. 186 | func (inst *Sell) SetProgramAccount(program ag_solanago.PublicKey) *Sell { 187 | inst.AccountMetaSlice[11] = ag_solanago.Meta(program) 188 | return inst 189 | } 190 | 191 | // GetProgramAccount gets the "program" account. 192 | func (inst *Sell) GetProgramAccount() *ag_solanago.AccountMeta { 193 | return inst.AccountMetaSlice.Get(11) 194 | } 195 | 196 | func (inst Sell) Build() *Instruction { 197 | return &Instruction{BaseVariant: ag_binary.BaseVariant{ 198 | Impl: inst, 199 | TypeID: Instruction_Sell, 200 | }} 201 | } 202 | 203 | // ValidateAndBuild validates the instruction parameters and accounts; 204 | // if there is a validation error, it returns the error. 205 | // Otherwise, it builds and returns the instruction. 206 | func (inst Sell) ValidateAndBuild() (*Instruction, error) { 207 | if err := inst.Validate(); err != nil { 208 | return nil, err 209 | } 210 | return inst.Build(), nil 211 | } 212 | 213 | func (inst *Sell) Validate() error { 214 | // Check whether all (required) parameters are set: 215 | { 216 | if inst.Amount == nil { 217 | return errors.New("Amount parameter is not set") 218 | } 219 | if inst.MinSolOutput == nil { 220 | return errors.New("MinSolOutput parameter is not set") 221 | } 222 | } 223 | 224 | // Check whether all (required) accounts are set: 225 | { 226 | if inst.AccountMetaSlice[0] == nil { 227 | return errors.New("accounts.Global is not set") 228 | } 229 | if inst.AccountMetaSlice[1] == nil { 230 | return errors.New("accounts.FeeRecipient is not set") 231 | } 232 | if inst.AccountMetaSlice[2] == nil { 233 | return errors.New("accounts.Mint is not set") 234 | } 235 | if inst.AccountMetaSlice[3] == nil { 236 | return errors.New("accounts.BondingCurve is not set") 237 | } 238 | if inst.AccountMetaSlice[4] == nil { 239 | return errors.New("accounts.AssociatedBondingCurve is not set") 240 | } 241 | if inst.AccountMetaSlice[5] == nil { 242 | return errors.New("accounts.AssociatedUser is not set") 243 | } 244 | if inst.AccountMetaSlice[6] == nil { 245 | return errors.New("accounts.User is not set") 246 | } 247 | if inst.AccountMetaSlice[7] == nil { 248 | return errors.New("accounts.SystemProgram is not set") 249 | } 250 | if inst.AccountMetaSlice[8] == nil { 251 | return errors.New("accounts.AssociatedTokenProgram is not set") 252 | } 253 | if inst.AccountMetaSlice[9] == nil { 254 | return errors.New("accounts.TokenProgram is not set") 255 | } 256 | if inst.AccountMetaSlice[10] == nil { 257 | return errors.New("accounts.EventAuthority is not set") 258 | } 259 | if inst.AccountMetaSlice[11] == nil { 260 | return errors.New("accounts.Program is not set") 261 | } 262 | } 263 | return nil 264 | } 265 | 266 | func (inst *Sell) EncodeToTree(parent ag_treeout.Branches) { 267 | parent.Child(ag_format.Program(ProgramName, ProgramID)). 268 | // 269 | ParentFunc(func(programBranch ag_treeout.Branches) { 270 | programBranch.Child(ag_format.Instruction("Sell")). 271 | // 272 | ParentFunc(func(instructionBranch ag_treeout.Branches) { 273 | 274 | // Parameters of the instruction: 275 | instructionBranch.Child("Params[len=2]").ParentFunc(func(paramsBranch ag_treeout.Branches) { 276 | paramsBranch.Child(ag_format.Param(" Amount", *inst.Amount)) 277 | paramsBranch.Child(ag_format.Param("MinSolOutput", *inst.MinSolOutput)) 278 | }) 279 | 280 | // Accounts of the instruction: 281 | instructionBranch.Child("Accounts[len=12]").ParentFunc(func(accountsBranch ag_treeout.Branches) { 282 | accountsBranch.Child(ag_format.Meta(" global", inst.AccountMetaSlice.Get(0))) 283 | accountsBranch.Child(ag_format.Meta(" feeRecipient", inst.AccountMetaSlice.Get(1))) 284 | accountsBranch.Child(ag_format.Meta(" mint", inst.AccountMetaSlice.Get(2))) 285 | accountsBranch.Child(ag_format.Meta(" bondingCurve", inst.AccountMetaSlice.Get(3))) 286 | accountsBranch.Child(ag_format.Meta("associatedBondingCurve", inst.AccountMetaSlice.Get(4))) 287 | accountsBranch.Child(ag_format.Meta(" associatedUser", inst.AccountMetaSlice.Get(5))) 288 | accountsBranch.Child(ag_format.Meta(" user", inst.AccountMetaSlice.Get(6))) 289 | accountsBranch.Child(ag_format.Meta(" systemProgram", inst.AccountMetaSlice.Get(7))) 290 | accountsBranch.Child(ag_format.Meta("associatedTokenProgram", inst.AccountMetaSlice.Get(8))) 291 | accountsBranch.Child(ag_format.Meta(" tokenProgram", inst.AccountMetaSlice.Get(9))) 292 | accountsBranch.Child(ag_format.Meta(" eventAuthority", inst.AccountMetaSlice.Get(10))) 293 | accountsBranch.Child(ag_format.Meta(" program", inst.AccountMetaSlice.Get(11))) 294 | }) 295 | }) 296 | }) 297 | } 298 | 299 | func (obj Sell) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error) { 300 | // Serialize `Amount` param: 301 | err = encoder.Encode(obj.Amount) 302 | if err != nil { 303 | return err 304 | } 305 | // Serialize `MinSolOutput` param: 306 | err = encoder.Encode(obj.MinSolOutput) 307 | if err != nil { 308 | return err 309 | } 310 | return nil 311 | } 312 | func (obj *Sell) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error) { 313 | // Deserialize `Amount`: 314 | err = decoder.Decode(&obj.Amount) 315 | if err != nil { 316 | return err 317 | } 318 | // Deserialize `MinSolOutput`: 319 | err = decoder.Decode(&obj.MinSolOutput) 320 | if err != nil { 321 | return err 322 | } 323 | return nil 324 | } 325 | 326 | // NewSellInstruction declares a new Sell instruction with the provided parameters and accounts. 327 | func NewSellInstruction( 328 | // Parameters: 329 | amount uint64, 330 | minSolOutput uint64, 331 | // Accounts: 332 | global ag_solanago.PublicKey, 333 | feeRecipient ag_solanago.PublicKey, 334 | mint ag_solanago.PublicKey, 335 | bondingCurve ag_solanago.PublicKey, 336 | associatedBondingCurve ag_solanago.PublicKey, 337 | associatedUser ag_solanago.PublicKey, 338 | user ag_solanago.PublicKey, 339 | systemProgram ag_solanago.PublicKey, 340 | associatedTokenProgram ag_solanago.PublicKey, 341 | tokenProgram ag_solanago.PublicKey, 342 | eventAuthority ag_solanago.PublicKey, 343 | program ag_solanago.PublicKey) *Sell { 344 | return NewSellInstructionBuilder(). 345 | SetAmount(amount). 346 | SetMinSolOutput(minSolOutput). 347 | SetGlobalAccount(global). 348 | SetFeeRecipientAccount(feeRecipient). 349 | SetMintAccount(mint). 350 | SetBondingCurveAccount(bondingCurve). 351 | SetAssociatedBondingCurveAccount(associatedBondingCurve). 352 | SetAssociatedUserAccount(associatedUser). 353 | SetUserAccount(user). 354 | SetSystemProgramAccount(systemProgram). 355 | SetAssociatedTokenProgramAccount(associatedTokenProgram). 356 | SetTokenProgramAccount(tokenProgram). 357 | SetEventAuthorityAccount(eventAuthority). 358 | SetProgramAccount(program) 359 | } 360 | -------------------------------------------------------------------------------- /generated/pump/Sell_test.go: -------------------------------------------------------------------------------- 1 | // Code generated by https://github.com/gagliardetto/anchor-go. DO NOT EDIT. 2 | 3 | package pump 4 | 5 | import ( 6 | "bytes" 7 | ag_gofuzz "github.com/gagliardetto/gofuzz" 8 | ag_require "github.com/stretchr/testify/require" 9 | "strconv" 10 | "testing" 11 | ) 12 | 13 | func TestEncodeDecode_Sell(t *testing.T) { 14 | fu := ag_gofuzz.New().NilChance(0) 15 | for i := 0; i < 1; i++ { 16 | t.Run("Sell"+strconv.Itoa(i), func(t *testing.T) { 17 | { 18 | params := new(Sell) 19 | fu.Fuzz(params) 20 | params.AccountMetaSlice = nil 21 | buf := new(bytes.Buffer) 22 | err := encodeT(*params, buf) 23 | ag_require.NoError(t, err) 24 | got := new(Sell) 25 | err = decodeT(got, buf.Bytes()) 26 | got.AccountMetaSlice = nil 27 | ag_require.NoError(t, err) 28 | ag_require.Equal(t, params, got) 29 | } 30 | }) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /generated/pump/SetParams.go: -------------------------------------------------------------------------------- 1 | // Code generated by https://github.com/gagliardetto/anchor-go. DO NOT EDIT. 2 | 3 | package pump 4 | 5 | import ( 6 | "errors" 7 | ag_binary "github.com/gagliardetto/binary" 8 | ag_solanago "github.com/gagliardetto/solana-go" 9 | ag_format "github.com/gagliardetto/solana-go/text/format" 10 | ag_treeout "github.com/gagliardetto/treeout" 11 | ) 12 | 13 | // Sets the global state parameters. 14 | type SetParams struct { 15 | FeeRecipient *ag_solanago.PublicKey 16 | InitialVirtualTokenReserves *uint64 17 | InitialVirtualSolReserves *uint64 18 | InitialRealTokenReserves *uint64 19 | TokenTotalSupply *uint64 20 | FeeBasisPoints *uint64 21 | 22 | // [0] = [WRITE] global 23 | // 24 | // [1] = [WRITE, SIGNER] user 25 | // 26 | // [2] = [] systemProgram 27 | // 28 | // [3] = [] eventAuthority 29 | // 30 | // [4] = [] program 31 | ag_solanago.AccountMetaSlice `bin:"-"` 32 | } 33 | 34 | // NewSetParamsInstructionBuilder creates a new `SetParams` instruction builder. 35 | func NewSetParamsInstructionBuilder() *SetParams { 36 | nd := &SetParams{ 37 | AccountMetaSlice: make(ag_solanago.AccountMetaSlice, 5), 38 | } 39 | return nd 40 | } 41 | 42 | // SetFeeRecipient sets the "feeRecipient" parameter. 43 | func (inst *SetParams) SetFeeRecipient(feeRecipient ag_solanago.PublicKey) *SetParams { 44 | inst.FeeRecipient = &feeRecipient 45 | return inst 46 | } 47 | 48 | // SetInitialVirtualTokenReserves sets the "initialVirtualTokenReserves" parameter. 49 | func (inst *SetParams) SetInitialVirtualTokenReserves(initialVirtualTokenReserves uint64) *SetParams { 50 | inst.InitialVirtualTokenReserves = &initialVirtualTokenReserves 51 | return inst 52 | } 53 | 54 | // SetInitialVirtualSolReserves sets the "initialVirtualSolReserves" parameter. 55 | func (inst *SetParams) SetInitialVirtualSolReserves(initialVirtualSolReserves uint64) *SetParams { 56 | inst.InitialVirtualSolReserves = &initialVirtualSolReserves 57 | return inst 58 | } 59 | 60 | // SetInitialRealTokenReserves sets the "initialRealTokenReserves" parameter. 61 | func (inst *SetParams) SetInitialRealTokenReserves(initialRealTokenReserves uint64) *SetParams { 62 | inst.InitialRealTokenReserves = &initialRealTokenReserves 63 | return inst 64 | } 65 | 66 | // SetTokenTotalSupply sets the "tokenTotalSupply" parameter. 67 | func (inst *SetParams) SetTokenTotalSupply(tokenTotalSupply uint64) *SetParams { 68 | inst.TokenTotalSupply = &tokenTotalSupply 69 | return inst 70 | } 71 | 72 | // SetFeeBasisPoints sets the "feeBasisPoints" parameter. 73 | func (inst *SetParams) SetFeeBasisPoints(feeBasisPoints uint64) *SetParams { 74 | inst.FeeBasisPoints = &feeBasisPoints 75 | return inst 76 | } 77 | 78 | // SetGlobalAccount sets the "global" account. 79 | func (inst *SetParams) SetGlobalAccount(global ag_solanago.PublicKey) *SetParams { 80 | inst.AccountMetaSlice[0] = ag_solanago.Meta(global).WRITE() 81 | return inst 82 | } 83 | 84 | // GetGlobalAccount gets the "global" account. 85 | func (inst *SetParams) GetGlobalAccount() *ag_solanago.AccountMeta { 86 | return inst.AccountMetaSlice.Get(0) 87 | } 88 | 89 | // SetUserAccount sets the "user" account. 90 | func (inst *SetParams) SetUserAccount(user ag_solanago.PublicKey) *SetParams { 91 | inst.AccountMetaSlice[1] = ag_solanago.Meta(user).WRITE().SIGNER() 92 | return inst 93 | } 94 | 95 | // GetUserAccount gets the "user" account. 96 | func (inst *SetParams) GetUserAccount() *ag_solanago.AccountMeta { 97 | return inst.AccountMetaSlice.Get(1) 98 | } 99 | 100 | // SetSystemProgramAccount sets the "systemProgram" account. 101 | func (inst *SetParams) SetSystemProgramAccount(systemProgram ag_solanago.PublicKey) *SetParams { 102 | inst.AccountMetaSlice[2] = ag_solanago.Meta(systemProgram) 103 | return inst 104 | } 105 | 106 | // GetSystemProgramAccount gets the "systemProgram" account. 107 | func (inst *SetParams) GetSystemProgramAccount() *ag_solanago.AccountMeta { 108 | return inst.AccountMetaSlice.Get(2) 109 | } 110 | 111 | // SetEventAuthorityAccount sets the "eventAuthority" account. 112 | func (inst *SetParams) SetEventAuthorityAccount(eventAuthority ag_solanago.PublicKey) *SetParams { 113 | inst.AccountMetaSlice[3] = ag_solanago.Meta(eventAuthority) 114 | return inst 115 | } 116 | 117 | // GetEventAuthorityAccount gets the "eventAuthority" account. 118 | func (inst *SetParams) GetEventAuthorityAccount() *ag_solanago.AccountMeta { 119 | return inst.AccountMetaSlice.Get(3) 120 | } 121 | 122 | // SetProgramAccount sets the "program" account. 123 | func (inst *SetParams) SetProgramAccount(program ag_solanago.PublicKey) *SetParams { 124 | inst.AccountMetaSlice[4] = ag_solanago.Meta(program) 125 | return inst 126 | } 127 | 128 | // GetProgramAccount gets the "program" account. 129 | func (inst *SetParams) GetProgramAccount() *ag_solanago.AccountMeta { 130 | return inst.AccountMetaSlice.Get(4) 131 | } 132 | 133 | func (inst SetParams) Build() *Instruction { 134 | return &Instruction{BaseVariant: ag_binary.BaseVariant{ 135 | Impl: inst, 136 | TypeID: Instruction_SetParams, 137 | }} 138 | } 139 | 140 | // ValidateAndBuild validates the instruction parameters and accounts; 141 | // if there is a validation error, it returns the error. 142 | // Otherwise, it builds and returns the instruction. 143 | func (inst SetParams) ValidateAndBuild() (*Instruction, error) { 144 | if err := inst.Validate(); err != nil { 145 | return nil, err 146 | } 147 | return inst.Build(), nil 148 | } 149 | 150 | func (inst *SetParams) Validate() error { 151 | // Check whether all (required) parameters are set: 152 | { 153 | if inst.FeeRecipient == nil { 154 | return errors.New("FeeRecipient parameter is not set") 155 | } 156 | if inst.InitialVirtualTokenReserves == nil { 157 | return errors.New("InitialVirtualTokenReserves parameter is not set") 158 | } 159 | if inst.InitialVirtualSolReserves == nil { 160 | return errors.New("InitialVirtualSolReserves parameter is not set") 161 | } 162 | if inst.InitialRealTokenReserves == nil { 163 | return errors.New("InitialRealTokenReserves parameter is not set") 164 | } 165 | if inst.TokenTotalSupply == nil { 166 | return errors.New("TokenTotalSupply parameter is not set") 167 | } 168 | if inst.FeeBasisPoints == nil { 169 | return errors.New("FeeBasisPoints parameter is not set") 170 | } 171 | } 172 | 173 | // Check whether all (required) accounts are set: 174 | { 175 | if inst.AccountMetaSlice[0] == nil { 176 | return errors.New("accounts.Global is not set") 177 | } 178 | if inst.AccountMetaSlice[1] == nil { 179 | return errors.New("accounts.User is not set") 180 | } 181 | if inst.AccountMetaSlice[2] == nil { 182 | return errors.New("accounts.SystemProgram is not set") 183 | } 184 | if inst.AccountMetaSlice[3] == nil { 185 | return errors.New("accounts.EventAuthority is not set") 186 | } 187 | if inst.AccountMetaSlice[4] == nil { 188 | return errors.New("accounts.Program is not set") 189 | } 190 | } 191 | return nil 192 | } 193 | 194 | func (inst *SetParams) EncodeToTree(parent ag_treeout.Branches) { 195 | parent.Child(ag_format.Program(ProgramName, ProgramID)). 196 | // 197 | ParentFunc(func(programBranch ag_treeout.Branches) { 198 | programBranch.Child(ag_format.Instruction("SetParams")). 199 | // 200 | ParentFunc(func(instructionBranch ag_treeout.Branches) { 201 | 202 | // Parameters of the instruction: 203 | instructionBranch.Child("Params[len=6]").ParentFunc(func(paramsBranch ag_treeout.Branches) { 204 | paramsBranch.Child(ag_format.Param(" FeeRecipient", *inst.FeeRecipient)) 205 | paramsBranch.Child(ag_format.Param("InitialVirtualTokenReserves", *inst.InitialVirtualTokenReserves)) 206 | paramsBranch.Child(ag_format.Param(" InitialVirtualSolReserves", *inst.InitialVirtualSolReserves)) 207 | paramsBranch.Child(ag_format.Param(" InitialRealTokenReserves", *inst.InitialRealTokenReserves)) 208 | paramsBranch.Child(ag_format.Param(" TokenTotalSupply", *inst.TokenTotalSupply)) 209 | paramsBranch.Child(ag_format.Param(" FeeBasisPoints", *inst.FeeBasisPoints)) 210 | }) 211 | 212 | // Accounts of the instruction: 213 | instructionBranch.Child("Accounts[len=5]").ParentFunc(func(accountsBranch ag_treeout.Branches) { 214 | accountsBranch.Child(ag_format.Meta(" global", inst.AccountMetaSlice.Get(0))) 215 | accountsBranch.Child(ag_format.Meta(" user", inst.AccountMetaSlice.Get(1))) 216 | accountsBranch.Child(ag_format.Meta(" systemProgram", inst.AccountMetaSlice.Get(2))) 217 | accountsBranch.Child(ag_format.Meta("eventAuthority", inst.AccountMetaSlice.Get(3))) 218 | accountsBranch.Child(ag_format.Meta(" program", inst.AccountMetaSlice.Get(4))) 219 | }) 220 | }) 221 | }) 222 | } 223 | 224 | func (obj SetParams) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error) { 225 | // Serialize `FeeRecipient` param: 226 | err = encoder.Encode(obj.FeeRecipient) 227 | if err != nil { 228 | return err 229 | } 230 | // Serialize `InitialVirtualTokenReserves` param: 231 | err = encoder.Encode(obj.InitialVirtualTokenReserves) 232 | if err != nil { 233 | return err 234 | } 235 | // Serialize `InitialVirtualSolReserves` param: 236 | err = encoder.Encode(obj.InitialVirtualSolReserves) 237 | if err != nil { 238 | return err 239 | } 240 | // Serialize `InitialRealTokenReserves` param: 241 | err = encoder.Encode(obj.InitialRealTokenReserves) 242 | if err != nil { 243 | return err 244 | } 245 | // Serialize `TokenTotalSupply` param: 246 | err = encoder.Encode(obj.TokenTotalSupply) 247 | if err != nil { 248 | return err 249 | } 250 | // Serialize `FeeBasisPoints` param: 251 | err = encoder.Encode(obj.FeeBasisPoints) 252 | if err != nil { 253 | return err 254 | } 255 | return nil 256 | } 257 | func (obj *SetParams) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error) { 258 | // Deserialize `FeeRecipient`: 259 | err = decoder.Decode(&obj.FeeRecipient) 260 | if err != nil { 261 | return err 262 | } 263 | // Deserialize `InitialVirtualTokenReserves`: 264 | err = decoder.Decode(&obj.InitialVirtualTokenReserves) 265 | if err != nil { 266 | return err 267 | } 268 | // Deserialize `InitialVirtualSolReserves`: 269 | err = decoder.Decode(&obj.InitialVirtualSolReserves) 270 | if err != nil { 271 | return err 272 | } 273 | // Deserialize `InitialRealTokenReserves`: 274 | err = decoder.Decode(&obj.InitialRealTokenReserves) 275 | if err != nil { 276 | return err 277 | } 278 | // Deserialize `TokenTotalSupply`: 279 | err = decoder.Decode(&obj.TokenTotalSupply) 280 | if err != nil { 281 | return err 282 | } 283 | // Deserialize `FeeBasisPoints`: 284 | err = decoder.Decode(&obj.FeeBasisPoints) 285 | if err != nil { 286 | return err 287 | } 288 | return nil 289 | } 290 | 291 | // NewSetParamsInstruction declares a new SetParams instruction with the provided parameters and accounts. 292 | func NewSetParamsInstruction( 293 | // Parameters: 294 | feeRecipient ag_solanago.PublicKey, 295 | initialVirtualTokenReserves uint64, 296 | initialVirtualSolReserves uint64, 297 | initialRealTokenReserves uint64, 298 | tokenTotalSupply uint64, 299 | feeBasisPoints uint64, 300 | // Accounts: 301 | global ag_solanago.PublicKey, 302 | user ag_solanago.PublicKey, 303 | systemProgram ag_solanago.PublicKey, 304 | eventAuthority ag_solanago.PublicKey, 305 | program ag_solanago.PublicKey) *SetParams { 306 | return NewSetParamsInstructionBuilder(). 307 | SetFeeRecipient(feeRecipient). 308 | SetInitialVirtualTokenReserves(initialVirtualTokenReserves). 309 | SetInitialVirtualSolReserves(initialVirtualSolReserves). 310 | SetInitialRealTokenReserves(initialRealTokenReserves). 311 | SetTokenTotalSupply(tokenTotalSupply). 312 | SetFeeBasisPoints(feeBasisPoints). 313 | SetGlobalAccount(global). 314 | SetUserAccount(user). 315 | SetSystemProgramAccount(systemProgram). 316 | SetEventAuthorityAccount(eventAuthority). 317 | SetProgramAccount(program) 318 | } 319 | -------------------------------------------------------------------------------- /generated/pump/SetParams_test.go: -------------------------------------------------------------------------------- 1 | // Code generated by https://github.com/gagliardetto/anchor-go. DO NOT EDIT. 2 | 3 | package pump 4 | 5 | import ( 6 | "bytes" 7 | ag_gofuzz "github.com/gagliardetto/gofuzz" 8 | ag_require "github.com/stretchr/testify/require" 9 | "strconv" 10 | "testing" 11 | ) 12 | 13 | func TestEncodeDecode_SetParams(t *testing.T) { 14 | fu := ag_gofuzz.New().NilChance(0) 15 | for i := 0; i < 1; i++ { 16 | t.Run("SetParams"+strconv.Itoa(i), func(t *testing.T) { 17 | { 18 | params := new(SetParams) 19 | fu.Fuzz(params) 20 | params.AccountMetaSlice = nil 21 | buf := new(bytes.Buffer) 22 | err := encodeT(*params, buf) 23 | ag_require.NoError(t, err) 24 | got := new(SetParams) 25 | err = decodeT(got, buf.Bytes()) 26 | got.AccountMetaSlice = nil 27 | ag_require.NoError(t, err) 28 | ag_require.Equal(t, params, got) 29 | } 30 | }) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /generated/pump/Withdraw.go: -------------------------------------------------------------------------------- 1 | // Code generated by https://github.com/gagliardetto/anchor-go. DO NOT EDIT. 2 | 3 | package pump 4 | 5 | import ( 6 | "errors" 7 | ag_binary "github.com/gagliardetto/binary" 8 | ag_solanago "github.com/gagliardetto/solana-go" 9 | ag_format "github.com/gagliardetto/solana-go/text/format" 10 | ag_treeout "github.com/gagliardetto/treeout" 11 | ) 12 | 13 | // Allows the admin to withdraw liquidity for a migration once the bonding curve completes 14 | type Withdraw struct { 15 | 16 | // [0] = [] global 17 | // 18 | // [1] = [] mint 19 | // 20 | // [2] = [WRITE] bondingCurve 21 | // 22 | // [3] = [WRITE] associatedBondingCurve 23 | // 24 | // [4] = [WRITE] associatedUser 25 | // 26 | // [5] = [WRITE, SIGNER] user 27 | // 28 | // [6] = [] systemProgram 29 | // 30 | // [7] = [] tokenProgram 31 | // 32 | // [8] = [] rent 33 | // 34 | // [9] = [] eventAuthority 35 | // 36 | // [10] = [] program 37 | ag_solanago.AccountMetaSlice `bin:"-"` 38 | } 39 | 40 | // NewWithdrawInstructionBuilder creates a new `Withdraw` instruction builder. 41 | func NewWithdrawInstructionBuilder() *Withdraw { 42 | nd := &Withdraw{ 43 | AccountMetaSlice: make(ag_solanago.AccountMetaSlice, 11), 44 | } 45 | return nd 46 | } 47 | 48 | // SetGlobalAccount sets the "global" account. 49 | func (inst *Withdraw) SetGlobalAccount(global ag_solanago.PublicKey) *Withdraw { 50 | inst.AccountMetaSlice[0] = ag_solanago.Meta(global) 51 | return inst 52 | } 53 | 54 | // GetGlobalAccount gets the "global" account. 55 | func (inst *Withdraw) GetGlobalAccount() *ag_solanago.AccountMeta { 56 | return inst.AccountMetaSlice.Get(0) 57 | } 58 | 59 | // SetMintAccount sets the "mint" account. 60 | func (inst *Withdraw) SetMintAccount(mint ag_solanago.PublicKey) *Withdraw { 61 | inst.AccountMetaSlice[1] = ag_solanago.Meta(mint) 62 | return inst 63 | } 64 | 65 | // GetMintAccount gets the "mint" account. 66 | func (inst *Withdraw) GetMintAccount() *ag_solanago.AccountMeta { 67 | return inst.AccountMetaSlice.Get(1) 68 | } 69 | 70 | // SetBondingCurveAccount sets the "bondingCurve" account. 71 | func (inst *Withdraw) SetBondingCurveAccount(bondingCurve ag_solanago.PublicKey) *Withdraw { 72 | inst.AccountMetaSlice[2] = ag_solanago.Meta(bondingCurve).WRITE() 73 | return inst 74 | } 75 | 76 | // GetBondingCurveAccount gets the "bondingCurve" account. 77 | func (inst *Withdraw) GetBondingCurveAccount() *ag_solanago.AccountMeta { 78 | return inst.AccountMetaSlice.Get(2) 79 | } 80 | 81 | // SetAssociatedBondingCurveAccount sets the "associatedBondingCurve" account. 82 | func (inst *Withdraw) SetAssociatedBondingCurveAccount(associatedBondingCurve ag_solanago.PublicKey) *Withdraw { 83 | inst.AccountMetaSlice[3] = ag_solanago.Meta(associatedBondingCurve).WRITE() 84 | return inst 85 | } 86 | 87 | // GetAssociatedBondingCurveAccount gets the "associatedBondingCurve" account. 88 | func (inst *Withdraw) GetAssociatedBondingCurveAccount() *ag_solanago.AccountMeta { 89 | return inst.AccountMetaSlice.Get(3) 90 | } 91 | 92 | // SetAssociatedUserAccount sets the "associatedUser" account. 93 | func (inst *Withdraw) SetAssociatedUserAccount(associatedUser ag_solanago.PublicKey) *Withdraw { 94 | inst.AccountMetaSlice[4] = ag_solanago.Meta(associatedUser).WRITE() 95 | return inst 96 | } 97 | 98 | // GetAssociatedUserAccount gets the "associatedUser" account. 99 | func (inst *Withdraw) GetAssociatedUserAccount() *ag_solanago.AccountMeta { 100 | return inst.AccountMetaSlice.Get(4) 101 | } 102 | 103 | // SetUserAccount sets the "user" account. 104 | func (inst *Withdraw) SetUserAccount(user ag_solanago.PublicKey) *Withdraw { 105 | inst.AccountMetaSlice[5] = ag_solanago.Meta(user).WRITE().SIGNER() 106 | return inst 107 | } 108 | 109 | // GetUserAccount gets the "user" account. 110 | func (inst *Withdraw) GetUserAccount() *ag_solanago.AccountMeta { 111 | return inst.AccountMetaSlice.Get(5) 112 | } 113 | 114 | // SetSystemProgramAccount sets the "systemProgram" account. 115 | func (inst *Withdraw) SetSystemProgramAccount(systemProgram ag_solanago.PublicKey) *Withdraw { 116 | inst.AccountMetaSlice[6] = ag_solanago.Meta(systemProgram) 117 | return inst 118 | } 119 | 120 | // GetSystemProgramAccount gets the "systemProgram" account. 121 | func (inst *Withdraw) GetSystemProgramAccount() *ag_solanago.AccountMeta { 122 | return inst.AccountMetaSlice.Get(6) 123 | } 124 | 125 | // SetTokenProgramAccount sets the "tokenProgram" account. 126 | func (inst *Withdraw) SetTokenProgramAccount(tokenProgram ag_solanago.PublicKey) *Withdraw { 127 | inst.AccountMetaSlice[7] = ag_solanago.Meta(tokenProgram) 128 | return inst 129 | } 130 | 131 | // GetTokenProgramAccount gets the "tokenProgram" account. 132 | func (inst *Withdraw) GetTokenProgramAccount() *ag_solanago.AccountMeta { 133 | return inst.AccountMetaSlice.Get(7) 134 | } 135 | 136 | // SetRentAccount sets the "rent" account. 137 | func (inst *Withdraw) SetRentAccount(rent ag_solanago.PublicKey) *Withdraw { 138 | inst.AccountMetaSlice[8] = ag_solanago.Meta(rent) 139 | return inst 140 | } 141 | 142 | // GetRentAccount gets the "rent" account. 143 | func (inst *Withdraw) GetRentAccount() *ag_solanago.AccountMeta { 144 | return inst.AccountMetaSlice.Get(8) 145 | } 146 | 147 | // SetEventAuthorityAccount sets the "eventAuthority" account. 148 | func (inst *Withdraw) SetEventAuthorityAccount(eventAuthority ag_solanago.PublicKey) *Withdraw { 149 | inst.AccountMetaSlice[9] = ag_solanago.Meta(eventAuthority) 150 | return inst 151 | } 152 | 153 | // GetEventAuthorityAccount gets the "eventAuthority" account. 154 | func (inst *Withdraw) GetEventAuthorityAccount() *ag_solanago.AccountMeta { 155 | return inst.AccountMetaSlice.Get(9) 156 | } 157 | 158 | // SetProgramAccount sets the "program" account. 159 | func (inst *Withdraw) SetProgramAccount(program ag_solanago.PublicKey) *Withdraw { 160 | inst.AccountMetaSlice[10] = ag_solanago.Meta(program) 161 | return inst 162 | } 163 | 164 | // GetProgramAccount gets the "program" account. 165 | func (inst *Withdraw) GetProgramAccount() *ag_solanago.AccountMeta { 166 | return inst.AccountMetaSlice.Get(10) 167 | } 168 | 169 | func (inst Withdraw) Build() *Instruction { 170 | return &Instruction{BaseVariant: ag_binary.BaseVariant{ 171 | Impl: inst, 172 | TypeID: Instruction_Withdraw, 173 | }} 174 | } 175 | 176 | // ValidateAndBuild validates the instruction parameters and accounts; 177 | // if there is a validation error, it returns the error. 178 | // Otherwise, it builds and returns the instruction. 179 | func (inst Withdraw) ValidateAndBuild() (*Instruction, error) { 180 | if err := inst.Validate(); err != nil { 181 | return nil, err 182 | } 183 | return inst.Build(), nil 184 | } 185 | 186 | func (inst *Withdraw) Validate() error { 187 | // Check whether all (required) accounts are set: 188 | { 189 | if inst.AccountMetaSlice[0] == nil { 190 | return errors.New("accounts.Global is not set") 191 | } 192 | if inst.AccountMetaSlice[1] == nil { 193 | return errors.New("accounts.Mint is not set") 194 | } 195 | if inst.AccountMetaSlice[2] == nil { 196 | return errors.New("accounts.BondingCurve is not set") 197 | } 198 | if inst.AccountMetaSlice[3] == nil { 199 | return errors.New("accounts.AssociatedBondingCurve is not set") 200 | } 201 | if inst.AccountMetaSlice[4] == nil { 202 | return errors.New("accounts.AssociatedUser is not set") 203 | } 204 | if inst.AccountMetaSlice[5] == nil { 205 | return errors.New("accounts.User is not set") 206 | } 207 | if inst.AccountMetaSlice[6] == nil { 208 | return errors.New("accounts.SystemProgram is not set") 209 | } 210 | if inst.AccountMetaSlice[7] == nil { 211 | return errors.New("accounts.TokenProgram is not set") 212 | } 213 | if inst.AccountMetaSlice[8] == nil { 214 | return errors.New("accounts.Rent is not set") 215 | } 216 | if inst.AccountMetaSlice[9] == nil { 217 | return errors.New("accounts.EventAuthority is not set") 218 | } 219 | if inst.AccountMetaSlice[10] == nil { 220 | return errors.New("accounts.Program is not set") 221 | } 222 | } 223 | return nil 224 | } 225 | 226 | func (inst *Withdraw) EncodeToTree(parent ag_treeout.Branches) { 227 | parent.Child(ag_format.Program(ProgramName, ProgramID)). 228 | // 229 | ParentFunc(func(programBranch ag_treeout.Branches) { 230 | programBranch.Child(ag_format.Instruction("Withdraw")). 231 | // 232 | ParentFunc(func(instructionBranch ag_treeout.Branches) { 233 | 234 | // Parameters of the instruction: 235 | instructionBranch.Child("Params[len=0]").ParentFunc(func(paramsBranch ag_treeout.Branches) {}) 236 | 237 | // Accounts of the instruction: 238 | instructionBranch.Child("Accounts[len=11]").ParentFunc(func(accountsBranch ag_treeout.Branches) { 239 | accountsBranch.Child(ag_format.Meta(" global", inst.AccountMetaSlice.Get(0))) 240 | accountsBranch.Child(ag_format.Meta(" mint", inst.AccountMetaSlice.Get(1))) 241 | accountsBranch.Child(ag_format.Meta(" bondingCurve", inst.AccountMetaSlice.Get(2))) 242 | accountsBranch.Child(ag_format.Meta("associatedBondingCurve", inst.AccountMetaSlice.Get(3))) 243 | accountsBranch.Child(ag_format.Meta(" associatedUser", inst.AccountMetaSlice.Get(4))) 244 | accountsBranch.Child(ag_format.Meta(" user", inst.AccountMetaSlice.Get(5))) 245 | accountsBranch.Child(ag_format.Meta(" systemProgram", inst.AccountMetaSlice.Get(6))) 246 | accountsBranch.Child(ag_format.Meta(" tokenProgram", inst.AccountMetaSlice.Get(7))) 247 | accountsBranch.Child(ag_format.Meta(" rent", inst.AccountMetaSlice.Get(8))) 248 | accountsBranch.Child(ag_format.Meta(" eventAuthority", inst.AccountMetaSlice.Get(9))) 249 | accountsBranch.Child(ag_format.Meta(" program", inst.AccountMetaSlice.Get(10))) 250 | }) 251 | }) 252 | }) 253 | } 254 | 255 | func (obj Withdraw) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error) { 256 | return nil 257 | } 258 | func (obj *Withdraw) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error) { 259 | return nil 260 | } 261 | 262 | // NewWithdrawInstruction declares a new Withdraw instruction with the provided parameters and accounts. 263 | func NewWithdrawInstruction( 264 | // Accounts: 265 | global ag_solanago.PublicKey, 266 | mint ag_solanago.PublicKey, 267 | bondingCurve ag_solanago.PublicKey, 268 | associatedBondingCurve ag_solanago.PublicKey, 269 | associatedUser ag_solanago.PublicKey, 270 | user ag_solanago.PublicKey, 271 | systemProgram ag_solanago.PublicKey, 272 | tokenProgram ag_solanago.PublicKey, 273 | rent ag_solanago.PublicKey, 274 | eventAuthority ag_solanago.PublicKey, 275 | program ag_solanago.PublicKey) *Withdraw { 276 | return NewWithdrawInstructionBuilder(). 277 | SetGlobalAccount(global). 278 | SetMintAccount(mint). 279 | SetBondingCurveAccount(bondingCurve). 280 | SetAssociatedBondingCurveAccount(associatedBondingCurve). 281 | SetAssociatedUserAccount(associatedUser). 282 | SetUserAccount(user). 283 | SetSystemProgramAccount(systemProgram). 284 | SetTokenProgramAccount(tokenProgram). 285 | SetRentAccount(rent). 286 | SetEventAuthorityAccount(eventAuthority). 287 | SetProgramAccount(program) 288 | } 289 | -------------------------------------------------------------------------------- /generated/pump/Withdraw_test.go: -------------------------------------------------------------------------------- 1 | // Code generated by https://github.com/gagliardetto/anchor-go. DO NOT EDIT. 2 | 3 | package pump 4 | 5 | import ( 6 | "bytes" 7 | ag_gofuzz "github.com/gagliardetto/gofuzz" 8 | ag_require "github.com/stretchr/testify/require" 9 | "strconv" 10 | "testing" 11 | ) 12 | 13 | func TestEncodeDecode_Withdraw(t *testing.T) { 14 | fu := ag_gofuzz.New().NilChance(0) 15 | for i := 0; i < 1; i++ { 16 | t.Run("Withdraw"+strconv.Itoa(i), func(t *testing.T) { 17 | { 18 | params := new(Withdraw) 19 | fu.Fuzz(params) 20 | params.AccountMetaSlice = nil 21 | buf := new(bytes.Buffer) 22 | err := encodeT(*params, buf) 23 | ag_require.NoError(t, err) 24 | got := new(Withdraw) 25 | err = decodeT(got, buf.Bytes()) 26 | got.AccountMetaSlice = nil 27 | ag_require.NoError(t, err) 28 | ag_require.Equal(t, params, got) 29 | } 30 | }) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /generated/pump/accounts.go: -------------------------------------------------------------------------------- 1 | // Code generated by https://github.com/gagliardetto/anchor-go. DO NOT EDIT. 2 | 3 | package pump 4 | 5 | import ( 6 | "fmt" 7 | ag_binary "github.com/gagliardetto/binary" 8 | ag_solanago "github.com/gagliardetto/solana-go" 9 | ) 10 | 11 | type Global struct { 12 | Initialized bool 13 | Authority ag_solanago.PublicKey 14 | FeeRecipient ag_solanago.PublicKey 15 | InitialVirtualTokenReserves uint64 16 | InitialVirtualSolReserves uint64 17 | InitialRealTokenReserves uint64 18 | TokenTotalSupply uint64 19 | FeeBasisPoints uint64 20 | } 21 | 22 | var GlobalDiscriminator = [8]byte{167, 232, 232, 177, 200, 108, 114, 127} 23 | 24 | func (obj Global) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error) { 25 | // Write account discriminator: 26 | err = encoder.WriteBytes(GlobalDiscriminator[:], false) 27 | if err != nil { 28 | return err 29 | } 30 | // Serialize `Initialized` param: 31 | err = encoder.Encode(obj.Initialized) 32 | if err != nil { 33 | return err 34 | } 35 | // Serialize `Authority` param: 36 | err = encoder.Encode(obj.Authority) 37 | if err != nil { 38 | return err 39 | } 40 | // Serialize `FeeRecipient` param: 41 | err = encoder.Encode(obj.FeeRecipient) 42 | if err != nil { 43 | return err 44 | } 45 | // Serialize `InitialVirtualTokenReserves` param: 46 | err = encoder.Encode(obj.InitialVirtualTokenReserves) 47 | if err != nil { 48 | return err 49 | } 50 | // Serialize `InitialVirtualSolReserves` param: 51 | err = encoder.Encode(obj.InitialVirtualSolReserves) 52 | if err != nil { 53 | return err 54 | } 55 | // Serialize `InitialRealTokenReserves` param: 56 | err = encoder.Encode(obj.InitialRealTokenReserves) 57 | if err != nil { 58 | return err 59 | } 60 | // Serialize `TokenTotalSupply` param: 61 | err = encoder.Encode(obj.TokenTotalSupply) 62 | if err != nil { 63 | return err 64 | } 65 | // Serialize `FeeBasisPoints` param: 66 | err = encoder.Encode(obj.FeeBasisPoints) 67 | if err != nil { 68 | return err 69 | } 70 | return nil 71 | } 72 | 73 | func (obj *Global) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error) { 74 | // Read and check account discriminator: 75 | { 76 | discriminator, err := decoder.ReadTypeID() 77 | if err != nil { 78 | return err 79 | } 80 | if !discriminator.Equal(GlobalDiscriminator[:]) { 81 | return fmt.Errorf( 82 | "wrong discriminator: wanted %s, got %s", 83 | "[167 232 232 177 200 108 114 127]", 84 | fmt.Sprint(discriminator[:])) 85 | } 86 | } 87 | // Deserialize `Initialized`: 88 | err = decoder.Decode(&obj.Initialized) 89 | if err != nil { 90 | return err 91 | } 92 | // Deserialize `Authority`: 93 | err = decoder.Decode(&obj.Authority) 94 | if err != nil { 95 | return err 96 | } 97 | // Deserialize `FeeRecipient`: 98 | err = decoder.Decode(&obj.FeeRecipient) 99 | if err != nil { 100 | return err 101 | } 102 | // Deserialize `InitialVirtualTokenReserves`: 103 | err = decoder.Decode(&obj.InitialVirtualTokenReserves) 104 | if err != nil { 105 | return err 106 | } 107 | // Deserialize `InitialVirtualSolReserves`: 108 | err = decoder.Decode(&obj.InitialVirtualSolReserves) 109 | if err != nil { 110 | return err 111 | } 112 | // Deserialize `InitialRealTokenReserves`: 113 | err = decoder.Decode(&obj.InitialRealTokenReserves) 114 | if err != nil { 115 | return err 116 | } 117 | // Deserialize `TokenTotalSupply`: 118 | err = decoder.Decode(&obj.TokenTotalSupply) 119 | if err != nil { 120 | return err 121 | } 122 | // Deserialize `FeeBasisPoints`: 123 | err = decoder.Decode(&obj.FeeBasisPoints) 124 | if err != nil { 125 | return err 126 | } 127 | return nil 128 | } 129 | 130 | type BondingCurve struct { 131 | VirtualTokenReserves uint64 132 | VirtualSolReserves uint64 133 | RealTokenReserves uint64 134 | RealSolReserves uint64 135 | TokenTotalSupply uint64 136 | Complete bool 137 | } 138 | 139 | var BondingCurveDiscriminator = [8]byte{23, 183, 248, 55, 96, 216, 172, 96} 140 | 141 | func (obj BondingCurve) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error) { 142 | // Write account discriminator: 143 | err = encoder.WriteBytes(BondingCurveDiscriminator[:], false) 144 | if err != nil { 145 | return err 146 | } 147 | // Serialize `VirtualTokenReserves` param: 148 | err = encoder.Encode(obj.VirtualTokenReserves) 149 | if err != nil { 150 | return err 151 | } 152 | // Serialize `VirtualSolReserves` param: 153 | err = encoder.Encode(obj.VirtualSolReserves) 154 | if err != nil { 155 | return err 156 | } 157 | // Serialize `RealTokenReserves` param: 158 | err = encoder.Encode(obj.RealTokenReserves) 159 | if err != nil { 160 | return err 161 | } 162 | // Serialize `RealSolReserves` param: 163 | err = encoder.Encode(obj.RealSolReserves) 164 | if err != nil { 165 | return err 166 | } 167 | // Serialize `TokenTotalSupply` param: 168 | err = encoder.Encode(obj.TokenTotalSupply) 169 | if err != nil { 170 | return err 171 | } 172 | // Serialize `Complete` param: 173 | err = encoder.Encode(obj.Complete) 174 | if err != nil { 175 | return err 176 | } 177 | return nil 178 | } 179 | 180 | func (obj *BondingCurve) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error) { 181 | // Read and check account discriminator: 182 | { 183 | discriminator, err := decoder.ReadTypeID() 184 | if err != nil { 185 | return err 186 | } 187 | if !discriminator.Equal(BondingCurveDiscriminator[:]) { 188 | return fmt.Errorf( 189 | "wrong discriminator: wanted %s, got %s", 190 | "[23 183 248 55 96 216 172 96]", 191 | fmt.Sprint(discriminator[:])) 192 | } 193 | } 194 | // Deserialize `VirtualTokenReserves`: 195 | err = decoder.Decode(&obj.VirtualTokenReserves) 196 | if err != nil { 197 | return err 198 | } 199 | // Deserialize `VirtualSolReserves`: 200 | err = decoder.Decode(&obj.VirtualSolReserves) 201 | if err != nil { 202 | return err 203 | } 204 | // Deserialize `RealTokenReserves`: 205 | err = decoder.Decode(&obj.RealTokenReserves) 206 | if err != nil { 207 | return err 208 | } 209 | // Deserialize `RealSolReserves`: 210 | err = decoder.Decode(&obj.RealSolReserves) 211 | if err != nil { 212 | return err 213 | } 214 | // Deserialize `TokenTotalSupply`: 215 | err = decoder.Decode(&obj.TokenTotalSupply) 216 | if err != nil { 217 | return err 218 | } 219 | // Deserialize `Complete`: 220 | err = decoder.Decode(&obj.Complete) 221 | if err != nil { 222 | return err 223 | } 224 | return nil 225 | } 226 | -------------------------------------------------------------------------------- /generated/pump/instructions.go: -------------------------------------------------------------------------------- 1 | // Code generated by https://github.com/gagliardetto/anchor-go. DO NOT EDIT. 2 | 3 | package pump 4 | 5 | import ( 6 | "bytes" 7 | "fmt" 8 | ag_spew "github.com/davecgh/go-spew/spew" 9 | ag_binary "github.com/gagliardetto/binary" 10 | ag_solanago "github.com/gagliardetto/solana-go" 11 | ag_text "github.com/gagliardetto/solana-go/text" 12 | ag_treeout "github.com/gagliardetto/treeout" 13 | ) 14 | 15 | var ProgramID ag_solanago.PublicKey = ag_solanago.MustPublicKeyFromBase58("6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P") 16 | 17 | func SetProgramID(pubkey ag_solanago.PublicKey) { 18 | ProgramID = pubkey 19 | ag_solanago.RegisterInstructionDecoder(ProgramID, registryDecodeInstruction) 20 | } 21 | 22 | const ProgramName = "Pump" 23 | 24 | func init() { 25 | if !ProgramID.IsZero() { 26 | ag_solanago.RegisterInstructionDecoder(ProgramID, registryDecodeInstruction) 27 | } 28 | } 29 | 30 | var ( 31 | // Creates the global state. 32 | Instruction_Initialize = ag_binary.TypeID([8]byte{175, 175, 109, 31, 13, 152, 155, 237}) 33 | 34 | // Sets the global state parameters. 35 | Instruction_SetParams = ag_binary.TypeID([8]byte{27, 234, 178, 52, 147, 2, 187, 141}) 36 | 37 | // Creates a new coin and bonding curve. 38 | Instruction_Create = ag_binary.TypeID([8]byte{24, 30, 200, 40, 5, 28, 7, 119}) 39 | 40 | // Buys tokens from a bonding curve. 41 | Instruction_Buy = ag_binary.TypeID([8]byte{102, 6, 61, 18, 1, 218, 235, 234}) 42 | 43 | // Sells tokens into a bonding curve. 44 | Instruction_Sell = ag_binary.TypeID([8]byte{51, 230, 133, 164, 1, 127, 131, 173}) 45 | 46 | // Allows the admin to withdraw liquidity for a migration once the bonding curve completes 47 | Instruction_Withdraw = ag_binary.TypeID([8]byte{183, 18, 70, 156, 148, 109, 161, 34}) 48 | ) 49 | 50 | // InstructionIDToName returns the name of the instruction given its ID. 51 | func InstructionIDToName(id ag_binary.TypeID) string { 52 | switch id { 53 | case Instruction_Initialize: 54 | return "Initialize" 55 | case Instruction_SetParams: 56 | return "SetParams" 57 | case Instruction_Create: 58 | return "Create" 59 | case Instruction_Buy: 60 | return "Buy" 61 | case Instruction_Sell: 62 | return "Sell" 63 | case Instruction_Withdraw: 64 | return "Withdraw" 65 | default: 66 | return "" 67 | } 68 | } 69 | 70 | type Instruction struct { 71 | ag_binary.BaseVariant 72 | } 73 | 74 | func (inst *Instruction) EncodeToTree(parent ag_treeout.Branches) { 75 | if enToTree, ok := inst.Impl.(ag_text.EncodableToTree); ok { 76 | enToTree.EncodeToTree(parent) 77 | } else { 78 | parent.Child(ag_spew.Sdump(inst)) 79 | } 80 | } 81 | 82 | var InstructionImplDef = ag_binary.NewVariantDefinition( 83 | ag_binary.AnchorTypeIDEncoding, 84 | []ag_binary.VariantType{ 85 | { 86 | "initialize", (*Initialize)(nil), 87 | }, 88 | { 89 | "set_params", (*SetParams)(nil), 90 | }, 91 | { 92 | "create", (*Create)(nil), 93 | }, 94 | { 95 | "buy", (*Buy)(nil), 96 | }, 97 | { 98 | "sell", (*Sell)(nil), 99 | }, 100 | { 101 | "withdraw", (*Withdraw)(nil), 102 | }, 103 | }, 104 | ) 105 | 106 | func (inst *Instruction) ProgramID() ag_solanago.PublicKey { 107 | return ProgramID 108 | } 109 | 110 | func (inst *Instruction) Accounts() (out []*ag_solanago.AccountMeta) { 111 | return inst.Impl.(ag_solanago.AccountsGettable).GetAccounts() 112 | } 113 | 114 | func (inst *Instruction) Data() ([]byte, error) { 115 | buf := new(bytes.Buffer) 116 | if err := ag_binary.NewBorshEncoder(buf).Encode(inst); err != nil { 117 | return nil, fmt.Errorf("unable to encode instruction: %w", err) 118 | } 119 | return buf.Bytes(), nil 120 | } 121 | 122 | func (inst *Instruction) TextEncode(encoder *ag_text.Encoder, option *ag_text.Option) error { 123 | return encoder.Encode(inst.Impl, option) 124 | } 125 | 126 | func (inst *Instruction) UnmarshalWithDecoder(decoder *ag_binary.Decoder) error { 127 | return inst.BaseVariant.UnmarshalBinaryVariant(decoder, InstructionImplDef) 128 | } 129 | 130 | func (inst *Instruction) MarshalWithEncoder(encoder *ag_binary.Encoder) error { 131 | err := encoder.WriteBytes(inst.TypeID.Bytes(), false) 132 | if err != nil { 133 | return fmt.Errorf("unable to write variant type: %w", err) 134 | } 135 | return encoder.Encode(inst.Impl) 136 | } 137 | 138 | func registryDecodeInstruction(accounts []*ag_solanago.AccountMeta, data []byte) (interface{}, error) { 139 | inst, err := DecodeInstruction(accounts, data) 140 | if err != nil { 141 | return nil, err 142 | } 143 | return inst, nil 144 | } 145 | 146 | func DecodeInstruction(accounts []*ag_solanago.AccountMeta, data []byte) (*Instruction, error) { 147 | inst := new(Instruction) 148 | if err := ag_binary.NewBorshDecoder(data).Decode(inst); err != nil { 149 | return nil, fmt.Errorf("unable to decode instruction: %w", err) 150 | } 151 | if v, ok := inst.Impl.(ag_solanago.AccountsSettable); ok { 152 | err := v.SetAccounts(accounts) 153 | if err != nil { 154 | return nil, fmt.Errorf("unable to set accounts for instruction: %w", err) 155 | } 156 | } 157 | return inst, nil 158 | } 159 | -------------------------------------------------------------------------------- /generated/pump/testing_utils.go: -------------------------------------------------------------------------------- 1 | // Code generated by https://github.com/gagliardetto/anchor-go. DO NOT EDIT. 2 | 3 | package pump 4 | 5 | import ( 6 | "bytes" 7 | "fmt" 8 | ag_binary "github.com/gagliardetto/binary" 9 | ) 10 | 11 | func encodeT(data interface{}, buf *bytes.Buffer) error { 12 | if err := ag_binary.NewBorshEncoder(buf).Encode(data); err != nil { 13 | return fmt.Errorf("unable to encode instruction: %w", err) 14 | } 15 | return nil 16 | } 17 | 18 | func decodeT(dst interface{}, data []byte) error { 19 | return ag_binary.NewBorshDecoder(data).Decode(dst) 20 | } 21 | -------------------------------------------------------------------------------- /generated/pump/types.go: -------------------------------------------------------------------------------- 1 | // Code generated by https://github.com/gagliardetto/anchor-go. DO NOT EDIT. 2 | 3 | package pump 4 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/Computer217/SolanaBotV2 2 | 3 | go 1.22.2 4 | 5 | require ( 6 | github.com/gagliardetto/gofuzz v1.2.2 7 | github.com/gagliardetto/solana-go v1.11.0 8 | github.com/stretchr/testify v1.9.0 9 | ) 10 | 11 | require ( 12 | github.com/benbjohnson/clock v1.3.0 // indirect 13 | github.com/pmezard/go-difflib v1.0.0 // indirect 14 | github.com/streamingfast/logging v0.0.0-20230608130331-f22c91403091 // indirect 15 | gopkg.in/yaml.v3 v3.0.1 // indirect 16 | ) 17 | 18 | require ( 19 | filippo.io/edwards25519 v1.1.0 // indirect 20 | github.com/andres-erbsen/clock v0.0.0-20160526145045-9e14626cd129 // indirect 21 | github.com/avast/retry-go v3.0.0+incompatible 22 | github.com/blendle/zapdriver v1.3.1 // indirect 23 | github.com/buger/jsonparser v1.1.1 // indirect 24 | github.com/davecgh/go-spew v1.1.1 25 | github.com/fatih/color v1.17.0 // indirect 26 | github.com/gagliardetto/binary v0.8.0 27 | github.com/gagliardetto/treeout v0.1.4 28 | github.com/google/uuid v1.6.0 // indirect 29 | github.com/gorilla/rpc v1.2.1 // indirect 30 | github.com/gorilla/websocket v1.5.3 // indirect 31 | github.com/json-iterator/go v1.1.12 // indirect 32 | github.com/klauspost/compress v1.17.9 // indirect 33 | github.com/logrusorgru/aurora v2.0.3+incompatible // indirect 34 | github.com/mattn/go-colorable v0.1.13 // indirect 35 | github.com/mattn/go-isatty v0.0.20 // indirect 36 | github.com/mitchellh/go-testing-interface v1.14.1 // indirect 37 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect 38 | github.com/modern-go/reflect2 v1.0.2 // indirect 39 | github.com/mostynb/zstdpool-freelist v0.0.0-20201229113212-927304c0c3b1 // indirect 40 | github.com/mr-tron/base58 v1.2.0 // indirect 41 | go.mongodb.org/mongo-driver v1.16.1 // indirect 42 | go.uber.org/atomic v1.11.0 // indirect 43 | go.uber.org/multierr v1.11.0 // indirect 44 | go.uber.org/ratelimit v0.3.1 // indirect 45 | go.uber.org/zap v1.27.0 // indirect 46 | golang.org/x/crypto v0.27.0 // indirect 47 | golang.org/x/sys v0.25.0 // indirect 48 | golang.org/x/term v0.24.0 // indirect 49 | golang.org/x/time v0.6.0 // indirect 50 | ) 51 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | filippo.io/edwards25519 v1.0.0-rc.1 h1:m0VOOB23frXZvAOK44usCgLWvtsxIoMCTBGJZlpmGfU= 2 | filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= 3 | filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= 4 | filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= 5 | github.com/AlekSi/pointer v1.1.0 h1:SSDMPcXD9jSl8FPy9cRzoRaMJtm9g9ggGTxecRUbQoI= 6 | github.com/AlekSi/pointer v1.1.0/go.mod h1:y7BvfRI3wXPWKXEBhU71nbnIEEZX0QTSB2Bj48UJIZE= 7 | github.com/andres-erbsen/clock v0.0.0-20160526145045-9e14626cd129 h1:MzBOUgng9orim59UnfUTLRjMpd09C5uEVQ6RPGeCaVI= 8 | github.com/andres-erbsen/clock v0.0.0-20160526145045-9e14626cd129/go.mod h1:rFgpPQZYZ8vdbc+48xibu8ALc3yeyd64IhHS+PU6Yyg= 9 | github.com/avast/retry-go v3.0.0+incompatible h1:4SOWQ7Qs+oroOTQOYnAHqelpCO0biHSxpiH9JdtuBj0= 10 | github.com/avast/retry-go v3.0.0+incompatible/go.mod h1:XtSnn+n/sHqQIpZ10K1qAevBhOOCWBLXXy3hyiqqBrY= 11 | github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= 12 | github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= 13 | github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= 14 | github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= 15 | github.com/blendle/zapdriver v1.3.1 h1:C3dydBOWYRiOk+B8X9IVZ5IOe+7cl+tGOexN4QqHfpE= 16 | github.com/blendle/zapdriver v1.3.1/go.mod h1:mdXfREi6u5MArG4j9fewC+FGnXaBR+T4Ox4J2u4eHCc= 17 | github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs= 18 | github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= 19 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 20 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 21 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 22 | github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s= 23 | github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= 24 | github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= 25 | github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= 26 | github.com/gagliardetto/binary v0.8.0 h1:U9ahc45v9HW0d15LoN++vIXSJyqR/pWw8DDlhd7zvxg= 27 | github.com/gagliardetto/binary v0.8.0/go.mod h1:2tfj51g5o9dnvsc+fL3Jxr22MuWzYXwx9wEoN0XQ7/c= 28 | github.com/gagliardetto/gofuzz v1.2.2 h1:XL/8qDMzcgvR4+CyRQW9UGdwPRPMHVJfqQ/uMvSUuQw= 29 | github.com/gagliardetto/gofuzz v1.2.2/go.mod h1:bkH/3hYLZrMLbfYWA0pWzXmi5TTRZnu4pMGZBkqMKvY= 30 | github.com/gagliardetto/solana-go v1.10.0 h1:lDuHGC+XLxw9j8fCHBZM9tv4trI0PVhev1m9NAMaIdM= 31 | github.com/gagliardetto/solana-go v1.10.0/go.mod h1:afBEcIRrDLJst3lvAahTr63m6W2Ns6dajZxe2irF7Jg= 32 | github.com/gagliardetto/solana-go v1.11.0 h1:g6mR7uRNVT0Y0LVR0bvJNfKV6TyO6oUzBYu03ZmkEmY= 33 | github.com/gagliardetto/solana-go v1.11.0/go.mod h1:afBEcIRrDLJst3lvAahTr63m6W2Ns6dajZxe2irF7Jg= 34 | github.com/gagliardetto/treeout v0.1.4 h1:ozeYerrLCmCubo1TcIjFiOWTTGteOOHND1twdFpgwaw= 35 | github.com/gagliardetto/treeout v0.1.4/go.mod h1:loUefvXTrlRG5rYmJmExNryyBRh8f89VZhmMOyCyqok= 36 | github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= 37 | github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= 38 | github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 39 | github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= 40 | github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= 41 | github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 42 | github.com/gorilla/rpc v1.2.0 h1:WvvdC2lNeT1SP32zrIce5l0ECBfbAlmrmSBsuc57wfk= 43 | github.com/gorilla/rpc v1.2.0/go.mod h1:V4h9r+4sF5HnzqbwIez0fKSpANP0zlYd3qR7p36jkTQ= 44 | github.com/gorilla/rpc v1.2.1 h1:yC+LMV5esttgpVvNORL/xX4jvTTEUE30UZhZ5JF7K9k= 45 | github.com/gorilla/rpc v1.2.1/go.mod h1:uNpOihAlF5xRFLuTYhfR0yfCTm0WTQSQttkMSptRfGk= 46 | github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= 47 | github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= 48 | github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= 49 | github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= 50 | github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= 51 | github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= 52 | github.com/klauspost/compress v1.11.4/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= 53 | github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc= 54 | github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= 55 | github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= 56 | github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= 57 | github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= 58 | github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= 59 | github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= 60 | github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= 61 | github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= 62 | github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= 63 | github.com/logrusorgru/aurora v2.0.3+incompatible h1:tOpm7WcpBTn4fjmVfgpQq0EfczGlG91VSDkswnjF5A8= 64 | github.com/logrusorgru/aurora v2.0.3+incompatible/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= 65 | github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA= 66 | github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= 67 | github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= 68 | github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= 69 | github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= 70 | github.com/mattn/go-isatty v0.0.11 h1:FxPOTFNqGkuDUGi3H/qkUbQO4ZiBa2brKq5r0l8TGeM= 71 | github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= 72 | github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= 73 | github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= 74 | github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= 75 | github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= 76 | github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= 77 | github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= 78 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= 79 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= 80 | github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= 81 | github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= 82 | github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= 83 | github.com/mostynb/zstdpool-freelist v0.0.0-20201229113212-927304c0c3b1 h1:mPMvm6X6tf4w8y7j9YIt6V9jfWhL6QlbEc7CCmeQlWk= 84 | github.com/mostynb/zstdpool-freelist v0.0.0-20201229113212-927304c0c3b1/go.mod h1:ye2e/VUEtE2BHE+G/QcKkcLQVAEJoYRFj5VUOQatCRE= 85 | github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= 86 | github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= 87 | github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= 88 | github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= 89 | github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 90 | github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= 91 | github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 92 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 93 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 94 | github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= 95 | github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= 96 | github.com/streamingfast/logging v0.0.0-20230608130331-f22c91403091 h1:RN5mrigyirb8anBEtdjtHFIufXdacyTi6i4KBfeNXeo= 97 | github.com/streamingfast/logging v0.0.0-20230608130331-f22c91403091/go.mod h1:VlduQ80JcGJSargkRU4Sg9Xo63wZD/l8A5NC/Uo1/uU= 98 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 99 | github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= 100 | github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 101 | github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= 102 | github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 103 | github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= 104 | github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= 105 | github.com/test-go/testify v1.1.4 h1:Tf9lntrKUMHiXQ07qBScBTSA0dhYQlu83hswqelv1iE= 106 | github.com/test-go/testify v1.1.4/go.mod h1:rH7cfJo/47vWGdi4GPj16x3/t1xGOj2YxzmNQzk2ghU= 107 | github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= 108 | github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= 109 | github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= 110 | github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= 111 | github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g= 112 | github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8= 113 | github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= 114 | github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= 115 | go.mongodb.org/mongo-driver v1.11.0 h1:FZKhBSTydeuffHj9CBjXlR8vQLee1cQyTWYPA6/tqiE= 116 | go.mongodb.org/mongo-driver v1.11.0/go.mod h1:s7p5vEtfbeR1gYi6pnj3c3/urpbLv2T5Sfd6Rp2HBB8= 117 | go.mongodb.org/mongo-driver v1.16.1 h1:rIVLL3q0IHM39dvE+z2ulZLp9ENZKThVfuvN/IiN4l8= 118 | go.mongodb.org/mongo-driver v1.16.1/go.mod h1:oB6AhJQvFQL4LEHyXi6aJzQJtBiTQHiAd83l0GdFaiw= 119 | go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= 120 | go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= 121 | go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= 122 | go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= 123 | go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= 124 | go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= 125 | go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= 126 | go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= 127 | go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= 128 | go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= 129 | go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= 130 | go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= 131 | go.uber.org/ratelimit v0.2.0 h1:UQE2Bgi7p2B85uP5dC2bbRtig0C+OeNRnNEafLjsLPA= 132 | go.uber.org/ratelimit v0.2.0/go.mod h1:YYBV4e4naJvhpitQrWJu1vCpgB7CboMe0qhltKt6mUg= 133 | go.uber.org/ratelimit v0.3.1 h1:K4qVE+byfv/B3tC+4nYWP7v/6SimcO7HzHekoMNBma0= 134 | go.uber.org/ratelimit v0.3.1/go.mod h1:6euWsTB6U/Nb3X++xEUXA8ciPJvr19Q/0h1+oDcJhRk= 135 | go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= 136 | go.uber.org/zap v1.21.0 h1:WefMeulhovoZ2sYXz7st6K0sLj7bBhpiFaud4r4zST8= 137 | go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw= 138 | go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= 139 | go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= 140 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 141 | golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 142 | golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= 143 | golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d h1:sK3txAijHtOK88l68nt020reeT1ZdKLIYetKl95FzVY= 144 | golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= 145 | golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= 146 | golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= 147 | golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 148 | golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 149 | golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 150 | golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 151 | golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 152 | golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= 153 | golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 h1:CIJ76btIcR3eFI5EgSo6k1qKw9KJexJuRLI9G7Hp5wE= 154 | golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= 155 | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 156 | golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 157 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 158 | golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 159 | golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 160 | golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 161 | golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 162 | golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 163 | golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 164 | golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 165 | golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4= 166 | golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 167 | golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 168 | golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 169 | golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= 170 | golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 171 | golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= 172 | golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf h1:MZ2shdL+ZM/XzY3ZGOnh4Nlpnxz5GSOhOmtHo3iPU6M= 173 | golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= 174 | golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM= 175 | golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8= 176 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 177 | golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 178 | golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 179 | golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= 180 | golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= 181 | golang.org/x/time v0.0.0-20191024005414-555d28b269f0 h1:/5xXl8Y5W96D+TtHSlonuFqGHIWVuyCkGJLwGh9JJFs= 182 | golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= 183 | golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= 184 | golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= 185 | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 186 | golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 187 | golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 188 | golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= 189 | golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 190 | golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 191 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 192 | golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= 193 | golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 194 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 195 | gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= 196 | gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 197 | gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 198 | gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= 199 | gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= 200 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 201 | gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 202 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 203 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 204 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "context" 5 | "flag" 6 | "log" 7 | "os" 8 | "os/signal" 9 | 10 | "github.com/Computer217/SolanaBotV2/data" 11 | "github.com/Computer217/SolanaBotV2/token" 12 | "github.com/Computer217/SolanaBotV2/transaction" 13 | "github.com/gagliardetto/solana-go" 14 | "github.com/gagliardetto/solana-go/rpc" 15 | "github.com/gagliardetto/solana-go/rpc/ws" 16 | ) 17 | 18 | func main() { 19 | // Parse command line arguments. 20 | dryRun := flag.Bool("test", false, "run test") 21 | HeliusMainNet := flag.String("helius-rpc-api-key", "", "mainnet url api key") 22 | WebHook := flag.String("helius-websocket-api-key", "", "websocket url api key") 23 | walletPath := flag.String("wallet-path", "./wallet/botwallet.json", "wallet path") 24 | defaultSolanaAmount := flag.Float64("solana-amount", 0, "solana amount to purchase") 25 | flag.Parse() 26 | 27 | // extract wallet to perform transactions. 28 | var wallet solana.Wallet 29 | pk, err := solana.PrivateKeyFromSolanaKeygenFile(*walletPath) 30 | if err != nil { 31 | log.Fatal("Failed to read wallet file:", err) 32 | } 33 | wallet.PrivateKey = pk 34 | 35 | // init context. 36 | ctx, cancel := context.WithCancel(context.Background()) 37 | 38 | // Connect to the WebSocket server. 39 | wsClient, err := ws.Connect(ctx, *WebHook) 40 | if err != nil { 41 | log.Fatal("Failed to connect to WebSocket server:", err) 42 | } 43 | defer wsClient.Close() 44 | 45 | // Handle WebSocket close signal. 46 | interrupt := make(chan os.Signal, 1) 47 | signal.Notify(interrupt, os.Interrupt) 48 | 49 | // Subscribe to account changes. 50 | wsSub, err := wsClient.LogsSubscribeMentions(solana.MustPublicKeyFromBase58(transaction.PumpFunCreateTokenContract), rpc.CommitmentFinalized) 51 | if err != nil { 52 | log.Fatal("Failed to subscribe to account changes:", err) 53 | } 54 | 55 | // Create a new RPC client. 56 | rpcClient := rpc.New(*HeliusMainNet) 57 | defer rpcClient.Close() 58 | 59 | // Create transaction handler. 60 | h := transaction.NewTransactionHandler(*HeliusMainNet, rpcClient, wsClient, &wallet, *dryRun) 61 | 62 | // Set the amount of sol used to purchase tokens. 63 | h.SetPurchaseAmount(*defaultSolanaAmount) 64 | 65 | // initialize channel for mint data. 66 | mintChan := make(chan *data.MintData) 67 | 68 | // listen for pump fun contract mint activity. 69 | // for each mint, fetch the mint data and pass to the channel. 70 | go token.FetchCreatedTokenMintData(ctx, wsSub, h, mintChan) 71 | 72 | // Go routine for sniping tokens. 73 | go transaction.SnipeTokens(ctx, mintChan, h) 74 | 75 | // Wait for interrupt signal to close the connection 76 | <-interrupt 77 | log.Println("interrupt signal received, closing connection") 78 | wsClient.Close() 79 | cancel() 80 | } 81 | -------------------------------------------------------------------------------- /token/token.go: -------------------------------------------------------------------------------- 1 | package token 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | "log" 7 | "strconv" 8 | "time" 9 | 10 | "github.com/Computer217/SolanaBotV2/data" 11 | "github.com/Computer217/SolanaBotV2/transaction" 12 | "github.com/avast/retry-go" 13 | "github.com/gagliardetto/solana-go" 14 | "github.com/gagliardetto/solana-go/rpc/ws" 15 | ) 16 | 17 | func FetchCreatedTokenMintData(ctx context.Context, wsSub *ws.LogSubscription, t *transaction.TransactionHandler, mintChan chan *data.MintData) { 18 | log.Println("Listening for contract activity...") 19 | for { 20 | select { 21 | case <-ctx.Done(): 22 | log.Println("Context cancelled, cleaning up go routine FetchCreateTokens...") 23 | return 24 | default: 25 | // Receive account updates. 26 | msg, err := wsSub.Recv() 27 | if err != nil { 28 | log.Fatalf("Failed to receive message %v: %v", msg, err) 29 | } 30 | if msg.Value.Err != nil { 31 | continue 32 | } 33 | // Fetch transaction details. 34 | var data *data.GetParsedTransactionFromSignatureResponse 35 | err = retry.Do( 36 | func() error { 37 | data, err = t.GetParsedTransactionFromSignature(msg.Value.Signature.String()) 38 | return err 39 | }, 40 | retry.Attempts(3), // Set the number of retries 41 | retry.Delay(time.Second), // Set the delay between retries 42 | ) 43 | if err != nil { 44 | log.Printf("Retry budget Exhausted for fetching transaction %v details: %v\n", msg.Value.Signature, err) 45 | continue 46 | } 47 | if data.Result.Meta.Err.Message != "" { 48 | log.Printf("Fetching Signature: %v Received GetTransaction() error: %+v\n", msg.Value.Signature, data.Result.Meta.Err) 49 | continue 50 | } 51 | 52 | // Filter transaction for mint data. 53 | mintData, err := filterTransactionForMintData(data) 54 | if err != nil { 55 | log.Println("Error parsing transaction:", err) 56 | return 57 | } 58 | if mintData != nil { 59 | mintData.CreationHash = msg.Value.Signature.String() 60 | mintChan <- mintData 61 | } 62 | } 63 | } 64 | } 65 | 66 | func filterTransactionForMintData(data *data.GetParsedTransactionFromSignatureResponse) (*data.MintData, error) { 67 | if data != nil { 68 | // Parse the transaction for mint data. 69 | mint, err := parseTransaction(data) 70 | if err != nil { 71 | log.Println("Error parsing transaction:", err) 72 | return nil, err 73 | } 74 | return mint, nil 75 | } 76 | return nil, nil 77 | } 78 | 79 | func parseTransaction(d *data.GetParsedTransactionFromSignatureResponse) (*data.MintData, error) { 80 | // if transaction results in error skip. 81 | if d.Result.Meta.Err != (data.Err{}) { 82 | return nil, nil 83 | } 84 | 85 | // fetch mint data and check if it's a mint transaction. 86 | mintData, foundMint := fetchMintInstruction(d) 87 | 88 | // Check mint transaction values associated to pumpfun contract. 89 | overOneSolPurchased := assertAmountPurchasedByDev(d) 90 | 91 | if foundMint && overOneSolPurchased { 92 | // fetch market cap. 93 | fetchMarketCap(d, mintData) 94 | return mintData, nil 95 | } 96 | return nil, nil 97 | } 98 | 99 | func assertAmountPurchasedByDev(data *data.GetParsedTransactionFromSignatureResponse) bool { 100 | // overOneSolPurchased denotes whether the dev bought more than 1 sol at the time of token creation. 101 | // pumpFunCalled denotes whether the dev interacted with the pump.fun contract at the time of token creation. 102 | var overOneSolPurchased bool 103 | 104 | // fetch the dev address. This is the source address for the transaction interacting with the pumpFun contract address. 105 | var devAddress string 106 | for _, innerInstruction := range data.Result.Meta.InnerInstructions { 107 | for _, instruction := range innerInstruction.Instructions { 108 | if instruction.Parsed.Type == "transfer" { 109 | if instruction.Parsed.Info.Destination == transaction.PumpFun { 110 | devAddress = instruction.Parsed.Info.Source 111 | } 112 | } 113 | } 114 | } 115 | 116 | // theAccountOwnerOfNewTokenOne and accountOwnerOfNewTokenTwo are either: 117 | // 1. The address for the dev token account. 118 | // 2. The address for the account associated with the mint of the new token. 119 | // I saw these values flipped in practice. What we are trying to determine here is whether the dev purchased more than 1 sol. 120 | accountOwnerOfNewTokenOne := data.Result.Meta.PostTokenBalances[0].Owner 121 | accountOwnerOfNewTokenTwo := data.Result.Meta.PostTokenBalances[1].Owner 122 | 123 | for _, innerInstruction := range data.Result.Meta.InnerInstructions { 124 | for _, instruction := range innerInstruction.Instructions { 125 | if instruction.Parsed.Type == "transfer" { 126 | // check the following 3 conditions: 127 | // 1. The source/sender address is the dev address. 128 | // 2. The destination address is either the dev token account or the contract holding account associated with the mint of the new token. 129 | // 3. The amount of lamports transferred is more than 1 sol. 130 | if instruction.Parsed.Info.Source == devAddress && 131 | (instruction.Parsed.Info.Destination == accountOwnerOfNewTokenOne || instruction.Parsed.Info.Destination == accountOwnerOfNewTokenTwo) && 132 | transaction.LampToSol(instruction.Parsed.Info.Lamports) >= 1.0 { 133 | overOneSolPurchased = true 134 | } 135 | } 136 | } 137 | } 138 | 139 | return overOneSolPurchased 140 | } 141 | 142 | func fetchMintInstruction(d *data.GetParsedTransactionFromSignatureResponse) (*data.MintData, bool) { 143 | for _, innerInstruction := range d.Result.Meta.InnerInstructions { 144 | for _, instruction := range innerInstruction.Instructions { 145 | if instruction.Parsed.Type == "mintTo" && instruction.ProgramID == "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" { 146 | return &data.MintData{ 147 | Info: &data.MintInfo{ 148 | TotalSupply: instruction.Parsed.Info.Amount, 149 | MintAddress: solana.MustPublicKeyFromBase58(instruction.Parsed.Info.Mint), 150 | MintAuthority: instruction.Parsed.Info.MintAuthority, 151 | }, 152 | Type: instruction.Parsed.Type, 153 | }, true 154 | } 155 | } 156 | } 157 | return nil, false 158 | } 159 | 160 | func fetchMarketCap(data *data.GetParsedTransactionFromSignatureResponse, mintData *data.MintData) { 161 | var splTokenTransfer, solanaTokenTransfer struct { 162 | Accounts []string "json:\"accounts,omitempty\"" 163 | Data string "json:\"data,omitempty\"" 164 | ProgramID string "json:\"programId\"" 165 | StackHeight int "json:\"stackHeight\"" 166 | Parsed struct { 167 | Info struct { 168 | Amount string "json:\"amount\"" 169 | Authority string "json:\"authority\"" 170 | Destination string "json:\"destination\"" 171 | Source string "json:\"source\"" 172 | Lamports int64 "json:\"lamports,omitempty\"" 173 | Mint string "json:\"mint,omitempty\"" 174 | MintAuthority string "json:\"mintAuthority,omitempty\"" 175 | Account string "json:\"account,omitempty\"" 176 | } "json:\"info\"" 177 | Type string "json:\"type\"" 178 | } "json:\"parsed,omitempty\"" 179 | Program string "json:\"program,omitempty\"" 180 | } 181 | 182 | for _, innerInstruction := range data.Result.Meta.InnerInstructions { 183 | for _, instruction := range innerInstruction.Instructions { 184 | if instruction.Parsed.Type == "transfer" { 185 | i, _ := strconv.Atoi(instruction.Parsed.Info.Amount) 186 | if instruction.Program == "spl-token" && i > 0 { 187 | splTokenTransfer = instruction 188 | } 189 | if instruction.Program == "system" && instruction.ProgramID == "11111111111111111111111111111111" && instruction.Parsed.Info.Destination != transaction.PumpFun && instruction.Parsed.Info.Destination != transaction.BlockRouteContract && instruction.Parsed.Info.Lamports != 0 { 190 | solanaTokenTransfer = instruction 191 | } 192 | } 193 | } 194 | } 195 | 196 | // calculate market cap. 197 | // Fetch the dev amount and the remaining circulating supply. 198 | var remainingCirculatingSupply, devSupply float64 199 | if splTokenTransfer.Parsed.Info.Amount == data.Result.Meta.PostTokenBalances[1].UITokenAmount.Amount { 200 | devSupply = data.Result.Meta.PostTokenBalances[1].UITokenAmount.UIAmount 201 | remainingCirculatingSupply = data.Result.Meta.PostTokenBalances[0].UITokenAmount.UIAmount 202 | } else { 203 | devSupply = data.Result.Meta.PostTokenBalances[0].UITokenAmount.UIAmount 204 | remainingCirculatingSupply = data.Result.Meta.PostTokenBalances[1].UITokenAmount.UIAmount 205 | } 206 | mintData.DevSupply = devSupply 207 | 208 | // calculate how much dev paid per token. 209 | amountPaidForToken := float64(transaction.LampToSol(solanaTokenTransfer.Parsed.Info.Lamports)) 210 | priceInSol := amountPaidForToken / devSupply 211 | mintData.TokenPriceInSol = priceInSol 212 | 213 | // Calculate market cap. 214 | mintData.Info.MarketCapInSol = fmt.Sprintf("%f", priceInSol*remainingCirculatingSupply) 215 | } 216 | -------------------------------------------------------------------------------- /transaction/transaction.go: -------------------------------------------------------------------------------- 1 | package transaction 2 | 3 | import ( 4 | "bytes" 5 | "context" 6 | "encoding/json" 7 | "fmt" 8 | "io" 9 | "log" 10 | "math" 11 | "net/http" 12 | "os" 13 | 14 | "github.com/Computer217/SolanaBotV2/data" 15 | "github.com/Computer217/SolanaBotV2/generated/pump" 16 | "github.com/davecgh/go-spew/spew" 17 | "github.com/gagliardetto/solana-go" 18 | "github.com/gagliardetto/solana-go/programs/system" 19 | "github.com/gagliardetto/solana-go/rpc" 20 | "github.com/gagliardetto/solana-go/rpc/ws" 21 | "github.com/gagliardetto/solana-go/text" 22 | 23 | associatedtokenaccount "github.com/gagliardetto/solana-go/programs/associated-token-account" 24 | computebudget "github.com/gagliardetto/solana-go/programs/compute-budget" 25 | confirm "github.com/gagliardetto/solana-go/rpc/sendAndConfirmTransaction" 26 | ) 27 | 28 | const JitoTip5 = "DfXygSm4jCyNCybVYYK6DwvWqjKee8pbDmJGcLWNDXjh" 29 | const PumpFunBuyContract = "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" 30 | const PumpFunCreateTokenContract = "TSLvdd1pWpHVjahSpsvCXUbgwsL3JAcvokwaKt1eokM" 31 | const PumpFun = "CebN5WGQ4jvEPvsVU4EoHEpgzq1VV7AbicfhtW4xC9iM" 32 | const Global = "4wTV1YmiEkRvAtNtsSGPtUrqRYQMe5SKy2uB4Jjaxnjf" 33 | const BlockRouteContract = "HWEoBxYs7ssKuudEjzjmpfJVX7Dvi7wescFsVx2L5yoY" 34 | const EventAuthority = "Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1" 35 | 36 | // createComputeLimitInstruction creates an instruction that sets the compute unit limit. 37 | func createComputeLimitInstruction(computeLimit uint32) (*computebudget.Instruction, error) { 38 | return computebudget.NewSetComputeUnitLimitInstructionBuilder().SetUnits(computeLimit).ValidateAndBuild() 39 | } 40 | 41 | // createJitoTip5Instruction creates an instruction that transfers an amount to the jitoTip5 initiative. 42 | func createJitoTip5Instruction(wallet solana.PublicKey, tip uint64) (*system.Instruction, error) { 43 | transf := system.NewTransferInstructionBuilder() 44 | transf = transf.SetLamports(tip) 45 | transf = transf.SetFundingAccount(wallet) 46 | 47 | // convert string address to PublicKey 48 | pubk, err := solana.PublicKeyFromBase58(JitoTip5) 49 | if err != nil { 50 | return nil, err 51 | } 52 | transf = transf.SetRecipientAccount(pubk) 53 | return transf.ValidateAndBuild() 54 | } 55 | 56 | // createComputeUnitPriceInstruction creates an instruction that sets the compute unit price. 57 | func createComputeUnitPriceInstruction(computeUnit uint64) (*computebudget.Instruction, error) { 58 | return computebudget.NewSetComputeUnitPriceInstructionBuilder().SetMicroLamports(computeUnit).ValidateAndBuild() 59 | } 60 | 61 | // createAssociateTokenAccountInstruction creates an instruction that creates a token account. 62 | // Input: 63 | // - Wallet: the account that will be the owner of the new token account (main wallet). 64 | // - Mint: the mint of the token that will be associated with the new token account. 65 | func createAssociateTokenAccountInstruction(Wallet solana.PublicKey, mint solana.PublicKey) (*associatedtokenaccount.Instruction, error) { 66 | return associatedtokenaccount.NewCreateInstruction(Wallet, Wallet, mint).ValidateAndBuild() 67 | } 68 | 69 | // createPumpFunInstruction creates the instruction for buying tokens on pump.fun. 70 | func createPumpFunInstruction(wallet, mint, bondingCurve, associatedBondingCurve, associatedUser solana.PublicKey, maxLamportCost, tokenAmount uint64) (*pump.Instruction, error) { 71 | pumpInstruction := pump.NewBuyInstruction( 72 | tokenAmount, 73 | maxLamportCost, 74 | solana.MustPublicKeyFromBase58(Global), 75 | solana.MustPublicKeyFromBase58(PumpFun), 76 | mint, 77 | bondingCurve, 78 | associatedBondingCurve, 79 | associatedUser, 80 | wallet, 81 | solana.SystemProgramID, 82 | solana.TokenProgramID, 83 | solana.SysVarRentPubkey, 84 | solana.MustPublicKeyFromBase58(EventAuthority), 85 | solana.MustPublicKeyFromBase58(PumpFunBuyContract)) 86 | 87 | return pumpInstruction.ValidateAndBuild() 88 | } 89 | 90 | type BuyParams struct { 91 | ComputeLimit uint32 // Default: 100000 92 | ComputeUnit uint64 // Default: 100000 93 | Wallet *solana.Wallet 94 | Mint solana.PublicKey 95 | BondingCurve solana.PublicKey 96 | AssociatedBondingCurve solana.PublicKey 97 | AssociatedUser solana.PublicKey 98 | TokenAmount uint64 99 | MaxLamportCost uint64 // Price including slippage tolerance. 100 | } 101 | 102 | // BuildBuyInstructions creates the instructions for buying tokens on pump.fun. 103 | func (b *BuyParams) BuildBuyTransaction() (*solana.Transaction, error) { 104 | // create compute limit instruction 105 | computeLimitInstruction, err := createComputeLimitInstruction(b.ComputeLimit) 106 | if err != nil { 107 | return nil, err 108 | } 109 | 110 | // create jito tip instruction 111 | jitoTipInstruction, err := createJitoTip5Instruction(b.Wallet.PublicKey(), 112 | 10000000) 113 | if err != nil { 114 | return nil, err 115 | } 116 | 117 | // create compute unit price instruction. 118 | computeUnitPriceInstruction, err := createComputeUnitPriceInstruction(b.ComputeUnit) 119 | if err != nil { 120 | return nil, err 121 | } 122 | 123 | // create associate token account instruction. 124 | associateTokenAccountInstruction, err := createAssociateTokenAccountInstruction(b.Wallet.PublicKey(), 125 | b.Mint) 126 | if err != nil { 127 | return nil, err 128 | } 129 | 130 | // create pump fun instruction. 131 | pumpFunInstruction, err := createPumpFunInstruction(b.Wallet.PublicKey(), 132 | b.Mint, 133 | b.BondingCurve, 134 | b.AssociatedBondingCurve, 135 | b.AssociatedUser, 136 | b.MaxLamportCost, 137 | b.TokenAmount) 138 | if err != nil { 139 | return nil, err 140 | } 141 | 142 | return solana.NewTransaction([]solana.Instruction{ 143 | computeLimitInstruction, 144 | jitoTipInstruction, 145 | computeUnitPriceInstruction, 146 | associateTokenAccountInstruction, 147 | pumpFunInstruction}, 148 | solana.Hash{}, 149 | solana.TransactionPayer(b.Wallet.PublicKey()), 150 | ) 151 | } 152 | 153 | type TransactionHandler struct { 154 | UrlEndpoint string 155 | RpcClient *rpc.Client 156 | WsClient *ws.Client 157 | Wallet *solana.Wallet 158 | TokensHandled map[solana.PublicKey]bool 159 | LampsToBuy uint64 160 | DryRun bool 161 | } 162 | 163 | // NewTransactionHandler creates a handler to send transactions to interact with pump.fun contract. 164 | func NewTransactionHandler(urlEndpoint string, rpcClient *rpc.Client, wsClient *ws.Client, wallet *solana.Wallet, dryRun bool) *TransactionHandler { 165 | return &TransactionHandler{ 166 | UrlEndpoint: urlEndpoint, 167 | RpcClient: rpcClient, 168 | WsClient: wsClient, 169 | Wallet: wallet, 170 | TokensHandled: make(map[solana.PublicKey]bool), 171 | DryRun: dryRun, 172 | } 173 | } 174 | 175 | // set the amount of tokens to buy in sol. 176 | func (t *TransactionHandler) SetPurchaseAmount(sol float64) { 177 | // instruction requires the amount of tokens to buy in lamports. 178 | t.LampsToBuy = SolToLamp(sol) 179 | } 180 | 181 | func (t *TransactionHandler) SignAndSendTransaction(ctx context.Context, tx *solana.Transaction, wallet *solana.Wallet) error { 182 | // Sign the transaction: 183 | _, err := tx.Sign( 184 | func(key solana.PublicKey) *solana.PrivateKey { 185 | if wallet.PublicKey().Equals(key) { 186 | return &wallet.PrivateKey 187 | } 188 | return nil 189 | }, 190 | ) 191 | if err != nil { 192 | return fmt.Errorf("tx.Sign failure: %v", err) 193 | } 194 | spew.Dump(tx) 195 | tx.EncodeToTree(text.NewTreeEncoder(os.Stdout, "Buying from Pump.fun")) 196 | 197 | // If dry run is enabled, simulate the buy. 198 | if t.DryRun { 199 | log.Println("Simulating buy...") 200 | resp, err := t.RpcClient.SimulateTransaction(ctx, tx) 201 | if err != nil { 202 | log.Fatal("Failed to simulate transaction:", err) 203 | } 204 | spew.Dump(resp) 205 | return nil 206 | } 207 | 208 | // Send transaction, and wait for confirmation: 209 | sig, err := confirm.SendAndConfirmTransaction( 210 | ctx, 211 | t.RpcClient, 212 | t.WsClient, 213 | tx, 214 | ) 215 | if err != nil { 216 | return fmt.Errorf("SendAndConfirmTransaction failed: %v", err) 217 | } 218 | spew.Dump(sig) 219 | return nil 220 | } 221 | 222 | func (t *TransactionHandler) buyFromPumpfun(ctx context.Context, mintData *data.MintData) { 223 | // Calculate the amount of tokens to buy. 224 | mintData.TokenAmount = uint64(math.Floor(LampToSol(int64(t.LampsToBuy)) / mintData.TokenPriceInSol)) 225 | fmt.Printf("\033[1;33mPurchase Amount (SOL):\033[0m \033[1;36m%.12f\033[0m\n", LampToSol(int64(t.LampsToBuy))) 226 | fmt.Printf("\033[1;33mToken Price:\033[0m \033[1;36m%.12f\033[0m\n", mintData.TokenPriceInSol) 227 | fmt.Printf("\033[1;33mToken Amount:\033[0m \033[1;36m%v\033[0m\n", mintData.TokenAmount) 228 | fmt.Printf("\033[1;33mMarket Cap (SOL):\033[0m \033[1;36m%v\033[0m\n", mintData.Info.MarketCapInSol) 229 | fmt.Printf("\033[1;33mMax Tx Cost (SOL):\033[0m \033[1;36m%.12f\033[0m\n", LampToSol(int64(maxLamportCost(t.LampsToBuy)))) 230 | 231 | // derive associated token account (ie. associateUser value from IDL). 232 | ata, _, err := solana.FindAssociatedTokenAddress( 233 | t.Wallet.PublicKey(), 234 | mintData.Info.MintAddress, 235 | ) 236 | if err != nil { 237 | log.Fatalf("failed to derive associated token account: %v", err) 238 | } 239 | 240 | // Derive bonding curve address. 241 | // define the seeds used to derive the PDA 242 | // getProgramDerivedAddress equivalent. 243 | seeds := [][]byte{ 244 | []byte("bonding-curve"), 245 | mintData.Info.MintAddress.Bytes(), 246 | } 247 | 248 | bondingCurve, _, err := solana.FindProgramAddress(seeds, solana.MustPublicKeyFromBase58(PumpFunBuyContract)) 249 | if err != nil { 250 | log.Fatalf("failed to derive bonding curve address: %v", err) 251 | } 252 | 253 | // Derive associated bonding curve address. 254 | associatedBondingCurve, _, err := solana.FindAssociatedTokenAddress( 255 | bondingCurve, 256 | mintData.Info.MintAddress, 257 | ) 258 | if err != nil { 259 | log.Fatalf("failed to derive associated bonding curve address: %v", err) 260 | } 261 | 262 | // set all parameters for buying tokens. 263 | tokenBuyParams := BuyParams{ 264 | TokenAmount: mintData.TokenAmount * 1000000, // shift by 6 since pumpfun specifies 6 decimal places. 265 | ComputeLimit: 100000, 266 | ComputeUnit: 100000, 267 | Wallet: t.Wallet, 268 | Mint: mintData.Info.MintAddress, 269 | BondingCurve: bondingCurve, 270 | AssociatedBondingCurve: associatedBondingCurve, 271 | AssociatedUser: ata, 272 | MaxLamportCost: maxLamportCost(t.LampsToBuy), 273 | } 274 | 275 | // Build transaction with instructions to buy tokens. 276 | tx, err := tokenBuyParams.BuildBuyTransaction() 277 | if err != nil { 278 | log.Fatalf("failed to build buy transaction: %v", err) 279 | } 280 | 281 | // Fetch recent blockhash and set in transaction. 282 | recentBlockhash, err := t.RpcClient.GetRecentBlockhash(ctx, rpc.CommitmentFinalized) 283 | if err != nil { 284 | log.Fatalf("Failed to fetch recent blockhash: %v", err) 285 | } 286 | tx.Message.RecentBlockhash = recentBlockhash.Value.Blockhash 287 | 288 | // Sign and send the transaction. 289 | if err := t.SignAndSendTransaction(ctx, tx, t.Wallet); err != nil { 290 | log.Fatalf("failed to sign and send transaction: %v", err) 291 | } 292 | 293 | log.Println("Listening for contract activity again...") 294 | } 295 | 296 | func (t *TransactionHandler) handleTransaction(ctx context.Context, mintData *data.MintData) { 297 | // handle duplicate token creation messages. 298 | if found := t.TokensHandled[mintData.Info.MintAddress]; found { 299 | return 300 | } else { 301 | t.TokensHandled[mintData.Info.MintAddress] = true 302 | } 303 | 304 | // Print to stdout when a avalid token is found. 305 | fmt.Println("\033[1;32m|============================|") 306 | fmt.Println("| Token Found |") 307 | fmt.Println("|============================|\033[0m") 308 | fmt.Printf("\033[1;33mToken Creation Hash:\033[0m \033[1;32m%v\033[0m\n", mintData.CreationHash) 309 | fmt.Printf("\033[1;33mMint Address:\033[0m \033[1;32m%v\033[0m\n", mintData.Info.MintAddress) 310 | fmt.Printf("\033[1;33mTotal Supply:\033[0m \033[1;32m%v\033[0m\n", mintData.Info.TotalSupply) 311 | fmt.Printf("\033[1;33mAmount of Tokens Purchased by Dev:\033[0m \033[1;32m%f\033[0m\n", mintData.DevSupply) 312 | fmt.Printf("\033[1;33mPrice of Token paid by dev in Sol:\033[0m \033[1;32m%.12f\033[0m\n", mintData.TokenPriceInSol) 313 | fmt.Printf("\033[1;33murl:\033[0m \033[1;32mpump.fun/%v\033[0m\n", mintData.Info.MintAddress) 314 | 315 | fmt.Println() 316 | t.buyFromPumpfun(ctx, mintData) 317 | } 318 | 319 | func (t *TransactionHandler) GetParsedTransactionFromSignature(hash string) (*data.GetParsedTransactionFromSignatureResponse, error) { 320 | // JSON-RPC request body 321 | requestBody, err := json.Marshal(map[string]interface{}{ 322 | "jsonrpc": "2.0", 323 | "id": 1, 324 | "method": "getTransaction", 325 | "params": []interface{}{ 326 | hash, 327 | map[string]interface{}{ 328 | "maxSupportedTransactionVersion": 0, 329 | "encoding": "jsonParsed", 330 | }, 331 | }, 332 | }) 333 | if err != nil { 334 | log.Println("Error marshaling JSON:", err) 335 | return nil, err 336 | } 337 | 338 | // Send the HTTP request 339 | response, err := http.Post(t.UrlEndpoint, "application/json", bytes.NewBuffer(requestBody)) 340 | if err != nil { 341 | log.Println("Error sending request:", err) 342 | return nil, err 343 | } 344 | defer response.Body.Close() 345 | 346 | // response.Body is a stream that can only be read once. 347 | bodyBytes, err := io.ReadAll(response.Body) 348 | if err != nil { 349 | log.Println("Error reading response body:", err) 350 | return nil, err 351 | } 352 | nullSkip, err := skipNull(bodyBytes) 353 | if err != nil { 354 | return nil, err 355 | } 356 | if nullSkip { 357 | return nil, nil 358 | } 359 | 360 | // Skip legacy version transactions. 361 | legacySkip, err := skipLegacy(bodyBytes) 362 | if err != nil { 363 | return nil, err 364 | } 365 | if legacySkip { 366 | return nil, nil 367 | } 368 | 369 | // Read the response body into structured Data. 370 | result := new(data.GetParsedTransactionFromSignatureResponse) 371 | err = json.Unmarshal(bodyBytes, &result) 372 | if err != nil { 373 | return nil, fmt.Errorf("error decoding JSON: %v", err) 374 | } 375 | return result, nil 376 | } 377 | 378 | // maxLamportCost calculates the maximum lamport cost for a given amount of tokens to buy including the slipage. 379 | // for no slippage, set the slippage tolerance to -1. 380 | func maxLamportCost(LampsToBuy uint64) uint64 { 381 | solValue := LampToSol(int64(LampsToBuy)) 382 | totalAmountWithSlippage := solValue * 1.25 // %25 slippage tolerance. 383 | return SolToLamp(totalAmountWithSlippage) 384 | } 385 | 386 | // skipNull skips null body responses when fetching for a transaction hash. 387 | func skipNull(bodyBytes []byte) (bool, error) { 388 | var prettyJSON bytes.Buffer 389 | err := json.Indent(&prettyJSON, bodyBytes, "", " ") 390 | if err != nil { 391 | log.Println("Error generating pretty JSON:", err) 392 | return false, err 393 | } 394 | 395 | var result map[string]interface{} 396 | err = json.Unmarshal(bodyBytes, &result) 397 | if err != nil { 398 | log.Println("Error decoding JSON:", err) 399 | return false, err 400 | } 401 | 402 | // Check if the specific field is nil 403 | if result["result"] == nil { 404 | // log.Printf("result is nil: %v", prettyJSON.String()) 405 | return true, nil 406 | } 407 | return false, nil 408 | } 409 | 410 | // skipLegacy skips legacy version transactions. 411 | func skipLegacy(bodyBytes []byte) (bool, error) { 412 | var prettyJSON bytes.Buffer 413 | err := json.Indent(&prettyJSON, bodyBytes, "", " ") 414 | if err != nil { 415 | log.Println("Error generating pretty JSON:", err) 416 | return false, err 417 | } 418 | 419 | // Skip legacy version transactions. 420 | // Unmarshal the JSON into a map 421 | var legacyResult struct { 422 | Result struct { 423 | Version interface{} `json:"version"` 424 | } `json:"result"` 425 | } 426 | err = json.Unmarshal(bodyBytes, &legacyResult) 427 | if err != nil { 428 | log.Println("Error decoding vanilla JSON:", err) 429 | return false, err 430 | } 431 | 432 | // Check the type of the version field 433 | switch v := legacyResult.Result.Version.(type) { 434 | case string: 435 | if v == "legacy" { 436 | return true, nil 437 | } 438 | case float64: 439 | if v == 0 { 440 | return false, nil 441 | } 442 | default: 443 | 444 | return false, fmt.Errorf("unexpected type for version field: %T, transaction: %v", v, prettyJSON.String()) 445 | } 446 | return false, nil 447 | } 448 | 449 | func LampToSol(lamports int64) float64 { 450 | return float64(lamports) / 1000000000.0 451 | } 452 | 453 | func SolToLamp(sol float64) uint64 { 454 | return uint64(sol * 1000000000) 455 | } 456 | 457 | func SnipeTokens(ctx context.Context, mintChan chan *data.MintData, t *TransactionHandler) { 458 | for { 459 | select { 460 | case <-ctx.Done(): 461 | // Context has been cancelled, stop the goroutine 462 | return 463 | case mintData := <-mintChan: 464 | // Handle transaction. 465 | t.handleTransaction(ctx, mintData) 466 | } 467 | } 468 | } 469 | --------------------------------------------------------------------------------