@calm-xyz/core 0.9.0 → 0.10.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.
Files changed (3) hide show
  1. package/dist/index.d.ts +48 -671
  2. package/dist/index.js +13 -227
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -67,29 +67,6 @@ const client = request;
67
67
  * Generated by Kubb (https://kubb.dev/).
68
68
  * Do not edit manually.
69
69
  */
70
- function getCheckoutStripeSessionUrl(address, sessionId) {
71
- return {
72
- method: "POST",
73
- url: `/v1/wallets/${address}/stripe/session/${sessionId}/checkout`
74
- };
75
- }
76
- /**
77
- * @description Checks out a session and returns its `client_secret`. Driven by the client SDK's `performCheckout` callback — never called standalone; the SDK handles required next actions (3DS) between calls.
78
- * @summary Check out a Stripe onramp session
79
- * {@link /v1/wallets/:address/stripe/session/:sessionId/checkout}
80
- */
81
- async function checkoutStripeSession(address, sessionId, config = {}) {
82
- const { client: request = client, ...requestConfig } = config;
83
- return (await request({
84
- method: "POST",
85
- url: getCheckoutStripeSessionUrl(address, sessionId).url.toString(),
86
- ...requestConfig
87
- })).data;
88
- }
89
- /**
90
- * Generated by Kubb (https://kubb.dev/).
91
- * Do not edit manually.
92
- */
93
70
  function getClearSessionUrl() {
94
71
  return {
95
72
  method: "POST",
@@ -218,7 +195,7 @@ function getCreateDepositAddressUrl(address) {
218
195
  };
219
196
  }
220
197
  /**
221
- * @description Returns an intake address for a `(source chain, source token) → destination` route. Funding it delivers USDC to the destination; the same route reuses one address.
198
+ * @description Returns an intake address for a `(source chain, source token) → destination` route. Funding it delivers the destination chain's payout token — USDC on most chains, USDm on MegaETH (`4326`) — at that token's own decimals; the same route reuses one address.
222
199
  * @summary Create a crypto deposit address
223
200
  * {@link /v1/wallets/:address/deposit-address}
224
201
  */
@@ -355,54 +332,6 @@ async function createSiweNonce(address, config = {}) {
355
332
  * Generated by Kubb (https://kubb.dev/).
356
333
  * Do not edit manually.
357
334
  */
358
- function getCreateStripeAuthIntentUrl(address) {
359
- return {
360
- method: "POST",
361
- url: `/v1/wallets/${address}/stripe/auth-intent`
362
- };
363
- }
364
- /**
365
- * @description Opens a Link OAuth intent for the buyer's email and returns its id (handed to the client SDK's `authenticate(...)`) plus its expiry. Read-passthrough — nothing is persisted here.
366
- * @summary Open a Stripe Link auth intent
367
- * {@link /v1/wallets/:address/stripe/auth-intent}
368
- */
369
- async function createStripeAuthIntent(address, data, config = {}) {
370
- const { client: request = client, ...requestConfig } = config;
371
- const requestData = data;
372
- return (await request({
373
- method: "POST",
374
- url: getCreateStripeAuthIntentUrl(address).url.toString(),
375
- data: requestData,
376
- ...requestConfig
377
- })).data;
378
- }
379
- /**
380
- * Generated by Kubb (https://kubb.dev/).
381
- * Do not edit manually.
382
- */
383
- function getCreateStripeCustomerUrl(address, crypto_customer_id) {
384
- return {
385
- method: "POST",
386
- url: `/v1/wallets/${address}/stripe/customer/${crypto_customer_id}`
387
- };
388
- }
389
- /**
390
- * @description Validates the crypto customer exists and persists the customer id onto the session so `/status` can re-derive it after a reopen.
391
- * @summary Persist a Stripe crypto customer
392
- * {@link /v1/wallets/:address/stripe/customer/:crypto_customer_id}
393
- */
394
- async function createStripeCustomer(address, crypto_customer_id, config = {}) {
395
- const { client: request = client, ...requestConfig } = config;
396
- return (await request({
397
- method: "POST",
398
- url: getCreateStripeCustomerUrl(address, crypto_customer_id).url.toString(),
399
- ...requestConfig
400
- })).data;
401
- }
402
- /**
403
- * Generated by Kubb (https://kubb.dev/).
404
- * Do not edit manually.
405
- */
406
335
  function getCreateStripeSessionUrl(address) {
407
336
  return {
408
337
  method: "POST",
@@ -410,7 +339,7 @@ function getCreateStripeSessionUrl(address) {
410
339
  };
411
340
  }
412
341
  /**
413
- * @description Opens a headless onramp session and mirrors it into a local order. Returns Stripe's `session_id` (fed to the client SDK's `performCheckout`) plus our own `order_id` to poll via `GET .../stripe/order/:id`. Pass exactly one of `source_amount` / `destination_amount`.
342
+ * @description Mints an embedded onramp session and mirrors it into a local order. Returns Stripe's `client_secret` (which the SDK mounts the onramp iframe with) plus our own `order_id` to poll via `GET .../stripe/order/:id`. Every chain is a valid `destination_chain`: the ones the card provider settles to directly are delivered by it, and the rest are routed on arrival, which requires a registered wallet and delivers to the session wallet. Amounts are optional; pass at most one of `source_amount` / `destination_amount`.
414
343
  * @summary Open a Stripe onramp session
415
344
  * {@link /v1/wallets/:address/stripe/session}
416
345
  */
@@ -428,31 +357,6 @@ async function createStripeSession(address, data, config = {}) {
428
357
  * Generated by Kubb (https://kubb.dev/).
429
358
  * Do not edit manually.
430
359
  */
431
- function getCreateStripeTokensUrl(address) {
432
- return {
433
- method: "POST",
434
- url: `/v1/wallets/${address}/stripe/tokens`
435
- };
436
- }
437
- /**
438
- * @description Exchanges a consented auth intent for the per-user OAuth tokens and stores them server-side. Returns 204; the access token never reaches the browser. The bound intent must match this session.
439
- * @summary Exchange an auth intent for tokens
440
- * {@link /v1/wallets/:address/stripe/tokens}
441
- */
442
- async function createStripeTokens(address, data, config = {}) {
443
- const { client: request = client, ...requestConfig } = config;
444
- const requestData = data;
445
- return (await request({
446
- method: "POST",
447
- url: getCreateStripeTokensUrl(address).url.toString(),
448
- data: requestData,
449
- ...requestConfig
450
- })).data;
451
- }
452
- /**
453
- * Generated by Kubb (https://kubb.dev/).
454
- * Do not edit manually.
455
- */
456
360
  function getCreateSwapQuoteUrl(address) {
457
361
  return {
458
362
  method: "POST",
@@ -460,7 +364,7 @@ function getCreateSwapQuoteUrl(address) {
460
364
  };
461
365
  }
462
366
  /**
463
- * @description Returns an executable quote for swapping a source token into destination USDC. The response carries the steps the client executes on-chain; source and destination chains may differ.
367
+ * @description Returns an executable quote for swapping a source token into the destination chain's payout token — USDC on most chains, USDm on MegaETH (`4326`) — at that token's own decimals. The response carries the steps the client executes on-chain; source and destination chains may differ.
464
368
  * @summary Quote a swap
465
369
  * {@link /v1/wallets/:address/swap/quote}
466
370
  */
@@ -581,7 +485,7 @@ function getGetBalancesUrl(address) {
581
485
  };
582
486
  }
583
487
  /**
584
- * @description Returns the wallet's token balances across the supported source chains, each with its USD value. Filter with `?chains=1,8453`; the default is every readable chain.
488
+ * @description Returns the wallet's token balances across the supported source chains, each with its USD value. Filter with `?chains=1,8453`; the default covers the source chains, so a destination-only chain like MegaETH (`4326`) must be requested explicitly.
585
489
  * @summary List wallet balances
586
490
  * {@link /v1/wallets/:address/balances}
587
491
  */
@@ -716,13 +620,13 @@ async function getFxRates(config = {}) {
716
620
  function getGetIdentityVerificationLinkUrl(address) {
717
621
  return {
718
622
  method: "POST",
719
- url: `/v1/wallets/${address}/identity-verification`
623
+ url: `/v1/wallets/${address}/virtual-accounts/identity-verification`
720
624
  };
721
625
  }
722
626
  /**
723
627
  * @description Returns the hosted identity-verification URL for the wallet. Present it to the user, then poll `GET /v1/wallets/:address` for the resulting status.
724
628
  * @summary Get the identity-verification link
725
- * {@link /v1/wallets/:address/identity-verification}
629
+ * {@link /v1/wallets/:address/virtual-accounts/identity-verification}
726
630
  */
727
631
  async function getIdentityVerificationLink(address, config = {}) {
728
632
  const { client: request = client, ...requestConfig } = config;
@@ -759,29 +663,6 @@ async function getStripeConfig(address, config = {}) {
759
663
  * Generated by Kubb (https://kubb.dev/).
760
664
  * Do not edit manually.
761
665
  */
762
- function getGetStripeCustomerStatusUrl(address, crypto_customer_id) {
763
- return {
764
- method: "GET",
765
- url: `/v1/wallets/${address}/stripe/customer/${crypto_customer_id}`
766
- };
767
- }
768
- /**
769
- * @description Reads the crypto customer's KYC and document-verification statuses (the two the SDK branches on) plus its provided fields — the same projection as the customer POST, but a pure read with no persistence. The SDK polls it while the verifying step is on screen.
770
- * @summary Poll a Stripe crypto customer's status
771
- * {@link /v1/wallets/:address/stripe/customer/:crypto_customer_id}
772
- */
773
- async function getStripeCustomerStatus(address, crypto_customer_id, config = {}) {
774
- const { client: request = client, ...requestConfig } = config;
775
- return (await request({
776
- method: "GET",
777
- url: getGetStripeCustomerStatusUrl(address, crypto_customer_id).url.toString(),
778
- ...requestConfig
779
- })).data;
780
- }
781
- /**
782
- * Generated by Kubb (https://kubb.dev/).
783
- * Do not edit manually.
784
- */
785
666
  function getGetStripeOrderUrl(address, id) {
786
667
  return {
787
668
  method: "GET",
@@ -805,63 +686,16 @@ async function getStripeOrder(address, id, config = {}) {
805
686
  * Generated by Kubb (https://kubb.dev/).
806
687
  * Do not edit manually.
807
688
  */
808
- function getGetStripeQuoteUrl(address) {
809
- return {
810
- method: "GET",
811
- url: `/v1/wallets/${address}/stripe/quote`
812
- };
813
- }
814
- /**
815
- * @description Returns an informational price estimate for a source amount (fiat spend) or destination amount (target USDC) — the destination amount, the buyer's all-in source total, the fee components, and when the rate was fetched. Pin exactly one. No customer, token, or session is involved (it prices with the secret key alone), so it's `session`-gated only. Display-only: Stripe sets the final amounts at session creation.
816
- * @summary Quote a Stripe onramp amount
817
- * {@link /v1/wallets/:address/stripe/quote}
818
- */
819
- async function getStripeQuote(address, params, config = {}) {
820
- const { client: request = client, ...requestConfig } = config;
821
- return (await request({
822
- method: "GET",
823
- url: getGetStripeQuoteUrl(address).url.toString(),
824
- params,
825
- ...requestConfig
826
- })).data;
827
- }
828
- /**
829
- * Generated by Kubb (https://kubb.dev/).
830
- * Do not edit manually.
831
- */
832
- function getGetStripeStatusUrl(address) {
833
- return {
834
- method: "GET",
835
- url: `/v1/wallets/${address}/stripe/status`
836
- };
837
- }
838
- /**
839
- * @description Reports whether this session is still Link-authenticated and, once the customer POST has run, the persisted crypto customer id and the Link account email. Reads Redis only, so an un-authed session is a 200 with `authenticated: false` (not a 401) — the SDK polls it to re-derive the Stripe session on a cold open.
840
- * @summary Get the session's Stripe login state
841
- * {@link /v1/wallets/:address/stripe/status}
842
- */
843
- async function getStripeStatus(address, config = {}) {
844
- const { client: request = client, ...requestConfig } = config;
845
- return (await request({
846
- method: "GET",
847
- url: getGetStripeStatusUrl(address).url.toString(),
848
- ...requestConfig
849
- })).data;
850
- }
851
- /**
852
- * Generated by Kubb (https://kubb.dev/).
853
- * Do not edit manually.
854
- */
855
689
  function getGetTermsOfServiceLinkUrl(address) {
856
690
  return {
857
691
  method: "POST",
858
- url: `/v1/wallets/${address}/terms-of-service`
692
+ url: `/v1/wallets/${address}/virtual-accounts/terms-of-service`
859
693
  };
860
694
  }
861
695
  /**
862
696
  * @description Returns the hosted terms-of-service URL for the wallet. Present it to the user, then poll `GET /v1/wallets/:address` for acceptance.
863
697
  * @summary Get the terms-of-service link
864
- * {@link /v1/wallets/:address/terms-of-service}
698
+ * {@link /v1/wallets/:address/virtual-accounts/terms-of-service}
865
699
  */
866
700
  async function getTermsOfServiceLink(address, config = {}) {
867
701
  const { client: request = client, ...requestConfig } = config;
@@ -898,54 +732,6 @@ async function getWallet(address, config = {}) {
898
732
  * Generated by Kubb (https://kubb.dev/).
899
733
  * Do not edit manually.
900
734
  */
901
- function getListStripePaymentTokensUrl(address) {
902
- return {
903
- method: "GET",
904
- url: `/v1/wallets/${address}/stripe/payment-tokens`
905
- };
906
- }
907
- /**
908
- * @description Returns the payment methods the customer has on file. Read-passthrough — the SDK checks this before `collectPaymentMethod` to offer a saved method.
909
- * @summary List the customer's payment methods
910
- * {@link /v1/wallets/:address/stripe/payment-tokens}
911
- */
912
- async function listStripePaymentTokens(address, params, config = {}) {
913
- const { client: request = client, ...requestConfig } = config;
914
- return (await request({
915
- method: "GET",
916
- url: getListStripePaymentTokensUrl(address).url.toString(),
917
- params,
918
- ...requestConfig
919
- })).data;
920
- }
921
- /**
922
- * Generated by Kubb (https://kubb.dev/).
923
- * Do not edit manually.
924
- */
925
- function getListStripeWalletsUrl(address) {
926
- return {
927
- method: "GET",
928
- url: `/v1/wallets/${address}/stripe/wallets`
929
- };
930
- }
931
- /**
932
- * @description Returns the crypto wallets registered to the customer's Link account. Read-passthrough — the SDK checks this before `registerWalletAddress` to avoid re-registering a known address.
933
- * @summary List the customer's crypto wallets
934
- * {@link /v1/wallets/:address/stripe/wallets}
935
- */
936
- async function listStripeWallets(address, params, config = {}) {
937
- const { client: request = client, ...requestConfig } = config;
938
- return (await request({
939
- method: "GET",
940
- url: getListStripeWalletsUrl(address).url.toString(),
941
- params,
942
- ...requestConfig
943
- })).data;
944
- }
945
- /**
946
- * Generated by Kubb (https://kubb.dev/).
947
- * Do not edit manually.
948
- */
949
735
  function getListVirtualAccountsUrl(address) {
950
736
  return {
951
737
  method: "GET",
@@ -1020,13 +806,13 @@ async function registerWallet(address, data, config = {}) {
1020
806
  function getSubmitIdentityVerificationUrl(address) {
1021
807
  return {
1022
808
  method: "POST",
1023
- url: `/v1/wallets/${address}/identity-verification/submit`
809
+ url: `/v1/wallets/${address}/virtual-accounts/identity-verification/submit`
1024
810
  };
1025
811
  }
1026
812
  /**
1027
813
  * @description Records that the user finished the identity-verification flow and returns 204. Internal to the SDK's instant-submit UX — partners should create the link, then poll `GET /v1/wallets/:address` for the resulting status instead.
1028
814
  * @summary Record identity-verification completion
1029
- * {@link /v1/wallets/:address/identity-verification/submit}
815
+ * {@link /v1/wallets/:address/virtual-accounts/identity-verification/submit}
1030
816
  */
1031
817
  async function submitIdentityVerification(address, config = {}) {
1032
818
  const { client: request = client, ...requestConfig } = config;
@@ -1043,13 +829,13 @@ async function submitIdentityVerification(address, config = {}) {
1043
829
  function getSubmitTermsOfServiceUrl(address) {
1044
830
  return {
1045
831
  method: "POST",
1046
- url: `/v1/wallets/${address}/terms-of-service/submit`
832
+ url: `/v1/wallets/${address}/virtual-accounts/terms-of-service/submit`
1047
833
  };
1048
834
  }
1049
835
  /**
1050
836
  * @description Records that the user finished the terms-of-service flow and returns 204. Internal to the SDK's instant-submit UX — partners should create the link, then poll `GET /v1/wallets/:address` for acceptance instead.
1051
837
  * @summary Record terms-of-service completion
1052
- * {@link /v1/wallets/:address/terms-of-service/submit}
838
+ * {@link /v1/wallets/:address/virtual-accounts/terms-of-service/submit}
1053
839
  */
1054
840
  async function submitTermsOfService(address, config = {}) {
1055
841
  const { client: request = client, ...requestConfig } = config;
@@ -1195,4 +981,4 @@ const dataCurrencyEnum = {
1195
981
  function configureCalm(options) {
1196
982
  setConfig({ apiUrl: options.apiUrl });
1197
983
  }
1198
- export { ApiError, checkoutStripeSession, clearSession, client, client as default, configureCalm, connectExchange, connectExchangePathParamsExchangeEnum, createCardLink, createCardLinkMutationRequestCurrencyEnum, createCashAppOrder, createCashAppOrder200StatusEnum, createCashAppQuote, createDepositAddress, createDepositAddressMutationRequestSourceTokenEnum, createExchangeWithdrawQuote, createExchangeWithdrawQuotePathParamsExchangeEnum, createSessionDynamic, createSessionPrivy, createSessionSiwe, createSiweNonce, createStripeAuthIntent, createStripeCustomer, createStripeSession, createStripeTokens, createSwapQuote, createSwapQuoteMutationRequestSourceTokenEnum, createSwapQuoteMutationRequestTradeTypeEnum, createVirtualAccount, createVirtualAccountMutationRequestCurrencyEnum, dataCurrencyEnum, disconnectExchange, disconnectExchangePathParamsExchangeEnum, executeExchangeWithdrawal, executeExchangeWithdrawal200StatusEnum, executeExchangeWithdrawalPathParamsExchangeEnum, getBalance, getBalancePathParamsTokenEnum, getBalances, getCashAppOrder, getCashAppOrder200StatusEnum, getConfig, getExchange, getExchangeAssets, getExchangeAssetsPathParamsExchangeEnum, getExchangePathParamsExchangeEnum, getExchangeWithdrawal, getExchangeWithdrawal200StatusEnum, getExchangeWithdrawalPathParamsExchangeEnum, getFxRates, getIdentityVerificationLink, getStripeConfig, getStripeCustomerStatus, getStripeOrder, getStripeOrder200StatusEnum, getStripeQuote, getStripeStatus, getTermsOfServiceLink, getWallet, getWallet200IdentityVerificationStatusEnum, listStripePaymentTokens, listStripeWallets, listVirtualAccounts, refreshSession, registerWallet, setConfig, submitIdentityVerification, submitTermsOfService, updateVirtualAccount };
984
+ export { ApiError, clearSession, client, client as default, configureCalm, connectExchange, connectExchangePathParamsExchangeEnum, createCardLink, createCardLinkMutationRequestCurrencyEnum, createCashAppOrder, createCashAppOrder200StatusEnum, createCashAppQuote, createDepositAddress, createDepositAddressMutationRequestSourceTokenEnum, createExchangeWithdrawQuote, createExchangeWithdrawQuotePathParamsExchangeEnum, createSessionDynamic, createSessionPrivy, createSessionSiwe, createSiweNonce, createStripeSession, createSwapQuote, createSwapQuoteMutationRequestSourceTokenEnum, createSwapQuoteMutationRequestTradeTypeEnum, createVirtualAccount, createVirtualAccountMutationRequestCurrencyEnum, dataCurrencyEnum, disconnectExchange, disconnectExchangePathParamsExchangeEnum, executeExchangeWithdrawal, executeExchangeWithdrawal200StatusEnum, executeExchangeWithdrawalPathParamsExchangeEnum, getBalance, getBalancePathParamsTokenEnum, getBalances, getCashAppOrder, getCashAppOrder200StatusEnum, getConfig, getExchange, getExchangeAssets, getExchangeAssetsPathParamsExchangeEnum, getExchangePathParamsExchangeEnum, getExchangeWithdrawal, getExchangeWithdrawal200StatusEnum, getExchangeWithdrawalPathParamsExchangeEnum, getFxRates, getIdentityVerificationLink, getStripeConfig, getStripeOrder, getStripeOrder200StatusEnum, getTermsOfServiceLink, getWallet, getWallet200IdentityVerificationStatusEnum, listVirtualAccounts, refreshSession, registerWallet, setConfig, submitIdentityVerification, submitTermsOfService, updateVirtualAccount };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@calm-xyz/core",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "Headless client for the Calm fiat-to-crypto onramp API.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",