From b5356375f1185121a4798a0efbf3e91696a9b59f Mon Sep 17 00:00:00 2001 From: robGG1997 Date: Thu, 14 Sep 2023 11:30:11 +0300 Subject: [PATCH 01/26] Revert "automated duplicating imported samples modifications (#595)" This reverts commit a5558941827a91df51e2dd200648dcd13a1231c8. --- .github/workflows/duplicate_sample.yaml | 28 ------------------- duplicate_package_sample.sh | 14 ---------- .../Samples~/Web3.Unity/Prefabs.meta | 8 ------ .../Samples~/Web3.Unity/Scenes.meta | 8 ------ .../Samples~/Web3.Unity/Scripts.meta | 8 ------ .../Samples~/Web3.Unity/Sprites.meta | 8 ------ 6 files changed, 74 deletions(-) delete mode 100644 .github/workflows/duplicate_sample.yaml delete mode 100644 duplicate_package_sample.sh delete mode 100644 src/UnityPackages/io.chainsafe.web3-unity/Samples~/Web3.Unity/Prefabs.meta delete mode 100644 src/UnityPackages/io.chainsafe.web3-unity/Samples~/Web3.Unity/Scenes.meta delete mode 100644 src/UnityPackages/io.chainsafe.web3-unity/Samples~/Web3.Unity/Scripts.meta delete mode 100644 src/UnityPackages/io.chainsafe.web3-unity/Samples~/Web3.Unity/Sprites.meta diff --git a/.github/workflows/duplicate_sample.yaml b/.github/workflows/duplicate_sample.yaml deleted file mode 100644 index 793149e56..000000000 --- a/.github/workflows/duplicate_sample.yaml +++ /dev/null @@ -1,28 +0,0 @@ -name: Duplicate-Package-Sample - -on: - push: - branches: - - main - -jobs: - duplicate: - name: duplicate package sample - runs-on: ubuntu-latest - - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - - name: Run duplicate script file - run: bash ${GITHUB_WORKSPACE}/duplicate_package_sample.sh - - - name: Commit and Push - run: | - git config --global user.email $git_email - git config --global user.name "${{ github.actor }}" - git add ./src/UnityPackages/io.chainsafe.web3-unity/Samples~/Web3.Unity/. -f - git diff-index --cached --quiet HEAD || git commit -m "Auto-duplicate Package Samples" - git push - env: - git_email: "${{ github.actor }}@users.noreply.github.com" \ No newline at end of file diff --git a/duplicate_package_sample.sh b/duplicate_package_sample.sh deleted file mode 100644 index f3a677742..000000000 --- a/duplicate_package_sample.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -# Specify the source directory and the destination directory -SOURCE_DIRECTORY="src/UnitySampleProject/Assets/Samples/web3.unity SDK/2.5.0-pre001/Web3.Unity Samples/" -DESTINATION_DIRECTORY="src/UnityPackages/io.chainsafe.web3-unity/Samples~/Web3.Unity/" - -# clear destination directory first -rm -r "$DESTINATION_DIRECTORY" - -# Copy source to the destination -cp -r "$SOURCE_DIRECTORY" "$DESTINATION_DIRECTORY" - -#add all modified files -git add "src/UnityPackages/io.chainsafe.web3-unity/Samples~/Web3.Unity/." -f \ No newline at end of file diff --git a/src/UnityPackages/io.chainsafe.web3-unity/Samples~/Web3.Unity/Prefabs.meta b/src/UnityPackages/io.chainsafe.web3-unity/Samples~/Web3.Unity/Prefabs.meta deleted file mode 100644 index 5b35daff8..000000000 --- a/src/UnityPackages/io.chainsafe.web3-unity/Samples~/Web3.Unity/Prefabs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 45a04d2621549e3458049c6c447c3941 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/src/UnityPackages/io.chainsafe.web3-unity/Samples~/Web3.Unity/Scenes.meta b/src/UnityPackages/io.chainsafe.web3-unity/Samples~/Web3.Unity/Scenes.meta deleted file mode 100644 index 5488a62ed..000000000 --- a/src/UnityPackages/io.chainsafe.web3-unity/Samples~/Web3.Unity/Scenes.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: f39f8dda9616349489a7803d7e0aff30 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/src/UnityPackages/io.chainsafe.web3-unity/Samples~/Web3.Unity/Scripts.meta b/src/UnityPackages/io.chainsafe.web3-unity/Samples~/Web3.Unity/Scripts.meta deleted file mode 100644 index 9a1e8b8d4..000000000 --- a/src/UnityPackages/io.chainsafe.web3-unity/Samples~/Web3.Unity/Scripts.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: eaef630f284e6e04a88b5939e0eb1cc5 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/src/UnityPackages/io.chainsafe.web3-unity/Samples~/Web3.Unity/Sprites.meta b/src/UnityPackages/io.chainsafe.web3-unity/Samples~/Web3.Unity/Sprites.meta deleted file mode 100644 index 7175ee89d..000000000 --- a/src/UnityPackages/io.chainsafe.web3-unity/Samples~/Web3.Unity/Sprites.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 0c06517aee7843642a091a67c72b1379 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: From cd514db5c9d0bb82e069293c669733864d41544e Mon Sep 17 00:00:00 2001 From: robGG1997 Date: Wed, 7 Feb 2024 13:35:15 +0300 Subject: [PATCH 02/26] made main package testable, revert due to a mistake --- src/UnitySampleProject/Packages/manifest.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/UnitySampleProject/Packages/manifest.json b/src/UnitySampleProject/Packages/manifest.json index 08c0ac92f..22a37ba40 100644 --- a/src/UnitySampleProject/Packages/manifest.json +++ b/src/UnitySampleProject/Packages/manifest.json @@ -47,5 +47,8 @@ "com.unity.modules.wind": "1.0.0", "com.unity.modules.xr": "1.0.0", "com.tools.webglthreadingpatcher": "https://github.com/VolodymyrBS/WebGLThreadingPatcher.git" - } + }, + "testables": [ + "io.chainsafe.web3-unity" + ] } \ No newline at end of file From b2588bc6092461b3b18547418359bf00594be794 Mon Sep 17 00:00:00 2001 From: oleksandrchainsafe <127766834+oleksandrchainsafe@users.noreply.github.com> Date: Tue, 4 Jun 2024 14:04:27 +0100 Subject: [PATCH 03/26] Updated readme URI pointing at script examples (#1005) Updated URI pointing at script examples Co-authored-by: creeppak <=> --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 543e8f5fc..c67648cdf 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [Twitter](https://twitter.com/chainsafeth) ## Documentation -You can access the full docs at [docs.gaming.chainsafe.io](https://docs.gaming.chainsafe.io) +You can access the full docs at [docs.gaming.chainsafe.io](https://docs.gaming.chainsafe.io). Our codebase is quite easy to use. This is an example of accessing player balance and calling a write method of a custom Smart Contract within Unity. @@ -24,7 +24,7 @@ async void Awake() } ``` -Additional prefab scripts can be found here https://docs.gaming.chainsafe.io/current/prefab-scripts#contract-call +Additional prefab scripts can be found here [docs.gaming.chainsafe.io/current/sample-scripts](https://docs.gaming.chainsafe.io/current/sample-scripts). ## Support - Need help with web3.unity or found a bug? Be sure to read the documentation above, then review existing issues or create a new one [here](https://github.com/ChainSafe/web3.unity/issues). This is the best way to get help from the ChainSafe Gaming team. From fef31f987552191f7421c42e71b35ed229915ca2 Mon Sep 17 00:00:00 2001 From: rob1997 Date: Thu, 27 Jun 2024 15:23:54 +0300 Subject: [PATCH 04/26] publish dependencies Data and CI updated, time to test --- .github/workflows/check_and_commit.yml | 31 ++++---- .../post_push_checks_and_commits.yml | 4 +- scripts/data/published_dependencies.txt | 76 ++++++++++++++++++- 3 files changed, 90 insertions(+), 21 deletions(-) diff --git a/.github/workflows/check_and_commit.yml b/.github/workflows/check_and_commit.yml index 2eade7446..8291138ba 100644 --- a/.github/workflows/check_and_commit.yml +++ b/.github/workflows/check_and_commit.yml @@ -69,26 +69,25 @@ jobs: export DLL_META_FILE_TEMPLATE="${{ vars.DLL_META_FILE_TEMPLATE }}" + export PACKAGE_LIB_PATH= + while IFS= read -r entry || [ -n "$entry" ]; do - IFS=':' read -ra dirs <<< "$entry" - export PACKAGE_LIB_PATH="${GITHUB_WORKSPACE}/${dirs[0]}" - - if [ -d "$PACKAGE_LIB_PATH" ]; then - rm "$PACKAGE_LIB_PATH"*.dll + if [[ $entry == *: ]] + then + PACKAGE_LIB_PATH="${GITHUB_WORKSPACE}/${entry%:}" + if [ -d "$PACKAGE_LIB_PATH" ]; then + rm "$PACKAGE_LIB_PATH"*.dll + else + mkdir -p "$PACKAGE_LIB_PATH" + fi else - mkdir -p "$PACKAGE_LIB_PATH" - fi - - IFS=';' read -ra dependencies <<< "${dirs[1]}" - - for dependency in "${dependencies[@]}" - do - cp "$PUBLISH_PATH/$dependency.dll" $PACKAGE_LIB_PATH - if ! [ -f "$PACKAGE_LIB_PATH$dependency.dll.meta" ]; then - echo -e "${DLL_META_FILE_TEMPLATE/"[[assetGuid]]"/"$(uuidgen | tr -d '-')"}" >> "$PACKAGE_LIB_PATH$dependency.dll.meta" + export DEPENDENCY=$(echo "$entry" | tr -d '\t' | tr -d ' ') + cp "$PUBLISH_PATH/$DEPENDENCY" $PACKAGE_LIB_PATH + if ! [ -f "$PACKAGE_LIB_PATH$DEPENDENCY.meta" ]; then + echo -e "${DLL_META_FILE_TEMPLATE/"[[assetGuid]]"/"$(uuidgen | tr -d '-')"}" >> "$PACKAGE_LIB_PATH$DEPENDENCY.meta" fi - done + fi git add "$PACKAGE_LIB_PATH." -f done < "${GITHUB_WORKSPACE}/scripts/data/published_dependencies.txt" diff --git a/.github/workflows/post_push_checks_and_commits.yml b/.github/workflows/post_push_checks_and_commits.yml index 5cd430cf3..b326e28ff 100644 --- a/.github/workflows/post_push_checks_and_commits.yml +++ b/.github/workflows/post_push_checks_and_commits.yml @@ -2,10 +2,10 @@ name: Post Push Checks and Commits on: push: - branches: [ dev ] + branches: [ rob/scripts-data-formatting-1015 ] jobs: check_and_commit: name: Check and Commit - uses: ChainSafe/web3.unity/.github/workflows/check_and_commit.yml@main + uses: ChainSafe/web3.unity/.github/workflows/check_and_commit.yml@rob/scripts-data-formatting-1015 secrets: inherit \ No newline at end of file diff --git a/scripts/data/published_dependencies.txt b/scripts/data/published_dependencies.txt index 284c36f465..4df86257a 100644 --- a/scripts/data/published_dependencies.txt +++ b/scripts/data/published_dependencies.txt @@ -1,3 +1,73 @@ -Packages/io.chainsafe.web3-unity/Runtime/Libraries/:ADRaffy.ENSNormalize;Nethereum.Model;BouncyCastle.Crypto;Nethereum.RLP;ChainSafe.Gaming.Debugging;Nethereum.RPC;ChainSafe.Gaming.Gelato;ChainSafe.Gaming.SygmaClient;Nethereum.Signer.EIP712;ChainSafe.Gaming.InProcessSigner;Nethereum.Signer;ChainSafe.Gaming.InProcessTransactionExecutor;Nethereum.Util;ChainSafe.Gaming.Unity.ThirdParty;Nethereum.Web3;ChainSafe.Gaming.Unity;System.Buffers;ChainSafe.Gaming.WalletConnect;System.Memory;ChainSafe.Gaming;System.Numerics.Vectors;Microsoft.Bcl.AsyncInterfaces;System.Reactive;Microsoft.Extensions.DependencyInjection.Abstractions;System.Runtime.CompilerServices.Unsafe;Microsoft.Extensions.DependencyInjection;System.Runtime.InteropServices.WindowsRuntime;Microsoft.Extensions.Logging.Abstractions;System.Security.Cryptography.Cng;Microsoft.IdentityModel.Abstractions;System.Text.Encodings.Web;Microsoft.IdentityModel.Logging;System.Text.Json;Microsoft.IdentityModel.Tokens;System.Threading.Channels;NBitcoin;System.Threading.Tasks.Extensions;Nethereum.ABI;WalletConnectSharp.Auth;Nethereum.Accounts;WalletConnectSharp.Common;WalletConnectSharp.Events;Nethereum.BlockchainProcessing;WalletConnectSharp.Core;Nethereum.Contracts;WalletConnectSharp.Crypto;Nethereum.Hex;Nethereum.JsonRpc.Client;WalletConnectSharp.Network.Websocket;Nethereum.JsonRpc.IpcClient;WalletConnectSharp.Network;Nethereum.JsonRpc.RpcClient;WalletConnectSharp.Sign;Nethereum.KeyStore;WalletConnectSharp.Storage;Nethereum.Merkle.Patricia;WalletConnectSharp.Web3Wallet;Nethereum.Merkle;Websocket.Client;Nethereum.Metamask;Nethereum.Siwe.Core;Nethereum.Siwe;Nethereum.UI;Nethereum.Unity.Metamask;Nethereum.Unity;ChainSafe.Gaming.MetaMask.Unity;ChainSafe.Gaming.Marketplace -Packages/io.chainsafe.web3-unity.lootboxes/Chainlink/Runtime/Libraries/:Chainsafe.Gaming.Chainlink;ChainSafe.Gaming.Lootboxes.Chainlink -Packages/io.chainsafe.web3-unity.hyperplay/Runtime/Libraries/:ChainSafe.Gaming.HyperPlay \ No newline at end of file +Packages/io.chainsafe.web3-unity/Runtime/Libraries/: + ADRaffy.ENSNormalize.dll + Nethereum.Model.dll + BouncyCastle.Crypto.dll + Nethereum.RLP.dll + ChainSafe.Gaming.Debugging.dll + Nethereum.RPC.dll + ChainSafe.Gaming.Gelato.dll + ChainSafe.Gaming.SygmaClient.dll + Nethereum.Signer.EIP712.dll + ChainSafe.Gaming.InProcessSigner.dll + Nethereum.Signer.dll + ChainSafe.Gaming.InProcessTransactionExecutor.dll + Nethereum.Util.dll + ChainSafe.Gaming.Unity.ThirdParty.dll + Nethereum.Web3.dll + ChainSafe.Gaming.Unity.dll + System.Buffers.dll + ChainSafe.Gaming.WalletConnect.dll + System.Memory.dll + ChainSafe.Gaming.dll + System.Numerics.Vectors.dll + Microsoft.Bcl.AsyncInterfaces.dll + System.Reactive.dll + Microsoft.Extensions.DependencyInjection.Abstractions.dll + System.Runtime.CompilerServices.Unsafe.dll + Microsoft.Extensions.DependencyInjection.dll + System.Runtime.InteropServices.WindowsRuntime.dll + Microsoft.Extensions.Logging.Abstractions.dll + System.Security.Cryptography.Cng.dll + Microsoft.IdentityModel.Abstractions.dll + System.Text.Encodings.Web.dll + Microsoft.IdentityModel.Logging.dll + System.Text.Json.dll + Microsoft.IdentityModel.Tokens.dll + System.Threading.Channels.dll + NBitcoin.dll + System.Threading.Tasks.Extensions.dll + Nethereum.ABI.dll + WalletConnectSharp.Auth.dll + Nethereum.Accounts.dll + WalletConnectSharp.Common.dll + WalletConnectSharp.Events.dll + Nethereum.BlockchainProcessing.dll + WalletConnectSharp.Core.dll + Nethereum.Contracts.dll + WalletConnectSharp.Crypto.dll + Nethereum.Hex.dll + Nethereum.JsonRpc.Client.dll + WalletConnectSharp.Network.Websocket.dll + Nethereum.JsonRpc.IpcClient.dll + WalletConnectSharp.Network.dll + Nethereum.JsonRpc.RpcClient.dll + WalletConnectSharp.Sign.dll + Nethereum.KeyStore.dll + WalletConnectSharp.Storage.dll + Nethereum.Merkle.Patricia.dll + WalletConnectSharp.Web3Wallet.dll + Nethereum.Merkle.dll + Websocket.Client.dll + Nethereum.Metamask.dll + Nethereum.Siwe.Core.dll + Nethereum.Siwe.dll + Nethereum.UI.dll + Nethereum.Unity.Metamask.dll + Nethereum.Unity.dll + ChainSafe.Gaming.MetaMask.Unity.dll + ChainSafe.Gaming.Marketplace.dll +Packages/io.chainsafe.web3-unity.lootboxes/Chainlink/Runtime/Libraries/: + Chainsafe.Gaming.Chainlink.dll + ChainSafe.Gaming.Lootboxes.Chainlink.dll +Packages/io.chainsafe.web3-unity.hyperplay/Runtime/Libraries/: + ChainSafe.Gaming.HyperPlay.dll \ No newline at end of file From e5ee43b274d90d5b45aeb818d0a5519cf6630251 Mon Sep 17 00:00:00 2001 From: rob1997 Date: Thu, 27 Jun 2024 15:33:27 +0300 Subject: [PATCH 05/26] skip tests and make push happen --- .github/workflows/check_and_commit.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check_and_commit.yml b/.github/workflows/check_and_commit.yml index 8291138ba..de2556590 100644 --- a/.github/workflows/check_and_commit.yml +++ b/.github/workflows/check_and_commit.yml @@ -89,7 +89,7 @@ jobs: fi fi - git add "$PACKAGE_LIB_PATH." -f + git add "$PACKAGE_LIB_PATH$DEPENDENCY" -f done < "${GITHUB_WORKSPACE}/scripts/data/published_dependencies.txt" - uses: actions/cache@v2 with: @@ -98,6 +98,7 @@ jobs: restore-keys: | Library- - uses: game-ci/unity-test-runner@v3 + if: ${{ github.ref_name == 'dev' }} id: tests env: UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} @@ -120,7 +121,7 @@ jobs: name: Coverage results for ${{ matrix.testMode }} path: ${{ steps.tests.outputs.coveragePath }} - name: Commit and Push changes - if: ${{ github.ref_name == 'dev' }} + if: ${{ github.ref_name == 'rob/scripts-data-formatting-1015' }} run: | git diff-index --cached --quiet HEAD || git commit -m 'Auto Commit [skip ci] - Duplicate Packages Samples From 888aaadb5d19126573e674ad1390b33587c8a8f1 Mon Sep 17 00:00:00 2001 From: rob1997 Date: Thu, 27 Jun 2024 15:35:44 +0300 Subject: [PATCH 06/26] git add path fix --- .github/workflows/check_and_commit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check_and_commit.yml b/.github/workflows/check_and_commit.yml index de2556590..0e8e3a739 100644 --- a/.github/workflows/check_and_commit.yml +++ b/.github/workflows/check_and_commit.yml @@ -89,7 +89,7 @@ jobs: fi fi - git add "$PACKAGE_LIB_PATH$DEPENDENCY" -f + git add "$PACKAGE_LIB_PATH." -f done < "${GITHUB_WORKSPACE}/scripts/data/published_dependencies.txt" - uses: actions/cache@v2 with: From 8102db0064148e584ffe3b0da1ee3e5f074a2a39 Mon Sep 17 00:00:00 2001 From: rob1997 Date: Thu, 27 Jun 2024 15:37:46 +0300 Subject: [PATCH 07/26] more ifs --- .github/workflows/check_and_commit.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check_and_commit.yml b/.github/workflows/check_and_commit.yml index 0e8e3a739..07fc68ca7 100644 --- a/.github/workflows/check_and_commit.yml +++ b/.github/workflows/check_and_commit.yml @@ -111,12 +111,12 @@ jobs: checkName: ${{ matrix.testMode }} Test Results coverageOptions: 'generateAdditionalMetrics;generateHtmlReport;generateBadgeReport;' - uses: actions/upload-artifact@v3 - if: always() + if: ${{ github.ref_name == 'dev' }} with: name: Test results for ${{ matrix.testMode }} path: ${{ steps.tests.outputs.artifactsPath }} - uses: actions/upload-artifact@v3 - if: always() + if: ${{ github.ref_name == 'dev' }} with: name: Coverage results for ${{ matrix.testMode }} path: ${{ steps.tests.outputs.coveragePath }} From 2c5a3840dff54e627a136fcee068c4e7511ab81b Mon Sep 17 00:00:00 2001 From: rob1997 Date: Thu, 27 Jun 2024 17:32:24 +0300 Subject: [PATCH 08/26] duplicate_samples new format and CI --- .github/workflows/check_and_commit.yml | 35 +++++++++++++++----------- scripts/data/duplicate_samples.txt | 24 +++++++++++++----- 2 files changed, 39 insertions(+), 20 deletions(-) diff --git a/.github/workflows/check_and_commit.yml b/.github/workflows/check_and_commit.yml index 07fc68ca7..7a8ddb1ed 100644 --- a/.github/workflows/check_and_commit.yml +++ b/.github/workflows/check_and_commit.yml @@ -33,20 +33,27 @@ jobs: while IFS= read -r entry || [ -n "$entry" ]; do - - IFS=':' read -ra dirs <<< "$entry" - SOURCE_PATH=${dirs[0]} - DESTINATION_DIRECTORY=${dirs[1]} - - SOURCE_PATH="${GITHUB_WORKSPACE}/$SOURCE_PATH/$(ls "$SOURCE_PATH" | head -n 1)/$DESTINATION_DIRECTORY" - - DESTINATION_PATH="${GITHUB_WORKSPACE}/${dirs[2]}" - - rm -rf "$DESTINATION_PATH" - mkdir -p "$DESTINATION_PATH" - cp -r "$SOURCE_PATH/." "$DESTINATION_PATH" - - git add "$DESTINATION_PATH." -f + source_prefix="source:" + display_name_prefix="display_name:" + destination_prefix="destination:" + + entry=$(echo "$entry" | tr -d '\t' | tr -d ' ') + + if [[ $entry = $source_prefix* ]] + then + SOURCE_PATH=${entry#"$source_prefix"} + elif [[ $entry = $display_name_prefix* ]] + then + DESTINATION_DIRECTORY=${entry#"$display_name_prefix"} + SOURCE_PATH="${GITHUB_WORKSPACE}/$SOURCE_PATH/$(ls "$SOURCE_PATH" | head -n 1)/$DESTINATION_DIRECTORY" + elif [[ $entry = $destination_prefix* ]] + then + DESTINATION_PATH="${GITHUB_WORKSPACE}/${entry#"$destination_prefix"}" + rm -rf "$DESTINATION_PATH" + mkdir -p "$DESTINATION_PATH" + cp -r "$SOURCE_PATH/." "$DESTINATION_PATH" + git add "$DESTINATION_PATH." -f + fi done < "${GITHUB_WORKSPACE}/scripts/data/duplicate_samples.txt" - name: update submodules # clone submodules diff --git a/scripts/data/duplicate_samples.txt b/scripts/data/duplicate_samples.txt index f4dc1d088..5d10c352b 100644 --- a/scripts/data/duplicate_samples.txt +++ b/scripts/data/duplicate_samples.txt @@ -1,6 +1,18 @@ -src/UnitySampleProject/Assets/Samples/web3.unity SDK:Web3.Unity Samples:Packages/io.chainsafe.web3-unity/Samples~/Web3.Unity/ -src/UnitySampleProject/Assets/Samples/web3.unity SDK Web3Auth:Web3Auth Samples:Packages/io.chainsafe.web3-unity.web3auth/Samples~/Web3.Unity Web3Auth/ -src/UnitySampleProject/Assets/Samples/web3.unity SDK Lootboxes:Lootboxes Samples:Packages/io.chainsafe.web3-unity.lootboxes/Samples~/Web3.Unity Chainlink Lootboxes/ -src/UnitySampleProject/Assets/Samples/web3.unity SDK Ramp:Ramp Samples:Packages/io.chainsafe.web3-unity.ramp/Samples~/Web3.Unity Ramp/ -src/UnitySampleProject/Assets/Samples/web3.unity SDK HyperPlay:HyperPlay Samples:Packages/io.chainsafe.web3-unity.hyperplay/Samples~/Web3.Unity HyperPlay/ -src/UnitySampleProject/Assets/Samples/web3.unity SDK Marketplace:Marketplace Samples:Packages/io.chainsafe.web3-unity.marketplace/Samples~/Web3.Unity Marketplace/ \ No newline at end of file +source:src/UnitySampleProject/Assets/Samples/web3.unity SDK + display_name:Web3.Unity Samples + destination:Packages/io.chainsafe.web3-unity/Samples~/Web3.Unity/ +source:src/UnitySampleProject/Assets/Samples/web3.unity SDK Web3Auth + display_name:Web3Auth Samples + destination:Packages/io.chainsafe.web3-unity.web3auth/Samples~/Web3.Unity Web3Auth/ +source:src/UnitySampleProject/Assets/Samples/web3.unity SDK Lootboxes + display_name:Lootboxes Samples + destination:Packages/io.chainsafe.web3-unity.lootboxes/Samples~/Web3.Unity Chainlink Lootboxes/ +source:src/UnitySampleProject/Assets/Samples/web3.unity SDK Ramp + display_name:Ramp Samples + destination:Packages/io.chainsafe.web3-unity.ramp/Samples~/Web3.Unity Ramp/ +source:src/UnitySampleProject/Assets/Samples/web3.unity SDK HyperPlay + display_name:HyperPlay Samples + destination:Packages/io.chainsafe.web3-unity.hyperplay/Samples~/Web3.Unity HyperPlay/ +source:src/UnitySampleProject/Assets/Samples/web3.unity SDK Marketplace + display_name:Marketplace Samples + destination:Packages/io.chainsafe.web3-unity.marketplace/Samples~/Web3.Unity Marketplace/ \ No newline at end of file From 6c4bce68c2ac6a8c9ed905e5265eba3d88073ee3 Mon Sep 17 00:00:00 2001 From: rob1997 Date: Thu, 27 Jun 2024 18:27:17 +0300 Subject: [PATCH 09/26] directory error fix --- .github/workflows/check_and_commit.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check_and_commit.yml b/.github/workflows/check_and_commit.yml index 7a8ddb1ed..ca4c13a50 100644 --- a/.github/workflows/check_and_commit.yml +++ b/.github/workflows/check_and_commit.yml @@ -41,11 +41,11 @@ jobs: if [[ $entry = $source_prefix* ]] then - SOURCE_PATH=${entry#"$source_prefix"} + SOURCE_PATH="${GITHUB_WORKSPACE}/{entry#"$source_prefix"}" elif [[ $entry = $display_name_prefix* ]] then DESTINATION_DIRECTORY=${entry#"$display_name_prefix"} - SOURCE_PATH="${GITHUB_WORKSPACE}/$SOURCE_PATH/$(ls "$SOURCE_PATH" | head -n 1)/$DESTINATION_DIRECTORY" + SOURCE_PATH="$SOURCE_PATH/$(ls "$SOURCE_PATH" | head -n 1)/$DESTINATION_DIRECTORY" elif [[ $entry = $destination_prefix* ]] then DESTINATION_PATH="${GITHUB_WORKSPACE}/${entry#"$destination_prefix"}" From 9379b1e6e7918578ac1267e2ff54de1cbc57edaa Mon Sep 17 00:00:00 2001 From: rob1997 Date: Thu, 27 Jun 2024 18:28:02 +0300 Subject: [PATCH 10/26] typo fix --- .github/workflows/check_and_commit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check_and_commit.yml b/.github/workflows/check_and_commit.yml index ca4c13a50..29576314f 100644 --- a/.github/workflows/check_and_commit.yml +++ b/.github/workflows/check_and_commit.yml @@ -41,7 +41,7 @@ jobs: if [[ $entry = $source_prefix* ]] then - SOURCE_PATH="${GITHUB_WORKSPACE}/{entry#"$source_prefix"}" + SOURCE_PATH="${GITHUB_WORKSPACE}/${entry#"$source_prefix"}" elif [[ $entry = $display_name_prefix* ]] then DESTINATION_DIRECTORY=${entry#"$display_name_prefix"} From 6e0624fcbcef388ab6b99bc2ff5bdb5de22ff80b Mon Sep 17 00:00:00 2001 From: rob1997 Date: Thu, 27 Jun 2024 18:29:55 +0300 Subject: [PATCH 11/26] source path fix --- .github/workflows/check_and_commit.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check_and_commit.yml b/.github/workflows/check_and_commit.yml index 29576314f..b60ed86ff 100644 --- a/.github/workflows/check_and_commit.yml +++ b/.github/workflows/check_and_commit.yml @@ -41,11 +41,11 @@ jobs: if [[ $entry = $source_prefix* ]] then - SOURCE_PATH="${GITHUB_WORKSPACE}/${entry#"$source_prefix"}" + SOURCE_PATH="${GITHUB_WORKSPACE}/${entry#"$source_prefix"}/" elif [[ $entry = $display_name_prefix* ]] then DESTINATION_DIRECTORY=${entry#"$display_name_prefix"} - SOURCE_PATH="$SOURCE_PATH/$(ls "$SOURCE_PATH" | head -n 1)/$DESTINATION_DIRECTORY" + SOURCE_PATH="$SOURCE_PATH$(ls "$SOURCE_PATH" | head -n 1)/$DESTINATION_DIRECTORY" elif [[ $entry = $destination_prefix* ]] then DESTINATION_PATH="${GITHUB_WORKSPACE}/${entry#"$destination_prefix"}" From ab1603f779650c55da27fe3ab10c9b64cf533070 Mon Sep 17 00:00:00 2001 From: rob1997 Date: Thu, 27 Jun 2024 18:31:17 +0300 Subject: [PATCH 12/26] remove trimming spaces --- .github/workflows/check_and_commit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check_and_commit.yml b/.github/workflows/check_and_commit.yml index b60ed86ff..7dc1f4a38 100644 --- a/.github/workflows/check_and_commit.yml +++ b/.github/workflows/check_and_commit.yml @@ -37,7 +37,7 @@ jobs: display_name_prefix="display_name:" destination_prefix="destination:" - entry=$(echo "$entry" | tr -d '\t' | tr -d ' ') + entry=$(echo "$entry" | tr -d '\t') if [[ $entry = $source_prefix* ]] then From 4939c2f0797d938324ec01ac3d936e153ba2eb6d Mon Sep 17 00:00:00 2001 From: rob1997 Date: Thu, 27 Jun 2024 18:33:13 +0300 Subject: [PATCH 13/26] maybe spaces was the problem all along --- .github/workflows/check_and_commit.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check_and_commit.yml b/.github/workflows/check_and_commit.yml index 7dc1f4a38..4a222262d 100644 --- a/.github/workflows/check_and_commit.yml +++ b/.github/workflows/check_and_commit.yml @@ -41,11 +41,11 @@ jobs: if [[ $entry = $source_prefix* ]] then - SOURCE_PATH="${GITHUB_WORKSPACE}/${entry#"$source_prefix"}/" + SOURCE_PATH=${entry#"$source_prefix"} elif [[ $entry = $display_name_prefix* ]] then DESTINATION_DIRECTORY=${entry#"$display_name_prefix"} - SOURCE_PATH="$SOURCE_PATH$(ls "$SOURCE_PATH" | head -n 1)/$DESTINATION_DIRECTORY" + SOURCE_PATH="${GITHUB_WORKSPACE}/$SOURCE_PATH/$(ls "$SOURCE_PATH" | head -n 1)/$DESTINATION_DIRECTORY" elif [[ $entry = $destination_prefix* ]] then DESTINATION_PATH="${GITHUB_WORKSPACE}/${entry#"$destination_prefix"}" From dbf388fe342087c1a4af877cc3a730d7ac392fb8 Mon Sep 17 00:00:00 2001 From: rob1997 Date: Thu, 27 Jun 2024 18:36:04 +0300 Subject: [PATCH 14/26] sample duplicate testing --- .../1.0.0/HyperPlay Samples/Scripts/HyperPlayLoginProvider.cs | 2 +- .../2.6.0/Lootboxes Samples/Scripts/Scene/LootBoxScene.cs | 1 + .../2.6.0/Web3Auth Samples/Scripts/Web3AuthLoginProvider.cs | 2 +- .../Scripts/Scenes/WalletConnectLoginProvider.cs | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/UnitySampleProject/Assets/Samples/web3.unity SDK HyperPlay/1.0.0/HyperPlay Samples/Scripts/HyperPlayLoginProvider.cs b/src/UnitySampleProject/Assets/Samples/web3.unity SDK HyperPlay/1.0.0/HyperPlay Samples/Scripts/HyperPlayLoginProvider.cs index 93263321f..1c8075322 100644 --- a/src/UnitySampleProject/Assets/Samples/web3.unity SDK HyperPlay/1.0.0/HyperPlay Samples/Scripts/HyperPlayLoginProvider.cs +++ b/src/UnitySampleProject/Assets/Samples/web3.unity SDK HyperPlay/1.0.0/HyperPlay Samples/Scripts/HyperPlayLoginProvider.cs @@ -8,7 +8,7 @@ using UnityEngine.UI; /// -/// Login using HyperPlay desktop client. +/// Login using HyperPlay desktop client.Test /// public class HyperPlayLoginProvider : LoginProvider, IWeb3BuilderServiceAdapter { diff --git a/src/UnitySampleProject/Assets/Samples/web3.unity SDK Lootboxes/2.6.0/Lootboxes Samples/Scripts/Scene/LootBoxScene.cs b/src/UnitySampleProject/Assets/Samples/web3.unity SDK Lootboxes/2.6.0/Lootboxes Samples/Scripts/Scene/LootBoxScene.cs index 7f0e40c24..d712e9389 100644 --- a/src/UnitySampleProject/Assets/Samples/web3.unity SDK Lootboxes/2.6.0/Lootboxes Samples/Scripts/Scene/LootBoxScene.cs +++ b/src/UnitySampleProject/Assets/Samples/web3.unity SDK Lootboxes/2.6.0/Lootboxes Samples/Scripts/Scene/LootBoxScene.cs @@ -7,6 +7,7 @@ namespace LootBoxes.Chainlink.Scene { + //Test public class LootBoxScene : MonoBehaviour { public Animator animator; diff --git a/src/UnitySampleProject/Assets/Samples/web3.unity SDK Web3Auth/2.6.0/Web3Auth Samples/Scripts/Web3AuthLoginProvider.cs b/src/UnitySampleProject/Assets/Samples/web3.unity SDK Web3Auth/2.6.0/Web3Auth Samples/Scripts/Web3AuthLoginProvider.cs index edc077ae9..95e183bb2 100644 --- a/src/UnitySampleProject/Assets/Samples/web3.unity SDK Web3Auth/2.6.0/Web3Auth Samples/Scripts/Web3AuthLoginProvider.cs +++ b/src/UnitySampleProject/Assets/Samples/web3.unity SDK Web3Auth/2.6.0/Web3Auth Samples/Scripts/Web3AuthLoginProvider.cs @@ -13,7 +13,7 @@ using Network = Web3Auth.Network; /// -/// Login using Web3Auth. +/// Login using Web3Auth.Test /// public class Web3AuthLoginProvider : LoginProvider, IWeb3BuilderServiceAdapter { diff --git a/src/UnitySampleProject/Assets/Samples/web3.unity SDK/2.6.0/Web3.Unity Samples/Scripts/Scenes/WalletConnectLoginProvider.cs b/src/UnitySampleProject/Assets/Samples/web3.unity SDK/2.6.0/Web3.Unity Samples/Scripts/Scenes/WalletConnectLoginProvider.cs index 8c7673cd3..cfcdf63d0 100644 --- a/src/UnitySampleProject/Assets/Samples/web3.unity SDK/2.6.0/Web3.Unity Samples/Scripts/Scenes/WalletConnectLoginProvider.cs +++ b/src/UnitySampleProject/Assets/Samples/web3.unity SDK/2.6.0/Web3.Unity Samples/Scripts/Scenes/WalletConnectLoginProvider.cs @@ -7,7 +7,7 @@ using UnityEngine.UI; /// -/// Login using an existing wallet with WalletConnect. +/// Login using an existing wallet with WalletConnect.Test /// public class WalletConnectLoginProvider : LoginProvider, IWeb3BuilderServiceAdapter { From f1624837e11318de0f264ec9dc963beb4a468762 Mon Sep 17 00:00:00 2001 From: rob1997 Date: Thu, 27 Jun 2024 18:40:41 +0300 Subject: [PATCH 15/26] added some echoes --- .github/workflows/check_and_commit.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/check_and_commit.yml b/.github/workflows/check_and_commit.yml index 4a222262d..6b571eaf3 100644 --- a/.github/workflows/check_and_commit.yml +++ b/.github/workflows/check_and_commit.yml @@ -46,11 +46,13 @@ jobs: then DESTINATION_DIRECTORY=${entry#"$display_name_prefix"} SOURCE_PATH="${GITHUB_WORKSPACE}/$SOURCE_PATH/$(ls "$SOURCE_PATH" | head -n 1)/$DESTINATION_DIRECTORY" + echo "Source Path: $SOURCE_PATH" elif [[ $entry = $destination_prefix* ]] then DESTINATION_PATH="${GITHUB_WORKSPACE}/${entry#"$destination_prefix"}" rm -rf "$DESTINATION_PATH" mkdir -p "$DESTINATION_PATH" + echo "Copying $SOURCE_PATH to $DESTINATION_PATH" cp -r "$SOURCE_PATH/." "$DESTINATION_PATH" git add "$DESTINATION_PATH." -f fi From 646a52116916162c50d766d251233da98926b5cd Mon Sep 17 00:00:00 2001 From: rob1997 Date: Thu, 27 Jun 2024 18:45:03 +0300 Subject: [PATCH 16/26] echoes needed -e parameter apparently --- .github/workflows/check_and_commit.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check_and_commit.yml b/.github/workflows/check_and_commit.yml index 6b571eaf3..c377f913f 100644 --- a/.github/workflows/check_and_commit.yml +++ b/.github/workflows/check_and_commit.yml @@ -46,13 +46,13 @@ jobs: then DESTINATION_DIRECTORY=${entry#"$display_name_prefix"} SOURCE_PATH="${GITHUB_WORKSPACE}/$SOURCE_PATH/$(ls "$SOURCE_PATH" | head -n 1)/$DESTINATION_DIRECTORY" - echo "Source Path: $SOURCE_PATH" + echo -e "Source Path: $SOURCE_PATH" elif [[ $entry = $destination_prefix* ]] then DESTINATION_PATH="${GITHUB_WORKSPACE}/${entry#"$destination_prefix"}" rm -rf "$DESTINATION_PATH" mkdir -p "$DESTINATION_PATH" - echo "Copying $SOURCE_PATH to $DESTINATION_PATH" + echo -e "Copying $SOURCE_PATH to $DESTINATION_PATH" cp -r "$SOURCE_PATH/." "$DESTINATION_PATH" git add "$DESTINATION_PATH." -f fi From d1595a0b93c6b882a0bbb88b839921356dc2357c Mon Sep 17 00:00:00 2001 From: rob1997 Date: Thu, 27 Jun 2024 18:47:50 +0300 Subject: [PATCH 17/26] echo entry --- .github/workflows/check_and_commit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check_and_commit.yml b/.github/workflows/check_and_commit.yml index c377f913f..ab932b68b 100644 --- a/.github/workflows/check_and_commit.yml +++ b/.github/workflows/check_and_commit.yml @@ -30,9 +30,9 @@ jobs: export SOURCE_PATH= export DESTINATION_DIRECTORY= export DESTINATION_PATH= - while IFS= read -r entry || [ -n "$entry" ]; do + echo -e "Duplicate Samples $entry" source_prefix="source:" display_name_prefix="display_name:" destination_prefix="destination:" From 1c4dc178fe0983780da7096d6f9827ce10bc184f Mon Sep 17 00:00:00 2001 From: rob1997 Date: Thu, 27 Jun 2024 18:58:16 +0300 Subject: [PATCH 18/26] trim function updated --- .github/workflows/check_and_commit.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/check_and_commit.yml b/.github/workflows/check_and_commit.yml index ab932b68b..0a031cb55 100644 --- a/.github/workflows/check_and_commit.yml +++ b/.github/workflows/check_and_commit.yml @@ -32,12 +32,11 @@ jobs: export DESTINATION_PATH= while IFS= read -r entry || [ -n "$entry" ]; do - echo -e "Duplicate Samples $entry" source_prefix="source:" display_name_prefix="display_name:" destination_prefix="destination:" - entry=$(echo "$entry" | tr -d '\t') + entry=$(echo "$entry" | sed -e 's/^[[:space:]]*//') if [[ $entry = $source_prefix* ]] then From 4d44d5431d24e7d77bb16c6f6ea590b5d5e33927 Mon Sep 17 00:00:00 2001 From: rob1997 Date: Sun, 30 Jun 2024 12:46:53 +0300 Subject: [PATCH 19/26] duplicated CI publish workflow to scripts/setup.sh --- .github/workflows/check_and_commit.yml | 2 -- scripts/publish-to-unity-package.sh | 50 +++++++++++--------------- 2 files changed, 20 insertions(+), 32 deletions(-) diff --git a/.github/workflows/check_and_commit.yml b/.github/workflows/check_and_commit.yml index 0a031cb55..5aa5a9079 100644 --- a/.github/workflows/check_and_commit.yml +++ b/.github/workflows/check_and_commit.yml @@ -45,13 +45,11 @@ jobs: then DESTINATION_DIRECTORY=${entry#"$display_name_prefix"} SOURCE_PATH="${GITHUB_WORKSPACE}/$SOURCE_PATH/$(ls "$SOURCE_PATH" | head -n 1)/$DESTINATION_DIRECTORY" - echo -e "Source Path: $SOURCE_PATH" elif [[ $entry = $destination_prefix* ]] then DESTINATION_PATH="${GITHUB_WORKSPACE}/${entry#"$destination_prefix"}" rm -rf "$DESTINATION_PATH" mkdir -p "$DESTINATION_PATH" - echo -e "Copying $SOURCE_PATH to $DESTINATION_PATH" cp -r "$SOURCE_PATH/." "$DESTINATION_PATH" git add "$DESTINATION_PATH." -f fi diff --git a/scripts/publish-to-unity-package.sh b/scripts/publish-to-unity-package.sh index b366503c7..c05170969 100755 --- a/scripts/publish-to-unity-package.sh +++ b/scripts/publish-to-unity-package.sh @@ -1,49 +1,39 @@ #! /usr/bin/env sh + set -e -echo Building project... scripts_dir=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) -pushd "$scripts_dir"/../src/ChainSafe.Gaming.Unity - -rm -rf obj -rm -rf bin -dotnet publish -c release -f netstandard2.1 /property:Unity=true +echo Publishing project... -echo Restoring non-Unity packages... - -dotnet restore +pushd "$scripts_dir"/../src/ChainSafe.Gaming.Unity -echo Moving files to Unity package... +dotnet publish ChainSafe.Gaming.Unity.csproj -c Release /property:Unity=true export PUBLISH_PATH="bin/Release/netstandard2.1/publish" echo -e "DLLs Generated\n$(ls "$PUBLISH_PATH")" -export PACKAGE_DEPENDENCIES=($(<$scripts_dir/data/published_dependencies.txt)) - -PACKAGE_DEPENDENCIES="${PACKAGE_DEPENDENCIES//$'\n'/ }" -PACKAGE_DEPENDENCIES="${PACKAGE_DEPENDENCIES//$'\r'/}" +export PACKAGE_LIB_PATH= -for entry in "${PACKAGE_DEPENDENCIES[@]}" +while IFS= read -r entry || [ -n "$entry" ]; do - IFS=':' read -ra dirs <<< "$entry" - - export PACKAGE_LIB_PATH=$scripts_dir/../${dirs[0]} - - if [ -d "$PACKAGE_LIB_PATH" ]; then - rm -f "$PACKAGE_LIB_PATH"*.dll + entry=$(echo "$entry" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') + if [[ $entry == *: ]] + then + PACKAGE_LIB_PATH="$scripts_dir/../${entry%:}" + if [ -d "$PACKAGE_LIB_PATH" ]; then + rm -rf "$PACKAGE_LIB_PATH"*.dll + else + mkdir -p "$PACKAGE_LIB_PATH" + fi + echo "Copying to $PACKAGE_LIB_PATH..." else - mkdir -p "$PACKAGE_LIB_PATH" + export DEPENDENCY=$(echo "$entry" | tr -d '\t' | tr -d ' ') + cp -fr "$PUBLISH_PATH/$DEPENDENCY" $PACKAGE_LIB_PATH fi - - IFS=';' read -ra dependencies <<< "${dirs[1]}" - - for dependency in "${dependencies[@]}" - do - cp "$PUBLISH_PATH/$dependency.dll" $PACKAGE_LIB_PATH - done -done + git add "$PACKAGE_LIB_PATH." -f +done < "$scripts_dir/data/published_dependencies.txt" popd From 05ca847ea08287c9a2a5304b047fb3e7ebd725f5 Mon Sep 17 00:00:00 2001 From: rob1997 Date: Sun, 30 Jun 2024 12:56:23 +0300 Subject: [PATCH 20/26] reverted testing workflow changes --- .github/workflows/check_and_commit.yml | 7 +++---- .github/workflows/post_push_checks_and_commits.yml | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/check_and_commit.yml b/.github/workflows/check_and_commit.yml index 5aa5a9079..7a7826124 100644 --- a/.github/workflows/check_and_commit.yml +++ b/.github/workflows/check_and_commit.yml @@ -104,7 +104,6 @@ jobs: restore-keys: | Library- - uses: game-ci/unity-test-runner@v3 - if: ${{ github.ref_name == 'dev' }} id: tests env: UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} @@ -117,17 +116,17 @@ jobs: checkName: ${{ matrix.testMode }} Test Results coverageOptions: 'generateAdditionalMetrics;generateHtmlReport;generateBadgeReport;' - uses: actions/upload-artifact@v3 - if: ${{ github.ref_name == 'dev' }} + if: always() with: name: Test results for ${{ matrix.testMode }} path: ${{ steps.tests.outputs.artifactsPath }} - uses: actions/upload-artifact@v3 - if: ${{ github.ref_name == 'dev' }} + if: always() with: name: Coverage results for ${{ matrix.testMode }} path: ${{ steps.tests.outputs.coveragePath }} - name: Commit and Push changes - if: ${{ github.ref_name == 'rob/scripts-data-formatting-1015' }} + if: ${{ github.ref_name == 'dev' }} run: | git diff-index --cached --quiet HEAD || git commit -m 'Auto Commit [skip ci] - Duplicate Packages Samples diff --git a/.github/workflows/post_push_checks_and_commits.yml b/.github/workflows/post_push_checks_and_commits.yml index b326e28ff..5cd430cf3 100644 --- a/.github/workflows/post_push_checks_and_commits.yml +++ b/.github/workflows/post_push_checks_and_commits.yml @@ -2,10 +2,10 @@ name: Post Push Checks and Commits on: push: - branches: [ rob/scripts-data-formatting-1015 ] + branches: [ dev ] jobs: check_and_commit: name: Check and Commit - uses: ChainSafe/web3.unity/.github/workflows/check_and_commit.yml@rob/scripts-data-formatting-1015 + uses: ChainSafe/web3.unity/.github/workflows/check_and_commit.yml@main secrets: inherit \ No newline at end of file From 443b43870af9008ea8de87bf45866efb18a20c2e Mon Sep 17 00:00:00 2001 From: rob1997 Date: Sun, 30 Jun 2024 12:59:22 +0300 Subject: [PATCH 21/26] revert sample test packages --- .../1.0.0/HyperPlay Samples/Scripts/HyperPlayLoginProvider.cs | 2 +- .../2.6.0/Lootboxes Samples/Scripts/Scene/LootBoxScene.cs | 1 - .../2.6.0/Web3Auth Samples/Scripts/Web3AuthLoginProvider.cs | 2 +- .../Scripts/Scenes/WalletConnectLoginProvider.cs | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/UnitySampleProject/Assets/Samples/web3.unity SDK HyperPlay/1.0.0/HyperPlay Samples/Scripts/HyperPlayLoginProvider.cs b/src/UnitySampleProject/Assets/Samples/web3.unity SDK HyperPlay/1.0.0/HyperPlay Samples/Scripts/HyperPlayLoginProvider.cs index 1c8075322..93263321f 100644 --- a/src/UnitySampleProject/Assets/Samples/web3.unity SDK HyperPlay/1.0.0/HyperPlay Samples/Scripts/HyperPlayLoginProvider.cs +++ b/src/UnitySampleProject/Assets/Samples/web3.unity SDK HyperPlay/1.0.0/HyperPlay Samples/Scripts/HyperPlayLoginProvider.cs @@ -8,7 +8,7 @@ using UnityEngine.UI; /// -/// Login using HyperPlay desktop client.Test +/// Login using HyperPlay desktop client. /// public class HyperPlayLoginProvider : LoginProvider, IWeb3BuilderServiceAdapter { diff --git a/src/UnitySampleProject/Assets/Samples/web3.unity SDK Lootboxes/2.6.0/Lootboxes Samples/Scripts/Scene/LootBoxScene.cs b/src/UnitySampleProject/Assets/Samples/web3.unity SDK Lootboxes/2.6.0/Lootboxes Samples/Scripts/Scene/LootBoxScene.cs index d712e9389..7f0e40c24 100644 --- a/src/UnitySampleProject/Assets/Samples/web3.unity SDK Lootboxes/2.6.0/Lootboxes Samples/Scripts/Scene/LootBoxScene.cs +++ b/src/UnitySampleProject/Assets/Samples/web3.unity SDK Lootboxes/2.6.0/Lootboxes Samples/Scripts/Scene/LootBoxScene.cs @@ -7,7 +7,6 @@ namespace LootBoxes.Chainlink.Scene { - //Test public class LootBoxScene : MonoBehaviour { public Animator animator; diff --git a/src/UnitySampleProject/Assets/Samples/web3.unity SDK Web3Auth/2.6.0/Web3Auth Samples/Scripts/Web3AuthLoginProvider.cs b/src/UnitySampleProject/Assets/Samples/web3.unity SDK Web3Auth/2.6.0/Web3Auth Samples/Scripts/Web3AuthLoginProvider.cs index 95e183bb2..edc077ae9 100644 --- a/src/UnitySampleProject/Assets/Samples/web3.unity SDK Web3Auth/2.6.0/Web3Auth Samples/Scripts/Web3AuthLoginProvider.cs +++ b/src/UnitySampleProject/Assets/Samples/web3.unity SDK Web3Auth/2.6.0/Web3Auth Samples/Scripts/Web3AuthLoginProvider.cs @@ -13,7 +13,7 @@ using Network = Web3Auth.Network; /// -/// Login using Web3Auth.Test +/// Login using Web3Auth. /// public class Web3AuthLoginProvider : LoginProvider, IWeb3BuilderServiceAdapter { diff --git a/src/UnitySampleProject/Assets/Samples/web3.unity SDK/2.6.0/Web3.Unity Samples/Scripts/Scenes/WalletConnectLoginProvider.cs b/src/UnitySampleProject/Assets/Samples/web3.unity SDK/2.6.0/Web3.Unity Samples/Scripts/Scenes/WalletConnectLoginProvider.cs index cfcdf63d0..8c7673cd3 100644 --- a/src/UnitySampleProject/Assets/Samples/web3.unity SDK/2.6.0/Web3.Unity Samples/Scripts/Scenes/WalletConnectLoginProvider.cs +++ b/src/UnitySampleProject/Assets/Samples/web3.unity SDK/2.6.0/Web3.Unity Samples/Scripts/Scenes/WalletConnectLoginProvider.cs @@ -7,7 +7,7 @@ using UnityEngine.UI; /// -/// Login using an existing wallet with WalletConnect.Test +/// Login using an existing wallet with WalletConnect. /// public class WalletConnectLoginProvider : LoginProvider, IWeb3BuilderServiceAdapter { From f7c99088dd220d6537cc93061166f948a10167d0 Mon Sep 17 00:00:00 2001 From: rob1997 Date: Mon, 1 Jul 2024 12:12:17 +0300 Subject: [PATCH 22/26] scripts now in batch too --- scripts/publish-to-unity-package.bat | 42 +++++++++++++--------------- scripts/publish-to-unity-package.sh | 1 - 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/scripts/publish-to-unity-package.bat b/scripts/publish-to-unity-package.bat index 98ddb9e7b..ee6bd8864 100644 --- a/scripts/publish-to-unity-package.bat +++ b/scripts/publish-to-unity-package.bat @@ -1,41 +1,39 @@ - - SET SCRIPT_DIR=%~dp0 +setlocal enabledelayedexpansion + echo Building project... pushd "%SCRIPT_DIR%\..\src\ChainSafe.Gaming.Unity" -del obj /F /Q -del bin /F /Q -dotnet restore -dotnet publish -c release -f netstandard2.1 /property:Unity=true -if %errorlevel% neq 0 exit /b %errorlevel% - -echo Moving files to Unity package... +rem Publish the project +dotnet publish ChainSafe.Gaming.Unity.csproj -c Release /property:Unity=true -echo Moving files to Unity package... - -set "PUBLISH_PATH=bin\Release\netstandard2.1\publish" +set PUBLISH_PATH=bin\Release\netstandard2.1\publish +rem List generated DLLs echo DLLs Generated dir /b "%PUBLISH_PATH%" -setlocal enabledelayedexpansion -set "PACKAGE_DEPENDENCIES_FILE=%SCRIPT_DIR%\data\published_dependencies.txt" +set PACKAGE_LIB_PATH= -for /f "usebackq tokens=*" %%a in (%PACKAGE_DEPENDENCIES_FILE%) do ( - for /f "tokens=1,* delims=:" %%b in ('echo %%a') do ( - set "PACKAGE_LIB_PATH=%SCRIPT_DIR%\..\%%b" +rem Read and process each line from the dependencies file +for /f "usebackq tokens=*" %%A in ("%SCRIPT_DIR%\data\published_dependencies.txt") do ( + + set entry=%%A - if exist "!PACKAGE_LIB_PATH!" ( + rem Check if the line ends with a colon + if "!entry:~-1!" == ":" ( + set "PACKAGE_LIB_PATH=%SCRIPT_DIR%..\!entry:~0,-1!" + if exist "!PACKAGE_LIB_PATH!\" ( del /q "!PACKAGE_LIB_PATH!\*.dll" ) else ( mkdir "!PACKAGE_LIB_PATH!" ) - - for %%d in (%%c) do ( - copy "%PUBLISH_PATH%\%%d.dll" "!PACKAGE_LIB_PATH!" - ) + + echo Copying to !PACKAGE_LIB_PATH!... + ) else ( + set "DEPENDENCY=!entry: =!" + copy /y "%PUBLISH_PATH%\!DEPENDENCY!" "!PACKAGE_LIB_PATH!" ) ) diff --git a/scripts/publish-to-unity-package.sh b/scripts/publish-to-unity-package.sh index c05170969..4b8d78243 100755 --- a/scripts/publish-to-unity-package.sh +++ b/scripts/publish-to-unity-package.sh @@ -32,7 +32,6 @@ do export DEPENDENCY=$(echo "$entry" | tr -d '\t' | tr -d ' ') cp -fr "$PUBLISH_PATH/$DEPENDENCY" $PACKAGE_LIB_PATH fi - git add "$PACKAGE_LIB_PATH." -f done < "$scripts_dir/data/published_dependencies.txt" popd From 9435b1281fe654c6ed832746cb5dadc79424d5a4 Mon Sep 17 00:00:00 2001 From: rob1997 Date: Mon, 1 Jul 2024 12:19:20 +0300 Subject: [PATCH 23/26] conflict resolved --- scripts/data/published_dependencies.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/data/published_dependencies.txt b/scripts/data/published_dependencies.txt index 4df86257a..6ae1f950e 100644 --- a/scripts/data/published_dependencies.txt +++ b/scripts/data/published_dependencies.txt @@ -58,14 +58,12 @@ Packages/io.chainsafe.web3-unity/Runtime/Libraries/: WalletConnectSharp.Web3Wallet.dll Nethereum.Merkle.dll Websocket.Client.dll - Nethereum.Metamask.dll Nethereum.Siwe.Core.dll Nethereum.Siwe.dll Nethereum.UI.dll - Nethereum.Unity.Metamask.dll - Nethereum.Unity.dll - ChainSafe.Gaming.MetaMask.Unity.dll + ChainSafe.Gaming.Unity.MetaMask.dll ChainSafe.Gaming.Marketplace.dll + ChainSafe.Gaming.Unity.EthereumWindow.dll Packages/io.chainsafe.web3-unity.lootboxes/Chainlink/Runtime/Libraries/: Chainsafe.Gaming.Chainlink.dll ChainSafe.Gaming.Lootboxes.Chainlink.dll From 482203634de8fcbf57cfd3b9220c8fa1943d16f9 Mon Sep 17 00:00:00 2001 From: rob1997 Date: Mon, 1 Jul 2024 12:22:39 +0300 Subject: [PATCH 24/26] revert from merge --- .../ChainSafe.Gaming.MetaMask.Unity.dll.meta | 92 +++++++++++++++++++ .../Libraries/Nethereum.Metamask.dll.meta | 33 +++++++ .../Nethereum.Unity.Metamask.dll.meta | 33 +++++++ .../Libraries/Nethereum.Unity.dll.meta | 33 +++++++ 4 files changed, 191 insertions(+) create mode 100644 Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.MetaMask.Unity.dll.meta create mode 100644 Packages/io.chainsafe.web3-unity/Runtime/Libraries/Nethereum.Metamask.dll.meta create mode 100644 Packages/io.chainsafe.web3-unity/Runtime/Libraries/Nethereum.Unity.Metamask.dll.meta create mode 100644 Packages/io.chainsafe.web3-unity/Runtime/Libraries/Nethereum.Unity.dll.meta diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.MetaMask.Unity.dll.meta b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.MetaMask.Unity.dll.meta new file mode 100644 index 000000000..4737dd0bf --- /dev/null +++ b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.MetaMask.Unity.dll.meta @@ -0,0 +1,92 @@ +fileFormatVersion: 2 +guid: 1043bc7b5bb84df1b06f3c4e156136b5 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 1 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + : Any + second: + enabled: 0 + settings: + Exclude Android: 1 + Exclude Editor: 1 + Exclude Linux64: 1 + Exclude OSXUniversal: 1 + Exclude WebGL: 0 + Exclude Win: 1 + Exclude Win64: 1 + Exclude iOS: 1 + - first: + Android: Android + second: + enabled: 0 + settings: + CPU: ARMv7 + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + - first: + Standalone: Linux64 + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: OSXUniversal + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: Win + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: Win64 + second: + enabled: 0 + settings: + CPU: None + - first: + WebGL: WebGL + second: + enabled: 1 + settings: {} + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + iPhone: iOS + second: + enabled: 0 + settings: + AddToEmbeddedBinaries: false + CPU: AnyCPU + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/Nethereum.Metamask.dll.meta b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/Nethereum.Metamask.dll.meta new file mode 100644 index 000000000..b0f0ad964 --- /dev/null +++ b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/Nethereum.Metamask.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: ede579b9369647949e93902a54a60c8e +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 1 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/Nethereum.Unity.Metamask.dll.meta b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/Nethereum.Unity.Metamask.dll.meta new file mode 100644 index 000000000..69e4b0388 --- /dev/null +++ b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/Nethereum.Unity.Metamask.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: 20892c90c032441ab4f34d5c357812f3 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 1 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/Nethereum.Unity.dll.meta b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/Nethereum.Unity.dll.meta new file mode 100644 index 000000000..e91513aad --- /dev/null +++ b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/Nethereum.Unity.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: 7967a6cb961d47ce8bdcf678d111c109 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 1 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: From 2b36aa05cbd5718ce38ed63b4282d811110bffe2 Mon Sep 17 00:00:00 2001 From: Robel Getnet Geremew Date: Mon, 1 Jul 2024 14:16:59 +0300 Subject: [PATCH 25/26] Scripts Data formatting (#1047) * Revert "automated duplicating imported samples modifications (#595)" This reverts commit a5558941827a91df51e2dd200648dcd13a1231c8. * made main package testable, revert due to a mistake * scripts data formatting * edits reformatted --------- Co-authored-by: robGG1997 --- .github/workflows/check_and_commit.yml | 63 +++++++++++---------- scripts/data/duplicate_samples.txt | 20 +++++-- scripts/data/published_dependencies.txt | 75 ++++++++++++++++++++++++- scripts/publish-to-unity-package.bat | 44 +++++++-------- scripts/publish-to-unity-package.sh | 51 +++++++---------- 5 files changed, 162 insertions(+), 91 deletions(-) diff --git a/.github/workflows/check_and_commit.yml b/.github/workflows/check_and_commit.yml index 2eade7446..ae89cfa9b 100644 --- a/.github/workflows/check_and_commit.yml +++ b/.github/workflows/check_and_commit.yml @@ -33,20 +33,27 @@ jobs: while IFS= read -r entry || [ -n "$entry" ]; do + source_prefix="source:" + display_name_prefix="display_name:" + destination_prefix="destination:" - IFS=':' read -ra dirs <<< "$entry" - SOURCE_PATH=${dirs[0]} - DESTINATION_DIRECTORY=${dirs[1]} + entry=$(echo "$entry" | sed -e 's/^[[:space:]]*//') - SOURCE_PATH="${GITHUB_WORKSPACE}/$SOURCE_PATH/$(ls "$SOURCE_PATH" | head -n 1)/$DESTINATION_DIRECTORY" - - DESTINATION_PATH="${GITHUB_WORKSPACE}/${dirs[2]}" - - rm -rf "$DESTINATION_PATH" - mkdir -p "$DESTINATION_PATH" - cp -r "$SOURCE_PATH/." "$DESTINATION_PATH" - - git add "$DESTINATION_PATH." -f + if [[ $entry = $source_prefix* ]] + then + SOURCE_PATH=${entry#"$source_prefix"} + elif [[ $entry = $display_name_prefix* ]] + then + DESTINATION_DIRECTORY=${entry#"$display_name_prefix"} + SOURCE_PATH="${GITHUB_WORKSPACE}/$SOURCE_PATH/$(ls "$SOURCE_PATH" | head -n 1)/$DESTINATION_DIRECTORY" + elif [[ $entry = $destination_prefix* ]] + then + DESTINATION_PATH="${GITHUB_WORKSPACE}/${entry#"$destination_prefix"}" + rm -rf "$DESTINATION_PATH" + mkdir -p "$DESTINATION_PATH" + cp -r "$SOURCE_PATH/." "$DESTINATION_PATH" + git add "$DESTINATION_PATH." -f + fi done < "${GITHUB_WORKSPACE}/scripts/data/duplicate_samples.txt" - name: update submodules # clone submodules @@ -69,27 +76,25 @@ jobs: export DLL_META_FILE_TEMPLATE="${{ vars.DLL_META_FILE_TEMPLATE }}" + export PACKAGE_LIB_PATH= + while IFS= read -r entry || [ -n "$entry" ]; do - IFS=':' read -ra dirs <<< "$entry" - export PACKAGE_LIB_PATH="${GITHUB_WORKSPACE}/${dirs[0]}" - - if [ -d "$PACKAGE_LIB_PATH" ]; then - rm "$PACKAGE_LIB_PATH"*.dll + if [[ $entry == *: ]] + then + PACKAGE_LIB_PATH="${GITHUB_WORKSPACE}/${entry%:}" + if [ -d "$PACKAGE_LIB_PATH" ]; then + rm "$PACKAGE_LIB_PATH"*.dll + else + mkdir -p "$PACKAGE_LIB_PATH" + fi else - mkdir -p "$PACKAGE_LIB_PATH" - fi - - IFS=';' read -ra dependencies <<< "${dirs[1]}" - - for dependency in "${dependencies[@]}" - do - cp "$PUBLISH_PATH/$dependency.dll" $PACKAGE_LIB_PATH - if ! [ -f "$PACKAGE_LIB_PATH$dependency.dll.meta" ]; then - echo -e "${DLL_META_FILE_TEMPLATE/"[[assetGuid]]"/"$(uuidgen | tr -d '-')"}" >> "$PACKAGE_LIB_PATH$dependency.dll.meta" + export DEPENDENCY=$(echo "$entry" | tr -d '\t' | tr -d ' ') + cp "$PUBLISH_PATH/$DEPENDENCY" $PACKAGE_LIB_PATH + if ! [ -f "$PACKAGE_LIB_PATH$DEPENDENCY.meta" ]; then + echo -e "${DLL_META_FILE_TEMPLATE/"[[assetGuid]]"/"$(uuidgen | tr -d '-')"}" >> "$PACKAGE_LIB_PATH$DEPENDENCY.meta" fi - done - + fi git add "$PACKAGE_LIB_PATH." -f done < "${GITHUB_WORKSPACE}/scripts/data/published_dependencies.txt" - uses: actions/cache@v2 diff --git a/scripts/data/duplicate_samples.txt b/scripts/data/duplicate_samples.txt index 485699603..892f2f4e3 100644 --- a/scripts/data/duplicate_samples.txt +++ b/scripts/data/duplicate_samples.txt @@ -1,5 +1,15 @@ -src/UnitySampleProject/Assets/Samples/web3.unity SDK:Web3.Unity Samples:Packages/io.chainsafe.web3-unity/Samples~/Web3.Unity/ -src/UnitySampleProject/Assets/Samples/web3.unity SDK Web3Auth:Web3.Unity Web3Auth Samples:Packages/io.chainsafe.web3-unity.web3auth/Samples~/Web3.Unity Web3Auth/ -src/UnitySampleProject/Assets/Samples/web3.unity SDK Lootboxes:Chainlink Lootbox Sample:Packages/io.chainsafe.web3-unity.lootboxes/Samples~/Chainlink Lootbox Samples/ -src/UnitySampleProject/Assets/Samples/web3.unity SDK Ramp:Web3.Unity Ramp Samples:Packages/io.chainsafe.web3-unity.ramp/Samples~/Web3.Unity Ramp Samples/ -src/UnitySampleProject/Assets/Samples/web3.unity SDK HyperPlay:Web3.Unity HyperPlay Samples:Packages/io.chainsafe.web3-unity.hyperplay/Samples~/Web3.Unity HyperPlay Samples/ \ No newline at end of file +source:src/UnitySampleProject/Assets/Samples/web3.unity SDK + display_name:Web3.Unity Samples + destination:Packages/io.chainsafe.web3-unity/Samples~/Web3.Unity/ +source:src/UnitySampleProject/Assets/Samples/web3.unity SDK Web3Auth + display_name:Web3.Unity Web3Auth Samples + destination:Packages/io.chainsafe.web3-unity.web3auth/Samples~/Web3.Unity Web3Auth/ +source:src/UnitySampleProject/Assets/Samples/web3.unity SDK Lootboxes + display_name:Chainlink Lootbox Sample + destination:Packages/io.chainsafe.web3-unity.lootboxes/Samples~/Chainlink Lootbox Samples/ +source:src/UnitySampleProject/Assets/Samples/web3.unity SDK Ramp + display_name:Web3.Unity Ramp Samples + destination:Packages/io.chainsafe.web3-unity.ramp/Samples~/Web3.Unity Ramp Samples/ +source:src/UnitySampleProject/Assets/Samples/web3.unity SDK HyperPlay + display_name:Web3.Unity HyperPlay Samples + destination:Packages/io.chainsafe.web3-unity.hyperplay/Samples~/Web3.Unity HyperPlay Samples/ \ No newline at end of file diff --git a/scripts/data/published_dependencies.txt b/scripts/data/published_dependencies.txt index 95a06a814..28fa91c57 100644 --- a/scripts/data/published_dependencies.txt +++ b/scripts/data/published_dependencies.txt @@ -1,3 +1,72 @@ -Packages/io.chainsafe.web3-unity/Runtime/Libraries/:ADRaffy.ENSNormalize;Nethereum.Model;BouncyCastle.Crypto;Nethereum.RLP;ChainSafe.Gaming.Debugging;Nethereum.RPC;ChainSafe.Gaming.Gelato;ChainSafe.Gaming.SygmaClient;Nethereum.Signer.EIP712;ChainSafe.Gaming.InProcessSigner;Nethereum.Signer;ChainSafe.Gaming.InProcessTransactionExecutor;Nethereum.Util;ChainSafe.Gaming.Unity.ThirdParty;Nethereum.Web3;ChainSafe.Gaming.Unity;System.Buffers;ChainSafe.Gaming.WalletConnect;System.Memory;ChainSafe.Gaming;System.Numerics.Vectors;Microsoft.Bcl.AsyncInterfaces;System.Reactive;Microsoft.Extensions.DependencyInjection.Abstractions;System.Runtime.CompilerServices.Unsafe;Microsoft.Extensions.DependencyInjection;System.Runtime.InteropServices.WindowsRuntime;Microsoft.Extensions.Logging.Abstractions;System.Security.Cryptography.Cng;Microsoft.IdentityModel.Abstractions;System.Text.Encodings.Web;Microsoft.IdentityModel.Logging;System.Text.Json;Microsoft.IdentityModel.Tokens;System.Threading.Channels;NBitcoin;System.Threading.Tasks.Extensions;Nethereum.ABI;WalletConnectSharp.Auth;Nethereum.Accounts;WalletConnectSharp.Common;WalletConnectSharp.Events;Nethereum.BlockchainProcessing;WalletConnectSharp.Core;Nethereum.Contracts;WalletConnectSharp.Crypto;Nethereum.Hex;Nethereum.JsonRpc.Client;WalletConnectSharp.Network.Websocket;Nethereum.JsonRpc.IpcClient;WalletConnectSharp.Network;Nethereum.JsonRpc.RpcClient;WalletConnectSharp.Sign;Nethereum.KeyStore;WalletConnectSharp.Storage;Nethereum.Merkle.Patricia;WalletConnectSharp.Web3Wallet;Nethereum.Merkle;Websocket.Client;Nethereum.Metamask;Nethereum.Siwe.Core;Nethereum.Siwe;Nethereum.UI;Nethereum.Unity.Metamask;Nethereum.Unity;ChainSafe.Gaming.MetaMask;ChainSafe.Gaming.MetaMask.Unity;ChainSafe.Gaming.InProcessTransactionExecutor.Unity;ChainSafe.Gaming.Marketplace -Packages/io.chainsafe.web3-unity.lootboxes/Chainlink/Runtime/Libraries/:Chainsafe.Gaming.Chainlink;ChainSafe.Gaming.Lootboxes.Chainlink -Packages/io.chainsafe.web3-unity.hyperplay/Runtime/Libraries/:ChainSafe.Gaming.HyperPlay \ No newline at end of file +Packages/io.chainsafe.web3-unity/Runtime/Libraries/: + ADRaffy.ENSNormalize.dll + Nethereum.Model.dll + BouncyCastle.Crypto.dll + Nethereum.RLP.dll + ChainSafe.Gaming.Debugging.dll + Nethereum.RPC.dll + ChainSafe.Gaming.Gelato.dll + ChainSafe.Gaming.SygmaClient.dll + Nethereum.Signer.EIP712.dll + ChainSafe.Gaming.InProcessSigner.dll + Nethereum.Signer.dll + ChainSafe.Gaming.InProcessTransactionExecutor.dll + Nethereum.Util.dll + ChainSafe.Gaming.Unity.ThirdParty.dll + Nethereum.Web3.dll + ChainSafe.Gaming.Unity.dll + System.Buffers.dll + ChainSafe.Gaming.WalletConnect.dll + System.Memory.dll + ChainSafe.Gaming.dll + System.Numerics.Vectors.dll + Microsoft.Bcl.AsyncInterfaces.dll + System.Reactive.dll + Microsoft.Extensions.DependencyInjection.Abstractions.dll + System.Runtime.CompilerServices.Unsafe.dll + Microsoft.Extensions.DependencyInjection.dll + System.Runtime.InteropServices.WindowsRuntime.dll + Microsoft.Extensions.Logging.Abstractions.dll + System.Security.Cryptography.Cng.dll + Microsoft.IdentityModel.Abstractions.dll + System.Text.Encodings.Web.dll + Microsoft.IdentityModel.Logging.dllSystem.Text.Json.dll + Microsoft.IdentityModel.Tokens.dll + System.Threading.Channels.dll + NBitcoin.dll + System.Threading.Tasks.Extensions.dll + Nethereum.ABI.dll + WalletConnectSharp.Auth.dll + Nethereum.Accounts.dll + WalletConnectSharp.Common.dll + WalletConnectSharp.Events.dll + Nethereum.BlockchainProcessing.dll + WalletConnectSharp.Core.dllNethereum.Contracts.dll + WalletConnectSharp.Crypto.dllNethereum.Hex.dll + Nethereum.JsonRpc.Client.dll + WalletConnectSharp.Network.Websocket.dll + Nethereum.JsonRpc.IpcClient.dll + WalletConnectSharp.Network.dll + Nethereum.JsonRpc.RpcClient.dll + WalletConnectSharp.Sign.dll + Nethereum.KeyStore.dll + WalletConnectSharp.Storage.dll + Nethereum.Merkle.Patricia.dll + WalletConnectSharp.Web3Wallet.dll + Nethereum.Merkle.dll + Websocket.Client.dll + Nethereum.Metamask.dll + Nethereum.Siwe.Core.dll + Nethereum.Siwe.dll + Nethereum.UI.dll + Nethereum.Unity.Metamask.dll + Nethereum.Unity.dll + ChainSafe.Gaming.MetaMask.dll + ChainSafe.Gaming.MetaMask.Unity.dll + ChainSafe.Gaming.InProcessTransactionExecutor.Unity.dll + ChainSafe.Gaming.Marketplace.dll +Packages/io.chainsafe.web3-unity.lootboxes/Chainlink/Runtime/Libraries/: + Chainsafe.Gaming.Chainlink.dll + ChainSafe.Gaming.Lootboxes.Chainlink.dll +Packages/io.chainsafe.web3-unity.hyperplay/Runtime/Libraries/: + ChainSafe.Gaming.HyperPlay.dll \ No newline at end of file diff --git a/scripts/publish-to-unity-package.bat b/scripts/publish-to-unity-package.bat index 98ddb9e7b..7baf2c810 100644 --- a/scripts/publish-to-unity-package.bat +++ b/scripts/publish-to-unity-package.bat @@ -1,44 +1,42 @@ - - SET SCRIPT_DIR=%~dp0 +setlocal enabledelayedexpansion + echo Building project... pushd "%SCRIPT_DIR%\..\src\ChainSafe.Gaming.Unity" -del obj /F /Q -del bin /F /Q -dotnet restore -dotnet publish -c release -f netstandard2.1 /property:Unity=true -if %errorlevel% neq 0 exit /b %errorlevel% - -echo Moving files to Unity package... +rem Publish the project +dotnet publish ChainSafe.Gaming.Unity.csproj -c Release /property:Unity=true -echo Moving files to Unity package... - -set "PUBLISH_PATH=bin\Release\netstandard2.1\publish" +set PUBLISH_PATH=bin\Release\netstandard2.1\publish +rem List generated DLLs echo DLLs Generated dir /b "%PUBLISH_PATH%" -setlocal enabledelayedexpansion -set "PACKAGE_DEPENDENCIES_FILE=%SCRIPT_DIR%\data\published_dependencies.txt" +set PACKAGE_LIB_PATH= -for /f "usebackq tokens=*" %%a in (%PACKAGE_DEPENDENCIES_FILE%) do ( - for /f "tokens=1,* delims=:" %%b in ('echo %%a') do ( - set "PACKAGE_LIB_PATH=%SCRIPT_DIR%\..\%%b" +rem Read and process each line from the dependencies file +for /f "usebackq tokens=*" %%A in ("%SCRIPT_DIR%\data\published_dependencies.txt") do ( + + set entry=%%A - if exist "!PACKAGE_LIB_PATH!" ( + rem Check if the line ends with a colon + if "!entry:~-1!" == ":" ( + set "PACKAGE_LIB_PATH=%SCRIPT_DIR%..\!entry:~0,-1!" + if exist "!PACKAGE_LIB_PATH!\" ( del /q "!PACKAGE_LIB_PATH!\*.dll" ) else ( mkdir "!PACKAGE_LIB_PATH!" ) - - for %%d in (%%c) do ( - copy "%PUBLISH_PATH%\%%d.dll" "!PACKAGE_LIB_PATH!" - ) + + echo Copying to !PACKAGE_LIB_PATH!... + ) else ( + set "DEPENDENCY=!entry: =!" + copy /y "%PUBLISH_PATH%\!DEPENDENCY!" "!PACKAGE_LIB_PATH!" ) ) popd -echo Done +echo Done \ No newline at end of file diff --git a/scripts/publish-to-unity-package.sh b/scripts/publish-to-unity-package.sh index b366503c7..332d28caa 100755 --- a/scripts/publish-to-unity-package.sh +++ b/scripts/publish-to-unity-package.sh @@ -1,50 +1,39 @@ #! /usr/bin/env sh + set -e -echo Building project... scripts_dir=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) -pushd "$scripts_dir"/../src/ChainSafe.Gaming.Unity - -rm -rf obj -rm -rf bin -dotnet publish -c release -f netstandard2.1 /property:Unity=true +echo Publishing project... -echo Restoring non-Unity packages... - -dotnet restore +pushd "$scripts_dir"/../src/ChainSafe.Gaming.Unity -echo Moving files to Unity package... +dotnet publish ChainSafe.Gaming.Unity.csproj -c Release /property:Unity=true export PUBLISH_PATH="bin/Release/netstandard2.1/publish" echo -e "DLLs Generated\n$(ls "$PUBLISH_PATH")" -export PACKAGE_DEPENDENCIES=($(<$scripts_dir/data/published_dependencies.txt)) - -PACKAGE_DEPENDENCIES="${PACKAGE_DEPENDENCIES//$'\n'/ }" -PACKAGE_DEPENDENCIES="${PACKAGE_DEPENDENCIES//$'\r'/}" +export PACKAGE_LIB_PATH= -for entry in "${PACKAGE_DEPENDENCIES[@]}" +while IFS= read -r entry || [ -n "$entry" ]; do - IFS=':' read -ra dirs <<< "$entry" - - export PACKAGE_LIB_PATH=$scripts_dir/../${dirs[0]} - - if [ -d "$PACKAGE_LIB_PATH" ]; then - rm -f "$PACKAGE_LIB_PATH"*.dll + entry=$(echo "$entry" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') + if [[ $entry == *: ]] + then + PACKAGE_LIB_PATH="$scripts_dir/../${entry%:}" + if [ -d "$PACKAGE_LIB_PATH" ]; then + rm -rf "$PACKAGE_LIB_PATH"*.dll + else + mkdir -p "$PACKAGE_LIB_PATH" + fi + echo "Copying to $PACKAGE_LIB_PATH..." else - mkdir -p "$PACKAGE_LIB_PATH" + export DEPENDENCY=$(echo "$entry" | tr -d '\t' | tr -d ' ') + cp -fr "$PUBLISH_PATH/$DEPENDENCY" $PACKAGE_LIB_PATH fi - - IFS=';' read -ra dependencies <<< "${dirs[1]}" - - for dependency in "${dependencies[@]}" - do - cp "$PUBLISH_PATH/$dependency.dll" $PACKAGE_LIB_PATH - done -done +done < "$scripts_dir/data/published_dependencies.txt" popd -echo Done +echo Done \ No newline at end of file From 1713cb9ecab032ee3094c6b216e246c5af8a9a6f Mon Sep 17 00:00:00 2001 From: rob1997 Date: Mon, 1 Jul 2024 14:19:49 +0300 Subject: [PATCH 26/26] Revert from merge --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c67648cdf..543e8f5fc 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [Twitter](https://twitter.com/chainsafeth) ## Documentation -You can access the full docs at [docs.gaming.chainsafe.io](https://docs.gaming.chainsafe.io). +You can access the full docs at [docs.gaming.chainsafe.io](https://docs.gaming.chainsafe.io) Our codebase is quite easy to use. This is an example of accessing player balance and calling a write method of a custom Smart Contract within Unity. @@ -24,7 +24,7 @@ async void Awake() } ``` -Additional prefab scripts can be found here [docs.gaming.chainsafe.io/current/sample-scripts](https://docs.gaming.chainsafe.io/current/sample-scripts). +Additional prefab scripts can be found here https://docs.gaming.chainsafe.io/current/prefab-scripts#contract-call ## Support - Need help with web3.unity or found a bug? Be sure to read the documentation above, then review existing issues or create a new one [here](https://github.com/ChainSafe/web3.unity/issues). This is the best way to get help from the ChainSafe Gaming team.