@stridge/kit 0.1.0-alpha.6 → 0.1.0-alpha.61
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/README.md +22 -6
- package/dist/KitProvider.d.ts +40 -0
- package/dist/KitProvider.js +1 -1
- package/dist/_internal/activity/driver/index.d.ts +3 -0
- package/dist/_internal/activity/driver/index.js +1 -0
- package/dist/_internal/deposit/driver/index.d.ts +3 -3
- package/dist/_internal/drivers/stridge/index.d.ts +4 -2
- package/dist/_internal/drivers/stridge/index.js +1 -1
- package/dist/_internal/drivers/stridge-mock/index.d.ts +4 -2
- package/dist/_internal/drivers/stridge-mock/index.js +1 -1
- package/dist/_internal/withdraw/driver/index.d.ts +2 -2
- package/dist/activity/compound/index.d.ts +19 -0
- package/dist/activity/compound/index.js +1 -0
- package/dist/activity/dialog/index.d.ts +4 -0
- package/dist/activity/dialog/index.js +1 -0
- package/dist/activity/widgets/index.d.ts +5 -0
- package/dist/activity/widgets/index.js +1 -0
- package/dist/deposit/compound/index.d.ts +25 -15
- package/dist/deposit/compound/index.js +1 -1
- package/dist/deposit/dialog/index.d.ts +2 -1
- package/dist/deposit/widgets/index.d.ts +17 -0
- package/dist/deposit/widgets/index.js +1 -0
- package/dist/drivers/stridge/catalog.d.ts +54 -0
- package/dist/drivers/stridge/catalog.js +1 -0
- package/dist/drivers/stridge/createStridgeActivityDriver.d.ts +44 -0
- package/dist/drivers/stridge/createStridgeActivityDriver.js +1 -0
- package/dist/drivers/stridge/createStridgeDepositDriver.d.ts +10 -1
- package/dist/drivers/stridge/createStridgeDepositDriver.js +1 -1
- package/dist/drivers/stridge/createStridgeWithdrawDriver.d.ts +37 -14
- package/dist/drivers/stridge/createStridgeWithdrawDriver.js +1 -1
- package/dist/drivers/stridge/internal/ensureWalletChain.js +1 -0
- package/dist/drivers/stridge/internal/pollOnce.js +1 -1
- package/dist/drivers/stridge/internal/resolveAddEthereumChain.js +1 -0
- package/dist/drivers/stridge/internal/retry.js +1 -0
- package/dist/drivers/stridge/internal/supportedChains.js +1 -0
- package/dist/drivers/stridge/types.d.ts +20 -14
- package/dist/drivers/stridge/types.js +1 -1
- package/dist/drivers/stridge/wagmiSigner.js +1 -1
- package/dist/drivers/stridge-mock/checkoutChannel.d.ts +31 -0
- package/dist/drivers/stridge-mock/checkoutChannel.js +1 -0
- package/dist/drivers/stridge-mock/createStridgeMockActivityDriver.d.ts +44 -0
- package/dist/drivers/stridge-mock/createStridgeMockActivityDriver.js +1 -0
- package/dist/drivers/stridge-mock/createStridgeMockDriver.d.ts +30 -2
- package/dist/drivers/stridge-mock/createStridgeMockDriver.js +1 -1
- package/dist/drivers/stridge-mock/createStridgeMockWithdrawDriver.d.ts +15 -3
- package/dist/drivers/stridge-mock/createStridgeMockWithdrawDriver.js +1 -1
- package/dist/drivers/stridge-mock/fixtures.d.ts +19 -13
- package/dist/drivers/stridge-mock/fixtures.js +1 -1
- package/dist/drivers/stridge-mock/triggers.d.ts +12 -0
- package/dist/events/bus/createBus.d.ts +26 -0
- package/dist/events/bus/createBus.js +1 -0
- package/dist/events/bus/flowIdRegistry.d.ts +17 -0
- package/dist/events/bus/flowIdRegistry.js +1 -0
- package/dist/events/bus/index.js +1 -0
- package/dist/events/bus/metadata.js +1 -0
- package/dist/events/context.js +1 -0
- package/dist/events/emit/index.js +1 -0
- package/dist/events/emit/mapFailure.js +1 -0
- package/dist/events/emit/useActivityEmissions.js +1 -0
- package/dist/events/emit/useDepositEmissions.js +1 -0
- package/dist/events/emit/useKitEmitter.js +1 -0
- package/dist/events/emit/useWithdrawEmissions.js +1 -0
- package/dist/events/hooks/index.d.ts +6 -0
- package/dist/events/hooks/index.js +1 -0
- package/dist/events/hooks/useCurrentFlowId.d.ts +6 -0
- package/dist/events/hooks/useCurrentFlowId.js +1 -0
- package/dist/events/hooks/useStableHandler.js +1 -0
- package/dist/events/hooks/useStridgeEvent.d.ts +9 -0
- package/dist/events/hooks/useStridgeEvent.js +1 -0
- package/dist/events/hooks/useStridgeEventBus.d.ts +34 -0
- package/dist/events/hooks/useStridgeEventBus.js +1 -0
- package/dist/events/hooks/useStridgeEvents.d.ts +7 -0
- package/dist/events/hooks/useStridgeEvents.js +1 -0
- package/dist/events/hooks/useStridgeFlowEvent.d.ts +8 -0
- package/dist/events/hooks/useStridgeFlowEvent.js +1 -0
- package/dist/events/hooks/useStridgeFlowEvents.d.ts +6 -0
- package/dist/events/hooks/useStridgeFlowEvents.js +1 -0
- package/dist/events/index.d.ts +17 -0
- package/dist/events/index.js +1 -0
- package/dist/events/publish.js +1 -0
- package/dist/events/redact.d.ts +34 -0
- package/dist/events/redact.js +1 -0
- package/dist/events/types/activity.d.ts +53 -0
- package/dist/events/types/deposit.d.ts +235 -0
- package/dist/events/types/envelope.d.ts +145 -0
- package/dist/events/types/index.d.ts +32 -0
- package/dist/events/types/kit.d.ts +23 -0
- package/dist/events/types/withdraw.d.ts +150 -0
- package/dist/flows/activity/compound/ActivityFlow.d.ts +46 -0
- package/dist/flows/activity/compound/ActivityFlow.js +1 -0
- package/dist/flows/activity/compound/components/Boundary.d.ts +29 -0
- package/dist/flows/activity/compound/components/Boundary.js +1 -0
- package/dist/flows/activity/compound/components/Steps.d.ts +24 -0
- package/dist/flows/activity/compound/components/Steps.js +1 -0
- package/dist/flows/activity/dialog/ActivityDialog.d.ts +55 -0
- package/dist/flows/activity/dialog/ActivityDialog.js +1 -0
- package/dist/flows/activity/dialog/ActivityFlowBoundary.d.ts +1 -0
- package/dist/flows/activity/dialog/ActivityFlowBoundary.js +1 -0
- package/dist/flows/activity/driver/context.d.ts +38 -0
- package/dist/flows/activity/driver/context.js +1 -0
- package/dist/flows/activity/driver/types.d.ts +58 -0
- package/dist/flows/activity/orchestrator/controller.d.ts +11 -0
- package/dist/flows/activity/orchestrator/controller.js +1 -0
- package/dist/flows/activity/orchestrator/index.d.ts +4 -0
- package/dist/flows/activity/orchestrator/index.js +1 -0
- package/dist/flows/activity/orchestrator/reducer.d.ts +1 -0
- package/dist/flows/activity/orchestrator/reducer.js +1 -0
- package/dist/flows/activity/orchestrator/types.d.ts +71 -0
- package/dist/flows/activity/orchestrator/useActivity.d.ts +94 -0
- package/dist/flows/activity/orchestrator/useActivity.js +1 -0
- package/dist/flows/activity/widgets/ActivityDetail.d.ts +41 -0
- package/dist/flows/activity/widgets/ActivityDetail.js +1 -0
- package/dist/flows/activity/widgets/ActivityList.d.ts +38 -0
- package/dist/flows/activity/widgets/ActivityList.js +1 -0
- package/dist/flows/activity/widgets/useStandaloneActivitySource.js +1 -0
- package/dist/flows/deposit/dialog/DepositBootstrapErrorState.js +1 -1
- package/dist/flows/deposit/dialog/DepositDialog.d.ts +26 -79
- package/dist/flows/deposit/dialog/DepositDialog.js +1 -1
- package/dist/flows/deposit/dialog/WalletRequiredState.js +1 -0
- package/dist/flows/deposit/dialog/WalletRequiredState.styles.js +1 -0
- package/dist/flows/deposit/driver/payloads.d.ts +109 -5
- package/dist/flows/deposit/driver/transformers/balanceToBalancesPayload.d.ts +2 -0
- package/dist/flows/deposit/driver/transformers/balanceToBalancesPayload.js +1 -1
- package/dist/flows/deposit/driver/transformers/index.d.ts +1 -0
- package/dist/flows/deposit/driver/transformers/quoteToPayload.d.ts +2 -0
- package/dist/flows/deposit/driver/transformers/settlementToPayload.d.ts +25 -0
- package/dist/flows/deposit/driver/transformers/settlementToPayload.js +1 -1
- package/dist/flows/deposit/driver/transformers/startToAddressesPayload.d.ts +2 -0
- package/dist/flows/deposit/driver/transformers/startToAddressesPayload.js +1 -1
- package/dist/flows/deposit/driver/transformers/startToBrandPayload.d.ts +1 -0
- package/dist/flows/deposit/driver/transformers/startToTargetPayload.d.ts +2 -0
- package/dist/flows/deposit/driver/transformers/startToTargetPayload.js +1 -1
- package/dist/flows/deposit/driver/transformers/walletAddressToWalletPayload.d.ts +1 -0
- package/dist/flows/deposit/driver/types.d.ts +92 -5
- package/dist/flows/deposit/orchestrator/controller.js +1 -1
- package/dist/flows/deposit/orchestrator/index.d.ts +5 -0
- package/dist/flows/deposit/orchestrator/reducer.d.ts +1 -0
- package/dist/flows/deposit/orchestrator/reducer.js +1 -1
- package/dist/flows/deposit/orchestrator/types.d.ts +276 -12
- package/dist/flows/deposit/orchestrator/useDeposit.d.ts +45 -1
- package/dist/flows/deposit/orchestrator/useDeposit.js +1 -1
- package/dist/flows/deposit/shared/checkoutPopup.js +1 -0
- package/dist/flows/deposit/shared/onramp.js +1 -0
- package/dist/flows/deposit/widgets/activity/DepositActivityDetail.d.ts +40 -0
- package/dist/flows/deposit/widgets/activity/DepositActivityDetail.js +1 -0
- package/dist/flows/deposit/widgets/activity/DepositActivityList.d.ts +38 -0
- package/dist/flows/deposit/widgets/activity/DepositActivityList.js +1 -0
- package/dist/flows/deposit/widgets/activity/index.d.ts +2 -0
- package/dist/flows/deposit/widgets/activity/index.js +1 -0
- package/dist/flows/deposit/widgets/activity/useDepositActivitySource.js +1 -0
- package/dist/flows/deposit/widgets/amount-entry/AmountEntry.d.ts +32 -5
- package/dist/flows/deposit/widgets/amount-entry/AmountEntry.js +1 -1
- package/dist/flows/deposit/widgets/amount-entry/footerIntent.js +1 -0
- package/dist/flows/deposit/widgets/asset-picker/AssetPicker.d.ts +24 -4
- package/dist/flows/deposit/widgets/asset-picker/AssetPicker.js +1 -1
- package/dist/flows/deposit/widgets/confirm-deposit/ConfirmDeposit.d.ts +37 -4
- package/dist/flows/deposit/widgets/confirm-deposit/ConfirmDeposit.js +1 -1
- package/dist/flows/deposit/widgets/deposit/Deposit.d.ts +39 -4
- package/dist/flows/deposit/widgets/deposit/Deposit.js +1 -1
- package/dist/flows/deposit/widgets/deposit/compound/Deposit.d.ts +58 -1
- package/dist/flows/deposit/widgets/deposit/compound/Deposit.js +1 -1
- package/dist/flows/deposit/widgets/deposit/compound/Deposit.slots.d.ts +6 -0
- package/dist/flows/deposit/widgets/deposit/compound/Deposit.slots.js +1 -1
- package/dist/flows/deposit/widgets/deposit/compound/Deposit.styles.js +1 -1
- package/dist/flows/deposit/widgets/deposit/compound/components/Boundary.d.ts +29 -0
- package/dist/flows/deposit/widgets/deposit/compound/components/Boundary.js +1 -0
- package/dist/flows/deposit/widgets/deposit/compound/components/Guards.d.ts +28 -0
- package/dist/flows/deposit/widgets/deposit/compound/components/Guards.js +1 -0
- package/dist/flows/deposit/widgets/deposit/compound/components/Header.d.ts +11 -0
- package/dist/flows/deposit/widgets/deposit/compound/components/Header.js +1 -1
- package/dist/flows/deposit/widgets/deposit/compound/components/Method.d.ts +7 -0
- package/dist/flows/deposit/widgets/deposit/compound/components/Method.js +1 -1
- package/dist/flows/deposit/widgets/deposit/compound/components/MethodSection.d.ts +40 -0
- package/dist/flows/deposit/widgets/deposit/compound/components/MethodSection.js +1 -0
- package/dist/flows/deposit/widgets/deposit/compound/components/Methods.d.ts +15 -9
- package/dist/flows/deposit/widgets/deposit/compound/components/Methods.js +1 -1
- package/dist/flows/deposit/widgets/deposit/compound/components/Rail.d.ts +18 -0
- package/dist/flows/deposit/widgets/deposit/compound/components/Rail.js +1 -0
- package/dist/flows/deposit/widgets/deposit/compound/components/RailPicker.d.ts +43 -0
- package/dist/flows/deposit/widgets/deposit/compound/components/RailPicker.js +1 -0
- package/dist/flows/deposit/widgets/deposit/compound/components/Steps.d.ts +24 -0
- package/dist/flows/deposit/widgets/deposit/compound/components/Steps.js +1 -0
- package/dist/flows/deposit/widgets/deposit/compound/index.d.ts +2 -1
- package/dist/flows/deposit/widgets/deposit/compound/types.d.ts +106 -4
- package/dist/flows/deposit/widgets/deposit-status-banner/DepositStatusBanner.d.ts +41 -1
- package/dist/flows/deposit/widgets/deposit-status-banner/DepositStatusBanner.js +1 -1
- package/dist/flows/deposit/widgets/deposit-status-banner/compound/DepositStatusBanner.js +1 -1
- package/dist/flows/deposit/widgets/deposit-status-banner/compound/components/Hero.js +1 -1
- package/dist/flows/deposit/widgets/deposit-status-banner/compound/components/PrimaryAction.js +1 -1
- package/dist/flows/deposit/widgets/deposit-status-banner/compound/types.d.ts +5 -5
- package/dist/flows/deposit/widgets/error-state/ErrorState.d.ts +39 -4
- package/dist/flows/deposit/widgets/error-state/ErrorState.js +1 -1
- package/dist/flows/deposit/widgets/onramp-amount-entry/OnrampAmountEntry.d.ts +64 -0
- package/dist/flows/deposit/widgets/onramp-amount-entry/OnrampAmountEntry.js +1 -0
- package/dist/flows/deposit/widgets/onramp-amount-entry/compound/OnrampAmountEntry.d.ts +62 -0
- package/dist/flows/deposit/widgets/onramp-amount-entry/compound/OnrampAmountEntry.js +1 -0
- package/dist/flows/deposit/widgets/onramp-amount-entry/compound/OnrampAmountEntry.slots.d.ts +14 -0
- package/dist/flows/deposit/widgets/onramp-amount-entry/compound/OnrampAmountEntry.slots.js +1 -0
- package/dist/flows/deposit/widgets/onramp-amount-entry/compound/OnrampAmountEntry.styles.js +1 -0
- package/dist/flows/deposit/widgets/onramp-amount-entry/compound/components/HeroLabel.d.ts +13 -0
- package/dist/flows/deposit/widgets/onramp-amount-entry/compound/components/HeroLabel.js +1 -0
- package/dist/flows/deposit/widgets/onramp-amount-entry/compound/components/ReceiveChip.d.ts +14 -0
- package/dist/flows/deposit/widgets/onramp-amount-entry/compound/components/ReceiveChip.js +1 -0
- package/dist/flows/deposit/widgets/onramp-amount-entry/compound/context.js +1 -0
- package/dist/flows/deposit/widgets/onramp-amount-entry/compound/index.d.ts +3 -0
- package/dist/flows/deposit/widgets/onramp-amount-entry/compound/index.js +1 -0
- package/dist/flows/deposit/widgets/onramp-amount-entry/compound/types.d.ts +29 -0
- package/dist/flows/deposit/widgets/onramp-amount-entry/index.d.ts +1 -0
- package/dist/flows/deposit/widgets/onramp-amount-entry/index.js +1 -0
- package/dist/flows/deposit/widgets/onramp-confirm/OnrampConfirm.d.ts +50 -0
- package/dist/flows/deposit/widgets/onramp-confirm/OnrampConfirm.js +1 -0
- package/dist/flows/deposit/widgets/onramp-confirm/compound/OnrampConfirm.d.ts +42 -0
- package/dist/flows/deposit/widgets/onramp-confirm/compound/OnrampConfirm.js +1 -0
- package/dist/flows/deposit/widgets/onramp-confirm/compound/OnrampConfirm.slots.d.ts +24 -0
- package/dist/flows/deposit/widgets/onramp-confirm/compound/OnrampConfirm.slots.js +1 -0
- package/dist/flows/deposit/widgets/onramp-confirm/compound/OnrampConfirm.styles.js +1 -0
- package/dist/flows/deposit/widgets/onramp-confirm/compound/components/Body.d.ts +16 -0
- package/dist/flows/deposit/widgets/onramp-confirm/compound/components/Body.js +1 -0
- package/dist/flows/deposit/widgets/onramp-confirm/compound/components/Header.d.ts +15 -0
- package/dist/flows/deposit/widgets/onramp-confirm/compound/components/Header.js +1 -0
- package/dist/flows/deposit/widgets/onramp-confirm/compound/components/Summary.d.ts +15 -0
- package/dist/flows/deposit/widgets/onramp-confirm/compound/components/Summary.js +1 -0
- package/dist/flows/deposit/widgets/onramp-confirm/compound/context.d.ts +25 -0
- package/dist/flows/deposit/widgets/onramp-confirm/compound/context.js +1 -0
- package/dist/flows/deposit/widgets/onramp-confirm/compound/index.d.ts +4 -0
- package/dist/flows/deposit/widgets/onramp-confirm/compound/index.js +1 -0
- package/dist/flows/deposit/widgets/onramp-confirm/compound/types.d.ts +62 -0
- package/dist/flows/deposit/widgets/onramp-confirm/index.d.ts +1 -0
- package/dist/flows/deposit/widgets/onramp-confirm/index.js +1 -0
- package/dist/flows/deposit/widgets/onramp-payment-pending/OnrampPaymentPending.d.ts +48 -0
- package/dist/flows/deposit/widgets/onramp-payment-pending/OnrampPaymentPending.js +1 -0
- package/dist/flows/deposit/widgets/onramp-payment-pending/compound/OnrampPaymentPending.d.ts +63 -0
- package/dist/flows/deposit/widgets/onramp-payment-pending/compound/OnrampPaymentPending.js +1 -0
- package/dist/flows/deposit/widgets/onramp-payment-pending/compound/OnrampPaymentPending.slots.d.ts +14 -0
- package/dist/flows/deposit/widgets/onramp-payment-pending/compound/OnrampPaymentPending.slots.js +1 -0
- package/dist/flows/deposit/widgets/onramp-payment-pending/compound/components/ReopenButton.d.ts +11 -0
- package/dist/flows/deposit/widgets/onramp-payment-pending/compound/components/ReopenButton.js +1 -0
- package/dist/flows/deposit/widgets/onramp-payment-pending/compound/context.js +1 -0
- package/dist/flows/deposit/widgets/onramp-payment-pending/compound/index.d.ts +2 -0
- package/dist/flows/deposit/widgets/onramp-payment-pending/compound/index.js +1 -0
- package/dist/flows/deposit/widgets/onramp-payment-pending/index.d.ts +1 -0
- package/dist/flows/deposit/widgets/onramp-payment-pending/index.js +1 -0
- package/dist/flows/deposit/widgets/processing-state/ProcessingState.d.ts +30 -4
- package/dist/flows/deposit/widgets/processing-state/ProcessingState.js +1 -1
- package/dist/flows/deposit/widgets/success-state/SuccessState.d.ts +38 -4
- package/dist/flows/deposit/widgets/success-state/SuccessState.js +1 -1
- package/dist/flows/deposit/widgets/transfer-crypto/TransferCrypto.d.ts +34 -3
- package/dist/flows/deposit/widgets/transfer-crypto/TransferCrypto.js +1 -1
- package/dist/flows/deposit/widgets/transfer-crypto/compound/TransferCrypto.d.ts +1 -1
- package/dist/flows/deposit/widgets/transfer-crypto/compound/TransferCrypto.styles.js +1 -1
- package/dist/flows/deposit/widgets/transfer-crypto/compound/components/Address.js +1 -1
- package/dist/flows/deposit/widgets/transfer-crypto/compound/components/Disclosure.d.ts +5 -2
- package/dist/flows/deposit/widgets/transfer-crypto/compound/components/Disclosure.js +1 -1
- package/dist/flows/deposit/widgets/transfer-crypto/compound/components/Header.d.ts +6 -0
- package/dist/flows/deposit/widgets/transfer-crypto/compound/components/Header.js +1 -1
- package/dist/flows/deposit/widgets/transfer-crypto/compound/components/QrCode.d.ts +4 -10
- package/dist/flows/deposit/widgets/transfer-crypto/compound/components/QrCode.js +1 -1
- package/dist/flows/deposit/widgets/transfer-crypto/compound/types.d.ts +16 -2
- package/dist/flows/shared/transformers/computeQuoteAttrs.d.ts +1 -0
- package/dist/flows/shared/transformers/index.d.ts +1 -0
- package/dist/flows/shared/transformers/pickRelevantSettlement.d.ts +1 -0
- package/dist/flows/shared/transformers/pickRelevantSettlement.js +1 -1
- package/dist/flows/shared/transformers/testnets.js +1 -0
- package/dist/flows/withdraw/bindings/WithdrawBindings.d.ts +92 -0
- package/dist/flows/withdraw/bindings/WithdrawBindings.js +1 -0
- package/dist/flows/withdraw/bindings/index.d.ts +1 -0
- package/dist/flows/withdraw/bindings/index.js +1 -0
- package/dist/flows/withdraw/dialog/WithdrawDialog.d.ts +44 -71
- package/dist/flows/withdraw/dialog/WithdrawDialog.js +1 -1
- package/dist/flows/withdraw/driver/dto.d.ts +8 -7
- package/dist/flows/withdraw/driver/payloads.d.ts +16 -1
- package/dist/flows/withdraw/driver/transformers/settlementToWithdrawalPayload.js +1 -1
- package/dist/flows/withdraw/driver/transformers/supportedAssetsToReceiveOptionsPayload.js +1 -1
- package/dist/flows/withdraw/driver/types.d.ts +77 -14
- package/dist/flows/withdraw/orchestrator/controller.js +1 -1
- package/dist/flows/withdraw/orchestrator/index.d.ts +1 -1
- package/dist/flows/withdraw/orchestrator/reducer.js +1 -1
- package/dist/flows/withdraw/orchestrator/types.d.ts +218 -35
- package/dist/flows/withdraw/orchestrator/useWithdraw.d.ts +36 -1
- package/dist/flows/withdraw/orchestrator/useWithdraw.js +1 -1
- package/dist/flows/withdraw/widgets/activity/WithdrawActivityDetail.d.ts +39 -0
- package/dist/flows/withdraw/widgets/activity/WithdrawActivityDetail.js +1 -0
- package/dist/flows/withdraw/widgets/activity/WithdrawActivityList.d.ts +36 -0
- package/dist/flows/withdraw/widgets/activity/WithdrawActivityList.js +1 -0
- package/dist/flows/withdraw/widgets/activity/index.d.ts +2 -0
- package/dist/flows/withdraw/widgets/activity/index.js +1 -0
- package/dist/flows/withdraw/widgets/activity/useWithdrawActivitySource.js +1 -0
- package/dist/flows/withdraw/widgets/withdraw/compound/Withdraw.d.ts +60 -0
- package/dist/flows/withdraw/widgets/withdraw/compound/Withdraw.js +1 -0
- package/dist/flows/withdraw/widgets/withdraw/compound/Withdraw.slots.d.ts +13 -0
- package/dist/flows/withdraw/widgets/withdraw/compound/Withdraw.slots.js +1 -0
- package/dist/flows/withdraw/widgets/withdraw/compound/components/Boundary.d.ts +29 -0
- package/dist/flows/withdraw/widgets/withdraw/compound/components/Boundary.js +1 -0
- package/dist/flows/withdraw/widgets/withdraw/compound/components/Guards.d.ts +25 -0
- package/dist/flows/withdraw/widgets/withdraw/compound/components/Guards.js +1 -0
- package/dist/flows/withdraw/widgets/withdraw/compound/components/Steps.d.ts +27 -0
- package/dist/flows/withdraw/widgets/withdraw/compound/components/Steps.js +1 -0
- package/dist/flows/withdraw/widgets/withdraw/compound/index.d.ts +3 -0
- package/dist/flows/withdraw/widgets/withdraw/compound/index.js +1 -0
- package/dist/flows/withdraw/widgets/withdraw-error/WithdrawError.d.ts +45 -2
- package/dist/flows/withdraw/widgets/withdraw-error/WithdrawError.js +1 -1
- package/dist/flows/withdraw/widgets/withdraw-form/WithdrawForm.d.ts +32 -12
- package/dist/flows/withdraw/widgets/withdraw-form/WithdrawForm.js +1 -1
- package/dist/flows/withdraw/widgets/withdraw-form/compound/WithdrawForm.js +1 -1
- package/dist/flows/withdraw/widgets/withdraw-form/compound/components/Body.d.ts +7 -6
- package/dist/flows/withdraw/widgets/withdraw-form/compound/components/Header.d.ts +6 -1
- package/dist/flows/withdraw/widgets/withdraw-form/compound/components/Header.js +1 -1
- package/dist/flows/withdraw/widgets/withdraw-form/compound/components/RecipientField.d.ts +7 -5
- package/dist/flows/withdraw/widgets/withdraw-form/compound/components/RecipientField.js +1 -1
- package/dist/flows/withdraw/widgets/withdraw-form/compound/types.d.ts +15 -5
- package/dist/flows/withdraw/widgets/withdraw-form/validation.js +1 -1
- package/dist/flows/withdraw/widgets/withdraw-in-progress/WithdrawInProgress.d.ts +39 -3
- package/dist/flows/withdraw/widgets/withdraw-in-progress/WithdrawInProgress.js +1 -1
- package/dist/flows/withdraw/widgets/withdraw-success/WithdrawSuccess.d.ts +46 -2
- package/dist/flows/withdraw/widgets/withdraw-success/WithdrawSuccess.js +1 -1
- package/dist/format/index.d.ts +2 -1
- package/dist/format/index.js +1 -1
- package/dist/i18n/index.d.ts +5 -4
- package/dist/i18n/index.js +1 -1
- package/dist/i18n/locales/ar.js +1 -1
- package/dist/i18n/locales/es.js +1 -1
- package/dist/i18n/locales/source-keys.d.ts +12 -0
- package/dist/i18n/locales/source-keys.js +0 -0
- package/dist/icons/index.d.ts +5 -1
- package/dist/icons/index.js +1 -1
- package/dist/index.d.ts +35 -11
- package/dist/index.js +1 -1
- package/dist/package.js +1 -1
- package/dist/scope/KitPortalScope.js +1 -1
- package/dist/scope/KitScope.d.ts +27 -1
- package/dist/scope/KitScope.js +1 -1
- package/dist/scope/context.d.ts +24 -1
- package/dist/scope/index.d.ts +1 -1
- package/dist/shared/attribution/Attribution.js +1 -0
- package/dist/shared/attribution/Attribution.slots.js +1 -0
- package/dist/shared/attribution/Attribution.styles.js +1 -0
- package/dist/shared/attribution/index.js +1 -0
- package/dist/shared/chains/index.d.ts +48 -29
- package/dist/shared/chains/index.js +1 -1
- package/dist/shared/constants/brand-intercom.js +1 -0
- package/dist/shared/cuer/Cuer.js +1 -1
- package/dist/shared/dialog/DialogShell.d.ts +21 -6
- package/dist/shared/dialog/DialogShell.js +1 -1
- package/dist/shared/dialog/Frame.js +1 -1
- package/dist/shared/dialog/LoadingState.js +1 -0
- package/dist/shared/dialog/LoadingState.styles.js +1 -0
- package/dist/shared/dialog/StepTransition.js +1 -1
- package/dist/shared/dialog/useDirectionalChevronTransform.js +1 -1
- package/dist/shared/driver/types.d.ts +4 -3
- package/dist/shared/format/formatSmartRelative.d.ts +25 -0
- package/dist/shared/format/formatSmartRelative.js +1 -0
- package/dist/shared/format/formatUsd.js +1 -1
- package/dist/shared/i18n/KitI18nProvider.d.ts +11 -8
- package/dist/shared/i18n/KitI18nProvider.js +1 -1
- package/dist/shared/i18n/createKitI18n.d.ts +79 -16
- package/dist/shared/i18n/createKitI18n.js +1 -1
- package/dist/shared/i18n/useLingui.d.ts +11 -3
- package/dist/shared/icons/ActivityIcon.d.ts +12 -0
- package/dist/shared/icons/ActivityIcon.js +1 -0
- package/dist/shared/icons/BitcoinIcon.d.ts +14 -0
- package/dist/shared/icons/BitcoinIcon.js +1 -0
- package/dist/shared/icons/CardIcon.d.ts +16 -0
- package/dist/shared/icons/CardIcon.js +1 -0
- package/dist/shared/icons/LogoIcon.d.ts +13 -0
- package/dist/shared/icons/LogoIcon.js +1 -0
- package/dist/shared/merchant-link/MerchantLink.d.ts +1 -0
- package/dist/shared/merchant-link/MerchantLink.js +1 -0
- package/dist/shared/merchant-link/MerchantLinkButton.d.ts +1 -0
- package/dist/shared/merchant-link/MerchantLinkButton.js +1 -0
- package/dist/shared/merchant-link/index.d.ts +1 -0
- package/dist/shared/merchant-link/index.js +1 -0
- package/dist/shared/merchant-link/resolveMerchantLink.js +1 -0
- package/dist/shared/orchestrator/activityOpenInput.d.ts +21 -0
- package/dist/shared/orchestrator/createActivityReducers.js +1 -0
- package/dist/shared/orchestrator/index.d.ts +2 -0
- package/dist/shared/orchestrator/index.js +1 -1
- package/dist/shared/orchestrator/resolveActivityEntry.d.ts +1 -0
- package/dist/shared/orchestrator/resolveActivityEntry.js +1 -0
- package/dist/shared/orchestrator/toFailure.js +1 -1
- package/dist/shared/orchestrator/types.d.ts +8 -0
- package/dist/shared/orchestrator/useOnrampSessionWatcher.js +1 -0
- package/dist/shared/orchestrator/useSettlementWatcher.js +1 -1
- package/dist/shared/presentation/index.js +1 -0
- package/dist/shared/presentation/types.d.ts +30 -0
- package/dist/shared/presentation/types.js +1 -0
- package/dist/shared/presentation/useResolvedSurfaceKind.js +1 -0
- package/dist/shared/primitives/TxHashValue/TxHashValue.js +1 -1
- package/dist/shared/support/SupportConfigContext.d.ts +1 -0
- package/dist/shared/support/SupportConfigContext.js +1 -0
- package/dist/shared/support/SupportLink.d.ts +1 -0
- package/dist/shared/support/SupportLink.js +1 -0
- package/dist/shared/support/SupportSpinner.d.ts +1 -0
- package/dist/shared/support/SupportSpinner.js +1 -0
- package/dist/shared/support/index.d.ts +2 -0
- package/dist/shared/support/index.js +1 -0
- package/dist/shared/support/intercom-loader.d.ts +17 -0
- package/dist/shared/support/intercom-loader.js +1 -0
- package/dist/shared/support/types.d.ts +43 -0
- package/dist/shared/support/useIntercomMerchantContext.d.ts +27 -0
- package/dist/shared/support/useIntercomMerchantContext.js +1 -0
- package/dist/shared/support/useIntercomShutdownOnUnmount.js +1 -0
- package/dist/shared/support/useMerchantContext.d.ts +1 -0
- package/dist/shared/support/useMerchantContext.js +1 -0
- package/dist/shared/support/useSupportTrigger.js +1 -0
- package/dist/shared/terms/TermsConfigContext.d.ts +1 -0
- package/dist/shared/terms/TermsConfigContext.js +1 -0
- package/dist/shared/terms/TermsLink.d.ts +1 -0
- package/dist/shared/terms/TermsLink.js +1 -0
- package/dist/shared/terms/index.d.ts +1 -0
- package/dist/shared/terms/index.js +1 -0
- package/dist/shared/terms/types.d.ts +43 -0
- package/dist/shared/ui/AdaptiveSurface/AdaptiveSurface.d.ts +52 -0
- package/dist/shared/ui/AdaptiveSurface/AdaptiveSurface.js +1 -0
- package/dist/shared/ui/AdaptiveSurface/index.d.ts +2 -0
- package/dist/shared/ui/AdaptiveSurface/index.js +1 -0
- package/dist/shared/ui/Card/Card.d.ts +12 -9
- package/dist/shared/ui/Card/Card.js +1 -1
- package/dist/shared/ui/Card/Card.styles.js +1 -1
- package/dist/shared/ui/Details/Details.d.ts +9 -1
- package/dist/shared/ui/Details/Details.styles.js +1 -1
- package/dist/shared/ui/Dialog/Dialog.d.ts +10 -8
- package/dist/shared/ui/Dialog/Dialog.js +1 -1
- package/dist/shared/ui/Dialog/Dialog.styles.js +1 -1
- package/dist/shared/ui/Drawer/Drawer.d.ts +135 -0
- package/dist/shared/ui/Drawer/Drawer.js +1 -0
- package/dist/shared/ui/Drawer/Drawer.slots.d.ts +19 -0
- package/dist/shared/ui/Drawer/Drawer.slots.js +1 -0
- package/dist/shared/ui/Drawer/Drawer.styles.js +1 -0
- package/dist/shared/ui/Drawer/index.d.ts +2 -0
- package/dist/shared/ui/Drawer/index.js +1 -0
- package/dist/shared/ui/Select/Select.js +1 -1
- package/dist/shared/ui/SelectableTile/SelectableTile.d.ts +21 -8
- package/dist/shared/ui/SelectableTile/SelectableTile.js +1 -1
- package/dist/shared/ui/Steps/Steps.d.ts +52 -0
- package/dist/shared/ui/Steps/Steps.js +1 -0
- package/dist/shared/ui/Steps/Steps.slots.d.ts +7 -0
- package/dist/shared/ui/Steps/Steps.slots.js +1 -0
- package/dist/shared/ui/Steps/Steps.styles.js +1 -0
- package/dist/shared/ui/Steps/index.d.ts +2 -0
- package/dist/shared/ui/Steps/index.js +1 -0
- package/dist/shared/ui/Tabs/Tabs.d.ts +79 -0
- package/dist/shared/ui/Tabs/Tabs.js +1 -0
- package/dist/shared/ui/Tabs/Tabs.slots.d.ts +11 -0
- package/dist/shared/ui/Tabs/Tabs.slots.js +1 -0
- package/dist/shared/ui/Tabs/Tabs.styles.js +1 -0
- package/dist/shared/ui/Tabs/index.d.ts +2 -0
- package/dist/shared/ui/Tabs/index.js +1 -0
- package/dist/shared/ui/WalletRow/WalletRow.d.ts +1 -1
- package/dist/shared/ui/WalletRow/WalletRow.js +1 -1
- package/dist/shared/ui/surfaceContext.d.ts +9 -0
- package/dist/shared/ui/surfaceContext.js +1 -0
- package/dist/shared/utils/assertNever.js +1 -0
- package/dist/shared/utils/logos/types.d.ts +1 -1
- package/dist/shared/utils/useDeepMemo.js +1 -0
- package/dist/shared/wallet/ConnectWalletContext.d.ts +17 -0
- package/dist/shared/wallet/ConnectWalletContext.js +1 -0
- package/dist/shared/widgets/activity/ActivityTrigger.js +1 -0
- package/dist/shared/widgets/activity/ActivityTrigger.styles.js +1 -0
- package/dist/shared/widgets/activity/adapters/settlementToWidgetProps.js +1 -0
- package/dist/shared/widgets/activity/compound/Activity.d.ts +95 -0
- package/dist/shared/widgets/activity/compound/Activity.js +1 -0
- package/dist/shared/widgets/activity/compound/Activity.slots.d.ts +22 -0
- package/dist/shared/widgets/activity/compound/Activity.slots.js +1 -0
- package/dist/shared/widgets/activity/compound/Activity.styles.js +1 -0
- package/dist/shared/widgets/activity/compound/ActivityDetail.d.ts +82 -0
- package/dist/shared/widgets/activity/compound/ActivityDetail.js +1 -0
- package/dist/shared/widgets/activity/compound/Row.slots.d.ts +21 -0
- package/dist/shared/widgets/activity/compound/Row.slots.js +1 -0
- package/dist/shared/widgets/activity/compound/Row.styles.js +1 -0
- package/dist/shared/widgets/activity/compound/components/ActivityHeader.d.ts +39 -0
- package/dist/shared/widgets/activity/compound/components/ActivityHeader.js +1 -0
- package/dist/shared/widgets/activity/compound/components/Empty.d.ts +15 -0
- package/dist/shared/widgets/activity/compound/components/Empty.js +1 -0
- package/dist/shared/widgets/activity/compound/components/ErrorView.d.ts +26 -0
- package/dist/shared/widgets/activity/compound/components/ErrorView.js +1 -0
- package/dist/shared/widgets/activity/compound/components/List.d.ts +23 -0
- package/dist/shared/widgets/activity/compound/components/List.js +1 -0
- package/dist/shared/widgets/activity/compound/components/Row.d.ts +51 -0
- package/dist/shared/widgets/activity/compound/components/Row.js +1 -0
- package/dist/shared/widgets/activity/compound/components/StatusPip.js +1 -0
- package/dist/shared/widgets/activity/compound/context.d.ts +95 -0
- package/dist/shared/widgets/activity/compound/context.js +1 -0
- package/dist/shared/widgets/activity/compound/index.d.ts +8 -0
- package/dist/shared/widgets/activity/compound/index.js +1 -0
- package/dist/shared/widgets/activity/index.js +1 -0
- package/dist/shared/widgets/activity/payloads.d.ts +108 -0
- package/dist/shared/widgets/activity/transformers/activityResponseToPayload.js +1 -0
- package/dist/shared/widgets/activity/transformers/resolveDirection.js +1 -0
- package/dist/shared/widgets/amount-entry/compound/AmountEntry.d.ts +10 -2
- package/dist/shared/widgets/amount-entry/compound/AmountEntry.js +1 -1
- package/dist/shared/widgets/amount-entry/compound/AmountEntry.slots.d.ts +6 -0
- package/dist/shared/widgets/amount-entry/compound/AmountEntry.slots.js +1 -1
- package/dist/shared/widgets/amount-entry/compound/AmountEntry.styles.js +1 -1
- package/dist/shared/widgets/amount-entry/compound/components/Details.d.ts +34 -0
- package/dist/shared/widgets/amount-entry/compound/components/Details.js +1 -0
- package/dist/shared/widgets/amount-entry/compound/components/Footer.d.ts +2 -1
- package/dist/shared/widgets/amount-entry/compound/components/Footer.js +1 -1
- package/dist/shared/widgets/amount-entry/compound/components/Header.d.ts +6 -1
- package/dist/shared/widgets/amount-entry/compound/components/Header.js +1 -1
- package/dist/shared/widgets/amount-entry/compound/components/Hero/Hero.js +1 -1
- package/dist/shared/widgets/amount-entry/compound/components/Hero/SwapBackdrop.js +1 -1
- package/dist/shared/widgets/amount-entry/compound/components/Notice.d.ts +7 -0
- package/dist/shared/widgets/amount-entry/compound/components/Notice.js +1 -0
- package/dist/shared/widgets/amount-entry/compound/index.d.ts +1 -1
- package/dist/shared/widgets/amount-entry/compound/types.d.ts +69 -3
- package/dist/shared/widgets/asset-picker/compound/AssetPicker.d.ts +3 -0
- package/dist/shared/widgets/asset-picker/compound/AssetPicker.js +1 -1
- package/dist/shared/widgets/asset-picker/compound/AssetPicker.slots.d.ts +2 -0
- package/dist/shared/widgets/asset-picker/compound/AssetPicker.slots.js +1 -1
- package/dist/shared/widgets/asset-picker/compound/AssetPicker.styles.js +1 -1
- package/dist/shared/widgets/asset-picker/compound/components/Asset.d.ts +7 -1
- package/dist/shared/widgets/asset-picker/compound/components/Asset.js +1 -1
- package/dist/shared/widgets/asset-picker/compound/components/Empty.d.ts +15 -0
- package/dist/shared/widgets/asset-picker/compound/components/Empty.js +1 -0
- package/dist/shared/widgets/asset-picker/compound/components/Header.d.ts +6 -1
- package/dist/shared/widgets/asset-picker/compound/components/Header.js +1 -1
- package/dist/shared/widgets/asset-picker/compound/types.d.ts +15 -1
- package/dist/shared/widgets/confirm-transfer/compound/ConfirmTransfer.styles.js +1 -1
- package/dist/shared/widgets/confirm-transfer/compound/components/Breakdown.js +1 -1
- package/dist/shared/widgets/confirm-transfer/compound/components/Disclaimer.d.ts +4 -3
- package/dist/shared/widgets/confirm-transfer/compound/components/Disclaimer.js +1 -1
- package/dist/shared/widgets/confirm-transfer/compound/components/QuoteTimer.js +1 -1
- package/dist/shared/widgets/error-state/compound/components/AssetValue.js +1 -1
- package/dist/shared/widgets/error-state/compound/components/HelpInfo.js +1 -1
- package/dist/shared/widgets/error-state/compound/components/MoreDetails.d.ts +1 -1
- package/dist/shared/widgets/error-state/compound/components/MoreDetails.js +1 -1
- package/dist/shared/widgets/error-state/compound/components/StatusValue.js +1 -1
- package/dist/shared/widgets/processing-state/compound/ProcessingState.d.ts +1 -5
- package/dist/shared/widgets/processing-state/compound/ProcessingState.js +1 -1
- package/dist/shared/widgets/processing-state/compound/ProcessingState.slots.d.ts +0 -1
- package/dist/shared/widgets/processing-state/compound/ProcessingState.slots.js +1 -1
- package/dist/shared/widgets/processing-state/compound/ProcessingState.styles.js +1 -1
- package/dist/shared/widgets/processing-state/compound/components/Details.d.ts +6 -1
- package/dist/shared/widgets/processing-state/compound/components/Details.js +1 -1
- package/dist/shared/widgets/processing-state/compound/components/Header.d.ts +4 -3
- package/dist/shared/widgets/processing-state/compound/components/Header.js +1 -1
- package/dist/shared/widgets/processing-state/compound/components/Hero.d.ts +14 -7
- package/dist/shared/widgets/processing-state/compound/components/Hero.js +1 -1
- package/dist/shared/widgets/processing-state/compound/components/Rows.js +1 -1
- package/dist/shared/widgets/processing-state/compound/components/StatusPill.js +1 -1
- package/dist/shared/widgets/processing-state/compound/components/splitAmount.js +1 -0
- package/dist/shared/widgets/processing-state/compound/index.d.ts +1 -1
- package/dist/shared/widgets/processing-state/compound/types.d.ts +11 -29
- package/dist/shared/widgets/success-state/compound/components/Actions.js +1 -1
- package/dist/shared/widgets/success-state/compound/components/AssetValue.js +1 -1
- package/dist/shared/widgets/success-state/compound/components/MoreDetails.d.ts +1 -1
- package/dist/shared/widgets/success-state/compound/components/MoreDetails.js +1 -1
- package/dist/shared/widgets/success-state/compound/components/RouteValue.js +1 -1
- package/dist/shared/widgets/success-state/compound/components/StatusPill.js +1 -1
- package/dist/shared/widgets/success-state/compound/types.d.ts +5 -5
- package/dist/storage/context.d.ts +9 -1
- package/dist/storage/context.js +1 -1
- package/dist/storage/index.d.ts +1 -1
- package/dist/stridge/StridgeProvider.d.ts +177 -35
- package/dist/stridge/StridgeProvider.js +1 -1
- package/dist/stridge/depositOwner.js +1 -0
- package/dist/stridge/optionalWagmi.js +1 -0
- package/dist/stridge/stubs.js +1 -1
- package/dist/styles/index.css +567 -12
- package/dist/types.d.ts +8 -6
- package/dist/ui/index.d.ts +9 -1
- package/dist/ui/index.js +1 -1
- package/dist/version.d.ts +10 -0
- package/dist/version.js +1 -0
- package/dist/withdraw/compound/index.d.ts +11 -8
- package/dist/withdraw/compound/index.js +1 -1
- package/dist/withdraw/dialog/index.d.ts +4 -1
- package/dist/withdraw/widgets/index.d.ts +7 -0
- package/dist/withdraw/widgets/index.js +1 -0
- package/package.json +31 -7
- package/dist/_internal/deposit/widgets/index.d.ts +0 -11
- package/dist/_internal/deposit/widgets/index.js +0 -1
- package/dist/_internal/withdraw/widgets/index.d.ts +0 -5
- package/dist/_internal/withdraw/widgets/index.js +0 -1
- package/dist/flows/withdraw/dialog/WithdrawDialogEventsContext.d.ts +0 -36
- package/dist/flows/withdraw/dialog/WithdrawDialogEventsContext.js +0 -1
- package/dist/shared/widgets/processing-state/compound/components/Actions.d.ts +0 -17
- package/dist/shared/widgets/processing-state/compound/components/Actions.js +0 -1
- package/dist/stridge/StridgeContext.d.ts +0 -29
- package/dist/stridge/StridgeContext.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useDepositDriverInstance as e}from"../driver/context.js";import{useLingui as t}from"../../../shared/i18n/useLingui.js";import"../../../i18n/index.js";import{toFailure as n}from"../../../shared/orchestrator/toFailure.js";import{useDriverSettlementListener as r}from"../../../shared/orchestrator/useDriverSettlementListener.js";import{useEffectiveState as i}from"../../../shared/orchestrator/useEffectiveState.js";import{isUserRejectionFailure as a}from"../../../shared/orchestrator/userRejection.js";import{useSettlementWatcher as o}from"../../../shared/orchestrator/useSettlementWatcher.js";import"../../../shared/orchestrator/index.js";import{initialState as s,reducer as c}from"./reducer.js";import{resolveAssetById as l}from"./resolveAssetById.js";import{createContext as u,use as d,useCallback as f,useEffect as p,useMemo as m,useReducer as h,useRef as g}from"react";import{jsx as _}from"react/jsx-runtime";const v={id:`ELhVSL`,message:`Failed to submit deposit.`},y={id:`Ej5HL9`,message:`Signature declined. Please try again.`},b=u(null);b.displayName=`GatewayControllerContext`;function x(){let e=d(b);if(!e)throw Error(`useDeposit / GatewayController must be used inside <KitProvider deposit={…} />. Mount KitProvider once at the host's app root.`);return e}function S(){return x().state}function C(){return x().effectiveState}function w(){return x().actions}function T({children:t}){let n=e(),[r,a]=h(c,s),o=D(r,a,n);O(r,a,n),k(r,a,n);let l=i(r),u=E(r,a,n,o);return _(b,{value:m(()=>({state:r,effectiveState:l,dispatch:a,controller:u,actions:o}),[r,l,u,o]),children:t})}function E(e,t,n,r){let i=g(n);i.current=n;let a=f(e=>{if(!e)return t({type:`OPEN`,input:void 0}),!0;if(e.method===`transfer`)return t({type:`OPEN`,input:{method:`transfer`}}),!0;if(e.method===`wallet`&&e.assetId!==void 0){let n=l(i.current.getSnapshot(),e.assetId);return n?(t({type:`OPEN`,input:{method:`wallet`,asset:n}}),!0):!1}return t({type:`OPEN`,input:{method:`wallet`}}),!0},[t]),o=f(()=>{t({type:`CLOSE`})},[t]);return m(()=>({open:a,close:o,actions:r}),[a,o,r])}function D(e,r,i){let o=g(e);o.current=e;let s=g(i);s.current=i;let c=g(r);c.current=r;let{i18n:l}=t(),u=g(l);u.current=l;let d=f((e,t)=>{let r=s.current,i=new AbortController,o=j(e,t);r.submitDeposit(o,i.signal).then(e=>{i.signal.aborted||c.current({type:`DEPOSIT_SUBMITTED`,tx:e})}).catch(e=>{if(i.signal.aborted)return;let t=n(e,u.current._(v));if(a(t)){c.current({type:`DEPOSIT_SIGNATURE_DECLINED`,notice:u.current._(y)});return}c.current({type:`DEPOSIT_SUBMISSION_FAILED`,failure:t})})},[]),p=f(e=>{c.current({type:`DEPOSIT_METHOD_SELECTED`,method:e})},[]),h=f(e=>{c.current({type:`ASSET_CONFIRMED`,asset:e})},[]),_=f(e=>{o.current.name===`amountEntry`&&c.current({type:`AMOUNT_CONFIRMED`,amount:e})},[]),b=f(()=>{let e=o.current;if(e.name!==`confirmDeposit`)return;let t=e.ctx.phase;if(t.kind===`failed`){c.current({type:`QUOTE_RETRY`});return}if(t.kind!==`ready`)return;let{asset:n,amount:r}=e.ctx;c.current({type:`DEPOSIT_CONFIRMED`}),d(n,r)},[d]),x=f(()=>{c.current({type:`BACK`})},[]),S=f(()=>{c.current({type:`CLOSE`})},[]),C=f(()=>{c.current({type:`SUCCESS_DONE`})},[]),w=f(()=>{c.current({type:`ERROR_TRY_AGAIN`})},[]),T=f((e,t)=>{c.current({type:`RESUME_TO_PROCESSING`,method:e,tx:t})},[]),E=f((e,t)=>{c.current({type:`RESUME_TO_SUCCESS`,method:e,tx:t})},[]),D=f(e=>{c.current({type:`RESUME_TO_ERROR`,...e?{tx:e}:{}})},[]);return m(()=>({selectMethod:p,confirmAsset:h,confirmAmount:_,confirmDeposit:b,back:x,close:S,successDone:C,tryAgain:w,resumeToProcessing:T,resumeToSuccess:E,resumeToError:D}),[p,h,_,b,x,S,C,w,T,E,D])}function O(e,t,r){p(()=>{if(e.name!==`confirmDeposit`||e.ctx.phase.kind!==`loading`&&e.ctx.phase.kind!==`regenerating`)return;let i=new AbortController,a=A(e.ctx.asset,e.ctx.amount);return r.requestQuote(a,i.signal).catch(e=>{i.signal.aborted||t({type:`QUOTE_FAILED`,failure:n(e,`Failed to fetch quote.`)})}),()=>i.abort()},[e.name,e.name===`confirmDeposit`?e.ctx.phase.kind:void 0,e.name===`confirmDeposit`?e.ctx.asset:void 0,e.name===`confirmDeposit`?e.ctx.amount:void 0,r,t]),p(()=>{if(e.name!==`confirmDeposit`||e.ctx.phase.kind!==`ready`)return;let n=e.ctx.phase.quoteExpiresAt,r=Math.max(0,n-Date.now()),i=setTimeout(()=>{t({type:`QUOTE_EXPIRED`})},r);return()=>clearTimeout(i)},[e.name,e.name===`confirmDeposit`&&e.ctx.phase.kind===`ready`?e.ctx.phase.quoteExpiresAt:void 0,t])}function k(e,t,n){o(n,e.name===`processing`?e.ctx.tx:void 0),p(()=>{if(e.name!==`transferCrypto`||!n.watchSourceTx)return;let t=new AbortController,r;return n.watchSourceTx({},e=>{t.signal.aborted||r||(r=new AbortController,n.watchSettlement({tx:e},()=>{},r.signal))},t.signal),()=>{t.abort(),r?.abort()}},[e.name,n]),p(()=>{if(e.name===`closed`||e.name===`transferCrypto`||e.name===`processing`||!n.fetchActiveSettlement)return;let t=new AbortController,r,i,a=!1,o=async()=>{try{let e=await n.fetchActiveSettlement({},t.signal);if(a)return;if(e&&!r&&e.payload.kind===`pending`){let t=e.payload.txHash?.value;t&&(r=new AbortController,n.watchSettlement({tx:{hash:t}},()=>{},r.signal))}}catch{}a||(i=setTimeout(o,5e3))};return o(),()=>{a=!0,t.abort(),r?.abort(),i&&clearTimeout(i)}},[e.name,n]);let i=g(e);i.current=e,r(n,e=>{i.current.name===`processing`&&(e===`succeeded`?t({type:`PROCESSING_SUCCEEDED`}):e===`failed`&&t({type:`PROCESSING_FAILED`}))});let a=g(null);p(()=>{let e=()=>{let e=n.getSnapshot(),r=i.current,o=e.quote;o.status!==a.current&&(a.current=o.status,o.status===`ready`&&r.name===`confirmDeposit`?(r.ctx.phase.kind===`loading`||r.ctx.phase.kind===`regenerating`)&&t({type:`QUOTE_RESOLVED`,expiresAt:o.payload.expiresAt}):o.status===`error`&&r.name===`confirmDeposit`&&(r.ctx.phase.kind===`loading`||r.ctx.phase.kind===`regenerating`)&&t({type:`QUOTE_FAILED`,failure:{reason:o.error.message,code:o.error.name}}))},r=n.subscribe(e);return e(),r},[n,t])}function A(e,t){let n=e.eip155Id;if(!n)throw Error(`Asset ${e.symbol} is missing eip155Id; cannot build quote input.`);return{sourceChainId:Number(n),sourceTokenAddress:e.address,sourceTokenDecimals:e.decimals,sourceTokenSymbol:e.symbol,sourceIsNative:e.isNative,amount:t,...e.priceUsd===void 0?{}:{sourcePriceUsd:e.priceUsd}}}function j(e,t){let n=e.eip155Id;if(!n)throw Error(`Asset ${e.symbol} is missing eip155Id; cannot build submit input.`);return{sourceChainId:Number(n),sourceTokenAddress:e.address,sourceTokenDecimals:e.decimals,sourceIsNative:e.isNative,amount:t}}export{T as GatewayController,x as useControllerContext,w as useDepositActions,C as useDepositEffectiveState,S as useDepositState};
|
|
1
|
+
"use client";import{useOptionalActivityDriverInstance as e}from"../../activity/driver/context.js";import{useLingui as t}from"../../../shared/i18n/useLingui.js";import"../../../i18n/index.js";import{toFailure as n}from"../../../shared/orchestrator/toFailure.js";import{useDriverSettlementListener as r}from"../../../shared/orchestrator/useDriverSettlementListener.js";import{useEffectiveState as i}from"../../../shared/orchestrator/useEffectiveState.js";import{useOnrampSessionWatcher as a}from"../../../shared/orchestrator/useOnrampSessionWatcher.js";import{isUserRejectionFailure as o}from"../../../shared/orchestrator/userRejection.js";import{useSettlementWatcher as s}from"../../../shared/orchestrator/useSettlementWatcher.js";import"../../../shared/orchestrator/index.js";import{useDepositDriverInstance as c}from"../driver/context.js";import{openCheckoutPopup as l}from"../shared/checkoutPopup.js";import{initialState as u,reducer as d}from"./reducer.js";import{resolveAssetById as f}from"./resolveAssetById.js";import{createContext as p,use as m,useCallback as h,useEffect as g,useMemo as _,useReducer as v,useRef as y}from"react";import{jsx as b}from"react/jsx-runtime";const x={id:`ELhVSL`,message:`Failed to submit deposit.`},S={id:`Ej5HL9`,message:`Signature declined. Please try again.`},C={id:`Z0UMar`,message:`Failed to fetch quote.`},w={id:`9d3cBd`,message:`Failed to open the payment window. Please try again.`},T=p(null);T.displayName=`GatewayControllerStateContext`;const E=p(null);E.displayName=`GatewayControllerStableContext`;function D(){let e=m(T),t=m(E);if(!e||!t)throw Error(`useDeposit / GatewayController must be used inside <KitProvider deposit={…} />. Mount KitProvider once at the host's app root.`);return{...e,...t}}function O(){let e=m(E);if(!e)throw Error(`useDeposit / GatewayController must be used inside <KitProvider deposit={…} />. Mount KitProvider once at the host's app root.`);return e}function k(){return m(E)}const A=p(void 0);A.displayName=`DepositMethodsConfigContext`;function j(){return m(A)}function M(e){let t=j();return _(()=>t?e.filter(e=>e.value===`onramp`?t.onrampRail?.disabled!==!0:!0):e,[e,t])}function N(){let e=m(T);if(!e)throw Error(`useDeposit / GatewayController must be used inside <KitProvider deposit={…} />. Mount KitProvider once at the host's app root.`);return e.state}function P(){let e=m(T);if(!e)throw Error(`useDeposit / GatewayController must be used inside <KitProvider deposit={…} />. Mount KitProvider once at the host's app root.`);return e.effectiveState}function F(){return O().actions}function I({methodsConfig:t,children:n}){let r=c(),a=e(),[o,s]=v(d,u),l=R(o,s,r,a);z(o,s,r),B(o,s,r,a);let f=i(o),p=L(o,s,r,l,t);return b(A,{value:t,children:b(E,{value:_(()=>({dispatch:s,controller:p,actions:l}),[s,p,l]),children:b(T,{value:_(()=>({state:o,effectiveState:f}),[o,f]),children:n})})})}function L(e,t,n,r,i){let a=y(n);a.current=n;let o=y(i);o.current=i;let s=h(e=>{if(!e)return a.current.arm(),t({type:`OPEN`,input:void 0}),!0;if(o.current?.[e.method]?.disabled)return!1;if(e.method===`transfer`)return a.current.arm(),t({type:`OPEN`,input:{method:`transfer`}}),!0;if(e.method===`wallet`&&e.assetId!==void 0){let n=f(a.current.getSnapshot(),e.assetId);return a.current.arm(),n?(t({type:`OPEN`,input:{method:`wallet`,asset:n}}),!0):(t({type:`OPEN`,input:{method:`wallet`}}),!0)}return a.current.arm(),t({type:`OPEN`,input:{method:`wallet`}}),!0},[t]),c=h(()=>{t({type:`CLOSE`})},[t]);return _(()=>({open:s,close:c,actions:r}),[s,c,r])}function R(e,r,i,a){let s=y(e);s.current=e;let c=y(i);c.current=i;let l=y(a);l.current=a;let u=y(r);u.current=r;let{i18n:d}=t(),f=y(d);f.current=d;let p=h((e,t)=>{let r=c.current,i=new AbortController,a=H(e,t);r.submitDeposit(a,i.signal).then(e=>{if(!i.signal.aborted){try{r.invalidateBalances?.()}catch{}try{l.current?.invalidateActivity?.()}catch{}u.current({type:`DEPOSIT_SUBMITTED`,tx:e})}}).catch(e=>{if(i.signal.aborted)return;let t=n(e,f.current._(x));if(o(t)){u.current({type:`DEPOSIT_SIGNATURE_DECLINED`,notice:f.current._(S)});return}u.current({type:`DEPOSIT_SUBMISSION_FAILED`,failure:t})})},[]),m=h(e=>{u.current({type:`DEPOSIT_METHOD_SELECTED`,method:e})},[]),g=h(()=>{u.current({type:`ONRAMP_SELECTED`})},[]),v=h(e=>{s.current.name===`onrampAmountEntry`&&u.current({type:`ONRAMP_AMOUNT_CHANGED`,amount:e})},[]),b=h(e=>{u.current({type:`ONRAMP_AMOUNT_CONFIRMED`,amount:e})},[]),C=h(()=>{let e=s.current;if(e.name!==`onrampConfirm`)return;let t=e.ctx.phase;t.kind!==`ready`&&t.kind!==`failed`||u.current({type:`ONRAMP_CONFIRMED`})},[]),w=h(e=>{u.current({type:`ASSET_CONFIRMED`,asset:e})},[]),T=h(e=>{s.current.name===`amountEntry`&&u.current({type:`AMOUNT_CONFIRMED`,amount:e})},[]),E=h(()=>{let e=s.current;if(e.name!==`confirmDeposit`)return;let t=e.ctx.phase;if(t.kind===`failed`){u.current({type:`QUOTE_RETRY`});return}if(t.kind!==`ready`)return;let{asset:n,amount:r}=e.ctx;u.current({type:`DEPOSIT_CONFIRMED`}),p(n,r)},[p]),D=h(()=>{u.current({type:`BACK`})},[]),O=h(()=>{u.current({type:`CLOSE`})},[]),k=h(()=>{u.current({type:`SUCCESS_DONE`})},[]),A=h(()=>{u.current({type:`ERROR_TRY_AGAIN`})},[]),j=h((e,t)=>{u.current({type:`RESUME_TO_PROCESSING`,method:e,tx:t})},[]),M=h((e,t)=>{u.current({type:`RESUME_TO_SUCCESS`,method:e,tx:t})},[]),N=h(e=>{u.current({type:`RESUME_TO_ERROR`,...e?{tx:e}:{}})},[]),P=h(()=>{if(l.current==null){process.env.NODE_ENV!==`production`&&console.warn("[@stridge/kit] useDepositActions().openActivity() was called but no activity driver is mounted. Wrap the host with `<KitProvider activity={…}>` (or `<StridgeProvider>` with any flow enabled) to enable the activity surface.");return}let e=s.current;e.name!==`deposit`&&e.name!==`assetPicker`&&e.name!==`amountEntry`&&e.name!==`transferCrypto`||u.current({type:`OPEN_ACTIVITY`})},[]),F=h(e=>{u.current({type:`SELECT_SETTLEMENT`,settlementId:e})},[]);return _(()=>({selectMethod:m,selectOnramp:g,setOnrampAmount:v,confirmOnrampAmount:b,confirmOnramp:C,confirmAsset:w,confirmAmount:T,confirmDeposit:E,back:D,close:O,successDone:k,tryAgain:A,resumeToProcessing:j,resumeToSuccess:M,resumeToError:N,openActivity:P,selectSettlement:F}),[m,g,v,b,C,w,T,E,D,O,k,A,j,M,N,P,F])}function z(e,r,i){let{i18n:a}=t(),o=y(a);o.current=a;let s=e.name===`onrampAmountEntry`?e.ctx.amount:void 0;g(()=>{if(e.name!==`onrampAmountEntry`||!i.requestOnrampQuote)return;let t=s;if(t==null||!Number.isFinite(t)||t<=0)return;let n=new AbortController,r=setTimeout(()=>{i.requestOnrampQuote?.({amount:t},n.signal).catch(()=>{})},400);return()=>{clearTimeout(r),n.abort()}},[e.name,s,i]);let c=e.name===`onrampConfirm`&&e.ctx.phase.kind===`loading`,u=e.name===`onrampConfirm`?e.ctx.amount:void 0;g(()=>{if(!c||!i.requestOnrampQuote||u==null)return;let e=new AbortController;return i.requestOnrampQuote({amount:u},e.signal).catch(t=>{e.signal.aborted||r({type:`ONRAMP_QUOTE_FAILED`,failure:n(t,o.current._(C))})}),()=>e.abort()},[c,u,i,r]);let d=e.name===`onrampConfirm`&&e.ctx.phase.kind===`creating`,f=e.name===`onrampConfirm`?e.ctx.amount:void 0;g(()=>{if(!d||f==null)return;if(!i.createOnrampSession){r({type:`ONRAMP_SESSION_FAILED`,failure:{reason:o.current._(w)}});return}let e=new AbortController;return i.createOnrampSession({amount:f},e.signal).then(t=>{if(!e.signal.aborted){if(!t.checkoutUrl){r({type:`ONRAMP_SESSION_FAILED`,failure:{reason:o.current._(w)}});return}l(t.checkoutUrl),r({type:`ONRAMP_SESSION_CREATED`,sessionId:t.sessionId,checkoutUrl:t.checkoutUrl})}}).catch(t=>{e.signal.aborted||r({type:`ONRAMP_SESSION_FAILED`,failure:n(t,o.current._(w))})}),()=>e.abort()},[d,f,i,r]),g(()=>{if(e.name!==`confirmDeposit`||e.ctx.phase.kind!==`loading`&&e.ctx.phase.kind!==`regenerating`)return;let t=new AbortController,a=V(e.ctx.asset,e.ctx.amount);return i.requestQuote(a,t.signal).catch(e=>{t.signal.aborted||r({type:`QUOTE_FAILED`,failure:n(e,`Failed to fetch quote.`)})}),()=>t.abort()},[e.name,e.name===`confirmDeposit`?e.ctx.phase.kind:void 0,e.name===`confirmDeposit`?e.ctx.asset:void 0,e.name===`confirmDeposit`?e.ctx.amount:void 0,i,r]),g(()=>{if(e.name!==`confirmDeposit`||e.ctx.phase.kind!==`ready`)return;let t=e.ctx.phase.quoteExpiresAt,n=Math.max(0,t-Date.now()),i=setTimeout(()=>{r({type:`QUOTE_EXPIRED`})},n);return()=>clearTimeout(i)},[e.name,e.name===`confirmDeposit`&&e.ctx.phase.kind===`ready`?e.ctx.phase.quoteExpiresAt:void 0,r])}function B(e,t,n,i){let o=y(i);o.current=i;let c=e.name===`processing`?e.ctx.tx:void 0;s(n,c?{tx:c}:void 0,c?.hash);let l=e.name===`onrampPaymentPending`?e.ctx.sessionId:void 0;a(n,l?{sessionId:l}:void 0,l),g(()=>{if(e.name!==`transferCrypto`||!n.watchSourceTx)return;let t=new AbortController,r;return n.watchSourceTx({},e=>{if(!t.signal.aborted&&!r){r=new AbortController,n.watchSettlement({tx:e},()=>{},r.signal);try{o.current?.invalidateActivity?.()}catch{}}},t.signal),()=>{t.abort(),r?.abort()}},[e.name,n]);let u=e.name===`activityList`||e.name===`activityDetail`;g(()=>{if(!u||!i)return;let e=new AbortController;return i.watchActivity(e.signal),()=>e.abort()},[u,i]),g(()=>{if(e.name===`closed`||e.name===`transferCrypto`||e.name===`processing`||u||!n.fetchActiveSettlement)return;let t=new AbortController,r,i,a=!1,o=async()=>{try{let e=await n.fetchActiveSettlement({},t.signal);if(a)return;if(e&&!r&&e.payload.kind===`pending`){let t=e.payload.txHash?.value;t&&(r=new AbortController,n.watchSettlement({tx:{hash:t}},()=>{},r.signal))}}catch{}a||(i=setTimeout(o,5e3))};return o(),()=>{a=!0,t.abort(),r?.abort(),i&&clearTimeout(i)}},[e.name,u,n]);let d=y(e);d.current=e,r(n,e=>{if(e===`pending`||e===`succeeded`||e===`failed`)try{n.invalidateBalances?.()}catch{}d.current.name===`processing`&&(e===`succeeded`?t({type:`PROCESSING_SUCCEEDED`}):e===`failed`&&t({type:`PROCESSING_FAILED`}))});let f=y(null);g(()=>{let e=()=>{let e=n.getSnapshot(),r=d.current,i=e.quote;i.status!==f.current&&(f.current=i.status,i.status===`ready`&&r.name===`confirmDeposit`?(r.ctx.phase.kind===`loading`||r.ctx.phase.kind===`regenerating`)&&t({type:`QUOTE_RESOLVED`,expiresAt:i.payload.expiresAt}):i.status===`error`&&r.name===`confirmDeposit`&&(r.ctx.phase.kind===`loading`||r.ctx.phase.kind===`regenerating`)&&t({type:`QUOTE_FAILED`,failure:{reason:i.error.message,code:i.error.name,cause:i.error}}))},r=n.subscribe(e);return e(),r},[n,t]);let p=y(null);g(()=>{let e=()=>{let e=n.getSnapshot(),r=d.current,i=e.onrampQuote,a=i?.status??`idle`;a!==p.current&&(p.current=a,!(r.name!==`onrampConfirm`||r.ctx.phase.kind!==`loading`)&&(a===`ready`||a===`stale`?t({type:`ONRAMP_QUOTE_RESOLVED`}):a===`error`&&i?.status===`error`&&t({type:`ONRAMP_QUOTE_FAILED`,failure:{reason:i.error.message,code:i.error.name,cause:i.error}})))},r=n.subscribe(e);return e(),r},[n,t]);let m=y(null);g(()=>{let e=()=>{let e=n.getSnapshot(),r=d.current,i=e.onrampSession,a=i?.status===`ready`||i?.status===`stale`?i.payload.state:i?.status??`idle`;if(a!==m.current&&(m.current=a,r.name===`onrampPaymentPending`)){if(a===`SESSION_COMPLETED`)t({type:`ONRAMP_SESSION_COMPLETED`});else if(a===`SESSION_EXPIRED`)t({type:`ONRAMP_SESSION_EXPIRED`});else if(a===`SESSION_FAILED`){let e=i?.status===`ready`||i?.status===`stale`?i.payload.failureCode:void 0;t({type:`ONRAMP_SESSION_FAILED`,failure:{reason:e??`Payment failed.`,...e?{code:e}:{}}})}}},r=n.subscribe(e);return e(),r},[n,t])}function V(e,t){let n=e.eip155Id;if(!n)throw Error(`Asset ${e.symbol} is missing eip155Id; cannot build quote input.`);return{sourceChainId:Number(n),sourceTokenAddress:e.address,sourceTokenDecimals:e.decimals,sourceTokenSymbol:e.symbol,sourceIsNative:e.isNative,amount:t,...e.priceUsd===void 0?{}:{sourcePriceUsd:e.priceUsd}}}function H(e,t){let n=e.eip155Id;if(!n)throw Error(`Asset ${e.symbol} is missing eip155Id; cannot build submit input.`);return{sourceChainId:Number(n),sourceTokenAddress:e.address,sourceTokenDecimals:e.decimals,sourceIsNative:e.isNative,amount:t}}export{I as GatewayController,D as useControllerContext,F as useDepositActions,P as useDepositEffectiveState,j as useDepositMethodsConfig,N as useDepositState,M as useEnabledRails,k as useOptionalStableControllerContext,O as useStableControllerContext};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FailureInfo } from "../../../shared/orchestrator/types.js";
|
|
2
|
+
import { ConfirmDepositPhase, DepositActions, DepositController, DepositMethod, DepositMethodConfig, DepositMethodsConfig, DepositRailConfig, DepositState, DepositStateName, GatewayEvent, OnrampConfirmPhase, OpenInput, ResolvedOpenInput, RetryTargetSpec } from "./types.js";
|
|
3
|
+
import { useDepositState } from "./controller.js";
|
|
4
|
+
import { STEPS_WITH_OWN_SETTLEMENT_VIEW, stepRendersSettlement } from "./steps.js";
|
|
5
|
+
import { useDeposit } from "./useDeposit.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
import{createActivityReducers as e}from"../../../shared/orchestrator/createActivityReducers.js";import"../../../shared/orchestrator/index.js";import{assertNever as t}from"../../../shared/utils/assertNever.js";const n={name:`closed`},{reduceFromActivityList:r,reduceFromActivityDetail:i}=e({activityList:e=>({name:`activityList`,ctx:{backTarget:e}}),activityDetail:(e,t,n)=>({name:`activityDetail`,ctx:{settlementId:e,backTarget:t,viaList:n}}),closed:()=>({name:`closed`}),restoreFromBackTarget:e=>v(e)});function a(e,n){if(n.type===`RESUME_TO_PROCESSING`)return e.name===`closed`?e:{name:`processing`,ctx:{method:n.method,tx:n.tx,retryTargetForFailure:{kind:`fresh`}}};if(n.type===`RESUME_TO_SUCCESS`)return e.name===`closed`?e:{name:`success`,ctx:{method:n.method,tx:n.tx}};if(n.type===`RESUME_TO_ERROR`)return e.name===`closed`?e:{name:`error`,ctx:{retryTarget:{kind:`fresh`},...n.tx?{tx:n.tx}:{}}};switch(e.name){case`closed`:return o(n);case`deposit`:return s(e,n);case`assetPicker`:return c(e,n);case`amountEntry`:return l(e,n);case`onrampAmountEntry`:return u(e,n);case`onrampConfirm`:return d(e,n);case`onrampPaymentPending`:return f(e,n);case`confirmDeposit`:return p(e,n);case`transferCrypto`:return m(e,n);case`processing`:return h(e,n);case`success`:return g(e,n);case`error`:return _(e,n);case`activityList`:return r(e,n);case`activityDetail`:return i(e,n);default:return t(e)}}function o(e){if(e.type!==`OPEN`)return{name:`closed`};let t=e.input;return t?t.method===`transfer`?{name:`transferCrypto`,ctx:{method:`transfer`,backTarget:`closed`}}:t.asset?{name:`amountEntry`,ctx:{method:`wallet`,asset:t.asset,backTarget:`closed`}}:{name:`assetPicker`,ctx:{method:`wallet`,backTarget:`closed`}}:{name:`deposit`,ctx:{backTarget:`closed`}}}function s(e,t){switch(t.type){case`DEPOSIT_METHOD_SELECTED`:return t.method===`wallet`?{name:`assetPicker`,ctx:{method:`wallet`,backTarget:`deposit`}}:{name:`transferCrypto`,ctx:{method:`transfer`,backTarget:`deposit`}};case`ONRAMP_SELECTED`:return{name:`onrampAmountEntry`,ctx:{method:`onramp`,backTarget:`deposit`}};case`OPEN_ACTIVITY`:return{name:`activityList`,ctx:{backTarget:{kind:`deposit`,backTarget:`closed`}}};case`BACK`:case`CLOSE`:return{name:`closed`};default:return e}}function c(e,t){switch(t.type){case`ASSET_CONFIRMED`:return{name:`amountEntry`,ctx:{method:`wallet`,asset:t.asset,backTarget:`assetPicker`}};case`OPEN_ACTIVITY`:return{name:`activityList`,ctx:{backTarget:{kind:`assetPicker`,method:`wallet`,backTarget:e.ctx.backTarget}}};case`BACK`:return e.ctx.backTarget===`deposit`?{name:`deposit`,ctx:{backTarget:`closed`}}:{name:`closed`};case`CLOSE`:return{name:`closed`};default:return e}}function l(e,t){switch(t.type){case`AMOUNT_CONFIRMED`:return{name:`confirmDeposit`,ctx:{method:`wallet`,asset:e.ctx.asset,amount:t.amount,phase:{kind:`loading`},backTarget:`amountEntry`}};case`OPEN_ACTIVITY`:return{name:`activityList`,ctx:{backTarget:{kind:`amountEntry`,method:`wallet`,asset:e.ctx.asset,backTarget:e.ctx.backTarget}}};case`BACK`:return e.ctx.backTarget===`assetPicker`?{name:`assetPicker`,ctx:{method:`wallet`,backTarget:`deposit`}}:{name:`closed`};case`CLOSE`:return{name:`closed`};default:return e}}function u(e,t){switch(t.type){case`ONRAMP_AMOUNT_CHANGED`:return t.amount===null?{...e,ctx:{...e.ctx,amount:void 0}}:{...e,ctx:{...e.ctx,amount:t.amount}};case`ONRAMP_AMOUNT_CONFIRMED`:return{name:`onrampConfirm`,ctx:{method:`onramp`,amount:t.amount,phase:{kind:`loading`},backTarget:`onrampAmountEntry`}};case`BACK`:return e.ctx.backTarget===`deposit`?{name:`deposit`,ctx:{backTarget:`closed`}}:{name:`closed`};case`CLOSE`:return{name:`closed`};default:return e}}function d(e,t){let n=e.ctx.phase;switch(t.type){case`ONRAMP_QUOTE_RESOLVED`:return n.kind===`loading`?{...e,ctx:{...e.ctx,phase:{kind:`ready`}}}:e;case`ONRAMP_QUOTE_FAILED`:return n.kind===`loading`||n.kind===`creating`?{...e,ctx:{...e.ctx,phase:{kind:`failed`,failure:t.failure}}}:e;case`ONRAMP_CONFIRMED`:return n.kind===`ready`||n.kind===`failed`?{...e,ctx:{...e.ctx,phase:{kind:`creating`}}}:e;case`ONRAMP_SESSION_CREATED`:return n.kind===`creating`?{name:`onrampPaymentPending`,ctx:{method:`onramp`,amount:e.ctx.amount,sessionId:t.sessionId,checkoutUrl:t.checkoutUrl,backTarget:`onrampConfirm`}}:e;case`ONRAMP_SESSION_FAILED`:return n.kind===`creating`?{...e,ctx:{...e.ctx,phase:{kind:`failed`,failure:t.failure}}}:e;case`BACK`:return{name:`onrampAmountEntry`,ctx:{method:`onramp`,backTarget:`deposit`,amount:e.ctx.amount}};case`CLOSE`:return{name:`closed`};default:return e}}function f(e,t){switch(t.type){case`ONRAMP_SESSION_COMPLETED`:return{name:`success`,ctx:{method:`onramp`,sessionId:e.ctx.sessionId}};case`ONRAMP_SESSION_EXPIRED`:return{name:`error`,ctx:{retryTarget:{kind:`onrampAmountEntry`},sessionId:e.ctx.sessionId,...t.failure?{failure:t.failure}:{}}};case`ONRAMP_SESSION_FAILED`:return{name:`error`,ctx:{retryTarget:{kind:`onrampAmountEntry`},sessionId:e.ctx.sessionId,failure:t.failure}};case`BACK`:return{name:`onrampConfirm`,ctx:{method:`onramp`,amount:e.ctx.amount,phase:{kind:`ready`},backTarget:`onrampAmountEntry`}};case`CLOSE`:return{name:`closed`};default:return e}}function p(e,t){let n=e.ctx.phase;switch(t.type){case`QUOTE_RESOLVED`:return n.kind===`loading`||n.kind===`regenerating`?{...e,ctx:{...e.ctx,phase:{kind:`ready`,quoteExpiresAt:t.expiresAt}}}:e;case`QUOTE_FAILED`:return n.kind===`loading`||n.kind===`regenerating`?{...e,ctx:{...e.ctx,phase:{kind:`failed`,failure:t.failure,recoverFrom:`quote`}}}:e;case`QUOTE_RETRY`:return n.kind===`failed`?{...e,ctx:{...e.ctx,phase:{kind:`loading`}}}:e;case`QUOTE_EXPIRED`:return n.kind===`ready`?{...e,ctx:{...e.ctx,phase:{kind:`regenerating`}}}:e;case`DEPOSIT_CONFIRMED`:return n.kind===`ready`?{...e,ctx:{...e.ctx,phase:{kind:`submitting`}}}:e;case`DEPOSIT_SUBMITTED`:if(n.kind===`submitting`){let n={kind:`confirmDepositReady`,method:`wallet`,asset:e.ctx.asset,amount:e.ctx.amount};return{name:`processing`,ctx:{method:`wallet`,tx:t.tx,retryTargetForFailure:n}}}return e;case`DEPOSIT_SUBMISSION_FAILED`:return n.kind===`submitting`?{...e,ctx:{...e.ctx,phase:{kind:`failed`,failure:t.failure,recoverFrom:`submission`}}}:e;case`DEPOSIT_SIGNATURE_DECLINED`:return n.kind===`submitting`?{...e,ctx:{...e.ctx,phase:{kind:`regenerating`,...t.notice?{notice:t.notice}:{}}}}:e;case`BACK`:return{name:`amountEntry`,ctx:{method:`wallet`,asset:e.ctx.asset,backTarget:`assetPicker`}};case`CLOSE`:return{name:`closed`};default:return e}}function m(e,t){switch(t.type){case`OPEN_ACTIVITY`:return{name:`activityList`,ctx:{backTarget:{kind:`transferCrypto`,method:`transfer`,backTarget:e.ctx.backTarget}}};case`BACK`:return e.ctx.backTarget===`deposit`?{name:`deposit`,ctx:{backTarget:`closed`}}:{name:`closed`};case`CLOSE`:return{name:`closed`};default:return e}}function h(e,t){switch(t.type){case`PROCESSING_SUCCEEDED`:return{name:`success`,ctx:{method:e.ctx.method,tx:e.ctx.tx}};case`PROCESSING_FAILED`:return{name:`error`,ctx:{retryTarget:e.ctx.retryTargetForFailure,tx:e.ctx.tx}};case`CLOSE`:return{name:`closed`};default:return e}}function g(e,t){return t.type===`SUCCESS_DONE`||t.type===`CLOSE`?{name:`closed`}:e}function _(e,t){return t.type===`ERROR_TRY_AGAIN`?y(e.ctx.retryTarget):t.type===`CLOSE`?{name:`closed`}:e}function v(e){return e.kind===`deposit`?{name:`deposit`,ctx:{backTarget:`closed`}}:e.kind===`assetPicker`?{name:`assetPicker`,ctx:{method:`wallet`,backTarget:e.backTarget}}:e.kind===`amountEntry`?{name:`amountEntry`,ctx:{method:`wallet`,asset:e.asset,backTarget:e.backTarget}}:{name:`transferCrypto`,ctx:{method:`transfer`,backTarget:e.backTarget}}}function y(e){return e.kind===`fresh`?{name:`deposit`,ctx:{backTarget:`closed`}}:e.kind===`onrampAmountEntry`?{name:`onrampAmountEntry`,ctx:{method:`onramp`,backTarget:`deposit`}}:e.kind===`transferCrypto`?{name:`transferCrypto`,ctx:{method:`transfer`,backTarget:e.backTarget}}:{name:`confirmDeposit`,ctx:{method:`wallet`,asset:e.asset,amount:e.amount,phase:{kind:`loading`},backTarget:`amountEntry`}}}export{n as initialState,a as reducer};
|
|
@@ -1,14 +1,70 @@
|
|
|
1
1
|
import { TxRef } from "../../../shared/driver/types.js";
|
|
2
2
|
import { BalanceItemPayload } from "../driver/payloads.js";
|
|
3
3
|
import { FailureInfo } from "../../../shared/orchestrator/types.js";
|
|
4
|
-
|
|
5
4
|
//#region src/flows/deposit/orchestrator/types.d.ts
|
|
6
5
|
/**
|
|
7
6
|
* Deposit method picked on the `Deposit` widget. `wallet` enters Path A
|
|
8
7
|
* (asset → amount → confirm → process), `transfer` enters Path B
|
|
9
8
|
* (transfer-crypto → process).
|
|
10
9
|
*/
|
|
11
|
-
type DepositMethod = "wallet" | "transfer";
|
|
10
|
+
type DepositMethod = "wallet" | "transfer" | "onramp";
|
|
11
|
+
/**
|
|
12
|
+
* Host-supplied disable lever for a single payment method on the deposit-method picker. The host
|
|
13
|
+
* decides eligibility — the kit ships no per-host inference (embedded vs. external wallet,
|
|
14
|
+
* region, KYC tier, …). When `disabled` is true the tile stays in the picker (preserves
|
|
15
|
+
* discoverability), renders natively disabled, can't be selected, and shows `disabledHint` as
|
|
16
|
+
* the inline meta line below the title (also folded into the tile's accessible name so screen
|
|
17
|
+
* readers convey the reason).
|
|
18
|
+
*/
|
|
19
|
+
interface DepositMethodConfig {
|
|
20
|
+
/** When true, the method is rendered disabled and can't be selected. */
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Plain-text reason shown inline as the tile's meta line — replaces the address+balance
|
|
24
|
+
* reading on the wallet tile and the `"No limit · Instant"` reading on the transfer tile so
|
|
25
|
+
* the explanation is unmissable and the auto-derived signals (which can read misleadingly,
|
|
26
|
+
* e.g. an embedded wallet's $0.00) are suppressed. Also folded into the tile's accessible
|
|
27
|
+
* name so screen readers convey it alongside the title. Ignored when `disabled` is falsy.
|
|
28
|
+
*/
|
|
29
|
+
disabledHint?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Per-rail host configuration for the deposit picker. Distinct from
|
|
33
|
+
* {@link DepositMethodConfig} — a rail toggle removes the rail tab entirely
|
|
34
|
+
* from the `RailPicker` rather than disabling a single tile, so there is no
|
|
35
|
+
* `disabledHint` slot (there is no tile to surface the hint on). When only
|
|
36
|
+
* one rail remains after filtering, the orchestrated widget's default
|
|
37
|
+
* composition collapses the `RailPicker` chrome and renders the surviving
|
|
38
|
+
* rail's content directly at the body root.
|
|
39
|
+
*/
|
|
40
|
+
interface DepositRailConfig {
|
|
41
|
+
/**
|
|
42
|
+
* Opt-IN gate for the rail. The onramp rail is hidden by default — hosts that want
|
|
43
|
+
* the "Cash" tab in their picker must set `enabled: true` and have a driver that
|
|
44
|
+
* surfaces the matching entity (e.g. `onrampMethods`). Crypto-only integrators upgrade
|
|
45
|
+
* transparently because the default is `enabled !== true`. Set explicitly to `false`
|
|
46
|
+
* is equivalent to leaving it unset.
|
|
47
|
+
*/
|
|
48
|
+
enabled?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Legacy opt-OUT toggle. Kept for back-compatibility with the brief window where the
|
|
51
|
+
* rail shipped on by default and integrators had to set this to hide it. New code
|
|
52
|
+
* should prefer {@link DepositRailConfig.enabled}; setting `disabled: true` continues
|
|
53
|
+
* to hide the rail regardless of `enabled`.
|
|
54
|
+
*/
|
|
55
|
+
disabled?: boolean;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Per-method host configuration for the deposit picker. Omitting a method (or the whole object)
|
|
59
|
+
* keeps default behavior; supply `{ disabled: true, disabledHint: "…" }` to mark an option as
|
|
60
|
+
* unavailable for the current user. `onrampRail` is a rail-level toggle — see
|
|
61
|
+
* {@link DepositRailConfig}.
|
|
62
|
+
*/
|
|
63
|
+
interface DepositMethodsConfig {
|
|
64
|
+
wallet?: DepositMethodConfig;
|
|
65
|
+
transfer?: DepositMethodConfig;
|
|
66
|
+
onrampRail?: DepositRailConfig;
|
|
67
|
+
}
|
|
12
68
|
/**
|
|
13
69
|
* Confirm-deposit phase sub-union. Drives the confirm-deposit widget's hero / footer chrome.
|
|
14
70
|
* Phase data is pure navigation; the actual quote payload comes from the driver's `quote` entity.
|
|
@@ -28,6 +84,23 @@ type ConfirmDepositPhase = {
|
|
|
28
84
|
failure: FailureInfo;
|
|
29
85
|
recoverFrom: "quote" | "submission";
|
|
30
86
|
};
|
|
87
|
+
/**
|
|
88
|
+
* Onramp-confirm phase sub-union. Drives the onramp confirm widget's CTA chrome — `loading` paints
|
|
89
|
+
* the quote skeleton while `requestOnrampQuote` resolves, `ready` renders the priced summary + the
|
|
90
|
+
* "Continue to payment" CTA, `creating` shows the spinner while `createOnrampSession` runs and the
|
|
91
|
+
* checkout tab opens, and `failed` surfaces an inline retry. Phase is pure navigation; the quote
|
|
92
|
+
* payload comes from the driver's `onrampQuote` entity.
|
|
93
|
+
*/
|
|
94
|
+
type OnrampConfirmPhase = {
|
|
95
|
+
kind: "loading";
|
|
96
|
+
} | {
|
|
97
|
+
kind: "ready";
|
|
98
|
+
} | {
|
|
99
|
+
kind: "creating";
|
|
100
|
+
} | {
|
|
101
|
+
kind: "failed";
|
|
102
|
+
failure: FailureInfo;
|
|
103
|
+
};
|
|
31
104
|
/**
|
|
32
105
|
* Where `ERROR_TRY_AGAIN` lands. Encoded once at error-entry time so retry is deterministic.
|
|
33
106
|
*/
|
|
@@ -39,6 +112,12 @@ type RetryTargetSpec = {
|
|
|
39
112
|
} | {
|
|
40
113
|
kind: "transferCrypto";
|
|
41
114
|
backTarget: "closed" | "deposit";
|
|
115
|
+
} | {
|
|
116
|
+
/**
|
|
117
|
+
* Onramp ("Cash") retry — `ERROR_TRY_AGAIN` routes the user back to
|
|
118
|
+
* `onrampAmountEntry` so they can re-enter an amount and create a fresh checkout session.
|
|
119
|
+
*/
|
|
120
|
+
kind: "onrampAmountEntry";
|
|
42
121
|
} | {
|
|
43
122
|
/**
|
|
44
123
|
* No re-runnable target — used when `ERROR_TRY_AGAIN` should route the user back to the
|
|
@@ -47,6 +126,33 @@ type RetryTargetSpec = {
|
|
|
47
126
|
*/
|
|
48
127
|
kind: "fresh";
|
|
49
128
|
};
|
|
129
|
+
/**
|
|
130
|
+
* Where `BACK` lands when the user exits the activity surface. Encoded once at `OPEN_ACTIVITY`
|
|
131
|
+
* time so the back chevron can restore each pre-commit source state lossless — same precedent
|
|
132
|
+
* as {@link RetryTargetSpec}, just for the activity-exit path instead of the error-retry path.
|
|
133
|
+
*
|
|
134
|
+
* The discriminant `kind` mirrors the source-state name. The remaining fields carry exactly the
|
|
135
|
+
* ctx slots needed to rebuild that state (method, asset, inner backTarget). Direct-entry into
|
|
136
|
+
* the per-flow activity is no longer possible — that path migrated to the standalone
|
|
137
|
+
* `useActivity()` hook — so every reachable backTarget identifies a concrete source step.
|
|
138
|
+
*/
|
|
139
|
+
type ActivityBackTarget = {
|
|
140
|
+
kind: "deposit";
|
|
141
|
+
backTarget: "closed";
|
|
142
|
+
} | {
|
|
143
|
+
kind: "assetPicker";
|
|
144
|
+
method: "wallet";
|
|
145
|
+
backTarget: "closed" | "deposit";
|
|
146
|
+
} | {
|
|
147
|
+
kind: "amountEntry";
|
|
148
|
+
method: "wallet";
|
|
149
|
+
asset: BalanceItemPayload;
|
|
150
|
+
backTarget: "closed" | "assetPicker";
|
|
151
|
+
} | {
|
|
152
|
+
kind: "transferCrypto";
|
|
153
|
+
method: "transfer";
|
|
154
|
+
backTarget: "closed" | "deposit";
|
|
155
|
+
};
|
|
50
156
|
/**
|
|
51
157
|
* State machine state nodes. Per-state discriminated ctx narrows what is available — illegal
|
|
52
158
|
* states (e.g. `confirmDeposit` without an asset) are unrepresentable.
|
|
@@ -75,6 +181,35 @@ type DepositState = {
|
|
|
75
181
|
asset: BalanceItemPayload;
|
|
76
182
|
backTarget: "closed" | "assetPicker";
|
|
77
183
|
};
|
|
184
|
+
} | {
|
|
185
|
+
name: "onrampAmountEntry";
|
|
186
|
+
ctx: {
|
|
187
|
+
method: "onramp";
|
|
188
|
+
backTarget: "closed" | "deposit";
|
|
189
|
+
/**
|
|
190
|
+
* Optional initial amount, restored when the user backs out of `onrampConfirm` so the
|
|
191
|
+
* fiat band keeps the value they entered before continuing. Absent on first entry
|
|
192
|
+
* (the widget falls back to the first preset).
|
|
193
|
+
*/
|
|
194
|
+
amount?: number;
|
|
195
|
+
};
|
|
196
|
+
} | {
|
|
197
|
+
name: "onrampConfirm";
|
|
198
|
+
ctx: {
|
|
199
|
+
method: "onramp";
|
|
200
|
+
amount: number;
|
|
201
|
+
phase: OnrampConfirmPhase;
|
|
202
|
+
backTarget: "onrampAmountEntry";
|
|
203
|
+
};
|
|
204
|
+
} | {
|
|
205
|
+
name: "onrampPaymentPending";
|
|
206
|
+
ctx: {
|
|
207
|
+
method: "onramp";
|
|
208
|
+
amount: number;
|
|
209
|
+
sessionId: string;
|
|
210
|
+
checkoutUrl: string;
|
|
211
|
+
backTarget: "onrampConfirm";
|
|
212
|
+
};
|
|
78
213
|
} | {
|
|
79
214
|
name: "confirmDeposit";
|
|
80
215
|
ctx: {
|
|
@@ -101,7 +236,13 @@ type DepositState = {
|
|
|
101
236
|
name: "success";
|
|
102
237
|
ctx: {
|
|
103
238
|
method: DepositMethod;
|
|
104
|
-
|
|
239
|
+
/**
|
|
240
|
+
* Source-chain broadcast tx for crypto deposits. Optional because the onramp branch
|
|
241
|
+
* has no on-chain tx of its own at terminal time — it reads the completed
|
|
242
|
+
* `onrampSession` entity instead and carries {@link sessionId}.
|
|
243
|
+
*/
|
|
244
|
+
tx?: TxRef; /** Onramp checkout session id — set only when `method === "onramp"`. */
|
|
245
|
+
sessionId?: string;
|
|
105
246
|
};
|
|
106
247
|
} | {
|
|
107
248
|
name: "error";
|
|
@@ -109,11 +250,38 @@ type DepositState = {
|
|
|
109
250
|
retryTarget: RetryTargetSpec;
|
|
110
251
|
/**
|
|
111
252
|
* Set for non-settlement failures (quote / submission rejections that escalate via
|
|
112
|
-
* the orchestrated `error` arm
|
|
113
|
-
* widget renders from the driver's `settlement`
|
|
253
|
+
* the orchestrated `error` arm, and onramp session failures). Crypto settlement
|
|
254
|
+
* failures leave this `undefined` — the widget renders from the driver's `settlement`
|
|
255
|
+
* entity (`kind: "failed"`) instead.
|
|
114
256
|
*/
|
|
115
257
|
failure?: FailureInfo; /** Source-chain tx hash when the error followed a successful broadcast. */
|
|
116
|
-
tx?: TxRef;
|
|
258
|
+
tx?: TxRef; /** Onramp checkout session id — set only when the failure came from the onramp rail. */
|
|
259
|
+
sessionId?: string;
|
|
260
|
+
};
|
|
261
|
+
} | {
|
|
262
|
+
/**
|
|
263
|
+
* Activity list — reachable from any pre-commit state via the header icon.
|
|
264
|
+
* `backTarget` snapshots the source state at `OPEN_ACTIVITY` time so the back chevron
|
|
265
|
+
* can restore it lossless.
|
|
266
|
+
*/
|
|
267
|
+
name: "activityList";
|
|
268
|
+
ctx: {
|
|
269
|
+
backTarget: ActivityBackTarget;
|
|
270
|
+
};
|
|
271
|
+
} | {
|
|
272
|
+
/**
|
|
273
|
+
* Activity per-settlement detail — reached from `activityList` via
|
|
274
|
+
* `SELECT_SETTLEMENT`. Carries the selected row's id, the same `backTarget` so `BACK`
|
|
275
|
+
* collapses through `activityList` to the original source step, and a `viaList` flag
|
|
276
|
+
* that disambiguates "reached via the list" from "reached imperatively"; the latter
|
|
277
|
+
* skips the list interlude on `BACK`. For direct-entry into the activity surface,
|
|
278
|
+
* see {@link useActivity}.
|
|
279
|
+
*/
|
|
280
|
+
name: "activityDetail";
|
|
281
|
+
ctx: {
|
|
282
|
+
settlementId: string;
|
|
283
|
+
backTarget: ActivityBackTarget;
|
|
284
|
+
viaList: boolean;
|
|
117
285
|
};
|
|
118
286
|
};
|
|
119
287
|
type DepositStateName = DepositState["name"];
|
|
@@ -142,6 +310,40 @@ type GatewayEvent = {
|
|
|
142
310
|
} | {
|
|
143
311
|
type: "DEPOSIT_METHOD_SELECTED";
|
|
144
312
|
method: DepositMethod;
|
|
313
|
+
} | {
|
|
314
|
+
type: "ONRAMP_SELECTED";
|
|
315
|
+
} | {
|
|
316
|
+
/**
|
|
317
|
+
* Live fiat amount the user is typing on `onrampAmountEntry`, mirrored into `ctx.amount`
|
|
318
|
+
* so the controller's debounced quote effect can fetch a fresh `onrampQuote` for the
|
|
319
|
+
* on-screen breakdown. `null` while the field is empty (no quote fires). Distinct from
|
|
320
|
+
* {@link GatewayEvent} `ONRAMP_AMOUNT_CONFIRMED`, which commits the amount and advances
|
|
321
|
+
* the FSM to `onrampConfirm`.
|
|
322
|
+
*/
|
|
323
|
+
type: "ONRAMP_AMOUNT_CHANGED";
|
|
324
|
+
amount: number | null;
|
|
325
|
+
} | {
|
|
326
|
+
type: "ONRAMP_AMOUNT_CONFIRMED";
|
|
327
|
+
amount: number;
|
|
328
|
+
} | {
|
|
329
|
+
type: "ONRAMP_QUOTE_RESOLVED";
|
|
330
|
+
} | {
|
|
331
|
+
type: "ONRAMP_QUOTE_FAILED";
|
|
332
|
+
failure: FailureInfo;
|
|
333
|
+
} | {
|
|
334
|
+
type: "ONRAMP_CONFIRMED";
|
|
335
|
+
} | {
|
|
336
|
+
type: "ONRAMP_SESSION_CREATED";
|
|
337
|
+
sessionId: string;
|
|
338
|
+
checkoutUrl: string;
|
|
339
|
+
} | {
|
|
340
|
+
type: "ONRAMP_SESSION_COMPLETED";
|
|
341
|
+
} | {
|
|
342
|
+
type: "ONRAMP_SESSION_EXPIRED";
|
|
343
|
+
failure?: FailureInfo;
|
|
344
|
+
} | {
|
|
345
|
+
type: "ONRAMP_SESSION_FAILED";
|
|
346
|
+
failure: FailureInfo;
|
|
145
347
|
} | {
|
|
146
348
|
type: "ASSET_CONFIRMED";
|
|
147
349
|
asset: BalanceItemPayload;
|
|
@@ -205,11 +407,30 @@ type GatewayEvent = {
|
|
|
205
407
|
*/
|
|
206
408
|
type: "RESUME_TO_ERROR";
|
|
207
409
|
tx?: TxRef;
|
|
410
|
+
} | {
|
|
411
|
+
/**
|
|
412
|
+
* User tapped the header activity icon. Legal from every pre-commit state
|
|
413
|
+
* (`deposit | assetPicker | amountEntry | transferCrypto`); ignored elsewhere. The
|
|
414
|
+
* reducer snapshots the source state into a {@link ActivityBackTarget} so the back
|
|
415
|
+
* chevron can restore it lossless.
|
|
416
|
+
*/
|
|
417
|
+
type: "OPEN_ACTIVITY";
|
|
418
|
+
} | {
|
|
419
|
+
/**
|
|
420
|
+
* User tapped a row in the activity list. Legal only from `activityList`; transitions
|
|
421
|
+
* to `activityDetail` carrying the selected `settlementId` and the same `backTarget`,
|
|
422
|
+
* so a later `BACK` from the list step restores the original source state.
|
|
423
|
+
*/
|
|
424
|
+
type: "SELECT_SETTLEMENT";
|
|
425
|
+
settlementId: string;
|
|
208
426
|
};
|
|
209
427
|
/**
|
|
210
428
|
* Public open-input variant accepted by `useDeposit().open()`. Hosts pass the small ID-based
|
|
211
|
-
* shape; the controller resolves
|
|
212
|
-
*
|
|
429
|
+
* shape; the controller resolves `assetId` against the driver's `balances` entity before
|
|
430
|
+
* dispatching. Lookup misses fall through to the asset picker — the host's click never silently
|
|
431
|
+
* no-ops.
|
|
432
|
+
*
|
|
433
|
+
* For direct-entry into the activity surface, see {@link useActivity}.
|
|
213
434
|
*/
|
|
214
435
|
type OpenInput = undefined | {
|
|
215
436
|
method: "wallet";
|
|
@@ -226,11 +447,14 @@ interface DepositController {
|
|
|
226
447
|
*
|
|
227
448
|
* - `open()` → `deposit` (method picker)
|
|
228
449
|
* - `open({ method: "wallet" })` → `assetPicker`
|
|
229
|
-
* - `open({ method: "wallet", assetId })` → `amountEntry`
|
|
450
|
+
* - `open({ method: "wallet", assetId })` → `amountEntry` when `assetId` resolves, otherwise
|
|
451
|
+
* falls through to `assetPicker`
|
|
230
452
|
* - `open({ method: "transfer" })` → `transferCrypto`
|
|
231
453
|
*
|
|
232
|
-
* Returns `false` when `
|
|
233
|
-
*
|
|
454
|
+
* Returns `false` only when the requested `method` is disabled via
|
|
455
|
+
* {@link DepositMethodsConfig}.
|
|
456
|
+
*
|
|
457
|
+
* For direct-entry into the activity surface, see {@link useActivity}.
|
|
234
458
|
*/
|
|
235
459
|
open(input?: OpenInput): boolean;
|
|
236
460
|
/** Close the deposit dialog. Idempotent. */
|
|
@@ -248,6 +472,32 @@ interface DepositController {
|
|
|
248
472
|
*/
|
|
249
473
|
interface DepositActions {
|
|
250
474
|
selectMethod(method: DepositMethod): void;
|
|
475
|
+
/**
|
|
476
|
+
* Promotes the FSM from `deposit` (method picker) into `onrampAmountEntry`. The onramp rail is
|
|
477
|
+
* single-method (the hosted-checkout provider collects the payment instrument), so this takes
|
|
478
|
+
* no argument — selecting "Cash" goes straight to amount entry.
|
|
479
|
+
*/
|
|
480
|
+
selectOnramp(): void;
|
|
481
|
+
/**
|
|
482
|
+
* Mirrors the live fiat amount the user is typing on `onrampAmountEntry` into the FSM's
|
|
483
|
+
* `ctx.amount`. The controller's debounced quote effect keys off that value to fetch a fresh
|
|
484
|
+
* `onrampQuote` for the on-screen breakdown — without this sync the amount-entry screen would
|
|
485
|
+
* never quote (the field's local state is invisible to the controller). Pass `null` when the
|
|
486
|
+
* field is cleared. No FSM transition; `onrampAmountEntry` stays current.
|
|
487
|
+
*/
|
|
488
|
+
setOnrampAmount(amount: number | null): void;
|
|
489
|
+
/**
|
|
490
|
+
* Promotes the FSM from `onrampAmountEntry` into `onrampConfirm{loading}` carrying the entered
|
|
491
|
+
* fiat amount. The controller's quote effect resolves the `onrampQuote` entity and the bridge
|
|
492
|
+
* flips the phase to `ready`.
|
|
493
|
+
*/
|
|
494
|
+
confirmOnrampAmount(amount: number): void;
|
|
495
|
+
/**
|
|
496
|
+
* Flips `onrampConfirm{ready}` → `onrampConfirm{creating}`. The controller's session effect
|
|
497
|
+
* calls `createOnrampSession`, opens the hosted checkout in a new tab, and dispatches
|
|
498
|
+
* `ONRAMP_SESSION_CREATED` to advance to `onrampPaymentPending`.
|
|
499
|
+
*/
|
|
500
|
+
confirmOnramp(): void;
|
|
251
501
|
confirmAsset(asset: BalanceItemPayload): void;
|
|
252
502
|
confirmAmount(amount: number): void;
|
|
253
503
|
confirmDeposit(): void;
|
|
@@ -261,6 +511,20 @@ interface DepositActions {
|
|
|
261
511
|
resumeToSuccess(method: DepositMethod, tx: TxRef): void;
|
|
262
512
|
/** Banner-driven jump into the error widget. */
|
|
263
513
|
resumeToError(tx?: TxRef): void;
|
|
514
|
+
/**
|
|
515
|
+
* Header-icon entry into the activity surface. Legal only from the pre-quote states
|
|
516
|
+
* (`deposit | assetPicker | amountEntry | transferCrypto`); ignored from `confirmDeposit`
|
|
517
|
+
* onwards and from terminal states. Snapshots the current state into a
|
|
518
|
+
* {@link ActivityBackTarget} so `back()` can restore it lossless. No-ops with a dev-mode
|
|
519
|
+
* warning when no activity driver is mounted (host wired the action without
|
|
520
|
+
* `<KitProvider activity={…}>`).
|
|
521
|
+
*/
|
|
522
|
+
openActivity(): void;
|
|
523
|
+
/**
|
|
524
|
+
* Open the detail view for a settlement listed on the activity surface. Legal only from
|
|
525
|
+
* `activityList`; transitions the FSM to `activityDetail`.
|
|
526
|
+
*/
|
|
527
|
+
selectSettlement(settlementId: string): void;
|
|
264
528
|
}
|
|
265
529
|
//#endregion
|
|
266
|
-
export { ConfirmDepositPhase, DepositActions, DepositController, DepositMethod, DepositState, DepositStateName, GatewayEvent, OpenInput, ResolvedOpenInput, RetryTargetSpec };
|
|
530
|
+
export { ConfirmDepositPhase, DepositActions, DepositController, DepositMethod, DepositMethodConfig, DepositMethodsConfig, DepositRailConfig, DepositState, DepositStateName, GatewayEvent, OnrampConfirmPhase, OpenInput, ResolvedOpenInput, RetryTargetSpec };
|
|
@@ -31,5 +31,49 @@ import { DepositController } from "./types.js";
|
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
33
|
declare function useDeposit(): DepositController;
|
|
34
|
+
/**
|
|
35
|
+
* Non-throwing variant of {@link useDeposit} — returns `null` when called outside a
|
|
36
|
+
* `<KitProvider deposit={…} />`. Lets hosts mount `<StridgeProvider />` conditionally
|
|
37
|
+
* (e.g. only after a wallet is connected) without descendants crashing the moment they render
|
|
38
|
+
* before the provider exists.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```tsx
|
|
42
|
+
* const deposit = useOptionalDeposit();
|
|
43
|
+
* return (
|
|
44
|
+
* <button onClick={() => deposit?.open()} disabled={!deposit}>
|
|
45
|
+
* Deposit
|
|
46
|
+
* </button>
|
|
47
|
+
* );
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
declare function useOptionalDeposit(): DepositController | null;
|
|
51
|
+
/**
|
|
52
|
+
* Headless prefetch handle for the deposit driver. Returns a stable function that arms the
|
|
53
|
+
* driver — kicks off the deferred `gateway/start` + `supportedAssets` + initial `balance/onchain`
|
|
54
|
+
* bootstrap. Calling it before the user opens the dialog warms the cache so the subsequent
|
|
55
|
+
* `useDeposit().open()` lands on populated data without a perceptible loading window.
|
|
56
|
+
*
|
|
57
|
+
* The function is fire-and-forget: returns `void`. To observe bootstrap state, read
|
|
58
|
+
* `useDepositSnapshot().target.status` directly — the snapshot is the single source of truth.
|
|
59
|
+
*
|
|
60
|
+
* The most common use is hover-to-warm:
|
|
61
|
+
*
|
|
62
|
+
* ```tsx
|
|
63
|
+
* const deposit = useDeposit();
|
|
64
|
+
* const prefetchDeposit = usePrefetchDeposit();
|
|
65
|
+
* <button onMouseEnter={prefetchDeposit} onClick={() => deposit.open()}>Deposit</button>;
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* Headless balance widgets that need data on render call this in an effect:
|
|
69
|
+
*
|
|
70
|
+
* ```tsx
|
|
71
|
+
* const prefetchDeposit = usePrefetchDeposit();
|
|
72
|
+
* useEffect(() => { prefetchDeposit(); }, [prefetchDeposit]);
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* Idempotent — subsequent calls are no-ops while the driver is already armed.
|
|
76
|
+
*/
|
|
77
|
+
declare function usePrefetchDeposit(): () => void;
|
|
34
78
|
//#endregion
|
|
35
|
-
export { useDeposit };
|
|
79
|
+
export { useDeposit, useOptionalDeposit, usePrefetchDeposit };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
1
|
+
"use client";import{useDepositDriverInstance as e}from"../driver/context.js";import{useOptionalStableControllerContext as t,useStableControllerContext as n}from"./controller.js";import{useCallback as r}from"react";function i(){return n().controller}function a(){return t()?.controller??null}function o(){let t=e();return r(()=>{t.arm()},[t])}export{i as useDeposit,a as useOptionalDeposit,o as usePrefetchDeposit};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){if(typeof window>`u`)return;let t;try{t=new URL(e,window.location.href)}catch{return}if(t.protocol!==`http:`&&t.protocol!==`https:`)return;let n=window.screenLeft??0,r=window.screenTop??0,i=window.outerWidth||window.innerWidth||460,a=window.outerHeight||window.innerHeight||760,o=Math.max(0,n+(i-460)/2),s=Math.max(0,r+(a-760)/2),c=`popup=yes,width=460,height=760,left=${Math.round(o)},top=${Math.round(s)},noopener,noreferrer`;window.open(e,`_blank`,c)}export{e as openCheckoutPopup};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=[{value:200,label:`$200`},{value:500,label:`$500`},{value:1e3,label:`$1k`},{value:2e3,label:`$2k`}];export{e as ONRAMP_AMOUNT_PRESETS};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/flows/deposit/widgets/activity/DepositActivityDetail.d.ts
|
|
5
|
+
interface DepositActivityDetailOwnProps {
|
|
6
|
+
/**
|
|
7
|
+
* Optional custom composition forwarded to the underlying `<ActivityDetail>`
|
|
8
|
+
* compound. Defaults to mounting all three per-kind parts; each gates internally on the
|
|
9
|
+
* resolved payload's `kind`.
|
|
10
|
+
*/
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Orchestrated activity detail wrapper for the deposit dialog. Mounts the cross-flow
|
|
15
|
+
* `<ActivityDetail>` compound and exposes per-kind parts (`Processing`, `Succeeded`,
|
|
16
|
+
* `Failed`) as namespace members. Renders `null` while the FSM is not on `activityDetail`.
|
|
17
|
+
*/
|
|
18
|
+
declare function DepositActivityDetail({
|
|
19
|
+
children
|
|
20
|
+
}: DepositActivityDetailOwnProps): _$react_jsx_runtime0.JSX.Element | null;
|
|
21
|
+
declare namespace DepositActivityDetail {
|
|
22
|
+
type Props = DepositActivityDetailOwnProps;
|
|
23
|
+
const Processing: ({
|
|
24
|
+
children
|
|
25
|
+
}: {
|
|
26
|
+
children?: ReactNode;
|
|
27
|
+
}) => _$react_jsx_runtime0.JSX.Element | null;
|
|
28
|
+
const Succeeded: ({
|
|
29
|
+
children
|
|
30
|
+
}: {
|
|
31
|
+
children?: ReactNode;
|
|
32
|
+
}) => _$react_jsx_runtime0.JSX.Element | null;
|
|
33
|
+
const Failed: ({
|
|
34
|
+
children
|
|
35
|
+
}: {
|
|
36
|
+
children?: ReactNode;
|
|
37
|
+
}) => _$react_jsx_runtime0.JSX.Element | null;
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { DepositActivityDetail };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{ActivitySourceProvider as e}from"../../../../shared/widgets/activity/compound/context.js";import{ActivityDetail as t}from"../../../../shared/widgets/activity/compound/ActivityDetail.js";import"../../../../shared/widgets/activity/compound/index.js";import{useDepositActivitySource as n}from"./useDepositActivitySource.js";import{jsx as r}from"react/jsx-runtime";function i({children:i}){let{sourceValue:a,step:o}=n();return o!==`activityDetail`||!a?null:r(e,{value:a,children:r(t,{children:i})})}(function(e){e.Processing=t.Processing,e.Succeeded=t.Succeeded,e.Failed=t.Failed})(i||={});export{i as DepositActivityDetail};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ActivityHeader, ActivityListHeader } from "../../../../shared/widgets/activity/compound/components/ActivityHeader.js";
|
|
2
|
+
import { ActivityEmpty } from "../../../../shared/widgets/activity/compound/components/Empty.js";
|
|
3
|
+
import { ActivityErrorView } from "../../../../shared/widgets/activity/compound/components/ErrorView.js";
|
|
4
|
+
import { ActivityList } from "../../../../shared/widgets/activity/compound/components/List.js";
|
|
5
|
+
import { ActivityRow } from "../../../../shared/widgets/activity/compound/components/Row.js";
|
|
6
|
+
import { ComponentProps, ReactNode } from "react";
|
|
7
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
8
|
+
|
|
9
|
+
//#region src/flows/deposit/widgets/activity/DepositActivityList.d.ts
|
|
10
|
+
interface DepositActivityListOwnProps {
|
|
11
|
+
/**
|
|
12
|
+
* Optional custom composition forwarded to the underlying `<Activity>` compound.
|
|
13
|
+
* Defaults to the compound's `<Header /> + <List />` shape.
|
|
14
|
+
*/
|
|
15
|
+
children?: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Orchestrated activity list wrapper for the deposit dialog. Bridges the deposit
|
|
19
|
+
* flow's snapshot + actions + FSM state into the cross-flow `<Activity>` compound's
|
|
20
|
+
* source value. Renders `null` while the FSM is not on `activityList` — the dialog's step
|
|
21
|
+
* router only matches the active step, but the no-op guard keeps the component safe to mount
|
|
22
|
+
* in custom dialog compositions that skip the step router.
|
|
23
|
+
*/
|
|
24
|
+
declare function DepositActivityList({
|
|
25
|
+
children,
|
|
26
|
+
...props
|
|
27
|
+
}: ComponentProps<"div"> & DepositActivityListOwnProps): _$react_jsx_runtime0.JSX.Element | null;
|
|
28
|
+
declare namespace DepositActivityList {
|
|
29
|
+
type Props = ComponentProps<"div"> & DepositActivityListOwnProps;
|
|
30
|
+
const Header: typeof ActivityHeader;
|
|
31
|
+
const ListHeader: typeof ActivityListHeader;
|
|
32
|
+
const List: typeof ActivityList;
|
|
33
|
+
const Row: typeof ActivityRow;
|
|
34
|
+
const Empty: typeof ActivityEmpty;
|
|
35
|
+
const ErrorView: typeof ActivityErrorView;
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { DepositActivityList };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{ActivitySourceProvider as e}from"../../../../shared/widgets/activity/compound/context.js";import{Activity as t}from"../../../../shared/widgets/activity/compound/Activity.js";import"../../../../shared/widgets/activity/compound/index.js";import{useDepositActivitySource as n}from"./useDepositActivitySource.js";import{jsx as r}from"react/jsx-runtime";function i({children:i,...a}){let{sourceValue:o,step:s}=n();return s!==`activityList`||!o?null:r(e,{value:o,children:r(t,{...a,children:i})})}(function(e){e.Header=t.Header,e.ListHeader=t.ListHeader,e.List=t.List,e.Row=t.Row,e.Empty=t.Empty,e.ErrorView=t.ErrorView})(i||={});export{i as DepositActivityList};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./DepositActivityDetail.js";import"./DepositActivityList.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{useOptionalActivityDriverInstance as e,useOptionalActivitySnapshot as t}from"../../../activity/driver/context.js";import{useLingui as n}from"../../../../shared/i18n/useLingui.js";import"../../../../i18n/index.js";import{useDepositSnapshot as r}from"../../driver/context.js";import{useDepositActions as i,useDepositEffectiveState as a}from"../../orchestrator/controller.js";import{defaultBlockExplorers as o}from"../../../../shared/utils/explorers.js";import{useCallback as s,useMemo as c}from"react";function l(){let l=r(),u=i(),d=e(),f=t(),p=a(),{i18n:m}=n(),h=s(e=>{d?.refreshActivity(e)},[d]),g=p.name===`activityList`||p.name===`activityDetail`,_=p.name===`activityDetail`?p.ctx.settlementId:void 0,v=g;return{sourceValue:c(()=>{if(!g||!f)return null;let e=l.wallet,t=f.activity,n=e.status===`ready`||e.status===`stale`?e.payload.address.value:t.status===`ready`||t.status===`stale`?t.response.owner:`0x0000000000000000000000000000000000000000`,r=t.status===`ready`||t.status===`stale`?t.payload.brandName:void 0,i=l.brand,a=i.status===`ready`||i.status===`stale`?i.payload.name:void 0,s=r??a,c={i18n:m,sourceWallet:{name:`Wallet`,address:n},explorers:o(),...s?{brandName:s}:{}};return{entity:f.activity,refresh:h,selectSettlement:u.selectSettlement,...v?{back:u.back}:{},..._===void 0?{}:{settlementId:_},settlementContext:c}},[f,l,u,g,_,m,h,v]),settlementId:_,step:p.name===`activityList`?`activityList`:p.name===`activityDetail`?`activityDetail`:`other`}}export{l as useDepositActivitySource};
|