Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

Commit

Permalink
reverts recent commit
Browse files Browse the repository at this point in the history
  • Loading branch information
peetzweg committed Sep 20, 2023
1 parent 8423a9b commit e1affef
Show file tree
Hide file tree
Showing 63 changed files with 1,489 additions and 228 deletions.
4 changes: 2 additions & 2 deletions packages/useink/src/core/types/api-contract.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SubmittableResult } from '@polkadot/api';
import { ISubmittableResult } from './substrate.ts';
import { SubmittableResult } from '@polkadot/api';

export {
BlueprintPromise,
Expand Down Expand Up @@ -28,7 +28,7 @@ export type {
} from '@polkadot/api-contract/types';
export { Abi, ContractPromise } from '@polkadot/api-contract';

// biome-ignore lint/correctness/noUnusedVariables: The Release flow breaks when exporting from '@polkadot/api-contract/base/contract';
// rome-ignore lint/correctness/noUnusedVariables: The Release flow breaks when exporting from '@polkadot/api-contract/base/contract';
export declare class ContractSubmittableResult extends SubmittableResult {
readonly contractEvents?: DecodedEvent[] | undefined;
constructor(result: ISubmittableResult, contractEvents?: DecodedEvent[]);
Expand Down
2 changes: 1 addition & 1 deletion packages/useink/src/notifications/context.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { createContext } from 'react';
import {
AddNotificationPayload,
Config,
DEFAULT_NOTIFICATIONS,
Notifications,
} from './model.ts';
import { createContext } from 'react';

export const NotificationsContext = createContext<{
config?: Config;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useContext, useMemo } from 'react';
import { HALF_A_SECOND } from '../../react/constants.ts';
import { useInterval } from '../../react/hooks/internal/useInterval.ts';
import { getExpiredItem } from '../../utils/index';
Expand All @@ -8,6 +7,7 @@ import {
Notification,
Notifications,
} from '../model.ts';
import { useContext, useMemo } from 'react';

export interface UseNotifications {
notifications: Notifications;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useEffect } from 'react';
import { ChainId } from '../../chains/types.ts';
import { Tx } from '../../index';
import { useNotifications } from './useNotifications.ts';
import { useEffect } from 'react';

type TxInfo<T> = Pick<Tx<T>, 'status'> & Pick<Tx<T>, 'result'>;

Expand Down
2 changes: 1 addition & 1 deletion packages/useink/src/notifications/provider.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React, { useCallback, useReducer } from 'react';
import { useIsMounted } from '../react/hooks/internal/useIsMounted.ts';
import { pseudoRandomId } from '../utils/index';
import { NotificationsContext } from './context.ts';
Expand All @@ -8,6 +7,7 @@ import {
DEFAULT_NOTIFICATIONS,
} from './model.ts';
import { notificationReducer } from './reducer.ts';
import React, { useCallback, useReducer } from 'react';

export const NotificationsProvider: React.FC<
React.PropsWithChildren<{
Expand Down
2 changes: 1 addition & 1 deletion packages/useink/src/react/hooks/config/useChain.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useMemo } from 'react';
import { Chain, ChainId } from '../../../chains/index';
import { useConfig } from './useConfig.ts';
import { useMemo } from 'react';

export const useChain = (chainId?: ChainId): Chain | undefined => {
const { chains } = useConfig();
Expand Down
2 changes: 1 addition & 1 deletion packages/useink/src/react/hooks/config/useConfig.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useContext } from 'react';
import { ConfigContext } from '../../providers/config/context.ts';
import { Config } from '../../providers/config/model.ts';
import { useContext } from 'react';

export const useConfig = (): Config => useContext<Config>(ConfigContext);
2 changes: 1 addition & 1 deletion packages/useink/src/react/hooks/config/useDefaultCaller.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useMemo } from 'react';
import { ChainId } from '../../../chains/index';
import { useChain } from './useChain.ts';
import { useConfig } from './useConfig.ts';
import { useMemo } from 'react';

export const useDefaultCaller = (chainId?: ChainId): string | undefined => {
const { caller } = useConfig();
Expand Down
2 changes: 1 addition & 1 deletion packages/useink/src/react/hooks/contracts/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BN } from '@polkadot/util';
import { ChainId } from '../../../chains/types.ts';
import { Abi, ContractOptions, ContractPromise } from '../../../core/index';
import { BN } from '@polkadot/util';

export type CallOptions = Omit<ContractOptions, 'value'> & {
defaultCaller?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion packages/useink/src/react/hooks/contracts/useAbiMessage.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useMemo } from 'react';
import {
AbiMessage,
ContractPromise,
toContractAbiMessage,
} from '../../../core/index';
import { useMemo } from 'react';

export function useAbiMessage(
contract: ContractPromise | undefined,
Expand Down
2 changes: 1 addition & 1 deletion packages/useink/src/react/hooks/contracts/useCall.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useCallback, useState } from 'react';
import {
DecodedContractResult,
LazyCallOptions,
Expand All @@ -7,6 +6,7 @@ import {
import { ChainContract, useDefaultCaller } from '../index';
import { useWallet } from '../wallets/useWallet.ts';
import { useAbiMessage } from './useAbiMessage.ts';
import { useCallback, useState } from 'react';

export type CallSend<T> = (
args?: unknown[],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useEffect } from 'react';
import { LazyCallOptions } from '../../../core/index.ts';
import { useBlockHeader } from '../substrate/useBlockHeader.ts';
import { ChainContract } from './types.ts';
import { Call, useCall } from './useCall.ts';
import { useEffect } from 'react';

export function useCallSubscription<T>(
chainContract: ChainContract | undefined,
Expand Down
2 changes: 1 addition & 1 deletion packages/useink/src/react/hooks/contracts/useCodeHash.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useCallback, useEffect, useState } from 'react';
import { isValidHash } from '../../../utils';
import { useCallback, useEffect, useState } from 'react';

export enum CodeHashError {
InvalidHash = 'Invalid code hash value.',
Expand Down
2 changes: 1 addition & 1 deletion packages/useink/src/react/hooks/contracts/useContract.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useEffect, useMemo, useState } from 'react';
import { ChainId } from '../../../chains/index';
import { Abi, ContractPromise } from '../../../core/index';
import { useChain } from '../config/useChain.ts';
import { useApi } from '../substrate/useApi.ts';
import { ChainContract } from './types.ts';
import { useEffect, useMemo, useState } from 'react';

export function useContract<T extends ContractPromise = ContractPromise>(
address: string,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useCallback, useEffect, useMemo, useState } from 'react';
import { ChainId } from '../../../../chains/index.ts';
import {
BlueprintPromise,
Expand Down Expand Up @@ -27,6 +26,7 @@ import { useApi } from '../../substrate/useApi.ts';
import { useWallet } from '../../wallets/useWallet.ts';
import { useTxEvents } from '../useTxEvents.ts';
import { Deploy, DeploySignAndSend, DeployTx, DeployerError } from './types.ts';
import { useCallback, useEffect, useMemo, useState } from 'react';

export function useDeployer<T>(chainId?: ChainId): Deploy<T> {
const { account } = useWallet();
Expand Down
4 changes: 2 additions & 2 deletions packages/useink/src/react/hooks/contracts/useDryRun.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useMemo, useState } from 'react';
import {
DecodedTxResult,
LazyCallOptions,
Expand All @@ -9,6 +8,7 @@ import { useDefaultCaller } from '../config/index';
import { useWallet } from '../wallets/useWallet.ts';
import { ChainContract } from './types.ts';
import { useAbiMessage } from './useAbiMessage.ts';
import { useMemo, useState } from 'react';

export type DryRunResult<T> = DecodedTxResult<T>;

Expand All @@ -21,7 +21,7 @@ export interface DryRun<T> {
send: Send<T>;
isSubmitting: boolean;
result?: DryRunResult<T>;
resolved: boolean;
resolved: Boolean;
resetState: () => void;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { IEventLike } from '@polkadot/types/types/events';
import { useContext, useEffect } from 'react';
import { Bytes } from '../../../core/index';
import { getExpiredItem } from '../../../utils/index';
import { FIVE_SECONDS, HALF_A_SECOND } from '../../constants.ts';
Expand All @@ -8,6 +6,8 @@ import { useConfig } from '../config/useConfig.ts';
import { useInterval } from '../internal/useInterval.ts';
import { useBlockHeader } from '../substrate/useBlockHeader.ts';
import { ChainContract } from './types.ts';
import { IEventLike } from '@polkadot/types/types/events';
import { useContext, useEffect } from 'react';

export const useEventSubscription = (
chainContract: ChainContract | undefined,
Expand Down
2 changes: 1 addition & 1 deletion packages/useink/src/react/hooks/contracts/useEvents.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useContext, useMemo } from 'react';
import { AccountId } from '../../../core/index';
import { Event, EventsContext } from '../../providers/events/index';
import { RemoveEventPayload } from '../../providers/events/model.ts';
import { useContext, useMemo } from 'react';

export interface Events {
events: Event[];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useCallback, useState } from 'react';
import { SignatureResult } from '../../../core/index.ts';
import { useWallet } from '../wallets/useWallet.ts';
import { useCallback, useState } from 'react';

export type Sign = (data?: string) => void;

Expand Down
2 changes: 1 addition & 1 deletion packages/useink/src/react/hooks/contracts/useMetadata.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useEffect, useState } from 'react';
import { ChainId } from '../../../chains';
import {
DEFAULT,
Expand All @@ -8,6 +7,7 @@ import {
} from '../../../core';
import { MetadataError, toBasicMetadata } from '../../../utils';
import { useApi } from '../substrate/useApi';
import { useEffect, useState } from 'react';

export interface BasicMetadataFile {
data: Uint8Array;
Expand Down
2 changes: 1 addition & 1 deletion packages/useink/src/react/hooks/contracts/useSalter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useCallback, useState } from 'react';
import { isValidHash, pseudoRandomHex } from '../../../utils';
import { useCallback, useState } from 'react';

export enum SalterError {
InvalidHash = 'Invalid salt hash value.',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useCallback, useState } from 'react';
import { signatureVerify } from '../../../utils';
import { useCallback, useState } from 'react';

type VerificationParams = Parameters<typeof signatureVerify>;

Expand Down
2 changes: 1 addition & 1 deletion packages/useink/src/react/hooks/contracts/useTx.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useMemo, useState } from 'react';
import {
ApiBase,
ContractSubmittableResult,
Expand All @@ -11,6 +10,7 @@ import { useWallet } from '../wallets/useWallet.ts';
import { ChainContract } from './types.ts';
import { useDryRun } from './useDryRun.ts';
import { useTxEvents } from './useTxEvents.ts';
import { useMemo, useState } from 'react';

export type ContractSubmittableResultCallback = (
result?: ContractSubmittableResult,
Expand Down
2 changes: 1 addition & 1 deletion packages/useink/src/react/hooks/contracts/useTxEvents.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useCallback, useEffect, useState } from 'react';
import { EventRecord } from '../../../core';
import { isInBlock } from '../../../utils';
import { Tx } from './useTx';
import { useCallback, useEffect, useState } from 'react';

type Eventable = Pick<Tx<unknown>, 'status'> & Pick<Tx<unknown>, 'result'>;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useCallback, useState } from 'react';
import { ChainContract, useDefaultCaller } from '..';
import {
LazyCallOptions,
Expand All @@ -7,6 +6,7 @@ import {
txPaymentInfo,
} from '../../../core';
import { useWallet } from '../wallets/useWallet.ts';
import { useCallback, useState } from 'react';

type Send = (
params?: unknown[],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useMemo } from 'react';
import { unixMilliToDate } from '../../../utils/helpers/unixMilliToDate';
import { useMemo } from 'react';

export const useUnixMilliToDate = (
unixInMilliSeconds: number | undefined,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { useEffect, useState } from 'react';
import { ChainId } from '../../../../chains/index';
import { DeriveBalancesAccount, WithAddress } from '../../../../core/index';
import { getBalance } from '../../../../core/index';
import { useChain } from '../../index';
import { useApi } from '../useApi.ts';
import { useBlockHeader } from '../useBlockHeader.ts';
import { useEffect, useState } from 'react';

export const useBalance = (
account: WithAddress | undefined,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useEffect, useState } from 'react';
import { ChainId } from '../../../../chains';
import { getTimestampUnix } from '../../../../core';
import { useApi } from '../useApi';
import { useBlockHeader } from '../useBlockHeader';
import { useEffect, useState } from 'react';

// Get the current timestamp in milliseconds
export const useTimestampNow = (chainId?: ChainId): number | undefined => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useEffect, useState } from 'react';
import { ChainId } from '../../../../chains';
import { QueryableModuleCalls, getTimestampQuery } from '../../../../core';
import { useApi } from '../useApi';
import { useEffect, useState } from 'react';

// Get a queryable function that can then be used to call a chain: `await timestampQuery.now()`
export const useTimestampQuery = (
Expand Down
2 changes: 1 addition & 1 deletion packages/useink/src/react/hooks/substrate/useApi.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useContext } from 'react';
import { ChainId } from '../../../chains/index';
import { IApiProvider, useChain } from '../../index';
import { API, APIContext } from '../../providers/api/index';
import { useContext } from 'react';

export const useApis = (): API => useContext<API>(APIContext);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { useContext } from 'react';
import { ChainId } from '../../../chains/index';
import {
BlockHeaderContext,
ChainBlockHeaders,
} from '../../providers/blockHeader/index';
import { useChain } from '../config/useChain.ts';
import { BlockHeader } from './index';
import { useContext } from 'react';

export type { BlockHeader } from '../../providers/blockHeader/index';

Expand Down
2 changes: 1 addition & 1 deletion packages/useink/src/react/hooks/substrate/useTransfer.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useCallback, useMemo, useState } from 'react';
import { useChain, useWallet } from '../';
import { ChainId } from '../../../chains';
import { Hash, SignerOptions, transfer } from '../../../core';
import { useApi } from './useApi.ts';
import { useCallback, useMemo, useState } from 'react';

export type SignAndSendTransfer = (
to: string,
Expand Down
2 changes: 1 addition & 1 deletion packages/useink/src/react/hooks/wallets/useAllWallets.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useMemo } from 'react';
import { Wallet } from '../../providers/wallet/index';
import { useWallet } from '../index';
import { useMemo } from 'react';

export const useAllWallets = (): Wallet[] => {
const { getWallets } = useWallet();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useMemo } from 'react';
import { Wallet } from '../../providers/wallet/index';
import { useWallet } from '../index';
import { useMemo } from 'react';

export const useInstalledWallets = (): Wallet[] => {
const { getWallets } = useWallet();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useMemo } from 'react';
import { Wallet } from '../../providers/wallet/index';
import { useWallet } from './useWallet.ts';
import { useMemo } from 'react';

export const useUninstalledWallets = (): Wallet[] => {
const { getWallets } = useWallet();
Expand Down
2 changes: 1 addition & 1 deletion packages/useink/src/react/hooks/wallets/useWallet.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useContext } from 'react';
import { WalletContext, WalletState } from '../../providers/wallet/index';
import { useContext } from 'react';

export type { WalletState } from '../../providers/wallet/index';

Expand Down
2 changes: 1 addition & 1 deletion packages/useink/src/react/providers/UseInkProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import { APIProvider } from './api/provider.tsx';
import { BlockHeaderProvider } from './blockHeader/index';
import { ConfigProps, ConfigProvider } from './config/index';
import { EventsProvider } from './events/index';
import { WalletProvider } from './wallet/index';
import React from 'react';

export type InkConfig = {
config: ConfigProps;
Expand Down
2 changes: 1 addition & 1 deletion packages/useink/src/react/providers/api/context.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createContext } from 'react';
import { API } from './model.ts';
import { createContext } from 'react';

export const APIContext = createContext<API>({
apis: {},
Expand Down
Loading

0 comments on commit e1affef

Please sign in to comment.