@gardenfi/swap 0.0.2-beta.5 → 0.1.0
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/index24.cjs +1 -1
- package/dist/index24.js +2 -2
- package/dist/index29.cjs +1 -1
- package/dist/index29.js +1 -1
- package/dist/index30.cjs +1 -1
- package/dist/index30.js +2 -2
- package/dist/index304.cjs +1 -1
- package/dist/index304.js +1 -1
- package/dist/index305.cjs +1 -1
- package/dist/index305.js +1 -1
- package/dist/index361.cjs +1 -1
- package/dist/index361.js +3 -140
- package/dist/index362.cjs +1 -1
- package/dist/index362.js +140 -3
- package/dist/index39.cjs +1 -1
- package/dist/index39.js +24 -83
- package/dist/index40.cjs +1 -1
- package/dist/index40.js +15 -11
- package/dist/index41.cjs +1 -1
- package/dist/index41.js +103 -24
- package/dist/index42.cjs +1 -1
- package/dist/index42.js +86 -16
- package/dist/index43.cjs +1 -1
- package/dist/index43.js +11 -105
- package/package.json +5 -5
package/dist/index24.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),f=require("./index7.cjs"),w=require("./index23.cjs"),a=require("./index34.cjs"),p=require("@gardenfi/react-hooks"),S=require("@gardenfi/garden-book"),g=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),f=require("./index7.cjs"),w=require("./index23.cjs"),a=require("./index34.cjs"),p=require("@gardenfi/react-hooks"),S=require("@gardenfi/garden-book"),g=require("./index42.cjs"),d=require("./index43.cjs"),u=require("framer-motion"),T=()=>{const{transactions:c,isLoading:m}=w.transactionHistoryStore(),{allAssets:s}=f.assetInfoStore(),{pendingOrders:o}=p.useGarden(),i=t.useMemo(()=>c.filter(e=>a.getAssetFromSwap(e.source_swap,s)&&a.getAssetFromSwap(e.destination_swap,s)),[c,s]),l=t.useMemo(()=>(o==null?void 0:o.filter(e=>a.getAssetFromSwap(e.source_swap,s)&&a.getAssetFromSwap(e.destination_swap,s)))??[],[o,s]),n=t.useMemo(()=>[...l,...i],[l,i]);return t.createElement(u.AnimatePresence,{mode:"wait"},t.createElement(u.motion.div,{className:"flex w-full flex-col overflow-y-auto scrollbar-hide h-full"},m?t.createElement(d.TransactionsSkeleton,null):n.length===0?t.createElement(S.Typography,{size:"h5",className:"py-4 text-center"},"No transactions found."):n.map((e,r)=>t.createElement("div",{key:e.order_id||r,className:"w-full"},t.createElement(g.TransactionRow,{order:e,status:e.status,isLast:r===n.length-1,isFirst:r===0})))))};exports.Transactions=T;
|
package/dist/index24.js
CHANGED
|
@@ -4,8 +4,8 @@ import { transactionHistoryStore as u } from "./index23.js";
|
|
|
4
4
|
import { getAssetFromSwap as a } from "./index34.js";
|
|
5
5
|
import { useGarden as w } from "@gardenfi/react-hooks";
|
|
6
6
|
import { Typography as d } from "@gardenfi/garden-book";
|
|
7
|
-
import { TransactionRow as h } from "./
|
|
8
|
-
import { TransactionsSkeleton as y } from "./
|
|
7
|
+
import { TransactionRow as h } from "./index42.js";
|
|
8
|
+
import { TransactionsSkeleton as y } from "./index43.js";
|
|
9
9
|
import { AnimatePresence as E, motion as T } from "framer-motion";
|
|
10
10
|
const L = () => {
|
|
11
11
|
const { transactions: l, isLoading: f } = u(), { allAssets: e } = p(), { pendingOrders: o } = w(), m = i(
|
package/dist/index29.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),n=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),n=require("./index39.cjs"),s=({open:e,onClose:t,children:o})=>r.createElement(n.BottomSheet,{open:e,onClose:t},o);exports.ResponsiveModal=s;
|
package/dist/index29.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import r from "react";
|
|
2
|
-
import { BottomSheet as m } from "./
|
|
2
|
+
import { BottomSheet as m } from "./index39.js";
|
|
3
3
|
const a = ({ open: e, onClose: t, children: o }) => /* @__PURE__ */ r.createElement(m, { open: e, onClose: t }, o);
|
|
4
4
|
export {
|
|
5
5
|
a as ResponsiveModal
|
package/dist/index30.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("react"),se=require("./index6.cjs"),ae=require("./index7.cjs"),re=require("./
|
|
1
|
+
"use strict";const e=require("react"),se=require("./index6.cjs"),ae=require("./index7.cjs"),re=require("./index40.cjs"),o=require("@gardenfi/garden-book"),L=require("framer-motion"),ie=require("./index41.cjs"),oe=require("@gardenfi/utils"),le=require("./index34.cjs"),d=require("./index12.cjs"),ce=require("@gardenfi/orderbook"),ue=require("./index25.cjs"),me=({onSelect:O})=>{const{inputAsset:S,outputAsset:T,currentNetwork:R,showFeesAndRateDetails:j,showBtcAddress:G}=se.swapStore(),{allAssets:b,chains:r,modalOpenFor:f,isAssetModalOpen:w,closeAssetModal:N,balances:v}=ae.assetInfoStore(),{evmAddress:U,bitcoinAddress:W,starknetAddress:D,suiAddress:K,solanaAddress:P}=ue.useAddresses(),[s,p]=e.useState(),[k,I]=e.useState(""),[A,q]=e.useState(),[B,$]=e.useState(),[V,H]=e.useState(""),[h]=e.useState(5),M=e.useRef(null),[y,g]=e.useState(!1),z=typeof window<"u"?window.innerWidth<768:!1,_=(j?G?d.HEIGHTS.large:d.HEIGHTS.medium:d.HEIGHTS.small)-d.BUFFER_HEIGHT.large,l=e.useMemo(()=>{const t=["bitcoin","ethereum","solana","base","arbitrum","starknet"];return r?[...r].sort((a,c)=>{const i=t.findIndex(m=>a.chainName.toLowerCase().includes(m)),u=t.findIndex(m=>c.chainName.toLowerCase().includes(m));return i===-1?1:u===-1?-1:i-u}):[]},[r]),J=e.useMemo(()=>f===d.IOType.input?T:S,[f,S,T]),C=e.useMemo(()=>{const t=k?B:A;return!t&&l.length===0?[]:t&&t.sort((n,a)=>{const c=r==null?void 0:r.find(u=>u.chain===n.chain),i=r==null?void 0:r.find(u=>u.chain===a.chain);if(c&&i){const u=l.findIndex(E=>E.chain===c.chain),m=l.findIndex(E=>E.chain===i.chain);return u-m}return 0}).filter(n=>!s||n.chain===s.chain).map(n=>{const a=r==null?void 0:r.find(ne=>ne.chain===n.chain),c=ce.ChainAsset.from(n).toString(),i=v==null?void 0:v[c],u=n.price??0,m=i&&n&&i.toString()==="0"?"":i?le.formatAmount(i.toString(),n.decimals,Math.min(n.decimals,8)):void 0,E=m&&(Number(m)*Number(u)).toFixed(5);return{asset:n,network:a,formattedBalance:m,fiatBalance:E}})},[B,A,l,r,s,v,k]),F=!!U||!!W||!!D||!!P||!!K,x=e.useMemo(()=>F?C&&[...C].sort((t,n)=>{const a=t.fiatBalance?Number(t.fiatBalance):0;return(n.fiatBalance?Number(n.fiatBalance):0)-a}):C,[C,F]),Q=e.useMemo(()=>{const t=l.slice(0,h);return s&&!t.find(n=>n.chain===s.chain)?[s,...t.slice(0,h-1)]:t},[l,h,s]),X=t=>{if(!A)return;const n=t.target.value.toLowerCase();if(I(n),!n){$(void 0);return}$(A.filter(a=>{var c,i;return((c=a.name)==null?void 0:c.toLowerCase().includes(n))||((i=a.symbol)==null?void 0:i.toLowerCase().includes(n))}))},Y=()=>g(!1),Z=t=>{(s==null?void 0:s.chain)===t.chain?p(void 0):p(t),g(!1)},ee=t=>{O(t),N(),setTimeout(()=>{p(void 0),I("")},700),g(!1)},te=()=>{N(),setTimeout(()=>{p(void 0),I("")},700),g(!1)};return e.useEffect(()=>{if(!b)return;const t=f===d.IOType.input?T:S;if(!t||f===d.IOType.input)q([...b]);else{const n=b.filter(a=>`${a.chain}-${a.symbol}`!=`${t.chain}-${t.symbol}`);q([...n,t])}},[b,J,f]),e.useEffect(()=>{w||(g(!1),N())},[N,w]),e.useEffect(()=>{w&&M.current&&setTimeout(()=>{var t;return(t=M.current)==null?void 0:t.focus()},100)},[w]),e.createElement(e.Fragment,null,y&&e.createElement(ie.AvailableChainsSidebar,{show:y,chains:[...l],hide:Y,onClick:Z}),e.createElement(L.AnimatePresence,{mode:"wait"},e.createElement(L.motion.div,{key:"assetModal",initial:{opacity:1},animate:{opacity:y?0:1},transition:{duration:y?.32:.45,delay:y?0:.25,ease:"easeOut"},className:"left-auto top-60 z-30 flex flex-col gap-3 rounded-[20px] w-full"},e.createElement("div",{className:"flex items-center justify-between p-1"},e.createElement(o.Typography,{size:"h4",weight:"medium"},`Select token to ${f===d.IOType.input?"send":"receive"}`),e.createElement(o.CloseIcon,{className:"hidden cursor-pointer sm:visible sm:block",onClick:te})),e.createElement("div",{className:"flex w-full flex-wrap gap-3"},e.createElement("div",{className:`flex w-full ${z?"gap-2":"gap-3"}`},Q.map((t,n)=>e.createElement("button",{key:t.chainId,className:`relative flex h-12 flex-1 items-center justify-center gap-2 overflow-visible rounded-xl outline-none duration-300 ease-in-out ${!s||t.chain!==s.chain?"!bg-white/50":"!bg-white"}`,onMouseEnter:()=>H(t.chainName),onMouseLeave:()=>H(""),onClick:()=>s&&t.chain===s.chain?p(void 0):p(t)},e.createElement("img",{src:t.iconUrl,alt:t.chainName,className:"h-5 w-5 rounded-full"}),V===t.chainName&&e.createElement(re.ChainsTooltip,{chain:t.chainName,className:`${R===oe.Network.TESTNET?n===0?"translate-x-7":l.length-h===0&&n===h-1&&z?"-translate-x-4":"":""}`}))),l.length>h&&e.createElement("button",{className:"h-12 w-12 cursor-pointer flex items-center justify-center rounded-xl !bg-white/50 p-4 duration-300 ease-in-out",onClick:()=>g(!0)},e.createElement(o.Typography,{size:"h4",weight:"regular",className:"!flex !cursor-pointer !items-center !text-mid-grey !text-center"},"+",l.length-h)))),e.createElement("div",{className:"flex w-full items-center justify-between rounded-2xl bg-white/50 px-4 py-[10px]"},e.createElement("div",{className:"flex flex-grow items-center"},e.createElement(o.Typography,{size:"h4",weight:"regular",className:"gf-w-full"},e.createElement("input",{ref:M,className:"w-full bg-transparent outline-none placeholder:text-mid-grey focus:outline-none",type:"text",value:k,placeholder:"Search assets",onChange:X}))),e.createElement(o.SearchIcon,null)),e.createElement("div",{className:"flex h-full flex-col overflow-auto rounded-2xl !bg-white"},e.createElement("div",{className:"px-4 pb-2 pt-2"},e.createElement(o.Typography,{size:"h5",weight:"medium"},s?`Assets on ${s.chainName}`:"Assets")),e.createElement(o.GradientScroll,{height:_,gradientHeight:42,onClose:!w},x&&x.length>0?x==null?void 0:x.map(({asset:t,network:n,formattedBalance:a})=>e.createElement("div",{key:`${t.chain}-${t.symbol}`,className:"flex w-full cursor-pointer items-center justify-between gap-2 px-4 py-1.5 hover:bg-[#f4f0fc]",onClick:()=>ee(t)},e.createElement("div",{className:"flex w-full items-center gap-2"},e.createElement("div",{className:"w-10"},e.createElement(o.TokenNetworkLogos,{tokenLogo:t.icon,chainLogo:n==null?void 0:n.iconUrl})),e.createElement(o.Typography,{className:"w-2/3",size:"h5",breakpoints:{sm:"h4"},weight:"regular"},t.name)),e.createElement("div",{className:"flex items-center gap-1"},a&&e.createElement(o.Typography,{size:"h5",breakpoints:{sm:"h4"},weight:"regular",className:"!text-mid-grey"},a),e.createElement(o.Typography,{size:"h5",breakpoints:{sm:"h4"},weight:"regular",className:"!text-mid-grey"},t.symbol)))):e.createElement("div",{className:"flex min-h-[274px] w-full items-center justify-center"},e.createElement(o.Typography,{size:"h4",weight:"regular"},"No assets found.")))))))};module.exports=me;
|
package/dist/index30.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import t, { useState as f, useRef as ie, useMemo as N, useEffect as F } from "react";
|
|
2
2
|
import { swapStore as oe } from "./index6.js";
|
|
3
3
|
import { assetInfoStore as le } from "./index7.js";
|
|
4
|
-
import { ChainsTooltip as ce } from "./
|
|
4
|
+
import { ChainsTooltip as ce } from "./index40.js";
|
|
5
5
|
import { Typography as u, CloseIcon as me, SearchIcon as ue, GradientScroll as de, TokenNetworkLogos as fe } from "@gardenfi/garden-book";
|
|
6
6
|
import { AnimatePresence as he, motion as pe } from "framer-motion";
|
|
7
|
-
import { AvailableChainsSidebar as ge } from "./
|
|
7
|
+
import { AvailableChainsSidebar as ge } from "./index41.js";
|
|
8
8
|
import { Network as we } from "@gardenfi/utils";
|
|
9
9
|
import { formatAmount as xe } from "./index34.js";
|
|
10
10
|
import { IOType as k, HEIGHTS as L, BUFFER_HEIGHT as be } from "./index12.js";
|
package/dist/index304.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./index201.cjs"),a=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./index201.cjs"),a=require("./index361.cjs"),c=require("./index230.cjs");function h(i){const r=i.replace(/^\.|\.$/gm,"");if(r.length===0)return new Uint8Array(1);const e=new Uint8Array(l.stringToBytes(r).byteLength+2);let t=0;const o=r.split(".");for(let s=0;s<o.length;s++){let n=l.stringToBytes(o[s]);n.byteLength>255&&(n=l.stringToBytes(a.encodeLabelhash(c.labelhash(o[s])))),e[t]=n.length,e.set(n,t+1),t+=n.length+1}return e.byteLength!==t+1?e.slice(0,t+1):e}exports.packetToBytes=h;
|
package/dist/index304.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { stringToBytes as i } from "./index201.js";
|
|
2
|
-
import { encodeLabelhash as h } from "./
|
|
2
|
+
import { encodeLabelhash as h } from "./index361.js";
|
|
3
3
|
import { labelhash as f } from "./index230.js";
|
|
4
4
|
function y(s) {
|
|
5
5
|
const o = s.replace(/^\.|\.$/gm, "");
|
package/dist/index305.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index362.cjs");async function f(i,{gatewayUrls:t,record:r}){return/eip155:/i.test(r)?l(i,{gatewayUrls:t,record:r}):e.parseAvatarUri({uri:r,gatewayUrls:t})}async function l(i,{gatewayUrls:t,record:r}){const n=e.parseNftUri(r),o=await e.getNftTokenUri(i,{nft:n}),{uri:a,isOnChain:c,isEncoded:p}=e.resolveAvatarUri({uri:o,gatewayUrls:t});if(c&&(a.includes("data:application/json;base64,")||a.startsWith("{"))){const u=p?atob(a.replace("data:application/json;base64,","")):a,d=JSON.parse(u);return e.parseAvatarUri({uri:e.getJsonImage(d),gatewayUrls:t})}let s=n.tokenID;return n.namespace==="erc1155"&&(s=s.replace("0x","").padStart(64,"0")),e.getMetadataAvatarUri({gatewayUrls:t,uri:a.replace(/(?:0x)?{id}/,s)})}exports.parseAvatarRecord=f;
|
package/dist/index305.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { parseAvatarUri as o, parseNftUri as f, getNftTokenUri as v, resolveAvatarUri as l, getJsonImage as A, getMetadataAvatarUri as N } from "./
|
|
1
|
+
import { parseAvatarUri as o, parseNftUri as f, getNftTokenUri as v, resolveAvatarUri as l, getJsonImage as A, getMetadataAvatarUri as N } from "./index362.js";
|
|
2
2
|
async function b(r, { gatewayUrls: t, record: e }) {
|
|
3
3
|
return /eip155:/i.test(e) ? U(r, { gatewayUrls: t, record: e }) : o({ uri: e, gatewayUrls: t });
|
|
4
4
|
}
|
package/dist/index361.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function t(e){return`[${e.slice(2)}]`}exports.encodeLabelhash=t;
|
package/dist/index361.js
CHANGED
|
@@ -1,143 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const b = /(?<protocol>https?:\/\/[^/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/, l = /^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?<target>[\w\-.]+))?(?<subtarget>\/.*)?$/, E = /^data:([a-zA-Z\-/+]*);base64,([^"].*)/, C = /^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;
|
|
4
|
-
async function k(t) {
|
|
5
|
-
try {
|
|
6
|
-
const e = await fetch(t, { method: "HEAD" });
|
|
7
|
-
if (e.status === 200) {
|
|
8
|
-
const n = e.headers.get("content-type");
|
|
9
|
-
return n == null ? void 0 : n.startsWith("image/");
|
|
10
|
-
}
|
|
11
|
-
return !1;
|
|
12
|
-
} catch (e) {
|
|
13
|
-
return typeof e == "object" && typeof e.response < "u" || !Object.hasOwn(globalThis, "Image") ? !1 : new Promise((n) => {
|
|
14
|
-
const r = new Image();
|
|
15
|
-
r.onload = () => {
|
|
16
|
-
n(!0);
|
|
17
|
-
}, r.onerror = () => {
|
|
18
|
-
n(!1);
|
|
19
|
-
}, r.src = t;
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
function w(t, e) {
|
|
24
|
-
return t ? t.endsWith("/") ? t.slice(0, -1) : t : e;
|
|
25
|
-
}
|
|
26
|
-
function N({ uri: t, gatewayUrls: e }) {
|
|
27
|
-
const n = E.test(t);
|
|
28
|
-
if (n)
|
|
29
|
-
return { uri: t, isOnChain: !0, isEncoded: n };
|
|
30
|
-
const r = w(e == null ? void 0 : e.ipfs, "https://ipfs.io"), a = w(e == null ? void 0 : e.arweave, "https://arweave.net"), i = t.match(b), { protocol: o, subpath: p, target: s, subtarget: m = "" } = (i == null ? void 0 : i.groups) || {}, u = o === "ipns:/" || p === "ipns/", h = o === "ipfs:/" || p === "ipfs/" || l.test(t);
|
|
31
|
-
if (t.startsWith("http") && !u && !h) {
|
|
32
|
-
let I = t;
|
|
33
|
-
return e != null && e.arweave && (I = t.replace(/https:\/\/arweave.net/g, e == null ? void 0 : e.arweave)), { uri: I, isOnChain: !1, isEncoded: !1 };
|
|
34
|
-
}
|
|
35
|
-
if ((u || h) && s)
|
|
36
|
-
return {
|
|
37
|
-
uri: `${r}/${u ? "ipns" : "ipfs"}/${s}${m}`,
|
|
38
|
-
isOnChain: !1,
|
|
39
|
-
isEncoded: !1
|
|
40
|
-
};
|
|
41
|
-
if (o === "ar:/" && s)
|
|
42
|
-
return {
|
|
43
|
-
uri: `${a}/${s}${m || ""}`,
|
|
44
|
-
isOnChain: !1,
|
|
45
|
-
isEncoded: !1
|
|
46
|
-
};
|
|
47
|
-
let c = t.replace(C, "");
|
|
48
|
-
if (c.startsWith("<svg") && (c = `data:image/svg+xml;base64,${btoa(c)}`), c.startsWith("data:") || c.startsWith("{"))
|
|
49
|
-
return {
|
|
50
|
-
uri: c,
|
|
51
|
-
isOnChain: !0,
|
|
52
|
-
isEncoded: !1
|
|
53
|
-
};
|
|
54
|
-
throw new d({ uri: t });
|
|
55
|
-
}
|
|
56
|
-
function O(t) {
|
|
57
|
-
if (typeof t != "object" || !("image" in t) && !("image_url" in t) && !("image_data" in t))
|
|
58
|
-
throw new A({ data: t });
|
|
59
|
-
return t.image || t.image_url || t.image_data;
|
|
60
|
-
}
|
|
61
|
-
async function D({ gatewayUrls: t, uri: e }) {
|
|
62
|
-
try {
|
|
63
|
-
const n = await fetch(e).then((a) => a.json());
|
|
64
|
-
return await R({
|
|
65
|
-
gatewayUrls: t,
|
|
66
|
-
uri: O(n)
|
|
67
|
-
});
|
|
68
|
-
} catch {
|
|
69
|
-
throw new d({ uri: e });
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
async function R({ gatewayUrls: t, uri: e }) {
|
|
73
|
-
const { uri: n, isOnChain: r } = N({ uri: e, gatewayUrls: t });
|
|
74
|
-
if (r || await k(n))
|
|
75
|
-
return n;
|
|
76
|
-
throw new d({ uri: e });
|
|
77
|
-
}
|
|
78
|
-
function z(t) {
|
|
79
|
-
let e = t;
|
|
80
|
-
e.startsWith("did:nft:") && (e = e.replace("did:nft:", "").replace(/_/g, "/"));
|
|
81
|
-
const [n, r, a] = e.split("/"), [i, o] = n.split(":"), [p, s] = r.split(":");
|
|
82
|
-
if (!i || i.toLowerCase() !== "eip155")
|
|
83
|
-
throw new f({ reason: "Only EIP-155 supported" });
|
|
84
|
-
if (!o)
|
|
85
|
-
throw new f({ reason: "Chain ID not found" });
|
|
86
|
-
if (!s)
|
|
87
|
-
throw new f({
|
|
88
|
-
reason: "Contract address not found"
|
|
89
|
-
});
|
|
90
|
-
if (!a)
|
|
91
|
-
throw new f({ reason: "Token ID not found" });
|
|
92
|
-
if (!p)
|
|
93
|
-
throw new f({ reason: "ERC namespace not found" });
|
|
94
|
-
return {
|
|
95
|
-
chainID: Number.parseInt(o, 10),
|
|
96
|
-
namespace: p.toLowerCase(),
|
|
97
|
-
contractAddress: s,
|
|
98
|
-
tokenID: a
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
async function W(t, { nft: e }) {
|
|
102
|
-
if (e.namespace === "erc721")
|
|
103
|
-
return g(t, {
|
|
104
|
-
address: e.contractAddress,
|
|
105
|
-
abi: [
|
|
106
|
-
{
|
|
107
|
-
name: "tokenURI",
|
|
108
|
-
type: "function",
|
|
109
|
-
stateMutability: "view",
|
|
110
|
-
inputs: [{ name: "tokenId", type: "uint256" }],
|
|
111
|
-
outputs: [{ name: "", type: "string" }]
|
|
112
|
-
}
|
|
113
|
-
],
|
|
114
|
-
functionName: "tokenURI",
|
|
115
|
-
args: [BigInt(e.tokenID)]
|
|
116
|
-
});
|
|
117
|
-
if (e.namespace === "erc1155")
|
|
118
|
-
return g(t, {
|
|
119
|
-
address: e.contractAddress,
|
|
120
|
-
abi: [
|
|
121
|
-
{
|
|
122
|
-
name: "uri",
|
|
123
|
-
type: "function",
|
|
124
|
-
stateMutability: "view",
|
|
125
|
-
inputs: [{ name: "_id", type: "uint256" }],
|
|
126
|
-
outputs: [{ name: "", type: "string" }]
|
|
127
|
-
}
|
|
128
|
-
],
|
|
129
|
-
functionName: "uri",
|
|
130
|
-
args: [BigInt(e.tokenID)]
|
|
131
|
-
});
|
|
132
|
-
throw new v({ namespace: e.namespace });
|
|
1
|
+
function n(e) {
|
|
2
|
+
return `[${e.slice(2)}]`;
|
|
133
3
|
}
|
|
134
4
|
export {
|
|
135
|
-
|
|
136
|
-
O as getJsonImage,
|
|
137
|
-
D as getMetadataAvatarUri,
|
|
138
|
-
W as getNftTokenUri,
|
|
139
|
-
k as isImageUri,
|
|
140
|
-
R as parseAvatarUri,
|
|
141
|
-
z as parseNftUri,
|
|
142
|
-
N as resolveAvatarUri
|
|
5
|
+
n as encodeLabelhash
|
|
143
6
|
};
|
package/dist/index362.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function t(e){return`[
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./index105.cjs"),a=require("./index189.cjs"),w=/(?<protocol>https?:\/\/[^/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,b=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?<target>[\w\-.]+))?(?<subtarget>\/.*)?$/,N=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,C=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function I(t){try{const e=await fetch(t,{method:"HEAD"});if(e.status===200){const n=e.headers.get("content-type");return n==null?void 0:n.startsWith("image/")}return!1}catch(e){return typeof e=="object"&&typeof e.response<"u"||!Object.hasOwn(globalThis,"Image")?!1:new Promise(n=>{const r=new Image;r.onload=()=>{n(!0)},r.onerror=()=>{n(!1)},r.src=t})}}function d(t,e){return t?t.endsWith("/")?t.slice(0,-1):t:e}function A({uri:t,gatewayUrls:e}){const n=N.test(t);if(n)return{uri:t,isOnChain:!0,isEncoded:n};const r=d(e==null?void 0:e.ipfs,"https://ipfs.io"),s=d(e==null?void 0:e.arweave,"https://arweave.net"),o=t.match(w),{protocol:c,subpath:p,target:i,subtarget:h=""}=(o==null?void 0:o.groups)||{},u=c==="ipns:/"||p==="ipns/",m=c==="ipfs:/"||p==="ipfs/"||b.test(t);if(t.startsWith("http")&&!u&&!m){let v=t;return e!=null&&e.arweave&&(v=t.replace(/https:\/\/arweave.net/g,e==null?void 0:e.arweave)),{uri:v,isOnChain:!1,isEncoded:!1}}if((u||m)&&i)return{uri:`${r}/${u?"ipns":"ipfs"}/${i}${h}`,isOnChain:!1,isEncoded:!1};if(c==="ar:/"&&i)return{uri:`${s}/${i}${h||""}`,isOnChain:!1,isEncoded:!1};let f=t.replace(C,"");if(f.startsWith("<svg")&&(f=`data:image/svg+xml;base64,${btoa(f)}`),f.startsWith("data:")||f.startsWith("{"))return{uri:f,isOnChain:!0,isEncoded:!1};throw new a.EnsAvatarUriResolutionError({uri:t})}function l(t){if(typeof t!="object"||!("image"in t)&&!("image_url"in t)&&!("image_data"in t))throw new a.EnsAvatarInvalidMetadataError({data:t});return t.image||t.image_url||t.image_data}async function k({gatewayUrls:t,uri:e}){try{const n=await fetch(e).then(s=>s.json());return await E({gatewayUrls:t,uri:l(n)})}catch{throw new a.EnsAvatarUriResolutionError({uri:e})}}async function E({gatewayUrls:t,uri:e}){const{uri:n,isOnChain:r}=A({uri:e,gatewayUrls:t});if(r||await I(n))return n;throw new a.EnsAvatarUriResolutionError({uri:e})}function R(t){let e=t;e.startsWith("did:nft:")&&(e=e.replace("did:nft:","").replace(/_/g,"/"));const[n,r,s]=e.split("/"),[o,c]=n.split(":"),[p,i]=r.split(":");if(!o||o.toLowerCase()!=="eip155")throw new a.EnsAvatarInvalidNftUriError({reason:"Only EIP-155 supported"});if(!c)throw new a.EnsAvatarInvalidNftUriError({reason:"Chain ID not found"});if(!i)throw new a.EnsAvatarInvalidNftUriError({reason:"Contract address not found"});if(!s)throw new a.EnsAvatarInvalidNftUriError({reason:"Token ID not found"});if(!p)throw new a.EnsAvatarInvalidNftUriError({reason:"ERC namespace not found"});return{chainID:Number.parseInt(c,10),namespace:p.toLowerCase(),contractAddress:i,tokenID:s}}async function O(t,{nft:e}){if(e.namespace==="erc721")return g.readContract(t,{address:e.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(e.tokenID)]});if(e.namespace==="erc1155")return g.readContract(t,{address:e.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(e.tokenID)]});throw new a.EnsAvatarUnsupportedNamespaceError({namespace:e.namespace})}exports.getGateway=d;exports.getJsonImage=l;exports.getMetadataAvatarUri=k;exports.getNftTokenUri=O;exports.isImageUri=I;exports.parseAvatarUri=E;exports.parseNftUri=R;exports.resolveAvatarUri=A;
|
package/dist/index362.js
CHANGED
|
@@ -1,6 +1,143 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { readContract as g } from "./index105.js";
|
|
2
|
+
import { EnsAvatarUriResolutionError as d, EnsAvatarInvalidNftUriError as f, EnsAvatarUnsupportedNamespaceError as v, EnsAvatarInvalidMetadataError as A } from "./index189.js";
|
|
3
|
+
const b = /(?<protocol>https?:\/\/[^/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/, l = /^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?<target>[\w\-.]+))?(?<subtarget>\/.*)?$/, E = /^data:([a-zA-Z\-/+]*);base64,([^"].*)/, C = /^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;
|
|
4
|
+
async function k(t) {
|
|
5
|
+
try {
|
|
6
|
+
const e = await fetch(t, { method: "HEAD" });
|
|
7
|
+
if (e.status === 200) {
|
|
8
|
+
const n = e.headers.get("content-type");
|
|
9
|
+
return n == null ? void 0 : n.startsWith("image/");
|
|
10
|
+
}
|
|
11
|
+
return !1;
|
|
12
|
+
} catch (e) {
|
|
13
|
+
return typeof e == "object" && typeof e.response < "u" || !Object.hasOwn(globalThis, "Image") ? !1 : new Promise((n) => {
|
|
14
|
+
const r = new Image();
|
|
15
|
+
r.onload = () => {
|
|
16
|
+
n(!0);
|
|
17
|
+
}, r.onerror = () => {
|
|
18
|
+
n(!1);
|
|
19
|
+
}, r.src = t;
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function w(t, e) {
|
|
24
|
+
return t ? t.endsWith("/") ? t.slice(0, -1) : t : e;
|
|
25
|
+
}
|
|
26
|
+
function N({ uri: t, gatewayUrls: e }) {
|
|
27
|
+
const n = E.test(t);
|
|
28
|
+
if (n)
|
|
29
|
+
return { uri: t, isOnChain: !0, isEncoded: n };
|
|
30
|
+
const r = w(e == null ? void 0 : e.ipfs, "https://ipfs.io"), a = w(e == null ? void 0 : e.arweave, "https://arweave.net"), i = t.match(b), { protocol: o, subpath: p, target: s, subtarget: m = "" } = (i == null ? void 0 : i.groups) || {}, u = o === "ipns:/" || p === "ipns/", h = o === "ipfs:/" || p === "ipfs/" || l.test(t);
|
|
31
|
+
if (t.startsWith("http") && !u && !h) {
|
|
32
|
+
let I = t;
|
|
33
|
+
return e != null && e.arweave && (I = t.replace(/https:\/\/arweave.net/g, e == null ? void 0 : e.arweave)), { uri: I, isOnChain: !1, isEncoded: !1 };
|
|
34
|
+
}
|
|
35
|
+
if ((u || h) && s)
|
|
36
|
+
return {
|
|
37
|
+
uri: `${r}/${u ? "ipns" : "ipfs"}/${s}${m}`,
|
|
38
|
+
isOnChain: !1,
|
|
39
|
+
isEncoded: !1
|
|
40
|
+
};
|
|
41
|
+
if (o === "ar:/" && s)
|
|
42
|
+
return {
|
|
43
|
+
uri: `${a}/${s}${m || ""}`,
|
|
44
|
+
isOnChain: !1,
|
|
45
|
+
isEncoded: !1
|
|
46
|
+
};
|
|
47
|
+
let c = t.replace(C, "");
|
|
48
|
+
if (c.startsWith("<svg") && (c = `data:image/svg+xml;base64,${btoa(c)}`), c.startsWith("data:") || c.startsWith("{"))
|
|
49
|
+
return {
|
|
50
|
+
uri: c,
|
|
51
|
+
isOnChain: !0,
|
|
52
|
+
isEncoded: !1
|
|
53
|
+
};
|
|
54
|
+
throw new d({ uri: t });
|
|
55
|
+
}
|
|
56
|
+
function O(t) {
|
|
57
|
+
if (typeof t != "object" || !("image" in t) && !("image_url" in t) && !("image_data" in t))
|
|
58
|
+
throw new A({ data: t });
|
|
59
|
+
return t.image || t.image_url || t.image_data;
|
|
60
|
+
}
|
|
61
|
+
async function D({ gatewayUrls: t, uri: e }) {
|
|
62
|
+
try {
|
|
63
|
+
const n = await fetch(e).then((a) => a.json());
|
|
64
|
+
return await R({
|
|
65
|
+
gatewayUrls: t,
|
|
66
|
+
uri: O(n)
|
|
67
|
+
});
|
|
68
|
+
} catch {
|
|
69
|
+
throw new d({ uri: e });
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
async function R({ gatewayUrls: t, uri: e }) {
|
|
73
|
+
const { uri: n, isOnChain: r } = N({ uri: e, gatewayUrls: t });
|
|
74
|
+
if (r || await k(n))
|
|
75
|
+
return n;
|
|
76
|
+
throw new d({ uri: e });
|
|
77
|
+
}
|
|
78
|
+
function z(t) {
|
|
79
|
+
let e = t;
|
|
80
|
+
e.startsWith("did:nft:") && (e = e.replace("did:nft:", "").replace(/_/g, "/"));
|
|
81
|
+
const [n, r, a] = e.split("/"), [i, o] = n.split(":"), [p, s] = r.split(":");
|
|
82
|
+
if (!i || i.toLowerCase() !== "eip155")
|
|
83
|
+
throw new f({ reason: "Only EIP-155 supported" });
|
|
84
|
+
if (!o)
|
|
85
|
+
throw new f({ reason: "Chain ID not found" });
|
|
86
|
+
if (!s)
|
|
87
|
+
throw new f({
|
|
88
|
+
reason: "Contract address not found"
|
|
89
|
+
});
|
|
90
|
+
if (!a)
|
|
91
|
+
throw new f({ reason: "Token ID not found" });
|
|
92
|
+
if (!p)
|
|
93
|
+
throw new f({ reason: "ERC namespace not found" });
|
|
94
|
+
return {
|
|
95
|
+
chainID: Number.parseInt(o, 10),
|
|
96
|
+
namespace: p.toLowerCase(),
|
|
97
|
+
contractAddress: s,
|
|
98
|
+
tokenID: a
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
async function W(t, { nft: e }) {
|
|
102
|
+
if (e.namespace === "erc721")
|
|
103
|
+
return g(t, {
|
|
104
|
+
address: e.contractAddress,
|
|
105
|
+
abi: [
|
|
106
|
+
{
|
|
107
|
+
name: "tokenURI",
|
|
108
|
+
type: "function",
|
|
109
|
+
stateMutability: "view",
|
|
110
|
+
inputs: [{ name: "tokenId", type: "uint256" }],
|
|
111
|
+
outputs: [{ name: "", type: "string" }]
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
functionName: "tokenURI",
|
|
115
|
+
args: [BigInt(e.tokenID)]
|
|
116
|
+
});
|
|
117
|
+
if (e.namespace === "erc1155")
|
|
118
|
+
return g(t, {
|
|
119
|
+
address: e.contractAddress,
|
|
120
|
+
abi: [
|
|
121
|
+
{
|
|
122
|
+
name: "uri",
|
|
123
|
+
type: "function",
|
|
124
|
+
stateMutability: "view",
|
|
125
|
+
inputs: [{ name: "_id", type: "uint256" }],
|
|
126
|
+
outputs: [{ name: "", type: "string" }]
|
|
127
|
+
}
|
|
128
|
+
],
|
|
129
|
+
functionName: "uri",
|
|
130
|
+
args: [BigInt(e.tokenID)]
|
|
131
|
+
});
|
|
132
|
+
throw new v({ namespace: e.namespace });
|
|
3
133
|
}
|
|
4
134
|
export {
|
|
5
|
-
|
|
135
|
+
w as getGateway,
|
|
136
|
+
O as getJsonImage,
|
|
137
|
+
D as getMetadataAvatarUri,
|
|
138
|
+
W as getNftTokenUri,
|
|
139
|
+
k as isImageUri,
|
|
140
|
+
R as parseAvatarUri,
|
|
141
|
+
z as parseNftUri,
|
|
142
|
+
N as resolveAvatarUri
|
|
6
143
|
};
|
package/dist/index39.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react"),o=require("framer-motion"),c=({open:a,onClose:e,children:r})=>{const n=t=>{t.target===t.currentTarget&&e&&e()};return i.createElement(o.AnimatePresence,{mode:"wait"},a&&i.createElement(o.motion.div,{initial:{opacity:0,x:"100%"},animate:{opacity:1,x:"0%"},exit:{opacity:0,x:"100%"},transition:{type:"spring",stiffness:250,damping:30},className:"absolute top-0 left-0 p-3 w-full h-full bg-white/50 backdrop-blur-md rounded-t-2xl z-[99]",onClick:t=>{n(t),t.stopPropagation()}},r))};exports.BottomSheet=c;
|
package/dist/index39.js
CHANGED
|
@@ -1,90 +1,31 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { getAssetFromSwap as g, formatAmount as w, getDayDifference as C } from "./index34.js";
|
|
7
|
-
import { swapStore as N } from "./index6.js";
|
|
8
|
-
import { tabs as k, getApiEndpoint as O } from "./index12.js";
|
|
9
|
-
import { orderInProgressStore as T } from "./index14.js";
|
|
10
|
-
import { useGarden as $ } from "@gardenfi/react-hooks";
|
|
11
|
-
const M = (e) => {
|
|
12
|
-
switch (e) {
|
|
13
|
-
case t.Created:
|
|
14
|
-
return "Detecting deposit";
|
|
15
|
-
case t.Expired:
|
|
16
|
-
return "Expired";
|
|
17
|
-
case t.Initiated:
|
|
18
|
-
return "Deposit detected (0/1)";
|
|
19
|
-
case t.InitiateDetected:
|
|
20
|
-
return "Deposit detected (0/1)";
|
|
21
|
-
case t.AwaitingRedeem:
|
|
22
|
-
return "Redeeming";
|
|
23
|
-
case t.Refunded:
|
|
24
|
-
case t.AwaitingRefund:
|
|
25
|
-
case t.Redeemed:
|
|
26
|
-
return "Completed";
|
|
27
|
-
default:
|
|
28
|
-
return "In progress...";
|
|
29
|
-
}
|
|
30
|
-
}, K = ({
|
|
31
|
-
order: e,
|
|
32
|
-
status: i,
|
|
33
|
-
isLast: h,
|
|
34
|
-
isFirst: x
|
|
35
|
-
}) => {
|
|
36
|
-
const { source_swap: s, destination_swap: c } = e, { allAssets: m } = y(), { currentNetwork: E, setActiveTab: b } = N(), { setIsOpen: _, setOrder: v } = T(), { garden: d } = $(), r = o(
|
|
37
|
-
() => g(s, m),
|
|
38
|
-
[s, m]
|
|
39
|
-
), n = o(
|
|
40
|
-
() => g(c, m),
|
|
41
|
-
[c, m]
|
|
42
|
-
), l = o(
|
|
43
|
-
() => i && M(i),
|
|
44
|
-
[i]
|
|
45
|
-
), p = o(
|
|
46
|
-
() => r && w(
|
|
47
|
-
s.amount,
|
|
48
|
-
(r == null ? void 0 : r.decimals) ?? 0,
|
|
49
|
-
Math.min(r.decimals, 8)
|
|
50
|
-
),
|
|
51
|
-
[s.amount, r]
|
|
52
|
-
), u = o(
|
|
53
|
-
() => n && w(
|
|
54
|
-
c.amount,
|
|
55
|
-
(n == null ? void 0 : n.decimals) ?? 0,
|
|
56
|
-
Math.min(n.decimals, 8)
|
|
57
|
-
),
|
|
58
|
-
[c.amount, n]
|
|
59
|
-
), A = o(
|
|
60
|
-
() => C(e.created_at),
|
|
61
|
-
[e.created_at]
|
|
62
|
-
), D = () => {
|
|
63
|
-
if (!e.order_id || !d) return;
|
|
64
|
-
if (i === t.Created && S(e.source_swap.chain)) {
|
|
65
|
-
_(!0), b(k.swap), v(d, e.order_id);
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
const I = O(E).explorer;
|
|
69
|
-
window.open(`${I}/order/${e.order_id}`, "_blank");
|
|
1
|
+
import i from "react";
|
|
2
|
+
import { AnimatePresence as n, motion as l } from "framer-motion";
|
|
3
|
+
const p = ({ open: a, onClose: e, children: o }) => {
|
|
4
|
+
const r = (t) => {
|
|
5
|
+
t.target === t.currentTarget && e && e();
|
|
70
6
|
};
|
|
71
|
-
return
|
|
72
|
-
|
|
7
|
+
return /* @__PURE__ */ i.createElement(n, { mode: "wait" }, a && /* @__PURE__ */ i.createElement(
|
|
8
|
+
l.div,
|
|
73
9
|
{
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
10
|
+
initial: { opacity: 0, x: "100%" },
|
|
11
|
+
animate: { opacity: 1, x: "0%" },
|
|
12
|
+
exit: {
|
|
13
|
+
opacity: 0,
|
|
14
|
+
x: "100%"
|
|
15
|
+
},
|
|
16
|
+
transition: {
|
|
17
|
+
type: "spring",
|
|
18
|
+
stiffness: 250,
|
|
19
|
+
damping: 30
|
|
20
|
+
},
|
|
21
|
+
className: "absolute top-0 left-0 p-3 w-full h-full bg-white/50 backdrop-blur-md rounded-t-2xl z-[99]",
|
|
22
|
+
onClick: (t) => {
|
|
23
|
+
r(t), t.stopPropagation();
|
|
84
24
|
}
|
|
85
|
-
|
|
25
|
+
},
|
|
26
|
+
o
|
|
86
27
|
));
|
|
87
28
|
};
|
|
88
29
|
export {
|
|
89
|
-
|
|
30
|
+
p as BottomSheet
|
|
90
31
|
};
|
package/dist/index40.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),o=require("@gardenfi/garden-book"),r=({chain:t,className:a})=>e.createElement("div",{className:"absolute z-50 mx-auto -mt-[84px]"},e.createElement("div",{className:`flex text-nowrap rounded-2xl bg-white px-3 py-2 shadow-custom ${a}`},e.createElement(o.Typography,{size:"h5",weight:"medium",className:"text-center !text-dark-grey"},t)));exports.ChainsTooltip=r;
|
package/dist/index40.js
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import e from "react";
|
|
2
|
-
import {
|
|
3
|
-
const s = () => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import { Typography as r } from "@gardenfi/garden-book";
|
|
3
|
+
const s = ({ chain: t, className: a }) => /* @__PURE__ */ e.createElement("div", { className: "absolute z-50 mx-auto -mt-[84px]" }, /* @__PURE__ */ e.createElement(
|
|
4
|
+
"div",
|
|
5
|
+
{
|
|
6
|
+
className: `flex text-nowrap rounded-2xl bg-white px-3 py-2 shadow-custom ${a}`
|
|
7
|
+
},
|
|
8
|
+
/* @__PURE__ */ e.createElement(
|
|
9
|
+
r,
|
|
7
10
|
{
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
size: "h5",
|
|
12
|
+
weight: "medium",
|
|
13
|
+
className: "text-center !text-dark-grey"
|
|
10
14
|
},
|
|
11
|
-
t
|
|
12
|
-
)
|
|
13
|
-
|
|
15
|
+
t
|
|
16
|
+
)
|
|
17
|
+
));
|
|
14
18
|
export {
|
|
15
|
-
s as
|
|
19
|
+
s as ChainsTooltip
|
|
16
20
|
};
|
package/dist/index41.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),a=require("@gardenfi/garden-book"),c=require("framer-motion"),N=require("./index75.cjs"),b=require("./index6.cjs"),i=require("./index12.cjs"),v=({show:n,chains:r,hide:m,onClick:u})=>{const[l,f]=e.useState(""),d=e.useRef(null),{isMobile:p}=N.viewPortStore(),{showFeesAndRateDetails:h,showBtcAddress:g}=b.swapStore(),w=(h?g?i.HEIGHTS.large:i.HEIGHTS.medium:i.HEIGHTS.small)-i.BUFFER_HEIGHT.medium,x={initial:{x:"100%",opacity:0},animate:{x:n?0:"100%",opacity:n?1:0},transition:{type:"tween",ease:"easeInOut",stiffness:200,damping:25,mass:.8,duration:.4}},y={initial:{y:"100%",opacity:0},animate:{y:n?0:"100%",opacity:n?1:0},transition:{type:"tween",ease:"easeInOut",stiffness:200,damping:25,mass:.8,duration:.4}},o=e.useMemo(()=>l?r.filter(t=>t.chainName.toLowerCase().includes(l.toLowerCase())).sort((t,s)=>t.chainName.localeCompare(s.chainName)):r.sort((t,s)=>t.chainName.localeCompare(s.chainName)),[r,l]),E=t=>{f(t.target.value)};return e.createElement(c.AnimatePresence,null,e.createElement(c.motion.div,{...p?y:x,className:"absolute left-0 top-0 z-50 w-full rounded-[16px] p-2"},e.createElement("div",{className:"transition-left left-auto top-60 z-40 flex w-full flex-col gap-3 duration-700 ease-cubic-in-out"},e.createElement("div",{className:"flex items-center justify-between p-1"},e.createElement(a.Typography,{size:"h4",weight:"medium"},"Select chain"),e.createElement(a.ArrowLeftIcon,{onClick:m,className:"cursor-pointer"})),e.createElement("div",{className:"flex w-full items-center justify-between rounded-2xl bg-white/50 px-4 py-[10px]"},e.createElement("div",{className:"flex flex-grow items-center"},e.createElement(a.Typography,{size:"h4",weight:"medium",className:"gf-w-full"},e.createElement("input",{ref:d,className:"w-full bg-transparent outline-none placeholder:text-mid-grey focus:outline-none",type:"text",value:l,placeholder:"Search chains",onChange:E}))),e.createElement(a.SearchIcon,null)),e.createElement("div",{className:"flex h-full flex-col overflow-auto rounded-2xl bg-white"},e.createElement(a.GradientScroll,{height:w,gradientHeight:42,className:"rounded-2xl"},e.createElement("div",{className:"flex w-full flex-col pb-2 pt-2"},o.length>0?o.map(t=>e.createElement("div",{key:t.chainId,className:"flex w-full cursor-pointer items-center justify-between hover:bg-off-white",onClick:()=>u(t)},e.createElement("div",{className:"flex w-full items-center gap-4 px-[14px] py-2"},e.createElement("img",{src:t.iconUrl,alt:t.chainName,className:"h-5 w-5 rounded-full"}),e.createElement(a.Typography,{size:"h5",breakpoints:{sm:"h4"},weight:"regular"},t.chainName)))):e.createElement("div",{className:"flex min-h-[334px] w-full items-center justify-center"},e.createElement(a.Typography,{size:"h4",weight:"medium",className:"text-center text-mid-grey"},"No chains found."))))))))};exports.AvailableChainsSidebar=v;
|
package/dist/index41.js
CHANGED
|
@@ -1,31 +1,110 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import e, { useState as E, useRef as y, useMemo as v } from "react";
|
|
2
|
+
import { Typography as l, ArrowLeftIcon as b, SearchIcon as C, GradientScroll as S } from "@gardenfi/garden-book";
|
|
3
|
+
import { AnimatePresence as I, motion as z } from "framer-motion";
|
|
4
|
+
import { viewPortStore as A } from "./index75.js";
|
|
5
|
+
import { swapStore as H } from "./index6.js";
|
|
6
|
+
import { HEIGHTS as s, BUFFER_HEIGHT as R } from "./index12.js";
|
|
7
|
+
const B = ({
|
|
8
|
+
show: a,
|
|
9
|
+
chains: i,
|
|
10
|
+
hide: m,
|
|
11
|
+
onClick: c
|
|
12
|
+
}) => {
|
|
13
|
+
const [n, u] = E(""), f = y(null), { isMobile: p } = A(), { showFeesAndRateDetails: d, showBtcAddress: h } = H(), x = (d ? h ? s.large : s.medium : s.small) - R.medium, g = {
|
|
14
|
+
initial: { x: "100%", opacity: 0 },
|
|
15
|
+
animate: {
|
|
16
|
+
x: a ? 0 : "100%",
|
|
17
|
+
opacity: a ? 1 : 0
|
|
18
|
+
},
|
|
19
|
+
transition: {
|
|
20
|
+
type: "tween",
|
|
21
|
+
ease: "easeInOut",
|
|
22
|
+
stiffness: 200,
|
|
23
|
+
damping: 25,
|
|
24
|
+
mass: 0.8,
|
|
25
|
+
duration: 0.4
|
|
26
|
+
}
|
|
27
|
+
}, w = {
|
|
28
|
+
initial: { y: "100%", opacity: 0 },
|
|
29
|
+
animate: {
|
|
30
|
+
y: a ? 0 : "100%",
|
|
31
|
+
opacity: a ? 1 : 0
|
|
32
|
+
},
|
|
33
|
+
transition: {
|
|
34
|
+
type: "tween",
|
|
35
|
+
ease: "easeInOut",
|
|
36
|
+
stiffness: 200,
|
|
37
|
+
damping: 25,
|
|
38
|
+
mass: 0.8,
|
|
39
|
+
duration: 0.4
|
|
40
|
+
}
|
|
41
|
+
}, o = v(() => n ? i.filter((t) => t.chainName.toLowerCase().includes(n.toLowerCase())).sort((t, r) => t.chainName.localeCompare(r.chainName)) : i.sort((t, r) => t.chainName.localeCompare(r.chainName)), [i, n]), N = (t) => {
|
|
42
|
+
u(t.target.value);
|
|
6
43
|
};
|
|
7
|
-
return /* @__PURE__ */
|
|
8
|
-
|
|
44
|
+
return /* @__PURE__ */ e.createElement(I, null, /* @__PURE__ */ e.createElement(
|
|
45
|
+
z.div,
|
|
9
46
|
{
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
exit: {
|
|
13
|
-
opacity: 0,
|
|
14
|
-
x: "100%"
|
|
15
|
-
},
|
|
16
|
-
transition: {
|
|
17
|
-
type: "spring",
|
|
18
|
-
stiffness: 250,
|
|
19
|
-
damping: 30
|
|
20
|
-
},
|
|
21
|
-
className: "absolute top-0 left-0 p-3 w-full h-full bg-white/50 backdrop-blur-md rounded-t-2xl z-[99]",
|
|
22
|
-
onClick: (t) => {
|
|
23
|
-
r(t), t.stopPropagation();
|
|
24
|
-
}
|
|
47
|
+
...p ? w : g,
|
|
48
|
+
className: "absolute left-0 top-0 z-50 w-full rounded-[16px] p-2"
|
|
25
49
|
},
|
|
26
|
-
|
|
50
|
+
/* @__PURE__ */ e.createElement("div", { className: "transition-left left-auto top-60 z-40 flex w-full flex-col gap-3 duration-700 ease-cubic-in-out" }, /* @__PURE__ */ e.createElement("div", { className: "flex items-center justify-between p-1" }, /* @__PURE__ */ e.createElement(l, { size: "h4", weight: "medium" }, "Select chain"), /* @__PURE__ */ e.createElement(b, { onClick: m, className: "cursor-pointer" })), /* @__PURE__ */ e.createElement("div", { className: "flex w-full items-center justify-between rounded-2xl bg-white/50 px-4 py-[10px]" }, /* @__PURE__ */ e.createElement("div", { className: "flex flex-grow items-center" }, /* @__PURE__ */ e.createElement(l, { size: "h4", weight: "medium", className: "gf-w-full" }, /* @__PURE__ */ e.createElement(
|
|
51
|
+
"input",
|
|
52
|
+
{
|
|
53
|
+
ref: f,
|
|
54
|
+
className: "w-full bg-transparent outline-none placeholder:text-mid-grey focus:outline-none",
|
|
55
|
+
type: "text",
|
|
56
|
+
value: n,
|
|
57
|
+
placeholder: "Search chains",
|
|
58
|
+
onChange: N
|
|
59
|
+
}
|
|
60
|
+
))), /* @__PURE__ */ e.createElement(C, null)), /* @__PURE__ */ e.createElement(
|
|
61
|
+
"div",
|
|
62
|
+
{
|
|
63
|
+
className: "flex h-full flex-col overflow-auto rounded-2xl bg-white"
|
|
64
|
+
},
|
|
65
|
+
/* @__PURE__ */ e.createElement(
|
|
66
|
+
S,
|
|
67
|
+
{
|
|
68
|
+
height: x,
|
|
69
|
+
gradientHeight: 42,
|
|
70
|
+
className: "rounded-2xl"
|
|
71
|
+
},
|
|
72
|
+
/* @__PURE__ */ e.createElement("div", { className: "flex w-full flex-col pb-2 pt-2" }, o.length > 0 ? o.map((t) => /* @__PURE__ */ e.createElement(
|
|
73
|
+
"div",
|
|
74
|
+
{
|
|
75
|
+
key: t.chainId,
|
|
76
|
+
className: "flex w-full cursor-pointer items-center justify-between hover:bg-off-white",
|
|
77
|
+
onClick: () => c(t)
|
|
78
|
+
},
|
|
79
|
+
/* @__PURE__ */ e.createElement("div", { className: "flex w-full items-center gap-4 px-[14px] py-2" }, /* @__PURE__ */ e.createElement(
|
|
80
|
+
"img",
|
|
81
|
+
{
|
|
82
|
+
src: t.iconUrl,
|
|
83
|
+
alt: t.chainName,
|
|
84
|
+
className: "h-5 w-5 rounded-full"
|
|
85
|
+
}
|
|
86
|
+
), /* @__PURE__ */ e.createElement(
|
|
87
|
+
l,
|
|
88
|
+
{
|
|
89
|
+
size: "h5",
|
|
90
|
+
breakpoints: { sm: "h4" },
|
|
91
|
+
weight: "regular"
|
|
92
|
+
},
|
|
93
|
+
t.chainName
|
|
94
|
+
))
|
|
95
|
+
)) : /* @__PURE__ */ e.createElement("div", { className: "flex min-h-[334px] w-full items-center justify-center" }, /* @__PURE__ */ e.createElement(
|
|
96
|
+
l,
|
|
97
|
+
{
|
|
98
|
+
size: "h4",
|
|
99
|
+
weight: "medium",
|
|
100
|
+
className: "text-center text-mid-grey"
|
|
101
|
+
},
|
|
102
|
+
"No chains found."
|
|
103
|
+
)))
|
|
104
|
+
)
|
|
105
|
+
))
|
|
27
106
|
));
|
|
28
107
|
};
|
|
29
108
|
export {
|
|
30
|
-
|
|
109
|
+
B as AvailableChainsSidebar
|
|
31
110
|
};
|
package/dist/index42.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),g=require("@gardenfi/garden-book"),A=require("./index36.cjs"),t=require("@gardenfi/orderbook"),I=require("./index7.cjs"),a=require("./index34.cjs"),M=require("./index6.cjs"),w=require("./index12.cjs"),_=require("./index14.cjs"),v=require("@gardenfi/react-hooks"),R=r=>{switch(r){case t.OrderStatus.Created:return"Detecting deposit";case t.OrderStatus.Expired:return"Expired";case t.OrderStatus.Initiated:return"Deposit detected (0/1)";case t.OrderStatus.InitiateDetected:return"Deposit detected (0/1)";case t.OrderStatus.AwaitingRedeem:return"Redeeming";case t.OrderStatus.Refunded:case t.OrderStatus.AwaitingRefund:case t.OrderStatus.Redeemed:return"Completed";default:return"In progress..."}},k=({order:r,status:o,isLast:f,isFirst:S})=>{const{source_swap:c,destination_swap:i}=r,{allAssets:u}=I.assetInfoStore(),{currentNetwork:h,setActiveTab:O}=M.swapStore(),{setIsOpen:b,setOrder:E}=_.orderInProgressStore(),{garden:d}=v.useGarden(),n=e.useMemo(()=>a.getAssetFromSwap(c,u),[c,u]),s=e.useMemo(()=>a.getAssetFromSwap(i,u),[i,u]),l=e.useMemo(()=>o&&R(o),[o]),m=e.useMemo(()=>n&&a.formatAmount(c.amount,(n==null?void 0:n.decimals)??0,Math.min(n.decimals,8)),[c.amount,n]),p=e.useMemo(()=>s&&a.formatAmount(i.amount,(s==null?void 0:s.decimals)??0,Math.min(s.decimals,8)),[i.amount,s]),x=e.useMemo(()=>a.getDayDifference(r.created_at),[r.created_at]),q=()=>{if(!r.order_id||!d)return;if(o===t.OrderStatus.Created&&t.isBitcoin(r.source_swap.chain)){b(!0),O(w.tabs.swap),E(d,r.order_id);return}const y=w.getApiEndpoint(h).explorer;window.open(`${y}/order/${r.order_id}`,"_blank")};return!n||!s?null:e.createElement("div",null,!S&&e.createElement("div",{className:"h-px w-full bg-white/50"}),e.createElement("div",{className:`flex flex-col gap-1 p-4 ${f?"rounded-b-2xl":""} ${l!=="Expired"?"cursor-pointer hover:bg-white/50":""}`,onClick:q},e.createElement("div",{className:"flex flex-col gap-1"},m&&p&&e.createElement(A.SwapInfo,{sendAsset:n,receiveAsset:s,sendAmount:m,receiveAmount:p}),e.createElement("div",{className:"flex justify-between"},e.createElement(g.Typography,{size:"h5",weight:"regular"},l),e.createElement(g.Typography,{size:"h5",weight:"regular"},x)))))};exports.TransactionRow=k;
|
package/dist/index42.js
CHANGED
|
@@ -1,20 +1,90 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Typography as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import a, { useMemo as o } from "react";
|
|
2
|
+
import { Typography as f } from "@gardenfi/garden-book";
|
|
3
|
+
import { SwapInfo as R } from "./index36.js";
|
|
4
|
+
import { OrderStatus as t, isBitcoin as S } from "@gardenfi/orderbook";
|
|
5
|
+
import { assetInfoStore as y } from "./index7.js";
|
|
6
|
+
import { getAssetFromSwap as g, formatAmount as w, getDayDifference as C } from "./index34.js";
|
|
7
|
+
import { swapStore as N } from "./index6.js";
|
|
8
|
+
import { tabs as k, getApiEndpoint as O } from "./index12.js";
|
|
9
|
+
import { orderInProgressStore as T } from "./index14.js";
|
|
10
|
+
import { useGarden as $ } from "@gardenfi/react-hooks";
|
|
11
|
+
const M = (e) => {
|
|
12
|
+
switch (e) {
|
|
13
|
+
case t.Created:
|
|
14
|
+
return "Detecting deposit";
|
|
15
|
+
case t.Expired:
|
|
16
|
+
return "Expired";
|
|
17
|
+
case t.Initiated:
|
|
18
|
+
return "Deposit detected (0/1)";
|
|
19
|
+
case t.InitiateDetected:
|
|
20
|
+
return "Deposit detected (0/1)";
|
|
21
|
+
case t.AwaitingRedeem:
|
|
22
|
+
return "Redeeming";
|
|
23
|
+
case t.Refunded:
|
|
24
|
+
case t.AwaitingRefund:
|
|
25
|
+
case t.Redeemed:
|
|
26
|
+
return "Completed";
|
|
27
|
+
default:
|
|
28
|
+
return "In progress...";
|
|
29
|
+
}
|
|
30
|
+
}, K = ({
|
|
31
|
+
order: e,
|
|
32
|
+
status: i,
|
|
33
|
+
isLast: h,
|
|
34
|
+
isFirst: x
|
|
35
|
+
}) => {
|
|
36
|
+
const { source_swap: s, destination_swap: c } = e, { allAssets: m } = y(), { currentNetwork: E, setActiveTab: b } = N(), { setIsOpen: _, setOrder: v } = T(), { garden: d } = $(), r = o(
|
|
37
|
+
() => g(s, m),
|
|
38
|
+
[s, m]
|
|
39
|
+
), n = o(
|
|
40
|
+
() => g(c, m),
|
|
41
|
+
[c, m]
|
|
42
|
+
), l = o(
|
|
43
|
+
() => i && M(i),
|
|
44
|
+
[i]
|
|
45
|
+
), p = o(
|
|
46
|
+
() => r && w(
|
|
47
|
+
s.amount,
|
|
48
|
+
(r == null ? void 0 : r.decimals) ?? 0,
|
|
49
|
+
Math.min(r.decimals, 8)
|
|
50
|
+
),
|
|
51
|
+
[s.amount, r]
|
|
52
|
+
), u = o(
|
|
53
|
+
() => n && w(
|
|
54
|
+
c.amount,
|
|
55
|
+
(n == null ? void 0 : n.decimals) ?? 0,
|
|
56
|
+
Math.min(n.decimals, 8)
|
|
57
|
+
),
|
|
58
|
+
[c.amount, n]
|
|
59
|
+
), A = o(
|
|
60
|
+
() => C(e.created_at),
|
|
61
|
+
[e.created_at]
|
|
62
|
+
), D = () => {
|
|
63
|
+
if (!e.order_id || !d) return;
|
|
64
|
+
if (i === t.Created && S(e.source_swap.chain)) {
|
|
65
|
+
_(!0), b(k.swap), v(d, e.order_id);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const I = O(E).explorer;
|
|
69
|
+
window.open(`${I}/order/${e.order_id}`, "_blank");
|
|
70
|
+
};
|
|
71
|
+
return !r || !n ? null : /* @__PURE__ */ a.createElement("div", null, !x && /* @__PURE__ */ a.createElement("div", { className: "h-px w-full bg-white/50" }), /* @__PURE__ */ a.createElement(
|
|
72
|
+
"div",
|
|
10
73
|
{
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
className: "text-center !text-dark-grey"
|
|
74
|
+
className: `flex flex-col gap-1 p-4 ${h ? "rounded-b-2xl" : ""} ${l !== "Expired" ? "cursor-pointer hover:bg-white/50" : ""}`,
|
|
75
|
+
onClick: D
|
|
14
76
|
},
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
77
|
+
/* @__PURE__ */ a.createElement("div", { className: "flex flex-col gap-1" }, p && u && /* @__PURE__ */ a.createElement(
|
|
78
|
+
R,
|
|
79
|
+
{
|
|
80
|
+
sendAsset: r,
|
|
81
|
+
receiveAsset: n,
|
|
82
|
+
sendAmount: p,
|
|
83
|
+
receiveAmount: u
|
|
84
|
+
}
|
|
85
|
+
), /* @__PURE__ */ a.createElement("div", { className: "flex justify-between" }, /* @__PURE__ */ a.createElement(f, { size: "h5", weight: "regular" }, l), /* @__PURE__ */ a.createElement(f, { size: "h5", weight: "regular" }, A)))
|
|
86
|
+
));
|
|
87
|
+
};
|
|
18
88
|
export {
|
|
19
|
-
|
|
89
|
+
K as TransactionRow
|
|
20
90
|
};
|
package/dist/index43.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),l=require("framer-motion"),r=()=>{const t=()=>e.createElement("div",{className:"flex flex-col gap-1"},e.createElement("div",{className:"flex justify-between gap-4"},e.createElement("div",{className:"h-5 w-24 animate-pulse rounded-md bg-gray-200"}),e.createElement("div",{className:"h-5 w-6 animate-pulse rounded-full bg-gray-200"}),e.createElement("div",{className:"h-5 w-24 animate-pulse rounded-md bg-gray-200"})),e.createElement("div",{className:"flex justify-between"},e.createElement("div",{className:"h-4 w-28 animate-pulse rounded-md bg-gray-200"}),e.createElement("div",{className:"h-4 w-20 animate-pulse rounded-md bg-gray-200"})));return e.createElement(l.motion.div,{layout:!0,className:"flex flex-col"},Array.from({length:4}).map((n,a)=>e.createElement("div",{key:a,className:`bg-white/50 p-4 ${a===3?"rounded-b-2xl":""}`},t())))};exports.TransactionsSkeleton=r;
|
package/dist/index43.js
CHANGED
|
@@ -1,110 +1,16 @@
|
|
|
1
|
-
import e
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const B = ({
|
|
8
|
-
show: a,
|
|
9
|
-
chains: i,
|
|
10
|
-
hide: m,
|
|
11
|
-
onClick: c
|
|
12
|
-
}) => {
|
|
13
|
-
const [n, u] = E(""), f = y(null), { isMobile: p } = A(), { showFeesAndRateDetails: d, showBtcAddress: h } = H(), x = (d ? h ? s.large : s.medium : s.small) - R.medium, g = {
|
|
14
|
-
initial: { x: "100%", opacity: 0 },
|
|
15
|
-
animate: {
|
|
16
|
-
x: a ? 0 : "100%",
|
|
17
|
-
opacity: a ? 1 : 0
|
|
18
|
-
},
|
|
19
|
-
transition: {
|
|
20
|
-
type: "tween",
|
|
21
|
-
ease: "easeInOut",
|
|
22
|
-
stiffness: 200,
|
|
23
|
-
damping: 25,
|
|
24
|
-
mass: 0.8,
|
|
25
|
-
duration: 0.4
|
|
26
|
-
}
|
|
27
|
-
}, w = {
|
|
28
|
-
initial: { y: "100%", opacity: 0 },
|
|
29
|
-
animate: {
|
|
30
|
-
y: a ? 0 : "100%",
|
|
31
|
-
opacity: a ? 1 : 0
|
|
32
|
-
},
|
|
33
|
-
transition: {
|
|
34
|
-
type: "tween",
|
|
35
|
-
ease: "easeInOut",
|
|
36
|
-
stiffness: 200,
|
|
37
|
-
damping: 25,
|
|
38
|
-
mass: 0.8,
|
|
39
|
-
duration: 0.4
|
|
40
|
-
}
|
|
41
|
-
}, o = v(() => n ? i.filter((t) => t.chainName.toLowerCase().includes(n.toLowerCase())).sort((t, r) => t.chainName.localeCompare(r.chainName)) : i.sort((t, r) => t.chainName.localeCompare(r.chainName)), [i, n]), N = (t) => {
|
|
42
|
-
u(t.target.value);
|
|
43
|
-
};
|
|
44
|
-
return /* @__PURE__ */ e.createElement(I, null, /* @__PURE__ */ e.createElement(
|
|
45
|
-
z.div,
|
|
1
|
+
import e from "react";
|
|
2
|
+
import { motion as l } from "framer-motion";
|
|
3
|
+
const s = () => {
|
|
4
|
+
const t = () => /* @__PURE__ */ e.createElement("div", { className: "flex flex-col gap-1" }, /* @__PURE__ */ e.createElement("div", { className: "flex justify-between gap-4" }, /* @__PURE__ */ e.createElement("div", { className: "h-5 w-24 animate-pulse rounded-md bg-gray-200" }), /* @__PURE__ */ e.createElement("div", { className: "h-5 w-6 animate-pulse rounded-full bg-gray-200" }), /* @__PURE__ */ e.createElement("div", { className: "h-5 w-24 animate-pulse rounded-md bg-gray-200" })), /* @__PURE__ */ e.createElement("div", { className: "flex justify-between" }, /* @__PURE__ */ e.createElement("div", { className: "h-4 w-28 animate-pulse rounded-md bg-gray-200" }), /* @__PURE__ */ e.createElement("div", { className: "h-4 w-20 animate-pulse rounded-md bg-gray-200" })));
|
|
5
|
+
return /* @__PURE__ */ e.createElement(l.div, { layout: !0, className: "flex flex-col" }, Array.from({ length: 4 }).map((m, a) => /* @__PURE__ */ e.createElement(
|
|
6
|
+
"div",
|
|
46
7
|
{
|
|
47
|
-
|
|
48
|
-
className:
|
|
8
|
+
key: a,
|
|
9
|
+
className: `bg-white/50 p-4 ${a === 3 ? "rounded-b-2xl" : ""}`
|
|
49
10
|
},
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
{
|
|
53
|
-
ref: f,
|
|
54
|
-
className: "w-full bg-transparent outline-none placeholder:text-mid-grey focus:outline-none",
|
|
55
|
-
type: "text",
|
|
56
|
-
value: n,
|
|
57
|
-
placeholder: "Search chains",
|
|
58
|
-
onChange: N
|
|
59
|
-
}
|
|
60
|
-
))), /* @__PURE__ */ e.createElement(C, null)), /* @__PURE__ */ e.createElement(
|
|
61
|
-
"div",
|
|
62
|
-
{
|
|
63
|
-
className: "flex h-full flex-col overflow-auto rounded-2xl bg-white"
|
|
64
|
-
},
|
|
65
|
-
/* @__PURE__ */ e.createElement(
|
|
66
|
-
S,
|
|
67
|
-
{
|
|
68
|
-
height: x,
|
|
69
|
-
gradientHeight: 42,
|
|
70
|
-
className: "rounded-2xl"
|
|
71
|
-
},
|
|
72
|
-
/* @__PURE__ */ e.createElement("div", { className: "flex w-full flex-col pb-2 pt-2" }, o.length > 0 ? o.map((t) => /* @__PURE__ */ e.createElement(
|
|
73
|
-
"div",
|
|
74
|
-
{
|
|
75
|
-
key: t.chainId,
|
|
76
|
-
className: "flex w-full cursor-pointer items-center justify-between hover:bg-off-white",
|
|
77
|
-
onClick: () => c(t)
|
|
78
|
-
},
|
|
79
|
-
/* @__PURE__ */ e.createElement("div", { className: "flex w-full items-center gap-4 px-[14px] py-2" }, /* @__PURE__ */ e.createElement(
|
|
80
|
-
"img",
|
|
81
|
-
{
|
|
82
|
-
src: t.iconUrl,
|
|
83
|
-
alt: t.chainName,
|
|
84
|
-
className: "h-5 w-5 rounded-full"
|
|
85
|
-
}
|
|
86
|
-
), /* @__PURE__ */ e.createElement(
|
|
87
|
-
l,
|
|
88
|
-
{
|
|
89
|
-
size: "h5",
|
|
90
|
-
breakpoints: { sm: "h4" },
|
|
91
|
-
weight: "regular"
|
|
92
|
-
},
|
|
93
|
-
t.chainName
|
|
94
|
-
))
|
|
95
|
-
)) : /* @__PURE__ */ e.createElement("div", { className: "flex min-h-[334px] w-full items-center justify-center" }, /* @__PURE__ */ e.createElement(
|
|
96
|
-
l,
|
|
97
|
-
{
|
|
98
|
-
size: "h4",
|
|
99
|
-
weight: "medium",
|
|
100
|
-
className: "text-center text-mid-grey"
|
|
101
|
-
},
|
|
102
|
-
"No chains found."
|
|
103
|
-
)))
|
|
104
|
-
)
|
|
105
|
-
))
|
|
106
|
-
));
|
|
11
|
+
t()
|
|
12
|
+
)));
|
|
107
13
|
};
|
|
108
14
|
export {
|
|
109
|
-
|
|
15
|
+
s as TransactionsSkeleton
|
|
110
16
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gardenfi/swap",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "vite build",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"registry": "https://registry.npmjs.org/"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@gardenfi/core": "3.0
|
|
32
|
+
"@gardenfi/core": "3.1.0",
|
|
33
33
|
"@gardenfi/garden-book": "0.2.2",
|
|
34
|
-
"@gardenfi/orderbook": "3.0
|
|
35
|
-
"@gardenfi/react-hooks": "3.0
|
|
36
|
-
"@gardenfi/utils": "3.
|
|
34
|
+
"@gardenfi/orderbook": "3.1.0",
|
|
35
|
+
"@gardenfi/react-hooks": "3.1.0",
|
|
36
|
+
"@gardenfi/utils": "3.1.0",
|
|
37
37
|
"@mysten/sui": "^1.37.2",
|
|
38
38
|
"@number-flow/react": "^0.5.9",
|
|
39
39
|
"@solana/web3.js": "^1.98.2",
|