Ammends Contracts
Requirements
Example
Create subsctiption on contract changes by the client.
import (
"context"
"fmt"
"io"
apihttp "github.com/proximax-storage/go-xpx-dfms-api-http"
drive "github.com/proximax-storage/go-xpx-dfms-drive"
)
func main() {
// Create a new client API by given address
client := apihttp.NewClientAPI("127.0.0.1:63666")
// ID of some contract
idStr := "baegaajaiaqjcahaxr4ry4styn74ronvr2nvfdmgxtrzyhsci2xqpw5eisrisrgn5"
id, err := drive.IDFromString(idStr)
if err != nil {
panic(err)
}
//New subscription
sub, err := client.Contract().Amendments(context.Background(), id)
if err != nil {
panic(err)
}
defer sub.Close()
for {
//Get next contract
ctr, err := sub.Next(context.Background())
if err != nil && (err != io.EOF || err != context.Canceled){
panic(err)
}
//Print contract
fmt.Println(ctr)
}
}