Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 43558b0
Author: Natalie Bunduwongse <nf1993@gmail.com>
Date:   Mon Oct 21 13:26:25 2024 +1300

    fix: config

commit 91ca2ad
Merge: 7d7a6b9 5c4830f
Author: Natalie Bunduwongse <nf1993@gmail.com>
Date:   Mon Oct 21 13:18:03 2024 +1300

    Merge branch 'main' into feat/list-asset

commit 7d7a6b9
Author: Natalie Bunduwongse <nf1993@gmail.com>
Date:   Mon Oct 21 13:14:26 2024 +1300

    feat: update unity sdk

commit 0e2bfd8
Author: Natalie Bunduwongse <nf1993@gmail.com>
Date:   Wed Oct 16 19:10:15 2024 +1300

    feat: testnet

commit c9ae488
Merge: 0bb6815 e410b3a
Author: Natalie Bunduwongse <nf1993@gmail.com>
Date:   Mon Oct 14 21:26:59 2024 +1300

    Merge branch 'main' into feat/list-asset

commit 0bb6815
Author: Natalie Bunduwongse <nf1993@gmail.com>
Date:   Mon Oct 14 21:25:58 2024 +1300

    refactor: marketplace

commit 068de0b
Author: Natalie Bunduwongse <nf1993@gmail.com>
Date:   Mon Oct 14 18:16:47 2024 +1300

    refactor: inventory

commit 9ab6470
Author: Natalie Bunduwongse <nf1993@gmail.com>
Date:   Mon Oct 14 17:40:08 2024 +1300

    style: fix lint

commit f8668b9
Merge: a42c0c0 cdf9917
Author: Natalie Bunduwongse <nf1993@gmail.com>
Date:   Mon Oct 14 17:31:44 2024 +1300

    Merge branch 'main' of github.com:immutable/unity-sdk-game-tutorial into feat/list-asset

commit a42c0c0
Author: Natalie Bunduwongse <nf1993@gmail.com>
Date:   Mon Oct 14 17:24:02 2024 +1300

    feat: orderbook manager

commit e5a1661
Author: Natalie Bunduwongse <nf1993@gmail.com>
Date:   Mon Oct 14 11:26:11 2024 +1300

    refactor: inventory screens

commit 0e2592e
Author: Natalie Bunduwongse <nf1993@gmail.com>
Date:   Mon Oct 14 10:48:52 2024 +1300

    refactor: remove unused code, create directories for inventory, marketplace, shop

commit 5c7ca8a
Author: Natalie Bunduwongse <nf1993@gmail.com>
Date:   Mon Oct 14 09:58:45 2024 +1300

    feat: update inventory screen to use search nfts endpoint

commit 1da43f1
Author: Natalie Bunduwongse <nf1993@gmail.com>
Date:   Wed Oct 9 17:13:09 2024 +1300

    fix: balance object in shop view

commit 1d6541c
Author: Natalie Bunduwongse <nf1993@gmail.com>
Date:   Wed Oct 9 17:10:28 2024 +1300

    feat: change marketplace to grid view

commit 4755fa1
Author: Natalie Bunduwongse <nf1993@gmail.com>
Date:   Tue Oct 8 15:37:56 2024 +1300

    feat: update search api

commit 60b24ba
Author: Natalie Bunduwongse <nf1993@gmail.com>
Date:   Mon Oct 7 18:10:57 2024 +1300

    feat: Show amount in order details view

commit 83b1e0c
Author: Natalie Bunduwongse <nf1993@gmail.com>
Date:   Mon Oct 7 16:34:41 2024 +1300

    feat: create and cancel 1155 orders

commit 6667c5a
Author: Natalie Bunduwongse <nf1993@gmail.com>
Date:   Fri Oct 4 18:05:02 2024 +1300

    feat: sell erc1155

commit a394615
Merge: 5738b16 af58662
Author: Natalie Bunduwongse <nf1993@gmail.com>
Date:   Fri Oct 4 12:26:51 2024 +1300

    Merge branch 'main' into feat/list-asset

commit 5738b16
Author: Natalie Bunduwongse <nf1993@gmail.com>
Date:   Fri Oct 4 12:21:28 2024 +1300

    style: fix lint

