Pay-to-open: Generic payments example
Important: This exsample is not supported by versions 4.0 and later of the SDK. It uses the EthereumController which is no longer included in those versions. To implement payments, you currently should use external libraries like web3 or eth-connect. See blockchain interactions in the documentation for more details.
The scene is partly based on the interactive door sample scene, but it only allows you to open the door if you've paid 10 MANA first. Click on the door, sign the transaction in Metamask pop-up and wait until you see "Enter". It uses generic payments API from Decentraland's SDK.
Install the CLI
Download and install the Decentraland CLI by running the following command
npm i -g decentraland
For a more details, follow the steps in the Installation guide.
Clone the repo to your local drive
git clone https://github.com/decentraland/sample-scene-memory-game.git
Previewing the scene
from the scene directory:
$: dcl preview
Any dependencies are installed and then the CLI will open the scene in a new browser tab automatically.
You can learn more about handling user inputs in our documentation: https://docs.decentraland.org
Download the Metamask chrome extension and create an account
Purchase MANA with that account.
Run a demo of the scene and verify that you're not allowed to open the door.
Make a transaction sending 10 MANA to the following wallet address: 0x9dbc8ae2586267126e5067c9958720245d8cc53f
Run the scene again, this time you should be able to open the door.