File tree Expand file tree Collapse file tree 4 files changed +14
-10
lines changed Expand file tree Collapse file tree 4 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ func NewFromRawTxString(tx string) (bmapTx *Tx, err error) {
6464
6565// FromBob returns a BmapTx from a BobTx
6666func (t * Tx ) FromBob (bobTx * bob.Tx ) (err error ) {
67+ aipCount := 0
6768 for vout , out := range bobTx .Out {
6869 for index , tape := range out .Tape {
6970 // Handle string prefixes
@@ -79,7 +80,8 @@ func (t *Tx) FromBob(bobTx *bob.Tx) (err error) {
7980 continue
8081 case aip .Prefix :
8182 aipOut := aip .NewFromTape (tape )
82- aipOut .SetDataFromTapes (out .Tape )
83+ aipOut .SetDataFromTapes (out .Tape , aipCount )
84+ aipCount ++
8385 t .AIP = append (t .AIP , aipOut )
8486 continue
8587 case bap .Prefix :
Original file line number Diff line number Diff line change 11package bmap
22
33import (
4+ "encoding/base64"
45 "testing"
56
67 "github.com/bitcoin-sv/go-sdk/transaction"
@@ -205,19 +206,20 @@ func TestB(t *testing.T) {
205206 mimeType := "text/plain"
206207 encoding := "utf8"
207208 prefix := b .Prefix
209+ encoded := base64 .StdEncoding .EncodeToString ([]byte (helloWorld ))
208210 tape := bpu.Tape {
209211 Cell : []bpu.Cell {
210212 {S : & prefix },
211- {S : & helloWorld },
213+ {B : & encoded },
212214 {S : & mimeType },
213215 {S : & encoding },
214216 },
215217 }
216218 bTx , err := b .NewFromTape (tape )
217219 if err != nil {
218220 t .Fatalf ("error occurred: %s" , err )
219- } else if bTx .Data . UTF8 != "Hello world" {
220- t .Fatalf ("Unexpected data %s %s" , bTx .Data . UTF8 , err )
221+ } else if string ( bTx .Data ) != "Hello world" {
222+ t .Fatalf ("Unexpected data %s %s" , string ( bTx .Data ) , err )
221223 }
222224}
223225
Original file line number Diff line number Diff line change @@ -4,8 +4,8 @@ go 1.23.1
44
55require (
66 github.com/bitcoin-sv/go-sdk v1.1.18
7- github.com/bitcoinschema/go-aip v0.3.1
8- github.com/bitcoinschema/go-b v0.2.1
7+ github.com/bitcoinschema/go-aip v0.3.2
8+ github.com/bitcoinschema/go-b v0.2.2
99 github.com/bitcoinschema/go-bap v0.4.1
1010 github.com/bitcoinschema/go-bob v0.5.1
1111 github.com/bitcoinschema/go-boost v0.2.1
Original file line number Diff line number Diff line change 11github.com/bitcoin-sv/go-sdk v1.1.18 h1:6lMdQGxlLFWysR2O4m8t0FpdEmdvqHIvYjp8+UV8AjI =
22github.com/bitcoin-sv/go-sdk v1.1.18 /go.mod h1:E/gP4wd23aa7clO4vYx+xMNwEs/I3shKv5NdwWgNkx8 =
3- github.com/bitcoinschema/go-aip v0.3.1 h1:VGzygNi9a/dmqPmbmtC5yLMOQONYosvYcUZoM95Q0u4 =
4- github.com/bitcoinschema/go-aip v0.3.1 /go.mod h1:VbMTjZ7oGusPuJZC+OWJnMeulshSq+F4brLJa6PHjMo =
5- github.com/bitcoinschema/go-b v0.2.1 h1:9KuAt7RS0Fb6p4Zjj4mTfHe6UqKIVn2HevXda6Ivsuo =
6- github.com/bitcoinschema/go-b v0.2.1 /go.mod h1:qzXa0Q5+62S/ZnLIidlCWwwpZXLWrs0npqiYincUP5I =
3+ github.com/bitcoinschema/go-aip v0.3.2 h1:bdhTTcVphqHzfHsV1Y6GKl73IASCTwceCXgkM0d62Ns =
4+ github.com/bitcoinschema/go-aip v0.3.2 /go.mod h1:5Q+P1U1G1WiCPu6VqKinmwpFmmBo9sNwskh4mLGbloU =
5+ github.com/bitcoinschema/go-b v0.2.2 h1:wZ0qtOAmj2cvDqxMOZho+VpKcR9V/UMFMkbCd7WH5OE =
6+ github.com/bitcoinschema/go-b v0.2.2 /go.mod h1:qzXa0Q5+62S/ZnLIidlCWwwpZXLWrs0npqiYincUP5I =
77github.com/bitcoinschema/go-bap v0.4.1 h1:t5SwpkW1oCvpn4+7nTp3W57hnaQJrgNxZNRNDMgUC98 =
88github.com/bitcoinschema/go-bap v0.4.1 /go.mod h1:M5DJ8L4nT7VY1VwV2qwaScgYboh4Jmw5Wx22osoNGko =
99github.com/bitcoinschema/go-bob v0.5.1 h1:pvRX16sAkQRRNBu1UpRnrbd/WX9MKwYEh0LRb7/u9FI =
You can’t perform that action at this time.
0 commit comments