@mintmoney/react 0.2.0-alpha.2 → 0.2.0-alpha.4
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/css/styles.css +12 -1
- package/dist/docs/customisation.md +4 -0
- package/dist/docs/quickstart.md +2 -0
- package/dist/esm/api/errors.js +89 -0
- package/dist/esm/api/errors.js.map +1 -0
- package/dist/esm/api/generated.js +825 -65
- package/dist/esm/api/generated.js.map +1 -1
- package/dist/esm/api/payments.js +36 -2
- package/dist/esm/api/payments.js.map +1 -1
- package/dist/esm/api/tokens.js +34 -0
- package/dist/esm/api/tokens.js.map +1 -0
- package/dist/esm/api/types.js.map +1 -1
- package/dist/esm/checkout/claimable-funds.js +19 -10
- package/dist/esm/checkout/claimable-funds.js.map +1 -1
- package/dist/esm/checkout/creation-error-modal.js +2 -2
- package/dist/esm/checkout/creation-error-modal.js.map +1 -1
- package/dist/esm/checkout/index.js +54 -13
- package/dist/esm/checkout/index.js.map +1 -1
- package/dist/esm/checkout/modal.js +52 -23
- package/dist/esm/checkout/modal.js.map +1 -1
- package/dist/esm/checkout/payment-status.js +68 -28
- package/dist/esm/checkout/payment-status.js.map +1 -1
- package/dist/esm/checkout/provider-status.js +9 -0
- package/dist/esm/checkout/provider-status.js.map +1 -0
- package/dist/esm/checkout/providers/checkout-wallet.js +140 -44
- package/dist/esm/checkout/providers/checkout-wallet.js.map +1 -1
- package/dist/esm/checkout/providers/wagmi-config.js +6 -3
- package/dist/esm/checkout/providers/wagmi-config.js.map +1 -1
- package/dist/esm/checkout/refund-notice.js +16 -0
- package/dist/esm/checkout/refund-notice.js.map +1 -0
- package/dist/esm/checkout/resume-state.js +207 -1
- package/dist/esm/checkout/resume-state.js.map +1 -1
- package/dist/esm/checkout/surplus-refund.js +12 -0
- package/dist/esm/checkout/surplus-refund.js.map +1 -1
- package/dist/esm/checkout/views/amount-header.js +11 -2
- package/dist/esm/checkout/views/amount-header.js.map +1 -1
- package/dist/esm/checkout/views/claimable-funds.js +21 -13
- package/dist/esm/checkout/views/claimable-funds.js.map +1 -1
- package/dist/esm/checkout/views/crypto-intent/direct-details.js +288 -888
- package/dist/esm/checkout/views/crypto-intent/direct-details.js.map +1 -1
- package/dist/esm/checkout/views/crypto-intent/manual-instruction-card.js +239 -0
- package/dist/esm/checkout/views/crypto-intent/manual-instruction-card.js.map +1 -0
- package/dist/esm/checkout/views/crypto-intent/manual-payment-summary.js +2 -26
- package/dist/esm/checkout/views/crypto-intent/manual-payment-summary.js.map +1 -1
- package/dist/esm/checkout/views/crypto-intent/manual-refresh.js +19 -0
- package/dist/esm/checkout/views/crypto-intent/manual-refresh.js.map +1 -0
- package/dist/esm/checkout/views/crypto-intent/manual-refund-preference.js +151 -23
- package/dist/esm/checkout/views/crypto-intent/manual-refund-preference.js.map +1 -1
- package/dist/esm/checkout/views/crypto-intent/manual-route-picker.js +309 -0
- package/dist/esm/checkout/views/crypto-intent/manual-route-picker.js.map +1 -0
- package/dist/esm/checkout/views/crypto-intent/manual-sources.js +155 -0
- package/dist/esm/checkout/views/crypto-intent/manual-sources.js.map +1 -0
- package/dist/esm/checkout/views/crypto-intent/manual-transfer-instructions.js +84 -0
- package/dist/esm/checkout/views/crypto-intent/manual-transfer-instructions.js.map +1 -0
- package/dist/esm/checkout/views/crypto-intent/payment-route-error.js +10 -0
- package/dist/esm/checkout/views/crypto-intent/payment-route-error.js.map +1 -0
- package/dist/esm/checkout/views/crypto-intent/processing.js +183 -32
- package/dist/esm/checkout/views/crypto-intent/processing.js.map +1 -1
- package/dist/esm/checkout/views/crypto-intent/success.js +74 -46
- package/dist/esm/checkout/views/crypto-intent/success.js.map +1 -1
- package/dist/esm/checkout/views/crypto-intent/wallet-payment-confirmation-amount.js +14 -24
- package/dist/esm/checkout/views/crypto-intent/wallet-payment-confirmation-amount.js.map +1 -1
- package/dist/esm/checkout/views/crypto-intent/wallet-payment-discovery.js +61 -0
- package/dist/esm/checkout/views/crypto-intent/wallet-payment-discovery.js.map +1 -0
- package/dist/esm/checkout/views/crypto-intent/wallet-payment-options.js +105 -627
- package/dist/esm/checkout/views/crypto-intent/wallet-payment-options.js.map +1 -1
- package/dist/esm/checkout/views/crypto-intent/wallet-payment-options.styles.js +506 -0
- package/dist/esm/checkout/views/crypto-intent/wallet-payment-options.styles.js.map +1 -0
- package/dist/esm/checkout/views/crypto-intent/wallet-select.js +4 -11
- package/dist/esm/checkout/views/crypto-intent/wallet-select.js.map +1 -1
- package/dist/esm/checkout/views/failed.js +44 -55
- package/dist/esm/checkout/views/failed.js.map +1 -1
- package/dist/esm/checkout/views/funding-timeline.js +182 -0
- package/dist/esm/checkout/views/funding-timeline.js.map +1 -0
- package/dist/esm/checkout/views/initial.js +35 -46
- package/dist/esm/checkout/views/initial.js.map +1 -1
- package/dist/esm/checkout/views/method-select.js +6 -4
- package/dist/esm/checkout/views/method-select.js.map +1 -1
- package/dist/esm/checkout/views/payment-follower.js +128 -0
- package/dist/esm/checkout/views/payment-follower.js.map +1 -0
- package/dist/esm/checkout/views/restart.js +17 -2
- package/dist/esm/checkout/views/restart.js.map +1 -1
- package/dist/esm/checkout/views/use-checkout-refund-status.js +75 -0
- package/dist/esm/checkout/views/use-checkout-refund-status.js.map +1 -0
- package/dist/esm/components/buttons/index.js +3 -2
- package/dist/esm/components/buttons/index.js.map +1 -1
- package/dist/esm/components/icons/search.js +5 -0
- package/dist/esm/components/icons/search.js.map +1 -0
- package/dist/esm/components/loading/index.js +2 -2
- package/dist/esm/components/loading/index.js.map +1 -1
- package/dist/esm/components/modals/modal-with-views.js +8 -14
- package/dist/esm/components/modals/modal-with-views.js.map +1 -1
- package/dist/esm/components/modals/modal.js +3 -3
- package/dist/esm/components/modals/modal.js.map +1 -1
- package/dist/esm/components/modals/transition-view.js +16 -0
- package/dist/esm/components/modals/transition-view.js.map +1 -0
- package/dist/esm/components/modals/use-modal-with-views.js +17 -19
- package/dist/esm/components/modals/use-modal-with-views.js.map +1 -1
- package/dist/esm/components/wallet-selector/wallets/wagmi/index.js +36 -2
- package/dist/esm/components/wallet-selector/wallets/wagmi/index.js.map +1 -1
- package/dist/esm/config.js.map +1 -1
- package/dist/esm/integrations/bitcoin-metamask.js +87 -0
- package/dist/esm/integrations/bitcoin-metamask.js.map +1 -0
- package/dist/esm/integrations/bitcoin-network.js +59 -0
- package/dist/esm/integrations/bitcoin-network.js.map +1 -0
- package/dist/esm/integrations/bitcoin-psbt.js +4 -0
- package/dist/esm/integrations/bitcoin-psbt.js.map +1 -0
- package/dist/esm/integrations/bitcoin-source.js +12 -0
- package/dist/esm/integrations/bitcoin-source.js.map +1 -0
- package/dist/esm/integrations/bitcoin-wallet.js +225 -0
- package/dist/esm/integrations/bitcoin-wallet.js.map +1 -0
- package/dist/esm/integrations/evm-chain.js +18 -0
- package/dist/esm/integrations/evm-chain.js.map +1 -1
- package/dist/esm/integrations/guarded-wallet-client.js +19 -0
- package/dist/esm/integrations/guarded-wallet-client.js.map +1 -0
- package/dist/esm/integrations/lifi.js +134 -45
- package/dist/esm/integrations/lifi.js.map +1 -1
- package/dist/esm/refund/index.js +237 -227
- package/dist/esm/refund/index.js.map +1 -1
- package/dist/esm/state/checkout/bitcoin-payment.js +254 -0
- package/dist/esm/state/checkout/bitcoin-payment.js.map +1 -0
- package/dist/esm/state/checkout/checkout-state.js +5 -11
- package/dist/esm/state/checkout/checkout-state.js.map +1 -1
- package/dist/esm/state/checkout/funding.js +5 -0
- package/dist/esm/state/checkout/funding.js.map +1 -0
- package/dist/esm/state/checkout/issuance-conflicts.js +29 -0
- package/dist/esm/state/checkout/issuance-conflicts.js.map +1 -0
- package/dist/esm/state/checkout/manual-route.js +10 -0
- package/dist/esm/state/checkout/manual-route.js.map +1 -0
- package/dist/esm/state/checkout/payment-attempt.js +44 -20
- package/dist/esm/state/checkout/payment-attempt.js.map +1 -1
- package/dist/esm/state/checkout/payment-lifecycle.js +9 -15
- package/dist/esm/state/checkout/payment-lifecycle.js.map +1 -1
- package/dist/esm/state/checkout/payment-observer.js +148 -0
- package/dist/esm/state/checkout/payment-observer.js.map +1 -0
- package/dist/esm/state/checkout/payment-phase.js +142 -0
- package/dist/esm/state/checkout/payment-phase.js.map +1 -0
- package/dist/esm/state/checkout/quote-countdown.js +26 -0
- package/dist/esm/state/checkout/quote-countdown.js.map +1 -0
- package/dist/esm/state/checkout/quote-lifecycle.js +145 -144
- package/dist/esm/state/checkout/quote-lifecycle.js.map +1 -1
- package/dist/esm/state/checkout/route-estimate.js +77 -0
- package/dist/esm/state/checkout/route-estimate.js.map +1 -0
- package/dist/esm/state/checkout/store.js +348 -313
- package/dist/esm/state/checkout/store.js.map +1 -1
- package/dist/esm/state/checkout/wallet-payment.js +334 -37
- package/dist/esm/state/checkout/wallet-payment.js.map +1 -1
- package/dist/esm/state/checkout/wallet-transfer-receipt.js +68 -0
- package/dist/esm/state/checkout/wallet-transfer-receipt.js.map +1 -0
- package/dist/esm/utils/string.js +2 -0
- package/dist/esm/utils/string.js.map +1 -1
- package/dist/esm/utils/token-amount.js +88 -0
- package/dist/esm/utils/token-amount.js.map +1 -0
- package/dist/esm/utils/wallet-errors.js +21 -4
- package/dist/esm/utils/wallet-errors.js.map +1 -1
- package/dist/types/api/errors.d.ts +37 -0
- package/dist/types/api/errors.d.ts.map +1 -0
- package/dist/types/api/generated.d.ts +4570 -707
- package/dist/types/api/generated.d.ts.map +1 -1
- package/dist/types/api/payments.d.ts +22 -2
- package/dist/types/api/payments.d.ts.map +1 -1
- package/dist/types/api/tokens.d.ts +6 -0
- package/dist/types/api/tokens.d.ts.map +1 -0
- package/dist/types/api/types.d.ts +30 -2
- package/dist/types/api/types.d.ts.map +1 -1
- package/dist/types/checkout/claimable-funds.d.ts +12 -2
- package/dist/types/checkout/claimable-funds.d.ts.map +1 -1
- package/dist/types/checkout/creation-error-modal.d.ts +2 -1
- package/dist/types/checkout/creation-error-modal.d.ts.map +1 -1
- package/dist/types/checkout/index.d.ts +23 -2
- package/dist/types/checkout/index.d.ts.map +1 -1
- package/dist/types/checkout/modal.d.ts +5 -2
- package/dist/types/checkout/modal.d.ts.map +1 -1
- package/dist/types/checkout/payment-status.d.ts +10 -2
- package/dist/types/checkout/payment-status.d.ts.map +1 -1
- package/dist/types/checkout/provider-status.d.ts +11 -0
- package/dist/types/checkout/provider-status.d.ts.map +1 -0
- package/dist/types/checkout/providers/checkout-wallet.d.ts +2 -3
- package/dist/types/checkout/providers/checkout-wallet.d.ts.map +1 -1
- package/dist/types/checkout/providers/wagmi-config.d.ts.map +1 -1
- package/dist/types/checkout/refund-notice.d.ts +7 -0
- package/dist/types/checkout/refund-notice.d.ts.map +1 -0
- package/dist/types/checkout/resume-state.d.ts +63 -1
- package/dist/types/checkout/resume-state.d.ts.map +1 -1
- package/dist/types/checkout/surplus-refund.d.ts +8 -0
- package/dist/types/checkout/surplus-refund.d.ts.map +1 -1
- package/dist/types/checkout/views/amount-header.d.ts +1 -0
- package/dist/types/checkout/views/amount-header.d.ts.map +1 -1
- package/dist/types/checkout/views/claimable-funds.d.ts.map +1 -1
- package/dist/types/checkout/views/crypto-intent/direct-details.d.ts +3 -13
- package/dist/types/checkout/views/crypto-intent/direct-details.d.ts.map +1 -1
- package/dist/types/checkout/views/crypto-intent/manual-instruction-card.d.ts +11 -0
- package/dist/types/checkout/views/crypto-intent/manual-instruction-card.d.ts.map +1 -0
- package/dist/types/checkout/views/crypto-intent/manual-payment-summary.d.ts +4 -11
- package/dist/types/checkout/views/crypto-intent/manual-payment-summary.d.ts.map +1 -1
- package/dist/types/checkout/views/crypto-intent/manual-refresh.d.ts +4 -0
- package/dist/types/checkout/views/crypto-intent/manual-refresh.d.ts.map +1 -0
- package/dist/types/checkout/views/crypto-intent/manual-refund-preference.d.ts +14 -10
- package/dist/types/checkout/views/crypto-intent/manual-refund-preference.d.ts.map +1 -1
- package/dist/types/checkout/views/crypto-intent/manual-route-picker.d.ts +18 -0
- package/dist/types/checkout/views/crypto-intent/manual-route-picker.d.ts.map +1 -0
- package/dist/types/checkout/views/crypto-intent/manual-sources.d.ts +33 -0
- package/dist/types/checkout/views/crypto-intent/manual-sources.d.ts.map +1 -0
- package/dist/types/checkout/views/crypto-intent/manual-transfer-instructions.d.ts +18 -0
- package/dist/types/checkout/views/crypto-intent/manual-transfer-instructions.d.ts.map +1 -0
- package/dist/types/checkout/views/crypto-intent/payment-route-error.d.ts +2 -0
- package/dist/types/checkout/views/crypto-intent/payment-route-error.d.ts.map +1 -0
- package/dist/types/checkout/views/crypto-intent/processing.d.ts +3 -2
- package/dist/types/checkout/views/crypto-intent/processing.d.ts.map +1 -1
- package/dist/types/checkout/views/crypto-intent/success.d.ts +2 -1
- package/dist/types/checkout/views/crypto-intent/success.d.ts.map +1 -1
- package/dist/types/checkout/views/crypto-intent/wallet-payment-confirmation-amount.d.ts +8 -8
- package/dist/types/checkout/views/crypto-intent/wallet-payment-confirmation-amount.d.ts.map +1 -1
- package/dist/types/checkout/views/crypto-intent/wallet-payment-discovery.d.ts +17 -0
- package/dist/types/checkout/views/crypto-intent/wallet-payment-discovery.d.ts.map +1 -0
- package/dist/types/checkout/views/crypto-intent/wallet-payment-options.d.ts +2 -1
- package/dist/types/checkout/views/crypto-intent/wallet-payment-options.d.ts.map +1 -1
- package/dist/types/checkout/views/crypto-intent/wallet-payment-options.styles.d.ts +61 -0
- package/dist/types/checkout/views/crypto-intent/wallet-payment-options.styles.d.ts.map +1 -0
- package/dist/types/checkout/views/crypto-intent/wallet-select.d.ts +1 -2
- package/dist/types/checkout/views/crypto-intent/wallet-select.d.ts.map +1 -1
- package/dist/types/checkout/views/failed.d.ts +6 -0
- package/dist/types/checkout/views/failed.d.ts.map +1 -1
- package/dist/types/checkout/views/funding-timeline.d.ts +21 -0
- package/dist/types/checkout/views/funding-timeline.d.ts.map +1 -0
- package/dist/types/checkout/views/initial.d.ts +2 -4
- package/dist/types/checkout/views/initial.d.ts.map +1 -1
- package/dist/types/checkout/views/method-select.d.ts +2 -1
- package/dist/types/checkout/views/method-select.d.ts.map +1 -1
- package/dist/types/checkout/views/payment-follower.d.ts +12 -0
- package/dist/types/checkout/views/payment-follower.d.ts.map +1 -0
- package/dist/types/checkout/views/restart.d.ts +1 -1
- package/dist/types/checkout/views/restart.d.ts.map +1 -1
- package/dist/types/checkout/views/use-checkout-refund-status.d.ts +74 -0
- package/dist/types/checkout/views/use-checkout-refund-status.d.ts.map +1 -0
- package/dist/types/components/buttons/index.d.ts.map +1 -1
- package/dist/types/components/icons/search.d.ts +2 -0
- package/dist/types/components/icons/search.d.ts.map +1 -0
- package/dist/types/components/loading/index.d.ts +6 -1
- package/dist/types/components/loading/index.d.ts.map +1 -1
- package/dist/types/components/modals/modal-with-views.d.ts +3 -1
- package/dist/types/components/modals/modal-with-views.d.ts.map +1 -1
- package/dist/types/components/modals/modal.d.ts +2 -1
- package/dist/types/components/modals/modal.d.ts.map +1 -1
- package/dist/types/components/modals/transition-view.d.ts +2 -0
- package/dist/types/components/modals/transition-view.d.ts.map +1 -0
- package/dist/types/components/modals/use-modal-with-views.d.ts +2 -1
- package/dist/types/components/modals/use-modal-with-views.d.ts.map +1 -1
- package/dist/types/components/wallet-selector/domain.d.ts +1 -1
- package/dist/types/components/wallet-selector/domain.d.ts.map +1 -1
- package/dist/types/components/wallet-selector/wallets/wagmi/index.d.ts +2 -1
- package/dist/types/components/wallet-selector/wallets/wagmi/index.d.ts.map +1 -1
- package/dist/types/config.d.ts +2 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/integrations/bitcoin-metamask.d.ts +11 -0
- package/dist/types/integrations/bitcoin-metamask.d.ts.map +1 -0
- package/dist/types/integrations/bitcoin-network.d.ts +13 -0
- package/dist/types/integrations/bitcoin-network.d.ts.map +1 -0
- package/dist/types/integrations/bitcoin-psbt.d.ts +5 -0
- package/dist/types/integrations/bitcoin-psbt.d.ts.map +1 -0
- package/dist/types/integrations/bitcoin-source.d.ts +12 -0
- package/dist/types/integrations/bitcoin-source.d.ts.map +1 -0
- package/dist/types/integrations/bitcoin-wallet.d.ts +63 -0
- package/dist/types/integrations/bitcoin-wallet.d.ts.map +1 -0
- package/dist/types/integrations/evm-chain.d.ts +5 -0
- package/dist/types/integrations/evm-chain.d.ts.map +1 -1
- package/dist/types/integrations/guarded-wallet-client.d.ts +4 -0
- package/dist/types/integrations/guarded-wallet-client.d.ts.map +1 -0
- package/dist/types/integrations/lifi.d.ts +42 -0
- package/dist/types/integrations/lifi.d.ts.map +1 -1
- package/dist/types/refund/index.d.ts +1 -1
- package/dist/types/refund/index.d.ts.map +1 -1
- package/dist/types/state/checkout/bitcoin-payment.d.ts +28 -0
- package/dist/types/state/checkout/bitcoin-payment.d.ts.map +1 -0
- package/dist/types/state/checkout/checkout-state.d.ts +46 -13
- package/dist/types/state/checkout/checkout-state.d.ts.map +1 -1
- package/dist/types/state/checkout/funding.d.ts +6 -0
- package/dist/types/state/checkout/funding.d.ts.map +1 -0
- package/dist/types/state/checkout/issuance-conflicts.d.ts +22 -0
- package/dist/types/state/checkout/issuance-conflicts.d.ts.map +1 -0
- package/dist/types/state/checkout/manual-route.d.ts +13 -0
- package/dist/types/state/checkout/manual-route.d.ts.map +1 -0
- package/dist/types/state/checkout/payment-attempt.d.ts +19 -1
- package/dist/types/state/checkout/payment-attempt.d.ts.map +1 -1
- package/dist/types/state/checkout/payment-lifecycle.d.ts +6 -8
- package/dist/types/state/checkout/payment-lifecycle.d.ts.map +1 -1
- package/dist/types/state/checkout/payment-observer.d.ts +42 -0
- package/dist/types/state/checkout/payment-observer.d.ts.map +1 -0
- package/dist/types/state/checkout/payment-phase.d.ts +118 -0
- package/dist/types/state/checkout/payment-phase.d.ts.map +1 -0
- package/dist/types/state/checkout/quote-countdown.d.ts +15 -0
- package/dist/types/state/checkout/quote-countdown.d.ts.map +1 -0
- package/dist/types/state/checkout/quote-lifecycle.d.ts +17 -6
- package/dist/types/state/checkout/quote-lifecycle.d.ts.map +1 -1
- package/dist/types/state/checkout/route-estimate.d.ts +38 -0
- package/dist/types/state/checkout/route-estimate.d.ts.map +1 -0
- package/dist/types/state/checkout/store.d.ts +35 -15
- package/dist/types/state/checkout/store.d.ts.map +1 -1
- package/dist/types/state/checkout/wallet-payment.d.ts +15 -2
- package/dist/types/state/checkout/wallet-payment.d.ts.map +1 -1
- package/dist/types/state/checkout/wallet-transfer-receipt.d.ts +18 -0
- package/dist/types/state/checkout/wallet-transfer-receipt.d.ts.map +1 -0
- package/dist/types/utils/string.d.ts +2 -0
- package/dist/types/utils/string.d.ts.map +1 -1
- package/dist/types/utils/token-amount.d.ts +18 -0
- package/dist/types/utils/token-amount.d.ts.map +1 -0
- package/dist/types/utils/wallet-errors.d.ts.map +1 -1
- package/package.json +3 -1
- package/dist/esm/refund/confirmation.js +0 -30
- package/dist/esm/refund/confirmation.js.map +0 -1
- package/dist/types/refund/confirmation.d.ts +0 -14
- package/dist/types/refund/confirmation.d.ts.map +0 -1
|
@@ -1,10 +1,28 @@
|
|
|
1
|
-
import type { PaymentsCryptoPayCreatePayload } from "../../api/generated.js";
|
|
1
|
+
import type { PaymentsCryptoPayCreatePayload, PaymentsCryptoPayEstimateCreatePayload } from "../../api/generated.js";
|
|
2
|
+
import type { CryptoCurrency } from "../../api/types.js";
|
|
2
3
|
import type { WalletPaymentOption, WalletPaymentQuote } from "../../config.js";
|
|
4
|
+
type RouteSource = Pick<CryptoCurrency, "asset" | "chain">;
|
|
5
|
+
/** Prices a wallet route while browsing; it carries no refund recipient. */
|
|
6
|
+
export declare function buildWalletEstimatePayload(args: {
|
|
7
|
+
option: WalletPaymentOption;
|
|
8
|
+
sendingAddress: string;
|
|
9
|
+
}): PaymentsCryptoPayEstimateCreatePayload;
|
|
3
10
|
export declare function buildWalletPaymentAttemptPayload(args: {
|
|
4
11
|
option: WalletPaymentOption;
|
|
5
12
|
sendingAddress: string;
|
|
6
13
|
quote?: WalletPaymentQuote | null;
|
|
7
14
|
requiredConfirmations?: number;
|
|
8
15
|
quoteRequestId?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Set only by the first issuing call: the refund recipient is frozen at
|
|
18
|
+
* issuance and never sent afterwards (QCT D1, D7).
|
|
19
|
+
*/
|
|
20
|
+
refundTo?: string | null;
|
|
9
21
|
}): PaymentsCryptoPayCreatePayload;
|
|
22
|
+
/**
|
|
23
|
+
* The manual route fields, classified against the settlement asset routes
|
|
24
|
+
* are priced in: an issued payment's frozen asset, else the checkout's.
|
|
25
|
+
*/
|
|
26
|
+
export declare function buildManualRoutePayload(source: RouteSource, settlement: RouteSource, mode?: "wallet" | "relay_deposit"): Pick<PaymentsCryptoPayCreatePayload, "mode" | "source" | "routing">;
|
|
27
|
+
export {};
|
|
10
28
|
//# sourceMappingURL=payment-attempt.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payment-attempt.d.ts","sourceRoot":"","sources":["../../../../src/state/checkout/payment-attempt.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"payment-attempt.d.ts","sourceRoot":"","sources":["../../../../src/state/checkout/payment-attempt.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,8BAA8B,EAC9B,sCAAsC,EACvC,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE/E,KAAK,WAAW,GAAG,IAAI,CAAC,cAAc,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC;AAQ3D,4EAA4E;AAC5E,wBAAgB,0BAA0B,CAAC,IAAI,EAAE;IAC/C,MAAM,EAAE,mBAAmB,CAAC;IAC5B,cAAc,EAAE,MAAM,CAAC;CACxB,GAAG,sCAAsC,CAOzC;AAED,wBAAgB,gCAAgC,CAAC,IAAI,EAAE;IACrD,MAAM,EAAE,mBAAmB,CAAC;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAClC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,GAAG,8BAA8B,CA4CjC;AAKD;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,WAAW,EACnB,UAAU,EAAE,WAAW,EACvB,IAAI,CAAC,EAAE,QAAQ,GAAG,eAAe,GAChC,IAAI,CAAC,8BAA8B,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC,CAarE"}
|
|
@@ -5,6 +5,7 @@ type AttemptLike = {
|
|
|
5
5
|
created_at?: string | null;
|
|
6
6
|
updated_at?: string | null;
|
|
7
7
|
} | null;
|
|
8
|
+
export declare const parseTime: (value?: string | null) => number | null;
|
|
8
9
|
/**
|
|
9
10
|
* Earliest moment the current quote stops being payable — the sooner of the
|
|
10
11
|
* displayed window and any provider (e.g. Relay) window. `null` when the
|
|
@@ -22,17 +23,14 @@ export declare const getAttemptQuoteTiming: (attempt?: AttemptLike) => {
|
|
|
22
23
|
* whether we should refresh, nothing about failure.
|
|
23
24
|
*/
|
|
24
25
|
export declare const isAttemptStale: (attempt?: AttemptLike) => boolean;
|
|
25
|
-
export declare const isPaymentSettled: (payment?: Payment | null) => boolean;
|
|
26
|
-
export declare const isPaymentProcessing: (payment?: Payment | null, confirmationStatus?: PaymentStatus | string) => boolean;
|
|
27
|
-
export declare const isPaymentFailed: (payment?: Payment | null) => boolean;
|
|
28
26
|
export declare const isPaymentConfirmed: (status: Payment["status"] | undefined, confirmationStatus?: PaymentStatus) => boolean;
|
|
29
|
-
export declare const isPaymentPollingTerminal: (status: PaymentStatus, confirmationStatus?: PaymentStatus) => boolean;
|
|
30
27
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* is
|
|
28
|
+
* Whether the checkout may ask for instructions at all. A payment keeps one
|
|
29
|
+
* attempt and its terms (QCT D1); the API alone decides admission and answers
|
|
30
|
+
* a closed payment with a stable 409, so only a settled or in-flight payment
|
|
31
|
+
* is skipped here.
|
|
35
32
|
*/
|
|
33
|
+
export declare const PAYMENT_NO_LONGER_PAYABLE_MESSAGE = "This payment is no longer payable.";
|
|
36
34
|
export declare const canCreateFreshAttempt: (payment?: Payment | null) => boolean;
|
|
37
35
|
export declare const formatRemainingTime: (remainingMs: number | null) => string | null;
|
|
38
36
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payment-lifecycle.d.ts","sourceRoot":"","sources":["../../../../src/state/checkout/payment-lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAE5D,KAAK,WAAW,GAAG;IACjB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"payment-lifecycle.d.ts","sourceRoot":"","sources":["../../../../src/state/checkout/payment-lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAE5D,KAAK,WAAW,GAAG;IACjB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,GAAG,IAAI,CAAC;AAET,eAAO,MAAM,SAAS,GAAI,QAAQ,MAAM,GAAG,IAAI,kBAI9C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,UAAU,WAAW,KAAG,MAAM,GAAG,IAOjE,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,UAAU,WAAW,KACpB;IACD,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CAmBhC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,UAAU,WAAW,YAGnD,CAAC;AAGF,eAAO,MAAM,kBAAkB,GAC7B,QAAQ,OAAO,CAAC,QAAQ,CAAC,GAAG,SAAS,EACrC,qBAAoB,aAAkC,YAII,CAAC;AAE7D;;;;;GAKG;AACH,eAAO,MAAM,iCAAiC,uCACR,CAAC;AAEvC,eAAO,MAAM,qBAAqB,GAAI,UAAU,OAAO,GAAG,IAAI,YAS7D,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,aAAa,MAAM,GAAG,IAAI,kBAQ7D,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type CheckoutState } from "./checkout-state.js";
|
|
2
|
+
import type { CryptoPaymentAttempt, Payment } from "../../api/types.js";
|
|
3
|
+
import type { BitcoinBroadcastEvidence } from "../../checkout/resume-state.js";
|
|
4
|
+
/**
|
|
5
|
+
* Returns `prev` when `next` holds the same data. Otherwise returns `next`
|
|
6
|
+
* with every unchanged part replaced by the same part of `prev`, so unchanged
|
|
7
|
+
* parts keep their identity and nothing keyed on them re-renders or re-runs.
|
|
8
|
+
*/
|
|
9
|
+
export declare const replaceEqualDeep: <T>(prev: unknown, next: T) => T;
|
|
10
|
+
interface PaymentObserverDependencies {
|
|
11
|
+
get: () => CheckoutState;
|
|
12
|
+
captureOpening: (additional?: () => boolean) => () => boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Stores the payment and its attempt, and syncs the quote with them unless
|
|
15
|
+
* `syncQuote` is false.
|
|
16
|
+
*/
|
|
17
|
+
updatePaymentSnapshot: (payment: Payment, attempt: CryptoPaymentAttempt | null, syncQuote: boolean, verifiedRefund?: BitcoinBroadcastEvidence) => void;
|
|
18
|
+
/** Rebuilds `checkout`, `methods` and `cryptoCurrency` from the payment. */
|
|
19
|
+
hydrateCheckout: (payment: Payment) => void;
|
|
20
|
+
reconcileWalletTopUp: (payment: Payment) => void;
|
|
21
|
+
}
|
|
22
|
+
type PaymentFollowing = {
|
|
23
|
+
/** Read at once, or wait one interval first. */
|
|
24
|
+
readNow: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Runs after each read, including reads that changed nothing, for views
|
|
27
|
+
* that act once per read.
|
|
28
|
+
*/
|
|
29
|
+
onRead?: () => void;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* The checkout's one payment observer. The checkout follows its payment
|
|
33
|
+
* through `followPayment`, which the modal's payment follower starts and
|
|
34
|
+
* stops.
|
|
35
|
+
*/
|
|
36
|
+
export declare const createPaymentObserver: ({ get, captureOpening, updatePaymentSnapshot, hydrateCheckout, reconcileWalletTopUp, }: PaymentObserverDependencies) => {
|
|
37
|
+
followPayment: ({ readNow, onRead }: PaymentFollowing) => {
|
|
38
|
+
stop: () => void;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=payment-observer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-observer.d.ts","sourceRoot":"","sources":["../../../../src/state/checkout/payment-observer.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIzD,OAAO,KAAK,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAO/E;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,EAAE,MAAM,OAAO,EAAE,MAAM,CAAC,KAAG,CA0B5D,CAAC;AAKF,UAAU,2BAA2B;IACnC,GAAG,EAAE,MAAM,aAAa,CAAC;IACzB,cAAc,EAAE,CAAC,UAAU,CAAC,EAAE,MAAM,OAAO,KAAK,MAAM,OAAO,CAAC;IAC9D;;;OAGG;IACH,qBAAqB,EAAE,CACrB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,oBAAoB,GAAG,IAAI,EACpC,SAAS,EAAE,OAAO,EAClB,cAAc,CAAC,EAAE,wBAAwB,KACtC,IAAI,CAAC;IACV,4EAA4E;IAC5E,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5C,oBAAoB,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CAClD;AAED,KAAK,gBAAgB,GAAG;IACtB,gDAAgD;IAChD,OAAO,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAAI,wFAMnC,2BAA2B;yCAmDgB,gBAAgB;;;CAkE7D,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { type Payment } from "../../api/types.js";
|
|
2
|
+
type PhaseFacts = {
|
|
3
|
+
/** A test payment, or one of a test checkout: its outcome is simulated. */
|
|
4
|
+
test: boolean;
|
|
5
|
+
/** Instructions were issued: the payment holds its only attempt. */
|
|
6
|
+
issued: boolean;
|
|
7
|
+
/** The issued instructions are a Relay deposit address. */
|
|
8
|
+
relay: boolean;
|
|
9
|
+
/** Relay detected a transfer and checkout should wait for its outcome. */
|
|
10
|
+
relayTransferDetected: boolean;
|
|
11
|
+
/** Relay failed or refunded the current request, so it delivers nothing. */
|
|
12
|
+
relayFailed: boolean;
|
|
13
|
+
/** The settlement cutoff passed: the payment accepts no more funds. */
|
|
14
|
+
cutoffPassed: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* A wallet broadcast the payer's transfer: the API recorded it, or this
|
|
17
|
+
* checkout holds a broadcast it has not reported yet.
|
|
18
|
+
*/
|
|
19
|
+
broadcast: boolean;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Where a payment stands for the buyer, from the API's payment alone. The
|
|
23
|
+
* pending phases split by what reached the payment: nothing (and what Relay
|
|
24
|
+
* says about the deposit), part of the amount due, or all of it. The others
|
|
25
|
+
* follow the payment's status.
|
|
26
|
+
*/
|
|
27
|
+
export type PaymentPhase = PhaseFacts & ({
|
|
28
|
+
kind: "unissued";
|
|
29
|
+
}
|
|
30
|
+
/** Nothing received; Relay, if any, still waits for the deposit. */
|
|
31
|
+
| {
|
|
32
|
+
kind: "awaiting_deposit";
|
|
33
|
+
}
|
|
34
|
+
/** Nothing received yet; Relay is delivering or delivered the deposit. */
|
|
35
|
+
| {
|
|
36
|
+
kind: "relay_delivering";
|
|
37
|
+
}
|
|
38
|
+
/** Nothing received, and the Relay request failed or was refunded. */
|
|
39
|
+
| {
|
|
40
|
+
kind: "relay_delivered_nothing";
|
|
41
|
+
providerStatus: "failed" | "refund_pending";
|
|
42
|
+
}
|
|
43
|
+
/** Part of the amount due arrived; the API's shortfall is still needed. */
|
|
44
|
+
| {
|
|
45
|
+
kind: "partly_funded";
|
|
46
|
+
shortfall: string;
|
|
47
|
+
}
|
|
48
|
+
/** The amount due arrived; the scan moves the payment on. */
|
|
49
|
+
| {
|
|
50
|
+
kind: "funded";
|
|
51
|
+
}
|
|
52
|
+
/** Funds arrived and settlement is under way. */
|
|
53
|
+
| {
|
|
54
|
+
kind: "settling";
|
|
55
|
+
status: "confirming_payment" | "deferred" | "refund_pending";
|
|
56
|
+
} | {
|
|
57
|
+
kind: "refundable";
|
|
58
|
+
} | {
|
|
59
|
+
kind: "paid";
|
|
60
|
+
} | {
|
|
61
|
+
kind: "failed";
|
|
62
|
+
});
|
|
63
|
+
export type PaymentPhaseKind = PaymentPhase["kind"];
|
|
64
|
+
export type PaymentPhaseContext = {
|
|
65
|
+
/** The time the settlement cutoff is compared with. */
|
|
66
|
+
now?: number;
|
|
67
|
+
/** This checkout holds a wallet broadcast the API may not have recorded. */
|
|
68
|
+
walletBroadcast?: boolean;
|
|
69
|
+
};
|
|
70
|
+
type PhasePayment = Pick<Payment, "status"> & Partial<Pick<Payment, "is_test" | "checkout" | "payment_attempt" | "funding" | "timeline">>;
|
|
71
|
+
export declare const derivePaymentPhase: (payment: PhasePayment | null | undefined, { now, walletBroadcast }?: PaymentPhaseContext) => PaymentPhase;
|
|
72
|
+
/** The payment is still pending: no status view owns it yet. */
|
|
73
|
+
export declare const isPendingPhase: (phase: PaymentPhase) => boolean;
|
|
74
|
+
/**
|
|
75
|
+
* The payment still accepts funds: pending, short of the amount due and
|
|
76
|
+
* before the settlement cutoff.
|
|
77
|
+
*/
|
|
78
|
+
export declare const acceptsFunds: (phase: PaymentPhase) => boolean;
|
|
79
|
+
/**
|
|
80
|
+
* A pending live payment with issued instructions that has received nothing,
|
|
81
|
+
* while Relay, if any, still waits. Only the chain scanner moves a payment on,
|
|
82
|
+
* seconds to minutes after funds land, so a payer whose wallet submitted the
|
|
83
|
+
* transfer or who confirmed sending may be waiting for it, or may have
|
|
84
|
+
* confirmed too early.
|
|
85
|
+
*/
|
|
86
|
+
export declare const isAwaitingDeposit: (phase: PaymentPhase) => boolean;
|
|
87
|
+
/** The API's shortfall of a partly funded payment, else null. */
|
|
88
|
+
export declare const pendingShortfall: (phase: PaymentPhase) => string | null;
|
|
89
|
+
/**
|
|
90
|
+
* Pending and holding funds, whether part of the amount due or all of it:
|
|
91
|
+
* after the cutoff the payer waits for their refund.
|
|
92
|
+
*/
|
|
93
|
+
export declare const holdsPendingFunds: (phase: PaymentPhase) => boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Whether the checkout reads the payment at all: a test payment's outcome is
|
|
96
|
+
* simulated, and nothing reaches an unissued one.
|
|
97
|
+
*/
|
|
98
|
+
export declare const isFollowedPhase: (phase: PaymentPhase) => boolean;
|
|
99
|
+
/**
|
|
100
|
+
* How often a followed payment is read: every 5 seconds while it is open or
|
|
101
|
+
* in flight, every 30 once it is terminal (paid, refundable or failed), so
|
|
102
|
+
* late deposits and claims still show.
|
|
103
|
+
*/
|
|
104
|
+
export declare const paymentReadInterval: (phase: PaymentPhase) => number;
|
|
105
|
+
/**
|
|
106
|
+
* Whether the payment's own state, rather than the payer's navigation, puts
|
|
107
|
+
* them on the payment status view. A method or instruction view would offer to
|
|
108
|
+
* pay the full amount again, or show instructions the API no longer accepts:
|
|
109
|
+
* - a failed payment: the API never issues it again, test payments included;
|
|
110
|
+
* - a pending payment whose transfer a wallet broadcast, until it arrives;
|
|
111
|
+
* - a Relay deposit in delivery, or any payment holding funds (a test payment
|
|
112
|
+
* only when Relay delivered them);
|
|
113
|
+
* - a payment that moved on, except on a first opening with nothing saved of
|
|
114
|
+
* a direct payment, which keeps the method picker (`navigated` false).
|
|
115
|
+
*/
|
|
116
|
+
export declare const belongsOnStatusView: (phase: PaymentPhase, navigated: boolean) => boolean;
|
|
117
|
+
export {};
|
|
118
|
+
//# sourceMappingURL=payment-phase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-phase.d.ts","sourceRoot":"","sources":["../../../../src/state/checkout/payment-phase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AASjE,KAAK,UAAU,GAAG;IAChB,2EAA2E;IAC3E,IAAI,EAAE,OAAO,CAAC;IACd,oEAAoE;IACpE,MAAM,EAAE,OAAO,CAAC;IAChB,2DAA2D;IAC3D,KAAK,EAAE,OAAO,CAAC;IACf,0EAA0E;IAC1E,qBAAqB,EAAE,OAAO,CAAC;IAC/B,4EAA4E;IAC5E,WAAW,EAAE,OAAO,CAAC;IACrB,uEAAuE;IACvE,YAAY,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,UAAU,GACnC,CACI;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE;AACtB,oEAAoE;GAClE;IAAE,IAAI,EAAE,kBAAkB,CAAA;CAAE;AAC9B,0EAA0E;GACxE;IAAE,IAAI,EAAE,kBAAkB,CAAA;CAAE;AAC9B,sEAAsE;GACpE;IACE,IAAI,EAAE,yBAAyB,CAAC;IAChC,cAAc,EAAE,QAAQ,GAAG,gBAAgB,CAAC;CAC7C;AACH,2EAA2E;GACzE;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE;AAC9C,6DAA6D;GAC3D;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE;AACpB,iDAAiD;GAC/C;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,oBAAoB,GAAG,UAAU,GAAG,gBAAgB,CAAC;CAC9D,GACD;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,GACtB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CACrB,CAAC;AAEJ,MAAM,MAAM,gBAAgB,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;AAEpD,MAAM,MAAM,mBAAmB,GAAG;IAChC,uDAAuD;IACvD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,KAAK,YAAY,GAAG,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,GACzC,OAAO,CACL,IAAI,CACF,OAAO,EACP,SAAS,GAAG,UAAU,GAAG,iBAAiB,GAAG,SAAS,GAAG,UAAU,CACpE,CACF,CAAC;AAEJ,eAAO,MAAM,kBAAkB,GAC7B,SAAS,YAAY,GAAG,IAAI,GAAG,SAAS,EACxC,2BAA+C,mBAAwB,KACtE,YA6DF,CAAC;AAWF,gEAAgE;AAChE,eAAO,MAAM,cAAc,GAAI,OAAO,YAAY,KAAG,OACrB,CAAC;AAEjC;;;GAGG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,YAAY,KAAG,OAIrB,CAAC;AAE/B;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAAI,OAAO,YAAY,KAAG,OACN,CAAC;AAEnD,iEAAiE;AACjE,eAAO,MAAM,gBAAgB,GAAI,OAAO,YAAY,KAAG,MAAM,GAAG,IACP,CAAC;AAE1D;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,OAAO,YAAY,KAAG,OACG,CAAC;AAE5D;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,YAAY,KAAG,OACzB,CAAC;AAE9B;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAAI,OAAO,YAAY,KAAG,MAKvB,CAAC;AAEpC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,GAC9B,OAAO,YAAY,EACnB,WAAW,OAAO,KACjB,OAiBF,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { QuoteState } from "./checkout-state.js";
|
|
2
|
+
import type { CryptoPaymentAttempt } from "../../api/types.js";
|
|
3
|
+
/** The share of the window left when the countdown turns urgent. */
|
|
4
|
+
export declare const QUOTE_COUNTDOWN_URGENT_THRESHOLD_RATIO = 0.25;
|
|
5
|
+
/**
|
|
6
|
+
* What the quote countdown shows, from one timing source. The quote
|
|
7
|
+
* lifecycle's countdown leads; it ticks with the quote's own expiry timer.
|
|
8
|
+
* Shown instructions whose quote has no countdown yet fall back to the issued
|
|
9
|
+
* attempt's expiry, ticking every second only while that fallback is shown.
|
|
10
|
+
*/
|
|
11
|
+
export declare const useQuoteCountdown: (quote: Pick<QuoteState, "remainingMs" | "totalDurationMs">, issuedAttempt?: CryptoPaymentAttempt | null) => {
|
|
12
|
+
remainingMs: number | null;
|
|
13
|
+
totalDurationMs: number | null;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=quote-countdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quote-countdown.d.ts","sourceRoot":"","sources":["../../../../src/state/checkout/quote-countdown.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,oEAAoE;AACpE,eAAO,MAAM,sCAAsC,OAAO,CAAC;AAE3D;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAC5B,OAAO,IAAI,CAAC,UAAU,EAAE,aAAa,GAAG,iBAAiB,CAAC,EAC1D,gBAAe,oBAAoB,GAAG,IAAW;;;CAoBlD,CAAC"}
|
|
@@ -1,20 +1,31 @@
|
|
|
1
|
-
import { type CheckoutState, type ManualAttemptOptions } from "./checkout-state.js";
|
|
1
|
+
import { type BrowsingQuote, type CheckoutState, type ManualAttemptOptions } from "./checkout-state.js";
|
|
2
2
|
import type { CryptoPaymentAttempt, Payment } from "../../api/types.js";
|
|
3
|
-
import type { WalletPaymentOption
|
|
3
|
+
import type { WalletPaymentOption } from "../../config.js";
|
|
4
|
+
/** A browsing price for the selected wallet route and when it stops being current. */
|
|
5
|
+
export type PricedWalletQuote = {
|
|
6
|
+
quote: BrowsingQuote;
|
|
7
|
+
expiresAt: number | null;
|
|
8
|
+
};
|
|
4
9
|
interface QuoteDependencies {
|
|
5
10
|
get: () => CheckoutState;
|
|
6
11
|
set: (update: (state: CheckoutState) => void) => void;
|
|
7
12
|
captureOpening: (additional?: () => boolean) => () => boolean;
|
|
8
|
-
|
|
13
|
+
/** Prices the selected wallet route through the estimate endpoint; never issues. */
|
|
14
|
+
priceWalletRoute: (option: WalletPaymentOption, walletAddress: string, ownsQuote: () => boolean) => Promise<PricedWalletQuote>;
|
|
15
|
+
/**
|
|
16
|
+
* Issues manual instructions. On PAYMENT_REQUIRES_NEW_LINK it has read the
|
|
17
|
+
* payment again before it rejects.
|
|
18
|
+
*/
|
|
9
19
|
createManualAttempt: (address: string, confirmations: number, refundTo: string | null, options: ManualAttemptOptions, ownsQuote: () => boolean) => Promise<CryptoPaymentAttempt>;
|
|
10
20
|
}
|
|
11
|
-
export declare const createQuoteLifecycle: ({ get, set, captureOpening,
|
|
21
|
+
export declare const createQuoteLifecycle: ({ get, set, captureOpening, priceWalletRoute, createManualAttempt, }: QuoteDependencies) => {
|
|
12
22
|
dispose: () => void;
|
|
13
23
|
getWalletQuoteRequestId: () => string;
|
|
14
|
-
|
|
24
|
+
clearWalletQuoteRequestId: (id: string) => void;
|
|
25
|
+
beginBitcoinWalletPreparation: () => () => boolean;
|
|
26
|
+
setWalletPaymentQuote: (data: BrowsingQuote) => void;
|
|
15
27
|
refreshQuote: (ownsConnection?: () => boolean) => Promise<void>;
|
|
16
28
|
syncQuote: (payment: Payment | null, attempt?: CryptoPaymentAttempt | null) => void;
|
|
17
|
-
configureWalletQuoteRefresh: (walletAddress: string | null) => void;
|
|
18
29
|
configureManualQuoteRefresh: () => void;
|
|
19
30
|
prepareWalletQuoteReplacement: (walletAddress?: string | null, selectedOptionId?: string | null) => void;
|
|
20
31
|
clearQuoteRefresh: (options?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quote-lifecycle.d.ts","sourceRoot":"","sources":["../../../../src/state/checkout/quote-lifecycle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"quote-lifecycle.d.ts","sourceRoot":"","sources":["../../../../src/state/checkout/quote-lifecycle.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,aAAa,EAGlB,KAAK,oBAAoB,EAC1B,MAAM,qBAAqB,CAAC;AAW7B,OAAO,KAAK,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAE3D,sFAAsF;AACtF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,aAAa,CAAC;IACrB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,CAAC;AAEF,UAAU,iBAAiB;IACzB,GAAG,EAAE,MAAM,aAAa,CAAC;IACzB,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,KAAK,IAAI,CAAC;IACtD,cAAc,EAAE,CAAC,UAAU,CAAC,EAAE,MAAM,OAAO,KAAK,MAAM,OAAO,CAAC;IAC9D,oFAAoF;IACpF,gBAAgB,EAAE,CAChB,MAAM,EAAE,mBAAmB,EAC3B,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,OAAO,KACrB,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAChC;;;OAGG;IACH,mBAAmB,EAAE,CACnB,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,OAAO,EAAE,oBAAoB,EAC7B,SAAS,EAAE,MAAM,OAAO,KACrB,OAAO,CAAC,oBAAoB,CAAC,CAAC;CACpC;AAOD,eAAO,MAAM,oBAAoB,GAAI,sEAMlC,iBAAiB;;;oCAwBqB,MAAM;;kCAmER,aAAa;oCAoJL,MAAM,OAAO;yBAiG/C,OAAO,GAAG,IAAI,YACb,oBAAoB,GAAG,IAAI;;oDA0BtB,MAAM,GAAG,IAAI;kCAyBnB;QAAE,qBAAqB,CAAC,EAAE,OAAO,CAAA;KAAE;4CAmB7B,MAAM,kBACL,MAAM,OAAO;6CAkBd,MAAM,WACZ,mBAAmB,EAAE;;CA2BjC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { PricedWalletQuote } from "./quote-lifecycle.js";
|
|
2
|
+
import type { CryptoCurrency, CryptoPayEstimate, CryptoPaymentAttempt } from "../../api/types.js";
|
|
3
|
+
import type { WalletPaymentOption, WalletPaymentQuote } from "../../config.js";
|
|
4
|
+
import type { WalletRouteQuoteTarget } from "../../integrations/lifi.js";
|
|
5
|
+
type SettlementAsset = Pick<CryptoCurrency, "asset" | "chain" | "asset_name">;
|
|
6
|
+
type IssuedAttempt = Pick<CryptoPaymentAttempt, "amount" | "amount_formatted" | "destination_address" | "settlement_token_address" | "settlement_config">;
|
|
7
|
+
/** A wallet estimate with its settlement amount in display units, when known. */
|
|
8
|
+
export type PricedRoute = {
|
|
9
|
+
estimate: CryptoPayEstimate;
|
|
10
|
+
/** The settlement amount this instruction should deliver. */
|
|
11
|
+
amountFormatted: string | null;
|
|
12
|
+
/** When the estimate stops being current (`quote_expires_at`). */
|
|
13
|
+
expiresAt: number | null;
|
|
14
|
+
};
|
|
15
|
+
export declare function priceBitcoinWalletEstimate(estimate: CryptoPayEstimate): PricedWalletQuote;
|
|
16
|
+
/**
|
|
17
|
+
* Formats an estimate's base units. An issued payment's attempt already
|
|
18
|
+
* carries the formatted amount due; otherwise the public token list gives the
|
|
19
|
+
* decimals. Nothing is computed beyond unit conversion.
|
|
20
|
+
*/
|
|
21
|
+
export declare function priceEstimate(estimate: CryptoPayEstimate, settlement: Pick<CryptoCurrency, "asset" | "chain">, attempt: Pick<CryptoPaymentAttempt, "amount" | "amount_formatted"> | null): Promise<PricedRoute>;
|
|
22
|
+
/**
|
|
23
|
+
* Where a routed wallet quote delivers. An issued payment targets its
|
|
24
|
+
* splitter; an unissued one has none yet, so the payer's address stands in
|
|
25
|
+
* for a price-only quote and Pay quotes the issued splitter again.
|
|
26
|
+
*/
|
|
27
|
+
export declare function buildWalletQuoteTarget(args: {
|
|
28
|
+
priced: PricedRoute;
|
|
29
|
+
attempt: IssuedAttempt | null;
|
|
30
|
+
settlement: SettlementAsset & {
|
|
31
|
+
chain_hex?: string | null;
|
|
32
|
+
};
|
|
33
|
+
walletAddress: string;
|
|
34
|
+
}): WalletRouteQuoteTarget;
|
|
35
|
+
/** The browsing quote shown for a direct route: the estimated amount due. */
|
|
36
|
+
export declare function buildDirectWalletQuote(option: WalletPaymentOption, priced: PricedRoute): WalletPaymentQuote;
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=route-estimate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-estimate.d.ts","sourceRoot":"","sources":["../../../../src/state/checkout/route-estimate.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC/E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEzE,KAAK,eAAe,GAAG,IAAI,CAAC,cAAc,EAAE,OAAO,GAAG,OAAO,GAAG,YAAY,CAAC,CAAC;AAC9E,KAAK,aAAa,GAAG,IAAI,CACvB,oBAAoB,EAClB,QAAQ,GACR,kBAAkB,GAClB,qBAAqB,GACrB,0BAA0B,GAC1B,mBAAmB,CACtB,CAAC;AAEF,iFAAiF;AACjF,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,6DAA6D;IAC7D,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,kEAAkE;IAClE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,CAAC;AAEF,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,iBAAiB,GAC1B,iBAAiB,CAcnB;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CACjC,QAAQ,EAAE,iBAAiB,EAC3B,UAAU,EAAE,IAAI,CAAC,cAAc,EAAE,OAAO,GAAG,OAAO,CAAC,EACnD,OAAO,EAAE,IAAI,CAAC,oBAAoB,EAAE,QAAQ,GAAG,kBAAkB,CAAC,GAAG,IAAI,GACxE,OAAO,CAAC,WAAW,CAAC,CAetB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE;IAC3C,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,aAAa,GAAG,IAAI,CAAC;IAC9B,UAAU,EAAE,eAAe,GAAG;QAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IAC5D,aAAa,EAAE,MAAM,CAAC;CACvB,GAAG,sBAAsB,CAuBzB;AAED,6EAA6E;AAC7E,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,mBAAmB,EAC3B,MAAM,EAAE,WAAW,GAClB,kBAAkB,CAapB"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { Checkout, CheckoutMethod, CryptoCurrency, Payment, CryptoPaymentAttempt
|
|
2
|
-
import {
|
|
1
|
+
import { Checkout, CheckoutMethod, CryptoCurrency, Payment, CryptoPaymentAttempt } from "../../api/types.js";
|
|
2
|
+
import { type ManualTransfer, type WalletTopUp, type WalletTopUpInFlight, type WalletTransactionIdentity } from "../../checkout/resume-state.js";
|
|
3
|
+
import { Transfer } from "../../components/wallet-selector/domain.js";
|
|
3
4
|
import { WalletPaymentOption, WalletPaymentQuote } from "../../config.js";
|
|
4
5
|
import { type CheckoutState, type WalletPaymentUpdate, type ManualAttemptOptions } from "./checkout-state.js";
|
|
6
|
+
import { type PricedWalletQuote } from "./quote-lifecycle.js";
|
|
5
7
|
export { ACTIONS } from "./checkout-state.js";
|
|
6
8
|
export declare const useCheckoutStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<CheckoutState>, "setState"> & {
|
|
7
9
|
setState(nextStateOrUpdater: CheckoutState | Partial<CheckoutState> | ((state: import("immer").WritableDraft<CheckoutState>) => void), shouldReplace?: false): void;
|
|
@@ -9,34 +11,52 @@ export declare const useCheckoutStore: import("zustand").UseBoundStore<Omit<impo
|
|
|
9
11
|
}>;
|
|
10
12
|
export declare const captureCheckoutOpening: (additional?: () => boolean) => () => boolean;
|
|
11
13
|
export declare const beginCheckoutOpening: () => () => void;
|
|
12
|
-
export declare const refreshQuote: (ownsConnection?: () => boolean) => Promise<void>, syncQuote: (payment: Payment | null, attempt?: CryptoPaymentAttempt | null) => void,
|
|
14
|
+
export declare const refreshQuote: (ownsConnection?: () => boolean) => Promise<void>, syncQuote: (payment: Payment | null, attempt?: CryptoPaymentAttempt | null) => void, configureManualQuoteRefresh: () => void, prepareWalletQuoteReplacement: (walletAddress?: string | null, selectedOptionId?: string | null) => void, clearQuoteRefresh: (options?: {
|
|
13
15
|
preserveWalletAddress?: boolean;
|
|
14
|
-
}) => void, loadWalletPaymentQuote: (walletAddress: string, ownsConnection: () => boolean) => Promise<void>, setWalletPaymentOptions: (walletAddress: string, options: WalletPaymentOption[]) => void, resetWalletPaymentState: () => void, setWalletPaymentQuote: (data:
|
|
16
|
+
}) => void, loadWalletPaymentQuote: (walletAddress: string, ownsConnection: () => boolean) => Promise<void>, setWalletPaymentOptions: (walletAddress: string, options: WalletPaymentOption[]) => void, resetWalletPaymentState: () => void, beginBitcoinWalletPreparation: () => () => boolean, setWalletPaymentQuote: (data: import("./checkout-state.js").BrowsingQuote) => void;
|
|
17
|
+
export declare const getCurrentWalletTopUp: (state?: CheckoutState) => WalletTopUpInFlight | null;
|
|
18
|
+
/**
|
|
19
|
+
* A payment is issued once its only attempt exists (QCT D1). From then on its
|
|
20
|
+
* terms, including the refund recipient, are fixed.
|
|
21
|
+
*/
|
|
22
|
+
export declare const isCheckoutIssued: (state?: CheckoutState) => boolean;
|
|
23
|
+
/** The refund recipient frozen at issuance, or null before issuance. */
|
|
24
|
+
export declare const getFrozenRefundRecipient: (state?: CheckoutState) => string | null;
|
|
25
|
+
export declare const assertWalletAttemptCurrent: (attempt: CryptoPaymentAttempt) => void;
|
|
26
|
+
export declare const followPayment: ({ readNow, onRead }: {
|
|
27
|
+
readNow: boolean;
|
|
28
|
+
onRead?: () => void;
|
|
29
|
+
}) => {
|
|
30
|
+
stop: () => void;
|
|
31
|
+
};
|
|
15
32
|
export declare const clearErrors: () => void;
|
|
16
33
|
export declare const initialiseStore: (payment: Payment) => Promise<void>;
|
|
17
34
|
export declare const createWalletOptionPaymentAttempt: (option: WalletPaymentOption, sendingAddress: string, quote?: WalletPaymentQuote | null, ownsWallet?: () => boolean) => Promise<CryptoPaymentAttempt>;
|
|
18
35
|
export declare const createManualDirectPaymentAttempt: (sendingAddress?: string, confirmations?: number, refundTo?: string | null, options?: ManualAttemptOptions, ownsQuote?: () => boolean) => Promise<CryptoPaymentAttempt>;
|
|
36
|
+
/** Prices a selected wallet route without issuing payment instructions. */
|
|
37
|
+
export declare const priceWalletRoute: (option: WalletPaymentOption, walletAddress: string, ownsQuote?: () => boolean) => Promise<PricedWalletQuote>;
|
|
19
38
|
export declare const createSuccessfulTestPaymentAttempt: () => Promise<void>;
|
|
20
39
|
export declare const createFailedTestPaymentAttempt: () => Promise<void>;
|
|
21
40
|
export declare function getAvailableCheckoutMethods(checkout: Checkout): CheckoutMethod[];
|
|
22
41
|
export declare const hydrateCheckoutFromPayment: (payment: Payment) => void;
|
|
23
|
-
export declare const getPayment: () => Promise<Payment | null>;
|
|
24
42
|
interface TransferWalletInterface {
|
|
25
43
|
getAddress(): Promise<string | null>;
|
|
26
|
-
executeTransfer(config: Transfer): Promise<string | null>;
|
|
44
|
+
executeTransfer(config: Transfer, beforeSign?: () => void, onIdentity?: (identity: WalletTransactionIdentity) => void): Promise<string | null>;
|
|
27
45
|
switchChain?(chainId: number): Promise<void>;
|
|
28
46
|
}
|
|
29
|
-
export declare const executeTransfer: (wallet: TransferWalletInterface, ownsWallet?: () => boolean) => Promise<string | null>;
|
|
30
|
-
export declare const checkChainStatus: (wallet: WalletInterface, submitted?: {
|
|
31
|
-
hash: string;
|
|
32
|
-
chainId: number;
|
|
33
|
-
canUpdate: () => boolean;
|
|
34
|
-
}) => Promise<void>;
|
|
47
|
+
export declare const executeTransfer: (wallet: TransferWalletInterface, ownsWallet?: () => boolean, beforeSign?: () => void, onIdentity?: (identity: WalletTransactionIdentity) => void) => Promise<string | null>;
|
|
35
48
|
export declare const resetTransfer: () => void;
|
|
36
|
-
export declare const
|
|
37
|
-
|
|
49
|
+
export declare const recordManualTransfer: (manualTransfer: ManualTransfer | null) => void;
|
|
50
|
+
export declare const readWalletTopUp: (paymentId: string) => WalletTopUpInFlight | null;
|
|
51
|
+
export declare const reserveWalletTopUp: (paymentId: string, attemptId: string) => {
|
|
52
|
+
readonly attemptId: string;
|
|
53
|
+
readonly pending: true;
|
|
38
54
|
};
|
|
39
|
-
export declare const
|
|
55
|
+
export declare const advanceWalletTopUp: (paymentId: string, current: WalletTopUpInFlight, next: WalletTopUpInFlight | null, { beforeSend, indexed }?: {
|
|
56
|
+
beforeSend?: boolean | undefined;
|
|
57
|
+
indexed?: boolean | undefined;
|
|
58
|
+
}) => boolean;
|
|
59
|
+
export declare const updateWalletTopUp: (paymentId: string, attemptId: string | undefined, txHash: string, change: Partial<Pick<WalletTopUp, "txHash" | "confirmation" | "identity">> | "indexed" | null) => void;
|
|
40
60
|
export declare const resetCheckoutStore: (payment?: Payment | null) => void;
|
|
41
61
|
export declare const resetCheckoutSessionForRetry: () => void;
|
|
42
62
|
export declare const setCheckoutMethod: (method: CheckoutMethod) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../../src/state/checkout/store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../../src/state/checkout/store.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
import type { WagmiWalletInterface } from "../../components/wallet-selector/wallets/wagmi/index.js";
|
|
2
|
+
import type { ConnectedBitcoinWallet } from "../../integrations/bitcoin-wallet.js";
|
|
3
|
+
import type { Config as WagmiConfig } from "@wagmi/core";
|
|
4
|
+
export declare function resumeWalletTopUp(config: WagmiConfig): Promise<void>;
|
|
2
5
|
export declare function loadWalletPaymentOptions(address: string, ownsConnection: () => boolean, force?: boolean): Promise<void>;
|
|
3
|
-
|
|
6
|
+
/** The connected wallet that signs a payment: an EVM or a Bitcoin wallet. */
|
|
7
|
+
export type PaymentWallet = {
|
|
4
8
|
wallet: WagmiWalletInterface;
|
|
9
|
+
bitcoin?: never;
|
|
10
|
+
} | {
|
|
11
|
+
wallet?: never;
|
|
12
|
+
bitcoin: ConnectedBitcoinWallet;
|
|
13
|
+
};
|
|
14
|
+
type WalletPaymentSession = PaymentWallet & {
|
|
5
15
|
address: string;
|
|
6
16
|
ownsConnection: () => boolean;
|
|
7
17
|
onStatusChange: (status: "submitted" | "failed") => void;
|
|
8
18
|
};
|
|
9
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Pay is the wallet flow's only issuing call (QCT D7). It captures the
|
|
21
|
+
* originating payment before any wallet or provider work.
|
|
22
|
+
*/
|
|
10
23
|
export declare function payWithWallet(session: WalletPaymentSession): Promise<void>;
|
|
11
24
|
export declare function retryWalletPayment(session: WalletPaymentSession): Promise<void>;
|
|
12
25
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet-payment.d.ts","sourceRoot":"","sources":["../../../../src/state/checkout/wallet-payment.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wallet-payment.d.ts","sourceRoot":"","sources":["../../../../src/state/checkout/wallet-payment.ts"],"names":[],"mappings":"AAsDA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yDAAyD,CAAC;AAEpG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,KAAK,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,aAAa,CAAC;AA2JzD,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,WAAW,iBA0D1D;AAeD,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,OAAO,EAC7B,KAAK,UAAQ,iBA+Bd;AAED,6EAA6E;AAC7E,MAAM,MAAM,aAAa,GACrB;IAAE,MAAM,EAAE,oBAAoB,CAAC;IAAC,OAAO,CAAC,EAAE,KAAK,CAAA;CAAE,GACjD;IAAE,MAAM,CAAC,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,sBAAsB,CAAA;CAAE,CAAC;AAExD,KAAK,oBAAoB,GAAG,aAAa,GAAG;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,OAAO,CAAC;IAC9B,cAAc,EAAE,CAAC,MAAM,EAAE,WAAW,GAAG,QAAQ,KAAK,IAAI,CAAC;CAC1D,CAAC;AAEF;;;GAGG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,oBAAoB,iBAsRhE;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,oBAAoB,iBAI/D"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CryptoPaymentAttempt } from "../../api/types.js";
|
|
2
|
+
import type { WalletTransactionIdentity } from "../../checkout/resume-state.js";
|
|
3
|
+
import type { Config as WagmiConfig } from "@wagmi/core";
|
|
4
|
+
export declare class TransferNotSentError extends Error {
|
|
5
|
+
}
|
|
6
|
+
export type WalletReceiptRecovery = {
|
|
7
|
+
identity: WalletTransactionIdentity;
|
|
8
|
+
scannedThroughBlock: number | null;
|
|
9
|
+
};
|
|
10
|
+
export declare function walletNonceScanned(config: WagmiConfig, chainId: number, { from, nonce }: WalletTransactionIdentity, scannedThroughBlock: number | null): Promise<boolean>;
|
|
11
|
+
export declare function checkWalletTransferReceipt(config: WagmiConfig, { txHash, chainId }: {
|
|
12
|
+
txHash: string;
|
|
13
|
+
chainId: number;
|
|
14
|
+
}, attempt: CryptoPaymentAttempt | null, { onIdentity, recovery, }?: {
|
|
15
|
+
onIdentity?: (identity: WalletTransactionIdentity) => void;
|
|
16
|
+
recovery?: WalletReceiptRecovery;
|
|
17
|
+
}): Promise<`0x${string}` | null>;
|
|
18
|
+
//# sourceMappingURL=wallet-transfer-receipt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet-transfer-receipt.d.ts","sourceRoot":"","sources":["../../../../src/state/checkout/wallet-transfer-receipt.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,KAAK,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,aAAa,CAAC;AAGzD,qBAAa,oBAAqB,SAAQ,KAAK;CAAG;AAElD,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,EAAE,yBAAyB,CAAC;IACpC,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC,CAAC;AAyBF,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,MAAM,EACf,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,yBAAyB,EAC1C,mBAAmB,EAAE,MAAM,GAAG,IAAI,oBAQnC;AAED,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,WAAW,EACnB,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EACxD,OAAO,EAAE,oBAAoB,GAAG,IAAI,EACpC,EACE,UAAU,EACV,QAAQ,GACT,GAAE;IACD,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,yBAAyB,KAAK,IAAI,CAAC;IAC3D,QAAQ,CAAC,EAAE,qBAAqB,CAAC;CAC7B,iCAwDP"}
|
|
@@ -21,4 +21,6 @@
|
|
|
21
21
|
*/
|
|
22
22
|
export declare const formatAmountForDisplay: (amount: string) => string;
|
|
23
23
|
export declare const formatAddress: (address: string) => string;
|
|
24
|
+
/** The shorter form used inside sentences: `0x1234...abcd`. */
|
|
25
|
+
export declare const formatShortAddress: (address: string) => string;
|
|
24
26
|
//# sourceMappingURL=string.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../../src/utils/string.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,sBAAsB,GAAI,QAAQ,MAAM,WAOpD,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,SAAS,MAAM,KAAG,MACC,CAAC"}
|
|
1
|
+
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../../src/utils/string.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,sBAAsB,GAAI,QAAQ,MAAM,WAOpD,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,SAAS,MAAM,KAAG,MACC,CAAC;AAElD,+DAA+D;AAC/D,eAAO,MAAM,kBAAkB,GAAI,SAAS,MAAM,KAAG,MACJ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Exact display units for a base-unit amount, or `null` when unknown. */
|
|
2
|
+
export declare function formatBaseUnits(rawAmount: string | null | undefined, decimals: number | null | undefined): string | null;
|
|
3
|
+
/** A compact display amount: at most six fraction digits, at least two. */
|
|
4
|
+
export declare function formatTokenAmount(rawAmount: string, decimals: number): string;
|
|
5
|
+
export declare function formatChainLabel(chain: string): string;
|
|
6
|
+
export declare function formatTokenLabel(token: string): string;
|
|
7
|
+
/** Token decimals when the API omits them: known tokens, else 18. */
|
|
8
|
+
export declare function fallbackTokenDecimals(token: string): number;
|
|
9
|
+
/** `1.50 USDC`: base units in display units, with the token's symbol. */
|
|
10
|
+
export declare function formatTokenValue(rawAmount: string, token: string, decimals?: number | null, symbol?: string | null): string;
|
|
11
|
+
export declare function formatRefundAmount(refund: {
|
|
12
|
+
current_refundable_balance: string;
|
|
13
|
+
token: string;
|
|
14
|
+
token_decimals?: number | null;
|
|
15
|
+
token_symbol?: string | null;
|
|
16
|
+
}): string;
|
|
17
|
+
export declare function transactionUrl(chain: string, transactionHash: string): string | null;
|
|
18
|
+
//# sourceMappingURL=token-amount.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-amount.d.ts","sourceRoot":"","sources":["../../../src/utils/token-amount.ts"],"names":[],"mappings":"AAQA,0EAA0E;AAC1E,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACpC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAClC,MAAM,GAAG,IAAI,CAOf;AAED,2EAA2E;AAC3E,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAwB7E;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKtD;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAYtD;AAED,qEAAqE;AACrE,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAK3D;AAED,yEAAyE;AACzE,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,EACxB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GACrB,MAAM,CAER;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE;IACzC,0BAA0B,EAAE,MAAM,CAAC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,GAAG,MAAM,CAOT;AAED,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,eAAe,EAAE,MAAM,GACtB,MAAM,GAAG,IAAI,CASf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet-errors.d.ts","sourceRoot":"","sources":["../../../src/utils/wallet-errors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wallet-errors.d.ts","sourceRoot":"","sources":["../../../src/utils/wallet-errors.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,qBAAqB,GAChC,OAAO,OAAO,EACd,UAAU,MAAM,KACf,MA+BF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mintmoney/react",
|
|
3
3
|
"description": "React SDK library for the MintMoney payments network",
|
|
4
|
-
"version": "0.2.0-alpha.
|
|
4
|
+
"version": "0.2.0-alpha.4",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -91,9 +91,11 @@
|
|
|
91
91
|
"@radix-ui/react-dialog": "^1.1.6",
|
|
92
92
|
"@radix-ui/react-visually-hidden": "^1.1.2",
|
|
93
93
|
"@reown/appkit": "^1.8.19",
|
|
94
|
+
"@reown/appkit-adapter-bitcoin": "1.8.19",
|
|
94
95
|
"@reown/appkit-adapter-wagmi": "^1.8.19",
|
|
95
96
|
"@tanstack/react-query": "^5.76.1",
|
|
96
97
|
"@wagmi/core": "^2.22.1",
|
|
98
|
+
"bitcoinjs-lib": "7.0.5",
|
|
97
99
|
"clsx": "^2.1.1",
|
|
98
100
|
"ethers": "^6.13.5",
|
|
99
101
|
"immer": "^10.0.0",
|