@pollar/core 0.7.0 → 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];
@@ -390,6 +546,21 @@ type RampsTransactionResponse = paths['/ramps/transaction/{txId}']['get']['respo
390
546
  type RampTxStatus = RampsTransactionResponse['status'];
391
547
  type RampDirection = RampsTransactionResponse['direction'];
392
548
  type PaymentInstructions = RampsOnrampResponse['paymentInstructions'];
549
+ type DistributionRule = paths['/distribution/rules']['get']['responses'][200]['content']['application/json']['content']['rules'][number];
550
+ type RulePeriod = DistributionRule['period'];
551
+ type DistributionClaimBody = NonNullable<paths['/distribution/claim']['post']['requestBody']>['content']['application/json'];
552
+ type DistributionClaimContent = paths['/distribution/claim']['post']['responses'][200]['content']['application/json']['content'];
553
+ type DistributionRulesState = {
554
+ step: 'idle';
555
+ } | {
556
+ step: 'loading';
557
+ } | {
558
+ step: 'loaded';
559
+ rules: DistributionRule[];
560
+ } | {
561
+ step: 'error';
562
+ message: string;
563
+ };
393
564
  type AdapterFn<TParams = unknown> = (params: TParams) => Promise<{
394
565
  unsignedTransaction: string;
395
566
  }>;
@@ -423,12 +594,26 @@ declare class PollarClient {
423
594
  private _profile;
424
595
  /** Last `DPoP-Nonce` we saw from a server response. Carried into the next proof. */
425
596
  private _dpopNonce;
597
+ /**
598
+ * Snapshot of each in-flight request's body, taken in `onRequest` before
599
+ * `fetch()` consumes the stream. Needed because `Request.clone()` throws
600
+ * once the body is disturbed, so the auto-retry path (DPoP nonce challenge
601
+ * / 401 refresh) must rebuild the request from scratch instead of cloning.
602
+ */
603
+ private _requestBodyCache;
426
604
  /** Singleton in-flight refresh — concurrent 401s coalesce into one /auth/refresh call. */
427
605
  private _refreshPromise;
428
606
  private _storageEventHandler;
429
607
  /** Optional UI label sent to the server at /auth/login so the sessions UI
430
608
  * can show a recognizable device name. Set via PollarClientConfig.deviceLabel. */
431
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;
432
617
  private _transactionState;
433
618
  private _transactionStateListeners;
434
619
  private _txHistoryState;
@@ -439,8 +624,18 @@ declare class PollarClient {
439
624
  private _authStateListeners;
440
625
  private _networkState;
441
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;
442
636
  private _walletAdapter;
443
637
  private readonly _walletAdapterResolver;
638
+ private readonly _walletResolverTimeoutMs;
444
639
  private _loginController;
445
640
  constructor(config: PollarClientConfig);
446
641
  /** Awaitable handle for the initial keypair + session restore. */
@@ -457,8 +652,54 @@ declare class PollarClient {
457
652
  */
458
653
  refresh(): Promise<void>;
459
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;
460
685
  getAuthState(): AuthState;
461
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;
462
703
  /** PII (email, names, avatar, providers). Held in memory only — never persisted. */
463
704
  getUserProfile(): PollarUserProfile | null;
464
705
  login(options: PollarLoginOptions): void;
@@ -507,9 +748,81 @@ declare class PollarClient {
507
748
  getWalletBalanceState(): WalletBalanceState;
508
749
  onWalletBalanceStateChange(cb: (state: WalletBalanceState) => void): () => void;
509
750
  refreshBalance(publicKey?: string): Promise<void>;
510
- 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>;
511
757
  getWalletType(): WalletId | null;
512
- 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>;
513
826
  getAppConfig(): Promise<unknown>;
514
827
  getKycStatus(providerId?: string): Promise<{
515
828
  status: KycStatus;
@@ -544,6 +857,8 @@ declare class PollarClient {
544
857
  intervalMs?: number;
545
858
  timeoutMs?: number;
546
859
  }): Promise<RampTxStatus>;
860
+ listDistributionRules(): Promise<DistributionRule[]>;
861
+ claimDistributionRule(body: DistributionClaimBody): Promise<DistributionClaimContent>;
547
862
  private _setTxHistoryState;
548
863
  private _setWalletBalanceState;
549
864
  private _newController;
@@ -563,6 +878,13 @@ declare class PollarClient {
563
878
  private _setNetworkState;
564
879
  private _setAuthState;
565
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;
566
888
  }
567
889
 
568
890
  /**
@@ -953,9 +1275,18 @@ interface paths {
953
1275
  trace?: never;
954
1276
  };
955
1277
  "/auth/logout": {
956
- parameters: { query?: never; header?: never; path?: never; cookie?: never };
1278
+ parameters: {
1279
+ query?: never;
1280
+ header?: never;
1281
+ path?: never;
1282
+ cookie?: never;
1283
+ };
957
1284
  get?: never;
958
1285
  put?: never;
1286
+ /**
1287
+ * Revoke the current session (or all sessions)
1288
+ * @description Server-side logout. Default behavior revokes the refresh-token family bound to the current access token. Pass `{"everywhere":true}` to revoke every active family for the authenticated user (logout from all devices).
1289
+ */
959
1290
  post: operations["postAuthLogout"];
960
1291
  delete?: never;
961
1292
  options?: never;
@@ -964,7 +1295,16 @@ interface paths {
964
1295
  trace?: never;
965
1296
  };
966
1297
  "/auth/sessions": {
967
- parameters: { query?: never; header?: never; path?: never; cookie?: never };
1298
+ parameters: {
1299
+ query?: never;
1300
+ header?: never;
1301
+ path?: never;
1302
+ cookie?: never;
1303
+ };
1304
+ /**
1305
+ * List active sessions for the authenticated user
1306
+ * @description Returns one row per active refresh-token family with the metadata captured at issuance (user agent, hashed IP, optional device label). The session whose `current: true` flag matches the access token in use can be highlighted in the UI.
1307
+ */
968
1308
  get: operations["getAuthSessions"];
969
1309
  put?: never;
970
1310
  post?: never;
@@ -975,11 +1315,17 @@ interface paths {
975
1315
  trace?: never;
976
1316
  };
977
1317
  "/auth/sessions/{familyId}": {
978
- parameters: { query?: never; header?: never; path?: never; cookie?: never };
1318
+ parameters: {
1319
+ query?: never;
1320
+ header?: never;
1321
+ path?: never;
1322
+ cookie?: never;
1323
+ };
979
1324
  get?: never;
980
1325
  put?: never;
981
1326
  post?: never;
982
- delete: operations["deleteAuthSessionByFamilyId"];
1327
+ /** Revoke a specific session (refresh-token family) */
1328
+ delete: operations["deleteAuthSessionsByFamilyId"];
983
1329
  options?: never;
984
1330
  head?: never;
985
1331
  patch?: never;
@@ -1065,6 +1411,66 @@ interface paths {
1065
1411
  patch?: never;
1066
1412
  trace?: never;
1067
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
+ };
1068
1474
  "/tx/status": {
1069
1475
  parameters: {
1070
1476
  query?: never;
@@ -1105,6 +1511,46 @@ interface paths {
1105
1511
  patch?: never;
1106
1512
  trace?: never;
1107
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
+ };
1108
1554
  "/wallet/balance": {
1109
1555
  parameters: {
1110
1556
  query?: never;
@@ -1265,6 +1711,46 @@ interface paths {
1265
1711
  patch?: never;
1266
1712
  trace?: never;
1267
1713
  };
1714
+ "/distribution/rules": {
1715
+ parameters: {
1716
+ query?: never;
1717
+ header?: never;
1718
+ path?: never;
1719
+ cookie?: never;
1720
+ };
1721
+ /**
1722
+ * List distribution rules
1723
+ * @description Returns every distribution rule defined for the calling application, each decorated with a `claimable` flag and (when not claimable) a `reason` ErrorCode the SDK can map to a UI message (expired, already claimed in window, exhausted, etc.).
1724
+ */
1725
+ get: operations["getDistributionRules"];
1726
+ put?: never;
1727
+ post?: never;
1728
+ delete?: never;
1729
+ options?: never;
1730
+ head?: never;
1731
+ patch?: never;
1732
+ trace?: never;
1733
+ };
1734
+ "/distribution/claim": {
1735
+ parameters: {
1736
+ query?: never;
1737
+ header?: never;
1738
+ path?: never;
1739
+ cookie?: never;
1740
+ };
1741
+ get?: never;
1742
+ put?: never;
1743
+ /**
1744
+ * Claim a distribution rule
1745
+ * @description Executes a claim against the given rule for the authenticated sdk-user. The server runs the same claimability checks as GET /distribution/rules against fresh counts; only the txHash and amount are returned on success.
1746
+ */
1747
+ post: operations["postDistributionClaim"];
1748
+ delete?: never;
1749
+ options?: never;
1750
+ head?: never;
1751
+ patch?: never;
1752
+ trace?: never;
1753
+ };
1268
1754
  }
1269
1755
  interface operations {
1270
1756
  getHealth: {
@@ -1332,7 +1818,7 @@ interface operations {
1332
1818
  "application/json": {
1333
1819
  /** @constant */
1334
1820
  success: false;
1335
- error: string;
1821
+ code: string;
1336
1822
  };
1337
1823
  };
1338
1824
  };
@@ -1345,7 +1831,7 @@ interface operations {
1345
1831
  "application/json": {
1346
1832
  /** @constant */
1347
1833
  success: false;
1348
- error: string;
1834
+ code: string;
1349
1835
  };
1350
1836
  };
1351
1837
  };
@@ -1358,7 +1844,7 @@ interface operations {
1358
1844
  "application/json": {
1359
1845
  /** @constant */
1360
1846
  success: false;
1361
- error: string;
1847
+ code: string;
1362
1848
  };
1363
1849
  };
1364
1850
  };
@@ -1420,7 +1906,7 @@ interface operations {
1420
1906
  "application/json": {
1421
1907
  /** @constant */
1422
1908
  success: false;
1423
- error: string;
1909
+ code: string;
1424
1910
  };
1425
1911
  };
1426
1912
  };
@@ -1433,7 +1919,7 @@ interface operations {
1433
1919
  "application/json": {
1434
1920
  /** @constant */
1435
1921
  success: false;
1436
- error: string;
1922
+ code: string;
1437
1923
  };
1438
1924
  };
1439
1925
  };
@@ -1446,7 +1932,7 @@ interface operations {
1446
1932
  "application/json": {
1447
1933
  /** @constant */
1448
1934
  success: false;
1449
- error: string;
1935
+ code: string;
1450
1936
  };
1451
1937
  };
1452
1938
  };
@@ -1459,7 +1945,7 @@ interface operations {
1459
1945
  "application/json": {
1460
1946
  /** @constant */
1461
1947
  success: false;
1462
- error: string;
1948
+ code: string;
1463
1949
  };
1464
1950
  };
1465
1951
  };
@@ -1494,7 +1980,7 @@ interface operations {
1494
1980
  "application/json": {
1495
1981
  /** @constant */
1496
1982
  success: false;
1497
- error: string;
1983
+ code: string;
1498
1984
  };
1499
1985
  };
1500
1986
  };
@@ -1507,7 +1993,7 @@ interface operations {
1507
1993
  "application/json": {
1508
1994
  /** @constant */
1509
1995
  success: false;
1510
- error: string;
1996
+ code: string;
1511
1997
  };
1512
1998
  };
1513
1999
  };
@@ -1520,7 +2006,7 @@ interface operations {
1520
2006
  "application/json": {
1521
2007
  /** @constant */
1522
2008
  success: false;
1523
- error: string;
2009
+ code: string;
1524
2010
  };
1525
2011
  };
1526
2012
  };
@@ -1533,7 +2019,7 @@ interface operations {
1533
2019
  "application/json": {
1534
2020
  /** @constant */
1535
2021
  success: false;
1536
- error: string;
2022
+ code: string;
1537
2023
  };
1538
2024
  };
1539
2025
  };
@@ -1567,7 +2053,7 @@ interface operations {
1567
2053
  "application/json": {
1568
2054
  /** @constant */
1569
2055
  success: false;
1570
- error: string;
2056
+ code: string;
1571
2057
  };
1572
2058
  };
1573
2059
  };
