@stridge/kit 0.1.0-alpha.13 → 0.1.0-alpha.15

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 (38) hide show
  1. package/README.md +17 -3
  2. package/dist/KitProvider.js +1 -1
  3. package/dist/_internal/withdraw/driver/index.d.ts +2 -2
  4. package/dist/drivers/stridge/createStridgeDepositDriver.js +1 -1
  5. package/dist/drivers/stridge/createStridgeWithdrawDriver.d.ts +10 -12
  6. package/dist/drivers/stridge/createStridgeWithdrawDriver.js +1 -1
  7. package/dist/drivers/stridge/types.d.ts +7 -4
  8. package/dist/drivers/stridge-mock/createStridgeMockWithdrawDriver.d.ts +2 -2
  9. package/dist/drivers/stridge-mock/createStridgeMockWithdrawDriver.js +1 -1
  10. package/dist/flows/deposit/orchestrator/controller.js +1 -1
  11. package/dist/flows/deposit/widgets/deposit/Deposit.js +1 -1
  12. package/dist/flows/shared/transformers/pickRelevantSettlement.js +1 -1
  13. package/dist/flows/withdraw/dialog/WithdrawDialog.d.ts +57 -11
  14. package/dist/flows/withdraw/dialog/WithdrawDialog.js +1 -1
  15. package/dist/flows/withdraw/dialog/WithdrawDialogBindingsContext.d.ts +44 -0
  16. package/dist/flows/withdraw/dialog/WithdrawDialogBindingsContext.js +1 -0
  17. package/dist/flows/withdraw/driver/types.d.ts +53 -11
  18. package/dist/flows/withdraw/orchestrator/controller.js +1 -1
  19. package/dist/flows/withdraw/orchestrator/reducer.js +1 -1
  20. package/dist/flows/withdraw/orchestrator/types.d.ts +106 -31
  21. package/dist/flows/withdraw/widgets/withdraw-form/WithdrawForm.js +1 -1
  22. package/dist/flows/withdraw/widgets/withdraw-form/compound/WithdrawForm.js +1 -1
  23. package/dist/flows/withdraw/widgets/withdraw-form/compound/components/RecipientField.d.ts +7 -5
  24. package/dist/flows/withdraw/widgets/withdraw-form/compound/components/RecipientField.js +1 -1
  25. package/dist/flows/withdraw/widgets/withdraw-form/compound/types.d.ts +8 -5
  26. package/dist/i18n/locales/ar.js +1 -1
  27. package/dist/i18n/locales/es.js +1 -1
  28. package/dist/i18n/locales/source-keys.d.ts +1 -1
  29. package/dist/index.d.ts +2 -2
  30. package/dist/package.js +1 -1
  31. package/dist/shared/driver/types.d.ts +4 -3
  32. package/dist/shared/orchestrator/useSettlementWatcher.js +1 -1
  33. package/dist/stridge/StridgeProvider.d.ts +44 -3
  34. package/dist/stridge/StridgeProvider.js +1 -1
  35. package/dist/stridge/optionalWagmi.js +1 -0
  36. package/dist/stridge/stubs.js +1 -1
  37. package/dist/withdraw/dialog/index.d.ts +3 -1
  38. package/package.json +1 -1
@@ -7,6 +7,6 @@
7
7
  * as the typed contract for {@link defineMessages}: callers get autocomplete on every key the
8
8
  * kit translates, and unknown keys fail at compile time via excess-property checks.
9
9
  */
