@stridge/kit 0.1.0-alpha.4 → 0.1.0-alpha.41

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.
Files changed (251) hide show
  1. package/README.md +22 -6
  2. package/dist/KitProvider.d.ts +29 -0
  3. package/dist/KitProvider.js +1 -1
  4. package/dist/_internal/drivers/stridge/index.d.ts +3 -2
  5. package/dist/_internal/drivers/stridge/index.js +1 -1
  6. package/dist/_internal/withdraw/driver/index.d.ts +2 -2
  7. package/dist/deposit/compound/index.d.ts +3 -3
  8. package/dist/drivers/stridge/catalog.d.ts +54 -0
  9. package/dist/drivers/stridge/catalog.js +1 -0
  10. package/dist/drivers/stridge/createStridgeDepositDriver.d.ts +9 -0
  11. package/dist/drivers/stridge/createStridgeDepositDriver.js +1 -1
  12. package/dist/drivers/stridge/createStridgeWithdrawDriver.d.ts +34 -13
  13. package/dist/drivers/stridge/createStridgeWithdrawDriver.js +1 -1
  14. package/dist/drivers/stridge/internal/ensureWalletChain.js +1 -0
  15. package/dist/drivers/stridge/internal/resolveAddEthereumChain.js +1 -0
  16. package/dist/drivers/stridge/internal/retry.js +1 -0
  17. package/dist/drivers/stridge/internal/supportedChains.js +1 -0
  18. package/dist/drivers/stridge/types.d.ts +20 -14
  19. package/dist/drivers/stridge/types.js +1 -1
  20. package/dist/drivers/stridge/wagmiSigner.js +1 -1
  21. package/dist/drivers/stridge-mock/createStridgeMockDriver.d.ts +2 -2
  22. package/dist/drivers/stridge-mock/createStridgeMockDriver.js +1 -1
  23. package/dist/drivers/stridge-mock/createStridgeMockWithdrawDriver.d.ts +15 -3
  24. package/dist/drivers/stridge-mock/createStridgeMockWithdrawDriver.js +1 -1
  25. package/dist/drivers/stridge-mock/fixtures.d.ts +13 -11
  26. package/dist/drivers/stridge-mock/fixtures.js +1 -1
  27. package/dist/events/bus/createBus.d.ts +7 -0
  28. package/dist/events/bus/createBus.js +1 -0
  29. package/dist/events/bus/flowIdRegistry.d.ts +17 -0
  30. package/dist/events/bus/flowIdRegistry.js +1 -0
  31. package/dist/events/bus/index.js +1 -0
  32. package/dist/events/bus/metadata.js +1 -0
  33. package/dist/events/context.js +1 -0
  34. package/dist/events/emit/index.js +1 -0
  35. package/dist/events/emit/mapFailure.js +1 -0
  36. package/dist/events/emit/useDepositEmissions.js +1 -0
  37. package/dist/events/emit/useKitEmitter.js +1 -0
  38. package/dist/events/emit/useWithdrawEmissions.js +1 -0
  39. package/dist/events/hooks/index.d.ts +6 -0
  40. package/dist/events/hooks/index.js +1 -0
  41. package/dist/events/hooks/useCurrentFlowId.d.ts +6 -0
  42. package/dist/events/hooks/useCurrentFlowId.js +1 -0
  43. package/dist/events/hooks/useStableHandler.js +1 -0
  44. package/dist/events/hooks/useStridgeEvent.d.ts +8 -0
  45. package/dist/events/hooks/useStridgeEvent.js +1 -0
  46. package/dist/events/hooks/useStridgeEventBus.d.ts +33 -0
  47. package/dist/events/hooks/useStridgeEventBus.js +1 -0
  48. package/dist/events/hooks/useStridgeEvents.d.ts +6 -0
  49. package/dist/events/hooks/useStridgeEvents.js +1 -0
  50. package/dist/events/hooks/useStridgeFlowEvent.d.ts +8 -0
  51. package/dist/events/hooks/useStridgeFlowEvent.js +1 -0
  52. package/dist/events/hooks/useStridgeFlowEvents.d.ts +6 -0
  53. package/dist/events/hooks/useStridgeFlowEvents.js +1 -0
  54. package/dist/events/index.d.ts +14 -0
  55. package/dist/events/index.js +1 -0
  56. package/dist/events/publish.js +1 -0
  57. package/dist/events/types/deposit.d.ts +235 -0
  58. package/dist/events/types/envelope.d.ts +145 -0
  59. package/dist/events/types/index.d.ts +31 -0
  60. package/dist/events/types/kit.d.ts +23 -0
  61. package/dist/events/types/withdraw.d.ts +150 -0
  62. package/dist/flows/deposit/dialog/DepositDialog.d.ts +14 -81
  63. package/dist/flows/deposit/dialog/DepositDialog.js +1 -1
  64. package/dist/flows/deposit/dialog/WalletRequiredState.js +1 -0
  65. package/dist/flows/deposit/dialog/WalletRequiredState.styles.js +1 -0
  66. package/dist/flows/deposit/driver/payloads.d.ts +10 -4
  67. package/dist/flows/deposit/driver/transformers/balanceToBalancesPayload.js +1 -1
  68. package/dist/flows/deposit/driver/transformers/startToAddressesPayload.js +1 -1
  69. package/dist/flows/deposit/driver/transformers/startToTargetPayload.js +1 -1
  70. package/dist/flows/deposit/driver/types.d.ts +11 -0
  71. package/dist/flows/deposit/orchestrator/controller.js +1 -1
  72. package/dist/flows/deposit/orchestrator/types.d.ts +30 -1
  73. package/dist/flows/deposit/orchestrator/useDeposit.d.ts +45 -1
  74. package/dist/flows/deposit/orchestrator/useDeposit.js +1 -1
  75. package/dist/flows/deposit/widgets/amount-entry/AmountEntry.d.ts +1 -1
  76. package/dist/flows/deposit/widgets/amount-entry/AmountEntry.js +1 -1
  77. package/dist/flows/deposit/widgets/amount-entry/footerIntent.js +1 -0
  78. package/dist/flows/deposit/widgets/confirm-deposit/ConfirmDeposit.js +1 -1
  79. package/dist/flows/deposit/widgets/deposit/Deposit.js +1 -1
  80. package/dist/flows/deposit/widgets/deposit/compound/components/Method.d.ts +6 -0
  81. package/dist/flows/deposit/widgets/deposit/compound/components/Method.js +1 -1
  82. package/dist/flows/deposit/widgets/deposit/compound/types.d.ts +6 -3
  83. package/dist/flows/deposit/widgets/deposit-status-banner/DepositStatusBanner.d.ts +7 -0
  84. package/dist/flows/deposit/widgets/deposit-status-banner/DepositStatusBanner.js +1 -1
  85. package/dist/flows/deposit/widgets/deposit-status-banner/compound/DepositStatusBanner.js +1 -1
  86. package/dist/flows/deposit/widgets/deposit-status-banner/compound/components/Hero.js +1 -1
  87. package/dist/flows/deposit/widgets/deposit-status-banner/compound/components/PrimaryAction.js +1 -1
  88. package/dist/flows/deposit/widgets/processing-state/ProcessingState.js +1 -1
  89. package/dist/flows/deposit/widgets/transfer-crypto/TransferCrypto.js +1 -1
  90. package/dist/flows/deposit/widgets/transfer-crypto/compound/TransferCrypto.d.ts +1 -1
  91. package/dist/flows/deposit/widgets/transfer-crypto/compound/components/Address.js +1 -1
  92. package/dist/flows/deposit/widgets/transfer-crypto/compound/components/Disclosure.d.ts +2 -1
  93. package/dist/flows/deposit/widgets/transfer-crypto/compound/components/Disclosure.js +1 -1
  94. package/dist/flows/deposit/widgets/transfer-crypto/compound/components/QrCode.d.ts +4 -10
  95. package/dist/flows/deposit/widgets/transfer-crypto/compound/components/QrCode.js +1 -1
  96. package/dist/flows/shared/transformers/pickRelevantSettlement.js +1 -1
  97. package/dist/flows/shared/transformers/testnets.js +1 -0
  98. package/dist/flows/withdraw/bindings/WithdrawBindings.d.ts +92 -0
  99. package/dist/flows/withdraw/bindings/WithdrawBindings.js +1 -0
  100. package/dist/flows/withdraw/bindings/index.d.ts +1 -0
  101. package/dist/flows/withdraw/bindings/index.js +1 -0
  102. package/dist/flows/withdraw/dialog/WithdrawDialog.d.ts +35 -71
  103. package/dist/flows/withdraw/dialog/WithdrawDialog.js +1 -1
  104. package/dist/flows/withdraw/driver/payloads.d.ts +16 -1
  105. package/dist/flows/withdraw/driver/transformers/settlementToWithdrawalPayload.js +1 -1
  106. package/dist/flows/withdraw/driver/transformers/supportedAssetsToReceiveOptionsPayload.js +1 -1
  107. package/dist/flows/withdraw/driver/types.d.ts +76 -13
  108. package/dist/flows/withdraw/orchestrator/controller.js +1 -1
  109. package/dist/flows/withdraw/orchestrator/index.d.ts +1 -1
  110. package/dist/flows/withdraw/orchestrator/reducer.js +1 -1
  111. package/dist/flows/withdraw/orchestrator/types.d.ts +131 -32
  112. package/dist/flows/withdraw/orchestrator/useWithdraw.d.ts +36 -1
  113. package/dist/flows/withdraw/orchestrator/useWithdraw.js +1 -1
  114. package/dist/flows/withdraw/widgets/withdraw-form/WithdrawForm.d.ts +5 -13
  115. package/dist/flows/withdraw/widgets/withdraw-form/WithdrawForm.js +1 -1
  116. package/dist/flows/withdraw/widgets/withdraw-form/compound/WithdrawForm.js +1 -1
  117. package/dist/flows/withdraw/widgets/withdraw-form/compound/components/RecipientField.d.ts +7 -5
  118. package/dist/flows/withdraw/widgets/withdraw-form/compound/components/RecipientField.js +1 -1
  119. package/dist/flows/withdraw/widgets/withdraw-form/compound/types.d.ts +15 -5
  120. package/dist/flows/withdraw/widgets/withdraw-form/validation.js +1 -1
  121. package/dist/flows/withdraw/widgets/withdraw-in-progress/WithdrawInProgress.d.ts +2 -1
  122. package/dist/flows/withdraw/widgets/withdraw-in-progress/WithdrawInProgress.js +1 -1
  123. package/dist/flows/withdraw/widgets/withdraw-success/WithdrawSuccess.js +1 -1
  124. package/dist/i18n/index.d.ts +5 -4
  125. package/dist/i18n/index.js +1 -1
  126. package/dist/i18n/locales/ar.js +1 -1
  127. package/dist/i18n/locales/es.js +1 -1
  128. package/dist/i18n/locales/source-keys.d.ts +12 -0
  129. package/dist/i18n/locales/source-keys.js +0 -0
  130. package/dist/icons/index.d.ts +2 -1
  131. package/dist/icons/index.js +1 -1
  132. package/dist/index.d.ts +21 -9
  133. package/dist/index.js +1 -1
  134. package/dist/package.js +1 -1
  135. package/dist/scope/KitPortalScope.js +1 -1
  136. package/dist/scope/KitScope.d.ts +18 -1
  137. package/dist/scope/KitScope.js +1 -1
  138. package/dist/scope/context.d.ts +17 -1
  139. package/dist/scope/index.d.ts +1 -1
  140. package/dist/shared/attribution/Attribution.js +1 -0
  141. package/dist/shared/attribution/Attribution.slots.js +1 -0
  142. package/dist/shared/attribution/Attribution.styles.js +1 -0
  143. package/dist/shared/attribution/index.js +1 -0
  144. package/dist/shared/chains/index.d.ts +48 -29
  145. package/dist/shared/chains/index.js +1 -1
  146. package/dist/shared/constants/brand-intercom.js +1 -0
  147. package/dist/shared/cuer/Cuer.js +1 -0
  148. package/dist/shared/cuer/QrCode.js +1 -0
  149. package/dist/shared/cuer/index.js +1 -0
  150. package/dist/shared/dialog/Frame.js +1 -1
  151. package/dist/shared/dialog/LoadingState.js +1 -0
  152. package/dist/shared/dialog/LoadingState.styles.js +1 -0
  153. package/dist/shared/dialog/StepTransition.js +1 -1
  154. package/dist/shared/driver/types.d.ts +4 -3
  155. package/dist/shared/i18n/KitI18nProvider.d.ts +11 -8
  156. package/dist/shared/i18n/KitI18nProvider.js +1 -1
  157. package/dist/shared/i18n/createKitI18n.d.ts +79 -16
  158. package/dist/shared/i18n/createKitI18n.js +1 -1
  159. package/dist/shared/i18n/useLingui.d.ts +11 -3
  160. package/dist/shared/icons/LogoIcon.d.ts +13 -0
  161. package/dist/shared/icons/LogoIcon.js +1 -0
  162. package/dist/shared/merchant-link/MerchantLink.d.ts +1 -0
  163. package/dist/shared/merchant-link/MerchantLink.js +1 -0
  164. package/dist/shared/merchant-link/MerchantLinkButton.d.ts +1 -0
  165. package/dist/shared/merchant-link/MerchantLinkButton.js +1 -0
  166. package/dist/shared/merchant-link/index.d.ts +1 -0
  167. package/dist/shared/merchant-link/index.js +1 -0
  168. package/dist/shared/merchant-link/resolveMerchantLink.js +1 -0
  169. package/dist/shared/orchestrator/useSettlementWatcher.js +1 -1
  170. package/dist/shared/primitives/TxHashValue/TxHashValue.js +1 -1
  171. package/dist/shared/support/SupportConfigContext.d.ts +1 -0
  172. package/dist/shared/support/SupportConfigContext.js +1 -0
  173. package/dist/shared/support/SupportLink.d.ts +1 -0
  174. package/dist/shared/support/SupportLink.js +1 -0
  175. package/dist/shared/support/SupportSpinner.d.ts +1 -0
  176. package/dist/shared/support/SupportSpinner.js +1 -0
  177. package/dist/shared/support/index.d.ts +2 -0
  178. package/dist/shared/support/index.js +1 -0
  179. package/dist/shared/support/intercom-loader.d.ts +17 -0
  180. package/dist/shared/support/intercom-loader.js +1 -0
  181. package/dist/shared/support/types.d.ts +43 -0
  182. package/dist/shared/support/useIntercomMerchantContext.d.ts +27 -0
  183. package/dist/shared/support/useIntercomMerchantContext.js +1 -0
  184. package/dist/shared/support/useIntercomShutdownOnUnmount.js +1 -0
  185. package/dist/shared/support/useMerchantContext.d.ts +1 -0
  186. package/dist/shared/support/useMerchantContext.js +1 -0
  187. package/dist/shared/support/useSupportTrigger.js +1 -0
  188. package/dist/shared/terms/TermsConfigContext.d.ts +1 -0
  189. package/dist/shared/terms/TermsConfigContext.js +1 -0
  190. package/dist/shared/terms/TermsLink.d.ts +1 -0
  191. package/dist/shared/terms/TermsLink.js +1 -0
  192. package/dist/shared/terms/index.d.ts +1 -0
  193. package/dist/shared/terms/index.js +1 -0
  194. package/dist/shared/terms/types.d.ts +43 -0
  195. package/dist/shared/ui/Card/Card.styles.js +1 -1
  196. package/dist/shared/ui/Details/Details.d.ts +9 -1
  197. package/dist/shared/ui/Details/Details.styles.js +1 -1
  198. package/dist/shared/ui/Dialog/Dialog.js +1 -1
  199. package/dist/shared/ui/Dialog/Dialog.styles.js +1 -1
  200. package/dist/shared/ui/Select/Select.js +1 -1
  201. package/dist/shared/ui/WalletRow/WalletRow.d.ts +1 -1
  202. package/dist/shared/ui/WalletRow/WalletRow.js +1 -1
  203. package/dist/shared/utils/useDeepMemo.js +1 -0
  204. package/dist/shared/wallet/ConnectWalletContext.d.ts +17 -0
  205. package/dist/shared/wallet/ConnectWalletContext.js +1 -0
  206. package/dist/shared/widgets/amount-entry/compound/components/Hero/Hero.js +1 -1
  207. package/dist/shared/widgets/amount-entry/compound/components/Hero/SwapBackdrop.js +1 -1
  208. package/dist/shared/widgets/asset-picker/compound/components/Asset.d.ts +7 -1
  209. package/dist/shared/widgets/asset-picker/compound/components/Asset.js +1 -1
  210. package/dist/shared/widgets/confirm-transfer/compound/components/Disclaimer.d.ts +4 -3
  211. package/dist/shared/widgets/confirm-transfer/compound/components/Disclaimer.js +1 -1
  212. package/dist/shared/widgets/error-state/compound/components/AssetValue.js +1 -1
  213. package/dist/shared/widgets/error-state/compound/components/HelpInfo.js +1 -1
  214. package/dist/shared/widgets/error-state/compound/components/StatusValue.js +1 -1
  215. package/dist/shared/widgets/processing-state/compound/ProcessingState.d.ts +1 -5
  216. package/dist/shared/widgets/processing-state/compound/ProcessingState.js +1 -1
  217. package/dist/shared/widgets/processing-state/compound/ProcessingState.slots.d.ts +0 -1
  218. package/dist/shared/widgets/processing-state/compound/ProcessingState.slots.js +1 -1
  219. package/dist/shared/widgets/processing-state/compound/ProcessingState.styles.js +1 -1
  220. package/dist/shared/widgets/processing-state/compound/components/Details.d.ts +6 -1
  221. package/dist/shared/widgets/processing-state/compound/components/Details.js +1 -1
  222. package/dist/shared/widgets/processing-state/compound/components/Header.d.ts +4 -3
  223. package/dist/shared/widgets/processing-state/compound/components/Header.js +1 -1
  224. package/dist/shared/widgets/processing-state/compound/components/Hero.d.ts +14 -7
  225. package/dist/shared/widgets/processing-state/compound/components/Hero.js +1 -1
  226. package/dist/shared/widgets/processing-state/compound/components/Rows.js +1 -1
  227. package/dist/shared/widgets/processing-state/compound/components/StatusPill.js +1 -1
  228. package/dist/shared/widgets/processing-state/compound/components/splitAmount.js +1 -0
  229. package/dist/shared/widgets/processing-state/compound/index.d.ts +1 -1
  230. package/dist/shared/widgets/processing-state/compound/types.d.ts +7 -26
  231. package/dist/shared/widgets/success-state/compound/components/Actions.js +1 -1
  232. package/dist/shared/widgets/success-state/compound/components/AssetValue.js +1 -1
  233. package/dist/shared/widgets/success-state/compound/components/RouteValue.js +1 -1
  234. package/dist/shared/widgets/success-state/compound/components/StatusPill.js +1 -1
  235. package/dist/stridge/StridgeProvider.d.ts +165 -35
  236. package/dist/stridge/StridgeProvider.js +1 -1
  237. package/dist/stridge/depositOwner.js +1 -0
  238. package/dist/stridge/optionalWagmi.js +1 -0
  239. package/dist/stridge/stubs.js +1 -1
  240. package/dist/styles/index.css +126 -10
  241. package/dist/types.d.ts +5 -4
  242. package/dist/ui/index.js +1 -1
  243. package/dist/withdraw/compound/index.d.ts +2 -2
  244. package/dist/withdraw/dialog/index.d.ts +3 -1
  245. package/package.json +13 -9
  246. package/dist/flows/withdraw/dialog/WithdrawDialogEventsContext.d.ts +0 -36
  247. package/dist/flows/withdraw/dialog/WithdrawDialogEventsContext.js +0 -1
  248. package/dist/shared/widgets/processing-state/compound/components/Actions.d.ts +0 -17
  249. package/dist/shared/widgets/processing-state/compound/components/Actions.js +0 -1
  250. package/dist/stridge/StridgeContext.d.ts +0 -29
  251. 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`, `wagmi`.
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, chains } from "@stridge/kit";
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
- asset={{ chain: chains.bsc, symbol: "USDC" }}
25
- flows={{ deposit: {}, withdraw: {} }}
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
 
@@ -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
@@ -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{WithdrawDriverProvider as a}from"./flows/withdraw/driver/context.js";import{WithdrawControllerProvider as o}from"./flows/withdraw/orchestrator/controller.js";import{KitScope as s}from"./scope/KitScope.js";import"./scope/index.js";import{jsx as c}from"react/jsx-runtime";function l({children:l,i18n:u,direction:d,deposit:f,withdraw:p,storage:m,storageNamespace:h,...g}){let _=n(u?.locale),v=l;return p&&(v=c(a,{driver:p,children:c(o,{children:v})})),f&&(v=c(t,{driver:f,children:c(i,{children:v})})),c(r,{locale:u?.locale,catalogs:u?.catalogs,children:c(s,{...g,direction:d??_,children:c(e,{storage:m,namespace:h,children:v})})})}export{l as KitProvider};
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,6 +1,7 @@
1
1
  import { StridgeChainSlug, StridgeRpc, StridgeRpcConfig, StridgeRpcWaitInput, createStridgeRpc } from "../../../drivers/stridge/rpc.js";
2
- import { STRIDGE_DEFAULT_ENVIRONMENT, STRIDGE_DEFAULT_MIN_DEPOSIT_USD, StridgeDriverConfig, StridgeDriverDestination, StridgeEnvironment, StridgePollIntervals, StridgeTokenIconResolverEntry } from "../../../drivers/stridge/types.js";
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, STRIDGE_DEFAULT_MIN_DEPOSIT_USD, type StridgeChainSlug, type StridgeDriverConfig, type StridgeDriverDestination, type StridgeEnvironment, type StridgePollIntervals, type StridgeRpc, type StridgeRpcConfig, type StridgeRpcWaitInput, type StridgeTokenIconResolverEntry, type StridgeWithdrawCurrency, type SupportedAssetsResponse, createStridgeDepositDriver, createStridgeRpc, createStridgeWithdrawDriver };
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,STRIDGE_DEFAULT_MIN_DEPOSIT_USD as t}from"../../../drivers/stridge/types.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 STRIDGE_DEFAULT_MIN_DEPOSIT_USD,r as createStridgeDepositDriver,n as createStridgeRpc,i as createStridgeWithdrawDriver};
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 { RequestWithdrawalQuoteInput, SubmitWithdrawalInput, WatchWithdrawableBalancesInput, WatchWithdrawalSettlementInput, WithdrawDriver, WithdrawSnapshot } from "../../../flows/withdraw/driver/types.js";
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 SubmitWithdrawalInput, type TxRef, type WatchWithdrawableBalancesInput, type WatchWithdrawalSettlementInput, type WithdrawDriver, WithdrawDriverProvider, 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 };
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,13 +1,13 @@
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";
5
6
  import { Deposit } from "../../flows/deposit/widgets/deposit/compound/Deposit.js";
6
7
  import { DEPOSIT_SLOTS, DepositSlot } from "../../flows/deposit/widgets/deposit/compound/Deposit.slots.js";
7
8
  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
9
  import { DepositStatusBanner } from "../../flows/deposit/widgets/deposit-status-banner/compound/DepositStatusBanner.js";
9
10
  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
11
  import { TransferCrypto } from "../../flows/deposit/widgets/transfer-crypto/compound/TransferCrypto.js";
12
12
  import { TRANSFER_CRYPTO_SLOTS, TransferCryptoSlot } from "../../flows/deposit/widgets/transfer-crypto/compound/TransferCrypto.slots.js";
13
13
  import { AmountEntryBodyProps, AmountEntryDialogProps, AmountEntryFlowProps, AmountEntryFooterProps, AmountEntryHeaderProps, AmountEntryHeroProps, AmountEntryPercentPreset, AmountEntryPillsProps, AmountEntryProps, AmountEntryToken } from "../../shared/widgets/amount-entry/compound/types.js";
@@ -19,10 +19,10 @@ import { ASSET_PICKER_SLOTS, AssetPickerSlot } from "../../shared/widgets/asset-
19
19
  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
20
  import { ErrorState } from "../../shared/widgets/error-state/compound/ErrorState.js";
21
21
  import { ERROR_STATE_SLOTS, ErrorStateSlot } from "../../shared/widgets/error-state/compound/ErrorState.slots.js";
22
- import { ProcessingStateActionsProps, ProcessingStateAsset, ProcessingStateBodyProps, ProcessingStateDetailProps, ProcessingStateDetailsProps, ProcessingStateDialogProps, ProcessingStateHeaderProps, ProcessingStateHeroProps, ProcessingStateProps, ProcessingStateRowProps, ProcessingStateSourceWallet, ProcessingStateStatusPillProps, ProcessingStateTxRef } from "../../shared/widgets/processing-state/compound/types.js";
22
+ import { ProcessingStateAsset, ProcessingStateBodyProps, ProcessingStateDetailProps, ProcessingStateDetailsProps, ProcessingStateDialogProps, ProcessingStateHeaderProps, ProcessingStateHeroProps, ProcessingStateProps, ProcessingStateRowProps, ProcessingStateSourceWallet, ProcessingStateStatusPillProps, ProcessingStateTxRef } from "../../shared/widgets/processing-state/compound/types.js";
23
23
  import { ProcessingState } from "../../shared/widgets/processing-state/compound/ProcessingState.js";
24
24
  import { PROCESSING_STATE_SLOTS, ProcessingStateSlot } from "../../shared/widgets/processing-state/compound/ProcessingState.slots.js";
25
25
  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
26
  import { SuccessState } from "../../shared/widgets/success-state/compound/SuccessState.js";
27
27
  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, ProcessingStateActionsProps, 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 };
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, 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 `Uda.supportedAssets()` 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 — `supportedAssets` is the
11
+ * gateway'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 `supportedAssets` 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 only authenticates `supportedAssets`, which is a gateway-key-readable 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 `supportedAssets` 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.uda.supportedAssets()).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,6 +14,14 @@ 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 `supportedAssets` cache. When supplied, the driver awaits this
19
+ * single in-flight promise instead of issuing its own `Uda.supportedAssets()` call —
20
+ * deduplicates the catalog fetch across deposit + withdraw drivers mounted under one
21
+ * `<StridgeProvider>`. When omitted, the driver falls back to its own per-instance fetch
22
+ * (the path BYO-driver 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
@@ -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 h}from"../../flows/deposit/driver/transformers/quoteToPayload.js";import{settlementToPayload as g}from"../../flows/deposit/driver/transformers/settlementToPayload.js";import{startToAddressesPayload as _}from"../../flows/deposit/driver/transformers/startToAddressesPayload.js";import{startToBrandPayload as v}from"../../flows/deposit/driver/transformers/startToBrandPayload.js";import{startToTargetPayload as y}from"../../flows/deposit/driver/transformers/startToTargetPayload.js";import{walletAddressToWalletPayload as b}from"../../flows/deposit/driver/transformers/walletAddressToWalletPayload.js";import{defaultBlockExplorers as x}from"../../shared/utils/explorers.js";import{createEntityStore as ee}from"../stridge-mock/store.js";import{startPoll as S}from"./poll.js";import{createStridgeRpc as te}from"./rpc.js";import{createWagmiSigner as ne}from"./wagmiSigner.js";import{createApiClient as re}from"@stridge/sdk";function C(C){let w=re({projectKey:C.projectKey,env:i(C.environment)}),T=C.pollIntervals??{},E=T.detectionMs??2e3,D=T.processingMs??2e3,O=T.terminalMs??1e4,k=T.balancesMs??6e4,A=C.minAmountUsd,j=C.maxAmountUsd,M=C.getI18n??(()=>e),N={...x(),...C.explorers??{}},P=C.destination.network_id,F=C.destination.asset_symbol,I=C.destination.to_address??C.userAddress,L=C.rpc??te(),R={address:C.userAddress},z=ee({brand:{status:`idle`},target:{status:`idle`},addresses:{status:`idle`},balances:{status:`idle`},quote:{status:`idle`},settlement:{status:`idle`},wallet:{status:`ready`,payload:b(R),raw:R,response:R}}),B,V,H,U,W=C.wagmiConfig?ne({wagmiConfig:C.wagmiConfig,getSupportedAssets:()=>V,explorers:N}):void 0;function G(){if(V)return H??=m(V),H}let K=!1,q=Promise.resolve(),J=!1,Y=Promise.resolve(null),X=null;function Z(){K||(K=!0,q=ce(),Y=le())}async function ce(){z.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:C.userAddress,destination:{network_id:P,to_address:I,asset_symbol:F},metadata:a({flow:`deposit`,...C.metadata?{hostMetadata:C.metadata}:{},extras:{destination:{networkId:P,assetSymbol:F}}})})),C.catalog?C.catalog.getSupportedAssets():u(()=>w.uda.supportedAssets()).catch(()=>null)]);B=e;let n=e.metadata?.brand_name;typeof n==`string`&&n.trim().length>0&&(U=n.trim());let r=M();if(t&&(V=t,H=void 0),z.update({brand:{status:`ready`,payload:v(e.metadata),raw:e.metadata,response:e},addresses:{status:`ready`,payload:_(e.deposit_addresses,{i18n:r,explorers:N,...t?{chainLogos:ae(t)}:{},...t?{minAmountUsdByEip155Id:se(t,A),nativeAssetByEip155Id:oe(t)}:{}}),raw:e.deposit_addresses,response:e}}),t){let e=y(t,{i18n:r,networkId:P,assetSymbol:F,minAmountUsd:A,...j===void 0?{}:{maxAmountUsd:j}}),n=t.assets.find(e=>String(e.network_id)===P);e&&n?z.update({target:{status:`ready`,payload:e,raw:n,response:t}}):z.update({target:{status:`error`,error:Error(`Destination not found in supportedAssets catalog.`)}})}else z.update({target:{status:`error`,error:Error(`supportedAssets fetch failed.`)}})}catch(e){let t=e instanceof Error?e:Error(String(e));z.update({brand:{status:`error`,error:t},target:{status:`error`,error:t},addresses:{status:`error`,error:t}})}}async function le(){try{await q;let e=l(V),t=await u(()=>w.balance.onchain(C.userAddress,{includeSpam:!1,includeZero:!1,...e?{chains:e}:{}}));X=Date.now();let n=G();if(!n)return z.update({balances:{status:`ready`,payload:[],raw:t,response:t}}),t;let r=p(t,{i18n:M(),routable:n,minAmountUsd:A,...C.resolveTokenIcon?{resolveTokenIcon:C.resolveTokenIcon}:{}});return z.update({balances:{status:`ready`,payload:r,raw:t,response:t},wallet:Q(r,M())}),t}catch(e){let t=e instanceof Error?e:Error(String(e));return z.update({balances:{status:`error`,error:t}}),null}}function Q(e,t){let n=e.reduce((e,t)=>e+(t.amountUsd?.value??0),0);return{status:`ready`,payload:{...b(R),balanceTotalUsd:{value:n,formatted:f(n,t)}},raw:R,response:R}}return{getSnapshot(){return z.getSnapshot()},subscribe(e){return z.subscribe(e)},arm:Z,async requestQuote(e,i){if(Z(),z.update({quote:{status:`loading`}}),await q,i.aborted)return;let a=B;if(!a){z.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:C.userAddress,toAddress:I},{signal:i});if(i.aborted)return;let u=M(),d={chainId:o,networkName:ie(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=h(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}});z.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));z.update({quote:{status:`error`,error:t}})}},async submitDeposit(e,t){if(!W)throw Error(`Connect a wallet to sign and submit the deposit.`);if(Z(),await q,t.aborted)throw new DOMException(`Aborted`,`AbortError`);let n=B;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:W,rpc:L,step:s({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:N,...C.receiptConfirmations===void 0?{}:{receiptConfirmations:C.receiptConfirmations},...C.receiptPollingIntervalMs===void 0?{}:{receiptPollingIntervalMs:C.receiptPollingIntervalMs}})},watchBalances(e,t,n){Z(),S({signal:n,fetch:async e=>{if(!J)return J=!0,Y;if(X!==null&&Date.now()-X<3e4)return z.getSnapshot().balances;try{await q;let t=l(V),n=await w.balance.onchain(C.userAddress,{signal:e,includeSpam:!1,includeZero:!1,...t?{chains:t}:{}});X=Date.now();let r=G();if(!r)return z.update({balances:{status:`ready`,payload:[],raw:n,response:n}}),null;let i=p(n,{i18n:M(),routable:r,minAmountUsd:A,...C.resolveTokenIcon?{resolveTokenIcon:C.resolveTokenIcon}:{}});return z.update({balances:{status:`ready`,payload:i,raw:n,response:n},wallet:Q(i,M())}),n}catch{return null}},listener:()=>{t(z.getSnapshot().balances)},nextIntervalMs:()=>k})},watchSourceTx(e,t,n){Z();let r=new Set,i={current:!1},a=!1;S({signal:n,fetch:e=>o(w,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??``,...N[s]&&o.from?.tx_id?{explorerUrl:`${N[s].replace(/\/+$/,``)}/tx/${o.from.tx_id}`}:{}})},nextIntervalMs:()=>a?0:E})},watchSettlement(e,t,n){let r=e=>o(w,C.userAddress,$(),e),i=!1;S({signal:n,fetch:r,listener:n=>{if(!n)return;let r=d(n,{txHash:e.tx.hash});if(!r)return;let a=g(r,n,{i18n:M(),sourceWallet:{name:`Wallet`,address:C.userAddress},explorers:N,...U?{brandName:U}:{}});a.kind!==`pending`&&(i=!0);let o={status:`ready`,payload:a,raw:r,response:n};z.update({settlement:o}),t(o)},nextIntervalMs:()=>i?O:D})},async fetchActiveSettlement(e,t){let n=await o(w,C.userAddress,$(),t);if(!n)return null;let r=d(n);if(!r)return null;let i=g(r,n,{i18n:M(),sourceWallet:{name:`Wallet`,address:C.userAddress},explorers:N,...U?{brandName:U}:{}});return i.kind===`pending`?{payload:i,raw:r,response:n}:null}};function $(){return{network_id:P,asset_symbol:F,to_address:I}}}function ie(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 ae(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 oe(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 se(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,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 `minDepositUsd` — withdraw v1 doesn't surface a USD floor on the form.
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 used to sign and broadcast the source-chain transfer. Receipt polling uses an
56
- * internal Stridge RPC client (see `rpc.ts`) withdraws don't depend on the host's wagmi
57
- * public client (which falls through to viem's hard-coded public defaults unreliable for
58
- * live tx flow).
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: Config;
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,20 +81,38 @@ interface CreateStridgeWithdrawDriverInput {
78
81
  /** Polling cadence overrides. */
79
82
  pollIntervals?: StridgePollIntervals;
80
83
  /**
81
- * Advanced escape hatch: inject a custom Stridge RPC client (e.g. for tests or a self-hosted
82
- * proxy). Defaults to a client that targets `https://${chainId}.nodes.stridge.com`.
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 `supportedAssets` cache. When supplied, the driver awaits this
111
+ * single in-flight promise instead of issuing its own `Uda.supportedAssets()` call —
112
+ * deduplicates the catalog fetch across deposit + withdraw drivers mounted under one
113
+ * `<StridgeProvider>`. 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
@@ -104,7 +125,7 @@ interface CreateStridgeWithdrawDriverInput {
104
125
  * supportedAssets-derived source-currency lookup completes).
105
126
  *
106
127
  * `gateway/start` is **not** part of bootstrap — the destination is user-picked at submit time, so
107
- * each `submitWithdrawal` call provisions a fresh UDA scoped to the chosen recipient/chain/token.
128
+ * each `prepareWithdrawal` call provisions a fresh UDA scoped to the chosen recipient/chain/token.
108
129
  * The destination is idempotent on `(owner, destination)`, so repeat submits to the same target
109
130
  * dedupe to one UDA.
110
131
  */
@@ -1 +1 @@
1
- "use client";import{defaultI18n as e}from"../../shared/i18n/defaultI18n.js";import{pickRelevantSettlement as t}from"../../flows/shared/transformers/pickRelevantSettlement.js";import{defaultBlockExplorers as n}from"../../shared/utils/explorers.js";import{createEntityStore as r}from"../stridge-mock/store.js";import{NATIVE_QUOTE_ADDRESS as i,isStablecoinSymbol as a,toBaseUnits as o}from"./internal/encoding.js";import{resolveSdkEnv as s}from"./internal/env.js";import{buildKitMetadata as c}from"./internal/metadata.js";import{pollOnce as l}from"./internal/pollOnce.js";import{buildErc20OrNativeStep as u,signAndConfirm as d}from"./internal/signAndConfirm.js";import{startPoll as f}from"./poll.js";import{createStridgeRpc as p}from"./rpc.js";import{createWagmiSigner as m}from"./wagmiSigner.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{createApiClient as y}from"@stridge/sdk";function b(b){let x=y({projectKey:b.projectKey,env:s(b.environment)}),S=b.pollIntervals??{},C=S.processingMs??2e3,w=S.terminalMs??1e4,T=S.balancesMs??6e4,E=b.getI18n??(()=>e),D={...n(),...b.explorers??{}},O=m({wagmiConfig:b.wagmiConfig}),k=b.rpc??p(),A=r({withdrawableBalances:{status:`loading`},receiveOptions:{status:`loading`},quote:{status:`idle`},settlement:{status:`idle`}}),j,M,N;function P(e){let t=e.assets.find(e=>e.network_id===b.currency.networkId);if(!t)return;let n=b.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 F(e){let t=E(),n=M,r=h(e,{i18n:t,networkId:b.currency.networkId,assetSymbol:b.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}:{}}}:{}});A.update({withdrawableBalances:{status:`ready`,payload:r,raw:e,response:e}})}let I=(async()=>{try{let[e,t]=await Promise.all([x.uda.supportedAssets(),x.balance.onchain(b.userAddress,{includeSpam:!1,includeZero:!1}).catch(()=>null)]);j=e,M=P(e);let n=v(e);A.update({receiveOptions:{status:`ready`,payload:n,raw:e.assets,response:e}}),t?F(t):M&&F({wallet_address:b.userAddress,fetched_at:new Date().toISOString(),total_usd:`0`,chains:[]})}catch(e){let t=e instanceof Error?e:Error(String(e));A.update({receiveOptions:{status:`error`,error:t}})}})();function L(){return c({flow:`withdraw`,...b.metadata?{hostMetadata:b.metadata}:{},extras:{source:{networkId:b.currency.networkId,assetSymbol:b.currency.assetSymbol}}})}function R(e,t){if(!j)return;let n=j.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 z(e){let t=A.getSnapshot().receiveOptions;if(!(t.status!==`ready`&&t.status!==`stale`))return t.payload.find(t=>t.eip155Id===e)}return{getSnapshot(){return A.getSnapshot()},subscribe(e){return A.subscribe(e)},async requestQuote(e,t){A.update({quote:{status:`loading`}});try{if(await I,t.aborted)return;let n=M;if(!n)throw Error(`Stridge withdraw driver: source currency ${b.currency.assetSymbol} not found on network ${b.currency.networkId} in supportedAssets.`);let r=R(e.receiveChainId,e.receiveTokenSymbol);if(!r)throw Error(`Stridge withdraw driver: receive asset ${e.receiveTokenSymbol} not found on chain ${e.receiveChainId} in supportedAssets.`);let s=o(e.amount,n.decimals),c=await x.uda.quote({fromNetworkId:n.eip155Id,fromAsset:n.isNative?i:n.address,toNetworkId:r.chainId,toAsset:r.isNative?i:r.address,amount:s,fromAddress:b.userAddress,toAddress:e.recipientAddress},{signal:t});if(t.aborted)return;let l=a(b.currency.assetSymbol)?1:void 0,u=a(r.symbol)?1:void 0,d=g(c,{i18n:E(),receiveSide:r,sourceAmount:e.amount,sendDecimals:n.decimals,sendSymbol:b.currency.assetSymbol,now:Date.now(),...l===void 0?{}:{sendPriceUsd:l},...u===void 0?{}:{receivePriceUsd:u}});A.update({quote:{status:`ready`,payload:d,raw:c,response:c}})}catch(e){if(t.aborted)return;let n=e instanceof Error?e:Error(String(e));A.update({quote:{status:`error`,error:n}})}},async submitWithdrawal(e,t){if(await I,t.aborted)throw new DOMException(`Aborted`,`AbortError`);let n=M;if(!n)throw Error(`Stridge withdraw driver: source currency ${b.currency.assetSymbol} not found on network ${b.currency.networkId} in supportedAssets.`);let r=R(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 x.gateway.start({owner:b.userAddress,destination:{network_id:r.networkId??String(e.receiveChainId),asset_symbol:r.symbol,to_address:e.recipientAddress},metadata:L()},{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 N={network_id:r.networkId??String(e.receiveChainId),asset_symbol:r.symbol,to_address:e.recipientAddress},d({signer:O,rpc:k,step:u({chainId:n.eip155Id,from:b.userAddress,udaDepositAddress:a.address,amount:e.amount,decimals:n.decimals,isNative:n.isNative,...n.isNative?{}:{sourceTokenAddress:n.address}}),signal:t,explorers:D,...b.receiptConfirmations===void 0?{}:{receiptConfirmations:b.receiptConfirmations},...b.receiptPollingIntervalMs===void 0?{}:{receiptPollingIntervalMs:b.receiptPollingIntervalMs}})},watchSettlement(e,n,r){let i=e=>l(x,b.userAddress,N,e),a=!1;f({signal:r,fetch:i,listener:r=>{if(!r)return;let i=t(r,{txHash:e.tx.hash});if(!i)return;let o=E(),s=z(Number(r.destination.eip155_id)),c=s?.tokens.find(e=>e.symbol===r.destination.asset_symbol),l={...s?.chainLogoUrl?{chainLogoUrl:s.chainLogoUrl}:{},...c?.assetLogoUrl?{assetLogoUrl:c.assetLogoUrl}:{},...s?.networkName?{networkName:s.networkName}:{}},u=_(i,r,{i18n:o,explorers:D,...Object.keys(l).length>0?{receiveAssetEnrichment:l}:{}});u.kind!==`pending`&&(a=!0);let d={status:`ready`,payload:u,raw:i,response:r};A.update({settlement:d}),n(d)},nextIntervalMs:()=>a?w:C})},watchWithdrawableBalances(e,t,n){f({signal:n,fetch:async e=>{try{return await I,e.aborted?null:await x.balance.onchain(b.userAddress,{signal:e,includeSpam:!1,includeZero:!1})}catch{return null}},listener:e=>{e&&F(e),t(A.getSnapshot().withdrawableBalances)},nextIntervalMs:()=>T})}}}export{b as createStridgeWithdrawDriver};
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{defaultBlockExplorers as d}from"../../shared/utils/explorers.js";import{createEntityStore as f}from"../stridge-mock/store.js";import{startPoll as p}from"./poll.js";import{balanceToWithdrawableBalancesPayload as m}from"../../flows/withdraw/driver/transformers/balanceToWithdrawableBalancesPayload.js";import{quoteToWithdrawalPayload as h}from"../../flows/withdraw/driver/transformers/quoteToWithdrawalPayload.js";import{settlementToWithdrawalPayload as g}from"../../flows/withdraw/driver/transformers/settlementToWithdrawalPayload.js";import{supportedAssetsToReceiveOptionsPayload as _}from"../../flows/withdraw/driver/transformers/supportedAssetsToReceiveOptionsPayload.js";import{createApiClient as v}from"@stridge/sdk";function y(y){let b=v({projectKey:y.projectKey,env:i(y.environment)}),x=y.pollIntervals??{},S=x.processingMs??2e3,C=x.terminalMs??1e4,w=x.balancesMs??6e4,T=y.getI18n??(()=>e),E={...d(),...y.explorers??{}},D=T(),O=f({withdrawableBalances:{status:`idle`},receiveOptions:{status:`idle`},quote:{status:`idle`},settlement:{status:`idle`},...y.minAmountUsd===void 0?{}:{minAmountUsd:{value:y.minAmountUsd,formatted:u(y.minAmountUsd,D)}},...y.maxAmountUsd===void 0?{}:{maxAmountUsd:{value:y.maxAmountUsd,formatted:u(y.maxAmountUsd,D)}}}),k,A,j;function M(e){let t=e.assets.find(e=>e.network_id===y.currency.networkId);if(!t)return;let n=y.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 N(e){let t=T(),n=A,r=m(e,{i18n:t,networkId:y.currency.networkId,assetSymbol:y.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}:{}}}:{}});O.update({withdrawableBalances:{status:`ready`,payload:r,raw:e,response:e}})}let P=!1,F=Promise.resolve(),I=!1,L=null;function R(){P||(P=!0,F=z())}async function z(){O.update({withdrawableBalances:{status:`loading`},receiveOptions:{status:`loading`}});let e=y.catalog?await y.catalog.getSupportedAssets():await c(()=>b.uda.supportedAssets()).catch(()=>null);if(e){k=e,A=M(e);let t=_(e);O.update({receiveOptions:{status:`ready`,payload:t,raw:e.assets,response:e}})}else O.update({receiveOptions:{status:`error`,error:Error(`supportedAssets fetch failed.`)}});let t=s(e??void 0),n=await c(()=>b.balance.onchain(y.userAddress,{includeSpam:!1,includeZero:!1,...t?{chains:t}:{}})).catch(()=>null);n?(L=Date.now(),N(n)):N({wallet_address:y.userAddress,fetched_at:new Date().toISOString(),total_usd:`0`,chains:[]})}function B(){return a({flow:`withdraw`,...y.metadata?{hostMetadata:y.metadata}:{},extras:{source:{networkId:y.currency.networkId,assetSymbol:y.currency.assetSymbol}}})}function V(e,t){if(!k)return;let n=k.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 H(e){let t=O.getSnapshot().receiveOptions;if(!(t.status!==`ready`&&t.status!==`stale`))return t.payload.find(t=>t.eip155Id===e)}return{getSnapshot(){return O.getSnapshot()},subscribe(e){return O.subscribe(e)},arm:R,async requestQuote(e,i){R(),O.update({quote:{status:`loading`}});try{if(await F,i.aborted)return;let a=A;if(!a)throw Error(`Stridge withdraw driver: source currency ${y.currency.assetSymbol} not found on network ${y.currency.networkId} in supportedAssets.`);let o=V(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 b.uda.quote({fromNetworkId:a.eip155Id,fromAsset:a.isNative?t:a.address,toNetworkId:o.chainId,toAsset:o.isNative?t:o.address,amount:s,fromAddress:y.userAddress,toAddress:e.recipientAddress},{signal:i});if(i.aborted)return;let l=n(y.currency.assetSymbol)?1:void 0,u=n(o.symbol)?1:void 0,d=h(c,{i18n:T(),receiveSide:o,sourceAmount:e.amount,sendDecimals:a.decimals,sendSymbol:y.currency.assetSymbol,now:Date.now(),...l===void 0?{}:{sendPriceUsd:l},...u===void 0?{}:{receivePriceUsd:u}});O.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));O.update({quote:{status:`error`,error:t}})}},async prepareWithdrawal(e,t){if(R(),await F,t.aborted)throw new DOMException(`Aborted`,`AbortError`);let n=A;if(!n)throw Error(`Stridge withdraw driver: source currency ${y.currency.assetSymbol} not found on network ${y.currency.networkId} in supportedAssets.`);let r=V(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 b.gateway.start({owner:y.userAddress,destination:{network_id:r.networkId??String(e.receiveChainId),asset_symbol:r.symbol,to_address:e.recipientAddress},metadata:B()},{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 j={network_id:r.networkId??String(e.receiveChainId),asset_symbol:r.symbol,to_address:e.recipientAddress},{depositTarget:{address:a.address,chainId:n.eip155Id,tokenSymbol:y.currency.assetSymbol,tokenAddress:n.isNative?``:n.address,tokenDecimals:n.decimals,isNative:n.isNative,amount:e.amount},correlation:{owner:y.userAddress}}},watchSettlement(e,t,n){let i=e=>o(b,y.userAddress,j,e),a=!1;p({signal:n,fetch:i,listener:n=>{if(!n)return;let i=A?r(e.form.amount,A.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=T(),c=H(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=g(o,n,{i18n:s,explorers:E,...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};O.update({settlement:p}),t(p)},nextIntervalMs:()=>a?C:S})},watchWithdrawableBalances(e,t,n){R(),p({signal:n,fetch:async e=>{if(!I){I=!0,await F;let e=O.getSnapshot().withdrawableBalances;return e.status===`ready`||e.status===`stale`?e.response:null}if(L!==null&&Date.now()-L<3e4)return null;try{if(await F,e.aborted)return null;let t=s(k),n=await b.balance.onchain(y.userAddress,{signal:e,includeSpam:!1,includeZero:!1,...t?{chains:t}:{}});return L=Date.now(),n}catch{return null}},listener:e=>{e&&N(e),t(O.getSnapshot().withdrawableBalances)},nextIntervalMs:()=>w})}}}export{y 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};
@@ -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};
@@ -0,0 +1 @@
1
+ async function e(e,r={}){let i=r.baseDelayMs??500,a=r.jitterMs??250;try{return await e()}catch(r){if(!t(r))throw r;return await n(i+Math.random()*a),await e()}}function t(e){if(!e||typeof e!=`object`)return!0;let t=e;return t.name===`AbortError`?!1:typeof t.status==`number`?t.status>=500||t.status===429:!0}function n(e){return new Promise(t=>setTimeout(t,e))}export{e as withOneShotRetry};
@@ -0,0 +1 @@
1
+ import{KNOWN_TESTNET_EIP155_IDS as e}from"../../../flows/shared/transformers/testnets.js";function t(t){if(!t)return;let n=new Set;for(let r of t.assets)r.chain_type===`EVM`&&(typeof r.eip155_id!=`number`||!Number.isFinite(r.eip155_id)||r.eip155_id<=0||e.has(r.eip155_id)||n.add(r.eip155_id));if(n.size!==0)return Array.from(n).join(`,`)}export{t as buildEvmChainsParam};
@@ -34,11 +34,6 @@ interface StridgePollIntervals {
34
34
  type StridgeEnvironment = "production" | "staging";
35
35
  /** Default {@link StridgeEnvironment} when {@link StridgeDriverConfig.environment} is omitted. */
36
36
  declare const STRIDGE_DEFAULT_ENVIRONMENT = "production";
37
- /**
38
- * Default low-balance / amount-entry floor in USD used when {@link StridgeDriverConfig.minDepositUsd}
39
- * is omitted. Hosts can override per project (some perp DEXes want a higher floor than $3).
40
- */
41
- declare const STRIDGE_DEFAULT_MIN_DEPOSIT_USD = 3;
42
37
  /**
43
38
  * Settlement destination for `gateway/start`. Mirrors the wire shape so hosts don't have to reach
44
39
  * for the SDK's `GatewayStartRequest.destination` type — every field corresponds 1:1.
@@ -81,11 +76,19 @@ interface StridgeDriverConfig {
81
76
  */
82
77
  destination: StridgeDriverDestination;
83
78
  /**
84
- * Low-balance / amount-entry USD floor. Drives the asset-picker's "Low balance" pill and the
85
- * amount-entry hero's `min` / `initialAmount` (via {@link toKitTarget}). Defaults to
86
- * {@link STRIDGE_DEFAULT_MIN_DEPOSIT_USD} when omitted.
79
+ * Low-balance / amount-entry USD floor. Drives the asset-picker's "Low Balance" pill and the
80
+ * amount-entry hero's `min` / `initialAmount`. The kit ships no default — when omitted, the
81
+ * floor is unset and the picker / amount-entry surface neither a "Low Balance" pill nor a
82
+ * minimum CTA. Hosts that want a floor opt in by passing the USD value here.
83
+ */
84
+ minAmountUsd?: number;
85
+ /**
86
+ * Optional upper USD bound on the deposit amount. When set, the amount-entry treats
87
+ * `min(walletBalanceUsd, maxAmountUsd)` as the effective ceiling — typing above it surfaces
88
+ * an inline notice and the footer CTA snaps the amount down on click. Omit to let the
89
+ * wallet balance be the only ceiling.
87
90
  */
88
- minDepositUsd?: number;
91
+ maxAmountUsd?: number;
89
92
  /**
90
93
  * Optional metadata persisted on the UDA at `gateway/start` time. Echoed back on
91
94
  * `gateway/{owner}` and webhook payloads. Treat as untrusted display data.
@@ -104,12 +107,15 @@ interface StridgeDriverConfig {
104
107
  /** Polling cadence overrides. */
105
108
  pollIntervals?: StridgePollIntervals;
106
109
  /**
107
- * Wagmi config used to sign and broadcast transfers. Receipt polling is intentionally NOT
110
+ * Wagmi config used to sign and broadcast transfers. Optional when omitted, the driver
111
+ * still bootstraps for read-only paths (balances, addresses, brand, quotes) and the
112
+ * transfer-crypto method path, but {@link DepositDriver.submitDeposit} throws a user-readable
113
+ * error since signing has no connector to talk to. Receipt polling is intentionally NOT
108
114
  * routed through this — the driver uses an internal Stridge RPC client (see `rpc.ts`) so
109
- * deposits don't depend on the host's wagmi public client (which falls
110
- * through to viem's hard-coded public defaults — unreliable for live tx flow).
115
+ * deposits don't depend on the host's wagmi public client (which falls through to viem's
116
+ * hard-coded public defaults — unreliable for live tx flow).
111
117
  */
112
- wagmiConfig: Config;
118
+ wagmiConfig?: Config;
113
119
  /**
114
120
  * Advanced escape hatch: inject a custom Stridge RPC client (e.g. for tests or a self-hosted
115
121
  * proxy). Defaults to a client that targets `https://${chainId}.nodes.stridge.com`.
@@ -142,4 +148,4 @@ interface StridgeDriverConfig {
142
148
  };
143
149
  }
144
150
  //#endregion
145
- export { STRIDGE_DEFAULT_ENVIRONMENT, STRIDGE_DEFAULT_MIN_DEPOSIT_USD, StridgeDriverConfig, StridgeDriverDestination, StridgeEnvironment, StridgePollIntervals, StridgeTokenIconResolverEntry };
151
+ export { STRIDGE_DEFAULT_ENVIRONMENT, StridgeDriverConfig, StridgeDriverDestination, StridgeEnvironment, StridgePollIntervals, StridgeTokenIconResolverEntry };
@@ -1 +1 @@
1
- const e=`production`,t=3;export{e as STRIDGE_DEFAULT_ENVIRONMENT,t as STRIDGE_DEFAULT_MIN_DEPOSIT_USD};
1
+ const e=`production`;export{e as STRIDGE_DEFAULT_ENVIRONMENT};
@@ -1 +1 @@
1
- import{numberToHex as e}from"viem";import{getAccount as t,getConnectorClient as n,switchChain as r}from"wagmi/actions";function i(i){return{async signAndBroadcastStep(o,s){a(s);let c=t(i.wagmiConfig);if(!c.address)throw Error(`Connect a wallet to sign and submit the deposit.`);c.chainId!==o.chainId&&await r(i.wagmiConfig,{chainId:o.chainId}),a(s);let l=o.from??c.address;if(!l)throw Error(`Stridge driver: no connected wallet address available to broadcast the deposit tx.`);return await(await n(i.wagmiConfig,{chainId:o.chainId})).request({method:`eth_sendTransaction`,params:[{from:l,to:o.to,data:o.data,value:e(o.value),chainId:e(o.chainId)}]})}}}function a(e){if(e.aborted)throw new DOMException(`Aborted`,`AbortError`)}export{i as createWagmiSigner};
1
+ import{ensureWalletChain as e}from"./internal/ensureWalletChain.js";import{numberToHex as t}from"viem";import{getAccount as n,getConnectorClient as r}from"wagmi/actions";function i(i){return{async signAndBroadcastStep(o,s){a(s);let c=n(i.wagmiConfig);if(!c.address)throw Error(`Connect a wallet to sign and submit the deposit.`);await e(o.chainId,{wagmiConfig:i.wagmiConfig,getSupportedAssets:i.getSupportedAssets,explorers:i.explorers}),a(s);let l=o.from??c.address;if(!l)throw Error(`Stridge driver: no connected wallet address available to broadcast the deposit tx.`);return await(await r(i.wagmiConfig,{chainId:o.chainId})).request({method:`eth_sendTransaction`,params:[{from:l,to:o.to,data:o.data,value:t(o.value),chainId:t(o.chainId)}]})}}}function a(e){if(e.aborted)throw new DOMException(`Aborted`,`AbortError`)}export{i as createWagmiSigner};
@@ -38,8 +38,8 @@ interface CreateStridgeMockDriverInput {
38
38
  getI18n?: () => I18n;
39
39
  /** Connected wallet info. When omitted, defaults to {@link DEFAULT_WALLET_INFO}. */
40
40
  wallet?: WalletInfo;
41
- /** Optional minimum-deposit USD floor surfaced on `target.payload.minDepositUsd`. */
42
- minDepositUsd?: number;
41
+ /** Optional minimum-deposit USD floor surfaced on `target.payload.minAmountUsd`. */
42
+ minAmountUsd?: number;
43
43
  /**
44
44
  * Settlement-destination override — a `{ chain, symbol }` selector resolved against the
45
45
  * mock's bundled catalog ({@link SAMPLE_DEPOSIT_CHAINS} via {@link resolveMockAsset}). Drives