@stridge/kit 0.1.0-alpha.5 → 0.1.0-alpha.50
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 +29 -0
- package/dist/KitProvider.js +1 -1
- package/dist/_internal/deposit/widgets/index.d.ts +3 -1
- package/dist/_internal/deposit/widgets/index.js +1 -1
- package/dist/_internal/drivers/stridge/index.d.ts +3 -2
- package/dist/_internal/drivers/stridge/index.js +1 -1
- package/dist/_internal/withdraw/driver/index.d.ts +2 -2
- package/dist/_internal/withdraw/widgets/index.d.ts +3 -1
- package/dist/_internal/withdraw/widgets/index.js +1 -1
- package/dist/activity-history/compound/index.d.ts +9 -0
- package/dist/activity-history/compound/index.js +1 -0
- package/dist/deposit/compound/index.d.ts +4 -3
- package/dist/drivers/stridge/catalog.d.ts +54 -0
- package/dist/drivers/stridge/catalog.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/createStridgeMockDriver.d.ts +4 -2
- package/dist/drivers/stridge-mock/createStridgeMockDriver.js +1 -1
- package/dist/drivers/stridge-mock/createStridgeMockWithdrawDriver.d.ts +17 -4
- package/dist/drivers/stridge-mock/createStridgeMockWithdrawDriver.js +1 -1
- package/dist/drivers/stridge-mock/fixtures.d.ts +14 -12
- package/dist/drivers/stridge-mock/fixtures.js +1 -1
- package/dist/events/bus/createBus.d.ts +7 -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/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 +8 -0
- package/dist/events/hooks/useStridgeEvent.js +1 -0
- package/dist/events/hooks/useStridgeEventBus.d.ts +33 -0
- package/dist/events/hooks/useStridgeEventBus.js +1 -0
- package/dist/events/hooks/useStridgeEvents.d.ts +6 -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 +14 -0
- package/dist/events/index.js +1 -0
- package/dist/events/publish.js +1 -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 +31 -0
- package/dist/events/types/kit.d.ts +23 -0
- package/dist/events/types/withdraw.d.ts +150 -0
- package/dist/flows/deposit/dialog/DepositDialog.d.ts +20 -82
- 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 +17 -4
- 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/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 +64 -3
- package/dist/flows/deposit/orchestrator/controller.js +1 -1
- package/dist/flows/deposit/orchestrator/reducer.js +1 -1
- package/dist/flows/deposit/orchestrator/types.d.ts +103 -1
- package/dist/flows/deposit/orchestrator/useDeposit.d.ts +45 -1
- package/dist/flows/deposit/orchestrator/useDeposit.js +1 -1
- package/dist/flows/deposit/widgets/activity-history/DepositHistoryDetail.d.ts +40 -0
- package/dist/flows/deposit/widgets/activity-history/DepositHistoryDetail.js +1 -0
- package/dist/flows/deposit/widgets/activity-history/DepositHistoryList.d.ts +38 -0
- package/dist/flows/deposit/widgets/activity-history/DepositHistoryList.js +1 -0
- package/dist/flows/deposit/widgets/activity-history/index.d.ts +2 -0
- package/dist/flows/deposit/widgets/activity-history/index.js +1 -0
- package/dist/flows/deposit/widgets/activity-history/useDepositActivityHistorySource.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 +22 -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 +33 -4
- package/dist/flows/deposit/widgets/deposit/Deposit.js +1 -1
- package/dist/flows/deposit/widgets/deposit/compound/Deposit.d.ts +32 -0
- package/dist/flows/deposit/widgets/deposit/compound/Deposit.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 +10 -0
- package/dist/flows/deposit/widgets/deposit/compound/components/Header.js +1 -1
- package/dist/flows/deposit/widgets/deposit/compound/components/Method.d.ts +6 -0
- package/dist/flows/deposit/widgets/deposit/compound/components/Method.js +1 -1
- 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 +1 -0
- package/dist/flows/deposit/widgets/deposit/compound/types.d.ts +6 -3
- 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/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 +5 -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 +35 -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 +111 -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 +201 -32
- 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-history/WithdrawHistoryDetail.d.ts +39 -0
- package/dist/flows/withdraw/widgets/activity-history/WithdrawHistoryDetail.js +1 -0
- package/dist/flows/withdraw/widgets/activity-history/WithdrawHistoryList.d.ts +36 -0
- package/dist/flows/withdraw/widgets/activity-history/WithdrawHistoryList.js +1 -0
- package/dist/flows/withdraw/widgets/activity-history/index.d.ts +2 -0
- package/dist/flows/withdraw/widgets/activity-history/index.js +1 -0
- package/dist/flows/withdraw/widgets/activity-history/useWithdrawActivityHistorySource.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/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/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 +3 -1
- package/dist/icons/index.js +1 -1
- package/dist/index.d.ts +22 -9
- 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 +18 -1
- package/dist/scope/KitScope.js +1 -1
- package/dist/scope/context.d.ts +17 -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/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/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/HistoryIcon.d.ts +12 -0
- package/dist/shared/icons/HistoryIcon.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/useSettlementWatcher.js +1 -1
- 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/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.js +1 -1
- package/dist/shared/ui/Dialog/Dialog.styles.js +1 -1
- 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/WalletRow/WalletRow.d.ts +1 -1
- package/dist/shared/ui/WalletRow/WalletRow.js +1 -1
- 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-history/ActivityTrigger.js +1 -0
- package/dist/shared/widgets/activity-history/ActivityTrigger.styles.js +1 -0
- package/dist/shared/widgets/activity-history/adapters/settlementToWidgetProps.js +1 -0
- package/dist/shared/widgets/activity-history/compound/ActivityHistory.d.ts +95 -0
- package/dist/shared/widgets/activity-history/compound/ActivityHistory.js +1 -0
- package/dist/shared/widgets/activity-history/compound/ActivityHistory.slots.d.ts +22 -0
- package/dist/shared/widgets/activity-history/compound/ActivityHistory.slots.js +1 -0
- package/dist/shared/widgets/activity-history/compound/ActivityHistory.styles.js +1 -0
- package/dist/shared/widgets/activity-history/compound/ActivityHistoryDetail.d.ts +75 -0
- package/dist/shared/widgets/activity-history/compound/ActivityHistoryDetail.js +1 -0
- package/dist/shared/widgets/activity-history/compound/Row.slots.d.ts +21 -0
- package/dist/shared/widgets/activity-history/compound/Row.slots.js +1 -0
- package/dist/shared/widgets/activity-history/compound/Row.styles.js +1 -0
- package/dist/shared/widgets/activity-history/compound/components/Empty.d.ts +15 -0
- package/dist/shared/widgets/activity-history/compound/components/Empty.js +1 -0
- package/dist/shared/widgets/activity-history/compound/components/ErrorView.d.ts +26 -0
- package/dist/shared/widgets/activity-history/compound/components/ErrorView.js +1 -0
- package/dist/shared/widgets/activity-history/compound/components/HistoryHeader.d.ts +39 -0
- package/dist/shared/widgets/activity-history/compound/components/HistoryHeader.js +1 -0
- package/dist/shared/widgets/activity-history/compound/components/List.d.ts +23 -0
- package/dist/shared/widgets/activity-history/compound/components/List.js +1 -0
- package/dist/shared/widgets/activity-history/compound/components/Row.d.ts +54 -0
- package/dist/shared/widgets/activity-history/compound/components/Row.js +1 -0
- package/dist/shared/widgets/activity-history/compound/components/StatusPip.js +1 -0
- package/dist/shared/widgets/activity-history/compound/context.d.ts +79 -0
- package/dist/shared/widgets/activity-history/compound/context.js +1 -0
- package/dist/shared/widgets/activity-history/index.js +1 -0
- package/dist/shared/widgets/activity-history/payloads.d.ts +81 -0
- package/dist/shared/widgets/activity-history/transformers/historyResponseToPayload.js +1 -0
- package/dist/shared/widgets/activity-history/transformers/resolveDirection.js +1 -0
- package/dist/shared/widgets/amount-entry/compound/AmountEntry.d.ts +4 -1
- package/dist/shared/widgets/amount-entry/compound/AmountEntry.js +1 -1
- package/dist/shared/widgets/amount-entry/compound/AmountEntry.slots.d.ts +1 -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/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/types.d.ts +26 -1
- package/dist/shared/widgets/asset-picker/compound/AssetPicker.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/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 +14 -0
- package/dist/shared/widgets/confirm-transfer/compound/ConfirmTransfer.styles.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/stridge/StridgeProvider.d.ts +165 -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 +228 -10
- package/dist/types.d.ts +5 -4
- package/dist/ui/index.d.ts +3 -1
- package/dist/ui/index.js +1 -1
- package/dist/withdraw/compound/index.d.ts +5 -2
- package/dist/withdraw/compound/index.js +1 -1
- package/dist/withdraw/dialog/index.d.ts +3 -1
- package/package.json +15 -7
- 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,7 +1,3 @@
|
|
|
1
|
-
import { TxRef } from "../../../shared/driver/types.js";
|
|
2
|
-
import { BalanceItemPayload, QuotePayload, SettlementFailurePayload, SettlementPendingPayload, SettlementSuccessPayload } from "../driver/payloads.js";
|
|
3
|
-
import { FailureInfo } from "../../../shared/orchestrator/types.js";
|
|
4
|
-
import { DepositMethod, DepositState, DepositStateName, ResolvedOpenInput } from "../orchestrator/types.js";
|
|
5
1
|
import { ErrorInfo } from "react";
|
|
6
2
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
7
3
|
|
|
@@ -12,23 +8,22 @@ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
|
12
8
|
* bound to the controller's `state.name !== "closed"`, so the dialog appears / disappears
|
|
13
9
|
* automatically as descendants call `useDeposit().open()` / `.close()`.
|
|
14
10
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
11
|
+
* The dialog is a pure composition of compound parts — `<Deposit.Boundary>` for crash
|
|
12
|
+
* recovery, `<Deposit.Guards>` for the wallet-required / bootstrap-fatal / bootstrap-loading
|
|
13
|
+
* cascade, `<Deposit.Steps>` for FSM-driven screen routing, and `<DepositStatusBanner />` for
|
|
14
|
+
* the inline settlement banner. Each piece is independently overrideable via the compound
|
|
15
|
+
* surface; this is the canonical shape integrators can copy verbatim.
|
|
18
16
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
17
|
+
* Lifecycle observability is delivered by the unified event bus exported from
|
|
18
|
+
* `@stridge/kit/events`. The dialog itself takes no `on*` callback props — subscribe via
|
|
19
|
+
* `useStridgeFlowEvents` / `useStridgeEvents` (or the single-event variants) anywhere in
|
|
20
|
+
* the provider subtree.
|
|
23
21
|
*/
|
|
24
22
|
declare function DepositDialog({
|
|
25
23
|
container,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
onError,
|
|
30
|
-
events
|
|
31
|
-
}: DepositDialog.Props): _$react_jsx_runtime0.JSX.Element;
|
|
24
|
+
metadata,
|
|
25
|
+
onError
|
|
26
|
+
}?: DepositDialog.Props): _$react_jsx_runtime0.JSX.Element;
|
|
32
27
|
declare namespace DepositDialog {
|
|
33
28
|
interface Props {
|
|
34
29
|
/**
|
|
@@ -37,76 +32,19 @@ declare namespace DepositDialog {
|
|
|
37
32
|
* dialog's width, height, and backdrop to that rect.
|
|
38
33
|
*/
|
|
39
34
|
container?: HTMLElement | null;
|
|
40
|
-
/** Forwarded to the dialog's internal {@link GatewayKitBoundary} for crash reporting. */
|
|
41
|
-
onError?: (error: Error, errorInfo: ErrorInfo) => void;
|
|
42
35
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
36
|
+
* Consumer-attached metadata that rides along on every bus event emitted from this
|
|
37
|
+
* dialog's session. Snapshotted at `deposit.opened` and frozen for the session —
|
|
38
|
+
* mid-flow prop changes are ignored to keep correlation consistent from `opened` to
|
|
39
|
+
* the terminal event. The kit does not validate or normalise the shape.
|
|
45
40
|
*/
|
|
46
|
-
|
|
47
|
-
/** Fires once when the dialog transitions back to `closed`. `atStep` is the last open step. */
|
|
48
|
-
onClosed?: (atStep: DepositStateName) => void;
|
|
49
|
-
/** Fires on every logical step transition. */
|
|
50
|
-
onStepChanged?: (event: {
|
|
51
|
-
from: DepositStateName;
|
|
52
|
-
to: DepositStateName;
|
|
53
|
-
ctx: GatewayContext | null;
|
|
54
|
-
}) => void;
|
|
55
|
-
/** Operational events — user actions, async outcomes, settlement-entity transitions. */
|
|
56
|
-
events?: Events;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Operational lifecycle hooks. Fire after the controller has acted (state machine has
|
|
60
|
-
* transitioned, driver entity has settled), so payloads are guaranteed valid for the named
|
|
61
|
-
* event.
|
|
62
|
-
*/
|
|
63
|
-
interface Events {
|
|
64
|
-
/** User picked a deposit method on the `Deposit` step. */
|
|
65
|
-
onMethodSelected?: (method: DepositMethod) => void;
|
|
66
|
-
/** User confirmed an asset on the `AssetPicker` step. The asset is the driver-shaped balance row. */
|
|
67
|
-
onAssetSelected?: (asset: BalanceItemPayload) => void;
|
|
68
|
-
/** User submitted an amount on the `AmountEntry` step. */
|
|
69
|
-
onAmountSubmitted?: (amount: number) => void;
|
|
70
|
-
/** User confirmed the deposit on the `ConfirmDeposit` step (wallet prompt is about to fire). */
|
|
71
|
-
onDepositConfirmed?: () => void;
|
|
72
|
-
/** User pressed Back on a non-root step. */
|
|
73
|
-
onBackPressed?: (fromStep: DepositStateName) => void;
|
|
74
|
-
/** Orchestrator requested a quote (`confirmDeposit` entered `loading` or `regenerating`). */
|
|
75
|
-
onQuoteRequested?: (input: {
|
|
76
|
-
asset: BalanceItemPayload;
|
|
77
|
-
amount: number;
|
|
78
|
-
}) => void;
|
|
79
|
-
/** Orchestrator received a successful quote — fires when the driver's `quote` entity transitions to `ready`. */
|
|
80
|
-
onQuoteResolved?: (quote: QuotePayload) => void;
|
|
81
|
-
/** Quote fetch failed (FSM `confirmDeposit{phase: failed, recoverFrom: "quote"}`). */
|
|
82
|
-
onQuoteFailed?: (failure: FailureInfo) => void;
|
|
83
|
-
/** A quote silently expired and a regeneration started (no user interaction). */
|
|
84
|
-
onQuoteExpired?: () => void;
|
|
85
|
-
/** Wallet broadcast a deposit tx; the orchestrator transitioned into `processing`. */
|
|
86
|
-
onDepositSubmitted?: (tx: TxRef) => void;
|
|
87
|
-
/** User declined the wallet signature prompt; orchestrator regenerated the quote. */
|
|
88
|
-
onSignatureDeclined?: () => void;
|
|
89
|
-
/** Deposit submission failed for a non-rejection reason. */
|
|
90
|
-
onSubmissionFailed?: (failure: FailureInfo) => void;
|
|
91
|
-
/** The driver's `settlement` entity emitted a progressive pending update. */
|
|
92
|
-
onProcessingProgress?: (update: SettlementPendingPayload) => void;
|
|
93
|
-
/** Terminal success — settlement entity reached `ready{kind: "succeeded"}`. */
|
|
94
|
-
onSucceeded?: (result: SettlementSuccessPayload) => void;
|
|
41
|
+
metadata?: Record<string, unknown>;
|
|
95
42
|
/**
|
|
96
|
-
*
|
|
97
|
-
*
|
|
43
|
+
* Forwarded to the dialog's internal `<Deposit.Boundary>` for crash reporting. The
|
|
44
|
+
* boundary's `onReset` is wired automatically through `useDeposit().close()`.
|
|
98
45
|
*/
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Background `fetchActiveSettlement` probe surfaced a pending deposit — the driver's
|
|
102
|
-
* `settlement` entity transitioned from `idle` / `loading` straight to a pending payload.
|
|
103
|
-
*/
|
|
104
|
-
onPendingSnapshotDetected?: (snapshot: SettlementPendingPayload) => void;
|
|
46
|
+
onError?: (error: Error, errorInfo: ErrorInfo) => void;
|
|
105
47
|
}
|
|
106
48
|
}
|
|
107
|
-
/** Convenience union — the `ctx` payload on `onStepChanged`. */
|
|
108
|
-
type GatewayContext = Exclude<DepositState, {
|
|
109
|
-
name: "closed";
|
|
110
|
-
}>["ctx"];
|
|
111
49
|
//#endregion
|
|
112
50
|
export { DepositDialog };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useDepositSnapshot as e}from"../driver/context.js";import{
|
|
1
|
+
"use client";import{useDepositSnapshot as e}from"../driver/context.js";import{useControllerContext as t}from"../orchestrator/controller.js";import{useDepositEmissions as n}from"../../../events/emit/useDepositEmissions.js";import"../../../events/emit/index.js";import{useIntercomShutdownOnUnmount as r}from"../../../shared/support/useIntercomShutdownOnUnmount.js";import"../../../shared/support/index.js";import{Dialog as i}from"../../../shared/ui/Dialog/Dialog.js";import"../../../shared/ui/Dialog/index.js";import{Deposit as a}from"../widgets/deposit/compound/Deposit.js";import"../widgets/deposit/compound/index.js";import{DepositHistoryDetail as o}from"../widgets/activity-history/DepositHistoryDetail.js";import{DepositHistoryList as s}from"../widgets/activity-history/DepositHistoryList.js";import"../widgets/activity-history/index.js";import{AmountEntry as c}from"../widgets/amount-entry/AmountEntry.js";import"../widgets/amount-entry/index.js";import{AssetPicker as l}from"../widgets/asset-picker/AssetPicker.js";import"../widgets/asset-picker/index.js";import{ConfirmDeposit as u}from"../widgets/confirm-deposit/ConfirmDeposit.js";import"../widgets/confirm-deposit/index.js";import{Deposit as d}from"../widgets/deposit/Deposit.js";import"../widgets/deposit/index.js";import{DepositStatusBanner as f}from"../widgets/deposit-status-banner/DepositStatusBanner.js";import"../widgets/deposit-status-banner/index.js";import{ErrorState as p}from"../widgets/error-state/ErrorState.js";import"../widgets/error-state/index.js";import{ProcessingState as m}from"../widgets/processing-state/ProcessingState.js";import"../widgets/processing-state/index.js";import{SuccessState as h}from"../widgets/success-state/SuccessState.js";import"../widgets/success-state/index.js";import{TransferCrypto as g}from"../widgets/transfer-crypto/TransferCrypto.js";import"../widgets/transfer-crypto/index.js";import{jsx as _,jsxs as v}from"react/jsx-runtime";function y({container:y,metadata:b,onError:x}={}){let{state:S,controller:C}=t(),w=e(),T=S.name!==`closed`;return n({state:S,settlement:w.settlement,quote:w.quote,metadata:b}),r(),_(i,{open:T,onOpenChange:e=>{e||C.close()},children:_(i.Content,{container:y,children:v(a.Boundary,{...x?{onError:x}:{},children:[_(a.Guards,{children:v(a.Steps,{children:[_(a.Step,{name:`deposit`,children:_(d,{})}),_(a.Step,{name:`assetPicker`,children:_(l,{})}),_(a.Step,{name:`amountEntry`,children:_(c,{})}),_(a.Step,{name:`confirmDeposit`,children:_(u,{})}),_(a.Step,{name:`transferCrypto`,children:_(g,{})}),_(a.Step,{name:`processing`,children:_(m,{})}),_(a.Step,{name:`success`,children:_(h,{})}),_(a.Step,{name:`error`,children:_(p,{})}),_(a.Step,{name:`historyList`,children:_(s,{})}),_(a.Step,{name:`historyDetail`,children:_(o,{})})]})}),_(f,{})]})})})}export{y as DepositDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{Trans as e}from"../../../shared/i18n/Trans.js";import"../../../i18n/index.js";import{useDepositActions as t}from"../orchestrator/controller.js";import{WalletIcon as n}from"../../../shared/icons/WalletIcon.js";import"../../../icons/index.js";import{useConnectWallet as r}from"../../../shared/wallet/ConnectWalletContext.js";import{Button as i}from"../../../shared/ui/Button/Button.js";import{Dialog as a}from"../../../shared/ui/Dialog/Dialog.js";import"../../../shared/ui/Dialog/index.js";import{Card as o}from"../../../shared/ui/Card/Card.js";import{text as s}from"../../../shared/ui/Text/Text.js";import"../../../ui/index.js";import{Frame as c}from"../../../shared/dialog/Frame.js";import{styles as l}from"./WalletRequiredState.styles.js";import{jsx as u,jsxs as d}from"react/jsx-runtime";import*as f from"@stylexjs/stylex";function p(){return d(`div`,{"aria-hidden":!0,...f.props(l.heroRing),children:[d(`svg`,{viewBox:`0 0 64 64`,xmlns:`http://www.w3.org/2000/svg`,fill:`none`,...f.props(l.heroRingSvg),children:[u(`circle`,{cx:`32`,cy:`32`,r:`28`,strokeWidth:`2`,style:{stroke:`color-mix(in oklab, var(--stridge-kit-info) 55%, transparent)`}}),u(`circle`,{cx:`32`,cy:`32`,r:`20`,style:{fill:`var(--stridge-kit-info)`}})]}),u(n,{style:{color:`var(--stridge-kit-info-foreground)`},...f.props(l.heroRingGlyph)})]})}function m(){let{close:n}=t(),m=r();return d(c,{"data-stridge-slot":`deposit-wallet-required`,"data-testid":`deposit-wallet-required`,...f.props(l.root),children:[d(o.Header,{...f.props(l.header),children:[u(s.span,{size:`base`,fontWeight:`semibold`,leading:`tight`,tracking:`tight`,children:u(e,{id:`5AApJw`,message:`Connect a wallet to continue`})}),u(a.CloseButton,{})]}),u(o.Body,{children:d(`div`,{"data-stridge-slot":`deposit-wallet-required-hero`,...f.props(l.hero),children:[u(p,{}),u(s.span,{size:`lg`,fontWeight:`semibold`,leading:`tight`,tracking:`tight`,align:`center`,...f.props(l.heroHeadline),children:u(e,{id:`BoQOH3`,message:`A wallet is required to deposit`})}),u(s.span,{size:`sm`,leading:`normal`,align:`center`,color:`subdued`,...f.props(l.heroReason),children:u(e,{id:`mF_ucv`,message:`Connect a wallet so the gateway can provision a deposit address and route your transfer.`})})]})}),d(o.Footer,{...f.props(l.footer),children:[m?u(i,{variant:`default`,size:`cta`,onClick:()=>{m.onClick()},"data-stridge-slot":`deposit-wallet-required-connect`,...f.props(l.cta),children:m.label??u(e,{id:`VHOVEJ`,message:`Connect wallet`})}):null,u(i,{variant:m?`ghost`:`default`,size:`cta`,onClick:n,"data-stridge-slot":`deposit-wallet-required-close`,...f.props(l.cta),children:u(e,{id:`yz7wBu`,message:`Close`})})]})]})}export{m as WalletRequiredState};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e={root:{"WalletRequiredState__styles.root":`WalletRequiredState__styles.root`,"position-kVAEAm":`x1n2onr6`,"width-kzqmXN":`xh8yej3`,"maxWidth-ks0D6T":`x17fpy1y`,$$css:`@stridge/kit:src/flows/deposit/dialog/WalletRequiredState.styles.ts:25`},header:{"WalletRequiredState__styles.header":`WalletRequiredState__styles.header`,"justifyContent-kjj79g":`x1qughib`,$$css:`@stridge/kit:src/flows/deposit/dialog/WalletRequiredState.styles.ts:34`},hero:{"WalletRequiredState__styles.hero":`WalletRequiredState__styles.hero`,"display-k1xSpc":`x78zum5`,"flexDirection-kXwgrk":`xdt5ytf`,"alignItems-kGNEyG":`x6s0dn4`,"gap-kOIVth":`x883omv`,"paddingTop-kLKAdn":`x9desvi`,"paddingInline-kg3NbH":`x65v0h`,"paddingBottom-kGO01o":`x1hhzuzn`,"animationName-kKVMdj":`xv305lp`,"animationDuration-k44tkh":`xmprevt x1s1fvk8`,"animationTimingFunction-kyAemX":`xrkt6z0`,"animationFillMode-kWV6AL":`x1u6ievf`,$$css:`@stridge/kit:src/flows/deposit/dialog/WalletRequiredState.styles.ts:42`},heroRing:{"WalletRequiredState__styles.heroRing":`WalletRequiredState__styles.heroRing`,"position-kVAEAm":`x1n2onr6`,"width-kzqmXN":`x1fu8urw`,"height-kZKoxP":`x1peatla`,"flexShrink-kmuXW":`x2lah0s`,$$css:`@stridge/kit:src/flows/deposit/dialog/WalletRequiredState.styles.ts:64`},heroRingSvg:{"WalletRequiredState__styles.heroRingSvg":`WalletRequiredState__styles.heroRingSvg`,"display-k1xSpc":`x1lliihq`,"width-kzqmXN":`xh8yej3`,"height-kZKoxP":`x5yr21d`,$$css:`@stridge/kit:src/flows/deposit/dialog/WalletRequiredState.styles.ts:73`},heroRingGlyph:{"WalletRequiredState__styles.heroRingGlyph":`WalletRequiredState__styles.heroRingGlyph`,"position-kVAEAm":`x10l6tqk`,"insetInlineStart-kLqNvP":`xbudbmw`,"top-k87sOh":`xwa60dl`,"transform-k3aq6I":`x11lhmoz`,"width-kzqmXN":`xgd8bvy`,"height-kZKoxP":`x1fgtraw`,"strokeWidth-kfJifR":`xvlca1e`,$$css:`@stridge/kit:src/flows/deposit/dialog/WalletRequiredState.styles.ts:87`},heroHeadline:{"WalletRequiredState__styles.heroHeadline":`WalletRequiredState__styles.heroHeadline`,"marginTop-keoZOQ":`x1k70j0n`,$$css:`@stridge/kit:src/flows/deposit/dialog/WalletRequiredState.styles.ts:96`},heroReason:{"WalletRequiredState__styles.heroReason":`WalletRequiredState__styles.heroReason`,"maxWidth-ks0D6T":`x1va8c73`,$$css:`@stridge/kit:src/flows/deposit/dialog/WalletRequiredState.styles.ts:99`},footer:{"WalletRequiredState__styles.footer":`WalletRequiredState__styles.footer`,"display-k1xSpc":`x78zum5`,"flexDirection-kXwgrk":`xdt5ytf`,"alignItems-kGNEyG":`x1qjc9v5`,"gap-kOIVth":`x1a6yh9e`,"paddingTop-kLKAdn":`x109j2v6`,"paddingInline-kg3NbH":`x65v0h`,"paddingBottom-kGO01o":`x1t4gjm`,$$css:`@stridge/kit:src/flows/deposit/dialog/WalletRequiredState.styles.ts:107`},cta:{"WalletRequiredState__styles.cta":`WalletRequiredState__styles.cta`,"width-kzqmXN":`xh8yej3`,"alignSelf-kSGwAc":`xkh2ocl`,$$css:`@stridge/kit:src/flows/deposit/dialog/WalletRequiredState.styles.ts:116`}};export{e as styles};
|
|
@@ -95,7 +95,13 @@ interface AssetPayload {
|
|
|
95
95
|
*/
|
|
96
96
|
interface TargetPayload extends ChainPayload, AssetPayload {
|
|
97
97
|
/** Optional minimum-deposit USD floor surfaced on amount-entry / asset-picker chrome. */
|
|
98
|
-
|
|
98
|
+
minAmountUsd?: FormattedField<number>;
|
|
99
|
+
/**
|
|
100
|
+
* Optional upper USD bound on the deposit amount. When set, the amount-entry treats
|
|
101
|
+
* `min(walletBalanceUsd, maxAmountUsd.value)` as the effective ceiling. Omitted when the
|
|
102
|
+
* host did not configure `flows.deposit.maxAmountUsd`.
|
|
103
|
+
*/
|
|
104
|
+
maxAmountUsd?: FormattedField<number>;
|
|
99
105
|
}
|
|
100
106
|
/**
|
|
101
107
|
* Per-chain deposit address provisioned by `gateway/start`. The kit ships one envelope item per
|
|
@@ -111,9 +117,9 @@ interface AddressItemPayload extends ChainPayload {
|
|
|
111
117
|
* Per-chain minimum-deposit USD floor surfaced next to the chain row in the transfer-crypto
|
|
112
118
|
* picker (`"Min $5"`). Drivers populate this from `supportedAssets`'s per-(chain × asset)
|
|
113
119
|
* floors so the user sees the right number for the chain they're funding from. Optional —
|
|
114
|
-
* the picker falls back to {@link TargetPayload.
|
|
120
|
+
* the picker falls back to {@link TargetPayload.minAmountUsd} when this isn't available.
|
|
115
121
|
*/
|
|
116
|
-
|
|
122
|
+
minAmountUsd?: FormattedField<number>;
|
|
117
123
|
/**
|
|
118
124
|
* Tokens the gateway accepts on this chain (`gateway/start.deposit_addresses[i].accepted_assets`).
|
|
119
125
|
* Drives the transfer-crypto Tokens dropdown — when the user picks a chain, the dropdown
|
|
@@ -140,6 +146,13 @@ interface AcceptedAssetPayload {
|
|
|
140
146
|
assetLogoUrl?: string;
|
|
141
147
|
/** True for the chain's native gas token (synthesized from an empty `address`). */
|
|
142
148
|
isNative: boolean;
|
|
149
|
+
/**
|
|
150
|
+
* Estimated price impact of depositing this asset, as a percentage decimal string
|
|
151
|
+
* (`"0.5"`, `"1.25"`). Joined from the `gateway/assets` catalog by (chain × contract address)
|
|
152
|
+
* — the wire's `accepted_assets` doesn't carry it. Drives the price-impact hint on the
|
|
153
|
+
* transfer-crypto disclosure row. Omitted when the catalog has no estimate for this asset.
|
|
154
|
+
*/
|
|
155
|
+
priceImpact?: string;
|
|
143
156
|
}
|
|
144
157
|
/**
|
|
145
158
|
* Source-side per-asset balance — what the connected wallet holds across supported chains. Drives
|
|
@@ -154,7 +167,7 @@ interface BalanceItemPayload extends ChainPayload, AssetPayload {
|
|
|
154
167
|
priceUsd?: number;
|
|
155
168
|
/**
|
|
156
169
|
* `true` when this row's USD value is below the kit's deposit floor
|
|
157
|
-
* ({@link TargetPayload.
|
|
170
|
+
* ({@link TargetPayload.minAmountUsd}). Drives the muted "Low Balance" badge in the asset
|
|
158
171
|
* picker; the row remains visible so the user knows the asset exists in the wallet.
|
|
159
172
|
*/
|
|
160
173
|
lowBalance?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{parseDecimalSafe as e}from"../../../shared/transformers/parseSmallestUnit.js";import{formatTokenAmount as t}from"../../../../shared/format/formatTokenAmount.js";import{formatUsd as n}from"../../../../shared/format/formatUsd.js";function r(e){let t=new Set,n=new Set;for(let r of e.assets){let e=String(r.eip155_id);t.add(e);for(let t of r.assets)t.address&&n.add(`${e}:${t.address.toLowerCase()}`)}return{nativeChains:t,tokens:n}}function i(e,t){let n=t.routable!==void 0&&(t.routable.nativeChains.size>0||t.routable.tokens.size>0),r=[];for(let i of e.chains)for(let e of i.tokens)e.is_spam||n&&t.routable&&!o(i.eip155_id,e,t.routable)||r.push(a(i.label,i.eip155_id,i.stridge_network_id,e,t));return r.sort(s),r}function a(r,i,a,o,s){let c=e(o.amount),l=e(o.amount_usd),u=e(o.usd_price),d=s.resolveTokenIcon?.({chainId:i,tokenAddress:o.token_address,symbol:o.symbol,isNative:o.is_native})??s.logos?.(i,o.token_address,o.is_native)??o.logo??void 0,f=s.
|
|
1
|
+
import{parseDecimalSafe as e}from"../../../shared/transformers/parseSmallestUnit.js";import{formatTokenAmount as t}from"../../../../shared/format/formatTokenAmount.js";import{formatUsd as n}from"../../../../shared/format/formatUsd.js";function r(e){let t=new Set,n=new Set;for(let r of e.assets){let e=String(r.eip155_id);t.add(e);for(let t of r.assets)t.address&&n.add(`${e}:${t.address.toLowerCase()}`)}return{nativeChains:t,tokens:n}}function i(e,t){let n=t.routable!==void 0&&(t.routable.nativeChains.size>0||t.routable.tokens.size>0),r=[];for(let i of e.chains)for(let e of i.tokens)e.is_spam||n&&t.routable&&!o(i.eip155_id,e,t.routable)||r.push(a(i.label,i.eip155_id,i.stridge_network_id,e,t));return r.sort(s),r}function a(r,i,a,o,s){let c=e(o.amount),l=e(o.amount_usd),u=e(o.usd_price),d=s.resolveTokenIcon?.({chainId:i,tokenAddress:o.token_address,symbol:o.symbol,isNative:o.is_native})??s.logos?.(i,o.token_address,o.is_native)??o.logo??void 0,f=s.minAmountUsd!==void 0&&s.minAmountUsd>0&&l<s.minAmountUsd;return{networkId:a,networkName:r,eip155Id:String(i),symbol:o.symbol,decimals:o.decimals,address:o.token_address||`0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee`,isNative:o.is_native,...d?{assetLogoUrl:d}:{},amount:{value:c,formatted:t(c,s.i18n,{compact:!0})},...l>0?{amountUsd:{value:l,formatted:n(l,s.i18n)}}:{},...u>0?{priceUsd:u}:{},...f?{lowBalance:!0,disabled:!0}:{}}}function o(e,t,n){let r=String(e);return t.is_native?n.nativeChains.has(r):t.token_address?n.tokens.has(`${r}:${t.token_address.toLowerCase()}`):!1}function s(e,t){return(t.amountUsd?.value??0)-(e.amountUsd?.value??0)}export{i as balanceToBalancesPayload,r as buildRoutableAllowlist};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { SettlementPayloadContext } from "./settlementToPayload.js";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { I18n } from "@lingui/core";
|
|
2
|
+
import { GatewaySettlementDto, GatewayUdaDto } from "@stridge/sdk";
|
|
3
|
+
|
|
4
|
+
//#region src/flows/deposit/driver/transformers/settlementToPayload.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Inputs the {@link settlementToPayload} transformer needs from the driver. The driver carries
|
|
7
|
+
* connected-wallet metadata and explorer info; the transformer composes the per-leg URLs and
|
|
8
|
+
* shortened address forms that the widget renders.
|
|
9
|
+
*/
|
|
10
|
+
interface SettlementPayloadContext {
|
|
11
|
+
/** Lingui i18n instance — drives every formatter call. */
|
|
12
|
+
i18n: I18n;
|
|
13
|
+
/** Connected wallet's source-side metadata — name + address (full hex). */
|
|
14
|
+
sourceWallet: {
|
|
15
|
+
name?: string;
|
|
16
|
+
address: string;
|
|
17
|
+
explorerUrl?: string;
|
|
18
|
+
};
|
|
19
|
+
/** Per-EIP-155 block-explorer base URLs (e.g. `{ 1: "https://etherscan.io" }`). */
|
|
20
|
+
explorers?: Record<number, string>;
|
|
21
|
+
/** Optional brand label rendered in place of the destination address (`gateway/start.metadata.brand_name`). */
|
|
22
|
+
brandName?: string;
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { SettlementPayloadContext };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{KNOWN_TESTNET_EIP155_IDS as e}from"../../../shared/transformers/testnets.js";import{formatNetworkName as t}from"../../../../shared/format/formatNetworkName.js";import{formatUsd as n}from"../../../../shared/format/formatUsd.js";import{shortenAddress as r}from"../../../../shared/format/shortenAddress.js";function i(i,o={}){let s=o.includeTestnets??!1;return i.flatMap(i=>{let c=String(i.eip155_id??``),l=Number(c);if(!s&&Number.isFinite(l)&&e.has(l))return[];let u=o.explorers?.[l],d=o.i18n&&c?o.minAmountUsdByEip155Id?.[c]:void 0,f=a(i.accepted_assets,c?o.nativeAssetByEip155Id?.[c]:void 0,c?o.priceImpactByEip155Id?.[c]:void 0);return[{networkName:t(i.network_name??``),...c?{eip155Id:c}:{},...o.chainLogos?.[c]?{chainLogoUrl:o.chainLogos[c]}:{},address:{value:i.address,formatted:r(i.address)},...u?{explorerUrl:`${u.replace(/\/+$/,``)}/address/${i.address}`}:{},...d!==void 0&&o.i18n?{minAmountUsd:{value:d,formatted:n(d,o.i18n)}}:{},...f.length>0?{acceptedAssets:f}:{}}]})}function a(e,t,n){let r=Array.isArray(e)?e.map(e=>o(e,n)):[];if(!t)return r;let i=r.findIndex(e=>e.symbol.toUpperCase()===t.symbol.toUpperCase());if(i>=0){let e=r[i];return e&&!e.priceImpact&&t.priceImpact&&(r[i]={...e,priceImpact:t.priceImpact}),r}return[t,...r]}function o(e,t){let n=e.logo,r=!e.address,i=e.address?t?.[e.address.toLowerCase()]:void 0;return{symbol:e.symbol,address:e.address,decimals:e.decimals,...typeof n==`string`&&n.length>0?{assetLogoUrl:n}:{},isNative:r,...i?{priceImpact:i}:{}}}export{i as startToAddressesPayload};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { GatewayStartResponse } from "@stridge/sdk";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{formatNetworkName as e}from"../../../../shared/format/formatNetworkName.js";import{formatUsd as t}from"../../../../shared/format/formatUsd.js";function n(n,r){let i=n.assets.find(e=>String(e.network_id)===r.networkId);if(!i)return;let a=i.assets.find(e=>e.symbol.toUpperCase()===r.assetSymbol.toUpperCase());if(!a)return;let o=i.native_currency?.logo;return{networkId:r.networkId,networkName:e(i.network_name),eip155Id:String(i.eip155_id),...o?{chainLogoUrl:o}:{},symbol:a.symbol,decimals:a.decimals,address:a.address??``,isNative:!a.address,...a.logo?{assetLogoUrl:a.logo}:{},...r.
|
|
1
|
+
import{formatNetworkName as e}from"../../../../shared/format/formatNetworkName.js";import{formatUsd as t}from"../../../../shared/format/formatUsd.js";function n(n,r){let i=n.assets.find(e=>String(e.network_id)===r.networkId);if(!i)return;let a=i.assets.find(e=>e.symbol.toUpperCase()===r.assetSymbol.toUpperCase());if(!a)return;let o=i.native_currency?.logo;return{networkId:r.networkId,networkName:e(i.network_name),eip155Id:String(i.eip155_id),...o?{chainLogoUrl:o}:{},symbol:a.symbol,decimals:a.decimals,address:a.address??``,isNative:!a.address,...a.logo?{assetLogoUrl:a.logo}:{},...r.minAmountUsd===void 0?{}:{minAmountUsd:{value:r.minAmountUsd,formatted:t(r.minAmountUsd,r.i18n)}},...r.maxAmountUsd===void 0?{}:{maxAmountUsd:{value:r.maxAmountUsd,formatted:t(r.maxAmountUsd,r.i18n)}}}}export{n as startToTargetPayload};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Entity, SettlementFailureKind, TxRef } from "../../../shared/driver/types.js";
|
|
2
|
+
import { ActivityHistoryPayload } from "../../../shared/widgets/activity-history/payloads.js";
|
|
2
3
|
import { AcceptedAssetPayload, AddressItemPayload, AssetPayload, BalanceItemPayload, BrandPayload, ChainPayload, QuoteBreakdownPayload, QuotePayload, QuoteRoutePayload, SettlementFailurePayload, SettlementPayload, SettlementPendingPayload, SettlementSuccessPayload, SourceWalletPayload, TargetPayload, WalletInfo, WalletPayload } from "./payloads.js";
|
|
3
|
-
import { DepositAddressDto, GatewayPollResponse, GatewaySettlementDto, GatewayStartResponse, OnchainBalanceResponse, QuoteResponse, SupportedAssetDto, SupportedAssetsResponse } from "@stridge/sdk";
|
|
4
|
+
import { DepositAddressDto, GatewayPollResponse, GatewaySettlementDto, GatewayStartResponse, GatewayUdaDto, OnchainBalanceResponse, QuoteResponse, SupportedAssetDto, SupportedAssetsResponse } from "@stridge/sdk";
|
|
4
5
|
|
|
5
6
|
//#region src/flows/deposit/driver/types.d.ts
|
|
6
7
|
/**
|
|
@@ -39,7 +40,7 @@ interface DepositSnapshot {
|
|
|
39
40
|
* the payload (`pending` / `succeeded` / `failed`) drives whether `<ProcessingState>`,
|
|
40
41
|
* `<SuccessState>`, or `<ErrorState>` is shown.
|
|
41
42
|
*/
|
|
42
|
-
settlement: Entity<SettlementPayload, GatewaySettlementDto,
|
|
43
|
+
settlement: Entity<SettlementPayload, GatewaySettlementDto, GatewayUdaDto>;
|
|
43
44
|
/**
|
|
44
45
|
* Connected-wallet identity. `idle` when no wallet is connected; `ready` once the host has
|
|
45
46
|
* supplied an address. The `payload.address.formatted` field is the canonical
|
|
@@ -47,6 +48,20 @@ interface DepositSnapshot {
|
|
|
47
48
|
* settlement (deposit-method tile, amount-entry source pill, banner disconnected-state copy).
|
|
48
49
|
*/
|
|
49
50
|
wallet: Entity<WalletPayload, WalletInfo, WalletInfo>;
|
|
51
|
+
/**
|
|
52
|
+
* Owner-scoped recent activity. Backed by the multi-UDA envelope from `GET /gateway/{owner}`
|
|
53
|
+
* fetched without a destination filter, so the list spans both deposit-direction and
|
|
54
|
+
* withdraw-direction settlements for the connected owner. Drives the kit's in-dialog
|
|
55
|
+
* `<ActivityHistory>` surface. `idle` when no fetch has run yet; `loading` during the first
|
|
56
|
+
* fetch; `ready` / `stale` once a list has landed; `error` when the initial fetch failed and
|
|
57
|
+
* the list is empty.
|
|
58
|
+
*
|
|
59
|
+
* The entity's `raw` slot is the array of UDAs from the envelope — the detail view walks
|
|
60
|
+
* `raw[].settlements[]` to locate a settlement by id and feeds it back through
|
|
61
|
+
* {@link import("./transformers").settlementToPayload} to render full success / error /
|
|
62
|
+
* processing widgets at display time.
|
|
63
|
+
*/
|
|
64
|
+
history: Entity<ActivityHistoryPayload, ReadonlyArray<GatewayUdaDto>, GatewayPollResponse>;
|
|
50
65
|
}
|
|
51
66
|
/**
|
|
52
67
|
* Input to {@link DepositDriver.requestQuote}.
|
|
@@ -107,7 +122,7 @@ type FetchActiveSettlementInput = Record<string, never>;
|
|
|
107
122
|
interface SettlementSnapshot {
|
|
108
123
|
payload: SettlementPayload;
|
|
109
124
|
raw: GatewaySettlementDto;
|
|
110
|
-
response:
|
|
125
|
+
response: GatewayUdaDto;
|
|
111
126
|
}
|
|
112
127
|
/**
|
|
113
128
|
* Unified driver contract. A `DepositDriver` is the single host-supplied source of both reactive
|
|
@@ -139,6 +154,17 @@ interface DepositDriver {
|
|
|
139
154
|
getSnapshot(): DepositSnapshot;
|
|
140
155
|
/** Lets you subscribe to entity transitions outside React (analytics, headless integrations). */
|
|
141
156
|
subscribe(listener: () => void): () => void;
|
|
157
|
+
/**
|
|
158
|
+
* Idempotent bootstrap trigger. The kit calls this from `useDeposit().open()` and the
|
|
159
|
+
* headless `usePrefetchDeposit()` hook. First call kicks off any deferred network work
|
|
160
|
+
* (`gateway/start`, `supportedAssets`, the initial `balance/onchain` fetch); subsequent
|
|
161
|
+
* calls are no-ops while bootstrap is in flight or completed.
|
|
162
|
+
*
|
|
163
|
+
* BYO drivers that bootstrap eagerly can implement this as a no-op — the contract is "after
|
|
164
|
+
* `arm()` returns, the driver's entities are either already populated or will populate as
|
|
165
|
+
* soon as the first network round-trips land".
|
|
166
|
+
*/
|
|
167
|
+
arm(): void;
|
|
142
168
|
/**
|
|
143
169
|
* Fetches a fresh quote for `input` and updates the `quote` entity through its lifecycle
|
|
144
170
|
* (`idle | loading → ready | error`). The optional `signal` cancels in-flight work.
|
|
@@ -154,6 +180,19 @@ interface DepositDriver {
|
|
|
154
180
|
* — when omitted, the asset-picker hides its USD-balance overlay.
|
|
155
181
|
*/
|
|
156
182
|
watchBalances?(input: Record<string, never>, listener: (entity: DepositSnapshot["balances"]) => void, signal: AbortSignal): void;
|
|
183
|
+
/**
|
|
184
|
+
* Invalidate any cached `balances` and force the driver to fetch fresh on its next tick. The
|
|
185
|
+
* orchestrator calls this after `submitDeposit` resolves and on every `settlement` kind
|
|
186
|
+
* transition (`pending` / `succeeded` / `failed`) so the user never advances on stale
|
|
187
|
+
* source-chain balance numbers — the `balance/onchain` SWR window otherwise hides the
|
|
188
|
+
* just-sent funds until it elapses.
|
|
189
|
+
*
|
|
190
|
+
* Drivers that do not cache balances (no SWR layer, no in-memory snapshot) can omit this; the
|
|
191
|
+
* kit calls it via optional chaining. When implemented, drivers should both invalidate the
|
|
192
|
+
* cache stamp and kick off an immediate refetch so `useDepositSnapshot().balances` reflects
|
|
193
|
+
* post-deposit reality without waiting for the next scheduled watcher tick.
|
|
194
|
+
*/
|
|
195
|
+
invalidateBalances?(): void;
|
|
157
196
|
/**
|
|
158
197
|
* Path B watcher — observes the deposit address until an inbound source-chain tx is detected,
|
|
159
198
|
* then fires the listener with the {@link TxRef}. Optional — when omitted, the orchestrator
|
|
@@ -172,6 +211,28 @@ interface DepositDriver {
|
|
|
172
211
|
* method picker.
|
|
173
212
|
*/
|
|
174
213
|
fetchActiveSettlement?(input: FetchActiveSettlementInput, signal: AbortSignal): Promise<SettlementSnapshot | null>;
|
|
214
|
+
/**
|
|
215
|
+
* Owner-scoped activity refresh. Calls `GET /gateway/{owner}` without a destination tuple,
|
|
216
|
+
* collapses the multi-UDA envelope into a row payload, and updates {@link
|
|
217
|
+
* DepositSnapshot.history} in place (transitioning `idle → loading → ready`, or
|
|
218
|
+
* `ready → stale → ready` for refreshes). Used as the imperative one-shot trigger — the
|
|
219
|
+
* activity surface's error-view retry button calls this. Steady-state recurring fetches
|
|
220
|
+
* land via {@link watchHistory}. Optional — drivers that don't have a multi-UDA history
|
|
221
|
+
* concept can omit it, in which case the activity header icon is hidden.
|
|
222
|
+
*/
|
|
223
|
+
refreshHistory?(signal: AbortSignal): void;
|
|
224
|
+
/**
|
|
225
|
+
* Long-running adaptive poll of `GET /gateway/{owner}` (unfiltered). Updates
|
|
226
|
+
* {@link DepositSnapshot.history} in place every tick. Cadence adapts to the
|
|
227
|
+
* current payload — short interval while any row is `pending`, long interval
|
|
228
|
+
* once all rows are terminal. Mounted by the controller while the FSM is on
|
|
229
|
+
* `history`; aborted on transition out.
|
|
230
|
+
*
|
|
231
|
+
* Optional — drivers that don't have a multi-UDA history concept can omit
|
|
232
|
+
* it. When omitted alongside {@link refreshHistory}, the activity surface
|
|
233
|
+
* stays cold (only the initial paint, no live updates).
|
|
234
|
+
*/
|
|
235
|
+
watchHistory?(signal: AbortSignal): void;
|
|
175
236
|
}
|
|
176
237
|
//#endregion
|
|
177
238
|
export { DepositDriver, DepositSnapshot, FetchActiveSettlementInput, RequestQuoteInput, SettlementSnapshot, SubmitDepositInput, WatchSettlementInput, WatchSourceTxInput };
|
|
@@ -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
|
|
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 d(b)}const C=u(void 0);C.displayName=`DepositMethodsConfigContext`;function w(){return d(C)}function T(){return x().state}function E(){return x().effectiveState}function D(){return x().actions}function O({methodsConfig:t,children:n}){let r=e(),[a,o]=h(c,s),l=A(a,o,r);j(a,o,r),M(a,o,r);let u=i(a),d=k(a,o,r,l,t);return _(C,{value:t,children:_(b,{value:m(()=>({state:a,effectiveState:u,dispatch:o,controller:d,actions:l}),[a,u,d,l]),children:n})})}function k(e,t,n,r,i){let a=g(n);a.current=n;let o=g(i);o.current=i;let s=f(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=l(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=f(()=>{t({type:`CLOSE`})},[t]);return m(()=>({open:s,close:c,actions:r}),[s,c,r])}function A(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=P(e,t);r.submitDeposit(o,i.signal).then(e=>{if(!i.signal.aborted){try{r.invalidateBalances?.()}catch{}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}:{}})},[]),O=f(()=>{let e=o.current;e.name!==`deposit`&&e.name!==`assetPicker`&&e.name!==`amountEntry`&&e.name!==`transferCrypto`||c.current({type:`OPEN_HISTORY`})},[]),k=f(e=>{c.current({type:`SELECT_SETTLEMENT`,settlementId:e})},[]);return m(()=>({selectMethod:p,confirmAsset:h,confirmAmount:_,confirmDeposit:b,back:x,close:S,successDone:C,tryAgain:w,resumeToProcessing:T,resumeToSuccess:E,resumeToError:D,openHistory:O,selectSettlement:k}),[p,h,_,b,x,S,C,w,T,E,D,O,k])}function j(e,t,r){p(()=>{if(e.name!==`confirmDeposit`||e.ctx.phase.kind!==`loading`&&e.ctx.phase.kind!==`regenerating`)return;let i=new AbortController,a=N(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 M(e,t,n){let i=e.name===`processing`?e.ctx.tx:void 0;o(n,i?{tx:i}:void 0,i?.hash),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]);let a=e.name===`historyList`||e.name===`historyDetail`;p(()=>{if(!a||!n.watchHistory)return;let e=new AbortController;return n.watchHistory(e.signal),()=>e.abort()},[a,n]),p(()=>{if(e.name===`closed`||e.name===`transferCrypto`||e.name===`processing`||a||!n.fetchActiveSettlement)return;let t=new AbortController,r,i,o=!1,s=async()=>{try{let e=await n.fetchActiveSettlement({},t.signal);if(o)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{}o||(i=setTimeout(s,5e3))};return s(),()=>{o=!0,t.abort(),r?.abort(),i&&clearTimeout(i)}},[e.name,a,n]);let s=g(e);s.current=e,r(n,e=>{if(e===`pending`||e===`succeeded`||e===`failed`)try{n.invalidateBalances?.()}catch{}s.current.name===`processing`&&(e===`succeeded`?t({type:`PROCESSING_SUCCEEDED`}):e===`failed`&&t({type:`PROCESSING_FAILED`}))});let c=g(null);p(()=>{let e=()=>{let e=n.getSnapshot(),r=s.current,i=e.quote;i.status!==c.current&&(c.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}}))},r=n.subscribe(e);return e(),r},[n,t])}function N(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 P(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{O as GatewayController,x as useControllerContext,D as useDepositActions,E as useDepositEffectiveState,w as useDepositMethodsConfig,T as useDepositState,S as useOptionalControllerContext};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e={name:`closed`};function t(e,t){if(t.type===`RESUME_TO_PROCESSING`)return e.name===`closed`?e:{name:`processing`,ctx:{method:t.method,tx:t.tx,retryTargetForFailure:{kind:`fresh`}}};if(t.type===`RESUME_TO_SUCCESS`)return e.name===`closed`?e:{name:`success`,ctx:{method:t.method,tx:t.tx}};if(t.type===`RESUME_TO_ERROR`)return e.name===`closed`?e:{name:`error`,ctx:{retryTarget:{kind:`fresh`},...t.tx?{tx:t.tx}:{}}};switch(e.name){case`closed`:return n(t);case`deposit`:return r(e,t);case`assetPicker`:return i(e,t);case`amountEntry`:return a(e,t);case`confirmDeposit`:return o(e,t);case`transferCrypto`:return s(e,t);case`processing`:return c(e,t);case`success`:return l(e,t);case`error`:return u(e,t);default:return
|
|
1
|
+
const e={name:`closed`};function t(e,t){if(t.type===`RESUME_TO_PROCESSING`)return e.name===`closed`?e:{name:`processing`,ctx:{method:t.method,tx:t.tx,retryTargetForFailure:{kind:`fresh`}}};if(t.type===`RESUME_TO_SUCCESS`)return e.name===`closed`?e:{name:`success`,ctx:{method:t.method,tx:t.tx}};if(t.type===`RESUME_TO_ERROR`)return e.name===`closed`?e:{name:`error`,ctx:{retryTarget:{kind:`fresh`},...t.tx?{tx:t.tx}:{}}};switch(e.name){case`closed`:return n(t);case`deposit`:return r(e,t);case`assetPicker`:return i(e,t);case`amountEntry`:return a(e,t);case`confirmDeposit`:return o(e,t);case`transferCrypto`:return s(e,t);case`processing`:return c(e,t);case`success`:return l(e,t);case`error`:return u(e,t);case`historyList`:return d(e,t);case`historyDetail`:return f(e,t);default:return h(e)}}function n(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 r(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`OPEN_HISTORY`:return{name:`historyList`,ctx:{backTarget:{kind:`deposit`,backTarget:`closed`}}};case`BACK`:case`CLOSE`:return{name:`closed`};default:return e}}function i(e,t){switch(t.type){case`ASSET_CONFIRMED`:return{name:`amountEntry`,ctx:{method:`wallet`,asset:t.asset,backTarget:`assetPicker`}};case`OPEN_HISTORY`:return{name:`historyList`,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 a(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_HISTORY`:return{name:`historyList`,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 o(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 s(e,t){switch(t.type){case`OPEN_HISTORY`:return{name:`historyList`,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 c(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 l(e,t){return t.type===`SUCCESS_DONE`||t.type===`CLOSE`?{name:`closed`}:e}function u(e,t){return t.type===`ERROR_TRY_AGAIN`?m(e.ctx.retryTarget):t.type===`CLOSE`?{name:`closed`}:e}function d(e,t){switch(t.type){case`SELECT_SETTLEMENT`:return{name:`historyDetail`,ctx:{settlementId:t.settlementId,backTarget:e.ctx.backTarget}};case`BACK`:return p(e.ctx.backTarget);case`CLOSE`:return{name:`closed`};default:return e}}function f(e,t){switch(t.type){case`BACK`:return{name:`historyList`,ctx:{backTarget:e.ctx.backTarget}};case`CLOSE`:return{name:`closed`};default:return e}}function p(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 m(e){return e.kind===`fresh`?{name:`deposit`,ctx:{backTarget:`closed`}}: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`}}}function h(e){throw Error(`Unhandled state: ${JSON.stringify(e)}`)}export{e as initialState,t as reducer};
|