@pollar/core 0.7.1 → 0.8.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/dist/index.d.mts CHANGED
@@ -75,6 +75,43 @@ interface KeyManager {
75
75
  sign(payload: Uint8Array): Promise<Uint8Array>;
76
76
  }
77
77
 
78
+ /**
79
+ * Pluggable "is the user looking at this app right now?" signal.
80
+ *
81
+ * Used by the silent-refresh scheduler so token renewals are skipped while
82
+ * the tab is hidden / the app is backgrounded — both saves network and
83
+ * works around aggressive `setTimeout` throttling that web browsers and RN
84
+ * apply to non-foreground contexts.
85
+ *
86
+ * Default web implementation listens to `visibilitychange` plus
87
+ * `pageshow`/`pagehide` (covers BFCache on iOS) and `focus`/`blur` (covers
88
+ * the cases where `visibilitychange` lags). Default for non-browser
89
+ * environments is a noop that always reports "visible".
90
+ *
91
+ * TODO(@pollar/react-native): when the dedicated RN package ships, it will
92
+ * export an `AppState`-backed provider. Until then, RN consumers can wire
93
+ * one inline:
94
+ *
95
+ * import { AppState } from 'react-native';
96
+ * const rnVisibility = {
97
+ * isVisible: () => AppState.currentState === 'active',
98
+ * onChange: (cb) => {
99
+ * const sub = AppState.addEventListener('change', (s) => cb(s === 'active'));
100
+ * return () => sub.remove();
101
+ * },
102
+ * };
103
+ * new PollarClient({ apiKey, visibilityProvider: rnVisibility });
104
+ */
105
+ interface VisibilityProvider {
106
+ isVisible(): boolean;
107
+ /**
108
+ * Subscribe to visibility transitions. The callback receives the new
109
+ * visibility state (`true` = visible). Returns an unsubscribe function
110
+ * that must detach every listener registered by this call.
111
+ */
112
+ onChange(cb: (visible: boolean) => void): () => void;
113
+ }
114
+
78
115
  declare enum WalletType {
79
116
  FREIGHTER = "freighter",
80
117
  ALBEDO = "albedo"
@@ -219,6 +256,14 @@ interface PollarClientConfig {
219
256
  * additional wallets without bundling those dependencies into `@pollar/core`.
220
257
  */
221
258
  walletAdapter?: WalletAdapterResolver;
259
+ /**
260
+ * Maximum time (ms) the SDK waits for a `walletAdapter` resolver to return.
261
+ * Guards against a broken extension bridge (e.g. Freighter content-script
262
+ * down) hanging the login flow forever. The resolver only constructs the
263
+ * adapter object — it does NOT include the user-facing approval step — so
264
+ * a few seconds is plenty. Defaults to 5000.
265
+ */
266
+ walletResolverTimeoutMs?: number;
222
267
  /**
223
268
  * Optional human-friendly label sent at /auth/login time and recorded on
224
269
  * the server-side refresh-token row so the user can identify it in the
@@ -226,6 +271,25 @@ interface PollarClientConfig {
226
271
  * If unset, the server-recorded `user_agent` header is the fallback.
227
272
  */
228
273
  deviceLabel?: string;
274
+ /**
275
+ * Foreground-detection signal for the silent-refresh scheduler. When the
276
+ * app is hidden / backgrounded, scheduled refreshes are skipped (saves
277
+ * network + sidesteps browser/RN background timer throttling); they run
278
+ * the moment visibility comes back. Defaults to a web provider in the
279
+ * browser (`visibilitychange` + BFCache + focus) and a noop elsewhere.
280
+ * React Native consumers should inject an `AppState`-backed provider —
281
+ * see TODO on `VisibilityProvider`.
282
+ */
283
+ visibilityProvider?: VisibilityProvider;
284
+ /**
285
+ * If set, the silent-refresh scheduler stops issuing proactive refreshes
286
+ * after this many milliseconds of no client-side HTTP activity. The
287
+ * session is not cleared — the next user action triggers a request that
288
+ * either reuses a still-valid access token or hits 401 → reactive
289
+ * refresh (transparent if the RT is still valid). Defaults to
290
+ * `undefined` = refresh forever as long as the app is visible.
291
+ */
292
+ maxIdleMs?: number;
229
293
  }
230
294
  /**
231
295
  * One row in the active-sessions list (returned by `PollarClient.listSessions()`).
@@ -245,6 +309,13 @@ type TxBuildBody = NonNullable<paths['/tx/build']['post']['requestBody']>['conte
245
309
  type TxBuildResponse = paths['/tx/build']['post']['responses'][200]['content']['application/json'];
246
310
  type TxSignAndSendBody = NonNullable<paths['/tx/sign-and-send']['post']['requestBody']>['content']['application/json'];
247
311
  type TxSignSendResponse = paths['/tx/sign-and-send']['post']['responses'][200]['content']['application/json'];
312
+ type TxSignBody = NonNullable<paths['/tx/sign']['post']['requestBody']>['content']['application/json'];
313
+ type TxSignResponse = paths['/tx/sign']['post']['responses'][200]['content']['application/json'];
314
+ type TxSignContent = TxSignResponse['content'];
315
+ type TxSubmitSignedBody = NonNullable<paths['/tx/submit']['post']['requestBody']>['content']['application/json'];
316
+ type TxBuildSignSubmitBody = NonNullable<paths['/tx/build-sign-submit']['post']['requestBody']>['content']['application/json'];
317
+ type TxBuildSignSubmitResponse = paths['/tx/build-sign-submit']['post']['responses'][200]['content']['application/json'];
318
+ type TxBuildSignSubmitContent = TxBuildSignSubmitResponse['content'];
248
319
  type PollarLoginOptions = {
249
320
  provider: 'google';
250
321
  } | {
@@ -257,6 +328,28 @@ type PollarLoginOptions = {
257
328
  type: WalletId;
258
329
  };
259
330
  type TxBuildContent = TxBuildResponse['content'];
331
+ /**
332
+ * Phases the SDK can be in across the build → sign → submit lifecycle.
333
+ *
334
+ * **Granular** steps (`building`, `signing`, `submitting`) are emitted when
335
+ * the SDK can directly observe that phase — i.e. when each is a separate
336
+ * client-driven call (`buildTx`, `signTx`, `submitTx`, external-wallet
337
+ * `signAndSubmitTx`).
338
+ *
339
+ * **Compound** steps (`signing-submitting`, `building-signing-submitting`)
340
+ * are emitted when multiple phases collapse into a single opaque backend
341
+ * round-trip (`signAndSubmitTx` custodial → `/tx/sign-and-send`, and `runTx`
342
+ * / `buildAndSignAndSubmitTx` custodial → `/tx/build-sign-submit`). The SDK
343
+ * can't see when one phase ends and the next begins inside that request, so
344
+ * it honestly reports a single fused state instead of fabricating
345
+ * transitions.
346
+ *
347
+ * **Terminal states** (`success`, `error`) and the post-Horizon-ack pending
348
+ * state (`submitted`) are shared across all paths.
349
+ *
350
+ * On `error`, the `phase` discriminator tells the consumer *where* the
351
+ * failure happened so modal UIs can offer "retry from this step" buttons.
352
+ */
260
353
  type TransactionState = {
261
354
  step: 'idle';
262
355
  } | {
@@ -267,17 +360,79 @@ type TransactionState = {
267
360
  } | {
268
361
  step: 'signing';
269
362
  buildData?: TxBuildContent;
270
- external?: true;
363
+ } | {
364
+ step: 'signed';
365
+ buildData?: TxBuildContent;
366
+ signedXdr: string;
367
+ submissionToken?: string;
368
+ } | {
369
+ step: 'submitting';
370
+ buildData?: TxBuildContent;
371
+ signedXdr?: string;
372
+ } | {
373
+ step: 'signing-submitting';
374
+ buildData?: TxBuildContent;
375
+ } | {
376
+ step: 'building-signing-submitting';
377
+ } | {
378
+ step: 'submitted';
379
+ buildData?: TxBuildContent;
380
+ hash: string;
271
381
  } | {
272
382
  step: 'success';
273
383
  buildData?: TxBuildContent;
274
384
  hash: string;
275
- external?: true;
276
385
  } | {
277
386
  step: 'error';
387
+ phase: TxErrorPhase;
278
388
  details?: string;
279
389
  buildData?: TxBuildContent;
280
- external?: true;
390
+ signedXdr?: string;
391
+ };
392
+ /**
393
+ * Identifies which phase failed when `TransactionState.step === 'error'`.
394
+ * Compound phase names (`signing-submitting`, `building-signing-submitting`)
395
+ * appear here when the failure happened inside an atomic backend call where
396
+ * the SDK can't isolate the failing sub-phase.
397
+ */
398
+ type TxErrorPhase = 'building' | 'signing' | 'submitting' | 'signing-submitting' | 'building-signing-submitting';
399
+ /**
400
+ * Per-call outcomes returned by `buildTx`, `signTx`, `submitTx`,
401
+ * `signAndSubmitTx`, and `buildAndSignAndSubmitTx`. These are additive to
402
+ * `TransactionState` — the same operations still drive the state machine for
403
+ * modal-style UIs, but headless callers can `await` the method and inspect
404
+ * the returned outcome directly instead of subscribing to state changes.
405
+ */
406
+ type BuildOutcome = {
407
+ status: 'built';
408
+ buildData: TxBuildContent;
409
+ } | {
410
+ status: 'error';
411
+ details?: string;
412
+ };
413
+ type SignOutcome = {
414
+ status: 'signed';
415
+ signedXdr: string;
416
+ submissionToken?: string;
417
+ expiresAt?: number;
418
+ } | {
419
+ status: 'error';
420
+ details?: string;
421
+ };
422
+ type SubmitOutcome = {
423
+ status: 'success';
424
+ hash: string;
425
+ buildData?: TxBuildContent;
426
+ } | {
427
+ status: 'pending';
428
+ hash: string;
429
+ buildData?: TxBuildContent;
430
+ } | {
431
+ status: 'error';
432
+ hash?: string;
433
+ details?: string;
434
+ resultCode?: string;
435
+ buildData?: TxBuildContent;
281
436
  };
282
437
  declare const AUTH_ERROR_CODES: {
283
438
  readonly SESSION_CREATE_FAILED: "SESSION_CREATE_FAILED";
@@ -288,6 +443,7 @@ declare const AUTH_ERROR_CODES: {
288
443
  readonly AUTH_FAILED: "AUTH_FAILED";
289
444
  readonly WALLET_CONNECT_FAILED: "WALLET_CONNECT_FAILED";
290
445
  readonly WALLET_AUTH_FAILED: "WALLET_AUTH_FAILED";
446
+ readonly WALLET_RESOLVER_TIMEOUT: "WALLET_RESOLVER_TIMEOUT";
291
447
  readonly UNEXPECTED_ERROR: "UNEXPECTED_ERROR";
292
448
  };
293
449
  type AuthErrorCode = (typeof AUTH_ERROR_CODES)[keyof typeof AUTH_ERROR_CODES];
@@ -451,6 +607,13 @@ declare class PollarClient {
451
607
  /** Optional UI label sent to the server at /auth/login so the sessions UI
452
608
  * can show a recognizable device name. Set via PollarClientConfig.deviceLabel. */
453
609
  private readonly _deviceLabel;
610
+ private readonly _visibilityProvider;
611
+ private readonly _maxIdleMs;
612
+ /** Updated by the request middleware. Read by the silent-refresh scheduler
613
+ * to skip proactive refreshes after `maxIdleMs` of no HTTP activity. */
614
+ private _lastRequestAt;
615
+ private _refreshTimer;
616
+ private _visibilityUnsubscribe;
454
617
  private _transactionState;
455
618
  private _transactionStateListeners;
456
619
  private _txHistoryState;
@@ -461,8 +624,18 @@ declare class PollarClient {
461
624
  private _authStateListeners;
462
625
  private _networkState;
463
626
  private _networkStateListeners;
627
+ /**
628
+ * Latched once the storage adapter degrades. We dedupe (the adapter only
629
+ * fires once anyway) and use it to replay state to late-subscribers — same
630
+ * pattern as `onAuthStateChange` replaying `_authState` on subscribe.
631
+ * Only populated when the SDK constructed the default storage adapter; if
632
+ * the consumer passes `config.storage`, they own degradation notifications.
633
+ */
634
+ private _storageDegraded;
635
+ private _storageDegradeListeners;
464
636
  private _walletAdapter;
465
637
  private readonly _walletAdapterResolver;
638
+ private readonly _walletResolverTimeoutMs;
466
639
  private _loginController;
467
640
  constructor(config: PollarClientConfig);
468
641
  /** Awaitable handle for the initial keypair + session restore. */
@@ -479,8 +652,54 @@ declare class PollarClient {
479
652
  */
480
653
  refresh(): Promise<void>;
481
654
  private _doRefresh;
655
+ /**
656
+ * Arm a single setTimeout to fire shortly before the current access token
657
+ * expires. Idempotent — clearing any previous timer first. Safe to call
658
+ * from any session-write site (initial login, restore-from-storage, after
659
+ * a successful rotation). No-op if there's no session in memory.
660
+ *
661
+ * Browser/RN background-tab throttling makes long-running setTimeouts
662
+ * unreliable on their own; the `visibilitychange` listener compensates by
663
+ * re-invoking `_maybeProactiveRefresh` whenever the app comes back to the
664
+ * foreground, catching any timer that fired late or never fired at all.
665
+ */
666
+ private _scheduleNextRefresh;
667
+ /**
668
+ * Decide whether to actually run a refresh right now. Called both from the
669
+ * scheduler timer and from the visibility-change listener.
670
+ *
671
+ * Skip if:
672
+ * - no session / no RT (nothing to refresh)
673
+ * - app is hidden — wait for the visibility listener to re-trigger us
674
+ * - `maxIdleMs` configured and no client request since that window — let
675
+ * the next reactive 401-refresh handle it whenever the user comes back
676
+ * - the AT still has more than `REFRESH_SKEW_SECONDS` of life — reschedule
677
+ *
678
+ * Otherwise call `refresh()`, which uses the existing in-flight singleton
679
+ * so we never collide with a reactive 401-triggered refresh. On failure,
680
+ * `_doRefresh` already calls `_clearSession`, so auth-state listeners see
681
+ * `step:'idle'` — no extra event dispatch needed here.
682
+ */
683
+ private _maybeProactiveRefresh;
684
+ private _clearRefreshTimer;
482
685
  getAuthState(): AuthState;
483
686
  onAuthStateChange(cb: (state: AuthState) => void): () => void;
687
+ /**
688
+ * Subscribe to persistent-storage degradation (Safari private mode,
689
+ * sandboxed iframes, quota errors, etc.). The SDK keeps running off
690
+ * in-memory storage after degrade, but sessions won't survive reload — a
691
+ * host UI typically wants to show "your session won't be saved" so the
692
+ * user isn't blindsided after a refresh.
693
+ *
694
+ * Fires at most once per client lifetime (the underlying adapter dedupes).
695
+ * Late subscribers receive the latched state synchronously on subscribe.
696
+ *
697
+ * Only fires when the SDK constructs the default storage adapter. If you
698
+ * pass a custom `config.storage`, wire your own notification path through
699
+ * that adapter's API — the SDK has no hook into it.
700
+ */
701
+ onStorageDegrade(cb: OnStorageDegrade): () => void;
702
+ private _dispatchStorageDegrade;
484
703
  /** PII (email, names, avatar, providers). Held in memory only — never persisted. */
485
704
  getUserProfile(): PollarUserProfile | null;
486
705
  login(options: PollarLoginOptions): void;
@@ -529,9 +748,81 @@ declare class PollarClient {
529
748
  getWalletBalanceState(): WalletBalanceState;
530
749
  onWalletBalanceStateChange(cb: (state: WalletBalanceState) => void): () => void;
531
750
  refreshBalance(publicKey?: string): Promise<void>;
532
- buildTx(operation: TxBuildBody['operation'], params: TxBuildBody['params'], options?: TxBuildBody['options']): Promise<void>;
751
+ /**
752
+ * Builds an unsigned XDR. Drives `_setTransactionState` for modal-style UIs
753
+ * AND returns a {@link BuildOutcome} so headless callers can `await` and
754
+ * inspect the result without subscribing to state changes.
755
+ */
756
+ buildTx(operation: TxBuildBody['operation'], params: TxBuildBody['params'], options?: TxBuildBody['options']): Promise<BuildOutcome>;
533
757
  getWalletType(): WalletId | null;
534
- signAndSubmitTx(unsignedXdr: string): Promise<void>;
758
+ /**
759
+ * Signs the given unsigned XDR and returns the signed XDR.
760
+ *
761
+ * - External wallets: signs locally via the wallet adapter.
762
+ * - Custodial wallets: posts to `/tx/sign`. The backend signs (through
763
+ * wallet-service or the app's customer-managed adapter) and returns the
764
+ * signed XDR plus an `idempotencyKey` the caller should echo back to
765
+ * `submitTx`.
766
+ *
767
+ * Drives `_setTransactionState`: emits `signing` while in flight and
768
+ * `signed` on success (or `error[phase: 'signing']` on failure). `buildData`
769
+ * is threaded through if the consumer previously called `buildTx`.
770
+ */
771
+ signTx(unsignedXdr: string): Promise<SignOutcome>;
772
+ /**
773
+ * Submits a signed XDR via `/tx/submit` regardless of wallet type
774
+ * (custodial or external). Routing through sdk-api gives us:
775
+ * - End-to-end tx_records persistence with full phase lifecycle so the
776
+ * developer dashboard can show every tx (both custodial and external
777
+ * wallet flows) at `/apps/:id/monitor/transactions`.
778
+ * - Idempotency tracking via `submissionToken` (returned by `signTx`).
779
+ * - A single response shape (SUCCESS / PENDING / FAILED) shared by both
780
+ * flows — previously external wallets could only return SUCCESS or
781
+ * error since the direct-to-Horizon path was synchronous.
782
+ *
783
+ * The extra hop adds ~50–150 ms vs. the legacy direct-Horizon path; the
784
+ * persistence + observability win is worth it.
785
+ *
786
+ * Drives `_setTransactionState`: emits `submitting` while in flight,
787
+ * `submitted` on Horizon ack (pending), `success` on ledger confirmation,
788
+ * or `error[phase: 'submitting']` on failure.
789
+ */
790
+ submitTx(signedXdr: string, opts?: {
791
+ submissionToken?: string;
792
+ }): Promise<SubmitOutcome>;
793
+ /**
794
+ * Signs and submits in one logical step. Returns a {@link SubmitOutcome}.
795
+ *
796
+ * - **External wallets**: composes `signTx` + `submitTx` client-side. State
797
+ * machine sees the full granular sequence `signing → signed → submitting
798
+ * → success` because the underlying methods each emit.
799
+ * - **Custodial wallets**: atomic `/tx/sign-and-send` round-trip. State
800
+ * machine emits the compound `signing-submitting` step (the SDK can't
801
+ * observe when one phase ends and the next begins inside that single
802
+ * backend call) and then transitions to `submitted` (Horizon ack only) or
803
+ * `success` (ledger-confirmed), or `error[phase: 'signing-submitting']`.
804
+ */
805
+ signAndSubmitTx(unsignedXdr: string): Promise<SubmitOutcome>;
806
+ /**
807
+ * One-shot: build → sign → submit, returning the final {@link SubmitOutcome}.
808
+ *
809
+ * - **External wallets**: composes `buildTx` + `signAndSubmitTx` client-side.
810
+ * State machine sees the full granular sequence (`building → built →
811
+ * signing → signed → submitting → success`) because each composed call
812
+ * emits its own transitions.
813
+ * - **Custodial wallets**: single round-trip to `/tx/build-sign-submit`. The
814
+ * signed XDR never leaves the backend. State machine emits the compound
815
+ * `building-signing-submitting` step (the SDK can't observe individual
816
+ * phase boundaries inside one atomic call) and then transitions to
817
+ * `submitted` / `success` / `error[phase: 'building-signing-submitting']`.
818
+ *
819
+ * If you need granular UI feedback for custodial flows (separate
820
+ * "Building…", "Signing…", "Submitting…" indicators), call `buildTx`,
821
+ * `signTx`, and `submitTx` separately instead.
822
+ */
823
+ buildAndSignAndSubmitTx(operation: TxBuildBody['operation'], params: TxBuildBody['params'], options?: TxBuildBody['options']): Promise<SubmitOutcome>;
824
+ /** Alias for {@link buildAndSignAndSubmitTx} — shorter "just do the thing" name. */
825
+ runTx(operation: TxBuildBody['operation'], params: TxBuildBody['params'], options?: TxBuildBody['options']): Promise<SubmitOutcome>;
535
826
  getAppConfig(): Promise<unknown>;
536
827
  getKycStatus(providerId?: string): Promise<{
537
828
  status: KycStatus;
@@ -587,6 +878,13 @@ declare class PollarClient {
587
878
  private _setNetworkState;
588
879
  private _setAuthState;
589
880
  private _setTransactionState;
881
+ /**
882
+ * Threads `buildData` through state transitions. When the user has already
883
+ * called `buildTx`, every subsequent state (signing, signed, submitting,
884
+ * submitted, success, error) should carry the build summary so modal UIs
885
+ * can keep showing "Send 5 USDC to G..." through the whole flow.
886
+ */
887
+ private _currentBuildData;
590
888
  }
591
889
 
592
890
  /**
@@ -1113,6 +1411,66 @@ interface paths {
1113
1411
  patch?: never;
1114
1412
  trace?: never;
1115
1413
  };
1414
+ "/tx/sign": {
1415
+ parameters: {
1416
+ query?: never;
1417
+ header?: never;
1418
+ path?: never;
1419
+ cookie?: never;
1420
+ };
1421
+ get?: never;
1422
+ put?: never;
1423
+ /**
1424
+ * Sign an unsigned XDR (split flow)
1425
+ * @description Sign-only step of the split build/sign/submit flow. For custodial wallets, the signed XDR is returned to the caller so it can be submitted later via POST /tx/submit. External wallets sign client-side and do not call this endpoint.
1426
+ */
1427
+ post: operations["postTxSign"];
1428
+ delete?: never;
1429
+ options?: never;
1430
+ head?: never;
1431
+ patch?: never;
1432
+ trace?: never;
1433
+ };
1434
+ "/tx/submit": {
1435
+ parameters: {
1436
+ query?: never;
1437
+ header?: never;
1438
+ path?: never;
1439
+ cookie?: never;
1440
+ };
1441
+ get?: never;
1442
+ put?: never;
1443
+ /**
1444
+ * Submit a pre-signed XDR
1445
+ * @description Submit step of the split build/sign/submit flow. Accepts a signed XDR produced by /tx/sign or by an external-wallet adapter. Goes through wallet-service /v1/tx/submit so the submission is policy-validated and idempotency-tracked.
1446
+ */
1447
+ post: operations["postTxSubmit"];
1448
+ delete?: never;
1449
+ options?: never;
1450
+ head?: never;
1451
+ patch?: never;
1452
+ trace?: never;
1453
+ };
1454
+ "/tx/build-sign-submit": {
1455
+ parameters: {
1456
+ query?: never;
1457
+ header?: never;
1458
+ path?: never;
1459
+ cookie?: never;
1460
+ };
1461
+ get?: never;
1462
+ put?: never;
1463
+ /**
1464
+ * Atomic build + sign + submit (one round-trip)
1465
+ * @description Server-side composition of /tx/build + /tx/sign + /tx/submit. The signed XDR never leaves the backend. Use for headless / server-driven flows that do not need intermediate state-machine transitions on the client.
1466
+ */
1467
+ post: operations["postTxBuildSignSubmit"];
1468
+ delete?: never;
1469
+ options?: never;
1470
+ head?: never;
1471
+ patch?: never;
1472
+ trace?: never;
1473
+ };
1116
1474
  "/tx/status": {
1117
1475
  parameters: {
1118
1476
  query?: never;
@@ -1153,6 +1511,46 @@ interface paths {
1153
1511
  patch?: never;
1154
1512
  trace?: never;
1155
1513
  };
1514
+ "/charges": {
1515
+ parameters: {
1516
+ query?: never;
1517
+ header?: never;
1518
+ path?: never;
1519
+ cookie?: never;
1520
+ };
1521
+ get?: never;
1522
+ put?: never;
1523
+ /**
1524
+ * Create a charge
1525
+ * @description Creates a Pollar Pay point-of-sale charge for one of the application branches. Reserves a pool wallet (the address the customer pays to) and returns the payment intent.
1526
+ */
1527
+ post: operations["postCharges"];
1528
+ delete?: never;
1529
+ options?: never;
1530
+ head?: never;
1531
+ patch?: never;
1532
+ trace?: never;
1533
+ };
1534
+ "/charges/{id}": {
1535
+ parameters: {
1536
+ query?: never;
1537
+ header?: never;
1538
+ path?: never;
1539
+ cookie?: never;
1540
+ };
1541
+ /**
1542
+ * Get charge status
1543
+ * @description Returns the live status of a charge. A pending charge past its window reads as expired.
1544
+ */
1545
+ get: operations["getChargesById"];
1546
+ put?: never;
1547
+ post?: never;
1548
+ delete?: never;
1549
+ options?: never;
1550
+ head?: never;
1551
+ patch?: never;
1552
+ trace?: never;
1553
+ };
1156
1554
  "/wallet/balance": {
1157
1555
  parameters: {
1158
1556
  query?: never;
@@ -1420,7 +1818,7 @@ interface operations {
1420
1818
  "application/json": {
1421
1819
  /** @constant */
1422
1820
  success: false;
1423
- error: string;
1821
+ code: string;
1424
1822
  };
1425
1823
  };
1426
1824
  };
@@ -1433,7 +1831,7 @@ interface operations {
1433
1831
  "application/json": {
1434
1832
  /** @constant */
1435
1833
  success: false;
1436
- error: string;
1834
+ code: string;
1437
1835
  };
1438
1836
  };
1439
1837
  };
@@ -1446,7 +1844,7 @@ interface operations {
1446
1844
  "application/json": {
1447
1845
  /** @constant */
1448
1846
  success: false;
1449
- error: string;
1847
+ code: string;
1450
1848
  };
1451
1849
  };
1452
1850
  };
@@ -1508,7 +1906,7 @@ interface operations {
1508
1906
  "application/json": {
1509
1907
  /** @constant */
1510
1908
  success: false;
1511
- error: string;
1909
+ code: string;
1512
1910
  };
1513
1911
  };
1514
1912
  };
@@ -1521,7 +1919,7 @@ interface operations {
1521
1919
  "application/json": {
1522
1920
  /** @constant */
1523
1921
  success: false;
1524
- error: string;
1922
+ code: string;
1525
1923
  };
1526
1924
  };
1527
1925
  };
@@ -1534,7 +1932,7 @@ interface operations {
1534
1932
  "application/json": {
1535
1933
  /** @constant */
1536
1934
  success: false;
1537
- error: string;
1935
+ code: string;
1538
1936
  };
1539
1937
  };
1540
1938
  };
@@ -1547,7 +1945,7 @@ interface operations {
1547
1945
  "application/json": {
1548
1946
  /** @constant */
1549
1947
  success: false;
1550
- error: string;
1948
+ code: string;
1551
1949
  };
1552
1950
  };
1553
1951
  };
@@ -1582,7 +1980,7 @@ interface operations {
1582
1980
  "application/json": {
1583
1981
  /** @constant */
1584
1982
  success: false;
1585
- error: string;
1983
+ code: string;
1586
1984
  };
1587
1985
  };
1588
1986
  };
@@ -1595,7 +1993,7 @@ interface operations {
1595
1993
  "application/json": {
1596
1994
  /** @constant */
1597
1995
  success: false;
1598
- error: string;
1996
+ code: string;
1599
1997
  };
1600
1998
  };
1601
1999
  };
@@ -1608,7 +2006,7 @@ interface operations {
1608
2006
  "application/json": {
1609
2007
  /** @constant */
1610
2008
  success: false;
1611
- error: string;
2009
+ code: string;
1612
2010
  };
1613
2011
  };
1614
2012
  };
@@ -1621,7 +2019,7 @@ interface operations {
1621
2019
  "application/json": {
1622
2020
  /** @constant */
1623
2021
  success: false;
1624
- error: string;
2022
+ code: string;
1625
2023
  };
1626
2024
  };
1627
2025
  };
