@bluxcc/core 0.1.20 → 0.1.21

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.
@@ -1,3 +1,4 @@
1
- import { ITransports, IWallet } from "../types";
2
- declare const handleTransactionSigning: (wallet: IWallet, xdr: string, userAddress: string, network: string, transports: ITransports) => Promise<import("@stellar/stellar-sdk/lib/horizon").HorizonApi.SubmitTransactionResponse>;
1
+ import { IUser } from '../store';
2
+ import { ITransports } from '../types';
3
+ declare const handleTransactionSigning: (xdr: string, user: IUser, network: string, transports: ITransports) => Promise<import("@stellar/stellar-sdk/lib/horizon").HorizonApi.SubmitTransactionResponse | undefined>;
3
4
  export default handleTransactionSigning;
package/dist/store.d.ts CHANGED
@@ -3,7 +3,7 @@ import { SignClient } from '@walletconnect/sign-client/dist/types/client';
3
3
  import { Route } from './enums';
4
4
  import { UseBalancesResult } from './hooks/useBalances';
5
5
  import { UseTransactionsResult } from './hooks/useTransactions';
6
- import { IAsset, IWallet, ISignMessage, IInternalConfig, ISendTransaction, IAppearance } from './types';
6
+ import { IAsset, IWallet, ISignMessage, IInternalConfig, ISendTransaction, IAppearance, AuthenticateApiResponse } from './types';
7
7
  export type WaitingStatus = 'login' | 'sendTransaction' | 'signMessage';
8
8
  export type AlertType = 'error' | 'success' | 'info' | 'warn' | 'none';
9
9
  export interface IUser {
@@ -12,6 +12,10 @@ export interface IUser {
12
12
  authValue: string;
13
13
  authMethod: string;
14
14
  }
15
+ export interface IAuth {
16
+ isAuthenticated: boolean;
17
+ JWT: string;
18
+ }
15
19
  export interface IStellarConfig {
16
20
  activeNetwork: string;
17
21
  servers: {
@@ -26,6 +30,7 @@ export interface ISelectAsset {
26
30
  swapFromAsset: IAsset;
27
31
  }
28
32
  export interface IStoreProperties {
33
+ auth?: IAuth;
29
34
  config: IInternalConfig;
30
35
  user?: IUser;
31
36
  authState: {
@@ -55,6 +60,7 @@ export interface IStoreProperties {
55
60
  client: SignClient;
56
61
  };
57
62
  networkSyncDisabled: boolean;
63
+ apiResponse?: AuthenticateApiResponse;
58
64
  }
59
65
  export interface IStoreMethods {
60
66
  connectEmail: (email: string) => void;
@@ -80,6 +86,8 @@ export interface IStoreMethods {
80
86
  cleanUp: (method: 'sendTransaction' | 'signMessage') => void;
81
87
  setNetworkSyncDisabled: (isDisabled: boolean) => void;
82
88
  setAppearance: (newAppearance: Partial<IAppearance>) => void;
89
+ setApiResponse: (res: AuthenticateApiResponse) => void;
90
+ setAuth: (a: IAuth) => void;
83
91
  }
84
92
  export interface IStore extends IStoreProperties, IStoreMethods {
85
93
  }
package/dist/types.d.ts CHANGED
@@ -16,7 +16,7 @@ export interface IWalletConnectMetaData {
16
16
  description: string;
17
17
  }
18
18
  export interface IConfig {
19
- appId?: string;
19
+ appId: string;
20
20
  appName: string;
21
21
  networks: string[];
22
22
  defaultNetwork?: string;
@@ -34,6 +34,7 @@ export interface IConfig {
34
34
  export interface IInternalConfig extends IConfig {
35
35
  explorer: IExplorer;
36
36
  appearance: IAppearance;
37
+ loginMethods: ILoginMethods;
37
38
  showWalletUIs: boolean;
38
39
  defaultNetwork: string;
39
40
  lang: LanguageKey;
@@ -103,18 +104,20 @@ export interface ISignOptions {
103
104
  export type SendTransactionResult = Horizon.HorizonApi.SubmitTransactionResponse;
104
105
  export interface ISendTransaction {
105
106
  xdr: string;
106
- wallet: IWallet;
107
107
  options: ISignOptions;
108
108
  result?: SendTransactionResult;
109
109
  rejecter: (reason: any) => void;
110
110
  resolver: (value: SendTransactionResult) => void;
111
111
  }
112
112
  export interface ISignMessage {
113
- wallet: IWallet;
114
113
  message: string;
115
- options: ISignOptions;
116
114
  result?: string;
115
+ options: ISignOptions;
117
116
  rejecter: (reason: any) => void;
118
117
  resolver: (value: string) => void;
119
118
  }
119
+ export interface AuthenticateApiResponse {
120
+ isValid: boolean;
121
+ message: string;
122
+ }
120
123
  export {};
@@ -0,0 +1,13 @@
1
+ import { AuthenticateApiResponse } from '../types';
2
+ import { IUser } from '../store';
3
+ export declare const authenticateAppId: (appId: string) => Promise<AuthenticateApiResponse>;
4
+ export declare const apiSendOtp: (appId: string, authValue: string) => Promise<boolean>;
5
+ export declare const apiVerifyOtp: (appId: string, user: IUser, otp: string) => Promise<string>;
6
+ type ApiGetUserResponse = {
7
+ status: number;
8
+ auth_method: string;
9
+ auth_value: string;
10
+ public_key: string;
11
+ };
12
+ export declare const apiGetUser: (JWT: string) => Promise<ApiGetUserResponse>;
13
+ export {};
@@ -10,6 +10,7 @@ export declare const addXLMToBalances: (balances: IAsset[]) => {
10
10
  assetBalance: string;
11
11
  assetType: string;
12
12
  }[];
13
+ export declare const fetcher: <T>(url: string, options: RequestInit) => Promise<T>;
13
14
  export declare const isChangeTrustNeeded: (to: string, asset: IAsset, balances: Horizon.HorizonApi.BalanceLine[]) => boolean;
14
15
  export declare const balanceToAsset: (balance: Horizon.HorizonApi.BalanceLine) => IAsset;
15
16
  export declare const capitalizeFirstLetter: (str: string) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluxcc/core",
3
- "version": "0.1.20",
3
+ "version": "0.1.21",
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": "^14.1.1",
45
+ "@stellar/stellar-sdk": "^14.4.2",
46
46
  "@walletconnect/core": "^2.21.9",
47
47
  "@walletconnect/sign-client": "^2.21.9",
48
48
  "qrcode.react": "^4.2.0",