From ead139c76a9792e4912766e7a7a239c28f9c341d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 22 Dec 2023 16:11:33 +0000 Subject: [PATCH] Deploy to GitHub pages --- 404.html | 33 ++++ .../durable-nonce/create-nonce-account.html | 104 ++++++++++ .../get-nonce-account-by-owner.html | 85 ++++++++ advanced/durable-nonce/get-nonce-account.html | 84 ++++++++ advanced/durable-nonce/index.html | 33 ++++ advanced/durable-nonce/upgrade-nonce.html | 141 +++++++++++++ advanced/durable-nonce/use-nonce.html | 92 +++++++++ advanced/memo.html | 88 +++++++++ assets/404.68265bf7.js | 1 + assets/404.html.94d59506.js | 1 + assets/404.html.e275e9a9.js | 1 + assets/Layout.5cbefb08.js | 1 + assets/accounts.html.26bf1d29.js | 1 + assets/accounts.html.96e253f2.js | 115 +++++++++++ assets/app.01f87ec9.js | 8 + assets/back-to-top.8efcbe56.svg | 1 + assets/create-account.html.8cde0ffe.js | 1 + assets/create-account.html.bb41477f.js | 97 +++++++++ assets/create-mint.html.8c277ef6.js | 76 +++++++ assets/create-mint.html.8c737506.js | 1 + assets/create-nonce-account.html.09101beb.js | 1 + assets/create-nonce-account.html.c254d86a.js | 72 +++++++ assets/create-token-account.html.082bc642.js | 134 +++++++++++++ assets/create-token-account.html.3be4b61e.js | 1 + assets/data.html.22999d61.js | 1 + assets/data.html.c03cd48e.js | 121 ++++++++++++ assets/get-metadata.html.2bbab957.js | 1 + assets/get-metadata.html.8daeda1b.js | 42 ++++ assets/get-mint.html.b4cc973b.js | 1 + assets/get-mint.html.d6de7b13.js | 32 +++ ...et-nonce-account-by-owner.html.4e38d4cc.js | 53 +++++ ...et-nonce-account-by-owner.html.e7678f5f.js | 1 + assets/get-nonce-account.html.365f85e2.js | 1 + assets/get-nonce-account.html.9fe949a4.js | 52 +++++ ...et-signatures-for-address.html.637d35dd.js | 1 + ...et-signatures-for-address.html.ce25d962.js | 153 +++++++++++++++ assets/get-sol-balance.html.6f961e64.js | 1 + assets/get-sol-balance.html.9d310a9a.js | 23 +++ assets/get-token-account.html.c10505a4.js | 30 +++ assets/get-token-account.html.e4cf79d9.js | 1 + assets/get-token-balance.html.48dc74ba.js | 1 + assets/get-token-balance.html.b25f50bd.js | 31 +++ assets/hello.html.b83fb618.js | 78 ++++++++ assets/hello.html.fc8163f0.js | 1 + assets/index.html.53b060d9.js | 1 + assets/index.html.aa82496b.js | 1 + assets/index.html.bb851f19.js | 1 + assets/index.html.c8b9bcbb.js | 1 + assets/memo.html.1a2a0915.js | 56 ++++++ assets/memo.html.7283ccff.js | 1 + assets/mint-a-nft.html.3f3b89f5.js | 1 + assets/mint-a-nft.html.842fde0f.js | 138 +++++++++++++ assets/mint-to.html.71acbc9f.js | 62 ++++++ assets/mint-to.html.fe63e0ea.js | 1 + assets/request-airdrop.html.2cbd486f.js | 24 +++ assets/request-airdrop.html.fa688e36.js | 1 + assets/sign-metadata.html.0570f274.js | 1 + assets/sign-metadata.html.be534e59.js | 58 ++++++ assets/style.507e4890.css | 1 + assets/token-transfer.html.b2c2d352.js | 63 ++++++ assets/token-transfer.html.c870739e.js | 1 + assets/transfer.html.565e3105.js | 1 + assets/transfer.html.93f621b8.js | 56 ++++++ assets/upgrade-nonce.html.88791bac.js | 109 +++++++++++ assets/upgrade-nonce.html.c7e291c7.js | 1 + assets/use-nonce.html.440dd4d8.js | 60 ++++++ assets/use-nonce.html.7b82dfda.js | 1 + index.html | 33 ++++ nft/get-metadata.html | 74 +++++++ nft/mint-a-nft.html | 170 ++++++++++++++++ nft/sign-metadata.html | 90 +++++++++ programs/101/accounts.html | 147 ++++++++++++++ programs/101/data.html | 153 +++++++++++++++ programs/101/hello.html | 110 +++++++++++ rpc/get-signatures-for-address.html | 185 ++++++++++++++++++ tour/create-account.html | 129 ++++++++++++ tour/create-mint.html | 108 ++++++++++ tour/create-token-account.html | 166 ++++++++++++++++ tour/get-mint.html | 64 ++++++ tour/get-sol-balance.html | 55 ++++++ tour/get-token-account.html | 62 ++++++ tour/get-token-balance.html | 63 ++++++ tour/mint-to.html | 94 +++++++++ tour/request-airdrop.html | 56 ++++++ tour/token-transfer.html | 95 +++++++++ tour/transfer.html | 88 +++++++++ 86 files changed, 4379 insertions(+) create mode 100644 404.html create mode 100644 advanced/durable-nonce/create-nonce-account.html create mode 100644 advanced/durable-nonce/get-nonce-account-by-owner.html create mode 100644 advanced/durable-nonce/get-nonce-account.html create mode 100644 advanced/durable-nonce/index.html create mode 100644 advanced/durable-nonce/upgrade-nonce.html create mode 100644 advanced/durable-nonce/use-nonce.html create mode 100644 advanced/memo.html create mode 100644 assets/404.68265bf7.js create mode 100644 assets/404.html.94d59506.js create mode 100644 assets/404.html.e275e9a9.js create mode 100644 assets/Layout.5cbefb08.js create mode 100644 assets/accounts.html.26bf1d29.js create mode 100644 assets/accounts.html.96e253f2.js create mode 100644 assets/app.01f87ec9.js create mode 100644 assets/back-to-top.8efcbe56.svg create mode 100644 assets/create-account.html.8cde0ffe.js create mode 100644 assets/create-account.html.bb41477f.js create mode 100644 assets/create-mint.html.8c277ef6.js create mode 100644 assets/create-mint.html.8c737506.js create mode 100644 assets/create-nonce-account.html.09101beb.js create mode 100644 assets/create-nonce-account.html.c254d86a.js create mode 100644 assets/create-token-account.html.082bc642.js create mode 100644 assets/create-token-account.html.3be4b61e.js create mode 100644 assets/data.html.22999d61.js create mode 100644 assets/data.html.c03cd48e.js create mode 100644 assets/get-metadata.html.2bbab957.js create mode 100644 assets/get-metadata.html.8daeda1b.js create mode 100644 assets/get-mint.html.b4cc973b.js create mode 100644 assets/get-mint.html.d6de7b13.js create mode 100644 assets/get-nonce-account-by-owner.html.4e38d4cc.js create mode 100644 assets/get-nonce-account-by-owner.html.e7678f5f.js create mode 100644 assets/get-nonce-account.html.365f85e2.js create mode 100644 assets/get-nonce-account.html.9fe949a4.js create mode 100644 assets/get-signatures-for-address.html.637d35dd.js create mode 100644 assets/get-signatures-for-address.html.ce25d962.js create mode 100644 assets/get-sol-balance.html.6f961e64.js create mode 100644 assets/get-sol-balance.html.9d310a9a.js create mode 100644 assets/get-token-account.html.c10505a4.js create mode 100644 assets/get-token-account.html.e4cf79d9.js create mode 100644 assets/get-token-balance.html.48dc74ba.js create mode 100644 assets/get-token-balance.html.b25f50bd.js create mode 100644 assets/hello.html.b83fb618.js create mode 100644 assets/hello.html.fc8163f0.js create mode 100644 assets/index.html.53b060d9.js create mode 100644 assets/index.html.aa82496b.js create mode 100644 assets/index.html.bb851f19.js create mode 100644 assets/index.html.c8b9bcbb.js create mode 100644 assets/memo.html.1a2a0915.js create mode 100644 assets/memo.html.7283ccff.js create mode 100644 assets/mint-a-nft.html.3f3b89f5.js create mode 100644 assets/mint-a-nft.html.842fde0f.js create mode 100644 assets/mint-to.html.71acbc9f.js create mode 100644 assets/mint-to.html.fe63e0ea.js create mode 100644 assets/request-airdrop.html.2cbd486f.js create mode 100644 assets/request-airdrop.html.fa688e36.js create mode 100644 assets/sign-metadata.html.0570f274.js create mode 100644 assets/sign-metadata.html.be534e59.js create mode 100644 assets/style.507e4890.css create mode 100644 assets/token-transfer.html.b2c2d352.js create mode 100644 assets/token-transfer.html.c870739e.js create mode 100644 assets/transfer.html.565e3105.js create mode 100644 assets/transfer.html.93f621b8.js create mode 100644 assets/upgrade-nonce.html.88791bac.js create mode 100644 assets/upgrade-nonce.html.c7e291c7.js create mode 100644 assets/use-nonce.html.440dd4d8.js create mode 100644 assets/use-nonce.html.7b82dfda.js create mode 100644 index.html create mode 100644 nft/get-metadata.html create mode 100644 nft/mint-a-nft.html create mode 100644 nft/sign-metadata.html create mode 100644 programs/101/accounts.html create mode 100644 programs/101/data.html create mode 100644 programs/101/hello.html create mode 100644 rpc/get-signatures-for-address.html create mode 100644 tour/create-account.html create mode 100644 tour/create-mint.html create mode 100644 tour/create-token-account.html create mode 100644 tour/get-mint.html create mode 100644 tour/get-sol-balance.html create mode 100644 tour/get-token-account.html create mode 100644 tour/get-token-balance.html create mode 100644 tour/mint-to.html create mode 100644 tour/request-airdrop.html create mode 100644 tour/token-transfer.html create mode 100644 tour/transfer.html diff --git a/404.html b/404.html new file mode 100644 index 00000000..c75541b4 --- /dev/null +++ b/404.html @@ -0,0 +1,33 @@ + + + + + + + + + Solana Development With Go + + + + +

404

How did we get here?
Take me home
+ + + diff --git a/advanced/durable-nonce/create-nonce-account.html b/advanced/durable-nonce/create-nonce-account.html new file mode 100644 index 00000000..a376a878 --- /dev/null +++ b/advanced/durable-nonce/create-nonce-account.html @@ -0,0 +1,104 @@ + + + + + + + + + Create Nonce Account | Solana Development With Go + + + + +

Create Nonce Account

package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/program/system"
+	"github.com/blocto/solana-go-sdk/rpc"
+	"github.com/blocto/solana-go-sdk/types"
+)
+
+// FUarP2p5EnxD66vVDL4PWRoWMzA56ZVHG24hpEDFShEz
+var feePayer, _ = types.AccountFromBase58("4TMFNY9ntAn3CHzguSAvDNLPRoQTaK3sWbQQXdDXaE6KWRBLufGL6PJdsD2koiEe3gGmMdRK3aAw7sikGNksHJrN")
+
+// 9aE476sH92Vz7DMPyq5WLPkrKWivxeuTKEFKd2sZZcde
+var alice, _ = types.AccountFromBase58("4voSPg3tYuWbKzimpQK9EbXHmuyy5fUrtXvpLDMLkmY6TRncaTHAKGD8jUg3maB5Jbrd9CkQg4qjJMyN6sQvnEF2")
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	// create a new account
+	nonceAccount := types.NewAccount()
+	fmt.Println("nonce account:", nonceAccount.PublicKey)
+
+	// get minimum balance
+	nonceAccountMinimumBalance, err := c.GetMinimumBalanceForRentExemption(context.Background(), system.NonceAccountSize)
+	if err != nil {
+		log.Fatalf("failed to get minimum balance for nonce account, err: %v", err)
+	}
+
+	// recent blockhash
+	recentBlockhashResponse, err := c.GetLatestBlockhash(context.Background())
+	if err != nil {
+		log.Fatalf("failed to get recent blockhash, err: %v", err)
+	}
+
+	// create a tx
+	tx, err := types.NewTransaction(types.NewTransactionParam{
+		Signers: []types.Account{feePayer, nonceAccount},
+		Message: types.NewMessage(types.NewMessageParam{
+			FeePayer:        feePayer.PublicKey,
+			RecentBlockhash: recentBlockhashResponse.Blockhash,
+			Instructions: []types.Instruction{
+				system.CreateAccount(system.CreateAccountParam{
+					From:     feePayer.PublicKey,
+					New:      nonceAccount.PublicKey,
+					Owner:    common.SystemProgramID,
+					Lamports: nonceAccountMinimumBalance,
+					Space:    system.NonceAccountSize,
+				}),
+				system.InitializeNonceAccount(system.InitializeNonceAccountParam{
+					Nonce: nonceAccount.PublicKey,
+					Auth:  alice.PublicKey,
+				}),
+			},
+		}),
+	})
+	if err != nil {
+		log.Fatalf("failed to new a transaction, err: %v", err)
+	}
+
+	sig, err := c.SendTransaction(context.Background(), tx)
+	if err != nil {
+		log.Fatalf("failed to send tx, err: %v", err)
+	}
+
+	fmt.Println("txhash", sig)
+}
+
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
Last Updated:
Contributors: yihau
+ + + diff --git a/advanced/durable-nonce/get-nonce-account-by-owner.html b/advanced/durable-nonce/get-nonce-account-by-owner.html new file mode 100644 index 00000000..c2f15a29 --- /dev/null +++ b/advanced/durable-nonce/get-nonce-account-by-owner.html @@ -0,0 +1,85 @@ + + + + + + + + + Get Nonce Account By Owner | Solana Development With Go + + + + +

Get Nonce Account By Owner

package main
+
+import (
+	"context"
+	"encoding/base64"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/program/system"
+	"github.com/blocto/solana-go-sdk/rpc"
+)
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	res, err := c.RpcClient.GetProgramAccountsWithConfig(
+		context.Background(),
+		common.SystemProgramID.ToBase58(),
+		rpc.GetProgramAccountsConfig{
+			Encoding: rpc.AccountEncodingBase64,
+			Filters: []rpc.GetProgramAccountsConfigFilter{
+				{
+					DataSize: system.NonceAccountSize,
+				},
+				{
+					MemCmp: &rpc.GetProgramAccountsConfigFilterMemCmp{
+						Offset: 8,
+						Bytes:  "9aE476sH92Vz7DMPyq5WLPkrKWivxeuTKEFKd2sZZcde", // owner address
+					},
+				},
+			},
+		},
+	)
+	if err != nil {
+		log.Fatalf("failed to get program accounts, err: %v", err)
+	}
+
+	for _, a := range res.Result {
+		fmt.Println("pubkey", a.Pubkey)
+		data, err := base64.StdEncoding.DecodeString((a.Account.Data.([]any))[0].(string))
+		if err != nil {
+			log.Fatalf("failed to decode data, err: %v", err)
+		}
+		nonceAccount, err := system.NonceAccountDeserialize(data)
+		if err != nil {
+			log.Fatalf("failed to parse nonce account, err: %v", err)
+		}
+		fmt.Printf("%+v\n", nonceAccount)
+	}
+}
+
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
Last Updated:
Contributors: yihau
+ + + diff --git a/advanced/durable-nonce/get-nonce-account.html b/advanced/durable-nonce/get-nonce-account.html new file mode 100644 index 00000000..953cfeb2 --- /dev/null +++ b/advanced/durable-nonce/get-nonce-account.html @@ -0,0 +1,84 @@ + + + + + + + + + Get Nonce Account | Solana Development With Go + + + + +

Get Nonce Account

Nonce Account

package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/rpc"
+)
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+	nonceAccountAddr := "DJyNpXgggw1WGgjTVzFsNjb3fuQZVMqhoakvSBfX9LYx"
+	nonceAccount, err := c.GetNonceAccount(context.Background(), nonceAccountAddr)
+	if err != nil {
+		log.Fatalf("failed to get nonce account, err: %v", err)
+	}
+	fmt.Printf("%+v\n", nonceAccount)
+	/*
+		type NonceAccount struct {
+			Version          uint32
+			State            uint32
+			AuthorizedPubkey common.PublicKey
+			Nonce            common.PublicKey
+			FeeCalculator    FeeCalculator
+		}
+	*/
+}
+
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

Only Nonce

package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/rpc"
+)
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	nonceAccountAddr := "DJyNpXgggw1WGgjTVzFsNjb3fuQZVMqhoakvSBfX9LYx"
+	nonce, err := c.GetNonceFromNonceAccount(context.Background(), nonceAccountAddr)
+	if err != nil {
+		log.Fatalf("failed to get nonce account, err: %v", err)
+	}
+
+	fmt.Println("nonce", nonce)
+}
+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Last Updated:
Contributors: yihau
+ + + diff --git a/advanced/durable-nonce/index.html b/advanced/durable-nonce/index.html new file mode 100644 index 00000000..a2f18a68 --- /dev/null +++ b/advanced/durable-nonce/index.html @@ -0,0 +1,33 @@ + + + + + + + + + Durable Nonce | Solana Development With Go + + + + +

Durable Nonce

A transaction includes a recent blockhash. The recent blockhash will expire after 150 blocks. (arpox. 2 min) To get rid of it, you can use durable nonce.

Mechanism

We can trigger the mechanism by

  1. use the nonce which stored in a nonce account as a recent blockhash
  2. make nonce advance instruction is the first instruciton
Last Updated:
Contributors: yihau
+ + + diff --git a/advanced/durable-nonce/upgrade-nonce.html b/advanced/durable-nonce/upgrade-nonce.html new file mode 100644 index 00000000..874b5500 --- /dev/null +++ b/advanced/durable-nonce/upgrade-nonce.html @@ -0,0 +1,141 @@ + + + + + + + + + Upgrade Nonce | Solana Development With Go + + + + +

Upgrade Nonce

Due to 2022/06/01 Solana outageopen in new window. All nonce account should be upgraded. You can update it either

  1. Advance Nonce (need origin authority signature)
package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/program/system"
+	"github.com/blocto/solana-go-sdk/rpc"
+	"github.com/blocto/solana-go-sdk/types"
+)
+
+// FUarP2p5EnxD66vVDL4PWRoWMzA56ZVHG24hpEDFShEz
+var feePayer, _ = types.AccountFromBase58("4TMFNY9ntAn3CHzguSAvDNLPRoQTaK3sWbQQXdDXaE6KWRBLufGL6PJdsD2koiEe3gGmMdRK3aAw7sikGNksHJrN")
+
+// 9aE476sH92Vz7DMPyq5WLPkrKWivxeuTKEFKd2sZZcde
+var alice, _ = types.AccountFromBase58("4voSPg3tYuWbKzimpQK9EbXHmuyy5fUrtXvpLDMLkmY6TRncaTHAKGD8jUg3maB5Jbrd9CkQg4qjJMyN6sQvnEF2")
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	// get nonce account
+	nonceAccountPubkey := common.PublicKeyFromString("5Covh7EB4HtC5ieeP7GwUH9AHySMmNicBmvXo534wEA8")
+
+	// recent blockhash
+	recentBlockhashResponse, err := c.GetLatestBlockhash(context.Background())
+	if err != nil {
+		log.Fatalf("failed to get recent blockhash, err: %v", err)
+	}
+
+	// create a tx
+	tx, err := types.NewTransaction(types.NewTransactionParam{
+		Signers: []types.Account{feePayer, alice},
+		Message: types.NewMessage(types.NewMessageParam{
+			FeePayer:        feePayer.PublicKey,
+			RecentBlockhash: recentBlockhashResponse.Blockhash,
+			Instructions: []types.Instruction{
+				system.AdvanceNonceAccount(system.AdvanceNonceAccountParam{
+					Nonce: nonceAccountPubkey,
+					Auth:  alice.PublicKey,
+				}),
+			},
+		}),
+	})
+	if err != nil {
+		log.Fatalf("failed to new a transaction, err: %v", err)
+	}
+
+	sig, err := c.SendTransaction(context.Background(), tx)
+	if err != nil {
+		log.Fatalf("failed to send tx, err: %v", err)
+	}
+
+	fmt.Println("txhash", sig)
+}
+
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
  1. Upgrade Nonce (you can use a random fee payer)
package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/program/system"
+	"github.com/blocto/solana-go-sdk/rpc"
+	"github.com/blocto/solana-go-sdk/types"
+)
+
+// FUarP2p5EnxD66vVDL4PWRoWMzA56ZVHG24hpEDFShEz
+var feePayer, _ = types.AccountFromBase58("4TMFNY9ntAn3CHzguSAvDNLPRoQTaK3sWbQQXdDXaE6KWRBLufGL6PJdsD2koiEe3gGmMdRK3aAw7sikGNksHJrN")
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	nonceAccountPubkey := common.PublicKeyFromString("DJyNpXgggw1WGgjTVzFsNjb3fuQZVMqhoakvSBfX9LYx")
+
+	// recent blockhash
+	recentBlockhashResponse, err := c.GetLatestBlockhash(context.Background())
+	if err != nil {
+		log.Fatalf("failed to get recent blockhash, err: %v", err)
+	}
+
+	tx, err := types.NewTransaction(types.NewTransactionParam{
+		Signers: []types.Account{feePayer},
+		Message: types.NewMessage(types.NewMessageParam{
+			FeePayer:        feePayer.PublicKey,
+			RecentBlockhash: recentBlockhashResponse.Blockhash,
+			Instructions: []types.Instruction{
+				system.UpgradeNonceAccount(system.UpgradeNonceAccountParam{
+					NonceAccountPubkey: nonceAccountPubkey,
+				}),
+			},
+		}),
+	})
+	if err != nil {
+		log.Fatalf("failed to new a transaction, err: %v", err)
+	}
+
+	sig, err := c.SendTransaction(context.Background(), tx)
+	if err != nil {
+		log.Fatalf("failed to send tx, err: %v", err)
+	}
+
+	fmt.Println("txhash", sig)
+}
+
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
Last Updated:
Contributors: yihau
+ + + diff --git a/advanced/durable-nonce/use-nonce.html b/advanced/durable-nonce/use-nonce.html new file mode 100644 index 00000000..a889477d --- /dev/null +++ b/advanced/durable-nonce/use-nonce.html @@ -0,0 +1,92 @@ + + + + + + + + + Use Nonce | Solana Development With Go + + + + +

Use Nonce

package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/program/memo"
+	"github.com/blocto/solana-go-sdk/program/system"
+	"github.com/blocto/solana-go-sdk/rpc"
+	"github.com/blocto/solana-go-sdk/types"
+)
+
+// FUarP2p5EnxD66vVDL4PWRoWMzA56ZVHG24hpEDFShEz
+var feePayer, _ = types.AccountFromBase58("4TMFNY9ntAn3CHzguSAvDNLPRoQTaK3sWbQQXdDXaE6KWRBLufGL6PJdsD2koiEe3gGmMdRK3aAw7sikGNksHJrN")
+
+// 9aE476sH92Vz7DMPyq5WLPkrKWivxeuTKEFKd2sZZcde
+var alice, _ = types.AccountFromBase58("4voSPg3tYuWbKzimpQK9EbXHmuyy5fUrtXvpLDMLkmY6TRncaTHAKGD8jUg3maB5Jbrd9CkQg4qjJMyN6sQvnEF2")
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	// get nonce account
+	nonceAccountPubkey := common.PublicKeyFromString("DJyNpXgggw1WGgjTVzFsNjb3fuQZVMqhoakvSBfX9LYx")
+	nonceAccount, err := c.GetNonceAccount(context.Background(), nonceAccountPubkey.ToBase58())
+	if err != nil {
+		log.Fatalf("failed to get nonce account, err: %v", err)
+	}
+
+	// create a tx
+	tx, err := types.NewTransaction(types.NewTransactionParam{
+		Signers: []types.Account{feePayer, alice},
+		Message: types.NewMessage(types.NewMessageParam{
+			FeePayer:        feePayer.PublicKey,
+			RecentBlockhash: nonceAccount.Nonce.ToBase58(),
+			Instructions: []types.Instruction{
+				system.AdvanceNonceAccount(system.AdvanceNonceAccountParam{
+					Nonce: nonceAccountPubkey,
+					Auth:  alice.PublicKey,
+				}),
+				memo.BuildMemo(memo.BuildMemoParam{
+					Memo: []byte("use nonce"),
+				}),
+			},
+		}),
+	})
+	if err != nil {
+		log.Fatalf("failed to new a transaction, err: %v", err)
+	}
+
+	sig, err := c.SendTransaction(context.Background(), tx)
+	if err != nil {
+		log.Fatalf("failed to send tx, err: %v", err)
+	}
+
+	fmt.Println("txhash", sig)
+}
+
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

TIP

You need to query nonce again after you used.

Last Updated:
Contributors: yihau
+ + + diff --git a/advanced/memo.html b/advanced/memo.html new file mode 100644 index 00000000..c5aa0bfe --- /dev/null +++ b/advanced/memo.html @@ -0,0 +1,88 @@ + + + + + + + + + Add Memo | Solana Development With Go + + + + +

Add Memo

You can add a memo to your transaction by memo instruction

package main
+
+import (
+	"context"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/program/memo"
+	"github.com/blocto/solana-go-sdk/rpc"
+	"github.com/blocto/solana-go-sdk/types"
+)
+
+// FUarP2p5EnxD66vVDL4PWRoWMzA56ZVHG24hpEDFShEz
+var feePayer, _ = types.AccountFromBase58("4TMFNY9ntAn3CHzguSAvDNLPRoQTaK3sWbQQXdDXaE6KWRBLufGL6PJdsD2koiEe3gGmMdRK3aAw7sikGNksHJrN")
+
+// 9aE476sH92Vz7DMPyq5WLPkrKWivxeuTKEFKd2sZZcde
+var alice, _ = types.AccountFromBase58("4voSPg3tYuWbKzimpQK9EbXHmuyy5fUrtXvpLDMLkmY6TRncaTHAKGD8jUg3maB5Jbrd9CkQg4qjJMyN6sQvnEF2")
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	// to fetch recent blockhash
+	recentBlockhashResponse, err := c.GetLatestBlockhash(context.Background())
+	if err != nil {
+		log.Fatalf("failed to get recent blockhash, err: %v", err)
+	}
+
+	// create a tx
+	tx, err := types.NewTransaction(types.NewTransactionParam{
+		Signers: []types.Account{feePayer, alice},
+		Message: types.NewMessage(types.NewMessageParam{
+			FeePayer:        feePayer.PublicKey,
+			RecentBlockhash: recentBlockhashResponse.Blockhash,
+			Instructions: []types.Instruction{
+				// memo instruction
+				memo.BuildMemo(memo.BuildMemoParam{
+					SignerPubkeys: []common.PublicKey{alice.PublicKey},
+					Memo:          []byte("🐳"),
+				}),
+			},
+		}),
+	})
+	if err != nil {
+		log.Fatalf("failed to new a transaction, err: %v", err)
+	}
+
+	// send tx
+	txhash, err := c.SendTransaction(context.Background(), tx)
+	if err != nil {
+		log.Fatalf("failed to send tx, err: %v", err)
+	}
+
+	log.Println("txhash:", txhash)
+}
+
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
Last Updated:
Contributors: yihau
+ + + diff --git a/assets/404.68265bf7.js b/assets/404.68265bf7.js new file mode 100644 index 00000000..c9cd9225 --- /dev/null +++ b/assets/404.68265bf7.js @@ -0,0 +1 @@ +import{f as i,u as _,g as p,r as f,o as k,c as v,a as o,t as c,b as L,w as g,h as l,d as x}from"./app.01f87ec9.js";const B={class:"theme-container"},N={class:"theme-default-content"},T=o("h1",null,"404",-1),V=i({setup(b){var a,s,n;const u=_(),e=p(),t=(a=e.value.notFound)!=null?a:["Not Found"],r=()=>t[Math.floor(Math.random()*t.length)],h=(s=e.value.home)!=null?s:u.value,m=(n=e.value.backToHome)!=null?n:"Back to home";return(C,M)=>{const d=f("RouterLink");return k(),v("div",B,[o("div",N,[T,o("blockquote",null,c(r()),1),L(d,{to:l(h)},{default:g(()=>[x(c(l(m)),1)]),_:1},8,["to"])])])}}});export{V as default}; diff --git a/assets/404.html.94d59506.js b/assets/404.html.94d59506.js new file mode 100644 index 00000000..818fcbf0 --- /dev/null +++ b/assets/404.html.94d59506.js @@ -0,0 +1 @@ +import{_ as r}from"./app.01f87ec9.js";const _={};function e(t,c){return null}var a=r(_,[["render",e]]);export{a as default}; diff --git a/assets/404.html.e275e9a9.js b/assets/404.html.e275e9a9.js new file mode 100644 index 00000000..fa2a247a --- /dev/null +++ b/assets/404.html.e275e9a9.js @@ -0,0 +1 @@ +const t={key:"v-3706649a",path:"/404.html",title:"",lang:"en-US",frontmatter:{layout:"404"},excerpt:"",headers:[],git:{},filePathRelative:null};export{t as data}; diff --git a/assets/Layout.5cbefb08.js b/assets/Layout.5cbefb08.js new file mode 100644 index 00000000..7cf33db4 --- /dev/null +++ b/assets/Layout.5cbefb08.js @@ -0,0 +1 @@ +var Be=Object.defineProperty,Me=Object.defineProperties;var De=Object.getOwnPropertyDescriptors;var de=Object.getOwnPropertySymbols;var Ne=Object.prototype.hasOwnProperty,Ee=Object.prototype.propertyIsEnumerable;var ve=(l,t,e)=>t in l?Be(l,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):l[t]=e,X=(l,t)=>{for(var e in t||(t={}))Ne.call(t,e)&&ve(l,e,t[e]);if(de)for(var e of de(t))Ee.call(t,e)&&ve(l,e,t[e]);return l},Y=(l,t)=>Me(l,De(t));import{_ as Ie,r as R,o as a,c,b as $,f as x,i as I,j as p,k as _e,h as n,F as D,l as A,m as w,a as g,t as T,n as G,p as J,q as C,w as B,s as pe,v as y,d as U,x as q,y as Pe,z as Re,A as Ae,B as Q,C as Z,D as V,E as fe,G as me,H as P,u as be,g as M,T as ge,I as O,J as He,K as j,L as K,M as Oe,N as ze,O as ee,P as ke,Q as $e,e as Fe,R as Le,S as We,U as W,V as te,W as Ue,X as Ve,Y as je,Z as Ke}from"./app.01f87ec9.js";const Ge={},qe={class:"theme-default-content custom"};function Xe(l,t){const e=R("Content");return a(),c("div",qe,[$(e)])}var Ye=Ie(Ge,[["render",Xe]]);const Je={key:0,class:"features"},Qe=x({setup(l){const t=I(),e=p(()=>_e(t.value.features)?t.value.features:[]);return(i,r)=>n(e).length?(a(),c("div",Je,[(a(!0),c(D,null,A(n(e),_=>(a(),c("div",{key:_.title,class:"feature"},[g("h2",null,T(_.title),1),g("p",null,T(_.details),1)]))),128))])):w("",!0)}}),Ze=["innerHTML"],et=["textContent"],tt=x({setup(l){const t=I(),e=p(()=>t.value.footer),i=p(()=>t.value.footerHtml);return(r,_)=>n(e)?(a(),c(D,{key:0},[n(i)?(a(),c("div",{key:0,class:"footer",innerHTML:n(e)},null,8,Ze)):(a(),c("div",{key:1,class:"footer",textContent:T(n(e))},null,8,et))],64)):w("",!0)}}),nt=["href","rel","target","aria-label"],at=x({inheritAttrs:!1}),E=x(Y(X({},at),{props:{item:{type:Object,required:!0}},setup(l){const t=l,e=G(),i=Ae(),{item:r}=J(t),_=p(()=>q(r.value.link)),f=p(()=>Pe(r.value.link)||Re(r.value.link)),h=p(()=>{if(!f.value){if(r.value.target)return r.value.target;if(_.value)return"_blank"}}),s=p(()=>h.value==="_blank"),o=p(()=>!_.value&&!f.value&&!s.value),u=p(()=>{if(!f.value){if(r.value.rel)return r.value.rel;if(s.value)return"noopener noreferrer"}}),d=p(()=>r.value.ariaLabel||r.value.text),v=p(()=>{const L=Object.keys(i.value.locales);return L.length?!L.some(m=>m===r.value.link):r.value.link!=="/"}),b=p(()=>v.value?e.path.startsWith(r.value.link):!1),k=p(()=>o.value?r.value.activeMatch?new RegExp(r.value.activeMatch).test(e.path):b.value:!1);return(L,m)=>{const S=R("RouterLink"),N=R("ExternalLinkIcon");return n(o)?(a(),C(S,pe({key:0,class:{"router-link-active":n(k)},to:n(r).link,"aria-label":n(d)},L.$attrs),{default:B(()=>[y(L.$slots,"before"),U(" "+T(n(r).text)+" ",1),y(L.$slots,"after")]),_:3},16,["class","to","aria-label"])):(a(),c("a",pe({key:1,class:"external-link",href:n(r).link,rel:n(u),target:n(h),"aria-label":n(d)},L.$attrs),[y(L.$slots,"before"),U(" "+T(n(r).text)+" ",1),n(s)?(a(),C(N,{key:0})):w("",!0),y(L.$slots,"after")],16,nt))}}})),st={class:"hero"},rt={key:0,id:"main-title"},ot={key:1,class:"description"},lt={key:2,class:"actions"},ut=x({setup(l){const t=I(),e=Q(),i=Z(),r=p(()=>i.value&&t.value.heroImageDark!==void 0?t.value.heroImageDark:t.value.heroImage),_=p(()=>t.value.heroText===null?null:t.value.heroText||e.value.title||"Hello"),f=p(()=>t.value.heroAlt||_.value||"hero"),h=p(()=>t.value.tagline===null?null:t.value.tagline||e.value.description||"Welcome to your VuePress site"),s=p(()=>_e(t.value.actions)?t.value.actions.map(({text:u,link:d,type:v="primary"})=>({text:u,link:d,type:v})):[]),o=()=>{if(!r.value)return null;const u=V("img",{src:fe(r.value),alt:f.value});return t.value.heroImageDark===void 0?u:V(me,u)};return(u,d)=>(a(),c("header",st,[$(o),n(_)?(a(),c("h1",rt,T(n(_)),1)):w("",!0),n(h)?(a(),c("p",ot,T(n(h)),1)):w("",!0),n(s).length?(a(),c("p",lt,[(a(!0),c(D,null,A(n(s),v=>(a(),C(E,{key:v.text,class:P(["action-button",[v.type]]),item:v},null,8,["class","item"]))),128))])):w("",!0)]))}}),it={class:"home"},ct=x({setup(l){return(t,e)=>(a(),c("main",it,[$(ut),$(Qe),$(Ye),$(tt)]))}}),dt=x({setup(l){const t=be(),e=Q(),i=M(),r=Z(),_=p(()=>i.value.home||t.value),f=p(()=>e.value.title),h=p(()=>r.value&&i.value.logoDark!==void 0?i.value.logoDark:i.value.logo),s=()=>{if(!h.value)return null;const o=V("img",{class:"logo",src:fe(h.value),alt:f.value});return i.value.logoDark===void 0?o:V(me,o)};return(o,u)=>{const d=R("RouterLink");return a(),C(d,{to:n(_)},{default:B(()=>[$(s),n(f)?(a(),c("span",{key:0,class:P(["site-name",{"can-hide":n(h)}])},T(n(f)),3)):w("",!0)]),_:1},8,["to"])}}}),ye=x({setup(l){const t=i=>{i.style.height=i.scrollHeight+"px"},e=i=>{i.style.height=""};return(i,r)=>(a(),C(ge,{name:"dropdown",onEnter:t,onAfterEnter:e,onBeforeLeave:t},{default:B(()=>[y(i.$slots,"default")]),_:3}))}}),vt=["aria-label"],pt={class:"title"},ht=g("span",{class:"arrow down"},null,-1),_t=["aria-label"],ft={class:"title"},mt={class:"navbar-dropdown"},bt={class:"navbar-dropdown-subtitle"},gt={key:1},kt={class:"navbar-dropdown-subitem-wrapper"},$t=x({props:{item:{type:Object,required:!0}},setup(l){const t=l,{item:e}=J(t),i=p(()=>e.value.ariaLabel||e.value.text),r=O(!1),_=G();He(()=>_.path,()=>{r.value=!1});const f=s=>{s.detail===0?r.value=!r.value:r.value=!1},h=(s,o)=>o[o.length-1]===s;return(s,o)=>(a(),c("div",{class:P(["navbar-dropdown-wrapper",{open:r.value}])},[g("button",{class:"navbar-dropdown-title",type:"button","aria-label":n(i),onClick:f},[g("span",pt,T(n(e).text),1),ht],8,vt),g("button",{class:"navbar-dropdown-title-mobile",type:"button","aria-label":n(i),onClick:o[0]||(o[0]=u=>r.value=!r.value)},[g("span",ft,T(n(e).text),1),g("span",{class:P(["arrow",r.value?"down":"right"])},null,2)],8,_t),$(ye,null,{default:B(()=>[j(g("ul",mt,[(a(!0),c(D,null,A(n(e).children,u=>(a(),c("li",{key:u.text,class:"navbar-dropdown-item"},[u.children?(a(),c(D,{key:0},[g("h4",bt,[u.link?(a(),C(E,{key:0,item:u,onFocusout:d=>h(u,n(e).children)&&u.children.length===0&&(r.value=!1)},null,8,["item","onFocusout"])):(a(),c("span",gt,T(u.text),1))]),g("ul",kt,[(a(!0),c(D,null,A(u.children,d=>(a(),c("li",{key:d.link,class:"navbar-dropdown-subitem"},[$(E,{item:d,onFocusout:v=>h(d,u.children)&&h(u,n(e).children)&&(r.value=!1)},null,8,["item","onFocusout"])]))),128))])],64)):(a(),C(E,{key:1,item:u,onFocusout:d=>h(u,n(e).children)&&(r.value=!1)},null,8,["item","onFocusout"]))]))),128))],512),[[K,r.value]])]),_:1})],2))}}),he=l=>decodeURI(l).replace(/#.*$/,"").replace(/(index)?\.(md|html)$/,""),Lt=(l,t)=>{if(t.hash===l)return!0;const e=he(t.path),i=he(l);return e===i},we=(l,t)=>l.link&&Lt(l.link,t)?!0:l.children?l.children.some(e=>we(e,t)):!1,xe=l=>!q(l)||/github\.com/.test(l)?"GitHub":/bitbucket\.org/.test(l)?"Bitbucket":/gitlab\.com/.test(l)?"GitLab":/gitee\.com/.test(l)?"Gitee":null,yt={GitHub:":repo/edit/:branch/:path",GitLab:":repo/-/edit/:branch/:path",Gitee:":repo/edit/:branch/:path",Bitbucket:":repo/src/:branch/:path?mode=edit&spa=0&at=:branch&fileviewer=file-view-default"},wt=({docsRepo:l,editLinkPattern:t})=>{if(t)return t;const e=xe(l);return e!==null?yt[e]:null},xt=({docsRepo:l,docsBranch:t,docsDir:e,filePathRelative:i,editLinkPattern:r})=>{if(!i)return null;const _=wt({docsRepo:l,editLinkPattern:r});return _?_.replace(/:repo/,q(l)?l:`https://github.com/${l}`).replace(/:branch/,t).replace(/:path/,Oe(`${ze(e)}/${i}`)):null},Ct={key:0,class:"navbar-items"},Ce=x({setup(l){const t=()=>{const o=ee(),u=be(),d=Q(),v=M();return p(()=>{var S,N;const b=Object.keys(d.value.locales);if(b.length<2)return[];const k=o.currentRoute.value.path,L=o.currentRoute.value.fullPath;return[{text:(S=v.value.selectLanguageText)!=null?S:"unknown language",ariaLabel:(N=v.value.selectLanguageAriaLabel)!=null?N:"unkown language",children:b.map(H=>{var se,re,oe,le,ue,ie;const z=(re=(se=d.value.locales)==null?void 0:se[H])!=null?re:{},ne=(le=(oe=v.value.locales)==null?void 0:oe[H])!=null?le:{},ae=`${z.lang}`,Te=(ue=ne.selectLanguageName)!=null?ue:ae;let F;if(ae===d.value.lang)F=L;else{const ce=k.replace(u.value,H);o.getRoutes().some(Se=>Se.path===ce)?F=ce:F=(ie=ne.home)!=null?ie:H}return{text:Te,link:F}})}]})},e=()=>{const o=M(),u=p(()=>o.value.repo),d=p(()=>u.value?xe(u.value):null),v=p(()=>u.value&&!q(u.value)?`https://github.com/${u.value}`:u.value),b=p(()=>v.value?o.value.repoLabel?o.value.repoLabel:d.value===null?"Source":d.value:null);return p(()=>!v.value||!b.value?[]:[{text:b.value,link:v.value}])},i=o=>ke(o)?$e(o):o.children?Y(X({},o),{children:o.children.map(i)}):o,_=(()=>{const o=M();return p(()=>(o.value.navbar||[]).map(i))})(),f=t(),h=e(),s=p(()=>[..._.value,...f.value,...h.value]);return(o,u)=>n(s).length?(a(),c("nav",Ct,[(a(!0),c(D,null,A(n(s),d=>(a(),c("div",{key:d.text,class:"navbar-item"},[d.children?(a(),C($t,{key:0,item:d},null,8,["item"])):(a(),C(E,{key:1,item:d},null,8,["item"]))]))),128))])):w("",!0)}}),Tt=["title"],St={class:"icon",focusable:"false",viewBox:"0 0 32 32"},Bt=Fe('',9),Mt=[Bt],Dt={class:"icon",focusable:"false",viewBox:"0 0 32 32"},Nt=g("path",{d:"M13.502 5.414a15.075 15.075 0 0 0 11.594 18.194a11.113 11.113 0 0 1-7.975 3.39c-.138 0-.278.005-.418 0a11.094 11.094 0 0 1-3.2-21.584M14.98 3a1.002 1.002 0 0 0-.175.016a13.096 13.096 0 0 0 1.825 25.981c.164.006.328 0 .49 0a13.072 13.072 0 0 0 10.703-5.555a1.01 1.01 0 0 0-.783-1.565A13.08 13.08 0 0 1 15.89 4.38A1.015 1.015 0 0 0 14.98 3z",fill:"currentColor"},null,-1),Et=[Nt],It=x({setup(l){const t=M(),e=Z(),i=()=>{e.value=!e.value};return(r,_)=>(a(),c("button",{class:"toggle-dark-button",title:n(t).toggleDarkMode,onClick:i},[j((a(),c("svg",St,Mt,512)),[[K,!n(e)]]),j((a(),c("svg",Dt,Et,512)),[[K,n(e)]])],8,Tt))}}),Pt=["title"],Rt=g("div",{class:"icon","aria-hidden":"true"},[g("span"),g("span"),g("span")],-1),At=[Rt],Ht=x({emits:["toggle"],setup(l){const t=M();return(e,i)=>(a(),c("div",{class:"toggle-sidebar-button",title:n(t).toggleSidebar,"aria-expanded":"false",role:"button",tabindex:"0",onClick:i[0]||(i[0]=r=>e.$emit("toggle"))},At,8,Pt))}}),Ot=x({emits:["toggle-sidebar"],setup(l){const t=M(),e=O(null),i=O(null),r=O(0),_=p(()=>r.value?{maxWidth:r.value+"px"}:{}),f=p(()=>t.value.darkMode);Le(()=>{const o=h(e.value,"paddingLeft")+h(e.value,"paddingRight"),u=()=>{var d;window.innerWidth<=719?r.value=0:r.value=e.value.offsetWidth-o-(((d=i.value)==null?void 0:d.offsetWidth)||0)};u(),window.addEventListener("resize",u,!1),window.addEventListener("orientationchange",u,!1)});function h(s,o){var v,b,k;const u=(k=(b=(v=s==null?void 0:s.ownerDocument)==null?void 0:v.defaultView)==null?void 0:b.getComputedStyle(s,null))==null?void 0:k[o],d=Number.parseInt(u,10);return Number.isNaN(d)?0:d}return(s,o)=>{const u=R("NavbarSearch");return a(),c("header",{ref_key:"navbar",ref:e,class:"navbar"},[$(Ht,{onToggle:o[0]||(o[0]=d=>s.$emit("toggle-sidebar"))}),g("span",{ref_key:"navbarBrand",ref:i},[$(dt)],512),g("div",{class:"navbar-items-wrapper",style:We(n(_))},[y(s.$slots,"before"),$(Ce,{class:"can-hide"}),y(s.$slots,"after"),n(f)?(a(),C(It,{key:0})):w("",!0),$(u)],4)],512)}}}),zt={class:"page-meta"},Ft={key:0,class:"meta-item edit-link"},Wt={key:1,class:"meta-item last-updated"},Ut={class:"meta-item-label"},Vt={class:"meta-item-info"},jt={key:2,class:"meta-item contributors"},Kt={class:"meta-item-label"},Gt={class:"meta-item-info"},qt=["title"],Xt=U(", "),Yt=x({setup(l){const t=()=>{const s=M(),o=W(),u=I();return p(()=>{var N,H,z;if(!((H=(N=u.value.editLink)!=null?N:s.value.editLink)!=null?H:!0))return null;const{repo:v,docsRepo:b=v,docsBranch:k="main",docsDir:L="",editLinkText:m}=s.value;if(!b)return null;const S=xt({docsRepo:b,docsBranch:k,docsDir:L,filePathRelative:o.value.filePathRelative,editLinkPattern:(z=u.value.editLinkPattern)!=null?z:s.value.editLinkPattern});return S?{text:m!=null?m:"Edit this page",link:S}:null})},e=()=>{const s=M(),o=W(),u=I();return p(()=>{var b,k,L,m;return!((k=(b=u.value.lastUpdated)!=null?b:s.value.lastUpdated)!=null?k:!0)||!((L=o.value.git)==null?void 0:L.updatedTime)?null:new Date((m=o.value.git)==null?void 0:m.updatedTime).toLocaleString()})},i=()=>{const s=M(),o=W(),u=I();return p(()=>{var v,b,k,L;return((b=(v=u.value.contributors)!=null?v:s.value.contributors)!=null?b:!0)&&(L=(k=o.value.git)==null?void 0:k.contributors)!=null?L:null})},r=M(),_=t(),f=e(),h=i();return(s,o)=>{const u=R("ClientOnly");return a(),c("footer",zt,[n(_)?(a(),c("div",Ft,[$(E,{class:"meta-item-label",item:n(_)},null,8,["item"])])):w("",!0),n(f)?(a(),c("div",Wt,[g("span",Ut,T(n(r).lastUpdatedText)+": ",1),$(u,null,{default:B(()=>[g("span",Vt,T(n(f)),1)]),_:1})])):w("",!0),n(h)&&n(h).length?(a(),c("div",jt,[g("span",Kt,T(n(r).contributorsText)+": ",1),g("span",Gt,[(a(!0),c(D,null,A(n(h),(d,v)=>(a(),c(D,{key:v},[g("span",{class:"contributor",title:`email: ${d.email}`},T(d.name),9,qt),v!==n(h).length-1?(a(),c(D,{key:0},[Xt],64)):w("",!0)],64))),128))])])):w("",!0)])}}}),Jt={key:0,class:"page-nav"},Qt={class:"inner"},Zt={key:0,class:"prev"},en={key:1,class:"next"},tn=x({setup(l){const t=s=>s===!1?null:ke(s)?$e(s):Ue(s)?s:!1,e=(s,o,u)=>{const d=s.findIndex(v=>v.link===o);if(d!==-1){const v=s[d+u];return(v==null?void 0:v.link)?v:null}for(const v of s)if(v.children){const b=e(v.children,o,u);if(b)return b}return null},i=I(),r=te(),_=G(),f=p(()=>{const s=t(i.value.prev);return s!==!1?s:e(r.value,_.path,-1)}),h=p(()=>{const s=t(i.value.next);return s!==!1?s:e(r.value,_.path,1)});return(s,o)=>n(f)||n(h)?(a(),c("nav",Jt,[g("p",Qt,[n(f)?(a(),c("span",Zt,[$(E,{item:n(f)},null,8,["item"])])):w("",!0),n(h)?(a(),c("span",en,[$(E,{item:n(h)},null,8,["item"])])):w("",!0)])])):w("",!0)}}),nn={class:"page"},an={class:"theme-default-content"},sn=x({setup(l){return(t,e)=>{const i=R("Content");return a(),c("main",nn,[y(t.$slots,"top"),g("div",an,[$(i)]),$(Yt),$(tn),y(t.$slots,"bottom")])}}}),rn={class:"sidebar-item-children"},on=x({props:{item:{type:Object,required:!0},depth:{type:Number,required:!1,default:0}},setup(l){const t=l,{item:e,depth:i}=J(t),r=G(),_=ee(),f=p(()=>we(e.value,r)),h=p(()=>({"sidebar-item":!0,"sidebar-heading":i.value===0,active:f.value,collapsible:e.value.collapsible})),s=O(!0),o=O(void 0);return e.value.collapsible&&(s.value=f.value,o.value=()=>{s.value=!s.value},_.afterEach(()=>{s.value=f.value})),(u,d)=>{var b;const v=R("SidebarItem",!0);return a(),c("li",null,[n(e).link?(a(),C(E,{key:0,class:P(n(h)),item:n(e)},null,8,["class","item"])):(a(),c("p",{key:1,tabindex:"0",class:P(n(h)),onClick:d[0]||(d[0]=(...k)=>o.value&&o.value(...k)),onKeydown:d[1]||(d[1]=Ve((...k)=>o.value&&o.value(...k),["enter"]))},[U(T(n(e).text)+" ",1),n(e).collapsible?(a(),c("span",{key:0,class:P(["arrow",s.value?"down":"right"])},null,2)):w("",!0)],34)),((b=n(e).children)==null?void 0:b.length)?(a(),C(ye,{key:2},{default:B(()=>[j(g("ul",rn,[(a(!0),c(D,null,A(n(e).children,k=>(a(),C(v,{key:`${n(i)}${k.text}${k.link}`,item:k,depth:n(i)+1},null,8,["item","depth"]))),128))],512),[[K,s.value]])]),_:1})):w("",!0)])}}}),ln={key:0,class:"sidebar-items"},un=x({setup(l){const t=te();return(e,i)=>n(t).length?(a(),c("ul",ln,[(a(!0),c(D,null,A(n(t),r=>(a(),C(on,{key:r.link||r.text,item:r},null,8,["item"]))),128))])):w("",!0)}}),cn={class:"sidebar"},dn=x({setup(l){return(t,e)=>(a(),c("aside",cn,[$(Ce),y(t.$slots,"top"),$(un),y(t.$slots,"bottom")]))}}),hn=x({setup(l){const t=W(),e=I(),i=M(),r=p(()=>e.value.navbar!==!1&&i.value.navbar!==!1),_=te(),f=O(!1),h=m=>{f.value=typeof m=="boolean"?m:!f.value},s={x:0,y:0},o=m=>{s.x=m.changedTouches[0].clientX,s.y=m.changedTouches[0].clientY},u=m=>{const S=m.changedTouches[0].clientX-s.x,N=m.changedTouches[0].clientY-s.y;Math.abs(S)>Math.abs(N)&&Math.abs(S)>40&&(S>0&&s.x<=80?h(!0):h(!1))},d=p(()=>[{"no-navbar":!r.value,"no-sidebar":!_.value.length,"sidebar-open":f.value},e.value.pageClass]);let v;Le(()=>{v=ee().afterEach(()=>{h(!1)})}),je(()=>{v()});const b=Ke(),k=b.resolve,L=b.pending;return(m,S)=>(a(),c("div",{class:P(["theme-container",n(d)]),onTouchstart:o,onTouchend:u},[y(m.$slots,"navbar",{},()=>[n(r)?(a(),C(Ot,{key:0,onToggleSidebar:h},{before:B(()=>[y(m.$slots,"navbar-before")]),after:B(()=>[y(m.$slots,"navbar-after")]),_:3})):w("",!0)]),g("div",{class:"sidebar-mask",onClick:S[0]||(S[0]=N=>h(!1))}),y(m.$slots,"sidebar",{},()=>[$(dn,null,{top:B(()=>[y(m.$slots,"sidebar-top")]),bottom:B(()=>[y(m.$slots,"sidebar-bottom")]),_:3})]),y(m.$slots,"page",{},()=>[n(e).home?(a(),C(ct,{key:0})):(a(),C(ge,{key:1,name:"fade-slide-y",mode:"out-in",onBeforeEnter:n(k),onBeforeLeave:n(L)},{default:B(()=>[(a(),C(sn,{key:n(t).path},{top:B(()=>[y(m.$slots,"page-top")]),bottom:B(()=>[y(m.$slots,"page-bottom")]),_:3}))]),_:3},8,["onBeforeEnter","onBeforeLeave"]))])],34))}});export{hn as default}; diff --git a/assets/accounts.html.26bf1d29.js b/assets/accounts.html.26bf1d29.js new file mode 100644 index 00000000..95a8911c --- /dev/null +++ b/assets/accounts.html.26bf1d29.js @@ -0,0 +1 @@ +const e={key:"v-da536522",path:"/programs/101/accounts.html",title:"Accounts",lang:"en-US",frontmatter:{},excerpt:"",headers:[{level:3,title:"client",slug:"client",children:[]},{level:3,title:"program",slug:"program",children:[]}],git:{updatedTime:1685469006e3,contributors:[{name:"Yihau Chen",email:"a122092487@gmail.com",commits:1}]},filePathRelative:"programs/101/accounts.md"};export{e as data}; diff --git a/assets/accounts.html.96e253f2.js b/assets/accounts.html.96e253f2.js new file mode 100644 index 00000000..27ef8ed9 --- /dev/null +++ b/assets/accounts.html.96e253f2.js @@ -0,0 +1,115 @@ +import{_ as n,e as s}from"./app.01f87ec9.js";const a={},t=s(`

Accounts

client

// an account meta list indicates which accounts will be used in a program.
+// we can only read/write accounts in progarms via this list.
+// (except some official vars)
+
+// an account meta includs
+//   - isSigner
+//     when an account is a signer. it needs to sign the tx.
+//   - isWritable
+//     when an account is writable. its data can be modified in this tx.
+
+package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/rpc"
+	"github.com/blocto/solana-go-sdk/types"
+)
+
+// FUarP2p5EnxD66vVDL4PWRoWMzA56ZVHG24hpEDFShEz
+var feePayer, _ = types.AccountFromBase58("4TMFNY9ntAn3CHzguSAvDNLPRoQTaK3sWbQQXdDXaE6KWRBLufGL6PJdsD2koiEe3gGmMdRK3aAw7sikGNksHJrN")
+
+var programId = common.PublicKeyFromString("CDKLz6tftV4kSD8sPVBD6ACqZpDY4Zuxf8rgSEYzR4M2")
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	res, err := c.GetLatestBlockhash(context.Background())
+	if err != nil {
+		log.Fatalf("failed to get latest blockhash, err: %v\\n", err)
+	}
+
+	firstAccount := types.NewAccount()
+	fmt.Printf("first account: %v\\n", firstAccount.PublicKey)
+
+	secondAccount := types.NewAccount()
+	fmt.Printf("second account: %v\\n", secondAccount.PublicKey)
+
+	tx, err := types.NewTransaction(types.NewTransactionParam{
+		Signers: []types.Account{feePayer, firstAccount},
+		Message: types.NewMessage(types.NewMessageParam{
+			FeePayer:        feePayer.PublicKey,
+			RecentBlockhash: res.Blockhash,
+			Instructions: []types.Instruction{
+				{
+					ProgramID: programId,
+					Accounts: []types.AccountMeta{
+						{
+							PubKey:     firstAccount.PublicKey,
+							IsSigner:   true,
+							IsWritable: false,
+						},
+						{
+							PubKey:     secondAccount.PublicKey,
+							IsSigner:   false,
+							IsWritable: true,
+						},
+					},
+					Data: []byte{},
+				},
+			},
+		}),
+	})
+	if err != nil {
+		log.Fatalf("failed to new a tx, err: %v", err)
+	}
+
+	sig, err := c.SendTransaction(context.Background(), tx)
+	if err != nil {
+		log.Fatalf("failed to send the tx, err: %v", err)
+	}
+
+	// 4jYHKXhZMoDL3HsRuYhFPhCiQJhtNjDzPv8FhSnH6cMi9mwBjgW649uoqvfBjpGbkdFB53NEUux6oq3GUV8e9YQA
+	fmt.Println(sig)
+}
+
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

program

use solana_program::{
+    account_info::{next_account_info, AccountInfo},
+    entrypoint,
+    entrypoint::ProgramResult,
+    msg,
+    pubkey::Pubkey,
+};
+
+entrypoint!(process_instruction);
+
+fn process_instruction(
+    _program_id: &Pubkey,
+    accounts: &[AccountInfo],
+    _instruction_data: &[u8],
+) -> ProgramResult {
+    let account_info_iter = &mut accounts.iter();
+
+    let first_account_info = next_account_info(account_info_iter)?;
+    msg!(&format!(
+        "first: {} isSigner: {}, isWritable: {}",
+        first_account_info.key.to_string(),
+        first_account_info.is_signer,
+        first_account_info.is_writable,
+    ));
+
+    let second_account_info = next_account_info(account_info_iter)?;
+    msg!(&format!(
+        "second: {} isSigner: {}, isWritable: {}",
+        second_account_info.key.to_string(),
+        second_account_info.is_signer,
+        second_account_info.is_writable,
+    ));
+
+    Ok(())
+}
+
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
`,5);function p(c,o){return t}var u=n(a,[["render",p]]);export{u as default}; diff --git a/assets/app.01f87ec9.js b/assets/app.01f87ec9.js new file mode 100644 index 00000000..422cd54b --- /dev/null +++ b/assets/app.01f87ec9.js @@ -0,0 +1,8 @@ +var dl=Object.defineProperty,hl=Object.defineProperties;var pl=Object.getOwnPropertyDescriptors;var Co=Object.getOwnPropertySymbols;var ml=Object.prototype.hasOwnProperty,gl=Object.prototype.propertyIsEnumerable;var Ao=(e,t,n)=>t in e?dl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,We=(e,t)=>{for(var n in t||(t={}))ml.call(t,n)&&Ao(e,n,t[n]);if(Co)for(var n of Co(t))gl.call(t,n)&&Ao(e,n,t[n]);return e},Pn=(e,t)=>hl(e,pl(t));const yo={};function jr(e,t){const n=Object.create(null),r=e.split(",");for(let o=0;o!!n[o.toLowerCase()]:o=>!!n[o]}const vl="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",_l=jr(vl);function Ps(e){return!!e||e===""}function $t(e){if(J(e)){const t={};for(let n=0;n{if(n){const r=n.split(yl);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function Rt(e){let t="";if(he(e))t=e;else if(J(e))for(let n=0;nhe(e)?e:e==null?"":J(e)||be(e)&&(e.toString===Is||!ee(e.toString))?JSON.stringify(e,Os,2):String(e),Os=(e,t)=>t&&t.__v_isRef?Os(e,t.value):Ft(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,o])=>(n[`${r} =>`]=o,n),{})}:Ls(t)?{[`Set(${t.size})`]:[...t.values()]}:be(t)&&!J(t)&&!Bs(t)?String(t):t,de={},Ht=[],Ue=()=>{},wl=()=>!1,Tl=/^on[^a-z]/,Tn=e=>Tl.test(e),Vr=e=>e.startsWith("onUpdate:"),Ce=Object.assign,Ur=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},Cl=Object.prototype.hasOwnProperty,oe=(e,t)=>Cl.call(e,t),J=Array.isArray,Ft=e=>Xn(e)==="[object Map]",Ls=e=>Xn(e)==="[object Set]",ee=e=>typeof e=="function",he=e=>typeof e=="string",qr=e=>typeof e=="symbol",be=e=>e!==null&&typeof e=="object",ks=e=>be(e)&&ee(e.then)&&ee(e.catch),Is=Object.prototype.toString,Xn=e=>Is.call(e),Al=e=>Xn(e).slice(8,-1),Bs=e=>Xn(e)==="[object Object]",Kr=e=>he(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,an=jr(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),er=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},xl=/-(\w)/g,Qe=er(e=>e.replace(xl,(t,n)=>n?n.toUpperCase():"")),Sl=/\B([A-Z])/g,Ot=er(e=>e.replace(Sl,"-$1").toLowerCase()),tr=er(e=>e.charAt(0).toUpperCase()+e.slice(1)),ur=er(e=>e?`on${tr(e)}`:""),gn=(e,t)=>!Object.is(e,t),fr=(e,t)=>{for(let n=0;n{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value:n})},Ms=e=>{const t=parseFloat(e);return isNaN(t)?e:t};let xo;const Pl=()=>xo||(xo=typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{});let Fe;class Rl{constructor(t=!1){this.active=!0,this.effects=[],this.cleanups=[],!t&&Fe&&(this.parent=Fe,this.index=(Fe.scopes||(Fe.scopes=[])).push(this)-1)}run(t){if(this.active)try{return Fe=this,t()}finally{Fe=this.parent}}on(){Fe=this}off(){Fe=this.parent}stop(t){if(this.active){let n,r;for(n=0,r=this.effects.length;n{const t=new Set(e);return t.w=0,t.n=0,t},Ds=e=>(e.w&pt)>0,Ns=e=>(e.n&pt)>0,Il=({deps:e})=>{if(e.length)for(let t=0;t{const{deps:t}=e;if(t.length){let n=0;for(let r=0;r{(c==="length"||c>=r)&&l.push(a)});else switch(n!==void 0&&l.push(i.get(n)),t){case"add":J(e)?Kr(n)&&l.push(i.get("length")):(l.push(i.get(Ct)),Ft(e)&&l.push(i.get(Ar)));break;case"delete":J(e)||(l.push(i.get(Ct)),Ft(e)&&l.push(i.get(Ar)));break;case"set":Ft(e)&&l.push(i.get(Ct));break}if(l.length===1)l[0]&&xr(l[0]);else{const a=[];for(const c of l)c&&a.push(...c);xr(Wr(a))}}function xr(e,t){for(const n of J(e)?e:[...e])(n!==Ye||n.allowRecurse)&&(n.scheduler?n.scheduler():n.run())}const Ml=jr("__proto__,__v_isRef,__isVue"),zs=new Set(Object.getOwnPropertyNames(Symbol).map(e=>Symbol[e]).filter(qr)),Dl=Yr(),Nl=Yr(!1,!0),Hl=Yr(!0),Po=Fl();function Fl(){const e={};return["includes","indexOf","lastIndexOf"].forEach(t=>{e[t]=function(...n){const r=se(this);for(let s=0,i=this.length;s{e[t]=function(...n){Gt();const r=se(this)[t].apply(this,n);return Yt(),r}}),e}function Yr(e=!1,t=!1){return function(r,o,s){if(o==="__v_isReactive")return!e;if(o==="__v_isReadonly")return e;if(o==="__v_isShallow")return t;if(o==="__v_raw"&&s===(e?t?ta:qs:t?Us:Vs).get(r))return r;const i=J(r);if(!e&&i&&oe(Po,o))return Reflect.get(Po,o,s);const l=Reflect.get(r,o,s);return(qr(o)?zs.has(o):Ml(o))||(e||Me(r,"get",o),t)?l:we(l)?!i||!Kr(o)?l.value:l:be(l)?e?Zr(l):Jt(l):l}}const zl=$s(),$l=$s(!0);function $s(e=!1){return function(n,r,o,s){let i=n[r];if(vn(i)&&we(i)&&!we(o))return!1;if(!e&&!vn(o)&&(Ks(o)||(o=se(o),i=se(i)),!J(n)&&we(i)&&!we(o)))return i.value=o,!0;const l=J(n)&&Kr(r)?Number(r)e,nr=e=>Reflect.getPrototypeOf(e);function Rn(e,t,n=!1,r=!1){e=e.__v_raw;const o=se(e),s=se(t);t!==s&&!n&&Me(o,"get",t),!n&&Me(o,"get",s);const{has:i}=nr(o),l=r?Jr:n?eo:_n;if(i.call(o,t))return l(e.get(t));if(i.call(o,s))return l(e.get(s));e!==o&&e.get(t)}function On(e,t=!1){const n=this.__v_raw,r=se(n),o=se(e);return e!==o&&!t&&Me(r,"has",e),!t&&Me(r,"has",o),e===o?n.has(e):n.has(e)||n.has(o)}function Ln(e,t=!1){return e=e.__v_raw,!t&&Me(se(e),"iterate",Ct),Reflect.get(e,"size",e)}function Ro(e){e=se(e);const t=se(this);return nr(t).has.call(t,e)||(t.add(e),nt(t,"add",e,e)),this}function Oo(e,t){t=se(t);const n=se(this),{has:r,get:o}=nr(n);let s=r.call(n,e);s||(e=se(e),s=r.call(n,e));const i=o.call(n,e);return n.set(e,t),s?gn(t,i)&&nt(n,"set",e,t):nt(n,"add",e,t),this}function Lo(e){const t=se(this),{has:n,get:r}=nr(t);let o=n.call(t,e);o||(e=se(e),o=n.call(t,e)),r&&r.call(t,e);const s=t.delete(e);return o&&nt(t,"delete",e,void 0),s}function ko(){const e=se(this),t=e.size!==0,n=e.clear();return t&&nt(e,"clear",void 0,void 0),n}function kn(e,t){return function(r,o){const s=this,i=s.__v_raw,l=se(i),a=t?Jr:e?eo:_n;return!e&&Me(l,"iterate",Ct),i.forEach((c,f)=>r.call(o,a(c),a(f),s))}}function In(e,t,n){return function(...r){const o=this.__v_raw,s=se(o),i=Ft(s),l=e==="entries"||e===Symbol.iterator&&i,a=e==="keys"&&i,c=o[e](...r),f=n?Jr:t?eo:_n;return!t&&Me(s,"iterate",a?Ar:Ct),{next(){const{value:m,done:d}=c.next();return d?{value:m,done:d}:{value:l?[f(m[0]),f(m[1])]:f(m),done:d}},[Symbol.iterator](){return this}}}}function ot(e){return function(...t){return e==="delete"?!1:this}}function Wl(){const e={get(s){return Rn(this,s)},get size(){return Ln(this)},has:On,add:Ro,set:Oo,delete:Lo,clear:ko,forEach:kn(!1,!1)},t={get(s){return Rn(this,s,!1,!0)},get size(){return Ln(this)},has:On,add:Ro,set:Oo,delete:Lo,clear:ko,forEach:kn(!1,!0)},n={get(s){return Rn(this,s,!0)},get size(){return Ln(this,!0)},has(s){return On.call(this,s,!0)},add:ot("add"),set:ot("set"),delete:ot("delete"),clear:ot("clear"),forEach:kn(!0,!1)},r={get(s){return Rn(this,s,!0,!0)},get size(){return Ln(this,!0)},has(s){return On.call(this,s,!0)},add:ot("add"),set:ot("set"),delete:ot("delete"),clear:ot("clear"),forEach:kn(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(s=>{e[s]=In(s,!1,!1),n[s]=In(s,!0,!1),t[s]=In(s,!1,!0),r[s]=In(s,!0,!0)}),[e,n,t,r]}const[Gl,Yl,Jl,Ql]=Wl();function Qr(e,t){const n=t?e?Ql:Jl:e?Yl:Gl;return(r,o,s)=>o==="__v_isReactive"?!e:o==="__v_isReadonly"?e:o==="__v_raw"?r:Reflect.get(oe(n,o)&&o in r?n:r,o,s)}const Zl={get:Qr(!1,!1)},Xl={get:Qr(!1,!0)},ea={get:Qr(!0,!1)},Vs=new WeakMap,Us=new WeakMap,qs=new WeakMap,ta=new WeakMap;function na(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function ra(e){return e.__v_skip||!Object.isExtensible(e)?0:na(Al(e))}function Jt(e){return vn(e)?e:Xr(e,!1,js,Zl,Vs)}function oa(e){return Xr(e,!1,Kl,Xl,Us)}function Zr(e){return Xr(e,!0,ql,ea,qs)}function Xr(e,t,n,r,o){if(!be(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const s=o.get(e);if(s)return s;const i=ra(e);if(i===0)return e;const l=new Proxy(e,i===2?r:n);return o.set(e,l),l}function zt(e){return vn(e)?zt(e.__v_raw):!!(e&&e.__v_isReactive)}function vn(e){return!!(e&&e.__v_isReadonly)}function Ks(e){return!!(e&&e.__v_isShallow)}function Ws(e){return zt(e)||vn(e)}function se(e){const t=e&&e.__v_raw;return t?se(t):e}function Gs(e){return Fn(e,"__v_skip",!0),e}const _n=e=>be(e)?Jt(e):e,eo=e=>be(e)?Zr(e):e;function Ys(e){dt&&Ye&&(e=se(e),Fs(e.dep||(e.dep=Wr())))}function Js(e,t){e=se(e),e.dep&&xr(e.dep)}function we(e){return!!(e&&e.__v_isRef===!0)}function Se(e){return Zs(e,!1)}function Qs(e){return Zs(e,!0)}function Zs(e,t){return we(e)?e:new sa(e,t)}class sa{constructor(t,n){this.__v_isShallow=n,this.dep=void 0,this.__v_isRef=!0,this._rawValue=n?t:se(t),this._value=n?t:_n(t)}get value(){return Ys(this),this._value}set value(t){t=this.__v_isShallow?t:se(t),gn(t,this._rawValue)&&(this._rawValue=t,this._value=this.__v_isShallow?t:_n(t),Js(this))}}function At(e){return we(e)?e.value:e}const ia={get:(e,t,n)=>At(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const o=e[t];return we(o)&&!we(n)?(o.value=n,!0):Reflect.set(e,t,n,r)}};function Xs(e){return zt(e)?e:new Proxy(e,ia)}function nh(e){const t=J(e)?new Array(e.length):{};for(const n in e)t[n]=aa(e,n);return t}class la{constructor(t,n,r){this._object=t,this._key=n,this._defaultValue=r,this.__v_isRef=!0}get value(){const t=this._object[this._key];return t===void 0?this._defaultValue:t}set value(t){this._object[this._key]=t}}function aa(e,t,n){const r=e[t];return we(r)?r:new la(e,t,n)}class ca{constructor(t,n,r,o){this._setter=n,this.dep=void 0,this.__v_isRef=!0,this._dirty=!0,this.effect=new Gr(t,()=>{this._dirty||(this._dirty=!0,Js(this))}),this.effect.computed=this,this.effect.active=this._cacheable=!o,this.__v_isReadonly=r}get value(){const t=se(this);return Ys(t),(t._dirty||!t._cacheable)&&(t._dirty=!1,t._value=t.effect.run()),t._value}set value(t){this._setter(t)}}function ua(e,t,n=!1){let r,o;const s=ee(e);return s?(r=e,o=Ue):(r=e.get,o=e.set),new ca(r,o,s||!o,n)}Promise.resolve();function ht(e,t,n,r){let o;try{o=r?e(...r):e()}catch(s){Cn(s,t,n)}return o}function ze(e,t,n,r){if(ee(e)){const s=ht(e,t,n,r);return s&&ks(s)&&s.catch(i=>{Cn(i,t,n)}),s}const o=[];for(let s=0;s>>1;bn(Ie[r])et&&Ie.splice(t,1)}function ni(e,t,n,r){J(e)?n.push(...e):(!t||!t.includes(e,e.allowRecurse?r+1:r))&&n.push(e),ti()}function pa(e){ni(e,ln,cn,Mt)}function ma(e){ni(e,at,un,Dt)}function oo(e,t=null){if(cn.length){for(Pr=t,ln=[...new Set(cn)],cn.length=0,Mt=0;Mtbn(n)-bn(r)),Dt=0;Dte.id==null?1/0:e.id;function ri(e){Sr=!1,zn=!0,oo(e),Ie.sort((n,r)=>bn(n)-bn(r));const t=Ue;try{for(et=0;etE.trim()):m&&(o=n.map(Ms))}let l,a=r[l=ur(t)]||r[l=ur(Qe(t))];!a&&s&&(a=r[l=ur(Ot(t))]),a&&ze(a,e,6,o);const c=r[l+"Once"];if(c){if(!e.emitted)e.emitted={};else if(e.emitted[l])return;e.emitted[l]=!0,ze(c,e,6,o)}}function oi(e,t,n=!1){const r=t.emitsCache,o=r.get(e);if(o!==void 0)return o;const s=e.emits;let i={},l=!1;if(!ee(e)){const a=c=>{const f=oi(c,t,!0);f&&(l=!0,Ce(i,f))};!n&&t.mixins.length&&t.mixins.forEach(a),e.extends&&a(e.extends),e.mixins&&e.mixins.forEach(a)}return!s&&!l?(r.set(e,null),null):(J(s)?s.forEach(a=>i[a]=null):Ce(i,s),r.set(e,i),i)}function so(e,t){return!e||!Tn(t)?!1:(t=t.slice(2).replace(/Once$/,""),oe(e,t[0].toLowerCase()+t.slice(1))||oe(e,Ot(t))||oe(e,t))}let Be=null,rr=null;function jn(e){const t=Be;return Be=e,rr=e&&e.type.__scopeId||null,t}function va(e){rr=e}function _a(){rr=null}function ba(e,t=Be,n){if(!t||e._n)return e;const r=(...o)=>{r._d&&Vo(-1);const s=jn(t),i=e(...o);return jn(s),r._d&&Vo(1),i};return r._n=!0,r._c=!0,r._d=!0,r}function dr(e){const{type:t,vnode:n,proxy:r,withProxy:o,props:s,propsOptions:[i],slots:l,attrs:a,emit:c,render:f,renderCache:m,data:d,setupState:E,ctx:h,inheritAttrs:b}=e;let g,v;const T=jn(e);try{if(n.shapeFlag&4){const O=o||r;g=Ve(f.call(O,O,m,s,E,d,h)),v=a}else{const O=t;g=Ve(O.length>1?O(s,{attrs:a,slots:l,emit:c}):O(s,null)),v=t.props?a:ya(a)}}catch(O){dn.length=0,Cn(O,e,1),g=_e($e)}let P=g;if(v&&b!==!1){const O=Object.keys(v),{shapeFlag:N}=P;O.length&&N&7&&(i&&O.some(Vr)&&(v=Ea(v,i)),P=Vt(P,v))}return n.dirs&&(P.dirs=P.dirs?P.dirs.concat(n.dirs):n.dirs),n.transition&&(P.transition=n.transition),g=P,jn(T),g}const ya=e=>{let t;for(const n in e)(n==="class"||n==="style"||Tn(n))&&((t||(t={}))[n]=e[n]);return t},Ea=(e,t)=>{const n={};for(const r in e)(!Vr(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function wa(e,t,n){const{props:r,children:o,component:s}=e,{props:i,children:l,patchFlag:a}=t,c=s.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&a>=0){if(a&1024)return!0;if(a&16)return r?Io(r,i,c):!!i;if(a&8){const f=t.dynamicProps;for(let m=0;me.__isSuspense;function si(e,t){t&&t.pendingBranch?J(e)?t.effects.push(...e):t.effects.push(e):ma(e)}function xt(e,t){if(Ee){let n=Ee.provides;const r=Ee.parent&&Ee.parent.provides;r===n&&(n=Ee.provides=Object.create(r)),n[e]=t}}function Te(e,t,n=!1){const r=Ee||Be;if(r){const o=r.parent==null?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides;if(o&&e in o)return o[e];if(arguments.length>1)return n&&ee(t)?t.call(r.proxy):t}}const Bo={};function Je(e,t,n){return ii(e,t,n)}function ii(e,t,{immediate:n,deep:r,flush:o,onTrack:s,onTrigger:i}=de){const l=Ee;let a,c=!1,f=!1;if(we(e)?(a=()=>e.value,c=Ks(e)):zt(e)?(a=()=>e,r=!0):J(e)?(f=!0,c=e.some(zt),a=()=>e.map(v=>{if(we(v))return v.value;if(zt(v))return Tt(v);if(ee(v))return ht(v,l,2)})):ee(e)?t?a=()=>ht(e,l,2):a=()=>{if(!(l&&l.isUnmounted))return m&&m(),ze(e,l,3,[d])}:a=Ue,t&&r){const v=a;a=()=>Tt(v())}let m,d=v=>{m=g.onStop=()=>{ht(v,l,4)}};if(qt)return d=Ue,t?n&&ze(t,l,3,[a(),f?[]:void 0,d]):a(),Ue;let E=f?[]:Bo;const h=()=>{if(!!g.active)if(t){const v=g.run();(r||c||(f?v.some((T,P)=>gn(T,E[P])):gn(v,E)))&&(m&&m(),ze(t,l,3,[v,E===Bo?void 0:E,d]),E=v)}else g.run()};h.allowRecurse=!!t;let b;o==="sync"?b=h:o==="post"?b=()=>Re(h,l&&l.suspense):b=()=>{!l||l.isMounted?pa(h):h()};const g=new Gr(a,b);return t?n?h():E=g.run():o==="post"?Re(g.run.bind(g),l&&l.suspense):g.run(),()=>{g.stop(),l&&l.scope&&Ur(l.scope.effects,g)}}function Aa(e,t,n){const r=this.proxy,o=he(e)?e.includes(".")?li(r,e):()=>r[e]:e.bind(r,r);let s;ee(t)?s=t:(s=t.handler,n=t);const i=Ee;Ut(this);const l=ii(o,s.bind(r),n);return i?Ut(i):Pt(),l}function li(e,t){const n=t.split(".");return()=>{let r=e;for(let o=0;o{Tt(n,t)});else if(Bs(e))for(const n in e)Tt(e[n],t);return e}function xa(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Ze(()=>{e.isMounted=!0}),sr(()=>{e.isUnmounting=!0}),e}const Ne=[Function,Array],Sa={name:"BaseTransition",props:{mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Ne,onEnter:Ne,onAfterEnter:Ne,onEnterCancelled:Ne,onBeforeLeave:Ne,onLeave:Ne,onAfterLeave:Ne,onLeaveCancelled:Ne,onBeforeAppear:Ne,onAppear:Ne,onAfterAppear:Ne,onAppearCancelled:Ne},setup(e,{slots:t}){const n=Ri(),r=xa();let o;return()=>{const s=t.default&&ui(t.default(),!0);if(!s||!s.length)return;const i=se(e),{mode:l}=i,a=s[0];if(r.isLeaving)return hr(a);const c=Mo(a);if(!c)return hr(a);const f=Rr(c,i,r,n);Or(c,f);const m=n.subTree,d=m&&Mo(m);let E=!1;const{getTransitionKey:h}=c.type;if(h){const b=h();o===void 0?o=b:b!==o&&(o=b,E=!0)}if(d&&d.type!==$e&&(!Et(c,d)||E)){const b=Rr(d,i,r,n);if(Or(d,b),l==="out-in")return r.isLeaving=!0,b.afterLeave=()=>{r.isLeaving=!1,n.update()},hr(a);l==="in-out"&&c.type!==$e&&(b.delayLeave=(g,v,T)=>{const P=ci(r,d);P[String(d.key)]=d,g._leaveCb=()=>{v(),g._leaveCb=void 0,delete f.delayedLeave},f.delayedLeave=T})}return a}}},ai=Sa;function ci(e,t){const{leavingVNodes:n}=e;let r=n.get(t.type);return r||(r=Object.create(null),n.set(t.type,r)),r}function Rr(e,t,n,r){const{appear:o,mode:s,persisted:i=!1,onBeforeEnter:l,onEnter:a,onAfterEnter:c,onEnterCancelled:f,onBeforeLeave:m,onLeave:d,onAfterLeave:E,onLeaveCancelled:h,onBeforeAppear:b,onAppear:g,onAfterAppear:v,onAppearCancelled:T}=t,P=String(e.key),O=ci(n,e),N=(x,w)=>{x&&ze(x,r,9,w)},j={mode:s,persisted:i,beforeEnter(x){let w=l;if(!n.isMounted)if(o)w=b||l;else return;x._leaveCb&&x._leaveCb(!0);const G=O[P];G&&Et(e,G)&&G.el._leaveCb&&G.el._leaveCb(),N(w,[x])},enter(x){let w=a,G=c,U=f;if(!n.isMounted)if(o)w=g||a,G=v||c,U=T||f;else return;let Y=!1;const y=x._enterCb=M=>{Y||(Y=!0,M?N(U,[x]):N(G,[x]),j.delayedLeave&&j.delayedLeave(),x._enterCb=void 0)};w?(w(x,y),w.length<=1&&y()):y()},leave(x,w){const G=String(e.key);if(x._enterCb&&x._enterCb(!0),n.isUnmounting)return w();N(m,[x]);let U=!1;const Y=x._leaveCb=y=>{U||(U=!0,w(),y?N(h,[x]):N(E,[x]),x._leaveCb=void 0,O[G]===e&&delete O[G])};O[G]=e,d?(d(x,Y),d.length<=1&&Y()):Y()},clone(x){return Rr(x,t,n,r)}};return j}function hr(e){if(An(e))return e=Vt(e),e.children=null,e}function Mo(e){return An(e)?e.children?e.children[0]:void 0:e}function Or(e,t){e.shapeFlag&6&&e.component?Or(e.component.subTree,t):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function ui(e,t=!1){let n=[],r=0;for(let o=0;o1)for(let o=0;o!!e.type.__asyncLoader;function ae(e){ee(e)&&(e={loader:e});const{loader:t,loadingComponent:n,errorComponent:r,delay:o=200,timeout:s,suspensible:i=!0,onError:l}=e;let a=null,c,f=0;const m=()=>(f++,a=null,d()),d=()=>{let E;return a||(E=a=t().catch(h=>{if(h=h instanceof Error?h:new Error(String(h)),l)return new Promise((b,g)=>{l(h,()=>b(m()),()=>g(h),f+1)});throw h}).then(h=>E!==a&&a?a:(h&&(h.__esModule||h[Symbol.toStringTag]==="Module")&&(h=h.default),c=h,h)))};return qe({name:"AsyncComponentWrapper",__asyncLoader:d,get __asyncResolved(){return c},setup(){const E=Ee;if(c)return()=>pr(c,E);const h=T=>{a=null,Cn(T,E,13,!r)};if(i&&E.suspense||qt)return d().then(T=>()=>pr(T,E)).catch(T=>(h(T),()=>r?_e(r,{error:T}):null));const b=Se(!1),g=Se(),v=Se(!!o);return o&&setTimeout(()=>{v.value=!1},o),s!=null&&setTimeout(()=>{if(!b.value&&!g.value){const T=new Error(`Async component timed out after ${s}ms.`);h(T),g.value=T}},s),d().then(()=>{b.value=!0,E.parent&&An(E.parent.vnode)&&ro(E.parent.update)}).catch(T=>{h(T),g.value=T}),()=>{if(b.value&&c)return pr(c,E);if(g.value&&r)return _e(r,{error:g.value});if(n&&!v.value)return _e(n)}}})}function pr(e,{vnode:{ref:t,props:n,children:r}}){const o=_e(e,n,r);return o.ref=t,o}const An=e=>e.type.__isKeepAlive;function Pa(e,t){fi(e,"a",t)}function Ra(e,t){fi(e,"da",t)}function fi(e,t,n=Ee){const r=e.__wdc||(e.__wdc=()=>{let o=n;for(;o;){if(o.isDeactivated)return;o=o.parent}return e()});if(or(t,r,n),n){let o=n.parent;for(;o&&o.parent;)An(o.parent.vnode)&&Oa(r,t,n,o),o=o.parent}}function Oa(e,t,n,r){const o=or(t,e,r,!0);io(()=>{Ur(r[t],o)},n)}function or(e,t,n=Ee,r=!1){if(n){const o=n[e]||(n[e]=[]),s=t.__weh||(t.__weh=(...i)=>{if(n.isUnmounted)return;Gt(),Ut(n);const l=ze(t,n,e,i);return Pt(),Yt(),l});return r?o.unshift(s):o.push(s),s}}const rt=e=>(t,n=Ee)=>(!qt||e==="sp")&&or(e,t,n),La=rt("bm"),Ze=rt("m"),ka=rt("bu"),di=rt("u"),sr=rt("bum"),io=rt("um"),Ia=rt("sp"),Ba=rt("rtg"),Ma=rt("rtc");function Da(e,t=Ee){or("ec",e,t)}let Lr=!0;function Na(e){const t=pi(e),n=e.proxy,r=e.ctx;Lr=!1,t.beforeCreate&&Do(t.beforeCreate,e,"bc");const{data:o,computed:s,methods:i,watch:l,provide:a,inject:c,created:f,beforeMount:m,mounted:d,beforeUpdate:E,updated:h,activated:b,deactivated:g,beforeDestroy:v,beforeUnmount:T,destroyed:P,unmounted:O,render:N,renderTracked:j,renderTriggered:x,errorCaptured:w,serverPrefetch:G,expose:U,inheritAttrs:Y,components:y,directives:M,filters:W}=t;if(c&&Ha(c,r,null,e.appContext.config.unwrapInjectedRef),i)for(const X in i){const ne=i[X];ee(ne)&&(r[X]=ne.bind(n))}if(o){const X=o.call(n,n);be(X)&&(e.data=Jt(X))}if(Lr=!0,s)for(const X in s){const ne=s[X],ye=ee(ne)?ne.bind(n,n):ee(ne.get)?ne.get.bind(n,n):Ue,Ae=!ee(ne)&&ee(ne.set)?ne.set.bind(n):Ue,Le=ge({get:ye,set:Ae});Object.defineProperty(r,X,{enumerable:!0,configurable:!0,get:()=>Le.value,set:De=>Le.value=De})}if(l)for(const X in l)hi(l[X],r,n,X);if(a){const X=ee(a)?a.call(n):a;Reflect.ownKeys(X).forEach(ne=>{xt(ne,X[ne])})}f&&Do(f,e,"c");function $(X,ne){J(ne)?ne.forEach(ye=>X(ye.bind(n))):ne&&X(ne.bind(n))}if($(La,m),$(Ze,d),$(ka,E),$(di,h),$(Pa,b),$(Ra,g),$(Da,w),$(Ma,j),$(Ba,x),$(sr,T),$(io,O),$(Ia,G),J(U))if(U.length){const X=e.exposed||(e.exposed={});U.forEach(ne=>{Object.defineProperty(X,ne,{get:()=>n[ne],set:ye=>n[ne]=ye})})}else e.exposed||(e.exposed={});N&&e.render===Ue&&(e.render=N),Y!=null&&(e.inheritAttrs=Y),y&&(e.components=y),M&&(e.directives=M)}function Ha(e,t,n=Ue,r=!1){J(e)&&(e=kr(e));for(const o in e){const s=e[o];let i;be(s)?"default"in s?i=Te(s.from||o,s.default,!0):i=Te(s.from||o):i=Te(s),we(i)&&r?Object.defineProperty(t,o,{enumerable:!0,configurable:!0,get:()=>i.value,set:l=>i.value=l}):t[o]=i}}function Do(e,t,n){ze(J(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function hi(e,t,n,r){const o=r.includes(".")?li(n,r):()=>n[r];if(he(e)){const s=t[e];ee(s)&&Je(o,s)}else if(ee(e))Je(o,e.bind(n));else if(be(e))if(J(e))e.forEach(s=>hi(s,t,n,r));else{const s=ee(e.handler)?e.handler.bind(n):t[e.handler];ee(s)&&Je(o,s,e)}}function pi(e){const t=e.type,{mixins:n,extends:r}=t,{mixins:o,optionsCache:s,config:{optionMergeStrategies:i}}=e.appContext,l=s.get(t);let a;return l?a=l:!o.length&&!n&&!r?a=t:(a={},o.length&&o.forEach(c=>Un(a,c,i,!0)),Un(a,t,i)),s.set(t,a),a}function Un(e,t,n,r=!1){const{mixins:o,extends:s}=t;s&&Un(e,s,n,!0),o&&o.forEach(i=>Un(e,i,n,!0));for(const i in t)if(!(r&&i==="expose")){const l=Fa[i]||n&&n[i];e[i]=l?l(e[i],t[i]):t[i]}return e}const Fa={data:No,props:_t,emits:_t,methods:_t,computed:_t,beforeCreate:xe,created:xe,beforeMount:xe,mounted:xe,beforeUpdate:xe,updated:xe,beforeDestroy:xe,beforeUnmount:xe,destroyed:xe,unmounted:xe,activated:xe,deactivated:xe,errorCaptured:xe,serverPrefetch:xe,components:_t,directives:_t,watch:$a,provide:No,inject:za};function No(e,t){return t?e?function(){return Ce(ee(e)?e.call(this,this):e,ee(t)?t.call(this,this):t)}:t:e}function za(e,t){return _t(kr(e),kr(t))}function kr(e){if(J(e)){const t={};for(let n=0;n0)&&!(i&16)){if(i&8){const f=e.vnode.dynamicProps;for(let m=0;m{a=!0;const[d,E]=gi(m,t,!0);Ce(i,d),E&&l.push(...E)};!n&&t.mixins.length&&t.mixins.forEach(f),e.extends&&f(e.extends),e.mixins&&e.mixins.forEach(f)}if(!s&&!a)return r.set(e,Ht),Ht;if(J(s))for(let f=0;f-1,E[1]=b<0||h-1||oe(E,"default"))&&l.push(m)}}}const c=[i,l];return r.set(e,c),c}function Ho(e){return e[0]!=="$"}function Fo(e){const t=e&&e.toString().match(/^\s*function (\w+)/);return t?t[1]:e===null?"null":""}function zo(e,t){return Fo(e)===Fo(t)}function $o(e,t){return J(t)?t.findIndex(n=>zo(n,e)):ee(t)&&zo(t,e)?0:-1}const vi=e=>e[0]==="_"||e==="$stable",lo=e=>J(e)?e.map(Ve):[Ve(e)],Ua=(e,t,n)=>{const r=ba((...o)=>lo(t(...o)),n);return r._c=!1,r},_i=(e,t,n)=>{const r=e._ctx;for(const o in e){if(vi(o))continue;const s=e[o];if(ee(s))t[o]=Ua(o,s,r);else if(s!=null){const i=lo(s);t[o]=()=>i}}},bi=(e,t)=>{const n=lo(t);e.slots.default=()=>n},qa=(e,t)=>{if(e.vnode.shapeFlag&32){const n=t._;n?(e.slots=se(t),Fn(t,"_",n)):_i(t,e.slots={})}else e.slots={},t&&bi(e,t);Fn(e.slots,ir,1)},Ka=(e,t,n)=>{const{vnode:r,slots:o}=e;let s=!0,i=de;if(r.shapeFlag&32){const l=t._;l?n&&l===1?s=!1:(Ce(o,t),!n&&l===1&&delete o._):(s=!t.$stable,_i(t,o)),i=t}else t&&(bi(e,t),i={default:1});if(s)for(const l in o)!vi(l)&&!(l in i)&&delete o[l]};function rh(e,t){const n=Be;if(n===null)return e;const r=n.proxy,o=e.dirs||(e.dirs=[]);for(let s=0;sqn(d,t&&(J(t)?t[E]:t),n,r,o));return}if(Vn(r)&&!o)return;const s=r.shapeFlag&4?uo(r.component)||r.component.proxy:r.el,i=o?null:s,{i:l,r:a}=e,c=t&&t.r,f=l.refs===de?l.refs={}:l.refs,m=l.setupState;if(c!=null&&c!==a&&(he(c)?(f[c]=null,oe(m,c)&&(m[c]=null)):we(c)&&(c.value=null)),ee(a))ht(a,l,12,[i,f]);else{const d=he(a),E=we(a);if(d||E){const h=()=>{if(e.f){const b=d?f[a]:a.value;o?J(b)&&Ur(b,s):J(b)?b.includes(s)||b.push(s):d?f[a]=[s]:(a.value=[s],e.k&&(f[e.k]=a.value))}else d?(f[a]=i,oe(m,a)&&(m[a]=i)):we(a)&&(a.value=i,e.k&&(f[e.k]=i))};i?(h.id=-1,Re(h,n)):h()}}}let st=!1;const Bn=e=>/svg/.test(e.namespaceURI)&&e.tagName!=="foreignObject",mr=e=>e.nodeType===8;function Ya(e){const{mt:t,p:n,o:{patchProp:r,nextSibling:o,parentNode:s,remove:i,insert:l,createComment:a}}=e,c=(g,v)=>{if(!v.hasChildNodes()){n(null,g,v),$n();return}st=!1,f(v.firstChild,g,null,null,null),$n(),st&&console.error("Hydration completed but contains mismatches.")},f=(g,v,T,P,O,N=!1)=>{const j=mr(g)&&g.data==="[",x=()=>h(g,v,T,P,O,j),{type:w,ref:G,shapeFlag:U}=v,Y=g.nodeType;v.el=g;let y=null;switch(w){case yn:Y!==3?y=x():(g.data!==v.children&&(st=!0,g.data=v.children),y=o(g));break;case $e:Y!==8||j?y=x():y=o(g);break;case fn:if(Y!==1)y=x();else{y=g;const M=!v.children.length;for(let W=0;W{N=N||!!v.dynamicChildren;const{type:j,props:x,patchFlag:w,shapeFlag:G,dirs:U}=v,Y=j==="input"&&U||j==="option";if(Y||w!==-1){if(U&&Ge(v,null,T,"created"),x)if(Y||!N||w&48)for(const M in x)(Y&&M.endsWith("value")||Tn(M)&&!an(M))&&r(g,M,null,x[M],!1,void 0,T);else x.onClick&&r(g,"onClick",null,x.onClick,!1,void 0,T);let y;if((y=x&&x.onVnodeBeforeMount)&&He(y,T,v),U&&Ge(v,null,T,"beforeMount"),((y=x&&x.onVnodeMounted)||U)&&si(()=>{y&&He(y,T,v),U&&Ge(v,null,T,"mounted")},P),G&16&&!(x&&(x.innerHTML||x.textContent))){let M=d(g.firstChild,v,g,T,P,O,N);for(;M;){st=!0;const W=M;M=M.nextSibling,i(W)}}else G&8&&g.textContent!==v.children&&(st=!0,g.textContent=v.children)}return g.nextSibling},d=(g,v,T,P,O,N,j)=>{j=j||!!v.dynamicChildren;const x=v.children,w=x.length;for(let G=0;G{const{slotScopeIds:j}=v;j&&(O=O?O.concat(j):j);const x=s(g),w=d(o(g),v,x,T,P,O,N);return w&&mr(w)&&w.data==="]"?o(v.anchor=w):(st=!0,l(v.anchor=a("]"),x,w),w)},h=(g,v,T,P,O,N)=>{if(st=!0,v.el=null,N){const w=b(g);for(;;){const G=o(g);if(G&&G!==w)i(G);else break}}const j=o(g),x=s(g);return i(g),n(null,v,x,j,T,P,Bn(x),O),j},b=g=>{let v=0;for(;g;)if(g=o(g),g&&mr(g)&&(g.data==="["&&v++,g.data==="]")){if(v===0)return o(g);v--}return g};return[c,f]}const Re=si;function Ja(e){return Ei(e)}function Qa(e){return Ei(e,Ya)}function Ei(e,t){const n=Pl();n.__VUE__=!0;const{insert:r,remove:o,patchProp:s,createElement:i,createText:l,createComment:a,setText:c,setElementText:f,parentNode:m,nextSibling:d,setScopeId:E=Ue,cloneNode:h,insertStaticContent:b}=e,g=(u,p,_,S=null,A=null,L=null,D=!1,k=null,B=!!p.dynamicChildren)=>{if(u===p)return;u&&!Et(u,p)&&(S=F(u),Pe(u,A,L,!0),u=null),p.patchFlag===-2&&(B=!1,p.dynamicChildren=null);const{type:R,ref:q,shapeFlag:z}=p;switch(R){case yn:v(u,p,_,S);break;case $e:T(u,p,_,S);break;case fn:u==null&&P(p,_,S,D);break;case Oe:M(u,p,_,S,A,L,D,k,B);break;default:z&1?j(u,p,_,S,A,L,D,k,B):z&6?W(u,p,_,S,A,L,D,k,B):(z&64||z&128)&&R.process(u,p,_,S,A,L,D,k,B,ce)}q!=null&&A&&qn(q,u&&u.ref,L,p||u,!p)},v=(u,p,_,S)=>{if(u==null)r(p.el=l(p.children),_,S);else{const A=p.el=u.el;p.children!==u.children&&c(A,p.children)}},T=(u,p,_,S)=>{u==null?r(p.el=a(p.children||""),_,S):p.el=u.el},P=(u,p,_,S)=>{[u.el,u.anchor]=b(u.children,p,_,S,u.el,u.anchor)},O=({el:u,anchor:p},_,S)=>{let A;for(;u&&u!==p;)A=d(u),r(u,_,S),u=A;r(p,_,S)},N=({el:u,anchor:p})=>{let _;for(;u&&u!==p;)_=d(u),o(u),u=_;o(p)},j=(u,p,_,S,A,L,D,k,B)=>{D=D||p.type==="svg",u==null?x(p,_,S,A,L,D,k,B):U(u,p,A,L,D,k,B)},x=(u,p,_,S,A,L,D,k)=>{let B,R;const{type:q,props:z,shapeFlag:K,transition:Q,patchFlag:re,dirs:me}=u;if(u.el&&h!==void 0&&re===-1)B=u.el=h(u.el);else{if(B=u.el=i(u.type,L,z&&z.is,z),K&8?f(B,u.children):K&16&&G(u.children,B,null,S,A,L&&q!=="foreignObject",D,k),me&&Ge(u,null,S,"created"),z){for(const pe in z)pe!=="value"&&!an(pe)&&s(B,pe,null,z[pe],L,u.children,S,A,I);"value"in z&&s(B,"value",null,z.value),(R=z.onVnodeBeforeMount)&&He(R,S,u)}w(B,u,u.scopeId,D,S)}me&&Ge(u,null,S,"beforeMount");const ue=(!A||A&&!A.pendingBranch)&&Q&&!Q.persisted;ue&&Q.beforeEnter(B),r(B,p,_),((R=z&&z.onVnodeMounted)||ue||me)&&Re(()=>{R&&He(R,S,u),ue&&Q.enter(B),me&&Ge(u,null,S,"mounted")},A)},w=(u,p,_,S,A)=>{if(_&&E(u,_),S)for(let L=0;L{for(let R=B;R{const k=p.el=u.el;let{patchFlag:B,dynamicChildren:R,dirs:q}=p;B|=u.patchFlag&16;const z=u.props||de,K=p.props||de;let Q;_&&mt(_,!1),(Q=K.onVnodeBeforeUpdate)&&He(Q,_,p,u),q&&Ge(p,u,_,"beforeUpdate"),_&&mt(_,!0);const re=A&&p.type!=="foreignObject";if(R?Y(u.dynamicChildren,R,k,_,S,re,L):D||ye(u,p,k,null,_,S,re,L,!1),B>0){if(B&16)y(k,p,z,K,_,S,A);else if(B&2&&z.class!==K.class&&s(k,"class",null,K.class,A),B&4&&s(k,"style",z.style,K.style,A),B&8){const me=p.dynamicProps;for(let ue=0;ue{Q&&He(Q,_,p,u),q&&Ge(p,u,_,"updated")},S)},Y=(u,p,_,S,A,L,D)=>{for(let k=0;k{if(_!==S){for(const k in S){if(an(k))continue;const B=S[k],R=_[k];B!==R&&k!=="value"&&s(u,k,R,B,D,p.children,A,L,I)}if(_!==de)for(const k in _)!an(k)&&!(k in S)&&s(u,k,_[k],null,D,p.children,A,L,I);"value"in S&&s(u,"value",_.value,S.value)}},M=(u,p,_,S,A,L,D,k,B)=>{const R=p.el=u?u.el:l(""),q=p.anchor=u?u.anchor:l("");let{patchFlag:z,dynamicChildren:K,slotScopeIds:Q}=p;Q&&(k=k?k.concat(Q):Q),u==null?(r(R,_,S),r(q,_,S),G(p.children,_,q,A,L,D,k,B)):z>0&&z&64&&K&&u.dynamicChildren?(Y(u.dynamicChildren,K,_,A,L,D,k),(p.key!=null||A&&p===A.subTree)&&wi(u,p,!0)):ye(u,p,_,q,A,L,D,k,B)},W=(u,p,_,S,A,L,D,k,B)=>{p.slotScopeIds=k,u==null?p.shapeFlag&512?A.ctx.activate(p,_,S,D,B):ie(p,_,S,A,L,D,B):$(u,p,B)},ie=(u,p,_,S,A,L,D)=>{const k=u.component=uc(u,S,A);if(An(u)&&(k.ctx.renderer=ce),fc(k),k.asyncDep){if(A&&A.registerDep(k,X),!u.el){const B=k.subTree=_e($e);T(null,B,p,_)}return}X(k,u,p,_,A,L,D)},$=(u,p,_)=>{const S=p.component=u.component;if(wa(u,p,_))if(S.asyncDep&&!S.asyncResolved){ne(S,p,_);return}else S.next=p,ha(S.update),S.update();else p.component=u.component,p.el=u.el,S.vnode=p},X=(u,p,_,S,A,L,D)=>{const k=()=>{if(u.isMounted){let{next:q,bu:z,u:K,parent:Q,vnode:re}=u,me=q,ue;mt(u,!1),q?(q.el=re.el,ne(u,q,D)):q=re,z&&fr(z),(ue=q.props&&q.props.onVnodeBeforeUpdate)&&He(ue,Q,q,re),mt(u,!0);const pe=dr(u),je=u.subTree;u.subTree=pe,g(je,pe,m(je.el),F(je),u,A,L),q.el=pe.el,me===null&&Ta(u,pe.el),K&&Re(K,A),(ue=q.props&&q.props.onVnodeUpdated)&&Re(()=>He(ue,Q,q,re),A)}else{let q;const{el:z,props:K}=p,{bm:Q,m:re,parent:me}=u,ue=Vn(p);if(mt(u,!1),Q&&fr(Q),!ue&&(q=K&&K.onVnodeBeforeMount)&&He(q,me,p),mt(u,!0),z&&Z){const pe=()=>{u.subTree=dr(u),Z(z,u.subTree,u,A,null)};ue?p.type.__asyncLoader().then(()=>!u.isUnmounted&&pe()):pe()}else{const pe=u.subTree=dr(u);g(null,pe,_,S,u,A,L),p.el=pe.el}if(re&&Re(re,A),!ue&&(q=K&&K.onVnodeMounted)){const pe=p;Re(()=>He(q,me,pe),A)}p.shapeFlag&256&&u.a&&Re(u.a,A),u.isMounted=!0,p=_=S=null}},B=u.effect=new Gr(k,()=>ro(u.update),u.scope),R=u.update=B.run.bind(B);R.id=u.uid,mt(u,!0),R()},ne=(u,p,_)=>{p.component=u;const S=u.vnode.props;u.vnode=p,u.next=null,Va(u,p.props,S,_),Ka(u,p.children,_),Gt(),oo(void 0,u.update),Yt()},ye=(u,p,_,S,A,L,D,k,B=!1)=>{const R=u&&u.children,q=u?u.shapeFlag:0,z=p.children,{patchFlag:K,shapeFlag:Q}=p;if(K>0){if(K&128){Le(R,z,_,S,A,L,D,k,B);return}else if(K&256){Ae(R,z,_,S,A,L,D,k,B);return}}Q&8?(q&16&&I(R,A,L),z!==R&&f(_,z)):q&16?Q&16?Le(R,z,_,S,A,L,D,k,B):I(R,A,L,!0):(q&8&&f(_,""),Q&16&&G(z,_,S,A,L,D,k,B))},Ae=(u,p,_,S,A,L,D,k,B)=>{u=u||Ht,p=p||Ht;const R=u.length,q=p.length,z=Math.min(R,q);let K;for(K=0;Kq?I(u,A,L,!0,!1,z):G(p,_,S,A,L,D,k,B,z)},Le=(u,p,_,S,A,L,D,k,B)=>{let R=0;const q=p.length;let z=u.length-1,K=q-1;for(;R<=z&&R<=K;){const Q=u[R],re=p[R]=B?ct(p[R]):Ve(p[R]);if(Et(Q,re))g(Q,re,_,null,A,L,D,k,B);else break;R++}for(;R<=z&&R<=K;){const Q=u[z],re=p[K]=B?ct(p[K]):Ve(p[K]);if(Et(Q,re))g(Q,re,_,null,A,L,D,k,B);else break;z--,K--}if(R>z){if(R<=K){const Q=K+1,re=QK)for(;R<=z;)Pe(u[R],A,L,!0),R++;else{const Q=R,re=R,me=new Map;for(R=re;R<=K;R++){const ke=p[R]=B?ct(p[R]):Ve(p[R]);ke.key!=null&&me.set(ke.key,R)}let ue,pe=0;const je=K-re+1;let Lt=!1,Eo=0;const en=new Array(je);for(R=0;R=je){Pe(ke,A,L,!0);continue}let Ke;if(ke.key!=null)Ke=me.get(ke.key);else for(ue=re;ue<=K;ue++)if(en[ue-re]===0&&Et(ke,p[ue])){Ke=ue;break}Ke===void 0?Pe(ke,A,L,!0):(en[Ke-re]=R+1,Ke>=Eo?Eo=Ke:Lt=!0,g(ke,p[Ke],_,null,A,L,D,k,B),pe++)}const wo=Lt?Za(en):Ht;for(ue=wo.length-1,R=je-1;R>=0;R--){const ke=re+R,Ke=p[ke],To=ke+1{const{el:L,type:D,transition:k,children:B,shapeFlag:R}=u;if(R&6){De(u.component.subTree,p,_,S);return}if(R&128){u.suspense.move(p,_,S);return}if(R&64){D.move(u,p,_,ce);return}if(D===Oe){r(L,p,_);for(let z=0;zk.enter(L),A);else{const{leave:z,delayLeave:K,afterLeave:Q}=k,re=()=>r(L,p,_),me=()=>{z(L,()=>{re(),Q&&Q()})};K?K(L,re,me):me()}else r(L,p,_)},Pe=(u,p,_,S=!1,A=!1)=>{const{type:L,props:D,ref:k,children:B,dynamicChildren:R,shapeFlag:q,patchFlag:z,dirs:K}=u;if(k!=null&&qn(k,null,_,u,!0),q&256){p.ctx.deactivate(u);return}const Q=q&1&&K,re=!Vn(u);let me;if(re&&(me=D&&D.onVnodeBeforeUnmount)&&He(me,p,u),q&6)H(u.component,_,S);else{if(q&128){u.suspense.unmount(_,S);return}Q&&Ge(u,null,p,"beforeUnmount"),q&64?u.type.remove(u,p,_,A,ce,S):R&&(L!==Oe||z>0&&z&64)?I(R,p,_,!1,!0):(L===Oe&&z&384||!A&&q&16)&&I(B,p,_),S&&Xt(u)}(re&&(me=D&&D.onVnodeUnmounted)||Q)&&Re(()=>{me&&He(me,p,u),Q&&Ge(u,null,p,"unmounted")},_)},Xt=u=>{const{type:p,el:_,anchor:S,transition:A}=u;if(p===Oe){C(_,S);return}if(p===fn){N(u);return}const L=()=>{o(_),A&&!A.persisted&&A.afterLeave&&A.afterLeave()};if(u.shapeFlag&1&&A&&!A.persisted){const{leave:D,delayLeave:k}=A,B=()=>D(_,L);k?k(u.el,L,B):B()}else L()},C=(u,p)=>{let _;for(;u!==p;)_=d(u),o(u),u=_;o(p)},H=(u,p,_)=>{const{bum:S,scope:A,update:L,subTree:D,um:k}=u;S&&fr(S),A.stop(),L&&(L.active=!1,Pe(D,u,p,_)),k&&Re(k,p),Re(()=>{u.isUnmounted=!0},p),p&&p.pendingBranch&&!p.isUnmounted&&u.asyncDep&&!u.asyncResolved&&u.suspenseId===p.pendingId&&(p.deps--,p.deps===0&&p.resolve())},I=(u,p,_,S=!1,A=!1,L=0)=>{for(let D=L;Du.shapeFlag&6?F(u.component.subTree):u.shapeFlag&128?u.suspense.next():d(u.anchor||u.el),le=(u,p,_)=>{u==null?p._vnode&&Pe(p._vnode,null,null,!0):g(p._vnode||null,u,p,null,null,null,_),$n(),p._vnode=u},ce={p:g,um:Pe,m:De,r:Xt,mt:ie,mc:G,pc:ye,pbc:Y,n:F,o:e};let te,Z;return t&&([te,Z]=t(ce)),{render:le,hydrate:te,createApp:Ga(le,te)}}function mt({effect:e,update:t},n){e.allowRecurse=t.allowRecurse=n}function wi(e,t,n=!1){const r=e.children,o=t.children;if(J(r)&&J(o))for(let s=0;s>1,e[n[l]]0&&(t[r]=n[s-1]),n[s]=r)}}for(s=n.length,i=n[s-1];s-- >0;)n[s]=i,i=t[i];return n}const Xa=e=>e.__isTeleport,Ti="components";function ec(e,t){return nc(Ti,e,!0,t)||e}const tc=Symbol();function nc(e,t,n=!0,r=!1){const o=Be||Ee;if(o){const s=o.type;if(e===Ti){const l=mc(s);if(l&&(l===t||l===Qe(t)||l===tr(Qe(t))))return s}const i=jo(o[e]||s[e],t)||jo(o.appContext[e],t);return!i&&r?s:i}}function jo(e,t){return e&&(e[t]||e[Qe(t)]||e[tr(Qe(t))])}const Oe=Symbol(void 0),yn=Symbol(void 0),$e=Symbol(void 0),fn=Symbol(void 0),dn=[];let St=null;function jt(e=!1){dn.push(St=e?null:[])}function rc(){dn.pop(),St=dn[dn.length-1]||null}let Kn=1;function Vo(e){Kn+=e}function Ci(e){return e.dynamicChildren=Kn>0?St||Ht:null,rc(),Kn>0&&St&&St.push(e),e}function Wn(e,t,n,r,o,s){return Ci(En(e,t,n,r,o,s,!0))}function Ai(e,t,n,r,o){return Ci(_e(e,t,n,r,o,!0))}function Gn(e){return e?e.__v_isVNode===!0:!1}function Et(e,t){return e.type===t.type&&e.key===t.key}const ir="__vInternal",xi=({key:e})=>e!=null?e:null,Dn=({ref:e,ref_key:t,ref_for:n})=>e!=null?he(e)||we(e)||ee(e)?{i:Be,r:e,k:t,f:!!n}:e:null;function En(e,t=null,n=null,r=0,o=null,s=e===Oe?0:1,i=!1,l=!1){const a={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&xi(t),ref:t&&Dn(t),scopeId:rr,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:s,patchFlag:r,dynamicProps:o,dynamicChildren:null,appContext:null};return l?(co(a,n),s&128&&e.normalize(a)):n&&(a.shapeFlag|=he(n)?8:16),Kn>0&&!i&&St&&(a.patchFlag>0||s&6)&&a.patchFlag!==32&&St.push(a),a}const _e=oc;function oc(e,t=null,n=null,r=0,o=null,s=!1){if((!e||e===tc)&&(e=$e),Gn(e)){const l=Vt(e,t,!0);return n&&co(l,n),l}if(gc(e)&&(e=e.__vccOpts),t){t=sc(t);let{class:l,style:a}=t;l&&!he(l)&&(t.class=Rt(l)),be(a)&&(Ws(a)&&!J(a)&&(a=Ce({},a)),t.style=$t(a))}const i=he(e)?1:Ca(e)?128:Xa(e)?64:be(e)?4:ee(e)?2:0;return En(e,t,n,r,o,i,s,!0)}function sc(e){return e?Ws(e)||ir in e?Ce({},e):e:null}function Vt(e,t,n=!1){const{props:r,ref:o,patchFlag:s,children:i}=e,l=t?ic(r||{},t):r;return{__v_isVNode:!0,__v_skip:!0,type:e.type,props:l,key:l&&xi(l),ref:t&&t.ref?n&&o?J(o)?o.concat(Dn(t)):[o,Dn(t)]:Dn(t):o,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:i,target:e.target,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==Oe?s===-1?16:s|16:s,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:e.transition,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&Vt(e.ssContent),ssFallback:e.ssFallback&&Vt(e.ssFallback),el:e.el,anchor:e.anchor}}function ao(e=" ",t=0){return _e(yn,null,e,t)}function oh(e,t){const n=_e(fn,null,e);return n.staticCount=t,n}function sh(e="",t=!1){return t?(jt(),Ai($e,null,e)):_e($e,null,e)}function Ve(e){return e==null||typeof e=="boolean"?_e($e):J(e)?_e(Oe,null,e.slice()):typeof e=="object"?ct(e):_e(yn,null,String(e))}function ct(e){return e.el===null||e.memo?e:Vt(e)}function co(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(J(t))n=16;else if(typeof t=="object")if(r&65){const o=t.default;o&&(o._c&&(o._d=!1),co(e,o()),o._c&&(o._d=!0));return}else{n=32;const o=t._;!o&&!(ir in t)?t._ctx=Be:o===3&&Be&&(Be.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else ee(t)?(t={default:t,_ctx:Be},n=32):(t=String(t),r&64?(n=16,t=[ao(t)]):n=8);e.children=t,e.shapeFlag|=n}function ic(...e){const t={};for(let n=0;nt(i,l,void 0,s&&s[l]));else{const i=Object.keys(e);o=new Array(i.length);for(let l=0,a=i.length;lGn(t)?!(t.type===$e||t.type===Oe&&!Pi(t.children)):!0)?e:null}const Br=e=>e?Oi(e)?uo(e)||e.proxy:Br(e.parent):null,Yn=Ce(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>Br(e.parent),$root:e=>Br(e.root),$emit:e=>e.emit,$options:e=>pi(e),$forceUpdate:e=>()=>ro(e.update),$nextTick:e=>no.bind(e.proxy),$watch:e=>Aa.bind(e)}),lc={get({_:e},t){const{ctx:n,setupState:r,data:o,props:s,accessCache:i,type:l,appContext:a}=e;let c;if(t[0]!=="$"){const E=i[t];if(E!==void 0)switch(E){case 1:return r[t];case 2:return o[t];case 4:return n[t];case 3:return s[t]}else{if(r!==de&&oe(r,t))return i[t]=1,r[t];if(o!==de&&oe(o,t))return i[t]=2,o[t];if((c=e.propsOptions[0])&&oe(c,t))return i[t]=3,s[t];if(n!==de&&oe(n,t))return i[t]=4,n[t];Lr&&(i[t]=0)}}const f=Yn[t];let m,d;if(f)return t==="$attrs"&&Me(e,"get",t),f(e);if((m=l.__cssModules)&&(m=m[t]))return m;if(n!==de&&oe(n,t))return i[t]=4,n[t];if(d=a.config.globalProperties,oe(d,t))return d[t]},set({_:e},t,n){const{data:r,setupState:o,ctx:s}=e;return o!==de&&oe(o,t)?(o[t]=n,!0):r!==de&&oe(r,t)?(r[t]=n,!0):oe(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(s[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:o,propsOptions:s}},i){let l;return!!n[i]||e!==de&&oe(e,i)||t!==de&&oe(t,i)||(l=s[0])&&oe(l,i)||oe(r,i)||oe(Yn,i)||oe(o.config.globalProperties,i)},defineProperty(e,t,n){return n.get!=null?this.set(e,t,n.get(),null):n.value!=null&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}},ac=yi();let cc=0;function uc(e,t,n){const r=e.type,o=(t?t.appContext:e.appContext)||ac,s={uid:cc++,vnode:e,type:r,parent:t,appContext:o,root:null,next:null,subTree:null,effect:null,update:null,scope:new Rl(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(o.provides),accessCache:null,renderCache:[],components:null,directives:null,propsOptions:gi(r,o),emitsOptions:oi(r,o),emit:null,emitted:null,propsDefaults:de,inheritAttrs:r.inheritAttrs,ctx:de,data:de,props:de,attrs:de,slots:de,refs:de,setupState:de,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return s.ctx={_:s},s.root=t?t.root:s,s.emit=ga.bind(null,s),e.ce&&e.ce(s),s}let Ee=null;const Ri=()=>Ee||Be,Ut=e=>{Ee=e,e.scope.on()},Pt=()=>{Ee&&Ee.scope.off(),Ee=null};function Oi(e){return e.vnode.shapeFlag&4}let qt=!1;function fc(e,t=!1){qt=t;const{props:n,children:r}=e.vnode,o=Oi(e);ja(e,n,o,t),qa(e,r);const s=o?dc(e,t):void 0;return qt=!1,s}function dc(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=Gs(new Proxy(e.ctx,lc));const{setup:r}=n;if(r){const o=e.setupContext=r.length>1?pc(e):null;Ut(e),Gt();const s=ht(r,e,0,[e.props,o]);if(Yt(),Pt(),ks(s)){if(s.then(Pt,Pt),t)return s.then(i=>{Uo(e,i,t)}).catch(i=>{Cn(i,e,0)});e.asyncDep=s}else Uo(e,s,t)}else Li(e,t)}function Uo(e,t,n){ee(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:be(t)&&(e.setupState=Xs(t)),Li(e,n)}let qo;function Li(e,t,n){const r=e.type;if(!e.render){if(!t&&qo&&!r.render){const o=r.template;if(o){const{isCustomElement:s,compilerOptions:i}=e.appContext.config,{delimiters:l,compilerOptions:a}=r,c=Ce(Ce({isCustomElement:s,delimiters:l},i),a);r.render=qo(o,c)}}e.render=r.render||Ue}Ut(e),Gt(),Na(e),Yt(),Pt()}function hc(e){return new Proxy(e.attrs,{get(t,n){return Me(e,"get","$attrs"),t[n]}})}function pc(e){const t=r=>{e.exposed=r||{}};let n;return{get attrs(){return n||(n=hc(e))},slots:e.slots,emit:e.emit,expose:t}}function uo(e){if(e.exposed)return e.exposeProxy||(e.exposeProxy=new Proxy(Xs(Gs(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Yn)return Yn[n](e)}}))}function mc(e){return ee(e)&&e.displayName||e.name}function gc(e){return ee(e)&&"__vccOpts"in e}const ge=(e,t)=>ua(e,t,qt);function ve(e,t,n){const r=arguments.length;return r===2?be(t)&&!J(t)?Gn(t)?_e(e,null,[t]):_e(e,t):_e(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&Gn(n)&&(n=[n]),_e(e,t,n))}const vc="3.2.31",_c="http://www.w3.org/2000/svg",wt=typeof document!="undefined"?document:null,Ko=wt&&wt.createElement("template"),bc={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{const o=t?wt.createElementNS(_c,e):wt.createElement(e,n?{is:n}:void 0);return e==="select"&&r&&r.multiple!=null&&o.setAttribute("multiple",r.multiple),o},createText:e=>wt.createTextNode(e),createComment:e=>wt.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>wt.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},cloneNode(e){const t=e.cloneNode(!0);return"_value"in e&&(t._value=e._value),t},insertStaticContent(e,t,n,r,o,s){const i=n?n.previousSibling:t.lastChild;if(o&&(o===s||o.nextSibling))for(;t.insertBefore(o.cloneNode(!0),n),!(o===s||!(o=o.nextSibling)););else{Ko.innerHTML=r?`${e}`:e;const l=Ko.content;if(r){const a=l.firstChild;for(;a.firstChild;)l.appendChild(a.firstChild);l.removeChild(a)}t.insertBefore(l,n)}return[i?i.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}};function yc(e,t,n){const r=e._vtc;r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}function Ec(e,t,n){const r=e.style,o=he(n);if(n&&!o){for(const s in n)Mr(r,s,n[s]);if(t&&!he(t))for(const s in t)n[s]==null&&Mr(r,s,"")}else{const s=r.display;o?t!==n&&(r.cssText=n):t&&e.removeAttribute("style"),"_vod"in e&&(r.display=s)}}const Wo=/\s*!important$/;function Mr(e,t,n){if(J(n))n.forEach(r=>Mr(e,t,r));else if(t.startsWith("--"))e.setProperty(t,n);else{const r=wc(e,t);Wo.test(n)?e.setProperty(Ot(r),n.replace(Wo,""),"important"):e[r]=n}}const Go=["Webkit","Moz","ms"],gr={};function wc(e,t){const n=gr[t];if(n)return n;let r=Qe(t);if(r!=="filter"&&r in e)return gr[t]=r;r=tr(r);for(let o=0;odocument.createEvent("Event").timeStamp&&(Jn=()=>performance.now());const e=navigator.userAgent.match(/firefox\/(\d+)/i);ki=!!(e&&Number(e[1])<=53)}let Dr=0;const Ac=Promise.resolve(),xc=()=>{Dr=0},Sc=()=>Dr||(Ac.then(xc),Dr=Jn());function Pc(e,t,n,r){e.addEventListener(t,n,r)}function Rc(e,t,n,r){e.removeEventListener(t,n,r)}function Oc(e,t,n,r,o=null){const s=e._vei||(e._vei={}),i=s[t];if(r&&i)i.value=r;else{const[l,a]=Lc(t);if(r){const c=s[t]=kc(r,o);Pc(e,l,c,a)}else i&&(Rc(e,l,i,a),s[t]=void 0)}}const Jo=/(?:Once|Passive|Capture)$/;function Lc(e){let t;if(Jo.test(e)){t={};let n;for(;n=e.match(Jo);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}return[Ot(e.slice(2)),t]}function kc(e,t){const n=r=>{const o=r.timeStamp||Jn();(ki||o>=n.attached-1)&&ze(Ic(r,n.value),t,5,[r])};return n.value=e,n.attached=Sc(),n}function Ic(e,t){if(J(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(r=>o=>!o._stopped&&r&&r(o))}else return t}const Qo=/^on[a-z]/,Bc=(e,t,n,r,o=!1,s,i,l,a)=>{t==="class"?yc(e,r,o):t==="style"?Ec(e,n,r):Tn(t)?Vr(t)||Oc(e,t,n,r,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):Mc(e,t,r,o))?Cc(e,t,r,s,i,l,a):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),Tc(e,t,r,o))};function Mc(e,t,n,r){return r?!!(t==="innerHTML"||t==="textContent"||t in e&&Qo.test(t)&&ee(n)):t==="spellcheck"||t==="draggable"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA"||Qo.test(t)&&he(n)?!1:t in e}const it="transition",tn="animation",fo=(e,{slots:t})=>ve(ai,Dc(e),t);fo.displayName="Transition";const Ii={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String};fo.props=Ce({},ai.props,Ii);const gt=(e,t=[])=>{J(e)?e.forEach(n=>n(...t)):e&&e(...t)},Zo=e=>e?J(e)?e.some(t=>t.length>1):e.length>1:!1;function Dc(e){const t={};for(const y in e)y in Ii||(t[y]=e[y]);if(e.css===!1)return t;const{name:n="v",type:r,duration:o,enterFromClass:s=`${n}-enter-from`,enterActiveClass:i=`${n}-enter-active`,enterToClass:l=`${n}-enter-to`,appearFromClass:a=s,appearActiveClass:c=i,appearToClass:f=l,leaveFromClass:m=`${n}-leave-from`,leaveActiveClass:d=`${n}-leave-active`,leaveToClass:E=`${n}-leave-to`}=e,h=Nc(o),b=h&&h[0],g=h&&h[1],{onBeforeEnter:v,onEnter:T,onEnterCancelled:P,onLeave:O,onLeaveCancelled:N,onBeforeAppear:j=v,onAppear:x=T,onAppearCancelled:w=P}=t,G=(y,M,W)=>{kt(y,M?f:l),kt(y,M?c:i),W&&W()},U=(y,M)=>{kt(y,E),kt(y,d),M&&M()},Y=y=>(M,W)=>{const ie=y?x:T,$=()=>G(M,y,W);gt(ie,[M,$]),Xo(()=>{kt(M,y?a:s),lt(M,y?f:l),Zo(ie)||es(M,r,b,$)})};return Ce(t,{onBeforeEnter(y){gt(v,[y]),lt(y,s),lt(y,i)},onBeforeAppear(y){gt(j,[y]),lt(y,a),lt(y,c)},onEnter:Y(!1),onAppear:Y(!0),onLeave(y,M){const W=()=>U(y,M);lt(y,m),zc(),lt(y,d),Xo(()=>{kt(y,m),lt(y,E),Zo(O)||es(y,r,g,W)}),gt(O,[y,W])},onEnterCancelled(y){G(y,!1),gt(P,[y])},onAppearCancelled(y){G(y,!0),gt(w,[y])},onLeaveCancelled(y){U(y),gt(N,[y])}})}function Nc(e){if(e==null)return null;if(be(e))return[vr(e.enter),vr(e.leave)];{const t=vr(e);return[t,t]}}function vr(e){return Ms(e)}function lt(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e._vtc||(e._vtc=new Set)).add(t)}function kt(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const{_vtc:n}=e;n&&(n.delete(t),n.size||(e._vtc=void 0))}function Xo(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let Hc=0;function es(e,t,n,r){const o=e._endId=++Hc,s=()=>{o===e._endId&&r()};if(n)return setTimeout(s,n);const{type:i,timeout:l,propCount:a}=Fc(e,t);if(!i)return r();const c=i+"end";let f=0;const m=()=>{e.removeEventListener(c,d),s()},d=E=>{E.target===e&&++f>=a&&m()};setTimeout(()=>{f(n[h]||"").split(", "),o=r(it+"Delay"),s=r(it+"Duration"),i=ts(o,s),l=r(tn+"Delay"),a=r(tn+"Duration"),c=ts(l,a);let f=null,m=0,d=0;t===it?i>0&&(f=it,m=i,d=s.length):t===tn?c>0&&(f=tn,m=c,d=a.length):(m=Math.max(i,c),f=m>0?i>c?it:tn:null,d=f?f===it?s.length:a.length:0);const E=f===it&&/\b(transform|all)(,|$)/.test(n[it+"Property"]);return{type:f,timeout:m,propCount:d,hasTransform:E}}function ts(e,t){for(;e.lengthns(n)+ns(e[r])))}function ns(e){return Number(e.slice(0,-1).replace(",","."))*1e3}function zc(){return document.body.offsetHeight}const $c={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},lh=(e,t)=>n=>{if(!("key"in n))return;const r=Ot(n.key);if(t.some(o=>o===r||$c[o]===r))return e(n)},ah={beforeMount(e,{value:t},{transition:n}){e._vod=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):nn(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:r}){!t!=!n&&(r?t?(r.beforeEnter(e),nn(e,!0),r.enter(e)):r.leave(e,()=>{nn(e,!1)}):nn(e,t))},beforeUnmount(e,{value:t}){nn(e,t)}};function nn(e,t){e.style.display=t?e._vod:"none"}const Bi=Ce({patchProp:Bc},bc);let hn,rs=!1;function jc(){return hn||(hn=Ja(Bi))}function Vc(){return hn=rs?hn:Qa(Bi),rs=!0,hn}const Uc=(...e)=>{const t=jc().createApp(...e),{mount:n}=t;return t.mount=r=>{const o=Mi(r);if(!o)return;const s=t._component;!ee(s)&&!s.render&&!s.template&&(s.template=o.innerHTML),o.innerHTML="";const i=n(o,!1,o instanceof SVGElement);return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),i},t},qc=(...e)=>{const t=Vc().createApp(...e),{mount:n}=t;return t.mount=r=>{const o=Mi(r);if(o)return n(o,!0,o instanceof SVGElement)},t};function Mi(e){return he(e)?document.querySelector(e):e}/*! + * vue-router v4.0.12 + * (c) 2021 Eduardo San Martin Morote + * @license MIT + */const Di=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",Qt=e=>Di?Symbol(e):"_vr_"+e,Kc=Qt("rvlm"),os=Qt("rvd"),lr=Qt("r"),ho=Qt("rl"),Nr=Qt("rvl"),Nt=typeof window!="undefined";function Wc(e){return e.__esModule||Di&&e[Symbol.toStringTag]==="Module"}const fe=Object.assign;function _r(e,t){const n={};for(const r in t){const o=t[r];n[r]=Array.isArray(o)?o.map(e):e(o)}return n}const pn=()=>{},Gc=/\/$/,Yc=e=>e.replace(Gc,"");function br(e,t,n="/"){let r,o={},s="",i="";const l=t.indexOf("?"),a=t.indexOf("#",l>-1?l:0);return l>-1&&(r=t.slice(0,l),s=t.slice(l+1,a>-1?a:t.length),o=e(s)),a>-1&&(r=r||t.slice(0,a),i=t.slice(a,t.length)),r=Xc(r!=null?r:t,n),{fullPath:r+(s&&"?")+s+i,path:r,query:o,hash:i}}function Jc(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function ss(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function Qc(e,t,n){const r=t.matched.length-1,o=n.matched.length-1;return r>-1&&r===o&&Kt(t.matched[r],n.matched[o])&&Ni(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function Kt(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function Ni(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(!Zc(e[n],t[n]))return!1;return!0}function Zc(e,t){return Array.isArray(e)?is(e,t):Array.isArray(t)?is(t,e):e===t}function is(e,t){return Array.isArray(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function Xc(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),r=e.split("/");let o=n.length-1,s,i;for(s=0;s({left:window.pageXOffset,top:window.pageYOffset});function ou(e){let t;if("el"in e){const n=e.el,r=typeof n=="string"&&n.startsWith("#"),o=typeof n=="string"?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!o)return;t=ru(o,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left!=null?t.left:window.pageXOffset,t.top!=null?t.top:window.pageYOffset)}function ls(e,t){return(history.state?history.state.position-t:-1)+e}const Hr=new Map;function su(e,t){Hr.set(e,t)}function iu(e){const t=Hr.get(e);return Hr.delete(e),t}let lu=()=>location.protocol+"//"+location.host;function Hi(e,t){const{pathname:n,search:r,hash:o}=t,s=e.indexOf("#");if(s>-1){let l=o.includes(e.slice(s))?e.slice(s).length:1,a=o.slice(l);return a[0]!=="/"&&(a="/"+a),ss(a,"")}return ss(n,e)+r+o}function au(e,t,n,r){let o=[],s=[],i=null;const l=({state:d})=>{const E=Hi(e,location),h=n.value,b=t.value;let g=0;if(d){if(n.value=E,t.value=d,i&&i===h){i=null;return}g=b?d.position-b.position:0}else r(E);o.forEach(v=>{v(n.value,h,{delta:g,type:wn.pop,direction:g?g>0?mn.forward:mn.back:mn.unknown})})};function a(){i=n.value}function c(d){o.push(d);const E=()=>{const h=o.indexOf(d);h>-1&&o.splice(h,1)};return s.push(E),E}function f(){const{history:d}=window;!d.state||d.replaceState(fe({},d.state,{scroll:ar()}),"")}function m(){for(const d of s)d();s=[],window.removeEventListener("popstate",l),window.removeEventListener("beforeunload",f)}return window.addEventListener("popstate",l),window.addEventListener("beforeunload",f),{pauseListeners:a,listen:c,destroy:m}}function as(e,t,n,r=!1,o=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:o?ar():null}}function cu(e){const{history:t,location:n}=window,r={value:Hi(e,n)},o={value:t.state};o.value||s(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function s(a,c,f){const m=e.indexOf("#"),d=m>-1?(n.host&&document.querySelector("base")?e:e.slice(m))+a:lu()+e+a;try{t[f?"replaceState":"pushState"](c,"",d),o.value=c}catch(E){console.error(E),n[f?"replace":"assign"](d)}}function i(a,c){const f=fe({},t.state,as(o.value.back,a,o.value.forward,!0),c,{position:o.value.position});s(a,f,!0),r.value=a}function l(a,c){const f=fe({},o.value,t.state,{forward:a,scroll:ar()});s(f.current,f,!0);const m=fe({},as(r.value,a,null),{position:f.position+1},c);s(a,m,!1),r.value=a}return{location:r,state:o,push:l,replace:i}}function uu(e){e=eu(e);const t=cu(e),n=au(e,t.state,t.location,t.replace);function r(s,i=!0){i||n.pauseListeners(),history.go(s)}const o=fe({location:"",base:e,go:r,createHref:nu.bind(null,e)},t,n);return Object.defineProperty(o,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(o,"state",{enumerable:!0,get:()=>t.state.value}),o}function fu(e){return typeof e=="string"||e&&typeof e=="object"}function Fi(e){return typeof e=="string"||typeof e=="symbol"}const Xe={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0},zi=Qt("nf");var cs;(function(e){e[e.aborted=4]="aborted",e[e.cancelled=8]="cancelled",e[e.duplicated=16]="duplicated"})(cs||(cs={}));function Wt(e,t){return fe(new Error,{type:e,[zi]:!0},t)}function vt(e,t){return e instanceof Error&&zi in e&&(t==null||!!(e.type&t))}const us="[^/]+?",du={sensitive:!1,strict:!1,start:!0,end:!0},hu=/[.+*?^${}()[\]/\\]/g;function pu(e,t){const n=fe({},du,t),r=[];let o=n.start?"^":"";const s=[];for(const c of e){const f=c.length?[]:[90];n.strict&&!c.length&&(o+="/");for(let m=0;mt.length?t.length===1&&t[0]===40+40?1:-1:0}function gu(e,t){let n=0;const r=e.score,o=t.score;for(;n1&&(a==="*"||a==="+")&&t(`A repeatable param (${c}) must be alone in its segment. eg: '/:ids+.`),s.push({type:1,value:c,regexp:f,repeatable:a==="*"||a==="+",optional:a==="*"||a==="?"})):t("Invalid state to consume buffer"),c="")}function d(){c+=a}for(;l{i(T)}:pn}function i(f){if(Fi(f)){const m=r.get(f);m&&(r.delete(f),n.splice(n.indexOf(m),1),m.children.forEach(i),m.alias.forEach(i))}else{const m=n.indexOf(f);m>-1&&(n.splice(m,1),f.record.name&&r.delete(f.record.name),f.children.forEach(i),f.alias.forEach(i))}}function l(){return n}function a(f){let m=0;for(;m=0;)m++;n.splice(m,0,f),f.record.name&&!fs(f)&&r.set(f.record.name,f)}function c(f,m){let d,E={},h,b;if("name"in f&&f.name){if(d=r.get(f.name),!d)throw Wt(1,{location:f});b=d.record.name,E=fe(wu(m.params,d.keys.filter(T=>!T.optional).map(T=>T.name)),f.params),h=d.stringify(E)}else if("path"in f)h=f.path,d=n.find(T=>T.re.test(h)),d&&(E=d.parse(h),b=d.record.name);else{if(d=m.name?r.get(m.name):n.find(T=>T.re.test(m.path)),!d)throw Wt(1,{location:f,currentLocation:m});b=d.record.name,E=fe({},m.params,f.params),h=d.stringify(E)}const g=[];let v=d;for(;v;)g.unshift(v.record),v=v.parent;return{name:b,path:h,params:E,matched:g,meta:Au(g)}}return e.forEach(f=>s(f)),{addRoute:s,resolve:c,removeRoute:i,getRoutes:l,getRecordMatcher:o}}function wu(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function Tu(e){return{path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:void 0,beforeEnter:e.beforeEnter,props:Cu(e),children:e.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in e?e.components||{}:{default:e.component}}}function Cu(e){const t={},n=e.props||!1;if("component"in e)t.default=n;else for(const r in e.components)t[r]=typeof n=="boolean"?n:n[r];return t}function fs(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function Au(e){return e.reduce((t,n)=>fe(t,n.meta),{})}function ds(e,t){const n={};for(const r in e)n[r]=r in t?t[r]:e[r];return n}const $i=/#/g,xu=/&/g,Su=/\//g,Pu=/=/g,Ru=/\?/g,ji=/\+/g,Ou=/%5B/g,Lu=/%5D/g,Vi=/%5E/g,ku=/%60/g,Ui=/%7B/g,Iu=/%7C/g,qi=/%7D/g,Bu=/%20/g;function po(e){return encodeURI(""+e).replace(Iu,"|").replace(Ou,"[").replace(Lu,"]")}function Mu(e){return po(e).replace(Ui,"{").replace(qi,"}").replace(Vi,"^")}function Fr(e){return po(e).replace(ji,"%2B").replace(Bu,"+").replace($i,"%23").replace(xu,"%26").replace(ku,"`").replace(Ui,"{").replace(qi,"}").replace(Vi,"^")}function Du(e){return Fr(e).replace(Pu,"%3D")}function Nu(e){return po(e).replace($i,"%23").replace(Ru,"%3F")}function Hu(e){return e==null?"":Nu(e).replace(Su,"%2F")}function Qn(e){try{return decodeURIComponent(""+e)}catch{}return""+e}function Fu(e){const t={};if(e===""||e==="?")return t;const r=(e[0]==="?"?e.slice(1):e).split("&");for(let o=0;os&&Fr(s)):[r&&Fr(r)]).forEach(s=>{s!==void 0&&(t+=(t.length?"&":"")+n,s!=null&&(t+="="+s))})}return t}function zu(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=Array.isArray(r)?r.map(o=>o==null?null:""+o):r==null?r:""+r)}return t}function rn(){let e=[];function t(r){return e.push(r),()=>{const o=e.indexOf(r);o>-1&&e.splice(o,1)}}function n(){e=[]}return{add:t,list:()=>e,reset:n}}function ut(e,t,n,r,o){const s=r&&(r.enterCallbacks[o]=r.enterCallbacks[o]||[]);return()=>new Promise((i,l)=>{const a=m=>{m===!1?l(Wt(4,{from:n,to:t})):m instanceof Error?l(m):fu(m)?l(Wt(2,{from:t,to:m})):(s&&r.enterCallbacks[o]===s&&typeof m=="function"&&s.push(m),i())},c=e.call(r&&r.instances[o],t,n,a);let f=Promise.resolve(c);e.length<3&&(f=f.then(a)),f.catch(m=>l(m))})}function yr(e,t,n,r){const o=[];for(const s of e)for(const i in s.components){let l=s.components[i];if(!(t!=="beforeRouteEnter"&&!s.instances[i]))if($u(l)){const c=(l.__vccOpts||l)[t];c&&o.push(ut(c,n,r,s,i))}else{let a=l();o.push(()=>a.then(c=>{if(!c)return Promise.reject(new Error(`Couldn't resolve component "${i}" at "${s.path}"`));const f=Wc(c)?c.default:c;s.components[i]=f;const d=(f.__vccOpts||f)[t];return d&&ut(d,n,r,s,i)()}))}}return o}function $u(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function ps(e){const t=Te(lr),n=Te(ho),r=ge(()=>t.resolve(At(e.to))),o=ge(()=>{const{matched:a}=r.value,{length:c}=a,f=a[c-1],m=n.matched;if(!f||!m.length)return-1;const d=m.findIndex(Kt.bind(null,f));if(d>-1)return d;const E=ms(a[c-2]);return c>1&&ms(f)===E&&m[m.length-1].path!==E?m.findIndex(Kt.bind(null,a[c-2])):d}),s=ge(()=>o.value>-1&&qu(n.params,r.value.params)),i=ge(()=>o.value>-1&&o.value===n.matched.length-1&&Ni(n.params,r.value.params));function l(a={}){return Uu(a)?t[At(e.replace)?"replace":"push"](At(e.to)).catch(pn):Promise.resolve()}return{route:r,href:ge(()=>r.value.href),isActive:s,isExactActive:i,navigate:l}}const ju=qe({name:"RouterLink",props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"}},useLink:ps,setup(e,{slots:t}){const n=Jt(ps(e)),{options:r}=Te(lr),o=ge(()=>({[gs(e.activeClass,r.linkActiveClass,"router-link-active")]:n.isActive,[gs(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const s=t.default&&t.default(n);return e.custom?s:ve("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:o.value},s)}}}),Vu=ju;function Uu(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){const t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function qu(e,t){for(const n in t){const r=t[n],o=e[n];if(typeof r=="string"){if(r!==o)return!1}else if(!Array.isArray(o)||o.length!==r.length||r.some((s,i)=>s!==o[i]))return!1}return!0}function ms(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const gs=(e,t,n)=>e!=null?e:t!=null?t:n,Ku=qe({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},setup(e,{attrs:t,slots:n}){const r=Te(Nr),o=ge(()=>e.route||r.value),s=Te(os,0),i=ge(()=>o.value.matched[s]);xt(os,s+1),xt(Kc,i),xt(Nr,o);const l=Se();return Je(()=>[l.value,i.value,e.name],([a,c,f],[m,d,E])=>{c&&(c.instances[f]=a,d&&d!==c&&a&&a===m&&(c.leaveGuards.size||(c.leaveGuards=d.leaveGuards),c.updateGuards.size||(c.updateGuards=d.updateGuards))),a&&c&&(!d||!Kt(c,d)||!m)&&(c.enterCallbacks[f]||[]).forEach(h=>h(a))},{flush:"post"}),()=>{const a=o.value,c=i.value,f=c&&c.components[e.name],m=e.name;if(!f)return vs(n.default,{Component:f,route:a});const d=c.props[e.name],E=d?d===!0?a.params:typeof d=="function"?d(a):d:null,b=ve(f,fe({},E,t,{onVnodeUnmounted:g=>{g.component.isUnmounted&&(c.instances[m]=null)},ref:l}));return vs(n.default,{Component:b,route:a})||b}}});function vs(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const Ki=Ku;function Wu(e){const t=Eu(e.routes,e),n=e.parseQuery||Fu,r=e.stringifyQuery||hs,o=e.history,s=rn(),i=rn(),l=rn(),a=Qs(Xe);let c=Xe;Nt&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const f=_r.bind(null,C=>""+C),m=_r.bind(null,Hu),d=_r.bind(null,Qn);function E(C,H){let I,F;return Fi(C)?(I=t.getRecordMatcher(C),F=H):F=C,t.addRoute(F,I)}function h(C){const H=t.getRecordMatcher(C);H&&t.removeRoute(H)}function b(){return t.getRoutes().map(C=>C.record)}function g(C){return!!t.getRecordMatcher(C)}function v(C,H){if(H=fe({},H||a.value),typeof C=="string"){const Z=br(n,C,H.path),u=t.resolve({path:Z.path},H),p=o.createHref(Z.fullPath);return fe(Z,u,{params:d(u.params),hash:Qn(Z.hash),redirectedFrom:void 0,href:p})}let I;if("path"in C)I=fe({},C,{path:br(n,C.path,H.path).path});else{const Z=fe({},C.params);for(const u in Z)Z[u]==null&&delete Z[u];I=fe({},C,{params:m(C.params)}),H.params=m(H.params)}const F=t.resolve(I,H),le=C.hash||"";F.params=f(d(F.params));const ce=Jc(r,fe({},C,{hash:Mu(le),path:F.path})),te=o.createHref(ce);return fe({fullPath:ce,hash:le,query:r===hs?zu(C.query):C.query||{}},F,{redirectedFrom:void 0,href:te})}function T(C){return typeof C=="string"?br(n,C,a.value.path):fe({},C)}function P(C,H){if(c!==C)return Wt(8,{from:H,to:C})}function O(C){return x(C)}function N(C){return O(fe(T(C),{replace:!0}))}function j(C){const H=C.matched[C.matched.length-1];if(H&&H.redirect){const{redirect:I}=H;let F=typeof I=="function"?I(C):I;return typeof F=="string"&&(F=F.includes("?")||F.includes("#")?F=T(F):{path:F},F.params={}),fe({query:C.query,hash:C.hash,params:C.params},F)}}function x(C,H){const I=c=v(C),F=a.value,le=C.state,ce=C.force,te=C.replace===!0,Z=j(I);if(Z)return x(fe(T(Z),{state:le,force:ce,replace:te}),H||I);const u=I;u.redirectedFrom=H;let p;return!ce&&Qc(r,F,I)&&(p=Wt(16,{to:u,from:F}),Ae(F,F,!0,!1)),(p?Promise.resolve(p):G(u,F)).catch(_=>vt(_)?_:X(_,u,F)).then(_=>{if(_){if(vt(_,2))return x(fe(T(_.to),{state:le,force:ce,replace:te}),H||u)}else _=Y(u,F,!0,te,le);return U(u,F,_),_})}function w(C,H){const I=P(C,H);return I?Promise.reject(I):Promise.resolve()}function G(C,H){let I;const[F,le,ce]=Gu(C,H);I=yr(F.reverse(),"beforeRouteLeave",C,H);for(const Z of F)Z.leaveGuards.forEach(u=>{I.push(ut(u,C,H))});const te=w.bind(null,C,H);return I.push(te),It(I).then(()=>{I=[];for(const Z of s.list())I.push(ut(Z,C,H));return I.push(te),It(I)}).then(()=>{I=yr(le,"beforeRouteUpdate",C,H);for(const Z of le)Z.updateGuards.forEach(u=>{I.push(ut(u,C,H))});return I.push(te),It(I)}).then(()=>{I=[];for(const Z of C.matched)if(Z.beforeEnter&&!H.matched.includes(Z))if(Array.isArray(Z.beforeEnter))for(const u of Z.beforeEnter)I.push(ut(u,C,H));else I.push(ut(Z.beforeEnter,C,H));return I.push(te),It(I)}).then(()=>(C.matched.forEach(Z=>Z.enterCallbacks={}),I=yr(ce,"beforeRouteEnter",C,H),I.push(te),It(I))).then(()=>{I=[];for(const Z of i.list())I.push(ut(Z,C,H));return I.push(te),It(I)}).catch(Z=>vt(Z,8)?Z:Promise.reject(Z))}function U(C,H,I){for(const F of l.list())F(C,H,I)}function Y(C,H,I,F,le){const ce=P(C,H);if(ce)return ce;const te=H===Xe,Z=Nt?history.state:{};I&&(F||te?o.replace(C.fullPath,fe({scroll:te&&Z&&Z.scroll},le)):o.push(C.fullPath,le)),a.value=C,Ae(C,H,I,te),ye()}let y;function M(){y=o.listen((C,H,I)=>{const F=v(C),le=j(F);if(le){x(fe(le,{replace:!0}),F).catch(pn);return}c=F;const ce=a.value;Nt&&su(ls(ce.fullPath,I.delta),ar()),G(F,ce).catch(te=>vt(te,12)?te:vt(te,2)?(x(te.to,F).then(Z=>{vt(Z,20)&&!I.delta&&I.type===wn.pop&&o.go(-1,!1)}).catch(pn),Promise.reject()):(I.delta&&o.go(-I.delta,!1),X(te,F,ce))).then(te=>{te=te||Y(F,ce,!1),te&&(I.delta?o.go(-I.delta,!1):I.type===wn.pop&&vt(te,20)&&o.go(-1,!1)),U(F,ce,te)}).catch(pn)})}let W=rn(),ie=rn(),$;function X(C,H,I){ye(C);const F=ie.list();return F.length?F.forEach(le=>le(C,H,I)):console.error(C),Promise.reject(C)}function ne(){return $&&a.value!==Xe?Promise.resolve():new Promise((C,H)=>{W.add([C,H])})}function ye(C){$||($=!0,M(),W.list().forEach(([H,I])=>C?I(C):H()),W.reset())}function Ae(C,H,I,F){const{scrollBehavior:le}=e;if(!Nt||!le)return Promise.resolve();const ce=!I&&iu(ls(C.fullPath,0))||(F||!I)&&history.state&&history.state.scroll||null;return no().then(()=>le(C,H,ce)).then(te=>te&&ou(te)).catch(te=>X(te,C,H))}const Le=C=>o.go(C);let De;const Pe=new Set;return{currentRoute:a,addRoute:E,removeRoute:h,hasRoute:g,getRoutes:b,resolve:v,options:e,push:O,replace:N,go:Le,back:()=>Le(-1),forward:()=>Le(1),beforeEach:s.add,beforeResolve:i.add,afterEach:l.add,onError:ie.add,isReady:ne,install(C){const H=this;C.component("RouterLink",Vu),C.component("RouterView",Ki),C.config.globalProperties.$router=H,Object.defineProperty(C.config.globalProperties,"$route",{enumerable:!0,get:()=>At(a)}),Nt&&!De&&a.value===Xe&&(De=!0,O(o.location).catch(le=>{}));const I={};for(const le in Xe)I[le]=ge(()=>a.value[le]);C.provide(lr,H),C.provide(ho,Jt(I)),C.provide(Nr,a);const F=C.unmount;Pe.add(C),C.unmount=function(){Pe.delete(C),Pe.size<1&&(c=Xe,y&&y(),a.value=Xe,De=!1,$=!1),F()}}}}function It(e){return e.reduce((t,n)=>t.then(()=>n()),Promise.resolve())}function Gu(e,t){const n=[],r=[],o=[],s=Math.max(t.matched.length,e.matched.length);for(let i=0;iKt(c,l))?r.push(l):n.push(l));const a=e.matched[i];a&&(t.matched.find(c=>Kt(c,a))||o.push(a))}return[n,r,o]}function mo(){return Te(lr)}function go(){return Te(ho)}const Yu=qe({setup(e,t){const n=Se(!1);return Ze(()=>{n.value=!0}),()=>{var r,o;return n.value?(o=(r=t.slots).default)===null||o===void 0?void 0:o.call(r):null}}}),Ju="modulepreload",_s={},Qu="/solana-go-sdk/",V=function(t,n){return!n||n.length===0?t():Promise.all(n.map(r=>{if(r=`${Qu}${r}`,r in _s)return;_s[r]=!0;const o=r.endsWith(".css"),s=o?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${r}"]${s}`))return;const i=document.createElement("link");if(i.rel=o?"stylesheet":Ju,o||(i.as="script",i.crossOrigin=""),i.href=r,document.head.appendChild(i),o)return new Promise((l,a)=>{i.addEventListener("load",l),i.addEventListener("error",a)})})).then(()=>t())},Wi={"v-8daa1a0e":ae(()=>V(()=>import("./index.html.c8b9bcbb.js"),[])),"v-59d0d0eb":ae(()=>V(()=>import("./memo.html.1a2a0915.js"),[])),"v-280665e7":ae(()=>V(()=>import("./get-metadata.html.8daeda1b.js"),[])),"v-23bafe30":ae(()=>V(()=>import("./mint-a-nft.html.842fde0f.js"),[])),"v-a02bf734":ae(()=>V(()=>import("./sign-metadata.html.be534e59.js"),[])),"v-b8f58dfe":ae(()=>V(()=>import("./get-signatures-for-address.html.ce25d962.js"),[])),"v-24f1ec82":ae(()=>V(()=>import("./create-account.html.bb41477f.js"),[])),"v-6a1127a4":ae(()=>V(()=>import("./create-mint.html.8c277ef6.js"),[])),"v-3079eed3":ae(()=>V(()=>import("./create-token-account.html.082bc642.js"),[])),"v-35d7797c":ae(()=>V(()=>import("./get-mint.html.d6de7b13.js"),[])),"v-09e730af":ae(()=>V(()=>import("./get-sol-balance.html.9d310a9a.js"),[])),"v-25cdf616":ae(()=>V(()=>import("./get-token-account.html.c10505a4.js"),[])),"v-0f32b5a6":ae(()=>V(()=>import("./get-token-balance.html.b25f50bd.js"),[])),"v-41cbbd5e":ae(()=>V(()=>import("./mint-to.html.71acbc9f.js"),[])),"v-79469b88":ae(()=>V(()=>import("./request-airdrop.html.2cbd486f.js"),[])),"v-eec8ee88":ae(()=>V(()=>import("./token-transfer.html.b2c2d352.js"),[])),"v-7c3a81e0":ae(()=>V(()=>import("./transfer.html.93f621b8.js"),[])),"v-6c8477c6":ae(()=>V(()=>import("./index.html.bb851f19.js"),[])),"v-c5aa4956":ae(()=>V(()=>import("./create-nonce-account.html.c254d86a.js"),[])),"v-ab1b707e":ae(()=>V(()=>import("./get-nonce-account-by-owner.html.4e38d4cc.js"),[])),"v-7b499707":ae(()=>V(()=>import("./get-nonce-account.html.9fe949a4.js"),[])),"v-068ebe3e":ae(()=>V(()=>import("./upgrade-nonce.html.88791bac.js"),[])),"v-5036c796":ae(()=>V(()=>import("./use-nonce.html.440dd4d8.js"),[])),"v-da536522":ae(()=>V(()=>import("./accounts.html.96e253f2.js"),[])),"v-231c922b":ae(()=>V(()=>import("./data.html.c03cd48e.js"),[])),"v-5586a7ea":ae(()=>V(()=>import("./hello.html.b83fb618.js"),[])),"v-3706649a":ae(()=>V(()=>import("./404.html.94d59506.js"),[]))},Zu={"v-8daa1a0e":()=>V(()=>import("./index.html.aa82496b.js"),[]).then(({data:e})=>e),"v-59d0d0eb":()=>V(()=>import("./memo.html.7283ccff.js"),[]).then(({data:e})=>e),"v-280665e7":()=>V(()=>import("./get-metadata.html.2bbab957.js"),[]).then(({data:e})=>e),"v-23bafe30":()=>V(()=>import("./mint-a-nft.html.3f3b89f5.js"),[]).then(({data:e})=>e),"v-a02bf734":()=>V(()=>import("./sign-metadata.html.0570f274.js"),[]).then(({data:e})=>e),"v-b8f58dfe":()=>V(()=>import("./get-signatures-for-address.html.637d35dd.js"),[]).then(({data:e})=>e),"v-24f1ec82":()=>V(()=>import("./create-account.html.8cde0ffe.js"),[]).then(({data:e})=>e),"v-6a1127a4":()=>V(()=>import("./create-mint.html.8c737506.js"),[]).then(({data:e})=>e),"v-3079eed3":()=>V(()=>import("./create-token-account.html.3be4b61e.js"),[]).then(({data:e})=>e),"v-35d7797c":()=>V(()=>import("./get-mint.html.b4cc973b.js"),[]).then(({data:e})=>e),"v-09e730af":()=>V(()=>import("./get-sol-balance.html.6f961e64.js"),[]).then(({data:e})=>e),"v-25cdf616":()=>V(()=>import("./get-token-account.html.e4cf79d9.js"),[]).then(({data:e})=>e),"v-0f32b5a6":()=>V(()=>import("./get-token-balance.html.48dc74ba.js"),[]).then(({data:e})=>e),"v-41cbbd5e":()=>V(()=>import("./mint-to.html.fe63e0ea.js"),[]).then(({data:e})=>e),"v-79469b88":()=>V(()=>import("./request-airdrop.html.fa688e36.js"),[]).then(({data:e})=>e),"v-eec8ee88":()=>V(()=>import("./token-transfer.html.c870739e.js"),[]).then(({data:e})=>e),"v-7c3a81e0":()=>V(()=>import("./transfer.html.565e3105.js"),[]).then(({data:e})=>e),"v-6c8477c6":()=>V(()=>import("./index.html.53b060d9.js"),[]).then(({data:e})=>e),"v-c5aa4956":()=>V(()=>import("./create-nonce-account.html.09101beb.js"),[]).then(({data:e})=>e),"v-ab1b707e":()=>V(()=>import("./get-nonce-account-by-owner.html.e7678f5f.js"),[]).then(({data:e})=>e),"v-7b499707":()=>V(()=>import("./get-nonce-account.html.365f85e2.js"),[]).then(({data:e})=>e),"v-068ebe3e":()=>V(()=>import("./upgrade-nonce.html.c7e291c7.js"),[]).then(({data:e})=>e),"v-5036c796":()=>V(()=>import("./use-nonce.html.7b82dfda.js"),[]).then(({data:e})=>e),"v-da536522":()=>V(()=>import("./accounts.html.26bf1d29.js"),[]).then(({data:e})=>e),"v-231c922b":()=>V(()=>import("./data.html.22999d61.js"),[]).then(({data:e})=>e),"v-5586a7ea":()=>V(()=>import("./hello.html.fc8163f0.js"),[]).then(({data:e})=>e),"v-3706649a":()=>V(()=>import("./404.html.e275e9a9.js"),[]).then(({data:e})=>e)},Gi=Se(Zu),Yi=Zr({key:"",path:"",title:"",lang:"",frontmatter:{},excerpt:"",headers:[]}),tt=Se(Yi),Zt=()=>tt;yo.webpackHot&&(__VUE_HMR_RUNTIME__.updatePageData=e=>{Gi.value[e.key]=()=>Promise.resolve(e),e.key===tt.value.key&&(tt.value=e)});const Ji=Symbol(""),Xu=()=>{const e=Te(Ji);if(!e)throw new Error("usePageFrontmatter() is called without provider.");return e},Qi=Symbol(""),ef=()=>{const e=Te(Qi);if(!e)throw new Error("usePageHead() is called without provider.");return e},tf=Symbol(""),Zi=Symbol(""),nf=()=>{const e=Te(Zi);if(!e)throw new Error("usePageLang() is called without provider.");return e},vo=Symbol(""),rf=()=>{const e=Te(vo);if(!e)throw new Error("useRouteLocale() is called without provider.");return e},of={base:"/solana-go-sdk/",lang:"en-US",title:"Solana Development With Go",description:"",head:[],locales:{}},ft=Se(of),sf=()=>ft;yo.webpackHot&&(__VUE_HMR_RUNTIME__.updateSiteData=e=>{ft.value=e});const Xi=Symbol(""),ch=()=>{const e=Te(Xi);if(!e)throw new Error("useSiteLocaleData() is called without provider.");return e},lf=Symbol(""),_o=e=>{let t;e.pageKey?t=e.pageKey:t=Zt().value.key;const n=Wi[t];return n?ve(n):ve("div","404 Not Found")};_o.displayName="Content";_o.props={pageKey:{type:String,required:!1}};const af={"404":ae(()=>V(()=>import("./404.68265bf7.js"),[])),Layout:ae(()=>V(()=>import("./Layout.5cbefb08.js"),[]))},cf=([e,t,n])=>e==="meta"&&t.name?`${e}.${t.name}`:["title","base"].includes(e)?e:e==="template"&&t.id?`${e}.${t.id}`:JSON.stringify([e,t,n]),uf=e=>{const t=new Set,n=[];return e.forEach(r=>{const o=cf(r);t.has(o)||(t.add(o),n.push(r))}),n},ff=e=>/^(https?:)?\/\//.test(e),uh=e=>/^mailto:/.test(e),fh=e=>/^tel:/.test(e),el=e=>Object.prototype.toString.call(e)==="[object Object]",df=e=>e.replace(/\/$/,""),hf=e=>e.replace(/^\//,""),tl=(e,t)=>{const n=Object.keys(e).sort((r,o)=>{const s=o.split("/").length-r.split("/").length;return s!==0?s:o.length-r.length});for(const r of n)if(t.startsWith(r))return r;return"/"},bs=qe({name:"Vuepress",setup(){const e=Zt(),t=ge(()=>{let n;if(e.value.path){const r=e.value.frontmatter.layout;he(r)?n=r:n="Layout"}else n="404";return af[n]||ec(n,!1)});return()=>ve(t.value)}}),xn=e=>e,cr=e=>e,pf=e=>ff(e)?e:`${sf().value.base}${hf(e)}`,bt=Jt({resolvePageData:async e=>{const t=Gi.value[e],n=await(t==null?void 0:t());return n!=null?n:Yi},resolvePageFrontmatter:e=>e.frontmatter,resolvePageHead:(e,t,n)=>{const r=he(t.description)?t.description:n.description,o=[...J(t.head)?t.head:[],...n.head,["title",{},e],["meta",{name:"description",content:r}]];return uf(o)},resolvePageHeadTitle:(e,t)=>`${e.title?`${e.title} | `:""}${t.title}`,resolvePageLang:e=>e.lang||"en",resolveRouteLocale:(e,t)=>tl(e,t),resolveSiteLocaleData:(e,t)=>We(We({},e),e.locales[t])});const mf=ve("svg",{class:"external-link-icon",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false",x:"0px",y:"0px",viewBox:"0 0 100 100",width:"15",height:"15"},[ve("path",{fill:"currentColor",d:"M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"}),ve("polygon",{fill:"currentColor",points:"45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"})]),gf=qe({name:"ExternalLinkIcon",props:{locales:{type:Object,required:!1,default:()=>({})}},setup(e){const t=rf(),n=ge(()=>{var r;return(r=e.locales[t.value])!==null&&r!==void 0?r:{openInNewWindow:"open in new window"}});return()=>ve("span",[mf,ve("span",{class:"external-link-icon-sr-only"},n.value.openInNewWindow)])}}),vf={"/":{openInNewWindow:"open in new window"}};var _f=xn(({app:e})=>{e.component("ExternalLinkIcon",ve(gf,{locales:vf}))});/*! medium-zoom 1.0.6 | MIT License | https://github.com/francoischalifour/medium-zoom */var yt=Object.assign||function(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{},r=window.Promise||function(y){function M(){}y(M,M)},o=function(y){var M=y.target;if(M===G){h();return}P.indexOf(M)!==-1&&b({target:M})},s=function(){if(!(N||!w.original)){var y=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0;Math.abs(j-y)>x.scrollOffset&&setTimeout(h,150)}},i=function(y){var M=y.key||y.keyCode;(M==="Escape"||M==="Esc"||M===27)&&h()},l=function(){var y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},M=y;if(y.background&&(G.style.background=y.background),y.container&&y.container instanceof Object&&(M.container=yt({},x.container,y.container)),y.template){var W=Nn(y.template)?y.template:document.querySelector(y.template);M.template=W}return x=yt({},x,M),P.forEach(function(ie){ie.dispatchEvent(Bt("medium-zoom:update",{detail:{zoom:U}}))}),U},a=function(){var y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return e(yt({},x,y))},c=function(){for(var y=arguments.length,M=Array(y),W=0;W0?M.reduce(function($,X){return[].concat($,Es(X))},[]):P;return ie.forEach(function($){$.classList.remove("medium-zoom-image"),$.dispatchEvent(Bt("medium-zoom:detach",{detail:{zoom:U}}))}),P=P.filter(function($){return ie.indexOf($)===-1}),U},m=function(y,M){var W=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return P.forEach(function(ie){ie.addEventListener("medium-zoom:"+y,M,W)}),O.push({type:"medium-zoom:"+y,listener:M,options:W}),U},d=function(y,M){var W=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return P.forEach(function(ie){ie.removeEventListener("medium-zoom:"+y,M,W)}),O=O.filter(function(ie){return!(ie.type==="medium-zoom:"+y&&ie.listener.toString()===M.toString())}),U},E=function(){var y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},M=y.target,W=function(){var $={width:document.documentElement.clientWidth,height:document.documentElement.clientHeight,left:0,top:0,right:0,bottom:0},X=void 0,ne=void 0;if(x.container)if(x.container instanceof Object)$=yt({},$,x.container),X=$.width-$.left-$.right-x.margin*2,ne=$.height-$.top-$.bottom-x.margin*2;else{var ye=Nn(x.container)?x.container:document.querySelector(x.container),Ae=ye.getBoundingClientRect(),Le=Ae.width,De=Ae.height,Pe=Ae.left,Xt=Ae.top;$=yt({},$,{width:Le,height:De,left:Pe,top:Xt})}X=X||$.width-x.margin*2,ne=ne||$.height-x.margin*2;var C=w.zoomedHd||w.original,H=ys(C)?X:C.naturalWidth||X,I=ys(C)?ne:C.naturalHeight||ne,F=C.getBoundingClientRect(),le=F.top,ce=F.left,te=F.width,Z=F.height,u=Math.min(H,X)/te,p=Math.min(I,ne)/Z,_=Math.min(u,p),S=(-ce+(X-te)/2+x.margin+$.left)/_,A=(-le+(ne-Z)/2+x.margin+$.top)/_,L="scale("+_+") translate3d("+S+"px, "+A+"px, 0)";w.zoomed.style.transform=L,w.zoomedHd&&(w.zoomedHd.style.transform=L)};return new r(function(ie){if(M&&P.indexOf(M)===-1){ie(U);return}var $=function Le(){N=!1,w.zoomed.removeEventListener("transitionend",Le),w.original.dispatchEvent(Bt("medium-zoom:opened",{detail:{zoom:U}})),ie(U)};if(w.zoomed){ie(U);return}if(M)w.original=M;else if(P.length>0){var X=P;w.original=X[0]}else{ie(U);return}if(w.original.dispatchEvent(Bt("medium-zoom:open",{detail:{zoom:U}})),j=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,N=!0,w.zoomed=Ef(w.original),document.body.appendChild(G),x.template){var ne=Nn(x.template)?x.template:document.querySelector(x.template);w.template=document.createElement("div"),w.template.appendChild(ne.content.cloneNode(!0)),document.body.appendChild(w.template)}if(document.body.appendChild(w.zoomed),window.requestAnimationFrame(function(){document.body.classList.add("medium-zoom--opened")}),w.original.classList.add("medium-zoom-image--hidden"),w.zoomed.classList.add("medium-zoom-image--opened"),w.zoomed.addEventListener("click",h),w.zoomed.addEventListener("transitionend",$),w.original.getAttribute("data-zoom-src")){w.zoomedHd=w.zoomed.cloneNode(),w.zoomedHd.removeAttribute("srcset"),w.zoomedHd.removeAttribute("sizes"),w.zoomedHd.src=w.zoomed.getAttribute("data-zoom-src"),w.zoomedHd.onerror=function(){clearInterval(ye),console.warn("Unable to reach the zoom image target "+w.zoomedHd.src),w.zoomedHd=null,W()};var ye=setInterval(function(){w.zoomedHd.complete&&(clearInterval(ye),w.zoomedHd.classList.add("medium-zoom-image--opened"),w.zoomedHd.addEventListener("click",h),document.body.appendChild(w.zoomedHd),W())},10)}else if(w.original.hasAttribute("srcset")){w.zoomedHd=w.zoomed.cloneNode(),w.zoomedHd.removeAttribute("sizes"),w.zoomedHd.removeAttribute("loading");var Ae=w.zoomedHd.addEventListener("load",function(){w.zoomedHd.removeEventListener("load",Ae),w.zoomedHd.classList.add("medium-zoom-image--opened"),w.zoomedHd.addEventListener("click",h),document.body.appendChild(w.zoomedHd),W()})}else W()})},h=function(){return new r(function(y){if(N||!w.original){y(U);return}var M=function W(){w.original.classList.remove("medium-zoom-image--hidden"),document.body.removeChild(w.zoomed),w.zoomedHd&&document.body.removeChild(w.zoomedHd),document.body.removeChild(G),w.zoomed.classList.remove("medium-zoom-image--opened"),w.template&&document.body.removeChild(w.template),N=!1,w.zoomed.removeEventListener("transitionend",W),w.original.dispatchEvent(Bt("medium-zoom:closed",{detail:{zoom:U}})),w.original=null,w.zoomed=null,w.zoomedHd=null,w.template=null,y(U)};N=!0,document.body.classList.remove("medium-zoom--opened"),w.zoomed.style.transform="",w.zoomedHd&&(w.zoomedHd.style.transform=""),w.template&&(w.template.style.transition="opacity 150ms",w.template.style.opacity=0),w.original.dispatchEvent(Bt("medium-zoom:close",{detail:{zoom:U}})),w.zoomed.addEventListener("transitionend",M)})},b=function(){var y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},M=y.target;return w.original?h():E({target:M})},g=function(){return x},v=function(){return P},T=function(){return w.original},P=[],O=[],N=!1,j=0,x=n,w={original:null,zoomed:null,zoomedHd:null,template:null};Object.prototype.toString.call(t)==="[object Object]"?x=t:(t||typeof t=="string")&&c(t),x=yt({margin:0,background:"#fff",scrollOffset:40,container:null,template:null},x);var G=yf(x.background);document.addEventListener("click",o),document.addEventListener("keyup",i),document.addEventListener("scroll",s),window.addEventListener("resize",h);var U={open:E,close:h,toggle:b,update:l,clone:a,attach:c,detach:f,on:m,off:d,getOptions:g,getImages:v,getZoomedImage:T};return U};function Tf(e,t){t===void 0&&(t={});var n=t.insertAt;if(!(!e||typeof document=="undefined")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",n==="top"&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}var Cf=".medium-zoom-overlay{position:fixed;top:0;right:0;bottom:0;left:0;opacity:0;transition:opacity .3s;will-change:opacity}.medium-zoom--opened .medium-zoom-overlay{cursor:pointer;cursor:zoom-out;opacity:1}.medium-zoom-image{cursor:pointer;cursor:zoom-in;transition:transform .3s cubic-bezier(.2,0,.2,1)!important}.medium-zoom-image--hidden{visibility:hidden}.medium-zoom-image--opened{position:relative;cursor:pointer;cursor:zoom-out;will-change:transform}";Tf(Cf);var Af=wf;const xf=Symbol("mediumZoom");const Sf=".theme-default-content > img, .theme-default-content :not(a) > img",Pf={},Rf=300;var Of=xn(({app:e,router:t})=>{const n=Af(Pf);n.refresh=(r=Sf)=>{n.detach(),n.attach(r)},e.provide(xf,n),t.afterEach(()=>{setTimeout(()=>n.refresh(),Rf)})});const Lf={navbar:[{text:"GitHub",link:"https://github.com/blocto/solana-go-sdk"}],locales:{"/":{selectLanguageName:"English",sidebar:[{text:"Tour",children:[{text:"Basic",children:[{text:"Create Account",link:"/tour/create-account"},{text:"Request Airdrop",link:"/tour/request-airdrop"},{text:"Get Balance",link:"/tour/get-sol-balance"},{text:"Transfer",link:"/tour/transfer"}]},{text:"Token",children:[{text:"Create Mint",link:"/tour/create-mint"},{text:"Get Mint",link:"/tour/get-mint"},{text:"Create Token Account",link:"/tour/create-token-account"},{text:"Get Token Account",link:"/tour/get-token-account"},{text:"Mint To",link:"/tour/mint-to"},{text:"Get Balance",link:"/tour/get-token-balance"},{text:"Transfer",link:"/tour/token-transfer"}]}]},{text:"NFT",children:[{text:"Mint a NFT",link:"/nft/mint-a-nft"},{text:"Get Metadata",link:"/nft/get-metadata"},{text:"Sign Metadata",link:"/nft/sign-metadata"}]},{text:"Advanced",children:[{text:"Add Memo",link:"/advanced/memo"},{text:"Durable Nonce",link:"/advanced/durable-nonce/README.md",children:[{text:"Create Nonce Account",link:"/advanced/durable-nonce/create-nonce-account"},{text:"Get Nonce Account",link:"/advanced/durable-nonce/get-nonce-account"},{text:"Use Nonce",link:"/advanced/durable-nonce/use-nonce"},{text:"Upgrade Nonce",link:"/advanced/durable-nonce/upgrade-nonce"},{text:"Get Nonce Account By Owner",link:"/advanced/durable-nonce/get-nonce-account-by-owner"}]}]},{text:"RPC",children:[{text:"Get Signatures For Address",link:"/rpc/get-signatures-for-address"}]},{text:"Program",children:[{text:"101",children:[{text:"Hello",link:"/programs/101/hello"},{text:"Accounts",link:"/programs/101/accounts"},{text:"Data",link:"/programs/101/data"}]}]}]}},logo:null,darkMode:!0,repo:null,selectLanguageText:"Languages",selectLanguageAriaLabel:"Select language",sidebar:"auto",sidebarDepth:2,editLink:!0,editLinkText:"Edit this page",lastUpdated:!0,lastUpdatedText:"Last Updated",contributors:!0,contributorsText:"Contributors",notFound:["There's nothing here.","How did we get here?","That's a Four-Oh-Four.","Looks like we've got some broken links."],backToHome:"Take me home",openInNewWindow:"open in new window",toggleDarkMode:"toggle dark mode",toggleSidebar:"toggle sidebar"},nl=Se(Lf),kf=()=>nl;yo.webpackHot&&(__VUE_HMR_RUNTIME__.updateThemeData=e=>{nl.value=e});const rl=Symbol(""),If=()=>{const e=Te(rl);if(!e)throw new Error("useThemeLocaleData() is called without provider.");return e},Bf=(e,t)=>{var n;return We(We({},e),(n=e.locales)===null||n===void 0?void 0:n[t])};var Mf=xn(({app:e})=>{const t=kf(),n=e._context.provides[vo],r=ge(()=>Bf(t.value,n.value));e.provide(rl,r),Object.defineProperties(e.config.globalProperties,{$theme:{get(){return t.value}},$themeLocale:{get(){return r.value}}})});const Df=qe({props:{type:{type:String,required:!1,default:"tip"},text:{type:String,required:!1,default:""},vertical:{type:String,required:!1,default:void 0}},setup(e){return(t,n)=>(jt(),Wn("span",{class:Rt(["badge",e.type]),style:$t({verticalAlign:e.vertical})},[Si(t.$slots,"default",{},()=>[ao(Rs(e.text),1)])],6))}});var Nf=qe({name:"CodeGroup",setup(e,{slots:t}){const n=Se(-1),r=Se([]),o=(l=n.value)=>{l{l>0?n.value=l-1:n.value=r.value.length-1,r.value[n.value].focus()},i=(l,a)=>{l.key===" "||l.key==="Enter"?(l.preventDefault(),n.value=a):l.key==="ArrowRight"?(l.preventDefault(),o(a)):l.key==="ArrowLeft"&&(l.preventDefault(),s(a))};return()=>{var l;const a=(((l=t.default)===null||l===void 0?void 0:l.call(t))||[]).filter(c=>c.type.name==="CodeGroupItem").map(c=>(c.props===null&&(c.props={}),c));return a.length===0?null:(n.value<0||n.value>a.length-1?(n.value=a.findIndex(c=>c.props.active===""||c.props.active===!0),n.value===-1&&(n.value=0)):a.forEach((c,f)=>{c.props.active=f===n.value}),ve("div",{class:"code-group"},[ve("div",{class:"code-group__nav"},ve("ul",{class:"code-group__ul"},a.map((c,f)=>{const m=f===n.value;return ve("li",{class:"code-group__li"},ve("button",{ref:d=>{d&&(r.value[f]=d)},class:{"code-group__nav-tab":!0,"code-group__nav-tab-active":m},ariaPressed:m,ariaExpanded:m,onClick:()=>n.value=f,onKeydown:d=>i(d,f)},c.props.title))}))),a]))}}});const Hf=["aria-selected"],Ff=qe({name:"CodeGroupItem"}),zf=qe(Pn(We({},Ff),{props:{title:{type:String,required:!0},active:{type:Boolean,required:!1,default:!1}},setup(e){return(t,n)=>(jt(),Wn("div",{class:Rt(["code-group-item",{"code-group-item__active":e.active}]),"aria-selected":e.active},[Si(t.$slots,"default")],10,Hf))}}));function ol(e){return Ll()?(kl(e),!0):!1}const Sn=typeof window!="undefined",$f=e=>typeof e=="string",Er=()=>{};function jf(e,t){function n(...r){e(()=>t.apply(this,r),{fn:t,thisArg:this,args:r})}return n}const Vf=e=>e();var ws=Object.getOwnPropertySymbols,Uf=Object.prototype.hasOwnProperty,qf=Object.prototype.propertyIsEnumerable,Kf=(e,t)=>{var n={};for(var r in e)Uf.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ws)for(var r of ws(e))t.indexOf(r)<0&&qf.call(e,r)&&(n[r]=e[r]);return n};function Wf(e,t,n={}){const r=n,{eventFilter:o=Vf}=r,s=Kf(r,["eventFilter"]);return Je(e,jf(o,t),s)}function Gf(e,t=!0){Ri()?Ze(e):t?e():no(e)}const Zn=Sn?window:void 0;Sn&&window.document;Sn&&window.navigator;Sn&&window.location;function Yf(...e){let t,n,r,o;if($f(e[0])?([n,r,o]=e,t=Zn):[t,n,r,o]=e,!t)return Er;let s=Er;const i=Je(()=>At(t),a=>{s(),!!a&&(a.addEventListener(n,r,o),s=()=>{a.removeEventListener(n,r,o),s=Er})},{immediate:!0,flush:"post"}),l=()=>{i(),s()};return ol(l),l}function Jf(e,t={}){const{window:n=Zn}=t;let r;const o=Se(!1),s=()=>{!n||(r||(r=n.matchMedia(e)),o.value=r.matches)};return Gf(()=>{s(),!!r&&("addEventListener"in r?r.addEventListener("change",s):r.addListener(s),ol(()=>{"removeEventListener"in s?r.removeEventListener("change",s):r.removeListener(s)}))}),o}const zr=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},$r="__vueuse_ssr_handlers__";zr[$r]=zr[$r]||{};const Qf=zr[$r];function Zf(e,t){return Qf[e]||t}function Xf(e){return e==null?"any":e instanceof Set?"set":e instanceof Map?"map":typeof e=="boolean"?"boolean":typeof e=="string"?"string":typeof e=="object"||Array.isArray(e)?"object":Number.isNaN(e)?"any":"number"}const ed={boolean:{read:e=>e==="true",write:e=>String(e)},object:{read:e=>JSON.parse(e),write:e=>JSON.stringify(e)},number:{read:e=>Number.parseFloat(e),write:e=>String(e)},any:{read:e=>e,write:e=>String(e)},string:{read:e=>e,write:e=>String(e)},map:{read:e=>new Map(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e.entries()))},set:{read:e=>new Set(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e.entries()))}};function td(e,t,n,r={}){var o;const{flush:s="pre",deep:i=!0,listenToStorageChanges:l=!0,writeDefaults:a=!0,shallow:c,window:f=Zn,eventFilter:m,onError:d=T=>{console.error(T)}}=r,E=At(t),h=Xf(E),b=(c?Qs:Se)(t),g=(o=r.serializer)!=null?o:ed[h];if(!n)try{n=Zf("getDefaultStorage",()=>{var T;return(T=Zn)==null?void 0:T.localStorage})()}catch(T){d(T)}function v(T){if(!(!n||T&&T.key!==e))try{const P=T?T.newValue:n.getItem(e);P==null?(b.value=E,a&&E!==null&&n.setItem(e,g.write(E))):typeof P!="string"?b.value=P:b.value=g.read(P)}catch(P){d(P)}}return v(),f&&l&&Yf(f,"storage",T=>setTimeout(()=>v(T),0)),n&&Wf(b,()=>{try{b.value==null?n.removeItem(e):n.setItem(e,g.write(b.value))}catch(T){d(T)}},{flush:s,deep:i,eventFilter:m}),b}function nd(e){return Jf("(prefers-color-scheme: dark)",e)}var Ts,Cs;Sn&&(window==null?void 0:window.navigator)&&((Ts=window==null?void 0:window.navigator)==null?void 0:Ts.platform)&&/iP(ad|hone|od)/.test((Cs=window==null?void 0:window.navigator)==null?void 0:Cs.platform);var rd=Object.defineProperty,As=Object.getOwnPropertySymbols,od=Object.prototype.hasOwnProperty,sd=Object.prototype.propertyIsEnumerable,xs=(e,t,n)=>t in e?rd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,id=(e,t)=>{for(var n in t||(t={}))od.call(t,n)&&xs(e,n,t[n]);if(As)for(var n of As(t))sd.call(t,n)&&xs(e,n,t[n]);return e};const ld={top:0,left:0,bottom:0,right:0,height:0,width:0};id({text:""},ld);const sl=Symbol(""),dh=()=>{const e=Te(sl);if(!e)throw new Error("useDarkMode() is called without provider.");return e},ad=()=>{const e=cl(),t=nd(),n=td("vuepress-color-scheme","auto"),r=ge({get(){return e.value.darkMode?n.value==="auto"?t.value:n.value==="dark":!1},set(o){o===t.value?n.value="auto":n.value=o?"dark":"light"}});xt(sl,r),cd(r)},cd=e=>{const t=(n=e.value)=>{const r=window==null?void 0:window.document.querySelector("html");r==null||r.classList.toggle("dark",n)};Ze(()=>{Je(e,t,{immediate:!0})}),io(()=>t())},il=(...e)=>{const n=mo().resolve(...e),r=n.matched[n.matched.length-1];if(!(r==null?void 0:r.redirect))return n;const{redirect:o}=r,s=ee(o)?o(n):o,i=he(s)?{path:s}:s;return il(We({hash:n.hash,query:n.query,params:n.params},i))},ud=e=>{const t=il(e);return{text:t.meta.title||e,link:t.name==="404"?e:t.fullPath}};let wr=null,on=null;const fd={wait:()=>wr,pending:()=>{wr=new Promise(e=>on=e)},resolve:()=>{on==null||on(),wr=null,on=null}},dd=()=>fd,ll=Symbol("sidebarItems"),hh=()=>{const e=Te(ll);if(!e)throw new Error("useSidebarItems() is called without provider.");return e},hd=()=>{const e=cl(),t=Xu(),n=ge(()=>pd(t.value,e.value));xt(ll,n)},pd=(e,t)=>{var n,r,o,s;const i=(r=(n=e.sidebar)!==null&&n!==void 0?n:t.sidebar)!==null&&r!==void 0?r:"auto",l=(s=(o=e.sidebarDepth)!==null&&o!==void 0?o:t.sidebarDepth)!==null&&s!==void 0?s:2;return e.home||i===!1?[]:i==="auto"?gd(l):J(i)?al(i,l):el(i)?vd(i,l):[]},md=(e,t)=>({text:e.title,link:`#${e.slug}`,children:bo(e.children,t)}),bo=(e,t)=>t>0?e.map(n=>md(n,t-1)):[],gd=e=>{const t=Zt();return[{text:t.value.title,children:bo(t.value.headers,e)}]},al=(e,t)=>{const n=go(),r=Zt(),o=s=>{var i;let l;if(he(s)?l=ud(s):l=s,l.children)return Pn(We({},l),{children:l.children.map(a=>o(a))});if(l.link===n.path){const a=((i=r.value.headers[0])===null||i===void 0?void 0:i.level)===1?r.value.headers[0].children:r.value.headers;return Pn(We({},l),{children:bo(a,t)})}return l};return e.map(s=>o(s))},vd=(e,t)=>{var n;const r=go(),o=tl(e,r.path),s=(n=e[o])!==null&&n!==void 0?n:[];return al(s,t)},cl=()=>If();var _d=xn(({app:e,router:t})=>{e.component("Badge",Df),e.component("CodeGroup",Nf),e.component("CodeGroupItem",zf),e.component("NavbarSearch",()=>{const r=e.component("Docsearch")||e.component("SearchBox");return r?ve(r):null});const n=t.options.scrollBehavior;t.options.scrollBehavior=async(...r)=>(await dd().wait(),n(...r))});var bd=(e,t)=>{const n=e.__vccOpts||e;for(const[r,o]of t)n[r]=o;return n};const yd={name:"CodeCopy",props:{parent:Object,code:String,options:{align:String,color:String,backgroundTransition:Boolean,backgroundColor:String,successText:String,successTextColor:String,staticIcon:Boolean}},data(){return{success:!1,originalBackground:null,originalTransition:null}},computed:{alignStyle(){let e={};return e[this.options.align]="7.5px",e},iconClass(){return this.options.staticIcon?"":"hover"}},mounted(){this.originalTransition=this.parent.style.transition,this.originalBackground=this.parent.style.background},beforeDestroy(){this.parent.style.transition=this.originalTransition,this.parent.style.background=this.originalBackground},methods:{hexToRgb(e){let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null},copyToClipboard(e){if(navigator.clipboard)navigator.clipboard.writeText(this.code).then(()=>{this.setSuccessTransitions()},()=>{});else{let t=document.createElement("textarea");document.body.appendChild(t),t.value=this.code,t.select(),document.execCommand("Copy"),t.remove(),this.setSuccessTransitions()}},setSuccessTransitions(){if(clearTimeout(this.successTimeout),this.options.backgroundTransition){this.parent.style.transition="background 350ms";let e=this.hexToRgb(this.options.backgroundColor);this.parent.style.background=`rgba(${e.r}, ${e.g}, ${e.b}, 0.1)`}this.success=!0,this.successTimeout=setTimeout(()=>{this.options.backgroundTransition&&(this.parent.style.background=this.originalBackground,this.parent.style.transition=this.originalTransition),this.success=!1},500)}}},Ed=e=>(va("data-v-51dd6513"),e=e(),_a(),e),wd={class:"code-copy"},Td=Ed(()=>En("path",{fill:"none",d:"M0 0h24v24H0z"},null,-1)),Cd=["fill"];function Ad(e,t,n,r,o,s){return jt(),Wn("div",wd,[(jt(),Wn("svg",{onClick:t[0]||(t[0]=(...i)=>s.copyToClipboard&&s.copyToClipboard(...i)),xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",class:Rt(s.iconClass),style:$t(s.alignStyle)},[Td,En("path",{fill:n.options.color,d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4l6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h7zm-1 7h5.5L14 6.5V12z"},null,8,Cd)],6)),En("span",{class:Rt(o.success?"success":""),style:$t(We({color:n.options.successTextColor},s.alignStyle))},Rs(n.options.successText),7)])}var ul=bd(yd,[["render",Ad],["__scopeId","data-v-51dd6513"]]),xd=xn(({app:e,router:t,siteData:n})=>{e.component("CodeCopy",ul)});const Sd=[_f,Of,Mf,_d,xd];function fl(e,t,n){var r,o,s;t===void 0&&(t=50),n===void 0&&(n={});var i=(r=n.isImmediate)!=null&&r,l=(o=n.callback)!=null&&o,a=n.maxWait,c=Date.now(),f=[];function m(){if(a!==void 0){var E=Date.now()-c;if(E+t>=a)return a-E}return t}var d=function(){var E=[].slice.call(arguments),h=this;return new Promise(function(b,g){var v=i&&s===void 0;if(s!==void 0&&clearTimeout(s),s=setTimeout(function(){if(s=void 0,c=Date.now(),!i){var P=e.apply(h,E);l&&l(P),f.forEach(function(O){return(0,O.resolve)(P)}),f=[]}},m()),v){var T=e.apply(h,E);return l&&l(T),b(T)}f.push({resolve:b,reject:g})})};return d.cancel=function(E){s!==void 0&&clearTimeout(s),f.forEach(function(h){return(0,h.reject)(E)}),f=[]},d}const Ss=()=>window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,Pd=()=>window.scrollTo({top:0,behavior:"smooth"});const Rd=qe({name:"BackToTop",setup(){const e=Se(0),t=ge(()=>e.value>300),n=fl(()=>{e.value=Ss()},100);Ze(()=>{e.value=Ss(),window.addEventListener("scroll",()=>n())});const r=ve("div",{class:"back-to-top",onClick:Pd});return()=>ve(fo,{name:"back-to-top"},{default:()=>t.value?r:null})}}),Od=[Rd],Ld=({headerLinkSelector:e,headerAnchorSelector:t,delay:n,offset:r=5})=>{const o=mo(),s=Zt(),l=fl(()=>{var a,c,f,m;const d=Array.from(document.querySelectorAll(e)),h=Array.from(document.querySelectorAll(t)).filter(P=>d.some(O=>O.hash===P.hash)),b=Math.max(window.pageYOffset,document.documentElement.scrollTop,document.body.scrollTop),g=window.innerHeight+b,v=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),T=Math.abs(v-g)=((c=(a=O.parentElement)===null||a===void 0?void 0:a.offsetTop)!==null&&c!==void 0?c:0)-r,w=!N||b<((m=(f=N.parentElement)===null||f===void 0?void 0:f.offsetTop)!==null&&m!==void 0?m:0)-r;if(!(j||x&&w))continue;const U=decodeURIComponent(o.currentRoute.value.hash),Y=decodeURIComponent(O.hash);if(U===Y)return;if(T){for(let y=P+1;y{l(),window.addEventListener("scroll",l)}),sr(()=>{window.removeEventListener("scroll",l)}),Je(()=>s.value.path,l)},kd=async(e,...t)=>{const{scrollBehavior:n}=e.options;e.options.scrollBehavior=void 0,await e.replace(...t).finally(()=>e.options.scrollBehavior=n)},Id="a.sidebar-item",Bd=".header-anchor",Md=300,Dd=5;var Nd=cr(()=>{Ld({headerLinkSelector:Id,headerAnchorSelector:Bd,delay:Md,offset:Dd})}),Hd=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},Hn={exports:{}};/* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress + * @license MIT */(function(e,t){(function(n,r){e.exports=r()})(Hd,function(){var n={};n.version="0.2.0";var r=n.settings={minimum:.08,easing:"ease",positionUsing:"",speed:200,trickle:!0,trickleRate:.02,trickleSpeed:800,showSpinner:!0,barSelector:'[role="bar"]',spinnerSelector:'[role="spinner"]',parent:"body",template:'
'};n.configure=function(h){var b,g;for(b in h)g=h[b],g!==void 0&&h.hasOwnProperty(b)&&(r[b]=g);return this},n.status=null,n.set=function(h){var b=n.isStarted();h=o(h,r.minimum,1),n.status=h===1?null:h;var g=n.render(!b),v=g.querySelector(r.barSelector),T=r.speed,P=r.easing;return g.offsetWidth,l(function(O){r.positionUsing===""&&(r.positionUsing=n.getPositioningCSS()),a(v,i(h,T,P)),h===1?(a(g,{transition:"none",opacity:1}),g.offsetWidth,setTimeout(function(){a(g,{transition:"all "+T+"ms linear",opacity:0}),setTimeout(function(){n.remove(),O()},T)},T)):setTimeout(O,T)}),this},n.isStarted=function(){return typeof n.status=="number"},n.start=function(){n.status||n.set(0);var h=function(){setTimeout(function(){!n.status||(n.trickle(),h())},r.trickleSpeed)};return r.trickle&&h(),this},n.done=function(h){return!h&&!n.status?this:n.inc(.3+.5*Math.random()).set(1)},n.inc=function(h){var b=n.status;return b?(typeof h!="number"&&(h=(1-b)*o(Math.random()*b,.1,.95)),b=o(b+h,0,.994),n.set(b)):n.start()},n.trickle=function(){return n.inc(Math.random()*r.trickleRate)},function(){var h=0,b=0;n.promise=function(g){return!g||g.state()==="resolved"?this:(b===0&&n.start(),h++,b++,g.always(function(){b--,b===0?(h=0,n.done()):n.set((h-b)/h)}),this)}}(),n.render=function(h){if(n.isRendered())return document.getElementById("nprogress");f(document.documentElement,"nprogress-busy");var b=document.createElement("div");b.id="nprogress",b.innerHTML=r.template;var g=b.querySelector(r.barSelector),v=h?"-100":s(n.status||0),T=document.querySelector(r.parent),P;return a(g,{transition:"all 0 linear",transform:"translate3d("+v+"%,0,0)"}),r.showSpinner||(P=b.querySelector(r.spinnerSelector),P&&E(P)),T!=document.body&&f(T,"nprogress-custom-parent"),T.appendChild(b),b},n.remove=function(){m(document.documentElement,"nprogress-busy"),m(document.querySelector(r.parent),"nprogress-custom-parent");var h=document.getElementById("nprogress");h&&E(h)},n.isRendered=function(){return!!document.getElementById("nprogress")},n.getPositioningCSS=function(){var h=document.body.style,b="WebkitTransform"in h?"Webkit":"MozTransform"in h?"Moz":"msTransform"in h?"ms":"OTransform"in h?"O":"";return b+"Perspective"in h?"translate3d":b+"Transform"in h?"translate":"margin"};function o(h,b,g){return hg?g:h}function s(h){return(-1+h)*100}function i(h,b,g){var v;return r.positionUsing==="translate3d"?v={transform:"translate3d("+s(h)+"%,0,0)"}:r.positionUsing==="translate"?v={transform:"translate("+s(h)+"%,0)"}:v={"margin-left":s(h)+"%"},v.transition="all "+b+"ms "+g,v}var l=function(){var h=[];function b(){var g=h.shift();g&&g(b)}return function(g){h.push(g),h.length==1&&b()}}(),a=function(){var h=["Webkit","O","Moz","ms"],b={};function g(O){return O.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,function(N,j){return j.toUpperCase()})}function v(O){var N=document.body.style;if(O in N)return O;for(var j=h.length,x=O.charAt(0).toUpperCase()+O.slice(1),w;j--;)if(w=h[j]+x,w in N)return w;return O}function T(O){return O=g(O),b[O]||(b[O]=v(O))}function P(O,N,j){N=T(N),O.style[N]=j}return function(O,N){var j=arguments,x,w;if(j.length==2)for(x in N)w=N[x],w!==void 0&&N.hasOwnProperty(x)&&P(O,x,w);else P(O,j[1],j[2])}}();function c(h,b){var g=typeof h=="string"?h:d(h);return g.indexOf(" "+b+" ")>=0}function f(h,b){var g=d(h),v=g+b;c(g,b)||(h.className=v.substring(1))}function m(h,b){var g=d(h),v;!c(h,b)||(v=g.replace(" "+b+" "," "),h.className=v.substring(1,v.length-1))}function d(h){return(" "+(h.className||"")+" ").replace(/\s+/gi," ")}function E(h){h&&h.parentNode&&h.parentNode.removeChild(h)}return n})})(Hn);const Fd=()=>{Ze(()=>{const e=mo(),t=new Set;t.add(e.currentRoute.value.path),Hn.exports.configure({showSpinner:!1}),e.beforeEach(n=>{t.has(n.path)||Hn.exports.start()}),e.afterEach(n=>{t.add(n.path),Hn.exports.done()})})};var zd=cr(()=>{Fd()}),$d=cr(()=>{ad(),hd()});var jd=cr(()=>{const e=Zt(),t=()=>{setTimeout(()=>{document.querySelectorAll('div[class*="language-"]').forEach(n=>{if(n.classList.contains("code-copy-added"))return;let r={align:"bottom",color:"#BBBBBB",backgroundTransition:!0,backgroundColor:"#0075b8",successText:"Copied!",successTextColor:"#BBBBBB",staticIcon:!1},o=Uc(ul,{parent:n,code:n.querySelector("pre").innerText,options:r}),s=document.createElement("div");n.appendChild(s),o.mount(s),n.classList.add("code-copy-added")})},100)};return Ze(()=>{t(),window.addEventListener("snippetors-vuepress-plugin-code-copy-update-event",t)}),sr(()=>{window.removeEventListener("snippetors-vuepress-plugin-code-copy-update-event",t)}),di(()=>{t()}),Je(()=>e.value.path,t),t});const Vd=[Nd,zd,$d,jd],Ud=[["v-8daa1a0e","/",{title:"Solana Development With Go"},["/index.html","/README.md"]],["v-59d0d0eb","/advanced/memo.html",{title:"Add Memo"},["/advanced/memo","/advanced/memo.md"]],["v-280665e7","/nft/get-metadata.html",{title:"Get Token Metadata"},["/nft/get-metadata","/nft/get-metadata.md"]],["v-23bafe30","/nft/mint-a-nft.html",{title:"Mint A NFT"},["/nft/mint-a-nft","/nft/mint-a-nft.md"]],["v-a02bf734","/nft/sign-metadata.html",{title:"Sign Metadata"},["/nft/sign-metadata","/nft/sign-metadata.md"]],["v-b8f58dfe","/rpc/get-signatures-for-address.html",{title:"Get Signatures For Address"},["/rpc/get-signatures-for-address","/rpc/get-signatures-for-address.md"]],["v-24f1ec82","/tour/create-account.html",{title:"Create Account"},["/tour/create-account","/tour/create-account.md"]],["v-6a1127a4","/tour/create-mint.html",{title:"Create Mint"},["/tour/create-mint","/tour/create-mint.md"]],["v-3079eed3","/tour/create-token-account.html",{title:"Create Token Account"},["/tour/create-token-account","/tour/create-token-account.md"]],["v-35d7797c","/tour/get-mint.html",{title:"Get Mint"},["/tour/get-mint","/tour/get-mint.md"]],["v-09e730af","/tour/get-sol-balance.html",{title:"Get Balance"},["/tour/get-sol-balance","/tour/get-sol-balance.md"]],["v-25cdf616","/tour/get-token-account.html",{title:"Get Token Account"},["/tour/get-token-account","/tour/get-token-account.md"]],["v-0f32b5a6","/tour/get-token-balance.html",{title:"Get Token Balance"},["/tour/get-token-balance","/tour/get-token-balance.md"]],["v-41cbbd5e","/tour/mint-to.html",{title:"Mint To"},["/tour/mint-to","/tour/mint-to.md"]],["v-79469b88","/tour/request-airdrop.html",{title:"Request Airdrop"},["/tour/request-airdrop","/tour/request-airdrop.md"]],["v-eec8ee88","/tour/token-transfer.html",{title:"Token Transfer"},["/tour/token-transfer","/tour/token-transfer.md"]],["v-7c3a81e0","/tour/transfer.html",{title:"Transfer"},["/tour/transfer","/tour/transfer.md"]],["v-6c8477c6","/advanced/durable-nonce/",{title:"Durable Nonce"},["/advanced/durable-nonce/index.html","/advanced/durable-nonce/README.md"]],["v-c5aa4956","/advanced/durable-nonce/create-nonce-account.html",{title:"Create Nonce Account"},["/advanced/durable-nonce/create-nonce-account","/advanced/durable-nonce/create-nonce-account.md"]],["v-ab1b707e","/advanced/durable-nonce/get-nonce-account-by-owner.html",{title:"Get Nonce Account By Owner"},["/advanced/durable-nonce/get-nonce-account-by-owner","/advanced/durable-nonce/get-nonce-account-by-owner.md"]],["v-7b499707","/advanced/durable-nonce/get-nonce-account.html",{title:"Get Nonce Account"},["/advanced/durable-nonce/get-nonce-account","/advanced/durable-nonce/get-nonce-account.md"]],["v-068ebe3e","/advanced/durable-nonce/upgrade-nonce.html",{title:"Upgrade Nonce"},["/advanced/durable-nonce/upgrade-nonce","/advanced/durable-nonce/upgrade-nonce.md"]],["v-5036c796","/advanced/durable-nonce/use-nonce.html",{title:"Use Nonce"},["/advanced/durable-nonce/use-nonce","/advanced/durable-nonce/use-nonce.md"]],["v-da536522","/programs/101/accounts.html",{title:"Accounts"},["/programs/101/accounts","/programs/101/accounts.md"]],["v-231c922b","/programs/101/data.html",{title:"Data"},["/programs/101/data","/programs/101/data.md"]],["v-5586a7ea","/programs/101/hello.html",{title:"Hello"},["/programs/101/hello","/programs/101/hello.md"]],["v-3706649a","/404.html",{title:""},["/404"]]],qd=Ud.reduce((e,[t,n,r,o])=>(e.push({name:t,path:n,component:bs,meta:r},...o.map(s=>({path:s,redirect:n}))),e),[{name:"404",path:"/:catchAll(.*)",component:bs}]),Kd=uu,Wd=()=>{const e=Wu({history:Kd(df(ft.value.base)),routes:qd,scrollBehavior:(t,n,r)=>r||(t.hash?{el:t.hash}:{top:0})});return e.beforeResolve(async(t,n)=>{var r;(t.path!==n.path||n===Xe)&&([tt.value]=await Promise.all([bt.resolvePageData(t.name),(r=Wi[t.name])===null||r===void 0?void 0:r.__asyncLoader()]))}),e},Gd=e=>{e.component("ClientOnly",Yu),e.component("Content",_o)},Yd=(e,t)=>{const n=ge(()=>bt.resolveRouteLocale(ft.value.locales,t.currentRoute.value.path)),r=ge(()=>bt.resolveSiteLocaleData(ft.value,n.value)),o=ge(()=>bt.resolvePageFrontmatter(tt.value)),s=ge(()=>bt.resolvePageHeadTitle(tt.value,r.value)),i=ge(()=>bt.resolvePageHead(s.value,o.value,r.value)),l=ge(()=>bt.resolvePageLang(tt.value));return e.provide(vo,n),e.provide(Xi,r),e.provide(Ji,o),e.provide(tf,s),e.provide(Qi,i),e.provide(Zi,l),Object.defineProperties(e.config.globalProperties,{$frontmatter:{get:()=>o.value},$head:{get:()=>i.value},$headTitle:{get:()=>s.value},$lang:{get:()=>l.value},$page:{get:()=>tt.value},$routeLocale:{get:()=>n.value},$site:{get:()=>ft.value},$siteLocale:{get:()=>r.value},$withBase:{get:()=>pf}}),{pageData:tt,pageFrontmatter:o,pageHead:i,pageHeadTitle:s,pageLang:l,routeLocale:n,siteData:ft,siteLocaleData:r}},Jd=()=>{const e=go(),t=ef(),n=nf(),r=Se([]),o=()=>{t.value.forEach(i=>{const l=Qd(i);l&&r.value.push(l)})},s=()=>{document.documentElement.lang=n.value,r.value.forEach(i=>{i.parentNode===document.head&&document.head.removeChild(i)}),r.value.splice(0,r.value.length),t.value.forEach(i=>{const l=Zd(i);l!==null&&(document.head.appendChild(l),r.value.push(l))})};xt(lf,s),Ze(()=>{o(),s(),Je(()=>e.path,()=>s())})},Qd=([e,t,n=""])=>{const r=Object.entries(t).map(([l,a])=>he(a)?`[${l}="${a}"]`:a===!0?`[${l}]`:"").join(""),o=`head > ${e}${r}`;return Array.from(document.querySelectorAll(o)).find(l=>l.innerText===n)||null},Zd=([e,t,n])=>{if(!he(e))return null;const r=document.createElement(e);return el(t)&&Object.entries(t).forEach(([o,s])=>{he(s)?r.setAttribute(o,s):s===!0&&r.setAttribute(o,"")}),he(n)&&r.appendChild(document.createTextNode(n)),r},Xd=qc,eh=async()=>{const e=Xd({name:"VuepressApp",setup(){Jd();for(const n of Vd)n();return()=>[ve(Ki),...Od.map(n=>ve(n))]}}),t=Wd();Gd(e),Yd(e,t);for(const n of Sd)await n({app:e,router:t,siteData:ft});return e.use(t),{app:e,router:t}};eh().then(({app:e,router:t})=>{t.isReady().then(()=>{e.mount("#app")})});export{sf as A,ch as B,dh as C,ve as D,pf as E,Oe as F,Yu as G,Rt as H,Se as I,Je as J,rh as K,ah as L,hf as M,df as N,mo as O,he as P,ud as Q,Ze as R,$t as S,fo as T,Zt as U,hh as V,el as W,lh as X,io as Y,dd as Z,bd as _,En as a,_e as b,Wn as c,eh as createVueApp,ao as d,oh as e,qe as f,cl as g,At as h,Xu as i,ge as j,J as k,ih as l,sh as m,go as n,jt as o,nh as p,Ai as q,ec as r,ic as s,Rs as t,rf as u,Si as v,ba as w,ff as x,uh as y,fh as z}; diff --git a/assets/back-to-top.8efcbe56.svg b/assets/back-to-top.8efcbe56.svg new file mode 100644 index 00000000..83236781 --- /dev/null +++ b/assets/back-to-top.8efcbe56.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/create-account.html.8cde0ffe.js b/assets/create-account.html.8cde0ffe.js new file mode 100644 index 00000000..430c60cc --- /dev/null +++ b/assets/create-account.html.8cde0ffe.js @@ -0,0 +1 @@ +const e={key:"v-24f1ec82",path:"/tour/create-account.html",title:"Create Account",lang:"en-US",frontmatter:{},excerpt:"",headers:[{level:2,title:"Create a new account",slug:"create-a-new-account",children:[]},{level:2,title:"Recover from a key",slug:"recover-from-a-key",children:[{level:3,title:"Base58",slug:"base58",children:[]},{level:3,title:"Bytes",slug:"bytes",children:[]},{level:3,title:"BIP 39",slug:"bip-39",children:[]},{level:3,title:"BIP 44",slug:"bip-44",children:[]}]},{level:2,title:"Full Code",slug:"full-code",children:[]}],git:{updatedTime:1646071383e3,contributors:[{name:"yihau",email:"a122092487@gmail.com",commits:1}]},filePathRelative:"tour/create-account.md"};export{e as data}; diff --git a/assets/create-account.html.bb41477f.js b/assets/create-account.html.bb41477f.js new file mode 100644 index 00000000..358b1a0f --- /dev/null +++ b/assets/create-account.html.bb41477f.js @@ -0,0 +1,97 @@ +import{_ as n,e as s}from"./app.01f87ec9.js";const a={},p=s(`

Create Account

An account is a basic identity on chain.

Create a new account

		account := types.NewAccount()
+
1

Recover from a key

Base58

		account, _ := types.AccountFromBase58("28WJTTqMuurAfz6yqeTrFMXeFd91uzi9i1AW6F5KyHQDS9siXb8TquAuatvLuCEYdggyeiNKLAUr3w7Czmmf2Rav")
+
1

Bytes

		account, _ := types.AccountFromBytes([]byte{
+			56, 125, 59, 118, 230, 173, 152, 169, 197, 34,
+			168, 187, 217, 160, 119, 204, 124, 69, 52, 136,
+			214, 49, 207, 234, 79, 70, 83, 224, 1, 224, 36,
+			247, 131, 83, 164, 85, 139, 215, 183, 148, 79,
+			198, 74, 93, 156, 157, 208, 99, 221, 127, 51,
+			156, 43, 196, 101, 144, 104, 252, 221, 108,
+			245, 104, 13, 151,
+		})
+
1
2
3
4
5
6
7
8
9

BIP 39

		mnemonic := "pill tomorrow foster begin walnut borrow virtual kick shift mutual shoe scatter"
+		seed := bip39.NewSeed(mnemonic, "") // (mnemonic, password)
+		account, _ := types.AccountFromSeed(seed[:32])
+
1
2
3

BIP 44

		mnemonic := "neither lonely flavor argue grass remind eye tag avocado spot unusual intact"
+		seed := bip39.NewSeed(mnemonic, "") // (mnemonic, password)
+		path := \`m/44'/501'/0'/0'\`
+		derivedKey, _ := hdwallet.Derived(path, seed)
+		account, _ := types.AccountFromSeed(derivedKey.PrivateKey)
+
1
2
3
4
5

Full Code

package main
+
+import (
+	"fmt"
+
+	"github.com/blocto/solana-go-sdk/pkg/hdwallet"
+	"github.com/blocto/solana-go-sdk/types"
+	"github.com/mr-tron/base58"
+	"github.com/tyler-smith/go-bip39"
+)
+
+func main() {
+	// create a new account
+	{
+		account := types.NewAccount()
+		fmt.Println(account.PublicKey.ToBase58())
+		fmt.Println(base58.Encode(account.PrivateKey))
+	}
+
+	// from a base58 pirvate key
+	{
+		account, _ := types.AccountFromBase58("28WJTTqMuurAfz6yqeTrFMXeFd91uzi9i1AW6F5KyHQDS9siXb8TquAuatvLuCEYdggyeiNKLAUr3w7Czmmf2Rav")
+		fmt.Println(account.PublicKey.ToBase58())
+	}
+
+	// from a private key bytes
+	{
+		account, _ := types.AccountFromBytes([]byte{
+			56, 125, 59, 118, 230, 173, 152, 169, 197, 34,
+			168, 187, 217, 160, 119, 204, 124, 69, 52, 136,
+			214, 49, 207, 234, 79, 70, 83, 224, 1, 224, 36,
+			247, 131, 83, 164, 85, 139, 215, 183, 148, 79,
+			198, 74, 93, 156, 157, 208, 99, 221, 127, 51,
+			156, 43, 196, 101, 144, 104, 252, 221, 108,
+			245, 104, 13, 151,
+		})
+		fmt.Println(account.PublicKey.ToBase58())
+	}
+
+	// from bip 39 (solana cli tool)
+	{
+		mnemonic := "pill tomorrow foster begin walnut borrow virtual kick shift mutual shoe scatter"
+		seed := bip39.NewSeed(mnemonic, "") // (mnemonic, password)
+		account, _ := types.AccountFromSeed(seed[:32])
+		fmt.Println(account.PublicKey.ToBase58())
+	}
+
+	// from bip 44 (phantom)
+	{
+		mnemonic := "neither lonely flavor argue grass remind eye tag avocado spot unusual intact"
+		seed := bip39.NewSeed(mnemonic, "") // (mnemonic, password)
+		path := \`m/44'/501'/0'/0'\`
+		derivedKey, _ := hdwallet.Derived(path, seed)
+		account, _ := types.AccountFromSeed(derivedKey.PrivateKey)
+		fmt.Printf("%v => %v\\n", path, account.PublicKey.ToBase58())
+
+		// others
+		for i := 1; i < 10; i++ {
+			path := fmt.Sprintf(\`m/44'/501'/%d'/0'\`, i)
+			derivedKey, _ := hdwallet.Derived(path, seed)
+			account, _ := types.AccountFromSeed(derivedKey.PrivateKey)
+			fmt.Printf("%v => %v\\n", path, account.PublicKey.ToBase58())
+		}
+		/*
+			m/44'/501'/0'/0' => 5vftMkHL72JaJG6ExQfGAsT2uGVHpRR7oTNUPMs68Y2N
+			m/44'/501'/1'/0' => GcXbfQ5yY3uxCyBNDPBbR5FjumHf89E7YHXuULfGDBBv
+			m/44'/501'/2'/0' => 7QPgyQwNLqnoSwHEuK8wKy2Y3Ani6EHoZRihTuWkwxbc
+			m/44'/501'/3'/0' => 5aE8UprEEWtpVskhxo3f8ETco2kVKiZT9SS3D5Lcg8s2
+			m/44'/501'/4'/0' => 5n6afo6LZmzH1J4R38ZCaNSwaztLjd48nWwToLQkCHxp
+			m/44'/501'/5'/0' => 2Gr1hWnbaqGXMghicSTHncqV7GVLLddNFJDC7YJoso8M
+			m/44'/501'/6'/0' => BNMDY3tCyYbayMzBjZm8RW59unpDWcQRfVmWXCJhLb7D
+			m/44'/501'/7'/0' => 9CySTpi4iC85gMW6G4BMoYbNBsdyJrfseHoGmViLha63
+			m/44'/501'/8'/0' => ApteF7PmUWS8Lzm6tJPkWgrxSFW5LwYGWCUJ2ByAec91
+			m/44'/501'/9'/0' => 6frdqXQAgJMyKwmZxkLYbdGjnYTvUceh6LNhkQt2siQp
+		*/
+	}
+}
+
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
`,15);function t(e,o){return p}var u=n(a,[["render",t]]);export{u as default}; diff --git a/assets/create-mint.html.8c277ef6.js b/assets/create-mint.html.8c277ef6.js new file mode 100644 index 00000000..976ae59c --- /dev/null +++ b/assets/create-mint.html.8c277ef6.js @@ -0,0 +1,76 @@ +import{_ as n,e as s}from"./app.01f87ec9.js";const a={},t=s(`

Create Mint

create a new token

package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/program/system"
+	"github.com/blocto/solana-go-sdk/program/token"
+	"github.com/blocto/solana-go-sdk/rpc"
+	"github.com/blocto/solana-go-sdk/types"
+)
+
+// FUarP2p5EnxD66vVDL4PWRoWMzA56ZVHG24hpEDFShEz
+var feePayer, _ = types.AccountFromBase58("4TMFNY9ntAn3CHzguSAvDNLPRoQTaK3sWbQQXdDXaE6KWRBLufGL6PJdsD2koiEe3gGmMdRK3aAw7sikGNksHJrN")
+
+// 9aE476sH92Vz7DMPyq5WLPkrKWivxeuTKEFKd2sZZcde
+var alice, _ = types.AccountFromBase58("4voSPg3tYuWbKzimpQK9EbXHmuyy5fUrtXvpLDMLkmY6TRncaTHAKGD8jUg3maB5Jbrd9CkQg4qjJMyN6sQvnEF2")
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	// create an mint account
+	mint := types.NewAccount()
+	fmt.Println("mint:", mint.PublicKey.ToBase58())
+
+	// get rent
+	rentExemptionBalance, err := c.GetMinimumBalanceForRentExemption(
+		context.Background(),
+		token.MintAccountSize,
+	)
+	if err != nil {
+		log.Fatalf("get min balacne for rent exemption, err: %v", err)
+	}
+
+	res, err := c.GetLatestBlockhash(context.Background())
+	if err != nil {
+		log.Fatalf("get recent block hash error, err: %v\\n", err)
+	}
+
+	tx, err := types.NewTransaction(types.NewTransactionParam{
+		Message: types.NewMessage(types.NewMessageParam{
+			FeePayer:        feePayer.PublicKey,
+			RecentBlockhash: res.Blockhash,
+			Instructions: []types.Instruction{
+				system.CreateAccount(system.CreateAccountParam{
+					From:     feePayer.PublicKey,
+					New:      mint.PublicKey,
+					Owner:    common.TokenProgramID,
+					Lamports: rentExemptionBalance,
+					Space:    token.MintAccountSize,
+				}),
+				token.InitializeMint(token.InitializeMintParam{
+					Decimals:   8,
+					Mint:       mint.PublicKey,
+					MintAuth:   alice.PublicKey,
+					FreezeAuth: nil,
+				}),
+			},
+		}),
+		Signers: []types.Account{feePayer, mint},
+	})
+	if err != nil {
+		log.Fatalf("generate tx error, err: %v\\n", err)
+	}
+
+	txhash, err := c.SendTransaction(context.Background(), tx)
+	if err != nil {
+		log.Fatalf("send tx error, err: %v\\n", err)
+	}
+
+	log.Println("txhash:", txhash)
+}
+
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
`,3);function p(o,e){return t}var u=n(a,[["render",p]]);export{u as default}; diff --git a/assets/create-mint.html.8c737506.js b/assets/create-mint.html.8c737506.js new file mode 100644 index 00000000..b1094c94 --- /dev/null +++ b/assets/create-mint.html.8c737506.js @@ -0,0 +1 @@ +const t={key:"v-6a1127a4",path:"/tour/create-mint.html",title:"Create Mint",lang:"en-US",frontmatter:{},excerpt:"",headers:[],git:{updatedTime:1646071383e3,contributors:[{name:"yihau",email:"a122092487@gmail.com",commits:1}]},filePathRelative:"tour/create-mint.md"};export{t as data}; diff --git a/assets/create-nonce-account.html.09101beb.js b/assets/create-nonce-account.html.09101beb.js new file mode 100644 index 00000000..eb793be5 --- /dev/null +++ b/assets/create-nonce-account.html.09101beb.js @@ -0,0 +1 @@ +const e={key:"v-c5aa4956",path:"/advanced/durable-nonce/create-nonce-account.html",title:"Create Nonce Account",lang:"en-US",frontmatter:{},excerpt:"",headers:[],git:{updatedTime:1646930333e3,contributors:[{name:"yihau",email:"a122092487@gmail.com",commits:1}]},filePathRelative:"advanced/durable-nonce/create-nonce-account.md"};export{e as data}; diff --git a/assets/create-nonce-account.html.c254d86a.js b/assets/create-nonce-account.html.c254d86a.js new file mode 100644 index 00000000..8e04f9a4 --- /dev/null +++ b/assets/create-nonce-account.html.c254d86a.js @@ -0,0 +1,72 @@ +import{_ as n,e as s}from"./app.01f87ec9.js";const a={},t=s(`

Create Nonce Account

package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/program/system"
+	"github.com/blocto/solana-go-sdk/rpc"
+	"github.com/blocto/solana-go-sdk/types"
+)
+
+// FUarP2p5EnxD66vVDL4PWRoWMzA56ZVHG24hpEDFShEz
+var feePayer, _ = types.AccountFromBase58("4TMFNY9ntAn3CHzguSAvDNLPRoQTaK3sWbQQXdDXaE6KWRBLufGL6PJdsD2koiEe3gGmMdRK3aAw7sikGNksHJrN")
+
+// 9aE476sH92Vz7DMPyq5WLPkrKWivxeuTKEFKd2sZZcde
+var alice, _ = types.AccountFromBase58("4voSPg3tYuWbKzimpQK9EbXHmuyy5fUrtXvpLDMLkmY6TRncaTHAKGD8jUg3maB5Jbrd9CkQg4qjJMyN6sQvnEF2")
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	// create a new account
+	nonceAccount := types.NewAccount()
+	fmt.Println("nonce account:", nonceAccount.PublicKey)
+
+	// get minimum balance
+	nonceAccountMinimumBalance, err := c.GetMinimumBalanceForRentExemption(context.Background(), system.NonceAccountSize)
+	if err != nil {
+		log.Fatalf("failed to get minimum balance for nonce account, err: %v", err)
+	}
+
+	// recent blockhash
+	recentBlockhashResponse, err := c.GetLatestBlockhash(context.Background())
+	if err != nil {
+		log.Fatalf("failed to get recent blockhash, err: %v", err)
+	}
+
+	// create a tx
+	tx, err := types.NewTransaction(types.NewTransactionParam{
+		Signers: []types.Account{feePayer, nonceAccount},
+		Message: types.NewMessage(types.NewMessageParam{
+			FeePayer:        feePayer.PublicKey,
+			RecentBlockhash: recentBlockhashResponse.Blockhash,
+			Instructions: []types.Instruction{
+				system.CreateAccount(system.CreateAccountParam{
+					From:     feePayer.PublicKey,
+					New:      nonceAccount.PublicKey,
+					Owner:    common.SystemProgramID,
+					Lamports: nonceAccountMinimumBalance,
+					Space:    system.NonceAccountSize,
+				}),
+				system.InitializeNonceAccount(system.InitializeNonceAccountParam{
+					Nonce: nonceAccount.PublicKey,
+					Auth:  alice.PublicKey,
+				}),
+			},
+		}),
+	})
+	if err != nil {
+		log.Fatalf("failed to new a transaction, err: %v", err)
+	}
+
+	sig, err := c.SendTransaction(context.Background(), tx)
+	if err != nil {
+		log.Fatalf("failed to send tx, err: %v", err)
+	}
+
+	fmt.Println("txhash", sig)
+}
+
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
`,2);function p(c,o){return t}var u=n(a,[["render",p]]);export{u as default}; diff --git a/assets/create-token-account.html.082bc642.js b/assets/create-token-account.html.082bc642.js new file mode 100644 index 00000000..0548e1b2 --- /dev/null +++ b/assets/create-token-account.html.082bc642.js @@ -0,0 +1,134 @@ +import{_ as n,e as s}from"./app.01f87ec9.js";const a={},t=s(`

Create Token Account

package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/program/associated_token_account"
+	"github.com/blocto/solana-go-sdk/rpc"
+	"github.com/blocto/solana-go-sdk/types"
+)
+
+// FUarP2p5EnxD66vVDL4PWRoWMzA56ZVHG24hpEDFShEz
+var feePayer, _ = types.AccountFromBase58("4TMFNY9ntAn3CHzguSAvDNLPRoQTaK3sWbQQXdDXaE6KWRBLufGL6PJdsD2koiEe3gGmMdRK3aAw7sikGNksHJrN")
+
+// 9aE476sH92Vz7DMPyq5WLPkrKWivxeuTKEFKd2sZZcde
+var alice, _ = types.AccountFromBase58("4voSPg3tYuWbKzimpQK9EbXHmuyy5fUrtXvpLDMLkmY6TRncaTHAKGD8jUg3maB5Jbrd9CkQg4qjJMyN6sQvnEF2")
+
+var mintPubkey = common.PublicKeyFromString("F6tecPzBMF47yJ2EN6j2aGtE68yR5jehXcZYVZa6ZETo")
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	ata, _, err := common.FindAssociatedTokenAddress(alice.PublicKey, mintPubkey)
+	if err != nil {
+		log.Fatalf("find ata error, err: %v", err)
+	}
+	fmt.Println("ata:", ata.ToBase58())
+
+	res, err := c.GetLatestBlockhash(context.Background())
+	if err != nil {
+		log.Fatalf("get recent block hash error, err: %v\\n", err)
+	}
+
+	tx, err := types.NewTransaction(types.NewTransactionParam{
+		Message: types.NewMessage(types.NewMessageParam{
+			FeePayer:        feePayer.PublicKey,
+			RecentBlockhash: res.Blockhash,
+			Instructions: []types.Instruction{
+				associated_token_account.Create(associated_token_account.CreateParam{
+					Funder:                 feePayer.PublicKey,
+					Owner:                  alice.PublicKey,
+					Mint:                   mintPubkey,
+					AssociatedTokenAccount: ata,
+				}),
+			},
+		}),
+		Signers: []types.Account{feePayer},
+	})
+	if err != nil {
+		log.Fatalf("generate tx error, err: %v\\n", err)
+	}
+
+	txhash, err := c.SendTransaction(context.Background(), tx)
+	if err != nil {
+		log.Fatalf("send raw tx error, err: %v\\n", err)
+	}
+
+	log.Println("txhash:", txhash)
+}
+
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

Random

package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/program/system"
+	"github.com/blocto/solana-go-sdk/program/token"
+	"github.com/blocto/solana-go-sdk/rpc"
+	"github.com/blocto/solana-go-sdk/types"
+)
+
+// FUarP2p5EnxD66vVDL4PWRoWMzA56ZVHG24hpEDFShEz
+var feePayer, _ = types.AccountFromBase58("4TMFNY9ntAn3CHzguSAvDNLPRoQTaK3sWbQQXdDXaE6KWRBLufGL6PJdsD2koiEe3gGmMdRK3aAw7sikGNksHJrN")
+
+// 9aE476sH92Vz7DMPyq5WLPkrKWivxeuTKEFKd2sZZcde
+var alice, _ = types.AccountFromBase58("4voSPg3tYuWbKzimpQK9EbXHmuyy5fUrtXvpLDMLkmY6TRncaTHAKGD8jUg3maB5Jbrd9CkQg4qjJMyN6sQvnEF2")
+
+var mintPubkey = common.PublicKeyFromString("F6tecPzBMF47yJ2EN6j2aGtE68yR5jehXcZYVZa6ZETo")
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	aliceRandomTokenAccount := types.NewAccount()
+	fmt.Println("alice token account:", aliceRandomTokenAccount.PublicKey.ToBase58())
+
+	rentExemptionBalance, err := c.GetMinimumBalanceForRentExemption(context.Background(), token.TokenAccountSize)
+	if err != nil {
+		log.Fatalf("get min balacne for rent exemption, err: %v", err)
+	}
+
+	res, err := c.GetLatestBlockhash(context.Background())
+	if err != nil {
+		log.Fatalf("get recent block hash error, err: %v\\n", err)
+	}
+
+	tx, err := types.NewTransaction(types.NewTransactionParam{
+		Message: types.NewMessage(types.NewMessageParam{
+			FeePayer:        feePayer.PublicKey,
+			RecentBlockhash: res.Blockhash,
+			Instructions: []types.Instruction{
+				system.CreateAccount(system.CreateAccountParam{
+					From:     feePayer.PublicKey,
+					New:      aliceRandomTokenAccount.PublicKey,
+					Owner:    common.TokenProgramID,
+					Lamports: rentExemptionBalance,
+					Space:    token.TokenAccountSize,
+				}),
+				token.InitializeAccount(token.InitializeAccountParam{
+					Account: aliceRandomTokenAccount.PublicKey,
+					Mint:    mintPubkey,
+					Owner:   alice.PublicKey,
+				}),
+			},
+		}),
+		Signers: []types.Account{feePayer, aliceRandomTokenAccount},
+	})
+	if err != nil {
+		log.Fatalf("generate tx error, err: %v\\n", err)
+	}
+
+	txhash, err := c.SendTransaction(context.Background(), tx)
+	if err != nil {
+		log.Fatalf("send tx error, err: %v\\n", err)
+	}
+
+	log.Println("txhash:", txhash)
+}
+
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
`,5);function p(o,c){return t}var u=n(a,[["render",p]]);export{u as default}; diff --git a/assets/create-token-account.html.3be4b61e.js b/assets/create-token-account.html.3be4b61e.js new file mode 100644 index 00000000..d9dc1a51 --- /dev/null +++ b/assets/create-token-account.html.3be4b61e.js @@ -0,0 +1 @@ +const e={key:"v-3079eed3",path:"/tour/create-token-account.html",title:"Create Token Account",lang:"en-US",frontmatter:{},excerpt:"",headers:[{level:2,title:"Associated Token Account (Recommended)",slug:"associated-token-account-recommended",children:[]},{level:2,title:"Random",slug:"random",children:[]}],git:{updatedTime:1646071383e3,contributors:[{name:"yihau",email:"a122092487@gmail.com",commits:1}]},filePathRelative:"tour/create-token-account.md"};export{e as data}; diff --git a/assets/data.html.22999d61.js b/assets/data.html.22999d61.js new file mode 100644 index 00000000..7d4c5b99 --- /dev/null +++ b/assets/data.html.22999d61.js @@ -0,0 +1 @@ +const e={key:"v-231c922b",path:"/programs/101/data.html",title:"Data",lang:"en-US",frontmatter:{},excerpt:"",headers:[{level:3,title:"client",slug:"client",children:[]},{level:3,title:"program",slug:"program",children:[]}],git:{updatedTime:1685469006e3,contributors:[{name:"Yihau Chen",email:"a122092487@gmail.com",commits:1}]},filePathRelative:"programs/101/data.md"};export{e as data}; diff --git a/assets/data.html.c03cd48e.js b/assets/data.html.c03cd48e.js new file mode 100644 index 00000000..6514517e --- /dev/null +++ b/assets/data.html.c03cd48e.js @@ -0,0 +1,121 @@ +import{_ as n,e as s}from"./app.01f87ec9.js";const a={},t=s(`

Data

client

// data is the most powerful part in an instruction
+// we can pack everything into data, like number, pubkey ... whatever you want.
+// we need to make them become a u8 array when we try to pack it in to a tx.
+
+package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/rpc"
+	"github.com/blocto/solana-go-sdk/types"
+)
+
+// FUarP2p5EnxD66vVDL4PWRoWMzA56ZVHG24hpEDFShEz
+var feePayer, _ = types.AccountFromBase58("4TMFNY9ntAn3CHzguSAvDNLPRoQTaK3sWbQQXdDXaE6KWRBLufGL6PJdsD2koiEe3gGmMdRK3aAw7sikGNksHJrN")
+
+var programId = common.PublicKeyFromString("c6vyXkJqgA85rYnLiMqxXd39fusJWbRJkoF3jXTd96H")
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	res, err := c.GetLatestBlockhash(context.Background())
+	if err != nil {
+		log.Fatalf("failed to get latest blockhash, err: %v\\n", err)
+	}
+
+	// (our example prgoram will parse the first byte as the selector then print remaining data.)
+	{
+		tx, err := types.NewTransaction(types.NewTransactionParam{
+			Signers: []types.Account{feePayer},
+			Message: types.NewMessage(types.NewMessageParam{
+				FeePayer:        feePayer.PublicKey,
+				RecentBlockhash: res.Blockhash,
+				Instructions: []types.Instruction{
+					{
+						ProgramID: programId,
+						Accounts:  []types.AccountMeta{},
+						Data:      []byte{0, 1, 2, 3, 4},
+					},
+				},
+			}),
+		})
+		if err != nil {
+			log.Fatalf("failed to new a tx, err: %v", err)
+		}
+
+		sig, err := c.SendTransaction(context.Background(), tx)
+		if err != nil {
+			log.Fatalf("failed to send the tx, err: %v", err)
+		}
+
+		// 5X3qhwXJcjSZ3KqY8cTs5YbswBTS7yyqnfTn2diGwGERPrMNUjh9efc6Y9ABanfDUzaQN1n6BHHyMRjDJk2tfy1i
+		fmt.Println(sig)
+	}
+
+	{
+		tx, err := types.NewTransaction(types.NewTransactionParam{
+			Signers: []types.Account{feePayer},
+			Message: types.NewMessage(types.NewMessageParam{
+				FeePayer:        feePayer.PublicKey,
+				RecentBlockhash: res.Blockhash,
+				Instructions: []types.Instruction{
+					{
+						ProgramID: programId,
+						Accounts:  []types.AccountMeta{},
+						Data:      []byte{1, 5, 6, 7, 8},
+					},
+				},
+			}),
+		})
+		if err != nil {
+			log.Fatalf("failed to new a tx, err: %v", err)
+		}
+
+		sig, err := c.SendTransaction(context.Background(), tx)
+		if err != nil {
+			log.Fatalf("failed to send the tx, err: %v", err)
+		}
+
+		// 5GETq1uLwMGdmsAH79pPByzGxQxXS1LqZ6Y9T6dBQ5qiMHFo5EgwDAHccFVEcc9hTYyj5zGfLX6j1uSz5NX7HZ8Q
+		fmt.Println(sig)
+	}
+}
+
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

program

use solana_program::{
+    account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, msg,
+    program_error::ProgramError, pubkey::Pubkey,
+};
+
+entrypoint!(process_instruction);
+
+fn process_instruction(
+    _program_id: &Pubkey,
+    _accounts: &[AccountInfo],
+    instruction_data: &[u8],
+) -> ProgramResult {
+    let (selector, rest) = instruction_data
+        .split_first()
+        .ok_or(ProgramError::InvalidInstructionData)?;
+
+    match selector {
+        0 => msg!(&format!(
+            "first instruction is called. remaining data: {:?}",
+            rest,
+        )),
+        1 => msg!(&format!(
+            "second instruction is called. remaining data: {:?}",
+            rest,
+        )),
+        _ => {
+            msg!("invalid called");
+            return Err(ProgramError::InvalidInstructionData);
+        }
+    }
+
+    Ok(())
+}
+
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
`,5);function p(o,c){return t}var u=n(a,[["render",p]]);export{u as default}; diff --git a/assets/get-metadata.html.2bbab957.js b/assets/get-metadata.html.2bbab957.js new file mode 100644 index 00000000..bcb8afa5 --- /dev/null +++ b/assets/get-metadata.html.2bbab957.js @@ -0,0 +1 @@ +const t={key:"v-280665e7",path:"/nft/get-metadata.html",title:"Get Token Metadata",lang:"en-US",frontmatter:{},excerpt:"",headers:[],git:{updatedTime:1646244832e3,contributors:[{name:"yihau",email:"a122092487@gmail.com",commits:1}]},filePathRelative:"nft/get-metadata.md"};export{t as data}; diff --git a/assets/get-metadata.html.8daeda1b.js b/assets/get-metadata.html.8daeda1b.js new file mode 100644 index 00000000..e279a528 --- /dev/null +++ b/assets/get-metadata.html.8daeda1b.js @@ -0,0 +1,42 @@ +import{_ as n,e as a}from"./app.01f87ec9.js";const s={},t=a(`

Get Token Metadata

package main
+
+import (
+	"context"
+	"log"
+
+	"github.com/davecgh/go-spew/spew"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/program/metaplex/token_metadata"
+	"github.com/blocto/solana-go-sdk/rpc"
+)
+
+func main() {
+	// NFT in solana is a normal mint but only mint 1.
+	// If you want to get its metadata, you need to know where it stored.
+	// and you can use \`tokenmeta.GetTokenMetaPubkey\` to get the metadata account key
+	// here I take a random Degenerate Ape Academy as an example
+	mint := common.PublicKeyFromString("GphF2vTuzhwhLWBWWvD8y5QLCPp1aQC5EnzrWsnbiWPx")
+	metadataAccount, err := token_metadata.GetTokenMetaPubkey(mint)
+	if err != nil {
+		log.Fatalf("faield to get metadata account, err: %v", err)
+	}
+
+	// new a client
+	c := client.NewClient(rpc.MainnetRPCEndpoint)
+
+	// get data which stored in metadataAccount
+	accountInfo, err := c.GetAccountInfo(context.Background(), metadataAccount.ToBase58())
+	if err != nil {
+		log.Fatalf("failed to get accountInfo, err: %v", err)
+	}
+
+	// parse it
+	metadata, err := token_metadata.MetadataDeserialize(accountInfo.Data)
+	if err != nil {
+		log.Fatalf("failed to parse metaAccount, err: %v", err)
+	}
+	spew.Dump(metadata)
+}
+
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
`,2);function p(e,o){return t}var l=n(s,[["render",p]]);export{l as default}; diff --git a/assets/get-mint.html.b4cc973b.js b/assets/get-mint.html.b4cc973b.js new file mode 100644 index 00000000..066424eb --- /dev/null +++ b/assets/get-mint.html.b4cc973b.js @@ -0,0 +1 @@ +const t={key:"v-35d7797c",path:"/tour/get-mint.html",title:"Get Mint",lang:"en-US",frontmatter:{},excerpt:"",headers:[],git:{updatedTime:1646071383e3,contributors:[{name:"yihau",email:"a122092487@gmail.com",commits:1}]},filePathRelative:"tour/get-mint.md"};export{t as data}; diff --git a/assets/get-mint.html.d6de7b13.js b/assets/get-mint.html.d6de7b13.js new file mode 100644 index 00000000..d0e7b142 --- /dev/null +++ b/assets/get-mint.html.d6de7b13.js @@ -0,0 +1,32 @@ +import{_ as n,e as s}from"./app.01f87ec9.js";const a={},t=s(`

Get Mint

get detail from a exist mint

package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/program/token"
+	"github.com/blocto/solana-go-sdk/rpc"
+)
+
+var mintPubkey = common.PublicKeyFromString("F6tecPzBMF47yJ2EN6j2aGtE68yR5jehXcZYVZa6ZETo")
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	getAccountInfoResponse, err := c.GetAccountInfo(context.TODO(), mintPubkey.ToBase58())
+	if err != nil {
+		log.Fatalf("failed to get account info, err: %v", err)
+	}
+
+	mintAccount, err := token.MintAccountFromData(getAccountInfoResponse.Data)
+	if err != nil {
+		log.Fatalf("failed to parse data to a mint account, err: %v", err)
+	}
+
+	fmt.Printf("%+v\\n", mintAccount)
+	// {MintAuthority:9aE476sH92Vz7DMPyq5WLPkrKWivxeuTKEFKd2sZZcde Supply:0 Decimals:8 IsInitialized:true FreezeAuthority:<nil>}
+}
+
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
`,3);function p(o,e){return t}var l=n(a,[["render",p]]);export{l as default}; diff --git a/assets/get-nonce-account-by-owner.html.4e38d4cc.js b/assets/get-nonce-account-by-owner.html.4e38d4cc.js new file mode 100644 index 00000000..55a01c3e --- /dev/null +++ b/assets/get-nonce-account-by-owner.html.4e38d4cc.js @@ -0,0 +1,53 @@ +import{_ as n,e as s}from"./app.01f87ec9.js";const a={},t=s(`

Get Nonce Account By Owner

package main
+
+import (
+	"context"
+	"encoding/base64"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/program/system"
+	"github.com/blocto/solana-go-sdk/rpc"
+)
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	res, err := c.RpcClient.GetProgramAccountsWithConfig(
+		context.Background(),
+		common.SystemProgramID.ToBase58(),
+		rpc.GetProgramAccountsConfig{
+			Encoding: rpc.AccountEncodingBase64,
+			Filters: []rpc.GetProgramAccountsConfigFilter{
+				{
+					DataSize: system.NonceAccountSize,
+				},
+				{
+					MemCmp: &rpc.GetProgramAccountsConfigFilterMemCmp{
+						Offset: 8,
+						Bytes:  "9aE476sH92Vz7DMPyq5WLPkrKWivxeuTKEFKd2sZZcde", // owner address
+					},
+				},
+			},
+		},
+	)
+	if err != nil {
+		log.Fatalf("failed to get program accounts, err: %v", err)
+	}
+
+	for _, a := range res.Result {
+		fmt.Println("pubkey", a.Pubkey)
+		data, err := base64.StdEncoding.DecodeString((a.Account.Data.([]any))[0].(string))
+		if err != nil {
+			log.Fatalf("failed to decode data, err: %v", err)
+		}
+		nonceAccount, err := system.NonceAccountDeserialize(data)
+		if err != nil {
+			log.Fatalf("failed to parse nonce account, err: %v", err)
+		}
+		fmt.Printf("%+v\\n", nonceAccount)
+	}
+}
+
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
`,2);function p(o,c){return t}var u=n(a,[["render",p]]);export{u as default}; diff --git a/assets/get-nonce-account-by-owner.html.e7678f5f.js b/assets/get-nonce-account-by-owner.html.e7678f5f.js new file mode 100644 index 00000000..53531461 --- /dev/null +++ b/assets/get-nonce-account-by-owner.html.e7678f5f.js @@ -0,0 +1 @@ +const e={key:"v-ab1b707e",path:"/advanced/durable-nonce/get-nonce-account-by-owner.html",title:"Get Nonce Account By Owner",lang:"en-US",frontmatter:{},excerpt:"",headers:[],git:{updatedTime:16553163e5,contributors:[{name:"yihau",email:"a122092487@gmail.com",commits:1}]},filePathRelative:"advanced/durable-nonce/get-nonce-account-by-owner.md"};export{e as data}; diff --git a/assets/get-nonce-account.html.365f85e2.js b/assets/get-nonce-account.html.365f85e2.js new file mode 100644 index 00000000..6a197aa9 --- /dev/null +++ b/assets/get-nonce-account.html.365f85e2.js @@ -0,0 +1 @@ +const e={key:"v-7b499707",path:"/advanced/durable-nonce/get-nonce-account.html",title:"Get Nonce Account",lang:"en-US",frontmatter:{},excerpt:"",headers:[{level:2,title:"Nonce Account",slug:"nonce-account",children:[]},{level:2,title:"Only Nonce",slug:"only-nonce",children:[]}],git:{updatedTime:1646930333e3,contributors:[{name:"yihau",email:"a122092487@gmail.com",commits:1}]},filePathRelative:"advanced/durable-nonce/get-nonce-account.md"};export{e as data}; diff --git a/assets/get-nonce-account.html.9fe949a4.js b/assets/get-nonce-account.html.9fe949a4.js new file mode 100644 index 00000000..275bd6a8 --- /dev/null +++ b/assets/get-nonce-account.html.9fe949a4.js @@ -0,0 +1,52 @@ +import{_ as n,e as s}from"./app.01f87ec9.js";const a={},t=s(`

Get Nonce Account

Nonce Account

package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/rpc"
+)
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+	nonceAccountAddr := "DJyNpXgggw1WGgjTVzFsNjb3fuQZVMqhoakvSBfX9LYx"
+	nonceAccount, err := c.GetNonceAccount(context.Background(), nonceAccountAddr)
+	if err != nil {
+		log.Fatalf("failed to get nonce account, err: %v", err)
+	}
+	fmt.Printf("%+v\\n", nonceAccount)
+	/*
+		type NonceAccount struct {
+			Version          uint32
+			State            uint32
+			AuthorizedPubkey common.PublicKey
+			Nonce            common.PublicKey
+			FeeCalculator    FeeCalculator
+		}
+	*/
+}
+
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

Only Nonce

package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/rpc"
+)
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	nonceAccountAddr := "DJyNpXgggw1WGgjTVzFsNjb3fuQZVMqhoakvSBfX9LYx"
+	nonce, err := c.GetNonceFromNonceAccount(context.Background(), nonceAccountAddr)
+	if err != nil {
+		log.Fatalf("failed to get nonce account, err: %v", err)
+	}
+
+	fmt.Println("nonce", nonce)
+}
+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
`,5);function p(e,c){return t}var l=n(a,[["render",p]]);export{l as default}; diff --git a/assets/get-signatures-for-address.html.637d35dd.js b/assets/get-signatures-for-address.html.637d35dd.js new file mode 100644 index 00000000..db6c711e --- /dev/null +++ b/assets/get-signatures-for-address.html.637d35dd.js @@ -0,0 +1 @@ +const e={key:"v-b8f58dfe",path:"/rpc/get-signatures-for-address.html",title:"Get Signatures For Address",lang:"en-US",frontmatter:{},excerpt:"",headers:[{level:2,title:"All",slug:"all",children:[]},{level:2,title:"Limit",slug:"limit",children:[]},{level:2,title:"Range",slug:"range",children:[{level:3,title:"Before",slug:"before",children:[]},{level:3,title:"Until",slug:"until",children:[]}]},{level:2,title:"Full Code",slug:"full-code",children:[]}],git:{updatedTime:1658684184e3,contributors:[{name:"Yihau Chen",email:"a122092487@gmail.com",commits:1}]},filePathRelative:"rpc/get-signatures-for-address.md"};export{e as data}; diff --git a/assets/get-signatures-for-address.html.ce25d962.js b/assets/get-signatures-for-address.html.ce25d962.js new file mode 100644 index 00000000..ea615b68 --- /dev/null +++ b/assets/get-signatures-for-address.html.ce25d962.js @@ -0,0 +1,153 @@ +import{_ as n,e as s}from"./app.01f87ec9.js";const a={},t=s(`

Get Signatures For Address

Fetch tx histroy.

All

	// get all (limit is between 1 ~ 1,000, default is 1,000)
+	{
+		res, err := c.GetSignaturesForAddress(context.Background(), target)
+		if err != nil {
+			log.Fatalf("failed to GetSignaturesForAddress, err: %v", err)
+		}
+		spew.Dump(res)
+	}
+
1
2
3
4
5
6
7
8

Limit

	// get latest X tx
+	{
+		res, err := c.GetSignaturesForAddressWithConfig(
+			context.Background(),
+			target,
+			rpc.GetSignaturesForAddressConfig{
+				Limit: 5,
+			},
+		)
+		if err != nil {
+			log.Fatalf("failed to GetSignaturesForAddress, err: %v", err)
+		}
+		spew.Dump(res)
+	}
+
1
2
3
4
5
6
7
8
9
10
11
12
13
14

Range

context:

	/*
+		if a txhash list like:
+
+		(new)
+		3gwJwVorVprqZmm1ULAp9bKQy6sQ7skG11XYdMSQigA936MBANcSBy6NcNJF2yPf9ycgzZ6vFd4pjAY7qSko61Au
+		wTEnw3vpBthzLUD6gv9B3aC4dQNp4hews85ipM3w9MGZAh38HZ2im9LaWY7aRusVN5Wj33mNvqSRDNyC43u6GQs
+		3e6dRv5KnvpU43VjVjbsubvPR1yFK9b922WcTugyTBSdWdToeCK16NccSaxY6XJ5yi51UswP3ZDe3VJBZTVg2MCW
+		2nYnHvbVuwmYeara3VjoCt9uS8ZXrSra5DRK7QBT8i5acoBiSK3FQY2vsaDSJQ6QX5i1pkvyRRjL1oUATMLZEsqy
+		2uFaNDgQWZsgZvR6s3WQKwaCxFgS4ML7xrZyAqgmuTSEuGmrWyCcTrjtajr6baYR6FaVLZ4PWgyt55EmTcT8S7Sg
+		4XGVHHpLW99AUFEd6RivasG57vqu4EMMNdcQdmphepmW484dMYtWLkYw4nSNnSpKiDoYDbSu9ksxECNKBk2JEyHQ
+		3kjLJokcYqAhQjERCVutv5gdUuQ1HsxSCcFsJdQbqNkqd5ML8WRaZJguZgpWH8isCfyEN8YktxxPPNJURhAtvUKE
+		(old)
+	*/
+
1
2
3
4
5
6
7
8
9
10
11
12
13

Before

	// you can fetch the last 3 tx by
+	{
+		res, err := c.GetSignaturesForAddressWithConfig(
+			context.Background(),
+			target,
+			rpc.GetSignaturesForAddressConfig{
+				Before: "2nYnHvbVuwmYeara3VjoCt9uS8ZXrSra5DRK7QBT8i5acoBiSK3FQY2vsaDSJQ6QX5i1pkvyRRjL1oUATMLZEsqy",
+				Limit:  3,
+			},
+		)
+		if err != nil {
+			log.Fatalf("failed to GetSignaturesForAddress, err: %v", err)
+		}
+		spew.Dump(res)
+	}
+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

Until

	// you can fetch the latest 3 tx by \`until\`
+	// * the result will be different if there are some newer txs added.
+	{
+		res, err := c.GetSignaturesForAddressWithConfig(
+			context.Background(),
+			target,
+			rpc.GetSignaturesForAddressConfig{
+				Until: "2nYnHvbVuwmYeara3VjoCt9uS8ZXrSra5DRK7QBT8i5acoBiSK3FQY2vsaDSJQ6QX5i1pkvyRRjL1oUATMLZEsqy",
+				Limit: 3,
+			},
+		)
+		if err != nil {
+			log.Fatalf("failed to GetSignaturesForAddress, err: %v", err)
+		}
+		spew.Dump(res)
+	}
+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

Full Code

package main
+
+import (
+	"context"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/rpc"
+	"github.com/davecgh/go-spew/spew"
+)
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+	target := "Memo1UhkJRfHyvLMcVucJwxXeuD728EqVDDwQDxFMNo"
+
+	// get all (limit is between 1 ~ 1,000, default is 1,000)
+	{
+		res, err := c.GetSignaturesForAddress(context.Background(), target)
+		if err != nil {
+			log.Fatalf("failed to GetSignaturesForAddress, err: %v", err)
+		}
+		spew.Dump(res)
+	}
+
+	// get latest X tx
+	{
+		res, err := c.GetSignaturesForAddressWithConfig(
+			context.Background(),
+			target,
+			rpc.GetSignaturesForAddressConfig{
+				Limit: 5,
+			},
+		)
+		if err != nil {
+			log.Fatalf("failed to GetSignaturesForAddress, err: %v", err)
+		}
+		spew.Dump(res)
+	}
+
+	/*
+		if a txhash list like:
+
+		(new)
+		3gwJwVorVprqZmm1ULAp9bKQy6sQ7skG11XYdMSQigA936MBANcSBy6NcNJF2yPf9ycgzZ6vFd4pjAY7qSko61Au
+		wTEnw3vpBthzLUD6gv9B3aC4dQNp4hews85ipM3w9MGZAh38HZ2im9LaWY7aRusVN5Wj33mNvqSRDNyC43u6GQs
+		3e6dRv5KnvpU43VjVjbsubvPR1yFK9b922WcTugyTBSdWdToeCK16NccSaxY6XJ5yi51UswP3ZDe3VJBZTVg2MCW
+		2nYnHvbVuwmYeara3VjoCt9uS8ZXrSra5DRK7QBT8i5acoBiSK3FQY2vsaDSJQ6QX5i1pkvyRRjL1oUATMLZEsqy
+		2uFaNDgQWZsgZvR6s3WQKwaCxFgS4ML7xrZyAqgmuTSEuGmrWyCcTrjtajr6baYR6FaVLZ4PWgyt55EmTcT8S7Sg
+		4XGVHHpLW99AUFEd6RivasG57vqu4EMMNdcQdmphepmW484dMYtWLkYw4nSNnSpKiDoYDbSu9ksxECNKBk2JEyHQ
+		3kjLJokcYqAhQjERCVutv5gdUuQ1HsxSCcFsJdQbqNkqd5ML8WRaZJguZgpWH8isCfyEN8YktxxPPNJURhAtvUKE
+		(old)
+	*/
+
+	// you can fetch the last 3 tx by
+	{
+		res, err := c.GetSignaturesForAddressWithConfig(
+			context.Background(),
+			target,
+			rpc.GetSignaturesForAddressConfig{
+				Before: "2nYnHvbVuwmYeara3VjoCt9uS8ZXrSra5DRK7QBT8i5acoBiSK3FQY2vsaDSJQ6QX5i1pkvyRRjL1oUATMLZEsqy",
+				Limit:  3,
+			},
+		)
+		if err != nil {
+			log.Fatalf("failed to GetSignaturesForAddress, err: %v", err)
+		}
+		spew.Dump(res)
+	}
+
+	// you can fetch the latest 3 tx by \`until\`
+	// * the result will be different if there are some newer txs added.
+	{
+		res, err := c.GetSignaturesForAddressWithConfig(
+			context.Background(),
+			target,
+			rpc.GetSignaturesForAddressConfig{
+				Until: "2nYnHvbVuwmYeara3VjoCt9uS8ZXrSra5DRK7QBT8i5acoBiSK3FQY2vsaDSJQ6QX5i1pkvyRRjL1oUATMLZEsqy",
+				Limit: 3,
+			},
+		)
+		if err != nil {
+			log.Fatalf("failed to GetSignaturesForAddress, err: %v", err)
+		}
+		spew.Dump(res)
+	}
+}
+
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
`,15);function p(e,c){return t}var u=n(a,[["render",p]]);export{u as default}; diff --git a/assets/get-sol-balance.html.6f961e64.js b/assets/get-sol-balance.html.6f961e64.js new file mode 100644 index 00000000..b7a23398 --- /dev/null +++ b/assets/get-sol-balance.html.6f961e64.js @@ -0,0 +1 @@ +const e={key:"v-09e730af",path:"/tour/get-sol-balance.html",title:"Get Balance",lang:"en-US",frontmatter:{},excerpt:"",headers:[],git:{updatedTime:1646071383e3,contributors:[{name:"yihau",email:"a122092487@gmail.com",commits:1}]},filePathRelative:"tour/get-sol-balance.md"};export{e as data}; diff --git a/assets/get-sol-balance.html.9d310a9a.js b/assets/get-sol-balance.html.9d310a9a.js new file mode 100644 index 00000000..7f2c46ef --- /dev/null +++ b/assets/get-sol-balance.html.9d310a9a.js @@ -0,0 +1,23 @@ +import{_ as n,e as s}from"./app.01f87ec9.js";const a={},t=s(`

Get Balance

get sol balance

package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/rpc"
+)
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+	balance, err := c.GetBalance(
+		context.TODO(),
+		"9qeP9DmjXAmKQc4wy133XZrQ3Fo4ejsYteA7X4YFJ3an",
+	)
+	if err != nil {
+		log.Fatalf("failed to request airdrop, err: %v", err)
+	}
+	fmt.Println(balance)
+}
+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

TIP

1 SOL = 10^9 lamports

`,4);function p(e,c){return t}var l=n(a,[["render",p]]);export{l as default}; diff --git a/assets/get-token-account.html.c10505a4.js b/assets/get-token-account.html.c10505a4.js new file mode 100644 index 00000000..ff4f235a --- /dev/null +++ b/assets/get-token-account.html.c10505a4.js @@ -0,0 +1,30 @@ +import{_ as n,e as s}from"./app.01f87ec9.js";const a={},t=s(`

Get Token Account

package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/program/token"
+	"github.com/blocto/solana-go-sdk/rpc"
+)
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	// token account address
+	getAccountInfoResponse, err := c.GetAccountInfo(context.TODO(), "HeCBh32JJ8DxcjTyc6q46tirHR8hd2xj3mGoAcQ7eduL")
+	if err != nil {
+		log.Fatalf("failed to get account info, err: %v", err)
+	}
+
+	tokenAccount, err := token.TokenAccountFromData(getAccountInfoResponse.Data)
+	if err != nil {
+		log.Fatalf("failed to parse data to a token account, err: %v", err)
+	}
+
+	fmt.Printf("%+v\\n", tokenAccount)
+	// {Mint:F6tecPzBMF47yJ2EN6j2aGtE68yR5jehXcZYVZa6ZETo Owner:9aE476sH92Vz7DMPyq5WLPkrKWivxeuTKEFKd2sZZcde Amount:100000000 Delegate:<nil> State:1 IsNative:<nil> DelegatedAmount:0 CloseAuthority:<nil>}
+}
+
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
`,2);function p(o,e){return t}var l=n(a,[["render",p]]);export{l as default}; diff --git a/assets/get-token-account.html.e4cf79d9.js b/assets/get-token-account.html.e4cf79d9.js new file mode 100644 index 00000000..7f9446ab --- /dev/null +++ b/assets/get-token-account.html.e4cf79d9.js @@ -0,0 +1 @@ +const t={key:"v-25cdf616",path:"/tour/get-token-account.html",title:"Get Token Account",lang:"en-US",frontmatter:{},excerpt:"",headers:[],git:{updatedTime:1646071383e3,contributors:[{name:"yihau",email:"a122092487@gmail.com",commits:1}]},filePathRelative:"tour/get-token-account.md"};export{t as data}; diff --git a/assets/get-token-balance.html.48dc74ba.js b/assets/get-token-balance.html.48dc74ba.js new file mode 100644 index 00000000..e7a8ad6e --- /dev/null +++ b/assets/get-token-balance.html.48dc74ba.js @@ -0,0 +1 @@ +const e={key:"v-0f32b5a6",path:"/tour/get-token-balance.html",title:"Get Token Balance",lang:"en-US",frontmatter:{},excerpt:"",headers:[],git:{updatedTime:1646071383e3,contributors:[{name:"yihau",email:"a122092487@gmail.com",commits:1}]},filePathRelative:"tour/get-token-balance.md"};export{e as data}; diff --git a/assets/get-token-balance.html.b25f50bd.js b/assets/get-token-balance.html.b25f50bd.js new file mode 100644 index 00000000..d8629dca --- /dev/null +++ b/assets/get-token-balance.html.b25f50bd.js @@ -0,0 +1,31 @@ +import{_ as n,e as s}from"./app.01f87ec9.js";const a={},t=s(`

Get Token Balance

package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/rpc"
+)
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	// should pass a token account address
+	balance, decimals, err := c.GetTokenAccountBalance(
+		context.Background(),
+		"HeCBh32JJ8DxcjTyc6q46tirHR8hd2xj3mGoAcQ7eduL",
+	)
+	if err != nil {
+		log.Fatalln("get balance error", err)
+	}
+	// the smallest unit like lamports
+	fmt.Println("balance", balance)
+	// the decimals of mint which token account holds
+	fmt.Println("decimals", decimals)
+
+	// if you want use a normal unit, you can do
+	// balance / 10^decimals
+}
+
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
`,2);function p(e,c){return t}var l=n(a,[["render",p]]);export{l as default}; diff --git a/assets/hello.html.b83fb618.js b/assets/hello.html.b83fb618.js new file mode 100644 index 00000000..9f0b7963 --- /dev/null +++ b/assets/hello.html.b83fb618.js @@ -0,0 +1,78 @@ +import{_ as n,e as s}from"./app.01f87ec9.js";const a={},p=s(`

Hello

client

// an instruction is the smallest unit in a tx.
+// each instruction represent an action with a program.
+// there are three basic fields in an instruction:
+//   - program id
+//     the program which you would like to interact with
+//   - account meta list
+//     accounts which are used in the program
+//   - data
+//     a u8 array.
+
+package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/rpc"
+	"github.com/blocto/solana-go-sdk/types"
+)
+
+// FUarP2p5EnxD66vVDL4PWRoWMzA56ZVHG24hpEDFShEz
+var feePayer, _ = types.AccountFromBase58("4TMFNY9ntAn3CHzguSAvDNLPRoQTaK3sWbQQXdDXaE6KWRBLufGL6PJdsD2koiEe3gGmMdRK3aAw7sikGNksHJrN")
+
+var programId = common.PublicKeyFromString("EGz5CDh7dG7BwzqL7y5ePpZNvrw7ehr4E4oGRhCCpiEK")
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	res, err := c.GetLatestBlockhash(context.Background())
+	if err != nil {
+		log.Fatalf("failed to get latest blockhash, err: %v\\n", err)
+	}
+
+	// our first program won't use any accounts and parse any data. we leave them empty atm.
+	tx, err := types.NewTransaction(types.NewTransactionParam{
+		Signers: []types.Account{feePayer},
+		Message: types.NewMessage(types.NewMessageParam{
+			FeePayer:        feePayer.PublicKey,
+			RecentBlockhash: res.Blockhash,
+			Instructions: []types.Instruction{
+				{
+					ProgramID: programId,
+					Accounts:  []types.AccountMeta{},
+					Data:      []byte{},
+				},
+			},
+		}),
+	})
+	if err != nil {
+		log.Fatalf("failed to new a tx, err: %v", err)
+	}
+
+	sig, err := c.SendTransaction(context.Background(), tx)
+	if err != nil {
+		log.Fatalf("failed to send the tx, err: %v", err)
+	}
+
+	// 5eCfcdKGzn8yLGfgX6V1AfjAavTQRGQ936Zyuqejf9W1tTsjABjHTrc66nv5g9qKStmRPr3FeCVznADuCnJ8Zfbq
+	fmt.Println(sig)
+}
+
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

program

use solana_program::{
+    account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, msg, pubkey::Pubkey,
+};
+
+entrypoint!(process_instruction);
+
+fn process_instruction(
+    _program_id: &Pubkey,
+    _accounts: &[AccountInfo],
+    _instruction_data: &[u8],
+) -> ProgramResult {
+    msg!("hello");
+    Ok(())
+}
+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
`,5);function t(e,o){return p}var u=n(a,[["render",t]]);export{u as default}; diff --git a/assets/hello.html.fc8163f0.js b/assets/hello.html.fc8163f0.js new file mode 100644 index 00000000..672d51ad --- /dev/null +++ b/assets/hello.html.fc8163f0.js @@ -0,0 +1 @@ +const e={key:"v-5586a7ea",path:"/programs/101/hello.html",title:"Hello",lang:"en-US",frontmatter:{},excerpt:"",headers:[{level:3,title:"client",slug:"client",children:[]},{level:3,title:"program",slug:"program",children:[]}],git:{updatedTime:1685469006e3,contributors:[{name:"Yihau Chen",email:"a122092487@gmail.com",commits:1}]},filePathRelative:"programs/101/hello.md"};export{e as data}; diff --git a/assets/index.html.53b060d9.js b/assets/index.html.53b060d9.js new file mode 100644 index 00000000..853058f9 --- /dev/null +++ b/assets/index.html.53b060d9.js @@ -0,0 +1 @@ +const e={key:"v-6c8477c6",path:"/advanced/durable-nonce/",title:"Durable Nonce",lang:"en-US",frontmatter:{},excerpt:"",headers:[{level:2,title:"Mechanism",slug:"mechanism",children:[]}],git:{updatedTime:1646930333e3,contributors:[{name:"yihau",email:"a122092487@gmail.com",commits:1}]},filePathRelative:"advanced/durable-nonce/README.md"};export{e as data}; diff --git a/assets/index.html.aa82496b.js b/assets/index.html.aa82496b.js new file mode 100644 index 00000000..ff5df3ed --- /dev/null +++ b/assets/index.html.aa82496b.js @@ -0,0 +1 @@ +const e={key:"v-8daa1a0e",path:"/",title:"Solana Development With Go",lang:"en-US",frontmatter:{},excerpt:"",headers:[],git:{updatedTime:1646244832e3,contributors:[{name:"yihau",email:"a122092487@gmail.com",commits:2}]},filePathRelative:"README.md"};export{e as data}; diff --git a/assets/index.html.bb851f19.js b/assets/index.html.bb851f19.js new file mode 100644 index 00000000..5cc8638c --- /dev/null +++ b/assets/index.html.bb851f19.js @@ -0,0 +1 @@ +import{_ as e,e as a}from"./app.01f87ec9.js";const n={},c=a('

Durable Nonce

A transaction includes a recent blockhash. The recent blockhash will expire after 150 blocks. (arpox. 2 min) To get rid of it, you can use durable nonce.

Mechanism

We can trigger the mechanism by

  1. use the nonce which stored in a nonce account as a recent blockhash
  2. make nonce advance instruction is the first instruciton
',5);function r(i,o){return c}var h=e(n,[["render",r]]);export{h as default}; diff --git a/assets/index.html.c8b9bcbb.js b/assets/index.html.c8b9bcbb.js new file mode 100644 index 00000000..48e3f649 --- /dev/null +++ b/assets/index.html.c8b9bcbb.js @@ -0,0 +1 @@ +import{_ as t,r as a,o as s,c as r,a as e,b as c,F as l,d as o}from"./app.01f87ec9.js";const i={},_=e("h1",{id:"solana-development-with-go",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#solana-development-with-go","aria-hidden":"true"},"#"),o(" Solana Development With Go")],-1),d=o("Here is a book to help someone build something on "),h={href:"https://github.com/solana-labs/solana",target:"_blank",rel:"noopener noreferrer"},m=o("Solana"),p=o(" with Go.");function f(u,x){const n=a("ExternalLinkIcon");return s(),r(l,null,[_,e("p",null,[d,e("a",h,[m,c(n)]),p])],64)}var g=t(i,[["render",f]]);export{g as default}; diff --git a/assets/memo.html.1a2a0915.js b/assets/memo.html.1a2a0915.js new file mode 100644 index 00000000..44daf009 --- /dev/null +++ b/assets/memo.html.1a2a0915.js @@ -0,0 +1,56 @@ +import{_ as n,e as s}from"./app.01f87ec9.js";const a={},t=s(`

Add Memo

You can add a memo to your transaction by memo instruction

package main
+
+import (
+	"context"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/program/memo"
+	"github.com/blocto/solana-go-sdk/rpc"
+	"github.com/blocto/solana-go-sdk/types"
+)
+
+// FUarP2p5EnxD66vVDL4PWRoWMzA56ZVHG24hpEDFShEz
+var feePayer, _ = types.AccountFromBase58("4TMFNY9ntAn3CHzguSAvDNLPRoQTaK3sWbQQXdDXaE6KWRBLufGL6PJdsD2koiEe3gGmMdRK3aAw7sikGNksHJrN")
+
+// 9aE476sH92Vz7DMPyq5WLPkrKWivxeuTKEFKd2sZZcde
+var alice, _ = types.AccountFromBase58("4voSPg3tYuWbKzimpQK9EbXHmuyy5fUrtXvpLDMLkmY6TRncaTHAKGD8jUg3maB5Jbrd9CkQg4qjJMyN6sQvnEF2")
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	// to fetch recent blockhash
+	recentBlockhashResponse, err := c.GetLatestBlockhash(context.Background())
+	if err != nil {
+		log.Fatalf("failed to get recent blockhash, err: %v", err)
+	}
+
+	// create a tx
+	tx, err := types.NewTransaction(types.NewTransactionParam{
+		Signers: []types.Account{feePayer, alice},
+		Message: types.NewMessage(types.NewMessageParam{
+			FeePayer:        feePayer.PublicKey,
+			RecentBlockhash: recentBlockhashResponse.Blockhash,
+			Instructions: []types.Instruction{
+				// memo instruction
+				memo.BuildMemo(memo.BuildMemoParam{
+					SignerPubkeys: []common.PublicKey{alice.PublicKey},
+					Memo:          []byte("\u{1F433}"),
+				}),
+			},
+		}),
+	})
+	if err != nil {
+		log.Fatalf("failed to new a transaction, err: %v", err)
+	}
+
+	// send tx
+	txhash, err := c.SendTransaction(context.Background(), tx)
+	if err != nil {
+		log.Fatalf("failed to send tx, err: %v", err)
+	}
+
+	log.Println("txhash:", txhash)
+}
+
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
`,3);function p(o,e){return t}var u=n(a,[["render",p]]);export{u as default}; diff --git a/assets/memo.html.7283ccff.js b/assets/memo.html.7283ccff.js new file mode 100644 index 00000000..dfbcc778 --- /dev/null +++ b/assets/memo.html.7283ccff.js @@ -0,0 +1 @@ +const e={key:"v-59d0d0eb",path:"/advanced/memo.html",title:"Add Memo",lang:"en-US",frontmatter:{},excerpt:"",headers:[],git:{updatedTime:1646930333e3,contributors:[{name:"yihau",email:"a122092487@gmail.com",commits:1}]},filePathRelative:"advanced/memo.md"};export{e as data}; diff --git a/assets/mint-a-nft.html.3f3b89f5.js b/assets/mint-a-nft.html.3f3b89f5.js new file mode 100644 index 00000000..31e50638 --- /dev/null +++ b/assets/mint-a-nft.html.3f3b89f5.js @@ -0,0 +1 @@ +const t={key:"v-23bafe30",path:"/nft/mint-a-nft.html",title:"Mint A NFT",lang:"en-US",frontmatter:{},excerpt:"",headers:[],git:{updatedTime:1646244832e3,contributors:[{name:"yihau",email:"a122092487@gmail.com",commits:1}]},filePathRelative:"nft/mint-a-nft.md"};export{t as data}; diff --git a/assets/mint-a-nft.html.842fde0f.js b/assets/mint-a-nft.html.842fde0f.js new file mode 100644 index 00000000..040a437f --- /dev/null +++ b/assets/mint-a-nft.html.842fde0f.js @@ -0,0 +1,138 @@ +import{_ as n,e as s}from"./app.01f87ec9.js";const a={},t=s(`

Mint A NFT

package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/pkg/pointer"
+	"github.com/blocto/solana-go-sdk/program/associated_token_account"
+	"github.com/blocto/solana-go-sdk/program/metaplex/token_metadata"
+	"github.com/blocto/solana-go-sdk/program/system"
+	"github.com/blocto/solana-go-sdk/program/token"
+	"github.com/blocto/solana-go-sdk/rpc"
+	"github.com/blocto/solana-go-sdk/types"
+)
+
+// FUarP2p5EnxD66vVDL4PWRoWMzA56ZVHG24hpEDFShEz
+var feePayer, _ = types.AccountFromBase58("4TMFNY9ntAn3CHzguSAvDNLPRoQTaK3sWbQQXdDXaE6KWRBLufGL6PJdsD2koiEe3gGmMdRK3aAw7sikGNksHJrN")
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	mint := types.NewAccount()
+	fmt.Printf("NFT: %v\\n", mint.PublicKey.ToBase58())
+
+	collection := types.NewAccount()
+	fmt.Printf("collection: %v\\n", collection.PublicKey.ToBase58())
+
+	ata, _, err := common.FindAssociatedTokenAddress(feePayer.PublicKey, mint.PublicKey)
+	if err != nil {
+		log.Fatalf("failed to find a valid ata, err: %v", err)
+	}
+
+	tokenMetadataPubkey, err := token_metadata.GetTokenMetaPubkey(mint.PublicKey)
+	if err != nil {
+		log.Fatalf("failed to find a valid token metadata, err: %v", err)
+
+	}
+	tokenMasterEditionPubkey, err := token_metadata.GetMasterEdition(mint.PublicKey)
+	if err != nil {
+		log.Fatalf("failed to find a valid master edition, err: %v", err)
+	}
+
+	mintAccountRent, err := c.GetMinimumBalanceForRentExemption(context.Background(), token.MintAccountSize)
+	if err != nil {
+		log.Fatalf("failed to get mint account rent, err: %v", err)
+	}
+
+	recentBlockhashResponse, err := c.GetLatestBlockhash(context.Background())
+	if err != nil {
+		log.Fatalf("failed to get recent blockhash, err: %v", err)
+	}
+
+	tx, err := types.NewTransaction(types.NewTransactionParam{
+		Signers: []types.Account{mint, feePayer},
+		Message: types.NewMessage(types.NewMessageParam{
+			FeePayer:        feePayer.PublicKey,
+			RecentBlockhash: recentBlockhashResponse.Blockhash,
+			Instructions: []types.Instruction{
+				system.CreateAccount(system.CreateAccountParam{
+					From:     feePayer.PublicKey,
+					New:      mint.PublicKey,
+					Owner:    common.TokenProgramID,
+					Lamports: mintAccountRent,
+					Space:    token.MintAccountSize,
+				}),
+				token.InitializeMint(token.InitializeMintParam{
+					Decimals:   0,
+					Mint:       mint.PublicKey,
+					MintAuth:   feePayer.PublicKey,
+					FreezeAuth: &feePayer.PublicKey,
+				}),
+				token_metadata.CreateMetadataAccountV3(token_metadata.CreateMetadataAccountV3Param{
+					Metadata:                tokenMetadataPubkey,
+					Mint:                    mint.PublicKey,
+					MintAuthority:           feePayer.PublicKey,
+					Payer:                   feePayer.PublicKey,
+					UpdateAuthority:         feePayer.PublicKey,
+					UpdateAuthorityIsSigner: true,
+					IsMutable:               true,
+					Data: token_metadata.DataV2{
+						Name:                 "Fake SMS #1355",
+						Symbol:               "FSMB",
+						Uri:                  "https://34c7ef24f4v2aejh75xhxy5z6ars4xv47gpsdrei6fiowptk2nqq.arweave.net/3wXyF1wvK6ARJ_9ue-O58CMuXrz5nyHEiPFQ6z5q02E",
+						SellerFeeBasisPoints: 100,
+						Creators: &[]token_metadata.Creator{
+							{
+								Address:  feePayer.PublicKey,
+								Verified: true,
+								Share:    100,
+							},
+						},
+						Collection: &token_metadata.Collection{
+							Verified: false,
+							Key:      collection.PublicKey,
+						},
+						Uses: nil,
+					},
+					CollectionDetails: nil,
+				}),
+				associated_token_account.CreateAssociatedTokenAccount(associated_token_account.CreateAssociatedTokenAccountParam{
+					Funder:                 feePayer.PublicKey,
+					Owner:                  feePayer.PublicKey,
+					Mint:                   mint.PublicKey,
+					AssociatedTokenAccount: ata,
+				}),
+				token.MintTo(token.MintToParam{
+					Mint:   mint.PublicKey,
+					To:     ata,
+					Auth:   feePayer.PublicKey,
+					Amount: 1,
+				}),
+				token_metadata.CreateMasterEditionV3(token_metadata.CreateMasterEditionParam{
+					Edition:         tokenMasterEditionPubkey,
+					Mint:            mint.PublicKey,
+					UpdateAuthority: feePayer.PublicKey,
+					MintAuthority:   feePayer.PublicKey,
+					Metadata:        tokenMetadataPubkey,
+					Payer:           feePayer.PublicKey,
+					MaxSupply:       pointer.Get[uint64](0),
+				}),
+			},
+		}),
+	})
+	if err != nil {
+		log.Fatalf("failed to new a tx, err: %v", err)
+	}
+
+	sig, err := c.SendTransaction(context.Background(), tx)
+	if err != nil {
+		log.Fatalf("failed to send tx, err: %v", err)
+	}
+
+	fmt.Println("txid:", sig)
+}
+
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
`,2);function p(o,e){return t}var u=n(a,[["render",p]]);export{u as default}; diff --git a/assets/mint-to.html.71acbc9f.js b/assets/mint-to.html.71acbc9f.js new file mode 100644 index 00000000..e386ff70 --- /dev/null +++ b/assets/mint-to.html.71acbc9f.js @@ -0,0 +1,62 @@ +import{_ as n,e as s}from"./app.01f87ec9.js";const a={},t=s(`

Mint To

package main
+
+import (
+	"context"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/program/token"
+	"github.com/blocto/solana-go-sdk/rpc"
+	"github.com/blocto/solana-go-sdk/types"
+)
+
+// FUarP2p5EnxD66vVDL4PWRoWMzA56ZVHG24hpEDFShEz
+var feePayer, _ = types.AccountFromBase58("4TMFNY9ntAn3CHzguSAvDNLPRoQTaK3sWbQQXdDXaE6KWRBLufGL6PJdsD2koiEe3gGmMdRK3aAw7sikGNksHJrN")
+
+// 9aE476sH92Vz7DMPyq5WLPkrKWivxeuTKEFKd2sZZcde
+var alice, _ = types.AccountFromBase58("4voSPg3tYuWbKzimpQK9EbXHmuyy5fUrtXvpLDMLkmY6TRncaTHAKGD8jUg3maB5Jbrd9CkQg4qjJMyN6sQvnEF2")
+
+var mintPubkey = common.PublicKeyFromString("F6tecPzBMF47yJ2EN6j2aGtE68yR5jehXcZYVZa6ZETo")
+
+var aliceTokenRandomTokenPubkey = common.PublicKeyFromString("HeCBh32JJ8DxcjTyc6q46tirHR8hd2xj3mGoAcQ7eduL")
+
+var aliceTokenATAPubkey = common.PublicKeyFromString("J1T6kAPowNFcxFh4pmwSqxQM9AitN7HwLyvxV2ZGfLf2")
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	res, err := c.GetLatestBlockhash(context.Background())
+	if err != nil {
+		log.Fatalf("get recent block hash error, err: %v\\n", err)
+	}
+
+	tx, err := types.NewTransaction(types.NewTransactionParam{
+		Message: types.NewMessage(types.NewMessageParam{
+			FeePayer:        feePayer.PublicKey,
+			RecentBlockhash: res.Blockhash,
+			Instructions: []types.Instruction{
+				token.MintToChecked(token.MintToCheckedParam{
+					Mint:     mintPubkey,
+					Auth:     alice.PublicKey,
+					Signers:  []common.PublicKey{},
+					To:       aliceTokenRandomTokenPubkey,
+					Amount:   1e8,
+					Decimals: 8,
+				}),
+			},
+		}),
+		Signers: []types.Account{feePayer, alice},
+	})
+	if err != nil {
+		log.Fatalf("generate tx error, err: %v\\n", err)
+	}
+
+	txhash, err := c.SendTransaction(context.Background(), tx)
+	if err != nil {
+		log.Fatalf("send raw tx error, err: %v\\n", err)
+	}
+
+	log.Println("txhash:", txhash)
+}
+
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
`,2);function p(o,e){return t}var u=n(a,[["render",p]]);export{u as default}; diff --git a/assets/mint-to.html.fe63e0ea.js b/assets/mint-to.html.fe63e0ea.js new file mode 100644 index 00000000..39cc7104 --- /dev/null +++ b/assets/mint-to.html.fe63e0ea.js @@ -0,0 +1 @@ +const t={key:"v-41cbbd5e",path:"/tour/mint-to.html",title:"Mint To",lang:"en-US",frontmatter:{},excerpt:"",headers:[],git:{updatedTime:1646071383e3,contributors:[{name:"yihau",email:"a122092487@gmail.com",commits:1}]},filePathRelative:"tour/mint-to.md"};export{t as data}; diff --git a/assets/request-airdrop.html.2cbd486f.js b/assets/request-airdrop.html.2cbd486f.js new file mode 100644 index 00000000..154a8901 --- /dev/null +++ b/assets/request-airdrop.html.2cbd486f.js @@ -0,0 +1,24 @@ +import{_ as t,r as e,o as p,c as o,a as n,b as c,F as l,e as r,d as s}from"./app.01f87ec9.js";const u={},i=r(`

Request Airdrop

Request some airdrop for testing.

package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/rpc"
+)
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+	sig, err := c.RequestAirdrop(
+		context.TODO(),
+		"9qeP9DmjXAmKQc4wy133XZrQ3Fo4ejsYteA7X4YFJ3an", // address
+		1e9, // lamports (1 SOL = 10^9 lamports)
+	)
+	if err != nil {
+		log.Fatalf("failed to request airdrop, err: %v", err)
+	}
+	fmt.Println(sig)
+}
+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
`,3),k={class:"custom-container tip"},b=n("p",{class:"custom-container-title"},"TIP",-1),m=s("you can look up this tx on "),d={href:"https://explorer.solana.com/?cluster=devnet",target:"_blank",rel:"noopener noreferrer"},g=s("https://explorer.solana.com/?cluster=devnet");function _(f,q){const a=e("ExternalLinkIcon");return p(),o(l,null,[i,n("div",k,[b,n("p",null,[m,n("a",d,[g,c(a)])])])],64)}var x=t(u,[["render",_]]);export{x as default}; diff --git a/assets/request-airdrop.html.fa688e36.js b/assets/request-airdrop.html.fa688e36.js new file mode 100644 index 00000000..817166bc --- /dev/null +++ b/assets/request-airdrop.html.fa688e36.js @@ -0,0 +1 @@ +const t={key:"v-79469b88",path:"/tour/request-airdrop.html",title:"Request Airdrop",lang:"en-US",frontmatter:{},excerpt:"",headers:[],git:{updatedTime:1646071383e3,contributors:[{name:"yihau",email:"a122092487@gmail.com",commits:1}]},filePathRelative:"tour/request-airdrop.md"};export{t as data}; diff --git a/assets/sign-metadata.html.0570f274.js b/assets/sign-metadata.html.0570f274.js new file mode 100644 index 00000000..04b82780 --- /dev/null +++ b/assets/sign-metadata.html.0570f274.js @@ -0,0 +1 @@ +const t={key:"v-a02bf734",path:"/nft/sign-metadata.html",title:"Sign Metadata",lang:"en-US",frontmatter:{},excerpt:"",headers:[],git:{updatedTime:1646244832e3,contributors:[{name:"yihau",email:"a122092487@gmail.com",commits:1}]},filePathRelative:"nft/sign-metadata.md"};export{t as data}; diff --git a/assets/sign-metadata.html.be534e59.js b/assets/sign-metadata.html.be534e59.js new file mode 100644 index 00000000..8592c1c5 --- /dev/null +++ b/assets/sign-metadata.html.be534e59.js @@ -0,0 +1,58 @@ +import{_ as n,e as s}from"./app.01f87ec9.js";const a={},t=s(`

Sign Metadata

to convert a unverified creator to a verifeid creator.

package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/program/metaplex/token_metadata"
+	"github.com/blocto/solana-go-sdk/rpc"
+	"github.com/blocto/solana-go-sdk/types"
+)
+
+// FUarP2p5EnxD66vVDL4PWRoWMzA56ZVHG24hpEDFShEz
+var feePayer, _ = types.AccountFromBase58("4TMFNY9ntAn3CHzguSAvDNLPRoQTaK3sWbQQXdDXaE6KWRBLufGL6PJdsD2koiEe3gGmMdRK3aAw7sikGNksHJrN")
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	// mint address
+	nft := common.PublicKeyFromString("FK8eFRgmqewUzr7R6pYUxSPnSNusYmkhAV4e3pUJYdCd")
+
+	tokenMetadataPubkey, err := token_metadata.GetTokenMetaPubkey(nft)
+	if err != nil {
+		log.Fatalf("failed to find a valid token metadata, err: %v", err)
+	}
+
+	recentBlockhashResponse, err := c.GetLatestBlockhash(context.Background())
+	if err != nil {
+		log.Fatalf("failed to get recent blockhash, err: %v", err)
+	}
+
+	tx, err := types.NewTransaction(types.NewTransactionParam{
+		Signers: []types.Account{feePayer},
+		Message: types.NewMessage(types.NewMessageParam{
+			FeePayer:        feePayer.PublicKey,
+			RecentBlockhash: recentBlockhashResponse.Blockhash,
+			Instructions: []types.Instruction{
+				token_metadata.SignMetadata(token_metadata.SignMetadataParam{
+					Metadata: tokenMetadataPubkey,
+					Creator:  feePayer.PublicKey,
+				}),
+			},
+		}),
+	})
+	if err != nil {
+		log.Fatalf("failed to new a tx, err: %v", err)
+	}
+
+	sig, err := c.SendTransaction(context.Background(), tx)
+	if err != nil {
+		log.Fatalf("failed to send tx, err: %v", err)
+	}
+
+	fmt.Println(sig)
+}
+
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
`,3);function p(e,o){return t}var u=n(a,[["render",p]]);export{u as default}; diff --git a/assets/style.507e4890.css b/assets/style.507e4890.css new file mode 100644 index 00000000..cb859431 --- /dev/null +++ b/assets/style.507e4890.css @@ -0,0 +1 @@ +:root{--external-link-icon-color:#aaa}.external-link-icon{position:relative;display:inline-block;color:var(--external-link-icon-color);vertical-align:middle;top:-1px}.external-link-icon-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}:root{--medium-zoom-z-index:100;--medium-zoom-bg-color:#ffffff;--medium-zoom-opacity:1}.medium-zoom-overlay{background-color:var(--medium-zoom-bg-color)!important;z-index:var(--medium-zoom-z-index)}.medium-zoom-overlay~img{z-index:calc(var(--medium-zoom-z-index) + 1)}.medium-zoom--opened .medium-zoom-overlay{opacity:var(--medium-zoom-opacity)}:root{--c-brand:#3eaf7c;--c-brand-light:#4abf8a;--c-bg:#ffffff;--c-bg-light:#f3f4f5;--c-bg-lighter:#eeeeee;--c-bg-navbar:var(--c-bg);--c-bg-sidebar:var(--c-bg);--c-bg-arrow:#cccccc;--c-text:#2c3e50;--c-text-accent:var(--c-brand);--c-text-light:#3a5169;--c-text-lighter:#4e6e8e;--c-text-lightest:#6a8bad;--c-text-quote:#999999;--c-border:#eaecef;--c-border-dark:#dfe2e5;--c-tip:#42b983;--c-tip-bg:var(--c-bg-light);--c-tip-title:var(--c-text);--c-tip-text:var(--c-text);--c-tip-text-accent:var(--c-text-accent);--c-warning:#e7c000;--c-warning-bg:#fffae3;--c-warning-title:#ad9000;--c-warning-text:#746000;--c-warning-text-accent:var(--c-text);--c-danger:#cc0000;--c-danger-bg:#ffe0e0;--c-danger-title:#990000;--c-danger-text:#660000;--c-danger-text-accent:var(--c-text);--c-details-bg:#eeeeee;--c-badge-tip:var(--c-tip);--c-badge-warning:var(--c-warning);--c-badge-danger:var(--c-danger);--t-color:.3s ease;--t-transform:.3s ease;--code-bg-color:#282c34;--code-hl-bg-color:rgba(0, 0, 0, .66);--code-ln-color:#9e9e9e;--code-ln-wrapper-width:3.5rem;--font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;--font-family-code:Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace;--navbar-height:3.6rem;--navbar-padding-v:.7rem;--navbar-padding-h:1.5rem;--sidebar-width:20rem;--sidebar-width-mobile:calc(var(--sidebar-width) * .82);--content-width:740px;--homepage-width:960px}.back-to-top{--back-to-top-color:var(--c-brand);--back-to-top-color-hover:var(--c-brand-light)}.DocSearch{--docsearch-primary-color:var(--c-brand);--docsearch-text-color:var(--c-text);--docsearch-highlight-color:var(--c-brand);--docsearch-muted-color:var(--c-text-quote);--docsearch-container-background:rgba(9, 10, 17, .8);--docsearch-modal-background:var(--c-bg-light);--docsearch-searchbox-background:var(--c-bg-lighter);--docsearch-searchbox-focus-background:var(--c-bg);--docsearch-searchbox-shadow:inset 0 0 0 2px var(--c-brand);--docsearch-hit-color:var(--c-text-light);--docsearch-hit-active-color:var(--c-bg);--docsearch-hit-background:var(--c-bg);--docsearch-hit-shadow:0 1px 3px 0 var(--c-border-dark);--docsearch-footer-background:var(--c-bg)}.external-link-icon{--external-link-icon-color:var(--c-text-quote)}.medium-zoom-overlay{--medium-zoom-bg-color:var(--c-bg)}#nprogress{--nprogress-color:var(--c-brand)}.pwa-popup{--pwa-popup-text-color:var(--c-text);--pwa-popup-bg-color:var(--c-bg);--pwa-popup-border-color:var(--c-brand);--pwa-popup-shadow:0 4px 16px var(--c-brand);--pwa-popup-btn-text-color:var(--c-bg);--pwa-popup-btn-bg-color:var(--c-brand);--pwa-popup-btn-hover-bg-color:var(--c-brand-light)}.search-box{--search-bg-color:var(--c-bg);--search-accent-color:var(--c-brand);--search-text-color:var(--c-text);--search-border-color:var(--c-border);--search-item-text-color:var(--c-text-lighter);--search-item-focus-bg-color:var(--c-bg-light)}html.dark{--c-brand:#3aa675;--c-brand-light:#349469;--c-bg:#22272e;--c-bg-light:#2b313a;--c-bg-lighter:#262c34;--c-text:#adbac7;--c-text-light:#96a7b7;--c-text-lighter:#8b9eb0;--c-text-lightest:#8094a8;--c-border:#3e4c5a;--c-border-dark:#34404c;--c-tip:#318a62;--c-warning:#ceab00;--c-warning-bg:#7e755b;--c-warning-title:#ceac03;--c-warning-text:#362e00;--c-danger:#940000;--c-danger-bg:#806161;--c-danger-title:#610000;--c-danger-text:#3a0000;--c-details-bg:#323843;--code-hl-bg-color:#363b46;color-scheme:dark}html.dark .DocSearch{--docsearch-logo-color:var(--c-text);--docsearch-modal-shadow:inset 1px 1px 0 0 #2c2e40, 0 3px 8px 0 #000309;--docsearch-key-shadow:inset 0 -2px 0 0 #282d55, inset 0 0 1px 1px #51577d, 0 2px 2px 0 rgba(3, 4, 9, .3);--docsearch-key-gradient:linear-gradient(-225deg, #444950, #1c1e21);--docsearch-footer-shadow:inset 0 1px 0 0 rgba(73, 76, 106, .5), 0 -4px 8px 0 rgba(0, 0, 0, .2)}body,html{padding:0;margin:0;background-color:var(--c-bg);transition:background-color var(--t-color)}body{font-family:var(--font-family);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-size:16px}a,p a code{color:var(--c-text-accent)}a{font-weight:500;text-decoration:none;overflow-wrap:break-word}p a code{font-weight:400}code,kbd{font-family:var(--font-family-code)}body,kbd{color:var(--c-text)}kbd{background:var(--c-bg-lighter);border:solid .15rem var(--c-border-dark);border-bottom:solid .25rem var(--c-border-dark);border-radius:.15rem;padding:0 .15em}code{color:var(--c-text-lighter);padding:.25rem .5rem;font-size:.85em;background-color:var(--c-bg-light);border-radius:3px;overflow-wrap:break-word;transition:background-color var(--t-color)}blockquote{font-size:1rem;color:var(--c-text-quote);border-left:.2rem solid var(--c-border-dark);margin:1rem 0;padding:.25rem 0 .25rem 1rem}blockquote>p,code{margin:0}ol,ul{padding-left:1.2em}strong{font-weight:600}h1,h2,h3,h4,h5,h6{font-weight:600;line-height:1.25}h1:focus-visible,h2:focus-visible,h3:focus-visible,h4:focus-visible,h5:focus-visible,h6:focus-visible{outline:0}h1:hover .header-anchor,h2:hover .header-anchor,h3:hover .header-anchor,h4:hover .header-anchor,h5:hover .header-anchor,h6:hover .header-anchor{opacity:1}h1{font-size:2.2rem}h2{font-size:1.65rem;padding-bottom:.3rem;border-bottom:1px solid var(--c-border);transition:border-color var(--t-color)}h3{font-size:1.35rem}h4{font-size:1.15rem}h5{font-size:1.05rem}h6{font-size:1rem}a.header-anchor{font-size:.85em;float:left;margin-left:-.87em;padding-right:.23em;margin-top:.125em;opacity:0}a.header-anchor:hover{text-decoration:none}a.header-anchor:focus-visible{opacity:1}ol,p,ul{line-height:1.7}hr{border:0;border-top:1px solid var(--c-border)}table,tr{transition:border-color var(--t-color)}table{border-collapse:collapse;margin:1rem 0;display:block;overflow-x:auto}tr{border-top:1px solid var(--c-border-dark)}tr:nth-child(2n){background-color:var(--c-bg-light);transition:background-color var(--t-color)}td,th{padding:.6em 1em;border:1px solid var(--c-border-dark);transition:border-color var(--t-color)}.arrow,.badge{display:inline-block}.arrow{width:0;height:0}.arrow.down,.arrow.up{border-left:4px solid transparent;border-right:4px solid transparent}.arrow.up{border-bottom:6px solid var(--c-bg-arrow)}.arrow.down{border-top:6px solid var(--c-bg-arrow)}.arrow.left,.arrow.right{border-top:4px solid transparent;border-bottom:4px solid transparent}.arrow.right{border-left:6px solid var(--c-bg-arrow)}.arrow.left{border-right:6px solid var(--c-bg-arrow)}.badge{font-size:14px;height:18px;line-height:18px;border-radius:3px;padding:0 6px;color:var(--c-bg);vertical-align:top;transition:color var(--t-color),background-color var(--t-color)}.badge.tip{background-color:var(--c-badge-tip)}.badge.warning{background-color:var(--c-badge-warning)}.badge.danger{background-color:var(--c-badge-danger)}.badge+.badge{margin-left:5px}code[class*=language-],pre[class*=language-]{color:#ccc;background:0 0;font-family:var(--font-family-code);font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*=language-],pre[class*=language-]{background:#2d2d2d}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}.token.block-comment,.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#999}.token.punctuation{color:#ccc}.token.attr-name,.token.deleted,.token.namespace,.token.tag{color:#ec5975}.token.function-name{color:#6196cc}.token.boolean,.token.function,.token.number{color:#f08d49}.token.class-name,.token.constant,.token.property,.token.symbol{color:#f8c555}.token.atrule,.token.builtin,.token.important,.token.keyword,.token.selector{color:#cc99cd}.token.attr-value,.token.char,.token.regex,.token.string,.token.variable{color:#7ec699}.token.entity,.token.operator,.token.url{color:#67cdcc}.token.bold,.token.important{font-weight:700}.token.italic{font-style:italic}.token.entity{cursor:help}.token.inserted{color:#3eaf7c}.theme-default-content pre,.theme-default-content pre[class*=language-]{line-height:1.4;padding:1.3rem 1.5rem;margin:.85rem 0;border-radius:6px;overflow:auto}.theme-default-content pre code,.theme-default-content pre[class*=language-] code{color:#fff;padding:0;background-color:transparent;border-radius:0;overflow-wrap:unset;-webkit-font-smoothing:auto;-moz-osx-font-smoothing:auto}.theme-default-content .line-number{font-family:var(--font-family-code)}div[class*=language-]{position:relative;background-color:var(--code-bg-color);border-radius:6px}div[class*=language-]:before{position:absolute;z-index:3;top:.8em;right:1em;font-size:.75rem;color:var(--code-ln-color)}div[class*=language-] pre,div[class*=language-] pre[class*=language-]{background:0 0!important;position:relative;z-index:1}div[class*=language-] .highlight-lines{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding-top:1.3rem;position:absolute;top:0;left:0;width:100%;line-height:1.4}div[class*=language-] .highlight-lines .highlight-line{background-color:var(--code-hl-bg-color)}div[class*=language-]:not(.line-numbers-mode) .line-numbers{display:none}div[class*=language-].line-numbers-mode .highlight-lines .highlight-line{position:relative}div[class*=language-].line-numbers-mode .highlight-lines .highlight-line:before{content:" ";position:absolute;z-index:2;left:0;top:0;display:block;width:var(--code-ln-wrapper-width);height:100%}div[class*=language-].line-numbers-mode pre{margin-left:var(--code-ln-wrapper-width);padding-left:1rem;vertical-align:middle}div[class*=language-].line-numbers-mode .line-numbers{position:absolute;top:0;width:var(--code-ln-wrapper-width);text-align:center;color:var(--code-ln-color);padding-top:1.25rem;line-height:1.4}div[class*=language-].line-numbers-mode .line-numbers .line-number,div[class*=language-].line-numbers-mode .line-numbers br{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}div[class*=language-].line-numbers-mode .line-numbers .line-number{position:relative;z-index:3;font-size:.85em;line-height:0}div[class*=language-].line-numbers-mode:after{content:"";position:absolute;top:0;left:0;width:var(--code-ln-wrapper-width);height:100%;border-radius:6px 0 0 6px;border-right:1px solid var(--code-hl-bg-color)}div[class*=language-].ext-c:before{content:"c"}div[class*=language-].ext-cpp:before{content:"cpp"}div[class*=language-].ext-cs:before{content:"cs"}div[class*=language-].ext-css:before{content:"css"}div[class*=language-].ext-dart:before{content:"dart"}div[class*=language-].ext-docker:before{content:"docker"}div[class*=language-].ext-fs:before{content:"fs"}div[class*=language-].ext-go:before{content:"go"}div[class*=language-].ext-html:before{content:"html"}div[class*=language-].ext-java:before{content:"java"}div[class*=language-].ext-js:before{content:"js"}div[class*=language-].ext-json:before{content:"json"}div[class*=language-].ext-kt:before{content:"kt"}div[class*=language-].ext-less:before{content:"less"}div[class*=language-].ext-makefile:before{content:"makefile"}div[class*=language-].ext-md:before{content:"md"}div[class*=language-].ext-php:before{content:"php"}div[class*=language-].ext-py:before{content:"py"}div[class*=language-].ext-rb:before{content:"rb"}div[class*=language-].ext-rs:before{content:"rs"}div[class*=language-].ext-sass:before{content:"sass"}div[class*=language-].ext-scss:before{content:"scss"}div[class*=language-].ext-sh:before{content:"sh"}div[class*=language-].ext-styl:before{content:"styl"}div[class*=language-].ext-ts:before{content:"ts"}div[class*=language-].ext-toml:before{content:"toml"}div[class*=language-].ext-vue:before{content:"vue"}div[class*=language-].ext-yml:before{content:"yml"}@media (max-width:419px){.theme-default-content div[class*=language-]{margin:.85rem -1.5rem;border-radius:0}}.code-group__nav{margin-top:.85rem;margin-bottom:calc(-1.7rem - 6px);padding-bottom:calc(1.7rem - 6px);padding-left:10px;padding-top:10px;border-top-left-radius:6px;border-top-right-radius:6px;background-color:var(--code-bg-color)}.code-group__ul{margin:auto 0;padding-left:0;display:inline-flex;list-style:none}.code-group__nav-tab{border:0;padding:5px;cursor:pointer;background-color:transparent;font-size:.85em;line-height:1.4;color:#ffffffe6;font-weight:600}.code-group__nav-tab:focus{outline:0}.code-group__nav-tab:focus-visible{outline:1px solid rgba(255,255,255,.9)}.code-group__nav-tab-active{border-bottom:var(--c-brand) 1px solid}@media (max-width:419px){.code-group__nav{margin-left:-1.5rem;margin-right:-1.5rem;border-radius:0}}.code-group-item,.navbar-dropdown-wrapper .navbar-dropdown .navbar-dropdown-item .navbar-dropdown-subtitle>a.router-link-active:after{display:none}.code-group-item__active{display:block}.code-group-item>pre{background-color:orange}.custom-container{transition:color var(--t-color),border-color var(--t-color),background-color var(--t-color)}.custom-container .custom-container-title{font-weight:600;margin-bottom:-.4rem}.custom-container.danger,.custom-container.tip,.custom-container.warning{padding:.1rem 1.5rem;border-left-width:.5rem;border-left-style:solid;margin:1rem 0}.custom-container.tip{border-color:var(--c-tip);background-color:var(--c-tip-bg);color:var(--c-tip-text)}.custom-container.tip .custom-container-title{color:var(--c-tip-title)}.custom-container.tip a{color:var(--c-tip-text-accent)}.custom-container.warning{border-color:var(--c-warning);background-color:var(--c-warning-bg);color:var(--c-warning-text)}.custom-container.warning .custom-container-title{color:var(--c-warning-title)}.custom-container.warning a{color:var(--c-warning-text-accent)}.custom-container.danger{border-color:var(--c-danger);background-color:var(--c-danger-bg);color:var(--c-danger-text)}.custom-container.danger .custom-container-title{color:var(--c-danger-title)}.custom-container.danger a{color:var(--c-danger-text-accent)}.custom-container.details{display:block;position:relative;border-radius:2px;margin:1.6em 0;padding:1.6em;background-color:var(--c-details-bg)}.custom-container.details h4{margin-top:0}.custom-container.details figure:last-child,.custom-container.details p:last-child{margin-bottom:0;padding-bottom:0}.custom-container.details summary{outline:0;cursor:pointer}.home{padding:var(--navbar-height) 2rem 0;max-width:var(--homepage-width);margin:0 auto;display:block}.home .hero{text-align:center}.home .hero img{max-width:100%;max-height:280px;display:block;margin:3rem auto 1.5rem}.home .hero h1{font-size:3rem}.home .hero .actions,.home .hero .description,.home .hero h1{margin:1.8rem auto}.home .hero .actions{display:flex;flex-wrap:wrap;gap:1rem;justify-content:center}.home .hero .description{max-width:35rem;font-size:1.6rem;line-height:1.3;color:var(--c-text-lightest)}.home .hero .action-button{display:inline-block;font-size:1.2rem;padding:.8rem 1.6rem;border-width:2px;border-style:solid;border-radius:4px;transition:background-color var(--t-color);box-sizing:border-box}.home .hero .action-button.primary{color:var(--c-bg);background-color:var(--c-brand);border-color:var(--c-brand)}.home .hero .action-button.primary:hover{background-color:var(--c-brand-light)}.home .hero .action-button.secondary{color:var(--c-brand);background-color:var(--c-bg);border-color:var(--c-brand)}.home .hero .action-button.secondary:hover{color:var(--c-bg);background-color:var(--c-brand-light)}.home .features{border-top:1px solid var(--c-border);transition:border-color var(--t-color);padding:1.2rem 0;margin-top:2.5rem;display:flex;flex-wrap:wrap;align-items:flex-start;align-content:stretch;justify-content:space-between}.home .feature{flex-grow:1;flex-basis:30%;max-width:30%}.home .feature h2{font-size:1.4rem;font-weight:500;border-bottom:none;padding-bottom:0;color:var(--c-text-light)}.home .feature p,.home .footer{color:var(--c-text-lighter)}.home .footer{padding:2.5rem;border-top:1px solid var(--c-border);text-align:center;transition:border-color var(--t-color)}@media (max-width:719px){.home .features{flex-direction:column}.home .feature{max-width:100%;padding:0 2.5rem}}@media (max-width:419px){.home{padding-left:1.5rem;padding-right:1.5rem}.home .hero img{max-height:210px;margin:2rem auto 1.2rem}.home .hero h1{font-size:2rem}.home .hero .actions,.home .hero .description,.home .hero h1{margin:1.2rem auto}.home .hero .description{font-size:1.2rem}.home .hero .action-button{font-size:1rem;padding:.6rem 1.2rem}.home .feature h2{font-size:1.25rem}}.page{padding-top:var(--navbar-height);padding-left:var(--sidebar-width)}.navbar,.sidebar{position:fixed;left:0;box-sizing:border-box}.navbar{z-index:20;top:0;right:0;height:var(--navbar-height);border-bottom:1px solid var(--c-border);background-color:var(--c-bg-navbar);transition:background-color var(--t-color),border-color var(--t-color)}.sidebar{font-size:16px;width:var(--sidebar-width);z-index:10;margin:0;top:var(--navbar-height);bottom:0;border-right:1px solid var(--c-border);overflow-y:auto;scrollbar-width:thin;scrollbar-color:var(--c-brand) var(--c-border);background-color:var(--c-bg-sidebar);transition:transform var(--t-transform),background-color var(--t-color),border-color var(--t-color)}.sidebar::-webkit-scrollbar{width:7px}.sidebar::-webkit-scrollbar-track{background-color:var(--c-border)}.sidebar::-webkit-scrollbar-thumb{background-color:var(--c-brand)}.sidebar-mask{position:fixed;z-index:9;top:0;left:0;width:100vw;height:100vh;display:none}.theme-container.sidebar-open .sidebar-mask{display:block}.theme-container.sidebar-open .navbar>.toggle-sidebar-button .icon span:nth-child(1){transform:rotate(45deg) translate(5.5px,5.5px)}.theme-container.sidebar-open .navbar>.toggle-sidebar-button .icon span:nth-child(2){transform:scaleX(0)}.theme-container.sidebar-open .navbar>.toggle-sidebar-button .icon span:nth-child(3){transform:rotate(-45deg) translate(6px,-6px)}.theme-container.sidebar-open .navbar>.toggle-sidebar-button .icon span:nth-child(1),.theme-container.sidebar-open .navbar>.toggle-sidebar-button .icon span:nth-child(3){transform-origin:center}.theme-container.no-navbar .theme-default-content:not(.custom)>h1,.theme-container.no-navbar h2,.theme-container.no-navbar h3,.theme-container.no-navbar h4,.theme-container.no-navbar h5,.theme-container.no-navbar h6{margin-top:1.5rem;padding-top:0}.theme-container.no-navbar .page{padding-top:0}.theme-container.no-navbar .sidebar{top:0}@media (min-width:720px){.theme-container.no-sidebar .sidebar{display:none}.theme-container.no-sidebar .page{padding-left:0}}.theme-default-content:not(.custom)>h1,.theme-default-content:not(.custom)>h2,.theme-default-content:not(.custom)>h3,.theme-default-content:not(.custom)>h4,.theme-default-content:not(.custom)>h5,.theme-default-content:not(.custom)>h6{margin-top:calc(.5rem - var(--navbar-height));padding-top:calc(1rem + var(--navbar-height));margin-bottom:0}.theme-default-content:not(.custom)>h1:first-child,.theme-default-content:not(.custom)>h2:first-child,.theme-default-content:not(.custom)>h3:first-child,.theme-default-content:not(.custom)>h4:first-child,.theme-default-content:not(.custom)>h5:first-child,.theme-default-content:not(.custom)>h6:first-child{margin-bottom:1rem}.theme-default-content:not(.custom)>h1:first-child+.custom-container,.theme-default-content:not(.custom)>h1:first-child+p,.theme-default-content:not(.custom)>h1:first-child+pre,.theme-default-content:not(.custom)>h2:first-child+.custom-container,.theme-default-content:not(.custom)>h2:first-child+p,.theme-default-content:not(.custom)>h2:first-child+pre,.theme-default-content:not(.custom)>h3:first-child+.custom-container,.theme-default-content:not(.custom)>h3:first-child+p,.theme-default-content:not(.custom)>h3:first-child+pre,.theme-default-content:not(.custom)>h4:first-child+.custom-container,.theme-default-content:not(.custom)>h4:first-child+p,.theme-default-content:not(.custom)>h4:first-child+pre,.theme-default-content:not(.custom)>h5:first-child+.custom-container,.theme-default-content:not(.custom)>h5:first-child+p,.theme-default-content:not(.custom)>h5:first-child+pre,.theme-default-content:not(.custom)>h6:first-child+.custom-container,.theme-default-content:not(.custom)>h6:first-child+p,.theme-default-content:not(.custom)>h6:first-child+pre{margin-top:2rem}.theme-default-content:not(.custom){max-width:var(--content-width);margin:0 auto;padding:2rem 2.5rem;padding-top:0}@media (max-width:959px){.theme-default-content:not(.custom){padding:2rem}}@media (max-width:419px){.theme-default-content:not(.custom){padding:1.5rem}}.theme-default-content:not(.custom) a:hover{text-decoration:underline}.theme-default-content:not(.custom) img{max-width:100%}.theme-default-content.custom{padding:0;margin:0}.theme-default-content.custom img{max-width:100%}@media (max-width:959px){.sidebar{font-size:15px;width:var(--sidebar-width-mobile)}.page{padding-left:var(--sidebar-width-mobile)}}@media (max-width:719px){.sidebar{top:0;padding-top:var(--navbar-height);transform:translate(-100%)}.page{padding-left:0}.theme-container.sidebar-open .sidebar{transform:translate(0)}.theme-container.no-navbar .sidebar{padding-top:0}}@media (max-width:419px){h1{font-size:1.9rem}}.navbar{--navbar-line-height:calc( var(--navbar-height) - 2 * var(--navbar-padding-v) );padding:var(--navbar-padding-v) var(--navbar-padding-h);line-height:var(--navbar-line-height)}.navbar .logo{height:var(--navbar-line-height);margin-right:var(--navbar-padding-v);vertical-align:top}.navbar .site-name{font-size:1.3rem;font-weight:600;color:var(--c-text);position:relative}.navbar .navbar-items-wrapper{display:flex;position:absolute;box-sizing:border-box;top:var(--navbar-padding-v);right:var(--navbar-padding-h);height:var(--navbar-line-height);padding-left:var(--navbar-padding-h);white-space:nowrap;font-size:.9rem}.navbar .navbar-items-wrapper .search-box{flex:0 0 auto;vertical-align:top}@media (max-width:719px){.navbar{padding-left:4rem}.navbar .can-hide{display:none}.navbar .site-name{width:calc(100vw - 9.4rem);overflow:hidden;white-space:nowrap;text-overflow:ellipsis}}.navbar-items,.navbar-items a{display:inline-block}.navbar-items a{line-height:1.4rem;color:inherit}.navbar-items a.router-link-active,.navbar-items a:hover{color:var(--c-text-accent)}.navbar-items .navbar-item{position:relative;display:inline-block;margin-left:1.5rem;line-height:var(--navbar-line-height)}.navbar-items .navbar-item:first-child{margin-left:0}@media (max-width:719px){.navbar-items .navbar-item{margin-left:0}}@media (min-width:719px){.navbar-items a.router-link-active,.navbar-items a:hover{color:var(--c-text)}.navbar-item>a.router-link-active,.navbar-item>a:hover{margin-bottom:-2px;border-bottom:2px solid var(--c-text-accent)}}.toggle-sidebar-button{position:absolute;top:.6rem;left:1rem;display:none;padding:.6rem;cursor:pointer}.toggle-sidebar-button .icon{display:flex;flex-direction:column;justify-content:center;align-items:center;width:1.25rem;height:1.25rem;cursor:inherit}.toggle-sidebar-button .icon span{display:inline-block;width:100%;height:2px;border-radius:2px;background-color:var(--c-text);transition:transform var(--t-transform)}.toggle-sidebar-button .icon span:nth-child(2){margin:6px 0}@media screen and (max-width:719px){.toggle-sidebar-button{display:block}}.toggle-dark-button{display:flex;margin:auto;margin-left:1rem;border:0;background:0 0;color:var(--c-text);opacity:.8;cursor:pointer}.toggle-dark-button:hover{opacity:1}.toggle-dark-button .icon{width:1.25rem;height:1.25rem}.DocSearch{transition:background-color var(--t-color)}.navbar-dropdown-wrapper{cursor:pointer}.navbar-dropdown-wrapper .navbar-dropdown-title,.navbar-dropdown-wrapper .navbar-dropdown-title-mobile{display:block;font-size:.9rem;font-family:inherit;cursor:inherit;padding:inherit;line-height:1.4rem;background:0 0;border:0;font-weight:500;color:var(--c-text)}.navbar-dropdown-wrapper .navbar-dropdown-title-mobile{display:none;font-weight:600;font-size:inherit}.navbar-dropdown-wrapper .navbar-dropdown-title-mobile:hover,.navbar-dropdown-wrapper .navbar-dropdown-title:hover{border-color:transparent}.navbar-dropdown-wrapper .navbar-dropdown-title .arrow,.navbar-dropdown-wrapper .navbar-dropdown-title-mobile .arrow{vertical-align:middle;margin-top:-1px;margin-left:.4rem}.navbar-dropdown-wrapper .navbar-dropdown-title-mobile:hover{color:var(--c-text-accent)}.navbar-dropdown-wrapper .navbar-dropdown .navbar-dropdown-item{color:inherit;line-height:1.7rem}.navbar-dropdown-wrapper .navbar-dropdown .navbar-dropdown-item .navbar-dropdown-subtitle{margin:.45rem 0 0;border-top:1px solid var(--c-border);padding:1rem 0 .45rem;font-size:.9rem}.navbar-dropdown-wrapper .navbar-dropdown .navbar-dropdown-item .navbar-dropdown-subtitle>span{padding:0 1.5rem 0 1.25rem}.navbar-dropdown-wrapper .navbar-dropdown .navbar-dropdown-item .navbar-dropdown-subtitle>a{font-weight:inherit}.navbar-dropdown-wrapper .navbar-dropdown .navbar-dropdown-item .navbar-dropdown-subitem-wrapper{padding:0;list-style:none}.navbar-dropdown-wrapper .navbar-dropdown .navbar-dropdown-item .navbar-dropdown-subitem-wrapper .navbar-dropdown-subitem{font-size:.9em}.navbar-dropdown-wrapper .navbar-dropdown .navbar-dropdown-item a{display:block;line-height:1.7rem;position:relative;border-bottom:none;font-weight:400;margin-bottom:0;padding:0 1.5rem 0 1.25rem}.navbar-dropdown-wrapper .navbar-dropdown .navbar-dropdown-item a.router-link-active,.navbar-dropdown-wrapper .navbar-dropdown .navbar-dropdown-item a:hover{color:var(--c-text-accent)}.navbar-dropdown-wrapper .navbar-dropdown .navbar-dropdown-item a.router-link-active:after{content:"";width:0;height:0;border-left:5px solid var(--c-text-accent);border-top:3px solid transparent;border-bottom:3px solid transparent;position:absolute;top:calc(50% - 2px);left:9px}.navbar-dropdown-wrapper .navbar-dropdown .navbar-dropdown-item:first-child .navbar-dropdown-subtitle{margin-top:0;padding-top:0;border-top:0}@media (max-width:719px){.navbar-dropdown-wrapper.open .navbar-dropdown-title,.navbar-dropdown-wrapper.open .navbar-dropdown-title-mobile{margin-bottom:.5rem}.navbar-dropdown-wrapper .navbar-dropdown-title{display:none}.navbar-dropdown-wrapper .navbar-dropdown-title-mobile{display:block}.navbar-dropdown-wrapper .navbar-dropdown{transition:height .1s ease-out;overflow:hidden}.navbar-dropdown-wrapper .navbar-dropdown .navbar-dropdown-item .navbar-dropdown-subtitle{border-top:0;margin-top:0;padding-top:0;padding-bottom:0;font-size:15px;line-height:2rem}.navbar-dropdown-wrapper .navbar-dropdown .navbar-dropdown-item>a{font-size:15px;line-height:2rem}.navbar-dropdown-wrapper .navbar-dropdown .navbar-dropdown-item .navbar-dropdown-subitem{font-size:14px;padding-left:1rem}}@media (min-width:720px){.navbar-dropdown-wrapper{height:1.8rem}.navbar-dropdown-wrapper.open .navbar-dropdown,.navbar-dropdown-wrapper:hover .navbar-dropdown{display:block!important}.navbar-dropdown-wrapper.open:blur{display:none}.navbar-dropdown-wrapper .navbar-dropdown{display:none;height:auto!important;box-sizing:border-box;max-height:calc(100vh - 2.7rem);overflow-y:auto;position:absolute;top:100%;right:0;background-color:var(--c-bg-navbar);padding:.6rem 0;border:1px solid var(--c-border);border-bottom-color:var(--c-border-dark);text-align:left;border-radius:.25rem;white-space:nowrap;margin:0}}.page{padding-bottom:2rem;display:block}.page-meta{max-width:var(--content-width);margin:0 auto;padding:1rem 2.5rem;overflow:auto}@media (max-width:959px){.page-meta{padding:2rem}}@media (max-width:419px){.page-meta{padding:1.5rem}}.page-meta .meta-item{cursor:default;margin-top:.8rem}.page-meta .meta-item .meta-item-label{font-weight:500;color:var(--c-text-lighter)}.page-meta .meta-item .meta-item-info{font-weight:400;color:var(--c-text-quote)}.page-meta .edit-link{display:inline-block;margin-right:.25rem}.page-meta .last-updated{float:right}@media (max-width:719px){.page-meta .last-updated{font-size:.8em;float:none}.page-meta .contributors{font-size:.8em}}.page-nav{max-width:var(--content-width);margin:0 auto;padding:1rem 2.5rem 2rem;padding-bottom:0}@media (max-width:959px){.page-nav{padding:2rem}}@media (max-width:419px){.page-nav{padding:1.5rem}}.page-nav .inner{min-height:2rem;margin-top:0;border-top:1px solid var(--c-border);transition:border-color var(--t-color);padding-top:1rem;overflow:auto}.page-nav .prev a:before{content:"\2190"}.page-nav .next{float:right}.page-nav .next a:after{content:"\2192"}.sidebar ul{padding:0;margin:0;list-style-type:none}.sidebar a{display:inline-block}.sidebar .navbar-items{display:none;border-bottom:1px solid var(--c-border);transition:border-color var(--t-color);padding:.5rem 0 .75rem}.sidebar .navbar-items a{font-weight:600}.sidebar .navbar-items .navbar-item{display:block;line-height:1.25rem;font-size:1.1em;padding:.5rem 0 .5rem 1.5rem}.sidebar .sidebar-items{padding:1.5rem 0}@media (max-width:719px){.sidebar .navbar-items{display:block}.sidebar .navbar-items .navbar-dropdown-wrapper .navbar-dropdown .navbar-dropdown-item a.router-link-active:after{top:calc(1rem - 2px)}.sidebar .sidebar-items{padding:1rem 0}}.sidebar-item{cursor:default;border-left:.25rem solid transparent;color:var(--c-text)}.sidebar-item:focus-visible{outline-width:1px;outline-offset:-1px}.sidebar-item.active:not(p.sidebar-heading){font-weight:600;color:var(--c-text-accent);border-left-color:var(--c-text-accent)}.sidebar-item.sidebar-heading{transition:color .15s ease;font-size:1.1em;font-weight:700;padding:.35rem 1.5rem .35rem 1.25rem;width:100%;box-sizing:border-box;margin:0}.sidebar-item.sidebar-heading.collapsible,a.sidebar-item{cursor:pointer}.sidebar-item.sidebar-heading.collapsible+.sidebar-item-children{transition:height .1s ease-out;overflow:hidden;margin-bottom:.75rem}.sidebar-item.sidebar-heading .arrow{position:relative;top:-.12em;left:.5em}.sidebar-item:not(.sidebar-heading){font-size:1em;font-weight:400;display:inline-block;margin:0;padding:.35rem 1rem .35rem 2rem;line-height:1.4;width:100%;box-sizing:border-box}.sidebar-item:not(.sidebar-heading)+.sidebar-item-children{padding-left:1rem;font-size:.95em}.sidebar-item-children .sidebar-item-children .sidebar-item:not(.sidebar-heading){padding:.25rem 1rem .25rem 1.75rem}.sidebar-item-children .sidebar-item-children .sidebar-item:not(.sidebar-heading).active{font-weight:500;border-left-color:transparent}a.sidebar-heading+.sidebar-item-children .sidebar-item:not(.sidebar-heading).active{border-left-color:transparent}a.sidebar-item:hover{color:var(--c-text-accent)}.table-of-contents .badge{vertical-align:middle}.dropdown-enter-from,.dropdown-leave-to{height:0!important}.fade-slide-y-enter-active{transition:all .2s ease}.fade-slide-y-leave-active{transition:all .2s cubic-bezier(1,.5,.8,1)}.fade-slide-y-enter-from,.fade-slide-y-leave-to{transform:translateY(10px);opacity:0}svg[data-v-51dd6513]{right:7.5px;opacity:.75;cursor:pointer;z-index:1}span[data-v-51dd6513],svg.hover[data-v-51dd6513]{opacity:0}.success[data-v-51dd6513],svg[data-v-51dd6513]:hover{opacity:1!important}span[data-v-51dd6513],svg[data-v-51dd6513]{position:absolute}span[data-v-51dd6513]{font-size:.85rem;line-height:1.2rem;right:40px;transition:opacity .5s}:root{--back-to-top-z-index:5;--back-to-top-color:#3eaf7c;--back-to-top-color-hover:#71cda3}.back-to-top{cursor:pointer;position:fixed;bottom:2rem;right:2.5rem;width:2rem;height:1.2rem;background-color:var(--back-to-top-color);-webkit-mask:url(/solana-go-sdk/assets/back-to-top.8efcbe56.svg)no-repeat;mask:url(/solana-go-sdk/assets/back-to-top.8efcbe56.svg)no-repeat;z-index:var(--back-to-top-z-index)}.back-to-top:hover{background-color:var(--back-to-top-color-hover)}@media (max-width:959px){.back-to-top{display:none}}.back-to-top-enter-active,.back-to-top-leave-active{transition:opacity .3s}.back-to-top-enter-from,.back-to-top-leave-to{opacity:0}:root{--nprogress-color:#29d;--nprogress-z-index:1031}#nprogress{pointer-events:none}#nprogress .bar{background:var(--nprogress-color);position:fixed;z-index:var(--nprogress-z-index);top:0;left:0;width:100%;height:2px}#nprogress .peg{display:block;position:absolute;right:0;width:100px;height:100%;box-shadow:0 0 10px var(--nprogress-color),0 0 5px var(--nprogress-color);opacity:1;transform:rotate(3deg) translateY(-4px)}.code-copy-added:hover>div>.code-copy svg{opacity:.75} diff --git a/assets/token-transfer.html.b2c2d352.js b/assets/token-transfer.html.b2c2d352.js new file mode 100644 index 00000000..06c0cdfd --- /dev/null +++ b/assets/token-transfer.html.b2c2d352.js @@ -0,0 +1,63 @@ +import{_ as n,e as s}from"./app.01f87ec9.js";const a={},t=s(`

Token Transfer

package main
+
+import (
+	"context"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/program/token"
+	"github.com/blocto/solana-go-sdk/rpc"
+	"github.com/blocto/solana-go-sdk/types"
+)
+
+// FUarP2p5EnxD66vVDL4PWRoWMzA56ZVHG24hpEDFShEz
+var feePayer, _ = types.AccountFromBase58("4TMFNY9ntAn3CHzguSAvDNLPRoQTaK3sWbQQXdDXaE6KWRBLufGL6PJdsD2koiEe3gGmMdRK3aAw7sikGNksHJrN")
+
+// 9aE476sH92Vz7DMPyq5WLPkrKWivxeuTKEFKd2sZZcde
+var alice, _ = types.AccountFromBase58("4voSPg3tYuWbKzimpQK9EbXHmuyy5fUrtXvpLDMLkmY6TRncaTHAKGD8jUg3maB5Jbrd9CkQg4qjJMyN6sQvnEF2")
+
+var mintPubkey = common.PublicKeyFromString("F6tecPzBMF47yJ2EN6j2aGtE68yR5jehXcZYVZa6ZETo")
+
+var aliceTokenRandomTokenPubkey = common.PublicKeyFromString("HeCBh32JJ8DxcjTyc6q46tirHR8hd2xj3mGoAcQ7eduL")
+
+var aliceTokenATAPubkey = common.PublicKeyFromString("J1T6kAPowNFcxFh4pmwSqxQM9AitN7HwLyvxV2ZGfLf2")
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	res, err := c.GetLatestBlockhash(context.Background())
+	if err != nil {
+		log.Fatalf("get recent block hash error, err: %v\\n", err)
+	}
+
+	tx, err := types.NewTransaction(types.NewTransactionParam{
+		Message: types.NewMessage(types.NewMessageParam{
+			FeePayer:        feePayer.PublicKey,
+			RecentBlockhash: res.Blockhash,
+			Instructions: []types.Instruction{
+				token.TransferChecked(token.TransferCheckedParam{
+					From:     aliceTokenRandomTokenPubkey,
+					To:       aliceTokenATAPubkey,
+					Mint:     mintPubkey,
+					Auth:     alice.PublicKey,
+					Signers:  []common.PublicKey{},
+					Amount:   1e8,
+					Decimals: 8,
+				}),
+			},
+		}),
+		Signers: []types.Account{feePayer, alice},
+	})
+	if err != nil {
+		log.Fatalf("failed to new tx, err: %v", err)
+	}
+
+	txhash, err := c.SendTransaction(context.Background(), tx)
+	if err != nil {
+		log.Fatalf("send raw tx error, err: %v\\n", err)
+	}
+
+	log.Println("txhash:", txhash)
+}
+
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
`,2);function p(o,e){return t}var u=n(a,[["render",p]]);export{u as default}; diff --git a/assets/token-transfer.html.c870739e.js b/assets/token-transfer.html.c870739e.js new file mode 100644 index 00000000..f5954b28 --- /dev/null +++ b/assets/token-transfer.html.c870739e.js @@ -0,0 +1 @@ +const e={key:"v-eec8ee88",path:"/tour/token-transfer.html",title:"Token Transfer",lang:"en-US",frontmatter:{},excerpt:"",headers:[],git:{updatedTime:1646071383e3,contributors:[{name:"yihau",email:"a122092487@gmail.com",commits:1}]},filePathRelative:"tour/token-transfer.md"};export{e as data}; diff --git a/assets/transfer.html.565e3105.js b/assets/transfer.html.565e3105.js new file mode 100644 index 00000000..35f1d489 --- /dev/null +++ b/assets/transfer.html.565e3105.js @@ -0,0 +1 @@ +const e={key:"v-7c3a81e0",path:"/tour/transfer.html",title:"Transfer",lang:"en-US",frontmatter:{},excerpt:"",headers:[{level:2,title:"Full Code",slug:"full-code",children:[]}],git:{updatedTime:1646071383e3,contributors:[{name:"yihau",email:"a122092487@gmail.com",commits:1}]},filePathRelative:"tour/transfer.md"};export{e as data}; diff --git a/assets/transfer.html.93f621b8.js b/assets/transfer.html.93f621b8.js new file mode 100644 index 00000000..e9d070cb --- /dev/null +++ b/assets/transfer.html.93f621b8.js @@ -0,0 +1,56 @@ +import{_ as n,e as s}from"./app.01f87ec9.js";const a={},t=s(`

Transfer

We will build a transaction to transfer our SOL out.

A quick guide for a transaction is that:

  1. a transactions is composed by some signatures + a message
  2. a message is composed by one or more instructions + a blockhash

Full Code

package main
+
+import (
+	"context"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/program/system"
+	"github.com/blocto/solana-go-sdk/rpc"
+	"github.com/blocto/solana-go-sdk/types"
+)
+
+// FUarP2p5EnxD66vVDL4PWRoWMzA56ZVHG24hpEDFShEz
+var feePayer, _ = types.AccountFromBase58("4TMFNY9ntAn3CHzguSAvDNLPRoQTaK3sWbQQXdDXaE6KWRBLufGL6PJdsD2koiEe3gGmMdRK3aAw7sikGNksHJrN")
+
+// 9aE476sH92Vz7DMPyq5WLPkrKWivxeuTKEFKd2sZZcde
+var alice, _ = types.AccountFromBase58("4voSPg3tYuWbKzimpQK9EbXHmuyy5fUrtXvpLDMLkmY6TRncaTHAKGD8jUg3maB5Jbrd9CkQg4qjJMyN6sQvnEF2")
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	// to fetch recent blockhash
+	recentBlockhashResponse, err := c.GetLatestBlockhash(context.Background())
+	if err != nil {
+		log.Fatalf("failed to get recent blockhash, err: %v", err)
+	}
+
+	// create a transfer tx
+	tx, err := types.NewTransaction(types.NewTransactionParam{
+		Signers: []types.Account{feePayer, alice},
+		Message: types.NewMessage(types.NewMessageParam{
+			FeePayer:        feePayer.PublicKey,
+			RecentBlockhash: recentBlockhashResponse.Blockhash,
+			Instructions: []types.Instruction{
+				system.Transfer(system.TransferParam{
+					From:   alice.PublicKey,
+					To:     common.PublicKeyFromString("2xNweLHLqrbx4zo1waDvgWJHgsUpPj8Y8icbAFeR4a8i"),
+					Amount: 1e8, // 0.1 SOL
+				}),
+			},
+		}),
+	})
+	if err != nil {
+		log.Fatalf("failed to new a transaction, err: %v", err)
+	}
+
+	// send tx
+	txhash, err := c.SendTransaction(context.Background(), tx)
+	if err != nil {
+		log.Fatalf("failed to send tx, err: %v", err)
+	}
+
+	log.Println("txhash:", txhash)
+}
+
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

TIP

  1. fee payer and from can be different wallets but both of them need to sign the transaction
  2. a transaction can composed by many instructions so you can do something like A => B, B => C, C => A and D is the fee payer.
`,7);function p(o,e){return t}var l=n(a,[["render",p]]);export{l as default}; diff --git a/assets/upgrade-nonce.html.88791bac.js b/assets/upgrade-nonce.html.88791bac.js new file mode 100644 index 00000000..81541076 --- /dev/null +++ b/assets/upgrade-nonce.html.88791bac.js @@ -0,0 +1,109 @@ +import{_ as t,r as p,o,c as e,a as n,b as c,F as u,d as s,e as l}from"./app.01f87ec9.js";const i={},r=n("h1",{id:"upgrade-nonce",tabindex:"-1"},[n("a",{class:"header-anchor",href:"#upgrade-nonce","aria-hidden":"true"},"#"),s(" Upgrade Nonce")],-1),k=s("Due to "),b={href:"https://solana.com/news/06-01-22-solana-mainnet-beta-outage-report-2",target:"_blank",rel:"noopener noreferrer"},m=s("2022/06/01 Solana outage"),g=s(". All nonce account should be upgraded. You can update it either"),d=l(`
  1. Advance Nonce (need origin authority signature)
package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/program/system"
+	"github.com/blocto/solana-go-sdk/rpc"
+	"github.com/blocto/solana-go-sdk/types"
+)
+
+// FUarP2p5EnxD66vVDL4PWRoWMzA56ZVHG24hpEDFShEz
+var feePayer, _ = types.AccountFromBase58("4TMFNY9ntAn3CHzguSAvDNLPRoQTaK3sWbQQXdDXaE6KWRBLufGL6PJdsD2koiEe3gGmMdRK3aAw7sikGNksHJrN")
+
+// 9aE476sH92Vz7DMPyq5WLPkrKWivxeuTKEFKd2sZZcde
+var alice, _ = types.AccountFromBase58("4voSPg3tYuWbKzimpQK9EbXHmuyy5fUrtXvpLDMLkmY6TRncaTHAKGD8jUg3maB5Jbrd9CkQg4qjJMyN6sQvnEF2")
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	// get nonce account
+	nonceAccountPubkey := common.PublicKeyFromString("5Covh7EB4HtC5ieeP7GwUH9AHySMmNicBmvXo534wEA8")
+
+	// recent blockhash
+	recentBlockhashResponse, err := c.GetLatestBlockhash(context.Background())
+	if err != nil {
+		log.Fatalf("failed to get recent blockhash, err: %v", err)
+	}
+
+	// create a tx
+	tx, err := types.NewTransaction(types.NewTransactionParam{
+		Signers: []types.Account{feePayer, alice},
+		Message: types.NewMessage(types.NewMessageParam{
+			FeePayer:        feePayer.PublicKey,
+			RecentBlockhash: recentBlockhashResponse.Blockhash,
+			Instructions: []types.Instruction{
+				system.AdvanceNonceAccount(system.AdvanceNonceAccountParam{
+					Nonce: nonceAccountPubkey,
+					Auth:  alice.PublicKey,
+				}),
+			},
+		}),
+	})
+	if err != nil {
+		log.Fatalf("failed to new a transaction, err: %v", err)
+	}
+
+	sig, err := c.SendTransaction(context.Background(), tx)
+	if err != nil {
+		log.Fatalf("failed to send tx, err: %v", err)
+	}
+
+	fmt.Println("txhash", sig)
+}
+
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
  1. Upgrade Nonce (you can use a random fee payer)
package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/program/system"
+	"github.com/blocto/solana-go-sdk/rpc"
+	"github.com/blocto/solana-go-sdk/types"
+)
+
+// FUarP2p5EnxD66vVDL4PWRoWMzA56ZVHG24hpEDFShEz
+var feePayer, _ = types.AccountFromBase58("4TMFNY9ntAn3CHzguSAvDNLPRoQTaK3sWbQQXdDXaE6KWRBLufGL6PJdsD2koiEe3gGmMdRK3aAw7sikGNksHJrN")
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	nonceAccountPubkey := common.PublicKeyFromString("DJyNpXgggw1WGgjTVzFsNjb3fuQZVMqhoakvSBfX9LYx")
+
+	// recent blockhash
+	recentBlockhashResponse, err := c.GetLatestBlockhash(context.Background())
+	if err != nil {
+		log.Fatalf("failed to get recent blockhash, err: %v", err)
+	}
+
+	tx, err := types.NewTransaction(types.NewTransactionParam{
+		Signers: []types.Account{feePayer},
+		Message: types.NewMessage(types.NewMessageParam{
+			FeePayer:        feePayer.PublicKey,
+			RecentBlockhash: recentBlockhashResponse.Blockhash,
+			Instructions: []types.Instruction{
+				system.UpgradeNonceAccount(system.UpgradeNonceAccountParam{
+					NonceAccountPubkey: nonceAccountPubkey,
+				}),
+			},
+		}),
+	})
+	if err != nil {
+		log.Fatalf("failed to new a transaction, err: %v", err)
+	}
+
+	sig, err := c.SendTransaction(context.Background(), tx)
+	if err != nil {
+		log.Fatalf("failed to send tx, err: %v", err)
+	}
+
+	fmt.Println("txhash", sig)
+}
+
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
`,4);function f(h,y){const a=p("ExternalLinkIcon");return o(),e(u,null,[r,n("p",null,[k,n("a",b,[m,c(a)]),g]),d],64)}var P=t(i,[["render",f]]);export{P as default}; diff --git a/assets/upgrade-nonce.html.c7e291c7.js b/assets/upgrade-nonce.html.c7e291c7.js new file mode 100644 index 00000000..fd2673aa --- /dev/null +++ b/assets/upgrade-nonce.html.c7e291c7.js @@ -0,0 +1 @@ +const e={key:"v-068ebe3e",path:"/advanced/durable-nonce/upgrade-nonce.html",title:"Upgrade Nonce",lang:"en-US",frontmatter:{},excerpt:"",headers:[],git:{updatedTime:16553163e5,contributors:[{name:"yihau",email:"a122092487@gmail.com",commits:1}]},filePathRelative:"advanced/durable-nonce/upgrade-nonce.md"};export{e as data}; diff --git a/assets/use-nonce.html.440dd4d8.js b/assets/use-nonce.html.440dd4d8.js new file mode 100644 index 00000000..5bd2b3ac --- /dev/null +++ b/assets/use-nonce.html.440dd4d8.js @@ -0,0 +1,60 @@ +import{_ as n,e as s}from"./app.01f87ec9.js";const a={},t=s(`

Use Nonce

package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/program/memo"
+	"github.com/blocto/solana-go-sdk/program/system"
+	"github.com/blocto/solana-go-sdk/rpc"
+	"github.com/blocto/solana-go-sdk/types"
+)
+
+// FUarP2p5EnxD66vVDL4PWRoWMzA56ZVHG24hpEDFShEz
+var feePayer, _ = types.AccountFromBase58("4TMFNY9ntAn3CHzguSAvDNLPRoQTaK3sWbQQXdDXaE6KWRBLufGL6PJdsD2koiEe3gGmMdRK3aAw7sikGNksHJrN")
+
+// 9aE476sH92Vz7DMPyq5WLPkrKWivxeuTKEFKd2sZZcde
+var alice, _ = types.AccountFromBase58("4voSPg3tYuWbKzimpQK9EbXHmuyy5fUrtXvpLDMLkmY6TRncaTHAKGD8jUg3maB5Jbrd9CkQg4qjJMyN6sQvnEF2")
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	// get nonce account
+	nonceAccountPubkey := common.PublicKeyFromString("DJyNpXgggw1WGgjTVzFsNjb3fuQZVMqhoakvSBfX9LYx")
+	nonceAccount, err := c.GetNonceAccount(context.Background(), nonceAccountPubkey.ToBase58())
+	if err != nil {
+		log.Fatalf("failed to get nonce account, err: %v", err)
+	}
+
+	// create a tx
+	tx, err := types.NewTransaction(types.NewTransactionParam{
+		Signers: []types.Account{feePayer, alice},
+		Message: types.NewMessage(types.NewMessageParam{
+			FeePayer:        feePayer.PublicKey,
+			RecentBlockhash: nonceAccount.Nonce.ToBase58(),
+			Instructions: []types.Instruction{
+				system.AdvanceNonceAccount(system.AdvanceNonceAccountParam{
+					Nonce: nonceAccountPubkey,
+					Auth:  alice.PublicKey,
+				}),
+				memo.BuildMemo(memo.BuildMemoParam{
+					Memo: []byte("use nonce"),
+				}),
+			},
+		}),
+	})
+	if err != nil {
+		log.Fatalf("failed to new a transaction, err: %v", err)
+	}
+
+	sig, err := c.SendTransaction(context.Background(), tx)
+	if err != nil {
+		log.Fatalf("failed to send tx, err: %v", err)
+	}
+
+	fmt.Println("txhash", sig)
+}
+
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

TIP

You need to query nonce again after you used.

`,3);function p(o,c){return t}var u=n(a,[["render",p]]);export{u as default}; diff --git a/assets/use-nonce.html.7b82dfda.js b/assets/use-nonce.html.7b82dfda.js new file mode 100644 index 00000000..13a4c84a --- /dev/null +++ b/assets/use-nonce.html.7b82dfda.js @@ -0,0 +1 @@ +const e={key:"v-5036c796",path:"/advanced/durable-nonce/use-nonce.html",title:"Use Nonce",lang:"en-US",frontmatter:{},excerpt:"",headers:[],git:{updatedTime:1646930333e3,contributors:[{name:"yihau",email:"a122092487@gmail.com",commits:1}]},filePathRelative:"advanced/durable-nonce/use-nonce.md"};export{e as data}; diff --git a/index.html b/index.html new file mode 100644 index 00000000..3e0321f6 --- /dev/null +++ b/index.html @@ -0,0 +1,33 @@ + + + + + + + + + Solana Development With Go | Solana Development With Go + + + + + + + + diff --git a/nft/get-metadata.html b/nft/get-metadata.html new file mode 100644 index 00000000..089aa5e8 --- /dev/null +++ b/nft/get-metadata.html @@ -0,0 +1,74 @@ + + + + + + + + + Get Token Metadata | Solana Development With Go + + + + +

Get Token Metadata

package main
+
+import (
+	"context"
+	"log"
+
+	"github.com/davecgh/go-spew/spew"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/program/metaplex/token_metadata"
+	"github.com/blocto/solana-go-sdk/rpc"
+)
+
+func main() {
+	// NFT in solana is a normal mint but only mint 1.
+	// If you want to get its metadata, you need to know where it stored.
+	// and you can use `tokenmeta.GetTokenMetaPubkey` to get the metadata account key
+	// here I take a random Degenerate Ape Academy as an example
+	mint := common.PublicKeyFromString("GphF2vTuzhwhLWBWWvD8y5QLCPp1aQC5EnzrWsnbiWPx")
+	metadataAccount, err := token_metadata.GetTokenMetaPubkey(mint)
+	if err != nil {
+		log.Fatalf("faield to get metadata account, err: %v", err)
+	}
+
+	// new a client
+	c := client.NewClient(rpc.MainnetRPCEndpoint)
+
+	// get data which stored in metadataAccount
+	accountInfo, err := c.GetAccountInfo(context.Background(), metadataAccount.ToBase58())
+	if err != nil {
+		log.Fatalf("failed to get accountInfo, err: %v", err)
+	}
+
+	// parse it
+	metadata, err := token_metadata.MetadataDeserialize(accountInfo.Data)
+	if err != nil {
+		log.Fatalf("failed to parse metaAccount, err: %v", err)
+	}
+	spew.Dump(metadata)
+}
+
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
Last Updated:
Contributors: yihau
+ + + diff --git a/nft/mint-a-nft.html b/nft/mint-a-nft.html new file mode 100644 index 00000000..06f51dde --- /dev/null +++ b/nft/mint-a-nft.html @@ -0,0 +1,170 @@ + + + + + + + + + Mint A NFT | Solana Development With Go + + + + +

Mint A NFT

package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/pkg/pointer"
+	"github.com/blocto/solana-go-sdk/program/associated_token_account"
+	"github.com/blocto/solana-go-sdk/program/metaplex/token_metadata"
+	"github.com/blocto/solana-go-sdk/program/system"
+	"github.com/blocto/solana-go-sdk/program/token"
+	"github.com/blocto/solana-go-sdk/rpc"
+	"github.com/blocto/solana-go-sdk/types"
+)
+
+// FUarP2p5EnxD66vVDL4PWRoWMzA56ZVHG24hpEDFShEz
+var feePayer, _ = types.AccountFromBase58("4TMFNY9ntAn3CHzguSAvDNLPRoQTaK3sWbQQXdDXaE6KWRBLufGL6PJdsD2koiEe3gGmMdRK3aAw7sikGNksHJrN")
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	mint := types.NewAccount()
+	fmt.Printf("NFT: %v\n", mint.PublicKey.ToBase58())
+
+	collection := types.NewAccount()
+	fmt.Printf("collection: %v\n", collection.PublicKey.ToBase58())
+
+	ata, _, err := common.FindAssociatedTokenAddress(feePayer.PublicKey, mint.PublicKey)
+	if err != nil {
+		log.Fatalf("failed to find a valid ata, err: %v", err)
+	}
+
+	tokenMetadataPubkey, err := token_metadata.GetTokenMetaPubkey(mint.PublicKey)
+	if err != nil {
+		log.Fatalf("failed to find a valid token metadata, err: %v", err)
+
+	}
+	tokenMasterEditionPubkey, err := token_metadata.GetMasterEdition(mint.PublicKey)
+	if err != nil {
+		log.Fatalf("failed to find a valid master edition, err: %v", err)
+	}
+
+	mintAccountRent, err := c.GetMinimumBalanceForRentExemption(context.Background(), token.MintAccountSize)
+	if err != nil {
+		log.Fatalf("failed to get mint account rent, err: %v", err)
+	}
+
+	recentBlockhashResponse, err := c.GetLatestBlockhash(context.Background())
+	if err != nil {
+		log.Fatalf("failed to get recent blockhash, err: %v", err)
+	}
+
+	tx, err := types.NewTransaction(types.NewTransactionParam{
+		Signers: []types.Account{mint, feePayer},
+		Message: types.NewMessage(types.NewMessageParam{
+			FeePayer:        feePayer.PublicKey,
+			RecentBlockhash: recentBlockhashResponse.Blockhash,
+			Instructions: []types.Instruction{
+				system.CreateAccount(system.CreateAccountParam{
+					From:     feePayer.PublicKey,
+					New:      mint.PublicKey,
+					Owner:    common.TokenProgramID,
+					Lamports: mintAccountRent,
+					Space:    token.MintAccountSize,
+				}),
+				token.InitializeMint(token.InitializeMintParam{
+					Decimals:   0,
+					Mint:       mint.PublicKey,
+					MintAuth:   feePayer.PublicKey,
+					FreezeAuth: &feePayer.PublicKey,
+				}),
+				token_metadata.CreateMetadataAccountV3(token_metadata.CreateMetadataAccountV3Param{
+					Metadata:                tokenMetadataPubkey,
+					Mint:                    mint.PublicKey,
+					MintAuthority:           feePayer.PublicKey,
+					Payer:                   feePayer.PublicKey,
+					UpdateAuthority:         feePayer.PublicKey,
+					UpdateAuthorityIsSigner: true,
+					IsMutable:               true,
+					Data: token_metadata.DataV2{
+						Name:                 "Fake SMS #1355",
+						Symbol:               "FSMB",
+						Uri:                  "https://34c7ef24f4v2aejh75xhxy5z6ars4xv47gpsdrei6fiowptk2nqq.arweave.net/3wXyF1wvK6ARJ_9ue-O58CMuXrz5nyHEiPFQ6z5q02E",
+						SellerFeeBasisPoints: 100,
+						Creators: &[]token_metadata.Creator{
+							{
+								Address:  feePayer.PublicKey,
+								Verified: true,
+								Share:    100,
+							},
+						},
+						Collection: &token_metadata.Collection{
+							Verified: false,
+							Key:      collection.PublicKey,
+						},
+						Uses: nil,
+					},
+					CollectionDetails: nil,
+				}),
+				associated_token_account.CreateAssociatedTokenAccount(associated_token_account.CreateAssociatedTokenAccountParam{
+					Funder:                 feePayer.PublicKey,
+					Owner:                  feePayer.PublicKey,
+					Mint:                   mint.PublicKey,
+					AssociatedTokenAccount: ata,
+				}),
+				token.MintTo(token.MintToParam{
+					Mint:   mint.PublicKey,
+					To:     ata,
+					Auth:   feePayer.PublicKey,
+					Amount: 1,
+				}),
+				token_metadata.CreateMasterEditionV3(token_metadata.CreateMasterEditionParam{
+					Edition:         tokenMasterEditionPubkey,
+					Mint:            mint.PublicKey,
+					UpdateAuthority: feePayer.PublicKey,
+					MintAuthority:   feePayer.PublicKey,
+					Metadata:        tokenMetadataPubkey,
+					Payer:           feePayer.PublicKey,
+					MaxSupply:       pointer.Get[uint64](0),
+				}),
+			},
+		}),
+	})
+	if err != nil {
+		log.Fatalf("failed to new a tx, err: %v", err)
+	}
+
+	sig, err := c.SendTransaction(context.Background(), tx)
+	if err != nil {
+		log.Fatalf("failed to send tx, err: %v", err)
+	}
+
+	fmt.Println("txid:", sig)
+}
+
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
Last Updated:
Contributors: yihau
+ + + diff --git a/nft/sign-metadata.html b/nft/sign-metadata.html new file mode 100644 index 00000000..94f7e155 --- /dev/null +++ b/nft/sign-metadata.html @@ -0,0 +1,90 @@ + + + + + + + + + Sign Metadata | Solana Development With Go + + + + +

Sign Metadata

to convert a unverified creator to a verifeid creator.

package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/program/metaplex/token_metadata"
+	"github.com/blocto/solana-go-sdk/rpc"
+	"github.com/blocto/solana-go-sdk/types"
+)
+
+// FUarP2p5EnxD66vVDL4PWRoWMzA56ZVHG24hpEDFShEz
+var feePayer, _ = types.AccountFromBase58("4TMFNY9ntAn3CHzguSAvDNLPRoQTaK3sWbQQXdDXaE6KWRBLufGL6PJdsD2koiEe3gGmMdRK3aAw7sikGNksHJrN")
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	// mint address
+	nft := common.PublicKeyFromString("FK8eFRgmqewUzr7R6pYUxSPnSNusYmkhAV4e3pUJYdCd")
+
+	tokenMetadataPubkey, err := token_metadata.GetTokenMetaPubkey(nft)
+	if err != nil {
+		log.Fatalf("failed to find a valid token metadata, err: %v", err)
+	}
+
+	recentBlockhashResponse, err := c.GetLatestBlockhash(context.Background())
+	if err != nil {
+		log.Fatalf("failed to get recent blockhash, err: %v", err)
+	}
+
+	tx, err := types.NewTransaction(types.NewTransactionParam{
+		Signers: []types.Account{feePayer},
+		Message: types.NewMessage(types.NewMessageParam{
+			FeePayer:        feePayer.PublicKey,
+			RecentBlockhash: recentBlockhashResponse.Blockhash,
+			Instructions: []types.Instruction{
+				token_metadata.SignMetadata(token_metadata.SignMetadataParam{
+					Metadata: tokenMetadataPubkey,
+					Creator:  feePayer.PublicKey,
+				}),
+			},
+		}),
+	})
+	if err != nil {
+		log.Fatalf("failed to new a tx, err: %v", err)
+	}
+
+	sig, err := c.SendTransaction(context.Background(), tx)
+	if err != nil {
+		log.Fatalf("failed to send tx, err: %v", err)
+	}
+
+	fmt.Println(sig)
+}
+
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
Last Updated:
Contributors: yihau
+ + + diff --git a/programs/101/accounts.html b/programs/101/accounts.html new file mode 100644 index 00000000..c4b9c1ea --- /dev/null +++ b/programs/101/accounts.html @@ -0,0 +1,147 @@ + + + + + + + + + Accounts | Solana Development With Go + + + + +

Accounts

client

// an account meta list indicates which accounts will be used in a program.
+// we can only read/write accounts in progarms via this list.
+// (except some official vars)
+
+// an account meta includs
+//   - isSigner
+//     when an account is a signer. it needs to sign the tx.
+//   - isWritable
+//     when an account is writable. its data can be modified in this tx.
+
+package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/rpc"
+	"github.com/blocto/solana-go-sdk/types"
+)
+
+// FUarP2p5EnxD66vVDL4PWRoWMzA56ZVHG24hpEDFShEz
+var feePayer, _ = types.AccountFromBase58("4TMFNY9ntAn3CHzguSAvDNLPRoQTaK3sWbQQXdDXaE6KWRBLufGL6PJdsD2koiEe3gGmMdRK3aAw7sikGNksHJrN")
+
+var programId = common.PublicKeyFromString("CDKLz6tftV4kSD8sPVBD6ACqZpDY4Zuxf8rgSEYzR4M2")
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	res, err := c.GetLatestBlockhash(context.Background())
+	if err != nil {
+		log.Fatalf("failed to get latest blockhash, err: %v\n", err)
+	}
+
+	firstAccount := types.NewAccount()
+	fmt.Printf("first account: %v\n", firstAccount.PublicKey)
+
+	secondAccount := types.NewAccount()
+	fmt.Printf("second account: %v\n", secondAccount.PublicKey)
+
+	tx, err := types.NewTransaction(types.NewTransactionParam{
+		Signers: []types.Account{feePayer, firstAccount},
+		Message: types.NewMessage(types.NewMessageParam{
+			FeePayer:        feePayer.PublicKey,
+			RecentBlockhash: res.Blockhash,
+			Instructions: []types.Instruction{
+				{
+					ProgramID: programId,
+					Accounts: []types.AccountMeta{
+						{
+							PubKey:     firstAccount.PublicKey,
+							IsSigner:   true,
+							IsWritable: false,
+						},
+						{
+							PubKey:     secondAccount.PublicKey,
+							IsSigner:   false,
+							IsWritable: true,
+						},
+					},
+					Data: []byte{},
+				},
+			},
+		}),
+	})
+	if err != nil {
+		log.Fatalf("failed to new a tx, err: %v", err)
+	}
+
+	sig, err := c.SendTransaction(context.Background(), tx)
+	if err != nil {
+		log.Fatalf("failed to send the tx, err: %v", err)
+	}
+
+	// 4jYHKXhZMoDL3HsRuYhFPhCiQJhtNjDzPv8FhSnH6cMi9mwBjgW649uoqvfBjpGbkdFB53NEUux6oq3GUV8e9YQA
+	fmt.Println(sig)
+}
+
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

program

use solana_program::{
+    account_info::{next_account_info, AccountInfo},
+    entrypoint,
+    entrypoint::ProgramResult,
+    msg,
+    pubkey::Pubkey,
+};
+
+entrypoint!(process_instruction);
+
+fn process_instruction(
+    _program_id: &Pubkey,
+    accounts: &[AccountInfo],
+    _instruction_data: &[u8],
+) -> ProgramResult {
+    let account_info_iter = &mut accounts.iter();
+
+    let first_account_info = next_account_info(account_info_iter)?;
+    msg!(&format!(
+        "first: {} isSigner: {}, isWritable: {}",
+        first_account_info.key.to_string(),
+        first_account_info.is_signer,
+        first_account_info.is_writable,
+    ));
+
+    let second_account_info = next_account_info(account_info_iter)?;
+    msg!(&format!(
+        "second: {} isSigner: {}, isWritable: {}",
+        second_account_info.key.to_string(),
+        second_account_info.is_signer,
+        second_account_info.is_writable,
+    ));
+
+    Ok(())
+}
+
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
Last Updated:
Contributors: Yihau Chen
+ + + diff --git a/programs/101/data.html b/programs/101/data.html new file mode 100644 index 00000000..ef0d8ffa --- /dev/null +++ b/programs/101/data.html @@ -0,0 +1,153 @@ + + + + + + + + + Data | Solana Development With Go + + + + +

Data

client

// data is the most powerful part in an instruction
+// we can pack everything into data, like number, pubkey ... whatever you want.
+// we need to make them become a u8 array when we try to pack it in to a tx.
+
+package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/rpc"
+	"github.com/blocto/solana-go-sdk/types"
+)
+
+// FUarP2p5EnxD66vVDL4PWRoWMzA56ZVHG24hpEDFShEz
+var feePayer, _ = types.AccountFromBase58("4TMFNY9ntAn3CHzguSAvDNLPRoQTaK3sWbQQXdDXaE6KWRBLufGL6PJdsD2koiEe3gGmMdRK3aAw7sikGNksHJrN")
+
+var programId = common.PublicKeyFromString("c6vyXkJqgA85rYnLiMqxXd39fusJWbRJkoF3jXTd96H")
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	res, err := c.GetLatestBlockhash(context.Background())
+	if err != nil {
+		log.Fatalf("failed to get latest blockhash, err: %v\n", err)
+	}
+
+	// (our example prgoram will parse the first byte as the selector then print remaining data.)
+	{
+		tx, err := types.NewTransaction(types.NewTransactionParam{
+			Signers: []types.Account{feePayer},
+			Message: types.NewMessage(types.NewMessageParam{
+				FeePayer:        feePayer.PublicKey,
+				RecentBlockhash: res.Blockhash,
+				Instructions: []types.Instruction{
+					{
+						ProgramID: programId,
+						Accounts:  []types.AccountMeta{},
+						Data:      []byte{0, 1, 2, 3, 4},
+					},
+				},
+			}),
+		})
+		if err != nil {
+			log.Fatalf("failed to new a tx, err: %v", err)
+		}
+
+		sig, err := c.SendTransaction(context.Background(), tx)
+		if err != nil {
+			log.Fatalf("failed to send the tx, err: %v", err)
+		}
+
+		// 5X3qhwXJcjSZ3KqY8cTs5YbswBTS7yyqnfTn2diGwGERPrMNUjh9efc6Y9ABanfDUzaQN1n6BHHyMRjDJk2tfy1i
+		fmt.Println(sig)
+	}
+
+	{
+		tx, err := types.NewTransaction(types.NewTransactionParam{
+			Signers: []types.Account{feePayer},
+			Message: types.NewMessage(types.NewMessageParam{
+				FeePayer:        feePayer.PublicKey,
+				RecentBlockhash: res.Blockhash,
+				Instructions: []types.Instruction{
+					{
+						ProgramID: programId,
+						Accounts:  []types.AccountMeta{},
+						Data:      []byte{1, 5, 6, 7, 8},
+					},
+				},
+			}),
+		})
+		if err != nil {
+			log.Fatalf("failed to new a tx, err: %v", err)
+		}
+
+		sig, err := c.SendTransaction(context.Background(), tx)
+		if err != nil {
+			log.Fatalf("failed to send the tx, err: %v", err)
+		}
+
+		// 5GETq1uLwMGdmsAH79pPByzGxQxXS1LqZ6Y9T6dBQ5qiMHFo5EgwDAHccFVEcc9hTYyj5zGfLX6j1uSz5NX7HZ8Q
+		fmt.Println(sig)
+	}
+}
+
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

program

use solana_program::{
+    account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, msg,
+    program_error::ProgramError, pubkey::Pubkey,
+};
+
+entrypoint!(process_instruction);
+
+fn process_instruction(
+    _program_id: &Pubkey,
+    _accounts: &[AccountInfo],
+    instruction_data: &[u8],
+) -> ProgramResult {
+    let (selector, rest) = instruction_data
+        .split_first()
+        .ok_or(ProgramError::InvalidInstructionData)?;
+
+    match selector {
+        0 => msg!(&format!(
+            "first instruction is called. remaining data: {:?}",
+            rest,
+        )),
+        1 => msg!(&format!(
+            "second instruction is called. remaining data: {:?}",
+            rest,
+        )),
+        _ => {
+            msg!("invalid called");
+            return Err(ProgramError::InvalidInstructionData);
+        }
+    }
+
+    Ok(())
+}
+
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
Last Updated:
Contributors: Yihau Chen
+ + + diff --git a/programs/101/hello.html b/programs/101/hello.html new file mode 100644 index 00000000..1eef61c0 --- /dev/null +++ b/programs/101/hello.html @@ -0,0 +1,110 @@ + + + + + + + + + Hello | Solana Development With Go + + + + +

Hello

client

// an instruction is the smallest unit in a tx.
+// each instruction represent an action with a program.
+// there are three basic fields in an instruction:
+//   - program id
+//     the program which you would like to interact with
+//   - account meta list
+//     accounts which are used in the program
+//   - data
+//     a u8 array.
+
+package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/rpc"
+	"github.com/blocto/solana-go-sdk/types"
+)
+
+// FUarP2p5EnxD66vVDL4PWRoWMzA56ZVHG24hpEDFShEz
+var feePayer, _ = types.AccountFromBase58("4TMFNY9ntAn3CHzguSAvDNLPRoQTaK3sWbQQXdDXaE6KWRBLufGL6PJdsD2koiEe3gGmMdRK3aAw7sikGNksHJrN")
+
+var programId = common.PublicKeyFromString("EGz5CDh7dG7BwzqL7y5ePpZNvrw7ehr4E4oGRhCCpiEK")
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	res, err := c.GetLatestBlockhash(context.Background())
+	if err != nil {
+		log.Fatalf("failed to get latest blockhash, err: %v\n", err)
+	}
+
+	// our first program won't use any accounts and parse any data. we leave them empty atm.
+	tx, err := types.NewTransaction(types.NewTransactionParam{
+		Signers: []types.Account{feePayer},
+		Message: types.NewMessage(types.NewMessageParam{
+			FeePayer:        feePayer.PublicKey,
+			RecentBlockhash: res.Blockhash,
+			Instructions: []types.Instruction{
+				{
+					ProgramID: programId,
+					Accounts:  []types.AccountMeta{},
+					Data:      []byte{},
+				},
+			},
+		}),
+	})
+	if err != nil {
+		log.Fatalf("failed to new a tx, err: %v", err)
+	}
+
+	sig, err := c.SendTransaction(context.Background(), tx)
+	if err != nil {
+		log.Fatalf("failed to send the tx, err: %v", err)
+	}
+
+	// 5eCfcdKGzn8yLGfgX6V1AfjAavTQRGQ936Zyuqejf9W1tTsjABjHTrc66nv5g9qKStmRPr3FeCVznADuCnJ8Zfbq
+	fmt.Println(sig)
+}
+
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

program

use solana_program::{
+    account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, msg, pubkey::Pubkey,
+};
+
+entrypoint!(process_instruction);
+
+fn process_instruction(
+    _program_id: &Pubkey,
+    _accounts: &[AccountInfo],
+    _instruction_data: &[u8],
+) -> ProgramResult {
+    msg!("hello");
+    Ok(())
+}
+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Last Updated:
Contributors: Yihau Chen
+ + + diff --git a/rpc/get-signatures-for-address.html b/rpc/get-signatures-for-address.html new file mode 100644 index 00000000..b2ae5cda --- /dev/null +++ b/rpc/get-signatures-for-address.html @@ -0,0 +1,185 @@ + + + + + + + + + Get Signatures For Address | Solana Development With Go + + + + +

Get Signatures For Address

Fetch tx histroy.

All

	// get all (limit is between 1 ~ 1,000, default is 1,000)
+	{
+		res, err := c.GetSignaturesForAddress(context.Background(), target)
+		if err != nil {
+			log.Fatalf("failed to GetSignaturesForAddress, err: %v", err)
+		}
+		spew.Dump(res)
+	}
+
1
2
3
4
5
6
7
8

Limit

	// get latest X tx
+	{
+		res, err := c.GetSignaturesForAddressWithConfig(
+			context.Background(),
+			target,
+			rpc.GetSignaturesForAddressConfig{
+				Limit: 5,
+			},
+		)
+		if err != nil {
+			log.Fatalf("failed to GetSignaturesForAddress, err: %v", err)
+		}
+		spew.Dump(res)
+	}
+
1
2
3
4
5
6
7
8
9
10
11
12
13
14

Range

context:

	/*
+		if a txhash list like:
+
+		(new)
+		3gwJwVorVprqZmm1ULAp9bKQy6sQ7skG11XYdMSQigA936MBANcSBy6NcNJF2yPf9ycgzZ6vFd4pjAY7qSko61Au
+		wTEnw3vpBthzLUD6gv9B3aC4dQNp4hews85ipM3w9MGZAh38HZ2im9LaWY7aRusVN5Wj33mNvqSRDNyC43u6GQs
+		3e6dRv5KnvpU43VjVjbsubvPR1yFK9b922WcTugyTBSdWdToeCK16NccSaxY6XJ5yi51UswP3ZDe3VJBZTVg2MCW
+		2nYnHvbVuwmYeara3VjoCt9uS8ZXrSra5DRK7QBT8i5acoBiSK3FQY2vsaDSJQ6QX5i1pkvyRRjL1oUATMLZEsqy
+		2uFaNDgQWZsgZvR6s3WQKwaCxFgS4ML7xrZyAqgmuTSEuGmrWyCcTrjtajr6baYR6FaVLZ4PWgyt55EmTcT8S7Sg
+		4XGVHHpLW99AUFEd6RivasG57vqu4EMMNdcQdmphepmW484dMYtWLkYw4nSNnSpKiDoYDbSu9ksxECNKBk2JEyHQ
+		3kjLJokcYqAhQjERCVutv5gdUuQ1HsxSCcFsJdQbqNkqd5ML8WRaZJguZgpWH8isCfyEN8YktxxPPNJURhAtvUKE
+		(old)
+	*/
+
1
2
3
4
5
6
7
8
9
10
11
12
13

Before

	// you can fetch the last 3 tx by
+	{
+		res, err := c.GetSignaturesForAddressWithConfig(
+			context.Background(),
+			target,
+			rpc.GetSignaturesForAddressConfig{
+				Before: "2nYnHvbVuwmYeara3VjoCt9uS8ZXrSra5DRK7QBT8i5acoBiSK3FQY2vsaDSJQ6QX5i1pkvyRRjL1oUATMLZEsqy",
+				Limit:  3,
+			},
+		)
+		if err != nil {
+			log.Fatalf("failed to GetSignaturesForAddress, err: %v", err)
+		}
+		spew.Dump(res)
+	}
+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

Until

	// you can fetch the latest 3 tx by `until`
+	// * the result will be different if there are some newer txs added.
+	{
+		res, err := c.GetSignaturesForAddressWithConfig(
+			context.Background(),
+			target,
+			rpc.GetSignaturesForAddressConfig{
+				Until: "2nYnHvbVuwmYeara3VjoCt9uS8ZXrSra5DRK7QBT8i5acoBiSK3FQY2vsaDSJQ6QX5i1pkvyRRjL1oUATMLZEsqy",
+				Limit: 3,
+			},
+		)
+		if err != nil {
+			log.Fatalf("failed to GetSignaturesForAddress, err: %v", err)
+		}
+		spew.Dump(res)
+	}
+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

Full Code

package main
+
+import (
+	"context"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/rpc"
+	"github.com/davecgh/go-spew/spew"
+)
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+	target := "Memo1UhkJRfHyvLMcVucJwxXeuD728EqVDDwQDxFMNo"
+
+	// get all (limit is between 1 ~ 1,000, default is 1,000)
+	{
+		res, err := c.GetSignaturesForAddress(context.Background(), target)
+		if err != nil {
+			log.Fatalf("failed to GetSignaturesForAddress, err: %v", err)
+		}
+		spew.Dump(res)
+	}
+
+	// get latest X tx
+	{
+		res, err := c.GetSignaturesForAddressWithConfig(
+			context.Background(),
+			target,
+			rpc.GetSignaturesForAddressConfig{
+				Limit: 5,
+			},
+		)
+		if err != nil {
+			log.Fatalf("failed to GetSignaturesForAddress, err: %v", err)
+		}
+		spew.Dump(res)
+	}
+
+	/*
+		if a txhash list like:
+
+		(new)
+		3gwJwVorVprqZmm1ULAp9bKQy6sQ7skG11XYdMSQigA936MBANcSBy6NcNJF2yPf9ycgzZ6vFd4pjAY7qSko61Au
+		wTEnw3vpBthzLUD6gv9B3aC4dQNp4hews85ipM3w9MGZAh38HZ2im9LaWY7aRusVN5Wj33mNvqSRDNyC43u6GQs
+		3e6dRv5KnvpU43VjVjbsubvPR1yFK9b922WcTugyTBSdWdToeCK16NccSaxY6XJ5yi51UswP3ZDe3VJBZTVg2MCW
+		2nYnHvbVuwmYeara3VjoCt9uS8ZXrSra5DRK7QBT8i5acoBiSK3FQY2vsaDSJQ6QX5i1pkvyRRjL1oUATMLZEsqy
+		2uFaNDgQWZsgZvR6s3WQKwaCxFgS4ML7xrZyAqgmuTSEuGmrWyCcTrjtajr6baYR6FaVLZ4PWgyt55EmTcT8S7Sg
+		4XGVHHpLW99AUFEd6RivasG57vqu4EMMNdcQdmphepmW484dMYtWLkYw4nSNnSpKiDoYDbSu9ksxECNKBk2JEyHQ
+		3kjLJokcYqAhQjERCVutv5gdUuQ1HsxSCcFsJdQbqNkqd5ML8WRaZJguZgpWH8isCfyEN8YktxxPPNJURhAtvUKE
+		(old)
+	*/
+
+	// you can fetch the last 3 tx by
+	{
+		res, err := c.GetSignaturesForAddressWithConfig(
+			context.Background(),
+			target,
+			rpc.GetSignaturesForAddressConfig{
+				Before: "2nYnHvbVuwmYeara3VjoCt9uS8ZXrSra5DRK7QBT8i5acoBiSK3FQY2vsaDSJQ6QX5i1pkvyRRjL1oUATMLZEsqy",
+				Limit:  3,
+			},
+		)
+		if err != nil {
+			log.Fatalf("failed to GetSignaturesForAddress, err: %v", err)
+		}
+		spew.Dump(res)
+	}
+
+	// you can fetch the latest 3 tx by `until`
+	// * the result will be different if there are some newer txs added.
+	{
+		res, err := c.GetSignaturesForAddressWithConfig(
+			context.Background(),
+			target,
+			rpc.GetSignaturesForAddressConfig{
+				Until: "2nYnHvbVuwmYeara3VjoCt9uS8ZXrSra5DRK7QBT8i5acoBiSK3FQY2vsaDSJQ6QX5i1pkvyRRjL1oUATMLZEsqy",
+				Limit: 3,
+			},
+		)
+		if err != nil {
+			log.Fatalf("failed to GetSignaturesForAddress, err: %v", err)
+		}
+		spew.Dump(res)
+	}
+}
+
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
Last Updated:
Contributors: Yihau Chen
+ + + diff --git a/tour/create-account.html b/tour/create-account.html new file mode 100644 index 00000000..d5d8a9a5 --- /dev/null +++ b/tour/create-account.html @@ -0,0 +1,129 @@ + + + + + + + + + Create Account | Solana Development With Go + + + + +

Create Account

An account is a basic identity on chain.

Create a new account

		account := types.NewAccount()
+
1

Recover from a key

Base58

		account, _ := types.AccountFromBase58("28WJTTqMuurAfz6yqeTrFMXeFd91uzi9i1AW6F5KyHQDS9siXb8TquAuatvLuCEYdggyeiNKLAUr3w7Czmmf2Rav")
+
1

Bytes

		account, _ := types.AccountFromBytes([]byte{
+			56, 125, 59, 118, 230, 173, 152, 169, 197, 34,
+			168, 187, 217, 160, 119, 204, 124, 69, 52, 136,
+			214, 49, 207, 234, 79, 70, 83, 224, 1, 224, 36,
+			247, 131, 83, 164, 85, 139, 215, 183, 148, 79,
+			198, 74, 93, 156, 157, 208, 99, 221, 127, 51,
+			156, 43, 196, 101, 144, 104, 252, 221, 108,
+			245, 104, 13, 151,
+		})
+
1
2
3
4
5
6
7
8
9

BIP 39

		mnemonic := "pill tomorrow foster begin walnut borrow virtual kick shift mutual shoe scatter"
+		seed := bip39.NewSeed(mnemonic, "") // (mnemonic, password)
+		account, _ := types.AccountFromSeed(seed[:32])
+
1
2
3

BIP 44

		mnemonic := "neither lonely flavor argue grass remind eye tag avocado spot unusual intact"
+		seed := bip39.NewSeed(mnemonic, "") // (mnemonic, password)
+		path := `m/44'/501'/0'/0'`
+		derivedKey, _ := hdwallet.Derived(path, seed)
+		account, _ := types.AccountFromSeed(derivedKey.PrivateKey)
+
1
2
3
4
5

Full Code

package main
+
+import (
+	"fmt"
+
+	"github.com/blocto/solana-go-sdk/pkg/hdwallet"
+	"github.com/blocto/solana-go-sdk/types"
+	"github.com/mr-tron/base58"
+	"github.com/tyler-smith/go-bip39"
+)
+
+func main() {
+	// create a new account
+	{
+		account := types.NewAccount()
+		fmt.Println(account.PublicKey.ToBase58())
+		fmt.Println(base58.Encode(account.PrivateKey))
+	}
+
+	// from a base58 pirvate key
+	{
+		account, _ := types.AccountFromBase58("28WJTTqMuurAfz6yqeTrFMXeFd91uzi9i1AW6F5KyHQDS9siXb8TquAuatvLuCEYdggyeiNKLAUr3w7Czmmf2Rav")
+		fmt.Println(account.PublicKey.ToBase58())
+	}
+
+	// from a private key bytes
+	{
+		account, _ := types.AccountFromBytes([]byte{
+			56, 125, 59, 118, 230, 173, 152, 169, 197, 34,
+			168, 187, 217, 160, 119, 204, 124, 69, 52, 136,
+			214, 49, 207, 234, 79, 70, 83, 224, 1, 224, 36,
+			247, 131, 83, 164, 85, 139, 215, 183, 148, 79,
+			198, 74, 93, 156, 157, 208, 99, 221, 127, 51,
+			156, 43, 196, 101, 144, 104, 252, 221, 108,
+			245, 104, 13, 151,
+		})
+		fmt.Println(account.PublicKey.ToBase58())
+	}
+
+	// from bip 39 (solana cli tool)
+	{
+		mnemonic := "pill tomorrow foster begin walnut borrow virtual kick shift mutual shoe scatter"
+		seed := bip39.NewSeed(mnemonic, "") // (mnemonic, password)
+		account, _ := types.AccountFromSeed(seed[:32])
+		fmt.Println(account.PublicKey.ToBase58())
+	}
+
+	// from bip 44 (phantom)
+	{
+		mnemonic := "neither lonely flavor argue grass remind eye tag avocado spot unusual intact"
+		seed := bip39.NewSeed(mnemonic, "") // (mnemonic, password)
+		path := `m/44'/501'/0'/0'`
+		derivedKey, _ := hdwallet.Derived(path, seed)
+		account, _ := types.AccountFromSeed(derivedKey.PrivateKey)
+		fmt.Printf("%v => %v\n", path, account.PublicKey.ToBase58())
+
+		// others
+		for i := 1; i < 10; i++ {
+			path := fmt.Sprintf(`m/44'/501'/%d'/0'`, i)
+			derivedKey, _ := hdwallet.Derived(path, seed)
+			account, _ := types.AccountFromSeed(derivedKey.PrivateKey)
+			fmt.Printf("%v => %v\n", path, account.PublicKey.ToBase58())
+		}
+		/*
+			m/44'/501'/0'/0' => 5vftMkHL72JaJG6ExQfGAsT2uGVHpRR7oTNUPMs68Y2N
+			m/44'/501'/1'/0' => GcXbfQ5yY3uxCyBNDPBbR5FjumHf89E7YHXuULfGDBBv
+			m/44'/501'/2'/0' => 7QPgyQwNLqnoSwHEuK8wKy2Y3Ani6EHoZRihTuWkwxbc
+			m/44'/501'/3'/0' => 5aE8UprEEWtpVskhxo3f8ETco2kVKiZT9SS3D5Lcg8s2
+			m/44'/501'/4'/0' => 5n6afo6LZmzH1J4R38ZCaNSwaztLjd48nWwToLQkCHxp
+			m/44'/501'/5'/0' => 2Gr1hWnbaqGXMghicSTHncqV7GVLLddNFJDC7YJoso8M
+			m/44'/501'/6'/0' => BNMDY3tCyYbayMzBjZm8RW59unpDWcQRfVmWXCJhLb7D
+			m/44'/501'/7'/0' => 9CySTpi4iC85gMW6G4BMoYbNBsdyJrfseHoGmViLha63
+			m/44'/501'/8'/0' => ApteF7PmUWS8Lzm6tJPkWgrxSFW5LwYGWCUJ2ByAec91
+			m/44'/501'/9'/0' => 6frdqXQAgJMyKwmZxkLYbdGjnYTvUceh6LNhkQt2siQp
+		*/
+	}
+}
+
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
Last Updated:
Contributors: yihau
+ + + diff --git a/tour/create-mint.html b/tour/create-mint.html new file mode 100644 index 00000000..288694f7 --- /dev/null +++ b/tour/create-mint.html @@ -0,0 +1,108 @@ + + + + + + + + + Create Mint | Solana Development With Go + + + + +

Create Mint

create a new token

package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/program/system"
+	"github.com/blocto/solana-go-sdk/program/token"
+	"github.com/blocto/solana-go-sdk/rpc"
+	"github.com/blocto/solana-go-sdk/types"
+)
+
+// FUarP2p5EnxD66vVDL4PWRoWMzA56ZVHG24hpEDFShEz
+var feePayer, _ = types.AccountFromBase58("4TMFNY9ntAn3CHzguSAvDNLPRoQTaK3sWbQQXdDXaE6KWRBLufGL6PJdsD2koiEe3gGmMdRK3aAw7sikGNksHJrN")
+
+// 9aE476sH92Vz7DMPyq5WLPkrKWivxeuTKEFKd2sZZcde
+var alice, _ = types.AccountFromBase58("4voSPg3tYuWbKzimpQK9EbXHmuyy5fUrtXvpLDMLkmY6TRncaTHAKGD8jUg3maB5Jbrd9CkQg4qjJMyN6sQvnEF2")
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	// create an mint account
+	mint := types.NewAccount()
+	fmt.Println("mint:", mint.PublicKey.ToBase58())
+
+	// get rent
+	rentExemptionBalance, err := c.GetMinimumBalanceForRentExemption(
+		context.Background(),
+		token.MintAccountSize,
+	)
+	if err != nil {
+		log.Fatalf("get min balacne for rent exemption, err: %v", err)
+	}
+
+	res, err := c.GetLatestBlockhash(context.Background())
+	if err != nil {
+		log.Fatalf("get recent block hash error, err: %v\n", err)
+	}
+
+	tx, err := types.NewTransaction(types.NewTransactionParam{
+		Message: types.NewMessage(types.NewMessageParam{
+			FeePayer:        feePayer.PublicKey,
+			RecentBlockhash: res.Blockhash,
+			Instructions: []types.Instruction{
+				system.CreateAccount(system.CreateAccountParam{
+					From:     feePayer.PublicKey,
+					New:      mint.PublicKey,
+					Owner:    common.TokenProgramID,
+					Lamports: rentExemptionBalance,
+					Space:    token.MintAccountSize,
+				}),
+				token.InitializeMint(token.InitializeMintParam{
+					Decimals:   8,
+					Mint:       mint.PublicKey,
+					MintAuth:   alice.PublicKey,
+					FreezeAuth: nil,
+				}),
+			},
+		}),
+		Signers: []types.Account{feePayer, mint},
+	})
+	if err != nil {
+		log.Fatalf("generate tx error, err: %v\n", err)
+	}
+
+	txhash, err := c.SendTransaction(context.Background(), tx)
+	if err != nil {
+		log.Fatalf("send tx error, err: %v\n", err)
+	}
+
+	log.Println("txhash:", txhash)
+}
+
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
Last Updated:
Contributors: yihau
+ + + diff --git a/tour/create-token-account.html b/tour/create-token-account.html new file mode 100644 index 00000000..245466ce --- /dev/null +++ b/tour/create-token-account.html @@ -0,0 +1,166 @@ + + + + + + + + + Create Token Account | Solana Development With Go + + + + +

Create Token Account

package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/program/associated_token_account"
+	"github.com/blocto/solana-go-sdk/rpc"
+	"github.com/blocto/solana-go-sdk/types"
+)
+
+// FUarP2p5EnxD66vVDL4PWRoWMzA56ZVHG24hpEDFShEz
+var feePayer, _ = types.AccountFromBase58("4TMFNY9ntAn3CHzguSAvDNLPRoQTaK3sWbQQXdDXaE6KWRBLufGL6PJdsD2koiEe3gGmMdRK3aAw7sikGNksHJrN")
+
+// 9aE476sH92Vz7DMPyq5WLPkrKWivxeuTKEFKd2sZZcde
+var alice, _ = types.AccountFromBase58("4voSPg3tYuWbKzimpQK9EbXHmuyy5fUrtXvpLDMLkmY6TRncaTHAKGD8jUg3maB5Jbrd9CkQg4qjJMyN6sQvnEF2")
+
+var mintPubkey = common.PublicKeyFromString("F6tecPzBMF47yJ2EN6j2aGtE68yR5jehXcZYVZa6ZETo")
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	ata, _, err := common.FindAssociatedTokenAddress(alice.PublicKey, mintPubkey)
+	if err != nil {
+		log.Fatalf("find ata error, err: %v", err)
+	}
+	fmt.Println("ata:", ata.ToBase58())
+
+	res, err := c.GetLatestBlockhash(context.Background())
+	if err != nil {
+		log.Fatalf("get recent block hash error, err: %v\n", err)
+	}
+
+	tx, err := types.NewTransaction(types.NewTransactionParam{
+		Message: types.NewMessage(types.NewMessageParam{
+			FeePayer:        feePayer.PublicKey,
+			RecentBlockhash: res.Blockhash,
+			Instructions: []types.Instruction{
+				associated_token_account.Create(associated_token_account.CreateParam{
+					Funder:                 feePayer.PublicKey,
+					Owner:                  alice.PublicKey,
+					Mint:                   mintPubkey,
+					AssociatedTokenAccount: ata,
+				}),
+			},
+		}),
+		Signers: []types.Account{feePayer},
+	})
+	if err != nil {
+		log.Fatalf("generate tx error, err: %v\n", err)
+	}
+
+	txhash, err := c.SendTransaction(context.Background(), tx)
+	if err != nil {
+		log.Fatalf("send raw tx error, err: %v\n", err)
+	}
+
+	log.Println("txhash:", txhash)
+}
+
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

Random

package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/program/system"
+	"github.com/blocto/solana-go-sdk/program/token"
+	"github.com/blocto/solana-go-sdk/rpc"
+	"github.com/blocto/solana-go-sdk/types"
+)
+
+// FUarP2p5EnxD66vVDL4PWRoWMzA56ZVHG24hpEDFShEz
+var feePayer, _ = types.AccountFromBase58("4TMFNY9ntAn3CHzguSAvDNLPRoQTaK3sWbQQXdDXaE6KWRBLufGL6PJdsD2koiEe3gGmMdRK3aAw7sikGNksHJrN")
+
+// 9aE476sH92Vz7DMPyq5WLPkrKWivxeuTKEFKd2sZZcde
+var alice, _ = types.AccountFromBase58("4voSPg3tYuWbKzimpQK9EbXHmuyy5fUrtXvpLDMLkmY6TRncaTHAKGD8jUg3maB5Jbrd9CkQg4qjJMyN6sQvnEF2")
+
+var mintPubkey = common.PublicKeyFromString("F6tecPzBMF47yJ2EN6j2aGtE68yR5jehXcZYVZa6ZETo")
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	aliceRandomTokenAccount := types.NewAccount()
+	fmt.Println("alice token account:", aliceRandomTokenAccount.PublicKey.ToBase58())
+
+	rentExemptionBalance, err := c.GetMinimumBalanceForRentExemption(context.Background(), token.TokenAccountSize)
+	if err != nil {
+		log.Fatalf("get min balacne for rent exemption, err: %v", err)
+	}
+
+	res, err := c.GetLatestBlockhash(context.Background())
+	if err != nil {
+		log.Fatalf("get recent block hash error, err: %v\n", err)
+	}
+
+	tx, err := types.NewTransaction(types.NewTransactionParam{
+		Message: types.NewMessage(types.NewMessageParam{
+			FeePayer:        feePayer.PublicKey,
+			RecentBlockhash: res.Blockhash,
+			Instructions: []types.Instruction{
+				system.CreateAccount(system.CreateAccountParam{
+					From:     feePayer.PublicKey,
+					New:      aliceRandomTokenAccount.PublicKey,
+					Owner:    common.TokenProgramID,
+					Lamports: rentExemptionBalance,
+					Space:    token.TokenAccountSize,
+				}),
+				token.InitializeAccount(token.InitializeAccountParam{
+					Account: aliceRandomTokenAccount.PublicKey,
+					Mint:    mintPubkey,
+					Owner:   alice.PublicKey,
+				}),
+			},
+		}),
+		Signers: []types.Account{feePayer, aliceRandomTokenAccount},
+	})
+	if err != nil {
+		log.Fatalf("generate tx error, err: %v\n", err)
+	}
+
+	txhash, err := c.SendTransaction(context.Background(), tx)
+	if err != nil {
+		log.Fatalf("send tx error, err: %v\n", err)
+	}
+
+	log.Println("txhash:", txhash)
+}
+
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
Last Updated:
Contributors: yihau
+ + + diff --git a/tour/get-mint.html b/tour/get-mint.html new file mode 100644 index 00000000..ed67deb7 --- /dev/null +++ b/tour/get-mint.html @@ -0,0 +1,64 @@ + + + + + + + + + Get Mint | Solana Development With Go + + + + +

Get Mint

get detail from a exist mint

package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/program/token"
+	"github.com/blocto/solana-go-sdk/rpc"
+)
+
+var mintPubkey = common.PublicKeyFromString("F6tecPzBMF47yJ2EN6j2aGtE68yR5jehXcZYVZa6ZETo")
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	getAccountInfoResponse, err := c.GetAccountInfo(context.TODO(), mintPubkey.ToBase58())
+	if err != nil {
+		log.Fatalf("failed to get account info, err: %v", err)
+	}
+
+	mintAccount, err := token.MintAccountFromData(getAccountInfoResponse.Data)
+	if err != nil {
+		log.Fatalf("failed to parse data to a mint account, err: %v", err)
+	}
+
+	fmt.Printf("%+v\n", mintAccount)
+	// {MintAuthority:9aE476sH92Vz7DMPyq5WLPkrKWivxeuTKEFKd2sZZcde Supply:0 Decimals:8 IsInitialized:true FreezeAuthority:<nil>}
+}
+
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
Last Updated:
Contributors: yihau
+ + + diff --git a/tour/get-sol-balance.html b/tour/get-sol-balance.html new file mode 100644 index 00000000..05ab0a19 --- /dev/null +++ b/tour/get-sol-balance.html @@ -0,0 +1,55 @@ + + + + + + + + + Get Balance | Solana Development With Go + + + + +

Get Balance

get sol balance

package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/rpc"
+)
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+	balance, err := c.GetBalance(
+		context.TODO(),
+		"9qeP9DmjXAmKQc4wy133XZrQ3Fo4ejsYteA7X4YFJ3an",
+	)
+	if err != nil {
+		log.Fatalf("failed to request airdrop, err: %v", err)
+	}
+	fmt.Println(balance)
+}
+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

TIP

1 SOL = 10^9 lamports

Last Updated:
Contributors: yihau
+ + + diff --git a/tour/get-token-account.html b/tour/get-token-account.html new file mode 100644 index 00000000..4765ed41 --- /dev/null +++ b/tour/get-token-account.html @@ -0,0 +1,62 @@ + + + + + + + + + Get Token Account | Solana Development With Go + + + + +

Get Token Account

package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/program/token"
+	"github.com/blocto/solana-go-sdk/rpc"
+)
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	// token account address
+	getAccountInfoResponse, err := c.GetAccountInfo(context.TODO(), "HeCBh32JJ8DxcjTyc6q46tirHR8hd2xj3mGoAcQ7eduL")
+	if err != nil {
+		log.Fatalf("failed to get account info, err: %v", err)
+	}
+
+	tokenAccount, err := token.TokenAccountFromData(getAccountInfoResponse.Data)
+	if err != nil {
+		log.Fatalf("failed to parse data to a token account, err: %v", err)
+	}
+
+	fmt.Printf("%+v\n", tokenAccount)
+	// {Mint:F6tecPzBMF47yJ2EN6j2aGtE68yR5jehXcZYVZa6ZETo Owner:9aE476sH92Vz7DMPyq5WLPkrKWivxeuTKEFKd2sZZcde Amount:100000000 Delegate:<nil> State:1 IsNative:<nil> DelegatedAmount:0 CloseAuthority:<nil>}
+}
+
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
Last Updated:
Contributors: yihau
+ + + diff --git a/tour/get-token-balance.html b/tour/get-token-balance.html new file mode 100644 index 00000000..9b8ed880 --- /dev/null +++ b/tour/get-token-balance.html @@ -0,0 +1,63 @@ + + + + + + + + + Get Token Balance | Solana Development With Go + + + + +

Get Token Balance

package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/rpc"
+)
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	// should pass a token account address
+	balance, decimals, err := c.GetTokenAccountBalance(
+		context.Background(),
+		"HeCBh32JJ8DxcjTyc6q46tirHR8hd2xj3mGoAcQ7eduL",
+	)
+	if err != nil {
+		log.Fatalln("get balance error", err)
+	}
+	// the smallest unit like lamports
+	fmt.Println("balance", balance)
+	// the decimals of mint which token account holds
+	fmt.Println("decimals", decimals)
+
+	// if you want use a normal unit, you can do
+	// balance / 10^decimals
+}
+
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
Last Updated:
Contributors: yihau
+ + + diff --git a/tour/mint-to.html b/tour/mint-to.html new file mode 100644 index 00000000..46c69410 --- /dev/null +++ b/tour/mint-to.html @@ -0,0 +1,94 @@ + + + + + + + + + Mint To | Solana Development With Go + + + + +

Mint To

package main
+
+import (
+	"context"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/program/token"
+	"github.com/blocto/solana-go-sdk/rpc"
+	"github.com/blocto/solana-go-sdk/types"
+)
+
+// FUarP2p5EnxD66vVDL4PWRoWMzA56ZVHG24hpEDFShEz
+var feePayer, _ = types.AccountFromBase58("4TMFNY9ntAn3CHzguSAvDNLPRoQTaK3sWbQQXdDXaE6KWRBLufGL6PJdsD2koiEe3gGmMdRK3aAw7sikGNksHJrN")
+
+// 9aE476sH92Vz7DMPyq5WLPkrKWivxeuTKEFKd2sZZcde
+var alice, _ = types.AccountFromBase58("4voSPg3tYuWbKzimpQK9EbXHmuyy5fUrtXvpLDMLkmY6TRncaTHAKGD8jUg3maB5Jbrd9CkQg4qjJMyN6sQvnEF2")
+
+var mintPubkey = common.PublicKeyFromString("F6tecPzBMF47yJ2EN6j2aGtE68yR5jehXcZYVZa6ZETo")
+
+var aliceTokenRandomTokenPubkey = common.PublicKeyFromString("HeCBh32JJ8DxcjTyc6q46tirHR8hd2xj3mGoAcQ7eduL")
+
+var aliceTokenATAPubkey = common.PublicKeyFromString("J1T6kAPowNFcxFh4pmwSqxQM9AitN7HwLyvxV2ZGfLf2")
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	res, err := c.GetLatestBlockhash(context.Background())
+	if err != nil {
+		log.Fatalf("get recent block hash error, err: %v\n", err)
+	}
+
+	tx, err := types.NewTransaction(types.NewTransactionParam{
+		Message: types.NewMessage(types.NewMessageParam{
+			FeePayer:        feePayer.PublicKey,
+			RecentBlockhash: res.Blockhash,
+			Instructions: []types.Instruction{
+				token.MintToChecked(token.MintToCheckedParam{
+					Mint:     mintPubkey,
+					Auth:     alice.PublicKey,
+					Signers:  []common.PublicKey{},
+					To:       aliceTokenRandomTokenPubkey,
+					Amount:   1e8,
+					Decimals: 8,
+				}),
+			},
+		}),
+		Signers: []types.Account{feePayer, alice},
+	})
+	if err != nil {
+		log.Fatalf("generate tx error, err: %v\n", err)
+	}
+
+	txhash, err := c.SendTransaction(context.Background(), tx)
+	if err != nil {
+		log.Fatalf("send raw tx error, err: %v\n", err)
+	}
+
+	log.Println("txhash:", txhash)
+}
+
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
Last Updated:
Contributors: yihau
+ + + diff --git a/tour/request-airdrop.html b/tour/request-airdrop.html new file mode 100644 index 00000000..5dd996b4 --- /dev/null +++ b/tour/request-airdrop.html @@ -0,0 +1,56 @@ + + + + + + + + + Request Airdrop | Solana Development With Go + + + + +

Request Airdrop

Request some airdrop for testing.

package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/rpc"
+)
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+	sig, err := c.RequestAirdrop(
+		context.TODO(),
+		"9qeP9DmjXAmKQc4wy133XZrQ3Fo4ejsYteA7X4YFJ3an", // address
+		1e9, // lamports (1 SOL = 10^9 lamports)
+	)
+	if err != nil {
+		log.Fatalf("failed to request airdrop, err: %v", err)
+	}
+	fmt.Println(sig)
+}
+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Last Updated:
Contributors: yihau
+ + + diff --git a/tour/token-transfer.html b/tour/token-transfer.html new file mode 100644 index 00000000..c23b24f6 --- /dev/null +++ b/tour/token-transfer.html @@ -0,0 +1,95 @@ + + + + + + + + + Token Transfer | Solana Development With Go + + + + +

Token Transfer

package main
+
+import (
+	"context"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/program/token"
+	"github.com/blocto/solana-go-sdk/rpc"
+	"github.com/blocto/solana-go-sdk/types"
+)
+
+// FUarP2p5EnxD66vVDL4PWRoWMzA56ZVHG24hpEDFShEz
+var feePayer, _ = types.AccountFromBase58("4TMFNY9ntAn3CHzguSAvDNLPRoQTaK3sWbQQXdDXaE6KWRBLufGL6PJdsD2koiEe3gGmMdRK3aAw7sikGNksHJrN")
+
+// 9aE476sH92Vz7DMPyq5WLPkrKWivxeuTKEFKd2sZZcde
+var alice, _ = types.AccountFromBase58("4voSPg3tYuWbKzimpQK9EbXHmuyy5fUrtXvpLDMLkmY6TRncaTHAKGD8jUg3maB5Jbrd9CkQg4qjJMyN6sQvnEF2")
+
+var mintPubkey = common.PublicKeyFromString("F6tecPzBMF47yJ2EN6j2aGtE68yR5jehXcZYVZa6ZETo")
+
+var aliceTokenRandomTokenPubkey = common.PublicKeyFromString("HeCBh32JJ8DxcjTyc6q46tirHR8hd2xj3mGoAcQ7eduL")
+
+var aliceTokenATAPubkey = common.PublicKeyFromString("J1T6kAPowNFcxFh4pmwSqxQM9AitN7HwLyvxV2ZGfLf2")
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	res, err := c.GetLatestBlockhash(context.Background())
+	if err != nil {
+		log.Fatalf("get recent block hash error, err: %v\n", err)
+	}
+
+	tx, err := types.NewTransaction(types.NewTransactionParam{
+		Message: types.NewMessage(types.NewMessageParam{
+			FeePayer:        feePayer.PublicKey,
+			RecentBlockhash: res.Blockhash,
+			Instructions: []types.Instruction{
+				token.TransferChecked(token.TransferCheckedParam{
+					From:     aliceTokenRandomTokenPubkey,
+					To:       aliceTokenATAPubkey,
+					Mint:     mintPubkey,
+					Auth:     alice.PublicKey,
+					Signers:  []common.PublicKey{},
+					Amount:   1e8,
+					Decimals: 8,
+				}),
+			},
+		}),
+		Signers: []types.Account{feePayer, alice},
+	})
+	if err != nil {
+		log.Fatalf("failed to new tx, err: %v", err)
+	}
+
+	txhash, err := c.SendTransaction(context.Background(), tx)
+	if err != nil {
+		log.Fatalf("send raw tx error, err: %v\n", err)
+	}
+
+	log.Println("txhash:", txhash)
+}
+
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
Last Updated:
Contributors: yihau
+ + + diff --git a/tour/transfer.html b/tour/transfer.html new file mode 100644 index 00000000..d532e84f --- /dev/null +++ b/tour/transfer.html @@ -0,0 +1,88 @@ + + + + + + + + + Transfer | Solana Development With Go + + + + +

Transfer

We will build a transaction to transfer our SOL out.

A quick guide for a transaction is that:

  1. a transactions is composed by some signatures + a message
  2. a message is composed by one or more instructions + a blockhash

Full Code

package main
+
+import (
+	"context"
+	"log"
+
+	"github.com/blocto/solana-go-sdk/client"
+	"github.com/blocto/solana-go-sdk/common"
+	"github.com/blocto/solana-go-sdk/program/system"
+	"github.com/blocto/solana-go-sdk/rpc"
+	"github.com/blocto/solana-go-sdk/types"
+)
+
+// FUarP2p5EnxD66vVDL4PWRoWMzA56ZVHG24hpEDFShEz
+var feePayer, _ = types.AccountFromBase58("4TMFNY9ntAn3CHzguSAvDNLPRoQTaK3sWbQQXdDXaE6KWRBLufGL6PJdsD2koiEe3gGmMdRK3aAw7sikGNksHJrN")
+
+// 9aE476sH92Vz7DMPyq5WLPkrKWivxeuTKEFKd2sZZcde
+var alice, _ = types.AccountFromBase58("4voSPg3tYuWbKzimpQK9EbXHmuyy5fUrtXvpLDMLkmY6TRncaTHAKGD8jUg3maB5Jbrd9CkQg4qjJMyN6sQvnEF2")
+
+func main() {
+	c := client.NewClient(rpc.DevnetRPCEndpoint)
+
+	// to fetch recent blockhash
+	recentBlockhashResponse, err := c.GetLatestBlockhash(context.Background())
+	if err != nil {
+		log.Fatalf("failed to get recent blockhash, err: %v", err)
+	}
+
+	// create a transfer tx
+	tx, err := types.NewTransaction(types.NewTransactionParam{
+		Signers: []types.Account{feePayer, alice},
+		Message: types.NewMessage(types.NewMessageParam{
+			FeePayer:        feePayer.PublicKey,
+			RecentBlockhash: recentBlockhashResponse.Blockhash,
+			Instructions: []types.Instruction{
+				system.Transfer(system.TransferParam{
+					From:   alice.PublicKey,
+					To:     common.PublicKeyFromString("2xNweLHLqrbx4zo1waDvgWJHgsUpPj8Y8icbAFeR4a8i"),
+					Amount: 1e8, // 0.1 SOL
+				}),
+			},
+		}),
+	})
+	if err != nil {
+		log.Fatalf("failed to new a transaction, err: %v", err)
+	}
+
+	// send tx
+	txhash, err := c.SendTransaction(context.Background(), tx)
+	if err != nil {
+		log.Fatalf("failed to send tx, err: %v", err)
+	}
+
+	log.Println("txhash:", txhash)
+}
+
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

TIP

  1. fee payer and from can be different wallets but both of them need to sign the transaction
  2. a transaction can composed by many instructions so you can do something like A => B, B => C, C => A and D is the fee payer.
Last Updated:
Contributors: yihau
+ + +