-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.go
99 lines (83 loc) · 3.38 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
package main
import (
// "context"
// "fmt"
// "log"
//"log"
"fmt"
"solana-wallet/mintNFT"
// "github.com/portto/solana-go-sdk/client"
// "github.com/portto/solana-go-sdk/program/sysprog"
// "github.com/portto/solana-go-sdk/rpc"
"github.com/portto/solana-go-sdk/types"
)
//var Alice = ("5TdJYb9AhEhSqLvAG4MPJddHHQSX4breqCSWnx2Ast5k")
var AliceSK, _ = types.AccountFromBytes([]byte{162, 128, 223, 203, 33, 217, 35, 50, 114, 79, 106, 50, 93, 174, 66, 2, 47, 22, 191, 158, 233, 41, 109, 52, 49, 255, 214, 3, 3, 182, 50, 185, 2, 212, 203, 14, 73, 174, 65, 37, 136, 138, 5, 84, 53, 62, 136, 198, 69, 3, 211, 0, 20, 214, 9, 140, 211, 24, 14, 197, 109, 104, 35, 65})
func main() {
// // create a RPC client
// c := client.NewClient(rpc.TestnetRPCEndpoint)
// // get the current running Solana version
// response, err := c.GetVersion(context.TODO())
// if err != nil {
// panic(err)
// }
// fmt.Println("version", response.SolanaCore)
// // // // create a new wallet using types.NewAccount()
// wallet := types.NewAccount()
fmt.Println("ALice is the fee payer------------------------", AliceSK.PublicKey)
// // // // // display the wallet public and private keys
// fmt.Println("Wallet Address:", wallet.PublicKey.ToBase58())
// fmt.Println("Private Key:", wallet.PrivateKey)
// //fund new account----------------------------------------------------------------------------------------
// sig, err := c.RequestAirdrop(
// context.TODO(),
// wallet.PublicKey.ToBase58(), // address
// 1e9, // lamports (1 SOL = 10^9 lamports)
// )
// if err != nil {
// log.Fatalf("failed to request airdrop, err: %v", err)
// }
// fmt.Println("-----------------------------------------air drop succeeded-------------------------------")
// fmt.Println(sig)
// recentBlockhashResponse, err := c.GetRecentBlockhash(context.Background())
// if err != nil {
// log.Fatalf("failed to get recent blockhash, err: %v", err)
// }
// tx, err := types.NewTransaction(types.NewTransactionParam{
// Signers: []types.Account{AliceSK},
// Message: types.NewMessage(types.NewMessageParam{
// FeePayer: AliceSK.PublicKey,
// RecentBlockhash: recentBlockhashResponse.Blockhash,
// Instructions: []types.Instruction{
// sysprog.Transfer(sysprog.TransferParam{
// From: AliceSK.PublicKey,
// To: wallet.PublicKey,
// Amount: 1e9,
// }),
// },
// }),
// })
// if err != nil {
// log.Println("failed to new a transaction, err: %v", err)
// }
// // send tx
// txhash, err := c.SendTransaction(context.Background(), tx)
// if err != nil {
// log.Println("failed to send tx, err: %v", err)
// }
// log.Println("txhash:", txhash)
// fmt.Println("------------------wallet pk------------------", wallet.PublicKey)
// //get balance --------------------------------------------------------------------------------------------------------------
// balance, err := c.GetBalance(
// context.TODO(),
// wallet.PublicKey.ToBase58(),
// )
// if err != nil {
// log.Fatalf("failed to get balance, err: %v", err)
// }
// fmt.Println("-------------------------------------------balance is --------------------", balance)
// fmt.Printf("balance: %v\n", balance)
// //solanaHandler.HandleCalls()
// fmt.Println("------------------------------------------------------------------------------------------------------------------------")
mintNFT.MainCode()
}