@stridge/kit 0.1.0-alpha.30 → 0.1.0-alpha.31
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/_internal/drivers/stridge/index.d.ts +2 -2
- package/dist/_internal/drivers/stridge/index.js +1 -1
- package/dist/drivers/stridge/createStridgeDepositDriver.js +1 -1
- package/dist/drivers/stridge/createStridgeWithdrawDriver.d.ts +16 -1
- package/dist/drivers/stridge/createStridgeWithdrawDriver.js +1 -1
- package/dist/drivers/stridge/types.d.ts +13 -10
- package/dist/drivers/stridge/types.js +1 -1
- package/dist/drivers/stridge-mock/createStridgeMockDriver.d.ts +2 -2
- package/dist/drivers/stridge-mock/createStridgeMockDriver.js +1 -1
- package/dist/drivers/stridge-mock/createStridgeMockWithdrawDriver.d.ts +12 -0
- package/dist/drivers/stridge-mock/createStridgeMockWithdrawDriver.js +1 -1
- package/dist/drivers/stridge-mock/fixtures.d.ts +6 -6
- package/dist/drivers/stridge-mock/fixtures.js +1 -1
- package/dist/flows/deposit/driver/payloads.d.ts +10 -4
- package/dist/flows/deposit/driver/transformers/balanceToBalancesPayload.js +1 -1
- package/dist/flows/deposit/driver/transformers/startToAddressesPayload.js +1 -1
- package/dist/flows/deposit/driver/transformers/startToTargetPayload.js +1 -1
- package/dist/flows/deposit/widgets/amount-entry/AmountEntry.d.ts +1 -1
- package/dist/flows/deposit/widgets/amount-entry/AmountEntry.js +1 -1
- package/dist/flows/deposit/widgets/amount-entry/footerIntent.js +1 -0
- package/dist/flows/deposit/widgets/transfer-crypto/TransferCrypto.js +1 -1
- package/dist/flows/withdraw/driver/types.d.ts +16 -2
- package/dist/flows/withdraw/widgets/withdraw-form/WithdrawForm.js +1 -1
- package/dist/flows/withdraw/widgets/withdraw-form/validation.js +1 -1
- package/dist/i18n/locales/ar.js +1 -1
- package/dist/i18n/locales/es.js +1 -1
- package/dist/i18n/locales/source-keys.d.ts +1 -1
- package/dist/package.js +1 -1
- package/dist/stridge/StridgeProvider.d.ts +25 -3
- package/dist/stridge/StridgeProvider.js +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StridgeChainSlug, StridgeRpc, StridgeRpcConfig, StridgeRpcWaitInput, createStridgeRpc } from "../../../drivers/stridge/rpc.js";
|
|
2
|
-
import { STRIDGE_DEFAULT_ENVIRONMENT,
|
|
2
|
+
import { STRIDGE_DEFAULT_ENVIRONMENT, StridgeDriverConfig, StridgeDriverDestination, StridgeEnvironment, StridgePollIntervals, StridgeTokenIconResolverEntry } from "../../../drivers/stridge/types.js";
|
|
3
3
|
import { CreateStridgeDepositDriverInput, createStridgeDepositDriver } from "../../../drivers/stridge/createStridgeDepositDriver.js";
|
|
4
4
|
import { CreateStridgeWithdrawDriverInput, StridgeWithdrawCurrency, createStridgeWithdrawDriver } from "../../../drivers/stridge/createStridgeWithdrawDriver.js";
|
|
5
5
|
import { GatewayStartResponse, SupportedAssetsResponse } from "@stridge/sdk";
|
|
6
|
-
export { type CreateStridgeDepositDriverInput, type CreateStridgeWithdrawDriverInput, type GatewayStartResponse, STRIDGE_DEFAULT_ENVIRONMENT,
|
|
6
|
+
export { type CreateStridgeDepositDriverInput, type CreateStridgeWithdrawDriverInput, type GatewayStartResponse, STRIDGE_DEFAULT_ENVIRONMENT, 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 };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{STRIDGE_DEFAULT_ENVIRONMENT as e
|
|
1
|
+
import{STRIDGE_DEFAULT_ENVIRONMENT as e}from"../../../drivers/stridge/types.js";import{createStridgeRpc as t}from"../../../drivers/stridge/rpc.js";import{createStridgeDepositDriver as n}from"../../../drivers/stridge/createStridgeDepositDriver.js";import{createStridgeWithdrawDriver as r}from"../../../drivers/stridge/createStridgeWithdrawDriver.js";export{e as STRIDGE_DEFAULT_ENVIRONMENT,n as createStridgeDepositDriver,t as createStridgeRpc,r as createStridgeWithdrawDriver};
|
|
@@ -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 h}from"./internal/encoding.js";import
|
|
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 h}from"./internal/encoding.js";import{resolveSdkEnv as g}from"./internal/env.js";import{buildKitMetadata as _}from"./internal/metadata.js";import{pollOnce as v}from"./internal/pollOnce.js";import{buildErc20OrNativeStep as y,signAndConfirm as ee}from"./internal/signAndConfirm.js";import{startPoll as b}from"./poll.js";import{createStridgeRpc as x}from"./rpc.js";import{createWagmiSigner as te}from"./wagmiSigner.js";import{createApiClient as S}from"@stridge/sdk";function C(C){let O=S({projectKey:C.projectKey,env:g(C.environment)}),k=C.pollIntervals??{},A=k.detectionMs??2e3,j=k.processingMs??2e3,M=k.terminalMs??1e4,N=k.balancesMs??6e4,P=C.minAmountUsd,F=C.maxAmountUsd,I=C.getI18n??(()=>e),L={...d(),...C.explorers??{}},R=C.destination.network_id,z=C.destination.asset_symbol,B=C.destination.to_address??C.userAddress,V=C.wagmiConfig?te({wagmiConfig:C.wagmiConfig}):void 0,H=C.rpc??x(),U={address:C.userAddress},W=f({brand:{status:`loading`},target:{status:`loading`},addresses:{status:`loading`},balances:{status:`loading`},quote:{status:`idle`},settlement:{status:`idle`},wallet:{status:`ready`,payload:u(U),raw:U,response:U}}),G,K,q,J;function Y(){if(K)return q??=i(K),q}let X=(async()=>{try{let[e,t]=await Promise.all([O.gateway.start({owner:C.userAddress,destination:{network_id:R,to_address:B,asset_symbol:z},metadata:_({flow:`deposit`,...C.metadata?{hostMetadata:C.metadata}:{},extras:{destination:{networkId:R,assetSymbol:z}}})}),O.uda.supportedAssets().catch(()=>null)]);G=e;let n=e.metadata?.brand_name;typeof n==`string`&&n.trim().length>0&&(J=n.trim());let r=I();if(t&&(K=t,q=void 0),W.update({brand:{status:`ready`,payload:c(e.metadata),raw:e.metadata,response:e},addresses:{status:`ready`,payload:s(e.deposit_addresses,{i18n:r,explorers:L,...t?{chainLogos:T(t)}:{},...t?{minAmountUsdByEip155Id:D(t,P),nativeAssetByEip155Id:E(t)}:{}}),raw:e.deposit_addresses,response:e}}),t){let e=l(t,{i18n:r,networkId:R,assetSymbol:z,minAmountUsd:P,...F===void 0?{}:{maxAmountUsd:F}}),n=t.assets.find(e=>String(e.network_id)===R);e&&n?W.update({target:{status:`ready`,payload:e,raw:n,response:t}}):W.update({target:{status:`error`,error:Error(`Destination not found in supportedAssets catalog.`)}})}else W.update({target:{status:`error`,error:Error(`supportedAssets fetch failed.`)}})}catch(e){let t=e instanceof Error?e:Error(String(e));W.update({brand:{status:`error`,error:t},target:{status:`error`,error:t},addresses:{status:`error`,error:t}})}})(),Z=!1,ne=(async()=>{try{let e=await O.balance.onchain(C.userAddress,{includeSpam:!1,includeZero:!1});await X;let t=Y();if(!t)return null;let n=r(e,{i18n:I(),routable:t,minAmountUsd:P,...C.resolveTokenIcon?{resolveTokenIcon:C.resolveTokenIcon}:{}});return W.update({balances:{status:`ready`,payload:n,raw:e,response:e},wallet:Q(n,I())}),e}catch(e){let t=e instanceof Error?e:Error(String(e));return W.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(U),balanceTotalUsd:{value:r,formatted:n(r,t)}},raw:U,response:U}}return{getSnapshot(){return W.getSnapshot()},subscribe(e){return W.subscribe(e)},async requestQuote(e,t){W.update({quote:{status:`loading`}});let n=G;if(!n){W.update({quote:{status:`error`,error:Error(`gateway/start not yet resolved.`)}});return}try{let r=e.sourceChainId,i=e.sourceIsNative?p:e.sourceTokenAddress,o=h(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:B},{signal:t});if(t.aborted)return;let c=I(),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}});W.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));W.update({quote:{status:`error`,error:n}})}},async submitDeposit(e,t){if(!V)throw Error(`Connect a wallet to sign and submit the deposit.`);let n=G;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 ee({signer:V,rpc:H,step:y({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:L,...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(!Z)return Z=!0,ne;try{let t=await O.balance.onchain(C.userAddress,{signal:e,includeSpam:!1,includeZero:!1});await X;let n=Y();if(!n)return null;let i=r(t,{i18n:I(),routable:n,minAmountUsd:P,...C.resolveTokenIcon?{resolveTokenIcon:C.resolveTokenIcon}:{}});return W.update({balances:{status:`ready`,payload:i,raw:t,response:t},wallet:Q(i,I())}),t}catch{return null}},listener:()=>{t(W.getSnapshot().balances)},nextIntervalMs:()=>N})},watchSourceTx(e,t,n){let r=new Set,i={current:!1},a=!1;b({signal:n,fetch:e=>v(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??``,...L[s]&&o.from?.tx_id?{explorerUrl:`${L[s].replace(/\/+$/,``)}/tx/${o.from.tx_id}`}:{}})},nextIntervalMs:()=>a?0:A})},watchSettlement(e,n,r){let i=e=>v(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:I(),sourceWallet:{name:`Wallet`,address:C.userAddress},explorers:L,...J?{brandName:J}:{}});s.kind!==`pending`&&(a=!0);let c={status:`ready`,payload:s,raw:i,response:r};W.update({settlement:c}),n(c)},nextIntervalMs:()=>a?M:j})},async fetchActiveSettlement(e,n){let r=await v(O,C.userAddress,$(),n);if(!r)return null;let i=t(r);if(!i)return null;let a=o(i,r,{i18n:I(),sourceWallet:{name:`Wallet`,address:C.userAddress},explorers:L,...J?{brandName:J}:{}});return a.kind===`pending`?{payload:a,raw:i,response:r}:null}};function $(){return{network_id:R,asset_symbol:z,to_address:B}}}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};
|
|
@@ -28,7 +28,8 @@ interface StridgeWithdrawCurrency {
|
|
|
28
28
|
* recipient/chain/token, so the destination is per-submit (closure state) rather than
|
|
29
29
|
* driver-config.
|
|
30
30
|
* - No `confirmDisplay` — withdraw doesn't ship a confirm-deposit step.
|
|
31
|
-
* - No `
|
|
31
|
+
* - No bundled default for `minAmountUsd` — the floor only blocks submit when the host
|
|
32
|
+
* explicitly configures one.
|
|
32
33
|
*/
|
|
33
34
|
interface CreateStridgeWithdrawDriverInput {
|
|
34
35
|
/** Connected wallet EOA. Threaded as `gateway/start.owner` and `uda/quote.from_address`. */
|
|
@@ -90,6 +91,20 @@ interface CreateStridgeWithdrawDriverInput {
|
|
|
90
91
|
* UNDER the kit-set `kit_flow` / `kit_version` / `source` keys (kit keys win).
|
|
91
92
|
*/
|
|
92
93
|
metadata?: Record<string, unknown>;
|
|
94
|
+
/**
|
|
95
|
+
* Optional lower USD bound on the withdraw amount. Surfaced on
|
|
96
|
+
* {@link WithdrawSnapshot.minAmountUsd}; the form blocks submit with a localized "Min $X"
|
|
97
|
+
* CTA while the typed amount sits below this value. Omit to leave the form without a lower
|
|
98
|
+
* bound (only the wallet balance / non-zero gate apply).
|
|
99
|
+
*/
|
|
100
|
+
minAmountUsd?: number;
|
|
101
|
+
/**
|
|
102
|
+
* Optional upper USD bound on the withdraw amount. Surfaced on
|
|
103
|
+
* {@link WithdrawSnapshot.maxAmountUsd}; the form blocks submit with a localized "Max $X"
|
|
104
|
+
* CTA while the typed amount sits above this value. Omit to let the brand-currency balance
|
|
105
|
+
* be the only ceiling.
|
|
106
|
+
*/
|
|
107
|
+
maxAmountUsd?: number;
|
|
93
108
|
}
|
|
94
109
|
/**
|
|
95
110
|
* Builds a Stridge-backed {@link WithdrawDriver}. Returns the unified driver contract — the kit's
|
|
@@ -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{
|
|
1
|
+
"use client";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{defaultBlockExplorers as r}from"../../shared/utils/explorers.js";import{createEntityStore as i}from"../stridge-mock/store.js";import{NATIVE_QUOTE_ADDRESS as a,isStablecoinSymbol as o,toBaseUnits as s}from"./internal/encoding.js";import{resolveSdkEnv as c}from"./internal/env.js";import{buildKitMetadata as l}from"./internal/metadata.js";import{pollOnce as u}from"./internal/pollOnce.js";import{startPoll as d}from"./poll.js";import{balanceToWithdrawableBalancesPayload as f}from"../../flows/withdraw/driver/transformers/balanceToWithdrawableBalancesPayload.js";import{quoteToWithdrawalPayload as p}from"../../flows/withdraw/driver/transformers/quoteToWithdrawalPayload.js";import{settlementToWithdrawalPayload as m}from"../../flows/withdraw/driver/transformers/settlementToWithdrawalPayload.js";import{supportedAssetsToReceiveOptionsPayload as h}from"../../flows/withdraw/driver/transformers/supportedAssetsToReceiveOptionsPayload.js";import{createApiClient as g}from"@stridge/sdk";function _(_){let v=g({projectKey:_.projectKey,env:c(_.environment)}),y=_.pollIntervals??{},b=y.processingMs??2e3,x=y.terminalMs??1e4,S=y.balancesMs??6e4,C=_.getI18n??(()=>e),w={...r(),..._.explorers??{}},T=C(),E=i({withdrawableBalances:{status:`loading`},receiveOptions:{status:`loading`},quote:{status:`idle`},settlement:{status:`idle`},..._.minAmountUsd===void 0?{}:{minAmountUsd:{value:_.minAmountUsd,formatted:n(_.minAmountUsd,T)}},..._.maxAmountUsd===void 0?{}:{maxAmountUsd:{value:_.maxAmountUsd,formatted:n(_.maxAmountUsd,T)}}}),D,O,k;function A(e){let t=e.assets.find(e=>e.network_id===_.currency.networkId);if(!t)return;let n=_.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 j(e){let t=C(),n=O,r=f(e,{i18n:t,networkId:_.currency.networkId,assetSymbol:_.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}:{}}}:{}});E.update({withdrawableBalances:{status:`ready`,payload:r,raw:e,response:e}})}let M=(async()=>{try{let[e,t]=await Promise.all([v.uda.supportedAssets(),v.balance.onchain(_.userAddress,{includeSpam:!1,includeZero:!1}).catch(()=>null)]);D=e,O=A(e);let n=h(e);E.update({receiveOptions:{status:`ready`,payload:n,raw:e.assets,response:e}}),t?j(t):O&&j({wallet_address:_.userAddress,fetched_at:new Date().toISOString(),total_usd:`0`,chains:[]})}catch(e){let t=e instanceof Error?e:Error(String(e));E.update({receiveOptions:{status:`error`,error:t}})}})();function N(){return l({flow:`withdraw`,..._.metadata?{hostMetadata:_.metadata}:{},extras:{source:{networkId:_.currency.networkId,assetSymbol:_.currency.assetSymbol}}})}function P(e,t){if(!D)return;let n=D.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 F(e){let t=E.getSnapshot().receiveOptions;if(!(t.status!==`ready`&&t.status!==`stale`))return t.payload.find(t=>t.eip155Id===e)}return{getSnapshot(){return E.getSnapshot()},subscribe(e){return E.subscribe(e)},async requestQuote(e,t){E.update({quote:{status:`loading`}});try{if(await M,t.aborted)return;let n=O;if(!n)throw Error(`Stridge withdraw driver: source currency ${_.currency.assetSymbol} not found on network ${_.currency.networkId} in supportedAssets.`);let r=P(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=s(e.amount,n.decimals),c=await v.uda.quote({fromNetworkId:n.eip155Id,fromAsset:n.isNative?a:n.address,toNetworkId:r.chainId,toAsset:r.isNative?a:r.address,amount:i,fromAddress:_.userAddress,toAddress:e.recipientAddress},{signal:t});if(t.aborted)return;let l=o(_.currency.assetSymbol)?1:void 0,u=o(r.symbol)?1:void 0,d=p(c,{i18n:C(),receiveSide:r,sourceAmount:e.amount,sendDecimals:n.decimals,sendSymbol:_.currency.assetSymbol,now:Date.now(),...l===void 0?{}:{sendPriceUsd:l},...u===void 0?{}:{receivePriceUsd:u}});E.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));E.update({quote:{status:`error`,error:n}})}},async prepareWithdrawal(e,t){if(await M,t.aborted)throw new DOMException(`Aborted`,`AbortError`);let n=O;if(!n)throw Error(`Stridge withdraw driver: source currency ${_.currency.assetSymbol} not found on network ${_.currency.networkId} in supportedAssets.`);let r=P(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 v.gateway.start({owner:_.userAddress,destination:{network_id:r.networkId??String(e.receiveChainId),asset_symbol:r.symbol,to_address:e.recipientAddress},metadata:N()},{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 k={network_id:r.networkId??String(e.receiveChainId),asset_symbol:r.symbol,to_address:e.recipientAddress},{depositTarget:{address:a.address,chainId:n.eip155Id,tokenSymbol:_.currency.assetSymbol,tokenAddress:n.isNative?``:n.address,tokenDecimals:n.decimals,isNative:n.isNative,amount:e.amount},correlation:{owner:_.userAddress}}},watchSettlement(e,n,r){let i=e=>u(v,_.userAddress,k,e),a=!1;d({signal:r,fetch:i,listener:r=>{if(!r)return;let i=O?s(e.form.amount,O.decimals).toString():void 0,o=e.tx?.hash?t(r,{txHash:e.tx.hash}):t(r,{bestMatch:{destination:{chainId:e.form.receiveChainId,tokenSymbol:e.form.receiveTokenSymbol,recipientAddress:e.form.recipientAddress},submittedAt:e.submittedAt,...i?{sourceAmountBaseUnits:i}:{}}});if(!o)return;let c=C(),l=F(Number(r.destination.eip155_id)),u=l?.tokens.find(e=>e.symbol===r.destination.asset_symbol),d={...l?.chainLogoUrl?{chainLogoUrl:l.chainLogoUrl}:{},...u?.assetLogoUrl?{assetLogoUrl:u.assetLogoUrl}:{},...l?.networkName?{networkName:l.networkName}:{}},f=m(o,r,{i18n:c,explorers:w,...Object.keys(d).length>0?{receiveAssetEnrichment:d}:{},...O?{sendAssetDecimals:O.decimals}:{},...u?.decimals===void 0?{}:{receiveAssetDecimals:u.decimals}});f.kind!==`pending`&&(a=!0);let p={status:`ready`,payload:f,raw:o,response:r};E.update({settlement:p}),n(p)},nextIntervalMs:()=>a?x:b})},watchWithdrawableBalances(e,t,n){d({signal:n,fetch:async e=>{try{return await M,e.aborted?null:await v.balance.onchain(_.userAddress,{signal:e,includeSpam:!1,includeZero:!1})}catch{return null}},listener:e=>{e&&j(e),t(E.getSnapshot().withdrawableBalances)},nextIntervalMs:()=>S})}}}export{_ as createStridgeWithdrawDriver};
|
|
@@ -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
|
|
85
|
-
* amount-entry hero's `min` / `initialAmount
|
|
86
|
-
*
|
|
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
|
-
|
|
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.
|
|
@@ -145,4 +148,4 @@ interface StridgeDriverConfig {
|
|
|
145
148
|
};
|
|
146
149
|
}
|
|
147
150
|
//#endregion
|
|
148
|
-
export { STRIDGE_DEFAULT_ENVIRONMENT,
|
|
151
|
+
export { STRIDGE_DEFAULT_ENVIRONMENT, StridgeDriverConfig, StridgeDriverDestination, StridgeEnvironment, StridgePollIntervals, StridgeTokenIconResolverEntry };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=`production
|
|
1
|
+
const e=`production`;export{e as STRIDGE_DEFAULT_ENVIRONMENT};
|
|
@@ -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.
|
|
42
|
-
|
|
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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defaultI18n as e}from"../../shared/i18n/defaultI18n.js";import{shortenAddress as t}from"../../shared/format/shortenAddress.js";import{createEntityStore as n}from"./store.js";import{DEFAULT_BRAND_PAYLOAD as r,DEFAULT_WALLET_INFO as i,STUB_DEPOSIT_ADDRESSES_RAW as a,STUB_GATEWAY_POLL_RESPONSE as o,STUB_GATEWAY_SETTLEMENT_DTO as s,STUB_GATEWAY_START_RESPONSE as c,STUB_ONCHAIN_BALANCE_RESPONSE as l,STUB_QUOTE_RESPONSE as u,STUB_SUPPORTED_ASSETS_RESPONSE as d,buildDefaultAddressesPayload as f,buildDefaultBalances as p,buildDefaultFailurePayload as m,buildDefaultPendingPayload as h,buildDefaultQuotePayload as g,buildDefaultSuccessPayload as _,buildDefaultTargetPayload as v,buildDefaultTargetRaw as y,buildDefaultWalletPayload as b,resolveMockAsset as x}from"./fixtures.js";const S={quote:1400,submit:4e3,processingPendingDelay:1500,processingTerminal:3e3,transferDetected:4e3};function C(r={}){let a=r.getI18n??(()=>e),c=r.wallet??i,l=x(r.asset),d=n(w(a(),c,r.
|
|
1
|
+
import{defaultI18n as e}from"../../shared/i18n/defaultI18n.js";import{shortenAddress as t}from"../../shared/format/shortenAddress.js";import{createEntityStore as n}from"./store.js";import{DEFAULT_BRAND_PAYLOAD as r,DEFAULT_WALLET_INFO as i,STUB_DEPOSIT_ADDRESSES_RAW as a,STUB_GATEWAY_POLL_RESPONSE as o,STUB_GATEWAY_SETTLEMENT_DTO as s,STUB_GATEWAY_START_RESPONSE as c,STUB_ONCHAIN_BALANCE_RESPONSE as l,STUB_QUOTE_RESPONSE as u,STUB_SUPPORTED_ASSETS_RESPONSE as d,buildDefaultAddressesPayload as f,buildDefaultBalances as p,buildDefaultFailurePayload as m,buildDefaultPendingPayload as h,buildDefaultQuotePayload as g,buildDefaultSuccessPayload as _,buildDefaultTargetPayload as v,buildDefaultTargetRaw as y,buildDefaultWalletPayload as b,resolveMockAsset as x}from"./fixtures.js";const S={quote:1400,submit:4e3,processingPendingDelay:1500,processingTerminal:3e3,transferDetected:4e3};function C(r={}){let a=r.getI18n??(()=>e),c=r.wallet??i,l=x(r.asset),d=n(w(a(),c,r.minAmountUsd,l,r.initialState)),f={...S,...r.latency??{}},p=r.autoSettleTo??`succeeded`,v=r.pendingTriggerToSuccessMs===void 0?3500:r.pendingTriggerToSuccessMs,y=new Set,b=new Set,C=new Set,E=!1,D,O;function k(){D!==void 0&&(clearTimeout(D),D=void 0),O!==void 0&&(clearTimeout(O),O=void 0),E=!1}function A(){if(E)return;E=!0;let e=a();D=setTimeout(()=>{D=void 0;let t={status:`ready`,payload:h(e,l),raw:s,response:o};d.update({settlement:t});for(let e of y)e(t);O=setTimeout(()=>{if(O=void 0,p===`succeeded`){let t={status:`ready`,payload:_(e,l),raw:s,response:o};d.update({settlement:t});for(let e of y)e(t)}else if(p===`failed`){let t={status:`ready`,payload:m(e,void 0,l),raw:s,response:o};d.update({settlement:t});for(let e of y)e(t)}E=!1},f.processingTerminal)},f.processingPendingDelay)}let j={getSnapshot(){return d.getSnapshot()},subscribe(e){return d.subscribe(e)},async requestQuote(e,t){d.update({quote:{status:`loading`}}),await T(f.quote,t);let n=a(),r=Date.now()+3e4;d.update({quote:{status:`ready`,payload:g(n,r,l),raw:u,response:u}})},async submitDeposit(e,t){return await T(f.submit,t),p!==`none`&&A(),{hash:`0x1d72b900dd9b4f9fb0e11c14978d9cbbff7b47db0b820911839aad7081f6b72a`,explorerUrl:`https://etherscan.io/tx/0x1d72b900dd9b4f9fb0e11c14978d9cbbff7b47db0b820911839aad7081f6b72a`}},watchBalances(e,t,n){C.add(t);let r=d.getSnapshot().balances;queueMicrotask(()=>{n.aborted||t(r)}),n.addEventListener(`abort`,()=>C.delete(t),{once:!0})},watchSourceTx(e,t,n){b.add(t);let r=setTimeout(()=>{n.aborted||t({hash:`0x1d72b900dd9b4f9fb0e11c14978d9cbbff7b47db0b820911839aad7081f6b72a`,explorerUrl:`https://etherscan.io/tx/0x1d72b900dd9b4f9fb0e11c14978d9cbbff7b47db0b820911839aad7081f6b72a`})},f.transferDetected);n.addEventListener(`abort`,()=>{clearTimeout(r),b.delete(t)},{once:!0})},watchSettlement(e,t,n){y.add(t);let r=d.getSnapshot().settlement;queueMicrotask(()=>{n.aborted||t(r)}),n.addEventListener(`abort`,()=>y.delete(t),{once:!0})},async fetchActiveSettlement(e,t){let n=d.getSnapshot().settlement;return n.status!==`ready`||n.payload.kind!==`pending`?null:{payload:n.payload,raw:n.raw,response:n.response}}},M=0,N=null;function P(){N!==null&&(clearTimeout(N),N=null)}function F(e){M+=1;let n=`0x${M.toString(16).padStart(8,`0`)}${e.value.length>10?e.value.slice(10):`0`.repeat(56)}`;return{value:n,formatted:t(n)}}function I(e,t){if(e)return e.replace(/(\/tx\/|\/address\/)(0x[0-9a-fA-F]+)/,(e,n)=>`${n}${t}`)}let L={triggerSettlementPending(e){let t=h(a(),l),n=t.txHash?F(t.txHash):void 0,r=n?I(t.txExplorerUrl,n.value):void 0,i={status:`ready`,payload:{...t,...n?{txHash:n}:{},...r?{txExplorerUrl:r}:{},...e},raw:s,response:o};P(),d.update({settlement:i});for(let e of y)e(i);v!==null&&v>=0&&(N=setTimeout(()=>{N=null,L.triggerSettlementSuccess()},v))},triggerSettlementSuccess(e){P();let t=_(a(),l),n=F(t.depositTx.hash),r=I(t.depositTx.explorerUrl,n.value),i={status:`ready`,payload:{...t,depositTx:{...t.depositTx,hash:n,...r?{explorerUrl:r}:{}},...e},raw:s,response:o};d.update({settlement:i});for(let e of y)e(i)},triggerSettlementFailure(e,t){P();let n=m(a(),e,l),r=F(n.txHash),i=I(n.txExplorerUrl,r.value),c={status:`ready`,payload:{...n,txHash:r,...i?{txExplorerUrl:i}:{},...t},raw:s,response:o};d.update({settlement:c});for(let e of y)e(c)},triggerQuoteFailure(e){d.update({quote:{status:`error`,error:e}})},reset(){P(),k(),d.replace(w(a(),c,r.minAmountUsd,l,r.initialState))}};return{driver:j,triggers:L}}function w(e,t,n,i,o){let s={brand:{status:`ready`,payload:r,raw:c.metadata,response:c},target:{status:`ready`,payload:v(e,n,i),raw:y(i),response:d},addresses:{status:`ready`,payload:f(e,n),raw:a,response:c},balances:{status:`ready`,payload:p(e),raw:l,response:l},quote:{status:`idle`},settlement:{status:`idle`},wallet:{status:`ready`,payload:b(e,t),raw:t,response:t}};return o?{...s,...o}:s}function T(e,t){return new Promise((n,r)=>{if(t.aborted){r(E());return}let i=setTimeout(()=>{t.removeEventListener(`abort`,a),n()},e),a=()=>{clearTimeout(i),r(E())};t.addEventListener(`abort`,a,{once:!0})})}function E(){if(typeof DOMException==`function`)return new DOMException(`Aborted`,`AbortError`);let e=Error(`Aborted`);return e.name=`AbortError`,e}export{C as createStridgeMockDriver};
|
|
@@ -97,6 +97,18 @@ interface CreateStridgeMockWithdrawDriverInput {
|
|
|
97
97
|
* on BSC via {@link resolveMockAsset}.
|
|
98
98
|
*/
|
|
99
99
|
asset?: MockAssetSelection;
|
|
100
|
+
/**
|
|
101
|
+
* Optional lower USD bound on the withdraw amount. Mirrors the live driver's option —
|
|
102
|
+
* populates {@link WithdrawSnapshot.minAmountUsd} so the form's "Min $X" gate fires under the
|
|
103
|
+
* mock too.
|
|
104
|
+
*/
|
|
105
|
+
minAmountUsd?: number;
|
|
106
|
+
/**
|
|
107
|
+
* Optional upper USD bound on the withdraw amount. Mirrors the live driver's option —
|
|
108
|
+
* populates {@link WithdrawSnapshot.maxAmountUsd} so the form's "Max $X" gate fires under the
|
|
109
|
+
* mock too.
|
|
110
|
+
*/
|
|
111
|
+
maxAmountUsd?: number;
|
|
100
112
|
}
|
|
101
113
|
/**
|
|
102
114
|
* Deterministic in-memory {@link WithdrawDriver} backed by the V2 mockup fixtures. Used by
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{defaultI18n as e}from"../../shared/i18n/defaultI18n.js";import{formatDurationCompact as t}from"../../shared/format/formatDurationCompact.js";import{formatTimestamp as n}from"../../shared/format/formatTimestamp.js";import{formatUsd as r}from"../../shared/format/formatUsd.js";import{shortenAddress as i}from"../../shared/format/shortenAddress.js";import{supportedAssetsToReceiveOptionsPayload as a}from"../../flows/withdraw/driver/transformers/supportedAssetsToReceiveOptionsPayload.js";import{DEFAULT_MOCK_ASSET as o,buildDefaultSupportedAssetsResponse as s,resolveMockAsset as c}from"./fixtures.js";const l=`0x32995Fb47918BD37133dB46F21c5Ed906140Dd41`,u=`0xd41f5e9e5b1c2c4d8e7a0bf3a9e6c1d2b8f5d4c3e2a1b0c9d8e7f6a5b4c3d2e1`;function d(e){return{symbol:e.symbol,decimals:e.decimals,address:e.address,isNative:e.isNative,assetLogoUrl:e.assetLogoUrl,networkName:e.networkName,eip155Id:e.eip155IdString,networkId:e.networkId,chainLogoUrl:e.chainLogoUrl}}function f(e){return`${e.explorerBase}/tx/`}const p={quote:1400,submit:4e3,processingPendingDelay:1500,processingTerminal:3e3},m=d(o),h=4.00613;function g(e=o){let t=d(e);return[{networkId:t.networkId,networkName:t.networkName,eip155Id:t.eip155Id,...t.chainLogoUrl?{chainLogoUrl:t.chainLogoUrl}:{},symbol:t.symbol,decimals:t.decimals,address:t.address,...t.assetLogoUrl?{assetLogoUrl:t.assetLogoUrl}:{},isNative:t.isNative,amount:{value:4.01,formatted:`4.01`},amountUsd:{value:4.01,formatted:`$4.01`}}]}function _(e=h,t=o){let n=O(e);return{receiveAsset:d(t),receiveAmount:{value:e,formatted:n},receiveAmountUsd:{value:e,formatted:`$${e.toFixed(2)}`},breakdown:{selectedRoute:{provider:`mock`,scenario:`same_chain_same_token`,label:`Mock · same chain same token`},networkCost:{value:0,formatted:`$0.00`},priceImpact:{value:0,formatted:`0.00%`}},quoteTotalSeconds:30,expiresAt:Date.now()+3e4}}function v(t=e,a=h,s=l,c=u,p=o){let m=Date.now();return{kind:`pending`,receiveAsset:d(p),receiveAmount:{value:a,formatted:O(a)},receiveAmountUsd:{value:a,formatted:r(a,t)},recipient:{value:s,formatted:i(s)},submittedAt:{value:m,formatted:n(m,t)},txHash:{value:c,formatted:i(c)},txExplorerUrl:`${f(p)}${c}`}}function y(r=e,a=h,s=l,c=14,p=u,m=o,g=`0xa17b4c9e2d68f0a5c3b91e7f4d52a86b09c1d7e3f8a4b2c5d6e9f0a1b2c3d4e5`){let _=Date.now(),v=c*1e3,y=_-v;return{kind:`succeeded`,receiveAsset:d(m),receiveAmount:{value:a,formatted:O(a)},recipient:{value:s,formatted:i(s)},submittedAt:{value:y,formatted:n(y,r)},filledAt:{value:_,formatted:n(_,r)},totalTime:{value:c,formatted:t(v,r)},txHash:{value:p,formatted:i(p)},txExplorerUrl:`${f(m)}${p}`,completionTx:{hash:{value:g,formatted:i(g)},explorerUrl:`${f(m)}${g}`}}}function b(t=e,r=`unknown`,a=h,s=l,c=u,p=o){let m=Date.now(),g=m-5e3;return{kind:`failed`,failureKind:r,receiveAsset:d(p),receiveAmount:{value:a,formatted:O(a)},recipient:{value:s,formatted:i(s)},submittedAt:{value:g,formatted:n(g,t)},failedAt:{value:m,formatted:n(m,t)},txHash:{value:c,formatted:i(c)},txExplorerUrl:`${f(p)}${c}`}}function x(t={}){let n={...p,...t.latency},r=t.autoSettleTo??`succeeded`,i=t.pendingTriggerToSuccessMs===void 0?3500:t.pendingTriggerToSuccessMs,o=t.getI18n??(()=>e),f=c(t.asset),m=d(f),x=g(f),C=S(x),O=s(),k=a(O),A={withdrawableBalances:t.initialState?.withdrawableBalances??{status:`ready`,payload:x,raw:C,response:C},receiveOptions:t.initialState?.receiveOptions??{status:`ready`,payload:k,raw:O.assets,response:O},quote:t.initialState?.quote??{status:`idle`},settlement:t.initialState?.settlement??{status:`idle`}},j=A,M=new Set,N=new Set,P=new Set,F=new Set,I=()=>{for(let e of M)e()},L=e=>{if(j={...j,...e},I(),e.settlement)for(let e of N)e(j.settlement);if(e.withdrawableBalances)for(let e of P)e(j.withdrawableBalances)},R=(e,t)=>{let n=setTimeout(()=>{F.delete(n),e()},t);F.add(n)},z=null,B=!1,V=0;function H(){return V+=1,`0x${V.toString(16).padStart(8,`0`)}${u.slice(10)}`}let U={getSnapshot:()=>j,subscribe(e){return M.add(e),()=>{M.delete(e)}},async requestQuote(e,t){L({quote:{status:`loading`}}),await D(n.quote,t);let r=_(e.amount,f),i=w(r,e.amount,m);L({quote:{status:`ready`,payload:r,raw:i,response:i}})},async prepareWithdrawal(e,t){await D(n.submit,t),z={amount:e.amount,recipient:e.recipientAddress};let r=H();return W(e.amount,e.recipientAddress,r,t),{depositTarget:{address:`0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC`,chainId:Number(f.eip155IdString),tokenSymbol:f.symbol,tokenAddress:f.address,tokenDecimals:f.decimals,isNative:f.isNative,amount:e.amount},correlation:{owner:`0x70997970C51812dc3A010C7d01b50e0d17dc79C8`}}},watchSettlement(e,t,n){N.add(t);let r=j.settlement;queueMicrotask(()=>{n.aborted||t(r)}),n.addEventListener(`abort`,()=>N.delete(t),{once:!0})},watchWithdrawableBalances(e,t,n){P.add(t);let r=j.withdrawableBalances;queueMicrotask(()=>{n.aborted||t(r)}),n.addEventListener(`abort`,()=>P.delete(t),{once:!0})}};function W(e,t,i,a){B||(B=!0,R(()=>{if(a.aborted){B=!1;return}let s=v(o(),e,t,i,f),c=T(s,m);if(L({settlement:{status:`ready`,payload:s,raw:c,response:E(c,s)}}),r===`none`){B=!1;return}R(()=>{if(B=!1,a.aborted)return;let n=r===`succeeded`?y(o(),e,t,14,i,f):b(o(),`unknown`,e,t,i,f),s=T(n,m);L({settlement:{status:`ready`,payload:n,raw:s,response:E(s,n)}})},n.processingTerminal)},n.processingPendingDelay))}let G={triggerWithdrawalInProgress(e){let{amount:t,recipient:n}=K(),r={...v(o(),t,n,H(),f),...e},a=T(r,m);L({settlement:{status:`ready`,payload:r,raw:a,response:E(a,r)}}),i!==null&&R(()=>G.triggerWithdrawalSuccess(),i)},triggerWithdrawalSuccess(e){let{amount:t,recipient:n}=K(),r={...y(o(),t,n,14,H(),f),...e},i=T(r,m);L({settlement:{status:`ready`,payload:r,raw:i,response:E(i,r)}})},triggerWithdrawalFailed(e,t){let{amount:n,recipient:r}=K(),i={...b(o(),e,n,r,H(),f),...t},a=T(i,m);L({settlement:{status:`ready`,payload:i,raw:a,response:E(a,i)}})},triggerQuoteFailure(e){L({quote:{status:`error`,error:e}})},reset(){for(let e of F)clearTimeout(e);F.clear(),B=!1,z=null,V=0,j=A,I()}};function K(){return{amount:z?.amount??h,recipient:z?.recipient??l}}return{driver:U,triggers:G}}function S(e){let t=e.reduce((e,t)=>e+(t.amountUsd?.value??0),0);return{wallet_address:`0xMockWallet000000000000000000000000000000`,fetched_at:new Date(0).toISOString(),total_usd:t.toFixed(2),chains:e.map(e=>({eip155_id:e.eip155Id?Number(e.eip155Id):0,stridge_network_id:e.networkId??``,network_name:e.networkName.toLowerCase(),label:e.networkName,scanner_url:``,native_symbol:``,subtotal_usd:(e.amountUsd?.value??0).toFixed(2),tokens:[{token_address:e.address,symbol:e.symbol,name:e.symbol,decimals:e.decimals,logo:e.assetLogoUrl??``,is_native:e.isNative,is_spam:!1,raw_amount:C(e.amount.value,e.decimals).toString(),amount:e.amount.value.toString(),amount_usd:(e.amountUsd?.value??0).toFixed(2),usd_price:e.amount.value>0?((e.amountUsd?.value??0)/e.amount.value).toFixed(6):`0`,price_change_24h_pct:`0`}]}))}}function C(e,t){if(!Number.isFinite(e)||e<0)return 0n;let[n,r=``]=e.toFixed(t).split(`.`),i=r.padEnd(t,`0`).slice(0,t);return BigInt((n??`0`)+i)}function w(e,t,n=m){let r=C(e.receiveAmount.value,e.receiveAsset.decimals).toString(),i=C(t,n.decimals).toString(),a=t>0?(e.receiveAmount.value/t).toFixed(6):`1`;return{from:{network_id:Number(n.eip155Id??56),asset_address:n.address,amount:i},to:{network_id:Number(e.receiveAsset.eip155Id??56),asset_address:e.receiveAsset.address,amount:r},exchange_rate:a,fees:{total_fee:`0`},route:{provider:`mock`,scenario:`same_chain_same_token`,estimated_time_seconds:30},expires_at:new Date(e.expiresAt).toISOString()}}function T(e,t=m){let n=new Date(e.submittedAt.value).toISOString(),r=e.kind===`succeeded`?`completed`:e.kind===`failed`?`failed`:`routing`,i=e.kind===`succeeded`?e.filledAt.value:e.kind===`failed`?e.failedAt.value:e.submittedAt.value,a={tx_id:(e.kind===`succeeded`?e.txHash.value:e.txHash?.value)??``,asset_symbol:t.symbol,asset_address:t.address,eip155_id:t.eip155Id??`56`,network_id:t.networkId??`9006`,network_name:t.networkName.toLowerCase(),raw_amount:C(e.receiveAmount.value,t.decimals).toString(),amount:e.receiveAmount.value.toString(),confirmed_at:n},o={address:e.recipient.value,asset_address:e.receiveAsset.address,asset_symbol:e.receiveAsset.symbol,eip155_id:e.receiveAsset.eip155Id??``,network_id:e.receiveAsset.networkId??``,network_name:e.receiveAsset.networkName.toLowerCase(),raw_amount:C(e.receiveAmount.value,e.receiveAsset.decimals).toString(),amount:e.receiveAmount.value.toString(),...e.kind===`succeeded`?{settled_at:new Date(e.filledAt.value).toISOString(),...e.completionTx?{tx_id:e.completionTx.hash.value}:{}}:{}};return{id:`mock-settlement-${e.recipient.value}-${a.tx_id}`,status:r,created_at:n,updated_at:new Date(i).toISOString(),events:[],fees:{raw_amount:`0`},from:a,to:o,route:{provider:`mock`,scenario:`withdraw_v1`},...e.kind===`failed`?{error:e.failureKind}:{}}}function E(e,t){let n=t.kind!==`pending`;return{owner:`0xMockOwner`,uda_id:`mock-uda`,created_at:e.created_at,updated_at:e.updated_at,is_terminal:n,status:t.kind===`succeeded`?`completed`:t.kind===`failed`?`failed`:`to_pending`,destination:{address:t.recipient.value,asset_address:t.receiveAsset.address,asset_decimals:t.receiveAsset.decimals,asset_symbol:t.receiveAsset.symbol,eip155_id:t.receiveAsset.eip155Id??``,network_id:t.receiveAsset.networkId??``,network_name:t.receiveAsset.networkName},settlements:[e]}}function D(e,t){return new Promise((n,r)=>{if(t.aborted){r(new DOMException(`Aborted`,`AbortError`));return}let i=setTimeout(()=>{t.removeEventListener(`abort`,a),n()},e),a=()=>{clearTimeout(i),t.removeEventListener(`abort`,a),r(new DOMException(`Aborted`,`AbortError`))};t.addEventListener(`abort`,a)})}function O(e){return Number.isInteger(e)?e.toFixed(2):e.toFixed(5)}export{g as buildDefaultWithdrawableBalances,b as buildDefaultWithdrawalFailurePayload,v as buildDefaultWithdrawalPendingPayload,_ as buildDefaultWithdrawalQuotePayload,y as buildDefaultWithdrawalSuccessPayload,x as createStridgeMockWithdrawDriver};
|
|
1
|
+
"use client";import{defaultI18n as e}from"../../shared/i18n/defaultI18n.js";import{formatDurationCompact as t}from"../../shared/format/formatDurationCompact.js";import{formatTimestamp as n}from"../../shared/format/formatTimestamp.js";import{formatUsd as r}from"../../shared/format/formatUsd.js";import{shortenAddress as i}from"../../shared/format/shortenAddress.js";import{supportedAssetsToReceiveOptionsPayload as a}from"../../flows/withdraw/driver/transformers/supportedAssetsToReceiveOptionsPayload.js";import{DEFAULT_MOCK_ASSET as o,buildDefaultSupportedAssetsResponse as s,resolveMockAsset as c}from"./fixtures.js";const l=`0x32995Fb47918BD37133dB46F21c5Ed906140Dd41`,u=`0xd41f5e9e5b1c2c4d8e7a0bf3a9e6c1d2b8f5d4c3e2a1b0c9d8e7f6a5b4c3d2e1`;function d(e){return{symbol:e.symbol,decimals:e.decimals,address:e.address,isNative:e.isNative,assetLogoUrl:e.assetLogoUrl,networkName:e.networkName,eip155Id:e.eip155IdString,networkId:e.networkId,chainLogoUrl:e.chainLogoUrl}}function f(e){return`${e.explorerBase}/tx/`}const p={quote:1400,submit:4e3,processingPendingDelay:1500,processingTerminal:3e3},m=d(o),h=4.00613;function g(e=o){let t=d(e);return[{networkId:t.networkId,networkName:t.networkName,eip155Id:t.eip155Id,...t.chainLogoUrl?{chainLogoUrl:t.chainLogoUrl}:{},symbol:t.symbol,decimals:t.decimals,address:t.address,...t.assetLogoUrl?{assetLogoUrl:t.assetLogoUrl}:{},isNative:t.isNative,amount:{value:4.01,formatted:`4.01`},amountUsd:{value:4.01,formatted:`$4.01`}}]}function _(e=h,t=o){let n=O(e);return{receiveAsset:d(t),receiveAmount:{value:e,formatted:n},receiveAmountUsd:{value:e,formatted:`$${e.toFixed(2)}`},breakdown:{selectedRoute:{provider:`mock`,scenario:`same_chain_same_token`,label:`Mock · same chain same token`},networkCost:{value:0,formatted:`$0.00`},priceImpact:{value:0,formatted:`0.00%`}},quoteTotalSeconds:30,expiresAt:Date.now()+3e4}}function v(t=e,a=h,s=l,c=u,p=o){let m=Date.now();return{kind:`pending`,receiveAsset:d(p),receiveAmount:{value:a,formatted:O(a)},receiveAmountUsd:{value:a,formatted:r(a,t)},recipient:{value:s,formatted:i(s)},submittedAt:{value:m,formatted:n(m,t)},txHash:{value:c,formatted:i(c)},txExplorerUrl:`${f(p)}${c}`}}function y(r=e,a=h,s=l,c=14,p=u,m=o,g=`0xa17b4c9e2d68f0a5c3b91e7f4d52a86b09c1d7e3f8a4b2c5d6e9f0a1b2c3d4e5`){let _=Date.now(),v=c*1e3,y=_-v;return{kind:`succeeded`,receiveAsset:d(m),receiveAmount:{value:a,formatted:O(a)},recipient:{value:s,formatted:i(s)},submittedAt:{value:y,formatted:n(y,r)},filledAt:{value:_,formatted:n(_,r)},totalTime:{value:c,formatted:t(v,r)},txHash:{value:p,formatted:i(p)},txExplorerUrl:`${f(m)}${p}`,completionTx:{hash:{value:g,formatted:i(g)},explorerUrl:`${f(m)}${g}`}}}function b(t=e,r=`unknown`,a=h,s=l,c=u,p=o){let m=Date.now(),g=m-5e3;return{kind:`failed`,failureKind:r,receiveAsset:d(p),receiveAmount:{value:a,formatted:O(a)},recipient:{value:s,formatted:i(s)},submittedAt:{value:g,formatted:n(g,t)},failedAt:{value:m,formatted:n(m,t)},txHash:{value:c,formatted:i(c)},txExplorerUrl:`${f(p)}${c}`}}function x(t={}){let n={...p,...t.latency},i=t.autoSettleTo??`succeeded`,o=t.pendingTriggerToSuccessMs===void 0?3500:t.pendingTriggerToSuccessMs,f=t.getI18n??(()=>e),m=c(t.asset),x=d(m),C=g(m),O=S(C),k=s(),A=a(k),j=t.initialState?.minAmountUsd??(t.minAmountUsd===void 0?void 0:{value:t.minAmountUsd,formatted:r(t.minAmountUsd,f())}),M=t.initialState?.maxAmountUsd??(t.maxAmountUsd===void 0?void 0:{value:t.maxAmountUsd,formatted:r(t.maxAmountUsd,f())}),N={withdrawableBalances:t.initialState?.withdrawableBalances??{status:`ready`,payload:C,raw:O,response:O},receiveOptions:t.initialState?.receiveOptions??{status:`ready`,payload:A,raw:k.assets,response:k},quote:t.initialState?.quote??{status:`idle`},settlement:t.initialState?.settlement??{status:`idle`},...j?{minAmountUsd:j}:{},...M?{maxAmountUsd:M}:{}},P=N,F=new Set,I=new Set,L=new Set,R=new Set,z=()=>{for(let e of F)e()},B=e=>{if(P={...P,...e},z(),e.settlement)for(let e of I)e(P.settlement);if(e.withdrawableBalances)for(let e of L)e(P.withdrawableBalances)},V=(e,t)=>{let n=setTimeout(()=>{R.delete(n),e()},t);R.add(n)},H=null,U=!1,W=0;function G(){return W+=1,`0x${W.toString(16).padStart(8,`0`)}${u.slice(10)}`}let K={getSnapshot:()=>P,subscribe(e){return F.add(e),()=>{F.delete(e)}},async requestQuote(e,t){B({quote:{status:`loading`}}),await D(n.quote,t);let r=_(e.amount,m),i=w(r,e.amount,x);B({quote:{status:`ready`,payload:r,raw:i,response:i}})},async prepareWithdrawal(e,t){await D(n.submit,t),H={amount:e.amount,recipient:e.recipientAddress};let r=G();return q(e.amount,e.recipientAddress,r,t),{depositTarget:{address:`0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC`,chainId:Number(m.eip155IdString),tokenSymbol:m.symbol,tokenAddress:m.address,tokenDecimals:m.decimals,isNative:m.isNative,amount:e.amount},correlation:{owner:`0x70997970C51812dc3A010C7d01b50e0d17dc79C8`}}},watchSettlement(e,t,n){I.add(t);let r=P.settlement;queueMicrotask(()=>{n.aborted||t(r)}),n.addEventListener(`abort`,()=>I.delete(t),{once:!0})},watchWithdrawableBalances(e,t,n){L.add(t);let r=P.withdrawableBalances;queueMicrotask(()=>{n.aborted||t(r)}),n.addEventListener(`abort`,()=>L.delete(t),{once:!0})}};function q(e,t,r,a){U||(U=!0,V(()=>{if(a.aborted){U=!1;return}let o=v(f(),e,t,r,m),s=T(o,x);if(B({settlement:{status:`ready`,payload:o,raw:s,response:E(s,o)}}),i===`none`){U=!1;return}V(()=>{if(U=!1,a.aborted)return;let n=i===`succeeded`?y(f(),e,t,14,r,m):b(f(),`unknown`,e,t,r,m),o=T(n,x);B({settlement:{status:`ready`,payload:n,raw:o,response:E(o,n)}})},n.processingTerminal)},n.processingPendingDelay))}let J={triggerWithdrawalInProgress(e){let{amount:t,recipient:n}=Y(),r={...v(f(),t,n,G(),m),...e},i=T(r,x);B({settlement:{status:`ready`,payload:r,raw:i,response:E(i,r)}}),o!==null&&V(()=>J.triggerWithdrawalSuccess(),o)},triggerWithdrawalSuccess(e){let{amount:t,recipient:n}=Y(),r={...y(f(),t,n,14,G(),m),...e},i=T(r,x);B({settlement:{status:`ready`,payload:r,raw:i,response:E(i,r)}})},triggerWithdrawalFailed(e,t){let{amount:n,recipient:r}=Y(),i={...b(f(),e,n,r,G(),m),...t},a=T(i,x);B({settlement:{status:`ready`,payload:i,raw:a,response:E(a,i)}})},triggerQuoteFailure(e){B({quote:{status:`error`,error:e}})},reset(){for(let e of R)clearTimeout(e);R.clear(),U=!1,H=null,W=0,P=N,z()}};function Y(){return{amount:H?.amount??h,recipient:H?.recipient??l}}return{driver:K,triggers:J}}function S(e){let t=e.reduce((e,t)=>e+(t.amountUsd?.value??0),0);return{wallet_address:`0xMockWallet000000000000000000000000000000`,fetched_at:new Date(0).toISOString(),total_usd:t.toFixed(2),chains:e.map(e=>({eip155_id:e.eip155Id?Number(e.eip155Id):0,stridge_network_id:e.networkId??``,network_name:e.networkName.toLowerCase(),label:e.networkName,scanner_url:``,native_symbol:``,subtotal_usd:(e.amountUsd?.value??0).toFixed(2),tokens:[{token_address:e.address,symbol:e.symbol,name:e.symbol,decimals:e.decimals,logo:e.assetLogoUrl??``,is_native:e.isNative,is_spam:!1,raw_amount:C(e.amount.value,e.decimals).toString(),amount:e.amount.value.toString(),amount_usd:(e.amountUsd?.value??0).toFixed(2),usd_price:e.amount.value>0?((e.amountUsd?.value??0)/e.amount.value).toFixed(6):`0`,price_change_24h_pct:`0`}]}))}}function C(e,t){if(!Number.isFinite(e)||e<0)return 0n;let[n,r=``]=e.toFixed(t).split(`.`),i=r.padEnd(t,`0`).slice(0,t);return BigInt((n??`0`)+i)}function w(e,t,n=m){let r=C(e.receiveAmount.value,e.receiveAsset.decimals).toString(),i=C(t,n.decimals).toString(),a=t>0?(e.receiveAmount.value/t).toFixed(6):`1`;return{from:{network_id:Number(n.eip155Id??56),asset_address:n.address,amount:i},to:{network_id:Number(e.receiveAsset.eip155Id??56),asset_address:e.receiveAsset.address,amount:r},exchange_rate:a,fees:{total_fee:`0`},route:{provider:`mock`,scenario:`same_chain_same_token`,estimated_time_seconds:30},expires_at:new Date(e.expiresAt).toISOString()}}function T(e,t=m){let n=new Date(e.submittedAt.value).toISOString(),r=e.kind===`succeeded`?`completed`:e.kind===`failed`?`failed`:`routing`,i=e.kind===`succeeded`?e.filledAt.value:e.kind===`failed`?e.failedAt.value:e.submittedAt.value,a={tx_id:(e.kind===`succeeded`?e.txHash.value:e.txHash?.value)??``,asset_symbol:t.symbol,asset_address:t.address,eip155_id:t.eip155Id??`56`,network_id:t.networkId??`9006`,network_name:t.networkName.toLowerCase(),raw_amount:C(e.receiveAmount.value,t.decimals).toString(),amount:e.receiveAmount.value.toString(),confirmed_at:n},o={address:e.recipient.value,asset_address:e.receiveAsset.address,asset_symbol:e.receiveAsset.symbol,eip155_id:e.receiveAsset.eip155Id??``,network_id:e.receiveAsset.networkId??``,network_name:e.receiveAsset.networkName.toLowerCase(),raw_amount:C(e.receiveAmount.value,e.receiveAsset.decimals).toString(),amount:e.receiveAmount.value.toString(),...e.kind===`succeeded`?{settled_at:new Date(e.filledAt.value).toISOString(),...e.completionTx?{tx_id:e.completionTx.hash.value}:{}}:{}};return{id:`mock-settlement-${e.recipient.value}-${a.tx_id}`,status:r,created_at:n,updated_at:new Date(i).toISOString(),events:[],fees:{raw_amount:`0`},from:a,to:o,route:{provider:`mock`,scenario:`withdraw_v1`},...e.kind===`failed`?{error:e.failureKind}:{}}}function E(e,t){let n=t.kind!==`pending`;return{owner:`0xMockOwner`,uda_id:`mock-uda`,created_at:e.created_at,updated_at:e.updated_at,is_terminal:n,status:t.kind===`succeeded`?`completed`:t.kind===`failed`?`failed`:`to_pending`,destination:{address:t.recipient.value,asset_address:t.receiveAsset.address,asset_decimals:t.receiveAsset.decimals,asset_symbol:t.receiveAsset.symbol,eip155_id:t.receiveAsset.eip155Id??``,network_id:t.receiveAsset.networkId??``,network_name:t.receiveAsset.networkName},settlements:[e]}}function D(e,t){return new Promise((n,r)=>{if(t.aborted){r(new DOMException(`Aborted`,`AbortError`));return}let i=setTimeout(()=>{t.removeEventListener(`abort`,a),n()},e),a=()=>{clearTimeout(i),t.removeEventListener(`abort`,a),r(new DOMException(`Aborted`,`AbortError`))};t.addEventListener(`abort`,a)})}function O(e){return Number.isInteger(e)?e.toFixed(2):e.toFixed(5)}export{g as buildDefaultWithdrawableBalances,b as buildDefaultWithdrawalFailurePayload,v as buildDefaultWithdrawalPendingPayload,_ as buildDefaultWithdrawalQuotePayload,y as buildDefaultWithdrawalSuccessPayload,x as createStridgeMockWithdrawDriver};
|
|
@@ -56,23 +56,23 @@ interface MockAssetSelection {
|
|
|
56
56
|
* {@link buildDefaultTargetRaw}() with no asset override.
|
|
57
57
|
*/
|
|
58
58
|
declare const DEFAULT_TARGET_RAW: SupportedAssetDto;
|
|
59
|
-
declare function buildDefaultTargetPayload(i18n: I18n,
|
|
59
|
+
declare function buildDefaultTargetPayload(i18n: I18n, minAmountUsd?: number, asset?: MockAsset): TargetPayload;
|
|
60
60
|
/**
|
|
61
|
-
* Build the bundled deposit-address fixtures. When `
|
|
62
|
-
* formatted per-chain `
|
|
61
|
+
* Build the bundled deposit-address fixtures. When `minAmountUsd` is set, every row carries a
|
|
62
|
+
* formatted per-chain `minAmountUsd` so the transfer-crypto picker renders `Min $X` next to the
|
|
63
63
|
* Chains label and on each option row — the same display the captured-production payload showed.
|
|
64
64
|
*/
|
|
65
|
-
declare function buildDefaultAddressesPayload(i18n: I18n,
|
|
65
|
+
declare function buildDefaultAddressesPayload(i18n: I18n, minAmountUsd?: number): ReadonlyArray<AddressItemPayload>;
|
|
66
66
|
/**
|
|
67
67
|
* Static-i18n form of {@link buildDefaultAddressesPayload} — kept for callers that pre-import the
|
|
68
|
-
* canonical mock list without a live `I18n` handle. Excludes per-row `
|
|
68
|
+
* canonical mock list without a live `I18n` handle. Excludes per-row `minAmountUsd`; callers that
|
|
69
69
|
* want it must use the builder.
|
|
70
70
|
*/
|
|
71
71
|
declare const DEFAULT_ADDRESSES_PAYLOAD: ReadonlyArray<AddressItemPayload>;
|
|
72
72
|
/**
|
|
73
73
|
* Default source-side balance list — derived from the captured `/v1/balance/onchain/{wallet}`
|
|
74
74
|
* response for `0xf39Fd6…2266` against the production UDA, filtered through routability +
|
|
75
|
-
* spam-drop + the kit's `
|
|
75
|
+
* spam-drop + the kit's `minAmountUsd` floor (rows whose `amountUsd` is below the floor ride in
|
|
76
76
|
* as `lowBalance + disabled` so the picker dims them out instead of dropping them).
|
|
77
77
|
*
|
|
78
78
|
* Captured snapshot (chain × token, after routability filter):
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{formatDurationCompact as e}from"../../shared/format/formatDurationCompact.js";import{formatPercent as t}from"../../shared/format/formatPercent.js";import{formatTimestamp as n}from"../../shared/format/formatTimestamp.js";import{formatTokenAmount as r}from"../../shared/format/formatTokenAmount.js";import{formatUsd as i}from"../../shared/format/formatUsd.js";import{shortenAddress as a}from"../../shared/format/shortenAddress.js";const o=`Stridge ACME`,s=`0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266`,c=`0x1d72b900dd9b4f9fb0e11c14978d9cbbff7b47db0b820911839aad7081f6b72a`,l=`0x268a11a1002eb7026e3a77999872695ee3a920e5c46172a43aa396da10ac5296`,u=`0xcae135e02df387bba14e231988126295a663c8d9f8e90c1ead5876cc2fee036d`,d=1778167499e3,f=1778169184e3,p=1778086787e3,m=1778087105e3,h=`0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d`,g=`https://cdn.stridge.com/assets/usdc.svg`,_=`https://cdn.stridge.com/assets/usdt.svg`,v={1:`https://cdn.stridge.com/networks/60.svg`,8453:`https://cdn.stridge.com/networks/8453.svg`,42161:`https://cdn.stridge.com/networks/9001.svg`},y=`https://cdn.stridge.com/networks/9006.svg`,b=`https://cdn.stridge.com/networks/966.svg`,x=`0x166872371d1EB43B62c25861Bb7B1be4d5f09F56`,S={address:s,chainId:56},C={name:o},w={networkId:`9006`,networkName:`BSC`,eip155IdString:`56`,eip155IdNumber:56,chainLogoUrl:y,explorerBase:`https://bscscan.com`,symbol:`USDC`,decimals:18,address:h,assetLogoUrl:g,isNative:!1,nativeSymbol:`BNB`};function T(e){if(!e)return w;let t=e.networkId.toLowerCase(),n=k.find(n=>n.networkName.toLowerCase()===t||(M[n.eip155Id]??n.eip155Id)===e.networkId);if(!n)return w;let r=n.acceptedAssets.find(t=>t.symbol.toUpperCase()===e.symbol.toUpperCase());if(!r)return w;let i=n.acceptedAssets.find(e=>e.isNative);return{networkId:M[n.eip155Id]??n.eip155Id,networkName:n.networkName,eip155IdString:n.eip155Id,eip155IdNumber:Number(n.eip155Id),chainLogoUrl:n.chainLogoUrl,explorerBase:n.explorerBase,symbol:r.symbol,decimals:r.decimals,address:r.address,assetLogoUrl:r.assetLogoUrl??n.chainLogoUrl,isNative:r.isNative,nativeSymbol:i?.symbol??r.symbol}}function E(e=w){return{network_id:e.networkId,network_name:e.networkName,network_symbol:e.networkName.toLowerCase(),chain_type:`EVM`,eip155_id:e.eip155IdNumber,native_currency:{symbol:e.nativeSymbol,name:e.nativeSymbol,decimals:18,logo:e.chainLogoUrl},assets:[{symbol:e.symbol,decimals:e.decimals,address:e.address,logo:e.assetLogoUrl}]}}const D=E();function O(e,t,n=w){return{networkId:n.networkId,networkName:n.networkName,eip155Id:n.eip155IdString,chainLogoUrl:n.chainLogoUrl,symbol:n.symbol,decimals:n.decimals,address:n.address,assetLogoUrl:n.assetLogoUrl,isNative:n.isNative,...t===void 0?{}:{minDepositUsd:{value:t,formatted:i(t,e)}}}}const k=[{eip155Id:`1`,networkName:`Ethereum`,chainLogoUrl:v[1],explorerBase:`https://etherscan.io`,acceptedAssets:[{symbol:`ETH`,address:``,decimals:18,isNative:!0,assetLogoUrl:v[1]},{symbol:`TUSD`,address:`0x0000000000085d4780B73119b644AE5ecd22b376`,decimals:18,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/tusd.svg`},{symbol:`PAXG`,address:`0x45804880De22913dAFE09f4980848ECE6EcbAf78`,decimals:18,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/paxg.svg`},{symbol:`DAI`,address:`0x6B175474E89094C44Da98b954EedeAC495271d0F`,decimals:18,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/dai.svg`},{symbol:`PYUSD`,address:`0x6c3ea9036406852006290770BEdFcAbA0e23A0e8`,decimals:6,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/pyusd.svg`},{symbol:`USDC`,address:`0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48`,decimals:6,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/usdc.svg`},{symbol:`WETH`,address:`0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2`,decimals:18,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/weth.svg`},{symbol:`USDT`,address:`0xdAC17F958D2ee523a2206206994597C13D831ec7`,decimals:6,isNative:!1,assetLogoUrl:_}]},{eip155Id:`56`,networkName:`BSC`,chainLogoUrl:y,explorerBase:`https://bscscan.com`,acceptedAssets:[{symbol:`BNB`,address:``,decimals:18,isNative:!0,assetLogoUrl:y},{symbol:`WETH`,address:`0x2170Ed0880ac9A755fd29B2688956BD959F933F8`,decimals:18,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/weth.svg`},{symbol:`TUSD`,address:`0x40af3827F39D0EAcBF4A168f8D4ee67c121D11c9`,decimals:18,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/tusd.svg`},{symbol:`USDT`,address:`0x55d398326f99059fF775485246999027B3197955`,decimals:18,isNative:!1,assetLogoUrl:_},{symbol:`USDC`,address:h,decimals:18,isNative:!1,assetLogoUrl:g}]},{eip155Id:`8453`,networkName:`Base`,chainLogoUrl:v[8453],explorerBase:`https://basescan.org`,acceptedAssets:[{symbol:`ETH`,address:``,decimals:18,isNative:!0,assetLogoUrl:v[8453]},{symbol:`WETH`,address:`0x4200000000000000000000000000000000000006`,decimals:18,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/weth.svg`},{symbol:`DAI`,address:`0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb`,decimals:18,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/dai.svg`},{symbol:`USDC`,address:`0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`,decimals:6,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/usdc.svg`},{symbol:`USDT`,address:`0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2`,decimals:6,isNative:!1,assetLogoUrl:_}]},{eip155Id:`42161`,networkName:`Arbitrum`,chainLogoUrl:v[42161],explorerBase:`https://arbiscan.io`,acceptedAssets:[{symbol:`ETH`,address:``,decimals:18,isNative:!0,assetLogoUrl:v[42161]},{symbol:`TUSD`,address:`0x4D15a3A2286D883AF0AA1B3f21367843FAc63E07`,decimals:18,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/tusd.svg`},{symbol:`WETH`,address:`0x82aF49447D8a07e3bd95BD0d56f35241523fBab1`,decimals:18,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/weth.svg`},{symbol:`USDC`,address:`0xaf88d065e77c8cC2239327C5EDb3A432268e5831`,decimals:6,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/usdc.svg`},{symbol:`DAI`,address:`0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1`,decimals:18,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/dai.svg`},{symbol:`USDT`,address:`0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9`,decimals:6,isNative:!1,assetLogoUrl:_}]},{eip155Id:`137`,networkName:`Polygon`,chainLogoUrl:b,explorerBase:`https://polygonscan.com`,acceptedAssets:[{symbol:`POL`,address:``,decimals:18,isNative:!0,assetLogoUrl:b},{symbol:`TUSD`,address:`0x2e1AD108fF1D8C782fcBbB89AAd783aC49586756`,decimals:18,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/tusd.svg`},{symbol:`USDC`,address:`0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359`,decimals:6,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/usdc.svg`},{symbol:`WETH`,address:`0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619`,decimals:18,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/weth.svg`},{symbol:`DAI`,address:`0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063`,decimals:18,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/dai.svg`},{symbol:`USDT`,address:`0xc2132D05D31c914a87C6611C10748AEb04B58e8F`,decimals:6,isNative:!1,assetLogoUrl:_}]}];function A(e,t){let n=t===void 0?{}:{minDepositUsd:{value:t,formatted:i(t,e)}};return k.map(({eip155Id:e,networkName:t,chainLogoUrl:r,explorerBase:i,acceptedAssets:o})=>({eip155Id:e,networkName:t,chainLogoUrl:r,address:{value:x,formatted:a(x)},explorerUrl:`${i}/address/${x}`,acceptedAssets:o,...n}))}const j=k.map(({eip155Id:e,networkName:t,chainLogoUrl:n,explorerBase:r,acceptedAssets:i})=>({eip155Id:e,networkName:t,chainLogoUrl:n,address:{value:x,formatted:a(x)},explorerUrl:`${r}/address/${x}`,acceptedAssets:i})),M={1:`60`,56:`9006`,137:`966`,8453:`8453`,42161:`9001`};function N(){return{assets:k.map(e=>{let t=e.acceptedAssets.find(e=>e.isNative),n=e.acceptedAssets.filter(e=>!e.isNative);return{eip155_id:Number(e.eip155Id),network_id:M[e.eip155Id]??e.eip155Id,network_name:e.networkName.toLowerCase(),network_symbol:e.networkName.toLowerCase(),chain_type:`EVM`,assets:n.map(e=>({address:e.address,decimals:e.decimals,logo:e.assetLogoUrl??``,name:e.symbol,symbol:e.symbol})),native_currency:{symbol:t?.symbol??``,name:t?.symbol??``,decimals:t?.decimals??18,logo:t?.assetLogoUrl??e.chainLogoUrl}}})}}function P(e){return[{networkId:`9006`,networkName:`BSC`,eip155Id:`56`,symbol:`USDC`,decimals:18,address:h,assetLogoUrl:g,chainLogoUrl:y,isNative:!1,amount:{value:42.805864,formatted:r(42.805864,e,{compact:!0})},amountUsd:{value:42.81,formatted:i(42.81,e)},priceUsd:1},{networkId:`9006`,networkName:`BSC`,eip155Id:`56`,symbol:`BNB`,decimals:18,address:``,assetLogoUrl:y,chainLogoUrl:y,isNative:!0,amount:{value:.016699,formatted:r(.016699,e,{compact:!0})},amountUsd:{value:10.86,formatted:i(10.86,e)},priceUsd:650.41},{networkId:`60`,networkName:`Ethereum`,eip155Id:`1`,symbol:`USDT`,decimals:6,address:`0xdAC17F958D2ee523a2206206994597C13D831ec7`,assetLogoUrl:_,chainLogoUrl:v[1],isNative:!1,amount:{value:.757479,formatted:r(.757479,e,{compact:!0})},amountUsd:{value:.76,formatted:i(.76,e)},priceUsd:1,lowBalance:!0,disabled:!0},{networkId:`9006`,networkName:`BSC`,eip155Id:`56`,symbol:`USDT`,decimals:18,address:`0x55d398326f99059fF775485246999027B3197955`,assetLogoUrl:_,chainLogoUrl:y,isNative:!1,amount:{value:.595218,formatted:r(.595218,e,{compact:!0})},amountUsd:{value:.6,formatted:i(.6,e)},priceUsd:1,lowBalance:!0,disabled:!0},{networkId:`60`,networkName:`Ethereum`,eip155Id:`1`,symbol:`ETH`,decimals:18,address:``,assetLogoUrl:v[1],chainLogoUrl:v[1],isNative:!0,amount:{value:167e-6,formatted:r(167e-6,e,{compact:!0})},amountUsd:{value:.39,formatted:i(.39,e)},priceUsd:2316.86,lowBalance:!0,disabled:!0},{networkId:`60`,networkName:`Ethereum`,eip155Id:`1`,symbol:`USDC`,decimals:6,address:`0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48`,assetLogoUrl:`https://cdn.stridge.com/assets/usdc.svg`,chainLogoUrl:v[1],isNative:!1,amount:{value:.10408,formatted:r(.10408,e,{compact:!0})},amountUsd:{value:.1,formatted:i(.1,e)},priceUsd:1,lowBalance:!0,disabled:!0}]}function F(e,n,a=w){return{heroAmountUsd:{value:1.999758,formatted:i(1.999758,e)},sendAsset:{symbol:`USDC`,decimals:6,address:`0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48`,assetLogoUrl:`https://cdn.stridge.com/assets/usdc.svg`,isNative:!1,chainId:1,networkName:`Ethereum`,eip155Id:`1`,chainLogoUrl:v[1]},sendAmount:{value:2,formatted:r(2,e)},receiveAsset:{symbol:a.symbol,decimals:a.decimals,address:a.address,assetLogoUrl:a.assetLogoUrl,isNative:a.isNative,chainId:a.eip155IdNumber,networkName:a.networkName,eip155Id:a.eip155IdString,chainLogoUrl:a.chainLogoUrl},receiveAmount:{value:1.9958,formatted:r(1.9958,e)},quoteTotalSeconds:30,expiresAt:n,etaSeconds:30,breakdown:{selectedRoute:{provider:`lifi`,scenario:`cross_chain_diff_token`,label:`LIFI · cross chain diff token`},networkCost:{value:.0042,formatted:i(.0042,e)},priceImpact:{value:.21,formatted:t(.21,e)}}}}function I(e,t=w){return{kind:`pending`,sourceWallet:{name:`Wallet`,address:{value:s,formatted:a(s)},explorerUrl:`https://etherscan.io/address/${s}`},creditedAsset:{symbol:t.symbol,decimals:t.decimals,address:t.address,assetLogoUrl:t.assetLogoUrl,isNative:t.isNative},creditedTo:o,txHash:{value:c,formatted:a(c)},txExplorerUrl:`https://etherscan.io/tx/${c}`,detectedAt:{value:d,formatted:n(d,e)},submittedAt:{value:d,formatted:n(d,e)},receiveAmount:{value:4.983615,formatted:r(4.983615,e)}}}function L(t,i=w){let u=f-d;return{kind:`succeeded`,sourceWallet:{name:`Wallet`,address:{value:s,formatted:a(s)},explorerUrl:`https://etherscan.io/address/${s}`},destination:{name:o,address:{value:s,formatted:a(s)}},creditedAsset:{symbol:i.symbol,decimals:i.decimals,address:i.address,assetLogoUrl:i.assetLogoUrl,isNative:i.isNative},receiveAmount:{value:4.983615,formatted:r(4.983615,t)},routeHops:[{provider:`LIFI`,chainId:1},{provider:`LIFI`,chainId:i.eip155IdNumber}],totalTime:{value:u,formatted:e(u,t)},depositTx:{hash:{value:c,formatted:a(c)},explorerUrl:`https://etherscan.io/tx/${c}`},completionTx:{hash:{value:l,formatted:a(l)},explorerUrl:`${i.explorerBase}/tx/${l}`},submittedAt:{value:d,formatted:n(d,t)},filledAt:{value:f,formatted:n(f,t)}}}function R(e,t=`execution-reverted`,i=w){return{kind:`failed`,failureKind:t,sourceWallet:{name:`Wallet`,address:{value:s,formatted:a(s)},explorerUrl:`https://etherscan.io/address/${s}`},destination:{name:o,address:{value:s,formatted:a(s)}},creditedAsset:{symbol:i.symbol,decimals:i.decimals,address:i.address,assetLogoUrl:i.assetLogoUrl,isNative:i.isNative},receiveAmount:{value:0,formatted:r(0,e)},txHash:{value:u,formatted:a(u)},txExplorerUrl:`https://etherscan.io/tx/${u}`,submittedAt:{value:p,formatted:n(p,e)},failedAt:{value:m,formatted:n(m,e)}}}function z(e,t=S){let n=P(e).reduce((e,t)=>e+(t.amountUsd?.value??0),0);return{address:{value:t.address,formatted:a(t.address)},...t.chainId===void 0?{}:{chainId:t.chainId},balanceTotalUsd:{value:n,formatted:i(n,e)}}}const B={deposit_addresses:[],metadata:{brand_name:o}},V=[],H={assets:[]},U={chains:[]},W={},G={id:`mock-settlement`,status:`completed`,created_at:new Date(d).toISOString(),updated_at:new Date(f).toISOString()},K={settlements:[],is_terminal:!1};function q(e,t,n,r){return t===`pending`?I(e,n&&typeof n!=`string`?n:void 0):t===`succeeded`?L(e,n&&typeof n!=`string`?n:void 0):R(e,typeof n==`string`?n:void 0,r)}export{j as DEFAULT_ADDRESSES_PAYLOAD,C as DEFAULT_BRAND_PAYLOAD,w as DEFAULT_MOCK_ASSET,D as DEFAULT_TARGET_RAW,S as DEFAULT_WALLET_INFO,V as STUB_DEPOSIT_ADDRESSES_RAW,K as STUB_GATEWAY_POLL_RESPONSE,G as STUB_GATEWAY_SETTLEMENT_DTO,B as STUB_GATEWAY_START_RESPONSE,U as STUB_ONCHAIN_BALANCE_RESPONSE,W as STUB_QUOTE_RESPONSE,H as STUB_SUPPORTED_ASSETS_RESPONSE,A as buildDefaultAddressesPayload,P as buildDefaultBalances,R as buildDefaultFailurePayload,I as buildDefaultPendingPayload,F as buildDefaultQuotePayload,L as buildDefaultSuccessPayload,N as buildDefaultSupportedAssetsResponse,O as buildDefaultTargetPayload,E as buildDefaultTargetRaw,z as buildDefaultWalletPayload,q as buildSettlementPayload,T as resolveMockAsset};
|
|
1
|
+
import{formatDurationCompact as e}from"../../shared/format/formatDurationCompact.js";import{formatPercent as t}from"../../shared/format/formatPercent.js";import{formatTimestamp as n}from"../../shared/format/formatTimestamp.js";import{formatTokenAmount as r}from"../../shared/format/formatTokenAmount.js";import{formatUsd as i}from"../../shared/format/formatUsd.js";import{shortenAddress as a}from"../../shared/format/shortenAddress.js";const o=`Stridge ACME`,s=`0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266`,c=`0x1d72b900dd9b4f9fb0e11c14978d9cbbff7b47db0b820911839aad7081f6b72a`,l=`0x268a11a1002eb7026e3a77999872695ee3a920e5c46172a43aa396da10ac5296`,u=`0xcae135e02df387bba14e231988126295a663c8d9f8e90c1ead5876cc2fee036d`,d=1778167499e3,f=1778169184e3,p=1778086787e3,m=1778087105e3,h=`0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d`,g=`https://cdn.stridge.com/assets/usdc.svg`,_=`https://cdn.stridge.com/assets/usdt.svg`,v={1:`https://cdn.stridge.com/networks/60.svg`,8453:`https://cdn.stridge.com/networks/8453.svg`,42161:`https://cdn.stridge.com/networks/9001.svg`},y=`https://cdn.stridge.com/networks/9006.svg`,b=`https://cdn.stridge.com/networks/966.svg`,x=`0x166872371d1EB43B62c25861Bb7B1be4d5f09F56`,S={address:s,chainId:56},C={name:o},w={networkId:`9006`,networkName:`BSC`,eip155IdString:`56`,eip155IdNumber:56,chainLogoUrl:y,explorerBase:`https://bscscan.com`,symbol:`USDC`,decimals:18,address:h,assetLogoUrl:g,isNative:!1,nativeSymbol:`BNB`};function T(e){if(!e)return w;let t=e.networkId.toLowerCase(),n=k.find(n=>n.networkName.toLowerCase()===t||(M[n.eip155Id]??n.eip155Id)===e.networkId);if(!n)return w;let r=n.acceptedAssets.find(t=>t.symbol.toUpperCase()===e.symbol.toUpperCase());if(!r)return w;let i=n.acceptedAssets.find(e=>e.isNative);return{networkId:M[n.eip155Id]??n.eip155Id,networkName:n.networkName,eip155IdString:n.eip155Id,eip155IdNumber:Number(n.eip155Id),chainLogoUrl:n.chainLogoUrl,explorerBase:n.explorerBase,symbol:r.symbol,decimals:r.decimals,address:r.address,assetLogoUrl:r.assetLogoUrl??n.chainLogoUrl,isNative:r.isNative,nativeSymbol:i?.symbol??r.symbol}}function E(e=w){return{network_id:e.networkId,network_name:e.networkName,network_symbol:e.networkName.toLowerCase(),chain_type:`EVM`,eip155_id:e.eip155IdNumber,native_currency:{symbol:e.nativeSymbol,name:e.nativeSymbol,decimals:18,logo:e.chainLogoUrl},assets:[{symbol:e.symbol,decimals:e.decimals,address:e.address,logo:e.assetLogoUrl}]}}const D=E();function O(e,t,n=w){return{networkId:n.networkId,networkName:n.networkName,eip155Id:n.eip155IdString,chainLogoUrl:n.chainLogoUrl,symbol:n.symbol,decimals:n.decimals,address:n.address,assetLogoUrl:n.assetLogoUrl,isNative:n.isNative,...t===void 0?{}:{minAmountUsd:{value:t,formatted:i(t,e)}}}}const k=[{eip155Id:`1`,networkName:`Ethereum`,chainLogoUrl:v[1],explorerBase:`https://etherscan.io`,acceptedAssets:[{symbol:`ETH`,address:``,decimals:18,isNative:!0,assetLogoUrl:v[1]},{symbol:`TUSD`,address:`0x0000000000085d4780B73119b644AE5ecd22b376`,decimals:18,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/tusd.svg`},{symbol:`PAXG`,address:`0x45804880De22913dAFE09f4980848ECE6EcbAf78`,decimals:18,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/paxg.svg`},{symbol:`DAI`,address:`0x6B175474E89094C44Da98b954EedeAC495271d0F`,decimals:18,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/dai.svg`},{symbol:`PYUSD`,address:`0x6c3ea9036406852006290770BEdFcAbA0e23A0e8`,decimals:6,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/pyusd.svg`},{symbol:`USDC`,address:`0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48`,decimals:6,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/usdc.svg`},{symbol:`WETH`,address:`0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2`,decimals:18,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/weth.svg`},{symbol:`USDT`,address:`0xdAC17F958D2ee523a2206206994597C13D831ec7`,decimals:6,isNative:!1,assetLogoUrl:_}]},{eip155Id:`56`,networkName:`BSC`,chainLogoUrl:y,explorerBase:`https://bscscan.com`,acceptedAssets:[{symbol:`BNB`,address:``,decimals:18,isNative:!0,assetLogoUrl:y},{symbol:`WETH`,address:`0x2170Ed0880ac9A755fd29B2688956BD959F933F8`,decimals:18,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/weth.svg`},{symbol:`TUSD`,address:`0x40af3827F39D0EAcBF4A168f8D4ee67c121D11c9`,decimals:18,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/tusd.svg`},{symbol:`USDT`,address:`0x55d398326f99059fF775485246999027B3197955`,decimals:18,isNative:!1,assetLogoUrl:_},{symbol:`USDC`,address:h,decimals:18,isNative:!1,assetLogoUrl:g}]},{eip155Id:`8453`,networkName:`Base`,chainLogoUrl:v[8453],explorerBase:`https://basescan.org`,acceptedAssets:[{symbol:`ETH`,address:``,decimals:18,isNative:!0,assetLogoUrl:v[8453]},{symbol:`WETH`,address:`0x4200000000000000000000000000000000000006`,decimals:18,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/weth.svg`},{symbol:`DAI`,address:`0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb`,decimals:18,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/dai.svg`},{symbol:`USDC`,address:`0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`,decimals:6,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/usdc.svg`},{symbol:`USDT`,address:`0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2`,decimals:6,isNative:!1,assetLogoUrl:_}]},{eip155Id:`42161`,networkName:`Arbitrum`,chainLogoUrl:v[42161],explorerBase:`https://arbiscan.io`,acceptedAssets:[{symbol:`ETH`,address:``,decimals:18,isNative:!0,assetLogoUrl:v[42161]},{symbol:`TUSD`,address:`0x4D15a3A2286D883AF0AA1B3f21367843FAc63E07`,decimals:18,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/tusd.svg`},{symbol:`WETH`,address:`0x82aF49447D8a07e3bd95BD0d56f35241523fBab1`,decimals:18,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/weth.svg`},{symbol:`USDC`,address:`0xaf88d065e77c8cC2239327C5EDb3A432268e5831`,decimals:6,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/usdc.svg`},{symbol:`DAI`,address:`0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1`,decimals:18,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/dai.svg`},{symbol:`USDT`,address:`0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9`,decimals:6,isNative:!1,assetLogoUrl:_}]},{eip155Id:`137`,networkName:`Polygon`,chainLogoUrl:b,explorerBase:`https://polygonscan.com`,acceptedAssets:[{symbol:`POL`,address:``,decimals:18,isNative:!0,assetLogoUrl:b},{symbol:`TUSD`,address:`0x2e1AD108fF1D8C782fcBbB89AAd783aC49586756`,decimals:18,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/tusd.svg`},{symbol:`USDC`,address:`0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359`,decimals:6,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/usdc.svg`},{symbol:`WETH`,address:`0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619`,decimals:18,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/weth.svg`},{symbol:`DAI`,address:`0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063`,decimals:18,isNative:!1,assetLogoUrl:`https://cdn.stridge.com/assets/dai.svg`},{symbol:`USDT`,address:`0xc2132D05D31c914a87C6611C10748AEb04B58e8F`,decimals:6,isNative:!1,assetLogoUrl:_}]}];function A(e,t){let n=t===void 0?{}:{minAmountUsd:{value:t,formatted:i(t,e)}};return k.map(({eip155Id:e,networkName:t,chainLogoUrl:r,explorerBase:i,acceptedAssets:o})=>({eip155Id:e,networkName:t,chainLogoUrl:r,address:{value:x,formatted:a(x)},explorerUrl:`${i}/address/${x}`,acceptedAssets:o,...n}))}const j=k.map(({eip155Id:e,networkName:t,chainLogoUrl:n,explorerBase:r,acceptedAssets:i})=>({eip155Id:e,networkName:t,chainLogoUrl:n,address:{value:x,formatted:a(x)},explorerUrl:`${r}/address/${x}`,acceptedAssets:i})),M={1:`60`,56:`9006`,137:`966`,8453:`8453`,42161:`9001`};function N(){return{assets:k.map(e=>{let t=e.acceptedAssets.find(e=>e.isNative),n=e.acceptedAssets.filter(e=>!e.isNative);return{eip155_id:Number(e.eip155Id),network_id:M[e.eip155Id]??e.eip155Id,network_name:e.networkName.toLowerCase(),network_symbol:e.networkName.toLowerCase(),chain_type:`EVM`,assets:n.map(e=>({address:e.address,decimals:e.decimals,logo:e.assetLogoUrl??``,name:e.symbol,symbol:e.symbol})),native_currency:{symbol:t?.symbol??``,name:t?.symbol??``,decimals:t?.decimals??18,logo:t?.assetLogoUrl??e.chainLogoUrl}}})}}function P(e){return[{networkId:`9006`,networkName:`BSC`,eip155Id:`56`,symbol:`USDC`,decimals:18,address:h,assetLogoUrl:g,chainLogoUrl:y,isNative:!1,amount:{value:42.805864,formatted:r(42.805864,e,{compact:!0})},amountUsd:{value:42.81,formatted:i(42.81,e)},priceUsd:1},{networkId:`9006`,networkName:`BSC`,eip155Id:`56`,symbol:`BNB`,decimals:18,address:``,assetLogoUrl:y,chainLogoUrl:y,isNative:!0,amount:{value:.016699,formatted:r(.016699,e,{compact:!0})},amountUsd:{value:10.86,formatted:i(10.86,e)},priceUsd:650.41},{networkId:`60`,networkName:`Ethereum`,eip155Id:`1`,symbol:`USDT`,decimals:6,address:`0xdAC17F958D2ee523a2206206994597C13D831ec7`,assetLogoUrl:_,chainLogoUrl:v[1],isNative:!1,amount:{value:.757479,formatted:r(.757479,e,{compact:!0})},amountUsd:{value:.76,formatted:i(.76,e)},priceUsd:1,lowBalance:!0,disabled:!0},{networkId:`9006`,networkName:`BSC`,eip155Id:`56`,symbol:`USDT`,decimals:18,address:`0x55d398326f99059fF775485246999027B3197955`,assetLogoUrl:_,chainLogoUrl:y,isNative:!1,amount:{value:.595218,formatted:r(.595218,e,{compact:!0})},amountUsd:{value:.6,formatted:i(.6,e)},priceUsd:1,lowBalance:!0,disabled:!0},{networkId:`60`,networkName:`Ethereum`,eip155Id:`1`,symbol:`ETH`,decimals:18,address:``,assetLogoUrl:v[1],chainLogoUrl:v[1],isNative:!0,amount:{value:167e-6,formatted:r(167e-6,e,{compact:!0})},amountUsd:{value:.39,formatted:i(.39,e)},priceUsd:2316.86,lowBalance:!0,disabled:!0},{networkId:`60`,networkName:`Ethereum`,eip155Id:`1`,symbol:`USDC`,decimals:6,address:`0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48`,assetLogoUrl:`https://cdn.stridge.com/assets/usdc.svg`,chainLogoUrl:v[1],isNative:!1,amount:{value:.10408,formatted:r(.10408,e,{compact:!0})},amountUsd:{value:.1,formatted:i(.1,e)},priceUsd:1,lowBalance:!0,disabled:!0}]}function F(e,n,a=w){return{heroAmountUsd:{value:1.999758,formatted:i(1.999758,e)},sendAsset:{symbol:`USDC`,decimals:6,address:`0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48`,assetLogoUrl:`https://cdn.stridge.com/assets/usdc.svg`,isNative:!1,chainId:1,networkName:`Ethereum`,eip155Id:`1`,chainLogoUrl:v[1]},sendAmount:{value:2,formatted:r(2,e)},receiveAsset:{symbol:a.symbol,decimals:a.decimals,address:a.address,assetLogoUrl:a.assetLogoUrl,isNative:a.isNative,chainId:a.eip155IdNumber,networkName:a.networkName,eip155Id:a.eip155IdString,chainLogoUrl:a.chainLogoUrl},receiveAmount:{value:1.9958,formatted:r(1.9958,e)},quoteTotalSeconds:30,expiresAt:n,etaSeconds:30,breakdown:{selectedRoute:{provider:`lifi`,scenario:`cross_chain_diff_token`,label:`LIFI · cross chain diff token`},networkCost:{value:.0042,formatted:i(.0042,e)},priceImpact:{value:.21,formatted:t(.21,e)}}}}function I(e,t=w){return{kind:`pending`,sourceWallet:{name:`Wallet`,address:{value:s,formatted:a(s)},explorerUrl:`https://etherscan.io/address/${s}`},creditedAsset:{symbol:t.symbol,decimals:t.decimals,address:t.address,assetLogoUrl:t.assetLogoUrl,isNative:t.isNative},creditedTo:o,txHash:{value:c,formatted:a(c)},txExplorerUrl:`https://etherscan.io/tx/${c}`,detectedAt:{value:d,formatted:n(d,e)},submittedAt:{value:d,formatted:n(d,e)},receiveAmount:{value:4.983615,formatted:r(4.983615,e)}}}function L(t,i=w){let u=f-d;return{kind:`succeeded`,sourceWallet:{name:`Wallet`,address:{value:s,formatted:a(s)},explorerUrl:`https://etherscan.io/address/${s}`},destination:{name:o,address:{value:s,formatted:a(s)}},creditedAsset:{symbol:i.symbol,decimals:i.decimals,address:i.address,assetLogoUrl:i.assetLogoUrl,isNative:i.isNative},receiveAmount:{value:4.983615,formatted:r(4.983615,t)},routeHops:[{provider:`LIFI`,chainId:1},{provider:`LIFI`,chainId:i.eip155IdNumber}],totalTime:{value:u,formatted:e(u,t)},depositTx:{hash:{value:c,formatted:a(c)},explorerUrl:`https://etherscan.io/tx/${c}`},completionTx:{hash:{value:l,formatted:a(l)},explorerUrl:`${i.explorerBase}/tx/${l}`},submittedAt:{value:d,formatted:n(d,t)},filledAt:{value:f,formatted:n(f,t)}}}function R(e,t=`execution-reverted`,i=w){return{kind:`failed`,failureKind:t,sourceWallet:{name:`Wallet`,address:{value:s,formatted:a(s)},explorerUrl:`https://etherscan.io/address/${s}`},destination:{name:o,address:{value:s,formatted:a(s)}},creditedAsset:{symbol:i.symbol,decimals:i.decimals,address:i.address,assetLogoUrl:i.assetLogoUrl,isNative:i.isNative},receiveAmount:{value:0,formatted:r(0,e)},txHash:{value:u,formatted:a(u)},txExplorerUrl:`https://etherscan.io/tx/${u}`,submittedAt:{value:p,formatted:n(p,e)},failedAt:{value:m,formatted:n(m,e)}}}function z(e,t=S){let n=P(e).reduce((e,t)=>e+(t.amountUsd?.value??0),0);return{address:{value:t.address,formatted:a(t.address)},...t.chainId===void 0?{}:{chainId:t.chainId},balanceTotalUsd:{value:n,formatted:i(n,e)}}}const B={deposit_addresses:[],metadata:{brand_name:o}},V=[],H={assets:[]},U={chains:[]},W={},G={id:`mock-settlement`,status:`completed`,created_at:new Date(d).toISOString(),updated_at:new Date(f).toISOString()},K={settlements:[],is_terminal:!1};function q(e,t,n,r){return t===`pending`?I(e,n&&typeof n!=`string`?n:void 0):t===`succeeded`?L(e,n&&typeof n!=`string`?n:void 0):R(e,typeof n==`string`?n:void 0,r)}export{j as DEFAULT_ADDRESSES_PAYLOAD,C as DEFAULT_BRAND_PAYLOAD,w as DEFAULT_MOCK_ASSET,D as DEFAULT_TARGET_RAW,S as DEFAULT_WALLET_INFO,V as STUB_DEPOSIT_ADDRESSES_RAW,K as STUB_GATEWAY_POLL_RESPONSE,G as STUB_GATEWAY_SETTLEMENT_DTO,B as STUB_GATEWAY_START_RESPONSE,U as STUB_ONCHAIN_BALANCE_RESPONSE,W as STUB_QUOTE_RESPONSE,H as STUB_SUPPORTED_ASSETS_RESPONSE,A as buildDefaultAddressesPayload,P as buildDefaultBalances,R as buildDefaultFailurePayload,I as buildDefaultPendingPayload,F as buildDefaultQuotePayload,L as buildDefaultSuccessPayload,N as buildDefaultSupportedAssetsResponse,O as buildDefaultTargetPayload,E as buildDefaultTargetRaw,z as buildDefaultWalletPayload,q as buildSettlementPayload,T as resolveMockAsset};
|
|
@@ -95,7 +95,13 @@ interface AssetPayload {
|
|
|
95
95
|
*/
|
|
96
96
|
interface TargetPayload extends ChainPayload, AssetPayload {
|
|
97
97
|
/** Optional minimum-deposit USD floor surfaced on amount-entry / asset-picker chrome. */
|
|
98
|
-
|
|
98
|
+
minAmountUsd?: FormattedField<number>;
|
|
99
|
+
/**
|
|
100
|
+
* Optional upper USD bound on the deposit amount. When set, the amount-entry treats
|
|
101
|
+
* `min(walletBalanceUsd, maxAmountUsd.value)` as the effective ceiling. Omitted when the
|
|
102
|
+
* host did not configure `flows.deposit.maxAmountUsd`.
|
|
103
|
+
*/
|
|
104
|
+
maxAmountUsd?: FormattedField<number>;
|
|
99
105
|
}
|
|
100
106
|
/**
|
|
101
107
|
* Per-chain deposit address provisioned by `gateway/start`. The kit ships one envelope item per
|
|
@@ -111,9 +117,9 @@ interface AddressItemPayload extends ChainPayload {
|
|
|
111
117
|
* Per-chain minimum-deposit USD floor surfaced next to the chain row in the transfer-crypto
|
|
112
118
|
* picker (`"Min $5"`). Drivers populate this from `supportedAssets`'s per-(chain × asset)
|
|
113
119
|
* floors so the user sees the right number for the chain they're funding from. Optional —
|
|
114
|
-
* the picker falls back to {@link TargetPayload.
|
|
120
|
+
* the picker falls back to {@link TargetPayload.minAmountUsd} when this isn't available.
|
|
115
121
|
*/
|
|
116
|
-
|
|
122
|
+
minAmountUsd?: FormattedField<number>;
|
|
117
123
|
/**
|
|
118
124
|
* Tokens the gateway accepts on this chain (`gateway/start.deposit_addresses[i].accepted_assets`).
|
|
119
125
|
* Drives the transfer-crypto Tokens dropdown — when the user picks a chain, the dropdown
|
|
@@ -154,7 +160,7 @@ interface BalanceItemPayload extends ChainPayload, AssetPayload {
|
|
|
154
160
|
priceUsd?: number;
|
|
155
161
|
/**
|
|
156
162
|
* `true` when this row's USD value is below the kit's deposit floor
|
|
157
|
-
* ({@link TargetPayload.
|
|
163
|
+
* ({@link TargetPayload.minAmountUsd}). Drives the muted "Low Balance" badge in the asset
|
|
158
164
|
* picker; the row remains visible so the user knows the asset exists in the wallet.
|
|
159
165
|
*/
|
|
160
166
|
lowBalance?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{parseDecimalSafe as e}from"../../../shared/transformers/parseSmallestUnit.js";import{formatTokenAmount as t}from"../../../../shared/format/formatTokenAmount.js";import{formatUsd as n}from"../../../../shared/format/formatUsd.js";function r(e){let t=new Set,n=new Set;for(let r of e.assets){let e=String(r.eip155_id);t.add(e);for(let t of r.assets)t.address&&n.add(`${e}:${t.address.toLowerCase()}`)}return{nativeChains:t,tokens:n}}function i(e,t){let n=t.routable!==void 0&&(t.routable.nativeChains.size>0||t.routable.tokens.size>0),r=[];for(let i of e.chains)for(let e of i.tokens)e.is_spam||n&&t.routable&&!o(i.eip155_id,e,t.routable)||r.push(a(i.label,i.eip155_id,i.stridge_network_id,e,t));return r.sort(s),r}function a(r,i,a,o,s){let c=e(o.amount),l=e(o.amount_usd),u=e(o.usd_price),d=s.resolveTokenIcon?.({chainId:i,tokenAddress:o.token_address,symbol:o.symbol,isNative:o.is_native})??s.logos?.(i,o.token_address,o.is_native)??o.logo??void 0,f=s.
|
|
1
|
+
import{parseDecimalSafe as e}from"../../../shared/transformers/parseSmallestUnit.js";import{formatTokenAmount as t}from"../../../../shared/format/formatTokenAmount.js";import{formatUsd as n}from"../../../../shared/format/formatUsd.js";function r(e){let t=new Set,n=new Set;for(let r of e.assets){let e=String(r.eip155_id);t.add(e);for(let t of r.assets)t.address&&n.add(`${e}:${t.address.toLowerCase()}`)}return{nativeChains:t,tokens:n}}function i(e,t){let n=t.routable!==void 0&&(t.routable.nativeChains.size>0||t.routable.tokens.size>0),r=[];for(let i of e.chains)for(let e of i.tokens)e.is_spam||n&&t.routable&&!o(i.eip155_id,e,t.routable)||r.push(a(i.label,i.eip155_id,i.stridge_network_id,e,t));return r.sort(s),r}function a(r,i,a,o,s){let c=e(o.amount),l=e(o.amount_usd),u=e(o.usd_price),d=s.resolveTokenIcon?.({chainId:i,tokenAddress:o.token_address,symbol:o.symbol,isNative:o.is_native})??s.logos?.(i,o.token_address,o.is_native)??o.logo??void 0,f=s.minAmountUsd!==void 0&&s.minAmountUsd>0&&l<s.minAmountUsd;return{networkId:a,networkName:r,eip155Id:String(i),symbol:o.symbol,decimals:o.decimals,address:o.token_address||`0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee`,isNative:o.is_native,...d?{assetLogoUrl:d}:{},amount:{value:c,formatted:t(c,s.i18n,{compact:!0})},...l>0?{amountUsd:{value:l,formatted:n(l,s.i18n)}}:{},...u>0?{priceUsd:u}:{},...f?{lowBalance:!0,disabled:!0}:{}}}function o(e,t,n){let r=String(e);return t.is_native?n.nativeChains.has(r):t.token_address?n.tokens.has(`${r}:${t.token_address.toLowerCase()}`):!1}function s(e,t){return(t.amountUsd?.value??0)-(e.amountUsd?.value??0)}export{i as balanceToBalancesPayload,r as buildRoutableAllowlist};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{formatNetworkName as e}from"../../../../shared/format/formatNetworkName.js";import{formatUsd as t}from"../../../../shared/format/formatUsd.js";import{shortenAddress as n}from"../../../../shared/format/shortenAddress.js";const r=new Set([11155111,5,80001,80002,84532,421614,11155420,97]);function i(i,o={}){let s=o.includeTestnets??!1;return i.flatMap(i=>{let c=String(i.eip155_id??``),l=Number(c);if(!s&&Number.isFinite(l)&&r.has(l))return[];let u=o.explorers?.[l],d=o.i18n&&c?o.
|
|
1
|
+
import{formatNetworkName as e}from"../../../../shared/format/formatNetworkName.js";import{formatUsd as t}from"../../../../shared/format/formatUsd.js";import{shortenAddress as n}from"../../../../shared/format/shortenAddress.js";const r=new Set([11155111,5,80001,80002,84532,421614,11155420,97]);function i(i,o={}){let s=o.includeTestnets??!1;return i.flatMap(i=>{let c=String(i.eip155_id??``),l=Number(c);if(!s&&Number.isFinite(l)&&r.has(l))return[];let u=o.explorers?.[l],d=o.i18n&&c?o.minAmountUsdByEip155Id?.[c]:void 0,f=a(i.accepted_assets,c?o.nativeAssetByEip155Id?.[c]:void 0);return[{networkName:e(i.network_name??``),...c?{eip155Id:c}:{},...o.chainLogos?.[c]?{chainLogoUrl:o.chainLogos[c]}:{},address:{value:i.address,formatted:n(i.address)},...u?{explorerUrl:`${u.replace(/\/+$/,``)}/address/${i.address}`}:{},...d!==void 0&&o.i18n?{minAmountUsd:{value:d,formatted:t(d,o.i18n)}}:{},...f.length>0?{acceptedAssets:f}:{}}]})}function a(e,t){let n=Array.isArray(e)?e.map(o):[];return!t||new Set(n.map(e=>e.symbol.toUpperCase())).has(t.symbol.toUpperCase())?n:[t,...n]}function o(e){let t=e.logo,n=!e.address;return{symbol:e.symbol,address:e.address,decimals:e.decimals,...typeof t==`string`&&t.length>0?{assetLogoUrl:t}:{},isNative:n}}export{i as startToAddressesPayload};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{formatNetworkName as e}from"../../../../shared/format/formatNetworkName.js";import{formatUsd as t}from"../../../../shared/format/formatUsd.js";function n(n,r){let i=n.assets.find(e=>String(e.network_id)===r.networkId);if(!i)return;let a=i.assets.find(e=>e.symbol.toUpperCase()===r.assetSymbol.toUpperCase());if(!a)return;let o=i.native_currency?.logo;return{networkId:r.networkId,networkName:e(i.network_name),eip155Id:String(i.eip155_id),...o?{chainLogoUrl:o}:{},symbol:a.symbol,decimals:a.decimals,address:a.address??``,isNative:!a.address,...a.logo?{assetLogoUrl:a.logo}:{},...r.
|
|
1
|
+
import{formatNetworkName as e}from"../../../../shared/format/formatNetworkName.js";import{formatUsd as t}from"../../../../shared/format/formatUsd.js";function n(n,r){let i=n.assets.find(e=>String(e.network_id)===r.networkId);if(!i)return;let a=i.assets.find(e=>e.symbol.toUpperCase()===r.assetSymbol.toUpperCase());if(!a)return;let o=i.native_currency?.logo;return{networkId:r.networkId,networkName:e(i.network_name),eip155Id:String(i.eip155_id),...o?{chainLogoUrl:o}:{},symbol:a.symbol,decimals:a.decimals,address:a.address??``,isNative:!a.address,...a.logo?{assetLogoUrl:a.logo}:{},...r.minAmountUsd===void 0?{}:{minAmountUsd:{value:r.minAmountUsd,formatted:t(r.minAmountUsd,r.i18n)}},...r.maxAmountUsd===void 0?{}:{maxAmountUsd:{value:r.maxAmountUsd,formatted:t(r.maxAmountUsd,r.i18n)}}}}export{n as startToTargetPayload};
|
|
@@ -14,7 +14,7 @@ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
|
14
14
|
* minimum-deposit USD floor from the driver's `target` entity. Renders nothing on any other
|
|
15
15
|
* FSM state.
|
|
16
16
|
*
|
|
17
|
-
* Honors `target.payload.
|
|
17
|
+
* Honors `target.payload.minAmountUsd.value`: when the entered amount is below it, the footer
|
|
18
18
|
* CTA flips to "Update order" and clicking auto-snaps the amount up to the floor. The widget
|
|
19
19
|
* also prefills the entry to the floor on first render so the user starts at a valid amount.
|
|
20
20
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useDepositSnapshot as e}from"../../driver/context.js";import{useKitI18n as t}from"../../../../shared/i18n/useKitI18n.js";import{Trans as n}from"../../../../shared/i18n/Trans.js";import{useLingui as r}from"../../../../shared/i18n/useLingui.js";import"../../../../i18n/index.js";import{useDepositActions as i,useDepositEffectiveState as a}from"../../orchestrator/controller.js";import{formatTokenAmount as o}from"../../../../shared/format/formatTokenAmount.js";import{DialogShell as s}from"../../../../shared/dialog/DialogShell.js";import{text as c}from"../../../../shared/ui/Text/Text.js";import"../../../../shared/ui/Text/index.js";import{AmountEntry as l}from"../../../../shared/widgets/amount-entry/compound/AmountEntry.js";import"../../../../shared/widgets/amount-entry/compound/index.js";import{toAssetDescriptor as u}from"../../../../shared/widgets/asset-descriptor.js";import{
|
|
1
|
+
"use client";import{useDepositSnapshot as e}from"../../driver/context.js";import{useKitI18n as t}from"../../../../shared/i18n/useKitI18n.js";import{Trans as n}from"../../../../shared/i18n/Trans.js";import{useLingui as r}from"../../../../shared/i18n/useLingui.js";import"../../../../i18n/index.js";import{useDepositActions as i,useDepositEffectiveState as a}from"../../orchestrator/controller.js";import{formatTokenAmount as o}from"../../../../shared/format/formatTokenAmount.js";import{DialogShell as s}from"../../../../shared/dialog/DialogShell.js";import{text as c}from"../../../../shared/ui/Text/Text.js";import"../../../../shared/ui/Text/index.js";import{AmountEntry as l}from"../../../../shared/widgets/amount-entry/compound/AmountEntry.js";import"../../../../shared/widgets/amount-entry/compound/index.js";import{toAssetDescriptor as u}from"../../../../shared/widgets/asset-descriptor.js";import{effectiveMaxUsd as d,resolveFooterIntent as f}from"./footerIntent.js";import{useEffect as p,useRef as m,useState as h}from"react";import{jsx as g,jsxs as _}from"react/jsx-runtime";const v=[{value:`25`,label:`25%`},{value:`50`,label:`50%`},{value:`75`,label:`75%`},{value:`max`,label:`Max`}];function y(n){let s=e(),c=a(),{confirmAmount:y,back:C}=i(),{_:w}=r(),T=t(),E=s.target,D=E.status===`ready`||E.status===`stale`?E.payload:void 0,O=c.name===`amountEntry`?c.ctx.asset:void 0,k=O?.amountUsd?.value??0,A=D?.minAmountUsd?.value,j=D?.minAmountUsd?.formatted,M=D?.maxAmountUsd?.value,N=D?.maxAmountUsd?.formatted,P=d(k,M),F=O?.priceUsd,[I,L]=h(A??null),[R,z]=h(),B=m(void 0),V=O?`${O.eip155Id??``}:${O.address??``}`:void 0;p(()=>{V&&B.current!==V&&(B.current=V,typeof A==`number`&&(L(A),z(void 0)))},[V,A]);let H=e=>{z(e);let t=e===`max`?1:Number.parseInt(e,10)/100;Number.isFinite(t)&&L(P*t)},U=e=>{L(e),z(void 0)},W=f({amount:I,...A===void 0?{}:{minAmountUsd:A},...M===void 0?{}:{maxAmountUsd:M},walletBalanceUsd:k}),G=()=>{if(W===`aboveBalance`||W===`aboveCap`){L(P),z(`max`);return}if(W===`belowMin`&&typeof A==`number`){L(A),z(void 0);return}I!==null&&y(F&&F>0?I/F:I)};if(c.name!==`amountEntry`||!O||!D)return null;let K=c.ctx.backTarget===`closed`?void 0:C,q=u(O)??{symbol:O.symbol},J=u(D)??{symbol:D.symbol},Y=`${o((I??0)/1,T,{maxDecimals:5})} ${D.symbol}`,X=b(W,{updateOrder:w({id:`bOZXx5`,message:`Update order`}),depositMax:w({id:`9cCjMJ`,message:`Deposit max balance`})});return _(l,{...n,amount:I,sendToken:q,receiveToken:J,max:P,...A===void 0?{}:{min:A},onAmountChange:U,...K?{onBack:K}:{},subLineAmount:Y,presets:v,...R===void 0?{}:{activePreset:R},onPresetSelect:H,...X===void 0?{}:{footerLabel:X},onContinue:G,children:[g(l.Header,{}),_(l.Body,{children:[g(l.Hero,{}),g(l.Pills,{}),g(x,{intent:W,formattedCap:N}),g(l.Flow,{}),g(S,{intent:W,formattedMin:j})]}),g(l.Footer,{})]})}function b(e,t){if(e===`aboveCap`||e===`belowMin`)return t.updateOrder;if(e===`aboveBalance`)return t.depositMax}function x({intent:e,formattedCap:t}){return e===`aboveCap`&&t?g(c.p,{size:`sm`,color:`subdued`,className:`AmountEntry__noticeStyles.root x2b8uid x1vvogim`,"data-style-src":`@stridge/kit:src/flows/deposit/widgets/amount-entry/AmountEntry.tsx:17`,children:g(n,{id:`-I_tc5`,message:`Max {formattedCap}`,values:{formattedCap:t}})}):e===`aboveBalance`?g(c.p,{size:`sm`,color:`subdued`,className:`AmountEntry__noticeStyles.root x2b8uid x1vvogim`,"data-style-src":`@stridge/kit:src/flows/deposit/widgets/amount-entry/AmountEntry.tsx:17`,children:g(n,{id:`znqB4T`,message:`Insufficient balance`})}):null}function S({intent:e,formattedMin:t}){return e!==`belowMin`||!t?null:g(c.p,{size:`sm`,color:`subdued`,className:`AmountEntry__noticeStyles.root x2b8uid x1vvogim`,"data-style-src":`@stridge/kit:src/flows/deposit/widgets/amount-entry/AmountEntry.tsx:17`,children:g(n,{id:`3eKjkO`,message:`{formattedMin} minimum deposit`,values:{formattedMin:t}})})}function C({open:e,defaultOpen:t,onOpenChange:n,trigger:r,...i}){return g(s,{open:e,defaultOpen:t,onOpenChange:n,trigger:r,children:g(y,{...i})})}(function(e){e.Dialog=C})(y||={});export{y as AmountEntry};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){let{amount:r,minAmountUsd:i,maxAmountUsd:a,walletBalanceUsd:o}=e,s=t(o,a);return r!==null&&s>0&&r>s?n(o,a)?`aboveCap`:`aboveBalance`:typeof i==`number`&&i>0&&(r===null||r<i)?`belowMin`:`ready`}function t(e,t){return typeof t==`number`&&t>0?Math.min(e,t):e}function n(e,t){return typeof t==`number`&&t>0&&t<=e}export{t as effectiveMaxUsd,e as resolveFooterIntent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useDepositSnapshot as e}from"../../driver/context.js";import{useDepositActions as t,useDepositEffectiveState as n}from"../../orchestrator/controller.js";import{DialogShell as r}from"../../../../shared/dialog/DialogShell.js";import{TransferCrypto as i}from"./compound/TransferCrypto.js";import"./compound/index.js";import{useMemo as a,useState as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";function l(r){let l=e(),u=n(),d=u.name,{back:f}=t(),p=u.name===`transferCrypto`&&u.ctx.backTarget!==`closed`?f:void 0,m=l.addresses,h=m.status===`ready`||m.status===`stale`?m.payload:[],g=l.target,_=g.status===`ready`||g.status===`stale`?g.payload:void 0,v=_?.
|
|
1
|
+
"use client";import{useDepositSnapshot as e}from"../../driver/context.js";import{useDepositActions as t,useDepositEffectiveState as n}from"../../orchestrator/controller.js";import{DialogShell as r}from"../../../../shared/dialog/DialogShell.js";import{TransferCrypto as i}from"./compound/TransferCrypto.js";import"./compound/index.js";import{useMemo as a,useState as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";function l(r){let l=e(),u=n(),d=u.name,{back:f}=t(),p=u.name===`transferCrypto`&&u.ctx.backTarget!==`closed`?f:void 0,m=l.addresses,h=m.status===`ready`||m.status===`stale`?m.payload:[],g=l.target,_=g.status===`ready`||g.status===`stale`?g.payload:void 0,v=_?.minAmountUsd?.formatted,y=a(()=>{let e=new Map;for(let t of h)for(let n of t.acceptedAssets??[]){let r=n.symbol.toUpperCase(),i=e.get(r);i?i.push({chain:t,asset:n}):e.set(r,[{chain:t,asset:n}])}return e},[h]),b=a(()=>y.size===0?_?[{symbol:_.symbol,..._.eip155Id?{chainId:Number(_.eip155Id)}:{},..._.address?{address:_.address}:{},..._.isNative===void 0?{}:{isNative:_.isNative},..._.assetLogoUrl?{logoUrl:_.assetLogoUrl}:{}}]:[]:[...y.values()].map(e=>{let t=e[0];return{symbol:t.asset.symbol,...t.chain.eip155Id?{chainId:Number(t.chain.eip155Id)}:{},...t.asset.address?{address:t.asset.address}:{},isNative:t.asset.isNative,...t.asset.assetLogoUrl?{logoUrl:t.asset.assetLogoUrl}:{}}}),[y,_]),[x,S]=o(void 0),[C,w]=o(void 0),T=a(()=>{if(x&&b.some(e=>e.symbol.toUpperCase()===x.symbol.toUpperCase()))return x;let e=_?.symbol.toUpperCase();return b.find(t=>t.symbol.toUpperCase()===e)??b[0]},[x,b,_?.symbol]),E=a(()=>(T?y.get(T.symbol.toUpperCase())?.map(e=>e.chain)??[...h]:[...h]).map(e=>{let t=e.minAmountUsd?.formatted??v;return{symbol:e.networkName,...e.eip155Id?{chainId:Number(e.eip155Id)}:{},isNative:!0,...e.chainLogoUrl?{logoUrl:e.chainLogoUrl}:{},...t?{minDeposit:t}:{}}}),[T,y,h,v]),D=a(()=>{if(C&&E.some(e=>e.chainId===C.chainId))return C;let e=_?.eip155Id?Number(_.eip155Id):void 0;return(e===void 0?void 0:E.find(t=>t.chainId===e))??E[0]},[C,E,_?.eip155Id]),O=a(()=>D?.chainId?h.find(e=>e.eip155Id&&Number(e.eip155Id)===D.chainId)??h[0]:h[0],[D,h]),k=a(()=>{if(!T)return;let e=O?.acceptedAssets?.find(e=>e.symbol.toUpperCase()===T.symbol.toUpperCase());return e?{symbol:e.symbol,...D?.chainId===void 0?{}:{chainId:D.chainId},...e.address?{address:e.address}:{},isNative:e.isNative,...e.assetLogoUrl?{logoUrl:e.assetLogoUrl}:{}}:T},[T,O,D?.chainId]),A=O?.address.value??``;if(d!==`transferCrypto`||!_||h.length===0)return null;let j={symbol:_.symbol,..._.eip155Id?{chainId:Number(_.eip155Id)}:{},..._.address?{address:_.address}:{},..._.isNative===void 0?{}:{isNative:_.isNative},..._.assetLogoUrl?{logoUrl:_.assetLogoUrl}:{}},M={symbol:_.networkName,..._.eip155Id?{chainId:Number(_.eip155Id)}:{},isNative:!0,..._.chainLogoUrl?{logoUrl:_.chainLogoUrl}:{}};return c(i,{...r,depositAddress:A,token:k,chain:D,onTokenChange:S,onChainChange:w,tokenOptions:b,chainOptions:E,sendAsset:k,sendNetwork:D,receiveAsset:j,receiveNetwork:M,children:[s(i.Header,{...p?{onBack:p}:{}}),c(i.Body,{children:[s(i.Selectors,{}),s(i.QrCode,{}),s(i.Summary,{}),s(i.Address,{}),s(i.Disclosure,{})]})]})}function u({open:e,defaultOpen:t,onOpenChange:n,trigger:i,...a}){return s(r,{open:e,defaultOpen:t,onOpenChange:n,trigger:i,children:s(l,{...a})})}(function(e){e.Dialog=u})(l||={});export{l as TransferCrypto};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Entity, SettlementFailureKind, TxRef } from "../../../shared/driver/types.js";
|
|
2
|
+
import { FormattedField } from "../../../shared/format/types.js";
|
|
2
3
|
import { ReceiveOptionDto, ReceiveOptionsResponse, WithdrawableBalanceDto, WithdrawableBalancesResponse, WithdrawalQuoteDto, WithdrawalQuoteResponse, WithdrawalSettlementDto, WithdrawalSettlementResponse } from "./dto.js";
|
|
3
4
|
import { ReceiveChainPayload, ReceiveTokenOptionPayload, WithdrawableBalanceItemPayload, WithdrawalQuoteBreakdownPayload, WithdrawalQuotePayload, WithdrawalReceiveAssetPayload, WithdrawalSettlementFailurePayload, WithdrawalSettlementPayload, WithdrawalSettlementPendingPayload, WithdrawalSettlementSuccessPayload } from "./payloads.js";
|
|
4
5
|
|
|
@@ -8,8 +9,9 @@ import { ReceiveChainPayload, ReceiveTokenOptionPayload, WithdrawableBalanceItem
|
|
|
8
9
|
* {@link WithdrawDriver.getSnapshot} and consumed by `useSyncExternalStore`. The kit's
|
|
9
10
|
* `useWithdrawSnapshot()` hook returns this shape.
|
|
10
11
|
*
|
|
11
|
-
*
|
|
12
|
-
* the `ready` / `stale` variants.
|
|
12
|
+
* Most fields are {@link Entity} envelopes — components switch on `status` and read `payload` on
|
|
13
|
+
* the `ready` / `stale` variants. The optional `minAmountUsd` / `maxAmountUsd` carry static
|
|
14
|
+
* config-derived USD bounds (set once at driver construction) and stay outside the entity model.
|
|
13
15
|
*/
|
|
14
16
|
interface WithdrawSnapshot {
|
|
15
17
|
/**
|
|
@@ -37,6 +39,18 @@ interface WithdrawSnapshot {
|
|
|
37
39
|
* error state screen renders.
|
|
38
40
|
*/
|
|
39
41
|
settlement: Entity<WithdrawalSettlementPayload, WithdrawalSettlementDto, WithdrawalSettlementResponse>;
|
|
42
|
+
/**
|
|
43
|
+
* Optional lower USD bound on the withdraw amount. The withdraw form blocks submit with a
|
|
44
|
+
* localized "Min $X" CTA when the typed amount sits below `value`. Set from
|
|
45
|
+
* `<StridgeProvider flows.withdraw.minAmountUsd>` and constant across the driver's lifetime.
|
|
46
|
+
*/
|
|
47
|
+
minAmountUsd?: FormattedField<number>;
|
|
48
|
+
/**
|
|
49
|
+
* Optional upper USD bound on the withdraw amount. The withdraw form blocks submit with a
|
|
50
|
+
* localized "Max $X" CTA when the typed amount sits above `value`. Set from
|
|
51
|
+
* `<StridgeProvider flows.withdraw.maxAmountUsd>` and constant across the driver's lifetime.
|
|
52
|
+
*/
|
|
53
|
+
maxAmountUsd?: FormattedField<number>;
|
|
40
54
|
}
|
|
41
55
|
/**
|
|
42
56
|
* Input to {@link WithdrawDriver.requestQuote}. The form widget builds this from current field
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{isValidAddressForChainType as e}from"../../../../shared/chains/index.js";import{useKitI18n as t}from"../../../../shared/i18n/useKitI18n.js";import{useLingui as n}from"../../../../shared/i18n/useLingui.js";import"../../../../i18n/index.js";import{useWithdrawBindingsValue as
|
|
1
|
+
"use client";import{isValidAddressForChainType as e}from"../../../../shared/chains/index.js";import{useKitI18n as t}from"../../../../shared/i18n/useKitI18n.js";import{useLingui as n}from"../../../../shared/i18n/useLingui.js";import"../../../../i18n/index.js";import{useWithdrawBindingsValue as ee}from"../../bindings/WithdrawBindings.js";import"../../bindings/index.js";import{useWithdrawDriverInstance as r,useWithdrawSnapshot as te}from"../../driver/context.js";import{useWithdrawActions as ne,useWithdrawEffectiveState as re}from"../../orchestrator/controller.js";import{formatTokenAmount as ie}from"../../../../shared/format/formatTokenAmount.js";import{parseAmountInputValue as ae}from"../../../../shared/ui/AmountInput/utils.js";import"../../../../shared/ui/AmountInput/index.js";import{toAssetDescriptor as i}from"../../../../shared/widgets/asset-descriptor.js";import{useQuoteCountdown as oe}from"../../../../shared/quote/useQuoteCountdown.js";import"../../../../shared/quote/index.js";import{WithdrawForm as a}from"./compound/WithdrawForm.js";import"./compound/index.js";import{useWithdrawDialogEvents as se}from"../../dialog/WithdrawDialogEventsContext.js";import{resolveSubmitLabel as ce}from"./validation.js";import{useCallback as o,useEffect as s,useMemo as c,useRef as l,useState as u}from"react";import{jsx as d,jsxs as le}from"react/jsx-runtime";function ue({events:ue}){let f=te(),p=r(),m=re(),h=ne(),{i18n:de,_:g}=n(),fe=se(),pe=c(()=>({...fe,...ue??{}}),[fe,ue]),_=l(pe);_.current=pe;let{balance:v,suggestedRecipient:me}=ee(),[y,he]=u(``),[ge,_e]=u(``),ve=m.name===`submitting`,b=m.name===`form`?m.ctx?.notice:void 0,ye=l(b);ye.current=b;let x=f.withdrawableBalances.status===`ready`||f.withdrawableBalances.status===`stale`?f.withdrawableBalances.payload[0]:void 0,S=c(()=>i(x)??{symbol:`USDC`},[x]),be=c(()=>i(x?{symbol:x.networkName,eip155Id:x.eip155Id,isNative:!0,logoUrl:x.chainLogoUrl}:void 0)??{symbol:`BSC`},[x]),C=typeof v==`number`?v:typeof v==`object`?v.amount:void 0,xe=x?.symbol??S.symbol,w=C??x?.amount.value,Se=C===void 0?x?.symbol:xe,T=w!==void 0&&Se!==void 0?{amount:C===void 0?x?.amount.formatted??ie(w,de):ie(C,de),symbol:Se}:void 0,E=f.receiveOptions.status===`ready`||f.receiveOptions.status===`stale`?f.receiveOptions.payload:[],D=x?.eip155Id?Number(x.eip155Id):void 0,O=x?.symbol??S.symbol,k=c(()=>{let e=new Map;for(let t of E)for(let n of t.tokens){let ee=n.symbol.toUpperCase(),r=e.get(ee);r?r.push({chain:t,token:n}):e.set(ee,[{chain:t,token:n}])}return e},[E]),A=c(()=>{if(k.size===0)return;let e=O.toUpperCase();return k.has(e)?e:k.keys().next().value},[k,O]),j=o(e=>{let t=k.get(e);if(!(!t||t.length===0))return(D===void 0?void 0:t.find(e=>e.chain.eip155Id===D))??t[0]},[k,D]),[M,N]=u(void 0),[P,F]=u(void 0);s(()=>{if(P||!A)return;let e=j(A);e&&(N(e.chain),F(e.token))},[A,j,P]);let I=o(()=>{ye.current&&h.clearNotice()},[h]),Ce=o(e=>{I(),he(e),_.current.onRecipientChanged?.(e)},[I]),L=t().locale,R=o(e=>{I(),_e(e);let t=ae(e,L);_.current.onAmountChanged?.({raw:e,numeric:t})},[I,L]),we=o(e=>{I();let t=e.symbol.toUpperCase(),n=k.get(t)?.find(e=>e.chain.eip155Id===M?.eip155Id)??j(t);n&&(N(n.chain),F(n.token),_.current.onReceiveTokenChanged?.(n.token),n.chain.eip155Id!==M?.eip155Id&&_.current.onReceiveChainChanged?.(n.chain))},[I,k,j,M?.eip155Id]),Te=o(e=>{I(),N(e);let t=P?.symbol.toUpperCase(),n=(t?e.tokens.find(e=>e.symbol.toUpperCase()===t):void 0)??e.tokens[0];n&&F(n),_.current.onReceiveChainChanged?.(e),n&&n.symbol!==P?.symbol&&_.current.onReceiveTokenChanged?.(n)},[I,P?.symbol]),z=ae(ge,L),B=z!==null&&z>0,Ee=y.trim(),De=Ee.length>0,Oe=M?.chainType??`unknown`,V=e(Ee,Oe),H=M!==void 0&&P!==void 0,U=B&&w!==void 0&&z>w,W=f.minAmountUsd,G=f.maxAmountUsd,ke=x?.amountUsd&&x.amount.value>0?x.amountUsd.value/x.amount.value:void 0,K=ke!==void 0&&z!==null?z*ke:void 0,q=B&&K!==void 0&&W!==void 0&&W.value>0&&K<W.value,J=B&&K!==void 0&&G!==void 0&&G.value>0&&K>G.value,[Y,Ae]=u(null),X=(f.quote.status===`ready`||f.quote.status===`stale`)&&De&&B&&H&&Y!==null&&Y.recipient===y&&Y.amount===z&&Y.receiveChainId===M.eip155Id&&Y.receiveSymbol===P.symbol?f.quote.payload:void 0,je=c(()=>k.size===0?[S]:[...k.values()].map(e=>{let t=e[0];return i({symbol:t.token.symbol,eip155Id:t.chain.eip155Id,address:t.token.address,isNative:t.token.isNative,logoUrl:t.token.assetLogoUrl})??{symbol:t.token.symbol}}),[k,S]),Me=c(()=>{let e=P?.symbol.toUpperCase(),t=e?k.get(e):void 0;return(t?t.map(e=>e.chain):E).map(e=>i({symbol:e.networkName,eip155Id:e.eip155Id,isNative:!0,logoUrl:e.chainLogoUrl})??{symbol:e.networkName})},[P?.symbol,k,E]),Ne=P?i({symbol:P.symbol,eip155Id:M?.eip155Id,address:P.address,isNative:P.isNative,logoUrl:P.assetLogoUrl}):S,Pe=M?i({symbol:M.networkName,eip155Id:M.eip155Id,isNative:!0,logoUrl:M.chainLogoUrl}):be,Fe=c(()=>{if(X?.breakdown)return{route:X.breakdown.selectedRoute?.label,networkCost:X.breakdown.networkCost?.formatted,priceImpact:X.breakdown.priceImpact?.formatted}},[X]),Ie=c(()=>{if(B)return X?.receiveAmountUsd?X.receiveAmountUsd.formatted:`$${z.toFixed(2)}`},[z,B,X]),Le=X&&B?X.receiveAmount.formatted:void 0,Re=X?.receiveAmountUsd?.formatted,ze=V&&B&&!U&&!q&&!J&&H&&X===void 0&&f.quote.status!==`error`,Z=V&&B&&!U&&!q&&!J&&H&&X!==void 0,Be=oe({expiresAt:X?.expiresAt,enabled:Z}),Ve=Z&&X?X.quoteTotalSeconds:void 0,[Q,He]=u(!1);s(()=>{He(!1)},[y,z,M?.eip155Id,P?.symbol,m.name]),s(()=>{if(!Z||!X||m.name!==`form`||Q)return;let e=Math.max(0,X.expiresAt-Date.now()),t=setTimeout(()=>{He(!0)},e);return()=>clearTimeout(t)},[Z,X,m.name,Q]),s(()=>{if(!Q||m.name!==`form`||D===void 0||!M||!P||!V||!B||U||q||J)return;let e=new AbortController,t={recipient:y,amount:z??0,receiveChainId:M.eip155Id,receiveSymbol:P.symbol},n={sourceAssetSymbol:O,sourceChainId:D,amount:z??0,receiveTokenSymbol:P.symbol,receiveChainId:M.eip155Id,recipientAddress:y};return _.current.onQuoteRequested?.(n),p.requestQuote(n,e.signal).then(()=>{e.signal.aborted||Ae(t)}).catch(()=>{}).finally(()=>{e.signal.aborted||He(!1)}),()=>e.abort()},[Q,p,y,z,V,B,U,q,J,D,O,M,P,m.name]);let $=!V||!B||U||q||J||!H||ze||Q,Ue=ce({enterRecipientAddress:g({id:`nr03QI`,message:`Enter Recipient Address`}),enterValidRecipientAddress:g({id:`GZPxmc`,message:`Enter Valid Recipient Address`}),enterAmount:g({id:`yH9V_J`,message:`Enter Amount`}),insufficientBalance:g({id:`N2DUxS`,message:`Insufficient Balance`}),...W?{belowMinimumAmount:g({id:`WkRH60`,message:`Min {0}`,values:{0:W.formatted}})}:{},...G?{aboveCapAmount:g({id:`AHyker`,message:`Max {0}`,values:{0:G.formatted}})}:{},regeneratingQuote:g({id:`Ly6geA`,message:`Regenerating quote…`}),estimatingQuote:g({id:`Uevt3L`,message:`Estimating quote`})},{isRecipientFilled:De,isRecipientValid:V,isAmountValid:B,exceedsBalance:U,belowMinimum:q,aboveCap:J,quoteEstimating:ze,quoteRegenerating:Q}),We=l(null);s(()=>{if(We.current?.abort(),!V||!B||U||q||J||!H||m.name!==`form`||D===void 0)return;let e=new AbortController;We.current=e;let t={recipient:y,amount:z,receiveChainId:M.eip155Id,receiveSymbol:P.symbol},n=setTimeout(()=>{let n={sourceAssetSymbol:O,sourceChainId:D,amount:z,receiveTokenSymbol:P.symbol,receiveChainId:M.eip155Id,recipientAddress:y};_.current.onQuoteRequested?.(n),p.requestQuote(n,e.signal).then(()=>{e.signal.aborted||Ae(t)}).catch(()=>{})},400);return()=>{clearTimeout(n),e.abort()}},[p,y,z,V,B,U,q,J,H,D,O,M?.eip155Id,P?.symbol,m.name]);let Ge=o(()=>{T&&R(T.amount)},[T,R]),Ke=o(()=>{ve||$||D===void 0||!M||!P||h.submit({sourceAssetSymbol:O,sourceChainId:D,amount:z??0,recipientAddress:y,receiveTokenSymbol:P.symbol,receiveChainId:M.eip155Id})},[h,z,D,O,M,P,y,$,ve]),qe=o(e=>{let t=E.find(t=>String(t.eip155Id)===String(e.chainId));t&&Te(t)},[Te,E]),Je=o(e=>{let t=e.symbol.toUpperCase(),n=k.get(t);!n||n.length===0||we((n.find(e=>e.chain.eip155Id===M?.eip155Id)??n[0]).token)},[we,k,M?.eip155Id]);return m.name!==`form`&&m.name!==`submitting`?null:le(a,{recipientAddress:y,onRecipientChange:Ce,recipientChainType:Oe,...me?{suggestedRecipient:me}:{},amount:ge,onAmountChange:R,onAmountMax:Ge,sourceAsset:S,sourceChain:be,receiveAsset:Ne,receiveChain:Pe,receiveAssetOptions:je,onReceiveAssetChange:Je,receiveChainOptions:Me,onReceiveChainChange:qe,balance:T,amountUsd:Ie,receiveAmount:Le,receiveAmountUsd:Re,breakdown:Fe,quoteEstimating:ze,quoteRegenerating:Q,...Be===void 0?{}:{quoteSeconds:Be},...Ve===void 0?{}:{quoteTotalSeconds:Ve},submitting:ve,submitDisabled:$,submitLabel:Ue,...b?{notice:b}:{},onSubmit:Ke,children:[d(a.Header,{}),le(a.Body,{children:[d(a.RecipientField,{}),d(a.AmountField,{}),d(a.ReceiveSelectors,{}),d(a.BreakdownCard,{})]}),d(a.Footer,{})]})}export{ue as WithdrawForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e,t){if(!t.isRecipientFilled)return e.enterRecipientAddress;if(!t.isRecipientValid)return e.enterValidRecipientAddress;if(!t.isAmountValid)return e.enterAmount;if(t.exceedsBalance)return e.insufficientBalance;if(t.quoteRegenerating)return e.regeneratingQuote;if(t.quoteEstimating)return e.estimatingQuote}export{e as resolveSubmitLabel};
|
|
1
|
+
function e(e,t){if(!t.isRecipientFilled)return e.enterRecipientAddress;if(!t.isRecipientValid)return e.enterValidRecipientAddress;if(!t.isAmountValid)return e.enterAmount;if(t.exceedsBalance)return e.insufficientBalance;if(t.belowMinimum&&e.belowMinimumAmount)return e.belowMinimumAmount;if(t.aboveCap&&e.aboveCapAmount)return e.aboveCapAmount;if(t.quoteRegenerating)return e.regeneratingQuote;if(t.quoteEstimating)return e.estimatingQuote}export{e as resolveSubmitLabel};
|
package/dist/i18n/locales/ar.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=JSON.parse(`{"--OGth":["نجح الإيداع"],"-nuEh_":["الوقت المُقدَّر"],"-tu7Q8":["المزيد عن ",["0"]],"02NghK":["Close this dialog and try again in a moment. If the problem persists, double-check the gateway key on your integration."],"0eg2g7":["جاري تقدير الغاز…"],"0lHlRj":["قيد النقل"],"2Eoi_a":["عرض التفاصيل"],"3dqPLT":["تحويل العملة الرقمية"],"3eKjkO":["الحد الأدنى للإيداع ",["formattedMin"]],"3kg1gB":["اكتمل الإيداع"],"3yd3IL":["The deposit driver failed to load gateway configuration."],"5AApJw":["اتصل بمحفظة للمتابعة"],"5joj8M":["تفاصيل المعاملة"],"60ahSE":["معاملة السحب"],"69Gavs":["Technical details"],"6D8qH6":["أرسل العملة المختارة على الشبكة المختارة إلى هذا العنوان. تظهر الأموال في حسابك بمجرد تأكيد الشبكة للتحويل."],"6RDwJM":["العملات"],"7Bj3x9":["فشل"],"7evBec":["وقت المعالجة: ",["resolvedProcessingTime"]],"88cUW-":["تستلم"],"9JHY2T":["تمت إضافة أموال إيداعك إلى حسابك."],"9XIJb8":["T…"],"9cCjMJ":["إيداع الحد الأقصى من الرصيد"],"< 1 min":["< دقيقة"],"AO44G_":["عرض الإيصال"],"AOPSKq":["إيداع ",["0"]],"AWtGgd":["احصل على المساعدة"],"AeXO77":["حساب"],"AeZIvT":["ستستلم"],"AikETk":["الحد الأدنى ",["minDeposit"]],"BhQhbU":["استخدم عنوان المستلم المقترح"],"CK1KXz":["الأقصى"],"Ck1xL4":["ترسل"],"D79cZK":["فوري"],"DPfwMq":["تم"],"Dd7jP5":["تواجه مشكلات؟"],"DoS2vD":["إخفاء التفاصيل التقنية"],"ELhVSL":["Failed to submit deposit."],"Ej5HL9":["Signature declined. Please try again."],"Enslfm":["الوجهة"],"G-SK3q":["واجهت الواجهة خطأً غير متوقع وتعذَّر إكمال العرض. حاول مرة أخرى، أو أغلق هذا الحوار وأعد المحاولة من التطبيق."],"GX8GKD":["الأصول"],"GZPxmc":["Enter Valid Recipient Address"],"GcuGHR":["تمت الإضافة إلى ",["captionSuffix"]],"GwkmPx":["تبديل المبلغ المعروض"],"IDt4jm":[["0","plural",{"one":["#"," second"],"other":["#"," seconds"]}]," left on quote"],"IRogzB":["تمت إضافة أموال إيداعك إلى ",["brand"],"."],"KDw4GX":["حاول مرة أخرى"],"KGoAE6":["تلقائي · ",["value"]],"KTNWsg":["فشل السحب"],"KuqCAK":["~ 2 دقيقة"],"LEbOpR":["مزيد من التفاصيل"],"Ly6geA":["جاري إعادة احتساب عرض السعر…"],"MZ_nQf":["عنوان المستلم"],"N2DUxS":["Insufficient Balance"],"OLF0i7":["Couldn't load deposit options"],"Offl0a":["ستُضاف أموال إيداعك إلى حسابك."],"Oi8TiZ":["عرض التقدم"],"OsyKSt":["سحب"],"P9fBwv":["Stack"],"PiH3UR":["تم النسخ!"],"Q12Rrs":["معاملة الإيداع"],"QU2cIs":["لديك أسئلة؟"],"Rxjdjn":["لم يكتمل الإيداع"],"SOVBoe":["نسخ عنوان الإيداع"],"SZRUQ4":["أقصى انزلاق سعري"],"Sjplg3":["عرض في المستكشف"],"SlfejT":["Error"],"TG4WOd":["ستُضاف أموال إيداعك إلى ",["brand"],"."],"TT0aVH":["تم إرسال الطلب"],"Uevt3L":["جاري تقدير العرض"],"UqHbdz":["إغلاق إشعار الإيداع قيد التنفيذ"],"V1fa9u":["عرض المزيد"],"VAZUpd":["فشل الطلب"],"WkRH60":["الحد الأدنى ",["0"]],"Wqz0SO":["رصيد منخفض"],"Z1WbO6":["الأموال آمنة على شبكة المصدر — تواصل مع الدعم للاسترجاع."],"ZqugiS":["الرصيد: ",["0"]," ",["1"]],"_girqu":["نجح السحب"],"_kXBrK":["إجمالي الوقت"],"a2WllD":["العملة المستلمة"],"aiEUrg":["إظهار التفاصيل التقنية"],"bOZXx5":["تحديث الطلب"],"bZnukT":["تكلفة الشبكة"],"c6Bl9M":["Toggle technical details"],"cGYrpE":["تطبَّق الشروط"],"cHPbBJ":["تعذَّر على الجسر تمويل معاملة الوجهة (نفد رصيد الغاز)."],"cxR5Qy":["معاملة التسوية"],"e3xU5E":["تم استلام الإيداع"],"fKSGnu":["الحد الأدنى للمبلغ المطلوب على هذه الشبكة لتغطية رسوم الشبكة والتوجيه."],"fWsBTs":["حدث خطأ. حاول مرة أخرى."],"flMR3h":["تم سحب أموالك بنجاح."],"g2UNkE":["مشغل بواسطة"],"gfh8CC":["الشبكات"],"hKMHs1":["الفرق بين الناتج المتوقع للمسار وسعر السوق الأوسط الأساسي."],"he3ygx":["نسخ"],"hehnjM":["المبلغ"],"i-4Fbp":["فشل الإيداع"],"i-EgW-":["التكلفة التقديرية لبث هذه المعاملة على سلسلة الوجهة."],"iH8pgl":["رجوع"],"junZX6":["تم استلام الإيداع وجاري المعالجة…"],"kH6wUX":["تأثير السعر"],"kR8ayx":["بالنقر على تأكيد الإيداع، فإنك توافق على <0>الشروط</0>."],"kUFhUv":["Withdrawal failed."],"kj3M8S":["إيداع"],"kjrq_8":["مزيد من المعلومات"],"lOEm_1":["تم تنفيذ الطلب"],"ldK3jJ":["Failed to submit withdrawal."],"lxjao1":["مسار السيولة المختار المستخدم لتسوية هذا السحب."],"mgLWEL":["تراجعت معاملة الوجهة على السلسلة."],"mvYQx_":["تم الاكتشاف"],"njn4bC":["أكِّد المعاملة في محفظتك"],"nr03QI":["أدخل عنوان المستلم"],"nwtY4N":["حدث خطأ"],"oBNGNc":["The route's expected output drifted while your transaction was pending."],"oFmN8a":["إيداع ",["symbol"]],"oW1G8i":["تم إيداع أموالك بنجاح."],"ob8R_m":["حاول مرة أخرى أو تواصل معنا إذا استمرت المشكلة."],"ogD_nm":["إيداع إلى ",["0"]],"olEUh2":["ناجح"],"pCzTTC":["عنوان الإيداع الخاص بك"],"q32Nt8":["اكتمل السحب"],"qQ5VJt":["We can't reach the gateway right now"],"qj0vvX":["تأكيد الإيداع"],"qtoOYG":["بدون حد"],"rT8e1f":["المسار"],"rZdp61":["معاملة الإكمال"],"sSiLKx":["شبكة الاستلام"],"sb9Y58":["محفظة"],"sbwbC0":["طريقة الدفع"],"uPo3PQ":["عرض أقل"],"vrnnn9":["جاري المعالجة"],"w-2VR9":["جاري السحب…"],"wdxz7K":["المصدر"],"xDAtGP":["Message"],"xGVfLh":["متابعة"],"yH9V_J":["أدخل المبلغ"],"yrvWai":["معاملة المصدر"],"yxnt3y":["حالة التنفيذ"],"yy2rkt":["0x…"],"yz7wBu":["إغلاق"],"zYD5xm":["جاري الإضافة"],"zbtijb":["إيداع ",["0"]," إلى ",["1"]],"znqB4T":["رصيد غير كافٍ"],"{hours} hr":[["hours"]," ساعة"],"{minutes} min":[["minutes"]," دقيقة"],"{n}h":[["n"],"س"],"{n}m":[["n"],"د"],"{n}s":[["n"],"ث"]}`);export{e as messages};
|
|
1
|
+
const e=JSON.parse(`{"--OGth":["نجح الإيداع"],"-I_tc5":["Max ",["formattedCap"]],"-nuEh_":["الوقت المُقدَّر"],"-tu7Q8":["المزيد عن ",["0"]],"02NghK":["Close this dialog and try again in a moment. If the problem persists, double-check the gateway key on your integration."],"0eg2g7":["جاري تقدير الغاز…"],"0lHlRj":["قيد النقل"],"2Eoi_a":["عرض التفاصيل"],"3dqPLT":["تحويل العملة الرقمية"],"3eKjkO":["الحد الأدنى للإيداع ",["formattedMin"]],"3kg1gB":["اكتمل الإيداع"],"3yd3IL":["The deposit driver failed to load gateway configuration."],"5AApJw":["اتصل بمحفظة للمتابعة"],"5joj8M":["تفاصيل المعاملة"],"60ahSE":["معاملة السحب"],"69Gavs":["Technical details"],"6D8qH6":["أرسل العملة المختارة على الشبكة المختارة إلى هذا العنوان. تظهر الأموال في حسابك بمجرد تأكيد الشبكة للتحويل."],"6RDwJM":["العملات"],"7Bj3x9":["فشل"],"7evBec":["وقت المعالجة: ",["resolvedProcessingTime"]],"88cUW-":["تستلم"],"9JHY2T":["تمت إضافة أموال إيداعك إلى حسابك."],"9XIJb8":["T…"],"9cCjMJ":["إيداع الحد الأقصى من الرصيد"],"< 1 min":["< دقيقة"],"AHyker":["Max ",["0"]],"AO44G_":["عرض الإيصال"],"AOPSKq":["إيداع ",["0"]],"AWtGgd":["احصل على المساعدة"],"AeXO77":["حساب"],"AeZIvT":["ستستلم"],"AikETk":["الحد الأدنى ",["minDeposit"]],"BhQhbU":["استخدم عنوان المستلم المقترح"],"CK1KXz":["الأقصى"],"Ck1xL4":["ترسل"],"D79cZK":["فوري"],"DPfwMq":["تم"],"Dd7jP5":["تواجه مشكلات؟"],"DoS2vD":["إخفاء التفاصيل التقنية"],"ELhVSL":["Failed to submit deposit."],"Ej5HL9":["Signature declined. Please try again."],"Enslfm":["الوجهة"],"G-SK3q":["واجهت الواجهة خطأً غير متوقع وتعذَّر إكمال العرض. حاول مرة أخرى، أو أغلق هذا الحوار وأعد المحاولة من التطبيق."],"GX8GKD":["الأصول"],"GZPxmc":["Enter Valid Recipient Address"],"GcuGHR":["تمت الإضافة إلى ",["captionSuffix"]],"GwkmPx":["تبديل المبلغ المعروض"],"IDt4jm":[["0","plural",{"one":["#"," second"],"other":["#"," seconds"]}]," left on quote"],"IRogzB":["تمت إضافة أموال إيداعك إلى ",["brand"],"."],"KDw4GX":["حاول مرة أخرى"],"KGoAE6":["تلقائي · ",["value"]],"KTNWsg":["فشل السحب"],"KuqCAK":["~ 2 دقيقة"],"LEbOpR":["مزيد من التفاصيل"],"Ly6geA":["جاري إعادة احتساب عرض السعر…"],"MZ_nQf":["عنوان المستلم"],"N2DUxS":["Insufficient Balance"],"OLF0i7":["Couldn't load deposit options"],"Offl0a":["ستُضاف أموال إيداعك إلى حسابك."],"Oi8TiZ":["عرض التقدم"],"OsyKSt":["سحب"],"P9fBwv":["Stack"],"PiH3UR":["تم النسخ!"],"Q12Rrs":["معاملة الإيداع"],"QU2cIs":["لديك أسئلة؟"],"Rxjdjn":["لم يكتمل الإيداع"],"SOVBoe":["نسخ عنوان الإيداع"],"SZRUQ4":["أقصى انزلاق سعري"],"Sjplg3":["عرض في المستكشف"],"SlfejT":["Error"],"TG4WOd":["ستُضاف أموال إيداعك إلى ",["brand"],"."],"TT0aVH":["تم إرسال الطلب"],"Uevt3L":["جاري تقدير العرض"],"UqHbdz":["إغلاق إشعار الإيداع قيد التنفيذ"],"V1fa9u":["عرض المزيد"],"VAZUpd":["فشل الطلب"],"WkRH60":["الحد الأدنى ",["0"]],"Wqz0SO":["رصيد منخفض"],"Z1WbO6":["الأموال آمنة على شبكة المصدر — تواصل مع الدعم للاسترجاع."],"ZqugiS":["الرصيد: ",["0"]," ",["1"]],"_girqu":["نجح السحب"],"_kXBrK":["إجمالي الوقت"],"a2WllD":["العملة المستلمة"],"aiEUrg":["إظهار التفاصيل التقنية"],"bOZXx5":["تحديث الطلب"],"bZnukT":["تكلفة الشبكة"],"c6Bl9M":["Toggle technical details"],"cGYrpE":["تطبَّق الشروط"],"cHPbBJ":["تعذَّر على الجسر تمويل معاملة الوجهة (نفد رصيد الغاز)."],"cxR5Qy":["معاملة التسوية"],"e3xU5E":["تم استلام الإيداع"],"fKSGnu":["الحد الأدنى للمبلغ المطلوب على هذه الشبكة لتغطية رسوم الشبكة والتوجيه."],"fWsBTs":["حدث خطأ. حاول مرة أخرى."],"flMR3h":["تم سحب أموالك بنجاح."],"g2UNkE":["مشغل بواسطة"],"gfh8CC":["الشبكات"],"hKMHs1":["الفرق بين الناتج المتوقع للمسار وسعر السوق الأوسط الأساسي."],"he3ygx":["نسخ"],"hehnjM":["المبلغ"],"i-4Fbp":["فشل الإيداع"],"i-EgW-":["التكلفة التقديرية لبث هذه المعاملة على سلسلة الوجهة."],"iH8pgl":["رجوع"],"junZX6":["تم استلام الإيداع وجاري المعالجة…"],"kH6wUX":["تأثير السعر"],"kR8ayx":["بالنقر على تأكيد الإيداع، فإنك توافق على <0>الشروط</0>."],"kUFhUv":["Withdrawal failed."],"kj3M8S":["إيداع"],"kjrq_8":["مزيد من المعلومات"],"lOEm_1":["تم تنفيذ الطلب"],"ldK3jJ":["Failed to submit withdrawal."],"lxjao1":["مسار السيولة المختار المستخدم لتسوية هذا السحب."],"mgLWEL":["تراجعت معاملة الوجهة على السلسلة."],"mvYQx_":["تم الاكتشاف"],"njn4bC":["أكِّد المعاملة في محفظتك"],"nr03QI":["أدخل عنوان المستلم"],"nwtY4N":["حدث خطأ"],"oBNGNc":["The route's expected output drifted while your transaction was pending."],"oFmN8a":["إيداع ",["symbol"]],"oW1G8i":["تم إيداع أموالك بنجاح."],"ob8R_m":["حاول مرة أخرى أو تواصل معنا إذا استمرت المشكلة."],"ogD_nm":["إيداع إلى ",["0"]],"olEUh2":["ناجح"],"pCzTTC":["عنوان الإيداع الخاص بك"],"q32Nt8":["اكتمل السحب"],"qQ5VJt":["We can't reach the gateway right now"],"qj0vvX":["تأكيد الإيداع"],"qtoOYG":["بدون حد"],"rT8e1f":["المسار"],"rZdp61":["معاملة الإكمال"],"sSiLKx":["شبكة الاستلام"],"sb9Y58":["محفظة"],"sbwbC0":["طريقة الدفع"],"uPo3PQ":["عرض أقل"],"vrnnn9":["جاري المعالجة"],"w-2VR9":["جاري السحب…"],"wdxz7K":["المصدر"],"xDAtGP":["Message"],"xGVfLh":["متابعة"],"yH9V_J":["أدخل المبلغ"],"yrvWai":["معاملة المصدر"],"yxnt3y":["حالة التنفيذ"],"yy2rkt":["0x…"],"yz7wBu":["إغلاق"],"zYD5xm":["جاري الإضافة"],"zbtijb":["إيداع ",["0"]," إلى ",["1"]],"znqB4T":["رصيد غير كافٍ"],"{hours} hr":[["hours"]," ساعة"],"{minutes} min":[["minutes"]," دقيقة"],"{n}h":[["n"],"س"],"{n}m":[["n"],"د"],"{n}s":[["n"],"ث"]}`);export{e as messages};
|
package/dist/i18n/locales/es.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=JSON.parse(`{"--OGth":["Depósito exitoso"],"-nuEh_":["Tiempo estimado"],"-tu7Q8":["Más sobre ",["0"]],"02NghK":["Close this dialog and try again in a moment. If the problem persists, double-check the gateway key on your integration."],"0eg2g7":["Estimando gas…"],"0lHlRj":["En tránsito"],"2Eoi_a":["Ver detalles"],"3dqPLT":["Transferir cripto"],"3eKjkO":["Depósito mínimo de ",["formattedMin"]],"3kg1gB":["Depósito completado"],"3yd3IL":["The deposit driver failed to load gateway configuration."],"5AApJw":["Conecta una billetera para continuar"],"5joj8M":["Desglose de la transacción"],"60ahSE":["Tx del retiro"],"69Gavs":["Technical details"],"6D8qH6":["Envía el token seleccionado en la red elegida a esta dirección. Los fondos aparecerán en tu cuenta cuando la red confirme la transferencia."],"6RDwJM":["Tokens"],"7Bj3x9":["Fallido"],"7evBec":["Tiempo de procesamiento: ",["resolvedProcessingTime"]],"88cUW-":["Recibes"],"9JHY2T":["Tu depósito se acreditó en tu cuenta."],"9XIJb8":["T…"],"9cCjMJ":["Depositar saldo máximo"],"< 1 min":["< 1 min"],"AO44G_":["Ver recibo"],"AOPSKq":["Depositar ",["0"]],"AWtGgd":["Obtener ayuda"],"AeXO77":["Cuenta"],"AeZIvT":["Recibirás"],"AikETk":["Mín ",["minDeposit"]],"BhQhbU":["Usar la dirección sugerida del destinatario"],"CK1KXz":["Máx"],"Ck1xL4":["Envías"],"D79cZK":["Instantáneo"],"DPfwMq":["Listo"],"Dd7jP5":["¿Tienes problemas?"],"DoS2vD":["Ocultar detalles técnicos"],"ELhVSL":["Failed to submit deposit."],"Ej5HL9":["Signature declined. Please try again."],"Enslfm":["Destino"],"G-SK3q":["El kit encontró un error inesperado y no pudo terminar de renderizar. Vuelve a intentarlo, o cierra este diálogo y reinténtalo desde la aplicación."],"GX8GKD":["Activos"],"GZPxmc":["Enter Valid Recipient Address"],"GcuGHR":["Acreditado a ",["captionSuffix"]],"GwkmPx":["Cambiar el importe mostrado"],"IDt4jm":[["0","plural",{"one":["#"," second"],"other":["#"," seconds"]}]," left on quote"],"IRogzB":["Tu depósito se acreditó a ",["brand"],"."],"KDw4GX":["Reintentar"],"KGoAE6":["Auto · ",["value"]],"KTNWsg":["El retiro falló"],"KuqCAK":["~ 2 min"],"LEbOpR":["Más detalles"],"Ly6geA":["Regenerando cotización…"],"MZ_nQf":["Dirección del destinatario"],"N2DUxS":["Insufficient Balance"],"OLF0i7":["Couldn't load deposit options"],"Offl0a":["Tu depósito se acreditará en tu cuenta."],"Oi8TiZ":["Ver progreso"],"OsyKSt":["Retirar"],"P9fBwv":["Stack"],"PiH3UR":["¡Copiado!"],"Q12Rrs":["Tx depósito"],"QU2cIs":["¿Tienes preguntas?"],"Rxjdjn":["El depósito no se completó"],"SOVBoe":["Copiar dirección de depósito"],"SZRUQ4":["Deslizamiento máximo"],"Sjplg3":["Ver en el explorador"],"SlfejT":["Error"],"TG4WOd":["Tu depósito se acreditará a ",["brand"],"."],"TT0aVH":["Orden enviada"],"Uevt3L":["Estimando cotización"],"UqHbdz":["Descartar aviso de depósito pendiente"],"V1fa9u":["Ver más"],"VAZUpd":["Orden fallida"],"WkRH60":["Mín ",["0"]],"Wqz0SO":["Saldo bajo"],"Z1WbO6":["Los fondos están seguros en la red de origen — contacta a soporte para recuperarlos."],"ZqugiS":["Saldo: ",["0"]," ",["1"]],"_girqu":["Retiro exitoso"],"_kXBrK":["Tiempo total"],"a2WllD":["Token a recibir"],"aiEUrg":["Mostrar detalles técnicos"],"bOZXx5":["Actualizar orden"],"bZnukT":["Costo de red"],"c6Bl9M":["Toggle technical details"],"cGYrpE":["Aplican términos"],"cHPbBJ":["El puente no pudo financiar la transacción de destino (presupuesto de gas agotado)."],"cxR5Qy":["Tx liquidación"],"e3xU5E":["Depósito recibido"],"fKSGnu":["Cantidad mínima requerida para que esta red cubra las tarifas y el enrutamiento."],"fWsBTs":["Algo salió mal. Vuelve a intentarlo."],"flMR3h":["Tus fondos fueron retirados con éxito."],"g2UNkE":["Con tecnología de"],"gfh8CC":["Redes"],"hKMHs1":["Diferencia entre el resultado esperado de la ruta y el precio medio de mercado subyacente."],"he3ygx":["Copiar"],"hehnjM":["Monto"],"i-4Fbp":["Depósito fallido"],"i-EgW-":["El costo estimado para emitir esta transacción en la red de destino."],"iH8pgl":["Atrás"],"junZX6":["Depósito recibido y procesando…"],"kH6wUX":["Impacto en precio"],"kR8ayx":["Al hacer clic en Confirmar depósito, aceptas nuestros <0>términos</0>."],"kUFhUv":["Withdrawal failed."],"kj3M8S":["Depositar"],"kjrq_8":["Más información"],"lOEm_1":["Orden completada"],"ldK3jJ":["Failed to submit withdrawal."],"lxjao1":["La ruta de liquidez seleccionada para liquidar este retiro."],"mgLWEL":["La transacción del tramo de destino se revirtió en cadena."],"mvYQx_":["Detectado"],"njn4bC":["Confirma la transacción en tu billetera"],"nr03QI":["Ingresa la dirección del destinatario"],"nwtY4N":["Algo salió mal"],"oBNGNc":["The route's expected output drifted while your transaction was pending."],"oFmN8a":["Depositar ",["symbol"]],"oW1G8i":["Tus fondos se depositaron correctamente."],"ob8R_m":["Inténtalo nuevamente o contáctanos si el problema persiste."],"ogD_nm":["Depositar a ",["0"]],"olEUh2":["Exitoso"],"pCzTTC":["Tu dirección de depósito"],"q32Nt8":["Retiro completado"],"qQ5VJt":["We can't reach the gateway right now"],"qj0vvX":["Confirmar depósito"],"qtoOYG":["Sin límite"],"rT8e1f":["Ruta"],"rZdp61":["Tx finalización"],"sSiLKx":["Red a recibir"],"sb9Y58":["Billetera"],"sbwbC0":["Método de pago"],"uPo3PQ":["Ver menos"],"vrnnn9":["Procesando"],"w-2VR9":["Retiro en curso…"],"wdxz7K":["Origen"],"xDAtGP":["Message"],"xGVfLh":["Continuar"],"yH9V_J":["Ingresa el monto"],"yrvWai":["Tx origen"],"yxnt3y":["Estado de ejecución"],"yy2rkt":["0x…"],"yz7wBu":["Cerrar"],"zYD5xm":["Acreditando"],"zbtijb":["Depositar ",["0"]," a ",["1"]],"znqB4T":["Saldo insuficiente"],"{hours} hr":[["hours"]," h"],"{minutes} min":[["minutes"]," min"],"{n}h":[["n"],"h"],"{n}m":[["n"],"m"],"{n}s":[["n"],"s"]}`);export{e as messages};
|
|
1
|
+
const e=JSON.parse(`{"--OGth":["Depósito exitoso"],"-I_tc5":["Max ",["formattedCap"]],"-nuEh_":["Tiempo estimado"],"-tu7Q8":["Más sobre ",["0"]],"02NghK":["Close this dialog and try again in a moment. If the problem persists, double-check the gateway key on your integration."],"0eg2g7":["Estimando gas…"],"0lHlRj":["En tránsito"],"2Eoi_a":["Ver detalles"],"3dqPLT":["Transferir cripto"],"3eKjkO":["Depósito mínimo de ",["formattedMin"]],"3kg1gB":["Depósito completado"],"3yd3IL":["The deposit driver failed to load gateway configuration."],"5AApJw":["Conecta una billetera para continuar"],"5joj8M":["Desglose de la transacción"],"60ahSE":["Tx del retiro"],"69Gavs":["Technical details"],"6D8qH6":["Envía el token seleccionado en la red elegida a esta dirección. Los fondos aparecerán en tu cuenta cuando la red confirme la transferencia."],"6RDwJM":["Tokens"],"7Bj3x9":["Fallido"],"7evBec":["Tiempo de procesamiento: ",["resolvedProcessingTime"]],"88cUW-":["Recibes"],"9JHY2T":["Tu depósito se acreditó en tu cuenta."],"9XIJb8":["T…"],"9cCjMJ":["Depositar saldo máximo"],"< 1 min":["< 1 min"],"AHyker":["Max ",["0"]],"AO44G_":["Ver recibo"],"AOPSKq":["Depositar ",["0"]],"AWtGgd":["Obtener ayuda"],"AeXO77":["Cuenta"],"AeZIvT":["Recibirás"],"AikETk":["Mín ",["minDeposit"]],"BhQhbU":["Usar la dirección sugerida del destinatario"],"CK1KXz":["Máx"],"Ck1xL4":["Envías"],"D79cZK":["Instantáneo"],"DPfwMq":["Listo"],"Dd7jP5":["¿Tienes problemas?"],"DoS2vD":["Ocultar detalles técnicos"],"ELhVSL":["Failed to submit deposit."],"Ej5HL9":["Signature declined. Please try again."],"Enslfm":["Destino"],"G-SK3q":["El kit encontró un error inesperado y no pudo terminar de renderizar. Vuelve a intentarlo, o cierra este diálogo y reinténtalo desde la aplicación."],"GX8GKD":["Activos"],"GZPxmc":["Enter Valid Recipient Address"],"GcuGHR":["Acreditado a ",["captionSuffix"]],"GwkmPx":["Cambiar el importe mostrado"],"IDt4jm":[["0","plural",{"one":["#"," second"],"other":["#"," seconds"]}]," left on quote"],"IRogzB":["Tu depósito se acreditó a ",["brand"],"."],"KDw4GX":["Reintentar"],"KGoAE6":["Auto · ",["value"]],"KTNWsg":["El retiro falló"],"KuqCAK":["~ 2 min"],"LEbOpR":["Más detalles"],"Ly6geA":["Regenerando cotización…"],"MZ_nQf":["Dirección del destinatario"],"N2DUxS":["Insufficient Balance"],"OLF0i7":["Couldn't load deposit options"],"Offl0a":["Tu depósito se acreditará en tu cuenta."],"Oi8TiZ":["Ver progreso"],"OsyKSt":["Retirar"],"P9fBwv":["Stack"],"PiH3UR":["¡Copiado!"],"Q12Rrs":["Tx depósito"],"QU2cIs":["¿Tienes preguntas?"],"Rxjdjn":["El depósito no se completó"],"SOVBoe":["Copiar dirección de depósito"],"SZRUQ4":["Deslizamiento máximo"],"Sjplg3":["Ver en el explorador"],"SlfejT":["Error"],"TG4WOd":["Tu depósito se acreditará a ",["brand"],"."],"TT0aVH":["Orden enviada"],"Uevt3L":["Estimando cotización"],"UqHbdz":["Descartar aviso de depósito pendiente"],"V1fa9u":["Ver más"],"VAZUpd":["Orden fallida"],"WkRH60":["Mín ",["0"]],"Wqz0SO":["Saldo bajo"],"Z1WbO6":["Los fondos están seguros en la red de origen — contacta a soporte para recuperarlos."],"ZqugiS":["Saldo: ",["0"]," ",["1"]],"_girqu":["Retiro exitoso"],"_kXBrK":["Tiempo total"],"a2WllD":["Token a recibir"],"aiEUrg":["Mostrar detalles técnicos"],"bOZXx5":["Actualizar orden"],"bZnukT":["Costo de red"],"c6Bl9M":["Toggle technical details"],"cGYrpE":["Aplican términos"],"cHPbBJ":["El puente no pudo financiar la transacción de destino (presupuesto de gas agotado)."],"cxR5Qy":["Tx liquidación"],"e3xU5E":["Depósito recibido"],"fKSGnu":["Cantidad mínima requerida para que esta red cubra las tarifas y el enrutamiento."],"fWsBTs":["Algo salió mal. Vuelve a intentarlo."],"flMR3h":["Tus fondos fueron retirados con éxito."],"g2UNkE":["Con tecnología de"],"gfh8CC":["Redes"],"hKMHs1":["Diferencia entre el resultado esperado de la ruta y el precio medio de mercado subyacente."],"he3ygx":["Copiar"],"hehnjM":["Monto"],"i-4Fbp":["Depósito fallido"],"i-EgW-":["El costo estimado para emitir esta transacción en la red de destino."],"iH8pgl":["Atrás"],"junZX6":["Depósito recibido y procesando…"],"kH6wUX":["Impacto en precio"],"kR8ayx":["Al hacer clic en Confirmar depósito, aceptas nuestros <0>términos</0>."],"kUFhUv":["Withdrawal failed."],"kj3M8S":["Depositar"],"kjrq_8":["Más información"],"lOEm_1":["Orden completada"],"ldK3jJ":["Failed to submit withdrawal."],"lxjao1":["La ruta de liquidez seleccionada para liquidar este retiro."],"mgLWEL":["La transacción del tramo de destino se revirtió en cadena."],"mvYQx_":["Detectado"],"njn4bC":["Confirma la transacción en tu billetera"],"nr03QI":["Ingresa la dirección del destinatario"],"nwtY4N":["Algo salió mal"],"oBNGNc":["The route's expected output drifted while your transaction was pending."],"oFmN8a":["Depositar ",["symbol"]],"oW1G8i":["Tus fondos se depositaron correctamente."],"ob8R_m":["Inténtalo nuevamente o contáctanos si el problema persiste."],"ogD_nm":["Depositar a ",["0"]],"olEUh2":["Exitoso"],"pCzTTC":["Tu dirección de depósito"],"q32Nt8":["Retiro completado"],"qQ5VJt":["We can't reach the gateway right now"],"qj0vvX":["Confirmar depósito"],"qtoOYG":["Sin límite"],"rT8e1f":["Ruta"],"rZdp61":["Tx finalización"],"sSiLKx":["Red a recibir"],"sb9Y58":["Billetera"],"sbwbC0":["Método de pago"],"uPo3PQ":["Ver menos"],"vrnnn9":["Procesando"],"w-2VR9":["Retiro en curso…"],"wdxz7K":["Origen"],"xDAtGP":["Message"],"xGVfLh":["Continuar"],"yH9V_J":["Ingresa el monto"],"yrvWai":["Tx origen"],"yxnt3y":["Estado de ejecución"],"yy2rkt":["0x…"],"yz7wBu":["Cerrar"],"zYD5xm":["Acreditando"],"zbtijb":["Depositar ",["0"]," a ",["1"]],"znqB4T":["Saldo insuficiente"],"{hours} hr":[["hours"]," h"],"{minutes} min":[["minutes"]," min"],"{n}h":[["n"],"h"],"{n}m":[["n"],"m"],"{n}s":[["n"],"s"]}`);export{e as messages};
|
|
@@ -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." | "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." | "Powered by" | "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" | "T…" | "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";
|
|
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." | "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" | "Max {0}" | "Max {formattedCap}" | "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." | "Powered by" | "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" | "T…" | "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/package.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=`0.1.0-alpha.
|
|
1
|
+
var e=`0.1.0-alpha.31`;export{e as version};
|
|
@@ -64,10 +64,20 @@ interface StridgeDepositFlowConfig {
|
|
|
64
64
|
*/
|
|
65
65
|
owner?: StridgeFlowOwner;
|
|
66
66
|
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
67
|
+
* Lower USD bound on the deposit amount. Drives the asset-picker's "Low Balance" pill,
|
|
68
|
+
* prefills the amount-entry hero, and gates the confirm CTA — typing below the floor flips
|
|
69
|
+
* the footer to "Update order" and snaps the amount up on click. The kit ships no default:
|
|
70
|
+
* omit to leave the deposit without a host-configured floor (the picker still surfaces any
|
|
71
|
+
* per-chain `min_deposit_usd` the gateway publishes).
|
|
69
72
|
*/
|
|
70
|
-
|
|
73
|
+
minAmountUsd?: number;
|
|
74
|
+
/**
|
|
75
|
+
* Upper USD bound on the deposit amount. When set, the effective ceiling is
|
|
76
|
+
* `min(walletBalanceUsd, maxAmountUsd)`. Typing above it surfaces an inline notice and the
|
|
77
|
+
* footer CTA snaps the amount down to the cap on click. Omit to let the wallet balance be
|
|
78
|
+
* the only ceiling.
|
|
79
|
+
*/
|
|
80
|
+
maxAmountUsd?: number;
|
|
71
81
|
/**
|
|
72
82
|
* Metadata persisted on the UDA at `gateway/start` time. Echoed back on `gateway/{owner}`
|
|
73
83
|
* and webhook payloads. Treat as untrusted display data.
|
|
@@ -121,6 +131,18 @@ interface StridgeWithdrawFlowConfig {
|
|
|
121
131
|
* party broadcasting the source-chain tx to the UDA.
|
|
122
132
|
*/
|
|
123
133
|
owner: StridgeFlowOwner;
|
|
134
|
+
/**
|
|
135
|
+
* Lower USD bound on the withdraw amount. When set, the form blocks submit with a localized
|
|
136
|
+
* "Min $X" CTA while the typed amount sits below the floor. Omit to leave the form without a
|
|
137
|
+
* lower bound (only the wallet balance / non-zero gate apply).
|
|
138
|
+
*/
|
|
139
|
+
minAmountUsd?: number;
|
|
140
|
+
/**
|
|
141
|
+
* Upper USD bound on the withdraw amount. When set, the form blocks submit with a localized
|
|
142
|
+
* "Max $X" CTA while the typed amount sits above the cap. Omit to let the brand-currency
|
|
143
|
+
* balance be the only ceiling.
|
|
144
|
+
*/
|
|
145
|
+
maxAmountUsd?: number;
|
|
124
146
|
/**
|
|
125
147
|
* Metadata persisted on every UDA the withdraw flow provisions. Merged under the kit-set
|
|
126
148
|
* `kit_flow` / `kit_version` / `source` keys (kit keys win).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{createKitI18n as e}from"../shared/i18n/createKitI18n.js";import"../i18n/index.js";import{StridgeContext as t}from"./StridgeContext.js";import{createStridgeDepositDriver as n}from"../drivers/stridge/createStridgeDepositDriver.js";import{createStridgeWithdrawDriver as r}from"../drivers/stridge/createStridgeWithdrawDriver.js";import"../_internal/drivers/stridge/index.js";import{KitProvider as i}from"../KitProvider.js";import{resolveSupport as a}from"../shared/support/resolveSupport.js";import{useIntercomMerchantContext as o}from"../shared/support/useIntercomMerchantContext.js";import{useMerchantContext as s}from"../shared/support/useMerchantContext.js";import"../shared/support/index.js";import{useOptionalWagmi as c}from"./optionalWagmi.js";import{createStubDepositDriver as l,createStubWithdrawDriver as u}from"./stubs.js";import{useMemo as d,useRef as f,useSyncExternalStore as p}from"react";import{jsx as m}from"react/jsx-runtime";function h({gatewayKey:h,environment:g,asset:_,flows:v,appearance:y,i18n:b,storage:x,dev:S,support:C,terms:w,className:T,children:E}){if(!v.deposit&&!v.withdraw)throw Error("<StridgeProvider /> requires at least one of `flows.deposit` or `flows.withdraw`.");if(!_)throw Error("<StridgeProvider /> requires `asset: { networkId, symbol }`.");let{config:D,address:O}=c(),k=d(()=>e(b??{}),[b?.locale,b?.messages]),A=f(k);A.current=k;let j=_.networkId,M=_.symbol,N=v.deposit,P=v.withdraw,F=N?.owner?.address??O??S?.userAddressOverride,I=P?.owner.address,L=d(()=>{if(!(!N||!F))return n({userAddress:F,projectKey:h,destination:{network_id:j,asset_symbol:M,to_address:N.destination.address},wagmiConfig:D,getI18n:()=>A.current,...g?{environment:g}:{},...N.
|
|
1
|
+
"use client";import{createKitI18n as e}from"../shared/i18n/createKitI18n.js";import"../i18n/index.js";import{StridgeContext as t}from"./StridgeContext.js";import{createStridgeDepositDriver as n}from"../drivers/stridge/createStridgeDepositDriver.js";import{createStridgeWithdrawDriver as r}from"../drivers/stridge/createStridgeWithdrawDriver.js";import"../_internal/drivers/stridge/index.js";import{KitProvider as i}from"../KitProvider.js";import{resolveSupport as a}from"../shared/support/resolveSupport.js";import{useIntercomMerchantContext as o}from"../shared/support/useIntercomMerchantContext.js";import{useMerchantContext as s}from"../shared/support/useMerchantContext.js";import"../shared/support/index.js";import{useOptionalWagmi as c}from"./optionalWagmi.js";import{createStubDepositDriver as l,createStubWithdrawDriver as u}from"./stubs.js";import{useMemo as d,useRef as f,useSyncExternalStore as p}from"react";import{jsx as m}from"react/jsx-runtime";function h({gatewayKey:h,environment:g,asset:_,flows:v,appearance:y,i18n:b,storage:x,dev:S,support:C,terms:w,className:T,children:E}){if(!v.deposit&&!v.withdraw)throw Error("<StridgeProvider /> requires at least one of `flows.deposit` or `flows.withdraw`.");if(!_)throw Error("<StridgeProvider /> requires `asset: { networkId, symbol }`.");let{config:D,address:O}=c(),k=d(()=>e(b??{}),[b?.locale,b?.messages]),A=f(k);A.current=k;let j=_.networkId,M=_.symbol,N=v.deposit,P=v.withdraw,F=N?.owner?.address??O??S?.userAddressOverride,I=P?.owner.address,L=d(()=>{if(!(!N||!F))return n({userAddress:F,projectKey:h,destination:{network_id:j,asset_symbol:M,to_address:N.destination.address},wagmiConfig:D,getI18n:()=>A.current,...g?{environment:g}:{},...N.minAmountUsd===void 0?{}:{minAmountUsd:N.minAmountUsd},...N.maxAmountUsd===void 0?{}:{maxAmountUsd:N.maxAmountUsd},...N.metadata?{metadata:N.metadata}:{}})},[N,F,h,g,j,M,D]),R=d(()=>l(),[]),z=N?L??R:void 0,B=d(()=>{if(!(!P||!I))return r({userAddress:I,projectKey:h,currency:{networkId:j,assetSymbol:M},wagmiConfig:D,getI18n:()=>A.current,...g?{environment:g}:{},...P.minAmountUsd===void 0?{}:{minAmountUsd:P.minAmountUsd},...P.maxAmountUsd===void 0?{}:{maxAmountUsd:P.maxAmountUsd},...P.metadata?{metadata:P.metadata}:{}})},[P,I,h,g,j,M,D]),V=d(()=>u(),[]),H=P?B??V:void 0,U=L??B,W=p(e=>U?.subscribe(e)??(()=>{}),()=>{if(L){let e=L.getSnapshot();return e.brand.status===`ready`&&e.target.status===`ready`}return B?B.getSnapshot().receiveOptions.status===`ready`:!1},()=>!1),G=F??I,K=s({gatewayKey:h,environment:g??`production`,assetChain:j,assetSymbol:M,...G?{userAddress:G}:{},...L?{depositDriver:L}:{}});return o(a(C).kind===`stridge`?K:null),m(t,{value:d(()=>({isReady:W,driver:L}),[W,L]),children:m(i,{theme:y?.theme,accent:y?.accent,radius:y?.radius,direction:y?.direction,attribution:y?.attribution,i18n:b,storage:x?.driver,storageNamespace:x?.namespace,className:T,support:C,merchantContext:K,terms:w,...z?{deposit:z}:{},...N?.methods?{depositMethods:N.methods}:{},...H?{withdraw:H}:{},children:E})})}export{h as StridgeProvider};
|