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

Marketplace sample calls #962

Merged
merged 16 commits into from
May 21, 2024
Merged

Marketplace sample calls #962

merged 16 commits into from
May 21, 2024

Conversation

sneakzttv
Copy link
Contributor

@sneakzttv sneakzttv commented May 16, 2024

Marketplace write calls are now functional within the sample scene, these functions can easily be added to a GUI to populate it with data as the user wishes.

image

To test:

  • You will need a bearer token from the dashboard login console https://dashboard.gaming.chainsafe.io/ it comes from the login response in the network tab and its member key is access_token, we need a better way to expose this to the user as it's needed for the request header with half of the calls.
  • You will also need to create a 721, 1155 collection with Nfts and a marketplace to see the get calls, you can also do this from the editor if you choose.
  • Insert all the details into the Marketplace Call object and fill it out with contract & id information. Be careful with IDs and contracts, they're two different things.
  • As the contracts are specific to users and have role control, they need to be initialized by the person using them for functions like mint which is why i have left the variables open.
  • Press play and test the marketplace functions in the sample scene.
  • Newly created collections, marketplaces and minted Nfts will show up accordingly in the dashboard.
  • Deleting may be sticky to test as it can only be used after chain interactions are reverted for creating collections/marketplaces.
  • Server settings menu moved up a level in the editor as it's more intuitive there.

@sneakzttv sneakzttv added the ready-to-merge Ready to Merge PR - this'll trigger required checks label May 16, 2024
@sneakzttv sneakzttv removed the ready-to-merge Ready to Merge PR - this'll trigger required checks label May 17, 2024
@sneakzttv
Copy link
Contributor Author

sneakzttv commented May 17, 2024

I want to put the return values into classes and fix webgl, will complete early monday and get juan to double check.

@sneakzttv
Copy link
Contributor Author

sneakzttv commented May 20, 2024

Updating to 2022 to gain better code coverage on this PR within the new system, will include webgl and classes update momentarily before getting Juan to test.

@sneakzttv sneakzttv added ready-to-merge Ready to Merge PR - this'll trigger required checks labels May 20, 2024
Cleanup
Menu update
@sneakzttv
Copy link
Contributor Author

sneakzttv commented May 21, 2024

Fixed, had to make a jslib and thread that into the stack to get it to work on webgl, also closes #959

@sneakzttv sneakzttv added ready-to-merge Ready to Merge PR - this'll trigger required checks and removed ready-to-merge Ready to Merge PR - this'll trigger required checks labels May 21, 2024
Copy link
Contributor

@juans-chainsafe juans-chainsafe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Majority of the samples are working, but some are failing. Here is the current status:

Working

  • GetProjectItems ✅
  • GetMarketplaceItems ✅
  • GetItem ✅
  • GetProjectTokens ✅
  • GetCollectionTokens721 ✅
  • GetCollectionTokens1155
  • GetCollectionToken ✅
  • GetTokenOwners ✅
  • CreateCollection721 ✅
  • CreateCollection1155 ✅
  • CreateMarketplace ✅

Functionality working but I get errors

  • DeleteCollection ✅ ❌
NullReferenceException: Object reference not set to an instance of an object
Scripts.EVM.Remote.CSServer.DeleteData (System.String _bearerToken, System.String _path) (at /Users/juanmanuelspoleti/Desktop/workspace/web3.unity/Packages/io.chainsafe.web3-unity/Runtime/Scripts/EVM/Remote/CSServer.cs:60)
Scripts.EVM.Marketplace.Marketplace.DeleteCollection (System.String _bearerToken, System.String _collectionId) (at /Users/juanmanuelspoleti/Desktop/workspace/web3.unity/Packages/io.chainsafe.web3-unity/Runtime/Scripts/EVM/Marketplace/Marketplace.cs:283)
MarketplaceCalls.DeleteCollection () (at Assets/Samples/web3.unity SDK/2.5.0/Web3.Unity Samples/Scripts/Scenes/SampleMain/Marketplace/MarketplaceCalls.cs:204)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) (at <e307bbb467104258887a104f6151f183>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:153)
UnityEngine.UnitySynchronizationContext.Exec () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:83)
UnityEngine.UnitySynchronizationContext.ExecuteTasks () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:107)

Failing

  • Mint721 ❌
  • Mint 1155 ❌
    Full log for Mint error:
[Web3] [WalletConnect SDK] [JsonRpcProvider] Got payload {"id":439372001364994,"jsonrpc":"2.0","method":"irn_subscription","params":{"id":"13b6432a6b7fd533950b29d25b66ce86af943bc559d989b7e5edb1f2c2e87002","data":{"topic":"7b62869c46b6c9c9b015407e455d6f8583bf7673c3fc40a130a15635a98ce19a","message":"ALH23F3Cf4j/71q2ju8NSdhu4NydT0WI5w6/PKlufQofeuCM7DhpSPtBlZKRfFYKtuxqyJeH00CC6FZ9AWhe9Ov7nvfs05I5dXoSWBnoy6vHhdBtQTf6KV81zrmvQNXOezCnH0+FSdyT95TILnh+nM4SD+2bMCVT7sUWDDFV6HADZ86ARH3yn/d8BsfteLLsNUlVlMkhk+A+cpQ5Z0wxiizPvNz4u27ReR3aKJztevrGmWhkA50vp+b+Zm40","publishedAt":1716296880237,"tag":1109}}}

[Web3] [WalletConnect SDK] [JsonRpcProvider] Payload has ID 439372001364994

[Web3] [WalletConnect SDK] Got generic response for type System.String

[Web3] [WalletConnect SDK] Got response for type System.String
 
WalletConnectException: User disapproved requested chains
WalletConnectSharp.Sign.Engine.Request[T,TR] (System.String topic, T data, System.String chainId, System.Nullable`1[T] expiry) (at <8a03767a7c084e38b9e400624d188dfb>:0)
ChainSafe.Gaming.WalletConnect.WalletConnectProvider.Request[T] (T data, System.Nullable`1[T] expiry) (at <0d45ab63aa8549c4ad1635c4b8a7792b>:0)
ChainSafe.Gaming.WalletConnect.WalletConnectTransactionExecutor.SendTransaction (ChainSafe.Gaming.Evm.Transactions.TransactionRequest transaction) (at <0d45ab63aa8549c4ad1635c4b8a7792b>:0)
ChainSafe.Gaming.Evm.Contracts.Contract.SendWithReceipt (System.String method, System.Object[] parameters, ChainSafe.Gaming.Evm.Transactions.TransactionRequest overwrite) (at <a5a8db86682c403bbecf38c48c360d65>:0)
ChainSafe.Gaming.Evm.Contracts.Contract.Send (System.String method, System.Object[] parameters, ChainSafe.Gaming.Evm.Transactions.TransactionRequest overwrite) (at <a5a8db86682c403bbecf38c48c360d65>:0)
Scripts.EVM.Token.Evm.ContractSend (ChainSafe.Gaming.Web3.Web3 web3, System.String method, System.String abi, System.String contractAddress, System.Object[] args, Nethereum.Hex.HexTypes.HexBigInteger value) (at /Users/juanmanuelspoleti/Desktop/workspace/web3.unity/Packages/io.chainsafe.web3-unity/Runtime/Scripts/EVM/Token/Evm.cs:26)
Scripts.EVM.Marketplace.Marketplace.Mint721CollectionNft (System.String _collectionContract, System.String _uri) (at /Users/juanmanuelspoleti/Desktop/workspace/web3.unity/Packages/io.chainsafe.web3-unity/Runtime/Scripts/EVM/Marketplace/Marketplace.cs:234)
MarketplaceCalls.Mint721CollectionNft () (at Assets/Samples/web3.unity SDK/2.5.0/Web3.Unity Samples/Scripts/Scenes/SampleMain/Marketplace/MarketplaceCalls.cs:184)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) (at <e307bbb467104258887a104f6151f183>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:153)
UnityEngine.UnitySynchronizationContext.Exec () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:83)
UnityEngine.UnitySynchronizationContext.ExecuteTasks () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:107)
  • DeleteMarketplace ❌
    Error deleting: HTTP/1.1 404 Not Found
    But Marketplace exists and is not deployed:
{
    "id": "0d6419b6-ed27-4372-90d3-3ed2d183549a",
    "name": "test delete",
    "description": "",
    "owner": "6dabb083-f75d-482c-8b2b-aad3818ff93b",
    "chain_id": 11155111,
    "banner": "",
    "project_id": "6aa5af5a-cf38-4093-b78a-c1c13b58d0f4",
    "contract_address": "",
    "deployed": false,
    "created_at": 1716296563,
    "updated_at": 1716296563
}
Screenshot 2024-05-21 at 10 26 53 AM

@sneakzttv sneakzttv linked an issue May 21, 2024 that may be closed by this pull request
Copy link
Contributor

@juans-chainsafe juans-chainsafe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issues were fixed!
Mint1155 ✅
WebGL ✅

I didnt find any more issues, awesome work! The only annoying thing is the Bearer token that expires

@sneakzttv sneakzttv added ready-to-merge Ready to Merge PR - this'll trigger required checks and removed ready-to-merge Ready to Merge PR - this'll trigger required checks labels May 21, 2024
@sneakzttv sneakzttv merged commit 6382224 into dev May 21, 2024
5 checks passed
@sneakzttv sneakzttv deleted the Sneakz/marketplace branch May 21, 2024 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge Ready to Merge PR - this'll trigger required checks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IPFS/Marketplace image uploads for samples in WebGL & other platforms
4 participants