@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,4 +1,5 @@
|
|
|
1
1
|
import { Entity, SettlementFailureKind, TxRef } from "../../../shared/driver/types.js";
|
|
2
|
+
import { FormattedField } from "../../../shared/format/types.js";
|
|
2
3
|
import { ReceiveOptionDto, ReceiveOptionsResponse, WithdrawableBalanceDto, WithdrawableBalancesResponse, WithdrawalQuoteDto, WithdrawalQuoteResponse, WithdrawalSettlementDto, WithdrawalSettlementResponse } from "./dto.js";
|
|
3
4
|
import { ReceiveChainPayload, ReceiveTokenOptionPayload, WithdrawableBalanceItemPayload, WithdrawalQuoteBreakdownPayload, WithdrawalQuotePayload, WithdrawalReceiveAssetPayload, WithdrawalSettlementFailurePayload, WithdrawalSettlementPayload, WithdrawalSettlementPendingPayload, WithdrawalSettlementSuccessPayload } from "./payloads.js";
|
|
4
5
|
|
|
@@ -8,8 +9,9 @@ import { ReceiveChainPayload, ReceiveTokenOptionPayload, WithdrawableBalanceItem
|
|
|
8
9
|
* {@link WithdrawDriver.getSnapshot} and consumed by `useSyncExternalStore`. The kit's
|
|
9
10
|
* `useWithdrawSnapshot()` hook returns this shape.
|
|
10
11
|
*
|
|
11
|
-
*
|
|
12
|
-
* the `ready` / `stale` variants.
|
|
12
|
+
* Most fields are {@link Entity} envelopes — components switch on `status` and read `payload` on
|
|
13
|
+
* the `ready` / `stale` variants. The optional `minAmountUsd` / `maxAmountUsd` carry static
|
|
14
|
+
* config-derived USD bounds (set once at driver construction) and stay outside the entity model.
|
|
13
15
|
*/
|
|
14
16
|
interface WithdrawSnapshot {
|
|
15
17
|
/**
|
|
@@ -23,7 +25,7 @@ interface WithdrawSnapshot {
|
|
|
23
25
|
withdrawableBalances: Entity<ReadonlyArray<WithdrawableBalanceItemPayload>, WithdrawableBalancesResponse, WithdrawableBalancesResponse>;
|
|
24
26
|
/**
|
|
25
27
|
* Per-chain catalog of routable receive destinations. Drives the form's "Receive chain" /
|
|
26
|
-
* "Receive token" pickers. Derived from `
|
|
28
|
+
* "Receive token" pickers. Derived from `Gateway.assets()`.
|
|
27
29
|
*/
|
|
28
30
|
receiveOptions: Entity<ReadonlyArray<ReceiveChainPayload>, ReadonlyArray<ReceiveOptionDto>, ReceiveOptionsResponse>;
|
|
29
31
|
/**
|
|
@@ -37,6 +39,18 @@ interface WithdrawSnapshot {
|
|
|
37
39
|
* error state screen renders.
|
|
38
40
|
*/
|
|
39
41
|
settlement: Entity<WithdrawalSettlementPayload, WithdrawalSettlementDto, WithdrawalSettlementResponse>;
|
|
42
|
+
/**
|
|
43
|
+
* Optional lower USD bound on the withdraw amount. The withdraw form blocks submit with a
|
|
44
|
+
* localized "Min $X" CTA when the typed amount sits below `value`. Set from
|
|
45
|
+
* `<StridgeProvider flows.withdraw.minAmountUsd>` and constant across the driver's lifetime.
|
|
46
|
+
*/
|
|
47
|
+
minAmountUsd?: FormattedField<number>;
|
|
48
|
+
/**
|
|
49
|
+
* Optional upper USD bound on the withdraw amount. The withdraw form blocks submit with a
|
|
50
|
+
* localized "Max $X" CTA when the typed amount sits above `value`. Set from
|
|
51
|
+
* `<StridgeProvider flows.withdraw.maxAmountUsd>` and constant across the driver's lifetime.
|
|
52
|
+
*/
|
|
53
|
+
maxAmountUsd?: FormattedField<number>;
|
|
40
54
|
}
|
|
41
55
|
/**
|
|
42
56
|
* Input to {@link WithdrawDriver.requestQuote}. The form widget builds this from current field
|
|
@@ -57,17 +71,57 @@ interface RequestWithdrawalQuoteInput {
|
|
|
57
71
|
recipientAddress: string;
|
|
58
72
|
}
|
|
59
73
|
/**
|
|
60
|
-
* Input to {@link WithdrawDriver.
|
|
61
|
-
* — the live driver re-uses the most recent quote for
|
|
62
|
-
* scope both calls.
|
|
74
|
+
* Input to {@link WithdrawDriver.prepareWithdrawal}. Identical to {@link RequestWithdrawalQuoteInput}
|
|
75
|
+
* — the live driver re-uses the most recent quote shape for the gateway/start call, so the same
|
|
76
|
+
* identifying fields scope both calls.
|
|
63
77
|
*/
|
|
64
|
-
type
|
|
78
|
+
type PrepareWithdrawalInput = RequestWithdrawalQuoteInput;
|
|
65
79
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
80
|
+
* Result of {@link WithdrawDriver.prepareWithdrawal}. Carries everything the host's `onSubmit`
|
|
81
|
+
* callback needs to broadcast a transfer to the Stridge UDA on the brand-currency chain — the
|
|
82
|
+
* UDA address, the chain, the token, the amount — plus the Stridge correlation fields the host
|
|
83
|
+
* may want to mirror into their own backend logs.
|
|
84
|
+
*/
|
|
85
|
+
interface WithdrawPreparation {
|
|
86
|
+
/**
|
|
87
|
+
* Where the host should send brand-currency funds. The kit has already provisioned a UDA
|
|
88
|
+
* (via `gateway/start`); the host's job is to broadcast a single on-chain transfer of
|
|
89
|
+
* `amount` of `tokenSymbol` from their treasury / custodial wallet to `address` on `chainId`.
|
|
90
|
+
* Stridge takes over from there to bridge into the user's chosen recipient/chain/token.
|
|
91
|
+
*/
|
|
92
|
+
depositTarget: {
|
|
93
|
+
/** UDA deposit address on the brand-currency chain. */address: string; /** EIP-155 chain id of the brand-currency network. */
|
|
94
|
+
chainId: number; /** Brand-currency token symbol (e.g. `"USDC"`). */
|
|
95
|
+
tokenSymbol: string; /** ERC-20 contract address of the brand currency. Empty string for native gas tokens. */
|
|
96
|
+
tokenAddress: string; /** On-chain decimal precision (e.g. `6` for USDC on Ethereum, `18` for ETH). */
|
|
97
|
+
tokenDecimals: number; /** `true` when the brand currency is the chain's native gas token. */
|
|
98
|
+
isNative: boolean; /** Exact amount to transfer, in display units (kit-managed decimals already factored in). */
|
|
99
|
+
amount: number;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Stridge correlation slot the host can pass through to their own backend / logs. `owner`
|
|
103
|
+
* is the same value the kit threaded into `gateway/start.owner` for this UDA.
|
|
104
|
+
*/
|
|
105
|
+
correlation: {
|
|
106
|
+
owner: string;
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Input to {@link WithdrawDriver.watchSettlement}. `tx` is optional — when the host has
|
|
111
|
+
* surfaced a broadcast tx hash via the orchestrator's `setTxHash` action, the watcher anchors
|
|
112
|
+
* to it for precise matching. When omitted, the watcher falls back to a best-match heuristic
|
|
113
|
+
* (destination tuple + amount tolerance + submit-time window) so the kit can find the relevant
|
|
114
|
+
* settlement even if the host never surfaces a tx hash.
|
|
68
115
|
*/
|
|
69
116
|
interface WatchWithdrawalSettlementInput {
|
|
70
|
-
tx
|
|
117
|
+
tx?: TxRef;
|
|
118
|
+
/**
|
|
119
|
+
* Form snapshot at submit time. The driver uses this in best-match mode to filter
|
|
120
|
+
* `gateway/{owner}` to settlements whose destination matches the user's selection.
|
|
121
|
+
*/
|
|
122
|
+
form: RequestWithdrawalQuoteInput;
|
|
123
|
+
/** Unix-ms timestamp the host called `beginProcessing` — the start of the matching window. */
|
|
124
|
+
submittedAt: number;
|
|
71
125
|
}
|
|
72
126
|
/**
|
|
73
127
|
* Input to {@link WithdrawDriver.watchWithdrawableBalances}. Optional listener — the form's
|
|
@@ -107,16 +161,25 @@ interface WithdrawDriver {
|
|
|
107
161
|
getSnapshot(): WithdrawSnapshot;
|
|
108
162
|
/** Subscribe to entity transitions outside React (analytics, headless integrations). */
|
|
109
163
|
subscribe(listener: () => void): () => void;
|
|
164
|
+
/**
|
|
165
|
+
* Idempotent bootstrap trigger. The kit calls this from `useWithdraw().open()` and the
|
|
166
|
+
* headless `usePrefetchWithdraw()` hook. First call kicks off any deferred network work
|
|
167
|
+
* (e.g. `supportedAssets` + the initial `balance/onchain` fetch); subsequent calls are
|
|
168
|
+
* no-ops while bootstrap is in flight or completed.
|
|
169
|
+
*/
|
|
170
|
+
arm(): void;
|
|
110
171
|
/**
|
|
111
172
|
* Fetches a fresh quote for `input` and updates the `quote` entity through its lifecycle
|
|
112
173
|
* (`idle | loading → ready | error`). The `signal` cancels in-flight work.
|
|
113
174
|
*/
|
|
114
175
|
requestQuote(input: RequestWithdrawalQuoteInput, signal: AbortSignal): Promise<void>;
|
|
115
176
|
/**
|
|
116
|
-
*
|
|
117
|
-
*
|
|
177
|
+
* Provisions a fresh UDA for this withdrawal (via `gateway/start`) and returns the deposit
|
|
178
|
+
* target + Stridge correlation slot for the host's `onSubmit` callback to act on. The kit
|
|
179
|
+
* never signs the withdraw transfer itself — the host's backend (treasury wallet, custodial
|
|
180
|
+
* signer, hot-wallet service) does. See {@link WithdrawPreparation}.
|
|
118
181
|
*/
|
|
119
|
-
|
|
182
|
+
prepareWithdrawal(input: PrepareWithdrawalInput, signal: AbortSignal): Promise<WithdrawPreparation>;
|
|
120
183
|
/**
|
|
121
184
|
* Watches the settlement entity through its lifecycle (pending → succeeded / failed). The
|
|
122
185
|
* listener fires on every transition with the new envelope; the FSM consumes these via the
|
|
@@ -130,4 +193,4 @@ interface WithdrawDriver {
|
|
|
130
193
|
watchWithdrawableBalances?(input: WatchWithdrawableBalancesInput, listener: (entity: WithdrawSnapshot["withdrawableBalances"]) => void, signal: AbortSignal): void;
|
|
131
194
|
}
|
|
132
195
|
//#endregion
|
|
133
|
-
export {
|
|
196
|
+
export { PrepareWithdrawalInput, RequestWithdrawalQuoteInput, WatchWithdrawableBalancesInput, WatchWithdrawalSettlementInput, WithdrawDriver, WithdrawPreparation, WithdrawSnapshot };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
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{useSettlementWatcher as a}from"../../../shared/orchestrator/useSettlementWatcher.js";import"../../../shared/orchestrator/index.js";import{useWithdrawBindingsRef as o}from"../bindings/WithdrawBindings.js";import"../bindings/index.js";import{useWithdrawDriverInstance as s}from"../driver/context.js";import{initialState as c,reducer as l}from"./reducer.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:`ldK3jJ`,message:`Failed to submit withdrawal.`},y={id:`kUFhUv`,message:`Withdrawal failed.`},b={id:`srsA0x`,message:`Withdrawal declined.`},x=u(null);x.displayName=`WithdrawControllerContext`;function S(){let e=d(x);if(!e)throw Error(`useWithdraw / WithdrawControllerProvider must be used inside <KitProvider withdraw={…} />. Mount KitProvider once at the host's app root with a withdraw driver.`);return e}function C(){return d(x)}function w(){return S().state}function T(){return S().effectiveState}function E(){return S().actions}function D({children:t}){let n=s(),r=e(),[o,u]=h(l,c),d=k(o,u,n,r),f=o.name===`inProgress`?{form:o.ctx.input,submittedAt:o.ctx.submittedAt,...o.ctx.tx?{tx:o.ctx.tx}:{}}:void 0;a(n,f,f?`${f.submittedAt}|${f.tx?.hash??``}`:void 0),A(r,o.name===`activityList`||o.name===`activityDetail`),j(o,u,n);let p=i(o),g=O(u,d,n);return _(x,{value:m(()=>({state:o,effectiveState:p,dispatch:u,controller:g,actions:d}),[o,p,g,d]),children:t})}function O(e,t,n){let r=g(n);r.current=n;let i=f(t=>(r.current.arm(),e({type:`OPEN`}),!0),[e]),a=f(()=>{e({type:`CLOSE`})},[e]);return m(()=>({open:i,close:a,actions:t}),[i,a,t])}function k(e,r,i,a){let s=g(e);s.current=e;let c=g(i);c.current=i;let l=g(a);l.current=a;let u=g(r);u.current=r;let{i18n:d}=t(),p=g(d);p.current=d;let h=o(),_=f(e=>{let t=c.current;u.current({type:`SUBMIT`,input:e});let r=new AbortController,i={sourceAssetSymbol:e.sourceAssetSymbol,sourceChainId:e.sourceChainId,amount:e.amount,receiveTokenSymbol:e.receiveTokenSymbol,receiveChainId:e.receiveChainId,recipientAddress:e.recipientAddress},a={beginProcessing(e){u.current({type:`BEGIN_PROCESSING`,submittedAt:Date.now(),...e?{tx:e}:{}});try{l.current?.invalidateActivity?.()}catch{}},setTxHash(e){u.current({type:`SET_TX_HASH`,tx:e,submittedAt:Date.now()})},fail(e){u.current({type:`MARK_FAILED`,...e?{failure:e}:{}})},decline(){u.current({type:`SUBMIT_FAILED`,failure:{reason:p.current._(b),code:`UserRejectedRequestError`},input:e})},succeed(){u.current({type:`MARK_SUCCEEDED`})}};t.prepareWithdrawal(i,r.signal).then(i=>{if(r.signal.aborted)return;let o=h.current.onSubmit;if(!o){u.current({type:`SUBMIT_FAILED`,failure:n(Error(`WithdrawDialog onSubmit is missing.`),p.current._(v)),input:e});return}let s=t.getSnapshot().quote,c=s.status===`ready`||s.status===`stale`?s.payload:void 0;try{let t=o({form:e,depositTarget:i.depositTarget,correlation:i.correlation,...c?{quote:c}:{}},a,r.signal);t&&typeof t.catch==`function`&&t.catch(t=>{r.signal.aborted||u.current({type:`SUBMIT_FAILED`,failure:n(t,p.current._(v)),input:e})})}catch(t){if(r.signal.aborted)return;u.current({type:`SUBMIT_FAILED`,failure:n(t,p.current._(v)),input:e})}}).catch(t=>{r.signal.aborted||u.current({type:`SUBMIT_FAILED`,failure:n(t,p.current._(v)),input:e})})},[]),y=f(()=>{u.current({type:`CLOSE`})},[]),x=f(()=>{u.current({type:`RESET`})},[]),S=f(()=>{u.current({type:`CLEAR_NOTICE`})},[]),C=f(()=>{u.current({type:`BACK`})},[]),w=f(()=>{if(l.current==null){process.env.NODE_ENV!==`production`&&console.warn("[@stridge/kit] useWithdrawActions().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}s.current.name===`form`&&u.current({type:`OPEN_ACTIVITY`})},[]),T=f(e=>{u.current({type:`SELECT_SETTLEMENT`,settlementId:e})},[]);return m(()=>({submit:_,close:y,reset:x,clearNotice:S,back:C,openActivity:w,selectSettlement:T}),[_,y,x,S,C,w,T])}function A(e,t){p(()=>{if(!t||!e)return;let n=new AbortController;return e.watchActivity(n.signal),()=>n.abort()},[t,e])}function j(e,n,i){let a=g(e);a.current=e;let{i18n:o}=t(),s=g(o);s.current=o,r(i,(e,t)=>{if(a.current.name===`inProgress`){if(e===`succeeded`){n({type:`SETTLEMENT_SUCCEEDED`});return}if(e===`failed`){let e=t.settlement,r=e.status===`ready`||e.status===`stale`?e.payload:null,i=r&&r.kind===`failed`?{reason:s.current._(y),code:r.failureKind}:void 0;n({type:`SETTLEMENT_FAILED`,...i?{failure:i}:{}})}}})}export{D as WithdrawControllerProvider,S as useControllerContext,C as useOptionalControllerContext,E as useWithdrawActions,T as useWithdrawEffectiveState,w as useWithdrawState};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { FailureInfo } from "../../../shared/orchestrator/types.js";
|
|
2
2
|
import { WithdrawActions, WithdrawController, WithdrawEvent, WithdrawState, WithdrawStateName, WithdrawalFormSnapshot } from "./types.js";
|
|
3
3
|
import { useWithdrawState } from "./controller.js";
|
|
4
|
-
import { useWithdraw } from "./useWithdraw.js";
|
|
4
|
+
import { useOptionalWithdraw, usePrefetchWithdraw, useWithdraw } from "./useWithdraw.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{createActivityReducers as e}from"../../../shared/orchestrator/createActivityReducers.js";import{isUserRejectionFailure as t}from"../../../shared/orchestrator/userRejection.js";import"../../../shared/orchestrator/index.js";import{assertNever as n}from"../../../shared/utils/assertNever.js";const r={name:`closed`},{reduceFromActivityList:i,reduceFromActivityDetail:a}=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=>p(e)});function o(e,t){switch(e.name){case`closed`:return s(t);case`form`:return c(e,t);case`submitting`:return l(e,t);case`inProgress`:return u(e,t);case`success`:return d(e,t);case`error`:return f(e,t);case`activityList`:return i(e,t);case`activityDetail`:return a(e,t);default:return n(e)}}function s(e){return e.type===`OPEN`?{name:`form`}:{name:`closed`}}function c(e,t){switch(t.type){case`SUBMIT`:return{name:`submitting`,ctx:{input:t.input}};case`CLEAR_NOTICE`:return e.ctx?.notice?{name:`form`}:e;case`OPEN_ACTIVITY`:return{name:`activityList`,ctx:{backTarget:{kind:`form`,...e.ctx?.notice?{notice:e.ctx.notice}:{}}}};case`CLOSE`:return{name:`closed`};default:return e}}function l(e,n){switch(n.type){case`BEGIN_PROCESSING`:return{name:`inProgress`,ctx:{input:e.ctx.input,submittedAt:n.submittedAt,...n.tx?{tx:n.tx}:{}}};case`SET_TX_HASH`:return{name:`inProgress`,ctx:{input:e.ctx.input,submittedAt:n.submittedAt,tx:n.tx}};case`MARK_SUCCEEDED`:return{name:`success`,ctx:{input:e.ctx.input}};case`MARK_FAILED`:return{name:`error`,ctx:{input:e.ctx.input,...n.failure?{failure:n.failure}:{}}};case`SUBMIT_FAILED`:return t(n.failure)?{name:`form`,ctx:{notice:n.failure.reason}}:{name:`error`,ctx:{input:n.input,failure:n.failure}};case`CLOSE`:return{name:`closed`};default:return e}}function u(e,t){switch(t.type){case`SET_TX_HASH`:return{name:`inProgress`,ctx:{...e.ctx,tx:t.tx}};case`BEGIN_PROCESSING`:return{name:`inProgress`,ctx:{input:e.ctx.input,submittedAt:e.ctx.submittedAt,...e.ctx.tx?{tx:e.ctx.tx}:t.tx?{tx:t.tx}:{}}};case`MARK_SUCCEEDED`:return{name:`success`,ctx:{input:e.ctx.input,...e.ctx.tx?{tx:e.ctx.tx}:{}}};case`MARK_FAILED`:return{name:`error`,ctx:{input:e.ctx.input,...e.ctx.tx?{tx:e.ctx.tx}:{},...t.failure?{failure:t.failure}:{}}};case`SETTLEMENT_SUCCEEDED`:return{name:`success`,ctx:{input:e.ctx.input,...e.ctx.tx?{tx:e.ctx.tx}:{}}};case`SETTLEMENT_FAILED`:return{name:`error`,ctx:{input:e.ctx.input,...e.ctx.tx?{tx:e.ctx.tx}:{},...t.failure?{failure:t.failure}:{}}};case`CLOSE`:return{name:`closed`};default:return e}}function d(e,t){switch(t.type){case`RESET`:return{name:`form`};case`CLOSE`:return{name:`closed`};default:return e}}function f(e,t){switch(t.type){case`RESET`:return{name:`form`};case`CLOSE`:return{name:`closed`};default:return e}}function p(e){return e.notice?{name:`form`,ctx:{notice:e.notice}}:{name:`form`}}export{r as initialState,o as reducer};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TxRef } from "../../../shared/driver/types.js";
|
|
2
2
|
import { FailureInfo } from "../../../shared/orchestrator/types.js";
|
|
3
|
-
|
|
3
|
+
import { WithdrawalQuotePayload } from "../driver/payloads.js";
|
|
4
|
+
import { WithdrawPreparation } from "../driver/types.js";
|
|
4
5
|
//#region src/flows/withdraw/orchestrator/types.d.ts
|
|
5
6
|
/**
|
|
6
7
|
* Form values captured at submit time. The orchestrator carries this snapshot through every
|
|
@@ -20,24 +21,43 @@ interface WithdrawalFormSnapshot {
|
|
|
20
21
|
receiveTokenSymbol: string;
|
|
21
22
|
/** Receive-side chain id (EIP-155 numeric). */
|
|
22
23
|
receiveChainId: number;
|
|
24
|
+
/**
|
|
25
|
+
* Pre-formatted USD figure the form displayed under the amount input at submit time. Carried
|
|
26
|
+
* through the FSM so the in-progress / success heroes can render the same dollar value the
|
|
27
|
+
* user just saw on the form, before the indexer prices the settlement legs. Optional because
|
|
28
|
+
* the form's USD computation already returns `undefined` for invalid amounts; the snapshot
|
|
29
|
+
* mirrors that. Pre-formatted (locale-aware) — the orchestrator does not re-format.
|
|
30
|
+
*/
|
|
31
|
+
amountUsd?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Where `BACK` lands when the user exits the activity surface. Encoded once at `OPEN_ACTIVITY`
|
|
35
|
+
* time — the in-flow header icon is the only way into withdraw activity now (direct-entry
|
|
36
|
+
* migrated to `useActivity()`), so the form is always the source step.
|
|
37
|
+
*/
|
|
38
|
+
interface ActivityBackTarget {
|
|
39
|
+
kind: "form";
|
|
40
|
+
notice?: string;
|
|
23
41
|
}
|
|
24
42
|
/**
|
|
25
|
-
* State machine state for the orchestrated withdraw dialog. Per-state discriminated `ctx`
|
|
26
|
-
* what data is available
|
|
27
|
-
* unrepresentable.
|
|
43
|
+
* State machine state for the orchestrated withdraw dialog. Per-state discriminated `ctx`
|
|
44
|
+
* narrows what data is available.
|
|
28
45
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
46
|
+
* **Host-paced lifecycle** (different from the old wagmi-signed model): the kit stays in
|
|
47
|
+
* `submitting` until the host's `onSubmit` callback calls one of the controller's actions
|
|
48
|
+
* (`beginProcessing`, `fail`, `succeed`). `inProgress` accepts an optional `tx` — the host may
|
|
49
|
+
* move the user into processing before a broadcast tx hash exists; the kit polls
|
|
50
|
+
* `gateway/{owner}` and best-matches the relevant settlement (destination tuple + amount +
|
|
51
|
+
* submit-time window) until the host supplies a tx hash via `setTxHash`. `success` / `error`
|
|
52
|
+
* similarly accept optional `tx` since the host may declare a terminal verdict directly.
|
|
31
53
|
*/
|
|
32
54
|
type WithdrawState = {
|
|
33
55
|
name: "closed";
|
|
34
56
|
} | {
|
|
35
57
|
name: "form";
|
|
36
58
|
/**
|
|
37
|
-
* Optional notice rendered inline near the submit footer.
|
|
38
|
-
*
|
|
39
|
-
* recipient + amount + receive selection) with `notice = "Signature declined…"` so they
|
|
40
|
-
* can retry without losing context. Cleared on the next SUBMIT or CLOSE.
|
|
59
|
+
* Optional notice rendered inline near the submit footer. Cleared on the next SUBMIT
|
|
60
|
+
* or CLOSE.
|
|
41
61
|
*/
|
|
42
62
|
ctx?: {
|
|
43
63
|
notice?: string;
|
|
@@ -50,27 +70,56 @@ type WithdrawState = {
|
|
|
50
70
|
} | {
|
|
51
71
|
name: "inProgress";
|
|
52
72
|
ctx: {
|
|
53
|
-
input: WithdrawalFormSnapshot;
|
|
54
|
-
|
|
73
|
+
input: WithdrawalFormSnapshot; /** Unix-ms timestamp the host moved the FSM into processing (drives best-match windowing). */
|
|
74
|
+
submittedAt: number;
|
|
75
|
+
/**
|
|
76
|
+
* Source-chain broadcast hash, when the host has surfaced one via
|
|
77
|
+
* `actions.setTxHash`. Absent while the kit relies on the best-match heuristic.
|
|
78
|
+
*/
|
|
79
|
+
tx?: TxRef;
|
|
55
80
|
};
|
|
56
81
|
} | {
|
|
57
82
|
name: "success";
|
|
58
83
|
ctx: {
|
|
59
84
|
input: WithdrawalFormSnapshot;
|
|
60
|
-
tx
|
|
85
|
+
tx?: TxRef;
|
|
61
86
|
};
|
|
62
87
|
} | {
|
|
63
88
|
name: "error";
|
|
64
89
|
ctx: {
|
|
65
90
|
/**
|
|
66
91
|
* Form snapshot captured at submit time. Set when error follows a submit attempt;
|
|
67
|
-
* absent when the error path was reached without a known prior submit
|
|
68
|
-
* unreachable in V2 — kept optional so resume-style entries can re-use the slot).
|
|
92
|
+
* absent when the error path was reached without a known prior submit.
|
|
69
93
|
*/
|
|
70
|
-
input?: WithdrawalFormSnapshot; /** Optional non-settlement failure (quote / submission rejection). */
|
|
94
|
+
input?: WithdrawalFormSnapshot; /** Optional non-settlement failure (quote / submission rejection, host-supplied failure). */
|
|
71
95
|
failure?: FailureInfo; /** Source-chain broadcast tx hash when the error followed a successful broadcast. */
|
|
72
96
|
tx?: TxRef;
|
|
73
97
|
};
|
|
98
|
+
} | {
|
|
99
|
+
/**
|
|
100
|
+
* Activity list — reachable from `form` via the header icon. `backTarget`
|
|
101
|
+
* snapshots the source state (including any inline notice) at `OPEN_ACTIVITY` time so
|
|
102
|
+
* the back chevron can restore it lossless.
|
|
103
|
+
*/
|
|
104
|
+
name: "activityList";
|
|
105
|
+
ctx: {
|
|
106
|
+
backTarget: ActivityBackTarget;
|
|
107
|
+
};
|
|
108
|
+
} | {
|
|
109
|
+
/**
|
|
110
|
+
* Activity per-settlement detail — reached from `activityList` via
|
|
111
|
+
* `SELECT_SETTLEMENT`. Carries the selected row's id, the same `backTarget` so `BACK`
|
|
112
|
+
* collapses through `activityList` to the original source step, and a `viaList` flag
|
|
113
|
+
* that disambiguates "reached via the list" from "reached imperatively"; the latter
|
|
114
|
+
* skips the list interlude on `BACK`. For direct-entry into the activity surface,
|
|
115
|
+
* see {@link useActivity}.
|
|
116
|
+
*/
|
|
117
|
+
name: "activityDetail";
|
|
118
|
+
ctx: {
|
|
119
|
+
settlementId: string;
|
|
120
|
+
backTarget: ActivityBackTarget;
|
|
121
|
+
viaList: boolean;
|
|
122
|
+
};
|
|
74
123
|
};
|
|
75
124
|
/**
|
|
76
125
|
* Public state-name discriminator — useful for analytics and React-side gating without unwrapping
|
|
@@ -79,21 +128,41 @@ type WithdrawState = {
|
|
|
79
128
|
type WithdrawStateName = WithdrawState["name"];
|
|
80
129
|
/**
|
|
81
130
|
* Reducer event union. Strict discriminated; no stringly-typed transitions.
|
|
131
|
+
*
|
|
132
|
+
* The host-paced lifecycle splits the old `SUBMIT_CONFIRMED { tx }` event into three pieces so
|
|
133
|
+
* the host can move the user forward at whichever step their backend actually completes:
|
|
134
|
+
*
|
|
135
|
+
* - `BEGIN_PROCESSING { tx?, submittedAt }` — host accepted the request; move to inProgress with
|
|
136
|
+
* or without a tx hash.
|
|
137
|
+
* - `SET_TX_HASH { tx }` — host surfaced a broadcast hash later; upgrade best-match polling to
|
|
138
|
+
* tx-anchored.
|
|
139
|
+
* - `MARK_SUCCEEDED` / `MARK_FAILED { failure? }` — host short-circuits to a terminal verdict
|
|
140
|
+
* (e.g. their own settlement verification ran independently of Stridge's poll).
|
|
82
141
|
*/
|
|
83
142
|
type WithdrawEvent = {
|
|
84
|
-
type: "OPEN";
|
|
143
|
+
/** Lifecycle entry. Always lands the FSM on `form`. */type: "OPEN";
|
|
85
144
|
} | {
|
|
86
145
|
type: "CLOSE";
|
|
87
146
|
} | {
|
|
88
147
|
type: "SUBMIT";
|
|
89
148
|
input: WithdrawalFormSnapshot;
|
|
90
149
|
} | {
|
|
91
|
-
type: "
|
|
150
|
+
type: "BEGIN_PROCESSING";
|
|
151
|
+
submittedAt: number;
|
|
152
|
+
tx?: TxRef;
|
|
153
|
+
} | {
|
|
154
|
+
type: "SET_TX_HASH";
|
|
92
155
|
tx: TxRef;
|
|
156
|
+
submittedAt: number;
|
|
93
157
|
} | {
|
|
94
158
|
type: "SUBMIT_FAILED";
|
|
95
159
|
failure: FailureInfo;
|
|
96
160
|
input: WithdrawalFormSnapshot;
|
|
161
|
+
} | {
|
|
162
|
+
type: "MARK_SUCCEEDED";
|
|
163
|
+
} | {
|
|
164
|
+
type: "MARK_FAILED";
|
|
165
|
+
failure?: FailureInfo;
|
|
97
166
|
} | {
|
|
98
167
|
type: "SETTLEMENT_SUCCEEDED";
|
|
99
168
|
} | {
|
|
@@ -101,24 +170,48 @@ type WithdrawEvent = {
|
|
|
101
170
|
failure?: FailureInfo;
|
|
102
171
|
} | {
|
|
103
172
|
type: "RESET";
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Drops the inline notice on the `form` state. Dispatched by the form widget when the user
|
|
107
|
-
* starts editing again after a wallet-rejection landed them back on `form{notice}`. Mirror of
|
|
108
|
-
* deposit's `regenerating → ready` transition (where the notice clears as a side-effect of
|
|
109
|
-
* the next quote resolving) — withdraw's form has no FSM-driven phase to ride on, so the
|
|
110
|
-
* widget signals it explicitly.
|
|
111
|
-
*/
|
|
112
|
-
| {
|
|
173
|
+
} | {
|
|
113
174
|
type: "CLEAR_NOTICE";
|
|
175
|
+
} | {
|
|
176
|
+
/**
|
|
177
|
+
* User tapped the back chevron. Legal only from `activityList` / `activityDetail` today —
|
|
178
|
+
* the form step has no source to return to (closing the dialog is `CLOSE`). Two-step
|
|
179
|
+
* collapse: `activityDetail → activityList → source`.
|
|
180
|
+
*/
|
|
181
|
+
type: "BACK";
|
|
182
|
+
} | {
|
|
183
|
+
/**
|
|
184
|
+
* User tapped the header activity icon. Legal from `form`; ignored elsewhere. Snapshots
|
|
185
|
+
* the source state into a {@link ActivityBackTarget} so the back chevron can restore it
|
|
186
|
+
* lossless (including any inline notice surfaced after a recent submit failure).
|
|
187
|
+
*/
|
|
188
|
+
type: "OPEN_ACTIVITY";
|
|
189
|
+
} | {
|
|
190
|
+
/**
|
|
191
|
+
* User tapped a row in the activity list. Legal only from `activityList`; transitions
|
|
192
|
+
* to `activityDetail` carrying the selected `settlementId`.
|
|
193
|
+
*/
|
|
194
|
+
type: "SELECT_SETTLEMENT";
|
|
195
|
+
settlementId: string;
|
|
114
196
|
};
|
|
197
|
+
/**
|
|
198
|
+
* Public open-input variant accepted by `useWithdraw().open()`. Today the withdraw flow has no
|
|
199
|
+
* `{ method }` arm — opening always lands on `form`.
|
|
200
|
+
*
|
|
201
|
+
* For direct-entry into the activity surface, see {@link useActivity}.
|
|
202
|
+
*/
|
|
203
|
+
type WithdrawOpenInput = undefined;
|
|
115
204
|
/**
|
|
116
205
|
* Imperative controller returned by `useWithdraw()`. Mirrors {@link import("#/flows/deposit/orchestrator").DepositController}'s
|
|
117
206
|
* surface so hosts can drive both flows symmetrically. Stable across re-renders.
|
|
118
207
|
*/
|
|
119
208
|
interface WithdrawController {
|
|
120
|
-
/**
|
|
121
|
-
|
|
209
|
+
/**
|
|
210
|
+
* Open the withdraw dialog on `form`. Returns `true` whenever the open() call advanced the
|
|
211
|
+
* dialog past its guards — there is no per-method disable lever on withdraw, so the only
|
|
212
|
+
* `false` path is reserved for forward compatibility. Idempotent.
|
|
213
|
+
*/
|
|
214
|
+
open(input?: WithdrawOpenInput): boolean;
|
|
122
215
|
/** Close the withdraw dialog. Idempotent. */
|
|
123
216
|
close(): void;
|
|
124
217
|
/**
|
|
@@ -134,9 +227,11 @@ interface WithdrawController {
|
|
|
134
227
|
*/
|
|
135
228
|
interface WithdrawActions {
|
|
136
229
|
/**
|
|
137
|
-
* Submits the withdrawal
|
|
138
|
-
*
|
|
139
|
-
* the
|
|
230
|
+
* Submits the withdrawal. Dispatches `SUBMIT` synchronously (so the form flips to the
|
|
231
|
+
* loading-button state) and then fires the host's `<WithdrawDialog onSubmit>` callback with
|
|
232
|
+
* the prepared UDA target + a `WithdrawSubmitActions` handle. The kit stays in `submitting`
|
|
233
|
+
* until the host calls one of those actions (`beginProcessing`, `setTxHash`, `decline`,
|
|
234
|
+
* `fail`, `succeed`).
|
|
140
235
|
*/
|
|
141
236
|
submit(input: WithdrawalFormSnapshot): void;
|
|
142
237
|
/** Close the dialog. Idempotent. */
|
|
@@ -147,10 +242,98 @@ interface WithdrawActions {
|
|
|
147
242
|
*/
|
|
148
243
|
reset(): void;
|
|
149
244
|
/**
|
|
150
|
-
* Clear the form's inline notice
|
|
151
|
-
* No-op when there's no notice or the FSM isn't on `form`.
|
|
245
|
+
* Clear the form's inline notice. No-op when there's no notice or the FSM isn't on `form`.
|
|
152
246
|
*/
|
|
153
247
|
clearNotice(): void;
|
|
248
|
+
/**
|
|
249
|
+
* Back-chevron action. Today the chevron is only rendered on the activity step
|
|
250
|
+
* (detail → list → source); other steps either render no chevron or close directly via
|
|
251
|
+
* {@link close}.
|
|
252
|
+
*/
|
|
253
|
+
back(): void;
|
|
254
|
+
/**
|
|
255
|
+
* Header-icon entry into the activity surface. Legal from `form`; ignored elsewhere.
|
|
256
|
+
* Snapshots the current state into a {@link ActivityBackTarget} so `back()` can restore it
|
|
257
|
+
* lossless. No-ops with a dev-mode warning when no activity driver is mounted (host wired the
|
|
258
|
+
* action without `<KitProvider activity={…}>`).
|
|
259
|
+
*/
|
|
260
|
+
openActivity(): void;
|
|
261
|
+
/**
|
|
262
|
+
* Open the detail view for a settlement listed on the activity surface. Legal only from
|
|
263
|
+
* `activityList`; transitions the FSM to `activityDetail`.
|
|
264
|
+
*/
|
|
265
|
+
selectSettlement(settlementId: string): void;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Payload the kit hands to the host's `<WithdrawDialog onSubmit>` callback. Carries everything
|
|
269
|
+
* the host needs to broadcast the source-chain transfer to the UDA (or to validate the request
|
|
270
|
+
* server-side before broadcasting / queueing).
|
|
271
|
+
*/
|
|
272
|
+
interface WithdrawSubmitInput {
|
|
273
|
+
/** What the user picked on the form (recipient, amount, receive token + chain). */
|
|
274
|
+
form: WithdrawalFormSnapshot;
|
|
275
|
+
/** Where the host should send brand-currency funds to trigger the bridge. */
|
|
276
|
+
depositTarget: WithdrawPreparation["depositTarget"];
|
|
277
|
+
/** Stridge correlation slot — useful for backend logs / cross-system traces. */
|
|
278
|
+
correlation: WithdrawPreparation["correlation"];
|
|
279
|
+
/** Active quote payload at submit time, when one is available. */
|
|
280
|
+
quote?: WithdrawalQuotePayload;
|
|
154
281
|
}
|
|
282
|
+
/**
|
|
283
|
+
* Imperative handles the host's `onSubmit` callback receives. Each action advances the kit's
|
|
284
|
+
* FSM at the point the host's backend reaches the matching state. All actions are optional —
|
|
285
|
+
* the host calls only what fits their flow (e.g. backend pre-validates and accepts ⇒
|
|
286
|
+
* `beginProcessing()`; later the broadcast lands ⇒ `setTxHash({ hash })`; settlement watching
|
|
287
|
+
* via Stridge takes over from there). The kit also exposes a `signal` for cancellation when
|
|
288
|
+
* the user closes the dialog mid-submit.
|
|
289
|
+
*/
|
|
290
|
+
interface WithdrawSubmitActions {
|
|
291
|
+
/**
|
|
292
|
+
* Move the FSM into `inProgress`. Pass `tx` if a broadcast hash already exists at this point;
|
|
293
|
+
* otherwise omit — the kit polls `gateway/{owner}` with a best-match heuristic until you
|
|
294
|
+
* call {@link setTxHash}. Idempotent — calling more than once is a no-op.
|
|
295
|
+
*/
|
|
296
|
+
beginProcessing(tx?: TxRef): void;
|
|
297
|
+
/**
|
|
298
|
+
* Surface a broadcast hash mid-processing. Upgrades the watcher from best-match to
|
|
299
|
+
* tx-anchored. Legal from `inProgress` or `submitting` (auto-promotes to `inProgress`).
|
|
300
|
+
*/
|
|
301
|
+
setTxHash(tx: TxRef): void;
|
|
302
|
+
/**
|
|
303
|
+
* Mark the withdraw failed. Legal from `submitting` (pre-broadcast rejection) and
|
|
304
|
+
* `inProgress` (post-broadcast failure). The optional `failure` carries a localized
|
|
305
|
+
* reason + machine code for analytics; omit when the host has nothing meaningful to
|
|
306
|
+
* report and just needs to terminate the flow.
|
|
307
|
+
*
|
|
308
|
+
* For user-rejection (the user said no in their wallet), prefer {@link decline} so the
|
|
309
|
+
* kit can emit `withdraw.submission.declined` instead of `withdraw.submission.failed`.
|
|
310
|
+
*/
|
|
311
|
+
fail(failure?: FailureInfo): void;
|
|
312
|
+
/**
|
|
313
|
+
* Mark the withdraw as user-declined. Use when the user explicitly refused a wallet
|
|
314
|
+
* prompt or backed out of a host-side confirmation step. The kit routes the FSM back to
|
|
315
|
+
* `form{notice}` (same as the wallet-rejection heuristic) and emits
|
|
316
|
+
* `withdraw.submission.declined` on the unified bus — distinct from `*.failed` because
|
|
317
|
+
* declining is a user choice, not an error. Analytics that count `.failed` events stay
|
|
318
|
+
* accurate.
|
|
319
|
+
*
|
|
320
|
+
* Legal from `submitting`. When the host doesn't call this explicitly, the kit's
|
|
321
|
+
* built-in rejection heuristic still classifies wallet-rejection-shaped errors as
|
|
322
|
+
* declines automatically.
|
|
323
|
+
*/
|
|
324
|
+
decline(): void;
|
|
325
|
+
/**
|
|
326
|
+
* Mark the withdraw succeeded directly. Useful when the host runs their own settlement
|
|
327
|
+
* verification independently of Stridge's poll. Legal from `submitting` and `inProgress`.
|
|
328
|
+
*/
|
|
329
|
+
succeed(): void;
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Host-supplied callback fired when the user submits the withdrawal form. The kit hands the
|
|
333
|
+
* callback the resolved {@link WithdrawSubmitInput} plus a {@link WithdrawSubmitActions} handle
|
|
334
|
+
* the host calls to advance the FSM. The kit does NOT await the callback's promise — the host
|
|
335
|
+
* is in control of pacing via the actions. The `signal` aborts when the user closes the dialog.
|
|
336
|
+
*/
|
|
337
|
+
type WithdrawSubmitCallback = (input: WithdrawSubmitInput, actions: WithdrawSubmitActions, signal: AbortSignal) => void | Promise<void>;
|
|
155
338
|
//#endregion
|
|
156
|
-
export { WithdrawActions, WithdrawController, WithdrawEvent, WithdrawState, WithdrawStateName, WithdrawalFormSnapshot };
|
|
339
|
+
export { WithdrawActions, WithdrawController, WithdrawEvent, WithdrawState, WithdrawStateName, WithdrawSubmitActions, WithdrawSubmitCallback, WithdrawSubmitInput, WithdrawalFormSnapshot };
|
|
@@ -19,5 +19,40 @@ import { WithdrawController } from "./types.js";
|
|
|
19
19
|
* ```
|
|
20
20
|
*/
|
|
21
21
|
declare function useWithdraw(): WithdrawController;
|
|
22
|
+
/**
|
|
23
|
+
* Non-throwing variant of {@link useWithdraw} — returns `null` when called outside a
|
|
24
|
+
* `<KitProvider withdraw={…} />`. Lets hosts mount `<StridgeProvider />` conditionally
|
|
25
|
+
* (e.g. only after a wallet is connected) without descendants crashing the moment they render
|
|
26
|
+
* before the provider exists.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* const withdraw = useOptionalWithdraw();
|
|
31
|
+
* return (
|
|
32
|
+
* <button onClick={() => withdraw?.open()} disabled={!withdraw}>
|
|
33
|
+
* Withdraw
|
|
34
|
+
* </button>
|
|
35
|
+
* );
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
declare function useOptionalWithdraw(): WithdrawController | null;
|
|
39
|
+
/**
|
|
40
|
+
* Headless prefetch handle for the withdraw driver. Returns a stable function that arms the
|
|
41
|
+
* driver — kicks off the deferred `supportedAssets` + initial `balance/onchain` bootstrap.
|
|
42
|
+
* Calling it before the user opens the dialog warms the cache so the subsequent
|
|
43
|
+
* `useWithdraw().open()` lands on populated data without a perceptible loading window.
|
|
44
|
+
*
|
|
45
|
+
* Fire-and-forget: returns `void`. Observe bootstrap state via
|
|
46
|
+
* `useWithdrawSnapshot().receiveOptions.status` if needed.
|
|
47
|
+
*
|
|
48
|
+
* ```tsx
|
|
49
|
+
* const withdraw = useWithdraw();
|
|
50
|
+
* const prefetchWithdraw = usePrefetchWithdraw();
|
|
51
|
+
* <button onMouseEnter={prefetchWithdraw} onClick={() => withdraw.open()}>Withdraw</button>;
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* Idempotent — subsequent calls are no-ops while the driver is already armed.
|
|
55
|
+
*/
|
|
56
|
+
declare function usePrefetchWithdraw(): () => void;
|
|
22
57
|
//#endregion
|
|
23
|
-
export { useWithdraw };
|
|
58
|
+
export { useOptionalWithdraw, usePrefetchWithdraw, useWithdraw };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
1
|
+
"use client";import{useWithdrawDriverInstance as e}from"../driver/context.js";import{useControllerContext as t,useOptionalControllerContext as n}from"./controller.js";import{useCallback as r}from"react";function i(){return t().controller}function a(){return n()?.controller??null}function o(){let t=e();return r(()=>{t.arm()},[t])}export{a as useOptionalWithdraw,o as usePrefetchWithdraw,i as useWithdraw};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/flows/withdraw/widgets/activity/WithdrawActivityDetail.d.ts
|
|
5
|
+
interface WithdrawActivityDetailOwnProps {
|
|
6
|
+
/**
|
|
7
|
+
* Optional custom composition forwarded to the underlying `<ActivityDetail>`
|
|
8
|
+
* compound. Defaults to mounting all three per-kind parts.
|
|
9
|
+
*/
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Orchestrated activity detail wrapper for the withdraw dialog. Mirrors
|
|
14
|
+
* {@link import("#/flows/deposit/widgets/activity").DepositActivityDetail}. Renders
|
|
15
|
+
* `null` while the FSM is not on `activityDetail`.
|
|
16
|
+
*/
|
|
17
|
+
declare function WithdrawActivityDetail({
|
|
18
|
+
children
|
|
19
|
+
}: WithdrawActivityDetailOwnProps): _$react_jsx_runtime0.JSX.Element | null;
|
|
20
|
+
declare namespace WithdrawActivityDetail {
|
|
21
|
+
type Props = WithdrawActivityDetailOwnProps;
|
|
22
|
+
const Processing: ({
|
|
23
|
+
children
|
|
24
|
+
}: {
|
|
25
|
+
children?: ReactNode;
|
|
26
|
+
}) => _$react_jsx_runtime0.JSX.Element | null;
|
|
27
|
+
const Succeeded: ({
|
|
28
|
+
children
|
|
29
|
+
}: {
|
|
30
|
+
children?: ReactNode;
|
|
31
|
+
}) => _$react_jsx_runtime0.JSX.Element | null;
|
|
32
|
+
const Failed: ({
|
|
33
|
+
children
|
|
34
|
+
}: {
|
|
35
|
+
children?: ReactNode;
|
|
36
|
+
}) => _$react_jsx_runtime0.JSX.Element | null;
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { WithdrawActivityDetail };
|
|
@@ -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{useWithdrawActivitySource as n}from"./useWithdrawActivitySource.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 WithdrawActivityDetail};
|