@stridge/kit 0.1.0-alpha.13 → 0.1.0-alpha.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/KitProvider.js +1 -1
- package/dist/_internal/withdraw/driver/index.d.ts +2 -2
- package/dist/drivers/stridge/createStridgeDepositDriver.js +1 -1
- package/dist/drivers/stridge/createStridgeWithdrawDriver.d.ts +10 -12
- package/dist/drivers/stridge/createStridgeWithdrawDriver.js +1 -1
- package/dist/drivers/stridge/types.d.ts +7 -4
- package/dist/drivers/stridge-mock/createStridgeMockWithdrawDriver.d.ts +2 -2
- package/dist/drivers/stridge-mock/createStridgeMockWithdrawDriver.js +1 -1
- package/dist/flows/deposit/orchestrator/controller.js +1 -1
- package/dist/flows/deposit/widgets/deposit/Deposit.js +1 -1
- package/dist/flows/shared/transformers/pickRelevantSettlement.js +1 -1
- package/dist/flows/withdraw/dialog/WithdrawDialog.d.ts +57 -11
- package/dist/flows/withdraw/dialog/WithdrawDialog.js +1 -1
- package/dist/flows/withdraw/dialog/WithdrawDialogBindingsContext.d.ts +44 -0
- package/dist/flows/withdraw/dialog/WithdrawDialogBindingsContext.js +1 -0
- package/dist/flows/withdraw/driver/types.d.ts +53 -11
- package/dist/flows/withdraw/orchestrator/controller.js +1 -1
- package/dist/flows/withdraw/orchestrator/reducer.js +1 -1
- package/dist/flows/withdraw/orchestrator/types.d.ts +106 -31
- package/dist/flows/withdraw/widgets/withdraw-form/WithdrawForm.js +1 -1
- package/dist/flows/withdraw/widgets/withdraw-form/compound/WithdrawForm.js +1 -1
- package/dist/flows/withdraw/widgets/withdraw-form/compound/components/RecipientField.d.ts +7 -5
- package/dist/flows/withdraw/widgets/withdraw-form/compound/components/RecipientField.js +1 -1
- package/dist/flows/withdraw/widgets/withdraw-form/compound/types.d.ts +8 -5
- package/dist/i18n/locales/ar.js +1 -1
- package/dist/i18n/locales/es.js +1 -1
- package/dist/i18n/locales/source-keys.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/package.js +1 -1
- package/dist/shared/driver/types.d.ts +4 -3
- package/dist/shared/orchestrator/useSettlementWatcher.js +1 -1
- package/dist/stridge/StridgeProvider.d.ts +44 -3
- package/dist/stridge/StridgeProvider.js +1 -1
- package/dist/stridge/optionalWagmi.js +1 -0
- package/dist/stridge/stubs.js +1 -1
- package/dist/withdraw/dialog/index.d.ts +3 -1
- package/package.json +1 -1
|
@@ -22,9 +22,44 @@ interface StridgeAsset {
|
|
|
22
22
|
symbol: string;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
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.
|
|
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
|
|
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};
|
package/dist/stridge/stubs.js
CHANGED
|
@@ -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),
|
|
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 };
|