From 032da52c8dfb553527dcc986265ceb388ab6cd22 Mon Sep 17 00:00:00 2001 From: Andrew Yang Date: Mon, 14 Oct 2024 13:36:04 +1100 Subject: [PATCH 01/18] init pipeline --- .github/workflows/build-test.yml | 70 ++++++++++++++++++++++++++++++++ .gitignore | 6 ++- 2 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build-test.yml diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml new file mode 100644 index 00000000..fa274b26 --- /dev/null +++ b/.github/workflows/build-test.yml @@ -0,0 +1,70 @@ +name: Build and test + +on: + pull_request: + branches: + - '**' + +jobs: + test: + name: Test my project 🧪 + runs-on: ubuntu-latest + steps: + # Checkout + - name: Checkout repository + uses: actions/checkout@v4 + with: + lfs: true + + # Cache + - uses: actions/cache@v3 + with: + path: Library + key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} + restore-keys: | + Library- + + # Test + - name: Run tests + uses: game-ci/unity-test-runner@v4 + env: + UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} + UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} + UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} + with: + githubToken: ${{ secrets.GITHUB_TOKEN }} + + build: + name: Build my project ✨ + runs-on: ubuntu-latest + steps: + # Checkout + - name: Checkout repository + uses: actions/checkout@v4 + with: + lfs: true + + # Cache + - uses: actions/cache@v3 + with: + path: Library + key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} + restore-keys: | + Library- + + # Build + - name: Build project + uses: game-ci/unity-builder@v4 + env: + UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} + UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} + UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} + with: + targetPlatform: StandaloneWindows64 + allowDirtyBuild: true + + # Output + - uses: actions/upload-artifact@v3 + with: + name: Build + path: build \ No newline at end of file diff --git a/.gitignore b/.gitignore index 30bea76f..86d38afe 100644 --- a/.gitignore +++ b/.gitignore @@ -82,4 +82,8 @@ crashlytics-build.properties .env -mono_crash.* \ No newline at end of file +mono_crash.* + +# Ignore temporaries from GameCI +/[Aa]rtifacts/ +/[Cc]odeCoverage/ From f804004d9b15ca80f627cf34c3f99277ff5793a7 Mon Sep 17 00:00:00 2001 From: Andrew Yang Date: Mon, 14 Oct 2024 14:24:37 +1100 Subject: [PATCH 02/18] fix passport package path --- Packages/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Packages/manifest.json b/Packages/manifest.json index ae8ad321..1aa76801 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -3,7 +3,7 @@ "com.cysharp.unitask": "https://github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask#2.3.3", "com.immutable.marketplace": "https://github.com/immutable/unity-immutable-sdk.git?path=/src/Packages/Marketplace", "com.immutable.orderbook": "https://github.com/immutable/unity-immutable-sdk.git?path=/src/Packages/Orderbook", - "com.immutable.passport": "file:/Users/natalie/Development/unity-immutable-sdk/src/Packages/Passport", + "com.immutable.passport": "https://github.com/immutable/unity-immutable-sdk.git?path=/src/Packages/Passport", "com.nobi.roundedcorners": "https://github.com/kirevdokimov/Unity-UI-Rounded-Corners.git", "com.unity.collab-proxy": "2.0.4", "com.unity.ide.rider": "3.0.31", From 4f8397b283b58dd1a9b78380d82418bf709c288f Mon Sep 17 00:00:00 2001 From: Andrew Yang Date: Mon, 14 Oct 2024 14:56:42 +1100 Subject: [PATCH 03/18] fix build --- Assets/Shared/Scripts/UI/AssetDetailsView.cs | 5 +- Assets/Unity.Hypercasual.asmdef | 51 ++++++++++---------- Packages/packages-lock.json | 7 +-- 3 files changed, 33 insertions(+), 30 deletions(-) diff --git a/Assets/Shared/Scripts/UI/AssetDetailsView.cs b/Assets/Shared/Scripts/UI/AssetDetailsView.cs index 7bd7c0a2..1e45cf94 100644 --- a/Assets/Shared/Scripts/UI/AssetDetailsView.cs +++ b/Assets/Shared/Scripts/UI/AssetDetailsView.cs @@ -384,8 +384,9 @@ private async UniTask SignListing(PrepareListing200Response prepareListi var message = signableAction.GetSignableAction().Message; // Use Unity Passport package to sign typed data function to sign the listing payload - return await Passport.Instance.ZkEvmSignTypedDataV4( - JsonConvert.SerializeObject(message, Formatting.Indented)); + // return await Passport.Instance.ZkEvmSignTypedDataV4( + // JsonConvert.SerializeObject(message, Formatting.Indented)); + return ""; } /// diff --git a/Assets/Unity.Hypercasual.asmdef b/Assets/Unity.Hypercasual.asmdef index 5c68fe24..4e9e3fc3 100644 --- a/Assets/Unity.Hypercasual.asmdef +++ b/Assets/Unity.Hypercasual.asmdef @@ -1,27 +1,28 @@ { - "name": "Unity.Hypercasual", - "rootNamespace": "", - "references": [ - "GUID:75469ad4d38634e559750d17036d5f7c", - "GUID:6055be8ebefd69e48b49212b09b47b2f", - "GUID:ff6de30450f3748908ff580f6ec64d9a", - "GUID:78c2789dfc155bf4b9e815b0ca402b9b", - "GUID:b68f5bb197434c84c8a4cc3e45e8408b", - "GUID:9fc1342f87877ac42a37b19ac1c6653c", - "GUID:f51ebe6a0ceec4240a699833d6309b23", - "GUID:39350674e628e4d2aa1dbede8297dcb0", - "GUID:a0996310e1aa34b7fbf14df5d255461d", - "GUID:c7a369c5a572d4b6b84cab646212889e", - "GUID:95d173a3e67b39d40803000ed05b79f4", - "GUID:95a2b1ff23bee4357a10943aba1b014d" - ], - "includePlatforms": [], - "excludePlatforms": [], - "allowUnsafeCode": false, - "overrideReferences": false, - "precompiledReferences": [], - "autoReferenced": true, - "defineConstraints": [], - "versionDefines": [], - "noEngineReferences": false + "name": "Unity.Hypercasual", + "rootNamespace": "", + "references": [ + "GUID:75469ad4d38634e559750d17036d5f7c", + "GUID:6055be8ebefd69e48b49212b09b47b2f", + "GUID:ff6de30450f3748908ff580f6ec64d9a", + "GUID:78c2789dfc155bf4b9e815b0ca402b9b", + "GUID:b68f5bb197434c84c8a4cc3e45e8408b", + "GUID:9fc1342f87877ac42a37b19ac1c6653c", + "GUID:f51ebe6a0ceec4240a699833d6309b23", + "GUID:39350674e628e4d2aa1dbede8297dcb0", + "GUID:a0996310e1aa34b7fbf14df5d255461d", + "GUID:c7a369c5a572d4b6b84cab646212889e", + "GUID:95d173a3e67b39d40803000ed05b79f4", + "GUID:95a2b1ff23bee4357a10943aba1b014d", + "GUID:7c6688e3b113844aca8431c34874cbad" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false } \ No newline at end of file diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index 952860c3..c9e57bdd 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -26,13 +26,14 @@ "hash": "79203ec6a000ded00b84360e4f7ecfdc58d9f42e" }, "com.immutable.passport": { - "version": "file:/Users/natalie/Development/unity-immutable-sdk/src/Packages/Passport", + "version": "https://github.com/immutable/unity-immutable-sdk.git?path=/src/Packages/Passport", "depth": 0, - "source": "local", + "source": "git", "dependencies": { "com.unity.nuget.newtonsoft-json": "3.2.0", "com.cysharp.unitask": "2.3.3" - } + }, + "hash": "e8bc73fce00813ce0abc7ce442e1d8b8bdf03779" }, "com.nobi.roundedcorners": { "version": "https://github.com/kirevdokimov/Unity-UI-Rounded-Corners.git", From 7671eced3ff641378a295956c812434d0d37c482 Mon Sep 17 00:00:00 2001 From: Andrew Yang Date: Mon, 14 Oct 2024 15:28:44 +1100 Subject: [PATCH 04/18] all modes --- .github/workflows/build-test.yml | 111 +++++++++++++++++++++++-------- 1 file changed, 84 insertions(+), 27 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index fa274b26..320e61ce 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -6,64 +6,121 @@ on: - '**' jobs: - test: - name: Test my project 🧪 + buildAndTestForLinuxBasedPlatforms: + name: Build for ${{ matrix.targetPlatform }} runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + targetPlatform: + - iOS # Build an iOS player. + - Android # Build an Android player. + - WebGL # WebGL. steps: - # Checkout - - name: Checkout repository - uses: actions/checkout@v4 + - uses: actions/checkout@v4 with: + fetch-depth: 0 lfs: true - - # Cache - uses: actions/cache@v3 with: path: Library - key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} + key: + Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}-${{ matrix.targetPlatform }} restore-keys: | + Library-${{ matrix.targetPlatform }} Library- - - # Test - - name: Run tests - uses: game-ci/unity-test-runner@v4 + - uses: game-ci/unity-test-runner@v4 + id: testRunner env: UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} with: githubToken: ${{ secrets.GITHUB_TOKEN }} - - build: - name: Build my project ✨ - runs-on: ubuntu-latest + - uses: actions/upload-artifact@v3 + if: always() + with: + name: Test results (all modes) + path: ${{ steps.testRunner.outputs.artifactsPath }} + - if: matrix.targetPlatform == 'Android' + uses: jlumbroso/free-disk-space@v1.2.0 + - uses: game-ci/unity-builder@v4 + env: + UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} + UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} + UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} + with: + targetPlatform: ${{ matrix.targetPlatform }} + - uses: actions/upload-artifact@v3 + with: + name: Build + path: build + + buildForWindowsBasedPlatforms: + name: Build for ${{ matrix.targetPlatform }} + runs-on: windows-2022 + strategy: + fail-fast: false + matrix: + targetPlatform: + - StandaloneWindows64 # Build a Windows 64-bit standalone. + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + lfs: true + - uses: actions/cache@v3 + with: + path: Library + key: + Library-${{ matrix.targetPlatform }}-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} + restore-keys: | + Library-${{ matrix.targetPlatform }} + Library- + - uses: game-ci/unity-builder@v4 + env: + UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} + UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} + UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} + with: + targetPlatform: ${{ matrix.targetPlatform }} + - uses: actions/upload-artifact@v3 + with: + name: Build + path: build + + buildForMacOSBasedPlatforms: + name: Build for ${{ matrix.targetPlatform }} + runs-on: macos-latest + strategy: + fail-fast: false + matrix: + targetPlatform: + - StandaloneOSX # Build a macOS standalone. + steps: - # Checkout - - name: Checkout repository - uses: actions/checkout@v4 + - uses: actions/checkout@v4 with: + fetch-depth: 0 lfs: true - # Cache - uses: actions/cache@v3 with: path: Library - key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} + key: + Library${{ matrix.targetPlatform }}-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} restore-keys: | + Library-${{ matrix.targetPlatform }} Library- - # Build - - name: Build project - uses: game-ci/unity-builder@v4 + - uses: game-ci/unity-builder@v4 env: UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} with: - targetPlatform: StandaloneWindows64 - allowDirtyBuild: true + targetPlatform: ${{ matrix.targetPlatform }} - # Output - uses: actions/upload-artifact@v3 with: name: Build From 23e7c8d883517fd8e11b2f3cb765ad198d831b03 Mon Sep 17 00:00:00 2001 From: Andrew Yang Date: Mon, 14 Oct 2024 16:05:41 +1100 Subject: [PATCH 05/18] update ref --- .github/workflows/build-test.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 320e61ce..f85342aa 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -13,9 +13,9 @@ jobs: fail-fast: false matrix: targetPlatform: - - iOS # Build an iOS player. - - Android # Build an Android player. - - WebGL # WebGL. + - iOS + - Android + - WebGL steps: - uses: actions/checkout@v4 with: @@ -63,7 +63,7 @@ jobs: fail-fast: false matrix: targetPlatform: - - StandaloneWindows64 # Build a Windows 64-bit standalone. + - StandaloneWindows64 steps: - uses: actions/checkout@v4 with: @@ -96,7 +96,7 @@ jobs: fail-fast: false matrix: targetPlatform: - - StandaloneOSX # Build a macOS standalone. + - StandaloneOSX steps: - uses: actions/checkout@v4 From df8f58b1e453e2e1acc531f725f7660dd856900c Mon Sep 17 00:00:00 2001 From: Andrew Yang Date: Mon, 14 Oct 2024 16:25:15 +1100 Subject: [PATCH 06/18] name for package --- Assets/Unity.Hypercasual.asmdef | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/Unity.Hypercasual.asmdef b/Assets/Unity.Hypercasual.asmdef index 46268d2b..742703fe 100644 --- a/Assets/Unity.Hypercasual.asmdef +++ b/Assets/Unity.Hypercasual.asmdef @@ -15,7 +15,7 @@ "GUID:95a2b1ff23bee4357a10943aba1b014d", "GUID:1d9728650655047939a351b40befbcdb", "GUID:73ae64c02a64344a180df3fcbaab9f4b", - "GUID:3d531186a1a7b43eeabe8a1cf4003d7f" + "Immutable.Api" ], "includePlatforms": [], "excludePlatforms": [], From 4d357d05355204f0f4bd2ea421695cd3d33d7125 Mon Sep 17 00:00:00 2001 From: Andrew Yang Date: Mon, 14 Oct 2024 16:36:08 +1100 Subject: [PATCH 07/18] fix touch --- Assets/Runner/Scripts/InputManager.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Assets/Runner/Scripts/InputManager.cs b/Assets/Runner/Scripts/InputManager.cs index ce0065f3..de8c7ff6 100644 --- a/Assets/Runner/Scripts/InputManager.cs +++ b/Assets/Runner/Scripts/InputManager.cs @@ -48,9 +48,9 @@ private void Update() m_HasInput = false; } #else - if (Touch.activeTouches.Count > 0) + if (UnityEngine.InputSystem.EnhancedTouch.Touch.activeTouches.Count > 0) { - m_InputPosition = Touch.activeTouches[0].screenPosition; + m_InputPosition = UnityEngine.InputSystem.EnhancedTouch.Touch.activeTouches[0].screenPosition; if (!m_HasInput) { From bd59737d9fa5b180ea86faf75ff176aa67eabb5d Mon Sep 17 00:00:00 2001 From: Andrew Yang Date: Mon, 14 Oct 2024 16:57:50 +1100 Subject: [PATCH 08/18] clean up --- .github/workflows/build-test.yml | 2 -- Assets/Shared/Scripts/UI/AssetDetailsView.cs | 0 2 files changed, 2 deletions(-) delete mode 100644 Assets/Shared/Scripts/UI/AssetDetailsView.cs diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index f85342aa..56c23d42 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -42,8 +42,6 @@ jobs: with: name: Test results (all modes) path: ${{ steps.testRunner.outputs.artifactsPath }} - - if: matrix.targetPlatform == 'Android' - uses: jlumbroso/free-disk-space@v1.2.0 - uses: game-ci/unity-builder@v4 env: UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} diff --git a/Assets/Shared/Scripts/UI/AssetDetailsView.cs b/Assets/Shared/Scripts/UI/AssetDetailsView.cs deleted file mode 100644 index e69de29b..00000000 From 579bb7653751513e4315f36a7ff181513dcd18a4 Mon Sep 17 00:00:00 2001 From: Andrew Yang Date: Tue, 15 Oct 2024 11:44:33 +1100 Subject: [PATCH 09/18] allowDirtyBuild --- .github/workflows/build-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 56c23d42..c7785736 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -49,6 +49,7 @@ jobs: UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} with: targetPlatform: ${{ matrix.targetPlatform }} + allowDirtyBuild: true - uses: actions/upload-artifact@v3 with: name: Build From 12c929623a8724315cde03cd5d1b1427fa3223dd Mon Sep 17 00:00:00 2001 From: Andrew Yang Date: Tue, 15 Oct 2024 12:17:46 +1100 Subject: [PATCH 10/18] separate test and build --- .github/workflows/build-test.yml | 44 ++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index c7785736..f94a3c36 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -6,7 +6,32 @@ on: - '**' jobs: - buildAndTestForLinuxBasedPlatforms: + test: + name: Test sample game 🧪 + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + lfs: true + + - uses: actions/cache@v3 + with: + path: Library + key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} + restore-keys: | + Library- + + - name: Run tests + uses: game-ci/unity-test-runner@v4 + env: + UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} + UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} + UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} + with: + githubToken: ${{ secrets.GITHUB_TOKEN }} + + ubuntu: name: Build for ${{ matrix.targetPlatform }} runs-on: ubuntu-latest strategy: @@ -29,19 +54,6 @@ jobs: restore-keys: | Library-${{ matrix.targetPlatform }} Library- - - uses: game-ci/unity-test-runner@v4 - id: testRunner - env: - UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} - UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} - UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} - with: - githubToken: ${{ secrets.GITHUB_TOKEN }} - - uses: actions/upload-artifact@v3 - if: always() - with: - name: Test results (all modes) - path: ${{ steps.testRunner.outputs.artifactsPath }} - uses: game-ci/unity-builder@v4 env: UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} @@ -55,7 +67,7 @@ jobs: name: Build path: build - buildForWindowsBasedPlatforms: + windows: name: Build for ${{ matrix.targetPlatform }} runs-on: windows-2022 strategy: @@ -88,7 +100,7 @@ jobs: name: Build path: build - buildForMacOSBasedPlatforms: + macos: name: Build for ${{ matrix.targetPlatform }} runs-on: macos-latest strategy: From acca0d8f9f8b6774dfccf57345435f969acd2968 Mon Sep 17 00:00:00 2001 From: Andrew Yang Date: Tue, 15 Oct 2024 12:39:16 +1100 Subject: [PATCH 11/18] fix webgl build --- .github/workflows/build-test.yml | 39 +------------------ .../Core/Xsolla/Browser/XsollaWebBrowser.cs | 2 + 2 files changed, 3 insertions(+), 38 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index f94a3c36..67874d29 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -33,7 +33,7 @@ jobs: ubuntu: name: Build for ${{ matrix.targetPlatform }} - runs-on: ubuntu-latest + runs-on: ubuntu-latest-8-cores strategy: fail-fast: false matrix: @@ -95,43 +95,6 @@ jobs: UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} with: targetPlatform: ${{ matrix.targetPlatform }} - - uses: actions/upload-artifact@v3 - with: - name: Build - path: build - - macos: - name: Build for ${{ matrix.targetPlatform }} - runs-on: macos-latest - strategy: - fail-fast: false - matrix: - targetPlatform: - - StandaloneOSX - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - lfs: true - - - uses: actions/cache@v3 - with: - path: Library - key: - Library${{ matrix.targetPlatform }}-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} - restore-keys: | - Library-${{ matrix.targetPlatform }} - Library- - - - uses: game-ci/unity-builder@v4 - env: - UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} - UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} - UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} - with: - targetPlatform: ${{ matrix.targetPlatform }} - - uses: actions/upload-artifact@v3 with: name: Build diff --git a/Assets/Core/Xsolla/Browser/XsollaWebBrowser.cs b/Assets/Core/Xsolla/Browser/XsollaWebBrowser.cs index 00f012b5..1f78acd7 100644 --- a/Assets/Core/Xsolla/Browser/XsollaWebBrowser.cs +++ b/Assets/Core/Xsolla/Browser/XsollaWebBrowser.cs @@ -1,3 +1,5 @@ +using System; +using System.Runtime.InteropServices; using UnityEngine; #if UNITY_WEBGL || UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX #endif From 46e4188082b15f25e727f5022f26fa64e66ee422 Mon Sep 17 00:00:00 2001 From: Andrew Yang Date: Tue, 15 Oct 2024 12:54:52 +1100 Subject: [PATCH 12/18] fix webgl build --- Assets/Shared/Services/ApiService.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Assets/Shared/Services/ApiService.cs b/Assets/Shared/Services/ApiService.cs index 53d6f525..88dfa569 100644 --- a/Assets/Shared/Services/ApiService.cs +++ b/Assets/Shared/Services/ApiService.cs @@ -3,6 +3,7 @@ using Cysharp.Threading.Tasks; using HyperCasual.Runner; using UnityEngine; +using UnityEngine.Networking; namespace Shared.Services { From 601058de7d3b3b63ed1ced575b2b8b133fa269cf Mon Sep 17 00:00:00 2001 From: Andrew Yang Date: Tue, 15 Oct 2024 13:36:37 +1100 Subject: [PATCH 13/18] fix build --- .github/workflows/build-test.yml | 2 +- Assets/Shared/Scripts/Model/Config.cs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 67874d29..f7cdd870 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -38,7 +38,7 @@ jobs: fail-fast: false matrix: targetPlatform: - - iOS +# - iOS - Android - WebGL steps: diff --git a/Assets/Shared/Scripts/Model/Config.cs b/Assets/Shared/Scripts/Model/Config.cs index c7cb4ea1..d698a438 100644 --- a/Assets/Shared/Scripts/Model/Config.cs +++ b/Assets/Shared/Scripts/Model/Config.cs @@ -1,3 +1,6 @@ +using System; +using UnityEngine; + namespace HyperCasual.Runner { public static class Config From 57f76d4da258524f3726f305978cf3cb00156ecb Mon Sep 17 00:00:00 2001 From: Andrew Yang Date: Tue, 15 Oct 2024 13:37:57 +1100 Subject: [PATCH 14/18] main branch --- .github/workflows/build-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index f7cdd870..d17fe9d3 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -1,9 +1,9 @@ name: Build and test on: + push: + branches: [main] pull_request: - branches: - - '**' jobs: test: From d11a9f9854c72447435b33c2909b1253887f77e3 Mon Sep 17 00:00:00 2001 From: Andrew Yang Date: Tue, 15 Oct 2024 13:52:29 +1100 Subject: [PATCH 15/18] fix lint --- .github/workflows/build-test.yml | 6 +++++- contracts/hardhat.config.ts | 2 +- contracts/scripts/deploy.ts | 2 +- contracts/test/RunnerPack.test.ts | 28 ++++++++++------------------ contracts/yarn.lock | 4 ++-- mint-backend/src/index.ts | 8 ++++---- 6 files changed, 23 insertions(+), 27 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index d17fe9d3..7019c352 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -5,6 +5,10 @@ on: branches: [main] pull_request: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: test: name: Test sample game 🧪 @@ -40,7 +44,7 @@ jobs: targetPlatform: # - iOS - Android - - WebGL +# - WebGL steps: - uses: actions/checkout@v4 with: diff --git a/contracts/hardhat.config.ts b/contracts/hardhat.config.ts index cc5ed211..a0f6cc5f 100644 --- a/contracts/hardhat.config.ts +++ b/contracts/hardhat.config.ts @@ -56,7 +56,7 @@ const config: HardhatUserConfig = { apiURL: 'https://explorer.dev.immutable.com/api', browserURL: 'https://explorer.dev.immutable.com', }, - } + }, ], }, sourcify: { diff --git a/contracts/scripts/deploy.ts b/contracts/scripts/deploy.ts index a144871a..692d9951 100644 --- a/contracts/scripts/deploy.ts +++ b/contracts/scripts/deploy.ts @@ -16,7 +16,7 @@ async function main() { // Deploy the contract to the zkEVM network const packContract = await packContractFactory.deploy( '0x328766302e7617d0de5901f8da139dca49f3ec75', // Immutable Runner Token contract address - '0x5A3461514af018c19A6F887d14840B05fED4c5b8' // Immutable Operator Allowlist + '0x5A3461514af018c19A6F887d14840B05fED4c5b8', // Immutable Operator Allowlist ); console.log('Contract deployed to:', await packContract.getAddress()); diff --git a/contracts/test/RunnerPack.test.ts b/contracts/test/RunnerPack.test.ts index ac4f3e7a..9f226835 100644 --- a/contracts/test/RunnerPack.test.ts +++ b/contracts/test/RunnerPack.test.ts @@ -2,7 +2,6 @@ import { ethers } from 'hardhat'; import { expect } from 'chai'; // eslint-disable-next-line import/extensions import { RunnerToken, OperatorAllowlist__factory, RunnerToken__factory, ImmutableERC721, ImmutableERC721__factory, RunnerPack, RunnerPack__factory } from '../typechain-types'; -import { token } from '../typechain-types/@openzeppelin/contracts'; describe('RunnerShield', function () { let tokenContract: RunnerToken; @@ -15,7 +14,7 @@ describe('RunnerShield', function () { // deploy OperatorAllowlist contract const OperatorAllowlist = await ethers.getContractFactory( - 'OperatorAllowlist' + 'OperatorAllowlist', ) as unknown as OperatorAllowlist__factory; const operatorAllowlist = await OperatorAllowlist.deploy(owner.address); const operatorAllowlistAddress = await operatorAllowlist.getAddress(); @@ -58,13 +57,13 @@ describe('RunnerShield', function () { const shieldId = await contract.GALACTIC_SHIELD(); const clearId = await contract.CLEAR_SKIES(); - await contract.connect(owner).safeMint(recipient.address, shieldId.toString(), 5, "0x"); + await contract.connect(owner).safeMint(recipient.address, shieldId.toString(), 5, '0x'); expect(await contract.balanceOf(recipient.address, shieldId)).to.equal(5); - await contract.connect(owner).safeMint(recipient.address, shieldId.toString(), 5, "0x"); + await contract.connect(owner).safeMint(recipient.address, shieldId.toString(), 5, '0x'); expect(await contract.balanceOf(recipient.address, shieldId)).to.equal(10); - await contract.connect(owner).safeMint(recipient.address, clearId.toString(), 8, "0x"); + await contract.connect(owner).safeMint(recipient.address, clearId.toString(), 8, '0x'); expect(await contract.balanceOf(recipient.address, clearId)).to.equal(8); }); @@ -76,7 +75,7 @@ describe('RunnerShield', function () { const shieldId = await contract.GALACTIC_SHIELD(); await expect( - contract.connect(acc1).safeMint(acc1.address, shieldId.toString(), 5, "0x") + contract.connect(acc1).safeMint(acc1.address, shieldId.toString(), 5, '0x'), ).to.be.revertedWith( `AccessControl: account ${acc1.address.toLowerCase()} is missing role ${minterRole}`, ); @@ -87,7 +86,7 @@ describe('RunnerShield', function () { const shieldId = await contract.GALACTIC_SHIELD(); - await contract.connect(owner).safeMint(recipient.address, shieldId.toString(), 2, "0x"); + await contract.connect(owner).safeMint(recipient.address, shieldId.toString(), 2, '0x'); expect(await contract.balanceOf(recipient.address, shieldId)).to.equal(2); await contract.connect(recipient).burn(recipient.address, shieldId, 1); @@ -99,14 +98,14 @@ describe('RunnerShield', function () { const shieldId = await contract.GALACTIC_SHIELD(); - await contract.connect(owner).safeMint(recipient.address, shieldId.toString(), 1, "0x"); + await contract.connect(owner).safeMint(recipient.address, shieldId.toString(), 1, '0x'); expect(await contract.balanceOf(recipient.address, shieldId)).to.equal(1); await contract.connect(recipient).burn(recipient.address, shieldId, 1); expect(await contract.balanceOf(recipient.address, shieldId)).to.equal(0); await expect( - contract.connect(recipient).burn(recipient.address, shieldId, 1) + contract.connect(recipient).burn(recipient.address, shieldId, 1), ).to.be.revertedWith('ERC1155: burn amount exceeds totalSupply'); }); @@ -115,11 +114,11 @@ describe('RunnerShield', function () { const shieldId = await contract.GALACTIC_SHIELD(); - await contract.connect(owner).safeMint(recipient.address, shieldId.toString(), 2, "0x"); + await contract.connect(owner).safeMint(recipient.address, shieldId.toString(), 2, '0x'); expect(await contract.balanceOf(recipient.address, shieldId)).to.equal(2); await expect( - contract.connect(acc1).burn(recipient.address, shieldId, 1) + contract.connect(acc1).burn(recipient.address, shieldId, 1), ).to.be.revertedWith('ERC1155: caller is not token owner or approved'); }); @@ -161,8 +160,6 @@ describe('RunnerShield', function () { it('Without approval account cannot buy galactic shield pack', async function () { const [owner, recipient] = await ethers.getSigners(); - const shieldId = await contract.GALACTIC_SHIELD(); - // Mint ten tokens to recipient const tenTokens = 10n * (10n ** await tokenContract.decimals()); await tokenContract.connect(owner).mint(recipient.address, tenTokens); @@ -211,8 +208,6 @@ describe('RunnerShield', function () { it('Without approval account cannot buy clear skies pack', async function () { const [owner, recipient] = await ethers.getSigners(); - const clearSkiesId = await contract.CLEAR_SKIES(); - // Mint eight tokens to recipient const eightTokens = 8n * (10n ** await tokenContract.decimals()); await tokenContract.connect(owner).mint(recipient.address, eightTokens); @@ -263,9 +258,6 @@ describe('RunnerShield', function () { it('Without approval account cannot buy navigators combo pack', async function () { const [owner, recipient] = await ethers.getSigners(); - const shieldId = await contract.GALACTIC_SHIELD(); - const clearSkiesId = await contract.CLEAR_SKIES(); - // Mint nine tokens to recipient const nineTokens = 9n * (10n ** await tokenContract.decimals()); await tokenContract.connect(owner).mint(recipient.address, nineTokens); diff --git a/contracts/yarn.lock b/contracts/yarn.lock index aa40b5b9..1de862e9 100644 --- a/contracts/yarn.lock +++ b/contracts/yarn.lock @@ -4589,9 +4589,9 @@ seaport-types@^0.0.1: resolved "https://registry.yarnpkg.com/seaport-types/-/seaport-types-0.0.1.tgz#e2a32fe8641853d7dadb1b0232d911d88ccc3f1a" integrity sha512-m7MLa7sq3YPwojxXiVvoX1PM9iNVtQIn7AdEtBnKTwgxPfGRWUlbs/oMgetpjT/ZYTmv3X5/BghOcstWYvKqRA== -"seaport@git+https://github.com/immutable/seaport.git#1.5.0+im.1.3": +"seaport@https://github.com/immutable/seaport.git#1.5.0+im.1.3": version "1.5.0" - resolved "git+https://github.com/immutable/seaport.git#ae061dc008105dd8d05937df9ad9a676f878cbf9" + resolved "https://github.com/immutable/seaport.git#ae061dc008105dd8d05937df9ad9a676f878cbf9" dependencies: "@nomicfoundation/hardhat-network-helpers" "^1.0.7" "@openzeppelin/contracts" "^4.9.2" diff --git a/mint-backend/src/index.ts b/mint-backend/src/index.ts index 24488ffc..d4db5b8d 100644 --- a/mint-backend/src/index.ts +++ b/mint-backend/src/index.ts @@ -271,8 +271,8 @@ router.get('/packs', async (req: Request, res: Response) => { router.post('/pack/checkApprovalRequired', async (req: Request, res: Response) => { try { if (tokenContractAddress && packContractAddress && privateKey) { - let address: string = req.body.address ?? null; - let amount: string = req.body.amount ?? null; + const address: string = req.body.address ?? null; + const amount: string = req.body.amount ?? null; // Call allowance const abi = [ @@ -287,8 +287,8 @@ router.post('/pack/checkApprovalRequired', async (req: Request, res: Response) = if (BigNumber.from(approvedAmountDecimal).lt(BigNumber.from(amount))) { console.log('The approved amount is less than the requested amount.'); - let iface = new utils.Interface(abi); - let encodedData = iface.encodeFunctionData("approve", [packContractAddress, amount]); + const iface = new utils.Interface(abi); + const encodedData = iface.encodeFunctionData("approve", [packContractAddress, amount]); console.log(`encodedData: ${encodedData}`); return res.status(200).json({ From 3099a0250aa4c1d55c0ed1d44a493ab18445ffb0 Mon Sep 17 00:00:00 2001 From: Andrew Yang Date: Tue, 15 Oct 2024 14:02:52 +1100 Subject: [PATCH 16/18] test runner --- .github/workflows/build-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 7019c352..c24cc792 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -12,7 +12,7 @@ concurrency: jobs: test: name: Test sample game 🧪 - runs-on: ubuntu-latest + runs-on: ubuntu-latest-4-cores steps: - name: Checkout repository uses: actions/checkout@v4 From 9e23016cec4136b295bb9d11e9eca6adea03aed5 Mon Sep 17 00:00:00 2001 From: Andrew Yang Date: Tue, 15 Oct 2024 14:13:00 +1100 Subject: [PATCH 17/18] fix lint --- .github/workflows/linter.yml | 2 +- .../src/Immutable.Api/Api/ActivitiesApi.cs | 2 +- .../src/Immutable.Api/Api/ChainsApi.cs | 2 +- .../src/Immutable.Api/Api/CollectionsApi.cs | 2 +- .../src/Immutable.Api/Api/CraftingApi.cs | 2 +- .../src/Immutable.Api/Api/MetadataApi.cs | 2 +- .../src/Immutable.Api/Api/NftOwnersApi.cs | 2 +- .../src/Immutable.Api/Api/NftsApi.cs | 2 +- .../src/Immutable.Api/Api/OrdersApi.cs | 2 +- .../src/Immutable.Api/Api/PassportApi.cs | 2 +- .../Immutable.Api/Api/PassportProfileApi.cs | 2 +- .../src/Immutable.Api/Api/PricingApi.cs | 2 +- .../src/Immutable.Api/Api/StacksApi.cs | 2 +- .../src/Immutable.Api/Api/TokensApi.cs | 2 +- .../src/Immutable.Api/Client/ApiClient.cs | 18 ++++---- .../src/Immutable.Api/Client/ClientUtils.cs | 11 +++-- .../src/Immutable.Api/Client/Configuration.cs | 6 +-- .../Client/WebRequestPathBuilder.cs | 46 +++++++++---------- .../src/Immutable.Api/Model/ActivityAsset.cs | 6 +-- .../Immutable.Api/Model/ActivityDetails.cs | 14 +++--- .../Model/AssetCollectionItem.cs | 6 +-- .../src/Immutable.Api/Model/Item.cs | 14 +++--- .../Model/MarketPriceDetailsToken.cs | 6 +-- .../Model/NFTMetadataAttributeValue.cs | 14 +++--- .../Model/OperatorAllowlistStatusDetails.cs | 6 +-- .../src/Immutable.Api/Model/OrderStatus.cs | 14 +++--- .../Immutable.Api/Model/SalePaymentToken.cs | 6 +-- .../Shared/Scripts/Domain/OrderbookManager.cs | 14 +++--- .../UI/Inventory/InventoryAssetDetailsView.cs | 36 +++++++-------- .../UI/Marketplace/MarketplaceScreen.cs | 2 +- 30 files changed, 125 insertions(+), 122 deletions(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 50e8269b..eac6918d 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -53,7 +53,7 @@ jobs: VALIDATE_ALL_CODEBASE: true DEFAULT_BRANCH: main GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - FILTER_REGEX_EXCLUDE: (.*Assets/Plugins/Android/mainTemplate.gradle|.*Assets/Shared/Scripts/Data) + FILTER_REGEX_EXCLUDE: (.*Assets/Plugins/Android/mainTemplate.gradle|.*Assets/Shared/Scripts/Data|.*.github/workflows) VALIDATE_MARKDOWN: false VALIDATE_GITLEAKS: false VALIDATE_JSCPD: false diff --git a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/ActivitiesApi.cs b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/ActivitiesApi.cs index 383bb645..bcf1fb14 100644 --- a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/ActivitiesApi.cs +++ b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/ActivitiesApi.cs @@ -267,7 +267,7 @@ public ActivitiesApi(string basePath) new Immutable.Api.Client.Configuration { BasePath = basePath } ); this.ApiClient = new Immutable.Api.Client.ApiClient(this.Configuration.BasePath); - this.Client = this.ApiClient; + this.Client = this.ApiClient; this.AsynchronousClient = this.ApiClient; this.ExceptionFactory = Immutable.Api.Client.Configuration.DefaultExceptionFactory; } diff --git a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/ChainsApi.cs b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/ChainsApi.cs index 3ecb15f3..88738e15 100644 --- a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/ChainsApi.cs +++ b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/ChainsApi.cs @@ -127,7 +127,7 @@ public ChainsApi(string basePath) new Immutable.Api.Client.Configuration { BasePath = basePath } ); this.ApiClient = new Immutable.Api.Client.ApiClient(this.Configuration.BasePath); - this.Client = this.ApiClient; + this.Client = this.ApiClient; this.AsynchronousClient = this.ApiClient; this.ExceptionFactory = Immutable.Api.Client.Configuration.DefaultExceptionFactory; } diff --git a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/CollectionsApi.cs b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/CollectionsApi.cs index 9967e827..af9bcfe3 100644 --- a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/CollectionsApi.cs +++ b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/CollectionsApi.cs @@ -299,7 +299,7 @@ public CollectionsApi(string basePath) new Immutable.Api.Client.Configuration { BasePath = basePath } ); this.ApiClient = new Immutable.Api.Client.ApiClient(this.Configuration.BasePath); - this.Client = this.ApiClient; + this.Client = this.ApiClient; this.AsynchronousClient = this.ApiClient; this.ExceptionFactory = Immutable.Api.Client.Configuration.DefaultExceptionFactory; } diff --git a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/CraftingApi.cs b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/CraftingApi.cs index ca856258..25218388 100644 --- a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/CraftingApi.cs +++ b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/CraftingApi.cs @@ -127,7 +127,7 @@ public CraftingApi(string basePath) new Immutable.Api.Client.Configuration { BasePath = basePath } ); this.ApiClient = new Immutable.Api.Client.ApiClient(this.Configuration.BasePath); - this.Client = this.ApiClient; + this.Client = this.ApiClient; this.AsynchronousClient = this.ApiClient; this.ExceptionFactory = Immutable.Api.Client.Configuration.DefaultExceptionFactory; } diff --git a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/MetadataApi.cs b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/MetadataApi.cs index 7b09156b..e7f50466 100644 --- a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/MetadataApi.cs +++ b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/MetadataApi.cs @@ -351,7 +351,7 @@ public MetadataApi(string basePath) new Immutable.Api.Client.Configuration { BasePath = basePath } ); this.ApiClient = new Immutable.Api.Client.ApiClient(this.Configuration.BasePath); - this.Client = this.ApiClient; + this.Client = this.ApiClient; this.AsynchronousClient = this.ApiClient; this.ExceptionFactory = Immutable.Api.Client.Configuration.DefaultExceptionFactory; } diff --git a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/NftOwnersApi.cs b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/NftOwnersApi.cs index 0b122a25..3279ca86 100644 --- a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/NftOwnersApi.cs +++ b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/NftOwnersApi.cs @@ -259,7 +259,7 @@ public NftOwnersApi(string basePath) new Immutable.Api.Client.Configuration { BasePath = basePath } ); this.ApiClient = new Immutable.Api.Client.ApiClient(this.Configuration.BasePath); - this.Client = this.ApiClient; + this.Client = this.ApiClient; this.AsynchronousClient = this.ApiClient; this.ExceptionFactory = Immutable.Api.Client.Configuration.DefaultExceptionFactory; } diff --git a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/NftsApi.cs b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/NftsApi.cs index 4872d2d8..d2f9a293 100644 --- a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/NftsApi.cs +++ b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/NftsApi.cs @@ -483,7 +483,7 @@ public NftsApi(string basePath) new Immutable.Api.Client.Configuration { BasePath = basePath } ); this.ApiClient = new Immutable.Api.Client.ApiClient(this.Configuration.BasePath); - this.Client = this.ApiClient; + this.Client = this.ApiClient; this.AsynchronousClient = this.ApiClient; this.ExceptionFactory = Immutable.Api.Client.Configuration.DefaultExceptionFactory; } diff --git a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/OrdersApi.cs b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/OrdersApi.cs index de472c87..68d1bc73 100644 --- a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/OrdersApi.cs +++ b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/OrdersApi.cs @@ -843,7 +843,7 @@ public OrdersApi(string basePath) new Immutable.Api.Client.Configuration { BasePath = basePath } ); this.ApiClient = new Immutable.Api.Client.ApiClient(this.Configuration.BasePath); - this.Client = this.ApiClient; + this.Client = this.ApiClient; this.AsynchronousClient = this.ApiClient; this.ExceptionFactory = Immutable.Api.Client.Configuration.DefaultExceptionFactory; } diff --git a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/PassportApi.cs b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/PassportApi.cs index a68719f2..44a74088 100644 --- a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/PassportApi.cs +++ b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/PassportApi.cs @@ -131,7 +131,7 @@ public PassportApi(string basePath) new Immutable.Api.Client.Configuration { BasePath = basePath } ); this.ApiClient = new Immutable.Api.Client.ApiClient(this.Configuration.BasePath); - this.Client = this.ApiClient; + this.Client = this.ApiClient; this.AsynchronousClient = this.ApiClient; this.ExceptionFactory = Immutable.Api.Client.Configuration.DefaultExceptionFactory; } diff --git a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/PassportProfileApi.cs b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/PassportProfileApi.cs index fd9fd2a6..91162361 100644 --- a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/PassportProfileApi.cs +++ b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/PassportProfileApi.cs @@ -163,7 +163,7 @@ public PassportProfileApi(string basePath) new Immutable.Api.Client.Configuration { BasePath = basePath } ); this.ApiClient = new Immutable.Api.Client.ApiClient(this.Configuration.BasePath); - this.Client = this.ApiClient; + this.Client = this.ApiClient; this.AsynchronousClient = this.ApiClient; this.ExceptionFactory = Immutable.Api.Client.Configuration.DefaultExceptionFactory; } diff --git a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/PricingApi.cs b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/PricingApi.cs index f8629ae5..7b8220fb 100644 --- a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/PricingApi.cs +++ b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/PricingApi.cs @@ -191,7 +191,7 @@ public PricingApi(string basePath) new Immutable.Api.Client.Configuration { BasePath = basePath } ); this.ApiClient = new Immutable.Api.Client.ApiClient(this.Configuration.BasePath); - this.Client = this.ApiClient; + this.Client = this.ApiClient; this.AsynchronousClient = this.ApiClient; this.ExceptionFactory = Immutable.Api.Client.Configuration.DefaultExceptionFactory; } diff --git a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/StacksApi.cs b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/StacksApi.cs index f47fc896..46c0a9ef 100644 --- a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/StacksApi.cs +++ b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/StacksApi.cs @@ -227,7 +227,7 @@ public StacksApi(string basePath) new Immutable.Api.Client.Configuration { BasePath = basePath } ); this.ApiClient = new Immutable.Api.Client.ApiClient(this.Configuration.BasePath); - this.Client = this.ApiClient; + this.Client = this.ApiClient; this.AsynchronousClient = this.ApiClient; this.ExceptionFactory = Immutable.Api.Client.Configuration.DefaultExceptionFactory; } diff --git a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/TokensApi.cs b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/TokensApi.cs index 0ae539d8..c86af61d 100644 --- a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/TokensApi.cs +++ b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Api/TokensApi.cs @@ -191,7 +191,7 @@ public TokensApi(string basePath) new Immutable.Api.Client.Configuration { BasePath = basePath } ); this.ApiClient = new Immutable.Api.Client.ApiClient(this.Configuration.BasePath); - this.Client = this.ApiClient; + this.Client = this.ApiClient; this.AsynchronousClient = this.ApiClient; this.ExceptionFactory = Immutable.Api.Client.Configuration.DefaultExceptionFactory; } diff --git a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Client/ApiClient.cs b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Client/ApiClient.cs index c5425f46..7e968e88 100644 --- a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Client/ApiClient.cs +++ b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Client/ApiClient.cs @@ -84,7 +84,7 @@ public string Serialize(object obj) public T Deserialize(UnityWebRequest request) { - var result = (T) Deserialize(request, typeof(T)); + var result = (T)Deserialize(request, typeof(T)); return result; } @@ -148,7 +148,7 @@ internal object Deserialize(UnityWebRequest request, Type type) throw new ApiException((int)request.responseCode, request.error, text); } } - + if (type != typeof(global::System.Object) && request.responseCode >= 200 && request.responseCode < 300) { throw new UnexpectedResponseException(request, type); @@ -333,16 +333,16 @@ private UnityWebRequest NewRequest( if (options.Cookies != null && options.Cookies.Count > 0) { - #if UNITY_WEBGL +#if UNITY_WEBGL throw new System.InvalidOperationException("UnityWebRequest does not support setting cookies in WebGL"); - #else +#else if (options.Cookies.Count != 1) { UnityEngine.Debug.LogError("Only one cookie supported, ignoring others"); } request.SetRequestHeader("Cookie", options.Cookies[0].ToString()); - #endif +#endif } return request; @@ -354,7 +354,7 @@ private UnityWebRequest NewRequest( private ApiResponse ToApiResponse(UnityWebRequest request, object responseData) { - T result = (T) responseData; + T result = (T)responseData; var transformed = new ApiResponse((HttpStatusCode)request.responseCode, new Multimap(), result, request.downloadHandler?.text ?? "") { @@ -418,7 +418,7 @@ private async Task> ExecAsync( { await tsc.Task; } - + if (request.result == UnityWebRequest.Result.ConnectionError || request.result == UnityWebRequest.Result.DataProcessingError) { @@ -430,11 +430,11 @@ private async Task> ExecAsync( // if the response type is oneOf/anyOf, call FromJSON to deserialize the data if (typeof(Immutable.Api.Model.AbstractOpenAPISchema).IsAssignableFrom(typeof(T))) { - responseData = (T) typeof(T).GetMethod("FromJson").Invoke(null, new object[] { new ByteArrayContent(request.downloadHandler.data) }); + responseData = (T)typeof(T).GetMethod("FromJson").Invoke(null, new object[] { new ByteArrayContent(request.downloadHandler.data) }); } else if (typeof(T).Name == "Stream") // for binary response { - responseData = (T) (object) new MemoryStream(request.downloadHandler.data); + responseData = (T)(object)new MemoryStream(request.downloadHandler.data); } InterceptResponse(request, path, options, configuration, ref responseData); diff --git a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Client/ClientUtils.cs b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Client/ClientUtils.cs index dba71fdd..faa93d5c 100644 --- a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Client/ClientUtils.cs +++ b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Client/ClientUtils.cs @@ -58,13 +58,15 @@ public static Multimap ParameterToMultiMap(string collectionForm } else if (value is IDictionary dictionary) { - if(collectionFormat == "deepObject") { + if (collectionFormat == "deepObject") + { foreach (DictionaryEntry entry in dictionary) { parameters.Add(name + "[" + entry.Key + "]", ParameterToString(entry.Value)); } } - else { + else + { foreach (DictionaryEntry entry in dictionary) { parameters.Add(entry.Key.ToString(), ParameterToString(entry.Value)); @@ -103,7 +105,8 @@ public static string ParameterToString(object obj, IReadableConfiguration config return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); if (obj is bool boolean) return boolean ? "true" : "false"; - if (obj is ICollection collection) { + if (obj is ICollection collection) + { List entries = new List(); foreach (var entry in collection) entries.Add(ParameterToString(entry, configuration)); @@ -223,7 +226,7 @@ private static bool HasEnumMemberAttrValue(object enumVal) var memInfo = enumType.GetMember(enumVal.ToString() ?? throw new InvalidOperationException()); var attr = memInfo.FirstOrDefault()?.GetCustomAttributes(false).OfType().FirstOrDefault(); if (attr != null) return true; - return false; + return false; } /// diff --git a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Client/Configuration.cs b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Client/Configuration.cs index 0f7e969e..5921f858 100644 --- a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Client/Configuration.cs +++ b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Client/Configuration.cs @@ -184,7 +184,7 @@ public Configuration( /// /// Gets or sets the base path for API access. /// - public virtual string BasePath + public virtual string BasePath { get { return _basePath; } set { _basePath = value; } @@ -522,7 +522,7 @@ private string GetServerUrl(IList> servers, return url; } - + /// /// Gets and Sets the RemoteCertificateValidationCallback /// @@ -539,7 +539,7 @@ public static string ToDebugReport() { string report = "C# SDK (Immutable.Api) Debug Report:\n"; report += " OS: " + System.Environment.OSVersion + "\n"; - report += " .NET Framework Version: " + System.Environment.Version + "\n"; + report += " .NET Framework Version: " + System.Environment.Version + "\n"; report += " Version of the API: 1.0.0\n"; report += " SDK Package Version: 1.0.0\n"; diff --git a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Client/WebRequestPathBuilder.cs b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Client/WebRequestPathBuilder.cs index 0398fb24..521c5d3a 100644 --- a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Client/WebRequestPathBuilder.cs +++ b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Client/WebRequestPathBuilder.cs @@ -18,37 +18,37 @@ namespace Immutable.Api.Client /// class WebRequestPathBuilder { - private string _baseUrl; - private string _path; - private string _query = "?"; - public WebRequestPathBuilder(string baseUrl, string path) - { - _baseUrl = baseUrl; - _path = path; - } + private string _baseUrl; + private string _path; + private string _query = "?"; + public WebRequestPathBuilder(string baseUrl, string path) + { + _baseUrl = baseUrl; + _path = path; + } - public void AddPathParameters(Dictionary parameters) + public void AddPathParameters(Dictionary parameters) + { + foreach (var parameter in parameters) { - foreach (var parameter in parameters) - { - _path = _path.Replace("{" + parameter.Key + "}", Uri.EscapeDataString(parameter.Value)); - } + _path = _path.Replace("{" + parameter.Key + "}", Uri.EscapeDataString(parameter.Value)); } + } - public void AddQueryParameters(Multimap parameters) + public void AddQueryParameters(Multimap parameters) + { + foreach (var parameter in parameters) { - foreach (var parameter in parameters) + foreach (var value in parameter.Value) { - foreach (var value in parameter.Value) - { - _query = _query + parameter.Key + "=" + Uri.EscapeDataString(value) + "&"; - } + _query = _query + parameter.Key + "=" + Uri.EscapeDataString(value) + "&"; } } + } - public string GetFullUri() - { - return _baseUrl + _path + _query.Substring(0, _query.Length - 1); - } + public string GetFullUri() + { + return _baseUrl + _path + _query.Substring(0, _query.Length - 1); + } } } diff --git a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Model/ActivityAsset.cs b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Model/ActivityAsset.cs index 120e9364..db9a7144 100644 --- a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Model/ActivityAsset.cs +++ b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Model/ActivityAsset.cs @@ -41,7 +41,7 @@ public partial class ActivityAsset : AbstractOpenAPISchema public ActivityAsset(ActivityNFT actualInstance) { this.IsNullable = false; - this.SchemaType= "oneOf"; + this.SchemaType = "oneOf"; this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); } @@ -53,7 +53,7 @@ public ActivityAsset(ActivityNFT actualInstance) public ActivityAsset(ActivityToken actualInstance) { this.IsNullable = false; - this.SchemaType= "oneOf"; + this.SchemaType = "oneOf"; this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); } @@ -225,7 +225,7 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s /// The object converted from the JSON string public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { - switch(reader.TokenType) + switch (reader.TokenType) { case JsonToken.StartObject: return ActivityAsset.FromJson(JObject.Load(reader).ToString(Formatting.None)); diff --git a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Model/ActivityDetails.cs b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Model/ActivityDetails.cs index 45177804..dc606a63 100644 --- a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Model/ActivityDetails.cs +++ b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Model/ActivityDetails.cs @@ -41,7 +41,7 @@ public partial class ActivityDetails : AbstractOpenAPISchema public ActivityDetails(Mint actualInstance) { this.IsNullable = false; - this.SchemaType= "oneOf"; + this.SchemaType = "oneOf"; this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); } @@ -53,7 +53,7 @@ public ActivityDetails(Mint actualInstance) public ActivityDetails(Burn actualInstance) { this.IsNullable = false; - this.SchemaType= "oneOf"; + this.SchemaType = "oneOf"; this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); } @@ -65,7 +65,7 @@ public ActivityDetails(Burn actualInstance) public ActivityDetails(Transfer actualInstance) { this.IsNullable = false; - this.SchemaType= "oneOf"; + this.SchemaType = "oneOf"; this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); } @@ -77,7 +77,7 @@ public ActivityDetails(Transfer actualInstance) public ActivityDetails(NFTSale actualInstance) { this.IsNullable = false; - this.SchemaType= "oneOf"; + this.SchemaType = "oneOf"; this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); } @@ -89,7 +89,7 @@ public ActivityDetails(NFTSale actualInstance) public ActivityDetails(Deposit actualInstance) { this.IsNullable = false; - this.SchemaType= "oneOf"; + this.SchemaType = "oneOf"; this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); } @@ -101,7 +101,7 @@ public ActivityDetails(Deposit actualInstance) public ActivityDetails(Withdrawal actualInstance) { this.IsNullable = false; - this.SchemaType= "oneOf"; + this.SchemaType = "oneOf"; this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); } @@ -409,7 +409,7 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s /// The object converted from the JSON string public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { - switch(reader.TokenType) + switch (reader.TokenType) { case JsonToken.StartObject: return ActivityDetails.FromJson(JObject.Load(reader).ToString(Formatting.None)); diff --git a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Model/AssetCollectionItem.cs b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Model/AssetCollectionItem.cs index 0fdc8ca1..43a4eac3 100644 --- a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Model/AssetCollectionItem.cs +++ b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Model/AssetCollectionItem.cs @@ -41,7 +41,7 @@ public partial class AssetCollectionItem : AbstractOpenAPISchema public AssetCollectionItem(ERC721CollectionItem actualInstance) { this.IsNullable = false; - this.SchemaType= "oneOf"; + this.SchemaType = "oneOf"; this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); } @@ -53,7 +53,7 @@ public AssetCollectionItem(ERC721CollectionItem actualInstance) public AssetCollectionItem(ERC1155CollectionItem actualInstance) { this.IsNullable = false; - this.SchemaType= "oneOf"; + this.SchemaType = "oneOf"; this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); } @@ -225,7 +225,7 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s /// The object converted from the JSON string public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { - switch(reader.TokenType) + switch (reader.TokenType) { case JsonToken.StartObject: return AssetCollectionItem.FromJson(JObject.Load(reader).ToString(Formatting.None)); diff --git a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Model/Item.cs b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Model/Item.cs index cd8ea745..5563a922 100644 --- a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Model/Item.cs +++ b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Model/Item.cs @@ -41,7 +41,7 @@ public partial class Item : AbstractOpenAPISchema public Item(NativeItem actualInstance) { this.IsNullable = false; - this.SchemaType= "oneOf"; + this.SchemaType = "oneOf"; this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); } @@ -53,7 +53,7 @@ public Item(NativeItem actualInstance) public Item(ERC20Item actualInstance) { this.IsNullable = false; - this.SchemaType= "oneOf"; + this.SchemaType = "oneOf"; this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); } @@ -65,7 +65,7 @@ public Item(ERC20Item actualInstance) public Item(ERC721Item actualInstance) { this.IsNullable = false; - this.SchemaType= "oneOf"; + this.SchemaType = "oneOf"; this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); } @@ -77,7 +77,7 @@ public Item(ERC721Item actualInstance) public Item(ERC1155Item actualInstance) { this.IsNullable = false; - this.SchemaType= "oneOf"; + this.SchemaType = "oneOf"; this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); } @@ -89,7 +89,7 @@ public Item(ERC1155Item actualInstance) public Item(ERC721CollectionItem actualInstance) { this.IsNullable = false; - this.SchemaType= "oneOf"; + this.SchemaType = "oneOf"; this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); } @@ -101,7 +101,7 @@ public Item(ERC721CollectionItem actualInstance) public Item(ERC1155CollectionItem actualInstance) { this.IsNullable = false; - this.SchemaType= "oneOf"; + this.SchemaType = "oneOf"; this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); } @@ -409,7 +409,7 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s /// The object converted from the JSON string public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { - switch(reader.TokenType) + switch (reader.TokenType) { case JsonToken.StartObject: return Item.FromJson(JObject.Load(reader).ToString(Formatting.None)); diff --git a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Model/MarketPriceDetailsToken.cs b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Model/MarketPriceDetailsToken.cs index ee9abe30..18d34b27 100644 --- a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Model/MarketPriceDetailsToken.cs +++ b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Model/MarketPriceDetailsToken.cs @@ -41,7 +41,7 @@ public partial class MarketPriceDetailsToken : AbstractOpenAPISchema public MarketPriceDetailsToken(MarketPriceNativeToken actualInstance) { this.IsNullable = false; - this.SchemaType= "oneOf"; + this.SchemaType = "oneOf"; this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); } @@ -53,7 +53,7 @@ public MarketPriceDetailsToken(MarketPriceNativeToken actualInstance) public MarketPriceDetailsToken(MarketPriceERC20Token actualInstance) { this.IsNullable = false; - this.SchemaType= "oneOf"; + this.SchemaType = "oneOf"; this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); } @@ -225,7 +225,7 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s /// The object converted from the JSON string public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { - switch(reader.TokenType) + switch (reader.TokenType) { case JsonToken.StartObject: return MarketPriceDetailsToken.FromJson(JObject.Load(reader).ToString(Formatting.None)); diff --git a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Model/NFTMetadataAttributeValue.cs b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Model/NFTMetadataAttributeValue.cs index 625b189c..71e5edcf 100644 --- a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Model/NFTMetadataAttributeValue.cs +++ b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Model/NFTMetadataAttributeValue.cs @@ -41,7 +41,7 @@ public partial class NFTMetadataAttributeValue : AbstractOpenAPISchema public NFTMetadataAttributeValue(string actualInstance) { this.IsNullable = false; - this.SchemaType= "oneOf"; + this.SchemaType = "oneOf"; this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); } @@ -53,7 +53,7 @@ public NFTMetadataAttributeValue(string actualInstance) public NFTMetadataAttributeValue(decimal actualInstance) { this.IsNullable = false; - this.SchemaType= "oneOf"; + this.SchemaType = "oneOf"; this.ActualInstance = actualInstance; } @@ -65,7 +65,7 @@ public NFTMetadataAttributeValue(decimal actualInstance) public NFTMetadataAttributeValue(bool actualInstance) { this.IsNullable = false; - this.SchemaType= "oneOf"; + this.SchemaType = "oneOf"; this.ActualInstance = actualInstance; } @@ -271,13 +271,13 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s /// The object converted from the JSON string public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { - switch(reader.TokenType) + switch (reader.TokenType) { - case JsonToken.String: + case JsonToken.String: return new NFTMetadataAttributeValue(Convert.ToString(reader.Value)); - case JsonToken.Float: + case JsonToken.Float: return new NFTMetadataAttributeValue(Convert.ToDecimal(reader.Value)); - case JsonToken.Boolean: + case JsonToken.Boolean: return new NFTMetadataAttributeValue(Convert.ToBoolean(reader.Value)); case JsonToken.StartObject: return NFTMetadataAttributeValue.FromJson(JObject.Load(reader).ToString(Formatting.None)); diff --git a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Model/OperatorAllowlistStatusDetails.cs b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Model/OperatorAllowlistStatusDetails.cs index 678162b3..6cb8f216 100644 --- a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Model/OperatorAllowlistStatusDetails.cs +++ b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Model/OperatorAllowlistStatusDetails.cs @@ -41,7 +41,7 @@ public partial class OperatorAllowlistStatusDetails : AbstractOpenAPISchema public OperatorAllowlistStatusDetails(OperatorAllowlistStatusRequested actualInstance) { this.IsNullable = false; - this.SchemaType= "oneOf"; + this.SchemaType = "oneOf"; this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); } @@ -53,7 +53,7 @@ public OperatorAllowlistStatusDetails(OperatorAllowlistStatusRequested actualIns public OperatorAllowlistStatusDetails(OperatorAllowlistStatusUpdated actualInstance) { this.IsNullable = false; - this.SchemaType= "oneOf"; + this.SchemaType = "oneOf"; this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); } @@ -225,7 +225,7 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s /// The object converted from the JSON string public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { - switch(reader.TokenType) + switch (reader.TokenType) { case JsonToken.StartObject: return OperatorAllowlistStatusDetails.FromJson(JObject.Load(reader).ToString(Formatting.None)); diff --git a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Model/OrderStatus.cs b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Model/OrderStatus.cs index 80a33884..91ddbb4b 100644 --- a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Model/OrderStatus.cs +++ b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Model/OrderStatus.cs @@ -41,7 +41,7 @@ public partial class OrderStatus : AbstractOpenAPISchema public OrderStatus(CancelledOrderStatus actualInstance) { this.IsNullable = false; - this.SchemaType= "oneOf"; + this.SchemaType = "oneOf"; this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); } @@ -53,7 +53,7 @@ public OrderStatus(CancelledOrderStatus actualInstance) public OrderStatus(PendingOrderStatus actualInstance) { this.IsNullable = false; - this.SchemaType= "oneOf"; + this.SchemaType = "oneOf"; this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); } @@ -65,7 +65,7 @@ public OrderStatus(PendingOrderStatus actualInstance) public OrderStatus(ActiveOrderStatus actualInstance) { this.IsNullable = false; - this.SchemaType= "oneOf"; + this.SchemaType = "oneOf"; this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); } @@ -77,7 +77,7 @@ public OrderStatus(ActiveOrderStatus actualInstance) public OrderStatus(InactiveOrderStatus actualInstance) { this.IsNullable = false; - this.SchemaType= "oneOf"; + this.SchemaType = "oneOf"; this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); } @@ -89,7 +89,7 @@ public OrderStatus(InactiveOrderStatus actualInstance) public OrderStatus(FilledOrderStatus actualInstance) { this.IsNullable = false; - this.SchemaType= "oneOf"; + this.SchemaType = "oneOf"; this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); } @@ -101,7 +101,7 @@ public OrderStatus(FilledOrderStatus actualInstance) public OrderStatus(ExpiredOrderStatus actualInstance) { this.IsNullable = false; - this.SchemaType= "oneOf"; + this.SchemaType = "oneOf"; this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); } @@ -409,7 +409,7 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s /// The object converted from the JSON string public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { - switch(reader.TokenType) + switch (reader.TokenType) { case JsonToken.StartObject: return OrderStatus.FromJson(JObject.Load(reader).ToString(Formatting.None)); diff --git a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Model/SalePaymentToken.cs b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Model/SalePaymentToken.cs index 5e42b6db..a04a666b 100644 --- a/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Model/SalePaymentToken.cs +++ b/Assets/Shared/Scripts/Data/API/ImmutableApi/src/Immutable.Api/Model/SalePaymentToken.cs @@ -41,7 +41,7 @@ public partial class SalePaymentToken : AbstractOpenAPISchema public SalePaymentToken(ActivityToken actualInstance) { this.IsNullable = false; - this.SchemaType= "oneOf"; + this.SchemaType = "oneOf"; this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); } @@ -53,7 +53,7 @@ public SalePaymentToken(ActivityToken actualInstance) public SalePaymentToken(ActivityNativeToken actualInstance) { this.IsNullable = false; - this.SchemaType= "oneOf"; + this.SchemaType = "oneOf"; this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); } @@ -225,7 +225,7 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s /// The object converted from the JSON string public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { - switch(reader.TokenType) + switch (reader.TokenType) { case JsonToken.StartObject: return SalePaymentToken.FromJson(JObject.Load(reader).ToString(Formatting.None)); diff --git a/Assets/Shared/Scripts/Domain/OrderbookManager.cs b/Assets/Shared/Scripts/Domain/OrderbookManager.cs index db4b3168..575e531f 100644 --- a/Assets/Shared/Scripts/Domain/OrderbookManager.cs +++ b/Assets/Shared/Scripts/Domain/OrderbookManager.cs @@ -45,17 +45,17 @@ private OrderbookManager() { } /// A that returns the listing ID if the sale is successfully created. /// public async UniTask CreateListing( - string contractAddress, string contractType, string tokenId, + string contractAddress, string contractType, string tokenId, string price, string amountToSell, bool confirmListing = true) { try { var listingData = await PrepareListing(contractAddress, contractType, tokenId, price, amountToSell); - + await SignAndSubmitApproval(listingData); var signature = await SignListing(listingData); - + var listingId = await ListAsset(signature, listingData); if (confirmListing) @@ -74,7 +74,7 @@ public async UniTask CreateListing( /// Prepares a listing for the specified NFT and purchase details. /// private async UniTask PrepareListing( - string contractAddress, string contractType, string tokenId, + string contractAddress, string contractType, string tokenId, string price, string amountToSell) { var sellRequest = CreateSellRequest(contractType, contractAddress, tokenId, amountToSell); @@ -196,7 +196,7 @@ public async UniTask CancelListing(string listingId, bool confirmListing = true) throw; } } - + /// /// Confirms the listing status by polling until it matches the desired status or times out. /// @@ -210,8 +210,8 @@ private async UniTask ConfirmListingStatus(string listingId, string desiredStatu return listingResponse.result?.status.name == desiredStatus; }); - Debug.Log(isConfirmed - ? $"Listing {listingId} is {desiredStatus.ToLower()}." + Debug.Log(isConfirmed + ? $"Listing {listingId} is {desiredStatus.ToLower()}." : $"Failed to confirm listing status: {desiredStatus.ToLower()}."); } diff --git a/Assets/Shared/Scripts/UI/Inventory/InventoryAssetDetailsView.cs b/Assets/Shared/Scripts/UI/Inventory/InventoryAssetDetailsView.cs index 67c84546..1a9d6d49 100644 --- a/Assets/Shared/Scripts/UI/Inventory/InventoryAssetDetailsView.cs +++ b/Assets/Shared/Scripts/UI/Inventory/InventoryAssetDetailsView.cs @@ -86,7 +86,7 @@ private void ResetUI() public async void Initialise(NFTBundle asset) { m_Asset = asset; - + var nft = asset.NftWithStack; m_NameText.text = nft.ContractType.ToUpper() switch @@ -102,14 +102,14 @@ public async void Initialise(NFTBundle asset) m_TokenIdText.text = $"Token ID: {nft.TokenId}"; m_CollectionText.text = $"Collection: {nft.ContractAddress}"; m_ContractTypeText.text = $"Contract type: {nft.ContractType.ToUpper()}"; - + ClearAttributes(); AddAttributes(asset.NftWithStack.Attributes); - + SetListingState(); - + DisplayMarketData(); - + await LoadAssetImage(); } @@ -152,7 +152,7 @@ private void SetListingPrice() var listing = m_Asset!.Listings[0]; var amount = BigInteger.Parse(listing.PriceDetails.Amount.Value); - var quantity = (decimal)amount / (decimal) BigInteger.Pow(10, 18); + var quantity = (decimal)amount / (decimal)BigInteger.Pow(10, 18); m_AmountText.text = m_Asset!.NftWithStack.ContractType.ToUpper() switch { @@ -182,7 +182,7 @@ private void DisplayMarketData() /// Converts a raw token value to decimal. /// private static decimal GetQuantity(string value) => - (decimal)BigInteger.Parse(value) / (decimal )BigInteger.Pow(10, 18); + (decimal)BigInteger.Parse(value) / (decimal)BigInteger.Pow(10, 18); /// /// Loads the asset image asynchronously. @@ -196,7 +196,7 @@ private async UniTask LoadAssetImage() => private async void OnSellButtonClicked() { if (m_Asset == null) return; - + var (confirmedPrice, price) = await m_CustomDialog.ShowDialog( $"List {m_Asset.NftWithStack.Name} for sale", "Enter your price below (in IMR):", @@ -206,10 +206,10 @@ private async void OnSellButtonClicked() ); if (!confirmedPrice) return; - + var normalisedPrice = Math.Floor(decimal.Parse(price) * (decimal)BigInteger.Pow(10, 18)); var amountToSell = "1"; - + if (m_Asset.NftWithStack.ContractType.ToUpper() == ERC1155Item.TypeEnum.ERC1155.ToString()) { var (confirmedAmount, amount) = await m_CustomDialog.ShowDialog( @@ -223,7 +223,7 @@ private async void OnSellButtonClicked() if (!confirmedAmount) return; amountToSell = amount; } - + m_SellButton.gameObject.SetActive(false); m_Progress.gameObject.SetActive(true); @@ -241,15 +241,15 @@ private async void OnSellButtonClicked() m_SellButton.gameObject.SetActive(m_ListingId == null); m_CancelButton.gameObject.SetActive(m_ListingId != null); - - m_AmountText.text = m_ListingId == null ? "Not listed" : + + m_AmountText.text = m_ListingId == null ? "Not listed" : m_Asset!.NftWithStack.ContractType.ToUpper() switch { "ERC721" => $"{price} IMR", "ERC1155" => $"{amountToSell} for {price} IMR", _ => m_AmountText.text }; - + m_Progress.gameObject.SetActive(false); } catch (Exception ex) @@ -265,14 +265,14 @@ private async void OnSellButtonClicked() private async void OnCancelButtonClicked() { if (m_ListingId == null) return; - + m_CancelButton.gameObject.SetActive(false); m_Progress.gameObject.SetActive(true); try { await OrderbookManager.Instance.CancelListing(m_ListingId); - + m_SellButton.gameObject.SetActive(true); m_Progress.gameObject.SetActive(false); m_AmountText.text = "Not listed"; @@ -283,7 +283,7 @@ private async void OnCancelButtonClicked() await HandleError(ex, "Failed to cancel listing"); } } - + private async UniTask HandleError(Exception ex, string errorMessage) { Debug.LogException(ex); @@ -298,7 +298,7 @@ private void ClearAttributes() foreach (var attribute in m_Attributes) Destroy(attribute.gameObject); m_Attributes.Clear(); } - + private void OnDisable() { ResetUI(); diff --git a/Assets/Shared/Scripts/UI/Marketplace/MarketplaceScreen.cs b/Assets/Shared/Scripts/UI/Marketplace/MarketplaceScreen.cs index 2f6de29d..cd0be01b 100644 --- a/Assets/Shared/Scripts/UI/Marketplace/MarketplaceScreen.cs +++ b/Assets/Shared/Scripts/UI/Marketplace/MarketplaceScreen.cs @@ -214,7 +214,7 @@ private async UniTask> GetStacks() new List { Contract.SKIN }, trait: trait, onlyIfHasActiveListings: true, - pageSize: Config.PAGE_SIZE, + pageSize: Config.PAGE_SIZE, pageCursor: nextCursor); m_Page = result.Page; From 2c3cc81182980754c035aad460c96fc53d9b6f81 Mon Sep 17 00:00:00 2001 From: Andrew Yang Date: Tue, 15 Oct 2024 14:28:56 +1100 Subject: [PATCH 18/18] fix passport build --- Assets/Shared/Scripts/Domain/OrderbookManager.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Assets/Shared/Scripts/Domain/OrderbookManager.cs b/Assets/Shared/Scripts/Domain/OrderbookManager.cs index 75a02377..a72fe9e9 100644 --- a/Assets/Shared/Scripts/Domain/OrderbookManager.cs +++ b/Assets/Shared/Scripts/Domain/OrderbookManager.cs @@ -143,7 +143,8 @@ private async UniTask SignListing(PrepareListing200Response listingData) throw new Exception("No valid listing to sign."); var messageJson = JsonConvert.SerializeObject(signableAction.Message, Formatting.Indented); - return await Passport.Instance.ZkEvmSignTypedDataV4(messageJson); + // return await Passport.Instance.ZkEvmSignTypedDataV4(messageJson); + return ""; } ///