Commit 44887f8c authored by harrylee's avatar harrylee

add interchainGet and execute method

parent 659d1455
...@@ -13,6 +13,7 @@ import ( ...@@ -13,6 +13,7 @@ import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"strconv"
"strings" "strings"
"time" "time"
...@@ -317,15 +318,81 @@ func (client *JSONClient) Invoke(requst *Request, privateKey string) (*Response, ...@@ -317,15 +318,81 @@ func (client *JSONClient) Invoke(requst *Request, privateKey string) (*Response,
} }
// TODO 执行请求 // TODO 执行请求
func (client *JSONClient) Execute(requst *Request) (*Response, error) { func (client *JSONClient) Execute(requst *Request,privateKey string) (*Response, error) {
//err := client.Call(Chain33_QueryTransaction, query, &detail) if requst.Exec == broker.BrokerX{
//if err != nil { switch requst.Fcn {
// return nil, err case "invokeInterchain":
//} srcChainServiceID := string(requst.Args[0])
// sequenceNum,err := strconv.ParseUint(string(requst.Args[1]), 10, 64)
//return &detail, nil if err != nil {
return nil,fmt.Errorf("cannot parse %s to uint64", string(requst.Args[1]))
}
targetCID := string(requst.Args[2])
reqType, err := strconv.ParseUint(string(requst.Args[3]), 10, 64)
if err != nil {
return nil,fmt.Errorf("cannot parse %s to uint64", string(requst.Args[3]))
}
if tx, err := broker.UpdateIndex("",srcChainServiceID, targetCID,sequenceNum, reqType,nil); err == nil {
resp,err:=client.SendTransactionSync(privateKey,tx)
if err !=nil {
return resp,err
}
//splitedCID[1]就是合约名称
splitedCID := strings.Split(targetCID, "&")
if len(splitedCID) != 2 {
return nil,fmt.Errorf("Target chaincode id %s is not valid", targetCID)
}
callFunc := &CallFunc{}
if err := json.Unmarshal(requst.Args[4], callFunc); err != nil {
return nil,fmt.Errorf("unmarshal call func failed for %s", requst.Args[4])
}
// 调用相应链码, (链码名称,参数,通道名称)
if splitedCID[1] == storage.StorageX{
//interchainGet方法是在sdk封装的,用于支持跨链之前数据的查询
switch callFunc.Func {
case "interchainGet":
return client.InterChainGet(string(callFunc.Args[0]))
}
}else{
return nil,fmt.Errorf("can't support exec %s",splitedCID[1])
}
}
}
}
return nil, nil
}
//包装适配跨链插件调用
func (client *JSONClient) InterChainSet(key,value string) (*Response, error) {
return nil, nil return nil, nil
} }
//包装适配跨链插件调用
func (client *JSONClient) InterChainGet(key string) (*Response, error) {
jsonraw, err := json.Marshal(&types.QueryStorage{TxHash: key})
if err != nil {
return nil, err
}
query := Query4Jrpc{
Execer: client.prefix + storage.StorageX,
FuncName: storage.FuncNameQueryStorage,
Payload: jsonraw,
}
// var storage types.Storage
data, err := client.CallBack("Chain33.Query", query, ParseStorage)
if err != nil {
return nil, err
}
storage :=data.(*types.Storage)
//这里暂时就去明文存证内容
resp := &Response{OK:true,Message:key,Data:storage.GetContentStorage().GetContent()}
return resp, nil
}
// 简单实现交易时间监听功能,后面换成grpc长链接方式监听 // 简单实现交易时间监听功能,后面换成grpc长链接方式监听
func (client *JSONClient) RegisterTxEvent(start int64, ccID, eventFilter string) (chan<- event.Registration, <-chan *event.CCEvent, <-chan error) { func (client *JSONClient) RegisterTxEvent(start int64, ccID, eventFilter string) (chan<- event.Registration, <-chan *event.CCEvent, <-chan error) {
......
package client
import (
"encoding/json"
"fmt"
"gitlab.33.cn/link33/chain33-sdk-go/dapp/storage"
"gitlab.33.cn/link33/chain33-sdk-go/types"
. "github.com/bitly/go-simplejson"
)
// 回调解析函数
func ParseStorage(raw json.RawMessage) (interface{}, error) {
js, err := NewJson(raw)
if err != nil {
return nil, err
}
if contentStorge, ok := js.CheckGet("contentStorage"); ok {
contentHex, _ := contentStorge.Get("content").String()
content, _ := types.FromHex(contentHex)
key, _ := contentStorge.Get("key").String()
value, _ := contentStorge.Get("value").String()
op, _ := contentStorge.Get("op").Int()
storage := &types.Storage{Ty: storage.TyContentStorageAction, Value: &types.Storage_ContentStorage{ContentStorage: &types.ContentOnlyNotaryStorage{
Content: content,
Key: key,
Op: int32(op),
Value: value,
XXX_NoUnkeyedLiteral: struct{}{},
XXX_unrecognized: nil,
XXX_sizecache: 0,
}}}
return storage, nil
}
if linkStorge, ok := js.CheckGet("linkStorage"); ok {
linkHex, _ := linkStorge.Get("link").String()
link, _ := types.FromHex(linkHex)
key, _ := linkStorge.Get("key").String()
value, _ := linkStorge.Get("value").String()
storage := &types.Storage{Ty: storage.TyLinkStorageAction, Value: &types.Storage_LinkStorage{LinkStorage: &types.LinkNotaryStorage{
Link: link,
Key: key,
Value: value,
XXX_NoUnkeyedLiteral: struct{}{},
XXX_unrecognized: nil,
XXX_sizecache: 0,
}}}
return storage, nil
}
if hashStorge, ok := js.CheckGet("hashStorage"); ok {
hashHex, _ := hashStorge.Get("hash").String()
hash, _ := types.FromHex(hashHex)
key, _ := hashStorge.Get("key").String()
value, _ := hashStorge.Get("value").String()
storage := &types.Storage{Ty: storage.TyHashStorageAction, Value: &types.Storage_HashStorage{HashStorage: &types.HashOnlyNotaryStorage{
Hash: hash,
Key: key,
Value: value,
XXX_NoUnkeyedLiteral: struct{}{},
XXX_unrecognized: nil,
XXX_sizecache: 0,
}}}
return storage, nil
}
if encryptStorage, ok := js.CheckGet("encryptStorage"); ok {
contentHashHex, _ := encryptStorage.Get("contentHash").String()
contentHash, _ := types.FromHex(contentHashHex)
encryptContentHex, _ := encryptStorage.Get("encryptContent").String()
encryptContent, _ := types.FromHex(encryptContentHex)
nonceHex, _ := encryptStorage.Get("nonce").String()
nonce, _ := types.FromHex(nonceHex)
key, _ := encryptStorage.Get("key").String()
value, _ := encryptStorage.Get("value").String()
storage := &types.Storage{Ty: storage.TyEncryptStorageAction, Value: &types.Storage_EncryptStorage{EncryptStorage: &types.EncryptNotaryStorage{
EncryptContent: encryptContent,
ContentHash: contentHash,
Nonce: nonce,
Key: key,
Value: value,
XXX_NoUnkeyedLiteral: struct{}{},
XXX_unrecognized: nil,
XXX_sizecache: 0,
}}}
return storage, nil
}
if encryptStorage, ok := js.CheckGet("encryptShareStorage"); ok {
contentHashHex, _ := encryptStorage.Get("contentHash").String()
contentHash, _ := types.FromHex(contentHashHex)
encryptContentHex, _ := encryptStorage.Get("encryptContent").String()
encryptContent, _ := types.FromHex(encryptContentHex)
pubKeyHex, _ := encryptStorage.Get("pubKey").String()
pubKey, _ := types.FromHex(pubKeyHex)
key, _ := encryptStorage.Get("key").String()
value, _ := encryptStorage.Get("value").String()
storage := &types.Storage{Ty: storage.TyEncryptShareStorageAction, Value: &types.Storage_EncryptShareStorage{EncryptShareStorage: &types.EncryptShareNotaryStorage{
EncryptContent: encryptContent,
ContentHash: contentHash,
PubKey: pubKey,
Key: key,
Value: value,
XXX_NoUnkeyedLiteral: struct{}{},
XXX_unrecognized: nil,
XXX_sizecache: 0,
}}}
return storage, nil
}
return nil, fmt.Errorf("unknow type!")
}
...@@ -360,3 +360,8 @@ type Response struct { ...@@ -360,3 +360,8 @@ type Response struct {
Message string `json:"message"` Message string `json:"message"`
Data []byte `json:"data"` Data []byte `json:"data"`
} }
type CallFunc struct {
Func string `json:"func"`
Args [][]byte `json:"args"`
}
...@@ -51,3 +51,7 @@ func UpdateIndex(paraName, srcServiceID, dstServiceID string, sequenceNum, reqTy ...@@ -51,3 +51,7 @@ func UpdateIndex(paraName, srcServiceID, dstServiceID string, sequenceNum, reqTy
return tx, nil return tx, nil
} }
} }
func EmitInterchainSetEvent(){
}
...@@ -3,13 +3,13 @@ package broker ...@@ -3,13 +3,13 @@ package broker
const ( const (
TyUnknowAction = iota + 100 TyUnknowAction = iota + 100
TyInitAction TyInitAction
TyRegisterAction TyRegisterExectorAction
TyAuditAction TyAuditAction
TyUpdateIndexAction TyUpdateIndexAction
TyEmitInterchainEventAction TyEmitInterchainEventAction
NameInitAction = "Init" NameInitAction = "Init"
NameRegisterAction = "Register" NameRegisterExectorAction = "RegisterExector"
NameAuditAction = "Audit" NameAuditAction = "Audit"
NameUpdateIndexAction = "UpdateIndex" NameUpdateIndexAction = "UpdateIndex"
NameEmitInterchainEventAction = "EmitInterchainEvent" NameEmitInterchainEventAction = "EmitInterchainEvent"
...@@ -31,7 +31,7 @@ const Addr = "1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs" ...@@ -31,7 +31,7 @@ const Addr = "1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs"
// 定义actionMap // 定义actionMap
var ActionMap = map[string]int32{ var ActionMap = map[string]int32{
NameInitAction: TyInitAction, NameInitAction: TyInitAction,
NameRegisterAction: TyRegisterAction, NameRegisterExectorAction: TyRegisterExectorAction,
NameAuditAction: TyAuditAction, NameAuditAction: TyAuditAction,
NameUpdateIndexAction: TyUpdateIndexAction, NameUpdateIndexAction: TyUpdateIndexAction,
NameEmitInterchainEventAction: TyEmitInterchainEventAction, NameEmitInterchainEventAction: TyEmitInterchainEventAction,
......
syntax = "proto3"; syntax = "proto3";
package types; package types;
// option go_package = "../types"; //option go_package = "../types";
message BrokerAction { message BrokerAction {
oneof value { oneof value {
Register register = 1; Init init =1;
Audit audit = 2; RegisterExector registerExector = 2;
InterchainEvent emitInterchainEvent = 3; Audit audit = 3;
UpdateIndex updateIndex = 4; InterchainEvent emitInterchainEvent = 4;
UpdateIndex updateIndex =5;
} }
int32 ty = 5; int32 ty = 6;
}
//broker初始化信息
message Init {
string bxhId = 1;
string appChainId = 2;
} }
// 业务合约注册模型: 0表示正在审核,1表示审核通过,2表示审核失败 // 业务合约注册模型: 0表示正在审核,1表示审核通过,2表示审核失败
message Register { message RegisterExector {
//业务合约名称 //业务合约名称
string exectorName = 1; string exectorName = 1;
} }
...@@ -38,7 +48,7 @@ message UpdateIndex { ...@@ -38,7 +48,7 @@ message UpdateIndex {
//源链ID,固定格式0x000002 //源链ID,固定格式0x000002
string srcServiceID = 3; string srcServiceID = 3;
//请求类型 0表示信息流入 1表示信息流出 2表示回滚 //请求类型 0表示信息流入 1表示信息流出 2表示回滚
uint64 reqType = 4; uint64 reqType =4;
//响应信息 //响应信息
Response response = 5; Response response = 5;
} }
...@@ -52,7 +62,7 @@ message InterchainEvent { ...@@ -52,7 +62,7 @@ message InterchainEvent {
//源链ID,固定格式0x000002 //源链ID,固定格式0x000002
string srcServiceID = 3; string srcServiceID = 3;
//跨链交易类型 0表示storage,1表示coins,2表示token...... //跨链交易类型 0表示storage,1表示coins,2表示token......
uint64 type = 4; uint64 type =4;
//调用方法 //调用方法
string func = 5; string func = 5;
//参数列表 //参数列表
...@@ -60,33 +70,33 @@ message InterchainEvent { ...@@ -60,33 +70,33 @@ message InterchainEvent {
//状态 0表示开始处理 1表示跨链成功 2表示跨链失败 //状态 0表示开始处理 1表示跨链成功 2表示跨链失败
int32 status = 7; int32 status = 7;
} }
// ReceiptBrokerLog //ReceiptBrokerLog
message ReceiptBrokerLog { message ReceiptBrokerLog{
oneof value { oneof value {
Register register = 1; RegisterExector registerExector = 1;
Audit audit = 2; Audit audit = 2;
InterchainEvent emitInterchainEvent = 3; InterchainEvent emitInterchainEvent = 3;
UpdateIndex updateIndex = 4; UpdateIndex updateIndex =4;
} }
int32 ty = 5; int32 ty = 5;
} }
service broker {} service broker {}
//查询跨出事件 //查询跨出事件
message QueryInterchainEvent { message QueryInterchainEvent{
uint64 index = 1; uint64 index =1;
//目的链ID,固定格式0x000001 //目的链ID,固定格式0x000001
string dstServiceID = 2; string dstServiceID = 2;
//源链ID,固定格式0x000002 //源链ID,固定格式0x000002
string srcServiceID = 3; string srcServiceID = 3;
} }
//跨链事件列表 //跨链事件列表
message InterChainEventList { message InterChainEventList{
repeated InterchainEvent list = 1; repeated InterchainEvent list =1;
} }
////根据状态查看跨链事件 ////根据状态查看跨链事件
// message QueryInterchainEventList { //message QueryInterchainEventList {
// //事件状态必填(默认是0,只查询待处理状态的事件) // //事件状态必填(默认是0,只查询待处理状态的事件)
// int32 status = 1; // int32 status = 1;
// // 主键索引 // // 主键索引
...@@ -97,36 +107,46 @@ message InterChainEventList { ...@@ -97,36 +107,46 @@ message InterChainEventList {
// int32 direction = 4; // int32 direction = 4;
//} //}
////跨链事件列表 ////跨链事件列表
// message InterchainEventList { //message InterchainEventList {
// repeated InterchainEvent list = 1; // repeated InterchainEvent list = 1;
// string primaryKey = 2; // string primaryKey = 2;
//} //}
message QueryOutterMeta {}
message QueryInnerMeta {} message QueryNilParam{
message QueryNilParam {}
}
message QueryOutterMeta{
}
message QueryInnerMeta{
message QueryInMessage {
string inServicePair = 1;
uint64 sequenceNum = 2;
} }
message QueryOutMessage { message QueryInMessage{
string inServicePair = 1; string inServicePair = 1;
uint64 sequenceNum = 2; uint64 sequenceNum = 2;
} }
message Meta { message QueryOutMessage{
map<string, uint64> meta = 1; string inServicePair = 1;
uint64 sequenceNum = 2;
} }
message BrokerInfo { message BrokerInfo {
//跨链协议版本ID //跨链协议版本ID
string bxhId = 1; string bxhId =1;
//应用链ID //应用链ID
string appChainId = 2; string appChainId = 2;
} }
message Response {
message Meta {
map<string,uint64> meta = 1;
}
message Response{
// A status code that should follow the HTTP status codes. // A status code that should follow the HTTP status codes.
int32 status = 1; int32 status = 1;
// A message associated with the response code. // A message associated with the response code.
......
This diff is collapsed.
...@@ -5,17 +5,14 @@ package types ...@@ -5,17 +5,14 @@ package types
import ( import (
fmt "fmt" fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
math "math"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
var ( var _ = proto.Marshal
_ = proto.Marshal var _ = fmt.Errorf
_ = fmt.Errorf var _ = math.Inf
_ = math.Inf
)
// This is a compile-time assertion to ensure that this generated file // This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
...@@ -46,19 +43,15 @@ func (*CertAction) Descriptor() ([]byte, []int) { ...@@ -46,19 +43,15 @@ func (*CertAction) Descriptor() ([]byte, []int) {
func (m *CertAction) XXX_Unmarshal(b []byte) error { func (m *CertAction) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CertAction.Unmarshal(m, b) return xxx_messageInfo_CertAction.Unmarshal(m, b)
} }
func (m *CertAction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *CertAction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CertAction.Marshal(b, m, deterministic) return xxx_messageInfo_CertAction.Marshal(b, m, deterministic)
} }
func (m *CertAction) XXX_Merge(src proto.Message) { func (m *CertAction) XXX_Merge(src proto.Message) {
xxx_messageInfo_CertAction.Merge(m, src) xxx_messageInfo_CertAction.Merge(m, src)
} }
func (m *CertAction) XXX_Size() int { func (m *CertAction) XXX_Size() int {
return xxx_messageInfo_CertAction.Size(m) return xxx_messageInfo_CertAction.Size(m)
} }
func (m *CertAction) XXX_DiscardUnknown() { func (m *CertAction) XXX_DiscardUnknown() {
xxx_messageInfo_CertAction.DiscardUnknown(m) xxx_messageInfo_CertAction.DiscardUnknown(m)
} }
...@@ -150,19 +143,15 @@ func (*CertNew) Descriptor() ([]byte, []int) { ...@@ -150,19 +143,15 @@ func (*CertNew) Descriptor() ([]byte, []int) {
func (m *CertNew) XXX_Unmarshal(b []byte) error { func (m *CertNew) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CertNew.Unmarshal(m, b) return xxx_messageInfo_CertNew.Unmarshal(m, b)
} }
func (m *CertNew) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *CertNew) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CertNew.Marshal(b, m, deterministic) return xxx_messageInfo_CertNew.Marshal(b, m, deterministic)
} }
func (m *CertNew) XXX_Merge(src proto.Message) { func (m *CertNew) XXX_Merge(src proto.Message) {
xxx_messageInfo_CertNew.Merge(m, src) xxx_messageInfo_CertNew.Merge(m, src)
} }
func (m *CertNew) XXX_Size() int { func (m *CertNew) XXX_Size() int {
return xxx_messageInfo_CertNew.Size(m) return xxx_messageInfo_CertNew.Size(m)
} }
func (m *CertNew) XXX_DiscardUnknown() { func (m *CertNew) XXX_DiscardUnknown() {
xxx_messageInfo_CertNew.DiscardUnknown(m) xxx_messageInfo_CertNew.DiscardUnknown(m)
} }
...@@ -202,19 +191,15 @@ func (*CertUpdate) Descriptor() ([]byte, []int) { ...@@ -202,19 +191,15 @@ func (*CertUpdate) Descriptor() ([]byte, []int) {
func (m *CertUpdate) XXX_Unmarshal(b []byte) error { func (m *CertUpdate) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CertUpdate.Unmarshal(m, b) return xxx_messageInfo_CertUpdate.Unmarshal(m, b)
} }
func (m *CertUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *CertUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CertUpdate.Marshal(b, m, deterministic) return xxx_messageInfo_CertUpdate.Marshal(b, m, deterministic)
} }
func (m *CertUpdate) XXX_Merge(src proto.Message) { func (m *CertUpdate) XXX_Merge(src proto.Message) {
xxx_messageInfo_CertUpdate.Merge(m, src) xxx_messageInfo_CertUpdate.Merge(m, src)
} }
func (m *CertUpdate) XXX_Size() int { func (m *CertUpdate) XXX_Size() int {
return xxx_messageInfo_CertUpdate.Size(m) return xxx_messageInfo_CertUpdate.Size(m)
} }
func (m *CertUpdate) XXX_DiscardUnknown() { func (m *CertUpdate) XXX_DiscardUnknown() {
xxx_messageInfo_CertUpdate.DiscardUnknown(m) xxx_messageInfo_CertUpdate.DiscardUnknown(m)
} }
...@@ -254,19 +239,15 @@ func (*CertNormal) Descriptor() ([]byte, []int) { ...@@ -254,19 +239,15 @@ func (*CertNormal) Descriptor() ([]byte, []int) {
func (m *CertNormal) XXX_Unmarshal(b []byte) error { func (m *CertNormal) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CertNormal.Unmarshal(m, b) return xxx_messageInfo_CertNormal.Unmarshal(m, b)
} }
func (m *CertNormal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *CertNormal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CertNormal.Marshal(b, m, deterministic) return xxx_messageInfo_CertNormal.Marshal(b, m, deterministic)
} }
func (m *CertNormal) XXX_Merge(src proto.Message) { func (m *CertNormal) XXX_Merge(src proto.Message) {
xxx_messageInfo_CertNormal.Merge(m, src) xxx_messageInfo_CertNormal.Merge(m, src)
} }
func (m *CertNormal) XXX_Size() int { func (m *CertNormal) XXX_Size() int {
return xxx_messageInfo_CertNormal.Size(m) return xxx_messageInfo_CertNormal.Size(m)
} }
func (m *CertNormal) XXX_DiscardUnknown() { func (m *CertNormal) XXX_DiscardUnknown() {
xxx_messageInfo_CertNormal.DiscardUnknown(m) xxx_messageInfo_CertNormal.DiscardUnknown(m)
} }
...@@ -306,19 +287,15 @@ func (*CertSignature) Descriptor() ([]byte, []int) { ...@@ -306,19 +287,15 @@ func (*CertSignature) Descriptor() ([]byte, []int) {
func (m *CertSignature) XXX_Unmarshal(b []byte) error { func (m *CertSignature) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CertSignature.Unmarshal(m, b) return xxx_messageInfo_CertSignature.Unmarshal(m, b)
} }
func (m *CertSignature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *CertSignature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CertSignature.Marshal(b, m, deterministic) return xxx_messageInfo_CertSignature.Marshal(b, m, deterministic)
} }
func (m *CertSignature) XXX_Merge(src proto.Message) { func (m *CertSignature) XXX_Merge(src proto.Message) {
xxx_messageInfo_CertSignature.Merge(m, src) xxx_messageInfo_CertSignature.Merge(m, src)
} }
func (m *CertSignature) XXX_Size() int { func (m *CertSignature) XXX_Size() int {
return xxx_messageInfo_CertSignature.Size(m) return xxx_messageInfo_CertSignature.Size(m)
} }
func (m *CertSignature) XXX_DiscardUnknown() { func (m *CertSignature) XXX_DiscardUnknown() {
xxx_messageInfo_CertSignature.DiscardUnknown(m) xxx_messageInfo_CertSignature.DiscardUnknown(m)
} }
......
This diff is collapsed.
...@@ -5,17 +5,14 @@ package types ...@@ -5,17 +5,14 @@ package types
import ( import (
fmt "fmt" fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
math "math"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
var ( var _ = proto.Marshal
_ = proto.Marshal var _ = fmt.Errorf
_ = fmt.Errorf var _ = math.Inf
_ = math.Inf
)
// This is a compile-time assertion to ensure that this generated file // This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
...@@ -29,9 +26,9 @@ type Transaction struct { ...@@ -29,9 +26,9 @@ type Transaction struct {
Signature *Signature `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"` Signature *Signature `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"`
Fee int64 `protobuf:"varint,4,opt,name=fee,proto3" json:"fee,omitempty"` Fee int64 `protobuf:"varint,4,opt,name=fee,proto3" json:"fee,omitempty"`
Expire int64 `protobuf:"varint,5,opt,name=expire,proto3" json:"expire,omitempty"` Expire int64 `protobuf:"varint,5,opt,name=expire,proto3" json:"expire,omitempty"`
// 随机ID,可以防止payload 相同的时候,交易重复 //随机ID,可以防止payload 相同的时候,交易重复
Nonce int64 `protobuf:"varint,6,opt,name=nonce,proto3" json:"nonce,omitempty"` Nonce int64 `protobuf:"varint,6,opt,name=nonce,proto3" json:"nonce,omitempty"`
// 对方地址,如果没有对方地址,可以为空 //对方地址,如果没有对方地址,可以为空
To string `protobuf:"bytes,7,opt,name=to,proto3" json:"to,omitempty"` To string `protobuf:"bytes,7,opt,name=to,proto3" json:"to,omitempty"`
GroupCount int32 `protobuf:"varint,8,opt,name=groupCount,proto3" json:"groupCount,omitempty"` GroupCount int32 `protobuf:"varint,8,opt,name=groupCount,proto3" json:"groupCount,omitempty"`
Header []byte `protobuf:"bytes,9,opt,name=header,proto3" json:"header,omitempty"` Header []byte `protobuf:"bytes,9,opt,name=header,proto3" json:"header,omitempty"`
...@@ -51,19 +48,15 @@ func (*Transaction) Descriptor() ([]byte, []int) { ...@@ -51,19 +48,15 @@ func (*Transaction) Descriptor() ([]byte, []int) {
func (m *Transaction) XXX_Unmarshal(b []byte) error { func (m *Transaction) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Transaction.Unmarshal(m, b) return xxx_messageInfo_Transaction.Unmarshal(m, b)
} }
func (m *Transaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *Transaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Transaction.Marshal(b, m, deterministic) return xxx_messageInfo_Transaction.Marshal(b, m, deterministic)
} }
func (m *Transaction) XXX_Merge(src proto.Message) { func (m *Transaction) XXX_Merge(src proto.Message) {
xxx_messageInfo_Transaction.Merge(m, src) xxx_messageInfo_Transaction.Merge(m, src)
} }
func (m *Transaction) XXX_Size() int { func (m *Transaction) XXX_Size() int {
return xxx_messageInfo_Transaction.Size(m) return xxx_messageInfo_Transaction.Size(m)
} }
func (m *Transaction) XXX_DiscardUnknown() { func (m *Transaction) XXX_DiscardUnknown() {
xxx_messageInfo_Transaction.DiscardUnknown(m) xxx_messageInfo_Transaction.DiscardUnknown(m)
} }
...@@ -143,7 +136,7 @@ func (m *Transaction) GetNext() []byte { ...@@ -143,7 +136,7 @@ func (m *Transaction) GetNext() []byte {
type Signature struct { type Signature struct {
Ty int32 `protobuf:"varint,1,opt,name=ty,proto3" json:"ty,omitempty"` Ty int32 `protobuf:"varint,1,opt,name=ty,proto3" json:"ty,omitempty"`
Pubkey []byte `protobuf:"bytes,2,opt,name=pubkey,proto3" json:"pubkey,omitempty"` Pubkey []byte `protobuf:"bytes,2,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
// 当ty为5时,格式应该用RingSignature去解析 //当ty为5时,格式应该用RingSignature去解析
Signature []byte `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"` Signature []byte `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
...@@ -160,19 +153,15 @@ func (*Signature) Descriptor() ([]byte, []int) { ...@@ -160,19 +153,15 @@ func (*Signature) Descriptor() ([]byte, []int) {
func (m *Signature) XXX_Unmarshal(b []byte) error { func (m *Signature) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Signature.Unmarshal(m, b) return xxx_messageInfo_Signature.Unmarshal(m, b)
} }
func (m *Signature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *Signature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Signature.Marshal(b, m, deterministic) return xxx_messageInfo_Signature.Marshal(b, m, deterministic)
} }
func (m *Signature) XXX_Merge(src proto.Message) { func (m *Signature) XXX_Merge(src proto.Message) {
xxx_messageInfo_Signature.Merge(m, src) xxx_messageInfo_Signature.Merge(m, src)
} }
func (m *Signature) XXX_Size() int { func (m *Signature) XXX_Size() int {
return xxx_messageInfo_Signature.Size(m) return xxx_messageInfo_Signature.Size(m)
} }
func (m *Signature) XXX_DiscardUnknown() { func (m *Signature) XXX_DiscardUnknown() {
xxx_messageInfo_Signature.DiscardUnknown(m) xxx_messageInfo_Signature.DiscardUnknown(m)
} }
......
This diff is collapsed.
...@@ -5,17 +5,14 @@ package types ...@@ -5,17 +5,14 @@ package types
import ( import (
fmt "fmt" fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
math "math"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
var ( var _ = proto.Marshal
_ = proto.Marshal var _ = fmt.Errorf
_ = fmt.Errorf var _ = math.Inf
_ = math.Inf
)
// This is a compile-time assertion to ensure that this generated file // This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
...@@ -44,19 +41,15 @@ func (*WasmAction) Descriptor() ([]byte, []int) { ...@@ -44,19 +41,15 @@ func (*WasmAction) Descriptor() ([]byte, []int) {
func (m *WasmAction) XXX_Unmarshal(b []byte) error { func (m *WasmAction) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_WasmAction.Unmarshal(m, b) return xxx_messageInfo_WasmAction.Unmarshal(m, b)
} }
func (m *WasmAction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *WasmAction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_WasmAction.Marshal(b, m, deterministic) return xxx_messageInfo_WasmAction.Marshal(b, m, deterministic)
} }
func (m *WasmAction) XXX_Merge(src proto.Message) { func (m *WasmAction) XXX_Merge(src proto.Message) {
xxx_messageInfo_WasmAction.Merge(m, src) xxx_messageInfo_WasmAction.Merge(m, src)
} }
func (m *WasmAction) XXX_Size() int { func (m *WasmAction) XXX_Size() int {
return xxx_messageInfo_WasmAction.Size(m) return xxx_messageInfo_WasmAction.Size(m)
} }
func (m *WasmAction) XXX_DiscardUnknown() { func (m *WasmAction) XXX_DiscardUnknown() {
xxx_messageInfo_WasmAction.DiscardUnknown(m) xxx_messageInfo_WasmAction.DiscardUnknown(m)
} }
...@@ -133,19 +126,15 @@ func (*WasmCreate) Descriptor() ([]byte, []int) { ...@@ -133,19 +126,15 @@ func (*WasmCreate) Descriptor() ([]byte, []int) {
func (m *WasmCreate) XXX_Unmarshal(b []byte) error { func (m *WasmCreate) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_WasmCreate.Unmarshal(m, b) return xxx_messageInfo_WasmCreate.Unmarshal(m, b)
} }
func (m *WasmCreate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *WasmCreate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_WasmCreate.Marshal(b, m, deterministic) return xxx_messageInfo_WasmCreate.Marshal(b, m, deterministic)
} }
func (m *WasmCreate) XXX_Merge(src proto.Message) { func (m *WasmCreate) XXX_Merge(src proto.Message) {
xxx_messageInfo_WasmCreate.Merge(m, src) xxx_messageInfo_WasmCreate.Merge(m, src)
} }
func (m *WasmCreate) XXX_Size() int { func (m *WasmCreate) XXX_Size() int {
return xxx_messageInfo_WasmCreate.Size(m) return xxx_messageInfo_WasmCreate.Size(m)
} }
func (m *WasmCreate) XXX_DiscardUnknown() { func (m *WasmCreate) XXX_DiscardUnknown() {
xxx_messageInfo_WasmCreate.DiscardUnknown(m) xxx_messageInfo_WasmCreate.DiscardUnknown(m)
} }
...@@ -186,19 +175,15 @@ func (*WasmCall) Descriptor() ([]byte, []int) { ...@@ -186,19 +175,15 @@ func (*WasmCall) Descriptor() ([]byte, []int) {
func (m *WasmCall) XXX_Unmarshal(b []byte) error { func (m *WasmCall) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_WasmCall.Unmarshal(m, b) return xxx_messageInfo_WasmCall.Unmarshal(m, b)
} }
func (m *WasmCall) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *WasmCall) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_WasmCall.Marshal(b, m, deterministic) return xxx_messageInfo_WasmCall.Marshal(b, m, deterministic)
} }
func (m *WasmCall) XXX_Merge(src proto.Message) { func (m *WasmCall) XXX_Merge(src proto.Message) {
xxx_messageInfo_WasmCall.Merge(m, src) xxx_messageInfo_WasmCall.Merge(m, src)
} }
func (m *WasmCall) XXX_Size() int { func (m *WasmCall) XXX_Size() int {
return xxx_messageInfo_WasmCall.Size(m) return xxx_messageInfo_WasmCall.Size(m)
} }
func (m *WasmCall) XXX_DiscardUnknown() { func (m *WasmCall) XXX_DiscardUnknown() {
xxx_messageInfo_WasmCall.DiscardUnknown(m) xxx_messageInfo_WasmCall.DiscardUnknown(m)
} }
...@@ -250,19 +235,15 @@ func (*QueryCheckContract) Descriptor() ([]byte, []int) { ...@@ -250,19 +235,15 @@ func (*QueryCheckContract) Descriptor() ([]byte, []int) {
func (m *QueryCheckContract) XXX_Unmarshal(b []byte) error { func (m *QueryCheckContract) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_QueryCheckContract.Unmarshal(m, b) return xxx_messageInfo_QueryCheckContract.Unmarshal(m, b)
} }
func (m *QueryCheckContract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *QueryCheckContract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_QueryCheckContract.Marshal(b, m, deterministic) return xxx_messageInfo_QueryCheckContract.Marshal(b, m, deterministic)
} }
func (m *QueryCheckContract) XXX_Merge(src proto.Message) { func (m *QueryCheckContract) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryCheckContract.Merge(m, src) xxx_messageInfo_QueryCheckContract.Merge(m, src)
} }
func (m *QueryCheckContract) XXX_Size() int { func (m *QueryCheckContract) XXX_Size() int {
return xxx_messageInfo_QueryCheckContract.Size(m) return xxx_messageInfo_QueryCheckContract.Size(m)
} }
func (m *QueryCheckContract) XXX_DiscardUnknown() { func (m *QueryCheckContract) XXX_DiscardUnknown() {
xxx_messageInfo_QueryCheckContract.DiscardUnknown(m) xxx_messageInfo_QueryCheckContract.DiscardUnknown(m)
} }
...@@ -293,19 +274,15 @@ func (*CustomLog) Descriptor() ([]byte, []int) { ...@@ -293,19 +274,15 @@ func (*CustomLog) Descriptor() ([]byte, []int) {
func (m *CustomLog) XXX_Unmarshal(b []byte) error { func (m *CustomLog) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CustomLog.Unmarshal(m, b) return xxx_messageInfo_CustomLog.Unmarshal(m, b)
} }
func (m *CustomLog) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *CustomLog) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CustomLog.Marshal(b, m, deterministic) return xxx_messageInfo_CustomLog.Marshal(b, m, deterministic)
} }
func (m *CustomLog) XXX_Merge(src proto.Message) { func (m *CustomLog) XXX_Merge(src proto.Message) {
xxx_messageInfo_CustomLog.Merge(m, src) xxx_messageInfo_CustomLog.Merge(m, src)
} }
func (m *CustomLog) XXX_Size() int { func (m *CustomLog) XXX_Size() int {
return xxx_messageInfo_CustomLog.Size(m) return xxx_messageInfo_CustomLog.Size(m)
} }
func (m *CustomLog) XXX_DiscardUnknown() { func (m *CustomLog) XXX_DiscardUnknown() {
xxx_messageInfo_CustomLog.DiscardUnknown(m) xxx_messageInfo_CustomLog.DiscardUnknown(m)
} }
...@@ -337,19 +314,15 @@ func (*CreateContractLog) Descriptor() ([]byte, []int) { ...@@ -337,19 +314,15 @@ func (*CreateContractLog) Descriptor() ([]byte, []int) {
func (m *CreateContractLog) XXX_Unmarshal(b []byte) error { func (m *CreateContractLog) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreateContractLog.Unmarshal(m, b) return xxx_messageInfo_CreateContractLog.Unmarshal(m, b)
} }
func (m *CreateContractLog) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *CreateContractLog) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CreateContractLog.Marshal(b, m, deterministic) return xxx_messageInfo_CreateContractLog.Marshal(b, m, deterministic)
} }
func (m *CreateContractLog) XXX_Merge(src proto.Message) { func (m *CreateContractLog) XXX_Merge(src proto.Message) {
xxx_messageInfo_CreateContractLog.Merge(m, src) xxx_messageInfo_CreateContractLog.Merge(m, src)
} }
func (m *CreateContractLog) XXX_Size() int { func (m *CreateContractLog) XXX_Size() int {
return xxx_messageInfo_CreateContractLog.Size(m) return xxx_messageInfo_CreateContractLog.Size(m)
} }
func (m *CreateContractLog) XXX_DiscardUnknown() { func (m *CreateContractLog) XXX_DiscardUnknown() {
xxx_messageInfo_CreateContractLog.DiscardUnknown(m) xxx_messageInfo_CreateContractLog.DiscardUnknown(m)
} }
...@@ -389,19 +362,15 @@ func (*CallContractLog) Descriptor() ([]byte, []int) { ...@@ -389,19 +362,15 @@ func (*CallContractLog) Descriptor() ([]byte, []int) {
func (m *CallContractLog) XXX_Unmarshal(b []byte) error { func (m *CallContractLog) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CallContractLog.Unmarshal(m, b) return xxx_messageInfo_CallContractLog.Unmarshal(m, b)
} }
func (m *CallContractLog) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *CallContractLog) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CallContractLog.Marshal(b, m, deterministic) return xxx_messageInfo_CallContractLog.Marshal(b, m, deterministic)
} }
func (m *CallContractLog) XXX_Merge(src proto.Message) { func (m *CallContractLog) XXX_Merge(src proto.Message) {
xxx_messageInfo_CallContractLog.Merge(m, src) xxx_messageInfo_CallContractLog.Merge(m, src)
} }
func (m *CallContractLog) XXX_Size() int { func (m *CallContractLog) XXX_Size() int {
return xxx_messageInfo_CallContractLog.Size(m) return xxx_messageInfo_CallContractLog.Size(m)
} }
func (m *CallContractLog) XXX_DiscardUnknown() { func (m *CallContractLog) XXX_DiscardUnknown() {
xxx_messageInfo_CallContractLog.DiscardUnknown(m) xxx_messageInfo_CallContractLog.DiscardUnknown(m)
} }
...@@ -447,19 +416,15 @@ func (*LocalDataLog) Descriptor() ([]byte, []int) { ...@@ -447,19 +416,15 @@ func (*LocalDataLog) Descriptor() ([]byte, []int) {
func (m *LocalDataLog) XXX_Unmarshal(b []byte) error { func (m *LocalDataLog) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_LocalDataLog.Unmarshal(m, b) return xxx_messageInfo_LocalDataLog.Unmarshal(m, b)
} }
func (m *LocalDataLog) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *LocalDataLog) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_LocalDataLog.Marshal(b, m, deterministic) return xxx_messageInfo_LocalDataLog.Marshal(b, m, deterministic)
} }
func (m *LocalDataLog) XXX_Merge(src proto.Message) { func (m *LocalDataLog) XXX_Merge(src proto.Message) {
xxx_messageInfo_LocalDataLog.Merge(m, src) xxx_messageInfo_LocalDataLog.Merge(m, src)
} }
func (m *LocalDataLog) XXX_Size() int { func (m *LocalDataLog) XXX_Size() int {
return xxx_messageInfo_LocalDataLog.Size(m) return xxx_messageInfo_LocalDataLog.Size(m)
} }
func (m *LocalDataLog) XXX_DiscardUnknown() { func (m *LocalDataLog) XXX_DiscardUnknown() {
xxx_messageInfo_LocalDataLog.DiscardUnknown(m) xxx_messageInfo_LocalDataLog.DiscardUnknown(m)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment