@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
package/README.md
CHANGED
|
@@ -10,28 +10,44 @@ React widgets and headless hooks for the Stridge Gateway — drop-in deposit and
|
|
|
10
10
|
pnpm add @stridge/kit
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
Peer dependencies: `react`, `react-dom`, `viem
|
|
13
|
+
Peer dependencies: `react`, `react-dom`, `viem`. `wagmi` is optional — required only when you enable the deposit/wallet method (the customer signs the source-chain transfer from their connected wallet). Withdraw and deposit/transfer-crypto work without wagmi.
|
|
14
14
|
|
|
15
15
|
## Quick start
|
|
16
16
|
|
|
17
17
|
```tsx
|
|
18
|
-
import { StridgeProvider
|
|
18
|
+
import { StridgeProvider } from "@stridge/kit";
|
|
19
19
|
import { DepositDialog } from "@stridge/kit/deposit/dialog";
|
|
20
20
|
import { WithdrawDialog } from "@stridge/kit/withdraw/dialog";
|
|
21
21
|
|
|
22
22
|
<StridgeProvider
|
|
23
23
|
gatewayKey={process.env.NEXT_PUBLIC_STRIDGE_GATEWAY_KEY!}
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
// `networkId` is the Stridge network id, listed at
|
|
25
|
+
// https://api.stridge.com/v1/uda/supported-assets — "9006" is BSC.
|
|
26
|
+
asset={{ networkId: "9006", symbol: "USDC" }}
|
|
27
|
+
flows={{
|
|
28
|
+
deposit: {
|
|
29
|
+
// Required — where bridged funds settle (your treasury, or the customer's wallet
|
|
30
|
+
// under a same-owner-only gateway-kit configuration).
|
|
31
|
+
destination: { address: customerAddress },
|
|
32
|
+
// Optional — `gateway/start.owner` for deposit UDAs. Falls back to the connected
|
|
33
|
+
// wagmi wallet when omitted.
|
|
34
|
+
owner: { address: customerAddress },
|
|
35
|
+
},
|
|
36
|
+
withdraw: {
|
|
37
|
+
// Required — `gateway/start.owner` for withdraw UDAs. The kit scopes settlement
|
|
38
|
+
// polls against this address.
|
|
39
|
+
owner: { address: customerAddress },
|
|
40
|
+
},
|
|
41
|
+
}}
|
|
26
42
|
appearance={{ theme: "dark", accent: "oklch(78% 0.15 240)", radius: "rounded" }}
|
|
27
43
|
>
|
|
28
44
|
<YourApp />
|
|
29
45
|
<DepositDialog />
|
|
30
|
-
<WithdrawDialog />
|
|
46
|
+
<WithdrawDialog balance={liveBalance} onSubmit={handleWithdrawSubmit} />
|
|
31
47
|
</StridgeProvider>;
|
|
32
48
|
```
|
|
33
49
|
|
|
34
|
-
Open or close the dialogs with `useDeposit().open()` / `useWithdraw().open()`. Headless integrators render their own UI via `useDeposit()`, `useDepositState()`, `useDepositSnapshot()` and the withdraw mirrors — the root entry ships no UI, so the headless bundle stays clean.
|
|
50
|
+
Open or close the dialogs with `useDeposit().open()` / `useWithdraw().open()`. Headless integrators render their own UI via `useDeposit()`, `useDepositState()`, `useDepositSnapshot()` and the withdraw mirrors — the root entry ships no UI, so the headless bundle stays clean. `useOptionalDeposit()` / `useOptionalWithdraw()` return `null` when called outside the provider, for hosts that mount `<StridgeProvider />` conditionally (e.g. only after a wallet is connected).
|
|
35
51
|
|
|
36
52
|
## Documentation
|
|
37
53
|
|
package/dist/KitProvider.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { DepositDriver } from "./flows/deposit/driver/types.js";
|
|
2
|
+
import { DepositMethodsConfig } from "./flows/deposit/orchestrator/types.js";
|
|
2
3
|
import { WithdrawDriver } from "./flows/withdraw/driver/types.js";
|
|
3
4
|
import { KitScope } from "./scope/KitScope.js";
|
|
4
5
|
import { KitI18nConfig } from "./shared/i18n/createKitI18n.js";
|
|
6
|
+
import { IntercomMerchantContext } from "./shared/support/useIntercomMerchantContext.js";
|
|
7
|
+
import { SupportConfig } from "./shared/support/types.js";
|
|
8
|
+
import { TermsConfig } from "./shared/terms/types.js";
|
|
5
9
|
import { KitStoragePersistence } from "./storage/types.js";
|
|
6
10
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
7
11
|
|
|
@@ -45,9 +49,14 @@ declare function KitProvider({
|
|
|
45
49
|
i18n,
|
|
46
50
|
direction,
|
|
47
51
|
deposit,
|
|
52
|
+
depositMethods,
|
|
48
53
|
withdraw,
|
|
49
54
|
storage,
|
|
50
55
|
storageNamespace,
|
|
56
|
+
support,
|
|
57
|
+
merchantContext,
|
|
58
|
+
terms,
|
|
59
|
+
attribution,
|
|
51
60
|
...scopeProps
|
|
52
61
|
}: KitProvider.Props): _$react_jsx_runtime0.JSX.Element;
|
|
53
62
|
declare namespace KitProvider {
|
|
@@ -65,6 +74,14 @@ declare namespace KitProvider {
|
|
|
65
74
|
* `@stridge/kit/deposit/dialog` read from it.
|
|
66
75
|
*/
|
|
67
76
|
deposit?: DepositDriver;
|
|
77
|
+
/**
|
|
78
|
+
* Per-method host disable lever for the deposit-method picker. Lets the host mark Wallet
|
|
79
|
+
* or Transfer Crypto unavailable for the current user (embedded-wallet hosts, KYC gates,
|
|
80
|
+
* regional restrictions, …) without removing the option from the picker. Surfaced as a
|
|
81
|
+
* natively disabled tile with the optional `disabledHint` rendered inline as the meta
|
|
82
|
+
* line below the title.
|
|
83
|
+
*/
|
|
84
|
+
depositMethods?: DepositMethodsConfig;
|
|
68
85
|
/**
|
|
69
86
|
* Host-supplied {@link WithdrawDriver} — source of reactive data + imperative actions for
|
|
70
87
|
* the withdraw flow. When supplied, the provider mounts the withdraw driver context and
|
|
@@ -85,6 +102,18 @@ declare namespace KitProvider {
|
|
|
85
102
|
* keep state isolated. Defaults to `stridge-kit:storage:v1`.
|
|
86
103
|
*/
|
|
87
104
|
storageNamespace?: string;
|
|
105
|
+
/**
|
|
106
|
+
* Merchant-configurable in-dialog "Get help" override for direct `<KitProvider />` mounts.
|
|
107
|
+
*/
|
|
108
|
+
support?: SupportConfig;
|
|
109
|
+
/**
|
|
110
|
+
* Merchant and user triage metadata passed to merchant-owned support callbacks.
|
|
111
|
+
*/
|
|
112
|
+
merchantContext?: IntercomMerchantContext;
|
|
113
|
+
/**
|
|
114
|
+
* Merchant-configurable terms link for direct `<KitProvider />` mounts.
|
|
115
|
+
*/
|
|
116
|
+
terms?: TermsConfig;
|
|
88
117
|
}
|
|
89
118
|
}
|
|
90
119
|
//#endregion
|
package/dist/KitProvider.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{KitStorageProvider as e}from"./storage/context.js";import"./storage/index.js";import{DepositDriverProvider as t}from"./flows/deposit/driver/context.js";import{getLocaleDirection as n}from"./shared/i18n/getLocaleDirection.js";import{KitI18nProvider as r}from"./shared/i18n/KitI18nProvider.js";import"./i18n/index.js";import{GatewayController as i}from"./flows/deposit/orchestrator/controller.js";import{
|
|
1
|
+
"use client";import{KitStorageProvider as e}from"./storage/context.js";import"./storage/index.js";import{DepositDriverProvider as t}from"./flows/deposit/driver/context.js";import{getLocaleDirection as n}from"./shared/i18n/getLocaleDirection.js";import{KitI18nProvider as r}from"./shared/i18n/KitI18nProvider.js";import"./i18n/index.js";import{GatewayController as i}from"./flows/deposit/orchestrator/controller.js";import{WithdrawBindingsProvider as a}from"./flows/withdraw/bindings/WithdrawBindings.js";import"./flows/withdraw/bindings/index.js";import{WithdrawDriverProvider as o}from"./flows/withdraw/driver/context.js";import{WithdrawControllerProvider as s}from"./flows/withdraw/orchestrator/controller.js";import{KitScope as c}from"./scope/KitScope.js";import"./scope/index.js";import{SupportConfigContext as l}from"./shared/support/SupportConfigContext.js";import{TermsConfigContext as u}from"./shared/terms/TermsConfigContext.js";import{useMemo as d}from"react";import{jsx as f}from"react/jsx-runtime";import{LazyMotion as p,domMax as m}from"motion/react";function h({children:h,i18n:g,direction:_,deposit:v,depositMethods:y,withdraw:b,storage:x,storageNamespace:S,support:C,merchantContext:w,terms:T,attribution:E=`visible`,...D}){let O=n(g?.locale),k=h;b&&(k=f(a,{children:f(o,{driver:b,children:f(s,{children:k})})})),v&&(k=f(t,{driver:v,children:f(i,{methodsConfig:y,children:k})}));let A=d(()=>({config:C,merchantContext:w??null}),[C,w]),j=C!==void 0||w!==void 0,M=d(()=>({config:T}),[T]),N=T!==void 0,P=f(r,{locale:g?.locale,messages:g?.messages,children:f(c,{...D,direction:_??O,locale:g?.locale,attribution:E,children:f(e,{storage:x,namespace:S,children:k})})});return j&&(P=f(l.Provider,{value:A,children:P})),N&&(P=f(u.Provider,{value:M,children:P})),f(p,{features:m,children:P})}export{h as KitProvider};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { DialogShell, DialogShellControls, DialogShellProps } from "../../../shared/dialog/DialogShell.js";
|
|
2
|
+
import { DepositHistoryDetail } from "../../../flows/deposit/widgets/activity-history/DepositHistoryDetail.js";
|
|
3
|
+
import { DepositHistoryList } from "../../../flows/deposit/widgets/activity-history/DepositHistoryList.js";
|
|
2
4
|
import { AmountEntry } from "../../../flows/deposit/widgets/amount-entry/AmountEntry.js";
|
|
3
5
|
import { AssetPicker } from "../../../flows/deposit/widgets/asset-picker/AssetPicker.js";
|
|
4
6
|
import { ConfirmDeposit } from "../../../flows/deposit/widgets/confirm-deposit/ConfirmDeposit.js";
|
|
@@ -8,4 +10,4 @@ import { ErrorState } from "../../../flows/deposit/widgets/error-state/ErrorStat
|
|
|
8
10
|
import { ProcessingState } from "../../../flows/deposit/widgets/processing-state/ProcessingState.js";
|
|
9
11
|
import { SuccessState } from "../../../flows/deposit/widgets/success-state/SuccessState.js";
|
|
10
12
|
import { TransferCrypto } from "../../../flows/deposit/widgets/transfer-crypto/TransferCrypto.js";
|
|
11
|
-
export { AmountEntry, AssetPicker, ConfirmDeposit, Deposit, DepositStatusBanner, DialogShell, type DialogShellControls, type DialogShellProps, ErrorState, ProcessingState, SuccessState, TransferCrypto };
|
|
13
|
+
export { AmountEntry, AssetPicker, ConfirmDeposit, Deposit, DepositHistoryDetail, DepositHistoryList, DepositStatusBanner, DialogShell, type DialogShellControls, type DialogShellProps, ErrorState, ProcessingState, SuccessState, TransferCrypto };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DialogShell as e}from"../../../shared/dialog/DialogShell.js";import{
|
|
1
|
+
import{DialogShell as e}from"../../../shared/dialog/DialogShell.js";import{DepositHistoryDetail as t}from"../../../flows/deposit/widgets/activity-history/DepositHistoryDetail.js";import{DepositHistoryList as n}from"../../../flows/deposit/widgets/activity-history/DepositHistoryList.js";import"../../../flows/deposit/widgets/activity-history/index.js";import{AmountEntry as r}from"../../../flows/deposit/widgets/amount-entry/AmountEntry.js";import"../../../flows/deposit/widgets/amount-entry/index.js";import{AssetPicker as i}from"../../../flows/deposit/widgets/asset-picker/AssetPicker.js";import"../../../flows/deposit/widgets/asset-picker/index.js";import{ConfirmDeposit as a}from"../../../flows/deposit/widgets/confirm-deposit/ConfirmDeposit.js";import"../../../flows/deposit/widgets/confirm-deposit/index.js";import{Deposit as o}from"../../../flows/deposit/widgets/deposit/Deposit.js";import"../../../flows/deposit/widgets/deposit/index.js";import{DepositStatusBanner as s}from"../../../flows/deposit/widgets/deposit-status-banner/DepositStatusBanner.js";import"../../../flows/deposit/widgets/deposit-status-banner/index.js";import{ErrorState as c}from"../../../flows/deposit/widgets/error-state/ErrorState.js";import"../../../flows/deposit/widgets/error-state/index.js";import{ProcessingState as l}from"../../../flows/deposit/widgets/processing-state/ProcessingState.js";import"../../../flows/deposit/widgets/processing-state/index.js";import{SuccessState as u}from"../../../flows/deposit/widgets/success-state/SuccessState.js";import"../../../flows/deposit/widgets/success-state/index.js";import{TransferCrypto as d}from"../../../flows/deposit/widgets/transfer-crypto/TransferCrypto.js";import"../../../flows/deposit/widgets/transfer-crypto/index.js";export{r as AmountEntry,i as AssetPicker,a as ConfirmDeposit,o as Deposit,t as DepositHistoryDetail,n as DepositHistoryList,s as DepositStatusBanner,e as DialogShell,c as ErrorState,l as ProcessingState,u as SuccessState,d as TransferCrypto};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { StridgeChainSlug, StridgeRpc, StridgeRpcConfig, StridgeRpcWaitInput, createStridgeRpc } from "../../../drivers/stridge/rpc.js";
|
|
2
|
-
import { STRIDGE_DEFAULT_ENVIRONMENT,
|
|
2
|
+
import { STRIDGE_DEFAULT_ENVIRONMENT, StridgeDriverConfig, StridgeDriverDestination, StridgeEnvironment, StridgePollIntervals, StridgeTokenIconResolverEntry } from "../../../drivers/stridge/types.js";
|
|
3
|
+
import { CreateStridgeCatalogInput, StridgeCatalog, createStridgeCatalog } from "../../../drivers/stridge/catalog.js";
|
|
3
4
|
import { CreateStridgeDepositDriverInput, createStridgeDepositDriver } from "../../../drivers/stridge/createStridgeDepositDriver.js";
|
|
4
5
|
import { CreateStridgeWithdrawDriverInput, StridgeWithdrawCurrency, createStridgeWithdrawDriver } from "../../../drivers/stridge/createStridgeWithdrawDriver.js";
|
|
5
6
|
import { GatewayStartResponse, SupportedAssetsResponse } from "@stridge/sdk";
|
|
6
|
-
export { type CreateStridgeDepositDriverInput, type CreateStridgeWithdrawDriverInput, type GatewayStartResponse, STRIDGE_DEFAULT_ENVIRONMENT,
|
|
7
|
+
export { type CreateStridgeCatalogInput, type CreateStridgeDepositDriverInput, type CreateStridgeWithdrawDriverInput, type GatewayStartResponse, STRIDGE_DEFAULT_ENVIRONMENT, type StridgeCatalog, type StridgeChainSlug, type StridgeDriverConfig, type StridgeDriverDestination, type StridgeEnvironment, type StridgePollIntervals, type StridgeRpc, type StridgeRpcConfig, type StridgeRpcWaitInput, type StridgeTokenIconResolverEntry, type StridgeWithdrawCurrency, type SupportedAssetsResponse, createStridgeCatalog, createStridgeDepositDriver, createStridgeRpc, createStridgeWithdrawDriver };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{STRIDGE_DEFAULT_ENVIRONMENT as e
|
|
1
|
+
import{STRIDGE_DEFAULT_ENVIRONMENT as e}from"../../../drivers/stridge/types.js";import{createStridgeCatalog as t}from"../../../drivers/stridge/catalog.js";import{createStridgeRpc as n}from"../../../drivers/stridge/rpc.js";import{createStridgeDepositDriver as r}from"../../../drivers/stridge/createStridgeDepositDriver.js";import{createStridgeWithdrawDriver as i}from"../../../drivers/stridge/createStridgeWithdrawDriver.js";export{e as STRIDGE_DEFAULT_ENVIRONMENT,t as createStridgeCatalog,r as createStridgeDepositDriver,n as createStridgeRpc,i as createStridgeWithdrawDriver};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Entity, SettlementFailureKind, TxRef } from "../../../shared/driver/types.js";
|
|
2
2
|
import { ReceiveOptionDto, ReceiveOptionsResponse, WithdrawableBalanceDto, WithdrawableBalancesResponse, WithdrawalQuoteDto, WithdrawalQuoteResponse, WithdrawalSettlementDto, WithdrawalSettlementResponse } from "../../../flows/withdraw/driver/dto.js";
|
|
3
3
|
import { ReceiveChainPayload, ReceiveTokenOptionPayload, WithdrawableBalanceItemPayload, WithdrawalQuoteBreakdownPayload, WithdrawalQuotePayload, WithdrawalReceiveAssetPayload, WithdrawalSettlementFailurePayload, WithdrawalSettlementPayload, WithdrawalSettlementPendingPayload, WithdrawalSettlementSuccessPayload } from "../../../flows/withdraw/driver/payloads.js";
|
|
4
|
-
import {
|
|
4
|
+
import { PrepareWithdrawalInput, RequestWithdrawalQuoteInput, WatchWithdrawableBalancesInput, WatchWithdrawalSettlementInput, WithdrawDriver, WithdrawPreparation, WithdrawSnapshot } from "../../../flows/withdraw/driver/types.js";
|
|
5
5
|
import { WithdrawDriverProvider, useWithdrawDriverInstance, useWithdrawSnapshot } from "../../../flows/withdraw/driver/context.js";
|
|
6
|
-
export { type Entity, type ReceiveChainPayload, type ReceiveOptionDto, type ReceiveOptionsResponse, type ReceiveTokenOptionPayload, type RequestWithdrawalQuoteInput, type SettlementFailureKind, type
|
|
6
|
+
export { type Entity, type PrepareWithdrawalInput, type ReceiveChainPayload, type ReceiveOptionDto, type ReceiveOptionsResponse, type ReceiveTokenOptionPayload, type RequestWithdrawalQuoteInput, type SettlementFailureKind, type TxRef, type WatchWithdrawableBalancesInput, type WatchWithdrawalSettlementInput, type WithdrawDriver, WithdrawDriverProvider, type WithdrawPreparation, type WithdrawSnapshot, type WithdrawableBalanceDto, type WithdrawableBalanceItemPayload, type WithdrawableBalancesResponse, type WithdrawalQuoteBreakdownPayload, type WithdrawalQuoteDto, type WithdrawalQuotePayload, type WithdrawalQuoteResponse, type WithdrawalReceiveAssetPayload, type WithdrawalSettlementDto, type WithdrawalSettlementFailurePayload, type WithdrawalSettlementPayload, type WithdrawalSettlementPendingPayload, type WithdrawalSettlementResponse, type WithdrawalSettlementSuccessPayload, useWithdrawDriverInstance, useWithdrawSnapshot };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { WithdrawHistoryDetail } from "../../../flows/withdraw/widgets/activity-history/WithdrawHistoryDetail.js";
|
|
2
|
+
import { WithdrawHistoryList } from "../../../flows/withdraw/widgets/activity-history/WithdrawHistoryList.js";
|
|
1
3
|
import { WithdrawError } from "../../../flows/withdraw/widgets/withdraw-error/WithdrawError.js";
|
|
2
4
|
import { WithdrawForm } from "../../../flows/withdraw/widgets/withdraw-form/WithdrawForm.js";
|
|
3
5
|
import { WithdrawInProgress } from "../../../flows/withdraw/widgets/withdraw-in-progress/WithdrawInProgress.js";
|
|
4
6
|
import { WithdrawSuccess } from "../../../flows/withdraw/widgets/withdraw-success/WithdrawSuccess.js";
|
|
5
|
-
export { WithdrawError, WithdrawForm, WithdrawInProgress, WithdrawSuccess };
|
|
7
|
+
export { WithdrawError, WithdrawForm, WithdrawHistoryDetail, WithdrawHistoryList, WithdrawInProgress, WithdrawSuccess };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{WithdrawHistoryDetail as e}from"../../../flows/withdraw/widgets/activity-history/WithdrawHistoryDetail.js";import{WithdrawHistoryList as t}from"../../../flows/withdraw/widgets/activity-history/WithdrawHistoryList.js";import"../../../flows/withdraw/widgets/activity-history/index.js";import{WithdrawError as n}from"../../../flows/withdraw/widgets/withdraw-error/WithdrawError.js";import"../../../flows/withdraw/widgets/withdraw-error/index.js";import{WithdrawForm as r}from"../../../flows/withdraw/widgets/withdraw-form/WithdrawForm.js";import"../../../flows/withdraw/widgets/withdraw-form/index.js";import{WithdrawInProgress as i}from"../../../flows/withdraw/widgets/withdraw-in-progress/WithdrawInProgress.js";import"../../../flows/withdraw/widgets/withdraw-in-progress/index.js";import{WithdrawSuccess as a}from"../../../flows/withdraw/widgets/withdraw-success/WithdrawSuccess.js";import"../../../flows/withdraw/widgets/withdraw-success/index.js";export{n as WithdrawError,r as WithdrawForm,e as WithdrawHistoryDetail,t as WithdrawHistoryList,i as WithdrawInProgress,a as WithdrawSuccess};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ActivityHistoryPayload, ActivityHistoryRowPayload } from "../../shared/widgets/activity-history/payloads.js";
|
|
2
|
+
import { ActivityHistoryHeader, ActivityHistoryListHeader } from "../../shared/widgets/activity-history/compound/components/HistoryHeader.js";
|
|
3
|
+
import { ActivityHistoryRowProps } from "../../shared/widgets/activity-history/compound/components/Row.js";
|
|
4
|
+
import { ActivityHistory } from "../../shared/widgets/activity-history/compound/ActivityHistory.js";
|
|
5
|
+
import { ACTIVITY_HISTORY_SLOTS, ActivityHistorySlot } from "../../shared/widgets/activity-history/compound/ActivityHistory.slots.js";
|
|
6
|
+
import { ActivityHistoryDetail } from "../../shared/widgets/activity-history/compound/ActivityHistoryDetail.js";
|
|
7
|
+
import { ActivityHistorySourceProvider, ActivityHistorySourceValue, useActivityHistorySource } from "../../shared/widgets/activity-history/compound/context.js";
|
|
8
|
+
import { ACTIVITY_HISTORY_ROW_SLOTS, ActivityHistoryRowSlot } from "../../shared/widgets/activity-history/compound/Row.slots.js";
|
|
9
|
+
export { ACTIVITY_HISTORY_ROW_SLOTS, ACTIVITY_HISTORY_SLOTS, ActivityHistory, ActivityHistoryDetail, ActivityHistoryHeader, ActivityHistoryListHeader, type ActivityHistoryPayload, type ActivityHistoryRowPayload, type ActivityHistoryRowProps, type ActivityHistoryRowSlot, type ActivityHistorySlot, ActivityHistorySourceProvider, type ActivityHistorySourceValue, useActivityHistorySource };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ACTIVITY_HISTORY_SLOTS as e}from"../../shared/widgets/activity-history/compound/ActivityHistory.slots.js";import{ActivityHistorySourceProvider as t,useActivityHistorySource as n}from"../../shared/widgets/activity-history/compound/context.js";import{ActivityHistoryHeader as r,ActivityHistoryListHeader as i}from"../../shared/widgets/activity-history/compound/components/HistoryHeader.js";import{ACTIVITY_HISTORY_ROW_SLOTS as a}from"../../shared/widgets/activity-history/compound/Row.slots.js";import{ActivityHistory as o}from"../../shared/widgets/activity-history/compound/ActivityHistory.js";import{ActivityHistoryDetail as s}from"../../shared/widgets/activity-history/compound/ActivityHistoryDetail.js";export{a as ACTIVITY_HISTORY_ROW_SLOTS,e as ACTIVITY_HISTORY_SLOTS,o as ActivityHistory,s as ActivityHistoryDetail,r as ActivityHistoryHeader,i as ActivityHistoryListHeader,t as ActivityHistorySourceProvider,n as useActivityHistorySource};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { ConfirmTransferAmountsProps, ConfirmTransferBodyProps, ConfirmTransferBreakdown, ConfirmTransferBreakdownPercentRow, ConfirmTransferBreakdownProps, ConfirmTransferBreakdownTextRow, ConfirmTransferBreakdownUsdRow, ConfirmTransferDialogProps, ConfirmTransferDisclaimerProps, ConfirmTransferFooterProps, ConfirmTransferHeaderProps, ConfirmTransferHeroProps, ConfirmTransferMetaProps, ConfirmTransferProps, ConfirmTransferToken, ConfirmTransferTransfer } from "../../shared/widgets/confirm-transfer/compound/types.js";
|
|
2
2
|
import { ConfirmTransfer } from "../../shared/widgets/confirm-transfer/compound/ConfirmTransfer.js";
|
|
3
3
|
import { CONFIRM_TRANSFER_SLOTS, ConfirmTransferSlot } from "../../shared/widgets/confirm-transfer/compound/ConfirmTransfer.slots.js";
|
|
4
|
+
import { TransferCryptoAsset, TransferCryptoBodyProps, TransferCryptoChain, TransferCryptoDialogProps, TransferCryptoDisclosureProps, TransferCryptoHeaderProps, TransferCryptoProps, TransferCryptoToken } from "../../flows/deposit/widgets/transfer-crypto/compound/types.js";
|
|
4
5
|
import { DepositBodyProps, DepositDialogProps, DepositHeaderProps, DepositMethodInput, DepositMethodOption, DepositMethodProps, DepositMethodsProps, DepositProps } from "../../flows/deposit/widgets/deposit/compound/types.js";
|
|
6
|
+
import { DepositStepsProps } from "../../flows/deposit/widgets/deposit/compound/components/Steps.js";
|
|
5
7
|
import { Deposit } from "../../flows/deposit/widgets/deposit/compound/Deposit.js";
|
|
6
8
|
import { DEPOSIT_SLOTS, DepositSlot } from "../../flows/deposit/widgets/deposit/compound/Deposit.slots.js";
|
|
7
9
|
import { DepositStatusBannerAsset, DepositStatusBannerBodyProps, DepositStatusBannerCloseProps, DepositStatusBannerDetailProps, DepositStatusBannerDetailsProps, DepositStatusBannerFooterProps, DepositStatusBannerHeroProps, DepositStatusBannerKind, DepositStatusBannerPrimaryActionProps, DepositStatusBannerProps, DepositStatusBannerRowProps, DepositStatusBannerToggleProps, DepositStatusBannerTxRef } from "../../flows/deposit/widgets/deposit-status-banner/compound/types.js";
|
|
8
10
|
import { DepositStatusBanner } from "../../flows/deposit/widgets/deposit-status-banner/compound/DepositStatusBanner.js";
|
|
9
11
|
import { DEPOSIT_STATUS_BANNER_SLOTS, DepositStatusBannerSlot } from "../../flows/deposit/widgets/deposit-status-banner/compound/DepositStatusBanner.slots.js";
|
|
10
|
-
import { TransferCryptoAsset, TransferCryptoBodyProps, TransferCryptoChain, TransferCryptoDialogProps, TransferCryptoDisclosureProps, TransferCryptoHeaderProps, TransferCryptoProps, TransferCryptoToken } from "../../flows/deposit/widgets/transfer-crypto/compound/types.js";
|
|
11
12
|
import { TransferCrypto } from "../../flows/deposit/widgets/transfer-crypto/compound/TransferCrypto.js";
|
|
12
13
|
import { TRANSFER_CRYPTO_SLOTS, TransferCryptoSlot } from "../../flows/deposit/widgets/transfer-crypto/compound/TransferCrypto.slots.js";
|
|
13
14
|
import { AmountEntryBodyProps, AmountEntryDialogProps, AmountEntryFlowProps, AmountEntryFooterProps, AmountEntryHeaderProps, AmountEntryHeroProps, AmountEntryPercentPreset, AmountEntryPillsProps, AmountEntryProps, AmountEntryToken } from "../../shared/widgets/amount-entry/compound/types.js";
|
|
@@ -19,10 +20,10 @@ import { ASSET_PICKER_SLOTS, AssetPickerSlot } from "../../shared/widgets/asset-
|
|
|
19
20
|
import { ErrorStateActionsProps, ErrorStateAsset, ErrorStateAssetValueProps, ErrorStateBodyProps, ErrorStateDestination, ErrorStateDetailProps, ErrorStateDetailsProps, ErrorStateDialogProps, ErrorStateDisclosureChevronProps, ErrorStateHeaderProps, ErrorStateHelp, ErrorStateHelpInfoProps, ErrorStateHeroProps, ErrorStateMoreDetailsProps, ErrorStateProps, ErrorStateRowProps, ErrorStateSourceWallet, ErrorStateStatusValueProps, ErrorStateTxRef } from "../../shared/widgets/error-state/compound/types.js";
|
|
20
21
|
import { ErrorState } from "../../shared/widgets/error-state/compound/ErrorState.js";
|
|
21
22
|
import { ERROR_STATE_SLOTS, ErrorStateSlot } from "../../shared/widgets/error-state/compound/ErrorState.slots.js";
|
|
22
|
-
import {
|
|
23
|
+
import { ProcessingStateAsset, ProcessingStateBodyProps, ProcessingStateDetailProps, ProcessingStateDetailsProps, ProcessingStateDialogProps, ProcessingStateHeaderProps, ProcessingStateHeroProps, ProcessingStateProps, ProcessingStateRowProps, ProcessingStateSourceWallet, ProcessingStateStatusPillProps, ProcessingStateTxRef } from "../../shared/widgets/processing-state/compound/types.js";
|
|
23
24
|
import { ProcessingState } from "../../shared/widgets/processing-state/compound/ProcessingState.js";
|
|
24
25
|
import { PROCESSING_STATE_SLOTS, ProcessingStateSlot } from "../../shared/widgets/processing-state/compound/ProcessingState.slots.js";
|
|
25
26
|
import { SuccessStateActionsProps, SuccessStateAsset, SuccessStateAssetValueProps, SuccessStateBodyProps, SuccessStateDetailProps, SuccessStateDetailsProps, SuccessStateDialogProps, SuccessStateExplorer, SuccessStateHeaderProps, SuccessStateHeadlineProps, SuccessStateMoreDetailsProps, SuccessStateProps, SuccessStateRouteValueProps, SuccessStateRowProps, SuccessStateSourceWallet, SuccessStateStatusPillProps, SuccessStateTxRef } from "../../shared/widgets/success-state/compound/types.js";
|
|
26
27
|
import { SuccessState } from "../../shared/widgets/success-state/compound/SuccessState.js";
|
|
27
28
|
import { SUCCESS_STATE_SLOTS, SuccessStateSlot } from "../../shared/widgets/success-state/compound/SuccessState.slots.js";
|
|
28
|
-
export { AMOUNT_ENTRY_SLOTS, ASSET_PICKER_SLOTS, AmountEntry, AmountEntryBodyProps, AmountEntryDialogProps, AmountEntryFlowProps, AmountEntryFooterProps, AmountEntryHeaderProps, AmountEntryHeroProps, AmountEntryPercentPreset, AmountEntryPillsProps, AmountEntryProps, AmountEntrySlot, AmountEntryToken, AssetOption, AssetPicker, AssetPickerAssetProps, AssetPickerBodyProps, AssetPickerDialogProps, AssetPickerFooterProps, AssetPickerHeaderProps, AssetPickerListProps, AssetPickerProps, AssetPickerSlot, AssetPickerToken, CONFIRM_TRANSFER_SLOTS, ConfirmTransfer, ConfirmTransferAmountsProps, ConfirmTransferBodyProps, ConfirmTransferBreakdown, ConfirmTransferBreakdownPercentRow, ConfirmTransferBreakdownProps, ConfirmTransferBreakdownTextRow, ConfirmTransferBreakdownUsdRow, ConfirmTransferDialogProps, ConfirmTransferDisclaimerProps, ConfirmTransferFooterProps, ConfirmTransferHeaderProps, ConfirmTransferHeroProps, ConfirmTransferMetaProps, ConfirmTransferProps, ConfirmTransferSlot, ConfirmTransferToken, ConfirmTransferTransfer, DEPOSIT_SLOTS, DEPOSIT_STATUS_BANNER_SLOTS, Deposit, DepositBodyProps, DepositDialogProps, DepositHeaderProps, DepositMethodInput, DepositMethodOption, DepositMethodProps, DepositMethodsProps, DepositProps, DepositSlot, DepositStatusBanner, DepositStatusBannerAsset, DepositStatusBannerBodyProps, DepositStatusBannerCloseProps, DepositStatusBannerDetailProps, DepositStatusBannerDetailsProps, DepositStatusBannerFooterProps, DepositStatusBannerHeroProps, DepositStatusBannerKind, DepositStatusBannerPrimaryActionProps, DepositStatusBannerProps, DepositStatusBannerRowProps, DepositStatusBannerSlot, DepositStatusBannerToggleProps, DepositStatusBannerTxRef, ERROR_STATE_SLOTS, ErrorState, ErrorStateActionsProps, ErrorStateAsset, ErrorStateAssetValueProps, ErrorStateBodyProps, ErrorStateDestination, ErrorStateDetailProps, ErrorStateDetailsProps, ErrorStateDialogProps, ErrorStateDisclosureChevronProps, ErrorStateHeaderProps, ErrorStateHelp, ErrorStateHelpInfoProps, ErrorStateHeroProps, ErrorStateMoreDetailsProps, ErrorStateProps, ErrorStateRowProps, ErrorStateSlot, ErrorStateSourceWallet, ErrorStateStatusValueProps, ErrorStateTxRef, PROCESSING_STATE_SLOTS, ProcessingState,
|
|
29
|
+
export { AMOUNT_ENTRY_SLOTS, ASSET_PICKER_SLOTS, AmountEntry, AmountEntryBodyProps, AmountEntryDialogProps, AmountEntryFlowProps, AmountEntryFooterProps, AmountEntryHeaderProps, AmountEntryHeroProps, AmountEntryPercentPreset, AmountEntryPillsProps, AmountEntryProps, AmountEntrySlot, AmountEntryToken, AssetOption, AssetPicker, AssetPickerAssetProps, AssetPickerBodyProps, AssetPickerDialogProps, AssetPickerFooterProps, AssetPickerHeaderProps, AssetPickerListProps, AssetPickerProps, AssetPickerSlot, AssetPickerToken, CONFIRM_TRANSFER_SLOTS, ConfirmTransfer, ConfirmTransferAmountsProps, ConfirmTransferBodyProps, ConfirmTransferBreakdown, ConfirmTransferBreakdownPercentRow, ConfirmTransferBreakdownProps, ConfirmTransferBreakdownTextRow, ConfirmTransferBreakdownUsdRow, ConfirmTransferDialogProps, ConfirmTransferDisclaimerProps, ConfirmTransferFooterProps, ConfirmTransferHeaderProps, ConfirmTransferHeroProps, ConfirmTransferMetaProps, ConfirmTransferProps, ConfirmTransferSlot, ConfirmTransferToken, ConfirmTransferTransfer, DEPOSIT_SLOTS, DEPOSIT_STATUS_BANNER_SLOTS, Deposit, DepositBodyProps, DepositDialogProps, DepositHeaderProps, DepositMethodInput, DepositMethodOption, DepositMethodProps, DepositMethodsProps, DepositProps, DepositSlot, DepositStatusBanner, DepositStatusBannerAsset, DepositStatusBannerBodyProps, DepositStatusBannerCloseProps, DepositStatusBannerDetailProps, DepositStatusBannerDetailsProps, DepositStatusBannerFooterProps, DepositStatusBannerHeroProps, DepositStatusBannerKind, DepositStatusBannerPrimaryActionProps, DepositStatusBannerProps, DepositStatusBannerRowProps, DepositStatusBannerSlot, DepositStatusBannerToggleProps, DepositStatusBannerTxRef, DepositStepsProps, ERROR_STATE_SLOTS, ErrorState, ErrorStateActionsProps, ErrorStateAsset, ErrorStateAssetValueProps, ErrorStateBodyProps, ErrorStateDestination, ErrorStateDetailProps, ErrorStateDetailsProps, ErrorStateDialogProps, ErrorStateDisclosureChevronProps, ErrorStateHeaderProps, ErrorStateHelp, ErrorStateHelpInfoProps, ErrorStateHeroProps, ErrorStateMoreDetailsProps, ErrorStateProps, ErrorStateRowProps, ErrorStateSlot, ErrorStateSourceWallet, ErrorStateStatusValueProps, ErrorStateTxRef, PROCESSING_STATE_SLOTS, ProcessingState, ProcessingStateAsset, ProcessingStateBodyProps, ProcessingStateDetailProps, ProcessingStateDetailsProps, ProcessingStateDialogProps, ProcessingStateHeaderProps, ProcessingStateHeroProps, ProcessingStateProps, ProcessingStateRowProps, ProcessingStateSlot, ProcessingStateSourceWallet, ProcessingStateStatusPillProps, ProcessingStateTxRef, SUCCESS_STATE_SLOTS, SuccessState, SuccessStateActionsProps, SuccessStateAsset, SuccessStateAssetValueProps, SuccessStateBodyProps, SuccessStateDetailProps, SuccessStateDetailsProps, SuccessStateDialogProps, SuccessStateExplorer, SuccessStateHeaderProps, SuccessStateHeadlineProps, SuccessStateMoreDetailsProps, SuccessStateProps, SuccessStateRouteValueProps, SuccessStateRowProps, SuccessStateSlot, SuccessStateSourceWallet, SuccessStateStatusPillProps, SuccessStateTxRef, TRANSFER_CRYPTO_SLOTS, TransferCrypto, TransferCryptoAsset, TransferCryptoBodyProps, TransferCryptoChain, TransferCryptoDialogProps, TransferCryptoDisclosureProps, TransferCryptoHeaderProps, TransferCryptoProps, TransferCryptoSlot, TransferCryptoToken };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { StridgeEnvironment } from "./types.js";
|
|
2
|
+
import { ApiClient, SupportedAssetsResponse } from "@stridge/sdk";
|
|
3
|
+
|
|
4
|
+
//#region src/drivers/stridge/catalog.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Provider-scoped shared `Gateway.assets()` cache. Deduplicates the catalog fetch across the
|
|
7
|
+
* deposit and withdraw drivers when both flows are mounted in a single `<StridgeProvider>` — they
|
|
8
|
+
* `await` the same in-flight promise and one network round-trip serves both flows.
|
|
9
|
+
*
|
|
10
|
+
* The catalog never invalidates within a single provider lifecycle — `gateway/assets` is the
|
|
11
|
+
* merchant's catalog of routable chains / assets, which changes on the order of days, not user
|
|
12
|
+
* sessions. Hosts that need to invalidate unmount and remount the provider.
|
|
13
|
+
*
|
|
14
|
+
* BYO-driver hosts using `<KitProvider>` directly are unaffected — both `createStridge*Driver`
|
|
15
|
+
* factories accept `catalog` as an opt-in input and fall back to their own per-driver fetch when
|
|
16
|
+
* none is supplied.
|
|
17
|
+
*/
|
|
18
|
+
interface StridgeCatalog {
|
|
19
|
+
/**
|
|
20
|
+
* Resolve the shared `gateway/assets` cache. First call kicks off the network fetch;
|
|
21
|
+
* subsequent calls return the same in-flight promise (or its resolved value).
|
|
22
|
+
*
|
|
23
|
+
* Resolves with `null` when the fetch fails — every consumer treats a missing catalog as a
|
|
24
|
+
* soft degradation (the deposit driver flips its `target` entity to `error`; the withdraw
|
|
25
|
+
* driver flips `receiveOptions` to `error`; both still issue the initial `balance/onchain`
|
|
26
|
+
* call against the backend's catalog-wide default chain set).
|
|
27
|
+
*/
|
|
28
|
+
getSupportedAssets(): Promise<SupportedAssetsResponse | null>;
|
|
29
|
+
}
|
|
30
|
+
interface CreateStridgeCatalogInput {
|
|
31
|
+
/**
|
|
32
|
+
* Pre-built SDK client. Pass this when the caller already has a client they want the
|
|
33
|
+
* catalog to share (so request headers / dedup behavior stay consistent across calls).
|
|
34
|
+
* Mutually exclusive with `projectKey` / `environment`.
|
|
35
|
+
*/
|
|
36
|
+
sdk?: ApiClient;
|
|
37
|
+
/**
|
|
38
|
+
* Stridge project key. Used to build a dedicated SDK client when `sdk` is not supplied. The
|
|
39
|
+
* key authenticates `gateway/assets`, the merchant-filtered catalog endpoint.
|
|
40
|
+
*/
|
|
41
|
+
projectKey?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Stridge environment. Used only when `sdk` is not supplied. Defaults to `"production"`.
|
|
44
|
+
*/
|
|
45
|
+
environment?: StridgeEnvironment;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Build a {@link StridgeCatalog}. Wraps the `gateway/assets` call in the same one-shot retry
|
|
49
|
+
* helper the driver bootstrap uses so transient 5xx / 429 / network errors don't surface a hard
|
|
50
|
+
* "no catalog" state for the user.
|
|
51
|
+
*/
|
|
52
|
+
declare function createStridgeCatalog(input: CreateStridgeCatalogInput): StridgeCatalog;
|
|
53
|
+
//#endregion
|
|
54
|
+
export { CreateStridgeCatalogInput, StridgeCatalog, createStridgeCatalog };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{resolveSdkEnv as e}from"./internal/env.js";import{withOneShotRetry as t}from"./internal/retry.js";import{createApiClient as n}from"@stridge/sdk";function r(r){let i=r.sdk??n({projectKey:r.projectKey??``,env:e(r.environment)}),a=null;return{getSupportedAssets(){return a??=t(()=>i.gateway.assets()).catch(()=>null),a}}}export{r as createStridgeCatalog};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DepositDriver } from "../../flows/deposit/driver/types.js";
|
|
2
2
|
import { StridgeDriverConfig } from "./types.js";
|
|
3
|
+
import { StridgeCatalog } from "./catalog.js";
|
|
3
4
|
import { I18n } from "@lingui/core";
|
|
4
5
|
|
|
5
6
|
//#region src/drivers/stridge/createStridgeDepositDriver.d.ts
|
|
@@ -13,13 +14,21 @@ interface CreateStridgeDepositDriverInput extends StridgeDriverConfig {
|
|
|
13
14
|
* re-bootstrap. When omitted, falls back to the kit's English-only {@link defaultI18n}.
|
|
14
15
|
*/
|
|
15
16
|
getI18n?: () => I18n;
|
|
17
|
+
/**
|
|
18
|
+
* Provider-scoped shared catalog cache. When supplied, the driver awaits this single
|
|
19
|
+
* in-flight promise instead of issuing its own `Gateway.assets()` call — deduplicates the
|
|
20
|
+
* catalog fetch across deposit + withdraw drivers mounted under one `<StridgeProvider>`.
|
|
21
|
+
* When omitted, the driver falls back to its own per-instance fetch (the path BYO-driver
|
|
22
|
+
* hosts using `<KitProvider>` directly take).
|
|
23
|
+
*/
|
|
24
|
+
catalog?: StridgeCatalog;
|
|
16
25
|
}
|
|
17
26
|
/**
|
|
18
27
|
* Builds a Stridge-backed {@link DepositDriver}. Returns the unified driver contract — the kit's
|
|
19
28
|
* `<KitProvider deposit={…}>` consumes this directly, no separate `dataSource` / `operations`
|
|
20
29
|
* adapter layer.
|
|
21
30
|
*
|
|
22
|
-
* Bootstrap kicks off `gateway/start` + `
|
|
31
|
+
* Bootstrap kicks off `gateway/start` + `Gateway.assets()` in parallel on creation; the
|
|
23
32
|
* driver's `brand`, `target`, and `addresses` entities transition `loading` → `ready` once both
|
|
24
33
|
* responses land. The first `balance/onchain` fetch fires alongside, populating `balances`.
|
|
25
34
|
* Wallet identity is published synchronously from `userAddress`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defaultI18n as e}from"../../shared/i18n/defaultI18n.js";import{pickRelevantSettlement as t}from"../../flows/shared/transformers/pickRelevantSettlement.js";import{formatUsd as n}from"../../shared/format/formatUsd.js";import{balanceToBalancesPayload as r,buildRoutableAllowlist as i}from"../../flows/deposit/driver/transformers/balanceToBalancesPayload.js";import{quoteToPayload as a}from"../../flows/deposit/driver/transformers/quoteToPayload.js";import{settlementToPayload as o}from"../../flows/deposit/driver/transformers/settlementToPayload.js";import{startToAddressesPayload as s}from"../../flows/deposit/driver/transformers/startToAddressesPayload.js";import{startToBrandPayload as c}from"../../flows/deposit/driver/transformers/startToBrandPayload.js";import{startToTargetPayload as l}from"../../flows/deposit/driver/transformers/startToTargetPayload.js";import{walletAddressToWalletPayload as u}from"../../flows/deposit/driver/transformers/walletAddressToWalletPayload.js";import{defaultBlockExplorers as d}from"../../shared/utils/explorers.js";import{createEntityStore as f}from"../stridge-mock/store.js";import{NATIVE_QUOTE_ADDRESS as p,isStablecoinSymbol as m,toBaseUnits as ee}from"./internal/encoding.js";import"./types.js";import{resolveSdkEnv as h}from"./internal/env.js";import{buildKitMetadata as g}from"./internal/metadata.js";import{pollOnce as _}from"./internal/pollOnce.js";import{buildErc20OrNativeStep as v,signAndConfirm as y}from"./internal/signAndConfirm.js";import{startPoll as b}from"./poll.js";import{createStridgeRpc as te}from"./rpc.js";import{createWagmiSigner as x}from"./wagmiSigner.js";import{createApiClient as S}from"@stridge/sdk";function C(C){let O=S({projectKey:C.projectKey,env:h(C.environment)}),k=C.pollIntervals??{},A=k.detectionMs??2e3,j=k.processingMs??2e3,M=k.terminalMs??1e4,N=k.balancesMs??6e4,P=C.minDepositUsd??3,F=C.getI18n??(()=>e),I={...d(),...C.explorers??{}},L=C.destination.network_id,R=C.destination.asset_symbol,z=C.destination.to_address??C.userAddress,B=x({wagmiConfig:C.wagmiConfig}),V=C.rpc??te(),H={address:C.userAddress},U=f({brand:{status:`loading`},target:{status:`loading`},addresses:{status:`loading`},balances:{status:`loading`},quote:{status:`idle`},settlement:{status:`idle`},wallet:{status:`ready`,payload:u(H),raw:H,response:H}}),W,G,K,q;function J(){if(G)return K??=i(G),K}let Y=(async()=>{try{let[e,t]=await Promise.all([O.gateway.start({owner:C.userAddress,destination:{network_id:L,to_address:z,asset_symbol:R},metadata:g({flow:`deposit`,...C.metadata?{hostMetadata:C.metadata}:{},extras:{destination:{networkId:L,assetSymbol:R}}})}),O.uda.supportedAssets().catch(()=>null)]);W=e;let n=e.metadata?.brand_name;typeof n==`string`&&n.trim().length>0&&(q=n.trim());let r=F();if(t&&(G=t,K=void 0),U.update({brand:{status:`ready`,payload:c(e.metadata),raw:e.metadata,response:e},addresses:{status:`ready`,payload:s(e.deposit_addresses,{i18n:r,explorers:I,...t?{chainLogos:T(t)}:{},...t?{minDepositUsdByEip155Id:D(t,P),nativeAssetByEip155Id:E(t)}:{}}),raw:e.deposit_addresses,response:e}}),t){let e=l(t,{i18n:r,networkId:L,assetSymbol:R,minDepositUsd:P}),n=t.assets.find(e=>String(e.network_id)===L);e&&n?U.update({target:{status:`ready`,payload:e,raw:n,response:t}}):U.update({target:{status:`error`,error:Error(`Destination not found in supportedAssets catalog.`)}})}else U.update({target:{status:`error`,error:Error(`supportedAssets fetch failed.`)}})}catch(e){let t=e instanceof Error?e:Error(String(e));U.update({brand:{status:`error`,error:t},target:{status:`error`,error:t},addresses:{status:`error`,error:t}})}})(),X=!1,Z=(async()=>{try{let e=await O.balance.onchain(C.userAddress,{includeSpam:!1,includeZero:!1});await Y;let t=J();if(!t)return null;let n=r(e,{i18n:F(),routable:t,minDepositUsd:P,...C.resolveTokenIcon?{resolveTokenIcon:C.resolveTokenIcon}:{}});return U.update({balances:{status:`ready`,payload:n,raw:e,response:e},wallet:Q(n,F())}),e}catch(e){let t=e instanceof Error?e:Error(String(e));return U.update({balances:{status:`error`,error:t}}),null}})();function Q(e,t){let r=e.reduce((e,t)=>e+(t.amountUsd?.value??0),0);return{status:`ready`,payload:{...u(H),balanceTotalUsd:{value:r,formatted:n(r,t)}},raw:H,response:H}}return{getSnapshot(){return U.getSnapshot()},subscribe(e){return U.subscribe(e)},async requestQuote(e,t){U.update({quote:{status:`loading`}});let n=W;if(!n){U.update({quote:{status:`error`,error:Error(`gateway/start not yet resolved.`)}});return}try{let r=e.sourceChainId,i=e.sourceIsNative?p:e.sourceTokenAddress,o=ee(e.amount,e.sourceTokenDecimals),s=await O.uda.quote({fromNetworkId:r,fromAsset:i,toNetworkId:Number(n.destination.eip155_id),toAsset:n.destination.asset_address||`0x0000000000000000000000000000000000000000`,amount:o,fromAddress:C.userAddress,toAddress:z},{signal:t});if(t.aborted)return;let c=F(),l={chainId:r,networkName:w(r),eip155Id:String(r),symbol:e.sourceTokenSymbol,decimals:e.sourceTokenDecimals,address:e.sourceTokenAddress,isNative:e.sourceIsNative},u={chainId:Number(n.destination.eip155_id),networkName:n.destination.network_name,eip155Id:n.destination.eip155_id,symbol:n.destination.asset_symbol,decimals:n.destination.asset_decimals,address:n.destination.asset_address,isNative:!n.destination.asset_address},d=m(n.destination.asset_symbol)?1:void 0,f=a(s,{i18n:c,sendSide:l,receiveSide:u,sourceAmount:e.amount,now:Date.now(),...e.sourcePriceUsd===void 0?{}:{sendPriceUsd:e.sourcePriceUsd},...d===void 0?{}:{receivePriceUsd:d}});U.update({quote:{status:`ready`,payload:f,raw:s,response:s}})}catch(e){if(t.aborted)return;let n=e instanceof Error?e:Error(String(e));U.update({quote:{status:`error`,error:n}})}},async submitDeposit(e,t){let n=W;if(!n)throw Error(`gateway/start not yet resolved.`);let r=n.deposit_addresses.find(t=>Number(t.eip155_id)===Number(e.sourceChainId));if(!r)throw Error(`No Stridge deposit address provisioned on chain ${e.sourceChainId}. Pick a supported source chain.`);return y({signer:B,rpc:V,step:v({chainId:e.sourceChainId,from:C.userAddress,udaDepositAddress:r.address,amount:e.amount,decimals:e.sourceTokenDecimals,isNative:e.sourceIsNative,...e.sourceIsNative?{}:{sourceTokenAddress:e.sourceTokenAddress}}),signal:t,explorers:I,...C.receiptConfirmations===void 0?{}:{receiptConfirmations:C.receiptConfirmations},...C.receiptPollingIntervalMs===void 0?{}:{receiptPollingIntervalMs:C.receiptPollingIntervalMs}})},watchBalances(e,t,n){b({signal:n,fetch:async e=>{if(!X)return X=!0,Z;try{let t=await O.balance.onchain(C.userAddress,{signal:e,includeSpam:!1,includeZero:!1});await Y;let n=J();if(!n)return null;let i=r(t,{i18n:F(),routable:n,minDepositUsd:P,...C.resolveTokenIcon?{resolveTokenIcon:C.resolveTokenIcon}:{}});return U.update({balances:{status:`ready`,payload:i,raw:t,response:t},wallet:Q(i,F())}),t}catch{return null}},listener:()=>{t(U.getSnapshot().balances)},nextIntervalMs:()=>N})},watchSourceTx(e,t,n){let r=new Set,i={current:!1},a=!1;b({signal:n,fetch:e=>_(O,C.userAddress,$(),e),listener:e=>{if(a||!e)return;let n=e.settlements??[];if(!i.current){for(let e of n)r.add(e.id);i.current=!0;return}let o=n.find(e=>!r.has(e.id));if(!o)return;a=!0;let s=Number(o.from?.eip155_id??`0`);t({hash:o.from?.tx_id??``,...I[s]&&o.from?.tx_id?{explorerUrl:`${I[s].replace(/\/+$/,``)}/tx/${o.from.tx_id}`}:{}})},nextIntervalMs:()=>a?0:A})},watchSettlement(e,n,r){let i=e=>_(O,C.userAddress,$(),e),a=!1;b({signal:r,fetch:i,listener:r=>{if(!r)return;let i=t(r,{txHash:e.tx.hash});if(!i)return;let s=o(i,r,{i18n:F(),sourceWallet:{name:`Wallet`,address:C.userAddress},explorers:I,...q?{brandName:q}:{}});s.kind!==`pending`&&(a=!0);let c={status:`ready`,payload:s,raw:i,response:r};U.update({settlement:c}),n(c)},nextIntervalMs:()=>a?M:j})},async fetchActiveSettlement(e,n){let r=await _(O,C.userAddress,$(),n);if(!r)return null;let i=t(r);if(!i)return null;let a=o(i,r,{i18n:F(),sourceWallet:{name:`Wallet`,address:C.userAddress},explorers:I,...q?{brandName:q}:{}});return a.kind===`pending`?{payload:a,raw:i,response:r}:null}};function $(){return{network_id:L,asset_symbol:R,to_address:z}}}function w(e){switch(e){case 1:return`Ethereum`;case 56:return`BSC`;case 137:return`Polygon`;case 42161:return`Arbitrum`;case 10:return`Optimism`;case 8453:return`Base`;default:return`Chain ${e}`}}function T(e){let t={};for(let n of e.assets){let e=String(n.eip155_id),r=n.native_currency?.logo;r&&(t[e]=r)}return t}function E(e){let t={};for(let n of e.assets){let e=n.native_currency;if(!e?.symbol)continue;let r=String(n.eip155_id);t[r]={symbol:e.symbol,address:``,decimals:typeof e.decimals==`number`?e.decimals:18,isNative:!0,...e.logo?{assetLogoUrl:e.logo}:{}}}return t}function D(e,t){let n={};for(let r of e.assets){let e=String(r.eip155_id),i=r.native_currency?.min_deposit_usd,a=typeof i==`string`&&i.trim().length>0?Number.parseFloat(i):NaN;n[e]=Number.isFinite(a)?a:t}return n}export{C as createStridgeDepositDriver};
|
|
1
|
+
import{defaultI18n as e}from"../../shared/i18n/defaultI18n.js";import{NATIVE_QUOTE_ADDRESS as t,isStablecoinSymbol as n,toBaseUnits as r}from"./internal/encoding.js";import{resolveSdkEnv as i}from"./internal/env.js";import{buildKitMetadata as a}from"./internal/metadata.js";import{pollOnce as o}from"./internal/pollOnce.js";import{buildErc20OrNativeStep as s,signAndConfirm as c}from"./internal/signAndConfirm.js";import{buildEvmChainsParam as l}from"./internal/supportedChains.js";import{withOneShotRetry as u}from"./internal/retry.js";import{pickRelevantSettlement as d}from"../../flows/shared/transformers/pickRelevantSettlement.js";import{formatUsd as f}from"../../shared/format/formatUsd.js";import{balanceToBalancesPayload as p,buildRoutableAllowlist as m}from"../../flows/deposit/driver/transformers/balanceToBalancesPayload.js";import{quoteToPayload as ee}from"../../flows/deposit/driver/transformers/quoteToPayload.js";import{settlementToPayload as h}from"../../flows/deposit/driver/transformers/settlementToPayload.js";import{startToAddressesPayload as te}from"../../flows/deposit/driver/transformers/startToAddressesPayload.js";import{startToBrandPayload as ne}from"../../flows/deposit/driver/transformers/startToBrandPayload.js";import{startToTargetPayload as re}from"../../flows/deposit/driver/transformers/startToTargetPayload.js";import{walletAddressToWalletPayload as g}from"../../flows/deposit/driver/transformers/walletAddressToWalletPayload.js";import{historyResponseToPayload as ie}from"../../shared/widgets/activity-history/transformers/historyResponseToPayload.js";import{defaultBlockExplorers as _}from"../../shared/utils/explorers.js";import{createEntityStore as ae}from"../stridge-mock/store.js";import{startPoll as v}from"./poll.js";import{createStridgeRpc as y}from"./rpc.js";import{createWagmiSigner as oe}from"./wagmiSigner.js";import{BackendError as se,createApiClient as ce}from"@stridge/sdk";const b=3e4;function x(x){let w=ce({projectKey:x.projectKey,env:i(x.environment)}),T=x.pollIntervals??{},fe=T.detectionMs??2e3,pe=T.processingMs??2e3,E=T.terminalMs??1e4,me=T.balancesMs??6e4,D=x.minAmountUsd,O=x.maxAmountUsd,k=x.getI18n??(()=>e),A={..._(),...x.explorers??{}},j=x.destination.network_id,M=x.destination.asset_symbol,N=x.destination.to_address??x.userAddress,he=x.rpc??y(),P={address:x.userAddress},F=ae({brand:{status:`idle`},target:{status:`idle`},addresses:{status:`idle`},balances:{status:`idle`},quote:{status:`idle`},settlement:{status:`idle`},wallet:{status:`ready`,payload:g(P),raw:P,response:P},history:{status:`idle`}}),I,L,R,z,B=x.wagmiConfig?oe({wagmiConfig:x.wagmiConfig,getSupportedAssets:()=>L,explorers:A}):void 0;function V(){if(L)return R??=m(L),R}let H=!1,U=Promise.resolve(),W=!1,G=Promise.resolve(null),K=null;function q(){H||(H=!0,U=ge(),G=_e())}let J;async function Y(e){try{if(await U,e.aborted)return null;let t=l(L),n=await w.balance.onchain(x.userAddress,{signal:e,includeSpam:!1,includeZero:!1,...t?{chains:t}:{}});if(e.aborted)return null;K=Date.now();let r=V();if(!r)return F.update({balances:{status:`ready`,payload:[],raw:n,response:n}}),null;let i=p(n,{i18n:k(),routable:r,minAmountUsd:D,...x.resolveTokenIcon?{resolveTokenIcon:x.resolveTokenIcon}:{}});return F.update({balances:{status:`ready`,payload:i,raw:n,response:n},wallet:X(i,k())}),n}catch{return null}}async function ge(){F.update({brand:{status:`loading`},target:{status:`loading`},addresses:{status:`loading`},balances:{status:`loading`}});try{let[e,t]=await Promise.all([u(()=>w.gateway.start({owner:x.userAddress,destination:{network_id:j,to_address:N,asset_symbol:M},metadata:a({flow:`deposit`,...x.metadata?{hostMetadata:x.metadata}:{},extras:{destination:{networkId:j,assetSymbol:M}}})})),x.catalog?x.catalog.getSupportedAssets():u(()=>w.gateway.assets()).catch(()=>null)]);I=e;let n=e.metadata?.brand_name;typeof n==`string`&&n.trim().length>0&&(z=n.trim());let r=k();if(t&&(L=t,R=void 0),F.update({brand:{status:`ready`,payload:ne(e.metadata),raw:e.metadata,response:e},addresses:{status:`ready`,payload:te(e.deposit_addresses,{i18n:r,explorers:A,...t?{chainLogos:S(t)}:{},...t?{minAmountUsdByEip155Id:C(t,D),nativeAssetByEip155Id:ue(t),priceImpactByEip155Id:de(t)}:{}}),raw:e.deposit_addresses,response:e}}),t){let e=re(t,{i18n:r,networkId:j,assetSymbol:M,minAmountUsd:D,...O===void 0?{}:{maxAmountUsd:O}}),n=t.assets.find(e=>String(e.network_id)===j);e&&n?F.update({target:{status:`ready`,payload:e,raw:n,response:t}}):F.update({target:{status:`error`,error:Error(`Destination not found in supportedAssets catalog.`)}})}else F.update({target:{status:`error`,error:Error(`supportedAssets fetch failed.`)}})}catch(e){let t=e instanceof Error?e:Error(String(e));F.update({brand:{status:`error`,error:t},target:{status:`error`,error:t},addresses:{status:`error`,error:t}})}}async function _e(){try{await U;let e=l(L),t=await u(()=>w.balance.onchain(x.userAddress,{includeSpam:!1,includeZero:!1,...e?{chains:e}:{}}));K=Date.now();let n=V();if(!n)return F.update({balances:{status:`ready`,payload:[],raw:t,response:t}}),t;let r=p(t,{i18n:k(),routable:n,minAmountUsd:D,...x.resolveTokenIcon?{resolveTokenIcon:x.resolveTokenIcon}:{}});return F.update({balances:{status:`ready`,payload:r,raw:t,response:t},wallet:X(r,k())}),t}catch(e){let t=e instanceof Error?e:Error(String(e));return F.update({balances:{status:`error`,error:t}}),null}}function X(e,t){let n=e.reduce((e,t)=>e+(t.amountUsd?.value??0),0);return{status:`ready`,payload:{...g(P),balanceTotalUsd:{value:n,formatted:f(n,t)}},raw:P,response:P}}function ve(){let e=L?S(L):void 0;return{i18n:k(),ownerAddress:x.userAddress,...e?{chainLogoFor:t=>e[String(t)]}:{}}}function Z(e){let t=ie(e,ve());F.update({history:{status:`ready`,payload:t,raw:e.udas,response:e}})}async function Q(e){let t=F.getSnapshot().history;(t.status===`idle`||t.status===`error`)&&F.update({history:{status:`loading`}});try{let t=await w.gateway.poll(x.userAddress,{limit:20,signal:e});return e.aborted?null:(Z(t),t)}catch(t){if(e.aborted)return null;if(t instanceof se&&t.statusCode===404)return Z({owner:x.userAddress,filter:{},udas:[]}),null;let n=t instanceof Error?t:Error(String(t)),r=F.getSnapshot().history;return r.status===`ready`?(F.update({history:{status:`stale`,payload:r.payload,raw:r.raw,response:r.response}}),null):(r.status===`stale`||F.update({history:{status:`error`,error:n}}),null)}}return{getSnapshot(){return F.getSnapshot()},subscribe(e){return F.subscribe(e)},arm:q,async requestQuote(e,i){if(q(),F.update({quote:{status:`loading`}}),await U,i.aborted)return;let a=I;if(!a){F.update({quote:{status:`error`,error:Error(`gateway/start not yet resolved.`)}});return}try{let o=e.sourceChainId,s=e.sourceIsNative?t:e.sourceTokenAddress,c=r(e.amount,e.sourceTokenDecimals),l=await w.uda.quote({fromNetworkId:o,fromAsset:s,toNetworkId:Number(a.destination.eip155_id),toAsset:a.destination.asset_address||`0x0000000000000000000000000000000000000000`,amount:c,fromAddress:x.userAddress,toAddress:N},{signal:i});if(i.aborted)return;let u=k(),d={chainId:o,networkName:le(o),eip155Id:String(o),symbol:e.sourceTokenSymbol,decimals:e.sourceTokenDecimals,address:e.sourceTokenAddress,isNative:e.sourceIsNative},f={chainId:Number(a.destination.eip155_id),networkName:a.destination.network_name,eip155Id:a.destination.eip155_id,symbol:a.destination.asset_symbol,decimals:a.destination.asset_decimals,address:a.destination.asset_address,isNative:!a.destination.asset_address},p=n(a.destination.asset_symbol)?1:void 0,m=ee(l,{i18n:u,sendSide:d,receiveSide:f,sourceAmount:e.amount,now:Date.now(),...e.sourcePriceUsd===void 0?{}:{sendPriceUsd:e.sourcePriceUsd},...p===void 0?{}:{receivePriceUsd:p}});F.update({quote:{status:`ready`,payload:m,raw:l,response:l}})}catch(e){if(i.aborted)return;let t=e instanceof Error?e:Error(String(e));F.update({quote:{status:`error`,error:t}})}},async submitDeposit(e,t){if(!B)throw Error(`Connect a wallet to sign and submit the deposit.`);if(q(),await U,t.aborted)throw new DOMException(`Aborted`,`AbortError`);let n=I;if(!n)throw Error(`gateway/start not yet resolved.`);let r=n.deposit_addresses.find(t=>Number(t.eip155_id)===Number(e.sourceChainId));if(!r)throw Error(`No Stridge deposit address provisioned on chain ${e.sourceChainId}. Pick a supported source chain.`);return c({signer:B,rpc:he,step:s({chainId:e.sourceChainId,from:x.userAddress,udaDepositAddress:r.address,amount:e.amount,decimals:e.sourceTokenDecimals,isNative:e.sourceIsNative,...e.sourceIsNative?{}:{sourceTokenAddress:e.sourceTokenAddress}}),signal:t,explorers:A,...x.receiptConfirmations===void 0?{}:{receiptConfirmations:x.receiptConfirmations},...x.receiptPollingIntervalMs===void 0?{}:{receiptPollingIntervalMs:x.receiptPollingIntervalMs}})},watchBalances(e,t,n){q(),v({signal:n,fetch:async e=>W?K!==null&&Date.now()-K<3e4?F.getSnapshot().balances:Y(e):(W=!0,G),listener:()=>{t(F.getSnapshot().balances)},nextIntervalMs:()=>me})},invalidateBalances(){K=null,J?.abort();let e=new AbortController;J=e,Y(e.signal).finally(()=>{J===e&&(J=void 0)})},watchSourceTx(e,t,n){q();let r=new Set,i={current:!1},a=!1;v({signal:n,fetch:async e=>{let{matched:t}=await o(w,x.userAddress,$(),e);return t},listener:e=>{if(a||!e)return;let n=e.settlements??[];if(!i.current){for(let e of n)r.add(e.id);i.current=!0;return}let o=n.find(e=>!r.has(e.id));if(!o)return;a=!0;let s=Number(o.from?.eip155_id??`0`);t({hash:o.from?.tx_id??``,...A[s]&&o.from?.tx_id?{explorerUrl:`${A[s].replace(/\/+$/,``)}/tx/${o.from.tx_id}`}:{}})},nextIntervalMs:()=>a?0:fe})},watchSettlement(e,t,n){let r=async e=>{let{matched:t}=await o(w,x.userAddress,$(),e);return t},i=!1;v({signal:n,fetch:r,listener:n=>{if(!n)return;let r=d(n,{txHash:e.tx.hash});if(!r)return;let a=h(r,n,{i18n:k(),sourceWallet:{name:`Wallet`,address:x.userAddress},explorers:A,...z?{brandName:z}:{}});a.kind!==`pending`&&(i=!0);let o={status:`ready`,payload:a,raw:r,response:n};F.update({settlement:o}),t(o)},nextIntervalMs:()=>i?E:pe})},async fetchActiveSettlement(e,t){let{matched:n}=await o(w,x.userAddress,$(),t);if(!n)return null;let r=d(n);if(!r)return null;let i=h(r,n,{i18n:k(),sourceWallet:{name:`Wallet`,address:x.userAddress},explorers:A,...z?{brandName:z}:{}});return i.kind===`pending`?{payload:i,raw:r,response:n}:null},refreshHistory(e){q(),Q(e)},watchHistory(e){q(),v({signal:e,fetch:e=>Q(e),listener:()=>{},nextIntervalMs:()=>{let e=F.getSnapshot().history;return e.status!==`ready`&&e.status!==`stale`?b:e.payload.rows.some(e=>e.status.kind===`pending`)?5e3:b}})}};function $(){return{network_id:j,asset_symbol:M,to_address:N}}}function le(e){switch(e){case 1:return`Ethereum`;case 56:return`BSC`;case 137:return`Polygon`;case 42161:return`Arbitrum`;case 10:return`Optimism`;case 8453:return`Base`;default:return`Chain ${e}`}}function S(e){let t={};for(let n of e.assets){let e=String(n.eip155_id),r=n.native_currency?.logo;r&&(t[e]=r)}return t}function ue(e){let t={};for(let n of e.assets){let e=n.native_currency;if(!e?.symbol)continue;let r=String(n.eip155_id),i=typeof e.price_impact==`string`?e.price_impact.trim():``;t[r]={symbol:e.symbol,address:``,decimals:typeof e.decimals==`number`?e.decimals:18,isNative:!0,...e.logo?{assetLogoUrl:e.logo}:{},...i?{priceImpact:i}:{}}}return t}function de(e){let t={};for(let n of e.assets){let e={};for(let t of n.assets??[]){let n=t.price_impact;typeof n==`string`&&n.trim().length>0&&t.address&&(e[t.address.toLowerCase()]=n.trim())}Object.keys(e).length>0&&(t[String(n.eip155_id)]=e)}return t}function C(e,t){let n={};for(let r of e.assets){let e=String(r.eip155_id),i=r.native_currency?.min_deposit_usd,a=typeof i==`string`&&i.trim().length>0?Number.parseFloat(i):NaN;n[e]=Number.isFinite(a)?a:t}return n}export{x as createStridgeDepositDriver};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { WithdrawDriver } from "../../flows/withdraw/driver/types.js";
|
|
2
2
|
import { StridgeRpc } from "./rpc.js";
|
|
3
3
|
import { StridgeEnvironment, StridgePollIntervals, StridgeTokenIconResolverEntry } from "./types.js";
|
|
4
|
+
import { StridgeCatalog } from "./catalog.js";
|
|
4
5
|
import { I18n } from "@lingui/core";
|
|
5
6
|
import { Config } from "wagmi";
|
|
6
7
|
|
|
@@ -28,7 +29,8 @@ interface StridgeWithdrawCurrency {
|
|
|
28
29
|
* recipient/chain/token, so the destination is per-submit (closure state) rather than
|
|
29
30
|
* driver-config.
|
|
30
31
|
* - No `confirmDisplay` — withdraw doesn't ship a confirm-deposit step.
|
|
31
|
-
* - No `
|
|
32
|
+
* - No bundled default for `minAmountUsd` — the floor only blocks submit when the host
|
|
33
|
+
* explicitly configures one.
|
|
32
34
|
*/
|
|
33
35
|
interface CreateStridgeWithdrawDriverInput {
|
|
34
36
|
/** Connected wallet EOA. Threaded as `gateway/start.owner` and `uda/quote.from_address`. */
|
|
@@ -52,12 +54,13 @@ interface CreateStridgeWithdrawDriverInput {
|
|
|
52
54
|
*/
|
|
53
55
|
currency: StridgeWithdrawCurrency;
|
|
54
56
|
/**
|
|
55
|
-
* Wagmi config
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
57
|
+
* Wagmi config slot — retained for symmetry with {@link import("./types").StridgeDriverConfig}
|
|
58
|
+
* but no longer consumed by the withdraw driver. Withdraw broadcasting is fully host-driven
|
|
59
|
+
* via the orchestrator's `onSubmit` callback + actions; the kit never signs the source-chain
|
|
60
|
+
* transfer to the UDA itself. Pass it for forward compatibility or omit entirely — both
|
|
61
|
+
* behave identically.
|
|
59
62
|
*/
|
|
60
|
-
wagmiConfig
|
|
63
|
+
wagmiConfig?: Config;
|
|
61
64
|
/**
|
|
62
65
|
* Stable `I18n` ref-getter. The driver re-runs transformers on read so locale flips don't
|
|
63
66
|
* re-bootstrap. When omitted, falls back to the kit's English-only {@link defaultI18n}.
|
|
@@ -78,33 +81,53 @@ interface CreateStridgeWithdrawDriverInput {
|
|
|
78
81
|
/** Polling cadence overrides. */
|
|
79
82
|
pollIntervals?: StridgePollIntervals;
|
|
80
83
|
/**
|
|
81
|
-
*
|
|
82
|
-
*
|
|
84
|
+
* Retained-for-symmetry RPC slot — accepted for parity with the deposit driver config but
|
|
85
|
+
* no longer consumed; the withdraw driver does not poll source-chain receipts (host-side
|
|
86
|
+
* `onSubmit` owns the broadcast lifecycle).
|
|
83
87
|
*/
|
|
84
88
|
rpc?: StridgeRpc;
|
|
85
|
-
/** Block confirmations to wait on before treating the broadcast tx as mined. Defaults to `1`. */
|
|
86
|
-
receiptConfirmations?: number;
|
|
87
|
-
/** Receipt polling interval in milliseconds while waiting for mining. */
|
|
88
|
-
receiptPollingIntervalMs?: number;
|
|
89
89
|
/**
|
|
90
90
|
* Optional metadata persisted on every UDA the driver provisions. Echoed back on
|
|
91
91
|
* `gateway/{owner}` and webhook payloads. Treat as untrusted display data on read. Merged
|
|
92
92
|
* UNDER the kit-set `kit_flow` / `kit_version` / `source` keys (kit keys win).
|
|
93
93
|
*/
|
|
94
94
|
metadata?: Record<string, unknown>;
|
|
95
|
+
/**
|
|
96
|
+
* Optional lower USD bound on the withdraw amount. Surfaced on
|
|
97
|
+
* {@link WithdrawSnapshot.minAmountUsd}; the form blocks submit with a localized "Min $X"
|
|
98
|
+
* CTA while the typed amount sits below this value. Omit to leave the form without a lower
|
|
99
|
+
* bound (only the wallet balance / non-zero gate apply).
|
|
100
|
+
*/
|
|
101
|
+
minAmountUsd?: number;
|
|
102
|
+
/**
|
|
103
|
+
* Optional upper USD bound on the withdraw amount. Surfaced on
|
|
104
|
+
* {@link WithdrawSnapshot.maxAmountUsd}; the form blocks submit with a localized "Max $X"
|
|
105
|
+
* CTA while the typed amount sits above this value. Omit to let the brand-currency balance
|
|
106
|
+
* be the only ceiling.
|
|
107
|
+
*/
|
|
108
|
+
maxAmountUsd?: number;
|
|
109
|
+
/**
|
|
110
|
+
* Provider-scoped shared catalog cache. When supplied, the driver awaits this single
|
|
111
|
+
* in-flight promise instead of issuing its own `Gateway.assets()` call — deduplicates the
|
|
112
|
+
* catalog fetch across deposit + withdraw drivers mounted under one `<StridgeProvider>`.
|
|
113
|
+
* When omitted, the driver falls back to its own per-instance fetch.
|
|
114
|
+
*/
|
|
115
|
+
catalog?: StridgeCatalog;
|
|
95
116
|
}
|
|
96
117
|
/**
|
|
97
118
|
* Builds a Stridge-backed {@link WithdrawDriver}. Returns the unified driver contract — the kit's
|
|
98
119
|
* `<KitProvider withdraw={…}>` consumes this directly, no separate `dataSource` / `operations`
|
|
99
120
|
* adapter layer.
|
|
100
121
|
*
|
|
101
|
-
* Bootstrap
|
|
122
|
+
* Bootstrap is lazy — `Gateway.assets()` and `balance/onchain` fire on the first `arm()`, not
|
|
123
|
+
* at construction. Inside `arm()` the two calls run sequentially (assets first so its EVM chain
|
|
124
|
+
* list can be threaded as the `chains` filter on the initial `balance/onchain` call). The
|
|
102
125
|
* `receiveOptions` entity transitions `loading → ready` once supportedAssets lands; the
|
|
103
126
|
* `withdrawableBalances` entity flips `loading → ready` after the first balance fetch (and the
|
|
104
127
|
* supportedAssets-derived source-currency lookup completes).
|
|
105
128
|
*
|
|
106
129
|
* `gateway/start` is **not** part of bootstrap — the destination is user-picked at submit time, so
|
|
107
|
-
* each `
|
|
130
|
+
* each `prepareWithdrawal` call provisions a fresh UDA scoped to the chosen recipient/chain/token.
|
|
108
131
|
* The destination is idempotent on `(owner, destination)`, so repeat submits to the same target
|
|
109
132
|
* dedupe to one UDA.
|
|
110
133
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{defaultI18n as e}from"../../shared/i18n/defaultI18n.js";import{
|
|
1
|
+
"use client";import{defaultI18n as e}from"../../shared/i18n/defaultI18n.js";import{NATIVE_QUOTE_ADDRESS as t,isStablecoinSymbol as n,toBaseUnits as r}from"./internal/encoding.js";import{resolveSdkEnv as i}from"./internal/env.js";import{buildKitMetadata as a}from"./internal/metadata.js";import{pollOnce as o}from"./internal/pollOnce.js";import{buildEvmChainsParam as s}from"./internal/supportedChains.js";import{withOneShotRetry as c}from"./internal/retry.js";import{pickRelevantSettlement as l}from"../../flows/shared/transformers/pickRelevantSettlement.js";import{formatUsd as u}from"../../shared/format/formatUsd.js";import{historyResponseToPayload as d}from"../../shared/widgets/activity-history/transformers/historyResponseToPayload.js";import{defaultBlockExplorers as f}from"../../shared/utils/explorers.js";import{createEntityStore as p}from"../stridge-mock/store.js";import{startPoll as m}from"./poll.js";import{balanceToWithdrawableBalancesPayload as h}from"../../flows/withdraw/driver/transformers/balanceToWithdrawableBalancesPayload.js";import{quoteToWithdrawalPayload as g}from"../../flows/withdraw/driver/transformers/quoteToWithdrawalPayload.js";import{settlementToWithdrawalPayload as _}from"../../flows/withdraw/driver/transformers/settlementToWithdrawalPayload.js";import{supportedAssetsToReceiveOptionsPayload as v}from"../../flows/withdraw/driver/transformers/supportedAssetsToReceiveOptionsPayload.js";import{BackendError as y,createApiClient as b}from"@stridge/sdk";const x=3e4;function S(S){let w=b({projectKey:S.projectKey,env:i(S.environment)}),T=S.pollIntervals??{},E=T.processingMs??2e3,D=T.terminalMs??1e4,O=T.balancesMs??6e4,k=S.getI18n??(()=>e),A={...f(),...S.explorers??{}},j=k(),M=p({withdrawableBalances:{status:`idle`},receiveOptions:{status:`idle`},quote:{status:`idle`},settlement:{status:`idle`},history:{status:`idle`},...S.minAmountUsd===void 0?{}:{minAmountUsd:{value:S.minAmountUsd,formatted:u(S.minAmountUsd,j)}},...S.maxAmountUsd===void 0?{}:{maxAmountUsd:{value:S.maxAmountUsd,formatted:u(S.maxAmountUsd,j)}}}),N,P,F;function I(e){let t=e.assets.find(e=>e.network_id===S.currency.networkId);if(!t)return;let n=S.currency.assetSymbol.toUpperCase(),r=t.native_currency?.symbol?.toUpperCase()===n?t.native_currency:void 0,i=t.assets.find(e=>e.symbol?.toUpperCase()===n),a={networkId:t.network_id,eip155Id:t.eip155_id,networkName:t.network_name,...t.native_currency?.logo?{chainLogoUrl:t.native_currency.logo}:{},decimals:i?.decimals??r?.decimals??18,address:i?.address??``,isNative:!i&&!!r,...i?.logo?{assetLogoUrl:i.logo}:r?.logo?{assetLogoUrl:r.logo}:{}};return i||r?a:void 0}function L(e){let t=k(),n=P,r=h(e,{i18n:t,networkId:S.currency.networkId,assetSymbol:S.currency.assetSymbol,...n?{fallbackMeta:{decimals:n.decimals,address:n.address,isNative:n.isNative,eip155Id:String(n.eip155Id),networkName:n.networkName,...n.chainLogoUrl?{chainLogoUrl:n.chainLogoUrl}:{},...n.assetLogoUrl?{assetLogoUrl:n.assetLogoUrl}:{}}}:{}});M.update({withdrawableBalances:{status:`ready`,payload:r,raw:e,response:e}})}let R=!1,z=Promise.resolve(),B=!1,V=null;function H(){R||(R=!0,z=U())}async function U(){M.update({withdrawableBalances:{status:`loading`},receiveOptions:{status:`loading`}});let e=S.catalog?await S.catalog.getSupportedAssets():await c(()=>w.gateway.assets()).catch(()=>null);if(e){N=e,P=I(e);let t=v(e);M.update({receiveOptions:{status:`ready`,payload:t,raw:e.assets,response:e}})}else M.update({receiveOptions:{status:`error`,error:Error(`supportedAssets fetch failed.`)}});let t=s(e??void 0),n=await c(()=>w.balance.onchain(S.userAddress,{includeSpam:!1,includeZero:!1,...t?{chains:t}:{}})).catch(()=>null);n?(V=Date.now(),L(n)):L({wallet_address:S.userAddress,fetched_at:new Date().toISOString(),total_usd:`0`,chains:[]})}function W(){return a({flow:`withdraw`,...S.metadata?{hostMetadata:S.metadata}:{},extras:{source:{networkId:S.currency.networkId,assetSymbol:S.currency.assetSymbol}}})}function G(e,t){if(!N)return;let n=N.assets.find(t=>t.eip155_id===e);if(!n)return;let r=t.toUpperCase(),i=n.native_currency?.symbol?.toUpperCase()===r?n.native_currency:void 0,a=n.assets.find(e=>e.symbol?.toUpperCase()===r);if(!(!i&&!a))return{chainId:n.eip155_id,symbol:a?.symbol??i?.symbol??t,decimals:a?.decimals??i?.decimals??18,address:a?.address??``,isNative:!a&&!!i,...a?.logo?{assetLogoUrl:a.logo}:i?.logo?{assetLogoUrl:i.logo}:{},networkId:n.network_id,networkName:n.network_name,...i?.logo?{chainLogoUrl:i.logo}:{}}}function K(e){let t=M.getSnapshot().receiveOptions;if(!(t.status!==`ready`&&t.status!==`stale`))return t.payload.find(t=>t.eip155Id===e)}function q(){let e=N?C(N):void 0;return{i18n:k(),ownerAddress:S.userAddress,...e?{chainLogoFor:t=>e[String(t)]}:{}}}function J(e){let t=d(e,q());M.update({history:{status:`ready`,payload:t,raw:e.udas,response:e}})}async function Y(e){let t=M.getSnapshot().history;(t.status===`idle`||t.status===`error`)&&M.update({history:{status:`loading`}});try{let t=await w.gateway.poll(S.userAddress,{limit:20,signal:e});return e.aborted?null:(J(t),t)}catch(t){if(e.aborted)return null;if(t instanceof y&&t.statusCode===404)return J({owner:S.userAddress,filter:{},udas:[]}),null;let n=t instanceof Error?t:Error(String(t)),r=M.getSnapshot().history;return r.status===`ready`?(M.update({history:{status:`stale`,payload:r.payload,raw:r.raw,response:r.response}}),null):(r.status===`stale`||M.update({history:{status:`error`,error:n}}),null)}}return{getSnapshot(){return M.getSnapshot()},subscribe(e){return M.subscribe(e)},arm:H,async requestQuote(e,i){H(),M.update({quote:{status:`loading`}});try{if(await z,i.aborted)return;let a=P;if(!a)throw Error(`Stridge withdraw driver: source currency ${S.currency.assetSymbol} not found on network ${S.currency.networkId} in supportedAssets.`);let o=G(e.receiveChainId,e.receiveTokenSymbol);if(!o)throw Error(`Stridge withdraw driver: receive asset ${e.receiveTokenSymbol} not found on chain ${e.receiveChainId} in supportedAssets.`);let s=r(e.amount,a.decimals),c=await w.uda.quote({fromNetworkId:a.eip155Id,fromAsset:a.isNative?t:a.address,toNetworkId:o.chainId,toAsset:o.isNative?t:o.address,amount:s,fromAddress:S.userAddress,toAddress:e.recipientAddress},{signal:i});if(i.aborted)return;let l=n(S.currency.assetSymbol)?1:void 0,u=n(o.symbol)?1:void 0,d=g(c,{i18n:k(),receiveSide:o,sourceAmount:e.amount,sendDecimals:a.decimals,sendSymbol:S.currency.assetSymbol,now:Date.now(),...l===void 0?{}:{sendPriceUsd:l},...u===void 0?{}:{receivePriceUsd:u}});M.update({quote:{status:`ready`,payload:d,raw:c,response:c}})}catch(e){if(i.aborted)return;let t=e instanceof Error?e:Error(String(e));M.update({quote:{status:`error`,error:t}})}},async prepareWithdrawal(e,t){if(H(),await z,t.aborted)throw new DOMException(`Aborted`,`AbortError`);let n=P;if(!n)throw Error(`Stridge withdraw driver: source currency ${S.currency.assetSymbol} not found on network ${S.currency.networkId} in supportedAssets.`);let r=G(e.receiveChainId,e.receiveTokenSymbol);if(!r)throw Error(`Stridge withdraw driver: receive asset ${e.receiveTokenSymbol} not found on chain ${e.receiveChainId} in supportedAssets.`);let i=await w.gateway.start({owner:S.userAddress,destination:{network_id:r.networkId??String(e.receiveChainId),asset_symbol:r.symbol,to_address:e.recipientAddress},metadata:W()},{signal:t});if(t.aborted)throw new DOMException(`Aborted`,`AbortError`);let a=i.deposit_addresses.find(e=>Number(e.eip155_id)===n.eip155Id);if(!a)throw Error(`Stridge withdraw driver: no UDA deposit address provisioned on chain ${n.eip155Id} for the brand currency. Check that supportedAssets advertises this chain.`);return F={network_id:r.networkId??String(e.receiveChainId),asset_symbol:r.symbol,to_address:e.recipientAddress},{depositTarget:{address:a.address,chainId:n.eip155Id,tokenSymbol:S.currency.assetSymbol,tokenAddress:n.isNative?``:n.address,tokenDecimals:n.decimals,isNative:n.isNative,amount:e.amount},correlation:{owner:S.userAddress}}},watchSettlement(e,t,n){let i=async e=>{let{matched:t}=await o(w,S.userAddress,F,e);return t},a=!1;m({signal:n,fetch:i,listener:n=>{if(!n)return;let i=P?r(e.form.amount,P.decimals).toString():void 0,o=e.tx?.hash?l(n,{txHash:e.tx.hash}):l(n,{bestMatch:{destination:{chainId:e.form.receiveChainId,tokenSymbol:e.form.receiveTokenSymbol,recipientAddress:e.form.recipientAddress},submittedAt:e.submittedAt,...i?{sourceAmountBaseUnits:i}:{}}});if(!o)return;let s=k(),c=K(Number(n.destination.eip155_id)),u=c?.tokens.find(e=>e.symbol===n.destination.asset_symbol),d={...c?.chainLogoUrl?{chainLogoUrl:c.chainLogoUrl}:{},...u?.assetLogoUrl?{assetLogoUrl:u.assetLogoUrl}:{},...c?.networkName?{networkName:c.networkName}:{}},f=_(o,n,{i18n:s,explorers:A,...Object.keys(d).length>0?{receiveAssetEnrichment:d}:{},...u?.decimals===void 0?{}:{receiveAssetDecimals:u.decimals}});f.kind!==`pending`&&(a=!0);let p={status:`ready`,payload:f,raw:o,response:n};M.update({settlement:p}),t(p)},nextIntervalMs:()=>a?D:E})},watchWithdrawableBalances(e,t,n){H(),m({signal:n,fetch:async e=>{if(!B){B=!0,await z;let e=M.getSnapshot().withdrawableBalances;return e.status===`ready`||e.status===`stale`?e.response:null}if(V!==null&&Date.now()-V<3e4)return null;try{if(await z,e.aborted)return null;let t=s(N),n=await w.balance.onchain(S.userAddress,{signal:e,includeSpam:!1,includeZero:!1,...t?{chains:t}:{}});return V=Date.now(),n}catch{return null}},listener:e=>{e&&L(e),t(M.getSnapshot().withdrawableBalances)},nextIntervalMs:()=>O})},refreshHistory(e){H(),Y(e)},watchHistory(e){H(),m({signal:e,fetch:e=>Y(e),listener:()=>{},nextIntervalMs:()=>{let e=M.getSnapshot().history;return e.status!==`ready`&&e.status!==`stale`?x:e.payload.rows.some(e=>e.status.kind===`pending`)?5e3:x}})}}}function C(e){let t={};for(let n of e.assets){let e=String(n.eip155_id),r=n.native_currency?.logo;r&&(t[e]=r)}return t}export{S as createStridgeWithdrawDriver};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{resolveAddEthereumChain as e}from"./resolveAddEthereumChain.js";import{numberToHex as t}from"viem";import{getAccount as n,switchChain as r}from"wagmi/actions";function i(e){let t=e,n=new Set;for(;t&&!n.has(t);){if(n.add(t),t instanceof Error&&t.name===`ChainNotConfiguredError`)return!0;t=t.cause}return!1}function a(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.code===4902||t.data?.originalError?.code===4902}async function o(o,s){let c=n(s.wagmiConfig);if(c.chainId===o)return;if(!c.connector)throw Error(`Connect a wallet to sign and submit the deposit.`);try{await r(s.wagmiConfig,{chainId:o});return}catch(e){if(!i(e))throw e}let l=e(o,{wagmiConfig:s.wagmiConfig,supportedAssets:s.getSupportedAssets(),explorers:s.explorers});if(!l)throw Error(`Unable to add chain ${o} to your wallet automatically. Add it manually in your wallet and try again.`);let u=await c.connector.getProvider({chainId:o}),d=t(o);try{await u.request({method:`wallet_switchEthereumChain`,params:[{chainId:d}]})}catch(e){if(!a(e))throw e;await u.request({method:`wallet_addEthereumChain`,params:[l]})}let f=await u.request({method:`eth_chainId`});if(Number.parseInt(f,16)!==o){let e=Error(`User rejected the chain switch after adding the network.`);throw e.name=`UserRejectedRequestError`,Object.assign(e,{code:4001}),e}}export{o as ensureWalletChain};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
async function e(e,
|
|
1
|
+
async function e(e,n,r,i){try{let a=await e.gateway.poll(n,{...r?{network_id:r.network_id,to_address:r.to_address,asset_symbol:r.asset_symbol}:{},signal:i});return{matched:t(a.udas,r),envelope:a}}catch(e){if(i.aborted)throw e;if(e.statusCode===404)return{matched:null,envelope:null};throw e}}function t(e,t){if(e.length===0)return null;if(!t)return e[0]??null;let n=t.to_address.toLowerCase(),r=t.asset_symbol.toUpperCase();return e.find(e=>e.destination.network_id===t.network_id&&(e.destination.asset_symbol??``).toUpperCase()===r&&(e.destination.address??``).toLowerCase()===n)??null}export{e as pollOnce};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{numberToHex as e}from"viem";const t=e=>`https://${e}.nodes.stridge.com`;function n(n,r){let i=r.wagmiConfig.chains.find(e=>e.id===n),a=r.supportedAssets?.assets.find(e=>e.chain_type===`EVM`&&e.eip155_id===n),o=i?.name??a?.network_name,s=i?.nativeCurrency.symbol??a?.native_currency.symbol,c=typeof a?.native_currency.decimals==`number`?a.native_currency.decimals:void 0,l=i?.nativeCurrency.decimals??c??18,u=i?.nativeCurrency.name??a?.native_currency.name??s;if(!o||!s||!u)return;let d=i?.rpcUrls.default?.http[0],f=[d&&d.length>0?d:t(n)],p=i?.blockExplorers?.default?.url??r.explorers[n];return{chainId:e(n),chainName:o,nativeCurrency:{name:u,symbol:s,decimals:l},rpcUrls:f,...p?{blockExplorerUrls:[p]}:{}}}export{n as resolveAddEthereumChain};
|