@rainlanguage/ui-components 0.0.1-alpha.147 → 0.0.1-alpha.149

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -204,12 +204,12 @@ async function handleDeployButtonClick() {
204
204
  <DepositInput {deposit} />
205
205
  {/each}
206
206
 
207
- {#each allTokenOutputs as output, i}
208
- <TokenIOInput {i} label="Output" vault={output} />
207
+ {#each allTokenOutputs as output}
208
+ <TokenIOInput label="Output" vault={output} />
209
209
  {/each}
210
210
 
211
- {#each allTokenInputs as input, i}
212
- <TokenIOInput {i} label="Input" vault={input} />
211
+ {#each allTokenInputs as input}
212
+ <TokenIOInput label="Input" vault={input} />
213
213
  {/each}
214
214
  {/if}
215
215
 
@@ -4,23 +4,23 @@ import DeploymentSectionHeader from "./DeploymentSectionHeader.svelte";
4
4
  import { onMount } from "svelte";
5
5
  import { useGui } from "../../hooks/useGui";
6
6
  const gui = useGui();
7
- export let i;
8
7
  export let label;
9
8
  export let vault;
10
9
  let tokenInfo = null;
11
10
  let inputValue = "";
12
11
  let error = "";
13
12
  onMount(() => {
13
+ if (!vault.token?.key) return;
14
14
  const result = gui.getVaultIds();
15
15
  if (result.error) {
16
16
  error = result.error.msg;
17
17
  return;
18
18
  }
19
19
  const vaultIds = result.value;
20
- if (label === "Input") {
21
- inputValue = vaultIds.get("input")?.[i];
22
- } else if (label === "Output") {
23
- inputValue = vaultIds.get("output")?.[i];
20
+ const vaultMap = vaultIds.get(label.toLowerCase());
21
+ if (vaultMap) {
22
+ const vaultId = vaultMap.get(vault.token.key);
23
+ inputValue = vaultId || "";
24
24
  }
25
25
  });
26
26
  const handleGetTokenInfo = async () => {
@@ -38,10 +38,13 @@ const handleGetTokenInfo = async () => {
38
38
  }
39
39
  };
40
40
  const handleInput = async () => {
41
- const isInput = label === "Input";
41
+ if (!vault.token) {
42
+ error = "Vault token is not set.";
43
+ return;
44
+ }
42
45
  error = "";
43
46
  try {
44
- gui?.setVaultId(isInput, i, inputValue);
47
+ gui.setVaultId(label.toLowerCase(), vault.token.key, inputValue);
45
48
  } catch (e) {
46
49
  const errorMessage = e.message ? e.message : "Error setting vault ID.";
47
50
  error = errorMessage;
@@ -54,8 +57,8 @@ $: if (vault.token?.key) {
54
57
 
55
58
  <div class="flex w-full flex-col gap-6">
56
59
  <DeploymentSectionHeader
57
- title={`${label} ${i + 1} ${tokenInfo?.symbol ? `(${tokenInfo.symbol})` : ''}`}
58
- description={`${tokenInfo?.symbol} vault ID`}
60
+ title={`${label} ${tokenInfo?.symbol ? `(${tokenInfo.symbol})` : ''}`}
61
+ description={`${tokenInfo?.symbol || 'Token'} vault ID`}
59
62
  />
60
63
  <div class="flex flex-col gap-2">
61
64
  <Input
@@ -2,7 +2,6 @@ import { SvelteComponent } from "svelte";
2
2
  import { type OrderIOCfg } from '@rainlanguage/orderbook';
3
3
  declare const __propDef: {
4
4
  props: {
5
- i: number;
6
5
  label: "Input" | "Output";
7
6
  vault: OrderIOCfg;
8
7
  };
@@ -42,7 +42,7 @@ $: vaultsVol = createInfiniteQuery({
42
42
 
43
43
  <svelte:fragment slot="bodyRow" let:item>
44
44
  <TableBodyCell tdClass="px-4 py-2">
45
- <Hash type={HashType.Identifier} shorten value={item.id} />
45
+ <Hash type={HashType.Identifier} shorten value={item.id.toString()} />
46
46
  </TableBodyCell>
47
47
  <TableBodyCell tdClass="break-all py-2 min-w-32">
48
48
  <div class="flex gap-x-3">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rainlanguage/ui-components",
3
- "version": "0.0.1-alpha.147",
3
+ "version": "0.0.1-alpha.149",
4
4
  "description": "A component library for building Svelte applications to be used with Raindex.",
5
5
  "license": "LicenseRef-DCL-1.0",
6
6
  "author": "Rain Open Source Software Ltd",
@@ -53,7 +53,7 @@
53
53
  "@fontsource/dm-sans": "5.1.0",
54
54
  "@imask/svelte": "7.6.1",
55
55
  "@observablehq/plot": "0.6.16",
56
- "@rainlanguage/orderbook": "0.0.1-alpha.147",
56
+ "@rainlanguage/orderbook": "0.0.1-alpha.149",
57
57
  "@reown/appkit": "1.6.4",
58
58
  "@reown/appkit-adapter-wagmi": "1.6.4",
59
59
  "@sentry/sveltekit": "7.120.0",