{
  "type": "script",
  "title": "Load Wallet Config Demo",
  "description": "Loads a wallet configuration with five workspaces: default, multi-delegation, hierarchical deterministic, anonymous, and anonymous multi-delegation. Child keys are derived and the addresses each workspace needs are built, then the loaded profile is exported. Workspaces are virtual groups of keys and addresses that give users a specialized wallet experience. See 'Save Wallet Config Demo' to persist one",
  "require": {
    "not": {
      "walletTypeIn": [
        "extension"
      ]
    }
  },
  "run": {
    "profile": {
      "type": "loadConfig",
      "updateId": "loadConfigDemo",
      "layers": {
        "workspaces": {
          "type": "Workspace",
          "namePattern": "demo_{key}",
          "items": {
            "default": {
              "titlePattern": "Default",
              "descriptionPattern": "Your Main wallet only"
            },
            "multi_delegations": {
              "titlePattern": "Multi Delegation",
              "descriptionPattern": "Your delegation portfolio, each address stake rights can be delegated to a different staking pool"
            },
            "hd": {
              "titlePattern": "Hierarchical Deterministic",
              "descriptionPattern": "Access to your Yoroi or Daedalus wallet child addresses"
            },
            "anonymous": {
              "titlePattern": "Anonymous",
              "descriptionPattern": "Pure Enterprise child addresses, without staking rights. Don't combine with other workspaces to increase anonymity"
            },
            "anonymous_multi_delegations": {
              "titlePattern": "Anonymous Multi Delegation",
              "descriptionPattern": "Child addresses, with staking rights allowing anonymous portfolio multi delegations to different stake pools. Don't combine with other workspaces to increase anonymity"
            }
          }
        },
        "mainKeys": {
          "type": "Key",
          "namePattern": "hd_{kind}_main",
          "items": {
            "mainSpendKey": {
              "workspaceIds": [
                "demo_default",
                "demo_multi_delegations"
              ],
              "kind": "spend",
              "accountIndex": 0,
              "addressIndex": 0
            },
            "mainStakeKey": {
              "workspaceIds": [
                "demo_default",
                "demo_hd"
              ],
              "kind": "stake",
              "accountIndex": 0,
              "addressIndex": 0
            }
          }
        },
        "spendKeys": {
          "type": "Key",
          "workspaceIds": [
            "demo_hd",
            "demo_anonymous",
            "demo_anonymous_multi_delegations"
          ],
          "namePattern": "hd_{kind}_{key}",
          "kind": "spend",
          "items": [
            {
              "accountIndex": 0,
              "addressIndex": 0
            },
            {
              "accountIndex": 0,
              "addressIndex": 1
            },
            {
              "accountIndex": 0,
              "addressIndex": 2
            },
            {
              "accountIndex": 0,
              "addressIndex": 3
            },
            {
              "accountIndex": 0,
              "addressIndex": 4
            },
            {
              "accountIndex": 0,
              "addressIndex": 5
            },
            {
              "accountIndex": 0,
              "addressIndex": 6
            }
          ]
        },
        "stakeKeys": {
          "type": "Key",
          "workspaceIds": [
            "demo_multi_delegations",
            "demo_anonymous_multi_delegations"
          ],
          "namePattern": "hd_{kind}_{key}",
          "kind": "stake",
          "items": {
            "A": {
              "accountIndex": 0,
              "addressIndex": 0
            },
            "B": {
              "accountIndex": 0,
              "addressIndex": 1
            },
            "C": {
              "accountIndex": 0,
              "addressIndex": 2
            },
            "D": {
              "accountIndex": 0,
              "addressIndex": 3
            },
            "E": {
              "accountIndex": 0,
              "addressIndex": 4
            }
          }
        },
        "default": {
          "type": "Address",
          "workspaceIds": [
            "demo_default"
          ],
          "namePattern": "demo_main",
          "items": [
            {
              "spendPubKeyName": "hd_spend_main",
              "stakePubKeyName": "hd_stake_main"
            }
          ]
        },
        "hierarchicalDeterministic": {
          "type": "Address",
          "workspaceIds": [
            "demo_hd"
          ],
          "namePattern": "hd_{key}",
          "items": [
            {
              "spendPubKeyName": "hd_spend_0",
              "stakePubKeyName": "hd_stake_main"
            },
            {
              "spendPubKeyName": "hd_spend_1",
              "stakePubKeyName": "hd_stake_main"
            },
            {
              "spendPubKeyName": "hd_spend_2",
              "stakePubKeyName": "hd_stake_main"
            },
            {
              "spendPubKeyName": "hd_spend_3",
              "stakePubKeyName": "hd_stake_main"
            },
            {
              "spendPubKeyName": "hd_spend_4",
              "stakePubKeyName": "hd_stake_main"
            },
            {
              "spendPubKeyName": "hd_spend_5",
              "stakePubKeyName": "hd_stake_main"
            }
          ]
        },
        "delegationPortfolio": {
          "type": "Address",
          "workspaceIds": [
            "demo_multi_delegations"
          ],
          "namePattern": "pool_{key}",
          "items": [
            {
              "spendPubKeyName": "hd_spend_main",
              "stakePubKeyName": "hd_stake_A"
            },
            {
              "spendPubKeyName": "hd_spend_main",
              "stakePubKeyName": "hd_stake_B"
            },
            {
              "spendPubKeyName": "hd_spend_main",
              "stakePubKeyName": "hd_stake_C"
            },
            {
              "spendPubKeyName": "hd_spend_main",
              "stakePubKeyName": "hd_stake_D"
            },
            {
              "spendPubKeyName": "hd_spend_main",
              "stakePubKeyName": "hd_stake_E"
            }
          ]
        },
        "reward": {
          "type": "Address",
          "workspaceIds": [
            "demo_multi_delegations",
            "demo_anonymous_multi_delegations"
          ],
          "namePattern": "reward_{key}",
          "items": {
            "main": {
              "workspaceIds": [
                "demo_default"
              ],
              "stakePubKeyName": "hd_stake_main"
            },
            "A": {
              "stakePubKeyName": "hd_stake_A"
            },
            "B": {
              "stakePubKeyName": "hd_stake_B"
            },
            "C": {
              "stakePubKeyName": "hd_stake_C"
            },
            "D": {
              "stakePubKeyName": "hd_stake_D"
            },
            "E": {
              "stakePubKeyName": "hd_stake_E"
            }
          }
        },
        "anonymousHierachicalDeterministic": {
          "type": "Address",
          "workspaceIds": [
            "demo_anonymous"
          ],
          "namePattern": "anon_{key}",
          "items": [
            {
              "spendPubKeyName": "hd_spend_0"
            },
            {
              "spendPubKeyName": "hd_spend_1"
            },
            {
              "spendPubKeyName": "hd_spend_2"
            },
            {
              "spendPubKeyName": "hd_spend_3"
            },
            {
              "spendPubKeyName": "hd_spend_4"
            }
          ]
        },
        "anonymousStaking": {
          "type": "Address",
          "workspaceIds": [
            "demo_anonymous_multi_delegations"
          ],
          "namePattern": "anonstake_{key}",
          "items": [
            {
              "spendPubKeyName": "hd_spend_0",
              "stakePubKeyName": "hd_stake_A"
            },
            {
              "spendPubKeyName": "hd_spend_1",
              "stakePubKeyName": "hd_stake_B"
            },
            {
              "spendPubKeyName": "hd_spend_2",
              "stakePubKeyName": "hd_stake_C"
            },
            {
              "spendPubKeyName": "hd_spend_3",
              "stakePubKeyName": "hd_stake_D"
            },
            {
              "spendPubKeyName": "hd_spend_4",
              "stakePubKeyName": "hd_stake_E"
            }
          ]
        }
      }
    },
    "finally": {
      "type": "script",
      "exportAs": "SetupDemo",
      "run": {
        "results": {
          "type": "macro",
          "run": "{get('cache.profile')}"
        }
      }
    }
  }
}