Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing erc721 and erc1155 samples reported by Juan. #1247

Merged
merged 2 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading