Skip to content
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
7 changes: 4 additions & 3 deletions src/useStellar/useAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ import type {
} from '@bluxcc/core/dist/exports/core/getAccount';

import { getAddress, getNetwork } from '../utils';
import type { QueryOptions } from '../utils';

type R = GetAccountResult;
type O = GetAccountOptions;

export function useAccount(
options?: O,
queryOptions?: UseQueryOptions<R, Error>,
queryOptions?: QueryOptions<R>
): UseQueryResult<R, Error> {
const address = getAddress(options?.address);
const network = getNetwork(options?.network);
Expand Down Expand Up @@ -47,10 +48,10 @@ export function useAccount(
);

const result = useQuery<R, Error>({
...(queryOptions as UseQueryOptions<R, Error> | undefined),
enabled,
queryKey,
queryFn,
enabled,
...queryOptions,
});

return result;
Expand Down
7 changes: 4 additions & 3 deletions src/useStellar/useAccounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ import type {
} from '@bluxcc/core/dist/exports/core/getAccounts';

import { getNetwork } from '../utils';
import type { QueryOptions } from '../utils';

type R = GetAccountsResult;
type O = GetAccountsOptions;

export function useAccounts(
options?: O,
queryOptions?: UseQueryOptions<R, Error>,
queryOptions?: QueryOptions<R>
): UseQueryResult<R, Error> {
const network = getNetwork(options?.network);
const enabled = queryOptions?.enabled ?? true;
Expand Down Expand Up @@ -51,10 +52,10 @@ export function useAccounts(
);

const result = useQuery<R, Error>({
...(queryOptions as UseQueryOptions<R, Error> | undefined),
enabled,
queryKey,
queryFn,
enabled,
...queryOptions,
});

return result;
Expand Down
7 changes: 4 additions & 3 deletions src/useStellar/useAssets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ import type {
} from "@bluxcc/core/dist/exports/core/getAssets";

import { getNetwork } from '../utils';
import type { QueryOptions } from '../utils';

type R = GetAssetsResult;
type O = GetAssetsOptions;

export function useAssets(
options?: O,
queryOptions?: UseQueryOptions<R, Error>,
queryOptions?: QueryOptions<R>
): UseQueryResult<R, Error> {
const network = getNetwork(options?.network);
const enabled = queryOptions?.enabled ?? true;
Expand Down Expand Up @@ -49,10 +50,10 @@ export function useAssets(
);

const result = useQuery<R, Error>({
...(queryOptions as UseQueryOptions<R, Error> | undefined),
enabled,
queryKey,
queryFn,
enabled,
...queryOptions,
});

return result;
Expand Down
7 changes: 4 additions & 3 deletions src/useStellar/useBalances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ import type {
} from "@bluxcc/core/dist/exports/core/getBalances";

import { getAddress, getNetwork } from '../utils';
import type { QueryOptions } from '../utils';

type R = GetBalancesResult;
type O = GetBalancesOptions;

export function useBalances(
options?: O,
queryOptions?: UseQueryOptions<R, Error>,
queryOptions?: QueryOptions<R>
): UseQueryResult<R, Error> {
const address = getAddress(options?.address);
const network = getNetwork(options?.network);
Expand Down Expand Up @@ -50,10 +51,10 @@ export function useBalances(
);

const result = useQuery<R, Error>({
...(queryOptions as UseQueryOptions<R, Error> | undefined),
enabled,
queryKey,
queryFn,
enabled,
...queryOptions,
});

return result;
Expand Down
7 changes: 4 additions & 3 deletions src/useStellar/useClaimableBalances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ import type {
} from "@bluxcc/core/dist/exports/core/getClaimableBalances";

import { getAddress, getNetwork } from '../utils';
import type { QueryOptions } from '../utils';

type R = GetClaimableBalancesResult;
type O = GetClaimableBalancesOptions;

export function useClaimableBalances(
options: O,
queryOptions?: UseQueryOptions<R, Error>,
queryOptions?: QueryOptions<R>
): UseQueryResult<R, Error> {
const claimant = getAddress(options.claimant);
const network = getNetwork(options?.network);
Expand Down Expand Up @@ -52,10 +53,10 @@ export function useClaimableBalances(
);

const result = useQuery<R, Error>({
...(queryOptions as UseQueryOptions<R, Error> | undefined),
enabled,
queryKey,
queryFn,
enabled,
...queryOptions,
});

return result;
Expand Down
7 changes: 4 additions & 3 deletions src/useStellar/useEffects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ import type {
} from "@bluxcc/core/dist/exports/core/getEffects";

import { getNetwork } from '../utils';
import type { QueryOptions } from '../utils';

type R = GetEffectsResult;
type O = GetEffectsOptions;

export function useEffects(
options?: O,
queryOptions?: UseQueryOptions<R, Error>,
queryOptions?: QueryOptions<R>
): UseQueryResult<R, Error> {
const network = getNetwork(options?.network);
const enabled = queryOptions?.enabled ?? true;
Expand Down Expand Up @@ -52,10 +53,10 @@ export function useEffects(
);

const result = useQuery<R, Error>({
...(queryOptions as UseQueryOptions<R, Error> | undefined),
enabled,
queryKey,
queryFn,
enabled,
...queryOptions,
});

return result;
Expand Down
7 changes: 4 additions & 3 deletions src/useStellar/useLedgers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ import type {
} from "@bluxcc/core/dist/exports/core/getLedgers";

import { getNetwork } from '../utils';
import type { QueryOptions } from '../utils';

type R = GetLedgersResult;
type O = GetLedgersOptions;

export function useLedgers(
options?: O,
queryOptions?: UseQueryOptions<R, Error>,
queryOptions?: QueryOptions<R>
): UseQueryResult<R, Error> {
const network = getNetwork(options?.network);
const enabled = queryOptions?.enabled ?? true;
Expand Down Expand Up @@ -48,10 +49,10 @@ export function useLedgers(
);

const result = useQuery<R, Error>({
...(queryOptions as UseQueryOptions<R, Error> | undefined),
enabled,
queryKey,
queryFn,
enabled,
...queryOptions,
});

return result;
Expand Down
7 changes: 4 additions & 3 deletions src/useStellar/useLiquidityPools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ import type {
} from "@bluxcc/core/dist/exports/core/getLiquidityPools";

import { getNetwork } from '../utils';
import type { QueryOptions } from '../utils';

type R = GetLiquidityPoolsResult;
type O = GetLiquidityPoolsOptions;

export function useLiquidityPools(
options?: O,
queryOptions?: UseQueryOptions<R, Error>,
queryOptions?: QueryOptions<R>
): UseQueryResult<R, Error> {
const network = getNetwork(options?.network);
const enabled = queryOptions?.enabled ?? true;
Expand Down Expand Up @@ -49,10 +50,10 @@ export function useLiquidityPools(
);

const result = useQuery<R, Error>({
...(queryOptions as UseQueryOptions<R, Error> | undefined),
enabled,
queryKey,
queryFn,
enabled,
...queryOptions,
});

return result;
Expand Down
8 changes: 4 additions & 4 deletions src/useStellar/useOffers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ import type {
} from "@bluxcc/core/dist/exports/core/getOffers";

import { getNetwork } from '../utils';
import type { QueryOptions } from '../utils';

type R = GetOffersResult;
type O = GetOffersOptions;

export function useOffers(
options?: O,
queryOptions?: UseQueryOptions<R, Error>,
queryOptions?: QueryOptions<R>
): UseQueryResult<R, Error> {
const network = getNetwork(options?.network);
const enabled = queryOptions?.enabled ?? true;
Expand All @@ -28,7 +29,6 @@ export function useOffers(
options?.selling,
options?.sponsor,
options?.seller,
options?.forAccount,
options?.cursor,
options?.limit,
options?.network,
Expand All @@ -53,10 +53,10 @@ export function useOffers(
);

const result = useQuery<R, Error>({
...(queryOptions as UseQueryOptions<R, Error> | undefined),
enabled,
queryKey,
queryFn,
enabled,
...queryOptions,
});

return result;
Expand Down
7 changes: 4 additions & 3 deletions src/useStellar/useOperations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ import type {
} from "@bluxcc/core/dist/exports/core/getOperations";

import { getNetwork } from '../utils';
import type { QueryOptions } from '../utils';

type R = GetOperationsResult;
type O = GetOperationsOptions;

export function useOperations(
options?: O,
queryOptions?: UseQueryOptions<R, Error>,
queryOptions?: QueryOptions<R>
): UseQueryResult<R, Error> {
const network = getNetwork(options?.network);
const enabled = queryOptions?.enabled ?? true;
Expand Down Expand Up @@ -54,10 +55,10 @@ export function useOperations(
);

const result = useQuery<R, Error>({
...(queryOptions as UseQueryOptions<R, Error> | undefined),
enabled,
queryKey,
queryFn,
enabled,
...queryOptions,
});

return result;
Expand Down
10 changes: 5 additions & 5 deletions src/useStellar/useOrderbook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ import type {
} from "@bluxcc/core/dist/exports/core/getOrderbook";

import { Asset } from '@stellar/stellar-sdk';
import { CallBuilderOptions } from '../utils';
import { getNetwork } from '../utils';
import { CallBuilderOptions, getNetwork } from '../utils';
import type { QueryOptions } from '../utils';

type R = GetOrderbookResult;
type O = CallBuilderOptions;

export function useOrderbook(
args: [selling: Asset, buying: Asset],
options?: O,
queryOptions?: UseQueryOptions<R, Error>,
queryOptions?: QueryOptions<R>
): UseQueryResult<R, Error> {
const network = getNetwork(options?.network);
const enabled = queryOptions?.enabled ?? true;
Expand Down Expand Up @@ -51,9 +51,9 @@ export function useOrderbook(
);

return useQuery<R, Error>({
...(queryOptions as UseQueryOptions<R, Error> | undefined),
enabled,
queryKey,
queryFn,
enabled,
...queryOptions,
});
}
7 changes: 4 additions & 3 deletions src/useStellar/usePayments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type {
import { PaymentCallBuilder } from '@stellar/stellar-sdk/lib/horizon/payment_call_builder';
import { ServerApi } from '@stellar/stellar-sdk/lib/horizon';
import { getNetwork } from '../utils';
import type { QueryOptions } from '../utils';

type R = {
builder: PaymentCallBuilder;
Expand All @@ -21,7 +22,7 @@ type O = GetPaymentsOptions;

export function usePayments(
options?: O,
queryOptions?: UseQueryOptions<R, Error>,
queryOptions?: QueryOptions<R>
): UseQueryResult<R, Error> {
const network = getNetwork(options?.network);
const enabled = queryOptions?.enabled ?? true;
Expand Down Expand Up @@ -55,10 +56,10 @@ export function usePayments(
);

const result = useQuery<R, Error>({
...(queryOptions as UseQueryOptions<R, Error> | undefined),
enabled,
queryKey,
queryFn,
enabled,
...queryOptions,
});

return result;
Expand Down
10 changes: 5 additions & 5 deletions src/useStellar/useStrictReceivePaths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import type {
} from "@bluxcc/core/dist/exports/core/getStrictReceivePaths";

import { Asset } from '@stellar/stellar-sdk';
import { CallBuilderOptions } from '../utils';
import { getNetwork } from '../utils';
import { CallBuilderOptions, getNetwork } from '../utils';
import type { QueryOptions } from '../utils';

type R = GetPaymentPathResult;
type O = CallBuilderOptions;
Expand All @@ -23,7 +23,7 @@ export function useStrictReceivePaths(
destinationAmount: string,
],
options?: O,
queryOptions?: UseQueryOptions<R, Error>,
queryOptions?: QueryOptions<R>
): UseQueryResult<R, Error> {
const network = getNetwork(options?.network);
const enabled = queryOptions?.enabled ?? true;
Expand Down Expand Up @@ -56,10 +56,10 @@ export function useStrictReceivePaths(
);

const result = useQuery<R, Error>({
...(queryOptions as UseQueryOptions<R, Error> | undefined),
enabled,
queryKey,
queryFn,
enabled,
...queryOptions,
});

return result;
Expand Down
Loading