Cardano Example Dapp
Minimal Coin Sending Demo
Instead of using key-value maps for list of block code, here we use arrays and number indexes, making code less self explanatory but much smaller. The 'outputs' property of the 'buildTx' API function allows you to define multi-asset transaction outputs. In Cardano assets are defined by a policyId and an assetName, for ADA we use 'ada' in both cases. Receiver, asset and quantity are exposed as flat arguments so an auto-generated dapp can drive them
Try it online:
- Visit HTML+JS Dapp
- Visit HTML+React Dapp
- Visit Native HTML dapp
- Run Run in Wallet…Open in IDE…
Source code:
- dapp connection code: GCScript DSL
- frontend (using @gamechanger-finance/gc): HTML+JS dapp
- frontend (using @gamechanger-finance/gc): HTML+React dapp
- frontend (without official library): Native HTML dapp
Dapp code was autogenerated by Playground IDE in GameChanger Wallet
GCScript code (dapp connection):
{
"type": "script",
"title": "Minimal Coin Sending Demo",
"description": "Instead of using key-value maps for list of block code, here we use arrays and number indexes, making code less self explanatory but much smaller. The 'outputs' property of the 'buildTx' API function allows you to define multi-asset transaction outputs. In Cardano assets are defined by a policyId and an assetName, for ADA we use 'ada' in both cases. Receiver, asset and quantity are exposed as flat arguments so an auto-generated dapp can drive them",
"args": {
"to-address": "addr1q9faamq9k6557gve35amtdqph99h9q2txhz07chaxg6uwwgd6j6v0fc04n5ehg292yxvs292vesrqqmxqfnp7yuwn7yqczuqwr",
"policy-id": "ada",
"asset-name-hex": "ada",
"quantity": "1000000"
},
"run": [
{
"type": "buildTx",
"tx": {
"outputs": [
{
"address": "{get('args.to-address')}",
"assets": [
{
"policyId": "{get('args.policy-id')}",
"assetNameHex": "{get('args.asset-name-hex')}",
"quantity": "{get('args.quantity')}"
}
]
}
]
}
},
{
"type": "signTxs",
"detailedPermissions": false,
"txs": [
"{get('cache.0.txHex')}"
]
},
{
"type": "submitTxs",
"txs": "{get('cache.1')}"
}
]
}
Run standalone QR dapp connection:
You can use Playground IDE in GameChanger Wallet in QR URL Transport mode to capture results
Resources
- How to connect?
- Docs and examples on Github
- GCScript documentation
- Playground IDE in GameChanger Wallet
- Tutorials on Youtube
- Support on Discord
- News on Twitter
- Website
License
MIT
