@bluxcc/react 0.3.7 → 0.3.9

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 (41) hide show
  1. package/dist/Provider.d.ts +90 -2
  2. package/dist/hooks/index.d.ts +13 -12
  3. package/dist/hooks/useJwt.d.ts +20 -0
  4. package/dist/hooks/useLoginAction.d.ts +5 -1
  5. package/dist/hooks/useLoginCode.d.ts +21 -3
  6. package/dist/hooks/useLoginEmail.d.ts +32 -4
  7. package/dist/hooks/useLoginOAuth.d.ts +19 -4
  8. package/dist/hooks/useLoginPasskey.d.ts +19 -4
  9. package/dist/hooks/useLoginSms.d.ts +32 -4
  10. package/dist/hooks/useLoginWallet.d.ts +19 -4
  11. package/dist/index.cjs.js +1 -1
  12. package/dist/index.d.ts +5 -5
  13. package/dist/index.esm.js +1 -1
  14. package/dist/useStellar/index.d.ts +28 -27
  15. package/dist/useStellar/useAccount.d.ts +11 -3
  16. package/dist/useStellar/useAccounts.d.ts +2 -2
  17. package/dist/useStellar/useAssets.d.ts +16 -3
  18. package/dist/useStellar/useBalances.d.ts +13 -3
  19. package/dist/useStellar/useClaimableBalances.d.ts +18 -3
  20. package/dist/useStellar/useEffects.d.ts +22 -3
  21. package/dist/useStellar/useLedgers.d.ts +14 -3
  22. package/dist/useStellar/useLiquidityPools.d.ts +16 -3
  23. package/dist/useStellar/useOffers.d.ts +22 -3
  24. package/dist/useStellar/useOperations.d.ts +24 -3
  25. package/dist/useStellar/useOrderbook.d.ts +9 -4
  26. package/dist/useStellar/usePayments.d.ts +20 -3
  27. package/dist/useStellar/useReadContract.d.ts +54 -0
  28. package/dist/useStellar/useReadContracts.d.ts +6 -3
  29. package/dist/useStellar/useResolveXlmName.d.ts +1 -1
  30. package/dist/useStellar/useResolveXlmNameByAddress.d.ts +1 -1
  31. package/dist/useStellar/useSacAddress.d.ts +2 -2
  32. package/dist/useStellar/useStrictReceivePaths.d.ts +9 -4
  33. package/dist/useStellar/useStrictSendPaths.d.ts +9 -4
  34. package/dist/useStellar/useSwap.d.ts +31 -3
  35. package/dist/useStellar/useTokenMetadata.d.ts +6 -3
  36. package/dist/useStellar/useTradeAggregation.d.ts +9 -4
  37. package/dist/useStellar/useTrades.d.ts +22 -3
  38. package/dist/useStellar/useTransactions.d.ts +22 -3
  39. package/dist/useStellar/useTransfer.d.ts +37 -3
  40. package/dist/useStellar/useWriteContract.d.ts +3 -3
  41. package/package.json +7 -5
@@ -1,8 +1,8 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
- import type { GetTradeAggregationResult } from "@bluxcc/core/dist/exports/core/getTradeAggregation";
2
+ import type { GetTradeAggregationResult } from "@bluxcc/core";
3
3
  import { Asset } from '@stellar/stellar-sdk';
4
- import { CallBuilderOptions } from '../utils';
5
- import type { QueryOptions } from '../utils';
4
+ import { CallBuilderOptions } from "../utils.js";
5
+ import type { QueryOptions } from "../utils.js";
6
6
  type R = GetTradeAggregationResult;
7
7
  type O = CallBuilderOptions;
8
8
  /**
@@ -37,5 +37,10 @@ export declare function useTradeAggregation(args: [
37
37
  end_time: number,
38
38
  resolution: number,
39
39
  offset: number
40
- ], options?: O, queryOptions?: QueryOptions<R>): UseQueryResult<R, Error>;
40
+ ], options?: {
41
+ cursor?: string;
42
+ limit?: number;
43
+ network?: string;
44
+ order?: "asc" | "desc";
45
+ }, queryOptions?: QueryOptions<R>): UseQueryResult<R, Error>;
41
46
  export {};
@@ -1,6 +1,6 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
- import type { GetTradesResult, GetTradesOptions } from "@bluxcc/core/dist/exports/core/getTrades";
3
- import type { QueryOptions } from "../utils";
2
+ import type { GetTradesResult, GetTradesOptions } from "@bluxcc/core";
3
+ import type { QueryOptions } from "../utils.js";
4
4
  type R = GetTradesResult;
5
5
  type O = GetTradesOptions;
6
6
  /**
@@ -23,5 +23,24 @@ type O = GetTradesOptions;
23
23
  * });
24
24
  * ```
25
25
  */
26
- export declare function useTrades(options?: O, queryOptions?: QueryOptions<R>): UseQueryResult<R, Error>;
26
+ export declare function useTrades(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 trades for this `[base, counter]` asset pair. Each accepts `'xlm'`, `'CODE:ISSUER'`, or an `Asset`. */
36
+ forAssetPair?: [base: import("@bluxcc/core").AssetArg, counter: import("@bluxcc/core").AssetArg];
37
+ /** Only trades against this offer id. */
38
+ forOffer?: string;
39
+ /** Only trades of this type (e.g. `orderbook`, `liquidity_pool`). */
40
+ forType?: import("@stellar/stellar-sdk").Horizon.ServerApi.TradeType;
41
+ /** Only trades involving this account (address, SEP-2 address, or `.xlm` name). */
42
+ forAccount?: string;
43
+ /** Only trades for this liquidity pool id. */
44
+ forLiquidityPool?: string;
45
+ }, queryOptions?: QueryOptions<R>): UseQueryResult<R, Error>;
27
46
  export {};
@@ -1,6 +1,6 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
- import type { GetTransactionsResult, GetTransactionsOptions } from "@bluxcc/core/dist/exports/core/getTransactions";
3
- import type { QueryOptions } from "../utils";
2
+ import type { GetTransactionsResult, GetTransactionsOptions } from "@bluxcc/core";
3
+ import type { QueryOptions } from "../utils.js";
4
4
  type R = GetTransactionsResult;
5
5
  type O = GetTransactionsOptions;
6
6
  /**
@@ -21,5 +21,24 @@ type O = GetTransactionsOptions;
21
21
  * const { data } = useTransactions({ forAccount: 'GA…', limit: 25 });
22
22
  * ```
23
23
  */
24
- export declare function useTransactions(options?: O, queryOptions?: QueryOptions<R>): UseQueryResult<R, Error>;
24
+ export declare function useTransactions(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
+ /** Only transactions touching this account (address, SEP-2 address, or `.xlm` name). */
34
+ forAccount?: string;
35
+ /** Only transactions affecting this claimable balance id. */
36
+ forClaimableBalance?: string;
37
+ /** Only transactions in this ledger, by sequence number. */
38
+ forLedger?: string | number;
39
+ /** Only transactions affecting this liquidity pool id. */
40
+ forLiquidityPool?: string;
41
+ /** Include failed transactions. Defaults to `false`. */
42
+ includeFailed?: boolean;
43
+ }, queryOptions?: QueryOptions<R>): UseQueryResult<R, Error>;
25
44
  export {};
@@ -1,7 +1,7 @@
1
1
  import { transfer } from '@bluxcc/core';
2
2
  import { UseMutationResult } from '@tanstack/react-query';
3
- import type { TransferOptions } from '@bluxcc/core/dist/exports/core/transfer';
4
- import type { MutationOptions } from '../utils';
3
+ import type { TransferOptions } from '@bluxcc/core';
4
+ import type { MutationOptions } from "../utils.js";
5
5
  type R = Awaited<ReturnType<typeof transfer>>;
6
6
  /**
7
7
  * Variables for {@link useTransfer} — the core `transfer` options verbatim, so
@@ -9,7 +9,41 @@ type R = Awaited<ReturnType<typeof transfer>>;
9
9
  * token, federated address, `.xlm` name) is just a different object passed to
10
10
  * `transfer({ ... })`.
11
11
  */
12
- export type TransferVariables = TransferOptions;
12
+ export type TransferVariables = {
13
+ /**
14
+ * Recipient: a Stellar address (`G...` or muxed `M...`), a SEP-2 federated
15
+ * address (`alice*example.com`), or a `.xlm` name. For a `token` transfer a
16
+ * contract id (`C...`) or a name resolving to one is also accepted.
17
+ */
18
+ to: string;
19
+ /**
20
+ * Amount to send. Numbers and bigints are coerced to a string. For classic
21
+ * assets this is a decimal amount (`"10.5"`); for a `token` it is the integer
22
+ * base-unit amount the contract expects.
23
+ */
24
+ amount: import("@bluxcc/core").Numberish;
25
+ /**
26
+ * Asset to send. Accepts `'xlm'` / `'native'`, a `CODE:ISSUER` string, or an
27
+ * `Asset`. Defaults to the native lumen. Ignored when `token` is set.
28
+ */
29
+ asset?: import("@bluxcc/core").AssetArg;
30
+ /** Optional text memo. Ignored for `token` (Soroban) transfers. */
31
+ memo?: string;
32
+ /**
33
+ * When the recipient cannot receive the asset directly (its account does not
34
+ * exist, or it has no trustline for an issued asset), send a claimable balance
35
+ * it can claim later instead of failing. Defaults to `false`.
36
+ */
37
+ claimable?: boolean;
38
+ /**
39
+ * A SEP-41 token contract id (`C...`) or name resolving to one. When set,
40
+ * value moves through the contract's `transfer(from, to, amount)` entrypoint
41
+ * instead of a classic op.
42
+ */
43
+ token?: string;
44
+ /** Network passphrase to send on. Defaults to the active network. */
45
+ network?: string;
46
+ };
13
47
  type V = TransferVariables;
14
48
  /**
15
49
  * Return type of {@link useTransfer}: the full TanStack mutation result plus
@@ -1,7 +1,7 @@
1
1
  import { writeContract } from '@bluxcc/core';
2
2
  import { UseMutationResult } from '@tanstack/react-query';
3
- import type { IContractCall, WriteContractsOptions } from '@bluxcc/core/dist/exports/utils';
4
- import type { MutationOptions } from '../utils';
3
+ import type { IContractCall, WriteContractsOptions } from '@bluxcc/core';
4
+ import type { MutationOptions } from "../utils.js";
5
5
  type CoreWriteContractResult = Awaited<ReturnType<typeof writeContract>>;
6
6
  /** Submitted transaction with a caller-specified decoded contract result. */
7
7
  export type WriteContractHookResult<TReturnValue = unknown> = Omit<CoreWriteContractResult, 'returnValue'> & {
@@ -23,7 +23,7 @@ type V = WriteContractVariables;
23
23
  *
24
24
  * A thin wrapper over TanStack Query's `useMutation`: call `mutate` /
25
25
  * `mutateAsync` with the contract call to sign and send it. For read-only calls
26
- * (no signature, no fees) use `useReadContracts` instead.
26
+ * (no signature, no fees) use `useReadContract` or `useReadContracts` instead.
27
27
  *
28
28
  * @param mutationOptions - Optional TanStack Mutation options (`onSuccess`,
29
29
  * `onError`, `onSettled`, …); `mutationFn` is provided by the hook.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bluxcc/react",
3
3
  "author": "Blux team",
4
- "version": "0.3.7",
4
+ "version": "0.3.9",
5
5
  "homepage": "https://blux.cc",
6
6
  "description": "Connecting to the Stellar Ecosystem and Beyond",
7
7
  "repository": {
@@ -14,9 +14,9 @@
14
14
  "types": "dist/index.d.ts",
15
15
  "exports": {
16
16
  ".": {
17
+ "types": "./dist/index.d.ts",
17
18
  "import": "./dist/index.esm.js",
18
- "require": "./dist/index.cjs.js",
19
- "types": "./dist/index.d.ts"
19
+ "require": "./dist/index.cjs.js"
20
20
  }
21
21
  },
22
22
  "engines": {
@@ -27,10 +27,12 @@
27
27
  ],
28
28
  "scripts": {
29
29
  "dev": "rollup -c rollup.config.dev.js --watch",
30
- "build": "rollup -c rollup.config.prod.js"
30
+ "build": "rollup -c rollup.config.prod.js",
31
+ "test:types": "node --test tests/public-declaration-types.test.mjs tests/packed-types.test.mjs",
32
+ "prepack": "npm run build && npm run test:types"
31
33
  },
32
34
  "peerDependencies": {
33
- "@bluxcc/core": "^0.3.7",
35
+ "@bluxcc/core": "^0.3.9",
34
36
  "@stellar/stellar-sdk": "^17.0.1",
35
37
  "@tanstack/react-query": "^5.90.11",
36
38
  "react": ">=17.0.0",