Skip to content

Commit 51c128f

Browse files
authored
Merge pull request #75 from BitcoinSchema/sigma
Sigma Support
2 parents cf36331 + 844be4b commit 51c128f

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

bmap.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.com/bitcoinschema/go-boost"
1212
"github.com/bitcoinschema/go-bpu"
1313
magic "github.com/bitcoinschema/go-map"
14+
"github.com/bitcoinschema/go-sigma"
1415
"github.com/libsv/go-bt/v2"
1516
)
1617

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

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

6365
// FromBob returns a BmapTx from a BobTx
6466
func (t *Tx) FromBob(bobTx *bob.Tx) (err error) {
65-
for _, out := range bobTx.Out {
67+
for vout, out := range bobTx.Out {
6668
for index, tape := range out.Tape {
6769
// Handle string prefixes
6870
if len(tape.Cell) > 0 && tape.Cell[0].S != nil {
@@ -108,6 +110,10 @@ func (t *Tx) FromBob(bobTx *bob.Tx) (err error) {
108110
}
109111
t.B = append(t.B, bOut)
110112
continue
113+
case sigma.Prefix:
114+
sigOut := sigma.NewSigFromTape(out.Tape[index], vout)
115+
t.Sigma = append(t.Sigma, sigOut)
116+
continue
111117
}
112118
}
113119
// Handle OPCODE prefixes

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ require (
1111
github.com/bitcoinschema/go-boost v0.1.0
1212
github.com/bitcoinschema/go-bpu v0.1.3
1313
github.com/bitcoinschema/go-map v0.1.0
14+
github.com/bitcoinschema/go-sigma v0.0.2
1415
github.com/libsv/go-bt/v2 v2.2.5
1516
)
1617

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ github.com/bitcoinschema/go-bpu v0.1.3 h1:O7SvuptH4Q7hemD6G9OotPLINZ61CAVOgWKJWK
1616
github.com/bitcoinschema/go-bpu v0.1.3/go.mod h1:y4ZEDC0fSYRrA6N6bzKwHXdtMrRiQhpurpkTVobz07I=
1717
github.com/bitcoinschema/go-map v0.1.0 h1:dM8OJ/E5MnEm9m1xNI/B3msCgSI9s7Ps3Vk0BFP53eI=
1818
github.com/bitcoinschema/go-map v0.1.0/go.mod h1:36YXG/kob/Z+tCK3EpHMdN9+ADMSDMPYA7JFuPOBi3M=
19+
github.com/bitcoinschema/go-sigma v0.0.2 h1:4okeV6JeAm/5CKSdmWzENMVVTGq8ZI/Yx3ogG+AqUVc=
20+
github.com/bitcoinschema/go-sigma v0.0.2/go.mod h1:uq5j6hPNQ/SlR0xjxCm29G/yEid+tbYpnbpYzqHFG/o=
1921
github.com/bitcoinsv/bsvd v0.0.0-20190609155523-4c29707f7173 h1:2yTIV9u7H0BhRDGXH5xrAwAz7XibWJtX2dNezMeNsUo=
2022
github.com/bitcoinsv/bsvd v0.0.0-20190609155523-4c29707f7173/go.mod h1:BZ1UcC9+tmcDEcdVXgpt13hMczwJxWzpAn68wNs7zRA=
2123
github.com/bitcoinsv/bsvlog v0.0.0-20181216181007-cb81b076bf2e h1:6f+gRvaPE/4h0g39dqTNPr9/P4mikw0aB+dhiExaWN8=

0 commit comments

Comments
 (0)