Skip to content

Commit

Permalink
Fixing erc721 and erc1155 samples reported by Juan. (#1247)
Browse files Browse the repository at this point in the history
* Fixing erc721 and erc1155 samples reported by Juan.

* Linter fix
  • Loading branch information
kantagara authored Nov 27, 2024
1 parent 1cfb6a6 commit 1152e74
Show file tree
Hide file tree
Showing 24 changed files with 28 additions and 4 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using ChainSafe.Gaming.Evm.Signers;
using ChainSafe.Gaming.Evm.Transactions;
using ChainSafe.Gaming.GUI;
using ChainSafe.Gaming.MultiCall;
using ChainSafe.Gaming.UnityPackage.Connection;
using ChainSafe.Gaming.UnityPackage.UI;
using ChainSafe.Gaming.Web3;
Expand Down
2 changes: 1 addition & 1 deletion src/ChainSafe.Gaming.Reown/ReownProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ async Task<T> MakeRequest<TRequest>(bool sendChainId = true)
return await SignClient.Request<TRequest, T>(
topic,
data,
sendChainId ? BuildChainIdForReown(chainConfig.ChainId) : null);;
sendChainId ? BuildChainIdForReown(chainConfig.ChainId) : null);
}
catch (KeyNotFoundException e)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public async Task<List<OwnerOfBatchModel>> GetOwnerOfBatch(string[] tokenIds)
if (multiCall == null)
{
throw new Web3Exception(
$"Can't execute {nameof(GetOwnerOfBatch)}. No MultiCall component was provided during construction.");
$"Can't execute {nameof(GetOwnerOfBatch)}. No MultiCall component was provided during construction. If you are using Web3Unity component, make sure to add the Multicall service adapter to the same game object.");
}

var calls = tokenIds
Expand Down
7 changes: 7 additions & 0 deletions src/ChainSafe.Gaming/RPC/Contracts/BuiltIn/Erc721Service.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using ChainSafe.Gaming.Evm.Signers;
using ChainSafe.Gaming.Evm.Utils;
using ChainSafe.Gaming.MultiCall;
using ChainSafe.Gaming.Web3.Environment;
using TransactionReceipt = ChainSafe.Gaming.Evm.Transactions.TransactionReceipt;

namespace ChainSafe.Gaming.Evm.Contracts.BuiltIn
Expand Down Expand Up @@ -36,6 +37,12 @@ public Erc721Service(IContractBuilder contractBuilder, ISigner signer)
this.signer = signer;
}

public Erc721Service(IContractBuilder contractBuilder, IMultiCall multiCall)
: this(contractBuilder)
{
this.multiCall = multiCall;
}

public Erc721Service(IContractBuilder contractBuilder, ISigner signer, IMultiCall multiCall)
: this(contractBuilder, signer)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 1573338518}
m_HandleRect: {fileID: 1573338517}
m_Direction: 0
m_Value: 0
m_Value: 1
m_Size: 1
m_NumberOfSteps: 0
m_OnValueChanged:
Expand Down Expand Up @@ -1023,6 +1023,14 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 29625373239180716, guid: 6d183a51c0030794a8ff3fea5dbd6423, type: 3}
propertyPath: initializeOnAwake
value: 1
objectReference: {fileID: 0}
- target: {fileID: 29625373239180716, guid: 6d183a51c0030794a8ff3fea5dbd6423, type: 3}
propertyPath: rememberConnection
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8519303782652390544, guid: 6d183a51c0030794a8ff3fea5dbd6423, type: 3}
propertyPath: m_LocalPosition.x
value: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public class Erc1155Sample : MonoBehaviour, ISample
/// </summary>
public async Task<string> BalanceOf()
{
var balance = await Web3Unity.Web3.Erc1155.GetBalanceOf(ChainSafeContracts.Erc1155, tokenIdBalanceOf);
var balance = await Web3Unity.Web3.Erc1155.GetBalanceOf(ChainSafeContracts.Erc1155, tokenIdBalanceOf, accountBalanceOf);

return balance.ToString();
}
Expand Down

0 comments on commit 1152e74

Please sign in to comment.