Skip to content

Commit

Permalink
Merge pull request #75 from BitcoinSchema/sigma
Browse files Browse the repository at this point in the history
Sigma Support
  • Loading branch information
rohenaz authored Nov 10, 2023
2 parents cf36331 + 844be4b commit 51c128f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion bmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/bitcoinschema/go-boost"
"github.com/bitcoinschema/go-bpu"
magic "github.com/bitcoinschema/go-map"
"github.com/bitcoinschema/go-sigma"
"github.com/libsv/go-bt/v2"
)

Expand All @@ -24,6 +25,7 @@ type Tx struct {
MAP []magic.MAP `json:"MAP,omitempty" bson:"MAP,omitempty"`
Run []*run.Jig `json:"Run,omitempty" bson:"Run,omitempty"`
Ord []*ord.Ordinal `json:"Ord,omitempty" bson:"Ord,omitempty"`
Sigma []*sigma.Sig `json:"Sigma,omitempty" bson:"Sigma,omitempty"`
}

// NewFromBob returns a new BmapTx from a BobTx
Expand Down Expand Up @@ -62,7 +64,7 @@ func NewFromRawTxString(tx string) (bmapTx *Tx, err error) {

// FromBob returns a BmapTx from a BobTx
func (t *Tx) FromBob(bobTx *bob.Tx) (err error) {
for _, out := range bobTx.Out {
for vout, out := range bobTx.Out {
for index, tape := range out.Tape {
// Handle string prefixes
if len(tape.Cell) > 0 && tape.Cell[0].S != nil {
Expand Down Expand Up @@ -108,6 +110,10 @@ func (t *Tx) FromBob(bobTx *bob.Tx) (err error) {
}
t.B = append(t.B, bOut)
continue
case sigma.Prefix:
sigOut := sigma.NewSigFromTape(out.Tape[index], vout)
t.Sigma = append(t.Sigma, sigOut)
continue
}
}
// Handle OPCODE prefixes
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ require (
github.com/bitcoinschema/go-boost v0.1.0
github.com/bitcoinschema/go-bpu v0.1.3
github.com/bitcoinschema/go-map v0.1.0
github.com/bitcoinschema/go-sigma v0.0.2
github.com/libsv/go-bt/v2 v2.2.5
)

Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ github.com/bitcoinschema/go-bpu v0.1.3 h1:O7SvuptH4Q7hemD6G9OotPLINZ61CAVOgWKJWK
github.com/bitcoinschema/go-bpu v0.1.3/go.mod h1:y4ZEDC0fSYRrA6N6bzKwHXdtMrRiQhpurpkTVobz07I=
github.com/bitcoinschema/go-map v0.1.0 h1:dM8OJ/E5MnEm9m1xNI/B3msCgSI9s7Ps3Vk0BFP53eI=
github.com/bitcoinschema/go-map v0.1.0/go.mod h1:36YXG/kob/Z+tCK3EpHMdN9+ADMSDMPYA7JFuPOBi3M=
github.com/bitcoinschema/go-sigma v0.0.2 h1:4okeV6JeAm/5CKSdmWzENMVVTGq8ZI/Yx3ogG+AqUVc=
github.com/bitcoinschema/go-sigma v0.0.2/go.mod h1:uq5j6hPNQ/SlR0xjxCm29G/yEid+tbYpnbpYzqHFG/o=
github.com/bitcoinsv/bsvd v0.0.0-20190609155523-4c29707f7173 h1:2yTIV9u7H0BhRDGXH5xrAwAz7XibWJtX2dNezMeNsUo=
github.com/bitcoinsv/bsvd v0.0.0-20190609155523-4c29707f7173/go.mod h1:BZ1UcC9+tmcDEcdVXgpt13hMczwJxWzpAn68wNs7zRA=
github.com/bitcoinsv/bsvlog v0.0.0-20181216181007-cb81b076bf2e h1:6f+gRvaPE/4h0g39dqTNPr9/P4mikw0aB+dhiExaWN8=
Expand Down

0 comments on commit 51c128f

Please sign in to comment.