@bluxcc/react 0.1.10 → 0.1.11

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.
@@ -35,6 +35,7 @@ interface IServers {
35
35
  soroban: Url;
36
36
  }
37
37
  export type ITransports = Record<string, IServers>;
38
+ export type IExplorers = 'steexp' | 'stellarchain' | 'stellarexpert' | 'lumenscan';
38
39
  /**
39
40
  * BluxProvider.config
40
41
  */
@@ -44,6 +45,7 @@ export interface IProviderConfig {
44
45
  defaultNetwork: string;
45
46
  appearance?: Partial<IAppearance>;
46
47
  transports?: ITransports;
48
+ explorer?: IExplorers;
47
49
  loginMethods?: Array<'wallet' | 'email' | 'sms' | 'google' | 'twitter' | 'discord' | 'github' | 'passkey'>;
48
50
  }
49
51
  /**
@@ -51,6 +53,7 @@ export interface IProviderConfig {
51
53
  * Appearance will be set to default values if the user does not provider appearance (or provides some of the values in Appearance)
52
54
  */
53
55
  export interface IConfig extends IProviderConfig {
56
+ explorer: IExplorers;
54
57
  appearance: IAppearance;
55
58
  }
56
59
  /**
@@ -113,12 +116,7 @@ export interface ContextInterface {
113
116
  availableWallets: WalletInterface[];
114
117
  waitingStatus: 'connecting' | 'signing';
115
118
  activeNetwork: string;
116
- signTransaction: {
117
- xdr: string;
118
- network: string;
119
- resolver: ((value: HorizonApi.SubmitTransactionResponse) => void) | null;
120
- result: HorizonApi.SubmitTransactionResponse | null;
121
- };
119
+ signTransaction: ISignTransaction<boolean>;
122
120
  servers: {
123
121
  horizon: Horizon.Server;
124
122
  soroban: rpc.Server;
@@ -176,6 +174,19 @@ export interface GetNetworkResult {
176
174
  }
177
175
  export interface ISendTransactionOptions {
178
176
  network?: string;
177
+ isSoroban?: boolean;
178
+ }
179
+ export type ISendTransactionOptionsInternal = {
180
+ network: string;
181
+ isSoroban: boolean;
182
+ };
183
+ export type TransactionResponseType<T extends boolean> = T extends true ? rpc.Api.GetSuccessfulTransactionResponse : HorizonApi.SubmitTransactionResponse;
184
+ export interface ISignTransaction<IsSoroban extends boolean> {
185
+ options: ISendTransactionOptionsInternal;
186
+ xdr: string;
187
+ rejecter: ((reason: any) => void) | null;
188
+ result: TransactionResponseType<IsSoroban> | null;
189
+ resolver: ((value: TransactionResponseType<IsSoroban>) => void) | null;
179
190
  }
180
191
  /**
181
192
  * Defines the available actions for interacting with a wallet.
@@ -5,9 +5,9 @@ type UseBalanceParams = {
5
5
  asset?: string | Asset;
6
6
  };
7
7
  interface UseBalanceResult {
8
+ balance: string;
8
9
  loading: boolean;
9
10
  error: Error | null;
10
- balance: string | null;
11
11
  }
12
12
  declare const useBalance: ({ asset, address, network }: UseBalanceParams) => UseBalanceResult;
13
13
  export default useBalance;
@@ -12,7 +12,7 @@ type TransactionRecord<T extends boolean> = T extends true ? TransactionRecordWi
12
12
  interface UseTransactionsResult<T extends boolean> {
13
13
  loading: boolean;
14
14
  error: Error | null;
15
- transactions: TransactionRecord<T>[] | null;
15
+ transactions: TransactionRecord<T>[];
16
16
  }
17
17
  declare const useTransactions: <T extends boolean = false>(params?: UseTransactionsProps<T>) => UseTransactionsResult<T>;
18
18
  export default useTransactions;
@@ -0,0 +1,3 @@
1
+ import { rpc } from "@stellar/stellar-sdk";
2
+ declare const finalizeSorobanTransaction: (hash: string, server: rpc.Server) => Promise<rpc.Api.GetSuccessfulTransactionResponse | null>;
3
+ export default finalizeSorobanTransaction;
@@ -1,2 +1,3 @@
1
- declare const getExplorerUrl: (networkPassphrase: string, endpoint: string) => string;
1
+ import { IExplorers } from '../../types';
2
+ declare const getExplorerUrl: (networkPassphrase: string, explorerProvider: IExplorers, endpoint: "accountUrl" | "transactionUrl" | "operationUrl" | "ledgerUrl", value: string) => string | null;
2
3
  export default getExplorerUrl;
@@ -1,5 +1,5 @@
1
1
  declare const getTransactionDetails: (xdr: string, network: string) => {
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";
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";
3
3
  operations: number;
4
4
  sender: string;
5
5
  estimatedFee: number;
@@ -1,4 +1,10 @@
1
- import { Horizon } from '@stellar/stellar-sdk';
2
- import { ITransports } from '../../types';
3
- declare const submitTransaction: (xdr: string, network: string, transports: ITransports) => Promise<Horizon.HorizonApi.SubmitTransactionResponse>;
1
+ import { Horizon, rpc } from '@stellar/stellar-sdk';
2
+ import { ISendTransactionOptionsInternal, ITransports } from '../../types';
3
+ declare function submitTransaction(xdr: string, options: ISendTransactionOptionsInternal & {
4
+ isSoroban: true;
5
+ }, transports: ITransports): Promise<rpc.Api.GetSuccessfulTransactionResponse>;
6
+ declare function submitTransaction(xdr: string, options: ISendTransactionOptionsInternal & {
7
+ isSoroban?: false;
8
+ }, transports: ITransports): Promise<Horizon.HorizonApi.SubmitTransactionResponse>;
9
+ declare function submitTransaction(xdr: string, options: ISendTransactionOptionsInternal, transports: ITransports): Promise<rpc.Api.GetSuccessfulTransactionResponse | Horizon.HorizonApi.SubmitTransactionResponse>;
4
10
  export default submitTransaction;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bluxcc/react",
3
3
  "author": "Blux team",
4
- "version": "0.1.10",
4
+ "version": "0.1.11",
5
5
  "homepage": "https://blux.cc",
6
6
  "description": "Connecting to the Stellar Ecosystem and Beyond",
7
7
  "repository": {
@@ -1,12 +0,0 @@
1
- import { AccountData } from '../types';
2
- interface AccountHookResult {
3
- account: AccountData | null;
4
- loading: boolean;
5
- error: string | null;
6
- }
7
- interface AccountHookProps {
8
- publicKey: string;
9
- passphrase: string;
10
- }
11
- declare const useAccount: ({ publicKey, passphrase, }: AccountHookProps) => AccountHookResult;
12
- export default useAccount;