@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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare const getTransactionDetails: (xdr: string, network: string) => {
|
|
2
|
-
action: "
|
|
2
|
+
action: "accountMerge" | "allowTrust" | "beginSponsoringFutureReserves" | "bumpSequence" | "changeTrust" | "claimClaimableBalance" | "clawbackClaimableBalance" | "clawback" | "createAccount" | "createClaimableBalance" | "createPassiveSellOffer" | "endSponsoringFutureReserves" | "extendFootprintTtl" | "inflation" | "invokeHostFunction" | "liquidityPoolDeposit" | "liquidityPoolWithdraw" | "manageBuyOffer" | "manageData" | "manageSellOffer" | "pathPaymentStrictReceive" | "pathPaymentStrictSend" | "payment" | "restoreFootprint" | "revokeAccountSponsorship" | "revokeClaimableBalanceSponsorship" | "revokeDataSponsorship" | "revokeLiquidityPoolSponsorship" | "revokeOfferSponsorship" | "revokeSignerSponsorship" | "revokeTrustlineSponsorship" | "setOptions" | "setTrustLineFlags";
|
|
3
3
|
operations: number;
|
|
4
4
|
sender: string;
|
|
5
5
|
receiver: string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ITransports, IWallet } from '../types';
|
|
2
|
-
declare const handleTransactionSigning: (wallet: IWallet, xdr: string, userAddress: string, network: string, transports: ITransports, shouldSubmit: boolean) => Promise<string | import("
|
|
2
|
+
declare const handleTransactionSigning: (wallet: IWallet, xdr: string, userAddress: string, network: string, transports: ITransports, shouldSubmit: boolean) => Promise<string | import("../types").ISubmittedTransaction>;
|
|
3
3
|
export default handleTransactionSigning;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
declare function submitTransaction(xdr: string, network: string, transports: ITransports): Promise<// | rpc.Api.GetSuccessfulTransactionResponse
|
|
4
|
-
Horizon.HorizonApi.SubmitTransactionResponse>;
|
|
1
|
+
import { ITransports, ISubmittedTransaction } from '../types';
|
|
2
|
+
declare function submitTransaction(xdr: string, network: string, transports: ITransports): Promise<ISubmittedTransaction>;
|
|
5
3
|
export default submitTransaction;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Horizon } from '@stellar/stellar-sdk';
|
|
2
2
|
import { IAsset } from '../types';
|
|
3
|
-
declare const swapTransaction: (rawFromAmount: string, rawToAmount: string, lastFieldChanged: "from" | "to", fromAsset: IAsset, toAsset: IAsset, path: IAsset[], sourceAddress: string, server:
|
|
3
|
+
declare const swapTransaction: (rawFromAmount: string, rawToAmount: string, lastFieldChanged: "from" | "to", fromAsset: IAsset, toAsset: IAsset, path: IAsset[], sourceAddress: string, server: Horizon.Server, networkPassphrase: string, isChangeTrustNeeded: boolean) => Promise<string>;
|
|
4
4
|
export default swapTransaction;
|
package/dist/store.d.ts
CHANGED
|
@@ -74,6 +74,7 @@ export interface IStoreProperties {
|
|
|
74
74
|
signMessage?: ISignMessage;
|
|
75
75
|
signAuthEntry?: ISignAuthEntry;
|
|
76
76
|
login?: ILoginPromise;
|
|
77
|
+
loginError?: string;
|
|
77
78
|
balances: UseBalancesResult;
|
|
78
79
|
transactions: UseTransactionsResult;
|
|
79
80
|
selectAsset: ISelectAsset;
|
|
@@ -116,6 +117,7 @@ export interface IStoreMethods {
|
|
|
116
117
|
setAuth: (a: IAuth) => void;
|
|
117
118
|
setIsAuthenticated: (isAuthenticated: boolean) => void;
|
|
118
119
|
setLogin: (loginDetails: ILoginPromise | undefined) => void;
|
|
120
|
+
setLoginError: (message?: string) => void;
|
|
119
121
|
setLogos: (logos: ILogo[]) => void;
|
|
120
122
|
}
|
|
121
123
|
export interface IStore extends IStoreProperties, IStoreMethods {
|
package/dist/types.d.ts
CHANGED
|
@@ -1,41 +1,75 @@
|
|
|
1
|
-
import { Horizon } from '@stellar/stellar-sdk';
|
|
1
|
+
import { Horizon, rpc } from '@stellar/stellar-sdk';
|
|
2
2
|
import { SupportedWallet } from './enums';
|
|
3
|
+
/** Supported UI language codes (ISO 639-1). */
|
|
3
4
|
export type LanguageKey = 'en' | 'es' | 'pt' | 'fr' | 'de' | 'ru' | 'zh' | 'ja' | 'ko';
|
|
5
|
+
/** Custom RPC endpoints keyed by network passphrase. */
|
|
4
6
|
export type ITransports = Record<string, IServers>;
|
|
7
|
+
/** Block explorer used to build account/transaction links. */
|
|
5
8
|
export type IExplorer = 'steexp' | 'stellarchain' | 'stellarexpert' | 'lumenscan';
|
|
9
|
+
/** Social login providers supported by Blux. */
|
|
6
10
|
export type ISocialProvider = 'google';
|
|
11
|
+
/** Login methods to offer in the modal. */
|
|
7
12
|
export type ILoginMethods = Array<'wallet' | 'sms' | 'email' | 'passkey' | ISocialProvider>;
|
|
13
|
+
/** Canonical names of the wallets Blux can integrate with. */
|
|
8
14
|
export type IWalletNames = Array<'rabet' | 'albedo' | 'freighter' | 'xbull' | 'lobstr' | 'hana' | 'hot' | 'klever' | 'cactuslink' | 'fordefi' | 'trezor'>;
|
|
15
|
+
/** RPC endpoints for a single network. */
|
|
9
16
|
interface IServers {
|
|
17
|
+
/** Horizon base URL. */
|
|
10
18
|
horizon: string;
|
|
19
|
+
/** Soroban RPC base URL. */
|
|
11
20
|
soroban: string;
|
|
12
21
|
}
|
|
22
|
+
/** WalletConnect project metadata shown to users during pairing. */
|
|
13
23
|
export interface IWalletConnectMetaData {
|
|
24
|
+
/** Icon URLs for your app. */
|
|
14
25
|
icons: string[];
|
|
26
|
+
/** Your app URL. */
|
|
15
27
|
url: string;
|
|
28
|
+
/** WalletConnect Cloud project id. */
|
|
16
29
|
projectId: string;
|
|
30
|
+
/** Short description of your app. */
|
|
17
31
|
description: string;
|
|
18
32
|
}
|
|
33
|
+
/** Trezor Connect manifest metadata. */
|
|
19
34
|
export interface ITrezorMetaData {
|
|
35
|
+
/** Contact email required by Trezor Connect. */
|
|
20
36
|
email: string;
|
|
37
|
+
/** Optional app URL for the Trezor manifest. */
|
|
21
38
|
appUrl?: string;
|
|
22
39
|
}
|
|
40
|
+
/** Configuration passed to {@link createConfig}. */
|
|
23
41
|
export interface IConfig {
|
|
42
|
+
/** Your Blux app id, from the Blux dashboard. Required for email/passkey/social login. */
|
|
24
43
|
appId: string;
|
|
44
|
+
/** Display name of your app, shown in wallet prompts and UI. */
|
|
25
45
|
appName: string;
|
|
46
|
+
/** Network passphrases your app supports (e.g. from {@link networks}). */
|
|
26
47
|
networks: string[];
|
|
48
|
+
/** Which of `networks` to start on. Defaults to the first entry. */
|
|
27
49
|
defaultNetwork?: string;
|
|
50
|
+
/** Theme overrides for the Blux UI. */
|
|
28
51
|
appearance?: Partial<IAppearance>;
|
|
52
|
+
/** UI language. Defaults to `'en'`. */
|
|
29
53
|
lang?: LanguageKey;
|
|
54
|
+
/** Block explorer used for links. Defaults to `'stellarchain'`. */
|
|
30
55
|
explorer?: IExplorer;
|
|
56
|
+
/** Persist the session across reloads. Defaults to `false`. */
|
|
31
57
|
isPersistent?: boolean;
|
|
58
|
+
/** Show Blux's built-in signing/approval UIs. When `false`, signing happens headlessly. Defaults to `true`. */
|
|
32
59
|
showWalletUIs?: boolean;
|
|
60
|
+
/** Login methods to offer. Defaults to `['wallet']`. */
|
|
33
61
|
loginMethods?: ILoginMethods | string[];
|
|
62
|
+
/** Custom Horizon/Soroban endpoints per network; required for custom networks. */
|
|
34
63
|
transports?: ITransports;
|
|
64
|
+
/** Wallets to hide from the picker. */
|
|
35
65
|
excludeWallets?: IWalletNames;
|
|
66
|
+
/** Wallets to surface first in the picker, in the given order. */
|
|
36
67
|
orderWallets?: IWalletNames | string[];
|
|
68
|
+
/** WalletConnect metadata; required to enable WalletConnect. */
|
|
37
69
|
walletConnect?: IWalletConnectMetaData;
|
|
70
|
+
/** Trezor manifest metadata; required to enable Trezor. */
|
|
38
71
|
trezor?: ITrezorMetaData;
|
|
72
|
+
/** Prompt the user when their wallet is on a different network. Defaults to `true`. */
|
|
39
73
|
promptOnWrongNetwork?: boolean;
|
|
40
74
|
}
|
|
41
75
|
export interface IInternalConfig extends IConfig {
|
|
@@ -49,21 +83,37 @@ export interface IInternalConfig extends IConfig {
|
|
|
49
83
|
orderWallets?: string[];
|
|
50
84
|
promptOnWrongNetwork: boolean;
|
|
51
85
|
}
|
|
86
|
+
/** Theme tokens for the Blux modal and components. */
|
|
52
87
|
export interface IAppearance {
|
|
88
|
+
/** Modal or component background color/image. */
|
|
53
89
|
background: string;
|
|
90
|
+
/** Background color for input fields or UI sections. */
|
|
54
91
|
fieldBackground: string;
|
|
92
|
+
/** Primary accent or highlight color. */
|
|
55
93
|
accentColor: string;
|
|
94
|
+
/** Main text color. */
|
|
56
95
|
textColor: string;
|
|
96
|
+
/** Font family or style. */
|
|
57
97
|
fontFamily: string;
|
|
98
|
+
/** Outline width (e.g. `'2px'`); falls back to `borderWidth`. */
|
|
58
99
|
outlineWidth?: string;
|
|
100
|
+
/** Outline color; falls back to `borderColor`. */
|
|
59
101
|
outlineColor?: string;
|
|
102
|
+
/** Modal corner radius; falls back to `borderRadius`. */
|
|
60
103
|
outlineRadius?: string;
|
|
104
|
+
/** Corner radius for UI elements. */
|
|
61
105
|
borderRadius: string;
|
|
106
|
+
/** Border color for elements. */
|
|
62
107
|
borderColor: string;
|
|
108
|
+
/** Border width (e.g. `'1px'`, `'0'`). */
|
|
63
109
|
borderWidth: string;
|
|
110
|
+
/** App logo URL. */
|
|
64
111
|
logo: string;
|
|
112
|
+
/** Blur level for the backdrop (e.g. `'8px'`). */
|
|
65
113
|
backdropBlur: string;
|
|
114
|
+
/** Backdrop color behind the modal/overlay. */
|
|
66
115
|
backdropColor: string;
|
|
116
|
+
/** Box shadow style for the modal. */
|
|
67
117
|
boxShadow: string;
|
|
68
118
|
}
|
|
69
119
|
export interface IWallet {
|
|
@@ -109,7 +159,26 @@ export interface IAsset {
|
|
|
109
159
|
export interface ISignOptions {
|
|
110
160
|
network: string;
|
|
111
161
|
}
|
|
112
|
-
|
|
162
|
+
/**
|
|
163
|
+
* Lazily resolves to the value the invoked contract function returned, decoded
|
|
164
|
+
* to a native JS value. Resolves to `null` for classic transactions and for
|
|
165
|
+
* Soroban calls whose function returns nothing.
|
|
166
|
+
*/
|
|
167
|
+
export type TransactionReturnValue = () => Promise<unknown>;
|
|
168
|
+
/** A transaction that has been submitted to (and accepted by) the network. */
|
|
169
|
+
export interface ISubmittedTransaction {
|
|
170
|
+
/** The transaction hash. */
|
|
171
|
+
hash: string;
|
|
172
|
+
/** Resolves the invoked contract function's return value; see {@link TransactionReturnValue}. */
|
|
173
|
+
returnValue: TransactionReturnValue;
|
|
174
|
+
/**
|
|
175
|
+
* The underlying response: a Horizon submit response for classic
|
|
176
|
+
* transactions, or the finalized Soroban RPC transaction for contract calls.
|
|
177
|
+
*/
|
|
178
|
+
raw: Horizon.HorizonApi.SubmitTransactionResponse | rpc.Api.GetSuccessfulTransactionResponse;
|
|
179
|
+
}
|
|
180
|
+
/** Result of a sign-and-send: the submitted transaction, or the signed XDR when not submitting. */
|
|
181
|
+
export type SendTransactionResult = ISubmittedTransaction | string;
|
|
113
182
|
export interface ISendTransaction {
|
|
114
183
|
xdr: string;
|
|
115
184
|
shouldSubmit: boolean;
|
|
@@ -135,8 +204,6 @@ export interface ISignAuthEntry {
|
|
|
135
204
|
export interface ISocialConfigEntry {
|
|
136
205
|
provider: string;
|
|
137
206
|
displayName: string;
|
|
138
|
-
clientId: string;
|
|
139
|
-
redirectUri: string;
|
|
140
207
|
}
|
|
141
208
|
export interface AuthenticateApiResponse {
|
|
142
209
|
isValid: boolean;
|
package/dist/utils/api.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ type ApiPasskeyChallenge = {
|
|
|
7
7
|
challenge_id: number;
|
|
8
8
|
};
|
|
9
9
|
export declare const authenticateAppId: (appId: string) => Promise<AuthenticateApiResponse>;
|
|
10
|
-
export declare const apiSocialLogin: (appId: string, provider: string, code: string) => Promise<string>;
|
|
11
10
|
export declare const apiRegisterPasskeyChallenge: (appId: string) => Promise<ApiPasskeyChallenge>;
|
|
12
11
|
export declare const apiRegisterPasskey: (appId: string, challenge: ApiPasskeyChallenge, passkeyResult: PasskeyFlowResult) => Promise<string>;
|
|
13
12
|
export declare const apiSendOtp: (appId: string, authValue: string) => Promise<boolean>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const ACCESS_DENIED_FALLBACK = "This account is not allowed to access this app";
|
|
2
|
+
export declare class BluxAccessDeniedError extends Error {
|
|
3
|
+
constructor(message?: string);
|
|
4
|
+
}
|
|
5
|
+
export declare const isAccessDenied: (error: unknown) => error is BluxAccessDeniedError;
|
|
6
|
+
export declare const looksLikeAccessDenied: (message: string) => boolean;
|
package/dist/utils/helpers.d.ts
CHANGED
|
@@ -3,10 +3,10 @@ import translations from '../constants/locales';
|
|
|
3
3
|
import { Route, SupportedWallet } from '../enums';
|
|
4
4
|
import { IAsset, IWallet, IExplorer, LanguageKey, ITransports, IWalletNames } from '../types';
|
|
5
5
|
import { INetworkTransports } from '../constants/networkDetails';
|
|
6
|
-
import { HorizonApi } from '@stellar/stellar-sdk/lib/horizon';
|
|
7
6
|
export declare const bufferToBase64Url: (buf: ArrayBuffer) => string;
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
7
|
+
export declare const base64UrlToBuffer: (value: string) => ArrayBuffer;
|
|
8
|
+
export declare const getAssetTitle: (asset: Horizon.HorizonApi.BalanceLineNative | Horizon.HorizonApi.BalanceLineAsset<"credit_alphanum4"> | Horizon.HorizonApi.BalanceLineAsset<"credit_alphanum12"> | Horizon.HorizonApi.BalanceLineLiquidityPool) => string;
|
|
9
|
+
export declare const getAssetSubtitle: (asset: Horizon.HorizonApi.BalanceLineNative | Horizon.HorizonApi.BalanceLineAsset<"credit_alphanum4"> | Horizon.HorizonApi.BalanceLineAsset<"credit_alphanum12"> | Horizon.HorizonApi.BalanceLineLiquidityPool) => string;
|
|
10
10
|
export declare const iAssetToAsset: (asset: IAsset) => Asset;
|
|
11
11
|
export declare const addXLMToBalances: (balances: IAsset[]) => {
|
|
12
12
|
assetIssuer: string;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import CDNFiles from '../constants/cdnFiles';
|
|
2
|
-
import { ILoginMethods,
|
|
2
|
+
import { ILoginMethods, AuthenticateApiResponse } from '../types';
|
|
3
3
|
type SocialProviderMeta = {
|
|
4
4
|
displayName: string;
|
|
5
|
-
authUrl: string;
|
|
6
|
-
scopes: string[];
|
|
7
5
|
icon: CDNFiles;
|
|
8
|
-
extraParams?: Record<string, string>;
|
|
9
6
|
};
|
|
10
7
|
export declare const SOCIAL_PROVIDERS: Record<string, SocialProviderMeta>;
|
|
11
8
|
export declare const isSocialProvider: (method: string) => boolean;
|
|
@@ -13,12 +10,10 @@ export declare const getEnabledSocials: (loginMethods: ILoginMethods | string[],
|
|
|
13
10
|
export type ISocialSession = {
|
|
14
11
|
provider: string;
|
|
15
12
|
popup: Window | null;
|
|
16
|
-
state: string;
|
|
17
|
-
redirectUri: string;
|
|
18
13
|
error?: string;
|
|
19
14
|
};
|
|
20
15
|
export declare const getActiveSocialSession: () => ISocialSession | null;
|
|
21
16
|
export declare const cancelActiveSocialSession: () => void;
|
|
22
|
-
export declare const beginSocialLogin: (provider: string,
|
|
23
|
-
export declare const
|
|
17
|
+
export declare const beginSocialLogin: (provider: string, appId: string) => ISocialSession;
|
|
18
|
+
export declare const awaitSocialLogin: (session: ISocialSession) => Promise<string>;
|
|
24
19
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bluxcc/core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"homepage": "https://blux.cc",
|
|
5
5
|
"description": "Blux is a wallet infra for the Stellar network",
|
|
6
6
|
"type": "module",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@ledgerhq/hw-app-str": "^7.2.8",
|
|
43
43
|
"@lobstrco/signer-extension-api": "^1.0.0-beta.0",
|
|
44
44
|
"@stellar/freighter-api": "^5.0.0",
|
|
45
|
-
"@stellar/stellar-sdk": "^
|
|
45
|
+
"@stellar/stellar-sdk": "^16.0.0",
|
|
46
46
|
"@walletconnect/core": "^2.21.9",
|
|
47
47
|
"@walletconnect/sign-client": "^2.21.9",
|
|
48
48
|
"qrcode.react": "^4.2.0",
|