@bluxcc/core 0.2.17 → 0.3.0
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/README.md +130 -15
- package/dist/components/Modal/index.d.ts +4 -1
- package/dist/components/Provider.d.ts +4 -1
- package/dist/exports/blux.d.ts +4 -8
- package/dist/exports/createConfig.d.ts +8 -1
- package/dist/exports/index.d.ts +3 -0
- package/dist/index.cjs.js +2 -2
- package/dist/index.esm.js +14 -14
- package/dist/stellar/handleSignMessage.d.ts +1 -1
- package/dist/stellar/processes/continueLoginProcess.d.ts +1 -0
- package/dist/tailwind.css.d.ts +2 -0
- package/dist/types.d.ts +19 -7
- package/dist/utils/api.d.ts +9 -4
- package/dist/utils/appValidity.d.ts +4 -3
- package/dist/utils/helpers.d.ts +2 -1
- package/package.json +2 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { IWallet } from "../types";
|
|
2
|
-
declare const handleSignMessage: (wallet: IWallet, message: string, address: string, network
|
|
2
|
+
declare const handleSignMessage: (wallet: IWallet, message: string, address: string, network?: string) => Promise<string>;
|
|
3
3
|
export default handleSignMessage;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
1
2
|
import { Horizon, rpc } from '@stellar/stellar-sdk';
|
|
2
3
|
import { SupportedWallet } from './enums';
|
|
3
4
|
/** Supported UI language codes (ISO 639-1). */
|
|
4
|
-
export type LanguageKey = 'en' | 'es' | 'pt' | 'fr' | 'de' | 'ru' | 'zh' | 'ja' | 'ko';
|
|
5
|
+
export type LanguageKey = 'en' | 'es' | 'pt' | 'fr' | 'de' | 'ru' | 'zh' | 'ja' | 'ko' | 'tr';
|
|
5
6
|
/** Custom RPC endpoints keyed by network passphrase. */
|
|
6
7
|
export type ITransports = Record<string, IServers>;
|
|
8
|
+
/** A value TypeScript still treats as a string, while keeping literal unions suggestable. */
|
|
9
|
+
type LooseString = string & {};
|
|
7
10
|
/** Block explorer used to build account/transaction links. */
|
|
8
11
|
export type IExplorer = 'steexp' | 'stellarchain' | 'stellarexpert' | 'lumenscan';
|
|
9
12
|
/** Social login providers supported by Blux. */
|
|
@@ -13,7 +16,7 @@ export type ILoginMethods = Array<'wallet' | 'sms' | 'email' | 'passkey' | ISoci
|
|
|
13
16
|
/** Canonical names of the wallets Blux can integrate with. */
|
|
14
17
|
export type IWalletNames = Array<'rabet' | 'albedo' | 'freighter' | 'xbull' | 'lobstr' | 'hana' | 'hot' | 'klever' | 'cactuslink' | 'fordefi' | 'trezor'>;
|
|
15
18
|
/** RPC endpoints for a single network. */
|
|
16
|
-
interface IServers {
|
|
19
|
+
export interface IServers {
|
|
17
20
|
/** Horizon base URL. */
|
|
18
21
|
horizon: string;
|
|
19
22
|
/** Soroban RPC base URL. */
|
|
@@ -58,13 +61,13 @@ export interface IConfig {
|
|
|
58
61
|
/** Show Blux's built-in signing/approval UIs. When `false`, signing happens headlessly. Defaults to `true`. */
|
|
59
62
|
showWalletUIs?: boolean;
|
|
60
63
|
/** Login methods to offer. Defaults to `['wallet']`. */
|
|
61
|
-
loginMethods?: ILoginMethods |
|
|
64
|
+
loginMethods?: Array<ILoginMethods[number] | LooseString>;
|
|
62
65
|
/** Custom Horizon/Soroban endpoints per network; required for custom networks. */
|
|
63
66
|
transports?: ITransports;
|
|
64
67
|
/** Wallets to hide from the picker. */
|
|
65
68
|
excludeWallets?: IWalletNames;
|
|
66
69
|
/** Wallets to surface first in the picker, in the given order. */
|
|
67
|
-
orderWallets?: IWalletNames |
|
|
70
|
+
orderWallets?: Array<IWalletNames[number] | LooseString>;
|
|
68
71
|
/** WalletConnect metadata; required to enable WalletConnect. */
|
|
69
72
|
walletConnect?: IWalletConnectMetaData;
|
|
70
73
|
/** Trezor manifest metadata; required to enable Trezor. */
|
|
@@ -116,9 +119,19 @@ export interface IAppearance {
|
|
|
116
119
|
/** Box shadow style for the modal. */
|
|
117
120
|
boxShadow: string;
|
|
118
121
|
}
|
|
122
|
+
/** How a wallet proves it controls an address during login. */
|
|
123
|
+
export type WalletProofType = 'signed_transaction' | 'signed_message';
|
|
119
124
|
export interface IWallet {
|
|
120
125
|
name: SupportedWallet;
|
|
121
126
|
website: string;
|
|
127
|
+
/**
|
|
128
|
+
* When true, login proves ownership with `signMessage` (SEP-53) instead of a
|
|
129
|
+
* SEP-10 challenge transaction. Use this for wallets that treat the
|
|
130
|
+
* unsubmittable challenge as a real payment and block on insufficient XLM
|
|
131
|
+
* (Freighter, Hana, Rabet, OneKey). Hardware wallets that cannot sign arbitrary messages
|
|
132
|
+
* must leave this unset so they keep using the challenge transaction.
|
|
133
|
+
*/
|
|
134
|
+
authenticateWithSignedMessage?: boolean;
|
|
122
135
|
connect: () => Promise<string>;
|
|
123
136
|
disconnect: () => Promise<void>;
|
|
124
137
|
getNetwork: () => Promise<{
|
|
@@ -132,7 +145,7 @@ export interface IWallet {
|
|
|
132
145
|
}) => Promise<string>;
|
|
133
146
|
signMessage: (message: string, options: {
|
|
134
147
|
address: string;
|
|
135
|
-
network
|
|
148
|
+
network?: string;
|
|
136
149
|
}) => Promise<string>;
|
|
137
150
|
signTransaction: (xdr: string, options: {
|
|
138
151
|
network: string;
|
|
@@ -149,7 +162,7 @@ export interface IAccountData {
|
|
|
149
162
|
transactions?: Horizon.ServerApi.TransactionRecord[];
|
|
150
163
|
}
|
|
151
164
|
export interface IAsset {
|
|
152
|
-
logo?: string |
|
|
165
|
+
logo?: string | ReactNode;
|
|
153
166
|
valueInCurrency?: string;
|
|
154
167
|
assetBalance: string;
|
|
155
168
|
assetCode: string;
|
|
@@ -233,7 +246,6 @@ export interface ISendTransaction {
|
|
|
233
246
|
export interface ISignMessage {
|
|
234
247
|
message: string;
|
|
235
248
|
result?: string;
|
|
236
|
-
options: ISignOptions;
|
|
237
249
|
rejecter: (reason: any) => void;
|
|
238
250
|
resolver: (value: string) => void;
|
|
239
251
|
}
|
package/dist/utils/api.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IUser } from '../store';
|
|
2
|
-
import { AuthenticateApiResponse } from '../types';
|
|
2
|
+
import { AuthenticateApiResponse, WalletProofType } from '../types';
|
|
3
3
|
import { PasskeyFlowResult } from '../pages/Onboarding/Passkey';
|
|
4
4
|
type ApiPasskeyChallenge = {
|
|
5
5
|
user_id: string;
|
|
@@ -11,11 +11,16 @@ export declare const apiPasskeyChallenge: (appId: string, authValue: string) =>
|
|
|
11
11
|
export declare const apiPasskeyVerify: (appId: string, challenge: ApiPasskeyChallenge, passkeyResult: PasskeyFlowResult) => Promise<string>;
|
|
12
12
|
export declare const apiSendOtp: (appId: string, authValue: string) => Promise<boolean>;
|
|
13
13
|
type ApiWalletChallenge = {
|
|
14
|
-
challenge_xdr
|
|
14
|
+
challenge_xdr?: string;
|
|
15
|
+
challenge?: string;
|
|
15
16
|
network_passphrase: string;
|
|
17
|
+
proof_type?: WalletProofType;
|
|
16
18
|
};
|
|
17
|
-
export declare const apiWalletChallenge: (appId: string, walletName: string, walletAddress: string) => Promise<ApiWalletChallenge>;
|
|
18
|
-
export declare const apiVerifyWalletChallenge: (appId: string,
|
|
19
|
+
export declare const apiWalletChallenge: (appId: string, walletName: string, walletAddress: string, proofType?: WalletProofType) => Promise<ApiWalletChallenge>;
|
|
20
|
+
export declare const apiVerifyWalletChallenge: (appId: string, code: string, options?: {
|
|
21
|
+
proofType?: WalletProofType;
|
|
22
|
+
challenge?: string;
|
|
23
|
+
}) => Promise<string>;
|
|
19
24
|
export declare const apiVerifyOtp: (appId: string, user: IUser, otp: string) => Promise<string>;
|
|
20
25
|
type ApiGetUserResponse = {
|
|
21
26
|
auth_method: string;
|
|
@@ -15,8 +15,9 @@ export declare const isAppValid: () => boolean;
|
|
|
15
15
|
*/
|
|
16
16
|
export declare const assertAppIsValid: () => void;
|
|
17
17
|
/**
|
|
18
|
-
* Resolves once the SDK has finished initializing
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* Resolves once the SDK has finished initializing AND appId validation has
|
|
19
|
+
* settled, so the caller can then assert validity. Polls because both happen
|
|
20
|
+
* asynchronously after createConfig. For apps that do not offer wallet login,
|
|
21
|
+
* `isReady` does not wait on wallet availability — only appId validation.
|
|
21
22
|
*/
|
|
22
23
|
export declare const waitForBluxReady: () => Promise<void>;
|
package/dist/utils/helpers.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Asset, Horizon } from '@stellar/stellar-sdk';
|
|
2
2
|
import translations from '../constants/locales';
|
|
3
3
|
import { Route, SupportedWallet } from '../enums';
|
|
4
|
-
import { IAsset, IWallet, IExplorer, LanguageKey, ITransports, IWalletNames } from '../types';
|
|
4
|
+
import { IAsset, IWallet, IExplorer, LanguageKey, ITransports, IWalletNames, ILoginMethods } from '../types';
|
|
5
5
|
import { INetworkTransports } from '../constants/networkDetails';
|
|
6
6
|
export declare const bufferToBase64Url: (buf: ArrayBuffer) => string;
|
|
7
7
|
export declare const base64UrlToBuffer: (value: string) => ArrayBuffer;
|
|
@@ -36,6 +36,7 @@ export declare const getRecentConnectionMethod: () => SupportedWallet[];
|
|
|
36
36
|
export declare const getNetworkByPassphrase: (passphrase: string) => string;
|
|
37
37
|
export declare const getNetworkRpc: (network: string, transports: ITransports) => INetworkTransports;
|
|
38
38
|
export declare const canonicalWalletName: (name: string) => string;
|
|
39
|
+
export declare const loginMethodsIncludeWallet: (loginMethods: ILoginMethods | string[] | undefined) => boolean;
|
|
39
40
|
export declare const getSortedCheckedWallets: (wallets: IWallet[], priorityNames?: string[]) => IWallet[];
|
|
40
41
|
export declare const getWalletNetwork: (wallet: IWallet) => Promise<string>;
|
|
41
42
|
export declare const handleLoadWallets: (walletNames: IWalletNames, orderWallets?: string[]) => Promise<IWallet[]>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bluxcc/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
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": "^17.0.1",
|
|
46
46
|
"@walletconnect/core": "^2.21.9",
|
|
47
47
|
"@walletconnect/sign-client": "^2.21.9",
|
|
48
48
|
"qrcode.react": "^4.2.0",
|