Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use TypeScript #40

Merged
merged 5 commits into from
Nov 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
"react-dom": "^18.2.0"
},
"devDependencies": {
"@agoric/casting": "dev",
"@agoric/ertp": "^0.14.2",
"@agoric/ui-components": "^0.2.33",
"@agoric/web-components": "0.5.1-dev-a4976a7.0",
"@agoric/zoe": "0.24.0",
"@agoric/casting": "^0.3.3-dev-f5341af.0",
"@agoric/ertp": "^0.15.4-dev-f5341af.0",
"@agoric/ui-components": "^0.3.4-dev-f5341af.0",
"@agoric/web-components": "^0.5.1-dev-f5341af.0",
"@agoric/zoe": "^0.25.4-dev-f5341af.0",
"@endo/eventual-send": "^0.16.0",
"@endo/init": "0.5.43",
"@endo/init": "^0.5.43",
"@headlessui/react": "^1.6.6",
"@types/node": "^18.7.13",
"@types/react": "^18.0.17",
Expand Down
4 changes: 3 additions & 1 deletion src/components/AssetDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { Brand } from '@agoric/ertp';
import { useAtomValue } from 'jotai';

import AssetListItem from 'components/AssetListItem';
import ListItem from 'components/ListItem';
import SkeletonListItem from 'components/SkeletonListItem';
import { displayFunctionsAtom } from 'store/app';

// Ambient
import '@agoric/ertp/src/types.js';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it appropriate to use import type here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally but the problem is the types needed are defined ambiently instead of in a module. We'll get there eventually but it's a lot more work Agoric/agoric-sdk#4560


const AssetDialog = ({
brands,
handleBrandSelected,
Expand Down
4 changes: 3 additions & 1 deletion src/components/AssetListItem.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { useAtomValue } from 'jotai';

import { Brand } from '@agoric/ertp';
import { displayFunctionsAtom } from 'store/app';

// Ambient
import '@agoric/ertp/src/types';

const AssetListItem = ({ brand }: { brand: Brand }) => {
const { displayBrandIcon, displayBrandPetname } =
useAtomValue(displayFunctionsAtom);
Expand Down
5 changes: 4 additions & 1 deletion src/components/CustomInput.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { AmountMath, AssetKind, Brand } from '@agoric/ertp';
import { AmountMath, AssetKind } from '@agoric/ertp';
import { useState } from 'react';
import { parseAsValue, stringifyValue } from '@agoric/ui-components';
import { useAtomValue } from 'jotai';
import { displayFunctionsAtom } from 'store/app';
import { PursesJSONState } from '@agoric/wallet-backend';
import { calcSignificantDecimalPlaces } from 'utils/displayFunctions';

// Ambient
import '@agoric/ertp/src/types';

const DEFAULT_PLACES_TO_SHOW = 2;

const CustomInput = ({
Expand Down
4 changes: 3 additions & 1 deletion src/components/DialogSwap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
import { AnimatePresence, motion } from 'framer-motion';
import { FiX, FiExternalLink } from 'react-icons/fi';

import { Brand } from '@agoric/ertp';
import AssetDialog from 'components/AssetDialog';

// Ambient
import '@agoric/ertp/src/types';

const DialogSwap = ({
open,
handleClose,
Expand Down
5 changes: 4 additions & 1 deletion src/components/SectionSwap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { useState } from 'react';
import { motion } from 'framer-motion';
import { FiChevronDown } from 'react-icons/fi';
import { useAtomValue, useAtom } from 'jotai';
import { AmountMath, Brand } from '@agoric/ertp';
import clsx from 'clsx';

import CustomInput from 'components/CustomInput';
Expand All @@ -22,6 +21,10 @@ import {
selectedAnchorPetnameAtom,
} from 'store/swap';

// Ambient
import '@agoric/ertp/src/types';
import { AmountMath } from '@agoric/ertp';

export enum SectionSwapType {
FROM = 'FROM',
TO = 'TO',
Expand Down
Loading