@@ -1580,7 +2066,7 @@ interface operations {
1580
2066
  "application/json": {
1581
2067
  /** @constant */
1582
2068
  success: false;
1583
- error: string;
2069
+ code: string;
1584
2070
  };
1585
2071
  };
1586
2072
  };
@@ -1593,7 +2079,7 @@ interface operations {
1593
2079
  "application/json": {
1594
2080
  /** @constant */
1595
2081
  success: false;
1596
- error: string;
2082
+ code: string;
1597
2083
  };
1598
2084
  };
1599
2085
  };
@@ -1643,7 +2129,7 @@ interface operations {
1643
2129
  "application/json": {
1644
2130
  /** @constant */
1645
2131
  success: false;
1646
- error: string;
2132
+ code: string;
1647
2133
  };
1648
2134
  };
1649
2135
  };
@@ -1656,7 +2142,7 @@ interface operations {
1656
2142
  "application/json": {
1657
2143
  /** @constant */
1658
2144
  success: false;
1659
- error: string;
2145
+ code: string;
1660
2146
  };
1661
2147
  };
1662
2148
  };
@@ -1669,7 +2155,7 @@ interface operations {
1669
2155
  "application/json": {
1670
2156
  /** @constant */
1671
2157
  success: false;
1672
- error: string;
2158
+ code: string;
1673
2159
  };
1674
2160
  };
