@rainlanguage/ui-components 0.0.1-alpha.110 → 0.0.1-alpha.112

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.
@@ -2,6 +2,7 @@
2
2
  export let active;
3
3
  export let buttonText;
4
4
  export let clickHandler;
5
+ export let dataTestId;
5
6
  </script>
6
7
 
7
8
  <Button
@@ -9,6 +10,7 @@ export let clickHandler;
9
10
  color="alternative"
10
11
  class={active ? 'border-2 border-blue-300 dark:border-blue-700' : 'border-2 border-transparent'}
11
12
  on:click={clickHandler}
13
+ data-testid={dataTestId}
12
14
  >
13
15
  {buttonText}
14
16
  </Button>
@@ -4,6 +4,7 @@ declare const __propDef: {
4
4
  active: boolean;
5
5
  buttonText: string;
6
6
  clickHandler: () => void;
7
+ dataTestId: string;
7
8
  };
8
9
  events: {
9
10
  [evt: string]: CustomEvent<any>;
@@ -13,7 +13,6 @@ import DepositInput from "./DepositInput.svelte";
13
13
  import SelectToken from "./SelectToken.svelte";
14
14
  import DeploymentSectionHeader from "./DeploymentSectionHeader.svelte";
15
15
  import { useGui } from "../../hooks/useGui";
16
- import { useAccount } from "../../providers/wallet/useAccount";
17
16
  import { handleDeployment } from "./handleDeployment";
18
17
  import {} from "../../types/transaction";
19
18
  import { fade } from "svelte/transition";
@@ -25,6 +24,7 @@ export let onDeploy;
25
24
  export let wagmiConnected;
26
25
  export let appKitModal;
27
26
  export let settings;
27
+ export let account;
28
28
  let allDepositFields = [];
29
29
  let allTokenOutputs = [];
30
30
  let allFieldDefinitionsWithoutDefaults = [];
@@ -35,7 +35,6 @@ let allTokenInfos = [];
35
35
  let selectTokens = void 0;
36
36
  let checkingDeployment = false;
37
37
  let subgraphUrl = void 0;
38
- const { account } = useAccount();
39
38
  const gui = useGui();
40
39
  const registry = useRegistry();
41
40
  let deploymentStepsError = DeploymentStepsError.error;
@@ -179,7 +178,7 @@ async function handleDeployButtonClick() {
179
178
  }
180
179
  DeploymentStepsError.clear();
181
180
  const deploymentArgs = await handleDeployment(gui, $account, subgraphUrl);
182
- return await onDeploy(deploymentArgs);
181
+ return onDeploy(deploymentArgs);
183
182
  } catch (e) {
184
183
  DeploymentStepsError.catch(e, DeploymentStepsErrorCode.ADD_ORDER_FAILED);
185
184
  } finally {
@@ -3,6 +3,7 @@ import { type ConfigSource, type NameAndDescriptionCfg } from '@rainlanguage/ord
3
3
  import { type Writable } from 'svelte/store';
4
4
  import type { AppKit } from '@reown/appkit';
5
5
  import { type DeploymentArgs } from '../../types/transaction';
6
+ import type { Account } from '../../types/account';
6
7
  declare const __propDef: {
7
8
  props: {
8
9
  /** The deployment configuration containing key, name and description */ deployment: {
@@ -15,6 +16,7 @@ declare const __propDef: {
15
16
  wagmiConnected: Writable<boolean>;
16
17
  appKitModal: Writable<AppKit>;
17
18
  settings: Writable<ConfigSource>;
19
+ account: Account;
18
20
  };
19
21
  events: {
20
22
  [evt: string]: CustomEvent<any>;
@@ -85,6 +85,7 @@ $: if (deposit.token?.key) {
85
85
  <div class="flex w-full flex-wrap gap-4">
86
86
  {#each deposit.presets as preset}
87
87
  <ButtonSelectOption
88
+ dataTestId={`deposit-preset-${preset}`}
88
89
  active={currentDeposit?.amount === preset}
89
90
  buttonText={preset}
90
91
  clickHandler={() => handlePresetClick(preset)}
@@ -13,6 +13,7 @@ async function handleAcceptDisclaimer() {
13
13
  bind:open
14
14
  class="max-h-full dark:border dark:border-gray-700 dark:bg-gray-900"
15
15
  dialogClass="fixed top-0 start-0 end-1 h-modal md:inset-0 md:h-full z-50 w-full p-4 flex justify-center items-center h-full"
16
+ data-testid="deployment-disclaimer-modal"
16
17
  >
17
18
  <div class="flex flex-col items-start gap-y-8 p-4">
18
19
  <div class="space-y-4">
@@ -48,6 +48,7 @@ async function handleCustomInputChange(value) {
48
48
  <div class="flex w-full flex-wrap gap-4">
49
49
  {#each fieldDefinition.presets as preset}
50
50
  <ButtonSelectOption
51
+ dataTestId={`binding-${fieldDefinition.binding}-preset-${preset.name || preset.value}`}
51
52
  buttonText={preset.name || preset.value}
52
53
  clickHandler={() => handlePresetClick(preset)}
53
54
  active={currentValue?.value === preset.value}
@@ -58,6 +59,7 @@ async function handleCustomInputChange(value) {
58
59
 
59
60
  {#if !fieldDefinition.presets || fieldDefinition.showCustomField}
60
61
  <Input
62
+ data-testid={`binding-${fieldDefinition.binding}-input`}
61
63
  size="lg"
62
64
  placeholder="Enter custom value"
63
65
  bind:value={inputValue}
@@ -81,7 +81,10 @@ async function handleInput(event) {
81
81
  <span>Checking...</span>
82
82
  </div>
83
83
  {:else if tokenInfo}
84
- <div class="flex h-5 flex-row items-center gap-2">
84
+ <div
85
+ class="flex h-5 flex-row items-center gap-2"
86
+ data-testid={`select-token-success-${token.key}`}
87
+ >
85
88
  <CheckCircleSolid class="h-5 w-5" color="green" />
86
89
  <span>{tokenInfo.name}</span>
87
90
  </div>
@@ -59,6 +59,7 @@ $: if (vault.token?.key) {
59
59
  />
60
60
  <div class="flex flex-col gap-2">
61
61
  <Input
62
+ data-testid="vault-id-input"
62
63
  size="lg"
63
64
  type="text"
64
65
  placeholder="Enter vault ID"
package/dist/index.d.ts CHANGED
@@ -67,8 +67,8 @@ export { default as InputRegistryUrl } from './components/input/InputRegistryUrl
67
67
  export type { AppStoresInterface } from './types/appStores.ts';
68
68
  export type { ConfigSource, OrderbookConfigSource, OrderbookCfgRef } from '@rainlanguage/orderbook';
69
69
  export { TransactionStatus, TransactionErrorMessage, type TransactionState, type ExtendedApprovalCalldata } from './stores/transactionStore';
70
- export type { DeploymentArgs, DepositOrWithdrawArgs, OrderRemoveArgs } from './types/transaction';
71
- export type { DepositOrWithdrawModalProps, OrderRemoveModalProps, QuoteDebugModalHandler, DebugTradeModalHandler, DeployModalProps, DisclaimerModalProps } from './types/modal';
70
+ export type { DeploymentArgs, VaultActionArgs, OrderRemoveArgs } from './types/transaction';
71
+ export type { VaultActionModalProps, OrderRemoveModalProps, QuoteDebugModalHandler, DebugTradeModalHandler, DeployModalProps, DisclaimerModalProps } from './types/modal';
72
72
  export type { ValidStrategyDetail, InvalidStrategyDetail } from './types/strategy';
73
73
  export type { ToastProps } from './types/toast';
74
74
  export { createResolvableQuery, createResolvableInfiniteQuery } from './__mocks__/queries';
@@ -1,8 +1,8 @@
1
1
  import type { SgOrder } from '@rainlanguage/orderbook';
2
- import type { DepositOrWithdrawArgs, OrderRemoveArgs, DeploymentArgs } from './transaction';
3
- export type DepositOrWithdrawModalProps = {
2
+ import type { VaultActionArgs, OrderRemoveArgs, DeploymentArgs } from './transaction';
3
+ export type VaultActionModalProps = {
4
4
  open: boolean;
5
- args: DepositOrWithdrawArgs;
5
+ args: VaultActionArgs;
6
6
  };
7
7
  export type OrderRemoveModalProps = {
8
8
  open: boolean;
@@ -9,10 +9,9 @@ export type DeploymentArgs = {
9
9
  subgraphUrl?: string;
10
10
  network: string;
11
11
  };
12
- export type DepositOrWithdrawArgs = {
12
+ export type VaultActionArgs = {
13
13
  vault: SgVault;
14
- onDepositOrWithdraw: () => void;
15
- action: 'deposit' | 'withdraw';
14
+ onSuccess: () => void;
16
15
  chainId: number;
17
16
  rpcUrl: string;
18
17
  subgraphUrl: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rainlanguage/ui-components",
3
- "version": "0.0.1-alpha.110",
3
+ "version": "0.0.1-alpha.112",
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.110",
56
+ "@rainlanguage/orderbook": "0.0.1-alpha.112",
57
57
  "@reown/appkit": "1.6.4",
58
58
  "@reown/appkit-adapter-wagmi": "1.6.4",
59
59
  "@sentry/sveltekit": "7.120.0",