Cardano Example Dapp
Submit 3 transactions and report errors
This example will build 3 transactions, sign and submit them without halting on errors, instead it will continue script execution to return any errors reported from the nodes
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": "Submit 3 transactions and report errors",
"description": "This example will build 3 transactions, sign and submit them without halting on errors, instead it will continue script execution to return any errors reported from the nodes",
"exportAs": "txErrors",
"return": {
"mode": "last"
},
"run": {
"buildA": {
"type": "buildTx",
"title": "Will succeed",
"tx": {}
},
"buildB": {
"type": "buildTx",
"title": "Will fail",
"tx": {
"ttl": {
"until": "0"
}
}
},
"buildC": {
"type": "buildTx",
"title": "Will also succeed",
"tx": {}
},
"sign": {
"detailedPermissions": false,
"type": "signTxs",
"txs": {
"A": "{get('cache.buildA.txHex')}",
"B": "{get('cache.buildB.txHex')}",
"C": "{get('cache.buildC.txHex')}"
}
},
"submit": {
"type": "submitTxs",
"mode": "noWait",
"noFail": true,
"extras": true,
"txs": "{get('cache.sign')}"
},
"finally": {
"type": "macro",
"run": {
"status": {
"A": "{get('cache.submit.txsExtended.A.status')}",
"B": "{get('cache.submit.txsExtended.B.status')}",
"C": "{get('cache.submit.txsExtended.C.status')}"
},
"txHashes": {
"A": "{get('cache.submit.txsExtended.A.txHash')}",
"B": "{get('cache.submit.txsExtended.B.txHash')}",
"C": "{get('cache.submit.txsExtended.C.txHash')}"
},
"errors": {
"A": "{get('cache.submit.txsExtended.A.error')}",
"B": "{get('cache.submit.txsExtended.B.error')}",
"C": "{get('cache.submit.txsExtended.C.error')}"
}
}
}
}
}
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