@@ -1655,7 +2053,7 @@ interface operations {
1655
2053
  "application/json": {
1656
2054
  /** @constant */
1657
2055
  success: false;
1658
- error: string;
2056
+ code: string;
1659
2057
  };
1660
2058
  };
1661
2059
  };
@@ -1668,7 +2066,7 @@ interface operations {
1668
2066
  "application/json": {
1669
2067
  /** @constant */
1670
2068
  success: false;
1671
- error: string;
2069
+ code: string;
1672
2070
  };
1673
2071
  };
1674
2072
  };
@@ -1681,7 +2079,7 @@ interface operations {
1681
2079
  "application/json": {
1682
2080
  /** @constant */
1683
2081
  success: false;
1684
- error: string;
2082
+ code: string;
1685
2083
  };
1686
2084
  };
1687
2085
  };
@@ -1731,7 +2129,7 @@ interface operations {
1731
2129
  "application/json": {
1732
2130
  /** @constant */
1733
2131
  success: false;
1734
- error: string;
2132
+ code: string;
1735
2133
  };
1736
2134
  };
1737
2135
  };
@@ -1744,7 +2142,7 @@ interface operations {
1744
2142
  "application/json": {
1745
2143
  /** @constant */
1746
2144
  success: false;
1747
- error: string;
2145
+ code: string;
1748
2146
  };
1749
2147
  };
1750
2148
  };
@@ -1757,7 +2155,7 @@ interface operations {
1757
2155
  "application/json": {
1758
2156
  /** @constant */
1759
2157
  success: false;
1760
- error: string;
2158
+ code: string;
1761
2159
  };
1762
2160
  };
1763
2161
  };
@@ -1770,7 +2168,7 @@ interface operations {
1770
2168
  "application/json": {
1771
2169
  /** @constant */
1772
2170
  success: false;
1773
- error: string;
2171
+ code: string;
1774
2172
  };
1775
2173
  };
1776
2174
  };
@@ -1818,7 +2216,7 @@ interface operations {
1818
2216
  "application/json": {
1819
2217
  /** @constant */
1820
2218
  success: false;
1821
- error: string;
2219
+ code: string;
1822
2220
  };
1823
2221
  };
1824
2222
  };
@@ -1831,7 +2229,7 @@ interface operations {
1831
2229
  "application/json": {
1832
2230
  /** @constant */
1833
2231
  success: false;
1834
- error: string;
2232
+ code: string;
1835
2233
  };
1836
2234
  };
1837
2235
  };
@@ -1844,7 +2242,7 @@ interface operations {
1844
2242
  "application/json": {
1845
2243
  /** @constant */
1846
2244
  success: false;
1847
- error: string;
2245
+ code: string;
1848
2246
  };
1849
2247
  };
1850
2248
  };
@@ -1857,7 +2255,7 @@ interface operations {
1857
2255
  "application/json": {
1858
2256
  /** @constant */
1859
2257
  success: false;
1860
- error: string;
2258
+ code: string;
1861
2259
  };
1862
2260
  };
1863
2261
  };
@@ -1906,7 +2304,7 @@ interface operations {
1906
2304
  "application/json": {
1907
2305
  /** @constant */
1908
2306
  success: false;
1909
- error: string;
2307
+ code: string;
1910
2308
  };
1911
2309
  };
1912
2310
  };
@@ -1919,7 +2317,7 @@ interface operations {
1919
2317
  "application/json": {
1920
2318
  /** @constant */
1921
2319
  success: false;
1922
- error: string;
2320
+ code: string;
1923
2321
  };
1924
2322
  };
1925
2323
  };
@@ -1932,7 +2330,7 @@ interface operations {
1932
2330
  "application/json": {
1933
2331
  /** @constant */
1934
2332
  success: false;
1935
- error: string;
2333
+ code: string;
1936
2334
  };
1937
2335
  };
1938
2336
  };
@@ -1945,7 +2343,7 @@ interface operations {
1945
2343
  "application/json": {
1946
2344
  /** @constant */
1947
2345
  success: false;
1948
- error: string;
2346
+ code: string;
1949
2347
  };
1950
2348
  };
1951
2349
  };
@@ -2037,7 +2435,7 @@ interface operations {
2037
2435
  "application/json": {
2038
2436
  /** @constant */
2039
2437
  success: false;
2040
- error: string;
2438
+ code: string;
2041
2439
  };
2042
2440
  };
2043
2441
  };
@@ -2050,7 +2448,7 @@ interface operations {
2050
2448
  "application/json": {
2051
2449
  /** @constant */
2052
2450
  success: false;
2053
- error: string;
2451
+ code: string;
2054
2452
  };
2055
2453
  };
2056
2454
  };
@@ -2063,7 +2461,7 @@ interface operations {
2063
2461
  "application/json": {
2064
2462
  /** @constant */
2065
2463
  success: false;
2066
- error: string;
2464
+ code: string;
2067
2465
  };
2068
2466
  };
2069
2467
  };
@@ -2076,7 +2474,7 @@ interface operations {
2076
2474
  "application/json": {
2077
2475
  /** @constant */
2078
2476
  success: false;
2079
- error: string;
2477
+ code: string;
2080
2478
  };
2081
2479
  };
2082
2480
  };
@@ -2127,7 +2525,7 @@ interface operations {
2127
2525
  "application/json": {
2128
2526
  /** @constant */
2129
2527
  success: false;
2130
- error: string;
2528
+ code: string;
2131
2529
  };
2132
2530
  };
2133
2531
  };
@@ -2140,7 +2538,7 @@ interface operations {
2140
2538
  "application/json": {
2141
2539
  /** @constant */
2142
2540
  success: false;
2143
- error: string;
2541
+ code: string;
2144
2542
  };
2145
2543
  };
2146
2544
  };
@@ -2153,7 +2551,7 @@ interface operations {
2153
2551
  "application/json": {
2154
2552
  /** @constant */
2155
2553
  success: false;
2156
- error: string;
2554
+ code: string;
2157
2555
  };
2158
2556
  };
2159
2557
  };
@@ -2166,7 +2564,7 @@ interface operations {
2166
2564
  "application/json": {
2167
2565
  /** @constant */
2168
2566
  success: false;
2169
- error: string;
2567
+ code: string;
2170
2568
  };
2171
2569
  };
2172
2570
  };
@@ -2213,7 +2611,7 @@ interface operations {
2213
2611
  "application/json": {
2214
2612
  /** @constant */
2215
2613
  success: false;
2216
- error: string;
2614
+ code: string;
2217
2615
  };
2218
2616
  };
2219
2617
  };
@@ -2263,7 +2661,7 @@ interface operations {
2263
2661
  "application/json": {
2264
2662
  /** @constant */
2265
2663
  success: false;
2266
- error: string;
2664
+ code: string;
2267
2665
  };
2268
2666
  };
2269
2667
  };
@@ -2306,7 +2704,7 @@ interface operations {
2306
2704
  "application/json": {
2307
2705
  /** @constant */
2308
2706
  success: false;
2309
- error: string;
2707
+ code: string;
2310
2708
  };
2311
2709
  };
2312
2710
  };
@@ -2319,7 +2717,7 @@ interface operations {
2319
2717
  "application/json": {
2320
2718
  /** @constant */
2321
2719
  success: false;
2322
- error: string;
2720
+ code: string;
2323
2721
  };
2324
2722
  };
2325
2723
  };
@@ -2376,7 +2774,7 @@ interface operations {
2376
2774
  "application/json": {
2377
2775
  /** @constant */
2378
2776
  success: false;
2379
- error: string;
2777
+ code: string;
2380
2778
  };
2381
2779
  };
2382
2780
  };
@@ -2389,7 +2787,7 @@ interface operations {
2389
2787
  "application/json": {
2390
2788
  /** @constant */
2391
2789
  success: false;
2392
- error: string;
2790
+ code: string;
2393
2791
  };
2394
2792
  };