1675
2161
  };
@@ -1682,7 +2168,7 @@ interface operations {
1682
2168
  "application/json": {
1683
2169
  /** @constant */
1684
2170
  success: false;
1685
- error: string;
2171
+ code: string;
1686
2172
  };
1687
2173
  };
1688
2174
  };
@@ -1730,7 +2216,7 @@ interface operations {
1730
2216
  "application/json": {
1731
2217
  /** @constant */
1732
2218
  success: false;
1733
- error: string;
2219
+ code: string;
1734
2220
  };
1735
2221
  };
1736
2222
  };
@@ -1743,7 +2229,7 @@ interface operations {
1743
2229
  "application/json": {
1744
2230
  /** @constant */
1745
2231
  success: false;
1746
- error: string;
2232
+ code: string;
1747
2233
  };
1748
2234
  };
1749
2235
  };
@@ -1756,7 +2242,7 @@ interface operations {
1756
2242
  "application/json": {
1757
2243
  /** @constant */
1758
2244
  success: false;
1759
- error: string;
2245
+ code: string;
1760
2246
  };
1761
2247
  };
1762
2248
  };
@@ -1769,7 +2255,7 @@ interface operations {
1769
2255
  "application/json": {
1770
2256
  /** @constant */
1771
2257
  success: false;
1772
- error: string;
2258
+ code: string;
1773
2259
  };
1774
2260
  };
1775
2261
  };
@@ -1818,7 +2304,7 @@ interface operations {
1818
2304
  "application/json": {
1819
2305
  /** @constant */
1820
2306
  success: false;
1821
- error: string;
2307
+ code: string;
1822
2308
  };
1823
2309
  };
1824
2310
  };
@@ -1831,7 +2317,7 @@ interface operations {
1831
2317
  "application/json": {
1832
2318
  /** @constant */
1833
2319
  success: false;
1834
- error: string;
2320
+ code: string;
1835
2321
  };
1836
2322
  };
1837
2323
  };
@@ -1844,7 +2330,7 @@ interface operations {
1844
2330
  "application/json": {
1845
2331
  /** @constant */
1846
2332
  success: false;
1847
- error: string;
2333
+ code: string;
1848
2334
  };
1849
2335
  };
1850
2336
  };
@@ -1857,7 +2343,7 @@ interface operations {
1857
2343
  "application/json": {
1858
2344
  /** @constant */
1859
2345
  success: false;
1860
- error: string;
2346
+ code: string;
1861
2347
  };
1862
2348
  };
1863
2349
  };
@@ -1949,7 +2435,7 @@ interface operations {
1949
2435
  "application/json": {
1950
2436
  /** @constant */
1951
2437
  success: false;
1952
- error: string;
2438
+ code: string;
1953
2439
  };
1954
2440
  };
1955
2441
  };
