Skip to content

Commit

Permalink
Attached processing fees for HW3 + Fixed Retrier + Deprecated attr fi…
Browse files Browse the repository at this point in the history
…elds for onchain content
  • Loading branch information
xssnick committed Sep 10, 2024
1 parent 0ce0d25 commit 41c6626
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
4 changes: 2 additions & 2 deletions example/nft-info/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func main() {
case *nft.ContentOffchain:
fmt.Println(" content offchain :", content.URI)
case *nft.ContentOnchain:
fmt.Println(" content onchain :", content.Name)
fmt.Println(" content onchain :", content.GetAttribute("name"))
}
fmt.Println(" owner :", collectionData.OwnerAddress.String())
fmt.Println(" minted items num :", collectionData.NextItemIndex)
Expand All @@ -69,7 +69,7 @@ func main() {
fmt.Println(" full content :", nftContent.(*nft.ContentOffchain).URI)
}
case *nft.ContentOnchain:
fmt.Println(" content name :", content.Name)
fmt.Println(" content name :", content.GetAttribute("name"))
}
} else {
fmt.Println(" empty content")
Expand Down
12 changes: 8 additions & 4 deletions ton/nft/content.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@ type ContentOffchain struct {
}

type ContentOnchain struct {
Name string
// Deprecated: use GetAttribute("name")
Name string
// Deprecated: use GetAttribute("description")
Description string
Image string
ImageData []byte
attributes *cell.Dictionary
// Deprecated: use GetAttribute("image")
Image string
// Deprecated: use GetAttributeBinary("image_data")
ImageData []byte
attributes *cell.Dictionary
}

type ContentSemichain struct {
Expand Down
4 changes: 2 additions & 2 deletions ton/retrier.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ type retryClient struct {
}

func (w *retryClient) QueryLiteserver(ctx context.Context, payload tl.Serializable, result tl.Serializable) error {
tries := w.maxRetries
tries := 0
for {
err := w.original.QueryLiteserver(ctx, payload, result)
if w.maxRetries > 0 && tries == w.maxRetries {
if w.maxRetries > 0 && tries >= w.maxRetries {
return err
}
tries++
Expand Down
4 changes: 4 additions & 0 deletions ton/wallet/highloadv3.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ func (s *SpecHighloadV3) packActions(queryId uint64, messages []*Message) (_ *Me
list = cell.BeginCell().MustStoreRef(list).MustStoreBuilder(msg).EndCell()
}

// attach some coins for internal message processing gas fees
fees := new(big.Int).Add(new(big.Int).Mul(tlb.MustFromTON("0.007").Nano(), big.NewInt(int64(len(messages)))), tlb.MustFromTON("0.01").Nano())
amt = new(big.Int).Add(amt, fees)

return &Message{
Mode: PayGasSeparately + IgnoreErrors,
InternalMessage: &tlb.InternalMessage{
Expand Down

0 comments on commit 41c6626

Please sign in to comment.