Skip to main content

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:​

Source code:​

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

This GCScript/URL is too large! make it shorter uploading parts to GCFS. Unable to generate QR code

Resources​

License​

MIT