poolrpc: add account_expiry to Deposit/Withdraw

Follows the same format than in RenewAccount: one of `absolute_expiry`
or `relative_expiry`.
This commit is contained in:
positiveblue 2021-11-02 15:16:38 -07:00
parent 5db7a10b4c
commit b1848de6ca
No known key found for this signature in database
GPG key ID: 4FFF2510928804DC
3 changed files with 160 additions and 17 deletions

View file

@ -988,6 +988,10 @@ type WithdrawAccountRequest struct {
//
//The fee rate, in satoshis per kw, to use for the withdrawal transaction.
FeeRateSatPerKw uint64 `protobuf:"varint,3,opt,name=fee_rate_sat_per_kw,json=feeRateSatPerKw,proto3" json:"fee_rate_sat_per_kw,omitempty"`
// Types that are assignable to AccountExpiry:
// *WithdrawAccountRequest_AbsoluteExpiry
// *WithdrawAccountRequest_RelativeExpiry
AccountExpiry isWithdrawAccountRequest_AccountExpiry `protobuf_oneof:"account_expiry"`
}
func (x *WithdrawAccountRequest) Reset() {
@ -1043,6 +1047,45 @@ func (x *WithdrawAccountRequest) GetFeeRateSatPerKw() uint64 {
return 0
}
func (m *WithdrawAccountRequest) GetAccountExpiry() isWithdrawAccountRequest_AccountExpiry {
if m != nil {
return m.AccountExpiry
}
return nil
}
func (x *WithdrawAccountRequest) GetAbsoluteExpiry() uint32 {
if x, ok := x.GetAccountExpiry().(*WithdrawAccountRequest_AbsoluteExpiry); ok {
return x.AbsoluteExpiry
}
return 0
}
func (x *WithdrawAccountRequest) GetRelativeExpiry() uint32 {
if x, ok := x.GetAccountExpiry().(*WithdrawAccountRequest_RelativeExpiry); ok {
return x.RelativeExpiry
}
return 0
}
type isWithdrawAccountRequest_AccountExpiry interface {
isWithdrawAccountRequest_AccountExpiry()
}
type WithdrawAccountRequest_AbsoluteExpiry struct {
// The new absolute expiration height of the account.
AbsoluteExpiry uint32 `protobuf:"varint,4,opt,name=absolute_expiry,json=absoluteExpiry,proto3,oneof"`
}
type WithdrawAccountRequest_RelativeExpiry struct {
// The new relative expiration height of the account.
RelativeExpiry uint32 `protobuf:"varint,5,opt,name=relative_expiry,json=relativeExpiry,proto3,oneof"`
}
func (*WithdrawAccountRequest_AbsoluteExpiry) isWithdrawAccountRequest_AccountExpiry() {}
func (*WithdrawAccountRequest_RelativeExpiry) isWithdrawAccountRequest_AccountExpiry() {}
type WithdrawAccountResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -1114,6 +1157,10 @@ type DepositAccountRequest struct {
//
//The fee rate, in satoshis per kw, to use for the deposit transaction.
FeeRateSatPerKw uint64 `protobuf:"varint,3,opt,name=fee_rate_sat_per_kw,json=feeRateSatPerKw,proto3" json:"fee_rate_sat_per_kw,omitempty"`
// Types that are assignable to AccountExpiry:
// *DepositAccountRequest_AbsoluteExpiry
// *DepositAccountRequest_RelativeExpiry
AccountExpiry isDepositAccountRequest_AccountExpiry `protobuf_oneof:"account_expiry"`
}
func (x *DepositAccountRequest) Reset() {
@ -1169,6 +1216,45 @@ func (x *DepositAccountRequest) GetFeeRateSatPerKw() uint64 {
return 0
}
func (m *DepositAccountRequest) GetAccountExpiry() isDepositAccountRequest_AccountExpiry {
if m != nil {
return m.AccountExpiry
}
return nil
}
func (x *DepositAccountRequest) GetAbsoluteExpiry() uint32 {
if x, ok := x.GetAccountExpiry().(*DepositAccountRequest_AbsoluteExpiry); ok {
return x.AbsoluteExpiry
}
return 0
}
func (x *DepositAccountRequest) GetRelativeExpiry() uint32 {
if x, ok := x.GetAccountExpiry().(*DepositAccountRequest_RelativeExpiry); ok {
return x.RelativeExpiry
}
return 0
}
type isDepositAccountRequest_AccountExpiry interface {
isDepositAccountRequest_AccountExpiry()
}
type DepositAccountRequest_AbsoluteExpiry struct {
// The new absolute expiration height of the account.
AbsoluteExpiry uint32 `protobuf:"varint,4,opt,name=absolute_expiry,json=absoluteExpiry,proto3,oneof"`
}
type DepositAccountRequest_RelativeExpiry struct {
// The new relative expiration height of the account.
RelativeExpiry uint32 `protobuf:"varint,5,opt,name=relative_expiry,json=relativeExpiry,proto3,oneof"`
}
func (*DepositAccountRequest_AbsoluteExpiry) isDepositAccountRequest_AccountExpiry() {}
func (*DepositAccountRequest_RelativeExpiry) isDepositAccountRequest_AccountExpiry() {}
type DepositAccountResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -4792,7 +4878,7 @@ var file_trader_proto_rawDesc = []byte{
0x6f, 0x73, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x5f, 0x74, 0x78, 0x69, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x54, 0x78, 0x69,
0x64, 0x22, 0x90, 0x01, 0x0a, 0x16, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x41, 0x63,
0x64, 0x22, 0xf8, 0x01, 0x0a, 0x16, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x41, 0x63,
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a,
0x74, 0x72, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c,
0x52, 0x09, 0x74, 0x72, 0x61, 0x64, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x12, 0x29, 0x0a, 0x07, 0x6f,
@ -4801,22 +4887,35 @@ var file_trader_proto_rawDesc = []byte{
0x75, 0x74, 0x70, 0x75, 0x74, 0x73, 0x12, 0x2c, 0x0a, 0x13, 0x66, 0x65, 0x65, 0x5f, 0x72, 0x61,
0x74, 0x65, 0x5f, 0x73, 0x61, 0x74, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x6b, 0x77, 0x18, 0x03, 0x20,
0x01, 0x28, 0x04, 0x52, 0x0f, 0x66, 0x65, 0x65, 0x52, 0x61, 0x74, 0x65, 0x53, 0x61, 0x74, 0x50,
0x65, 0x72, 0x4b, 0x77, 0x22, 0x6a, 0x0a, 0x17, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77,
0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
0x2a, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x10, 0x2e, 0x70, 0x6f, 0x6f, 0x6c, 0x72, 0x70, 0x63, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75,
0x6e, 0x74, 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x77,
0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x5f, 0x74, 0x78, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01,
0x28, 0x0c, 0x52, 0x0c, 0x77, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x54, 0x78, 0x69, 0x64,
0x22, 0x83, 0x01, 0x0a, 0x15, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x41, 0x63, 0x63, 0x6f,
0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x74, 0x72,
0x61, 0x64, 0x65, 0x72, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09,
0x74, 0x72, 0x61, 0x64, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x6d, 0x6f,
0x75, 0x6e, 0x74, 0x5f, 0x73, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x61,
0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x53, 0x61, 0x74, 0x12, 0x2c, 0x0a, 0x13, 0x66, 0x65, 0x65, 0x5f,
0x72, 0x61, 0x74, 0x65, 0x5f, 0x73, 0x61, 0x74, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x6b, 0x77, 0x18,
0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x66, 0x65, 0x65, 0x52, 0x61, 0x74, 0x65, 0x53, 0x61,
0x74, 0x50, 0x65, 0x72, 0x4b, 0x77, 0x22, 0x67, 0x0a, 0x16, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69,
0x65, 0x72, 0x4b, 0x77, 0x12, 0x29, 0x0a, 0x0f, 0x61, 0x62, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x65,
0x5f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52,
0x0e, 0x61, 0x62, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x65, 0x45, 0x78, 0x70, 0x69, 0x72, 0x79, 0x12,
0x29, 0x0a, 0x0f, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x65, 0x78, 0x70, 0x69,
0x72, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x0e, 0x72, 0x65, 0x6c, 0x61,
0x74, 0x69, 0x76, 0x65, 0x45, 0x78, 0x70, 0x69, 0x72, 0x79, 0x42, 0x10, 0x0a, 0x0e, 0x61, 0x63,
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x22, 0x6a, 0x0a, 0x17,
0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75,
0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x6f, 0x6f, 0x6c, 0x72,
0x70, 0x63, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f,
0x75, 0x6e, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x77, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x5f,
0x74, 0x78, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x77, 0x69, 0x74, 0x68,
0x64, 0x72, 0x61, 0x77, 0x54, 0x78, 0x69, 0x64, 0x22, 0xeb, 0x01, 0x0a, 0x15, 0x44, 0x65, 0x70,
0x6f, 0x73, 0x69, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x74, 0x72, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x6b, 0x65, 0x79,
0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x74, 0x72, 0x61, 0x64, 0x65, 0x72, 0x4b, 0x65,
0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x73, 0x61, 0x74, 0x18,
0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x53, 0x61, 0x74,
0x12, 0x2c, 0x0a, 0x13, 0x66, 0x65, 0x65, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x73, 0x61, 0x74,
0x5f, 0x70, 0x65, 0x72, 0x5f, 0x6b, 0x77, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x66,
0x65, 0x65, 0x52, 0x61, 0x74, 0x65, 0x53, 0x61, 0x74, 0x50, 0x65, 0x72, 0x4b, 0x77, 0x12, 0x29,
0x0a, 0x0f, 0x61, 0x62, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x65, 0x5f, 0x65, 0x78, 0x70, 0x69, 0x72,
0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x0e, 0x61, 0x62, 0x73, 0x6f, 0x6c,
0x75, 0x74, 0x65, 0x45, 0x78, 0x70, 0x69, 0x72, 0x79, 0x12, 0x29, 0x0a, 0x0f, 0x72, 0x65, 0x6c,
0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x18, 0x05, 0x20, 0x01,
0x28, 0x0d, 0x48, 0x00, 0x52, 0x0e, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x45, 0x78,
0x70, 0x69, 0x72, 0x79, 0x42, 0x10, 0x0a, 0x0e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f,
0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x22, 0x67, 0x0a, 0x16, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69,
0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x12, 0x2a, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x10, 0x2e, 0x70, 0x6f, 0x6f, 0x6c, 0x72, 0x70, 0x63, 0x2e, 0x41, 0x63, 0x63, 0x6f,
@ -6451,6 +6550,14 @@ func file_trader_proto_init() {
(*CloseAccountRequest_OutputWithFee)(nil),
(*CloseAccountRequest_Outputs)(nil),
}
file_trader_proto_msgTypes[10].OneofWrappers = []interface{}{
(*WithdrawAccountRequest_AbsoluteExpiry)(nil),
(*WithdrawAccountRequest_RelativeExpiry)(nil),
}
file_trader_proto_msgTypes[12].OneofWrappers = []interface{}{
(*DepositAccountRequest_AbsoluteExpiry)(nil),
(*DepositAccountRequest_RelativeExpiry)(nil),
}
file_trader_proto_msgTypes[14].OneofWrappers = []interface{}{
(*RenewAccountRequest_AbsoluteExpiry)(nil),
(*RenewAccountRequest_RelativeExpiry)(nil),

View file

@ -338,6 +338,14 @@ message WithdrawAccountRequest {
The fee rate, in satoshis per kw, to use for the withdrawal transaction.
*/
uint64 fee_rate_sat_per_kw = 3;
oneof account_expiry {
// The new absolute expiration height of the account.
uint32 absolute_expiry = 4;
// The new relative expiration height of the account.
uint32 relative_expiry = 5;
}
}
message WithdrawAccountResponse {
// The state of the account after processing the withdrawal.
@ -361,6 +369,14 @@ message DepositAccountRequest {
The fee rate, in satoshis per kw, to use for the deposit transaction.
*/
uint64 fee_rate_sat_per_kw = 3;
oneof account_expiry {
// The new absolute expiration height of the account.
uint32 absolute_expiry = 4;
// The new relative expiration height of the account.
uint32 relative_expiry = 5;
}
}
message DepositAccountResponse {
// The state of the account after processing the deposit.

View file

@ -1342,6 +1342,16 @@
"type": "string",
"format": "uint64",
"description": "The fee rate, in satoshis per kw, to use for the deposit transaction."
},
"absolute_expiry": {
"type": "integer",
"format": "int64",
"description": "The new absolute expiration height of the account."
},
"relative_expiry": {
"type": "integer",
"format": "int64",
"description": "The new relative expiration height of the account."
}
}
},
@ -2329,6 +2339,16 @@
"type": "string",
"format": "uint64",
"description": "The fee rate, in satoshis per kw, to use for the withdrawal transaction."
},
"absolute_expiry": {
"type": "integer",
"format": "int64",
"description": "The new absolute expiration height of the account."
},
"relative_expiry": {
"type": "integer",
"format": "int64",
"description": "The new relative expiration height of the account."
}
}
},