From f521327cb50bfdbfd0b906310f2320141d240eb0 Mon Sep 17 00:00:00 2001 From: Wilmer Paulino Date: Tue, 9 Jun 2020 16:52:50 -0700 Subject: [PATCH] clmrpc: add DepositAccount RPC --- clmrpc/trader.pb.go | 332 +++++++++++++++++++++++++++---------- clmrpc/trader.pb.gw.go | 156 ++++++++--------- clmrpc/trader.proto | 38 ++++- clmrpc/trader.swagger.json | 140 +++++++++++----- cmd/agora/account.go | 4 +- rpcserver.go | 46 ++++- 6 files changed, 501 insertions(+), 215 deletions(-) diff --git a/clmrpc/trader.pb.go b/clmrpc/trader.pb.go index c19ace8..3c53fe6 100644 --- a/clmrpc/trader.pb.go +++ b/clmrpc/trader.pb.go @@ -194,7 +194,7 @@ func (m *ListAccountsResponse) GetAccounts() []*Account { type Output struct { // The value, in satoshis, of the output. - Value uint64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` + ValueSat uint64 `protobuf:"varint,1,opt,name=value_sat,json=valueSat,proto3" json:"value_sat,omitempty"` // The address corresponding to the output. Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -227,9 +227,9 @@ func (m *Output) XXX_DiscardUnknown() { var xxx_messageInfo_Output proto.InternalMessageInfo -func (m *Output) GetValue() uint64 { +func (m *Output) GetValueSat() uint64 { if m != nil { - return m.Value + return m.ValueSat } return 0 } @@ -443,6 +443,116 @@ func (m *WithdrawAccountResponse) GetWithdrawTxid() []byte { return nil } +type DepositAccountRequest struct { + // + //The trader key associated with the account that funds will be deposited + //into. + TraderKey []byte `protobuf:"bytes,1,opt,name=trader_key,json=traderKey,proto3" json:"trader_key,omitempty"` + // The amount in satoshis to deposit into the account. + AmountSat uint64 `protobuf:"varint,2,opt,name=amount_sat,json=amountSat,proto3" json:"amount_sat,omitempty"` + // + //The fee rate, in satoshis per vbyte, to use for the deposit transaction. + SatPerVbyte uint32 `protobuf:"varint,3,opt,name=sat_per_vbyte,json=satPerVbyte,proto3" json:"sat_per_vbyte,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DepositAccountRequest) Reset() { *m = DepositAccountRequest{} } +func (m *DepositAccountRequest) String() string { return proto.CompactTextString(m) } +func (*DepositAccountRequest) ProtoMessage() {} +func (*DepositAccountRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b8f61804588c75fe, []int{8} +} + +func (m *DepositAccountRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DepositAccountRequest.Unmarshal(m, b) +} +func (m *DepositAccountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DepositAccountRequest.Marshal(b, m, deterministic) +} +func (m *DepositAccountRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_DepositAccountRequest.Merge(m, src) +} +func (m *DepositAccountRequest) XXX_Size() int { + return xxx_messageInfo_DepositAccountRequest.Size(m) +} +func (m *DepositAccountRequest) XXX_DiscardUnknown() { + xxx_messageInfo_DepositAccountRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_DepositAccountRequest proto.InternalMessageInfo + +func (m *DepositAccountRequest) GetTraderKey() []byte { + if m != nil { + return m.TraderKey + } + return nil +} + +func (m *DepositAccountRequest) GetAmountSat() uint64 { + if m != nil { + return m.AmountSat + } + return 0 +} + +func (m *DepositAccountRequest) GetSatPerVbyte() uint32 { + if m != nil { + return m.SatPerVbyte + } + return 0 +} + +type DepositAccountResponse struct { + // The state of the account after processing the deposit. + Account *Account `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"` + // The transaction used to deposit funds into the account. + DepositTxid []byte `protobuf:"bytes,2,opt,name=deposit_txid,json=depositTxid,proto3" json:"deposit_txid,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DepositAccountResponse) Reset() { *m = DepositAccountResponse{} } +func (m *DepositAccountResponse) String() string { return proto.CompactTextString(m) } +func (*DepositAccountResponse) ProtoMessage() {} +func (*DepositAccountResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b8f61804588c75fe, []int{9} +} + +func (m *DepositAccountResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DepositAccountResponse.Unmarshal(m, b) +} +func (m *DepositAccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DepositAccountResponse.Marshal(b, m, deterministic) +} +func (m *DepositAccountResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_DepositAccountResponse.Merge(m, src) +} +func (m *DepositAccountResponse) XXX_Size() int { + return xxx_messageInfo_DepositAccountResponse.Size(m) +} +func (m *DepositAccountResponse) XXX_DiscardUnknown() { + xxx_messageInfo_DepositAccountResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_DepositAccountResponse proto.InternalMessageInfo + +func (m *DepositAccountResponse) GetAccount() *Account { + if m != nil { + return m.Account + } + return nil +} + +func (m *DepositAccountResponse) GetDepositTxid() []byte { + if m != nil { + return m.DepositTxid + } + return nil +} + type Account struct { // //The identifying component of an account. This is the key used for the trader @@ -469,7 +579,7 @@ func (m *Account) Reset() { *m = Account{} } func (m *Account) String() string { return proto.CompactTextString(m) } func (*Account) ProtoMessage() {} func (*Account) Descriptor() ([]byte, []int) { - return fileDescriptor_b8f61804588c75fe, []int{8} + return fileDescriptor_b8f61804588c75fe, []int{10} } func (m *Account) XXX_Unmarshal(b []byte) error { @@ -546,7 +656,7 @@ func (m *SubmitOrderRequest) Reset() { *m = SubmitOrderRequest{} } func (m *SubmitOrderRequest) String() string { return proto.CompactTextString(m) } func (*SubmitOrderRequest) ProtoMessage() {} func (*SubmitOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b8f61804588c75fe, []int{9} + return fileDescriptor_b8f61804588c75fe, []int{11} } func (m *SubmitOrderRequest) XXX_Unmarshal(b []byte) error { @@ -626,7 +736,7 @@ func (m *SubmitOrderResponse) Reset() { *m = SubmitOrderResponse{} } func (m *SubmitOrderResponse) String() string { return proto.CompactTextString(m) } func (*SubmitOrderResponse) ProtoMessage() {} func (*SubmitOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b8f61804588c75fe, []int{10} + return fileDescriptor_b8f61804588c75fe, []int{12} } func (m *SubmitOrderResponse) XXX_Unmarshal(b []byte) error { @@ -702,7 +812,7 @@ func (m *ListOrdersRequest) Reset() { *m = ListOrdersRequest{} } func (m *ListOrdersRequest) String() string { return proto.CompactTextString(m) } func (*ListOrdersRequest) ProtoMessage() {} func (*ListOrdersRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b8f61804588c75fe, []int{11} + return fileDescriptor_b8f61804588c75fe, []int{13} } func (m *ListOrdersRequest) XXX_Unmarshal(b []byte) error { @@ -735,7 +845,7 @@ func (m *ListOrdersResponse) Reset() { *m = ListOrdersResponse{} } func (m *ListOrdersResponse) String() string { return proto.CompactTextString(m) } func (*ListOrdersResponse) ProtoMessage() {} func (*ListOrdersResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b8f61804588c75fe, []int{12} + return fileDescriptor_b8f61804588c75fe, []int{14} } func (m *ListOrdersResponse) XXX_Unmarshal(b []byte) error { @@ -781,7 +891,7 @@ func (m *CancelOrderRequest) Reset() { *m = CancelOrderRequest{} } func (m *CancelOrderRequest) String() string { return proto.CompactTextString(m) } func (*CancelOrderRequest) ProtoMessage() {} func (*CancelOrderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b8f61804588c75fe, []int{13} + return fileDescriptor_b8f61804588c75fe, []int{15} } func (m *CancelOrderRequest) XXX_Unmarshal(b []byte) error { @@ -819,7 +929,7 @@ func (m *CancelOrderResponse) Reset() { *m = CancelOrderResponse{} } func (m *CancelOrderResponse) String() string { return proto.CompactTextString(m) } func (*CancelOrderResponse) ProtoMessage() {} func (*CancelOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b8f61804588c75fe, []int{14} + return fileDescriptor_b8f61804588c75fe, []int{16} } func (m *CancelOrderResponse) XXX_Unmarshal(b []byte) error { @@ -877,7 +987,7 @@ func (m *Order) Reset() { *m = Order{} } func (m *Order) String() string { return proto.CompactTextString(m) } func (*Order) ProtoMessage() {} func (*Order) Descriptor() ([]byte, []int) { - return fileDescriptor_b8f61804588c75fe, []int{15} + return fileDescriptor_b8f61804588c75fe, []int{17} } func (m *Order) XXX_Unmarshal(b []byte) error { @@ -975,7 +1085,7 @@ func (m *Bid) Reset() { *m = Bid{} } func (m *Bid) String() string { return proto.CompactTextString(m) } func (*Bid) ProtoMessage() {} func (*Bid) Descriptor() ([]byte, []int) { - return fileDescriptor_b8f61804588c75fe, []int{16} + return fileDescriptor_b8f61804588c75fe, []int{18} } func (m *Bid) XXX_Unmarshal(b []byte) error { @@ -1038,7 +1148,7 @@ func (m *Ask) Reset() { *m = Ask{} } func (m *Ask) String() string { return proto.CompactTextString(m) } func (*Ask) ProtoMessage() {} func (*Ask) Descriptor() ([]byte, []int) { - return fileDescriptor_b8f61804588c75fe, []int{17} + return fileDescriptor_b8f61804588c75fe, []int{19} } func (m *Ask) XXX_Unmarshal(b []byte) error { @@ -1090,7 +1200,7 @@ func (m *RecoverAccountsRequest) Reset() { *m = RecoverAccountsRequest{} func (m *RecoverAccountsRequest) String() string { return proto.CompactTextString(m) } func (*RecoverAccountsRequest) ProtoMessage() {} func (*RecoverAccountsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b8f61804588c75fe, []int{18} + return fileDescriptor_b8f61804588c75fe, []int{20} } func (m *RecoverAccountsRequest) XXX_Unmarshal(b []byte) error { @@ -1123,7 +1233,7 @@ func (m *RecoverAccountsResponse) Reset() { *m = RecoverAccountsResponse func (m *RecoverAccountsResponse) String() string { return proto.CompactTextString(m) } func (*RecoverAccountsResponse) ProtoMessage() {} func (*RecoverAccountsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b8f61804588c75fe, []int{19} + return fileDescriptor_b8f61804588c75fe, []int{21} } func (m *RecoverAccountsResponse) XXX_Unmarshal(b []byte) error { @@ -1161,6 +1271,8 @@ func init() { proto.RegisterType((*CloseAccountResponse)(nil), "clmrpc.CloseAccountResponse") proto.RegisterType((*WithdrawAccountRequest)(nil), "clmrpc.WithdrawAccountRequest") proto.RegisterType((*WithdrawAccountResponse)(nil), "clmrpc.WithdrawAccountResponse") + proto.RegisterType((*DepositAccountRequest)(nil), "clmrpc.DepositAccountRequest") + proto.RegisterType((*DepositAccountResponse)(nil), "clmrpc.DepositAccountResponse") proto.RegisterType((*Account)(nil), "clmrpc.Account") proto.RegisterType((*SubmitOrderRequest)(nil), "clmrpc.SubmitOrderRequest") proto.RegisterType((*SubmitOrderResponse)(nil), "clmrpc.SubmitOrderResponse") @@ -1178,81 +1290,85 @@ func init() { func init() { proto.RegisterFile("trader.proto", fileDescriptor_b8f61804588c75fe) } var fileDescriptor_b8f61804588c75fe = []byte{ - // 1179 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x5d, 0x6f, 0xdb, 0x36, - 0x17, 0x8e, 0xe3, 0xaf, 0xe4, 0xf8, 0xa3, 0x2a, 0xed, 0xa6, 0xaa, 0xdb, 0x34, 0x81, 0xfa, 0xf6, - 0x9d, 0x97, 0x0c, 0x31, 0x9a, 0xad, 0xc0, 0xb0, 0x5d, 0xe5, 0xc3, 0x5d, 0x82, 0x15, 0x89, 0xa1, - 0xa4, 0xe9, 0x80, 0x01, 0xd3, 0x68, 0x89, 0x49, 0x08, 0xcb, 0x92, 0x27, 0x51, 0x8e, 0x83, 0xa2, - 0x37, 0x03, 0x7a, 0x3d, 0x0c, 0xfb, 0x69, 0xfb, 0x0b, 0x05, 0xf6, 0x37, 0x06, 0x52, 0xa4, 0x25, - 0xcb, 0x0e, 0xba, 0x5d, 0xec, 0x4e, 0x3c, 0xcf, 0xe1, 0x79, 0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, 0x48, 0x16, 0xf4, 0xf7, 0x84, 0x64, 0x51, - 0x73, 0x36, 0x9e, 0x0b, 0x92, 0x8d, 0xad, 0xf5, 0x2c, 0x49, 0xe7, 0x5d, 0x72, 0xff, 0xdf, 0xa3, - 0x0f, 0x39, 0xb8, 0x97, 0xe9, 0x8e, 0xe8, 0xa9, 0x2a, 0xbc, 0xb8, 0x7b, 0xb7, 0x36, 0xee, 0xc4, - 0x25, 0xf7, 0x0b, 0xc1, 0xbd, 0x6d, 0xfc, 0x7f, 0x8e, 0x5b, 0x75, 0xcb, 0x19, 0x11, 0x7c, 0x7b, - 0x6f, 0xe0, 0x5e, 0xc6, 0x80, 0x89, 0x8c, 0xc5, 0x9e, 0x4d, 0x64, 0xdc, 0xe1, 0x5c, 0xe3, 0x99, - 0x90, 0xb1, 0x6e, 0xe8, 0x73, 0x32, 0xa4, 0x99, 0x39, 0x31, 0x86, 0x4a, 0xaa, 0xcf, 0x24, 0x86, - 0x99, 0x6f, 0x70, 0xad, 0xc7, 0x0b, 0x31, 0x49, 0xf6, 0x48, 0x90, 0x35, 0x8c, 0xba, 0x22, 0x13, - 0x0f, 0x9b, 0xb0, 0xce, 0x8f, 0x00, 0x49, 0x8b, 0x40, 0x8f, 0xd2, 0xde, 0x98, 0xe9, 0x25, 0xad, - 0xd6, 0x22, 0x48, 0xd6, 0x5f, 0x13, 0xf5, 0x35, 0x94, 0xa9, 0x8f, 0x5c, 0xa8, 0xa4, 0x1e, 0xfc, - 0x44, 0xff, 0x7c, 0xf3, 0x48, 0xf4, 0x2f, 0xea, 0x10, 0xff, 0x13, 0xf5, 0x9f, 0x6e, 0x3d, 0x99, - 0xad, 0xdf, 0x79, 0x97, 0x7a, 0xb3, 0xdf, 0xf7, 0x4b, 0xe2, 0x4f, 0xfb, 0xcb, 0xbf, 0x03, 0x00, - 0x00, 0xff, 0xff, 0x2c, 0xf4, 0x78, 0xd0, 0xb1, 0x0b, 0x00, 0x00, + // 1247 bytes of a gzipped FileDescri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xf2, 0x8c, 0x0b, 0x90, 0x06, 0x79, 0x3c, 0x61, + 0xb2, 0x0a, 0xf9, 0x4f, 0xd4, 0x01, 0x6d, 0x14, 0x79, 0x0e, 0xf5, 0x2e, 0xad, 0x11, 0x21, 0x16, + 0x57, 0x15, 0x25, 0x58, 0x30, 0x1b, 0x52, 0xfe, 0x8c, 0x10, 0x93, 0x17, 0x55, 0xca, 0xf7, 0x62, + 0xda, 0x77, 0xd4, 0x51, 0x15, 0x5a, 0x12, 0x15, 0x8a, 0x16, 0xfd, 0xc0, 0x55, 0x56, 0xea, 0xb3, + 0x05, 0xc5, 0xc8, 0xa3, 0x2c, 0xd4, 0xcb, 0xc2, 0xc1, 0xf8, 0x83, 0xb7, 0x83, 0xf8, 0x61, 0x45, + 0xde, 0x28, 0x72, 0x47, 0xd4, 0x75, 0x89, 0xa3, 0x6f, 0xc5, 0xed, 0x20, 0x80, 0x97, 0x4b, 0xb9, + 0x31, 0x87, 0xfc, 0x11, 0x75, 0xd0, 0xc7, 0x8b, 0xf4, 0xca, 0x4a, 0xaa, 0xaf, 0xb0, 0x9a, 0x0a, + 0x45, 0x07, 0xd0, 0x9c, 0x50, 0xcf, 0x72, 0x22, 0xd9, 0x6d, 0x43, 0xd7, 0xb7, 0xc7, 0xa1, 0xbc, + 0xa1, 0xdb, 0x13, 0xea, 0xf5, 0x24, 0x72, 0x24, 0x00, 0xbe, 0x91, 0x66, 0x24, 0x08, 0xa9, 0xef, + 0xc9, 0x81, 0xa4, 0x3e, 0x39, 0xf3, 0xd3, 0x70, 0xfc, 0x7e, 0xcc, 0x78, 0x7e, 0x2d, 0x33, 0x9e, + 0xff, 0x67, 0x66, 0x1d, 0xb6, 0x4d, 0x62, 0xfb, 0x33, 0x12, 0xa4, 0x77, 0xf5, 0x39, 0xdc, 0x5d, + 0x43, 0x64, 0x29, 0x7f, 0x01, 0xdb, 0x5e, 0x34, 0xb1, 0x82, 0x18, 0x26, 0x8e, 0x95, 0x58, 0xde, + 0xd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x71, 0x2f, 0xcd, 0xd6, 0x55, 0x4f, 0x00, 0x7e, 0x87, 0x0c, + 0x1a, 0xab, 0x6b, 0x18, 0xed, 0x2a, 0xc3, 0x99, 0x2f, 0x83, 0xf6, 0x83, 0xeb, 0x60, 0x49, 0xfb, + 0x48, 0xd0, 0xee, 0x1a, 0xfa, 0x1a, 0xad, 0xdc, 0xca, 0x9c, 0xf5, 0x2d, 0xdc, 0x4a, 0xd5, 0xf6, + 0x32, 0xde, 0xec, 0x76, 0x58, 0xc6, 0x7b, 0x4d, 0x53, 0xfc, 0x0b, 0xb1, 0xec, 0x13, 0x4e, 0x8c, + 0xa1, 0x9a, 0x58, 0x61, 0xcb, 0x5a, 0x5c, 0xdf, 0x9d, 0xed, 0x9d, 0x4c, 0x4c, 0x92, 0xdd, 0x13, + 0x64, 0x4d, 0xa3, 0xa1, 0xc8, 0xc4, 0xcc, 0x14, 0x55, 0xf9, 0x3d, 0xc0, 0x72, 0xfb, 0xa0, 0x7b, + 0xc9, 0xb2, 0x5b, 0x59, 0x53, 0xed, 0x76, 0x16, 0x24, 0xed, 0x6f, 0x0b, 0xfb, 0x1a, 0x4a, 0xd9, + 0x47, 0x2e, 0x54, 0x13, 0xbb, 0x64, 0xe9, 0xff, 0xfa, 0x5e, 0x5a, 0xfa, 0x9f, 0xb5, 0x7c, 0x64, + 0x71, 0xec, 0xdf, 0x5f, 0xb5, 0xdf, 0xfd, 0x39, 0xb1, 0x0e, 0x7e, 0x19, 0x96, 0xc4, 0xdf, 0x95, + 0xcf, 0xff, 0x09, 0x00, 0x00, 0xff, 0xff, 0xd4, 0xfd, 0xa2, 0x2b, 0xf6, 0x0c, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1271,6 +1387,7 @@ type TraderClient interface { ListAccounts(ctx context.Context, in *ListAccountsRequest, opts ...grpc.CallOption) (*ListAccountsResponse, error) CloseAccount(ctx context.Context, in *CloseAccountRequest, opts ...grpc.CallOption) (*CloseAccountResponse, error) WithdrawAccount(ctx context.Context, in *WithdrawAccountRequest, opts ...grpc.CallOption) (*WithdrawAccountResponse, error) + DepositAccount(ctx context.Context, in *DepositAccountRequest, opts ...grpc.CallOption) (*DepositAccountResponse, error) RecoverAccounts(ctx context.Context, in *RecoverAccountsRequest, opts ...grpc.CallOption) (*RecoverAccountsResponse, error) SubmitOrder(ctx context.Context, in *SubmitOrderRequest, opts ...grpc.CallOption) (*SubmitOrderResponse, error) ListOrders(ctx context.Context, in *ListOrdersRequest, opts ...grpc.CallOption) (*ListOrdersResponse, error) @@ -1321,6 +1438,15 @@ func (c *traderClient) WithdrawAccount(ctx context.Context, in *WithdrawAccountR return out, nil } +func (c *traderClient) DepositAccount(ctx context.Context, in *DepositAccountRequest, opts ...grpc.CallOption) (*DepositAccountResponse, error) { + out := new(DepositAccountResponse) + err := c.cc.Invoke(ctx, "/clmrpc.Trader/DepositAccount", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *traderClient) RecoverAccounts(ctx context.Context, in *RecoverAccountsRequest, opts ...grpc.CallOption) (*RecoverAccountsResponse, error) { out := new(RecoverAccountsResponse) err := c.cc.Invoke(ctx, "/clmrpc.Trader/RecoverAccounts", in, out, opts...) @@ -1363,6 +1489,7 @@ type TraderServer interface { ListAccounts(context.Context, *ListAccountsRequest) (*ListAccountsResponse, error) CloseAccount(context.Context, *CloseAccountRequest) (*CloseAccountResponse, error) WithdrawAccount(context.Context, *WithdrawAccountRequest) (*WithdrawAccountResponse, error) + DepositAccount(context.Context, *DepositAccountRequest) (*DepositAccountResponse, error) RecoverAccounts(context.Context, *RecoverAccountsRequest) (*RecoverAccountsResponse, error) SubmitOrder(context.Context, *SubmitOrderRequest) (*SubmitOrderResponse, error) ListOrders(context.Context, *ListOrdersRequest) (*ListOrdersResponse, error) @@ -1385,6 +1512,9 @@ func (*UnimplementedTraderServer) CloseAccount(ctx context.Context, req *CloseAc func (*UnimplementedTraderServer) WithdrawAccount(ctx context.Context, req *WithdrawAccountRequest) (*WithdrawAccountResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method WithdrawAccount not implemented") } +func (*UnimplementedTraderServer) DepositAccount(ctx context.Context, req *DepositAccountRequest) (*DepositAccountResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DepositAccount not implemented") +} func (*UnimplementedTraderServer) RecoverAccounts(ctx context.Context, req *RecoverAccountsRequest) (*RecoverAccountsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RecoverAccounts not implemented") } @@ -1474,6 +1604,24 @@ func _Trader_WithdrawAccount_Handler(srv interface{}, ctx context.Context, dec f return interceptor(ctx, in, info, handler) } +func _Trader_DepositAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DepositAccountRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TraderServer).DepositAccount(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/clmrpc.Trader/DepositAccount", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TraderServer).DepositAccount(ctx, req.(*DepositAccountRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Trader_RecoverAccounts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(RecoverAccountsRequest) if err := dec(in); err != nil { @@ -1566,6 +1714,10 @@ var _Trader_serviceDesc = grpc.ServiceDesc{ MethodName: "WithdrawAccount", Handler: _Trader_WithdrawAccount_Handler, }, + { + MethodName: "DepositAccount", + Handler: _Trader_DepositAccount_Handler, + }, { MethodName: "RecoverAccounts", Handler: _Trader_RecoverAccounts_Handler, diff --git a/clmrpc/trader.pb.gw.go b/clmrpc/trader.pb.gw.go index a1f84fe..95177ab 100644 --- a/clmrpc/trader.pb.gw.go +++ b/clmrpc/trader.pb.gw.go @@ -84,31 +84,13 @@ func local_request_Trader_ListAccounts_0(ctx context.Context, marshaler runtime. } var ( - filter_Trader_CloseAccount_0 = &utilities.DoubleArray{Encoding: map[string]int{"trader_key": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} + filter_Trader_CloseAccount_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) func request_Trader_CloseAccount_0(ctx context.Context, marshaler runtime.Marshaler, client TraderClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq CloseAccountRequest var metadata runtime.ServerMetadata - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["trader_key"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "trader_key") - } - - protoReq.TraderKey, err = runtime.Bytes(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "trader_key", err) - } - if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -125,24 +107,6 @@ func local_request_Trader_CloseAccount_0(ctx context.Context, marshaler runtime. var protoReq CloseAccountRequest var metadata runtime.ServerMetadata - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["trader_key"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "trader_key") - } - - protoReq.TraderKey, err = runtime.Bytes(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "trader_key", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Trader_CloseAccount_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -164,24 +128,6 @@ func request_Trader_WithdrawAccount_0(ctx context.Context, marshaler runtime.Mar return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["trader_key"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "trader_key") - } - - protoReq.TraderKey, err = runtime.Bytes(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "trader_key", err) - } - msg, err := client.WithdrawAccount(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err @@ -199,29 +145,45 @@ func local_request_Trader_WithdrawAccount_0(ctx context.Context, marshaler runti return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["trader_key"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "trader_key") - } - - protoReq.TraderKey, err = runtime.Bytes(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "trader_key", err) - } - msg, err := server.WithdrawAccount(ctx, &protoReq) return msg, metadata, err } +func request_Trader_DepositAccount_0(ctx context.Context, marshaler runtime.Marshaler, client TraderClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DepositAccountRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.DepositAccount(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Trader_DepositAccount_0(ctx context.Context, marshaler runtime.Marshaler, server TraderServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DepositAccountRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.DepositAccount(ctx, &protoReq) + return msg, metadata, err + +} + func request_Trader_RecoverAccounts_0(ctx context.Context, marshaler runtime.Marshaler, client TraderClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq RecoverAccountsRequest var metadata runtime.ServerMetadata @@ -447,6 +409,26 @@ func RegisterTraderHandlerServer(ctx context.Context, mux *runtime.ServeMux, ser }) + mux.Handle("POST", pattern_Trader_DepositAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Trader_DepositAccount_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Trader_DepositAccount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("POST", pattern_Trader_RecoverAccounts_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -648,6 +630,26 @@ func RegisterTraderHandlerClient(ctx context.Context, mux *runtime.ServeMux, cli }) + mux.Handle("POST", pattern_Trader_DepositAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Trader_DepositAccount_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Trader_DepositAccount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("POST", pattern_Trader_RecoverAccounts_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -736,9 +738,11 @@ var ( pattern_Trader_ListAccounts_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "clm", "accounts"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Trader_CloseAccount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "clm", "accounts", "trader_key"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Trader_CloseAccount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "clm", "accounts"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Trader_WithdrawAccount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"v1", "clm", "accounts", "withdraw", "trader_key"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Trader_WithdrawAccount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "clm", "accounts", "withdraw"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Trader_DepositAccount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "clm", "accounts", "deposit"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Trader_RecoverAccounts_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "clm", "accounts", "recover"}, "", runtime.AssumeColonVerbOpt(true))) @@ -758,6 +762,8 @@ var ( forward_Trader_WithdrawAccount_0 = runtime.ForwardResponseMessage + forward_Trader_DepositAccount_0 = runtime.ForwardResponseMessage + forward_Trader_RecoverAccounts_0 = runtime.ForwardResponseMessage forward_Trader_SubmitOrder_0 = runtime.ForwardResponseMessage diff --git a/clmrpc/trader.proto b/clmrpc/trader.proto index 8d310f9..b1a9cf6 100644 --- a/clmrpc/trader.proto +++ b/clmrpc/trader.proto @@ -21,13 +21,20 @@ service Trader { rpc CloseAccount (CloseAccountRequest) returns (CloseAccountResponse) { option (google.api.http) = { - delete: "/v1/clm/accounts/{trader_key}" + delete: "/v1/clm/accounts" }; }; rpc WithdrawAccount (WithdrawAccountRequest) returns (WithdrawAccountResponse) { option (google.api.http) = { - post: "/v1/clm/accounts/withdraw/{trader_key}" + post: "/v1/clm/accounts/withdraw" + body: "*" + }; + }; + + rpc DepositAccount (DepositAccountRequest) returns (DepositAccountResponse) { + option (google.api.http) = { + post: "/v1/clm/accounts/deposit" body: "*" }; }; @@ -72,7 +79,7 @@ message ListAccountsResponse { message Output { // The value, in satoshis, of the output. - uint64 value = 1; + uint64 value_sat = 1; // The address corresponding to the output. string address = 2; @@ -117,6 +124,29 @@ message WithdrawAccountResponse { bytes withdraw_txid = 2; } +message DepositAccountRequest { + /* + The trader key associated with the account that funds will be deposited + into. + */ + bytes trader_key = 1; + + // The amount in satoshis to deposit into the account. + uint64 amount_sat = 2; + + /* + The fee rate, in satoshis per vbyte, to use for the deposit transaction. + */ + uint32 sat_per_vbyte = 3; +} +message DepositAccountResponse { + // The state of the account after processing the deposit. + Account account = 1; + + // The transaction used to deposit funds into the account. + bytes deposit_txid = 2; +} + enum AccountState { // The state of an account when it is pending its confirmation on-chain. PENDING_OPEN = 0; @@ -295,4 +325,4 @@ message RecoverAccountsRequest { message RecoverAccountsResponse { // The number of accounts that were recovered. uint32 num_recovered_accounts = 1; -} \ No newline at end of file +} diff --git a/clmrpc/trader.swagger.json b/clmrpc/trader.swagger.json index e0cd3f2..1140ef9 100644 --- a/clmrpc/trader.swagger.json +++ b/clmrpc/trader.swagger.json @@ -32,6 +32,36 @@ "Trader" ] }, + "delete": { + "operationId": "CloseAccount", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/clmrpcCloseAccountResponse" + } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/gatewayruntimeError" + } + } + }, + "parameters": [ + { + "name": "trader_key", + "description": "The trader key associated with the account that will be closed.", + "in": "query", + "required": false, + "type": "string", + "format": "byte" + } + ], + "tags": [ + "Trader" + ] + }, "post": { "operationId": "InitAccount", "responses": { @@ -63,6 +93,38 @@ ] } }, + "/v1/clm/accounts/deposit": { + "post": { + "operationId": "DepositAccount", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/clmrpcDepositAccountResponse" + } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/gatewayruntimeError" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/clmrpcDepositAccountRequest" + } + } + ], + "tags": [ + "Trader" + ] + } + }, "/v1/clm/accounts/recover": { "post": { "operationId": "RecoverAccounts", @@ -95,7 +157,7 @@ ] } }, - "/v1/clm/accounts/withdraw/{trader_key}": { + "/v1/clm/accounts/withdraw": { "post": { "operationId": "WithdrawAccount", "responses": { @@ -113,14 +175,6 @@ } }, "parameters": [ - { - "name": "trader_key", - "description": "The trader key associated with the account that funds will be withdrawed\nfrom.", - "in": "path", - "required": true, - "type": "string", - "format": "byte" - }, { "name": "body", "in": "body", @@ -135,38 +189,6 @@ ] } }, - "/v1/clm/accounts/{trader_key}": { - "delete": { - "operationId": "CloseAccount", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/clmrpcCloseAccountResponse" - } - }, - "default": { - "description": "An unexpected error response", - "schema": { - "$ref": "#/definitions/gatewayruntimeError" - } - } - }, - "parameters": [ - { - "name": "trader_key", - "description": "The trader key associated with the account that will be closed.", - "in": "path", - "required": true, - "type": "string", - "format": "byte" - } - ], - "tags": [ - "Trader" - ] - } - }, "/v1/clm/orders": { "get": { "operationId": "ListOrders", @@ -356,6 +378,40 @@ } } }, + "clmrpcDepositAccountRequest": { + "type": "object", + "properties": { + "trader_key": { + "type": "string", + "format": "byte", + "description": "The trader key associated with the account that funds will be deposited\ninto." + }, + "amount_sat": { + "type": "string", + "format": "uint64", + "description": "The amount in satoshis to deposit into the account." + }, + "sat_per_vbyte": { + "type": "integer", + "format": "int64", + "description": "The fee rate, in satoshis per vbyte, to use for the deposit transaction." + } + } + }, + "clmrpcDepositAccountResponse": { + "type": "object", + "properties": { + "account": { + "$ref": "#/definitions/clmrpcAccount", + "description": "The state of the account after processing the deposit." + }, + "deposit_txid": { + "type": "string", + "format": "byte", + "description": "The transaction used to deposit funds into the account." + } + } + }, "clmrpcInitAccountRequest": { "type": "object", "properties": { @@ -487,7 +543,7 @@ "clmrpcOutput": { "type": "object", "properties": { - "value": { + "value_sat": { "type": "string", "format": "uint64", "description": "The value, in satoshis, of the output." diff --git a/cmd/agora/account.go b/cmd/agora/account.go index 2e275da..e1eab5e 100644 --- a/cmd/agora/account.go +++ b/cmd/agora/account.go @@ -205,8 +205,8 @@ func withdrawAccount(ctx *cli.Context) error { TraderKey: traderKey, Outputs: []*clmrpc.Output{ { - Value: amt, - Address: addr, + ValueSat: amt, + Address: addr, }, }, SatPerVbyte: satPerVByte, diff --git a/rpcserver.go b/rpcserver.go index e4ba38c..e42e4e1 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -737,6 +737,48 @@ func marshallAccount(a *account.Account) (*clmrpc.Account, error) { }, nil } +// DepositAccount handles a trader's request to deposit funds into the specified +// account by spending the specified inputs. +func (s *rpcServer) DepositAccount(ctx context.Context, + req *clmrpc.DepositAccountRequest) (*clmrpc.DepositAccountResponse, error) { + + // Ensure the trader key is well formed. + traderKey, err := btcec.ParsePubKey(req.TraderKey, btcec.S256()) + if err != nil { + return nil, err + } + + // Enforce a minimum fee rate of 1 sat/vbyte. + feeRate := chainfee.SatPerKVByte(req.SatPerVbyte * 1000).FeePerKWeight() + if feeRate < chainfee.FeePerKwFloor { + log.Debugf("Manual fee rate input of %d sat/kw is too low, "+ + "using %d sat/kw instead", feeRate, + chainfee.FeePerKwFloor) + feeRate = chainfee.FeePerKwFloor + } + + // Proceed to process the deposit and map its response to the RPC's + // response. + modifiedAccount, tx, err := s.accountManager.DepositAccount( + ctx, traderKey, btcutil.Amount(req.AmountSat), feeRate, + atomic.LoadUint32(&s.bestHeight), + ) + if err != nil { + return nil, err + } + + rpcModifiedAccount, err := marshallAccount(modifiedAccount) + if err != nil { + return nil, err + } + txHash := tx.TxHash() + + return &clmrpc.DepositAccountResponse{ + Account: rpcModifiedAccount, + DepositTxid: txHash[:], + }, nil +} + // WithdrawAccount handles a trader's request to withdraw funds from the // specified account by spending the current account output to the specified // outputs. @@ -761,7 +803,7 @@ func (s *rpcServer) WithdrawAccount(ctx context.Context, // Enforce a minimum fee rate of 1 sat/vbyte. feeRate := chainfee.SatPerKVByte(req.SatPerVbyte * 1000).FeePerKWeight() if feeRate < chainfee.FeePerKwFloor { - log.Infof("Manual fee rate input of %d sat/kw is too low, "+ + log.Debugf("Manual fee rate input of %d sat/kw is too low, "+ "using %d sat/kw instead", feeRate, chainfee.FeePerKwFloor) feeRate = chainfee.FeePerKwFloor @@ -844,7 +886,7 @@ func (s *rpcServer) parseRPCOutputs(outputs []*clmrpc.Output) ([]*wire.TxOut, } res = append(res, &wire.TxOut{ - Value: int64(output.Value), + Value: int64(output.ValueSat), PkScript: outputScript, }) }