Cardano Example Dapp
GCFS Disk
Script that will create a GCFS Disk in more than one transaction using API 'buildFsTxs' endpoint. Also the script will generate some of the files to be written on chain, one of them is an encrypted GC script
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):
{
"title": "Get ready for some fun...",
"description": "Script that will create a GCFS Disk in more than one transaction using API 'buildFsTxs' endpoint. Also the script will generate some of the files to be written on chain, one of them is an encrypted GC script",
"type": "script",
"returnURLPattern": "http://localhost:3000/demo/api/dapp",
"run": {
"dependencies": {
"type": "script",
"exportAs": "data",
"run": {
"jsonData": {
"type": "data",
"value": {
"foo": "1",
"bar": 2,
"baz": true,
"baf": null,
"more": {
"info": {
"here": "Encrypted with GC API v2"
}
}
}
},
"jsonScript": {
"type": "data",
"value": {
"type": "script",
"title": "Simple Wallet Auth",
"description": "Will sign a message containing wallet address, using wallet address to sign",
"returnURLPattern": "http://localhost:3000/demo/api/dapp",
"exportAs": "connect",
"return": {
"mode": "one",
"key": "signature"
},
"run": {
"privateDataThatShouldNotBeLeaked": {
"type": "data",
"value": "If you see this, the world is broken"
},
"address": {
"type": "getCurrentAddress"
},
"signature": {
"type": "signDataWithAddress",
"address": "{get('cache.address')}",
"dataHex": "{strToHex(get('cache.privateDataThatShouldNotBeLeaked'))}"
}
}
}
},
"hexData": {
"type": "macro",
"run": "{strToHex(objToJson(get('cache.dependencies.jsonData')))}"
},
"hexScript": {
"type": "macro",
"run": "{strToHex(objToJson(get('cache.dependencies.jsonScript')))}"
},
"encryptedHexData": {
"type": "encrypt",
"requirePassword": {
"kind": "modal",
"description": "A password is required to encrypt this data",
"weak": true,
"default": "xyz1234"
},
"messageHex": "{get('cache.dependencies.hexData')}"
},
"encryptedHexScript": {
"type": "encrypt",
"requirePassword": {
"kind": "modal",
"description": "A password is required to encrypt this script",
"weak": true,
"default": "xyz1234"
},
"messageHex": "{get('cache.dependencies.hexScript')}"
}
}
},
"buildTxs": {
"type": "buildFsTxs",
"description": "encryption tests",
"assetName": "gc.disk",
"replicas": "1",
"noAppend": false,
"noIndexFileNames": false,
"noIndexFileData": false,
"layers": [
{
"//info/updatedAt": {
"kind": "file",
"fileHex": "4d6f6e204f637420323620323032362031373a35363a333120474d542d30333030"
},
"//empty/dir": {
"kind": "directory"
},
"//data/encryptedData.crypt": {
"kind": "file",
"fileHex": "{strToHex(get('cache.dependencies.encryptedHexData'))}"
},
"//scripts/encryptedScript.crypt": {
"kind": "file",
"fileHex": "{strToHex(get('cache.dependencies.encryptedHexScript'))}"
}
}
]
},
"signTxs": {
"type": "signTxs",
"namePattern": "GCFS_Signed_{key}",
"txs": "{get('cache.buildTxs.txList')}",
"detailedPermissions": false
},
"submitTxs": {
"type": "submitTxs",
"mode": "parallel",
"namePattern": "GCFS_Submitted{key}",
"txs": "{get('cache.signTxs')}"
},
"finally": {
"type": "script",
"exportAs": "buildFs",
"run": {
"txs": {
"type": "macro",
"run": "{get('cache.submitTxs')}"
}
}
}
}
}
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
