@@ -61,6 +61,53 @@ func main() {
61
61
}
62
62
```
63
63
64
+ ### Creating and Broadcasting a Token Transfer Transaction
65
+ ``` go
66
+ import (
67
+ " github.com/balancednetwork/stacks-go-sdk/stacks"
68
+ " github.com/balancednetwork/stacks-go-sdk/clarity"
69
+ )
70
+
71
+ func main () {
72
+ network := stacks.NewStacksMainnet ()
73
+
74
+ contractAddress := " SP466FNC0P7JWTNM2R9T199QRZN1MYEDTAR0KP27"
75
+ contractName := " contract-name"
76
+ functionName := " function-name"
77
+ senderAddress := " SP1P72Z3704VMT3DMHPP2CB8TGQWGDBHD3RPR9GZS"
78
+ senderKey := []byte {...} // sender's private key
79
+
80
+ // Prepare function arguments
81
+ arg1 , _ := clarity.NewInt (123 )
82
+ arg2 := clarity.NewStringType (" example" )
83
+ functionArgs := []clarity.ClarityValue {arg1, arg2}
84
+
85
+ // Create and sign the transaction
86
+ tx , err := stacks.MakeContractCall (
87
+ contractAddress,
88
+ contractName,
89
+ functionName,
90
+ functionArgs,
91
+ *network,
92
+ senderAddress,
93
+ senderKey,
94
+ nil , // Let the function estimate the fee
95
+ nil , // Let the function fetch the nonce
96
+ )
97
+ if err != nil {
98
+ // Handle error
99
+ }
100
+
101
+ // Broadcast the transaction
102
+ txID , err := stacks.BroadcastTransaction (tx, network)
103
+ if err != nil {
104
+ // Handle error
105
+ }
106
+
107
+ println (" Contract call transaction broadcast successfully. Transaction ID:" , txID)
108
+ }
109
+ ```
110
+
64
111
### Working with Clarity Values
65
112
``` golang
66
113
import (
0 commit comments