10
- type KitTranslatableKey = "0x…" | "< 1 min" | "Account" | "Amount" | "Assets" | "Auto · {value}" | "Back" | "Balance: {0} {1}" | "By clicking Confirm Deposit, you agree to our <0>terms</0>." | "Chains" | "Close" | "Close this dialog and try again in a moment. If the problem persists, double-check the gateway key on your integration." | "Close — we'll notify you" | "Completion tx" | "Confirm Deposit" | "Confirm transaction in your wallet" | "Continue" | "Copied!" | "Copy" | "Copy deposit address" | "Couldn't load deposit options" | "Credited to {captionSuffix}" | "Crediting" | "Deposit" | "Deposit completed" | "Deposit didn't complete" | "Deposit failed" | "Deposit max balance" | "Deposit received" | "Deposit received and processing…" | "Deposit successful" | "Deposit to {0}" | "Deposit tx" | "Deposit {0}" | "Deposit {0} to {1}" | "Deposit {symbol}" | "Destination" | "Detected" | "Difference between the route's expected output and the underlying market mid-price." | "Dismiss pending deposit notice" | "Done" | "Enter Amount" | "Enter Recipient Address" | "Enter Valid Recipient Address" | "Error" | "Estimated time" | "Estimating gas…" | "Estimating quote" | "Experiencing problems?" | "Failed" | "Failed to submit deposit." | "Failed to submit withdrawal." | "Fill status" | "Funds are safe on the source chain — contact support to recover." | "Get help" | "Have questions?" | "Hide technical details" | "In transit" | "Instant" | "Insufficient Balance" | "Insufficient balance" | "Low Balance" | "Max" | "Max slippage" | "Message" | "Min {0}" | "Min {minDeposit}" | "More about {0}" | "More details" | "More information" | "Network cost" | "No limit" | "Order failed" | "Order filled" | "Order submitted" | "Payment Method" | "Please try again or contact us if the issue persists." | "Price impact" | "Processing" | "Processing time: {resolvedProcessingTime}" | "Receive chain" | "Receive token" | "Recipient address" | "Regenerating quote…" | "Route" | "See less" | "See more" | "Send the selected token on the selected chain to this address. Funds appear in your account once the network confirms the transfer." | "Settlement tx" | "Show technical details" | "Signature declined. Please try again." | "Something went wrong" | "Something went wrong. Please try again." | "Source" | "Source tx" | "Stack" | "Successful" | "Swap displayed amount" | "Technical details" | "Terms apply" | "The bridge could not fund the destination transaction (gas budget exhausted)." | "The deposit driver failed to load gateway configuration." | "The destination-leg transaction reverted on-chain." | "The estimated cost to broadcast this transaction on the destination chain." | "The kit hit an unexpected error and could not finish rendering. Try again, or close this dialog and retry from the host." | "The minimum amount required for this chain to cover network fees and routing." | "The route's expected output drifted while your transaction was pending." | "The selected liquidity route used to settle this withdrawal." | "Toggle technical details" | "Tokens" | "Total time" | "Transaction breakdown" | "Transfer Crypto" | "Try again" | "Update order" | "Use connected wallet address" | "View details" | "View on Explorer" | "View progress" | "View receipt" | "Wallet" | "We can't reach the gateway right now" | "Withdraw" | "Withdrawal complete" | "Withdrawal failed" | "Withdrawal failed." | "Withdrawal in progress…" | "Withdrawal successful" | "Withdrawal tx" | "You receive" | "You send" | "You will receive" | "Your deposit address" | "Your deposit has been credited to your account." | "Your deposit has been credited to {brand}." | "Your deposit will be credited to your account." | "Your deposit will be credited to {brand}." | "Your funds were successfully deposited." | "Your funds were successfully withdrawn." | "{0, plural, one {# second} other {# seconds}} left on quote" | "{formattedMin} minimum deposit" | "{hours} hr" | "{minutes} min" | "{n}h" | "{n}m" | "{n}s" | "~ 2 min";
10
+ type KitTranslatableKey = "0x…" | "< 1 min" | "Account" | "Amount" | "Assets" | "Auto · {value}" | "Back" | "Balance: {0} {1}" | "By clicking Confirm Deposit, you agree to our <0>terms</0>." | "Chains" | "Close" | "Close this dialog and try again in a moment. If the problem persists, double-check the gateway key on your integration." | "Close — we'll notify you" | "Completion tx" | "Confirm Deposit" | "Confirm transaction in your wallet" | "Connect a wallet to continue" | "Continue" | "Copied!" | "Copy" | "Copy deposit address" | "Couldn't load deposit options" | "Credited to {captionSuffix}" | "Crediting" | "Deposit" | "Deposit completed" | "Deposit didn't complete" | "Deposit failed" | "Deposit max balance" | "Deposit received" | "Deposit received and processing…" | "Deposit successful" | "Deposit to {0}" | "Deposit tx" | "Deposit {0}" | "Deposit {0} to {1}" | "Deposit {symbol}" | "Destination" | "Detected" | "Difference between the route's expected output and the underlying market mid-price." | "Dismiss pending deposit notice" | "Done" | "Enter Amount" | "Enter Recipient Address" | "Enter Valid Recipient Address" | "Error" | "Estimated time" | "Estimating gas…" | "Estimating quote" | "Experiencing problems?" | "Failed" | "Failed to submit deposit." | "Failed to submit withdrawal." | "Fill status" | "Funds are safe on the source chain — contact support to recover." | "Get help" | "Have questions?" | "Hide technical details" | "In transit" | "Instant" | "Insufficient Balance" | "Insufficient balance" | "Low Balance" | "Max" | "Max slippage" | "Message" | "Min {0}" | "Min {minDeposit}" | "More about {0}" | "More details" | "More information" | "Network cost" | "No limit" | "Order failed" | "Order filled" | "Order submitted" | "Payment Method" | "Please try again or contact us if the issue persists." | "Price impact" | "Processing" | "Processing time: {resolvedProcessingTime}" | "Receive chain" | "Receive token" | "Recipient address" | "Regenerating quote…" | "Route" | "See less" | "See more" | "Send the selected token on the selected chain to this address. Funds appear in your account once the network confirms the transfer." | "Settlement tx" | "Show technical details" | "Signature declined. Please try again." | "Something went wrong" | "Something went wrong. Please try again." | "Source" | "Source tx" | "Stack" | "Successful" | "Swap displayed amount" | "Technical details" | "Terms apply" | "The bridge could not fund the destination transaction (gas budget exhausted)." | "The deposit driver failed to load gateway configuration." | "The destination-leg transaction reverted on-chain." | "The estimated cost to broadcast this transaction on the destination chain." | "The kit hit an unexpected error and could not finish rendering. Try again, or close this dialog and retry from the host." | "The minimum amount required for this chain to cover network fees and routing." | "The route's expected output drifted while your transaction was pending." | "The selected liquidity route used to settle this withdrawal." | "Toggle technical details" | "Tokens" | "Total time" | "Transaction breakdown" | "Transfer Crypto" | "Try again" | "Update order" | "Use suggested recipient address" | "View details" | "View on Explorer" | "View progress" | "View receipt" | "Wallet" | "We can't reach the gateway right now" | "Withdraw" | "Withdrawal complete" | "Withdrawal failed" | "Withdrawal failed." | "Withdrawal in progress…" | "Withdrawal successful" | "Withdrawal tx" | "You receive" | "You send" | "You will receive" | "Your deposit address" | "Your deposit has been credited to your account." | "Your deposit has been credited to {brand}." | "Your deposit will be credited to your account." | "Your deposit will be credited to {brand}." | "Your funds were successfully deposited." | "Your funds were successfully withdrawn." | "{0, plural, one {# second} other {# seconds}} left on quote" | "{formattedMin} minimum deposit" | "{hours} hr" | "{minutes} min" | "{n}h" | "{n}m" | "{n}s" | "~ 2 min";
11
11
  //#endregion