@@ -1962,7 +2448,7 @@ interface operations {
1962
2448
  "application/json": {
1963
2449
  /** @constant */
1964
2450
  success: false;
1965
- error: string;
2451
+ code: string;
1966
2452
  };
1967
2453
  };
1968
2454
  };
@@ -1975,7 +2461,7 @@ interface operations {
1975
2461
  "application/json": {
1976
2462
  /** @constant */
1977
2463
  success: false;
1978
- error: string;
2464
+ code: string;
1979
2465
  };
1980
2466
  };
1981
2467
  };
@@ -1988,7 +2474,7 @@ interface operations {
1988
2474
  "application/json": {
1989
2475
  /** @constant */
1990
2476
  success: false;
1991
- error: string;
2477
+ code: string;
1992
2478
  };
1993
2479
  };
1994
2480
  };
@@ -2039,7 +2525,7 @@ interface operations {
2039
2525
  "application/json": {
2040
2526
  /** @constant */
2041
2527
  success: false;
2042
- error: string;
2528
+ code: string;
2043
2529
  };
2044
2530
  };
2045
2531
  };
@@ -2052,7 +2538,7 @@ interface operations {
2052
2538
  "application/json": {
2053
2539
  /** @constant */
2054
2540
  success: false;
2055
- error: string;
2541
+ code: string;
2056
2542
  };
2057
2543
  };
2058
2544
  };
@@ -2065,7 +2551,7 @@ interface operations {
2065
2551
  "application/json": {
2066
2552
  /** @constant */
2067
2553
  success: false;
2068
- error: string;
2554
+ code: string;
2069
2555
  };
2070
2556
  };
2071
2557
  };
@@ -2078,22 +2564,28 @@ interface operations {
2078
2564
  "application/json": {
2079
2565
  /** @constant */
2080
2566
  success: false;
2081
- error: string;
2567
+ code: string;
2082
2568
  };
2083
2569
  };
2084
2570
  };
2085
2571
  };
2086
2572
  };
