Add Privy type wallet

This commit is contained in:
2025-03-05 10:36:54 +07:00
parent 30bf9d26f6
commit 988cc9eb61
21 changed files with 287 additions and 53 deletions

View File

@@ -1,4 +1,4 @@
<mxfile host="app.diagrams.net" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36" version="26.0.14" pages="5"> <mxfile host="app.diagrams.net" agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36" version="26.0.16" pages="5">
<diagram id="r-WTTOEb8AyglykpmDMH" name="Pre-build"> <diagram id="r-WTTOEb8AyglykpmDMH" name="Pre-build">
<mxGraphModel dx="1919" dy="1012" grid="0" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="0" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0"> <mxGraphModel dx="1919" dy="1012" grid="0" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="0" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
<root> <root>
@@ -1439,7 +1439,7 @@
</mxGraphModel> </mxGraphModel>
</diagram> </diagram>
<diagram name="v2" id="QNzTR9byRf81KNjGaH7l"> <diagram name="v2" id="QNzTR9byRf81KNjGaH7l">
<mxGraphModel dx="1508" dy="1770" grid="0" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="0" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0"> <mxGraphModel dx="2432" dy="1887" grid="0" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="0" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
<root> <root>
<mxCell id="VxSGIQ4LdSJy6ndKUiif-0" /> <mxCell id="VxSGIQ4LdSJy6ndKUiif-0" />
<mxCell id="VxSGIQ4LdSJy6ndKUiif-1" parent="VxSGIQ4LdSJy6ndKUiif-0" /> <mxCell id="VxSGIQ4LdSJy6ndKUiif-1" parent="VxSGIQ4LdSJy6ndKUiif-0" />
@@ -1501,7 +1501,7 @@
<mxGeometry x="-164" y="135" width="110" height="32" as="geometry" /> <mxGeometry x="-164" y="135" width="110" height="32" as="geometry" />
</mxCell> </mxCell>
<mxCell id="VxSGIQ4LdSJy6ndKUiif-21" value="GMX" style="ellipse;shape=cloud;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;" parent="VxSGIQ4LdSJy6ndKUiif-1" vertex="1"> <mxCell id="VxSGIQ4LdSJy6ndKUiif-21" value="GMX" style="ellipse;shape=cloud;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;" parent="VxSGIQ4LdSJy6ndKUiif-1" vertex="1">
<mxGeometry x="1359" y="285.5" width="120" height="80" as="geometry" /> <mxGeometry x="1446" y="307" width="120" height="80" as="geometry" />
</mxCell> </mxCell>
<mxCell id="VxSGIQ4LdSJy6ndKUiif-22" value="MongoDb" style="shape=cylinder3;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;size=15;" parent="VxSGIQ4LdSJy6ndKUiif-1" vertex="1"> <mxCell id="VxSGIQ4LdSJy6ndKUiif-22" value="MongoDb" style="shape=cylinder3;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;size=15;" parent="VxSGIQ4LdSJy6ndKUiif-1" vertex="1">
<mxGeometry x="885" y="578.49" width="60" height="85.88" as="geometry" /> <mxGeometry x="885" y="578.49" width="60" height="85.88" as="geometry" />
@@ -2043,6 +2043,11 @@
<mxCell id="2h-o9D8toSF9tg0EiDx5-3" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.07;entryY=0.4;entryDx=0;entryDy=0;entryPerimeter=0;" parent="VxSGIQ4LdSJy6ndKUiif-1" source="VxSGIQ4LdSJy6ndKUiif-71" target="2h-o9D8toSF9tg0EiDx5-1" edge="1"> <mxCell id="2h-o9D8toSF9tg0EiDx5-3" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.07;entryY=0.4;entryDx=0;entryDy=0;entryPerimeter=0;" parent="VxSGIQ4LdSJy6ndKUiif-1" source="VxSGIQ4LdSJy6ndKUiif-71" target="2h-o9D8toSF9tg0EiDx5-1" edge="1">
<mxGeometry relative="1" as="geometry" /> <mxGeometry relative="1" as="geometry" />
</mxCell> </mxCell>
<mxCell id="pJB7hp7hr7cbuzhkkWlN-13" value="ID/Address / APIID/Key" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="2h-o9D8toSF9tg0EiDx5-3">
<mxGeometry x="-0.3173" y="3" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="2h-o9D8toSF9tg0EiDx5-4" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.083;entryY=0.548;entryDx=0;entryDy=0;entryPerimeter=0;" parent="VxSGIQ4LdSJy6ndKUiif-1" source="VxSGIQ4LdSJy6ndKUiif-72" target="VxSGIQ4LdSJy6ndKUiif-21" edge="1"> <mxCell id="2h-o9D8toSF9tg0EiDx5-4" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.083;entryY=0.548;entryDx=0;entryDy=0;entryPerimeter=0;" parent="VxSGIQ4LdSJy6ndKUiif-1" source="VxSGIQ4LdSJy6ndKUiif-72" target="VxSGIQ4LdSJy6ndKUiif-21" edge="1">
<mxGeometry relative="1" as="geometry"> <mxGeometry relative="1" as="geometry">
<Array as="points"> <Array as="points">
@@ -2061,55 +2066,95 @@
</mxGeometry> </mxGeometry>
</mxCell> </mxCell>
<mxCell id="2h-o9D8toSF9tg0EiDx5-6" value="" style="rounded=0;whiteSpace=wrap;html=1;" parent="VxSGIQ4LdSJy6ndKUiif-1" vertex="1"> <mxCell id="2h-o9D8toSF9tg0EiDx5-6" value="" style="rounded=0;whiteSpace=wrap;html=1;" parent="VxSGIQ4LdSJy6ndKUiif-1" vertex="1">
<mxGeometry x="-298" y="-441" width="676" height="287.5" as="geometry" /> <mxGeometry x="-304" y="-538" width="1037" height="385" as="geometry" />
</mxCell> </mxCell>
<mxCell id="2h-o9D8toSF9tg0EiDx5-19" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.75;exitDx=0;exitDy=0;" parent="VxSGIQ4LdSJy6ndKUiif-1" source="2h-o9D8toSF9tg0EiDx5-8" target="2h-o9D8toSF9tg0EiDx5-12" edge="1"> <mxCell id="2h-o9D8toSF9tg0EiDx5-19" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.75;exitDx=0;exitDy=0;" parent="VxSGIQ4LdSJy6ndKUiif-1" source="2h-o9D8toSF9tg0EiDx5-8" target="2h-o9D8toSF9tg0EiDx5-12" edge="1">
<mxGeometry relative="1" as="geometry" /> <mxGeometry relative="1" as="geometry" />
</mxCell> </mxCell>
<mxCell id="P7nfm7ApQSAVWMvNfPew-1" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.25;exitDx=0;exitDy=0;" edge="1" parent="VxSGIQ4LdSJy6ndKUiif-1" source="2h-o9D8toSF9tg0EiDx5-8" target="P7nfm7ApQSAVWMvNfPew-0"> <mxCell id="pJB7hp7hr7cbuzhkkWlN-2" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.25;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="VxSGIQ4LdSJy6ndKUiif-1" source="2h-o9D8toSF9tg0EiDx5-8" target="P7nfm7ApQSAVWMvNfPew-0">
<mxGeometry relative="1" as="geometry" /> <mxGeometry relative="1" as="geometry" />
</mxCell> </mxCell>
<mxCell id="2h-o9D8toSF9tg0EiDx5-8" value="Tyk&lt;div&gt;API Gateway&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;" parent="VxSGIQ4LdSJy6ndKUiif-1" vertex="1"> <mxCell id="2h-o9D8toSF9tg0EiDx5-8" value="Tyk&lt;div&gt;API Gateway&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;" parent="VxSGIQ4LdSJy6ndKUiif-1" vertex="1">
<mxGeometry x="-266" y="-383" width="120" height="204" as="geometry" /> <mxGeometry x="-276.5" y="-438" width="120" height="116" as="geometry" />
</mxCell> </mxCell>
<mxCell id="2h-o9D8toSF9tg0EiDx5-9" value="Kaigen server" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="VxSGIQ4LdSJy6ndKUiif-1" vertex="1"> <mxCell id="2h-o9D8toSF9tg0EiDx5-9" value="Kaigen server" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="VxSGIQ4LdSJy6ndKUiif-1" vertex="1">
<mxGeometry x="-298" y="-441" width="120" height="30" as="geometry" /> <mxGeometry x="-304" y="-538" width="120" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="2h-o9D8toSF9tg0EiDx5-10" value="Postgre" style="shape=cylinder3;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;size=15;" parent="VxSGIQ4LdSJy6ndKUiif-1" vertex="1"> <mxCell id="2h-o9D8toSF9tg0EiDx5-10" value="Postgre" style="shape=cylinder3;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;size=15;" parent="VxSGIQ4LdSJy6ndKUiif-1" vertex="1">
<mxGeometry x="280" y="-313" width="60" height="85.88" as="geometry" /> <mxGeometry x="636" y="-407.88" width="60" height="85.88" as="geometry" />
</mxCell>
<mxCell id="2h-o9D8toSF9tg0EiDx5-23" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="VxSGIQ4LdSJy6ndKUiif-1" source="2h-o9D8toSF9tg0EiDx5-12" target="VxSGIQ4LdSJy6ndKUiif-13" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell> </mxCell>
<mxCell id="2h-o9D8toSF9tg0EiDx5-25" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.75;exitDx=0;exitDy=0;" parent="VxSGIQ4LdSJy6ndKUiif-1" source="2h-o9D8toSF9tg0EiDx5-12" target="2h-o9D8toSF9tg0EiDx5-1" edge="1"> <mxCell id="2h-o9D8toSF9tg0EiDx5-25" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.75;exitDx=0;exitDy=0;" parent="VxSGIQ4LdSJy6ndKUiif-1" source="2h-o9D8toSF9tg0EiDx5-12" target="2h-o9D8toSF9tg0EiDx5-1" edge="1">
<mxGeometry relative="1" as="geometry" /> <mxGeometry relative="1" as="geometry" />
</mxCell> </mxCell>
<mxCell id="P7nfm7ApQSAVWMvNfPew-3" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="VxSGIQ4LdSJy6ndKUiif-1" source="2h-o9D8toSF9tg0EiDx5-12">
<mxGeometry relative="1" as="geometry">
<mxPoint x="278.19597244262695" y="-269.92835807800293" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="2h-o9D8toSF9tg0EiDx5-12" value="n8n" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;" parent="VxSGIQ4LdSJy6ndKUiif-1" vertex="1"> <mxCell id="2h-o9D8toSF9tg0EiDx5-12" value="n8n" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;" parent="VxSGIQ4LdSJy6ndKUiif-1" vertex="1">
<mxGeometry x="-87" y="-274" width="279" height="88" as="geometry" /> <mxGeometry x="5" y="-337" width="377" height="143" as="geometry" />
</mxCell> </mxCell>
<mxCell id="2h-o9D8toSF9tg0EiDx5-13" value="Managing server" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="VxSGIQ4LdSJy6ndKUiif-1" vertex="1"> <mxCell id="2h-o9D8toSF9tg0EiDx5-13" value="Managing server" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="VxSGIQ4LdSJy6ndKUiif-1" vertex="1">
<mxGeometry x="-298" y="-129" width="120" height="30" as="geometry" /> <mxGeometry x="-286" y="-121" width="120" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="P7nfm7ApQSAVWMvNfPew-4" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="VxSGIQ4LdSJy6ndKUiif-1" source="2h-o9D8toSF9tg0EiDx5-14" target="2h-o9D8toSF9tg0EiDx5-8"> <mxCell id="pJB7hp7hr7cbuzhkkWlN-9" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="VxSGIQ4LdSJy6ndKUiif-1" source="2h-o9D8toSF9tg0EiDx5-14" target="2h-o9D8toSF9tg0EiDx5-8">
<mxGeometry relative="1" as="geometry" /> <mxGeometry relative="1" as="geometry" />
</mxCell> </mxCell>
<mxCell id="2h-o9D8toSF9tg0EiDx5-14" value="Kaigen&lt;div&gt;Frontend&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#bac8d3;strokeColor=#23445d;" parent="VxSGIQ4LdSJy6ndKUiif-1" vertex="1"> <mxCell id="2h-o9D8toSF9tg0EiDx5-14" value="Kaigen&lt;div&gt;Frontend&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#bac8d3;strokeColor=#23445d;" parent="VxSGIQ4LdSJy6ndKUiif-1" vertex="1">
<mxGeometry x="-456" y="-410" width="145" height="256.5" as="geometry" /> <mxGeometry x="-496" y="-508" width="145" height="256.5" as="geometry" />
</mxCell> </mxCell>
<mxCell id="P7nfm7ApQSAVWMvNfPew-5" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="VxSGIQ4LdSJy6ndKUiif-1" source="P7nfm7ApQSAVWMvNfPew-0" target="2h-o9D8toSF9tg0EiDx5-12"> <mxCell id="P7nfm7ApQSAVWMvNfPew-5" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="VxSGIQ4LdSJy6ndKUiif-1" source="P7nfm7ApQSAVWMvNfPew-0" target="2h-o9D8toSF9tg0EiDx5-12" edge="1">
<mxGeometry relative="1" as="geometry" /> <mxGeometry relative="1" as="geometry" />
</mxCell> </mxCell>
<mxCell id="P7nfm7ApQSAVWMvNfPew-0" value="Kaigen Next.js" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;" vertex="1" parent="VxSGIQ4LdSJy6ndKUiif-1"> <mxCell id="pJB7hp7hr7cbuzhkkWlN-6" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.25;exitDx=0;exitDy=0;" edge="1" parent="VxSGIQ4LdSJy6ndKUiif-1" source="P7nfm7ApQSAVWMvNfPew-0" target="pJB7hp7hr7cbuzhkkWlN-4">
<mxGeometry x="-87" y="-374" width="279" height="83" as="geometry" />
</mxCell>
<mxCell id="P7nfm7ApQSAVWMvNfPew-2" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="VxSGIQ4LdSJy6ndKUiif-1" source="P7nfm7ApQSAVWMvNfPew-0" target="2h-o9D8toSF9tg0EiDx5-10">
<mxGeometry relative="1" as="geometry" /> <mxGeometry relative="1" as="geometry" />
</mxCell> </mxCell>
<mxCell id="pJB7hp7hr7cbuzhkkWlN-8" value="&lt;span style=&quot;color: rgb(158, 203, 255); font-family: ui-monospace, SFMono-Regular, &amp;quot;SF Mono&amp;quot;, Menlo, Monaco, Consolas, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace; text-align: left; white-space-collapse: preserve; background-color: rgb(22, 22, 24);&quot;&gt;&lt;font style=&quot;font-size: 8px;&quot;&gt;POST https://api.privy.io/v1/wallets&lt;/font&gt;&lt;/span&gt;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="pJB7hp7hr7cbuzhkkWlN-6">
<mxGeometry x="0.2325" y="-3" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="wzSu_xpErBMZuScJpzK4-7" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.25;exitY=1;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="VxSGIQ4LdSJy6ndKUiif-1" source="P7nfm7ApQSAVWMvNfPew-0" target="2h-o9D8toSF9tg0EiDx5-8">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="P7nfm7ApQSAVWMvNfPew-0" value="Kaigen Next.js" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;" parent="VxSGIQ4LdSJy6ndKUiif-1" vertex="1">
<mxGeometry x="36" y="-518" width="308" height="122" as="geometry" />
</mxCell>
<mxCell id="P7nfm7ApQSAVWMvNfPew-2" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;" parent="VxSGIQ4LdSJy6ndKUiif-1" source="P7nfm7ApQSAVWMvNfPew-0" target="2h-o9D8toSF9tg0EiDx5-10" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="pJB7hp7hr7cbuzhkkWlN-1" value="Api gateway jwt" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="VxSGIQ4LdSJy6ndKUiif-1">
<mxGeometry x="-453.5" y="-297.31" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="pJB7hp7hr7cbuzhkkWlN-3" value="&lt;br&gt;&lt;br&gt;wallet creation pipeline:&lt;br&gt;- POST /Account/ Exchange.Evm AccountType.Privy&lt;br&gt;&lt;div&gt;- Check Users funds&lt;div&gt;- Check USDC Gmx approval&lt;/div&gt;&lt;/div&gt;" style="text;html=1;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="VxSGIQ4LdSJy6ndKUiif-1">
<mxGeometry x="12" y="-331" width="383" height="30" as="geometry" />
</mxCell>
<mxCell id="pJB7hp7hr7cbuzhkkWlN-4" value="Privy" style="ellipse;whiteSpace=wrap;html=1;" vertex="1" parent="VxSGIQ4LdSJy6ndKUiif-1">
<mxGeometry x="753.25" y="-534" width="120" height="80" as="geometry" />
</mxCell>
<mxCell id="pJB7hp7hr7cbuzhkkWlN-5" value="- POST n8n.kaigen.managing.live &lt;br&gt;- Send new created wallet ID/Address" style="text;html=1;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="VxSGIQ4LdSJy6ndKUiif-1">
<mxGeometry x="41" y="-511" width="277.5" height="30" as="geometry" />
</mxCell>
<mxCell id="pJB7hp7hr7cbuzhkkWlN-12" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="VxSGIQ4LdSJy6ndKUiif-1" source="2h-o9D8toSF9tg0EiDx5-12" target="2h-o9D8toSF9tg0EiDx5-10">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="wzSu_xpErBMZuScJpzK4-10" value="READ Everythings else&lt;br&gt;UPDATE DebitCredits" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="pJB7hp7hr7cbuzhkkWlN-12">
<mxGeometry x="-0.2934" y="-2" relative="1" as="geometry">
<mxPoint x="-1" y="-29" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="wzSu_xpErBMZuScJpzK4-8" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.11;entryY=-0.002;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="VxSGIQ4LdSJy6ndKUiif-1" source="2h-o9D8toSF9tg0EiDx5-8" target="VxSGIQ4LdSJy6ndKUiif-13">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="-174" y="-303" />
<mxPoint x="-174" y="-97" />
<mxPoint x="-148" y="-97" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="wzSu_xpErBMZuScJpzK4-9" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.75;exitDx=0;exitDy=0;entryX=1.014;entryY=0.867;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="VxSGIQ4LdSJy6ndKUiif-1" source="2h-o9D8toSF9tg0EiDx5-12" target="2h-o9D8toSF9tg0EiDx5-8">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="-91" y="-230" />
<mxPoint x="-91" y="-337" />
</Array>
</mxGeometry>
</mxCell>
</root> </root>
</mxGraphModel> </mxGraphModel>
</diagram> </diagram>

