@cosmosapp/pay_sdk 2.0.0 → 2.1.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.
@@ -129,6 +129,27 @@ declare const WebhookEventType: {
129
129
  readonly PaymentIntentFailed: "PAYMENT_INTENT_FAILED";
130
130
  readonly PaymentIntentCancelled: "PAYMENT_INTENT_CANCELLED";
131
131
  readonly PaymentIntentDeleted: "PAYMENT_INTENT_DELETED";
132
+ readonly ReceiverUpdated: "RECEIVER_UPDATED";
133
+ readonly PayinCreated: "PAYIN_CREATED";
134
+ readonly PayinUpdated: "PAYIN_UPDATED";
135
+ readonly PayinCompleted: "PAYIN_COMPLETED";
136
+ readonly PayoutCreated: "PAYOUT_CREATED";
137
+ readonly PayoutUpdated: "PAYOUT_UPDATED";
138
+ readonly PayoutCompleted: "PAYOUT_COMPLETED";
139
+ readonly SwapCreated: "SWAP_CREATED";
140
+ readonly SwapSubmitted: "SWAP_SUBMITTED";
141
+ readonly SwapSucceeded: "SWAP_SUCCEEDED";
142
+ readonly SwapFailed: "SWAP_FAILED";
143
+ readonly LiquidityCreated: "LIQUIDITY_CREATED";
144
+ readonly LiquiditySubmitted: "LIQUIDITY_SUBMITTED";
145
+ readonly LiquiditySucceeded: "LIQUIDITY_SUCCEEDED";
146
+ readonly LiquidityFailed: "LIQUIDITY_FAILED";
147
+ readonly CrossChainSwapCreated: "CROSS_CHAIN_SWAP_CREATED";
148
+ readonly CrossChainSwapUpdated: "CROSS_CHAIN_SWAP_UPDATED";
149
+ readonly CrossChainSwapSucceeded: "CROSS_CHAIN_SWAP_SUCCEEDED";
150
+ readonly CrossChainSwapRefunded: "CROSS_CHAIN_SWAP_REFUNDED";
151
+ readonly CrossChainSwapFailed: "CROSS_CHAIN_SWAP_FAILED";
152
+ readonly CrossChainSwapExpired: "CROSS_CHAIN_SWAP_EXPIRED";
132
153
  };
133
154
  type WebhookEventType = (typeof WebhookEventType)[keyof typeof WebhookEventType];
134
155
  /** Delivery state of a single webhook attempt. */
@@ -350,6 +371,46 @@ interface WebhookEvent<T = PaymentIntentData> {
350
371
  createdAt: string;
351
372
  data: T;
352
373
  }
374
+ /** What each webhook event carries in `data`. */
375
+ interface WebhookEventDataMap {
376
+ PAYMENT_INTENT_CREATED: PaymentIntentData;
377
+ PAYMENT_INTENT_UPDATED: PaymentIntentData;
378
+ PAYMENT_INTENT_SUCCEEDED: PaymentIntentData;
379
+ PAYMENT_INTENT_FAILED: PaymentIntentData;
380
+ PAYMENT_INTENT_CANCELLED: PaymentIntentData;
381
+ PAYMENT_INTENT_DELETED: PaymentIntentData;
382
+ /** Identity and state only — ids, status, rails; never personal data. */
383
+ RECEIVER_UPDATED: Record<string, unknown>;
384
+ PAYIN_CREATED: Record<string, unknown>;
385
+ PAYIN_UPDATED: Record<string, unknown>;
386
+ PAYIN_COMPLETED: Record<string, unknown>;
387
+ PAYOUT_CREATED: Record<string, unknown>;
388
+ PAYOUT_UPDATED: Record<string, unknown>;
389
+ PAYOUT_COMPLETED: Record<string, unknown>;
390
+ /** A Stellar swap, or a Solana / Monad one (it carries `chain`). */
391
+ SWAP_CREATED: SwapData | ChainSwapData;
392
+ SWAP_SUBMITTED: SwapData | ChainSwapData;
393
+ SWAP_SUCCEEDED: SwapData | ChainSwapData;
394
+ SWAP_FAILED: SwapData | ChainSwapData;
395
+ LIQUIDITY_CREATED: LiquidityOperationData;
396
+ LIQUIDITY_SUBMITTED: LiquidityOperationData;
397
+ LIQUIDITY_SUCCEEDED: LiquidityOperationData;
398
+ LIQUIDITY_FAILED: LiquidityOperationData;
399
+ CROSS_CHAIN_SWAP_CREATED: CrossChainSwapData;
400
+ CROSS_CHAIN_SWAP_UPDATED: CrossChainSwapData;
401
+ CROSS_CHAIN_SWAP_SUCCEEDED: CrossChainSwapData;
402
+ CROSS_CHAIN_SWAP_REFUNDED: CrossChainSwapData;
403
+ CROSS_CHAIN_SWAP_FAILED: CrossChainSwapData;
404
+ CROSS_CHAIN_SWAP_EXPIRED: CrossChainSwapData;
405
+ }
406
+ /** One webhook event of a known type, with `data` typed for it. */
407
+ type TypedWebhookEvent<K extends keyof WebhookEventDataMap> = Omit<WebhookEvent<WebhookEventDataMap[K]>, 'type'> & {
408
+ type: K;
409
+ };
410
+ /** Any webhook event — narrow on `type` to get `data` typed. */
411
+ type AnyWebhookEvent = {
412
+ [K in keyof WebhookEventDataMap]: TypedWebhookEvent<K>;
413
+ }[keyof WebhookEventDataMap];
353
414
  /** Body for `POST /v1/products`. */
354
415
  interface CreateProductOptions {
355
416
  name: string;
@@ -513,37 +574,65 @@ interface HealthCheckData {
513
574
  status: string;
514
575
  } & Record<string, unknown>>;
515
576
  }
577
+ /**
578
+ * The chain a same-chain swap runs on. `stellar` (the default when omitted) is
579
+ * the Stellar DEX; `solana` goes through Jupiter and `monad` through Kuru Flow,
580
+ * both mainnet only.
581
+ */
582
+ type SwapChain = 'stellar' | 'solana' | 'monad';
583
+ /** The chains off Stellar, whose swaps come back as a {@link ChainSwapData}. */
584
+ type OtherSwapChain = Exclude<SwapChain, 'stellar'>;
516
585
  /** Body for `POST /v1/swaps/quote` (pricing only; no fee parameter — the fee is enforced server-side per organization). */
