Skip to content

Commit

Permalink
Merge pull request #191 from xssnick/dev-v19
Browse files Browse the repository at this point in the history
Fixed raw special cell serialization as ref in ToCell, Dict helpers
  • Loading branch information
xssnick authored May 15, 2024
2 parents 1628740 + 5943977 commit 97fe541
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<img align="right" width="425px" src="https://github.com/xssnick/props/blob/master/logoimg.png?raw=true">

[![Based on TON][ton-svg]][ton]
![Coverage](https://img.shields.io/badge/Coverage-73.8%25-brightgreen)
![Coverage](https://img.shields.io/badge/Coverage-73.7%25-brightgreen)

Golang library for interacting with TON blockchain.

Expand Down
9 changes: 5 additions & 4 deletions example/highload-wallet/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,11 @@ func main() {
messages = append(messages, &wallet.Message{
Mode: 1 + 2, // pay fee separately, ignore action errors
InternalMessage: &tlb.InternalMessage{
Bounce: addr.IsBounceable(),
DstAddr: addr,
Amount: tlb.MustFromTON(amtStr),
Body: comment,
IHRDisabled: true, // disable hyper routing (currently not works in ton)
Bounce: addr.IsBounceable(),
DstAddr: addr,
Amount: tlb.MustFromTON(amtStr),
Body: comment,
},
})
}
Expand Down
8 changes: 8 additions & 0 deletions tlb/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,14 @@ func storeField(settings []string, root *cell.Builder, structField reflect.Struc

asRef := false
if settings[0] == "^" {
if cellType == parseType {
// store cell as ref directly
if err := root.StoreRef(fieldVal.Interface().(*cell.Cell)); err != nil {
return fmt.Errorf("failed to store cell to ref for %s, err: %w", structField.Name, err)
}
return nil
}

asRef = true
settings = settings[1:]
builder = cell.BeginCell()
Expand Down
2 changes: 1 addition & 1 deletion ton/wallet/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func Test_WalletFindTransactionByInMsgHash(t *testing.T) {
}

// wait next block to be sure everything updated
block, err = api.WaitForBlock(block.SeqNo + 2).GetMasterchainInfo(ctx)
block, err = api.WaitForBlock(block.SeqNo + 3).GetMasterchainInfo(ctx)
if err != nil {
t.Fatal("wait master err:", err.Error())
}
Expand Down
11 changes: 11 additions & 0 deletions tvm/cell/dict.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,17 @@ func (c *Slice) LoadDict(keySz uint) (*Dictionary, error) {
return cl.ToDict(keySz)
}

func (d *Dictionary) GetKeySize() uint {
return d.keySz
}

func (d *Dictionary) Copy() *Dictionary {
return &Dictionary{
keySz: d.keySz,
root: d.root,
}
}

func (d *Dictionary) SetIntKey(key *big.Int, value *Cell) error {
return d.Set(BeginCell().MustStoreBigInt(key, d.keySz).EndCell(), value)
}
Expand Down

0 comments on commit 97fe541

Please sign in to comment.