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

Function sendFaucetTx

plugin/go/tutorial/rpc_test.go:334–344  ·  view source on GitHub ↗

sendFaucetTx sends a faucet transaction using raw JSON

(rpcURL string, signerKey *keyGroup, recipientAddr string, amount, fee, networkID, chainID, height uint64)

Source from the content-addressed store, hash-verified

332
333// sendFaucetTx sends a faucet transaction using raw JSON
334func sendFaucetTx(rpcURL string, signerKey *keyGroup, recipientAddr string, amount, fee, networkID, chainID, height uint64) (string, error) {
335 // Create the faucet message as JSON map
336 // protojson expects base64 for bytes fields
337 faucetMsg := map[string]interface{}{
338 "signerAddress": hexToBase64(signerKey.Address),
339 "recipientAddress": hexToBase64(recipientAddr),
340 "amount": float64(amount),
341 }
342
343 return buildSignAndSendTx(rpcURL, signerKey, "faucet", faucetMsg, fee, networkID, chainID, height)
344}
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) {

Callers 1

TestPluginTransactionsFunction · 0.70

Calls 2

hexToBase64Function · 0.70
buildSignAndSendTxFunction · 0.70

Tested by

no test coverage detected