517
586
  interface QuoteSwapOptions {
518
- /** Amount to send, as a decimal string (max 7 decimals). */
587
+ /** Which chain to swap on. Omitted means Stellar. */
588
+ chain?: SwapChain;
589
+ /** Amount to send, as a decimal string in the asset's own units (max 7 decimals on Stellar). */
519
590
  amount: string;
520
- /** Source asset code. Omit (or `XLM`/`native`) for native lumens. */
591
+ /**
592
+ * Stellar: asset code (omit, `XLM` or `native` for lumens). Solana / Monad:
593
+ * `SOL` / `MON`, `native`, or the SPL mint / ERC-20 address.
594
+ */
521
595
  sourceAssetCode?: string;
522
- /** Issuer account for a non-native source asset. */
596
+ /** Stellar only: issuer account for a non-native source asset. */
523
597
  sourceAssetIssuer?: string;
524
- /** Destination asset code the swap should deliver. */
598
+ /** The asset the swap should deliver, spelled as for `sourceAssetCode`. */
525
599
  destAssetCode: string;
526
- /** Issuer account for a non-native destination asset. */
600
+ /** Stellar only: issuer account for a non-native destination asset. */
527
601
  destAssetIssuer?: string;
528
602
  /** Allowed slippage in basis points. */
529
603
  slippageBps?: number;
530
604
  }
531
605
  /** Body for `POST /v1/swaps`. */
532
606
  interface CreateSwapOptions extends QuoteSwapOptions {
533
- /** Source account performing the swap. A registered address-book name also works. */
607
+ /** Source account performing (and signing) the swap, on `chain`. A registered address-book name also works on Stellar. */
534
608
  source: string;
535
- /** Destination account that receives the swapped asset. Defaults to the source. */
609
+ /** Stellar only: account that receives the swapped asset. Defaults to the source. */
536
610
  destination?: string;
537
- /** MEMO_ID (numeric uint64) for idempotency + on-chain identification. */
611
+ /** Stellar only: MEMO_ID (numeric uint64) for idempotency + on-chain identification. */
538
612
  memo?: string;
613
+ /** Idempotency key (the `Idempotency-Key` header is preferred when both are set). */
614
+ idempotencyKey?: string;
539
615
  }
540
- /** Body for `POST /v1/swaps/:id/submit`. */
541
- interface SubmitSwapOptions {
542
- /** Signed transaction envelope (base64 XDR) to relay to the network. */
616
+ /**
617
+ * Body for `POST /v1/swaps/:id/submit`: `signedXdr` for a Stellar swap,
618
+ * `signedTransaction` for a Solana or Monad one.
619
+ */
620
+ type SubmitSwapOptions = {
621
+ /** Signed transaction envelope (base64 XDR) to relay to the Stellar network. */
543
622
  signedXdr: string;
544
- }
623
+ signedTransaction?: never;
624
+ } | {
625
+ /**
626
+ * Solana: base64 wire bytes of the signed VersionedTransaction. Monad: the
627
+ * `0x`-hex raw signed EIP-1559 transaction.
628
+ */
629
+ signedTransaction: string;
630
+ signedXdr?: never;
631
+ };
545
632
  /** Query for `GET /v1/swaps`. */
