* Cleanup common

* Cleanup client

* Cleanup server

* Renamings

* Tidy up proto

* Update ocean protos

* Fixes

* Fixes
This commit is contained in:
Pietralberto Mazza
2024-02-28 18:05:03 +01:00
committed by GitHub
parent 1650ea5935
commit 6d0d03e316
31 changed files with 2475 additions and 2217 deletions

View File

@@ -372,11 +372,11 @@
"pubkey": {
"type": "string"
},
"lifetime": {
"roundLifetime": {
"type": "string",
"format": "int64"
},
"exitDelay": {
"unilateralExitDelay": {
"type": "string",
"format": "int64"
}

View File

@@ -169,6 +169,15 @@
}
}
},
"v1LockUtxosResponse": {
"type": "object",
"properties": {
"expirationDate": {
"type": "string",
"format": "int64"
}
}
},
"v1MintResponse": {
"type": "object",
"properties": {

View File

@@ -56,15 +56,6 @@ service ArkService {
}
}
message OnboardRequest {
string boarding_tx = 1;
Tree congestion_tree = 2;
string user_pubkey = 3;
}
message OnboardResponse {
}
message RegisterPaymentRequest {
repeated Input inputs = 1;
}
@@ -94,6 +85,63 @@ message GetRoundResponse {
Round round = 1;
}
message GetEventStreamRequest {}
message GetEventStreamResponse {
oneof event {
RoundFinalizationEvent round_finalization = 1;
RoundFinalizedEvent round_finalized = 2;
RoundFailed round_failed = 3;
}
}
message PingRequest {
string payment_id = 1;
}
message PingResponse {}
message ListVtxosRequest {
string address = 1;
}
message ListVtxosResponse {
repeated Vtxo vtxos = 1;
}
message GetInfoRequest {}
message GetInfoResponse {
string pubkey = 1;
int64 round_lifetime = 2;
int64 unilateral_exit_delay = 3;
}
message OnboardRequest {
string boarding_tx = 1;
Tree congestion_tree = 2;
string user_pubkey = 3;
}
message OnboardResponse {
}
// EVENT TYPES
message RoundFinalizationEvent {
string id = 1;
string pool_partial_tx = 2;
repeated string forfeit_txs = 3;
Tree congestion_tree = 4;
}
message RoundFinalizedEvent {
string id = 1;
string pool_txid = 2;
}
message RoundFailed {
string id = 1;
string reason = 2;
}
// TYPES
message Round {
string id = 1;
int64 start = 2;
@@ -114,13 +162,6 @@ message Output {
uint64 amount = 2;
}
message RoundFinalizationEvent {
string id = 1;
string pool_partial_tx = 2;
repeated string forfeit_txs = 3;
Tree congestion_tree = 4;
}
message Tree {
repeated TreeLevel levels = 1;
}
@@ -135,51 +176,9 @@ message Node {
string parent_txid = 3;
}
message RoundFinalizedEvent {
string id = 1;
string pool_txid = 2;
}
message RoundFailed {
string id = 1;
string reason = 2;
}
message GetEventStreamRequest {}
message GetEventStreamResponse {
oneof event {
RoundFinalizationEvent round_finalization = 1;
RoundFinalizedEvent round_finalized = 2;
RoundFailed round_failed = 3;
}
}
message PingRequest {
string payment_id = 1;
}
message PingResponse {}
message ListVtxosRequest {
string address = 1;
}
message ListVtxosResponse {
repeated Vtxo vtxos = 1;
}
message Vtxo {
Input outpoint = 1;
Output receiver = 2;
bool spent = 3;
string pool_txid = 4;
}
message GetInfoRequest {}
message GetInfoResponse {
string pubkey = 1;
int64 lifetime = 2;
int64 exit_delay = 3;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -25,6 +25,8 @@ type TransactionServiceClient interface {
// Selected utxos are locked for predefined amount of time to prevent
// double-spending them.
SelectUtxos(ctx context.Context, in *SelectUtxosRequest, opts ...grpc.CallOption) (*SelectUtxosResponse, error)
// LockUtxos allows to manually select utxos to spend by a subsequent tx.
LockUtxos(ctx context.Context, in *LockUtxosRequest, opts ...grpc.CallOption) (*LockUtxosResponse, error)
// EstimateFees returns the fee amount to pay for a tx containing the given
// inputs and outputs.
EstimateFees(ctx context.Context, in *EstimateFeesRequest, opts ...grpc.CallOption) (*EstimateFeesResponse, error)
@@ -87,6 +89,15 @@ func (c *transactionServiceClient) SelectUtxos(ctx context.Context, in *SelectUt
return out, nil
}
func (c *transactionServiceClient) LockUtxos(ctx context.Context, in *LockUtxosRequest, opts ...grpc.CallOption) (*LockUtxosResponse, error) {
out := new(LockUtxosResponse)
err := c.cc.Invoke(ctx, "/ocean.v1.TransactionService/LockUtxos", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *transactionServiceClient) EstimateFees(ctx context.Context, in *EstimateFeesRequest, opts ...grpc.CallOption) (*EstimateFeesResponse, error) {
out := new(EstimateFeesResponse)
err := c.cc.Invoke(ctx, "/ocean.v1.TransactionService/EstimateFees", in, out, opts...)
@@ -224,6 +235,8 @@ type TransactionServiceServer interface {
// Selected utxos are locked for predefined amount of time to prevent
// double-spending them.
SelectUtxos(context.Context, *SelectUtxosRequest) (*SelectUtxosResponse, error)
// LockUtxos allows to manually select utxos to spend by a subsequent tx.
LockUtxos(context.Context, *LockUtxosRequest) (*LockUtxosResponse, error)
// EstimateFees returns the fee amount to pay for a tx containing the given
// inputs and outputs.
EstimateFees(context.Context, *EstimateFeesRequest) (*EstimateFeesResponse, error)
@@ -270,6 +283,9 @@ func (UnimplementedTransactionServiceServer) GetTransaction(context.Context, *Ge
func (UnimplementedTransactionServiceServer) SelectUtxos(context.Context, *SelectUtxosRequest) (*SelectUtxosResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SelectUtxos not implemented")
}
func (UnimplementedTransactionServiceServer) LockUtxos(context.Context, *LockUtxosRequest) (*LockUtxosResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method LockUtxos not implemented")
}
func (UnimplementedTransactionServiceServer) EstimateFees(context.Context, *EstimateFeesRequest) (*EstimateFeesResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method EstimateFees not implemented")
}
@@ -360,6 +376,24 @@ func _TransactionService_SelectUtxos_Handler(srv interface{}, ctx context.Contex
return interceptor(ctx, in, info, handler)
}
func _TransactionService_LockUtxos_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(LockUtxosRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(TransactionServiceServer).LockUtxos(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/ocean.v1.TransactionService/LockUtxos",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TransactionServiceServer).LockUtxos(ctx, req.(*LockUtxosRequest))
}
return interceptor(ctx, in, info, handler)
}
func _TransactionService_EstimateFees_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(EstimateFeesRequest)
if err := dec(in); err != nil {
@@ -627,6 +661,10 @@ var TransactionService_ServiceDesc = grpc.ServiceDesc{
MethodName: "SelectUtxos",
Handler: _TransactionService_SelectUtxos_Handler,
},
{
MethodName: "LockUtxos",
Handler: _TransactionService_LockUtxos_Handler,
},
{
MethodName: "EstimateFees",
Handler: _TransactionService_EstimateFees_Handler,