Skip to content

Commit 7f6f44b

Browse files
committed
updated examples
1 parent 0f8851f commit 7f6f44b

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

csharp/IotaWalletNet/IotaWalletNet.Main/Examples/Native Tokens/Mint/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ The following example will:
9494
}
9595
}
9696

97-
string hexEncodedCirculatingSupply = "1000000".ToHexString();
98-
string hexEncodedMaximumSupply = "1500000".ToHexString();
97+
string hexEncodedCirculatingSupply = 1024.ToHexEncodedAmount();
98+
string hexEncodedMaximumSupply = 2056.ToHexEncodedAmount();
9999

100-
NativeTokenIRC30 nativeTokenMetadata = new NativeTokenIRC30(name: "iotanet", symbol:"inet", decimals:6)
100+
NativeTokenIRC30 nativeTokenMetadata = new NativeTokenIRC30(name: "iotanet", symbol: "inet", decimals: 6)
101101
.SetDescription("Just a test coin")
102102
.SetUrl("https://github.com/IOTA-NET/IotaWallet.NET");
103103

csharp/IotaWalletNet/IotaWalletNet.Main/Examples/Native Tokens/Send/README.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Mint Native Tokens
1+
# Send Native Tokens
22

33
## Code Example
44

@@ -10,9 +10,8 @@ The following example will:
1010
4. Check if there exists any NativeTokens with atleast 10 tokens
1111
5. Send NativeTokens
1212

13-
1413
```cs
15-
public class SendNativeTokensExample
14+
public class SendNativeTokensExample
1615
{
1716
public static async Task Run()
1817
{
@@ -57,7 +56,7 @@ The following example will:
5756
return;
5857
}
5958

60-
59+
6160
SyncAccountResponse syncAccountResponse = await account.SyncAccountAsync();
6261
Console.WriteLine($"SyncAccountAsync: {syncAccountResponse}");
6362

@@ -69,15 +68,15 @@ The following example will:
6968
* For this example, we are just getting the first native token available which has atleast 10 tokens,
7069
* since we are intending to send 10 tokens.
7170
* */
72-
NativeTokenBalance? nativeTokenBalance = getBalanceResponse.Payload?.NativeTokens?.First(nativeTokenBalance => int.Parse(nativeTokenBalance.Available.FromHexString()) > 10);
71+
NativeTokenBalance? nativeTokenBalance = getBalanceResponse.Payload?.NativeTokens?.First(nativeTokenBalance => nativeTokenBalance.Available.FromHexEncodedAmountToUInt64() > 10);
7372

7473
if (nativeTokenBalance == null)
7574
{
7675
throw new Exception("No native tokens found that has atleast 10 tokens available...");
7776
}
7877

7978
string tokenId = nativeTokenBalance.TokenId;
80-
string amount = "10".ToHexString();
79+
string amount = 10.ToHexEncodedAmount();
8180

8281
string receiverAddress = "rms1qrcagm98yyj983aan86wvvlgv8g72zspvhv40eynpmdn4ms8rmvrgkfqvfp";
8382
AddressWithNativeTokens addressWithNativeTokens = new AddressWithNativeTokens(new List<string[]> { new string[] { tokenId, amount } }.ToList(), receiverAddress);
@@ -91,5 +90,4 @@ The following example will:
9190
}
9291

9392
}
94-
95-
```
93+
```

csharp/IotaWalletNet/IotaWalletNet.Main/Examples/Native Tokens/Send/SendNativeTokensExample.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@ public static async Task Run()
6969
* For this example, we are just getting the first native token available which has atleast 10 tokens,
7070
* since we are intending to send 10 tokens.
7171
* */
72-
NativeTokenBalance? nativeTokenBalance = getBalanceResponse.Payload?.NativeTokens?.First(nativeTokenBalance => int.Parse(nativeTokenBalance.Available.FromHexString()) > 10);
72+
NativeTokenBalance? nativeTokenBalance = getBalanceResponse.Payload?.NativeTokens?.First(nativeTokenBalance => nativeTokenBalance.Available.FromHexEncodedAmountToUInt64() > 10);
7373

7474
if (nativeTokenBalance == null)
7575
{
7676
throw new Exception("No native tokens found that has atleast 10 tokens available...");
7777
}
7878

7979
string tokenId = nativeTokenBalance.TokenId;
80-
string amount = "10".ToHexString();
80+
string amount = 10.ToHexEncodedAmount();
8181

8282
string receiverAddress = "rms1qrcagm98yyj983aan86wvvlgv8g72zspvhv40eynpmdn4ms8rmvrgkfqvfp";
8383
AddressWithNativeTokens addressWithNativeTokens = new AddressWithNativeTokens(new List<string[]> { new string[] { tokenId, amount } }.ToList(), receiverAddress);

0 commit comments

Comments
 (0)