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

chore: get react-components and typedoc building again #106

Closed
wants to merge 6 commits into from
Closed
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"eslint-config-jessie": "^0.0.6",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-html": "^7.1.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsdoc": "^46.2.6",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-no-only-tests": "^3.1.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/react-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"./dist/style.css": "./dist/style.css"
},
"scripts": {
"build": "tsc && vite build",
"build": "tsc && NODE_OPTIONS=--max-old-space-size=4096 vite build",
"lint": "eslint --ext .js,.jsx,.ts,.tsx",
"lint:fix": "eslint --ext .js,.jsx,.ts,.tsx --fix",
"test": "vitest run --passWithNoTests",
Expand Down Expand Up @@ -51,7 +51,7 @@
"eslint": "8.46.0",
"eslint-config-prettier": "9.0.0",
"eslint-config-standard-with-typescript": "37.0.0",
"eslint-plugin-import": "2.28.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-n": "16.0.1",
"eslint-plugin-promise": "6.1.1",
"eslint-plugin-react": "7.33.1",
Expand Down
10 changes: 8 additions & 2 deletions packages/react-components/src/lib/components/AmountInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const noop = () => {
/* no-op */
};

type Props = {
export type AmountInputProps = {
value: NatValue | null;
decimalPlaces: number;
className?: React.HtmlHTMLAttributes<HTMLInputElement>['className'];
Expand All @@ -15,7 +15,13 @@ type Props = {
};

const RenderAmountInput = (
{ value, decimalPlaces, className, onChange = noop, disabled = false }: Props,
{
value,
decimalPlaces,
className,
onChange = noop,
disabled = false,
}: AmountInputProps,
ref?: Ref<HTMLInputElement>,
) => {
const { displayString, handleInputChange } = useAmountInput({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { agoricChain, prettyTestChainName } from '../config/index.js';
import { ChangeChainCombobox } from '@interchain-ui/react';
import { useState } from 'react';

type Props = {
export type NetworkDropdownProps = {
networkConfigs: NetworkConfig[];
label?: ChangeChainCombobox['label'];
size?: ChangeChainCombobox['size'];
Expand Down Expand Up @@ -33,7 +33,7 @@ export const NetworkDropdown = ({
maxHeight,
size = 'md',
appearance = 'bold',
}: Props) => {
}: NetworkDropdownProps) => {
const { networkConfig, setNetworkConfig } = useAgoricNetwork();
assert(
networkConfig && setNetworkConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ import { useAgoricNetwork } from '../hooks';
import BldIcon from '../icons/Bld';
import type { ChangeEvent } from 'react';

type Props = {
export type NodeSelectorModalProps = {
isOpen?: boolean;
onClose: () => void;
};

export const NodeSelectorModal = ({ onClose, isOpen = false }: Props) => {
export const NodeSelectorModal = ({
onClose,
isOpen = false,
}: NodeSelectorModalProps) => {
const { networkConfig, setNetworkConfig } = useAgoricNetwork();
const defaultRest = networkConfig?.apis?.rest?.at(0);
const defaultRpc = networkConfig?.apis?.rpc?.at(0);
Expand Down
12 changes: 7 additions & 5 deletions packages/react-components/src/lib/context/AgoricContext.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { createContext } from 'react';
import {
type AmountValue,
makeAgoricWalletConnection,
} from '@agoric/web-components';
import { makeAgoricWalletConnection } from '@agoric/web-components';
import type { ChainStorageWatcher } from '@agoric/rpc';
import type { Brand, Amount, AssetKind } from '@agoric/ertp/src/types';
import type {
Brand,
Amount,
AssetKind,
AmountValue,
} from '@agoric/ertp/src/types';

export type PurseJSONState<T extends AssetKind> = {
brand: Brand;
Expand Down
8 changes: 4 additions & 4 deletions packages/react-components/src/lib/context/AgoricProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import type { MainWalletBase, WalletConnectOptions } from '@cosmos-kit/core';

import '@interchain-ui/react/styles';

type Props = {
export type AgoricProviderProps = PropsWithChildren<{
wallets: MainWalletBase[];
defaultNetworkConfig: NetworkConfig;
walletConnectOptions?: WalletConnectOptions;
onConnectionError?: (e: unknown) => void;
};
}>;

export const AgoricProvider = (props: PropsWithChildren<Props>) => {
export const AgoricProvider = (props: AgoricProviderProps) => {
return (
<NetworkProvider defaultNetworkConfig={props.defaultNetworkConfig}>
<AgoricProviderInner {...props} />
Expand All @@ -29,7 +29,7 @@ const AgoricProviderInner = ({
walletConnectOptions,
children,
onConnectionError,
}: PropsWithChildren<Props>) => {
}: AgoricProviderProps) => {
const { networkConfig } = useContext(NetworkContext);
assert(networkConfig, 'Network config missing from context');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ import { subscribeLatest } from '@agoric/notifier';
import type { ChainName } from 'cosmos-kit';
import type { AssetKind } from '@agoric/ertp/src/types';

type Props = {
export type AgoricProviderLiteProps = PropsWithChildren<{
chainName?: ChainName;
useCustomEndpoints?: boolean;
onConnectionError?: (e: unknown) => void;
};
}>;

/**
* Provides access to Agoric-specific account features such as smart wallet
Expand All @@ -48,7 +48,7 @@ export const AgoricProviderLite = ({
onConnectionError = () => {},
chainName = 'agoric',
useCustomEndpoints = true,
}: PropsWithChildren<Props>) => {
}: AgoricProviderLiteProps) => {
const [walletConnection, setWalletConnection] = useState<
AgoricWalletConnection | undefined
>(undefined);
Expand Down
9 changes: 7 additions & 2 deletions packages/react-components/src/lib/hooks/amountInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ type Args = {
};

export const useAmountInput = ({ value, decimalPlaces, onChange }: Args) => {
const amountString = stringifyValue(value, AssetKind.NAT, decimalPlaces);
const amountString =
value === null ? '' : stringifyValue(value, AssetKind.NAT, decimalPlaces);

const [fieldString, setFieldString] = useState(
value === null ? '' : amountString,
Expand All @@ -26,7 +27,11 @@ export const useAmountInput = ({ value, decimalPlaces, onChange }: Args) => {
setFieldString(str);

try {
const parsed = parseAsValue(str, AssetKind.NAT, decimalPlaces);
const parsed = parseAsValue(
str,
AssetKind.NAT,
decimalPlaces,
) as NatValue;
onChange(parsed);
} catch {
console.debug('Invalid input', str);
Expand Down
4 changes: 4 additions & 0 deletions packages/react-components/typedoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": ["../../typedoc.base.json"],
"entryPoints": ["src/lib/index.ts"]
}
2 changes: 1 addition & 1 deletion packages/rpc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@vitest/coverage-c8": "^0.25.3",
"axios-mock-adapter": "^1.22.0",
"eslint": "^8.22.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-require-extensions": "^0.1.3",
"happy-dom": "^9.20.3",
"postinstall-postinstall": "^2.1.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @ts-check

export { makeAgoricWalletConnection } from './src/wallet-connection/walletConnection.js';
export {
agoricRegistryTypes,
Expand Down
11 changes: 7 additions & 4 deletions packages/web-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@
"@agoric/assert": "^0.6.0",
"@agoric/cache": "^0.3.2",
"@agoric/casting": "^0.4.3-u13.0",
"@agoric/ertp": "^0.16.2",
"@agoric/ertp": "^0.16.3-dev-e2e36cc.0",
"@agoric/notifier": "^0.6.3-dev-8c14632.0",
"@agoric/smart-wallet": "^0.5.3",
"@endo/captp": "^3.1.1",
"@endo/eventual-send": "^0.17.5",
"@endo/marshal": "^0.8.5"
},
"devDependencies": {
"eslint-config-airbnb-base": "15.0.0",
"@agoric/eslint-config": "0.4.1-u12.0",
"@agoric/rpc": "^0.9.0",
"@keplr-wallet/types": "^0.11.37",
"@typescript-eslint/eslint-plugin": "^7.1.0",
"eslint": "^8.57.0",
"eslint-config-airbnb-base": "15.0.0",
"ses": "0.18.7",
"vitest": "^0.34.1"
},
Expand All @@ -46,14 +46,17 @@
"jsdoc/require-property-description": "off",
"jsdoc/require-returns": "off",
"jsdoc/check-tag-names": "off",
"jsdoc/require-param-type": "off",
"jsdoc/tag-lines": "off",
"import/no-extraneous-dependencies": "off"
"import/no-unresolved": "off",
"import/no-extraneous-dependencies": "off",
"import/order": "off"
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
},
"env": {
"env": {
"browser": true
}
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-check
export const stringifyCopyBag = value => {
return `${value.length}`;
};
112 changes: 0 additions & 112 deletions packages/web-components/src/display/display.js

This file was deleted.

Loading
Loading