Compare commits
8 Commits
bade30ba1a
...
3a9d132f8d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3a9d132f8d | ||
|
|
898b542e54 | ||
| 16e47129f4 | |||
|
|
828628d82f | ||
|
|
2d9185a5ec | ||
| 2816e5333b | |||
|
|
262f7d3bc0 | ||
|
|
f91d39b943 |
@ -17,10 +17,13 @@ var (
|
|||||||
PublicKeyStart = []byte{12, 14, 187, 9}
|
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}
|
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}
|
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}
|
Tip5Zero = [5]uint64{1730770831742798981, 2676322185709933211, 8329210750824781744, 16756092452590401876, 3547445316740171466}
|
||||||
Tip5One = [5]uint64{6727110957294540849, 15606243244732609007, 11887284596344881785, 10646863421881571398, 8146872807338919620}
|
Tip5One = [5]uint64{6727110957294540849, 15606243244732609007, 11887284596344881785, 10646863421881571398, 8146872807338919620}
|
||||||
Tip5ZeroZero = [5]uint64{4372149332062030091, 17876920912185183887, 13348798570422431948, 8872865212694716527, 3385176510443841516}
|
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 {
|
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}
|
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 {
|
func Tip5HashBelts(input []Belt) [5]uint64 {
|
||||||
inputLen := len(input)
|
inputLen := len(input)
|
||||||
q := inputLen / RATE
|
q := inputLen / RATE
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -26,12 +26,17 @@ const (
|
|||||||
type WalletGetBalanceRequest struct {
|
type WalletGetBalanceRequest struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
// pubkey cheetah point; specific address, or current wallet
|
// 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
|
// Pagination parameters. The server enforces limits and may return fewer
|
||||||
// entries than requested to respect message size and policy. For consistent
|
// entries than requested to respect message size and policy. For consistent
|
||||||
// paging across a stable snapshot, pass along the returned page_token from
|
// paging across a stable snapshot, pass along the returned page_token from
|
||||||
// the previous response without modification.
|
// 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
|
unknownFields protoimpl.UnknownFields
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
@ -66,11 +71,29 @@ func (*WalletGetBalanceRequest) Descriptor() ([]byte, []int) {
|
|||||||
return file_nockchain_proto_rawDescGZIP(), []int{0}
|
return file_nockchain_proto_rawDescGZIP(), []int{0}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *WalletGetBalanceRequest) GetAddress() string {
|
func (x *WalletGetBalanceRequest) GetSelector() isWalletGetBalanceRequest_Selector {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Address
|
return x.Selector
|
||||||
}
|
}
|
||||||
return ""
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *WalletGetBalanceRequest) GetAddress() *Base58Pubkey {
|
||||||
|
if x != nil {
|
||||||
|
if x, ok := x.Selector.(*WalletGetBalanceRequest_Address); ok {
|
||||||
|
return x.Address
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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 {
|
func (x *WalletGetBalanceRequest) GetPage() *PageRequest {
|
||||||
@ -80,6 +103,22 @@ func (x *WalletGetBalanceRequest) GetPage() *PageRequest {
|
|||||||
return nil
|
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 {
|
type WalletGetBalanceResponse struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
// Types that are valid to be assigned to Result:
|
// Types that are valid to be assigned to Result:
|
||||||
@ -128,7 +167,7 @@ func (x *WalletGetBalanceResponse) GetResult() isWalletGetBalanceResponse_Result
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *WalletGetBalanceResponse) GetBalance() *WalletBalanceData {
|
func (x *WalletGetBalanceResponse) GetBalance() *Balance {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
if x, ok := x.Result.(*WalletGetBalanceResponse_Balance); ok {
|
if x, ok := x.Result.(*WalletGetBalanceResponse_Balance); ok {
|
||||||
return x.Balance
|
return x.Balance
|
||||||
@ -155,7 +194,7 @@ type WalletGetBalanceResponse_Balance struct {
|
|||||||
// Continue paging using `balance.page.next_page_token` until empty. Clients
|
// Continue paging using `balance.page.next_page_token` until empty. Clients
|
||||||
// should treat the page token as opaque; it may encode snapshot identity
|
// should treat the page token as opaque; it may encode snapshot identity
|
||||||
// and the last returned key.
|
// 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 {
|
type WalletGetBalanceResponse_Error struct {
|
||||||
@ -437,31 +476,35 @@ var File_nockchain_proto protoreflect.FileDescriptor
|
|||||||
|
|
||||||
const file_nockchain_proto_rawDesc = "" +
|
const file_nockchain_proto_rawDesc = "" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"\x0fnockchain.proto\x12\x13nockchain.public.v1\x1a\x10blockchain.proto\x1a\x10primitives.proto\x1a\x10pagination.proto\"i\n" +
|
"\x0fnockchain.proto\x12\x13nockchain.public.v2\x1a\x10blockchain.proto\x1a\x10primitives.proto\x1a\x10pagination.proto\"\xdc\x01\n" +
|
||||||
"\x17WalletGetBalanceRequest\x12\x18\n" +
|
"\x17WalletGetBalanceRequest\x12=\n" +
|
||||||
"\aaddress\x18\x01 \x01(\tR\aaddress\x124\n" +
|
"\aaddress\x18\x01 \x01(\v2!.nockchain.public.v2.Base58PubkeyH\x00R\aaddress\x12@\n" +
|
||||||
"\x04page\x18\x02 \x01(\v2 .nockchain.public.v1.PageRequestR\x04page\"\xa2\x01\n" +
|
"\n" +
|
||||||
"\x18WalletGetBalanceResponse\x12B\n" +
|
"first_name\x18\x02 \x01(\v2\x1f.nockchain.public.v2.Base58HashH\x00R\tfirstName\x124\n" +
|
||||||
"\abalance\x18\x01 \x01(\v2&.nockchain.public.v1.WalletBalanceDataH\x00R\abalance\x128\n" +
|
"\x04page\x18\x03 \x01(\v2 .nockchain.public.v2.PageRequestR\x04pageB\n" +
|
||||||
"\x05error\x18\x02 \x01(\v2 .nockchain.public.v1.ErrorStatusH\x00R\x05errorB\b\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" +
|
"\x06result\"\x8a\x01\n" +
|
||||||
"\x1cWalletSendTransactionRequest\x12.\n" +
|
"\x1cWalletSendTransactionRequest\x12.\n" +
|
||||||
"\x05tx_id\x18\x01 \x01(\v2\x19.nockchain.public.v1.HashR\x04txId\x12:\n" +
|
"\x05tx_id\x18\x01 \x01(\v2\x19.nockchain.public.v2.HashR\x04txId\x12:\n" +
|
||||||
"\x06raw_tx\x18\x02 \x01(\v2#.nockchain.public.v1.RawTransactionR\x05rawTx\"\x9a\x01\n" +
|
"\x06raw_tx\x18\x02 \x01(\v2#.nockchain.public.v2.RawTransactionR\x05rawTx\"\x9a\x01\n" +
|
||||||
"\x1dWalletSendTransactionResponse\x125\n" +
|
"\x1dWalletSendTransactionResponse\x125\n" +
|
||||||
"\x03ack\x18\x01 \x01(\v2!.nockchain.public.v1.AcknowledgedH\x00R\x03ack\x128\n" +
|
"\x03ack\x18\x01 \x01(\v2!.nockchain.public.v2.AcknowledgedH\x00R\x03ack\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" +
|
||||||
"\x06result\"R\n" +
|
"\x06result\"R\n" +
|
||||||
"\x1aTransactionAcceptedRequest\x124\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" +
|
"\x1bTransactionAcceptedResponse\x12\x1c\n" +
|
||||||
"\baccepted\x18\x01 \x01(\bH\x00R\baccepted\x128\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" +
|
"\x06result2\xfd\x02\n" +
|
||||||
"\x10NockchainService\x12o\n" +
|
"\x10NockchainService\x12o\n" +
|
||||||
"\x10WalletGetBalance\x12,.nockchain.public.v1.WalletGetBalanceRequest\x1a-.nockchain.public.v1.WalletGetBalanceResponse\x12~\n" +
|
"\x10WalletGetBalance\x12,.nockchain.public.v2.WalletGetBalanceRequest\x1a-.nockchain.public.v2.WalletGetBalanceResponse\x12~\n" +
|
||||||
"\x15WalletSendTransaction\x121.nockchain.public.v1.WalletSendTransactionRequest\x1a2.nockchain.public.v1.WalletSendTransactionResponse\x12x\n" +
|
"\x15WalletSendTransaction\x121.nockchain.public.v2.WalletSendTransactionRequest\x1a2.nockchain.public.v2.WalletSendTransactionResponse\x12x\n" +
|
||||||
"\x13TransactionAccepted\x12/.nockchain.public.v1.TransactionAcceptedRequest\x1a0.nockchain.public.v1.TransactionAcceptedResponseB\x0eZ\f./;nockchainb\x06proto3"
|
"\x13TransactionAccepted\x12/.nockchain.public.v2.TransactionAcceptedRequest\x1a0.nockchain.public.v2.TransactionAcceptedResponseB\x0eZ\f./;nockchainb\x06proto3"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_nockchain_proto_rawDescOnce sync.Once
|
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_msgTypes = make([]protoimpl.MessageInfo, 6)
|
||||||
var file_nockchain_proto_goTypes = []any{
|
var file_nockchain_proto_goTypes = []any{
|
||||||
(*WalletGetBalanceRequest)(nil), // 0: nockchain.public.v1.WalletGetBalanceRequest
|
(*WalletGetBalanceRequest)(nil), // 0: nockchain.public.v2.WalletGetBalanceRequest
|
||||||
(*WalletGetBalanceResponse)(nil), // 1: nockchain.public.v1.WalletGetBalanceResponse
|
(*WalletGetBalanceResponse)(nil), // 1: nockchain.public.v2.WalletGetBalanceResponse
|
||||||
(*WalletSendTransactionRequest)(nil), // 2: nockchain.public.v1.WalletSendTransactionRequest
|
(*WalletSendTransactionRequest)(nil), // 2: nockchain.public.v2.WalletSendTransactionRequest
|
||||||
(*WalletSendTransactionResponse)(nil), // 3: nockchain.public.v1.WalletSendTransactionResponse
|
(*WalletSendTransactionResponse)(nil), // 3: nockchain.public.v2.WalletSendTransactionResponse
|
||||||
(*TransactionAcceptedRequest)(nil), // 4: nockchain.public.v1.TransactionAcceptedRequest
|
(*TransactionAcceptedRequest)(nil), // 4: nockchain.public.v2.TransactionAcceptedRequest
|
||||||
(*TransactionAcceptedResponse)(nil), // 5: nockchain.public.v1.TransactionAcceptedResponse
|
(*TransactionAcceptedResponse)(nil), // 5: nockchain.public.v2.TransactionAcceptedResponse
|
||||||
(*PageRequest)(nil), // 6: nockchain.public.v1.PageRequest
|
(*Base58Pubkey)(nil), // 6: nockchain.public.v2.Base58Pubkey
|
||||||
(*WalletBalanceData)(nil), // 7: nockchain.public.v1.WalletBalanceData
|
(*Base58Hash)(nil), // 7: nockchain.public.v2.Base58Hash
|
||||||
(*ErrorStatus)(nil), // 8: nockchain.public.v1.ErrorStatus
|
(*PageRequest)(nil), // 8: nockchain.public.v2.PageRequest
|
||||||
(*Hash)(nil), // 9: nockchain.public.v1.Hash
|
(*Balance)(nil), // 9: nockchain.public.v2.Balance
|
||||||
(*RawTransaction)(nil), // 10: nockchain.public.v1.RawTransaction
|
(*ErrorStatus)(nil), // 10: nockchain.public.v2.ErrorStatus
|
||||||
(*Acknowledged)(nil), // 11: nockchain.public.v1.Acknowledged
|
(*Hash)(nil), // 11: nockchain.public.v2.Hash
|
||||||
(*Base58Hash)(nil), // 12: nockchain.public.v1.Base58Hash
|
(*RawTransaction)(nil), // 12: nockchain.public.v2.RawTransaction
|
||||||
|
(*Acknowledged)(nil), // 13: nockchain.public.v2.Acknowledged
|
||||||
}
|
}
|
||||||
var file_nockchain_proto_depIdxs = []int32{
|
var file_nockchain_proto_depIdxs = []int32{
|
||||||
6, // 0: nockchain.public.v1.WalletGetBalanceRequest.page:type_name -> nockchain.public.v1.PageRequest
|
6, // 0: nockchain.public.v2.WalletGetBalanceRequest.address:type_name -> nockchain.public.v2.Base58Pubkey
|
||||||
7, // 1: nockchain.public.v1.WalletGetBalanceResponse.balance:type_name -> nockchain.public.v1.WalletBalanceData
|
7, // 1: nockchain.public.v2.WalletGetBalanceRequest.first_name:type_name -> nockchain.public.v2.Base58Hash
|
||||||
8, // 2: nockchain.public.v1.WalletGetBalanceResponse.error:type_name -> nockchain.public.v1.ErrorStatus
|
8, // 2: nockchain.public.v2.WalletGetBalanceRequest.page:type_name -> nockchain.public.v2.PageRequest
|
||||||
9, // 3: nockchain.public.v1.WalletSendTransactionRequest.tx_id:type_name -> nockchain.public.v1.Hash
|
9, // 3: nockchain.public.v2.WalletGetBalanceResponse.balance:type_name -> nockchain.public.v2.Balance
|
||||||
10, // 4: nockchain.public.v1.WalletSendTransactionRequest.raw_tx:type_name -> nockchain.public.v1.RawTransaction
|
10, // 4: nockchain.public.v2.WalletGetBalanceResponse.error:type_name -> nockchain.public.v2.ErrorStatus
|
||||||
11, // 5: nockchain.public.v1.WalletSendTransactionResponse.ack:type_name -> nockchain.public.v1.Acknowledged
|
11, // 5: nockchain.public.v2.WalletSendTransactionRequest.tx_id:type_name -> nockchain.public.v2.Hash
|
||||||
8, // 6: nockchain.public.v1.WalletSendTransactionResponse.error:type_name -> nockchain.public.v1.ErrorStatus
|
12, // 6: nockchain.public.v2.WalletSendTransactionRequest.raw_tx:type_name -> nockchain.public.v2.RawTransaction
|
||||||
12, // 7: nockchain.public.v1.TransactionAcceptedRequest.tx_id:type_name -> nockchain.public.v1.Base58Hash
|
13, // 7: nockchain.public.v2.WalletSendTransactionResponse.ack:type_name -> nockchain.public.v2.Acknowledged
|
||||||
8, // 8: nockchain.public.v1.TransactionAcceptedResponse.error:type_name -> nockchain.public.v1.ErrorStatus
|
10, // 8: nockchain.public.v2.WalletSendTransactionResponse.error:type_name -> nockchain.public.v2.ErrorStatus
|
||||||
0, // 9: nockchain.public.v1.NockchainService.WalletGetBalance:input_type -> nockchain.public.v1.WalletGetBalanceRequest
|
7, // 9: nockchain.public.v2.TransactionAcceptedRequest.tx_id:type_name -> nockchain.public.v2.Base58Hash
|
||||||
2, // 10: nockchain.public.v1.NockchainService.WalletSendTransaction:input_type -> nockchain.public.v1.WalletSendTransactionRequest
|
10, // 10: nockchain.public.v2.TransactionAcceptedResponse.error:type_name -> nockchain.public.v2.ErrorStatus
|
||||||
4, // 11: nockchain.public.v1.NockchainService.TransactionAccepted:input_type -> nockchain.public.v1.TransactionAcceptedRequest
|
0, // 11: nockchain.public.v2.NockchainService.WalletGetBalance:input_type -> nockchain.public.v2.WalletGetBalanceRequest
|
||||||
1, // 12: nockchain.public.v1.NockchainService.WalletGetBalance:output_type -> nockchain.public.v1.WalletGetBalanceResponse
|
2, // 12: nockchain.public.v2.NockchainService.WalletSendTransaction:input_type -> nockchain.public.v2.WalletSendTransactionRequest
|
||||||
3, // 13: nockchain.public.v1.NockchainService.WalletSendTransaction:output_type -> nockchain.public.v1.WalletSendTransactionResponse
|
4, // 13: nockchain.public.v2.NockchainService.TransactionAccepted:input_type -> nockchain.public.v2.TransactionAcceptedRequest
|
||||||
5, // 14: nockchain.public.v1.NockchainService.TransactionAccepted:output_type -> nockchain.public.v1.TransactionAcceptedResponse
|
1, // 14: nockchain.public.v2.NockchainService.WalletGetBalance:output_type -> nockchain.public.v2.WalletGetBalanceResponse
|
||||||
12, // [12:15] is the sub-list for method output_type
|
3, // 15: nockchain.public.v2.NockchainService.WalletSendTransaction:output_type -> nockchain.public.v2.WalletSendTransactionResponse
|
||||||
9, // [9:12] is the sub-list for method input_type
|
5, // 16: nockchain.public.v2.NockchainService.TransactionAccepted:output_type -> nockchain.public.v2.TransactionAcceptedResponse
|
||||||
9, // [9:9] is the sub-list for extension type_name
|
14, // [14:17] is the sub-list for method output_type
|
||||||
9, // [9:9] is the sub-list for extension extendee
|
11, // [11:14] is the sub-list for method input_type
|
||||||
0, // [0:9] is the sub-list for field type_name
|
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() }
|
func init() { file_nockchain_proto_init() }
|
||||||
@ -522,6 +568,10 @@ func file_nockchain_proto_init() {
|
|||||||
file_blockchain_proto_init()
|
file_blockchain_proto_init()
|
||||||
file_primitives_proto_init()
|
file_primitives_proto_init()
|
||||||
file_pagination_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{
|
file_nockchain_proto_msgTypes[1].OneofWrappers = []any{
|
||||||
(*WalletGetBalanceResponse_Balance)(nil),
|
(*WalletGetBalanceResponse_Balance)(nil),
|
||||||
(*WalletGetBalanceResponse_Error)(nil),
|
(*WalletGetBalanceResponse_Error)(nil),
|
||||||
|
|||||||
@ -21,9 +21,9 @@ import (
|
|||||||
const _ = grpc.SupportPackageIsVersion9
|
const _ = grpc.SupportPackageIsVersion9
|
||||||
|
|
||||||
const (
|
const (
|
||||||
NockchainService_WalletGetBalance_FullMethodName = "/nockchain.public.v1.NockchainService/WalletGetBalance"
|
NockchainService_WalletGetBalance_FullMethodName = "/nockchain.public.v2.NockchainService/WalletGetBalance"
|
||||||
NockchainService_WalletSendTransaction_FullMethodName = "/nockchain.public.v1.NockchainService/WalletSendTransaction"
|
NockchainService_WalletSendTransaction_FullMethodName = "/nockchain.public.v2.NockchainService/WalletSendTransaction"
|
||||||
NockchainService_TransactionAccepted_FullMethodName = "/nockchain.public.v1.NockchainService/TransactionAccepted"
|
NockchainService_TransactionAccepted_FullMethodName = "/nockchain.public.v2.NockchainService/TransactionAccepted"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NockchainServiceClient is the client API for NockchainService service.
|
// 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,
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
// and not to be introspected or modified (even as a copy)
|
// and not to be introspected or modified (even as a copy)
|
||||||
var NockchainService_ServiceDesc = grpc.ServiceDesc{
|
var NockchainService_ServiceDesc = grpc.ServiceDesc{
|
||||||
ServiceName: "nockchain.public.v1.NockchainService",
|
ServiceName: "nockchain.public.v2.NockchainService",
|
||||||
HandlerType: (*NockchainServiceServer)(nil),
|
HandlerType: (*NockchainServiceServer)(nil),
|
||||||
Methods: []grpc.MethodDesc{
|
Methods: []grpc.MethodDesc{
|
||||||
{
|
{
|
||||||
|
|||||||
@ -152,7 +152,7 @@ var File_pagination_proto protoreflect.FileDescriptor
|
|||||||
|
|
||||||
const file_pagination_proto_rawDesc = "" +
|
const file_pagination_proto_rawDesc = "" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"\x10pagination.proto\x12\x13nockchain.public.v1\"\x80\x01\n" +
|
"\x10pagination.proto\x12\x13nockchain.public.v2\"\x80\x01\n" +
|
||||||
"\vPageRequest\x125\n" +
|
"\vPageRequest\x125\n" +
|
||||||
"\x17client_page_items_limit\x18\x01 \x01(\rR\x14clientPageItemsLimit\x12\x1d\n" +
|
"\x17client_page_items_limit\x18\x01 \x01(\rR\x14clientPageItemsLimit\x12\x1d\n" +
|
||||||
"\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_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||||
var file_pagination_proto_goTypes = []any{
|
var file_pagination_proto_goTypes = []any{
|
||||||
(*PageRequest)(nil), // 0: nockchain.public.v1.PageRequest
|
(*PageRequest)(nil), // 0: nockchain.public.v2.PageRequest
|
||||||
(*PageResponse)(nil), // 1: nockchain.public.v1.PageResponse
|
(*PageResponse)(nil), // 1: nockchain.public.v2.PageResponse
|
||||||
}
|
}
|
||||||
var file_pagination_proto_depIdxs = []int32{
|
var file_pagination_proto_depIdxs = []int32{
|
||||||
0, // [0:0] is the sub-list for method output_type
|
0, // [0:0] is the sub-list for method output_type
|
||||||
|
|||||||
@ -101,7 +101,7 @@ func (ErrorCode) EnumDescriptor() ([]byte, []int) {
|
|||||||
|
|
||||||
type ErrorStatus struct {
|
type ErrorStatus struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
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"`
|
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
|
Details *string `protobuf:"bytes,3,opt,name=details,proto3,oneof" json:"details,omitempty"` // additional error context
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
@ -598,6 +598,50 @@ func (x *Base58Hash) GetHash() string {
|
|||||||
return ""
|
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);
|
// pub struct SchnorrPubkey(pub CheetahPoint);
|
||||||
type SchnorrPubkey struct {
|
type SchnorrPubkey struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
@ -608,7 +652,7 @@ type SchnorrPubkey struct {
|
|||||||
|
|
||||||
func (x *SchnorrPubkey) Reset() {
|
func (x *SchnorrPubkey) Reset() {
|
||||||
*x = SchnorrPubkey{}
|
*x = SchnorrPubkey{}
|
||||||
mi := &file_primitives_proto_msgTypes[9]
|
mi := &file_primitives_proto_msgTypes[10]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -620,7 +664,7 @@ func (x *SchnorrPubkey) String() string {
|
|||||||
func (*SchnorrPubkey) ProtoMessage() {}
|
func (*SchnorrPubkey) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *SchnorrPubkey) ProtoReflect() protoreflect.Message {
|
func (x *SchnorrPubkey) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_primitives_proto_msgTypes[9]
|
mi := &file_primitives_proto_msgTypes[10]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -633,7 +677,7 @@ func (x *SchnorrPubkey) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use SchnorrPubkey.ProtoReflect.Descriptor instead.
|
// Deprecated: Use SchnorrPubkey.ProtoReflect.Descriptor instead.
|
||||||
func (*SchnorrPubkey) Descriptor() ([]byte, []int) {
|
func (*SchnorrPubkey) Descriptor() ([]byte, []int) {
|
||||||
return file_primitives_proto_rawDescGZIP(), []int{9}
|
return file_primitives_proto_rawDescGZIP(), []int{10}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *SchnorrPubkey) GetValue() *CheetahPoint {
|
func (x *SchnorrPubkey) GetValue() *CheetahPoint {
|
||||||
@ -659,7 +703,7 @@ type CheetahPoint struct {
|
|||||||
|
|
||||||
func (x *CheetahPoint) Reset() {
|
func (x *CheetahPoint) Reset() {
|
||||||
*x = CheetahPoint{}
|
*x = CheetahPoint{}
|
||||||
mi := &file_primitives_proto_msgTypes[10]
|
mi := &file_primitives_proto_msgTypes[11]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -671,7 +715,7 @@ func (x *CheetahPoint) String() string {
|
|||||||
func (*CheetahPoint) ProtoMessage() {}
|
func (*CheetahPoint) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *CheetahPoint) ProtoReflect() protoreflect.Message {
|
func (x *CheetahPoint) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_primitives_proto_msgTypes[10]
|
mi := &file_primitives_proto_msgTypes[11]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -684,7 +728,7 @@ func (x *CheetahPoint) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use CheetahPoint.ProtoReflect.Descriptor instead.
|
// Deprecated: Use CheetahPoint.ProtoReflect.Descriptor instead.
|
||||||
func (*CheetahPoint) Descriptor() ([]byte, []int) {
|
func (*CheetahPoint) Descriptor() ([]byte, []int) {
|
||||||
return file_primitives_proto_rawDescGZIP(), []int{10}
|
return file_primitives_proto_rawDescGZIP(), []int{11}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *CheetahPoint) GetX() *SixBelt {
|
func (x *CheetahPoint) GetX() *SixBelt {
|
||||||
@ -723,7 +767,7 @@ type SixBelt struct {
|
|||||||
|
|
||||||
func (x *SixBelt) Reset() {
|
func (x *SixBelt) Reset() {
|
||||||
*x = SixBelt{}
|
*x = SixBelt{}
|
||||||
mi := &file_primitives_proto_msgTypes[11]
|
mi := &file_primitives_proto_msgTypes[12]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -735,7 +779,7 @@ func (x *SixBelt) String() string {
|
|||||||
func (*SixBelt) ProtoMessage() {}
|
func (*SixBelt) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *SixBelt) ProtoReflect() protoreflect.Message {
|
func (x *SixBelt) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_primitives_proto_msgTypes[11]
|
mi := &file_primitives_proto_msgTypes[12]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -748,7 +792,7 @@ func (x *SixBelt) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use SixBelt.ProtoReflect.Descriptor instead.
|
// Deprecated: Use SixBelt.ProtoReflect.Descriptor instead.
|
||||||
func (*SixBelt) Descriptor() ([]byte, []int) {
|
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 {
|
func (x *SixBelt) GetBelt_1() *Belt {
|
||||||
@ -803,7 +847,7 @@ type Belt struct {
|
|||||||
|
|
||||||
func (x *Belt) Reset() {
|
func (x *Belt) Reset() {
|
||||||
*x = Belt{}
|
*x = Belt{}
|
||||||
mi := &file_primitives_proto_msgTypes[12]
|
mi := &file_primitives_proto_msgTypes[13]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -815,7 +859,7 @@ func (x *Belt) String() string {
|
|||||||
func (*Belt) ProtoMessage() {}
|
func (*Belt) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *Belt) ProtoReflect() protoreflect.Message {
|
func (x *Belt) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_primitives_proto_msgTypes[12]
|
mi := &file_primitives_proto_msgTypes[13]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -828,7 +872,7 @@ func (x *Belt) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use Belt.ProtoReflect.Descriptor instead.
|
// Deprecated: Use Belt.ProtoReflect.Descriptor instead.
|
||||||
func (*Belt) Descriptor() ([]byte, []int) {
|
func (*Belt) Descriptor() ([]byte, []int) {
|
||||||
return file_primitives_proto_rawDescGZIP(), []int{12}
|
return file_primitives_proto_rawDescGZIP(), []int{13}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Belt) GetValue() uint64 {
|
func (x *Belt) GetValue() uint64 {
|
||||||
@ -842,9 +886,9 @@ var File_primitives_proto protoreflect.FileDescriptor
|
|||||||
|
|
||||||
const file_primitives_proto_rawDesc = "" +
|
const file_primitives_proto_rawDesc = "" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"\x10primitives.proto\x12\x13nockchain.public.v1\"\x86\x01\n" +
|
"\x10primitives.proto\x12\x13nockchain.public.v2\"\x86\x01\n" +
|
||||||
"\vErrorStatus\x122\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" +
|
"\amessage\x18\x02 \x01(\tR\amessage\x12\x1d\n" +
|
||||||
"\adetails\x18\x03 \x01(\tH\x00R\adetails\x88\x01\x01B\n" +
|
"\adetails\x18\x03 \x01(\tH\x00R\adetails\x88\x01\x01B\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
@ -859,36 +903,38 @@ const file_primitives_proto_rawDesc = "" +
|
|||||||
"\x05Nicks\x12\x14\n" +
|
"\x05Nicks\x12\x14\n" +
|
||||||
"\x05value\x18\x01 \x01(\x04R\x05value\"\x9b\x03\n" +
|
"\x05value\x18\x01 \x01(\x04R\x05value\"\x9b\x03\n" +
|
||||||
"\tEightBelt\x120\n" +
|
"\tEightBelt\x120\n" +
|
||||||
"\x06belt_1\x18\x01 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt1\x120\n" +
|
"\x06belt_1\x18\x01 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt1\x120\n" +
|
||||||
"\x06belt_2\x18\x02 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt2\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.v1.BeltR\x05belt3\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.v1.BeltR\x05belt4\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.v1.BeltR\x05belt5\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.v1.BeltR\x05belt6\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.v1.BeltR\x05belt7\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.v1.BeltR\x05belt8\"\x80\x02\n" +
|
"\x06belt_8\x18\b \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt8\"\x80\x02\n" +
|
||||||
"\x04Hash\x120\n" +
|
"\x04Hash\x120\n" +
|
||||||
"\x06belt_1\x18\x01 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt1\x120\n" +
|
"\x06belt_1\x18\x01 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt1\x120\n" +
|
||||||
"\x06belt_2\x18\x02 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt2\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.v1.BeltR\x05belt3\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.v1.BeltR\x05belt4\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.v1.BeltR\x05belt5\" \n" +
|
"\x06belt_5\x18\x05 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt5\" \n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"Base58Hash\x12\x12\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" +
|
"\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" +
|
"\fCheetahPoint\x12*\n" +
|
||||||
"\x01x\x18\x01 \x01(\v2\x1c.nockchain.public.v1.SixBeltR\x01x\x12*\n" +
|
"\x01x\x18\x01 \x01(\v2\x1c.nockchain.public.v2.SixBeltR\x01x\x12*\n" +
|
||||||
"\x01y\x18\x02 \x01(\v2\x1c.nockchain.public.v1.SixBeltR\x01y\x12\x10\n" +
|
"\x01y\x18\x02 \x01(\v2\x1c.nockchain.public.v2.SixBeltR\x01y\x12\x10\n" +
|
||||||
"\x03inf\x18\x03 \x01(\bR\x03inf\"\xb5\x02\n" +
|
"\x03inf\x18\x03 \x01(\bR\x03inf\"\xb5\x02\n" +
|
||||||
"\aSixBelt\x120\n" +
|
"\aSixBelt\x120\n" +
|
||||||
"\x06belt_1\x18\x01 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt1\x120\n" +
|
"\x06belt_1\x18\x01 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt1\x120\n" +
|
||||||
"\x06belt_2\x18\x02 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt2\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.v1.BeltR\x05belt3\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.v1.BeltR\x05belt4\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.v1.BeltR\x05belt5\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.v1.BeltR\x05belt6\"\x1c\n" +
|
"\x06belt_6\x18\x06 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt6\"\x1c\n" +
|
||||||
"\x04Belt\x12\x14\n" +
|
"\x04Belt\x12\x14\n" +
|
||||||
"\x05value\x18\x01 \x01(\x04R\x05value*\xf0\x02\n" +
|
"\x05value\x18\x01 \x01(\x04R\x05value*\xf0\x02\n" +
|
||||||
"\tErrorCode\x12\x1a\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_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{
|
var file_primitives_proto_goTypes = []any{
|
||||||
(ErrorCode)(0), // 0: nockchain.public.v1.ErrorCode
|
(ErrorCode)(0), // 0: nockchain.public.v2.ErrorCode
|
||||||
(*ErrorStatus)(nil), // 1: nockchain.public.v1.ErrorStatus
|
(*ErrorStatus)(nil), // 1: nockchain.public.v2.ErrorStatus
|
||||||
(*Acknowledged)(nil), // 2: nockchain.public.v1.Acknowledged
|
(*Acknowledged)(nil), // 2: nockchain.public.v2.Acknowledged
|
||||||
(*NoteVersion)(nil), // 3: nockchain.public.v1.NoteVersion
|
(*NoteVersion)(nil), // 3: nockchain.public.v2.NoteVersion
|
||||||
(*BlockHeight)(nil), // 4: nockchain.public.v1.BlockHeight
|
(*BlockHeight)(nil), // 4: nockchain.public.v2.BlockHeight
|
||||||
(*BlockHeightDelta)(nil), // 5: nockchain.public.v1.BlockHeightDelta
|
(*BlockHeightDelta)(nil), // 5: nockchain.public.v2.BlockHeightDelta
|
||||||
(*Nicks)(nil), // 6: nockchain.public.v1.Nicks
|
(*Nicks)(nil), // 6: nockchain.public.v2.Nicks
|
||||||
(*EightBelt)(nil), // 7: nockchain.public.v1.EightBelt
|
(*EightBelt)(nil), // 7: nockchain.public.v2.EightBelt
|
||||||
(*Hash)(nil), // 8: nockchain.public.v1.Hash
|
(*Hash)(nil), // 8: nockchain.public.v2.Hash
|
||||||
(*Base58Hash)(nil), // 9: nockchain.public.v1.Base58Hash
|
(*Base58Hash)(nil), // 9: nockchain.public.v2.Base58Hash
|
||||||
(*SchnorrPubkey)(nil), // 10: nockchain.public.v1.SchnorrPubkey
|
(*Base58Pubkey)(nil), // 10: nockchain.public.v2.Base58Pubkey
|
||||||
(*CheetahPoint)(nil), // 11: nockchain.public.v1.CheetahPoint
|
(*SchnorrPubkey)(nil), // 11: nockchain.public.v2.SchnorrPubkey
|
||||||
(*SixBelt)(nil), // 12: nockchain.public.v1.SixBelt
|
(*CheetahPoint)(nil), // 12: nockchain.public.v2.CheetahPoint
|
||||||
(*Belt)(nil), // 13: nockchain.public.v1.Belt
|
(*SixBelt)(nil), // 13: nockchain.public.v2.SixBelt
|
||||||
|
(*Belt)(nil), // 14: nockchain.public.v2.Belt
|
||||||
}
|
}
|
||||||
var file_primitives_proto_depIdxs = []int32{
|
var file_primitives_proto_depIdxs = []int32{
|
||||||
0, // 0: nockchain.public.v1.ErrorStatus.code:type_name -> nockchain.public.v1.ErrorCode
|
0, // 0: nockchain.public.v2.ErrorStatus.code:type_name -> nockchain.public.v2.ErrorCode
|
||||||
13, // 1: nockchain.public.v1.EightBelt.belt_1:type_name -> nockchain.public.v1.Belt
|
14, // 1: nockchain.public.v2.EightBelt.belt_1:type_name -> nockchain.public.v2.Belt
|
||||||
13, // 2: nockchain.public.v1.EightBelt.belt_2:type_name -> nockchain.public.v1.Belt
|
14, // 2: nockchain.public.v2.EightBelt.belt_2:type_name -> nockchain.public.v2.Belt
|
||||||
13, // 3: nockchain.public.v1.EightBelt.belt_3:type_name -> nockchain.public.v1.Belt
|
14, // 3: nockchain.public.v2.EightBelt.belt_3:type_name -> nockchain.public.v2.Belt
|
||||||
13, // 4: nockchain.public.v1.EightBelt.belt_4:type_name -> nockchain.public.v1.Belt
|
14, // 4: nockchain.public.v2.EightBelt.belt_4:type_name -> nockchain.public.v2.Belt
|
||||||
13, // 5: nockchain.public.v1.EightBelt.belt_5:type_name -> nockchain.public.v1.Belt
|
14, // 5: nockchain.public.v2.EightBelt.belt_5:type_name -> nockchain.public.v2.Belt
|
||||||
13, // 6: nockchain.public.v1.EightBelt.belt_6:type_name -> nockchain.public.v1.Belt
|
14, // 6: nockchain.public.v2.EightBelt.belt_6:type_name -> nockchain.public.v2.Belt
|
||||||
13, // 7: nockchain.public.v1.EightBelt.belt_7:type_name -> nockchain.public.v1.Belt
|
14, // 7: nockchain.public.v2.EightBelt.belt_7:type_name -> nockchain.public.v2.Belt
|
||||||
13, // 8: nockchain.public.v1.EightBelt.belt_8:type_name -> nockchain.public.v1.Belt
|
14, // 8: nockchain.public.v2.EightBelt.belt_8:type_name -> nockchain.public.v2.Belt
|
||||||
13, // 9: nockchain.public.v1.Hash.belt_1:type_name -> nockchain.public.v1.Belt
|
14, // 9: nockchain.public.v2.Hash.belt_1:type_name -> nockchain.public.v2.Belt
|
||||||
13, // 10: nockchain.public.v1.Hash.belt_2:type_name -> nockchain.public.v1.Belt
|
14, // 10: nockchain.public.v2.Hash.belt_2:type_name -> nockchain.public.v2.Belt
|
||||||
13, // 11: nockchain.public.v1.Hash.belt_3:type_name -> nockchain.public.v1.Belt
|
14, // 11: nockchain.public.v2.Hash.belt_3:type_name -> nockchain.public.v2.Belt
|
||||||
13, // 12: nockchain.public.v1.Hash.belt_4:type_name -> nockchain.public.v1.Belt
|
14, // 12: nockchain.public.v2.Hash.belt_4:type_name -> nockchain.public.v2.Belt
|
||||||
13, // 13: nockchain.public.v1.Hash.belt_5:type_name -> nockchain.public.v1.Belt
|
14, // 13: nockchain.public.v2.Hash.belt_5:type_name -> nockchain.public.v2.Belt
|
||||||
11, // 14: nockchain.public.v1.SchnorrPubkey.value:type_name -> nockchain.public.v1.CheetahPoint
|
12, // 14: nockchain.public.v2.SchnorrPubkey.value:type_name -> nockchain.public.v2.CheetahPoint
|
||||||
12, // 15: nockchain.public.v1.CheetahPoint.x:type_name -> nockchain.public.v1.SixBelt
|
13, // 15: nockchain.public.v2.CheetahPoint.x:type_name -> nockchain.public.v2.SixBelt
|
||||||
12, // 16: nockchain.public.v1.CheetahPoint.y:type_name -> nockchain.public.v1.SixBelt
|
13, // 16: nockchain.public.v2.CheetahPoint.y:type_name -> nockchain.public.v2.SixBelt
|
||||||
13, // 17: nockchain.public.v1.SixBelt.belt_1:type_name -> nockchain.public.v1.Belt
|
14, // 17: nockchain.public.v2.SixBelt.belt_1:type_name -> nockchain.public.v2.Belt
|
||||||
13, // 18: nockchain.public.v1.SixBelt.belt_2:type_name -> nockchain.public.v1.Belt
|
14, // 18: nockchain.public.v2.SixBelt.belt_2:type_name -> nockchain.public.v2.Belt
|
||||||
13, // 19: nockchain.public.v1.SixBelt.belt_3:type_name -> nockchain.public.v1.Belt
|
14, // 19: nockchain.public.v2.SixBelt.belt_3:type_name -> nockchain.public.v2.Belt
|
||||||
13, // 20: nockchain.public.v1.SixBelt.belt_4:type_name -> nockchain.public.v1.Belt
|
14, // 20: nockchain.public.v2.SixBelt.belt_4:type_name -> nockchain.public.v2.Belt
|
||||||
13, // 21: nockchain.public.v1.SixBelt.belt_5:type_name -> nockchain.public.v1.Belt
|
14, // 21: nockchain.public.v2.SixBelt.belt_5:type_name -> nockchain.public.v2.Belt
|
||||||
13, // 22: nockchain.public.v1.SixBelt.belt_6:type_name -> nockchain.public.v1.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 output_type
|
||||||
23, // [23:23] is the sub-list for method input_type
|
23, // [23:23] is the sub-list for method input_type
|
||||||
23, // [23:23] is the sub-list for extension type_name
|
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(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_primitives_proto_rawDesc), len(file_primitives_proto_rawDesc)),
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_primitives_proto_rawDesc), len(file_primitives_proto_rawDesc)),
|
||||||
NumEnums: 1,
|
NumEnums: 1,
|
||||||
NumMessages: 13,
|
NumMessages: 14,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 0,
|
NumServices: 0,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -161,7 +161,7 @@ type ImportKeysRequest struct {
|
|||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
|
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
|
||||||
Version uint64 `protobuf:"varint,2,opt,name=version,proto3" json:"version,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
|
unknownFields protoimpl.UnknownFields
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
@ -446,20 +446,18 @@ func (x *DeriveChildResponse) GetVersion() uint64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type CreateTxRequest struct {
|
type CreateTxRequest struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
Names string `protobuf:"bytes,1,opt,name=names,proto3" json:"names,omitempty"`
|
Names string `protobuf:"bytes,1,opt,name=names,proto3" json:"names,omitempty"`
|
||||||
Recipients string `protobuf:"bytes,2,opt,name=recipients,proto3" json:"recipients,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,3,opt,name=fee,proto3" json:"fee,omitempty"`
|
||||||
Fee uint64 `protobuf:"varint,4,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"`
|
||||||
IsMasterKey bool `protobuf:"varint,5,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"`
|
||||||
Key string `protobuf:"bytes,6,opt,name=key,proto3" json:"key,omitempty"`
|
Index uint64 `protobuf:"varint,6,opt,name=index,proto3" json:"index,omitempty"`
|
||||||
ChainCode string `protobuf:"bytes,7,opt,name=chain_code,json=chainCode,proto3" json:"chain_code,omitempty"`
|
Hardened bool `protobuf:"varint,7,opt,name=hardened,proto3" json:"hardened,omitempty"`
|
||||||
Index uint64 `protobuf:"varint,8,opt,name=index,proto3" json:"index,omitempty"`
|
Version uint64 `protobuf:"varint,8,opt,name=version,proto3" json:"version,omitempty"`
|
||||||
Hardened bool `protobuf:"varint,9,opt,name=hardened,proto3" json:"hardened,omitempty"`
|
RefundAddress string `protobuf:"bytes,9,opt,name=refund_address,json=refundAddress,proto3" json:"refund_address,omitempty"`
|
||||||
Version uint64 `protobuf:"varint,10,opt,name=version,proto3" json:"version,omitempty"`
|
unknownFields protoimpl.UnknownFields
|
||||||
TimelockIntent *TimelockIntent `protobuf:"bytes,11,opt,name=timelock_intent,json=timelockIntent,proto3" json:"timelock_intent,omitempty"`
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *CreateTxRequest) Reset() {
|
func (x *CreateTxRequest) Reset() {
|
||||||
@ -506,13 +504,6 @@ func (x *CreateTxRequest) GetRecipients() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *CreateTxRequest) GetGifts() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.Gifts
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *CreateTxRequest) GetFee() uint64 {
|
func (x *CreateTxRequest) GetFee() uint64 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Fee
|
return x.Fee
|
||||||
@ -527,16 +518,9 @@ func (x *CreateTxRequest) GetIsMasterKey() bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *CreateTxRequest) GetKey() string {
|
func (x *CreateTxRequest) GetSeed() string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Key
|
return x.Seed
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *CreateTxRequest) GetChainCode() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.ChainCode
|
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
@ -562,11 +546,11 @@ func (x *CreateTxRequest) GetVersion() uint64 {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *CreateTxRequest) GetTimelockIntent() *TimelockIntent {
|
func (x *CreateTxRequest) GetRefundAddress() string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.TimelockIntent
|
return x.RefundAddress
|
||||||
}
|
}
|
||||||
return nil
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
type CreateTxResponse struct {
|
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"`
|
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"`
|
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"`
|
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
|
unknownFields protoimpl.UnknownFields
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
@ -689,6 +674,13 @@ func (x *ScanRequest) GetIncludeMultisig() bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *ScanRequest) GetVersion() uint64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Version
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
type ScanResponse struct {
|
type ScanResponse struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
ScanData []*ScanData `protobuf:"bytes,1,rep,name=scan_data,json=scanData,proto3" json:"scan_data,omitempty"`
|
ScanData []*ScanData `protobuf:"bytes,1,rep,name=scan_data,json=scanData,proto3" json:"scan_data,omitempty"`
|
||||||
@ -734,8 +726,12 @@ func (x *ScanResponse) GetScanData() []*ScanData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type GetBalanceRequest struct {
|
type GetBalanceRequest struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
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
|
unknownFields protoimpl.UnknownFields
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
@ -770,16 +766,50 @@ func (*GetBalanceRequest) Descriptor() ([]byte, []int) {
|
|||||||
return file_service_proto_rawDescGZIP(), []int{10}
|
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 {
|
func (x *GetBalanceRequest) GetAddress() string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Address
|
if x, ok := x.Selector.(*GetBalanceRequest_Address); ok {
|
||||||
|
return x.Address
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ""
|
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 {
|
type GetBalanceResponse struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
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
|
unknownFields protoimpl.UnknownFields
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
@ -814,7 +844,7 @@ func (*GetBalanceResponse) Descriptor() ([]byte, []int) {
|
|||||||
return file_service_proto_rawDescGZIP(), []int{11}
|
return file_service_proto_rawDescGZIP(), []int{11}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetBalanceResponse) GetData() *WalletBalanceData {
|
func (x *GetBalanceResponse) GetData() *Balance {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Data
|
return x.Data
|
||||||
}
|
}
|
||||||
@ -913,7 +943,7 @@ var File_service_proto protoreflect.FileDescriptor
|
|||||||
|
|
||||||
const file_service_proto_rawDesc = "" +
|
const file_service_proto_rawDesc = "" +
|
||||||
"\n" +
|
"\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" +
|
"\rKeygenRequest\x12\x18\n" +
|
||||||
"\aversion\x18\x01 \x01(\x04R\aversion\"\xf2\x01\n" +
|
"\aversion\x18\x01 \x01(\x04R\aversion\"\xf2\x01\n" +
|
||||||
"\x0eKeygenResponse\x12\x18\n" +
|
"\x0eKeygenResponse\x12\x18\n" +
|
||||||
@ -929,7 +959,7 @@ const file_service_proto_rawDesc = "" +
|
|||||||
"\x11ImportKeysRequest\x12\x10\n" +
|
"\x11ImportKeysRequest\x12\x10\n" +
|
||||||
"\x03key\x18\x01 \x01(\tR\x03key\x12\x18\n" +
|
"\x03key\x18\x01 \x01(\tR\x03key\x12\x18\n" +
|
||||||
"\aversion\x18\x02 \x01(\x04R\aversion\x12@\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" +
|
"importType\"\xf6\x01\n" +
|
||||||
"\x12ImportKeysResponse\x12\x18\n" +
|
"\x12ImportKeysResponse\x12\x18\n" +
|
||||||
"\aaddress\x18\x01 \x01(\tR\aaddress\x12\x1f\n" +
|
"\aaddress\x18\x01 \x01(\tR\aaddress\x12\x1f\n" +
|
||||||
@ -952,52 +982,53 @@ const file_service_proto_rawDesc = "" +
|
|||||||
"privateKey\x12\x1d\n" +
|
"privateKey\x12\x1d\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"chain_code\x18\x03 \x01(\tR\tchainCode\x12\x18\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" +
|
"\x0fCreateTxRequest\x12\x14\n" +
|
||||||
"\x05names\x18\x01 \x01(\tR\x05names\x12\x1e\n" +
|
"\x05names\x18\x01 \x01(\tR\x05names\x12\x1e\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"recipients\x18\x02 \x01(\tR\n" +
|
"recipients\x18\x02 \x01(\tR\n" +
|
||||||
"recipients\x12\x14\n" +
|
"recipients\x12\x10\n" +
|
||||||
"\x05gifts\x18\x03 \x01(\tR\x05gifts\x12\x10\n" +
|
"\x03fee\x18\x03 \x01(\x04R\x03fee\x12\"\n" +
|
||||||
"\x03fee\x18\x04 \x01(\x04R\x03fee\x12\"\n" +
|
"\ris_master_key\x18\x04 \x01(\bR\visMasterKey\x12\x12\n" +
|
||||||
"\ris_master_key\x18\x05 \x01(\bR\visMasterKey\x12\x10\n" +
|
"\x04seed\x18\x05 \x01(\tR\x04seed\x12\x14\n" +
|
||||||
"\x03key\x18\x06 \x01(\tR\x03key\x12\x1d\n" +
|
"\x05index\x18\x06 \x01(\x04R\x05index\x12\x1a\n" +
|
||||||
"\n" +
|
"\bhardened\x18\a \x01(\bR\bhardened\x12\x18\n" +
|
||||||
"chain_code\x18\a \x01(\tR\tchainCode\x12\x14\n" +
|
"\aversion\x18\b \x01(\x04R\aversion\x12%\n" +
|
||||||
"\x05index\x18\b \x01(\x04R\x05index\x12\x1a\n" +
|
"\x0erefund_address\x18\t \x01(\tR\rrefundAddress\"D\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" +
|
|
||||||
"\x10CreateTxResponse\x120\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" +
|
"\vScanRequest\x12#\n" +
|
||||||
"\rmaster_pubkey\x18\x01 \x01(\tR\fmasterPubkey\x12\x1d\n" +
|
"\rmaster_pubkey\x18\x01 \x01(\tR\fmasterPubkey\x12\x1d\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"chain_code\x18\x02 \x01(\tR\tchainCode\x12!\n" +
|
"chain_code\x18\x02 \x01(\tR\tchainCode\x12!\n" +
|
||||||
"\fsearch_depth\x18\x03 \x01(\x04R\vsearchDepth\x12+\n" +
|
"\fsearch_depth\x18\x03 \x01(\x04R\vsearchDepth\x12+\n" +
|
||||||
"\x11include_timelocks\x18\x04 \x01(\bR\x10includeTimelocks\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" +
|
"\fScanResponse\x12:\n" +
|
||||||
"\tscan_data\x18\x01 \x03(\v2\x1d.nockchain.public.v1.ScanDataR\bscanData\"-\n" +
|
"\tscan_data\x18\x01 \x03(\v2\x1d.nockchain.public.v2.ScanDataR\bscanData\"\\\n" +
|
||||||
"\x11GetBalanceRequest\x12\x18\n" +
|
"\x11GetBalanceRequest\x12\x1a\n" +
|
||||||
"\aaddress\x18\x01 \x01(\tR\aaddress\"P\n" +
|
"\aaddress\x18\x01 \x01(\tH\x00R\aaddress\x12\x1f\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" +
|
|
||||||
"\n" +
|
"\n" +
|
||||||
"ImportKeys\x12&.nockchain.public.v1.ImportKeysRequest\x1a'.nockchain.public.v1.ImportKeysResponse\x12`\n" +
|
"first_name\x18\x02 \x01(\tH\x00R\tfirstNameB\n" +
|
||||||
"\vDeriveChild\x12'.nockchain.public.v1.DeriveChildRequest\x1a(.nockchain.public.v1.DeriveChildResponse\x12W\n" +
|
"\n" +
|
||||||
"\bCreateTx\x12$.nockchain.public.v1.CreateTxRequest\x1a%.nockchain.public.v1.CreateTxResponse\x12K\n" +
|
"\bselector\"F\n" +
|
||||||
"\x04Scan\x12 .nockchain.public.v1.ScanRequest\x1a!.nockchain.public.v1.ScanResponse\x12c\n" +
|
"\x12GetBalanceResponse\x120\n" +
|
||||||
"\x10WalletGetBalance\x12&.nockchain.public.v1.GetBalanceRequest\x1a'.nockchain.public.v1.GetBalanceResponse\x12r\n" +
|
"\x04data\x18\x01 \x01(\v2\x1c.nockchain.public.v2.BalanceR\x04data\"K\n" +
|
||||||
"\x15WalletSendTransaction\x12+.nockchain.public.v1.SendTransactionRequest\x1a,.nockchain.public.v1.SendTransactionResponse\x12x\n" +
|
"\x16SendTransactionRequest\x121\n" +
|
||||||
"\x13TransactionAccepted\x12/.nockchain.public.v1.TransactionAcceptedRequest\x1a0.nockchain.public.v1.TransactionAcceptedResponseB\x0eZ\f./;nockchainb\x06proto3"
|
"\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 (
|
var (
|
||||||
file_service_proto_rawDescOnce sync.Once
|
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_msgTypes = make([]protoimpl.MessageInfo, 14)
|
||||||
var file_service_proto_goTypes = []any{
|
var file_service_proto_goTypes = []any{
|
||||||
(*KeygenRequest)(nil), // 0: nockchain.public.v1.KeygenRequest
|
(*KeygenRequest)(nil), // 0: nockchain.public.v2.KeygenRequest
|
||||||
(*KeygenResponse)(nil), // 1: nockchain.public.v1.KeygenResponse
|
(*KeygenResponse)(nil), // 1: nockchain.public.v2.KeygenResponse
|
||||||
(*ImportKeysRequest)(nil), // 2: nockchain.public.v1.ImportKeysRequest
|
(*ImportKeysRequest)(nil), // 2: nockchain.public.v2.ImportKeysRequest
|
||||||
(*ImportKeysResponse)(nil), // 3: nockchain.public.v1.ImportKeysResponse
|
(*ImportKeysResponse)(nil), // 3: nockchain.public.v2.ImportKeysResponse
|
||||||
(*DeriveChildRequest)(nil), // 4: nockchain.public.v1.DeriveChildRequest
|
(*DeriveChildRequest)(nil), // 4: nockchain.public.v2.DeriveChildRequest
|
||||||
(*DeriveChildResponse)(nil), // 5: nockchain.public.v1.DeriveChildResponse
|
(*DeriveChildResponse)(nil), // 5: nockchain.public.v2.DeriveChildResponse
|
||||||
(*CreateTxRequest)(nil), // 6: nockchain.public.v1.CreateTxRequest
|
(*CreateTxRequest)(nil), // 6: nockchain.public.v2.CreateTxRequest
|
||||||
(*CreateTxResponse)(nil), // 7: nockchain.public.v1.CreateTxResponse
|
(*CreateTxResponse)(nil), // 7: nockchain.public.v2.CreateTxResponse
|
||||||
(*ScanRequest)(nil), // 8: nockchain.public.v1.ScanRequest
|
(*ScanRequest)(nil), // 8: nockchain.public.v2.ScanRequest
|
||||||
(*ScanResponse)(nil), // 9: nockchain.public.v1.ScanResponse
|
(*ScanResponse)(nil), // 9: nockchain.public.v2.ScanResponse
|
||||||
(*GetBalanceRequest)(nil), // 10: nockchain.public.v1.GetBalanceRequest
|
(*GetBalanceRequest)(nil), // 10: nockchain.public.v2.GetBalanceRequest
|
||||||
(*GetBalanceResponse)(nil), // 11: nockchain.public.v1.GetBalanceResponse
|
(*GetBalanceResponse)(nil), // 11: nockchain.public.v2.GetBalanceResponse
|
||||||
(*SendTransactionRequest)(nil), // 12: nockchain.public.v1.SendTransactionRequest
|
(*SendTransactionRequest)(nil), // 12: nockchain.public.v2.SendTransactionRequest
|
||||||
(*SendTransactionResponse)(nil), // 13: nockchain.public.v1.SendTransactionResponse
|
(*SendTransactionResponse)(nil), // 13: nockchain.public.v2.SendTransactionResponse
|
||||||
(ImportType)(0), // 14: nockchain.public.v1.ImportType
|
(ImportType)(0), // 14: nockchain.public.v2.ImportType
|
||||||
(*TimelockIntent)(nil), // 15: nockchain.public.v1.TimelockIntent
|
(*RawTx)(nil), // 15: nockchain.public.v2.RawTx
|
||||||
(*RawTx)(nil), // 16: nockchain.public.v1.RawTx
|
(*ScanData)(nil), // 16: nockchain.public.v2.ScanData
|
||||||
(*ScanData)(nil), // 17: nockchain.public.v1.ScanData
|
(*Balance)(nil), // 17: nockchain.public.v2.Balance
|
||||||
(*WalletBalanceData)(nil), // 18: nockchain.public.v1.WalletBalanceData
|
(*WalletSendTransactionResponse)(nil), // 18: nockchain.public.v2.WalletSendTransactionResponse
|
||||||
(*WalletSendTransactionResponse)(nil), // 19: nockchain.public.v1.WalletSendTransactionResponse
|
(*TransactionAcceptedRequest)(nil), // 19: nockchain.public.v2.TransactionAcceptedRequest
|
||||||
(*TransactionAcceptedRequest)(nil), // 20: nockchain.public.v1.TransactionAcceptedRequest
|
(*TransactionAcceptedResponse)(nil), // 20: nockchain.public.v2.TransactionAcceptedResponse
|
||||||
(*TransactionAcceptedResponse)(nil), // 21: nockchain.public.v1.TransactionAcceptedResponse
|
|
||||||
}
|
}
|
||||||
var file_service_proto_depIdxs = []int32{
|
var file_service_proto_depIdxs = []int32{
|
||||||
14, // 0: nockchain.public.v1.ImportKeysRequest.import_type:type_name -> nockchain.public.v1.ImportType
|
14, // 0: nockchain.public.v2.ImportKeysRequest.import_type:type_name -> nockchain.public.v2.ImportType
|
||||||
15, // 1: nockchain.public.v1.CreateTxRequest.timelock_intent:type_name -> nockchain.public.v1.TimelockIntent
|
15, // 1: nockchain.public.v2.CreateTxResponse.rawTx:type_name -> nockchain.public.v2.RawTx
|
||||||
16, // 2: nockchain.public.v1.CreateTxResponse.rawTx:type_name -> nockchain.public.v1.RawTx
|
16, // 2: nockchain.public.v2.ScanResponse.scan_data:type_name -> nockchain.public.v2.ScanData
|
||||||
17, // 3: nockchain.public.v1.ScanResponse.scan_data:type_name -> nockchain.public.v1.ScanData
|
17, // 3: nockchain.public.v2.GetBalanceResponse.data:type_name -> nockchain.public.v2.Balance
|
||||||
18, // 4: nockchain.public.v1.GetBalanceResponse.data:type_name -> nockchain.public.v1.WalletBalanceData
|
15, // 4: nockchain.public.v2.SendTransactionRequest.raw_tx:type_name -> nockchain.public.v2.RawTx
|
||||||
16, // 5: nockchain.public.v1.SendTransactionRequest.raw_tx:type_name -> nockchain.public.v1.RawTx
|
18, // 5: nockchain.public.v2.SendTransactionResponse.response:type_name -> nockchain.public.v2.WalletSendTransactionResponse
|
||||||
19, // 6: nockchain.public.v1.SendTransactionResponse.response:type_name -> nockchain.public.v1.WalletSendTransactionResponse
|
0, // 6: nockchain.public.v2.WalletService.Keygen:input_type -> nockchain.public.v2.KeygenRequest
|
||||||
0, // 7: nockchain.public.v1.WalletService.Keygen:input_type -> nockchain.public.v1.KeygenRequest
|
2, // 7: nockchain.public.v2.WalletService.ImportKeys:input_type -> nockchain.public.v2.ImportKeysRequest
|
||||||
2, // 8: nockchain.public.v1.WalletService.ImportKeys:input_type -> nockchain.public.v1.ImportKeysRequest
|
4, // 8: nockchain.public.v2.WalletService.DeriveChild:input_type -> nockchain.public.v2.DeriveChildRequest
|
||||||
4, // 9: nockchain.public.v1.WalletService.DeriveChild:input_type -> nockchain.public.v1.DeriveChildRequest
|
6, // 9: nockchain.public.v2.WalletService.CreateTx:input_type -> nockchain.public.v2.CreateTxRequest
|
||||||
6, // 10: nockchain.public.v1.WalletService.CreateTx:input_type -> nockchain.public.v1.CreateTxRequest
|
8, // 10: nockchain.public.v2.WalletService.Scan:input_type -> nockchain.public.v2.ScanRequest
|
||||||
8, // 11: nockchain.public.v1.WalletService.Scan:input_type -> nockchain.public.v1.ScanRequest
|
10, // 11: nockchain.public.v2.WalletService.WalletGetBalance:input_type -> nockchain.public.v2.GetBalanceRequest
|
||||||
10, // 12: nockchain.public.v1.WalletService.WalletGetBalance:input_type -> nockchain.public.v1.GetBalanceRequest
|
12, // 12: nockchain.public.v2.WalletService.WalletSendTransaction:input_type -> nockchain.public.v2.SendTransactionRequest
|
||||||
12, // 13: nockchain.public.v1.WalletService.WalletSendTransaction:input_type -> nockchain.public.v1.SendTransactionRequest
|
19, // 13: nockchain.public.v2.WalletService.TransactionAccepted:input_type -> nockchain.public.v2.TransactionAcceptedRequest
|
||||||
20, // 14: nockchain.public.v1.WalletService.TransactionAccepted:input_type -> nockchain.public.v1.TransactionAcceptedRequest
|
1, // 14: nockchain.public.v2.WalletService.Keygen:output_type -> nockchain.public.v2.KeygenResponse
|
||||||
1, // 15: nockchain.public.v1.WalletService.Keygen:output_type -> nockchain.public.v1.KeygenResponse
|
3, // 15: nockchain.public.v2.WalletService.ImportKeys:output_type -> nockchain.public.v2.ImportKeysResponse
|
||||||
3, // 16: nockchain.public.v1.WalletService.ImportKeys:output_type -> nockchain.public.v1.ImportKeysResponse
|
5, // 16: nockchain.public.v2.WalletService.DeriveChild:output_type -> nockchain.public.v2.DeriveChildResponse
|
||||||
5, // 17: nockchain.public.v1.WalletService.DeriveChild:output_type -> nockchain.public.v1.DeriveChildResponse
|
7, // 17: nockchain.public.v2.WalletService.CreateTx:output_type -> nockchain.public.v2.CreateTxResponse
|
||||||
7, // 18: nockchain.public.v1.WalletService.CreateTx:output_type -> nockchain.public.v1.CreateTxResponse
|
9, // 18: nockchain.public.v2.WalletService.Scan:output_type -> nockchain.public.v2.ScanResponse
|
||||||
9, // 19: nockchain.public.v1.WalletService.Scan:output_type -> nockchain.public.v1.ScanResponse
|
11, // 19: nockchain.public.v2.WalletService.WalletGetBalance:output_type -> nockchain.public.v2.GetBalanceResponse
|
||||||
11, // 20: nockchain.public.v1.WalletService.WalletGetBalance:output_type -> nockchain.public.v1.GetBalanceResponse
|
13, // 20: nockchain.public.v2.WalletService.WalletSendTransaction:output_type -> nockchain.public.v2.SendTransactionResponse
|
||||||
13, // 21: nockchain.public.v1.WalletService.WalletSendTransaction:output_type -> nockchain.public.v1.SendTransactionResponse
|
20, // 21: nockchain.public.v2.WalletService.TransactionAccepted:output_type -> nockchain.public.v2.TransactionAcceptedResponse
|
||||||
21, // 22: nockchain.public.v1.WalletService.TransactionAccepted:output_type -> nockchain.public.v1.TransactionAcceptedResponse
|
14, // [14:22] is the sub-list for method output_type
|
||||||
15, // [15:23] is the sub-list for method output_type
|
6, // [6:14] is the sub-list for method input_type
|
||||||
7, // [7:15] is the sub-list for method input_type
|
6, // [6:6] is the sub-list for extension type_name
|
||||||
7, // [7:7] is the sub-list for extension type_name
|
6, // [6:6] is the sub-list for extension extendee
|
||||||
7, // [7:7] is the sub-list for extension extendee
|
0, // [0:6] is the sub-list for field type_name
|
||||||
0, // [0:7] is the sub-list for field type_name
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_service_proto_init() }
|
func init() { file_service_proto_init() }
|
||||||
@ -1075,6 +1104,10 @@ func file_service_proto_init() {
|
|||||||
file_types_proto_init()
|
file_types_proto_init()
|
||||||
file_blockchain_proto_init()
|
file_blockchain_proto_init()
|
||||||
file_nockchain_proto_init()
|
file_nockchain_proto_init()
|
||||||
|
file_service_proto_msgTypes[10].OneofWrappers = []any{
|
||||||
|
(*GetBalanceRequest_Address)(nil),
|
||||||
|
(*GetBalanceRequest_FirstName)(nil),
|
||||||
|
}
|
||||||
type x struct{}
|
type x struct{}
|
||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
|
|||||||
@ -19,14 +19,14 @@ import (
|
|||||||
const _ = grpc.SupportPackageIsVersion9
|
const _ = grpc.SupportPackageIsVersion9
|
||||||
|
|
||||||
const (
|
const (
|
||||||
WalletService_Keygen_FullMethodName = "/nockchain.public.v1.WalletService/Keygen"
|
WalletService_Keygen_FullMethodName = "/nockchain.public.v2.WalletService/Keygen"
|
||||||
WalletService_ImportKeys_FullMethodName = "/nockchain.public.v1.WalletService/ImportKeys"
|
WalletService_ImportKeys_FullMethodName = "/nockchain.public.v2.WalletService/ImportKeys"
|
||||||
WalletService_DeriveChild_FullMethodName = "/nockchain.public.v1.WalletService/DeriveChild"
|
WalletService_DeriveChild_FullMethodName = "/nockchain.public.v2.WalletService/DeriveChild"
|
||||||
WalletService_CreateTx_FullMethodName = "/nockchain.public.v1.WalletService/CreateTx"
|
WalletService_CreateTx_FullMethodName = "/nockchain.public.v2.WalletService/CreateTx"
|
||||||
WalletService_Scan_FullMethodName = "/nockchain.public.v1.WalletService/Scan"
|
WalletService_Scan_FullMethodName = "/nockchain.public.v2.WalletService/Scan"
|
||||||
WalletService_WalletGetBalance_FullMethodName = "/nockchain.public.v1.WalletService/WalletGetBalance"
|
WalletService_WalletGetBalance_FullMethodName = "/nockchain.public.v2.WalletService/WalletGetBalance"
|
||||||
WalletService_WalletSendTransaction_FullMethodName = "/nockchain.public.v1.WalletService/WalletSendTransaction"
|
WalletService_WalletSendTransaction_FullMethodName = "/nockchain.public.v2.WalletService/WalletSendTransaction"
|
||||||
WalletService_TransactionAccepted_FullMethodName = "/nockchain.public.v1.WalletService/TransactionAccepted"
|
WalletService_TransactionAccepted_FullMethodName = "/nockchain.public.v2.WalletService/TransactionAccepted"
|
||||||
)
|
)
|
||||||
|
|
||||||
// WalletServiceClient is the client API for WalletService service.
|
// 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,
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
// and not to be introspected or modified (even as a copy)
|
// and not to be introspected or modified (even as a copy)
|
||||||
var WalletService_ServiceDesc = grpc.ServiceDesc{
|
var WalletService_ServiceDesc = grpc.ServiceDesc{
|
||||||
ServiceName: "nockchain.public.v1.WalletService",
|
ServiceName: "nockchain.public.v2.WalletService",
|
||||||
HandlerType: (*WalletServiceServer)(nil),
|
HandlerType: (*WalletServiceServer)(nil),
|
||||||
Methods: []grpc.MethodDesc{
|
Methods: []grpc.MethodDesc{
|
||||||
{
|
{
|
||||||
|
|||||||
@ -128,7 +128,7 @@ func (Version) EnumDescriptor() ([]byte, []int) {
|
|||||||
type ScanData struct {
|
type ScanData struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
Pubkey string `protobuf:"bytes,1,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
|
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
|
unknownFields protoimpl.UnknownFields
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
@ -170,7 +170,7 @@ func (x *ScanData) GetPubkey() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ScanData) GetData() *WalletBalanceData {
|
func (x *ScanData) GetData() *Balance {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Data
|
return x.Data
|
||||||
}
|
}
|
||||||
@ -328,9 +328,8 @@ func (x *Timelock) GetValue() uint64 {
|
|||||||
type RawTx struct {
|
type RawTx struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
TxId string `protobuf:"bytes,1,opt,name=tx_id,json=txId,proto3" json:"tx_id,omitempty"`
|
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"`
|
Version Version `protobuf:"varint,2,opt,name=version,proto3,enum=nockchain.public.v2.Version" json:"version,omitempty"`
|
||||||
TimelockRange *TimelockRange `protobuf:"bytes,3,opt,name=timelock_range,json=timelockRange,proto3" json:"timelock_range,omitempty"`
|
NamedSpends []*NockchainNamedSpend `protobuf:"bytes,3,rep,name=named_spends,json=namedSpends,proto3" json:"named_spends,omitempty"`
|
||||||
TotalFees uint64 `protobuf:"varint,4,opt,name=total_fees,json=totalFees,proto3" json:"total_fees,omitempty"`
|
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
@ -372,50 +371,46 @@ func (x *RawTx) GetTxId() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *RawTx) GetInputs() []*NockchainInput {
|
func (x *RawTx) GetVersion() Version {
|
||||||
if x != nil {
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *RawTx) GetTimelockRange() *TimelockRange {
|
type NockchainNamedSpend struct {
|
||||||
if x != nil {
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
return x.TimelockRange
|
Name *NockchainName `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
}
|
// Types that are valid to be assigned to SpendKind:
|
||||||
return nil
|
//
|
||||||
}
|
// *NockchainNamedSpend_Legacy
|
||||||
|
// *NockchainNamedSpend_Witness
|
||||||
func (x *RawTx) GetTotalFees() uint64 {
|
SpendKind isNockchainNamedSpend_SpendKind `protobuf_oneof:"spend_kind"`
|
||||||
if x != nil {
|
|
||||||
return x.TotalFees
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
type NockchainSpend 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"`
|
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *NockchainSpend) Reset() {
|
func (x *NockchainNamedSpend) Reset() {
|
||||||
*x = NockchainSpend{}
|
*x = NockchainNamedSpend{}
|
||||||
mi := &file_types_proto_msgTypes[5]
|
mi := &file_types_proto_msgTypes[5]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *NockchainSpend) String() string {
|
func (x *NockchainNamedSpend) String() string {
|
||||||
return protoimpl.X.MessageStringOf(x)
|
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]
|
mi := &file_types_proto_msgTypes[5]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
@ -427,48 +422,169 @@ func (x *NockchainSpend) ProtoReflect() protoreflect.Message {
|
|||||||
return mi.MessageOf(x)
|
return mi.MessageOf(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: Use NockchainSpend.ProtoReflect.Descriptor instead.
|
// Deprecated: Use NockchainNamedSpend.ProtoReflect.Descriptor instead.
|
||||||
func (*NockchainSpend) Descriptor() ([]byte, []int) {
|
func (*NockchainNamedSpend) Descriptor() ([]byte, []int) {
|
||||||
return file_types_proto_rawDescGZIP(), []int{5}
|
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 {
|
if x != nil {
|
||||||
return x.Signatures
|
return x.Signatures
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *NockchainSpend) GetSeeds() []*NockchainSeed {
|
func (x *NockchainSpendV0) GetSeeds() []*NockchainSeedV0 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Seeds
|
return x.Seeds
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *NockchainSpend) GetFee() uint64 {
|
func (x *NockchainSpendV0) GetFee() uint64 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Fee
|
return x.Fee
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
type NockchainNote struct {
|
type NockchainSpendV1 struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
Version Version `protobuf:"varint,1,opt,name=version,proto3,enum=nockchain.public.v1.Version" json:"version,omitempty"`
|
unknownFields protoimpl.UnknownFields
|
||||||
BlockHeight uint64 `protobuf:"varint,2,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"`
|
sizeCache protoimpl.SizeCache
|
||||||
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"`
|
func (x *NockchainSpendV1) Reset() {
|
||||||
Source *NockchainSource `protobuf:"bytes,6,opt,name=source,proto3" json:"source,omitempty"`
|
*x = NockchainSpendV1{}
|
||||||
Asset uint64 `protobuf:"varint,7,opt,name=asset,proto3" json:"asset,omitempty"`
|
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"`
|
||||||
|
// Types that are valid to be assigned to Note:
|
||||||
|
//
|
||||||
|
// *NockchainNote_V0
|
||||||
|
// *NockchainNote_V1
|
||||||
|
Note isNockchainNote_Note `protobuf_oneof:"note"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *NockchainNote) Reset() {
|
func (x *NockchainNote) Reset() {
|
||||||
*x = NockchainNote{}
|
*x = NockchainNote{}
|
||||||
mi := &file_types_proto_msgTypes[6]
|
mi := &file_types_proto_msgTypes[8]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -480,7 +596,7 @@ func (x *NockchainNote) String() string {
|
|||||||
func (*NockchainNote) ProtoMessage() {}
|
func (*NockchainNote) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *NockchainNote) ProtoReflect() protoreflect.Message {
|
func (x *NockchainNote) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_types_proto_msgTypes[6]
|
mi := &file_types_proto_msgTypes[8]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -493,58 +609,170 @@ func (x *NockchainNote) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use NockchainNote.ProtoReflect.Descriptor instead.
|
// Deprecated: Use NockchainNote.ProtoReflect.Descriptor instead.
|
||||||
func (*NockchainNote) Descriptor() ([]byte, []int) {
|
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 {
|
if x != nil {
|
||||||
return x.Version
|
return x.Version
|
||||||
}
|
}
|
||||||
return Version_V0
|
return Version_V0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *NockchainNote) GetBlockHeight() uint64 {
|
func (x *NockchainNoteV0) GetOriginPage() uint64 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.BlockHeight
|
return x.OriginPage
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *NockchainNote) GetTimelock() *TimelockIntent {
|
func (x *NockchainNoteV0) GetName() *NockchainName {
|
||||||
if x != nil {
|
|
||||||
return x.Timelock
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *NockchainNote) GetName() *NockchainName {
|
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Name
|
return x.Name
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *NockchainNote) GetLock() *NockchainLock {
|
func (x *NockchainNoteV0) GetLock() *NockchainLock {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Lock
|
return x.Lock
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *NockchainNote) GetSource() *NockchainSource {
|
func (x *NockchainNoteV0) GetSource() *NockchainSource {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Source
|
return x.Source
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *NockchainNote) GetAsset() uint64 {
|
func (x *NockchainNoteV0) GetAsset() uint64 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Asset
|
return x.Asset
|
||||||
}
|
}
|
||||||
return 0
|
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 {
|
type NockchainName struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
First string `protobuf:"bytes,1,opt,name=first,proto3" json:"first,omitempty"`
|
First string `protobuf:"bytes,1,opt,name=first,proto3" json:"first,omitempty"`
|
||||||
@ -555,7 +783,7 @@ type NockchainName struct {
|
|||||||
|
|
||||||
func (x *NockchainName) Reset() {
|
func (x *NockchainName) Reset() {
|
||||||
*x = NockchainName{}
|
*x = NockchainName{}
|
||||||
mi := &file_types_proto_msgTypes[7]
|
mi := &file_types_proto_msgTypes[11]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -567,7 +795,7 @@ func (x *NockchainName) String() string {
|
|||||||
func (*NockchainName) ProtoMessage() {}
|
func (*NockchainName) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *NockchainName) ProtoReflect() protoreflect.Message {
|
func (x *NockchainName) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_types_proto_msgTypes[7]
|
mi := &file_types_proto_msgTypes[11]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -580,7 +808,7 @@ func (x *NockchainName) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use NockchainName.ProtoReflect.Descriptor instead.
|
// Deprecated: Use NockchainName.ProtoReflect.Descriptor instead.
|
||||||
func (*NockchainName) Descriptor() ([]byte, []int) {
|
func (*NockchainName) Descriptor() ([]byte, []int) {
|
||||||
return file_types_proto_rawDescGZIP(), []int{7}
|
return file_types_proto_rawDescGZIP(), []int{11}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *NockchainName) GetFirst() string {
|
func (x *NockchainName) GetFirst() string {
|
||||||
@ -597,66 +825,6 @@ func (x *NockchainName) GetLast() string {
|
|||||||
return ""
|
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 {
|
type NockchainSignature struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
Pubkey string `protobuf:"bytes,1,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
|
Pubkey string `protobuf:"bytes,1,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
|
||||||
@ -668,7 +836,7 @@ type NockchainSignature struct {
|
|||||||
|
|
||||||
func (x *NockchainSignature) Reset() {
|
func (x *NockchainSignature) Reset() {
|
||||||
*x = NockchainSignature{}
|
*x = NockchainSignature{}
|
||||||
mi := &file_types_proto_msgTypes[9]
|
mi := &file_types_proto_msgTypes[12]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -680,7 +848,7 @@ func (x *NockchainSignature) String() string {
|
|||||||
func (*NockchainSignature) ProtoMessage() {}
|
func (*NockchainSignature) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *NockchainSignature) ProtoReflect() protoreflect.Message {
|
func (x *NockchainSignature) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_types_proto_msgTypes[9]
|
mi := &file_types_proto_msgTypes[12]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -693,7 +861,7 @@ func (x *NockchainSignature) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use NockchainSignature.ProtoReflect.Descriptor instead.
|
// Deprecated: Use NockchainSignature.ProtoReflect.Descriptor instead.
|
||||||
func (*NockchainSignature) Descriptor() ([]byte, []int) {
|
func (*NockchainSignature) Descriptor() ([]byte, []int) {
|
||||||
return file_types_proto_rawDescGZIP(), []int{9}
|
return file_types_proto_rawDescGZIP(), []int{12}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *NockchainSignature) GetPubkey() string {
|
func (x *NockchainSignature) GetPubkey() string {
|
||||||
@ -717,32 +885,32 @@ func (x *NockchainSignature) GetSig() []uint64 {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type NockchainSeed struct {
|
type NockchainSeedV0 struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
OutputSource *NockchainSource `protobuf:"bytes,1,opt,name=output_source,json=outputSource,proto3,oneof" json:"output_source,omitempty"`
|
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"`
|
LockRoot string `protobuf:"bytes,2,opt,name=lock_root,json=lockRoot,proto3" json:"lock_root,omitempty"`
|
||||||
TimelockIntent *TimelockIntent `protobuf:"bytes,3,opt,name=timelock_intent,json=timelockIntent,proto3,oneof" json:"timelock_intent,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"`
|
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"`
|
ParentHash string `protobuf:"bytes,5,opt,name=parent_hash,json=parentHash,proto3" json:"parent_hash,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *NockchainSeed) Reset() {
|
func (x *NockchainSeedV0) Reset() {
|
||||||
*x = NockchainSeed{}
|
*x = NockchainSeedV0{}
|
||||||
mi := &file_types_proto_msgTypes[10]
|
mi := &file_types_proto_msgTypes[13]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *NockchainSeed) String() string {
|
func (x *NockchainSeedV0) String() string {
|
||||||
return protoimpl.X.MessageStringOf(x)
|
return protoimpl.X.MessageStringOf(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*NockchainSeed) ProtoMessage() {}
|
func (*NockchainSeedV0) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *NockchainSeed) ProtoReflect() protoreflect.Message {
|
func (x *NockchainSeedV0) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_types_proto_msgTypes[10]
|
mi := &file_types_proto_msgTypes[13]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -753,40 +921,40 @@ func (x *NockchainSeed) ProtoReflect() protoreflect.Message {
|
|||||||
return mi.MessageOf(x)
|
return mi.MessageOf(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: Use NockchainSeed.ProtoReflect.Descriptor instead.
|
// Deprecated: Use NockchainSeedV0.ProtoReflect.Descriptor instead.
|
||||||
func (*NockchainSeed) Descriptor() ([]byte, []int) {
|
func (*NockchainSeedV0) Descriptor() ([]byte, []int) {
|
||||||
return file_types_proto_rawDescGZIP(), []int{10}
|
return file_types_proto_rawDescGZIP(), []int{13}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *NockchainSeed) GetOutputSource() *NockchainSource {
|
func (x *NockchainSeedV0) GetOutputSource() *NockchainSource {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.OutputSource
|
return x.OutputSource
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *NockchainSeed) GetRecipient() *NockchainLock {
|
func (x *NockchainSeedV0) GetLockRoot() string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Recipient
|
return x.LockRoot
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *NockchainSeedV0) GetNoteData() *NockchainLock {
|
||||||
|
if x != nil {
|
||||||
|
return x.NoteData
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *NockchainSeed) GetTimelockIntent() *TimelockIntent {
|
func (x *NockchainSeedV0) GetGift() uint64 {
|
||||||
if x != nil {
|
|
||||||
return x.TimelockIntent
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *NockchainSeed) GetGift() uint64 {
|
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Gift
|
return x.Gift
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *NockchainSeed) GetParentHash() string {
|
func (x *NockchainSeedV0) GetParentHash() string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.ParentHash
|
return x.ParentHash
|
||||||
}
|
}
|
||||||
@ -803,7 +971,7 @@ type NockchainLock struct {
|
|||||||
|
|
||||||
func (x *NockchainLock) Reset() {
|
func (x *NockchainLock) Reset() {
|
||||||
*x = NockchainLock{}
|
*x = NockchainLock{}
|
||||||
mi := &file_types_proto_msgTypes[11]
|
mi := &file_types_proto_msgTypes[14]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -815,7 +983,7 @@ func (x *NockchainLock) String() string {
|
|||||||
func (*NockchainLock) ProtoMessage() {}
|
func (*NockchainLock) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *NockchainLock) ProtoReflect() protoreflect.Message {
|
func (x *NockchainLock) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_types_proto_msgTypes[11]
|
mi := &file_types_proto_msgTypes[14]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -828,7 +996,7 @@ func (x *NockchainLock) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use NockchainLock.ProtoReflect.Descriptor instead.
|
// Deprecated: Use NockchainLock.ProtoReflect.Descriptor instead.
|
||||||
func (*NockchainLock) Descriptor() ([]byte, []int) {
|
func (*NockchainLock) Descriptor() ([]byte, []int) {
|
||||||
return file_types_proto_rawDescGZIP(), []int{11}
|
return file_types_proto_rawDescGZIP(), []int{14}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *NockchainLock) GetKeysRequired() uint64 {
|
func (x *NockchainLock) GetKeysRequired() uint64 {
|
||||||
@ -855,7 +1023,7 @@ type NockchainSource struct {
|
|||||||
|
|
||||||
func (x *NockchainSource) Reset() {
|
func (x *NockchainSource) Reset() {
|
||||||
*x = NockchainSource{}
|
*x = NockchainSource{}
|
||||||
mi := &file_types_proto_msgTypes[12]
|
mi := &file_types_proto_msgTypes[15]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -867,7 +1035,7 @@ func (x *NockchainSource) String() string {
|
|||||||
func (*NockchainSource) ProtoMessage() {}
|
func (*NockchainSource) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *NockchainSource) ProtoReflect() protoreflect.Message {
|
func (x *NockchainSource) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_types_proto_msgTypes[12]
|
mi := &file_types_proto_msgTypes[15]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -880,7 +1048,7 @@ func (x *NockchainSource) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use NockchainSource.ProtoReflect.Descriptor instead.
|
// Deprecated: Use NockchainSource.ProtoReflect.Descriptor instead.
|
||||||
func (*NockchainSource) Descriptor() ([]byte, []int) {
|
func (*NockchainSource) Descriptor() ([]byte, []int) {
|
||||||
return file_types_proto_rawDescGZIP(), []int{12}
|
return file_types_proto_rawDescGZIP(), []int{15}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *NockchainSource) GetSource() string {
|
func (x *NockchainSource) GetSource() string {
|
||||||
@ -901,63 +1069,67 @@ var File_types_proto protoreflect.FileDescriptor
|
|||||||
|
|
||||||
const file_types_proto_rawDesc = "" +
|
const file_types_proto_rawDesc = "" +
|
||||||
"\n" +
|
"\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" +
|
"\bScanData\x12\x16\n" +
|
||||||
"\x06pubkey\x18\x01 \x01(\tR\x06pubkey\x12:\n" +
|
"\x06pubkey\x18\x01 \x01(\tR\x06pubkey\x120\n" +
|
||||||
"\x04data\x18\x02 \x01(\v2&.nockchain.public.v1.WalletBalanceDataR\x04data\"\xb4\x01\n" +
|
"\x04data\x18\x02 \x01(\v2\x1c.nockchain.public.v2.BalanceR\x04data\"\xb4\x01\n" +
|
||||||
"\x0eTimelockIntent\x12C\n" +
|
"\x0eTimelockIntent\x12C\n" +
|
||||||
"\babsolute\x18\x01 \x01(\v2\".nockchain.public.v1.TimelockRangeH\x00R\babsolute\x88\x01\x01\x12C\n" +
|
"\babsolute\x18\x01 \x01(\v2\".nockchain.public.v2.TimelockRangeH\x00R\babsolute\x88\x01\x01\x12C\n" +
|
||||||
"\brelative\x18\x02 \x01(\v2\".nockchain.public.v1.TimelockRangeH\x01R\brelative\x88\x01\x01B\v\n" +
|
"\brelative\x18\x02 \x01(\v2\".nockchain.public.v2.TimelockRangeH\x01R\brelative\x88\x01\x01B\v\n" +
|
||||||
"\t_absoluteB\v\n" +
|
"\t_absoluteB\v\n" +
|
||||||
"\t_relative\"\x8b\x01\n" +
|
"\t_relative\"\x8b\x01\n" +
|
||||||
"\rTimelockRange\x124\n" +
|
"\rTimelockRange\x124\n" +
|
||||||
"\x03min\x18\x01 \x01(\v2\x1d.nockchain.public.v1.TimelockH\x00R\x03min\x88\x01\x01\x124\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.v1.TimelockH\x01R\x03max\x88\x01\x01B\x06\n" +
|
"\x03max\x18\x02 \x01(\v2\x1d.nockchain.public.v2.TimelockH\x01R\x03max\x88\x01\x01B\x06\n" +
|
||||||
"\x04_minB\x06\n" +
|
"\x04_minB\x06\n" +
|
||||||
"\x04_max\" \n" +
|
"\x04_max\" \n" +
|
||||||
"\bTimelock\x12\x14\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" +
|
"\x05RawTx\x12\x13\n" +
|
||||||
"\x05tx_id\x18\x01 \x01(\tR\x04txId\x12;\n" +
|
"\x05tx_id\x18\x01 \x01(\tR\x04txId\x126\n" +
|
||||||
"\x06inputs\x18\x02 \x03(\v2#.nockchain.public.v1.NockchainInputR\x06inputs\x12I\n" +
|
"\aversion\x18\x02 \x01(\x0e2\x1c.nockchain.public.v2.VersionR\aversion\x12K\n" +
|
||||||
"\x0etimelock_range\x18\x03 \x01(\v2\".nockchain.public.v1.TimelockRangeR\rtimelockRange\x12\x1d\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" +
|
"\n" +
|
||||||
"total_fees\x18\x04 \x01(\x04R\ttotalFees\"\xa5\x01\n" +
|
"spend_kind\"\xa9\x01\n" +
|
||||||
"\x0eNockchainSpend\x12G\n" +
|
"\x10NockchainSpendV0\x12G\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"signatures\x18\x01 \x03(\v2'.nockchain.public.v1.NockchainSignatureR\n" +
|
"signatures\x18\x01 \x03(\v2'.nockchain.public.v2.NockchainSignatureR\n" +
|
||||||
"signatures\x128\n" +
|
"signatures\x12:\n" +
|
||||||
"\x05seeds\x18\x02 \x03(\v2\".nockchain.public.v1.NockchainSeedR\x05seeds\x12\x10\n" +
|
"\x05seeds\x18\x02 \x03(\v2$.nockchain.public.v2.NockchainSeedV0R\x05seeds\x12\x10\n" +
|
||||||
"\x03fee\x18\x03 \x01(\x04R\x03fee\"\x81\x03\n" +
|
"\x03fee\x18\x03 \x01(\x04R\x03fee\"\x12\n" +
|
||||||
|
"\x10NockchainSpendV1\"\x87\x01\n" +
|
||||||
"\rNockchainNote\x126\n" +
|
"\rNockchainNote\x126\n" +
|
||||||
"\aversion\x18\x01 \x01(\x0e2\x1c.nockchain.public.v1.VersionR\aversion\x12!\n" +
|
"\x02v0\x18\x01 \x01(\v2$.nockchain.public.v2.NockchainNoteV0H\x00R\x02v0\x126\n" +
|
||||||
"\fblock_height\x18\x02 \x01(\x04R\vblockHeight\x12D\n" +
|
"\x02v1\x18\x02 \x01(\v2$.nockchain.public.v2.NockchainNoteV1H\x00R\x02v1B\x06\n" +
|
||||||
"\btimelock\x18\x03 \x01(\v2#.nockchain.public.v1.TimelockIntentH\x00R\btimelock\x88\x01\x01\x126\n" +
|
"\x04note\"\xae\x02\n" +
|
||||||
"\x04name\x18\x04 \x01(\v2\".nockchain.public.v1.NockchainNameR\x04name\x126\n" +
|
"\x0fNockchainNoteV0\x126\n" +
|
||||||
"\x04lock\x18\x05 \x01(\v2\".nockchain.public.v1.NockchainLockR\x04lock\x12<\n" +
|
"\aversion\x18\x01 \x01(\x0e2\x1c.nockchain.public.v2.VersionR\aversion\x12\x1f\n" +
|
||||||
"\x06source\x18\x06 \x01(\v2$.nockchain.public.v1.NockchainSourceR\x06source\x12\x14\n" +
|
"\vorigin_page\x18\x02 \x01(\x04R\n" +
|
||||||
"\x05asset\x18\a \x01(\x04R\x05assetB\v\n" +
|
"originPage\x126\n" +
|
||||||
"\t_timelock\"9\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" +
|
"\rNockchainName\x12\x14\n" +
|
||||||
"\x05first\x18\x01 \x01(\tR\x05first\x12\x12\n" +
|
"\x05first\x18\x01 \x01(\tR\x05first\x12\x12\n" +
|
||||||
"\x04last\x18\x02 \x01(\tR\x04last\"\xbb\x01\n" +
|
"\x04last\x18\x02 \x01(\tR\x04last\"R\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" +
|
|
||||||
"\x12NockchainSignature\x12\x16\n" +
|
"\x12NockchainSignature\x12\x16\n" +
|
||||||
"\x06pubkey\x18\x01 \x01(\tR\x06pubkey\x12\x12\n" +
|
"\x06pubkey\x18\x01 \x01(\tR\x06pubkey\x12\x12\n" +
|
||||||
"\x04chal\x18\x02 \x03(\x04R\x04chal\x12\x10\n" +
|
"\x04chal\x18\x02 \x03(\x04R\x04chal\x12\x10\n" +
|
||||||
"\x03sig\x18\x03 \x03(\x04R\x03sig\"\xcf\x02\n" +
|
"\x03sig\x18\x03 \x03(\x04R\x03sig\"\x86\x02\n" +
|
||||||
"\rNockchainSeed\x12N\n" +
|
"\x0fNockchainSeedV0\x12N\n" +
|
||||||
"\routput_source\x18\x01 \x01(\v2$.nockchain.public.v1.NockchainSourceH\x00R\foutputSource\x88\x01\x01\x12@\n" +
|
"\routput_source\x18\x01 \x01(\v2$.nockchain.public.v2.NockchainSourceH\x00R\foutputSource\x88\x01\x01\x12\x1b\n" +
|
||||||
"\trecipient\x18\x02 \x01(\v2\".nockchain.public.v1.NockchainLockR\trecipient\x12Q\n" +
|
"\tlock_root\x18\x02 \x01(\tR\blockRoot\x12?\n" +
|
||||||
"\x0ftimelock_intent\x18\x03 \x01(\v2#.nockchain.public.v1.TimelockIntentH\x01R\x0etimelockIntent\x88\x01\x01\x12\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" +
|
"\x04gift\x18\x04 \x01(\x04R\x04gift\x12\x1f\n" +
|
||||||
"\vparent_hash\x18\x05 \x01(\tR\n" +
|
"\vparent_hash\x18\x05 \x01(\tR\n" +
|
||||||
"parentHashB\x10\n" +
|
"parentHashB\x10\n" +
|
||||||
"\x0e_output_sourceB\x12\n" +
|
"\x0e_output_source\"N\n" +
|
||||||
"\x10_timelock_intent\"N\n" +
|
|
||||||
"\rNockchainLock\x12#\n" +
|
"\rNockchainLock\x12#\n" +
|
||||||
"\rkeys_required\x18\x01 \x01(\x04R\fkeysRequired\x12\x18\n" +
|
"\rkeys_required\x18\x01 \x01(\x04R\fkeysRequired\x12\x18\n" +
|
||||||
"\apubkeys\x18\x02 \x03(\tR\apubkeys\"J\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_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{
|
var file_types_proto_goTypes = []any{
|
||||||
(ImportType)(0), // 0: nockchain.public.v1.ImportType
|
(ImportType)(0), // 0: nockchain.public.v2.ImportType
|
||||||
(Version)(0), // 1: nockchain.public.v1.Version
|
(Version)(0), // 1: nockchain.public.v2.Version
|
||||||
(*ScanData)(nil), // 2: nockchain.public.v1.ScanData
|
(*ScanData)(nil), // 2: nockchain.public.v2.ScanData
|
||||||
(*TimelockIntent)(nil), // 3: nockchain.public.v1.TimelockIntent
|
(*TimelockIntent)(nil), // 3: nockchain.public.v2.TimelockIntent
|
||||||
(*TimelockRange)(nil), // 4: nockchain.public.v1.TimelockRange
|
(*TimelockRange)(nil), // 4: nockchain.public.v2.TimelockRange
|
||||||
(*Timelock)(nil), // 5: nockchain.public.v1.Timelock
|
(*Timelock)(nil), // 5: nockchain.public.v2.Timelock
|
||||||
(*RawTx)(nil), // 6: nockchain.public.v1.RawTx
|
(*RawTx)(nil), // 6: nockchain.public.v2.RawTx
|
||||||
(*NockchainSpend)(nil), // 7: nockchain.public.v1.NockchainSpend
|
(*NockchainNamedSpend)(nil), // 7: nockchain.public.v2.NockchainNamedSpend
|
||||||
(*NockchainNote)(nil), // 8: nockchain.public.v1.NockchainNote
|
(*NockchainSpendV0)(nil), // 8: nockchain.public.v2.NockchainSpendV0
|
||||||
(*NockchainName)(nil), // 9: nockchain.public.v1.NockchainName
|
(*NockchainSpendV1)(nil), // 9: nockchain.public.v2.NockchainSpendV1
|
||||||
(*NockchainInput)(nil), // 10: nockchain.public.v1.NockchainInput
|
(*NockchainNote)(nil), // 10: nockchain.public.v2.NockchainNote
|
||||||
(*NockchainSignature)(nil), // 11: nockchain.public.v1.NockchainSignature
|
(*NockchainNoteV0)(nil), // 11: nockchain.public.v2.NockchainNoteV0
|
||||||
(*NockchainSeed)(nil), // 12: nockchain.public.v1.NockchainSeed
|
(*NockchainNoteV1)(nil), // 12: nockchain.public.v2.NockchainNoteV1
|
||||||
(*NockchainLock)(nil), // 13: nockchain.public.v1.NockchainLock
|
(*NockchainName)(nil), // 13: nockchain.public.v2.NockchainName
|
||||||
(*NockchainSource)(nil), // 14: nockchain.public.v1.NockchainSource
|
(*NockchainSignature)(nil), // 14: nockchain.public.v2.NockchainSignature
|
||||||
(*WalletBalanceData)(nil), // 15: nockchain.public.v1.WalletBalanceData
|
(*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{
|
var file_types_proto_depIdxs = []int32{
|
||||||
15, // 0: nockchain.public.v1.ScanData.data:type_name -> nockchain.public.v1.WalletBalanceData
|
18, // 0: nockchain.public.v2.ScanData.data:type_name -> nockchain.public.v2.Balance
|
||||||
4, // 1: nockchain.public.v1.TimelockIntent.absolute:type_name -> nockchain.public.v1.TimelockRange
|
4, // 1: nockchain.public.v2.TimelockIntent.absolute:type_name -> nockchain.public.v2.TimelockRange
|
||||||
4, // 2: nockchain.public.v1.TimelockIntent.relative:type_name -> nockchain.public.v1.TimelockRange
|
4, // 2: nockchain.public.v2.TimelockIntent.relative:type_name -> nockchain.public.v2.TimelockRange
|
||||||
5, // 3: nockchain.public.v1.TimelockRange.min:type_name -> nockchain.public.v1.Timelock
|
5, // 3: nockchain.public.v2.TimelockRange.min:type_name -> nockchain.public.v2.Timelock
|
||||||
5, // 4: nockchain.public.v1.TimelockRange.max:type_name -> nockchain.public.v1.Timelock
|
5, // 4: nockchain.public.v2.TimelockRange.max:type_name -> nockchain.public.v2.Timelock
|
||||||
10, // 5: nockchain.public.v1.RawTx.inputs:type_name -> nockchain.public.v1.NockchainInput
|
1, // 5: nockchain.public.v2.RawTx.version:type_name -> nockchain.public.v2.Version
|
||||||
4, // 6: nockchain.public.v1.RawTx.timelock_range:type_name -> nockchain.public.v1.TimelockRange
|
7, // 6: nockchain.public.v2.RawTx.named_spends:type_name -> nockchain.public.v2.NockchainNamedSpend
|
||||||
11, // 7: nockchain.public.v1.NockchainSpend.signatures:type_name -> nockchain.public.v1.NockchainSignature
|
13, // 7: nockchain.public.v2.NockchainNamedSpend.name:type_name -> nockchain.public.v2.NockchainName
|
||||||
12, // 8: nockchain.public.v1.NockchainSpend.seeds:type_name -> nockchain.public.v1.NockchainSeed
|
8, // 8: nockchain.public.v2.NockchainNamedSpend.legacy:type_name -> nockchain.public.v2.NockchainSpendV0
|
||||||
1, // 9: nockchain.public.v1.NockchainNote.version:type_name -> nockchain.public.v1.Version
|
9, // 9: nockchain.public.v2.NockchainNamedSpend.witness:type_name -> nockchain.public.v2.NockchainSpendV1
|
||||||
3, // 10: nockchain.public.v1.NockchainNote.timelock:type_name -> nockchain.public.v1.TimelockIntent
|
14, // 10: nockchain.public.v2.NockchainSpendV0.signatures:type_name -> nockchain.public.v2.NockchainSignature
|
||||||
9, // 11: nockchain.public.v1.NockchainNote.name:type_name -> nockchain.public.v1.NockchainName
|
15, // 11: nockchain.public.v2.NockchainSpendV0.seeds:type_name -> nockchain.public.v2.NockchainSeedV0
|
||||||
13, // 12: nockchain.public.v1.NockchainNote.lock:type_name -> nockchain.public.v1.NockchainLock
|
11, // 12: nockchain.public.v2.NockchainNote.v0:type_name -> nockchain.public.v2.NockchainNoteV0
|
||||||
14, // 13: nockchain.public.v1.NockchainNote.source:type_name -> nockchain.public.v1.NockchainSource
|
12, // 13: nockchain.public.v2.NockchainNote.v1:type_name -> nockchain.public.v2.NockchainNoteV1
|
||||||
9, // 14: nockchain.public.v1.NockchainInput.name:type_name -> nockchain.public.v1.NockchainName
|
1, // 14: nockchain.public.v2.NockchainNoteV0.version:type_name -> nockchain.public.v2.Version
|
||||||
8, // 15: nockchain.public.v1.NockchainInput.note:type_name -> nockchain.public.v1.NockchainNote
|
13, // 15: nockchain.public.v2.NockchainNoteV0.name:type_name -> nockchain.public.v2.NockchainName
|
||||||
7, // 16: nockchain.public.v1.NockchainInput.spend:type_name -> nockchain.public.v1.NockchainSpend
|
16, // 16: nockchain.public.v2.NockchainNoteV0.lock:type_name -> nockchain.public.v2.NockchainLock
|
||||||
14, // 17: nockchain.public.v1.NockchainSeed.output_source:type_name -> nockchain.public.v1.NockchainSource
|
17, // 17: nockchain.public.v2.NockchainNoteV0.source:type_name -> nockchain.public.v2.NockchainSource
|
||||||
13, // 18: nockchain.public.v1.NockchainSeed.recipient:type_name -> nockchain.public.v1.NockchainLock
|
17, // 18: nockchain.public.v2.NockchainSeedV0.output_source:type_name -> nockchain.public.v2.NockchainSource
|
||||||
3, // 19: nockchain.public.v1.NockchainSeed.timelock_intent:type_name -> nockchain.public.v1.TimelockIntent
|
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 output_type
|
||||||
20, // [20:20] is the sub-list for method input_type
|
20, // [20:20] is the sub-list for method input_type
|
||||||
20, // [20:20] is the sub-list for extension type_name
|
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_blockchain_proto_init()
|
||||||
file_types_proto_msgTypes[1].OneofWrappers = []any{}
|
file_types_proto_msgTypes[1].OneofWrappers = []any{}
|
||||||
file_types_proto_msgTypes[2].OneofWrappers = []any{}
|
file_types_proto_msgTypes[2].OneofWrappers = []any{}
|
||||||
file_types_proto_msgTypes[6].OneofWrappers = []any{}
|
file_types_proto_msgTypes[5].OneofWrappers = []any{
|
||||||
file_types_proto_msgTypes[10].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{}
|
type x struct{}
|
||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_types_proto_rawDesc), len(file_types_proto_rawDesc)),
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_types_proto_rawDesc), len(file_types_proto_rawDesc)),
|
||||||
NumEnums: 2,
|
NumEnums: 2,
|
||||||
NumMessages: 13,
|
NumMessages: 16,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 0,
|
NumServices: 0,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,24 +1,17 @@
|
|||||||
// nockchain/common/v1/blockchain.proto
|
// nockchain/common/v2/blockchain.proto
|
||||||
|
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
package nockchain.public.v1;
|
package nockchain.public.v2;
|
||||||
|
|
||||||
import "primitives.proto";
|
import "primitives.proto";
|
||||||
import "pagination.proto";
|
import "pagination.proto";
|
||||||
option go_package = "./;nockchain";
|
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
|
message Balance {
|
||||||
// the returned page token to continue paging against the same snapshot.
|
repeated BalanceEntry notes = 1;
|
||||||
BlockHeight height = 2; // block height where balance was computed
|
BlockHeight height = 2;
|
||||||
optional Hash block_id = 3; // block where balance was computed
|
optional Hash block_id = 3;
|
||||||
|
|
||||||
// Pagination cursor for fetching the next page in a paginated view.
|
|
||||||
// When empty, there are no further results for this snapshot.
|
|
||||||
PageResponse page = 4;
|
PageResponse page = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,39 +20,107 @@ message BalanceEntry {
|
|||||||
Note note = 2;
|
Note note = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// the string key is the name of the input
|
|
||||||
// message RawTransaction { map<Name, Input> inputs = 1; }
|
|
||||||
message RawTransaction {
|
message RawTransaction {
|
||||||
repeated NamedInput named_inputs = 1;
|
NoteVersion version = 1;
|
||||||
TimeLockRangeAbsolute timelock_range = 2;
|
Hash id = 2;
|
||||||
Nicks total_fees = 3;
|
repeated SpendEntry spends = 3;
|
||||||
Hash id = 4;
|
|
||||||
}
|
}
|
||||||
|
message SpendEntry {
|
||||||
message NamedInput {
|
|
||||||
Name name = 1;
|
Name name = 1;
|
||||||
Input input = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message Input {
|
|
||||||
Note note = 1;
|
|
||||||
Spend spend = 2;
|
Spend spend = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message Spend {
|
message Spend {
|
||||||
|
oneof spend_kind {
|
||||||
|
LegacySpend legacy = 1;
|
||||||
|
WitnessSpend witness = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message LegacySpend {
|
||||||
Signature signature = 1;
|
Signature signature = 1;
|
||||||
repeated Seed seeds = 2;
|
repeated Seed seeds = 2;
|
||||||
Nicks miner_fee_nicks = 3;
|
Nicks miner_fee_nicks = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message WitnessSpend {
|
||||||
|
Witness witness = 1;
|
||||||
|
repeated Seed seeds = 2;
|
||||||
|
Nicks fee = 3;
|
||||||
|
}
|
||||||
|
|
||||||
message Seed {
|
message Seed {
|
||||||
optional OutputSource output_source = 1;
|
// Absent when the seed originates from a coinbase output.
|
||||||
Lock recipient = 2;
|
Source output_source = 1;
|
||||||
optional TimeLockIntent timelock_intent = 3;
|
Hash lock_root = 2;
|
||||||
|
NoteData note_data = 3;
|
||||||
Nicks gift = 4;
|
Nicks gift = 4;
|
||||||
Hash parent_hash = 5;
|
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 OutputSource { optional Source source = 1; }
|
||||||
|
|
||||||
message Source {
|
message Source {
|
||||||
@ -110,7 +171,14 @@ message Name {
|
|||||||
Hash last = 2;
|
Hash last = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
message Note {
|
message Note {
|
||||||
|
oneof note_version {
|
||||||
|
NoteV0 legacy = 1;
|
||||||
|
NoteV1 v1 = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
message NoteV0 {
|
||||||
BlockHeight origin_page = 1; // page-number when added to balance
|
BlockHeight origin_page = 1; // page-number when added to balance
|
||||||
optional TimeLockIntent timelock = 2; // enforced timelock
|
optional TimeLockIntent timelock = 2; // enforced timelock
|
||||||
Name name = 3; // nname (human/name label)
|
Name name = 3; // nname (human/name label)
|
||||||
@ -120,11 +188,27 @@ message Note {
|
|||||||
NoteVersion version = 7; // note version (currently 0)
|
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 Signature { repeated SignatureEntry entries = 1; }
|
||||||
|
|
||||||
message SignatureEntry {
|
message SignatureEntry {
|
||||||
SchnorrPubkey schnorr_pubkey =
|
SchnorrPubkey schnorr_pubkey = 1; // serialized pubkey corresponding to the signer
|
||||||
1; // serialized pubkey corresponding to the signer
|
|
||||||
SchnorrSignature signature = 2;
|
SchnorrSignature signature = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
package nockchain.public.v1;
|
package nockchain.public.v2;
|
||||||
|
|
||||||
import "blockchain.proto";
|
import "blockchain.proto";
|
||||||
import "primitives.proto";
|
import "primitives.proto";
|
||||||
@ -21,12 +21,15 @@ service NockchainService {
|
|||||||
|
|
||||||
message WalletGetBalanceRequest {
|
message WalletGetBalanceRequest {
|
||||||
// pubkey cheetah point; specific address, or current wallet
|
// 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
|
// Pagination parameters. The server enforces limits and may return fewer
|
||||||
// entries than requested to respect message size and policy. For consistent
|
// entries than requested to respect message size and policy. For consistent
|
||||||
// paging across a stable snapshot, pass along the returned page_token from
|
// paging across a stable snapshot, pass along the returned page_token from
|
||||||
// the previous response without modification.
|
// the previous response without modification.
|
||||||
PageRequest page = 2;
|
PageRequest page = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message WalletGetBalanceResponse {
|
message WalletGetBalanceResponse {
|
||||||
@ -35,7 +38,7 @@ message WalletGetBalanceResponse {
|
|||||||
// Continue paging using `balance.page.next_page_token` until empty. Clients
|
// Continue paging using `balance.page.next_page_token` until empty. Clients
|
||||||
// should treat the page token as opaque; it may encode snapshot identity
|
// should treat the page token as opaque; it may encode snapshot identity
|
||||||
// and the last returned key.
|
// and the last returned key.
|
||||||
WalletBalanceData balance = 1;
|
Balance balance = 1;
|
||||||
ErrorStatus error = 2;
|
ErrorStatus error = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
package nockchain.public.v1;
|
package nockchain.public.v2;
|
||||||
option go_package = "./;nockchain";
|
option go_package = "./;nockchain";
|
||||||
|
|
||||||
// Generic pagination parameters for list-style RPCs.
|
// Generic pagination parameters for list-style RPCs.
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
package nockchain.public.v1;
|
package nockchain.public.v2;
|
||||||
option go_package = "./;nockchain";
|
option go_package = "./;nockchain";
|
||||||
|
|
||||||
message ErrorStatus {
|
message ErrorStatus {
|
||||||
@ -63,6 +63,10 @@ message Base58Hash {
|
|||||||
string hash = 1;
|
string hash = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message Base58Pubkey {
|
||||||
|
string key = 1;
|
||||||
|
}
|
||||||
|
|
||||||
// pub struct SchnorrPubkey(pub CheetahPoint);
|
// pub struct SchnorrPubkey(pub CheetahPoint);
|
||||||
message SchnorrPubkey { CheetahPoint value = 1; }
|
message SchnorrPubkey { CheetahPoint value = 1; }
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package nockchain.public.v1;
|
package nockchain.public.v2;
|
||||||
|
|
||||||
option go_package = "./;nockchain";
|
option go_package = "./;nockchain";
|
||||||
|
|
||||||
@ -68,15 +68,13 @@ message DeriveChildResponse {
|
|||||||
message CreateTxRequest {
|
message CreateTxRequest {
|
||||||
string names = 1;
|
string names = 1;
|
||||||
string recipients = 2;
|
string recipients = 2;
|
||||||
string gifts = 3;
|
uint64 fee = 3;
|
||||||
uint64 fee = 4;
|
bool is_master_key = 4;
|
||||||
bool is_master_key = 5;
|
string seed = 5;
|
||||||
string key = 6;
|
uint64 index = 6;
|
||||||
string chain_code = 7;
|
bool hardened = 7;
|
||||||
uint64 index = 8;
|
uint64 version = 8;
|
||||||
bool hardened = 9;
|
string refund_address = 9;
|
||||||
uint64 version = 10;
|
|
||||||
TimelockIntent timelock_intent = 11;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message CreateTxResponse {
|
message CreateTxResponse {
|
||||||
@ -100,6 +98,7 @@ message ScanRequest {
|
|||||||
uint64 search_depth = 3;
|
uint64 search_depth = 3;
|
||||||
bool include_timelocks = 4;
|
bool include_timelocks = 4;
|
||||||
bool include_multisig = 5;
|
bool include_multisig = 5;
|
||||||
|
uint64 version = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
message ScanResponse {
|
message ScanResponse {
|
||||||
@ -107,11 +106,14 @@ message ScanResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message GetBalanceRequest {
|
message GetBalanceRequest {
|
||||||
string address = 1;
|
oneof selector {
|
||||||
|
string address = 1;
|
||||||
|
string first_name = 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
message GetBalanceResponse {
|
message GetBalanceResponse {
|
||||||
WalletBalanceData data = 1;
|
Balance data = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message SendTransactionRequest {
|
message SendTransactionRequest {
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package nockchain.public.v1;
|
package nockchain.public.v2;
|
||||||
|
|
||||||
option go_package = "./;nockchain";
|
option go_package = "./;nockchain";
|
||||||
|
|
||||||
import "blockchain.proto";
|
import "blockchain.proto";
|
||||||
message ScanData {
|
message ScanData {
|
||||||
string pubkey = 1;
|
string pubkey = 1;
|
||||||
WalletBalanceData data = 2;
|
Balance data = 2;
|
||||||
}
|
}
|
||||||
enum ImportType {
|
enum ImportType {
|
||||||
UNDEFINED = 0;
|
UNDEFINED = 0;
|
||||||
@ -31,51 +31,65 @@ message Timelock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message RawTx {
|
message RawTx {
|
||||||
string tx_id = 1;
|
string tx_id = 1;
|
||||||
repeated NockchainInput inputs = 2;
|
Version version = 2;
|
||||||
TimelockRange timelock_range = 3;
|
repeated NockchainNamedSpend named_spends = 3;
|
||||||
uint64 total_fees = 4;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message NockchainSpend {
|
message NockchainNamedSpend {
|
||||||
|
NockchainName name = 1;
|
||||||
|
oneof spend_kind {
|
||||||
|
NockchainSpendV0 legacy = 2;
|
||||||
|
NockchainSpendV1 witness = 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message NockchainSpendV0 {
|
||||||
repeated NockchainSignature signatures = 1;
|
repeated NockchainSignature signatures = 1;
|
||||||
repeated NockchainSeed seeds = 2;
|
repeated NockchainSeedV0 seeds = 2;
|
||||||
uint64 fee = 3;
|
uint64 fee = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message NockchainSpendV1 {
|
||||||
|
}
|
||||||
|
|
||||||
message NockchainNote {
|
message NockchainNote {
|
||||||
|
oneof note {
|
||||||
|
NockchainNoteV0 v0 = 1;
|
||||||
|
NockchainNoteV1 v1 = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
message NockchainNoteV0 {
|
||||||
Version version = 1;
|
Version version = 1;
|
||||||
uint64 block_height = 2;
|
uint64 origin_page = 2;
|
||||||
optional TimelockIntent timelock = 3;
|
NockchainName name = 3;
|
||||||
NockchainName name = 4;
|
|
||||||
NockchainLock lock = 5;
|
NockchainLock lock = 5;
|
||||||
NockchainSource source = 6;
|
NockchainSource source = 6;
|
||||||
uint64 asset =7;
|
uint64 asset =7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message NockchainNoteV1 {
|
||||||
|
}
|
||||||
|
|
||||||
message NockchainName {
|
message NockchainName {
|
||||||
string first = 1;
|
string first = 1;
|
||||||
string last = 2;
|
string last = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message NockchainInput {
|
|
||||||
NockchainName name = 1;
|
|
||||||
NockchainNote note = 2;
|
|
||||||
NockchainSpend spend = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
message NockchainSignature {
|
message NockchainSignature {
|
||||||
string pubkey = 1;
|
string pubkey = 1;
|
||||||
repeated uint64 chal = 2;
|
repeated uint64 chal = 2;
|
||||||
repeated uint64 sig = 3;
|
repeated uint64 sig = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message NockchainSeed {
|
message NockchainSeedV0 {
|
||||||
optional NockchainSource output_source = 1;
|
optional NockchainSource output_source = 1;
|
||||||
NockchainLock recipient = 2;
|
string lock_root = 2;
|
||||||
optional TimelockIntent timelock_intent = 3;
|
NockchainLock note_data = 3;
|
||||||
uint64 gift = 4;
|
uint64 gift = 4;
|
||||||
string parent_hash = 5;
|
string parent_hash = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
message NockchainLock {
|
message NockchainLock {
|
||||||
uint64 keys_required = 1;
|
uint64 keys_required = 1;
|
||||||
repeated string pubkeys = 2;
|
repeated string pubkeys = 2;
|
||||||
|
|||||||
@ -41,26 +41,44 @@ func (nc *NockchainClient) Close() error {
|
|||||||
return nc.conn.Close()
|
return nc.conn.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (nc *NockchainClient) WalletGetBalance(address string) (*nockchain.WalletBalanceData, error) {
|
func (nc *NockchainClient) WalletGetBalance(req *nockchain.GetBalanceRequest) (*nockchain.Balance, error) {
|
||||||
pageToken := ""
|
pageToken := ""
|
||||||
allNotes := []*nockchain.BalanceEntry{}
|
allNotes := []*nockchain.BalanceEntry{}
|
||||||
var height *nockchain.BlockHeight
|
var height *nockchain.BlockHeight
|
||||||
var blockId *nockchain.Hash
|
var blockId *nockchain.Hash
|
||||||
|
page := &nockchain.PageRequest{
|
||||||
|
ClientPageItemsLimit: 0,
|
||||||
|
PageToken: pageToken,
|
||||||
|
MaxBytes: 0,
|
||||||
|
}
|
||||||
for {
|
for {
|
||||||
req := nockchain.WalletGetBalanceRequest{
|
var request *nockchain.WalletGetBalanceRequest
|
||||||
Address: address,
|
switch req.Selector.(type) {
|
||||||
Page: &nockchain.PageRequest{
|
case *nockchain.GetBalanceRequest_Address:
|
||||||
ClientPageItemsLimit: 0,
|
request = &nockchain.WalletGetBalanceRequest{
|
||||||
PageToken: pageToken,
|
Selector: &nockchain.WalletGetBalanceRequest_Address{
|
||||||
MaxBytes: 0,
|
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(), &req)
|
resp, err := nc.client.WalletGetBalance(context.Background(), request)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
balance := nockchain.WalletBalanceData{}
|
balance := nockchain.Balance{}
|
||||||
switch resp.Result.(type) {
|
switch resp.Result.(type) {
|
||||||
case *nockchain.WalletGetBalanceResponse_Balance:
|
case *nockchain.WalletGetBalanceResponse_Balance:
|
||||||
balance = *resp.GetBalance()
|
balance = *resp.GetBalance()
|
||||||
@ -84,9 +102,11 @@ func (nc *NockchainClient) WalletGetBalance(address string) (*nockchain.WalletBa
|
|||||||
break
|
break
|
||||||
} else {
|
} else {
|
||||||
pageToken = balance.Page.NextPageToken
|
pageToken = balance.Page.NextPageToken
|
||||||
|
page.PageToken = pageToken
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return &nockchain.WalletBalanceData{
|
|
||||||
|
return &nockchain.Balance{
|
||||||
Notes: allNotes,
|
Notes: allNotes,
|
||||||
Height: height,
|
Height: height,
|
||||||
BlockId: blockId,
|
BlockId: blockId,
|
||||||
@ -118,24 +138,22 @@ func (nc *NockchainClient) TxAccepted(txId string) (*nockchain.TransactionAccept
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (nc *NockchainClient) WalletSendTransaction(tx *nockchain.RawTx) (*nockchain.WalletSendTransactionResponse, error) {
|
func (nc *NockchainClient) WalletSendTransaction(tx *nockchain.RawTx) (*nockchain.WalletSendTransactionResponse, error) {
|
||||||
inputs := []*nockchain.NamedInput{}
|
spends := []*nockchain.SpendEntry{}
|
||||||
for _, i := range tx.Inputs {
|
for _, namedSpend := range tx.NamedSpends {
|
||||||
input, err := ConvertInput(i)
|
spendEntry, err := ConvertNamedSpend(namedSpend)
|
||||||
if err != nil {
|
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{
|
req := nockchain.WalletSendTransactionRequest{
|
||||||
TxId: ParseHash(tx.TxId),
|
TxId: ParseHash(tx.TxId),
|
||||||
RawTx: &nockchain.RawTransaction{
|
RawTx: &nockchain.RawTransaction{
|
||||||
Id: ParseHash(tx.TxId),
|
Id: ParseHash(tx.TxId),
|
||||||
NamedInputs: inputs,
|
Version: &nockchain.NoteVersion{
|
||||||
TotalFees: &nockchain.Nicks{Value: tx.TotalFees},
|
Value: uint32(tx.Version),
|
||||||
TimelockRange: &nockchain.TimeLockRangeAbsolute{
|
|
||||||
Min: (*nockchain.BlockHeight)(tx.TimelockRange.Min),
|
|
||||||
Max: (*nockchain.BlockHeight)(tx.TimelockRange.Max),
|
|
||||||
},
|
},
|
||||||
|
Spends: spends,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -40,10 +40,27 @@ func HashSignature(signature *nockchain.NockchainSignature) ([5]uint64, error) {
|
|||||||
}
|
}
|
||||||
pkHash := HashPubkey(pkPoint)
|
pkHash := HashPubkey(pkPoint)
|
||||||
sigHash = crypto.Tip5RehashTenCell(pkHash, sigHash)
|
sigHash = crypto.Tip5RehashTenCell(pkHash, sigHash)
|
||||||
sigHash = crypto.Tip5RehashTenCell(sigHash, crypto.Tip5ZeroZero)
|
return crypto.Tip5RehashTenCell(sigHash, crypto.Tip5ZeroZero), nil
|
||||||
return crypto.Tip5RehashTenCell(crypto.Tip5Zero, sigHash), 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 {
|
func HashOwner(pkPoint crypto.CheetahPoint) [5]uint64 {
|
||||||
pkHashedBelts := HashPubkey(pkPoint)
|
pkHashedBelts := HashPubkey(pkPoint)
|
||||||
pkHashedZeroZero := crypto.Tip5RehashTenCell(pkHashedBelts, crypto.Tip5ZeroZero)
|
pkHashedZeroZero := crypto.Tip5RehashTenCell(pkHashedBelts, crypto.Tip5ZeroZero)
|
||||||
@ -61,15 +78,32 @@ func HashName(name *nockchain.NockchainName) [5]uint64 {
|
|||||||
return crypto.Tip5RehashTenCell(firstNameHash, crypto.Tip5RehashTenCell(lastNameHash, crypto.Tip5Zero))
|
return crypto.Tip5RehashTenCell(firstNameHash, crypto.Tip5RehashTenCell(lastNameHash, crypto.Tip5Zero))
|
||||||
}
|
}
|
||||||
|
|
||||||
func HashNote(note *nockchain.NockchainNote) ([5]uint64, error) {
|
func HashNameVarLen(name *nockchain.NockchainName) [5]uint64 {
|
||||||
|
belts := []crypto.Belt{}
|
||||||
|
for _, i := range crypto.Base58ToTip5Hash(name.First) {
|
||||||
|
belts = append(belts, crypto.Belt{Value: i})
|
||||||
|
}
|
||||||
|
for _, i := range crypto.Base58ToTip5Hash(name.Last) {
|
||||||
|
belts = append(belts, crypto.Belt{Value: i})
|
||||||
|
}
|
||||||
|
belts = append(belts, crypto.BELT_ZERO)
|
||||||
|
size := len(belts)
|
||||||
|
belts = append([]crypto.Belt{{Value: uint64(size)}}, belts...)
|
||||||
|
for _, i := range crypto.MagicDyckForName {
|
||||||
|
belts = append(belts, crypto.Belt{Value: i})
|
||||||
|
}
|
||||||
|
res := crypto.Tip5HashBelts(belts)
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func HashNoteV0(note *nockchain.NockchainNoteV0) ([5]uint64, error) {
|
||||||
versionHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: uint64(note.Version)}})
|
versionHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: uint64(note.Version)}})
|
||||||
blockHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: note.BlockHeight}})
|
blockHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: note.OriginPage}})
|
||||||
timelockHash := HashTimelockIntent(note.Timelock)
|
hashBlockTimeLock := crypto.Tip5RehashTenCell(blockHash, crypto.Tip5Zero)
|
||||||
hashBlockTimeLock := crypto.Tip5RehashTenCell(blockHash, timelockHash)
|
|
||||||
|
|
||||||
p := crypto.Tip5RehashTenCell(versionHash, hashBlockTimeLock)
|
p := crypto.Tip5RehashTenCell(versionHash, hashBlockTimeLock)
|
||||||
nameHash := HashName(note.Name)
|
nameHash := HashName(note.Name)
|
||||||
lockHash, err := HashLock(note.Lock)
|
lockHash, err := HashLockV0(note.Lock)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return [5]uint64{}, err
|
return [5]uint64{}, err
|
||||||
}
|
}
|
||||||
@ -115,7 +149,8 @@ func HashTimelockRange(timelockRange *nockchain.TimelockRange) [5]uint64 {
|
|||||||
|
|
||||||
return hash
|
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}})
|
keysRequiredHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: lock.KeysRequired}})
|
||||||
|
|
||||||
finalPk := base58.Decode(lock.Pubkeys[lock.KeysRequired-1])
|
finalPk := base58.Decode(lock.Pubkeys[lock.KeysRequired-1])
|
||||||
@ -141,6 +176,23 @@ func HashLock(lock *nockchain.NockchainLock) ([5]uint64, error) {
|
|||||||
return crypto.Tip5RehashTenCell(keysRequiredHash, finalHash), nil
|
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 {
|
func HashSource(source *nockchain.NockchainSource) [5]uint64 {
|
||||||
if source == nil {
|
if source == nil {
|
||||||
return crypto.Tip5Zero
|
return crypto.Tip5Zero
|
||||||
@ -149,43 +201,45 @@ func HashSource(source *nockchain.NockchainSource) [5]uint64 {
|
|||||||
return crypto.Tip5RehashTenCell(sourceHash, crypto.Tip5One)
|
return crypto.Tip5RehashTenCell(sourceHash, crypto.Tip5One)
|
||||||
}
|
}
|
||||||
|
|
||||||
func HashSeedWithoutSource(seed *nockchain.NockchainSeed) ([5]uint64, error) {
|
func HashSeedWithoutSource(seed *nockchain.NockchainSeedV0) [5]uint64 {
|
||||||
lockHash, err := HashLock(seed.Recipient)
|
lockRoot := crypto.Base58ToTip5Hash(seed.LockRoot)
|
||||||
if err != nil {
|
fmt.Println("lockRoot:", lockRoot)
|
||||||
return [5]uint64{}, nil
|
|
||||||
}
|
|
||||||
timelockIntentHash := HashTimelockIntent(seed.TimelockIntent)
|
|
||||||
assetHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: seed.Gift}})
|
assetHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: seed.Gift}})
|
||||||
|
|
||||||
parentHash := crypto.Base58ToTip5Hash(seed.ParentHash)
|
parentHash := crypto.Base58ToTip5Hash(seed.ParentHash)
|
||||||
|
fmt.Println("parentHash:", parentHash)
|
||||||
assetHashparentHash := crypto.Tip5RehashTenCell(assetHash, 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)
|
seedHash := crypto.Tip5RehashTenCell(lockRoot, noteDataHashAssetParentHash)
|
||||||
return seedHash, nil
|
return seedHash
|
||||||
}
|
}
|
||||||
func HashSeed(seed *nockchain.NockchainSeed) ([5]uint64, error) {
|
func HashSeed(seed *nockchain.NockchainSeedV0) [5]uint64 {
|
||||||
seedHash, err := HashSeedWithoutSource(seed)
|
seedHash := HashSeedWithoutSource(seed)
|
||||||
if err != nil {
|
|
||||||
return [5]uint64{}, nil
|
|
||||||
}
|
|
||||||
sourceHash := HashSource(seed.OutputSource)
|
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 := []crypto.Belt{{Value: 0}}
|
||||||
belts = append(belts, crypto.Belt{Value: seed.Recipient.KeysRequired})
|
lockRoot := crypto.Base58ToTip5Hash(seed.LockRoot)
|
||||||
for _, pk := range seed.Recipient.Pubkeys {
|
for _, i := range lockRoot {
|
||||||
pkPoint, err := crypto.CheetaPointFromBytes(base58.Decode(pk))
|
belts = append(belts, crypto.Belt{Value: i})
|
||||||
if err != nil {
|
|
||||||
return [5]uint64{}, err
|
|
||||||
}
|
|
||||||
belts = append(belts, pkPoint.X[:]...)
|
|
||||||
belts = append(belts, pkPoint.Y[:]...)
|
|
||||||
}
|
}
|
||||||
belts = append(belts, []crypto.Belt{{Value: 1}, {Value: 0}, {Value: 0}, {Value: 0}, {Value: seed.Gift}}...)
|
// %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: 0}, {Value: 0}, {Value: 0}, {Value: 0}, {Value: 0}, {Value: seed.Gift}}...)
|
||||||
parentHash := crypto.Base58ToTip5Hash(seed.ParentHash)
|
parentHash := crypto.Base58ToTip5Hash(seed.ParentHash)
|
||||||
for _, i := range parentHash {
|
for _, i := range parentHash {
|
||||||
belts = append(belts, crypto.Belt{Value: i})
|
belts = append(belts, crypto.Belt{Value: i})
|
||||||
@ -195,9 +249,12 @@ func HashSeedVarLen(seed *nockchain.NockchainSeed) ([5]uint64, error) {
|
|||||||
for _, i := range crypto.MagicDyckForSeed {
|
for _, i := range crypto.MagicDyckForSeed {
|
||||||
belts = append(belts, crypto.Belt{Value: i})
|
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{}
|
belts := []crypto.Belt{}
|
||||||
for _, belt := range pkPoint.X {
|
for _, belt := range pkPoint.X {
|
||||||
belts = append(belts, belt)
|
belts = append(belts, belt)
|
||||||
@ -210,12 +267,18 @@ func HashNonce(pkPoint crypto.CheetahPoint, message [5]uint64) ([]crypto.Belt, [
|
|||||||
for _, belt := range message {
|
for _, belt := range message {
|
||||||
belts = append(belts, crypto.Belt{Value: belt})
|
belts = append(belts, crypto.Belt{Value: belt})
|
||||||
}
|
}
|
||||||
|
|
||||||
resBelts := make([]crypto.Belt, len(belts))
|
resBelts := make([]crypto.Belt, len(belts))
|
||||||
copy(resBelts, belts)
|
copy(resBelts, belts)
|
||||||
|
|
||||||
|
for _, belt := range privKeyT8 {
|
||||||
|
belts = append(belts, crypto.Belt{Value: belt})
|
||||||
|
}
|
||||||
|
|
||||||
return resBelts, crypto.Tip5HashBelts(belts)
|
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
|
// TODO: handle multiple sig
|
||||||
if len(spend.Signatures) == 0 {
|
if len(spend.Signatures) == 0 {
|
||||||
return [5]uint64{}, fmt.Errorf("signatures can not be empty")
|
return [5]uint64{}, fmt.Errorf("signatures can not be empty")
|
||||||
@ -225,226 +288,122 @@ func HashSpend(spend *nockchain.NockchainSpend) ([5]uint64, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return [5]uint64{}, err
|
return [5]uint64{}, err
|
||||||
}
|
}
|
||||||
seedsCount := len(spend.Seeds)
|
|
||||||
var finalSeedHash [5]uint64
|
|
||||||
if seedsCount == 1 {
|
|
||||||
seedHash, err := HashSeedWithoutSource(spend.Seeds[0])
|
|
||||||
if err != nil {
|
|
||||||
return [5]uint64{}, err
|
|
||||||
}
|
|
||||||
|
|
||||||
finalSeedHash = crypto.Tip5RehashTenCell(seedHash, crypto.Tip5ZeroZero)
|
seedsTree := NewZTree(
|
||||||
} else {
|
func(i interface{}) [5]uint64 {
|
||||||
seed1Hash, err := HashSeedWithoutSource(spend.Seeds[0])
|
if seed, ok := i.(*nockchain.NockchainSeedV0); ok {
|
||||||
if err != nil {
|
return HashSeedVarLen(seed)
|
||||||
return [5]uint64{}, err
|
|
||||||
}
|
|
||||||
seed1HashVarLen, err := HashSeedVarLen(spend.Seeds[0])
|
|
||||||
if err != nil {
|
|
||||||
return [5]uint64{}, err
|
|
||||||
}
|
|
||||||
seed1DoubleHash := crypto.Tip5RehashTenCell(seed1HashVarLen, seed1HashVarLen)
|
|
||||||
seed2Hash, err := HashSeedWithoutSource(spend.Seeds[1])
|
|
||||||
if err != nil {
|
|
||||||
return [5]uint64{}, err
|
|
||||||
}
|
|
||||||
seed2HashVarLen, err := HashSeedVarLen(spend.Seeds[1])
|
|
||||||
if err != nil {
|
|
||||||
return [5]uint64{}, err
|
|
||||||
}
|
|
||||||
seed2DoubleHash := crypto.Tip5RehashTenCell(seed2HashVarLen, seed2HashVarLen)
|
|
||||||
|
|
||||||
seedHash1BigInt := new(big.Int).SetBytes(base58.Decode(crypto.Tip5HashToBase58(seed1HashVarLen)))
|
|
||||||
seed1DoubleHashBigInt := new(big.Int).SetBytes(base58.Decode(crypto.Tip5HashToBase58(seed1DoubleHash)))
|
|
||||||
seedHash2BigInt := new(big.Int).SetBytes(base58.Decode(crypto.Tip5HashToBase58(seed2HashVarLen)))
|
|
||||||
seed2DoubleHashBigInt := new(big.Int).SetBytes(base58.Decode(crypto.Tip5HashToBase58(seed2DoubleHash)))
|
|
||||||
if seedHash1BigInt.Cmp(seedHash2BigInt) == -1 {
|
|
||||||
// seed 1 < seed 2
|
|
||||||
|
|
||||||
if seed1DoubleHashBigInt.Cmp(seed2DoubleHashBigInt) == -1 {
|
|
||||||
// seed1
|
|
||||||
// / \
|
|
||||||
// ~ seed2
|
|
||||||
// / \
|
|
||||||
// ~ ~
|
|
||||||
finalSeedHash = crypto.Tip5RehashTenCell(seed2Hash, crypto.Tip5ZeroZero)
|
|
||||||
finalSeedHash = crypto.Tip5RehashTenCell(crypto.Tip5Zero, finalSeedHash)
|
|
||||||
finalSeedHash = crypto.Tip5RehashTenCell(seed1Hash, finalSeedHash)
|
|
||||||
} else {
|
} else {
|
||||||
// seed2
|
return [5]uint64{}
|
||||||
// / \
|
|
||||||
// seed1 ~
|
|
||||||
// / \
|
|
||||||
// ~ ~
|
|
||||||
finalSeedHash = crypto.Tip5RehashTenCell(seed1Hash, crypto.Tip5ZeroZero)
|
|
||||||
finalSeedHash = crypto.Tip5RehashTenCell(finalSeedHash, crypto.Tip5Zero)
|
|
||||||
finalSeedHash = crypto.Tip5RehashTenCell(seed2Hash, finalSeedHash)
|
|
||||||
}
|
}
|
||||||
} else {
|
},
|
||||||
// seed 1 > seed 2
|
func(i interface{}) ([5]uint64, error) {
|
||||||
|
if seed, ok := i.(*nockchain.NockchainSeedV0); ok {
|
||||||
if seed1DoubleHashBigInt.Cmp(seed2DoubleHashBigInt) == -1 {
|
return HashSeedWithoutSource(seed), nil
|
||||||
// seed1
|
|
||||||
// / \
|
|
||||||
// seed2 ~
|
|
||||||
// / \
|
|
||||||
// ~ ~
|
|
||||||
finalSeedHash = crypto.Tip5RehashTenCell(seed2Hash, crypto.Tip5ZeroZero)
|
|
||||||
finalSeedHash = crypto.Tip5RehashTenCell(finalSeedHash, crypto.Tip5Zero)
|
|
||||||
finalSeedHash = crypto.Tip5RehashTenCell(seed1Hash, finalSeedHash)
|
|
||||||
} else {
|
} else {
|
||||||
// seed2
|
return [5]uint64{}, fmt.Errorf("invalid input type")
|
||||||
// / \
|
|
||||||
// ~ seed1
|
|
||||||
// / \
|
|
||||||
// ~ ~
|
|
||||||
finalSeedHash = crypto.Tip5RehashTenCell(seed1Hash, crypto.Tip5ZeroZero)
|
|
||||||
finalSeedHash = crypto.Tip5RehashTenCell(crypto.Tip5Zero, finalSeedHash)
|
|
||||||
finalSeedHash = crypto.Tip5RehashTenCell(seed2Hash, finalSeedHash)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
)
|
||||||
|
for _, seed := range spend.Seeds {
|
||||||
|
seedsTree.Insert(seed, seed)
|
||||||
}
|
}
|
||||||
|
finalSeedHash, err := seedsTree.Hash()
|
||||||
|
if err != nil {
|
||||||
|
return [5]uint64{}, err
|
||||||
|
}
|
||||||
|
|
||||||
feeHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: spend.Fee}})
|
feeHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: spend.Fee}})
|
||||||
seedHashFee := crypto.Tip5RehashTenCell(finalSeedHash, feeHash)
|
seedHashFee := crypto.Tip5RehashTenCell(finalSeedHash, feeHash)
|
||||||
return crypto.Tip5RehashTenCell(sigHash, seedHashFee), nil
|
return crypto.Tip5RehashTenCell(sigHash, seedHashFee), nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func HashMsg(spend *nockchain.NockchainSpend) ([5]uint64, error) {
|
func HashMsg(spend *nockchain.NockchainSpendV0) ([5]uint64, error) {
|
||||||
seedsCount := len(spend.Seeds)
|
seedsTree := NewZTree(
|
||||||
var finalSeedHash [5]uint64
|
|
||||||
if seedsCount == 1 {
|
|
||||||
seedHash, err := HashSeed(spend.Seeds[0])
|
|
||||||
if err != nil {
|
|
||||||
return [5]uint64{}, err
|
|
||||||
}
|
|
||||||
|
|
||||||
finalSeedHash = crypto.Tip5RehashTenCell(seedHash, crypto.Tip5ZeroZero)
|
|
||||||
} else {
|
|
||||||
seed1HashVarLen, err := HashSeedVarLen(spend.Seeds[0])
|
|
||||||
if err != nil {
|
|
||||||
return [5]uint64{}, err
|
|
||||||
}
|
|
||||||
seed1Hash, err := HashSeed(spend.Seeds[0])
|
|
||||||
if err != nil {
|
|
||||||
return [5]uint64{}, err
|
|
||||||
}
|
|
||||||
seed1DoubleHash := crypto.Tip5RehashTenCell(seed1HashVarLen, seed1HashVarLen)
|
|
||||||
seed2HashVarLen, err := HashSeedVarLen(spend.Seeds[1])
|
|
||||||
if err != nil {
|
|
||||||
return [5]uint64{}, err
|
|
||||||
}
|
|
||||||
seed2Hash, err := HashSeed(spend.Seeds[1])
|
|
||||||
if err != nil {
|
|
||||||
return [5]uint64{}, err
|
|
||||||
}
|
|
||||||
seed2DoubleHash := crypto.Tip5RehashTenCell(seed2HashVarLen, seed2HashVarLen)
|
|
||||||
|
|
||||||
seedHash1BigInt := new(big.Int).SetBytes(base58.Decode(crypto.Tip5HashToBase58(seed1HashVarLen)))
|
|
||||||
seed1DoubleHashBigInt := new(big.Int).SetBytes(base58.Decode(crypto.Tip5HashToBase58(seed1DoubleHash)))
|
|
||||||
seedHash2BigInt := new(big.Int).SetBytes(base58.Decode(crypto.Tip5HashToBase58(seed2HashVarLen)))
|
|
||||||
seed2DoubleHashBigInt := new(big.Int).SetBytes(base58.Decode(crypto.Tip5HashToBase58(seed2DoubleHash)))
|
|
||||||
if seedHash1BigInt.Cmp(seedHash2BigInt) == -1 {
|
|
||||||
// seed 1 < seed 2
|
|
||||||
|
|
||||||
if seed1DoubleHashBigInt.Cmp(seed2DoubleHashBigInt) == -1 {
|
|
||||||
// seed1
|
|
||||||
// / \
|
|
||||||
// ~ seed2
|
|
||||||
// / \
|
|
||||||
// ~ ~
|
|
||||||
finalSeedHash = crypto.Tip5RehashTenCell(seed2Hash, crypto.Tip5ZeroZero)
|
|
||||||
finalSeedHash = crypto.Tip5RehashTenCell(crypto.Tip5Zero, finalSeedHash)
|
|
||||||
finalSeedHash = crypto.Tip5RehashTenCell(seed1Hash, finalSeedHash)
|
|
||||||
} else {
|
|
||||||
// seed2
|
|
||||||
// / \
|
|
||||||
// seed1 ~
|
|
||||||
// / \
|
|
||||||
// ~ ~
|
|
||||||
finalSeedHash = crypto.Tip5RehashTenCell(seed1Hash, crypto.Tip5ZeroZero)
|
|
||||||
finalSeedHash = crypto.Tip5RehashTenCell(finalSeedHash, crypto.Tip5Zero)
|
|
||||||
finalSeedHash = crypto.Tip5RehashTenCell(seed2Hash, finalSeedHash)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// seed 1 > seed 2
|
|
||||||
|
|
||||||
if seed1DoubleHashBigInt.Cmp(seed2DoubleHashBigInt) == -1 {
|
|
||||||
// seed1
|
|
||||||
// / \
|
|
||||||
// seed2 ~
|
|
||||||
// / \
|
|
||||||
// ~ ~
|
|
||||||
finalSeedHash = crypto.Tip5RehashTenCell(seed2Hash, crypto.Tip5ZeroZero)
|
|
||||||
finalSeedHash = crypto.Tip5RehashTenCell(finalSeedHash, crypto.Tip5Zero)
|
|
||||||
finalSeedHash = crypto.Tip5RehashTenCell(seed1Hash, finalSeedHash)
|
|
||||||
} else {
|
|
||||||
// seed2
|
|
||||||
// / \
|
|
||||||
// ~ seed1
|
|
||||||
// / \
|
|
||||||
// ~ ~
|
|
||||||
finalSeedHash = crypto.Tip5RehashTenCell(seed1Hash, crypto.Tip5ZeroZero)
|
|
||||||
finalSeedHash = crypto.Tip5RehashTenCell(crypto.Tip5Zero, finalSeedHash)
|
|
||||||
finalSeedHash = crypto.Tip5RehashTenCell(seed2Hash, finalSeedHash)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
feeHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: spend.Fee}})
|
|
||||||
return crypto.Tip5RehashTenCell(finalSeedHash, feeHash), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func HashInput(input *nockchain.NockchainInput) ([5]uint64, error) {
|
|
||||||
nameHash := HashName(input.Name)
|
|
||||||
|
|
||||||
noteHash, err := HashNote(input.Note)
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
func ComputeTxId(inputs []*nockchain.NockchainInput, timelockRange *nockchain.TimelockRange, totalFees uint64) ([5]uint64, error) {
|
|
||||||
|
|
||||||
inputTree := NewZTree(
|
|
||||||
func(i interface{}) [5]uint64 {
|
func(i interface{}) [5]uint64 {
|
||||||
if name, ok := i.(*nockchain.NockchainName); ok {
|
if seed, ok := i.(*nockchain.NockchainSeedV0); ok {
|
||||||
return HashName(name)
|
return HashSeedVarLen(seed)
|
||||||
} else {
|
} else {
|
||||||
return [5]uint64{}
|
return [5]uint64{}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
func(i interface{}) ([5]uint64, error) {
|
func(i interface{}) ([5]uint64, error) {
|
||||||
if input, ok := i.(*nockchain.NockchainInput); ok {
|
if seed, ok := i.(*nockchain.NockchainSeedV0); ok {
|
||||||
hash, err := HashInput(input)
|
return HashSeed(seed), nil
|
||||||
return hash, err
|
|
||||||
} else {
|
} else {
|
||||||
return [5]uint64{}, fmt.Errorf("invalid input type")
|
return [5]uint64{}, fmt.Errorf("invalid input type")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
for _, input := range inputs {
|
for _, seed := range spend.Seeds {
|
||||||
inputTree.Insert(input.Name, input)
|
seedsTree.Insert(seed, seed)
|
||||||
}
|
}
|
||||||
inputHash, err := inputTree.Hash()
|
finalSeedHash, err := seedsTree.Hash()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return [5]uint64{}, fmt.Errorf("error hashing inputs: %v", err)
|
return [5]uint64{}, err
|
||||||
}
|
}
|
||||||
|
feeHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: spend.Fee}})
|
||||||
|
return crypto.Tip5RehashTenCell(finalSeedHash, feeHash), nil
|
||||||
|
}
|
||||||
|
|
||||||
timelockHash := HashTimelockRange(timelockRange)
|
// func HashInput(input *nockchain.NockchainInput) ([5]uint64, error) {
|
||||||
|
// nameHash := HashName(input.Name)
|
||||||
|
|
||||||
totalFeesHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: totalFees}})
|
// noteHash, err := HashNote(input.Note)
|
||||||
|
// if err != nil {
|
||||||
|
// return [5]uint64{}, err
|
||||||
|
|
||||||
q := crypto.Tip5RehashTenCell(timelockHash, totalFeesHash)
|
// }
|
||||||
return crypto.Tip5RehashTenCell(inputHash, q), nil
|
// spendHash, err := HashSpend(input.Spend)
|
||||||
|
// if err != nil {
|
||||||
|
// return [5]uint64{}, err
|
||||||
|
|
||||||
|
// }
|
||||||
|
// hashNoteSpend := crypto.Tip5RehashTenCell(noteHash, spendHash)
|
||||||
|
// return crypto.Tip5RehashTenCell(nameHash, hashNoteSpend), nil
|
||||||
|
// }
|
||||||
|
|
||||||
|
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)
|
||||||
|
} else {
|
||||||
|
return [5]uint64{}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
func(i interface{}) ([5]uint64, error) {
|
||||||
|
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 _, spend := range spends {
|
||||||
|
spendTree.Insert(spend.Name, spend)
|
||||||
|
}
|
||||||
|
spendHash, err = spendTree.Hash()
|
||||||
|
if err != nil {
|
||||||
|
return [5]uint64{}, fmt.Errorf("error hashing spends: %v", err)
|
||||||
|
}
|
||||||
|
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) {
|
func ComputeSig(m crypto.MasterKey, msg [5]uint64) ([8]uint64, [8]uint64, error) {
|
||||||
@ -452,7 +411,7 @@ func ComputeSig(m crypto.MasterKey, msg [5]uint64) ([8]uint64, [8]uint64, error)
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return [8]uint64{}, [8]uint64{}, err
|
return [8]uint64{}, [8]uint64{}, err
|
||||||
}
|
}
|
||||||
belts, nonce := HashNonce(pkPoint, msg)
|
belts, nonce := HashNonce(pkPoint, msg, m.PrivateKey)
|
||||||
nonceBigInt := crypto.TruncGOrder(nonce)
|
nonceBigInt := crypto.TruncGOrder(nonce)
|
||||||
scalar := crypto.CheetahScaleBig(crypto.A_GEN, *nonceBigInt)
|
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
|
package wallet
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"cmp"
|
||||||
context "context"
|
context "context"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
@ -15,6 +16,13 @@ import (
|
|||||||
"github.com/phamminh0811/private-grpc/nockchain"
|
"github.com/phamminh0811/private-grpc/nockchain"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
WitnessWordsCount = 0
|
||||||
|
SignatureWordsCount = 31
|
||||||
|
SeedWordsCount = 13
|
||||||
|
BaseFee = 1 << 15
|
||||||
|
)
|
||||||
|
|
||||||
type GprcHandler struct {
|
type GprcHandler struct {
|
||||||
nockchain.UnimplementedWalletServiceServer
|
nockchain.UnimplementedWalletServiceServer
|
||||||
client NockchainClient
|
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]"
|
// - `names` - Comma-separated list of note name pairs in format "[first last]"
|
||||||
// Example: "[first1 last1],[first2 last2]"
|
// Example: "[first1 last1],[first2 last2]"
|
||||||
//
|
//
|
||||||
// - `recipients` - Comma-separated list of recipient $locks
|
// - `recipients` Comma-separated list of transaction output, formatted as "<recipient1>:<amount1>,<recipient1>:<amount1>"
|
||||||
// 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"
|
|
||||||
//
|
//
|
||||||
// - `fee` - Transaction fee to be subtracted from one of the input notes
|
// - `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) {
|
func (h *GprcHandler) CreateTx(ctx context.Context, req *nockchain.CreateTxRequest) (*nockchain.CreateTxResponse, error) {
|
||||||
nnames := []*nockchain.NockchainName{}
|
nnames := []*nockchain.NockchainName{}
|
||||||
names := strings.Split(req.Names, ",")
|
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 {
|
for _, name := range names {
|
||||||
name = strings.TrimSpace(name)
|
name = strings.TrimSpace(name)
|
||||||
if strings.HasPrefix(name, "[") && strings.HasSuffix(name, "]") {
|
if strings.HasPrefix(name, "[") && strings.HasSuffix(name, "]") {
|
||||||
@ -391,7 +393,7 @@ func (h *GprcHandler) CreateTx(ctx context.Context, req *nockchain.CreateTxReque
|
|||||||
nameTree := NewZTree(
|
nameTree := NewZTree(
|
||||||
func(i interface{}) [5]uint64 {
|
func(i interface{}) [5]uint64 {
|
||||||
if name, ok := i.(*nockchain.NockchainName); ok {
|
if name, ok := i.(*nockchain.NockchainName); ok {
|
||||||
return HashName(name)
|
return HashNameVarLen(name)
|
||||||
} else {
|
} else {
|
||||||
return [5]uint64{}
|
return [5]uint64{}
|
||||||
}
|
}
|
||||||
@ -401,72 +403,39 @@ func (h *GprcHandler) CreateTx(ctx context.Context, req *nockchain.CreateTxReque
|
|||||||
for _, name := range nnames {
|
for _, name := range nnames {
|
||||||
nameTree.Insert(name, nil)
|
nameTree.Insert(name, nil)
|
||||||
}
|
}
|
||||||
nameLeftMost := nameTree.KeyLeftMost().(*nockchain.NockchainName)
|
nameList := nameTree.Tap()
|
||||||
idxLeftMost := -1
|
nameKeys := []string{}
|
||||||
|
for _, nameKey := range nameList {
|
||||||
|
name := nameKey.Key.(*nockchain.NockchainName)
|
||||||
|
nameKeys = append(nameKeys, name.First+" "+name.Last)
|
||||||
|
}
|
||||||
|
indices := make([]int, len(nnames))
|
||||||
for i, name := range nnames {
|
for i, name := range nnames {
|
||||||
if name.First == nameLeftMost.First && name.Last == nameLeftMost.Last {
|
if idx := slices.Index(nameKeys, name.First+" "+name.Last); idx != -1 {
|
||||||
idxLeftMost = i
|
indices[idx] = i
|
||||||
}
|
|
||||||
}
|
|
||||||
if idxLeftMost == -1 {
|
|
||||||
return nil, fmt.Errorf("unable to find left most node")
|
|
||||||
}
|
|
||||||
|
|
||||||
recipents := []*nockchain.NockchainLock{}
|
|
||||||
if strings.Contains(req.Recipients, "[") {
|
|
||||||
pairs := strings.Split(req.Recipients, ",")
|
|
||||||
for _, pair := range pairs {
|
|
||||||
pair = strings.TrimSpace(pair)
|
|
||||||
|
|
||||||
if strings.HasPrefix(pair, "[") && strings.HasSuffix(pair, "]") {
|
|
||||||
inner := pair[1 : len(pair)-1]
|
|
||||||
parts := strings.SplitN(inner, " ", 2)
|
|
||||||
|
|
||||||
if len(parts) == 2 {
|
|
||||||
number, err := strconv.ParseUint(parts[0], 10, 64)
|
|
||||||
if err != nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
specs := strings.Split(req.Recipients, ",")
|
||||||
chainCode := base58.Decode(req.ChainCode)
|
if len(specs) == 0 {
|
||||||
key := base58.Decode(req.Key)
|
return nil, fmt.Errorf("at least one output must be provided")
|
||||||
masterKey, err := crypto.MasterKeyFromPrivKey(chainCode, key)
|
}
|
||||||
|
if len(specs) > 1 {
|
||||||
|
return nil, fmt.Errorf("multiple outputs are not supported yet, provide a single <pkh>:<amount> pair")
|
||||||
|
}
|
||||||
|
|
||||||
|
spec := specs[0]
|
||||||
|
pairs := strings.Split(spec, ":")
|
||||||
|
if len(pairs) != 2 {
|
||||||
|
return nil, fmt.Errorf("%s", "Invalid output spec "+spec+", expected <pkh>:<amount>")
|
||||||
|
}
|
||||||
|
|
||||||
|
gift, err := strconv.ParseUint(strings.TrimSpace(pairs[1]), 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
masterKey, err := crypto.MasterKeyFromSeed(req.Seed)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -486,8 +455,32 @@ func (h *GprcHandler) CreateTx(ctx context.Context, req *nockchain.CreateTxReque
|
|||||||
masterKey = &childKey
|
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
|
// 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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -510,121 +503,148 @@ func (h *GprcHandler) CreateTx(ctx context.Context, req *nockchain.CreateTxReque
|
|||||||
name := "[" + firstName + " " + lastName + "]"
|
name := "[" + firstName + " " + lastName + "]"
|
||||||
if i := slices.Index(names, name); i != -1 {
|
if i := slices.Index(names, name); i != -1 {
|
||||||
balanceEntry := ParseBalanceEntry(note)
|
balanceEntry := ParseBalanceEntry(note)
|
||||||
notes[i] = &balanceEntry
|
switch req.Version {
|
||||||
|
case 0:
|
||||||
|
notesV0[i] = balanceEntry.GetV0()
|
||||||
|
case 1:
|
||||||
|
notesV1[i] = balanceEntry.GetV1()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inputs := []*nockchain.NockchainInput{}
|
giftRemaining := gift
|
||||||
|
feeRemaining := req.Fee
|
||||||
|
wordCount := 0
|
||||||
for i := 0; i < len(names); i++ {
|
for i := 0; i < len(names); i++ {
|
||||||
if notes[i] == nil {
|
switch req.Version {
|
||||||
return nil, fmt.Errorf("notes scanned is missing at name: %s", names[i])
|
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])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
}
|
}
|
||||||
|
|
||||||
if notes[i].Asset < gifts[i]+req.Fee {
|
feeAvailable := note.Asset - giftPortion
|
||||||
return nil, fmt.Errorf("note not enough balance")
|
if feeRemaining != 0 {
|
||||||
|
feePortion = min(feeRemaining, feeAvailable)
|
||||||
}
|
}
|
||||||
|
|
||||||
parentHash, err := HashNote(notes[i])
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
seeds := []*nockchain.NockchainSeed{
|
|
||||||
{
|
if req.Version == 0 {
|
||||||
OutputSource: nil,
|
lockRoot := HashLock(recipent)
|
||||||
Recipient: recipents[i],
|
wordCount += SeedWordsCount
|
||||||
TimelockIntent: req.TimelockIntent,
|
seeds := []*nockchain.NockchainSeedV0{
|
||||||
Gift: gifts[i],
|
{
|
||||||
ParentHash: crypto.Tip5HashToBase58(parentHash),
|
OutputSource: nil,
|
||||||
},
|
LockRoot: crypto.Tip5HashToBase58(lockRoot),
|
||||||
}
|
NoteData: recipent,
|
||||||
if notes[i].Asset < gifts[i] {
|
Gift: giftPortion,
|
||||||
return nil, fmt.Errorf("insufficient funds for notes %s", names[i])
|
ParentHash: crypto.Tip5HashToBase58(parentHash),
|
||||||
}
|
},
|
||||||
assetLeft := notes[i].Asset - gifts[i]
|
}
|
||||||
if i == idxLeftMost {
|
if refund != 0 {
|
||||||
if assetLeft > req.Fee {
|
wordCount += SeedWordsCount
|
||||||
assetLeft -= req.Fee
|
lockRoot := HashLock(refundLock)
|
||||||
} else {
|
seeds = append(seeds, &nockchain.NockchainSeedV0{
|
||||||
return nil, fmt.Errorf("insufficient funds for notes %s", names[i])
|
OutputSource: nil,
|
||||||
}
|
LockRoot: crypto.Tip5HashToBase58(lockRoot),
|
||||||
}
|
NoteData: refundLock,
|
||||||
if assetLeft != 0 {
|
Gift: refund,
|
||||||
seeds = append(seeds, &nockchain.NockchainSeed{
|
ParentHash: crypto.Tip5HashToBase58(parentHash),
|
||||||
OutputSource: nil,
|
})
|
||||||
Recipient: &nockchain.NockchainLock{
|
}
|
||||||
KeysRequired: 1,
|
|
||||||
Pubkeys: []string{base58.Encode(masterKey.PublicKey)},
|
spend := nockchain.NockchainSpendV0{
|
||||||
|
Signatures: nil,
|
||||||
|
Seeds: seeds,
|
||||||
|
Fee: feePortion,
|
||||||
|
}
|
||||||
|
|
||||||
|
msg, err := HashMsg(&spend)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
fmt.Println("msg:", msg)
|
||||||
|
|
||||||
|
// sign
|
||||||
|
chalT8, sigT8, err := ComputeSig(*masterKey, msg)
|
||||||
|
if err != nil {
|
||||||
|
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),
|
||||||
|
Chal: chalT8[:],
|
||||||
|
Sig: sigT8[:],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
wordCount += SignatureWordsCount
|
||||||
|
spends = append(spends, &nockchain.NockchainNamedSpend{
|
||||||
|
Name: note.Name,
|
||||||
|
SpendKind: &nockchain.NockchainNamedSpend_Legacy{
|
||||||
|
Legacy: &spend,
|
||||||
},
|
},
|
||||||
TimelockIntent: req.TimelockIntent,
|
|
||||||
Gift: assetLeft,
|
|
||||||
ParentHash: crypto.Tip5HashToBase58(parentHash),
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
var spend nockchain.NockchainSpend
|
|
||||||
if i == idxLeftMost {
|
|
||||||
spend = nockchain.NockchainSpend{
|
|
||||||
Signatures: nil,
|
|
||||||
Seeds: seeds,
|
|
||||||
Fee: req.Fee,
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
spend = nockchain.NockchainSpend{
|
|
||||||
Signatures: nil,
|
|
||||||
Seeds: seeds,
|
|
||||||
Fee: 0,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
msg, err := HashMsg(&spend)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// sign
|
|
||||||
chalT8, sigT8, err := ComputeSig(*masterKey, msg)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
spend.Signatures = []*nockchain.NockchainSignature{
|
|
||||||
{
|
|
||||||
Pubkey: base58.Encode(masterKey.PublicKey),
|
|
||||||
Chal: chalT8[:],
|
|
||||||
Sig: sigT8[:],
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
input := nockchain.NockchainInput{
|
|
||||||
Name: nnames[i],
|
|
||||||
Note: notes[i],
|
|
||||||
Spend: &spend,
|
|
||||||
}
|
|
||||||
inputs = append(inputs, &input)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var timelockRange *nockchain.TimelockRange
|
if wordCount*BaseFee > int(req.Fee) {
|
||||||
if req.TimelockIntent == nil {
|
return nil, fmt.Errorf("min fee not met, this transaction requires at least: %d", wordCount*BaseFee)
|
||||||
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
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rawTx := nockchain.RawTx{
|
rawTx := nockchain.RawTx{
|
||||||
TxId: "",
|
TxId: "",
|
||||||
Inputs: inputs,
|
Version: 1,
|
||||||
TimelockRange: timelockRange,
|
NamedSpends: spends,
|
||||||
TotalFees: req.Fee,
|
|
||||||
}
|
}
|
||||||
txId, err := ComputeTxId(inputs, timelockRange, req.Fee)
|
txId, err := ComputeTxId(spends, req.Version)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -644,8 +664,23 @@ func (h *GprcHandler) Scan(ctx context.Context, req *nockchain.ScanRequest) (*no
|
|||||||
ChainCode: chainCode,
|
ChainCode: chainCode,
|
||||||
PrivateKey: []byte{},
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -660,7 +695,24 @@ func (h *GprcHandler) Scan(ctx context.Context, req *nockchain.ScanRequest) (*no
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
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 {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -678,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) {
|
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{
|
return &nockchain.GetBalanceResponse{
|
||||||
Data: data,
|
Data: data,
|
||||||
}, err
|
}, err
|
||||||
|
|||||||
@ -417,193 +417,212 @@ func TestImportKey(t *testing.T) {
|
|||||||
// This test should be run with timeout 120s
|
// This test should be run with timeout 120s
|
||||||
func TestScan(t *testing.T) {
|
func TestScan(t *testing.T) {
|
||||||
// some random seed we take to get empty notes
|
// 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"
|
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"
|
||||||
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"
|
|
||||||
|
|
||||||
masterKey1, err := crypto.MasterKeyFromSeed(seed1)
|
masterKey1, err := crypto.MasterKeyFromSeed(seed1)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
fmt.Println("pk: ", base58.Encode(masterKey1.PublicKey))
|
||||||
nc, err := wallet.NewNockchainClient("nockchain-api.zorp.io:443")
|
nc, err := wallet.NewNockchainClient("nockchain-api.zorp.io:443")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
masterKey1Scan, err := nc.WalletGetBalance(base58.Encode(masterKey1.PublicKey))
|
masterKey1Scan, err := nc.WalletGetBalance(&nockchain.GetBalanceRequest{
|
||||||
|
Selector: &nockchain.GetBalanceRequest_Address{
|
||||||
|
Address: base58.Encode(masterKey1.PublicKey),
|
||||||
|
},
|
||||||
|
})
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Empty(t, masterKey1Scan.Notes)
|
fmt.Println("masterKey1Scan:", masterKey1Scan)
|
||||||
|
assert.NotEmpty(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 TestEncodeNoun(t *testing.T) {
|
||||||
func TestFullFlow(t *testing.T) {
|
lock1 := &nockchain.NockchainLock{
|
||||||
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"
|
KeysRequired: 1,
|
||||||
masterKey1, err := crypto.MasterKeyFromSeed(mnemonic1)
|
Pubkeys: []string{"5wef35rKxbJDJRAtzGG1VwbMQK9jF3Wr5e6fyMsh2hxnCQZDZJV1YNQ"},
|
||||||
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,
|
|
||||||
})
|
|
||||||
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)
|
|
||||||
|
|
||||||
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),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gift = note.Asset - gift - 100
|
lock1Encode := wallet.EncodeNoteData(lock1)
|
||||||
seed2 := &nockchain.NockchainSeed{
|
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})
|
||||||
OutputSource: nil,
|
|
||||||
Recipient: &nockchain.NockchainLock{
|
|
||||||
KeysRequired: 1,
|
|
||||||
Pubkeys: []string{base58.Encode(masterKey1.PublicKey)},
|
|
||||||
},
|
|
||||||
TimelockIntent: nil,
|
|
||||||
Gift: gift,
|
|
||||||
ParentHash: crypto.Tip5HashToBase58(parentHash),
|
|
||||||
}
|
|
||||||
|
|
||||||
spend := nockchain.NockchainSpend{
|
lock2 := lock1
|
||||||
Signatures: nil,
|
lock2.Pubkeys = []string{"7UXNF2HXzEaPUvLDVDgGJyriKqpd2974Kj7U2RnLuBPeRGa7ZezhGmK"}
|
||||||
Seeds: []*nockchain.NockchainSeed{
|
lock2Encode := wallet.EncodeNoteData(lock2)
|
||||||
seed1, seed2,
|
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})
|
||||||
},
|
|
||||||
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 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)
|
||||||
|
|
||||||
|
// 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,
|
||||||
|
// })
|
||||||
|
// 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)
|
||||||
|
|
||||||
|
// 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),
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 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
|
// This test should be run with timeout 300s
|
||||||
func TestCreateTx(t *testing.T) {
|
func TestCreateTx(t *testing.T) {
|
||||||
seed1 := "pledge vessel toilet sunny hockey skirt spend wire disorder attitude crumble lecture problem bundle bone rather address over suit ancient primary gospel silent repair"
|
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)
|
masterKey1, err := crypto.MasterKeyFromSeed(seed1)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
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"
|
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 := "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)
|
masterKey2, err := crypto.MasterKeyFromSeed(seed2)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
fmt.Println("masterKey2", base58.Encode(masterKey2.PublicKey))
|
||||||
|
|
||||||
nc, err := wallet.NewNockchainClient("nockchain-api.zorp.io:443")
|
nc, err := wallet.NewNockchainClient("nockchain-api.zorp.io:443")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
handler := wallet.NewGprcHandler(*nc)
|
handler := wallet.NewGprcHandler(*nc)
|
||||||
|
|
||||||
inputs := "[CxiTK4HjqPRebUkoy6rH89ZcNGuH4goHkmKgmgCJxZEFS2C3qrDoh4y 91z5muQKgHZDcChdnCSTEtvuN8dbbXp5wzNs5xrCkce2YvSX1q6fu3d],[CxiTK4HjqPRebUkoy6rH89ZcNGuH4goHkmKgmgCJxZEFS2C3qrDoh4y 3a9VWigUM1TuS79yM4dAqkiUg6WJMUPGwVKJpQUHCLJcFZsCWM2q6pF],[CxiTK4HjqPRebUkoy6rH89ZcNGuH4goHkmKgmgCJxZEFS2C3qrDoh4y 9RkPvHMtuYtjV2qvB86u7zcnr26SdVcKzFnHgfhUSEG1W3FgKgLpbBm]"
|
inputs := "[4taoqkpysafnp64WBQyzHDKVrqkMeNrdAiVSbWdzZmj7yQYZgQtCq4W 8yd685r3WhvRYsYWFy3LNQqSMMNwWyE3QZe5fqp1jgG3PWtLPvXdYvR]"
|
||||||
recipients := fmt.Sprintf("%s,%s,%s", base58.Encode(masterKey2.PublicKey), base58.Encode(masterKey2.PublicKey), base58.Encode(masterKey2.PublicKey))
|
|
||||||
gifts := "100,100,100"
|
pkPoint2, err := crypto.CheetaPointFromBytes(masterKey2.PublicKey)
|
||||||
fee := 100
|
assert.NoError(t, err)
|
||||||
|
addr2 := wallet.HashPubkey(pkPoint2)
|
||||||
|
|
||||||
|
recipients := fmt.Sprintf("%s:2000000", crypto.Tip5HashToBase58(addr2))
|
||||||
|
fee := 1867776 // min fee
|
||||||
|
|
||||||
req := &nockchain.CreateTxRequest{
|
req := &nockchain.CreateTxRequest{
|
||||||
Names: inputs,
|
Names: inputs,
|
||||||
Recipients: recipients,
|
Recipients: recipients,
|
||||||
Gifts: gifts,
|
Fee: uint64(fee),
|
||||||
Fee: uint64(fee),
|
IsMasterKey: true,
|
||||||
IsMasterKey: true,
|
Seed: seed1,
|
||||||
Key: base58.Encode(masterKey1.PrivateKey),
|
Index: 0,
|
||||||
ChainCode: base58.Encode(masterKey1.ChainCode),
|
Hardened: false,
|
||||||
Index: 0,
|
Version: 0,
|
||||||
Hardened: false,
|
RefundAddress: crypto.Tip5HashToBase58(addr1),
|
||||||
TimelockIntent: nil,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
res, err := handler.CreateTx(context.Background(), req)
|
res, err := handler.CreateTx(context.Background(), req)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
// the result is taken from create-tx scripts
|
// the result is taken from create-tx scripts
|
||||||
assert.Equal(t, res.RawTx.TxId, "8gjTa6H1MrKXPWgNJCF9fsYE7PUfqhYzxetUoTftz7zyHCv24ZYHDM3")
|
assert.Equal(t, res.RawTx.TxId, "6oDgTWnk6sL98yK49hcQTRAfCdFfgKh58U6TDTKmGPirhoxkMii2D6E")
|
||||||
}
|
}
|
||||||
|
|||||||
307
wallet/types.go
307
wallet/types.go
@ -1,188 +1,165 @@
|
|||||||
package wallet
|
package wallet
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"github.com/btcsuite/btcd/btcutil/base58"
|
"github.com/btcsuite/btcd/btcutil/base58"
|
||||||
"github.com/phamminh0811/private-grpc/crypto"
|
"github.com/phamminh0811/private-grpc/crypto"
|
||||||
"github.com/phamminh0811/private-grpc/nockchain"
|
"github.com/phamminh0811/private-grpc/nockchain"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ParseBalanceEntry(entry *nockchain.BalanceEntry) nockchain.NockchainNote {
|
func ParseBalanceEntry(entry *nockchain.BalanceEntry) nockchain.NockchainNote {
|
||||||
version := nockchain.Version(entry.Note.Version.Value)
|
switch entry.Note.NoteVersion.(type) {
|
||||||
pubkeys := []string{}
|
case *nockchain.Note_Legacy:
|
||||||
for _, pk := range entry.Note.Lock.SchnorrPubkeys {
|
note := entry.Note.GetLegacy()
|
||||||
pkPoint := crypto.CheetahPoint{
|
version := nockchain.Version(note.Version.Value)
|
||||||
X: [6]crypto.Belt{
|
pubkeys := []string{}
|
||||||
{Value: pk.Value.X.Belt_1.Value},
|
for _, pk := range note.Lock.SchnorrPubkeys {
|
||||||
{Value: pk.Value.X.Belt_2.Value},
|
pkPoint := crypto.CheetahPoint{
|
||||||
{Value: pk.Value.X.Belt_3.Value},
|
X: [6]crypto.Belt{
|
||||||
{Value: pk.Value.X.Belt_4.Value},
|
{Value: pk.Value.X.Belt_1.Value},
|
||||||
{Value: pk.Value.X.Belt_5.Value},
|
{Value: pk.Value.X.Belt_2.Value},
|
||||||
{Value: pk.Value.X.Belt_6.Value},
|
{Value: pk.Value.X.Belt_3.Value},
|
||||||
},
|
{Value: pk.Value.X.Belt_4.Value},
|
||||||
Y: [6]crypto.Belt{
|
{Value: pk.Value.X.Belt_5.Value},
|
||||||
{Value: pk.Value.Y.Belt_1.Value},
|
{Value: pk.Value.X.Belt_6.Value},
|
||||||
{Value: pk.Value.Y.Belt_2.Value},
|
|
||||||
{Value: pk.Value.Y.Belt_3.Value},
|
|
||||||
{Value: pk.Value.Y.Belt_4.Value},
|
|
||||||
{Value: pk.Value.Y.Belt_5.Value},
|
|
||||||
{Value: pk.Value.Y.Belt_6.Value},
|
|
||||||
},
|
|
||||||
Inf: pk.Value.Inf,
|
|
||||||
}
|
|
||||||
|
|
||||||
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,
|
|
||||||
}
|
|
||||||
return nockchain.NockchainNote{
|
|
||||||
Version: version,
|
|
||||||
BlockHeight: entry.Note.OriginPage.Value,
|
|
||||||
Timelock: ParseTimelockIntent(entry.Note.Timelock),
|
|
||||||
Name: &nockchain.NockchainName{
|
|
||||||
First: crypto.Tip5HashToBase58([5]uint64{
|
|
||||||
entry.Name.First.Belt_1.Value,
|
|
||||||
entry.Name.First.Belt_2.Value,
|
|
||||||
entry.Name.First.Belt_3.Value,
|
|
||||||
entry.Name.First.Belt_4.Value,
|
|
||||||
entry.Name.First.Belt_5.Value,
|
|
||||||
}),
|
|
||||||
Last: crypto.Tip5HashToBase58([5]uint64{
|
|
||||||
entry.Name.Last.Belt_1.Value,
|
|
||||||
entry.Name.Last.Belt_2.Value,
|
|
||||||
entry.Name.Last.Belt_3.Value,
|
|
||||||
entry.Name.Last.Belt_4.Value,
|
|
||||||
entry.Name.Last.Belt_5.Value,
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
Lock: &nockchain.NockchainLock{
|
|
||||||
KeysRequired: uint64(entry.Note.Lock.KeysRequired),
|
|
||||||
Pubkeys: pubkeys,
|
|
||||||
},
|
|
||||||
Source: &nockchain.NockchainSource{
|
|
||||||
Source: crypto.Tip5HashToBase58(sourceHash),
|
|
||||||
IsCoinbase: entry.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]},
|
|
||||||
},
|
|
||||||
TimelockRange: timelockRange,
|
|
||||||
TotalFees: &nockchain.Nicks{
|
|
||||||
Value: rawTx.TotalFees,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func ConvertInput(input *nockchain.NockchainInput) (*nockchain.NamedInput, error) {
|
|
||||||
pks := []*nockchain.SchnorrPubkey{}
|
|
||||||
|
|
||||||
for _, i := range input.Note.Lock.Pubkeys {
|
|
||||||
pk, err := ParseSchnorrPubkey(i)
|
|
||||||
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,
|
|
||||||
},
|
},
|
||||||
|
Y: [6]crypto.Belt{
|
||||||
|
{Value: pk.Value.Y.Belt_1.Value},
|
||||||
|
{Value: pk.Value.Y.Belt_2.Value},
|
||||||
|
{Value: pk.Value.Y.Belt_3.Value},
|
||||||
|
{Value: pk.Value.Y.Belt_4.Value},
|
||||||
|
{Value: pk.Value.Y.Belt_5.Value},
|
||||||
|
{Value: pk.Value.Y.Belt_6.Value},
|
||||||
|
},
|
||||||
|
Inf: pk.Value.Inf,
|
||||||
}
|
}
|
||||||
}
|
|
||||||
seeds = append(seeds, &nockchain.Seed{
|
|
||||||
OutputSource: source,
|
|
||||||
Recipient: &nockchain.Lock{
|
|
||||||
KeysRequired: uint32(seed.Recipient.KeysRequired),
|
|
||||||
SchnorrPubkeys: seedPks,
|
|
||||||
},
|
|
||||||
TimelockIntent: ConvertTimelockIntent(seed.TimelockIntent),
|
|
||||||
Gift: &nockchain.Nicks{Value: seed.Gift},
|
|
||||||
ParentHash: ParseHash(seed.ParentHash),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
sigEntries := []*nockchain.SignatureEntry{}
|
pkStr := base58.Encode(pkPoint.Bytes())
|
||||||
for _, sig := range input.Spend.Signatures {
|
pubkeys = append(pubkeys, pkStr)
|
||||||
pk, err := ParseSchnorrPubkey(sig.Pubkey)
|
}
|
||||||
|
sourceHash := [5]uint64{
|
||||||
|
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,
|
||||||
|
OriginPage: note.OriginPage.Value,
|
||||||
|
Name: &nockchain.NockchainName{
|
||||||
|
First: crypto.Tip5HashToBase58([5]uint64{
|
||||||
|
entry.Name.First.Belt_1.Value,
|
||||||
|
entry.Name.First.Belt_2.Value,
|
||||||
|
entry.Name.First.Belt_3.Value,
|
||||||
|
entry.Name.First.Belt_4.Value,
|
||||||
|
entry.Name.First.Belt_5.Value,
|
||||||
|
}),
|
||||||
|
Last: crypto.Tip5HashToBase58([5]uint64{
|
||||||
|
entry.Name.Last.Belt_1.Value,
|
||||||
|
entry.Name.Last.Belt_2.Value,
|
||||||
|
entry.Name.Last.Belt_3.Value,
|
||||||
|
entry.Name.Last.Belt_4.Value,
|
||||||
|
entry.Name.Last.Belt_5.Value,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
Lock: &nockchain.NockchainLock{
|
||||||
|
KeysRequired: uint64(note.Lock.KeysRequired),
|
||||||
|
Pubkeys: pubkeys,
|
||||||
|
},
|
||||||
|
Source: &nockchain.NockchainSource{
|
||||||
|
Source: crypto.Tip5HashToBase58(sourceHash),
|
||||||
|
IsCoinbase: note.Source.Coinbase,
|
||||||
|
},
|
||||||
|
Asset: note.Assets.Value,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
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 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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
sigEntries = append(sigEntries, &nockchain.SignatureEntry{
|
seeds := []*nockchain.Seed{}
|
||||||
SchnorrPubkey: pk,
|
for _, seed := range legacySpend.Seeds {
|
||||||
|
seeds = append(seeds, &nockchain.Seed{
|
||||||
|
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,
|
||||||
|
},
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
entries[i] = &nockchain.SignatureEntry{
|
||||||
|
SchnorrPubkey: pubkey,
|
||||||
Signature: &nockchain.SchnorrSignature{
|
Signature: &nockchain.SchnorrSignature{
|
||||||
Chal: ParseEightBelt(sig.Chal),
|
Chal: ParseEightBelt(sig.Chal),
|
||||||
Sig: ParseEightBelt(sig.Sig),
|
Sig: ParseEightBelt(sig.Sig),
|
||||||
},
|
},
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
return &nockchain.NamedInput{
|
return &nockchain.Signature{
|
||||||
Name: ConvertName(input.Name),
|
Entries: entries,
|
||||||
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},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
185
wallet/ztree.go
185
wallet/ztree.go
@ -1,8 +1,10 @@
|
|||||||
package wallet
|
package wallet
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"math/big"
|
||||||
"slices"
|
"slices"
|
||||||
|
|
||||||
|
"github.com/btcsuite/btcd/btcutil/base58"
|
||||||
"github.com/phamminh0811/private-grpc/crypto"
|
"github.com/phamminh0811/private-grpc/crypto"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -20,6 +22,11 @@ type ZTree struct {
|
|||||||
HashValueFunc func(interface{}) ([5]uint64, error)
|
HashValueFunc func(interface{}) ([5]uint64, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ZPair struct {
|
||||||
|
Key interface{}
|
||||||
|
Value interface{}
|
||||||
|
}
|
||||||
|
|
||||||
func NewZTree(hashKeyFunc func(interface{}) [5]uint64, hashValueFunc func(interface{}) ([5]uint64, error)) *ZTree {
|
func NewZTree(hashKeyFunc func(interface{}) [5]uint64, hashValueFunc func(interface{}) ([5]uint64, error)) *ZTree {
|
||||||
return &ZTree{
|
return &ZTree{
|
||||||
Root: nil,
|
Root: nil,
|
||||||
@ -36,13 +43,13 @@ func (z *ZTree) Hash() ([5]uint64, error) {
|
|||||||
return z.Root.HashNode(z.HashValueFunc)
|
return z.Root.HashNode(z.HashValueFunc)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (z *ZTree) KeyLeftMost() interface{} {
|
func (t *ZTree) Tap() []ZPair {
|
||||||
node := z.Root
|
tap := []ZPair{}
|
||||||
for node.Left != nil {
|
TapNode(t.Root, &tap)
|
||||||
node = node.Left
|
slices.Reverse(tap)
|
||||||
}
|
return tap
|
||||||
return node.Key
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (node *ZNode) InsertNode(hashFunc func(interface{}) [5]uint64, key, value interface{}) *ZNode {
|
func (node *ZNode) InsertNode(hashFunc func(interface{}) [5]uint64, key, value interface{}) *ZNode {
|
||||||
if node == nil {
|
if node == nil {
|
||||||
node = &ZNode{
|
node = &ZNode{
|
||||||
@ -53,42 +60,18 @@ func (node *ZNode) InsertNode(hashFunc func(interface{}) [5]uint64, key, value i
|
|||||||
}
|
}
|
||||||
return node
|
return node
|
||||||
}
|
}
|
||||||
|
|
||||||
keyHash := hashFunc(key)
|
keyHash := hashFunc(key)
|
||||||
keyDoubleHash := crypto.Tip5RehashTenCell(keyHash, keyHash)
|
keyDoubleHash := crypto.Tip5RehashTenCell(keyHash, keyHash)
|
||||||
nodeKeyHash := hashFunc(node.Key)
|
nodeKeyHash := hashFunc(node.Key)
|
||||||
nodeKeyDoubleHash := crypto.Tip5RehashTenCell(nodeKeyHash, nodeKeyHash)
|
nodeKeyDoubleHash := crypto.Tip5RehashTenCell(nodeKeyHash, nodeKeyHash)
|
||||||
|
|
||||||
if slices.Compare(keyHash[:], nodeKeyHash[:]) == -1 {
|
keyHashBigInt := new(big.Int).SetBytes(base58.Decode(crypto.Tip5HashToBase58(keyHash)))
|
||||||
|
nodeKeyHashBigInt := new(big.Int).SetBytes(base58.Decode(crypto.Tip5HashToBase58(nodeKeyHash)))
|
||||||
|
keyDoubleHashBigInt := new(big.Int).SetBytes(base58.Decode(crypto.Tip5HashToBase58(keyDoubleHash)))
|
||||||
|
nodeKeyDoubleHashBigInt := new(big.Int).SetBytes(base58.Decode(crypto.Tip5HashToBase58(nodeKeyDoubleHash)))
|
||||||
|
if keyHashBigInt.Cmp(nodeKeyHashBigInt) == 1 {
|
||||||
// key < node key
|
// key < node key
|
||||||
if slices.Compare(keyDoubleHash[:], nodeKeyDoubleHash[:]) == -1 {
|
if keyDoubleHashBigInt.Cmp(nodeKeyDoubleHashBigInt) == 1 {
|
||||||
// reinsert in left
|
|
||||||
node.Left = node.Left.InsertNode(hashFunc, key, value)
|
|
||||||
} else {
|
|
||||||
// new key
|
|
||||||
// / \
|
|
||||||
// ~ old key
|
|
||||||
// / \
|
|
||||||
// ... ...
|
|
||||||
nodeKey := node.Key
|
|
||||||
nodeValue := node.Value
|
|
||||||
leftNode := node.Left
|
|
||||||
rightNode := node.Right
|
|
||||||
node = &ZNode{
|
|
||||||
Key: key,
|
|
||||||
Value: value,
|
|
||||||
Right: nil,
|
|
||||||
Left: &ZNode{
|
|
||||||
Key: nodeKey,
|
|
||||||
Value: nodeValue,
|
|
||||||
Left: leftNode,
|
|
||||||
Right: rightNode,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// key > node key
|
|
||||||
if slices.Compare(keyDoubleHash[:], nodeKeyDoubleHash[:]) == -1 {
|
|
||||||
// reinsert in right
|
// reinsert in right
|
||||||
node.Right = node.Right.InsertNode(hashFunc, key, value)
|
node.Right = node.Right.InsertNode(hashFunc, key, value)
|
||||||
} else {
|
} else {
|
||||||
@ -101,16 +84,104 @@ func (node *ZNode) InsertNode(hashFunc func(interface{}) [5]uint64, key, value i
|
|||||||
nodeValue := node.Value
|
nodeValue := node.Value
|
||||||
leftNode := node.Left
|
leftNode := node.Left
|
||||||
rightNode := node.Right
|
rightNode := node.Right
|
||||||
node = &ZNode{
|
if rightNode == nil {
|
||||||
Key: key,
|
node = &ZNode{
|
||||||
Value: value,
|
Key: key,
|
||||||
Right: &ZNode{
|
Value: value,
|
||||||
Key: nodeKey,
|
Right: nil,
|
||||||
Value: nodeValue,
|
Left: &ZNode{
|
||||||
Left: leftNode,
|
Key: nodeKey,
|
||||||
Right: rightNode,
|
Value: nodeValue,
|
||||||
},
|
Left: leftNode,
|
||||||
Left: nil,
|
Right: nil,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
rightNodeKeyHash := hashFunc(rightNode.Key)
|
||||||
|
rightNodeKeyHashBigInt := new(big.Int).SetBytes(base58.Decode(crypto.Tip5HashToBase58(rightNodeKeyHash)))
|
||||||
|
if rightNodeKeyHashBigInt.Cmp(keyHashBigInt) == -1 {
|
||||||
|
node = &ZNode{
|
||||||
|
Key: key,
|
||||||
|
Value: value,
|
||||||
|
Right: nil,
|
||||||
|
Left: &ZNode{
|
||||||
|
Key: nodeKey,
|
||||||
|
Value: nodeValue,
|
||||||
|
Left: leftNode,
|
||||||
|
Right: rightNode,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
node = &ZNode{
|
||||||
|
Key: key,
|
||||||
|
Value: value,
|
||||||
|
Right: rightNode,
|
||||||
|
Left: &ZNode{
|
||||||
|
Key: nodeKey,
|
||||||
|
Value: nodeValue,
|
||||||
|
Left: leftNode,
|
||||||
|
Right: nil,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// key > node key
|
||||||
|
if keyDoubleHashBigInt.Cmp(nodeKeyDoubleHashBigInt) == 1 {
|
||||||
|
// reinsert in left
|
||||||
|
node.Left = node.Left.InsertNode(hashFunc, key, value)
|
||||||
|
} else {
|
||||||
|
// new key
|
||||||
|
// / \
|
||||||
|
// ~ old key
|
||||||
|
// / \
|
||||||
|
// ... ...
|
||||||
|
nodeKey := node.Key
|
||||||
|
nodeValue := node.Value
|
||||||
|
leftNode := node.Left
|
||||||
|
rightNode := node.Right
|
||||||
|
if leftNode == nil {
|
||||||
|
node = &ZNode{
|
||||||
|
Key: key,
|
||||||
|
Value: value,
|
||||||
|
Right: &ZNode{
|
||||||
|
Key: nodeKey,
|
||||||
|
Value: nodeValue,
|
||||||
|
Left: nil,
|
||||||
|
Right: rightNode,
|
||||||
|
},
|
||||||
|
Left: nil,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
leftNodeKeyHash := hashFunc(leftNode.Key)
|
||||||
|
leftNodeKeyHashBigInt := new(big.Int).SetBytes(base58.Decode(crypto.Tip5HashToBase58(leftNodeKeyHash)))
|
||||||
|
if leftNodeKeyHashBigInt.Cmp(keyHashBigInt) == -1 {
|
||||||
|
node = &ZNode{
|
||||||
|
Key: key,
|
||||||
|
Value: value,
|
||||||
|
Right: &ZNode{
|
||||||
|
Key: nodeKey,
|
||||||
|
Value: nodeValue,
|
||||||
|
Left: nil,
|
||||||
|
Right: rightNode,
|
||||||
|
},
|
||||||
|
Left: leftNode,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
node = &ZNode{
|
||||||
|
Key: key,
|
||||||
|
Value: value,
|
||||||
|
Right: &ZNode{
|
||||||
|
Key: nodeKey,
|
||||||
|
Value: nodeValue,
|
||||||
|
Left: leftNode,
|
||||||
|
Right: rightNode,
|
||||||
|
},
|
||||||
|
Left: nil,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -138,3 +209,25 @@ func (node *ZNode) HashNode(hashFunc func(interface{}) ([5]uint64, error)) ([5]u
|
|||||||
}
|
}
|
||||||
return crypto.Tip5RehashTenCell(valHash, hashLeftRight), nil
|
return crypto.Tip5RehashTenCell(valHash, hashLeftRight), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TapNode(node *ZNode, acc *[]ZPair) {
|
||||||
|
if node == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
stored := false
|
||||||
|
if node.Right != nil {
|
||||||
|
TapNode(node.Right, acc)
|
||||||
|
} else {
|
||||||
|
*acc = append(*acc, ZPair{Key: node.Key, Value: node.Value})
|
||||||
|
stored = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if node.Left != nil {
|
||||||
|
TapNode(node.Left, acc)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !stored {
|
||||||
|
*acc = append(*acc, ZPair{Key: node.Key, Value: node.Value})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user