2087
- getApplicationsConfig: {
2573
+ postAuthLogout: {
2088
2574
  parameters: {
2089
2575
  query?: never;
2090
2576
  header?: never;
2091
2577
  path?: never;
2092
2578
  cookie?: never;
2093
2579
  };
2094
- requestBody?: never;
2580
+ requestBody: {
2581
+ content: {
2582
+ "application/json": {
2583
+ everywhere?: boolean;
2584
+ };
2585
+ };
2586
+ };
2095
2587
  responses: {
2096
- /** @description Application config */
2588
+ /** @description Sessions revoked */
2097
2589
  200: {
2098
2590
  headers: {
2099
2591
  [name: string]: unknown;
@@ -2101,24 +2593,171 @@ interface operations {
2101
2593
  content: {
2102
2594
  "application/json": {
2103
2595
  /** @constant */
2104
- code: "SDK_APPLICATION_CONFIG";
2596
+ code: "SDK_LOGOUT_SUCCESS";
2105
2597
  /** @constant */
2106
2598
  success: true;
2107
2599
  content: {
2108
- application: {
2109
- name: string;
2110
- };
2111
- styles: {
2112
- theme?: string;
2113
- accentColor?: string;
2114
- logoUrl?: string;
2115
- emailEnabled?: boolean;
2116
- embeddedWallets?: boolean;
2117
- providers?: {
2118
- google?: boolean;
2119
- discord?: boolean;
2120
- x?: boolean;
2121
- github?: boolean;
2600
+ revoked: number;
2601
+ };
2602
+ };
2603
+ };
2604
+ };
2605
+ /** @description Unauthorized */
2606
+ 401: {
2607
+ headers: {
2608
+ [name: string]: unknown;
2609
+ };
2610
+ content: {
2611
+ "application/json": {
2612
+ /** @constant */
2613
+ success: false;
2614
+ code: string;
2615
+ };
2616
+ };
2617
+ };
2618
+ };
2619
+ };
2620
+ getAuthSessions: {
2621
+ parameters: {
2622
+ query?: never;
2623
+ header?: never;
2624
+ path?: never;
2625
+ cookie?: never;
2626
+ };
2627
+ requestBody?: never;
2628
+ responses: {
2629
+ /** @description Sessions list */
2630
+ 200: {
2631
+ headers: {
2632
+ [name: string]: unknown;
2633
+ };
2634
+ content: {
2635
+ "application/json": {
2636
+ /** @constant */
2637
+ code: "SDK_SESSIONS_LIST";
2638
+ /** @constant */
2639
+ success: true;
2640
+ content: {
2641
+ sessions: {
2642
+ familyId: string;
2643
+ createdAt: string;
2644
+ lastUsedAt: string | null;
2645
+ userAgent: string | null;
2646
+ ipHash: string | null;
2647
+ deviceLabel: string | null;
2648
+ current: boolean;
2649
+ expiresAt: string;
2650
+ }[];
2651
+ };
2652
+ };
2653
+ };
2654
+ };
2655
+ /** @description Unauthorized */
2656
+ 401: {
2657
+ headers: {
2658
+ [name: string]: unknown;
2659
+ };
2660
+ content: {
2661
+ "application/json": {
2662
+ /** @constant */
2663
+ success: false;
2664
+ code: string;
2665
+ };
2666
+ };
2667
+ };
2668
+ };
2669
+ };
2670
+ deleteAuthSessionsByFamilyId: {
2671
+ parameters: {
2672
+ query?: never;
2673
+ header?: never;
2674
+ path: {
2675
+ familyId: string;
2676
+ };
2677
+ cookie?: never;
2678
+ };
2679
+ requestBody?: never;
2680
+ responses: {
2681
+ /** @description Session revoked */
2682
+ 200: {
2683
+ headers: {
2684
+ [name: string]: unknown;
2685
+ };
2686
+ content: {
2687
+ "application/json": {
2688
+ /** @constant */
2689
+ code: "SDK_SESSION_REVOKED";
2690
+ /** @constant */
2691
+ success: true;
2692
+ content: {
2693
+ revoked: number;
2694
+ };
2695
+ };
2696
+ };
2697
+ };
2698
+ /** @description Unauthorized */
2699
+ 401: {
2700
+ headers: {
2701
+ [name: string]: unknown;
2702
+ };
2703
+ content: {
2704
+ "application/json": {
2705
+ /** @constant */
2706
+ success: false;
2707
+ code: string;
2708
+ };
2709
+ };
2710
+ };
2711
+ /** @description Not found */
2712
+ 404: {
2713
+ headers: {
2714
+ [name: string]: unknown;
2715
+ };
2716
+ content: {
2717
+ "application/json": {
2718
+ /** @constant */
2719
+ success: false;
2720
+ code: string;
2721
+ };
2722
+ };
2723
+ };
2724
+ };
2725
+ };
2726
+ getApplicationsConfig: {
2727
+ parameters: {
2728
+ query?: never;
2729
+ header?: never;
2730
+ path?: never;
2731
+ cookie?: never;
2732
+ };
2733
+ requestBody?: never;
2734
+ responses: {
2735
+ /** @description Application config */
2736
+ 200: {
2737
+ headers: {
2738
+ [name: string]: unknown;
2739
+ };
2740
+ content: {
2741
+ "application/json": {
2742
+ /** @constant */
2743
+ code: "SDK_APPLICATION_CONFIG";
2744
+ /** @constant */
2745
+ success: true;
2746
+ content: {
2747
+ application: {
2748
+ name: string;
2749
+ };
2750
+ styles: {
2751
+ theme?: string;
2752
+ accentColor?: string;
2753
+ logoUrl?: string;
2754
+ emailEnabled?: boolean;
2755
+ embeddedWallets?: boolean;
2756
+ providers?: {
2757
+ google?: boolean;
2758
+ discord?: boolean;
2759
+ x?: boolean;
2760
+ github?: boolean;
2122
2761
  apple?: boolean;
2123
2762
  };
2124
2763
  };
@@ -2135,7 +2774,7 @@ interface operations {
2135
2774
  "application/json": {
2136
2775
  /** @constant */
2137
2776
  success: false;
2138
- error: string;
2777
+ code: string;
2139
2778
  };
2140
2779
  };
2141
2780
  };
@@ -2148,7 +2787,7 @@ interface operations {
2148
2787
  "application/json": {
2149
2788
  /** @constant */
2150
2789
  success: false;
2151
- error: string;
2790
+ code: string;
2152
2791
  };
2153
2792
  };
2154
2793
  };
@@ -2161,7 +2800,7 @@ interface operations {
2161
2800
  "application/json": {
2162
2801
  /** @constant */
2163
2802
  success: false;
2164
- error: string;
2803
+ code: string;
2165
2804
  };
2166
2805
  };
2167
2806
  };
@@ -2196,7 +2835,7 @@ interface operations {
2196
2835
  "application/json": {
2197
2836
  /** @constant */
2198
2837
  success: false;
2199
- error: string;
2838
+ code: string;
2200
2839
  };
2201
2840
  };
2202
2841
  };
@@ -2447,7 +3086,7 @@ interface operations {
2447
3086
  "application/json": {
2448
3087
  /** @constant */
2449
3088
  success: false;
2450
- error: string;
3089
+ code: string;
2451
3090
  };
2452
3091
  };
2453
3092
  };
@@ -2460,7 +3099,7 @@ interface operations {
2460
3099
  "application/json": {
2461
3100
  /** @constant */
2462
3101
  success: false;
2463
- error: string;
3102
+ code: string;
2464
3103
  };
2465
3104
  };
2466
3105
  };
@@ -2473,7 +3112,7 @@ interface operations {
2473
3112
  "application/json": {
2474
3113
  /** @constant */
2475
3114
  success: false;
2476
- error: string;
3115
+ code: string;
2477
3116
  };
2478
3117
  };
2479
3118
  };
@@ -2518,8 +3157,488 @@ interface operations {
2518
3157
  };
2519
3158
  };
2520
3159
  };
2521
- /** @description Validation error */
2522
- 400: {
3160
+ /** @description Validation error */
3161
+ 400: {
3162
+ headers: {
3163
+ [name: string]: unknown;
3164
+ };
3165
+ content: {
3166
+ "application/json": {
3167
+ /** @constant */
3168
+ success: false;
3169
+ code: string;
3170
+ };
3171
+ };
3172
+ };
3173
+ /** @description Unauthorized */
3174
+ 401: {
3175
+ headers: {
3176
+ [name: string]: unknown;
3177
+ };
3178
+ content: {
3179
+ "application/json": {
3180
+ /** @constant */
3181
+ success: false;
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;
3209
+ };
3210
+ };
3211
+ };
3212
+ };
3213
+ };
3214
+ postTxSign: {
3215
+ parameters: {
3216
+ query?: never;
3217
+ header?: never;
3218
+ path?: never;
3219
+ cookie?: never;
3220
+ };
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
+ };
3232
+ responses: {
3233
+ /** @description Signed XDR + idempotency key to use with /tx/submit */
3234
+ 200: {
3235
+ headers: {
3236
+ [name: string]: unknown;
3237
+ };
3238
+ content: {
3239
+ "application/json": {
3240
+ /** @constant */
3241
+ code: "SDK_TX_SIGNED";
3242
+ /** @constant */
3243
+ success: true;
3244
+ content: {
3245
+ signedXdr: string;
3246
+ idempotencyKey: string;
3247
+ };
3248
+ };
3249
+ };
3250
+ };
3251
+ /** @description Validation error */
3252
+ 400: {
3253
+ headers: {
3254
+ [name: string]: unknown;
3255
+ };
3256
+ content: {
3257
+ "application/json": {
3258
+ /** @constant */
3259
+ success: false;
3260
+ code: string;
3261
+ };
3262
+ };
3263
+ };
3264
+ /** @description Unauthorized */
3265
+ 401: {
3266
+ headers: {
3267
+ [name: string]: unknown;
3268
+ };
3269
+ content: {
3270
+ "application/json": {
3271
+ /** @constant */
3272
+ success: false;
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;
3300
+ };
3301
+ };
3302
+ };
3303
+ };
3304
+ };
3305
+ postTxSubmit: {
3306
+ parameters: {
3307
+ query?: never;
3308
+ header?: never;
3309
+ path?: never;
3310
+ cookie?: never;
3311
+ };
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
+ };
3323
+ responses: {
3324
+ /** @description Submit result (PENDING | SUCCESS | FAILED) */
3325
+ 200: {
3326
+ headers: {
3327
+ [name: string]: unknown;
3328
+ };
3329
+ content: {
3330
+ "application/json": {
3331
+ /** @constant */
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: {
2523
3642
  headers: {
2524
3643
  [name: string]: unknown;
2525
3644
  };
@@ -2527,12 +3646,12 @@ interface operations {
2527
3646
  "application/json": {
2528
3647
  /** @constant */
2529
3648
  success: false;
2530
- error: string;
3649
+ code: string;
2531
3650
  };
2532
3651
  };
2533
3652
  };
2534
- /** @description Unauthorized */
2535
- 401: {
3653
+ /** @description Build/sign/submit error */
3654
+ 502: {
2536
3655
  headers: {
2537
3656
  [name: string]: unknown;
2538
3657
  };
@@ -2540,7 +3659,7 @@ interface operations {
2540
3659
  "application/json": {
2541
3660
  /** @constant */
2542
3661
  success: false;
2543
- error: string;
3662
+ code: string;
2544
3663
  };
2545
3664
  };
2546
3665
  };
@@ -2589,7 +3708,7 @@ interface operations {
2589
3708
  "application/json": {
2590
3709
  /** @constant */
2591
3710
  success: false;
2592
- error: string;
3711
+ code: string;
2593
3712
  };
2594
3713
  };
2595
3714
  };
@@ -2602,7 +3721,7 @@ interface operations {
2602
3721
  "application/json": {
2603
3722
  /** @constant */
2604
3723
  success: false;
2605
- error: string;
3724
+ code: string;
2606
3725
  };
2607
3726
  };
2608
3727
  };
@@ -2665,7 +3784,171 @@ interface operations {
2665
3784
  "application/json": {
2666
3785
  /** @constant */
2667
3786
  success: false;
2668
- 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
+ };
2669
3952
  };
2670
3953
  };
2671
3954
  };
@@ -2678,7 +3961,33 @@ interface operations {
2678
3961
  "application/json": {
2679
3962
  /** @constant */
2680
3963
  success: false;
2681
- 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;
2682
3991
  };
2683
3992
  };
2684
3993
  };
