complete transfer v0 -> v1
This commit is contained in:
parent
898b542e54
commit
3a9d132f8d
@ -17,11 +17,13 @@ var (
|
||||
PublicKeyStart = []byte{12, 14, 187, 9}
|
||||
MagicDyckForPoint = []uint64{0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1}
|
||||
MagicDyckForT8 = []uint64{0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1}
|
||||
MagicDyckForSeed = []uint64{0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1}
|
||||
MagicDyckForSeed = []uint64{0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1}
|
||||
MagicDyckForName = []uint64{0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1}
|
||||
Tip5Zero = [5]uint64{1730770831742798981, 2676322185709933211, 8329210750824781744, 16756092452590401876, 3547445316740171466}
|
||||
Tip5One = [5]uint64{6727110957294540849, 15606243244732609007, 11887284596344881785, 10646863421881571398, 8146872807338919620}
|
||||
Tip5ZeroZero = [5]uint64{4372149332062030091, 17876920912185183887, 13348798570422431948, 8872865212694716527, 3385176510443841516}
|
||||
LockTagTip5Hash = [5]uint64{14842882926452000379, 13014485748050717591, 1400056310629901848, 12454303796926623552, 932704623874458879}
|
||||
PkhTagTip5Hash = [5]uint64{10156173885239003330, 10977325146168166962, 5009593872749405377, 3760122916894980618, 174876511384150447}
|
||||
)
|
||||
|
||||
type MasterKey struct {
|
||||
|
||||
@ -144,6 +144,14 @@ var (
|
||||
INIT_SPONGE_FIX = [16]uint64{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295}
|
||||
)
|
||||
|
||||
func Tip5HashLeaf(leaf uint64) [5]uint64 {
|
||||
belts := []Belt{
|
||||
{Value: 1},
|
||||
{Value: leaf},
|
||||
}
|
||||
return Tip5HashBelts(belts)
|
||||
}
|
||||
|
||||
func Tip5HashBelts(input []Belt) [5]uint64 {
|
||||
inputLen := len(input)
|
||||
q := inputLen / RATE
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -26,12 +26,17 @@ const (
|
||||
type WalletGetBalanceRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// pubkey cheetah point; specific address, or current wallet
|
||||
Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
|
||||
//
|
||||
// Types that are valid to be assigned to Selector:
|
||||
//
|
||||
// *WalletGetBalanceRequest_Address
|
||||
// *WalletGetBalanceRequest_FirstName
|
||||
Selector isWalletGetBalanceRequest_Selector `protobuf_oneof:"selector"`
|
||||
// Pagination parameters. The server enforces limits and may return fewer
|
||||
// entries than requested to respect message size and policy. For consistent
|
||||
// paging across a stable snapshot, pass along the returned page_token from
|
||||
// the previous response without modification.
|
||||
Page *PageRequest `protobuf:"bytes,2,opt,name=page,proto3" json:"page,omitempty"`
|
||||
Page *PageRequest `protobuf:"bytes,3,opt,name=page,proto3" json:"page,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
@ -66,11 +71,29 @@ func (*WalletGetBalanceRequest) Descriptor() ([]byte, []int) {
|
||||
return file_nockchain_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *WalletGetBalanceRequest) GetAddress() string {
|
||||
func (x *WalletGetBalanceRequest) GetSelector() isWalletGetBalanceRequest_Selector {
|
||||
if x != nil {
|
||||
return x.Selector
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *WalletGetBalanceRequest) GetAddress() *Base58Pubkey {
|
||||
if x != nil {
|
||||
if x, ok := x.Selector.(*WalletGetBalanceRequest_Address); ok {
|
||||
return x.Address
|
||||
}
|
||||
return ""
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *WalletGetBalanceRequest) GetFirstName() *Base58Hash {
|
||||
if x != nil {
|
||||
if x, ok := x.Selector.(*WalletGetBalanceRequest_FirstName); ok {
|
||||
return x.FirstName
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *WalletGetBalanceRequest) GetPage() *PageRequest {
|
||||
@ -80,6 +103,22 @@ func (x *WalletGetBalanceRequest) GetPage() *PageRequest {
|
||||
return nil
|
||||
}
|
||||
|
||||
type isWalletGetBalanceRequest_Selector interface {
|
||||
isWalletGetBalanceRequest_Selector()
|
||||
}
|
||||
|
||||
type WalletGetBalanceRequest_Address struct {
|
||||
Address *Base58Pubkey `protobuf:"bytes,1,opt,name=address,proto3,oneof"`
|
||||
}
|
||||
|
||||
type WalletGetBalanceRequest_FirstName struct {
|
||||
FirstName *Base58Hash `protobuf:"bytes,2,opt,name=first_name,json=firstName,proto3,oneof"`
|
||||
}
|
||||
|
||||
func (*WalletGetBalanceRequest_Address) isWalletGetBalanceRequest_Selector() {}
|
||||
|
||||
func (*WalletGetBalanceRequest_FirstName) isWalletGetBalanceRequest_Selector() {}
|
||||
|
||||
type WalletGetBalanceResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// Types that are valid to be assigned to Result:
|
||||
@ -128,7 +167,7 @@ func (x *WalletGetBalanceResponse) GetResult() isWalletGetBalanceResponse_Result
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *WalletGetBalanceResponse) GetBalance() *WalletBalanceData {
|
||||
func (x *WalletGetBalanceResponse) GetBalance() *Balance {
|
||||
if x != nil {
|
||||
if x, ok := x.Result.(*WalletGetBalanceResponse_Balance); ok {
|
||||
return x.Balance
|
||||
@ -155,7 +194,7 @@ type WalletGetBalanceResponse_Balance struct {
|
||||
// Continue paging using `balance.page.next_page_token` until empty. Clients
|
||||
// should treat the page token as opaque; it may encode snapshot identity
|
||||
// and the last returned key.
|
||||
Balance *WalletBalanceData `protobuf:"bytes,1,opt,name=balance,proto3,oneof"`
|
||||
Balance *Balance `protobuf:"bytes,1,opt,name=balance,proto3,oneof"`
|
||||
}
|
||||
|
||||
type WalletGetBalanceResponse_Error struct {
|
||||
@ -437,31 +476,35 @@ var File_nockchain_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_nockchain_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\x0fnockchain.proto\x12\x13nockchain.public.v1\x1a\x10blockchain.proto\x1a\x10primitives.proto\x1a\x10pagination.proto\"i\n" +
|
||||
"\x17WalletGetBalanceRequest\x12\x18\n" +
|
||||
"\aaddress\x18\x01 \x01(\tR\aaddress\x124\n" +
|
||||
"\x04page\x18\x02 \x01(\v2 .nockchain.public.v1.PageRequestR\x04page\"\xa2\x01\n" +
|
||||
"\x18WalletGetBalanceResponse\x12B\n" +
|
||||
"\abalance\x18\x01 \x01(\v2&.nockchain.public.v1.WalletBalanceDataH\x00R\abalance\x128\n" +
|
||||
"\x05error\x18\x02 \x01(\v2 .nockchain.public.v1.ErrorStatusH\x00R\x05errorB\b\n" +
|
||||
"\x0fnockchain.proto\x12\x13nockchain.public.v2\x1a\x10blockchain.proto\x1a\x10primitives.proto\x1a\x10pagination.proto\"\xdc\x01\n" +
|
||||
"\x17WalletGetBalanceRequest\x12=\n" +
|
||||
"\aaddress\x18\x01 \x01(\v2!.nockchain.public.v2.Base58PubkeyH\x00R\aaddress\x12@\n" +
|
||||
"\n" +
|
||||
"first_name\x18\x02 \x01(\v2\x1f.nockchain.public.v2.Base58HashH\x00R\tfirstName\x124\n" +
|
||||
"\x04page\x18\x03 \x01(\v2 .nockchain.public.v2.PageRequestR\x04pageB\n" +
|
||||
"\n" +
|
||||
"\bselector\"\x98\x01\n" +
|
||||
"\x18WalletGetBalanceResponse\x128\n" +
|
||||
"\abalance\x18\x01 \x01(\v2\x1c.nockchain.public.v2.BalanceH\x00R\abalance\x128\n" +
|
||||
"\x05error\x18\x02 \x01(\v2 .nockchain.public.v2.ErrorStatusH\x00R\x05errorB\b\n" +
|
||||
"\x06result\"\x8a\x01\n" +
|
||||
"\x1cWalletSendTransactionRequest\x12.\n" +
|
||||
"\x05tx_id\x18\x01 \x01(\v2\x19.nockchain.public.v1.HashR\x04txId\x12:\n" +
|
||||
"\x06raw_tx\x18\x02 \x01(\v2#.nockchain.public.v1.RawTransactionR\x05rawTx\"\x9a\x01\n" +
|
||||
"\x05tx_id\x18\x01 \x01(\v2\x19.nockchain.public.v2.HashR\x04txId\x12:\n" +
|
||||
"\x06raw_tx\x18\x02 \x01(\v2#.nockchain.public.v2.RawTransactionR\x05rawTx\"\x9a\x01\n" +
|
||||
"\x1dWalletSendTransactionResponse\x125\n" +
|
||||
"\x03ack\x18\x01 \x01(\v2!.nockchain.public.v1.AcknowledgedH\x00R\x03ack\x128\n" +
|
||||
"\x05error\x18\x02 \x01(\v2 .nockchain.public.v1.ErrorStatusH\x00R\x05errorB\b\n" +
|
||||
"\x03ack\x18\x01 \x01(\v2!.nockchain.public.v2.AcknowledgedH\x00R\x03ack\x128\n" +
|
||||
"\x05error\x18\x02 \x01(\v2 .nockchain.public.v2.ErrorStatusH\x00R\x05errorB\b\n" +
|
||||
"\x06result\"R\n" +
|
||||
"\x1aTransactionAcceptedRequest\x124\n" +
|
||||
"\x05tx_id\x18\x01 \x01(\v2\x1f.nockchain.public.v1.Base58HashR\x04txId\"\x7f\n" +
|
||||
"\x05tx_id\x18\x01 \x01(\v2\x1f.nockchain.public.v2.Base58HashR\x04txId\"\x7f\n" +
|
||||
"\x1bTransactionAcceptedResponse\x12\x1c\n" +
|
||||
"\baccepted\x18\x01 \x01(\bH\x00R\baccepted\x128\n" +
|
||||
"\x05error\x18\x02 \x01(\v2 .nockchain.public.v1.ErrorStatusH\x00R\x05errorB\b\n" +
|
||||
"\x05error\x18\x02 \x01(\v2 .nockchain.public.v2.ErrorStatusH\x00R\x05errorB\b\n" +
|
||||
"\x06result2\xfd\x02\n" +
|
||||
"\x10NockchainService\x12o\n" +
|
||||
"\x10WalletGetBalance\x12,.nockchain.public.v1.WalletGetBalanceRequest\x1a-.nockchain.public.v1.WalletGetBalanceResponse\x12~\n" +
|
||||
"\x15WalletSendTransaction\x121.nockchain.public.v1.WalletSendTransactionRequest\x1a2.nockchain.public.v1.WalletSendTransactionResponse\x12x\n" +
|
||||
"\x13TransactionAccepted\x12/.nockchain.public.v1.TransactionAcceptedRequest\x1a0.nockchain.public.v1.TransactionAcceptedResponseB\x0eZ\f./;nockchainb\x06proto3"
|
||||
"\x10WalletGetBalance\x12,.nockchain.public.v2.WalletGetBalanceRequest\x1a-.nockchain.public.v2.WalletGetBalanceResponse\x12~\n" +
|
||||
"\x15WalletSendTransaction\x121.nockchain.public.v2.WalletSendTransactionRequest\x1a2.nockchain.public.v2.WalletSendTransactionResponse\x12x\n" +
|
||||
"\x13TransactionAccepted\x12/.nockchain.public.v2.TransactionAcceptedRequest\x1a0.nockchain.public.v2.TransactionAcceptedResponseB\x0eZ\f./;nockchainb\x06proto3"
|
||||
|
||||
var (
|
||||
file_nockchain_proto_rawDescOnce sync.Once
|
||||
@ -477,41 +520,44 @@ func file_nockchain_proto_rawDescGZIP() []byte {
|
||||
|
||||
var file_nockchain_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
|
||||
var file_nockchain_proto_goTypes = []any{
|
||||
(*WalletGetBalanceRequest)(nil), // 0: nockchain.public.v1.WalletGetBalanceRequest
|
||||
(*WalletGetBalanceResponse)(nil), // 1: nockchain.public.v1.WalletGetBalanceResponse
|
||||
(*WalletSendTransactionRequest)(nil), // 2: nockchain.public.v1.WalletSendTransactionRequest
|
||||
(*WalletSendTransactionResponse)(nil), // 3: nockchain.public.v1.WalletSendTransactionResponse
|
||||
(*TransactionAcceptedRequest)(nil), // 4: nockchain.public.v1.TransactionAcceptedRequest
|
||||
(*TransactionAcceptedResponse)(nil), // 5: nockchain.public.v1.TransactionAcceptedResponse
|
||||
(*PageRequest)(nil), // 6: nockchain.public.v1.PageRequest
|
||||
(*WalletBalanceData)(nil), // 7: nockchain.public.v1.WalletBalanceData
|
||||
(*ErrorStatus)(nil), // 8: nockchain.public.v1.ErrorStatus
|
||||
(*Hash)(nil), // 9: nockchain.public.v1.Hash
|
||||
(*RawTransaction)(nil), // 10: nockchain.public.v1.RawTransaction
|
||||
(*Acknowledged)(nil), // 11: nockchain.public.v1.Acknowledged
|
||||
(*Base58Hash)(nil), // 12: nockchain.public.v1.Base58Hash
|
||||
(*WalletGetBalanceRequest)(nil), // 0: nockchain.public.v2.WalletGetBalanceRequest
|
||||
(*WalletGetBalanceResponse)(nil), // 1: nockchain.public.v2.WalletGetBalanceResponse
|
||||
(*WalletSendTransactionRequest)(nil), // 2: nockchain.public.v2.WalletSendTransactionRequest
|
||||
(*WalletSendTransactionResponse)(nil), // 3: nockchain.public.v2.WalletSendTransactionResponse
|
||||
(*TransactionAcceptedRequest)(nil), // 4: nockchain.public.v2.TransactionAcceptedRequest
|
||||
(*TransactionAcceptedResponse)(nil), // 5: nockchain.public.v2.TransactionAcceptedResponse
|
||||
(*Base58Pubkey)(nil), // 6: nockchain.public.v2.Base58Pubkey
|
||||
(*Base58Hash)(nil), // 7: nockchain.public.v2.Base58Hash
|
||||
(*PageRequest)(nil), // 8: nockchain.public.v2.PageRequest
|
||||
(*Balance)(nil), // 9: nockchain.public.v2.Balance
|
||||
(*ErrorStatus)(nil), // 10: nockchain.public.v2.ErrorStatus
|
||||
(*Hash)(nil), // 11: nockchain.public.v2.Hash
|
||||
(*RawTransaction)(nil), // 12: nockchain.public.v2.RawTransaction
|
||||
(*Acknowledged)(nil), // 13: nockchain.public.v2.Acknowledged
|
||||
}
|
||||
var file_nockchain_proto_depIdxs = []int32{
|
||||
6, // 0: nockchain.public.v1.WalletGetBalanceRequest.page:type_name -> nockchain.public.v1.PageRequest
|
||||
7, // 1: nockchain.public.v1.WalletGetBalanceResponse.balance:type_name -> nockchain.public.v1.WalletBalanceData
|
||||
8, // 2: nockchain.public.v1.WalletGetBalanceResponse.error:type_name -> nockchain.public.v1.ErrorStatus
|
||||
9, // 3: nockchain.public.v1.WalletSendTransactionRequest.tx_id:type_name -> nockchain.public.v1.Hash
|
||||
10, // 4: nockchain.public.v1.WalletSendTransactionRequest.raw_tx:type_name -> nockchain.public.v1.RawTransaction
|
||||
11, // 5: nockchain.public.v1.WalletSendTransactionResponse.ack:type_name -> nockchain.public.v1.Acknowledged
|
||||
8, // 6: nockchain.public.v1.WalletSendTransactionResponse.error:type_name -> nockchain.public.v1.ErrorStatus
|
||||
12, // 7: nockchain.public.v1.TransactionAcceptedRequest.tx_id:type_name -> nockchain.public.v1.Base58Hash
|
||||
8, // 8: nockchain.public.v1.TransactionAcceptedResponse.error:type_name -> nockchain.public.v1.ErrorStatus
|
||||
0, // 9: nockchain.public.v1.NockchainService.WalletGetBalance:input_type -> nockchain.public.v1.WalletGetBalanceRequest
|
||||
2, // 10: nockchain.public.v1.NockchainService.WalletSendTransaction:input_type -> nockchain.public.v1.WalletSendTransactionRequest
|
||||
4, // 11: nockchain.public.v1.NockchainService.TransactionAccepted:input_type -> nockchain.public.v1.TransactionAcceptedRequest
|
||||
1, // 12: nockchain.public.v1.NockchainService.WalletGetBalance:output_type -> nockchain.public.v1.WalletGetBalanceResponse
|
||||
3, // 13: nockchain.public.v1.NockchainService.WalletSendTransaction:output_type -> nockchain.public.v1.WalletSendTransactionResponse
|
||||
5, // 14: nockchain.public.v1.NockchainService.TransactionAccepted:output_type -> nockchain.public.v1.TransactionAcceptedResponse
|
||||
12, // [12:15] is the sub-list for method output_type
|
||||
9, // [9:12] is the sub-list for method input_type
|
||||
9, // [9:9] is the sub-list for extension type_name
|
||||
9, // [9:9] is the sub-list for extension extendee
|
||||
0, // [0:9] is the sub-list for field type_name
|
||||
6, // 0: nockchain.public.v2.WalletGetBalanceRequest.address:type_name -> nockchain.public.v2.Base58Pubkey
|
||||
7, // 1: nockchain.public.v2.WalletGetBalanceRequest.first_name:type_name -> nockchain.public.v2.Base58Hash
|
||||
8, // 2: nockchain.public.v2.WalletGetBalanceRequest.page:type_name -> nockchain.public.v2.PageRequest
|
||||
9, // 3: nockchain.public.v2.WalletGetBalanceResponse.balance:type_name -> nockchain.public.v2.Balance
|
||||
10, // 4: nockchain.public.v2.WalletGetBalanceResponse.error:type_name -> nockchain.public.v2.ErrorStatus
|
||||
11, // 5: nockchain.public.v2.WalletSendTransactionRequest.tx_id:type_name -> nockchain.public.v2.Hash
|
||||
12, // 6: nockchain.public.v2.WalletSendTransactionRequest.raw_tx:type_name -> nockchain.public.v2.RawTransaction
|
||||
13, // 7: nockchain.public.v2.WalletSendTransactionResponse.ack:type_name -> nockchain.public.v2.Acknowledged
|
||||
10, // 8: nockchain.public.v2.WalletSendTransactionResponse.error:type_name -> nockchain.public.v2.ErrorStatus
|
||||
7, // 9: nockchain.public.v2.TransactionAcceptedRequest.tx_id:type_name -> nockchain.public.v2.Base58Hash
|
||||
10, // 10: nockchain.public.v2.TransactionAcceptedResponse.error:type_name -> nockchain.public.v2.ErrorStatus
|
||||
0, // 11: nockchain.public.v2.NockchainService.WalletGetBalance:input_type -> nockchain.public.v2.WalletGetBalanceRequest
|
||||
2, // 12: nockchain.public.v2.NockchainService.WalletSendTransaction:input_type -> nockchain.public.v2.WalletSendTransactionRequest
|
||||
4, // 13: nockchain.public.v2.NockchainService.TransactionAccepted:input_type -> nockchain.public.v2.TransactionAcceptedRequest
|
||||
1, // 14: nockchain.public.v2.NockchainService.WalletGetBalance:output_type -> nockchain.public.v2.WalletGetBalanceResponse
|
||||
3, // 15: nockchain.public.v2.NockchainService.WalletSendTransaction:output_type -> nockchain.public.v2.WalletSendTransactionResponse
|
||||
5, // 16: nockchain.public.v2.NockchainService.TransactionAccepted:output_type -> nockchain.public.v2.TransactionAcceptedResponse
|
||||
14, // [14:17] is the sub-list for method output_type
|
||||
11, // [11:14] is the sub-list for method input_type
|
||||
11, // [11:11] is the sub-list for extension type_name
|
||||
11, // [11:11] is the sub-list for extension extendee
|
||||
0, // [0:11] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_nockchain_proto_init() }
|
||||
@ -522,6 +568,10 @@ func file_nockchain_proto_init() {
|
||||
file_blockchain_proto_init()
|
||||
file_primitives_proto_init()
|
||||
file_pagination_proto_init()
|
||||
file_nockchain_proto_msgTypes[0].OneofWrappers = []any{
|
||||
(*WalletGetBalanceRequest_Address)(nil),
|
||||
(*WalletGetBalanceRequest_FirstName)(nil),
|
||||
}
|
||||
file_nockchain_proto_msgTypes[1].OneofWrappers = []any{
|
||||
(*WalletGetBalanceResponse_Balance)(nil),
|
||||
(*WalletGetBalanceResponse_Error)(nil),
|
||||
|
||||
@ -21,9 +21,9 @@ import (
|
||||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
NockchainService_WalletGetBalance_FullMethodName = "/nockchain.public.v1.NockchainService/WalletGetBalance"
|
||||
NockchainService_WalletSendTransaction_FullMethodName = "/nockchain.public.v1.NockchainService/WalletSendTransaction"
|
||||
NockchainService_TransactionAccepted_FullMethodName = "/nockchain.public.v1.NockchainService/TransactionAccepted"
|
||||
NockchainService_WalletGetBalance_FullMethodName = "/nockchain.public.v2.NockchainService/WalletGetBalance"
|
||||
NockchainService_WalletSendTransaction_FullMethodName = "/nockchain.public.v2.NockchainService/WalletSendTransaction"
|
||||
NockchainService_TransactionAccepted_FullMethodName = "/nockchain.public.v2.NockchainService/TransactionAccepted"
|
||||
)
|
||||
|
||||
// NockchainServiceClient is the client API for NockchainService service.
|
||||
@ -178,7 +178,7 @@ func _NockchainService_TransactionAccepted_Handler(srv interface{}, ctx context.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var NockchainService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "nockchain.public.v1.NockchainService",
|
||||
ServiceName: "nockchain.public.v2.NockchainService",
|
||||
HandlerType: (*NockchainServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
|
||||
@ -152,7 +152,7 @@ var File_pagination_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_pagination_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\x10pagination.proto\x12\x13nockchain.public.v1\"\x80\x01\n" +
|
||||
"\x10pagination.proto\x12\x13nockchain.public.v2\"\x80\x01\n" +
|
||||
"\vPageRequest\x125\n" +
|
||||
"\x17client_page_items_limit\x18\x01 \x01(\rR\x14clientPageItemsLimit\x12\x1d\n" +
|
||||
"\n" +
|
||||
@ -175,8 +175,8 @@ func file_pagination_proto_rawDescGZIP() []byte {
|
||||
|
||||
var file_pagination_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_pagination_proto_goTypes = []any{
|
||||
(*PageRequest)(nil), // 0: nockchain.public.v1.PageRequest
|
||||
(*PageResponse)(nil), // 1: nockchain.public.v1.PageResponse
|
||||
(*PageRequest)(nil), // 0: nockchain.public.v2.PageRequest
|
||||
(*PageResponse)(nil), // 1: nockchain.public.v2.PageResponse
|
||||
}
|
||||
var file_pagination_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
|
||||
@ -101,7 +101,7 @@ func (ErrorCode) EnumDescriptor() ([]byte, []int) {
|
||||
|
||||
type ErrorStatus struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Code ErrorCode `protobuf:"varint,1,opt,name=code,proto3,enum=nockchain.public.v1.ErrorCode" json:"code,omitempty"`
|
||||
Code ErrorCode `protobuf:"varint,1,opt,name=code,proto3,enum=nockchain.public.v2.ErrorCode" json:"code,omitempty"`
|
||||
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
|
||||
Details *string `protobuf:"bytes,3,opt,name=details,proto3,oneof" json:"details,omitempty"` // additional error context
|
||||
unknownFields protoimpl.UnknownFields
|
||||
@ -598,6 +598,50 @@ func (x *Base58Hash) GetHash() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
type Base58Pubkey struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *Base58Pubkey) Reset() {
|
||||
*x = Base58Pubkey{}
|
||||
mi := &file_primitives_proto_msgTypes[9]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *Base58Pubkey) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Base58Pubkey) ProtoMessage() {}
|
||||
|
||||
func (x *Base58Pubkey) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_primitives_proto_msgTypes[9]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Base58Pubkey.ProtoReflect.Descriptor instead.
|
||||
func (*Base58Pubkey) Descriptor() ([]byte, []int) {
|
||||
return file_primitives_proto_rawDescGZIP(), []int{9}
|
||||
}
|
||||
|
||||
func (x *Base58Pubkey) GetKey() string {
|
||||
if x != nil {
|
||||
return x.Key
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// pub struct SchnorrPubkey(pub CheetahPoint);
|
||||
type SchnorrPubkey struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
@ -608,7 +652,7 @@ type SchnorrPubkey struct {
|
||||
|
||||
func (x *SchnorrPubkey) Reset() {
|
||||
*x = SchnorrPubkey{}
|
||||
mi := &file_primitives_proto_msgTypes[9]
|
||||
mi := &file_primitives_proto_msgTypes[10]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -620,7 +664,7 @@ func (x *SchnorrPubkey) String() string {
|
||||
func (*SchnorrPubkey) ProtoMessage() {}
|
||||
|
||||
func (x *SchnorrPubkey) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_primitives_proto_msgTypes[9]
|
||||
mi := &file_primitives_proto_msgTypes[10]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -633,7 +677,7 @@ func (x *SchnorrPubkey) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use SchnorrPubkey.ProtoReflect.Descriptor instead.
|
||||
func (*SchnorrPubkey) Descriptor() ([]byte, []int) {
|
||||
return file_primitives_proto_rawDescGZIP(), []int{9}
|
||||
return file_primitives_proto_rawDescGZIP(), []int{10}
|
||||
}
|
||||
|
||||
func (x *SchnorrPubkey) GetValue() *CheetahPoint {
|
||||
@ -659,7 +703,7 @@ type CheetahPoint struct {
|
||||
|
||||
func (x *CheetahPoint) Reset() {
|
||||
*x = CheetahPoint{}
|
||||
mi := &file_primitives_proto_msgTypes[10]
|
||||
mi := &file_primitives_proto_msgTypes[11]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -671,7 +715,7 @@ func (x *CheetahPoint) String() string {
|
||||
func (*CheetahPoint) ProtoMessage() {}
|
||||
|
||||
func (x *CheetahPoint) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_primitives_proto_msgTypes[10]
|
||||
mi := &file_primitives_proto_msgTypes[11]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -684,7 +728,7 @@ func (x *CheetahPoint) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use CheetahPoint.ProtoReflect.Descriptor instead.
|
||||
func (*CheetahPoint) Descriptor() ([]byte, []int) {
|
||||
return file_primitives_proto_rawDescGZIP(), []int{10}
|
||||
return file_primitives_proto_rawDescGZIP(), []int{11}
|
||||
}
|
||||
|
||||
func (x *CheetahPoint) GetX() *SixBelt {
|
||||
@ -723,7 +767,7 @@ type SixBelt struct {
|
||||
|
||||
func (x *SixBelt) Reset() {
|
||||
*x = SixBelt{}
|
||||
mi := &file_primitives_proto_msgTypes[11]
|
||||
mi := &file_primitives_proto_msgTypes[12]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -735,7 +779,7 @@ func (x *SixBelt) String() string {
|
||||
func (*SixBelt) ProtoMessage() {}
|
||||
|
||||
func (x *SixBelt) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_primitives_proto_msgTypes[11]
|
||||
mi := &file_primitives_proto_msgTypes[12]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -748,7 +792,7 @@ func (x *SixBelt) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use SixBelt.ProtoReflect.Descriptor instead.
|
||||
func (*SixBelt) Descriptor() ([]byte, []int) {
|
||||
return file_primitives_proto_rawDescGZIP(), []int{11}
|
||||
return file_primitives_proto_rawDescGZIP(), []int{12}
|
||||
}
|
||||
|
||||
func (x *SixBelt) GetBelt_1() *Belt {
|
||||
@ -803,7 +847,7 @@ type Belt struct {
|
||||
|
||||
func (x *Belt) Reset() {
|
||||
*x = Belt{}
|
||||
mi := &file_primitives_proto_msgTypes[12]
|
||||
mi := &file_primitives_proto_msgTypes[13]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -815,7 +859,7 @@ func (x *Belt) String() string {
|
||||
func (*Belt) ProtoMessage() {}
|
||||
|
||||
func (x *Belt) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_primitives_proto_msgTypes[12]
|
||||
mi := &file_primitives_proto_msgTypes[13]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -828,7 +872,7 @@ func (x *Belt) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use Belt.ProtoReflect.Descriptor instead.
|
||||
func (*Belt) Descriptor() ([]byte, []int) {
|
||||
return file_primitives_proto_rawDescGZIP(), []int{12}
|
||||
return file_primitives_proto_rawDescGZIP(), []int{13}
|
||||
}
|
||||
|
||||
func (x *Belt) GetValue() uint64 {
|
||||
@ -842,9 +886,9 @@ var File_primitives_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_primitives_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\x10primitives.proto\x12\x13nockchain.public.v1\"\x86\x01\n" +
|
||||
"\x10primitives.proto\x12\x13nockchain.public.v2\"\x86\x01\n" +
|
||||
"\vErrorStatus\x122\n" +
|
||||
"\x04code\x18\x01 \x01(\x0e2\x1e.nockchain.public.v1.ErrorCodeR\x04code\x12\x18\n" +
|
||||
"\x04code\x18\x01 \x01(\x0e2\x1e.nockchain.public.v2.ErrorCodeR\x04code\x12\x18\n" +
|
||||
"\amessage\x18\x02 \x01(\tR\amessage\x12\x1d\n" +
|
||||
"\adetails\x18\x03 \x01(\tH\x00R\adetails\x88\x01\x01B\n" +
|
||||
"\n" +
|
||||
@ -859,36 +903,38 @@ const file_primitives_proto_rawDesc = "" +
|
||||
"\x05Nicks\x12\x14\n" +
|
||||
"\x05value\x18\x01 \x01(\x04R\x05value\"\x9b\x03\n" +
|
||||
"\tEightBelt\x120\n" +
|
||||
"\x06belt_1\x18\x01 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt1\x120\n" +
|
||||
"\x06belt_2\x18\x02 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt2\x120\n" +
|
||||
"\x06belt_3\x18\x03 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt3\x120\n" +
|
||||
"\x06belt_4\x18\x04 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt4\x120\n" +
|
||||
"\x06belt_5\x18\x05 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt5\x120\n" +
|
||||
"\x06belt_6\x18\x06 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt6\x120\n" +
|
||||
"\x06belt_7\x18\a \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt7\x120\n" +
|
||||
"\x06belt_8\x18\b \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt8\"\x80\x02\n" +
|
||||
"\x06belt_1\x18\x01 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt1\x120\n" +
|
||||
"\x06belt_2\x18\x02 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt2\x120\n" +
|
||||
"\x06belt_3\x18\x03 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt3\x120\n" +
|
||||
"\x06belt_4\x18\x04 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt4\x120\n" +
|
||||
"\x06belt_5\x18\x05 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt5\x120\n" +
|
||||
"\x06belt_6\x18\x06 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt6\x120\n" +
|
||||
"\x06belt_7\x18\a \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt7\x120\n" +
|
||||
"\x06belt_8\x18\b \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt8\"\x80\x02\n" +
|
||||
"\x04Hash\x120\n" +
|
||||
"\x06belt_1\x18\x01 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt1\x120\n" +
|
||||
"\x06belt_2\x18\x02 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt2\x120\n" +
|
||||
"\x06belt_3\x18\x03 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt3\x120\n" +
|
||||
"\x06belt_4\x18\x04 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt4\x120\n" +
|
||||
"\x06belt_5\x18\x05 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt5\" \n" +
|
||||
"\x06belt_1\x18\x01 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt1\x120\n" +
|
||||
"\x06belt_2\x18\x02 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt2\x120\n" +
|
||||
"\x06belt_3\x18\x03 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt3\x120\n" +
|
||||
"\x06belt_4\x18\x04 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt4\x120\n" +
|
||||
"\x06belt_5\x18\x05 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt5\" \n" +
|
||||
"\n" +
|
||||
"Base58Hash\x12\x12\n" +
|
||||
"\x04hash\x18\x01 \x01(\tR\x04hash\"H\n" +
|
||||
"\x04hash\x18\x01 \x01(\tR\x04hash\" \n" +
|
||||
"\fBase58Pubkey\x12\x10\n" +
|
||||
"\x03key\x18\x01 \x01(\tR\x03key\"H\n" +
|
||||
"\rSchnorrPubkey\x127\n" +
|
||||
"\x05value\x18\x01 \x01(\v2!.nockchain.public.v1.CheetahPointR\x05value\"x\n" +
|
||||
"\x05value\x18\x01 \x01(\v2!.nockchain.public.v2.CheetahPointR\x05value\"x\n" +
|
||||
"\fCheetahPoint\x12*\n" +
|
||||
"\x01x\x18\x01 \x01(\v2\x1c.nockchain.public.v1.SixBeltR\x01x\x12*\n" +
|
||||
"\x01y\x18\x02 \x01(\v2\x1c.nockchain.public.v1.SixBeltR\x01y\x12\x10\n" +
|
||||
"\x01x\x18\x01 \x01(\v2\x1c.nockchain.public.v2.SixBeltR\x01x\x12*\n" +
|
||||
"\x01y\x18\x02 \x01(\v2\x1c.nockchain.public.v2.SixBeltR\x01y\x12\x10\n" +
|
||||
"\x03inf\x18\x03 \x01(\bR\x03inf\"\xb5\x02\n" +
|
||||
"\aSixBelt\x120\n" +
|
||||
"\x06belt_1\x18\x01 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt1\x120\n" +
|
||||
"\x06belt_2\x18\x02 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt2\x120\n" +
|
||||
"\x06belt_3\x18\x03 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt3\x120\n" +
|
||||
"\x06belt_4\x18\x04 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt4\x120\n" +
|
||||
"\x06belt_5\x18\x05 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt5\x120\n" +
|
||||
"\x06belt_6\x18\x06 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt6\"\x1c\n" +
|
||||
"\x06belt_1\x18\x01 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt1\x120\n" +
|
||||
"\x06belt_2\x18\x02 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt2\x120\n" +
|
||||
"\x06belt_3\x18\x03 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt3\x120\n" +
|
||||
"\x06belt_4\x18\x04 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt4\x120\n" +
|
||||
"\x06belt_5\x18\x05 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt5\x120\n" +
|
||||
"\x06belt_6\x18\x06 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt6\"\x1c\n" +
|
||||
"\x04Belt\x12\x14\n" +
|
||||
"\x05value\x18\x01 \x01(\x04R\x05value*\xf0\x02\n" +
|
||||
"\tErrorCode\x12\x1a\n" +
|
||||
@ -919,47 +965,48 @@ func file_primitives_proto_rawDescGZIP() []byte {
|
||||
}
|
||||
|
||||
var file_primitives_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||
var file_primitives_proto_msgTypes = make([]protoimpl.MessageInfo, 13)
|
||||
var file_primitives_proto_msgTypes = make([]protoimpl.MessageInfo, 14)
|
||||
var file_primitives_proto_goTypes = []any{
|
||||
(ErrorCode)(0), // 0: nockchain.public.v1.ErrorCode
|
||||
(*ErrorStatus)(nil), // 1: nockchain.public.v1.ErrorStatus
|
||||
(*Acknowledged)(nil), // 2: nockchain.public.v1.Acknowledged
|
||||
(*NoteVersion)(nil), // 3: nockchain.public.v1.NoteVersion
|
||||
(*BlockHeight)(nil), // 4: nockchain.public.v1.BlockHeight
|
||||
(*BlockHeightDelta)(nil), // 5: nockchain.public.v1.BlockHeightDelta
|
||||
(*Nicks)(nil), // 6: nockchain.public.v1.Nicks
|
||||
(*EightBelt)(nil), // 7: nockchain.public.v1.EightBelt
|
||||
(*Hash)(nil), // 8: nockchain.public.v1.Hash
|
||||
(*Base58Hash)(nil), // 9: nockchain.public.v1.Base58Hash
|
||||
(*SchnorrPubkey)(nil), // 10: nockchain.public.v1.SchnorrPubkey
|
||||
(*CheetahPoint)(nil), // 11: nockchain.public.v1.CheetahPoint
|
||||
(*SixBelt)(nil), // 12: nockchain.public.v1.SixBelt
|
||||
(*Belt)(nil), // 13: nockchain.public.v1.Belt
|
||||
(ErrorCode)(0), // 0: nockchain.public.v2.ErrorCode
|
||||
(*ErrorStatus)(nil), // 1: nockchain.public.v2.ErrorStatus
|
||||
(*Acknowledged)(nil), // 2: nockchain.public.v2.Acknowledged
|
||||
(*NoteVersion)(nil), // 3: nockchain.public.v2.NoteVersion
|
||||
(*BlockHeight)(nil), // 4: nockchain.public.v2.BlockHeight
|
||||
(*BlockHeightDelta)(nil), // 5: nockchain.public.v2.BlockHeightDelta
|
||||
(*Nicks)(nil), // 6: nockchain.public.v2.Nicks
|
||||
(*EightBelt)(nil), // 7: nockchain.public.v2.EightBelt
|
||||
(*Hash)(nil), // 8: nockchain.public.v2.Hash
|
||||
(*Base58Hash)(nil), // 9: nockchain.public.v2.Base58Hash
|
||||
(*Base58Pubkey)(nil), // 10: nockchain.public.v2.Base58Pubkey
|
||||
(*SchnorrPubkey)(nil), // 11: nockchain.public.v2.SchnorrPubkey
|
||||
(*CheetahPoint)(nil), // 12: nockchain.public.v2.CheetahPoint
|
||||
(*SixBelt)(nil), // 13: nockchain.public.v2.SixBelt
|
||||
(*Belt)(nil), // 14: nockchain.public.v2.Belt
|
||||
}
|
||||
var file_primitives_proto_depIdxs = []int32{
|
||||
0, // 0: nockchain.public.v1.ErrorStatus.code:type_name -> nockchain.public.v1.ErrorCode
|
||||
13, // 1: nockchain.public.v1.EightBelt.belt_1:type_name -> nockchain.public.v1.Belt
|
||||
13, // 2: nockchain.public.v1.EightBelt.belt_2:type_name -> nockchain.public.v1.Belt
|
||||
13, // 3: nockchain.public.v1.EightBelt.belt_3:type_name -> nockchain.public.v1.Belt
|
||||
13, // 4: nockchain.public.v1.EightBelt.belt_4:type_name -> nockchain.public.v1.Belt
|
||||
13, // 5: nockchain.public.v1.EightBelt.belt_5:type_name -> nockchain.public.v1.Belt
|
||||
13, // 6: nockchain.public.v1.EightBelt.belt_6:type_name -> nockchain.public.v1.Belt
|
||||
13, // 7: nockchain.public.v1.EightBelt.belt_7:type_name -> nockchain.public.v1.Belt
|
||||
13, // 8: nockchain.public.v1.EightBelt.belt_8:type_name -> nockchain.public.v1.Belt
|
||||
13, // 9: nockchain.public.v1.Hash.belt_1:type_name -> nockchain.public.v1.Belt
|
||||
13, // 10: nockchain.public.v1.Hash.belt_2:type_name -> nockchain.public.v1.Belt
|
||||
13, // 11: nockchain.public.v1.Hash.belt_3:type_name -> nockchain.public.v1.Belt
|
||||
13, // 12: nockchain.public.v1.Hash.belt_4:type_name -> nockchain.public.v1.Belt
|
||||
13, // 13: nockchain.public.v1.Hash.belt_5:type_name -> nockchain.public.v1.Belt
|
||||
11, // 14: nockchain.public.v1.SchnorrPubkey.value:type_name -> nockchain.public.v1.CheetahPoint
|
||||
12, // 15: nockchain.public.v1.CheetahPoint.x:type_name -> nockchain.public.v1.SixBelt
|
||||
12, // 16: nockchain.public.v1.CheetahPoint.y:type_name -> nockchain.public.v1.SixBelt
|
||||
13, // 17: nockchain.public.v1.SixBelt.belt_1:type_name -> nockchain.public.v1.Belt
|
||||
13, // 18: nockchain.public.v1.SixBelt.belt_2:type_name -> nockchain.public.v1.Belt
|
||||
13, // 19: nockchain.public.v1.SixBelt.belt_3:type_name -> nockchain.public.v1.Belt
|
||||
13, // 20: nockchain.public.v1.SixBelt.belt_4:type_name -> nockchain.public.v1.Belt
|
||||
13, // 21: nockchain.public.v1.SixBelt.belt_5:type_name -> nockchain.public.v1.Belt
|
||||
13, // 22: nockchain.public.v1.SixBelt.belt_6:type_name -> nockchain.public.v1.Belt
|
||||
0, // 0: nockchain.public.v2.ErrorStatus.code:type_name -> nockchain.public.v2.ErrorCode
|
||||
14, // 1: nockchain.public.v2.EightBelt.belt_1:type_name -> nockchain.public.v2.Belt
|
||||
14, // 2: nockchain.public.v2.EightBelt.belt_2:type_name -> nockchain.public.v2.Belt
|
||||
14, // 3: nockchain.public.v2.EightBelt.belt_3:type_name -> nockchain.public.v2.Belt
|
||||
14, // 4: nockchain.public.v2.EightBelt.belt_4:type_name -> nockchain.public.v2.Belt
|
||||
14, // 5: nockchain.public.v2.EightBelt.belt_5:type_name -> nockchain.public.v2.Belt
|
||||
14, // 6: nockchain.public.v2.EightBelt.belt_6:type_name -> nockchain.public.v2.Belt
|
||||
14, // 7: nockchain.public.v2.EightBelt.belt_7:type_name -> nockchain.public.v2.Belt
|
||||
14, // 8: nockchain.public.v2.EightBelt.belt_8:type_name -> nockchain.public.v2.Belt
|
||||
14, // 9: nockchain.public.v2.Hash.belt_1:type_name -> nockchain.public.v2.Belt
|
||||
14, // 10: nockchain.public.v2.Hash.belt_2:type_name -> nockchain.public.v2.Belt
|
||||
14, // 11: nockchain.public.v2.Hash.belt_3:type_name -> nockchain.public.v2.Belt
|
||||
14, // 12: nockchain.public.v2.Hash.belt_4:type_name -> nockchain.public.v2.Belt
|
||||
14, // 13: nockchain.public.v2.Hash.belt_5:type_name -> nockchain.public.v2.Belt
|
||||
12, // 14: nockchain.public.v2.SchnorrPubkey.value:type_name -> nockchain.public.v2.CheetahPoint
|
||||
13, // 15: nockchain.public.v2.CheetahPoint.x:type_name -> nockchain.public.v2.SixBelt
|
||||
13, // 16: nockchain.public.v2.CheetahPoint.y:type_name -> nockchain.public.v2.SixBelt
|
||||
14, // 17: nockchain.public.v2.SixBelt.belt_1:type_name -> nockchain.public.v2.Belt
|
||||
14, // 18: nockchain.public.v2.SixBelt.belt_2:type_name -> nockchain.public.v2.Belt
|
||||
14, // 19: nockchain.public.v2.SixBelt.belt_3:type_name -> nockchain.public.v2.Belt
|
||||
14, // 20: nockchain.public.v2.SixBelt.belt_4:type_name -> nockchain.public.v2.Belt
|
||||
14, // 21: nockchain.public.v2.SixBelt.belt_5:type_name -> nockchain.public.v2.Belt
|
||||
14, // 22: nockchain.public.v2.SixBelt.belt_6:type_name -> nockchain.public.v2.Belt
|
||||
23, // [23:23] is the sub-list for method output_type
|
||||
23, // [23:23] is the sub-list for method input_type
|
||||
23, // [23:23] is the sub-list for extension type_name
|
||||
@ -979,7 +1026,7 @@ func file_primitives_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_primitives_proto_rawDesc), len(file_primitives_proto_rawDesc)),
|
||||
NumEnums: 1,
|
||||
NumMessages: 13,
|
||||
NumMessages: 14,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
||||
@ -161,7 +161,7 @@ type ImportKeysRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
|
||||
Version uint64 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"`
|
||||
ImportType ImportType `protobuf:"varint,3,opt,name=import_type,json=importType,proto3,enum=nockchain.public.v1.ImportType" json:"import_type,omitempty"`
|
||||
ImportType ImportType `protobuf:"varint,3,opt,name=import_type,json=importType,proto3,enum=nockchain.public.v2.ImportType" json:"import_type,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
@ -449,15 +449,13 @@ type CreateTxRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Names string `protobuf:"bytes,1,opt,name=names,proto3" json:"names,omitempty"`
|
||||
Recipients string `protobuf:"bytes,2,opt,name=recipients,proto3" json:"recipients,omitempty"`
|
||||
Gifts string `protobuf:"bytes,3,opt,name=gifts,proto3" json:"gifts,omitempty"`
|
||||
Fee uint64 `protobuf:"varint,4,opt,name=fee,proto3" json:"fee,omitempty"`
|
||||
IsMasterKey bool `protobuf:"varint,5,opt,name=is_master_key,json=isMasterKey,proto3" json:"is_master_key,omitempty"`
|
||||
Key string `protobuf:"bytes,6,opt,name=key,proto3" json:"key,omitempty"`
|
||||
ChainCode string `protobuf:"bytes,7,opt,name=chain_code,json=chainCode,proto3" json:"chain_code,omitempty"`
|
||||
Index uint64 `protobuf:"varint,8,opt,name=index,proto3" json:"index,omitempty"`
|
||||
Hardened bool `protobuf:"varint,9,opt,name=hardened,proto3" json:"hardened,omitempty"`
|
||||
Version uint64 `protobuf:"varint,10,opt,name=version,proto3" json:"version,omitempty"`
|
||||
TimelockIntent *TimelockIntent `protobuf:"bytes,11,opt,name=timelock_intent,json=timelockIntent,proto3" json:"timelock_intent,omitempty"`
|
||||
Fee uint64 `protobuf:"varint,3,opt,name=fee,proto3" json:"fee,omitempty"`
|
||||
IsMasterKey bool `protobuf:"varint,4,opt,name=is_master_key,json=isMasterKey,proto3" json:"is_master_key,omitempty"`
|
||||
Seed string `protobuf:"bytes,5,opt,name=seed,proto3" json:"seed,omitempty"`
|
||||
Index uint64 `protobuf:"varint,6,opt,name=index,proto3" json:"index,omitempty"`
|
||||
Hardened bool `protobuf:"varint,7,opt,name=hardened,proto3" json:"hardened,omitempty"`
|
||||
Version uint64 `protobuf:"varint,8,opt,name=version,proto3" json:"version,omitempty"`
|
||||
RefundAddress string `protobuf:"bytes,9,opt,name=refund_address,json=refundAddress,proto3" json:"refund_address,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
@ -506,13 +504,6 @@ func (x *CreateTxRequest) GetRecipients() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CreateTxRequest) GetGifts() string {
|
||||
if x != nil {
|
||||
return x.Gifts
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CreateTxRequest) GetFee() uint64 {
|
||||
if x != nil {
|
||||
return x.Fee
|
||||
@ -527,16 +518,9 @@ func (x *CreateTxRequest) GetIsMasterKey() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *CreateTxRequest) GetKey() string {
|
||||
func (x *CreateTxRequest) GetSeed() string {
|
||||
if x != nil {
|
||||
return x.Key
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CreateTxRequest) GetChainCode() string {
|
||||
if x != nil {
|
||||
return x.ChainCode
|
||||
return x.Seed
|
||||
}
|
||||
return ""
|
||||
}
|
||||
@ -562,11 +546,11 @@ func (x *CreateTxRequest) GetVersion() uint64 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *CreateTxRequest) GetTimelockIntent() *TimelockIntent {
|
||||
func (x *CreateTxRequest) GetRefundAddress() string {
|
||||
if x != nil {
|
||||
return x.TimelockIntent
|
||||
return x.RefundAddress
|
||||
}
|
||||
return nil
|
||||
return ""
|
||||
}
|
||||
|
||||
type CreateTxResponse struct {
|
||||
@ -620,6 +604,7 @@ type ScanRequest struct {
|
||||
SearchDepth uint64 `protobuf:"varint,3,opt,name=search_depth,json=searchDepth,proto3" json:"search_depth,omitempty"`
|
||||
IncludeTimelocks bool `protobuf:"varint,4,opt,name=include_timelocks,json=includeTimelocks,proto3" json:"include_timelocks,omitempty"`
|
||||
IncludeMultisig bool `protobuf:"varint,5,opt,name=include_multisig,json=includeMultisig,proto3" json:"include_multisig,omitempty"`
|
||||
Version uint64 `protobuf:"varint,6,opt,name=version,proto3" json:"version,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
@ -689,6 +674,13 @@ func (x *ScanRequest) GetIncludeMultisig() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *ScanRequest) GetVersion() uint64 {
|
||||
if x != nil {
|
||||
return x.Version
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type ScanResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
ScanData []*ScanData `protobuf:"bytes,1,rep,name=scan_data,json=scanData,proto3" json:"scan_data,omitempty"`
|
||||
@ -735,7 +727,11 @@ func (x *ScanResponse) GetScanData() []*ScanData {
|
||||
|
||||
type GetBalanceRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
|
||||
// Types that are valid to be assigned to Selector:
|
||||
//
|
||||
// *GetBalanceRequest_Address
|
||||
// *GetBalanceRequest_FirstName
|
||||
Selector isGetBalanceRequest_Selector `protobuf_oneof:"selector"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
@ -770,16 +766,50 @@ func (*GetBalanceRequest) Descriptor() ([]byte, []int) {
|
||||
return file_service_proto_rawDescGZIP(), []int{10}
|
||||
}
|
||||
|
||||
func (x *GetBalanceRequest) GetSelector() isGetBalanceRequest_Selector {
|
||||
if x != nil {
|
||||
return x.Selector
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *GetBalanceRequest) GetAddress() string {
|
||||
if x != nil {
|
||||
if x, ok := x.Selector.(*GetBalanceRequest_Address); ok {
|
||||
return x.Address
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *GetBalanceRequest) GetFirstName() string {
|
||||
if x != nil {
|
||||
if x, ok := x.Selector.(*GetBalanceRequest_FirstName); ok {
|
||||
return x.FirstName
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type isGetBalanceRequest_Selector interface {
|
||||
isGetBalanceRequest_Selector()
|
||||
}
|
||||
|
||||
type GetBalanceRequest_Address struct {
|
||||
Address string `protobuf:"bytes,1,opt,name=address,proto3,oneof"`
|
||||
}
|
||||
|
||||
type GetBalanceRequest_FirstName struct {
|
||||
FirstName string `protobuf:"bytes,2,opt,name=first_name,json=firstName,proto3,oneof"`
|
||||
}
|
||||
|
||||
func (*GetBalanceRequest_Address) isGetBalanceRequest_Selector() {}
|
||||
|
||||
func (*GetBalanceRequest_FirstName) isGetBalanceRequest_Selector() {}
|
||||
|
||||
type GetBalanceResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Data *WalletBalanceData `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
|
||||
Data *Balance `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
@ -814,7 +844,7 @@ func (*GetBalanceResponse) Descriptor() ([]byte, []int) {
|
||||
return file_service_proto_rawDescGZIP(), []int{11}
|
||||
}
|
||||
|
||||
func (x *GetBalanceResponse) GetData() *WalletBalanceData {
|
||||
func (x *GetBalanceResponse) GetData() *Balance {
|
||||
if x != nil {
|
||||
return x.Data
|
||||
}
|
||||
@ -913,7 +943,7 @@ var File_service_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_service_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\rservice.proto\x12\x13nockchain.public.v1\x1a\vtypes.proto\x1a\x10blockchain.proto\x1a\x0fnockchain.proto\")\n" +
|
||||
"\rservice.proto\x12\x13nockchain.public.v2\x1a\vtypes.proto\x1a\x10blockchain.proto\x1a\x0fnockchain.proto\")\n" +
|
||||
"\rKeygenRequest\x12\x18\n" +
|
||||
"\aversion\x18\x01 \x01(\x04R\aversion\"\xf2\x01\n" +
|
||||
"\x0eKeygenResponse\x12\x18\n" +
|
||||
@ -929,7 +959,7 @@ const file_service_proto_rawDesc = "" +
|
||||
"\x11ImportKeysRequest\x12\x10\n" +
|
||||
"\x03key\x18\x01 \x01(\tR\x03key\x12\x18\n" +
|
||||
"\aversion\x18\x02 \x01(\x04R\aversion\x12@\n" +
|
||||
"\vimport_type\x18\x03 \x01(\x0e2\x1f.nockchain.public.v1.ImportTypeR\n" +
|
||||
"\vimport_type\x18\x03 \x01(\x0e2\x1f.nockchain.public.v2.ImportTypeR\n" +
|
||||
"importType\"\xf6\x01\n" +
|
||||
"\x12ImportKeysResponse\x12\x18\n" +
|
||||
"\aaddress\x18\x01 \x01(\tR\aaddress\x12\x1f\n" +
|
||||
@ -952,52 +982,53 @@ const file_service_proto_rawDesc = "" +
|
||||
"privateKey\x12\x1d\n" +
|
||||
"\n" +
|
||||
"chain_code\x18\x03 \x01(\tR\tchainCode\x12\x18\n" +
|
||||
"\aversion\x18\x04 \x01(\x04R\aversion\"\xde\x02\n" +
|
||||
"\aversion\x18\x04 \x01(\x04R\aversion\"\x84\x02\n" +
|
||||
"\x0fCreateTxRequest\x12\x14\n" +
|
||||
"\x05names\x18\x01 \x01(\tR\x05names\x12\x1e\n" +
|
||||
"\n" +
|
||||
"recipients\x18\x02 \x01(\tR\n" +
|
||||
"recipients\x12\x14\n" +
|
||||
"\x05gifts\x18\x03 \x01(\tR\x05gifts\x12\x10\n" +
|
||||
"\x03fee\x18\x04 \x01(\x04R\x03fee\x12\"\n" +
|
||||
"\ris_master_key\x18\x05 \x01(\bR\visMasterKey\x12\x10\n" +
|
||||
"\x03key\x18\x06 \x01(\tR\x03key\x12\x1d\n" +
|
||||
"\n" +
|
||||
"chain_code\x18\a \x01(\tR\tchainCode\x12\x14\n" +
|
||||
"\x05index\x18\b \x01(\x04R\x05index\x12\x1a\n" +
|
||||
"\bhardened\x18\t \x01(\bR\bhardened\x12\x18\n" +
|
||||
"\aversion\x18\n" +
|
||||
" \x01(\x04R\aversion\x12L\n" +
|
||||
"\x0ftimelock_intent\x18\v \x01(\v2#.nockchain.public.v1.TimelockIntentR\x0etimelockIntent\"D\n" +
|
||||
"recipients\x12\x10\n" +
|
||||
"\x03fee\x18\x03 \x01(\x04R\x03fee\x12\"\n" +
|
||||
"\ris_master_key\x18\x04 \x01(\bR\visMasterKey\x12\x12\n" +
|
||||
"\x04seed\x18\x05 \x01(\tR\x04seed\x12\x14\n" +
|
||||
"\x05index\x18\x06 \x01(\x04R\x05index\x12\x1a\n" +
|
||||
"\bhardened\x18\a \x01(\bR\bhardened\x12\x18\n" +
|
||||
"\aversion\x18\b \x01(\x04R\aversion\x12%\n" +
|
||||
"\x0erefund_address\x18\t \x01(\tR\rrefundAddress\"D\n" +
|
||||
"\x10CreateTxResponse\x120\n" +
|
||||
"\x05rawTx\x18\x01 \x01(\v2\x1a.nockchain.public.v1.RawTxR\x05rawTx\"\xcc\x01\n" +
|
||||
"\x05rawTx\x18\x01 \x01(\v2\x1a.nockchain.public.v2.RawTxR\x05rawTx\"\xe6\x01\n" +
|
||||
"\vScanRequest\x12#\n" +
|
||||
"\rmaster_pubkey\x18\x01 \x01(\tR\fmasterPubkey\x12\x1d\n" +
|
||||
"\n" +
|
||||
"chain_code\x18\x02 \x01(\tR\tchainCode\x12!\n" +
|
||||
"\fsearch_depth\x18\x03 \x01(\x04R\vsearchDepth\x12+\n" +
|
||||
"\x11include_timelocks\x18\x04 \x01(\bR\x10includeTimelocks\x12)\n" +
|
||||
"\x10include_multisig\x18\x05 \x01(\bR\x0fincludeMultisig\"J\n" +
|
||||
"\x10include_multisig\x18\x05 \x01(\bR\x0fincludeMultisig\x12\x18\n" +
|
||||
"\aversion\x18\x06 \x01(\x04R\aversion\"J\n" +
|
||||
"\fScanResponse\x12:\n" +
|
||||
"\tscan_data\x18\x01 \x03(\v2\x1d.nockchain.public.v1.ScanDataR\bscanData\"-\n" +
|
||||
"\x11GetBalanceRequest\x12\x18\n" +
|
||||
"\aaddress\x18\x01 \x01(\tR\aaddress\"P\n" +
|
||||
"\x12GetBalanceResponse\x12:\n" +
|
||||
"\x04data\x18\x01 \x01(\v2&.nockchain.public.v1.WalletBalanceDataR\x04data\"K\n" +
|
||||
"\x16SendTransactionRequest\x121\n" +
|
||||
"\x06raw_tx\x18\x01 \x01(\v2\x1a.nockchain.public.v1.RawTxR\x05rawTx\"i\n" +
|
||||
"\x17SendTransactionResponse\x12N\n" +
|
||||
"\bresponse\x18\x01 \x01(\v22.nockchain.public.v1.WalletSendTransactionResponseR\bresponse2\x9c\x06\n" +
|
||||
"\rWalletService\x12Q\n" +
|
||||
"\x06Keygen\x12\".nockchain.public.v1.KeygenRequest\x1a#.nockchain.public.v1.KeygenResponse\x12]\n" +
|
||||
"\tscan_data\x18\x01 \x03(\v2\x1d.nockchain.public.v2.ScanDataR\bscanData\"\\\n" +
|
||||
"\x11GetBalanceRequest\x12\x1a\n" +
|
||||
"\aaddress\x18\x01 \x01(\tH\x00R\aaddress\x12\x1f\n" +
|
||||
"\n" +
|
||||
"ImportKeys\x12&.nockchain.public.v1.ImportKeysRequest\x1a'.nockchain.public.v1.ImportKeysResponse\x12`\n" +
|
||||
"\vDeriveChild\x12'.nockchain.public.v1.DeriveChildRequest\x1a(.nockchain.public.v1.DeriveChildResponse\x12W\n" +
|
||||
"\bCreateTx\x12$.nockchain.public.v1.CreateTxRequest\x1a%.nockchain.public.v1.CreateTxResponse\x12K\n" +
|
||||
"\x04Scan\x12 .nockchain.public.v1.ScanRequest\x1a!.nockchain.public.v1.ScanResponse\x12c\n" +
|
||||
"\x10WalletGetBalance\x12&.nockchain.public.v1.GetBalanceRequest\x1a'.nockchain.public.v1.GetBalanceResponse\x12r\n" +
|
||||
"\x15WalletSendTransaction\x12+.nockchain.public.v1.SendTransactionRequest\x1a,.nockchain.public.v1.SendTransactionResponse\x12x\n" +
|
||||
"\x13TransactionAccepted\x12/.nockchain.public.v1.TransactionAcceptedRequest\x1a0.nockchain.public.v1.TransactionAcceptedResponseB\x0eZ\f./;nockchainb\x06proto3"
|
||||
"first_name\x18\x02 \x01(\tH\x00R\tfirstNameB\n" +
|
||||
"\n" +
|
||||
"\bselector\"F\n" +
|
||||
"\x12GetBalanceResponse\x120\n" +
|
||||
"\x04data\x18\x01 \x01(\v2\x1c.nockchain.public.v2.BalanceR\x04data\"K\n" +
|
||||
"\x16SendTransactionRequest\x121\n" +
|
||||
"\x06raw_tx\x18\x01 \x01(\v2\x1a.nockchain.public.v2.RawTxR\x05rawTx\"i\n" +
|
||||
"\x17SendTransactionResponse\x12N\n" +
|
||||
"\bresponse\x18\x01 \x01(\v22.nockchain.public.v2.WalletSendTransactionResponseR\bresponse2\x9c\x06\n" +
|
||||
"\rWalletService\x12Q\n" +
|
||||
"\x06Keygen\x12\".nockchain.public.v2.KeygenRequest\x1a#.nockchain.public.v2.KeygenResponse\x12]\n" +
|
||||
"\n" +
|
||||
"ImportKeys\x12&.nockchain.public.v2.ImportKeysRequest\x1a'.nockchain.public.v2.ImportKeysResponse\x12`\n" +
|
||||
"\vDeriveChild\x12'.nockchain.public.v2.DeriveChildRequest\x1a(.nockchain.public.v2.DeriveChildResponse\x12W\n" +
|
||||
"\bCreateTx\x12$.nockchain.public.v2.CreateTxRequest\x1a%.nockchain.public.v2.CreateTxResponse\x12K\n" +
|
||||
"\x04Scan\x12 .nockchain.public.v2.ScanRequest\x1a!.nockchain.public.v2.ScanResponse\x12c\n" +
|
||||
"\x10WalletGetBalance\x12&.nockchain.public.v2.GetBalanceRequest\x1a'.nockchain.public.v2.GetBalanceResponse\x12r\n" +
|
||||
"\x15WalletSendTransaction\x12+.nockchain.public.v2.SendTransactionRequest\x1a,.nockchain.public.v2.SendTransactionResponse\x12x\n" +
|
||||
"\x13TransactionAccepted\x12/.nockchain.public.v2.TransactionAcceptedRequest\x1a0.nockchain.public.v2.TransactionAcceptedResponseB\x0eZ\f./;nockchainb\x06proto3"
|
||||
|
||||
var (
|
||||
file_service_proto_rawDescOnce sync.Once
|
||||
@ -1013,58 +1044,56 @@ func file_service_proto_rawDescGZIP() []byte {
|
||||
|
||||
var file_service_proto_msgTypes = make([]protoimpl.MessageInfo, 14)
|
||||
var file_service_proto_goTypes = []any{
|
||||
(*KeygenRequest)(nil), // 0: nockchain.public.v1.KeygenRequest
|
||||
(*KeygenResponse)(nil), // 1: nockchain.public.v1.KeygenResponse
|
||||
(*ImportKeysRequest)(nil), // 2: nockchain.public.v1.ImportKeysRequest
|
||||
(*ImportKeysResponse)(nil), // 3: nockchain.public.v1.ImportKeysResponse
|
||||
(*DeriveChildRequest)(nil), // 4: nockchain.public.v1.DeriveChildRequest
|
||||
(*DeriveChildResponse)(nil), // 5: nockchain.public.v1.DeriveChildResponse
|
||||
(*CreateTxRequest)(nil), // 6: nockchain.public.v1.CreateTxRequest
|
||||
(*CreateTxResponse)(nil), // 7: nockchain.public.v1.CreateTxResponse
|
||||
(*ScanRequest)(nil), // 8: nockchain.public.v1.ScanRequest
|
||||
(*ScanResponse)(nil), // 9: nockchain.public.v1.ScanResponse
|
||||
(*GetBalanceRequest)(nil), // 10: nockchain.public.v1.GetBalanceRequest
|
||||
(*GetBalanceResponse)(nil), // 11: nockchain.public.v1.GetBalanceResponse
|
||||
(*SendTransactionRequest)(nil), // 12: nockchain.public.v1.SendTransactionRequest
|
||||
(*SendTransactionResponse)(nil), // 13: nockchain.public.v1.SendTransactionResponse
|
||||
(ImportType)(0), // 14: nockchain.public.v1.ImportType
|
||||
(*TimelockIntent)(nil), // 15: nockchain.public.v1.TimelockIntent
|
||||
(*RawTx)(nil), // 16: nockchain.public.v1.RawTx
|
||||
(*ScanData)(nil), // 17: nockchain.public.v1.ScanData
|
||||
(*WalletBalanceData)(nil), // 18: nockchain.public.v1.WalletBalanceData
|
||||
(*WalletSendTransactionResponse)(nil), // 19: nockchain.public.v1.WalletSendTransactionResponse
|
||||
(*TransactionAcceptedRequest)(nil), // 20: nockchain.public.v1.TransactionAcceptedRequest
|
||||
(*TransactionAcceptedResponse)(nil), // 21: nockchain.public.v1.TransactionAcceptedResponse
|
||||
(*KeygenRequest)(nil), // 0: nockchain.public.v2.KeygenRequest
|
||||
(*KeygenResponse)(nil), // 1: nockchain.public.v2.KeygenResponse
|
||||
(*ImportKeysRequest)(nil), // 2: nockchain.public.v2.ImportKeysRequest
|
||||
(*ImportKeysResponse)(nil), // 3: nockchain.public.v2.ImportKeysResponse
|
||||
(*DeriveChildRequest)(nil), // 4: nockchain.public.v2.DeriveChildRequest
|
||||
(*DeriveChildResponse)(nil), // 5: nockchain.public.v2.DeriveChildResponse
|
||||
(*CreateTxRequest)(nil), // 6: nockchain.public.v2.CreateTxRequest
|
||||
(*CreateTxResponse)(nil), // 7: nockchain.public.v2.CreateTxResponse
|
||||
(*ScanRequest)(nil), // 8: nockchain.public.v2.ScanRequest
|
||||
(*ScanResponse)(nil), // 9: nockchain.public.v2.ScanResponse
|
||||
(*GetBalanceRequest)(nil), // 10: nockchain.public.v2.GetBalanceRequest
|
||||
(*GetBalanceResponse)(nil), // 11: nockchain.public.v2.GetBalanceResponse
|
||||
(*SendTransactionRequest)(nil), // 12: nockchain.public.v2.SendTransactionRequest
|
||||
(*SendTransactionResponse)(nil), // 13: nockchain.public.v2.SendTransactionResponse
|
||||
(ImportType)(0), // 14: nockchain.public.v2.ImportType
|
||||
(*RawTx)(nil), // 15: nockchain.public.v2.RawTx
|
||||
(*ScanData)(nil), // 16: nockchain.public.v2.ScanData
|
||||
(*Balance)(nil), // 17: nockchain.public.v2.Balance
|
||||
(*WalletSendTransactionResponse)(nil), // 18: nockchain.public.v2.WalletSendTransactionResponse
|
||||
(*TransactionAcceptedRequest)(nil), // 19: nockchain.public.v2.TransactionAcceptedRequest
|
||||
(*TransactionAcceptedResponse)(nil), // 20: nockchain.public.v2.TransactionAcceptedResponse
|
||||
}
|
||||
var file_service_proto_depIdxs = []int32{
|
||||
14, // 0: nockchain.public.v1.ImportKeysRequest.import_type:type_name -> nockchain.public.v1.ImportType
|
||||
15, // 1: nockchain.public.v1.CreateTxRequest.timelock_intent:type_name -> nockchain.public.v1.TimelockIntent
|
||||
16, // 2: nockchain.public.v1.CreateTxResponse.rawTx:type_name -> nockchain.public.v1.RawTx
|
||||
17, // 3: nockchain.public.v1.ScanResponse.scan_data:type_name -> nockchain.public.v1.ScanData
|
||||
18, // 4: nockchain.public.v1.GetBalanceResponse.data:type_name -> nockchain.public.v1.WalletBalanceData
|
||||
16, // 5: nockchain.public.v1.SendTransactionRequest.raw_tx:type_name -> nockchain.public.v1.RawTx
|
||||
19, // 6: nockchain.public.v1.SendTransactionResponse.response:type_name -> nockchain.public.v1.WalletSendTransactionResponse
|
||||
0, // 7: nockchain.public.v1.WalletService.Keygen:input_type -> nockchain.public.v1.KeygenRequest
|
||||
2, // 8: nockchain.public.v1.WalletService.ImportKeys:input_type -> nockchain.public.v1.ImportKeysRequest
|
||||
4, // 9: nockchain.public.v1.WalletService.DeriveChild:input_type -> nockchain.public.v1.DeriveChildRequest
|
||||
6, // 10: nockchain.public.v1.WalletService.CreateTx:input_type -> nockchain.public.v1.CreateTxRequest
|
||||
8, // 11: nockchain.public.v1.WalletService.Scan:input_type -> nockchain.public.v1.ScanRequest
|
||||
10, // 12: nockchain.public.v1.WalletService.WalletGetBalance:input_type -> nockchain.public.v1.GetBalanceRequest
|
||||
12, // 13: nockchain.public.v1.WalletService.WalletSendTransaction:input_type -> nockchain.public.v1.SendTransactionRequest
|
||||
20, // 14: nockchain.public.v1.WalletService.TransactionAccepted:input_type -> nockchain.public.v1.TransactionAcceptedRequest
|
||||
1, // 15: nockchain.public.v1.WalletService.Keygen:output_type -> nockchain.public.v1.KeygenResponse
|
||||
3, // 16: nockchain.public.v1.WalletService.ImportKeys:output_type -> nockchain.public.v1.ImportKeysResponse
|
||||
5, // 17: nockchain.public.v1.WalletService.DeriveChild:output_type -> nockchain.public.v1.DeriveChildResponse
|
||||
7, // 18: nockchain.public.v1.WalletService.CreateTx:output_type -> nockchain.public.v1.CreateTxResponse
|
||||
9, // 19: nockchain.public.v1.WalletService.Scan:output_type -> nockchain.public.v1.ScanResponse
|
||||
11, // 20: nockchain.public.v1.WalletService.WalletGetBalance:output_type -> nockchain.public.v1.GetBalanceResponse
|
||||
13, // 21: nockchain.public.v1.WalletService.WalletSendTransaction:output_type -> nockchain.public.v1.SendTransactionResponse
|
||||
21, // 22: nockchain.public.v1.WalletService.TransactionAccepted:output_type -> nockchain.public.v1.TransactionAcceptedResponse
|
||||
15, // [15:23] is the sub-list for method output_type
|
||||
7, // [7:15] is the sub-list for method input_type
|
||||
7, // [7:7] is the sub-list for extension type_name
|
||||
7, // [7:7] is the sub-list for extension extendee
|
||||
0, // [0:7] is the sub-list for field type_name
|
||||
14, // 0: nockchain.public.v2.ImportKeysRequest.import_type:type_name -> nockchain.public.v2.ImportType
|
||||
15, // 1: nockchain.public.v2.CreateTxResponse.rawTx:type_name -> nockchain.public.v2.RawTx
|
||||
16, // 2: nockchain.public.v2.ScanResponse.scan_data:type_name -> nockchain.public.v2.ScanData
|
||||
17, // 3: nockchain.public.v2.GetBalanceResponse.data:type_name -> nockchain.public.v2.Balance
|
||||
15, // 4: nockchain.public.v2.SendTransactionRequest.raw_tx:type_name -> nockchain.public.v2.RawTx
|
||||
18, // 5: nockchain.public.v2.SendTransactionResponse.response:type_name -> nockchain.public.v2.WalletSendTransactionResponse
|
||||
0, // 6: nockchain.public.v2.WalletService.Keygen:input_type -> nockchain.public.v2.KeygenRequest
|
||||
2, // 7: nockchain.public.v2.WalletService.ImportKeys:input_type -> nockchain.public.v2.ImportKeysRequest
|
||||
4, // 8: nockchain.public.v2.WalletService.DeriveChild:input_type -> nockchain.public.v2.DeriveChildRequest
|
||||
6, // 9: nockchain.public.v2.WalletService.CreateTx:input_type -> nockchain.public.v2.CreateTxRequest
|
||||
8, // 10: nockchain.public.v2.WalletService.Scan:input_type -> nockchain.public.v2.ScanRequest
|
||||
10, // 11: nockchain.public.v2.WalletService.WalletGetBalance:input_type -> nockchain.public.v2.GetBalanceRequest
|
||||
12, // 12: nockchain.public.v2.WalletService.WalletSendTransaction:input_type -> nockchain.public.v2.SendTransactionRequest
|
||||
19, // 13: nockchain.public.v2.WalletService.TransactionAccepted:input_type -> nockchain.public.v2.TransactionAcceptedRequest
|
||||
1, // 14: nockchain.public.v2.WalletService.Keygen:output_type -> nockchain.public.v2.KeygenResponse
|
||||
3, // 15: nockchain.public.v2.WalletService.ImportKeys:output_type -> nockchain.public.v2.ImportKeysResponse
|
||||
5, // 16: nockchain.public.v2.WalletService.DeriveChild:output_type -> nockchain.public.v2.DeriveChildResponse
|
||||
7, // 17: nockchain.public.v2.WalletService.CreateTx:output_type -> nockchain.public.v2.CreateTxResponse
|
||||
9, // 18: nockchain.public.v2.WalletService.Scan:output_type -> nockchain.public.v2.ScanResponse
|
||||
11, // 19: nockchain.public.v2.WalletService.WalletGetBalance:output_type -> nockchain.public.v2.GetBalanceResponse
|
||||
13, // 20: nockchain.public.v2.WalletService.WalletSendTransaction:output_type -> nockchain.public.v2.SendTransactionResponse
|
||||
20, // 21: nockchain.public.v2.WalletService.TransactionAccepted:output_type -> nockchain.public.v2.TransactionAcceptedResponse
|
||||
14, // [14:22] is the sub-list for method output_type
|
||||
6, // [6:14] is the sub-list for method input_type
|
||||
6, // [6:6] is the sub-list for extension type_name
|
||||
6, // [6:6] is the sub-list for extension extendee
|
||||
0, // [0:6] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_service_proto_init() }
|
||||
@ -1075,6 +1104,10 @@ func file_service_proto_init() {
|
||||
file_types_proto_init()
|
||||
file_blockchain_proto_init()
|
||||
file_nockchain_proto_init()
|
||||
file_service_proto_msgTypes[10].OneofWrappers = []any{
|
||||
(*GetBalanceRequest_Address)(nil),
|
||||
(*GetBalanceRequest_FirstName)(nil),
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
|
||||
@ -19,14 +19,14 @@ import (
|
||||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
WalletService_Keygen_FullMethodName = "/nockchain.public.v1.WalletService/Keygen"
|
||||
WalletService_ImportKeys_FullMethodName = "/nockchain.public.v1.WalletService/ImportKeys"
|
||||
WalletService_DeriveChild_FullMethodName = "/nockchain.public.v1.WalletService/DeriveChild"
|
||||
WalletService_CreateTx_FullMethodName = "/nockchain.public.v1.WalletService/CreateTx"
|
||||
WalletService_Scan_FullMethodName = "/nockchain.public.v1.WalletService/Scan"
|
||||
WalletService_WalletGetBalance_FullMethodName = "/nockchain.public.v1.WalletService/WalletGetBalance"
|
||||
WalletService_WalletSendTransaction_FullMethodName = "/nockchain.public.v1.WalletService/WalletSendTransaction"
|
||||
WalletService_TransactionAccepted_FullMethodName = "/nockchain.public.v1.WalletService/TransactionAccepted"
|
||||
WalletService_Keygen_FullMethodName = "/nockchain.public.v2.WalletService/Keygen"
|
||||
WalletService_ImportKeys_FullMethodName = "/nockchain.public.v2.WalletService/ImportKeys"
|
||||
WalletService_DeriveChild_FullMethodName = "/nockchain.public.v2.WalletService/DeriveChild"
|
||||
WalletService_CreateTx_FullMethodName = "/nockchain.public.v2.WalletService/CreateTx"
|
||||
WalletService_Scan_FullMethodName = "/nockchain.public.v2.WalletService/Scan"
|
||||
WalletService_WalletGetBalance_FullMethodName = "/nockchain.public.v2.WalletService/WalletGetBalance"
|
||||
WalletService_WalletSendTransaction_FullMethodName = "/nockchain.public.v2.WalletService/WalletSendTransaction"
|
||||
WalletService_TransactionAccepted_FullMethodName = "/nockchain.public.v2.WalletService/TransactionAccepted"
|
||||
)
|
||||
|
||||
// WalletServiceClient is the client API for WalletService service.
|
||||
@ -348,7 +348,7 @@ func _WalletService_TransactionAccepted_Handler(srv interface{}, ctx context.Con
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var WalletService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "nockchain.public.v1.WalletService",
|
||||
ServiceName: "nockchain.public.v2.WalletService",
|
||||
HandlerType: (*WalletServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
|
||||
@ -128,7 +128,7 @@ func (Version) EnumDescriptor() ([]byte, []int) {
|
||||
type ScanData struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Pubkey string `protobuf:"bytes,1,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
|
||||
Data *WalletBalanceData `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
|
||||
Data *Balance `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
@ -170,7 +170,7 @@ func (x *ScanData) GetPubkey() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ScanData) GetData() *WalletBalanceData {
|
||||
func (x *ScanData) GetData() *Balance {
|
||||
if x != nil {
|
||||
return x.Data
|
||||
}
|
||||
@ -328,9 +328,8 @@ func (x *Timelock) GetValue() uint64 {
|
||||
type RawTx struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
TxId string `protobuf:"bytes,1,opt,name=tx_id,json=txId,proto3" json:"tx_id,omitempty"`
|
||||
Inputs []*NockchainInput `protobuf:"bytes,2,rep,name=inputs,proto3" json:"inputs,omitempty"`
|
||||
TimelockRange *TimelockRange `protobuf:"bytes,3,opt,name=timelock_range,json=timelockRange,proto3" json:"timelock_range,omitempty"`
|
||||
TotalFees uint64 `protobuf:"varint,4,opt,name=total_fees,json=totalFees,proto3" json:"total_fees,omitempty"`
|
||||
Version Version `protobuf:"varint,2,opt,name=version,proto3,enum=nockchain.public.v2.Version" json:"version,omitempty"`
|
||||
NamedSpends []*NockchainNamedSpend `protobuf:"bytes,3,rep,name=named_spends,json=namedSpends,proto3" json:"named_spends,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
@ -372,50 +371,46 @@ func (x *RawTx) GetTxId() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RawTx) GetInputs() []*NockchainInput {
|
||||
func (x *RawTx) GetVersion() Version {
|
||||
if x != nil {
|
||||
return x.Inputs
|
||||
return x.Version
|
||||
}
|
||||
return Version_V0
|
||||
}
|
||||
|
||||
func (x *RawTx) GetNamedSpends() []*NockchainNamedSpend {
|
||||
if x != nil {
|
||||
return x.NamedSpends
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *RawTx) GetTimelockRange() *TimelockRange {
|
||||
if x != nil {
|
||||
return x.TimelockRange
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *RawTx) GetTotalFees() uint64 {
|
||||
if x != nil {
|
||||
return x.TotalFees
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type NockchainSpend struct {
|
||||
type NockchainNamedSpend struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Signatures []*NockchainSignature `protobuf:"bytes,1,rep,name=signatures,proto3" json:"signatures,omitempty"`
|
||||
Seeds []*NockchainSeed `protobuf:"bytes,2,rep,name=seeds,proto3" json:"seeds,omitempty"`
|
||||
Fee uint64 `protobuf:"varint,3,opt,name=fee,proto3" json:"fee,omitempty"`
|
||||
Name *NockchainName `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
// Types that are valid to be assigned to SpendKind:
|
||||
//
|
||||
// *NockchainNamedSpend_Legacy
|
||||
// *NockchainNamedSpend_Witness
|
||||
SpendKind isNockchainNamedSpend_SpendKind `protobuf_oneof:"spend_kind"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *NockchainSpend) Reset() {
|
||||
*x = NockchainSpend{}
|
||||
func (x *NockchainNamedSpend) Reset() {
|
||||
*x = NockchainNamedSpend{}
|
||||
mi := &file_types_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *NockchainSpend) String() string {
|
||||
func (x *NockchainNamedSpend) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*NockchainSpend) ProtoMessage() {}
|
||||
func (*NockchainNamedSpend) ProtoMessage() {}
|
||||
|
||||
func (x *NockchainSpend) ProtoReflect() protoreflect.Message {
|
||||
func (x *NockchainNamedSpend) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_types_proto_msgTypes[5]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
@ -427,48 +422,169 @@ func (x *NockchainSpend) ProtoReflect() protoreflect.Message {
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use NockchainSpend.ProtoReflect.Descriptor instead.
|
||||
func (*NockchainSpend) Descriptor() ([]byte, []int) {
|
||||
// Deprecated: Use NockchainNamedSpend.ProtoReflect.Descriptor instead.
|
||||
func (*NockchainNamedSpend) Descriptor() ([]byte, []int) {
|
||||
return file_types_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *NockchainSpend) GetSignatures() []*NockchainSignature {
|
||||
func (x *NockchainNamedSpend) GetName() *NockchainName {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *NockchainNamedSpend) GetSpendKind() isNockchainNamedSpend_SpendKind {
|
||||
if x != nil {
|
||||
return x.SpendKind
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *NockchainNamedSpend) GetLegacy() *NockchainSpendV0 {
|
||||
if x != nil {
|
||||
if x, ok := x.SpendKind.(*NockchainNamedSpend_Legacy); ok {
|
||||
return x.Legacy
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *NockchainNamedSpend) GetWitness() *NockchainSpendV1 {
|
||||
if x != nil {
|
||||
if x, ok := x.SpendKind.(*NockchainNamedSpend_Witness); ok {
|
||||
return x.Witness
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type isNockchainNamedSpend_SpendKind interface {
|
||||
isNockchainNamedSpend_SpendKind()
|
||||
}
|
||||
|
||||
type NockchainNamedSpend_Legacy struct {
|
||||
Legacy *NockchainSpendV0 `protobuf:"bytes,2,opt,name=legacy,proto3,oneof"`
|
||||
}
|
||||
|
||||
type NockchainNamedSpend_Witness struct {
|
||||
Witness *NockchainSpendV1 `protobuf:"bytes,3,opt,name=witness,proto3,oneof"`
|
||||
}
|
||||
|
||||
func (*NockchainNamedSpend_Legacy) isNockchainNamedSpend_SpendKind() {}
|
||||
|
||||
func (*NockchainNamedSpend_Witness) isNockchainNamedSpend_SpendKind() {}
|
||||
|
||||
type NockchainSpendV0 struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Signatures []*NockchainSignature `protobuf:"bytes,1,rep,name=signatures,proto3" json:"signatures,omitempty"`
|
||||
Seeds []*NockchainSeedV0 `protobuf:"bytes,2,rep,name=seeds,proto3" json:"seeds,omitempty"`
|
||||
Fee uint64 `protobuf:"varint,3,opt,name=fee,proto3" json:"fee,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *NockchainSpendV0) Reset() {
|
||||
*x = NockchainSpendV0{}
|
||||
mi := &file_types_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *NockchainSpendV0) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*NockchainSpendV0) ProtoMessage() {}
|
||||
|
||||
func (x *NockchainSpendV0) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_types_proto_msgTypes[6]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use NockchainSpendV0.ProtoReflect.Descriptor instead.
|
||||
func (*NockchainSpendV0) Descriptor() ([]byte, []int) {
|
||||
return file_types_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *NockchainSpendV0) GetSignatures() []*NockchainSignature {
|
||||
if x != nil {
|
||||
return x.Signatures
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *NockchainSpend) GetSeeds() []*NockchainSeed {
|
||||
func (x *NockchainSpendV0) GetSeeds() []*NockchainSeedV0 {
|
||||
if x != nil {
|
||||
return x.Seeds
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *NockchainSpend) GetFee() uint64 {
|
||||
func (x *NockchainSpendV0) GetFee() uint64 {
|
||||
if x != nil {
|
||||
return x.Fee
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type NockchainSpendV1 struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *NockchainSpendV1) Reset() {
|
||||
*x = NockchainSpendV1{}
|
||||
mi := &file_types_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *NockchainSpendV1) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*NockchainSpendV1) ProtoMessage() {}
|
||||
|
||||
func (x *NockchainSpendV1) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_types_proto_msgTypes[7]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use NockchainSpendV1.ProtoReflect.Descriptor instead.
|
||||
func (*NockchainSpendV1) Descriptor() ([]byte, []int) {
|
||||
return file_types_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
type NockchainNote struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Version Version `protobuf:"varint,1,opt,name=version,proto3,enum=nockchain.public.v1.Version" json:"version,omitempty"`
|
||||
BlockHeight uint64 `protobuf:"varint,2,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"`
|
||||
Timelock *TimelockIntent `protobuf:"bytes,3,opt,name=timelock,proto3,oneof" json:"timelock,omitempty"`
|
||||
Name *NockchainName `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Lock *NockchainLock `protobuf:"bytes,5,opt,name=lock,proto3" json:"lock,omitempty"`
|
||||
Source *NockchainSource `protobuf:"bytes,6,opt,name=source,proto3" json:"source,omitempty"`
|
||||
Asset uint64 `protobuf:"varint,7,opt,name=asset,proto3" json:"asset,omitempty"`
|
||||
// Types that are valid to be assigned to Note:
|
||||
//
|
||||
// *NockchainNote_V0
|
||||
// *NockchainNote_V1
|
||||
Note isNockchainNote_Note `protobuf_oneof:"note"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *NockchainNote) Reset() {
|
||||
*x = NockchainNote{}
|
||||
mi := &file_types_proto_msgTypes[6]
|
||||
mi := &file_types_proto_msgTypes[8]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -480,7 +596,7 @@ func (x *NockchainNote) String() string {
|
||||
func (*NockchainNote) ProtoMessage() {}
|
||||
|
||||
func (x *NockchainNote) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_types_proto_msgTypes[6]
|
||||
mi := &file_types_proto_msgTypes[8]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -493,58 +609,170 @@ func (x *NockchainNote) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use NockchainNote.ProtoReflect.Descriptor instead.
|
||||
func (*NockchainNote) Descriptor() ([]byte, []int) {
|
||||
return file_types_proto_rawDescGZIP(), []int{6}
|
||||
return file_types_proto_rawDescGZIP(), []int{8}
|
||||
}
|
||||
|
||||
func (x *NockchainNote) GetVersion() Version {
|
||||
func (x *NockchainNote) GetNote() isNockchainNote_Note {
|
||||
if x != nil {
|
||||
return x.Note
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *NockchainNote) GetV0() *NockchainNoteV0 {
|
||||
if x != nil {
|
||||
if x, ok := x.Note.(*NockchainNote_V0); ok {
|
||||
return x.V0
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *NockchainNote) GetV1() *NockchainNoteV1 {
|
||||
if x != nil {
|
||||
if x, ok := x.Note.(*NockchainNote_V1); ok {
|
||||
return x.V1
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type isNockchainNote_Note interface {
|
||||
isNockchainNote_Note()
|
||||
}
|
||||
|
||||
type NockchainNote_V0 struct {
|
||||
V0 *NockchainNoteV0 `protobuf:"bytes,1,opt,name=v0,proto3,oneof"`
|
||||
}
|
||||
|
||||
type NockchainNote_V1 struct {
|
||||
V1 *NockchainNoteV1 `protobuf:"bytes,2,opt,name=v1,proto3,oneof"`
|
||||
}
|
||||
|
||||
func (*NockchainNote_V0) isNockchainNote_Note() {}
|
||||
|
||||
func (*NockchainNote_V1) isNockchainNote_Note() {}
|
||||
|
||||
type NockchainNoteV0 struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Version Version `protobuf:"varint,1,opt,name=version,proto3,enum=nockchain.public.v2.Version" json:"version,omitempty"`
|
||||
OriginPage uint64 `protobuf:"varint,2,opt,name=origin_page,json=originPage,proto3" json:"origin_page,omitempty"`
|
||||
Name *NockchainName `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Lock *NockchainLock `protobuf:"bytes,5,opt,name=lock,proto3" json:"lock,omitempty"`
|
||||
Source *NockchainSource `protobuf:"bytes,6,opt,name=source,proto3" json:"source,omitempty"`
|
||||
Asset uint64 `protobuf:"varint,7,opt,name=asset,proto3" json:"asset,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *NockchainNoteV0) Reset() {
|
||||
*x = NockchainNoteV0{}
|
||||
mi := &file_types_proto_msgTypes[9]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *NockchainNoteV0) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*NockchainNoteV0) ProtoMessage() {}
|
||||
|
||||
func (x *NockchainNoteV0) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_types_proto_msgTypes[9]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use NockchainNoteV0.ProtoReflect.Descriptor instead.
|
||||
func (*NockchainNoteV0) Descriptor() ([]byte, []int) {
|
||||
return file_types_proto_rawDescGZIP(), []int{9}
|
||||
}
|
||||
|
||||
func (x *NockchainNoteV0) GetVersion() Version {
|
||||
if x != nil {
|
||||
return x.Version
|
||||
}
|
||||
return Version_V0
|
||||
}
|
||||
|
||||
func (x *NockchainNote) GetBlockHeight() uint64 {
|
||||
func (x *NockchainNoteV0) GetOriginPage() uint64 {
|
||||
if x != nil {
|
||||
return x.BlockHeight
|
||||
return x.OriginPage
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *NockchainNote) GetTimelock() *TimelockIntent {
|
||||
if x != nil {
|
||||
return x.Timelock
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *NockchainNote) GetName() *NockchainName {
|
||||
func (x *NockchainNoteV0) GetName() *NockchainName {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *NockchainNote) GetLock() *NockchainLock {
|
||||
func (x *NockchainNoteV0) GetLock() *NockchainLock {
|
||||
if x != nil {
|
||||
return x.Lock
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *NockchainNote) GetSource() *NockchainSource {
|
||||
func (x *NockchainNoteV0) GetSource() *NockchainSource {
|
||||
if x != nil {
|
||||
return x.Source
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *NockchainNote) GetAsset() uint64 {
|
||||
func (x *NockchainNoteV0) GetAsset() uint64 {
|
||||
if x != nil {
|
||||
return x.Asset
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type NockchainNoteV1 struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *NockchainNoteV1) Reset() {
|
||||
*x = NockchainNoteV1{}
|
||||
mi := &file_types_proto_msgTypes[10]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *NockchainNoteV1) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*NockchainNoteV1) ProtoMessage() {}
|
||||
|
||||
func (x *NockchainNoteV1) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_types_proto_msgTypes[10]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use NockchainNoteV1.ProtoReflect.Descriptor instead.
|
||||
func (*NockchainNoteV1) Descriptor() ([]byte, []int) {
|
||||
return file_types_proto_rawDescGZIP(), []int{10}
|
||||
}
|
||||
|
||||
type NockchainName struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
First string `protobuf:"bytes,1,opt,name=first,proto3" json:"first,omitempty"`
|
||||
@ -555,7 +783,7 @@ type NockchainName struct {
|
||||
|
||||
func (x *NockchainName) Reset() {
|
||||
*x = NockchainName{}
|
||||
mi := &file_types_proto_msgTypes[7]
|
||||
mi := &file_types_proto_msgTypes[11]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -567,7 +795,7 @@ func (x *NockchainName) String() string {
|
||||
func (*NockchainName) ProtoMessage() {}
|
||||
|
||||
func (x *NockchainName) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_types_proto_msgTypes[7]
|
||||
mi := &file_types_proto_msgTypes[11]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -580,7 +808,7 @@ func (x *NockchainName) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use NockchainName.ProtoReflect.Descriptor instead.
|
||||
func (*NockchainName) Descriptor() ([]byte, []int) {
|
||||
return file_types_proto_rawDescGZIP(), []int{7}
|
||||
return file_types_proto_rawDescGZIP(), []int{11}
|
||||
}
|
||||
|
||||
func (x *NockchainName) GetFirst() string {
|
||||
@ -597,66 +825,6 @@ func (x *NockchainName) GetLast() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
type NockchainInput struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Name *NockchainName `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Note *NockchainNote `protobuf:"bytes,2,opt,name=note,proto3" json:"note,omitempty"`
|
||||
Spend *NockchainSpend `protobuf:"bytes,3,opt,name=spend,proto3" json:"spend,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *NockchainInput) Reset() {
|
||||
*x = NockchainInput{}
|
||||
mi := &file_types_proto_msgTypes[8]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *NockchainInput) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*NockchainInput) ProtoMessage() {}
|
||||
|
||||
func (x *NockchainInput) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_types_proto_msgTypes[8]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use NockchainInput.ProtoReflect.Descriptor instead.
|
||||
func (*NockchainInput) Descriptor() ([]byte, []int) {
|
||||
return file_types_proto_rawDescGZIP(), []int{8}
|
||||
}
|
||||
|
||||
func (x *NockchainInput) GetName() *NockchainName {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *NockchainInput) GetNote() *NockchainNote {
|
||||
if x != nil {
|
||||
return x.Note
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *NockchainInput) GetSpend() *NockchainSpend {
|
||||
if x != nil {
|
||||
return x.Spend
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type NockchainSignature struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Pubkey string `protobuf:"bytes,1,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
|
||||
@ -668,7 +836,7 @@ type NockchainSignature struct {
|
||||
|
||||
func (x *NockchainSignature) Reset() {
|
||||
*x = NockchainSignature{}
|
||||
mi := &file_types_proto_msgTypes[9]
|
||||
mi := &file_types_proto_msgTypes[12]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -680,7 +848,7 @@ func (x *NockchainSignature) String() string {
|
||||
func (*NockchainSignature) ProtoMessage() {}
|
||||
|
||||
func (x *NockchainSignature) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_types_proto_msgTypes[9]
|
||||
mi := &file_types_proto_msgTypes[12]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -693,7 +861,7 @@ func (x *NockchainSignature) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use NockchainSignature.ProtoReflect.Descriptor instead.
|
||||
func (*NockchainSignature) Descriptor() ([]byte, []int) {
|
||||
return file_types_proto_rawDescGZIP(), []int{9}
|
||||
return file_types_proto_rawDescGZIP(), []int{12}
|
||||
}
|
||||
|
||||
func (x *NockchainSignature) GetPubkey() string {
|
||||
@ -717,32 +885,32 @@ func (x *NockchainSignature) GetSig() []uint64 {
|
||||
return nil
|
||||
}
|
||||
|
||||
type NockchainSeed struct {
|
||||
type NockchainSeedV0 struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
OutputSource *NockchainSource `protobuf:"bytes,1,opt,name=output_source,json=outputSource,proto3,oneof" json:"output_source,omitempty"`
|
||||
Recipient *NockchainLock `protobuf:"bytes,2,opt,name=recipient,proto3" json:"recipient,omitempty"`
|
||||
TimelockIntent *TimelockIntent `protobuf:"bytes,3,opt,name=timelock_intent,json=timelockIntent,proto3,oneof" json:"timelock_intent,omitempty"`
|
||||
LockRoot string `protobuf:"bytes,2,opt,name=lock_root,json=lockRoot,proto3" json:"lock_root,omitempty"`
|
||||
NoteData *NockchainLock `protobuf:"bytes,3,opt,name=note_data,json=noteData,proto3" json:"note_data,omitempty"`
|
||||
Gift uint64 `protobuf:"varint,4,opt,name=gift,proto3" json:"gift,omitempty"`
|
||||
ParentHash string `protobuf:"bytes,5,opt,name=parent_hash,json=parentHash,proto3" json:"parent_hash,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *NockchainSeed) Reset() {
|
||||
*x = NockchainSeed{}
|
||||
mi := &file_types_proto_msgTypes[10]
|
||||
func (x *NockchainSeedV0) Reset() {
|
||||
*x = NockchainSeedV0{}
|
||||
mi := &file_types_proto_msgTypes[13]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *NockchainSeed) String() string {
|
||||
func (x *NockchainSeedV0) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*NockchainSeed) ProtoMessage() {}
|
||||
func (*NockchainSeedV0) ProtoMessage() {}
|
||||
|
||||
func (x *NockchainSeed) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_types_proto_msgTypes[10]
|
||||
func (x *NockchainSeedV0) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_types_proto_msgTypes[13]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -753,40 +921,40 @@ func (x *NockchainSeed) ProtoReflect() protoreflect.Message {
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use NockchainSeed.ProtoReflect.Descriptor instead.
|
||||
func (*NockchainSeed) Descriptor() ([]byte, []int) {
|
||||
return file_types_proto_rawDescGZIP(), []int{10}
|
||||
// Deprecated: Use NockchainSeedV0.ProtoReflect.Descriptor instead.
|
||||
func (*NockchainSeedV0) Descriptor() ([]byte, []int) {
|
||||
return file_types_proto_rawDescGZIP(), []int{13}
|
||||
}
|
||||
|
||||
func (x *NockchainSeed) GetOutputSource() *NockchainSource {
|
||||
func (x *NockchainSeedV0) GetOutputSource() *NockchainSource {
|
||||
if x != nil {
|
||||
return x.OutputSource
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *NockchainSeed) GetRecipient() *NockchainLock {
|
||||
func (x *NockchainSeedV0) GetLockRoot() string {
|
||||
if x != nil {
|
||||
return x.Recipient
|
||||
return x.LockRoot
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *NockchainSeedV0) GetNoteData() *NockchainLock {
|
||||
if x != nil {
|
||||
return x.NoteData
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *NockchainSeed) GetTimelockIntent() *TimelockIntent {
|
||||
if x != nil {
|
||||
return x.TimelockIntent
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *NockchainSeed) GetGift() uint64 {
|
||||
func (x *NockchainSeedV0) GetGift() uint64 {
|
||||
if x != nil {
|
||||
return x.Gift
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *NockchainSeed) GetParentHash() string {
|
||||
func (x *NockchainSeedV0) GetParentHash() string {
|
||||
if x != nil {
|
||||
return x.ParentHash
|
||||
}
|
||||
@ -803,7 +971,7 @@ type NockchainLock struct {
|
||||
|
||||
func (x *NockchainLock) Reset() {
|
||||
*x = NockchainLock{}
|
||||
mi := &file_types_proto_msgTypes[11]
|
||||
mi := &file_types_proto_msgTypes[14]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -815,7 +983,7 @@ func (x *NockchainLock) String() string {
|
||||
func (*NockchainLock) ProtoMessage() {}
|
||||
|
||||
func (x *NockchainLock) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_types_proto_msgTypes[11]
|
||||
mi := &file_types_proto_msgTypes[14]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -828,7 +996,7 @@ func (x *NockchainLock) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use NockchainLock.ProtoReflect.Descriptor instead.
|
||||
func (*NockchainLock) Descriptor() ([]byte, []int) {
|
||||
return file_types_proto_rawDescGZIP(), []int{11}
|
||||
return file_types_proto_rawDescGZIP(), []int{14}
|
||||
}
|
||||
|
||||
func (x *NockchainLock) GetKeysRequired() uint64 {
|
||||
@ -855,7 +1023,7 @@ type NockchainSource struct {
|
||||
|
||||
func (x *NockchainSource) Reset() {
|
||||
*x = NockchainSource{}
|
||||
mi := &file_types_proto_msgTypes[12]
|
||||
mi := &file_types_proto_msgTypes[15]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -867,7 +1035,7 @@ func (x *NockchainSource) String() string {
|
||||
func (*NockchainSource) ProtoMessage() {}
|
||||
|
||||
func (x *NockchainSource) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_types_proto_msgTypes[12]
|
||||
mi := &file_types_proto_msgTypes[15]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -880,7 +1048,7 @@ func (x *NockchainSource) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use NockchainSource.ProtoReflect.Descriptor instead.
|
||||
func (*NockchainSource) Descriptor() ([]byte, []int) {
|
||||
return file_types_proto_rawDescGZIP(), []int{12}
|
||||
return file_types_proto_rawDescGZIP(), []int{15}
|
||||
}
|
||||
|
||||
func (x *NockchainSource) GetSource() string {
|
||||
@ -901,63 +1069,67 @@ var File_types_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_types_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\vtypes.proto\x12\x13nockchain.public.v1\x1a\x10blockchain.proto\"^\n" +
|
||||
"\vtypes.proto\x12\x13nockchain.public.v2\x1a\x10blockchain.proto\"T\n" +
|
||||
"\bScanData\x12\x16\n" +
|
||||
"\x06pubkey\x18\x01 \x01(\tR\x06pubkey\x12:\n" +
|
||||
"\x04data\x18\x02 \x01(\v2&.nockchain.public.v1.WalletBalanceDataR\x04data\"\xb4\x01\n" +
|
||||
"\x06pubkey\x18\x01 \x01(\tR\x06pubkey\x120\n" +
|
||||
"\x04data\x18\x02 \x01(\v2\x1c.nockchain.public.v2.BalanceR\x04data\"\xb4\x01\n" +
|
||||
"\x0eTimelockIntent\x12C\n" +
|
||||
"\babsolute\x18\x01 \x01(\v2\".nockchain.public.v1.TimelockRangeH\x00R\babsolute\x88\x01\x01\x12C\n" +
|
||||
"\brelative\x18\x02 \x01(\v2\".nockchain.public.v1.TimelockRangeH\x01R\brelative\x88\x01\x01B\v\n" +
|
||||
"\babsolute\x18\x01 \x01(\v2\".nockchain.public.v2.TimelockRangeH\x00R\babsolute\x88\x01\x01\x12C\n" +
|
||||
"\brelative\x18\x02 \x01(\v2\".nockchain.public.v2.TimelockRangeH\x01R\brelative\x88\x01\x01B\v\n" +
|
||||
"\t_absoluteB\v\n" +
|
||||
"\t_relative\"\x8b\x01\n" +
|
||||
"\rTimelockRange\x124\n" +
|
||||
"\x03min\x18\x01 \x01(\v2\x1d.nockchain.public.v1.TimelockH\x00R\x03min\x88\x01\x01\x124\n" +
|
||||
"\x03max\x18\x02 \x01(\v2\x1d.nockchain.public.v1.TimelockH\x01R\x03max\x88\x01\x01B\x06\n" +
|
||||
"\x03min\x18\x01 \x01(\v2\x1d.nockchain.public.v2.TimelockH\x00R\x03min\x88\x01\x01\x124\n" +
|
||||
"\x03max\x18\x02 \x01(\v2\x1d.nockchain.public.v2.TimelockH\x01R\x03max\x88\x01\x01B\x06\n" +
|
||||
"\x04_minB\x06\n" +
|
||||
"\x04_max\" \n" +
|
||||
"\bTimelock\x12\x14\n" +
|
||||
"\x05value\x18\x01 \x01(\x04R\x05value\"\xc3\x01\n" +
|
||||
"\x05value\x18\x01 \x01(\x04R\x05value\"\xa1\x01\n" +
|
||||
"\x05RawTx\x12\x13\n" +
|
||||
"\x05tx_id\x18\x01 \x01(\tR\x04txId\x12;\n" +
|
||||
"\x06inputs\x18\x02 \x03(\v2#.nockchain.public.v1.NockchainInputR\x06inputs\x12I\n" +
|
||||
"\x0etimelock_range\x18\x03 \x01(\v2\".nockchain.public.v1.TimelockRangeR\rtimelockRange\x12\x1d\n" +
|
||||
"\x05tx_id\x18\x01 \x01(\tR\x04txId\x126\n" +
|
||||
"\aversion\x18\x02 \x01(\x0e2\x1c.nockchain.public.v2.VersionR\aversion\x12K\n" +
|
||||
"\fnamed_spends\x18\x03 \x03(\v2(.nockchain.public.v2.NockchainNamedSpendR\vnamedSpends\"\xdf\x01\n" +
|
||||
"\x13NockchainNamedSpend\x126\n" +
|
||||
"\x04name\x18\x01 \x01(\v2\".nockchain.public.v2.NockchainNameR\x04name\x12?\n" +
|
||||
"\x06legacy\x18\x02 \x01(\v2%.nockchain.public.v2.NockchainSpendV0H\x00R\x06legacy\x12A\n" +
|
||||
"\awitness\x18\x03 \x01(\v2%.nockchain.public.v2.NockchainSpendV1H\x00R\awitnessB\f\n" +
|
||||
"\n" +
|
||||
"total_fees\x18\x04 \x01(\x04R\ttotalFees\"\xa5\x01\n" +
|
||||
"\x0eNockchainSpend\x12G\n" +
|
||||
"spend_kind\"\xa9\x01\n" +
|
||||
"\x10NockchainSpendV0\x12G\n" +
|
||||
"\n" +
|
||||
"signatures\x18\x01 \x03(\v2'.nockchain.public.v1.NockchainSignatureR\n" +
|
||||
"signatures\x128\n" +
|
||||
"\x05seeds\x18\x02 \x03(\v2\".nockchain.public.v1.NockchainSeedR\x05seeds\x12\x10\n" +
|
||||
"\x03fee\x18\x03 \x01(\x04R\x03fee\"\x81\x03\n" +
|
||||
"signatures\x18\x01 \x03(\v2'.nockchain.public.v2.NockchainSignatureR\n" +
|
||||
"signatures\x12:\n" +
|
||||
"\x05seeds\x18\x02 \x03(\v2$.nockchain.public.v2.NockchainSeedV0R\x05seeds\x12\x10\n" +
|
||||
"\x03fee\x18\x03 \x01(\x04R\x03fee\"\x12\n" +
|
||||
"\x10NockchainSpendV1\"\x87\x01\n" +
|
||||
"\rNockchainNote\x126\n" +
|
||||
"\aversion\x18\x01 \x01(\x0e2\x1c.nockchain.public.v1.VersionR\aversion\x12!\n" +
|
||||
"\fblock_height\x18\x02 \x01(\x04R\vblockHeight\x12D\n" +
|
||||
"\btimelock\x18\x03 \x01(\v2#.nockchain.public.v1.TimelockIntentH\x00R\btimelock\x88\x01\x01\x126\n" +
|
||||
"\x04name\x18\x04 \x01(\v2\".nockchain.public.v1.NockchainNameR\x04name\x126\n" +
|
||||
"\x04lock\x18\x05 \x01(\v2\".nockchain.public.v1.NockchainLockR\x04lock\x12<\n" +
|
||||
"\x06source\x18\x06 \x01(\v2$.nockchain.public.v1.NockchainSourceR\x06source\x12\x14\n" +
|
||||
"\x05asset\x18\a \x01(\x04R\x05assetB\v\n" +
|
||||
"\t_timelock\"9\n" +
|
||||
"\x02v0\x18\x01 \x01(\v2$.nockchain.public.v2.NockchainNoteV0H\x00R\x02v0\x126\n" +
|
||||
"\x02v1\x18\x02 \x01(\v2$.nockchain.public.v2.NockchainNoteV1H\x00R\x02v1B\x06\n" +
|
||||
"\x04note\"\xae\x02\n" +
|
||||
"\x0fNockchainNoteV0\x126\n" +
|
||||
"\aversion\x18\x01 \x01(\x0e2\x1c.nockchain.public.v2.VersionR\aversion\x12\x1f\n" +
|
||||
"\vorigin_page\x18\x02 \x01(\x04R\n" +
|
||||
"originPage\x126\n" +
|
||||
"\x04name\x18\x03 \x01(\v2\".nockchain.public.v2.NockchainNameR\x04name\x126\n" +
|
||||
"\x04lock\x18\x05 \x01(\v2\".nockchain.public.v2.NockchainLockR\x04lock\x12<\n" +
|
||||
"\x06source\x18\x06 \x01(\v2$.nockchain.public.v2.NockchainSourceR\x06source\x12\x14\n" +
|
||||
"\x05asset\x18\a \x01(\x04R\x05asset\"\x11\n" +
|
||||
"\x0fNockchainNoteV1\"9\n" +
|
||||
"\rNockchainName\x12\x14\n" +
|
||||
"\x05first\x18\x01 \x01(\tR\x05first\x12\x12\n" +
|
||||
"\x04last\x18\x02 \x01(\tR\x04last\"\xbb\x01\n" +
|
||||
"\x0eNockchainInput\x126\n" +
|
||||
"\x04name\x18\x01 \x01(\v2\".nockchain.public.v1.NockchainNameR\x04name\x126\n" +
|
||||
"\x04note\x18\x02 \x01(\v2\".nockchain.public.v1.NockchainNoteR\x04note\x129\n" +
|
||||
"\x05spend\x18\x03 \x01(\v2#.nockchain.public.v1.NockchainSpendR\x05spend\"R\n" +
|
||||
"\x04last\x18\x02 \x01(\tR\x04last\"R\n" +
|
||||
"\x12NockchainSignature\x12\x16\n" +
|
||||
"\x06pubkey\x18\x01 \x01(\tR\x06pubkey\x12\x12\n" +
|
||||
"\x04chal\x18\x02 \x03(\x04R\x04chal\x12\x10\n" +
|
||||
"\x03sig\x18\x03 \x03(\x04R\x03sig\"\xcf\x02\n" +
|
||||
"\rNockchainSeed\x12N\n" +
|
||||
"\routput_source\x18\x01 \x01(\v2$.nockchain.public.v1.NockchainSourceH\x00R\foutputSource\x88\x01\x01\x12@\n" +
|
||||
"\trecipient\x18\x02 \x01(\v2\".nockchain.public.v1.NockchainLockR\trecipient\x12Q\n" +
|
||||
"\x0ftimelock_intent\x18\x03 \x01(\v2#.nockchain.public.v1.TimelockIntentH\x01R\x0etimelockIntent\x88\x01\x01\x12\x12\n" +
|
||||
"\x03sig\x18\x03 \x03(\x04R\x03sig\"\x86\x02\n" +
|
||||
"\x0fNockchainSeedV0\x12N\n" +
|
||||
"\routput_source\x18\x01 \x01(\v2$.nockchain.public.v2.NockchainSourceH\x00R\foutputSource\x88\x01\x01\x12\x1b\n" +
|
||||
"\tlock_root\x18\x02 \x01(\tR\blockRoot\x12?\n" +
|
||||
"\tnote_data\x18\x03 \x01(\v2\".nockchain.public.v2.NockchainLockR\bnoteData\x12\x12\n" +
|
||||
"\x04gift\x18\x04 \x01(\x04R\x04gift\x12\x1f\n" +
|
||||
"\vparent_hash\x18\x05 \x01(\tR\n" +
|
||||
"parentHashB\x10\n" +
|
||||
"\x0e_output_sourceB\x12\n" +
|
||||
"\x10_timelock_intent\"N\n" +
|
||||
"\x0e_output_source\"N\n" +
|
||||
"\rNockchainLock\x12#\n" +
|
||||
"\rkeys_required\x18\x01 \x01(\x04R\fkeysRequired\x12\x18\n" +
|
||||
"\apubkeys\x18\x02 \x03(\tR\apubkeys\"J\n" +
|
||||
@ -992,46 +1164,49 @@ func file_types_proto_rawDescGZIP() []byte {
|
||||
}
|
||||
|
||||
var file_types_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
|
||||
var file_types_proto_msgTypes = make([]protoimpl.MessageInfo, 13)
|
||||
var file_types_proto_msgTypes = make([]protoimpl.MessageInfo, 16)
|
||||
var file_types_proto_goTypes = []any{
|
||||
(ImportType)(0), // 0: nockchain.public.v1.ImportType
|
||||
(Version)(0), // 1: nockchain.public.v1.Version
|
||||
(*ScanData)(nil), // 2: nockchain.public.v1.ScanData
|
||||
(*TimelockIntent)(nil), // 3: nockchain.public.v1.TimelockIntent
|
||||
(*TimelockRange)(nil), // 4: nockchain.public.v1.TimelockRange
|
||||
(*Timelock)(nil), // 5: nockchain.public.v1.Timelock
|
||||
(*RawTx)(nil), // 6: nockchain.public.v1.RawTx
|
||||
(*NockchainSpend)(nil), // 7: nockchain.public.v1.NockchainSpend
|
||||
(*NockchainNote)(nil), // 8: nockchain.public.v1.NockchainNote
|
||||
(*NockchainName)(nil), // 9: nockchain.public.v1.NockchainName
|
||||
(*NockchainInput)(nil), // 10: nockchain.public.v1.NockchainInput
|
||||
(*NockchainSignature)(nil), // 11: nockchain.public.v1.NockchainSignature
|
||||
(*NockchainSeed)(nil), // 12: nockchain.public.v1.NockchainSeed
|
||||
(*NockchainLock)(nil), // 13: nockchain.public.v1.NockchainLock
|
||||
(*NockchainSource)(nil), // 14: nockchain.public.v1.NockchainSource
|
||||
(*WalletBalanceData)(nil), // 15: nockchain.public.v1.WalletBalanceData
|
||||
(ImportType)(0), // 0: nockchain.public.v2.ImportType
|
||||
(Version)(0), // 1: nockchain.public.v2.Version
|
||||
(*ScanData)(nil), // 2: nockchain.public.v2.ScanData
|
||||
(*TimelockIntent)(nil), // 3: nockchain.public.v2.TimelockIntent
|
||||
(*TimelockRange)(nil), // 4: nockchain.public.v2.TimelockRange
|
||||
(*Timelock)(nil), // 5: nockchain.public.v2.Timelock
|
||||
(*RawTx)(nil), // 6: nockchain.public.v2.RawTx
|
||||
(*NockchainNamedSpend)(nil), // 7: nockchain.public.v2.NockchainNamedSpend
|
||||
(*NockchainSpendV0)(nil), // 8: nockchain.public.v2.NockchainSpendV0
|
||||
(*NockchainSpendV1)(nil), // 9: nockchain.public.v2.NockchainSpendV1
|
||||
(*NockchainNote)(nil), // 10: nockchain.public.v2.NockchainNote
|
||||
(*NockchainNoteV0)(nil), // 11: nockchain.public.v2.NockchainNoteV0
|
||||
(*NockchainNoteV1)(nil), // 12: nockchain.public.v2.NockchainNoteV1
|
||||
(*NockchainName)(nil), // 13: nockchain.public.v2.NockchainName
|
||||
(*NockchainSignature)(nil), // 14: nockchain.public.v2.NockchainSignature
|
||||
(*NockchainSeedV0)(nil), // 15: nockchain.public.v2.NockchainSeedV0
|
||||
(*NockchainLock)(nil), // 16: nockchain.public.v2.NockchainLock
|
||||
(*NockchainSource)(nil), // 17: nockchain.public.v2.NockchainSource
|
||||
(*Balance)(nil), // 18: nockchain.public.v2.Balance
|
||||
}
|
||||
var file_types_proto_depIdxs = []int32{
|
||||
15, // 0: nockchain.public.v1.ScanData.data:type_name -> nockchain.public.v1.WalletBalanceData
|
||||
4, // 1: nockchain.public.v1.TimelockIntent.absolute:type_name -> nockchain.public.v1.TimelockRange
|
||||
4, // 2: nockchain.public.v1.TimelockIntent.relative:type_name -> nockchain.public.v1.TimelockRange
|
||||
5, // 3: nockchain.public.v1.TimelockRange.min:type_name -> nockchain.public.v1.Timelock
|
||||
5, // 4: nockchain.public.v1.TimelockRange.max:type_name -> nockchain.public.v1.Timelock
|
||||
10, // 5: nockchain.public.v1.RawTx.inputs:type_name -> nockchain.public.v1.NockchainInput
|
||||
4, // 6: nockchain.public.v1.RawTx.timelock_range:type_name -> nockchain.public.v1.TimelockRange
|
||||
11, // 7: nockchain.public.v1.NockchainSpend.signatures:type_name -> nockchain.public.v1.NockchainSignature
|
||||
12, // 8: nockchain.public.v1.NockchainSpend.seeds:type_name -> nockchain.public.v1.NockchainSeed
|
||||
1, // 9: nockchain.public.v1.NockchainNote.version:type_name -> nockchain.public.v1.Version
|
||||
3, // 10: nockchain.public.v1.NockchainNote.timelock:type_name -> nockchain.public.v1.TimelockIntent
|
||||
9, // 11: nockchain.public.v1.NockchainNote.name:type_name -> nockchain.public.v1.NockchainName
|
||||
13, // 12: nockchain.public.v1.NockchainNote.lock:type_name -> nockchain.public.v1.NockchainLock
|
||||
14, // 13: nockchain.public.v1.NockchainNote.source:type_name -> nockchain.public.v1.NockchainSource
|
||||
9, // 14: nockchain.public.v1.NockchainInput.name:type_name -> nockchain.public.v1.NockchainName
|
||||
8, // 15: nockchain.public.v1.NockchainInput.note:type_name -> nockchain.public.v1.NockchainNote
|
||||
7, // 16: nockchain.public.v1.NockchainInput.spend:type_name -> nockchain.public.v1.NockchainSpend
|
||||
14, // 17: nockchain.public.v1.NockchainSeed.output_source:type_name -> nockchain.public.v1.NockchainSource
|
||||
13, // 18: nockchain.public.v1.NockchainSeed.recipient:type_name -> nockchain.public.v1.NockchainLock
|
||||
3, // 19: nockchain.public.v1.NockchainSeed.timelock_intent:type_name -> nockchain.public.v1.TimelockIntent
|
||||
18, // 0: nockchain.public.v2.ScanData.data:type_name -> nockchain.public.v2.Balance
|
||||
4, // 1: nockchain.public.v2.TimelockIntent.absolute:type_name -> nockchain.public.v2.TimelockRange
|
||||
4, // 2: nockchain.public.v2.TimelockIntent.relative:type_name -> nockchain.public.v2.TimelockRange
|
||||
5, // 3: nockchain.public.v2.TimelockRange.min:type_name -> nockchain.public.v2.Timelock
|
||||
5, // 4: nockchain.public.v2.TimelockRange.max:type_name -> nockchain.public.v2.Timelock
|
||||
1, // 5: nockchain.public.v2.RawTx.version:type_name -> nockchain.public.v2.Version
|
||||
7, // 6: nockchain.public.v2.RawTx.named_spends:type_name -> nockchain.public.v2.NockchainNamedSpend
|
||||
13, // 7: nockchain.public.v2.NockchainNamedSpend.name:type_name -> nockchain.public.v2.NockchainName
|
||||
8, // 8: nockchain.public.v2.NockchainNamedSpend.legacy:type_name -> nockchain.public.v2.NockchainSpendV0
|
||||
9, // 9: nockchain.public.v2.NockchainNamedSpend.witness:type_name -> nockchain.public.v2.NockchainSpendV1
|
||||
14, // 10: nockchain.public.v2.NockchainSpendV0.signatures:type_name -> nockchain.public.v2.NockchainSignature
|
||||
15, // 11: nockchain.public.v2.NockchainSpendV0.seeds:type_name -> nockchain.public.v2.NockchainSeedV0
|
||||
11, // 12: nockchain.public.v2.NockchainNote.v0:type_name -> nockchain.public.v2.NockchainNoteV0
|
||||
12, // 13: nockchain.public.v2.NockchainNote.v1:type_name -> nockchain.public.v2.NockchainNoteV1
|
||||
1, // 14: nockchain.public.v2.NockchainNoteV0.version:type_name -> nockchain.public.v2.Version
|
||||
13, // 15: nockchain.public.v2.NockchainNoteV0.name:type_name -> nockchain.public.v2.NockchainName
|
||||
16, // 16: nockchain.public.v2.NockchainNoteV0.lock:type_name -> nockchain.public.v2.NockchainLock
|
||||
17, // 17: nockchain.public.v2.NockchainNoteV0.source:type_name -> nockchain.public.v2.NockchainSource
|
||||
17, // 18: nockchain.public.v2.NockchainSeedV0.output_source:type_name -> nockchain.public.v2.NockchainSource
|
||||
16, // 19: nockchain.public.v2.NockchainSeedV0.note_data:type_name -> nockchain.public.v2.NockchainLock
|
||||
20, // [20:20] is the sub-list for method output_type
|
||||
20, // [20:20] is the sub-list for method input_type
|
||||
20, // [20:20] is the sub-list for extension type_name
|
||||
@ -1047,15 +1222,22 @@ func file_types_proto_init() {
|
||||
file_blockchain_proto_init()
|
||||
file_types_proto_msgTypes[1].OneofWrappers = []any{}
|
||||
file_types_proto_msgTypes[2].OneofWrappers = []any{}
|
||||
file_types_proto_msgTypes[6].OneofWrappers = []any{}
|
||||
file_types_proto_msgTypes[10].OneofWrappers = []any{}
|
||||
file_types_proto_msgTypes[5].OneofWrappers = []any{
|
||||
(*NockchainNamedSpend_Legacy)(nil),
|
||||
(*NockchainNamedSpend_Witness)(nil),
|
||||
}
|
||||
file_types_proto_msgTypes[8].OneofWrappers = []any{
|
||||
(*NockchainNote_V0)(nil),
|
||||
(*NockchainNote_V1)(nil),
|
||||
}
|
||||
file_types_proto_msgTypes[13].OneofWrappers = []any{}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_types_proto_rawDesc), len(file_types_proto_rawDesc)),
|
||||
NumEnums: 2,
|
||||
NumMessages: 13,
|
||||
NumMessages: 16,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
||||
@ -1,24 +1,17 @@
|
||||
// nockchain/common/v1/blockchain.proto
|
||||
// nockchain/common/v2/blockchain.proto
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package nockchain.public.v1;
|
||||
package nockchain.public.v2;
|
||||
|
||||
import "primitives.proto";
|
||||
import "pagination.proto";
|
||||
option go_package = "./;nockchain";
|
||||
message WalletBalanceData {
|
||||
// Page of full UTXO entries for the requested wallet. Entries are ordered
|
||||
// by (Name.first, Name.last) to support consistent pagination.
|
||||
repeated BalanceEntry notes = 1; // note name -> amount
|
||||
|
||||
// Snapshot metadata where this page was computed. Clients should include
|
||||
// the returned page token to continue paging against the same snapshot.
|
||||
BlockHeight height = 2; // block height where balance was computed
|
||||
optional Hash block_id = 3; // block where balance was computed
|
||||
|
||||
// Pagination cursor for fetching the next page in a paginated view.
|
||||
// When empty, there are no further results for this snapshot.
|
||||
message Balance {
|
||||
repeated BalanceEntry notes = 1;
|
||||
BlockHeight height = 2;
|
||||
optional Hash block_id = 3;
|
||||
PageResponse page = 4;
|
||||
}
|
||||
|
||||
@ -27,39 +20,107 @@ message BalanceEntry {
|
||||
Note note = 2;
|
||||
}
|
||||
|
||||
// the string key is the name of the input
|
||||
// message RawTransaction { map<Name, Input> inputs = 1; }
|
||||
message RawTransaction {
|
||||
repeated NamedInput named_inputs = 1;
|
||||
TimeLockRangeAbsolute timelock_range = 2;
|
||||
Nicks total_fees = 3;
|
||||
Hash id = 4;
|
||||
NoteVersion version = 1;
|
||||
Hash id = 2;
|
||||
repeated SpendEntry spends = 3;
|
||||
}
|
||||
|
||||
message NamedInput {
|
||||
message SpendEntry {
|
||||
Name name = 1;
|
||||
Input input = 2;
|
||||
}
|
||||
|
||||
message Input {
|
||||
Note note = 1;
|
||||
Spend spend = 2;
|
||||
}
|
||||
|
||||
message Spend {
|
||||
oneof spend_kind {
|
||||
LegacySpend legacy = 1;
|
||||
WitnessSpend witness = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message LegacySpend {
|
||||
Signature signature = 1;
|
||||
repeated Seed seeds = 2;
|
||||
Nicks miner_fee_nicks = 3;
|
||||
}
|
||||
|
||||
message WitnessSpend {
|
||||
Witness witness = 1;
|
||||
repeated Seed seeds = 2;
|
||||
Nicks fee = 3;
|
||||
}
|
||||
|
||||
message Seed {
|
||||
optional OutputSource output_source = 1;
|
||||
Lock recipient = 2;
|
||||
optional TimeLockIntent timelock_intent = 3;
|
||||
// Absent when the seed originates from a coinbase output.
|
||||
Source output_source = 1;
|
||||
Hash lock_root = 2;
|
||||
NoteData note_data = 3;
|
||||
Nicks gift = 4;
|
||||
Hash parent_hash = 5;
|
||||
}
|
||||
|
||||
message Witness {
|
||||
LockMerkleProof lock_merkle_proof = 1;
|
||||
PkhSignature pkh_signature = 2;
|
||||
repeated HaxPreimage hax = 3;
|
||||
//uint64 tim = 4; // reserved field, currently 0
|
||||
}
|
||||
|
||||
|
||||
message HaxPreimage {
|
||||
Hash hash = 1;
|
||||
bytes value = 2; // jammed noun bytes
|
||||
}
|
||||
|
||||
message PkhSignature {
|
||||
repeated PkhSignatureEntry entries = 1;
|
||||
}
|
||||
|
||||
message PkhSignatureEntry {
|
||||
Hash hash = 1;
|
||||
SchnorrPubkey pubkey = 2;
|
||||
SchnorrSignature signature = 3;
|
||||
}
|
||||
|
||||
message LockMerkleProof {
|
||||
SpendCondition spend_condition = 1;
|
||||
uint64 axis = 2;
|
||||
MerkleProof proof = 3;
|
||||
}
|
||||
|
||||
message SpendCondition {
|
||||
repeated LockPrimitive primitives = 1;
|
||||
}
|
||||
|
||||
message LockPrimitive {
|
||||
oneof primitive {
|
||||
PkhLock pkh = 1;
|
||||
LockTim tim = 2;
|
||||
HaxLock hax = 3;
|
||||
BurnLock burn = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message PkhLock {
|
||||
uint64 m = 1;
|
||||
repeated Hash hashes = 2;
|
||||
}
|
||||
|
||||
message LockTim {
|
||||
TimeLockRangeRelative rel = 1;
|
||||
TimeLockRangeAbsolute abs = 2;
|
||||
}
|
||||
|
||||
message HaxLock {
|
||||
repeated Hash hashes = 1;
|
||||
}
|
||||
|
||||
message BurnLock {}
|
||||
|
||||
message MerkleProof {
|
||||
Hash root = 1;
|
||||
repeated Hash path = 2;
|
||||
}
|
||||
|
||||
message OutputSource { optional Source source = 1; }
|
||||
|
||||
message Source {
|
||||
@ -110,7 +171,14 @@ message Name {
|
||||
Hash last = 2;
|
||||
}
|
||||
|
||||
|
||||
message Note {
|
||||
oneof note_version {
|
||||
NoteV0 legacy = 1;
|
||||
NoteV1 v1 = 2;
|
||||
}
|
||||
}
|
||||
message NoteV0 {
|
||||
BlockHeight origin_page = 1; // page-number when added to balance
|
||||
optional TimeLockIntent timelock = 2; // enforced timelock
|
||||
Name name = 3; // nname (human/name label)
|
||||
@ -120,11 +188,27 @@ message Note {
|
||||
NoteVersion version = 7; // note version (currently 0)
|
||||
}
|
||||
|
||||
message NoteV1 {
|
||||
NoteVersion version = 1;
|
||||
BlockHeight origin_page = 2;
|
||||
Name name = 3;
|
||||
NoteData note_data = 4;
|
||||
Nicks assets = 5;
|
||||
}
|
||||
|
||||
message NoteData {
|
||||
repeated NoteDataEntry entries = 1;
|
||||
}
|
||||
|
||||
message NoteDataEntry {
|
||||
string key = 1;
|
||||
bytes blob = 2; // jammed noun bytes
|
||||
}
|
||||
|
||||
message Signature { repeated SignatureEntry entries = 1; }
|
||||
|
||||
message SignatureEntry {
|
||||
SchnorrPubkey schnorr_pubkey =
|
||||
1; // serialized pubkey corresponding to the signer
|
||||
SchnorrPubkey schnorr_pubkey = 1; // serialized pubkey corresponding to the signer
|
||||
SchnorrSignature signature = 2;
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package nockchain.public.v1;
|
||||
package nockchain.public.v2;
|
||||
|
||||
import "blockchain.proto";
|
||||
import "primitives.proto";
|
||||
@ -21,12 +21,15 @@ service NockchainService {
|
||||
|
||||
message WalletGetBalanceRequest {
|
||||
// pubkey cheetah point; specific address, or current wallet
|
||||
string address = 1;
|
||||
oneof selector {
|
||||
Base58Pubkey address = 1;
|
||||
Base58Hash first_name = 2;
|
||||
}
|
||||
// Pagination parameters. The server enforces limits and may return fewer
|
||||
// entries than requested to respect message size and policy. For consistent
|
||||
// paging across a stable snapshot, pass along the returned page_token from
|
||||
// the previous response without modification.
|
||||
PageRequest page = 2;
|
||||
PageRequest page = 3;
|
||||
}
|
||||
|
||||
message WalletGetBalanceResponse {
|
||||
@ -35,7 +38,7 @@ message WalletGetBalanceResponse {
|
||||
// Continue paging using `balance.page.next_page_token` until empty. Clients
|
||||
// should treat the page token as opaque; it may encode snapshot identity
|
||||
// and the last returned key.
|
||||
WalletBalanceData balance = 1;
|
||||
Balance balance = 1;
|
||||
ErrorStatus error = 2;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package nockchain.public.v1;
|
||||
package nockchain.public.v2;
|
||||
option go_package = "./;nockchain";
|
||||
|
||||
// Generic pagination parameters for list-style RPCs.
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package nockchain.public.v1;
|
||||
package nockchain.public.v2;
|
||||
option go_package = "./;nockchain";
|
||||
|
||||
message ErrorStatus {
|
||||
@ -63,6 +63,10 @@ message Base58Hash {
|
||||
string hash = 1;
|
||||
}
|
||||
|
||||
message Base58Pubkey {
|
||||
string key = 1;
|
||||
}
|
||||
|
||||
// pub struct SchnorrPubkey(pub CheetahPoint);
|
||||
message SchnorrPubkey { CheetahPoint value = 1; }
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
syntax = "proto3";
|
||||
package nockchain.public.v1;
|
||||
package nockchain.public.v2;
|
||||
|
||||
option go_package = "./;nockchain";
|
||||
|
||||
@ -68,15 +68,13 @@ message DeriveChildResponse {
|
||||
message CreateTxRequest {
|
||||
string names = 1;
|
||||
string recipients = 2;
|
||||
string gifts = 3;
|
||||
uint64 fee = 4;
|
||||
bool is_master_key = 5;
|
||||
string key = 6;
|
||||
string chain_code = 7;
|
||||
uint64 index = 8;
|
||||
bool hardened = 9;
|
||||
uint64 version = 10;
|
||||
TimelockIntent timelock_intent = 11;
|
||||
uint64 fee = 3;
|
||||
bool is_master_key = 4;
|
||||
string seed = 5;
|
||||
uint64 index = 6;
|
||||
bool hardened = 7;
|
||||
uint64 version = 8;
|
||||
string refund_address = 9;
|
||||
}
|
||||
|
||||
message CreateTxResponse {
|
||||
@ -100,6 +98,7 @@ message ScanRequest {
|
||||
uint64 search_depth = 3;
|
||||
bool include_timelocks = 4;
|
||||
bool include_multisig = 5;
|
||||
uint64 version = 6;
|
||||
}
|
||||
|
||||
message ScanResponse {
|
||||
@ -107,11 +106,14 @@ message ScanResponse {
|
||||
}
|
||||
|
||||
message GetBalanceRequest {
|
||||
oneof selector {
|
||||
string address = 1;
|
||||
string first_name = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message GetBalanceResponse {
|
||||
WalletBalanceData data = 1;
|
||||
Balance data = 1;
|
||||
}
|
||||
|
||||
message SendTransactionRequest {
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
syntax = "proto3";
|
||||
package nockchain.public.v1;
|
||||
package nockchain.public.v2;
|
||||
|
||||
option go_package = "./;nockchain";
|
||||
|
||||
import "blockchain.proto";
|
||||
message ScanData {
|
||||
string pubkey = 1;
|
||||
WalletBalanceData data = 2;
|
||||
Balance data = 2;
|
||||
}
|
||||
enum ImportType {
|
||||
UNDEFINED = 0;
|
||||
@ -32,50 +32,64 @@ message Timelock {
|
||||
|
||||
message RawTx {
|
||||
string tx_id = 1;
|
||||
repeated NockchainInput inputs = 2;
|
||||
TimelockRange timelock_range = 3;
|
||||
uint64 total_fees = 4;
|
||||
Version version = 2;
|
||||
repeated NockchainNamedSpend named_spends = 3;
|
||||
}
|
||||
|
||||
message NockchainSpend {
|
||||
message NockchainNamedSpend {
|
||||
NockchainName name = 1;
|
||||
oneof spend_kind {
|
||||
NockchainSpendV0 legacy = 2;
|
||||
NockchainSpendV1 witness = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message NockchainSpendV0 {
|
||||
repeated NockchainSignature signatures = 1;
|
||||
repeated NockchainSeed seeds = 2;
|
||||
repeated NockchainSeedV0 seeds = 2;
|
||||
uint64 fee = 3;
|
||||
}
|
||||
|
||||
message NockchainSpendV1 {
|
||||
}
|
||||
|
||||
message NockchainNote {
|
||||
oneof note {
|
||||
NockchainNoteV0 v0 = 1;
|
||||
NockchainNoteV1 v1 = 2;
|
||||
}
|
||||
}
|
||||
message NockchainNoteV0 {
|
||||
Version version = 1;
|
||||
uint64 block_height = 2;
|
||||
optional TimelockIntent timelock = 3;
|
||||
NockchainName name = 4;
|
||||
uint64 origin_page = 2;
|
||||
NockchainName name = 3;
|
||||
NockchainLock lock = 5;
|
||||
NockchainSource source = 6;
|
||||
uint64 asset =7;
|
||||
}
|
||||
|
||||
message NockchainNoteV1 {
|
||||
}
|
||||
|
||||
message NockchainName {
|
||||
string first = 1;
|
||||
string last = 2;
|
||||
}
|
||||
|
||||
message NockchainInput {
|
||||
NockchainName name = 1;
|
||||
NockchainNote note = 2;
|
||||
NockchainSpend spend = 3;
|
||||
}
|
||||
|
||||
message NockchainSignature {
|
||||
string pubkey = 1;
|
||||
repeated uint64 chal = 2;
|
||||
repeated uint64 sig = 3;
|
||||
}
|
||||
|
||||
message NockchainSeed {
|
||||
message NockchainSeedV0 {
|
||||
optional NockchainSource output_source = 1;
|
||||
NockchainLock recipient = 2;
|
||||
optional TimelockIntent timelock_intent = 3;
|
||||
string lock_root = 2;
|
||||
NockchainLock note_data = 3;
|
||||
uint64 gift = 4;
|
||||
string parent_hash = 5;
|
||||
}
|
||||
|
||||
message NockchainLock {
|
||||
uint64 keys_required = 1;
|
||||
repeated string pubkeys = 2;
|
||||
|
||||
@ -41,26 +41,44 @@ func (nc *NockchainClient) Close() error {
|
||||
return nc.conn.Close()
|
||||
}
|
||||
|
||||
func (nc *NockchainClient) WalletGetBalance(address string) (*nockchain.WalletBalanceData, error) {
|
||||
func (nc *NockchainClient) WalletGetBalance(req *nockchain.GetBalanceRequest) (*nockchain.Balance, error) {
|
||||
pageToken := ""
|
||||
allNotes := []*nockchain.BalanceEntry{}
|
||||
var height *nockchain.BlockHeight
|
||||
var blockId *nockchain.Hash
|
||||
for {
|
||||
req := nockchain.WalletGetBalanceRequest{
|
||||
Address: address,
|
||||
Page: &nockchain.PageRequest{
|
||||
page := &nockchain.PageRequest{
|
||||
ClientPageItemsLimit: 0,
|
||||
PageToken: pageToken,
|
||||
MaxBytes: 0,
|
||||
},
|
||||
}
|
||||
resp, err := nc.client.WalletGetBalance(context.Background(), &req)
|
||||
for {
|
||||
var request *nockchain.WalletGetBalanceRequest
|
||||
switch req.Selector.(type) {
|
||||
case *nockchain.GetBalanceRequest_Address:
|
||||
request = &nockchain.WalletGetBalanceRequest{
|
||||
Selector: &nockchain.WalletGetBalanceRequest_Address{
|
||||
Address: &nockchain.Base58Pubkey{
|
||||
Key: req.GetAddress(),
|
||||
},
|
||||
},
|
||||
Page: page,
|
||||
}
|
||||
case *nockchain.GetBalanceRequest_FirstName:
|
||||
request = &nockchain.WalletGetBalanceRequest{
|
||||
Selector: &nockchain.WalletGetBalanceRequest_FirstName{
|
||||
FirstName: &nockchain.Base58Hash{
|
||||
Hash: req.GetFirstName(),
|
||||
},
|
||||
},
|
||||
Page: page,
|
||||
}
|
||||
}
|
||||
resp, err := nc.client.WalletGetBalance(context.Background(), request)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
balance := nockchain.WalletBalanceData{}
|
||||
balance := nockchain.Balance{}
|
||||
switch resp.Result.(type) {
|
||||
case *nockchain.WalletGetBalanceResponse_Balance:
|
||||
balance = *resp.GetBalance()
|
||||
@ -84,9 +102,11 @@ func (nc *NockchainClient) WalletGetBalance(address string) (*nockchain.WalletBa
|
||||
break
|
||||
} else {
|
||||
pageToken = balance.Page.NextPageToken
|
||||
page.PageToken = pageToken
|
||||
}
|
||||
}
|
||||
return &nockchain.WalletBalanceData{
|
||||
|
||||
return &nockchain.Balance{
|
||||
Notes: allNotes,
|
||||
Height: height,
|
||||
BlockId: blockId,
|
||||
@ -118,24 +138,22 @@ func (nc *NockchainClient) TxAccepted(txId string) (*nockchain.TransactionAccept
|
||||
}
|
||||
|
||||
func (nc *NockchainClient) WalletSendTransaction(tx *nockchain.RawTx) (*nockchain.WalletSendTransactionResponse, error) {
|
||||
inputs := []*nockchain.NamedInput{}
|
||||
for _, i := range tx.Inputs {
|
||||
input, err := ConvertInput(i)
|
||||
spends := []*nockchain.SpendEntry{}
|
||||
for _, namedSpend := range tx.NamedSpends {
|
||||
spendEntry, err := ConvertNamedSpend(namedSpend)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error converting input: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
inputs = append(inputs, input)
|
||||
spends = append(spends, spendEntry)
|
||||
}
|
||||
req := nockchain.WalletSendTransactionRequest{
|
||||
TxId: ParseHash(tx.TxId),
|
||||
RawTx: &nockchain.RawTransaction{
|
||||
Id: ParseHash(tx.TxId),
|
||||
NamedInputs: inputs,
|
||||
TotalFees: &nockchain.Nicks{Value: tx.TotalFees},
|
||||
TimelockRange: &nockchain.TimeLockRangeAbsolute{
|
||||
Min: (*nockchain.BlockHeight)(tx.TimelockRange.Min),
|
||||
Max: (*nockchain.BlockHeight)(tx.TimelockRange.Max),
|
||||
Version: &nockchain.NoteVersion{
|
||||
Value: uint32(tx.Version),
|
||||
},
|
||||
Spends: spends,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@ -40,10 +40,27 @@ func HashSignature(signature *nockchain.NockchainSignature) ([5]uint64, error) {
|
||||
}
|
||||
pkHash := HashPubkey(pkPoint)
|
||||
sigHash = crypto.Tip5RehashTenCell(pkHash, sigHash)
|
||||
sigHash = crypto.Tip5RehashTenCell(sigHash, crypto.Tip5ZeroZero)
|
||||
return crypto.Tip5RehashTenCell(crypto.Tip5Zero, sigHash), nil
|
||||
return crypto.Tip5RehashTenCell(sigHash, crypto.Tip5ZeroZero), nil
|
||||
}
|
||||
|
||||
func HashNoteData(lock *nockchain.NockchainLock) [5]uint64 {
|
||||
keysRequiredHash := crypto.Tip5HashLeaf(lock.KeysRequired)
|
||||
// TODO: handle multisig
|
||||
finalHash := crypto.Base58ToTip5Hash(lock.Pubkeys[lock.KeysRequired-1])
|
||||
hash := crypto.Tip5RehashTenCell(crypto.Tip5HashLeaf(finalHash[3]), crypto.Tip5HashLeaf(finalHash[4]))
|
||||
hash = crypto.Tip5RehashTenCell(crypto.Tip5HashLeaf(finalHash[2]), hash)
|
||||
hash = crypto.Tip5RehashTenCell(crypto.Tip5HashLeaf(finalHash[1]), hash)
|
||||
hash = crypto.Tip5RehashTenCell(crypto.Tip5HashLeaf(finalHash[0]), hash)
|
||||
hash = crypto.Tip5RehashTenCell(hash, crypto.Tip5ZeroZero)
|
||||
|
||||
pkh := crypto.Tip5RehashTenCell(keysRequiredHash, hash)
|
||||
pkhWithPkhTag := crypto.Tip5RehashTenCell(crypto.PkhTagTip5Hash, pkh)
|
||||
pkhWithPkhTag = crypto.Tip5RehashTenCell(pkhWithPkhTag, crypto.Tip5Zero)
|
||||
pkhWithPkhTag = crypto.Tip5RehashTenCell(crypto.Tip5Zero, pkhWithPkhTag)
|
||||
|
||||
pkhWithPkhLockTag := crypto.Tip5RehashTenCell(crypto.LockTagTip5Hash, pkhWithPkhTag)
|
||||
return crypto.Tip5RehashTenCell(pkhWithPkhLockTag, crypto.Tip5ZeroZero)
|
||||
}
|
||||
func HashOwner(pkPoint crypto.CheetahPoint) [5]uint64 {
|
||||
pkHashedBelts := HashPubkey(pkPoint)
|
||||
pkHashedZeroZero := crypto.Tip5RehashTenCell(pkHashedBelts, crypto.Tip5ZeroZero)
|
||||
@ -79,15 +96,14 @@ func HashNameVarLen(name *nockchain.NockchainName) [5]uint64 {
|
||||
return res
|
||||
}
|
||||
|
||||
func HashNote(note *nockchain.NockchainNote) ([5]uint64, error) {
|
||||
func HashNoteV0(note *nockchain.NockchainNoteV0) ([5]uint64, error) {
|
||||
versionHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: uint64(note.Version)}})
|
||||
blockHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: note.BlockHeight}})
|
||||
timelockHash := HashTimelockIntent(note.Timelock)
|
||||
hashBlockTimeLock := crypto.Tip5RehashTenCell(blockHash, timelockHash)
|
||||
blockHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: note.OriginPage}})
|
||||
hashBlockTimeLock := crypto.Tip5RehashTenCell(blockHash, crypto.Tip5Zero)
|
||||
|
||||
p := crypto.Tip5RehashTenCell(versionHash, hashBlockTimeLock)
|
||||
nameHash := HashName(note.Name)
|
||||
lockHash, err := HashLock(note.Lock)
|
||||
lockHash, err := HashLockV0(note.Lock)
|
||||
if err != nil {
|
||||
return [5]uint64{}, err
|
||||
}
|
||||
@ -133,7 +149,8 @@ func HashTimelockRange(timelockRange *nockchain.TimelockRange) [5]uint64 {
|
||||
|
||||
return hash
|
||||
}
|
||||
func HashLock(lock *nockchain.NockchainLock) ([5]uint64, error) {
|
||||
|
||||
func HashLockV0(lock *nockchain.NockchainLock) ([5]uint64, error) {
|
||||
keysRequiredHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: lock.KeysRequired}})
|
||||
|
||||
finalPk := base58.Decode(lock.Pubkeys[lock.KeysRequired-1])
|
||||
@ -159,6 +176,23 @@ func HashLock(lock *nockchain.NockchainLock) ([5]uint64, error) {
|
||||
return crypto.Tip5RehashTenCell(keysRequiredHash, finalHash), nil
|
||||
}
|
||||
|
||||
func HashLock(lock *nockchain.NockchainLock) [5]uint64 {
|
||||
keysRequiredHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: lock.KeysRequired}})
|
||||
|
||||
pkh := crypto.Base58ToTip5Hash(lock.Pubkeys[lock.KeysRequired-1])
|
||||
finalHash := crypto.Tip5RehashTenCell(pkh, crypto.Tip5ZeroZero)
|
||||
if lock.KeysRequired != 1 {
|
||||
for i := uint64(1); i < lock.KeysRequired; i++ {
|
||||
pkh := crypto.Base58ToTip5Hash(lock.Pubkeys[lock.KeysRequired-1-i])
|
||||
finalHash = crypto.Tip5RehashTenCell(pkh, finalHash)
|
||||
}
|
||||
}
|
||||
|
||||
lockHash := crypto.Tip5RehashTenCell(keysRequiredHash, finalHash)
|
||||
lockHashWithTag := crypto.Tip5RehashTenCell(crypto.PkhTagTip5Hash, lockHash)
|
||||
return crypto.Tip5RehashTenCell(lockHashWithTag, crypto.Tip5Zero)
|
||||
}
|
||||
|
||||
func HashSource(source *nockchain.NockchainSource) [5]uint64 {
|
||||
if source == nil {
|
||||
return crypto.Tip5Zero
|
||||
@ -167,43 +201,45 @@ func HashSource(source *nockchain.NockchainSource) [5]uint64 {
|
||||
return crypto.Tip5RehashTenCell(sourceHash, crypto.Tip5One)
|
||||
}
|
||||
|
||||
func HashSeedWithoutSource(seed *nockchain.NockchainSeed) ([5]uint64, error) {
|
||||
lockHash, err := HashLock(seed.Recipient)
|
||||
if err != nil {
|
||||
return [5]uint64{}, nil
|
||||
}
|
||||
timelockIntentHash := HashTimelockIntent(seed.TimelockIntent)
|
||||
func HashSeedWithoutSource(seed *nockchain.NockchainSeedV0) [5]uint64 {
|
||||
lockRoot := crypto.Base58ToTip5Hash(seed.LockRoot)
|
||||
fmt.Println("lockRoot:", lockRoot)
|
||||
assetHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: seed.Gift}})
|
||||
|
||||
parentHash := crypto.Base58ToTip5Hash(seed.ParentHash)
|
||||
fmt.Println("parentHash:", parentHash)
|
||||
assetHashparentHash := crypto.Tip5RehashTenCell(assetHash, parentHash)
|
||||
|
||||
timelockHashAssetParentHash := crypto.Tip5RehashTenCell(timelockIntentHash, assetHashparentHash)
|
||||
noteDataHash := HashNoteData(seed.NoteData)
|
||||
fmt.Println("noteDataHash:", noteDataHash)
|
||||
noteDataHashAssetParentHash := crypto.Tip5RehashTenCell(noteDataHash, assetHashparentHash)
|
||||
|
||||
seedHash := crypto.Tip5RehashTenCell(lockHash, timelockHashAssetParentHash)
|
||||
return seedHash, nil
|
||||
}
|
||||
func HashSeed(seed *nockchain.NockchainSeed) ([5]uint64, error) {
|
||||
seedHash, err := HashSeedWithoutSource(seed)
|
||||
if err != nil {
|
||||
return [5]uint64{}, nil
|
||||
seedHash := crypto.Tip5RehashTenCell(lockRoot, noteDataHashAssetParentHash)
|
||||
return seedHash
|
||||
}
|
||||
func HashSeed(seed *nockchain.NockchainSeedV0) [5]uint64 {
|
||||
seedHash := HashSeedWithoutSource(seed)
|
||||
sourceHash := HashSource(seed.OutputSource)
|
||||
return crypto.Tip5RehashTenCell(sourceHash, seedHash), nil
|
||||
return crypto.Tip5RehashTenCell(sourceHash, seedHash)
|
||||
}
|
||||
|
||||
func HashSeedVarLen(seed *nockchain.NockchainSeed) ([5]uint64, error) {
|
||||
func HashSeedVarLen(seed *nockchain.NockchainSeedV0) [5]uint64 {
|
||||
belts := []crypto.Belt{{Value: 0}}
|
||||
belts = append(belts, crypto.Belt{Value: seed.Recipient.KeysRequired})
|
||||
for _, pk := range seed.Recipient.Pubkeys {
|
||||
pkPoint, err := crypto.CheetaPointFromBytes(base58.Decode(pk))
|
||||
if err != nil {
|
||||
return [5]uint64{}, err
|
||||
lockRoot := crypto.Base58ToTip5Hash(seed.LockRoot)
|
||||
for _, i := range lockRoot {
|
||||
belts = append(belts, crypto.Belt{Value: i})
|
||||
}
|
||||
belts = append(belts, pkPoint.X[:]...)
|
||||
belts = append(belts, pkPoint.Y[:]...)
|
||||
// %lock and %pkh tag
|
||||
belts = append(belts, []crypto.Belt{{Value: 1801678700}, {Value: 0}, {Value: 6843248}}...)
|
||||
belts = append(belts, crypto.Belt{Value: seed.NoteData.KeysRequired})
|
||||
for _, pk := range seed.NoteData.Pubkeys {
|
||||
pkHash := crypto.Base58ToTip5Hash(pk)
|
||||
for _, i := range pkHash {
|
||||
belts = append(belts, crypto.Belt{Value: i})
|
||||
}
|
||||
belts = append(belts, []crypto.Belt{{Value: 1}, {Value: 0}, {Value: 0}, {Value: 0}, {Value: seed.Gift}}...)
|
||||
}
|
||||
|
||||
belts = append(belts, []crypto.Belt{{Value: 0}, {Value: 0}, {Value: 0}, {Value: 0}, {Value: 0}, {Value: seed.Gift}}...)
|
||||
parentHash := crypto.Base58ToTip5Hash(seed.ParentHash)
|
||||
for _, i := range parentHash {
|
||||
belts = append(belts, crypto.Belt{Value: i})
|
||||
@ -213,9 +249,12 @@ func HashSeedVarLen(seed *nockchain.NockchainSeed) ([5]uint64, error) {
|
||||
for _, i := range crypto.MagicDyckForSeed {
|
||||
belts = append(belts, crypto.Belt{Value: i})
|
||||
}
|
||||
return crypto.Tip5HashBelts(belts), nil
|
||||
return crypto.Tip5HashBelts(belts)
|
||||
}
|
||||
func HashNonce(pkPoint crypto.CheetahPoint, message [5]uint64) ([]crypto.Belt, [5]uint64) {
|
||||
|
||||
func HashNonce(pkPoint crypto.CheetahPoint, message [5]uint64, privKey []byte) ([]crypto.Belt, [5]uint64) {
|
||||
privKeyBigInt := new(big.Int).SetBytes(privKey)
|
||||
privKeyT8 := crypto.BigIntToT8(*privKeyBigInt)
|
||||
belts := []crypto.Belt{}
|
||||
for _, belt := range pkPoint.X {
|
||||
belts = append(belts, belt)
|
||||
@ -228,12 +267,18 @@ func HashNonce(pkPoint crypto.CheetahPoint, message [5]uint64) ([]crypto.Belt, [
|
||||
for _, belt := range message {
|
||||
belts = append(belts, crypto.Belt{Value: belt})
|
||||
}
|
||||
|
||||
resBelts := make([]crypto.Belt, len(belts))
|
||||
copy(resBelts, belts)
|
||||
|
||||
for _, belt := range privKeyT8 {
|
||||
belts = append(belts, crypto.Belt{Value: belt})
|
||||
}
|
||||
|
||||
return resBelts, crypto.Tip5HashBelts(belts)
|
||||
}
|
||||
|
||||
func HashSpend(spend *nockchain.NockchainSpend) ([5]uint64, error) {
|
||||
func HashSpendV0(spend *nockchain.NockchainSpendV0) ([5]uint64, error) {
|
||||
// TODO: handle multiple sig
|
||||
if len(spend.Signatures) == 0 {
|
||||
return [5]uint64{}, fmt.Errorf("signatures can not be empty")
|
||||
@ -246,20 +291,15 @@ func HashSpend(spend *nockchain.NockchainSpend) ([5]uint64, error) {
|
||||
|
||||
seedsTree := NewZTree(
|
||||
func(i interface{}) [5]uint64 {
|
||||
if seed, ok := i.(*nockchain.NockchainSeed); ok {
|
||||
seedHash, err := HashSeedVarLen(seed)
|
||||
if err != nil {
|
||||
return [5]uint64{}
|
||||
}
|
||||
return seedHash
|
||||
if seed, ok := i.(*nockchain.NockchainSeedV0); ok {
|
||||
return HashSeedVarLen(seed)
|
||||
} else {
|
||||
return [5]uint64{}
|
||||
}
|
||||
},
|
||||
func(i interface{}) ([5]uint64, error) {
|
||||
if seed, ok := i.(*nockchain.NockchainSeed); ok {
|
||||
hash, err := HashSeedWithoutSource(seed)
|
||||
return hash, err
|
||||
if seed, ok := i.(*nockchain.NockchainSeedV0); ok {
|
||||
return HashSeedWithoutSource(seed), nil
|
||||
} else {
|
||||
return [5]uint64{}, fmt.Errorf("invalid input type")
|
||||
}
|
||||
@ -279,23 +319,18 @@ func HashSpend(spend *nockchain.NockchainSpend) ([5]uint64, error) {
|
||||
|
||||
}
|
||||
|
||||
func HashMsg(spend *nockchain.NockchainSpend) ([5]uint64, error) {
|
||||
func HashMsg(spend *nockchain.NockchainSpendV0) ([5]uint64, error) {
|
||||
seedsTree := NewZTree(
|
||||
func(i interface{}) [5]uint64 {
|
||||
if seed, ok := i.(*nockchain.NockchainSeed); ok {
|
||||
seedHash, err := HashSeedVarLen(seed)
|
||||
if err != nil {
|
||||
return [5]uint64{}
|
||||
}
|
||||
return seedHash
|
||||
if seed, ok := i.(*nockchain.NockchainSeedV0); ok {
|
||||
return HashSeedVarLen(seed)
|
||||
} else {
|
||||
return [5]uint64{}
|
||||
}
|
||||
},
|
||||
func(i interface{}) ([5]uint64, error) {
|
||||
if seed, ok := i.(*nockchain.NockchainSeed); ok {
|
||||
hash, err := HashSeed(seed)
|
||||
return hash, err
|
||||
if seed, ok := i.(*nockchain.NockchainSeedV0); ok {
|
||||
return HashSeed(seed), nil
|
||||
} else {
|
||||
return [5]uint64{}, fmt.Errorf("invalid input type")
|
||||
}
|
||||
@ -312,26 +347,29 @@ func HashMsg(spend *nockchain.NockchainSpend) ([5]uint64, error) {
|
||||
return crypto.Tip5RehashTenCell(finalSeedHash, feeHash), nil
|
||||
}
|
||||
|
||||
func HashInput(input *nockchain.NockchainInput) ([5]uint64, error) {
|
||||
nameHash := HashName(input.Name)
|
||||
// func HashInput(input *nockchain.NockchainInput) ([5]uint64, error) {
|
||||
// nameHash := HashName(input.Name)
|
||||
|
||||
noteHash, err := HashNote(input.Note)
|
||||
if err != nil {
|
||||
return [5]uint64{}, err
|
||||
// noteHash, err := HashNote(input.Note)
|
||||
// if err != nil {
|
||||
// return [5]uint64{}, err
|
||||
|
||||
}
|
||||
spendHash, err := HashSpend(input.Spend)
|
||||
if err != nil {
|
||||
return [5]uint64{}, err
|
||||
// }
|
||||
// spendHash, err := HashSpend(input.Spend)
|
||||
// if err != nil {
|
||||
// return [5]uint64{}, err
|
||||
|
||||
}
|
||||
hashNoteSpend := crypto.Tip5RehashTenCell(noteHash, spendHash)
|
||||
return crypto.Tip5RehashTenCell(nameHash, hashNoteSpend), nil
|
||||
}
|
||||
// }
|
||||
// hashNoteSpend := crypto.Tip5RehashTenCell(noteHash, spendHash)
|
||||
// return crypto.Tip5RehashTenCell(nameHash, hashNoteSpend), nil
|
||||
// }
|
||||
|
||||
func ComputeTxId(inputs []*nockchain.NockchainInput, timelockRange *nockchain.TimelockRange, totalFees uint64) ([5]uint64, error) {
|
||||
|
||||
inputTree := NewZTree(
|
||||
func ComputeTxId(spends []*nockchain.NockchainNamedSpend, version uint64) ([5]uint64, error) {
|
||||
var spendHash [5]uint64
|
||||
var err error
|
||||
switch version {
|
||||
case 0:
|
||||
spendTree := NewZTree(
|
||||
func(i interface{}) [5]uint64 {
|
||||
if name, ok := i.(*nockchain.NockchainName); ok {
|
||||
return HashNameVarLen(name)
|
||||
@ -340,28 +378,32 @@ func ComputeTxId(inputs []*nockchain.NockchainInput, timelockRange *nockchain.Ti
|
||||
}
|
||||
},
|
||||
func(i interface{}) ([5]uint64, error) {
|
||||
if input, ok := i.(*nockchain.NockchainInput); ok {
|
||||
hash, err := HashInput(input)
|
||||
return hash, err
|
||||
if spendEntry, ok := i.(*nockchain.NockchainNamedSpend); ok {
|
||||
nameHash := HashName(spendEntry.Name)
|
||||
spendV0Hash, err := HashSpendV0(spendEntry.GetLegacy())
|
||||
if err != nil {
|
||||
return [5]uint64{}, fmt.Errorf("error hashing spend: %v", err)
|
||||
}
|
||||
|
||||
zeroHashspend := crypto.Tip5RehashTenCell(crypto.Tip5Zero, spendV0Hash)
|
||||
return crypto.Tip5RehashTenCell(nameHash, zeroHashspend), nil
|
||||
} else {
|
||||
return [5]uint64{}, fmt.Errorf("invalid input type")
|
||||
}
|
||||
},
|
||||
)
|
||||
for _, input := range inputs {
|
||||
inputTree.Insert(input.Name, input)
|
||||
for _, spend := range spends {
|
||||
spendTree.Insert(spend.Name, spend)
|
||||
}
|
||||
inputHash, err := inputTree.Hash()
|
||||
spendHash, err = spendTree.Hash()
|
||||
if err != nil {
|
||||
return [5]uint64{}, fmt.Errorf("error hashing inputs: %v", err)
|
||||
return [5]uint64{}, fmt.Errorf("error hashing spends: %v", err)
|
||||
}
|
||||
|
||||
timelockHash := HashTimelockRange(timelockRange)
|
||||
|
||||
totalFeesHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: totalFees}})
|
||||
|
||||
q := crypto.Tip5RehashTenCell(timelockHash, totalFeesHash)
|
||||
return crypto.Tip5RehashTenCell(inputHash, q), nil
|
||||
fmt.Println("spendHash:", spendHash)
|
||||
default:
|
||||
return [5]uint64{}, fmt.Errorf("unsupported version %d", version)
|
||||
}
|
||||
return crypto.Tip5RehashTenCell(crypto.Tip5One, spendHash), nil
|
||||
}
|
||||
|
||||
func ComputeSig(m crypto.MasterKey, msg [5]uint64) ([8]uint64, [8]uint64, error) {
|
||||
@ -369,7 +411,7 @@ func ComputeSig(m crypto.MasterKey, msg [5]uint64) ([8]uint64, [8]uint64, error)
|
||||
if err != nil {
|
||||
return [8]uint64{}, [8]uint64{}, err
|
||||
}
|
||||
belts, nonce := HashNonce(pkPoint, msg)
|
||||
belts, nonce := HashNonce(pkPoint, msg, m.PrivateKey)
|
||||
nonceBigInt := crypto.TruncGOrder(nonce)
|
||||
scalar := crypto.CheetahScaleBig(crypto.A_GEN, *nonceBigInt)
|
||||
|
||||
|
||||
91
wallet/noun.go
Normal file
91
wallet/noun.go
Normal file
@ -0,0 +1,91 @@
|
||||
package wallet
|
||||
|
||||
import (
|
||||
"math/bits"
|
||||
|
||||
"github.com/phamminh0811/private-grpc/crypto"
|
||||
"github.com/phamminh0811/private-grpc/nockchain"
|
||||
)
|
||||
|
||||
var InitialBits = []bool{true, false, false, true, true, false, true, false, false, false, false, false, false, false, true, true, true, true, false, false, false, false, false, true, true, true, false, true, true, false, true, false, true, true, false, false, false, false, true, false, true, true, true, false}
|
||||
|
||||
func NumBitsUint64(v uint64) int {
|
||||
if v == 0 {
|
||||
return 0
|
||||
}
|
||||
return 64 - bits.LeadingZeros64(v)
|
||||
}
|
||||
|
||||
func Uint64ToBitsLSB0(x uint64) []bool {
|
||||
bits := make([]bool, 64)
|
||||
for i := 0; i < 64; i++ {
|
||||
bits[i] = ((x >> i) & 1) == 1
|
||||
}
|
||||
return bits
|
||||
}
|
||||
|
||||
func BoolsToBytesLSB0(bits []bool) []byte {
|
||||
if len(bits) == 0 {
|
||||
return nil
|
||||
}
|
||||
n := (len(bits) + 7) / 8 // ceil division
|
||||
bytes := make([]byte, n)
|
||||
for i, bit := range bits {
|
||||
if bit {
|
||||
byteIdx := i / 8
|
||||
bitIdx := i % 8
|
||||
bytes[byteIdx] |= 1 << bitIdx // LSB0: least-significant bit first
|
||||
}
|
||||
}
|
||||
return bytes
|
||||
}
|
||||
|
||||
func EncodeNoteData(noteData *nockchain.NockchainLock) []byte {
|
||||
bits := InitialBits
|
||||
|
||||
numPubkeys := noteData.KeysRequired
|
||||
numPubkeysSz := NumBitsUint64(uint64(numPubkeys))
|
||||
numPubkeysSzSz := NumBitsUint64(uint64(numPubkeysSz))
|
||||
|
||||
bits = append(bits, false)
|
||||
for i := 0; i < numPubkeysSzSz; i++ {
|
||||
bits = append(bits, false)
|
||||
}
|
||||
bits = append(bits, true)
|
||||
|
||||
if numPubkeysSzSz > 1 {
|
||||
numPubkeysSzBits := Uint64ToBitsLSB0(uint64(numPubkeysSz))
|
||||
bits = append(bits, numPubkeysSzBits[0:numPubkeysSzSz-1]...)
|
||||
}
|
||||
|
||||
numPubkeysBits := Uint64ToBitsLSB0(uint64(numPubkeys))
|
||||
bits = append(bits, numPubkeysBits[0:numPubkeysSz]...)
|
||||
bits = append(bits, []bool{true, false}...)
|
||||
for _, pkStr := range noteData.Pubkeys {
|
||||
pkHash := crypto.Base58ToTip5Hash(pkStr)
|
||||
for i, hash := range pkHash {
|
||||
if i != 4 {
|
||||
bits = append(bits, []bool{true, false}...)
|
||||
}
|
||||
hashSz := NumBitsUint64(hash)
|
||||
hashSzSz := NumBitsUint64(uint64(hashSz))
|
||||
|
||||
bits = append(bits, false)
|
||||
for i := 0; i < hashSzSz; i++ {
|
||||
bits = append(bits, false)
|
||||
}
|
||||
bits = append(bits, true)
|
||||
|
||||
if hashSzSz > 1 {
|
||||
hashSzBits := Uint64ToBitsLSB0(uint64(hashSz))
|
||||
bits = append(bits, hashSzBits[0:hashSzSz-1]...)
|
||||
}
|
||||
|
||||
hashBits := Uint64ToBitsLSB0(hash)
|
||||
bits = append(bits, hashBits[0:hashSz]...)
|
||||
}
|
||||
}
|
||||
|
||||
bits = append(bits, []bool{true, false, false, true, false, true, false, true}...)
|
||||
return BoolsToBytesLSB0(bits)
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
package wallet
|
||||
|
||||
import (
|
||||
"cmp"
|
||||
context "context"
|
||||
"crypto/rand"
|
||||
"crypto/sha256"
|
||||
@ -15,6 +16,13 @@ import (
|
||||
"github.com/phamminh0811/private-grpc/nockchain"
|
||||
)
|
||||
|
||||
const (
|
||||
WitnessWordsCount = 0
|
||||
SignatureWordsCount = 31
|
||||
SeedWordsCount = 13
|
||||
BaseFee = 1 << 15
|
||||
)
|
||||
|
||||
type GprcHandler struct {
|
||||
nockchain.UnimplementedWalletServiceServer
|
||||
client NockchainClient
|
||||
@ -360,20 +368,14 @@ func (h *GprcHandler) DeriveChild(ctx context.Context, req *nockchain.DeriveChil
|
||||
// - `names` - Comma-separated list of note name pairs in format "[first last]"
|
||||
// Example: "[first1 last1],[first2 last2]"
|
||||
//
|
||||
// - `recipients` - Comma-separated list of recipient $locks
|
||||
// Example: "[1 pk1],[2 pk2,pk3,pk4]"
|
||||
// A simple comma-separated list is also supported: "pk1,pk2,pk3",
|
||||
// where it is presumed that all recipients are single-signature,
|
||||
// that is to say, it is the same as "[1 pk1],[1 pk2],[1 pk3]"
|
||||
//
|
||||
// - `gifts` - Comma-separated list of amounts to send to each recipient
|
||||
// Example: "100,200"
|
||||
// - `recipients` Comma-separated list of transaction output, formatted as "<recipient1>:<amount1>,<recipient1>:<amount1>"
|
||||
//
|
||||
// - `fee` - Transaction fee to be subtracted from one of the input notes
|
||||
func (h *GprcHandler) CreateTx(ctx context.Context, req *nockchain.CreateTxRequest) (*nockchain.CreateTxResponse, error) {
|
||||
nnames := []*nockchain.NockchainName{}
|
||||
names := strings.Split(req.Names, ",")
|
||||
notes := make([]*nockchain.NockchainNote, len(names))
|
||||
notesV0 := make([]*nockchain.NockchainNoteV0, len(names))
|
||||
notesV1 := make([]*nockchain.NockchainNoteV1, len(names))
|
||||
for _, name := range names {
|
||||
name = strings.TrimSpace(name)
|
||||
if strings.HasPrefix(name, "[") && strings.HasSuffix(name, "]") {
|
||||
@ -414,61 +416,26 @@ func (h *GprcHandler) CreateTx(ctx context.Context, req *nockchain.CreateTxReque
|
||||
}
|
||||
}
|
||||
|
||||
recipents := []*nockchain.NockchainLock{}
|
||||
if strings.Contains(req.Recipients, "[") {
|
||||
pairs := strings.Split(req.Recipients, ",")
|
||||
for _, pair := range pairs {
|
||||
pair = strings.TrimSpace(pair)
|
||||
specs := strings.Split(req.Recipients, ",")
|
||||
if len(specs) == 0 {
|
||||
return nil, fmt.Errorf("at least one output must be provided")
|
||||
}
|
||||
if len(specs) > 1 {
|
||||
return nil, fmt.Errorf("multiple outputs are not supported yet, provide a single <pkh>:<amount> pair")
|
||||
}
|
||||
|
||||
if strings.HasPrefix(pair, "[") && strings.HasSuffix(pair, "]") {
|
||||
inner := pair[1 : len(pair)-1]
|
||||
parts := strings.SplitN(inner, " ", 2)
|
||||
spec := specs[0]
|
||||
pairs := strings.Split(spec, ":")
|
||||
if len(pairs) != 2 {
|
||||
return nil, fmt.Errorf("%s", "Invalid output spec "+spec+", expected <pkh>:<amount>")
|
||||
}
|
||||
|
||||
if len(parts) == 2 {
|
||||
number, err := strconv.ParseUint(parts[0], 10, 64)
|
||||
gift, err := strconv.ParseUint(strings.TrimSpace(pairs[1]), 10, 64)
|
||||
if err != nil {
|
||||
continue
|
||||
return nil, err
|
||||
}
|
||||
|
||||
pubkeysStr := strings.Split(parts[1], ",")
|
||||
|
||||
recipents = append(recipents, &nockchain.NockchainLock{KeysRequired: number, Pubkeys: pubkeysStr})
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Parse simple format: "pk1,pk2,pk3"
|
||||
addrs := strings.Split(req.Recipients, ",")
|
||||
|
||||
for _, addr := range addrs {
|
||||
recipents = append(recipents, &nockchain.NockchainLock{KeysRequired: uint64(1), Pubkeys: []string{strings.TrimSpace(addr)}})
|
||||
}
|
||||
}
|
||||
gifts := []uint64{}
|
||||
for _, gift := range strings.Split(req.Gifts, ",") {
|
||||
gift, err := strconv.ParseUint(gift, 10, 64)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
gifts = append(gifts, gift)
|
||||
}
|
||||
|
||||
// Verify lengths based on single vs multiple mode
|
||||
if len(recipents) == 1 && len(gifts) == 1 {
|
||||
// Single mode: can spend from multiple notes to single recipient
|
||||
// No additional validation needed - any number of names is allowed
|
||||
} else {
|
||||
// Multiple mode: all lengths must match
|
||||
if len(nnames) != len(recipents) || len(nnames) != len(gifts) {
|
||||
return nil, fmt.Errorf("multiple recipient mode requires names, recipients, and gifts to have the same length")
|
||||
}
|
||||
}
|
||||
|
||||
var masterKey *crypto.MasterKey
|
||||
chainCode := base58.Decode(req.ChainCode)
|
||||
key := base58.Decode(req.Key)
|
||||
masterKey, err := crypto.MasterKeyFromPrivKey(chainCode, key)
|
||||
masterKey, err := crypto.MasterKeyFromSeed(req.Seed)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -488,8 +455,32 @@ func (h *GprcHandler) CreateTx(ctx context.Context, req *nockchain.CreateTxReque
|
||||
masterKey = &childKey
|
||||
}
|
||||
|
||||
recipent := &nockchain.NockchainLock{
|
||||
KeysRequired: 1,
|
||||
Pubkeys: []string{strings.TrimSpace(pairs[0])},
|
||||
}
|
||||
if req.Version == 0 && req.RefundAddress == "" {
|
||||
return nil, fmt.Errorf("need to specify a refund address if spending from v0 notes")
|
||||
}
|
||||
refundAddr := req.RefundAddress
|
||||
if refundAddr == "" {
|
||||
masterPkPoint, err := crypto.CheetaPointFromBytes(masterKey.PublicKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
pkHash := HashPubkey(masterPkPoint)
|
||||
refundAddr = crypto.Tip5HashToBase58(pkHash)
|
||||
}
|
||||
refundLock := &nockchain.NockchainLock{
|
||||
KeysRequired: 1,
|
||||
Pubkeys: []string{refundAddr},
|
||||
}
|
||||
// Scan key to get notes
|
||||
masterKeyScan, err := h.client.WalletGetBalance(base58.Encode(masterKey.PublicKey))
|
||||
masterKeyScan, err := h.client.WalletGetBalance(&nockchain.GetBalanceRequest{
|
||||
Selector: &nockchain.GetBalanceRequest_Address{
|
||||
Address: base58.Encode(masterKey.PublicKey),
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -512,67 +503,108 @@ func (h *GprcHandler) CreateTx(ctx context.Context, req *nockchain.CreateTxReque
|
||||
name := "[" + firstName + " " + lastName + "]"
|
||||
if i := slices.Index(names, name); i != -1 {
|
||||
balanceEntry := ParseBalanceEntry(note)
|
||||
notes[i] = &balanceEntry
|
||||
switch req.Version {
|
||||
case 0:
|
||||
notesV0[i] = balanceEntry.GetV0()
|
||||
case 1:
|
||||
notesV1[i] = balanceEntry.GetV1()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inputs := make([]*nockchain.NockchainInput, len(names))
|
||||
isSpent := false
|
||||
for i := 0; i < len(nameKeys); i++ {
|
||||
idx := indices[i]
|
||||
if notes[idx] == nil {
|
||||
return nil, fmt.Errorf("notes scanned is missing at name: %s", names[idx])
|
||||
giftRemaining := gift
|
||||
feeRemaining := req.Fee
|
||||
wordCount := 0
|
||||
for i := 0; i < len(names); i++ {
|
||||
switch req.Version {
|
||||
case 0:
|
||||
if notesV0[i] == nil {
|
||||
return nil, fmt.Errorf("notes scanned is missing at name: %s", names[i])
|
||||
}
|
||||
case 1:
|
||||
if notesV1[i] == nil {
|
||||
return nil, fmt.Errorf("notes scanned is missing at name: %s", names[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if notes[idx].Asset < gifts[idx] {
|
||||
return nil, fmt.Errorf("note %s not enough balance", names[idx])
|
||||
notesV0Sort := make([]*nockchain.NockchainNoteV0, len(notesV0))
|
||||
copy(notesV0Sort, notesV0)
|
||||
|
||||
notesV1Sort := make([]*nockchain.NockchainNoteV1, len(notesV1))
|
||||
copy(notesV1Sort, notesV1)
|
||||
|
||||
slices.SortFunc(notesV0Sort, func(note1, note2 *nockchain.NockchainNoteV0) int {
|
||||
return cmp.Compare(note1.Asset, note2.Asset)
|
||||
})
|
||||
// TODO: sort V1 notes
|
||||
|
||||
spends := []*nockchain.NockchainNamedSpend{}
|
||||
for _, note := range notesV0Sort {
|
||||
giftPortion := uint64(0)
|
||||
feePortion := uint64(0)
|
||||
if giftRemaining != 0 {
|
||||
giftPortion = min(giftRemaining, note.Asset)
|
||||
}
|
||||
|
||||
parentHash, err := HashNote(notes[idx])
|
||||
feeAvailable := note.Asset - giftPortion
|
||||
if feeRemaining != 0 {
|
||||
feePortion = min(feeRemaining, feeAvailable)
|
||||
}
|
||||
|
||||
if giftPortion == 0 && feePortion == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
giftRemaining = giftRemaining - giftPortion
|
||||
feeRemaining = feeRemaining - feePortion
|
||||
|
||||
refund := note.Asset - giftPortion - feePortion
|
||||
if refund == 0 && giftPortion == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
parentHash, err := HashNoteV0(note)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
seeds := []*nockchain.NockchainSeed{
|
||||
|
||||
if req.Version == 0 {
|
||||
lockRoot := HashLock(recipent)
|
||||
wordCount += SeedWordsCount
|
||||
seeds := []*nockchain.NockchainSeedV0{
|
||||
{
|
||||
OutputSource: nil,
|
||||
Recipient: recipents[idx],
|
||||
TimelockIntent: req.TimelockIntent,
|
||||
Gift: gifts[idx],
|
||||
LockRoot: crypto.Tip5HashToBase58(lockRoot),
|
||||
NoteData: recipent,
|
||||
Gift: giftPortion,
|
||||
ParentHash: crypto.Tip5HashToBase58(parentHash),
|
||||
},
|
||||
}
|
||||
|
||||
assetLeft := notes[idx].Asset - gifts[idx]
|
||||
fee := uint64(0)
|
||||
if !isSpent && assetLeft >= req.Fee {
|
||||
isSpent = true
|
||||
fee = req.Fee
|
||||
assetLeft -= req.Fee
|
||||
}
|
||||
|
||||
if assetLeft != 0 {
|
||||
seeds = append(seeds, &nockchain.NockchainSeed{
|
||||
if refund != 0 {
|
||||
wordCount += SeedWordsCount
|
||||
lockRoot := HashLock(refundLock)
|
||||
seeds = append(seeds, &nockchain.NockchainSeedV0{
|
||||
OutputSource: nil,
|
||||
Recipient: &nockchain.NockchainLock{
|
||||
KeysRequired: 1,
|
||||
Pubkeys: []string{base58.Encode(masterKey.PublicKey)},
|
||||
},
|
||||
TimelockIntent: req.TimelockIntent,
|
||||
Gift: assetLeft,
|
||||
LockRoot: crypto.Tip5HashToBase58(lockRoot),
|
||||
NoteData: refundLock,
|
||||
Gift: refund,
|
||||
ParentHash: crypto.Tip5HashToBase58(parentHash),
|
||||
})
|
||||
}
|
||||
spend := nockchain.NockchainSpend{
|
||||
|
||||
spend := nockchain.NockchainSpendV0{
|
||||
Signatures: nil,
|
||||
Seeds: seeds,
|
||||
Fee: fee,
|
||||
Fee: feePortion,
|
||||
}
|
||||
|
||||
msg, err := HashMsg(&spend)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fmt.Println("msg:", msg)
|
||||
|
||||
// sign
|
||||
chalT8, sigT8, err := ComputeSig(*masterKey, msg)
|
||||
@ -580,6 +612,11 @@ func (h *GprcHandler) CreateTx(ctx context.Context, req *nockchain.CreateTxReque
|
||||
return nil, err
|
||||
}
|
||||
|
||||
masterPkPoint, err := crypto.CheetaPointFromBytes(masterKey.PublicKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fmt.Println("master pk point:", masterPkPoint)
|
||||
spend.Signatures = []*nockchain.NockchainSignature{
|
||||
{
|
||||
Pubkey: base58.Encode(masterKey.PublicKey),
|
||||
@ -587,40 +624,27 @@ func (h *GprcHandler) CreateTx(ctx context.Context, req *nockchain.CreateTxReque
|
||||
Sig: sigT8[:],
|
||||
},
|
||||
}
|
||||
|
||||
input := nockchain.NockchainInput{
|
||||
Name: nnames[idx],
|
||||
Note: notes[idx],
|
||||
Spend: &spend,
|
||||
}
|
||||
inputs[idx] = &input
|
||||
wordCount += SignatureWordsCount
|
||||
spends = append(spends, &nockchain.NockchainNamedSpend{
|
||||
Name: note.Name,
|
||||
SpendKind: &nockchain.NockchainNamedSpend_Legacy{
|
||||
Legacy: &spend,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
if !isSpent {
|
||||
return nil, fmt.Errorf("insufficient funds")
|
||||
}
|
||||
var timelockRange *nockchain.TimelockRange
|
||||
if req.TimelockIntent == nil {
|
||||
timelockRange = &nockchain.TimelockRange{
|
||||
Min: nil,
|
||||
Max: nil,
|
||||
}
|
||||
} else {
|
||||
if req.TimelockIntent.Absolute != nil {
|
||||
timelockRange = req.TimelockIntent.Absolute
|
||||
}
|
||||
if req.TimelockIntent.Relative != nil {
|
||||
timelockRange = req.TimelockIntent.Relative
|
||||
|
||||
if wordCount*BaseFee > int(req.Fee) {
|
||||
return nil, fmt.Errorf("min fee not met, this transaction requires at least: %d", wordCount*BaseFee)
|
||||
}
|
||||
}
|
||||
|
||||
rawTx := nockchain.RawTx{
|
||||
TxId: "",
|
||||
Inputs: inputs,
|
||||
TimelockRange: timelockRange,
|
||||
TotalFees: req.Fee,
|
||||
Version: 1,
|
||||
NamedSpends: spends,
|
||||
}
|
||||
txId, err := ComputeTxId(inputs, timelockRange, req.Fee)
|
||||
txId, err := ComputeTxId(spends, req.Version)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -640,8 +664,23 @@ func (h *GprcHandler) Scan(ctx context.Context, req *nockchain.ScanRequest) (*no
|
||||
ChainCode: chainCode,
|
||||
PrivateKey: []byte{},
|
||||
}
|
||||
address := ""
|
||||
if req.Version == 0 {
|
||||
address = base58.Encode(masterKey.PublicKey)
|
||||
} else {
|
||||
pkPoint, err := crypto.CheetaPointFromBytes(masterKey.PublicKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
pkHash := HashPubkey(pkPoint)
|
||||
address = crypto.Tip5HashToBase58(pkHash)
|
||||
}
|
||||
|
||||
masterKeyScan, err := h.client.WalletGetBalance(req.MasterPubkey)
|
||||
masterKeyScan, err := h.client.WalletGetBalance(&nockchain.GetBalanceRequest{
|
||||
Selector: &nockchain.GetBalanceRequest_Address{
|
||||
Address: address,
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -656,7 +695,24 @@ func (h *GprcHandler) Scan(ctx context.Context, req *nockchain.ScanRequest) (*no
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
childKeyScan, err := h.client.WalletGetBalance(base58.Encode(childKey.PublicKey))
|
||||
|
||||
address := ""
|
||||
if req.Version == 0 {
|
||||
address = base58.Encode(childKey.PublicKey)
|
||||
} else {
|
||||
pkPoint, err := crypto.CheetaPointFromBytes(childKey.PublicKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
pkHash := HashPubkey(pkPoint)
|
||||
address = crypto.Tip5HashToBase58(pkHash)
|
||||
}
|
||||
|
||||
childKeyScan, err := h.client.WalletGetBalance(&nockchain.GetBalanceRequest{
|
||||
Selector: &nockchain.GetBalanceRequest_Address{
|
||||
Address: address,
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
@ -674,7 +730,7 @@ func (h *GprcHandler) Scan(ctx context.Context, req *nockchain.ScanRequest) (*no
|
||||
}
|
||||
|
||||
func (h *GprcHandler) WalletGetBalance(_ context.Context, req *nockchain.GetBalanceRequest) (*nockchain.GetBalanceResponse, error) {
|
||||
data, err := h.client.WalletGetBalance(req.Address)
|
||||
data, err := h.client.WalletGetBalance(req)
|
||||
return &nockchain.GetBalanceResponse{
|
||||
Data: data,
|
||||
}, err
|
||||
|
||||
@ -417,169 +417,180 @@ func TestImportKey(t *testing.T) {
|
||||
// This test should be run with timeout 120s
|
||||
func TestScan(t *testing.T) {
|
||||
// some random seed we take to get empty notes
|
||||
seed1 := "foster chicken claw fade income frown junior abandon price lesson mango wrap dry clay loyal camera caught during property useless puppy royal soccer arm"
|
||||
seed2 := "brass vacuum stairs hurt brisk govern describe enforce fly exact rescue capable belt flavor lottery sauce easy frame orange legal injury border obey novel"
|
||||
seed1 := "rail nurse smile angle uphold gun kitten spoon quick frozen trigger cable decorate episode blame tray off bag arena taxi approve breeze job letter"
|
||||
|
||||
masterKey1, err := crypto.MasterKeyFromSeed(seed1)
|
||||
assert.NoError(t, err)
|
||||
|
||||
fmt.Println("pk: ", base58.Encode(masterKey1.PublicKey))
|
||||
nc, err := wallet.NewNockchainClient("nockchain-api.zorp.io:443")
|
||||
assert.NoError(t, err)
|
||||
|
||||
masterKey1Scan, err := nc.WalletGetBalance(base58.Encode(masterKey1.PublicKey))
|
||||
assert.NoError(t, err)
|
||||
assert.Empty(t, masterKey1Scan.Notes)
|
||||
|
||||
masterKey2, err := crypto.MasterKeyFromSeed(seed2)
|
||||
assert.NoError(t, err)
|
||||
|
||||
masterKey2Scan, err := nc.WalletGetBalance(base58.Encode(masterKey2.PublicKey))
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, masterKey2Scan.Notes, 1)
|
||||
assert.Equal(t, masterKey2Scan.Notes[0].Note.Assets.Value, uint64(100000))
|
||||
assert.Equal(t, masterKey2Scan.Notes[0].Note.OriginPage.Value, uint64(35054))
|
||||
}
|
||||
|
||||
// This test should be run with timeout 120s
|
||||
func TestFullFlow(t *testing.T) {
|
||||
mnemonic1 := "rail nurse smile angle uphold gun kitten spoon quick frozen trigger cable decorate episode blame tray off bag arena taxi approve breeze job letter"
|
||||
masterKey1, err := crypto.MasterKeyFromSeed(mnemonic1)
|
||||
assert.NoError(t, err)
|
||||
|
||||
mnemonic2 := "brass vacuum stairs hurt brisk govern describe enforce fly exact rescue capable belt flavor lottery sauce easy frame orange legal injury border obey novel"
|
||||
masterKey2, err := crypto.MasterKeyFromSeed(mnemonic2)
|
||||
assert.NoError(t, err)
|
||||
|
||||
inputName := "[4taoqkpysafnp64WBQyzHDKVrqkMeNrdAiVSbWdzZmj7yQYZgQtCq4W 9cjUFbdtaFHeXNWCAKjsTphBchHmCoUU6a1aDbJAFz9qHqeG8osh4wF]"
|
||||
|
||||
nc, err := wallet.NewNockchainClient("nockchain-api.zorp.io:443")
|
||||
assert.NoError(t, err)
|
||||
|
||||
masterKeyScan, err := nc.WalletGetBalance(base58.Encode(masterKey1.PublicKey))
|
||||
assert.NoError(t, err)
|
||||
|
||||
var note *nockchain.NockchainNote
|
||||
for _, balanceEntry := range masterKeyScan.Notes {
|
||||
firstName := crypto.Tip5HashToBase58([5]uint64{
|
||||
balanceEntry.Name.First.Belt_1.Value,
|
||||
balanceEntry.Name.First.Belt_2.Value,
|
||||
balanceEntry.Name.First.Belt_3.Value,
|
||||
balanceEntry.Name.First.Belt_4.Value,
|
||||
balanceEntry.Name.First.Belt_5.Value,
|
||||
masterKey1Scan, err := nc.WalletGetBalance(&nockchain.GetBalanceRequest{
|
||||
Selector: &nockchain.GetBalanceRequest_Address{
|
||||
Address: base58.Encode(masterKey1.PublicKey),
|
||||
},
|
||||
})
|
||||
lastName := crypto.Tip5HashToBase58([5]uint64{
|
||||
balanceEntry.Name.Last.Belt_1.Value,
|
||||
balanceEntry.Name.Last.Belt_2.Value,
|
||||
balanceEntry.Name.Last.Belt_3.Value,
|
||||
balanceEntry.Name.Last.Belt_4.Value,
|
||||
balanceEntry.Name.Last.Belt_5.Value,
|
||||
})
|
||||
nname := "[" + firstName + " " + lastName + "]"
|
||||
if nname == inputName {
|
||||
nnote := wallet.ParseBalanceEntry(balanceEntry)
|
||||
note = &nnote
|
||||
break
|
||||
}
|
||||
}
|
||||
assert.NotNil(t, note)
|
||||
|
||||
parentHash, err := wallet.HashNote(note)
|
||||
assert.NoError(t, err)
|
||||
fmt.Println("masterKey1Scan:", masterKey1Scan)
|
||||
assert.NotEmpty(t, masterKey1Scan.Notes)
|
||||
}
|
||||
|
||||
gift := uint64(100000)
|
||||
seed1 := &nockchain.NockchainSeed{
|
||||
OutputSource: nil,
|
||||
Recipient: &nockchain.NockchainLock{
|
||||
func TestEncodeNoun(t *testing.T) {
|
||||
lock1 := &nockchain.NockchainLock{
|
||||
KeysRequired: 1,
|
||||
Pubkeys: []string{base58.Encode(masterKey2.PublicKey)},
|
||||
},
|
||||
TimelockIntent: nil,
|
||||
Gift: gift,
|
||||
ParentHash: crypto.Tip5HashToBase58(parentHash),
|
||||
Pubkeys: []string{"5wef35rKxbJDJRAtzGG1VwbMQK9jF3Wr5e6fyMsh2hxnCQZDZJV1YNQ"},
|
||||
}
|
||||
|
||||
gift = note.Asset - gift - 100
|
||||
seed2 := &nockchain.NockchainSeed{
|
||||
OutputSource: nil,
|
||||
Recipient: &nockchain.NockchainLock{
|
||||
KeysRequired: 1,
|
||||
Pubkeys: []string{base58.Encode(masterKey1.PublicKey)},
|
||||
},
|
||||
TimelockIntent: nil,
|
||||
Gift: gift,
|
||||
ParentHash: crypto.Tip5HashToBase58(parentHash),
|
||||
lock1Encode := wallet.EncodeNoteData(lock1)
|
||||
assert.Equal(t, lock1Encode, []byte{89, 192, 131, 91, 67, 199, 5, 16, 32, 24, 199, 52, 39, 171, 121, 6, 15, 240, 167, 243, 69, 34, 254, 110, 4, 78, 3, 8, 44, 245, 128, 176, 69, 72, 150, 253, 6, 232, 167, 34, 133, 115, 154, 56, 106, 106, 192, 175, 176, 88, 89, 160, 208, 117, 55, 78, 5})
|
||||
|
||||
lock2 := lock1
|
||||
lock2.Pubkeys = []string{"7UXNF2HXzEaPUvLDVDgGJyriKqpd2974Kj7U2RnLuBPeRGa7ZezhGmK"}
|
||||
lock2Encode := wallet.EncodeNoteData(lock2)
|
||||
assert.Equal(t, lock2Encode, []byte{89, 192, 131, 91, 67, 199, 5, 248, 151, 186, 241, 213, 183, 156, 103, 181, 1, 254, 206, 33, 184, 3, 142, 3, 99, 101, 0, 1, 246, 168, 22, 252, 21, 155, 53, 205, 0, 2, 172, 67, 150, 149, 228, 139, 80, 206, 0, 1, 203, 54, 188, 141, 54, 21, 39, 193, 84})
|
||||
}
|
||||
|
||||
spend := nockchain.NockchainSpend{
|
||||
Signatures: nil,
|
||||
Seeds: []*nockchain.NockchainSeed{
|
||||
seed1, seed2,
|
||||
},
|
||||
Fee: 100,
|
||||
}
|
||||
// // This test should be run with timeout 120s
|
||||
// func TestFullFlow(t *testing.T) {
|
||||
// mnemonic1 := "rail nurse smile angle uphold gun kitten spoon quick frozen trigger cable decorate episode blame tray off bag arena taxi approve breeze job letter"
|
||||
// masterKey1, err := crypto.MasterKeyFromSeed(mnemonic1)
|
||||
// assert.NoError(t, err)
|
||||
// fmt.Println(base58.Encode(masterKey1.PublicKey))
|
||||
// mnemonic2 := "brass vacuum stairs hurt brisk govern describe enforce fly exact rescue capable belt flavor lottery sauce easy frame orange legal injury border obey novel"
|
||||
// masterKey2, err := crypto.MasterKeyFromSeed(mnemonic2)
|
||||
// assert.NoError(t, err)
|
||||
|
||||
msg, err := wallet.HashMsg(&spend)
|
||||
assert.NoError(t, err)
|
||||
// inputName := "[4taoqkpysafnp64WBQyzHDKVrqkMeNrdAiVSbWdzZmj7yQYZgQtCq4W 9cjUFbdtaFHeXNWCAKjsTphBchHmCoUU6a1aDbJAFz9qHqeG8osh4wF]"
|
||||
|
||||
chalT8, sigT8, err := wallet.ComputeSig(*masterKey1, msg)
|
||||
assert.NoError(t, err)
|
||||
// nc, err := wallet.NewNockchainClient("nockchain-api.zorp.io:443")
|
||||
// assert.NoError(t, err)
|
||||
|
||||
spend.Signatures = []*nockchain.NockchainSignature{
|
||||
{
|
||||
Pubkey: base58.Encode(masterKey1.PublicKey),
|
||||
Chal: chalT8[:],
|
||||
Sig: sigT8[:],
|
||||
},
|
||||
}
|
||||
// masterKeyScan, err := nc.WalletGetBalance(base58.Encode(masterKey1.PublicKey))
|
||||
// assert.NoError(t, err)
|
||||
|
||||
input := nockchain.NockchainInput{
|
||||
Name: &nockchain.NockchainName{
|
||||
First: "4taoqkpysafnp64WBQyzHDKVrqkMeNrdAiVSbWdzZmj7yQYZgQtCq4W",
|
||||
Last: "9cjUFbdtaFHeXNWCAKjsTphBchHmCoUU6a1aDbJAFz9qHqeG8osh4wF",
|
||||
},
|
||||
Note: note,
|
||||
Spend: &spend,
|
||||
}
|
||||
// var note *nockchain.NockchainNote
|
||||
// for _, balanceEntry := range masterKeyScan.Notes {
|
||||
// firstName := crypto.Tip5HashToBase58([5]uint64{
|
||||
// balanceEntry.Name.First.Belt_1.Value,
|
||||
// balanceEntry.Name.First.Belt_2.Value,
|
||||
// balanceEntry.Name.First.Belt_3.Value,
|
||||
// balanceEntry.Name.First.Belt_4.Value,
|
||||
// balanceEntry.Name.First.Belt_5.Value,
|
||||
// })
|
||||
// lastName := crypto.Tip5HashToBase58([5]uint64{
|
||||
// balanceEntry.Name.Last.Belt_1.Value,
|
||||
// balanceEntry.Name.Last.Belt_2.Value,
|
||||
// balanceEntry.Name.Last.Belt_3.Value,
|
||||
// balanceEntry.Name.Last.Belt_4.Value,
|
||||
// balanceEntry.Name.Last.Belt_5.Value,
|
||||
// })
|
||||
// nname := "[" + firstName + " " + lastName + "]"
|
||||
// if nname == inputName {
|
||||
// nnote := wallet.ParseBalanceEntry(balanceEntry)
|
||||
// note = &nnote
|
||||
// break
|
||||
// }
|
||||
// }
|
||||
// assert.NotNil(t, note)
|
||||
|
||||
id, err := wallet.ComputeTxId([]*nockchain.NockchainInput{&input}, &nockchain.TimelockRange{
|
||||
Min: nil,
|
||||
Max: nil,
|
||||
}, 100)
|
||||
assert.NoError(t, err)
|
||||
// parentHash, err := wallet.HashNote(note)
|
||||
// assert.NoError(t, err)
|
||||
|
||||
rawTx := nockchain.RawTx{
|
||||
TxId: crypto.Tip5HashToBase58(id),
|
||||
Inputs: []*nockchain.NockchainInput{&input},
|
||||
TimelockRange: &nockchain.TimelockRange{
|
||||
Min: nil,
|
||||
Max: nil,
|
||||
},
|
||||
TotalFees: 100,
|
||||
}
|
||||
resp, err := nc.WalletSendTransaction(&rawTx)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, resp.Result, &nockchain.WalletSendTransactionResponse_Ack{
|
||||
Ack: &nockchain.Acknowledged{},
|
||||
})
|
||||
// gift := uint64(100000)
|
||||
// seed1 := &nockchain.NockchainSeed{
|
||||
// OutputSource: nil,
|
||||
// Recipient: &nockchain.NockchainLock{
|
||||
// KeysRequired: 1,
|
||||
// Pubkeys: []string{base58.Encode(masterKey2.PublicKey)},
|
||||
// },
|
||||
// TimelockIntent: nil,
|
||||
// Gift: gift,
|
||||
// ParentHash: crypto.Tip5HashToBase58(parentHash),
|
||||
// }
|
||||
|
||||
txAcceptedResp, err := nc.TxAccepted(rawTx.TxId)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, txAcceptedResp.Result, &nockchain.TransactionAcceptedResponse_Accepted{
|
||||
Accepted: true,
|
||||
})
|
||||
}
|
||||
// gift = note.Asset - gift - 100
|
||||
// seed2 := &nockchain.NockchainSeed{
|
||||
// OutputSource: nil,
|
||||
// Recipient: &nockchain.NockchainLock{
|
||||
// KeysRequired: 1,
|
||||
// Pubkeys: []string{base58.Encode(masterKey1.PublicKey)},
|
||||
// },
|
||||
// TimelockIntent: nil,
|
||||
// Gift: gift,
|
||||
// ParentHash: crypto.Tip5HashToBase58(parentHash),
|
||||
// }
|
||||
|
||||
// spend := nockchain.NockchainSpend{
|
||||
// Signatures: nil,
|
||||
// Seeds: []*nockchain.NockchainSeed{
|
||||
// seed1, seed2,
|
||||
// },
|
||||
// Fee: 100,
|
||||
// }
|
||||
|
||||
// msg, err := wallet.HashMsg(&spend)
|
||||
// assert.NoError(t, err)
|
||||
|
||||
// chalT8, sigT8, err := wallet.ComputeSig(*masterKey1, msg)
|
||||
// assert.NoError(t, err)
|
||||
|
||||
// spend.Signatures = []*nockchain.NockchainSignature{
|
||||
// {
|
||||
// Pubkey: base58.Encode(masterKey1.PublicKey),
|
||||
// Chal: chalT8[:],
|
||||
// Sig: sigT8[:],
|
||||
// },
|
||||
// }
|
||||
|
||||
// input := nockchain.NockchainInput{
|
||||
// Name: &nockchain.NockchainName{
|
||||
// First: "4taoqkpysafnp64WBQyzHDKVrqkMeNrdAiVSbWdzZmj7yQYZgQtCq4W",
|
||||
// Last: "9cjUFbdtaFHeXNWCAKjsTphBchHmCoUU6a1aDbJAFz9qHqeG8osh4wF",
|
||||
// },
|
||||
// Note: note,
|
||||
// Spend: &spend,
|
||||
// }
|
||||
|
||||
// id, err := wallet.ComputeTxId([]*nockchain.NockchainInput{&input}, &nockchain.TimelockRange{
|
||||
// Min: nil,
|
||||
// Max: nil,
|
||||
// }, 100)
|
||||
// assert.NoError(t, err)
|
||||
|
||||
// rawTx := nockchain.RawTx{
|
||||
// TxId: crypto.Tip5HashToBase58(id),
|
||||
// Inputs: []*nockchain.NockchainInput{&input},
|
||||
// TimelockRange: &nockchain.TimelockRange{
|
||||
// Min: nil,
|
||||
// Max: nil,
|
||||
// },
|
||||
// TotalFees: 100,
|
||||
// }
|
||||
// resp, err := nc.WalletSendTransaction(&rawTx)
|
||||
// assert.NoError(t, err)
|
||||
// assert.Equal(t, resp.Result, &nockchain.WalletSendTransactionResponse_Ack{
|
||||
// Ack: &nockchain.Acknowledged{},
|
||||
// })
|
||||
|
||||
// txAcceptedResp, err := nc.TxAccepted(rawTx.TxId)
|
||||
// assert.NoError(t, err)
|
||||
// assert.Equal(t, txAcceptedResp.Result, &nockchain.TransactionAcceptedResponse_Accepted{
|
||||
// Accepted: true,
|
||||
// })
|
||||
// }
|
||||
|
||||
// This test should be run with timeout 300s
|
||||
func TestCreateTx(t *testing.T) {
|
||||
seed1 := "brass vacuum stairs hurt brisk govern describe enforce fly exact rescue capable belt flavor lottery sauce easy frame orange legal injury border obey novel"
|
||||
|
||||
seed1 := "rail nurse smile angle uphold gun kitten spoon quick frozen trigger cable decorate episode blame tray off bag arena taxi approve breeze job letter"
|
||||
masterKey1, err := crypto.MasterKeyFromSeed(seed1)
|
||||
assert.NoError(t, err)
|
||||
fmt.Println("masterKey1: ", base58.Encode(masterKey1.PublicKey))
|
||||
|
||||
// nockchain-wallet create-tx --names '[5bcr83LnCYyHqQh4ExK6metaf1cs7JYDqMYc92Awqhwc6VEpZJL9wj9 AmSjC3SDNtb7ZrUkTXc242BvGeimeL1nAV4CqV63HpLMryhom4L9W59],[5bcr83LnCYyHqQh4ExK6metaf1cs7JYDqMYc92Awqhwc6VEpZJL9wj9 7oo4x3fuwcJ5DrbFY1yf715ctjtE6CqqPagJWT8d687Q6sgMVWc1SXz],[5bcr83LnCYyHqQh4ExK6metaf1cs7JYDqMYc92Awqhwc6VEpZJL9wj9 8BrF9XAKwzvFdy8p7KAB8VEvcswPADhs2WamhWSLUErYN9z8U8cynaA]' --recipients '37Ttw4d6Fq1WGis5qVz8SbeEtpqsbg2ihArBedi4ZeuhFFo8tbCNvwWNq9D8KFBc2qv7uzvPJmKmJg68aEHEh21FiXk9iJCmzyE3NqdSgpsPMCx7Q39yhUUrKkKvGnHUKzMe,37Ttw4d6Fq1WGis5qVz8SbeEtpqsbg2ihArBedi4ZeuhFFo8tbCNvwWNq9D8KFBc2qv7uzvPJmKmJg68aEHEh21FiXk9iJCmzyE3NqdSgpsPMCx7Q39yhUUrKkKvGnHUKzMe,37Ttw4d6Fq1WGis5qVz8SbeEtpqsbg2ihArBedi4ZeuhFFo8tbCNvwWNq9D8KFBc2qv7uzvPJmKmJg68aEHEh21FiXk9iJCmzyE3NqdSgpsPMCx7Q39yhUUrKkKvGnHUKzMe' --gifts '50,50,50' --fee 100
|
||||
pkPoint1, err := crypto.CheetaPointFromBytes(masterKey1.PublicKey)
|
||||
assert.NoError(t, err)
|
||||
addr1 := wallet.HashPubkey(pkPoint1)
|
||||
// nockchain-wallet create-tx --names '[4taoqkpysafnp64WBQyzHDKVrqkMeNrdAiVSbWdzZmj7yQYZgQtCq4W 8yd685r3WhvRYsYWFy3LNQqSMMNwWyE3QZe5fqp1jgG3PWtLPvXdYvR]" --fee 1867776 --recipient "5wef35rKxbJDJRAtzGG1VwbMQK9jF3Wr5e6fyMsh2hxnCQZDZJV1YNQ:2000000" --refund-pkh 7UXNF2HXzEaPUvLDVDgGJyriKqpd2974Kj7U2RnLuBPeRGa7ZezhGmK
|
||||
|
||||
seed2 := "chimney endorse scan ramp cheap harvest mother ball winter way barrel foil tissue pupil answer worth right undo one chimney element grape image unlock"
|
||||
seed2 := "anchor various pair jazz panel rubber virus address achieve opinion end silent runway bus wolf pony cigar nuclear moral mixed gold window timber member"
|
||||
masterKey2, err := crypto.MasterKeyFromSeed(seed2)
|
||||
assert.NoError(t, err)
|
||||
fmt.Println("masterKey2", base58.Encode(masterKey2.PublicKey))
|
||||
@ -588,27 +599,30 @@ func TestCreateTx(t *testing.T) {
|
||||
assert.NoError(t, err)
|
||||
handler := wallet.NewGprcHandler(*nc)
|
||||
|
||||
inputs := "[5bcr83LnCYyHqQh4ExK6metaf1cs7JYDqMYc92Awqhwc6VEpZJL9wj9 AmSjC3SDNtb7ZrUkTXc242BvGeimeL1nAV4CqV63HpLMryhom4L9W59],[5bcr83LnCYyHqQh4ExK6metaf1cs7JYDqMYc92Awqhwc6VEpZJL9wj9 7oo4x3fuwcJ5DrbFY1yf715ctjtE6CqqPagJWT8d687Q6sgMVWc1SXz],[5bcr83LnCYyHqQh4ExK6metaf1cs7JYDqMYc92Awqhwc6VEpZJL9wj9 8BrF9XAKwzvFdy8p7KAB8VEvcswPADhs2WamhWSLUErYN9z8U8cynaA]"
|
||||
recipients := fmt.Sprintf("%s,%s,%s", base58.Encode(masterKey2.PublicKey), base58.Encode(masterKey2.PublicKey), base58.Encode(masterKey2.PublicKey))
|
||||
gifts := "50,50,50"
|
||||
fee := 100
|
||||
inputs := "[4taoqkpysafnp64WBQyzHDKVrqkMeNrdAiVSbWdzZmj7yQYZgQtCq4W 8yd685r3WhvRYsYWFy3LNQqSMMNwWyE3QZe5fqp1jgG3PWtLPvXdYvR]"
|
||||
|
||||
pkPoint2, err := crypto.CheetaPointFromBytes(masterKey2.PublicKey)
|
||||
assert.NoError(t, err)
|
||||
addr2 := wallet.HashPubkey(pkPoint2)
|
||||
|
||||
recipients := fmt.Sprintf("%s:2000000", crypto.Tip5HashToBase58(addr2))
|
||||
fee := 1867776 // min fee
|
||||
|
||||
req := &nockchain.CreateTxRequest{
|
||||
Names: inputs,
|
||||
Recipients: recipients,
|
||||
Gifts: gifts,
|
||||
Fee: uint64(fee),
|
||||
IsMasterKey: true,
|
||||
Key: base58.Encode(masterKey1.PrivateKey),
|
||||
ChainCode: base58.Encode(masterKey1.ChainCode),
|
||||
Seed: seed1,
|
||||
Index: 0,
|
||||
Hardened: false,
|
||||
TimelockIntent: nil,
|
||||
Version: 0,
|
||||
RefundAddress: crypto.Tip5HashToBase58(addr1),
|
||||
}
|
||||
|
||||
res, err := handler.CreateTx(context.Background(), req)
|
||||
assert.NoError(t, err)
|
||||
|
||||
// the result is taken from create-tx scripts
|
||||
assert.Equal(t, res.RawTx.TxId, "A8vSeRde61B4sZccSnNPEnkQgTe15EssoFwyhQXbkhtk4UNm5hyGSid")
|
||||
assert.Equal(t, res.RawTx.TxId, "6oDgTWnk6sL98yK49hcQTRAfCdFfgKh58U6TDTKmGPirhoxkMii2D6E")
|
||||
}
|
||||
|
||||
183
wallet/types.go
183
wallet/types.go
@ -1,15 +1,20 @@
|
||||
package wallet
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/btcsuite/btcd/btcutil/base58"
|
||||
"github.com/phamminh0811/private-grpc/crypto"
|
||||
"github.com/phamminh0811/private-grpc/nockchain"
|
||||
)
|
||||
|
||||
func ParseBalanceEntry(entry *nockchain.BalanceEntry) nockchain.NockchainNote {
|
||||
version := nockchain.Version(entry.Note.Version.Value)
|
||||
switch entry.Note.NoteVersion.(type) {
|
||||
case *nockchain.Note_Legacy:
|
||||
note := entry.Note.GetLegacy()
|
||||
version := nockchain.Version(note.Version.Value)
|
||||
pubkeys := []string{}
|
||||
for _, pk := range entry.Note.Lock.SchnorrPubkeys {
|
||||
for _, pk := range note.Lock.SchnorrPubkeys {
|
||||
pkPoint := crypto.CheetahPoint{
|
||||
X: [6]crypto.Belt{
|
||||
{Value: pk.Value.X.Belt_1.Value},
|
||||
@ -33,18 +38,18 @@ func ParseBalanceEntry(entry *nockchain.BalanceEntry) nockchain.NockchainNote {
|
||||
pkStr := base58.Encode(pkPoint.Bytes())
|
||||
pubkeys = append(pubkeys, pkStr)
|
||||
}
|
||||
|
||||
sourceHash := [5]uint64{
|
||||
entry.Note.Source.Hash.Belt_1.Value,
|
||||
entry.Note.Source.Hash.Belt_2.Value,
|
||||
entry.Note.Source.Hash.Belt_3.Value,
|
||||
entry.Note.Source.Hash.Belt_4.Value,
|
||||
entry.Note.Source.Hash.Belt_5.Value,
|
||||
note.Source.Hash.Belt_1.Value,
|
||||
note.Source.Hash.Belt_2.Value,
|
||||
note.Source.Hash.Belt_3.Value,
|
||||
note.Source.Hash.Belt_4.Value,
|
||||
note.Source.Hash.Belt_5.Value,
|
||||
}
|
||||
return nockchain.NockchainNote{
|
||||
Note: &nockchain.NockchainNote_V0{
|
||||
V0: &nockchain.NockchainNoteV0{
|
||||
Version: version,
|
||||
BlockHeight: entry.Note.OriginPage.Value,
|
||||
Timelock: ParseTimelockIntent(entry.Note.Timelock),
|
||||
OriginPage: note.OriginPage.Value,
|
||||
Name: &nockchain.NockchainName{
|
||||
First: crypto.Tip5HashToBase58([5]uint64{
|
||||
entry.Name.First.Belt_1.Value,
|
||||
@ -62,127 +67,99 @@ func ParseBalanceEntry(entry *nockchain.BalanceEntry) nockchain.NockchainNote {
|
||||
}),
|
||||
},
|
||||
Lock: &nockchain.NockchainLock{
|
||||
KeysRequired: uint64(entry.Note.Lock.KeysRequired),
|
||||
KeysRequired: uint64(note.Lock.KeysRequired),
|
||||
Pubkeys: pubkeys,
|
||||
},
|
||||
Source: &nockchain.NockchainSource{
|
||||
Source: crypto.Tip5HashToBase58(sourceHash),
|
||||
IsCoinbase: entry.Note.Source.Coinbase,
|
||||
IsCoinbase: note.Source.Coinbase,
|
||||
},
|
||||
Asset: entry.Note.Assets.Value,
|
||||
}
|
||||
}
|
||||
|
||||
func ConvertRawTx(rawTx *nockchain.RawTx) nockchain.RawTransaction {
|
||||
id := crypto.Base58ToTip5Hash(rawTx.TxId)
|
||||
|
||||
var timelockRange *nockchain.TimeLockRangeAbsolute
|
||||
if rawTx.TimelockRange != nil {
|
||||
timelockRange = &nockchain.TimeLockRangeAbsolute{
|
||||
Min: (*nockchain.BlockHeight)(rawTx.TimelockRange.Min),
|
||||
Max: (*nockchain.BlockHeight)(rawTx.TimelockRange.Max),
|
||||
}
|
||||
}
|
||||
|
||||
return nockchain.RawTransaction{
|
||||
Id: &nockchain.Hash{
|
||||
Belt_1: &nockchain.Belt{Value: id[0]},
|
||||
Belt_2: &nockchain.Belt{Value: id[1]},
|
||||
Belt_3: &nockchain.Belt{Value: id[2]},
|
||||
Belt_4: &nockchain.Belt{Value: id[3]},
|
||||
Belt_5: &nockchain.Belt{Value: id[4]},
|
||||
Asset: note.Assets.Value,
|
||||
},
|
||||
TimelockRange: timelockRange,
|
||||
TotalFees: &nockchain.Nicks{
|
||||
Value: rawTx.TotalFees,
|
||||
},
|
||||
}
|
||||
case *nockchain.Note_V1:
|
||||
fmt.Println("go here???")
|
||||
// Handle V1 notes if needed
|
||||
return nockchain.NockchainNote{
|
||||
Note: &nockchain.NockchainNote_V1{
|
||||
V1: &nockchain.NockchainNoteV1{},
|
||||
},
|
||||
}
|
||||
default:
|
||||
return nockchain.NockchainNote{}
|
||||
}
|
||||
}
|
||||
|
||||
func ConvertInput(input *nockchain.NockchainInput) (*nockchain.NamedInput, error) {
|
||||
pks := []*nockchain.SchnorrPubkey{}
|
||||
|
||||
for _, i := range input.Note.Lock.Pubkeys {
|
||||
pk, err := ParseSchnorrPubkey(i)
|
||||
func ConvertNamedSpend(spend *nockchain.NockchainNamedSpend) (*nockchain.SpendEntry, error) {
|
||||
convertedSpend := &nockchain.Spend{}
|
||||
switch spend.SpendKind.(type) {
|
||||
case *nockchain.NockchainNamedSpend_Legacy:
|
||||
legacySpend := spend.GetLegacy()
|
||||
signature, err := ConvertSignatures(legacySpend.Signatures)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
pks = append(pks, pk)
|
||||
}
|
||||
seeds := []*nockchain.Seed{}
|
||||
for _, seed := range input.Spend.Seeds {
|
||||
seedPks := []*nockchain.SchnorrPubkey{}
|
||||
|
||||
for _, i := range seed.Recipient.Pubkeys {
|
||||
pk, err := ParseSchnorrPubkey(i)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
seedPks = append(seedPks, pk)
|
||||
}
|
||||
var source *nockchain.OutputSource
|
||||
if seed.OutputSource != nil {
|
||||
source = &nockchain.OutputSource{
|
||||
Source: &nockchain.Source{
|
||||
Hash: ParseHash(seed.OutputSource.Source),
|
||||
Coinbase: input.Note.Source.IsCoinbase,
|
||||
},
|
||||
}
|
||||
}
|
||||
for _, seed := range legacySpend.Seeds {
|
||||
seeds = append(seeds, &nockchain.Seed{
|
||||
OutputSource: source,
|
||||
Recipient: &nockchain.Lock{
|
||||
KeysRequired: uint32(seed.Recipient.KeysRequired),
|
||||
SchnorrPubkeys: seedPks,
|
||||
OutputSource: &nockchain.Source{
|
||||
Hash: ParseHash(seed.OutputSource.Source),
|
||||
Coinbase: seed.OutputSource.IsCoinbase,
|
||||
},
|
||||
LockRoot: ParseHash(seed.LockRoot),
|
||||
NoteData: &nockchain.NoteData{
|
||||
Entries: []*nockchain.NoteDataEntry{
|
||||
{
|
||||
Key: "lock",
|
||||
Blob: EncodeNoteData(seed.NoteData),
|
||||
},
|
||||
},
|
||||
},
|
||||
Gift: &nockchain.Nicks{
|
||||
Value: seed.Gift,
|
||||
},
|
||||
TimelockIntent: ConvertTimelockIntent(seed.TimelockIntent),
|
||||
Gift: &nockchain.Nicks{Value: seed.Gift},
|
||||
ParentHash: ParseHash(seed.ParentHash),
|
||||
})
|
||||
}
|
||||
convertedSpend = &nockchain.Spend{
|
||||
SpendKind: &nockchain.Spend_Legacy{
|
||||
Legacy: &nockchain.LegacySpend{
|
||||
Signature: signature,
|
||||
Seeds: seeds,
|
||||
MinerFeeNicks: &nockchain.Nicks{
|
||||
Value: legacySpend.Fee,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
case *nockchain.NockchainNamedSpend_Witness:
|
||||
// TODO: handle v1
|
||||
}
|
||||
// Conversion logic here
|
||||
return &nockchain.SpendEntry{
|
||||
Name: ConvertName(spend.Name),
|
||||
Spend: convertedSpend,
|
||||
}, nil
|
||||
}
|
||||
|
||||
sigEntries := []*nockchain.SignatureEntry{}
|
||||
for _, sig := range input.Spend.Signatures {
|
||||
pk, err := ParseSchnorrPubkey(sig.Pubkey)
|
||||
func ConvertSignatures(signatures []*nockchain.NockchainSignature) (*nockchain.Signature, error) {
|
||||
entries := make([]*nockchain.SignatureEntry, len(signatures))
|
||||
for i, sig := range signatures {
|
||||
pubkey, err := ParseSchnorrPubkey(sig.Pubkey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
sigEntries = append(sigEntries, &nockchain.SignatureEntry{
|
||||
SchnorrPubkey: pk,
|
||||
entries[i] = &nockchain.SignatureEntry{
|
||||
SchnorrPubkey: pubkey,
|
||||
Signature: &nockchain.SchnorrSignature{
|
||||
Chal: ParseEightBelt(sig.Chal),
|
||||
Sig: ParseEightBelt(sig.Sig),
|
||||
},
|
||||
})
|
||||
}
|
||||
return &nockchain.NamedInput{
|
||||
Name: ConvertName(input.Name),
|
||||
Input: &nockchain.Input{
|
||||
Note: &nockchain.Note{
|
||||
OriginPage: &nockchain.BlockHeight{
|
||||
Value: input.Note.BlockHeight,
|
||||
},
|
||||
Timelock: ConvertTimelockIntent(input.Note.Timelock),
|
||||
Name: ConvertName(input.Name),
|
||||
Lock: &nockchain.Lock{
|
||||
KeysRequired: uint32(input.Note.Lock.KeysRequired),
|
||||
SchnorrPubkeys: pks,
|
||||
},
|
||||
Source: &nockchain.Source{
|
||||
Hash: ParseHash(input.Note.Source.Source),
|
||||
Coinbase: input.Note.Source.IsCoinbase,
|
||||
},
|
||||
Assets: &nockchain.Nicks{Value: input.Note.Asset},
|
||||
Version: &nockchain.NoteVersion{Value: uint32(input.Note.Version)},
|
||||
},
|
||||
Spend: &nockchain.Spend{
|
||||
Signature: &nockchain.Signature{
|
||||
Entries: sigEntries,
|
||||
},
|
||||
Seeds: seeds,
|
||||
MinerFeeNicks: &nockchain.Nicks{Value: input.Spend.Fee},
|
||||
},
|
||||
},
|
||||
}
|
||||
return &nockchain.Signature{
|
||||
Entries: entries,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user