-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGetSomeMXC.go
More file actions
88 lines (73 loc) · 2.38 KB
/
GetSomeMXC.go
File metadata and controls
88 lines (73 loc) · 2.38 KB
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
package main
import (
"fmt"
"stellarTools/getFromKyeboard"
"stellarTools/gettingAccountDetails"
"github.com/stellar/go/build"
"github.com/stellar/go/clients/horizon"
"github.com/stellar/go/network"
)
var distributorPri = "SD64I4OCIUPT6UONUCOT7WVIVOVQNFJI6FLO2NIO5CUDBPXQMUUZSDJA"
var distributorPub = "GDZPSKJSFLW4HF77OJFYB3ANCG3CF2PHUZ3YRG5PHPTNF7ZLYGNV7EPV"
func main() {
fmt.Println("Please enter your PublicKey: ")
publicKey := getFromKyeboard.FromKeyboard()
//buildingTransaction.SendMXC(publicKey)
// Make sure destination account exists
if _, err := horizon.DefaultTestNetClient.LoadAccount(publicKey); err != nil {
panic(err)
}
passphrase := network.TestNetworkPassphrase
fmt.Println(passphrase)
/*tx, err := build.Transaction(
build.TestNetwork,
build.SourceAccount{source},
build.AutoSequence{horizon.DefaultTestNetClient},
build.Payment(
build.Destination{destination},
//build.PayWith(MXC01,"100"),
//build.Amount("50"),
//build.CreditAmount{"MXC01",MXCissuer,"50"},
build.NativeAmount{"50"},
),
)*/
tx, err := build.Transaction(
build.TestNetwork,
build.SourceAccount{ distributorPub},
build.AutoSequence{horizon.DefaultTestNetClient},
build.Payment(
build.Destination{publicKey},
//build.SourceAccount{"GAPYC3DNGCYC4TJYCVPSLC476WYVNDTDJ2XOKDJWITCF3XYDSDT2FLXL"},
//build.Asset{Code:"MXC01",Issuer:"GAPYC3DNGCYC4TJYCVPSLC476WYVNDTDJ2XOKDJWITCF3XYDSDT2FLXL"},
//build.CreditAsset("MXC01","GDXFS34FXPGM3DNQIHQBPFP3DP32XNJX25FJI7OPICA7IQFQGJHFVMJT"),
//build.CreditAsset("MXC","GD4HUK74YYBT72FDNTIVF3OBHGICU74AWRFUGZOM7CUJV7FLASFYAXXO"),
build.CreditAmount{Code:"MXC",Issuer:"GD4HUK74YYBT72FDNTIVF3OBHGICU74AWRFUGZOM7CUJV7FLASFYAXXO",Amount:"200"},
//build.Amount(50),
//build.NativeAmount{"50"},
),
)
if err != nil {
panic(err)
}
// Sign the transaction to prove you are actually the person sending it.
txe, err := tx.Sign(distributorPri)
if err != nil {
panic(err)
}
txeB64, err := txe.Base64()
if err != nil {
panic(err)
}
fmt.Printf("tx base64: %s", txeB64)
fmt.Println()
// And finally, send it off to Stellar!
resp, err := horizon.DefaultTestNetClient.SubmitTransaction(txeB64)
if err != nil {
panic(err)
}
fmt.Println("Successful Transaction:")
fmt.Println("Ledger:", resp.Ledger)
fmt.Println("Hash:", resp.Hash)
fmt.Println("Your Account Balance: ")
gettingAccountDetails.GetBalance(publicKey)
}