@@ -2736,7 +4045,7 @@ interface operations {
2736
4045
  "application/json": {
2737
4046
  /** @constant */
2738
4047
  success: false;
2739
- error: string;
4048
+ code: string;
2740
4049
  };
2741
4050
  };
2742
4051
  };
@@ -2749,7 +4058,7 @@ interface operations {
2749
4058
  "application/json": {
2750
4059
  /** @constant */
2751
4060
  success: false;
2752
- error: string;
4061
+ code: string;
2753
4062
  };
2754
4063
  };
2755
4064
  };
@@ -2797,7 +4106,7 @@ interface operations {
2797
4106
  "application/json": {
2798
4107
  /** @constant */
2799
4108
  success: false;
2800
- error: string;
4109
+ code: string;
2801
4110
  };
2802
4111
  };
2803
4112
  };
@@ -2810,7 +4119,7 @@ interface operations {
2810
4119
  "application/json": {
2811
4120
  /** @constant */
2812
4121
  success: false;
2813
- error: string;
4122
+ code: string;
2814
4123
  };
2815
4124
  };
2816
4125
  };
@@ -2823,7 +4132,7 @@ interface operations {
2823
4132
  "application/json": {
2824
4133
  /** @constant */
2825
4134
  success: false;
2826
- error: string;
4135
+ code: string;
2827
4136
  };
2828
4137
  };
2829
4138
  };
@@ -2872,7 +4181,7 @@ interface operations {
2872
4181
  "application/json": {
2873
4182
  /** @constant */
2874
4183
  success: false;
2875
- error: string;
4184
+ code: string;
2876
4185
  };
2877
4186
  };
2878
4187
  };
@@ -2885,7 +4194,7 @@ interface operations {
2885
4194
  "application/json": {
2886
4195
  /** @constant */
2887
4196
  success: false;
2888
- error: string;
4197
+ code: string;
2889
4198
  };
2890
4199
  };
2891
4200
  };
