Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
johnpmitsch committed Dec 17, 2024
1 parent f3298ca commit 02c3847
Show file tree
Hide file tree
Showing 20 changed files with 150 additions and 141 deletions.
66 changes: 32 additions & 34 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
// https://stackoverflow.com/a/60488372
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
Expand All @@ -13,38 +13,36 @@
"webRoot": "${workspaceFolder}"
},
{
"type": "pwa-node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"<node_internals>/**"
],
"program": "${file}"
},
{
"name": "debug-app-nft-hooks",
"type": "node",
"request": "launch",
"runtimeExecutable": "yarn",
"runtimeArgs": [
"run",
"nx",
"run",
"apps-examples-nft-react-hooks:serve:development",
"-r",
"ts-node/register",
"-r",
"tsconfig-paths/register"
],
"protocol": "inspector",
"outputCapture": "std",
"internalConsoleOptions": "openOnSessionStart",
"console": "internalConsole",
"env": {
"TS_NODE_IGNORE": "false",
"TS_NODE_PROJECT": "${workspaceFolder}/packages/apps/examples/nft-react-hooks/tsconfig.json"
"type": "pwa-node",
"request": "launch",
"name": "Launch Program",
"skipFiles": ["<node_internals>/**"],
"program": "${file}"
},
"cwd": "${workspaceFolder}/packages/apps/examples/nft-react-hooks/"
}
{
"name": "debug-app-nft-hooks",
"type": "node",
"request": "launch",
"runtimeExecutable": "yarn",
"runtimeArgs": [
"run",
"nx",
"run",
"apps-examples-nft-react-hooks:serve:development",
"-r",
"ts-node/register",
"-r",
"tsconfig-paths/register"
],
"protocol": "inspector",
"outputCapture": "std",
"internalConsoleOptions": "openOnSessionStart",
"console": "internalConsole",
"env": {
"TS_NODE_IGNORE": "false",
"TS_NODE_PROJECT": "${workspaceFolder}/packages/apps/examples/nft-react-hooks/tsconfig.json"
},
"cwd": "${workspaceFolder}/packages/apps/examples/nft-react-hooks/"
}
]
}
2 changes: 1 addition & 1 deletion packages/apps/examples/nft-react-hooks/src/app/app.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Link, Outlet } from "react-router-dom";
import { Link, Outlet } from 'react-router-dom';

function App() {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
thead td th {
padding: 8px 12px;
font-weight: 600;
padding: 8px 12px;
font-weight: 600;
}

tbody td th {
padding: 2px 12px;
}
padding: 2px 12px;
}
Original file line number Diff line number Diff line change
@@ -1,57 +1,66 @@
import { useTrendingCollections, TrendingCollectionsTimePeriod } from '@quicknode/icy-nft-hooks';
import {
useTrendingCollections,
TrendingCollectionsTimePeriod,
} from '@quicknode/icy-nft-hooks';
import { useState } from 'react';

import './Collections.css';

function Collections() {
const [cursor, setCursor] = useState<string | undefined>(undefined);
const { collections, pageInfo } = useTrendingCollections({
orderBy: 'SALES',
orderDirection: 'DESC',
timePeriod: TrendingCollectionsTimePeriod.ONE_HOUR,
first: 5,
after: cursor
after: cursor,
});

return (
<div className="App">
<div>
Stats in last hour
</div>
<div>Stats in last hour</div>
<table>
<thead>
<th style={{ textAlign: "left" }}>Collection</th>
<th style={{ textAlign: "right" }}>Floor</th>
<th style={{ textAlign: "right" }}>Volume</th>
<th style={{ textAlign: "right" }}>Total Sales</th>
<th style={{ textAlign: "right" }}>Average</th>
<th style={{ textAlign: 'left' }}>Collection</th>
<th style={{ textAlign: 'right' }}>Floor</th>
<th style={{ textAlign: 'right' }}>Volume</th>
<th style={{ textAlign: 'right' }}>Total Sales</th>
<th style={{ textAlign: 'right' }}>Average</th>
</thead>
<tbody>
{collections.map(
(collection) => {
return (
<tr key={collection.address}>
<td>{collection.name}</td>
<td className="mono">Ξ{collection.stats.floor.toFixed(3)}</td>
<td className="mono">Ξ{collection.stats.volume.toFixed(3)}</td>
<td className="mono">{collection.stats.totalSales}</td>
<td className="mono">Ξ{collection.stats.average.toFixed(3)}</td>
</tr>
);
}
)}
{collections.map((collection) => {
return (
<tr key={collection.address}>
<td>{collection.name}</td>
<td className="mono">Ξ{collection.stats.floor.toFixed(3)}</td>
<td className="mono">Ξ{collection.stats.volume.toFixed(3)}</td>
<td className="mono">{collection.stats.totalSales}</td>
<td className="mono">Ξ{collection.stats.average.toFixed(3)}</td>
</tr>
);
})}
</tbody>
</table>
{pageInfo?.hasNextPage && (
<div style={{ alignItems: 'flex-end', width: '100%', justifyContent: 'flex-end', display: 'flex' }}>
<button onClick={() => {
setCursor(pageInfo.endCursor ?? undefined)
}}>Next</button>
<div
style={{
alignItems: 'flex-end',
width: '100%',
justifyContent: 'flex-end',
display: 'flex',
}}
>
<button
onClick={() => {
setCursor(pageInfo.endCursor ?? undefined);
}}
>
Next
</button>
</div>
)}
</div>
);
}

export default Collections;

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.Home {
display: flex;
flex-direction: column;
align-items: center;
}
display: flex;
flex-direction: column;
align-items: center;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import "./Home.css";
import './Home.css';

function Home() {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.Wallets {}
.Wallets {
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import './Wallets.css';
function Wallets() {
const [ensName, setEnsName] = useState('');
const [cursor, setCursor] = useState<string | undefined>(undefined);
const { nfts, isSearchValid, pageInfo } = useWalletNFTs({ ensName, first: 10, after: cursor });
const { nfts, isSearchValid, pageInfo } = useWalletNFTs({
ensName,
first: 10,
after: cursor,
});

return (
<div className="Wallets">
Expand All @@ -17,7 +21,8 @@ function Wallets() {
value={ensName}
onChange={(e) => setEnsName(e.target.value)}
style={{
outlineColor: !isSearchValid && ensName.length > 0 ? 'red' : undefined,
outlineColor:
!isSearchValid && ensName.length > 0 ? 'red' : undefined,
}}
/>
</div>
Expand All @@ -28,10 +33,7 @@ function Wallets() {
const imageUrl = nft.images.find((i) => !!i.url)?.url;

return (
<div
className="card"
key={`${nft.tokenId}${nft.contract.address}`}
>
<div className="card" key={`${nft.tokenId}${nft.contract.address}`}>
<div className="top">
<div>
<h1>{contract.name}</h1>
Expand All @@ -50,10 +52,21 @@ function Wallets() {
})}

{pageInfo?.hasNextPage && (
<div style={{ alignItems: 'flex-end', width: '100%', justifyContent: 'flex-end', display: 'flex' }}>
<button onClick={() => {
setCursor(pageInfo.endCursor ?? undefined)
}}>Next</button>
<div
style={{
alignItems: 'flex-end',
width: '100%',
justifyContent: 'flex-end',
display: 'flex',
}}
>
<button
onClick={() => {
setCursor(pageInfo.endCursor ?? undefined);
}}
>
Next
</button>
</div>
)}
</div>
Expand Down
8 changes: 2 additions & 6 deletions packages/apps/examples/nft-react-hooks/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import {
BrowserRouter as Router,
Routes,
Route,
} from "react-router-dom";
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import { IcyProvider } from '@quicknode/icy-nft-hooks';

import './styles.css';
Expand All @@ -18,7 +14,7 @@ const root = ReactDOM.createRoot(
document.getElementById('root') as HTMLElement
);

const apiKey = process.env['NX_ICY_API_KEY'] || ''
const apiKey = process.env['NX_ICY_API_KEY'] || '';

root.render(
<React.StrictMode>
Expand Down
21 changes: 10 additions & 11 deletions packages/apps/examples/nft-react-hooks/src/styles.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
body {
margin: 0;
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto',
'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
Expand Down Expand Up @@ -37,7 +37,7 @@ code {
border-radius: 8px;
text-decoration: none;
font-weight: 500;
opacity: .75;
opacity: 0.75;
}
.nav .links {
display: grid;
Expand All @@ -46,13 +46,12 @@ code {

.nav a:hover {
opacity: 1;
background: #292A2B;
background: #292a2b;
}

.search {
display: inline-flex;
margin: 16px auto;

}
.search button {
background: #434445;
Expand All @@ -61,7 +60,7 @@ code {
height: 40px;
padding: 0 16px;
font-weight: 600;
transition: all 150ms ease-out;
transition: all 150ms ease-out;

cursor: pointer;
font-size: 16px;
Expand All @@ -81,24 +80,24 @@ code {

.empty {
padding: 32px;
background: #292A2B;
background: #292a2b;
border-radius: 6px;
color: #AEAEB2;
color: #aeaeb2;
text-align: center;
}

.mono {
text-align: right;
font-family: 'Roboto Mono', monospace;
opacity: .75;
opacity: 0.75;
}

:root {
--mono: 'Roboto Mono', monospace;
}

.card {
background: #292A2B;
background: #292a2b;
padding: 16px;
margin: 32px;
border-radius: 12px;
Expand Down Expand Up @@ -144,7 +143,7 @@ code {
}

.top h2 {
opacity: .5;
opacity: 0.5;
margin-top: 12px;
font-size: 16px;
}
Expand Down
7 changes: 4 additions & 3 deletions packages/libs/sdk/src/solana/solana.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,10 @@ export class Solana {
feeType: PriorityFeeLevels = 'medium'
) {
const { result } = await this.fetchEstimatePriorityFees({});
const priorityFee = feeType === 'recommended'
? result.recommended
: result.per_compute_unit[feeType];
const priorityFee =
feeType === 'recommended'
? result.recommended
: result.per_compute_unit[feeType];

const priorityFeeInstruction = ComputeBudgetProgram.setComputeUnitPrice({
microLamports: priorityFee,
Expand Down
Loading

0 comments on commit 02c3847

Please sign in to comment.