@bluxcc/react 0.3.6 → 0.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/Provider.d.ts +91 -2
  2. package/dist/hooks/index.d.ts +1 -0
  3. package/dist/hooks/useBlux.d.ts +3 -1
  4. package/dist/hooks/useJwt.d.ts +19 -0
  5. package/dist/hooks/useLoginAction.d.ts +5 -1
  6. package/dist/hooks/useLoginCode.d.ts +21 -2
  7. package/dist/hooks/useLoginEmail.d.ts +33 -3
  8. package/dist/hooks/useLoginOAuth.d.ts +31 -3
  9. package/dist/hooks/useLoginPasskey.d.ts +19 -3
  10. package/dist/hooks/useLoginSms.d.ts +33 -3
  11. package/dist/hooks/useLoginWallet.d.ts +19 -3
  12. package/dist/index.cjs.js +1 -1
  13. package/dist/index.d.ts +2 -2
  14. package/dist/index.esm.js +1 -1
  15. package/dist/useStellar/index.d.ts +3 -0
  16. package/dist/useStellar/useAccount.d.ts +12 -4
  17. package/dist/useStellar/useAccounts.d.ts +2 -2
  18. package/dist/useStellar/useAssets.d.ts +17 -3
  19. package/dist/useStellar/useBalances.d.ts +12 -2
  20. package/dist/useStellar/useClaimableBalances.d.ts +18 -2
  21. package/dist/useStellar/useEffects.d.ts +21 -2
  22. package/dist/useStellar/useLedgers.d.ts +13 -2
  23. package/dist/useStellar/useLiquidityPools.d.ts +16 -2
  24. package/dist/useStellar/useOffers.d.ts +22 -2
  25. package/dist/useStellar/useOperations.d.ts +23 -2
  26. package/dist/useStellar/useOrderbook.d.ts +7 -2
  27. package/dist/useStellar/usePayments.d.ts +19 -2
  28. package/dist/useStellar/useReadContract.d.ts +54 -0
  29. package/dist/useStellar/useReadContracts.d.ts +20 -10
  30. package/dist/useStellar/useResolveXlmName.d.ts +22 -0
  31. package/dist/useStellar/useResolveXlmNameByAddress.d.ts +23 -0
  32. package/dist/useStellar/useSacAddress.d.ts +2 -2
  33. package/dist/useStellar/useStrictReceivePaths.d.ts +9 -4
  34. package/dist/useStellar/useStrictSendPaths.d.ts +10 -5
  35. package/dist/useStellar/useSwap.d.ts +32 -3
  36. package/dist/useStellar/useTokenMetadata.d.ts +7 -4
  37. package/dist/useStellar/useTradeAggregation.d.ts +7 -2
  38. package/dist/useStellar/useTrades.d.ts +22 -2
  39. package/dist/useStellar/useTransactions.d.ts +21 -2
  40. package/dist/useStellar/useTransfer.d.ts +39 -4
  41. package/dist/useStellar/useWriteContract.d.ts +16 -15
  42. package/package.json +2 -2
@@ -1,5 +1,5 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
- import type { GetAccountsResult, GetAccountsOptions } from '@bluxcc/core/dist/exports/core/getAccounts';
2
+ import type { GetAccountsResult, GetAccountsOptions } from '@bluxcc/core';
3
3
  import type { QueryOptions } from '../utils';
4
4
  type R = GetAccountsResult;
5
5
  type O = GetAccountsOptions;
@@ -22,7 +22,7 @@ type O = GetAccountsOptions;
22
22
  *
23
23
  * @example
24
24
  * ```tsx
25
- * const { data } = useAccounts({ forSigner: 'GA…', limit: 20 });
25
+ * const { data } = useAccounts({ forSigner: 'alice.xlm', limit: 20 });
26
26
  * data?.response.records.forEach((a) => console.log(a.account_id));
27
27
  * ```
28
28
  */
@@ -1,5 +1,5 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
- import type { GetAssetsResult, GetAssetsOptions } from "@bluxcc/core/dist/exports/core/getAssets";
2
+ import type { GetAssetsResult, GetAssetsOptions } from '@bluxcc/core';
3
3
  import type { QueryOptions } from '../utils';
4
4
  type R = GetAssetsResult;
5
5
  type O = GetAssetsOptions;
@@ -7,7 +7,8 @@ type O = GetAssetsOptions;
7
7
  * Fetches a paginated list of assets issued on the network from Horizon.
8
8
  *
9
9
  * Optionally narrow the list by `forCode` (asset code, e.g. "USDC") and/or
10
- * `forIssuer` (the issuing `G…` address). With no filter it returns all assets.
10
+ * `forIssuer` (a `G…`/`M…`, SEP-2, or `.xlm` account). With no filter it
11
+ * returns all assets.
11
12
  *
12
13
  * @param options - `forCode` / `forIssuer` filters, plus optional
13
14
  * `cursor` / `limit` / `order` and `network` (defaults to the active network).
@@ -21,5 +22,18 @@ type O = GetAssetsOptions;
21
22
  * const { data } = useAssets({ forCode: 'USDC' });
22
23
  * ```
23
24
  */
24
- export declare function useAssets(options?: O, queryOptions?: QueryOptions<R>): UseQueryResult<R, Error>;
25
+ export declare function useAssets(options?: {
26
+ /** Paging token; pass the previous page's cursor to fetch the next page. */
27
+ cursor?: string;
28
+ /** Maximum number of records returned per page. */
29
+ limit?: number;
30
+ /** Network passphrase to query. Defaults to the active network. */
31
+ network?: string;
32
+ /** Sort direction by ledger sequence. Defaults to Horizon's `asc`. */
33
+ order?: 'asc' | 'desc';
34
+ /** Filter to a single asset code (e.g. `USDC`). */
35
+ forCode?: string;
36
+ /** Filter to assets issued by this account id, SEP-2 address, or `.xlm` name. */
37
+ forIssuer?: string;
38
+ }, queryOptions?: QueryOptions<R>): UseQueryResult<R, Error>;
25
39
  export {};
@@ -1,5 +1,5 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
- import type { GetBalancesResult, GetBalancesOptions } from "@bluxcc/core/dist/exports/core/getBalances";
2
+ import type { GetBalancesResult, GetBalancesOptions } from "@bluxcc/core";
3
3
  import type { QueryOptions } from '../utils';
4
4
  type R = GetBalancesResult;
5
5
  type O = GetBalancesOptions;
@@ -24,5 +24,15 @@ type O = GetBalancesOptions;
24
24
  * const xlm = balances?.find((b) => b.asset_type === 'native');
25
25
  * ```
26
26
  */
27
- export declare function useBalances(options?: O, queryOptions?: QueryOptions<R>): UseQueryResult<R, Error>;
27
+ export declare function useBalances(options?: {
28
+ /**
29
+ * Account whose balances to read: a Stellar address (`G...`/`M...`), SEP-2
30
+ * federated address, or `.xlm` name. Defaults to the logged-in account.
31
+ */
32
+ address?: string;
33
+ /** Network passphrase to query. Defaults to the active network. */
34
+ network?: string;
35
+ /** Keep balance lines whose balance is exactly zero. Defaults to `false`. */
36
+ includeZeroBalances?: boolean;
37
+ }, queryOptions?: QueryOptions<R>): UseQueryResult<R, Error>;
28
38
  export {};
@@ -1,5 +1,6 @@
1
+ import type { AssetArg } from '@bluxcc/core';
1
2
  import { UseQueryResult } from '@tanstack/react-query';
2
- import type { GetClaimableBalancesResult, GetClaimableBalancesOptions } from "@bluxcc/core/dist/exports/core/getClaimableBalances";
3
+ import type { GetClaimableBalancesResult, GetClaimableBalancesOptions } from "@bluxcc/core";
3
4
  import type { QueryOptions } from '../utils';
4
5
  type R = GetClaimableBalancesResult;
5
6
  type O = GetClaimableBalancesOptions;
@@ -23,5 +24,20 @@ type O = GetClaimableBalancesOptions;
23
24
  * const { data } = useClaimableBalances({ asset: Asset.native() });
24
25
  * ```
25
26
  */
26
- export declare function useClaimableBalances(options: O, queryOptions?: QueryOptions<R>): UseQueryResult<R, Error>;
27
+ export declare function useClaimableBalances(options: {
28
+ /** Paging token; pass the previous page's cursor to fetch the next page. */
29
+ cursor?: string;
30
+ /** Maximum number of records returned per page. */
31
+ limit?: number;
32
+ /** Network passphrase to query. Defaults to the active network. */
33
+ network?: string;
34
+ /** Sort direction by ledger sequence. Defaults to Horizon's `asc`. */
35
+ order?: 'asc' | 'desc';
36
+ /** Only balances of this asset (`'xlm'`, `'CODE:ISSUER'`, or an `Asset`). */
37
+ asset: AssetArg;
38
+ /** Only balances sponsored by this account id, SEP-2 address, or `.xlm` name. */
39
+ sponsor?: string;
40
+ /** Only balances claimable by this account (address, SEP-2 address, or `.xlm` name). */
41
+ claimant: string;
42
+ }, queryOptions?: QueryOptions<R>): UseQueryResult<R, Error>;
27
43
  export {};
@@ -1,5 +1,5 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
- import type { GetEffectsResult, GetEffectsOptions } from "@bluxcc/core/dist/exports/core/getEffects";
2
+ import type { GetEffectsResult, GetEffectsOptions } from "@bluxcc/core";
3
3
  import type { QueryOptions } from '../utils';
4
4
  type R = GetEffectsResult;
5
5
  type O = GetEffectsOptions;
@@ -24,5 +24,24 @@ type O = GetEffectsOptions;
24
24
  * const { data } = useEffects({ forAccount: 'GA…', limit: 50 });
25
25
  * ```
26
26
  */
27
- export declare function useEffects(options?: O, queryOptions?: QueryOptions<R>): UseQueryResult<R, Error>;
27
+ export declare function useEffects(options?: {
28
+ /** Paging token; pass the previous page's cursor to fetch the next page. */
29
+ cursor?: string;
30
+ /** Maximum number of records returned per page. */
31
+ limit?: number;
32
+ /** Network passphrase to query. Defaults to the active network. */
33
+ network?: string;
34
+ /** Sort direction by ledger sequence. Defaults to Horizon's `asc`. */
35
+ order?: 'asc' | 'desc';
36
+ /** Only effects touching this account (address, SEP-2 address, or `.xlm` name). */
37
+ forAccount?: string;
38
+ /** Only effects in this ledger, by sequence number. */
39
+ forLedger?: string | number;
40
+ /** Only effects in this transaction, by hash. */
41
+ forTransaction?: string;
42
+ /** Only effects produced by this operation id. */
43
+ forOperation?: string;
44
+ /** Only effects for this liquidity pool id. */
45
+ forLiquidityPool?: string;
46
+ }, queryOptions?: QueryOptions<R>): UseQueryResult<R, Error>;
28
47
  export {};
@@ -1,5 +1,5 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
- import type { GetLedgersResult, GetLedgersOptions } from "@bluxcc/core/dist/exports/core/getLedgers";
2
+ import type { GetLedgersResult, GetLedgersOptions } from "@bluxcc/core";
3
3
  import type { QueryOptions } from '../utils';
4
4
  type R = GetLedgersResult;
5
5
  type O = GetLedgersOptions;
@@ -21,5 +21,16 @@ type O = GetLedgersOptions;
21
21
  * const { data } = useLedgers({ limit: 10, order: 'desc' });
22
22
  * ```
23
23
  */
24
- export declare function useLedgers(options?: O, queryOptions?: QueryOptions<R>): UseQueryResult<R, Error>;
24
+ export declare function useLedgers(options?: {
25
+ /** Paging token; pass the previous page's cursor to fetch the next page. */
26
+ cursor?: string;
27
+ /** Maximum number of records returned per page. */
28
+ limit?: number;
29
+ /** Network passphrase to query. Defaults to the active network. */
30
+ network?: string;
31
+ /** Sort direction by ledger sequence. Defaults to Horizon's `asc`. */
32
+ order?: 'asc' | 'desc';
33
+ /** Fetch a single ledger by its sequence number. */
34
+ ledger?: number | string;
35
+ }, queryOptions?: QueryOptions<R>): UseQueryResult<R, Error>;
25
36
  export {};
@@ -1,5 +1,6 @@
1
+ import type { AssetArg } from '@bluxcc/core';
1
2
  import { UseQueryResult } from '@tanstack/react-query';
2
- import type { GetLiquidityPoolsResult, GetLiquidityPoolsOptions } from "@bluxcc/core/dist/exports/core/getLiquidityPools";
3
+ import type { GetLiquidityPoolsResult, GetLiquidityPoolsOptions } from "@bluxcc/core";
3
4
  import type { QueryOptions } from '../utils';
4
5
  type R = GetLiquidityPoolsResult;
5
6
  type O = GetLiquidityPoolsOptions;
@@ -24,5 +25,18 @@ type O = GetLiquidityPoolsOptions;
24
25
  * });
25
26
  * ```
26
27
  */
27
- export declare function useLiquidityPools(options?: O, queryOptions?: QueryOptions<R>): UseQueryResult<R, Error>;
28
+ export declare function useLiquidityPools(options?: {
29
+ /** Paging token; pass the previous page's cursor to fetch the next page. */
30
+ cursor?: string;
31
+ /** Maximum number of records returned per page. */
32
+ limit?: number;
33
+ /** Network passphrase to query. Defaults to the active network. */
34
+ network?: string;
35
+ /** Sort direction by ledger sequence. Defaults to Horizon's `asc`. */
36
+ order?: 'asc' | 'desc';
37
+ /** Only pools made up of exactly these reserve assets (`'xlm'`, `'CODE:ISSUER'`, or `Asset`). */
38
+ forAssets?: Array<AssetArg>;
39
+ /** Only pools this account holds shares in (address, SEP-2 address, or `.xlm` name). */
40
+ forAccount?: string;
41
+ }, queryOptions?: QueryOptions<R>): UseQueryResult<R, Error>;
28
42
  export {};
@@ -1,5 +1,6 @@
1
+ import type { AssetArg } from '@bluxcc/core';
1
2
  import { UseQueryResult } from '@tanstack/react-query';
2
- import type { GetOffersResult, GetOffersOptions } from "@bluxcc/core/dist/exports/core/getOffers";
3
+ import type { GetOffersResult, GetOffersOptions } from "@bluxcc/core";
3
4
  import type { QueryOptions } from '../utils';
4
5
  type R = GetOffersResult;
5
6
  type O = GetOffersOptions;
@@ -22,5 +23,24 @@ type O = GetOffersOptions;
22
23
  * const { data } = useOffers({ seller: 'GA…' });
23
24
  * ```
24
25
  */
25
- export declare function useOffers(options?: O, queryOptions?: QueryOptions<R>): UseQueryResult<R, Error>;
26
+ export declare function useOffers(options?: {
27
+ /** Paging token; pass the previous page's cursor to fetch the next page. */
28
+ cursor?: string;
29
+ /** Maximum number of records returned per page. */
30
+ limit?: number;
31
+ /** Network passphrase to query. Defaults to the active network. */
32
+ network?: string;
33
+ /** Sort direction by ledger sequence. Defaults to Horizon's `asc`. */
34
+ order?: 'asc' | 'desc';
35
+ /** Only offers owned by this account (address, SEP-2 address, or `.xlm` name). */
36
+ forAccount?: string;
37
+ /** Only offers buying this asset (`'xlm'`, `'CODE:ISSUER'`, or an `Asset`). */
38
+ buying?: AssetArg;
39
+ /** Only offers selling this asset (`'xlm'`, `'CODE:ISSUER'`, or an `Asset`). */
40
+ selling?: AssetArg;
41
+ /** Only offers sponsored by this account id, SEP-2 address, or `.xlm` name. */
42
+ sponsor?: string;
43
+ /** Only offers created by this seller (address, SEP-2 address, or `.xlm` name). */
44
+ seller?: string;
45
+ }, queryOptions?: QueryOptions<R>): UseQueryResult<R, Error>;
26
46
  export {};
@@ -1,5 +1,5 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
- import type { GetOperationsResult, GetOperationsOptions } from "@bluxcc/core/dist/exports/core/getOperations";
2
+ import type { GetOperationsResult, GetOperationsOptions } from "@bluxcc/core";
3
3
  import type { QueryOptions } from '../utils';
4
4
  type R = GetOperationsResult;
5
5
  type O = GetOperationsOptions;
@@ -23,5 +23,26 @@ type O = GetOperationsOptions;
23
23
  * const { data } = useOperations({ forAccount: 'GA…', includeFailed: false });
24
24
  * ```
25
25
  */
26
- export declare function useOperations(options?: O, queryOptions?: QueryOptions<R>): UseQueryResult<R, Error>;
26
+ export declare function useOperations(options?: {
27
+ /** Paging token; pass the previous page's cursor to fetch the next page. */
28
+ cursor?: string;
29
+ /** Maximum number of records returned per page. */
30
+ limit?: number;
31
+ /** Network passphrase to query. Defaults to the active network. */
32
+ network?: string;
33
+ /** Sort direction by ledger sequence. Defaults to Horizon's `asc`. */
34
+ order?: 'asc' | 'desc';
35
+ /** Only operations touching this account (address, SEP-2 address, or `.xlm` name). */
36
+ forAccount?: string;
37
+ /** Only operations for this claimable balance id. */
38
+ forClaimableBalance?: string;
39
+ /** Only operations in this ledger, by sequence number. */
40
+ forLedger?: string | number;
41
+ /** Only operations in this transaction, by hash. */
42
+ forTransaction?: string;
43
+ /** Only operations for this liquidity pool id. */
44
+ forLiquidityPool?: string;
45
+ /** Include operations from failed transactions. Defaults to `false`. */
46
+ includeFailed?: boolean;
47
+ }, queryOptions?: QueryOptions<R>): UseQueryResult<R, Error>;
27
48
  export {};
@@ -1,5 +1,5 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
- import type { GetOrderbookResult } from "@bluxcc/core/dist/exports/core/getOrderbook";
2
+ import type { GetOrderbookResult } from "@bluxcc/core";
3
3
  import { Asset } from '@stellar/stellar-sdk';
4
4
  import { CallBuilderOptions } from '../utils';
5
5
  import type { QueryOptions } from '../utils';
@@ -24,5 +24,10 @@ type O = CallBuilderOptions;
24
24
  * console.log(data?.response.bids, data?.response.asks);
25
25
  * ```
26
26
  */
27
- export declare function useOrderbook(args: [selling: Asset, buying: Asset], options?: O, queryOptions?: QueryOptions<R>): UseQueryResult<R, Error>;
27
+ export declare function useOrderbook(args: [selling: Asset, buying: Asset], options?: {
28
+ cursor?: string;
29
+ limit?: number;
30
+ network?: string;
31
+ order?: 'asc' | 'desc';
32
+ }, queryOptions?: QueryOptions<R>): UseQueryResult<R, Error>;
28
33
  export {};
@@ -1,5 +1,5 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
- import type { GetPaymentsOptions } from '@bluxcc/core/dist/exports/core/getPayments';
2
+ import type { GetPaymentsOptions } from '@bluxcc/core';
3
3
  import { ServerApi } from '@stellar/stellar-sdk/lib/esm/horizon';
4
4
  import { PaymentCallBuilder } from '@stellar/stellar-sdk/lib/esm/horizon/payment_call_builder';
5
5
  import type { QueryOptions } from '../utils';
@@ -28,5 +28,22 @@ type O = GetPaymentsOptions;
28
28
  * const { data } = usePayments({ forAccount: 'GA…' });
29
29
  * ```
30
30
  */
31
- export declare function usePayments(options?: O, queryOptions?: QueryOptions<R>): UseQueryResult<R, Error>;
31
+ export declare function usePayments(options?: {
32
+ /** Paging token; pass the previous page's cursor to fetch the next page. */
33
+ cursor?: string;
34
+ /** Maximum number of records returned per page. */
35
+ limit?: number;
36
+ /** Network passphrase to query. Defaults to the active network. */
37
+ network?: string;
38
+ /** Sort direction by ledger sequence. Defaults to Horizon's `asc`. */
39
+ order?: 'asc' | 'desc';
40
+ /** Only payments touching this account (address, SEP-2 address, or `.xlm` name). */
41
+ forAccount?: string;
42
+ /** Only payments in this ledger, by sequence number. */
43
+ forLedger?: string | number;
44
+ /** Only payments in this transaction, by hash. */
45
+ forTransaction?: string;
46
+ /** Include payments from failed transactions. Defaults to `false`. */
47
+ includeFailed?: boolean;
48
+ }, queryOptions?: QueryOptions<R>): UseQueryResult<R, Error>;
32
49
  export {};
@@ -0,0 +1,54 @@
1
+ import { readContract } from '@bluxcc/core';
2
+ import { UseQueryResult } from '@tanstack/react-query';
3
+ import type { IContractCall, ReadContractsOptions } from '@bluxcc/core';
4
+ import type { QueryOptions } from '../utils';
5
+ type CoreReadContractResult = Awaited<ReturnType<typeof readContract>>;
6
+ /** Typed result returned by {@link useReadContract}. */
7
+ export type ReadContractHookResult<TReturnValue = unknown> = Omit<CoreReadContractResult, 'value'> & {
8
+ /** Decoded return value of the contract call. */
9
+ value: TReturnValue;
10
+ };
11
+ type O = ReadContractsOptions;
12
+ /**
13
+ * Reads one Soroban contract function by simulating it — no transaction is
14
+ * submitted, so no signature or fees are required.
15
+ *
16
+ * The call names a contract `address`, a function `fn`, and a positional
17
+ * `args` array. Native values are encoded from the deployed contract ABI, and
18
+ * pre-built `xdr.ScVal`s remain supported. The result comes back already
19
+ * decoded in `data.value`, with the raw simulation in `data.raw`. For several
20
+ * calls at once use `useReadContracts`. For state-changing calls use
21
+ * `useWriteContract`.
22
+ *
23
+ * @param call - The contract call to simulate, `{ address, fn, args }`.
24
+ * @param options - Optional `network` (defaults to the active network).
25
+ * @param queryOptions - Optional TanStack Query options (`enabled`, `staleTime`,
26
+ * …). `queryKey`/`queryFn` are managed by the hook.
27
+ * @returns A TanStack Query result. `data` is `{ raw, value }`.
28
+ *
29
+ * @example
30
+ * ```tsx
31
+ * const { data } = useReadContract<string>({
32
+ * address: 'token.xlm',
33
+ * fn: 'balance',
34
+ * args: ['alice.xlm'],
35
+ * });
36
+ * const balance = data?.value; // string
37
+ * ```
38
+ */
39
+ export declare function useReadContract<TReturnValue = unknown>(call: {
40
+ /** Contract id (`C...`) or `.xlm`/SEP-2 name resolving to a contract. */
41
+ address: string;
42
+ /** Name of the contract function to call. */
43
+ fn: string;
44
+ /**
45
+ * Positional call arguments. Native JS values are encoded from the deployed
46
+ * contract's spec; address-typed strings may be `G...`, `C...`, SEP-2, or
47
+ * `.xlm` names. Pre-encoded {@link xdr.ScVal} values are also accepted.
48
+ */
49
+ args: unknown[];
50
+ }, options?: {
51
+ /** Network passphrase to simulate against. Defaults to the active network. */
52
+ network?: string;
53
+ }, queryOptions?: QueryOptions<ReadContractHookResult<TReturnValue>>): UseQueryResult<ReadContractHookResult<TReturnValue>, Error>;
54
+ export {};
@@ -1,17 +1,23 @@
1
1
  import { readContracts } from '@bluxcc/core';
2
2
  import { UseQueryResult } from '@tanstack/react-query';
3
- import type { IContractCall, ReadContractsOptions } from '@bluxcc/core/dist/exports/utils';
3
+ import type { IContractCall, ReadContractsOptions } from '@bluxcc/core';
4
4
  import type { QueryOptions } from '../utils';
5
- type R = Awaited<ReturnType<typeof readContracts>>;
5
+ type CoreReadContractsResult = Exclude<Awaited<ReturnType<typeof readContracts>>, readonly unknown[]>;
6
+ /** Typed result returned by {@link useReadContracts}. */
7
+ export type ReadContractsHookResult<TValues extends readonly unknown[] = readonly unknown[]> = Omit<CoreReadContractsResult, 'values'> & {
8
+ /** Decoded return values, index-aligned with the supplied calls. */
9
+ values: TValues;
10
+ };
6
11
  type O = ReadContractsOptions;
7
12
  /**
8
13
  * Reads from one or more Soroban contracts by simulating their calls — no
9
14
  * transaction is submitted, so no signature or fees are required.
10
15
  *
11
- * Each call names a contract `address`, a function `fn`, and its `args` as
12
- * `xdr.ScVal`s — build those with the exported `ToScVal` helpers. Results come
13
- * back already decoded in `data.values`, with the raw simulation in `data.raws`.
14
- * For state-changing calls use `useWriteContract` instead.
16
+ * Each call names a contract `address`, a function `fn`, and a positional
17
+ * `args` array. Native values are encoded from the deployed contract ABI, and
18
+ * pre-built `xdr.ScVal`s remain supported. Results come back already decoded
19
+ * in `data.values`, with the raw simulation in `data.raws`. For state-changing
20
+ * calls use `useWriteContract` instead.
15
21
  *
16
22
  * @param calls - The contract calls to simulate, each `{ address, fn, args }`.
17
23
  * @param options - Optional `network` (defaults to the active network).
@@ -22,11 +28,15 @@ type O = ReadContractsOptions;
22
28
  *
23
29
  * @example
24
30
  * ```tsx
25
- * const { data } = useReadContracts([
26
- * { address: 'C…', fn: 'balance', args: [ToScVal.address('GA…')] },
31
+ * const { data } = useReadContracts<[string, boolean]>([
32
+ * { address: 'token.xlm', fn: 'balance', args: ['alice.xlm'] },
33
+ * { address: 'token.xlm', fn: 'authorized', args: ['alice.xlm'] },
27
34
  * ]);
28
- * const balance = data?.values[0];
35
+ * const balance = data?.values[0]; // string
29
36
  * ```
30
37
  */
31
- export declare function useReadContracts(calls: IContractCall[], options?: O, queryOptions?: QueryOptions<R>): UseQueryResult<R, Error>;
38
+ export declare function useReadContracts<TValues extends readonly unknown[] = readonly unknown[]>(calls: readonly IContractCall[], options?: {
39
+ /** Network passphrase to simulate against. Defaults to the active network. */
40
+ network?: string;
41
+ }, queryOptions?: QueryOptions<ReadContractsHookResult<TValues>>): UseQueryResult<ReadContractsHookResult<TValues>, Error>;
32
42
  export {};
@@ -0,0 +1,22 @@
1
+ import { type XlmNameLookupOptions, type XlmNameRecord } from '@bluxcc/core';
2
+ import { type UseQueryResult } from '@tanstack/react-query';
3
+ import type { QueryOptions } from '../utils';
4
+ /**
5
+ * Resolves a `.xlm` name to a validated account or contract record.
6
+ *
7
+ * The query is independent of Blux's active transaction network because XLM
8
+ * Domains uses its mainnet registry. It stays disabled until `name` is non-empty.
9
+ *
10
+ * @param name - A `.xlm` name such as `alice.xlm` or `token.xlm`.
11
+ * @param options - Optional SEP-2 connection options.
12
+ * @param queryOptions - Optional TanStack Query options. `queryKey` and
13
+ * `queryFn` are managed by the hook.
14
+ * @returns A TanStack Query result containing an {@link XlmNameRecord}.
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * const { data, isLoading, error } = useResolveXlmName('alice.xlm');
19
+ * console.log(data?.address);
20
+ * ```
21
+ */
22
+ export declare function useResolveXlmName(name: string, options?: XlmNameLookupOptions, queryOptions?: QueryOptions<XlmNameRecord>): UseQueryResult<XlmNameRecord, Error>;
@@ -0,0 +1,23 @@
1
+ import { type XlmAccountNameRecord, type XlmNameLookupOptions } from '@bluxcc/core';
2
+ import { type UseQueryResult } from '@tanstack/react-query';
3
+ import type { QueryOptions } from '../utils';
4
+ /**
5
+ * Finds one verified `.xlm` name associated with a classic Stellar account.
6
+ *
7
+ * The query accepts only a `G…` account address and stays disabled until the
8
+ * address is non-empty. If the account owns multiple names, XLM Domains chooses
9
+ * which reverse record to return.
10
+ *
11
+ * @param address - A classic Stellar account address (`G…`).
12
+ * @param options - Optional SEP-2 connection options.
13
+ * @param queryOptions - Optional TanStack Query options. `queryKey` and
14
+ * `queryFn` are managed by the hook.
15
+ * @returns A TanStack Query result containing an {@link XlmAccountNameRecord}.
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * const { data, isLoading, error } = useResolveXlmNameByAddress('G…');
20
+ * console.log(data?.name);
21
+ * ```
22
+ */
23
+ export declare function useResolveXlmNameByAddress(address: string, options?: XlmNameLookupOptions, queryOptions?: QueryOptions<XlmAccountNameRecord>): UseQueryResult<XlmAccountNameRecord, Error>;
@@ -1,4 +1,4 @@
1
- import type { AssetArg } from '@bluxcc/core/dist/exports/core/helpers';
1
+ import type { AssetArg } from '@bluxcc/core';
2
2
  /**
3
3
  * Result of {@link useSacAddress}. Because the underlying derivation is
4
4
  * synchronous and local, there is no loading state — `data` is populated
@@ -19,7 +19,7 @@ export type UseSacAddressResult = {
19
19
  * actually deployed), so this hook is synchronous: it returns the value right
20
20
  * away rather than a TanStack query result. Feed the result into
21
21
  * {@link useTokenMetadata}, `transfer`'s `token` option, or
22
- * `useReadContracts` / `useWriteContract`.
22
+ * `useReadContract` / `useReadContracts` / `useWriteContract`.
23
23
  *
24
24
  * Errors are captured rather than thrown during render: an invalid asset or a
25
25
  * missing network passphrase surfaces as `{ data: undefined, error }`.
@@ -1,5 +1,5 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
- import type { GetPaymentPathResult } from "@bluxcc/core/dist/exports/core/getStrictReceivePaths";
2
+ import type { GetPaymentPathResult } from '@bluxcc/core';
3
3
  import { Asset } from '@stellar/stellar-sdk';
4
4
  import { CallBuilderOptions } from '../utils';
5
5
  import type { QueryOptions } from '../utils';
@@ -15,8 +15,8 @@ type O = CallBuilderOptions;
15
15
  * `useStrictSendPaths`.
16
16
  *
17
17
  * @param args - `[source, destinationAsset, destinationAmount]`: the source
18
- * (a sending `G…` address, or an array of candidate source `Asset`s), the
19
- * asset the destination receives, and the exact amount they receive.
18
+ * (an account address/SEP-2/`.xlm` name, or an array of candidate source
19
+ * `Asset`s), the asset the destination receives, and the exact amount.
20
20
  * @param options - Optional `cursor` / `limit` / `order` and `network`
21
21
  * (defaults to active).
22
22
  * @param queryOptions - Optional TanStack Query options. `queryKey`/`queryFn`
@@ -33,5 +33,10 @@ export declare function useStrictReceivePaths(args: [
33
33
  source: string | Asset[],
34
34
  destinationAsset: Asset,
35
35
  destinationAmount: string
36
- ], options?: O, queryOptions?: QueryOptions<R>): UseQueryResult<R, Error>;
36
+ ], options?: {
37
+ cursor?: string;
38
+ limit?: number;
39
+ network?: string;
40
+ order?: 'asc' | 'desc';
41
+ }, queryOptions?: QueryOptions<R>): UseQueryResult<R, Error>;
37
42
  export {};
@@ -1,5 +1,5 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
- import type { GetPaymentPathResult } from "@bluxcc/core/dist/exports/core/getStrictSendPaths";
2
+ import type { GetPaymentPathResult } from '@bluxcc/core';
3
3
  import { Asset } from '@stellar/stellar-sdk';
4
4
  import { CallBuilderOptions } from '../utils';
5
5
  import type { QueryOptions } from '../utils';
@@ -13,8 +13,8 @@ type O = CallBuilderOptions;
13
13
  * inverse — fixing the received amount — use `useStrictReceivePaths`.
14
14
  *
15
15
  * @param args - `[sourceAsset, sourceAmount, destination]`: the asset the sender
16
- * spends, the exact amount they spend, and the destination (a `G…` address, or
17
- * an array of candidate destination `Asset`s).
16
+ * spends, the exact amount they spend, and the destination (an account
17
+ * address/SEP-2/`.xlm` name, or candidate destination `Asset`s).
18
18
  * @param options - Optional `cursor` / `limit` / `order` and `network`
19
19
  * (defaults to active).
20
20
  * @param queryOptions - Optional TanStack Query options. `queryKey`/`queryFn`
@@ -24,12 +24,17 @@ type O = CallBuilderOptions;
24
24
  *
25
25
  * @example
26
26
  * ```tsx
27
- * const { data } = useStrictSendPaths([Asset.native(), '50', 'GA…']);
27
+ * const { data } = useStrictSendPaths([Asset.native(), '50', 'alice.xlm']);
28
28
  * ```
29
29
  */
30
30
  export declare function useStrictSendPaths(args: [
31
31
  sourceAsset: Asset,
32
32
  sourceAmount: string,
33
33
  destination: string | Asset[]
34
- ], options?: O, queryOptions?: QueryOptions<R>): UseQueryResult<R, Error>;
34
+ ], options?: {
35
+ cursor?: string;
36
+ limit?: number;
37
+ network?: string;
38
+ order?: 'asc' | 'desc';
39
+ }, queryOptions?: QueryOptions<R>): UseQueryResult<R, Error>;
35
40
  export {};
@@ -1,6 +1,7 @@
1
+ import type { AssetArg, Numberish, SwapType } from '@bluxcc/core';
1
2
  import { swap } from '@bluxcc/core';
2
3
  import { UseMutationResult } from '@tanstack/react-query';
3
- import type { SwapOptions } from '@bluxcc/core/dist/exports/core/swap';
4
+ import type { SwapOptions } from '@bluxcc/core';
4
5
  import type { MutationOptions } from '../utils';
5
6
  type R = Awaited<ReturnType<typeof swap>>;
6
7
  /**
@@ -8,7 +9,35 @@ type R = Awaited<ReturnType<typeof swap>>;
8
9
  * knob it supports (`type` exactIn/exactOut, `slippage`, `to`, `memo`,
9
10
  * `network`) is just a field on the object passed to `swap({ ... })`.
10
11
  */
11
- export type SwapVariables = SwapOptions;
12
+ export type SwapVariables = {
13
+ /** Asset being sold. Accepts `'xlm'` / `'native'`, a `CODE:ISSUER` string, or an `Asset`. */
14
+ fromAsset: AssetArg;
15
+ /** Asset being bought. Accepts `'xlm'` / `'native'`, a `CODE:ISSUER` string, or an `Asset`. */
16
+ toAsset: AssetArg;
17
+ /**
18
+ * The fixed amount. For `'exactIn'` this is how much `fromAsset` to send; for
19
+ * `'exactOut'` it is how much `toAsset` to receive. Numbers and bigints are
20
+ * coerced to a string.
21
+ */
22
+ amount: Numberish;
23
+ /** Which side is fixed. Defaults to `'exactIn'`. */
24
+ type?: SwapType;
25
+ /**
26
+ * Where the bought asset is delivered: a Stellar address (`G...`/`M...`), a
27
+ * SEP-2 federated address, or `.xlm` name. Defaults to the logged-in account.
28
+ */
29
+ to?: string;
30
+ /**
31
+ * Maximum acceptable slippage as a fraction, where `0.005` = 0.5%. Sets the
32
+ * `destMin` (exactIn) / `sendMax` (exactOut) guardrail off the quoted price.
33
+ * Defaults to `0.005`.
34
+ */
35
+ slippage?: number;
36
+ /** Optional text memo to attach to the transaction. */
37
+ memo?: string;
38
+ /** Network passphrase to swap on. Defaults to the active network. */
39
+ network?: string;
40
+ };
12
41
  type V = SwapVariables;
13
42
  /**
14
43
  * Return type of {@link useSwap}: the full TanStack mutation result plus
@@ -57,7 +86,7 @@ export type UseSwapResult = UseMutationResult<R, Error, V> & {
57
86
  * fromAsset: 'USDC:GA…',
58
87
  * toAsset: 'xlm',
59
88
  * amount: '25',
60
- * to: 'GB…',
89
+ * to: 'alice.xlm',
61
90
  * slippage: 0.01, // 1%
62
91
  * memo: 'cash out',
63
92
  * });
@@ -1,5 +1,5 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
- import type { TokenMetadata, GetTokenMetadataOptions } from '@bluxcc/core/dist/exports/core/getTokenMetadata';
2
+ import type { TokenMetadata, GetTokenMetadataOptions } from '@bluxcc/core';
3
3
  import type { QueryOptions } from '../utils';
4
4
  type R = TokenMetadata;
5
5
  type O = GetTokenMetadataOptions;
@@ -14,8 +14,8 @@ type O = GetTokenMetadataOptions;
14
14
  * Contracts, which expose `admin()` instead). The query stays disabled until a
15
15
  * non-empty `address` is provided.
16
16
  *
17
- * @param address - The token contract id (`C…`), e.g. a SAC from
18
- * {@link useSacAddress} / `getSacAddress`.
17
+ * @param address - A token contract id (`C…`) or `.xlm`/SEP-2 name resolving
18
+ * to one, e.g. a SAC from {@link useSacAddress} / `getSacAddress`.
19
19
  * @param options - Core read options (currently just `network`, which defaults
20
20
  * to the active network).
21
21
  * @param queryOptions - Optional TanStack Query options (`enabled`, `staleTime`,
@@ -36,5 +36,8 @@ type O = GetTokenMetadataOptions;
36
36
  * });
37
37
  * ```
38
38
  */
39
- export declare function useTokenMetadata(address: string, options?: O, queryOptions?: QueryOptions<R>): UseQueryResult<R, Error>;
39
+ export declare function useTokenMetadata(address: string, options?: {
40
+ /** Network passphrase to read from. Defaults to the active network. */
41
+ network?: string;
42
+ }, queryOptions?: QueryOptions<R>): UseQueryResult<R, Error>;
40
43
  export {};