Skip to content

Commit

Permalink
svelte check
Browse files Browse the repository at this point in the history
  • Loading branch information
rouzwelt committed Feb 18, 2025
1 parent f4b8dd0 commit 2eca624
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions packages/ui-components/src/__tests__/DeploymentSteps.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { describe, it, expect, vi, beforeEach, type Mock } from 'vitest';
import { render, screen, waitFor } from '@testing-library/svelte';
import DeploymentSteps from '../lib/components/deployment/DeploymentSteps.svelte';
import { DotrainOrderGui, type Scenario } from '@rainlanguage/orderbook/js_api';
import { DotrainOrderGui, type ScenarioCfg } from '@rainlanguage/orderbook/js_api';
import type { ComponentProps } from 'svelte';
import { writable } from 'svelte/store';
import type { AppKit } from '@reown/appkit';
import type { ConfigSource } from '../lib/typeshare/config';
import type { ConfigSource, GuiDeploymentCfg } from '@rainlanguage/orderbook/js_api';
import type { DeploymentArgs } from '$lib/types/transaction';
import type { DisclaimerModal } from '$lib';

Expand Down Expand Up @@ -585,7 +585,7 @@ describe('DeploymentSteps', () => {
scenario: {
key: 'flare',
bindings: {}
} as Scenario,
} as ScenarioCfg,
order: {
key: 'flare-sflr-wflr',
network: {
Expand Down Expand Up @@ -616,7 +616,7 @@ describe('DeploymentSteps', () => {
outputs: []
}
}
};
} as unknown as GuiDeploymentCfg;

beforeEach(() => {
vi.clearAllMocks();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
} from '../lib/components/deployment/getDeploymentTransactionArgs';
import { getAccount } from '@wagmi/core';
import type { Config } from '@wagmi/core';
import type { DotrainOrderGui, OrderIO } from '@rainlanguage/orderbook/js_api';
import type { DotrainOrderGui, OrderIOCfg } from '@rainlanguage/orderbook/js_api';

// Mock wagmi/core
vi.mock('@wagmi/core', () => ({
Expand All @@ -15,7 +15,7 @@ vi.mock('@wagmi/core', () => ({
describe('getDeploymentTransactionArgs', () => {
let mockGui: DotrainOrderGui;
let mockWagmiConfig: Config;
let mockTokenOutputs: OrderIO[];
let mockTokenOutputs: OrderIOCfg[];

beforeEach(() => {
vi.clearAllMocks();
Expand Down Expand Up @@ -44,7 +44,7 @@ describe('getDeploymentTransactionArgs', () => {
mockWagmiConfig = {} as Config;
(getAccount as Mock).mockReturnValue({ address: '0xuser' });

mockTokenOutputs = [{ token: { key: 'token1' } }] as OrderIO[];
mockTokenOutputs = [{ token: { key: 'token1' } }] as OrderIOCfg[];
});

describe('successful cases', () => {
Expand Down Expand Up @@ -144,7 +144,7 @@ describe('getDeploymentTransactionArgs', () => {

describe('token info errors', () => {
it('should throw TOKEN_INFO_FAILED when token key is missing', async () => {
const invalidTokenOutputs = [{ token: {} }] as OrderIO[];
const invalidTokenOutputs = [{ token: {} }] as OrderIOCfg[];

await expect(
getDeploymentTransactionArgs(mockGui, mockWagmiConfig, invalidTokenOutputs)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<script lang="ts">
import { fade } from 'svelte/transition';
import { DotrainOrderGui, type NameAndDescription } from '@rainlanguage/orderbook/js_api';
import { DotrainOrderGui, type NameAndDescriptionCfg } from '@rainlanguage/orderbook/js_api';
import DeploymentsSection from './DeploymentsSection.svelte';
import SvelteMarkdown from 'svelte-markdown';
export let strategyName: string = '';
export let dotrain: string = '';
let strategyDetails: NameAndDescription;
let strategyDetails: NameAndDescriptionCfg;
let error: string;
let errorDetails: string;
let markdownContent: string = '';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<script lang="ts">
import { onMount } from 'svelte';
import { type NameAndDescription } from '@rainlanguage/orderbook/js_api';
import { type NameAndDescriptionCfg } from '@rainlanguage/orderbook/js_api';
import { page } from '$app/stores';
export let strategyDetails: NameAndDescription;
export let strategyDetails: NameAndDescriptionCfg;
export let registryName: string;
let customRegistryParam = '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type {
DepositAndAddOrderCalldataResult,
DotrainOrderGui
} from '@rainlanguage/orderbook/js_api';
import type { OrderIO } from '@rainlanguage/orderbook/js_api';
import type { OrderIOCfg } from '@rainlanguage/orderbook/js_api';
import type { Hex } from 'viem';
import type { ExtendedApprovalCalldata } from '$lib/stores/transactionStore';

Expand All @@ -30,7 +30,7 @@ export interface HandleAddOrderResult {
export async function getDeploymentTransactionArgs(
gui: DotrainOrderGui | null,
wagmiConfig: Config | undefined,
allTokenOutputs: OrderIO[]
allTokenOutputs: OrderIOCfg[]
): Promise<HandleAddOrderResult> {
if (!gui) {
throw new Error(AddOrderErrors.MISSING_GUI);
Expand Down Expand Up @@ -69,8 +69,8 @@ export async function getDeploymentTransactionArgs(
throw new Error(AddOrderErrors.INVALID_CHAIN_ID);
}

// @ts-expect-error orderbook is not typed
const orderbookAddress = currentDeployment?.deployment?.order?.orderbook?.address;
const orderbookAddress = currentDeployment?.deployment?.order?.orderbook
?.address as `0x${string}`;
if (!orderbookAddress) {
throw new Error(AddOrderErrors.MISSING_ORDERBOOK);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-components/src/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export { default as DisclaimerModal } from './components/deployment/DisclaimerMo

//Types
export type { AppStoresInterface } from './types/appStores.ts';
export type { ConfigSource, OrderbookConfigSource, OrderbookRef } from './typeshare/config';
export type { ConfigSource, OrderbookConfigSource } from '@rainlanguage/orderbook/js_api';
export {
TransactionStatus,
TransactionErrorMessage,
Expand Down

0 comments on commit 2eca624

Please sign in to comment.