import got from "got"; export default ({ host, port, wallet, username, password }) => new Proxy( {}, { get: (target, prop) => (...params) => ((method, ...params) => { let url = `http://${host}:${port}/wallet/${wallet}`; return got .post(url, { json: { method, params, }, headers: { authorization: `Basic ${Buffer.from( `${username}:${password}`, ).toString("base64")}`, }, }) .json() .then(({ result }) => result); })(prop.toLowerCase(), ...params), }, ); orm method='get'> coinos ui — legacy coinos.io web app (SvelteKit)coinos
aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/Code.svelte
blob: 9ad9bf29430dd6e641c1ffd8b2cf9dd2ceaa1d63 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<script>
  import { copyNoNewlines as copy } from "$lib/utils";
  import samples from "$lib/samples";
  let { sample } = $props();
</script>

{#snippet cp(something)}
  <button type="button" class="ml-auto" onclick={() => copy(something)}>
    <iconify-icon noobserver icon="ph:copy-bold" width="42"></iconify-icon>
  </button>
{/snippet}

<div
  class="bg-primary text-primary-content rounded-lg p-4 flex gap-4 whitespace-pre-wrap font-mono items-center"
>
  <div
    class="overflow-x-scroll max-w-full [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]"
  >
    <div class="break-all min-w-[800px]">{samples[sample]}</div>
  </div>
  {@render cp(samples[sample])}
</div>