@@ -2940,7 +4249,7 @@ interface operations {
2940
4249
  "application/json": {
2941
4250
  /** @constant */
2942
4251
  success: false;
2943
- error: string;
4252
+ code: string;
2944
4253
  };
2945
4254
  };
2946
4255
  };
@@ -2953,7 +4262,7 @@ interface operations {
2953
4262
  "application/json": {
2954
4263
  /** @constant */
2955
4264
  success: false;
2956
- error: string;
4265
+ code: string;
2957
4266
  };
2958
4267
  };
2959
4268
  };
@@ -2966,7 +4275,7 @@ interface operations {
2966
4275
  "application/json": {
2967
4276
  /** @constant */
2968
4277
  success: false;
2969
- error: string;
4278
+ code: string;
2970
4279
  };
2971
4280
  };
2972
4281
  };
@@ -3024,7 +4333,7 @@ interface operations {
3024
4333
  "application/json": {
3025
4334
  /** @constant */
3026
4335
  success: false;
3027
- error: string;
4336
+ code: string;
3028
4337
  };
3029
4338
  };
3030
4339
  };
@@ -3037,7 +4346,7 @@ interface operations {
3037
4346
  "application/json": {
3038
4347
  /** @constant */
3039
4348
  success: false;
3040
- error: string;
4349
+ code: string;
3041
4350
  };
3042
4351
  };
3043
4352
  };
@@ -3099,7 +4408,7 @@ interface operations {
3099
4408
  "application/json": {
3100
4409
  /** @constant */
3101
4410
  success: false;
3102
- error: string;
4411
+ code: string;
3103
4412
  };
3104
4413
  };
3105
4414
  };
@@ -3112,7 +4421,7 @@ interface operations {
3112
4421
  "application/json": {
3113
4422
  /** @constant */
3114
4423
  success: false;
3115
- error: string;
4424
+ code: string;
3116
4425
  };
3117
4426
  };
3118
4427
  };
@@ -3125,7 +4434,7 @@ interface operations {
3125
4434
  "application/json": {
3126
4435
  /** @constant */
3127
4436
  success: false;
3128
- error: string;
4437
+ code: string;
3129
4438
  };
3130
4439
  };
3131
4440
  };
@@ -3184,7 +4493,7 @@ interface operations {
3184
4493
  "application/json": {
3185
4494
  /** @constant */
3186
4495
  success: false;
3187
- error: string;
4496
+ code: string;
3188
4497
  };
3189
4498
  };
3190
4499
  };
@@ -3197,7 +4506,7 @@ interface operations {
3197
4506
  "application/json": {
3198
4507
  /** @constant */
3199
4508
  success: false;
3200
- error: string;
4509
+ code: string;
3201
4510
  };
3202
4511
  };
3203
4512
  };
@@ -3210,7 +4519,7 @@ interface operations {
3210
4519
  "application/json": {
3211
4520
  /** @constant */
3212
4521
  success: false;
3213
- error: string;
4522
+ code: string;
3214
4523
  };
3215
4524
  };
3216
4525
  };
@@ -3262,7 +4571,7 @@ interface operations {
3262
4571
  "application/json": {
3263
4572
  /** @constant */
3264
4573
  success: false;
3265
- error: string;
4574
+ code: string;
3266
4575
  };
3267
4576
  };
3268
4577
  };
@@ -3275,7 +4584,7 @@ interface operations {
3275
4584
  "application/json": {
3276
4585
  /** @constant */
3277
4586
  success: false;
3278
- error: string;
4587
+ code: string;
3279
4588
  };
3280
4589
  };
3281
4590
  };
@@ -3288,97 +4597,148 @@ interface operations {
3288
4597
  "application/json": {
3289
4598
  /** @constant */
3290
4599
  success: false;
3291
- error: string;
4600
+ code: string;
3292
4601
  };
3293
4602
  };
3294
4603
  };
3295
4604
  };
3296
4605
  };
