diff --git a/pkg/capabilities/v2/chain-capabilities/aptos/client.pb.go b/pkg/capabilities/v2/chain-capabilities/aptos/client.pb.go index 347028bdf..2e3b735ce 100644 --- a/pkg/capabilities/v2/chain-capabilities/aptos/client.pb.go +++ b/pkg/capabilities/v2/chain-capabilities/aptos/client.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.11 -// protoc v5.29.3 +// protoc-gen-go v1.36.10 +// protoc v5.27.3 // source: capabilities/blockchain/aptos/v1alpha/client.proto package aptos @@ -23,26 +23,29 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// Transaction execution status returned by the forwarder. +// Transaction status for Aptos write report. type TxStatus int32 const ( - TxStatus_TX_STATUS_FATAL TxStatus = 0 // unrecoverable failure - TxStatus_TX_STATUS_ABORTED TxStatus = 1 // not executed / dropped - TxStatus_TX_STATUS_SUCCESS TxStatus = 2 // executed successfully + TxStatus_TX_STATUS_UNKNOWN TxStatus = 0 + TxStatus_TX_STATUS_PENDING TxStatus = 1 + TxStatus_TX_STATUS_SUCCESS TxStatus = 2 + TxStatus_TX_STATUS_FAILED TxStatus = 3 ) // Enum value maps for TxStatus. var ( TxStatus_name = map[int32]string{ - 0: "TX_STATUS_FATAL", - 1: "TX_STATUS_ABORTED", + 0: "TX_STATUS_UNKNOWN", + 1: "TX_STATUS_PENDING", 2: "TX_STATUS_SUCCESS", + 3: "TX_STATUS_FAILED", } TxStatus_value = map[string]int32{ - "TX_STATUS_FATAL": 0, - "TX_STATUS_ABORTED": 1, + "TX_STATUS_UNKNOWN": 0, + "TX_STATUS_PENDING": 1, "TX_STATUS_SUCCESS": 2, + "TX_STATUS_FAILED": 3, } ) @@ -73,818 +76,30 @@ func (TxStatus) EnumDescriptor() ([]byte, []int) { return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{0} } -type TypeTagKind int32 - -const ( - TypeTagKind_TYPE_TAG_KIND_BOOL TypeTagKind = 0 - TypeTagKind_TYPE_TAG_KIND_U8 TypeTagKind = 1 - TypeTagKind_TYPE_TAG_KIND_U16 TypeTagKind = 2 - TypeTagKind_TYPE_TAG_KIND_U32 TypeTagKind = 3 - TypeTagKind_TYPE_TAG_KIND_U64 TypeTagKind = 4 - TypeTagKind_TYPE_TAG_KIND_U128 TypeTagKind = 5 - TypeTagKind_TYPE_TAG_KIND_U256 TypeTagKind = 6 - TypeTagKind_TYPE_TAG_KIND_ADDRESS TypeTagKind = 7 - TypeTagKind_TYPE_TAG_KIND_SIGNER TypeTagKind = 8 - TypeTagKind_TYPE_TAG_KIND_VECTOR TypeTagKind = 9 - TypeTagKind_TYPE_TAG_KIND_STRUCT TypeTagKind = 10 - TypeTagKind_TYPE_TAG_KIND_GENERIC TypeTagKind = 11 -) - -// Enum value maps for TypeTagKind. -var ( - TypeTagKind_name = map[int32]string{ - 0: "TYPE_TAG_KIND_BOOL", - 1: "TYPE_TAG_KIND_U8", - 2: "TYPE_TAG_KIND_U16", - 3: "TYPE_TAG_KIND_U32", - 4: "TYPE_TAG_KIND_U64", - 5: "TYPE_TAG_KIND_U128", - 6: "TYPE_TAG_KIND_U256", - 7: "TYPE_TAG_KIND_ADDRESS", - 8: "TYPE_TAG_KIND_SIGNER", - 9: "TYPE_TAG_KIND_VECTOR", - 10: "TYPE_TAG_KIND_STRUCT", - 11: "TYPE_TAG_KIND_GENERIC", - } - TypeTagKind_value = map[string]int32{ - "TYPE_TAG_KIND_BOOL": 0, - "TYPE_TAG_KIND_U8": 1, - "TYPE_TAG_KIND_U16": 2, - "TYPE_TAG_KIND_U32": 3, - "TYPE_TAG_KIND_U64": 4, - "TYPE_TAG_KIND_U128": 5, - "TYPE_TAG_KIND_U256": 6, - "TYPE_TAG_KIND_ADDRESS": 7, - "TYPE_TAG_KIND_SIGNER": 8, - "TYPE_TAG_KIND_VECTOR": 9, - "TYPE_TAG_KIND_STRUCT": 10, - "TYPE_TAG_KIND_GENERIC": 11, - } -) - -func (x TypeTagKind) Enum() *TypeTagKind { - p := new(TypeTagKind) - *p = x - return p -} - -func (x TypeTagKind) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (TypeTagKind) Descriptor() protoreflect.EnumDescriptor { - return file_capabilities_blockchain_aptos_v1alpha_client_proto_enumTypes[1].Descriptor() -} - -func (TypeTagKind) Type() protoreflect.EnumType { - return &file_capabilities_blockchain_aptos_v1alpha_client_proto_enumTypes[1] -} - -func (x TypeTagKind) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use TypeTagKind.Descriptor instead. -func (TypeTagKind) EnumDescriptor() ([]byte, []int) { - return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{1} -} - -type TransactionVariant int32 - -const ( - TransactionVariant_TRANSACTION_VARIANT_PENDING TransactionVariant = 0 - TransactionVariant_TRANSACTION_VARIANT_USER TransactionVariant = 1 - TransactionVariant_TRANSACTION_VARIANT_GENESIS TransactionVariant = 2 - TransactionVariant_TRANSACTION_VARIANT_BLOCK_METADATA TransactionVariant = 3 - TransactionVariant_TRANSACTION_VARIANT_BLOCK_EPILOGUE TransactionVariant = 4 - TransactionVariant_TRANSACTION_VARIANT_STATE_CHECKPOINT TransactionVariant = 5 - TransactionVariant_TRANSACTION_VARIANT_VALIDATOR TransactionVariant = 6 - TransactionVariant_TRANSACTION_VARIANT_UNKNOWN TransactionVariant = 7 -) - -// Enum value maps for TransactionVariant. -var ( - TransactionVariant_name = map[int32]string{ - 0: "TRANSACTION_VARIANT_PENDING", - 1: "TRANSACTION_VARIANT_USER", - 2: "TRANSACTION_VARIANT_GENESIS", - 3: "TRANSACTION_VARIANT_BLOCK_METADATA", - 4: "TRANSACTION_VARIANT_BLOCK_EPILOGUE", - 5: "TRANSACTION_VARIANT_STATE_CHECKPOINT", - 6: "TRANSACTION_VARIANT_VALIDATOR", - 7: "TRANSACTION_VARIANT_UNKNOWN", - } - TransactionVariant_value = map[string]int32{ - "TRANSACTION_VARIANT_PENDING": 0, - "TRANSACTION_VARIANT_USER": 1, - "TRANSACTION_VARIANT_GENESIS": 2, - "TRANSACTION_VARIANT_BLOCK_METADATA": 3, - "TRANSACTION_VARIANT_BLOCK_EPILOGUE": 4, - "TRANSACTION_VARIANT_STATE_CHECKPOINT": 5, - "TRANSACTION_VARIANT_VALIDATOR": 6, - "TRANSACTION_VARIANT_UNKNOWN": 7, - } -) - -func (x TransactionVariant) Enum() *TransactionVariant { - p := new(TransactionVariant) - *p = x - return p -} - -func (x TransactionVariant) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (TransactionVariant) Descriptor() protoreflect.EnumDescriptor { - return file_capabilities_blockchain_aptos_v1alpha_client_proto_enumTypes[2].Descriptor() -} - -func (TransactionVariant) Type() protoreflect.EnumType { - return &file_capabilities_blockchain_aptos_v1alpha_client_proto_enumTypes[2] -} - -func (x TransactionVariant) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use TransactionVariant.Descriptor instead. -func (TransactionVariant) EnumDescriptor() ([]byte, []int) { - return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{2} -} - -type AccountAPTBalanceRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // 32-byte address - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AccountAPTBalanceRequest) Reset() { - *x = AccountAPTBalanceRequest{} - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AccountAPTBalanceRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AccountAPTBalanceRequest) ProtoMessage() {} - -func (x *AccountAPTBalanceRequest) ProtoReflect() protoreflect.Message { - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AccountAPTBalanceRequest.ProtoReflect.Descriptor instead. -func (*AccountAPTBalanceRequest) Descriptor() ([]byte, []int) { - return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{0} -} - -func (x *AccountAPTBalanceRequest) GetAddress() []byte { - if x != nil { - return x.Address - } - return nil -} - -type AccountAPTBalanceReply struct { - state protoimpl.MessageState `protogen:"open.v1"` - Value uint64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AccountAPTBalanceReply) Reset() { - *x = AccountAPTBalanceReply{} - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AccountAPTBalanceReply) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AccountAPTBalanceReply) ProtoMessage() {} - -func (x *AccountAPTBalanceReply) ProtoReflect() protoreflect.Message { - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[1] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AccountAPTBalanceReply.ProtoReflect.Descriptor instead. -func (*AccountAPTBalanceReply) Descriptor() ([]byte, []int) { - return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{1} -} - -func (x *AccountAPTBalanceReply) GetValue() uint64 { - if x != nil { - return x.Value - } - return 0 -} - -type ViewRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - Payload *ViewPayload `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ViewRequest) Reset() { - *x = ViewRequest{} - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ViewRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ViewRequest) ProtoMessage() {} - -func (x *ViewRequest) ProtoReflect() protoreflect.Message { - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[2] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ViewRequest.ProtoReflect.Descriptor instead. -func (*ViewRequest) Descriptor() ([]byte, []int) { - return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{2} -} - -func (x *ViewRequest) GetPayload() *ViewPayload { - if x != nil { - return x.Payload - } - return nil -} - -type ViewReply struct { - state protoimpl.MessageState `protogen:"open.v1"` - Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ViewReply) Reset() { - *x = ViewReply{} - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ViewReply) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ViewReply) ProtoMessage() {} - -func (x *ViewReply) ProtoReflect() protoreflect.Message { - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[3] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ViewReply.ProtoReflect.Descriptor instead. -func (*ViewReply) Descriptor() ([]byte, []int) { - return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{3} -} - -func (x *ViewReply) GetData() []byte { - if x != nil { - return x.Data - } - return nil -} - -type ViewPayload struct { - state protoimpl.MessageState `protogen:"open.v1"` - Module *ModuleID `protobuf:"bytes,1,opt,name=module,proto3" json:"module,omitempty"` - Function string `protobuf:"bytes,2,opt,name=function,proto3" json:"function,omitempty"` - ArgTypes []*TypeTag `protobuf:"bytes,3,rep,name=arg_types,json=argTypes,proto3" json:"arg_types,omitempty"` - Args [][]byte `protobuf:"bytes,4,rep,name=args,proto3" json:"args,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ViewPayload) Reset() { - *x = ViewPayload{} - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ViewPayload) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ViewPayload) ProtoMessage() {} - -func (x *ViewPayload) ProtoReflect() protoreflect.Message { - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[4] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ViewPayload.ProtoReflect.Descriptor instead. -func (*ViewPayload) Descriptor() ([]byte, []int) { - return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{4} -} - -func (x *ViewPayload) GetModule() *ModuleID { - if x != nil { - return x.Module - } - return nil -} - -func (x *ViewPayload) GetFunction() string { - if x != nil { - return x.Function - } - return "" -} - -func (x *ViewPayload) GetArgTypes() []*TypeTag { - if x != nil { - return x.ArgTypes - } - return nil -} - -func (x *ViewPayload) GetArgs() [][]byte { - if x != nil { - return x.Args - } - return nil -} - -type ModuleID struct { - state protoimpl.MessageState `protogen:"open.v1"` - Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // 32-byte address - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ModuleID) Reset() { - *x = ModuleID{} - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ModuleID) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ModuleID) ProtoMessage() {} - -func (x *ModuleID) ProtoReflect() protoreflect.Message { - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[5] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ModuleID.ProtoReflect.Descriptor instead. -func (*ModuleID) Descriptor() ([]byte, []int) { - return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{5} -} - -func (x *ModuleID) GetAddress() []byte { - if x != nil { - return x.Address - } - return nil -} - -func (x *ModuleID) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -type TypeTag struct { - state protoimpl.MessageState `protogen:"open.v1"` - Kind TypeTagKind `protobuf:"varint,1,opt,name=kind,proto3,enum=capabilities.blockchain.aptos.v1alpha.TypeTagKind" json:"kind,omitempty"` - // Types that are valid to be assigned to Value: - // - // *TypeTag_Vector - // *TypeTag_Struct - // *TypeTag_Generic - Value isTypeTag_Value `protobuf_oneof:"value"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *TypeTag) Reset() { - *x = TypeTag{} - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *TypeTag) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TypeTag) ProtoMessage() {} - -func (x *TypeTag) ProtoReflect() protoreflect.Message { - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[6] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TypeTag.ProtoReflect.Descriptor instead. -func (*TypeTag) Descriptor() ([]byte, []int) { - return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{6} -} - -func (x *TypeTag) GetKind() TypeTagKind { - if x != nil { - return x.Kind - } - return TypeTagKind_TYPE_TAG_KIND_BOOL -} - -func (x *TypeTag) GetValue() isTypeTag_Value { - if x != nil { - return x.Value - } - return nil -} - -func (x *TypeTag) GetVector() *VectorTag { - if x != nil { - if x, ok := x.Value.(*TypeTag_Vector); ok { - return x.Vector - } - } - return nil -} - -func (x *TypeTag) GetStruct() *StructTag { - if x != nil { - if x, ok := x.Value.(*TypeTag_Struct); ok { - return x.Struct - } - } - return nil -} - -func (x *TypeTag) GetGeneric() *GenericTag { - if x != nil { - if x, ok := x.Value.(*TypeTag_Generic); ok { - return x.Generic - } - } - return nil -} - -type isTypeTag_Value interface { - isTypeTag_Value() -} - -type TypeTag_Vector struct { - Vector *VectorTag `protobuf:"bytes,2,opt,name=vector,proto3,oneof"` -} - -type TypeTag_Struct struct { - Struct *StructTag `protobuf:"bytes,3,opt,name=struct,proto3,oneof"` -} - -type TypeTag_Generic struct { - Generic *GenericTag `protobuf:"bytes,4,opt,name=generic,proto3,oneof"` -} - -func (*TypeTag_Vector) isTypeTag_Value() {} - -func (*TypeTag_Struct) isTypeTag_Value() {} - -func (*TypeTag_Generic) isTypeTag_Value() {} - -type VectorTag struct { - state protoimpl.MessageState `protogen:"open.v1"` - ElementType *TypeTag `protobuf:"bytes,1,opt,name=element_type,json=elementType,proto3" json:"element_type,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *VectorTag) Reset() { - *x = VectorTag{} - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *VectorTag) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*VectorTag) ProtoMessage() {} - -func (x *VectorTag) ProtoReflect() protoreflect.Message { - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[7] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use VectorTag.ProtoReflect.Descriptor instead. -func (*VectorTag) Descriptor() ([]byte, []int) { - return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{7} -} - -func (x *VectorTag) GetElementType() *TypeTag { - if x != nil { - return x.ElementType - } - return nil -} - -type StructTag struct { - state protoimpl.MessageState `protogen:"open.v1"` - Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // 32-byte address - Module string `protobuf:"bytes,2,opt,name=module,proto3" json:"module,omitempty"` - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` - TypeParams []*TypeTag `protobuf:"bytes,4,rep,name=type_params,json=typeParams,proto3" json:"type_params,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *StructTag) Reset() { - *x = StructTag{} - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *StructTag) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StructTag) ProtoMessage() {} - -func (x *StructTag) ProtoReflect() protoreflect.Message { - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[8] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StructTag.ProtoReflect.Descriptor instead. -func (*StructTag) Descriptor() ([]byte, []int) { - return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{8} -} - -func (x *StructTag) GetAddress() []byte { - if x != nil { - return x.Address - } - return nil -} - -func (x *StructTag) GetModule() string { - if x != nil { - return x.Module - } - return "" -} - -func (x *StructTag) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *StructTag) GetTypeParams() []*TypeTag { - if x != nil { - return x.TypeParams - } - return nil -} - -type GenericTag struct { - state protoimpl.MessageState `protogen:"open.v1"` - Index uint32 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GenericTag) Reset() { - *x = GenericTag{} - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GenericTag) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GenericTag) ProtoMessage() {} - -func (x *GenericTag) ProtoReflect() protoreflect.Message { - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[9] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GenericTag.ProtoReflect.Descriptor instead. -func (*GenericTag) Descriptor() ([]byte, []int) { - return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{9} -} - -func (x *GenericTag) GetIndex() uint32 { - if x != nil { - return x.Index - } - return 0 -} - -type TransactionByHashRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` // Transaction hash (hex string with 0x prefix) - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *TransactionByHashRequest) Reset() { - *x = TransactionByHashRequest{} - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *TransactionByHashRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TransactionByHashRequest) ProtoMessage() {} - -func (x *TransactionByHashRequest) ProtoReflect() protoreflect.Message { - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[10] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TransactionByHashRequest.ProtoReflect.Descriptor instead. -func (*TransactionByHashRequest) Descriptor() ([]byte, []int) { - return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{10} -} - -func (x *TransactionByHashRequest) GetHash() string { - if x != nil { - return x.Hash - } - return "" -} - -type TransactionByHashReply struct { - state protoimpl.MessageState `protogen:"open.v1"` - Transaction *Transaction `protobuf:"bytes,1,opt,name=transaction,proto3,oneof" json:"transaction,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *TransactionByHashReply) Reset() { - *x = TransactionByHashReply{} - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *TransactionByHashReply) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TransactionByHashReply) ProtoMessage() {} - -func (x *TransactionByHashReply) ProtoReflect() protoreflect.Message { - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[11] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TransactionByHashReply.ProtoReflect.Descriptor instead. -func (*TransactionByHashReply) Descriptor() ([]byte, []int) { - return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{11} -} - -func (x *TransactionByHashReply) GetTransaction() *Transaction { - if x != nil { - return x.Transaction - } - return nil -} - -type Transaction struct { +// Gas configuration for Aptos transactions. +type GasConfig struct { state protoimpl.MessageState `protogen:"open.v1"` - Type TransactionVariant `protobuf:"varint,1,opt,name=type,proto3,enum=capabilities.blockchain.aptos.v1alpha.TransactionVariant" json:"type,omitempty"` - Hash string `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` - Version *uint64 `protobuf:"varint,3,opt,name=version,proto3,oneof" json:"version,omitempty"` // nil for pending transactions - Success *bool `protobuf:"varint,4,opt,name=success,proto3,oneof" json:"success,omitempty"` // nil for pending/genesis transactions - Data []byte `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"` // Raw transaction data + MaxGasAmount uint64 `protobuf:"varint,1,opt,name=max_gas_amount,json=maxGasAmount,proto3" json:"max_gas_amount,omitempty"` + GasUnitPrice uint64 `protobuf:"varint,2,opt,name=gas_unit_price,json=gasUnitPrice,proto3" json:"gas_unit_price,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *Transaction) Reset() { - *x = Transaction{} - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[12] +func (x *GasConfig) Reset() { + *x = GasConfig{} + mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *Transaction) String() string { +func (x *GasConfig) String() string { return protoimpl.X.MessageStringOf(x) } -func (*Transaction) ProtoMessage() {} +func (*GasConfig) ProtoMessage() {} -func (x *Transaction) ProtoReflect() protoreflect.Message { - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[12] +func (x *GasConfig) ProtoReflect() protoreflect.Message { + mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[0] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -895,174 +110,50 @@ func (x *Transaction) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use Transaction.ProtoReflect.Descriptor instead. -func (*Transaction) Descriptor() ([]byte, []int) { - return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{12} -} - -func (x *Transaction) GetType() TransactionVariant { - if x != nil { - return x.Type - } - return TransactionVariant_TRANSACTION_VARIANT_PENDING +// Deprecated: Use GasConfig.ProtoReflect.Descriptor instead. +func (*GasConfig) Descriptor() ([]byte, []int) { + return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{0} } -func (x *Transaction) GetHash() string { +func (x *GasConfig) GetMaxGasAmount() uint64 { if x != nil { - return x.Hash - } - return "" -} - -func (x *Transaction) GetVersion() uint64 { - if x != nil && x.Version != nil { - return *x.Version + return x.MaxGasAmount } return 0 } -func (x *Transaction) GetSuccess() bool { - if x != nil && x.Success != nil { - return *x.Success - } - return false -} - -func (x *Transaction) GetData() []byte { - if x != nil { - return x.Data - } - return nil -} - -type AccountTransactionsRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // 32-byte address - Start *uint64 `protobuf:"varint,2,opt,name=start,proto3,oneof" json:"start,omitempty"` // Starting version number; nil for most recent - Limit *uint64 `protobuf:"varint,3,opt,name=limit,proto3,oneof" json:"limit,omitempty"` // Number of transactions to return; nil for default (~100) - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AccountTransactionsRequest) Reset() { - *x = AccountTransactionsRequest{} - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AccountTransactionsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AccountTransactionsRequest) ProtoMessage() {} - -func (x *AccountTransactionsRequest) ProtoReflect() protoreflect.Message { - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[13] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AccountTransactionsRequest.ProtoReflect.Descriptor instead. -func (*AccountTransactionsRequest) Descriptor() ([]byte, []int) { - return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{13} -} - -func (x *AccountTransactionsRequest) GetAddress() []byte { +func (x *GasConfig) GetGasUnitPrice() uint64 { if x != nil { - return x.Address - } - return nil -} - -func (x *AccountTransactionsRequest) GetStart() uint64 { - if x != nil && x.Start != nil { - return *x.Start - } - return 0 -} - -func (x *AccountTransactionsRequest) GetLimit() uint64 { - if x != nil && x.Limit != nil { - return *x.Limit + return x.GasUnitPrice } return 0 } -type AccountTransactionsReply struct { +// Request to write a signed report to the Aptos chain via the CRE forwarder. +type WriteReportRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - Transactions []*Transaction `protobuf:"bytes,1,rep,name=transactions,proto3" json:"transactions,omitempty"` + Receiver []byte `protobuf:"bytes,1,opt,name=receiver,proto3" json:"receiver,omitempty"` // 32-byte Aptos account address (registry or receiver contract) + Report *sdk.ReportResponse `protobuf:"bytes,2,opt,name=report,proto3" json:"report,omitempty"` + GasConfig *GasConfig `protobuf:"bytes,3,opt,name=gas_config,json=gasConfig,proto3,oneof" json:"gas_config,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *AccountTransactionsReply) Reset() { - *x = AccountTransactionsReply{} - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AccountTransactionsReply) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AccountTransactionsReply) ProtoMessage() {} - -func (x *AccountTransactionsReply) ProtoReflect() protoreflect.Message { - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[14] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AccountTransactionsReply.ProtoReflect.Descriptor instead. -func (*AccountTransactionsReply) Descriptor() ([]byte, []int) { - return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{14} -} - -func (x *AccountTransactionsReply) GetTransactions() []*Transaction { - if x != nil { - return x.Transactions - } - return nil -} - -type SubmitTransactionRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - ReceiverModuleId *ModuleID `protobuf:"bytes,1,opt,name=receiver_module_id,json=receiverModuleId,proto3" json:"receiver_module_id,omitempty"` - EncodedPayload []byte `protobuf:"bytes,2,opt,name=encoded_payload,json=encodedPayload,proto3" json:"encoded_payload,omitempty"` - GasConfig *GasConfig `protobuf:"bytes,3,opt,name=gas_config,json=gasConfig,proto3,oneof" json:"gas_config,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *SubmitTransactionRequest) Reset() { - *x = SubmitTransactionRequest{} - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[15] +func (x *WriteReportRequest) Reset() { + *x = WriteReportRequest{} + mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *SubmitTransactionRequest) String() string { +func (x *WriteReportRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*SubmitTransactionRequest) ProtoMessage() {} +func (*WriteReportRequest) ProtoMessage() {} -func (x *SubmitTransactionRequest) ProtoReflect() protoreflect.Message { - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[15] +func (x *WriteReportRequest) ProtoReflect() protoreflect.Message { + mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[1] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1073,56 +164,57 @@ func (x *SubmitTransactionRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use SubmitTransactionRequest.ProtoReflect.Descriptor instead. -func (*SubmitTransactionRequest) Descriptor() ([]byte, []int) { - return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{15} +// Deprecated: Use WriteReportRequest.ProtoReflect.Descriptor instead. +func (*WriteReportRequest) Descriptor() ([]byte, []int) { + return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{1} } -func (x *SubmitTransactionRequest) GetReceiverModuleId() *ModuleID { +func (x *WriteReportRequest) GetReceiver() []byte { if x != nil { - return x.ReceiverModuleId + return x.Receiver } return nil } -func (x *SubmitTransactionRequest) GetEncodedPayload() []byte { +func (x *WriteReportRequest) GetReport() *sdk.ReportResponse { if x != nil { - return x.EncodedPayload + return x.Report } return nil } -func (x *SubmitTransactionRequest) GetGasConfig() *GasConfig { +func (x *WriteReportRequest) GetGasConfig() *GasConfig { if x != nil { return x.GasConfig } return nil } -type SubmitTransactionReply struct { - state protoimpl.MessageState `protogen:"open.v1"` - TxStatus TxStatus `protobuf:"varint,1,opt,name=tx_status,json=txStatus,proto3,enum=capabilities.blockchain.aptos.v1alpha.TxStatus" json:"tx_status,omitempty"` - TxHash string `protobuf:"bytes,2,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"` - TxIdempotencyKey string `protobuf:"bytes,3,opt,name=tx_idempotency_key,json=txIdempotencyKey,proto3" json:"tx_idempotency_key,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache +// Reply from writing a report to Aptos. +type WriteReportReply struct { + state protoimpl.MessageState `protogen:"open.v1"` + TxStatus TxStatus `protobuf:"varint,1,opt,name=tx_status,json=txStatus,proto3,enum=capabilities.blockchain.aptos.v1alpha.TxStatus" json:"tx_status,omitempty"` + TxHash []byte `protobuf:"bytes,2,opt,name=tx_hash,json=txHash,proto3,oneof" json:"tx_hash,omitempty"` + ErrorMessage *string `protobuf:"bytes,3,opt,name=error_message,json=errorMessage,proto3,oneof" json:"error_message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (x *SubmitTransactionReply) Reset() { - *x = SubmitTransactionReply{} - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[16] +func (x *WriteReportReply) Reset() { + *x = WriteReportReply{} + mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *SubmitTransactionReply) String() string { +func (x *WriteReportReply) String() string { return protoimpl.X.MessageStringOf(x) } -func (*SubmitTransactionReply) ProtoMessage() {} +func (*WriteReportReply) ProtoMessage() {} -func (x *SubmitTransactionReply) ProtoReflect() protoreflect.Message { - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[16] +func (x *WriteReportReply) ProtoReflect() protoreflect.Message { + mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[2] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1133,55 +225,57 @@ func (x *SubmitTransactionReply) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use SubmitTransactionReply.ProtoReflect.Descriptor instead. -func (*SubmitTransactionReply) Descriptor() ([]byte, []int) { - return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{16} +// Deprecated: Use WriteReportReply.ProtoReflect.Descriptor instead. +func (*WriteReportReply) Descriptor() ([]byte, []int) { + return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{2} } -func (x *SubmitTransactionReply) GetTxStatus() TxStatus { +func (x *WriteReportReply) GetTxStatus() TxStatus { if x != nil { return x.TxStatus } - return TxStatus_TX_STATUS_FATAL + return TxStatus_TX_STATUS_UNKNOWN } -func (x *SubmitTransactionReply) GetTxHash() string { +func (x *WriteReportReply) GetTxHash() []byte { if x != nil { return x.TxHash } - return "" + return nil } -func (x *SubmitTransactionReply) GetTxIdempotencyKey() string { - if x != nil { - return x.TxIdempotencyKey +func (x *WriteReportReply) GetErrorMessage() string { + if x != nil && x.ErrorMessage != nil { + return *x.ErrorMessage } return "" } -type GasConfig struct { +// Request to execute a view (read-only) call on the Aptos chain. +// Maps to Aptos REST API POST /v1/view: function (e.g. "0x1::coin::name") and arguments. +type ViewRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - MaxGasAmount uint64 `protobuf:"varint,1,opt,name=max_gas_amount,json=maxGasAmount,proto3" json:"max_gas_amount,omitempty"` // Maximum gas units willing to pay - GasUnitPrice uint64 `protobuf:"varint,2,opt,name=gas_unit_price,json=gasUnitPrice,proto3" json:"gas_unit_price,omitempty"` // Price per gas unit in octas + Function string `protobuf:"bytes,1,opt,name=function,proto3" json:"function,omitempty"` // Fully qualified function, e.g. "0x1::coin::name" + Arguments [][]byte `protobuf:"bytes,2,rep,name=arguments,proto3" json:"arguments,omitempty"` // BCS- or JSON-encoded arguments; empty for no args unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *GasConfig) Reset() { - *x = GasConfig{} - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[17] +func (x *ViewRequest) Reset() { + *x = ViewRequest{} + mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *GasConfig) String() string { +func (x *ViewRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GasConfig) ProtoMessage() {} +func (*ViewRequest) ProtoMessage() {} -func (x *GasConfig) ProtoReflect() protoreflect.Message { - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[17] +func (x *ViewRequest) ProtoReflect() protoreflect.Message { + mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[3] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1192,49 +286,48 @@ func (x *GasConfig) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GasConfig.ProtoReflect.Descriptor instead. -func (*GasConfig) Descriptor() ([]byte, []int) { - return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{17} +// Deprecated: Use ViewRequest.ProtoReflect.Descriptor instead. +func (*ViewRequest) Descriptor() ([]byte, []int) { + return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{3} } -func (x *GasConfig) GetMaxGasAmount() uint64 { +func (x *ViewRequest) GetFunction() string { if x != nil { - return x.MaxGasAmount + return x.Function } - return 0 + return "" } -func (x *GasConfig) GetGasUnitPrice() uint64 { +func (x *ViewRequest) GetArguments() [][]byte { if x != nil { - return x.GasUnitPrice + return x.Arguments } - return 0 + return nil } -type WriteReportRequest struct { +// Reply from a view call. Data is the raw response (e.g. JSON array from Aptos view API). +type ViewReply struct { state protoimpl.MessageState `protogen:"open.v1"` - Receiver []byte `protobuf:"bytes,1,opt,name=receiver,proto3" json:"receiver,omitempty"` // 32-byte Aptos account address of the receiver module - GasConfig *GasConfig `protobuf:"bytes,2,opt,name=gas_config,json=gasConfig,proto3,oneof" json:"gas_config,omitempty"` // optional gas configuration - Report *sdk.ReportResponse `protobuf:"bytes,3,opt,name=report,proto3" json:"report,omitempty"` // signed report from consensus + Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *WriteReportRequest) Reset() { - *x = WriteReportRequest{} - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[18] +func (x *ViewReply) Reset() { + *x = ViewReply{} + mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *WriteReportRequest) String() string { +func (x *ViewReply) String() string { return protoimpl.X.MessageStringOf(x) } -func (*WriteReportRequest) ProtoMessage() {} +func (*ViewReply) ProtoMessage() {} -func (x *WriteReportRequest) ProtoReflect() protoreflect.Message { - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[18] +func (x *ViewReply) ProtoReflect() protoreflect.Message { + mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[4] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1245,228 +338,53 @@ func (x *WriteReportRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use WriteReportRequest.ProtoReflect.Descriptor instead. -func (*WriteReportRequest) Descriptor() ([]byte, []int) { - return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{18} -} - -func (x *WriteReportRequest) GetReceiver() []byte { - if x != nil { - return x.Receiver - } - return nil -} - -func (x *WriteReportRequest) GetGasConfig() *GasConfig { - if x != nil { - return x.GasConfig - } - return nil +// Deprecated: Use ViewReply.ProtoReflect.Descriptor instead. +func (*ViewReply) Descriptor() ([]byte, []int) { + return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{4} } -func (x *WriteReportRequest) GetReport() *sdk.ReportResponse { +func (x *ViewReply) GetData() []byte { if x != nil { - return x.Report + return x.Data } return nil } -type WriteReportReply struct { - state protoimpl.MessageState `protogen:"open.v1"` - TxStatus TxStatus `protobuf:"varint,1,opt,name=tx_status,json=txStatus,proto3,enum=capabilities.blockchain.aptos.v1alpha.TxStatus" json:"tx_status,omitempty"` - TxHash *string `protobuf:"bytes,2,opt,name=tx_hash,json=txHash,proto3,oneof" json:"tx_hash,omitempty"` // transaction hash (hex string with 0x prefix) - TransactionFee *uint64 `protobuf:"varint,3,opt,name=transaction_fee,json=transactionFee,proto3,oneof" json:"transaction_fee,omitempty"` // gas used in octas - ErrorMessage *string `protobuf:"bytes,4,opt,name=error_message,json=errorMessage,proto3,oneof" json:"error_message,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *WriteReportReply) Reset() { - *x = WriteReportReply{} - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *WriteReportReply) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*WriteReportReply) ProtoMessage() {} - -func (x *WriteReportReply) ProtoReflect() protoreflect.Message { - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[19] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use WriteReportReply.ProtoReflect.Descriptor instead. -func (*WriteReportReply) Descriptor() ([]byte, []int) { - return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{19} -} - -func (x *WriteReportReply) GetTxStatus() TxStatus { - if x != nil { - return x.TxStatus - } - return TxStatus_TX_STATUS_FATAL -} - -func (x *WriteReportReply) GetTxHash() string { - if x != nil && x.TxHash != nil { - return *x.TxHash - } - return "" -} - -func (x *WriteReportReply) GetTransactionFee() uint64 { - if x != nil && x.TransactionFee != nil { - return *x.TransactionFee - } - return 0 -} - -func (x *WriteReportReply) GetErrorMessage() string { - if x != nil && x.ErrorMessage != nil { - return *x.ErrorMessage - } - return "" -} - var File_capabilities_blockchain_aptos_v1alpha_client_proto protoreflect.FileDescriptor const file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDesc = "" + "\n" + - "2capabilities/blockchain/aptos/v1alpha/client.proto\x12%capabilities.blockchain.aptos.v1alpha\x1a\x15sdk/v1alpha/sdk.proto\x1a*tools/generator/v1alpha/cre_metadata.proto\"4\n" + - "\x18AccountAPTBalanceRequest\x12\x18\n" + - "\aaddress\x18\x01 \x01(\fR\aaddress\".\n" + - "\x16AccountAPTBalanceReply\x12\x14\n" + - "\x05value\x18\x01 \x01(\x04R\x05value\"[\n" + - "\vViewRequest\x12L\n" + - "\apayload\x18\x01 \x01(\v22.capabilities.blockchain.aptos.v1alpha.ViewPayloadR\apayload\"\x1f\n" + - "\tViewReply\x12\x12\n" + - "\x04data\x18\x01 \x01(\fR\x04data\"\xd3\x01\n" + - "\vViewPayload\x12G\n" + - "\x06module\x18\x01 \x01(\v2/.capabilities.blockchain.aptos.v1alpha.ModuleIDR\x06module\x12\x1a\n" + - "\bfunction\x18\x02 \x01(\tR\bfunction\x12K\n" + - "\targ_types\x18\x03 \x03(\v2..capabilities.blockchain.aptos.v1alpha.TypeTagR\bargTypes\x12\x12\n" + - "\x04args\x18\x04 \x03(\fR\x04args\"8\n" + - "\bModuleID\x12\x18\n" + - "\aaddress\x18\x01 \x01(\fR\aaddress\x12\x12\n" + - "\x04name\x18\x02 \x01(\tR\x04name\"\xc1\x02\n" + - "\aTypeTag\x12F\n" + - "\x04kind\x18\x01 \x01(\x0e22.capabilities.blockchain.aptos.v1alpha.TypeTagKindR\x04kind\x12J\n" + - "\x06vector\x18\x02 \x01(\v20.capabilities.blockchain.aptos.v1alpha.VectorTagH\x00R\x06vector\x12J\n" + - "\x06struct\x18\x03 \x01(\v20.capabilities.blockchain.aptos.v1alpha.StructTagH\x00R\x06struct\x12M\n" + - "\ageneric\x18\x04 \x01(\v21.capabilities.blockchain.aptos.v1alpha.GenericTagH\x00R\agenericB\a\n" + - "\x05value\"^\n" + - "\tVectorTag\x12Q\n" + - "\felement_type\x18\x01 \x01(\v2..capabilities.blockchain.aptos.v1alpha.TypeTagR\velementType\"\xa2\x01\n" + - "\tStructTag\x12\x18\n" + - "\aaddress\x18\x01 \x01(\fR\aaddress\x12\x16\n" + - "\x06module\x18\x02 \x01(\tR\x06module\x12\x12\n" + - "\x04name\x18\x03 \x01(\tR\x04name\x12O\n" + - "\vtype_params\x18\x04 \x03(\v2..capabilities.blockchain.aptos.v1alpha.TypeTagR\n" + - "typeParams\"\"\n" + - "\n" + - "GenericTag\x12\x14\n" + - "\x05index\x18\x01 \x01(\rR\x05index\".\n" + - "\x18TransactionByHashRequest\x12\x12\n" + - "\x04hash\x18\x01 \x01(\tR\x04hash\"\x83\x01\n" + - "\x16TransactionByHashReply\x12Y\n" + - "\vtransaction\x18\x01 \x01(\v22.capabilities.blockchain.aptos.v1alpha.TransactionH\x00R\vtransaction\x88\x01\x01B\x0e\n" + - "\f_transaction\"\xda\x01\n" + - "\vTransaction\x12M\n" + - "\x04type\x18\x01 \x01(\x0e29.capabilities.blockchain.aptos.v1alpha.TransactionVariantR\x04type\x12\x12\n" + - "\x04hash\x18\x02 \x01(\tR\x04hash\x12\x1d\n" + - "\aversion\x18\x03 \x01(\x04H\x00R\aversion\x88\x01\x01\x12\x1d\n" + - "\asuccess\x18\x04 \x01(\bH\x01R\asuccess\x88\x01\x01\x12\x12\n" + - "\x04data\x18\x05 \x01(\fR\x04dataB\n" + - "\n" + - "\b_versionB\n" + - "\n" + - "\b_success\"\x80\x01\n" + - "\x1aAccountTransactionsRequest\x12\x18\n" + - "\aaddress\x18\x01 \x01(\fR\aaddress\x12\x19\n" + - "\x05start\x18\x02 \x01(\x04H\x00R\x05start\x88\x01\x01\x12\x19\n" + - "\x05limit\x18\x03 \x01(\x04H\x01R\x05limit\x88\x01\x01B\b\n" + - "\x06_startB\b\n" + - "\x06_limit\"r\n" + - "\x18AccountTransactionsReply\x12V\n" + - "\ftransactions\x18\x01 \x03(\v22.capabilities.blockchain.aptos.v1alpha.TransactionR\ftransactions\"\x87\x02\n" + - "\x18SubmitTransactionRequest\x12]\n" + - "\x12receiver_module_id\x18\x01 \x01(\v2/.capabilities.blockchain.aptos.v1alpha.ModuleIDR\x10receiverModuleId\x12'\n" + - "\x0fencoded_payload\x18\x02 \x01(\fR\x0eencodedPayload\x12T\n" + - "\n" + - "gas_config\x18\x03 \x01(\v20.capabilities.blockchain.aptos.v1alpha.GasConfigH\x00R\tgasConfig\x88\x01\x01B\r\n" + - "\v_gas_config\"\xad\x01\n" + - "\x16SubmitTransactionReply\x12L\n" + - "\ttx_status\x18\x01 \x01(\x0e2/.capabilities.blockchain.aptos.v1alpha.TxStatusR\btxStatus\x12\x17\n" + - "\atx_hash\x18\x02 \x01(\tR\x06txHash\x12,\n" + - "\x12tx_idempotency_key\x18\x03 \x01(\tR\x10txIdempotencyKey\"W\n" + + "2capabilities/blockchain/aptos/v1alpha/client.proto\x12%capabilities.blockchain.aptos.v1alpha\x1a\x15sdk/v1alpha/sdk.proto\x1a*tools/generator/v1alpha/cre_metadata.proto\"W\n" + "\tGasConfig\x12$\n" + "\x0emax_gas_amount\x18\x01 \x01(\x04R\fmaxGasAmount\x12$\n" + "\x0egas_unit_price\x18\x02 \x01(\x04R\fgasUnitPrice\"\xca\x01\n" + "\x12WriteReportRequest\x12\x1a\n" + - "\breceiver\x18\x01 \x01(\fR\breceiver\x12T\n" + + "\breceiver\x18\x01 \x01(\fR\breceiver\x123\n" + + "\x06report\x18\x02 \x01(\v2\x1b.sdk.v1alpha.ReportResponseR\x06report\x12T\n" + "\n" + - "gas_config\x18\x02 \x01(\v20.capabilities.blockchain.aptos.v1alpha.GasConfigH\x00R\tgasConfig\x88\x01\x01\x123\n" + - "\x06report\x18\x03 \x01(\v2\x1b.sdk.v1alpha.ReportResponseR\x06reportB\r\n" + - "\v_gas_config\"\x88\x02\n" + + "gas_config\x18\x03 \x01(\v20.capabilities.blockchain.aptos.v1alpha.GasConfigH\x00R\tgasConfig\x88\x01\x01B\r\n" + + "\v_gas_config\"\xc6\x01\n" + "\x10WriteReportReply\x12L\n" + "\ttx_status\x18\x01 \x01(\x0e2/.capabilities.blockchain.aptos.v1alpha.TxStatusR\btxStatus\x12\x1c\n" + - "\atx_hash\x18\x02 \x01(\tH\x00R\x06txHash\x88\x01\x01\x12,\n" + - "\x0ftransaction_fee\x18\x03 \x01(\x04H\x01R\x0etransactionFee\x88\x01\x01\x12(\n" + - "\rerror_message\x18\x04 \x01(\tH\x02R\ferrorMessage\x88\x01\x01B\n" + + "\atx_hash\x18\x02 \x01(\fH\x00R\x06txHash\x88\x01\x01\x12(\n" + + "\rerror_message\x18\x03 \x01(\tH\x01R\ferrorMessage\x88\x01\x01B\n" + "\n" + - "\b_tx_hashB\x12\n" + - "\x10_transaction_feeB\x10\n" + - "\x0e_error_message*M\n" + - "\bTxStatus\x12\x13\n" + - "\x0fTX_STATUS_FATAL\x10\x00\x12\x15\n" + - "\x11TX_STATUS_ABORTED\x10\x01\x12\x15\n" + - "\x11TX_STATUS_SUCCESS\x10\x02*\xb4\x02\n" + - "\vTypeTagKind\x12\x16\n" + - "\x12TYPE_TAG_KIND_BOOL\x10\x00\x12\x14\n" + - "\x10TYPE_TAG_KIND_U8\x10\x01\x12\x15\n" + - "\x11TYPE_TAG_KIND_U16\x10\x02\x12\x15\n" + - "\x11TYPE_TAG_KIND_U32\x10\x03\x12\x15\n" + - "\x11TYPE_TAG_KIND_U64\x10\x04\x12\x16\n" + - "\x12TYPE_TAG_KIND_U128\x10\x05\x12\x16\n" + - "\x12TYPE_TAG_KIND_U256\x10\x06\x12\x19\n" + - "\x15TYPE_TAG_KIND_ADDRESS\x10\a\x12\x18\n" + - "\x14TYPE_TAG_KIND_SIGNER\x10\b\x12\x18\n" + - "\x14TYPE_TAG_KIND_VECTOR\x10\t\x12\x18\n" + - "\x14TYPE_TAG_KIND_STRUCT\x10\n" + - "\x12\x19\n" + - "\x15TYPE_TAG_KIND_GENERIC\x10\v*\xb2\x02\n" + - "\x12TransactionVariant\x12\x1f\n" + - "\x1bTRANSACTION_VARIANT_PENDING\x10\x00\x12\x1c\n" + - "\x18TRANSACTION_VARIANT_USER\x10\x01\x12\x1f\n" + - "\x1bTRANSACTION_VARIANT_GENESIS\x10\x02\x12&\n" + - "\"TRANSACTION_VARIANT_BLOCK_METADATA\x10\x03\x12&\n" + - "\"TRANSACTION_VARIANT_BLOCK_EPILOGUE\x10\x04\x12(\n" + - "$TRANSACTION_VARIANT_STATE_CHECKPOINT\x10\x05\x12!\n" + - "\x1dTRANSACTION_VARIANT_VALIDATOR\x10\x06\x12\x1f\n" + - "\x1bTRANSACTION_VARIANT_UNKNOWN\x10\a2\xa2\x06\n" + - "\x06Client\x12\x93\x01\n" + - "\x11AccountAPTBalance\x12?.capabilities.blockchain.aptos.v1alpha.AccountAPTBalanceRequest\x1a=.capabilities.blockchain.aptos.v1alpha.AccountAPTBalanceReply\x12l\n" + - "\x04View\x122.capabilities.blockchain.aptos.v1alpha.ViewRequest\x1a0.capabilities.blockchain.aptos.v1alpha.ViewReply\x12\x93\x01\n" + - "\x11TransactionByHash\x12?.capabilities.blockchain.aptos.v1alpha.TransactionByHashRequest\x1a=.capabilities.blockchain.aptos.v1alpha.TransactionByHashReply\x12\x99\x01\n" + - "\x13AccountTransactions\x12A.capabilities.blockchain.aptos.v1alpha.AccountTransactionsRequest\x1a?.capabilities.blockchain.aptos.v1alpha.AccountTransactionsReply\x12\x81\x01\n" + - "\vWriteReport\x129.capabilities.blockchain.aptos.v1alpha.WriteReportRequest\x1a7.capabilities.blockchain.aptos.v1alpha.WriteReportReply\x1a^\x82\xb5\x18Z\b\x01\x12\vaptos@1.0.0\x1aI\n" + - "\rChainSelector\x128\x126\n" + - "\x19\n" + - "\raptos-mainnet\x10\ued42\x90\x9b\x99\xbd\xe6A\n" + - "\x19\n" + - "\raptos-testnet\x10\x95҆\x9e\xe3\xfd\x94\xa8\n" + - "b\x06proto3" + "\b_tx_hashB\x10\n" + + "\x0e_error_message\"G\n" + + "\vViewRequest\x12\x1a\n" + + "\bfunction\x18\x01 \x01(\tR\bfunction\x12\x1c\n" + + "\targuments\x18\x02 \x03(\fR\targuments\"\x1f\n" + + "\tViewReply\x12\x12\n" + + "\x04data\x18\x01 \x01(\fR\x04data*e\n" + + "\bTxStatus\x12\x15\n" + + "\x11TX_STATUS_UNKNOWN\x10\x00\x12\x15\n" + + "\x11TX_STATUS_PENDING\x10\x01\x12\x15\n" + + "\x11TX_STATUS_SUCCESS\x10\x02\x12\x14\n" + + "\x10TX_STATUS_FAILED\x10\x032\xa4\x02\n" + + "\x06Client\x12\x81\x01\n" + + "\vWriteReport\x129.capabilities.blockchain.aptos.v1alpha.WriteReportRequest\x1a7.capabilities.blockchain.aptos.v1alpha.WriteReportReply\x12l\n" + + "\x04View\x122.capabilities.blockchain.aptos.v1alpha.ViewRequest\x1a0.capabilities.blockchain.aptos.v1alpha.ViewReply\x1a(\x82\xb5\x18$\b\x01\x12\vaptos@1.0.0\x1a\x13\n" + + "\rChainSelector\x12\x02\x12\x00b\x06proto3" var ( file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescOnce sync.Once @@ -1480,68 +398,30 @@ func file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP() []byt return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescData } -var file_capabilities_blockchain_aptos_v1alpha_client_proto_enumTypes = make([]protoimpl.EnumInfo, 3) -var file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes = make([]protoimpl.MessageInfo, 20) +var file_capabilities_blockchain_aptos_v1alpha_client_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_capabilities_blockchain_aptos_v1alpha_client_proto_goTypes = []any{ - (TxStatus)(0), // 0: capabilities.blockchain.aptos.v1alpha.TxStatus - (TypeTagKind)(0), // 1: capabilities.blockchain.aptos.v1alpha.TypeTagKind - (TransactionVariant)(0), // 2: capabilities.blockchain.aptos.v1alpha.TransactionVariant - (*AccountAPTBalanceRequest)(nil), // 3: capabilities.blockchain.aptos.v1alpha.AccountAPTBalanceRequest - (*AccountAPTBalanceReply)(nil), // 4: capabilities.blockchain.aptos.v1alpha.AccountAPTBalanceReply - (*ViewRequest)(nil), // 5: capabilities.blockchain.aptos.v1alpha.ViewRequest - (*ViewReply)(nil), // 6: capabilities.blockchain.aptos.v1alpha.ViewReply - (*ViewPayload)(nil), // 7: capabilities.blockchain.aptos.v1alpha.ViewPayload - (*ModuleID)(nil), // 8: capabilities.blockchain.aptos.v1alpha.ModuleID - (*TypeTag)(nil), // 9: capabilities.blockchain.aptos.v1alpha.TypeTag - (*VectorTag)(nil), // 10: capabilities.blockchain.aptos.v1alpha.VectorTag - (*StructTag)(nil), // 11: capabilities.blockchain.aptos.v1alpha.StructTag - (*GenericTag)(nil), // 12: capabilities.blockchain.aptos.v1alpha.GenericTag - (*TransactionByHashRequest)(nil), // 13: capabilities.blockchain.aptos.v1alpha.TransactionByHashRequest - (*TransactionByHashReply)(nil), // 14: capabilities.blockchain.aptos.v1alpha.TransactionByHashReply - (*Transaction)(nil), // 15: capabilities.blockchain.aptos.v1alpha.Transaction - (*AccountTransactionsRequest)(nil), // 16: capabilities.blockchain.aptos.v1alpha.AccountTransactionsRequest - (*AccountTransactionsReply)(nil), // 17: capabilities.blockchain.aptos.v1alpha.AccountTransactionsReply - (*SubmitTransactionRequest)(nil), // 18: capabilities.blockchain.aptos.v1alpha.SubmitTransactionRequest - (*SubmitTransactionReply)(nil), // 19: capabilities.blockchain.aptos.v1alpha.SubmitTransactionReply - (*GasConfig)(nil), // 20: capabilities.blockchain.aptos.v1alpha.GasConfig - (*WriteReportRequest)(nil), // 21: capabilities.blockchain.aptos.v1alpha.WriteReportRequest - (*WriteReportReply)(nil), // 22: capabilities.blockchain.aptos.v1alpha.WriteReportReply - (*sdk.ReportResponse)(nil), // 23: sdk.v1alpha.ReportResponse + (TxStatus)(0), // 0: capabilities.blockchain.aptos.v1alpha.TxStatus + (*GasConfig)(nil), // 1: capabilities.blockchain.aptos.v1alpha.GasConfig + (*WriteReportRequest)(nil), // 2: capabilities.blockchain.aptos.v1alpha.WriteReportRequest + (*WriteReportReply)(nil), // 3: capabilities.blockchain.aptos.v1alpha.WriteReportReply + (*ViewRequest)(nil), // 4: capabilities.blockchain.aptos.v1alpha.ViewRequest + (*ViewReply)(nil), // 5: capabilities.blockchain.aptos.v1alpha.ViewReply + (*sdk.ReportResponse)(nil), // 6: sdk.v1alpha.ReportResponse } var file_capabilities_blockchain_aptos_v1alpha_client_proto_depIdxs = []int32{ - 7, // 0: capabilities.blockchain.aptos.v1alpha.ViewRequest.payload:type_name -> capabilities.blockchain.aptos.v1alpha.ViewPayload - 8, // 1: capabilities.blockchain.aptos.v1alpha.ViewPayload.module:type_name -> capabilities.blockchain.aptos.v1alpha.ModuleID - 9, // 2: capabilities.blockchain.aptos.v1alpha.ViewPayload.arg_types:type_name -> capabilities.blockchain.aptos.v1alpha.TypeTag - 1, // 3: capabilities.blockchain.aptos.v1alpha.TypeTag.kind:type_name -> capabilities.blockchain.aptos.v1alpha.TypeTagKind - 10, // 4: capabilities.blockchain.aptos.v1alpha.TypeTag.vector:type_name -> capabilities.blockchain.aptos.v1alpha.VectorTag - 11, // 5: capabilities.blockchain.aptos.v1alpha.TypeTag.struct:type_name -> capabilities.blockchain.aptos.v1alpha.StructTag - 12, // 6: capabilities.blockchain.aptos.v1alpha.TypeTag.generic:type_name -> capabilities.blockchain.aptos.v1alpha.GenericTag - 9, // 7: capabilities.blockchain.aptos.v1alpha.VectorTag.element_type:type_name -> capabilities.blockchain.aptos.v1alpha.TypeTag - 9, // 8: capabilities.blockchain.aptos.v1alpha.StructTag.type_params:type_name -> capabilities.blockchain.aptos.v1alpha.TypeTag - 15, // 9: capabilities.blockchain.aptos.v1alpha.TransactionByHashReply.transaction:type_name -> capabilities.blockchain.aptos.v1alpha.Transaction - 2, // 10: capabilities.blockchain.aptos.v1alpha.Transaction.type:type_name -> capabilities.blockchain.aptos.v1alpha.TransactionVariant - 15, // 11: capabilities.blockchain.aptos.v1alpha.AccountTransactionsReply.transactions:type_name -> capabilities.blockchain.aptos.v1alpha.Transaction - 8, // 12: capabilities.blockchain.aptos.v1alpha.SubmitTransactionRequest.receiver_module_id:type_name -> capabilities.blockchain.aptos.v1alpha.ModuleID - 20, // 13: capabilities.blockchain.aptos.v1alpha.SubmitTransactionRequest.gas_config:type_name -> capabilities.blockchain.aptos.v1alpha.GasConfig - 0, // 14: capabilities.blockchain.aptos.v1alpha.SubmitTransactionReply.tx_status:type_name -> capabilities.blockchain.aptos.v1alpha.TxStatus - 20, // 15: capabilities.blockchain.aptos.v1alpha.WriteReportRequest.gas_config:type_name -> capabilities.blockchain.aptos.v1alpha.GasConfig - 23, // 16: capabilities.blockchain.aptos.v1alpha.WriteReportRequest.report:type_name -> sdk.v1alpha.ReportResponse - 0, // 17: capabilities.blockchain.aptos.v1alpha.WriteReportReply.tx_status:type_name -> capabilities.blockchain.aptos.v1alpha.TxStatus - 3, // 18: capabilities.blockchain.aptos.v1alpha.Client.AccountAPTBalance:input_type -> capabilities.blockchain.aptos.v1alpha.AccountAPTBalanceRequest - 5, // 19: capabilities.blockchain.aptos.v1alpha.Client.View:input_type -> capabilities.blockchain.aptos.v1alpha.ViewRequest - 13, // 20: capabilities.blockchain.aptos.v1alpha.Client.TransactionByHash:input_type -> capabilities.blockchain.aptos.v1alpha.TransactionByHashRequest - 16, // 21: capabilities.blockchain.aptos.v1alpha.Client.AccountTransactions:input_type -> capabilities.blockchain.aptos.v1alpha.AccountTransactionsRequest - 21, // 22: capabilities.blockchain.aptos.v1alpha.Client.WriteReport:input_type -> capabilities.blockchain.aptos.v1alpha.WriteReportRequest - 4, // 23: capabilities.blockchain.aptos.v1alpha.Client.AccountAPTBalance:output_type -> capabilities.blockchain.aptos.v1alpha.AccountAPTBalanceReply - 6, // 24: capabilities.blockchain.aptos.v1alpha.Client.View:output_type -> capabilities.blockchain.aptos.v1alpha.ViewReply - 14, // 25: capabilities.blockchain.aptos.v1alpha.Client.TransactionByHash:output_type -> capabilities.blockchain.aptos.v1alpha.TransactionByHashReply - 17, // 26: capabilities.blockchain.aptos.v1alpha.Client.AccountTransactions:output_type -> capabilities.blockchain.aptos.v1alpha.AccountTransactionsReply - 22, // 27: capabilities.blockchain.aptos.v1alpha.Client.WriteReport:output_type -> capabilities.blockchain.aptos.v1alpha.WriteReportReply - 23, // [23:28] is the sub-list for method output_type - 18, // [18:23] is the sub-list for method input_type - 18, // [18:18] is the sub-list for extension type_name - 18, // [18:18] is the sub-list for extension extendee - 0, // [0:18] is the sub-list for field type_name + 6, // 0: capabilities.blockchain.aptos.v1alpha.WriteReportRequest.report:type_name -> sdk.v1alpha.ReportResponse + 1, // 1: capabilities.blockchain.aptos.v1alpha.WriteReportRequest.gas_config:type_name -> capabilities.blockchain.aptos.v1alpha.GasConfig + 0, // 2: capabilities.blockchain.aptos.v1alpha.WriteReportReply.tx_status:type_name -> capabilities.blockchain.aptos.v1alpha.TxStatus + 2, // 3: capabilities.blockchain.aptos.v1alpha.Client.WriteReport:input_type -> capabilities.blockchain.aptos.v1alpha.WriteReportRequest + 4, // 4: capabilities.blockchain.aptos.v1alpha.Client.View:input_type -> capabilities.blockchain.aptos.v1alpha.ViewRequest + 3, // 5: capabilities.blockchain.aptos.v1alpha.Client.WriteReport:output_type -> capabilities.blockchain.aptos.v1alpha.WriteReportReply + 5, // 6: capabilities.blockchain.aptos.v1alpha.Client.View:output_type -> capabilities.blockchain.aptos.v1alpha.ViewReply + 5, // [5:7] is the sub-list for method output_type + 3, // [3:5] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name } func init() { file_capabilities_blockchain_aptos_v1alpha_client_proto_init() } @@ -1549,24 +429,15 @@ func file_capabilities_blockchain_aptos_v1alpha_client_proto_init() { if File_capabilities_blockchain_aptos_v1alpha_client_proto != nil { return } - file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[6].OneofWrappers = []any{ - (*TypeTag_Vector)(nil), - (*TypeTag_Struct)(nil), - (*TypeTag_Generic)(nil), - } - file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[11].OneofWrappers = []any{} - file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[12].OneofWrappers = []any{} - file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[13].OneofWrappers = []any{} - file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[15].OneofWrappers = []any{} - file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[18].OneofWrappers = []any{} - file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[19].OneofWrappers = []any{} + file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[1].OneofWrappers = []any{} + file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[2].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDesc), len(file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDesc)), - NumEnums: 3, - NumMessages: 20, + NumEnums: 1, + NumMessages: 5, NumExtensions: 0, NumServices: 1, }, diff --git a/pkg/capabilities/v2/chain-capabilities/aptos/generate.go b/pkg/capabilities/v2/chain-capabilities/aptos/generate.go index e4b2cbb94..22f618403 100644 --- a/pkg/capabilities/v2/chain-capabilities/aptos/generate.go +++ b/pkg/capabilities/v2/chain-capabilities/aptos/generate.go @@ -1,2 +1,6 @@ +// After changing the Aptos capability proto (e.g. adding the View RPC), run: +// go generate . +// from this directory so that client.pb.go and server/client_server_gen.go are regenerated +// (same codegen path as EVM/Solana; do not hand-edit the generated server). //go:generate go run ../../gen --pkg=github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/chain-capabilities/aptos --file=capabilities/blockchain/aptos/v1alpha/client.proto package aptos diff --git a/pkg/capabilities/v2/chain-capabilities/aptos/server/client_server_gen.go b/pkg/capabilities/v2/chain-capabilities/aptos/server/client_server_gen.go index 9292bd029..ab62b781c 100644 --- a/pkg/capabilities/v2/chain-capabilities/aptos/server/client_server_gen.go +++ b/pkg/capabilities/v2/chain-capabilities/aptos/server/client_server_gen.go @@ -20,16 +20,10 @@ import ( var _ = emptypb.Empty{} type ClientCapability interface { - AccountAPTBalance(ctx context.Context, metadata capabilities.RequestMetadata, input *aptos.AccountAPTBalanceRequest) (*capabilities.ResponseAndMetadata[*aptos.AccountAPTBalanceReply], caperrors.Error) + WriteReport(ctx context.Context, metadata capabilities.RequestMetadata, input *aptos.WriteReportRequest) (*capabilities.ResponseAndMetadata[*aptos.WriteReportReply], caperrors.Error) View(ctx context.Context, metadata capabilities.RequestMetadata, input *aptos.ViewRequest) (*capabilities.ResponseAndMetadata[*aptos.ViewReply], caperrors.Error) - TransactionByHash(ctx context.Context, metadata capabilities.RequestMetadata, input *aptos.TransactionByHashRequest) (*capabilities.ResponseAndMetadata[*aptos.TransactionByHashReply], caperrors.Error) - - AccountTransactions(ctx context.Context, metadata capabilities.RequestMetadata, input *aptos.AccountTransactionsRequest) (*capabilities.ResponseAndMetadata[*aptos.AccountTransactionsReply], caperrors.Error) - - WriteReport(ctx context.Context, metadata capabilities.RequestMetadata, input *aptos.WriteReportRequest) (*capabilities.ResponseAndMetadata[*aptos.WriteReportReply], caperrors.Error) - ChainSelector() uint64 Start(ctx context.Context) error @@ -118,10 +112,6 @@ func (c *clientCapability) UnregisterTrigger(ctx context.Context, request capabi return fmt.Errorf("trigger %s not found", request.Method) } -func (c *clientCapability) AckEvent(ctx context.Context, triggerId string, eventId string, method string) error { - return fmt.Errorf("trigger %s not found", method) -} - func (c *clientCapability) RegisterToWorkflow(ctx context.Context, request capabilities.RegisterToWorkflowRequest) error { return nil } @@ -133,16 +123,16 @@ func (c *clientCapability) UnregisterFromWorkflow(ctx context.Context, request c func (c *clientCapability) Execute(ctx context.Context, request capabilities.CapabilityRequest) (capabilities.CapabilityResponse, error) { response := capabilities.CapabilityResponse{} switch request.Method { - case "AccountAPTBalance": - input := &aptos.AccountAPTBalanceRequest{} + case "WriteReport": + input := &aptos.WriteReportRequest{} config := &emptypb.Empty{} - wrapped := func(ctx context.Context, metadata capabilities.RequestMetadata, input *aptos.AccountAPTBalanceRequest, _ *emptypb.Empty) (*aptos.AccountAPTBalanceReply, capabilities.ResponseMetadata, error) { - output, err := c.ClientCapability.AccountAPTBalance(ctx, metadata, input) + wrapped := func(ctx context.Context, metadata capabilities.RequestMetadata, input *aptos.WriteReportRequest, _ *emptypb.Empty) (*aptos.WriteReportReply, capabilities.ResponseMetadata, error) { + output, err := c.ClientCapability.WriteReport(ctx, metadata, input) if err != nil { return nil, capabilities.ResponseMetadata{}, err } if output == nil { - return nil, capabilities.ResponseMetadata{}, fmt.Errorf("output and error is nil for method AccountAPTBalance(..) (if output is nil error must be present)") + return nil, capabilities.ResponseMetadata{}, fmt.Errorf("output and error is nil for method WriteReport(..) (if output is nil error must be present)") } return output.Response, output.ResponseMetadata, err } @@ -161,48 +151,6 @@ func (c *clientCapability) Execute(ctx context.Context, request capabilities.Cap return output.Response, output.ResponseMetadata, err } return capabilities.Execute(ctx, request, input, config, wrapped) - case "TransactionByHash": - input := &aptos.TransactionByHashRequest{} - config := &emptypb.Empty{} - wrapped := func(ctx context.Context, metadata capabilities.RequestMetadata, input *aptos.TransactionByHashRequest, _ *emptypb.Empty) (*aptos.TransactionByHashReply, capabilities.ResponseMetadata, error) { - output, err := c.ClientCapability.TransactionByHash(ctx, metadata, input) - if err != nil { - return nil, capabilities.ResponseMetadata{}, err - } - if output == nil { - return nil, capabilities.ResponseMetadata{}, fmt.Errorf("output and error is nil for method TransactionByHash(..) (if output is nil error must be present)") - } - return output.Response, output.ResponseMetadata, err - } - return capabilities.Execute(ctx, request, input, config, wrapped) - case "AccountTransactions": - input := &aptos.AccountTransactionsRequest{} - config := &emptypb.Empty{} - wrapped := func(ctx context.Context, metadata capabilities.RequestMetadata, input *aptos.AccountTransactionsRequest, _ *emptypb.Empty) (*aptos.AccountTransactionsReply, capabilities.ResponseMetadata, error) { - output, err := c.ClientCapability.AccountTransactions(ctx, metadata, input) - if err != nil { - return nil, capabilities.ResponseMetadata{}, err - } - if output == nil { - return nil, capabilities.ResponseMetadata{}, fmt.Errorf("output and error is nil for method AccountTransactions(..) (if output is nil error must be present)") - } - return output.Response, output.ResponseMetadata, err - } - return capabilities.Execute(ctx, request, input, config, wrapped) - case "WriteReport": - input := &aptos.WriteReportRequest{} - config := &emptypb.Empty{} - wrapped := func(ctx context.Context, metadata capabilities.RequestMetadata, input *aptos.WriteReportRequest, _ *emptypb.Empty) (*aptos.WriteReportReply, capabilities.ResponseMetadata, error) { - output, err := c.ClientCapability.WriteReport(ctx, metadata, input) - if err != nil { - return nil, capabilities.ResponseMetadata{}, err - } - if output == nil { - return nil, capabilities.ResponseMetadata{}, fmt.Errorf("output and error is nil for method WriteReport(..) (if output is nil error must be present)") - } - return output.Response, output.ResponseMetadata, err - } - return capabilities.Execute(ctx, request, input, config, wrapped) default: return response, fmt.Errorf("method %s not found", request.Method) } diff --git a/pkg/chains/aptos/aptos.pb.go b/pkg/chains/aptos/aptos.pb.go index 1578de42c..7bccb0c4c 100644 --- a/pkg/chains/aptos/aptos.pb.go +++ b/pkg/chains/aptos/aptos.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.11 -// protoc v5.29.3 +// protoc-gen-go v1.36.10 +// protoc v5.27.3 // source: aptos.proto package aptos @@ -21,79 +21,79 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -type TypeTagKind int32 +type TypeTagType int32 const ( - TypeTagKind_TYPE_TAG_KIND_BOOL TypeTagKind = 0 - TypeTagKind_TYPE_TAG_KIND_U8 TypeTagKind = 1 - TypeTagKind_TYPE_TAG_KIND_U16 TypeTagKind = 2 - TypeTagKind_TYPE_TAG_KIND_U32 TypeTagKind = 3 - TypeTagKind_TYPE_TAG_KIND_U64 TypeTagKind = 4 - TypeTagKind_TYPE_TAG_KIND_U128 TypeTagKind = 5 - TypeTagKind_TYPE_TAG_KIND_U256 TypeTagKind = 6 - TypeTagKind_TYPE_TAG_KIND_ADDRESS TypeTagKind = 7 - TypeTagKind_TYPE_TAG_KIND_SIGNER TypeTagKind = 8 - TypeTagKind_TYPE_TAG_KIND_VECTOR TypeTagKind = 9 - TypeTagKind_TYPE_TAG_KIND_STRUCT TypeTagKind = 10 - TypeTagKind_TYPE_TAG_KIND_GENERIC TypeTagKind = 11 + TypeTagType_TYPE_TAG_BOOL TypeTagType = 0 + TypeTagType_TYPE_TAG_U8 TypeTagType = 1 + TypeTagType_TYPE_TAG_U16 TypeTagType = 2 + TypeTagType_TYPE_TAG_U32 TypeTagType = 3 + TypeTagType_TYPE_TAG_U64 TypeTagType = 4 + TypeTagType_TYPE_TAG_U128 TypeTagType = 5 + TypeTagType_TYPE_TAG_U256 TypeTagType = 6 + TypeTagType_TYPE_TAG_ADDRESS TypeTagType = 7 + TypeTagType_TYPE_TAG_SIGNER TypeTagType = 8 + TypeTagType_TYPE_TAG_VECTOR TypeTagType = 9 + TypeTagType_TYPE_TAG_STRUCT TypeTagType = 10 + TypeTagType_TYPE_TAG_GENERIC TypeTagType = 11 ) -// Enum value maps for TypeTagKind. +// Enum value maps for TypeTagType. var ( - TypeTagKind_name = map[int32]string{ - 0: "TYPE_TAG_KIND_BOOL", - 1: "TYPE_TAG_KIND_U8", - 2: "TYPE_TAG_KIND_U16", - 3: "TYPE_TAG_KIND_U32", - 4: "TYPE_TAG_KIND_U64", - 5: "TYPE_TAG_KIND_U128", - 6: "TYPE_TAG_KIND_U256", - 7: "TYPE_TAG_KIND_ADDRESS", - 8: "TYPE_TAG_KIND_SIGNER", - 9: "TYPE_TAG_KIND_VECTOR", - 10: "TYPE_TAG_KIND_STRUCT", - 11: "TYPE_TAG_KIND_GENERIC", - } - TypeTagKind_value = map[string]int32{ - "TYPE_TAG_KIND_BOOL": 0, - "TYPE_TAG_KIND_U8": 1, - "TYPE_TAG_KIND_U16": 2, - "TYPE_TAG_KIND_U32": 3, - "TYPE_TAG_KIND_U64": 4, - "TYPE_TAG_KIND_U128": 5, - "TYPE_TAG_KIND_U256": 6, - "TYPE_TAG_KIND_ADDRESS": 7, - "TYPE_TAG_KIND_SIGNER": 8, - "TYPE_TAG_KIND_VECTOR": 9, - "TYPE_TAG_KIND_STRUCT": 10, - "TYPE_TAG_KIND_GENERIC": 11, + TypeTagType_name = map[int32]string{ + 0: "TYPE_TAG_BOOL", + 1: "TYPE_TAG_U8", + 2: "TYPE_TAG_U16", + 3: "TYPE_TAG_U32", + 4: "TYPE_TAG_U64", + 5: "TYPE_TAG_U128", + 6: "TYPE_TAG_U256", + 7: "TYPE_TAG_ADDRESS", + 8: "TYPE_TAG_SIGNER", + 9: "TYPE_TAG_VECTOR", + 10: "TYPE_TAG_STRUCT", + 11: "TYPE_TAG_GENERIC", + } + TypeTagType_value = map[string]int32{ + "TYPE_TAG_BOOL": 0, + "TYPE_TAG_U8": 1, + "TYPE_TAG_U16": 2, + "TYPE_TAG_U32": 3, + "TYPE_TAG_U64": 4, + "TYPE_TAG_U128": 5, + "TYPE_TAG_U256": 6, + "TYPE_TAG_ADDRESS": 7, + "TYPE_TAG_SIGNER": 8, + "TYPE_TAG_VECTOR": 9, + "TYPE_TAG_STRUCT": 10, + "TYPE_TAG_GENERIC": 11, } ) -func (x TypeTagKind) Enum() *TypeTagKind { - p := new(TypeTagKind) +func (x TypeTagType) Enum() *TypeTagType { + p := new(TypeTagType) *p = x return p } -func (x TypeTagKind) String() string { +func (x TypeTagType) String() string { return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } -func (TypeTagKind) Descriptor() protoreflect.EnumDescriptor { +func (TypeTagType) Descriptor() protoreflect.EnumDescriptor { return file_aptos_proto_enumTypes[0].Descriptor() } -func (TypeTagKind) Type() protoreflect.EnumType { +func (TypeTagType) Type() protoreflect.EnumType { return &file_aptos_proto_enumTypes[0] } -func (x TypeTagKind) Number() protoreflect.EnumNumber { +func (x TypeTagType) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } -// Deprecated: Use TypeTagKind.Descriptor instead. -func (TypeTagKind) EnumDescriptor() ([]byte, []int) { +// Deprecated: Use TypeTagType.Descriptor instead. +func (TypeTagType) EnumDescriptor() ([]byte, []int) { return file_aptos_proto_rawDescGZIP(), []int{0} } @@ -161,53 +161,84 @@ func (TransactionVariant) EnumDescriptor() ([]byte, []int) { return file_aptos_proto_rawDescGZIP(), []int{1} } -type TxStatus int32 +type LedgerVersionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} -const ( - TxStatus_TX_STATUS_FATAL TxStatus = 0 // Transaction processing failed due to a network issue, RPC issue, or other fatal error - TxStatus_TX_STATUS_REVERTED TxStatus = 1 // Transaction was sent successfully but the smart contract execution reverted - TxStatus_TX_STATUS_SUCCESS TxStatus = 2 // Transaction was sent successfully, executed and mined into a block -) +func (x *LedgerVersionRequest) Reset() { + *x = LedgerVersionRequest{} + mi := &file_aptos_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} -// Enum value maps for TxStatus. -var ( - TxStatus_name = map[int32]string{ - 0: "TX_STATUS_FATAL", - 1: "TX_STATUS_REVERTED", - 2: "TX_STATUS_SUCCESS", - } - TxStatus_value = map[string]int32{ - "TX_STATUS_FATAL": 0, - "TX_STATUS_REVERTED": 1, - "TX_STATUS_SUCCESS": 2, +func (x *LedgerVersionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LedgerVersionRequest) ProtoMessage() {} + +func (x *LedgerVersionRequest) ProtoReflect() protoreflect.Message { + mi := &file_aptos_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } -) + return mi.MessageOf(x) +} -func (x TxStatus) Enum() *TxStatus { - p := new(TxStatus) - *p = x - return p +// Deprecated: Use LedgerVersionRequest.ProtoReflect.Descriptor instead. +func (*LedgerVersionRequest) Descriptor() ([]byte, []int) { + return file_aptos_proto_rawDescGZIP(), []int{0} } -func (x TxStatus) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +type LedgerVersionReply struct { + state protoimpl.MessageState `protogen:"open.v1"` + LedgerVersion uint64 `protobuf:"varint,1,opt,name=ledger_version,json=ledgerVersion,proto3" json:"ledger_version,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (TxStatus) Descriptor() protoreflect.EnumDescriptor { - return file_aptos_proto_enumTypes[2].Descriptor() +func (x *LedgerVersionReply) Reset() { + *x = LedgerVersionReply{} + mi := &file_aptos_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (TxStatus) Type() protoreflect.EnumType { - return &file_aptos_proto_enumTypes[2] +func (x *LedgerVersionReply) String() string { + return protoimpl.X.MessageStringOf(x) } -func (x TxStatus) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) +func (*LedgerVersionReply) ProtoMessage() {} + +func (x *LedgerVersionReply) ProtoReflect() protoreflect.Message { + mi := &file_aptos_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -// Deprecated: Use TxStatus.Descriptor instead. -func (TxStatus) EnumDescriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{2} +// Deprecated: Use LedgerVersionReply.ProtoReflect.Descriptor instead. +func (*LedgerVersionReply) Descriptor() ([]byte, []int) { + return file_aptos_proto_rawDescGZIP(), []int{1} +} + +func (x *LedgerVersionReply) GetLedgerVersion() uint64 { + if x != nil { + return x.LedgerVersion + } + return 0 } type AccountAPTBalanceRequest struct { @@ -219,7 +250,7 @@ type AccountAPTBalanceRequest struct { func (x *AccountAPTBalanceRequest) Reset() { *x = AccountAPTBalanceRequest{} - mi := &file_aptos_proto_msgTypes[0] + mi := &file_aptos_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -231,7 +262,7 @@ func (x *AccountAPTBalanceRequest) String() string { func (*AccountAPTBalanceRequest) ProtoMessage() {} func (x *AccountAPTBalanceRequest) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[0] + mi := &file_aptos_proto_msgTypes[2] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -244,7 +275,7 @@ func (x *AccountAPTBalanceRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use AccountAPTBalanceRequest.ProtoReflect.Descriptor instead. func (*AccountAPTBalanceRequest) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{0} + return file_aptos_proto_rawDescGZIP(), []int{2} } func (x *AccountAPTBalanceRequest) GetAddress() []byte { @@ -263,7 +294,7 @@ type AccountAPTBalanceReply struct { func (x *AccountAPTBalanceReply) Reset() { *x = AccountAPTBalanceReply{} - mi := &file_aptos_proto_msgTypes[1] + mi := &file_aptos_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -275,7 +306,7 @@ func (x *AccountAPTBalanceReply) String() string { func (*AccountAPTBalanceReply) ProtoMessage() {} func (x *AccountAPTBalanceReply) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[1] + mi := &file_aptos_proto_msgTypes[3] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -288,7 +319,7 @@ func (x *AccountAPTBalanceReply) ProtoReflect() protoreflect.Message { // Deprecated: Use AccountAPTBalanceReply.ProtoReflect.Descriptor instead. func (*AccountAPTBalanceReply) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{1} + return file_aptos_proto_rawDescGZIP(), []int{3} } func (x *AccountAPTBalanceReply) GetValue() uint64 { @@ -298,16 +329,121 @@ func (x *AccountAPTBalanceReply) GetValue() uint64 { return 0 } +type AccountTransactionsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // 32-byte account address + Start *uint64 `protobuf:"varint,2,opt,name=start,proto3,oneof" json:"start,omitempty"` // optional start sequence + Limit *uint64 `protobuf:"varint,3,opt,name=limit,proto3,oneof" json:"limit,omitempty"` // optional page size + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AccountTransactionsRequest) Reset() { + *x = AccountTransactionsRequest{} + mi := &file_aptos_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AccountTransactionsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AccountTransactionsRequest) ProtoMessage() {} + +func (x *AccountTransactionsRequest) ProtoReflect() protoreflect.Message { + mi := &file_aptos_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AccountTransactionsRequest.ProtoReflect.Descriptor instead. +func (*AccountTransactionsRequest) Descriptor() ([]byte, []int) { + return file_aptos_proto_rawDescGZIP(), []int{4} +} + +func (x *AccountTransactionsRequest) GetAddress() []byte { + if x != nil { + return x.Address + } + return nil +} + +func (x *AccountTransactionsRequest) GetStart() uint64 { + if x != nil && x.Start != nil { + return *x.Start + } + return 0 +} + +func (x *AccountTransactionsRequest) GetLimit() uint64 { + if x != nil && x.Limit != nil { + return *x.Limit + } + return 0 +} + +type AccountTransactionsReply struct { + state protoimpl.MessageState `protogen:"open.v1"` + Transactions []*Transaction `protobuf:"bytes,1,rep,name=transactions,proto3" json:"transactions,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AccountTransactionsReply) Reset() { + *x = AccountTransactionsReply{} + mi := &file_aptos_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AccountTransactionsReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AccountTransactionsReply) ProtoMessage() {} + +func (x *AccountTransactionsReply) ProtoReflect() protoreflect.Message { + mi := &file_aptos_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AccountTransactionsReply.ProtoReflect.Descriptor instead. +func (*AccountTransactionsReply) Descriptor() ([]byte, []int) { + return file_aptos_proto_rawDescGZIP(), []int{5} +} + +func (x *AccountTransactionsReply) GetTransactions() []*Transaction { + if x != nil { + return x.Transactions + } + return nil +} + type ViewRequest struct { state protoimpl.MessageState `protogen:"open.v1"` Payload *ViewPayload `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` + LedgerVersion *uint64 `protobuf:"varint,2,opt,name=ledger_version,json=ledgerVersion,proto3,oneof" json:"ledger_version,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *ViewRequest) Reset() { *x = ViewRequest{} - mi := &file_aptos_proto_msgTypes[2] + mi := &file_aptos_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -319,7 +455,7 @@ func (x *ViewRequest) String() string { func (*ViewRequest) ProtoMessage() {} func (x *ViewRequest) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[2] + mi := &file_aptos_proto_msgTypes[6] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -332,7 +468,7 @@ func (x *ViewRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ViewRequest.ProtoReflect.Descriptor instead. func (*ViewRequest) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{2} + return file_aptos_proto_rawDescGZIP(), []int{6} } func (x *ViewRequest) GetPayload() *ViewPayload { @@ -342,6 +478,13 @@ func (x *ViewRequest) GetPayload() *ViewPayload { return nil } +func (x *ViewRequest) GetLedgerVersion() uint64 { + if x != nil && x.LedgerVersion != nil { + return *x.LedgerVersion + } + return 0 +} + type ViewReply struct { state protoimpl.MessageState `protogen:"open.v1"` Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` @@ -351,7 +494,7 @@ type ViewReply struct { func (x *ViewReply) Reset() { *x = ViewReply{} - mi := &file_aptos_proto_msgTypes[3] + mi := &file_aptos_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -363,7 +506,7 @@ func (x *ViewReply) String() string { func (*ViewReply) ProtoMessage() {} func (x *ViewReply) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[3] + mi := &file_aptos_proto_msgTypes[7] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -376,7 +519,7 @@ func (x *ViewReply) ProtoReflect() protoreflect.Message { // Deprecated: Use ViewReply.ProtoReflect.Descriptor instead. func (*ViewReply) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{3} + return file_aptos_proto_rawDescGZIP(), []int{7} } func (x *ViewReply) GetData() []byte { @@ -398,7 +541,7 @@ type ViewPayload struct { func (x *ViewPayload) Reset() { *x = ViewPayload{} - mi := &file_aptos_proto_msgTypes[4] + mi := &file_aptos_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -410,7 +553,7 @@ func (x *ViewPayload) String() string { func (*ViewPayload) ProtoMessage() {} func (x *ViewPayload) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[4] + mi := &file_aptos_proto_msgTypes[8] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -423,7 +566,7 @@ func (x *ViewPayload) ProtoReflect() protoreflect.Message { // Deprecated: Use ViewPayload.ProtoReflect.Descriptor instead. func (*ViewPayload) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{4} + return file_aptos_proto_rawDescGZIP(), []int{8} } func (x *ViewPayload) GetModule() *ModuleID { @@ -464,7 +607,7 @@ type ModuleID struct { func (x *ModuleID) Reset() { *x = ModuleID{} - mi := &file_aptos_proto_msgTypes[5] + mi := &file_aptos_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -476,7 +619,7 @@ func (x *ModuleID) String() string { func (*ModuleID) ProtoMessage() {} func (x *ModuleID) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[5] + mi := &file_aptos_proto_msgTypes[9] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -489,7 +632,7 @@ func (x *ModuleID) ProtoReflect() protoreflect.Message { // Deprecated: Use ModuleID.ProtoReflect.Descriptor instead. func (*ModuleID) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{5} + return file_aptos_proto_rawDescGZIP(), []int{9} } func (x *ModuleID) GetAddress() []byte { @@ -508,7 +651,7 @@ func (x *ModuleID) GetName() string { type TypeTag struct { state protoimpl.MessageState `protogen:"open.v1"` - Kind TypeTagKind `protobuf:"varint,1,opt,name=kind,proto3,enum=loop.aptos.TypeTagKind" json:"kind,omitempty"` + Type TypeTagType `protobuf:"varint,1,opt,name=type,proto3,enum=loop.aptos.TypeTagType" json:"type,omitempty"` // Types that are valid to be assigned to Value: // // *TypeTag_Vector @@ -521,7 +664,7 @@ type TypeTag struct { func (x *TypeTag) Reset() { *x = TypeTag{} - mi := &file_aptos_proto_msgTypes[6] + mi := &file_aptos_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -533,7 +676,7 @@ func (x *TypeTag) String() string { func (*TypeTag) ProtoMessage() {} func (x *TypeTag) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[6] + mi := &file_aptos_proto_msgTypes[10] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -546,14 +689,14 @@ func (x *TypeTag) ProtoReflect() protoreflect.Message { // Deprecated: Use TypeTag.ProtoReflect.Descriptor instead. func (*TypeTag) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{6} + return file_aptos_proto_rawDescGZIP(), []int{10} } -func (x *TypeTag) GetKind() TypeTagKind { +func (x *TypeTag) GetType() TypeTagType { if x != nil { - return x.Kind + return x.Type } - return TypeTagKind_TYPE_TAG_KIND_BOOL + return TypeTagType_TYPE_TAG_BOOL } func (x *TypeTag) GetValue() isTypeTag_Value { @@ -621,7 +764,7 @@ type VectorTag struct { func (x *VectorTag) Reset() { *x = VectorTag{} - mi := &file_aptos_proto_msgTypes[7] + mi := &file_aptos_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -633,7 +776,7 @@ func (x *VectorTag) String() string { func (*VectorTag) ProtoMessage() {} func (x *VectorTag) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[7] + mi := &file_aptos_proto_msgTypes[11] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -646,7 +789,7 @@ func (x *VectorTag) ProtoReflect() protoreflect.Message { // Deprecated: Use VectorTag.ProtoReflect.Descriptor instead. func (*VectorTag) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{7} + return file_aptos_proto_rawDescGZIP(), []int{11} } func (x *VectorTag) GetElementType() *TypeTag { @@ -668,7 +811,7 @@ type StructTag struct { func (x *StructTag) Reset() { *x = StructTag{} - mi := &file_aptos_proto_msgTypes[8] + mi := &file_aptos_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -680,7 +823,7 @@ func (x *StructTag) String() string { func (*StructTag) ProtoMessage() {} func (x *StructTag) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[8] + mi := &file_aptos_proto_msgTypes[12] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -693,7 +836,7 @@ func (x *StructTag) ProtoReflect() protoreflect.Message { // Deprecated: Use StructTag.ProtoReflect.Descriptor instead. func (*StructTag) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{8} + return file_aptos_proto_rawDescGZIP(), []int{12} } func (x *StructTag) GetAddress() []byte { @@ -733,7 +876,7 @@ type GenericTag struct { func (x *GenericTag) Reset() { *x = GenericTag{} - mi := &file_aptos_proto_msgTypes[9] + mi := &file_aptos_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -745,7 +888,7 @@ func (x *GenericTag) String() string { func (*GenericTag) ProtoMessage() {} func (x *GenericTag) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[9] + mi := &file_aptos_proto_msgTypes[13] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -758,7 +901,7 @@ func (x *GenericTag) ProtoReflect() protoreflect.Message { // Deprecated: Use GenericTag.ProtoReflect.Descriptor instead. func (*GenericTag) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{9} + return file_aptos_proto_rawDescGZIP(), []int{13} } func (x *GenericTag) GetIndex() uint32 { @@ -768,28 +911,32 @@ func (x *GenericTag) GetIndex() uint32 { return 0 } -type TransactionByHashRequest struct { +type EventsByHandleRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` // Transaction hash (hex string with 0x prefix) + Account []byte `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"` // 32-byte address + EventHandle string `protobuf:"bytes,2,opt,name=event_handle,json=eventHandle,proto3" json:"event_handle,omitempty"` // Event handle struct tag + FieldName string `protobuf:"bytes,3,opt,name=field_name,json=fieldName,proto3" json:"field_name,omitempty"` // Field in the event handle struct + Start *uint64 `protobuf:"varint,4,opt,name=start,proto3,oneof" json:"start,omitempty"` // Starting sequence number + Limit *uint64 `protobuf:"varint,5,opt,name=limit,proto3,oneof" json:"limit,omitempty"` // Number of events to return (default 100) unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *TransactionByHashRequest) Reset() { - *x = TransactionByHashRequest{} - mi := &file_aptos_proto_msgTypes[10] +func (x *EventsByHandleRequest) Reset() { + *x = EventsByHandleRequest{} + mi := &file_aptos_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *TransactionByHashRequest) String() string { +func (x *EventsByHandleRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*TransactionByHashRequest) ProtoMessage() {} +func (*EventsByHandleRequest) ProtoMessage() {} -func (x *TransactionByHashRequest) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[10] +func (x *EventsByHandleRequest) ProtoReflect() protoreflect.Message { + mi := &file_aptos_proto_msgTypes[14] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -800,40 +947,68 @@ func (x *TransactionByHashRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use TransactionByHashRequest.ProtoReflect.Descriptor instead. -func (*TransactionByHashRequest) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{10} +// Deprecated: Use EventsByHandleRequest.ProtoReflect.Descriptor instead. +func (*EventsByHandleRequest) Descriptor() ([]byte, []int) { + return file_aptos_proto_rawDescGZIP(), []int{14} } -func (x *TransactionByHashRequest) GetHash() string { +func (x *EventsByHandleRequest) GetAccount() []byte { if x != nil { - return x.Hash + return x.Account } - return "" + return nil } -type TransactionByHashReply struct { - state protoimpl.MessageState `protogen:"open.v1"` - Transaction *Transaction `protobuf:"bytes,1,opt,name=transaction,proto3,oneof" json:"transaction,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache +func (x *EventsByHandleRequest) GetEventHandle() string { + if x != nil { + return x.EventHandle + } + return "" } -func (x *TransactionByHashReply) Reset() { - *x = TransactionByHashReply{} - mi := &file_aptos_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) +func (x *EventsByHandleRequest) GetFieldName() string { + if x != nil { + return x.FieldName + } + return "" } -func (x *TransactionByHashReply) String() string { +func (x *EventsByHandleRequest) GetStart() uint64 { + if x != nil && x.Start != nil { + return *x.Start + } + return 0 +} + +func (x *EventsByHandleRequest) GetLimit() uint64 { + if x != nil && x.Limit != nil { + return *x.Limit + } + return 0 +} + +type EventsByHandleReply struct { + state protoimpl.MessageState `protogen:"open.v1"` + Events []*Event `protobuf:"bytes,1,rep,name=events,proto3" json:"events,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *EventsByHandleReply) Reset() { + *x = EventsByHandleReply{} + mi := &file_aptos_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *EventsByHandleReply) String() string { return protoimpl.X.MessageStringOf(x) } -func (*TransactionByHashReply) ProtoMessage() {} +func (*EventsByHandleReply) ProtoMessage() {} -func (x *TransactionByHashReply) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[11] +func (x *EventsByHandleReply) ProtoReflect() protoreflect.Message { + mi := &file_aptos_proto_msgTypes[15] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -844,44 +1019,44 @@ func (x *TransactionByHashReply) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use TransactionByHashReply.ProtoReflect.Descriptor instead. -func (*TransactionByHashReply) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{11} +// Deprecated: Use EventsByHandleReply.ProtoReflect.Descriptor instead. +func (*EventsByHandleReply) Descriptor() ([]byte, []int) { + return file_aptos_proto_rawDescGZIP(), []int{15} } -func (x *TransactionByHashReply) GetTransaction() *Transaction { +func (x *EventsByHandleReply) GetEvents() []*Event { if x != nil { - return x.Transaction + return x.Events } return nil } -type Transaction struct { - state protoimpl.MessageState `protogen:"open.v1"` - Type TransactionVariant `protobuf:"varint,1,opt,name=type,proto3,enum=loop.aptos.TransactionVariant" json:"type,omitempty"` - Hash string `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` - Version *uint64 `protobuf:"varint,3,opt,name=version,proto3,oneof" json:"version,omitempty"` // nil for pending transactions - Success *bool `protobuf:"varint,4,opt,name=success,proto3,oneof" json:"success,omitempty"` // nil for pending/genesis transactions - Data []byte `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"` // Raw transaction data - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache +type Event struct { + state protoimpl.MessageState `protogen:"open.v1"` + Version uint64 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` // Block version of the event + Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` // Fully qualified name e.g. 0x1::coin::WithdrawEvent + Guid *GUID `protobuf:"bytes,3,opt,name=guid,proto3,oneof" json:"guid,omitempty"` // Unique identifier (V1 events only) + SequenceNumber uint64 `protobuf:"varint,4,opt,name=sequence_number,json=sequenceNumber,proto3" json:"sequence_number,omitempty"` // Sequence number (V1 events only) + Data []byte `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"` // Event data as raw bytes + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (x *Transaction) Reset() { - *x = Transaction{} - mi := &file_aptos_proto_msgTypes[12] +func (x *Event) Reset() { + *x = Event{} + mi := &file_aptos_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *Transaction) String() string { +func (x *Event) String() string { return protoimpl.X.MessageStringOf(x) } -func (*Transaction) ProtoMessage() {} +func (*Event) ProtoMessage() {} -func (x *Transaction) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[12] +func (x *Event) ProtoReflect() protoreflect.Message { + mi := &file_aptos_proto_msgTypes[16] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -892,70 +1067,120 @@ func (x *Transaction) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use Transaction.ProtoReflect.Descriptor instead. -func (*Transaction) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{12} +// Deprecated: Use Event.ProtoReflect.Descriptor instead. +func (*Event) Descriptor() ([]byte, []int) { + return file_aptos_proto_rawDescGZIP(), []int{16} } -func (x *Transaction) GetType() TransactionVariant { +func (x *Event) GetVersion() uint64 { if x != nil { - return x.Type + return x.Version } - return TransactionVariant_TRANSACTION_VARIANT_PENDING + return 0 } -func (x *Transaction) GetHash() string { +func (x *Event) GetType() string { if x != nil { - return x.Hash + return x.Type } return "" } -func (x *Transaction) GetVersion() uint64 { - if x != nil && x.Version != nil { - return *x.Version +func (x *Event) GetGuid() *GUID { + if x != nil { + return x.Guid } - return 0 + return nil } -func (x *Transaction) GetSuccess() bool { - if x != nil && x.Success != nil { - return *x.Success +func (x *Event) GetSequenceNumber() uint64 { + if x != nil { + return x.SequenceNumber } - return false + return 0 } -func (x *Transaction) GetData() []byte { +func (x *Event) GetData() []byte { if x != nil { return x.Data } return nil } -type AccountTransactionsRequest struct { +type GUID struct { + state protoimpl.MessageState `protogen:"open.v1"` + CreationNumber uint64 `protobuf:"varint,1,opt,name=creation_number,json=creationNumber,proto3" json:"creation_number,omitempty"` // Number of the GUID + AccountAddress []byte `protobuf:"bytes,2,opt,name=account_address,json=accountAddress,proto3" json:"account_address,omitempty"` // 32-byte account address of creator + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GUID) Reset() { + *x = GUID{} + mi := &file_aptos_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GUID) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GUID) ProtoMessage() {} + +func (x *GUID) ProtoReflect() protoreflect.Message { + mi := &file_aptos_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GUID.ProtoReflect.Descriptor instead. +func (*GUID) Descriptor() ([]byte, []int) { + return file_aptos_proto_rawDescGZIP(), []int{17} +} + +func (x *GUID) GetCreationNumber() uint64 { + if x != nil { + return x.CreationNumber + } + return 0 +} + +func (x *GUID) GetAccountAddress() []byte { + if x != nil { + return x.AccountAddress + } + return nil +} + +type TransactionByHashRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // 32-byte address - Start *uint64 `protobuf:"varint,2,opt,name=start,proto3,oneof" json:"start,omitempty"` // Starting version number; nil for most recent - Limit *uint64 `protobuf:"varint,3,opt,name=limit,proto3,oneof" json:"limit,omitempty"` // Number of transactions to return; nil for default (~100) + Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` // Transaction hash (hex string with 0x prefix) unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *AccountTransactionsRequest) Reset() { - *x = AccountTransactionsRequest{} - mi := &file_aptos_proto_msgTypes[13] +func (x *TransactionByHashRequest) Reset() { + *x = TransactionByHashRequest{} + mi := &file_aptos_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *AccountTransactionsRequest) String() string { +func (x *TransactionByHashRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*AccountTransactionsRequest) ProtoMessage() {} +func (*TransactionByHashRequest) ProtoMessage() {} -func (x *AccountTransactionsRequest) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[13] +func (x *TransactionByHashRequest) ProtoReflect() protoreflect.Message { + mi := &file_aptos_proto_msgTypes[18] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -966,54 +1191,88 @@ func (x *AccountTransactionsRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use AccountTransactionsRequest.ProtoReflect.Descriptor instead. -func (*AccountTransactionsRequest) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{13} +// Deprecated: Use TransactionByHashRequest.ProtoReflect.Descriptor instead. +func (*TransactionByHashRequest) Descriptor() ([]byte, []int) { + return file_aptos_proto_rawDescGZIP(), []int{18} } -func (x *AccountTransactionsRequest) GetAddress() []byte { +func (x *TransactionByHashRequest) GetHash() string { if x != nil { - return x.Address + return x.Hash } - return nil + return "" } -func (x *AccountTransactionsRequest) GetStart() uint64 { - if x != nil && x.Start != nil { - return *x.Start +type TransactionByHashReply struct { + state protoimpl.MessageState `protogen:"open.v1"` + Transaction *Transaction `protobuf:"bytes,1,opt,name=transaction,proto3,oneof" json:"transaction,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TransactionByHashReply) Reset() { + *x = TransactionByHashReply{} + mi := &file_aptos_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TransactionByHashReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TransactionByHashReply) ProtoMessage() {} + +func (x *TransactionByHashReply) ProtoReflect() protoreflect.Message { + mi := &file_aptos_proto_msgTypes[19] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return 0 + return mi.MessageOf(x) } -func (x *AccountTransactionsRequest) GetLimit() uint64 { - if x != nil && x.Limit != nil { - return *x.Limit +// Deprecated: Use TransactionByHashReply.ProtoReflect.Descriptor instead. +func (*TransactionByHashReply) Descriptor() ([]byte, []int) { + return file_aptos_proto_rawDescGZIP(), []int{19} +} + +func (x *TransactionByHashReply) GetTransaction() *Transaction { + if x != nil { + return x.Transaction } - return 0 + return nil } -type AccountTransactionsReply struct { +type Transaction struct { state protoimpl.MessageState `protogen:"open.v1"` - Transactions []*Transaction `protobuf:"bytes,1,rep,name=transactions,proto3" json:"transactions,omitempty"` + Type TransactionVariant `protobuf:"varint,1,opt,name=type,proto3,enum=loop.aptos.TransactionVariant" json:"type,omitempty"` + Hash string `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` + Version *uint64 `protobuf:"varint,3,opt,name=version,proto3,oneof" json:"version,omitempty"` // nil for pending transactions + Success *bool `protobuf:"varint,4,opt,name=success,proto3,oneof" json:"success,omitempty"` // nil for pending/genesis transactions + Data []byte `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"` // Raw transaction data unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *AccountTransactionsReply) Reset() { - *x = AccountTransactionsReply{} - mi := &file_aptos_proto_msgTypes[14] +func (x *Transaction) Reset() { + *x = Transaction{} + mi := &file_aptos_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *AccountTransactionsReply) String() string { +func (x *Transaction) String() string { return protoimpl.X.MessageStringOf(x) } -func (*AccountTransactionsReply) ProtoMessage() {} +func (*Transaction) ProtoMessage() {} -func (x *AccountTransactionsReply) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[14] +func (x *Transaction) ProtoReflect() protoreflect.Message { + mi := &file_aptos_proto_msgTypes[20] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1024,14 +1283,42 @@ func (x *AccountTransactionsReply) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use AccountTransactionsReply.ProtoReflect.Descriptor instead. -func (*AccountTransactionsReply) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{14} +// Deprecated: Use Transaction.ProtoReflect.Descriptor instead. +func (*Transaction) Descriptor() ([]byte, []int) { + return file_aptos_proto_rawDescGZIP(), []int{20} } -func (x *AccountTransactionsReply) GetTransactions() []*Transaction { +func (x *Transaction) GetType() TransactionVariant { if x != nil { - return x.Transactions + return x.Type + } + return TransactionVariant_TRANSACTION_VARIANT_PENDING +} + +func (x *Transaction) GetHash() string { + if x != nil { + return x.Hash + } + return "" +} + +func (x *Transaction) GetVersion() uint64 { + if x != nil && x.Version != nil { + return *x.Version + } + return 0 +} + +func (x *Transaction) GetSuccess() bool { + if x != nil && x.Success != nil { + return *x.Success + } + return false +} + +func (x *Transaction) GetData() []byte { + if x != nil { + return x.Data } return nil } @@ -1047,7 +1334,7 @@ type SubmitTransactionRequest struct { func (x *SubmitTransactionRequest) Reset() { *x = SubmitTransactionRequest{} - mi := &file_aptos_proto_msgTypes[15] + mi := &file_aptos_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1059,7 +1346,7 @@ func (x *SubmitTransactionRequest) String() string { func (*SubmitTransactionRequest) ProtoMessage() {} func (x *SubmitTransactionRequest) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[15] + mi := &file_aptos_proto_msgTypes[21] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1072,7 +1359,7 @@ func (x *SubmitTransactionRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SubmitTransactionRequest.ProtoReflect.Descriptor instead. func (*SubmitTransactionRequest) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{15} + return file_aptos_proto_rawDescGZIP(), []int{21} } func (x *SubmitTransactionRequest) GetReceiverModuleId() *ModuleID { @@ -1097,17 +1384,15 @@ func (x *SubmitTransactionRequest) GetGasConfig() *GasConfig { } type SubmitTransactionReply struct { - state protoimpl.MessageState `protogen:"open.v1"` - TxStatus TxStatus `protobuf:"varint,1,opt,name=tx_status,json=txStatus,proto3,enum=loop.aptos.TxStatus" json:"tx_status,omitempty"` - TxHash string `protobuf:"bytes,2,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"` - TxIdempotencyKey string `protobuf:"bytes,3,opt,name=tx_idempotency_key,json=txIdempotencyKey,proto3" json:"tx_idempotency_key,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + PendingTransaction *PendingTransaction `protobuf:"bytes,1,opt,name=pending_transaction,json=pendingTransaction,proto3,oneof" json:"pending_transaction,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *SubmitTransactionReply) Reset() { *x = SubmitTransactionReply{} - mi := &file_aptos_proto_msgTypes[16] + mi := &file_aptos_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1119,7 +1404,7 @@ func (x *SubmitTransactionReply) String() string { func (*SubmitTransactionReply) ProtoMessage() {} func (x *SubmitTransactionReply) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[16] + mi := &file_aptos_proto_msgTypes[22] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1132,28 +1417,14 @@ func (x *SubmitTransactionReply) ProtoReflect() protoreflect.Message { // Deprecated: Use SubmitTransactionReply.ProtoReflect.Descriptor instead. func (*SubmitTransactionReply) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{16} + return file_aptos_proto_rawDescGZIP(), []int{22} } -func (x *SubmitTransactionReply) GetTxStatus() TxStatus { +func (x *SubmitTransactionReply) GetPendingTransaction() *PendingTransaction { if x != nil { - return x.TxStatus + return x.PendingTransaction } - return TxStatus_TX_STATUS_FATAL -} - -func (x *SubmitTransactionReply) GetTxHash() string { - if x != nil { - return x.TxHash - } - return "" -} - -func (x *SubmitTransactionReply) GetTxIdempotencyKey() string { - if x != nil { - return x.TxIdempotencyKey - } - return "" + return nil } type GasConfig struct { @@ -1166,7 +1437,7 @@ type GasConfig struct { func (x *GasConfig) Reset() { *x = GasConfig{} - mi := &file_aptos_proto_msgTypes[17] + mi := &file_aptos_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1178,7 +1449,7 @@ func (x *GasConfig) String() string { func (*GasConfig) ProtoMessage() {} func (x *GasConfig) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[17] + mi := &file_aptos_proto_msgTypes[23] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1191,7 +1462,7 @@ func (x *GasConfig) ProtoReflect() protoreflect.Message { // Deprecated: Use GasConfig.ProtoReflect.Descriptor instead. func (*GasConfig) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{17} + return file_aptos_proto_rawDescGZIP(), []int{23} } func (x *GasConfig) GetMaxGasAmount() uint64 { @@ -1208,18 +1479,139 @@ func (x *GasConfig) GetGasUnitPrice() uint64 { return 0 } +type PendingTransaction struct { + state protoimpl.MessageState `protogen:"open.v1"` + Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` // Transaction hash (hex string with 0x prefix) + Sender []byte `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` // 32-byte sender address + SequenceNumber uint64 `protobuf:"varint,3,opt,name=sequence_number,json=sequenceNumber,proto3" json:"sequence_number,omitempty"` // Sequence number + ReplayProtectionNonce *uint64 `protobuf:"varint,4,opt,name=replay_protection_nonce,json=replayProtectionNonce,proto3,oneof" json:"replay_protection_nonce,omitempty"` // Optional nonce for replay protection + MaxGasAmount uint64 `protobuf:"varint,5,opt,name=max_gas_amount,json=maxGasAmount,proto3" json:"max_gas_amount,omitempty"` // Maximum gas amount + GasUnitPrice uint64 `protobuf:"varint,6,opt,name=gas_unit_price,json=gasUnitPrice,proto3" json:"gas_unit_price,omitempty"` // Gas unit price + ExpirationTimestampSecs uint64 `protobuf:"varint,7,opt,name=expiration_timestamp_secs,json=expirationTimestampSecs,proto3" json:"expiration_timestamp_secs,omitempty"` // Expiration timestamp in seconds + Payload []byte `protobuf:"bytes,8,opt,name=payload,proto3" json:"payload,omitempty"` // Transaction payload as raw bytes + Signature []byte `protobuf:"bytes,9,opt,name=signature,proto3" json:"signature,omitempty"` // Signature as raw bytes + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PendingTransaction) Reset() { + *x = PendingTransaction{} + mi := &file_aptos_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PendingTransaction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PendingTransaction) ProtoMessage() {} + +func (x *PendingTransaction) ProtoReflect() protoreflect.Message { + mi := &file_aptos_proto_msgTypes[24] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PendingTransaction.ProtoReflect.Descriptor instead. +func (*PendingTransaction) Descriptor() ([]byte, []int) { + return file_aptos_proto_rawDescGZIP(), []int{24} +} + +func (x *PendingTransaction) GetHash() string { + if x != nil { + return x.Hash + } + return "" +} + +func (x *PendingTransaction) GetSender() []byte { + if x != nil { + return x.Sender + } + return nil +} + +func (x *PendingTransaction) GetSequenceNumber() uint64 { + if x != nil { + return x.SequenceNumber + } + return 0 +} + +func (x *PendingTransaction) GetReplayProtectionNonce() uint64 { + if x != nil && x.ReplayProtectionNonce != nil { + return *x.ReplayProtectionNonce + } + return 0 +} + +func (x *PendingTransaction) GetMaxGasAmount() uint64 { + if x != nil { + return x.MaxGasAmount + } + return 0 +} + +func (x *PendingTransaction) GetGasUnitPrice() uint64 { + if x != nil { + return x.GasUnitPrice + } + return 0 +} + +func (x *PendingTransaction) GetExpirationTimestampSecs() uint64 { + if x != nil { + return x.ExpirationTimestampSecs + } + return 0 +} + +func (x *PendingTransaction) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +func (x *PendingTransaction) GetSignature() []byte { + if x != nil { + return x.Signature + } + return nil +} + var File_aptos_proto protoreflect.FileDescriptor const file_aptos_proto_rawDesc = "" + "\n" + "\vaptos.proto\x12\n" + - "loop.aptos\"4\n" + + "loop.aptos\"\x16\n" + + "\x14LedgerVersionRequest\";\n" + + "\x12LedgerVersionReply\x12%\n" + + "\x0eledger_version\x18\x01 \x01(\x04R\rledgerVersion\"4\n" + "\x18AccountAPTBalanceRequest\x12\x18\n" + "\aaddress\x18\x01 \x01(\fR\aaddress\".\n" + "\x16AccountAPTBalanceReply\x12\x14\n" + - "\x05value\x18\x01 \x01(\x04R\x05value\"@\n" + + "\x05value\x18\x01 \x01(\x04R\x05value\"\x80\x01\n" + + "\x1aAccountTransactionsRequest\x12\x18\n" + + "\aaddress\x18\x01 \x01(\fR\aaddress\x12\x19\n" + + "\x05start\x18\x02 \x01(\x04H\x00R\x05start\x88\x01\x01\x12\x19\n" + + "\x05limit\x18\x03 \x01(\x04H\x01R\x05limit\x88\x01\x01B\b\n" + + "\x06_startB\b\n" + + "\x06_limit\"W\n" + + "\x18AccountTransactionsReply\x12;\n" + + "\ftransactions\x18\x01 \x03(\v2\x17.loop.aptos.TransactionR\ftransactions\"\x7f\n" + "\vViewRequest\x121\n" + - "\apayload\x18\x01 \x01(\v2\x17.loop.aptos.ViewPayloadR\apayload\"\x1f\n" + + "\apayload\x18\x01 \x01(\v2\x17.loop.aptos.ViewPayloadR\apayload\x12*\n" + + "\x0eledger_version\x18\x02 \x01(\x04H\x00R\rledgerVersion\x88\x01\x01B\x11\n" + + "\x0f_ledger_version\"\x1f\n" + "\tViewReply\x12\x12\n" + "\x04data\x18\x01 \x01(\fR\x04data\"\x9d\x01\n" + "\vViewPayload\x12,\n" + @@ -1231,7 +1623,7 @@ const file_aptos_proto_rawDesc = "" + "\aaddress\x18\x01 \x01(\fR\aaddress\x12\x12\n" + "\x04name\x18\x02 \x01(\tR\x04name\"\xd5\x01\n" + "\aTypeTag\x12+\n" + - "\x04kind\x18\x01 \x01(\x0e2\x17.loop.aptos.TypeTagKindR\x04kind\x12/\n" + + "\x04type\x18\x01 \x01(\x0e2\x17.loop.aptos.TypeTagTypeR\x04type\x12/\n" + "\x06vector\x18\x02 \x01(\v2\x15.loop.aptos.VectorTagH\x00R\x06vector\x12/\n" + "\x06struct\x18\x03 \x01(\v2\x15.loop.aptos.StructTagH\x00R\x06struct\x122\n" + "\ageneric\x18\x04 \x01(\v2\x16.loop.aptos.GenericTagH\x00R\agenericB\a\n" + @@ -1246,7 +1638,28 @@ const file_aptos_proto_rawDesc = "" + "typeParams\"\"\n" + "\n" + "GenericTag\x12\x14\n" + - "\x05index\x18\x01 \x01(\rR\x05index\".\n" + + "\x05index\x18\x01 \x01(\rR\x05index\"\xbd\x01\n" + + "\x15EventsByHandleRequest\x12\x18\n" + + "\aaccount\x18\x01 \x01(\fR\aaccount\x12!\n" + + "\fevent_handle\x18\x02 \x01(\tR\veventHandle\x12\x1d\n" + + "\n" + + "field_name\x18\x03 \x01(\tR\tfieldName\x12\x19\n" + + "\x05start\x18\x04 \x01(\x04H\x00R\x05start\x88\x01\x01\x12\x19\n" + + "\x05limit\x18\x05 \x01(\x04H\x01R\x05limit\x88\x01\x01B\b\n" + + "\x06_startB\b\n" + + "\x06_limit\"@\n" + + "\x13EventsByHandleReply\x12)\n" + + "\x06events\x18\x01 \x03(\v2\x11.loop.aptos.EventR\x06events\"\xa6\x01\n" + + "\x05Event\x12\x18\n" + + "\aversion\x18\x01 \x01(\x04R\aversion\x12\x12\n" + + "\x04type\x18\x02 \x01(\tR\x04type\x12)\n" + + "\x04guid\x18\x03 \x01(\v2\x10.loop.aptos.GUIDH\x00R\x04guid\x88\x01\x01\x12'\n" + + "\x0fsequence_number\x18\x04 \x01(\x04R\x0esequenceNumber\x12\x12\n" + + "\x04data\x18\x05 \x01(\fR\x04dataB\a\n" + + "\x05_guid\"X\n" + + "\x04GUID\x12'\n" + + "\x0fcreation_number\x18\x01 \x01(\x04R\x0ecreationNumber\x12'\n" + + "\x0faccount_address\x18\x02 \x01(\fR\x0eaccountAddress\".\n" + "\x18TransactionByHashRequest\x12\x12\n" + "\x04hash\x18\x01 \x01(\tR\x04hash\"h\n" + "\x16TransactionByHashReply\x12>\n" + @@ -1261,42 +1674,44 @@ const file_aptos_proto_rawDesc = "" + "\n" + "\b_versionB\n" + "\n" + - "\b_success\"\x80\x01\n" + - "\x1aAccountTransactionsRequest\x12\x18\n" + - "\aaddress\x18\x01 \x01(\fR\aaddress\x12\x19\n" + - "\x05start\x18\x02 \x01(\x04H\x00R\x05start\x88\x01\x01\x12\x19\n" + - "\x05limit\x18\x03 \x01(\x04H\x01R\x05limit\x88\x01\x01B\b\n" + - "\x06_startB\b\n" + - "\x06_limit\"W\n" + - "\x18AccountTransactionsReply\x12;\n" + - "\ftransactions\x18\x01 \x03(\v2\x17.loop.aptos.TransactionR\ftransactions\"\xd1\x01\n" + + "\b_success\"\xd1\x01\n" + "\x18SubmitTransactionRequest\x12B\n" + "\x12receiver_module_id\x18\x01 \x01(\v2\x14.loop.aptos.ModuleIDR\x10receiverModuleId\x12'\n" + "\x0fencoded_payload\x18\x02 \x01(\fR\x0eencodedPayload\x129\n" + "\n" + "gas_config\x18\x03 \x01(\v2\x15.loop.aptos.GasConfigH\x00R\tgasConfig\x88\x01\x01B\r\n" + - "\v_gas_config\"\x92\x01\n" + - "\x16SubmitTransactionReply\x121\n" + - "\ttx_status\x18\x01 \x01(\x0e2\x14.loop.aptos.TxStatusR\btxStatus\x12\x17\n" + - "\atx_hash\x18\x02 \x01(\tR\x06txHash\x12,\n" + - "\x12tx_idempotency_key\x18\x03 \x01(\tR\x10txIdempotencyKey\"W\n" + + "\v_gas_config\"\x86\x01\n" + + "\x16SubmitTransactionReply\x12T\n" + + "\x13pending_transaction\x18\x01 \x01(\v2\x1e.loop.aptos.PendingTransactionH\x00R\x12pendingTransaction\x88\x01\x01B\x16\n" + + "\x14_pending_transaction\"W\n" + "\tGasConfig\x12$\n" + "\x0emax_gas_amount\x18\x01 \x01(\x04R\fmaxGasAmount\x12$\n" + - "\x0egas_unit_price\x18\x02 \x01(\x04R\fgasUnitPrice*\xb4\x02\n" + - "\vTypeTagKind\x12\x16\n" + - "\x12TYPE_TAG_KIND_BOOL\x10\x00\x12\x14\n" + - "\x10TYPE_TAG_KIND_U8\x10\x01\x12\x15\n" + - "\x11TYPE_TAG_KIND_U16\x10\x02\x12\x15\n" + - "\x11TYPE_TAG_KIND_U32\x10\x03\x12\x15\n" + - "\x11TYPE_TAG_KIND_U64\x10\x04\x12\x16\n" + - "\x12TYPE_TAG_KIND_U128\x10\x05\x12\x16\n" + - "\x12TYPE_TAG_KIND_U256\x10\x06\x12\x19\n" + - "\x15TYPE_TAG_KIND_ADDRESS\x10\a\x12\x18\n" + - "\x14TYPE_TAG_KIND_SIGNER\x10\b\x12\x18\n" + - "\x14TYPE_TAG_KIND_VECTOR\x10\t\x12\x18\n" + - "\x14TYPE_TAG_KIND_STRUCT\x10\n" + - "\x12\x19\n" + - "\x15TYPE_TAG_KIND_GENERIC\x10\v*\xb2\x02\n" + + "\x0egas_unit_price\x18\x02 \x01(\x04R\fgasUnitPrice\"\x82\x03\n" + + "\x12PendingTransaction\x12\x12\n" + + "\x04hash\x18\x01 \x01(\tR\x04hash\x12\x16\n" + + "\x06sender\x18\x02 \x01(\fR\x06sender\x12'\n" + + "\x0fsequence_number\x18\x03 \x01(\x04R\x0esequenceNumber\x12;\n" + + "\x17replay_protection_nonce\x18\x04 \x01(\x04H\x00R\x15replayProtectionNonce\x88\x01\x01\x12$\n" + + "\x0emax_gas_amount\x18\x05 \x01(\x04R\fmaxGasAmount\x12$\n" + + "\x0egas_unit_price\x18\x06 \x01(\x04R\fgasUnitPrice\x12:\n" + + "\x19expiration_timestamp_secs\x18\a \x01(\x04R\x17expirationTimestampSecs\x12\x18\n" + + "\apayload\x18\b \x01(\fR\apayload\x12\x1c\n" + + "\tsignature\x18\t \x01(\fR\tsignatureB\x1a\n" + + "\x18_replay_protection_nonce*\xf8\x01\n" + + "\vTypeTagType\x12\x11\n" + + "\rTYPE_TAG_BOOL\x10\x00\x12\x0f\n" + + "\vTYPE_TAG_U8\x10\x01\x12\x10\n" + + "\fTYPE_TAG_U16\x10\x02\x12\x10\n" + + "\fTYPE_TAG_U32\x10\x03\x12\x10\n" + + "\fTYPE_TAG_U64\x10\x04\x12\x11\n" + + "\rTYPE_TAG_U128\x10\x05\x12\x11\n" + + "\rTYPE_TAG_U256\x10\x06\x12\x14\n" + + "\x10TYPE_TAG_ADDRESS\x10\a\x12\x13\n" + + "\x0fTYPE_TAG_SIGNER\x10\b\x12\x13\n" + + "\x0fTYPE_TAG_VECTOR\x10\t\x12\x13\n" + + "\x0fTYPE_TAG_STRUCT\x10\n" + + "\x12\x14\n" + + "\x10TYPE_TAG_GENERIC\x10\v*\xb2\x02\n" + "\x12TransactionVariant\x12\x1f\n" + "\x1bTRANSACTION_VARIANT_PENDING\x10\x00\x12\x1c\n" + "\x18TRANSACTION_VARIANT_USER\x10\x01\x12\x1f\n" + @@ -1305,16 +1720,14 @@ const file_aptos_proto_rawDesc = "" + "\"TRANSACTION_VARIANT_BLOCK_EPILOGUE\x10\x04\x12(\n" + "$TRANSACTION_VARIANT_STATE_CHECKPOINT\x10\x05\x12!\n" + "\x1dTRANSACTION_VARIANT_VALIDATOR\x10\x06\x12\x1f\n" + - "\x1bTRANSACTION_VARIANT_UNKNOWN\x10\a*N\n" + - "\bTxStatus\x12\x13\n" + - "\x0fTX_STATUS_FATAL\x10\x00\x12\x16\n" + - "\x12TX_STATUS_REVERTED\x10\x01\x12\x15\n" + - "\x11TX_STATUS_SUCCESS\x10\x022\xc1\x03\n" + - "\x05Aptos\x12]\n" + - "\x11AccountAPTBalance\x12$.loop.aptos.AccountAPTBalanceRequest\x1a\".loop.aptos.AccountAPTBalanceReply\x126\n" + - "\x04View\x12\x17.loop.aptos.ViewRequest\x1a\x15.loop.aptos.ViewReply\x12]\n" + - "\x11TransactionByHash\x12$.loop.aptos.TransactionByHashRequest\x1a\".loop.aptos.TransactionByHashReply\x12c\n" + - "\x13AccountTransactions\x12&.loop.aptos.AccountTransactionsRequest\x1a$.loop.aptos.AccountTransactionsReply\x12]\n" + + "\x1bTRANSACTION_VARIANT_UNKNOWN\x10\a2\xea\x04\n" + + "\x05Aptos\x12Q\n" + + "\rLedgerVersion\x12 .loop.aptos.LedgerVersionRequest\x1a\x1e.loop.aptos.LedgerVersionReply\x12]\n" + + "\x11AccountAPTBalance\x12$.loop.aptos.AccountAPTBalanceRequest\x1a\".loop.aptos.AccountAPTBalanceReply\x12c\n" + + "\x13AccountTransactions\x12&.loop.aptos.AccountTransactionsRequest\x1a$.loop.aptos.AccountTransactionsReply\x126\n" + + "\x04View\x12\x17.loop.aptos.ViewRequest\x1a\x15.loop.aptos.ViewReply\x12T\n" + + "\x0eEventsByHandle\x12!.loop.aptos.EventsByHandleRequest\x1a\x1f.loop.aptos.EventsByHandleReply\x12]\n" + + "\x11TransactionByHash\x12$.loop.aptos.TransactionByHashRequest\x1a\".loop.aptos.TransactionByHashReply\x12]\n" + "\x11SubmitTransaction\x12$.loop.aptos.SubmitTransactionRequest\x1a\".loop.aptos.SubmitTransactionReplyB?Z=github.com/smartcontractkit/chainlink-common/pkg/chains/aptosb\x06proto3" var ( @@ -1329,62 +1742,74 @@ func file_aptos_proto_rawDescGZIP() []byte { return file_aptos_proto_rawDescData } -var file_aptos_proto_enumTypes = make([]protoimpl.EnumInfo, 3) -var file_aptos_proto_msgTypes = make([]protoimpl.MessageInfo, 18) +var file_aptos_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_aptos_proto_msgTypes = make([]protoimpl.MessageInfo, 25) var file_aptos_proto_goTypes = []any{ - (TypeTagKind)(0), // 0: loop.aptos.TypeTagKind + (TypeTagType)(0), // 0: loop.aptos.TypeTagType (TransactionVariant)(0), // 1: loop.aptos.TransactionVariant - (TxStatus)(0), // 2: loop.aptos.TxStatus - (*AccountAPTBalanceRequest)(nil), // 3: loop.aptos.AccountAPTBalanceRequest - (*AccountAPTBalanceReply)(nil), // 4: loop.aptos.AccountAPTBalanceReply - (*ViewRequest)(nil), // 5: loop.aptos.ViewRequest - (*ViewReply)(nil), // 6: loop.aptos.ViewReply - (*ViewPayload)(nil), // 7: loop.aptos.ViewPayload - (*ModuleID)(nil), // 8: loop.aptos.ModuleID - (*TypeTag)(nil), // 9: loop.aptos.TypeTag - (*VectorTag)(nil), // 10: loop.aptos.VectorTag - (*StructTag)(nil), // 11: loop.aptos.StructTag - (*GenericTag)(nil), // 12: loop.aptos.GenericTag - (*TransactionByHashRequest)(nil), // 13: loop.aptos.TransactionByHashRequest - (*TransactionByHashReply)(nil), // 14: loop.aptos.TransactionByHashReply - (*Transaction)(nil), // 15: loop.aptos.Transaction - (*AccountTransactionsRequest)(nil), // 16: loop.aptos.AccountTransactionsRequest - (*AccountTransactionsReply)(nil), // 17: loop.aptos.AccountTransactionsReply - (*SubmitTransactionRequest)(nil), // 18: loop.aptos.SubmitTransactionRequest - (*SubmitTransactionReply)(nil), // 19: loop.aptos.SubmitTransactionReply - (*GasConfig)(nil), // 20: loop.aptos.GasConfig + (*LedgerVersionRequest)(nil), // 2: loop.aptos.LedgerVersionRequest + (*LedgerVersionReply)(nil), // 3: loop.aptos.LedgerVersionReply + (*AccountAPTBalanceRequest)(nil), // 4: loop.aptos.AccountAPTBalanceRequest + (*AccountAPTBalanceReply)(nil), // 5: loop.aptos.AccountAPTBalanceReply + (*AccountTransactionsRequest)(nil), // 6: loop.aptos.AccountTransactionsRequest + (*AccountTransactionsReply)(nil), // 7: loop.aptos.AccountTransactionsReply + (*ViewRequest)(nil), // 8: loop.aptos.ViewRequest + (*ViewReply)(nil), // 9: loop.aptos.ViewReply + (*ViewPayload)(nil), // 10: loop.aptos.ViewPayload + (*ModuleID)(nil), // 11: loop.aptos.ModuleID + (*TypeTag)(nil), // 12: loop.aptos.TypeTag + (*VectorTag)(nil), // 13: loop.aptos.VectorTag + (*StructTag)(nil), // 14: loop.aptos.StructTag + (*GenericTag)(nil), // 15: loop.aptos.GenericTag + (*EventsByHandleRequest)(nil), // 16: loop.aptos.EventsByHandleRequest + (*EventsByHandleReply)(nil), // 17: loop.aptos.EventsByHandleReply + (*Event)(nil), // 18: loop.aptos.Event + (*GUID)(nil), // 19: loop.aptos.GUID + (*TransactionByHashRequest)(nil), // 20: loop.aptos.TransactionByHashRequest + (*TransactionByHashReply)(nil), // 21: loop.aptos.TransactionByHashReply + (*Transaction)(nil), // 22: loop.aptos.Transaction + (*SubmitTransactionRequest)(nil), // 23: loop.aptos.SubmitTransactionRequest + (*SubmitTransactionReply)(nil), // 24: loop.aptos.SubmitTransactionReply + (*GasConfig)(nil), // 25: loop.aptos.GasConfig + (*PendingTransaction)(nil), // 26: loop.aptos.PendingTransaction } var file_aptos_proto_depIdxs = []int32{ - 7, // 0: loop.aptos.ViewRequest.payload:type_name -> loop.aptos.ViewPayload - 8, // 1: loop.aptos.ViewPayload.module:type_name -> loop.aptos.ModuleID - 9, // 2: loop.aptos.ViewPayload.arg_types:type_name -> loop.aptos.TypeTag - 0, // 3: loop.aptos.TypeTag.kind:type_name -> loop.aptos.TypeTagKind - 10, // 4: loop.aptos.TypeTag.vector:type_name -> loop.aptos.VectorTag - 11, // 5: loop.aptos.TypeTag.struct:type_name -> loop.aptos.StructTag - 12, // 6: loop.aptos.TypeTag.generic:type_name -> loop.aptos.GenericTag - 9, // 7: loop.aptos.VectorTag.element_type:type_name -> loop.aptos.TypeTag - 9, // 8: loop.aptos.StructTag.type_params:type_name -> loop.aptos.TypeTag - 15, // 9: loop.aptos.TransactionByHashReply.transaction:type_name -> loop.aptos.Transaction - 1, // 10: loop.aptos.Transaction.type:type_name -> loop.aptos.TransactionVariant - 15, // 11: loop.aptos.AccountTransactionsReply.transactions:type_name -> loop.aptos.Transaction - 8, // 12: loop.aptos.SubmitTransactionRequest.receiver_module_id:type_name -> loop.aptos.ModuleID - 20, // 13: loop.aptos.SubmitTransactionRequest.gas_config:type_name -> loop.aptos.GasConfig - 2, // 14: loop.aptos.SubmitTransactionReply.tx_status:type_name -> loop.aptos.TxStatus - 3, // 15: loop.aptos.Aptos.AccountAPTBalance:input_type -> loop.aptos.AccountAPTBalanceRequest - 5, // 16: loop.aptos.Aptos.View:input_type -> loop.aptos.ViewRequest - 13, // 17: loop.aptos.Aptos.TransactionByHash:input_type -> loop.aptos.TransactionByHashRequest - 16, // 18: loop.aptos.Aptos.AccountTransactions:input_type -> loop.aptos.AccountTransactionsRequest - 18, // 19: loop.aptos.Aptos.SubmitTransaction:input_type -> loop.aptos.SubmitTransactionRequest - 4, // 20: loop.aptos.Aptos.AccountAPTBalance:output_type -> loop.aptos.AccountAPTBalanceReply - 6, // 21: loop.aptos.Aptos.View:output_type -> loop.aptos.ViewReply - 14, // 22: loop.aptos.Aptos.TransactionByHash:output_type -> loop.aptos.TransactionByHashReply - 17, // 23: loop.aptos.Aptos.AccountTransactions:output_type -> loop.aptos.AccountTransactionsReply - 19, // 24: loop.aptos.Aptos.SubmitTransaction:output_type -> loop.aptos.SubmitTransactionReply - 20, // [20:25] is the sub-list for method output_type - 15, // [15:20] is the sub-list for method input_type - 15, // [15:15] is the sub-list for extension type_name - 15, // [15:15] is the sub-list for extension extendee - 0, // [0:15] is the sub-list for field type_name + 22, // 0: loop.aptos.AccountTransactionsReply.transactions:type_name -> loop.aptos.Transaction + 10, // 1: loop.aptos.ViewRequest.payload:type_name -> loop.aptos.ViewPayload + 11, // 2: loop.aptos.ViewPayload.module:type_name -> loop.aptos.ModuleID + 12, // 3: loop.aptos.ViewPayload.arg_types:type_name -> loop.aptos.TypeTag + 0, // 4: loop.aptos.TypeTag.type:type_name -> loop.aptos.TypeTagType + 13, // 5: loop.aptos.TypeTag.vector:type_name -> loop.aptos.VectorTag + 14, // 6: loop.aptos.TypeTag.struct:type_name -> loop.aptos.StructTag + 15, // 7: loop.aptos.TypeTag.generic:type_name -> loop.aptos.GenericTag + 12, // 8: loop.aptos.VectorTag.element_type:type_name -> loop.aptos.TypeTag + 12, // 9: loop.aptos.StructTag.type_params:type_name -> loop.aptos.TypeTag + 18, // 10: loop.aptos.EventsByHandleReply.events:type_name -> loop.aptos.Event + 19, // 11: loop.aptos.Event.guid:type_name -> loop.aptos.GUID + 22, // 12: loop.aptos.TransactionByHashReply.transaction:type_name -> loop.aptos.Transaction + 1, // 13: loop.aptos.Transaction.type:type_name -> loop.aptos.TransactionVariant + 11, // 14: loop.aptos.SubmitTransactionRequest.receiver_module_id:type_name -> loop.aptos.ModuleID + 25, // 15: loop.aptos.SubmitTransactionRequest.gas_config:type_name -> loop.aptos.GasConfig + 26, // 16: loop.aptos.SubmitTransactionReply.pending_transaction:type_name -> loop.aptos.PendingTransaction + 2, // 17: loop.aptos.Aptos.LedgerVersion:input_type -> loop.aptos.LedgerVersionRequest + 4, // 18: loop.aptos.Aptos.AccountAPTBalance:input_type -> loop.aptos.AccountAPTBalanceRequest + 6, // 19: loop.aptos.Aptos.AccountTransactions:input_type -> loop.aptos.AccountTransactionsRequest + 8, // 20: loop.aptos.Aptos.View:input_type -> loop.aptos.ViewRequest + 16, // 21: loop.aptos.Aptos.EventsByHandle:input_type -> loop.aptos.EventsByHandleRequest + 20, // 22: loop.aptos.Aptos.TransactionByHash:input_type -> loop.aptos.TransactionByHashRequest + 23, // 23: loop.aptos.Aptos.SubmitTransaction:input_type -> loop.aptos.SubmitTransactionRequest + 3, // 24: loop.aptos.Aptos.LedgerVersion:output_type -> loop.aptos.LedgerVersionReply + 5, // 25: loop.aptos.Aptos.AccountAPTBalance:output_type -> loop.aptos.AccountAPTBalanceReply + 7, // 26: loop.aptos.Aptos.AccountTransactions:output_type -> loop.aptos.AccountTransactionsReply + 9, // 27: loop.aptos.Aptos.View:output_type -> loop.aptos.ViewReply + 17, // 28: loop.aptos.Aptos.EventsByHandle:output_type -> loop.aptos.EventsByHandleReply + 21, // 29: loop.aptos.Aptos.TransactionByHash:output_type -> loop.aptos.TransactionByHashReply + 24, // 30: loop.aptos.Aptos.SubmitTransaction:output_type -> loop.aptos.SubmitTransactionReply + 24, // [24:31] is the sub-list for method output_type + 17, // [17:24] is the sub-list for method input_type + 17, // [17:17] is the sub-list for extension type_name + 17, // [17:17] is the sub-list for extension extendee + 0, // [0:17] is the sub-list for field type_name } func init() { file_aptos_proto_init() } @@ -1392,22 +1817,27 @@ func file_aptos_proto_init() { if File_aptos_proto != nil { return } - file_aptos_proto_msgTypes[6].OneofWrappers = []any{ + file_aptos_proto_msgTypes[4].OneofWrappers = []any{} + file_aptos_proto_msgTypes[6].OneofWrappers = []any{} + file_aptos_proto_msgTypes[10].OneofWrappers = []any{ (*TypeTag_Vector)(nil), (*TypeTag_Struct)(nil), (*TypeTag_Generic)(nil), } - file_aptos_proto_msgTypes[11].OneofWrappers = []any{} - file_aptos_proto_msgTypes[12].OneofWrappers = []any{} - file_aptos_proto_msgTypes[13].OneofWrappers = []any{} - file_aptos_proto_msgTypes[15].OneofWrappers = []any{} + file_aptos_proto_msgTypes[14].OneofWrappers = []any{} + file_aptos_proto_msgTypes[16].OneofWrappers = []any{} + file_aptos_proto_msgTypes[19].OneofWrappers = []any{} + file_aptos_proto_msgTypes[20].OneofWrappers = []any{} + file_aptos_proto_msgTypes[21].OneofWrappers = []any{} + file_aptos_proto_msgTypes[22].OneofWrappers = []any{} + file_aptos_proto_msgTypes[24].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_aptos_proto_rawDesc), len(file_aptos_proto_rawDesc)), - NumEnums: 3, - NumMessages: 18, + NumEnums: 2, + NumMessages: 25, NumExtensions: 0, NumServices: 1, }, diff --git a/pkg/chains/aptos/aptos.proto b/pkg/chains/aptos/aptos.proto index da9be7b34..661d6d4dc 100644 --- a/pkg/chains/aptos/aptos.proto +++ b/pkg/chains/aptos/aptos.proto @@ -4,13 +4,23 @@ option go_package = "github.com/smartcontractkit/chainlink-common/pkg/chains/apt package loop.aptos; service Aptos { + rpc LedgerVersion(LedgerVersionRequest) returns (LedgerVersionReply); rpc AccountAPTBalance(AccountAPTBalanceRequest) returns (AccountAPTBalanceReply); + rpc AccountTransactions(AccountTransactionsRequest) returns (AccountTransactionsReply); rpc View(ViewRequest) returns (ViewReply); + rpc EventsByHandle(EventsByHandleRequest) returns (EventsByHandleReply); rpc TransactionByHash(TransactionByHashRequest) returns (TransactionByHashReply); - rpc AccountTransactions(AccountTransactionsRequest) returns (AccountTransactionsReply); rpc SubmitTransaction(SubmitTransactionRequest) returns (SubmitTransactionReply); } +// ========== LedgerVersion ========== + +message LedgerVersionRequest {} + +message LedgerVersionReply { + uint64 ledger_version = 1; +} + // ========== AccountAPTBalance ========== message AccountAPTBalanceRequest { @@ -21,10 +31,23 @@ message AccountAPTBalanceReply { uint64 value = 1; } +// ========== AccountTransactions ========== + +message AccountTransactionsRequest { + bytes address = 1; // 32-byte account address + optional uint64 start = 2; // optional start sequence + optional uint64 limit = 3; // optional page size +} + +message AccountTransactionsReply { + repeated Transaction transactions = 1; +} + // ========== View ========== message ViewRequest { ViewPayload payload = 1; + optional uint64 ledger_version = 2; } message ViewReply { @@ -44,7 +67,7 @@ message ModuleID { } message TypeTag { - TypeTagKind kind = 1; + TypeTagType type = 1; oneof value { VectorTag vector = 2; StructTag struct = 3; @@ -52,19 +75,19 @@ message TypeTag { } } -enum TypeTagKind { - TYPE_TAG_KIND_BOOL = 0; - TYPE_TAG_KIND_U8 = 1; - TYPE_TAG_KIND_U16 = 2; - TYPE_TAG_KIND_U32 = 3; - TYPE_TAG_KIND_U64 = 4; - TYPE_TAG_KIND_U128 = 5; - TYPE_TAG_KIND_U256 = 6; - TYPE_TAG_KIND_ADDRESS = 7; - TYPE_TAG_KIND_SIGNER = 8; - TYPE_TAG_KIND_VECTOR = 9; - TYPE_TAG_KIND_STRUCT = 10; - TYPE_TAG_KIND_GENERIC = 11; +enum TypeTagType { + TYPE_TAG_BOOL = 0; + TYPE_TAG_U8 = 1; + TYPE_TAG_U16 = 2; + TYPE_TAG_U32 = 3; + TYPE_TAG_U64 = 4; + TYPE_TAG_U128 = 5; + TYPE_TAG_U256 = 6; + TYPE_TAG_ADDRESS = 7; + TYPE_TAG_SIGNER = 8; + TYPE_TAG_VECTOR = 9; + TYPE_TAG_STRUCT = 10; + TYPE_TAG_GENERIC = 11; } message VectorTag { @@ -82,6 +105,32 @@ message GenericTag { uint32 index = 1; } +// ========== EventsByHandle ========== + +message EventsByHandleRequest { + bytes account = 1; // 32-byte address + string event_handle = 2; // Event handle struct tag + string field_name = 3; // Field in the event handle struct + optional uint64 start = 4; // Starting sequence number + optional uint64 limit = 5; // Number of events to return (default 100) +} + +message EventsByHandleReply { + repeated Event events = 1; +} + +message Event { + uint64 version = 1; // Block version of the event + string type = 2; // Fully qualified name e.g. 0x1::coin::WithdrawEvent + optional GUID guid = 3; // Unique identifier (V1 events only) + uint64 sequence_number = 4; // Sequence number (V1 events only) + bytes data = 5; // Event data as raw bytes +} + +message GUID { + uint64 creation_number = 1; // Number of the GUID + bytes account_address = 2; // 32-byte account address of creator +} // ========== TransactionByHash ========== @@ -112,18 +161,6 @@ message Transaction { bytes data = 5; // Raw transaction data } -// ========== AccountTransactions ========== - -message AccountTransactionsRequest { - bytes address = 1; // 32-byte address - optional uint64 start = 2; // Starting version number; nil for most recent - optional uint64 limit = 3; // Number of transactions to return; nil for default (~100) -} - -message AccountTransactionsReply { - repeated Transaction transactions = 1; -} - // ========== SubmitTransaction ========== message SubmitTransactionRequest { @@ -132,16 +169,8 @@ message SubmitTransactionRequest { optional GasConfig gas_config = 3; } -enum TxStatus { - TX_STATUS_FATAL = 0; // Transaction processing failed due to a network issue, RPC issue, or other fatal error - TX_STATUS_REVERTED = 1; // Transaction was sent successfully but the smart contract execution reverted - TX_STATUS_SUCCESS = 2; // Transaction was sent successfully, executed and mined into a block -} - message SubmitTransactionReply { - TxStatus tx_status = 1; - string tx_hash = 2; - string tx_idempotency_key = 3; + optional PendingTransaction pending_transaction = 1; } message GasConfig { @@ -149,3 +178,14 @@ message GasConfig { uint64 gas_unit_price = 2; // Price per gas unit in octas } +message PendingTransaction { + string hash = 1; // Transaction hash (hex string with 0x prefix) + bytes sender = 2; // 32-byte sender address + uint64 sequence_number = 3; // Sequence number + optional uint64 replay_protection_nonce = 4; // Optional nonce for replay protection + uint64 max_gas_amount = 5; // Maximum gas amount + uint64 gas_unit_price = 6; // Gas unit price + uint64 expiration_timestamp_secs = 7; // Expiration timestamp in seconds + bytes payload = 8; // Transaction payload as raw bytes + bytes signature = 9; // Signature as raw bytes +} diff --git a/pkg/chains/aptos/aptos_grpc.pb.go b/pkg/chains/aptos/aptos_grpc.pb.go index 2fc0f2d90..06a8025ba 100644 --- a/pkg/chains/aptos/aptos_grpc.pb.go +++ b/pkg/chains/aptos/aptos_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.5.1 -// - protoc v5.29.3 +// - protoc-gen-go-grpc v1.6.1 +// - protoc v5.27.3 // source: aptos.proto package aptos @@ -19,10 +19,12 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( + Aptos_LedgerVersion_FullMethodName = "/loop.aptos.Aptos/LedgerVersion" Aptos_AccountAPTBalance_FullMethodName = "/loop.aptos.Aptos/AccountAPTBalance" + Aptos_AccountTransactions_FullMethodName = "/loop.aptos.Aptos/AccountTransactions" Aptos_View_FullMethodName = "/loop.aptos.Aptos/View" + Aptos_EventsByHandle_FullMethodName = "/loop.aptos.Aptos/EventsByHandle" Aptos_TransactionByHash_FullMethodName = "/loop.aptos.Aptos/TransactionByHash" - Aptos_AccountTransactions_FullMethodName = "/loop.aptos.Aptos/AccountTransactions" Aptos_SubmitTransaction_FullMethodName = "/loop.aptos.Aptos/SubmitTransaction" ) @@ -30,10 +32,12 @@ const ( // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type AptosClient interface { + LedgerVersion(ctx context.Context, in *LedgerVersionRequest, opts ...grpc.CallOption) (*LedgerVersionReply, error) AccountAPTBalance(ctx context.Context, in *AccountAPTBalanceRequest, opts ...grpc.CallOption) (*AccountAPTBalanceReply, error) + AccountTransactions(ctx context.Context, in *AccountTransactionsRequest, opts ...grpc.CallOption) (*AccountTransactionsReply, error) View(ctx context.Context, in *ViewRequest, opts ...grpc.CallOption) (*ViewReply, error) + EventsByHandle(ctx context.Context, in *EventsByHandleRequest, opts ...grpc.CallOption) (*EventsByHandleReply, error) TransactionByHash(ctx context.Context, in *TransactionByHashRequest, opts ...grpc.CallOption) (*TransactionByHashReply, error) - AccountTransactions(ctx context.Context, in *AccountTransactionsRequest, opts ...grpc.CallOption) (*AccountTransactionsReply, error) SubmitTransaction(ctx context.Context, in *SubmitTransactionRequest, opts ...grpc.CallOption) (*SubmitTransactionReply, error) } @@ -45,6 +49,16 @@ func NewAptosClient(cc grpc.ClientConnInterface) AptosClient { return &aptosClient{cc} } +func (c *aptosClient) LedgerVersion(ctx context.Context, in *LedgerVersionRequest, opts ...grpc.CallOption) (*LedgerVersionReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(LedgerVersionReply) + err := c.cc.Invoke(ctx, Aptos_LedgerVersion_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *aptosClient) AccountAPTBalance(ctx context.Context, in *AccountAPTBalanceRequest, opts ...grpc.CallOption) (*AccountAPTBalanceReply, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(AccountAPTBalanceReply) @@ -55,6 +69,16 @@ func (c *aptosClient) AccountAPTBalance(ctx context.Context, in *AccountAPTBalan return out, nil } +func (c *aptosClient) AccountTransactions(ctx context.Context, in *AccountTransactionsRequest, opts ...grpc.CallOption) (*AccountTransactionsReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AccountTransactionsReply) + err := c.cc.Invoke(ctx, Aptos_AccountTransactions_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *aptosClient) View(ctx context.Context, in *ViewRequest, opts ...grpc.CallOption) (*ViewReply, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ViewReply) @@ -65,20 +89,20 @@ func (c *aptosClient) View(ctx context.Context, in *ViewRequest, opts ...grpc.Ca return out, nil } -func (c *aptosClient) TransactionByHash(ctx context.Context, in *TransactionByHashRequest, opts ...grpc.CallOption) (*TransactionByHashReply, error) { +func (c *aptosClient) EventsByHandle(ctx context.Context, in *EventsByHandleRequest, opts ...grpc.CallOption) (*EventsByHandleReply, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(TransactionByHashReply) - err := c.cc.Invoke(ctx, Aptos_TransactionByHash_FullMethodName, in, out, cOpts...) + out := new(EventsByHandleReply) + err := c.cc.Invoke(ctx, Aptos_EventsByHandle_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *aptosClient) AccountTransactions(ctx context.Context, in *AccountTransactionsRequest, opts ...grpc.CallOption) (*AccountTransactionsReply, error) { +func (c *aptosClient) TransactionByHash(ctx context.Context, in *TransactionByHashRequest, opts ...grpc.CallOption) (*TransactionByHashReply, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(AccountTransactionsReply) - err := c.cc.Invoke(ctx, Aptos_AccountTransactions_FullMethodName, in, out, cOpts...) + out := new(TransactionByHashReply) + err := c.cc.Invoke(ctx, Aptos_TransactionByHash_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -99,10 +123,12 @@ func (c *aptosClient) SubmitTransaction(ctx context.Context, in *SubmitTransacti // All implementations must embed UnimplementedAptosServer // for forward compatibility. type AptosServer interface { + LedgerVersion(context.Context, *LedgerVersionRequest) (*LedgerVersionReply, error) AccountAPTBalance(context.Context, *AccountAPTBalanceRequest) (*AccountAPTBalanceReply, error) + AccountTransactions(context.Context, *AccountTransactionsRequest) (*AccountTransactionsReply, error) View(context.Context, *ViewRequest) (*ViewReply, error) + EventsByHandle(context.Context, *EventsByHandleRequest) (*EventsByHandleReply, error) TransactionByHash(context.Context, *TransactionByHashRequest) (*TransactionByHashReply, error) - AccountTransactions(context.Context, *AccountTransactionsRequest) (*AccountTransactionsReply, error) SubmitTransaction(context.Context, *SubmitTransactionRequest) (*SubmitTransactionReply, error) mustEmbedUnimplementedAptosServer() } @@ -114,20 +140,26 @@ type AptosServer interface { // pointer dereference when methods are called. type UnimplementedAptosServer struct{} +func (UnimplementedAptosServer) LedgerVersion(context.Context, *LedgerVersionRequest) (*LedgerVersionReply, error) { + return nil, status.Error(codes.Unimplemented, "method LedgerVersion not implemented") +} func (UnimplementedAptosServer) AccountAPTBalance(context.Context, *AccountAPTBalanceRequest) (*AccountAPTBalanceReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method AccountAPTBalance not implemented") + return nil, status.Error(codes.Unimplemented, "method AccountAPTBalance not implemented") +} +func (UnimplementedAptosServer) AccountTransactions(context.Context, *AccountTransactionsRequest) (*AccountTransactionsReply, error) { + return nil, status.Error(codes.Unimplemented, "method AccountTransactions not implemented") } func (UnimplementedAptosServer) View(context.Context, *ViewRequest) (*ViewReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method View not implemented") + return nil, status.Error(codes.Unimplemented, "method View not implemented") } -func (UnimplementedAptosServer) TransactionByHash(context.Context, *TransactionByHashRequest) (*TransactionByHashReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method TransactionByHash not implemented") +func (UnimplementedAptosServer) EventsByHandle(context.Context, *EventsByHandleRequest) (*EventsByHandleReply, error) { + return nil, status.Error(codes.Unimplemented, "method EventsByHandle not implemented") } -func (UnimplementedAptosServer) AccountTransactions(context.Context, *AccountTransactionsRequest) (*AccountTransactionsReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method AccountTransactions not implemented") +func (UnimplementedAptosServer) TransactionByHash(context.Context, *TransactionByHashRequest) (*TransactionByHashReply, error) { + return nil, status.Error(codes.Unimplemented, "method TransactionByHash not implemented") } func (UnimplementedAptosServer) SubmitTransaction(context.Context, *SubmitTransactionRequest) (*SubmitTransactionReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method SubmitTransaction not implemented") + return nil, status.Error(codes.Unimplemented, "method SubmitTransaction not implemented") } func (UnimplementedAptosServer) mustEmbedUnimplementedAptosServer() {} func (UnimplementedAptosServer) testEmbeddedByValue() {} @@ -140,7 +172,7 @@ type UnsafeAptosServer interface { } func RegisterAptosServer(s grpc.ServiceRegistrar, srv AptosServer) { - // If the following call pancis, it indicates UnimplementedAptosServer was + // If the following call panics, it indicates UnimplementedAptosServer was // embedded by pointer and is nil. This will cause panics if an // unimplemented method is ever invoked, so we test this at initialization // time to prevent it from happening at runtime later due to I/O. @@ -150,6 +182,24 @@ func RegisterAptosServer(s grpc.ServiceRegistrar, srv AptosServer) { s.RegisterService(&Aptos_ServiceDesc, srv) } +func _Aptos_LedgerVersion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LedgerVersionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AptosServer).LedgerVersion(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Aptos_LedgerVersion_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AptosServer).LedgerVersion(ctx, req.(*LedgerVersionRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Aptos_AccountAPTBalance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(AccountAPTBalanceRequest) if err := dec(in); err != nil { @@ -168,6 +218,24 @@ func _Aptos_AccountAPTBalance_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _Aptos_AccountTransactions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AccountTransactionsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AptosServer).AccountTransactions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Aptos_AccountTransactions_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AptosServer).AccountTransactions(ctx, req.(*AccountTransactionsRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Aptos_View_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ViewRequest) if err := dec(in); err != nil { @@ -186,38 +254,38 @@ func _Aptos_View_Handler(srv interface{}, ctx context.Context, dec func(interfac return interceptor(ctx, in, info, handler) } -func _Aptos_TransactionByHash_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(TransactionByHashRequest) +func _Aptos_EventsByHandle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(EventsByHandleRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(AptosServer).TransactionByHash(ctx, in) + return srv.(AptosServer).EventsByHandle(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Aptos_TransactionByHash_FullMethodName, + FullMethod: Aptos_EventsByHandle_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AptosServer).TransactionByHash(ctx, req.(*TransactionByHashRequest)) + return srv.(AptosServer).EventsByHandle(ctx, req.(*EventsByHandleRequest)) } return interceptor(ctx, in, info, handler) } -func _Aptos_AccountTransactions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AccountTransactionsRequest) +func _Aptos_TransactionByHash_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TransactionByHashRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(AptosServer).AccountTransactions(ctx, in) + return srv.(AptosServer).TransactionByHash(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Aptos_AccountTransactions_FullMethodName, + FullMethod: Aptos_TransactionByHash_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AptosServer).AccountTransactions(ctx, req.(*AccountTransactionsRequest)) + return srv.(AptosServer).TransactionByHash(ctx, req.(*TransactionByHashRequest)) } return interceptor(ctx, in, info, handler) } @@ -247,21 +315,29 @@ var Aptos_ServiceDesc = grpc.ServiceDesc{ ServiceName: "loop.aptos.Aptos", HandlerType: (*AptosServer)(nil), Methods: []grpc.MethodDesc{ + { + MethodName: "LedgerVersion", + Handler: _Aptos_LedgerVersion_Handler, + }, { MethodName: "AccountAPTBalance", Handler: _Aptos_AccountAPTBalance_Handler, }, + { + MethodName: "AccountTransactions", + Handler: _Aptos_AccountTransactions_Handler, + }, { MethodName: "View", Handler: _Aptos_View_Handler, }, { - MethodName: "TransactionByHash", - Handler: _Aptos_TransactionByHash_Handler, + MethodName: "EventsByHandle", + Handler: _Aptos_EventsByHandle_Handler, }, { - MethodName: "AccountTransactions", - Handler: _Aptos_AccountTransactions_Handler, + MethodName: "TransactionByHash", + Handler: _Aptos_TransactionByHash_Handler, }, { MethodName: "SubmitTransaction", diff --git a/pkg/chains/aptos/proto_helpers.go b/pkg/chains/aptos/proto_helpers.go index ce1573a0f..b387a84b5 100644 --- a/pkg/chains/aptos/proto_helpers.go +++ b/pkg/chains/aptos/proto_helpers.go @@ -87,26 +87,26 @@ func ConvertTypeTagFromProto(proto *TypeTag) (*typeaptos.TypeTag, error) { var impl typeaptos.TypeTagImpl - switch proto.Kind { - case TypeTagKind_TYPE_TAG_KIND_BOOL: + switch proto.Type { + case TypeTagType_TYPE_TAG_BOOL: impl = typeaptos.BoolTag{} - case TypeTagKind_TYPE_TAG_KIND_U8: + case TypeTagType_TYPE_TAG_U8: impl = typeaptos.U8Tag{} - case TypeTagKind_TYPE_TAG_KIND_U16: + case TypeTagType_TYPE_TAG_U16: impl = typeaptos.U16Tag{} - case TypeTagKind_TYPE_TAG_KIND_U32: + case TypeTagType_TYPE_TAG_U32: impl = typeaptos.U32Tag{} - case TypeTagKind_TYPE_TAG_KIND_U64: + case TypeTagType_TYPE_TAG_U64: impl = typeaptos.U64Tag{} - case TypeTagKind_TYPE_TAG_KIND_U128: + case TypeTagType_TYPE_TAG_U128: impl = typeaptos.U128Tag{} - case TypeTagKind_TYPE_TAG_KIND_U256: + case TypeTagType_TYPE_TAG_U256: impl = typeaptos.U256Tag{} - case TypeTagKind_TYPE_TAG_KIND_ADDRESS: + case TypeTagType_TYPE_TAG_ADDRESS: impl = typeaptos.AddressTag{} - case TypeTagKind_TYPE_TAG_KIND_SIGNER: + case TypeTagType_TYPE_TAG_SIGNER: impl = typeaptos.SignerTag{} - case TypeTagKind_TYPE_TAG_KIND_VECTOR: + case TypeTagType_TYPE_TAG_VECTOR: vectorValue := proto.GetVector() if vectorValue == nil { return nil, fmt.Errorf("vector type tag missing vector value") @@ -118,7 +118,7 @@ func ConvertTypeTagFromProto(proto *TypeTag) (*typeaptos.TypeTag, error) { impl = typeaptos.VectorTag{ ElementType: *elementType, } - case TypeTagKind_TYPE_TAG_KIND_STRUCT: + case TypeTagType_TYPE_TAG_STRUCT: structValue := proto.GetStruct() if structValue == nil { return nil, fmt.Errorf("struct type tag missing struct value") @@ -143,7 +143,7 @@ func ConvertTypeTagFromProto(proto *TypeTag) (*typeaptos.TypeTag, error) { Name: structValue.Name, TypeParams: typeParams, } - case TypeTagKind_TYPE_TAG_KIND_GENERIC: + case TypeTagType_TYPE_TAG_GENERIC: genericValue := proto.GetGeneric() if genericValue == nil { return nil, fmt.Errorf("generic type tag missing generic value") @@ -152,7 +152,7 @@ func ConvertTypeTagFromProto(proto *TypeTag) (*typeaptos.TypeTag, error) { Index: uint16(genericValue.Index), } default: - return nil, fmt.Errorf("unknown type tag kind: %v", proto.Kind) + return nil, fmt.Errorf("unknown type tag type: %v", proto.Type) } return &typeaptos.TypeTag{ @@ -167,7 +167,7 @@ func ConvertTypeTagToProto(tag *typeaptos.TypeTag) (*TypeTag, error) { } protoTag := &TypeTag{ - Kind: TypeTagKind(tag.Value.TypeTagKind()), + Type: TypeTagType(tag.Value.TypeTagType()), } switch v := tag.Value.(type) { @@ -232,8 +232,237 @@ func ConvertViewReplyToProto(reply *typeaptos.ViewReply) (*ViewReply, error) { }, nil } +// ConvertEventsByHandleRequestToProto converts Go request to proto +func ConvertEventsByHandleRequestToProto(req *typeaptos.EventsByHandleRequest) (*EventsByHandleRequest, error) { + if req == nil { + return nil, fmt.Errorf("request is nil") + } + + protoReq := &EventsByHandleRequest{ + Account: req.Account[:], + EventHandle: req.EventHandle, + FieldName: req.FieldName, + } + if req.Start != nil { + protoReq.Start = req.Start + } + if req.Limit != nil { + protoReq.Limit = req.Limit + } + + return protoReq, nil +} + +// ConvertEventsByHandleRequestFromProto converts proto request to Go +func ConvertEventsByHandleRequestFromProto(proto *EventsByHandleRequest) (*typeaptos.EventsByHandleRequest, error) { + if proto == nil { + return nil, fmt.Errorf("proto request is nil") + } + + if len(proto.Account) != typeaptos.AccountAddressLength { + return nil, fmt.Errorf("invalid account address length: expected %d, got %d", typeaptos.AccountAddressLength, len(proto.Account)) + } + + var account typeaptos.AccountAddress + copy(account[:], proto.Account) + + req := &typeaptos.EventsByHandleRequest{ + Account: account, + EventHandle: proto.EventHandle, + FieldName: proto.FieldName, + } + if proto.Start != nil { + req.Start = proto.Start + } + if proto.Limit != nil { + req.Limit = proto.Limit + } + + return req, nil +} + +// ConvertEventsByHandleReplyToProto converts Go reply to proto +func ConvertEventsByHandleReplyToProto(reply *typeaptos.EventsByHandleReply) (*EventsByHandleReply, error) { + if reply == nil { + return nil, fmt.Errorf("reply is nil") + } + + protoEvents := make([]*Event, len(reply.Events)) + for i, event := range reply.Events { + protoEvent, err := ConvertEventToProto(event) + if err != nil { + return nil, fmt.Errorf("failed to convert event %d: %w", i, err) + } + protoEvents[i] = protoEvent + } + + return &EventsByHandleReply{ + Events: protoEvents, + }, nil +} + +// ConvertEventsByHandleReplyFromProto converts proto reply to Go +func ConvertEventsByHandleReplyFromProto(proto *EventsByHandleReply) (*typeaptos.EventsByHandleReply, error) { + if proto == nil { + return nil, fmt.Errorf("proto reply is nil") + } + + events := make([]*typeaptos.Event, len(proto.Events)) + for i, protoEvent := range proto.Events { + event, err := ConvertEventFromProto(protoEvent) + if err != nil { + return nil, fmt.Errorf("failed to convert event %d: %w", i, err) + } + events[i] = event + } + + return &typeaptos.EventsByHandleReply{ + Events: events, + }, nil +} + +// ConvertEventToProto converts Go Event to proto +func ConvertEventToProto(event *typeaptos.Event) (*Event, error) { + if event == nil { + return nil, fmt.Errorf("event is nil") + } + + protoEvent := &Event{ + Version: event.Version, + Type: event.Type, + SequenceNumber: event.SequenceNumber, + Data: event.Data, + } + + if event.Guid != nil { + protoGuid, err := ConvertGUIDToProto(event.Guid) + if err != nil { + return nil, fmt.Errorf("failed to convert GUID: %w", err) + } + protoEvent.Guid = protoGuid + } + + return protoEvent, nil +} + +// ConvertEventFromProto converts proto Event to Go +func ConvertEventFromProto(proto *Event) (*typeaptos.Event, error) { + if proto == nil { + return nil, fmt.Errorf("proto event is nil") + } + + event := &typeaptos.Event{ + Version: proto.Version, + Type: proto.Type, + SequenceNumber: proto.SequenceNumber, + Data: proto.Data, + } + + if proto.Guid != nil { + guid, err := ConvertGUIDFromProto(proto.Guid) + if err != nil { + return nil, fmt.Errorf("failed to convert GUID: %w", err) + } + event.Guid = guid + } + + return event, nil +} + +// ConvertGUIDToProto converts Go GUID to proto +func ConvertGUIDToProto(guid *typeaptos.GUID) (*GUID, error) { + if guid == nil { + return nil, fmt.Errorf("guid is nil") + } + + return &GUID{ + CreationNumber: guid.CreationNumber, + AccountAddress: guid.AccountAddress[:], + }, nil +} + +// ConvertGUIDFromProto converts proto GUID to Go +func ConvertGUIDFromProto(proto *GUID) (*typeaptos.GUID, error) { + if proto == nil { + return nil, fmt.Errorf("proto guid is nil") + } + + if len(proto.AccountAddress) != typeaptos.AccountAddressLength { + return nil, fmt.Errorf("invalid account address length: expected %d, got %d", typeaptos.AccountAddressLength, len(proto.AccountAddress)) + } + + var address typeaptos.AccountAddress + copy(address[:], proto.AccountAddress) + + return &typeaptos.GUID{ + CreationNumber: proto.CreationNumber, + AccountAddress: address, + }, nil +} + // ========== TransactionByHash Conversion ========== +func ConvertAccountTransactionsRequestToProto(req typeaptos.AccountTransactionsRequest) *AccountTransactionsRequest { + protoReq := &AccountTransactionsRequest{ + Address: req.Address[:], + } + if req.Start != nil { + protoReq.Start = req.Start + } + if req.Limit != nil { + protoReq.Limit = req.Limit + } + return protoReq +} + +func ConvertAccountTransactionsRequestFromProto(proto *AccountTransactionsRequest) (*typeaptos.AccountTransactionsRequest, error) { + if proto == nil { + return nil, fmt.Errorf("proto request is nil") + } + if len(proto.Address) != typeaptos.AccountAddressLength { + return nil, fmt.Errorf("invalid account address length: expected %d, got %d", typeaptos.AccountAddressLength, len(proto.Address)) + } + + var address typeaptos.AccountAddress + copy(address[:], proto.Address) + + return &typeaptos.AccountTransactionsRequest{ + Address: address, + Start: proto.Start, + Limit: proto.Limit, + }, nil +} + +func ConvertAccountTransactionsReplyToProto(reply *typeaptos.AccountTransactionsReply) *AccountTransactionsReply { + if reply == nil { + return nil + } + + txs := make([]*Transaction, 0, len(reply.Transactions)) + for _, tx := range reply.Transactions { + txs = append(txs, ConvertTransactionToProto(tx)) + } + return &AccountTransactionsReply{Transactions: txs} +} + +func ConvertAccountTransactionsReplyFromProto(proto *AccountTransactionsReply) (*typeaptos.AccountTransactionsReply, error) { + if proto == nil { + return nil, nil + } + + txs := make([]*typeaptos.Transaction, 0, len(proto.Transactions)) + for _, tx := range proto.Transactions { + decoded, err := ConvertTransactionFromProto(tx) + if err != nil { + return nil, err + } + if decoded != nil { + txs = append(txs, decoded) + } + } + return &typeaptos.AccountTransactionsReply{Transactions: txs}, nil +} + func ConvertTransactionByHashRequestToProto(req typeaptos.TransactionByHashRequest) *TransactionByHashRequest { return &TransactionByHashRequest{ Hash: req.Hash, @@ -360,62 +589,6 @@ func ConvertTransactionVariantFromProto(proto TransactionVariant) typeaptos.Tran } } -// ========== AccountTransactions Conversion ========== - -func ConvertAccountTransactionsRequestToProto(req typeaptos.AccountTransactionsRequest) *AccountTransactionsRequest { - return &AccountTransactionsRequest{ - Address: req.Address[:], - Start: req.Start, - Limit: req.Limit, - } -} - -func ConvertAccountTransactionsRequestFromProto(proto *AccountTransactionsRequest) (typeaptos.AccountTransactionsRequest, error) { - if proto == nil { - return typeaptos.AccountTransactionsRequest{}, fmt.Errorf("proto request is nil") - } - if len(proto.Address) != typeaptos.AccountAddressLength { - return typeaptos.AccountTransactionsRequest{}, fmt.Errorf("invalid address length: expected %d, got %d", typeaptos.AccountAddressLength, len(proto.Address)) - } - var address typeaptos.AccountAddress - copy(address[:], proto.Address) - return typeaptos.AccountTransactionsRequest{ - Address: address, - Start: proto.Start, - Limit: proto.Limit, - }, nil -} - -func ConvertAccountTransactionsReplyToProto(reply *typeaptos.AccountTransactionsReply) *AccountTransactionsReply { - if reply == nil { - return nil - } - protoTxs := make([]*Transaction, len(reply.Transactions)) - for i, tx := range reply.Transactions { - protoTxs[i] = ConvertTransactionToProto(tx) - } - return &AccountTransactionsReply{ - Transactions: protoTxs, - } -} - -func ConvertAccountTransactionsReplyFromProto(proto *AccountTransactionsReply) (*typeaptos.AccountTransactionsReply, error) { - if proto == nil { - return nil, nil - } - txs := make([]*typeaptos.Transaction, len(proto.Transactions)) - for i, protoTx := range proto.Transactions { - tx, err := ConvertTransactionFromProto(protoTx) - if err != nil { - return nil, fmt.Errorf("failed to convert transaction %d: %w", i, err) - } - txs[i] = tx - } - return &typeaptos.AccountTransactionsReply{ - Transactions: txs, - }, nil -} - // ========== SubmitTransaction Conversion ========== func ConvertSubmitTransactionRequestToProto(req typeaptos.SubmitTransactionRequest) (*SubmitTransactionRequest, error) { @@ -476,11 +649,17 @@ func ConvertSubmitTransactionReplyToProto(reply *typeaptos.SubmitTransactionRepl return nil, fmt.Errorf("reply is nil") } - return &SubmitTransactionReply{ - TxStatus: TxStatus(reply.TxStatus), - TxHash: reply.TxHash, - TxIdempotencyKey: reply.TxIdempotencyKey, - }, nil + protoReply := &SubmitTransactionReply{} + + if reply.PendingTransaction != nil { + protoPending, err := ConvertPendingTransactionToProto(reply.PendingTransaction) + if err != nil { + return nil, fmt.Errorf("failed to convert pending transaction: %w", err) + } + protoReply.PendingTransaction = protoPending + } + + return protoReply, nil } func ConvertSubmitTransactionReplyFromProto(proto *SubmitTransactionReply) (*typeaptos.SubmitTransactionReply, error) { @@ -488,9 +667,68 @@ func ConvertSubmitTransactionReplyFromProto(proto *SubmitTransactionReply) (*typ return nil, fmt.Errorf("proto reply is nil") } - return &typeaptos.SubmitTransactionReply{ - TxStatus: typeaptos.TransactionStatus(proto.TxStatus), - TxHash: proto.TxHash, - TxIdempotencyKey: proto.TxIdempotencyKey, - }, nil + reply := &typeaptos.SubmitTransactionReply{} + + if proto.PendingTransaction != nil { + pending, err := ConvertPendingTransactionFromProto(proto.PendingTransaction) + if err != nil { + return nil, fmt.Errorf("failed to convert pending transaction: %w", err) + } + reply.PendingTransaction = pending + } + + return reply, nil +} + +func ConvertPendingTransactionToProto(tx *typeaptos.PendingTransaction) (*PendingTransaction, error) { + if tx == nil { + return nil, fmt.Errorf("pending transaction is nil") + } + + protoTx := &PendingTransaction{ + Hash: tx.Hash, + Sender: tx.Sender[:], + SequenceNumber: tx.SequenceNumber, + MaxGasAmount: tx.MaxGasAmount, + GasUnitPrice: tx.GasUnitPrice, + ExpirationTimestampSecs: tx.ExpirationTimestampSecs, + Payload: tx.Payload, + Signature: tx.Signature, + } + + if tx.ReplayProtectionNonce != nil { + protoTx.ReplayProtectionNonce = tx.ReplayProtectionNonce + } + + return protoTx, nil +} + +func ConvertPendingTransactionFromProto(proto *PendingTransaction) (*typeaptos.PendingTransaction, error) { + if proto == nil { + return nil, fmt.Errorf("proto pending transaction is nil") + } + + if len(proto.Sender) != typeaptos.AccountAddressLength { + return nil, fmt.Errorf("invalid sender address length: expected %d, got %d", typeaptos.AccountAddressLength, len(proto.Sender)) + } + + var sender typeaptos.AccountAddress + copy(sender[:], proto.Sender) + + tx := &typeaptos.PendingTransaction{ + Hash: proto.Hash, + Sender: sender, + SequenceNumber: proto.SequenceNumber, + MaxGasAmount: proto.MaxGasAmount, + GasUnitPrice: proto.GasUnitPrice, + ExpirationTimestampSecs: proto.ExpirationTimestampSecs, + Payload: proto.Payload, + Signature: proto.Signature, + } + + if proto.ReplayProtectionNonce != nil { + tx.ReplayProtectionNonce = proto.ReplayProtectionNonce + } + + return tx, nil } diff --git a/pkg/chains/aptos/proto_helpers_test.go b/pkg/chains/aptos/proto_helpers_test.go index 7dc916b9a..2a806292a 100644 --- a/pkg/chains/aptos/proto_helpers_test.go +++ b/pkg/chains/aptos/proto_helpers_test.go @@ -87,7 +87,7 @@ func TestTypeTagConverters(t *testing.T) { roundtrip, err := conv.ConvertTypeTagFromProto(proto) require.NoError(t, err, "failed to convert back tag %d", i) - require.Equal(t, tag.Value.TypeTagKind(), roundtrip.Value.TypeTagKind()) + require.Equal(t, tag.Value.TypeTagType(), roundtrip.Value.TypeTagType()) } }) @@ -106,7 +106,7 @@ func TestTypeTagConverters(t *testing.T) { require.NoError(t, err) vec, ok := roundtrip.Value.(typeaptos.VectorTag) require.True(t, ok) - require.Equal(t, typeaptos.TypeTagU64, vec.ElementType.Value.TypeTagKind()) + require.Equal(t, typeaptos.TypeTagU64, vec.ElementType.Value.TypeTagType()) }) t.Run("StructTag roundtrip", func(t *testing.T) { @@ -166,7 +166,7 @@ func TestTypeTagConverters(t *testing.T) { t.Run("Invalid struct address length", func(t *testing.T) { protoTag := &conv.TypeTag{ - Kind: conv.TypeTagKind_TYPE_TAG_KIND_STRUCT, + Type: conv.TypeTagType_TYPE_TAG_STRUCT, Value: &conv.TypeTag_Struct{ Struct: &conv.StructTag{ Address: mkBytes(typeaptos.AccountAddressLength-1, 0x01), @@ -183,6 +183,67 @@ func TestTypeTagConverters(t *testing.T) { }) } +func TestEventConverters(t *testing.T) { + t.Run("Event roundtrip without GUID", func(t *testing.T) { + event := &typeaptos.Event{ + Version: 100, + Type: "0x1::coin::WithdrawEvent", + Guid: nil, + SequenceNumber: 5, + Data: []byte(`{"amount":"1000"}`), + } + + protoEvent, err := conv.ConvertEventToProto(event) + require.NoError(t, err) + require.Equal(t, uint64(100), protoEvent.Version) + require.Equal(t, "0x1::coin::WithdrawEvent", protoEvent.Type) + require.Nil(t, protoEvent.Guid) + + roundtrip, err := conv.ConvertEventFromProto(protoEvent) + require.NoError(t, err) + require.Equal(t, event.Version, roundtrip.Version) + require.Equal(t, event.Type, roundtrip.Type) + require.Nil(t, roundtrip.Guid) + require.True(t, bytes.Equal(event.Data, roundtrip.Data)) + }) + + t.Run("Event roundtrip with GUID", func(t *testing.T) { + addr := mkBytes(typeaptos.AccountAddressLength, 0xAB) + event := &typeaptos.Event{ + Version: 200, + Type: "0x1::account::KeyRotationEvent", + Guid: &typeaptos.GUID{ + CreationNumber: 42, + AccountAddress: [32]byte(addr), + }, + SequenceNumber: 10, + Data: []byte(`{"old_key":"0x123"}`), + } + + protoEvent, err := conv.ConvertEventToProto(event) + require.NoError(t, err) + require.NotNil(t, protoEvent.Guid) + require.Equal(t, uint64(42), protoEvent.Guid.CreationNumber) + + roundtrip, err := conv.ConvertEventFromProto(protoEvent) + require.NoError(t, err) + require.NotNil(t, roundtrip.Guid) + require.Equal(t, uint64(42), roundtrip.Guid.CreationNumber) + require.True(t, bytes.Equal(addr, roundtrip.Guid.AccountAddress[:])) + }) + + t.Run("GUID invalid address length", func(t *testing.T) { + protoGuid := &conv.GUID{ + CreationNumber: 1, + AccountAddress: mkBytes(typeaptos.AccountAddressLength+1, 0x01), + } + + _, err := conv.ConvertGUIDFromProto(protoGuid) + require.Error(t, err) + require.Contains(t, err.Error(), "invalid account address length") + }) +} + func TestTransactionConverters(t *testing.T) { t.Run("Transaction roundtrip with all fields", func(t *testing.T) { version := uint64(12345) @@ -303,24 +364,35 @@ func TestSubmitTransactionConverters(t *testing.T) { require.Nil(t, roundtrip.GasConfig) }) - t.Run("SubmitTransactionReply roundtrip", func(t *testing.T) { - reply := &typeaptos.SubmitTransactionReply{ - TxStatus: typeaptos.TxSuccess, - TxHash: "0xabc123", - TxIdempotencyKey: "key-456", + t.Run("PendingTransaction roundtrip", func(t *testing.T) { + senderAddr := mkBytes(typeaptos.AccountAddressLength, 0xAA) + nonce := uint64(999) + tx := &typeaptos.PendingTransaction{ + Hash: "0xpending123", + Sender: [32]byte(senderAddr), + SequenceNumber: 42, + ReplayProtectionNonce: &nonce, + MaxGasAmount: 10000, + GasUnitPrice: 200, + ExpirationTimestampSecs: 1234567890, + Payload: []byte{0x11, 0x22, 0x33}, + Signature: []byte{0xAA, 0xBB, 0xCC}, } - protoReply, err := conv.ConvertSubmitTransactionReplyToProto(reply) + protoTx, err := conv.ConvertPendingTransactionToProto(tx) require.NoError(t, err) - require.Equal(t, conv.TxStatus(typeaptos.TxSuccess), protoReply.TxStatus) - require.Equal(t, "0xabc123", protoReply.TxHash) - require.Equal(t, "key-456", protoReply.TxIdempotencyKey) + require.Equal(t, "0xpending123", protoTx.Hash) + require.Equal(t, uint64(42), protoTx.SequenceNumber) + require.NotNil(t, protoTx.ReplayProtectionNonce) + require.Equal(t, uint64(999), *protoTx.ReplayProtectionNonce) - roundtrip, err := conv.ConvertSubmitTransactionReplyFromProto(protoReply) + roundtrip, err := conv.ConvertPendingTransactionFromProto(protoTx) require.NoError(t, err) - require.Equal(t, reply.TxStatus, roundtrip.TxStatus) - require.Equal(t, reply.TxHash, roundtrip.TxHash) - require.Equal(t, reply.TxIdempotencyKey, roundtrip.TxIdempotencyKey) + require.Equal(t, tx.Hash, roundtrip.Hash) + require.True(t, bytes.Equal(senderAddr, roundtrip.Sender[:])) + require.Equal(t, tx.SequenceNumber, roundtrip.SequenceNumber) + require.NotNil(t, roundtrip.ReplayProtectionNonce) + require.Equal(t, nonce, *roundtrip.ReplayProtectionNonce) }) t.Run("Invalid request errors", func(t *testing.T) { @@ -345,139 +417,74 @@ func TestSubmitTransactionConverters(t *testing.T) { }) } -func TestErrorJoinBehavior(t *testing.T) { - t.Run("Aggregates multiple conversion errors", func(t *testing.T) { - // Test that error wrapping works as expected - protoPayload := &conv.ViewPayload{ - Module: &conv.ModuleID{ - Address: mkBytes(typeaptos.AccountAddressLength-5, 0x01), - Name: "bad", - }, - } - _, err := conv.ConvertViewPayloadFromProto(protoPayload) - require.Error(t, err) - require.True(t, errors.Is(err, err)) - }) -} - -func TestAccountTransactionsConverters(t *testing.T) { - t.Run("Request roundtrip with start and limit", func(t *testing.T) { - addr := mkBytes(typeaptos.AccountAddressLength, 0xAA) - start := uint64(100) - limit := uint64(25) - req := typeaptos.AccountTransactionsRequest{ - Address: [32]byte(addr), - Start: &start, - Limit: &limit, +func TestEventsByHandleConverters(t *testing.T) { + t.Run("EventsByHandleRequest roundtrip with optionals", func(t *testing.T) { + addr := mkBytes(typeaptos.AccountAddressLength, 0x03) + start := uint64(10) + limit := uint64(50) + req := &typeaptos.EventsByHandleRequest{ + Account: [32]byte(addr), + EventHandle: "0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>", + FieldName: "withdraw_events", + Start: &start, + Limit: &limit, } - protoReq := conv.ConvertAccountTransactionsRequestToProto(req) - require.Equal(t, addr, protoReq.Address) - require.NotNil(t, protoReq.Start) - require.Equal(t, uint64(100), *protoReq.Start) - require.NotNil(t, protoReq.Limit) - require.Equal(t, uint64(25), *protoReq.Limit) - - roundtrip, err := conv.ConvertAccountTransactionsRequestFromProto(protoReq) + protoReq, err := conv.ConvertEventsByHandleRequestToProto(req) require.NoError(t, err) - require.Equal(t, req.Address, roundtrip.Address) - require.Equal(t, *req.Start, *roundtrip.Start) - require.Equal(t, *req.Limit, *roundtrip.Limit) - }) - - t.Run("Request roundtrip without start and limit", func(t *testing.T) { - addr := mkBytes(typeaptos.AccountAddressLength, 0xBB) - req := typeaptos.AccountTransactionsRequest{ - Address: [32]byte(addr), - Start: nil, - Limit: nil, - } - - protoReq := conv.ConvertAccountTransactionsRequestToProto(req) - require.Nil(t, protoReq.Start) - require.Nil(t, protoReq.Limit) + require.Equal(t, "0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>", protoReq.EventHandle) + require.Equal(t, "withdraw_events", protoReq.FieldName) + require.NotNil(t, protoReq.Start) + require.Equal(t, uint64(10), *protoReq.Start) - roundtrip, err := conv.ConvertAccountTransactionsRequestFromProto(protoReq) + roundtrip, err := conv.ConvertEventsByHandleRequestFromProto(protoReq) require.NoError(t, err) - require.Nil(t, roundtrip.Start) - require.Nil(t, roundtrip.Limit) - }) - - t.Run("Request from proto nil error", func(t *testing.T) { - _, err := conv.ConvertAccountTransactionsRequestFromProto(nil) - require.Error(t, err) - require.Contains(t, err.Error(), "proto request is nil") - }) - - t.Run("Request from proto invalid address length", func(t *testing.T) { - protoReq := &conv.AccountTransactionsRequest{ - Address: mkBytes(10, 0x01), - } - _, err := conv.ConvertAccountTransactionsRequestFromProto(protoReq) - require.Error(t, err) - require.Contains(t, err.Error(), "invalid address length") + require.Equal(t, req.EventHandle, roundtrip.EventHandle) + require.NotNil(t, roundtrip.Start) + require.Equal(t, start, *roundtrip.Start) }) - t.Run("Reply roundtrip with multiple transactions", func(t *testing.T) { - version1 := uint64(100) - success1 := true - version2 := uint64(200) - success2 := false - reply := &typeaptos.AccountTransactionsReply{ - Transactions: []*typeaptos.Transaction{ - { - Type: typeaptos.TransactionVariantUser, - Hash: "0xaaa", - Version: &version1, - Success: &success1, - Data: []byte(`{"tx":1}`), - }, - { - Type: typeaptos.TransactionVariantUser, - Hash: "0xbbb", - Version: &version2, - Success: &success2, - Data: []byte(`{"tx":2}`), - }, + t.Run("EventsByHandleReply roundtrip", func(t *testing.T) { + events := []*typeaptos.Event{ + { + Version: 100, + Type: "0x1::coin::DepositEvent", + SequenceNumber: 1, + Data: []byte(`{"amount":"500"}`), + }, + { + Version: 101, + Type: "0x1::coin::WithdrawEvent", + SequenceNumber: 2, + Data: []byte(`{"amount":"300"}`), }, } + reply := &typeaptos.EventsByHandleReply{Events: events} - protoReply := conv.ConvertAccountTransactionsReplyToProto(reply) - require.Len(t, protoReply.Transactions, 2) - require.Equal(t, "0xaaa", protoReply.Transactions[0].Hash) - require.Equal(t, "0xbbb", protoReply.Transactions[1].Hash) - - roundtrip, err := conv.ConvertAccountTransactionsReplyFromProto(protoReply) + protoReply, err := conv.ConvertEventsByHandleReplyToProto(reply) require.NoError(t, err) - require.Len(t, roundtrip.Transactions, 2) - require.Equal(t, "0xaaa", roundtrip.Transactions[0].Hash) - require.Equal(t, uint64(100), *roundtrip.Transactions[0].Version) - require.True(t, *roundtrip.Transactions[0].Success) - require.Equal(t, "0xbbb", roundtrip.Transactions[1].Hash) - require.Equal(t, uint64(200), *roundtrip.Transactions[1].Version) - require.False(t, *roundtrip.Transactions[1].Success) - }) + require.Len(t, protoReply.Events, 2) - t.Run("Reply roundtrip with empty transactions", func(t *testing.T) { - reply := &typeaptos.AccountTransactionsReply{ - Transactions: []*typeaptos.Transaction{}, - } - - protoReply := conv.ConvertAccountTransactionsReplyToProto(reply) - require.Len(t, protoReply.Transactions, 0) - - roundtrip, err := conv.ConvertAccountTransactionsReplyFromProto(protoReply) + roundtrip, err := conv.ConvertEventsByHandleReplyFromProto(protoReply) require.NoError(t, err) - require.Len(t, roundtrip.Transactions, 0) + require.Len(t, roundtrip.Events, 2) + require.Equal(t, uint64(100), roundtrip.Events[0].Version) + require.Equal(t, "0x1::coin::DepositEvent", roundtrip.Events[0].Type) }) +} - t.Run("Reply nil handling", func(t *testing.T) { - result := conv.ConvertAccountTransactionsReplyToProto(nil) - require.Nil(t, result) - - roundtrip, err := conv.ConvertAccountTransactionsReplyFromProto(nil) - require.NoError(t, err) - require.Nil(t, roundtrip) +func TestErrorJoinBehavior(t *testing.T) { + t.Run("Aggregates multiple conversion errors", func(t *testing.T) { + // Test that error wrapping works as expected + protoPayload := &conv.ViewPayload{ + Module: &conv.ModuleID{ + Address: mkBytes(typeaptos.AccountAddressLength-5, 0x01), + Name: "bad", + }, + } + _, err := conv.ConvertViewPayloadFromProto(protoPayload) + require.Error(t, err) + require.True(t, errors.Is(err, err)) }) } @@ -492,4 +499,16 @@ func TestNilHandling(t *testing.T) { require.NoError(t, err) require.Nil(t, result) }) + + t.Run("ConvertPendingTransactionToProto with nil", func(t *testing.T) { + _, err := conv.ConvertPendingTransactionToProto(nil) + require.Error(t, err) + require.Contains(t, err.Error(), "pending transaction is nil") + }) + + t.Run("ConvertPendingTransactionFromProto with nil", func(t *testing.T) { + _, err := conv.ConvertPendingTransactionFromProto(nil) + require.Error(t, err) + require.Contains(t, err.Error(), "proto pending transaction is nil") + }) } diff --git a/pkg/loop/internal/core/services/capability/capabilities_registry.go b/pkg/loop/internal/core/services/capability/capabilities_registry.go index b398ea8c9..06c3affcf 100644 --- a/pkg/loop/internal/core/services/capability/capabilities_registry.go +++ b/pkg/loop/internal/core/services/capability/capabilities_registry.go @@ -4,6 +4,7 @@ import ( "context" "encoding/hex" "fmt" + "strings" "time" "google.golang.org/grpc" @@ -259,6 +260,41 @@ func decodeOcr3Config(pbCfg *capabilitiespb.OCR3Config) ocrtypes.ContractConfig } } +func transmitterAccountToBytes(account ocrtypes.Account) ([]byte, error) { + raw := []byte(account) + s := strings.TrimSpace(string(account)) + if s == "" { + return raw, nil + } + + trimmed := strings.TrimPrefix(strings.TrimPrefix(s, "0x"), "0X") + if looksHexAccount(trimmed) { + decoded, err := hex.DecodeString(trimmed) + if err != nil { + return nil, fmt.Errorf("failed to decode transmitter: %w", err) + } + return decoded, nil + } + + // Backward compatibility: some registry paths provide raw bytes directly. + return raw, nil +} + +func looksHexAccount(s string) bool { + if s == "" || len(s)%2 != 0 { + return false + } + for _, c := range s { + isDigit := c >= '0' && c <= '9' + isLower := c >= 'a' && c <= 'f' + isUpper := c >= 'A' && c <= 'F' + if !isDigit && !isLower && !isUpper { + return false + } + } + return true +} + func (cr *capabilitiesRegistryClient) Get(ctx context.Context, ID string) (capabilities.BaseCapability, error) { req := &pb.GetRequest{ Id: ID, @@ -512,9 +548,9 @@ func (c *capabilitiesRegistryServer) ConfigForCapability(ctx context.Context, re } transmitters := make([][]byte, len(cfg.Transmitters)) for i, t := range cfg.Transmitters { - transmitters[i], err = hex.DecodeString(string(t)) + transmitters[i], err = transmitterAccountToBytes(t) if err != nil { - return nil, fmt.Errorf("failed to decode transmitter: %w", err) + return nil, err } } ccp.Ocr3Configs[key] = &capabilitiespb.OCR3Config{ diff --git a/pkg/loop/internal/relayer/aptos.go b/pkg/loop/internal/relayer/aptos.go index 2667c2de3..34fc3ba35 100644 --- a/pkg/loop/internal/relayer/aptos.go +++ b/pkg/loop/internal/relayer/aptos.go @@ -4,6 +4,9 @@ import ( "context" "fmt" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + aptospb "github.com/smartcontractkit/chainlink-common/pkg/chains/aptos" "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/net" "github.com/smartcontractkit/chainlink-common/pkg/types" @@ -22,18 +25,36 @@ func NewAptosClient(client aptospb.AptosClient) *AptosClient { } } +func (ac *AptosClient) LedgerVersion(ctx context.Context) (uint64, error) { + reply, err := ac.grpcClient.LedgerVersion(ctx, &aptospb.LedgerVersionRequest{}) + if err != nil { + return 0, err + } + return reply.LedgerVersion, nil +} + func (ac *AptosClient) AccountAPTBalance(ctx context.Context, req aptos.AccountAPTBalanceRequest) (*aptos.AccountAPTBalanceReply, error) { reply, err := ac.grpcClient.AccountAPTBalance(ctx, &aptospb.AccountAPTBalanceRequest{ Address: req.Address[:], }) if err != nil { - return nil, net.WrapRPCErr(err) + return nil, err } return &aptos.AccountAPTBalanceReply{ Value: reply.Value, }, nil } +// AccountTransactions exposes Aptos account transaction listing for callers that need +// canonical tx hash derivation from transmitter account history. +func (ac *AptosClient) AccountTransactions(ctx context.Context, req aptos.AccountTransactionsRequest) (*aptos.AccountTransactionsReply, error) { + reply, err := ac.grpcClient.AccountTransactions(ctx, aptospb.ConvertAccountTransactionsRequestToProto(req)) + if err != nil { + return nil, err + } + return aptospb.ConvertAccountTransactionsReplyFromProto(reply) +} + func (ac *AptosClient) View(ctx context.Context, req aptos.ViewRequest) (*aptos.ViewReply, error) { // Convert Go types to proto types protoPayload, err := aptospb.ConvertViewPayloadToProto(req.Payload) @@ -44,32 +65,47 @@ func (ac *AptosClient) View(ctx context.Context, req aptos.ViewRequest) (*aptos. protoReq := &aptospb.ViewRequest{ Payload: protoPayload, } + if req.LedgerVersion != nil { + protoReq.LedgerVersion = req.LedgerVersion + } reply, err := ac.grpcClient.View(ctx, protoReq) if err != nil { - return nil, net.WrapRPCErr(err) + return nil, err } // Convert proto types back to Go types return aptospb.ConvertViewReplyFromProto(reply) } -func (ac *AptosClient) TransactionByHash(ctx context.Context, req aptos.TransactionByHashRequest) (*aptos.TransactionByHashReply, error) { - protoReq := aptospb.ConvertTransactionByHashRequestToProto(req) - protoResp, err := ac.grpcClient.TransactionByHash(ctx, protoReq) +func (ac *AptosClient) EventsByHandle(ctx context.Context, req aptos.EventsByHandleRequest) (*aptos.EventsByHandleReply, error) { + // Convert Go types to proto types + protoReq, err := aptospb.ConvertEventsByHandleRequestToProto(&req) if err != nil { - return nil, net.WrapRPCErr(err) + return nil, fmt.Errorf("failed to convert request: %w", err) } - return aptospb.ConvertTransactionByHashReplyFromProto(protoResp) + + reply, err := ac.grpcClient.EventsByHandle(ctx, protoReq) + if err != nil { + return nil, err + } + + // Convert proto types back to Go types + goReply, err := aptospb.ConvertEventsByHandleReplyFromProto(reply) + if err != nil { + return nil, fmt.Errorf("failed to convert reply: %w", err) + } + + return goReply, nil } -func (ac *AptosClient) AccountTransactions(ctx context.Context, req aptos.AccountTransactionsRequest) (*aptos.AccountTransactionsReply, error) { - protoReq := aptospb.ConvertAccountTransactionsRequestToProto(req) - protoResp, err := ac.grpcClient.AccountTransactions(ctx, protoReq) +func (ac *AptosClient) TransactionByHash(ctx context.Context, req aptos.TransactionByHashRequest) (*aptos.TransactionByHashReply, error) { + protoReq := aptospb.ConvertTransactionByHashRequestToProto(req) + protoResp, err := ac.grpcClient.TransactionByHash(ctx, protoReq) if err != nil { - return nil, net.WrapRPCErr(err) + return nil, err } - return aptospb.ConvertAccountTransactionsReplyFromProto(protoResp) + return aptospb.ConvertTransactionByHashReplyFromProto(protoResp) } func (ac *AptosClient) SubmitTransaction(ctx context.Context, req aptos.SubmitTransactionRequest) (*aptos.SubmitTransactionReply, error) { @@ -80,7 +116,7 @@ func (ac *AptosClient) SubmitTransaction(ctx context.Context, req aptos.SubmitTr protoResp, err := ac.grpcClient.SubmitTransaction(ctx, protoReq) if err != nil { - return nil, net.WrapRPCErr(err) + return nil, err } return aptospb.ConvertSubmitTransactionReplyFromProto(protoResp) @@ -96,6 +132,10 @@ type aptosServer struct { var _ aptospb.AptosServer = (*aptosServer)(nil) +type accountTransactionsReader interface { + AccountTransactions(ctx context.Context, req aptos.AccountTransactionsRequest) (*aptos.AccountTransactionsReply, error) +} + func newAptosServer(impl types.AptosService, b *net.BrokerExt) *aptosServer { return &aptosServer{impl: impl, BrokerExt: b.WithName("AptosServer")} } @@ -112,6 +152,30 @@ func (s *aptosServer) AccountAPTBalance(ctx context.Context, req *aptospb.Accoun }, nil } +func (s *aptosServer) LedgerVersion(ctx context.Context, _ *aptospb.LedgerVersionRequest) (*aptospb.LedgerVersionReply, error) { + ledgerVersion, err := s.impl.LedgerVersion(ctx) + if err != nil { + return nil, err + } + return &aptospb.LedgerVersionReply{LedgerVersion: ledgerVersion}, nil +} + +func (s *aptosServer) AccountTransactions(ctx context.Context, req *aptospb.AccountTransactionsRequest) (*aptospb.AccountTransactionsReply, error) { + impl, ok := s.impl.(accountTransactionsReader) + if !ok { + return nil, status.Error(codes.Unimplemented, "AccountTransactions not supported by aptos service") + } + goReq, err := aptospb.ConvertAccountTransactionsRequestFromProto(req) + if err != nil { + return nil, err + } + reply, err := impl.AccountTransactions(ctx, *goReq) + if err != nil { + return nil, err + } + return aptospb.ConvertAccountTransactionsReplyToProto(reply), nil +} + func (s *aptosServer) View(ctx context.Context, req *aptospb.ViewRequest) (*aptospb.ViewReply, error) { // Convert proto types to Go types goPayload, err := aptospb.ConvertViewPayloadFromProto(req.Payload) @@ -122,6 +186,10 @@ func (s *aptosServer) View(ctx context.Context, req *aptospb.ViewRequest) (*apto goReq := aptos.ViewRequest{ Payload: goPayload, } + if req.LedgerVersion != nil { + ledgerVersion := req.GetLedgerVersion() + goReq.LedgerVersion = &ledgerVersion + } reply, err := s.impl.View(ctx, goReq) if err != nil { @@ -132,31 +200,38 @@ func (s *aptosServer) View(ctx context.Context, req *aptospb.ViewRequest) (*apto return aptospb.ConvertViewReplyToProto(reply) } -func (s *aptosServer) TransactionByHash(ctx context.Context, req *aptospb.TransactionByHashRequest) (*aptospb.TransactionByHashReply, error) { - // Convert proto to Go types - goReq := aptospb.ConvertTransactionByHashRequestFromProto(req) +func (s *aptosServer) EventsByHandle(ctx context.Context, req *aptospb.EventsByHandleRequest) (*aptospb.EventsByHandleReply, error) { + // Convert proto types to Go types + goReq, err := aptospb.ConvertEventsByHandleRequestFromProto(req) + if err != nil { + return nil, fmt.Errorf("failed to convert request: %w", err) + } - reply, err := s.impl.TransactionByHash(ctx, goReq) + reply, err := s.impl.EventsByHandle(ctx, *goReq) if err != nil { return nil, err } // Convert Go types back to proto types - return aptospb.ConvertTransactionByHashReplyToProto(reply), nil -} - -func (s *aptosServer) AccountTransactions(ctx context.Context, req *aptospb.AccountTransactionsRequest) (*aptospb.AccountTransactionsReply, error) { - goReq, err := aptospb.ConvertAccountTransactionsRequestFromProto(req) + protoReply, err := aptospb.ConvertEventsByHandleReplyToProto(reply) if err != nil { - return nil, fmt.Errorf("failed to convert request: %w", err) + return nil, fmt.Errorf("failed to convert reply: %w", err) } - reply, err := s.impl.AccountTransactions(ctx, goReq) + return protoReply, nil +} + +func (s *aptosServer) TransactionByHash(ctx context.Context, req *aptospb.TransactionByHashRequest) (*aptospb.TransactionByHashReply, error) { + // Convert proto to Go types + goReq := aptospb.ConvertTransactionByHashRequestFromProto(req) + + reply, err := s.impl.TransactionByHash(ctx, goReq) if err != nil { return nil, err } - return aptospb.ConvertAccountTransactionsReplyToProto(reply), nil + // Convert Go types back to proto types + return aptospb.ConvertTransactionByHashReplyToProto(reply), nil } func (s *aptosServer) SubmitTransaction(ctx context.Context, req *aptospb.SubmitTransactionRequest) (*aptospb.SubmitTransactionReply, error) { diff --git a/pkg/loop/internal/relayerset/aptos.go b/pkg/loop/internal/relayerset/aptos.go index daba3c3d6..ca8f50450 100644 --- a/pkg/loop/internal/relayerset/aptos.go +++ b/pkg/loop/internal/relayerset/aptos.go @@ -21,20 +21,28 @@ type aptosClient struct { var _ aptospb.AptosClient = (*aptosClient)(nil) +func (ac *aptosClient) LedgerVersion(ctx context.Context, in *aptospb.LedgerVersionRequest, opts ...grpc.CallOption) (*aptospb.LedgerVersionReply, error) { + return ac.client.LedgerVersion(appendRelayID(ctx, ac.relayID), in, opts...) +} + func (ac *aptosClient) AccountAPTBalance(ctx context.Context, in *aptospb.AccountAPTBalanceRequest, opts ...grpc.CallOption) (*aptospb.AccountAPTBalanceReply, error) { return ac.client.AccountAPTBalance(appendRelayID(ctx, ac.relayID), in, opts...) } +func (ac *aptosClient) AccountTransactions(ctx context.Context, in *aptospb.AccountTransactionsRequest, opts ...grpc.CallOption) (*aptospb.AccountTransactionsReply, error) { + return ac.client.AccountTransactions(appendRelayID(ctx, ac.relayID), in, opts...) +} + func (ac *aptosClient) View(ctx context.Context, in *aptospb.ViewRequest, opts ...grpc.CallOption) (*aptospb.ViewReply, error) { return ac.client.View(appendRelayID(ctx, ac.relayID), in, opts...) } -func (ac *aptosClient) TransactionByHash(ctx context.Context, in *aptospb.TransactionByHashRequest, opts ...grpc.CallOption) (*aptospb.TransactionByHashReply, error) { - return ac.client.TransactionByHash(appendRelayID(ctx, ac.relayID), in, opts...) +func (ac *aptosClient) EventsByHandle(ctx context.Context, in *aptospb.EventsByHandleRequest, opts ...grpc.CallOption) (*aptospb.EventsByHandleReply, error) { + return ac.client.EventsByHandle(appendRelayID(ctx, ac.relayID), in, opts...) } -func (ac *aptosClient) AccountTransactions(ctx context.Context, in *aptospb.AccountTransactionsRequest, opts ...grpc.CallOption) (*aptospb.AccountTransactionsReply, error) { - return ac.client.AccountTransactions(appendRelayID(ctx, ac.relayID), in, opts...) +func (ac *aptosClient) TransactionByHash(ctx context.Context, in *aptospb.TransactionByHashRequest, opts ...grpc.CallOption) (*aptospb.TransactionByHashReply, error) { + return ac.client.TransactionByHash(appendRelayID(ctx, ac.relayID), in, opts...) } func (ac *aptosClient) SubmitTransaction(ctx context.Context, in *aptospb.SubmitTransactionRequest, opts ...grpc.CallOption) (*aptospb.SubmitTransactionReply, error) { @@ -48,6 +56,10 @@ type aptosServer struct { var _ aptospb.AptosServer = (*aptosServer)(nil) +type accountTransactionsReader interface { + AccountTransactions(ctx context.Context, req aptos.AccountTransactionsRequest) (*aptos.AccountTransactionsReply, error) +} + func (as *aptosServer) AccountAPTBalance(ctx context.Context, req *aptospb.AccountAPTBalanceRequest) (*aptospb.AccountAPTBalanceReply, error) { aptosService, err := as.parent.getAptosService(ctx) if err != nil { @@ -65,6 +77,39 @@ func (as *aptosServer) AccountAPTBalance(ctx context.Context, req *aptospb.Accou }, nil } +func (as *aptosServer) LedgerVersion(ctx context.Context, _ *aptospb.LedgerVersionRequest) (*aptospb.LedgerVersionReply, error) { + aptosService, err := as.parent.getAptosService(ctx) + if err != nil { + return nil, err + } + + ledgerVersion, err := aptosService.LedgerVersion(ctx) + if err != nil { + return nil, err + } + return &aptospb.LedgerVersionReply{LedgerVersion: ledgerVersion}, nil +} + +func (as *aptosServer) AccountTransactions(ctx context.Context, req *aptospb.AccountTransactionsRequest) (*aptospb.AccountTransactionsReply, error) { + aptosService, err := as.parent.getAptosService(ctx) + if err != nil { + return nil, err + } + client, ok := aptosService.(accountTransactionsReader) + if !ok { + return nil, fmt.Errorf("AccountTransactions not supported by aptos service") + } + goReq, err := aptospb.ConvertAccountTransactionsRequestFromProto(req) + if err != nil { + return nil, err + } + reply, err := client.AccountTransactions(ctx, *goReq) + if err != nil { + return nil, err + } + return aptospb.ConvertAccountTransactionsReplyToProto(reply), nil +} + func (as *aptosServer) View(ctx context.Context, req *aptospb.ViewRequest) (*aptospb.ViewReply, error) { aptosService, err := as.parent.getAptosService(ctx) if err != nil { @@ -80,6 +125,10 @@ func (as *aptosServer) View(ctx context.Context, req *aptospb.ViewRequest) (*apt goReq := aptos.ViewRequest{ Payload: goPayload, } + if req.LedgerVersion != nil { + ledgerVersion := req.GetLedgerVersion() + goReq.LedgerVersion = &ledgerVersion + } reply, err := aptosService.View(ctx, goReq) if err != nil { @@ -90,41 +139,48 @@ func (as *aptosServer) View(ctx context.Context, req *aptospb.ViewRequest) (*apt return aptospb.ConvertViewReplyToProto(reply) } -func (as *aptosServer) TransactionByHash(ctx context.Context, req *aptospb.TransactionByHashRequest) (*aptospb.TransactionByHashReply, error) { +func (as *aptosServer) EventsByHandle(ctx context.Context, req *aptospb.EventsByHandleRequest) (*aptospb.EventsByHandleReply, error) { aptosService, err := as.parent.getAptosService(ctx) if err != nil { return nil, err } - // Convert proto to Go types - goReq := aptospb.ConvertTransactionByHashRequestFromProto(req) + // Convert proto types to Go types + goReq, err := aptospb.ConvertEventsByHandleRequestFromProto(req) + if err != nil { + return nil, fmt.Errorf("failed to convert request: %w", err) + } - reply, err := aptosService.TransactionByHash(ctx, goReq) + reply, err := aptosService.EventsByHandle(ctx, *goReq) if err != nil { return nil, err } // Convert Go types back to proto types - return aptospb.ConvertTransactionByHashReplyToProto(reply), nil + protoReply, err := aptospb.ConvertEventsByHandleReplyToProto(reply) + if err != nil { + return nil, fmt.Errorf("failed to convert reply: %w", err) + } + + return protoReply, nil } -func (as *aptosServer) AccountTransactions(ctx context.Context, req *aptospb.AccountTransactionsRequest) (*aptospb.AccountTransactionsReply, error) { +func (as *aptosServer) TransactionByHash(ctx context.Context, req *aptospb.TransactionByHashRequest) (*aptospb.TransactionByHashReply, error) { aptosService, err := as.parent.getAptosService(ctx) if err != nil { return nil, err } - goReq, err := aptospb.ConvertAccountTransactionsRequestFromProto(req) - if err != nil { - return nil, fmt.Errorf("failed to convert request: %w", err) - } + // Convert proto to Go types + goReq := aptospb.ConvertTransactionByHashRequestFromProto(req) - reply, err := aptosService.AccountTransactions(ctx, goReq) + reply, err := aptosService.TransactionByHash(ctx, goReq) if err != nil { return nil, err } - return aptospb.ConvertAccountTransactionsReplyToProto(reply), nil + // Convert Go types back to proto types + return aptospb.ConvertTransactionByHashReplyToProto(reply), nil } func (as *aptosServer) SubmitTransaction(ctx context.Context, req *aptospb.SubmitTransactionRequest) (*aptospb.SubmitTransactionReply, error) { diff --git a/pkg/loop/internal/relayerset/relayerset_test.go b/pkg/loop/internal/relayerset/relayerset_test.go index d1d8198e5..cdac29424 100644 --- a/pkg/loop/internal/relayerset/relayerset_test.go +++ b/pkg/loop/internal/relayerset/relayerset_test.go @@ -1063,89 +1063,21 @@ func Test_RelayerSet_AptosService(t *testing.T) { }, }, { - name: "AccountTransactions", - run: func(t *testing.T, apt types.AptosService, mockApt *mocks2.AptosService) { - address := aptos.AccountAddress{ - 0x01, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - } - start := uint64(10) - limit := uint64(5) - req := aptos.AccountTransactionsRequest{ - Address: address, - Start: &start, - Limit: &limit, - } - version1 := uint64(100) - success1 := true - version2 := uint64(101) - success2 := true - expectedReply := &aptos.AccountTransactionsReply{ - Transactions: []*aptos.Transaction{ - { - Type: aptos.TransactionVariantUser, - Hash: "0xtx1", - Version: &version1, - Success: &success1, - Data: []byte(`{"sender":"0x1"}`), - }, - { - Type: aptos.TransactionVariantUser, - Hash: "0xtx2", - Version: &version2, - Success: &success2, - Data: []byte(`{"sender":"0x2"}`), - }, - }, - } - mockApt.EXPECT().AccountTransactions(mock.Anything, req). - Return(expectedReply, nil) - - reply, err := apt.AccountTransactions(ctx, req) - require.NoError(t, err) - require.Len(t, reply.Transactions, 2) - require.Equal(t, "0xtx1", reply.Transactions[0].Hash) - require.Equal(t, version1, *reply.Transactions[0].Version) - require.Equal(t, "0xtx2", reply.Transactions[1].Hash) - require.Equal(t, version2, *reply.Transactions[1].Version) - }, - }, - { - name: "AccountTransactions - empty result", + name: "SubmitTransaction", run: func(t *testing.T, apt types.AptosService, mockApt *mocks2.AptosService) { - address := aptos.AccountAddress{ - 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + receiverAddr := aptos.AccountAddress{ + 0xBB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, } - req := aptos.AccountTransactionsRequest{ - Address: address, - Start: nil, - Limit: nil, - } - expectedReply := &aptos.AccountTransactionsReply{ - Transactions: []*aptos.Transaction{}, - } - mockApt.EXPECT().AccountTransactions(mock.Anything, req). - Return(expectedReply, nil) - - reply, err := apt.AccountTransactions(ctx, req) - require.NoError(t, err) - require.Len(t, reply.Transactions, 0) - }, - }, - { - name: "SubmitTransaction", - run: func(t *testing.T, apt types.AptosService, mockApt *mocks2.AptosService) { - receiverAddr := aptos.AccountAddress{ - 0xBB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + senderAddr := aptos.AccountAddress{ + 0xCC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, } + nonce := uint64(999) req := aptos.SubmitTransactionRequest{ ReceiverModuleID: aptos.ModuleID{ Address: receiverAddr, @@ -1158,19 +1090,28 @@ func Test_RelayerSet_AptosService(t *testing.T) { }, } expectedReply := &aptos.SubmitTransactionReply{ - TxStatus: aptos.TxSuccess, - TxHash: "0xtxhash123", - TxIdempotencyKey: "key-456", + PendingTransaction: &aptos.PendingTransaction{ + Hash: "0xtxhash123", + Sender: senderAddr, + SequenceNumber: 42, + ReplayProtectionNonce: &nonce, + MaxGasAmount: 10000, + GasUnitPrice: 100, + ExpirationTimestampSecs: 1234567890, + Payload: []byte{0x11, 0x22, 0x33}, + Signature: []byte{0xAA, 0xBB, 0xCC}, + }, } mockApt.EXPECT().SubmitTransaction(mock.Anything, req). Return(expectedReply, nil) reply, err := apt.SubmitTransaction(ctx, req) require.NoError(t, err) - require.NotNil(t, reply.TxHash) - require.Equal(t, expectedReply.TxHash, reply.TxHash) - require.Equal(t, expectedReply.TxIdempotencyKey, reply.TxIdempotencyKey) - require.Equal(t, expectedReply.TxStatus, reply.TxStatus) + require.NotNil(t, reply.PendingTransaction) + require.Equal(t, "0xtxhash123", reply.PendingTransaction.Hash) + require.Equal(t, uint64(42), reply.PendingTransaction.SequenceNumber) + require.NotNil(t, reply.PendingTransaction.ReplayProtectionNonce) + require.Equal(t, nonce, *reply.PendingTransaction.ReplayProtectionNonce) }, }, } diff --git a/pkg/types/chains/aptos/aptos.go b/pkg/types/chains/aptos/aptos.go index 81b94af7b..167629d29 100644 --- a/pkg/types/chains/aptos/aptos.go +++ b/pkg/types/chains/aptos/aptos.go @@ -10,14 +10,16 @@ type AccountAddress [AccountAddressLength]byte // Client wraps the Aptos RPC client methods used for reading on-chain state. type Client interface { + // LedgerVersion returns the latest committed ledger (transaction) version. + LedgerVersion(ctx context.Context) (uint64, error) // AccountAPTBalance returns the native APT coin balance (in octas) for the given account address. AccountAPTBalance(ctx context.Context, req AccountAPTBalanceRequest) (*AccountAPTBalanceReply, error) // View executes a Move view function (read-only) and returns the raw result. View(ctx context.Context, req ViewRequest) (*ViewReply, error) + // EventsByHandle retrieves events emitted by a specific event handle on an account. + EventsByHandle(ctx context.Context, req EventsByHandleRequest) (*EventsByHandleReply, error) // TransactionByHash looks up a transaction (pending or committed) by its hash. TransactionByHash(ctx context.Context, req TransactionByHashRequest) (*TransactionByHashReply, error) - // AccountTransactions returns committed transactions associated with an account. - AccountTransactions(ctx context.Context, req AccountTransactionsRequest) (*AccountTransactionsReply, error) } // ========== AccountAPTBalance ========== @@ -30,14 +32,27 @@ type AccountAPTBalanceReply struct { Value uint64 } +// ========== AccountTransactions ========== + +type AccountTransactionsRequest struct { + Address AccountAddress + Start *uint64 // optional, nil for provider default + Limit *uint64 // optional, nil for provider default +} + +type AccountTransactionsReply struct { + Transactions []*Transaction +} + // ========== View ========== type ViewRequest struct { - Payload *ViewPayload + Payload *ViewPayload + LedgerVersion *uint64 // optional, nil uses latest ledger version on the node } type ViewReply struct { - Data []byte // this is marshaled JSON because the aptos rpc client returns JSON + Data []byte } // ViewPayload represents the payload for a view function call. @@ -63,15 +78,15 @@ type TypeTag struct { // TypeTagImpl is the interface for all type tag implementations. // Different type tags represent different Move types. type TypeTagImpl interface { - // TypeTagKind returns the type discriminator for this type tag. - TypeTagKind() TypeTagKind + // TypeTagType returns the type discriminator for this type tag. + TypeTagType() TypeTagType } -// TypeTagKind is an enum for different type tag variants. -type TypeTagKind uint8 +// TypeTagType is an enum for different type tag variants. +type TypeTagType uint8 const ( - TypeTagBool TypeTagKind = iota + TypeTagBool TypeTagType = iota TypeTagU8 TypeTagU16 TypeTagU32 @@ -90,54 +105,54 @@ const ( // BoolTag represents a boolean type. type BoolTag struct{} -func (BoolTag) TypeTagKind() TypeTagKind { return TypeTagBool } +func (BoolTag) TypeTagType() TypeTagType { return TypeTagBool } // U8Tag represents an unsigned 8-bit integer type. type U8Tag struct{} -func (U8Tag) TypeTagKind() TypeTagKind { return TypeTagU8 } +func (U8Tag) TypeTagType() TypeTagType { return TypeTagU8 } // U16Tag represents an unsigned 16-bit integer type. type U16Tag struct{} -func (U16Tag) TypeTagKind() TypeTagKind { return TypeTagU16 } +func (U16Tag) TypeTagType() TypeTagType { return TypeTagU16 } // U32Tag represents an unsigned 32-bit integer type. type U32Tag struct{} -func (U32Tag) TypeTagKind() TypeTagKind { return TypeTagU32 } +func (U32Tag) TypeTagType() TypeTagType { return TypeTagU32 } // U64Tag represents an unsigned 64-bit integer type. type U64Tag struct{} -func (U64Tag) TypeTagKind() TypeTagKind { return TypeTagU64 } +func (U64Tag) TypeTagType() TypeTagType { return TypeTagU64 } // U128Tag represents an unsigned 128-bit integer type. type U128Tag struct{} -func (U128Tag) TypeTagKind() TypeTagKind { return TypeTagU128 } +func (U128Tag) TypeTagType() TypeTagType { return TypeTagU128 } // U256Tag represents an unsigned 256-bit integer type. type U256Tag struct{} -func (U256Tag) TypeTagKind() TypeTagKind { return TypeTagU256 } +func (U256Tag) TypeTagType() TypeTagType { return TypeTagU256 } // AddressTag represents an account address type. type AddressTag struct{} -func (AddressTag) TypeTagKind() TypeTagKind { return TypeTagAddress } +func (AddressTag) TypeTagType() TypeTagType { return TypeTagAddress } // SignerTag represents a signer type. type SignerTag struct{} -func (SignerTag) TypeTagKind() TypeTagKind { return TypeTagSigner } +func (SignerTag) TypeTagType() TypeTagType { return TypeTagSigner } // VectorTag represents a vector type with an element type. type VectorTag struct { ElementType TypeTag } -func (VectorTag) TypeTagKind() TypeTagKind { return TypeTagVector } +func (VectorTag) TypeTagType() TypeTagType { return TypeTagVector } // StructTag represents a struct type with full type information. type StructTag struct { @@ -147,14 +162,46 @@ type StructTag struct { TypeParams []TypeTag } -func (StructTag) TypeTagKind() TypeTagKind { return TypeTagStruct } +func (StructTag) TypeTagType() TypeTagType { return TypeTagStruct } // GenericTag represents a generic type parameter (e.g., T in a generic function). type GenericTag struct { Index uint16 } -func (GenericTag) TypeTagKind() TypeTagKind { return TypeTagGeneric } +func (GenericTag) TypeTagType() TypeTagType { return TypeTagGeneric } + +// ========== EventsByHandle ========== + +type EventsByHandleRequest struct { + Account AccountAddress + EventHandle string + FieldName string + Start *uint64 // optional, nil for most recent events + Limit *uint64 // optional, 100 by default +} + +type EventsByHandleReply struct { + Events []*Event +} + +// Event represents an on-chain event from Move. +// There are two types of events: +// - Handle events (V1): have a GUID and SequenceNumber +// - Module events: do not have a GUID and SequenceNumber +type Event struct { + Version uint64 // Block version of the event + Type string // Fully qualified name e.g. 0x1::coin::WithdrawEvent + Guid *GUID // Unique identifier (only for V1 events) + SequenceNumber uint64 // Sequence number (only for V1 events) + Data []byte // Event data as raw bytes +} + +// GUID describes a GUID associated with V1 events +type GUID struct { + CreationNumber uint64 // Number of the GUID + AccountAddress AccountAddress // Account address of the creator +} // TransactionByHashRequest represents a request to get a transaction by hash type TransactionByHashRequest struct { @@ -189,41 +236,14 @@ type Transaction struct { Data []byte // Raw transaction data } -// ========== AccountTransactions ========== - -type AccountTransactionsRequest struct { - Address AccountAddress - Start *uint64 // Starting version number; nil for most recent - Limit *uint64 // Number of transactions to return; nil for default (~100) -} - -type AccountTransactionsReply struct { - Transactions []*Transaction -} - -// ========== SubmitTransaction ========== - type SubmitTransactionRequest struct { - ReceiverModuleID ModuleID // This can potentially be removed if the EncodedPayload is of type EntryFunction which has all the details + ReceiverModuleID ModuleID EncodedPayload []byte GasConfig *GasConfig } -type TransactionStatus int - -const ( - // Transaction processing failed due to a network issue, RPC issue, or other fatal error - TxFatal TransactionStatus = iota - // Transaction was sent successfully to the chain but the smart contract execution reverted - TxReverted - // Transaction was sent successfully to the chain, smart contract executed successfully and mined into a block. - TxSuccess -) - type SubmitTransactionReply struct { - TxStatus TransactionStatus - TxHash string - TxIdempotencyKey string + PendingTransaction *PendingTransaction } // GasConfig represents gas configuration for a transaction @@ -231,3 +251,16 @@ type GasConfig struct { MaxGasAmount uint64 // Maximum gas units willing to pay GasUnitPrice uint64 // Price per gas unit in octas } + +// PendingTransaction represents a transaction that has been submitted but not yet committed +type PendingTransaction struct { + Hash string // Transaction hash (hex string with 0x prefix) + Sender AccountAddress // Sender's account address + SequenceNumber uint64 // Sequence number of the transaction + ReplayProtectionNonce *uint64 // Optional nonce for replay protection + MaxGasAmount uint64 // Maximum gas amount + GasUnitPrice uint64 // Gas unit price + ExpirationTimestampSecs uint64 // Expiration timestamp in seconds + Payload []byte // Transaction payload as raw bytes + Signature []byte // Signature as raw bytes +} diff --git a/pkg/types/mocks/aptos_service.go b/pkg/types/mocks/aptos_service.go index 5ab7f4a9a..a45692369 100644 --- a/pkg/types/mocks/aptos_service.go +++ b/pkg/types/mocks/aptos_service.go @@ -23,6 +23,62 @@ func (_m *AptosService) EXPECT() *AptosService_Expecter { return &AptosService_Expecter{mock: &_m.Mock} } +// LedgerVersion provides a mock function with given fields: ctx +func (_m *AptosService) LedgerVersion(ctx context.Context) (uint64, error) { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for LedgerVersion") + } + + var r0 uint64 + var r1 error + if rf, ok := ret.Get(0).(func(context.Context) (uint64, error)); ok { + return rf(ctx) + } + if rf, ok := ret.Get(0).(func(context.Context) uint64); ok { + r0 = rf(ctx) + } else { + r0 = ret.Get(0).(uint64) + } + + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(ctx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// AptosService_LedgerVersion_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LedgerVersion' +type AptosService_LedgerVersion_Call struct { + *mock.Call +} + +// LedgerVersion is a helper method to define mock.On call +// - ctx context.Context +func (_e *AptosService_Expecter) LedgerVersion(ctx interface{}) *AptosService_LedgerVersion_Call { + return &AptosService_LedgerVersion_Call{Call: _e.mock.On("LedgerVersion", ctx)} +} + +func (_c *AptosService_LedgerVersion_Call) Run(run func(ctx context.Context)) *AptosService_LedgerVersion_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *AptosService_LedgerVersion_Call) Return(_a0 uint64, _a1 error) *AptosService_LedgerVersion_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *AptosService_LedgerVersion_Call) RunAndReturn(run func(context.Context) (uint64, error)) *AptosService_LedgerVersion_Call { + _c.Call.Return(run) + return _c +} + // AccountAPTBalance provides a mock function with given fields: ctx, req func (_m *AptosService) AccountAPTBalance(ctx context.Context, req aptos.AccountAPTBalanceRequest) (*aptos.AccountAPTBalanceReply, error) { ret := _m.Called(ctx, req) @@ -82,28 +138,28 @@ func (_c *AptosService_AccountAPTBalance_Call) RunAndReturn(run func(context.Con return _c } -// AccountTransactions provides a mock function with given fields: ctx, req -func (_m *AptosService) AccountTransactions(ctx context.Context, req aptos.AccountTransactionsRequest) (*aptos.AccountTransactionsReply, error) { +// EventsByHandle provides a mock function with given fields: ctx, req +func (_m *AptosService) EventsByHandle(ctx context.Context, req aptos.EventsByHandleRequest) (*aptos.EventsByHandleReply, error) { ret := _m.Called(ctx, req) if len(ret) == 0 { - panic("no return value specified for AccountTransactions") + panic("no return value specified for EventsByHandle") } - var r0 *aptos.AccountTransactionsReply + var r0 *aptos.EventsByHandleReply var r1 error - if rf, ok := ret.Get(0).(func(context.Context, aptos.AccountTransactionsRequest) (*aptos.AccountTransactionsReply, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, aptos.EventsByHandleRequest) (*aptos.EventsByHandleReply, error)); ok { return rf(ctx, req) } - if rf, ok := ret.Get(0).(func(context.Context, aptos.AccountTransactionsRequest) *aptos.AccountTransactionsReply); ok { + if rf, ok := ret.Get(0).(func(context.Context, aptos.EventsByHandleRequest) *aptos.EventsByHandleReply); ok { r0 = rf(ctx, req) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*aptos.AccountTransactionsReply) + r0 = ret.Get(0).(*aptos.EventsByHandleReply) } } - if rf, ok := ret.Get(1).(func(context.Context, aptos.AccountTransactionsRequest) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, aptos.EventsByHandleRequest) error); ok { r1 = rf(ctx, req) } else { r1 = ret.Error(1) @@ -112,31 +168,31 @@ func (_m *AptosService) AccountTransactions(ctx context.Context, req aptos.Accou return r0, r1 } -// AptosService_AccountTransactions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AccountTransactions' -type AptosService_AccountTransactions_Call struct { +// AptosService_EventsByHandle_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EventsByHandle' +type AptosService_EventsByHandle_Call struct { *mock.Call } -// AccountTransactions is a helper method to define mock.On call +// EventsByHandle is a helper method to define mock.On call // - ctx context.Context -// - req aptos.AccountTransactionsRequest -func (_e *AptosService_Expecter) AccountTransactions(ctx interface{}, req interface{}) *AptosService_AccountTransactions_Call { - return &AptosService_AccountTransactions_Call{Call: _e.mock.On("AccountTransactions", ctx, req)} +// - req aptos.EventsByHandleRequest +func (_e *AptosService_Expecter) EventsByHandle(ctx interface{}, req interface{}) *AptosService_EventsByHandle_Call { + return &AptosService_EventsByHandle_Call{Call: _e.mock.On("EventsByHandle", ctx, req)} } -func (_c *AptosService_AccountTransactions_Call) Run(run func(ctx context.Context, req aptos.AccountTransactionsRequest)) *AptosService_AccountTransactions_Call { +func (_c *AptosService_EventsByHandle_Call) Run(run func(ctx context.Context, req aptos.EventsByHandleRequest)) *AptosService_EventsByHandle_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(aptos.AccountTransactionsRequest)) + run(args[0].(context.Context), args[1].(aptos.EventsByHandleRequest)) }) return _c } -func (_c *AptosService_AccountTransactions_Call) Return(_a0 *aptos.AccountTransactionsReply, _a1 error) *AptosService_AccountTransactions_Call { +func (_c *AptosService_EventsByHandle_Call) Return(_a0 *aptos.EventsByHandleReply, _a1 error) *AptosService_EventsByHandle_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *AptosService_AccountTransactions_Call) RunAndReturn(run func(context.Context, aptos.AccountTransactionsRequest) (*aptos.AccountTransactionsReply, error)) *AptosService_AccountTransactions_Call { +func (_c *AptosService_EventsByHandle_Call) RunAndReturn(run func(context.Context, aptos.EventsByHandleRequest) (*aptos.EventsByHandleReply, error)) *AptosService_EventsByHandle_Call { _c.Call.Return(run) return _c } diff --git a/pkg/types/relayer.go b/pkg/types/relayer.go index 47c4628ab..05d9d23ce 100644 --- a/pkg/types/relayer.go +++ b/pkg/types/relayer.go @@ -564,6 +564,10 @@ var _ AptosService = &UnimplementedAptosService{} // In the future, embedding this type may be required to implement AptosService (through use of an unexported method). type UnimplementedAptosService struct{} +func (ua *UnimplementedAptosService) LedgerVersion(ctx context.Context) (uint64, error) { + return 0, status.Errorf(codes.Unimplemented, "method LedgerVersion not implemented") +} + func (ua *UnimplementedAptosService) AccountAPTBalance(ctx context.Context, req aptos.AccountAPTBalanceRequest) (*aptos.AccountAPTBalanceReply, error) { return nil, status.Errorf(codes.Unimplemented, "method AccountAPTBalance not implemented") } @@ -572,6 +576,10 @@ func (ua *UnimplementedAptosService) View(ctx context.Context, req aptos.ViewReq return nil, status.Errorf(codes.Unimplemented, "method View not implemented") } +func (ua *UnimplementedAptosService) EventsByHandle(ctx context.Context, req aptos.EventsByHandleRequest) (*aptos.EventsByHandleReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method EventsByHandle not implemented") +} + func (ua *UnimplementedAptosService) TransactionByHash(ctx context.Context, req aptos.TransactionByHashRequest) (*aptos.TransactionByHashReply, error) { return nil, status.Errorf(codes.Unimplemented, "method TransactionByHash not implemented") }