mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-20 13:27:50 +02:00
looprpc: static address loop-ins
This commit is contained in:
parent
55ff8aa4a7
commit
b9e5875f4e
7 changed files with 1108 additions and 378 deletions
|
|
@ -238,9 +238,6 @@ func summary(ctx *cli.Context) error {
|
|||
case "expired":
|
||||
filterState = looprpc.DepositState_EXPIRED
|
||||
|
||||
case "failed":
|
||||
filterState = looprpc.DepositState_FAILED_STATE
|
||||
|
||||
default:
|
||||
filterState = looprpc.DepositState_UNKNOWN_STATE
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1563,13 +1563,13 @@ func (s *swapClientServer) depositSummary(ctx context.Context,
|
|||
}
|
||||
|
||||
return &looprpc.StaticAddressSummaryResponse{
|
||||
StaticAddress: address.String(),
|
||||
TotalNumDeposits: uint32(totalNumDeposits),
|
||||
ValueUnconfirmed: valueUnconfirmed,
|
||||
ValueDeposited: valueDeposited,
|
||||
ValueExpired: valueExpired,
|
||||
ValueWithdrawn: valueWithdrawn,
|
||||
FilteredDeposits: clientDeposits,
|
||||
StaticAddress: address.String(),
|
||||
TotalNumDeposits: uint32(totalNumDeposits),
|
||||
ValueUnconfirmedSatoshis: valueUnconfirmed,
|
||||
ValueDepositedSatoshis: valueDeposited,
|
||||
ValueExpiredSatoshis: valueExpired,
|
||||
ValueWithdrawnSatoshis: valueWithdrawn,
|
||||
FilteredDeposits: clientDeposits,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
|
@ -1618,9 +1618,6 @@ func toClientState(state fsm.StateType) looprpc.DepositState {
|
|||
case deposit.Expired:
|
||||
return looprpc.DepositState_EXPIRED
|
||||
|
||||
case deposit.Failed:
|
||||
return looprpc.DepositState_FAILED_STATE
|
||||
|
||||
default:
|
||||
return looprpc.DepositState_UNKNOWN_STATE
|
||||
}
|
||||
|
|
@ -1646,9 +1643,6 @@ func toServerState(state looprpc.DepositState) fsm.StateType {
|
|||
case looprpc.DepositState_EXPIRED:
|
||||
return deposit.Expired
|
||||
|
||||
case looprpc.DepositState_FAILED_STATE:
|
||||
return deposit.Failed
|
||||
|
||||
default:
|
||||
return fsm.EmptyState
|
||||
}
|
||||
|
|
|
|||
1111
looprpc/client.pb.go
1111
looprpc/client.pb.go
File diff suppressed because it is too large
Load diff
|
|
@ -174,6 +174,12 @@ service SwapClient {
|
|||
*/
|
||||
rpc GetStaticAddressSummary (StaticAddressSummaryRequest)
|
||||
returns (StaticAddressSummaryResponse);
|
||||
|
||||
/* loop:`static`
|
||||
StaticAddressLoopIn initiates a static address loop-in swap.
|
||||
*/
|
||||
rpc StaticAddressLoopIn (StaticAddressLoopInRequest)
|
||||
returns (StaticAddressLoopInResponse);
|
||||
}
|
||||
|
||||
message LoopOutRequest {
|
||||
|
|
@ -1565,6 +1571,15 @@ message WithdrawDepositsRequest {
|
|||
}
|
||||
|
||||
message WithdrawDepositsResponse {
|
||||
/*
|
||||
The transaction hash of the withdrawal transaction.
|
||||
*/
|
||||
string withdrawal_tx_hash = 1;
|
||||
|
||||
/*
|
||||
The pkscript of the withdrawal transaction.
|
||||
*/
|
||||
string pk_script = 2;
|
||||
}
|
||||
|
||||
message OutPoint {
|
||||
|
|
@ -1610,27 +1625,37 @@ message StaticAddressSummaryResponse {
|
|||
/*
|
||||
The total value of unconfirmed deposits.
|
||||
*/
|
||||
int64 value_unconfirmed = 3;
|
||||
int64 value_unconfirmed_satoshis = 3;
|
||||
|
||||
/*
|
||||
The total value of confirmed deposits.
|
||||
*/
|
||||
int64 value_deposited = 4;
|
||||
int64 value_deposited_satoshis = 4;
|
||||
|
||||
/*
|
||||
The total value of all expired deposits.
|
||||
*/
|
||||
int64 value_expired = 5;
|
||||
int64 value_expired_satoshis = 5;
|
||||
|
||||
/*
|
||||
The total value of all deposits that have been withdrawn.
|
||||
*/
|
||||
int64 value_withdrawn = 6;
|
||||
int64 value_withdrawn_satoshis = 6;
|
||||
|
||||
/*
|
||||
The total value of all loop-ins that have been finalized.
|
||||
*/
|
||||
int64 value_looped_in_satoshis = 7;
|
||||
|
||||
/*
|
||||
The total value of all htlc timeout sweeps that the client swept.
|
||||
*/
|
||||
int64 value_htlc_timeout_sweeps_satoshis = 8;
|
||||
|
||||
/*
|
||||
A list of all deposits that match the filtered state.
|
||||
*/
|
||||
repeated Deposit filtered_deposits = 7;
|
||||
repeated Deposit filtered_deposits = 9;
|
||||
}
|
||||
|
||||
enum DepositState {
|
||||
|
|
@ -1657,28 +1682,48 @@ enum DepositState {
|
|||
*/
|
||||
WITHDRAWN = 3;
|
||||
|
||||
/*
|
||||
LOOPING_IN indicates that the deposit is currently being used in a static
|
||||
address loop-in swap.
|
||||
*/
|
||||
LOOPING_IN = 4;
|
||||
|
||||
/*
|
||||
LOOPED_IN indicates that the deposit was used in a static address loop-in
|
||||
swap.
|
||||
*/
|
||||
LOOPED_IN = 5;
|
||||
|
||||
/*
|
||||
SWEEP_HTLC_TIMEOUT indicates that the deposit is part of an active loop-in
|
||||
of which the respective htlc was published by the server and the timeout
|
||||
path has opened up for the client to sweep.
|
||||
*/
|
||||
SWEEP_HTLC_TIMEOUT = 6;
|
||||
|
||||
/*
|
||||
HTLC_TIMEOUT_SWEPT indicates that the timeout path of the htlc has been
|
||||
swept by the client.
|
||||
*/
|
||||
HTLC_TIMEOUT_SWEPT = 7;
|
||||
|
||||
/*
|
||||
PUBLISH_EXPIRED indicates that the deposit has expired and the sweep
|
||||
transaction has been published.
|
||||
*/
|
||||
PUBLISH_EXPIRED = 4;
|
||||
PUBLISH_EXPIRED = 8;
|
||||
|
||||
/*
|
||||
WAIT_FOR_EXPIRY_SWEEP indicates that the deposit has expired and the sweep
|
||||
transaction has not yet been sufficiently confirmed.
|
||||
*/
|
||||
WAIT_FOR_EXPIRY_SWEEP = 5;
|
||||
WAIT_FOR_EXPIRY_SWEEP = 9;
|
||||
|
||||
/*
|
||||
EXPIRED indicates that the deposit has expired and the sweep transaction
|
||||
has been sufficiently confirmed.
|
||||
*/
|
||||
EXPIRED = 6;
|
||||
|
||||
/*
|
||||
FAILED_STATE indicates that the deposit has failed.
|
||||
*/
|
||||
FAILED_STATE = 7;
|
||||
EXPIRED = 10;
|
||||
}
|
||||
|
||||
message Deposit {
|
||||
|
|
@ -1707,3 +1752,124 @@ message Deposit {
|
|||
*/
|
||||
int64 confirmation_height = 5;
|
||||
}
|
||||
|
||||
message StaticAddressLoopInRequest {
|
||||
/*
|
||||
The outpoints of the deposits to loop-in.
|
||||
*/
|
||||
repeated string outpoints = 1;
|
||||
|
||||
/*
|
||||
Maximum satoshis we are willing to pay the server for the swap. This value
|
||||
is not disclosed in the swap initiation call, but if the server asks for a
|
||||
higher fee, we abort the swap. Typically this value is taken from the
|
||||
response of the GetQuote call.
|
||||
*/
|
||||
int64 max_swap_fee_satoshis = 2;
|
||||
|
||||
/*
|
||||
Optionally the client can specify the last hop pubkey when requesting a
|
||||
loop-in quote. This is useful to get better off-chain routing fee from the
|
||||
server.
|
||||
*/
|
||||
bytes last_hop = 3;
|
||||
|
||||
/*
|
||||
An optional label for this swap. This field is limited to 500 characters and
|
||||
may not be one of the reserved values in loop/labels Reserved list.
|
||||
*/
|
||||
string label = 4;
|
||||
|
||||
/*
|
||||
An optional identification string that will be appended to the user agent
|
||||
string sent to the server to give information about the usage of loop. This
|
||||
initiator part is meant for user interfaces to add their name to give the
|
||||
full picture of the binary used (loopd, LiT) and the method used for
|
||||
triggering the swap (loop CLI, autolooper, LiT UI, other 3rd party UI).
|
||||
*/
|
||||
string initiator = 5;
|
||||
|
||||
/*
|
||||
Optional route hints to reach the destination through private channels.
|
||||
*/
|
||||
repeated looprpc.RouteHint route_hints = 6;
|
||||
|
||||
/*
|
||||
Private indicates whether the destination node should be considered private.
|
||||
In which case, loop will generate hop hints to assist with probing and
|
||||
payment.
|
||||
*/
|
||||
bool private = 7;
|
||||
|
||||
/*
|
||||
The swap payment timeout allows the user to specify an upper limit for the
|
||||
amount of time the server is allowed to take to fulfill the off-chain swap
|
||||
payment. If the timeout is reached the swap will be aborted on the server
|
||||
side and the client can retry the swap with different parameters.
|
||||
*/
|
||||
uint32 payment_timeout_seconds = 8;
|
||||
}
|
||||
|
||||
message StaticAddressLoopInResponse {
|
||||
/*
|
||||
The swap hash that identifies this swap.
|
||||
*/
|
||||
bytes swap_hash = 1;
|
||||
|
||||
/*
|
||||
The state the swap is in.
|
||||
*/
|
||||
string state = 2;
|
||||
|
||||
/*
|
||||
The amount of the swap.
|
||||
*/
|
||||
uint64 amount = 3;
|
||||
|
||||
/*
|
||||
The htlc cltv expiry height of the swap.
|
||||
*/
|
||||
int32 htlc_cltv = 4;
|
||||
|
||||
/*
|
||||
The quoted swap fee in satoshis.
|
||||
*/
|
||||
int64 quoted_swap_fee_satoshis = 5;
|
||||
|
||||
/*
|
||||
The maximum total swap fee the client is willing to pay for the swap.
|
||||
*/
|
||||
int64 max_swap_fee_satoshis = 6;
|
||||
|
||||
/*
|
||||
The block height at which the swap was initiated.
|
||||
*/
|
||||
uint32 initiation_height = 7;
|
||||
|
||||
/*
|
||||
The static address protocol version.
|
||||
*/
|
||||
string protocol_version = 8;
|
||||
|
||||
/*
|
||||
An optional label for this swap.
|
||||
*/
|
||||
string label = 9;
|
||||
|
||||
/*
|
||||
An optional identification string that will be appended to the user agent
|
||||
string sent to the server to give information about the usage of loop. This
|
||||
initiator part is meant for user interfaces to add their name to give the
|
||||
full picture of the binary used (loopd, LiT) and the method used for
|
||||
triggering the swap (loop CLI, autolooper, LiT UI, other 3rd party UI).
|
||||
*/
|
||||
string initiator = 10;
|
||||
|
||||
/*
|
||||
The swap payment timeout allows the user to specify an upper limit for the
|
||||
amount of time the server is allowed to take to fulfill the off-chain swap
|
||||
payment. If the timeout is reached the swap will be aborted on the server
|
||||
side and the client can retry the swap with different parameters.
|
||||
*/
|
||||
uint32 payment_timeout_seconds = 11;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -698,13 +698,16 @@
|
|||
"DEPOSITED",
|
||||
"WITHDRAWING",
|
||||
"WITHDRAWN",
|
||||
"LOOPING_IN",
|
||||
"LOOPED_IN",
|
||||
"SWEEP_HTLC_TIMEOUT",
|
||||
"HTLC_TIMEOUT_SWEPT",
|
||||
"PUBLISH_EXPIRED",
|
||||
"WAIT_FOR_EXPIRY_SWEEP",
|
||||
"EXPIRED",
|
||||
"FAILED_STATE"
|
||||
"EXPIRED"
|
||||
],
|
||||
"default": "UNKNOWN_STATE",
|
||||
"description": " - UNKNOWN_STATE: UNKNOWN_STATE is the default state of a deposit.\n - DEPOSITED: DEPOSITED indicates that the deposit has been sufficiently confirmed on\nchain.\n - WITHDRAWING: WITHDRAWING indicates that the deposit is currently being withdrawn. It\nflips to WITHDRAWN once the withdrawal transaction has been sufficiently\nconfirmed.\n - WITHDRAWN: WITHDRAWN indicates that the deposit has been withdrawn.\n - PUBLISH_EXPIRED: PUBLISH_EXPIRED indicates that the deposit has expired and the sweep\ntransaction has been published.\n - WAIT_FOR_EXPIRY_SWEEP: WAIT_FOR_EXPIRY_SWEEP indicates that the deposit has expired and the sweep\ntransaction has not yet been sufficiently confirmed.\n - EXPIRED: EXPIRED indicates that the deposit has expired and the sweep transaction\nhas been sufficiently confirmed.\n - FAILED_STATE: FAILED_STATE indicates that the deposit has failed."
|
||||
"description": " - UNKNOWN_STATE: UNKNOWN_STATE is the default state of a deposit.\n - DEPOSITED: DEPOSITED indicates that the deposit has been sufficiently confirmed on\nchain.\n - WITHDRAWING: WITHDRAWING indicates that the deposit is currently being withdrawn. It\nflips to WITHDRAWN once the withdrawal transaction has been sufficiently\nconfirmed.\n - WITHDRAWN: WITHDRAWN indicates that the deposit has been withdrawn.\n - LOOPING_IN: LOOPING_IN indicates that the deposit is currently being used in a static\naddress loop-in swap.\n - LOOPED_IN: LOOPED_IN indicates that the deposit was used in a static address loop-in\nswap.\n - SWEEP_HTLC_TIMEOUT: SWEEP_HTLC_TIMEOUT indicates that the deposit is part of an active loop-in\nof which the respective htlc was published by the server and the timeout\npath has opened up for the client to sweep.\n - HTLC_TIMEOUT_SWEPT: HTLC_TIMEOUT_SWEPT indicates that the timeout path of the htlc has been\nswept by the client.\n - PUBLISH_EXPIRED: PUBLISH_EXPIRED indicates that the deposit has expired and the sweep\ntransaction has been published.\n - WAIT_FOR_EXPIRY_SWEEP: WAIT_FOR_EXPIRY_SWEEP indicates that the deposit has expired and the sweep\ntransaction has not yet been sufficiently confirmed.\n - EXPIRED: EXPIRED indicates that the deposit has expired and the sweep transaction\nhas been sufficiently confirmed."
|
||||
},
|
||||
"looprpcDisqualified": {
|
||||
"type": "object",
|
||||
|
|
@ -1506,6 +1509,62 @@
|
|||
"looprpcSetLiquidityParamsResponse": {
|
||||
"type": "object"
|
||||
},
|
||||
"looprpcStaticAddressLoopInResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"swap_hash": {
|
||||
"type": "string",
|
||||
"format": "byte",
|
||||
"description": "The swap hash that identifies this swap."
|
||||
},
|
||||
"state": {
|
||||
"type": "string",
|
||||
"description": "The state the swap is in."
|
||||
},
|
||||
"amount": {
|
||||
"type": "string",
|
||||
"format": "uint64",
|
||||
"description": "The amount of the swap."
|
||||
},
|
||||
"htlc_cltv": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"description": "The htlc cltv expiry height of the swap."
|
||||
},
|
||||
"quoted_swap_fee_satoshis": {
|
||||
"type": "string",
|
||||
"format": "int64",
|
||||
"description": "The quoted swap fee in satoshis."
|
||||
},
|
||||
"max_swap_fee_satoshis": {
|
||||
"type": "string",
|
||||
"format": "int64",
|
||||
"description": "The maximum total swap fee the client is willing to pay for the swap."
|
||||
},
|
||||
"initiation_height": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "The block height at which the swap was initiated."
|
||||
},
|
||||
"protocol_version": {
|
||||
"type": "string",
|
||||
"description": "The static address protocol version."
|
||||
},
|
||||
"label": {
|
||||
"type": "string",
|
||||
"description": "An optional label for this swap."
|
||||
},
|
||||
"initiator": {
|
||||
"type": "string",
|
||||
"description": "An optional identification string that will be appended to the user agent\nstring sent to the server to give information about the usage of loop. This\ninitiator part is meant for user interfaces to add their name to give the\nfull picture of the binary used (loopd, LiT) and the method used for\ntriggering the swap (loop CLI, autolooper, LiT UI, other 3rd party UI)."
|
||||
},
|
||||
"payment_timeout_seconds": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "The swap payment timeout allows the user to specify an upper limit for the\namount of time the server is allowed to take to fulfill the off-chain swap\npayment. If the timeout is reached the swap will be aborted on the server\nside and the client can retry the swap with different parameters."
|
||||
}
|
||||
}
|
||||
},
|
||||
"looprpcStaticAddressSummaryResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
|
@ -1518,26 +1577,36 @@
|
|||
"format": "int64",
|
||||
"description": "The total number of deposits."
|
||||
},
|
||||
"value_unconfirmed": {
|
||||
"value_unconfirmed_satoshis": {
|
||||
"type": "string",
|
||||
"format": "int64",
|
||||
"description": "The total value of unconfirmed deposits."
|
||||
},
|
||||
"value_deposited": {
|
||||
"value_deposited_satoshis": {
|
||||
"type": "string",
|
||||
"format": "int64",
|
||||
"description": "The total value of confirmed deposits."
|
||||
},
|
||||
"value_expired": {
|
||||
"value_expired_satoshis": {
|
||||
"type": "string",
|
||||
"format": "int64",
|
||||
"description": "The total value of all expired deposits."
|
||||
},
|
||||
"value_withdrawn": {
|
||||
"value_withdrawn_satoshis": {
|
||||
"type": "string",
|
||||
"format": "int64",
|
||||
"description": "The total value of all deposits that have been withdrawn."
|
||||
},
|
||||
"value_looped_in_satoshis": {
|
||||
"type": "string",
|
||||
"format": "int64",
|
||||
"description": "The total value of all loop-ins that have been finalized."
|
||||
},
|
||||
"value_htlc_timeout_sweeps_satoshis": {
|
||||
"type": "string",
|
||||
"format": "int64",
|
||||
"description": "The total value of all htlc timeout sweeps that the client swept."
|
||||
},
|
||||
"filtered_deposits": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
|
|
@ -1746,7 +1815,17 @@
|
|||
}
|
||||
},
|
||||
"looprpcWithdrawDepositsResponse": {
|
||||
"type": "object"
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"withdrawal_tx_hash": {
|
||||
"type": "string",
|
||||
"description": "The transaction hash of the withdrawal transaction."
|
||||
},
|
||||
"pk_script": {
|
||||
"type": "string",
|
||||
"description": "The pkscript of the withdrawal transaction."
|
||||
}
|
||||
}
|
||||
},
|
||||
"protobufAny": {
|
||||
"type": "object",
|
||||
|
|
|
|||
|
|
@ -119,6 +119,9 @@ type SwapClientClient interface {
|
|||
// GetStaticAddressSummary returns a summary of static address related
|
||||
// statistics.
|
||||
GetStaticAddressSummary(ctx context.Context, in *StaticAddressSummaryRequest, opts ...grpc.CallOption) (*StaticAddressSummaryResponse, error)
|
||||
// loop:`static`
|
||||
// StaticAddressLoopIn initiates a static address loop-in swap.
|
||||
StaticAddressLoopIn(ctx context.Context, in *StaticAddressLoopInRequest, opts ...grpc.CallOption) (*StaticAddressLoopInResponse, error)
|
||||
}
|
||||
|
||||
type swapClientClient struct {
|
||||
|
|
@ -386,6 +389,15 @@ func (c *swapClientClient) GetStaticAddressSummary(ctx context.Context, in *Stat
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (c *swapClientClient) StaticAddressLoopIn(ctx context.Context, in *StaticAddressLoopInRequest, opts ...grpc.CallOption) (*StaticAddressLoopInResponse, error) {
|
||||
out := new(StaticAddressLoopInResponse)
|
||||
err := c.cc.Invoke(ctx, "/looprpc.SwapClient/StaticAddressLoopIn", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// SwapClientServer is the server API for SwapClient service.
|
||||
// All implementations must embed UnimplementedSwapClientServer
|
||||
// for forward compatibility
|
||||
|
|
@ -491,6 +503,9 @@ type SwapClientServer interface {
|
|||
// GetStaticAddressSummary returns a summary of static address related
|
||||
// statistics.
|
||||
GetStaticAddressSummary(context.Context, *StaticAddressSummaryRequest) (*StaticAddressSummaryResponse, error)
|
||||
// loop:`static`
|
||||
// StaticAddressLoopIn initiates a static address loop-in swap.
|
||||
StaticAddressLoopIn(context.Context, *StaticAddressLoopInRequest) (*StaticAddressLoopInResponse, error)
|
||||
mustEmbedUnimplementedSwapClientServer()
|
||||
}
|
||||
|
||||
|
|
@ -576,6 +591,9 @@ func (UnimplementedSwapClientServer) WithdrawDeposits(context.Context, *Withdraw
|
|||
func (UnimplementedSwapClientServer) GetStaticAddressSummary(context.Context, *StaticAddressSummaryRequest) (*StaticAddressSummaryResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetStaticAddressSummary not implemented")
|
||||
}
|
||||
func (UnimplementedSwapClientServer) StaticAddressLoopIn(context.Context, *StaticAddressLoopInRequest) (*StaticAddressLoopInResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method StaticAddressLoopIn not implemented")
|
||||
}
|
||||
func (UnimplementedSwapClientServer) mustEmbedUnimplementedSwapClientServer() {}
|
||||
|
||||
// UnsafeSwapClientServer may be embedded to opt out of forward compatibility for this service.
|
||||
|
|
@ -1060,6 +1078,24 @@ func _SwapClient_GetStaticAddressSummary_Handler(srv interface{}, ctx context.Co
|
|||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _SwapClient_StaticAddressLoopIn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(StaticAddressLoopInRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(SwapClientServer).StaticAddressLoopIn(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/looprpc.SwapClient/StaticAddressLoopIn",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(SwapClientServer).StaticAddressLoopIn(ctx, req.(*StaticAddressLoopInRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// SwapClient_ServiceDesc is the grpc.ServiceDesc for SwapClient service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
|
|
@ -1167,6 +1203,10 @@ var SwapClient_ServiceDesc = grpc.ServiceDesc{
|
|||
MethodName: "GetStaticAddressSummary",
|
||||
Handler: _SwapClient_GetStaticAddressSummary_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "StaticAddressLoopIn",
|
||||
Handler: _SwapClient_StaticAddressLoopIn_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{
|
||||
{
|
||||
|
|
|
|||
|
|
@ -687,4 +687,29 @@ func RegisterSwapClientJSONCallbacks(registry map[string]func(ctx context.Contex
|
|||
}
|
||||
callback(string(respBytes), nil)
|
||||
}
|
||||
|
||||
registry["looprpc.SwapClient.StaticAddressLoopIn"] = func(ctx context.Context,
|
||||
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
||||
|
||||
req := &StaticAddressLoopInRequest{}
|
||||
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
||||
if err != nil {
|
||||
callback("", err)
|
||||
return
|
||||
}
|
||||
|
||||
client := NewSwapClientClient(conn)
|
||||
resp, err := client.StaticAddressLoopIn(ctx, req)
|
||||
if err != nil {
|
||||
callback("", err)
|
||||
return
|
||||
}
|
||||
|
||||
respBytes, err := marshaler.Marshal(resp)
|
||||
if err != nil {
|
||||
callback("", err)
|
||||
return
|
||||
}
|
||||
callback(string(respBytes), nil)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue