@bluxcc/react 0.3.7 → 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.
- package/dist/Provider.d.ts +91 -2
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useBlux.d.ts +3 -1
- package/dist/hooks/useJwt.d.ts +19 -0
- package/dist/hooks/useLoginAction.d.ts +5 -1
- package/dist/hooks/useLoginCode.d.ts +21 -2
- package/dist/hooks/useLoginEmail.d.ts +33 -3
- package/dist/hooks/useLoginOAuth.d.ts +31 -3
- package/dist/hooks/useLoginPasskey.d.ts +19 -3
- package/dist/hooks/useLoginSms.d.ts +33 -3
- package/dist/hooks/useLoginWallet.d.ts +19 -3
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js +1 -1
- package/dist/useStellar/index.d.ts +1 -0
- package/dist/useStellar/useAccount.d.ts +10 -2
- package/dist/useStellar/useAccounts.d.ts +1 -1
- package/dist/useStellar/useAssets.d.ts +15 -2
- package/dist/useStellar/useBalances.d.ts +12 -2
- package/dist/useStellar/useClaimableBalances.d.ts +18 -2
- package/dist/useStellar/useEffects.d.ts +21 -2
- package/dist/useStellar/useLedgers.d.ts +13 -2
- package/dist/useStellar/useLiquidityPools.d.ts +16 -2
- package/dist/useStellar/useOffers.d.ts +22 -2
- package/dist/useStellar/useOperations.d.ts +23 -2
- package/dist/useStellar/useOrderbook.d.ts +7 -2
- package/dist/useStellar/usePayments.d.ts +19 -2
- package/dist/useStellar/useReadContract.d.ts +54 -0
- package/dist/useStellar/useReadContracts.d.ts +5 -2
- package/dist/useStellar/useSacAddress.d.ts +2 -2
- package/dist/useStellar/useStrictReceivePaths.d.ts +7 -2
- package/dist/useStellar/useStrictSendPaths.d.ts +7 -2
- package/dist/useStellar/useSwap.d.ts +31 -2
- package/dist/useStellar/useTokenMetadata.d.ts +5 -2
- package/dist/useStellar/useTradeAggregation.d.ts +7 -2
- package/dist/useStellar/useTrades.d.ts +22 -2
- package/dist/useStellar/useTransactions.d.ts +21 -2
- package/dist/useStellar/useTransfer.d.ts +37 -2
- package/dist/useStellar/useWriteContract.d.ts +2 -2
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
2
|
-
import type { GetAssetsResult, GetAssetsOptions } from '@bluxcc/core
|
|
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;
|
|
@@ -22,5 +22,18 @@ type O = GetAssetsOptions;
|
|
|
22
22
|
* const { data } = useAssets({ forCode: 'USDC' });
|
|
23
23
|
* ```
|
|
24
24
|
*/
|
|
25
|
-
export declare function useAssets(options?:
|
|
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>;
|
|
26
39
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
2
|
-
import type { GetBalancesResult, GetBalancesOptions } from "@bluxcc/core
|
|
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?:
|
|
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
|
|
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:
|
|
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
|
|
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?:
|
|
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
|
|
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?:
|
|
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
|
|
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?:
|
|
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
|
|
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?:
|
|
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
|
|
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?:
|
|
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
|
|
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?:
|
|
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
|
|
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?:
|
|
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,6 +1,6 @@
|
|
|
1
1
|
import { readContracts } from '@bluxcc/core';
|
|
2
2
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
3
|
-
import type { IContractCall, ReadContractsOptions } from '@bluxcc/core
|
|
3
|
+
import type { IContractCall, ReadContractsOptions } from '@bluxcc/core';
|
|
4
4
|
import type { QueryOptions } from '../utils';
|
|
5
5
|
type CoreReadContractsResult = Exclude<Awaited<ReturnType<typeof readContracts>>, readonly unknown[]>;
|
|
6
6
|
/** Typed result returned by {@link useReadContracts}. */
|
|
@@ -35,5 +35,8 @@ type O = ReadContractsOptions;
|
|
|
35
35
|
* const balance = data?.values[0]; // string
|
|
36
36
|
* ```
|
|
37
37
|
*/
|
|
38
|
-
export declare function useReadContracts<TValues extends readonly unknown[] = readonly unknown[]>(calls: readonly IContractCall[], options?:
|
|
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>;
|
|
39
42
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AssetArg } from '@bluxcc/core
|
|
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
|
|
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';
|
|
@@ -33,5 +33,10 @@ export declare function useStrictReceivePaths(args: [
|
|
|
33
33
|
source: string | Asset[],
|
|
34
34
|
destinationAsset: Asset,
|
|
35
35
|
destinationAmount: string
|
|
36
|
-
], options?:
|
|
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
|
|
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';
|
|
@@ -31,5 +31,10 @@ export declare function useStrictSendPaths(args: [
|
|
|
31
31
|
sourceAsset: Asset,
|
|
32
32
|
sourceAmount: string,
|
|
33
33
|
destination: string | Asset[]
|
|
34
|
-
], options?:
|
|
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
|
|
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 =
|
|
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
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
2
|
-
import type { TokenMetadata, GetTokenMetadataOptions } from '@bluxcc/core
|
|
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;
|
|
@@ -36,5 +36,8 @@ type O = GetTokenMetadataOptions;
|
|
|
36
36
|
* });
|
|
37
37
|
* ```
|
|
38
38
|
*/
|
|
39
|
-
export declare function useTokenMetadata(address: string, options?:
|
|
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 {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
2
|
-
import type { GetTradeAggregationResult } from "@bluxcc/core
|
|
2
|
+
import type { GetTradeAggregationResult } from "@bluxcc/core";
|
|
3
3
|
import { Asset } from '@stellar/stellar-sdk';
|
|
4
4
|
import { CallBuilderOptions } from '../utils';
|
|
5
5
|
import type { QueryOptions } from '../utils';
|
|
@@ -37,5 +37,10 @@ export declare function useTradeAggregation(args: [
|
|
|
37
37
|
end_time: number,
|
|
38
38
|
resolution: number,
|
|
39
39
|
offset: number
|
|
40
|
-
], options?:
|
|
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,5 +1,6 @@
|
|
|
1
|
+
import type { AssetArg } from '@bluxcc/core';
|
|
1
2
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
2
|
-
import type { GetTradesResult, GetTradesOptions } from "@bluxcc/core
|
|
3
|
+
import type { GetTradesResult, GetTradesOptions } from "@bluxcc/core";
|
|
3
4
|
import type { QueryOptions } from "../utils";
|
|
4
5
|
type R = GetTradesResult;
|
|
5
6
|
type O = GetTradesOptions;
|
|
@@ -23,5 +24,24 @@ type O = GetTradesOptions;
|
|
|
23
24
|
* });
|
|
24
25
|
* ```
|
|
25
26
|
*/
|
|
26
|
-
export declare function useTrades(options?:
|
|
27
|
+
export declare function useTrades(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 trades for this `[base, counter]` asset pair. Each accepts `'xlm'`, `'CODE:ISSUER'`, or an `Asset`. */
|
|
37
|
+
forAssetPair?: [base: AssetArg, counter: AssetArg];
|
|
38
|
+
/** Only trades against this offer id. */
|
|
39
|
+
forOffer?: string;
|
|
40
|
+
/** Only trades of this type (e.g. `orderbook`, `liquidity_pool`). */
|
|
41
|
+
forType?: Horizon.ServerApi.TradeType;
|
|
42
|
+
/** Only trades involving this account (address, SEP-2 address, or `.xlm` name). */
|
|
43
|
+
forAccount?: string;
|
|
44
|
+
/** Only trades for this liquidity pool id. */
|
|
45
|
+
forLiquidityPool?: string;
|
|
46
|
+
}, queryOptions?: QueryOptions<R>): UseQueryResult<R, Error>;
|
|
27
47
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
2
|
-
import type { GetTransactionsResult, GetTransactionsOptions } from "@bluxcc/core
|
|
2
|
+
import type { GetTransactionsResult, GetTransactionsOptions } from "@bluxcc/core";
|
|
3
3
|
import type { QueryOptions } from "../utils";
|
|
4
4
|
type R = GetTransactionsResult;
|
|
5
5
|
type O = GetTransactionsOptions;
|
|
@@ -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?:
|
|
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,6 +1,7 @@
|
|
|
1
|
+
import type { AssetArg, Numberish } from '@bluxcc/core';
|
|
1
2
|
import { transfer } from '@bluxcc/core';
|
|
2
3
|
import { UseMutationResult } from '@tanstack/react-query';
|
|
3
|
-
import type { TransferOptions } from '@bluxcc/core
|
|
4
|
+
import type { TransferOptions } from '@bluxcc/core';
|
|
4
5
|
import type { MutationOptions } from '../utils';
|
|
5
6
|
type R = Awaited<ReturnType<typeof transfer>>;
|
|
6
7
|
/**
|
|
@@ -9,7 +10,41 @@ type R = Awaited<ReturnType<typeof transfer>>;
|
|
|
9
10
|
* token, federated address, `.xlm` name) is just a different object passed to
|
|
10
11
|
* `transfer({ ... })`.
|
|
11
12
|
*/
|
|
12
|
-
export type TransferVariables =
|
|
13
|
+
export type TransferVariables = {
|
|
14
|
+
/**
|
|
15
|
+
* Recipient: a Stellar address (`G...` or muxed `M...`), a SEP-2 federated
|
|
16
|
+
* address (`alice*example.com`), or a `.xlm` name. For a `token` transfer a
|
|
17
|
+
* contract id (`C...`) or a name resolving to one is also accepted.
|
|
18
|
+
*/
|
|
19
|
+
to: string;
|
|
20
|
+
/**
|
|
21
|
+
* Amount to send. Numbers and bigints are coerced to a string. For classic
|
|
22
|
+
* assets this is a decimal amount (`"10.5"`); for a `token` it is the integer
|
|
23
|
+
* base-unit amount the contract expects.
|
|
24
|
+
*/
|
|
25
|
+
amount: Numberish;
|
|
26
|
+
/**
|
|
27
|
+
* Asset to send. Accepts `'xlm'` / `'native'`, a `CODE:ISSUER` string, or an
|
|
28
|
+
* `Asset`. Defaults to the native lumen. Ignored when `token` is set.
|
|
29
|
+
*/
|
|
30
|
+
asset?: AssetArg;
|
|
31
|
+
/** Optional text memo. Ignored for `token` (Soroban) transfers. */
|
|
32
|
+
memo?: string;
|
|
33
|
+
/**
|
|
34
|
+
* When the recipient cannot receive the asset directly (its account does not
|
|
35
|
+
* exist, or it has no trustline for an issued asset), send a claimable balance
|
|
36
|
+
* it can claim later instead of failing. Defaults to `false`.
|
|
37
|
+
*/
|
|
38
|
+
claimable?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* A SEP-41 token contract id (`C...`) or name resolving to one. When set,
|
|
41
|
+
* value moves through the contract's `transfer(from, to, amount)` entrypoint
|
|
42
|
+
* instead of a classic op.
|
|
43
|
+
*/
|
|
44
|
+
token?: string;
|
|
45
|
+
/** Network passphrase to send on. Defaults to the active network. */
|
|
46
|
+
network?: string;
|
|
47
|
+
};
|
|
13
48
|
type V = TransferVariables;
|
|
14
49
|
/**
|
|
15
50
|
* Return type of {@link useTransfer}: the full TanStack mutation result plus
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { writeContract } from '@bluxcc/core';
|
|
2
2
|
import { UseMutationResult } from '@tanstack/react-query';
|
|
3
|
-
import type { IContractCall, WriteContractsOptions } from '@bluxcc/core
|
|
3
|
+
import type { IContractCall, WriteContractsOptions } from '@bluxcc/core';
|
|
4
4
|
import type { MutationOptions } from '../utils';
|
|
5
5
|
type CoreWriteContractResult = Awaited<ReturnType<typeof writeContract>>;
|
|
6
6
|
/** Submitted transaction with a caller-specified decoded contract result. */
|
|
@@ -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.
|