@velora-dex/widget 0.10.0 → 0.10.1
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/components/widget/ReceiverAddress/state/subscriptions.js +1 -1
- package/dist/components/widget/ReceiverAddress/state/subscriptions.js.map +1 -1
- package/dist/events/getters/limit.js +1 -1
- package/dist/events/getters/limit.js.map +1 -1
- package/dist/events/getters/otc.js +1 -1
- package/dist/events/getters/otc.js.map +1 -1
- package/dist/events/getters/swap.js +1 -1
- package/dist/events/getters/swap.js.map +1 -1
- package/dist/events/getters/twap.js +1 -1
- package/dist/events/getters/twap.js.map +1 -1
- package/dist/events/getters/widgetState.js +1 -1
- package/dist/events/getters/widgetState.js.map +1 -1
- package/dist/hooks/batch/useCanBatchTxs.d.ts +0 -1
- package/dist/hooks/batch/useCanBatchTxs.d.ts.map +1 -1
- package/dist/hooks/batch/useCanBatchTxs.js +19 -28
- package/dist/hooks/batch/useCanBatchTxs.js.map +1 -1
- package/dist/hooks/connectors/useIsConnectedSafe.js.map +1 -1
- package/dist/hooks/permit/utils/types.d.ts +1 -1
- package/dist/hooks/permit/utils/types.d.ts.map +1 -1
- package/dist/lib/web3/wagmi/config.d.ts +0 -5
- package/dist/lib/web3/wagmi/config.d.ts.map +1 -1
- package/dist/lib/web3/wagmi/config.js.map +1 -1
- package/dist/lib/web3/wagmi/external.js +1 -1
- package/dist/lib/web3/wagmi/external.js.map +1 -1
- package/dist/lib/web3/wagmi/switchChain.d.ts.map +1 -1
- package/dist/lib/web3/wagmi/switchChain.js +1 -1
- package/dist/lib/web3/wagmi/switchChain.js.map +1 -1
- package/dist/transactions/queries/ensureCallsStatus.d.ts.map +1 -1
- package/dist/transactions/queries/ensureCallsStatus.js +1 -1
- package/dist/transactions/queries/ensureCallsStatus.js.map +1 -1
- package/dist/transactions/queries/ensureTxReceipt.js +1 -1
- package/dist/transactions/queries/ensureTxReceipt.js.map +1 -1
- package/dist/wagmi-register.d.ts +7 -0
- package/dist/wagmi-register.d.ts.map +1 -0
- package/package.json +2 -2
|
@@ -11,7 +11,7 @@ import { constructIsContractAtAddressQueryKey as l, getIsContractAtAddress as u
|
|
|
11
11
|
import { accountAtom as d } from "../../../../lib/web3/wagmi/external.js";
|
|
12
12
|
import { resetOrdersCountAtom as f } from "../../AppHeader/state/showMoreAtom.js";
|
|
13
13
|
import { openDrawerAtom as p } from "../../Drawer/state/useDrawerControls.js";
|
|
14
|
-
import {
|
|
14
|
+
import { watchConnection as m } from "@wagmi/core";
|
|
15
15
|
//#region src/components/widget/ReceiverAddress/state/subscriptions.ts
|
|
16
16
|
function h(t) {
|
|
17
17
|
e.set(n, t), e.set(r, t), e.set(i, t);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptions.js","names":["wagmiConfig","
|
|
1
|
+
{"version":3,"file":"subscriptions.js","names":["wagmiConfig","watchConnection","receiverAddressAtom","queryClient","isSupportedChainId","constructIsContractAtAddressQueryKey","getIsContractAtAddress","jotaiStore","accountAtom","resetOrdersCountAtom","enabledSrcChainsAtom","limitReceiverAddressAtom","openDrawerAtom","screenAtom","twapReceiverAddressAtom","Address","setReceiverAddress","address","set","subscribeToAccountChanges","onChange","account","prevAddress","chainId","connector","enabledSrcChains","get","undefined","includes","state","setState","prev","queryKey","isEOA","ensureQueryData","queryFn"],"sources":["../../../../../src/components/widget/ReceiverAddress/state/subscriptions.ts"],"sourcesContent":["import { wagmiConfig } from \"@/lib/web3/wagmi/config\";\nimport { watchConnection } from \"@wagmi/core\";\nimport { receiverAddressAtom } from \"./receiverAddressAtom\";\n\nimport { queryClient } from \"@/lib/queryClient\";\n\nimport { isSupportedChainId } from \"@/lib/web3/wagmi/utils\";\nimport {\n constructIsContractAtAddressQueryKey,\n getIsContractAtAddress,\n} from \"@/hooks/getCode/query\";\nimport { jotaiStore } from \"@/core/store\";\nimport { accountAtom } from \"@/lib/web3/wagmi/external\";\nimport { resetOrdersCountAtom } from \"../../AppHeader/state/showMoreAtom\";\nimport { enabledSrcChainsAtom } from \"@/core/state/enabledChainsAtom\";\nimport { limitReceiverAddressAtom } from \"@/core/limit/state/receiverAddressAtom\";\nimport { openDrawerAtom } from \"../../Drawer/state/useDrawerControls\";\nimport { screenAtom } from \"@/core/screen/state/screenAtom\";\nimport { twapReceiverAddressAtom } from \"@/core/twap/state/twapReceiverAddressAtom\";\nimport type { Address } from \"viem\";\n\nfunction setReceiverAddress(address: Address | undefined) {\n jotaiStore.set(receiverAddressAtom, address);\n jotaiStore.set(limitReceiverAddressAtom, address);\n jotaiStore.set(twapReceiverAddressAtom, address);\n}\n\nexport function subscribeToAccountChanges() {\n // subscribes to wallet account changes\n // config.subscribe(() => getAccount(config), onChange)\n return watchConnection(wagmiConfig, {\n onChange: async (account, { address: prevAddress }) => {\n const { address, chainId, connector } = account;\n const enabledSrcChains = jotaiStore.get(enabledSrcChainsAtom);\n\n // close any open drawer and screen on account change\n // enforce account specific Widget state\n if (address !== prevAddress) {\n jotaiStore.set(openDrawerAtom, null);\n jotaiStore.set(screenAtom, null);\n }\n\n // internal account atom to trigger atomEffects\n jotaiStore.set(accountAtom, {\n address,\n chainId,\n connector,\n });\n\n // reset the receiver address if the address is not valid or chainId is not supported\n if (\n !address ||\n chainId === undefined ||\n !isSupportedChainId(chainId) ||\n !enabledSrcChains.includes(chainId)\n ) {\n setReceiverAddress(undefined);\n return;\n }\n\n // reset activities pagination\n jotaiStore.set(resetOrdersCountAtom);\n\n if (chainId !== wagmiConfig.state.chainId)\n // wallet chainId takes precedence\n wagmiConfig.setState((prev) => ({ ...prev, chainId }));\n\n const queryKey = constructIsContractAtAddressQueryKey({\n chainId,\n address,\n });\n\n const { isEOA } = await queryClient.ensureQueryData({\n queryKey,\n queryFn: () =>\n getIsContractAtAddress({\n address,\n chainId,\n }),\n });\n\n // save if address is EOA, otherwise reset\n setReceiverAddress(isEOA ? address : undefined);\n },\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;AAqBA,SAASgB,EAAmBC,GAA8B;CAGxDV,AAFAA,EAAWW,IAAIhB,GAAqBe,EAAQ,EAC5CV,EAAWW,IAAIP,GAA0BM,EAAQ,EACjDV,EAAWW,IAAIJ,GAAyBG,EAAQ;;AAGlD,SAAgBE,IAA4B;CAG1C,OAAOlB,EAAgBD,GAAa,EAClCoB,UAAU,OAAOC,GAAS,EAAEJ,SAASK,QAAkB;EACrD,IAAM,EAAEL,YAASM,YAASC,iBAAcH,GAClCI,IAAmBlB,EAAWmB,IAAIhB,EAAqB;EAiB7D,IAbIO,MAAYK,MACdf,EAAWW,IAAIN,GAAgB,KAAK,EACpCL,EAAWW,IAAIL,GAAY,KAAK,GAIlCN,EAAWW,IAAIV,GAAa;GAC1BS;GACAM;GACAC;GACD,CAAC,EAIA,CAACP,KACDM,MAAYI,KAAAA,KACZ,CAACvB,EAAmBmB,EAAQ,IAC5B,CAACE,EAAiBG,SAASL,EAAQ,EACnC;GACAP,EAAmBW,KAAAA,EAAU;GAC7B;;EAMF,AAFApB,EAAWW,IAAIT,EAAqB,EAEhCc,MAAYvB,EAAY6B,MAAMN,WAEhCvB,EAAY8B,UAAUC,OAAU;GAAE,GAAGA;GAAMR;GAAS,EAAE;EAExD,IAAMS,IAAW3B,EAAqC;GACpDkB;GACAN;GACD,CAAC,EAEI,EAAEgB,aAAU,MAAM9B,EAAY+B,gBAAgB;GAClDF;GACAG,eACE7B,EAAuB;IACrBW;IACAM;IACD,CAAA;GACJ,CAAC;EAGFP,EAAmBiB,IAAQhB,IAAUU,KAAAA,EAAU;IAElD,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { limitTokenFromAtom as n, limitTokenToAtom as r } from "../../core/limit
|
|
|
4
4
|
import { limitPayInputAmountAtom as i, limitPriceAmountAtom as a, limitReceiveInputAmountAtom as o } from "../../core/limit/state/limitInputAmountAtom.js";
|
|
5
5
|
import { deadlineAtom as s } from "../../core/limit/state/deadlineAtom.js";
|
|
6
6
|
import { limitReceiverAddressAtom as c } from "../../core/limit/state/receiverAddressAtom.js";
|
|
7
|
-
import {
|
|
7
|
+
import { getConnection as l } from "@wagmi/core";
|
|
8
8
|
//#region src/events/getters/limit.ts
|
|
9
9
|
function u(e) {
|
|
10
10
|
let l = e(n), u = e(r), d = e(i), f = e(o), p = e(a), m = e(s), h = e(c);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limit.js","names":["LimitOrderFormState","
|
|
1
|
+
{"version":3,"file":"limit.js","names":["LimitOrderFormState","getConnection","wagmiConfig","Getter","limitTokenFromAtom","limitTokenToAtom","limitPayInputAmountAtom","limitPriceAmountAtom","limitReceiveInputAmountAtom","deadlineAtom","LimitFormInput","sanitizeTradeFlowToken","limitReceiverAddressAtom","getLimitOrderFormInput","get","tokenFrom","tokenTo","sendAmount","receiveAmount","limitPrice","orderDeadline","receiverAddress","undefined","srcChainId","network","destChainId","form","getLimitOrderState","formInput","account","address","connectedAccount"],"sources":["../../../src/events/getters/limit.ts"],"sourcesContent":["import type { LimitOrderFormState } from \"../types/common\";\nimport { getConnection } from \"@wagmi/core\";\nimport { wagmiConfig } from \"@/lib/web3/wagmi/config\";\nimport type { Getter } from \"jotai\";\nimport {\n limitTokenFromAtom,\n limitTokenToAtom,\n} from \"@/core/limit/state/limitTokenAtoms\";\nimport {\n limitPayInputAmountAtom,\n limitPriceAmountAtom,\n limitReceiveInputAmountAtom,\n} from \"@/core/limit/state/limitInputAmountAtom\";\nimport { deadlineAtom } from \"@/core/limit/state/deadlineAtom\";\nimport type { LimitFormInput } from \"../types/formInput\";\nimport { sanitizeTradeFlowToken } from \"@/lib/utils/tradeFlow\";\nimport { limitReceiverAddressAtom } from \"@/core/limit/state/receiverAddressAtom\";\n\nexport function getLimitOrderFormInput(get: Getter): LimitFormInput {\n const tokenFrom = get(limitTokenFromAtom);\n const tokenTo = get(limitTokenToAtom);\n\n const sendAmount = get(limitPayInputAmountAtom);\n const receiveAmount = get(limitReceiveInputAmountAtom);\n\n const limitPrice = get(limitPriceAmountAtom);\n const orderDeadline = get(deadlineAtom);\n\n const receiverAddress = get(limitReceiverAddressAtom);\n\n return {\n tokenFrom: sanitizeTradeFlowToken(tokenFrom),\n tokenTo: tokenTo ? sanitizeTradeFlowToken(tokenTo) : undefined,\n sendAmount,\n receiveAmount,\n srcChainId: tokenFrom.network,\n destChainId: tokenTo?.network,\n limitPrice,\n orderDeadline,\n form: \"limit\",\n receiverAddress,\n };\n}\n\nexport function getLimitOrderState(get: Getter): LimitOrderFormState {\n const formInput = getLimitOrderFormInput(get);\n\n const account = getConnection(wagmiConfig).address;\n\n // for LimitOrders user is the receiver\n const receiverAddress = account;\n\n return {\n ...formInput,\n connectedAccount: account,\n receiverAddress,\n };\n}\n"],"mappings":";;;;;;;;AAkBA,SAAgBa,EAAuBC,GAA6B;CAClE,IAAMC,IAAYD,EAAIV,EAAmB,EACnCY,IAAUF,EAAIT,EAAiB,EAE/BY,IAAaH,EAAIR,EAAwB,EACzCY,IAAgBJ,EAAIN,EAA4B,EAEhDW,IAAaL,EAAIP,EAAqB,EACtCa,IAAgBN,EAAIL,EAAa,EAEjCY,IAAkBP,EAAIF,EAAyB;CAErD,OAAO;EACLG,WAAWJ,EAAuBI,EAAU;EAC5CC,SAASA,IAAUL,EAAuBK,EAAQ,GAAGM,KAAAA;EACrDL;EACAC;EACAK,YAAYR,EAAUS;EACtBC,aAAaT,GAASQ;EACtBL;EACAC;EACAM,MAAM;EACNL;EACD;;AAGH,SAAgBM,EAAmBb,GAAkC;CACnE,IAAMc,IAAYf,EAAuBC,EAAI,EAEvCe,IAAU5B,EAAcC,EAAY,CAAC4B,SAGrCT,IAAkBQ;CAExB,OAAO;EACL,GAAGD;EACHG,kBAAkBF;EAClBR;EACD"}
|
|
@@ -4,7 +4,7 @@ import { deadlineAtom as n } from "../../core/otc/state/deadlineAtom.js";
|
|
|
4
4
|
import { otcTokenFromAtom as r, otcTokenToAtom as i } from "../../core/otc/state/selectedTokenAtom.js";
|
|
5
5
|
import { otcPayInputAmountAtom as a, otcPriceAmountAtom as o, otcReceiveInputAmountAtom as s } from "../../core/otc/state/otcInputAmountAtom.js";
|
|
6
6
|
import { otcReceiverAddressAtom as c } from "../../core/otc/state/receiverAddressAtom.js";
|
|
7
|
-
import {
|
|
7
|
+
import { getConnection as l } from "@wagmi/core";
|
|
8
8
|
//#region src/events/getters/otc.ts
|
|
9
9
|
function u(e) {
|
|
10
10
|
let l = e(r), u = e(i), d = e(a), f = e(s), p = e(o), m = e(n), h = e(c);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otc.js","names":["OTCOrderFormState","
|
|
1
|
+
{"version":3,"file":"otc.js","names":["OTCOrderFormState","getConnection","wagmiConfig","Getter","deadlineAtom","otcTokenFromAtom","otcTokenToAtom","otcPayInputAmountAtom","otcPriceAmountAtom","otcReceiveInputAmountAtom","OTCFormInput","otcReceiverAddressAtom","sanitizeTradeFlowToken","getOTCFormInput","get","tokenFrom","tokenTo","sendAmount","receiveAmount","otcPrice","orderDeadline","receiverAddress","undefined","srcChainId","network","destChainId","form","getOTCState","formInput","account","address","connectedAccount"],"sources":["../../../src/events/getters/otc.ts"],"sourcesContent":["import type { OTCOrderFormState } from \"../types/common\";\nimport { getConnection } from \"@wagmi/core\";\nimport { wagmiConfig } from \"@/lib/web3/wagmi/config\";\nimport type { Getter } from \"jotai\";\nimport { deadlineAtom } from \"@/core/otc/state/deadlineAtom\";\nimport {\n otcTokenFromAtom,\n otcTokenToAtom,\n} from \"@/core/otc/state/selectedTokenAtom\";\nimport {\n otcPayInputAmountAtom,\n otcPriceAmountAtom,\n otcReceiveInputAmountAtom,\n} from \"@/core/otc/state/otcInputAmountAtom\";\nimport type { OTCFormInput } from \"../types/formInput\";\nimport { otcReceiverAddressAtom } from \"@/core/otc/state/receiverAddressAtom\";\nimport { sanitizeTradeFlowToken } from \"@/lib/utils/tradeFlow\";\n\nexport function getOTCFormInput(get: Getter): OTCFormInput {\n const tokenFrom = get(otcTokenFromAtom);\n const tokenTo = get(otcTokenToAtom);\n\n const sendAmount = get(otcPayInputAmountAtom);\n const receiveAmount = get(otcReceiveInputAmountAtom);\n\n const otcPrice = get(otcPriceAmountAtom);\n const orderDeadline = get(deadlineAtom);\n\n const receiverAddress = get(otcReceiverAddressAtom);\n\n return {\n tokenFrom: sanitizeTradeFlowToken(tokenFrom),\n tokenTo: tokenTo ? sanitizeTradeFlowToken(tokenTo) : undefined,\n sendAmount,\n receiveAmount,\n srcChainId: tokenFrom.network,\n destChainId: tokenTo?.network,\n otcPrice,\n orderDeadline,\n form: \"otc\",\n receiverAddress,\n };\n}\n\nexport function getOTCState(get: Getter): OTCOrderFormState {\n const formInput = getOTCFormInput(get);\n\n const account = getConnection(wagmiConfig).address;\n\n return {\n ...formInput,\n connectedAccount: account,\n };\n}\n"],"mappings":";;;;;;;;AAkBA,SAAgBa,EAAgBC,GAA2B;CACzD,IAAMC,IAAYD,EAAIT,EAAiB,EACjCW,IAAUF,EAAIR,EAAe,EAE7BW,IAAaH,EAAIP,EAAsB,EACvCW,IAAgBJ,EAAIL,EAA0B,EAE9CU,IAAWL,EAAIN,EAAmB,EAClCY,IAAgBN,EAAIV,EAAa,EAEjCiB,IAAkBP,EAAIH,EAAuB;CAEnD,OAAO;EACLI,WAAWH,EAAuBG,EAAU;EAC5CC,SAASA,IAAUJ,EAAuBI,EAAQ,GAAGM,KAAAA;EACrDL;EACAC;EACAK,YAAYR,EAAUS;EACtBC,aAAaT,GAASQ;EACtBL;EACAC;EACAM,MAAM;EACNL;EACD;;AAGH,SAAgBM,EAAYb,GAAgC;CAC1D,IAAMc,IAAYf,EAAgBC,EAAI,EAEhCe,IAAU5B,EAAcC,EAAY,CAAC4B;CAE3C,OAAO;EACL,GAAGF;EACHG,kBAAkBF;EACnB"}
|
|
@@ -4,7 +4,7 @@ import { payInputAmountAtom as r, receiveInputAmountAtom as i } from "../../core
|
|
|
4
4
|
import { swapSideAtom as a } from "../../components/widget/SwapModeSwitcher/state/swapSideAtom.js";
|
|
5
5
|
import { receiverAddressAtom as o } from "../../components/widget/ReceiverAddress/state/receiverAddressAtom.js";
|
|
6
6
|
import { sanitizeTradeFlowToken as s } from "../../lib/utils/tradeFlow.js";
|
|
7
|
-
import {
|
|
7
|
+
import { getConnection as c } from "@wagmi/core";
|
|
8
8
|
//#region src/events/getters/swap.ts
|
|
9
9
|
function l(e) {
|
|
10
10
|
let r = e(t), i = e(n), c = r.network, l = i?.network, u = e(a), d = e(o);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swap.js","names":["SwapFormState","swapTokenFromAtom","swapTokenToAtom","payInputAmountAtom","receiveInputAmountAtom","swapSideAtom","
|
|
1
|
+
{"version":3,"file":"swap.js","names":["SwapFormState","swapTokenFromAtom","swapTokenToAtom","payInputAmountAtom","receiveInputAmountAtom","swapSideAtom","getConnection","wagmiConfig","receiverAddressAtom","Getter","SwapFormInput","sanitizeTradeFlowToken","getBaseParams","get","tokenFrom","tokenTo","srcChainId","network","destChainId","side","receiverAddress","undefined","getSwapState","baseState","sendAmount","receiveAmount","account","address","connectedAccount","getSwapFormInput","form"],"sources":["../../../src/events/getters/swap.ts"],"sourcesContent":["import type { SwapFormState } from \"../types/common\";\nimport {\n swapTokenFromAtom,\n swapTokenToAtom,\n} from \"@/core/inputs/state/selectedTokenAtom\";\nimport {\n payInputAmountAtom,\n receiveInputAmountAtom,\n} from \"@/core/inputs/state/inputAmountAtom\";\nimport { swapSideAtom } from \"@/components/widget/SwapModeSwitcher/state/swapSideAtom\";\nimport { getConnection } from \"@wagmi/core\";\nimport { wagmiConfig } from \"@/lib/web3/wagmi/config\";\nimport { receiverAddressAtom } from \"@/components/widget/ReceiverAddress/state/receiverAddressAtom\";\nimport type { Getter } from \"jotai\";\nimport type { SwapFormInput } from \"../types/formInput\";\nimport { sanitizeTradeFlowToken } from \"@/lib/utils/tradeFlow\";\n\nfunction getBaseParams(get: Getter) {\n const tokenFrom = get(swapTokenFromAtom);\n const tokenTo = get(swapTokenToAtom);\n\n const srcChainId = tokenFrom.network;\n const destChainId = tokenTo?.network;\n\n const side = get(swapSideAtom);\n\n const receiverAddress = get(receiverAddressAtom);\n\n return {\n tokenFrom: sanitizeTradeFlowToken(tokenFrom),\n tokenTo: tokenTo ? sanitizeTradeFlowToken(tokenTo) : undefined,\n srcChainId,\n destChainId,\n side,\n receiverAddress,\n };\n}\n\nexport function getSwapState(get: Getter): SwapFormState {\n const baseState = getBaseParams(get);\n\n const sendAmount = get(payInputAmountAtom);\n const receiveAmount = get(receiveInputAmountAtom);\n\n const account = getConnection(wagmiConfig).address;\n\n return {\n ...baseState,\n sendAmount,\n receiveAmount,\n connectedAccount: account,\n receiverAddress: baseState.receiverAddress ?? account,\n };\n}\n\nexport function getSwapFormInput(get: Getter): SwapFormInput {\n const baseState = getBaseParams(get);\n const side = baseState.side;\n\n if (side === \"SELL\") {\n const sendAmount = get(payInputAmountAtom);\n return {\n ...baseState,\n side,\n sendAmount,\n form: \"swap\",\n };\n }\n\n const receiveAmount = get(receiveInputAmountAtom);\n return {\n ...baseState,\n side,\n receiveAmount,\n form: \"swap\",\n };\n}\n"],"mappings":";;;;;;;;AAiBA,SAASY,EAAcC,GAAa;CAClC,IAAMC,IAAYD,EAAIZ,EAAkB,EAClCc,IAAUF,EAAIX,EAAgB,EAE9Bc,IAAaF,EAAUG,SACvBC,IAAcH,GAASE,SAEvBE,IAAON,EAAIR,EAAa,EAExBe,IAAkBP,EAAIL,EAAoB;CAEhD,OAAO;EACLM,WAAWH,EAAuBG,EAAU;EAC5CC,SAASA,IAAUJ,EAAuBI,EAAQ,GAAGM,KAAAA;EACrDL;EACAE;EACAC;EACAC;EACD;;AAGH,SAAgBE,EAAaT,GAA4B;CACvD,IAAMU,IAAYX,EAAcC,EAAI,EAE9BW,IAAaX,EAAIV,EAAmB,EACpCsB,IAAgBZ,EAAIT,EAAuB,EAE3CsB,IAAUpB,EAAcC,EAAY,CAACoB;CAE3C,OAAO;EACL,GAAGJ;EACHC;EACAC;EACAG,kBAAkBF;EAClBN,iBAAiBG,EAAUH,mBAAmBM;EAC/C;;AAGH,SAAgBG,EAAiBhB,GAA4B;CAC3D,IAAMU,IAAYX,EAAcC,EAAI,EAC9BM,IAAOI,EAAUJ;CAEvB,IAAIA,MAAS,QAAQ;EACnB,IAAMK,IAAaX,EAAIV,EAAmB;EAC1C,OAAO;GACL,GAAGoB;GACHJ;GACAK;GACAM,MAAM;GACP;;CAGH,IAAML,IAAgBZ,EAAIT,EAAuB;CACjD,OAAO;EACL,GAAGmB;EACHJ;EACAM;EACAK,MAAM;EACP"}
|
|
@@ -5,7 +5,7 @@ import { twapSideAtom as i } from "../../core/twap/state/twapSideAtom.js";
|
|
|
5
5
|
import { twapReceiverAddressAtom as a } from "../../core/twap/state/twapReceiverAddressAtom.js";
|
|
6
6
|
import { twapPayInputAmountAtom as o, twapReceiveInputAmountAtom as s } from "../../core/twap/state/twapInputAmountAtom.js";
|
|
7
7
|
import { twapDeadlinesAtom as c, twapSlippageAtom as l, twapSplitAtom as u } from "../../core/twap/state/twapParamsAtom.js";
|
|
8
|
-
import {
|
|
8
|
+
import { getConnection as d } from "@wagmi/core";
|
|
9
9
|
//#region src/events/getters/twap.ts
|
|
10
10
|
function f(e) {
|
|
11
11
|
let o = e(n), s = e(r), d = o.network, f = s?.network, p = e(i), m = e(a), h = e(u), g = e(l), { orderDeadline: _, orderInterval: v } = e(c);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"twap.js","names":["TwapFormState","
|
|
1
|
+
{"version":3,"file":"twap.js","names":["TwapFormState","getConnection","wagmiConfig","Getter","sanitizeTradeFlowToken","twapTokenFromAtom","twapTokenToAtom","twapSideAtom","twapReceiverAddressAtom","twapPayInputAmountAtom","twapReceiveInputAmountAtom","TwapFormInput","twapDeadlinesAtom","twapSlippageAtom","twapSplitAtom","getBaseParams","get","tokenFrom","tokenTo","srcChainId","network","destChainId","side","receiverAddress","orderSplit","slippage","orderDeadline","orderInterval","undefined","getTwapState","baseState","sendAmount","receiveAmount","account","address","connectedAccount","getTwapFormInput","form"],"sources":["../../../src/events/getters/twap.ts"],"sourcesContent":["import type { TwapFormState } from \"../types/common\";\n\nimport { getConnection } from \"@wagmi/core\";\nimport { wagmiConfig } from \"@/lib/web3/wagmi/config\";\nimport type { Getter } from \"jotai\";\nimport { sanitizeTradeFlowToken } from \"@/lib/utils/tradeFlow\";\nimport {\n twapTokenFromAtom,\n twapTokenToAtom,\n} from \"@/core/twap/state/twapTokenAtoms\";\nimport { twapSideAtom } from \"@/core/twap/state/twapSideAtom\";\nimport { twapReceiverAddressAtom } from \"@/core/twap/state/twapReceiverAddressAtom\";\nimport {\n twapPayInputAmountAtom,\n twapReceiveInputAmountAtom,\n} from \"@/core/twap/state/twapInputAmountAtom\";\nimport type { TwapFormInput } from \"../types/formInput\";\nimport {\n twapDeadlinesAtom,\n twapSlippageAtom,\n twapSplitAtom,\n} from \"@/core/twap/state/twapParamsAtom\";\n\nfunction getBaseParams(get: Getter) {\n const tokenFrom = get(twapTokenFromAtom);\n const tokenTo = get(twapTokenToAtom);\n\n const srcChainId = tokenFrom.network;\n const destChainId = tokenTo?.network;\n\n const side = get(twapSideAtom);\n\n const receiverAddress = get(twapReceiverAddressAtom);\n\n const orderSplit = get(twapSplitAtom);\n const slippage = get(twapSlippageAtom);\n\n const { orderDeadline, orderInterval } = get(twapDeadlinesAtom);\n\n return {\n tokenFrom: sanitizeTradeFlowToken(tokenFrom),\n tokenTo: tokenTo ? sanitizeTradeFlowToken(tokenTo) : undefined,\n srcChainId,\n destChainId,\n side,\n receiverAddress,\n orderSplit,\n slippage,\n orderDeadline,\n orderInterval,\n };\n}\n\nexport function getTwapState(get: Getter): TwapFormState {\n const baseState = getBaseParams(get);\n\n const sendAmount = get(twapPayInputAmountAtom);\n const receiveAmount = get(twapReceiveInputAmountAtom);\n\n const account = getConnection(wagmiConfig).address;\n\n return {\n ...baseState,\n sendAmount,\n receiveAmount,\n connectedAccount: account,\n receiverAddress: baseState.receiverAddress ?? account,\n };\n}\n\nexport function getTwapFormInput(get: Getter): TwapFormInput {\n const baseState = getBaseParams(get);\n const side = baseState.side;\n\n if (side === \"SELL\") {\n const sendAmount = get(twapPayInputAmountAtom);\n return {\n ...baseState,\n side,\n sendAmount,\n form: \"twap\",\n };\n }\n\n const receiveAmount = get(twapReceiveInputAmountAtom);\n return {\n ...baseState,\n side,\n receiveAmount,\n form: \"twap\",\n };\n}\n"],"mappings":";;;;;;;;;AAuBA,SAASe,EAAcC,GAAa;CAClC,IAAMC,IAAYD,EAAIX,EAAkB,EAClCa,IAAUF,EAAIV,EAAgB,EAE9Ba,IAAaF,EAAUG,SACvBC,IAAcH,GAASE,SAEvBE,IAAON,EAAIT,EAAa,EAExBgB,IAAkBP,EAAIR,EAAwB,EAE9CgB,IAAaR,EAAIF,EAAc,EAC/BW,IAAWT,EAAIH,EAAiB,EAEhC,EAAEa,kBAAeC,qBAAkBX,EAAIJ,EAAkB;CAE/D,OAAO;EACLK,WAAWb,EAAuBa,EAAU;EAC5CC,SAASA,IAAUd,EAAuBc,EAAQ,GAAGU,KAAAA;EACrDT;EACAE;EACAC;EACAC;EACAC;EACAC;EACAC;EACAC;EACD;;AAGH,SAAgBE,EAAab,GAA4B;CACvD,IAAMc,IAAYf,EAAcC,EAAI,EAE9Be,IAAaf,EAAIP,EAAuB,EACxCuB,IAAgBhB,EAAIN,EAA2B,EAE/CuB,IAAUhC,EAAcC,EAAY,CAACgC;CAE3C,OAAO;EACL,GAAGJ;EACHC;EACAC;EACAG,kBAAkBF;EAClBV,iBAAiBO,EAAUP,mBAAmBU;EAC/C;;AAGH,SAAgBG,EAAiBpB,GAA4B;CAC3D,IAAMc,IAAYf,EAAcC,EAAI,EAC9BM,IAAOQ,EAAUR;CAEvB,IAAIA,MAAS,QAAQ;EACnB,IAAMS,IAAaf,EAAIP,EAAuB;EAC9C,OAAO;GACL,GAAGqB;GACHR;GACAS;GACAM,MAAM;GACP;;CAGH,IAAML,IAAgBhB,EAAIN,EAA2B;CACrD,OAAO;EACL,GAAGoB;EACHR;EACAU;EACAK,MAAM;EACP"}
|
|
@@ -5,7 +5,7 @@ import { getLimitOrderState as r } from "./limit.js";
|
|
|
5
5
|
import { getOTCState as i } from "./otc.js";
|
|
6
6
|
import { getSettingsState as a } from "./settings.js";
|
|
7
7
|
import { getTwapState as o } from "./twap.js";
|
|
8
|
-
import {
|
|
8
|
+
import { getConnection as s } from "@wagmi/core";
|
|
9
9
|
//#region src/events/getters/widgetState.ts
|
|
10
10
|
function c() {
|
|
11
11
|
let { address: e, chainId: n, connector: r } = s(t);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widgetState.js","names":["Getter","AccountState","WidgetState","getSwapState","getLimitOrderState","getOTCState","tradeModeAtom","getSettingsState","
|
|
1
|
+
{"version":3,"file":"widgetState.js","names":["Getter","AccountState","WidgetState","getSwapState","getLimitOrderState","getOTCState","tradeModeAtom","getSettingsState","getConnection","wagmiConfig","getTwapState","accountState","address","chainId","connector","connectorData","name","icon","id","type","undefined","getWidgetState","get","currentTradeMode","formState","swap","limit","otc","twap","settingsState"],"sources":["../../../src/events/getters/widgetState.ts"],"sourcesContent":["import type { Getter } from \"jotai\";\nimport type { AccountState, WidgetState } from \"../types/common\";\nimport { getSwapState } from \"./swap\";\nimport { getLimitOrderState } from \"./limit\";\nimport { getOTCState } from \"./otc\";\nimport { tradeModeAtom } from \"@/core/state/tradeModeAtom\";\nimport { getSettingsState } from \"./settings\";\nimport { getConnection } from \"@wagmi/core\";\nimport { wagmiConfig } from \"@/lib/web3/wagmi/config\";\nimport { getTwapState } from \"./twap\";\n\nfunction accountState(): AccountState {\n const { address, chainId, connector } = getConnection(wagmiConfig);\n\n const connectorData = connector\n ? {\n name: connector.name,\n icon: connector.icon,\n id: connector.id,\n type: connector.type,\n }\n : undefined;\n return { address, chainId, connector: connectorData };\n}\n\nexport function getWidgetState(get: Getter): WidgetState {\n const currentTradeMode = get(tradeModeAtom);\n const formState = {\n swap: getSwapState(get),\n limit: getLimitOrderState(get),\n otc: getOTCState(get),\n twap: getTwapState(get),\n };\n\n return {\n currentTradeMode,\n formState,\n settingsState: getSettingsState(get),\n accountState: accountState(),\n };\n}\n"],"mappings":";;;;;;;;;AAWA,SAASW,IAA6B;CACpC,IAAM,EAAEC,YAASC,YAASC,iBAAcN,EAAcC,EAAY;CAUlE,OAAO;EAAEG;EAASC;EAASC,WARLA,IAClB;GACEE,MAAMF,EAAUE;GAChBC,MAAMH,EAAUG;GAChBC,IAAIJ,EAAUI;GACdC,MAAML,EAAUK;GACjB,GACDC,KAAAA;EACiD;;AAGvD,SAAgBC,EAAeC,GAA0B;CASvD,OAAO;EACLC,kBATuBD,EAAIhB,EAS3BiB;EACAC,WAAAA;GARAC,MAAMtB,EAAamB,EAAI;GACvBI,OAAOtB,EAAmBkB,EAAI;GAC9BK,KAAKtB,EAAYiB,EAAI;GACrBM,MAAMlB,EAAaY,EAAG;GAKtBE;EACAK,eAAetB,EAAiBe,EAAI;EACpCX,cAAcA,GAAa;EAC5B"}
|
|
@@ -2,7 +2,6 @@ import { CapabilitiesSchema } from 'viem';
|
|
|
2
2
|
type AtomicCapabilities = Required<Pick<CapabilitiesSchema["getCapabilities"]["ReturnType"], "atomic">>;
|
|
3
3
|
type AtomicStatus = AtomicCapabilities["atomic"]["status"];
|
|
4
4
|
type CanBatchTxsResult = {
|
|
5
|
-
byChain?: Record<number, AtomicStatus>;
|
|
6
5
|
forCurrentChain?: boolean;
|
|
7
6
|
currentChainStatus?: AtomicStatus;
|
|
8
7
|
isLoading: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCanBatchTxs.d.ts","sourceRoot":"","sources":["../../../src/hooks/batch/useCanBatchTxs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAK/C,KAAK,kBAAkB,GAAG,QAAQ,CAChC,IAAI,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,CAAC,YAAY,CAAC,EAAE,QAAQ,CAAC,CACpE,CAAC;AAEF,KAAK,YAAY,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC;AAE3D,KAAK,iBAAiB,GAAG;IACvB,
|
|
1
|
+
{"version":3,"file":"useCanBatchTxs.d.ts","sourceRoot":"","sources":["../../../src/hooks/batch/useCanBatchTxs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAK/C,KAAK,kBAAkB,GAAG,QAAQ,CAChC,IAAI,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,CAAC,YAAY,CAAC,EAAE,QAAQ,CAAC,CACpE,CAAC;AAEF,KAAK,YAAY,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC;AAE3D,KAAK,iBAAiB,GAAG;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,kBAAkB,CAAC,EAAE,YAAY,CAAC;IAClC,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,wBAAgB,cAAc,IAAI,iBAAiB,CAqClD"}
|
|
@@ -1,37 +1,28 @@
|
|
|
1
1
|
import { useLogger as e } from "../../core/logger.js";
|
|
2
2
|
import { c as t } from "react-compiler-runtime";
|
|
3
|
-
import "react";
|
|
4
3
|
import "viem";
|
|
5
4
|
import { useCapabilities as n, useConnection as r } from "wagmi";
|
|
6
5
|
//#region src/hooks/batch/useCanBatchTxs.ts
|
|
7
6
|
function i() {
|
|
8
|
-
let i = t(
|
|
9
|
-
i[0]
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
forCurrentChain: g,
|
|
28
|
-
currentChainStatus: h,
|
|
29
|
-
isLoading: f
|
|
30
|
-
}, i[5] = m, i[6] = h, i[7] = f, i[8] = g, i[9] = _) : _ = i[9], _;
|
|
31
|
-
}
|
|
32
|
-
function a(e) {
|
|
33
|
-
let [t, n] = e;
|
|
34
|
-
return [t, n.atomicBatch?.supported && "supported" || n.atomic?.status || "unsupported"];
|
|
7
|
+
let i = t(11), { address: a, chainId: o, connector: s } = r(), c = !!(a && o), l;
|
|
8
|
+
i[0] === c ? l = i[1] : (l = { enabled: c }, i[0] = c, i[1] = l);
|
|
9
|
+
let u = s?.uid, d;
|
|
10
|
+
i[2] !== a || i[3] !== o || i[4] !== l || i[5] !== u ? (d = {
|
|
11
|
+
query: l,
|
|
12
|
+
account: a,
|
|
13
|
+
scopeKey: u,
|
|
14
|
+
chainId: o
|
|
15
|
+
}, i[2] = a, i[3] = o, i[4] = l, i[5] = u, i[6] = d) : d = i[6];
|
|
16
|
+
let { data: f, isLoading: p } = n(d);
|
|
17
|
+
e("BATCH::useCanBatchTxs::wagmi").once.log("capabilities", f);
|
|
18
|
+
let m;
|
|
19
|
+
f && (m = f.atomicBatch?.supported ? "supported" : f.atomic?.status ? f.atomic?.status : "unsupported");
|
|
20
|
+
let h = m === "supported" || m === "ready", g;
|
|
21
|
+
return i[7] !== m || i[8] !== p || i[9] !== h ? (g = {
|
|
22
|
+
forCurrentChain: h,
|
|
23
|
+
currentChainStatus: m,
|
|
24
|
+
isLoading: p
|
|
25
|
+
}, i[7] = m, i[8] = p, i[9] = h, i[10] = g) : g = i[10], g;
|
|
35
26
|
}
|
|
36
27
|
//#endregion
|
|
37
28
|
export { i as useCanBatchTxs };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCanBatchTxs.js","names":["CapabilitiesSchema","useConnection","useCapabilities","
|
|
1
|
+
{"version":3,"file":"useCanBatchTxs.js","names":["CapabilitiesSchema","useConnection","useCapabilities","Config","useLogger","SupportedChainId","AtomicCapabilities","Required","Pick","AtomicStatus","CanBatchTxsResult","forCurrentChain","currentChainStatus","isLoading","useCanBatchTxs","$","_c","address","account","chainId","connector","t0","t1","enabled","t2","uid","t3","query","scopeKey","data","logger","once","log","undefined","atomicBatch","supported","atomic","status","t4","t5"],"sources":["../../../src/hooks/batch/useCanBatchTxs.ts"],"sourcesContent":["import { type CapabilitiesSchema } from \"viem\";\nimport { useConnection, useCapabilities, type Config } from \"wagmi\";\nimport { useLogger } from \"@/core/logger\";\nimport type { SupportedChainId } from \"@/lib/web3/wagmi/types\";\n\ntype AtomicCapabilities = Required<\n Pick<CapabilitiesSchema[\"getCapabilities\"][\"ReturnType\"], \"atomic\">\n>;\n\ntype AtomicStatus = AtomicCapabilities[\"atomic\"][\"status\"];\n\ntype CanBatchTxsResult = {\n forCurrentChain?: boolean;\n currentChainStatus?: AtomicStatus;\n isLoading: boolean;\n};\n\nexport function useCanBatchTxs(): CanBatchTxsResult {\n const { address: account, chainId, connector } = useConnection();\n\n const { data, isLoading } = useCapabilities<Config, SupportedChainId>({\n query: {\n enabled: !!(account && chainId), // with optional chainId a different result shape is returned, so don't make a request if unavailable\n },\n account,\n scopeKey: connector?.uid, // unique for App session & wallet connection\n chainId, // If chain is specified, capabilities are returned for that chain only; otherwise for all chains.\n // WalletConnect caches results based on `chainId`, so results without `input.chainId` can be reused across chain switches.\n // This is fine when capabilities include all chains at once, but for Safe via WalletConnect they can include only the current chain,\n // so after a chain switch (supported in the new Safe UI) the cached result can remain for the old chain.\n // Conclusion: always pass `chainId` to getCapabilities() to avoid caching issues with WalletConnect + Safe.\n });\n const logger = useLogger(\"BATCH::useCanBatchTxs::wagmi\");\n\n logger.once.log(\"capabilities\", data);\n\n let currentChainStatus: CanBatchTxsResult[\"currentChainStatus\"] = undefined;\n if (data) {\n if (data[\"atomicBatch\"]?.supported) {\n currentChainStatus = \"supported\";\n } else if (data.atomic?.status) {\n currentChainStatus = data.atomic?.status;\n } else {\n currentChainStatus = \"unsupported\";\n }\n }\n\n return {\n forCurrentChain:\n // ready means the user will be asked to upgrade to delegated EOA\n currentChainStatus === \"supported\" || currentChainStatus === \"ready\",\n currentChainStatus,\n isLoading,\n };\n}\n"],"mappings":";;;;;AAiBA,SAAOc,IAAA;CAAA,IAAAC,IAAAC,EAAA,GAAA,EACL,EAAAC,SAAAC,GAAAC,YAAAC,iBAAiDnB,GAAe,EAInDoB,IAAA,CAAC,EAAEH,KAAAC,IAAmBG;CAAA,AAAAP,EAAA,OAAAM,IAChCC,IAAAP,EAAA,MAFMO,IAAA,EAAAC,SACIF,GACV,EAAAN,EAAA,KAAAM,GAAAN,EAAA,KAAAO;CAES,IAAAE,IAAAJ,GAASK,KAAKC;CAAA,AAAAX,EAAA,OAAAG,KAAAH,EAAA,OAAAI,KAAAJ,EAAA,OAAAO,KAAAP,EAAA,OAAAS,KAL4CE,IAAA;EAAAC,OAC7DL;EAENJ;EAAAU,UAESJ;EAAcL;EAMzB,EAAAJ,EAAA,KAAAG,GAAAH,EAAA,KAAAI,GAAAJ,EAAA,KAAAO,GAAAP,EAAA,KAAAS,GAAAT,EAAA,KAAAW,KAAAA,IAAAX,EAAA;CAXD,IAAA,EAAAc,SAAAhB,iBAA4BX,EAA0CwB,EAWpE;CAGFI,EAFyB,+BAEzBA,CAAMC,KAAKC,IAAK,gBAAgBH,EAAK;CAErC,IAAAjB;CACA,AAAIiB,MACF,AAKEjB,IALEiB,EAAIK,aAA0BC,YACXvB,cACZiB,EAAIO,QAAeC,SACPR,EAAIO,QAAeC,SAEnBzB;CAOrB,IAAA0B,IAAA1B,MAAuB,eAAeA,MAAuB,SAAO2B;CAGvE,OAHuExB,EAAA,OAAAH,KAAAG,EAAA,OAAAF,KAAAE,EAAA,OAAAuB,KAHjEC,IAAA;EAAA5B,iBAGH2B;EAAoE1B;EAAAC;EAGvE,EAAAE,EAAA,KAAAH,GAAAG,EAAA,KAAAF,GAAAE,EAAA,KAAAuB,GAAAvB,EAAA,MAAAwB,KAAAA,IAAAxB,EAAA,KANMwB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIsConnectedSafe.js","names":["wagmiConfig","useIsSafeConnector","isSafeConnectorThroughWalletConnect","useIsSafeThroughWalletConnect","
|
|
1
|
+
{"version":3,"file":"useIsConnectedSafe.js","names":["wagmiConfig","useIsSafeConnector","isSafeConnectorThroughWalletConnect","useIsSafeThroughWalletConnect","getConnection","getWalletMetadata","walletMetadataQueryKey","queryClient","isConnectorWithSafeProvider","useIsExternalConnectorWithSafe","useConnectedSafe","isSafeConnector","isSafeThroughWalletConnect","isExternalProviderSafeIframe","useConnectedToSafeIframe","connectedSafe","connector","walletMeta","ensureQueryData","queryKey","uid","queryFn","gcTime","Infinity"],"sources":["../../../src/hooks/connectors/useIsConnectedSafe.ts"],"sourcesContent":["import { wagmiConfig } from \"@/lib/web3/wagmi/config\";\nimport { useIsSafeConnector } from \"./useIsGnosisSafeConnector\";\nimport {\n isSafeConnectorThroughWalletConnect,\n useIsSafeThroughWalletConnect,\n} from \"./useIsSafeThroughWalletConnect\";\nimport { getConnection } from \"@wagmi/core\";\nimport {\n getWalletMetadata,\n walletMetadataQueryKey,\n} from \"@/components/web3/ConnectWallets/walletIcons\";\nimport { queryClient } from \"@/lib/queryClient\";\nimport {\n isConnectorWithSafeProvider,\n useIsExternalConnectorWithSafe,\n} from \"@/components/web3/ConnectExternalProvider/utils\";\n\nexport function useConnectedSafe(): boolean {\n const isSafeConnector = useIsSafeConnector();\n const isSafeThroughWalletConnect = useIsSafeThroughWalletConnect();\n\n const isExternalProviderSafeIframe = useIsExternalConnectorWithSafe();\n\n return (\n isSafeConnector ||\n isSafeThroughWalletConnect ||\n isExternalProviderSafeIframe\n );\n}\n\nexport function useConnectedToSafeIframe(): boolean {\n const isSafeConnector = useIsSafeConnector();\n const isExternalProviderSafeIframe = useIsExternalConnectorWithSafe();\n return isExternalProviderSafeIframe || isSafeConnector;\n}\n\n// for use outside of react\nexport async function connectedSafe() {\n const connector = getConnection(wagmiConfig).connector;\n if (!connector) return false;\n\n if (isConnectorWithSafeProvider(connector)) return true;\n\n const walletMeta = await queryClient.ensureQueryData({\n queryKey: walletMetadataQueryKey(connector.uid),\n queryFn: () => getWalletMetadata(connector),\n gcTime: Infinity,\n });\n\n return isSafeConnectorThroughWalletConnect(walletMeta);\n}\n"],"mappings":";;;;;AAiBA,SAAOU,IAAA;CACL,IAAAC,IAAwBV,GAAoB,EAC5CW,IAAmCT,GAA+B,EAElEU,IAAqCJ,GAAgC;CAAC,OAGpEE,KAAAC,KAAAC;;AAMJ,SAAOC,IAAA;CACL,IAAAH,IAAwBV,GAAoB;CAC0B,OAAjCQ,GAC9BI,IAAAF"}
|
|
@@ -14,7 +14,7 @@ export interface EIP712Parameter {
|
|
|
14
14
|
name: string;
|
|
15
15
|
type: string;
|
|
16
16
|
}
|
|
17
|
-
export
|
|
17
|
+
export type EIP712ObjectValue = string | number | boolean | EIP712Object;
|
|
18
18
|
export interface EIP712Object {
|
|
19
19
|
[key: string]: EIP712ObjectValue;
|
|
20
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/hooks/permit/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,WAAW,GAAG;QAAE,YAAY,EAAE,eAAe,EAAE,CAAA;KAAE,CAAC;IACzD,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,EAAE,YAAY,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,EAAE,CAAC;CAClC;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,
|
|
1
|
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C,GAAG,QAAQ,CAAC;SAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KAAE,GAAG,KAAK,CAAC;CACxD,CAAC"}
|
|
@@ -1247,9 +1247,4 @@ export declare const wagmiConfig: import('wagmi').Config<readonly [{
|
|
|
1247
1247
|
};
|
|
1248
1248
|
verifyHash?: ((client: import('viem').Client, parameters: import('viem').VerifyHashActionParameters) => Promise<import('viem').VerifyHashActionReturnType>) | undefined;
|
|
1249
1249
|
}], Record<1 | 10 | 137 | 56 | 43114 | 42161 | 8453 | 100 | 130, import('viem').FallbackTransport<import('viem').Transport[]>>, CreateConnectorFn[]>;
|
|
1250
|
-
declare module "wagmi" {
|
|
1251
|
-
interface Register {
|
|
1252
|
-
config: typeof wagmiConfig;
|
|
1253
|
-
}
|
|
1254
|
-
}
|
|
1255
1250
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/lib/web3/wagmi/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAsC5E,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/lib/web3/wagmi/config.ts"],"names":[],"mappings":"AAAA,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0BAAuI,CAAC;oBAA6C,CAAC;0BAAmD,CAAC;;;;;;qFAA2P,CAAC;4BAAuD,CAAC;2BAAiD,CAAC;;;8BAAmJ,CAAC;;;;;;;;oBAAua,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;oJAtD5yR,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","names":["createConfig","createStorage","CreateConnectorFn","injected","safe","walletConnect","coinbaseWallet","chains","transports","isInIframe","LOCAL_STORAGE_PREFIX","connectors","delayConnector","projectId","import","meta","env","VITE_WALLET_CONNECT_ID","unshift","wagmiConfig","storage","window","localStorage","undefined","key","syncConnectedChain","batch","multicall","wait","
|
|
1
|
+
{"version":3,"file":"config.js","names":["createConfig","createStorage","CreateConnectorFn","injected","safe","walletConnect","coinbaseWallet","chains","transports","isInIframe","LOCAL_STORAGE_PREFIX","connectors","delayConnector","projectId","import","meta","env","VITE_WALLET_CONNECT_ID","unshift","wagmiConfig","storage","window","localStorage","undefined","key","syncConnectedChain","batch","multicall","wait","connectorFn","C","modifiedFn","config","connector","modified","connectCalled","connect","args","setup","getProvider","Error"],"sources":["../../../../src/lib/web3/wagmi/config.ts"],"sourcesContent":["import { createConfig, createStorage, type CreateConnectorFn } from \"wagmi\";\nimport {\n injected,\n // metaMask,\n safe,\n walletConnect,\n coinbaseWallet,\n} from \"wagmi/connectors\";\nimport { chains } from \"./constants\";\nimport { transports } from \"./transports\";\nimport { isInIframe } from \"./isInIframe\";\nimport { LOCAL_STORAGE_PREFIX } from \"@/lib/constants/storage\";\n\n// can add more connectors to cover wallets Privy doesn't support, but need to change UI to allow connection\nconst connectors = [\n delayConnector(\n walletConnect({\n projectId: import.meta.env.VITE_WALLET_CONNECT_ID,\n }) as CreateConnectorFn\n ),\n injected() as CreateConnectorFn,\n // metaMask() as CreateConnectorFn, // injected() detects metamask already\n coinbaseWallet() as CreateConnectorFn,\n // raw returned types result in\n // The inferred type of 'config' cannot be named without a reference to '.pnpm/@safe-global+safe-apps-provider@0.18.6_typescript@5.8.3/node_modules/@safe-global/safe-apps-provider'. This is likely not portable. A type annotation is necessary.\n\n // getPrivyWalletConnector(), // only CorssApp Privy connector is available, not our use case\n];\n// @TODO see how we can implement Ledger connector, borrow it from rainbowkit?\n\nif (isInIframe) {\n // when widget is in an App inside iframe, chances are we are in Safe web app,\n // allow Safe connector to be used.\n // we can't know if we are inside specifically Safe iframe until we try to connect, though.\n // A check for that is in isInsideSafeIframe.ts\n connectors.unshift(safe());\n}\n\nexport const wagmiConfig = createConfig({\n storage: createStorage({\n storage: typeof window !== \"undefined\" ? window.localStorage : undefined,\n key: `${LOCAL_STORAGE_PREFIX}_wagmi`,\n }),\n chains,\n connectors,\n transports,\n syncConnectedChain: false,\n batch: {\n multicall: {\n wait: 20,\n },\n },\n});\n\n/**\n * Normal flow:\n * 1. connector.setup() (optional func) is called on connector creation inside wagmi config\n * 1.1. connector.getProvider() is called inside connector.setup() (usually)\n * 2. connector.getProvider() is called inside reconnect in wagmi config\n * 3. connector.connect() is called on wallet connection\n * 3.1. connector.getProvider() is called inside connector.connect()\n *\n * if getProvider contains some singleton init logic, it may break if called again in a different context:\n * e.g. WalletConnect connection in Widget + in integrating app.\n * WConnectProvider.init() called inside Widget and in the integrating App can interfere with each other,\n * especially if inside Widget is called first.\n *\n * Delayed flow:\n * 1. connector.setup removed\n * 2. connector.getProvider() throws until connector.connect() is called (drawback:this disables reconnection on page load)\n * 3. connector.getProvider() is called on wallet connection inside connector.connect()\n */\nfunction delayConnector<C extends CreateConnectorFn>(connectorFn: C): C {\n const modifiedFn = ((config) => {\n const connector = connectorFn(config);\n const modified = {\n ...connector,\n };\n\n let connectCalled = false;\n\n modified.connect = async (...args) => {\n if (!connectCalled) {\n // first call to connect() will call setup() that was skipped in delayed flow\n connectCalled = true;\n await connector.setup?.(); // getProvvider is called inside setup(), at least in WalletConnect connector\n }\n return connector.connect(...args);\n };\n\n modified.getProvider = async (...args) => {\n // disallow provider specific logic until connect() is called explicitly\n if (!connectCalled) {\n throw new Error(\n \"Provider not available until connector.connect() is called\"\n );\n }\n return connector.getProvider(...args);\n };\n\n delete modified.setup;\n return modified;\n }) as C;\n\n return modifiedFn;\n}\n"],"mappings":";;;;;;;AAcA,IAAMW,IAAa;CACjBC,EACEP,EAAc,EACZQ,WAAAA,oCACD,CAAC,CACH;CACDV,GAAU;CAEVG,GAAgB;CAKjB;AAGGG,KAKFE,EAAWO,QAAQd,GAAM,CAAC;AAG5B,IAAae,IAAcnB,EAAa;CACtCoB,SAASnB,EAAc;EACrBmB,SAAS,OAAOC,SAAW,MAAcA,OAAOC,eAAeC,KAAAA;EAC/DC,KAAK,GAAGd,EAAoB;EAC7B,CAAC;CACFH;CACAI;CACAH;CACAiB,oBAAoB;CACpBC,OAAO,EACLC,WAAW,EACTC,MAAM,IACR,EACF;CACD,CAAC;AAoBF,SAAShB,EAA4CiB,GAAmB;CAgCtE,SA/BqBG,MAAW;EAC9B,IAAMC,IAAYJ,EAAYG,EAAO,EAC/BE,IAAW,EACf,GAAGD,GACJ,EAEGE,IAAgB;EAsBpB,OApBAD,EAASE,UAAU,OAAO,GAAGC,OACtBF,MAEHA,IAAgB,IAChB,MAAMF,EAAUK,SAAS,GAEpBL,EAAUG,QAAQ,GAAGC,EAAK,GAGnCH,EAASK,cAAc,OAAO,GAAGF,MAAS;GAExC,IAAI,CAACF,GACH,MAAUK,MACR,6DACD;GAEH,OAAOP,EAAUM,YAAY,GAAGF,EAAK;KAGvC,OAAOH,EAASI,OACTJ"}
|
|
@@ -5,7 +5,7 @@ import { isConnectorWithSafeProvider as r } from "../../../components/web3/Conne
|
|
|
5
5
|
import { isWalletConnectConnectorWithSafe as i } from "../../../hooks/connectors/useIsSafeThroughWalletConnect.js";
|
|
6
6
|
import { atom as a } from "jotai";
|
|
7
7
|
import { loadable as o } from "jotai/utils";
|
|
8
|
-
import {
|
|
8
|
+
import { getConnection as s } from "@wagmi/core";
|
|
9
9
|
//#region src/lib/web3/wagmi/external.ts
|
|
10
10
|
function c() {
|
|
11
11
|
let { address: e, chainId: t, connector: r } = s(n);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external.js","names":["
|
|
1
|
+
{"version":3,"file":"external.js","names":["getConnection","wagmiConfig","atom","atomWithCompare","constructPropertiesEqual","isConnectorWithSafeProvider","isWalletConnectConnectorWithSafe","loadable","getMinAccount","address","chainId","connector","accountAtom","addressAtom","get","isConnectorWithSafeAsyncAtom","isConnectorWithSafeAsyncAtomLoadableAtom"],"sources":["../../../../src/lib/web3/wagmi/external.ts"],"sourcesContent":["import { getConnection } from \"@wagmi/core\";\nimport { wagmiConfig } from \"./config\";\nimport { atom } from \"jotai\";\nimport { atomWithCompare } from \"@/lib/utils/atomWithCompare\";\nimport { constructPropertiesEqual } from \"@/lib/utils\";\nimport { isConnectorWithSafeProvider } from \"@/components/web3/ConnectExternalProvider/utils\";\nimport { isWalletConnectConnectorWithSafe } from \"@/hooks/connectors/useIsSafeThroughWalletConnect\";\nimport { loadable } from \"jotai/utils\";\n\nfunction getMinAccount() {\n const { address, chainId, connector } = getConnection(wagmiConfig);\n return { address, chainId, connector };\n}\n\nexport const accountAtom = atomWithCompare(\n getMinAccount(),\n constructPropertiesEqual([\"address\", \"chainId\", \"connector\"])\n);\n\nexport const addressAtom = atom((get) => get(accountAtom).address);\n\nconst isConnectorWithSafeAsyncAtom = atom(async (get) => {\n const { connector } = get(accountAtom);\n if (!connector) return false;\n return (\n isConnectorWithSafeProvider(connector) ||\n isWalletConnectConnectorWithSafe(connector)\n );\n});\n\nexport const isConnectorWithSafeAsyncAtomLoadableAtom = loadable(\n isConnectorWithSafeAsyncAtom\n);\n"],"mappings":";;;;;;;;;AASA,SAASQ,IAAgB;CACvB,IAAM,EAAEC,YAASC,YAASC,iBAAcX,EAAcC,EAAY;CAClE,OAAO;EAAEQ;EAASC;EAASC;EAAW;;AAGxC,IAAaC,IAAcT,EACzBK,GAAe,EACfJ,EAAyB;CAAC;CAAW;CAAW;CAAY,CAC9D,CAAC,EAEYS,IAAcX,GAAMY,MAAQA,EAAIF,EAAY,CAACH,QAAQ,EAWrDO,IAA2CT,EATnBL,EAAK,OAAOY,MAAQ;CACvD,IAAM,EAAEH,iBAAcG,EAAIF,EAAY;CAEtC,OADKD,IAEHN,EAA4BM,EAAU,IACtCL,EAAiCK,EAAU,GAHtB;EAQvBI,CACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switchChain.d.ts","sourceRoot":"","sources":["../../../../src/lib/web3/wagmi/switchChain.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAGhD,wBAAsB,WAAW,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,gBAAgB,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"switchChain.d.ts","sourceRoot":"","sources":["../../../../src/lib/web3/wagmi/switchChain.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAGhD,wBAAsB,WAAW,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,gBAAgB,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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 -3,7 +3,7 @@ import { isConnectorWithSafeIframeProvider as t } from "../../../components/web3
|
|
|
3
3
|
import * as n from "@wagmi/core";
|
|
4
4
|
//#region src/lib/web3/wagmi/switchChain.ts
|
|
5
5
|
async function r({ chainId: r }) {
|
|
6
|
-
let { connector: i, isConnected: a } = n.
|
|
6
|
+
let { connector: i, isConnected: a } = n.getConnection(e), o = i && t(i);
|
|
7
7
|
if (a && e.setState((e) => ({
|
|
8
8
|
...e,
|
|
9
9
|
chainId: r
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switchChain.js","names":["wagmi","wagmiConfig","SupportedChainId","isConnectorWithSafeIframeProvider","switchChain","chainId","connector","isConnected","
|
|
1
|
+
{"version":3,"file":"switchChain.js","names":["wagmi","wagmiConfig","SupportedChainId","isConnectorWithSafeIframeProvider","switchChain","chainId","connector","isConnected","getConnection","isSafeIframeProvider","setState","prev"],"sources":["../../../../src/lib/web3/wagmi/switchChain.ts"],"sourcesContent":["import * as wagmi from \"@wagmi/core\";\nimport { wagmiConfig } from \"./config\";\nimport type { SupportedChainId } from \"./types\";\nimport { isConnectorWithSafeIframeProvider } from \"@/components/web3/ConnectExternalProvider/utils\";\n\nexport async function switchChain({ chainId }: { chainId: SupportedChainId }) {\n const { connector, isConnected } = wagmi.getConnection(wagmiConfig);\n\n // check if connected to Safe iframe provider (whether through safe connector or as external provider)\n const isSafeIframeProvider =\n connector && isConnectorWithSafeIframeProvider(connector);\n\n // wagmi doesn't autoswitch state chainId with syncConnectedChain=false if connected\n if (isConnected) wagmiConfig.setState((prev) => ({ ...prev, chainId }));\n\n // safe doesn't support programmatic chain switching\n if (!isSafeIframeProvider) return wagmi.switchChain(wagmiConfig, { chainId });\n}\n"],"mappings":";;;;AAKA,eAAsBI,EAAY,EAAEC,cAA0C;CAC5E,IAAM,EAAEC,cAAWC,mBAAgBP,EAAMQ,cAAcP,EAAY,EAG7DQ,IACJH,KAAaH,EAAkCG,EAAU;CAM3D,IAHIC,KAAaN,EAAYS,UAAUC,OAAU;EAAE,GAAGA;EAAMN;EAAS,EAAE,EAGnE,CAACI,GAAsB,OAAOT,EAAMI,YAAYH,GAAa,EAAEI,YAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensureCallsStatus.d.ts","sourceRoot":"","sources":["../../../src/transactions/queries/ensureCallsStatus.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,
|
|
1
|
+
{"version":3,"file":"ensureCallsStatus.d.ts","sourceRoot":"","sources":["../../../src/transactions/queries/ensureCallsStatus.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAqC,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAE7E,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,EAAE;IAC1C,EAAE,EAAE,MAAM,CAAC;CACZ,KAAK,OAAO,CAAC,sBAAsB,CAAC,CAAC;AAEtC,KAAK,wBAAwB,GAAG,CAAC,MAAM,CAAC,EAAE;IACxC,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,KAAK,mBAAmB,CAAC;AAE1B,eAAO,MAAM,wBAAwB,EAAE,wBAsCpC,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { wagmiConfig as t } from "../../lib/web3/wagmi/config.js";
|
|
|
3
3
|
import { queryClient as n } from "../../lib/queryClient.js";
|
|
4
4
|
import { isConnectorWithSafeProvider as r } from "../../components/web3/ConnectExternalProvider/utils.js";
|
|
5
5
|
import { isWalletConnectConnectorWithSafe as i } from "../../hooks/connectors/useIsSafeThroughWalletConnect.js";
|
|
6
|
-
import {
|
|
6
|
+
import { getConnection as a, waitForCallsStatus as o } from "@wagmi/core";
|
|
7
7
|
import { waitForCallsStatusQueryKey as s } from "wagmi/query";
|
|
8
8
|
//#region src/transactions/queries/ensureCallsStatus.ts
|
|
9
9
|
var c = ({ queryClient: c = n, wagmiConfig: l = t, isSafe: u } = {}) => async ({ id: t }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensureCallsStatus.js","names":["isConnectorWithSafeProvider","isWalletConnectConnectorWithSafe","SAFE_CALLS_WAIT_TIMEOUT","queryClient","_queryClient","wagmiConfig","_wagmiConfig","QueryClient","
|
|
1
|
+
{"version":3,"file":"ensureCallsStatus.js","names":["isConnectorWithSafeProvider","isWalletConnectConnectorWithSafe","SAFE_CALLS_WAIT_TIMEOUT","queryClient","_queryClient","wagmiConfig","_wagmiConfig","QueryClient","getConnection","waitForCallsStatus","Config","waitForCallsStatusQueryKey","WaitForCallsStatusData","EnsureCallsStatusFn","options","id","Promise","EnsureCallsStatusFactory","params","isSafe","ensureCallsStatusFactory","_isSafe","connector","isConnectedToSafe","timeout","undefined","queryKey","throwOnFailure","status","ensureQueryData","queryFn"],"sources":["../../../src/transactions/queries/ensureCallsStatus.ts"],"sourcesContent":["import { isConnectorWithSafeProvider } from \"@/components/web3/ConnectExternalProvider/utils\";\nimport { isWalletConnectConnectorWithSafe } from \"@/hooks/connectors/useIsSafeThroughWalletConnect\";\nimport { SAFE_CALLS_WAIT_TIMEOUT } from \"@/lib/constants\";\nimport { queryClient as _queryClient } from \"@/lib/queryClient\";\nimport { wagmiConfig as _wagmiConfig } from \"@/lib/web3/wagmi/config\";\nimport type { QueryClient } from \"@tanstack/react-query\";\nimport { getConnection, waitForCallsStatus, type Config } from \"@wagmi/core\";\n\nimport {\n waitForCallsStatusQueryKey,\n type WaitForCallsStatusData,\n} from \"wagmi/query\";\n\nexport type EnsureCallsStatusFn = (options: {\n id: string;\n}) => Promise<WaitForCallsStatusData>;\n\ntype EnsureCallsStatusFactory = (params?: {\n queryClient?: QueryClient;\n wagmiConfig?: Config;\n isSafe?: boolean;\n}) => EnsureCallsStatusFn;\n\nexport const ensureCallsStatusFactory: EnsureCallsStatusFactory =\n ({\n queryClient = _queryClient,\n wagmiConfig = _wagmiConfig,\n isSafe: _isSafe,\n } = {}) =>\n async ({ id }) => {\n const { connector } = getConnection(wagmiConfig);\n\n let isSafe = _isSafe;\n if (!isSafe) {\n const isConnectedToSafe =\n !!connector &&\n (isConnectorWithSafeProvider(connector) ||\n (await isWalletConnectConnectorWithSafe(connector)));\n\n isSafe = isConnectedToSafe;\n }\n\n const timeout = isSafe ? SAFE_CALLS_WAIT_TIMEOUT : undefined;\n\n const queryKey = waitForCallsStatusQueryKey({\n id,\n timeout, // important to include timeout into queryKey to match useAwaitCalls queryKey\n throwOnFailure: true,\n });\n const status = await queryClient.ensureQueryData({\n queryKey,\n queryFn: async () => {\n return waitForCallsStatus(wagmiConfig, {\n id,\n throwOnFailure: true,\n timeout,\n });\n },\n });\n\n return status;\n };\n"],"mappings":";;;;;;;;AAuBA,IAAaoB,KACV,EACCjB,aAAAA,IAAcC,GACdC,aAAAA,IAAcC,GACda,QAAQE,MACN,EAAE,KACN,OAAO,EAAEN,YAAS;CAChB,IAAM,EAAEO,iBAAcd,EAAcH,EAAY,EAE5Cc,IAASE;CACb,AAMEF,MAJE,CAAC,CAACG,MACDtB,EAA4BsB,EAAU,IACpC,MAAMrB,EAAiCqB,EAAU;CAKxD,IAAME,IAAUL,IAASjB,IAA0BuB,KAAAA,GAE7CC,IAAWf,EAA2B;EAC1CI;EACAS;EACAG,gBAAgB;EACjB,CAAC;CAYF,OAAOC,MAXczB,EAAY0B,gBAAgB;EAC/CH;EACAI,SAAS,YACArB,EAAmBJ,GAAa;GACrCU;GACAY,gBAAgB;GAChBH;GACD,CAAC;EAEL,CAAC"}
|
|
@@ -8,7 +8,7 @@ import { ensureCallsStatusFactory as s } from "./ensureCallsStatus.js";
|
|
|
8
8
|
import { assert as c } from "ts-essentials";
|
|
9
9
|
import "wagmi/chains";
|
|
10
10
|
import "viem";
|
|
11
|
-
import {
|
|
11
|
+
import { getConnection as l, getConnectorClient as u } from "@wagmi/core";
|
|
12
12
|
import { waitForTransactionReceiptQueryOptions as d } from "wagmi/query";
|
|
13
13
|
//#region src/transactions/queries/ensureTxReceipt.ts
|
|
14
14
|
var f = t("Transactions:EnsureTxReceipt"), p = (t = {}) => async ({ hash: p, chainId: m, confirmations: h, onReplaced: g }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensureTxReceipt.js","names":["UseAwaitTxParameters","queryClient","_queryClient","wagmiConfig","_wagmiConfig","QueryClient","assert","MarkRequired","ReplacementReturnType","TransactionReceipt","waitForTransactionReceiptQueryOptions","SAFE_CALLS_WAIT_TIMEOUT","Chain","
|
|
1
|
+
{"version":3,"file":"ensureTxReceipt.js","names":["UseAwaitTxParameters","queryClient","_queryClient","wagmiConfig","_wagmiConfig","QueryClient","assert","MarkRequired","ReplacementReturnType","TransactionReceipt","waitForTransactionReceiptQueryOptions","SAFE_CALLS_WAIT_TIMEOUT","Chain","getConnection","getConnectorClient","isConnectorWithSafeIframeProvider","isExternalConnectorSafeWalletConnect","isWalletConnectConnectorWithSafe","ensureCallsStatusFactory","getLogger","OnReplacedCb","data","EnsureTxReceiptFn","options","Pick","onReplaced","Promise","EnsureTxReceiptFactory","params","isSafe","logger","ensureTxReceiptFactory","hash","chainId","confirmations","_isSafe","connector","isWConnectConnectorWithSafe","isConnectedToSafeIframe","isConnectedToSafe","timeout","config","realtxHash","safeClient","getClient","ensureCallsStatus","callsStatusResult","id","classReceipt","receipts","length","transactionHash","error","queryOptions","receipt","ensureQueryData"],"sources":["../../../src/transactions/queries/ensureTxReceipt.ts"],"sourcesContent":["import type { UseAwaitTxParameters } from \"@/hooks/txs/queries/useAwaitTx\";\nimport { queryClient as _queryClient } from \"@/lib/queryClient\";\nimport { wagmiConfig as _wagmiConfig } from \"@/lib/web3/wagmi/config\";\nimport type { QueryClient } from \"@tanstack/react-query\";\n\nimport { assert, type MarkRequired } from \"ts-essentials\";\nimport { type ReplacementReturnType, type TransactionReceipt } from \"viem\";\n\nimport { waitForTransactionReceiptQueryOptions } from \"wagmi/query\";\nimport { SAFE_CALLS_WAIT_TIMEOUT } from \"@/lib/constants\";\nimport { type Chain } from \"wagmi/chains\";\nimport { getConnection, getConnectorClient } from \"@wagmi/core\";\nimport {\n isConnectorWithSafeIframeProvider,\n isExternalConnectorSafeWalletConnect,\n} from \"@/components/web3/ConnectExternalProvider/utils\";\nimport { isWalletConnectConnectorWithSafe } from \"@/hooks/connectors/useIsSafeThroughWalletConnect\";\nimport { ensureCallsStatusFactory } from \"./ensureCallsStatus\";\nimport { getLogger } from \"@/core/logger\";\n\ntype OnReplacedCb = (data: ReplacementReturnType<Chain>) => void;\n\nexport type EnsureTxReceiptFn = (\n options: MarkRequired<\n Pick<UseAwaitTxParameters, \"hash\" | \"chainId\" | \"confirmations\">,\n \"hash\" | \"chainId\"\n > & {\n onReplaced?: OnReplacedCb;\n }\n) => Promise<TransactionReceipt>;\n\ntype EnsureTxReceiptFactory = (params?: {\n queryClient?: QueryClient;\n wagmiConfig?: typeof _wagmiConfig;\n isSafe?: boolean;\n}) => EnsureTxReceiptFn;\n\nconst logger = getLogger(\"Transactions:EnsureTxReceipt\");\n\nexport const ensureTxReceiptFactory: EnsureTxReceiptFactory =\n (options = {}) =>\n async ({ hash, chainId, confirmations, onReplaced }) => {\n const {\n queryClient = _queryClient,\n wagmiConfig = _wagmiConfig,\n isSafe: _isSafe,\n } = options;\n const { connector } = getConnection(wagmiConfig);\n let isWConnectConnectorWithSafe = false;\n let isConnectedToSafeIframe = false;\n if (connector) {\n isWConnectConnectorWithSafe =\n // can determine sync from connector.type and connector.id in case of external provider\n isExternalConnectorSafeWalletConnect(connector);\n // can determine sync from connector.type and connector.id in case of Safe Iframe provider,\n // whether as external provider or in safe connector\n isConnectedToSafeIframe = isConnectorWithSafeIframeProvider(connector);\n if (!isWConnectConnectorWithSafe && !isConnectedToSafeIframe) {\n // neither External Safe WalletConnect connector nor Safe Iframe connector,\n // so we check if it's a WalletConnect connector with Safe\n isWConnectConnectorWithSafe =\n await isWalletConnectConnectorWithSafe(connector);\n }\n }\n const isConnectedToSafe =\n isWConnectConnectorWithSafe || isConnectedToSafeIframe;\n\n const isSafe = _isSafe || isConnectedToSafe;\n\n const timeout = isSafe\n ? SAFE_CALLS_WAIT_TIMEOUT\n : SAFE_CALLS_WAIT_TIMEOUT / 2; // by default timeout is set to 0 inside waitForTransactionReceipt,\n // which makes the receipt query never resolve if the tx is dropped\n\n let config = wagmiConfig;\n let realtxHash = hash;\n\n // always use connector client if connected through native safe connector.\n // safe provider returns a safeTxHash that is different from a real tx hash.\n if (isConnectedToSafeIframe) {\n const safeClient = await getConnectorClient(wagmiConfig, {\n chainId,\n connector,\n });\n\n // force waitForTransactionReceiptQueryOptions to use SafeClient internally\n config = {\n ...wagmiConfig,\n // doesn't work with Safe through WalletConnect connector\n getClient: (options) => {\n assert(!options || options.chainId === chainId, \"chainId mismatch\");\n return safeClient;\n },\n } as typeof wagmiConfig;\n } else if (isWConnectConnectorWithSafe) {\n /**\n * When Safe is connected through WalletConnect\n * (whether as external provider or in WalletConnect connector),\n * the resulting provider only ever returns safeTxHash in response to eth_sendTransaction.\n * And the provider never returns any kind of result in response to eth_getTransactionReceipt\n * or eth_getTransactionByHash for that safeTxHash.\n * Safe iframe provider does return real txHash's receipt in response to eth_getTransactionReceipt for safeTxHash.\n * But Safe through WalletConnect never does that.\n * Options:\n * 1. Use deprecated Safe API v1 to get the real tx hash and await its receipt\n * 2. Use Safe API v2 (optionally through safe-api-kit) but there an API key is required\n * 3. Safe SDK isn't an option as it communicates with Safe only from inside an iframe\n * 4. Surprisingly, wallet_getCallsStatus works with safeTxHash (at least with multiple signers)\n *\n * Here we go with option 4:\n * sendCallsId=safeTxHash -> getCallsStatus -> realTxHash=callsReceipt.txHash -> await receipt of realTxHash\n *\n * refs:\n * https://github.com/safe-global/safe-react-apps/issues/712\n * https://github.com/safe-global/safe-react-apps/issues/62\n */\n const ensureCallsStatus = ensureCallsStatusFactory({\n ...options,\n isSafe: true,\n });\n try {\n const callsStatusResult = await ensureCallsStatus({ id: hash });\n const classReceipt =\n callsStatusResult.receipts?.[callsStatusResult.receipts.length - 1];\n\n assert(\n classReceipt,\n `Transaction receipt not found for Safe tx through WalletConnect ${hash}, on chain ${chainId}`\n );\n\n realtxHash = classReceipt.transactionHash;\n } catch (error) {\n // it is possible Safe through WalletConnect could be connected but called with a past non-Safe tx from localStorage,\n // in that case we should try to get the tx receipt normally\n logger.error(\n \"Error getting calls status for Safe tx through WalletConnect\",\n { error }\n );\n }\n }\n\n // wagmi/core waitForTransactionReceipt throws on receipt.status==\"reverted\",\n // unlike viem waitForTransactionReceipt which returns the receipt as is\n const queryOptions = waitForTransactionReceiptQueryOptions(config, {\n hash: realtxHash,\n chainId,\n confirmations,\n timeout,\n onReplaced,\n });\n\n const receipt = await queryClient.ensureQueryData(queryOptions);\n\n return receipt;\n };\n"],"mappings":";;;;;;;;;;;;;AAqCA,IAAM8B,IAASX,EAAU,+BAA+B,EAE3CY,KACVR,IAAU,EAAE,KACb,OAAO,EAAES,SAAMC,YAASC,kBAAeT,oBAAiB;CACtD,IAAM,EACJxB,aAAAA,IAAcC,GACdC,aAAAA,IAAcC,GACdyB,QAAQM,MACNZ,GACE,EAAEa,iBAAcvB,EAAcV,EAAY,EAC5CkC,IAA8B,IAC9BC,IAA0B;CAC9B,AAAIF,MACFC,IAEErB,EAAqCoB,EAAU,EAGjDE,IAA0BvB,EAAkCqB,EAAU,EAClE,CAACC,KAA+B,CAACC,MAGnCD,IACE,MAAMpB,EAAiCmB,EAAU;CAQvD,IAAMI,IAFSL,KAFbE,KAA+BC,IAK7B3B,IACAA,IAA0B,GAG1B8B,IAAStC,GACTuC,IAAaV;CAIjB,IAAIM,GAAyB;EAC3B,IAAMK,IAAa,MAAM7B,EAAmBX,GAAa;GACvD8B;GACAG;GACD,CAAC;EAGFK,IAAS;GACP,GAAGtC;GAEHyC,YAAYrB,OACVjB,EAAO,CAACiB,KAAWA,EAAQU,YAAYA,GAAS,mBAAmB,EAC5DU;GAEV;QACI,IAAIN,GAA6B;EAsBtC,IAAMQ,IAAoB3B,EAAyB;GACjD,GAAGK;GACHM,QAAQ;GACT,CAAC;EACF,IAAI;GACF,IAAMiB,IAAoB,MAAMD,EAAkB,EAAEE,IAAIf,GAAM,CAAC,EACzDgB,IACJF,EAAkBG,WAAWH,EAAkBG,SAASC,SAAS;GAOnER,AALApC,EACE0C,GACA,mEAAmEhB,EAAI,aAAcC,IACtF,EAEDS,IAAaM,EAAaG;WACnBC,GAAO;GAGdtB,EAAOsB,MACL,gEACA,EAAEA,UACJ,CAAC;;;CAML,IAAMC,IAAe3C,EAAsC+B,GAAQ;EACjET,MAAMU;EACNT;EACAC;EACAM;EACAf;EACD,CAAC;CAIF,OAAO6B,MAFerD,EAAYsD,gBAAgBF,EAAa"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wagmi-register.d.ts","sourceRoot":"","sources":["../src/wagmi-register.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,QAAQ,OAAO,CAAC;IACrB,UAAU,QAAQ;QAChB,MAAM,EAAE,OAAO,WAAW,CAAC;KAC5B;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@velora-dex/widget",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"@tanstack/react-pacer": "^0.22.1",
|
|
80
80
|
"@tanstack/react-virtual": "^3.14.3",
|
|
81
81
|
"@uniswap/token-lists": "1.0.0-beta.34",
|
|
82
|
-
"@velora-dex/sdk": "10.0
|
|
82
|
+
"@velora-dex/sdk": "10.1.0",
|
|
83
83
|
"@wagmi/core": "^3.5.2",
|
|
84
84
|
"@walletconnect/ethereum-provider": "^2.21.5",
|
|
85
85
|
"axios": "^1.16.1",
|