12
12
  export { KitTranslatableKey };
package/dist/index.d.ts CHANGED
@@ -22,5 +22,5 @@ import { useDeposit } from "./flows/deposit/orchestrator/useDeposit.js";
22
22
  import { useWithdrawState } from "./flows/withdraw/orchestrator/controller.js";
23
23
  import { useWithdraw } from "./flows/withdraw/orchestrator/useWithdraw.js";
24
24
  import { useOptionalStridge, useStridge } from "./stridge/StridgeContext.js";
25
- import { StridgeAppearance, StridgeAsset, StridgeDepositFlowConfig, StridgeProvider, StridgeStorageConfig, StridgeWithdrawFlowConfig } from "./stridge/StridgeProvider.js";
26
- export { type BannerAckBucket, type ChainInput, type ChainLogoInput, type ChainLogoMeta, type ChainSlug, DEFAULT_KIT_STORAGE_NAMESPACE, type DepositActions, type DepositController, type DepositMethod, type OpenInput as DepositOpenInput, type DepositSnapshot, type DepositState, type DepositStateName, type FailureInfo, KitPortalScope, KitStorageProvider, type LogosNamespace, type StridgeAppearance, type StridgeAsset, type StridgeDepositFlowConfig, type StridgeEnvironment, StridgeProvider, type StridgeStorageConfig, type StridgeWithdrawFlowConfig, type TokenLogoInput, type TxRef, type WithdrawActions, type WithdrawController, type WithdrawSnapshot, type WithdrawState, type WithdrawStateName, type WithdrawalFormSnapshot, bannerAckStorageKey, bucketFromSettlement, chains, createKitStorage, createLocalStorageAdapter, createMemoryStorageAdapter, createSessionStorageAdapter, logos, resolveStorageAdapter, useBannerAck, useBannerAckForSettlement, useDeposit, useDepositSnapshot, useDepositState, useKitConfig, useKitStorage, useKitStorageValue, useOptionalStridge, useStridge, useWithdraw, useWithdrawSnapshot, useWithdrawState };
25
+ import { StridgeAppearance, StridgeAsset, StridgeDepositDestination, StridgeDepositFlowConfig, StridgeFlowOwner, StridgeProvider, StridgeStorageConfig, StridgeWithdrawFlowConfig } from "./stridge/StridgeProvider.js";
26
+ export { type BannerAckBucket, type ChainInput, type ChainLogoInput, type ChainLogoMeta, type ChainSlug, DEFAULT_KIT_STORAGE_NAMESPACE, type DepositActions, type DepositController, type DepositMethod, type OpenInput as DepositOpenInput, type DepositSnapshot, type DepositState, type DepositStateName, type FailureInfo, KitPortalScope, KitStorageProvider, type LogosNamespace, type StridgeAppearance, type StridgeAsset, type StridgeDepositDestination, type StridgeDepositFlowConfig, type StridgeEnvironment, type StridgeFlowOwner, StridgeProvider, type StridgeStorageConfig, type StridgeWithdrawFlowConfig, type TokenLogoInput, type TxRef, type WithdrawActions, type WithdrawController, type WithdrawSnapshot, type WithdrawState, type WithdrawStateName, type WithdrawalFormSnapshot, bannerAckStorageKey, bucketFromSettlement, chains, createKitStorage, createLocalStorageAdapter, createMemoryStorageAdapter, createSessionStorageAdapter, logos, resolveStorageAdapter, useBannerAck, useBannerAckForSettlement, useDeposit, useDepositSnapshot, useDepositState, useKitConfig, useKitStorage, useKitStorageValue, useOptionalStridge, useStridge, useWithdraw, useWithdrawSnapshot, useWithdrawState };
package/dist/package.js CHANGED
@@ -1 +1 @@
1
- var e=`0.1.0-alpha.13`;export{e as version};
1
+ var e=`0.1.0-alpha.15`;export{e as version};
@@ -6,9 +6,10 @@
6
6
  * public `@stridge/kit/<flow>/driver` surface.