commit 21a9f97
Author: Natalie Bunduwongse <nf1993@gmail.com>
Date:   Fri Oct 4 12:13:37 2024 +1300

    fix: balance overlapping add funds

commit 8b0dbd6
Author: Natalie Bunduwongse <nf1993@gmail.com>
Date:   Fri Oct 4 12:01:32 2024 +1300

    feat: show powerups

commit 4f7770b
Author: Natalie Bunduwongse <nf1993@gmail.com>
Date:   Thu Oct 3 20:45:43 2024 +1300

    feat: format inventory screen

commit b905ecc
Author: Natalie Bunduwongse <nf1993@gmail.com>
Date:   Thu Oct 3 20:36:00 2024 +1300

    feat: buy pack

commit 0a0f71f
Author: Natalie Bunduwongse <nf1993@gmail.com>
Date:   Thu Oct 3 16:20:15 2024 +1300

    feat: packs

commit 3860e29
Author: Natalie Bunduwongse <nf1993@gmail.com>
Date:   Thu Oct 3 11:04:05 2024 +1300

    feat: shop

commit 02445aa
Merge: 10bcf65 e169b78
Author: Natalie Bunduwongse <nf1993@gmail.com>
Date:   Wed Oct 2 19:12:25 2024 +1300

    fix: merge conflicts

commit 10bcf65
Merge: 357d2d1 77b4b73
Author: Natalie Bunduwongse <nf1993@gmail.com>
Date:   Wed Oct 2 19:06:10 2024 +1300

    fix: merge conflicts

commit 357d2d1
Author: Natalie Bunduwongse <nf1993@gmail.com>
Date:   Wed Oct 2 17:21:27 2024 +1300

    feat: change inventory to grid

commit d2b1fd6
Author: Natalie Bunduwongse <nf1993@gmail.com>
Date:   Wed Oct 2 14:47:44 2024 +1300

    feat: use orderbook package

commit ae100c5
Author: Natalie Bunduwongse <nf1993@gmail.com>
Date:   Mon Sep 30 14:42:28 2024 +1300

    style: lint fixes
  • Loading branch information
nattb8 committed Oct 21, 2024
1 parent 5c4830f commit fb7ed7a
Show file tree
Hide file tree
Showing 12 changed files with 726 additions and 93 deletions.
147 changes: 145 additions & 2 deletions Assets/Shared/Prefabs/UI/ShopScreen.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -1924,6 +1924,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 5538285658628802168}
- {fileID: 3468965489332797179}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
Expand Down Expand Up @@ -1986,10 +1987,10 @@ MonoBehaviour:
m_AddButton: {fileID: 5951993766795102788}
m_BackEvent: {fileID: 11400000, guid: 58f804667e2cb4eb789b6d2dfb3c4ce3, type: 2}
m_Balance: {fileID: 7413814428584860172}
m_PackObj: {fileID: 1362636507398835244}
m_ItemObj: {fileID: 1362636507398835244}
m_ListParent: {fileID: 3995018089020746221}
m_ScrollView: {fileID: 6011150636714096262}
m_AddFunds: {fileID: 0}
m_AddFunds: {fileID: 4459613696454349734}
--- !u!1 &9098808456760454047
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -2803,3 +2804,145 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: b5e87ca911816437f846b3f0d738b485, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1001 &8930956508653391281
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 7510809188624096650}
m_Modifications:
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_AnchorMax.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_AnchorMax.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_AnchorMin.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_AnchorMin.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_SizeDelta.x
value: 600
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_SizeDelta.y
value: 650
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 4
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346709, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_Name
value: AddFundsView
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346709, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 9703ade02db14aea9329516418991255, type: 3}
--- !u!224 &3468965489332797179 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
m_PrefabInstance: {fileID: 8930956508653391281}
m_PrefabAsset: {fileID: 0}
--- !u!114 &4459613696454349734 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 5049268175328206359, guid: 9703ade02db14aea9329516418991255,
type: 3}
m_PrefabInstance: {fileID: 8930956508653391281}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 34f4fd3646f040d99e04107838a59be2, type: 3}
m_Name:
m_EditorClassIdentifier:
3 changes: 1 addition & 2 deletions Assets/Shared/Scripts/Domain/OrderbookManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,7 @@ private async UniTask<string> 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 "";
return await Passport.Instance.ZkEvmSignTypedDataV4(messageJson);
}

