Skip to main content

Cardano Example Dapp

Delegate Current Address to PEACE (MAINNET)​

About to delegate your ADA to 'PEACEpool Cardano ecosystem developers' stake pool. The stake key is registered and delegated in a single transaction, and an already registered stake key is handled, so the same script also works when re-delegating.

Try it online:​

Source code:​

Dapp code was autogenerated by Playground IDE in GameChanger Wallet

GCScript code (dapp connection):​

{
"title": "Delegate to [PEACE]",
"description": "About to delegate your ADA to 'PEACEpool Cardano ecosystem developers' stake pool. The stake key is registered and delegated in a single transaction, and an already registered stake key is handled, so the same script also works when re-delegating.",
"exportAs": "data",
"require": {
"not": {
"walletTypeIn": [
"burner",
"gift"
]
},
"networkTag": "mainnet"
},
"type": "script",
"return": {
"mode": "last"
},
"run": {
"dependencies": {
"type": "script",
"run": {
"currentAddress": {
"type": "getCurrentAddress"
},
"addressInfo": {
"type": "macro",
"run": "{getAddressInfo(get('cache.dependencies.currentAddress'))}"
},
"poolKeyHash": {
"type": "data",
"value": "bd24b3372791f401cc029455c44ea77f3c8750ce3b804a354af0ff16"
}
}
},
"registrationCert": {
"type": "certificate",
"cert": {
"kind": "StakeRegistration",
"pubKeyHashHex": "{get('cache.dependencies.addressInfo.stakingKeyHash')}"
}
},
"delegationCert": {
"type": "certificate",
"cert": {
"kind": "StakeDelegation",
"pubKeyHashHex": "{get('cache.dependencies.addressInfo.stakingKeyHash')}",
"poolKeyHashHex": "{get('cache.dependencies.poolKeyHash')}"
}
},
"txs": {
"type": "script",
"run": {
"buildDelegate": {
"type": "buildTx",
"title": "Delegate to [PEACE]",
"tx": {
"certificates": [
{
"certHex": "{get('cache.registrationCert')}"
},
{
"certHex": "{get('cache.delegationCert')}"
}
],
"options": {
"autoProvision": {
"workspaceNativeScript": true
},
"autoOptionalSigners": {
"nativeScript": true
},
"autoClean": {
"certReRegistrations": true
}
}
}
},
"signDelegate": {
"type": "signTxs",
"detailedPermissions": false,
"txs": [
"{get('cache.txs.buildDelegate.txHex')}"
]
},
"submitDelegate": {
"type": "submitTxs",
"txs": "{get('cache.txs.signDelegate')}"
}
}
},
"finally": {
"type": "macro",
"run": {
"address": "{get('cache.dependencies.currentAddress')}",
"rewardAddress": "{get('cache.dependencies.addressInfo.rewardAddress')}",
"stakePoolKeyHash": "{get('cache.dependencies.poolKeyHash')}",
"txHash": "{get('cache.txs.buildDelegate.txHash')}"
}
}
}
}

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