
# 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](https://gamechangerfinance.github.io/gamechanger.wallet/examples/Submit%203%20transactions%20and%20report%20errors.html)
-  Visit [HTML+React Dapp](https://gamechangerfinance.github.io/gamechanger.wallet/examples/Submit%203%20transactions%20and%20report%20errors_react.html)
-  Visit [Native HTML dapp](https://gamechangerfinance.github.io/gamechanger.wallet/examples/Submit%203%20transactions%20and%20report%20errors_nolib.html)
-  Run [Standalone URL dapp connection](https://wallet.gamechanger.finance/api/2/run/1-H4sIAAAAAAAAA5WUwWrjMBCGX0Xo0l0wYaG33JLQpcfCBnpWrUkskKWgGVGH4HffGclJ3WJo6oud0f_PfDMjctF0PoFea2yTO5FuNDnyEviX33pH6lFRMgFNSy4GVCZYleAUEylIKSZkh4VqZgH79p1DBYPpTx7Uu_NevWXn7ZdEjUJ3DCUd1kLUQc966mIm1RlPLhxVDFOZRrmABMYqlpasbQwsyaBqcS4JbZbciiIjUk6S_jz5J2iw6pBiL8VUiAzO-DDIyQaZnYana1M1g15fdM86PvMGSY98kEu0NLWRr2mAJbAfZhN8FUzMbQtgJTyweuQMRbn93nowzl99msjLK3PT_KH_6PGWavd9KuMxLqHIEsRtgbgY2BdIvUOUDen1gV3Q3C4IS_cDFjeKh5vXlyPQr4fWtB2s6kRWNDzD8PB7ZOF2SbGdK3ZLit2HojCW-zHrsQYqy7ScEF-Nk9sb4l-Z2ppSBlkt3zm8_ircn8pJT6VMow8uGO_PszK9aVPUt4UjGcqLjVcehsangSBYsKvNqsqX57Bg2H4yfB3LgmE3M4zS27PBDu7nq4Yf8M0Nd_F9GJhv-rO4l67IfwA309_FdtOP8vwHLLY95QUFAAA)

## Source code:

- dapp connection code: [GCScript DSL](Submit%203%20transactions%20and%20report%20errors.gcscript)
- frontend (using @gamechanger-finance/gc): [HTML+JS dapp](Submit%203%20transactions%20and%20report%20errors.html)
- frontend (using @gamechanger-finance/gc): [HTML+React dapp](Submit%203%20transactions%20and%20report%20errors_react.html)
- frontend (without official library): [Native HTML dapp](Submit%203%20transactions%20and%20report%20errors_nolib.html)

Dapp code was autogenerated by [Playground IDE in GameChanger Wallet ](https://wallet.gamechanger.finance/playground)

## GCScript code (dapp connection):
```json
{
  "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 ](https://wallet.gamechanger.finance/playground) 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](Submit%203%20transactions%20and%20report%20errors.png)](https://gamechangerfinance.github.io/gamechanger.wallet/examples/Submit%203%20transactions%20and%20report%20errors.png)

## Resources
- [How to connect?](https://www.npmjs.com/package/@gamechanger-finance/gc)
- [Docs and examples on Github](https://github.com/GameChangerFinance/gamechanger.wallet/)
- [GCScript documentation](https://wallet.gamechanger.finance/doc/api/v2)
- [Playground IDE in GameChanger Wallet ](https://wallet.gamechanger.finance/playground)
- [Tutorials on Youtube](https://www.youtube.com/@gamechanger.finance)
- [Support on Discord](https://discord.gg/vpbfyRaDKG)
- [News on Twitter](https://twitter.com/GameChangerOk)
- [Website](https://gamechanger.finance)

## License
MIT 
    