View File

@@ -7,6 +7,7 @@ using Managing.Common;
using Managing.Core.Middleawares; using Managing.Core.Middleawares;
using Managing.Infrastructure.Databases.InfluxDb.Models; using Managing.Infrastructure.Databases.InfluxDb.Models;
using Managing.Infrastructure.Databases.MongoDb.Configurations; using Managing.Infrastructure.Databases.MongoDb.Configurations;
using Managing.Infrastructure.Evm.Models.Privy;
using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models;
using NSwag; using NSwag;
using NSwag.Generation.Processors.Security; using NSwag.Generation.Processors.Security;
@@ -49,6 +50,7 @@ builder.Host.UseSerilog((hostBuilder, loggerConfiguration) =>
builder.Services.AddOptions(); builder.Services.AddOptions();
builder.Services.Configure<ManagingDatabaseSettings>(builder.Configuration.GetSection(Constants.Databases.MongoDb)); builder.Services.Configure<ManagingDatabaseSettings>(builder.Configuration.GetSection(Constants.Databases.MongoDb));
builder.Services.Configure<InfluxDbSettings>(builder.Configuration.GetSection(Constants.Databases.InfluxDb)); builder.Services.Configure<InfluxDbSettings>(builder.Configuration.GetSection(Constants.Databases.InfluxDb));
builder.Services.Configure<PrivySettings>(builder.Configuration.GetSection(Constants.ThirdParty.Privy));
builder.Services.AddControllers().AddJsonOptions(options => builder.Services.AddControllers().AddJsonOptions(options =>
options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter())); options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter()));
builder.Services.AddCors(o => o.AddPolicy("CorsPolicy", builder => builder.Services.AddCors(o => o.AddPolicy("CorsPolicy", builder =>

View File

@@ -9,6 +9,7 @@ using Managing.Bootstrap;
using Managing.Common; using Managing.Common;
using Managing.Infrastructure.Databases.InfluxDb.Models; using Managing.Infrastructure.Databases.InfluxDb.Models;
using Managing.Infrastructure.Databases.MongoDb.Configurations; using Managing.Infrastructure.Databases.MongoDb.Configurations;
using Managing.Infrastructure.Evm.Models.Privy;
using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.IdentityModel.Tokens; using Microsoft.IdentityModel.Tokens;
using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models;
@@ -58,6 +59,7 @@ builder.Host.UseSerilog((hostBuilder, loggerConfiguration) =>
builder.Services.AddOptions(); builder.Services.AddOptions();
builder.Services.Configure<ManagingDatabaseSettings>(builder.Configuration.GetSection(Constants.Databases.MongoDb)); builder.Services.Configure<ManagingDatabaseSettings>(builder.Configuration.GetSection(Constants.Databases.MongoDb));
builder.Services.Configure<InfluxDbSettings>(builder.Configuration.GetSection(Constants.Databases.InfluxDb)); builder.Services.Configure<InfluxDbSettings>(builder.Configuration.GetSection(Constants.Databases.InfluxDb));
builder.Services.Configure<PrivySettings>(builder.Configuration.GetSection(Constants.ThirdParty.Privy));
builder.Services.AddControllers().AddJsonOptions(options => builder.Services.AddControllers().AddJsonOptions(options =>
options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter())); options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter()));

View File

@@ -8,6 +8,10 @@
"Organization": "managing-org", "Organization": "managing-org",
"Token": "Fw2FPL2OwTzDHzSbR2Sd5xs0EKQYy00Q-hYKYAhr9cC1_q5YySONpxuf_Ck0PTjyUiF13xXmi__bu_pXH-H9zA==" "Token": "Fw2FPL2OwTzDHzSbR2Sd5xs0EKQYy00Q-hYKYAhr9cC1_q5YySONpxuf_Ck0PTjyUiF13xXmi__bu_pXH-H9zA=="
}, },
"Privy": {
"AppId": "cm6f47n1l003jx7mjwaembhup",
"AppSecret": "63Chz2z5M8TgR5qc8dznSLRAGTHTyPU4cjdQobrBF1Cx5tszZpTuFgyrRd7hZ2k6HpwDz3GEwQZzsCqHb8Z311bF"
},
"Serilog": { "Serilog": {
"MinimumLevel": { "MinimumLevel": {
"Default": "Information", "Default": "Information",

View File

@@ -18,21 +18,37 @@ public interface IEvmManager
string VerifySignature(string signature, string message); string VerifySignature(string signature, string message);
Task<List<EvmBalance>> GetBalances(Chain chain, int page, int pageSize, string publicAddress); Task<List<EvmBalance>> GetBalances(Chain chain, int page, int pageSize, string publicAddress);
Task<List<EvmBalance>> GetAllBalancesOnAllChain(string publicAddress); Task<List<EvmBalance>> GetAllBalancesOnAllChain(string publicAddress);
Task<List<Candle>> GetCandles(SubgraphProvider subgraphProvider, Ticker ticker, DateTime startDate, Timeframe interval);
Task<List<Candle>> GetCandles(SubgraphProvider subgraphProvider, Ticker ticker, DateTime startDate,
Timeframe interval);
decimal GetVolume(SubgraphProvider subgraphProvider, Ticker ticker); decimal GetVolume(SubgraphProvider subgraphProvider, Ticker ticker);
Task<List<Ticker>> GetAvailableTicker(); Task<List<Ticker>> GetAvailableTicker();
Task<Candle> GetCandle(SubgraphProvider subgraphProvider, Ticker ticker); Task<Candle> GetCandle(SubgraphProvider subgraphProvider, Ticker ticker);
Task<bool> InitAddress(string chainName, string publicAddress, string privateKey); Task<bool> InitAddress(string chainName, string publicAddress, string privateKey);
Task<bool> Send(Chain chain, Ticker ticker, decimal amount, string publicAddress, string privateKey, string receiverAddress);
Task<bool> Send(Chain chain, Ticker ticker, decimal amount, string publicAddress, string privateKey,
string receiverAddress);
Task<EvmBalance> GetTokenBalance(string chainName, Ticker ticker, string publicAddress); Task<EvmBalance> GetTokenBalance(string chainName, Ticker ticker, string publicAddress);
Task<bool> CancelOrders(Account account, Ticker ticker); Task<bool> CancelOrders(Account account, Ticker ticker);
Task<Trade> IncreasePosition(Account account, Ticker ticker, TradeDirection direction, decimal price, decimal quantity, decimal? leverage = 1);
Task<Trade> IncreasePosition(Account account, Ticker ticker, TradeDirection direction, decimal price,
decimal quantity, decimal? leverage = 1);
Task<Trade> GetTrade(Account account, string chainName, Ticker ticker); Task<Trade> GetTrade(Account account, string chainName, Ticker ticker);
Task<Trade> DecreasePosition(Account account, Ticker ticker, TradeDirection direction, decimal price, decimal quantity, decimal? leverage);
Task<Trade> DecreasePosition(Account account, Ticker ticker, TradeDirection direction, decimal price,
decimal quantity, decimal? leverage);
Task<decimal> QuantityInPosition(string chainName, string publicAddress, Ticker ticker); Task<decimal> QuantityInPosition(string chainName, string publicAddress, Ticker ticker);
Task<Trade> DecreaseOrder(Account account, TradeType tradeType, Ticker ticker, TradeDirection direction, decimal price, decimal quantity, decimal? leverage);
Task<Trade> DecreaseOrder(Account account, TradeType tradeType, Ticker ticker, TradeDirection direction,
decimal price, decimal quantity, decimal? leverage);
Task<decimal> GetFee(string chainName); Task<decimal> GetFee(string chainName);
Task<List<Trade>> GetOrders(Account account, Ticker ticker); Task<List<Trade>> GetOrders(Account account, Ticker ticker);
Task<Trade> GetTrade(string reference, string arbitrum, Ticker ticker); Task<Trade> GetTrade(string reference, string arbitrum, Ticker ticker);
Task<List<FundingRate>> GetFundingRates(); Task<List<FundingRate>> GetFundingRates();
Task<(string Id, string Address)> CreatePrivyWallet();
} }

View File

@@ -7,6 +7,7 @@ using Managing.Domain.Users;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace Managing.Application.Accounts; namespace Managing.Application.Accounts;
public class AccountService : IAccountService public class AccountService : IAccountService
{ {
private readonly IAccountRepository _accountRepository; private readonly IAccountRepository _accountRepository;
@@ -48,6 +49,21 @@ public class AccountService : IAccountService
request.Key = keys.Key; request.Key = keys.Key;
request.Secret = keys.Secret; request.Secret = keys.Secret;
} }
else if (request.Exchange == Enums.TradingExchanges.Evm
&& request.Type == Enums.AccountType.Privy)
{
if (string.IsNullOrEmpty(request.Key) || string.IsNullOrEmpty(request.Secret))
{
var privyClient = await _evmManager.CreatePrivyWallet();
request.Key = privyClient.Address;
request.Secret = privyClient.Id;
}
else
{
request.Key = request.Key; // Address
request.Secret = request.Secret; // Privy wallet id
}
}
else else
{ {
request.Key = request.Key; request.Key = request.Key;
@@ -116,10 +132,8 @@ public class AccountService : IAccountService
{ {
var cacheKey = $"user-account-{user.Name}"; var cacheKey = $"user-account-{user.Name}";
return _cacheService.GetOrSave(cacheKey, () => return _cacheService.GetOrSave(cacheKey, () => { return GetAccounts(user, hideSecrets, false); },
{ TimeSpan.FromMinutes(5));
return GetAccounts(user, hideSecrets, false);
}, TimeSpan.FromMinutes(5));
} }
private IEnumerable<Account> GetAccounts(User user, bool hideSecrets, bool getBalance) private IEnumerable<Account> GetAccounts(User user, bool hideSecrets, bool getBalance)
@@ -139,10 +153,8 @@ public class AccountService : IAccountService
public IEnumerable<Account> GetAccountsBalancesByUser(User user, bool hideSecrets) public IEnumerable<Account> GetAccountsBalancesByUser(User user, bool hideSecrets)
{ {
var cacheKey = $"user-account-balance-{user.Name}"; var cacheKey = $"user-account-balance-{user.Name}";
var accounts = _cacheService.GetOrSave(cacheKey, () => var accounts = _cacheService.GetOrSave(cacheKey, () => { return GetAccounts(user, true, true); },
{ TimeSpan.FromHours(3));
return GetAccounts(user, true, true);
}, TimeSpan.FromHours(3));
return accounts; return accounts;
} }

View File

@@ -31,6 +31,8 @@ using Managing.Infrastructure.Databases.MongoDb;
using Managing.Infrastructure.Databases.MongoDb.Abstractions; using Managing.Infrastructure.Databases.MongoDb.Abstractions;
using Managing.Infrastructure.Databases.MongoDb.Configurations; using Managing.Infrastructure.Databases.MongoDb.Configurations;
using Managing.Infrastructure.Evm; using Managing.Infrastructure.Evm;
using Managing.Infrastructure.Evm.Abstractions;
using Managing.Infrastructure.Evm.Models.Privy;
using Managing.Infrastructure.Evm.Services; using Managing.Infrastructure.Evm.Services;
using Managing.Infrastructure.Evm.Subgraphs; using Managing.Infrastructure.Evm.Subgraphs;
using Managing.Infrastructure.Exchanges; using Managing.Infrastructure.Exchanges;
@@ -90,6 +92,9 @@ public static class ApiBootstrap
services.AddSingleton<IInfluxDbSettings>(sp => services.AddSingleton<IInfluxDbSettings>(sp =>
sp.GetRequiredService<IOptions<InfluxDbSettings>>().Value); sp.GetRequiredService<IOptions<InfluxDbSettings>>().Value);
services.AddSingleton<IPrivySettings>(sp =>
sp.GetRequiredService<IOptions<PrivySettings>>().Value);
// Evm // Evm
services.AddGbcFeed(); services.AddGbcFeed();
services.AddUniswapV2(); services.AddUniswapV2();
@@ -129,6 +134,7 @@ public static class ApiBootstrap
services.AddSingleton<IDiscordService, DiscordService>(); services.AddSingleton<IDiscordService, DiscordService>();
services.AddSingleton<IBotService, BotService>(); services.AddSingleton<IBotService, BotService>();
services.AddSingleton<IWorkerService, WorkerService>(); services.AddSingleton<IWorkerService, WorkerService>();
services.AddTransient<IPrivyService, PrivyService>();
// Stream // Stream
services.AddSingleton<IBinanceSocketClient, BinanceSocketClient>(); services.AddSingleton<IBinanceSocketClient, BinanceSocketClient>();

View File

@@ -25,6 +25,8 @@ using Managing.Infrastructure.Databases.MongoDb;
using Managing.Infrastructure.Databases.MongoDb.Abstractions; using Managing.Infrastructure.Databases.MongoDb.Abstractions;
using Managing.Infrastructure.Databases.MongoDb.Configurations; using Managing.Infrastructure.Databases.MongoDb.Configurations;
using Managing.Infrastructure.Evm; using Managing.Infrastructure.Evm;
using Managing.Infrastructure.Evm.Abstractions;
using Managing.Infrastructure.Evm.Models.Privy;
using Managing.Infrastructure.Evm.Services; using Managing.Infrastructure.Evm.Services;
using Managing.Infrastructure.Evm.Subgraphs; using Managing.Infrastructure.Evm.Subgraphs;
using Managing.Infrastructure.Exchanges; using Managing.Infrastructure.Exchanges;
@@ -81,6 +83,9 @@ public static class WorkersBootstrap
services.AddTransient<IInfluxDbRepository, InfluxDbRepository>(); services.AddTransient<IInfluxDbRepository, InfluxDbRepository>();
services.AddSingleton<IPrivySettings>(sp =>
sp.GetRequiredService<IOptions<PrivySettings>>().Value);
// Evm // Evm
services.AddUniswapV2(); services.AddUniswapV2();
services.AddGbcFeed(); services.AddGbcFeed();
@@ -112,6 +117,7 @@ public static class WorkersBootstrap
services.AddTransient<IExchangeService, ExchangeService>(); services.AddTransient<IExchangeService, ExchangeService>();
services.AddSingleton<IBinanceSocketClient, BinanceSocketClient>(); services.AddSingleton<IBinanceSocketClient, BinanceSocketClient>();
services.AddSingleton<IKrakenSocketClient, KrakenSocketClient>(); services.AddSingleton<IKrakenSocketClient, KrakenSocketClient>();
services.AddSingleton<IPrivyService, PrivyService>();
// Messengers // Messengers
services.AddSingleton<IMessengerService, MessengerService>(); services.AddSingleton<IMessengerService, MessengerService>();

View File

@@ -23,6 +23,11 @@
public const string MongoDb = "ManagingDatabase"; public const string MongoDb = "ManagingDatabase";
} }
public class ThirdParty
{
public const string Privy = "Privy";
}
public class Chains public class Chains
{ {
public const string Ethereum = "Ethereum"; public const string Ethereum = "Ethereum";

View File

@@ -37,7 +37,8 @@ public static class Enums
Cex, Cex,
Trader, Trader,
Watch, Watch,
Auth Auth,
Privy
} }
public enum BotType public enum BotType

View File

@@ -0,0 +1,11 @@
using Managing.Infrastructure.Evm.Models;
namespace Managing.Infrastructure.Evm.Abstractions;
public interface IPrivyService
{
Task<PrivyWallet> CreateWalletAsync(string chainType = "ethereum");
Task<HttpResponseMessage> SendTransactionAsync(string walletId, string recipientAddress, long value,
string caip2 = "eip155:84532");
}

View File

@@ -0,0 +1,7 @@
namespace Managing.Infrastructure.Evm.Abstractions;
public interface IPrivySettings
{
string AppId { get; set; }
string AppSecret { get; set; }
}

View File

@@ -37,6 +37,7 @@ public class EvmManager : IEvmManager
private readonly IEnumerable<ISubgraphPrices> _subgraphs; private readonly IEnumerable<ISubgraphPrices> _subgraphs;
private Dictionary<string, Dictionary<string, decimal>> _geckoPrices; private Dictionary<string, Dictionary<string, decimal>> _geckoPrices;
private readonly GmxV2Service _gmxV2Service; private readonly GmxV2Service _gmxV2Service;
private readonly IPrivyService _privyService;
private readonly List<Ticker> _eligibleTickers = new List<Ticker>() private readonly List<Ticker> _eligibleTickers = new List<Ticker>()
{ {
@@ -44,12 +45,13 @@ public class EvmManager : IEvmManager
Ticker.PEPE, Ticker.DOGE, Ticker.UNI Ticker.PEPE, Ticker.DOGE, Ticker.UNI
}; };
public EvmManager(IEnumerable<ISubgraphPrices> subgraphs) public EvmManager(IEnumerable<ISubgraphPrices> subgraphs, IPrivyService privyService)
{ {
var defaultChain = ChainService.GetEthereum(); var defaultChain = ChainService.GetEthereum();
_web3 = new Web3(defaultChain.RpcUrl); _web3 = new Web3(defaultChain.RpcUrl);
_httpClient = new HttpClient(); _httpClient = new HttpClient();
_subgraphs = subgraphs; _subgraphs = subgraphs;
_privyService = privyService;
_geckoPrices = _geckoPrices != null && _geckoPrices.Any() _geckoPrices = _geckoPrices != null && _geckoPrices.Any()
? _geckoPrices ? _geckoPrices
: new Dictionary<string, Dictionary<string, decimal>>(); : new Dictionary<string, Dictionary<string, decimal>>();
@@ -657,4 +659,11 @@ public class EvmManager : IEvmManager
var chain = ChainService.GetChain(Constants.Chains.Arbitrum); var chain = ChainService.GetChain(Constants.Chains.Arbitrum);
return new Web3(wallet, chain.RpcUrl); return new Web3(wallet, chain.RpcUrl);
} }
public async Task<(string Id, string Address)> CreatePrivyWallet()
{
var privyWallet = await _privyService.CreateWalletAsync();
return (privyWallet.Id, privyWallet.Address);
}
} }

View File

@@ -0,0 +1,9 @@
using Managing.Infrastructure.Evm.Abstractions;
namespace Managing.Infrastructure.Evm.Models.Privy;
public class PrivySettings : IPrivySettings
{
public string AppId { get; set; }
public string AppSecret { get; set; }
}

View File

@@ -0,0 +1,12 @@
using System.Text.Json.Serialization;
namespace Managing.Infrastructure.Evm.Models;
public class PrivyWallet
{
[JsonPropertyName("id")] public string Id { get; set; }
[JsonPropertyName("address")] public string Address { get; set; }
[JsonPropertyName("chain_type")] public string ChainType { get; set; }
}

View File

@@ -793,6 +793,7 @@ public class GmxV2Service
var exchangeRouterService = new ExchangeRouterService(web3, Arbitrum.AddressV2.ExchangeRouter); var exchangeRouterService = new ExchangeRouterService(web3, Arbitrum.AddressV2.ExchangeRouter);
var receipt = await exchangeRouterService.MulticallRequestAndWaitForReceiptAsync(multiCallFunction); var receipt = await exchangeRouterService.MulticallRequestAndWaitForReceiptAsync(multiCallFunction);
// Call privy api instead and send the txn
var trade = new Trade(DateTime.UtcNow, var trade = new Trade(DateTime.UtcNow,
direction, direction,
Enums.TradeStatus.Requested, Enums.TradeStatus.Requested,

View File

@@ -0,0 +1,85 @@
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text;
using System.Text.Json;
using Managing.Infrastructure.Evm.Abstractions;
using Managing.Infrastructure.Evm.Models;
public class PrivyService : IPrivyService
{
private readonly HttpClient _privyClient;
private readonly string _appId;
private readonly string _appSecret;
public PrivyService(IPrivySettings settings)
{
_privyClient = new HttpClient();
_appId = settings.AppId;
_appSecret = settings.AppSecret;
ConfigureHttpClient();
}
private void ConfigureHttpClient()
{
_privyClient.BaseAddress = new Uri("https://api.privy.io/");
var authToken = Convert.ToBase64String(Encoding.ASCII.GetBytes($"{_appId}:{_appSecret}"));
// _privyClient.DefaultRequestHeaders.Authorization =
// new AuthenticationHeaderValue("Basic", $"{_appId}:{_appSecret}");
_privyClient.DefaultRequestHeaders.Add("privy-app-id", _appId);
// add custom header
_privyClient.DefaultRequestHeaders.Add("Authorization", authToken);
_privyClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
}
public async Task<PrivyWallet> CreateWalletAsync(string chainType = "ethereum")
{
try
{
var json = JsonSerializer.Serialize(new { chain_type = chainType });
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await _privyClient.PostAsJsonAsync("/v1/wallets", content);
var result = new PrivyWallet();
if (response.IsSuccessStatusCode)
{
result = await response.Content.ReadFromJsonAsync<PrivyWallet>();
}
else
{
throw new Exception(await response.Content.ReadAsStringAsync());
}
return result;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
public async Task<HttpResponseMessage> SendTransactionAsync(string walletId, string recipientAddress, long value,
string caip2 = "eip155:84532")
{
var requestBody = new
{
method = "eth_sendTransaction",
caip2,
@params = new
{
transaction = new
{
to = recipientAddress,
value
}
}
};
return await _privyClient.PostAsJsonAsync(
$"/v1/wallets/{walletId}/rpc",
requestBody
);
}
}

View File

@@ -59,14 +59,14 @@ const BacktestRowDetails: React.FC<IBotRowDetails> = ({
<CardText <CardText
title="Money Management" title="Money Management"
content={ content={
"SL: " +(moneyManagement.stopLoss * 100).toFixed(2) + "% TP: " + "SL: " +(moneyManagement?.stopLoss * 100).toFixed(2) + "% TP: " +
(moneyManagement.takeProfit * 100).toFixed(2) + "%" (moneyManagement?.takeProfit * 100).toFixed(2) + "%"
} }
></CardText> ></CardText>
<CardText <CardText
title="Optimized Money Management" title="Optimized Money Management"
content={ content={
"SL: " +optimizedMoneyManagement.stopLoss.toFixed(2) + "% TP: " + optimizedMoneyManagement.takeProfit.toFixed(2) + "%" "SL: " +optimizedMoneyManagement?.stopLoss.toFixed(2) + "% TP: " + optimizedMoneyManagement?.takeProfit.toFixed(2) + "%"
} }
></CardText> ></CardText>

View File

@@ -275,9 +275,9 @@ const BacktestTable: React.FC<IBacktestCards> = ({ list, isFetching }) => {
// Get average optimized money management for every backtest // Get average optimized money management for every backtest
const optimized = list!.map((b) => b.optimizedMoneyManagement) const optimized = list!.map((b) => b.optimizedMoneyManagement)
const stopLoss = optimized.reduce((acc, curr) => acc + curr.stopLoss, 0) const stopLoss = optimized.reduce((acc, curr) => acc + (curr?.stopLoss ?? 0), 0)
const takeProfit = optimized.reduce( const takeProfit = optimized.reduce(
(acc, curr) => acc + curr.takeProfit, (acc, curr) => acc + (curr?.takeProfit ?? 0),
0 0
) )

View File

@@ -1631,7 +1631,7 @@ export class TradingClient extends AuthorizedApiBase {
url_ = url_.replace(/[?&]$/, ""); url_ = url_.replace(/[?&]$/, "");
let options_: RequestInit = { let options_: RequestInit = {
method: "GET", method: "POST",
headers: { headers: {
"Accept": "application/json" "Accept": "application/json"
} }
@@ -1960,6 +1960,7 @@ export enum AccountType {
Trader = "Trader", Trader = "Trader",
Watch = "Watch", Watch = "Watch",
Auth = "Auth", Auth = "Auth",
Privy = "Privy",
} }
export interface User { export interface User {

View File

@@ -116,8 +116,8 @@ const AccountModal: React.FC<IModalProps> = ({ showModal, toggleModal }) => {
</div> </div>
</div> </div>
{selectedExchange != TradingExchanges.Evm && {(selectedExchange != TradingExchanges.Evm && selectedType != AccountType.Trader ) ||
selectedType != AccountType.Trader ? ( (selectedExchange == TradingExchanges.Evm && selectedType == AccountType.Privy )? (
<> <>
<div className="form-control"> <div className="form-control">
<div className="input-group"> <div className="input-group">