@bluxcc/react 0.1.2 → 0.1.4

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.
@@ -0,0 +1,8 @@
1
+ import { Networks } from "@stellar/stellar-sdk";
2
+ export declare const networks: {
3
+ mainnet: Networks;
4
+ testnet: Networks;
5
+ sandbox: Networks;
6
+ futurenet: Networks;
7
+ standalone: Networks;
8
+ };
@@ -1,5 +1,7 @@
1
1
  import { Horizon } from '@stellar/stellar-sdk';
2
- import { HorizonApi } from '@stellar/stellar-sdk/lib/horizon';
2
+ import { Url } from '../utils/network/url';
3
+ import { Fallback } from '../utils/network/fallback';
4
+ import { History } from '../utils/stellar/getTransactions';
3
5
  /**
4
6
  * Enum representing the supported wallets in the system.
5
7
  */
@@ -23,24 +25,32 @@ export declare enum WalletNetwork {
23
25
  export interface AccountData {
24
26
  id: string;
25
27
  sequence: string;
28
+ xlmBalance: string;
26
29
  subentry_count: number;
27
- thresholds: Horizon.HorizonApi.AccountThresholds;
28
30
  balances: Horizon.HorizonApi.BalanceLine[];
29
- xlmBalance: string;
30
- transactions?: Horizon.ServerApi.TransactionRecord[];
31
+ thresholds: Horizon.HorizonApi.AccountThresholds;
32
+ transactions?: History[];
33
+ }
34
+ interface IServers {
35
+ horizon?: Url | Fallback;
36
+ soroban?: Url | Fallback;
31
37
  }
38
+ export type ITransports = Record<string, IServers>;
32
39
  /**
33
40
  * Configuration options for the provider.
34
41
  */
35
42
  export interface IProviderConfig {
36
43
  appName: string;
37
- appLogo?: string;
38
- network: string;
44
+ networks: string[];
45
+ appearance: IAppearance;
46
+ transports?: ITransports;
47
+ loginMethods?: Array<'wallet' | 'email' | 'sms' | 'google' | 'twitter' | 'discord' | 'github' | 'passkey'>;
39
48
  }
40
49
  /**
41
50
  * Information about the connected wallet.
42
51
  */
43
52
  export interface WalletInfo {
53
+ passphrase: string;
44
54
  name: SupportedWallets;
45
55
  address: string | null;
46
56
  }
@@ -49,6 +59,8 @@ export interface WalletInfo {
49
59
  */
50
60
  export interface IUser {
51
61
  wallet: WalletInfo | null;
62
+ email: string | null;
63
+ phoneNumber: number | null;
52
64
  }
53
65
  /**
54
66
  * Context state management interface.
@@ -77,14 +89,13 @@ export interface IAppearance {
77
89
  textColor: string;
78
90
  font: SupportedFonts;
79
91
  cornerRadius: CornerRadius;
80
- cover: string;
92
+ logo?: React.ImgHTMLAttributes<HTMLImageElement>['src'];
81
93
  }
82
94
  /**
83
95
  * Structure of the global context values.
84
96
  */
85
97
  export interface ContextInterface {
86
98
  config: IProviderConfig;
87
- appearance: IAppearance;
88
99
  user: IUser;
89
100
  isModalOpen: boolean;
90
101
  isReady: boolean;
@@ -94,8 +105,8 @@ export interface ContextInterface {
94
105
  waitingStatus: 'connecting' | 'signing';
95
106
  signTransaction: {
96
107
  xdr: string;
97
- resolver: ((value: HorizonApi.SubmitTransactionResponse) => void) | null;
98
- result: HorizonApi.SubmitTransactionResponse | null;
108
+ resolver: ((value: Horizon.HorizonApi.SubmitTransactionResponse) => void) | null;
109
+ result: Horizon.HorizonApi.SubmitTransactionResponse | null;
99
110
  };
100
111
  }
101
112
  /**
@@ -108,7 +119,8 @@ export declare enum Routes {
108
119
  PROFILE = "PROFILE",// User profile view
109
120
  SIGN_TRANSACTION = "SIGN_TRANSACTION",// User sign transaction view
110
121
  SEND = "SEND",// User sign transaction view
111
- ACTIVITY = "ACTIVITY"
122
+ ACTIVITY = "ACTIVITY",// User sign transaction view
123
+ OTP = "OTP"
112
124
  }
113
125
  /**
114
126
  * Modal state management interface.
@@ -128,6 +140,7 @@ export interface ModalHeights {
128
140
  [Routes.SIGN_TRANSACTION]: number;
129
141
  [Routes.SEND]: number;
130
142
  [Routes.ACTIVITY]: number;
143
+ [Routes.OTP]: number;
131
144
  }
132
145
  /**
133
146
  * Represents the result of a successful wallet connection.
@@ -141,6 +154,10 @@ export interface ConnectResult {
141
154
  export interface SignResult {
142
155
  signedXdr: string;
143
156
  }
157
+ export interface GetNetworkResult {
158
+ network: string;
159
+ passphrase: string;
160
+ }
144
161
  /**
145
162
  * Defines the available actions for interacting with a wallet.
146
163
  */
@@ -162,9 +179,9 @@ export interface WalletInterface {
162
179
  submit?: boolean;
163
180
  }) => Promise<string>;
164
181
  disconnect?: () => Promise<void>;
165
- getNetwork?: () => Promise<{
182
+ getNetwork: () => Promise<{
166
183
  network: string;
167
- networkPassphrase: string;
184
+ passphrase: string;
168
185
  }>;
169
186
  signMessage?: (message: string, options?: {
170
187
  networkPassphrase?: string;
@@ -183,3 +200,4 @@ export interface WalletInterface {
183
200
  signerPublicKey?: string;
184
201
  }>;
185
202
  }
203
+ export {};
@@ -0,0 +1,3 @@
1
+ import { WalletInterface } from '../types';
2
+ declare const getWalletNetwork: (wallet: WalletInterface, networks: string[]) => Promise<string>;
3
+ export default getWalletNetwork;
@@ -0,0 +1,13 @@
1
+ import { Url } from './url';
2
+ export interface FallbackOptions {
3
+ retryCount?: number;
4
+ retryDelay?: number;
5
+ }
6
+ export interface Fallback extends FallbackOptions {
7
+ urls: Url[];
8
+ }
9
+ export declare const fallback: (urls: Url[], options?: FallbackOptions) => {
10
+ retryCount?: number;
11
+ retryDelay?: number;
12
+ urls: Url[];
13
+ };
@@ -0,0 +1,12 @@
1
+ export interface UrlOptions {
2
+ allowHttp?: boolean;
3
+ appName?: string;
4
+ appVersion?: string;
5
+ authToken?: string;
6
+ retryCount?: number;
7
+ retryDelay?: number;
8
+ }
9
+ export interface Url extends UrlOptions {
10
+ url: string;
11
+ }
12
+ export declare const url: (urlStr: string, options?: UrlOptions) => Url;
@@ -0,0 +1,3 @@
1
+ import { WalletInterface } from "../types";
2
+ declare const setWalletNetwork: (wallet: WalletInterface, networks: string[]) => Promise<string>;
3
+ export default setWalletNetwork;
@@ -1,5 +1,5 @@
1
1
  declare const getTransactionDetails: (xdr: string) => {
2
- action: "createAccount" | "payment" | "pathPaymentStrictReceive" | "pathPaymentStrictSend" | "createPassiveSellOffer" | "manageSellOffer" | "manageBuyOffer" | "setOptions" | "changeTrust" | "allowTrust" | "accountMerge" | "inflation" | "manageData" | "bumpSequence" | "createClaimableBalance" | "claimClaimableBalance" | "beginSponsoringFutureReserves" | "endSponsoringFutureReserves" | "revokeSponsorship" | "clawback" | "clawbackClaimableBalance" | "setTrustLineFlags" | "liquidityPoolDeposit" | "liquidityPoolWithdraw" | "invokeHostFunction" | "extendFootprintTtl" | "restoreFootprint";
2
+ action: "payment" | "createAccount" | "pathPaymentStrictReceive" | "pathPaymentStrictSend" | "createPassiveSellOffer" | "manageSellOffer" | "manageBuyOffer" | "setOptions" | "changeTrust" | "allowTrust" | "accountMerge" | "inflation" | "manageData" | "bumpSequence" | "createClaimableBalance" | "claimClaimableBalance" | "beginSponsoringFutureReserves" | "endSponsoringFutureReserves" | "revokeSponsorship" | "clawback" | "clawbackClaimableBalance" | "setTrustLineFlags" | "liquidityPoolDeposit" | "liquidityPoolWithdraw" | "invokeHostFunction" | "extendFootprintTtl" | "restoreFootprint";
3
3
  operations: number;
4
4
  sender: string;
5
5
  estimatedFee: number;
@@ -0,0 +1,7 @@
1
+ import { Horizon } from '@stellar/stellar-sdk';
2
+ export type History = {
3
+ title: string;
4
+ description: string;
5
+ others?: any;
6
+ };
7
+ export declare const getTransactions: (server: Horizon.Server, publicKey: string) => Promise<History[]>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bluxcc/react",
3
3
  "author": "Blux team",
4
- "version": "0.1.2",
4
+ "version": "0.1.4",
5
5
  "homepage": "https://blux.cc",
6
6
  "description": "Connecting to the Stellar Ecosystem and Beyond",
7
7
  "repository": {