Exemple #1
0
func (tx *PermissionsTx) WriteSignBytes(chainID string, w io.Writer, n *int64, err *error) {
	wire.WriteTo([]byte(Fmt(`{"chain_id":%s`, jsonEscape(chainID))), w, n, err)
	wire.WriteTo([]byte(Fmt(`,"tx":[%v,{"args":"`, TxTypePermissions)), w, n, err)
	wire.WriteJSON(tx.PermArgs, w, n, err)
	wire.WriteTo([]byte(`","input":`), w, n, err)
	tx.Input.WriteSignBytes(w, n, err)
	wire.WriteTo([]byte(`}]}`), w, n, err)
}
Exemple #2
0
func binaryWriter(args ...interface{}) ([]interface{}, error) {
	list := []interface{}{}
	for _, a := range args {
		buf, n, err := new(bytes.Buffer), new(int64), new(error)
		wire.WriteJSON(a, buf, n, err)
		if *err != nil {
			return nil, *err
		}
		list = append(list, buf.Bytes())

	}
	return list, nil
}
Exemple #3
0
func argsToJson(args ...interface{}) ([]string, error) {
	l := len(args)
	jsons := make([]string, l)
	n, err := new(int64), new(error)
	for i, a := range args {
		buf := new(bytes.Buffer)
		wire.WriteJSON(a, buf, n, err)
		if *err != nil {
			return nil, *err
		}
		jsons[i] = string(buf.Bytes())
	}
	return jsons, nil
}