diff --git a/crypto/master_key.go b/crypto/master_key.go index 0a48aed..ba6507d 100644 --- a/crypto/master_key.go +++ b/crypto/master_key.go @@ -17,11 +17,13 @@ var ( PublicKeyStart = []byte{12, 14, 187, 9} MagicDyckForPoint = []uint64{0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1} MagicDyckForT8 = []uint64{0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1} - MagicDyckForSeed = []uint64{0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1} + MagicDyckForSeed = []uint64{0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1} MagicDyckForName = []uint64{0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1} Tip5Zero = [5]uint64{1730770831742798981, 2676322185709933211, 8329210750824781744, 16756092452590401876, 3547445316740171466} Tip5One = [5]uint64{6727110957294540849, 15606243244732609007, 11887284596344881785, 10646863421881571398, 8146872807338919620} Tip5ZeroZero = [5]uint64{4372149332062030091, 17876920912185183887, 13348798570422431948, 8872865212694716527, 3385176510443841516} + LockTagTip5Hash = [5]uint64{14842882926452000379, 13014485748050717591, 1400056310629901848, 12454303796926623552, 932704623874458879} + PkhTagTip5Hash = [5]uint64{10156173885239003330, 10977325146168166962, 5009593872749405377, 3760122916894980618, 174876511384150447} ) type MasterKey struct { diff --git a/crypto/tip5.go b/crypto/tip5.go index df27761..c2ba26b 100644 --- a/crypto/tip5.go +++ b/crypto/tip5.go @@ -144,6 +144,14 @@ var ( INIT_SPONGE_FIX = [16]uint64{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295} ) +func Tip5HashLeaf(leaf uint64) [5]uint64 { + belts := []Belt{ + {Value: 1}, + {Value: leaf}, + } + return Tip5HashBelts(belts) +} + func Tip5HashBelts(input []Belt) [5]uint64 { inputLen := len(input) q := inputLen / RATE diff --git a/nockchain/blockchain.pb.go b/nockchain/blockchain.pb.go index adde804..58bded3 100644 --- a/nockchain/blockchain.pb.go +++ b/nockchain/blockchain.pb.go @@ -1,4 +1,4 @@ -// nockchain/common/v1/blockchain.proto +// nockchain/common/v2/blockchain.proto // Code generated by protoc-gen-go. DO NOT EDIT. // versions: @@ -23,36 +23,30 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -type WalletBalanceData struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Page of full UTXO entries for the requested wallet. Entries are ordered - // by (Name.first, Name.last) to support consistent pagination. - Notes []*BalanceEntry `protobuf:"bytes,1,rep,name=notes,proto3" json:"notes,omitempty"` // note name -> amount - // Snapshot metadata where this page was computed. Clients should include - // the returned page token to continue paging against the same snapshot. - Height *BlockHeight `protobuf:"bytes,2,opt,name=height,proto3" json:"height,omitempty"` // block height where balance was computed - BlockId *Hash `protobuf:"bytes,3,opt,name=block_id,json=blockId,proto3,oneof" json:"block_id,omitempty"` // block where balance was computed - // Pagination cursor for fetching the next page in a paginated view. - // When empty, there are no further results for this snapshot. - Page *PageResponse `protobuf:"bytes,4,opt,name=page,proto3" json:"page,omitempty"` +type Balance struct { + state protoimpl.MessageState `protogen:"open.v1"` + Notes []*BalanceEntry `protobuf:"bytes,1,rep,name=notes,proto3" json:"notes,omitempty"` + Height *BlockHeight `protobuf:"bytes,2,opt,name=height,proto3" json:"height,omitempty"` + BlockId *Hash `protobuf:"bytes,3,opt,name=block_id,json=blockId,proto3,oneof" json:"block_id,omitempty"` + Page *PageResponse `protobuf:"bytes,4,opt,name=page,proto3" json:"page,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *WalletBalanceData) Reset() { - *x = WalletBalanceData{} +func (x *Balance) Reset() { + *x = Balance{} mi := &file_blockchain_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *WalletBalanceData) String() string { +func (x *Balance) String() string { return protoimpl.X.MessageStringOf(x) } -func (*WalletBalanceData) ProtoMessage() {} +func (*Balance) ProtoMessage() {} -func (x *WalletBalanceData) ProtoReflect() protoreflect.Message { +func (x *Balance) ProtoReflect() protoreflect.Message { mi := &file_blockchain_proto_msgTypes[0] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -64,33 +58,33 @@ func (x *WalletBalanceData) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use WalletBalanceData.ProtoReflect.Descriptor instead. -func (*WalletBalanceData) Descriptor() ([]byte, []int) { +// Deprecated: Use Balance.ProtoReflect.Descriptor instead. +func (*Balance) Descriptor() ([]byte, []int) { return file_blockchain_proto_rawDescGZIP(), []int{0} } -func (x *WalletBalanceData) GetNotes() []*BalanceEntry { +func (x *Balance) GetNotes() []*BalanceEntry { if x != nil { return x.Notes } return nil } -func (x *WalletBalanceData) GetHeight() *BlockHeight { +func (x *Balance) GetHeight() *BlockHeight { if x != nil { return x.Height } return nil } -func (x *WalletBalanceData) GetBlockId() *Hash { +func (x *Balance) GetBlockId() *Hash { if x != nil { return x.BlockId } return nil } -func (x *WalletBalanceData) GetPage() *PageResponse { +func (x *Balance) GetPage() *PageResponse { if x != nil { return x.Page } @@ -149,14 +143,11 @@ func (x *BalanceEntry) GetNote() *Note { return nil } -// the string key is the name of the input -// message RawTransaction { map inputs = 1; } type RawTransaction struct { state protoimpl.MessageState `protogen:"open.v1"` - NamedInputs []*NamedInput `protobuf:"bytes,1,rep,name=named_inputs,json=namedInputs,proto3" json:"named_inputs,omitempty"` - TimelockRange *TimeLockRangeAbsolute `protobuf:"bytes,2,opt,name=timelock_range,json=timelockRange,proto3" json:"timelock_range,omitempty"` - TotalFees *Nicks `protobuf:"bytes,3,opt,name=total_fees,json=totalFees,proto3" json:"total_fees,omitempty"` - Id *Hash `protobuf:"bytes,4,opt,name=id,proto3" json:"id,omitempty"` + Version *NoteVersion `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + Id *Hash `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` + Spends []*SpendEntry `protobuf:"bytes,3,rep,name=spends,proto3" json:"spends,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -191,23 +182,9 @@ func (*RawTransaction) Descriptor() ([]byte, []int) { return file_blockchain_proto_rawDescGZIP(), []int{2} } -func (x *RawTransaction) GetNamedInputs() []*NamedInput { +func (x *RawTransaction) GetVersion() *NoteVersion { if x != nil { - return x.NamedInputs - } - return nil -} - -func (x *RawTransaction) GetTimelockRange() *TimeLockRangeAbsolute { - if x != nil { - return x.TimelockRange - } - return nil -} - -func (x *RawTransaction) GetTotalFees() *Nicks { - if x != nil { - return x.TotalFees + return x.Version } return nil } @@ -219,28 +196,35 @@ func (x *RawTransaction) GetId() *Hash { return nil } -type NamedInput struct { +func (x *RawTransaction) GetSpends() []*SpendEntry { + if x != nil { + return x.Spends + } + return nil +} + +type SpendEntry struct { state protoimpl.MessageState `protogen:"open.v1"` Name *Name `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Input *Input `protobuf:"bytes,2,opt,name=input,proto3" json:"input,omitempty"` + Spend *Spend `protobuf:"bytes,2,opt,name=spend,proto3" json:"spend,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *NamedInput) Reset() { - *x = NamedInput{} +func (x *SpendEntry) Reset() { + *x = SpendEntry{} mi := &file_blockchain_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *NamedInput) String() string { +func (x *SpendEntry) String() string { return protoimpl.X.MessageStringOf(x) } -func (*NamedInput) ProtoMessage() {} +func (*SpendEntry) ProtoMessage() {} -func (x *NamedInput) ProtoReflect() protoreflect.Message { +func (x *SpendEntry) ProtoReflect() protoreflect.Message { mi := &file_blockchain_proto_msgTypes[3] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -252,71 +236,19 @@ func (x *NamedInput) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use NamedInput.ProtoReflect.Descriptor instead. -func (*NamedInput) Descriptor() ([]byte, []int) { +// Deprecated: Use SpendEntry.ProtoReflect.Descriptor instead. +func (*SpendEntry) Descriptor() ([]byte, []int) { return file_blockchain_proto_rawDescGZIP(), []int{3} } -func (x *NamedInput) GetName() *Name { +func (x *SpendEntry) GetName() *Name { if x != nil { return x.Name } return nil } -func (x *NamedInput) GetInput() *Input { - if x != nil { - return x.Input - } - return nil -} - -type Input struct { - state protoimpl.MessageState `protogen:"open.v1"` - Note *Note `protobuf:"bytes,1,opt,name=note,proto3" json:"note,omitempty"` - Spend *Spend `protobuf:"bytes,2,opt,name=spend,proto3" json:"spend,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Input) Reset() { - *x = Input{} - mi := &file_blockchain_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Input) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Input) ProtoMessage() {} - -func (x *Input) ProtoReflect() protoreflect.Message { - mi := &file_blockchain_proto_msgTypes[4] - 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 Input.ProtoReflect.Descriptor instead. -func (*Input) Descriptor() ([]byte, []int) { - return file_blockchain_proto_rawDescGZIP(), []int{4} -} - -func (x *Input) GetNote() *Note { - if x != nil { - return x.Note - } - return nil -} - -func (x *Input) GetSpend() *Spend { +func (x *SpendEntry) GetSpend() *Spend { if x != nil { return x.Spend } @@ -324,17 +256,19 @@ func (x *Input) GetSpend() *Spend { } type Spend struct { - state protoimpl.MessageState `protogen:"open.v1"` - Signature *Signature `protobuf:"bytes,1,opt,name=signature,proto3" json:"signature,omitempty"` - Seeds []*Seed `protobuf:"bytes,2,rep,name=seeds,proto3" json:"seeds,omitempty"` - MinerFeeNicks *Nicks `protobuf:"bytes,3,opt,name=miner_fee_nicks,json=minerFeeNicks,proto3" json:"miner_fee_nicks,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to SpendKind: + // + // *Spend_Legacy + // *Spend_Witness + SpendKind isSpend_SpendKind `protobuf_oneof:"spend_kind"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *Spend) Reset() { *x = Spend{} - mi := &file_blockchain_proto_msgTypes[5] + mi := &file_blockchain_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -346,7 +280,7 @@ func (x *Spend) String() string { func (*Spend) ProtoMessage() {} func (x *Spend) ProtoReflect() protoreflect.Message { - mi := &file_blockchain_proto_msgTypes[5] + mi := &file_blockchain_proto_msgTypes[4] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -359,44 +293,185 @@ func (x *Spend) ProtoReflect() protoreflect.Message { // Deprecated: Use Spend.ProtoReflect.Descriptor instead. func (*Spend) Descriptor() ([]byte, []int) { + return file_blockchain_proto_rawDescGZIP(), []int{4} +} + +func (x *Spend) GetSpendKind() isSpend_SpendKind { + if x != nil { + return x.SpendKind + } + return nil +} + +func (x *Spend) GetLegacy() *LegacySpend { + if x != nil { + if x, ok := x.SpendKind.(*Spend_Legacy); ok { + return x.Legacy + } + } + return nil +} + +func (x *Spend) GetWitness() *WitnessSpend { + if x != nil { + if x, ok := x.SpendKind.(*Spend_Witness); ok { + return x.Witness + } + } + return nil +} + +type isSpend_SpendKind interface { + isSpend_SpendKind() +} + +type Spend_Legacy struct { + Legacy *LegacySpend `protobuf:"bytes,1,opt,name=legacy,proto3,oneof"` +} + +type Spend_Witness struct { + Witness *WitnessSpend `protobuf:"bytes,2,opt,name=witness,proto3,oneof"` +} + +func (*Spend_Legacy) isSpend_SpendKind() {} + +func (*Spend_Witness) isSpend_SpendKind() {} + +type LegacySpend struct { + state protoimpl.MessageState `protogen:"open.v1"` + Signature *Signature `protobuf:"bytes,1,opt,name=signature,proto3" json:"signature,omitempty"` + Seeds []*Seed `protobuf:"bytes,2,rep,name=seeds,proto3" json:"seeds,omitempty"` + MinerFeeNicks *Nicks `protobuf:"bytes,3,opt,name=miner_fee_nicks,json=minerFeeNicks,proto3" json:"miner_fee_nicks,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LegacySpend) Reset() { + *x = LegacySpend{} + mi := &file_blockchain_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LegacySpend) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LegacySpend) ProtoMessage() {} + +func (x *LegacySpend) ProtoReflect() protoreflect.Message { + mi := &file_blockchain_proto_msgTypes[5] + 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 LegacySpend.ProtoReflect.Descriptor instead. +func (*LegacySpend) Descriptor() ([]byte, []int) { return file_blockchain_proto_rawDescGZIP(), []int{5} } -func (x *Spend) GetSignature() *Signature { +func (x *LegacySpend) GetSignature() *Signature { if x != nil { return x.Signature } return nil } -func (x *Spend) GetSeeds() []*Seed { +func (x *LegacySpend) GetSeeds() []*Seed { if x != nil { return x.Seeds } return nil } -func (x *Spend) GetMinerFeeNicks() *Nicks { +func (x *LegacySpend) GetMinerFeeNicks() *Nicks { if x != nil { return x.MinerFeeNicks } return nil } +type WitnessSpend struct { + state protoimpl.MessageState `protogen:"open.v1"` + Witness *Witness `protobuf:"bytes,1,opt,name=witness,proto3" json:"witness,omitempty"` + Seeds []*Seed `protobuf:"bytes,2,rep,name=seeds,proto3" json:"seeds,omitempty"` + Fee *Nicks `protobuf:"bytes,3,opt,name=fee,proto3" json:"fee,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *WitnessSpend) Reset() { + *x = WitnessSpend{} + mi := &file_blockchain_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *WitnessSpend) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WitnessSpend) ProtoMessage() {} + +func (x *WitnessSpend) ProtoReflect() protoreflect.Message { + mi := &file_blockchain_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 WitnessSpend.ProtoReflect.Descriptor instead. +func (*WitnessSpend) Descriptor() ([]byte, []int) { + return file_blockchain_proto_rawDescGZIP(), []int{6} +} + +func (x *WitnessSpend) GetWitness() *Witness { + if x != nil { + return x.Witness + } + return nil +} + +func (x *WitnessSpend) GetSeeds() []*Seed { + if x != nil { + return x.Seeds + } + return nil +} + +func (x *WitnessSpend) GetFee() *Nicks { + if x != nil { + return x.Fee + } + return nil +} + type Seed struct { - state protoimpl.MessageState `protogen:"open.v1"` - OutputSource *OutputSource `protobuf:"bytes,1,opt,name=output_source,json=outputSource,proto3,oneof" json:"output_source,omitempty"` - Recipient *Lock `protobuf:"bytes,2,opt,name=recipient,proto3" json:"recipient,omitempty"` - TimelockIntent *TimeLockIntent `protobuf:"bytes,3,opt,name=timelock_intent,json=timelockIntent,proto3,oneof" json:"timelock_intent,omitempty"` - Gift *Nicks `protobuf:"bytes,4,opt,name=gift,proto3" json:"gift,omitempty"` - ParentHash *Hash `protobuf:"bytes,5,opt,name=parent_hash,json=parentHash,proto3" json:"parent_hash,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + // Absent when the seed originates from a coinbase output. + OutputSource *Source `protobuf:"bytes,1,opt,name=output_source,json=outputSource,proto3" json:"output_source,omitempty"` + LockRoot *Hash `protobuf:"bytes,2,opt,name=lock_root,json=lockRoot,proto3" json:"lock_root,omitempty"` + NoteData *NoteData `protobuf:"bytes,3,opt,name=note_data,json=noteData,proto3" json:"note_data,omitempty"` + Gift *Nicks `protobuf:"bytes,4,opt,name=gift,proto3" json:"gift,omitempty"` + ParentHash *Hash `protobuf:"bytes,5,opt,name=parent_hash,json=parentHash,proto3" json:"parent_hash,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *Seed) Reset() { *x = Seed{} - mi := &file_blockchain_proto_msgTypes[6] + mi := &file_blockchain_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -408,7 +483,7 @@ func (x *Seed) String() string { func (*Seed) ProtoMessage() {} func (x *Seed) ProtoReflect() protoreflect.Message { - mi := &file_blockchain_proto_msgTypes[6] + mi := &file_blockchain_proto_msgTypes[7] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -421,26 +496,26 @@ func (x *Seed) ProtoReflect() protoreflect.Message { // Deprecated: Use Seed.ProtoReflect.Descriptor instead. func (*Seed) Descriptor() ([]byte, []int) { - return file_blockchain_proto_rawDescGZIP(), []int{6} + return file_blockchain_proto_rawDescGZIP(), []int{7} } -func (x *Seed) GetOutputSource() *OutputSource { +func (x *Seed) GetOutputSource() *Source { if x != nil { return x.OutputSource } return nil } -func (x *Seed) GetRecipient() *Lock { +func (x *Seed) GetLockRoot() *Hash { if x != nil { - return x.Recipient + return x.LockRoot } return nil } -func (x *Seed) GetTimelockIntent() *TimeLockIntent { +func (x *Seed) GetNoteData() *NoteData { if x != nil { - return x.TimelockIntent + return x.NoteData } return nil } @@ -459,6 +534,676 @@ func (x *Seed) GetParentHash() *Hash { return nil } +type Witness struct { + state protoimpl.MessageState `protogen:"open.v1"` + LockMerkleProof *LockMerkleProof `protobuf:"bytes,1,opt,name=lock_merkle_proof,json=lockMerkleProof,proto3" json:"lock_merkle_proof,omitempty"` + PkhSignature *PkhSignature `protobuf:"bytes,2,opt,name=pkh_signature,json=pkhSignature,proto3" json:"pkh_signature,omitempty"` + Hax []*HaxPreimage `protobuf:"bytes,3,rep,name=hax,proto3" json:"hax,omitempty"` //uint64 tim = 4; // reserved field, currently 0 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Witness) Reset() { + *x = Witness{} + mi := &file_blockchain_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Witness) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Witness) ProtoMessage() {} + +func (x *Witness) ProtoReflect() protoreflect.Message { + mi := &file_blockchain_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 Witness.ProtoReflect.Descriptor instead. +func (*Witness) Descriptor() ([]byte, []int) { + return file_blockchain_proto_rawDescGZIP(), []int{8} +} + +func (x *Witness) GetLockMerkleProof() *LockMerkleProof { + if x != nil { + return x.LockMerkleProof + } + return nil +} + +func (x *Witness) GetPkhSignature() *PkhSignature { + if x != nil { + return x.PkhSignature + } + return nil +} + +func (x *Witness) GetHax() []*HaxPreimage { + if x != nil { + return x.Hax + } + return nil +} + +type HaxPreimage struct { + state protoimpl.MessageState `protogen:"open.v1"` + Hash *Hash `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` + Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` // jammed noun bytes + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HaxPreimage) Reset() { + *x = HaxPreimage{} + mi := &file_blockchain_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HaxPreimage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HaxPreimage) ProtoMessage() {} + +func (x *HaxPreimage) ProtoReflect() protoreflect.Message { + mi := &file_blockchain_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 HaxPreimage.ProtoReflect.Descriptor instead. +func (*HaxPreimage) Descriptor() ([]byte, []int) { + return file_blockchain_proto_rawDescGZIP(), []int{9} +} + +func (x *HaxPreimage) GetHash() *Hash { + if x != nil { + return x.Hash + } + return nil +} + +func (x *HaxPreimage) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +type PkhSignature struct { + state protoimpl.MessageState `protogen:"open.v1"` + Entries []*PkhSignatureEntry `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PkhSignature) Reset() { + *x = PkhSignature{} + mi := &file_blockchain_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PkhSignature) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PkhSignature) ProtoMessage() {} + +func (x *PkhSignature) ProtoReflect() protoreflect.Message { + mi := &file_blockchain_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 PkhSignature.ProtoReflect.Descriptor instead. +func (*PkhSignature) Descriptor() ([]byte, []int) { + return file_blockchain_proto_rawDescGZIP(), []int{10} +} + +func (x *PkhSignature) GetEntries() []*PkhSignatureEntry { + if x != nil { + return x.Entries + } + return nil +} + +type PkhSignatureEntry struct { + state protoimpl.MessageState `protogen:"open.v1"` + Hash *Hash `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` + Pubkey *SchnorrPubkey `protobuf:"bytes,2,opt,name=pubkey,proto3" json:"pubkey,omitempty"` + Signature *SchnorrSignature `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PkhSignatureEntry) Reset() { + *x = PkhSignatureEntry{} + mi := &file_blockchain_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PkhSignatureEntry) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PkhSignatureEntry) ProtoMessage() {} + +func (x *PkhSignatureEntry) ProtoReflect() protoreflect.Message { + mi := &file_blockchain_proto_msgTypes[11] + 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 PkhSignatureEntry.ProtoReflect.Descriptor instead. +func (*PkhSignatureEntry) Descriptor() ([]byte, []int) { + return file_blockchain_proto_rawDescGZIP(), []int{11} +} + +func (x *PkhSignatureEntry) GetHash() *Hash { + if x != nil { + return x.Hash + } + return nil +} + +func (x *PkhSignatureEntry) GetPubkey() *SchnorrPubkey { + if x != nil { + return x.Pubkey + } + return nil +} + +func (x *PkhSignatureEntry) GetSignature() *SchnorrSignature { + if x != nil { + return x.Signature + } + return nil +} + +type LockMerkleProof struct { + state protoimpl.MessageState `protogen:"open.v1"` + SpendCondition *SpendCondition `protobuf:"bytes,1,opt,name=spend_condition,json=spendCondition,proto3" json:"spend_condition,omitempty"` + Axis uint64 `protobuf:"varint,2,opt,name=axis,proto3" json:"axis,omitempty"` + Proof *MerkleProof `protobuf:"bytes,3,opt,name=proof,proto3" json:"proof,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LockMerkleProof) Reset() { + *x = LockMerkleProof{} + mi := &file_blockchain_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LockMerkleProof) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LockMerkleProof) ProtoMessage() {} + +func (x *LockMerkleProof) ProtoReflect() protoreflect.Message { + mi := &file_blockchain_proto_msgTypes[12] + 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 LockMerkleProof.ProtoReflect.Descriptor instead. +func (*LockMerkleProof) Descriptor() ([]byte, []int) { + return file_blockchain_proto_rawDescGZIP(), []int{12} +} + +func (x *LockMerkleProof) GetSpendCondition() *SpendCondition { + if x != nil { + return x.SpendCondition + } + return nil +} + +func (x *LockMerkleProof) GetAxis() uint64 { + if x != nil { + return x.Axis + } + return 0 +} + +func (x *LockMerkleProof) GetProof() *MerkleProof { + if x != nil { + return x.Proof + } + return nil +} + +type SpendCondition struct { + state protoimpl.MessageState `protogen:"open.v1"` + Primitives []*LockPrimitive `protobuf:"bytes,1,rep,name=primitives,proto3" json:"primitives,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SpendCondition) Reset() { + *x = SpendCondition{} + mi := &file_blockchain_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SpendCondition) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SpendCondition) ProtoMessage() {} + +func (x *SpendCondition) ProtoReflect() protoreflect.Message { + mi := &file_blockchain_proto_msgTypes[13] + 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 SpendCondition.ProtoReflect.Descriptor instead. +func (*SpendCondition) Descriptor() ([]byte, []int) { + return file_blockchain_proto_rawDescGZIP(), []int{13} +} + +func (x *SpendCondition) GetPrimitives() []*LockPrimitive { + if x != nil { + return x.Primitives + } + return nil +} + +type LockPrimitive struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Primitive: + // + // *LockPrimitive_Pkh + // *LockPrimitive_Tim + // *LockPrimitive_Hax + // *LockPrimitive_Burn + Primitive isLockPrimitive_Primitive `protobuf_oneof:"primitive"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LockPrimitive) Reset() { + *x = LockPrimitive{} + mi := &file_blockchain_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LockPrimitive) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LockPrimitive) ProtoMessage() {} + +func (x *LockPrimitive) ProtoReflect() protoreflect.Message { + mi := &file_blockchain_proto_msgTypes[14] + 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 LockPrimitive.ProtoReflect.Descriptor instead. +func (*LockPrimitive) Descriptor() ([]byte, []int) { + return file_blockchain_proto_rawDescGZIP(), []int{14} +} + +func (x *LockPrimitive) GetPrimitive() isLockPrimitive_Primitive { + if x != nil { + return x.Primitive + } + return nil +} + +func (x *LockPrimitive) GetPkh() *PkhLock { + if x != nil { + if x, ok := x.Primitive.(*LockPrimitive_Pkh); ok { + return x.Pkh + } + } + return nil +} + +func (x *LockPrimitive) GetTim() *LockTim { + if x != nil { + if x, ok := x.Primitive.(*LockPrimitive_Tim); ok { + return x.Tim + } + } + return nil +} + +func (x *LockPrimitive) GetHax() *HaxLock { + if x != nil { + if x, ok := x.Primitive.(*LockPrimitive_Hax); ok { + return x.Hax + } + } + return nil +} + +func (x *LockPrimitive) GetBurn() *BurnLock { + if x != nil { + if x, ok := x.Primitive.(*LockPrimitive_Burn); ok { + return x.Burn + } + } + return nil +} + +type isLockPrimitive_Primitive interface { + isLockPrimitive_Primitive() +} + +type LockPrimitive_Pkh struct { + Pkh *PkhLock `protobuf:"bytes,1,opt,name=pkh,proto3,oneof"` +} + +type LockPrimitive_Tim struct { + Tim *LockTim `protobuf:"bytes,2,opt,name=tim,proto3,oneof"` +} + +type LockPrimitive_Hax struct { + Hax *HaxLock `protobuf:"bytes,3,opt,name=hax,proto3,oneof"` +} + +type LockPrimitive_Burn struct { + Burn *BurnLock `protobuf:"bytes,4,opt,name=burn,proto3,oneof"` +} + +func (*LockPrimitive_Pkh) isLockPrimitive_Primitive() {} + +func (*LockPrimitive_Tim) isLockPrimitive_Primitive() {} + +func (*LockPrimitive_Hax) isLockPrimitive_Primitive() {} + +func (*LockPrimitive_Burn) isLockPrimitive_Primitive() {} + +type PkhLock struct { + state protoimpl.MessageState `protogen:"open.v1"` + M uint64 `protobuf:"varint,1,opt,name=m,proto3" json:"m,omitempty"` + Hashes []*Hash `protobuf:"bytes,2,rep,name=hashes,proto3" json:"hashes,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PkhLock) Reset() { + *x = PkhLock{} + mi := &file_blockchain_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PkhLock) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PkhLock) ProtoMessage() {} + +func (x *PkhLock) ProtoReflect() protoreflect.Message { + mi := &file_blockchain_proto_msgTypes[15] + 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 PkhLock.ProtoReflect.Descriptor instead. +func (*PkhLock) Descriptor() ([]byte, []int) { + return file_blockchain_proto_rawDescGZIP(), []int{15} +} + +func (x *PkhLock) GetM() uint64 { + if x != nil { + return x.M + } + return 0 +} + +func (x *PkhLock) GetHashes() []*Hash { + if x != nil { + return x.Hashes + } + return nil +} + +type LockTim struct { + state protoimpl.MessageState `protogen:"open.v1"` + Rel *TimeLockRangeRelative `protobuf:"bytes,1,opt,name=rel,proto3" json:"rel,omitempty"` + Abs *TimeLockRangeAbsolute `protobuf:"bytes,2,opt,name=abs,proto3" json:"abs,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LockTim) Reset() { + *x = LockTim{} + mi := &file_blockchain_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LockTim) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LockTim) ProtoMessage() {} + +func (x *LockTim) ProtoReflect() protoreflect.Message { + mi := &file_blockchain_proto_msgTypes[16] + 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 LockTim.ProtoReflect.Descriptor instead. +func (*LockTim) Descriptor() ([]byte, []int) { + return file_blockchain_proto_rawDescGZIP(), []int{16} +} + +func (x *LockTim) GetRel() *TimeLockRangeRelative { + if x != nil { + return x.Rel + } + return nil +} + +func (x *LockTim) GetAbs() *TimeLockRangeAbsolute { + if x != nil { + return x.Abs + } + return nil +} + +type HaxLock struct { + state protoimpl.MessageState `protogen:"open.v1"` + Hashes []*Hash `protobuf:"bytes,1,rep,name=hashes,proto3" json:"hashes,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HaxLock) Reset() { + *x = HaxLock{} + mi := &file_blockchain_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HaxLock) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HaxLock) ProtoMessage() {} + +func (x *HaxLock) ProtoReflect() protoreflect.Message { + mi := &file_blockchain_proto_msgTypes[17] + 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 HaxLock.ProtoReflect.Descriptor instead. +func (*HaxLock) Descriptor() ([]byte, []int) { + return file_blockchain_proto_rawDescGZIP(), []int{17} +} + +func (x *HaxLock) GetHashes() []*Hash { + if x != nil { + return x.Hashes + } + return nil +} + +type BurnLock struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BurnLock) Reset() { + *x = BurnLock{} + mi := &file_blockchain_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BurnLock) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BurnLock) ProtoMessage() {} + +func (x *BurnLock) ProtoReflect() protoreflect.Message { + mi := &file_blockchain_proto_msgTypes[18] + 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 BurnLock.ProtoReflect.Descriptor instead. +func (*BurnLock) Descriptor() ([]byte, []int) { + return file_blockchain_proto_rawDescGZIP(), []int{18} +} + +type MerkleProof struct { + state protoimpl.MessageState `protogen:"open.v1"` + Root *Hash `protobuf:"bytes,1,opt,name=root,proto3" json:"root,omitempty"` + Path []*Hash `protobuf:"bytes,2,rep,name=path,proto3" json:"path,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MerkleProof) Reset() { + *x = MerkleProof{} + mi := &file_blockchain_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MerkleProof) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MerkleProof) ProtoMessage() {} + +func (x *MerkleProof) ProtoReflect() protoreflect.Message { + mi := &file_blockchain_proto_msgTypes[19] + 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 MerkleProof.ProtoReflect.Descriptor instead. +func (*MerkleProof) Descriptor() ([]byte, []int) { + return file_blockchain_proto_rawDescGZIP(), []int{19} +} + +func (x *MerkleProof) GetRoot() *Hash { + if x != nil { + return x.Root + } + return nil +} + +func (x *MerkleProof) GetPath() []*Hash { + if x != nil { + return x.Path + } + return nil +} + type OutputSource struct { state protoimpl.MessageState `protogen:"open.v1"` Source *Source `protobuf:"bytes,1,opt,name=source,proto3,oneof" json:"source,omitempty"` @@ -468,7 +1213,7 @@ type OutputSource struct { func (x *OutputSource) Reset() { *x = OutputSource{} - mi := &file_blockchain_proto_msgTypes[7] + mi := &file_blockchain_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -480,7 +1225,7 @@ func (x *OutputSource) String() string { func (*OutputSource) ProtoMessage() {} func (x *OutputSource) ProtoReflect() protoreflect.Message { - mi := &file_blockchain_proto_msgTypes[7] + mi := &file_blockchain_proto_msgTypes[20] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -493,7 +1238,7 @@ func (x *OutputSource) ProtoReflect() protoreflect.Message { // Deprecated: Use OutputSource.ProtoReflect.Descriptor instead. func (*OutputSource) Descriptor() ([]byte, []int) { - return file_blockchain_proto_rawDescGZIP(), []int{7} + return file_blockchain_proto_rawDescGZIP(), []int{20} } func (x *OutputSource) GetSource() *Source { @@ -513,7 +1258,7 @@ type Source struct { func (x *Source) Reset() { *x = Source{} - mi := &file_blockchain_proto_msgTypes[8] + mi := &file_blockchain_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -525,7 +1270,7 @@ func (x *Source) String() string { func (*Source) ProtoMessage() {} func (x *Source) ProtoReflect() protoreflect.Message { - mi := &file_blockchain_proto_msgTypes[8] + mi := &file_blockchain_proto_msgTypes[21] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -538,7 +1283,7 @@ func (x *Source) ProtoReflect() protoreflect.Message { // Deprecated: Use Source.ProtoReflect.Descriptor instead. func (*Source) Descriptor() ([]byte, []int) { - return file_blockchain_proto_rawDescGZIP(), []int{8} + return file_blockchain_proto_rawDescGZIP(), []int{21} } func (x *Source) GetHash() *Hash { @@ -569,7 +1314,7 @@ type TimeLockIntent struct { func (x *TimeLockIntent) Reset() { *x = TimeLockIntent{} - mi := &file_blockchain_proto_msgTypes[9] + mi := &file_blockchain_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -581,7 +1326,7 @@ func (x *TimeLockIntent) String() string { func (*TimeLockIntent) ProtoMessage() {} func (x *TimeLockIntent) ProtoReflect() protoreflect.Message { - mi := &file_blockchain_proto_msgTypes[9] + mi := &file_blockchain_proto_msgTypes[22] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -594,7 +1339,7 @@ func (x *TimeLockIntent) ProtoReflect() protoreflect.Message { // Deprecated: Use TimeLockIntent.ProtoReflect.Descriptor instead. func (*TimeLockIntent) Descriptor() ([]byte, []int) { - return file_blockchain_proto_rawDescGZIP(), []int{9} + return file_blockchain_proto_rawDescGZIP(), []int{22} } func (x *TimeLockIntent) GetValue() isTimeLockIntent_Value { @@ -663,7 +1408,7 @@ type TimeLockRangeAbsoluteAndRelative struct { func (x *TimeLockRangeAbsoluteAndRelative) Reset() { *x = TimeLockRangeAbsoluteAndRelative{} - mi := &file_blockchain_proto_msgTypes[10] + mi := &file_blockchain_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -675,7 +1420,7 @@ func (x *TimeLockRangeAbsoluteAndRelative) String() string { func (*TimeLockRangeAbsoluteAndRelative) ProtoMessage() {} func (x *TimeLockRangeAbsoluteAndRelative) ProtoReflect() protoreflect.Message { - mi := &file_blockchain_proto_msgTypes[10] + mi := &file_blockchain_proto_msgTypes[23] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -688,7 +1433,7 @@ func (x *TimeLockRangeAbsoluteAndRelative) ProtoReflect() protoreflect.Message { // Deprecated: Use TimeLockRangeAbsoluteAndRelative.ProtoReflect.Descriptor instead. func (*TimeLockRangeAbsoluteAndRelative) Descriptor() ([]byte, []int) { - return file_blockchain_proto_rawDescGZIP(), []int{10} + return file_blockchain_proto_rawDescGZIP(), []int{23} } func (x *TimeLockRangeAbsoluteAndRelative) GetAbsolute() *TimeLockRangeAbsolute { @@ -716,7 +1461,7 @@ type TimeLockRangeAbsolute struct { func (x *TimeLockRangeAbsolute) Reset() { *x = TimeLockRangeAbsolute{} - mi := &file_blockchain_proto_msgTypes[11] + mi := &file_blockchain_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -728,7 +1473,7 @@ func (x *TimeLockRangeAbsolute) String() string { func (*TimeLockRangeAbsolute) ProtoMessage() {} func (x *TimeLockRangeAbsolute) ProtoReflect() protoreflect.Message { - mi := &file_blockchain_proto_msgTypes[11] + mi := &file_blockchain_proto_msgTypes[24] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -741,7 +1486,7 @@ func (x *TimeLockRangeAbsolute) ProtoReflect() protoreflect.Message { // Deprecated: Use TimeLockRangeAbsolute.ProtoReflect.Descriptor instead. func (*TimeLockRangeAbsolute) Descriptor() ([]byte, []int) { - return file_blockchain_proto_rawDescGZIP(), []int{11} + return file_blockchain_proto_rawDescGZIP(), []int{24} } func (x *TimeLockRangeAbsolute) GetMin() *BlockHeight { @@ -769,7 +1514,7 @@ type TimeLockRangeRelative struct { func (x *TimeLockRangeRelative) Reset() { *x = TimeLockRangeRelative{} - mi := &file_blockchain_proto_msgTypes[12] + mi := &file_blockchain_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -781,7 +1526,7 @@ func (x *TimeLockRangeRelative) String() string { func (*TimeLockRangeRelative) ProtoMessage() {} func (x *TimeLockRangeRelative) ProtoReflect() protoreflect.Message { - mi := &file_blockchain_proto_msgTypes[12] + mi := &file_blockchain_proto_msgTypes[25] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -794,7 +1539,7 @@ func (x *TimeLockRangeRelative) ProtoReflect() protoreflect.Message { // Deprecated: Use TimeLockRangeRelative.ProtoReflect.Descriptor instead. func (*TimeLockRangeRelative) Descriptor() ([]byte, []int) { - return file_blockchain_proto_rawDescGZIP(), []int{12} + return file_blockchain_proto_rawDescGZIP(), []int{25} } func (x *TimeLockRangeRelative) GetMin() *BlockHeightDelta { @@ -822,7 +1567,7 @@ type Lock struct { func (x *Lock) Reset() { *x = Lock{} - mi := &file_blockchain_proto_msgTypes[13] + mi := &file_blockchain_proto_msgTypes[26] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -834,7 +1579,7 @@ func (x *Lock) String() string { func (*Lock) ProtoMessage() {} func (x *Lock) ProtoReflect() protoreflect.Message { - mi := &file_blockchain_proto_msgTypes[13] + mi := &file_blockchain_proto_msgTypes[26] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -847,7 +1592,7 @@ func (x *Lock) ProtoReflect() protoreflect.Message { // Deprecated: Use Lock.ProtoReflect.Descriptor instead. func (*Lock) Descriptor() ([]byte, []int) { - return file_blockchain_proto_rawDescGZIP(), []int{13} + return file_blockchain_proto_rawDescGZIP(), []int{26} } func (x *Lock) GetKeysRequired() uint32 { @@ -876,7 +1621,7 @@ type Name struct { func (x *Name) Reset() { *x = Name{} - mi := &file_blockchain_proto_msgTypes[14] + mi := &file_blockchain_proto_msgTypes[27] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -888,7 +1633,7 @@ func (x *Name) String() string { func (*Name) ProtoMessage() {} func (x *Name) ProtoReflect() protoreflect.Message { - mi := &file_blockchain_proto_msgTypes[14] + mi := &file_blockchain_proto_msgTypes[27] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -901,7 +1646,7 @@ func (x *Name) ProtoReflect() protoreflect.Message { // Deprecated: Use Name.ProtoReflect.Descriptor instead. func (*Name) Descriptor() ([]byte, []int) { - return file_blockchain_proto_rawDescGZIP(), []int{14} + return file_blockchain_proto_rawDescGZIP(), []int{27} } func (x *Name) GetFirst() *Hash { @@ -919,21 +1664,19 @@ func (x *Name) GetLast() *Hash { } type Note struct { - state protoimpl.MessageState `protogen:"open.v1"` - OriginPage *BlockHeight `protobuf:"bytes,1,opt,name=origin_page,json=originPage,proto3" json:"origin_page,omitempty"` // page-number when added to balance - Timelock *TimeLockIntent `protobuf:"bytes,2,opt,name=timelock,proto3,oneof" json:"timelock,omitempty"` // enforced timelock - Name *Name `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` // nname (human/name label) - Lock *Lock `protobuf:"bytes,4,opt,name=lock,proto3" json:"lock,omitempty"` // spending condition - Source *Source `protobuf:"bytes,5,opt,name=source,proto3" json:"source,omitempty"` // provenance commitment - Assets *Nicks `protobuf:"bytes,6,opt,name=assets,proto3" json:"assets,omitempty"` // coin amount (nicks) - Version *NoteVersion `protobuf:"bytes,7,opt,name=version,proto3" json:"version,omitempty"` // note version (currently 0) + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to NoteVersion: + // + // *Note_Legacy + // *Note_V1 + NoteVersion isNote_NoteVersion `protobuf_oneof:"note_version"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *Note) Reset() { *x = Note{} - mi := &file_blockchain_proto_msgTypes[15] + mi := &file_blockchain_proto_msgTypes[28] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -945,7 +1688,7 @@ func (x *Note) String() string { func (*Note) ProtoMessage() {} func (x *Note) ProtoReflect() protoreflect.Message { - mi := &file_blockchain_proto_msgTypes[15] + mi := &file_blockchain_proto_msgTypes[28] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -958,58 +1701,314 @@ func (x *Note) ProtoReflect() protoreflect.Message { // Deprecated: Use Note.ProtoReflect.Descriptor instead. func (*Note) Descriptor() ([]byte, []int) { - return file_blockchain_proto_rawDescGZIP(), []int{15} + return file_blockchain_proto_rawDescGZIP(), []int{28} } -func (x *Note) GetOriginPage() *BlockHeight { +func (x *Note) GetNoteVersion() isNote_NoteVersion { + if x != nil { + return x.NoteVersion + } + return nil +} + +func (x *Note) GetLegacy() *NoteV0 { + if x != nil { + if x, ok := x.NoteVersion.(*Note_Legacy); ok { + return x.Legacy + } + } + return nil +} + +func (x *Note) GetV1() *NoteV1 { + if x != nil { + if x, ok := x.NoteVersion.(*Note_V1); ok { + return x.V1 + } + } + return nil +} + +type isNote_NoteVersion interface { + isNote_NoteVersion() +} + +type Note_Legacy struct { + Legacy *NoteV0 `protobuf:"bytes,1,opt,name=legacy,proto3,oneof"` +} + +type Note_V1 struct { + V1 *NoteV1 `protobuf:"bytes,2,opt,name=v1,proto3,oneof"` +} + +func (*Note_Legacy) isNote_NoteVersion() {} + +func (*Note_V1) isNote_NoteVersion() {} + +type NoteV0 struct { + state protoimpl.MessageState `protogen:"open.v1"` + OriginPage *BlockHeight `protobuf:"bytes,1,opt,name=origin_page,json=originPage,proto3" json:"origin_page,omitempty"` // page-number when added to balance + Timelock *TimeLockIntent `protobuf:"bytes,2,opt,name=timelock,proto3,oneof" json:"timelock,omitempty"` // enforced timelock + Name *Name `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` // nname (human/name label) + Lock *Lock `protobuf:"bytes,4,opt,name=lock,proto3" json:"lock,omitempty"` // spending condition + Source *Source `protobuf:"bytes,5,opt,name=source,proto3" json:"source,omitempty"` // provenance commitment + Assets *Nicks `protobuf:"bytes,6,opt,name=assets,proto3" json:"assets,omitempty"` // coin amount (nicks) + Version *NoteVersion `protobuf:"bytes,7,opt,name=version,proto3" json:"version,omitempty"` // note version (currently 0) + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NoteV0) Reset() { + *x = NoteV0{} + mi := &file_blockchain_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NoteV0) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NoteV0) ProtoMessage() {} + +func (x *NoteV0) ProtoReflect() protoreflect.Message { + mi := &file_blockchain_proto_msgTypes[29] + 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 NoteV0.ProtoReflect.Descriptor instead. +func (*NoteV0) Descriptor() ([]byte, []int) { + return file_blockchain_proto_rawDescGZIP(), []int{29} +} + +func (x *NoteV0) GetOriginPage() *BlockHeight { if x != nil { return x.OriginPage } return nil } -func (x *Note) GetTimelock() *TimeLockIntent { +func (x *NoteV0) GetTimelock() *TimeLockIntent { if x != nil { return x.Timelock } return nil } -func (x *Note) GetName() *Name { +func (x *NoteV0) GetName() *Name { if x != nil { return x.Name } return nil } -func (x *Note) GetLock() *Lock { +func (x *NoteV0) GetLock() *Lock { if x != nil { return x.Lock } return nil } -func (x *Note) GetSource() *Source { +func (x *NoteV0) GetSource() *Source { if x != nil { return x.Source } return nil } -func (x *Note) GetAssets() *Nicks { +func (x *NoteV0) GetAssets() *Nicks { if x != nil { return x.Assets } return nil } -func (x *Note) GetVersion() *NoteVersion { +func (x *NoteV0) GetVersion() *NoteVersion { if x != nil { return x.Version } return nil } +type NoteV1 struct { + state protoimpl.MessageState `protogen:"open.v1"` + Version *NoteVersion `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + OriginPage *BlockHeight `protobuf:"bytes,2,opt,name=origin_page,json=originPage,proto3" json:"origin_page,omitempty"` + Name *Name `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + NoteData *NoteData `protobuf:"bytes,4,opt,name=note_data,json=noteData,proto3" json:"note_data,omitempty"` + Assets *Nicks `protobuf:"bytes,5,opt,name=assets,proto3" json:"assets,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NoteV1) Reset() { + *x = NoteV1{} + mi := &file_blockchain_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NoteV1) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NoteV1) ProtoMessage() {} + +func (x *NoteV1) ProtoReflect() protoreflect.Message { + mi := &file_blockchain_proto_msgTypes[30] + 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 NoteV1.ProtoReflect.Descriptor instead. +func (*NoteV1) Descriptor() ([]byte, []int) { + return file_blockchain_proto_rawDescGZIP(), []int{30} +} + +func (x *NoteV1) GetVersion() *NoteVersion { + if x != nil { + return x.Version + } + return nil +} + +func (x *NoteV1) GetOriginPage() *BlockHeight { + if x != nil { + return x.OriginPage + } + return nil +} + +func (x *NoteV1) GetName() *Name { + if x != nil { + return x.Name + } + return nil +} + +func (x *NoteV1) GetNoteData() *NoteData { + if x != nil { + return x.NoteData + } + return nil +} + +func (x *NoteV1) GetAssets() *Nicks { + if x != nil { + return x.Assets + } + return nil +} + +type NoteData struct { + state protoimpl.MessageState `protogen:"open.v1"` + Entries []*NoteDataEntry `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NoteData) Reset() { + *x = NoteData{} + mi := &file_blockchain_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NoteData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NoteData) ProtoMessage() {} + +func (x *NoteData) ProtoReflect() protoreflect.Message { + mi := &file_blockchain_proto_msgTypes[31] + 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 NoteData.ProtoReflect.Descriptor instead. +func (*NoteData) Descriptor() ([]byte, []int) { + return file_blockchain_proto_rawDescGZIP(), []int{31} +} + +func (x *NoteData) GetEntries() []*NoteDataEntry { + if x != nil { + return x.Entries + } + return nil +} + +type NoteDataEntry struct { + state protoimpl.MessageState `protogen:"open.v1"` + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Blob []byte `protobuf:"bytes,2,opt,name=blob,proto3" json:"blob,omitempty"` // jammed noun bytes + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NoteDataEntry) Reset() { + *x = NoteDataEntry{} + mi := &file_blockchain_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NoteDataEntry) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NoteDataEntry) ProtoMessage() {} + +func (x *NoteDataEntry) ProtoReflect() protoreflect.Message { + mi := &file_blockchain_proto_msgTypes[32] + 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 NoteDataEntry.ProtoReflect.Descriptor instead. +func (*NoteDataEntry) Descriptor() ([]byte, []int) { + return file_blockchain_proto_rawDescGZIP(), []int{32} +} + +func (x *NoteDataEntry) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *NoteDataEntry) GetBlob() []byte { + if x != nil { + return x.Blob + } + return nil +} + type Signature struct { state protoimpl.MessageState `protogen:"open.v1"` Entries []*SignatureEntry `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"` @@ -1019,7 +2018,7 @@ type Signature struct { func (x *Signature) Reset() { *x = Signature{} - mi := &file_blockchain_proto_msgTypes[16] + mi := &file_blockchain_proto_msgTypes[33] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1031,7 +2030,7 @@ func (x *Signature) String() string { func (*Signature) ProtoMessage() {} func (x *Signature) ProtoReflect() protoreflect.Message { - mi := &file_blockchain_proto_msgTypes[16] + mi := &file_blockchain_proto_msgTypes[33] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1044,7 +2043,7 @@ func (x *Signature) ProtoReflect() protoreflect.Message { // Deprecated: Use Signature.ProtoReflect.Descriptor instead. func (*Signature) Descriptor() ([]byte, []int) { - return file_blockchain_proto_rawDescGZIP(), []int{16} + return file_blockchain_proto_rawDescGZIP(), []int{33} } func (x *Signature) GetEntries() []*SignatureEntry { @@ -1064,7 +2063,7 @@ type SignatureEntry struct { func (x *SignatureEntry) Reset() { *x = SignatureEntry{} - mi := &file_blockchain_proto_msgTypes[17] + mi := &file_blockchain_proto_msgTypes[34] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1076,7 +2075,7 @@ func (x *SignatureEntry) String() string { func (*SignatureEntry) ProtoMessage() {} func (x *SignatureEntry) ProtoReflect() protoreflect.Message { - mi := &file_blockchain_proto_msgTypes[17] + mi := &file_blockchain_proto_msgTypes[34] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1089,7 +2088,7 @@ func (x *SignatureEntry) ProtoReflect() protoreflect.Message { // Deprecated: Use SignatureEntry.ProtoReflect.Descriptor instead. func (*SignatureEntry) Descriptor() ([]byte, []int) { - return file_blockchain_proto_rawDescGZIP(), []int{17} + return file_blockchain_proto_rawDescGZIP(), []int{34} } func (x *SignatureEntry) GetSchnorrPubkey() *SchnorrPubkey { @@ -1116,7 +2115,7 @@ type SchnorrSignature struct { func (x *SchnorrSignature) Reset() { *x = SchnorrSignature{} - mi := &file_blockchain_proto_msgTypes[18] + mi := &file_blockchain_proto_msgTypes[35] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1128,7 +2127,7 @@ func (x *SchnorrSignature) String() string { func (*SchnorrSignature) ProtoMessage() {} func (x *SchnorrSignature) ProtoReflect() protoreflect.Message { - mi := &file_blockchain_proto_msgTypes[18] + mi := &file_blockchain_proto_msgTypes[35] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1141,7 +2140,7 @@ func (x *SchnorrSignature) ProtoReflect() protoreflect.Message { // Deprecated: Use SchnorrSignature.ProtoReflect.Descriptor instead. func (*SchnorrSignature) Descriptor() ([]byte, []int) { - return file_blockchain_proto_rawDescGZIP(), []int{18} + return file_blockchain_proto_rawDescGZIP(), []int{35} } func (x *SchnorrSignature) GetChal() *EightBelt { @@ -1162,92 +2161,150 @@ var File_blockchain_proto protoreflect.FileDescriptor const file_blockchain_proto_rawDesc = "" + "\n" + - "\x10blockchain.proto\x12\x13nockchain.public.v1\x1a\x10primitives.proto\x1a\x10pagination.proto\"\x85\x02\n" + - "\x11WalletBalanceData\x127\n" + - "\x05notes\x18\x01 \x03(\v2!.nockchain.public.v1.BalanceEntryR\x05notes\x128\n" + - "\x06height\x18\x02 \x01(\v2 .nockchain.public.v1.BlockHeightR\x06height\x129\n" + - "\bblock_id\x18\x03 \x01(\v2\x19.nockchain.public.v1.HashH\x00R\ablockId\x88\x01\x01\x125\n" + - "\x04page\x18\x04 \x01(\v2!.nockchain.public.v1.PageResponseR\x04pageB\v\n" + + "\x10blockchain.proto\x12\x13nockchain.public.v2\x1a\x10primitives.proto\x1a\x10pagination.proto\"\xfb\x01\n" + + "\aBalance\x127\n" + + "\x05notes\x18\x01 \x03(\v2!.nockchain.public.v2.BalanceEntryR\x05notes\x128\n" + + "\x06height\x18\x02 \x01(\v2 .nockchain.public.v2.BlockHeightR\x06height\x129\n" + + "\bblock_id\x18\x03 \x01(\v2\x19.nockchain.public.v2.HashH\x00R\ablockId\x88\x01\x01\x125\n" + + "\x04page\x18\x04 \x01(\v2!.nockchain.public.v2.PageResponseR\x04pageB\v\n" + "\t_block_id\"l\n" + "\fBalanceEntry\x12-\n" + - "\x04name\x18\x01 \x01(\v2\x19.nockchain.public.v1.NameR\x04name\x12-\n" + - "\x04note\x18\x02 \x01(\v2\x19.nockchain.public.v1.NoteR\x04note\"\x8d\x02\n" + - "\x0eRawTransaction\x12B\n" + - "\fnamed_inputs\x18\x01 \x03(\v2\x1f.nockchain.public.v1.NamedInputR\vnamedInputs\x12Q\n" + - "\x0etimelock_range\x18\x02 \x01(\v2*.nockchain.public.v1.TimeLockRangeAbsoluteR\rtimelockRange\x129\n" + + "\x04name\x18\x01 \x01(\v2\x19.nockchain.public.v2.NameR\x04name\x12-\n" + + "\x04note\x18\x02 \x01(\v2\x19.nockchain.public.v2.NoteR\x04note\"\xb0\x01\n" + + "\x0eRawTransaction\x12:\n" + + "\aversion\x18\x01 \x01(\v2 .nockchain.public.v2.NoteVersionR\aversion\x12)\n" + + "\x02id\x18\x02 \x01(\v2\x19.nockchain.public.v2.HashR\x02id\x127\n" + + "\x06spends\x18\x03 \x03(\v2\x1f.nockchain.public.v2.SpendEntryR\x06spends\"m\n" + "\n" + - "total_fees\x18\x03 \x01(\v2\x1a.nockchain.public.v1.NicksR\ttotalFees\x12)\n" + - "\x02id\x18\x04 \x01(\v2\x19.nockchain.public.v1.HashR\x02id\"m\n" + + "SpendEntry\x12-\n" + + "\x04name\x18\x01 \x01(\v2\x19.nockchain.public.v2.NameR\x04name\x120\n" + + "\x05spend\x18\x02 \x01(\v2\x1a.nockchain.public.v2.SpendR\x05spend\"\x90\x01\n" + + "\x05Spend\x12:\n" + + "\x06legacy\x18\x01 \x01(\v2 .nockchain.public.v2.LegacySpendH\x00R\x06legacy\x12=\n" + + "\awitness\x18\x02 \x01(\v2!.nockchain.public.v2.WitnessSpendH\x00R\awitnessB\f\n" + "\n" + - "NamedInput\x12-\n" + - "\x04name\x18\x01 \x01(\v2\x19.nockchain.public.v1.NameR\x04name\x120\n" + - "\x05input\x18\x02 \x01(\v2\x1a.nockchain.public.v1.InputR\x05input\"h\n" + - "\x05Input\x12-\n" + - "\x04note\x18\x01 \x01(\v2\x19.nockchain.public.v1.NoteR\x04note\x120\n" + - "\x05spend\x18\x02 \x01(\v2\x1a.nockchain.public.v1.SpendR\x05spend\"\xba\x01\n" + - "\x05Spend\x12<\n" + - "\tsignature\x18\x01 \x01(\v2\x1e.nockchain.public.v1.SignatureR\tsignature\x12/\n" + - "\x05seeds\x18\x02 \x03(\v2\x19.nockchain.public.v1.SeedR\x05seeds\x12B\n" + - "\x0fminer_fee_nicks\x18\x03 \x01(\v2\x1a.nockchain.public.v1.NicksR\rminerFeeNicks\"\xf1\x02\n" + - "\x04Seed\x12K\n" + - "\routput_source\x18\x01 \x01(\v2!.nockchain.public.v1.OutputSourceH\x00R\foutputSource\x88\x01\x01\x127\n" + - "\trecipient\x18\x02 \x01(\v2\x19.nockchain.public.v1.LockR\trecipient\x12Q\n" + - "\x0ftimelock_intent\x18\x03 \x01(\v2#.nockchain.public.v1.TimeLockIntentH\x01R\x0etimelockIntent\x88\x01\x01\x12.\n" + - "\x04gift\x18\x04 \x01(\v2\x1a.nockchain.public.v1.NicksR\x04gift\x12:\n" + - "\vparent_hash\x18\x05 \x01(\v2\x19.nockchain.public.v1.HashR\n" + - "parentHashB\x10\n" + - "\x0e_output_sourceB\x12\n" + - "\x10_timelock_intent\"S\n" + + "spend_kind\"\xc0\x01\n" + + "\vLegacySpend\x12<\n" + + "\tsignature\x18\x01 \x01(\v2\x1e.nockchain.public.v2.SignatureR\tsignature\x12/\n" + + "\x05seeds\x18\x02 \x03(\v2\x19.nockchain.public.v2.SeedR\x05seeds\x12B\n" + + "\x0fminer_fee_nicks\x18\x03 \x01(\v2\x1a.nockchain.public.v2.NicksR\rminerFeeNicks\"\xa5\x01\n" + + "\fWitnessSpend\x126\n" + + "\awitness\x18\x01 \x01(\v2\x1c.nockchain.public.v2.WitnessR\awitness\x12/\n" + + "\x05seeds\x18\x02 \x03(\v2\x19.nockchain.public.v2.SeedR\x05seeds\x12,\n" + + "\x03fee\x18\x03 \x01(\v2\x1a.nockchain.public.v2.NicksR\x03fee\"\xa8\x02\n" + + "\x04Seed\x12@\n" + + "\routput_source\x18\x01 \x01(\v2\x1b.nockchain.public.v2.SourceR\foutputSource\x126\n" + + "\tlock_root\x18\x02 \x01(\v2\x19.nockchain.public.v2.HashR\blockRoot\x12:\n" + + "\tnote_data\x18\x03 \x01(\v2\x1d.nockchain.public.v2.NoteDataR\bnoteData\x12.\n" + + "\x04gift\x18\x04 \x01(\v2\x1a.nockchain.public.v2.NicksR\x04gift\x12:\n" + + "\vparent_hash\x18\x05 \x01(\v2\x19.nockchain.public.v2.HashR\n" + + "parentHash\"\xd7\x01\n" + + "\aWitness\x12P\n" + + "\x11lock_merkle_proof\x18\x01 \x01(\v2$.nockchain.public.v2.LockMerkleProofR\x0flockMerkleProof\x12F\n" + + "\rpkh_signature\x18\x02 \x01(\v2!.nockchain.public.v2.PkhSignatureR\fpkhSignature\x122\n" + + "\x03hax\x18\x03 \x03(\v2 .nockchain.public.v2.HaxPreimageR\x03hax\"R\n" + + "\vHaxPreimage\x12-\n" + + "\x04hash\x18\x01 \x01(\v2\x19.nockchain.public.v2.HashR\x04hash\x12\x14\n" + + "\x05value\x18\x02 \x01(\fR\x05value\"P\n" + + "\fPkhSignature\x12@\n" + + "\aentries\x18\x01 \x03(\v2&.nockchain.public.v2.PkhSignatureEntryR\aentries\"\xc3\x01\n" + + "\x11PkhSignatureEntry\x12-\n" + + "\x04hash\x18\x01 \x01(\v2\x19.nockchain.public.v2.HashR\x04hash\x12:\n" + + "\x06pubkey\x18\x02 \x01(\v2\".nockchain.public.v2.SchnorrPubkeyR\x06pubkey\x12C\n" + + "\tsignature\x18\x03 \x01(\v2%.nockchain.public.v2.SchnorrSignatureR\tsignature\"\xab\x01\n" + + "\x0fLockMerkleProof\x12L\n" + + "\x0fspend_condition\x18\x01 \x01(\v2#.nockchain.public.v2.SpendConditionR\x0espendCondition\x12\x12\n" + + "\x04axis\x18\x02 \x01(\x04R\x04axis\x126\n" + + "\x05proof\x18\x03 \x01(\v2 .nockchain.public.v2.MerkleProofR\x05proof\"T\n" + + "\x0eSpendCondition\x12B\n" + + "\n" + + "primitives\x18\x01 \x03(\v2\".nockchain.public.v2.LockPrimitiveR\n" + + "primitives\"\xe7\x01\n" + + "\rLockPrimitive\x120\n" + + "\x03pkh\x18\x01 \x01(\v2\x1c.nockchain.public.v2.PkhLockH\x00R\x03pkh\x120\n" + + "\x03tim\x18\x02 \x01(\v2\x1c.nockchain.public.v2.LockTimH\x00R\x03tim\x120\n" + + "\x03hax\x18\x03 \x01(\v2\x1c.nockchain.public.v2.HaxLockH\x00R\x03hax\x123\n" + + "\x04burn\x18\x04 \x01(\v2\x1d.nockchain.public.v2.BurnLockH\x00R\x04burnB\v\n" + + "\tprimitive\"J\n" + + "\aPkhLock\x12\f\n" + + "\x01m\x18\x01 \x01(\x04R\x01m\x121\n" + + "\x06hashes\x18\x02 \x03(\v2\x19.nockchain.public.v2.HashR\x06hashes\"\x85\x01\n" + + "\aLockTim\x12<\n" + + "\x03rel\x18\x01 \x01(\v2*.nockchain.public.v2.TimeLockRangeRelativeR\x03rel\x12<\n" + + "\x03abs\x18\x02 \x01(\v2*.nockchain.public.v2.TimeLockRangeAbsoluteR\x03abs\"<\n" + + "\aHaxLock\x121\n" + + "\x06hashes\x18\x01 \x03(\v2\x19.nockchain.public.v2.HashR\x06hashes\"\n" + + "\n" + + "\bBurnLock\"k\n" + + "\vMerkleProof\x12-\n" + + "\x04root\x18\x01 \x01(\v2\x19.nockchain.public.v2.HashR\x04root\x12-\n" + + "\x04path\x18\x02 \x03(\v2\x19.nockchain.public.v2.HashR\x04path\"S\n" + "\fOutputSource\x128\n" + - "\x06source\x18\x01 \x01(\v2\x1b.nockchain.public.v1.SourceH\x00R\x06source\x88\x01\x01B\t\n" + + "\x06source\x18\x01 \x01(\v2\x1b.nockchain.public.v2.SourceH\x00R\x06source\x88\x01\x01B\t\n" + "\a_source\"S\n" + "\x06Source\x12-\n" + - "\x04hash\x18\x01 \x01(\v2\x19.nockchain.public.v1.HashR\x04hash\x12\x1a\n" + + "\x04hash\x18\x01 \x01(\v2\x19.nockchain.public.v2.HashR\x04hash\x12\x1a\n" + "\bcoinbase\x18\x02 \x01(\bR\bcoinbase\"\x9a\x02\n" + "\x0eTimeLockIntent\x12H\n" + - "\babsolute\x18\x01 \x01(\v2*.nockchain.public.v1.TimeLockRangeAbsoluteH\x00R\babsolute\x12H\n" + - "\brelative\x18\x02 \x01(\v2*.nockchain.public.v1.TimeLockRangeRelativeH\x00R\brelative\x12k\n" + - "\x15absolute_and_relative\x18\x03 \x01(\v25.nockchain.public.v1.TimeLockRangeAbsoluteAndRelativeH\x00R\x13absoluteAndRelativeB\a\n" + + "\babsolute\x18\x01 \x01(\v2*.nockchain.public.v2.TimeLockRangeAbsoluteH\x00R\babsolute\x12H\n" + + "\brelative\x18\x02 \x01(\v2*.nockchain.public.v2.TimeLockRangeRelativeH\x00R\brelative\x12k\n" + + "\x15absolute_and_relative\x18\x03 \x01(\v25.nockchain.public.v2.TimeLockRangeAbsoluteAndRelativeH\x00R\x13absoluteAndRelativeB\a\n" + "\x05value\"\xd6\x01\n" + " TimeLockRangeAbsoluteAndRelative\x12K\n" + - "\babsolute\x18\x01 \x01(\v2*.nockchain.public.v1.TimeLockRangeAbsoluteH\x00R\babsolute\x88\x01\x01\x12K\n" + - "\brelative\x18\x02 \x01(\v2*.nockchain.public.v1.TimeLockRangeRelativeH\x01R\brelative\x88\x01\x01B\v\n" + + "\babsolute\x18\x01 \x01(\v2*.nockchain.public.v2.TimeLockRangeAbsoluteH\x00R\babsolute\x88\x01\x01\x12K\n" + + "\brelative\x18\x02 \x01(\v2*.nockchain.public.v2.TimeLockRangeRelativeH\x01R\brelative\x88\x01\x01B\v\n" + "\t_absoluteB\v\n" + "\t_relative\"\x99\x01\n" + "\x15TimeLockRangeAbsolute\x127\n" + - "\x03min\x18\x01 \x01(\v2 .nockchain.public.v1.BlockHeightH\x00R\x03min\x88\x01\x01\x127\n" + - "\x03max\x18\x02 \x01(\v2 .nockchain.public.v1.BlockHeightH\x01R\x03max\x88\x01\x01B\x06\n" + + "\x03min\x18\x01 \x01(\v2 .nockchain.public.v2.BlockHeightH\x00R\x03min\x88\x01\x01\x127\n" + + "\x03max\x18\x02 \x01(\v2 .nockchain.public.v2.BlockHeightH\x01R\x03max\x88\x01\x01B\x06\n" + "\x04_minB\x06\n" + "\x04_max\"\xa3\x01\n" + "\x15TimeLockRangeRelative\x12<\n" + - "\x03min\x18\x01 \x01(\v2%.nockchain.public.v1.BlockHeightDeltaH\x00R\x03min\x88\x01\x01\x12<\n" + - "\x03max\x18\x02 \x01(\v2%.nockchain.public.v1.BlockHeightDeltaH\x01R\x03max\x88\x01\x01B\x06\n" + + "\x03min\x18\x01 \x01(\v2%.nockchain.public.v2.BlockHeightDeltaH\x00R\x03min\x88\x01\x01\x12<\n" + + "\x03max\x18\x02 \x01(\v2%.nockchain.public.v2.BlockHeightDeltaH\x01R\x03max\x88\x01\x01B\x06\n" + "\x04_minB\x06\n" + "\x04_max\"x\n" + "\x04Lock\x12#\n" + "\rkeys_required\x18\x01 \x01(\rR\fkeysRequired\x12K\n" + - "\x0fschnorr_pubkeys\x18\x02 \x03(\v2\".nockchain.public.v1.SchnorrPubkeyR\x0eschnorrPubkeys\"f\n" + + "\x0fschnorr_pubkeys\x18\x02 \x03(\v2\".nockchain.public.v2.SchnorrPubkeyR\x0eschnorrPubkeys\"f\n" + "\x04Name\x12/\n" + - "\x05first\x18\x01 \x01(\v2\x19.nockchain.public.v1.HashR\x05first\x12-\n" + - "\x04last\x18\x02 \x01(\v2\x19.nockchain.public.v1.HashR\x04last\"\x9f\x03\n" + - "\x04Note\x12A\n" + - "\vorigin_page\x18\x01 \x01(\v2 .nockchain.public.v1.BlockHeightR\n" + + "\x05first\x18\x01 \x01(\v2\x19.nockchain.public.v2.HashR\x05first\x12-\n" + + "\x04last\x18\x02 \x01(\v2\x19.nockchain.public.v2.HashR\x04last\"|\n" + + "\x04Note\x125\n" + + "\x06legacy\x18\x01 \x01(\v2\x1b.nockchain.public.v2.NoteV0H\x00R\x06legacy\x12-\n" + + "\x02v1\x18\x02 \x01(\v2\x1b.nockchain.public.v2.NoteV1H\x00R\x02v1B\x0e\n" + + "\fnote_version\"\xa1\x03\n" + + "\x06NoteV0\x12A\n" + + "\vorigin_page\x18\x01 \x01(\v2 .nockchain.public.v2.BlockHeightR\n" + "originPage\x12D\n" + - "\btimelock\x18\x02 \x01(\v2#.nockchain.public.v1.TimeLockIntentH\x00R\btimelock\x88\x01\x01\x12-\n" + - "\x04name\x18\x03 \x01(\v2\x19.nockchain.public.v1.NameR\x04name\x12-\n" + - "\x04lock\x18\x04 \x01(\v2\x19.nockchain.public.v1.LockR\x04lock\x123\n" + - "\x06source\x18\x05 \x01(\v2\x1b.nockchain.public.v1.SourceR\x06source\x122\n" + - "\x06assets\x18\x06 \x01(\v2\x1a.nockchain.public.v1.NicksR\x06assets\x12:\n" + - "\aversion\x18\a \x01(\v2 .nockchain.public.v1.NoteVersionR\aversionB\v\n" + - "\t_timelock\"J\n" + + "\btimelock\x18\x02 \x01(\v2#.nockchain.public.v2.TimeLockIntentH\x00R\btimelock\x88\x01\x01\x12-\n" + + "\x04name\x18\x03 \x01(\v2\x19.nockchain.public.v2.NameR\x04name\x12-\n" + + "\x04lock\x18\x04 \x01(\v2\x19.nockchain.public.v2.LockR\x04lock\x123\n" + + "\x06source\x18\x05 \x01(\v2\x1b.nockchain.public.v2.SourceR\x06source\x122\n" + + "\x06assets\x18\x06 \x01(\v2\x1a.nockchain.public.v2.NicksR\x06assets\x12:\n" + + "\aversion\x18\a \x01(\v2 .nockchain.public.v2.NoteVersionR\aversionB\v\n" + + "\t_timelock\"\xa6\x02\n" + + "\x06NoteV1\x12:\n" + + "\aversion\x18\x01 \x01(\v2 .nockchain.public.v2.NoteVersionR\aversion\x12A\n" + + "\vorigin_page\x18\x02 \x01(\v2 .nockchain.public.v2.BlockHeightR\n" + + "originPage\x12-\n" + + "\x04name\x18\x03 \x01(\v2\x19.nockchain.public.v2.NameR\x04name\x12:\n" + + "\tnote_data\x18\x04 \x01(\v2\x1d.nockchain.public.v2.NoteDataR\bnoteData\x122\n" + + "\x06assets\x18\x05 \x01(\v2\x1a.nockchain.public.v2.NicksR\x06assets\"H\n" + + "\bNoteData\x12<\n" + + "\aentries\x18\x01 \x03(\v2\".nockchain.public.v2.NoteDataEntryR\aentries\"5\n" + + "\rNoteDataEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x12\n" + + "\x04blob\x18\x02 \x01(\fR\x04blob\"J\n" + "\tSignature\x12=\n" + - "\aentries\x18\x01 \x03(\v2#.nockchain.public.v1.SignatureEntryR\aentries\"\xa0\x01\n" + + "\aentries\x18\x01 \x03(\v2#.nockchain.public.v2.SignatureEntryR\aentries\"\xa0\x01\n" + "\x0eSignatureEntry\x12I\n" + - "\x0eschnorr_pubkey\x18\x01 \x01(\v2\".nockchain.public.v1.SchnorrPubkeyR\rschnorrPubkey\x12C\n" + - "\tsignature\x18\x02 \x01(\v2%.nockchain.public.v1.SchnorrSignatureR\tsignature\"x\n" + + "\x0eschnorr_pubkey\x18\x01 \x01(\v2\".nockchain.public.v2.SchnorrPubkeyR\rschnorrPubkey\x12C\n" + + "\tsignature\x18\x02 \x01(\v2%.nockchain.public.v2.SchnorrSignatureR\tsignature\"x\n" + "\x10SchnorrSignature\x122\n" + - "\x04chal\x18\x01 \x01(\v2\x1e.nockchain.public.v1.EightBeltR\x04chal\x120\n" + - "\x03sig\x18\x02 \x01(\v2\x1e.nockchain.public.v1.EightBeltR\x03sigB\x0eZ\f./;nockchainb\x06proto3" + "\x04chal\x18\x01 \x01(\v2\x1e.nockchain.public.v2.EightBeltR\x04chal\x120\n" + + "\x03sig\x18\x02 \x01(\v2\x1e.nockchain.public.v2.EightBeltR\x03sigB\x0eZ\f./;nockchainb\x06proto3" var ( file_blockchain_proto_rawDescOnce sync.Once @@ -1261,90 +2318,138 @@ func file_blockchain_proto_rawDescGZIP() []byte { return file_blockchain_proto_rawDescData } -var file_blockchain_proto_msgTypes = make([]protoimpl.MessageInfo, 19) +var file_blockchain_proto_msgTypes = make([]protoimpl.MessageInfo, 36) var file_blockchain_proto_goTypes = []any{ - (*WalletBalanceData)(nil), // 0: nockchain.public.v1.WalletBalanceData - (*BalanceEntry)(nil), // 1: nockchain.public.v1.BalanceEntry - (*RawTransaction)(nil), // 2: nockchain.public.v1.RawTransaction - (*NamedInput)(nil), // 3: nockchain.public.v1.NamedInput - (*Input)(nil), // 4: nockchain.public.v1.Input - (*Spend)(nil), // 5: nockchain.public.v1.Spend - (*Seed)(nil), // 6: nockchain.public.v1.Seed - (*OutputSource)(nil), // 7: nockchain.public.v1.OutputSource - (*Source)(nil), // 8: nockchain.public.v1.Source - (*TimeLockIntent)(nil), // 9: nockchain.public.v1.TimeLockIntent - (*TimeLockRangeAbsoluteAndRelative)(nil), // 10: nockchain.public.v1.TimeLockRangeAbsoluteAndRelative - (*TimeLockRangeAbsolute)(nil), // 11: nockchain.public.v1.TimeLockRangeAbsolute - (*TimeLockRangeRelative)(nil), // 12: nockchain.public.v1.TimeLockRangeRelative - (*Lock)(nil), // 13: nockchain.public.v1.Lock - (*Name)(nil), // 14: nockchain.public.v1.Name - (*Note)(nil), // 15: nockchain.public.v1.Note - (*Signature)(nil), // 16: nockchain.public.v1.Signature - (*SignatureEntry)(nil), // 17: nockchain.public.v1.SignatureEntry - (*SchnorrSignature)(nil), // 18: nockchain.public.v1.SchnorrSignature - (*BlockHeight)(nil), // 19: nockchain.public.v1.BlockHeight - (*Hash)(nil), // 20: nockchain.public.v1.Hash - (*PageResponse)(nil), // 21: nockchain.public.v1.PageResponse - (*Nicks)(nil), // 22: nockchain.public.v1.Nicks - (*BlockHeightDelta)(nil), // 23: nockchain.public.v1.BlockHeightDelta - (*SchnorrPubkey)(nil), // 24: nockchain.public.v1.SchnorrPubkey - (*NoteVersion)(nil), // 25: nockchain.public.v1.NoteVersion - (*EightBelt)(nil), // 26: nockchain.public.v1.EightBelt + (*Balance)(nil), // 0: nockchain.public.v2.Balance + (*BalanceEntry)(nil), // 1: nockchain.public.v2.BalanceEntry + (*RawTransaction)(nil), // 2: nockchain.public.v2.RawTransaction + (*SpendEntry)(nil), // 3: nockchain.public.v2.SpendEntry + (*Spend)(nil), // 4: nockchain.public.v2.Spend + (*LegacySpend)(nil), // 5: nockchain.public.v2.LegacySpend + (*WitnessSpend)(nil), // 6: nockchain.public.v2.WitnessSpend + (*Seed)(nil), // 7: nockchain.public.v2.Seed + (*Witness)(nil), // 8: nockchain.public.v2.Witness + (*HaxPreimage)(nil), // 9: nockchain.public.v2.HaxPreimage + (*PkhSignature)(nil), // 10: nockchain.public.v2.PkhSignature + (*PkhSignatureEntry)(nil), // 11: nockchain.public.v2.PkhSignatureEntry + (*LockMerkleProof)(nil), // 12: nockchain.public.v2.LockMerkleProof + (*SpendCondition)(nil), // 13: nockchain.public.v2.SpendCondition + (*LockPrimitive)(nil), // 14: nockchain.public.v2.LockPrimitive + (*PkhLock)(nil), // 15: nockchain.public.v2.PkhLock + (*LockTim)(nil), // 16: nockchain.public.v2.LockTim + (*HaxLock)(nil), // 17: nockchain.public.v2.HaxLock + (*BurnLock)(nil), // 18: nockchain.public.v2.BurnLock + (*MerkleProof)(nil), // 19: nockchain.public.v2.MerkleProof + (*OutputSource)(nil), // 20: nockchain.public.v2.OutputSource + (*Source)(nil), // 21: nockchain.public.v2.Source + (*TimeLockIntent)(nil), // 22: nockchain.public.v2.TimeLockIntent + (*TimeLockRangeAbsoluteAndRelative)(nil), // 23: nockchain.public.v2.TimeLockRangeAbsoluteAndRelative + (*TimeLockRangeAbsolute)(nil), // 24: nockchain.public.v2.TimeLockRangeAbsolute + (*TimeLockRangeRelative)(nil), // 25: nockchain.public.v2.TimeLockRangeRelative + (*Lock)(nil), // 26: nockchain.public.v2.Lock + (*Name)(nil), // 27: nockchain.public.v2.Name + (*Note)(nil), // 28: nockchain.public.v2.Note + (*NoteV0)(nil), // 29: nockchain.public.v2.NoteV0 + (*NoteV1)(nil), // 30: nockchain.public.v2.NoteV1 + (*NoteData)(nil), // 31: nockchain.public.v2.NoteData + (*NoteDataEntry)(nil), // 32: nockchain.public.v2.NoteDataEntry + (*Signature)(nil), // 33: nockchain.public.v2.Signature + (*SignatureEntry)(nil), // 34: nockchain.public.v2.SignatureEntry + (*SchnorrSignature)(nil), // 35: nockchain.public.v2.SchnorrSignature + (*BlockHeight)(nil), // 36: nockchain.public.v2.BlockHeight + (*Hash)(nil), // 37: nockchain.public.v2.Hash + (*PageResponse)(nil), // 38: nockchain.public.v2.PageResponse + (*NoteVersion)(nil), // 39: nockchain.public.v2.NoteVersion + (*Nicks)(nil), // 40: nockchain.public.v2.Nicks + (*SchnorrPubkey)(nil), // 41: nockchain.public.v2.SchnorrPubkey + (*BlockHeightDelta)(nil), // 42: nockchain.public.v2.BlockHeightDelta + (*EightBelt)(nil), // 43: nockchain.public.v2.EightBelt } var file_blockchain_proto_depIdxs = []int32{ - 1, // 0: nockchain.public.v1.WalletBalanceData.notes:type_name -> nockchain.public.v1.BalanceEntry - 19, // 1: nockchain.public.v1.WalletBalanceData.height:type_name -> nockchain.public.v1.BlockHeight - 20, // 2: nockchain.public.v1.WalletBalanceData.block_id:type_name -> nockchain.public.v1.Hash - 21, // 3: nockchain.public.v1.WalletBalanceData.page:type_name -> nockchain.public.v1.PageResponse - 14, // 4: nockchain.public.v1.BalanceEntry.name:type_name -> nockchain.public.v1.Name - 15, // 5: nockchain.public.v1.BalanceEntry.note:type_name -> nockchain.public.v1.Note - 3, // 6: nockchain.public.v1.RawTransaction.named_inputs:type_name -> nockchain.public.v1.NamedInput - 11, // 7: nockchain.public.v1.RawTransaction.timelock_range:type_name -> nockchain.public.v1.TimeLockRangeAbsolute - 22, // 8: nockchain.public.v1.RawTransaction.total_fees:type_name -> nockchain.public.v1.Nicks - 20, // 9: nockchain.public.v1.RawTransaction.id:type_name -> nockchain.public.v1.Hash - 14, // 10: nockchain.public.v1.NamedInput.name:type_name -> nockchain.public.v1.Name - 4, // 11: nockchain.public.v1.NamedInput.input:type_name -> nockchain.public.v1.Input - 15, // 12: nockchain.public.v1.Input.note:type_name -> nockchain.public.v1.Note - 5, // 13: nockchain.public.v1.Input.spend:type_name -> nockchain.public.v1.Spend - 16, // 14: nockchain.public.v1.Spend.signature:type_name -> nockchain.public.v1.Signature - 6, // 15: nockchain.public.v1.Spend.seeds:type_name -> nockchain.public.v1.Seed - 22, // 16: nockchain.public.v1.Spend.miner_fee_nicks:type_name -> nockchain.public.v1.Nicks - 7, // 17: nockchain.public.v1.Seed.output_source:type_name -> nockchain.public.v1.OutputSource - 13, // 18: nockchain.public.v1.Seed.recipient:type_name -> nockchain.public.v1.Lock - 9, // 19: nockchain.public.v1.Seed.timelock_intent:type_name -> nockchain.public.v1.TimeLockIntent - 22, // 20: nockchain.public.v1.Seed.gift:type_name -> nockchain.public.v1.Nicks - 20, // 21: nockchain.public.v1.Seed.parent_hash:type_name -> nockchain.public.v1.Hash - 8, // 22: nockchain.public.v1.OutputSource.source:type_name -> nockchain.public.v1.Source - 20, // 23: nockchain.public.v1.Source.hash:type_name -> nockchain.public.v1.Hash - 11, // 24: nockchain.public.v1.TimeLockIntent.absolute:type_name -> nockchain.public.v1.TimeLockRangeAbsolute - 12, // 25: nockchain.public.v1.TimeLockIntent.relative:type_name -> nockchain.public.v1.TimeLockRangeRelative - 10, // 26: nockchain.public.v1.TimeLockIntent.absolute_and_relative:type_name -> nockchain.public.v1.TimeLockRangeAbsoluteAndRelative - 11, // 27: nockchain.public.v1.TimeLockRangeAbsoluteAndRelative.absolute:type_name -> nockchain.public.v1.TimeLockRangeAbsolute - 12, // 28: nockchain.public.v1.TimeLockRangeAbsoluteAndRelative.relative:type_name -> nockchain.public.v1.TimeLockRangeRelative - 19, // 29: nockchain.public.v1.TimeLockRangeAbsolute.min:type_name -> nockchain.public.v1.BlockHeight - 19, // 30: nockchain.public.v1.TimeLockRangeAbsolute.max:type_name -> nockchain.public.v1.BlockHeight - 23, // 31: nockchain.public.v1.TimeLockRangeRelative.min:type_name -> nockchain.public.v1.BlockHeightDelta - 23, // 32: nockchain.public.v1.TimeLockRangeRelative.max:type_name -> nockchain.public.v1.BlockHeightDelta - 24, // 33: nockchain.public.v1.Lock.schnorr_pubkeys:type_name -> nockchain.public.v1.SchnorrPubkey - 20, // 34: nockchain.public.v1.Name.first:type_name -> nockchain.public.v1.Hash - 20, // 35: nockchain.public.v1.Name.last:type_name -> nockchain.public.v1.Hash - 19, // 36: nockchain.public.v1.Note.origin_page:type_name -> nockchain.public.v1.BlockHeight - 9, // 37: nockchain.public.v1.Note.timelock:type_name -> nockchain.public.v1.TimeLockIntent - 14, // 38: nockchain.public.v1.Note.name:type_name -> nockchain.public.v1.Name - 13, // 39: nockchain.public.v1.Note.lock:type_name -> nockchain.public.v1.Lock - 8, // 40: nockchain.public.v1.Note.source:type_name -> nockchain.public.v1.Source - 22, // 41: nockchain.public.v1.Note.assets:type_name -> nockchain.public.v1.Nicks - 25, // 42: nockchain.public.v1.Note.version:type_name -> nockchain.public.v1.NoteVersion - 17, // 43: nockchain.public.v1.Signature.entries:type_name -> nockchain.public.v1.SignatureEntry - 24, // 44: nockchain.public.v1.SignatureEntry.schnorr_pubkey:type_name -> nockchain.public.v1.SchnorrPubkey - 18, // 45: nockchain.public.v1.SignatureEntry.signature:type_name -> nockchain.public.v1.SchnorrSignature - 26, // 46: nockchain.public.v1.SchnorrSignature.chal:type_name -> nockchain.public.v1.EightBelt - 26, // 47: nockchain.public.v1.SchnorrSignature.sig:type_name -> nockchain.public.v1.EightBelt - 48, // [48:48] is the sub-list for method output_type - 48, // [48:48] is the sub-list for method input_type - 48, // [48:48] is the sub-list for extension type_name - 48, // [48:48] is the sub-list for extension extendee - 0, // [0:48] is the sub-list for field type_name + 1, // 0: nockchain.public.v2.Balance.notes:type_name -> nockchain.public.v2.BalanceEntry + 36, // 1: nockchain.public.v2.Balance.height:type_name -> nockchain.public.v2.BlockHeight + 37, // 2: nockchain.public.v2.Balance.block_id:type_name -> nockchain.public.v2.Hash + 38, // 3: nockchain.public.v2.Balance.page:type_name -> nockchain.public.v2.PageResponse + 27, // 4: nockchain.public.v2.BalanceEntry.name:type_name -> nockchain.public.v2.Name + 28, // 5: nockchain.public.v2.BalanceEntry.note:type_name -> nockchain.public.v2.Note + 39, // 6: nockchain.public.v2.RawTransaction.version:type_name -> nockchain.public.v2.NoteVersion + 37, // 7: nockchain.public.v2.RawTransaction.id:type_name -> nockchain.public.v2.Hash + 3, // 8: nockchain.public.v2.RawTransaction.spends:type_name -> nockchain.public.v2.SpendEntry + 27, // 9: nockchain.public.v2.SpendEntry.name:type_name -> nockchain.public.v2.Name + 4, // 10: nockchain.public.v2.SpendEntry.spend:type_name -> nockchain.public.v2.Spend + 5, // 11: nockchain.public.v2.Spend.legacy:type_name -> nockchain.public.v2.LegacySpend + 6, // 12: nockchain.public.v2.Spend.witness:type_name -> nockchain.public.v2.WitnessSpend + 33, // 13: nockchain.public.v2.LegacySpend.signature:type_name -> nockchain.public.v2.Signature + 7, // 14: nockchain.public.v2.LegacySpend.seeds:type_name -> nockchain.public.v2.Seed + 40, // 15: nockchain.public.v2.LegacySpend.miner_fee_nicks:type_name -> nockchain.public.v2.Nicks + 8, // 16: nockchain.public.v2.WitnessSpend.witness:type_name -> nockchain.public.v2.Witness + 7, // 17: nockchain.public.v2.WitnessSpend.seeds:type_name -> nockchain.public.v2.Seed + 40, // 18: nockchain.public.v2.WitnessSpend.fee:type_name -> nockchain.public.v2.Nicks + 21, // 19: nockchain.public.v2.Seed.output_source:type_name -> nockchain.public.v2.Source + 37, // 20: nockchain.public.v2.Seed.lock_root:type_name -> nockchain.public.v2.Hash + 31, // 21: nockchain.public.v2.Seed.note_data:type_name -> nockchain.public.v2.NoteData + 40, // 22: nockchain.public.v2.Seed.gift:type_name -> nockchain.public.v2.Nicks + 37, // 23: nockchain.public.v2.Seed.parent_hash:type_name -> nockchain.public.v2.Hash + 12, // 24: nockchain.public.v2.Witness.lock_merkle_proof:type_name -> nockchain.public.v2.LockMerkleProof + 10, // 25: nockchain.public.v2.Witness.pkh_signature:type_name -> nockchain.public.v2.PkhSignature + 9, // 26: nockchain.public.v2.Witness.hax:type_name -> nockchain.public.v2.HaxPreimage + 37, // 27: nockchain.public.v2.HaxPreimage.hash:type_name -> nockchain.public.v2.Hash + 11, // 28: nockchain.public.v2.PkhSignature.entries:type_name -> nockchain.public.v2.PkhSignatureEntry + 37, // 29: nockchain.public.v2.PkhSignatureEntry.hash:type_name -> nockchain.public.v2.Hash + 41, // 30: nockchain.public.v2.PkhSignatureEntry.pubkey:type_name -> nockchain.public.v2.SchnorrPubkey + 35, // 31: nockchain.public.v2.PkhSignatureEntry.signature:type_name -> nockchain.public.v2.SchnorrSignature + 13, // 32: nockchain.public.v2.LockMerkleProof.spend_condition:type_name -> nockchain.public.v2.SpendCondition + 19, // 33: nockchain.public.v2.LockMerkleProof.proof:type_name -> nockchain.public.v2.MerkleProof + 14, // 34: nockchain.public.v2.SpendCondition.primitives:type_name -> nockchain.public.v2.LockPrimitive + 15, // 35: nockchain.public.v2.LockPrimitive.pkh:type_name -> nockchain.public.v2.PkhLock + 16, // 36: nockchain.public.v2.LockPrimitive.tim:type_name -> nockchain.public.v2.LockTim + 17, // 37: nockchain.public.v2.LockPrimitive.hax:type_name -> nockchain.public.v2.HaxLock + 18, // 38: nockchain.public.v2.LockPrimitive.burn:type_name -> nockchain.public.v2.BurnLock + 37, // 39: nockchain.public.v2.PkhLock.hashes:type_name -> nockchain.public.v2.Hash + 25, // 40: nockchain.public.v2.LockTim.rel:type_name -> nockchain.public.v2.TimeLockRangeRelative + 24, // 41: nockchain.public.v2.LockTim.abs:type_name -> nockchain.public.v2.TimeLockRangeAbsolute + 37, // 42: nockchain.public.v2.HaxLock.hashes:type_name -> nockchain.public.v2.Hash + 37, // 43: nockchain.public.v2.MerkleProof.root:type_name -> nockchain.public.v2.Hash + 37, // 44: nockchain.public.v2.MerkleProof.path:type_name -> nockchain.public.v2.Hash + 21, // 45: nockchain.public.v2.OutputSource.source:type_name -> nockchain.public.v2.Source + 37, // 46: nockchain.public.v2.Source.hash:type_name -> nockchain.public.v2.Hash + 24, // 47: nockchain.public.v2.TimeLockIntent.absolute:type_name -> nockchain.public.v2.TimeLockRangeAbsolute + 25, // 48: nockchain.public.v2.TimeLockIntent.relative:type_name -> nockchain.public.v2.TimeLockRangeRelative + 23, // 49: nockchain.public.v2.TimeLockIntent.absolute_and_relative:type_name -> nockchain.public.v2.TimeLockRangeAbsoluteAndRelative + 24, // 50: nockchain.public.v2.TimeLockRangeAbsoluteAndRelative.absolute:type_name -> nockchain.public.v2.TimeLockRangeAbsolute + 25, // 51: nockchain.public.v2.TimeLockRangeAbsoluteAndRelative.relative:type_name -> nockchain.public.v2.TimeLockRangeRelative + 36, // 52: nockchain.public.v2.TimeLockRangeAbsolute.min:type_name -> nockchain.public.v2.BlockHeight + 36, // 53: nockchain.public.v2.TimeLockRangeAbsolute.max:type_name -> nockchain.public.v2.BlockHeight + 42, // 54: nockchain.public.v2.TimeLockRangeRelative.min:type_name -> nockchain.public.v2.BlockHeightDelta + 42, // 55: nockchain.public.v2.TimeLockRangeRelative.max:type_name -> nockchain.public.v2.BlockHeightDelta + 41, // 56: nockchain.public.v2.Lock.schnorr_pubkeys:type_name -> nockchain.public.v2.SchnorrPubkey + 37, // 57: nockchain.public.v2.Name.first:type_name -> nockchain.public.v2.Hash + 37, // 58: nockchain.public.v2.Name.last:type_name -> nockchain.public.v2.Hash + 29, // 59: nockchain.public.v2.Note.legacy:type_name -> nockchain.public.v2.NoteV0 + 30, // 60: nockchain.public.v2.Note.v1:type_name -> nockchain.public.v2.NoteV1 + 36, // 61: nockchain.public.v2.NoteV0.origin_page:type_name -> nockchain.public.v2.BlockHeight + 22, // 62: nockchain.public.v2.NoteV0.timelock:type_name -> nockchain.public.v2.TimeLockIntent + 27, // 63: nockchain.public.v2.NoteV0.name:type_name -> nockchain.public.v2.Name + 26, // 64: nockchain.public.v2.NoteV0.lock:type_name -> nockchain.public.v2.Lock + 21, // 65: nockchain.public.v2.NoteV0.source:type_name -> nockchain.public.v2.Source + 40, // 66: nockchain.public.v2.NoteV0.assets:type_name -> nockchain.public.v2.Nicks + 39, // 67: nockchain.public.v2.NoteV0.version:type_name -> nockchain.public.v2.NoteVersion + 39, // 68: nockchain.public.v2.NoteV1.version:type_name -> nockchain.public.v2.NoteVersion + 36, // 69: nockchain.public.v2.NoteV1.origin_page:type_name -> nockchain.public.v2.BlockHeight + 27, // 70: nockchain.public.v2.NoteV1.name:type_name -> nockchain.public.v2.Name + 31, // 71: nockchain.public.v2.NoteV1.note_data:type_name -> nockchain.public.v2.NoteData + 40, // 72: nockchain.public.v2.NoteV1.assets:type_name -> nockchain.public.v2.Nicks + 32, // 73: nockchain.public.v2.NoteData.entries:type_name -> nockchain.public.v2.NoteDataEntry + 34, // 74: nockchain.public.v2.Signature.entries:type_name -> nockchain.public.v2.SignatureEntry + 41, // 75: nockchain.public.v2.SignatureEntry.schnorr_pubkey:type_name -> nockchain.public.v2.SchnorrPubkey + 35, // 76: nockchain.public.v2.SignatureEntry.signature:type_name -> nockchain.public.v2.SchnorrSignature + 43, // 77: nockchain.public.v2.SchnorrSignature.chal:type_name -> nockchain.public.v2.EightBelt + 43, // 78: nockchain.public.v2.SchnorrSignature.sig:type_name -> nockchain.public.v2.EightBelt + 79, // [79:79] is the sub-list for method output_type + 79, // [79:79] is the sub-list for method input_type + 79, // [79:79] is the sub-list for extension type_name + 79, // [79:79] is the sub-list for extension extendee + 0, // [0:79] is the sub-list for field type_name } func init() { file_blockchain_proto_init() } @@ -1355,24 +2460,37 @@ func file_blockchain_proto_init() { file_primitives_proto_init() file_pagination_proto_init() file_blockchain_proto_msgTypes[0].OneofWrappers = []any{} - file_blockchain_proto_msgTypes[6].OneofWrappers = []any{} - file_blockchain_proto_msgTypes[7].OneofWrappers = []any{} - file_blockchain_proto_msgTypes[9].OneofWrappers = []any{ + file_blockchain_proto_msgTypes[4].OneofWrappers = []any{ + (*Spend_Legacy)(nil), + (*Spend_Witness)(nil), + } + file_blockchain_proto_msgTypes[14].OneofWrappers = []any{ + (*LockPrimitive_Pkh)(nil), + (*LockPrimitive_Tim)(nil), + (*LockPrimitive_Hax)(nil), + (*LockPrimitive_Burn)(nil), + } + file_blockchain_proto_msgTypes[20].OneofWrappers = []any{} + file_blockchain_proto_msgTypes[22].OneofWrappers = []any{ (*TimeLockIntent_Absolute)(nil), (*TimeLockIntent_Relative)(nil), (*TimeLockIntent_AbsoluteAndRelative)(nil), } - file_blockchain_proto_msgTypes[10].OneofWrappers = []any{} - file_blockchain_proto_msgTypes[11].OneofWrappers = []any{} - file_blockchain_proto_msgTypes[12].OneofWrappers = []any{} - file_blockchain_proto_msgTypes[15].OneofWrappers = []any{} + file_blockchain_proto_msgTypes[23].OneofWrappers = []any{} + file_blockchain_proto_msgTypes[24].OneofWrappers = []any{} + file_blockchain_proto_msgTypes[25].OneofWrappers = []any{} + file_blockchain_proto_msgTypes[28].OneofWrappers = []any{ + (*Note_Legacy)(nil), + (*Note_V1)(nil), + } + file_blockchain_proto_msgTypes[29].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_blockchain_proto_rawDesc), len(file_blockchain_proto_rawDesc)), NumEnums: 0, - NumMessages: 19, + NumMessages: 36, NumExtensions: 0, NumServices: 0, }, diff --git a/nockchain/nockchain.pb.go b/nockchain/nockchain.pb.go index 3b2f331..e9f223b 100644 --- a/nockchain/nockchain.pb.go +++ b/nockchain/nockchain.pb.go @@ -26,12 +26,17 @@ const ( type WalletGetBalanceRequest struct { state protoimpl.MessageState `protogen:"open.v1"` // pubkey cheetah point; specific address, or current wallet - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // + // Types that are valid to be assigned to Selector: + // + // *WalletGetBalanceRequest_Address + // *WalletGetBalanceRequest_FirstName + Selector isWalletGetBalanceRequest_Selector `protobuf_oneof:"selector"` // Pagination parameters. The server enforces limits and may return fewer // entries than requested to respect message size and policy. For consistent // paging across a stable snapshot, pass along the returned page_token from // the previous response without modification. - Page *PageRequest `protobuf:"bytes,2,opt,name=page,proto3" json:"page,omitempty"` + Page *PageRequest `protobuf:"bytes,3,opt,name=page,proto3" json:"page,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -66,11 +71,29 @@ func (*WalletGetBalanceRequest) Descriptor() ([]byte, []int) { return file_nockchain_proto_rawDescGZIP(), []int{0} } -func (x *WalletGetBalanceRequest) GetAddress() string { +func (x *WalletGetBalanceRequest) GetSelector() isWalletGetBalanceRequest_Selector { if x != nil { - return x.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 { @@ -80,6 +103,22 @@ func (x *WalletGetBalanceRequest) GetPage() *PageRequest { return nil } +type isWalletGetBalanceRequest_Selector interface { + isWalletGetBalanceRequest_Selector() +} + +type WalletGetBalanceRequest_Address struct { + Address *Base58Pubkey `protobuf:"bytes,1,opt,name=address,proto3,oneof"` +} + +type WalletGetBalanceRequest_FirstName struct { + FirstName *Base58Hash `protobuf:"bytes,2,opt,name=first_name,json=firstName,proto3,oneof"` +} + +func (*WalletGetBalanceRequest_Address) isWalletGetBalanceRequest_Selector() {} + +func (*WalletGetBalanceRequest_FirstName) isWalletGetBalanceRequest_Selector() {} + type WalletGetBalanceResponse struct { state protoimpl.MessageState `protogen:"open.v1"` // Types that are valid to be assigned to Result: @@ -128,7 +167,7 @@ func (x *WalletGetBalanceResponse) GetResult() isWalletGetBalanceResponse_Result return nil } -func (x *WalletGetBalanceResponse) GetBalance() *WalletBalanceData { +func (x *WalletGetBalanceResponse) GetBalance() *Balance { if x != nil { if x, ok := x.Result.(*WalletGetBalanceResponse_Balance); ok { return x.Balance @@ -155,7 +194,7 @@ type WalletGetBalanceResponse_Balance struct { // Continue paging using `balance.page.next_page_token` until empty. Clients // should treat the page token as opaque; it may encode snapshot identity // and the last returned key. - Balance *WalletBalanceData `protobuf:"bytes,1,opt,name=balance,proto3,oneof"` + Balance *Balance `protobuf:"bytes,1,opt,name=balance,proto3,oneof"` } type WalletGetBalanceResponse_Error struct { @@ -437,31 +476,35 @@ var File_nockchain_proto protoreflect.FileDescriptor const file_nockchain_proto_rawDesc = "" + "\n" + - "\x0fnockchain.proto\x12\x13nockchain.public.v1\x1a\x10blockchain.proto\x1a\x10primitives.proto\x1a\x10pagination.proto\"i\n" + - "\x17WalletGetBalanceRequest\x12\x18\n" + - "\aaddress\x18\x01 \x01(\tR\aaddress\x124\n" + - "\x04page\x18\x02 \x01(\v2 .nockchain.public.v1.PageRequestR\x04page\"\xa2\x01\n" + - "\x18WalletGetBalanceResponse\x12B\n" + - "\abalance\x18\x01 \x01(\v2&.nockchain.public.v1.WalletBalanceDataH\x00R\abalance\x128\n" + - "\x05error\x18\x02 \x01(\v2 .nockchain.public.v1.ErrorStatusH\x00R\x05errorB\b\n" + + "\x0fnockchain.proto\x12\x13nockchain.public.v2\x1a\x10blockchain.proto\x1a\x10primitives.proto\x1a\x10pagination.proto\"\xdc\x01\n" + + "\x17WalletGetBalanceRequest\x12=\n" + + "\aaddress\x18\x01 \x01(\v2!.nockchain.public.v2.Base58PubkeyH\x00R\aaddress\x12@\n" + + "\n" + + "first_name\x18\x02 \x01(\v2\x1f.nockchain.public.v2.Base58HashH\x00R\tfirstName\x124\n" + + "\x04page\x18\x03 \x01(\v2 .nockchain.public.v2.PageRequestR\x04pageB\n" + + "\n" + + "\bselector\"\x98\x01\n" + + "\x18WalletGetBalanceResponse\x128\n" + + "\abalance\x18\x01 \x01(\v2\x1c.nockchain.public.v2.BalanceH\x00R\abalance\x128\n" + + "\x05error\x18\x02 \x01(\v2 .nockchain.public.v2.ErrorStatusH\x00R\x05errorB\b\n" + "\x06result\"\x8a\x01\n" + "\x1cWalletSendTransactionRequest\x12.\n" + - "\x05tx_id\x18\x01 \x01(\v2\x19.nockchain.public.v1.HashR\x04txId\x12:\n" + - "\x06raw_tx\x18\x02 \x01(\v2#.nockchain.public.v1.RawTransactionR\x05rawTx\"\x9a\x01\n" + + "\x05tx_id\x18\x01 \x01(\v2\x19.nockchain.public.v2.HashR\x04txId\x12:\n" + + "\x06raw_tx\x18\x02 \x01(\v2#.nockchain.public.v2.RawTransactionR\x05rawTx\"\x9a\x01\n" + "\x1dWalletSendTransactionResponse\x125\n" + - "\x03ack\x18\x01 \x01(\v2!.nockchain.public.v1.AcknowledgedH\x00R\x03ack\x128\n" + - "\x05error\x18\x02 \x01(\v2 .nockchain.public.v1.ErrorStatusH\x00R\x05errorB\b\n" + + "\x03ack\x18\x01 \x01(\v2!.nockchain.public.v2.AcknowledgedH\x00R\x03ack\x128\n" + + "\x05error\x18\x02 \x01(\v2 .nockchain.public.v2.ErrorStatusH\x00R\x05errorB\b\n" + "\x06result\"R\n" + "\x1aTransactionAcceptedRequest\x124\n" + - "\x05tx_id\x18\x01 \x01(\v2\x1f.nockchain.public.v1.Base58HashR\x04txId\"\x7f\n" + + "\x05tx_id\x18\x01 \x01(\v2\x1f.nockchain.public.v2.Base58HashR\x04txId\"\x7f\n" + "\x1bTransactionAcceptedResponse\x12\x1c\n" + "\baccepted\x18\x01 \x01(\bH\x00R\baccepted\x128\n" + - "\x05error\x18\x02 \x01(\v2 .nockchain.public.v1.ErrorStatusH\x00R\x05errorB\b\n" + + "\x05error\x18\x02 \x01(\v2 .nockchain.public.v2.ErrorStatusH\x00R\x05errorB\b\n" + "\x06result2\xfd\x02\n" + "\x10NockchainService\x12o\n" + - "\x10WalletGetBalance\x12,.nockchain.public.v1.WalletGetBalanceRequest\x1a-.nockchain.public.v1.WalletGetBalanceResponse\x12~\n" + - "\x15WalletSendTransaction\x121.nockchain.public.v1.WalletSendTransactionRequest\x1a2.nockchain.public.v1.WalletSendTransactionResponse\x12x\n" + - "\x13TransactionAccepted\x12/.nockchain.public.v1.TransactionAcceptedRequest\x1a0.nockchain.public.v1.TransactionAcceptedResponseB\x0eZ\f./;nockchainb\x06proto3" + "\x10WalletGetBalance\x12,.nockchain.public.v2.WalletGetBalanceRequest\x1a-.nockchain.public.v2.WalletGetBalanceResponse\x12~\n" + + "\x15WalletSendTransaction\x121.nockchain.public.v2.WalletSendTransactionRequest\x1a2.nockchain.public.v2.WalletSendTransactionResponse\x12x\n" + + "\x13TransactionAccepted\x12/.nockchain.public.v2.TransactionAcceptedRequest\x1a0.nockchain.public.v2.TransactionAcceptedResponseB\x0eZ\f./;nockchainb\x06proto3" var ( file_nockchain_proto_rawDescOnce sync.Once @@ -477,41 +520,44 @@ func file_nockchain_proto_rawDescGZIP() []byte { var file_nockchain_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_nockchain_proto_goTypes = []any{ - (*WalletGetBalanceRequest)(nil), // 0: nockchain.public.v1.WalletGetBalanceRequest - (*WalletGetBalanceResponse)(nil), // 1: nockchain.public.v1.WalletGetBalanceResponse - (*WalletSendTransactionRequest)(nil), // 2: nockchain.public.v1.WalletSendTransactionRequest - (*WalletSendTransactionResponse)(nil), // 3: nockchain.public.v1.WalletSendTransactionResponse - (*TransactionAcceptedRequest)(nil), // 4: nockchain.public.v1.TransactionAcceptedRequest - (*TransactionAcceptedResponse)(nil), // 5: nockchain.public.v1.TransactionAcceptedResponse - (*PageRequest)(nil), // 6: nockchain.public.v1.PageRequest - (*WalletBalanceData)(nil), // 7: nockchain.public.v1.WalletBalanceData - (*ErrorStatus)(nil), // 8: nockchain.public.v1.ErrorStatus - (*Hash)(nil), // 9: nockchain.public.v1.Hash - (*RawTransaction)(nil), // 10: nockchain.public.v1.RawTransaction - (*Acknowledged)(nil), // 11: nockchain.public.v1.Acknowledged - (*Base58Hash)(nil), // 12: nockchain.public.v1.Base58Hash + (*WalletGetBalanceRequest)(nil), // 0: nockchain.public.v2.WalletGetBalanceRequest + (*WalletGetBalanceResponse)(nil), // 1: nockchain.public.v2.WalletGetBalanceResponse + (*WalletSendTransactionRequest)(nil), // 2: nockchain.public.v2.WalletSendTransactionRequest + (*WalletSendTransactionResponse)(nil), // 3: nockchain.public.v2.WalletSendTransactionResponse + (*TransactionAcceptedRequest)(nil), // 4: nockchain.public.v2.TransactionAcceptedRequest + (*TransactionAcceptedResponse)(nil), // 5: nockchain.public.v2.TransactionAcceptedResponse + (*Base58Pubkey)(nil), // 6: nockchain.public.v2.Base58Pubkey + (*Base58Hash)(nil), // 7: nockchain.public.v2.Base58Hash + (*PageRequest)(nil), // 8: nockchain.public.v2.PageRequest + (*Balance)(nil), // 9: nockchain.public.v2.Balance + (*ErrorStatus)(nil), // 10: nockchain.public.v2.ErrorStatus + (*Hash)(nil), // 11: nockchain.public.v2.Hash + (*RawTransaction)(nil), // 12: nockchain.public.v2.RawTransaction + (*Acknowledged)(nil), // 13: nockchain.public.v2.Acknowledged } var file_nockchain_proto_depIdxs = []int32{ - 6, // 0: nockchain.public.v1.WalletGetBalanceRequest.page:type_name -> nockchain.public.v1.PageRequest - 7, // 1: nockchain.public.v1.WalletGetBalanceResponse.balance:type_name -> nockchain.public.v1.WalletBalanceData - 8, // 2: nockchain.public.v1.WalletGetBalanceResponse.error:type_name -> nockchain.public.v1.ErrorStatus - 9, // 3: nockchain.public.v1.WalletSendTransactionRequest.tx_id:type_name -> nockchain.public.v1.Hash - 10, // 4: nockchain.public.v1.WalletSendTransactionRequest.raw_tx:type_name -> nockchain.public.v1.RawTransaction - 11, // 5: nockchain.public.v1.WalletSendTransactionResponse.ack:type_name -> nockchain.public.v1.Acknowledged - 8, // 6: nockchain.public.v1.WalletSendTransactionResponse.error:type_name -> nockchain.public.v1.ErrorStatus - 12, // 7: nockchain.public.v1.TransactionAcceptedRequest.tx_id:type_name -> nockchain.public.v1.Base58Hash - 8, // 8: nockchain.public.v1.TransactionAcceptedResponse.error:type_name -> nockchain.public.v1.ErrorStatus - 0, // 9: nockchain.public.v1.NockchainService.WalletGetBalance:input_type -> nockchain.public.v1.WalletGetBalanceRequest - 2, // 10: nockchain.public.v1.NockchainService.WalletSendTransaction:input_type -> nockchain.public.v1.WalletSendTransactionRequest - 4, // 11: nockchain.public.v1.NockchainService.TransactionAccepted:input_type -> nockchain.public.v1.TransactionAcceptedRequest - 1, // 12: nockchain.public.v1.NockchainService.WalletGetBalance:output_type -> nockchain.public.v1.WalletGetBalanceResponse - 3, // 13: nockchain.public.v1.NockchainService.WalletSendTransaction:output_type -> nockchain.public.v1.WalletSendTransactionResponse - 5, // 14: nockchain.public.v1.NockchainService.TransactionAccepted:output_type -> nockchain.public.v1.TransactionAcceptedResponse - 12, // [12:15] is the sub-list for method output_type - 9, // [9:12] is the sub-list for method input_type - 9, // [9:9] is the sub-list for extension type_name - 9, // [9:9] is the sub-list for extension extendee - 0, // [0:9] is the sub-list for field type_name + 6, // 0: nockchain.public.v2.WalletGetBalanceRequest.address:type_name -> nockchain.public.v2.Base58Pubkey + 7, // 1: nockchain.public.v2.WalletGetBalanceRequest.first_name:type_name -> nockchain.public.v2.Base58Hash + 8, // 2: nockchain.public.v2.WalletGetBalanceRequest.page:type_name -> nockchain.public.v2.PageRequest + 9, // 3: nockchain.public.v2.WalletGetBalanceResponse.balance:type_name -> nockchain.public.v2.Balance + 10, // 4: nockchain.public.v2.WalletGetBalanceResponse.error:type_name -> nockchain.public.v2.ErrorStatus + 11, // 5: nockchain.public.v2.WalletSendTransactionRequest.tx_id:type_name -> nockchain.public.v2.Hash + 12, // 6: nockchain.public.v2.WalletSendTransactionRequest.raw_tx:type_name -> nockchain.public.v2.RawTransaction + 13, // 7: nockchain.public.v2.WalletSendTransactionResponse.ack:type_name -> nockchain.public.v2.Acknowledged + 10, // 8: nockchain.public.v2.WalletSendTransactionResponse.error:type_name -> nockchain.public.v2.ErrorStatus + 7, // 9: nockchain.public.v2.TransactionAcceptedRequest.tx_id:type_name -> nockchain.public.v2.Base58Hash + 10, // 10: nockchain.public.v2.TransactionAcceptedResponse.error:type_name -> nockchain.public.v2.ErrorStatus + 0, // 11: nockchain.public.v2.NockchainService.WalletGetBalance:input_type -> nockchain.public.v2.WalletGetBalanceRequest + 2, // 12: nockchain.public.v2.NockchainService.WalletSendTransaction:input_type -> nockchain.public.v2.WalletSendTransactionRequest + 4, // 13: nockchain.public.v2.NockchainService.TransactionAccepted:input_type -> nockchain.public.v2.TransactionAcceptedRequest + 1, // 14: nockchain.public.v2.NockchainService.WalletGetBalance:output_type -> nockchain.public.v2.WalletGetBalanceResponse + 3, // 15: nockchain.public.v2.NockchainService.WalletSendTransaction:output_type -> nockchain.public.v2.WalletSendTransactionResponse + 5, // 16: nockchain.public.v2.NockchainService.TransactionAccepted:output_type -> nockchain.public.v2.TransactionAcceptedResponse + 14, // [14:17] is the sub-list for method output_type + 11, // [11:14] is the sub-list for method input_type + 11, // [11:11] is the sub-list for extension type_name + 11, // [11:11] is the sub-list for extension extendee + 0, // [0:11] is the sub-list for field type_name } func init() { file_nockchain_proto_init() } @@ -522,6 +568,10 @@ func file_nockchain_proto_init() { file_blockchain_proto_init() file_primitives_proto_init() file_pagination_proto_init() + file_nockchain_proto_msgTypes[0].OneofWrappers = []any{ + (*WalletGetBalanceRequest_Address)(nil), + (*WalletGetBalanceRequest_FirstName)(nil), + } file_nockchain_proto_msgTypes[1].OneofWrappers = []any{ (*WalletGetBalanceResponse_Balance)(nil), (*WalletGetBalanceResponse_Error)(nil), diff --git a/nockchain/nockchain_grpc.pb.go b/nockchain/nockchain_grpc.pb.go index 50f01ed..bd79096 100644 --- a/nockchain/nockchain_grpc.pb.go +++ b/nockchain/nockchain_grpc.pb.go @@ -21,9 +21,9 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - NockchainService_WalletGetBalance_FullMethodName = "/nockchain.public.v1.NockchainService/WalletGetBalance" - NockchainService_WalletSendTransaction_FullMethodName = "/nockchain.public.v1.NockchainService/WalletSendTransaction" - NockchainService_TransactionAccepted_FullMethodName = "/nockchain.public.v1.NockchainService/TransactionAccepted" + NockchainService_WalletGetBalance_FullMethodName = "/nockchain.public.v2.NockchainService/WalletGetBalance" + NockchainService_WalletSendTransaction_FullMethodName = "/nockchain.public.v2.NockchainService/WalletSendTransaction" + NockchainService_TransactionAccepted_FullMethodName = "/nockchain.public.v2.NockchainService/TransactionAccepted" ) // NockchainServiceClient is the client API for NockchainService service. @@ -178,7 +178,7 @@ func _NockchainService_TransactionAccepted_Handler(srv interface{}, ctx context. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var NockchainService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "nockchain.public.v1.NockchainService", + ServiceName: "nockchain.public.v2.NockchainService", HandlerType: (*NockchainServiceServer)(nil), Methods: []grpc.MethodDesc{ { diff --git a/nockchain/pagination.pb.go b/nockchain/pagination.pb.go index 2ff4d81..bc4a964 100644 --- a/nockchain/pagination.pb.go +++ b/nockchain/pagination.pb.go @@ -152,7 +152,7 @@ var File_pagination_proto protoreflect.FileDescriptor const file_pagination_proto_rawDesc = "" + "\n" + - "\x10pagination.proto\x12\x13nockchain.public.v1\"\x80\x01\n" + + "\x10pagination.proto\x12\x13nockchain.public.v2\"\x80\x01\n" + "\vPageRequest\x125\n" + "\x17client_page_items_limit\x18\x01 \x01(\rR\x14clientPageItemsLimit\x12\x1d\n" + "\n" + @@ -175,8 +175,8 @@ func file_pagination_proto_rawDescGZIP() []byte { var file_pagination_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_pagination_proto_goTypes = []any{ - (*PageRequest)(nil), // 0: nockchain.public.v1.PageRequest - (*PageResponse)(nil), // 1: nockchain.public.v1.PageResponse + (*PageRequest)(nil), // 0: nockchain.public.v2.PageRequest + (*PageResponse)(nil), // 1: nockchain.public.v2.PageResponse } var file_pagination_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for method output_type diff --git a/nockchain/primitives.pb.go b/nockchain/primitives.pb.go index 9b2c5da..f1bb9d8 100644 --- a/nockchain/primitives.pb.go +++ b/nockchain/primitives.pb.go @@ -101,7 +101,7 @@ func (ErrorCode) EnumDescriptor() ([]byte, []int) { type ErrorStatus struct { state protoimpl.MessageState `protogen:"open.v1"` - Code ErrorCode `protobuf:"varint,1,opt,name=code,proto3,enum=nockchain.public.v1.ErrorCode" json:"code,omitempty"` + Code ErrorCode `protobuf:"varint,1,opt,name=code,proto3,enum=nockchain.public.v2.ErrorCode" json:"code,omitempty"` Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` Details *string `protobuf:"bytes,3,opt,name=details,proto3,oneof" json:"details,omitempty"` // additional error context unknownFields protoimpl.UnknownFields @@ -598,6 +598,50 @@ func (x *Base58Hash) GetHash() string { return "" } +type Base58Pubkey struct { + state protoimpl.MessageState `protogen:"open.v1"` + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Base58Pubkey) Reset() { + *x = Base58Pubkey{} + mi := &file_primitives_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Base58Pubkey) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Base58Pubkey) ProtoMessage() {} + +func (x *Base58Pubkey) ProtoReflect() protoreflect.Message { + mi := &file_primitives_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Base58Pubkey.ProtoReflect.Descriptor instead. +func (*Base58Pubkey) Descriptor() ([]byte, []int) { + return file_primitives_proto_rawDescGZIP(), []int{9} +} + +func (x *Base58Pubkey) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + // pub struct SchnorrPubkey(pub CheetahPoint); type SchnorrPubkey struct { state protoimpl.MessageState `protogen:"open.v1"` @@ -608,7 +652,7 @@ type SchnorrPubkey struct { func (x *SchnorrPubkey) Reset() { *x = SchnorrPubkey{} - mi := &file_primitives_proto_msgTypes[9] + mi := &file_primitives_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -620,7 +664,7 @@ func (x *SchnorrPubkey) String() string { func (*SchnorrPubkey) ProtoMessage() {} func (x *SchnorrPubkey) ProtoReflect() protoreflect.Message { - mi := &file_primitives_proto_msgTypes[9] + mi := &file_primitives_proto_msgTypes[10] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -633,7 +677,7 @@ func (x *SchnorrPubkey) ProtoReflect() protoreflect.Message { // Deprecated: Use SchnorrPubkey.ProtoReflect.Descriptor instead. func (*SchnorrPubkey) Descriptor() ([]byte, []int) { - return file_primitives_proto_rawDescGZIP(), []int{9} + return file_primitives_proto_rawDescGZIP(), []int{10} } func (x *SchnorrPubkey) GetValue() *CheetahPoint { @@ -659,7 +703,7 @@ type CheetahPoint struct { func (x *CheetahPoint) Reset() { *x = CheetahPoint{} - mi := &file_primitives_proto_msgTypes[10] + mi := &file_primitives_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -671,7 +715,7 @@ func (x *CheetahPoint) String() string { func (*CheetahPoint) ProtoMessage() {} func (x *CheetahPoint) ProtoReflect() protoreflect.Message { - mi := &file_primitives_proto_msgTypes[10] + mi := &file_primitives_proto_msgTypes[11] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -684,7 +728,7 @@ func (x *CheetahPoint) ProtoReflect() protoreflect.Message { // Deprecated: Use CheetahPoint.ProtoReflect.Descriptor instead. func (*CheetahPoint) Descriptor() ([]byte, []int) { - return file_primitives_proto_rawDescGZIP(), []int{10} + return file_primitives_proto_rawDescGZIP(), []int{11} } func (x *CheetahPoint) GetX() *SixBelt { @@ -723,7 +767,7 @@ type SixBelt struct { func (x *SixBelt) Reset() { *x = SixBelt{} - mi := &file_primitives_proto_msgTypes[11] + mi := &file_primitives_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -735,7 +779,7 @@ func (x *SixBelt) String() string { func (*SixBelt) ProtoMessage() {} func (x *SixBelt) ProtoReflect() protoreflect.Message { - mi := &file_primitives_proto_msgTypes[11] + mi := &file_primitives_proto_msgTypes[12] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -748,7 +792,7 @@ func (x *SixBelt) ProtoReflect() protoreflect.Message { // Deprecated: Use SixBelt.ProtoReflect.Descriptor instead. func (*SixBelt) Descriptor() ([]byte, []int) { - return file_primitives_proto_rawDescGZIP(), []int{11} + return file_primitives_proto_rawDescGZIP(), []int{12} } func (x *SixBelt) GetBelt_1() *Belt { @@ -803,7 +847,7 @@ type Belt struct { func (x *Belt) Reset() { *x = Belt{} - mi := &file_primitives_proto_msgTypes[12] + mi := &file_primitives_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -815,7 +859,7 @@ func (x *Belt) String() string { func (*Belt) ProtoMessage() {} func (x *Belt) ProtoReflect() protoreflect.Message { - mi := &file_primitives_proto_msgTypes[12] + mi := &file_primitives_proto_msgTypes[13] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -828,7 +872,7 @@ func (x *Belt) ProtoReflect() protoreflect.Message { // Deprecated: Use Belt.ProtoReflect.Descriptor instead. func (*Belt) Descriptor() ([]byte, []int) { - return file_primitives_proto_rawDescGZIP(), []int{12} + return file_primitives_proto_rawDescGZIP(), []int{13} } func (x *Belt) GetValue() uint64 { @@ -842,9 +886,9 @@ var File_primitives_proto protoreflect.FileDescriptor const file_primitives_proto_rawDesc = "" + "\n" + - "\x10primitives.proto\x12\x13nockchain.public.v1\"\x86\x01\n" + + "\x10primitives.proto\x12\x13nockchain.public.v2\"\x86\x01\n" + "\vErrorStatus\x122\n" + - "\x04code\x18\x01 \x01(\x0e2\x1e.nockchain.public.v1.ErrorCodeR\x04code\x12\x18\n" + + "\x04code\x18\x01 \x01(\x0e2\x1e.nockchain.public.v2.ErrorCodeR\x04code\x12\x18\n" + "\amessage\x18\x02 \x01(\tR\amessage\x12\x1d\n" + "\adetails\x18\x03 \x01(\tH\x00R\adetails\x88\x01\x01B\n" + "\n" + @@ -859,36 +903,38 @@ const file_primitives_proto_rawDesc = "" + "\x05Nicks\x12\x14\n" + "\x05value\x18\x01 \x01(\x04R\x05value\"\x9b\x03\n" + "\tEightBelt\x120\n" + - "\x06belt_1\x18\x01 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt1\x120\n" + - "\x06belt_2\x18\x02 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt2\x120\n" + - "\x06belt_3\x18\x03 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt3\x120\n" + - "\x06belt_4\x18\x04 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt4\x120\n" + - "\x06belt_5\x18\x05 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt5\x120\n" + - "\x06belt_6\x18\x06 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt6\x120\n" + - "\x06belt_7\x18\a \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt7\x120\n" + - "\x06belt_8\x18\b \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt8\"\x80\x02\n" + + "\x06belt_1\x18\x01 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt1\x120\n" + + "\x06belt_2\x18\x02 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt2\x120\n" + + "\x06belt_3\x18\x03 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt3\x120\n" + + "\x06belt_4\x18\x04 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt4\x120\n" + + "\x06belt_5\x18\x05 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt5\x120\n" + + "\x06belt_6\x18\x06 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt6\x120\n" + + "\x06belt_7\x18\a \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt7\x120\n" + + "\x06belt_8\x18\b \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt8\"\x80\x02\n" + "\x04Hash\x120\n" + - "\x06belt_1\x18\x01 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt1\x120\n" + - "\x06belt_2\x18\x02 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt2\x120\n" + - "\x06belt_3\x18\x03 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt3\x120\n" + - "\x06belt_4\x18\x04 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt4\x120\n" + - "\x06belt_5\x18\x05 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt5\" \n" + + "\x06belt_1\x18\x01 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt1\x120\n" + + "\x06belt_2\x18\x02 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt2\x120\n" + + "\x06belt_3\x18\x03 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt3\x120\n" + + "\x06belt_4\x18\x04 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt4\x120\n" + + "\x06belt_5\x18\x05 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt5\" \n" + "\n" + "Base58Hash\x12\x12\n" + - "\x04hash\x18\x01 \x01(\tR\x04hash\"H\n" + + "\x04hash\x18\x01 \x01(\tR\x04hash\" \n" + + "\fBase58Pubkey\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\"H\n" + "\rSchnorrPubkey\x127\n" + - "\x05value\x18\x01 \x01(\v2!.nockchain.public.v1.CheetahPointR\x05value\"x\n" + + "\x05value\x18\x01 \x01(\v2!.nockchain.public.v2.CheetahPointR\x05value\"x\n" + "\fCheetahPoint\x12*\n" + - "\x01x\x18\x01 \x01(\v2\x1c.nockchain.public.v1.SixBeltR\x01x\x12*\n" + - "\x01y\x18\x02 \x01(\v2\x1c.nockchain.public.v1.SixBeltR\x01y\x12\x10\n" + + "\x01x\x18\x01 \x01(\v2\x1c.nockchain.public.v2.SixBeltR\x01x\x12*\n" + + "\x01y\x18\x02 \x01(\v2\x1c.nockchain.public.v2.SixBeltR\x01y\x12\x10\n" + "\x03inf\x18\x03 \x01(\bR\x03inf\"\xb5\x02\n" + "\aSixBelt\x120\n" + - "\x06belt_1\x18\x01 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt1\x120\n" + - "\x06belt_2\x18\x02 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt2\x120\n" + - "\x06belt_3\x18\x03 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt3\x120\n" + - "\x06belt_4\x18\x04 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt4\x120\n" + - "\x06belt_5\x18\x05 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt5\x120\n" + - "\x06belt_6\x18\x06 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt6\"\x1c\n" + + "\x06belt_1\x18\x01 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt1\x120\n" + + "\x06belt_2\x18\x02 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt2\x120\n" + + "\x06belt_3\x18\x03 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt3\x120\n" + + "\x06belt_4\x18\x04 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt4\x120\n" + + "\x06belt_5\x18\x05 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt5\x120\n" + + "\x06belt_6\x18\x06 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt6\"\x1c\n" + "\x04Belt\x12\x14\n" + "\x05value\x18\x01 \x01(\x04R\x05value*\xf0\x02\n" + "\tErrorCode\x12\x1a\n" + @@ -919,47 +965,48 @@ func file_primitives_proto_rawDescGZIP() []byte { } var file_primitives_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_primitives_proto_msgTypes = make([]protoimpl.MessageInfo, 13) +var file_primitives_proto_msgTypes = make([]protoimpl.MessageInfo, 14) var file_primitives_proto_goTypes = []any{ - (ErrorCode)(0), // 0: nockchain.public.v1.ErrorCode - (*ErrorStatus)(nil), // 1: nockchain.public.v1.ErrorStatus - (*Acknowledged)(nil), // 2: nockchain.public.v1.Acknowledged - (*NoteVersion)(nil), // 3: nockchain.public.v1.NoteVersion - (*BlockHeight)(nil), // 4: nockchain.public.v1.BlockHeight - (*BlockHeightDelta)(nil), // 5: nockchain.public.v1.BlockHeightDelta - (*Nicks)(nil), // 6: nockchain.public.v1.Nicks - (*EightBelt)(nil), // 7: nockchain.public.v1.EightBelt - (*Hash)(nil), // 8: nockchain.public.v1.Hash - (*Base58Hash)(nil), // 9: nockchain.public.v1.Base58Hash - (*SchnorrPubkey)(nil), // 10: nockchain.public.v1.SchnorrPubkey - (*CheetahPoint)(nil), // 11: nockchain.public.v1.CheetahPoint - (*SixBelt)(nil), // 12: nockchain.public.v1.SixBelt - (*Belt)(nil), // 13: nockchain.public.v1.Belt + (ErrorCode)(0), // 0: nockchain.public.v2.ErrorCode + (*ErrorStatus)(nil), // 1: nockchain.public.v2.ErrorStatus + (*Acknowledged)(nil), // 2: nockchain.public.v2.Acknowledged + (*NoteVersion)(nil), // 3: nockchain.public.v2.NoteVersion + (*BlockHeight)(nil), // 4: nockchain.public.v2.BlockHeight + (*BlockHeightDelta)(nil), // 5: nockchain.public.v2.BlockHeightDelta + (*Nicks)(nil), // 6: nockchain.public.v2.Nicks + (*EightBelt)(nil), // 7: nockchain.public.v2.EightBelt + (*Hash)(nil), // 8: nockchain.public.v2.Hash + (*Base58Hash)(nil), // 9: nockchain.public.v2.Base58Hash + (*Base58Pubkey)(nil), // 10: nockchain.public.v2.Base58Pubkey + (*SchnorrPubkey)(nil), // 11: nockchain.public.v2.SchnorrPubkey + (*CheetahPoint)(nil), // 12: nockchain.public.v2.CheetahPoint + (*SixBelt)(nil), // 13: nockchain.public.v2.SixBelt + (*Belt)(nil), // 14: nockchain.public.v2.Belt } var file_primitives_proto_depIdxs = []int32{ - 0, // 0: nockchain.public.v1.ErrorStatus.code:type_name -> nockchain.public.v1.ErrorCode - 13, // 1: nockchain.public.v1.EightBelt.belt_1:type_name -> nockchain.public.v1.Belt - 13, // 2: nockchain.public.v1.EightBelt.belt_2:type_name -> nockchain.public.v1.Belt - 13, // 3: nockchain.public.v1.EightBelt.belt_3:type_name -> nockchain.public.v1.Belt - 13, // 4: nockchain.public.v1.EightBelt.belt_4:type_name -> nockchain.public.v1.Belt - 13, // 5: nockchain.public.v1.EightBelt.belt_5:type_name -> nockchain.public.v1.Belt - 13, // 6: nockchain.public.v1.EightBelt.belt_6:type_name -> nockchain.public.v1.Belt - 13, // 7: nockchain.public.v1.EightBelt.belt_7:type_name -> nockchain.public.v1.Belt - 13, // 8: nockchain.public.v1.EightBelt.belt_8:type_name -> nockchain.public.v1.Belt - 13, // 9: nockchain.public.v1.Hash.belt_1:type_name -> nockchain.public.v1.Belt - 13, // 10: nockchain.public.v1.Hash.belt_2:type_name -> nockchain.public.v1.Belt - 13, // 11: nockchain.public.v1.Hash.belt_3:type_name -> nockchain.public.v1.Belt - 13, // 12: nockchain.public.v1.Hash.belt_4:type_name -> nockchain.public.v1.Belt - 13, // 13: nockchain.public.v1.Hash.belt_5:type_name -> nockchain.public.v1.Belt - 11, // 14: nockchain.public.v1.SchnorrPubkey.value:type_name -> nockchain.public.v1.CheetahPoint - 12, // 15: nockchain.public.v1.CheetahPoint.x:type_name -> nockchain.public.v1.SixBelt - 12, // 16: nockchain.public.v1.CheetahPoint.y:type_name -> nockchain.public.v1.SixBelt - 13, // 17: nockchain.public.v1.SixBelt.belt_1:type_name -> nockchain.public.v1.Belt - 13, // 18: nockchain.public.v1.SixBelt.belt_2:type_name -> nockchain.public.v1.Belt - 13, // 19: nockchain.public.v1.SixBelt.belt_3:type_name -> nockchain.public.v1.Belt - 13, // 20: nockchain.public.v1.SixBelt.belt_4:type_name -> nockchain.public.v1.Belt - 13, // 21: nockchain.public.v1.SixBelt.belt_5:type_name -> nockchain.public.v1.Belt - 13, // 22: nockchain.public.v1.SixBelt.belt_6:type_name -> nockchain.public.v1.Belt + 0, // 0: nockchain.public.v2.ErrorStatus.code:type_name -> nockchain.public.v2.ErrorCode + 14, // 1: nockchain.public.v2.EightBelt.belt_1:type_name -> nockchain.public.v2.Belt + 14, // 2: nockchain.public.v2.EightBelt.belt_2:type_name -> nockchain.public.v2.Belt + 14, // 3: nockchain.public.v2.EightBelt.belt_3:type_name -> nockchain.public.v2.Belt + 14, // 4: nockchain.public.v2.EightBelt.belt_4:type_name -> nockchain.public.v2.Belt + 14, // 5: nockchain.public.v2.EightBelt.belt_5:type_name -> nockchain.public.v2.Belt + 14, // 6: nockchain.public.v2.EightBelt.belt_6:type_name -> nockchain.public.v2.Belt + 14, // 7: nockchain.public.v2.EightBelt.belt_7:type_name -> nockchain.public.v2.Belt + 14, // 8: nockchain.public.v2.EightBelt.belt_8:type_name -> nockchain.public.v2.Belt + 14, // 9: nockchain.public.v2.Hash.belt_1:type_name -> nockchain.public.v2.Belt + 14, // 10: nockchain.public.v2.Hash.belt_2:type_name -> nockchain.public.v2.Belt + 14, // 11: nockchain.public.v2.Hash.belt_3:type_name -> nockchain.public.v2.Belt + 14, // 12: nockchain.public.v2.Hash.belt_4:type_name -> nockchain.public.v2.Belt + 14, // 13: nockchain.public.v2.Hash.belt_5:type_name -> nockchain.public.v2.Belt + 12, // 14: nockchain.public.v2.SchnorrPubkey.value:type_name -> nockchain.public.v2.CheetahPoint + 13, // 15: nockchain.public.v2.CheetahPoint.x:type_name -> nockchain.public.v2.SixBelt + 13, // 16: nockchain.public.v2.CheetahPoint.y:type_name -> nockchain.public.v2.SixBelt + 14, // 17: nockchain.public.v2.SixBelt.belt_1:type_name -> nockchain.public.v2.Belt + 14, // 18: nockchain.public.v2.SixBelt.belt_2:type_name -> nockchain.public.v2.Belt + 14, // 19: nockchain.public.v2.SixBelt.belt_3:type_name -> nockchain.public.v2.Belt + 14, // 20: nockchain.public.v2.SixBelt.belt_4:type_name -> nockchain.public.v2.Belt + 14, // 21: nockchain.public.v2.SixBelt.belt_5:type_name -> nockchain.public.v2.Belt + 14, // 22: nockchain.public.v2.SixBelt.belt_6:type_name -> nockchain.public.v2.Belt 23, // [23:23] is the sub-list for method output_type 23, // [23:23] is the sub-list for method input_type 23, // [23:23] is the sub-list for extension type_name @@ -979,7 +1026,7 @@ func file_primitives_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_primitives_proto_rawDesc), len(file_primitives_proto_rawDesc)), NumEnums: 1, - NumMessages: 13, + NumMessages: 14, NumExtensions: 0, NumServices: 0, }, diff --git a/nockchain/service.pb.go b/nockchain/service.pb.go index 040a2bd..1337506 100644 --- a/nockchain/service.pb.go +++ b/nockchain/service.pb.go @@ -161,7 +161,7 @@ type ImportKeysRequest struct { state protoimpl.MessageState `protogen:"open.v1"` Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` Version uint64 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` - ImportType ImportType `protobuf:"varint,3,opt,name=import_type,json=importType,proto3,enum=nockchain.public.v1.ImportType" json:"import_type,omitempty"` + ImportType ImportType `protobuf:"varint,3,opt,name=import_type,json=importType,proto3,enum=nockchain.public.v2.ImportType" json:"import_type,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -446,20 +446,18 @@ func (x *DeriveChildResponse) GetVersion() uint64 { } type CreateTxRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - Names string `protobuf:"bytes,1,opt,name=names,proto3" json:"names,omitempty"` - Recipients string `protobuf:"bytes,2,opt,name=recipients,proto3" json:"recipients,omitempty"` - Gifts string `protobuf:"bytes,3,opt,name=gifts,proto3" json:"gifts,omitempty"` - Fee uint64 `protobuf:"varint,4,opt,name=fee,proto3" json:"fee,omitempty"` - IsMasterKey bool `protobuf:"varint,5,opt,name=is_master_key,json=isMasterKey,proto3" json:"is_master_key,omitempty"` - Key string `protobuf:"bytes,6,opt,name=key,proto3" json:"key,omitempty"` - ChainCode string `protobuf:"bytes,7,opt,name=chain_code,json=chainCode,proto3" json:"chain_code,omitempty"` - Index uint64 `protobuf:"varint,8,opt,name=index,proto3" json:"index,omitempty"` - Hardened bool `protobuf:"varint,9,opt,name=hardened,proto3" json:"hardened,omitempty"` - Version uint64 `protobuf:"varint,10,opt,name=version,proto3" json:"version,omitempty"` - TimelockIntent *TimelockIntent `protobuf:"bytes,11,opt,name=timelock_intent,json=timelockIntent,proto3" json:"timelock_intent,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Names string `protobuf:"bytes,1,opt,name=names,proto3" json:"names,omitempty"` + Recipients string `protobuf:"bytes,2,opt,name=recipients,proto3" json:"recipients,omitempty"` + Fee uint64 `protobuf:"varint,3,opt,name=fee,proto3" json:"fee,omitempty"` + IsMasterKey bool `protobuf:"varint,4,opt,name=is_master_key,json=isMasterKey,proto3" json:"is_master_key,omitempty"` + Seed string `protobuf:"bytes,5,opt,name=seed,proto3" json:"seed,omitempty"` + Index uint64 `protobuf:"varint,6,opt,name=index,proto3" json:"index,omitempty"` + Hardened bool `protobuf:"varint,7,opt,name=hardened,proto3" json:"hardened,omitempty"` + Version uint64 `protobuf:"varint,8,opt,name=version,proto3" json:"version,omitempty"` + RefundAddress string `protobuf:"bytes,9,opt,name=refund_address,json=refundAddress,proto3" json:"refund_address,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *CreateTxRequest) Reset() { @@ -506,13 +504,6 @@ func (x *CreateTxRequest) GetRecipients() string { return "" } -func (x *CreateTxRequest) GetGifts() string { - if x != nil { - return x.Gifts - } - return "" -} - func (x *CreateTxRequest) GetFee() uint64 { if x != nil { return x.Fee @@ -527,16 +518,9 @@ func (x *CreateTxRequest) GetIsMasterKey() bool { return false } -func (x *CreateTxRequest) GetKey() string { +func (x *CreateTxRequest) GetSeed() string { if x != nil { - return x.Key - } - return "" -} - -func (x *CreateTxRequest) GetChainCode() string { - if x != nil { - return x.ChainCode + return x.Seed } return "" } @@ -562,11 +546,11 @@ func (x *CreateTxRequest) GetVersion() uint64 { return 0 } -func (x *CreateTxRequest) GetTimelockIntent() *TimelockIntent { +func (x *CreateTxRequest) GetRefundAddress() string { if x != nil { - return x.TimelockIntent + return x.RefundAddress } - return nil + return "" } type CreateTxResponse struct { @@ -620,6 +604,7 @@ type ScanRequest struct { SearchDepth uint64 `protobuf:"varint,3,opt,name=search_depth,json=searchDepth,proto3" json:"search_depth,omitempty"` IncludeTimelocks bool `protobuf:"varint,4,opt,name=include_timelocks,json=includeTimelocks,proto3" json:"include_timelocks,omitempty"` IncludeMultisig bool `protobuf:"varint,5,opt,name=include_multisig,json=includeMultisig,proto3" json:"include_multisig,omitempty"` + Version uint64 `protobuf:"varint,6,opt,name=version,proto3" json:"version,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -689,6 +674,13 @@ func (x *ScanRequest) GetIncludeMultisig() bool { return false } +func (x *ScanRequest) GetVersion() uint64 { + if x != nil { + return x.Version + } + return 0 +} + type ScanResponse struct { state protoimpl.MessageState `protogen:"open.v1"` ScanData []*ScanData `protobuf:"bytes,1,rep,name=scan_data,json=scanData,proto3" json:"scan_data,omitempty"` @@ -734,8 +726,12 @@ func (x *ScanResponse) GetScanData() []*ScanData { } type GetBalanceRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Selector: + // + // *GetBalanceRequest_Address + // *GetBalanceRequest_FirstName + Selector isGetBalanceRequest_Selector `protobuf_oneof:"selector"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -770,16 +766,50 @@ func (*GetBalanceRequest) Descriptor() ([]byte, []int) { return file_service_proto_rawDescGZIP(), []int{10} } +func (x *GetBalanceRequest) GetSelector() isGetBalanceRequest_Selector { + if x != nil { + return x.Selector + } + return nil +} + func (x *GetBalanceRequest) GetAddress() string { if x != nil { - return x.Address + if x, ok := x.Selector.(*GetBalanceRequest_Address); ok { + return x.Address + } } return "" } +func (x *GetBalanceRequest) GetFirstName() string { + if x != nil { + if x, ok := x.Selector.(*GetBalanceRequest_FirstName); ok { + return x.FirstName + } + } + return "" +} + +type isGetBalanceRequest_Selector interface { + isGetBalanceRequest_Selector() +} + +type GetBalanceRequest_Address struct { + Address string `protobuf:"bytes,1,opt,name=address,proto3,oneof"` +} + +type GetBalanceRequest_FirstName struct { + FirstName string `protobuf:"bytes,2,opt,name=first_name,json=firstName,proto3,oneof"` +} + +func (*GetBalanceRequest_Address) isGetBalanceRequest_Selector() {} + +func (*GetBalanceRequest_FirstName) isGetBalanceRequest_Selector() {} + type GetBalanceResponse struct { state protoimpl.MessageState `protogen:"open.v1"` - Data *WalletBalanceData `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` + Data *Balance `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -814,7 +844,7 @@ func (*GetBalanceResponse) Descriptor() ([]byte, []int) { return file_service_proto_rawDescGZIP(), []int{11} } -func (x *GetBalanceResponse) GetData() *WalletBalanceData { +func (x *GetBalanceResponse) GetData() *Balance { if x != nil { return x.Data } @@ -913,7 +943,7 @@ var File_service_proto protoreflect.FileDescriptor const file_service_proto_rawDesc = "" + "\n" + - "\rservice.proto\x12\x13nockchain.public.v1\x1a\vtypes.proto\x1a\x10blockchain.proto\x1a\x0fnockchain.proto\")\n" + + "\rservice.proto\x12\x13nockchain.public.v2\x1a\vtypes.proto\x1a\x10blockchain.proto\x1a\x0fnockchain.proto\")\n" + "\rKeygenRequest\x12\x18\n" + "\aversion\x18\x01 \x01(\x04R\aversion\"\xf2\x01\n" + "\x0eKeygenResponse\x12\x18\n" + @@ -929,7 +959,7 @@ const file_service_proto_rawDesc = "" + "\x11ImportKeysRequest\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x18\n" + "\aversion\x18\x02 \x01(\x04R\aversion\x12@\n" + - "\vimport_type\x18\x03 \x01(\x0e2\x1f.nockchain.public.v1.ImportTypeR\n" + + "\vimport_type\x18\x03 \x01(\x0e2\x1f.nockchain.public.v2.ImportTypeR\n" + "importType\"\xf6\x01\n" + "\x12ImportKeysResponse\x12\x18\n" + "\aaddress\x18\x01 \x01(\tR\aaddress\x12\x1f\n" + @@ -952,52 +982,53 @@ const file_service_proto_rawDesc = "" + "privateKey\x12\x1d\n" + "\n" + "chain_code\x18\x03 \x01(\tR\tchainCode\x12\x18\n" + - "\aversion\x18\x04 \x01(\x04R\aversion\"\xde\x02\n" + + "\aversion\x18\x04 \x01(\x04R\aversion\"\x84\x02\n" + "\x0fCreateTxRequest\x12\x14\n" + "\x05names\x18\x01 \x01(\tR\x05names\x12\x1e\n" + "\n" + "recipients\x18\x02 \x01(\tR\n" + - "recipients\x12\x14\n" + - "\x05gifts\x18\x03 \x01(\tR\x05gifts\x12\x10\n" + - "\x03fee\x18\x04 \x01(\x04R\x03fee\x12\"\n" + - "\ris_master_key\x18\x05 \x01(\bR\visMasterKey\x12\x10\n" + - "\x03key\x18\x06 \x01(\tR\x03key\x12\x1d\n" + - "\n" + - "chain_code\x18\a \x01(\tR\tchainCode\x12\x14\n" + - "\x05index\x18\b \x01(\x04R\x05index\x12\x1a\n" + - "\bhardened\x18\t \x01(\bR\bhardened\x12\x18\n" + - "\aversion\x18\n" + - " \x01(\x04R\aversion\x12L\n" + - "\x0ftimelock_intent\x18\v \x01(\v2#.nockchain.public.v1.TimelockIntentR\x0etimelockIntent\"D\n" + + "recipients\x12\x10\n" + + "\x03fee\x18\x03 \x01(\x04R\x03fee\x12\"\n" + + "\ris_master_key\x18\x04 \x01(\bR\visMasterKey\x12\x12\n" + + "\x04seed\x18\x05 \x01(\tR\x04seed\x12\x14\n" + + "\x05index\x18\x06 \x01(\x04R\x05index\x12\x1a\n" + + "\bhardened\x18\a \x01(\bR\bhardened\x12\x18\n" + + "\aversion\x18\b \x01(\x04R\aversion\x12%\n" + + "\x0erefund_address\x18\t \x01(\tR\rrefundAddress\"D\n" + "\x10CreateTxResponse\x120\n" + - "\x05rawTx\x18\x01 \x01(\v2\x1a.nockchain.public.v1.RawTxR\x05rawTx\"\xcc\x01\n" + + "\x05rawTx\x18\x01 \x01(\v2\x1a.nockchain.public.v2.RawTxR\x05rawTx\"\xe6\x01\n" + "\vScanRequest\x12#\n" + "\rmaster_pubkey\x18\x01 \x01(\tR\fmasterPubkey\x12\x1d\n" + "\n" + "chain_code\x18\x02 \x01(\tR\tchainCode\x12!\n" + "\fsearch_depth\x18\x03 \x01(\x04R\vsearchDepth\x12+\n" + "\x11include_timelocks\x18\x04 \x01(\bR\x10includeTimelocks\x12)\n" + - "\x10include_multisig\x18\x05 \x01(\bR\x0fincludeMultisig\"J\n" + + "\x10include_multisig\x18\x05 \x01(\bR\x0fincludeMultisig\x12\x18\n" + + "\aversion\x18\x06 \x01(\x04R\aversion\"J\n" + "\fScanResponse\x12:\n" + - "\tscan_data\x18\x01 \x03(\v2\x1d.nockchain.public.v1.ScanDataR\bscanData\"-\n" + - "\x11GetBalanceRequest\x12\x18\n" + - "\aaddress\x18\x01 \x01(\tR\aaddress\"P\n" + - "\x12GetBalanceResponse\x12:\n" + - "\x04data\x18\x01 \x01(\v2&.nockchain.public.v1.WalletBalanceDataR\x04data\"K\n" + - "\x16SendTransactionRequest\x121\n" + - "\x06raw_tx\x18\x01 \x01(\v2\x1a.nockchain.public.v1.RawTxR\x05rawTx\"i\n" + - "\x17SendTransactionResponse\x12N\n" + - "\bresponse\x18\x01 \x01(\v22.nockchain.public.v1.WalletSendTransactionResponseR\bresponse2\x9c\x06\n" + - "\rWalletService\x12Q\n" + - "\x06Keygen\x12\".nockchain.public.v1.KeygenRequest\x1a#.nockchain.public.v1.KeygenResponse\x12]\n" + + "\tscan_data\x18\x01 \x03(\v2\x1d.nockchain.public.v2.ScanDataR\bscanData\"\\\n" + + "\x11GetBalanceRequest\x12\x1a\n" + + "\aaddress\x18\x01 \x01(\tH\x00R\aaddress\x12\x1f\n" + "\n" + - "ImportKeys\x12&.nockchain.public.v1.ImportKeysRequest\x1a'.nockchain.public.v1.ImportKeysResponse\x12`\n" + - "\vDeriveChild\x12'.nockchain.public.v1.DeriveChildRequest\x1a(.nockchain.public.v1.DeriveChildResponse\x12W\n" + - "\bCreateTx\x12$.nockchain.public.v1.CreateTxRequest\x1a%.nockchain.public.v1.CreateTxResponse\x12K\n" + - "\x04Scan\x12 .nockchain.public.v1.ScanRequest\x1a!.nockchain.public.v1.ScanResponse\x12c\n" + - "\x10WalletGetBalance\x12&.nockchain.public.v1.GetBalanceRequest\x1a'.nockchain.public.v1.GetBalanceResponse\x12r\n" + - "\x15WalletSendTransaction\x12+.nockchain.public.v1.SendTransactionRequest\x1a,.nockchain.public.v1.SendTransactionResponse\x12x\n" + - "\x13TransactionAccepted\x12/.nockchain.public.v1.TransactionAcceptedRequest\x1a0.nockchain.public.v1.TransactionAcceptedResponseB\x0eZ\f./;nockchainb\x06proto3" + "first_name\x18\x02 \x01(\tH\x00R\tfirstNameB\n" + + "\n" + + "\bselector\"F\n" + + "\x12GetBalanceResponse\x120\n" + + "\x04data\x18\x01 \x01(\v2\x1c.nockchain.public.v2.BalanceR\x04data\"K\n" + + "\x16SendTransactionRequest\x121\n" + + "\x06raw_tx\x18\x01 \x01(\v2\x1a.nockchain.public.v2.RawTxR\x05rawTx\"i\n" + + "\x17SendTransactionResponse\x12N\n" + + "\bresponse\x18\x01 \x01(\v22.nockchain.public.v2.WalletSendTransactionResponseR\bresponse2\x9c\x06\n" + + "\rWalletService\x12Q\n" + + "\x06Keygen\x12\".nockchain.public.v2.KeygenRequest\x1a#.nockchain.public.v2.KeygenResponse\x12]\n" + + "\n" + + "ImportKeys\x12&.nockchain.public.v2.ImportKeysRequest\x1a'.nockchain.public.v2.ImportKeysResponse\x12`\n" + + "\vDeriveChild\x12'.nockchain.public.v2.DeriveChildRequest\x1a(.nockchain.public.v2.DeriveChildResponse\x12W\n" + + "\bCreateTx\x12$.nockchain.public.v2.CreateTxRequest\x1a%.nockchain.public.v2.CreateTxResponse\x12K\n" + + "\x04Scan\x12 .nockchain.public.v2.ScanRequest\x1a!.nockchain.public.v2.ScanResponse\x12c\n" + + "\x10WalletGetBalance\x12&.nockchain.public.v2.GetBalanceRequest\x1a'.nockchain.public.v2.GetBalanceResponse\x12r\n" + + "\x15WalletSendTransaction\x12+.nockchain.public.v2.SendTransactionRequest\x1a,.nockchain.public.v2.SendTransactionResponse\x12x\n" + + "\x13TransactionAccepted\x12/.nockchain.public.v2.TransactionAcceptedRequest\x1a0.nockchain.public.v2.TransactionAcceptedResponseB\x0eZ\f./;nockchainb\x06proto3" var ( file_service_proto_rawDescOnce sync.Once @@ -1013,58 +1044,56 @@ func file_service_proto_rawDescGZIP() []byte { var file_service_proto_msgTypes = make([]protoimpl.MessageInfo, 14) var file_service_proto_goTypes = []any{ - (*KeygenRequest)(nil), // 0: nockchain.public.v1.KeygenRequest - (*KeygenResponse)(nil), // 1: nockchain.public.v1.KeygenResponse - (*ImportKeysRequest)(nil), // 2: nockchain.public.v1.ImportKeysRequest - (*ImportKeysResponse)(nil), // 3: nockchain.public.v1.ImportKeysResponse - (*DeriveChildRequest)(nil), // 4: nockchain.public.v1.DeriveChildRequest - (*DeriveChildResponse)(nil), // 5: nockchain.public.v1.DeriveChildResponse - (*CreateTxRequest)(nil), // 6: nockchain.public.v1.CreateTxRequest - (*CreateTxResponse)(nil), // 7: nockchain.public.v1.CreateTxResponse - (*ScanRequest)(nil), // 8: nockchain.public.v1.ScanRequest - (*ScanResponse)(nil), // 9: nockchain.public.v1.ScanResponse - (*GetBalanceRequest)(nil), // 10: nockchain.public.v1.GetBalanceRequest - (*GetBalanceResponse)(nil), // 11: nockchain.public.v1.GetBalanceResponse - (*SendTransactionRequest)(nil), // 12: nockchain.public.v1.SendTransactionRequest - (*SendTransactionResponse)(nil), // 13: nockchain.public.v1.SendTransactionResponse - (ImportType)(0), // 14: nockchain.public.v1.ImportType - (*TimelockIntent)(nil), // 15: nockchain.public.v1.TimelockIntent - (*RawTx)(nil), // 16: nockchain.public.v1.RawTx - (*ScanData)(nil), // 17: nockchain.public.v1.ScanData - (*WalletBalanceData)(nil), // 18: nockchain.public.v1.WalletBalanceData - (*WalletSendTransactionResponse)(nil), // 19: nockchain.public.v1.WalletSendTransactionResponse - (*TransactionAcceptedRequest)(nil), // 20: nockchain.public.v1.TransactionAcceptedRequest - (*TransactionAcceptedResponse)(nil), // 21: nockchain.public.v1.TransactionAcceptedResponse + (*KeygenRequest)(nil), // 0: nockchain.public.v2.KeygenRequest + (*KeygenResponse)(nil), // 1: nockchain.public.v2.KeygenResponse + (*ImportKeysRequest)(nil), // 2: nockchain.public.v2.ImportKeysRequest + (*ImportKeysResponse)(nil), // 3: nockchain.public.v2.ImportKeysResponse + (*DeriveChildRequest)(nil), // 4: nockchain.public.v2.DeriveChildRequest + (*DeriveChildResponse)(nil), // 5: nockchain.public.v2.DeriveChildResponse + (*CreateTxRequest)(nil), // 6: nockchain.public.v2.CreateTxRequest + (*CreateTxResponse)(nil), // 7: nockchain.public.v2.CreateTxResponse + (*ScanRequest)(nil), // 8: nockchain.public.v2.ScanRequest + (*ScanResponse)(nil), // 9: nockchain.public.v2.ScanResponse + (*GetBalanceRequest)(nil), // 10: nockchain.public.v2.GetBalanceRequest + (*GetBalanceResponse)(nil), // 11: nockchain.public.v2.GetBalanceResponse + (*SendTransactionRequest)(nil), // 12: nockchain.public.v2.SendTransactionRequest + (*SendTransactionResponse)(nil), // 13: nockchain.public.v2.SendTransactionResponse + (ImportType)(0), // 14: nockchain.public.v2.ImportType + (*RawTx)(nil), // 15: nockchain.public.v2.RawTx + (*ScanData)(nil), // 16: nockchain.public.v2.ScanData + (*Balance)(nil), // 17: nockchain.public.v2.Balance + (*WalletSendTransactionResponse)(nil), // 18: nockchain.public.v2.WalletSendTransactionResponse + (*TransactionAcceptedRequest)(nil), // 19: nockchain.public.v2.TransactionAcceptedRequest + (*TransactionAcceptedResponse)(nil), // 20: nockchain.public.v2.TransactionAcceptedResponse } var file_service_proto_depIdxs = []int32{ - 14, // 0: nockchain.public.v1.ImportKeysRequest.import_type:type_name -> nockchain.public.v1.ImportType - 15, // 1: nockchain.public.v1.CreateTxRequest.timelock_intent:type_name -> nockchain.public.v1.TimelockIntent - 16, // 2: nockchain.public.v1.CreateTxResponse.rawTx:type_name -> nockchain.public.v1.RawTx - 17, // 3: nockchain.public.v1.ScanResponse.scan_data:type_name -> nockchain.public.v1.ScanData - 18, // 4: nockchain.public.v1.GetBalanceResponse.data:type_name -> nockchain.public.v1.WalletBalanceData - 16, // 5: nockchain.public.v1.SendTransactionRequest.raw_tx:type_name -> nockchain.public.v1.RawTx - 19, // 6: nockchain.public.v1.SendTransactionResponse.response:type_name -> nockchain.public.v1.WalletSendTransactionResponse - 0, // 7: nockchain.public.v1.WalletService.Keygen:input_type -> nockchain.public.v1.KeygenRequest - 2, // 8: nockchain.public.v1.WalletService.ImportKeys:input_type -> nockchain.public.v1.ImportKeysRequest - 4, // 9: nockchain.public.v1.WalletService.DeriveChild:input_type -> nockchain.public.v1.DeriveChildRequest - 6, // 10: nockchain.public.v1.WalletService.CreateTx:input_type -> nockchain.public.v1.CreateTxRequest - 8, // 11: nockchain.public.v1.WalletService.Scan:input_type -> nockchain.public.v1.ScanRequest - 10, // 12: nockchain.public.v1.WalletService.WalletGetBalance:input_type -> nockchain.public.v1.GetBalanceRequest - 12, // 13: nockchain.public.v1.WalletService.WalletSendTransaction:input_type -> nockchain.public.v1.SendTransactionRequest - 20, // 14: nockchain.public.v1.WalletService.TransactionAccepted:input_type -> nockchain.public.v1.TransactionAcceptedRequest - 1, // 15: nockchain.public.v1.WalletService.Keygen:output_type -> nockchain.public.v1.KeygenResponse - 3, // 16: nockchain.public.v1.WalletService.ImportKeys:output_type -> nockchain.public.v1.ImportKeysResponse - 5, // 17: nockchain.public.v1.WalletService.DeriveChild:output_type -> nockchain.public.v1.DeriveChildResponse - 7, // 18: nockchain.public.v1.WalletService.CreateTx:output_type -> nockchain.public.v1.CreateTxResponse - 9, // 19: nockchain.public.v1.WalletService.Scan:output_type -> nockchain.public.v1.ScanResponse - 11, // 20: nockchain.public.v1.WalletService.WalletGetBalance:output_type -> nockchain.public.v1.GetBalanceResponse - 13, // 21: nockchain.public.v1.WalletService.WalletSendTransaction:output_type -> nockchain.public.v1.SendTransactionResponse - 21, // 22: nockchain.public.v1.WalletService.TransactionAccepted:output_type -> nockchain.public.v1.TransactionAcceptedResponse - 15, // [15:23] is the sub-list for method output_type - 7, // [7:15] is the sub-list for method input_type - 7, // [7:7] is the sub-list for extension type_name - 7, // [7:7] is the sub-list for extension extendee - 0, // [0:7] is the sub-list for field type_name + 14, // 0: nockchain.public.v2.ImportKeysRequest.import_type:type_name -> nockchain.public.v2.ImportType + 15, // 1: nockchain.public.v2.CreateTxResponse.rawTx:type_name -> nockchain.public.v2.RawTx + 16, // 2: nockchain.public.v2.ScanResponse.scan_data:type_name -> nockchain.public.v2.ScanData + 17, // 3: nockchain.public.v2.GetBalanceResponse.data:type_name -> nockchain.public.v2.Balance + 15, // 4: nockchain.public.v2.SendTransactionRequest.raw_tx:type_name -> nockchain.public.v2.RawTx + 18, // 5: nockchain.public.v2.SendTransactionResponse.response:type_name -> nockchain.public.v2.WalletSendTransactionResponse + 0, // 6: nockchain.public.v2.WalletService.Keygen:input_type -> nockchain.public.v2.KeygenRequest + 2, // 7: nockchain.public.v2.WalletService.ImportKeys:input_type -> nockchain.public.v2.ImportKeysRequest + 4, // 8: nockchain.public.v2.WalletService.DeriveChild:input_type -> nockchain.public.v2.DeriveChildRequest + 6, // 9: nockchain.public.v2.WalletService.CreateTx:input_type -> nockchain.public.v2.CreateTxRequest + 8, // 10: nockchain.public.v2.WalletService.Scan:input_type -> nockchain.public.v2.ScanRequest + 10, // 11: nockchain.public.v2.WalletService.WalletGetBalance:input_type -> nockchain.public.v2.GetBalanceRequest + 12, // 12: nockchain.public.v2.WalletService.WalletSendTransaction:input_type -> nockchain.public.v2.SendTransactionRequest + 19, // 13: nockchain.public.v2.WalletService.TransactionAccepted:input_type -> nockchain.public.v2.TransactionAcceptedRequest + 1, // 14: nockchain.public.v2.WalletService.Keygen:output_type -> nockchain.public.v2.KeygenResponse + 3, // 15: nockchain.public.v2.WalletService.ImportKeys:output_type -> nockchain.public.v2.ImportKeysResponse + 5, // 16: nockchain.public.v2.WalletService.DeriveChild:output_type -> nockchain.public.v2.DeriveChildResponse + 7, // 17: nockchain.public.v2.WalletService.CreateTx:output_type -> nockchain.public.v2.CreateTxResponse + 9, // 18: nockchain.public.v2.WalletService.Scan:output_type -> nockchain.public.v2.ScanResponse + 11, // 19: nockchain.public.v2.WalletService.WalletGetBalance:output_type -> nockchain.public.v2.GetBalanceResponse + 13, // 20: nockchain.public.v2.WalletService.WalletSendTransaction:output_type -> nockchain.public.v2.SendTransactionResponse + 20, // 21: nockchain.public.v2.WalletService.TransactionAccepted:output_type -> nockchain.public.v2.TransactionAcceptedResponse + 14, // [14:22] is the sub-list for method output_type + 6, // [6:14] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name } func init() { file_service_proto_init() } @@ -1075,6 +1104,10 @@ func file_service_proto_init() { file_types_proto_init() file_blockchain_proto_init() file_nockchain_proto_init() + file_service_proto_msgTypes[10].OneofWrappers = []any{ + (*GetBalanceRequest_Address)(nil), + (*GetBalanceRequest_FirstName)(nil), + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/nockchain/service_grpc.pb.go b/nockchain/service_grpc.pb.go index 73b8665..79a7838 100644 --- a/nockchain/service_grpc.pb.go +++ b/nockchain/service_grpc.pb.go @@ -19,14 +19,14 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - WalletService_Keygen_FullMethodName = "/nockchain.public.v1.WalletService/Keygen" - WalletService_ImportKeys_FullMethodName = "/nockchain.public.v1.WalletService/ImportKeys" - WalletService_DeriveChild_FullMethodName = "/nockchain.public.v1.WalletService/DeriveChild" - WalletService_CreateTx_FullMethodName = "/nockchain.public.v1.WalletService/CreateTx" - WalletService_Scan_FullMethodName = "/nockchain.public.v1.WalletService/Scan" - WalletService_WalletGetBalance_FullMethodName = "/nockchain.public.v1.WalletService/WalletGetBalance" - WalletService_WalletSendTransaction_FullMethodName = "/nockchain.public.v1.WalletService/WalletSendTransaction" - WalletService_TransactionAccepted_FullMethodName = "/nockchain.public.v1.WalletService/TransactionAccepted" + WalletService_Keygen_FullMethodName = "/nockchain.public.v2.WalletService/Keygen" + WalletService_ImportKeys_FullMethodName = "/nockchain.public.v2.WalletService/ImportKeys" + WalletService_DeriveChild_FullMethodName = "/nockchain.public.v2.WalletService/DeriveChild" + WalletService_CreateTx_FullMethodName = "/nockchain.public.v2.WalletService/CreateTx" + WalletService_Scan_FullMethodName = "/nockchain.public.v2.WalletService/Scan" + WalletService_WalletGetBalance_FullMethodName = "/nockchain.public.v2.WalletService/WalletGetBalance" + WalletService_WalletSendTransaction_FullMethodName = "/nockchain.public.v2.WalletService/WalletSendTransaction" + WalletService_TransactionAccepted_FullMethodName = "/nockchain.public.v2.WalletService/TransactionAccepted" ) // WalletServiceClient is the client API for WalletService service. @@ -348,7 +348,7 @@ func _WalletService_TransactionAccepted_Handler(srv interface{}, ctx context.Con // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var WalletService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "nockchain.public.v1.WalletService", + ServiceName: "nockchain.public.v2.WalletService", HandlerType: (*WalletServiceServer)(nil), Methods: []grpc.MethodDesc{ { diff --git a/nockchain/types.pb.go b/nockchain/types.pb.go index 3581f1a..bef06d2 100644 --- a/nockchain/types.pb.go +++ b/nockchain/types.pb.go @@ -128,7 +128,7 @@ func (Version) EnumDescriptor() ([]byte, []int) { type ScanData struct { state protoimpl.MessageState `protogen:"open.v1"` Pubkey string `protobuf:"bytes,1,opt,name=pubkey,proto3" json:"pubkey,omitempty"` - Data *WalletBalanceData `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` + Data *Balance `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -170,7 +170,7 @@ func (x *ScanData) GetPubkey() string { return "" } -func (x *ScanData) GetData() *WalletBalanceData { +func (x *ScanData) GetData() *Balance { if x != nil { return x.Data } @@ -328,9 +328,8 @@ func (x *Timelock) GetValue() uint64 { type RawTx struct { state protoimpl.MessageState `protogen:"open.v1"` TxId string `protobuf:"bytes,1,opt,name=tx_id,json=txId,proto3" json:"tx_id,omitempty"` - Inputs []*NockchainInput `protobuf:"bytes,2,rep,name=inputs,proto3" json:"inputs,omitempty"` - TimelockRange *TimelockRange `protobuf:"bytes,3,opt,name=timelock_range,json=timelockRange,proto3" json:"timelock_range,omitempty"` - TotalFees uint64 `protobuf:"varint,4,opt,name=total_fees,json=totalFees,proto3" json:"total_fees,omitempty"` + Version Version `protobuf:"varint,2,opt,name=version,proto3,enum=nockchain.public.v2.Version" json:"version,omitempty"` + NamedSpends []*NockchainNamedSpend `protobuf:"bytes,3,rep,name=named_spends,json=namedSpends,proto3" json:"named_spends,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -372,50 +371,46 @@ func (x *RawTx) GetTxId() string { return "" } -func (x *RawTx) GetInputs() []*NockchainInput { +func (x *RawTx) GetVersion() Version { if x != nil { - return x.Inputs + return x.Version + } + return Version_V0 +} + +func (x *RawTx) GetNamedSpends() []*NockchainNamedSpend { + if x != nil { + return x.NamedSpends } return nil } -func (x *RawTx) GetTimelockRange() *TimelockRange { - if x != nil { - return x.TimelockRange - } - return nil -} - -func (x *RawTx) GetTotalFees() uint64 { - if x != nil { - return x.TotalFees - } - return 0 -} - -type NockchainSpend struct { - 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"` +type NockchainNamedSpend struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name *NockchainName `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Types that are valid to be assigned to SpendKind: + // + // *NockchainNamedSpend_Legacy + // *NockchainNamedSpend_Witness + SpendKind isNockchainNamedSpend_SpendKind `protobuf_oneof:"spend_kind"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *NockchainSpend) Reset() { - *x = NockchainSpend{} +func (x *NockchainNamedSpend) Reset() { + *x = NockchainNamedSpend{} mi := &file_types_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *NockchainSpend) String() string { +func (x *NockchainNamedSpend) String() string { return protoimpl.X.MessageStringOf(x) } -func (*NockchainSpend) ProtoMessage() {} +func (*NockchainNamedSpend) ProtoMessage() {} -func (x *NockchainSpend) ProtoReflect() protoreflect.Message { +func (x *NockchainNamedSpend) ProtoReflect() protoreflect.Message { mi := &file_types_proto_msgTypes[5] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -427,48 +422,169 @@ func (x *NockchainSpend) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use NockchainSpend.ProtoReflect.Descriptor instead. -func (*NockchainSpend) Descriptor() ([]byte, []int) { +// Deprecated: Use NockchainNamedSpend.ProtoReflect.Descriptor instead. +func (*NockchainNamedSpend) Descriptor() ([]byte, []int) { return file_types_proto_rawDescGZIP(), []int{5} } -func (x *NockchainSpend) GetSignatures() []*NockchainSignature { +func (x *NockchainNamedSpend) GetName() *NockchainName { + if x != nil { + return x.Name + } + return nil +} + +func (x *NockchainNamedSpend) GetSpendKind() isNockchainNamedSpend_SpendKind { + if x != nil { + return x.SpendKind + } + return nil +} + +func (x *NockchainNamedSpend) GetLegacy() *NockchainSpendV0 { + if x != nil { + if x, ok := x.SpendKind.(*NockchainNamedSpend_Legacy); ok { + return x.Legacy + } + } + return nil +} + +func (x *NockchainNamedSpend) GetWitness() *NockchainSpendV1 { + if x != nil { + if x, ok := x.SpendKind.(*NockchainNamedSpend_Witness); ok { + return x.Witness + } + } + return nil +} + +type isNockchainNamedSpend_SpendKind interface { + isNockchainNamedSpend_SpendKind() +} + +type NockchainNamedSpend_Legacy struct { + Legacy *NockchainSpendV0 `protobuf:"bytes,2,opt,name=legacy,proto3,oneof"` +} + +type NockchainNamedSpend_Witness struct { + Witness *NockchainSpendV1 `protobuf:"bytes,3,opt,name=witness,proto3,oneof"` +} + +func (*NockchainNamedSpend_Legacy) isNockchainNamedSpend_SpendKind() {} + +func (*NockchainNamedSpend_Witness) isNockchainNamedSpend_SpendKind() {} + +type NockchainSpendV0 struct { + state protoimpl.MessageState `protogen:"open.v1"` + Signatures []*NockchainSignature `protobuf:"bytes,1,rep,name=signatures,proto3" json:"signatures,omitempty"` + Seeds []*NockchainSeedV0 `protobuf:"bytes,2,rep,name=seeds,proto3" json:"seeds,omitempty"` + Fee uint64 `protobuf:"varint,3,opt,name=fee,proto3" json:"fee,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NockchainSpendV0) Reset() { + *x = NockchainSpendV0{} + mi := &file_types_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NockchainSpendV0) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NockchainSpendV0) ProtoMessage() {} + +func (x *NockchainSpendV0) ProtoReflect() protoreflect.Message { + mi := &file_types_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NockchainSpendV0.ProtoReflect.Descriptor instead. +func (*NockchainSpendV0) Descriptor() ([]byte, []int) { + return file_types_proto_rawDescGZIP(), []int{6} +} + +func (x *NockchainSpendV0) GetSignatures() []*NockchainSignature { if x != nil { return x.Signatures } return nil } -func (x *NockchainSpend) GetSeeds() []*NockchainSeed { +func (x *NockchainSpendV0) GetSeeds() []*NockchainSeedV0 { if x != nil { return x.Seeds } return nil } -func (x *NockchainSpend) GetFee() uint64 { +func (x *NockchainSpendV0) GetFee() uint64 { if x != nil { return x.Fee } return 0 } -type NockchainNote struct { +type NockchainSpendV1 struct { state protoimpl.MessageState `protogen:"open.v1"` - Version Version `protobuf:"varint,1,opt,name=version,proto3,enum=nockchain.public.v1.Version" json:"version,omitempty"` - BlockHeight uint64 `protobuf:"varint,2,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` - Timelock *TimelockIntent `protobuf:"bytes,3,opt,name=timelock,proto3,oneof" json:"timelock,omitempty"` - Name *NockchainName `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` - Lock *NockchainLock `protobuf:"bytes,5,opt,name=lock,proto3" json:"lock,omitempty"` - Source *NockchainSource `protobuf:"bytes,6,opt,name=source,proto3" json:"source,omitempty"` - Asset uint64 `protobuf:"varint,7,opt,name=asset,proto3" json:"asset,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NockchainSpendV1) Reset() { + *x = NockchainSpendV1{} + mi := &file_types_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NockchainSpendV1) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NockchainSpendV1) ProtoMessage() {} + +func (x *NockchainSpendV1) ProtoReflect() protoreflect.Message { + mi := &file_types_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NockchainSpendV1.ProtoReflect.Descriptor instead. +func (*NockchainSpendV1) Descriptor() ([]byte, []int) { + return file_types_proto_rawDescGZIP(), []int{7} +} + +type NockchainNote struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Note: + // + // *NockchainNote_V0 + // *NockchainNote_V1 + Note isNockchainNote_Note `protobuf_oneof:"note"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *NockchainNote) Reset() { *x = NockchainNote{} - mi := &file_types_proto_msgTypes[6] + mi := &file_types_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -480,7 +596,7 @@ func (x *NockchainNote) String() string { func (*NockchainNote) ProtoMessage() {} func (x *NockchainNote) ProtoReflect() protoreflect.Message { - mi := &file_types_proto_msgTypes[6] + mi := &file_types_proto_msgTypes[8] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -493,58 +609,170 @@ func (x *NockchainNote) ProtoReflect() protoreflect.Message { // Deprecated: Use NockchainNote.ProtoReflect.Descriptor instead. func (*NockchainNote) Descriptor() ([]byte, []int) { - return file_types_proto_rawDescGZIP(), []int{6} + return file_types_proto_rawDescGZIP(), []int{8} } -func (x *NockchainNote) GetVersion() Version { +func (x *NockchainNote) GetNote() isNockchainNote_Note { + if x != nil { + return x.Note + } + return nil +} + +func (x *NockchainNote) GetV0() *NockchainNoteV0 { + if x != nil { + if x, ok := x.Note.(*NockchainNote_V0); ok { + return x.V0 + } + } + return nil +} + +func (x *NockchainNote) GetV1() *NockchainNoteV1 { + if x != nil { + if x, ok := x.Note.(*NockchainNote_V1); ok { + return x.V1 + } + } + return nil +} + +type isNockchainNote_Note interface { + isNockchainNote_Note() +} + +type NockchainNote_V0 struct { + V0 *NockchainNoteV0 `protobuf:"bytes,1,opt,name=v0,proto3,oneof"` +} + +type NockchainNote_V1 struct { + V1 *NockchainNoteV1 `protobuf:"bytes,2,opt,name=v1,proto3,oneof"` +} + +func (*NockchainNote_V0) isNockchainNote_Note() {} + +func (*NockchainNote_V1) isNockchainNote_Note() {} + +type NockchainNoteV0 struct { + state protoimpl.MessageState `protogen:"open.v1"` + Version Version `protobuf:"varint,1,opt,name=version,proto3,enum=nockchain.public.v2.Version" json:"version,omitempty"` + OriginPage uint64 `protobuf:"varint,2,opt,name=origin_page,json=originPage,proto3" json:"origin_page,omitempty"` + Name *NockchainName `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + Lock *NockchainLock `protobuf:"bytes,5,opt,name=lock,proto3" json:"lock,omitempty"` + Source *NockchainSource `protobuf:"bytes,6,opt,name=source,proto3" json:"source,omitempty"` + Asset uint64 `protobuf:"varint,7,opt,name=asset,proto3" json:"asset,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NockchainNoteV0) Reset() { + *x = NockchainNoteV0{} + mi := &file_types_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NockchainNoteV0) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NockchainNoteV0) ProtoMessage() {} + +func (x *NockchainNoteV0) ProtoReflect() protoreflect.Message { + mi := &file_types_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NockchainNoteV0.ProtoReflect.Descriptor instead. +func (*NockchainNoteV0) Descriptor() ([]byte, []int) { + return file_types_proto_rawDescGZIP(), []int{9} +} + +func (x *NockchainNoteV0) GetVersion() Version { if x != nil { return x.Version } return Version_V0 } -func (x *NockchainNote) GetBlockHeight() uint64 { +func (x *NockchainNoteV0) GetOriginPage() uint64 { if x != nil { - return x.BlockHeight + return x.OriginPage } return 0 } -func (x *NockchainNote) GetTimelock() *TimelockIntent { - if x != nil { - return x.Timelock - } - return nil -} - -func (x *NockchainNote) GetName() *NockchainName { +func (x *NockchainNoteV0) GetName() *NockchainName { if x != nil { return x.Name } return nil } -func (x *NockchainNote) GetLock() *NockchainLock { +func (x *NockchainNoteV0) GetLock() *NockchainLock { if x != nil { return x.Lock } return nil } -func (x *NockchainNote) GetSource() *NockchainSource { +func (x *NockchainNoteV0) GetSource() *NockchainSource { if x != nil { return x.Source } return nil } -func (x *NockchainNote) GetAsset() uint64 { +func (x *NockchainNoteV0) GetAsset() uint64 { if x != nil { return x.Asset } return 0 } +type NockchainNoteV1 struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NockchainNoteV1) Reset() { + *x = NockchainNoteV1{} + mi := &file_types_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NockchainNoteV1) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NockchainNoteV1) ProtoMessage() {} + +func (x *NockchainNoteV1) ProtoReflect() protoreflect.Message { + mi := &file_types_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NockchainNoteV1.ProtoReflect.Descriptor instead. +func (*NockchainNoteV1) Descriptor() ([]byte, []int) { + return file_types_proto_rawDescGZIP(), []int{10} +} + type NockchainName struct { state protoimpl.MessageState `protogen:"open.v1"` First string `protobuf:"bytes,1,opt,name=first,proto3" json:"first,omitempty"` @@ -555,7 +783,7 @@ type NockchainName struct { func (x *NockchainName) Reset() { *x = NockchainName{} - mi := &file_types_proto_msgTypes[7] + mi := &file_types_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -567,7 +795,7 @@ func (x *NockchainName) String() string { func (*NockchainName) ProtoMessage() {} func (x *NockchainName) ProtoReflect() protoreflect.Message { - mi := &file_types_proto_msgTypes[7] + mi := &file_types_proto_msgTypes[11] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -580,7 +808,7 @@ func (x *NockchainName) ProtoReflect() protoreflect.Message { // Deprecated: Use NockchainName.ProtoReflect.Descriptor instead. func (*NockchainName) Descriptor() ([]byte, []int) { - return file_types_proto_rawDescGZIP(), []int{7} + return file_types_proto_rawDescGZIP(), []int{11} } func (x *NockchainName) GetFirst() string { @@ -597,66 +825,6 @@ func (x *NockchainName) GetLast() string { return "" } -type NockchainInput struct { - state protoimpl.MessageState `protogen:"open.v1"` - Name *NockchainName `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Note *NockchainNote `protobuf:"bytes,2,opt,name=note,proto3" json:"note,omitempty"` - Spend *NockchainSpend `protobuf:"bytes,3,opt,name=spend,proto3" json:"spend,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *NockchainInput) Reset() { - *x = NockchainInput{} - mi := &file_types_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *NockchainInput) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NockchainInput) ProtoMessage() {} - -func (x *NockchainInput) ProtoReflect() protoreflect.Message { - mi := &file_types_proto_msgTypes[8] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NockchainInput.ProtoReflect.Descriptor instead. -func (*NockchainInput) Descriptor() ([]byte, []int) { - return file_types_proto_rawDescGZIP(), []int{8} -} - -func (x *NockchainInput) GetName() *NockchainName { - if x != nil { - return x.Name - } - return nil -} - -func (x *NockchainInput) GetNote() *NockchainNote { - if x != nil { - return x.Note - } - return nil -} - -func (x *NockchainInput) GetSpend() *NockchainSpend { - if x != nil { - return x.Spend - } - return nil -} - type NockchainSignature struct { state protoimpl.MessageState `protogen:"open.v1"` Pubkey string `protobuf:"bytes,1,opt,name=pubkey,proto3" json:"pubkey,omitempty"` @@ -668,7 +836,7 @@ type NockchainSignature struct { func (x *NockchainSignature) Reset() { *x = NockchainSignature{} - mi := &file_types_proto_msgTypes[9] + mi := &file_types_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -680,7 +848,7 @@ func (x *NockchainSignature) String() string { func (*NockchainSignature) ProtoMessage() {} func (x *NockchainSignature) ProtoReflect() protoreflect.Message { - mi := &file_types_proto_msgTypes[9] + mi := &file_types_proto_msgTypes[12] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -693,7 +861,7 @@ func (x *NockchainSignature) ProtoReflect() protoreflect.Message { // Deprecated: Use NockchainSignature.ProtoReflect.Descriptor instead. func (*NockchainSignature) Descriptor() ([]byte, []int) { - return file_types_proto_rawDescGZIP(), []int{9} + return file_types_proto_rawDescGZIP(), []int{12} } func (x *NockchainSignature) GetPubkey() string { @@ -717,32 +885,32 @@ func (x *NockchainSignature) GetSig() []uint64 { return nil } -type NockchainSeed struct { - state protoimpl.MessageState `protogen:"open.v1"` - OutputSource *NockchainSource `protobuf:"bytes,1,opt,name=output_source,json=outputSource,proto3,oneof" json:"output_source,omitempty"` - Recipient *NockchainLock `protobuf:"bytes,2,opt,name=recipient,proto3" json:"recipient,omitempty"` - TimelockIntent *TimelockIntent `protobuf:"bytes,3,opt,name=timelock_intent,json=timelockIntent,proto3,oneof" json:"timelock_intent,omitempty"` - Gift uint64 `protobuf:"varint,4,opt,name=gift,proto3" json:"gift,omitempty"` - ParentHash string `protobuf:"bytes,5,opt,name=parent_hash,json=parentHash,proto3" json:"parent_hash,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache +type NockchainSeedV0 struct { + state protoimpl.MessageState `protogen:"open.v1"` + OutputSource *NockchainSource `protobuf:"bytes,1,opt,name=output_source,json=outputSource,proto3,oneof" json:"output_source,omitempty"` + LockRoot string `protobuf:"bytes,2,opt,name=lock_root,json=lockRoot,proto3" json:"lock_root,omitempty"` + NoteData *NockchainLock `protobuf:"bytes,3,opt,name=note_data,json=noteData,proto3" json:"note_data,omitempty"` + Gift uint64 `protobuf:"varint,4,opt,name=gift,proto3" json:"gift,omitempty"` + ParentHash string `protobuf:"bytes,5,opt,name=parent_hash,json=parentHash,proto3" json:"parent_hash,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (x *NockchainSeed) Reset() { - *x = NockchainSeed{} - mi := &file_types_proto_msgTypes[10] +func (x *NockchainSeedV0) Reset() { + *x = NockchainSeedV0{} + mi := &file_types_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *NockchainSeed) String() string { +func (x *NockchainSeedV0) String() string { return protoimpl.X.MessageStringOf(x) } -func (*NockchainSeed) ProtoMessage() {} +func (*NockchainSeedV0) ProtoMessage() {} -func (x *NockchainSeed) ProtoReflect() protoreflect.Message { - mi := &file_types_proto_msgTypes[10] +func (x *NockchainSeedV0) ProtoReflect() protoreflect.Message { + mi := &file_types_proto_msgTypes[13] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -753,40 +921,40 @@ func (x *NockchainSeed) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use NockchainSeed.ProtoReflect.Descriptor instead. -func (*NockchainSeed) Descriptor() ([]byte, []int) { - return file_types_proto_rawDescGZIP(), []int{10} +// Deprecated: Use NockchainSeedV0.ProtoReflect.Descriptor instead. +func (*NockchainSeedV0) Descriptor() ([]byte, []int) { + return file_types_proto_rawDescGZIP(), []int{13} } -func (x *NockchainSeed) GetOutputSource() *NockchainSource { +func (x *NockchainSeedV0) GetOutputSource() *NockchainSource { if x != nil { return x.OutputSource } return nil } -func (x *NockchainSeed) GetRecipient() *NockchainLock { +func (x *NockchainSeedV0) GetLockRoot() string { if x != nil { - return x.Recipient + return x.LockRoot + } + return "" +} + +func (x *NockchainSeedV0) GetNoteData() *NockchainLock { + if x != nil { + return x.NoteData } return nil } -func (x *NockchainSeed) GetTimelockIntent() *TimelockIntent { - if x != nil { - return x.TimelockIntent - } - return nil -} - -func (x *NockchainSeed) GetGift() uint64 { +func (x *NockchainSeedV0) GetGift() uint64 { if x != nil { return x.Gift } return 0 } -func (x *NockchainSeed) GetParentHash() string { +func (x *NockchainSeedV0) GetParentHash() string { if x != nil { return x.ParentHash } @@ -803,7 +971,7 @@ type NockchainLock struct { func (x *NockchainLock) Reset() { *x = NockchainLock{} - mi := &file_types_proto_msgTypes[11] + mi := &file_types_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -815,7 +983,7 @@ func (x *NockchainLock) String() string { func (*NockchainLock) ProtoMessage() {} func (x *NockchainLock) ProtoReflect() protoreflect.Message { - mi := &file_types_proto_msgTypes[11] + mi := &file_types_proto_msgTypes[14] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -828,7 +996,7 @@ func (x *NockchainLock) ProtoReflect() protoreflect.Message { // Deprecated: Use NockchainLock.ProtoReflect.Descriptor instead. func (*NockchainLock) Descriptor() ([]byte, []int) { - return file_types_proto_rawDescGZIP(), []int{11} + return file_types_proto_rawDescGZIP(), []int{14} } func (x *NockchainLock) GetKeysRequired() uint64 { @@ -855,7 +1023,7 @@ type NockchainSource struct { func (x *NockchainSource) Reset() { *x = NockchainSource{} - mi := &file_types_proto_msgTypes[12] + mi := &file_types_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -867,7 +1035,7 @@ func (x *NockchainSource) String() string { func (*NockchainSource) ProtoMessage() {} func (x *NockchainSource) ProtoReflect() protoreflect.Message { - mi := &file_types_proto_msgTypes[12] + mi := &file_types_proto_msgTypes[15] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -880,7 +1048,7 @@ func (x *NockchainSource) ProtoReflect() protoreflect.Message { // Deprecated: Use NockchainSource.ProtoReflect.Descriptor instead. func (*NockchainSource) Descriptor() ([]byte, []int) { - return file_types_proto_rawDescGZIP(), []int{12} + return file_types_proto_rawDescGZIP(), []int{15} } func (x *NockchainSource) GetSource() string { @@ -901,63 +1069,67 @@ var File_types_proto protoreflect.FileDescriptor const file_types_proto_rawDesc = "" + "\n" + - "\vtypes.proto\x12\x13nockchain.public.v1\x1a\x10blockchain.proto\"^\n" + + "\vtypes.proto\x12\x13nockchain.public.v2\x1a\x10blockchain.proto\"T\n" + "\bScanData\x12\x16\n" + - "\x06pubkey\x18\x01 \x01(\tR\x06pubkey\x12:\n" + - "\x04data\x18\x02 \x01(\v2&.nockchain.public.v1.WalletBalanceDataR\x04data\"\xb4\x01\n" + + "\x06pubkey\x18\x01 \x01(\tR\x06pubkey\x120\n" + + "\x04data\x18\x02 \x01(\v2\x1c.nockchain.public.v2.BalanceR\x04data\"\xb4\x01\n" + "\x0eTimelockIntent\x12C\n" + - "\babsolute\x18\x01 \x01(\v2\".nockchain.public.v1.TimelockRangeH\x00R\babsolute\x88\x01\x01\x12C\n" + - "\brelative\x18\x02 \x01(\v2\".nockchain.public.v1.TimelockRangeH\x01R\brelative\x88\x01\x01B\v\n" + + "\babsolute\x18\x01 \x01(\v2\".nockchain.public.v2.TimelockRangeH\x00R\babsolute\x88\x01\x01\x12C\n" + + "\brelative\x18\x02 \x01(\v2\".nockchain.public.v2.TimelockRangeH\x01R\brelative\x88\x01\x01B\v\n" + "\t_absoluteB\v\n" + "\t_relative\"\x8b\x01\n" + "\rTimelockRange\x124\n" + - "\x03min\x18\x01 \x01(\v2\x1d.nockchain.public.v1.TimelockH\x00R\x03min\x88\x01\x01\x124\n" + - "\x03max\x18\x02 \x01(\v2\x1d.nockchain.public.v1.TimelockH\x01R\x03max\x88\x01\x01B\x06\n" + + "\x03min\x18\x01 \x01(\v2\x1d.nockchain.public.v2.TimelockH\x00R\x03min\x88\x01\x01\x124\n" + + "\x03max\x18\x02 \x01(\v2\x1d.nockchain.public.v2.TimelockH\x01R\x03max\x88\x01\x01B\x06\n" + "\x04_minB\x06\n" + "\x04_max\" \n" + "\bTimelock\x12\x14\n" + - "\x05value\x18\x01 \x01(\x04R\x05value\"\xc3\x01\n" + + "\x05value\x18\x01 \x01(\x04R\x05value\"\xa1\x01\n" + "\x05RawTx\x12\x13\n" + - "\x05tx_id\x18\x01 \x01(\tR\x04txId\x12;\n" + - "\x06inputs\x18\x02 \x03(\v2#.nockchain.public.v1.NockchainInputR\x06inputs\x12I\n" + - "\x0etimelock_range\x18\x03 \x01(\v2\".nockchain.public.v1.TimelockRangeR\rtimelockRange\x12\x1d\n" + + "\x05tx_id\x18\x01 \x01(\tR\x04txId\x126\n" + + "\aversion\x18\x02 \x01(\x0e2\x1c.nockchain.public.v2.VersionR\aversion\x12K\n" + + "\fnamed_spends\x18\x03 \x03(\v2(.nockchain.public.v2.NockchainNamedSpendR\vnamedSpends\"\xdf\x01\n" + + "\x13NockchainNamedSpend\x126\n" + + "\x04name\x18\x01 \x01(\v2\".nockchain.public.v2.NockchainNameR\x04name\x12?\n" + + "\x06legacy\x18\x02 \x01(\v2%.nockchain.public.v2.NockchainSpendV0H\x00R\x06legacy\x12A\n" + + "\awitness\x18\x03 \x01(\v2%.nockchain.public.v2.NockchainSpendV1H\x00R\awitnessB\f\n" + "\n" + - "total_fees\x18\x04 \x01(\x04R\ttotalFees\"\xa5\x01\n" + - "\x0eNockchainSpend\x12G\n" + + "spend_kind\"\xa9\x01\n" + + "\x10NockchainSpendV0\x12G\n" + "\n" + - "signatures\x18\x01 \x03(\v2'.nockchain.public.v1.NockchainSignatureR\n" + - "signatures\x128\n" + - "\x05seeds\x18\x02 \x03(\v2\".nockchain.public.v1.NockchainSeedR\x05seeds\x12\x10\n" + - "\x03fee\x18\x03 \x01(\x04R\x03fee\"\x81\x03\n" + + "signatures\x18\x01 \x03(\v2'.nockchain.public.v2.NockchainSignatureR\n" + + "signatures\x12:\n" + + "\x05seeds\x18\x02 \x03(\v2$.nockchain.public.v2.NockchainSeedV0R\x05seeds\x12\x10\n" + + "\x03fee\x18\x03 \x01(\x04R\x03fee\"\x12\n" + + "\x10NockchainSpendV1\"\x87\x01\n" + "\rNockchainNote\x126\n" + - "\aversion\x18\x01 \x01(\x0e2\x1c.nockchain.public.v1.VersionR\aversion\x12!\n" + - "\fblock_height\x18\x02 \x01(\x04R\vblockHeight\x12D\n" + - "\btimelock\x18\x03 \x01(\v2#.nockchain.public.v1.TimelockIntentH\x00R\btimelock\x88\x01\x01\x126\n" + - "\x04name\x18\x04 \x01(\v2\".nockchain.public.v1.NockchainNameR\x04name\x126\n" + - "\x04lock\x18\x05 \x01(\v2\".nockchain.public.v1.NockchainLockR\x04lock\x12<\n" + - "\x06source\x18\x06 \x01(\v2$.nockchain.public.v1.NockchainSourceR\x06source\x12\x14\n" + - "\x05asset\x18\a \x01(\x04R\x05assetB\v\n" + - "\t_timelock\"9\n" + + "\x02v0\x18\x01 \x01(\v2$.nockchain.public.v2.NockchainNoteV0H\x00R\x02v0\x126\n" + + "\x02v1\x18\x02 \x01(\v2$.nockchain.public.v2.NockchainNoteV1H\x00R\x02v1B\x06\n" + + "\x04note\"\xae\x02\n" + + "\x0fNockchainNoteV0\x126\n" + + "\aversion\x18\x01 \x01(\x0e2\x1c.nockchain.public.v2.VersionR\aversion\x12\x1f\n" + + "\vorigin_page\x18\x02 \x01(\x04R\n" + + "originPage\x126\n" + + "\x04name\x18\x03 \x01(\v2\".nockchain.public.v2.NockchainNameR\x04name\x126\n" + + "\x04lock\x18\x05 \x01(\v2\".nockchain.public.v2.NockchainLockR\x04lock\x12<\n" + + "\x06source\x18\x06 \x01(\v2$.nockchain.public.v2.NockchainSourceR\x06source\x12\x14\n" + + "\x05asset\x18\a \x01(\x04R\x05asset\"\x11\n" + + "\x0fNockchainNoteV1\"9\n" + "\rNockchainName\x12\x14\n" + "\x05first\x18\x01 \x01(\tR\x05first\x12\x12\n" + - "\x04last\x18\x02 \x01(\tR\x04last\"\xbb\x01\n" + - "\x0eNockchainInput\x126\n" + - "\x04name\x18\x01 \x01(\v2\".nockchain.public.v1.NockchainNameR\x04name\x126\n" + - "\x04note\x18\x02 \x01(\v2\".nockchain.public.v1.NockchainNoteR\x04note\x129\n" + - "\x05spend\x18\x03 \x01(\v2#.nockchain.public.v1.NockchainSpendR\x05spend\"R\n" + + "\x04last\x18\x02 \x01(\tR\x04last\"R\n" + "\x12NockchainSignature\x12\x16\n" + "\x06pubkey\x18\x01 \x01(\tR\x06pubkey\x12\x12\n" + "\x04chal\x18\x02 \x03(\x04R\x04chal\x12\x10\n" + - "\x03sig\x18\x03 \x03(\x04R\x03sig\"\xcf\x02\n" + - "\rNockchainSeed\x12N\n" + - "\routput_source\x18\x01 \x01(\v2$.nockchain.public.v1.NockchainSourceH\x00R\foutputSource\x88\x01\x01\x12@\n" + - "\trecipient\x18\x02 \x01(\v2\".nockchain.public.v1.NockchainLockR\trecipient\x12Q\n" + - "\x0ftimelock_intent\x18\x03 \x01(\v2#.nockchain.public.v1.TimelockIntentH\x01R\x0etimelockIntent\x88\x01\x01\x12\x12\n" + + "\x03sig\x18\x03 \x03(\x04R\x03sig\"\x86\x02\n" + + "\x0fNockchainSeedV0\x12N\n" + + "\routput_source\x18\x01 \x01(\v2$.nockchain.public.v2.NockchainSourceH\x00R\foutputSource\x88\x01\x01\x12\x1b\n" + + "\tlock_root\x18\x02 \x01(\tR\blockRoot\x12?\n" + + "\tnote_data\x18\x03 \x01(\v2\".nockchain.public.v2.NockchainLockR\bnoteData\x12\x12\n" + "\x04gift\x18\x04 \x01(\x04R\x04gift\x12\x1f\n" + "\vparent_hash\x18\x05 \x01(\tR\n" + "parentHashB\x10\n" + - "\x0e_output_sourceB\x12\n" + - "\x10_timelock_intent\"N\n" + + "\x0e_output_source\"N\n" + "\rNockchainLock\x12#\n" + "\rkeys_required\x18\x01 \x01(\x04R\fkeysRequired\x12\x18\n" + "\apubkeys\x18\x02 \x03(\tR\apubkeys\"J\n" + @@ -992,46 +1164,49 @@ func file_types_proto_rawDescGZIP() []byte { } var file_types_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_types_proto_msgTypes = make([]protoimpl.MessageInfo, 13) +var file_types_proto_msgTypes = make([]protoimpl.MessageInfo, 16) var file_types_proto_goTypes = []any{ - (ImportType)(0), // 0: nockchain.public.v1.ImportType - (Version)(0), // 1: nockchain.public.v1.Version - (*ScanData)(nil), // 2: nockchain.public.v1.ScanData - (*TimelockIntent)(nil), // 3: nockchain.public.v1.TimelockIntent - (*TimelockRange)(nil), // 4: nockchain.public.v1.TimelockRange - (*Timelock)(nil), // 5: nockchain.public.v1.Timelock - (*RawTx)(nil), // 6: nockchain.public.v1.RawTx - (*NockchainSpend)(nil), // 7: nockchain.public.v1.NockchainSpend - (*NockchainNote)(nil), // 8: nockchain.public.v1.NockchainNote - (*NockchainName)(nil), // 9: nockchain.public.v1.NockchainName - (*NockchainInput)(nil), // 10: nockchain.public.v1.NockchainInput - (*NockchainSignature)(nil), // 11: nockchain.public.v1.NockchainSignature - (*NockchainSeed)(nil), // 12: nockchain.public.v1.NockchainSeed - (*NockchainLock)(nil), // 13: nockchain.public.v1.NockchainLock - (*NockchainSource)(nil), // 14: nockchain.public.v1.NockchainSource - (*WalletBalanceData)(nil), // 15: nockchain.public.v1.WalletBalanceData + (ImportType)(0), // 0: nockchain.public.v2.ImportType + (Version)(0), // 1: nockchain.public.v2.Version + (*ScanData)(nil), // 2: nockchain.public.v2.ScanData + (*TimelockIntent)(nil), // 3: nockchain.public.v2.TimelockIntent + (*TimelockRange)(nil), // 4: nockchain.public.v2.TimelockRange + (*Timelock)(nil), // 5: nockchain.public.v2.Timelock + (*RawTx)(nil), // 6: nockchain.public.v2.RawTx + (*NockchainNamedSpend)(nil), // 7: nockchain.public.v2.NockchainNamedSpend + (*NockchainSpendV0)(nil), // 8: nockchain.public.v2.NockchainSpendV0 + (*NockchainSpendV1)(nil), // 9: nockchain.public.v2.NockchainSpendV1 + (*NockchainNote)(nil), // 10: nockchain.public.v2.NockchainNote + (*NockchainNoteV0)(nil), // 11: nockchain.public.v2.NockchainNoteV0 + (*NockchainNoteV1)(nil), // 12: nockchain.public.v2.NockchainNoteV1 + (*NockchainName)(nil), // 13: nockchain.public.v2.NockchainName + (*NockchainSignature)(nil), // 14: nockchain.public.v2.NockchainSignature + (*NockchainSeedV0)(nil), // 15: nockchain.public.v2.NockchainSeedV0 + (*NockchainLock)(nil), // 16: nockchain.public.v2.NockchainLock + (*NockchainSource)(nil), // 17: nockchain.public.v2.NockchainSource + (*Balance)(nil), // 18: nockchain.public.v2.Balance } var file_types_proto_depIdxs = []int32{ - 15, // 0: nockchain.public.v1.ScanData.data:type_name -> nockchain.public.v1.WalletBalanceData - 4, // 1: nockchain.public.v1.TimelockIntent.absolute:type_name -> nockchain.public.v1.TimelockRange - 4, // 2: nockchain.public.v1.TimelockIntent.relative:type_name -> nockchain.public.v1.TimelockRange - 5, // 3: nockchain.public.v1.TimelockRange.min:type_name -> nockchain.public.v1.Timelock - 5, // 4: nockchain.public.v1.TimelockRange.max:type_name -> nockchain.public.v1.Timelock - 10, // 5: nockchain.public.v1.RawTx.inputs:type_name -> nockchain.public.v1.NockchainInput - 4, // 6: nockchain.public.v1.RawTx.timelock_range:type_name -> nockchain.public.v1.TimelockRange - 11, // 7: nockchain.public.v1.NockchainSpend.signatures:type_name -> nockchain.public.v1.NockchainSignature - 12, // 8: nockchain.public.v1.NockchainSpend.seeds:type_name -> nockchain.public.v1.NockchainSeed - 1, // 9: nockchain.public.v1.NockchainNote.version:type_name -> nockchain.public.v1.Version - 3, // 10: nockchain.public.v1.NockchainNote.timelock:type_name -> nockchain.public.v1.TimelockIntent - 9, // 11: nockchain.public.v1.NockchainNote.name:type_name -> nockchain.public.v1.NockchainName - 13, // 12: nockchain.public.v1.NockchainNote.lock:type_name -> nockchain.public.v1.NockchainLock - 14, // 13: nockchain.public.v1.NockchainNote.source:type_name -> nockchain.public.v1.NockchainSource - 9, // 14: nockchain.public.v1.NockchainInput.name:type_name -> nockchain.public.v1.NockchainName - 8, // 15: nockchain.public.v1.NockchainInput.note:type_name -> nockchain.public.v1.NockchainNote - 7, // 16: nockchain.public.v1.NockchainInput.spend:type_name -> nockchain.public.v1.NockchainSpend - 14, // 17: nockchain.public.v1.NockchainSeed.output_source:type_name -> nockchain.public.v1.NockchainSource - 13, // 18: nockchain.public.v1.NockchainSeed.recipient:type_name -> nockchain.public.v1.NockchainLock - 3, // 19: nockchain.public.v1.NockchainSeed.timelock_intent:type_name -> nockchain.public.v1.TimelockIntent + 18, // 0: nockchain.public.v2.ScanData.data:type_name -> nockchain.public.v2.Balance + 4, // 1: nockchain.public.v2.TimelockIntent.absolute:type_name -> nockchain.public.v2.TimelockRange + 4, // 2: nockchain.public.v2.TimelockIntent.relative:type_name -> nockchain.public.v2.TimelockRange + 5, // 3: nockchain.public.v2.TimelockRange.min:type_name -> nockchain.public.v2.Timelock + 5, // 4: nockchain.public.v2.TimelockRange.max:type_name -> nockchain.public.v2.Timelock + 1, // 5: nockchain.public.v2.RawTx.version:type_name -> nockchain.public.v2.Version + 7, // 6: nockchain.public.v2.RawTx.named_spends:type_name -> nockchain.public.v2.NockchainNamedSpend + 13, // 7: nockchain.public.v2.NockchainNamedSpend.name:type_name -> nockchain.public.v2.NockchainName + 8, // 8: nockchain.public.v2.NockchainNamedSpend.legacy:type_name -> nockchain.public.v2.NockchainSpendV0 + 9, // 9: nockchain.public.v2.NockchainNamedSpend.witness:type_name -> nockchain.public.v2.NockchainSpendV1 + 14, // 10: nockchain.public.v2.NockchainSpendV0.signatures:type_name -> nockchain.public.v2.NockchainSignature + 15, // 11: nockchain.public.v2.NockchainSpendV0.seeds:type_name -> nockchain.public.v2.NockchainSeedV0 + 11, // 12: nockchain.public.v2.NockchainNote.v0:type_name -> nockchain.public.v2.NockchainNoteV0 + 12, // 13: nockchain.public.v2.NockchainNote.v1:type_name -> nockchain.public.v2.NockchainNoteV1 + 1, // 14: nockchain.public.v2.NockchainNoteV0.version:type_name -> nockchain.public.v2.Version + 13, // 15: nockchain.public.v2.NockchainNoteV0.name:type_name -> nockchain.public.v2.NockchainName + 16, // 16: nockchain.public.v2.NockchainNoteV0.lock:type_name -> nockchain.public.v2.NockchainLock + 17, // 17: nockchain.public.v2.NockchainNoteV0.source:type_name -> nockchain.public.v2.NockchainSource + 17, // 18: nockchain.public.v2.NockchainSeedV0.output_source:type_name -> nockchain.public.v2.NockchainSource + 16, // 19: nockchain.public.v2.NockchainSeedV0.note_data:type_name -> nockchain.public.v2.NockchainLock 20, // [20:20] is the sub-list for method output_type 20, // [20:20] is the sub-list for method input_type 20, // [20:20] is the sub-list for extension type_name @@ -1047,15 +1222,22 @@ func file_types_proto_init() { file_blockchain_proto_init() file_types_proto_msgTypes[1].OneofWrappers = []any{} file_types_proto_msgTypes[2].OneofWrappers = []any{} - file_types_proto_msgTypes[6].OneofWrappers = []any{} - file_types_proto_msgTypes[10].OneofWrappers = []any{} + file_types_proto_msgTypes[5].OneofWrappers = []any{ + (*NockchainNamedSpend_Legacy)(nil), + (*NockchainNamedSpend_Witness)(nil), + } + file_types_proto_msgTypes[8].OneofWrappers = []any{ + (*NockchainNote_V0)(nil), + (*NockchainNote_V1)(nil), + } + file_types_proto_msgTypes[13].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_types_proto_rawDesc), len(file_types_proto_rawDesc)), NumEnums: 2, - NumMessages: 13, + NumMessages: 16, NumExtensions: 0, NumServices: 0, }, diff --git a/proto/blockchain.proto b/proto/blockchain.proto index f6a847d..d82cc4d 100644 --- a/proto/blockchain.proto +++ b/proto/blockchain.proto @@ -1,24 +1,17 @@ -// nockchain/common/v1/blockchain.proto +// nockchain/common/v2/blockchain.proto syntax = "proto3"; -package nockchain.public.v1; +package nockchain.public.v2; import "primitives.proto"; import "pagination.proto"; option go_package = "./;nockchain"; -message WalletBalanceData { - // Page of full UTXO entries for the requested wallet. Entries are ordered - // by (Name.first, Name.last) to support consistent pagination. - repeated BalanceEntry notes = 1; // note name -> amount - // Snapshot metadata where this page was computed. Clients should include - // the returned page token to continue paging against the same snapshot. - BlockHeight height = 2; // block height where balance was computed - optional Hash block_id = 3; // block where balance was computed - - // Pagination cursor for fetching the next page in a paginated view. - // When empty, there are no further results for this snapshot. +message Balance { + repeated BalanceEntry notes = 1; + BlockHeight height = 2; + optional Hash block_id = 3; PageResponse page = 4; } @@ -27,39 +20,107 @@ message BalanceEntry { Note note = 2; } -// the string key is the name of the input -// message RawTransaction { map inputs = 1; } message RawTransaction { - repeated NamedInput named_inputs = 1; - TimeLockRangeAbsolute timelock_range = 2; - Nicks total_fees = 3; - Hash id = 4; + NoteVersion version = 1; + Hash id = 2; + repeated SpendEntry spends = 3; } - -message NamedInput { +message SpendEntry { Name name = 1; - Input input = 2; -} - -message Input { - Note note = 1; Spend spend = 2; } message Spend { + oneof spend_kind { + LegacySpend legacy = 1; + WitnessSpend witness = 2; + } +} + +message LegacySpend { Signature signature = 1; repeated Seed seeds = 2; Nicks miner_fee_nicks = 3; } +message WitnessSpend { + Witness witness = 1; + repeated Seed seeds = 2; + Nicks fee = 3; +} + message Seed { - optional OutputSource output_source = 1; - Lock recipient = 2; - optional TimeLockIntent timelock_intent = 3; + // Absent when the seed originates from a coinbase output. + Source output_source = 1; + Hash lock_root = 2; + NoteData note_data = 3; Nicks gift = 4; Hash parent_hash = 5; } +message Witness { + LockMerkleProof lock_merkle_proof = 1; + PkhSignature pkh_signature = 2; + repeated HaxPreimage hax = 3; + //uint64 tim = 4; // reserved field, currently 0 +} + + +message HaxPreimage { + Hash hash = 1; + bytes value = 2; // jammed noun bytes +} + +message PkhSignature { + repeated PkhSignatureEntry entries = 1; +} + +message PkhSignatureEntry { + Hash hash = 1; + SchnorrPubkey pubkey = 2; + SchnorrSignature signature = 3; +} + +message LockMerkleProof { + SpendCondition spend_condition = 1; + uint64 axis = 2; + MerkleProof proof = 3; +} + +message SpendCondition { + repeated LockPrimitive primitives = 1; +} + +message LockPrimitive { + oneof primitive { + PkhLock pkh = 1; + LockTim tim = 2; + HaxLock hax = 3; + BurnLock burn = 4; + } +} + +message PkhLock { + uint64 m = 1; + repeated Hash hashes = 2; +} + +message LockTim { + TimeLockRangeRelative rel = 1; + TimeLockRangeAbsolute abs = 2; +} + +message HaxLock { + repeated Hash hashes = 1; +} + +message BurnLock {} + +message MerkleProof { + Hash root = 1; + repeated Hash path = 2; +} + message OutputSource { optional Source source = 1; } message Source { @@ -110,7 +171,14 @@ message Name { Hash last = 2; } + message Note { + oneof note_version { + NoteV0 legacy = 1; + NoteV1 v1 = 2; + } +} +message NoteV0 { BlockHeight origin_page = 1; // page-number when added to balance optional TimeLockIntent timelock = 2; // enforced timelock Name name = 3; // nname (human/name label) @@ -120,11 +188,27 @@ message Note { NoteVersion version = 7; // note version (currently 0) } +message NoteV1 { + NoteVersion version = 1; + BlockHeight origin_page = 2; + Name name = 3; + NoteData note_data = 4; + Nicks assets = 5; +} + +message NoteData { + repeated NoteDataEntry entries = 1; +} + +message NoteDataEntry { + string key = 1; + bytes blob = 2; // jammed noun bytes +} + message Signature { repeated SignatureEntry entries = 1; } message SignatureEntry { - SchnorrPubkey schnorr_pubkey = - 1; // serialized pubkey corresponding to the signer + SchnorrPubkey schnorr_pubkey = 1; // serialized pubkey corresponding to the signer SchnorrSignature signature = 2; } diff --git a/proto/nockchain.proto b/proto/nockchain.proto index 06ed392..caacbb4 100644 --- a/proto/nockchain.proto +++ b/proto/nockchain.proto @@ -2,7 +2,7 @@ syntax = "proto3"; -package nockchain.public.v1; +package nockchain.public.v2; import "blockchain.proto"; import "primitives.proto"; @@ -21,12 +21,15 @@ service NockchainService { message WalletGetBalanceRequest { // pubkey cheetah point; specific address, or current wallet - string address = 1; + oneof selector { + Base58Pubkey address = 1; + Base58Hash first_name = 2; + } // Pagination parameters. The server enforces limits and may return fewer // entries than requested to respect message size and policy. For consistent // paging across a stable snapshot, pass along the returned page_token from // the previous response without modification. - PageRequest page = 2; + PageRequest page = 3; } message WalletGetBalanceResponse { @@ -35,7 +38,7 @@ message WalletGetBalanceResponse { // Continue paging using `balance.page.next_page_token` until empty. Clients // should treat the page token as opaque; it may encode snapshot identity // and the last returned key. - WalletBalanceData balance = 1; + Balance balance = 1; ErrorStatus error = 2; } } diff --git a/proto/pagination.proto b/proto/pagination.proto index 0cb78e7..fbae3fd 100644 --- a/proto/pagination.proto +++ b/proto/pagination.proto @@ -2,7 +2,7 @@ syntax = "proto3"; -package nockchain.public.v1; +package nockchain.public.v2; option go_package = "./;nockchain"; // Generic pagination parameters for list-style RPCs. diff --git a/proto/primitives.proto b/proto/primitives.proto index ececfe7..27de31b 100644 --- a/proto/primitives.proto +++ b/proto/primitives.proto @@ -2,7 +2,7 @@ syntax = "proto3"; -package nockchain.public.v1; +package nockchain.public.v2; option go_package = "./;nockchain"; message ErrorStatus { @@ -63,6 +63,10 @@ message Base58Hash { string hash = 1; } +message Base58Pubkey { + string key = 1; +} + // pub struct SchnorrPubkey(pub CheetahPoint); message SchnorrPubkey { CheetahPoint value = 1; } diff --git a/proto/service.proto b/proto/service.proto index e5839d6..7c42f3d 100644 --- a/proto/service.proto +++ b/proto/service.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -package nockchain.public.v1; +package nockchain.public.v2; option go_package = "./;nockchain"; @@ -68,15 +68,13 @@ message DeriveChildResponse { message CreateTxRequest { string names = 1; string recipients = 2; - string gifts = 3; - uint64 fee = 4; - bool is_master_key = 5; - string key = 6; - string chain_code = 7; - uint64 index = 8; - bool hardened = 9; - uint64 version = 10; - TimelockIntent timelock_intent = 11; + uint64 fee = 3; + bool is_master_key = 4; + string seed = 5; + uint64 index = 6; + bool hardened = 7; + uint64 version = 8; + string refund_address = 9; } message CreateTxResponse { @@ -100,6 +98,7 @@ message ScanRequest { uint64 search_depth = 3; bool include_timelocks = 4; bool include_multisig = 5; + uint64 version = 6; } message ScanResponse { @@ -107,11 +106,14 @@ message ScanResponse { } message GetBalanceRequest { - string address = 1; + oneof selector { + string address = 1; + string first_name = 2; + } } message GetBalanceResponse { - WalletBalanceData data = 1; + Balance data = 1; } message SendTransactionRequest { diff --git a/proto/types.proto b/proto/types.proto index da7abf6..23f00aa 100644 --- a/proto/types.proto +++ b/proto/types.proto @@ -1,12 +1,12 @@ syntax = "proto3"; -package nockchain.public.v1; +package nockchain.public.v2; option go_package = "./;nockchain"; import "blockchain.proto"; message ScanData { string pubkey = 1; - WalletBalanceData data = 2; + Balance data = 2; } enum ImportType { UNDEFINED = 0; @@ -31,51 +31,65 @@ message Timelock { } message RawTx { - string tx_id = 1; - repeated NockchainInput inputs = 2; - TimelockRange timelock_range = 3; - uint64 total_fees = 4; + string tx_id = 1; + Version version = 2; + repeated NockchainNamedSpend named_spends = 3; } -message NockchainSpend { +message NockchainNamedSpend { + NockchainName name = 1; + oneof spend_kind { + NockchainSpendV0 legacy = 2; + NockchainSpendV1 witness = 3; + } +} + +message NockchainSpendV0 { repeated NockchainSignature signatures = 1; - repeated NockchainSeed seeds = 2; + repeated NockchainSeedV0 seeds = 2; uint64 fee = 3; } + +message NockchainSpendV1 { +} + message NockchainNote { + oneof note { + NockchainNoteV0 v0 = 1; + NockchainNoteV1 v1 = 2; + } +} +message NockchainNoteV0 { Version version = 1; - uint64 block_height = 2; - optional TimelockIntent timelock = 3; - NockchainName name = 4; + uint64 origin_page = 2; + NockchainName name = 3; NockchainLock lock = 5; NockchainSource source = 6; uint64 asset =7; } +message NockchainNoteV1 { +} + message NockchainName { string first = 1; string last = 2; } -message NockchainInput { - NockchainName name = 1; - NockchainNote note = 2; - NockchainSpend spend = 3; -} - message NockchainSignature { string pubkey = 1; repeated uint64 chal = 2; repeated uint64 sig = 3; } -message NockchainSeed { +message NockchainSeedV0 { optional NockchainSource output_source = 1; - NockchainLock recipient = 2; - optional TimelockIntent timelock_intent = 3; + string lock_root = 2; + NockchainLock note_data = 3; uint64 gift = 4; string parent_hash = 5; } + message NockchainLock { uint64 keys_required = 1; repeated string pubkeys = 2; diff --git a/wallet/nockchain_service.go b/wallet/nockchain_service.go index f4e4fd4..ba242f1 100644 --- a/wallet/nockchain_service.go +++ b/wallet/nockchain_service.go @@ -41,26 +41,44 @@ func (nc *NockchainClient) Close() error { return nc.conn.Close() } -func (nc *NockchainClient) WalletGetBalance(address string) (*nockchain.WalletBalanceData, error) { +func (nc *NockchainClient) WalletGetBalance(req *nockchain.GetBalanceRequest) (*nockchain.Balance, error) { pageToken := "" allNotes := []*nockchain.BalanceEntry{} var height *nockchain.BlockHeight var blockId *nockchain.Hash + page := &nockchain.PageRequest{ + ClientPageItemsLimit: 0, + PageToken: pageToken, + MaxBytes: 0, + } for { - req := nockchain.WalletGetBalanceRequest{ - Address: address, - Page: &nockchain.PageRequest{ - ClientPageItemsLimit: 0, - PageToken: pageToken, - MaxBytes: 0, - }, + var request *nockchain.WalletGetBalanceRequest + switch req.Selector.(type) { + case *nockchain.GetBalanceRequest_Address: + request = &nockchain.WalletGetBalanceRequest{ + Selector: &nockchain.WalletGetBalanceRequest_Address{ + Address: &nockchain.Base58Pubkey{ + Key: req.GetAddress(), + }, + }, + Page: page, + } + case *nockchain.GetBalanceRequest_FirstName: + request = &nockchain.WalletGetBalanceRequest{ + Selector: &nockchain.WalletGetBalanceRequest_FirstName{ + FirstName: &nockchain.Base58Hash{ + Hash: req.GetFirstName(), + }, + }, + Page: page, + } } - resp, err := nc.client.WalletGetBalance(context.Background(), &req) + resp, err := nc.client.WalletGetBalance(context.Background(), request) if err != nil { return nil, err } - balance := nockchain.WalletBalanceData{} + balance := nockchain.Balance{} switch resp.Result.(type) { case *nockchain.WalletGetBalanceResponse_Balance: balance = *resp.GetBalance() @@ -84,9 +102,11 @@ func (nc *NockchainClient) WalletGetBalance(address string) (*nockchain.WalletBa break } else { pageToken = balance.Page.NextPageToken + page.PageToken = pageToken } } - return &nockchain.WalletBalanceData{ + + return &nockchain.Balance{ Notes: allNotes, Height: height, BlockId: blockId, @@ -118,24 +138,22 @@ func (nc *NockchainClient) TxAccepted(txId string) (*nockchain.TransactionAccept } func (nc *NockchainClient) WalletSendTransaction(tx *nockchain.RawTx) (*nockchain.WalletSendTransactionResponse, error) { - inputs := []*nockchain.NamedInput{} - for _, i := range tx.Inputs { - input, err := ConvertInput(i) + spends := []*nockchain.SpendEntry{} + for _, namedSpend := range tx.NamedSpends { + spendEntry, err := ConvertNamedSpend(namedSpend) if err != nil { - return nil, fmt.Errorf("error converting input: %v", err) + return nil, err } - inputs = append(inputs, input) + spends = append(spends, spendEntry) } req := nockchain.WalletSendTransactionRequest{ TxId: ParseHash(tx.TxId), RawTx: &nockchain.RawTransaction{ - Id: ParseHash(tx.TxId), - NamedInputs: inputs, - TotalFees: &nockchain.Nicks{Value: tx.TotalFees}, - TimelockRange: &nockchain.TimeLockRangeAbsolute{ - Min: (*nockchain.BlockHeight)(tx.TimelockRange.Min), - Max: (*nockchain.BlockHeight)(tx.TimelockRange.Max), + Id: ParseHash(tx.TxId), + Version: &nockchain.NoteVersion{ + Value: uint32(tx.Version), }, + Spends: spends, }, } diff --git a/wallet/nockhash.go b/wallet/nockhash.go index 6afa06a..85f2bba 100644 --- a/wallet/nockhash.go +++ b/wallet/nockhash.go @@ -40,10 +40,27 @@ func HashSignature(signature *nockchain.NockchainSignature) ([5]uint64, error) { } pkHash := HashPubkey(pkPoint) sigHash = crypto.Tip5RehashTenCell(pkHash, sigHash) - sigHash = crypto.Tip5RehashTenCell(sigHash, crypto.Tip5ZeroZero) - return crypto.Tip5RehashTenCell(crypto.Tip5Zero, sigHash), nil + return crypto.Tip5RehashTenCell(sigHash, crypto.Tip5ZeroZero), nil } +func HashNoteData(lock *nockchain.NockchainLock) [5]uint64 { + keysRequiredHash := crypto.Tip5HashLeaf(lock.KeysRequired) + // TODO: handle multisig + finalHash := crypto.Base58ToTip5Hash(lock.Pubkeys[lock.KeysRequired-1]) + hash := crypto.Tip5RehashTenCell(crypto.Tip5HashLeaf(finalHash[3]), crypto.Tip5HashLeaf(finalHash[4])) + hash = crypto.Tip5RehashTenCell(crypto.Tip5HashLeaf(finalHash[2]), hash) + hash = crypto.Tip5RehashTenCell(crypto.Tip5HashLeaf(finalHash[1]), hash) + hash = crypto.Tip5RehashTenCell(crypto.Tip5HashLeaf(finalHash[0]), hash) + hash = crypto.Tip5RehashTenCell(hash, crypto.Tip5ZeroZero) + + pkh := crypto.Tip5RehashTenCell(keysRequiredHash, hash) + pkhWithPkhTag := crypto.Tip5RehashTenCell(crypto.PkhTagTip5Hash, pkh) + pkhWithPkhTag = crypto.Tip5RehashTenCell(pkhWithPkhTag, crypto.Tip5Zero) + pkhWithPkhTag = crypto.Tip5RehashTenCell(crypto.Tip5Zero, pkhWithPkhTag) + + pkhWithPkhLockTag := crypto.Tip5RehashTenCell(crypto.LockTagTip5Hash, pkhWithPkhTag) + return crypto.Tip5RehashTenCell(pkhWithPkhLockTag, crypto.Tip5ZeroZero) +} func HashOwner(pkPoint crypto.CheetahPoint) [5]uint64 { pkHashedBelts := HashPubkey(pkPoint) pkHashedZeroZero := crypto.Tip5RehashTenCell(pkHashedBelts, crypto.Tip5ZeroZero) @@ -79,15 +96,14 @@ func HashNameVarLen(name *nockchain.NockchainName) [5]uint64 { return res } -func HashNote(note *nockchain.NockchainNote) ([5]uint64, error) { +func HashNoteV0(note *nockchain.NockchainNoteV0) ([5]uint64, error) { versionHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: uint64(note.Version)}}) - blockHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: note.BlockHeight}}) - timelockHash := HashTimelockIntent(note.Timelock) - hashBlockTimeLock := crypto.Tip5RehashTenCell(blockHash, timelockHash) + blockHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: note.OriginPage}}) + hashBlockTimeLock := crypto.Tip5RehashTenCell(blockHash, crypto.Tip5Zero) p := crypto.Tip5RehashTenCell(versionHash, hashBlockTimeLock) nameHash := HashName(note.Name) - lockHash, err := HashLock(note.Lock) + lockHash, err := HashLockV0(note.Lock) if err != nil { return [5]uint64{}, err } @@ -133,7 +149,8 @@ func HashTimelockRange(timelockRange *nockchain.TimelockRange) [5]uint64 { return hash } -func HashLock(lock *nockchain.NockchainLock) ([5]uint64, error) { + +func HashLockV0(lock *nockchain.NockchainLock) ([5]uint64, error) { keysRequiredHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: lock.KeysRequired}}) finalPk := base58.Decode(lock.Pubkeys[lock.KeysRequired-1]) @@ -159,6 +176,23 @@ func HashLock(lock *nockchain.NockchainLock) ([5]uint64, error) { return crypto.Tip5RehashTenCell(keysRequiredHash, finalHash), nil } +func HashLock(lock *nockchain.NockchainLock) [5]uint64 { + keysRequiredHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: lock.KeysRequired}}) + + pkh := crypto.Base58ToTip5Hash(lock.Pubkeys[lock.KeysRequired-1]) + finalHash := crypto.Tip5RehashTenCell(pkh, crypto.Tip5ZeroZero) + if lock.KeysRequired != 1 { + for i := uint64(1); i < lock.KeysRequired; i++ { + pkh := crypto.Base58ToTip5Hash(lock.Pubkeys[lock.KeysRequired-1-i]) + finalHash = crypto.Tip5RehashTenCell(pkh, finalHash) + } + } + + lockHash := crypto.Tip5RehashTenCell(keysRequiredHash, finalHash) + lockHashWithTag := crypto.Tip5RehashTenCell(crypto.PkhTagTip5Hash, lockHash) + return crypto.Tip5RehashTenCell(lockHashWithTag, crypto.Tip5Zero) +} + func HashSource(source *nockchain.NockchainSource) [5]uint64 { if source == nil { return crypto.Tip5Zero @@ -167,43 +201,45 @@ func HashSource(source *nockchain.NockchainSource) [5]uint64 { return crypto.Tip5RehashTenCell(sourceHash, crypto.Tip5One) } -func HashSeedWithoutSource(seed *nockchain.NockchainSeed) ([5]uint64, error) { - lockHash, err := HashLock(seed.Recipient) - if err != nil { - return [5]uint64{}, nil - } - timelockIntentHash := HashTimelockIntent(seed.TimelockIntent) +func HashSeedWithoutSource(seed *nockchain.NockchainSeedV0) [5]uint64 { + lockRoot := crypto.Base58ToTip5Hash(seed.LockRoot) + fmt.Println("lockRoot:", lockRoot) assetHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: seed.Gift}}) parentHash := crypto.Base58ToTip5Hash(seed.ParentHash) + fmt.Println("parentHash:", parentHash) assetHashparentHash := crypto.Tip5RehashTenCell(assetHash, parentHash) - timelockHashAssetParentHash := crypto.Tip5RehashTenCell(timelockIntentHash, assetHashparentHash) + noteDataHash := HashNoteData(seed.NoteData) + fmt.Println("noteDataHash:", noteDataHash) + noteDataHashAssetParentHash := crypto.Tip5RehashTenCell(noteDataHash, assetHashparentHash) - seedHash := crypto.Tip5RehashTenCell(lockHash, timelockHashAssetParentHash) - return seedHash, nil + seedHash := crypto.Tip5RehashTenCell(lockRoot, noteDataHashAssetParentHash) + return seedHash } -func HashSeed(seed *nockchain.NockchainSeed) ([5]uint64, error) { - seedHash, err := HashSeedWithoutSource(seed) - if err != nil { - return [5]uint64{}, nil - } +func HashSeed(seed *nockchain.NockchainSeedV0) [5]uint64 { + seedHash := HashSeedWithoutSource(seed) sourceHash := HashSource(seed.OutputSource) - return crypto.Tip5RehashTenCell(sourceHash, seedHash), nil + return crypto.Tip5RehashTenCell(sourceHash, seedHash) } -func HashSeedVarLen(seed *nockchain.NockchainSeed) ([5]uint64, error) { +func HashSeedVarLen(seed *nockchain.NockchainSeedV0) [5]uint64 { belts := []crypto.Belt{{Value: 0}} - belts = append(belts, crypto.Belt{Value: seed.Recipient.KeysRequired}) - for _, pk := range seed.Recipient.Pubkeys { - pkPoint, err := crypto.CheetaPointFromBytes(base58.Decode(pk)) - if err != nil { - return [5]uint64{}, err - } - belts = append(belts, pkPoint.X[:]...) - belts = append(belts, pkPoint.Y[:]...) + lockRoot := crypto.Base58ToTip5Hash(seed.LockRoot) + for _, i := range lockRoot { + belts = append(belts, crypto.Belt{Value: i}) } - 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) for _, i := range parentHash { belts = append(belts, crypto.Belt{Value: i}) @@ -213,9 +249,12 @@ func HashSeedVarLen(seed *nockchain.NockchainSeed) ([5]uint64, error) { for _, i := range crypto.MagicDyckForSeed { belts = append(belts, crypto.Belt{Value: i}) } - return crypto.Tip5HashBelts(belts), nil + return crypto.Tip5HashBelts(belts) } -func HashNonce(pkPoint crypto.CheetahPoint, message [5]uint64) ([]crypto.Belt, [5]uint64) { + +func HashNonce(pkPoint crypto.CheetahPoint, message [5]uint64, privKey []byte) ([]crypto.Belt, [5]uint64) { + privKeyBigInt := new(big.Int).SetBytes(privKey) + privKeyT8 := crypto.BigIntToT8(*privKeyBigInt) belts := []crypto.Belt{} for _, belt := range pkPoint.X { belts = append(belts, belt) @@ -228,12 +267,18 @@ func HashNonce(pkPoint crypto.CheetahPoint, message [5]uint64) ([]crypto.Belt, [ for _, belt := range message { belts = append(belts, crypto.Belt{Value: belt}) } + resBelts := make([]crypto.Belt, len(belts)) copy(resBelts, belts) + + for _, belt := range privKeyT8 { + belts = append(belts, crypto.Belt{Value: belt}) + } + return resBelts, crypto.Tip5HashBelts(belts) } -func HashSpend(spend *nockchain.NockchainSpend) ([5]uint64, error) { +func HashSpendV0(spend *nockchain.NockchainSpendV0) ([5]uint64, error) { // TODO: handle multiple sig if len(spend.Signatures) == 0 { return [5]uint64{}, fmt.Errorf("signatures can not be empty") @@ -246,20 +291,15 @@ func HashSpend(spend *nockchain.NockchainSpend) ([5]uint64, error) { seedsTree := NewZTree( func(i interface{}) [5]uint64 { - if seed, ok := i.(*nockchain.NockchainSeed); ok { - seedHash, err := HashSeedVarLen(seed) - if err != nil { - return [5]uint64{} - } - return seedHash + if seed, ok := i.(*nockchain.NockchainSeedV0); ok { + return HashSeedVarLen(seed) } else { return [5]uint64{} } }, func(i interface{}) ([5]uint64, error) { - if seed, ok := i.(*nockchain.NockchainSeed); ok { - hash, err := HashSeedWithoutSource(seed) - return hash, err + if seed, ok := i.(*nockchain.NockchainSeedV0); ok { + return HashSeedWithoutSource(seed), nil } else { return [5]uint64{}, fmt.Errorf("invalid input type") } @@ -279,23 +319,18 @@ func HashSpend(spend *nockchain.NockchainSpend) ([5]uint64, error) { } -func HashMsg(spend *nockchain.NockchainSpend) ([5]uint64, error) { +func HashMsg(spend *nockchain.NockchainSpendV0) ([5]uint64, error) { seedsTree := NewZTree( func(i interface{}) [5]uint64 { - if seed, ok := i.(*nockchain.NockchainSeed); ok { - seedHash, err := HashSeedVarLen(seed) - if err != nil { - return [5]uint64{} - } - return seedHash + if seed, ok := i.(*nockchain.NockchainSeedV0); ok { + return HashSeedVarLen(seed) } else { return [5]uint64{} } }, func(i interface{}) ([5]uint64, error) { - if seed, ok := i.(*nockchain.NockchainSeed); ok { - hash, err := HashSeed(seed) - return hash, err + if seed, ok := i.(*nockchain.NockchainSeedV0); ok { + return HashSeed(seed), nil } else { return [5]uint64{}, fmt.Errorf("invalid input type") } @@ -312,56 +347,63 @@ func HashMsg(spend *nockchain.NockchainSpend) ([5]uint64, error) { return crypto.Tip5RehashTenCell(finalSeedHash, feeHash), nil } -func HashInput(input *nockchain.NockchainInput) ([5]uint64, error) { - nameHash := HashName(input.Name) +// func HashInput(input *nockchain.NockchainInput) ([5]uint64, error) { +// nameHash := HashName(input.Name) - noteHash, err := HashNote(input.Note) - if err != nil { - return [5]uint64{}, err +// noteHash, err := HashNote(input.Note) +// if err != nil { +// return [5]uint64{}, err +// } +// spendHash, err := HashSpend(input.Spend) +// if err != nil { +// return [5]uint64{}, err + +// } +// 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) } - 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 { - if name, ok := i.(*nockchain.NockchainName); ok { - return HashNameVarLen(name) - } else { - return [5]uint64{} - } - }, - func(i interface{}) ([5]uint64, error) { - if input, ok := i.(*nockchain.NockchainInput); ok { - hash, err := HashInput(input) - return hash, err - } else { - return [5]uint64{}, fmt.Errorf("invalid input type") - } - }, - ) - for _, input := range inputs { - inputTree.Insert(input.Name, input) - } - inputHash, err := inputTree.Hash() - if err != nil { - return [5]uint64{}, fmt.Errorf("error hashing inputs: %v", err) - } - - timelockHash := HashTimelockRange(timelockRange) - - totalFeesHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: totalFees}}) - - q := crypto.Tip5RehashTenCell(timelockHash, totalFeesHash) - return crypto.Tip5RehashTenCell(inputHash, q), nil + return crypto.Tip5RehashTenCell(crypto.Tip5One, spendHash), nil } func ComputeSig(m crypto.MasterKey, msg [5]uint64) ([8]uint64, [8]uint64, error) { @@ -369,7 +411,7 @@ func ComputeSig(m crypto.MasterKey, msg [5]uint64) ([8]uint64, [8]uint64, error) if err != nil { return [8]uint64{}, [8]uint64{}, err } - belts, nonce := HashNonce(pkPoint, msg) + belts, nonce := HashNonce(pkPoint, msg, m.PrivateKey) nonceBigInt := crypto.TruncGOrder(nonce) scalar := crypto.CheetahScaleBig(crypto.A_GEN, *nonceBigInt) diff --git a/wallet/noun.go b/wallet/noun.go new file mode 100644 index 0000000..b2ddfca --- /dev/null +++ b/wallet/noun.go @@ -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) +} diff --git a/wallet/service.go b/wallet/service.go index 2b3cb64..f8ccab8 100644 --- a/wallet/service.go +++ b/wallet/service.go @@ -1,6 +1,7 @@ package wallet import ( + "cmp" context "context" "crypto/rand" "crypto/sha256" @@ -15,6 +16,13 @@ import ( "github.com/phamminh0811/private-grpc/nockchain" ) +const ( + WitnessWordsCount = 0 + SignatureWordsCount = 31 + SeedWordsCount = 13 + BaseFee = 1 << 15 +) + type GprcHandler struct { nockchain.UnimplementedWalletServiceServer client NockchainClient @@ -360,20 +368,14 @@ func (h *GprcHandler) DeriveChild(ctx context.Context, req *nockchain.DeriveChil // - `names` - Comma-separated list of note name pairs in format "[first last]" // Example: "[first1 last1],[first2 last2]" // -// - `recipients` - Comma-separated list of recipient $locks -// Example: "[1 pk1],[2 pk2,pk3,pk4]" -// A simple comma-separated list is also supported: "pk1,pk2,pk3", -// where it is presumed that all recipients are single-signature, -// that is to say, it is the same as "[1 pk1],[1 pk2],[1 pk3]" -// -// - `gifts` - Comma-separated list of amounts to send to each recipient -// Example: "100,200" +// - `recipients` Comma-separated list of transaction output, formatted as ":,:" // // - `fee` - Transaction fee to be subtracted from one of the input notes func (h *GprcHandler) CreateTx(ctx context.Context, req *nockchain.CreateTxRequest) (*nockchain.CreateTxResponse, error) { nnames := []*nockchain.NockchainName{} names := strings.Split(req.Names, ",") - notes := make([]*nockchain.NockchainNote, len(names)) + notesV0 := make([]*nockchain.NockchainNoteV0, len(names)) + notesV1 := make([]*nockchain.NockchainNoteV1, len(names)) for _, name := range names { name = strings.TrimSpace(name) if strings.HasPrefix(name, "[") && strings.HasSuffix(name, "]") { @@ -414,61 +416,26 @@ func (h *GprcHandler) CreateTx(ctx context.Context, req *nockchain.CreateTxReque } } - recipents := []*nockchain.NockchainLock{} - if strings.Contains(req.Recipients, "[") { - pairs := strings.Split(req.Recipients, ",") - for _, pair := range pairs { - pair = strings.TrimSpace(pair) - - 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)}}) - } + specs := strings.Split(req.Recipients, ",") + if len(specs) == 0 { + return nil, fmt.Errorf("at least one output must be provided") } - gifts := []uint64{} - for _, gift := range strings.Split(req.Gifts, ",") { - gift, err := strconv.ParseUint(gift, 10, 64) - if err != nil { - continue - } - - gifts = append(gifts, gift) + if len(specs) > 1 { + return nil, fmt.Errorf("multiple outputs are not supported yet, provide a single : pair") } - // 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") - } + spec := specs[0] + pairs := strings.Split(spec, ":") + if len(pairs) != 2 { + return nil, fmt.Errorf("%s", "Invalid output spec "+spec+", expected :") } - var masterKey *crypto.MasterKey - chainCode := base58.Decode(req.ChainCode) - key := base58.Decode(req.Key) - masterKey, err := crypto.MasterKeyFromPrivKey(chainCode, key) + 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 { return nil, err } @@ -488,8 +455,32 @@ func (h *GprcHandler) CreateTx(ctx context.Context, req *nockchain.CreateTxReque masterKey = &childKey } + recipent := &nockchain.NockchainLock{ + KeysRequired: 1, + Pubkeys: []string{strings.TrimSpace(pairs[0])}, + } + if req.Version == 0 && req.RefundAddress == "" { + return nil, fmt.Errorf("need to specify a refund address if spending from v0 notes") + } + refundAddr := req.RefundAddress + if refundAddr == "" { + masterPkPoint, err := crypto.CheetaPointFromBytes(masterKey.PublicKey) + if err != nil { + return nil, err + } + pkHash := HashPubkey(masterPkPoint) + refundAddr = crypto.Tip5HashToBase58(pkHash) + } + refundLock := &nockchain.NockchainLock{ + KeysRequired: 1, + Pubkeys: []string{refundAddr}, + } // Scan key to get notes - masterKeyScan, err := h.client.WalletGetBalance(base58.Encode(masterKey.PublicKey)) + masterKeyScan, err := h.client.WalletGetBalance(&nockchain.GetBalanceRequest{ + Selector: &nockchain.GetBalanceRequest_Address{ + Address: base58.Encode(masterKey.PublicKey), + }, + }) if err != nil { return nil, err } @@ -512,115 +503,148 @@ func (h *GprcHandler) CreateTx(ctx context.Context, req *nockchain.CreateTxReque name := "[" + firstName + " " + lastName + "]" if i := slices.Index(names, name); i != -1 { balanceEntry := ParseBalanceEntry(note) - notes[i] = &balanceEntry + switch req.Version { + case 0: + notesV0[i] = balanceEntry.GetV0() + case 1: + notesV1[i] = balanceEntry.GetV1() + } } } } - inputs := make([]*nockchain.NockchainInput, len(names)) - isSpent := false - for i := 0; i < len(nameKeys); i++ { - idx := indices[i] - if notes[idx] == nil { - return nil, fmt.Errorf("notes scanned is missing at name: %s", names[idx]) + giftRemaining := gift + feeRemaining := req.Fee + wordCount := 0 + for i := 0; i < len(names); i++ { + switch req.Version { + case 0: + if notesV0[i] == nil { + return nil, fmt.Errorf("notes scanned is missing at name: %s", names[i]) + } + case 1: + if notesV1[i] == nil { + return nil, fmt.Errorf("notes scanned is missing at name: %s", names[i]) + } + } + } + + 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[idx].Asset < gifts[idx] { - return nil, fmt.Errorf("note %s not enough balance", names[idx]) + feeAvailable := note.Asset - giftPortion + if feeRemaining != 0 { + feePortion = min(feeRemaining, feeAvailable) } - parentHash, err := HashNote(notes[idx]) + if giftPortion == 0 && feePortion == 0 { + continue + } + + giftRemaining = giftRemaining - giftPortion + feeRemaining = feeRemaining - feePortion + + refund := note.Asset - giftPortion - feePortion + if refund == 0 && giftPortion == 0 { + continue + } + + parentHash, err := HashNoteV0(note) if err != nil { return nil, err } - seeds := []*nockchain.NockchainSeed{ - { - OutputSource: nil, - Recipient: recipents[idx], - TimelockIntent: req.TimelockIntent, - Gift: gifts[idx], - ParentHash: crypto.Tip5HashToBase58(parentHash), - }, - } - assetLeft := notes[idx].Asset - gifts[idx] - fee := uint64(0) - if !isSpent && assetLeft >= req.Fee { - isSpent = true - fee = req.Fee - assetLeft -= req.Fee - } - - if assetLeft != 0 { - seeds = append(seeds, &nockchain.NockchainSeed{ - OutputSource: nil, - Recipient: &nockchain.NockchainLock{ - KeysRequired: 1, - Pubkeys: []string{base58.Encode(masterKey.PublicKey)}, + if req.Version == 0 { + lockRoot := HashLock(recipent) + wordCount += SeedWordsCount + seeds := []*nockchain.NockchainSeedV0{ + { + OutputSource: nil, + LockRoot: crypto.Tip5HashToBase58(lockRoot), + NoteData: recipent, + Gift: giftPortion, + ParentHash: crypto.Tip5HashToBase58(parentHash), + }, + } + if refund != 0 { + wordCount += SeedWordsCount + lockRoot := HashLock(refundLock) + seeds = append(seeds, &nockchain.NockchainSeedV0{ + OutputSource: nil, + LockRoot: crypto.Tip5HashToBase58(lockRoot), + NoteData: refundLock, + Gift: refund, + ParentHash: crypto.Tip5HashToBase58(parentHash), + }) + } + + 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), }) } - spend := nockchain.NockchainSpend{ - Signatures: nil, - Seeds: seeds, - Fee: fee, - } - 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[idx], - Note: notes[idx], - Spend: &spend, - } - inputs[idx] = &input } - if !isSpent { - return nil, fmt.Errorf("insufficient funds") + if wordCount*BaseFee > int(req.Fee) { + return nil, fmt.Errorf("min fee not met, this transaction requires at least: %d", wordCount*BaseFee) } - var timelockRange *nockchain.TimelockRange - if req.TimelockIntent == nil { - timelockRange = &nockchain.TimelockRange{ - Min: nil, - Max: nil, - } - } else { - if req.TimelockIntent.Absolute != nil { - timelockRange = req.TimelockIntent.Absolute - } - if req.TimelockIntent.Relative != nil { - timelockRange = req.TimelockIntent.Relative - } - } rawTx := nockchain.RawTx{ - TxId: "", - Inputs: inputs, - TimelockRange: timelockRange, - TotalFees: req.Fee, + TxId: "", + Version: 1, + NamedSpends: spends, } - txId, err := ComputeTxId(inputs, timelockRange, req.Fee) + txId, err := ComputeTxId(spends, req.Version) if err != nil { return nil, err } @@ -640,8 +664,23 @@ func (h *GprcHandler) Scan(ctx context.Context, req *nockchain.ScanRequest) (*no ChainCode: chainCode, PrivateKey: []byte{}, } + address := "" + if req.Version == 0 { + address = base58.Encode(masterKey.PublicKey) + } else { + pkPoint, err := crypto.CheetaPointFromBytes(masterKey.PublicKey) + if err != nil { + return nil, err + } + pkHash := HashPubkey(pkPoint) + address = crypto.Tip5HashToBase58(pkHash) + } - masterKeyScan, err := h.client.WalletGetBalance(req.MasterPubkey) + masterKeyScan, err := h.client.WalletGetBalance(&nockchain.GetBalanceRequest{ + Selector: &nockchain.GetBalanceRequest_Address{ + Address: address, + }, + }) if err != nil { return nil, err } @@ -656,7 +695,24 @@ func (h *GprcHandler) Scan(ctx context.Context, req *nockchain.ScanRequest) (*no if err != nil { continue } - childKeyScan, err := h.client.WalletGetBalance(base58.Encode(childKey.PublicKey)) + + address := "" + if req.Version == 0 { + address = base58.Encode(childKey.PublicKey) + } else { + pkPoint, err := crypto.CheetaPointFromBytes(childKey.PublicKey) + if err != nil { + return nil, err + } + pkHash := HashPubkey(pkPoint) + address = crypto.Tip5HashToBase58(pkHash) + } + + childKeyScan, err := h.client.WalletGetBalance(&nockchain.GetBalanceRequest{ + Selector: &nockchain.GetBalanceRequest_Address{ + Address: address, + }, + }) if err != nil { continue } @@ -674,7 +730,7 @@ func (h *GprcHandler) Scan(ctx context.Context, req *nockchain.ScanRequest) (*no } func (h *GprcHandler) WalletGetBalance(_ context.Context, req *nockchain.GetBalanceRequest) (*nockchain.GetBalanceResponse, error) { - data, err := h.client.WalletGetBalance(req.Address) + data, err := h.client.WalletGetBalance(req) return &nockchain.GetBalanceResponse{ Data: data, }, err diff --git a/wallet/service_test.go b/wallet/service_test.go index 0a6f2b3..13aab26 100644 --- a/wallet/service_test.go +++ b/wallet/service_test.go @@ -417,169 +417,180 @@ func TestImportKey(t *testing.T) { // This test should be run with timeout 120s func TestScan(t *testing.T) { // some random seed we take to get empty notes - seed1 := "foster chicken claw fade income frown junior abandon price lesson mango wrap dry clay loyal camera caught during property useless puppy royal soccer arm" - seed2 := "brass vacuum stairs hurt brisk govern describe enforce fly exact rescue capable belt flavor lottery sauce easy frame orange legal injury border obey novel" + seed1 := "rail nurse smile angle uphold gun kitten spoon quick frozen trigger cable decorate episode blame tray off bag arena taxi approve breeze job letter" masterKey1, err := crypto.MasterKeyFromSeed(seed1) assert.NoError(t, err) - + fmt.Println("pk: ", base58.Encode(masterKey1.PublicKey)) nc, err := wallet.NewNockchainClient("nockchain-api.zorp.io:443") assert.NoError(t, err) - masterKey1Scan, err := nc.WalletGetBalance(base58.Encode(masterKey1.PublicKey)) + masterKey1Scan, err := nc.WalletGetBalance(&nockchain.GetBalanceRequest{ + Selector: &nockchain.GetBalanceRequest_Address{ + Address: base58.Encode(masterKey1.PublicKey), + }, + }) assert.NoError(t, err) - assert.Empty(t, masterKey1Scan.Notes) - - masterKey2, err := crypto.MasterKeyFromSeed(seed2) - assert.NoError(t, err) - - masterKey2Scan, err := nc.WalletGetBalance(base58.Encode(masterKey2.PublicKey)) - assert.NoError(t, err) - assert.Len(t, masterKey2Scan.Notes, 1) - assert.Equal(t, masterKey2Scan.Notes[0].Note.Assets.Value, uint64(100000)) - assert.Equal(t, masterKey2Scan.Notes[0].Note.OriginPage.Value, uint64(35054)) + fmt.Println("masterKey1Scan:", masterKey1Scan) + assert.NotEmpty(t, masterKey1Scan.Notes) } -// This test should be run with timeout 120s -func TestFullFlow(t *testing.T) { - mnemonic1 := "rail nurse smile angle uphold gun kitten spoon quick frozen trigger cable decorate episode blame tray off bag arena taxi approve breeze job letter" - masterKey1, err := crypto.MasterKeyFromSeed(mnemonic1) - assert.NoError(t, err) - - mnemonic2 := "brass vacuum stairs hurt brisk govern describe enforce fly exact rescue capable belt flavor lottery sauce easy frame orange legal injury border obey novel" - masterKey2, err := crypto.MasterKeyFromSeed(mnemonic2) - assert.NoError(t, err) - - inputName := "[4taoqkpysafnp64WBQyzHDKVrqkMeNrdAiVSbWdzZmj7yQYZgQtCq4W 9cjUFbdtaFHeXNWCAKjsTphBchHmCoUU6a1aDbJAFz9qHqeG8osh4wF]" - - nc, err := wallet.NewNockchainClient("nockchain-api.zorp.io:443") - assert.NoError(t, err) - - masterKeyScan, err := nc.WalletGetBalance(base58.Encode(masterKey1.PublicKey)) - assert.NoError(t, err) - - var note *nockchain.NockchainNote - for _, balanceEntry := range masterKeyScan.Notes { - firstName := crypto.Tip5HashToBase58([5]uint64{ - balanceEntry.Name.First.Belt_1.Value, - balanceEntry.Name.First.Belt_2.Value, - balanceEntry.Name.First.Belt_3.Value, - balanceEntry.Name.First.Belt_4.Value, - balanceEntry.Name.First.Belt_5.Value, - }) - 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), +func TestEncodeNoun(t *testing.T) { + lock1 := &nockchain.NockchainLock{ + KeysRequired: 1, + Pubkeys: []string{"5wef35rKxbJDJRAtzGG1VwbMQK9jF3Wr5e6fyMsh2hxnCQZDZJV1YNQ"}, } - gift = note.Asset - gift - 100 - seed2 := &nockchain.NockchainSeed{ - OutputSource: nil, - Recipient: &nockchain.NockchainLock{ - KeysRequired: 1, - Pubkeys: []string{base58.Encode(masterKey1.PublicKey)}, - }, - TimelockIntent: nil, - Gift: gift, - ParentHash: crypto.Tip5HashToBase58(parentHash), - } + lock1Encode := wallet.EncodeNoteData(lock1) + assert.Equal(t, lock1Encode, []byte{89, 192, 131, 91, 67, 199, 5, 16, 32, 24, 199, 52, 39, 171, 121, 6, 15, 240, 167, 243, 69, 34, 254, 110, 4, 78, 3, 8, 44, 245, 128, 176, 69, 72, 150, 253, 6, 232, 167, 34, 133, 115, 154, 56, 106, 106, 192, 175, 176, 88, 89, 160, 208, 117, 55, 78, 5}) - 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, - }) + lock2 := lock1 + lock2.Pubkeys = []string{"7UXNF2HXzEaPUvLDVDgGJyriKqpd2974Kj7U2RnLuBPeRGa7ZezhGmK"} + lock2Encode := wallet.EncodeNoteData(lock2) + assert.Equal(t, lock2Encode, []byte{89, 192, 131, 91, 67, 199, 5, 248, 151, 186, 241, 213, 183, 156, 103, 181, 1, 254, 206, 33, 184, 3, 142, 3, 99, 101, 0, 1, 246, 168, 22, 252, 21, 155, 53, 205, 0, 2, 172, 67, 150, 149, 228, 139, 80, 206, 0, 1, 203, 54, 188, 141, 54, 21, 39, 193, 84}) } +// // 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 func TestCreateTx(t *testing.T) { - seed1 := "brass vacuum stairs hurt brisk govern describe enforce fly exact rescue capable belt flavor lottery sauce easy frame orange legal injury border obey novel" - + seed1 := "rail nurse smile angle uphold gun kitten spoon quick frozen trigger cable decorate episode blame tray off bag arena taxi approve breeze job letter" masterKey1, err := crypto.MasterKeyFromSeed(seed1) assert.NoError(t, err) - fmt.Println("masterKey1: ", base58.Encode(masterKey1.PublicKey)) - // nockchain-wallet create-tx --names '[5bcr83LnCYyHqQh4ExK6metaf1cs7JYDqMYc92Awqhwc6VEpZJL9wj9 AmSjC3SDNtb7ZrUkTXc242BvGeimeL1nAV4CqV63HpLMryhom4L9W59],[5bcr83LnCYyHqQh4ExK6metaf1cs7JYDqMYc92Awqhwc6VEpZJL9wj9 7oo4x3fuwcJ5DrbFY1yf715ctjtE6CqqPagJWT8d687Q6sgMVWc1SXz],[5bcr83LnCYyHqQh4ExK6metaf1cs7JYDqMYc92Awqhwc6VEpZJL9wj9 8BrF9XAKwzvFdy8p7KAB8VEvcswPADhs2WamhWSLUErYN9z8U8cynaA]' --recipients '37Ttw4d6Fq1WGis5qVz8SbeEtpqsbg2ihArBedi4ZeuhFFo8tbCNvwWNq9D8KFBc2qv7uzvPJmKmJg68aEHEh21FiXk9iJCmzyE3NqdSgpsPMCx7Q39yhUUrKkKvGnHUKzMe,37Ttw4d6Fq1WGis5qVz8SbeEtpqsbg2ihArBedi4ZeuhFFo8tbCNvwWNq9D8KFBc2qv7uzvPJmKmJg68aEHEh21FiXk9iJCmzyE3NqdSgpsPMCx7Q39yhUUrKkKvGnHUKzMe,37Ttw4d6Fq1WGis5qVz8SbeEtpqsbg2ihArBedi4ZeuhFFo8tbCNvwWNq9D8KFBc2qv7uzvPJmKmJg68aEHEh21FiXk9iJCmzyE3NqdSgpsPMCx7Q39yhUUrKkKvGnHUKzMe' --gifts '50,50,50' --fee 100 + pkPoint1, err := crypto.CheetaPointFromBytes(masterKey1.PublicKey) + assert.NoError(t, err) + addr1 := wallet.HashPubkey(pkPoint1) + // nockchain-wallet create-tx --names '[4taoqkpysafnp64WBQyzHDKVrqkMeNrdAiVSbWdzZmj7yQYZgQtCq4W 8yd685r3WhvRYsYWFy3LNQqSMMNwWyE3QZe5fqp1jgG3PWtLPvXdYvR]" --fee 1867776 --recipient "5wef35rKxbJDJRAtzGG1VwbMQK9jF3Wr5e6fyMsh2hxnCQZDZJV1YNQ:2000000" --refund-pkh 7UXNF2HXzEaPUvLDVDgGJyriKqpd2974Kj7U2RnLuBPeRGa7ZezhGmK - seed2 := "chimney endorse scan ramp cheap harvest mother ball winter way barrel foil tissue pupil answer worth right undo one chimney element grape image unlock" + seed2 := "anchor various pair jazz panel rubber virus address achieve opinion end silent runway bus wolf pony cigar nuclear moral mixed gold window timber member" masterKey2, err := crypto.MasterKeyFromSeed(seed2) assert.NoError(t, err) fmt.Println("masterKey2", base58.Encode(masterKey2.PublicKey)) @@ -588,27 +599,30 @@ func TestCreateTx(t *testing.T) { assert.NoError(t, err) handler := wallet.NewGprcHandler(*nc) - inputs := "[5bcr83LnCYyHqQh4ExK6metaf1cs7JYDqMYc92Awqhwc6VEpZJL9wj9 AmSjC3SDNtb7ZrUkTXc242BvGeimeL1nAV4CqV63HpLMryhom4L9W59],[5bcr83LnCYyHqQh4ExK6metaf1cs7JYDqMYc92Awqhwc6VEpZJL9wj9 7oo4x3fuwcJ5DrbFY1yf715ctjtE6CqqPagJWT8d687Q6sgMVWc1SXz],[5bcr83LnCYyHqQh4ExK6metaf1cs7JYDqMYc92Awqhwc6VEpZJL9wj9 8BrF9XAKwzvFdy8p7KAB8VEvcswPADhs2WamhWSLUErYN9z8U8cynaA]" - recipients := fmt.Sprintf("%s,%s,%s", base58.Encode(masterKey2.PublicKey), base58.Encode(masterKey2.PublicKey), base58.Encode(masterKey2.PublicKey)) - gifts := "50,50,50" - fee := 100 + inputs := "[4taoqkpysafnp64WBQyzHDKVrqkMeNrdAiVSbWdzZmj7yQYZgQtCq4W 8yd685r3WhvRYsYWFy3LNQqSMMNwWyE3QZe5fqp1jgG3PWtLPvXdYvR]" + + pkPoint2, err := crypto.CheetaPointFromBytes(masterKey2.PublicKey) + assert.NoError(t, err) + addr2 := wallet.HashPubkey(pkPoint2) + + recipients := fmt.Sprintf("%s:2000000", crypto.Tip5HashToBase58(addr2)) + fee := 1867776 // min fee req := &nockchain.CreateTxRequest{ - Names: inputs, - Recipients: recipients, - Gifts: gifts, - Fee: uint64(fee), - IsMasterKey: true, - Key: base58.Encode(masterKey1.PrivateKey), - ChainCode: base58.Encode(masterKey1.ChainCode), - Index: 0, - Hardened: false, - TimelockIntent: nil, + Names: inputs, + Recipients: recipients, + Fee: uint64(fee), + IsMasterKey: true, + Seed: seed1, + Index: 0, + Hardened: false, + Version: 0, + RefundAddress: crypto.Tip5HashToBase58(addr1), } res, err := handler.CreateTx(context.Background(), req) assert.NoError(t, err) // the result is taken from create-tx scripts - assert.Equal(t, res.RawTx.TxId, "A8vSeRde61B4sZccSnNPEnkQgTe15EssoFwyhQXbkhtk4UNm5hyGSid") + assert.Equal(t, res.RawTx.TxId, "6oDgTWnk6sL98yK49hcQTRAfCdFfgKh58U6TDTKmGPirhoxkMii2D6E") } diff --git a/wallet/types.go b/wallet/types.go index 21abf9a..f542f1e 100644 --- a/wallet/types.go +++ b/wallet/types.go @@ -1,188 +1,165 @@ package wallet import ( + "fmt" + "github.com/btcsuite/btcd/btcutil/base58" "github.com/phamminh0811/private-grpc/crypto" "github.com/phamminh0811/private-grpc/nockchain" ) func ParseBalanceEntry(entry *nockchain.BalanceEntry) nockchain.NockchainNote { - version := nockchain.Version(entry.Note.Version.Value) - pubkeys := []string{} - for _, pk := range entry.Note.Lock.SchnorrPubkeys { - pkPoint := crypto.CheetahPoint{ - X: [6]crypto.Belt{ - {Value: pk.Value.X.Belt_1.Value}, - {Value: pk.Value.X.Belt_2.Value}, - {Value: pk.Value.X.Belt_3.Value}, - {Value: pk.Value.X.Belt_4.Value}, - {Value: pk.Value.X.Belt_5.Value}, - {Value: pk.Value.X.Belt_6.Value}, - }, - 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, - } - - 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, + switch entry.Note.NoteVersion.(type) { + case *nockchain.Note_Legacy: + note := entry.Note.GetLegacy() + version := nockchain.Version(note.Version.Value) + pubkeys := []string{} + for _, pk := range note.Lock.SchnorrPubkeys { + pkPoint := crypto.CheetahPoint{ + X: [6]crypto.Belt{ + {Value: pk.Value.X.Belt_1.Value}, + {Value: pk.Value.X.Belt_2.Value}, + {Value: pk.Value.X.Belt_3.Value}, + {Value: pk.Value.X.Belt_4.Value}, + {Value: pk.Value.X.Belt_5.Value}, + {Value: pk.Value.X.Belt_6.Value}, }, + 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{} - for _, sig := range input.Spend.Signatures { - pk, err := ParseSchnorrPubkey(sig.Pubkey) + pkStr := base58.Encode(pkPoint.Bytes()) + pubkeys = append(pubkeys, pkStr) + } + 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 { return nil, err } - sigEntries = append(sigEntries, &nockchain.SignatureEntry{ - SchnorrPubkey: pk, + seeds := []*nockchain.Seed{} + 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{ Chal: ParseEightBelt(sig.Chal), Sig: ParseEightBelt(sig.Sig), }, - }) + } } - return &nockchain.NamedInput{ - Name: ConvertName(input.Name), - Input: &nockchain.Input{ - Note: &nockchain.Note{ - OriginPage: &nockchain.BlockHeight{ - Value: input.Note.BlockHeight, - }, - Timelock: ConvertTimelockIntent(input.Note.Timelock), - Name: ConvertName(input.Name), - Lock: &nockchain.Lock{ - KeysRequired: uint32(input.Note.Lock.KeysRequired), - SchnorrPubkeys: pks, - }, - Source: &nockchain.Source{ - Hash: ParseHash(input.Note.Source.Source), - Coinbase: input.Note.Source.IsCoinbase, - }, - Assets: &nockchain.Nicks{Value: input.Note.Asset}, - Version: &nockchain.NoteVersion{Value: uint32(input.Note.Version)}, - }, - Spend: &nockchain.Spend{ - Signature: &nockchain.Signature{ - Entries: sigEntries, - }, - Seeds: seeds, - MinerFeeNicks: &nockchain.Nicks{Value: input.Spend.Fee}, - }, - }, + return &nockchain.Signature{ + Entries: entries, }, nil }