2395
2793
  };
@@ -2402,7 +2800,7 @@ interface operations {
2402
2800
  "application/json": {
2403
2801
  /** @constant */
2404
2802
  success: false;
2405
- error: string;
2803
+ code: string;
2406
2804
  };
2407
2805
  };
2408
2806
  };
@@ -2437,7 +2835,7 @@ interface operations {
2437
2835
  "application/json": {
2438
2836
  /** @constant */
2439
2837
  success: false;
2440
- error: string;
2838
+ code: string;
2441
2839
  };
2442
2840
  };
2443
2841
  };
@@ -2688,7 +3086,7 @@ interface operations {
2688
3086
  "application/json": {
2689
3087
  /** @constant */
2690
3088
  success: false;
2691
- error: string;
3089
+ code: string;
2692
3090
  };
2693
3091
  };
2694
3092
  };
@@ -2701,7 +3099,7 @@ interface operations {
2701
3099
  "application/json": {
2702
3100
  /** @constant */
2703
3101
  success: false;
2704
- error: string;
3102
+ code: string;
2705
3103
  };
2706
3104
  };
2707
3105
  };
@@ -2714,7 +3112,7 @@ interface operations {
2714
3112
  "application/json": {
2715
3113
  /** @constant */
2716
3114
  success: false;
2717
- error: string;
3115
+ code: string;
2718
3116
  };
2719
3117
  };
2720
3118
  };
@@ -2768,7 +3166,7 @@ interface operations {
2768
3166
  "application/json": {
2769
3167
  /** @constant */
2770
3168
  success: false;
2771
- error: string;
3169
+ code: string;
2772
3170
  };
2773
3171
  };
2774
3172
  };
@@ -2781,25 +3179,58 @@ interface operations {
2781
3179
  "application/json": {
2782
3180
  /** @constant */
2783
3181
  success: false;
2784
- error: string;
3182
+ code: string;
3183
+ };
3184
+ };
3185
+ };
3186
+ /** @description Forbidden */
3187
+ 403: {
3188
+ headers: {
3189
+ [name: string]: unknown;
3190
+ };
3191
+ content: {
3192
+ "application/json": {
3193
+ /** @constant */
3194
+ success: false;
3195
+ code: string;
3196
+ };
3197
+ };
3198
+ };
3199
+ /** @description Signing or submission error (upstream/RPC) */
3200
+ 502: {
3201
+ headers: {
3202
+ [name: string]: unknown;
3203
+ };
3204
+ content: {
3205
+ "application/json": {
3206
+ /** @constant */
3207
+ success: false;
3208
+ code: string;
2785
3209
  };
2786
3210
  };
2787
3211
  };
2788
3212
  };
2789
3213
  };
