From 0cbe6a5ae2bf58233142382ff2febbcf77412a4e Mon Sep 17 00:00:00 2001 From: cawthorne Date: Wed, 25 Feb 2026 23:15:47 +0000 Subject: [PATCH 01/18] Update Aptos Service Protos (cherry picked from commit 8aa26f14ffe433a5bb8aa6bc86fa88c14cc79f82) --- pkg/chains/aptos/aptos.pb.go | 1049 ++++++++++++++++--------- pkg/chains/aptos/aptos.proto | 102 ++- pkg/chains/aptos/aptos_grpc.pb.go | 104 ++- pkg/chains/aptos/proto_helpers.go | 61 ++ pkg/loop/internal/relayer/aptos.go | 33 + pkg/loop/internal/relayerset/aptos.go | 28 + pkg/types/chains/aptos/aptos.go | 12 + 7 files changed, 961 insertions(+), 428 deletions(-) diff --git a/pkg/chains/aptos/aptos.pb.go b/pkg/chains/aptos/aptos.pb.go index 1578de42c..cdb4be8e0 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,55 +161,6 @@ func (TransactionVariant) EnumDescriptor() ([]byte, []int) { return file_aptos_proto_rawDescGZIP(), []int{1} } -type TxStatus int32 - -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 -) - -// 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 TxStatus) Enum() *TxStatus { - p := new(TxStatus) - *p = x - return p -} - -func (x TxStatus) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (TxStatus) Descriptor() protoreflect.EnumDescriptor { - return file_aptos_proto_enumTypes[2].Descriptor() -} - -func (TxStatus) Type() protoreflect.EnumType { - return &file_aptos_proto_enumTypes[2] -} - -func (x TxStatus) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use TxStatus.Descriptor instead. -func (TxStatus) EnumDescriptor() ([]byte, []int) { - return file_aptos_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 @@ -298,6 +249,110 @@ 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[2] + 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[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 AccountTransactionsRequest.ProtoReflect.Descriptor instead. +func (*AccountTransactionsRequest) Descriptor() ([]byte, []int) { + return file_aptos_proto_rawDescGZIP(), []int{2} +} + +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[3] + 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[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 AccountTransactionsReply.ProtoReflect.Descriptor instead. +func (*AccountTransactionsReply) Descriptor() ([]byte, []int) { + return file_aptos_proto_rawDescGZIP(), []int{3} +} + +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"` @@ -307,7 +362,7 @@ type ViewRequest struct { func (x *ViewRequest) Reset() { *x = ViewRequest{} - mi := &file_aptos_proto_msgTypes[2] + mi := &file_aptos_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -319,7 +374,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[4] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -332,7 +387,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{4} } func (x *ViewRequest) GetPayload() *ViewPayload { @@ -351,7 +406,7 @@ type ViewReply struct { func (x *ViewReply) Reset() { *x = ViewReply{} - mi := &file_aptos_proto_msgTypes[3] + mi := &file_aptos_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -363,7 +418,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[5] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -376,7 +431,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{5} } func (x *ViewReply) GetData() []byte { @@ -398,7 +453,7 @@ type ViewPayload struct { func (x *ViewPayload) Reset() { *x = ViewPayload{} - mi := &file_aptos_proto_msgTypes[4] + mi := &file_aptos_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -410,7 +465,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[6] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -423,7 +478,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{6} } func (x *ViewPayload) GetModule() *ModuleID { @@ -464,7 +519,7 @@ type ModuleID struct { func (x *ModuleID) Reset() { *x = ModuleID{} - mi := &file_aptos_proto_msgTypes[5] + mi := &file_aptos_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -476,7 +531,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[7] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -489,7 +544,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{7} } func (x *ModuleID) GetAddress() []byte { @@ -508,7 +563,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 +576,7 @@ type TypeTag struct { func (x *TypeTag) Reset() { *x = TypeTag{} - mi := &file_aptos_proto_msgTypes[6] + mi := &file_aptos_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -533,7 +588,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[8] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -546,14 +601,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{8} } -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 +676,7 @@ type VectorTag struct { func (x *VectorTag) Reset() { *x = VectorTag{} - mi := &file_aptos_proto_msgTypes[7] + mi := &file_aptos_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -633,7 +688,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[9] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -646,7 +701,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{9} } func (x *VectorTag) GetElementType() *TypeTag { @@ -668,7 +723,7 @@ type StructTag struct { func (x *StructTag) Reset() { *x = StructTag{} - mi := &file_aptos_proto_msgTypes[8] + mi := &file_aptos_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -680,7 +735,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[10] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -693,7 +748,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{10} } func (x *StructTag) GetAddress() []byte { @@ -733,7 +788,7 @@ type GenericTag struct { func (x *GenericTag) Reset() { *x = GenericTag{} - mi := &file_aptos_proto_msgTypes[9] + mi := &file_aptos_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -745,7 +800,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[11] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -758,7 +813,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{11} } func (x *GenericTag) GetIndex() uint32 { @@ -768,28 +823,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[12] 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[12] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -800,40 +859,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{12} } -func (x *TransactionByHashRequest) GetHash() string { +func (x *EventsByHandleRequest) GetAccount() []byte { if x != nil { - return x.Hash + return x.Account + } + return nil +} + +func (x *EventsByHandleRequest) GetEventHandle() string { + if x != nil { + return x.EventHandle } return "" } -type TransactionByHashReply struct { +func (x *EventsByHandleRequest) GetFieldName() string { + if x != nil { + return x.FieldName + } + return "" +} + +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"` - Transaction *Transaction `protobuf:"bytes,1,opt,name=transaction,proto3,oneof" json:"transaction,omitempty"` + Events []*Event `protobuf:"bytes,1,rep,name=events,proto3" json:"events,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *TransactionByHashReply) Reset() { - *x = TransactionByHashReply{} - mi := &file_aptos_proto_msgTypes[11] +func (x *EventsByHandleReply) Reset() { + *x = EventsByHandleReply{} + mi := &file_aptos_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *TransactionByHashReply) String() string { +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[13] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -844,44 +931,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{13} } -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[14] 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[14] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -892,70 +979,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{14} } -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[15] + 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[15] + 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{15} +} + +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[16] 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[16] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -966,54 +1103,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{16} } -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[17] + 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[17] + 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{17} +} + +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[18] 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[18] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1024,14 +1195,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{18} } -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 +1246,7 @@ type SubmitTransactionRequest struct { func (x *SubmitTransactionRequest) Reset() { *x = SubmitTransactionRequest{} - mi := &file_aptos_proto_msgTypes[15] + mi := &file_aptos_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1059,7 +1258,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[19] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1072,7 +1271,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{19} } func (x *SubmitTransactionRequest) GetReceiverModuleId() *ModuleID { @@ -1097,17 +1296,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[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1119,7 +1316,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[20] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1132,28 +1329,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} -} - -func (x *SubmitTransactionReply) GetTxStatus() TxStatus { - if x != nil { - return x.TxStatus - } - return TxStatus_TX_STATUS_FATAL -} - -func (x *SubmitTransactionReply) GetTxHash() string { - if x != nil { - return x.TxHash - } - return "" + return file_aptos_proto_rawDescGZIP(), []int{20} } -func (x *SubmitTransactionReply) GetTxIdempotencyKey() string { +func (x *SubmitTransactionReply) GetPendingTransaction() *PendingTransaction { if x != nil { - return x.TxIdempotencyKey + return x.PendingTransaction } - return "" + return nil } type GasConfig struct { @@ -1166,7 +1349,7 @@ type GasConfig struct { func (x *GasConfig) Reset() { *x = GasConfig{} - mi := &file_aptos_proto_msgTypes[17] + mi := &file_aptos_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1178,7 +1361,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[21] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1191,7 +1374,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{21} } func (x *GasConfig) GetMaxGasAmount() uint64 { @@ -1208,6 +1391,114 @@ 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[22] + 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[22] + 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{22} +} + +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 = "" + @@ -1217,7 +1508,15 @@ const file_aptos_proto_rawDesc = "" + "\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\"@\n" + "\vViewRequest\x121\n" + "\apayload\x18\x01 \x01(\v2\x17.loop.aptos.ViewPayloadR\apayload\"\x1f\n" + "\tViewReply\x12\x12\n" + @@ -1231,7 +1530,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 +1545,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 +1581,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 +1627,13 @@ 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" + + "\x1bTRANSACTION_VARIANT_UNKNOWN\x10\a2\x97\x04\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" + + "\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 +1648,70 @@ 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, 23) 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 + (*AccountAPTBalanceRequest)(nil), // 2: loop.aptos.AccountAPTBalanceRequest + (*AccountAPTBalanceReply)(nil), // 3: loop.aptos.AccountAPTBalanceReply + (*AccountTransactionsRequest)(nil), // 4: loop.aptos.AccountTransactionsRequest + (*AccountTransactionsReply)(nil), // 5: loop.aptos.AccountTransactionsReply + (*ViewRequest)(nil), // 6: loop.aptos.ViewRequest + (*ViewReply)(nil), // 7: loop.aptos.ViewReply + (*ViewPayload)(nil), // 8: loop.aptos.ViewPayload + (*ModuleID)(nil), // 9: loop.aptos.ModuleID + (*TypeTag)(nil), // 10: loop.aptos.TypeTag + (*VectorTag)(nil), // 11: loop.aptos.VectorTag + (*StructTag)(nil), // 12: loop.aptos.StructTag + (*GenericTag)(nil), // 13: loop.aptos.GenericTag + (*EventsByHandleRequest)(nil), // 14: loop.aptos.EventsByHandleRequest + (*EventsByHandleReply)(nil), // 15: loop.aptos.EventsByHandleReply + (*Event)(nil), // 16: loop.aptos.Event + (*GUID)(nil), // 17: loop.aptos.GUID + (*TransactionByHashRequest)(nil), // 18: loop.aptos.TransactionByHashRequest + (*TransactionByHashReply)(nil), // 19: loop.aptos.TransactionByHashReply + (*Transaction)(nil), // 20: loop.aptos.Transaction + (*SubmitTransactionRequest)(nil), // 21: loop.aptos.SubmitTransactionRequest + (*SubmitTransactionReply)(nil), // 22: loop.aptos.SubmitTransactionReply + (*GasConfig)(nil), // 23: loop.aptos.GasConfig + (*PendingTransaction)(nil), // 24: 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 + 20, // 0: loop.aptos.AccountTransactionsReply.transactions:type_name -> loop.aptos.Transaction + 8, // 1: loop.aptos.ViewRequest.payload:type_name -> loop.aptos.ViewPayload + 9, // 2: loop.aptos.ViewPayload.module:type_name -> loop.aptos.ModuleID + 10, // 3: loop.aptos.ViewPayload.arg_types:type_name -> loop.aptos.TypeTag + 0, // 4: loop.aptos.TypeTag.type:type_name -> loop.aptos.TypeTagType + 11, // 5: loop.aptos.TypeTag.vector:type_name -> loop.aptos.VectorTag + 12, // 6: loop.aptos.TypeTag.struct:type_name -> loop.aptos.StructTag + 13, // 7: loop.aptos.TypeTag.generic:type_name -> loop.aptos.GenericTag + 10, // 8: loop.aptos.VectorTag.element_type:type_name -> loop.aptos.TypeTag + 10, // 9: loop.aptos.StructTag.type_params:type_name -> loop.aptos.TypeTag + 16, // 10: loop.aptos.EventsByHandleReply.events:type_name -> loop.aptos.Event + 17, // 11: loop.aptos.Event.guid:type_name -> loop.aptos.GUID + 20, // 12: loop.aptos.TransactionByHashReply.transaction:type_name -> loop.aptos.Transaction + 1, // 13: loop.aptos.Transaction.type:type_name -> loop.aptos.TransactionVariant + 9, // 14: loop.aptos.SubmitTransactionRequest.receiver_module_id:type_name -> loop.aptos.ModuleID + 23, // 15: loop.aptos.SubmitTransactionRequest.gas_config:type_name -> loop.aptos.GasConfig + 24, // 16: loop.aptos.SubmitTransactionReply.pending_transaction:type_name -> loop.aptos.PendingTransaction + 2, // 17: loop.aptos.Aptos.AccountAPTBalance:input_type -> loop.aptos.AccountAPTBalanceRequest + 4, // 18: loop.aptos.Aptos.AccountTransactions:input_type -> loop.aptos.AccountTransactionsRequest + 6, // 19: loop.aptos.Aptos.View:input_type -> loop.aptos.ViewRequest + 14, // 20: loop.aptos.Aptos.EventsByHandle:input_type -> loop.aptos.EventsByHandleRequest + 18, // 21: loop.aptos.Aptos.TransactionByHash:input_type -> loop.aptos.TransactionByHashRequest + 21, // 22: loop.aptos.Aptos.SubmitTransaction:input_type -> loop.aptos.SubmitTransactionRequest + 3, // 23: loop.aptos.Aptos.AccountAPTBalance:output_type -> loop.aptos.AccountAPTBalanceReply + 5, // 24: loop.aptos.Aptos.AccountTransactions:output_type -> loop.aptos.AccountTransactionsReply + 7, // 25: loop.aptos.Aptos.View:output_type -> loop.aptos.ViewReply + 15, // 26: loop.aptos.Aptos.EventsByHandle:output_type -> loop.aptos.EventsByHandleReply + 19, // 27: loop.aptos.Aptos.TransactionByHash:output_type -> loop.aptos.TransactionByHashReply + 22, // 28: loop.aptos.Aptos.SubmitTransaction:output_type -> loop.aptos.SubmitTransactionReply + 23, // [23:29] is the sub-list for method output_type + 17, // [17:23] 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 +1719,26 @@ func file_aptos_proto_init() { if File_aptos_proto != nil { return } - file_aptos_proto_msgTypes[6].OneofWrappers = []any{ + file_aptos_proto_msgTypes[2].OneofWrappers = []any{} + file_aptos_proto_msgTypes[8].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[17].OneofWrappers = []any{} + file_aptos_proto_msgTypes[18].OneofWrappers = []any{} + file_aptos_proto_msgTypes[19].OneofWrappers = []any{} + file_aptos_proto_msgTypes[20].OneofWrappers = []any{} + file_aptos_proto_msgTypes[22].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: 23, NumExtensions: 0, NumServices: 1, }, diff --git a/pkg/chains/aptos/aptos.proto b/pkg/chains/aptos/aptos.proto index da9be7b34..b37a34e78 100644 --- a/pkg/chains/aptos/aptos.proto +++ b/pkg/chains/aptos/aptos.proto @@ -5,9 +5,10 @@ package loop.aptos; service Aptos { 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); } @@ -21,6 +22,18 @@ 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 { @@ -44,7 +57,7 @@ message ModuleID { } message TypeTag { - TypeTagKind kind = 1; + TypeTagType type = 1; oneof value { VectorTag vector = 2; StructTag struct = 3; @@ -52,19 +65,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 +95,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 +151,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 +159,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 +168,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..d225e3905 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 @@ -20,9 +20,10 @@ const _ = grpc.SupportPackageIsVersion9 const ( 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" ) @@ -31,9 +32,10 @@ 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 { 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) } @@ -55,6 +57,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 +77,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 } @@ -100,9 +112,10 @@ func (c *aptosClient) SubmitTransaction(ctx context.Context, in *SubmitTransacti // for forward compatibility. type AptosServer interface { 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() } @@ -115,19 +128,22 @@ type AptosServer interface { type UnimplementedAptosServer struct{} 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 +156,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. @@ -168,6 +184,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 +220,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) } @@ -251,17 +285,21 @@ var Aptos_ServiceDesc = grpc.ServiceDesc{ 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..ddfdf945d 100644 --- a/pkg/chains/aptos/proto_helpers.go +++ b/pkg/chains/aptos/proto_helpers.go @@ -234,6 +234,67 @@ func ConvertViewReplyToProto(reply *typeaptos.ViewReply) (*ViewReply, error) { // ========== 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, diff --git a/pkg/loop/internal/relayer/aptos.go b/pkg/loop/internal/relayer/aptos.go index 2667c2de3..3c9c9a1b6 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" @@ -34,6 +37,16 @@ func (ac *AptosClient) AccountAPTBalance(ctx context.Context, req aptos.AccountA }, 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) @@ -96,6 +109,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 +129,22 @@ func (s *aptosServer) AccountAPTBalance(ctx context.Context, req *aptospb.Accoun }, 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) diff --git a/pkg/loop/internal/relayerset/aptos.go b/pkg/loop/internal/relayerset/aptos.go index daba3c3d6..6ef3b8da4 100644 --- a/pkg/loop/internal/relayerset/aptos.go +++ b/pkg/loop/internal/relayerset/aptos.go @@ -25,6 +25,10 @@ func (ac *aptosClient) AccountAPTBalance(ctx context.Context, in *aptospb.Accoun 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...) } @@ -48,6 +52,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 +73,26 @@ func (as *aptosServer) AccountAPTBalance(ctx context.Context, req *aptospb.Accou }, 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 { diff --git a/pkg/types/chains/aptos/aptos.go b/pkg/types/chains/aptos/aptos.go index 81b94af7b..c40419386 100644 --- a/pkg/types/chains/aptos/aptos.go +++ b/pkg/types/chains/aptos/aptos.go @@ -30,6 +30,18 @@ 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 { From 3c118d41b0a640a5631293968b841e8dc4c421cd Mon Sep 17 00:00:00 2001 From: cawthorne Date: Thu, 26 Feb 2026 19:00:15 +0000 Subject: [PATCH 02/18] Add LedgerVersion for Aptos ViewRequest (cherry picked from commit 331a1e5785f73bad214f47c667cd53ab0bbbd628) --- pkg/types/chains/aptos/aptos.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/types/chains/aptos/aptos.go b/pkg/types/chains/aptos/aptos.go index c40419386..39e387834 100644 --- a/pkg/types/chains/aptos/aptos.go +++ b/pkg/types/chains/aptos/aptos.go @@ -45,7 +45,8 @@ type AccountTransactionsReply struct { // ========== View ========== type ViewRequest struct { - Payload *ViewPayload + Payload *ViewPayload + LedgerVersion *uint64 // optional, nil uses latest ledger version on the node } type ViewReply struct { From 517387421c0450d7e613ae63a0b13c7d94934128 Mon Sep 17 00:00:00 2001 From: cawthorne Date: Thu, 26 Feb 2026 19:16:20 +0000 Subject: [PATCH 03/18] aptos: add LedgerVersion RPC and plumb View ledger_version through loop adapters (cherry picked from commit ffa37f123f0e0bb21ef755321e390202cfd5dbd8) --- pkg/chains/aptos/aptos.pb.go | 365 ++++++++++++++++---------- pkg/chains/aptos/aptos.proto | 10 + pkg/chains/aptos/aptos_grpc.pb.go | 38 +++ pkg/loop/internal/relayer/aptos.go | 23 ++ pkg/loop/internal/relayerset/aptos.go | 21 ++ pkg/types/chains/aptos/aptos.go | 2 + pkg/types/mocks/aptos_service.go | 56 ++++ pkg/types/relayer.go | 4 + 8 files changed, 386 insertions(+), 133 deletions(-) diff --git a/pkg/chains/aptos/aptos.pb.go b/pkg/chains/aptos/aptos.pb.go index cdb4be8e0..7bccb0c4c 100644 --- a/pkg/chains/aptos/aptos.pb.go +++ b/pkg/chains/aptos/aptos.pb.go @@ -161,6 +161,86 @@ func (TransactionVariant) EnumDescriptor() ([]byte, []int) { return file_aptos_proto_rawDescGZIP(), []int{1} } +type LedgerVersionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LedgerVersionRequest) Reset() { + *x = LedgerVersionRequest{} + mi := &file_aptos_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +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) +} + +// Deprecated: Use LedgerVersionRequest.ProtoReflect.Descriptor instead. +func (*LedgerVersionRequest) Descriptor() ([]byte, []int) { + return file_aptos_proto_rawDescGZIP(), []int{0} +} + +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 (x *LedgerVersionReply) Reset() { + *x = LedgerVersionReply{} + mi := &file_aptos_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LedgerVersionReply) String() string { + return protoimpl.X.MessageStringOf(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 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 { state protoimpl.MessageState `protogen:"open.v1"` Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // 32-byte address @@ -170,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) } @@ -182,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 { @@ -195,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 { @@ -214,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) } @@ -226,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 { @@ -239,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 { @@ -260,7 +340,7 @@ type AccountTransactionsRequest struct { func (x *AccountTransactionsRequest) Reset() { *x = AccountTransactionsRequest{} - mi := &file_aptos_proto_msgTypes[2] + mi := &file_aptos_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -272,7 +352,7 @@ func (x *AccountTransactionsRequest) String() string { func (*AccountTransactionsRequest) ProtoMessage() {} func (x *AccountTransactionsRequest) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[2] + mi := &file_aptos_proto_msgTypes[4] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -285,7 +365,7 @@ func (x *AccountTransactionsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use AccountTransactionsRequest.ProtoReflect.Descriptor instead. func (*AccountTransactionsRequest) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{2} + return file_aptos_proto_rawDescGZIP(), []int{4} } func (x *AccountTransactionsRequest) GetAddress() []byte { @@ -318,7 +398,7 @@ type AccountTransactionsReply struct { func (x *AccountTransactionsReply) Reset() { *x = AccountTransactionsReply{} - mi := &file_aptos_proto_msgTypes[3] + mi := &file_aptos_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -330,7 +410,7 @@ func (x *AccountTransactionsReply) String() string { func (*AccountTransactionsReply) ProtoMessage() {} func (x *AccountTransactionsReply) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[3] + mi := &file_aptos_proto_msgTypes[5] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -343,7 +423,7 @@ func (x *AccountTransactionsReply) ProtoReflect() protoreflect.Message { // Deprecated: Use AccountTransactionsReply.ProtoReflect.Descriptor instead. func (*AccountTransactionsReply) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{3} + return file_aptos_proto_rawDescGZIP(), []int{5} } func (x *AccountTransactionsReply) GetTransactions() []*Transaction { @@ -356,13 +436,14 @@ func (x *AccountTransactionsReply) GetTransactions() []*Transaction { 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[4] + mi := &file_aptos_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -374,7 +455,7 @@ func (x *ViewRequest) String() string { func (*ViewRequest) ProtoMessage() {} func (x *ViewRequest) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[4] + mi := &file_aptos_proto_msgTypes[6] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -387,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{4} + return file_aptos_proto_rawDescGZIP(), []int{6} } func (x *ViewRequest) GetPayload() *ViewPayload { @@ -397,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"` @@ -406,7 +494,7 @@ type ViewReply struct { func (x *ViewReply) Reset() { *x = ViewReply{} - mi := &file_aptos_proto_msgTypes[5] + mi := &file_aptos_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -418,7 +506,7 @@ func (x *ViewReply) String() string { func (*ViewReply) ProtoMessage() {} func (x *ViewReply) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[5] + mi := &file_aptos_proto_msgTypes[7] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -431,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{5} + return file_aptos_proto_rawDescGZIP(), []int{7} } func (x *ViewReply) GetData() []byte { @@ -453,7 +541,7 @@ type ViewPayload struct { func (x *ViewPayload) Reset() { *x = ViewPayload{} - mi := &file_aptos_proto_msgTypes[6] + mi := &file_aptos_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -465,7 +553,7 @@ func (x *ViewPayload) String() string { func (*ViewPayload) ProtoMessage() {} func (x *ViewPayload) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[6] + mi := &file_aptos_proto_msgTypes[8] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -478,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{6} + return file_aptos_proto_rawDescGZIP(), []int{8} } func (x *ViewPayload) GetModule() *ModuleID { @@ -519,7 +607,7 @@ type ModuleID struct { func (x *ModuleID) Reset() { *x = ModuleID{} - mi := &file_aptos_proto_msgTypes[7] + mi := &file_aptos_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -531,7 +619,7 @@ func (x *ModuleID) String() string { func (*ModuleID) ProtoMessage() {} func (x *ModuleID) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[7] + mi := &file_aptos_proto_msgTypes[9] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -544,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{7} + return file_aptos_proto_rawDescGZIP(), []int{9} } func (x *ModuleID) GetAddress() []byte { @@ -576,7 +664,7 @@ type TypeTag struct { func (x *TypeTag) Reset() { *x = TypeTag{} - mi := &file_aptos_proto_msgTypes[8] + mi := &file_aptos_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -588,7 +676,7 @@ func (x *TypeTag) String() string { func (*TypeTag) ProtoMessage() {} func (x *TypeTag) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[8] + mi := &file_aptos_proto_msgTypes[10] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -601,7 +689,7 @@ func (x *TypeTag) ProtoReflect() protoreflect.Message { // Deprecated: Use TypeTag.ProtoReflect.Descriptor instead. func (*TypeTag) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{8} + return file_aptos_proto_rawDescGZIP(), []int{10} } func (x *TypeTag) GetType() TypeTagType { @@ -676,7 +764,7 @@ type VectorTag struct { func (x *VectorTag) Reset() { *x = VectorTag{} - mi := &file_aptos_proto_msgTypes[9] + mi := &file_aptos_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -688,7 +776,7 @@ func (x *VectorTag) String() string { func (*VectorTag) ProtoMessage() {} func (x *VectorTag) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[9] + mi := &file_aptos_proto_msgTypes[11] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -701,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{9} + return file_aptos_proto_rawDescGZIP(), []int{11} } func (x *VectorTag) GetElementType() *TypeTag { @@ -723,7 +811,7 @@ type StructTag struct { func (x *StructTag) Reset() { *x = StructTag{} - mi := &file_aptos_proto_msgTypes[10] + mi := &file_aptos_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -735,7 +823,7 @@ func (x *StructTag) String() string { func (*StructTag) ProtoMessage() {} func (x *StructTag) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[10] + mi := &file_aptos_proto_msgTypes[12] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -748,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{10} + return file_aptos_proto_rawDescGZIP(), []int{12} } func (x *StructTag) GetAddress() []byte { @@ -788,7 +876,7 @@ type GenericTag struct { func (x *GenericTag) Reset() { *x = GenericTag{} - mi := &file_aptos_proto_msgTypes[11] + mi := &file_aptos_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -800,7 +888,7 @@ func (x *GenericTag) String() string { func (*GenericTag) ProtoMessage() {} func (x *GenericTag) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[11] + mi := &file_aptos_proto_msgTypes[13] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -813,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{11} + return file_aptos_proto_rawDescGZIP(), []int{13} } func (x *GenericTag) GetIndex() uint32 { @@ -836,7 +924,7 @@ type EventsByHandleRequest struct { func (x *EventsByHandleRequest) Reset() { *x = EventsByHandleRequest{} - mi := &file_aptos_proto_msgTypes[12] + mi := &file_aptos_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -848,7 +936,7 @@ func (x *EventsByHandleRequest) String() string { func (*EventsByHandleRequest) ProtoMessage() {} func (x *EventsByHandleRequest) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[12] + mi := &file_aptos_proto_msgTypes[14] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -861,7 +949,7 @@ func (x *EventsByHandleRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use EventsByHandleRequest.ProtoReflect.Descriptor instead. func (*EventsByHandleRequest) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{12} + return file_aptos_proto_rawDescGZIP(), []int{14} } func (x *EventsByHandleRequest) GetAccount() []byte { @@ -908,7 +996,7 @@ type EventsByHandleReply struct { func (x *EventsByHandleReply) Reset() { *x = EventsByHandleReply{} - mi := &file_aptos_proto_msgTypes[13] + mi := &file_aptos_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -920,7 +1008,7 @@ func (x *EventsByHandleReply) String() string { func (*EventsByHandleReply) ProtoMessage() {} func (x *EventsByHandleReply) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[13] + mi := &file_aptos_proto_msgTypes[15] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -933,7 +1021,7 @@ func (x *EventsByHandleReply) ProtoReflect() protoreflect.Message { // Deprecated: Use EventsByHandleReply.ProtoReflect.Descriptor instead. func (*EventsByHandleReply) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{13} + return file_aptos_proto_rawDescGZIP(), []int{15} } func (x *EventsByHandleReply) GetEvents() []*Event { @@ -956,7 +1044,7 @@ type Event struct { func (x *Event) Reset() { *x = Event{} - mi := &file_aptos_proto_msgTypes[14] + mi := &file_aptos_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -968,7 +1056,7 @@ func (x *Event) String() string { func (*Event) ProtoMessage() {} func (x *Event) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[14] + mi := &file_aptos_proto_msgTypes[16] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -981,7 +1069,7 @@ func (x *Event) ProtoReflect() protoreflect.Message { // Deprecated: Use Event.ProtoReflect.Descriptor instead. func (*Event) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{14} + return file_aptos_proto_rawDescGZIP(), []int{16} } func (x *Event) GetVersion() uint64 { @@ -1029,7 +1117,7 @@ type GUID struct { func (x *GUID) Reset() { *x = GUID{} - mi := &file_aptos_proto_msgTypes[15] + mi := &file_aptos_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1041,7 +1129,7 @@ func (x *GUID) String() string { func (*GUID) ProtoMessage() {} func (x *GUID) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[15] + mi := &file_aptos_proto_msgTypes[17] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1054,7 +1142,7 @@ func (x *GUID) ProtoReflect() protoreflect.Message { // Deprecated: Use GUID.ProtoReflect.Descriptor instead. func (*GUID) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{15} + return file_aptos_proto_rawDescGZIP(), []int{17} } func (x *GUID) GetCreationNumber() uint64 { @@ -1080,7 +1168,7 @@ type TransactionByHashRequest struct { func (x *TransactionByHashRequest) Reset() { *x = TransactionByHashRequest{} - mi := &file_aptos_proto_msgTypes[16] + mi := &file_aptos_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1092,7 +1180,7 @@ func (x *TransactionByHashRequest) String() string { func (*TransactionByHashRequest) ProtoMessage() {} func (x *TransactionByHashRequest) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[16] + mi := &file_aptos_proto_msgTypes[18] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1105,7 +1193,7 @@ func (x *TransactionByHashRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use TransactionByHashRequest.ProtoReflect.Descriptor instead. func (*TransactionByHashRequest) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{16} + return file_aptos_proto_rawDescGZIP(), []int{18} } func (x *TransactionByHashRequest) GetHash() string { @@ -1124,7 +1212,7 @@ type TransactionByHashReply struct { func (x *TransactionByHashReply) Reset() { *x = TransactionByHashReply{} - mi := &file_aptos_proto_msgTypes[17] + mi := &file_aptos_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1136,7 +1224,7 @@ func (x *TransactionByHashReply) String() string { func (*TransactionByHashReply) ProtoMessage() {} func (x *TransactionByHashReply) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[17] + mi := &file_aptos_proto_msgTypes[19] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1149,7 +1237,7 @@ func (x *TransactionByHashReply) ProtoReflect() protoreflect.Message { // Deprecated: Use TransactionByHashReply.ProtoReflect.Descriptor instead. func (*TransactionByHashReply) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{17} + return file_aptos_proto_rawDescGZIP(), []int{19} } func (x *TransactionByHashReply) GetTransaction() *Transaction { @@ -1172,7 +1260,7 @@ type Transaction struct { func (x *Transaction) Reset() { *x = Transaction{} - mi := &file_aptos_proto_msgTypes[18] + mi := &file_aptos_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1184,7 +1272,7 @@ func (x *Transaction) String() string { func (*Transaction) ProtoMessage() {} func (x *Transaction) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[18] + mi := &file_aptos_proto_msgTypes[20] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1197,7 +1285,7 @@ func (x *Transaction) ProtoReflect() protoreflect.Message { // Deprecated: Use Transaction.ProtoReflect.Descriptor instead. func (*Transaction) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{18} + return file_aptos_proto_rawDescGZIP(), []int{20} } func (x *Transaction) GetType() TransactionVariant { @@ -1246,7 +1334,7 @@ type SubmitTransactionRequest struct { func (x *SubmitTransactionRequest) Reset() { *x = SubmitTransactionRequest{} - mi := &file_aptos_proto_msgTypes[19] + mi := &file_aptos_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1258,7 +1346,7 @@ func (x *SubmitTransactionRequest) String() string { func (*SubmitTransactionRequest) ProtoMessage() {} func (x *SubmitTransactionRequest) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[19] + mi := &file_aptos_proto_msgTypes[21] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1271,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{19} + return file_aptos_proto_rawDescGZIP(), []int{21} } func (x *SubmitTransactionRequest) GetReceiverModuleId() *ModuleID { @@ -1304,7 +1392,7 @@ type SubmitTransactionReply struct { func (x *SubmitTransactionReply) Reset() { *x = SubmitTransactionReply{} - mi := &file_aptos_proto_msgTypes[20] + mi := &file_aptos_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1316,7 +1404,7 @@ func (x *SubmitTransactionReply) String() string { func (*SubmitTransactionReply) ProtoMessage() {} func (x *SubmitTransactionReply) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[20] + mi := &file_aptos_proto_msgTypes[22] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1329,7 +1417,7 @@ func (x *SubmitTransactionReply) ProtoReflect() protoreflect.Message { // Deprecated: Use SubmitTransactionReply.ProtoReflect.Descriptor instead. func (*SubmitTransactionReply) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{20} + return file_aptos_proto_rawDescGZIP(), []int{22} } func (x *SubmitTransactionReply) GetPendingTransaction() *PendingTransaction { @@ -1349,7 +1437,7 @@ type GasConfig struct { func (x *GasConfig) Reset() { *x = GasConfig{} - mi := &file_aptos_proto_msgTypes[21] + mi := &file_aptos_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1361,7 +1449,7 @@ func (x *GasConfig) String() string { func (*GasConfig) ProtoMessage() {} func (x *GasConfig) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[21] + mi := &file_aptos_proto_msgTypes[23] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1374,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{21} + return file_aptos_proto_rawDescGZIP(), []int{23} } func (x *GasConfig) GetMaxGasAmount() uint64 { @@ -1408,7 +1496,7 @@ type PendingTransaction struct { func (x *PendingTransaction) Reset() { *x = PendingTransaction{} - mi := &file_aptos_proto_msgTypes[22] + mi := &file_aptos_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1420,7 +1508,7 @@ func (x *PendingTransaction) String() string { func (*PendingTransaction) ProtoMessage() {} func (x *PendingTransaction) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[22] + mi := &file_aptos_proto_msgTypes[24] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1433,7 +1521,7 @@ func (x *PendingTransaction) ProtoReflect() protoreflect.Message { // Deprecated: Use PendingTransaction.ProtoReflect.Descriptor instead. func (*PendingTransaction) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{22} + return file_aptos_proto_rawDescGZIP(), []int{24} } func (x *PendingTransaction) GetHash() string { @@ -1504,7 +1592,10 @@ 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" + @@ -1516,9 +1607,11 @@ const file_aptos_proto_rawDesc = "" + "\x06_startB\b\n" + "\x06_limit\"W\n" + "\x18AccountTransactionsReply\x12;\n" + - "\ftransactions\x18\x01 \x03(\v2\x17.loop.aptos.TransactionR\ftransactions\"@\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" + @@ -1627,8 +1720,9 @@ 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\a2\x97\x04\n" + - "\x05Aptos\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" + @@ -1649,66 +1743,70 @@ func file_aptos_proto_rawDescGZIP() []byte { } var file_aptos_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_aptos_proto_msgTypes = make([]protoimpl.MessageInfo, 23) +var file_aptos_proto_msgTypes = make([]protoimpl.MessageInfo, 25) var file_aptos_proto_goTypes = []any{ (TypeTagType)(0), // 0: loop.aptos.TypeTagType (TransactionVariant)(0), // 1: loop.aptos.TransactionVariant - (*AccountAPTBalanceRequest)(nil), // 2: loop.aptos.AccountAPTBalanceRequest - (*AccountAPTBalanceReply)(nil), // 3: loop.aptos.AccountAPTBalanceReply - (*AccountTransactionsRequest)(nil), // 4: loop.aptos.AccountTransactionsRequest - (*AccountTransactionsReply)(nil), // 5: loop.aptos.AccountTransactionsReply - (*ViewRequest)(nil), // 6: loop.aptos.ViewRequest - (*ViewReply)(nil), // 7: loop.aptos.ViewReply - (*ViewPayload)(nil), // 8: loop.aptos.ViewPayload - (*ModuleID)(nil), // 9: loop.aptos.ModuleID - (*TypeTag)(nil), // 10: loop.aptos.TypeTag - (*VectorTag)(nil), // 11: loop.aptos.VectorTag - (*StructTag)(nil), // 12: loop.aptos.StructTag - (*GenericTag)(nil), // 13: loop.aptos.GenericTag - (*EventsByHandleRequest)(nil), // 14: loop.aptos.EventsByHandleRequest - (*EventsByHandleReply)(nil), // 15: loop.aptos.EventsByHandleReply - (*Event)(nil), // 16: loop.aptos.Event - (*GUID)(nil), // 17: loop.aptos.GUID - (*TransactionByHashRequest)(nil), // 18: loop.aptos.TransactionByHashRequest - (*TransactionByHashReply)(nil), // 19: loop.aptos.TransactionByHashReply - (*Transaction)(nil), // 20: loop.aptos.Transaction - (*SubmitTransactionRequest)(nil), // 21: loop.aptos.SubmitTransactionRequest - (*SubmitTransactionReply)(nil), // 22: loop.aptos.SubmitTransactionReply - (*GasConfig)(nil), // 23: loop.aptos.GasConfig - (*PendingTransaction)(nil), // 24: loop.aptos.PendingTransaction + (*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{ - 20, // 0: loop.aptos.AccountTransactionsReply.transactions:type_name -> loop.aptos.Transaction - 8, // 1: loop.aptos.ViewRequest.payload:type_name -> loop.aptos.ViewPayload - 9, // 2: loop.aptos.ViewPayload.module:type_name -> loop.aptos.ModuleID - 10, // 3: loop.aptos.ViewPayload.arg_types:type_name -> loop.aptos.TypeTag + 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 - 11, // 5: loop.aptos.TypeTag.vector:type_name -> loop.aptos.VectorTag - 12, // 6: loop.aptos.TypeTag.struct:type_name -> loop.aptos.StructTag - 13, // 7: loop.aptos.TypeTag.generic:type_name -> loop.aptos.GenericTag - 10, // 8: loop.aptos.VectorTag.element_type:type_name -> loop.aptos.TypeTag - 10, // 9: loop.aptos.StructTag.type_params:type_name -> loop.aptos.TypeTag - 16, // 10: loop.aptos.EventsByHandleReply.events:type_name -> loop.aptos.Event - 17, // 11: loop.aptos.Event.guid:type_name -> loop.aptos.GUID - 20, // 12: loop.aptos.TransactionByHashReply.transaction:type_name -> loop.aptos.Transaction + 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 - 9, // 14: loop.aptos.SubmitTransactionRequest.receiver_module_id:type_name -> loop.aptos.ModuleID - 23, // 15: loop.aptos.SubmitTransactionRequest.gas_config:type_name -> loop.aptos.GasConfig - 24, // 16: loop.aptos.SubmitTransactionReply.pending_transaction:type_name -> loop.aptos.PendingTransaction - 2, // 17: loop.aptos.Aptos.AccountAPTBalance:input_type -> loop.aptos.AccountAPTBalanceRequest - 4, // 18: loop.aptos.Aptos.AccountTransactions:input_type -> loop.aptos.AccountTransactionsRequest - 6, // 19: loop.aptos.Aptos.View:input_type -> loop.aptos.ViewRequest - 14, // 20: loop.aptos.Aptos.EventsByHandle:input_type -> loop.aptos.EventsByHandleRequest - 18, // 21: loop.aptos.Aptos.TransactionByHash:input_type -> loop.aptos.TransactionByHashRequest - 21, // 22: loop.aptos.Aptos.SubmitTransaction:input_type -> loop.aptos.SubmitTransactionRequest - 3, // 23: loop.aptos.Aptos.AccountAPTBalance:output_type -> loop.aptos.AccountAPTBalanceReply - 5, // 24: loop.aptos.Aptos.AccountTransactions:output_type -> loop.aptos.AccountTransactionsReply - 7, // 25: loop.aptos.Aptos.View:output_type -> loop.aptos.ViewReply - 15, // 26: loop.aptos.Aptos.EventsByHandle:output_type -> loop.aptos.EventsByHandleReply - 19, // 27: loop.aptos.Aptos.TransactionByHash:output_type -> loop.aptos.TransactionByHashReply - 22, // 28: loop.aptos.Aptos.SubmitTransaction:output_type -> loop.aptos.SubmitTransactionReply - 23, // [23:29] is the sub-list for method output_type - 17, // [17:23] is the sub-list for method input_type + 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 @@ -1719,26 +1817,27 @@ func file_aptos_proto_init() { if File_aptos_proto != nil { return } - file_aptos_proto_msgTypes[2].OneofWrappers = []any{} - file_aptos_proto_msgTypes[8].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[12].OneofWrappers = []any{} file_aptos_proto_msgTypes[14].OneofWrappers = []any{} - file_aptos_proto_msgTypes[17].OneofWrappers = []any{} - file_aptos_proto_msgTypes[18].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: 2, - NumMessages: 23, + NumMessages: 25, NumExtensions: 0, NumServices: 1, }, diff --git a/pkg/chains/aptos/aptos.proto b/pkg/chains/aptos/aptos.proto index b37a34e78..661d6d4dc 100644 --- a/pkg/chains/aptos/aptos.proto +++ b/pkg/chains/aptos/aptos.proto @@ -4,6 +4,7 @@ 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); @@ -12,6 +13,14 @@ service Aptos { rpc SubmitTransaction(SubmitTransactionRequest) returns (SubmitTransactionReply); } +// ========== LedgerVersion ========== + +message LedgerVersionRequest {} + +message LedgerVersionReply { + uint64 ledger_version = 1; +} + // ========== AccountAPTBalance ========== message AccountAPTBalanceRequest { @@ -38,6 +47,7 @@ message AccountTransactionsReply { message ViewRequest { ViewPayload payload = 1; + optional uint64 ledger_version = 2; } message ViewReply { diff --git a/pkg/chains/aptos/aptos_grpc.pb.go b/pkg/chains/aptos/aptos_grpc.pb.go index d225e3905..06a8025ba 100644 --- a/pkg/chains/aptos/aptos_grpc.pb.go +++ b/pkg/chains/aptos/aptos_grpc.pb.go @@ -19,6 +19,7 @@ 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" @@ -31,6 +32,7 @@ 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) @@ -47,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) @@ -111,6 +123,7 @@ 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) @@ -127,6 +140,9 @@ 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.Error(codes.Unimplemented, "method AccountAPTBalance not implemented") } @@ -166,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 { @@ -281,6 +315,10 @@ 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, diff --git a/pkg/loop/internal/relayer/aptos.go b/pkg/loop/internal/relayer/aptos.go index 3c9c9a1b6..493bc08b9 100644 --- a/pkg/loop/internal/relayer/aptos.go +++ b/pkg/loop/internal/relayer/aptos.go @@ -25,6 +25,14 @@ 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[:], @@ -57,6 +65,9 @@ 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 { @@ -129,6 +140,14 @@ 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 { @@ -155,6 +174,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 { diff --git a/pkg/loop/internal/relayerset/aptos.go b/pkg/loop/internal/relayerset/aptos.go index 6ef3b8da4..e39da3c03 100644 --- a/pkg/loop/internal/relayerset/aptos.go +++ b/pkg/loop/internal/relayerset/aptos.go @@ -21,6 +21,10 @@ 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...) } @@ -73,6 +77,19 @@ 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 { @@ -108,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 { diff --git a/pkg/types/chains/aptos/aptos.go b/pkg/types/chains/aptos/aptos.go index 39e387834..0439dac40 100644 --- a/pkg/types/chains/aptos/aptos.go +++ b/pkg/types/chains/aptos/aptos.go @@ -10,6 +10,8 @@ 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. diff --git a/pkg/types/mocks/aptos_service.go b/pkg/types/mocks/aptos_service.go index 5ab7f4a9a..61ed36099 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) diff --git a/pkg/types/relayer.go b/pkg/types/relayer.go index 47c4628ab..dea0d7a5a 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") } From 1747a3e4d3a375326c0a67dbd761ed3e4965e328 Mon Sep 17 00:00:00 2001 From: cawthorne Date: Fri, 27 Feb 2026 15:20:57 +0000 Subject: [PATCH 04/18] aptos: reconcile proto/service compatibility after rebase (cherry picked from commit 7fda75dcc644561bb0bd5b036203041fefa9b164) --- .../v2/chain-capabilities/aptos/client.pb.go | 1449 ++--------------- .../v2/chain-capabilities/aptos/generate.go | 4 + .../aptos/server/client_server_gen.go | 64 +- pkg/chains/aptos/proto_helpers.go | 339 +++- pkg/chains/aptos/proto_helpers_test.go | 287 ++-- pkg/loop/internal/relayer/aptos.go | 69 +- pkg/loop/internal/relayerset/aptos.go | 39 +- .../internal/relayerset/relayerset_test.go | 103 +- pkg/types/chains/aptos/aptos.go | 116 +- pkg/types/mocks/aptos_service.go | 36 +- pkg/types/relayer.go | 4 + 11 files changed, 759 insertions(+), 1751 deletions(-) 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/proto_helpers.go b/pkg/chains/aptos/proto_helpers.go index ddfdf945d..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,6 +232,174 @@ 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 { @@ -421,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) { @@ -537,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) { @@ -549,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/relayer/aptos.go b/pkg/loop/internal/relayer/aptos.go index 493bc08b9..34fc3ba35 100644 --- a/pkg/loop/internal/relayer/aptos.go +++ b/pkg/loop/internal/relayer/aptos.go @@ -38,7 +38,7 @@ func (ac *AptosClient) AccountAPTBalance(ctx context.Context, req aptos.AccountA Address: req.Address[:], }) if err != nil { - return nil, net.WrapRPCErr(err) + return nil, err } return &aptos.AccountAPTBalanceReply{ Value: reply.Value, @@ -71,29 +71,41 @@ func (ac *AptosClient) View(ctx context.Context, req aptos.ViewRequest) (*aptos. 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) { @@ -104,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) @@ -188,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 e39da3c03..ca8f50450 100644 --- a/pkg/loop/internal/relayerset/aptos.go +++ b/pkg/loop/internal/relayerset/aptos.go @@ -37,12 +37,12 @@ func (ac *aptosClient) View(ctx context.Context, in *aptospb.ViewRequest, opts . 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) { @@ -139,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 0439dac40..167629d29 100644 --- a/pkg/types/chains/aptos/aptos.go +++ b/pkg/types/chains/aptos/aptos.go @@ -16,10 +16,10 @@ type Client interface { 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 ========== @@ -52,7 +52,7 @@ type ViewRequest struct { } 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. @@ -78,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 @@ -105,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 { @@ -162,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 { @@ -204,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 @@ -246,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 61ed36099..a45692369 100644 --- a/pkg/types/mocks/aptos_service.go +++ b/pkg/types/mocks/aptos_service.go @@ -138,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) @@ -168,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 dea0d7a5a..05d9d23ce 100644 --- a/pkg/types/relayer.go +++ b/pkg/types/relayer.go @@ -576,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") } From 7b59660d1e518a500dff01b1680df3ab7a9e5240 Mon Sep 17 00:00:00 2001 From: cawthorne Date: Tue, 3 Mar 2026 10:23:11 +0000 Subject: [PATCH 05/18] Handle Bytes Transmitters from Capability Registry (cherry picked from commit d263db311158c28c25b44c74089689954a21aa4a) --- .../capability/capabilities_registry.go | 40 ++++++++++++++++++- 1 file changed, 38 insertions(+), 2 deletions(-) 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{ From 0aca580b01e8a26502730be03573dc386ccc885a Mon Sep 17 00:00:00 2001 From: cawthorne Date: Tue, 10 Mar 2026 10:43:54 +0000 Subject: [PATCH 06/18] aptos: remove EventsByHandle from common loop service (cherry picked from commit 7e47b5e0e48b6d4d85456ac30b6b6ad799716e76) --- pkg/chains/aptos/aptos.pb.go | 398 ++++--------------------- pkg/chains/aptos/aptos.proto | 28 -- pkg/chains/aptos/aptos_grpc.pb.go | 38 --- pkg/chains/aptos/proto_helpers.go | 168 ----------- pkg/chains/aptos/proto_helpers_test.go | 117 -------- pkg/loop/internal/relayer/aptos.go | 42 --- pkg/loop/internal/relayerset/aptos.go | 30 -- pkg/types/chains/aptos/aptos.go | 34 --- pkg/types/mocks/aptos_service.go | 103 ++----- pkg/types/relayer.go | 4 - 10 files changed, 81 insertions(+), 881 deletions(-) diff --git a/pkg/chains/aptos/aptos.pb.go b/pkg/chains/aptos/aptos.pb.go index 7bccb0c4c..6a00c6acf 100644 --- a/pkg/chains/aptos/aptos.pb.go +++ b/pkg/chains/aptos/aptos.pb.go @@ -911,254 +911,6 @@ func (x *GenericTag) GetIndex() uint32 { return 0 } -type EventsByHandleRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - 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 *EventsByHandleRequest) Reset() { - *x = EventsByHandleRequest{} - mi := &file_aptos_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *EventsByHandleRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EventsByHandleRequest) ProtoMessage() {} - -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 { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use EventsByHandleRequest.ProtoReflect.Descriptor instead. -func (*EventsByHandleRequest) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{14} -} - -func (x *EventsByHandleRequest) GetAccount() []byte { - if x != nil { - return x.Account - } - return nil -} - -func (x *EventsByHandleRequest) GetEventHandle() string { - if x != nil { - return x.EventHandle - } - return "" -} - -func (x *EventsByHandleRequest) GetFieldName() string { - if x != nil { - return x.FieldName - } - return "" -} - -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 (*EventsByHandleReply) ProtoMessage() {} - -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 { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use EventsByHandleReply.ProtoReflect.Descriptor instead. -func (*EventsByHandleReply) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{15} -} - -func (x *EventsByHandleReply) GetEvents() []*Event { - if x != nil { - return x.Events - } - return nil -} - -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 *Event) Reset() { - *x = Event{} - mi := &file_aptos_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Event) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Event) ProtoMessage() {} - -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 { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Event.ProtoReflect.Descriptor instead. -func (*Event) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{16} -} - -func (x *Event) GetVersion() uint64 { - if x != nil { - return x.Version - } - return 0 -} - -func (x *Event) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *Event) GetGuid() *GUID { - if x != nil { - return x.Guid - } - return nil -} - -func (x *Event) GetSequenceNumber() uint64 { - if x != nil { - return x.SequenceNumber - } - return 0 -} - -func (x *Event) GetData() []byte { - if x != nil { - return x.Data - } - return nil -} - -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"` Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` // Transaction hash (hex string with 0x prefix) @@ -1168,7 +920,7 @@ type TransactionByHashRequest struct { func (x *TransactionByHashRequest) Reset() { *x = TransactionByHashRequest{} - mi := &file_aptos_proto_msgTypes[18] + mi := &file_aptos_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1180,7 +932,7 @@ func (x *TransactionByHashRequest) String() string { func (*TransactionByHashRequest) ProtoMessage() {} func (x *TransactionByHashRequest) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[18] + mi := &file_aptos_proto_msgTypes[14] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1193,7 +945,7 @@ func (x *TransactionByHashRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use TransactionByHashRequest.ProtoReflect.Descriptor instead. func (*TransactionByHashRequest) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{18} + return file_aptos_proto_rawDescGZIP(), []int{14} } func (x *TransactionByHashRequest) GetHash() string { @@ -1212,7 +964,7 @@ type TransactionByHashReply struct { func (x *TransactionByHashReply) Reset() { *x = TransactionByHashReply{} - mi := &file_aptos_proto_msgTypes[19] + mi := &file_aptos_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1224,7 +976,7 @@ func (x *TransactionByHashReply) String() string { func (*TransactionByHashReply) ProtoMessage() {} func (x *TransactionByHashReply) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[19] + mi := &file_aptos_proto_msgTypes[15] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1237,7 +989,7 @@ func (x *TransactionByHashReply) ProtoReflect() protoreflect.Message { // Deprecated: Use TransactionByHashReply.ProtoReflect.Descriptor instead. func (*TransactionByHashReply) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{19} + return file_aptos_proto_rawDescGZIP(), []int{15} } func (x *TransactionByHashReply) GetTransaction() *Transaction { @@ -1260,7 +1012,7 @@ type Transaction struct { func (x *Transaction) Reset() { *x = Transaction{} - mi := &file_aptos_proto_msgTypes[20] + mi := &file_aptos_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1272,7 +1024,7 @@ func (x *Transaction) String() string { func (*Transaction) ProtoMessage() {} func (x *Transaction) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[20] + mi := &file_aptos_proto_msgTypes[16] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1285,7 +1037,7 @@ func (x *Transaction) ProtoReflect() protoreflect.Message { // Deprecated: Use Transaction.ProtoReflect.Descriptor instead. func (*Transaction) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{20} + return file_aptos_proto_rawDescGZIP(), []int{16} } func (x *Transaction) GetType() TransactionVariant { @@ -1334,7 +1086,7 @@ type SubmitTransactionRequest struct { func (x *SubmitTransactionRequest) Reset() { *x = SubmitTransactionRequest{} - mi := &file_aptos_proto_msgTypes[21] + mi := &file_aptos_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1346,7 +1098,7 @@ func (x *SubmitTransactionRequest) String() string { func (*SubmitTransactionRequest) ProtoMessage() {} func (x *SubmitTransactionRequest) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[21] + mi := &file_aptos_proto_msgTypes[17] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1359,7 +1111,7 @@ func (x *SubmitTransactionRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SubmitTransactionRequest.ProtoReflect.Descriptor instead. func (*SubmitTransactionRequest) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{21} + return file_aptos_proto_rawDescGZIP(), []int{17} } func (x *SubmitTransactionRequest) GetReceiverModuleId() *ModuleID { @@ -1392,7 +1144,7 @@ type SubmitTransactionReply struct { func (x *SubmitTransactionReply) Reset() { *x = SubmitTransactionReply{} - mi := &file_aptos_proto_msgTypes[22] + mi := &file_aptos_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1404,7 +1156,7 @@ func (x *SubmitTransactionReply) String() string { func (*SubmitTransactionReply) ProtoMessage() {} func (x *SubmitTransactionReply) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[22] + mi := &file_aptos_proto_msgTypes[18] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1417,7 +1169,7 @@ func (x *SubmitTransactionReply) ProtoReflect() protoreflect.Message { // Deprecated: Use SubmitTransactionReply.ProtoReflect.Descriptor instead. func (*SubmitTransactionReply) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{22} + return file_aptos_proto_rawDescGZIP(), []int{18} } func (x *SubmitTransactionReply) GetPendingTransaction() *PendingTransaction { @@ -1437,7 +1189,7 @@ type GasConfig struct { func (x *GasConfig) Reset() { *x = GasConfig{} - mi := &file_aptos_proto_msgTypes[23] + mi := &file_aptos_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1449,7 +1201,7 @@ func (x *GasConfig) String() string { func (*GasConfig) ProtoMessage() {} func (x *GasConfig) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[23] + mi := &file_aptos_proto_msgTypes[19] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1462,7 +1214,7 @@ func (x *GasConfig) ProtoReflect() protoreflect.Message { // Deprecated: Use GasConfig.ProtoReflect.Descriptor instead. func (*GasConfig) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{23} + return file_aptos_proto_rawDescGZIP(), []int{19} } func (x *GasConfig) GetMaxGasAmount() uint64 { @@ -1496,7 +1248,7 @@ type PendingTransaction struct { func (x *PendingTransaction) Reset() { *x = PendingTransaction{} - mi := &file_aptos_proto_msgTypes[24] + mi := &file_aptos_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1508,7 +1260,7 @@ func (x *PendingTransaction) String() string { func (*PendingTransaction) ProtoMessage() {} func (x *PendingTransaction) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[24] + mi := &file_aptos_proto_msgTypes[20] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1521,7 +1273,7 @@ func (x *PendingTransaction) ProtoReflect() protoreflect.Message { // Deprecated: Use PendingTransaction.ProtoReflect.Descriptor instead. func (*PendingTransaction) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{24} + return file_aptos_proto_rawDescGZIP(), []int{20} } func (x *PendingTransaction) GetHash() string { @@ -1638,28 +1390,7 @@ const file_aptos_proto_rawDesc = "" + "typeParams\"\"\n" + "\n" + "GenericTag\x12\x14\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" + + "\x05index\x18\x01 \x01(\rR\x05index\".\n" + "\x18TransactionByHashRequest\x12\x12\n" + "\x04hash\x18\x01 \x01(\tR\x04hash\"h\n" + "\x16TransactionByHashReply\x12>\n" + @@ -1720,13 +1451,12 @@ 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\a2\xea\x04\n" + + "\x1bTRANSACTION_VARIANT_UNKNOWN\x10\a2\x94\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" + + "\x04View\x12\x17.loop.aptos.ViewRequest\x1a\x15.loop.aptos.ViewReply\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" @@ -1743,7 +1473,7 @@ func file_aptos_proto_rawDescGZIP() []byte { } var file_aptos_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_aptos_proto_msgTypes = make([]protoimpl.MessageInfo, 25) +var file_aptos_proto_msgTypes = make([]protoimpl.MessageInfo, 21) var file_aptos_proto_goTypes = []any{ (TypeTagType)(0), // 0: loop.aptos.TypeTagType (TransactionVariant)(0), // 1: loop.aptos.TransactionVariant @@ -1761,20 +1491,16 @@ var file_aptos_proto_goTypes = []any{ (*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 + (*TransactionByHashRequest)(nil), // 16: loop.aptos.TransactionByHashRequest + (*TransactionByHashReply)(nil), // 17: loop.aptos.TransactionByHashReply + (*Transaction)(nil), // 18: loop.aptos.Transaction + (*SubmitTransactionRequest)(nil), // 19: loop.aptos.SubmitTransactionRequest + (*SubmitTransactionReply)(nil), // 20: loop.aptos.SubmitTransactionReply + (*GasConfig)(nil), // 21: loop.aptos.GasConfig + (*PendingTransaction)(nil), // 22: loop.aptos.PendingTransaction } var file_aptos_proto_depIdxs = []int32{ - 22, // 0: loop.aptos.AccountTransactionsReply.transactions:type_name -> loop.aptos.Transaction + 18, // 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 @@ -1784,32 +1510,28 @@ var file_aptos_proto_depIdxs = []int32{ 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 + 18, // 10: loop.aptos.TransactionByHashReply.transaction:type_name -> loop.aptos.Transaction + 1, // 11: loop.aptos.Transaction.type:type_name -> loop.aptos.TransactionVariant + 11, // 12: loop.aptos.SubmitTransactionRequest.receiver_module_id:type_name -> loop.aptos.ModuleID + 21, // 13: loop.aptos.SubmitTransactionRequest.gas_config:type_name -> loop.aptos.GasConfig + 22, // 14: loop.aptos.SubmitTransactionReply.pending_transaction:type_name -> loop.aptos.PendingTransaction + 2, // 15: loop.aptos.Aptos.LedgerVersion:input_type -> loop.aptos.LedgerVersionRequest + 4, // 16: loop.aptos.Aptos.AccountAPTBalance:input_type -> loop.aptos.AccountAPTBalanceRequest + 6, // 17: loop.aptos.Aptos.AccountTransactions:input_type -> loop.aptos.AccountTransactionsRequest + 8, // 18: loop.aptos.Aptos.View:input_type -> loop.aptos.ViewRequest + 16, // 19: loop.aptos.Aptos.TransactionByHash:input_type -> loop.aptos.TransactionByHashRequest + 19, // 20: loop.aptos.Aptos.SubmitTransaction:input_type -> loop.aptos.SubmitTransactionRequest + 3, // 21: loop.aptos.Aptos.LedgerVersion:output_type -> loop.aptos.LedgerVersionReply + 5, // 22: loop.aptos.Aptos.AccountAPTBalance:output_type -> loop.aptos.AccountAPTBalanceReply + 7, // 23: loop.aptos.Aptos.AccountTransactions:output_type -> loop.aptos.AccountTransactionsReply + 9, // 24: loop.aptos.Aptos.View:output_type -> loop.aptos.ViewReply + 17, // 25: loop.aptos.Aptos.TransactionByHash:output_type -> loop.aptos.TransactionByHashReply + 20, // 26: loop.aptos.Aptos.SubmitTransaction:output_type -> loop.aptos.SubmitTransactionReply + 21, // [21:27] is the sub-list for method output_type + 15, // [15:21] 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 } func init() { file_aptos_proto_init() } @@ -1824,20 +1546,18 @@ func file_aptos_proto_init() { (*TypeTag_Struct)(nil), (*TypeTag_Generic)(nil), } - file_aptos_proto_msgTypes[14].OneofWrappers = []any{} + file_aptos_proto_msgTypes[15].OneofWrappers = []any{} file_aptos_proto_msgTypes[16].OneofWrappers = []any{} - file_aptos_proto_msgTypes[19].OneofWrappers = []any{} + file_aptos_proto_msgTypes[17].OneofWrappers = []any{} + file_aptos_proto_msgTypes[18].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: 2, - NumMessages: 25, + NumMessages: 21, NumExtensions: 0, NumServices: 1, }, diff --git a/pkg/chains/aptos/aptos.proto b/pkg/chains/aptos/aptos.proto index 661d6d4dc..7c4ec42d8 100644 --- a/pkg/chains/aptos/aptos.proto +++ b/pkg/chains/aptos/aptos.proto @@ -8,7 +8,6 @@ service Aptos { 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 SubmitTransaction(SubmitTransactionRequest) returns (SubmitTransactionReply); } @@ -105,33 +104,6 @@ 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 ========== message TransactionByHashRequest { diff --git a/pkg/chains/aptos/aptos_grpc.pb.go b/pkg/chains/aptos/aptos_grpc.pb.go index 06a8025ba..169969d84 100644 --- a/pkg/chains/aptos/aptos_grpc.pb.go +++ b/pkg/chains/aptos/aptos_grpc.pb.go @@ -23,7 +23,6 @@ const ( 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_SubmitTransaction_FullMethodName = "/loop.aptos.Aptos/SubmitTransaction" ) @@ -36,7 +35,6 @@ type AptosClient interface { 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) SubmitTransaction(ctx context.Context, in *SubmitTransactionRequest, opts ...grpc.CallOption) (*SubmitTransactionReply, error) } @@ -89,16 +87,6 @@ func (c *aptosClient) View(ctx context.Context, in *ViewRequest, opts ...grpc.Ca return out, nil } -func (c *aptosClient) EventsByHandle(ctx context.Context, in *EventsByHandleRequest, opts ...grpc.CallOption) (*EventsByHandleReply, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - 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) TransactionByHash(ctx context.Context, in *TransactionByHashRequest, opts ...grpc.CallOption) (*TransactionByHashReply, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(TransactionByHashReply) @@ -127,7 +115,6 @@ type AptosServer interface { 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) SubmitTransaction(context.Context, *SubmitTransactionRequest) (*SubmitTransactionReply, error) mustEmbedUnimplementedAptosServer() @@ -152,9 +139,6 @@ func (UnimplementedAptosServer) AccountTransactions(context.Context, *AccountTra func (UnimplementedAptosServer) View(context.Context, *ViewRequest) (*ViewReply, error) { return nil, status.Error(codes.Unimplemented, "method View not implemented") } -func (UnimplementedAptosServer) EventsByHandle(context.Context, *EventsByHandleRequest) (*EventsByHandleReply, error) { - return nil, status.Error(codes.Unimplemented, "method EventsByHandle not implemented") -} func (UnimplementedAptosServer) TransactionByHash(context.Context, *TransactionByHashRequest) (*TransactionByHashReply, error) { return nil, status.Error(codes.Unimplemented, "method TransactionByHash not implemented") } @@ -254,24 +238,6 @@ func _Aptos_View_Handler(srv interface{}, ctx context.Context, dec func(interfac return interceptor(ctx, in, info, handler) } -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).EventsByHandle(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Aptos_EventsByHandle_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AptosServer).EventsByHandle(ctx, req.(*EventsByHandleRequest)) - } - 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) if err := dec(in); err != nil { @@ -331,10 +297,6 @@ var Aptos_ServiceDesc = grpc.ServiceDesc{ MethodName: "View", Handler: _Aptos_View_Handler, }, - { - MethodName: "EventsByHandle", - Handler: _Aptos_EventsByHandle_Handler, - }, { MethodName: "TransactionByHash", Handler: _Aptos_TransactionByHash_Handler, diff --git a/pkg/chains/aptos/proto_helpers.go b/pkg/chains/aptos/proto_helpers.go index b387a84b5..9d4cb92a3 100644 --- a/pkg/chains/aptos/proto_helpers.go +++ b/pkg/chains/aptos/proto_helpers.go @@ -232,174 +232,6 @@ 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 { diff --git a/pkg/chains/aptos/proto_helpers_test.go b/pkg/chains/aptos/proto_helpers_test.go index 2a806292a..99c7c0535 100644 --- a/pkg/chains/aptos/proto_helpers_test.go +++ b/pkg/chains/aptos/proto_helpers_test.go @@ -183,67 +183,6 @@ 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) @@ -417,62 +356,6 @@ func TestSubmitTransactionConverters(t *testing.T) { }) } -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, err := conv.ConvertEventsByHandleRequestToProto(req) - require.NoError(t, err) - 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.ConvertEventsByHandleRequestFromProto(protoReq) - require.NoError(t, err) - require.Equal(t, req.EventHandle, roundtrip.EventHandle) - require.NotNil(t, roundtrip.Start) - require.Equal(t, start, *roundtrip.Start) - }) - - 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, err := conv.ConvertEventsByHandleReplyToProto(reply) - require.NoError(t, err) - require.Len(t, protoReply.Events, 2) - - roundtrip, err := conv.ConvertEventsByHandleReplyFromProto(protoReply) - require.NoError(t, err) - 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) - }) -} - func TestErrorJoinBehavior(t *testing.T) { t.Run("Aggregates multiple conversion errors", func(t *testing.T) { // Test that error wrapping works as expected diff --git a/pkg/loop/internal/relayer/aptos.go b/pkg/loop/internal/relayer/aptos.go index 34fc3ba35..0eb474057 100644 --- a/pkg/loop/internal/relayer/aptos.go +++ b/pkg/loop/internal/relayer/aptos.go @@ -78,27 +78,6 @@ func (ac *AptosClient) View(ctx context.Context, req aptos.ViewRequest) (*aptos. return aptospb.ConvertViewReplyFromProto(reply) } -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, fmt.Errorf("failed to convert request: %w", err) - } - - 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) TransactionByHash(ctx context.Context, req aptos.TransactionByHashRequest) (*aptos.TransactionByHashReply, error) { protoReq := aptospb.ConvertTransactionByHashRequestToProto(req) protoResp, err := ac.grpcClient.TransactionByHash(ctx, protoReq) @@ -200,27 +179,6 @@ func (s *aptosServer) View(ctx context.Context, req *aptospb.ViewRequest) (*apto return aptospb.ConvertViewReplyToProto(reply) } -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.EventsByHandle(ctx, *goReq) - if err != nil { - return nil, err - } - - // Convert Go types back to proto types - protoReply, err := aptospb.ConvertEventsByHandleReplyToProto(reply) - if err != nil { - return nil, fmt.Errorf("failed to convert reply: %w", err) - } - - 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) diff --git a/pkg/loop/internal/relayerset/aptos.go b/pkg/loop/internal/relayerset/aptos.go index ca8f50450..54dcd0b0d 100644 --- a/pkg/loop/internal/relayerset/aptos.go +++ b/pkg/loop/internal/relayerset/aptos.go @@ -37,10 +37,6 @@ func (ac *aptosClient) View(ctx context.Context, in *aptospb.ViewRequest, opts . return ac.client.View(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) TransactionByHash(ctx context.Context, in *aptospb.TransactionByHashRequest, opts ...grpc.CallOption) (*aptospb.TransactionByHashReply, error) { return ac.client.TransactionByHash(appendRelayID(ctx, ac.relayID), in, opts...) } @@ -139,32 +135,6 @@ func (as *aptosServer) View(ctx context.Context, req *aptospb.ViewRequest) (*apt return aptospb.ConvertViewReplyToProto(reply) } -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 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.EventsByHandle(ctx, *goReq) - if err != nil { - return nil, err - } - - // Convert Go types back to proto types - protoReply, err := aptospb.ConvertEventsByHandleReplyToProto(reply) - if err != nil { - return nil, fmt.Errorf("failed to convert reply: %w", err) - } - - return protoReply, nil -} - func (as *aptosServer) TransactionByHash(ctx context.Context, req *aptospb.TransactionByHashRequest) (*aptospb.TransactionByHashReply, error) { aptosService, err := as.parent.getAptosService(ctx) if err != nil { diff --git a/pkg/types/chains/aptos/aptos.go b/pkg/types/chains/aptos/aptos.go index 167629d29..e5970bbb8 100644 --- a/pkg/types/chains/aptos/aptos.go +++ b/pkg/types/chains/aptos/aptos.go @@ -16,8 +16,6 @@ type Client interface { 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) } @@ -171,38 +169,6 @@ type GenericTag struct { 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 { Hash string // Transaction hash (hex string with 0x prefix) diff --git a/pkg/types/mocks/aptos_service.go b/pkg/types/mocks/aptos_service.go index a45692369..fad2130c8 100644 --- a/pkg/types/mocks/aptos_service.go +++ b/pkg/types/mocks/aptos_service.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.53.3. DO NOT EDIT. +// Code generated by mockery v2.53.0. DO NOT EDIT. package mocks @@ -23,62 +23,6 @@ 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) @@ -138,29 +82,27 @@ func (_c *AptosService_AccountAPTBalance_Call) RunAndReturn(run func(context.Con return _c } -// 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) +// 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 EventsByHandle") + panic("no return value specified for LedgerVersion") } - var r0 *aptos.EventsByHandleReply + var r0 uint64 var r1 error - 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) (uint64, error)); ok { + return rf(ctx) } - if rf, ok := ret.Get(0).(func(context.Context, aptos.EventsByHandleRequest) *aptos.EventsByHandleReply); ok { - r0 = rf(ctx, req) + if rf, ok := ret.Get(0).(func(context.Context) uint64); ok { + r0 = rf(ctx) } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*aptos.EventsByHandleReply) - } + r0 = ret.Get(0).(uint64) } - if rf, ok := ret.Get(1).(func(context.Context, aptos.EventsByHandleRequest) error); ok { - r1 = rf(ctx, req) + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(ctx) } else { r1 = ret.Error(1) } @@ -168,31 +110,30 @@ func (_m *AptosService) EventsByHandle(ctx context.Context, req aptos.EventsByHa return r0, r1 } -// AptosService_EventsByHandle_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EventsByHandle' -type AptosService_EventsByHandle_Call struct { +// 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 } -// EventsByHandle is a helper method to define mock.On call +// LedgerVersion is a helper method to define mock.On call // - ctx context.Context -// - 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 (_e *AptosService_Expecter) LedgerVersion(ctx interface{}) *AptosService_LedgerVersion_Call { + return &AptosService_LedgerVersion_Call{Call: _e.mock.On("LedgerVersion", ctx)} } -func (_c *AptosService_EventsByHandle_Call) Run(run func(ctx context.Context, req aptos.EventsByHandleRequest)) *AptosService_EventsByHandle_Call { +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), args[1].(aptos.EventsByHandleRequest)) + run(args[0].(context.Context)) }) return _c } -func (_c *AptosService_EventsByHandle_Call) Return(_a0 *aptos.EventsByHandleReply, _a1 error) *AptosService_EventsByHandle_Call { +func (_c *AptosService_LedgerVersion_Call) Return(_a0 uint64, _a1 error) *AptosService_LedgerVersion_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *AptosService_EventsByHandle_Call) RunAndReturn(run func(context.Context, aptos.EventsByHandleRequest) (*aptos.EventsByHandleReply, error)) *AptosService_EventsByHandle_Call { +func (_c *AptosService_LedgerVersion_Call) RunAndReturn(run func(context.Context) (uint64, error)) *AptosService_LedgerVersion_Call { _c.Call.Return(run) return _c } diff --git a/pkg/types/relayer.go b/pkg/types/relayer.go index 05d9d23ce..dea0d7a5a 100644 --- a/pkg/types/relayer.go +++ b/pkg/types/relayer.go @@ -576,10 +576,6 @@ 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") } From e6c9084dd40c7d892802f3ec558b6c2bbc5a7037 Mon Sep 17 00:00:00 2001 From: cawthorne Date: Tue, 10 Mar 2026 10:48:32 +0000 Subject: [PATCH 07/18] aptos: regenerate proto stubs with upstream tool versions (cherry picked from commit 13d99da6e0cb4f4b24f06b39618620ba9493026c) --- pkg/chains/aptos/aptos.pb.go | 4 ++-- pkg/chains/aptos/aptos_grpc.pb.go | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pkg/chains/aptos/aptos.pb.go b/pkg/chains/aptos/aptos.pb.go index 6a00c6acf..2ffbc2a29 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.10 -// protoc v5.27.3 +// protoc-gen-go v1.36.11 +// protoc v5.29.3 // source: aptos.proto package aptos diff --git a/pkg/chains/aptos/aptos_grpc.pb.go b/pkg/chains/aptos/aptos_grpc.pb.go index 169969d84..cbb41d694 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.6.1 -// - protoc v5.27.3 +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.29.3 // source: aptos.proto package aptos @@ -128,22 +128,22 @@ type AptosServer interface { type UnimplementedAptosServer struct{} func (UnimplementedAptosServer) LedgerVersion(context.Context, *LedgerVersionRequest) (*LedgerVersionReply, error) { - return nil, status.Error(codes.Unimplemented, "method LedgerVersion not implemented") + return nil, status.Errorf(codes.Unimplemented, "method LedgerVersion not implemented") } func (UnimplementedAptosServer) AccountAPTBalance(context.Context, *AccountAPTBalanceRequest) (*AccountAPTBalanceReply, error) { - return nil, status.Error(codes.Unimplemented, "method AccountAPTBalance not implemented") + return nil, status.Errorf(codes.Unimplemented, "method AccountAPTBalance not implemented") } func (UnimplementedAptosServer) AccountTransactions(context.Context, *AccountTransactionsRequest) (*AccountTransactionsReply, error) { - return nil, status.Error(codes.Unimplemented, "method AccountTransactions not implemented") + return nil, status.Errorf(codes.Unimplemented, "method AccountTransactions not implemented") } func (UnimplementedAptosServer) View(context.Context, *ViewRequest) (*ViewReply, error) { - return nil, status.Error(codes.Unimplemented, "method View not implemented") + return nil, status.Errorf(codes.Unimplemented, "method View not implemented") } func (UnimplementedAptosServer) TransactionByHash(context.Context, *TransactionByHashRequest) (*TransactionByHashReply, error) { - return nil, status.Error(codes.Unimplemented, "method TransactionByHash not implemented") + return nil, status.Errorf(codes.Unimplemented, "method TransactionByHash not implemented") } func (UnimplementedAptosServer) SubmitTransaction(context.Context, *SubmitTransactionRequest) (*SubmitTransactionReply, error) { - return nil, status.Error(codes.Unimplemented, "method SubmitTransaction not implemented") + return nil, status.Errorf(codes.Unimplemented, "method SubmitTransaction not implemented") } func (UnimplementedAptosServer) mustEmbedUnimplementedAptosServer() {} func (UnimplementedAptosServer) testEmbeddedByValue() {} @@ -156,7 +156,7 @@ type UnsafeAptosServer interface { } func RegisterAptosServer(s grpc.ServiceRegistrar, srv AptosServer) { - // If the following call panics, it indicates UnimplementedAptosServer was + // If the following call pancis, 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. From fdc7dba205392cf31fd1241a3b15460cafc84cd4 Mon Sep 17 00:00:00 2001 From: cawthorne Date: Tue, 10 Mar 2026 10:51:53 +0000 Subject: [PATCH 08/18] aptos capability: restore existing generated client methods (cherry picked from commit 7f43bb273c428f46a0fa3a1d10cca194bc7d7597) --- .../v2/chain-capabilities/aptos/client.pb.go | 1449 +++++++++++++++-- .../v2/chain-capabilities/aptos/generate.go | 4 - .../aptos/server/client_server_gen.go | 64 +- 3 files changed, 1347 insertions(+), 170 deletions(-) diff --git a/pkg/capabilities/v2/chain-capabilities/aptos/client.pb.go b/pkg/capabilities/v2/chain-capabilities/aptos/client.pb.go index 2e3b735ce..347028bdf 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.10 -// protoc v5.27.3 +// protoc-gen-go v1.36.11 +// protoc v5.29.3 // source: capabilities/blockchain/aptos/v1alpha/client.proto package aptos @@ -23,29 +23,26 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// Transaction status for Aptos write report. +// Transaction execution status returned by the forwarder. type TxStatus int32 const ( - TxStatus_TX_STATUS_UNKNOWN TxStatus = 0 - TxStatus_TX_STATUS_PENDING TxStatus = 1 - TxStatus_TX_STATUS_SUCCESS TxStatus = 2 - TxStatus_TX_STATUS_FAILED TxStatus = 3 + 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 ) // Enum value maps for TxStatus. var ( TxStatus_name = map[int32]string{ - 0: "TX_STATUS_UNKNOWN", - 1: "TX_STATUS_PENDING", + 0: "TX_STATUS_FATAL", + 1: "TX_STATUS_ABORTED", 2: "TX_STATUS_SUCCESS", - 3: "TX_STATUS_FAILED", } TxStatus_value = map[string]int32{ - "TX_STATUS_UNKNOWN": 0, - "TX_STATUS_PENDING": 1, + "TX_STATUS_FATAL": 0, + "TX_STATUS_ABORTED": 1, "TX_STATUS_SUCCESS": 2, - "TX_STATUS_FAILED": 3, } ) @@ -76,30 +73,818 @@ func (TxStatus) EnumDescriptor() ([]byte, []int) { return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{0} } -// Gas configuration for Aptos transactions. -type GasConfig struct { +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 { state protoimpl.MessageState `protogen:"open.v1"` - 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"` + 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 unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *GasConfig) Reset() { - *x = GasConfig{} - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[0] +func (x *Transaction) Reset() { + *x = Transaction{} + mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *GasConfig) String() string { +func (x *Transaction) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GasConfig) ProtoMessage() {} +func (*Transaction) ProtoMessage() {} -func (x *GasConfig) ProtoReflect() protoreflect.Message { - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[0] +func (x *Transaction) ProtoReflect() protoreflect.Message { + mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[12] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -110,50 +895,128 @@ 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{0} +// Deprecated: Use Transaction.ProtoReflect.Descriptor instead. +func (*Transaction) Descriptor() ([]byte, []int) { + return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{12} } -func (x *GasConfig) GetMaxGasAmount() uint64 { +func (x *Transaction) GetType() TransactionVariant { if x != nil { - return x.MaxGasAmount + 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 *GasConfig) GetGasUnitPrice() uint64 { +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.GasUnitPrice + 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 { + if x != nil { + return x.Address + } + return nil +} + +func (x *AccountTransactionsRequest) GetStart() uint64 { + if x != nil && x.Start != nil { + return *x.Start } return 0 } -// Request to write a signed report to the Aptos chain via the CRE forwarder. -type WriteReportRequest struct { +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"` - 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"` + Transactions []*Transaction `protobuf:"bytes,1,rep,name=transactions,proto3" json:"transactions,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *WriteReportRequest) Reset() { - *x = WriteReportRequest{} - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[1] +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 *WriteReportRequest) String() string { +func (x *AccountTransactionsReply) String() string { return protoimpl.X.MessageStringOf(x) } -func (*WriteReportRequest) ProtoMessage() {} +func (*AccountTransactionsReply) ProtoMessage() {} -func (x *WriteReportRequest) ProtoReflect() protoreflect.Message { - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[1] +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 { @@ -164,57 +1027,102 @@ 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{1} +// Deprecated: Use AccountTransactionsReply.ProtoReflect.Descriptor instead. +func (*AccountTransactionsReply) Descriptor() ([]byte, []int) { + return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{14} } -func (x *WriteReportRequest) GetReceiver() []byte { +func (x *AccountTransactionsReply) GetTransactions() []*Transaction { if x != nil { - return x.Receiver + return x.Transactions } return nil } -func (x *WriteReportRequest) GetReport() *sdk.ReportResponse { +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] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SubmitTransactionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SubmitTransactionRequest) ProtoMessage() {} + +func (x *SubmitTransactionRequest) ProtoReflect() protoreflect.Message { + mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[15] if x != nil { - return x.Report + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + 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} +} + +func (x *SubmitTransactionRequest) GetReceiverModuleId() *ModuleID { + if x != nil { + return x.ReceiverModuleId } return nil } -func (x *WriteReportRequest) GetGasConfig() *GasConfig { +func (x *SubmitTransactionRequest) GetEncodedPayload() []byte { + if x != nil { + return x.EncodedPayload + } + return nil +} + +func (x *SubmitTransactionRequest) GetGasConfig() *GasConfig { if x != nil { return x.GasConfig } return nil } -// 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 +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 } -func (x *WriteReportReply) Reset() { - *x = WriteReportReply{} - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[2] +func (x *SubmitTransactionReply) Reset() { + *x = SubmitTransactionReply{} + mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *WriteReportReply) String() string { +func (x *SubmitTransactionReply) String() string { return protoimpl.X.MessageStringOf(x) } -func (*WriteReportReply) ProtoMessage() {} +func (*SubmitTransactionReply) ProtoMessage() {} -func (x *WriteReportReply) ProtoReflect() protoreflect.Message { - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[2] +func (x *SubmitTransactionReply) ProtoReflect() protoreflect.Message { + mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[16] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -225,57 +1133,55 @@ func (x *WriteReportReply) ProtoReflect() protoreflect.Message { 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{2} +// Deprecated: Use SubmitTransactionReply.ProtoReflect.Descriptor instead. +func (*SubmitTransactionReply) Descriptor() ([]byte, []int) { + return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{16} } -func (x *WriteReportReply) GetTxStatus() TxStatus { +func (x *SubmitTransactionReply) GetTxStatus() TxStatus { if x != nil { return x.TxStatus } - return TxStatus_TX_STATUS_UNKNOWN + return TxStatus_TX_STATUS_FATAL } -func (x *WriteReportReply) GetTxHash() []byte { +func (x *SubmitTransactionReply) GetTxHash() string { if x != nil { return x.TxHash } - return nil + return "" } -func (x *WriteReportReply) GetErrorMessage() string { - if x != nil && x.ErrorMessage != nil { - return *x.ErrorMessage +func (x *SubmitTransactionReply) GetTxIdempotencyKey() string { + if x != nil { + return x.TxIdempotencyKey } return "" } -// 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 { +type GasConfig struct { state protoimpl.MessageState `protogen:"open.v1"` - 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 + 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 unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *ViewRequest) Reset() { - *x = ViewRequest{} - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[3] +func (x *GasConfig) Reset() { + *x = GasConfig{} + mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *ViewRequest) String() string { +func (x *GasConfig) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ViewRequest) ProtoMessage() {} +func (*GasConfig) ProtoMessage() {} -func (x *ViewRequest) ProtoReflect() protoreflect.Message { - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[3] +func (x *GasConfig) ProtoReflect() protoreflect.Message { + mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[17] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -286,48 +1192,49 @@ func (x *ViewRequest) ProtoReflect() protoreflect.Message { 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{3} +// Deprecated: Use GasConfig.ProtoReflect.Descriptor instead. +func (*GasConfig) Descriptor() ([]byte, []int) { + return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{17} } -func (x *ViewRequest) GetFunction() string { +func (x *GasConfig) GetMaxGasAmount() uint64 { if x != nil { - return x.Function + return x.MaxGasAmount } - return "" + return 0 } -func (x *ViewRequest) GetArguments() [][]byte { +func (x *GasConfig) GetGasUnitPrice() uint64 { if x != nil { - return x.Arguments + return x.GasUnitPrice } - return nil + return 0 } -// Reply from a view call. Data is the raw response (e.g. JSON array from Aptos view API). -type ViewReply struct { +type WriteReportRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` + 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 unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *ViewReply) Reset() { - *x = ViewReply{} - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[4] +func (x *WriteReportRequest) Reset() { + *x = WriteReportRequest{} + mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *ViewReply) String() string { +func (x *WriteReportRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ViewReply) ProtoMessage() {} +func (*WriteReportRequest) ProtoMessage() {} -func (x *ViewReply) ProtoReflect() protoreflect.Message { - mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[4] +func (x *WriteReportRequest) ProtoReflect() protoreflect.Message { + mi := &file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[18] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -338,53 +1245,228 @@ func (x *ViewReply) ProtoReflect() protoreflect.Message { 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{4} +// Deprecated: Use WriteReportRequest.ProtoReflect.Descriptor instead. +func (*WriteReportRequest) Descriptor() ([]byte, []int) { + return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{18} } -func (x *ViewReply) GetData() []byte { +func (x *WriteReportRequest) GetReceiver() []byte { if x != nil { - return x.Data + return x.Receiver + } + return nil +} + +func (x *WriteReportRequest) GetGasConfig() *GasConfig { + if x != nil { + return x.GasConfig + } + return nil +} + +func (x *WriteReportRequest) GetReport() *sdk.ReportResponse { + if x != nil { + return x.Report } 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\"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\"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" + "\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\x123\n" + - "\x06report\x18\x02 \x01(\v2\x1b.sdk.v1alpha.ReportResponseR\x06report\x12T\n" + + "\breceiver\x18\x01 \x01(\fR\breceiver\x12T\n" + "\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" + + "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" + "\x10WriteReportReply\x12L\n" + "\ttx_status\x18\x01 \x01(\x0e2/.capabilities.blockchain.aptos.v1alpha.TxStatusR\btxStatus\x12\x1c\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" + + "\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" + "\n" + - "\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" + "\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" var ( file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescOnce sync.Once @@ -398,30 +1480,68 @@ 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, 1) -var file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +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_goTypes = []any{ - (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 + (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 } var file_capabilities_blockchain_aptos_v1alpha_client_proto_depIdxs = []int32{ - 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 + 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 } func init() { file_capabilities_blockchain_aptos_v1alpha_client_proto_init() } @@ -429,15 +1549,24 @@ 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[1].OneofWrappers = []any{} - file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[2].OneofWrappers = []any{} + 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{} 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: 1, - NumMessages: 5, + NumEnums: 3, + NumMessages: 20, 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 22f618403..e4b2cbb94 100644 --- a/pkg/capabilities/v2/chain-capabilities/aptos/generate.go +++ b/pkg/capabilities/v2/chain-capabilities/aptos/generate.go @@ -1,6 +1,2 @@ -// 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 ab62b781c..9292bd029 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,10 +20,16 @@ import ( var _ = emptypb.Empty{} type ClientCapability interface { - WriteReport(ctx context.Context, metadata capabilities.RequestMetadata, input *aptos.WriteReportRequest) (*capabilities.ResponseAndMetadata[*aptos.WriteReportReply], caperrors.Error) + AccountAPTBalance(ctx context.Context, metadata capabilities.RequestMetadata, input *aptos.AccountAPTBalanceRequest) (*capabilities.ResponseAndMetadata[*aptos.AccountAPTBalanceReply], 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 @@ -112,6 +118,10 @@ 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 } @@ -123,16 +133,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 "WriteReport": - input := &aptos.WriteReportRequest{} + case "AccountAPTBalance": + input := &aptos.AccountAPTBalanceRequest{} 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) + 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) 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 nil, capabilities.ResponseMetadata{}, fmt.Errorf("output and error is nil for method AccountAPTBalance(..) (if output is nil error must be present)") } return output.Response, output.ResponseMetadata, err } @@ -151,6 +161,48 @@ 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) } From 992f930f81e0800565e6798a79961759435b0fbb Mon Sep 17 00:00:00 2001 From: cawthorne Date: Tue, 10 Mar 2026 11:02:36 +0000 Subject: [PATCH 09/18] aptos: keep TxStatus submit API in minimal read split (cherry picked from commit 1a13fdce49299f2c808538e2afc1630292c2a6fa) --- pkg/chains/aptos/aptos.pb.go | 767 ++++++++---------- pkg/chains/aptos/aptos.proto | 77 +- pkg/chains/aptos/aptos_grpc.pb.go | 70 +- pkg/chains/aptos/proto_helpers.go | 232 ++---- pkg/chains/aptos/proto_helpers_test.go | 176 +++- pkg/loop/internal/relayer/aptos.go | 66 +- pkg/loop/internal/relayerset/aptos.go | 67 +- .../internal/relayerset/relayerset_test.go | 147 +++- pkg/types/chains/aptos/aptos.go | 94 ++- pkg/types/mocks/aptos_service.go | 61 +- 10 files changed, 941 insertions(+), 816 deletions(-) diff --git a/pkg/chains/aptos/aptos.pb.go b/pkg/chains/aptos/aptos.pb.go index 2ffbc2a29..39e314834 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 v5.27.3 // source: aptos.proto package aptos @@ -21,79 +21,79 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -type TypeTagType int32 +type TypeTagKind int32 const ( - 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 + 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 TypeTagType. +// Enum value maps for TypeTagKind. var ( - 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, + 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 TypeTagType) Enum() *TypeTagType { - p := new(TypeTagType) +func (x TypeTagKind) Enum() *TypeTagKind { + p := new(TypeTagKind) *p = x return p } -func (x TypeTagType) String() string { +func (x TypeTagKind) String() string { return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } -func (TypeTagType) Descriptor() protoreflect.EnumDescriptor { +func (TypeTagKind) Descriptor() protoreflect.EnumDescriptor { return file_aptos_proto_enumTypes[0].Descriptor() } -func (TypeTagType) Type() protoreflect.EnumType { +func (TypeTagKind) Type() protoreflect.EnumType { return &file_aptos_proto_enumTypes[0] } -func (x TypeTagType) Number() protoreflect.EnumNumber { +func (x TypeTagKind) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } -// Deprecated: Use TypeTagType.Descriptor instead. -func (TypeTagType) EnumDescriptor() ([]byte, []int) { +// Deprecated: Use TypeTagKind.Descriptor instead. +func (TypeTagKind) EnumDescriptor() ([]byte, []int) { return file_aptos_proto_rawDescGZIP(), []int{0} } @@ -161,6 +161,55 @@ func (TransactionVariant) EnumDescriptor() ([]byte, []int) { return file_aptos_proto_rawDescGZIP(), []int{1} } +type TxStatus int32 + +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 +) + +// 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 TxStatus) Enum() *TxStatus { + p := new(TxStatus) + *p = x + return p +} + +func (x TxStatus) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (TxStatus) Descriptor() protoreflect.EnumDescriptor { + return file_aptos_proto_enumTypes[2].Descriptor() +} + +func (TxStatus) Type() protoreflect.EnumType { + return &file_aptos_proto_enumTypes[2] +} + +func (x TxStatus) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use TxStatus.Descriptor instead. +func (TxStatus) EnumDescriptor() ([]byte, []int) { + return file_aptos_proto_rawDescGZIP(), []int{2} +} + type LedgerVersionRequest struct { state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields @@ -329,110 +378,6 @@ 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"` @@ -443,7 +388,7 @@ type ViewRequest struct { func (x *ViewRequest) Reset() { *x = ViewRequest{} - mi := &file_aptos_proto_msgTypes[6] + mi := &file_aptos_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -455,7 +400,7 @@ func (x *ViewRequest) String() string { func (*ViewRequest) ProtoMessage() {} func (x *ViewRequest) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[6] + mi := &file_aptos_proto_msgTypes[4] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -468,7 +413,7 @@ func (x *ViewRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ViewRequest.ProtoReflect.Descriptor instead. func (*ViewRequest) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{6} + return file_aptos_proto_rawDescGZIP(), []int{4} } func (x *ViewRequest) GetPayload() *ViewPayload { @@ -494,7 +439,7 @@ type ViewReply struct { func (x *ViewReply) Reset() { *x = ViewReply{} - mi := &file_aptos_proto_msgTypes[7] + mi := &file_aptos_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -506,7 +451,7 @@ func (x *ViewReply) String() string { func (*ViewReply) ProtoMessage() {} func (x *ViewReply) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[7] + mi := &file_aptos_proto_msgTypes[5] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -519,7 +464,7 @@ func (x *ViewReply) ProtoReflect() protoreflect.Message { // Deprecated: Use ViewReply.ProtoReflect.Descriptor instead. func (*ViewReply) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{7} + return file_aptos_proto_rawDescGZIP(), []int{5} } func (x *ViewReply) GetData() []byte { @@ -541,7 +486,7 @@ type ViewPayload struct { func (x *ViewPayload) Reset() { *x = ViewPayload{} - mi := &file_aptos_proto_msgTypes[8] + mi := &file_aptos_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -553,7 +498,7 @@ func (x *ViewPayload) String() string { func (*ViewPayload) ProtoMessage() {} func (x *ViewPayload) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[8] + mi := &file_aptos_proto_msgTypes[6] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -566,7 +511,7 @@ func (x *ViewPayload) ProtoReflect() protoreflect.Message { // Deprecated: Use ViewPayload.ProtoReflect.Descriptor instead. func (*ViewPayload) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{8} + return file_aptos_proto_rawDescGZIP(), []int{6} } func (x *ViewPayload) GetModule() *ModuleID { @@ -607,7 +552,7 @@ type ModuleID struct { func (x *ModuleID) Reset() { *x = ModuleID{} - mi := &file_aptos_proto_msgTypes[9] + mi := &file_aptos_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -619,7 +564,7 @@ func (x *ModuleID) String() string { func (*ModuleID) ProtoMessage() {} func (x *ModuleID) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[9] + mi := &file_aptos_proto_msgTypes[7] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -632,7 +577,7 @@ func (x *ModuleID) ProtoReflect() protoreflect.Message { // Deprecated: Use ModuleID.ProtoReflect.Descriptor instead. func (*ModuleID) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{9} + return file_aptos_proto_rawDescGZIP(), []int{7} } func (x *ModuleID) GetAddress() []byte { @@ -651,7 +596,7 @@ func (x *ModuleID) GetName() string { type TypeTag struct { state protoimpl.MessageState `protogen:"open.v1"` - Type TypeTagType `protobuf:"varint,1,opt,name=type,proto3,enum=loop.aptos.TypeTagType" json:"type,omitempty"` + Kind TypeTagKind `protobuf:"varint,1,opt,name=kind,proto3,enum=loop.aptos.TypeTagKind" json:"kind,omitempty"` // Types that are valid to be assigned to Value: // // *TypeTag_Vector @@ -664,7 +609,7 @@ type TypeTag struct { func (x *TypeTag) Reset() { *x = TypeTag{} - mi := &file_aptos_proto_msgTypes[10] + mi := &file_aptos_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -676,7 +621,7 @@ func (x *TypeTag) String() string { func (*TypeTag) ProtoMessage() {} func (x *TypeTag) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[10] + mi := &file_aptos_proto_msgTypes[8] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -689,14 +634,14 @@ func (x *TypeTag) ProtoReflect() protoreflect.Message { // Deprecated: Use TypeTag.ProtoReflect.Descriptor instead. func (*TypeTag) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{10} + return file_aptos_proto_rawDescGZIP(), []int{8} } -func (x *TypeTag) GetType() TypeTagType { +func (x *TypeTag) GetKind() TypeTagKind { if x != nil { - return x.Type + return x.Kind } - return TypeTagType_TYPE_TAG_BOOL + return TypeTagKind_TYPE_TAG_KIND_BOOL } func (x *TypeTag) GetValue() isTypeTag_Value { @@ -764,7 +709,7 @@ type VectorTag struct { func (x *VectorTag) Reset() { *x = VectorTag{} - mi := &file_aptos_proto_msgTypes[11] + mi := &file_aptos_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -776,7 +721,7 @@ func (x *VectorTag) String() string { func (*VectorTag) ProtoMessage() {} func (x *VectorTag) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[11] + mi := &file_aptos_proto_msgTypes[9] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -789,7 +734,7 @@ func (x *VectorTag) ProtoReflect() protoreflect.Message { // Deprecated: Use VectorTag.ProtoReflect.Descriptor instead. func (*VectorTag) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{11} + return file_aptos_proto_rawDescGZIP(), []int{9} } func (x *VectorTag) GetElementType() *TypeTag { @@ -811,7 +756,7 @@ type StructTag struct { func (x *StructTag) Reset() { *x = StructTag{} - mi := &file_aptos_proto_msgTypes[12] + mi := &file_aptos_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -823,7 +768,7 @@ func (x *StructTag) String() string { func (*StructTag) ProtoMessage() {} func (x *StructTag) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[12] + mi := &file_aptos_proto_msgTypes[10] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -836,7 +781,7 @@ func (x *StructTag) ProtoReflect() protoreflect.Message { // Deprecated: Use StructTag.ProtoReflect.Descriptor instead. func (*StructTag) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{12} + return file_aptos_proto_rawDescGZIP(), []int{10} } func (x *StructTag) GetAddress() []byte { @@ -876,7 +821,7 @@ type GenericTag struct { func (x *GenericTag) Reset() { *x = GenericTag{} - mi := &file_aptos_proto_msgTypes[13] + mi := &file_aptos_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -888,7 +833,7 @@ func (x *GenericTag) String() string { func (*GenericTag) ProtoMessage() {} func (x *GenericTag) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[13] + mi := &file_aptos_proto_msgTypes[11] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -901,7 +846,7 @@ func (x *GenericTag) ProtoReflect() protoreflect.Message { // Deprecated: Use GenericTag.ProtoReflect.Descriptor instead. func (*GenericTag) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{13} + return file_aptos_proto_rawDescGZIP(), []int{11} } func (x *GenericTag) GetIndex() uint32 { @@ -920,7 +865,7 @@ type TransactionByHashRequest struct { func (x *TransactionByHashRequest) Reset() { *x = TransactionByHashRequest{} - mi := &file_aptos_proto_msgTypes[14] + mi := &file_aptos_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -932,7 +877,7 @@ func (x *TransactionByHashRequest) String() string { func (*TransactionByHashRequest) ProtoMessage() {} func (x *TransactionByHashRequest) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[14] + mi := &file_aptos_proto_msgTypes[12] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -945,7 +890,7 @@ func (x *TransactionByHashRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use TransactionByHashRequest.ProtoReflect.Descriptor instead. func (*TransactionByHashRequest) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{14} + return file_aptos_proto_rawDescGZIP(), []int{12} } func (x *TransactionByHashRequest) GetHash() string { @@ -964,7 +909,7 @@ type TransactionByHashReply struct { func (x *TransactionByHashReply) Reset() { *x = TransactionByHashReply{} - mi := &file_aptos_proto_msgTypes[15] + mi := &file_aptos_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -976,7 +921,7 @@ func (x *TransactionByHashReply) String() string { func (*TransactionByHashReply) ProtoMessage() {} func (x *TransactionByHashReply) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[15] + mi := &file_aptos_proto_msgTypes[13] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -989,7 +934,7 @@ func (x *TransactionByHashReply) ProtoReflect() protoreflect.Message { // Deprecated: Use TransactionByHashReply.ProtoReflect.Descriptor instead. func (*TransactionByHashReply) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{15} + return file_aptos_proto_rawDescGZIP(), []int{13} } func (x *TransactionByHashReply) GetTransaction() *Transaction { @@ -1012,7 +957,7 @@ type Transaction struct { func (x *Transaction) Reset() { *x = Transaction{} - mi := &file_aptos_proto_msgTypes[16] + mi := &file_aptos_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1024,7 +969,7 @@ func (x *Transaction) String() string { func (*Transaction) ProtoMessage() {} func (x *Transaction) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[16] + mi := &file_aptos_proto_msgTypes[14] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1037,7 +982,7 @@ func (x *Transaction) ProtoReflect() protoreflect.Message { // Deprecated: Use Transaction.ProtoReflect.Descriptor instead. func (*Transaction) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{16} + return file_aptos_proto_rawDescGZIP(), []int{14} } func (x *Transaction) GetType() TransactionVariant { @@ -1075,6 +1020,110 @@ func (x *Transaction) GetData() []byte { 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_aptos_proto_msgTypes[15] + 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[15] + 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{15} +} + +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[16] + 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[16] + 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{16} +} + +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"` @@ -1136,10 +1185,12 @@ func (x *SubmitTransactionRequest) GetGasConfig() *GasConfig { } type SubmitTransactionReply struct { - 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 + 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 } func (x *SubmitTransactionReply) Reset() { @@ -1172,11 +1223,25 @@ func (*SubmitTransactionReply) Descriptor() ([]byte, []int) { return file_aptos_proto_rawDescGZIP(), []int{18} } -func (x *SubmitTransactionReply) GetPendingTransaction() *PendingTransaction { +func (x *SubmitTransactionReply) GetTxStatus() TxStatus { if x != nil { - return x.PendingTransaction + return x.TxStatus } - return nil + 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 "" } type GasConfig struct { @@ -1231,114 +1296,6 @@ 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[20] - 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[20] - 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{20} -} - -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 = "" + @@ -1351,15 +1308,7 @@ const file_aptos_proto_rawDesc = "" + "\x18AccountAPTBalanceRequest\x12\x18\n" + "\aaddress\x18\x01 \x01(\fR\aaddress\".\n" + "\x16AccountAPTBalanceReply\x12\x14\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" + + "\x05value\x18\x01 \x01(\x04R\x05value\"\x7f\n" + "\vViewRequest\x121\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" + @@ -1375,7 +1324,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" + - "\x04type\x18\x01 \x01(\x0e2\x17.loop.aptos.TypeTagTypeR\x04type\x12/\n" + + "\x04kind\x18\x01 \x01(\x0e2\x17.loop.aptos.TypeTagKindR\x04kind\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" + @@ -1405,44 +1354,42 @@ const file_aptos_proto_rawDesc = "" + "\n" + "\b_versionB\n" + "\n" + - "\b_success\"\xd1\x01\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" + "\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\"\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" + + "\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" + "\tGasConfig\x12$\n" + "\x0emax_gas_amount\x18\x01 \x01(\x04R\fmaxGasAmount\x12$\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" + + "\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" + "\x12TransactionVariant\x12\x1f\n" + "\x1bTRANSACTION_VARIANT_PENDING\x10\x00\x12\x1c\n" + "\x18TRANSACTION_VARIANT_USER\x10\x01\x12\x1f\n" + @@ -1451,13 +1398,17 @@ 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\a2\x94\x04\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\x94\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" + + "\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\x12]\n" + + "\x11TransactionByHash\x12$.loop.aptos.TransactionByHashRequest\x1a\".loop.aptos.TransactionByHashReply\x12c\n" + + "\x13AccountTransactions\x12&.loop.aptos.AccountTransactionsRequest\x1a$.loop.aptos.AccountTransactionsReply\x12]\n" + "\x11SubmitTransaction\x12$.loop.aptos.SubmitTransactionRequest\x1a\".loop.aptos.SubmitTransactionReplyB?Z=github.com/smartcontractkit/chainlink-common/pkg/chains/aptosb\x06proto3" var ( @@ -1472,61 +1423,61 @@ func file_aptos_proto_rawDescGZIP() []byte { return file_aptos_proto_rawDescData } -var file_aptos_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_aptos_proto_msgTypes = make([]protoimpl.MessageInfo, 21) +var file_aptos_proto_enumTypes = make([]protoimpl.EnumInfo, 3) +var file_aptos_proto_msgTypes = make([]protoimpl.MessageInfo, 20) var file_aptos_proto_goTypes = []any{ - (TypeTagType)(0), // 0: loop.aptos.TypeTagType + (TypeTagKind)(0), // 0: loop.aptos.TypeTagKind (TransactionVariant)(0), // 1: loop.aptos.TransactionVariant - (*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 - (*TransactionByHashRequest)(nil), // 16: loop.aptos.TransactionByHashRequest - (*TransactionByHashReply)(nil), // 17: loop.aptos.TransactionByHashReply - (*Transaction)(nil), // 18: loop.aptos.Transaction - (*SubmitTransactionRequest)(nil), // 19: loop.aptos.SubmitTransactionRequest - (*SubmitTransactionReply)(nil), // 20: loop.aptos.SubmitTransactionReply - (*GasConfig)(nil), // 21: loop.aptos.GasConfig - (*PendingTransaction)(nil), // 22: loop.aptos.PendingTransaction + (TxStatus)(0), // 2: loop.aptos.TxStatus + (*LedgerVersionRequest)(nil), // 3: loop.aptos.LedgerVersionRequest + (*LedgerVersionReply)(nil), // 4: loop.aptos.LedgerVersionReply + (*AccountAPTBalanceRequest)(nil), // 5: loop.aptos.AccountAPTBalanceRequest + (*AccountAPTBalanceReply)(nil), // 6: loop.aptos.AccountAPTBalanceReply + (*ViewRequest)(nil), // 7: loop.aptos.ViewRequest + (*ViewReply)(nil), // 8: loop.aptos.ViewReply + (*ViewPayload)(nil), // 9: loop.aptos.ViewPayload + (*ModuleID)(nil), // 10: loop.aptos.ModuleID + (*TypeTag)(nil), // 11: loop.aptos.TypeTag + (*VectorTag)(nil), // 12: loop.aptos.VectorTag + (*StructTag)(nil), // 13: loop.aptos.StructTag + (*GenericTag)(nil), // 14: loop.aptos.GenericTag + (*TransactionByHashRequest)(nil), // 15: loop.aptos.TransactionByHashRequest + (*TransactionByHashReply)(nil), // 16: loop.aptos.TransactionByHashReply + (*Transaction)(nil), // 17: loop.aptos.Transaction + (*AccountTransactionsRequest)(nil), // 18: loop.aptos.AccountTransactionsRequest + (*AccountTransactionsReply)(nil), // 19: loop.aptos.AccountTransactionsReply + (*SubmitTransactionRequest)(nil), // 20: loop.aptos.SubmitTransactionRequest + (*SubmitTransactionReply)(nil), // 21: loop.aptos.SubmitTransactionReply + (*GasConfig)(nil), // 22: loop.aptos.GasConfig } var file_aptos_proto_depIdxs = []int32{ - 18, // 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.TransactionByHashReply.transaction:type_name -> loop.aptos.Transaction - 1, // 11: loop.aptos.Transaction.type:type_name -> loop.aptos.TransactionVariant - 11, // 12: loop.aptos.SubmitTransactionRequest.receiver_module_id:type_name -> loop.aptos.ModuleID - 21, // 13: loop.aptos.SubmitTransactionRequest.gas_config:type_name -> loop.aptos.GasConfig - 22, // 14: loop.aptos.SubmitTransactionReply.pending_transaction:type_name -> loop.aptos.PendingTransaction - 2, // 15: loop.aptos.Aptos.LedgerVersion:input_type -> loop.aptos.LedgerVersionRequest - 4, // 16: loop.aptos.Aptos.AccountAPTBalance:input_type -> loop.aptos.AccountAPTBalanceRequest - 6, // 17: loop.aptos.Aptos.AccountTransactions:input_type -> loop.aptos.AccountTransactionsRequest - 8, // 18: loop.aptos.Aptos.View:input_type -> loop.aptos.ViewRequest - 16, // 19: loop.aptos.Aptos.TransactionByHash:input_type -> loop.aptos.TransactionByHashRequest - 19, // 20: loop.aptos.Aptos.SubmitTransaction:input_type -> loop.aptos.SubmitTransactionRequest - 3, // 21: loop.aptos.Aptos.LedgerVersion:output_type -> loop.aptos.LedgerVersionReply - 5, // 22: loop.aptos.Aptos.AccountAPTBalance:output_type -> loop.aptos.AccountAPTBalanceReply - 7, // 23: loop.aptos.Aptos.AccountTransactions:output_type -> loop.aptos.AccountTransactionsReply - 9, // 24: loop.aptos.Aptos.View:output_type -> loop.aptos.ViewReply - 17, // 25: loop.aptos.Aptos.TransactionByHash:output_type -> loop.aptos.TransactionByHashReply - 20, // 26: loop.aptos.Aptos.SubmitTransaction:output_type -> loop.aptos.SubmitTransactionReply + 9, // 0: loop.aptos.ViewRequest.payload:type_name -> loop.aptos.ViewPayload + 10, // 1: loop.aptos.ViewPayload.module:type_name -> loop.aptos.ModuleID + 11, // 2: loop.aptos.ViewPayload.arg_types:type_name -> loop.aptos.TypeTag + 0, // 3: loop.aptos.TypeTag.kind:type_name -> loop.aptos.TypeTagKind + 12, // 4: loop.aptos.TypeTag.vector:type_name -> loop.aptos.VectorTag + 13, // 5: loop.aptos.TypeTag.struct:type_name -> loop.aptos.StructTag + 14, // 6: loop.aptos.TypeTag.generic:type_name -> loop.aptos.GenericTag + 11, // 7: loop.aptos.VectorTag.element_type:type_name -> loop.aptos.TypeTag + 11, // 8: loop.aptos.StructTag.type_params:type_name -> loop.aptos.TypeTag + 17, // 9: loop.aptos.TransactionByHashReply.transaction:type_name -> loop.aptos.Transaction + 1, // 10: loop.aptos.Transaction.type:type_name -> loop.aptos.TransactionVariant + 17, // 11: loop.aptos.AccountTransactionsReply.transactions:type_name -> loop.aptos.Transaction + 10, // 12: loop.aptos.SubmitTransactionRequest.receiver_module_id:type_name -> loop.aptos.ModuleID + 22, // 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.LedgerVersion:input_type -> loop.aptos.LedgerVersionRequest + 5, // 16: loop.aptos.Aptos.AccountAPTBalance:input_type -> loop.aptos.AccountAPTBalanceRequest + 7, // 17: loop.aptos.Aptos.View:input_type -> loop.aptos.ViewRequest + 15, // 18: loop.aptos.Aptos.TransactionByHash:input_type -> loop.aptos.TransactionByHashRequest + 18, // 19: loop.aptos.Aptos.AccountTransactions:input_type -> loop.aptos.AccountTransactionsRequest + 20, // 20: loop.aptos.Aptos.SubmitTransaction:input_type -> loop.aptos.SubmitTransactionRequest + 4, // 21: loop.aptos.Aptos.LedgerVersion:output_type -> loop.aptos.LedgerVersionReply + 6, // 22: loop.aptos.Aptos.AccountAPTBalance:output_type -> loop.aptos.AccountAPTBalanceReply + 8, // 23: loop.aptos.Aptos.View:output_type -> loop.aptos.ViewReply + 16, // 24: loop.aptos.Aptos.TransactionByHash:output_type -> loop.aptos.TransactionByHashReply + 19, // 25: loop.aptos.Aptos.AccountTransactions:output_type -> loop.aptos.AccountTransactionsReply + 21, // 26: loop.aptos.Aptos.SubmitTransaction:output_type -> loop.aptos.SubmitTransactionReply 21, // [21:27] is the sub-list for method output_type 15, // [15:21] is the sub-list for method input_type 15, // [15:15] is the sub-list for extension type_name @@ -1540,24 +1491,22 @@ func file_aptos_proto_init() { return } file_aptos_proto_msgTypes[4].OneofWrappers = []any{} - file_aptos_proto_msgTypes[6].OneofWrappers = []any{} - file_aptos_proto_msgTypes[10].OneofWrappers = []any{ + file_aptos_proto_msgTypes[8].OneofWrappers = []any{ (*TypeTag_Vector)(nil), (*TypeTag_Struct)(nil), (*TypeTag_Generic)(nil), } + file_aptos_proto_msgTypes[13].OneofWrappers = []any{} + file_aptos_proto_msgTypes[14].OneofWrappers = []any{} file_aptos_proto_msgTypes[15].OneofWrappers = []any{} - file_aptos_proto_msgTypes[16].OneofWrappers = []any{} file_aptos_proto_msgTypes[17].OneofWrappers = []any{} - file_aptos_proto_msgTypes[18].OneofWrappers = []any{} - file_aptos_proto_msgTypes[20].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: 2, - NumMessages: 21, + NumEnums: 3, + NumMessages: 20, NumExtensions: 0, NumServices: 1, }, diff --git a/pkg/chains/aptos/aptos.proto b/pkg/chains/aptos/aptos.proto index 7c4ec42d8..d5a66072a 100644 --- a/pkg/chains/aptos/aptos.proto +++ b/pkg/chains/aptos/aptos.proto @@ -6,9 +6,9 @@ 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 TransactionByHash(TransactionByHashRequest) returns (TransactionByHashReply); + rpc AccountTransactions(AccountTransactionsRequest) returns (AccountTransactionsReply); rpc SubmitTransaction(SubmitTransactionRequest) returns (SubmitTransactionReply); } @@ -30,18 +30,6 @@ 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 { @@ -66,7 +54,7 @@ message ModuleID { } message TypeTag { - TypeTagType type = 1; + TypeTagKind kind = 1; oneof value { VectorTag vector = 2; StructTag struct = 3; @@ -74,19 +62,19 @@ message TypeTag { } } -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; +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; } message VectorTag { @@ -104,6 +92,7 @@ message GenericTag { uint32 index = 1; } + // ========== TransactionByHash ========== message TransactionByHashRequest { @@ -133,6 +122,18 @@ 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 { @@ -141,23 +142,19 @@ 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 { - optional PendingTransaction pending_transaction = 1; + TxStatus tx_status = 1; + string tx_hash = 2; + string tx_idempotency_key = 3; } message GasConfig { uint64 max_gas_amount = 1; // Maximum gas units willing to pay 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 cbb41d694..260e32b89 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 v5.27.3 // source: aptos.proto package aptos @@ -21,9 +21,9 @@ 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_TransactionByHash_FullMethodName = "/loop.aptos.Aptos/TransactionByHash" + Aptos_AccountTransactions_FullMethodName = "/loop.aptos.Aptos/AccountTransactions" Aptos_SubmitTransaction_FullMethodName = "/loop.aptos.Aptos/SubmitTransaction" ) @@ -33,9 +33,9 @@ const ( 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) 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) } @@ -67,30 +67,30 @@ 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) { +func (c *aptosClient) View(ctx context.Context, in *ViewRequest, opts ...grpc.CallOption) (*ViewReply, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(AccountTransactionsReply) - err := c.cc.Invoke(ctx, Aptos_AccountTransactions_FullMethodName, in, out, cOpts...) + out := new(ViewReply) + err := c.cc.Invoke(ctx, Aptos_View_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) { +func (c *aptosClient) TransactionByHash(ctx context.Context, in *TransactionByHashRequest, opts ...grpc.CallOption) (*TransactionByHashReply, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(ViewReply) - err := c.cc.Invoke(ctx, Aptos_View_FullMethodName, in, out, cOpts...) + out := new(TransactionByHashReply) + err := c.cc.Invoke(ctx, Aptos_TransactionByHash_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *aptosClient) TransactionByHash(ctx context.Context, in *TransactionByHashRequest, opts ...grpc.CallOption) (*TransactionByHashReply, error) { +func (c *aptosClient) AccountTransactions(ctx context.Context, in *AccountTransactionsRequest, opts ...grpc.CallOption) (*AccountTransactionsReply, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(TransactionByHashReply) - err := c.cc.Invoke(ctx, Aptos_TransactionByHash_FullMethodName, in, out, cOpts...) + out := new(AccountTransactionsReply) + err := c.cc.Invoke(ctx, Aptos_AccountTransactions_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -113,9 +113,9 @@ func (c *aptosClient) SubmitTransaction(ctx context.Context, in *SubmitTransacti 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) TransactionByHash(context.Context, *TransactionByHashRequest) (*TransactionByHashReply, error) + AccountTransactions(context.Context, *AccountTransactionsRequest) (*AccountTransactionsReply, error) SubmitTransaction(context.Context, *SubmitTransactionRequest) (*SubmitTransactionReply, error) mustEmbedUnimplementedAptosServer() } @@ -133,15 +133,15 @@ func (UnimplementedAptosServer) LedgerVersion(context.Context, *LedgerVersionReq func (UnimplementedAptosServer) AccountAPTBalance(context.Context, *AccountAPTBalanceRequest) (*AccountAPTBalanceReply, error) { return nil, status.Errorf(codes.Unimplemented, "method AccountAPTBalance not implemented") } -func (UnimplementedAptosServer) AccountTransactions(context.Context, *AccountTransactionsRequest) (*AccountTransactionsReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method AccountTransactions not implemented") -} func (UnimplementedAptosServer) View(context.Context, *ViewRequest) (*ViewReply, error) { return nil, status.Errorf(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) AccountTransactions(context.Context, *AccountTransactionsRequest) (*AccountTransactionsReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method AccountTransactions not implemented") +} func (UnimplementedAptosServer) SubmitTransaction(context.Context, *SubmitTransactionRequest) (*SubmitTransactionReply, error) { return nil, status.Errorf(codes.Unimplemented, "method SubmitTransaction not implemented") } @@ -202,56 +202,56 @@ 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) +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 { return nil, err } if interceptor == nil { - return srv.(AptosServer).AccountTransactions(ctx, in) + return srv.(AptosServer).View(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Aptos_AccountTransactions_FullMethodName, + FullMethod: Aptos_View_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AptosServer).AccountTransactions(ctx, req.(*AccountTransactionsRequest)) + return srv.(AptosServer).View(ctx, req.(*ViewRequest)) } 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) +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).View(ctx, in) + return srv.(AptosServer).TransactionByHash(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Aptos_View_FullMethodName, + FullMethod: Aptos_TransactionByHash_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AptosServer).View(ctx, req.(*ViewRequest)) + return srv.(AptosServer).TransactionByHash(ctx, req.(*TransactionByHashRequest)) } 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_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).TransactionByHash(ctx, in) + return srv.(AptosServer).AccountTransactions(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Aptos_TransactionByHash_FullMethodName, + FullMethod: Aptos_AccountTransactions_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AptosServer).TransactionByHash(ctx, req.(*TransactionByHashRequest)) + return srv.(AptosServer).AccountTransactions(ctx, req.(*AccountTransactionsRequest)) } return interceptor(ctx, in, info, handler) } @@ -289,10 +289,6 @@ var Aptos_ServiceDesc = grpc.ServiceDesc{ MethodName: "AccountAPTBalance", Handler: _Aptos_AccountAPTBalance_Handler, }, - { - MethodName: "AccountTransactions", - Handler: _Aptos_AccountTransactions_Handler, - }, { MethodName: "View", Handler: _Aptos_View_Handler, @@ -301,6 +297,10 @@ var Aptos_ServiceDesc = grpc.ServiceDesc{ MethodName: "TransactionByHash", Handler: _Aptos_TransactionByHash_Handler, }, + { + MethodName: "AccountTransactions", + Handler: _Aptos_AccountTransactions_Handler, + }, { MethodName: "SubmitTransaction", Handler: _Aptos_SubmitTransaction_Handler, diff --git a/pkg/chains/aptos/proto_helpers.go b/pkg/chains/aptos/proto_helpers.go index 9d4cb92a3..ce1573a0f 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.Type { - case TypeTagType_TYPE_TAG_BOOL: + switch proto.Kind { + case TypeTagKind_TYPE_TAG_KIND_BOOL: impl = typeaptos.BoolTag{} - case TypeTagType_TYPE_TAG_U8: + case TypeTagKind_TYPE_TAG_KIND_U8: impl = typeaptos.U8Tag{} - case TypeTagType_TYPE_TAG_U16: + case TypeTagKind_TYPE_TAG_KIND_U16: impl = typeaptos.U16Tag{} - case TypeTagType_TYPE_TAG_U32: + case TypeTagKind_TYPE_TAG_KIND_U32: impl = typeaptos.U32Tag{} - case TypeTagType_TYPE_TAG_U64: + case TypeTagKind_TYPE_TAG_KIND_U64: impl = typeaptos.U64Tag{} - case TypeTagType_TYPE_TAG_U128: + case TypeTagKind_TYPE_TAG_KIND_U128: impl = typeaptos.U128Tag{} - case TypeTagType_TYPE_TAG_U256: + case TypeTagKind_TYPE_TAG_KIND_U256: impl = typeaptos.U256Tag{} - case TypeTagType_TYPE_TAG_ADDRESS: + case TypeTagKind_TYPE_TAG_KIND_ADDRESS: impl = typeaptos.AddressTag{} - case TypeTagType_TYPE_TAG_SIGNER: + case TypeTagKind_TYPE_TAG_KIND_SIGNER: impl = typeaptos.SignerTag{} - case TypeTagType_TYPE_TAG_VECTOR: + case TypeTagKind_TYPE_TAG_KIND_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 TypeTagType_TYPE_TAG_STRUCT: + case TypeTagKind_TYPE_TAG_KIND_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 TypeTagType_TYPE_TAG_GENERIC: + case TypeTagKind_TYPE_TAG_KIND_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 type: %v", proto.Type) + return nil, fmt.Errorf("unknown type tag kind: %v", proto.Kind) } return &typeaptos.TypeTag{ @@ -167,7 +167,7 @@ func ConvertTypeTagToProto(tag *typeaptos.TypeTag) (*TypeTag, error) { } protoTag := &TypeTag{ - Type: TypeTagType(tag.Value.TypeTagType()), + Kind: TypeTagKind(tag.Value.TypeTagKind()), } switch v := tag.Value.(type) { @@ -234,67 +234,6 @@ func ConvertViewReplyToProto(reply *typeaptos.ViewReply) (*ViewReply, error) { // ========== 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, @@ -421,6 +360,62 @@ 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) { @@ -481,17 +476,11 @@ func ConvertSubmitTransactionReplyToProto(reply *typeaptos.SubmitTransactionRepl return nil, fmt.Errorf("reply is 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 + return &SubmitTransactionReply{ + TxStatus: TxStatus(reply.TxStatus), + TxHash: reply.TxHash, + TxIdempotencyKey: reply.TxIdempotencyKey, + }, nil } func ConvertSubmitTransactionReplyFromProto(proto *SubmitTransactionReply) (*typeaptos.SubmitTransactionReply, error) { @@ -499,68 +488,9 @@ func ConvertSubmitTransactionReplyFromProto(proto *SubmitTransactionReply) (*typ return nil, fmt.Errorf("proto reply is 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 + return &typeaptos.SubmitTransactionReply{ + TxStatus: typeaptos.TransactionStatus(proto.TxStatus), + TxHash: proto.TxHash, + TxIdempotencyKey: proto.TxIdempotencyKey, + }, nil } diff --git a/pkg/chains/aptos/proto_helpers_test.go b/pkg/chains/aptos/proto_helpers_test.go index 99c7c0535..7dc916b9a 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.TypeTagType(), roundtrip.Value.TypeTagType()) + require.Equal(t, tag.Value.TypeTagKind(), roundtrip.Value.TypeTagKind()) } }) @@ -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.TypeTagType()) + require.Equal(t, typeaptos.TypeTagU64, vec.ElementType.Value.TypeTagKind()) }) 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{ - Type: conv.TypeTagType_TYPE_TAG_STRUCT, + Kind: conv.TypeTagKind_TYPE_TAG_KIND_STRUCT, Value: &conv.TypeTag_Struct{ Struct: &conv.StructTag{ Address: mkBytes(typeaptos.AccountAddressLength-1, 0x01), @@ -303,35 +303,24 @@ func TestSubmitTransactionConverters(t *testing.T) { require.Nil(t, roundtrip.GasConfig) }) - 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}, + t.Run("SubmitTransactionReply roundtrip", func(t *testing.T) { + reply := &typeaptos.SubmitTransactionReply{ + TxStatus: typeaptos.TxSuccess, + TxHash: "0xabc123", + TxIdempotencyKey: "key-456", } - protoTx, err := conv.ConvertPendingTransactionToProto(tx) + protoReply, err := conv.ConvertSubmitTransactionReplyToProto(reply) require.NoError(t, err) - 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) + require.Equal(t, conv.TxStatus(typeaptos.TxSuccess), protoReply.TxStatus) + require.Equal(t, "0xabc123", protoReply.TxHash) + require.Equal(t, "key-456", protoReply.TxIdempotencyKey) - roundtrip, err := conv.ConvertPendingTransactionFromProto(protoTx) + roundtrip, err := conv.ConvertSubmitTransactionReplyFromProto(protoReply) require.NoError(t, err) - 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) + require.Equal(t, reply.TxStatus, roundtrip.TxStatus) + require.Equal(t, reply.TxHash, roundtrip.TxHash) + require.Equal(t, reply.TxIdempotencyKey, roundtrip.TxIdempotencyKey) }) t.Run("Invalid request errors", func(t *testing.T) { @@ -371,6 +360,127 @@ func TestErrorJoinBehavior(t *testing.T) { }) } +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, + } + + 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) + 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) + + roundtrip, err := conv.ConvertAccountTransactionsRequestFromProto(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") + }) + + 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}`), + }, + }, + } + + 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) + 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) + }) + + 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) + require.NoError(t, err) + require.Len(t, roundtrip.Transactions, 0) + }) + + 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 TestNilHandling(t *testing.T) { t.Run("ConvertTransactionToProto with nil", func(t *testing.T) { result := conv.ConvertTransactionToProto(nil) @@ -382,16 +492,4 @@ 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/relayer/aptos.go b/pkg/loop/internal/relayer/aptos.go index 0eb474057..6cd0ca731 100644 --- a/pkg/loop/internal/relayer/aptos.go +++ b/pkg/loop/internal/relayer/aptos.go @@ -4,9 +4,6 @@ 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" @@ -28,7 +25,7 @@ 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 0, net.WrapRPCErr(err) } return reply.LedgerVersion, nil } @@ -38,23 +35,13 @@ func (ac *AptosClient) AccountAPTBalance(ctx context.Context, req aptos.AccountA Address: req.Address[:], }) if err != nil { - return nil, err + return nil, net.WrapRPCErr(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) @@ -71,7 +58,7 @@ func (ac *AptosClient) View(ctx context.Context, req aptos.ViewRequest) (*aptos. reply, err := ac.grpcClient.View(ctx, protoReq) if err != nil { - return nil, err + return nil, net.WrapRPCErr(err) } // Convert proto types back to Go types @@ -82,11 +69,20 @@ func (ac *AptosClient) TransactionByHash(ctx context.Context, req aptos.Transact protoReq := aptospb.ConvertTransactionByHashRequestToProto(req) protoResp, err := ac.grpcClient.TransactionByHash(ctx, protoReq) if err != nil { - return nil, err + return nil, net.WrapRPCErr(err) } return aptospb.ConvertTransactionByHashReplyFromProto(protoResp) } +func (ac *AptosClient) AccountTransactions(ctx context.Context, req aptos.AccountTransactionsRequest) (*aptos.AccountTransactionsReply, error) { + protoReq := aptospb.ConvertAccountTransactionsRequestToProto(req) + protoResp, err := ac.grpcClient.AccountTransactions(ctx, protoReq) + if err != nil { + return nil, net.WrapRPCErr(err) + } + return aptospb.ConvertAccountTransactionsReplyFromProto(protoResp) +} + func (ac *AptosClient) SubmitTransaction(ctx context.Context, req aptos.SubmitTransactionRequest) (*aptos.SubmitTransactionReply, error) { protoReq, err := aptospb.ConvertSubmitTransactionRequestToProto(req) if err != nil { @@ -95,7 +91,7 @@ func (ac *AptosClient) SubmitTransaction(ctx context.Context, req aptos.SubmitTr protoResp, err := ac.grpcClient.SubmitTransaction(ctx, protoReq) if err != nil { - return nil, err + return nil, net.WrapRPCErr(err) } return aptospb.ConvertSubmitTransactionReplyFromProto(protoResp) @@ -111,10 +107,6 @@ 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")} } @@ -139,22 +131,6 @@ func (s *aptosServer) LedgerVersion(ctx context.Context, _ *aptospb.LedgerVersio 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) @@ -192,6 +168,20 @@ func (s *aptosServer) TransactionByHash(ctx context.Context, req *aptospb.Transa return aptospb.ConvertTransactionByHashReplyToProto(reply), nil } +func (s *aptosServer) AccountTransactions(ctx context.Context, req *aptospb.AccountTransactionsRequest) (*aptospb.AccountTransactionsReply, error) { + goReq, err := aptospb.ConvertAccountTransactionsRequestFromProto(req) + if err != nil { + return nil, fmt.Errorf("failed to convert request: %w", err) + } + + reply, err := s.impl.AccountTransactions(ctx, goReq) + if err != nil { + return nil, err + } + + return aptospb.ConvertAccountTransactionsReplyToProto(reply), nil +} + func (s *aptosServer) SubmitTransaction(ctx context.Context, req *aptospb.SubmitTransactionRequest) (*aptospb.SubmitTransactionReply, error) { goReq, err := aptospb.ConvertSubmitTransactionRequestFromProto(req) if err != nil { diff --git a/pkg/loop/internal/relayerset/aptos.go b/pkg/loop/internal/relayerset/aptos.go index 54dcd0b0d..ad65db60b 100644 --- a/pkg/loop/internal/relayerset/aptos.go +++ b/pkg/loop/internal/relayerset/aptos.go @@ -29,10 +29,6 @@ func (ac *aptosClient) AccountAPTBalance(ctx context.Context, in *aptospb.Accoun 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...) } @@ -41,6 +37,10 @@ func (ac *aptosClient) TransactionByHash(ctx context.Context, in *aptospb.Transa return ac.client.TransactionByHash(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) SubmitTransaction(ctx context.Context, in *aptospb.SubmitTransactionRequest, opts ...grpc.CallOption) (*aptospb.SubmitTransactionReply, error) { return ac.client.SubmitTransaction(appendRelayID(ctx, ac.relayID), in, opts...) } @@ -52,27 +52,6 @@ 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 { - return nil, err - } - - reply, err := aptosService.AccountAPTBalance(ctx, aptos.AccountAPTBalanceRequest{ - Address: aptos.AccountAddress(req.Address), - }) - if err != nil { - return nil, err - } - return &aptospb.AccountAPTBalanceReply{ - Value: reply.Value, - }, nil -} - func (as *aptosServer) LedgerVersion(ctx context.Context, _ *aptospb.LedgerVersionRequest) (*aptospb.LedgerVersionReply, error) { aptosService, err := as.parent.getAptosService(ctx) if err != nil { @@ -86,24 +65,21 @@ func (as *aptosServer) LedgerVersion(ctx context.Context, _ *aptospb.LedgerVersi return &aptospb.LedgerVersionReply{LedgerVersion: ledgerVersion}, nil } -func (as *aptosServer) AccountTransactions(ctx context.Context, req *aptospb.AccountTransactionsRequest) (*aptospb.AccountTransactionsReply, error) { +func (as *aptosServer) AccountAPTBalance(ctx context.Context, req *aptospb.AccountAPTBalanceRequest) (*aptospb.AccountAPTBalanceReply, 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) + + reply, err := aptosService.AccountAPTBalance(ctx, aptos.AccountAPTBalanceRequest{ + Address: aptos.AccountAddress(req.Address), + }) if err != nil { return nil, err } - return aptospb.ConvertAccountTransactionsReplyToProto(reply), nil + return &aptospb.AccountAPTBalanceReply{ + Value: reply.Value, + }, nil } func (as *aptosServer) View(ctx context.Context, req *aptospb.ViewRequest) (*aptospb.ViewReply, error) { @@ -153,6 +129,25 @@ func (as *aptosServer) TransactionByHash(ctx context.Context, req *aptospb.Trans return aptospb.ConvertTransactionByHashReplyToProto(reply), 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 + } + + goReq, err := aptospb.ConvertAccountTransactionsRequestFromProto(req) + if err != nil { + return nil, fmt.Errorf("failed to convert request: %w", err) + } + + reply, err := aptosService.AccountTransactions(ctx, goReq) + if err != nil { + return nil, err + } + + return aptospb.ConvertAccountTransactionsReplyToProto(reply), nil +} + func (as *aptosServer) SubmitTransaction(ctx context.Context, req *aptospb.SubmitTransactionRequest) (*aptospb.SubmitTransactionReply, error) { aptosService, err := as.parent.getAptosService(ctx) if err != nil { diff --git a/pkg/loop/internal/relayerset/relayerset_test.go b/pkg/loop/internal/relayerset/relayerset_test.go index cdac29424..9828d67c9 100644 --- a/pkg/loop/internal/relayerset/relayerset_test.go +++ b/pkg/loop/internal/relayerset/relayerset_test.go @@ -961,6 +961,17 @@ func Test_RelayerSet_AptosService(t *testing.T) { name string run func(t *testing.T, apt types.AptosService, mockApt *mocks2.AptosService) }{ + { + name: "LedgerVersion", + run: func(t *testing.T, apt types.AptosService, mockApt *mocks2.AptosService) { + expected := uint64(12345) + mockApt.EXPECT().LedgerVersion(mock.Anything).Return(expected, nil) + + version, err := apt.LedgerVersion(ctx) + require.NoError(t, err) + require.Equal(t, expected, version) + }, + }, { name: "AccountAPTBalance", run: func(t *testing.T, apt types.AptosService, mockApt *mocks2.AptosService) { @@ -1011,6 +1022,39 @@ func Test_RelayerSet_AptosService(t *testing.T) { require.Equal(t, expectedData, reply.Data) }, }, + { + name: "View with LedgerVersion", + run: func(t *testing.T, apt types.AptosService, mockApt *mocks2.AptosService) { + moduleAddr := aptos.AccountAddress{ + 0x01, 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, + } + ledgerVersion := uint64(987654) + req := aptos.ViewRequest{ + Payload: &aptos.ViewPayload{ + Module: aptos.ModuleID{ + Address: moduleAddr, + Name: "coin", + }, + Function: "balance", + ArgTypes: []aptos.TypeTag{ + {Value: aptos.AddressTag{}}, + }, + Args: [][]byte{{0x01, 0x02}}, + }, + LedgerVersion: &ledgerVersion, + } + expectedData := []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64} + mockApt.EXPECT().View(mock.Anything, req). + Return(&aptos.ViewReply{Data: expectedData}, nil) + + reply, err := apt.View(ctx, req) + require.NoError(t, err) + require.Equal(t, expectedData, reply.Data) + }, + }, { name: "TransactionByHash", run: func(t *testing.T, apt types.AptosService, mockApt *mocks2.AptosService) { @@ -1063,21 +1107,89 @@ func Test_RelayerSet_AptosService(t *testing.T) { }, }, { - name: "SubmitTransaction", + name: "AccountTransactions", run: func(t *testing.T, apt types.AptosService, mockApt *mocks2.AptosService) { - receiverAddr := aptos.AccountAddress{ - 0xBB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 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, } - senderAddr := aptos.AccountAddress{ - 0xCC, 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", + run: func(t *testing.T, apt types.AptosService, mockApt *mocks2.AptosService) { + address := aptos.AccountAddress{ + 0xFF, 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, 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, @@ -1090,28 +1202,19 @@ func Test_RelayerSet_AptosService(t *testing.T) { }, } expectedReply := &aptos.SubmitTransactionReply{ - 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}, - }, + TxStatus: aptos.TxSuccess, + TxHash: "0xtxhash123", + TxIdempotencyKey: "key-456", } mockApt.EXPECT().SubmitTransaction(mock.Anything, req). Return(expectedReply, nil) reply, err := apt.SubmitTransaction(ctx, req) require.NoError(t, err) - 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) + 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) }, }, } diff --git a/pkg/types/chains/aptos/aptos.go b/pkg/types/chains/aptos/aptos.go index e5970bbb8..a7a0c9736 100644 --- a/pkg/types/chains/aptos/aptos.go +++ b/pkg/types/chains/aptos/aptos.go @@ -18,6 +18,8 @@ type Client interface { View(ctx context.Context, req ViewRequest) (*ViewReply, 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,18 +32,6 @@ 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 { @@ -50,7 +40,7 @@ type ViewRequest struct { } type ViewReply struct { - Data []byte + Data []byte // this is marshaled JSON because the aptos rpc client returns JSON } // ViewPayload represents the payload for a view function call. @@ -76,15 +66,15 @@ type TypeTag struct { // TypeTagImpl is the interface for all type tag implementations. // Different type tags represent different Move types. type TypeTagImpl interface { - // TypeTagType returns the type discriminator for this type tag. - TypeTagType() TypeTagType + // TypeTagKind returns the type discriminator for this type tag. + TypeTagKind() TypeTagKind } -// TypeTagType is an enum for different type tag variants. -type TypeTagType uint8 +// TypeTagKind is an enum for different type tag variants. +type TypeTagKind uint8 const ( - TypeTagBool TypeTagType = iota + TypeTagBool TypeTagKind = iota TypeTagU8 TypeTagU16 TypeTagU32 @@ -103,54 +93,54 @@ const ( // BoolTag represents a boolean type. type BoolTag struct{} -func (BoolTag) TypeTagType() TypeTagType { return TypeTagBool } +func (BoolTag) TypeTagKind() TypeTagKind { return TypeTagBool } // U8Tag represents an unsigned 8-bit integer type. type U8Tag struct{} -func (U8Tag) TypeTagType() TypeTagType { return TypeTagU8 } +func (U8Tag) TypeTagKind() TypeTagKind { return TypeTagU8 } // U16Tag represents an unsigned 16-bit integer type. type U16Tag struct{} -func (U16Tag) TypeTagType() TypeTagType { return TypeTagU16 } +func (U16Tag) TypeTagKind() TypeTagKind { return TypeTagU16 } // U32Tag represents an unsigned 32-bit integer type. type U32Tag struct{} -func (U32Tag) TypeTagType() TypeTagType { return TypeTagU32 } +func (U32Tag) TypeTagKind() TypeTagKind { return TypeTagU32 } // U64Tag represents an unsigned 64-bit integer type. type U64Tag struct{} -func (U64Tag) TypeTagType() TypeTagType { return TypeTagU64 } +func (U64Tag) TypeTagKind() TypeTagKind { return TypeTagU64 } // U128Tag represents an unsigned 128-bit integer type. type U128Tag struct{} -func (U128Tag) TypeTagType() TypeTagType { return TypeTagU128 } +func (U128Tag) TypeTagKind() TypeTagKind { return TypeTagU128 } // U256Tag represents an unsigned 256-bit integer type. type U256Tag struct{} -func (U256Tag) TypeTagType() TypeTagType { return TypeTagU256 } +func (U256Tag) TypeTagKind() TypeTagKind { return TypeTagU256 } // AddressTag represents an account address type. type AddressTag struct{} -func (AddressTag) TypeTagType() TypeTagType { return TypeTagAddress } +func (AddressTag) TypeTagKind() TypeTagKind { return TypeTagAddress } // SignerTag represents a signer type. type SignerTag struct{} -func (SignerTag) TypeTagType() TypeTagType { return TypeTagSigner } +func (SignerTag) TypeTagKind() TypeTagKind { return TypeTagSigner } // VectorTag represents a vector type with an element type. type VectorTag struct { ElementType TypeTag } -func (VectorTag) TypeTagType() TypeTagType { return TypeTagVector } +func (VectorTag) TypeTagKind() TypeTagKind { return TypeTagVector } // StructTag represents a struct type with full type information. type StructTag struct { @@ -160,14 +150,14 @@ type StructTag struct { TypeParams []TypeTag } -func (StructTag) TypeTagType() TypeTagType { return TypeTagStruct } +func (StructTag) TypeTagKind() TypeTagKind { return TypeTagStruct } // GenericTag represents a generic type parameter (e.g., T in a generic function). type GenericTag struct { Index uint16 } -func (GenericTag) TypeTagType() TypeTagType { return TypeTagGeneric } +func (GenericTag) TypeTagKind() TypeTagKind { return TypeTagGeneric } // TransactionByHashRequest represents a request to get a transaction by hash type TransactionByHashRequest struct { @@ -202,14 +192,41 @@ 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 + ReceiverModuleID ModuleID // This can potentially be removed if the EncodedPayload is of type EntryFunction which has all the details 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 { - PendingTransaction *PendingTransaction + TxStatus TransactionStatus + TxHash string + TxIdempotencyKey string } // GasConfig represents gas configuration for a transaction @@ -217,16 +234,3 @@ 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 fad2130c8..0210ed481 100644 --- a/pkg/types/mocks/aptos_service.go +++ b/pkg/types/mocks/aptos_service.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.53.0. DO NOT EDIT. +// Code generated by mockery v2.53.3. DO NOT EDIT. package mocks @@ -138,6 +138,65 @@ func (_c *AptosService_LedgerVersion_Call) RunAndReturn(run func(context.Context 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) { + ret := _m.Called(ctx, req) + + if len(ret) == 0 { + panic("no return value specified for AccountTransactions") + } + + var r0 *aptos.AccountTransactionsReply + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, aptos.AccountTransactionsRequest) (*aptos.AccountTransactionsReply, error)); ok { + return rf(ctx, req) + } + if rf, ok := ret.Get(0).(func(context.Context, aptos.AccountTransactionsRequest) *aptos.AccountTransactionsReply); ok { + r0 = rf(ctx, req) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*aptos.AccountTransactionsReply) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, aptos.AccountTransactionsRequest) error); ok { + r1 = rf(ctx, req) + } else { + r1 = ret.Error(1) + } + + 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 { + *mock.Call +} + +// AccountTransactions 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)} +} + +func (_c *AptosService_AccountTransactions_Call) Run(run func(ctx context.Context, req aptos.AccountTransactionsRequest)) *AptosService_AccountTransactions_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(aptos.AccountTransactionsRequest)) + }) + return _c +} + +func (_c *AptosService_AccountTransactions_Call) Return(_a0 *aptos.AccountTransactionsReply, _a1 error) *AptosService_AccountTransactions_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 { + _c.Call.Return(run) + return _c +} + // SubmitTransaction provides a mock function with given fields: ctx, req func (_m *AptosService) SubmitTransaction(ctx context.Context, req aptos.SubmitTransactionRequest) (*aptos.SubmitTransactionReply, error) { ret := _m.Called(ctx, req) From fb12e471bfe23b1c62451af7173efb498243cbe6 Mon Sep 17 00:00:00 2001 From: cawthorne Date: Tue, 10 Mar 2026 11:42:38 +0000 Subject: [PATCH 10/18] chore: regenerate aptos proto and aptos service mock (cherry picked from commit e835cb9ab9a62edaa8a116ff289a797f4531a609) --- pkg/chains/aptos/aptos.pb.go | 2 +- pkg/chains/aptos/aptos_grpc.pb.go | 2 +- pkg/types/mocks/aptos_service.go | 90 +++++++++++++++---------------- 3 files changed, 47 insertions(+), 47 deletions(-) diff --git a/pkg/chains/aptos/aptos.pb.go b/pkg/chains/aptos/aptos.pb.go index 39e314834..1693ac17e 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.27.3 +// protoc v5.29.3 // source: aptos.proto package aptos diff --git a/pkg/chains/aptos/aptos_grpc.pb.go b/pkg/chains/aptos/aptos_grpc.pb.go index 260e32b89..1833254df 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.27.3 +// - protoc v5.29.3 // source: aptos.proto package aptos diff --git a/pkg/types/mocks/aptos_service.go b/pkg/types/mocks/aptos_service.go index 0210ed481..d8319ad26 100644 --- a/pkg/types/mocks/aptos_service.go +++ b/pkg/types/mocks/aptos_service.go @@ -82,27 +82,29 @@ func (_c *AptosService_AccountAPTBalance_Call) RunAndReturn(run func(context.Con return _c } -// LedgerVersion provides a mock function with given fields: ctx -func (_m *AptosService) LedgerVersion(ctx context.Context) (uint64, error) { - ret := _m.Called(ctx) +// AccountTransactions provides a mock function with given fields: ctx, req +func (_m *AptosService) AccountTransactions(ctx context.Context, req aptos.AccountTransactionsRequest) (*aptos.AccountTransactionsReply, error) { + ret := _m.Called(ctx, req) if len(ret) == 0 { - panic("no return value specified for LedgerVersion") + panic("no return value specified for AccountTransactions") } - var r0 uint64 + var r0 *aptos.AccountTransactionsReply 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, aptos.AccountTransactionsRequest) (*aptos.AccountTransactionsReply, error)); ok { + return rf(ctx, req) } - if rf, ok := ret.Get(0).(func(context.Context) uint64); ok { - r0 = rf(ctx) + if rf, ok := ret.Get(0).(func(context.Context, aptos.AccountTransactionsRequest) *aptos.AccountTransactionsReply); ok { + r0 = rf(ctx, req) } else { - r0 = ret.Get(0).(uint64) + if ret.Get(0) != nil { + r0 = ret.Get(0).(*aptos.AccountTransactionsReply) + } } - if rf, ok := ret.Get(1).(func(context.Context) error); ok { - r1 = rf(ctx) + if rf, ok := ret.Get(1).(func(context.Context, aptos.AccountTransactionsRequest) error); ok { + r1 = rf(ctx, req) } else { r1 = ret.Error(1) } @@ -110,57 +112,56 @@ func (_m *AptosService) LedgerVersion(ctx context.Context) (uint64, error) { 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 { +// AptosService_AccountTransactions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AccountTransactions' +type AptosService_AccountTransactions_Call struct { *mock.Call } -// LedgerVersion is a helper method to define mock.On call +// AccountTransactions 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)} +// - 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)} } -func (_c *AptosService_LedgerVersion_Call) Run(run func(ctx context.Context)) *AptosService_LedgerVersion_Call { +func (_c *AptosService_AccountTransactions_Call) Run(run func(ctx context.Context, req aptos.AccountTransactionsRequest)) *AptosService_AccountTransactions_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context)) + run(args[0].(context.Context), args[1].(aptos.AccountTransactionsRequest)) }) return _c } -func (_c *AptosService_LedgerVersion_Call) Return(_a0 uint64, _a1 error) *AptosService_LedgerVersion_Call { +func (_c *AptosService_AccountTransactions_Call) Return(_a0 *aptos.AccountTransactionsReply, _a1 error) *AptosService_AccountTransactions_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *AptosService_LedgerVersion_Call) RunAndReturn(run func(context.Context) (uint64, error)) *AptosService_LedgerVersion_Call { +func (_c *AptosService_AccountTransactions_Call) RunAndReturn(run func(context.Context, aptos.AccountTransactionsRequest) (*aptos.AccountTransactionsReply, error)) *AptosService_AccountTransactions_Call { _c.Call.Return(run) 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) { - ret := _m.Called(ctx, req) +// 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 AccountTransactions") + panic("no return value specified for LedgerVersion") } - var r0 *aptos.AccountTransactionsReply + var r0 uint64 var r1 error - if rf, ok := ret.Get(0).(func(context.Context, aptos.AccountTransactionsRequest) (*aptos.AccountTransactionsReply, error)); ok { - return rf(ctx, req) + if rf, ok := ret.Get(0).(func(context.Context) (uint64, error)); ok { + return rf(ctx) } - if rf, ok := ret.Get(0).(func(context.Context, aptos.AccountTransactionsRequest) *aptos.AccountTransactionsReply); ok { - r0 = rf(ctx, req) + if rf, ok := ret.Get(0).(func(context.Context) uint64); ok { + r0 = rf(ctx) } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*aptos.AccountTransactionsReply) - } + r0 = ret.Get(0).(uint64) } - if rf, ok := ret.Get(1).(func(context.Context, aptos.AccountTransactionsRequest) error); ok { - r1 = rf(ctx, req) + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(ctx) } else { r1 = ret.Error(1) } @@ -168,31 +169,30 @@ 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_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 } -// AccountTransactions is a helper method to define mock.On call +// LedgerVersion 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)} +func (_e *AptosService_Expecter) LedgerVersion(ctx interface{}) *AptosService_LedgerVersion_Call { + return &AptosService_LedgerVersion_Call{Call: _e.mock.On("LedgerVersion", ctx)} } -func (_c *AptosService_AccountTransactions_Call) Run(run func(ctx context.Context, req aptos.AccountTransactionsRequest)) *AptosService_AccountTransactions_Call { +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), args[1].(aptos.AccountTransactionsRequest)) + run(args[0].(context.Context)) }) return _c } -func (_c *AptosService_AccountTransactions_Call) Return(_a0 *aptos.AccountTransactionsReply, _a1 error) *AptosService_AccountTransactions_Call { +func (_c *AptosService_LedgerVersion_Call) Return(_a0 uint64, _a1 error) *AptosService_LedgerVersion_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_LedgerVersion_Call) RunAndReturn(run func(context.Context) (uint64, error)) *AptosService_LedgerVersion_Call { _c.Call.Return(run) return _c } From e0d6ea7248eda2f765426dcbe359a12295cd89ca Mon Sep 17 00:00:00 2001 From: cawthorne Date: Tue, 10 Mar 2026 12:49:33 +0000 Subject: [PATCH 11/18] capability: tighten transmitter hex decode and add tests (cherry picked from commit a2589e6520b04429ccb8a576d0bb22fc8d5b5bfa) --- .../capability/capabilities_registry.go | 15 +++++++++-- .../capability/capabilities_registry_test.go | 25 +++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/pkg/loop/internal/core/services/capability/capabilities_registry.go b/pkg/loop/internal/core/services/capability/capabilities_registry.go index 06c3affcf..6db7d3e3f 100644 --- a/pkg/loop/internal/core/services/capability/capabilities_registry.go +++ b/pkg/loop/internal/core/services/capability/capabilities_registry.go @@ -267,8 +267,11 @@ func transmitterAccountToBytes(account ocrtypes.Account) ([]byte, error) { return raw, nil } - trimmed := strings.TrimPrefix(strings.TrimPrefix(s, "0x"), "0X") - if looksHexAccount(trimmed) { + if strings.HasPrefix(s, "0x") || strings.HasPrefix(s, "0X") { + trimmed := s[2:] + if !looksHexAccount(trimmed) { + return nil, fmt.Errorf("failed to decode transmitter: invalid hex account %q", s) + } decoded, err := hex.DecodeString(trimmed) if err != nil { return nil, fmt.Errorf("failed to decode transmitter: %w", err) @@ -276,6 +279,14 @@ func transmitterAccountToBytes(account ocrtypes.Account) ([]byte, error) { return decoded, nil } + if looksHexAccount(s) { + decoded, err := hex.DecodeString(s) + 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 } diff --git a/pkg/loop/internal/core/services/capability/capabilities_registry_test.go b/pkg/loop/internal/core/services/capability/capabilities_registry_test.go index b945230eb..790c92021 100644 --- a/pkg/loop/internal/core/services/capability/capabilities_registry_test.go +++ b/pkg/loop/internal/core/services/capability/capabilities_registry_test.go @@ -586,6 +586,31 @@ func TestCapabilitiesRegistry_ConfigForCapability_WithOcr3AndOracleFactoryConfig assert.Equal(t, expectedCapConfig, capConf) } +func TestTransmitterAccountToBytes(t *testing.T) { + t.Run("decodes_0x_and_0X_prefixed_hex", func(t *testing.T) { + gotLower, err := transmitterAccountToBytes(ocrtypes.Account("0xABcd")) + require.NoError(t, err) + require.Equal(t, []byte{0xab, 0xcd}, gotLower) + + gotUpper, err := transmitterAccountToBytes(ocrtypes.Account("0X00ff")) + require.NoError(t, err) + require.Equal(t, []byte{0x00, 0xff}, gotUpper) + }) + + t.Run("returns_error_for_invalid_prefixed_hex", func(t *testing.T) { + _, err := transmitterAccountToBytes(ocrtypes.Account("0x123")) + require.Error(t, err) + require.Contains(t, err.Error(), "failed to decode transmitter") + }) + + t.Run("falls_back_to_raw_bytes_for_non_hex_account", func(t *testing.T) { + raw := []byte{0x00, 0x7f, 0xff, 0x41} + got, err := transmitterAccountToBytes(ocrtypes.Account(string(raw))) + require.NoError(t, err) + require.Equal(t, raw, got) + }) +} + func TestCapabilitiesRegistry_DONsForCapability(t *testing.T) { stopCh := make(chan struct{}) logger := logger.Test(t) From bd121207b5f59e691cf80daa435e4685a4a3ee77 Mon Sep 17 00:00:00 2001 From: cawthorne Date: Tue, 10 Mar 2026 13:20:59 +0000 Subject: [PATCH 12/18] test: cover aptos relayer ledger version and view grpc path (cherry picked from commit c991b6f7bfab5533712f0ab326ae64ff754925d9) --- pkg/loop/internal/relayer/aptos_test.go | 127 ++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 pkg/loop/internal/relayer/aptos_test.go diff --git a/pkg/loop/internal/relayer/aptos_test.go b/pkg/loop/internal/relayer/aptos_test.go new file mode 100644 index 000000000..cf9e69283 --- /dev/null +++ b/pkg/loop/internal/relayer/aptos_test.go @@ -0,0 +1,127 @@ +package relayer + +import ( + "context" + "net" + "testing" + + "github.com/stretchr/testify/require" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/test/bufconn" + + aptospb "github.com/smartcontractkit/chainlink-common/pkg/chains/aptos" + "github.com/smartcontractkit/chainlink-common/pkg/logger" + loopnet "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/net" + "github.com/smartcontractkit/chainlink-common/pkg/types" + aptostypes "github.com/smartcontractkit/chainlink-common/pkg/types/chains/aptos" +) + +func Test_AptosDomainRoundTripThroughGRPC(t *testing.T) { + t.Parallel() + + lis := bufconn.Listen(1024 * 1024) + s := grpc.NewServer() + + aptosService := &staticAptosService{} + aptospb.RegisterAptosServer(s, newAptosServer(aptosService, &loopnet.BrokerExt{ + BrokerConfig: loopnet.BrokerConfig{ + Logger: logger.Test(t), + }, + })) + + go func() { _ = s.Serve(lis) }() + defer s.Stop() + + ctx := t.Context() + conn, err := grpc.DialContext(ctx, "bufnet", + grpc.WithTransportCredentials(insecure.NewCredentials()), + grpc.WithContextDialer(func(ctx context.Context, s string) (net.Conn, error) { + return lis.Dial() + }), + ) + require.NoError(t, err) + defer conn.Close() + + client := &AptosClient{grpcClient: aptospb.NewAptosClient(conn)} + + t.Run("LedgerVersion", func(t *testing.T) { + const expectedLedgerVersion = uint64(12345) + aptosService.ledgerVersion = func(context.Context) (uint64, error) { + return expectedLedgerVersion, nil + } + + got, err := client.LedgerVersion(ctx) + require.NoError(t, err) + require.Equal(t, expectedLedgerVersion, got) + }) + + t.Run("View_WithLedgerVersion", func(t *testing.T) { + ledgerVersion := uint64(77) + expectedPayload := &aptostypes.ViewPayload{ + Module: aptostypes.ModuleID{ + Address: aptostypes.AccountAddress{}, + Name: "module_name", + }, + Function: "function_name", + Args: [][]byte{[]byte{0x01, 0x02}}, + } + expectedData := []byte(`{"value":"ok"}`) + + aptosService.view = func(_ context.Context, req aptostypes.ViewRequest) (*aptostypes.ViewReply, error) { + require.NotNil(t, req.Payload) + require.Equal(t, expectedPayload.Function, req.Payload.Function) + require.Equal(t, expectedPayload.Module.Name, req.Payload.Module.Name) + require.Equal(t, expectedPayload.Args, req.Payload.Args) + require.NotNil(t, req.LedgerVersion) + require.Equal(t, ledgerVersion, *req.LedgerVersion) + return &aptostypes.ViewReply{Data: expectedData}, nil + } + + got, err := client.View(ctx, aptostypes.ViewRequest{ + Payload: expectedPayload, + LedgerVersion: &ledgerVersion, + }) + require.NoError(t, err) + require.Equal(t, expectedData, got.Data) + }) + + t.Run("View_WithoutLedgerVersion", func(t *testing.T) { + expectedPayload := &aptostypes.ViewPayload{ + Module: aptostypes.ModuleID{ + Address: aptostypes.AccountAddress{}, + Name: "module_name", + }, + Function: "function_name", + } + expectedData := []byte(`{"value":"latest"}`) + + aptosService.view = func(_ context.Context, req aptostypes.ViewRequest) (*aptostypes.ViewReply, error) { + require.NotNil(t, req.Payload) + require.Equal(t, expectedPayload.Function, req.Payload.Function) + require.Equal(t, expectedPayload.Module.Name, req.Payload.Module.Name) + require.Nil(t, req.LedgerVersion) + return &aptostypes.ViewReply{Data: expectedData}, nil + } + + got, err := client.View(ctx, aptostypes.ViewRequest{ + Payload: expectedPayload, + }) + require.NoError(t, err) + require.Equal(t, expectedData, got.Data) + }) +} + +type staticAptosService struct { + types.UnimplementedAptosService + ledgerVersion func(ctx context.Context) (uint64, error) + view func(ctx context.Context, req aptostypes.ViewRequest) (*aptostypes.ViewReply, error) +} + +func (s *staticAptosService) LedgerVersion(ctx context.Context) (uint64, error) { + return s.ledgerVersion(ctx) +} + +func (s *staticAptosService) View(ctx context.Context, req aptostypes.ViewRequest) (*aptostypes.ViewReply, error) { + return s.view(ctx, req) +} From 9f9e6d5875d4466c086a7508e7b85bc93ed9c620 Mon Sep 17 00:00:00 2001 From: cawthorne Date: Tue, 10 Mar 2026 14:16:17 +0000 Subject: [PATCH 13/18] aptos capability: add ledger_version to ViewRequest (cherry picked from commit 7a83532543e54727b11832e6d9f93f47888cc54c) --- go.mod | 2 +- go.sum | 4 ++++ .../v2/chain-capabilities/aptos/client.pb.go | 17 ++++++++++++++--- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index eb9c45471..743515b66 100644 --- a/go.mod +++ b/go.mod @@ -41,7 +41,7 @@ require ( github.com/smartcontractkit/chain-selectors v1.0.89 github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.10 github.com/smartcontractkit/chainlink-protos/billing/go v0.0.0-20251024234028-0988426d98f4 - github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260226130359-963f935e0396 + github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260310141431-48133c37449f github.com/smartcontractkit/chainlink-protos/linking-service/go v0.0.0-20251002192024-d2ad9222409b github.com/smartcontractkit/chainlink-protos/node-platform v0.0.0-20260205130626-db2a2aab956b github.com/smartcontractkit/chainlink-protos/storage-service v0.3.0 diff --git a/go.sum b/go.sum index bfa8dbdd0..1a8d59482 100644 --- a/go.sum +++ b/go.sum @@ -334,6 +334,10 @@ github.com/smartcontractkit/chainlink-protos/billing/go v0.0.0-20251024234028-09 github.com/smartcontractkit/chainlink-protos/billing/go v0.0.0-20251024234028-0988426d98f4/go.mod h1:HHGeDUpAsPa0pmOx7wrByCitjQ0mbUxf0R9v+g67uCA= github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260226130359-963f935e0396 h1:03tbcwjyIEjvHba1IWOj1sfThwebm2XNzyFHSuZtlWc= github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260226130359-963f935e0396/go.mod h1:Jqt53s27Tr0jDl8mdBXg1xhu6F8Fci8JOuq43tgHOM8= +github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260310141144-140203173c25 h1:/kQXgpIKISqIa9zYeeRQeOTi+v5lUtaVsWAvCva+mSw= +github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260310141144-140203173c25/go.mod h1:Jqt53s27Tr0jDl8mdBXg1xhu6F8Fci8JOuq43tgHOM8= +github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260310141431-48133c37449f h1:6NNfapdoytMg+9gbu4/LfMYemvn5O0x4CJMd/8uIlFw= +github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260310141431-48133c37449f/go.mod h1:Jqt53s27Tr0jDl8mdBXg1xhu6F8Fci8JOuq43tgHOM8= github.com/smartcontractkit/chainlink-protos/linking-service/go v0.0.0-20251002192024-d2ad9222409b h1:QuI6SmQFK/zyUlVWEf0GMkiUYBPY4lssn26nKSd/bOM= github.com/smartcontractkit/chainlink-protos/linking-service/go v0.0.0-20251002192024-d2ad9222409b/go.mod h1:qSTSwX3cBP3FKQwQacdjArqv0g6QnukjV4XuzO6UyoY= github.com/smartcontractkit/chainlink-protos/node-platform v0.0.0-20260205130626-db2a2aab956b h1:36knUpKHHAZ86K4FGWXtx8i/EQftGdk2bqCoEu/Cha8= diff --git a/pkg/capabilities/v2/chain-capabilities/aptos/client.pb.go b/pkg/capabilities/v2/chain-capabilities/aptos/client.pb.go index 347028bdf..5e661bb7f 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 v5.27.3 // source: capabilities/blockchain/aptos/v1alpha/client.proto package aptos @@ -304,6 +304,7 @@ func (x *AccountAPTBalanceReply) GetValue() uint64 { 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"` // nil means use latest ledger version unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -345,6 +346,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"` @@ -1347,9 +1355,11 @@ const file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDesc = "" + "\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\"\x9a\x01\n" + "\vViewRequest\x12L\n" + - "\apayload\x18\x01 \x01(\v22.capabilities.blockchain.aptos.v1alpha.ViewPayloadR\apayload\"\x1f\n" + + "\apayload\x18\x01 \x01(\v22.capabilities.blockchain.aptos.v1alpha.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\"\xd3\x01\n" + "\vViewPayload\x12G\n" + @@ -1549,6 +1559,7 @@ 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[2].OneofWrappers = []any{} file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[6].OneofWrappers = []any{ (*TypeTag_Vector)(nil), (*TypeTag_Struct)(nil), From f4a5399a70a14c72f516ec9a68ce5fe7f62a03de Mon Sep 17 00:00:00 2001 From: cawthorne Date: Tue, 10 Mar 2026 14:33:35 +0000 Subject: [PATCH 14/18] deps: bump chainlink-protos/cre/go to merged main (cherry picked from commit ca31c544ac5cd54758d24aaee2e72795c491dfbd) --- go.mod | 2 +- go.sum | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 743515b66..c4837f477 100644 --- a/go.mod +++ b/go.mod @@ -41,7 +41,7 @@ require ( github.com/smartcontractkit/chain-selectors v1.0.89 github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.10 github.com/smartcontractkit/chainlink-protos/billing/go v0.0.0-20251024234028-0988426d98f4 - github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260310141431-48133c37449f + github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260310142526-ecda729848f6 github.com/smartcontractkit/chainlink-protos/linking-service/go v0.0.0-20251002192024-d2ad9222409b github.com/smartcontractkit/chainlink-protos/node-platform v0.0.0-20260205130626-db2a2aab956b github.com/smartcontractkit/chainlink-protos/storage-service v0.3.0 diff --git a/go.sum b/go.sum index 1a8d59482..1398d3bcb 100644 --- a/go.sum +++ b/go.sum @@ -332,12 +332,8 @@ github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.10 h1:FJAFgXS9 github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.10/go.mod h1:oiDa54M0FwxevWwyAX773lwdWvFYYlYHHQV1LQ5HpWY= github.com/smartcontractkit/chainlink-protos/billing/go v0.0.0-20251024234028-0988426d98f4 h1:GCzrxDWn3b7jFfEA+WiYRi8CKoegsayiDoJBCjYkneE= github.com/smartcontractkit/chainlink-protos/billing/go v0.0.0-20251024234028-0988426d98f4/go.mod h1:HHGeDUpAsPa0pmOx7wrByCitjQ0mbUxf0R9v+g67uCA= -github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260226130359-963f935e0396 h1:03tbcwjyIEjvHba1IWOj1sfThwebm2XNzyFHSuZtlWc= -github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260226130359-963f935e0396/go.mod h1:Jqt53s27Tr0jDl8mdBXg1xhu6F8Fci8JOuq43tgHOM8= -github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260310141144-140203173c25 h1:/kQXgpIKISqIa9zYeeRQeOTi+v5lUtaVsWAvCva+mSw= -github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260310141144-140203173c25/go.mod h1:Jqt53s27Tr0jDl8mdBXg1xhu6F8Fci8JOuq43tgHOM8= -github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260310141431-48133c37449f h1:6NNfapdoytMg+9gbu4/LfMYemvn5O0x4CJMd/8uIlFw= -github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260310141431-48133c37449f/go.mod h1:Jqt53s27Tr0jDl8mdBXg1xhu6F8Fci8JOuq43tgHOM8= +github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260310142526-ecda729848f6 h1:i15omvye/jtFlD48hqR88xt4bFcxMJqevNTJU1dgOQQ= +github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260310142526-ecda729848f6/go.mod h1:Jqt53s27Tr0jDl8mdBXg1xhu6F8Fci8JOuq43tgHOM8= github.com/smartcontractkit/chainlink-protos/linking-service/go v0.0.0-20251002192024-d2ad9222409b h1:QuI6SmQFK/zyUlVWEf0GMkiUYBPY4lssn26nKSd/bOM= github.com/smartcontractkit/chainlink-protos/linking-service/go v0.0.0-20251002192024-d2ad9222409b/go.mod h1:qSTSwX3cBP3FKQwQacdjArqv0g6QnukjV4XuzO6UyoY= github.com/smartcontractkit/chainlink-protos/node-platform v0.0.0-20260205130626-db2a2aab956b h1:36knUpKHHAZ86K4FGWXtx8i/EQftGdk2bqCoEu/Cha8= From b3fdce191b584223c7afd572b2190ab165b2fa99 Mon Sep 17 00:00:00 2001 From: cawthorne Date: Tue, 10 Mar 2026 14:44:20 +0000 Subject: [PATCH 15/18] capabilities: guard solana proto regen with missing source (cherry picked from commit 79d635021f011c378a1484766eea76c7a35b0f2e) --- pkg/capabilities/v2/chain-capabilities/solana/generate.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/capabilities/v2/chain-capabilities/solana/generate.go b/pkg/capabilities/v2/chain-capabilities/solana/generate.go index 9cdf1a6b5..c84392320 100644 --- a/pkg/capabilities/v2/chain-capabilities/solana/generate.go +++ b/pkg/capabilities/v2/chain-capabilities/solana/generate.go @@ -1,2 +1,4 @@ -//go:generate go run ../../gen --pkg=github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/chain-capabilities/solana --file=capabilities/blockchain/solana/v1alpha/client.proto +// TODO(CRE-): Re-enable Solana proto regeneration once chainlink-protos/cre/go +// embeds capabilities/blockchain/solana/v1alpha/client.proto again. +//go:generate echo "skipping solana proto regen: source proto not available in chainlink-protos/cre/go" package solana From bfbf87148fd3f3419a90a4389ea998937e91cab8 Mon Sep 17 00:00:00 2001 From: cawthorne Date: Tue, 10 Mar 2026 14:47:35 +0000 Subject: [PATCH 16/18] capabilities: commit regenerated aptos/evm client pb outputs (cherry picked from commit f59b6dca56117564338f87486fe25efdc2f32cb8) --- .../v2/chain-capabilities/aptos/client.pb.go | 2 +- .../v2/chain-capabilities/evm/client.pb.go | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/pkg/capabilities/v2/chain-capabilities/aptos/client.pb.go b/pkg/capabilities/v2/chain-capabilities/aptos/client.pb.go index 5e661bb7f..8770a267f 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.27.3 +// protoc v5.29.3 // source: capabilities/blockchain/aptos/v1alpha/client.proto package aptos diff --git a/pkg/capabilities/v2/chain-capabilities/evm/client.pb.go b/pkg/capabilities/v2/chain-capabilities/evm/client.pb.go index a4327ae5c..d007bd862 100644 --- a/pkg/capabilities/v2/chain-capabilities/evm/client.pb.go +++ b/pkg/capabilities/v2/chain-capabilities/evm/client.pb.go @@ -1791,7 +1791,7 @@ const file_capabilities_blockchain_evm_v1alpha_client_proto_rawDesc = "" + "\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\xcb\x11\n" + + "\x11TX_STATUS_SUCCESS\x10\x022\xcf\x12\n" + "\x06Client\x12\x80\x01\n" + "\fCallContract\x128.capabilities.blockchain.evm.v1alpha.CallContractRequest\x1a6.capabilities.blockchain.evm.v1alpha.CallContractReply\x12z\n" + "\n" + @@ -1803,8 +1803,8 @@ const file_capabilities_blockchain_evm_v1alpha_client_proto_rawDesc = "" + "\x0eHeaderByNumber\x12:.capabilities.blockchain.evm.v1alpha.HeaderByNumberRequest\x1a8.capabilities.blockchain.evm.v1alpha.HeaderByNumberReply\x12v\n" + "\n" + "LogTrigger\x12<.capabilities.blockchain.evm.v1alpha.FilterLogTriggerRequest\x1a(.capabilities.blockchain.evm.v1alpha.Log0\x01\x12}\n" + - "\vWriteReport\x127.capabilities.blockchain.evm.v1alpha.WriteReportRequest\x1a5.capabilities.blockchain.evm.v1alpha.WriteReportReply\x1a\x90\b\x82\xb5\x18\x8b\b\b\x01\x12\tevm@1.0.0\x1a\xfb\a\n" + - "\rChainSelector\x12\xe9\a\x12\xe6\a\n" + + "\vWriteReport\x127.capabilities.blockchain.evm.v1alpha.WriteReportRequest\x1a5.capabilities.blockchain.evm.v1alpha.WriteReportReply\x1a\x94\t\x82\xb5\x18\x8f\t\b\x01\x12\tevm@1.0.0\x1a\xff\b\n" + + "\rChainSelector\x12\xed\b\x12\xea\b\n" + "$\n" + "\x17apechain-testnet-curtis\x10\xc1ô\xf8\x8dĒ\xb2\x89\x01\n" + "\x17\n" + @@ -1828,6 +1828,8 @@ const file_capabilities_blockchain_evm_v1alpha_client_proto_rawDesc = "" + ")\n" + "\x1dethereum-mainnet-worldchain-1\x10\x87ﺷŶ¸\x1c\n" + "%\n" + + "\x19ethereum-mainnet-xlayer-1\x10\x96\xa5\xfc\x9c\xa6\xa8\xef\xed)\n" + + "%\n" + "\x19ethereum-mainnet-zksync-1\x10\x94\xee\x97\xd9\xed\xb4\xb1\xd7\x15\n" + "%\n" + "\x18ethereum-testnet-sepolia\x10ٵ\xe4\xce\xfc\xc9\xee\xa0\xde\x01\n" + @@ -1848,7 +1850,13 @@ const file_capabilities_blockchain_evm_v1alpha_client_proto_rawDesc = "" + " \n" + "\x13ink-testnet-sepolia\x10\xe8\xf4\xa7\xa5\xf3\xe6\x96\xc0\x87\x01\n" + "\x19\n" + + "\rjovay-mainnet\x10\xb5\xc3Ě\xa1\x80ߒ\x15\n" + + "\x19\n" + "\rjovay-testnet\x10\xe4ϊ\x84\u07b2ގ\r\n" + + "$\n" + + "\x17pharos-atlantic-testnet\x10̙\xed\xe0μ\xaf\xb4\xdf\x01\n" + + "\x1a\n" + + "\x0epharos-mainnet\x10\xc8\xc1\x87\x9e\xf5\xef͡l\n" + "\x1a\n" + "\x0eplasma-testnet\x10՛\xbf\xa5ô\x99\x877\n" + "\x1b\n" + From bc3411a9d8f96efd7ede8e49dce1a5e0f2f3db31 Mon Sep 17 00:00:00 2001 From: cawthorne Date: Wed, 11 Mar 2026 13:55:56 +0000 Subject: [PATCH 17/18] Add shared ViewPayloadFromCapability for Aptos (cherry picked from commit 1eac4738088f656adc658b9b491629f403b87ee8) --- pkg/types/chains/aptos/capability_convert.go | 121 ++++++++++++++++++ .../chains/aptos/capability_convert_test.go | 108 ++++++++++++++++ 2 files changed, 229 insertions(+) create mode 100644 pkg/types/chains/aptos/capability_convert.go create mode 100644 pkg/types/chains/aptos/capability_convert_test.go diff --git a/pkg/types/chains/aptos/capability_convert.go b/pkg/types/chains/aptos/capability_convert.go new file mode 100644 index 000000000..a3edfd7bc --- /dev/null +++ b/pkg/types/chains/aptos/capability_convert.go @@ -0,0 +1,121 @@ +package aptos + +import ( + "fmt" + + aptoscap "github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/chain-capabilities/aptos" +) + +// ViewPayloadFromCapability converts Aptos capability request payloads to Aptos relayer payloads. +func ViewPayloadFromCapability(payload *aptoscap.ViewPayload) (*ViewPayload, error) { + if payload == nil { + return nil, fmt.Errorf("ViewRequest.Payload is required") + } + if payload.Module == nil { + return nil, fmt.Errorf("ViewRequest.Payload.Module is required") + } + if payload.Function == "" { + return nil, fmt.Errorf("ViewRequest.Payload.Function is required") + } + if len(payload.Module.Address) > AccountAddressLength { + return nil, fmt.Errorf("module address too long: %d", len(payload.Module.Address)) + } + + var moduleAddress AccountAddress + copy(moduleAddress[AccountAddressLength-len(payload.Module.Address):], payload.Module.Address) + + argTypes := make([]TypeTag, 0, len(payload.ArgTypes)) + for i, tag := range payload.ArgTypes { + converted, err := typeTagFromCapability(tag) + if err != nil { + return nil, fmt.Errorf("invalid arg type at index %d: %w", i, err) + } + argTypes = append(argTypes, converted) + } + + return &ViewPayload{ + Module: ModuleID{ + Address: moduleAddress, + Name: payload.Module.Name, + }, + Function: payload.Function, + ArgTypes: argTypes, + Args: payload.Args, + }, nil +} + +func typeTagFromCapability(tag *aptoscap.TypeTag) (TypeTag, error) { + if tag == nil { + return TypeTag{}, fmt.Errorf("type tag is nil") + } + + switch tag.Kind { + case aptoscap.TypeTagKind_TYPE_TAG_KIND_BOOL: + return TypeTag{Value: BoolTag{}}, nil + case aptoscap.TypeTagKind_TYPE_TAG_KIND_U8: + return TypeTag{Value: U8Tag{}}, nil + case aptoscap.TypeTagKind_TYPE_TAG_KIND_U16: + return TypeTag{Value: U16Tag{}}, nil + case aptoscap.TypeTagKind_TYPE_TAG_KIND_U32: + return TypeTag{Value: U32Tag{}}, nil + case aptoscap.TypeTagKind_TYPE_TAG_KIND_U64: + return TypeTag{Value: U64Tag{}}, nil + case aptoscap.TypeTagKind_TYPE_TAG_KIND_U128: + return TypeTag{Value: U128Tag{}}, nil + case aptoscap.TypeTagKind_TYPE_TAG_KIND_U256: + return TypeTag{Value: U256Tag{}}, nil + case aptoscap.TypeTagKind_TYPE_TAG_KIND_ADDRESS: + return TypeTag{Value: AddressTag{}}, nil + case aptoscap.TypeTagKind_TYPE_TAG_KIND_SIGNER: + return TypeTag{Value: SignerTag{}}, nil + case aptoscap.TypeTagKind_TYPE_TAG_KIND_VECTOR: + vector := tag.GetVector() + if vector == nil { + return TypeTag{}, fmt.Errorf("vector tag missing vector value") + } + elementType, err := typeTagFromCapability(vector.ElementType) + if err != nil { + return TypeTag{}, err + } + return TypeTag{Value: VectorTag{ElementType: elementType}}, nil + case aptoscap.TypeTagKind_TYPE_TAG_KIND_STRUCT: + structTag := tag.GetStruct() + if structTag == nil { + return TypeTag{}, fmt.Errorf("struct tag missing struct value") + } + if len(structTag.Address) > AccountAddressLength { + return TypeTag{}, fmt.Errorf("struct address too long: %d", len(structTag.Address)) + } + var structAddress AccountAddress + copy(structAddress[AccountAddressLength-len(structTag.Address):], structTag.Address) + + typeParams := make([]TypeTag, 0, len(structTag.TypeParams)) + for i, tp := range structTag.TypeParams { + converted, err := typeTagFromCapability(tp) + if err != nil { + return TypeTag{}, fmt.Errorf("invalid struct type param at index %d: %w", i, err) + } + typeParams = append(typeParams, converted) + } + + return TypeTag{ + Value: StructTag{ + Address: structAddress, + Module: structTag.Module, + Name: structTag.Name, + TypeParams: typeParams, + }, + }, nil + case aptoscap.TypeTagKind_TYPE_TAG_KIND_GENERIC: + generic := tag.GetGeneric() + if generic == nil { + return TypeTag{}, fmt.Errorf("generic tag missing generic value") + } + if generic.Index > 0xFFFF { + return TypeTag{}, fmt.Errorf("generic type index out of range: %d", generic.Index) + } + return TypeTag{Value: GenericTag{Index: uint16(generic.Index)}}, nil + default: + return TypeTag{}, fmt.Errorf("unsupported type tag kind: %v", tag.Kind) + } +} diff --git a/pkg/types/chains/aptos/capability_convert_test.go b/pkg/types/chains/aptos/capability_convert_test.go new file mode 100644 index 000000000..7145d4d27 --- /dev/null +++ b/pkg/types/chains/aptos/capability_convert_test.go @@ -0,0 +1,108 @@ +package aptos + +import ( + "testing" + + "github.com/stretchr/testify/require" + + aptoscap "github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/chain-capabilities/aptos" +) + +func TestViewPayloadFromCapability_Success(t *testing.T) { + t.Parallel() + + payload, err := ViewPayloadFromCapability(&aptoscap.ViewPayload{ + Module: &aptoscap.ModuleID{ + Address: []byte{0x01}, + Name: "coin", + }, + Function: "name", + ArgTypes: []*aptoscap.TypeTag{ + { + Kind: aptoscap.TypeTagKind_TYPE_TAG_KIND_VECTOR, + Value: &aptoscap.TypeTag_Vector{ + Vector: &aptoscap.VectorTag{ + ElementType: &aptoscap.TypeTag{ + Kind: aptoscap.TypeTagKind_TYPE_TAG_KIND_U8, + }, + }, + }, + }, + { + Kind: aptoscap.TypeTagKind_TYPE_TAG_KIND_STRUCT, + Value: &aptoscap.TypeTag_Struct{ + Struct: &aptoscap.StructTag{ + Address: []byte{0x02}, + Module: "m", + Name: "n", + TypeParams: []*aptoscap.TypeTag{ + { + Kind: aptoscap.TypeTagKind_TYPE_TAG_KIND_GENERIC, + Value: &aptoscap.TypeTag_Generic{ + Generic: &aptoscap.GenericTag{Index: 7}, + }, + }, + }, + }, + }, + }, + }, + Args: [][]byte{{0xAA, 0xBB}}, + }) + require.NoError(t, err) + require.NotNil(t, payload) + require.Equal(t, "coin", payload.Module.Name) + require.Equal(t, "name", payload.Function) + require.Len(t, payload.ArgTypes, 2) + require.Equal(t, [][]byte{{0xAA, 0xBB}}, payload.Args) +} + +func TestViewPayloadFromCapability_RejectsInvalidInput(t *testing.T) { + t.Parallel() + + _, err := ViewPayloadFromCapability(nil) + require.ErrorContains(t, err, "ViewRequest.Payload is required") + + _, err = ViewPayloadFromCapability(&aptoscap.ViewPayload{}) + require.ErrorContains(t, err, "ViewRequest.Payload.Module is required") + + _, err = ViewPayloadFromCapability(&aptoscap.ViewPayload{ + Module: &aptoscap.ModuleID{Address: []byte{1}, Name: "coin"}, + }) + require.ErrorContains(t, err, "ViewRequest.Payload.Function is required") + + _, err = ViewPayloadFromCapability(&aptoscap.ViewPayload{ + Module: &aptoscap.ModuleID{ + Address: make([]byte, AccountAddressLength+1), + Name: "coin", + }, + Function: "name", + }) + require.ErrorContains(t, err, "module address too long") +} + +func TestViewPayloadFromCapability_RejectsBadTypeTags(t *testing.T) { + t.Parallel() + + _, err := ViewPayloadFromCapability(&aptoscap.ViewPayload{ + Module: &aptoscap.ModuleID{Address: []byte{1}, Name: "coin"}, + Function: "name", + ArgTypes: []*aptoscap.TypeTag{nil}, + }) + require.ErrorContains(t, err, "invalid arg type at index 0") + require.ErrorContains(t, err, "type tag is nil") + + _, err = ViewPayloadFromCapability(&aptoscap.ViewPayload{ + Module: &aptoscap.ModuleID{Address: []byte{1}, Name: "coin"}, + Function: "name", + ArgTypes: []*aptoscap.TypeTag{ + { + Kind: aptoscap.TypeTagKind_TYPE_TAG_KIND_GENERIC, + Value: &aptoscap.TypeTag_Generic{ + Generic: &aptoscap.GenericTag{Index: 1 << 20}, + }, + }, + }, + }) + require.ErrorContains(t, err, "generic type index out of range") +} From 43ccc379ebf673a6d0002db53317cd1a0e8a5e0c Mon Sep 17 00:00:00 2001 From: cawthorne Date: Sun, 15 Mar 2026 07:57:05 +0000 Subject: [PATCH 18/18] aptos: share write status and fee reply --- go.mod | 2 +- go.sum | 2 + .../v2/chain-capabilities/aptos/client.pb.go | 199 ++++++++++------ pkg/chains/aptos/aptos.pb.go | 17 +- pkg/chains/aptos/aptos.proto | 1 + pkg/chains/aptos/proto_helpers.go | 2 + pkg/chains/aptos/proto_helpers_test.go | 5 + pkg/types/chains/aptos/aptos.go | 1 + pkg/types/chains/aptos/write_status.go | 222 ++++++++++++++++++ pkg/types/chains/aptos/write_status_test.go | 58 +++++ 10 files changed, 436 insertions(+), 73 deletions(-) create mode 100644 pkg/types/chains/aptos/write_status.go create mode 100644 pkg/types/chains/aptos/write_status_test.go diff --git a/go.mod b/go.mod index c4837f477..916fb56a5 100644 --- a/go.mod +++ b/go.mod @@ -41,7 +41,7 @@ require ( github.com/smartcontractkit/chain-selectors v1.0.89 github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.10 github.com/smartcontractkit/chainlink-protos/billing/go v0.0.0-20251024234028-0988426d98f4 - github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260310142526-ecda729848f6 + github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260315075612-521c1d565f4a github.com/smartcontractkit/chainlink-protos/linking-service/go v0.0.0-20251002192024-d2ad9222409b github.com/smartcontractkit/chainlink-protos/node-platform v0.0.0-20260205130626-db2a2aab956b github.com/smartcontractkit/chainlink-protos/storage-service v0.3.0 diff --git a/go.sum b/go.sum index 1398d3bcb..0cde3e3ab 100644 --- a/go.sum +++ b/go.sum @@ -334,6 +334,8 @@ github.com/smartcontractkit/chainlink-protos/billing/go v0.0.0-20251024234028-09 github.com/smartcontractkit/chainlink-protos/billing/go v0.0.0-20251024234028-0988426d98f4/go.mod h1:HHGeDUpAsPa0pmOx7wrByCitjQ0mbUxf0R9v+g67uCA= github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260310142526-ecda729848f6 h1:i15omvye/jtFlD48hqR88xt4bFcxMJqevNTJU1dgOQQ= github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260310142526-ecda729848f6/go.mod h1:Jqt53s27Tr0jDl8mdBXg1xhu6F8Fci8JOuq43tgHOM8= +github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260315075612-521c1d565f4a h1:eqiLua4r2xM0iBMMfpRvbkYQ6B/hpDmTPYZdhf5nY1M= +github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260315075612-521c1d565f4a/go.mod h1:Jqt53s27Tr0jDl8mdBXg1xhu6F8Fci8JOuq43tgHOM8= github.com/smartcontractkit/chainlink-protos/linking-service/go v0.0.0-20251002192024-d2ad9222409b h1:QuI6SmQFK/zyUlVWEf0GMkiUYBPY4lssn26nKSd/bOM= github.com/smartcontractkit/chainlink-protos/linking-service/go v0.0.0-20251002192024-d2ad9222409b/go.mod h1:qSTSwX3cBP3FKQwQacdjArqv0g6QnukjV4XuzO6UyoY= github.com/smartcontractkit/chainlink-protos/node-platform v0.0.0-20260205130626-db2a2aab956b h1:36knUpKHHAZ86K4FGWXtx8i/EQftGdk2bqCoEu/Cha8= diff --git a/pkg/capabilities/v2/chain-capabilities/aptos/client.pb.go b/pkg/capabilities/v2/chain-capabilities/aptos/client.pb.go index 8770a267f..10cd4de58 100644 --- a/pkg/capabilities/v2/chain-capabilities/aptos/client.pb.go +++ b/pkg/capabilities/v2/chain-capabilities/aptos/client.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.11 +// protoc-gen-go v1.36.6 // protoc v5.29.3 // source: capabilities/blockchain/aptos/v1alpha/client.proto @@ -213,6 +213,52 @@ func (TransactionVariant) EnumDescriptor() ([]byte, []int) { return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{2} } +type ReceiverContractExecutionStatus int32 + +const ( + ReceiverContractExecutionStatus_RECEIVER_CONTRACT_EXECUTION_STATUS_SUCCESS ReceiverContractExecutionStatus = 0 + ReceiverContractExecutionStatus_RECEIVER_CONTRACT_EXECUTION_STATUS_REVERTED ReceiverContractExecutionStatus = 1 +) + +// Enum value maps for ReceiverContractExecutionStatus. +var ( + ReceiverContractExecutionStatus_name = map[int32]string{ + 0: "RECEIVER_CONTRACT_EXECUTION_STATUS_SUCCESS", + 1: "RECEIVER_CONTRACT_EXECUTION_STATUS_REVERTED", + } + ReceiverContractExecutionStatus_value = map[string]int32{ + "RECEIVER_CONTRACT_EXECUTION_STATUS_SUCCESS": 0, + "RECEIVER_CONTRACT_EXECUTION_STATUS_REVERTED": 1, + } +) + +func (x ReceiverContractExecutionStatus) Enum() *ReceiverContractExecutionStatus { + p := new(ReceiverContractExecutionStatus) + *p = x + return p +} + +func (x ReceiverContractExecutionStatus) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ReceiverContractExecutionStatus) Descriptor() protoreflect.EnumDescriptor { + return file_capabilities_blockchain_aptos_v1alpha_client_proto_enumTypes[3].Descriptor() +} + +func (ReceiverContractExecutionStatus) Type() protoreflect.EnumType { + return &file_capabilities_blockchain_aptos_v1alpha_client_proto_enumTypes[3] +} + +func (x ReceiverContractExecutionStatus) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ReceiverContractExecutionStatus.Descriptor instead. +func (ReceiverContractExecutionStatus) EnumDescriptor() ([]byte, []int) { + return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{3} +} + type AccountAPTBalanceRequest struct { state protoimpl.MessageState `protogen:"open.v1"` Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // 32-byte address @@ -1280,13 +1326,14 @@ func (x *WriteReportRequest) GetReport() *sdk.ReportResponse { } 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 + 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"` + ReceiverContractExecutionStatus *ReceiverContractExecutionStatus `protobuf:"varint,2,opt,name=receiver_contract_execution_status,json=receiverContractExecutionStatus,proto3,enum=capabilities.blockchain.aptos.v1alpha.ReceiverContractExecutionStatus,oneof" json:"receiver_contract_execution_status,omitempty"` + TxHash *string `protobuf:"bytes,3,opt,name=tx_hash,json=txHash,proto3,oneof" json:"tx_hash,omitempty"` // transaction hash (hex string with 0x prefix) + TransactionFee *uint64 `protobuf:"varint,4,opt,name=transaction_fee,json=transactionFee,proto3,oneof" json:"transaction_fee,omitempty"` // gas used in octas + ErrorMessage *string `protobuf:"bytes,5,opt,name=error_message,json=errorMessage,proto3,oneof" json:"error_message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *WriteReportReply) Reset() { @@ -1326,6 +1373,13 @@ func (x *WriteReportReply) GetTxStatus() TxStatus { return TxStatus_TX_STATUS_FATAL } +func (x *WriteReportReply) GetReceiverContractExecutionStatus() ReceiverContractExecutionStatus { + if x != nil && x.ReceiverContractExecutionStatus != nil { + return *x.ReceiverContractExecutionStatus + } + return ReceiverContractExecutionStatus_RECEIVER_CONTRACT_EXECUTION_STATUS_SUCCESS +} + func (x *WriteReportReply) GetTxHash() string { if x != nil && x.TxHash != nil { return *x.TxHash @@ -1428,12 +1482,14 @@ const file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDesc = "" + "\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" + + "\v_gas_config\"\xca\x03\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" + + "\ttx_status\x18\x01 \x01(\x0e2/.capabilities.blockchain.aptos.v1alpha.TxStatusR\btxStatus\x12\x98\x01\n" + + "\"receiver_contract_execution_status\x18\x02 \x01(\x0e2F.capabilities.blockchain.aptos.v1alpha.ReceiverContractExecutionStatusH\x00R\x1freceiverContractExecutionStatus\x88\x01\x01\x12\x1c\n" + + "\atx_hash\x18\x03 \x01(\tH\x01R\x06txHash\x88\x01\x01\x12,\n" + + "\x0ftransaction_fee\x18\x04 \x01(\x04H\x02R\x0etransactionFee\x88\x01\x01\x12(\n" + + "\rerror_message\x18\x05 \x01(\tH\x03R\ferrorMessage\x88\x01\x01B%\n" + + "#_receiver_contract_execution_statusB\n" + "\n" + "\b_tx_hashB\x12\n" + "\x10_transaction_feeB\x10\n" + @@ -1464,7 +1520,10 @@ const file_capabilities_blockchain_aptos_v1alpha_client_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\a2\xa2\x06\n" + + "\x1bTRANSACTION_VARIANT_UNKNOWN\x10\a*\x82\x01\n" + + "\x1fReceiverContractExecutionStatus\x12.\n" + + "*RECEIVER_CONTRACT_EXECUTION_STATUS_SUCCESS\x10\x00\x12/\n" + + "+RECEIVER_CONTRACT_EXECUTION_STATUS_REVERTED\x10\x012\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" + @@ -1490,68 +1549,70 @@ 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_enumTypes = make([]protoimpl.EnumInfo, 4) var file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes = make([]protoimpl.MessageInfo, 20) 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 + (TypeTagKind)(0), // 1: capabilities.blockchain.aptos.v1alpha.TypeTagKind + (TransactionVariant)(0), // 2: capabilities.blockchain.aptos.v1alpha.TransactionVariant + (ReceiverContractExecutionStatus)(0), // 3: capabilities.blockchain.aptos.v1alpha.ReceiverContractExecutionStatus + (*AccountAPTBalanceRequest)(nil), // 4: capabilities.blockchain.aptos.v1alpha.AccountAPTBalanceRequest + (*AccountAPTBalanceReply)(nil), // 5: capabilities.blockchain.aptos.v1alpha.AccountAPTBalanceReply + (*ViewRequest)(nil), // 6: capabilities.blockchain.aptos.v1alpha.ViewRequest + (*ViewReply)(nil), // 7: capabilities.blockchain.aptos.v1alpha.ViewReply + (*ViewPayload)(nil), // 8: capabilities.blockchain.aptos.v1alpha.ViewPayload + (*ModuleID)(nil), // 9: capabilities.blockchain.aptos.v1alpha.ModuleID + (*TypeTag)(nil), // 10: capabilities.blockchain.aptos.v1alpha.TypeTag + (*VectorTag)(nil), // 11: capabilities.blockchain.aptos.v1alpha.VectorTag + (*StructTag)(nil), // 12: capabilities.blockchain.aptos.v1alpha.StructTag + (*GenericTag)(nil), // 13: capabilities.blockchain.aptos.v1alpha.GenericTag + (*TransactionByHashRequest)(nil), // 14: capabilities.blockchain.aptos.v1alpha.TransactionByHashRequest + (*TransactionByHashReply)(nil), // 15: capabilities.blockchain.aptos.v1alpha.TransactionByHashReply + (*Transaction)(nil), // 16: capabilities.blockchain.aptos.v1alpha.Transaction + (*AccountTransactionsRequest)(nil), // 17: capabilities.blockchain.aptos.v1alpha.AccountTransactionsRequest + (*AccountTransactionsReply)(nil), // 18: capabilities.blockchain.aptos.v1alpha.AccountTransactionsReply + (*SubmitTransactionRequest)(nil), // 19: capabilities.blockchain.aptos.v1alpha.SubmitTransactionRequest + (*SubmitTransactionReply)(nil), // 20: capabilities.blockchain.aptos.v1alpha.SubmitTransactionReply + (*GasConfig)(nil), // 21: capabilities.blockchain.aptos.v1alpha.GasConfig + (*WriteReportRequest)(nil), // 22: capabilities.blockchain.aptos.v1alpha.WriteReportRequest + (*WriteReportReply)(nil), // 23: capabilities.blockchain.aptos.v1alpha.WriteReportReply + (*sdk.ReportResponse)(nil), // 24: 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 + 8, // 0: capabilities.blockchain.aptos.v1alpha.ViewRequest.payload:type_name -> capabilities.blockchain.aptos.v1alpha.ViewPayload + 9, // 1: capabilities.blockchain.aptos.v1alpha.ViewPayload.module:type_name -> capabilities.blockchain.aptos.v1alpha.ModuleID + 10, // 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 + 11, // 4: capabilities.blockchain.aptos.v1alpha.TypeTag.vector:type_name -> capabilities.blockchain.aptos.v1alpha.VectorTag + 12, // 5: capabilities.blockchain.aptos.v1alpha.TypeTag.struct:type_name -> capabilities.blockchain.aptos.v1alpha.StructTag + 13, // 6: capabilities.blockchain.aptos.v1alpha.TypeTag.generic:type_name -> capabilities.blockchain.aptos.v1alpha.GenericTag + 10, // 7: capabilities.blockchain.aptos.v1alpha.VectorTag.element_type:type_name -> capabilities.blockchain.aptos.v1alpha.TypeTag + 10, // 8: capabilities.blockchain.aptos.v1alpha.StructTag.type_params:type_name -> capabilities.blockchain.aptos.v1alpha.TypeTag + 16, // 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 + 16, // 11: capabilities.blockchain.aptos.v1alpha.AccountTransactionsReply.transactions:type_name -> capabilities.blockchain.aptos.v1alpha.Transaction + 9, // 12: capabilities.blockchain.aptos.v1alpha.SubmitTransactionRequest.receiver_module_id:type_name -> capabilities.blockchain.aptos.v1alpha.ModuleID + 21, // 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 + 21, // 15: capabilities.blockchain.aptos.v1alpha.WriteReportRequest.gas_config:type_name -> capabilities.blockchain.aptos.v1alpha.GasConfig + 24, // 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 + 3, // 18: capabilities.blockchain.aptos.v1alpha.WriteReportReply.receiver_contract_execution_status:type_name -> capabilities.blockchain.aptos.v1alpha.ReceiverContractExecutionStatus + 4, // 19: capabilities.blockchain.aptos.v1alpha.Client.AccountAPTBalance:input_type -> capabilities.blockchain.aptos.v1alpha.AccountAPTBalanceRequest + 6, // 20: capabilities.blockchain.aptos.v1alpha.Client.View:input_type -> capabilities.blockchain.aptos.v1alpha.ViewRequest + 14, // 21: capabilities.blockchain.aptos.v1alpha.Client.TransactionByHash:input_type -> capabilities.blockchain.aptos.v1alpha.TransactionByHashRequest + 17, // 22: capabilities.blockchain.aptos.v1alpha.Client.AccountTransactions:input_type -> capabilities.blockchain.aptos.v1alpha.AccountTransactionsRequest + 22, // 23: capabilities.blockchain.aptos.v1alpha.Client.WriteReport:input_type -> capabilities.blockchain.aptos.v1alpha.WriteReportRequest + 5, // 24: capabilities.blockchain.aptos.v1alpha.Client.AccountAPTBalance:output_type -> capabilities.blockchain.aptos.v1alpha.AccountAPTBalanceReply + 7, // 25: capabilities.blockchain.aptos.v1alpha.Client.View:output_type -> capabilities.blockchain.aptos.v1alpha.ViewReply + 15, // 26: capabilities.blockchain.aptos.v1alpha.Client.TransactionByHash:output_type -> capabilities.blockchain.aptos.v1alpha.TransactionByHashReply + 18, // 27: capabilities.blockchain.aptos.v1alpha.Client.AccountTransactions:output_type -> capabilities.blockchain.aptos.v1alpha.AccountTransactionsReply + 23, // 28: capabilities.blockchain.aptos.v1alpha.Client.WriteReport:output_type -> capabilities.blockchain.aptos.v1alpha.WriteReportReply + 24, // [24:29] is the sub-list for method output_type + 19, // [19:24] is the sub-list for method input_type + 19, // [19:19] is the sub-list for extension type_name + 19, // [19:19] is the sub-list for extension extendee + 0, // [0:19] is the sub-list for field type_name } func init() { file_capabilities_blockchain_aptos_v1alpha_client_proto_init() } @@ -1576,7 +1637,7 @@ func file_capabilities_blockchain_aptos_v1alpha_client_proto_init() { 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, + NumEnums: 4, NumMessages: 20, NumExtensions: 0, NumServices: 1, diff --git a/pkg/chains/aptos/aptos.pb.go b/pkg/chains/aptos/aptos.pb.go index 1693ac17e..45136219e 100644 --- a/pkg/chains/aptos/aptos.pb.go +++ b/pkg/chains/aptos/aptos.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.11 +// protoc-gen-go v1.36.6 // protoc v5.29.3 // source: aptos.proto @@ -1189,6 +1189,7 @@ type SubmitTransactionReply struct { 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"` + TransactionFee *uint64 `protobuf:"varint,4,opt,name=transaction_fee,json=transactionFee,proto3,oneof" json:"transaction_fee,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -1244,6 +1245,13 @@ func (x *SubmitTransactionReply) GetTxIdempotencyKey() string { return "" } +func (x *SubmitTransactionReply) GetTransactionFee() uint64 { + if x != nil && x.TransactionFee != nil { + return *x.TransactionFee + } + return 0 +} + type GasConfig 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 @@ -1368,11 +1376,13 @@ const file_aptos_proto_rawDesc = "" + "\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" + + "\v_gas_config\"\xd4\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" + + "\x12tx_idempotency_key\x18\x03 \x01(\tR\x10txIdempotencyKey\x12,\n" + + "\x0ftransaction_fee\x18\x04 \x01(\x04H\x00R\x0etransactionFee\x88\x01\x01B\x12\n" + + "\x10_transaction_fee\"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" + @@ -1500,6 +1510,7 @@ func file_aptos_proto_init() { file_aptos_proto_msgTypes[14].OneofWrappers = []any{} file_aptos_proto_msgTypes[15].OneofWrappers = []any{} file_aptos_proto_msgTypes[17].OneofWrappers = []any{} + file_aptos_proto_msgTypes[18].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/pkg/chains/aptos/aptos.proto b/pkg/chains/aptos/aptos.proto index d5a66072a..914f37b42 100644 --- a/pkg/chains/aptos/aptos.proto +++ b/pkg/chains/aptos/aptos.proto @@ -152,6 +152,7 @@ message SubmitTransactionReply { TxStatus tx_status = 1; string tx_hash = 2; string tx_idempotency_key = 3; + optional uint64 transaction_fee = 4; } message GasConfig { diff --git a/pkg/chains/aptos/proto_helpers.go b/pkg/chains/aptos/proto_helpers.go index ce1573a0f..f752e9109 100644 --- a/pkg/chains/aptos/proto_helpers.go +++ b/pkg/chains/aptos/proto_helpers.go @@ -480,6 +480,7 @@ func ConvertSubmitTransactionReplyToProto(reply *typeaptos.SubmitTransactionRepl TxStatus: TxStatus(reply.TxStatus), TxHash: reply.TxHash, TxIdempotencyKey: reply.TxIdempotencyKey, + TransactionFee: reply.TransactionFee, }, nil } @@ -492,5 +493,6 @@ func ConvertSubmitTransactionReplyFromProto(proto *SubmitTransactionReply) (*typ TxStatus: typeaptos.TransactionStatus(proto.TxStatus), TxHash: proto.TxHash, TxIdempotencyKey: proto.TxIdempotencyKey, + TransactionFee: proto.TransactionFee, }, nil } diff --git a/pkg/chains/aptos/proto_helpers_test.go b/pkg/chains/aptos/proto_helpers_test.go index 7dc916b9a..dbc4180f2 100644 --- a/pkg/chains/aptos/proto_helpers_test.go +++ b/pkg/chains/aptos/proto_helpers_test.go @@ -304,10 +304,12 @@ func TestSubmitTransactionConverters(t *testing.T) { }) t.Run("SubmitTransactionReply roundtrip", func(t *testing.T) { + fee := uint64(1234) reply := &typeaptos.SubmitTransactionReply{ TxStatus: typeaptos.TxSuccess, TxHash: "0xabc123", TxIdempotencyKey: "key-456", + TransactionFee: &fee, } protoReply, err := conv.ConvertSubmitTransactionReplyToProto(reply) @@ -315,12 +317,15 @@ func TestSubmitTransactionConverters(t *testing.T) { 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, fee, protoReply.GetTransactionFee()) roundtrip, err := conv.ConvertSubmitTransactionReplyFromProto(protoReply) 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.NotNil(t, roundtrip.TransactionFee) + require.Equal(t, fee, *roundtrip.TransactionFee) }) t.Run("Invalid request errors", func(t *testing.T) { diff --git a/pkg/types/chains/aptos/aptos.go b/pkg/types/chains/aptos/aptos.go index a7a0c9736..5dc6f3bb6 100644 --- a/pkg/types/chains/aptos/aptos.go +++ b/pkg/types/chains/aptos/aptos.go @@ -227,6 +227,7 @@ type SubmitTransactionReply struct { TxStatus TransactionStatus TxHash string TxIdempotencyKey string + TransactionFee *uint64 } // GasConfig represents gas configuration for a transaction diff --git a/pkg/types/chains/aptos/write_status.go b/pkg/types/chains/aptos/write_status.go new file mode 100644 index 000000000..6f93d9c1a --- /dev/null +++ b/pkg/types/chains/aptos/write_status.go @@ -0,0 +1,222 @@ +package aptos + +import ( + "fmt" + "regexp" + "strconv" + "strings" +) + +type ReceiverExecutionStatus uint8 + +const ( + ReceiverExecutionStatusUnknown ReceiverExecutionStatus = iota + ReceiverExecutionStatusSuccess + ReceiverExecutionStatusReverted +) + +type WriteFailureDecision uint8 + +const ( + WriteFailureDecisionRetryable WriteFailureDecision = iota + WriteFailureDecisionTerminal + WriteFailureDecisionAlreadyProcessed +) + +type WriteFailureKind uint8 + +const ( + WriteFailureKindUnknown WriteFailureKind = iota + WriteFailureKindForwarderRejected + WriteFailureKindReceiverReverted + WriteFailureKindAlreadyProcessed +) + +type WriteFailureClassification struct { + Decision WriteFailureDecision + Kind WriteFailureKind + ReceiverExecutionStatus ReceiverExecutionStatus + Reason string + Message string +} + +func (c WriteFailureClassification) Retryable() bool { + return c.Decision == WriteFailureDecisionRetryable +} + +func (c WriteFailureClassification) AlreadyProcessed() bool { + return c.Decision == WriteFailureDecisionAlreadyProcessed +} + +func (c WriteFailureClassification) Terminal() bool { + return c.Decision != WriteFailureDecisionRetryable +} + +func (c WriteFailureClassification) MessagePtr() *string { + if c.Message == "" { + return nil + } + return &c.Message +} + +var ( + moveAbortLocationRE = regexp.MustCompile(`(?i)move abort(?:ed)?(?: in)? ([^:]+(?:::[^:]+)+):?\s*(.*)$`) + forwarderAbortNames = map[string]string{ + "E_INVALID_DATA_LENGTH": "forwarder rejected the report because the report data was malformed", + "E_INVALID_SIGNER": "forwarder rejected the report because a signer was not part of the DON config", + "E_DUPLICATE_SIGNER": "forwarder rejected the report because the signer set contained duplicates", + "E_INVALID_SIGNATURE_COUNT": "forwarder rejected the report because the signature count was invalid", + "E_INVALID_SIGNATURE": "forwarder rejected the report because a signature was invalid", + "E_ALREADY_PROCESSED": "report was already processed by another node", + "E_MALFORMED_SIGNATURE": "forwarder rejected the report because a signature was malformed", + "E_CALLBACK_DATA_NOT_CONSUMED": "forwarder callback data was not consumed by the receiver", + "E_CONFIG_ID_NOT_FOUND": "forwarder rejected the report because the DON config was not found", + "E_INVALID_REPORT_VERSION": "forwarder rejected the report because the report version was invalid", + } + forwarderAbortCodes = map[uint64]string{ + 1: "forwarder rejected the report because the report data was malformed", + 6: "report was already processed by another node", + 12: "forwarder callback data was not consumed by the receiver", + 15: "forwarder rejected the report because the DON config was not found", + 16: "forwarder rejected the report because the report version was invalid", + 65538: "forwarder rejected the report because a signer was not part of the DON config", + 65539: "forwarder rejected the report because the signer set contained duplicates", + 65540: "forwarder rejected the report because the signature count was invalid", + 65541: "forwarder rejected the report because a signature was invalid", + 65544: "forwarder rejected the report because a signature was malformed", + } +) + +func ClassifyWriteVmStatus(vmStatus string) WriteFailureClassification { + vmStatus = normalizeVmStatus(vmStatus) + if vmStatus == "" || strings.EqualFold(vmStatus, "Executed successfully") { + return WriteFailureClassification{ + Decision: WriteFailureDecisionRetryable, + Kind: WriteFailureKindUnknown, + Reason: "no vm status available", + } + } + + if strings.EqualFold(vmStatus, "Out of gas") { + return WriteFailureClassification{ + Decision: WriteFailureDecisionRetryable, + Kind: WriteFailureKindUnknown, + Reason: "transaction ran out of gas", + Message: vmStatus, + } + } + + location, details, ok := splitMoveAbort(vmStatus) + if !ok { + return WriteFailureClassification{ + Decision: WriteFailureDecisionRetryable, + Kind: WriteFailureKindUnknown, + Reason: "vm failure was not a parsed move abort", + Message: vmStatus, + } + } + + if !isForwarderLocation(location) { + return WriteFailureClassification{ + Decision: WriteFailureDecisionTerminal, + Kind: WriteFailureKindReceiverReverted, + ReceiverExecutionStatus: ReceiverExecutionStatusReverted, + Reason: "receiver or user module aborted", + Message: fmt.Sprintf("receiver execution failed: %s", vmStatus), + } + } + + if name := extractAbortName(details); name != "" { + if name == "E_ALREADY_PROCESSED" { + return WriteFailureClassification{ + Decision: WriteFailureDecisionAlreadyProcessed, + Kind: WriteFailureKindAlreadyProcessed, + Reason: "forwarder reported the report was already processed", + Message: fmt.Sprintf("%s: %s", forwarderAbortNames[name], vmStatus), + } + } + if msg, ok := forwarderAbortNames[name]; ok { + return WriteFailureClassification{ + Decision: WriteFailureDecisionTerminal, + Kind: WriteFailureKindForwarderRejected, + Reason: "forwarder reported a terminal validation failure", + Message: fmt.Sprintf("%s: %s", msg, vmStatus), + } + } + } + + if code, ok := extractAbortCode(details); ok { + if code == 6 { + return WriteFailureClassification{ + Decision: WriteFailureDecisionAlreadyProcessed, + Kind: WriteFailureKindAlreadyProcessed, + Reason: "forwarder reported the report was already processed", + Message: fmt.Sprintf("%s: %s", forwarderAbortCodes[code], vmStatus), + } + } + if msg, found := forwarderAbortCodes[code]; found { + return WriteFailureClassification{ + Decision: WriteFailureDecisionTerminal, + Kind: WriteFailureKindForwarderRejected, + Reason: "forwarder reported a terminal validation failure", + Message: fmt.Sprintf("%s: %s", msg, vmStatus), + } + } + } + + return WriteFailureClassification{ + Decision: WriteFailureDecisionRetryable, + Kind: WriteFailureKindUnknown, + Reason: "forwarder abort was not a known terminal code", + Message: vmStatus, + } +} + +func normalizeVmStatus(vmStatus string) string { + vmStatus = strings.TrimSpace(vmStatus) + vmStatus = strings.TrimPrefix(vmStatus, "simulated tx unexpected status: ") + vmStatus = strings.TrimPrefix(vmStatus, "simulate bad status: ") + return strings.TrimSpace(vmStatus) +} + +func splitMoveAbort(vmStatus string) (location string, details string, ok bool) { + matches := moveAbortLocationRE.FindStringSubmatch(vmStatus) + if len(matches) == 3 { + return strings.TrimSpace(matches[1]), strings.TrimSpace(matches[2]), true + } + if strings.Contains(strings.ToLower(vmStatus), "move abort") { + return "", strings.TrimSpace(vmStatus), true + } + return "", "", false +} + +func isForwarderLocation(location string) bool { + location = strings.ToLower(strings.TrimSpace(location)) + return strings.HasSuffix(location, "::forwarder") || strings.Contains(location, "platform::forwarder") +} + +func extractAbortName(details string) string { + for _, token := range strings.FieldsFunc(details, func(r rune) bool { + return !(r == '_' || ('A' <= r && r <= 'Z') || ('0' <= r && r <= '9')) + }) { + if strings.HasPrefix(token, "E_") { + return token + } + } + return "" +} + +func extractAbortCode(details string) (uint64, bool) { + for _, token := range strings.Fields(details) { + token = strings.Trim(token, "(),.;") + if strings.HasPrefix(strings.ToLower(token), "0x") { + if value, err := strconv.ParseUint(token[2:], 16, 64); err == nil { + return value, true + } + } + if value, err := strconv.ParseUint(token, 10, 64); err == nil { + return value, true + } + } + return 0, false +} diff --git a/pkg/types/chains/aptos/write_status_test.go b/pkg/types/chains/aptos/write_status_test.go new file mode 100644 index 000000000..65e1f2ae6 --- /dev/null +++ b/pkg/types/chains/aptos/write_status_test.go @@ -0,0 +1,58 @@ +package aptos + +import "testing" + +func TestClassifyWriteVmStatus(t *testing.T) { + t.Run("receiver revert is terminal and marks receiver reverted", func(t *testing.T) { + classification := ClassifyWriteVmStatus("Move abort in 0xabc::receiver::module: 42") + if classification.Decision != WriteFailureDecisionTerminal { + t.Fatalf("expected terminal, got %v", classification.Decision) + } + if classification.Kind != WriteFailureKindReceiverReverted { + t.Fatalf("expected receiver reverted kind, got %v", classification.Kind) + } + if classification.ReceiverExecutionStatus != ReceiverExecutionStatusReverted { + t.Fatalf("expected receiver reverted status, got %v", classification.ReceiverExecutionStatus) + } + }) + + t.Run("known forwarder abort is terminal", func(t *testing.T) { + classification := ClassifyWriteVmStatus("Move abort in 0x1::platform::forwarder: E_INVALID_SIGNATURE") + if classification.Decision != WriteFailureDecisionTerminal { + t.Fatalf("expected terminal, got %v", classification.Decision) + } + if classification.Kind != WriteFailureKindForwarderRejected { + t.Fatalf("expected forwarder rejected kind, got %v", classification.Kind) + } + }) + + t.Run("already processed is explicit decision", func(t *testing.T) { + classification := ClassifyWriteVmStatus("Move abort in 0x1::platform::forwarder: E_ALREADY_PROCESSED") + if classification.Decision != WriteFailureDecisionAlreadyProcessed { + t.Fatalf("expected already processed, got %v", classification.Decision) + } + if classification.Kind != WriteFailureKindAlreadyProcessed { + t.Fatalf("expected already processed kind, got %v", classification.Kind) + } + }) + + t.Run("unknown forwarder abort remains retryable", func(t *testing.T) { + classification := ClassifyWriteVmStatus("Move abort in 0x1::platform::forwarder: 99999") + if classification.Decision != WriteFailureDecisionRetryable { + t.Fatalf("expected retryable, got %v", classification.Decision) + } + if classification.Kind != WriteFailureKindUnknown { + t.Fatalf("expected unknown kind, got %v", classification.Kind) + } + }) + + t.Run("out of gas remains retryable", func(t *testing.T) { + classification := ClassifyWriteVmStatus("Out of gas") + if classification.Decision != WriteFailureDecisionRetryable { + t.Fatalf("expected retryable, got %v", classification.Decision) + } + if classification.Message == "" { + t.Fatal("expected out of gas message") + } + }) +}