/// <summary>
Expand Down
19 changes: 11 additions & 8 deletions Assets/Shared/Scripts/Model/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ public static class Config
// public const string SERVER_URL = "https://sample-passport-unity-game-api.dev.immutable.com/fox";
public const string SERVER_URL = "http://localhost:6060";

// public const string CLIENT_ID = "ZJL7JvetcDFBNDlgRs5oJoxuAUUl6uQj";
public const string CLIENT_ID = "2Ng38UmEg0Morz1xOQLtsDs72Wx8uyGL"; // Devnet
public const string CLIENT_ID = "mp6rxfMDwwZDogcdgNrAaHnG0qMlXuMK"; // Testnet
//public const string CLIENT_ID = "2Ng38UmEg0Morz1xOQLtsDs72Wx8uyGL"; // Devnet
// public const string CLIENT_ID = "UnB98ngnXIZIEJWGJOjVe1BpCx5ix7qc"; // WebGL

public const string ENVIRONMENT = "dev";
public const string ENVIRONMENT = "sandbox";

#if (UNITY_ANDROID && !UNITY_EDITOR_WIN) || (UNITY_IPHONE && !UNITY_EDITOR_WIN) || UNITY_STANDALONE_OSX
public const string REDIRECT_URI = "immutablerunner://callback";
Expand All @@ -32,19 +32,22 @@ public static class Config
public const string LOGOUT_REIDIRECT_URI = null;
#endif

public const string CHAIN_NAME = "imtbl-zkevm-devnet";
public const string BASE_URL = "https://api.dev.immutable.com";
public const string CHAIN_NAME = "imtbl-zkevm-testnet";
public const string BASE_URL = "https://api.sandbox.immutable.com";
public const int PAGE_SIZE = 20;
}

