Ethereum Unity3D Boilerplate Questions

Hey guys!

I’ve been trying out the boilerplate and made this demo project to test its power:

Thanks David for all the great work. There’s a bright future to it!

Cheers!

1 Like

David,

Thank you for letting me know. I looked at your post, the demo is looking good! WebGL is now available as part of the 1.0.2 release. Additionally I should be releasing 1.0.3 in a few days and this will contain Nethereum integration as well as some minor bug fixes.

With your use of the SDK did you encounter any pain points, or anything that did not work as expected?

Please keep us in the loop as you continue to develop your game.

Regards,

David

@vivraan,

How is it going? BTW the fix has been posted to the features/walletconnect_integration branch and will be in the 1.0.3 release.

Thanks,

David

@dgoodrich how big is a Number in the database? Should it be used to store information on wallet balance?

I’m assuming that a Number is essentially the same as in JS, a 64-bit floating point value.

What’s the best way to deal with cryptocurrency balance using Moralis?

1 Like

Hi David,

I’ve been focused on other tasks for some days now but I remember everything was smooth with the SDK.

Today I’m going to update to 1.0.2 to check all the new features/fixes and continue with the process. Also, I need to record a video for the Unity Developer position you guys have available and I will make it about this project. Wish me luck :slight_smile:

Best,

David

2 Likes

You probably already know that a contract stores wei value as a 256bit string. DB cannot handle a number this large and so wei balances are stored in the DB as a string. Of course you cannot do sorting aggregation, etc. on this value as a number.

The Moralis Nitro update provides a way to store the wei as 128bit number (and also capture the whole precision as a 256 bit string). Nitro is still in beta phase but would be worth checking out.

Hope this helps.

BTW, did the fix I sent you earlier help you get past the cloud function validation issue?

Regards,

David

1 Like

Yes the fix did work! This new question is actually what came out due to the validation going through!

Is Moralis Nitro essentially the beta phase for the next stage of improvements which can be accessed starting from the free tier?

Also, I went on Discord and found that the way people were handling string balances was by using Moralis.Units.Token(str, decimals) to convert the string into a BigNumber for use. However, the typescript API marks it as returning a string and not a BigNumber, and somehow even though I have the BigNumber package I’m not able to use new BigNumber(str).

1 Like

Just checked, it looks like the server doesn’t understand what a BigNumber is. Whenever I try to use it with or without importing the type, it throws this error:


  ERROR  || 2022-01-14 05:25:04
Failed running cloud function putWalletWasActiveInInterval for user TMxzXlbYaRxsQ1u3jT0uLXXX with:
  Input: {"signal":true}
  Error: {"message":"Cannot read properties of undefined (reading 'Token')","code":141}
1 Like

The BN library is available through Moralis Web3. Please see this forum question

Regards,

David

1 Like

Somehow it’s not detecting this method!

Could you suggest a relevant thread for my Cloud Code questions?

1 Like

I did not find one that was a good fit so it will best to create a new thread for this.

Regards,

David

New thread for JS SDK issues: Problems with current implementation of Moralis Cloud Code

1 Like

I have followed all the instructions but why when I want to play the demo scene it crashes

Do you mean the Demo scene crashes or Unity3D IDE crashes? Please copy the error that is showing in the log and post it in this thread. The image above does not appear to show the exception.

Thank you,

David

Hey @dgoodrich I received feedback from a dev in the ETHGlobal NFTHack competition on the ResolveAddress API and seems like he gets an error on it:

ApiException: Error calling ResolveAddress: {"code":141,"error":"Invalid function: \"resolveAddress\""}

and his code is like this

Resolve result = MoralisInterface.GetClient().Web3Api.Resolve.ResolveAddress(domain);

Not sure if there’s any problem there or something that he might miss, but if you found something, let me know :raised_hands:

1 Like

@YosephKS,

Can you send me the domain as well? Did the user try this in the admin panel as well?

Thank you,

David

Hey @dgoodrich I am working on a WebGL game. Is it possible to use the web wallets to connect?

1 Like

Hello, you can but it is tricky. The default Wallet Connect / Unity package does not support this so I am working on a custom solution. I am looking at This Project as a solution for us.

Regards,

David

@YosephKS,

Maybe the user needs to update their server?

I ran the example via the Unity SDK:

var result = MoralisInterface.GetClient().Web3Api.Resolve.ResolveAddress("0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045");
Debug.Log($"{result}");

and result was

{
  "name": "vitalik.eth"
}

as expected.

Regards,

David

1 Like

Ohhh I see cool, sorry didn’t saw you message was taking a bit of break. Seems like you already message the user directly as well :raised_hands:

1 Like