Skip to content

Commit c7a8100

Browse files
committed
Tep62Nft signature fixes
1 parent 543309b commit c7a8100

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

TonLibDotNet.Demo/Samples/Recipes/NFTs.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,15 @@ public async Task Run(bool inMainnet)
3535

3636
var cd = await TonRecipes.NFTs.GetCollectionData(tonClient, collectionAddress);
3737
logger.LogInformation("GetCollectionData() for NFT Collection {Address}:", collectionAddress);
38-
logger.LogInformation(" Collection nextItemIndex: {Value}", Convert.ToHexString(cd.nextItemIndex));
39-
logger.LogInformation(" Collection content: {Value} bits", cd.collection_content.BitsCount);
38+
logger.LogInformation(" Collection nextItemIndex: {Value}", cd.nextItemIndex);
4039
logger.LogInformation(" Collection owner: {Value}", cd.ownerAddress);
40+
logger.LogInformation("Collectioncontent:\r\n{Value}",cd.collection_content.DumpCells());
41+
4142

4243
var nd = await TonRecipes.NFTs.GetNftData(tonClient, nftAddress);
4344
logger.LogInformation("GetNftData() for NFT Item {Address}:", nftAddress);
4445
logger.LogInformation(" Init?: {Value}", nd.init);
45-
logger.LogInformation(" Index?: {Value}", Convert.ToHexString(nd.index));
46+
logger.LogInformation(" Index?: {Value}", nd.index);
4647
logger.LogInformation(" Collection adr: {Value}", nd.collectionAddress);
4748
logger.LogInformation(" Owner: {Value}", nd.ownerAddress);
4849
logger.LogInformation(" Individual content:\r\n{Value}", nd.individualContent.DumpCells());

TonLibDotNet/Recipes/Tep62Nft.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public partial class Tep62Nft
4444
/// <exception cref="TonLibNonZeroExitCodeException" />
4545
/// <seealso href="https://github.com/ton-blockchain/TEPs/blob/master/text/0062-nft-standard.md#get-methods-1">Get-methods description</seealso>
4646
/// <seealso href="https://github.com/ton-blockchain/token-contract/blob/main/nft/nft-collection.fc#L137">Reference implementation</seealso>
47-
public async Task<(byte[] nextItemIndex, Cells.Cell collection_content, string? ownerAddress)> GetCollectionData(ITonClient tonClient, string collectionAddress)
47+
public async Task<(BigInteger nextItemIndex, Cells.Boc collection_content, string? ownerAddress)> GetCollectionData(ITonClient tonClient, string collectionAddress)
4848
{
4949
await tonClient.InitIfNeeded().ConfigureAwait(false);
5050

@@ -57,8 +57,8 @@ public partial class Tep62Nft
5757

5858
TonLibNonZeroExitCodeException.ThrowIfNonZero(result.ExitCode);
5959

60-
var nextIndex = result.Stack[0].ToBigIntegerBytes();
61-
var content = result.Stack[1].ToBoc().RootCells[0];
60+
var nextIndex = result.Stack[0].ToBigInteger();
61+
var content = result.Stack[1].ToBoc();
6262
var owner = result.Stack[2].ToBoc().RootCells[0].BeginRead().TryLoadAddressIntStd();
6363

6464
return (nextIndex, content, owner);
@@ -74,7 +74,7 @@ public partial class Tep62Nft
7474
/// <exception cref="TonLibNonZeroExitCodeException" />
7575
/// <seealso href="https://github.com/ton-blockchain/TEPs/blob/master/text/0062-nft-standard.md#get-methods-1">Get-methods description</seealso>
7676
/// <seealso href="https://github.com/ton-blockchain/token-contract/blob/main/nft/nft-collection.fc#L143">Reference implementation</seealso>
77-
public async Task<string> GetNftAddressByIndex(ITonClient tonClient, string collectionAddress, byte[] index)
77+
public async Task<string> GetNftAddressByIndex(ITonClient tonClient, string collectionAddress, BigInteger index)
7878
{
7979
ArgumentNullException.ThrowIfNull(index);
8080

@@ -114,7 +114,7 @@ public async Task<string> GetNftAddressByIndex(ITonClient tonClient, string coll
114114
/// <exception cref="TonLibNonZeroExitCodeException" />
115115
/// <seealso href="https://github.com/ton-blockchain/TEPs/blob/master/text/0062-nft-standard.md#get-methods">Get-methods description</seealso>
116116
/// <seealso href="https://github.com/ton-blockchain/token-contract/blob/main/nft/nft-item.fc#L142">Reference implementation</seealso>
117-
public async Task<(bool init, byte[] index, string collectionAddress, string? ownerAddress, Cells.Boc individualContent)> GetNftData(ITonClient tonClient, string nftAddress)
117+
public async Task<(bool init, BigInteger index, string collectionAddress, string? ownerAddress, Cells.Boc individualContent)> GetNftData(ITonClient tonClient, string nftAddress)
118118
{
119119
await tonClient.InitIfNeeded().ConfigureAwait(false);
120120

@@ -128,16 +128,16 @@ public async Task<string> GetNftAddressByIndex(ITonClient tonClient, string coll
128128
TonLibNonZeroExitCodeException.ThrowIfNonZero(result.ExitCode);
129129

130130
var init = result.Stack[0].ToInt() != 0;
131-
var index = result.Stack[1].ToBigIntegerBytes();
131+
var index = result.Stack[1].ToBigInteger();
132132
var collectionAddress = result.Stack[2].ToBoc().RootCells[0].BeginRead().LoadAddressIntStd();
133133
var ownerAddress = result.Stack[3].ToBoc().RootCells[0].BeginRead().LoadAddressIntStd();
134134
var individualContent = result.Stack[4].ToBoc();
135135

136136
return (init, index, collectionAddress, ownerAddress, individualContent);
137137
}
138138

139-
/// <inheritdoc cref="GetNftContent(ITonClient, string, byte[], Cells.Boc)"/>
140-
public Task<Cells.Boc> GetNftContent(ITonClient tonClient, string collectionAddress, byte[] index, Cells.Cell individualContent)
139+
/// <inheritdoc cref="GetNftContent(ITonClient, string, BigInteger, Cells.Boc)"/>
140+
public Task<Cells.Boc> GetNftContent(ITonClient tonClient, string collectionAddress, BigInteger index, Cells.Cell individualContent)
141141
{
142142
return GetNftContent(tonClient, collectionAddress, index, new Cells.Boc(individualContent));
143143
}
@@ -157,7 +157,7 @@ public async Task<string> GetNftAddressByIndex(ITonClient tonClient, string coll
157157
/// <exception cref="TonLibNonZeroExitCodeException" />
158158
/// <seealso href="https://github.com/ton-blockchain/TEPs/blob/master/text/0062-nft-standard.md#get-methods-1">Get-methods description</seealso>
159159
/// <seealso href="https://github.com/ton-blockchain/token-contract/blob/main/nft/nft-collection.fc#L155">Reference implementation</seealso>
160-
public async Task<Cells.Boc> GetNftContent(ITonClient tonClient, string collectionAddress, byte[] index, Cells.Boc individualContent)
160+
public async Task<Cells.Boc> GetNftContent(ITonClient tonClient, string collectionAddress, BigInteger index, Cells.Boc individualContent)
161161
{
162162
ArgumentNullException.ThrowIfNull(index);
163163
ArgumentNullException.ThrowIfNull(individualContent);

0 commit comments

Comments
 (0)