public static class Contract
{
// public const string SKIN = "0xad826E89CDe60E4eE248980D35c0F5C1196ad059"; // Testnet
public const string SKIN = "0xcdbee7935e1b0eaabdee64219182602df0d8d094"; // Devnet
// public const string SKIN = "0xcdbee7935e1b0eaabdee64219182602df0d8d094"; // Devnet
public const string SKIN = "0xc8df1b1693e2beffd2e484a825a357c6a3d998f2"; // Testnet team

// public const string TOKEN = "0x912cd5f1cd67F1143b7a5796fd9e5063D755DAbe"; // Testnet
public const string TOKEN = "0x328766302e7617d0de5901f8da139dca49f3ec75"; // Devnet
// public const string TOKEN = "0x328766302e7617d0de5901f8da139dca49f3ec75"; // Devnet
public const string TOKEN = "0xb237501b35dfdcad274299236a141425469ab9ba"; // Testnet team

public const string PACK = "0x60a6e04faf4feb1e08d7012077146b392569a094"; // Devnet
// public const string PACK = "0x60a6e04faf4feb1e08d7012077146b392569a094"; // Devnet
public const string PACK = "0x8525b5e782f3fbe6460057460be020146b63ed0f"; // Testnet team
}
}
2 changes: 1 addition & 1 deletion Assets/Unity.Hypercasual.asmdef
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"GUID:95a2b1ff23bee4357a10943aba1b014d",
"GUID:1d9728650655047939a351b40befbcdb",
"GUID:73ae64c02a64344a180df3fcbaab9f4b",
"Immutable.Api"
"GUID:ea96d519d1fac44c0a0586232395bd39"
],
"includePlatforms": [],
"excludePlatforms": [],
Expand Down
2 changes: 1 addition & 1 deletion Packages/packages-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"com.unity.nuget.newtonsoft-json": "3.2.0",
"com.cysharp.unitask": "2.3.3"
},
"hash": "e8bc73fce00813ce0abc7ce442e1d8b8bdf03779"
"hash": "03e4d2344a60f5d1a551b9de047629306693cab1"
},
"com.nobi.roundedcorners": {
"version": "https://github.com/kirevdokimov/Unity-UI-Rounded-Corners.git",
Expand Down
4 changes: 2 additions & 2 deletions ProjectSettings/PackageManagerSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ MonoBehaviour:
m_IsDefault: 0
m_Capabilities: 0
m_ConfigSource: 4
m_UserSelectedRegistryName: package.openupm.com
m_UserSelectedRegistryName: npmjs
m_UserAddingNewScopedRegistry: 0
m_RegistryInfoDraft:
m_Modified: 0
m_ErrorMessage:
m_UserModificationsInstanceId: -828
m_OriginalInstanceId: -832
m_OriginalInstanceId: -830
m_LoadAssets: 0
2 changes: 1 addition & 1 deletion ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ PlayerSettings:
allowUnsafeCode: 0
useDeterministicCompilation: 1
enableRoslynAnalyzers: 1
selectedPlatform: 2
selectedPlatform: 0
additionalIl2CppArgs:
scriptingRuntimeVersion: 1
gcIncremental: 0
Expand Down
2 changes: 1 addition & 1 deletion contracts/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## How to deploy the contract
1. Rename `contracts/.env.example` to `.env`, and set all parameters with the appropriate data for the environment these Sample game contracts will be deployed.
2. Run `yarn install`
3. Replace `YOUR_IMMUTABLE_RUNNER_SKIN_CONTRACT_ADDRESS` in `contracts/RunnerToken.sol` with your Immutable Runner Skin contract address
3. Replace `YOUR_IMMUTABLE_RUNNER_SKIN_CONTRACT_ADDRESS` in `scripts/deploy.ts` with your Immutable Runner Skin contract address
3. Run `yarn compile`
4. Run `yarn deploy`
6 changes: 3 additions & 3 deletions contracts/scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ async function main() {
// Load the Immutable Runner Tokencontract and get the contract factory
// const tokenContractFactory = await ethers.getContractFactory('RunnerToken');

// // Deploy the contract to the zkEVM network
// Deploy the contract to the zkEVM network
// const tokenContract = await tokenContractFactory.deploy(
// 'YOUR_IMMUTABLE_RUNNER_SKIN_CONTRACT_ADDRESS', // Immutable Runner Skin contract address
// );
Expand All @@ -15,8 +15,8 @@ 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
'0xb237501b35dfdcad274299236a141425469ab9ba', // Immutable Runner Token contract address
'0x6b969FD89dE634d8DE3271EbE97734FEFfcd58eE' // Immutable Operator Allowlist
);

console.log('Contract deployed to:', await packContract.getAddress());
Expand Down
2 changes: 1 addition & 1 deletion mint-backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"vm-browserify": "^1.1.2"
},
"dependencies": {
"@imtbl/sdk": "^1.40.4",
"@imtbl/sdk": "^1.57.0",
"axios": "^1.7.5",
"cors": "^2.8.5",
"dotenv": "^16.4.5",
Expand Down
34 changes: 1 addition & 33 deletions mint-backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ app.use(express.json()); // Handle JSON
app.use(cors()); // Enable CORS
const router: Router = express.Router();

const zkEvmProvider = new providers.JsonRpcProvider(`https://rpc.dev.immutable.com`);
const zkEvmProvider = new providers.JsonRpcProvider(`https://rpc.testnet.immutable.com`);

// Contract addresses
const foxContractAddress = process.env.FOX_CONTRACT_ADDRESS;
Expand Down Expand Up @@ -133,38 +133,6 @@ router.post('/mint/skin', async (req: Request, res: Response) => {
},
);

router.post('/refresh', async (req: Request, res: Response) => {
try {
if (skinColourContractAddress && privateKey) {
// Get the address to mint the token to
const to: string = req.body.to ?? null;
// Get the quantity to mint if specified, default is one
const tokenId = BigInt(req.body.tokenId ?? '1');

// Connect to wallet with minter role
const signer = new Wallet(privateKey).connect(zkEvmProvider);

// Specify the function to call
const abi = ['function mint(address to, uint256 tokenId)'];
// Connect contract to the signer
const contract = new Contract(skinColourContractAddress, abi, signer);

// Mints the number of tokens specified
const tx = await contract.mint(to, tokenId, gasOverrides);
await tx.wait();

return res.status(200).json({});
} else {
return res.status(500).json({});
}

} catch (error) {
console.log(error);
return res.status(400).json({ message: 'Failed to mint to user' });
}
},
);

// In-game ERC20 balance
router.get('/balance', async (req: Request, res: Response) => {
try {
Expand Down
Loading

0 comments on commit fb7ed7a

Please sign in to comment.