MCPcopy
hub / github.com/canopy-network/canopy / sendSendTx

Function sendSendTx

plugin/go/tutorial/rpc_test.go:347–357  ·  view source on GitHub ↗

sendSendTx sends a send transaction using raw JSON

(rpcURL string, senderKey *keyGroup, fromAddr, toAddr string, amount, fee, networkID, chainID, height uint64)

Source from the content-addressed store, hash-verified

345
346// sendSendTx sends a send transaction using raw JSON
347func sendSendTx(rpcURL string, senderKey *keyGroup, fromAddr, toAddr string, amount, fee, networkID, chainID, height uint64) (string, error) {
348 // Create the send message as JSON map
349 // protojson expects base64 for bytes fields
350 sendMsg := map[string]interface{}{
351 "fromAddress": hexToBase64(fromAddr),
352 "toAddress": hexToBase64(toAddr),
353 "amount": float64(amount),
354 }
355
356 return buildSignAndSendTx(rpcURL, senderKey, "send", sendMsg, fee, networkID, chainID, height)
357}
358
359// sendRewardTx sends a reward transaction using raw JSON
360func sendRewardTx(rpcURL string, adminKey *keyGroup, adminAddr, recipientAddr string, amount, fee, networkID, chainID, height uint64) (string, error) {

Callers 1

TestPluginTransactionsFunction · 0.70

Calls 2

hexToBase64Function · 0.70
buildSignAndSendTxFunction · 0.70

Tested by

no test coverage detected