Cardano Example Dapp
2FA
Create a workspace with a Shared Treasury address based on 2 addresses. A second address on the workspace is your main address as Signer
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": "2FA",
"description": "Create a workspace with a Shared Treasury address based on 2 addresses. A second address on the workspace is your main address as Signer",
"exportAs": "2FADemo",
"return": {
"mode": "none"
},
"run": {
"2FAAddress": {
"type": "data",
"value": "addr1q9faamq9k6557gve35amtdqph99h9q2txhz07chaxg6uwwgd6j6v0fc04n5ehg292yxvs292vesrqqmxqfnp7yuwn7yqczuqwr"
},
"2FAInfo": {
"type": "macro",
"run": "{getAddressInfo(get('cache.2FAAddress'))}"
},
"walletSetup": {
"type": "loadConfig",
"updateId": "2FADemo",
"layers": [
{
"type": "Workspace",
"items": [
{
"namePattern": "2fa",
"titlePattern": "2FA",
"descriptionPattern": "Wallet settings generated by a demo script to create a 2FA address"
}
]
},
{
"type": "Key",
"workspaceIds": [
"2fa"
],
"items": [
{
"namePattern": "spend-sponsor",
"kind": "spend",
"accountIndex": 0,
"addressIndex": 0
},
{
"namePattern": "stake-sponsor",
"kind": "stake",
"accountIndex": 0,
"addressIndex": 0
}
]
},
{
"type": "NativeScript",
"workspaceIds": [
"2fa"
],
"namePattern": "2fa_{key}_script",
"items": {
"spend": {
"all": {
"myself": {
"pubKeyName": "spend-sponsor"
},
"2fa": {
"pubKeyHashHex": "{get('cache.2FAInfo.paymentKeyHash')}"
}
}
},
"stake": {
"all": {
"myself": {
"pubKeyName": "stake-sponsor"
},
"2fa": {
"pubKeyHashHex": "{get('cache.2FAInfo.stakingKeyHash')}"
}
}
}
}
},
{
"type": "Address",
"workspaceIds": [
"2fa"
],
"items": [
{
"namePattern": "Signer",
"spendPubKeyName": "spend-sponsor",
"stakePubKeyName": "stake-sponsor"
},
{
"namePattern": "2FA Address",
"spendNativeScriptName": "2fa_spend_script",
"stakeNativeScriptName": "2fa_stake_script"
}
]
}
]
}
}
}
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
