{"id":14963947,"url":"https://github.com/ton-org/game-engines-sdk","last_synced_at":"2025-05-07T09:44:36.311Z","repository":{"id":216466952,"uuid":"740550567","full_name":"ton-org/game-engines-sdk","owner":"ton-org","description":"TON blockchain bindings and utilities for game engines","archived":false,"fork":false,"pushed_at":"2024-11-11T17:00:55.000Z","size":738,"stargazers_count":53,"open_issues_count":2,"forks_count":8,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-31T08:44:12.569Z","etag":null,"topics":["2d","blockchain","game","phaser","ton"],"latest_commit_sha":null,"homepage":"https://github.com/ton-org/game-engines-sdk","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ton-org.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-08T15:18:40.000Z","updated_at":"2025-02-24T16:32:53.000Z","dependencies_parsed_at":"2024-01-12T21:44:19.412Z","dependency_job_id":"dc929e6e-2ebc-4abb-adc4-204d9556186a","html_url":"https://github.com/ton-org/game-engines-sdk","commit_stats":{"total_commits":50,"total_committers":2,"mean_commits":25.0,"dds":"0.020000000000000018","last_synced_commit":"69d50b6ba6ec61cc7c3d96a18a72bd6aaffd6c76"},"previous_names":["barinbritva/ton-gamefi","barinbritva/game-engines-sdk","ton-org/game-engines-sdk"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ton-org%2Fgame-engines-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ton-org%2Fgame-engines-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ton-org%2Fgame-engines-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ton-org%2Fgame-engines-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ton-org","download_url":"https://codeload.github.com/ton-org/game-engines-sdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252853312,"owners_count":21814505,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["2d","blockchain","game","phaser","ton"],"created_at":"2024-09-24T13:32:22.275Z","updated_at":"2025-05-07T09:44:36.281Z","avatar_url":"https://github.com/ton-org.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# game-engines-sdk\n\nTON blockchain bindings and utilities for game engines:\n* [Phaser](https://phaser.io)\n* [Cocos](https://www.cocos.com/en)\n* Vanilla JavaScript\n\n# Getting started\nInstallation:\n```sh\n# for Phaser\nnpm install --save @ton/phaser-sdk@beta\n\n# for Cocos\nnpm install --save @ton/cocos-sdk@beta\n\n# for Cocos\nnpm install --save @ton/vanilla-sdk@beta\n```\n\nCreating GameFi instance:\n```typescript\n// creation options described in the related section\nconst gameFi = await GameFi.create()\n```\n\nConnecting wallet:\n```typescript\n// create the UI scene\nclass UiScene extends Phaser.Scene {}\nconst uiScene = new UiScene();\n\n// add the connect button to the scene\n// all options described in the related section\nconst button: Container = gameFi.createConnectButton({\n    scene: uiScene\n})\n```\n\nWatching wallet connection:\n```typescript\ngameFi.onWalletChange((wallet: Wallet | null) =\u003e {\n    // do the logic depending weather wallet is null or not\n})\n```\nThis can be used for:\n* Watch the wallet state and reflect it on the game UI\n* Restore connection with previously connected user wallet after app reloads\n\n# What SDK should I use?\n\nEngine specific features can be included to related SDKs. For example, `phaser-sdk` has build-it UI for connecting wallet. There is almost no differences between SDKs features right now.\n\nStart with SDK of related engine if you use one. Use `@ton/vanilla-sdk` otherwise.\n\n# GameFi methods \u0026 props\n`GameFi` static methods:\n\n| Method | Description |\n| -------- | -------- |\n| [create](https://ton-org.github.io/game-engines-sdk/classes/vanilla_src.GameFi.html#create) | creates a GameFi instance |\n\n`GameFi` instance methods:\n\n| Method | Description |\n| -------- | -------- |\n| [createConnectButton](https://ton-org.github.io/game-engines-sdk/classes/phaser_src.GameFi.html#createConnectButton) | creates a button to connect a wallet. |\n| [connectWallet](https://ton-org.github.io/game-engines-sdk/classes/vanilla_src.GameFi.html#connectWallet) | connect wallet manually (without build-in UIs) |\n| [onWalletChange](https://ton-org.github.io/game-engines-sdk/classes/vanilla_src.GameFi.html#onWalletChange) | watch weather wallet was connected or disconnected |\n| [disconnectWallet](https://ton-org.github.io/game-engines-sdk/classes/vanilla_src.GameFi.html#disconnectWallet) | disconnect wallet manually (without build-in UIs) |\n| [buyWithTon](https://ton-org.github.io/game-engines-sdk/classes/vanilla_src.GameFi.html#buyWithTon) | buy from in-game shop with TON |\n| [buyWithJetton](https://ton-org.github.io/game-engines-sdk/classes/vanilla_src.GameFi.html#buyWithJetton) | buy from in-game shop with jetton |\n| [transferTon](https://ton-org.github.io/game-engines-sdk/classes/vanilla_src.GameFi.html#transferTon) | transfer TON to another wallet address |\n| [transferJetton](https://ton-org.github.io/game-engines-sdk/classes/vanilla_src.GameFi.html#transferJetton) | transfer jetton to another wallet address |\n| [openNftCollection](https://ton-org.github.io/game-engines-sdk/classes/vanilla_src.GameFi.html#openNftCollection) | open NFT collection contract |\n| [openNftSale](https://ton-org.github.io/game-engines-sdk/classes/vanilla_src.GameFi.html#openNftSale) | open NFT collection contract |\n| [openNftItem](https://ton-org.github.io/game-engines-sdk/classes/vanilla_src.GameFi.html#openNftItem) | open NFT item contract |\n| [openNftItemByIndex](https://ton-org.github.io/game-engines-sdk/classes/vanilla_src.GameFi.html#openNftItemByIndex) | open NFT item contract using its index |\n| [openSbtCollection](https://ton-org.github.io/game-engines-sdk/classes/vanilla_src.GameFi.html#openSbtCollection) | open SBT collection contract |\n| [openJetton](https://ton-org.github.io/game-engines-sdk/classes/vanilla_src.GameFi.html#openJetton) | Open Jetton contract |\n| [openJettonWallet](https://ton-org.github.io/game-engines-sdk/classes/vanilla_src.GameFi.html#openJettonWallet) | Open Jetton Wallet contract |\n\n`GameFi` instance props:\n\n| Prop | Description |\n| -------- | -------- |\n| [assetsSdk](https://ton-org.github.io/game-engines-sdk/classes/vanilla_src.GameFi.html#assetsSdk) | [asset-sdk](https://github.com/ton-community/assets-sdk) instance in case you need to use it directly |\n| [walletConnector](https://ton-org.github.io/game-engines-sdk/classes/vanilla_src.GameFi.html#walletConnector) | wallet connector instance in case you need to use it directly |\n| [wallet](https://ton-org.github.io/game-engines-sdk/classes/vanilla_src.GameFi.html#wallet) | user's connected wallet |\n| [walletAccount](https://ton-org.github.io/game-engines-sdk/classes/vanilla_src.GameFi.html#walletAccount) | user's connected account |\n| [walletAddress](https://ton-org.github.io/game-engines-sdk/classes/vanilla_src.GameFi.html#walletAddress) | user's connected wallet address |\n| [merchantAddress](https://ton-org.github.io/game-engines-sdk/classes/vanilla_src.GameFi.html#merchantAddress) | in-game shop's address to receive TON |\n| [merchantJettonAddress](https://ton-org.github.io/game-engines-sdk/classes/vanilla_src.GameFi.html#merchantJettonAddress) | in-game shop's jetton used as in-game currency |\n\n# Use cases\nTo learn complex use cases:\n- read [TON blockchain for games](https://docs.ton.org/v3/guidelines/dapps/tutorials/web3-game-example) article\n- check out the source code of [Flappy Bird](https://github.com/ton-community/flappy-bird) demo for Phaser\n- check out the example of [Flappy Bird](https://github.com/CocosTechLabs/flappy-bird) for Cocos\n\n# References\nThe full [typedoc references](https://ton-org.github.io/game-engines-sdk/index.html).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fton-org%2Fgame-engines-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fton-org%2Fgame-engines-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fton-org%2Fgame-engines-sdk/lists"}