2790
- getTxStatus: {
3214
+ postTxSign: {
2791
3215
  parameters: {
2792
- query: {
2793
- network: "testnet" | "mainnet";
2794
- hash: string;
2795
- };
3216
+ query?: never;
2796
3217
  header?: never;
2797
3218
  path?: never;
2798
3219
  cookie?: never;
2799
3220
  };
2800
- requestBody?: never;
3221
+ requestBody: {
3222
+ content: {
3223
+ "application/json": {
3224
+ /** @enum {string} */
3225
+ network: "testnet" | "mainnet";
3226
+ publicKey: string;
3227
+ unsignedXdr: string;
3228
+ idempotencyKey?: string;
3229
+ };
3230
+ };
3231
+ };
2801
3232
  responses: {
2802
- /** @description Transaction status (PENDING si no existe aún en Horizon) */
3233
+ /** @description Signed XDR + idempotency key to use with /tx/submit */
2803
3234
  200: {
2804
3235
  headers: {
2805
3236
  [name: string]: unknown;
@@ -2807,16 +3238,12 @@ interface operations {
2807
3238
  content: {
2808
3239
  "application/json": {
2809
3240
  /** @constant */
2810
- code: "SDK_TX_STATUS";
3241
+ code: "SDK_TX_SIGNED";
2811
3242
  /** @constant */
2812
3243
  success: true;
2813
3244
  content: {
2814
- hash: string;
2815
- /** @enum {string} */
2816
- status: "PENDING" | "SUCCESS" | "FAILED";
2817
- resultCode?: string;
2818
- ledger?: number;
2819
- message?: string;
3245
+ signedXdr: string;
3246
+ idempotencyKey: string;
2820
3247
  };
2821
3248
  };
2822
3249
  };
@@ -2830,7 +3257,7 @@ interface operations {
2830
3257
  "application/json": {
2831
3258
  /** @constant */
2832
3259
  success: false;
2833
- error: string;
3260
+ code: string;
2834
3261
  };
2835
3262
  };
2836
3263
  };
@@ -2843,26 +3270,58 @@ interface operations {
2843
3270
  "application/json": {
2844
3271
  /** @constant */
2845
3272
  success: false;
2846
- error: string;
3273
+ code: string;
3274
+ };
3275
+ };
3276
+ };
3277
+ /** @description Forbidden */
3278
+ 403: {
3279
+ headers: {
3280
+ [name: string]: unknown;
3281
+ };
3282
+ content: {
3283
+ "application/json": {
3284
+ /** @constant */
3285
+ success: false;
3286
+ code: string;
3287
+ };
3288
+ };
3289
+ };
3290
+ /** @description Signing error */
3291
+ 502: {
3292
+ headers: {
3293
+ [name: string]: unknown;
3294
+ };
3295
+ content: {
3296
+ "application/json": {
3297
+ /** @constant */
3298
+ success: false;
3299
+ code: string;
2847
3300
  };
2848
3301
  };
2849
3302
  };
2850
3303
  };
2851
3304
  };
2852
- getTxHistory: {
3305
+ postTxSubmit: {
2853
3306
  parameters: {
2854
- query?: {
2855
- network?: "testnet" | "mainnet";
2856
- limit?: number;
2857
- offset?: number;
2858
- };
3307
+ query?: never;
2859
3308
  header?: never;
2860
3309
  path?: never;
2861
3310
  cookie?: never;
2862
3311
  };
2863
- requestBody?: never;
3312
+ requestBody: {
3313
+ content: {
3314
+ "application/json": {
3315
+ /** @enum {string} */
3316
+ network: "testnet" | "mainnet";
3317
+ publicKey: string;
3318
+ signedXdr: string;
3319
+ idempotencyKey?: string;
3320
+ };
3321
+ };
3322
+ };
2864
3323
  responses: {
2865
- /** @description Paginated list of transactions */
3324
+ /** @description Submit result (PENDING | SUCCESS | FAILED) */
2866
3325
  200: {
2867
3326
  headers: {
2868
3327
  [name: string]: unknown;
@@ -2870,7 +3329,426 @@ interface operations {
2870
3329
  content: {
2871
3330
  "application/json": {
2872
3331
  /** @constant */
2873
- code: "SDK_TX_HISTORY";
3332
+ code: "SDK_TX_SUBMIT";
3333
+ /** @constant */
3334
+ success: true;
3335
+ content: {
3336
+ hash: string;
3337
+ /** @enum {string} */
3338
+ status: "PENDING" | "SUCCESS" | "FAILED";
3339
+ resultCode?: string;
3340
+ message?: string;
3341
+ };
3342
+ };
3343
+ };
3344
+ };
3345
+ /** @description Validation error */
3346
+ 400: {
3347
+ headers: {
3348
+ [name: string]: unknown;
3349
+ };
3350
+ content: {
3351
+ "application/json": {
3352
+ /** @constant */
3353
+ success: false;
3354
+ code: string;
3355
+ };
3356
+ };
3357
+ };
3358
+ /** @description Unauthorized */
3359
+ 401: {
3360
+ headers: {
3361
+ [name: string]: unknown;
3362
+ };
3363
+ content: {
3364
+ "application/json": {
3365
+ /** @constant */
3366
+ success: false;
3367
+ code: string;
3368
+ };
3369
+ };
3370
+ };
3371
+ /** @description Submission error (RPC/network) */
3372
+ 502: {
3373
+ headers: {
3374
+ [name: string]: unknown;
3375
+ };
3376
+ content: {
3377
+ "application/json": {
3378
+ /** @constant */
3379
+ success: false;
3380
+ code: string;
3381
+ };
3382
+ };
3383
+ };
3384
+ };
3385
+ };
3386
+ postTxBuildSignSubmit: {
3387
+ parameters: {
3388
+ query?: never;
3389
+ header?: never;
3390
+ path?: never;
3391
+ cookie?: never;
3392
+ };
3393
+ requestBody: {
3394
+ content: {
3395
+ "application/json": {
3396
+ /** @enum {string} */
3397
+ network: "testnet" | "mainnet";
3398
+ publicKey: string;
3399
+ options?: {
3400
+ timeoutSec?: number;
3401
+ memo?: {
3402
+ /** @constant */
3403
+ type: "text";
3404
+ value: string;
3405
+ } | {
3406
+ /** @constant */
3407
+ type: "id";
3408
+ value: string;
3409
+ };
3410
+ maxFeeStroops?: number;
3411
+ };
3412
+ } & ({
3413
+ /** @constant */
3414
+ operation: "payment";
3415
+ params: {
3416
+ destination: string;
3417
+ amount: string;
3418
+ asset: {
3419
+ /** @constant */
3420
+ type: "native";
3421
+ } | {
3422
+ /** @constant */
3423
+ type: "credit_alphanum4";
3424
+ code: string;
3425
+ issuer: string;
3426
+ } | {
3427
+ /** @constant */
3428
+ type: "credit_alphanum12";
3429
+ code: string;
3430
+ issuer: string;
3431
+ };
3432
+ };
3433
+ } | {
3434
+ /** @constant */
3435
+ operation: "change_trust";
3436
+ params: {
3437
+ asset: {
3438
+ /** @constant */
3439
+ type: "credit_alphanum4";
3440
+ code: string;
3441
+ issuer: string;
3442
+ } | {
3443
+ /** @constant */
3444
+ type: "credit_alphanum12";
3445
+ code: string;
3446
+ issuer: string;
3447
+ } | {
3448
+ /** @constant */
3449
+ type: "liquidity_pool_shares";
3450
+ assetA: {
3451
+ /** @constant */
3452
+ type: "native";
3453
+ } | {
3454
+ /** @constant */
3455
+ type: "credit_alphanum4";
3456
+ code: string;
3457
+ issuer: string;
3458
+ } | {
3459
+ /** @constant */
3460
+ type: "credit_alphanum12";
3461
+ code: string;
3462
+ issuer: string;
3463
+ };
3464
+ assetB: {
3465
+ /** @constant */
3466
+ type: "native";
3467
+ } | {
3468
+ /** @constant */
3469
+ type: "credit_alphanum4";
3470
+ code: string;
3471
+ issuer: string;
3472
+ } | {
3473
+ /** @constant */
3474
+ type: "credit_alphanum12";
3475
+ code: string;
3476
+ issuer: string;
3477
+ };
3478
+ };
3479
+ limit?: string;
3480
+ };
3481
+ } | {
3482
+ /** @constant */
3483
+ operation: "path_payment_strict_send";
3484
+ params: {
3485
+ destination: string;
3486
+ sendAsset: {
3487
+ /** @constant */
3488
+ type: "native";
3489
+ } | {
3490
+ /** @constant */
3491
+ type: "credit_alphanum4";
3492
+ code: string;
3493
+ issuer: string;
3494
+ } | {
3495
+ /** @constant */
3496
+ type: "credit_alphanum12";
3497
+ code: string;
3498
+ issuer: string;
3499
+ };
3500
+ sendAmount: string;
3501
+ destAsset: {
3502
+ /** @constant */
3503
+ type: "native";
3504
+ } | {
3505
+ /** @constant */
3506
+ type: "credit_alphanum4";
3507
+ code: string;
3508
+ issuer: string;
3509
+ } | {
3510
+ /** @constant */
3511
+ type: "credit_alphanum12";
3512
+ code: string;
3513
+ issuer: string;
3514
+ };
3515
+ destMin: string;
3516
+ /** @default [] */
3517
+ path?: ({
3518
+ /** @constant */
3519
+ type: "native";
3520
+ } | {
3521
+ /** @constant */
3522
+ type: "credit_alphanum4";
3523
+ code: string;
3524
+ issuer: string;
3525
+ } | {
3526
+ /** @constant */
3527
+ type: "credit_alphanum12";
3528
+ code: string;
3529
+ issuer: string;
3530
+ })[];
3531
+ };
3532
+ } | {
3533
+ /** @constant */
3534
+ operation: "create_account";
3535
+ params: {
3536
+ destination: string;
3537
+ startingBalance: string;
3538
+ };
3539
+ } | {
3540
+ /** @constant */
3541
+ operation: "invoke_contract";
3542
+ params: {
3543
+ contractId: string;
3544
+ method: string;
3545
+ /** @default [] */
3546
+ args?: ({
3547
+ /** @constant */
3548
+ type: "bool";
3549
+ value: boolean;
3550
+ } | {
3551
+ /** @constant */
3552
+ type: "i32";
3553
+ value: number;
3554
+ } | {
3555
+ /** @constant */
3556
+ type: "u32";
3557
+ value: number;
3558
+ } | {
3559
+ /** @enum {string} */
3560
+ type: "i64" | "u64" | "i128" | "u128" | "i256" | "u256";
3561
+ value: string;
3562
+ } | {
3563
+ /** @constant */
3564
+ type: "address";
3565
+ value: string;
3566
+ } | {
3567
+ /** @enum {string} */
3568
+ type: "string" | "symbol";
3569
+ value: string;
3570
+ } | {
3571
+ /** @constant */
3572
+ type: "bytes";
3573
+ /** @description Base64-encoded bytes */
3574
+ value: string;
3575
+ } | {
3576
+ /** @constant */
3577
+ type: "vec";
3578
+ /** @description Array of ScValArg items */
3579
+ value: unknown[];
3580
+ } | {
3581
+ /** @constant */
3582
+ type: "map";
3583
+ /** @description Array of {key, val} ScValArg pairs */
3584
+ value: {
3585
+ key: unknown;
3586
+ val: unknown;
3587
+ }[];
3588
+ } | {
3589
+ /** @constant */
3590
+ type: "void";
3591
+ })[];
3592
+ };
3593
+ }) & {
3594
+ idempotencyKey?: string;
3595
+ };
3596
+ };
3597
+ };
3598
+ responses: {
3599
+ /** @description Final submit result with the original build summary */
3600
+ 200: {
3601
+ headers: {
3602
+ [name: string]: unknown;
3603
+ };
3604
+ content: {
3605
+ "application/json": {
3606
+ /** @constant */
3607
+ code: "SDK_TX_SUBMIT";
3608
+ /** @constant */
3609
+ success: true;
3610
+ content: {
3611
+ hash: string;
3612
+ /** @enum {string} */
3613
+ status: "PENDING" | "SUCCESS" | "FAILED";
3614
+ resultCode?: string;
3615
+ message?: string;
3616
+ summary: {
3617
+ title: string;
3618
+ lines: string[];
3619
+ network: string;
3620
+ fee: string;
3621
+ };
3622
+ estimatedFee: string;
3623
+ };
3624
+ };
3625
+ };
3626
+ };
3627
+ /** @description Validation error */
3628
+ 400: {
3629
+ headers: {
3630
+ [name: string]: unknown;
3631
+ };
3632
+ content: {
3633
+ "application/json": {
3634
+ /** @constant */
3635
+ success: false;
3636
+ code: string;
3637
+ };
3638
+ };
3639
+ };
3640
+ /** @description Unauthorized */
3641
+ 401: {
3642
+ headers: {
3643
+ [name: string]: unknown;
3644
+ };
3645
+ content: {
3646
+ "application/json": {
3647
+ /** @constant */
3648
+ success: false;
3649
+ code: string;
3650
+ };
3651
+ };
3652
+ };
3653
+ /** @description Build/sign/submit error */
3654
+ 502: {
3655
+ headers: {
3656
+ [name: string]: unknown;
3657
+ };
3658
+ content: {
3659
+ "application/json": {
3660
+ /** @constant */
3661
+ success: false;
3662
+ code: string;
3663
+ };
3664
+ };
3665
+ };
3666
+ };
3667
+ };
3668
+ getTxStatus: {
3669
+ parameters: {
3670
+ query: {
3671
+ network: "testnet" | "mainnet";
3672
+ hash: string;
3673
+ };
3674
+ header?: never;
3675
+ path?: never;
3676
+ cookie?: never;
3677
+ };
3678
+ requestBody?: never;
3679
+ responses: {
3680
+ /** @description Transaction status (PENDING si no existe aún en Horizon) */
3681
+ 200: {
3682
+ headers: {
3683
+ [name: string]: unknown;
3684
+ };
3685
+ content: {
3686
+ "application/json": {
3687
+ /** @constant */
3688
+ code: "SDK_TX_STATUS";
3689
+ /** @constant */
3690
+ success: true;
3691
+ content: {
3692
+ hash: string;
3693
+ /** @enum {string} */
3694
+ status: "PENDING" | "SUCCESS" | "FAILED";
3695
+ resultCode?: string;
3696
+ ledger?: number;
3697
+ message?: string;
3698
+ };
3699
+ };
3700
+ };
3701
+ };
3702
+ /** @description Validation error */
3703
+ 400: {
3704
+ headers: {
3705
+ [name: string]: unknown;
3706
+ };
3707
+ content: {
3708
+ "application/json": {
3709
+ /** @constant */
3710
+ success: false;
3711
+ code: string;
3712
+ };
3713
+ };
3714
+ };
3715
+ /** @description Unauthorized */
3716
+ 401: {
3717
+ headers: {
3718
+ [name: string]: unknown;
3719
+ };
3720
+ content: {
3721
+ "application/json": {
3722
+ /** @constant */
3723
+ success: false;
3724
+ code: string;
3725
+ };
3726
+ };
3727
+ };
3728
+ };
3729
+ };
3730
+ getTxHistory: {
3731
+ parameters: {
3732
+ query?: {
3733
+ network?: "testnet" | "mainnet";
3734
+ limit?: number;
3735
+ offset?: number;
3736
+ };
3737
+ header?: never;
3738
+ path?: never;
3739
+ cookie?: never;
3740
+ };
3741
+ requestBody?: never;
3742
+ responses: {
3743
+ /** @description Paginated list of transactions */
3744
+ 200: {
3745
+ headers: {
3746
+ [name: string]: unknown;
3747
+ };
3748
+ content: {
3749
+ "application/json": {
3750
+ /** @constant */
3751
+ code: "SDK_TX_HISTORY";
2874
3752
  /** @constant */
2875
3753
  success: true;
2876
3754
  content: {
@@ -2906,7 +3784,171 @@ interface operations {
2906
3784
  "application/json": {
2907
3785
  /** @constant */
2908
3786
  success: false;
2909
- error: string;
3787
+ code: string;
3788
+ };
3789
+ };
3790
+ };
3791
+ /** @description Unauthorized */
3792
+ 401: {
3793
+ headers: {
3794
+ [name: string]: unknown;
3795
+ };
3796
+ content: {
3797
+ "application/json": {
3798
+ /** @constant */
3799
+ success: false;
3800
+ code: string;
3801
+ };
3802
+ };
3803
+ };
3804
+ };
3805
+ };
3806
+ postCharges: {
3807
+ parameters: {
3808
+ query?: never;
3809
+ header?: never;
3810
+ path?: never;
3811
+ cookie?: never;
3812
+ };
3813
+ requestBody?: never;
3814
+ responses: {
3815
+ /** @description Charge created */
3816
+ 201: {
3817
+ headers: {
3818
+ [name: string]: unknown;
3819
+ };
3820
+ content: {
3821
+ "application/json": {
3822
+ /** @constant */
3823
+ code: "SDK_CHARGE_CREATED";
3824
+ /** @constant */
3825
+ success: true;
3826
+ content: {
3827
+ chargeId: string;
3828
+ walletAddress: string;
3829
+ reason: string;
3830
+ amount: string;
3831
+ asset: string;
3832
+ network: string;
3833
+ expiresAt: string;
3834
+ timeRemainingSeconds: number;
3835
+ };
3836
+ };
3837
+ };
3838
+ };
3839
+ /** @description Validation error */
3840
+ 400: {
3841
+ headers: {
3842
+ [name: string]: unknown;
3843
+ };
3844
+ content: {
3845
+ "application/json": {
3846
+ /** @constant */
3847
+ success: false;
3848
+ code: string;
3849
+ };
3850
+ };
3851
+ };
3852
+ /** @description Unauthorized */
3853
+ 401: {
3854
+ headers: {
3855
+ [name: string]: unknown;
3856
+ };
3857
+ content: {
3858
+ "application/json": {
3859
+ /** @constant */
3860
+ success: false;
3861
+ code: string;
3862
+ };
3863
+ };
3864
+ };
3865
+ /** @description Forbidden */
3866
+ 403: {
3867
+ headers: {
3868
+ [name: string]: unknown;
3869
+ };
3870
+ content: {
3871
+ "application/json": {
3872
+ /** @constant */
3873
+ success: false;
3874
+ code: string;
3875
+ };
3876
+ };
3877
+ };
3878
+ /** @description Not found */
3879
+ 404: {
3880
+ headers: {
3881
+ [name: string]: unknown;
3882
+ };
3883
+ content: {
3884
+ "application/json": {
3885
+ /** @constant */
3886
+ success: false;
3887
+ code: string;
3888
+ };
3889
+ };
3890
+ };
3891
+ /** @description No pool wallet available */
3892
+ 503: {
3893
+ headers: {
3894
+ [name: string]: unknown;
3895
+ };
3896
+ content: {
3897
+ "application/json": {
3898
+ chargeId: string;
3899
+ walletAddress: string;
3900
+ reason: string;
3901
+ amount: string;
3902
+ asset: string;
3903
+ network: string;
3904
+ expiresAt: string;
3905
+ timeRemainingSeconds: number;
3906
+ };
3907
+ };
3908
+ };
3909
+ };
3910
+ };
3911
+ getChargesById: {
3912
+ parameters: {
3913
+ query?: never;
3914
+ header?: never;
3915
+ path: {
3916
+ id: string;
3917
+ };
3918
+ cookie?: never;
3919
+ };
3920
+ requestBody?: never;
3921
+ responses: {
3922
+ /** @description Charge status */
3923
+ 200: {
3924
+ headers: {
3925
+ [name: string]: unknown;
3926
+ };
3927
+ content: {
3928
+ "application/json": {
3929
+ /** @constant */
3930
+ code: "SDK_CHARGE_STATUS";
3931
+ /** @constant */
3932
+ success: true;
3933
+ content: {
3934
+ chargeId: string;
3935
+ /** @enum {string} */
3936
+ status: "pending" | "completed" | "overpaid" | "underpaid" | "expired" | "refunded";
3937
+ reason: string;
3938
+ amountExpected: string;
3939
+ amountPaid: string;
3940
+ remaining: string;
3941
+ asset: string;
3942
+ walletAddress: string;
3943
+ network: string;
3944
+ expiresAt: string;
3945
+ timeRemainingSeconds: number;
3946
+ isExpired: boolean;
3947
+ feeAmount: string | null;
3948
+ payoutAmount: string | null;
3949
+ forwardTxHash: string | null;
3950
+ createdAt: string;
3951
+ };
2910
3952
  };
2911
3953
  };
2912
3954
  };
@@ -2919,7 +3961,33 @@ interface operations {
2919
3961
  "application/json": {
2920
3962
  /** @constant */
2921
3963
  success: false;
2922
- error: string;
3964
+ code: string;
3965
+ };
3966
+ };
3967
+ };
3968
+ /** @description Forbidden */
3969
+ 403: {
3970
+ headers: {
3971
+ [name: string]: unknown;
3972
+ };
3973
+ content: {
3974
+ "application/json": {
3975
+ /** @constant */
3976
+ success: false;
3977
+ code: string;
3978
+ };
3979
+ };
3980
+ };
3981
+ /** @description Not found */
3982
+ 404: {
3983
+ headers: {
3984
+ [name: string]: unknown;
3985
+ };
3986
+ content: {
3987
+ "application/json": {
3988
+ /** @constant */
3989
+ success: false;
3990
+ code: string;
2923
3991
  };
2924
3992
  };
2925
3993
  };
@@ -2977,7 +4045,7 @@ interface operations {
2977
4045
  "application/json": {
2978
4046
  /** @constant */
2979
4047
  success: false;
2980
- error: string;
4048
+ code: string;
2981
4049
  };
2982
4050
  };
2983
4051
  };
@@ -2990,7 +4058,7 @@ interface operations {
2990
4058
  "application/json": {
2991
4059
  /** @constant */
2992
4060
  success: false;
2993
- error: string;
4061
+ code: string;
2994
4062
  };
2995
4063
  };
2996
4064
  };
@@ -3038,7 +4106,7 @@ interface operations {
3038
4106
  "application/json": {
3039
4107
  /** @constant */
3040
4108
  success: false;
3041
- error: string;
4109
+ code: string;
3042
4110
  };
3043
4111
  };
3044
4112
  };
@@ -3051,7 +4119,7 @@ interface operations {
3051
4119
  "application/json": {
3052
4120
  /** @constant */
3053
4121
  success: false;
3054
- error: string;
4122
+ code: string;
3055
4123
  };
3056
4124
  };
3057
4125
  };
@@ -3064,7 +4132,7 @@ interface operations {
3064
4132
  "application/json": {
3065
4133
  /** @constant */
3066
4134
  success: false;
3067
- error: string;
4135
+ code: string;
3068
4136
  };
3069
4137
  };
3070
4138
  };
@@ -3113,7 +4181,7 @@ interface operations {
3113
4181
  "application/json": {
3114
4182
  /** @constant */
3115
4183
  success: false;
3116
- error: string;
4184
+ code: string;
3117
4185
  };
3118
4186
  };
3119
4187
  };
@@ -3126,7 +4194,7 @@ interface operations {
3126
4194
  "application/json": {
3127
4195
  /** @constant */
3128
4196
  success: false;
3129
- error: string;
4197
+ code: string;
3130
4198
  };
3131
4199
  };
3132
4200
  };
@@ -3181,7 +4249,7 @@ interface operations {
3181
4249
  "application/json": {
3182
4250
  /** @constant */
3183
4251
  success: false;
3184
- error: string;
4252
+ code: string;
3185
4253
  };
3186
4254
  };
3187
4255
  };
@@ -3194,7 +4262,7 @@ interface operations {
3194
4262
  "application/json": {
3195
4263
  /** @constant */
3196
4264
  success: false;
3197
- error: string;
4265
+ code: string;
3198
4266
  };
3199
4267
  };
3200
4268
  };
