Cardano Example Dapp
Using console
Let's use dapp connector internal console to log or debug some events. Run and go to Advanced - Console to read 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": "Using console",
"description": "Let's use dapp connector internal console to log or debug some events. Run and go to Advanced - Console to read them.",
"returnURLPattern": "http://localhost:3000/demo/api/dapp",
"run": {
"typesOfMessages": {
"type": "macro",
"run": [
"{console('log','Log message')}",
"{console('info','Info message')}",
"{console('warn','Warning message!')}",
"{console('error','Error message!!!')}"
]
},
"setGlobalAndLog": {
"type": "macro",
"run": "{\n set('temp1','hello');\n set('temp2',123);\n console('log',get('global'));\n console('info',get('global.temp1'));\n console('warn',get('global.temp2'));\n console('error',get('global.thisDoesNotExist')); \n return('goodbye!'); \n }"
},
"address": {
"type": "getCurrentAddress"
},
"logCache": {
"type": "macro",
"run": "{console('log',get('cache'))}"
},
"logMultipleThings": {
"type": "macro",
"run": {
"address": "{console('log','my address is',get('cache.address'))}",
"uuid": "{console('log',uuid(),uuid(),uuid())}",
"hash": "{console('log',sha256(get('cache.address')))}"
}
}
}
}
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
