@unifold/core 0.1.49 → 0.1.51
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 +194 -3
- package/dist/index.d.ts +194 -3
- package/dist/index.js +6 -1
- package/dist/index.mjs +6 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -309,6 +309,7 @@ interface OnrampSessionRequest {
|
|
|
309
309
|
subdivision_code?: string;
|
|
310
310
|
redirect_url?: string;
|
|
311
311
|
external_id?: string;
|
|
312
|
+
email?: string;
|
|
312
313
|
}
|
|
313
314
|
interface OnrampSessionResponse {
|
|
314
315
|
url: string;
|
|
@@ -401,6 +402,10 @@ interface PaymentNetwork {
|
|
|
401
402
|
name: string;
|
|
402
403
|
icon_urls: IconUrl[];
|
|
403
404
|
}
|
|
405
|
+
interface BlockedCountrySubdivision {
|
|
406
|
+
country_code: string;
|
|
407
|
+
subdivision_codes: string[];
|
|
408
|
+
}
|
|
404
409
|
interface ProjectConfigResponse {
|
|
405
410
|
project_name?: string;
|
|
406
411
|
asset_cdn_url: string;
|
|
@@ -411,6 +416,7 @@ interface ProjectConfigResponse {
|
|
|
411
416
|
networks: PaymentNetwork[];
|
|
412
417
|
};
|
|
413
418
|
blocked_country_codes?: string[];
|
|
419
|
+
blocked_country_subdivisions?: BlockedCountrySubdivision[];
|
|
414
420
|
pay_with_exchange?: {
|
|
415
421
|
enabled: boolean;
|
|
416
422
|
};
|
|
@@ -424,7 +430,9 @@ interface IpAddressResponse {
|
|
|
424
430
|
alpha2: string;
|
|
425
431
|
alpha3: string;
|
|
426
432
|
country: string;
|
|
433
|
+
/** @deprecated Use subdivision_code instead */
|
|
427
434
|
state: string | null;
|
|
435
|
+
subdivision_code: string | null;
|
|
428
436
|
ip_address: string;
|
|
429
437
|
}
|
|
430
438
|
/**
|
|
@@ -652,23 +660,94 @@ interface PaymentIntentDepositAddress {
|
|
|
652
660
|
address_type: string | null;
|
|
653
661
|
address: string;
|
|
654
662
|
}
|
|
663
|
+
/**
|
|
664
|
+
* Lifecycle status of a payment intent. Default and locked-quote types share
|
|
665
|
+
* this vocabulary; the `awaiting_refund` / `refunding` / `refunded` /
|
|
666
|
+
* `refund_failed` states are only reachable for `type === 'locked_quote'` in v1.
|
|
667
|
+
*/
|
|
668
|
+
type PaymentIntentStatus = "requires_payment" | "processing" | "succeeded" | "canceled" | "expired" | "awaiting_refund" | "refunding" | "refunded" | "refund_failed";
|
|
669
|
+
/**
|
|
670
|
+
* Product mode of a payment intent. `default` is the standard PI flow.
|
|
671
|
+
* `locked_quote` adds time-boxed rate locking, source-side amount tracking,
|
|
672
|
+
* an expiration timer, and a refund flow. Same row, different mode.
|
|
673
|
+
*/
|
|
674
|
+
type PaymentIntentType = "default" | "locked_quote";
|
|
655
675
|
interface PaymentIntent {
|
|
656
676
|
id: string;
|
|
677
|
+
/** Discriminator — `default` for the standard flow, `locked_quote` for rate-locked. */
|
|
678
|
+
type: PaymentIntentType;
|
|
657
679
|
user_id: string | null;
|
|
680
|
+
/**
|
|
681
|
+
* Destination amount in destination-token base units.
|
|
682
|
+
* @deprecated use `destination_amount` — kept for back-compat.
|
|
683
|
+
*/
|
|
658
684
|
amount: string;
|
|
685
|
+
/**
|
|
686
|
+
* USD value of the destination amount at creation/lock time.
|
|
687
|
+
* @deprecated use `destination_amount_usd` — kept for back-compat.
|
|
688
|
+
*/
|
|
659
689
|
amount_usd: string;
|
|
690
|
+
/**
|
|
691
|
+
* Cumulative amount received. For `default` this is destination-token base
|
|
692
|
+
* units (post-bridge). For `locked_quote` this is source-token base units
|
|
693
|
+
* accumulated on the deposit wallet.
|
|
694
|
+
*/
|
|
660
695
|
amount_received: string;
|
|
696
|
+
/** USD value of `amount_received` so far. */
|
|
661
697
|
amount_received_usd: string;
|
|
698
|
+
/**
|
|
699
|
+
* Destination currency code lowercased.
|
|
700
|
+
* @deprecated use `destination_currency` — kept for back-compat.
|
|
701
|
+
*/
|
|
662
702
|
currency: string;
|
|
663
|
-
status:
|
|
703
|
+
status: PaymentIntentStatus;
|
|
664
704
|
client_secret: string;
|
|
705
|
+
destination_currency: string;
|
|
706
|
+
destination_amount: string;
|
|
707
|
+
destination_amount_usd: string;
|
|
708
|
+
/**
|
|
709
|
+
* Cumulative amount received on the destination side, in destination-token
|
|
710
|
+
* base units. For `default` PIs this is the post-bridge balance landed at
|
|
711
|
+
* the recipient. For `locked_quote` PIs this is `0` until the atomic payout
|
|
712
|
+
* confirms, then the full `destination_amount`.
|
|
713
|
+
*/
|
|
714
|
+
destination_amount_received: string;
|
|
715
|
+
/** USD value of `destination_amount_received` so far. */
|
|
716
|
+
destination_amount_received_usd: string;
|
|
665
717
|
destination_network: string | null;
|
|
666
718
|
destination_chain_type: ChainType;
|
|
667
719
|
destination_chain_id: string;
|
|
668
720
|
destination_token_address: string;
|
|
669
|
-
recipient_address: string;
|
|
670
721
|
destination_token_decimals: number;
|
|
722
|
+
recipient_address: string;
|
|
671
723
|
deposit_addresses: PaymentIntentDepositAddress[];
|
|
724
|
+
source_currency: string | null;
|
|
725
|
+
source_network: string | null;
|
|
726
|
+
source_chain_type: ChainType | null;
|
|
727
|
+
source_chain_id: string | null;
|
|
728
|
+
source_token_address: string | null;
|
|
729
|
+
/** Decimals of the source token; null on default-mode rows. */
|
|
730
|
+
source_token_decimals: number | null;
|
|
731
|
+
source_amount: string | null;
|
|
732
|
+
source_amount_usd: string | null;
|
|
733
|
+
/**
|
|
734
|
+
* Cumulative source-side deposits received, in source-token base units.
|
|
735
|
+
* Locked-quote only — null on default-mode rows.
|
|
736
|
+
*/
|
|
737
|
+
source_amount_received: string | null;
|
|
738
|
+
/** USD value of `source_amount_received` at the locked rate. Locked-quote only. */
|
|
739
|
+
source_amount_received_usd: string | null;
|
|
740
|
+
/** Atomic payout (pool → recipient) hash. Locked-quote only; null until broadcast. */
|
|
741
|
+
transaction_hash: string | null;
|
|
742
|
+
refund_address: string | null;
|
|
743
|
+
refund_amount: string | null;
|
|
744
|
+
refund_amount_usd: string | null;
|
|
745
|
+
refund_transaction_hash: string | null;
|
|
746
|
+
refunded_at: string | null;
|
|
747
|
+
/** Human-readable failure reason for terminal-with-error states. */
|
|
748
|
+
failure_reason: string | null;
|
|
749
|
+
/** Timestamp the row was transitioned to EXPIRED. Locked-quote only. */
|
|
750
|
+
expired_at: string | null;
|
|
672
751
|
metadata: Record<string, string> | null;
|
|
673
752
|
description: string | null;
|
|
674
753
|
livemode: boolean;
|
|
@@ -692,6 +771,109 @@ interface PaymentIntentExecutionsResponse {
|
|
|
692
771
|
* Authenticates via client_secret and publishable key.
|
|
693
772
|
*/
|
|
694
773
|
declare function listPaymentIntentExecutions(clientSecret: string, publishableKey?: string): Promise<PaymentIntentExecutionsResponse>;
|
|
774
|
+
/**
|
|
775
|
+
* One source network on which a `SourceToken` can be received.
|
|
776
|
+
* Shape mirrors `SourceTokenNetworkDto` from the backend (snake_case on wire).
|
|
777
|
+
*/
|
|
778
|
+
interface SourceTokenNetwork {
|
|
779
|
+
/** Network slug, e.g. `"ethereum"`, `"base-sepolia"`. Pair with `currency` to identify a source token. */
|
|
780
|
+
network: string;
|
|
781
|
+
chain_name: string;
|
|
782
|
+
chain_type: ChainType;
|
|
783
|
+
icon_url: string;
|
|
784
|
+
icon_urls: IconUrl[];
|
|
785
|
+
/** Token contract address, or `"native"` for native gas tokens. */
|
|
786
|
+
token_address: string;
|
|
787
|
+
decimals: number;
|
|
788
|
+
/** Estimated processing time in seconds. Null = fast (typically < 60s). */
|
|
789
|
+
estimated_processing_time: number | null;
|
|
790
|
+
estimated_price_impact_percent: number;
|
|
791
|
+
max_slippage_percent: number;
|
|
792
|
+
minimum_deposit_amount_usd: number;
|
|
793
|
+
}
|
|
794
|
+
/**
|
|
795
|
+
* A source-token entry returned by `getSupportedSourceTokens`. Each token
|
|
796
|
+
* is keyed by `currency` (lowercased symbol) and lists the networks it can
|
|
797
|
+
* be received on.
|
|
798
|
+
*/
|
|
799
|
+
interface SourceToken {
|
|
800
|
+
/** Public-facing currency identifier — token symbol lowercased. */
|
|
801
|
+
currency: string;
|
|
802
|
+
symbol: string;
|
|
803
|
+
name: string;
|
|
804
|
+
icon_url: string;
|
|
805
|
+
icon_urls: IconUrl[];
|
|
806
|
+
networks: SourceTokenNetwork[];
|
|
807
|
+
}
|
|
808
|
+
interface SupportedSourceTokensResponse {
|
|
809
|
+
data: SourceToken[];
|
|
810
|
+
}
|
|
811
|
+
interface SupportedSourceTokensQuery {
|
|
812
|
+
destination_currency?: string;
|
|
813
|
+
destination_network?: string;
|
|
814
|
+
}
|
|
815
|
+
/**
|
|
816
|
+
* Server-only — `GET /payment_intents/supported_source_tokens` is now behind
|
|
817
|
+
* SecretKeyGuard. Call it from your backend with `Authorization: Bearer sk_...`.
|
|
818
|
+
* The browser SDK does not expose a function for it; merchants proxy from their
|
|
819
|
+
* own server. Types stay here so consumers can type their proxy responses.
|
|
820
|
+
*/
|
|
821
|
+
interface LockedQuotePreviewRequest {
|
|
822
|
+
/** Source currency lowercased, e.g. `"btc"`, `"eth"`, `"usdc"`. */
|
|
823
|
+
source_currency: string;
|
|
824
|
+
/** Source network slug, e.g. `"ethereum"`, `"bitcoin"`, `"base"`. */
|
|
825
|
+
source_network: string;
|
|
826
|
+
/**
|
|
827
|
+
* Destination currency lowercased — what the recipient receives. v1 ships
|
|
828
|
+
* `"usdc"` only, but the field is required so future destinations don't
|
|
829
|
+
* break the request shape.
|
|
830
|
+
*/
|
|
831
|
+
destination_currency: string;
|
|
832
|
+
/** Destination network slug. v1: `"base"`. */
|
|
833
|
+
destination_network: string;
|
|
834
|
+
/** Desired destination amount in destination-token base units. */
|
|
835
|
+
destination_amount: string;
|
|
836
|
+
}
|
|
837
|
+
/**
|
|
838
|
+
* Shape returned by `POST /payment_intents/locked_quotes/quote`. Mirrors the
|
|
839
|
+
* request's `(currency, network)` vocabulary instead of the legacy
|
|
840
|
+
* `source_token_*` / `destination_token_*` fields used by the standard
|
|
841
|
+
* `DepositQuote` (which is keyed by raw chain/token tuples).
|
|
842
|
+
*/
|
|
843
|
+
interface LockedQuotePreview {
|
|
844
|
+
/** `lqq_*` — single-use, expires per `expired_at`. */
|
|
845
|
+
quote_id: string;
|
|
846
|
+
/** ISO 8601. */
|
|
847
|
+
expired_at: string;
|
|
848
|
+
source_currency: string;
|
|
849
|
+
source_network: string;
|
|
850
|
+
/** Source amount in source-currency base units the user must deposit. */
|
|
851
|
+
source_amount: string;
|
|
852
|
+
source_amount_usd: string | null;
|
|
853
|
+
source_currency_decimals: number;
|
|
854
|
+
destination_currency: string;
|
|
855
|
+
destination_network: string;
|
|
856
|
+
/** Destination amount in destination-currency base units. */
|
|
857
|
+
destination_amount: string;
|
|
858
|
+
destination_amount_usd: string | null;
|
|
859
|
+
destination_currency_decimals: number;
|
|
860
|
+
}
|
|
861
|
+
/**
|
|
862
|
+
* Server-only — `POST /payment_intents/locked_quotes/quote` is now behind
|
|
863
|
+
* SecretKeyGuard. Call it from your backend with `Authorization: Bearer sk_...`,
|
|
864
|
+
* then commit the returned `quote_id` via `POST /payment_intents/locked_quotes`.
|
|
865
|
+
* The browser SDK does not expose a function for it.
|
|
866
|
+
*/
|
|
867
|
+
/**
|
|
868
|
+
* Server-only — `GET /payment_intents/locked_quotes/limits` is now behind
|
|
869
|
+
* SecretKeyGuard. Call it from your backend with `Authorization: Bearer sk_...`.
|
|
870
|
+
* The browser SDK does not expose a function for it; the type stays here so
|
|
871
|
+
* consumers can type their proxy responses.
|
|
872
|
+
*/
|
|
873
|
+
interface LockedQuoteLimits {
|
|
874
|
+
minimum_amount: number;
|
|
875
|
+
maximum_amount: number;
|
|
876
|
+
}
|
|
695
877
|
interface DepositQuoteRequest {
|
|
696
878
|
source_chain_type: string;
|
|
697
879
|
source_chain_id: string;
|
|
@@ -702,6 +884,13 @@ interface DepositQuoteRequest {
|
|
|
702
884
|
destination_token_address: string;
|
|
703
885
|
}
|
|
704
886
|
interface DepositQuote {
|
|
887
|
+
/**
|
|
888
|
+
* Opaque quote ID. `q_*` for standard Relay quotes (60s TTL),
|
|
889
|
+
* `lqq_*` for locked-quote previews (30s TTL, single-use).
|
|
890
|
+
*/
|
|
891
|
+
quote_id: string;
|
|
892
|
+
/** ISO timestamp at which this quote stops being valid. */
|
|
893
|
+
expired_at: string;
|
|
705
894
|
source_amount: string;
|
|
706
895
|
source_amount_usd: string | null;
|
|
707
896
|
source_token_decimals: number;
|
|
@@ -802,7 +991,9 @@ interface UserIpInfo {
|
|
|
802
991
|
alpha2: string;
|
|
803
992
|
alpha3?: string;
|
|
804
993
|
country?: string;
|
|
994
|
+
/** @deprecated Use subdivisionCode instead */
|
|
805
995
|
state?: string | null;
|
|
996
|
+
subdivisionCode?: string | null;
|
|
806
997
|
ipAddress?: string;
|
|
807
998
|
}
|
|
808
999
|
/**
|
|
@@ -915,4 +1106,4 @@ declare const i18n: {
|
|
|
915
1106
|
};
|
|
916
1107
|
type I18nStrings = typeof i18n;
|
|
917
1108
|
|
|
918
|
-
export { ActionType, type AddressBalanceResponse, type AddressBalancesResponse, type AddressValidationFailureCode, type AddressValidationMetadata, type AutoSwapRequest, type AutoSwapResponse, type BuildHypercoreTransactionRequest, type BuildHypercoreTransactionResponse, type BuildSolanaTransactionRequest, type BuildSolanaTransactionResponse, type ChainType, type CreateDepositAddressRequest, type CreateExchangeSessionRequest, type CreateExchangeSessionResponse, type DefaultTokenChain, type DefaultTokenMetadata, type DefaultTokenResponse, type DepositAddressResponse, type DepositEvent, DepositEventType, type DepositQuote, type DepositQuoteRequest, type DestinationToken, type DestinationTokenChain, type ExchangeProviderInfo, type ExchangeProvidersResponse, type ExchangeSessionStartParams, type ExchangeWalletAddress, ExecutionStatus, type FeaturedToken, type FiatCurrenciesResponse, type FiatCurrency, type GetExchangesQuery, type HypercoreActionType, type HypercoreActivationRequest, type HypercoreActivationResponse, type I18nStrings, type IconUrl, IneligibilityReason, type IpAddressResponse, type OnrampQuote, type OnrampQuotesRequest, type OnrampQuotesResponse, type OnrampSessionCreatedData, type OnrampSessionCreatedEvent, type OnrampSessionRequest, type OnrampSessionResponse, type PaymentIntent, type PaymentIntentDepositAddress, type PaymentIntentExecutionsResponse, type PaymentNetwork, type PollExecutionsRequest, type PollExecutionsResponse, type ProjectConfigResponse, type QueryExecutionsRequest, type QueryExecutionsResponse, SOLANA_USDC_ADDRESS, type SendHypercoreTransactionRequest, type SendHypercoreTransactionResponse, type SendSolanaTransactionRequest, type SendSolanaTransactionResponse, type SupportedChain, type SupportedDepositTokensResponse, type SupportedDestinationTokensResponse, type SupportedToken, type TokenBalance, type TokenChain, type TokenChainIconUrl, type TokenChainsResponse, type TokenIconUrl, type TokenInfo, type TokenMetadata, type UserIpInfo, type VerifyAddressRequest, type VerifyAddressResponse, type Wallet, buildHypercoreTransaction, buildSolanaTransaction, checkHypercoreActivation, createDepositAddress, createExchangeSession, createOnrampSession, generatePrefixedKSUID, getAddressBalance, getAddressBalances, getApiBaseUrl, getChainName, getDefaultOnrampToken, getDepositQuote, getExchangeSessionStartUrl, getExchanges, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIpAddress, getOnrampQuotes, getOnrampSessionStartUrl, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getTokenMetadata, getWalletByChainType, i18n, listPaymentIntentExecutions, pollDirectExecutions, queryExecutions, retrievePaymentIntent, sendHypercoreTransaction, sendSolanaTransaction, setApiConfig, useUserIp, verifyRecipientAddress };
|
|
1109
|
+
export { ActionType, type AddressBalanceResponse, type AddressBalancesResponse, type AddressValidationFailureCode, type AddressValidationMetadata, type AutoSwapRequest, type AutoSwapResponse, type BlockedCountrySubdivision, type BuildHypercoreTransactionRequest, type BuildHypercoreTransactionResponse, type BuildSolanaTransactionRequest, type BuildSolanaTransactionResponse, type ChainType, type CreateDepositAddressRequest, type CreateExchangeSessionRequest, type CreateExchangeSessionResponse, type DefaultTokenChain, type DefaultTokenMetadata, type DefaultTokenResponse, type DepositAddressResponse, type DepositEvent, DepositEventType, type DepositQuote, type DepositQuoteRequest, type DestinationToken, type DestinationTokenChain, type ExchangeProviderInfo, type ExchangeProvidersResponse, type ExchangeSessionStartParams, type ExchangeWalletAddress, ExecutionStatus, type FeaturedToken, type FiatCurrenciesResponse, type FiatCurrency, type GetExchangesQuery, type HypercoreActionType, type HypercoreActivationRequest, type HypercoreActivationResponse, type I18nStrings, type IconUrl, IneligibilityReason, type IpAddressResponse, type LockedQuoteLimits, type LockedQuotePreview, type LockedQuotePreviewRequest, type OnrampQuote, type OnrampQuotesRequest, type OnrampQuotesResponse, type OnrampSessionCreatedData, type OnrampSessionCreatedEvent, type OnrampSessionRequest, type OnrampSessionResponse, type PaymentIntent, type PaymentIntentDepositAddress, type PaymentIntentExecutionsResponse, type PaymentIntentStatus, type PaymentIntentType, type PaymentNetwork, type PollExecutionsRequest, type PollExecutionsResponse, type ProjectConfigResponse, type QueryExecutionsRequest, type QueryExecutionsResponse, SOLANA_USDC_ADDRESS, type SendHypercoreTransactionRequest, type SendHypercoreTransactionResponse, type SendSolanaTransactionRequest, type SendSolanaTransactionResponse, type SourceToken, type SourceTokenNetwork, type SupportedChain, type SupportedDepositTokensResponse, type SupportedDestinationTokensResponse, type SupportedSourceTokensQuery, type SupportedSourceTokensResponse, type SupportedToken, type TokenBalance, type TokenChain, type TokenChainIconUrl, type TokenChainsResponse, type TokenIconUrl, type TokenInfo, type TokenMetadata, type UserIpInfo, type VerifyAddressRequest, type VerifyAddressResponse, type Wallet, buildHypercoreTransaction, buildSolanaTransaction, checkHypercoreActivation, createDepositAddress, createExchangeSession, createOnrampSession, generatePrefixedKSUID, getAddressBalance, getAddressBalances, getApiBaseUrl, getChainName, getDefaultOnrampToken, getDepositQuote, getExchangeSessionStartUrl, getExchanges, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIpAddress, getOnrampQuotes, getOnrampSessionStartUrl, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getTokenMetadata, getWalletByChainType, i18n, listPaymentIntentExecutions, pollDirectExecutions, queryExecutions, retrievePaymentIntent, sendHypercoreTransaction, sendSolanaTransaction, setApiConfig, useUserIp, verifyRecipientAddress };
|
package/dist/index.d.ts
CHANGED
|
@@ -309,6 +309,7 @@ interface OnrampSessionRequest {
|
|
|
309
309
|
subdivision_code?: string;
|
|
310
310
|
redirect_url?: string;
|
|
311
311
|
external_id?: string;
|
|
312
|
+
email?: string;
|
|
312
313
|
}
|
|
313
314
|
interface OnrampSessionResponse {
|
|
314
315
|
url: string;
|
|
@@ -401,6 +402,10 @@ interface PaymentNetwork {
|
|
|
401
402
|
name: string;
|
|
402
403
|
icon_urls: IconUrl[];
|
|
403
404
|
}
|
|
405
|
+
interface BlockedCountrySubdivision {
|
|
406
|
+
country_code: string;
|
|
407
|
+
subdivision_codes: string[];
|
|
408
|
+
}
|
|
404
409
|
interface ProjectConfigResponse {
|
|
405
410
|
project_name?: string;
|
|
406
411
|
asset_cdn_url: string;
|
|
@@ -411,6 +416,7 @@ interface ProjectConfigResponse {
|
|
|
411
416
|
networks: PaymentNetwork[];
|
|
412
417
|
};
|
|
413
418
|
blocked_country_codes?: string[];
|
|
419
|
+
blocked_country_subdivisions?: BlockedCountrySubdivision[];
|
|
414
420
|
pay_with_exchange?: {
|
|
415
421
|
enabled: boolean;
|
|
416
422
|
};
|
|
@@ -424,7 +430,9 @@ interface IpAddressResponse {
|
|
|
424
430
|
alpha2: string;
|
|
425
431
|
alpha3: string;
|
|
426
432
|
country: string;
|
|
433
|
+
/** @deprecated Use subdivision_code instead */
|
|
427
434
|
state: string | null;
|
|
435
|
+
subdivision_code: string | null;
|
|
428
436
|
ip_address: string;
|
|
429
437
|
}
|
|
430
438
|
/**
|
|
@@ -652,23 +660,94 @@ interface PaymentIntentDepositAddress {
|
|
|
652
660
|
address_type: string | null;
|
|
653
661
|
address: string;
|
|
654
662
|
}
|
|
663
|
+
/**
|
|
664
|
+
* Lifecycle status of a payment intent. Default and locked-quote types share
|
|
665
|
+
* this vocabulary; the `awaiting_refund` / `refunding` / `refunded` /
|
|
666
|
+
* `refund_failed` states are only reachable for `type === 'locked_quote'` in v1.
|
|
667
|
+
*/
|
|
668
|
+
type PaymentIntentStatus = "requires_payment" | "processing" | "succeeded" | "canceled" | "expired" | "awaiting_refund" | "refunding" | "refunded" | "refund_failed";
|
|
669
|
+
/**
|
|
670
|
+
* Product mode of a payment intent. `default` is the standard PI flow.
|
|
671
|
+
* `locked_quote` adds time-boxed rate locking, source-side amount tracking,
|
|
672
|
+
* an expiration timer, and a refund flow. Same row, different mode.
|
|
673
|
+
*/
|
|
674
|
+
type PaymentIntentType = "default" | "locked_quote";
|
|
655
675
|
interface PaymentIntent {
|
|
656
676
|
id: string;
|
|
677
|
+
/** Discriminator — `default` for the standard flow, `locked_quote` for rate-locked. */
|
|
678
|
+
type: PaymentIntentType;
|
|
657
679
|
user_id: string | null;
|
|
680
|
+
/**
|
|
681
|
+
* Destination amount in destination-token base units.
|
|
682
|
+
* @deprecated use `destination_amount` — kept for back-compat.
|
|
683
|
+
*/
|
|
658
684
|
amount: string;
|
|
685
|
+
/**
|
|
686
|
+
* USD value of the destination amount at creation/lock time.
|
|
687
|
+
* @deprecated use `destination_amount_usd` — kept for back-compat.
|
|
688
|
+
*/
|
|
659
689
|
amount_usd: string;
|
|
690
|
+
/**
|
|
691
|
+
* Cumulative amount received. For `default` this is destination-token base
|
|
692
|
+
* units (post-bridge). For `locked_quote` this is source-token base units
|
|
693
|
+
* accumulated on the deposit wallet.
|
|
694
|
+
*/
|
|
660
695
|
amount_received: string;
|
|
696
|
+
/** USD value of `amount_received` so far. */
|
|
661
697
|
amount_received_usd: string;
|
|
698
|
+
/**
|
|
699
|
+
* Destination currency code lowercased.
|
|
700
|
+
* @deprecated use `destination_currency` — kept for back-compat.
|
|
701
|
+
*/
|
|
662
702
|
currency: string;
|
|
663
|
-
status:
|
|
703
|
+
status: PaymentIntentStatus;
|
|
664
704
|
client_secret: string;
|
|
705
|
+
destination_currency: string;
|
|
706
|
+
destination_amount: string;
|
|
707
|
+
destination_amount_usd: string;
|
|
708
|
+
/**
|
|
709
|
+
* Cumulative amount received on the destination side, in destination-token
|
|
710
|
+
* base units. For `default` PIs this is the post-bridge balance landed at
|
|
711
|
+
* the recipient. For `locked_quote` PIs this is `0` until the atomic payout
|
|
712
|
+
* confirms, then the full `destination_amount`.
|
|
713
|
+
*/
|
|
714
|
+
destination_amount_received: string;
|
|
715
|
+
/** USD value of `destination_amount_received` so far. */
|
|
716
|
+
destination_amount_received_usd: string;
|
|
665
717
|
destination_network: string | null;
|
|
666
718
|
destination_chain_type: ChainType;
|
|
667
719
|
destination_chain_id: string;
|
|
668
720
|
destination_token_address: string;
|
|
669
|
-
recipient_address: string;
|
|
670
721
|
destination_token_decimals: number;
|
|
722
|
+
recipient_address: string;
|
|
671
723
|
deposit_addresses: PaymentIntentDepositAddress[];
|
|
724
|
+
source_currency: string | null;
|
|
725
|
+
source_network: string | null;
|
|
726
|
+
source_chain_type: ChainType | null;
|
|
727
|
+
source_chain_id: string | null;
|
|
728
|
+
source_token_address: string | null;
|
|
729
|
+
/** Decimals of the source token; null on default-mode rows. */
|
|
730
|
+
source_token_decimals: number | null;
|
|
731
|
+
source_amount: string | null;
|
|
732
|
+
source_amount_usd: string | null;
|
|
733
|
+
/**
|
|
734
|
+
* Cumulative source-side deposits received, in source-token base units.
|
|
735
|
+
* Locked-quote only — null on default-mode rows.
|
|
736
|
+
*/
|
|
737
|
+
source_amount_received: string | null;
|
|
738
|
+
/** USD value of `source_amount_received` at the locked rate. Locked-quote only. */
|
|
739
|
+
source_amount_received_usd: string | null;
|
|
740
|
+
/** Atomic payout (pool → recipient) hash. Locked-quote only; null until broadcast. */
|
|
741
|
+
transaction_hash: string | null;
|
|
742
|
+
refund_address: string | null;
|
|
743
|
+
refund_amount: string | null;
|
|
744
|
+
refund_amount_usd: string | null;
|
|
745
|
+
refund_transaction_hash: string | null;
|
|
746
|
+
refunded_at: string | null;
|
|
747
|
+
/** Human-readable failure reason for terminal-with-error states. */
|
|
748
|
+
failure_reason: string | null;
|
|
749
|
+
/** Timestamp the row was transitioned to EXPIRED. Locked-quote only. */
|
|
750
|
+
expired_at: string | null;
|
|
672
751
|
metadata: Record<string, string> | null;
|
|
673
752
|
description: string | null;
|
|
674
753
|
livemode: boolean;
|
|
@@ -692,6 +771,109 @@ interface PaymentIntentExecutionsResponse {
|
|
|
692
771
|
* Authenticates via client_secret and publishable key.
|
|
693
772
|
*/
|
|
694
773
|
declare function listPaymentIntentExecutions(clientSecret: string, publishableKey?: string): Promise<PaymentIntentExecutionsResponse>;
|
|
774
|
+
/**
|
|
775
|
+
* One source network on which a `SourceToken` can be received.
|
|
776
|
+
* Shape mirrors `SourceTokenNetworkDto` from the backend (snake_case on wire).
|
|
777
|
+
*/
|
|
778
|
+
interface SourceTokenNetwork {
|
|
779
|
+
/** Network slug, e.g. `"ethereum"`, `"base-sepolia"`. Pair with `currency` to identify a source token. */
|
|
780
|
+
network: string;
|
|
781
|
+
chain_name: string;
|
|
782
|
+
chain_type: ChainType;
|
|
783
|
+
icon_url: string;
|
|
784
|
+
icon_urls: IconUrl[];
|
|
785
|
+
/** Token contract address, or `"native"` for native gas tokens. */
|
|
786
|
+
token_address: string;
|
|
787
|
+
decimals: number;
|
|
788
|
+
/** Estimated processing time in seconds. Null = fast (typically < 60s). */
|
|
789
|
+
estimated_processing_time: number | null;
|
|
790
|
+
estimated_price_impact_percent: number;
|
|
791
|
+
max_slippage_percent: number;
|
|
792
|
+
minimum_deposit_amount_usd: number;
|
|
793
|
+
}
|
|
794
|
+
/**
|
|
795
|
+
* A source-token entry returned by `getSupportedSourceTokens`. Each token
|
|
796
|
+
* is keyed by `currency` (lowercased symbol) and lists the networks it can
|
|
797
|
+
* be received on.
|
|
798
|
+
*/
|
|
799
|
+
interface SourceToken {
|
|
800
|
+
/** Public-facing currency identifier — token symbol lowercased. */
|
|
801
|
+
currency: string;
|
|
802
|
+
symbol: string;
|
|
803
|
+
name: string;
|
|
804
|
+
icon_url: string;
|
|
805
|
+
icon_urls: IconUrl[];
|
|
806
|
+
networks: SourceTokenNetwork[];
|
|
807
|
+
}
|
|
808
|
+
interface SupportedSourceTokensResponse {
|
|
809
|
+
data: SourceToken[];
|
|
810
|
+
}
|
|
811
|
+
interface SupportedSourceTokensQuery {
|
|
812
|
+
destination_currency?: string;
|
|
813
|
+
destination_network?: string;
|
|
814
|
+
}
|
|
815
|
+
/**
|
|
816
|
+
* Server-only — `GET /payment_intents/supported_source_tokens` is now behind
|
|
817
|
+
* SecretKeyGuard. Call it from your backend with `Authorization: Bearer sk_...`.
|
|
818
|
+
* The browser SDK does not expose a function for it; merchants proxy from their
|
|
819
|
+
* own server. Types stay here so consumers can type their proxy responses.
|
|
820
|
+
*/
|
|
821
|
+
interface LockedQuotePreviewRequest {
|
|
822
|
+
/** Source currency lowercased, e.g. `"btc"`, `"eth"`, `"usdc"`. */
|
|
823
|
+
source_currency: string;
|
|
824
|
+
/** Source network slug, e.g. `"ethereum"`, `"bitcoin"`, `"base"`. */
|
|
825
|
+
source_network: string;
|
|
826
|
+
/**
|
|
827
|
+
* Destination currency lowercased — what the recipient receives. v1 ships
|
|
828
|
+
* `"usdc"` only, but the field is required so future destinations don't
|
|
829
|
+
* break the request shape.
|
|
830
|
+
*/
|
|
831
|
+
destination_currency: string;
|
|
832
|
+
/** Destination network slug. v1: `"base"`. */
|
|
833
|
+
destination_network: string;
|
|
834
|
+
/** Desired destination amount in destination-token base units. */
|
|
835
|
+
destination_amount: string;
|
|
836
|
+
}
|
|
837
|
+
/**
|
|
838
|
+
* Shape returned by `POST /payment_intents/locked_quotes/quote`. Mirrors the
|
|
839
|
+
* request's `(currency, network)` vocabulary instead of the legacy
|
|
840
|
+
* `source_token_*` / `destination_token_*` fields used by the standard
|
|
841
|
+
* `DepositQuote` (which is keyed by raw chain/token tuples).
|
|
842
|
+
*/
|
|
843
|
+
interface LockedQuotePreview {
|
|
844
|
+
/** `lqq_*` — single-use, expires per `expired_at`. */
|
|
845
|
+
quote_id: string;
|
|
846
|
+
/** ISO 8601. */
|
|
847
|
+
expired_at: string;
|
|
848
|
+
source_currency: string;
|
|
849
|
+
source_network: string;
|
|
850
|
+
/** Source amount in source-currency base units the user must deposit. */
|
|
851
|
+
source_amount: string;
|
|
852
|
+
source_amount_usd: string | null;
|
|
853
|
+
source_currency_decimals: number;
|
|
854
|
+
destination_currency: string;
|
|
855
|
+
destination_network: string;
|
|
856
|
+
/** Destination amount in destination-currency base units. */
|
|
857
|
+
destination_amount: string;
|
|
858
|
+
destination_amount_usd: string | null;
|
|
859
|
+
destination_currency_decimals: number;
|
|
860
|
+
}
|
|
861
|
+
/**
|
|
862
|
+
* Server-only — `POST /payment_intents/locked_quotes/quote` is now behind
|
|
863
|
+
* SecretKeyGuard. Call it from your backend with `Authorization: Bearer sk_...`,
|
|
864
|
+
* then commit the returned `quote_id` via `POST /payment_intents/locked_quotes`.
|
|
865
|
+
* The browser SDK does not expose a function for it.
|
|
866
|
+
*/
|
|
867
|
+
/**
|
|
868
|
+
* Server-only — `GET /payment_intents/locked_quotes/limits` is now behind
|
|
869
|
+
* SecretKeyGuard. Call it from your backend with `Authorization: Bearer sk_...`.
|
|
870
|
+
* The browser SDK does not expose a function for it; the type stays here so
|
|
871
|
+
* consumers can type their proxy responses.
|
|
872
|
+
*/
|
|
873
|
+
interface LockedQuoteLimits {
|
|
874
|
+
minimum_amount: number;
|
|
875
|
+
maximum_amount: number;
|
|
876
|
+
}
|
|
695
877
|
interface DepositQuoteRequest {
|
|
696
878
|
source_chain_type: string;
|
|
697
879
|
source_chain_id: string;
|
|
@@ -702,6 +884,13 @@ interface DepositQuoteRequest {
|
|
|
702
884
|
destination_token_address: string;
|
|
703
885
|
}
|
|
704
886
|
interface DepositQuote {
|
|
887
|
+
/**
|
|
888
|
+
* Opaque quote ID. `q_*` for standard Relay quotes (60s TTL),
|
|
889
|
+
* `lqq_*` for locked-quote previews (30s TTL, single-use).
|
|
890
|
+
*/
|
|
891
|
+
quote_id: string;
|
|
892
|
+
/** ISO timestamp at which this quote stops being valid. */
|
|
893
|
+
expired_at: string;
|
|
705
894
|
source_amount: string;
|
|
706
895
|
source_amount_usd: string | null;
|
|
707
896
|
source_token_decimals: number;
|
|
@@ -802,7 +991,9 @@ interface UserIpInfo {
|
|
|
802
991
|
alpha2: string;
|
|
803
992
|
alpha3?: string;
|
|
804
993
|
country?: string;
|
|
994
|
+
/** @deprecated Use subdivisionCode instead */
|
|
805
995
|
state?: string | null;
|
|
996
|
+
subdivisionCode?: string | null;
|
|
806
997
|
ipAddress?: string;
|
|
807
998
|
}
|
|
808
999
|
/**
|
|
@@ -915,4 +1106,4 @@ declare const i18n: {
|
|
|
915
1106
|
};
|
|
916
1107
|
type I18nStrings = typeof i18n;
|
|
917
1108
|
|
|
918
|
-
export { ActionType, type AddressBalanceResponse, type AddressBalancesResponse, type AddressValidationFailureCode, type AddressValidationMetadata, type AutoSwapRequest, type AutoSwapResponse, type BuildHypercoreTransactionRequest, type BuildHypercoreTransactionResponse, type BuildSolanaTransactionRequest, type BuildSolanaTransactionResponse, type ChainType, type CreateDepositAddressRequest, type CreateExchangeSessionRequest, type CreateExchangeSessionResponse, type DefaultTokenChain, type DefaultTokenMetadata, type DefaultTokenResponse, type DepositAddressResponse, type DepositEvent, DepositEventType, type DepositQuote, type DepositQuoteRequest, type DestinationToken, type DestinationTokenChain, type ExchangeProviderInfo, type ExchangeProvidersResponse, type ExchangeSessionStartParams, type ExchangeWalletAddress, ExecutionStatus, type FeaturedToken, type FiatCurrenciesResponse, type FiatCurrency, type GetExchangesQuery, type HypercoreActionType, type HypercoreActivationRequest, type HypercoreActivationResponse, type I18nStrings, type IconUrl, IneligibilityReason, type IpAddressResponse, type OnrampQuote, type OnrampQuotesRequest, type OnrampQuotesResponse, type OnrampSessionCreatedData, type OnrampSessionCreatedEvent, type OnrampSessionRequest, type OnrampSessionResponse, type PaymentIntent, type PaymentIntentDepositAddress, type PaymentIntentExecutionsResponse, type PaymentNetwork, type PollExecutionsRequest, type PollExecutionsResponse, type ProjectConfigResponse, type QueryExecutionsRequest, type QueryExecutionsResponse, SOLANA_USDC_ADDRESS, type SendHypercoreTransactionRequest, type SendHypercoreTransactionResponse, type SendSolanaTransactionRequest, type SendSolanaTransactionResponse, type SupportedChain, type SupportedDepositTokensResponse, type SupportedDestinationTokensResponse, type SupportedToken, type TokenBalance, type TokenChain, type TokenChainIconUrl, type TokenChainsResponse, type TokenIconUrl, type TokenInfo, type TokenMetadata, type UserIpInfo, type VerifyAddressRequest, type VerifyAddressResponse, type Wallet, buildHypercoreTransaction, buildSolanaTransaction, checkHypercoreActivation, createDepositAddress, createExchangeSession, createOnrampSession, generatePrefixedKSUID, getAddressBalance, getAddressBalances, getApiBaseUrl, getChainName, getDefaultOnrampToken, getDepositQuote, getExchangeSessionStartUrl, getExchanges, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIpAddress, getOnrampQuotes, getOnrampSessionStartUrl, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getTokenMetadata, getWalletByChainType, i18n, listPaymentIntentExecutions, pollDirectExecutions, queryExecutions, retrievePaymentIntent, sendHypercoreTransaction, sendSolanaTransaction, setApiConfig, useUserIp, verifyRecipientAddress };
|
|
1109
|
+
export { ActionType, type AddressBalanceResponse, type AddressBalancesResponse, type AddressValidationFailureCode, type AddressValidationMetadata, type AutoSwapRequest, type AutoSwapResponse, type BlockedCountrySubdivision, type BuildHypercoreTransactionRequest, type BuildHypercoreTransactionResponse, type BuildSolanaTransactionRequest, type BuildSolanaTransactionResponse, type ChainType, type CreateDepositAddressRequest, type CreateExchangeSessionRequest, type CreateExchangeSessionResponse, type DefaultTokenChain, type DefaultTokenMetadata, type DefaultTokenResponse, type DepositAddressResponse, type DepositEvent, DepositEventType, type DepositQuote, type DepositQuoteRequest, type DestinationToken, type DestinationTokenChain, type ExchangeProviderInfo, type ExchangeProvidersResponse, type ExchangeSessionStartParams, type ExchangeWalletAddress, ExecutionStatus, type FeaturedToken, type FiatCurrenciesResponse, type FiatCurrency, type GetExchangesQuery, type HypercoreActionType, type HypercoreActivationRequest, type HypercoreActivationResponse, type I18nStrings, type IconUrl, IneligibilityReason, type IpAddressResponse, type LockedQuoteLimits, type LockedQuotePreview, type LockedQuotePreviewRequest, type OnrampQuote, type OnrampQuotesRequest, type OnrampQuotesResponse, type OnrampSessionCreatedData, type OnrampSessionCreatedEvent, type OnrampSessionRequest, type OnrampSessionResponse, type PaymentIntent, type PaymentIntentDepositAddress, type PaymentIntentExecutionsResponse, type PaymentIntentStatus, type PaymentIntentType, type PaymentNetwork, type PollExecutionsRequest, type PollExecutionsResponse, type ProjectConfigResponse, type QueryExecutionsRequest, type QueryExecutionsResponse, SOLANA_USDC_ADDRESS, type SendHypercoreTransactionRequest, type SendHypercoreTransactionResponse, type SendSolanaTransactionRequest, type SendSolanaTransactionResponse, type SourceToken, type SourceTokenNetwork, type SupportedChain, type SupportedDepositTokensResponse, type SupportedDestinationTokensResponse, type SupportedSourceTokensQuery, type SupportedSourceTokensResponse, type SupportedToken, type TokenBalance, type TokenChain, type TokenChainIconUrl, type TokenChainsResponse, type TokenIconUrl, type TokenInfo, type TokenMetadata, type UserIpInfo, type VerifyAddressRequest, type VerifyAddressResponse, type Wallet, buildHypercoreTransaction, buildSolanaTransaction, checkHypercoreActivation, createDepositAddress, createExchangeSession, createOnrampSession, generatePrefixedKSUID, getAddressBalance, getAddressBalances, getApiBaseUrl, getChainName, getDefaultOnrampToken, getDepositQuote, getExchangeSessionStartUrl, getExchanges, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIpAddress, getOnrampQuotes, getOnrampSessionStartUrl, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getTokenMetadata, getWalletByChainType, i18n, listPaymentIntentExecutions, pollDirectExecutions, queryExecutions, retrievePaymentIntent, sendHypercoreTransaction, sendSolanaTransaction, setApiConfig, useUserIp, verifyRecipientAddress };
|
package/dist/index.js
CHANGED
|
@@ -363,6 +363,9 @@ function getOnrampSessionStartUrl(request, publishableKey) {
|
|
|
363
363
|
if (request.external_id) {
|
|
364
364
|
params.append("external_id", request.external_id);
|
|
365
365
|
}
|
|
366
|
+
if (request.email) {
|
|
367
|
+
params.append("email", request.email);
|
|
368
|
+
}
|
|
366
369
|
return `${API_BASE_URL}/v1/public/onramps/sessions/start?${params.toString()}`;
|
|
367
370
|
}
|
|
368
371
|
async function getDefaultOnrampToken(params, publishableKey) {
|
|
@@ -800,11 +803,13 @@ function useUserIp() {
|
|
|
800
803
|
queryKey: ["unifold", "userIpInfo"],
|
|
801
804
|
queryFn: async () => {
|
|
802
805
|
const data = await getIpAddress();
|
|
806
|
+
const subdivision = (data.subdivision_code || data.state || "").toLowerCase() || null;
|
|
803
807
|
return {
|
|
804
808
|
alpha2: data.alpha2.toLowerCase(),
|
|
805
809
|
alpha3: data.alpha3?.toLowerCase(),
|
|
806
810
|
country: data.country,
|
|
807
|
-
state:
|
|
811
|
+
state: subdivision,
|
|
812
|
+
subdivisionCode: subdivision,
|
|
808
813
|
ipAddress: data.ip_address
|
|
809
814
|
};
|
|
810
815
|
},
|
package/dist/index.mjs
CHANGED
|
@@ -295,6 +295,9 @@ function getOnrampSessionStartUrl(request, publishableKey) {
|
|
|
295
295
|
if (request.external_id) {
|
|
296
296
|
params.append("external_id", request.external_id);
|
|
297
297
|
}
|
|
298
|
+
if (request.email) {
|
|
299
|
+
params.append("email", request.email);
|
|
300
|
+
}
|
|
298
301
|
return `${API_BASE_URL}/v1/public/onramps/sessions/start?${params.toString()}`;
|
|
299
302
|
}
|
|
300
303
|
async function getDefaultOnrampToken(params, publishableKey) {
|
|
@@ -732,11 +735,13 @@ function useUserIp() {
|
|
|
732
735
|
queryKey: ["unifold", "userIpInfo"],
|
|
733
736
|
queryFn: async () => {
|
|
734
737
|
const data = await getIpAddress();
|
|
738
|
+
const subdivision = (data.subdivision_code || data.state || "").toLowerCase() || null;
|
|
735
739
|
return {
|
|
736
740
|
alpha2: data.alpha2.toLowerCase(),
|
|
737
741
|
alpha3: data.alpha3?.toLowerCase(),
|
|
738
742
|
country: data.country,
|
|
739
|
-
state:
|
|
743
|
+
state: subdivision,
|
|
744
|
+
subdivisionCode: subdivision,
|
|
740
745
|
ipAddress: data.ip_address
|
|
741
746
|
};
|
|
742
747
|
},
|