{
  "always_run_in_app" : false,
  "icon" : {
    "color" : "deep-green",
    "glyph" : "chart-pie"
  },
  "name" : "Coin Tracker",
  "script" : "\/\/ Coin Tracker installer.\n\/\/ Paste this into a new Scriptable script and point your widgets at it.\n\/\/ Each run downloads the latest Coin Tracker from wizapp.uk and runs it,\n\/\/ so updates arrive without touching the phone. If the download fails,\n\/\/ the last copy it fetched is used instead.\n\nconst SOURCE = \"https:\/\/wizapp.uk\/showcase\/coin-tracker\/coin-tracker.js\"\nconst MARKER = \"COIN_TRACKER_CORE\"\n\nconst fm = FileManager.local()\nconst copyPath = fm.joinPath(fm.documentsDirectory(), \"coin-tracker-core.js\")\n\nlet code = null\ntry {\n  const r = new Request(`${SOURCE}?t=${Date.now()}`)\n  r.timeoutInterval = 10\n  const text = await r.loadString()\n  if (r.response.statusCode === 200 && text.includes(MARKER)) {\n    code = text\n    fm.writeString(copyPath, text)\n  }\n} catch (e) {}\n\nif (!code && fm.fileExists(copyPath)) code = fm.readString(copyPath)\n\nif (code) {\n  const AsyncFunction = Object.getPrototypeOf(async function () {}).constructor\n  await new AsyncFunction(code)()\n} else {\n  const w = new ListWidget()\n  w.backgroundColor = new Color(\"#0f1115\")\n  const t = w.addText(\"Coin Tracker could not be downloaded yet. Check your connection and run it again.\")\n  t.font = Font.systemFont(12)\n  t.textColor = Color.white()\n  if (config.runsInWidget) Script.setWidget(w)\n  else await w.presentSmall()\n  Script.complete()\n}\n",
  "share_sheet_inputs" : [

  ]
}