@bluxcc/core 0.2.6 → 0.2.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/exports/blux.d.ts +51 -0
- package/dist/exports/core/callBuilder.d.ts +25 -16
- package/dist/exports/core/fundAccount.d.ts +34 -0
- package/dist/exports/core/getAccount.d.ts +14 -0
- package/dist/exports/core/getAccounts.d.ts +27 -23
- package/dist/exports/core/getAssets.d.ts +11 -1
- package/dist/exports/core/getBalances.d.ts +15 -0
- package/dist/exports/core/getClaimableBalances.d.ts +16 -3
- package/dist/exports/core/getEffects.d.ts +15 -1
- package/dist/exports/core/getLedgers.d.ts +10 -1
- package/dist/exports/core/getLiquidityPools.d.ts +15 -3
- package/dist/exports/core/getNetwork.d.ts +6 -0
- package/dist/exports/core/getOffers.d.ts +19 -4
- package/dist/exports/core/getOperations.d.ts +16 -1
- package/dist/exports/core/getOrderbook.d.ts +12 -3
- package/dist/exports/core/getPayments.d.ts +14 -2
- package/dist/exports/core/getSacAddress.d.ts +18 -0
- package/dist/exports/core/getStrictReceivePaths.d.ts +15 -3
- package/dist/exports/core/getStrictSendPaths.d.ts +15 -3
- package/dist/exports/core/getTokenMetadata.d.ts +32 -0
- package/dist/exports/core/getTradeAggregation.d.ts +13 -2
- package/dist/exports/core/getTrades.d.ts +18 -3
- package/dist/exports/core/getTransactions.d.ts +15 -1
- package/dist/exports/core/helpers/account.d.ts +20 -0
- package/dist/exports/core/helpers/index.d.ts +9 -0
- package/dist/exports/core/helpers/resolveAddress.d.ts +47 -0
- package/dist/exports/core/helpers/resolveAsset.d.ts +19 -0
- package/dist/exports/core/index.d.ts +7 -0
- package/dist/exports/core/networks.d.ts +10 -0
- package/dist/exports/core/readContracts.d.ts +13 -0
- package/dist/exports/core/swap.d.ts +52 -0
- package/dist/exports/core/switchNetwork.d.ts +7 -0
- package/dist/exports/core/toScVal.d.ts +36 -0
- package/dist/exports/core/transfer.d.ts +49 -0
- package/dist/exports/core/writeContract.d.ts +12 -1
- package/dist/exports/createConfig.d.ts +9 -0
- package/dist/exports/utils.d.ts +42 -0
- package/dist/index.cjs.js +14 -14
- package/dist/index.esm.js +14 -14
- package/dist/stellar/getTransactionDetails.d.ts +1 -1
- package/dist/stellar/handleTransactionSigning.d.ts +1 -1
- package/dist/stellar/submitTransaction.d.ts +2 -4
- package/dist/stellar/swapTransaction.d.ts +2 -2
- package/dist/store.d.ts +2 -0
- package/dist/types.d.ts +71 -4
- package/dist/utils/api.d.ts +0 -1
- package/dist/utils/errors.d.ts +6 -0
- package/dist/utils/helpers.d.ts +3 -3
- package/dist/utils/socialLogin.d.ts +3 -8
- package/package.json +2 -2
package/dist/exports/blux.d.ts
CHANGED
|
@@ -1,18 +1,66 @@
|
|
|
1
1
|
import { IUser } from '../store';
|
|
2
|
+
/**
|
|
3
|
+
* Internal login driver. Prefer the public {@link login}.
|
|
4
|
+
*
|
|
5
|
+
* @param isSilent - When `true`, tries to restore a recent session without opening the modal.
|
|
6
|
+
* @returns A promise that resolves to the authenticated user.
|
|
7
|
+
*/
|
|
2
8
|
export declare const _login: (isSilent: boolean) => Promise<IUser>;
|
|
9
|
+
/**
|
|
10
|
+
* Opens the Blux modal so the user can connect a wallet or sign in, resolving
|
|
11
|
+
* once authenticated. Waits for the SDK to finish initializing first.
|
|
12
|
+
*
|
|
13
|
+
* @returns The authenticated user.
|
|
14
|
+
*/
|
|
3
15
|
export declare const login: () => Promise<IUser>;
|
|
16
|
+
/**
|
|
17
|
+
* Signs a transaction XDR with the connected wallet, without submitting it.
|
|
18
|
+
*
|
|
19
|
+
* @param xdr - The transaction envelope XDR to sign.
|
|
20
|
+
* @param options - Optional network passphrase override.
|
|
21
|
+
* @returns The signed transaction XDR.
|
|
22
|
+
* @throws If the user is not authenticated or the Blux modal is open elsewhere.
|
|
23
|
+
*/
|
|
4
24
|
export declare const signTransaction: (xdr: string, options?: {
|
|
5
25
|
network: string;
|
|
6
26
|
}) => Promise<unknown>;
|
|
27
|
+
/**
|
|
28
|
+
* Signs a transaction XDR with the connected wallet and submits it to the network.
|
|
29
|
+
*
|
|
30
|
+
* @param xdr - The transaction envelope XDR to sign and submit.
|
|
31
|
+
* @param options - Optional network passphrase override.
|
|
32
|
+
* @returns The submitted transaction result (an {@link ISubmittedTransaction}).
|
|
33
|
+
* @throws If the user is not authenticated or the Blux modal is open elsewhere.
|
|
34
|
+
*/
|
|
7
35
|
export declare const sendTransaction: (xdr: string, options?: {
|
|
8
36
|
network: string;
|
|
9
37
|
}) => Promise<unknown>;
|
|
38
|
+
/**
|
|
39
|
+
* Signs an arbitrary message with the connected wallet.
|
|
40
|
+
*
|
|
41
|
+
* @param message - The message to sign.
|
|
42
|
+
* @param options - Optional network passphrase override.
|
|
43
|
+
* @returns The signature.
|
|
44
|
+
* @throws If the user is not authenticated or the Blux modal is open elsewhere.
|
|
45
|
+
*/
|
|
10
46
|
export declare const signMessage: (message: string, options?: {
|
|
11
47
|
network: string;
|
|
12
48
|
}) => Promise<unknown>;
|
|
49
|
+
/**
|
|
50
|
+
* Signs a Soroban authorization entry with the connected wallet.
|
|
51
|
+
*
|
|
52
|
+
* @param authEntry - The base64 authorization entry to sign.
|
|
53
|
+
* @param options - Optional network passphrase override.
|
|
54
|
+
* @returns The signed authorization entry.
|
|
55
|
+
* @throws If the user is not authenticated or the Blux modal is open elsewhere.
|
|
56
|
+
*/
|
|
13
57
|
export declare const signAuthEntry: (authEntry: string, options?: {
|
|
14
58
|
network: string;
|
|
15
59
|
}) => Promise<unknown>;
|
|
60
|
+
/**
|
|
61
|
+
* The Blux client: authentication, wallet signing, and account UI entry points.
|
|
62
|
+
* Each method carries its own documentation; the getters expose live auth state.
|
|
63
|
+
*/
|
|
16
64
|
export declare const blux: {
|
|
17
65
|
login: () => Promise<IUser>;
|
|
18
66
|
logout: () => void;
|
|
@@ -30,7 +78,10 @@ export declare const blux: {
|
|
|
30
78
|
sendTransaction: (xdr: string, options?: {
|
|
31
79
|
network: string;
|
|
32
80
|
}) => Promise<unknown>;
|
|
81
|
+
/** Whether the SDK has finished initializing and is ready to use. */
|
|
33
82
|
readonly isReady: boolean;
|
|
83
|
+
/** Whether a user is currently authenticated. */
|
|
34
84
|
readonly isAuthenticated: boolean;
|
|
85
|
+
/** The currently authenticated user, or `undefined` when logged out. */
|
|
35
86
|
readonly user: IUser | undefined;
|
|
36
87
|
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { Asset } from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
1
|
+
import { Asset } from '@stellar/stellar-sdk';
|
|
2
|
+
import { CallBuilderOptions } from '../utils';
|
|
3
|
+
import { AccountCallBuilder } from '@stellar/stellar-sdk/lib/esm/horizon/account_call_builder';
|
|
4
|
+
import { ClaimableBalanceCallBuilder } from '@stellar/stellar-sdk/lib/esm/horizon/claimable_balances_call_builder';
|
|
5
|
+
import { LedgerCallBuilder } from '@stellar/stellar-sdk/lib/esm/horizon/ledger_call_builder';
|
|
6
|
+
import { TransactionCallBuilder } from '@stellar/stellar-sdk/lib/esm/horizon/transaction_call_builder';
|
|
7
|
+
import { OfferCallBuilder } from '@stellar/stellar-sdk/lib/esm/horizon/offer_call_builder';
|
|
8
|
+
import { TradesCallBuilder } from '@stellar/stellar-sdk/lib/esm/horizon/trades_call_builder';
|
|
9
|
+
import { OperationCallBuilder } from '@stellar/stellar-sdk/lib/esm/horizon/operation_call_builder';
|
|
10
|
+
import { LiquidityPoolCallBuilder } from '@stellar/stellar-sdk/lib/esm/horizon/liquidity_pool_call_builder';
|
|
11
|
+
import { OrderbookCallBuilder } from '@stellar/stellar-sdk/lib/esm/horizon/orderbook_call_builder';
|
|
12
|
+
import { PathCallBuilder } from '@stellar/stellar-sdk/lib/esm/horizon/path_call_builder';
|
|
13
|
+
import { TradeAggregationCallBuilder } from '@stellar/stellar-sdk/lib/esm/horizon/trade_aggregation_call_builder';
|
|
14
|
+
import { AssetsCallBuilder } from '@stellar/stellar-sdk/lib/esm/horizon/assets_call_builder';
|
|
15
|
+
import { EffectCallBuilder } from '@stellar/stellar-sdk/lib/esm/horizon/effect_call_builder';
|
|
16
|
+
import { PaymentCallBuilder } from '@stellar/stellar-sdk/lib/esm/horizon/payment_call_builder';
|
|
17
17
|
type CallBuilderMap = {
|
|
18
18
|
accounts: [[], AccountCallBuilder];
|
|
19
19
|
claimableBalances: [[], ClaimableBalanceCallBuilder];
|
|
@@ -55,5 +55,14 @@ type CallBuilderMap = {
|
|
|
55
55
|
TradeAggregationCallBuilder
|
|
56
56
|
];
|
|
57
57
|
};
|
|
58
|
+
/**
|
|
59
|
+
* Internal helper: creates the Horizon call builder named `callName`, applies the
|
|
60
|
+
* shared cursor/limit/order paging from `params`, and returns it ready to call.
|
|
61
|
+
*
|
|
62
|
+
* @param callName - Which Horizon collection to query.
|
|
63
|
+
* @param args - Positional arguments specific to that collection (already resolved to `Asset`s / account ids).
|
|
64
|
+
* @param params - Pagination and network options.
|
|
65
|
+
* @returns The configured Horizon call builder for `callName`.
|
|
66
|
+
*/
|
|
58
67
|
export declare const callBuilder: <C extends keyof CallBuilderMap>(callName: C, args: CallBuilderMap[C][0], params: CallBuilderOptions) => CallBuilderMap[C][1];
|
|
59
68
|
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** Outcome of a single Friendbot funding attempt. */
|
|
2
|
+
export type FundAccountStatus = 'funded' | 'already_funded' | 'failed';
|
|
3
|
+
/** Options for {@link fundAccount}. */
|
|
4
|
+
export type FundAccountOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* Network(s) to fund on, by passphrase or friendly name (`testnet` /
|
|
7
|
+
* `futurenet`). Defaults to both testnet and futurenet. Friendbot is only
|
|
8
|
+
* available on those networks.
|
|
9
|
+
*/
|
|
10
|
+
network?: string | string[];
|
|
11
|
+
};
|
|
12
|
+
/** Result of funding one network. */
|
|
13
|
+
export type FundAccountResult = {
|
|
14
|
+
/** Friendly network name (e.g. `testnet`), or the passphrase if unnamed. */
|
|
15
|
+
network: string;
|
|
16
|
+
/** Network passphrase that was funded. */
|
|
17
|
+
passphrase: string;
|
|
18
|
+
/** Whether the account was funded, was already funded, or the attempt failed. */
|
|
19
|
+
status: FundAccountStatus;
|
|
20
|
+
/** Hash of the funding transaction, when Friendbot returned one. */
|
|
21
|
+
hash?: string;
|
|
22
|
+
/** Failure reason, present only when `status` is `failed`. */
|
|
23
|
+
error?: string;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Funds an account with test lumens via Friendbot. Resolves federated addresses
|
|
27
|
+
* first and funds each requested network independently.
|
|
28
|
+
*
|
|
29
|
+
* @param address - Account to fund (address or federated address). Defaults to the logged-in account.
|
|
30
|
+
* @param options - Which network(s) to fund on.
|
|
31
|
+
* @returns One {@link FundAccountResult} per requested network.
|
|
32
|
+
* @throws If the address cannot be resolved, or a requested network is not fundable by Friendbot.
|
|
33
|
+
*/
|
|
34
|
+
export declare const fundAccount: (address?: string, options?: FundAccountOptions) => Promise<FundAccountResult[]>;
|
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
import { Horizon } from '@stellar/stellar-sdk';
|
|
2
|
+
/** Options for {@link getAccount}. */
|
|
2
3
|
export type GetAccountOptions = {
|
|
4
|
+
/**
|
|
5
|
+
* Account to load: a Stellar address (`G...`/`M...`) or a SEP-2 federated
|
|
6
|
+
* address (`name*domain.com`). Defaults to the logged-in account.
|
|
7
|
+
*/
|
|
3
8
|
address?: string;
|
|
9
|
+
/** Network passphrase to query. Defaults to the active network. */
|
|
4
10
|
network?: string;
|
|
5
11
|
};
|
|
12
|
+
/** The loaded account, or `null` when it does not exist on-chain. */
|
|
6
13
|
export type GetAccountResult = Horizon.AccountResponse | null;
|
|
14
|
+
/**
|
|
15
|
+
* Loads a single account from Horizon, resolving federated addresses first.
|
|
16
|
+
*
|
|
17
|
+
* @param options - Which account to load and on which network.
|
|
18
|
+
* @returns The account record, or `null` if it is not found / not yet funded.
|
|
19
|
+
* @throws If `address` is neither a valid Stellar address nor a resolvable federated address.
|
|
20
|
+
*/
|
|
7
21
|
export declare const getAccount: (options: GetAccountOptions) => Promise<GetAccountResult>;
|
|
@@ -1,34 +1,38 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AccountCallBuilder } from '@stellar/stellar-sdk/lib/horizon/account_call_builder';
|
|
1
|
+
import { Horizon } from '@stellar/stellar-sdk';
|
|
2
|
+
import { AccountCallBuilder } from '@stellar/stellar-sdk/lib/esm/horizon/account_call_builder';
|
|
3
|
+
import { type AssetArg } from './helpers';
|
|
3
4
|
import { CallBuilderOptions } from '../utils';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
sponsor?: string;
|
|
8
|
-
forLiquidityPool?: string;
|
|
9
|
-
};
|
|
10
|
-
type GetAccountsOptionsB = {
|
|
5
|
+
/** Filter fields for {@link getAccounts}; at least one must be provided. */
|
|
6
|
+
type GetAccountsFilters = {
|
|
7
|
+
/** Accounts that list this key as a signer (address or federated address). */
|
|
11
8
|
forSigner?: string;
|
|
12
|
-
|
|
9
|
+
/** Accounts holding a trustline to this asset (`'xlm'`, `'CODE:ISSUER'`, or an `Asset`). */
|
|
10
|
+
forAsset?: AssetArg;
|
|
11
|
+
/** Accounts sponsored by this account id. */
|
|
13
12
|
sponsor?: string;
|
|
13
|
+
/** Accounts participating in this liquidity pool id. */
|
|
14
14
|
forLiquidityPool?: string;
|
|
15
15
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
forLiquidityPool: string;
|
|
27
|
-
};
|
|
28
|
-
export type GetAccountsOptions = CallBuilderOptions & (GetAccountsOptionsA | GetAccountsOptionsB | GetAccountsOptionsC | GetAccountsOptionsD);
|
|
16
|
+
/**
|
|
17
|
+
* Requires at least one key of `T` to be present while keeping the rest
|
|
18
|
+
* optional — Horizon's `/accounts` endpoint must be filtered by something.
|
|
19
|
+
*/
|
|
20
|
+
type RequireAtLeastOne<T> = {
|
|
21
|
+
[K in keyof T]-?: Required<Pick<T, K>> & Partial<Omit<T, K>>;
|
|
22
|
+
}[keyof T];
|
|
23
|
+
/** Options for {@link getAccounts}: pagination plus at least one filter. */
|
|
24
|
+
export type GetAccountsOptions = CallBuilderOptions & RequireAtLeastOne<GetAccountsFilters>;
|
|
25
|
+
/** The Horizon call builder plus the first page of accounts. */
|
|
29
26
|
export type GetAccountsResult = {
|
|
30
27
|
builder: AccountCallBuilder;
|
|
31
28
|
response: Horizon.ServerApi.CollectionPage<Horizon.ServerApi.AccountRecord>;
|
|
32
29
|
};
|
|
30
|
+
/**
|
|
31
|
+
* Lists accounts filtered by signer, asset trustline, sponsor, or liquidity
|
|
32
|
+
* pool. At least one filter is required by Horizon.
|
|
33
|
+
*
|
|
34
|
+
* @param options - At least one filter, plus pagination and network.
|
|
35
|
+
* @returns The `builder` (for further paging) and the first-page `response`.
|
|
36
|
+
*/
|
|
33
37
|
export declare const getAccounts: (options: GetAccountsOptions) => Promise<GetAccountsResult>;
|
|
34
38
|
export {};
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import { Horizon } from '@stellar/stellar-sdk';
|
|
2
|
-
import { AssetsCallBuilder } from '@stellar/stellar-sdk/lib/horizon/assets_call_builder';
|
|
2
|
+
import { AssetsCallBuilder } from '@stellar/stellar-sdk/lib/esm/horizon/assets_call_builder';
|
|
3
3
|
import { CallBuilderOptions } from '../utils';
|
|
4
|
+
/** Options for {@link getAssets}. Extends the shared {@link CallBuilderOptions}. */
|
|
4
5
|
export type GetAssetsOptions = CallBuilderOptions & {
|
|
6
|
+
/** Filter to a single asset code (e.g. `USDC`). */
|
|
5
7
|
forCode?: string;
|
|
8
|
+
/** Filter to assets issued by this account id. */
|
|
6
9
|
forIssuer?: string;
|
|
7
10
|
};
|
|
11
|
+
/** The Horizon call builder plus the first page of matching issued assets. */
|
|
8
12
|
export type GetAssetsResult = {
|
|
9
13
|
builder: AssetsCallBuilder;
|
|
10
14
|
response: Horizon.ServerApi.CollectionPage<Horizon.ServerApi.AssetRecord>;
|
|
11
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* Lists issued assets known to Horizon, optionally filtered by code and/or issuer.
|
|
18
|
+
*
|
|
19
|
+
* @param options - Filters, pagination, and network.
|
|
20
|
+
* @returns The `builder` (for further paging) and the first-page `response`.
|
|
21
|
+
*/
|
|
12
22
|
export declare const getAssets: (options: GetAssetsOptions) => Promise<GetAssetsResult>;
|
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
import { Horizon } from '@stellar/stellar-sdk';
|
|
2
|
+
/** Options for {@link getBalances}. */
|
|
2
3
|
export type GetBalancesOptions = {
|
|
4
|
+
/**
|
|
5
|
+
* Account whose balances to read: a Stellar address (`G...`/`M...`) or a SEP-2
|
|
6
|
+
* federated address. Defaults to the logged-in account.
|
|
7
|
+
*/
|
|
3
8
|
address?: string;
|
|
9
|
+
/** Network passphrase to query. Defaults to the active network. */
|
|
4
10
|
network?: string;
|
|
11
|
+
/** Keep balance lines whose balance is exactly zero. Defaults to `false`. */
|
|
5
12
|
includeZeroBalances?: boolean;
|
|
6
13
|
};
|
|
14
|
+
/** The account's balance lines, with the native (XLM) line first when present. */
|
|
7
15
|
export type GetBalancesResult = Horizon.HorizonApi.BalanceLine[];
|
|
16
|
+
/**
|
|
17
|
+
* Reads an account's asset balances, resolving federated addresses first.
|
|
18
|
+
*
|
|
19
|
+
* @param options - Which account to read and on which network.
|
|
20
|
+
* @returns The balance lines (native first), or an empty array if the account is not found.
|
|
21
|
+
* @throws If `address` is neither a valid Stellar address nor a resolvable federated address.
|
|
22
|
+
*/
|
|
8
23
|
export declare const getBalances: (options: GetBalancesOptions) => Promise<GetBalancesResult>;
|
|
@@ -1,13 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ClaimableBalanceCallBuilder } from '@stellar/stellar-sdk/lib/horizon/claimable_balances_call_builder';
|
|
1
|
+
import { Horizon } from '@stellar/stellar-sdk';
|
|
2
|
+
import { ClaimableBalanceCallBuilder } from '@stellar/stellar-sdk/lib/esm/horizon/claimable_balances_call_builder';
|
|
3
|
+
import { type AssetArg } from './helpers';
|
|
3
4
|
import { CallBuilderOptions } from '../utils';
|
|
5
|
+
/** Options for {@link getClaimableBalances}. Extends the shared {@link CallBuilderOptions}. */
|
|
4
6
|
export type GetClaimableBalancesOptions = CallBuilderOptions & {
|
|
5
|
-
asset: Asset
|
|
7
|
+
/** Only balances of this asset (`'xlm'`, `'CODE:ISSUER'`, or an `Asset`). */
|
|
8
|
+
asset: AssetArg;
|
|
9
|
+
/** Only balances sponsored by this account id. */
|
|
6
10
|
sponsor?: string;
|
|
11
|
+
/** Only balances claimable by this account (address or federated address). */
|
|
7
12
|
claimant: string;
|
|
8
13
|
};
|
|
14
|
+
/** The Horizon call builder plus the first page of claimable balances. */
|
|
9
15
|
export type GetClaimableBalancesResult = {
|
|
10
16
|
builder: ClaimableBalanceCallBuilder;
|
|
11
17
|
response: Horizon.ServerApi.CollectionPage<Horizon.ServerApi.ClaimableBalanceRecord>;
|
|
12
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* Lists claimable balances, scoped by asset and claimant (and optionally
|
|
21
|
+
* sponsor).
|
|
22
|
+
*
|
|
23
|
+
* @param options - Filters, pagination, and network.
|
|
24
|
+
* @returns The `builder` (for further paging) and the first-page `response`.
|
|
25
|
+
*/
|
|
13
26
|
export declare const getClaimableBalances: (options: GetClaimableBalancesOptions) => Promise<GetClaimableBalancesResult>;
|
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
import { Horizon } from '@stellar/stellar-sdk';
|
|
2
|
-
import { EffectCallBuilder } from '@stellar/stellar-sdk/lib/horizon/effect_call_builder';
|
|
2
|
+
import { EffectCallBuilder } from '@stellar/stellar-sdk/lib/esm/horizon/effect_call_builder';
|
|
3
3
|
import { CallBuilderOptions } from '../utils';
|
|
4
|
+
/** Options for {@link getEffects}. Extends the shared {@link CallBuilderOptions}. */
|
|
4
5
|
export type GetEffectsOptions = CallBuilderOptions & {
|
|
6
|
+
/** Only effects touching this account (address or federated address). */
|
|
5
7
|
forAccount?: string;
|
|
8
|
+
/** Only effects in this ledger, by sequence number. */
|
|
6
9
|
forLedger?: string | number;
|
|
10
|
+
/** Only effects in this transaction, by hash. */
|
|
7
11
|
forTransaction?: string;
|
|
12
|
+
/** Only effects produced by this operation id. */
|
|
8
13
|
forOperation?: string;
|
|
14
|
+
/** Only effects for this liquidity pool id. */
|
|
9
15
|
forLiquidityPool?: string;
|
|
10
16
|
};
|
|
17
|
+
/** The Horizon call builder plus the first page of effects. */
|
|
11
18
|
export type GetEffectsResult = {
|
|
12
19
|
builder: EffectCallBuilder;
|
|
13
20
|
response: Horizon.ServerApi.CollectionPage<Horizon.ServerApi.EffectRecord>;
|
|
14
21
|
};
|
|
22
|
+
/**
|
|
23
|
+
* Lists effects (the granular ledger changes operations produce), optionally
|
|
24
|
+
* scoped to an account, ledger, transaction, operation, or liquidity pool.
|
|
25
|
+
*
|
|
26
|
+
* @param options - Filters, pagination, and network.
|
|
27
|
+
* @returns The `builder` (for further paging) and the first-page `response`.
|
|
28
|
+
*/
|
|
15
29
|
export declare const getEffects: (options: GetEffectsOptions) => Promise<GetEffectsResult>;
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import { Horizon } from '@stellar/stellar-sdk';
|
|
2
|
-
import { LedgerCallBuilder } from '@stellar/stellar-sdk/lib/horizon/ledger_call_builder';
|
|
2
|
+
import { LedgerCallBuilder } from '@stellar/stellar-sdk/lib/esm/horizon/ledger_call_builder';
|
|
3
3
|
import { CallBuilderOptions } from '../utils';
|
|
4
|
+
/** Options for {@link getLedgers}. Extends the shared {@link CallBuilderOptions}. */
|
|
4
5
|
export type GetLedgersOptions = CallBuilderOptions & {
|
|
6
|
+
/** Fetch a single ledger by its sequence number. */
|
|
5
7
|
ledger?: number | string;
|
|
6
8
|
};
|
|
9
|
+
/** The Horizon call builder plus the first page of ledgers. */
|
|
7
10
|
export type GetLedgersResult = {
|
|
8
11
|
builder: LedgerCallBuilder;
|
|
9
12
|
response: Horizon.ServerApi.CollectionPage<Horizon.ServerApi.LedgerRecord>;
|
|
10
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* Lists ledgers, or fetches a single ledger when `ledger` is given.
|
|
16
|
+
*
|
|
17
|
+
* @param options - Optional ledger selector, pagination, and network.
|
|
18
|
+
* @returns The `builder` (for further paging) and the first-page `response`.
|
|
19
|
+
*/
|
|
11
20
|
export declare const getLedgers: (options: GetLedgersOptions) => Promise<GetLedgersResult>;
|
|
@@ -1,12 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { LiquidityPoolCallBuilder } from '@stellar/stellar-sdk/lib/horizon/liquidity_pool_call_builder';
|
|
1
|
+
import { Horizon } from '@stellar/stellar-sdk';
|
|
2
|
+
import { LiquidityPoolCallBuilder } from '@stellar/stellar-sdk/lib/esm/horizon/liquidity_pool_call_builder';
|
|
3
|
+
import { type AssetArg } from './helpers';
|
|
3
4
|
import { CallBuilderOptions } from '../utils';
|
|
5
|
+
/** Options for {@link getLiquidityPools}. Extends the shared {@link CallBuilderOptions}. */
|
|
4
6
|
export type GetLiquidityPoolsOptions = CallBuilderOptions & {
|
|
5
|
-
|
|
7
|
+
/** Only pools made up of exactly these reserve assets (`'xlm'`, `'CODE:ISSUER'`, or `Asset`). */
|
|
8
|
+
forAssets?: Array<AssetArg>;
|
|
9
|
+
/** Only pools this account holds shares in (address or federated address). */
|
|
6
10
|
forAccount?: string;
|
|
7
11
|
};
|
|
12
|
+
/** The Horizon call builder plus the first page of liquidity pools. */
|
|
8
13
|
export type GetLiquidityPoolsResult = {
|
|
9
14
|
builder: LiquidityPoolCallBuilder;
|
|
10
15
|
response: Horizon.ServerApi.CollectionPage<Horizon.ServerApi.LiquidityPoolRecord>;
|
|
11
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* Lists liquidity pools, optionally scoped to a set of reserve assets or a
|
|
19
|
+
* participating account.
|
|
20
|
+
*
|
|
21
|
+
* @param options - Filters, pagination, and network.
|
|
22
|
+
* @returns The `builder` (for further paging) and the first-page `response`.
|
|
23
|
+
*/
|
|
12
24
|
export declare const getLiquidityPools: (options: GetLiquidityPoolsOptions) => Promise<GetLiquidityPoolsResult>;
|
|
@@ -1,15 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { OfferCallBuilder } from '@stellar/stellar-sdk/lib/horizon/offer_call_builder';
|
|
1
|
+
import { Horizon } from '@stellar/stellar-sdk';
|
|
2
|
+
import { OfferCallBuilder } from '@stellar/stellar-sdk/lib/esm/horizon/offer_call_builder';
|
|
3
|
+
import { type AssetArg } from './helpers';
|
|
3
4
|
import { CallBuilderOptions } from '../utils';
|
|
5
|
+
/** Options for {@link getOffers}. Extends the shared {@link CallBuilderOptions}. */
|
|
4
6
|
export type GetOffersOptions = CallBuilderOptions & {
|
|
7
|
+
/** Only offers owned by this account (address or federated address). */
|
|
5
8
|
forAccount?: string;
|
|
6
|
-
buying
|
|
7
|
-
|
|
9
|
+
/** Only offers buying this asset (`'xlm'`, `'CODE:ISSUER'`, or an `Asset`). */
|
|
10
|
+
buying?: AssetArg;
|
|
11
|
+
/** Only offers selling this asset (`'xlm'`, `'CODE:ISSUER'`, or an `Asset`). */
|
|
12
|
+
selling?: AssetArg;
|
|
13
|
+
/** Only offers sponsored by this account id. */
|
|
8
14
|
sponsor?: string;
|
|
15
|
+
/** Only offers created by this seller (address or federated address). */
|
|
9
16
|
seller?: string;
|
|
10
17
|
};
|
|
18
|
+
/** The Horizon call builder plus the first page of offers. */
|
|
11
19
|
export type GetOffersResult = {
|
|
12
20
|
builder: OfferCallBuilder;
|
|
13
21
|
response: Horizon.ServerApi.CollectionPage<Horizon.ServerApi.OfferRecord>;
|
|
14
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* Lists open DEX offers, optionally scoped by owner, buying/selling asset,
|
|
25
|
+
* sponsor, or seller.
|
|
26
|
+
*
|
|
27
|
+
* @param options - Filters, pagination, and network.
|
|
28
|
+
* @returns The `builder` (for further paging) and the first-page `response`.
|
|
29
|
+
*/
|
|
15
30
|
export declare const getOffers: (options: GetOffersOptions) => Promise<GetOffersResult>;
|
|
@@ -1,16 +1,31 @@
|
|
|
1
1
|
import { Horizon } from '@stellar/stellar-sdk';
|
|
2
|
-
import { OperationCallBuilder } from '@stellar/stellar-sdk/lib/horizon/operation_call_builder';
|
|
2
|
+
import { OperationCallBuilder } from '@stellar/stellar-sdk/lib/esm/horizon/operation_call_builder';
|
|
3
3
|
import { CallBuilderOptions } from '../utils';
|
|
4
|
+
/** Options for {@link getOperations}. Extends the shared {@link CallBuilderOptions}. */
|
|
4
5
|
export type GetOperationsOptions = CallBuilderOptions & {
|
|
6
|
+
/** Only operations touching this account (address or federated address). */
|
|
5
7
|
forAccount?: string;
|
|
8
|
+
/** Only operations for this claimable balance id. */
|
|
6
9
|
forClaimableBalance?: string;
|
|
10
|
+
/** Only operations in this ledger, by sequence number. */
|
|
7
11
|
forLedger?: string | number;
|
|
12
|
+
/** Only operations in this transaction, by hash. */
|
|
8
13
|
forTransaction?: string;
|
|
14
|
+
/** Only operations for this liquidity pool id. */
|
|
9
15
|
forLiquidityPool?: string;
|
|
16
|
+
/** Include operations from failed transactions. Defaults to `false`. */
|
|
10
17
|
includeFailed?: boolean;
|
|
11
18
|
};
|
|
19
|
+
/** The Horizon call builder plus the first page of operations. */
|
|
12
20
|
export type GetOperationsResult = {
|
|
13
21
|
builder: OperationCallBuilder;
|
|
14
22
|
response: Horizon.ServerApi.CollectionPage<Horizon.ServerApi.OperationRecord>;
|
|
15
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* Lists operations, optionally scoped to an account, ledger, transaction,
|
|
26
|
+
* claimable balance, or liquidity pool.
|
|
27
|
+
*
|
|
28
|
+
* @param options - Filters, pagination, and network.
|
|
29
|
+
* @returns The `builder` (for further paging) and the first-page `response`.
|
|
30
|
+
*/
|
|
16
31
|
export declare const getOperations: (options: GetOperationsOptions) => Promise<GetOperationsResult>;
|
|
@@ -1,8 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { OrderbookCallBuilder } from '@stellar/stellar-sdk/lib/horizon/orderbook_call_builder';
|
|
1
|
+
import { Horizon } from '@stellar/stellar-sdk';
|
|
2
|
+
import { OrderbookCallBuilder } from '@stellar/stellar-sdk/lib/esm/horizon/orderbook_call_builder';
|
|
3
|
+
import { type AssetArg } from './helpers';
|
|
3
4
|
import { CallBuilderOptions } from '../utils';
|
|
5
|
+
/** The Horizon call builder plus the current order book snapshot. */
|
|
4
6
|
export type GetOrderbookResult = {
|
|
5
7
|
builder: OrderbookCallBuilder;
|
|
6
8
|
response: Horizon.ServerApi.OrderbookRecord;
|
|
7
9
|
};
|
|
8
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Fetches the DEX order book for a `selling`/`buying` asset pair.
|
|
12
|
+
*
|
|
13
|
+
* @param args - `[selling, buying]`; each accepts `'xlm'`, `'CODE:ISSUER'`, or an `Asset`.
|
|
14
|
+
* @param options - Pagination and network.
|
|
15
|
+
* @returns The `builder` and the order book `response`.
|
|
16
|
+
*/
|
|
17
|
+
export declare const getOrderbook: (args: [selling: AssetArg, buying: AssetArg], options: CallBuilderOptions) => Promise<GetOrderbookResult>;
|
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
import { CallBuilderOptions } from '../utils';
|
|
2
|
+
/** Options for {@link getPayments}. Extends the shared {@link CallBuilderOptions}. */
|
|
2
3
|
export type GetPaymentsOptions = CallBuilderOptions & {
|
|
4
|
+
/** Only payments touching this account (address or federated address). */
|
|
3
5
|
forAccount?: string;
|
|
6
|
+
/** Only payments in this ledger, by sequence number. */
|
|
4
7
|
forLedger?: string | number;
|
|
8
|
+
/** Only payments in this transaction, by hash. */
|
|
5
9
|
forTransaction?: string;
|
|
10
|
+
/** Include payments from failed transactions. Defaults to `false`. */
|
|
6
11
|
includeFailed?: boolean;
|
|
7
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* Lists payment operations, optionally scoped to an account, ledger, or
|
|
15
|
+
* transaction.
|
|
16
|
+
*
|
|
17
|
+
* @param options - Filters, pagination, and network.
|
|
18
|
+
* @returns The `builder` (for further paging) and the first-page `response`.
|
|
19
|
+
*/
|
|
8
20
|
export declare const getPayments: (options: GetPaymentsOptions) => Promise<{
|
|
9
|
-
builder: import("@stellar/stellar-sdk/lib/horizon/payment_call_builder").PaymentCallBuilder;
|
|
10
|
-
response: import("@stellar/stellar-sdk/lib/horizon").ServerApi.CollectionPage<import("@stellar/stellar-sdk/lib/horizon").ServerApi.CreateAccountOperationRecord | import("@stellar/stellar-sdk/lib/horizon").ServerApi.PaymentOperationRecord | import("@stellar/stellar-sdk/lib/horizon").ServerApi.PathPaymentOperationRecord | import("@stellar/stellar-sdk/lib/horizon").ServerApi.AccountMergeOperationRecord | import("@stellar/stellar-sdk/lib/horizon").ServerApi.PathPaymentStrictSendOperationRecord | import("@stellar/stellar-sdk/lib/horizon").ServerApi.InvokeHostFunctionOperationRecord>;
|
|
21
|
+
builder: import("@stellar/stellar-sdk/lib/esm/horizon/payment_call_builder").PaymentCallBuilder;
|
|
22
|
+
response: import("@stellar/stellar-sdk/lib/esm/horizon").ServerApi.CollectionPage<import("@stellar/stellar-sdk/lib/esm/horizon").ServerApi.CreateAccountOperationRecord | import("@stellar/stellar-sdk/lib/esm/horizon").ServerApi.PaymentOperationRecord | import("@stellar/stellar-sdk/lib/esm/horizon").ServerApi.PathPaymentOperationRecord | import("@stellar/stellar-sdk/lib/esm/horizon").ServerApi.AccountMergeOperationRecord | import("@stellar/stellar-sdk/lib/esm/horizon").ServerApi.PathPaymentStrictSendOperationRecord | import("@stellar/stellar-sdk/lib/esm/horizon").ServerApi.InvokeHostFunctionOperationRecord>;
|
|
11
23
|
}>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type AssetArg } from './helpers';
|
|
2
|
+
/**
|
|
3
|
+
* Computes the Stellar Asset Contract (SAC) address of a classic asset.
|
|
4
|
+
*
|
|
5
|
+
* Every classic asset — native XLM or a `CODE:ISSUER` pair — has a deterministic
|
|
6
|
+
* Soroban contract id derived from the asset plus the network passphrase. That
|
|
7
|
+
* contract (the SAC) is what lets Soroban contracts hold and move the asset. The
|
|
8
|
+
* id is computed locally with no network call, so it is returned whether or not
|
|
9
|
+
* the SAC has actually been deployed yet. Feed the result into
|
|
10
|
+
* {@link getTokenMetadata}, {@link transfer}'s `token` option, or
|
|
11
|
+
* {@link readContracts} / {@link writeContract}.
|
|
12
|
+
*
|
|
13
|
+
* @param asset - The asset: `'xlm'` / `'native'`, a `CODE:ISSUER` string, or an `Asset`.
|
|
14
|
+
* @param network - Network passphrase to derive against. Defaults to the active network.
|
|
15
|
+
* @returns The SAC contract id (`C...`).
|
|
16
|
+
* @throws If the asset is invalid, or no network is given and there is no active network.
|
|
17
|
+
*/
|
|
18
|
+
export declare const getSacAddress: (asset: AssetArg, network?: string) => string;
|
|
@@ -1,8 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { PathCallBuilder } from '@stellar/stellar-sdk/lib/horizon/path_call_builder';
|
|
1
|
+
import { Horizon } from '@stellar/stellar-sdk';
|
|
2
|
+
import { PathCallBuilder } from '@stellar/stellar-sdk/lib/esm/horizon/path_call_builder';
|
|
3
|
+
import { type AssetArg } from './helpers';
|
|
3
4
|
import { CallBuilderOptions } from '../utils';
|
|
5
|
+
/** The Horizon call builder plus the first page of payment paths. */
|
|
4
6
|
export type GetPaymentPathResult = {
|
|
5
7
|
builder: PathCallBuilder;
|
|
6
8
|
response: Horizon.ServerApi.CollectionPage<Horizon.ServerApi.PaymentPathRecord>;
|
|
7
9
|
};
|
|
8
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Finds payment paths for a fixed amount received (strict-receive): "the
|
|
12
|
+
* destination must receive exactly X — what could the source send?".
|
|
13
|
+
*
|
|
14
|
+
* @param args - `[source, destinationAsset, destinationAmount]`. `source` is
|
|
15
|
+
* either the paying account (address or federated address) or an array of
|
|
16
|
+
* candidate source assets; `destinationAsset` accepts `'xlm'`/`'CODE:ISSUER'`/`Asset`.
|
|
17
|
+
* @param options - Pagination and network.
|
|
18
|
+
* @returns The `builder` (for further paging) and the first-page `response`.
|
|
19
|
+
*/
|
|
20
|
+
export declare const getStrictReceivePaths: (args: [source: string | AssetArg[], destinationAsset: AssetArg, destinationAmount: string], options: CallBuilderOptions) => Promise<GetPaymentPathResult>;
|
|
@@ -1,8 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { PathCallBuilder } from '@stellar/stellar-sdk/lib/horizon/path_call_builder';
|
|
1
|
+
import { Horizon } from '@stellar/stellar-sdk';
|
|
2
|
+
import { PathCallBuilder } from '@stellar/stellar-sdk/lib/esm/horizon/path_call_builder';
|
|
3
|
+
import { type AssetArg } from './helpers';
|
|
3
4
|
import { CallBuilderOptions } from '../utils';
|
|
5
|
+
/** The Horizon call builder plus the first page of payment paths. */
|
|
4
6
|
export type GetPaymentPathResult = {
|
|
5
7
|
builder: PathCallBuilder;
|
|
6
8
|
response: Horizon.ServerApi.CollectionPage<Horizon.ServerApi.PaymentPathRecord>;
|
|
7
9
|
};
|
|
8
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Finds payment paths for a fixed amount sent (strict-send): "I will send
|
|
12
|
+
* exactly X of the source asset — what can the destination receive?".
|
|
13
|
+
*
|
|
14
|
+
* @param args - `[sourceAsset, sourceAmount, destination]`. `sourceAsset` accepts
|
|
15
|
+
* `'xlm'`/`'CODE:ISSUER'`/`Asset`; `destination` is either a recipient account
|
|
16
|
+
* (address or federated address) or an array of candidate destination assets.
|
|
17
|
+
* @param options - Pagination and network.
|
|
18
|
+
* @returns The `builder` (for further paging) and the first-page `response`.
|
|
19
|
+
*/
|
|
20
|
+
export declare const getStrictSendPaths: (args: [sourceAsset: AssetArg, sourceAmount: string, destination: string | AssetArg[]], options: CallBuilderOptions) => Promise<GetPaymentPathResult>;
|