Skip to content

Commit

Permalink
Updated to support reflection
Browse files Browse the repository at this point in the history
  • Loading branch information
kpachhai committed Dec 2, 2024
1 parent 49f89ef commit f52de6a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
25 changes: 20 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,21 @@ The REST API is available at `http://localhost:8080`.
"MaxFee": 53000,
"Success": true,
"Fee": 48500,
"Outputs": {
"receiver_balance": 100000000000,
"sender_balance": 852999899999951500
},
"Actions": [
{
"ActionType": 0,
"Input": {
"AssetAddress": "0x00cf77495ce1bdbf11e5e45463fad5a862cb6cc0a20e00e658c4ac3355dcdc64bb",
"Memo": "",
"To": "0x00f570339dce77fb2694edac17c9e6f36c0945959813b99b0b1a18849a7d622237",
"Value": 100000000000
},
"Output": {
"receiver_balance": 100000000000,
"sender_balance": 852999899999951500
}
}
],
"Timestamp": "2024-12-02T10:22:50Z"
}
]
Expand All @@ -339,12 +350,16 @@ The REST API is available at `http://localhost:8080`.
"ID": 2,
"TxHash": "WPfzKZZAeug9wakxdzpQyp2qzJ27Kbi8BEfEY3KQDAKfiBbDp",
"ActionType": 0,
"ActionDetails": {
"Input": {
"AssetAddress": "0x00cf77495ce1bdbf11e5e45463fad5a862cb6cc0a20e00e658c4ac3355dcdc64bb",
"Memo": "",
"To": "0x00f570339dce77fb2694edac17c9e6f36c0945959813b99b0b1a18849a7d622237",
"Value": 100000000000
},
"Output": {
"receiver_balance": 100000000000,
"sender_balance": 852999899999951500
}
"Timestamp": "2024-12-02T10:22:50Z"
}
]
Expand Down
6 changes: 6 additions & 0 deletions grpc/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
pb "github.com/ava-labs/hypersdk/proto/pb/externalsubscriber"
"github.com/nuklai/nuklaivm/vm"
"google.golang.org/grpc"
"google.golang.org/grpc/reflection"
"google.golang.org/protobuf/types/known/emptypb"
)

Expand All @@ -41,8 +42,13 @@ func StartGRPCServer(db *sql.DB, port string) {
}

grpcServer := grpc.NewServer()

// Register your ExternalSubscriber service
pb.RegisterExternalSubscriberServer(grpcServer, &Server{db: db})

// Enable gRPC reflection for tools like grpcurl
reflection.Register(grpcServer)

fmt.Printf("External Subscriber server is listening on port %s...\n", port)
if err := grpcServer.Serve(lis); err != nil {
log.Fatalf("Failed to serve: %v", err)
Expand Down

0 comments on commit f52de6a

Please sign in to comment.