@@ -3207,7 +4275,7 @@ interface operations {
3207
4275
  "application/json": {
3208
4276
  /** @constant */
3209
4277
  success: false;
3210
- error: string;
4278
+ code: string;
3211
4279
  };
3212
4280
  };
3213
4281
  };
@@ -3265,7 +4333,7 @@ interface operations {
3265
4333
  "application/json": {
3266
4334
  /** @constant */
3267
4335
  success: false;
3268
- error: string;
4336
+ code: string;
3269
4337
  };
3270
4338
  };
3271
4339
  };
@@ -3278,7 +4346,7 @@ interface operations {
3278
4346
  "application/json": {
3279
4347
  /** @constant */
3280
4348
  success: false;
3281
- error: string;
4349
+ code: string;
3282
4350
  };
3283
4351
  };
3284
4352
  };
@@ -3340,7 +4408,7 @@ interface operations {
3340
4408
  "application/json": {
3341
4409
  /** @constant */
3342
4410
  success: false;
3343
- error: string;
4411
+ code: string;
3344
4412
  };
3345
4413
  };
3346
4414
  };
@@ -3353,7 +4421,7 @@ interface operations {
3353
4421
  "application/json": {
3354
4422
  /** @constant */
3355
4423
  success: false;
3356
- error: string;
4424
+ code: string;
3357
4425
  };
3358
4426
  };