3297
- postAuthLogout: {
3298
- parameters: { query?: never; header?: never; path?: never; cookie?: never };
3299
- requestBody?: {
3300
- content: {
3301
- "application/json": {
3302
- everywhere?: boolean;
3303
- };
3304
- };
4606
+ getDistributionRules: {
4607
+ parameters: {
4608
+ query?: never;
4609
+ header?: never;
4610
+ path?: never;
4611
+ cookie?: never;
3305
4612
  };
4613
+ requestBody?: never;
3306
4614
  responses: {
4615
+ /** @description List of distribution rules with claimability verdict per rule */
3307
4616
  200: {
3308
- headers: { [name: string]: unknown };
4617
+ headers: {
4618
+ [name: string]: unknown;
4619
+ };
3309
4620
  content: {
3310
4621
  "application/json": {
3311
4622
  /** @constant */
3312
- code: "SDK_LOGOUT_SUCCESS";
4623
+ code: "SDK_DISTRIBUTION_RULES_LIST";
3313
4624
  /** @constant */
3314
4625
  success: true;
3315
4626
  content: {
3316
- revoked: number;
4627
+ rules: {
4628
+ id: string;
4629
+ name: string;
4630
+ assetCode: string;
4631
+ amount: string;
4632
+ /** @enum {string} */
4633
+ period: "DAY" | "DAY_CALENDAR" | "WEEK" | "MONTH" | "MONTH_CALENDAR" | "LIFETIME";
4634
+ validFrom: string | null;
4635
+ validUntil: string | null;
4636
+ claimable: boolean;
4637
+ reason: string | null;
4638
+ }[];
3317
4639
  };
3318
4640
  };
3319
4641
  };
3320
4642
  };
3321
- };
3322
- };
3323
- getAuthSessions: {
3324
- parameters: { query?: never; header?: never; path?: never; cookie?: never };
3325
- requestBody?: never;
3326
- responses: {
3327
- 200: {
3328
- headers: { [name: string]: unknown };
4643
+ /** @description Unauthorized */
4644
+ 401: {
4645
+ headers: {
4646
+ [name: string]: unknown;
4647
+ };
3329
4648
  content: {
3330
4649
  "application/json": {
3331
4650
  /** @constant */
3332
- code: "SDK_SESSIONS_LIST";
3333
- /** @constant */
3334
- success: true;
3335
- content: {
3336
- sessions: {
3337
- familyId: string;
3338
- createdAt: string;
3339
- lastUsedAt: string | null;
3340
- userAgent: string | null;
3341
- ipHash: string | null;
3342
- deviceLabel: string | null;
3343
- current: boolean;
3344
- expiresAt: string;
3345
- }[];
3346
- };
4651
+ success: false;
4652
+ code: string;
3347
4653
  };
3348
4654
  };
3349
4655
  };
3350
4656
  };
3351
4657
  };
3352
- deleteAuthSessionByFamilyId: {
4658
+ postDistributionClaim: {
3353
4659
  parameters: {
3354
4660
  query?: never;
3355
4661
  header?: never;
3356
- path: { familyId: string };
4662
+ path?: never;
3357
4663
  cookie?: never;
3358
4664
  };
3359
- requestBody?: never;
4665
+ requestBody: {
4666
+ content: {
4667
+ "application/json": {
4668
+ ruleId: string;
4669
+ };
4670
+ };
4671
+ };
3360
4672
  responses: {
4673
+ /** @description Claim succeeded — payment submitted to Stellar */
3361
4674
  200: {
3362
- headers: { [name: string]: unknown };
4675
+ headers: {
4676
+ [name: string]: unknown;
4677
+ };
3363
4678
  content: {
3364
4679
  "application/json": {
3365
4680
  /** @constant */
3366
- code: "SDK_SESSION_REVOKED";
4681
+ code: "SDK_DISTRIBUTION_CLAIM_OK";
3367
4682
  /** @constant */
3368
4683
  success: true;
3369
4684
  content: {
3370
- revoked: number;
4685
+ ruleId: string;
4686
+ assetCode: string;
4687
+ amount: string;
4688
+ txHash: string | null;
3371
4689
  };
3372
4690
  };
3373
4691
  };
3374
4692
  };
4693
+ /** @description Validation error */
4694
+ 400: {
4695
+ headers: {
4696
+ [name: string]: unknown;
4697
+ };
4698
+ content: {
4699
+ "application/json": {
4700
+ /** @constant */
4701
+ success: false;
4702
+ code: string;
4703
+ };
4704
+ };
4705
+ };
4706
+ /** @description Unauthorized */
4707
+ 401: {
4708
+ headers: {
4709
+ [name: string]: unknown;
4710
+ };
4711
+ content: {
4712
+ "application/json": {
4713
+ /** @constant */
4714
+ success: false;
4715
+ code: string;
4716
+ };
4717
+ };
4718
+ };
4719
+ /** @description Rule not found, user has no wallet, or application has no distribution wallet */
3375
4720
  404: {
3376
- headers: { [name: string]: unknown };
4721
+ headers: {
4722
+ [name: string]: unknown;
4723
+ };
4724
+ content: {
4725
+ "application/json": {
4726
+ /** @constant */
4727
+ success: false;
4728
+ code: string;
4729
+ };
4730
+ };
4731
+ };
4732
+ /** @description Rule not claimable (disabled, expired, exhausted, rate-limited) */
4733
+ 409: {
4734
+ headers: {
4735
+ [name: string]: unknown;
4736
+ };
3377
4737
  content: {
3378
4738
  "application/json": {
3379
4739
  /** @constant */
3380
4740
  success: false;
3381
- error: string;
4741
+ code: string;
3382
4742
  };
3383
4743
  };
3384
4744
  };
@@ -3468,4 +4828,18 @@ declare function pollRampTransaction(api: PollarApiClient, txId: string, { inter
3468
4828
  timeoutMs?: number;
3469
4829
  }): Promise<RampTxStatus>;
3470
4830
 
3471
- export { AUTH_ERROR_CODES, type AdapterFn, AlbedoAdapter, type AuthErrorCode, type AuthState, type BuildProofArgs, type ConnectWalletResponse, 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 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, computeJwkThumbprint, createLocalStorageAdapter, createMemoryAdapter, createOffRamp, createOnRamp, defaultKeyManager, defaultStorage, getKycProviders, getKycStatus, getRampTransaction, getRampsQuote, isValidSession, normalizeHtu, pollKycStatus, pollRampTransaction, type paths as pollarPaths, resolveKyc, startKyc };
4831
+ /**
4832
+ * GET /distribution/rules
4833
+ * Returns the distribution rules visible to the calling sdk-user, each
4834
+ * decorated with `claimable` and (when not claimable) a `reason` ErrorCode
4835
+ * the UI maps to a friendly message.
4836
+ */
4837
+ declare function listDistributionRules(api: PollarApiClient): Promise<DistributionRule[]>;
4838
+ /**
4839
+ * POST /distribution/claim
4840
+ * Claims the given rule for the authenticated sdk-user. Returns the tx hash
4841
+ * once the payment is submitted to Stellar.
4842
+ */
4843
+ declare function claimDistributionRule(api: PollarApiClient, body: DistributionClaimBody): Promise<DistributionClaimContent>;
4844
+
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 };