@pollar/core 0.5.0 → 0.5.2

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/index.d.mts CHANGED
@@ -107,15 +107,18 @@ type TransactionState = {
107
107
  buildData: TxBuildContent;
108
108
  } | {
109
109
  step: 'signing';
110
- buildData: TxBuildContent;
110
+ buildData?: TxBuildContent;
111
+ external?: true;
111
112
  } | {
112
113
  step: 'success';
113
- buildData: TxBuildContent;
114
+ buildData?: TxBuildContent;
114
115
  hash: string;
116
+ external?: true;
115
117
  } | {
116
118
  step: 'error';
117
119
  details?: string;
118
120
  buildData?: TxBuildContent;
121
+ external?: true;
119
122
  };
120
123
  declare const AUTH_ERROR_CODES: {
121
124
  readonly SESSION_CREATE_FAILED: "SESSION_CREATE_FAILED";
@@ -183,6 +186,17 @@ declare class PollarFlowError extends Error {
183
186
  }
184
187
  type WalletBalanceContent = paths['/wallet/balance']['get']['responses'][200]['content']['application/json']['content'];
185
188
  type WalletBalanceRecord = WalletBalanceContent['balances'][number];
189
+ type WalletBalanceState = {
190
+ step: 'idle';
191
+ } | {
192
+ step: 'loading';
193
+ } | {
194
+ step: 'loaded';
195
+ data: WalletBalanceContent;
196
+ } | {
197
+ step: 'error';
198
+ message: string;
199
+ };
186
200
  type TxHistoryRecord = paths['/tx/history']['get']['responses'][200]['content']['application/json']['content']['records'][number];
187
201
  type TxHistoryParams = NonNullable<paths['/tx/history']['get']['parameters']['query']>;
188
202
  type TxHistoryContent = paths['/tx/history']['get']['responses'][200]['content']['application/json']['content'];
@@ -228,6 +242,8 @@ declare class PollarClient {
228
242
  private _transactionStateListeners;
229
243
  private _txHistoryState;
230
244
  private _txHistoryStateListeners;
245
+ private _walletBalanceState;
246
+ private _walletBalanceStateListeners;
231
247
  private _authState;
232
248
  private _authStateListeners;
233
249
  private _networkState;
@@ -250,12 +266,14 @@ declare class PollarClient {
250
266
  onNetworkStateChange(cb: (state: NetworkState) => void): () => void;
251
267
  getTransactionState(): TransactionState | null;
252
268
  onTransactionStateChange(cb: (state: TransactionState) => void): () => void;
253
- private _setTxHistoryState;
254
269
  getTxHistoryState(): TxHistoryState;
255
270
  onTxHistoryStateChange(cb: (state: TxHistoryState) => void): () => void;
256
271
  fetchTxHistory(params?: TxHistoryParams): Promise<void>;
257
- getWalletBalance(publicKey?: string): Promise<WalletBalanceContent | null>;
272
+ getWalletBalanceState(): WalletBalanceState;
273
+ onWalletBalanceStateChange(cb: (state: WalletBalanceState) => void): () => void;
274
+ refreshBalance(publicKey?: string): Promise<void>;
258
275
  buildTx(operation: TxBuildBody['operation'], params: TxBuildBody['params'], options?: TxBuildBody['options']): Promise<void>;
276
+ getWalletType(): WalletType | null;
259
277
  signAndSubmitTx(unsignedXdr: string): Promise<void>;
260
278
  getAppConfig(): Promise<unknown>;
261
279
  getKycStatus(providerId?: string): Promise<{
@@ -291,6 +309,8 @@ declare class PollarClient {
291
309
  intervalMs?: number;
292
310
  timeoutMs?: number;
293
311
  }): Promise<RampTxStatus>;
312
+ private _setTxHistoryState;
313
+ private _setWalletBalanceState;
294
314
  /** Creates a new AbortController, cancelling any existing flow first. */
295
315
  private _newController;
296
316
  /** Builds the deps object passed to flow functions via bind pattern. */
@@ -2076,6 +2096,8 @@ interface operations {
2076
2096
  balance: string;
2077
2097
  available: string;
2078
2098
  limit?: string;
2099
+ enabledInApp: boolean;
2100
+ trustlineRemoved: boolean;
2079
2101
  }[];
2080
2102
  };
2081
2103
  };
@@ -2732,4 +2754,4 @@ declare function pollRampTransaction(api: PollarApiClient, txId: string, { inter
2732
2754
  timeoutMs?: number;
2733
2755
  }): Promise<RampTxStatus>;
2734
2756
 
2735
- export { AUTH_ERROR_CODES, AlbedoAdapter, type AuthErrorCode, type AuthState, type ConnectWalletResponse, FreighterAdapter, type KycFlow, type KycLevel, type KycProvider, type KycStartBody, type KycStartResponse, type KycStatus, type NetworkState, type PaymentInstructions, type PollarApiClient, type PollarApplicationConfigContent, type PollarApplicationConfigResponse, PollarClient, type PollarClientConfig, PollarFlowError, type PollarLoginOptions, type RampDirection, type RampQuote, type RampTxStatus, type RampsOfframpBody, type RampsOfframpResponse, type RampsOnrampBody, type RampsOnrampResponse, type RampsQuoteQuery, type RampsQuoteResponse, type RampsTransactionResponse, type SignAuthEntryOptions, type SignAuthEntryResponse, type SignTransactionOptions, type SignTransactionResponse, type StellarBalance, StellarClient, type StellarClientConfig, type StellarNetwork, type TransactionState, type TxBuildBody, type TxBuildContent, type TxBuildResponse, type TxHistoryContent, type TxHistoryParams, type TxHistoryRecord, type TxHistoryState, type TxSignAndSendBody, type TxSignSendResponse, type WalletAdapter, type WalletBalanceContent, type WalletBalanceRecord, WalletType, createOffRamp, createOnRamp, getKycProviders, getKycStatus, getRampTransaction, getRampsQuote, isValidSession, pollKycStatus, pollRampTransaction, type paths as pollarPaths, resolveKyc, startKyc };
2757
+ export { AUTH_ERROR_CODES, AlbedoAdapter, type AuthErrorCode, type AuthState, type ConnectWalletResponse, FreighterAdapter, type KycFlow, type KycLevel, type KycProvider, type KycStartBody, type KycStartResponse, type KycStatus, type NetworkState, type PaymentInstructions, type PollarApiClient, type PollarApplicationConfigContent, type PollarApplicationConfigResponse, PollarClient, type PollarClientConfig, PollarFlowError, type PollarLoginOptions, type RampDirection, type RampQuote, type RampTxStatus, type RampsOfframpBody, type RampsOfframpResponse, type RampsOnrampBody, type RampsOnrampResponse, type RampsQuoteQuery, type RampsQuoteResponse, type RampsTransactionResponse, type SignAuthEntryOptions, type SignAuthEntryResponse, type SignTransactionOptions, type SignTransactionResponse, type StellarBalance, StellarClient, type StellarClientConfig, type StellarNetwork, type TransactionState, type TxBuildBody, type TxBuildContent, type TxBuildResponse, type TxHistoryContent, type TxHistoryParams, type TxHistoryRecord, type TxHistoryState, type TxSignAndSendBody, type TxSignSendResponse, type WalletAdapter, type WalletBalanceContent, type WalletBalanceRecord, type WalletBalanceState, WalletType, createOffRamp, createOnRamp, getKycProviders, getKycStatus, getRampTransaction, getRampsQuote, isValidSession, pollKycStatus, pollRampTransaction, type paths as pollarPaths, resolveKyc, startKyc };
package/dist/index.d.ts CHANGED
@@ -107,15 +107,18 @@ type TransactionState = {
107
107
  buildData: TxBuildContent;
108
108
  } | {
109
109
  step: 'signing';
110
- buildData: TxBuildContent;
110
+ buildData?: TxBuildContent;
111
+ external?: true;
111
112
  } | {
112
113
  step: 'success';
113
- buildData: TxBuildContent;
114
+ buildData?: TxBuildContent;
114
115
  hash: string;
116
+ external?: true;
115
117
  } | {
116
118
  step: 'error';
117
119
  details?: string;
118
120
  buildData?: TxBuildContent;
121
+ external?: true;
119
122
  };
120
123
  declare const AUTH_ERROR_CODES: {
121
124
  readonly SESSION_CREATE_FAILED: "SESSION_CREATE_FAILED";
@@ -183,6 +186,17 @@ declare class PollarFlowError extends Error {
183
186
  }
184
187
  type WalletBalanceContent = paths['/wallet/balance']['get']['responses'][200]['content']['application/json']['content'];
185
188
  type WalletBalanceRecord = WalletBalanceContent['balances'][number];
189
+ type WalletBalanceState = {
190
+ step: 'idle';
191
+ } | {
192
+ step: 'loading';
193
+ } | {
194
+ step: 'loaded';
195
+ data: WalletBalanceContent;
196
+ } | {
197
+ step: 'error';
198
+ message: string;
199
+ };
186
200
  type TxHistoryRecord = paths['/tx/history']['get']['responses'][200]['content']['application/json']['content']['records'][number];
187
201
  type TxHistoryParams = NonNullable<paths['/tx/history']['get']['parameters']['query']>;
188
202
  type TxHistoryContent = paths['/tx/history']['get']['responses'][200]['content']['application/json']['content'];
@@ -228,6 +242,8 @@ declare class PollarClient {
228
242
  private _transactionStateListeners;
229
243
  private _txHistoryState;
230
244
  private _txHistoryStateListeners;
245
+ private _walletBalanceState;
246
+ private _walletBalanceStateListeners;
231
247
  private _authState;
232
248
  private _authStateListeners;
233
249
  private _networkState;
@@ -250,12 +266,14 @@ declare class PollarClient {
250
266
  onNetworkStateChange(cb: (state: NetworkState) => void): () => void;
251
267
  getTransactionState(): TransactionState | null;
252
268
  onTransactionStateChange(cb: (state: TransactionState) => void): () => void;
253
- private _setTxHistoryState;
254
269
  getTxHistoryState(): TxHistoryState;
255
270
  onTxHistoryStateChange(cb: (state: TxHistoryState) => void): () => void;
256
271
  fetchTxHistory(params?: TxHistoryParams): Promise<void>;
257
- getWalletBalance(publicKey?: string): Promise<WalletBalanceContent | null>;
272
+ getWalletBalanceState(): WalletBalanceState;
273
+ onWalletBalanceStateChange(cb: (state: WalletBalanceState) => void): () => void;
274
+ refreshBalance(publicKey?: string): Promise<void>;
258
275
  buildTx(operation: TxBuildBody['operation'], params: TxBuildBody['params'], options?: TxBuildBody['options']): Promise<void>;
276
+ getWalletType(): WalletType | null;
259
277
  signAndSubmitTx(unsignedXdr: string): Promise<void>;
260
278
  getAppConfig(): Promise<unknown>;
261
279
  getKycStatus(providerId?: string): Promise<{
@@ -291,6 +309,8 @@ declare class PollarClient {
291
309
  intervalMs?: number;
292
310
  timeoutMs?: number;
293
311
  }): Promise<RampTxStatus>;
312
+ private _setTxHistoryState;
313
+ private _setWalletBalanceState;
294
314
  /** Creates a new AbortController, cancelling any existing flow first. */
295
315
  private _newController;
296
316
  /** Builds the deps object passed to flow functions via bind pattern. */
@@ -2076,6 +2096,8 @@ interface operations {
2076
2096
  balance: string;
2077
2097
  available: string;
2078
2098
  limit?: string;
2099
+ enabledInApp: boolean;
2100
+ trustlineRemoved: boolean;
2079
2101
  }[];
2080
2102
  };
2081
2103
  };
@@ -2732,4 +2754,4 @@ declare function pollRampTransaction(api: PollarApiClient, txId: string, { inter
2732
2754
  timeoutMs?: number;
2733
2755
  }): Promise<RampTxStatus>;
2734
2756
 
2735
- export { AUTH_ERROR_CODES, AlbedoAdapter, type AuthErrorCode, type AuthState, type ConnectWalletResponse, FreighterAdapter, type KycFlow, type KycLevel, type KycProvider, type KycStartBody, type KycStartResponse, type KycStatus, type NetworkState, type PaymentInstructions, type PollarApiClient, type PollarApplicationConfigContent, type PollarApplicationConfigResponse, PollarClient, type PollarClientConfig, PollarFlowError, type PollarLoginOptions, type RampDirection, type RampQuote, type RampTxStatus, type RampsOfframpBody, type RampsOfframpResponse, type RampsOnrampBody, type RampsOnrampResponse, type RampsQuoteQuery, type RampsQuoteResponse, type RampsTransactionResponse, type SignAuthEntryOptions, type SignAuthEntryResponse, type SignTransactionOptions, type SignTransactionResponse, type StellarBalance, StellarClient, type StellarClientConfig, type StellarNetwork, type TransactionState, type TxBuildBody, type TxBuildContent, type TxBuildResponse, type TxHistoryContent, type TxHistoryParams, type TxHistoryRecord, type TxHistoryState, type TxSignAndSendBody, type TxSignSendResponse, type WalletAdapter, type WalletBalanceContent, type WalletBalanceRecord, WalletType, createOffRamp, createOnRamp, getKycProviders, getKycStatus, getRampTransaction, getRampsQuote, isValidSession, pollKycStatus, pollRampTransaction, type paths as pollarPaths, resolveKyc, startKyc };
2757
+ export { AUTH_ERROR_CODES, AlbedoAdapter, type AuthErrorCode, type AuthState, type ConnectWalletResponse, FreighterAdapter, type KycFlow, type KycLevel, type KycProvider, type KycStartBody, type KycStartResponse, type KycStatus, type NetworkState, type PaymentInstructions, type PollarApiClient, type PollarApplicationConfigContent, type PollarApplicationConfigResponse, PollarClient, type PollarClientConfig, PollarFlowError, type PollarLoginOptions, type RampDirection, type RampQuote, type RampTxStatus, type RampsOfframpBody, type RampsOfframpResponse, type RampsOnrampBody, type RampsOnrampResponse, type RampsQuoteQuery, type RampsQuoteResponse, type RampsTransactionResponse, type SignAuthEntryOptions, type SignAuthEntryResponse, type SignTransactionOptions, type SignTransactionResponse, type StellarBalance, StellarClient, type StellarClientConfig, type StellarNetwork, type TransactionState, type TxBuildBody, type TxBuildContent, type TxBuildResponse, type TxHistoryContent, type TxHistoryParams, type TxHistoryRecord, type TxHistoryState, type TxSignAndSendBody, type TxSignSendResponse, type WalletAdapter, type WalletBalanceContent, type WalletBalanceRecord, type WalletBalanceState, WalletType, createOffRamp, createOnRamp, getKycProviders, getKycStatus, getRampTransaction, getRampsQuote, isValidSession, pollKycStatus, pollRampTransaction, type paths as pollarPaths, resolveKyc, startKyc };