3359
4427
  };
@@ -3366,7 +4434,7 @@ interface operations {
3366
4434
  "application/json": {
3367
4435
  /** @constant */
3368
4436
  success: false;
3369
- error: string;
4437
+ code: string;
3370
4438
  };
3371
4439
  };
3372
4440
  };
@@ -3425,7 +4493,7 @@ interface operations {
3425
4493
  "application/json": {
3426
4494
  /** @constant */
3427
4495
  success: false;
3428
- error: string;
4496
+ code: string;
3429
4497
  };
3430
4498
  };
3431
4499
  };
@@ -3438,7 +4506,7 @@ interface operations {
3438
4506
  "application/json": {
3439
4507
  /** @constant */
3440
4508
  success: false;
3441
- error: string;
4509
+ code: string;
3442
4510
  };
3443
4511
  };
3444
4512
  };
@@ -3451,7 +4519,7 @@ interface operations {
3451
4519
  "application/json": {
3452
4520
  /** @constant */
3453
4521
  success: false;
3454
- error: string;
4522
+ code: string;
3455
4523
  };
3456
4524
  };
3457
4525
  };
@@ -3503,7 +4571,7 @@ interface operations {
3503
4571
  "application/json": {
3504
4572
  /** @constant */
3505
4573
  success: false;
3506
- error: string;
4574
+ code: string;
3507
4575
  };
3508
4576
  };
3509
4577
  };
@@ -3516,7 +4584,7 @@ interface operations {
3516
4584
  "application/json": {
3517
4585
  /** @constant */
3518
4586
  success: false;
3519
- error: string;
4587
+ code: string;
3520
4588
  };
3521
4589
  };
3522
4590
  };
@@ -3529,7 +4597,7 @@ interface operations {
3529
4597
  "application/json": {
3530
4598
  /** @constant */
3531
4599
  success: false;
3532
- error: string;
4600
+ code: string;
3533
4601
  };
3534
4602
  };
3535
4603
  };
@@ -3581,7 +4649,7 @@ interface operations {
3581
4649
  "application/json": {
3582
4650
  /** @constant */
3583
4651
  success: false;
3584
- error: string;
4652
+ code: string;
3585
4653
  };
3586
4654
  };
3587
4655
  };
@@ -3631,7 +4699,7 @@ interface operations {
3631
4699
  "application/json": {
3632
4700
  /** @constant */
3633
4701
  success: false;
3634
- error: string;
4702
+ code: string;
3635
4703
  };
3636
4704
  };
3637
4705
  };
@@ -3644,7 +4712,7 @@ interface operations {
3644
4712
  "application/json": {
3645
4713
  /** @constant */
3646
4714
  success: false;
3647
- error: string;
4715
+ code: string;
3648
4716
  };
3649
4717
  };
3650
4718
  };
@@ -3657,7 +4725,7 @@ interface operations {
3657
4725
  "application/json": {
3658
4726
  /** @constant */
3659
4727
  success: false;
3660
- error: string;
4728
+ code: string;
3661
4729
  };
3662
4730
  };
3663
4731
  };
@@ -3670,7 +4738,7 @@ interface operations {
3670
4738
  "application/json": {
3671
4739
  /** @constant */
3672
4740
  success: false;
3673
- error: string;
4741
+ code: string;
3674
4742
  };
3675
4743
  };
3676
4744
  };
@@ -3774,4 +4842,4 @@ declare function listDistributionRules(api: PollarApiClient): Promise<Distributi
3774
4842
  */
3775
4843
  declare function claimDistributionRule(api: PollarApiClient, body: DistributionClaimBody): Promise<DistributionClaimContent>;
3776
4844
 
3777
- export { AUTH_ERROR_CODES, type AdapterFn, AlbedoAdapter, type AuthErrorCode, type AuthState, type BuildProofArgs, type ConnectWalletResponse, type DistributionClaimBody, type DistributionClaimContent, type DistributionRule, type DistributionRulesState, FreighterAdapter, type KeyManager, type KycFlow, type KycLevel, type KycProvider, type KycStartBody, type KycStartResponse, type KycStatus, type LocalStorageAdapterOptions, type NetworkState, OnStorageDegrade, type PaymentInstructions, type PollarAdapter, type PollarAdapters, type PollarApiClient, type PollarApplicationConfigContent, type PollarApplicationConfigResponse, PollarClient, type PollarClientConfig, PollarFlowError, type PollarLoginOptions, type PollarPersistedSession, type PollarUserProfile, type PublicEcJwk, type RampDirection, type RampQuote, type RampTxStatus, type RampsOfframpBody, type RampsOfframpResponse, type RampsOnrampBody, type RampsOnrampResponse, type RampsQuoteQuery, type RampsQuoteResponse, type RampsTransactionResponse, type RulePeriod, type SessionInfo, type SignAuthEntryOptions, type SignAuthEntryResponse, type SignTransactionOptions, type SignTransactionResponse, type StellarBalance, StellarClient, type StellarClientConfig, type StellarNetwork, Storage, type TransactionState, type TxBuildBody, type TxBuildContent, type TxBuildResponse, type TxHistoryContent, type TxHistoryParams, type TxHistoryRecord, type TxHistoryState, type TxSignAndSendBody, type TxSignSendResponse, type WalletAdapter, type WalletAdapterResolver, type WalletBalanceContent, type WalletBalanceRecord, type WalletBalanceState, type WalletId, WalletType, WebCryptoKeyManager, buildProof, canonicalEcJwk, claimDistributionRule, computeJwkThumbprint, createLocalStorageAdapter, createMemoryAdapter, createOffRamp, createOnRamp, defaultKeyManager, defaultStorage, getKycProviders, getKycStatus, getRampTransaction, getRampsQuote, isValidSession, listDistributionRules, normalizeHtu, pollKycStatus, pollRampTransaction, type paths as pollarPaths, resolveKyc, startKyc };
4845
+ export { AUTH_ERROR_CODES, type AdapterFn, AlbedoAdapter, type AuthErrorCode, type AuthState, type BuildOutcome, type BuildProofArgs, type ConnectWalletResponse, type DistributionClaimBody, type DistributionClaimContent, type DistributionRule, type DistributionRulesState, FreighterAdapter, type KeyManager, type KycFlow, type KycLevel, type KycProvider, type KycStartBody, type KycStartResponse, type KycStatus, type LocalStorageAdapterOptions, type NetworkState, OnStorageDegrade, type PaymentInstructions, type PollarAdapter, type PollarAdapters, type PollarApiClient, type PollarApplicationConfigContent, type PollarApplicationConfigResponse, PollarClient, type PollarClientConfig, PollarFlowError, type PollarLoginOptions, type PollarPersistedSession, type PollarUserProfile, type PublicEcJwk, type RampDirection, type RampQuote, type RampTxStatus, type RampsOfframpBody, type RampsOfframpResponse, type RampsOnrampBody, type RampsOnrampResponse, type RampsQuoteQuery, type RampsQuoteResponse, type RampsTransactionResponse, type RulePeriod, type SessionInfo, type SignAuthEntryOptions, type SignAuthEntryResponse, type SignOutcome, type SignTransactionOptions, type SignTransactionResponse, type StellarBalance, StellarClient, type StellarClientConfig, type StellarNetwork, Storage, type SubmitOutcome, type TransactionState, type TxBuildBody, type TxBuildContent, type TxBuildResponse, type TxBuildSignSubmitBody, type TxBuildSignSubmitContent, type TxBuildSignSubmitResponse, type TxErrorPhase, type TxHistoryContent, type TxHistoryParams, type TxHistoryRecord, type TxHistoryState, type TxSignAndSendBody, type TxSignBody, type TxSignContent, type TxSignResponse, type TxSignSendResponse, type TxSubmitSignedBody, type WalletAdapter, type WalletAdapterResolver, type WalletBalanceContent, type WalletBalanceRecord, type WalletBalanceState, type WalletId, WalletType, WebCryptoKeyManager, buildProof, canonicalEcJwk, claimDistributionRule, computeJwkThumbprint, createLocalStorageAdapter, createMemoryAdapter, createOffRamp, createOnRamp, defaultKeyManager, defaultStorage, getKycProviders, getKycStatus, getRampTransaction, getRampsQuote, isValidSession, listDistributionRules, normalizeHtu, pollKycStatus, pollRampTransaction, type paths as pollarPaths, resolveKyc, startKyc };