546
633
  interface ListSwapsOptions {
634
+ /** Which chain to list. Omitted means Stellar. */
635
+ chain?: SwapChain;
547
636
  status?: SwapStatus;
548
637
  /** Page size (max 100, default 20). */
549
638
  take?: number;
@@ -590,11 +679,16 @@ interface SwapListData {
590
679
  /** Raw pricing quote returned by `POST /v1/swaps/quote`. */
591
680
  interface SwapQuoteData {
592
681
  network: string;
682
+ /** Solana and Monad quotes only. */
683
+ chain?: OtherSwapChain;
684
+ /** The aggregator that priced a Solana or Monad swap. */
685
+ provider?: 'jupiter' | 'kuru';
593
686
  source: {
594
687
  asset: string;
595
688
  issuer: string | null;
596
689
  amount: string;
597
690
  };
691
+ /** Stellar takes the fee from the source asset; Solana and Monad from the output (`asset` says which). */
598
692
  fee: {
599
693
  asset: string;
600
694
  issuer: string | null;
@@ -628,6 +722,214 @@ interface SwapSubmitOutcomeData {
628
722
  resultCodes?: string[];
629
723
  swap: SwapData;
630
724
  }
725
+ /**
726
+ * What a Solana or Monad swap's wallet signs. Solana: an unsigned
727
+ * VersionedTransaction; Monad: a call the wallet signs as an EIP-1559
728
+ * transaction, filling in nonce and gas itself.
729
+ */
730
+ type ChainSwapTransaction = {
731
+ encoding: 'base64';
732
+ data: string;
733
+ lastValidBlockHeight?: number;
734
+ } | {
735
+ to: string;
736
+ data: string;
737
+ value: string;
738
+ chainId: number;
739
+ };
740
+ /** An EVM call the wallet sends itself (a Monad ERC-20 `approve`). */
741
+ interface EvmCallData {
742
+ to: string;
743
+ data: string;
744
+ value: string;
745
+ chainId: number;
746
+ }
747
+ /** Raw Solana or Monad swap (`chain_swap`), built by Jupiter or Kuru Flow. */
748
+ interface ChainSwapData {
749
+ id: string;
750
+ chain: OtherSwapChain;
751
+ /** Always `public`: the aggregators run on mainnet only. */
752
+ network: string;
753
+ provider: 'jupiter' | 'kuru';
754
+ status: SwapStatus;
755
+ /** The wallet that signs, pays and receives. */
756
+ source: string;
757
+ /** `native` (SOL / MON), or the SPL mint / ERC-20 address. */
758
+ sendAsset: string;
759
+ sendAmount: string;
760
+ destAsset: string;
761
+ /** Quoted output, net of the commission. */
762
+ destEstimated: string;
763
+ /** On-chain minimum after slippage. */
764
+ destMin: string;
765
+ feeBps: number;
766
+ /** The commission, in the destination asset (taken from the output). */
767
+ feeAmount: string;
768
+ slippageBps: number;
769
+ path: {
770
+ code: string;
771
+ issuer: string | null;
772
+ }[];
773
+ transaction: ChainSwapTransaction;
774
+ /** Monad, selling an ERC-20 with too small an allowance: send and confirm this first. */
775
+ approval: EvmCallData | null;
776
+ /** The Solana signature / EVM hash, once submitted. */
777
+ txHash: string | null;
778
+ idempotencyKey: string | null;
779
+ /** Submit refuses the transaction after this; build a new swap. */
780
+ expiresAt: string;
781
+ createdAt: string;
782
+ updatedAt: string;
783
+ }
784
+ /** Raw paginated list of Solana or Monad swaps. */
785
+ interface ChainSwapListData {
786
+ data: ChainSwapData[];
787
+ total: number;
788
+ take: number;
789
+ skip: number;
790
+ }
791
+ /** Raw outcome of relaying a signed Solana or Monad swap. */
792
+ interface ChainSwapSubmitOutcomeData {
793
+ submitted: boolean;
794
+ status: SwapStatus;
795
+ txHash: string;
796
+ swap: ChainSwapData;
797
+ }
798
+ /** Where a cross-chain swap stands. SUCCEEDED, REFUNDED and FAILED are final. */
799
+ declare const CrossChainSwapStatus: {
800
+ readonly AwaitingDeposit: "AWAITING_DEPOSIT";
801
+ readonly DepositDetected: "DEPOSIT_DETECTED";
802
+ readonly IncompleteDeposit: "INCOMPLETE_DEPOSIT";
803
+ readonly Processing: "PROCESSING";
804
+ readonly Succeeded: "SUCCEEDED";
805
+ readonly Refunded: "REFUNDED";
806
+ readonly Failed: "FAILED";
807
+ readonly Expired: "EXPIRED";
808
+ };
809
+ type CrossChainSwapStatus = (typeof CrossChainSwapStatus)[keyof typeof CrossChainSwapStatus];
810
+ /** A token NEAR Intents can swap on one of the supported chains. */
811
+ interface CrossChainAssetData {
812
+ chain: SwapChain;
813
+ symbol: string;
814
+ /** NEAR Intents' id for the asset. */
815
+ assetId: string;
816
+ decimals: number;
817
+ /** SPL mint, ERC-20 address or Stellar issuer; null for the native coin. */
818
+ contract: string | null;
819
+ }
820
+ /**
821
+ * Body for `POST /v1/cross-chain-swaps/quote`. Both legs on one chain is not a
822
+ * cross-chain swap — use `client.swaps` with `chain`.
823
+ */
824
+ interface QuoteCrossChainSwapOptions {
825
+ originChain: SwapChain;
826
+ /** Native ticker, a symbol listed once, a contract, or Stellar `CODE:ISSUER`. */
827
+ originAsset: string;
828
+ destinationChain: SwapChain;
829
+ destinationAsset: string;
830
+ /** Gross amount of the origin asset, in its own units. */
831
+ amount: string;
832
+ /** Who receives the output, on `destinationChain`. */
833
+ recipient: string;
834
+ /** Where a failed or late deposit is refunded, on `originChain`. */
835
+ refundTo: string;
836
+ slippageBps?: number;
837
+ }
838
+ /** Body for `POST /v1/cross-chain-swaps`. */
839
+ interface CreateCrossChainSwapOptions extends QuoteCrossChainSwapOptions {
840
+ idempotencyKey?: string;
841
+ }
842
+ /** Raw cross-chain quote. */
843
+ interface CrossChainQuoteData {
844
+ network: string;
845
+ origin: {
846
+ chain: SwapChain;
847
+ asset: string;
848
+ assetId: string;
849
+ contract: string | null;
850
+ amount: string;
851
+ amountUsd: string | null;
852
+ };
853
+ destination: {
854
+ chain: SwapChain;
855
+ asset: string;
856
+ assetId: string;
857
+ contract: string | null;
858
+ amount: string;
859
+ amountUsd: string | null;
860
+ /** Below this NEAR Intents refunds instead of filling. */
861
+ minimum: string;
862
+ };
863
+ /** The plan commission, taken by NEAR Intents out of the input. */
864
+ fee: {
865
+ bps: number;
866
+ amount: string;
867
+ asset: string;
868
+ };
869
+ slippageBps: number;
870
+ timeEstimateSeconds: number;
871
+ }
872
+ /** A settlement transaction NEAR Intents reports. */
873
+ interface CrossChainTransactionData {
874
+ hash: string;
875
+ explorerUrl: string;
876
+ }
877
+ /** Raw cross-chain swap. */
878
+ interface CrossChainSwapData {
879
+ id: string;
880
+ status: CrossChainSwapStatus;
881
+ /** NEAR Intents' own status word, verbatim. */
882
+ providerStatus: string;
883
+ network: string;
884
+ originChain: SwapChain;
885
+ originAsset: string;
886
+ originContract: string | null;
887
+ destinationChain: SwapChain;
888
+ destinationAsset: string;
889
+ destinationContract: string | null;
890
+ amountIn: string;
891
+ feeBps: number;
892
+ feeAmount: string;
893
+ amountOutEstimated: string;
894
+ amountOutMin: string;
895
+ slippageBps: number;
896
+ recipient: string;
897
+ refundTo: string;
898
+ /** Send exactly `amountIn` of the origin asset here. */
899
+ depositAddress: string;
900
+ /** Stellar only, and required: attach it as a MEMO_TEXT. */
901
+ depositMemo: string | null;
902
+ /** The deposit as a wallet link: SEP-7 pay, Solana Pay or EIP-681. */
903
+ depositUri: string;
904
+ /** QR of `depositUri` (PNG data URL); absent from list rows. */
905
+ qr?: string;
906
+ depositTxHash: string | null;
907
+ amountOut: string | null;
908
+ refundedAmount: string | null;
909
+ originTxHashes: CrossChainTransactionData[] | null;
910
+ destinationTxHashes: CrossChainTransactionData[] | null;
911
+ timeEstimateSeconds: number;
912
+ correlationId: string;
913
+ /** NEAR Intents' signature over the quote and deposit address — keep it. */
914
+ quoteSignature: string;
915
+ idempotencyKey: string | null;
916
+ expiresAt: string;
917
+ createdAt: string;
918
+ updatedAt: string;
919
+ }
920
+ /** Query for `GET /v1/cross-chain-swaps`. */
921
+ interface ListCrossChainSwapsOptions {
922
+ status?: CrossChainSwapStatus;
923
+ take?: number;
924
+ skip?: number;
925
+ }
926
+ /** Raw paginated list of cross-chain swaps. */
927
+ interface CrossChainSwapListData {
928
+ data: CrossChainSwapData[];
929
+ total: number;
930
+ take: number;
931
+ skip: number;
932
+ }
631
933
  /** Body for `POST /v1/liquidity-pools/deposit`. */
632
934
  interface DepositLiquidityOptions {
633
935
  /** Account whose funds go in, and which signs. An address-book name also works. */
@@ -1376,182 +1678,225 @@ interface WalletSignMessageData {
1376
1678
  message?: string;
1377
1679
  [key: string]: unknown;
1378
1680
  }
1379
- /** Identity providers a Pollar login can go through. */
1380
- type PollarProvider = 'google' | 'github';
1381
- /** State of a login, polled between the redirect and the token exchange. */
1382
- type PollarLoginStatus = 'pending' | 'authorized' | 'exchanging' | 'consumed' | 'failed' | 'expired';
1383
- /** A Pollar wallet, as returned alongside a session or a registration. */
1384
- interface PollarWalletData {
1385
- type: 'internal' | 'smart' | 'external';
1386
- address: string | null;
1387
- chain: 'STELLAR' | 'POLYGON' | 'SOLANA';
1388
- /** False until the reserve is funded — see {@link PollarManager.activateWallet}. */
1389
- exists_on_stellar?: boolean;
1390
- funding_mode?: 'IMMEDIATE' | 'DEFERRED';
1391
- network?: string;
1681
+ /** One status change of a payment intent — `GET /v1/payment-intents/{id}/transitions`. */
1682
+ interface PaymentIntentTransitionData {
1683
+ id: string;
1684
+ intentId: string;
1685
+ fromStatus: PaymentIntentStatus;
1686
+ toStatus: PaymentIntentStatus;
1687
+ txHash?: string | null;
1688
+ /** Who moved it: `api`, `validate`, `observer` or `system`. */
1689
+ actor: string;
1690
+ reason?: string | null;
1691
+ createdAt: string;
1392
1692
  }
1393
- /** The public half of the DPoP key a client binds its session to. */
1394
- interface PollarDpopJwk {
1395
- kty: 'EC';
1396
- crv: 'P-256';
1397
- x: string;
1398
- y: string;
1399
- }
1400
- /** The fields both login flows accept. */
1401
- interface PollarAuthorizeBaseOptions {
1402
- provider: PollarProvider;
1403
- code_challenge_method?: 'S256';
1404
- /** Binds the resulting session to a key this client holds. */
1405
- dpop_jwk?: PollarDpopJwk;
1406
- /** Shown to the user in their session list. */
1407
- device_label?: string;
1693
+ /** Query for `GET /v1/assets`. */
1694
+ interface ListRegistryAssetsOptions {
1695
+ network?: 'public' | 'testnet';
1696
+ /** Only the entries whose issuer was checked against the named organization. */
1697
+ verified?: boolean;
1408
1698
  }
1409
- /**
1410
- * Body for `POST /v1/pollar/oauth/authorize`.
1411
- *
1412
- * The code that comes back is redeemed with the `code_verifier` the challenge was
1413
- * derived from, so an intercepted code is worth nothing without the client that
1414
- * started the flow. How much that matters depends on the flow, and the type follows:
1415
- *
1416
- * - **Redirect** (`redirect_uri` set): `code_challenge` is required. The code crosses
1417
- * a browser, and the public callback hands it to whoever presents `state` — which
1418
- * is inside `authorization_url` — so the service answers `400 validation_failed`
1419
- * to a redirect-flow authorize without one.
1420
- * - **Poll** (no `redirect_uri`): the code only travels over your authenticated
1421
- * channel, so PKCE is optional. Send it anyway.
1422
- */
1423
- type PollarAuthorizeOptions = (PollarAuthorizeBaseOptions & {
1424
- /** Where the browser lands with the code. Must be allow-listed for the consumer. */
1425
- redirect_uri: string;
1426
- /** Base64url SHA-256 of the verifier held by the client. */
1427
- code_challenge: string;
1428
- }) | (PollarAuthorizeBaseOptions & {
1429
- redirect_uri?: undefined;
1430
- /** Base64url SHA-256 of the verifier held by the client. */
1431
- code_challenge?: string;
1432
- });
1433
- /** Raw authorize response — where to send the user, and what to poll. */
1434
- interface PollarAuthorizeData {
1435
- /** Correlates the login. Poll `sessions/{state}` with it. */
1436
- state: string;
1437
- /** The URL to open for the user. */
1438
- authorization_url: string;
1439
- provider: PollarProvider;
1440
- redirect_uri: string | null;
1441
- expires_at: string;
1442
- }
1443
- /** Raw polling response for a login in progress. */
1444
- interface PollarLoginSessionData {
1445
- status: PollarLoginStatus;
1446
- state: string;
1447
- /** The bridge code to redeem — present once `status` is `authorized`. */
1448
- code?: string;
1449
- code_expires_at?: string | null;
1450
- error_code?: string | null;
1451
- }
1452
- /** Body for `POST /v1/pollar/oauth/token`. */
1453
- interface PollarTokenOptions {
1454
- /** The bridge code collected from the polled session. */
1699
+ /** One `(code, issuer)` pair the server vouches for — or lists, unverified. */
1700
+ interface RegistryAssetData {
1455
1701
  code: string;
1456
- /** The PKCE verifier the challenge was derived from. Required when `authorize` sent a `code_challenge`. */
1457
- code_verifier?: string;
1702
+ /** Issuing account, or `null` for native XLM. */
1703
+ issuer: string | null;
1704
+ name: string;
1705
+ /** Who issues it, for display next to the code. */
1706
+ issuerName: string;
1707
+ /** The issuer's own on-chain `home_domain`, or empty when it publishes none. */
1708
+ issuerDomain: string;
1709
+ /** The issuing account was checked against `issuerName` — identity, not quality. */
1710
+ verified: boolean;
1711
+ /** Stellar Asset Contract id, when wrapped for Soroban. */
1712
+ contract: string | null;
1713
+ flags: {
1714
+ authRevocable: boolean;
1715
+ clawback: boolean;
1716
+ };
1458
1717
  }
1459
- /** A user profile as Pollar knows it. */
1460
- interface PollarProfileData {
1461
- email?: string;
1462
- first_name?: string;
1463
- last_name?: string;
1464
- avatar?: string;
1465
- [key: string]: unknown;
1718
+ /** Raw `GET /v1/assets` response. */
1719
+ interface AssetRegistryData {
1720
+ network: 'public' | 'testnet';
1721
+ /** Monotonic registry version: compare it against a bundled copy. */
1722
+ version: number;
1723
+ data: RegistryAssetData[];
1466
1724
  }
1467
- /** Raw Pollar session — the tokens, the wallets and the profile. */
1468
- interface PollarSessionData {
1469
- access_token: string;
1470
- refresh_token?: string;
1471
- token_type?: 'Bearer' | 'DPoP';
1472
- /** Unix seconds. */
1473
- expires_at?: number;
1474
- user_id?: string | null;
1475
- /** The primary wallet; `wallets` carries the rest. */
1476
- wallet?: PollarWalletData;
1477
- wallets?: PollarWalletData[];
1478
- profile?: PollarProfileData;
1479
- }
1480
- /** Body for `POST /v1/pollar/oauth/refresh`. */
1481
- interface PollarRefreshOptions {
1482
- refresh_token: string;
1483
- }
1484
- /** Raw rotated token pair. */
1485
- interface PollarRefreshData {
1486
- access_token: string;
1487
- refresh_token?: string;
1488
- token_type?: 'Bearer';
1489
- expires_at?: number;
1490
- }
1491
- /** Body for `POST /v1/pollar/oauth/logout`. */
1492
- interface PollarLogoutOptions {
1493
- access_token: string;
1494
- /** Revoke every device, not just this one. */
1495
- everywhere?: boolean;
1496
- }
1497
- /** How many sessions the logout revoked. */
1498
- interface PollarLogoutData {
1499
- revoked: number;
1500
- }
1501
- /** Body for `POST /v1/pollar/wallets/activate`. */
1502
- interface ActivatePollarWalletOptions {
1503
- public_key: string;
1504
- }
1505
- /** Raw activation result — the reserve that was funded. */
1506
- interface PollarActivationData {
1507
- public_key: string;
1508
- /** XLM sent to cover the base reserve. */
1509
- amount: string;
1510
- activated: boolean;
1725
+ type AliasChallengePurpose = 'CLAIM' | 'ADD_ADDRESS' | 'RECOVER';
1726
+ /** One verified address an alias points at. */
1727
+ interface AliasAddressData {
1728
+ id: string;
1729
+ address: string;
1730
+ network: string;
1731
+ label?: string | null;
1732
+ /** The default for this network. */
1733
+ isPrimary: boolean;
1734
+ /** When this address proved control of itself. */
1735
+ verifiedAt: string;
1736
+ }
1737
+ /** `GET /v1/aliases/resolve/{name}` — where to pay a handle. */
1738
+ interface AliasResolutionData {
1739
+ name: string;
1740
+ displayName: string;
1741
+ /** Every verified address on the requested network, primary first. */
1742
+ addresses: AliasAddressData[];
1743
+ /** The address to pay when the payer did not choose one. */
1744
+ primaryAddress?: string | null;
1745
+ }
1746
+ /** `GET /v1/aliases/availability/{name}`. */
1747
+ interface AliasAvailabilityData {
1748
+ name: string;
1749
+ available: boolean;
1750
+ /** Why not, when unavailable: `taken`, `reserved`, `bad_characters`, … */
1751
+ reason?: string | null;
1511
1752
  }
1512
- /** One asset to enable on a wallet. */
1513
- interface PollarTrustlineAsset {
1514
- code: string;
1515
- issuer: string;
1753
+ /** `GET /v1/aliases/by-address/{address}`. */
1754
+ interface AliasByAddressData {
1755
+ data: {
1756
+ name: string;
1757
+ displayName: string;
1758
+ network: string;
1759
+ isPrimary: boolean;
1760
+ }[];
1516
1761
  }
1517
- /** Body for `POST /v1/pollar/wallets/:address/trustlines`. */
1518
- interface PollarTrustlinesOptions {
1519
- assets: PollarTrustlineAsset[];
1762
+ /** Body for `POST /v1/aliases/challenges`. */
1763
+ interface CreateAliasChallengeOptions {
1764
+ /** The handle being claimed. */
1765
+ name: string;
1766
+ address: string;
1767
+ /** Network id: `public`, `testnet`, or a custom id. */
1768
+ network: string;
1769
+ purpose?: AliasChallengePurpose;
1770
+ }
1771
+ /** A nonce to sign — `POST /v1/aliases/challenges`. */
1772
+ interface AliasChallengeData {
1773
+ nonce: string;
1774
+ /** The EXACT string to digest and sign. Sign this, never a string you rebuilt. */
1775
+ message: string;
1776
+ /** Domain tag the digest is framed with. */
1777
+ domain: string;
1778
+ purpose: AliasChallengePurpose;
1779
+ expiresAt: string;
1780
+ }
1781
+ /** Body for `POST /v1/aliases`. */
1782
+ interface ClaimAliasOptions {
1783
+ name: string;
1784
+ /** Recovery mailbox — required at claim time. */
1785
+ email: string;
1786
+ /** The nonce from a CLAIM challenge. */
1787
+ nonce: string;
1788
+ /** base64 ed25519 over the challenge digest. */
1789
+ signature: string;
1790
+ /** Human label for this first address. */
1791
+ label?: string;
1792
+ }
1793
+ /** Body for `POST /v1/aliases/{name}/addresses`. */
1794
+ interface AddAliasAddressOptions {
1795
+ address: string;
1796
+ network: string;
1797
+ /** The nonce from an ADD_ADDRESS challenge. */
1798
+ nonce: string;
1799
+ signature: string;
1800
+ label?: string;
1801
+ /** Make this the address a payer gets when they do not ask for one. */
1802
+ primary?: boolean;
1803
+ }
1804
+ /** Body for `POST /v1/aliases/{name}/recovery/complete`. */
1805
+ interface CompleteAliasRecoveryOptions {
1806
+ /** The token delivered by email. */
1807
+ token: string;
1808
+ /** The address that will own the alias from now on. */
1809
+ address: string;
1810
+ network: string;
1811
+ /** The nonce from a RECOVER challenge. */
1812
+ nonce: string;
1813
+ signature: string;
1520
1814
  }
1521
- /** Raw trustline result — a status code for the operation. */
1522
- interface PollarTrustlineData {
1523
- code: string;
1524
- [key: string]: unknown;
1815
+ /** An alias the caller owns. */
1816
+ interface OwnedAliasData {
1817
+ id: string;
1818
+ /** Normalized handle — the form uniqueness is decided on. */
1819
+ name: string;
1820
+ /** As the claimant typed it. Display only. */
1821
+ displayName: string;
1822
+ status: 'ACTIVE' | 'SUSPENDED';
1823
+ addresses: AliasAddressData[];
1824
+ createdAt: string;
1825
+ email: string;
1826
+ emailVerifiedAt?: string | null;
1525
1827
  }
1526
- /** Body for `POST /v1/pollar/users` and `/users/with-wallet`. */
1527
- interface RegisterPollarUserOptions {
1528
- /** Your own id for this user — how you find them again. */
1529
- external_id: string;
1530
- email?: string;
1531
- first_name?: string;
1532
- last_name?: string;
1533
- avatar?: string;
1828
+ /** Raw `GET /v1/aliases` page. */
1829
+ interface AliasListData {
1830
+ data: OwnedAliasData[];
1831
+ total: number;
1832
+ take: number;
1833
+ skip: number;
1834
+ }
1835
+ /** `DELETE` answers for aliases and alias addresses. */
1836
+ interface AliasDeletedData {
1837
+ id: string;
1838
+ deleted: boolean;
1534
1839
  }
1535
- /** Raw registration result. */
1536
- interface PollarUserData {
1537
- external_id: string;
1538
- code: 'SERVER_USER_REGISTERED' | 'SERVER_USER_WALLET_CREATED';
1539
- user_id: string | null;
1540
- wallet?: PollarWalletData;
1840
+ /** Answer of `POST /v1/aliases/:name/recovery` — the same whether or not the mailbox matches. */
1841
+ interface AliasRecoveryStartedData {
1842
+ accepted: boolean;
1541
1843
  }
1542
- /** Body for `POST /v1/pollar/tokens/verify`. */
1543
- interface VerifyPollarTokenOptions {
1544
- token: string;
1844
+ /** The shared public API key an open-source wallet embeds, per environment. */
1845
+ interface PublicKeyData {
1846
+ env: 'dev' | 'prod';
1847
+ apiKey: string;
1545
1848
  }
1546
- /** Raw verification result — who the token belongs to, and until when. */
1547
- interface PollarTokenVerificationData {
1548
- user_id: string;
1549
- application_id: string;
1550
- /** Unix seconds. */
1551
- expires_at: number;
1552
- network?: string;
1553
- auth_provider?: string;
1554
- wallet?: PollarWalletData;
1849
+ /** A plugin this deployment serves, and this consumer's installation of it. */
1850
+ interface PluginData {
1851
+ slug: string;
1852
+ name: string;
1853
+ version: string;
1854
+ description: string;
1855
+ author: string;
1856
+ /** What the plugin may do; installing is consenting to exactly this list. */
1857
+ capabilities: string[];
1858
+ /** Hosts the plugin may call out to. */
1859
+ egress: string[];
1860
+ config: Record<string, unknown>;
1861
+ queries: unknown[];
1862
+ commands: unknown[];
1863
+ events: unknown[];
1864
+ /** Null when this consumer has not installed it. */
1865
+ installation: Record<string, unknown> | null;
1866
+ }
1867
+ interface PluginListData {
1868
+ data: PluginData[];
1869
+ }
1870
+ /** Body for `PUT /v1/plugins/:slug/installation`. */
1871
+ interface InstallPluginOptions {
1872
+ /** Exactly the capabilities the plugin declares — consent is all or nothing. */
1873
+ grantCapabilities: string[];
1874
+ config?: Record<string, unknown>;
1875
+ }
1876
+ interface PluginUninstalledData {
1877
+ slug: string;
1878
+ uninstalled: boolean;
1879
+ }
1880
+ /** Result of a plugin query or command. */
1881
+ interface PluginActionResultData<T = unknown> {
1882
+ plugin: string;
1883
+ action: string;
1884
+ output: T;
1885
+ }
1886
+ /** Body for `POST /v1/defindex/vaults/:vault/deposit`. */
1887
+ interface DefindexDepositOptions {
1888
+ /** One amount per vault asset, in its base units. */
1889
+ amounts: string[];
1890
+ /** The account that signs. */
1891
+ caller: string;
1892
+ invest?: boolean;
1893
+ slippageBps?: number;
1894
+ }
1895
+ /** Body for `POST /v1/defindex/vaults/:vault/withdraw`. */
1896
+ interface DefindexWithdrawOptions {
1897
+ shares: string;
1898
+ caller: string;
1899
+ slippageBps?: number;
1555
1900
  }
1556
1901
 
1557
1902
  /**
@@ -1694,4 +2039,4 @@ interface ResolvableIntentInput {
1694
2039
  */
1695
2040
  declare function resolveIntentBody<T extends ResolvableIntentInput>(options: T, book?: AddressBook): Omit<T, 'asset'>;
1696
2041
 
1697
- export { type CreateReceiverOptions as $, type AnalyticsSummaryData as A, type BrowseLiquidityPoolsOptions as B, type CustomerData as C, type DepositLiquidityOptions as D, type ListActivityOptions as E, type ActivityListData as F, type ActivitySummaryData as G, type HealthCheckData as H, type ReceiverData as I, type UpdateReceiverOptions as J, type ApproveReceiverOptions as K, type LiquidityOperationData as L, type RequestTosOptions as M, type TermsOfServiceData as N, type EnableReceiverOptions as O, type PayinQuoteData as P, type CreateReceiverWalletOptions as Q, type ReportActivityOptions as R, type SubmitLiquidityOptions as S, type TrustlineData as T, type UpdateCustomerOptions as U, type VirtualAccountData as V, type WebhookLogsData as W, type ReceiverWalletData as X, type ListKycOptions as Y, type CreateBankAccountOptions as Z, type BankAccountData as _, type AnalyticsBalancesData as a, type AnalyticsVolumeEntry as a$, type SetReceiverAccessOptions as a0, type WalletSignMessageData as a1, type KycUploadData as a2, type InitiateTosOptions as a3, type KycRailsData as a4, type BankDetailsData as a5, type PollarAuthorizeOptions as a6, type PollarAuthorizeData as a7, type PollarLoginSessionData as a8, type PollarTokenOptions as a9, type CreateProductOptions as aA, type SwapData as aB, SwapStatus as aC, type SubmitSwapOptions as aD, type QuoteSwapOptions as aE, type SwapQuoteData as aF, type CreateSwapOptions as aG, type ListSwapsOptions as aH, type WebhookDeliveryData as aI, WebhookEventType as aJ, WebhookDeliveryStatus as aK, type WebhookEndpointData as aL, type WebhookEndpointWithSecretData as aM, type UpdateWebhookEndpointOptions as aN, type WebhookPingData as aO, type ListWebhookDeliveriesOptions as aP, type WebhookEvent as aQ, type CreateWebhookEndpointOptions as aR, type ActivityBucket as aS, type ActivityEventData as aT, type ActivityLevel as aU, type ActivitySource as aV, AddressBook as aW, type AddressRef as aX, type AnalyticsBalanceEntry as aY, type AnalyticsRecentRow as aZ, type AnalyticsSeriesPoint as a_, type PollarSessionData as aa, type PollarRefreshOptions as ab, type PollarRefreshData as ac, type PollarLogoutOptions as ad, type PollarLogoutData as ae, type VerifyPollarTokenOptions as af, type PollarTokenVerificationData as ag, type ActivatePollarWalletOptions as ah, type PollarActivationData as ai, type PollarTrustlineData as aj, type PollarTrustlinesOptions as ak, type RegisterPollarUserOptions as al, type PollarUserData as am, type PaymentIntentData as an, PaymentIntentKind as ao, PaymentIntentStatus as ap, type UpdatePaymentIntentOptions as aq, type DeletedData as ar, type ValidationOutcomeData as as, type CreateTxPaymentIntentOptions as at, type CreatePayPaymentIntentOptions as au, type ListPaymentIntentsOptions as av, type ValidatePaymentIntentOptions as aw, type ProductData as ax, ProductKind as ay, type UpdateProductOptions as az, type ApiLogsData as b, type ApiLogRow as b0, type AssetDefinition as b1, type AssetRef as b2, Assets as b3, type BankAccountListData as b4, type BankRail as b5, type BankingPartner as b6, CosmosPayAPIError as b7, CosmosPayRequestError as b8, type CurrencyType as b9, type ReceiverWalletNetwork as bA, type ResolvableIntentInput as bB, type ResolvedAsset as bC, type SwapListData as bD, type SwapSubmitOutcomeData as bE, TestnetAssets as bF, type WalletId as bG, Wallets as bH, type WebhookDeliveryListData as bI, type WebhookLogRow as bJ, addresses as bK, assertAddress as bL, defineAsset as bM, isAddress as bN, isContractAddress as bO, isMuxedAddress as bP, isNativeAsset as bQ, isStellarAddress as bR, resolveAddress as bS, resolveAsset as bT, resolveIntentBody as bU, type CustomerListData as ba, type KycType as bb, type LiquidityOperationListData as bc, type LiquidityPoolListData as bd, type LiquidityPositionData as be, type LiquidityReserveData as bf, type LiquiditySubmitOutcomeData as bg, type PayinListData as bh, type PayinMethod as bi, type PayinPayerRules as bj, type PaymentIntentListData as bk, type PayoutChain as bl, type PayoutListData as bm, type PayoutNetwork as bn, type PollarAuthorizeBaseOptions as bo, type PollarDpopJwk as bp, type PollarLoginStatus as bq, type PollarProfileData as br, type PollarProvider as bs, type PollarTrustlineAsset as bt, type PollarWalletData as bu, type RampToken as bv, type ReceiverListData as bw, type ReceiverOwner as bx, type ReceiverType as by, type ReceiverWalletListData as bz, type CreateCustomerOptions as c, LiquidityOperationKind as d, LiquidityOperationStatus as e, type WithdrawLiquidityOptions as f, type LiquidityPositionsData as g, type LiquidityPoolData as h, type ListLiquidityOperationsOptions as i, type CreatePayinQuoteOptions as j, type CreatePayinOptions as k, type PayinData as l, type ListPayinsOptions as m, type CreateTrustlineOptions as n, type CreateVirtualAccountOptions as o, type CreatePayoutQuoteOptions as p, type PayoutQuoteData as q, type AuthorizePayoutOptions as r, type AuthorizePayoutData as s, type CreatePayoutOptions as t, type PayoutData as u, type ListPayoutsOptions as v, type AttachPayoutDocumentOptions as w, type PayoutDocumentData as x, type ActivityEventInput as y, type ActivityReportData as z };
2042
+ export { type ActivityReportData as $, type AliasResolutionData as A, type BrowseLiquidityPoolsOptions as B, type CreateAliasChallengeOptions as C, type DepositLiquidityOptions as D, type ListPayinsOptions as E, type CreateTrustlineOptions as F, type CreateVirtualAccountOptions as G, type HealthCheckData as H, type CreatePayoutQuoteOptions as I, type PayoutQuoteData as J, type AuthorizePayoutOptions as K, type ListRegistryAssetsOptions as L, type AuthorizePayoutData as M, type CreatePayoutOptions as N, type OwnedAliasData as O, type PayinQuoteData as P, type PayoutData as Q, type ListPayoutsOptions as R, type SubmitLiquidityOptions as S, type TrustlineData as T, type UpdateCustomerOptions as U, type VirtualAccountData as V, type WebhookLogsData as W, type AttachPayoutDocumentOptions as X, type PayoutDocumentData as Y, type ActivityEventInput as Z, type ReportActivityOptions as _, type AliasAvailabilityData as a, type WebhookDeliveryData as a$, type ListActivityOptions as a0, type ActivityListData as a1, type ActivitySummaryData as a2, type ReceiverData as a3, type UpdateReceiverOptions as a4, type ApproveReceiverOptions as a5, type RequestTosOptions as a6, type TermsOfServiceData as a7, type EnableReceiverOptions as a8, type CreateReceiverWalletOptions as a9, type PublicKeyData as aA, type PaymentIntentData as aB, PaymentIntentKind as aC, PaymentIntentStatus as aD, type UpdatePaymentIntentOptions as aE, type DeletedData as aF, type ValidationOutcomeData as aG, type CreateTxPaymentIntentOptions as aH, type CreatePayPaymentIntentOptions as aI, type PaymentIntentTransitionData as aJ, type ListPaymentIntentsOptions as aK, type ValidatePaymentIntentOptions as aL, type ProductData as aM, ProductKind as aN, type UpdateProductOptions as aO, type CreateProductOptions as aP, type ChainSwapData as aQ, type OtherSwapChain as aR, SwapStatus as aS, type ChainSwapTransaction as aT, type EvmCallData as aU, type SwapData as aV, type QuoteSwapOptions as aW, type SwapQuoteData as aX, type CreateSwapOptions as aY, type ListSwapsOptions as aZ, type SubmitSwapOptions as a_, type ReceiverWalletData as aa, type ListKycOptions as ab, type CreateBankAccountOptions as ac, type BankAccountData as ad, type CreateReceiverOptions as ae, type SetReceiverAccessOptions as af, type WalletSignMessageData as ag, type KycUploadData as ah, type InitiateTosOptions as ai, type KycRailsData as aj, type BankDetailsData as ak, type CrossChainSwapData as al, CrossChainSwapStatus as am, type SwapChain as an, type CrossChainTransactionData as ao, type CrossChainAssetData as ap, type QuoteCrossChainSwapOptions as aq, type CrossChainQuoteData as ar, type CreateCrossChainSwapOptions as as, type ListCrossChainSwapsOptions as at, type DefindexDepositOptions as au, type DefindexWithdrawOptions as av, type PluginData as aw, type InstallPluginOptions as ax, type PluginUninstalledData as ay, type PluginActionResultData as az, type AliasByAddressData as b, type WalletId as b$, WebhookEventType as b0, WebhookDeliveryStatus as b1, type WebhookEndpointData as b2, type WebhookEndpointWithSecretData as b3, type UpdateWebhookEndpointOptions as b4, type WebhookPingData as b5, type ListWebhookDeliveriesOptions as b6, type AnyWebhookEvent as b7, type WebhookEventDataMap as b8, type TypedWebhookEvent as b9, type CustomerListData as bA, type KycType as bB, type LiquidityOperationListData as bC, type LiquidityPoolListData as bD, type LiquidityPositionData as bE, type LiquidityReserveData as bF, type LiquiditySubmitOutcomeData as bG, type PayinListData as bH, type PayinMethod as bI, type PayinPayerRules as bJ, type PaymentIntentListData as bK, type PayoutChain as bL, type PayoutListData as bM, type PayoutNetwork as bN, type PluginListData as bO, type RampToken as bP, type ReceiverListData as bQ, type ReceiverOwner as bR, type ReceiverType as bS, type ReceiverWalletListData as bT, type ReceiverWalletNetwork as bU, type RegistryAssetData as bV, type ResolvableIntentInput as bW, type ResolvedAsset as bX, type SwapListData as bY, type SwapSubmitOutcomeData as bZ, TestnetAssets as b_, type CreateWebhookEndpointOptions as ba, type WebhookEvent as bb, type ActivityBucket as bc, type ActivityEventData as bd, type ActivityLevel as be, type ActivitySource as bf, AddressBook as bg, type AddressRef as bh, type AliasChallengePurpose as bi, type AnalyticsBalanceEntry as bj, type AnalyticsRecentRow as bk, type AnalyticsSeriesPoint as bl, type AnalyticsVolumeEntry as bm, type ApiLogRow as bn, type AssetDefinition as bo, type AssetRef as bp, Assets as bq, type BankAccountListData as br, type BankRail as bs, type BankingPartner as bt, type ChainSwapListData as bu, type ChainSwapSubmitOutcomeData as bv, CosmosPayAPIError as bw, CosmosPayRequestError as bx, type CrossChainSwapListData as by, type CurrencyType as bz, type AliasChallengeData as c, Wallets as c0, type WebhookDeliveryListData as c1, type WebhookLogRow as c2, addresses as c3, assertAddress as c4, defineAsset as c5, isAddress as c6, isContractAddress as c7, isMuxedAddress as c8, isNativeAsset as c9, isStellarAddress as ca, resolveAddress as cb, resolveAsset as cc, resolveIntentBody as cd, type ClaimAliasOptions as d, type AliasListData as e, type AddAliasAddressOptions as f, type AliasAddressData as g, type AliasDeletedData as h, type AliasRecoveryStartedData as i, type CompleteAliasRecoveryOptions as j, type AnalyticsSummaryData as k, type AnalyticsBalancesData as l, type ApiLogsData as m, type AssetRegistryData as n, type CustomerData as o, type CreateCustomerOptions as p, type LiquidityOperationData as q, LiquidityOperationKind as r, LiquidityOperationStatus as s, type WithdrawLiquidityOptions as t, type LiquidityPositionsData as u, type LiquidityPoolData as v, type ListLiquidityOperationsOptions as w, type CreatePayinQuoteOptions as x, type CreatePayinOptions as y, type PayinData as z };