Skip to content

Commit

Permalink
update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
klim0v committed Nov 10, 2020
1 parent 2c62af3 commit 9351b52
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions api/events_example_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package api_test

import (
"fmt"
"github.com/MinterTeam/minter-go-sdk/v2/api"
)

func ExampleConvertToEvent() {
eventValueJSON := `{
"address": "Mx7f0fc21d932f38ca9444f61703174569066cfa50",
"amount": "3962700000000000000000",
"role": "DAO",
"validator_pub_key": "Mpd83e627510eea6aefa46d9914b0715dabf4a561ced78d34267b31d41d5f700b5"
}`
event, _ := api.ConvertToEvent("minter/RewardEvent", []byte(eventValueJSON))
fmt.Println(event.GetAddress())
fmt.Println(event.GetValidatorPublicKey())
fmt.Printf("%#v", event.(*api.RewardEvent))

// Output:
// Mx7f0fc21d932f38ca9444f61703174569066cfa50
// Mpd83e627510eea6aefa46d9914b0715dabf4a561ced78d34267b31d41d5f700b5
// &api.RewardEvent{Role:"DAO", Address:"Mx7f0fc21d932f38ca9444f61703174569066cfa50", Amount:"3962700000000000000000", ValidatorPubKey:"Mpd83e627510eea6aefa46d9914b0715dabf4a561ced78d34267b31d41d5f700b5"}

}

0 comments on commit 9351b52

Please sign in to comment.