7
7
  */
8
8
  /**
9
- * On-chain transaction reference. Drivers return one of these from any imperative wallet action
10
- * (`submitDeposit`, `submitWithdrawal`); the orchestrator stamps it on the FSM's `tx` slot until
11
- * the matching settlement entity catches up and exposes a richer `txHash` / `txExplorerUrl` pair.
9
+ * On-chain transaction reference. The deposit driver returns one from `submitDeposit`; the
10
+ * withdraw flow's host-supplied `onSubmit` surfaces one via `actions.beginProcessing({ hash })`
11
+ * or `actions.setTxHash`. The orchestrator stamps it on the FSM's `tx` slot until the matching
12
+ * settlement entity catches up and exposes a richer `txHash` / `txExplorerUrl` pair.
12
13
  */
13
14
  interface TxRef {
14
15
  hash: string;
@@ -1 +1 @@
1
- import{useEffect as e}from"react";function t(t,n){let r=n?.hash;e(()=>{if(!n)return;let e=new AbortController;return t.watchSettlement({tx:n},()=>void 0,e.signal),()=>e.abort()},[r,t])}export{t as useSettlementWatcher};
1
+ import{useEffect as e,useRef as t}from"react";function n(n,r,i){let a=t(r);a.current=r,e(()=>{let e=a.current;if(e==null)return;let t=new AbortController;return n.watchSettlement(e,()=>void 0,t.signal),()=>t.abort()},[n,i])}export{n as useSettlementWatcher};
@@ -22,9 +22,44 @@ interface StridgeAsset {
22
22
  symbol: string;
23
23
  }
24
24
  /**
25
- * Per-flow deposit tuning. Pass `deposit: {}` to enable the deposit flow with defaults.
25
+ * Settlement destination for the deposit flow. The kit does not infer a destination from any
26
+ * connected wagmi wallet — businesses pass the treasury / settlement address where deposited
27
+ * funds should land.
28
+ *
29
+ * @remarks
30
+ * If the gateway-kit admin config has "Same-owner only" enabled (default), `address` must
31
+ * equal {@link StridgeDepositFlowConfig.owner | the deposit owner}. Turn the toggle off — and
32
+ * optionally pair it with a destination whitelist — to route funds to an address that differs
33
+ * from the owner.
34
+ */
35
+ interface StridgeDepositDestination {
36
+ address: Address;
37
+ }
38
+ /**
39
+ * Stridge `gateway/start.owner` identifier for a single flow. Scopes UDA provisioning and the
40
+ * proactive `gateway/{owner}` settlement poll. The kit treats the address as opaque — businesses
41
+ * pick whatever per-customer (real EOA, derived per-user EOA) or shared (treasury) granularity
42
+ * fits their model.
43
+ */
44
+ interface StridgeFlowOwner {
45
+ address: Address;
46
+ }
47
+ /**
48
+ * Per-flow deposit tuning.
26
49
  */
27
50
  interface StridgeDepositFlowConfig {
51
+ /**
52
+ * Settlement destination address — where settled brand-currency funds land at completion.
53
+ * Required when the deposit flow is enabled.
54
+ */
55
+ destination: StridgeDepositDestination;
56
+ /**
57
+ * Owner used as `gateway/start.owner` for deposit UDAs. Optional — falls back to the
58
+ * connected wagmi wallet address, then to `dev.userAddressOverride`. Set explicitly when
59
+ * the customer is identified by something other than their wagmi address (e.g. a derived
60
+ * per-user identifier, or a shared business owner that is not the wagmi-connected EOA).
61
+ */
62
+ owner?: StridgeFlowOwner;
28
63
  /**
29
64
  * Low-balance / amount-entry USD floor. Defaults to the kit's internal default
30
65
  * (`STRIDGE_DEFAULT_MIN_DEPOSIT_USD`) when omitted.
@@ -37,9 +72,15 @@ interface StridgeDepositFlowConfig {
37
72
  metadata?: Record<string, unknown>;
38
73
  }
39
74
  /**
40
- * Per-flow withdraw tuning. Pass `withdraw: {}` to enable the withdraw flow with defaults.
75
+ * Per-flow withdraw tuning.
41
76
  */
42
77
  interface StridgeWithdrawFlowConfig {
78
+ /**
79
+ * Owner used as `gateway/start.owner` for every withdraw UDA the flow provisions. Required —
80
+ * the withdraw flow has no wagmi fallback because the business (not the end-user) is the
81
+ * party broadcasting the source-chain tx to the UDA.
82
+ */
83
+ owner: StridgeFlowOwner;
43
84
  /**
44
85
  * Metadata persisted on every UDA the withdraw flow provisions. Merged under the kit-set
45
86
  * `kit_flow` / `kit_version` / `source` keys (kit keys win).
@@ -183,4 +224,4 @@ declare function StridgeProvider({
183
224
  children
184
225
  }: StridgeProvider.Props): _$react_jsx_runtime0.JSX.Element;
185
226
  //#endregion
186
- export { StridgeAppearance, StridgeAsset, StridgeDepositFlowConfig, StridgeProvider, StridgeStorageConfig, StridgeWithdrawFlowConfig };
227
+ export { StridgeAppearance, StridgeAsset, StridgeDepositDestination, StridgeDepositFlowConfig, StridgeFlowOwner, StridgeProvider, StridgeStorageConfig, StridgeWithdrawFlowConfig };
@@ -1 +1 @@
1
- "use client";import{normalizeChainToNetworkId as e}from"../shared/chains/index.js";import{createKitI18n as t}from"../shared/i18n/createKitI18n.js";import"../i18n/index.js";import{StridgeContext as n}from"./StridgeContext.js";import{createStridgeDepositDriver as r}from"../drivers/stridge/createStridgeDepositDriver.js";import{createStridgeWithdrawDriver as i}from"../drivers/stridge/createStridgeWithdrawDriver.js";import"../_internal/drivers/stridge/index.js";import{KitProvider as a}from"../KitProvider.js";import{useIntercomMerchantContext as o}from"../shared/support/useIntercomMerchantContext.js";import"../shared/support/index.js";import{createStubDepositDriver as s,createStubWithdrawDriver as c}from"./stubs.js";import{useMemo as l,useRef as u,useSyncExternalStore as d}from"react";import{jsx as f}from"react/jsx-runtime";import{useAccount as p,useConfig as m}from"wagmi";function h({gatewayKey:h,environment:g,asset:_,flows:v,appearance:y,i18n:b,storage:x,dev:S,className:C,children:w}){if(!v.deposit&&!v.withdraw)throw Error("<StridgeProvider /> requires at least one of `flows.deposit` or `flows.withdraw`.");if(!_)throw Error("<StridgeProvider /> requires `asset: { chain, symbol }`.");let T=m(),{address:E}=p(),D=E??S?.userAddressOverride,O=l(()=>t(b??{}),[b?.locale,b?.messages]),k=u(O);k.current=O;let A=l(()=>e(_.chain),[_.chain]),j=_.symbol,M=v.deposit,N=v.withdraw,P=l(()=>{if(!(!M||!D))return r({userAddress:D,projectKey:h,destination:{network_id:A,asset_symbol:j},wagmiConfig:T,getI18n:()=>k.current,...g?{environment:g}:{},...M.minDepositUsd===void 0?{}:{minDepositUsd:M.minDepositUsd},...M.metadata?{metadata:M.metadata}:{}})},[M,D,h,g,A,j,T]),F=l(()=>s(),[]),I=M?P??F:void 0,L=l(()=>{if(!(!N||!D))return i({userAddress:D,projectKey:h,currency:{networkId:A,assetSymbol:j},wagmiConfig:T,getI18n:()=>k.current,...g?{environment:g}:{},...N.metadata?{metadata:N.metadata}:{}})},[N,D,h,g,A,j,T]),R=l(()=>c(),[]),z=N?L??R:void 0,B=P??L,V=d(e=>B?.subscribe(e)??(()=>{}),()=>{if(P){let e=P.getSnapshot();return e.brand.status===`ready`&&e.target.status===`ready`}return L?L.getSnapshot().receiveOptions.status===`ready`:!1},()=>!1),H=d(e=>P?.subscribe(e)??(()=>{}),()=>{let e=P;if(!e)return;let t=e.getSnapshot();if(t.brand.status===`ready`||t.brand.status===`stale`)return t.brand.payload.name},()=>void 0),U=d(e=>P?.subscribe(e)??(()=>{}),()=>{let e=P;if(!e)return;let t=e.getSnapshot();if(t.brand.status===`ready`||t.brand.status===`stale`)return t.brand.payload.checkoutItemTitle},()=>void 0);return o({gatewayKey:h,environment:g??`production`,assetChain:A,assetSymbol:j,...D?{userAddress:D}:{},...H?{brandName:H}:{},...U?{checkoutItemTitle:U}:{}}),f(n,{value:l(()=>({isReady:V,driver:P}),[V,P]),children:f(a,{theme:y?.theme,accent:y?.accent,radius:y?.radius,direction:y?.direction,i18n:b,storage:x?.driver,storageNamespace:x?.namespace,className:C,...I?{deposit:I}:{},...z?{withdraw:z}:{},children:w})})}export{h as StridgeProvider};
1
+ "use client";import{normalizeChainToNetworkId as e}from"../shared/chains/index.js";import{createKitI18n as t}from"../shared/i18n/createKitI18n.js";import"../i18n/index.js";import{StridgeContext as n}from"./StridgeContext.js";import{createStridgeDepositDriver as r}from"../drivers/stridge/createStridgeDepositDriver.js";import{createStridgeWithdrawDriver as i}from"../drivers/stridge/createStridgeWithdrawDriver.js";import"../_internal/drivers/stridge/index.js";import{KitProvider as a}from"../KitProvider.js";import{useIntercomMerchantContext as o}from"../shared/support/useIntercomMerchantContext.js";import"../shared/support/index.js";import{useOptionalWagmi as s}from"./optionalWagmi.js";import{createStubDepositDriver as c,createStubWithdrawDriver as l}from"./stubs.js";import{useMemo as u,useRef as d,useSyncExternalStore as f}from"react";import{jsx as p}from"react/jsx-runtime";function m({gatewayKey:m,environment:h,asset:g,flows:_,appearance:v,i18n:y,storage:b,dev:x,className:S,children:C}){if(!_.deposit&&!_.withdraw)throw Error("<StridgeProvider /> requires at least one of `flows.deposit` or `flows.withdraw`.");if(!g)throw Error("<StridgeProvider /> requires `asset: { chain, symbol }`.");let{config:w,address:T}=s(),E=u(()=>t(y??{}),[y?.locale,y?.messages]),D=d(E);D.current=E;let O=u(()=>e(g.chain),[g.chain]),k=g.symbol,A=_.deposit,j=_.withdraw,M=A?.owner?.address??T??x?.userAddressOverride,N=j?.owner.address,P=u(()=>{if(!(!A||!M))return r({userAddress:M,projectKey:m,destination:{network_id:O,asset_symbol:k,to_address:A.destination.address},wagmiConfig:w,getI18n:()=>D.current,...h?{environment:h}:{},...A.minDepositUsd===void 0?{}:{minDepositUsd:A.minDepositUsd},...A.metadata?{metadata:A.metadata}:{}})},[A,M,m,h,O,k,w]),F=u(()=>c(),[]),I=A?P??F:void 0,L=u(()=>{if(!(!j||!N))return i({userAddress:N,projectKey:m,currency:{networkId:O,assetSymbol:k},wagmiConfig:w,getI18n:()=>D.current,...h?{environment:h}:{},...j.metadata?{metadata:j.metadata}:{}})},[j,N,m,h,O,k,w]),R=u(()=>l(),[]),z=j?L??R:void 0,B=P??L,V=f(e=>B?.subscribe(e)??(()=>{}),()=>{if(P){let e=P.getSnapshot();return e.brand.status===`ready`&&e.target.status===`ready`}return L?L.getSnapshot().receiveOptions.status===`ready`:!1},()=>!1),H=f(e=>P?.subscribe(e)??(()=>{}),()=>{let e=P;if(!e)return;let t=e.getSnapshot();if(t.brand.status===`ready`||t.brand.status===`stale`)return t.brand.payload.name},()=>void 0),U=f(e=>P?.subscribe(e)??(()=>{}),()=>{let e=P;if(!e)return;let t=e.getSnapshot();if(t.brand.status===`ready`||t.brand.status===`stale`)return t.brand.payload.checkoutItemTitle},()=>void 0),W=M??N;return o({gatewayKey:m,environment:h??`production`,assetChain:O,assetSymbol:k,...W?{userAddress:W}:{},...H?{brandName:H}:{},...U?{checkoutItemTitle:U}:{}}),p(n,{value:u(()=>({isReady:V,driver:P}),[V,P]),children:p(a,{theme:v?.theme,accent:v?.accent,radius:v?.radius,direction:v?.direction,i18n:y,storage:b?.driver,storageNamespace:b?.namespace,className:S,...I?{deposit:I}:{},...z?{withdraw:z}:{},children:C})})}export{m as StridgeProvider};
@@ -0,0 +1 @@
1
+ "use client";import{use as e,useCallback as t,useSyncExternalStore as n}from"react";import{getAccount as r,watchAccount as i}from"wagmi/actions";import{WagmiContext as a}from"wagmi";function o(){let o=e(a);return{config:o,address:n(t(e=>o?i(o,{onChange:()=>e()}):()=>{},[o]),t(()=>{if(o)return r(o).address},[o]),()=>void 0)}}export{o as useOptionalWagmi};
@@ -1 +1 @@
1
- const e=Object.freeze({status:`idle`}),t=Object.freeze({brand:e,target:e,addresses:e,balances:e,quote:e,settlement:e,wallet:e}),n=Object.freeze({withdrawableBalances:e,receiveOptions:e,quote:e,settlement:e}),r=()=>{};function i(){if(typeof DOMException==`function`)return new DOMException(`Aborted`,`AbortError`);let e=Error(`Aborted`);return e.name=`AbortError`,e}function a(e){return new Promise((t,n)=>{if(e.aborted){n(i());return}e.addEventListener(`abort`,()=>n(i()),{once:!0})})}function o(){return{getSnapshot:()=>t,subscribe:()=>r,requestQuote:(e,t)=>a(t),submitDeposit:(e,t)=>a(t),watchSettlement:()=>{},fetchActiveSettlement:async()=>null}}function s(){return{getSnapshot:()=>n,subscribe:()=>r,requestQuote:(e,t)=>a(t),submitWithdrawal:(e,t)=>a(t),watchSettlement:()=>{}}}export{o as createStubDepositDriver,s as createStubWithdrawDriver};
1
+ const e=Object.freeze({status:`idle`}),t=Object.freeze({brand:e,target:e,addresses:e,balances:e,quote:e,settlement:e,wallet:e}),n=Object.freeze({withdrawableBalances:e,receiveOptions:e,quote:e,settlement:e}),r=()=>{};function i(){if(typeof DOMException==`function`)return new DOMException(`Aborted`,`AbortError`);let e=Error(`Aborted`);return e.name=`AbortError`,e}function a(e){return new Promise((t,n)=>{if(e.aborted){n(i());return}e.addEventListener(`abort`,()=>n(i()),{once:!0})})}function o(){return{getSnapshot:()=>t,subscribe:()=>r,requestQuote:(e,t)=>a(t),submitDeposit:(e,t)=>a(t),watchSettlement:()=>{},fetchActiveSettlement:async()=>null}}function s(){return{getSnapshot:()=>n,subscribe:()=>r,requestQuote:(e,t)=>a(t),prepareWithdrawal:(e,t)=>a(t),watchSettlement:()=>{}}}export{o as createStubDepositDriver,s as createStubWithdrawDriver};
@@ -1,2 +1,4 @@
1
+ import { WithdrawSubmitActions, WithdrawSubmitCallback, WithdrawSubmitInput } from "../../flows/withdraw/orchestrator/types.js";
2
+ import { WithdrawBalanceInput, WithdrawSuggestedRecipient } from "../../flows/withdraw/dialog/WithdrawDialogBindingsContext.js";
1
3
  import { WithdrawDialog } from "../../flows/withdraw/dialog/WithdrawDialog.js";
2
- export { WithdrawDialog };
4
+ export { type WithdrawBalanceInput, WithdrawDialog, type WithdrawSubmitActions, type WithdrawSubmitCallback, type WithdrawSubmitInput, type WithdrawSuggestedRecipient };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stridge/kit",
3
- "version": "0.1.0-alpha.13",
3
+ "version": "0.1.0-alpha.15",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "files": [