From 5f3af42e491e1b6fc3bd67f727bf0cc075a2fe5c Mon Sep 17 00:00:00 2001 From: ssamkkim Date: Sat, 22 Apr 2023 16:07:04 -0700 Subject: [PATCH 01/55] citrus config types --- apps/web/src/lib/config.ts | 44 +++++++++++++++++++++++++++ packages/xray/src/lib/parser/types.ts | 16 ++++++++++ 2 files changed, 60 insertions(+) diff --git a/apps/web/src/lib/config.ts b/apps/web/src/lib/config.ts index 0eb77c45..ecda9aaf 100644 --- a/apps/web/src/lib/config.ts +++ b/apps/web/src/lib/config.ts @@ -43,6 +43,10 @@ export const transactionActionsMetadata: Record< icon: "openHand", label: "Borrow Fox", }, + BORROW_SOL_FOR_NFT: { + icon: "customer", + label: "Borrow SOL", + }, BURN: { filterLabel: "Burn", icon: "flame", @@ -53,6 +57,18 @@ export const transactionActionsMetadata: Record< icon: "flame", label: "Burned NFT", }, + CANCEL_LOAN_REQUEST: { + icon: "close", + label: "Cancel Loan Request", + }, + CANCEL_OFFER: { + icon: "close", + label: "Cancel Offer", + }, + CLAIM_NFT: { + icon: "squareCheck", + label: "Claim NFT", + }, COMPRESSED_NFT_MINT: { icon: "mint", label: "NFT Mint", @@ -70,6 +86,10 @@ export const transactionActionsMetadata: Record< icon: "cold", label: "Frozen", }, + LEND_FOR_NFT: { + icon: "handshake", + label: "Lend", + }, LOAN_FOX: { icon: "handshake", label: "Loan Fox", @@ -117,6 +137,10 @@ export const transactionActionsMetadata: Record< icon: "openHand", label: "Offer Loan", }, + REBORROW_SOL_FOR_NFT: { + icon: "customer", + label: "Reborrow SOL", + }, RECEIVED: { icon: "arrowDown", label: "Received", @@ -125,6 +149,10 @@ export const transactionActionsMetadata: Record< icon: "sale", label: "Repay Loan", }, + REQUEST_LOAN: { + icon: "questionBubble", + label: "Request Loan", + }, RESCIND_LOAN: { icon: "close", label: "Rescind Loan", @@ -181,6 +209,10 @@ export const transactionActionsMetadata: Record< icon: "box", label: "Generic Transaction", }, + UPDATE_OFFER: { + icon: "cycle", + label: "Update Offer", + }, XNFT_INSTALL: { icon: "download", label: "xNFT Install", @@ -307,4 +339,16 @@ export const enum IconPaths { star = ``, close = ``, + + cycle = ``, + + customer = ``, + + questionBubble = ``, + + plus = ``, + + newspaper = ``, + + squareCheck = ``, } diff --git a/packages/xray/src/lib/parser/types.ts b/packages/xray/src/lib/parser/types.ts index 16406a22..7f7039b0 100644 --- a/packages/xray/src/lib/parser/types.ts +++ b/packages/xray/src/lib/parser/types.ts @@ -29,6 +29,14 @@ export enum ProtonSupportedType { RESCIND_LOAN, TAKE_LOAN, REPAY_LOAN, + CANCEL_OFFER, + LEND_FOR_NFT, + REQUEST_LOAN, + CANCEL_LOAN_REQUEST, + BORROW_SOL_FOR_NFT, + REBORROW_SOL_FOR_NFT, + CLAIM_NFT, + UPDATE_OFFER, } export enum ProtonSupportedActionType { @@ -69,6 +77,14 @@ export enum ProtonSupportedActionType { "RESCIND_LOAN", "TAKE_LOAN", "REPAY_LOAN", + "CANCEL_OFFER", + "LEND_FOR_NFT", + "REQUEST_LOAN", + "CANCEL_LOAN_REQUEST", + "BORROW_SOL_FOR_NFT", + "REBORROW_SOL_FOR_NFT", + "CLAIM_NFT", + "UPDATE_OFFER", } export const ProtonCustomActionLabelTypes = { From 7b25ee7a7d7214876f98036ef31016abb55a60ac Mon Sep 17 00:00:00 2001 From: ssamkkim Date: Sat, 22 Apr 2023 16:15:13 -0700 Subject: [PATCH 02/55] foreclose loan --- apps/web/src/lib/config.ts | 4 ++++ packages/xray/src/lib/parser/types.ts | 2 ++ 2 files changed, 6 insertions(+) diff --git a/apps/web/src/lib/config.ts b/apps/web/src/lib/config.ts index ecda9aaf..d3171212 100644 --- a/apps/web/src/lib/config.ts +++ b/apps/web/src/lib/config.ts @@ -82,6 +82,10 @@ export const transactionActionsMetadata: Record< icon: "squad", label: "Multisig Transaction", }, + FORECLOSE_LOAN: { + icon: "squareCheck", + label: "Foreclose Loan", + }, FREEZE: { icon: "cold", label: "Frozen", diff --git a/packages/xray/src/lib/parser/types.ts b/packages/xray/src/lib/parser/types.ts index 7f7039b0..e0c575c8 100644 --- a/packages/xray/src/lib/parser/types.ts +++ b/packages/xray/src/lib/parser/types.ts @@ -37,6 +37,7 @@ export enum ProtonSupportedType { REBORROW_SOL_FOR_NFT, CLAIM_NFT, UPDATE_OFFER, + FORECLOSE_LOAN, } export enum ProtonSupportedActionType { @@ -85,6 +86,7 @@ export enum ProtonSupportedActionType { "REBORROW_SOL_FOR_NFT", "CLAIM_NFT", "UPDATE_OFFER", + "FORECLOSE_LOAN", } export const ProtonCustomActionLabelTypes = { From f4d5ad3d5a3bdfde0edb0c2671aaeb9411acaf59 Mon Sep 17 00:00:00 2001 From: ssamkkim Date: Sat, 22 Apr 2023 17:58:39 -0700 Subject: [PATCH 03/55] stake & unstake token config --- apps/web/src/lib/config.ts | 8 ++++++++ packages/xray/src/lib/parser/types.ts | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/apps/web/src/lib/config.ts b/apps/web/src/lib/config.ts index 0eb77c45..520a64da 100644 --- a/apps/web/src/lib/config.ts +++ b/apps/web/src/lib/config.ts @@ -141,6 +141,10 @@ export const transactionActionsMetadata: Record< icon: "star", label: "Staked SOL", }, + STAKE_TOKEN: { + icon: "star", + label: "Staked Token", + }, SWAP: { filterLabel: "Swap", icon: "swap", @@ -181,6 +185,10 @@ export const transactionActionsMetadata: Record< icon: "box", label: "Generic Transaction", }, + UNSTAKE_TOKEN: { + icon: "cancel", + label: "Unstake Token", + }, XNFT_INSTALL: { icon: "download", label: "xNFT Install", diff --git a/packages/xray/src/lib/parser/types.ts b/packages/xray/src/lib/parser/types.ts index 16406a22..e2ab358e 100644 --- a/packages/xray/src/lib/parser/types.ts +++ b/packages/xray/src/lib/parser/types.ts @@ -29,6 +29,8 @@ export enum ProtonSupportedType { RESCIND_LOAN, TAKE_LOAN, REPAY_LOAN, + STAKE_TOKEN, + UNSTAKE_TOKEN, } export enum ProtonSupportedActionType { @@ -69,6 +71,8 @@ export enum ProtonSupportedActionType { "RESCIND_LOAN", "TAKE_LOAN", "REPAY_LOAN", + "STAKE_TOKEN", + "UNSTAKE_TOKEN", } export const ProtonCustomActionLabelTypes = { From ae5c51d049118511419b6f1971cff7a9b890b2eb Mon Sep 17 00:00:00 2001 From: ssamkkim Date: Sun, 23 Apr 2023 23:23:31 -0700 Subject: [PATCH 04/55] search resolves cnfts --- packages/xray/src/lib/search.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/xray/src/lib/search.ts b/packages/xray/src/lib/search.ts index 522aaeeb..61e22104 100644 --- a/packages/xray/src/lib/search.ts +++ b/packages/xray/src/lib/search.ts @@ -50,8 +50,10 @@ export const search = async ( const account = await connection.getParsedAccountInfo(pubkey); // TODO Property 'program' does not exist on type 'Buffer | ParsedAccountData'. - // @ts-ignore - const isToken = account?.value?.data?.program === "spl-token"; + const isToken = + // @ts-ignore + account?.value?.data?.program === "spl-token" || + account?.value === null; const addressType = isToken ? "token" : "account"; From 3720d8def92123097dc7802f5824977bb768eaad Mon Sep 17 00:00:00 2001 From: Jimii Date: Mon, 24 Apr 2023 22:25:03 +0300 Subject: [PATCH 05/55] chore: add recommendations for vscode --- .vscode/extensions.json | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .vscode/extensions.json diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 00000000..390bb503 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,16 @@ +{ + // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp + + // List of extensions which should be recommended for users of this workspace. + "recommendations": [ + "aaron-bond.better-comments", + "svelte.svelte-vscode", + "prisma.prisma", + "esbenp.prettier-vscode", + "dbaeumer.vscode-eslint", + ], + // List of extensions recommended by VS Code that should not be recommended for users of this workspace. + "unwantedRecommendations": [ + + ] +} \ No newline at end of file From f7cf15b86e037a5a21d125808d2e8f04a1a1139c Mon Sep 17 00:00:00 2001 From: Jimii Date: Mon, 24 Apr 2023 22:34:48 +0300 Subject: [PATCH 06/55] chore: add .env template file --- .env.template | 1 + 1 file changed, 1 insertion(+) create mode 100644 .env.template diff --git a/.env.template b/.env.template new file mode 100644 index 00000000..a8b8d7ab --- /dev/null +++ b/.env.template @@ -0,0 +1 @@ +HELIUS_KEY = "" \ No newline at end of file From dc582432d5b3603d5455a3ae835ad40d1144d669 Mon Sep 17 00:00:00 2001 From: scammo Date: Tue, 25 Apr 2023 21:06:48 -0700 Subject: [PATCH 07/55] Update config.ts --- apps/web/src/lib/config.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/web/src/lib/config.ts b/apps/web/src/lib/config.ts index 94250004..db1b7cf3 100644 --- a/apps/web/src/lib/config.ts +++ b/apps/web/src/lib/config.ts @@ -220,6 +220,7 @@ export const transactionActionsMetadata: Record< UPDATE_OFFER: { icon: "cycle", label: "Update Offer", + }, UNSTAKE_TOKEN: { icon: "cancel", label: "Unstake Token", From 7ad5c505ddd815b1c89a57a18a41d4ed2f5d53fd Mon Sep 17 00:00:00 2001 From: Miles Smith <126003768+helius-wedtm@users.noreply.github.com> Date: Sun, 7 May 2023 11:49:14 -0400 Subject: [PATCH 08/55] feat: update to helius icarus endpoint --- apps/web/src/lib/trpc/routes/asset.ts | 78 ++++++++++++------------ packages/helius-sdk/src/utils/cluster.ts | 2 +- packages/xray/src/lib/connect.ts | 16 ++--- 3 files changed, 48 insertions(+), 48 deletions(-) diff --git a/apps/web/src/lib/trpc/routes/asset.ts b/apps/web/src/lib/trpc/routes/asset.ts index 821345d4..7e2755f5 100644 --- a/apps/web/src/lib/trpc/routes/asset.ts +++ b/apps/web/src/lib/trpc/routes/asset.ts @@ -6,47 +6,47 @@ const { HELIUS_KEY } = process.env; // TODO: add output validation once this merges with the token endpoint export const asset = t.procedure.input(z.string()).query(async ({ input }) => { - const url = `https://rpc.helius.xyz/?api-key=${HELIUS_KEY}`; + const url = `https://icarus.helius.xyz/?api-key=${HELIUS_KEY}`; - const response = await fetch(url, { - body: JSON.stringify({ - id: "asset", - jsonrpc: "2.0", - method: "getAsset", - params: [input], - }), - headers: { - "Content-Type": "application/json", - }, - method: "POST", - }); + const response = await fetch(url, { + body: JSON.stringify({ + id: "asset", + jsonrpc: "2.0", + method: "getAsset", + params: [input], + }), + headers: { + "Content-Type": "application/json", + }, + method: "POST", + }); - const data = await response.json(); - let metadata = { - address: "", - attributes: [], - collectionKey: "", - compressed: false, - creators: [], - description: "", - image: "", - name: "", - }; + const data = await response.json(); + let metadata = { + address: "", + attributes: [], + collectionKey: "", + compressed: false, + creators: [], + description: "", + image: "", + name: "", + }; - if (data?.result?.compression?.compressed === true) { - const assetData = await fetch(data.result.content.json_uri); - const returnAssetData = await assetData.json(); + if (data?.result?.compression?.compressed === true) { + const assetData = await fetch(data.result.content.json_uri); + const returnAssetData = await assetData.json(); - metadata = { - address: data?.result?.id || "", - attributes: returnAssetData?.attributes || [], - collectionKey: data?.result?.grouping[0]?.group_value || "", - compressed: true, - creators: data?.result?.creators || [], - description: returnAssetData?.description || "", - image: returnAssetData?.image || "", - name: returnAssetData?.name || "", - }; - } - return metadata; + metadata = { + address: data?.result?.id || "", + attributes: returnAssetData?.attributes || [], + collectionKey: data?.result?.grouping[0]?.group_value || "", + compressed: true, + creators: data?.result?.creators || [], + description: returnAssetData?.description || "", + image: returnAssetData?.image || "", + name: returnAssetData?.name || "", + }; + } + return metadata; }); diff --git a/packages/helius-sdk/src/utils/cluster.ts b/packages/helius-sdk/src/utils/cluster.ts index 4f38e48a..2fdc9ea6 100644 --- a/packages/helius-sdk/src/utils/cluster.ts +++ b/packages/helius-sdk/src/utils/cluster.ts @@ -11,7 +11,7 @@ export function heliusClusterApiUrl( case "devnet": return `https://rpc-devnet.helius.xyz/?api-key=${apiKey}`; case "mainnet-beta": - return `https://rpc.helius.xyz/?api-key=${apiKey}`; + return `https://icarus.helius.xyz/?api-key=${apiKey}`; default: return ""; } diff --git a/packages/xray/src/lib/connect.ts b/packages/xray/src/lib/connect.ts index 016d8629..bd0c5cba 100644 --- a/packages/xray/src/lib/connect.ts +++ b/packages/xray/src/lib/connect.ts @@ -1,19 +1,19 @@ import { Connection } from "@solana/web3.js"; const networks = { - devnet: `https://rpc-devnet.helius.xyz/`, - mainnet: `https://rpc.helius.xyz/`, - solanaMainnet: "https://api.mainnet-beta.solana.com", + devnet: `https://rpc-devnet.helius.xyz/`, + mainnet: `https://icarus.helius.xyz/`, + solanaMainnet: "https://api.mainnet-beta.solana.com", }; export type Network = keyof typeof networks; export const connect = (network: Network = "mainnet", heliusKey?: string) => { - let url = networks[network]; + let url = networks[network]; - if (heliusKey) { - url += `?api-key=${heliusKey}`; - } + if (heliusKey) { + url += `?api-key=${heliusKey}`; + } - return new Connection(url, "confirmed"); + return new Connection(url, "confirmed"); }; From 28f727e565e2ac03dd1636eba817c1e3605cdc7b Mon Sep 17 00:00:00 2001 From: Miles Smith Date: Tue, 9 May 2023 14:26:45 -0400 Subject: [PATCH 09/55] fix: formatting and new url psa: cloudflare enterprise for startups sucks, do not recommend. --- apps/web/src/lib/trpc/routes/asset.ts | 78 ++++++++++++------------ packages/helius-sdk/src/utils/cluster.ts | 20 +++--- packages/xray/src/lib/connect.ts | 16 ++--- 3 files changed, 57 insertions(+), 57 deletions(-) diff --git a/apps/web/src/lib/trpc/routes/asset.ts b/apps/web/src/lib/trpc/routes/asset.ts index 7e2755f5..1a993bc5 100644 --- a/apps/web/src/lib/trpc/routes/asset.ts +++ b/apps/web/src/lib/trpc/routes/asset.ts @@ -6,47 +6,47 @@ const { HELIUS_KEY } = process.env; // TODO: add output validation once this merges with the token endpoint export const asset = t.procedure.input(z.string()).query(async ({ input }) => { - const url = `https://icarus.helius.xyz/?api-key=${HELIUS_KEY}`; + const url = `https://mainnet-beta.solanarpc.network/?api-key=${HELIUS_KEY}`; - const response = await fetch(url, { - body: JSON.stringify({ - id: "asset", - jsonrpc: "2.0", - method: "getAsset", - params: [input], - }), - headers: { - "Content-Type": "application/json", - }, - method: "POST", - }); + const response = await fetch(url, { + body: JSON.stringify({ + id: "asset", + jsonrpc: "2.0", + method: "getAsset", + params: [input], + }), + headers: { + "Content-Type": "application/json", + }, + method: "POST", + }); - const data = await response.json(); - let metadata = { - address: "", - attributes: [], - collectionKey: "", - compressed: false, - creators: [], - description: "", - image: "", - name: "", - }; + const data = await response.json(); + let metadata = { + address: "", + attributes: [], + collectionKey: "", + compressed: false, + creators: [], + description: "", + image: "", + name: "", + }; - if (data?.result?.compression?.compressed === true) { - const assetData = await fetch(data.result.content.json_uri); - const returnAssetData = await assetData.json(); + if (data?.result?.compression?.compressed === true) { + const assetData = await fetch(data.result.content.json_uri); + const returnAssetData = await assetData.json(); - metadata = { - address: data?.result?.id || "", - attributes: returnAssetData?.attributes || [], - collectionKey: data?.result?.grouping[0]?.group_value || "", - compressed: true, - creators: data?.result?.creators || [], - description: returnAssetData?.description || "", - image: returnAssetData?.image || "", - name: returnAssetData?.name || "", - }; - } - return metadata; + metadata = { + address: data?.result?.id || "", + attributes: returnAssetData?.attributes || [], + collectionKey: data?.result?.grouping[0]?.group_value || "", + compressed: true, + creators: data?.result?.creators || [], + description: returnAssetData?.description || "", + image: returnAssetData?.image || "", + name: returnAssetData?.name || "", + }; + } + return metadata; }); diff --git a/packages/helius-sdk/src/utils/cluster.ts b/packages/helius-sdk/src/utils/cluster.ts index 2fdc9ea6..ef187d4c 100644 --- a/packages/helius-sdk/src/utils/cluster.ts +++ b/packages/helius-sdk/src/utils/cluster.ts @@ -4,15 +4,15 @@ import { Cluster } from "@solana/web3.js"; * Retrieves the Helius RPC API URL for the specified cluster */ export function heliusClusterApiUrl( - apiKey: string, - cluster: Cluster = "devnet" + apiKey: string, + cluster: Cluster = "devnet" ): string { - switch (cluster) { - case "devnet": - return `https://rpc-devnet.helius.xyz/?api-key=${apiKey}`; - case "mainnet-beta": - return `https://icarus.helius.xyz/?api-key=${apiKey}`; - default: - return ""; - } + switch (cluster) { + case "devnet": + return `https://rpc-devnet.helius.xyz/?api-key=${apiKey}`; + case "mainnet-beta": + return `https://mainnet-beta.solanarpc.network/?api-key=${apiKey}`; + default: + return ""; + } } diff --git a/packages/xray/src/lib/connect.ts b/packages/xray/src/lib/connect.ts index bd0c5cba..e5a2cd7a 100644 --- a/packages/xray/src/lib/connect.ts +++ b/packages/xray/src/lib/connect.ts @@ -1,19 +1,19 @@ import { Connection } from "@solana/web3.js"; const networks = { - devnet: `https://rpc-devnet.helius.xyz/`, - mainnet: `https://icarus.helius.xyz/`, - solanaMainnet: "https://api.mainnet-beta.solana.com", + devnet: `https://rpc-devnet.helius.xyz/`, + mainnet: `https://mainnet-beta.solanarpc.network/`, + solanaMainnet: "https://api.mainnet-beta.solana.com", }; export type Network = keyof typeof networks; export const connect = (network: Network = "mainnet", heliusKey?: string) => { - let url = networks[network]; + let url = networks[network]; - if (heliusKey) { - url += `?api-key=${heliusKey}`; - } + if (heliusKey) { + url += `?api-key=${heliusKey}`; + } - return new Connection(url, "confirmed"); + return new Connection(url, "confirmed"); }; From 1aef42dc03992b120b5280d47791a29443686ed7 Mon Sep 17 00:00:00 2001 From: joaomendoncaa Date: Sun, 14 May 2023 01:35:21 +0100 Subject: [PATCH 10/55] readme typo --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1c3a92c4..ddca1937 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,9 @@ A human-readable Solana transaction explorer powered by Helius. ## Support -- 📝 [Start Discussion](https://github.com/helius-labs/xray/discussions) -- 💡 [Submit Feature Request](https://github.com/helius-labs/xray/issues/new?assignees=&labels=question&template=FEATURE-REQUEST.yml&title=%F0%9F%92%A1+%5BREQUEST%5D+-+%3Ctitle%3E) -- 🐛 [Submit Bug Report](https://github.com/helius-labs/xray/issues/new?assignees=&labels=bug&template=BUG-REPORT.yml&title=%F0%9F%90%9B+%5BBUG%5D+-+%3Ctitle%3E) +- 📝 [Start Discussion](https://github.com/helius-labs/xray/discussions) +- 💡 [Submit Feature Request](https://github.com/helius-labs/xray/issues/new?assignees=&labels=question&template=FEATURE-REQUEST.yml&title=%F0%9F%92%A1+%5BREQUEST%5D+-+%3Ctitle%3E) +- 🐛 [Submit Bug Report](https://github.com/helius-labs/xray/issues/new?assignees=&labels=bug&template=BUG-REPORT.yml&title=%F0%9F%90%9B+%5BBUG%5D+-+%3Ctitle%3E) ## 🤝 Contribute @@ -40,7 +40,7 @@ Then when you're ready to create the PR, click "Ready for review". To save time, run tests locally, but they will also run on all PRs to `dev` and `main`. Tests will need to be passing for your changes to be merged. -### Auto merge `dev` -> `main`** +### Auto merge `dev` -> `main`\*\* Once changes are approved and merged into `dev`, they will be assumed as good and auto merged to `main`. From here they can be deployed by merging to either the `vercel/staging` or `vercel/prod` branches. @@ -263,4 +263,4 @@ Used for parsing blockchain data and making it pretty for the UI. # 📦 @helius-labs/xray-database [WIP] -A database for savaing metadata like transaction views or user details. +A database for saving metadata like transaction views or user details. From 3074f00449ec93f3e6991005bea364aea6a93d85 Mon Sep 17 00:00:00 2001 From: joaomendoncaa Date: Sun, 14 May 2023 03:53:34 +0100 Subject: [PATCH 11/55] feeBasisPoints on asset route - string util - icons - aditional info on collapsible - share per creator --- apps/web/src/app.postcss | 11 +++- apps/web/src/lib/components/collapse.svelte | 14 +++-- apps/web/src/lib/components/icon.svelte | 4 +- .../providers/token-provider.svelte | 3 ++ apps/web/src/lib/config.ts | 2 + apps/web/src/lib/trpc/routes/asset.ts | 2 + apps/web/src/lib/types.ts | 3 ++ apps/web/src/lib/util/percentage.ts | 3 ++ .../web/src/routes/token/[token]/+page.svelte | 53 +++++++++++++++++-- 9 files changed, 84 insertions(+), 11 deletions(-) create mode 100644 apps/web/src/lib/util/percentage.ts diff --git a/apps/web/src/app.postcss b/apps/web/src/app.postcss index 56ce81f6..08cbafcb 100644 --- a/apps/web/src/app.postcss +++ b/apps/web/src/app.postcss @@ -34,7 +34,12 @@ input::placeholder { } .card { - @apply rounded-lg border border-secondary bg-black p-3; + @apply rounded-lg border border-secondary bg-black p-3 transition-all duration-150; +} + +a.card:hover, +button.card:hover { + @apply border-[#fff]/50 bg-[#fff]/5; } .center { @@ -49,6 +54,10 @@ input::placeholder { @apply fill-green-500; } +.icon-stroke-success { + @apply stroke-green-500; +} + .icon-fill-black { @apply fill-black; } diff --git a/apps/web/src/lib/components/collapse.svelte b/apps/web/src/lib/components/collapse.svelte index d755b8b5..338e2b1c 100644 --- a/apps/web/src/lib/components/collapse.svelte +++ b/apps/web/src/lib/components/collapse.svelte @@ -1,11 +1,11 @@ @@ -21,11 +21,17 @@ id={iconId} size="md" fill="success" + stroke="success" /> {/if} -
+

{sectionTitle}

+ {#if sectionAditionalInfo} + {sectionAditionalInfo} + {/if}
diff --git a/apps/web/src/lib/components/icon.svelte b/apps/web/src/lib/components/icon.svelte index 0ec2b9b3..35972af3 100644 --- a/apps/web/src/lib/components/icon.svelte +++ b/apps/web/src/lib/components/icon.svelte @@ -6,6 +6,7 @@ export let id: Icon; export let path: string = ""; export let fill: string = "current" as "current" | "success" | "base-100"; + export let stroke: string = "current" as "current" | "success" | "base-100"; export let size = "sm" as "xs" | "sm" | "md" | "lg"; let el: SVGElement; @@ -31,7 +32,8 @@ diff --git a/apps/web/src/lib/components/providers/token-provider.svelte b/apps/web/src/lib/components/providers/token-provider.svelte index 9b8f5683..7d935823 100644 --- a/apps/web/src/lib/components/providers/token-provider.svelte +++ b/apps/web/src/lib/components/providers/token-provider.svelte @@ -23,6 +23,7 @@ address: "", attributes: [], collectionKey: "", + sellerFeeBasisPoints: 0, creators: [], description: "", image: "", @@ -55,6 +56,8 @@ metadata.address = data?.account; metadata.attributes = data?.offChainMetadata?.metadata?.attributes; + metadata.sellerFeeBasisPoints = + data?.onChainMetadata?.metadata?.data?.sellerFeeBasisPoints || 0; metadata.creators = data?.onChainMetadata?.metadata?.data?.creators; metadata.description = data?.offChainMetadata?.metadata?.description; metadata.collectionKey = diff --git a/apps/web/src/lib/config.ts b/apps/web/src/lib/config.ts index db1b7cf3..01bf39be 100644 --- a/apps/web/src/lib/config.ts +++ b/apps/web/src/lib/config.ts @@ -363,4 +363,6 @@ export const enum IconPaths { newspaper = ``, squareCheck = ``, + + percentage = ``, } diff --git a/apps/web/src/lib/trpc/routes/asset.ts b/apps/web/src/lib/trpc/routes/asset.ts index 1a993bc5..4f9ce670 100644 --- a/apps/web/src/lib/trpc/routes/asset.ts +++ b/apps/web/src/lib/trpc/routes/asset.ts @@ -27,6 +27,7 @@ export const asset = t.procedure.input(z.string()).query(async ({ input }) => { attributes: [], collectionKey: "", compressed: false, + sellerFeeBasisPoints: 0, creators: [], description: "", image: "", @@ -42,6 +43,7 @@ export const asset = t.procedure.input(z.string()).query(async ({ input }) => { attributes: returnAssetData?.attributes || [], collectionKey: data?.result?.grouping[0]?.group_value || "", compressed: true, + sellerFeeBasisPoints: data?.result?.sellerFeeBasisPoints || 0, creators: data?.result?.creators || [], description: returnAssetData?.description || "", image: returnAssetData?.image || "", diff --git a/apps/web/src/lib/types.ts b/apps/web/src/lib/types.ts index 038fab95..d5e33d25 100644 --- a/apps/web/src/lib/types.ts +++ b/apps/web/src/lib/types.ts @@ -46,6 +46,7 @@ export interface UITokenMetadata { collectionKey: string; description?: string; attributes?: UITokenMetadataAttribute[]; + sellerFeeBasisPoints?: number; creators?: UITokenMetadataCreators[]; price?: number; } @@ -85,3 +86,5 @@ export interface Modal { } export type Modals = keyof typeof modals; + +export type NullableProp = T | null | undefined; diff --git a/apps/web/src/lib/util/percentage.ts b/apps/web/src/lib/util/percentage.ts new file mode 100644 index 00000000..fddc366c --- /dev/null +++ b/apps/web/src/lib/util/percentage.ts @@ -0,0 +1,3 @@ +/** Converts metaplex sellerFeeBasisPoints to a "pretty" percentage based string */ +export default (sellerFeeBasisPoints: number): string => + `${sellerFeeBasisPoints / 100}%`; diff --git a/apps/web/src/routes/token/[token]/+page.svelte b/apps/web/src/routes/token/[token]/+page.svelte index f9925176..5399f23f 100644 --- a/apps/web/src/routes/token/[token]/+page.svelte +++ b/apps/web/src/routes/token/[token]/+page.svelte @@ -18,6 +18,7 @@
@@ -34,20 +39,27 @@ >
- Transactions - Tokens + {#if $accountInfo?.data?.value?.owner === ACCOUNT_COMPRESSION_ID.toBase58()} + Concurrent Merkle Tree + {/if}
{#if !$page.url.pathname.endsWith("/tokens")}
- - -
- {#if intersecting} -
-
-
- {#if browser} - - {/if} -
-
- -
-

- Powered by - - - Helius - -

-
-
-
- -
-
-
-

- We provide the most powerful Solana RPC hardware - around. We offer the fastest speeds at the - lowest prices possible. We also provide private - RPCs for serious users. -

-
-
-
- -
-
-
-

- Quickly build bots, analytics, marketplaces, - portfolio or wallet trackers using the most - complete Solana NFT API. -

-
-
-
- -
-
-
-

- We allow you to query historical data by - multiple dimensions including transaction types - (DAO votes, NFT Mints, DeFi Swaps, etc) or - underlying protocols (Jupiter, Magic Eden, etc). -

-
-
-
- -
-
-
-

- Stream on-chain events on up to 100k addresses - for free. -

-
-
-
-
- - Get Started - - {/if} -
-
From d81b997cbaa6932996561f255489df1af08c71b4 Mon Sep 17 00:00:00 2001 From: scammo Date: Wed, 31 May 2023 19:36:13 -0700 Subject: [PATCH 21/55] log messages improved formatting (#171) * log messages component * log messages format improvement * program names * styling changes * finishing touches * removed unnecessary package * fixed invoke and logged colors --------- Co-authored-by: qudo <59782726+qudo-code@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../src/lib/components/log-messages.svelte | 61 ++- apps/web/src/lib/util/program-logs.ts | 144 +++++++ apps/web/src/lib/util/program-name.ts | 390 ++++++++++++++++++ apps/web/src/routes/tx/[tx]/+page.svelte | 9 +- 4 files changed, 596 insertions(+), 8 deletions(-) create mode 100644 apps/web/src/lib/util/program-logs.ts create mode 100644 apps/web/src/lib/util/program-name.ts diff --git a/apps/web/src/lib/components/log-messages.svelte b/apps/web/src/lib/components/log-messages.svelte index da59e228..604500d1 100644 --- a/apps/web/src/lib/components/log-messages.svelte +++ b/apps/web/src/lib/components/log-messages.svelte @@ -1,3 +1,62 @@ - + +
+ {#each parsedLogs as instruction, idx} + {#if idx === 0} +

+ + {`#${idx + 1} - `} + + + + {`${instruction.invokedProgram} Instruction`} + +

+ {:else} +

+ + {`#${idx + 1} - `} + + + + {`${instruction.invokedProgram} Instruction`} + +

+ {/if} + {#each instruction.logs as log} +

+ {log.prefix}{log.text} +

+ {/each} + {/each} +
+ +{#if totalComputeUnits > 0} +
+
+ {`${totalComputeUnits} compute units consumed`} +
+{/if} diff --git a/apps/web/src/lib/util/program-logs.ts b/apps/web/src/lib/util/program-logs.ts new file mode 100644 index 00000000..691dbfe0 --- /dev/null +++ b/apps/web/src/lib/util/program-logs.ts @@ -0,0 +1,144 @@ +// https://github.com/solana-labs/explorer/blob/master/src/utils/program-logs.ts + +import { getProgramName } from "./program-name"; + +export type LogMessage = { + text: string; + prefix: string; + style: "sky" | "success" | "error" | "tangerine" | "neutral"; +}; + +export type InstructionLogs = { + invokedProgram: string | null; + programAddress: string; + logs: LogMessage[]; + computeUnits: number; + truncated: boolean; + failed: boolean; +}; + +export const parseProgramLogs = (logs: string[]) => { + let depth = 0; + let parsedLogs: InstructionLogs[] = []; + + function prefixBuilder( + // Indent level starts at 1. + indentLevel: number + ) { + let prefix; + if (indentLevel <= 0) { + // Log should always be at index level 1 or higher + prefix = ""; + } else { + prefix = new Array(indentLevel - 1) + .fill("\u00A0\u00A0\u00A0\u00A0") + .join(""); + } + return prefix + "> "; + } + + logs.forEach((log) => { + if (log.startsWith("Program log:")) { + log = log.replace(/Program log: (.*)/g, (match, p1) => { + return `Logged "${p1}"`; + }); + + parsedLogs[parsedLogs.length - 1].logs.push({ + prefix: prefixBuilder(depth), + style: "tangerine", + text: log, + }); + } else if (log.startsWith("Log truncated")) { + parsedLogs[parsedLogs.length - 1].truncated = true; + } else { + const regex = /Program (\w*) invoke \[(\d)\]/g; + const matches = [...log.matchAll(regex)]; + + if (matches.length > 0) { + const programAddress = matches[0][1]; + const programName = getProgramName(programAddress); + + if (depth === 0) { + parsedLogs.push({ + computeUnits: 0, + failed: false, + invokedProgram: programName, + logs: [], + programAddress, + truncated: false, + }); + } else { + parsedLogs[parsedLogs.length - 1].logs.push({ + prefix: prefixBuilder(depth), + style: "sky", + text: `Invoked ${programName}`, + }); + } + + depth++; + } else if (log.includes("success")) { + parsedLogs[parsedLogs.length - 1].logs.push({ + prefix: prefixBuilder(depth), + style: "success", + text: `Returned success`, + }); + depth--; + } else if (log.includes("failed")) { + const instructionLog = parsedLogs[parsedLogs.length - 1]; + instructionLog.failed = true; + + let currText = `Returned error "${log.slice( + log.indexOf(": ") + 2 + )}"`; + // failed to verify log of previous program so reset depth and print full log + if (log.startsWith("failed")) { + depth++; + currText = log.charAt(0).toUpperCase() + log.slice(1); + } + + instructionLog.logs.push({ + prefix: prefixBuilder(depth), + style: "error", + text: currText, + }); + depth--; + } else { + if (depth === 0) { + parsedLogs.push({ + computeUnits: 0, + failed: false, + invokedProgram: null, + logs: [], + programAddress: "", + truncated: false, + }); + depth++; + } + + // Remove redundant program address from logs + log = log.replace( + /Program \w* consumed (\d*) (.*)/g, + (match, p1, p2) => { + // Only aggregate compute units consumed from top-level tx instructions + // because they include inner ix compute units as well. + if (depth === 1) { + parsedLogs[parsedLogs.length - 1].computeUnits += + Number.parseInt(p1); + } + + return `Consumed ${p1} ${p2}`; + } + ); + + // native program logs don't start with "Program log:" + parsedLogs[parsedLogs.length - 1].logs.push({ + prefix: prefixBuilder(depth), + style: "neutral", + text: log, + }); + } + } + }); + + return parsedLogs; +}; diff --git a/apps/web/src/lib/util/program-name.ts b/apps/web/src/lib/util/program-name.ts new file mode 100644 index 00000000..7247c187 --- /dev/null +++ b/apps/web/src/lib/util/program-name.ts @@ -0,0 +1,390 @@ +// Default Program Name : https://github.com/solana-labs/explorer/blob/master/src/utils/tx.ts + +import { + BPF_LOADER_DEPRECATED_PROGRAM_ID, + BPF_LOADER_PROGRAM_ID, + Ed25519Program, + SYSVAR_CLOCK_PUBKEY, + SYSVAR_RENT_PUBKEY, + SYSVAR_REWARDS_PUBKEY, + SYSVAR_STAKE_HISTORY_PUBKEY, + Secp256k1Program, + StakeProgram, + SystemProgram, + VOTE_PROGRAM_ID, +} from "@solana/web3.js"; + +export enum PROGRAM_NAMES { + // native built-ins + ADDRESS_LOOKUP_TABLE = "Address Lookup Table Program", + COMPUTE_BUDGET = "Compute Budget Program", + CONFIG = "Config Program", + STAKE = "Stake Program", + SYSTEM = "System Program", + VOTE = "Vote Program", + + // native precompiles + SECP256K1 = "Secp256k1 SigVerify Precompile", + ED25519 = "Ed25519 SigVerify Precompile", + + // spl + ASSOCIATED_TOKEN = "Associated Token Program", + ACCOUNT_COMPRESSION = "Account Compression Program", + FEATURE_PROPOSAL = "Feature Proposal Program", + LENDING = "Lending Program", + MEMO = "Memo Program", + MEMO_2 = "Memo Program v2", + NAME = "Name Service Program", + STAKE_POOL = "Stake Pool Program", + SWAP = "Swap Program", + TOKEN = "Token Program", + TOKEN_METADATA = "Token Metadata Program", + TOKEN_VAULT = "Token Vault Program", + + // other + ACUMEN = "Acumen Program", + BREAK_SOLANA = "Break Solana Program", + CHAINLINK_ORACLE = "Chainlink OCR2 Oracle Program", + CHAINLINK_STORE = "Chainlink Store Program", + CLOCKWORK_1 = "Clockwork Thread Program v1", + CLOCKWORK_2 = "Clockwork Thread Program v2", + MANGO_GOVERNANCE = "Mango Governance Program", + MANGO_ICO = "Mango ICO Program", + MANGO_1 = "Mango Program v1", + MANGO_2 = "Mango Program v2", + MANGO_3 = "Mango Program v3", + MARINADE = "Marinade Staking Program", + MERCURIAL = "Mercurial Stable Swap Program", + METAPLEX = "Metaplex Program", + NFT_AUCTION = "NFT Auction Program", + NFT_CANDY_MACHINE = "NFT Candy Machine Program", + NFT_CANDY_MACHINE_V2 = "NFT Candy Machine Program V2", + ORCA_SWAP_1 = "Orca Swap Program v1", + ORCA_SWAP_2 = "Orca Swap Program v2", + ORCA_AQUAFARM = "Orca Aquafarm Program", + PORT = "Port Finance Program", + PYTH_DEVNET = "Pyth Oracle Program", + PYTH_TESTNET = "Pyth Oracle Program", + PYTH_MAINNET = "Pyth Oracle Program", + QUARRY_MERGE_MINE = "Quarry Merge Mine", + QUARRY_MINE = "Quarry Mine", + QUARRY_MINT_WRAPPER = "Quarry Mint Wrapper", + QUARRY_REDEEMER = "Quarry Redeemer", + QUARRY_REGISTRY = "Quarry Registry", + RAYDIUM_AMM = "Raydium AMM Program", + RAYDIUM_IDO = "Raydium IDO Program", + RAYDIUM_LP_1 = "Raydium Liquidity Pool Program v1", + RAYDIUM_LP_2 = "Raydium Liquidity Pool Program v2", + RAYDIUM_STAKING = "Raydium Staking Program", + SABER_ROUTER = "Saber Router Program", + SABER_SWAP = "Saber Stable Swap Program", + SERUM_1 = "Serum Dex Program v1", + SERUM_2 = "Serum Dex Program v2", + SERUM_3 = "Serum Dex Program v3", + SERUM_SWAP = "Serum Swap Program", + SERUM_POOL = "Serum Pool", + SOLEND = "Solend Program", + SOLIDO = "Lido for Solana Program", + STEP_SWAP = "Step Finance Swap Program", + SWIM_SWAP = "Swim Swap Program", + SWITCHBOARD = "Switchboard Oracle Program", + WORMHOLE = "Wormhole", + WORMHOLE_CORE = "Wormhole Core Bridge", + WORMHOLE_TOKEN = "Wormhole Token Bridge", + WORMHOLE_NFT = "Wormhole NFT Bridge", + SOLANART = "Solanart", + SOLANART_GO = "Solanart - Global offers", + STEPN_DEX = "STEPN Dex", + OPENBOOK_DEX = "OpenBook Dex", +} + +export type ProgramInfo = { + name: string; +}; + +export const PROGRAM_INFO_BY_ID: { [address: string]: ProgramInfo } = { + "22Y43yTVxuUkoRKdm9thyRhQ3SdgQS7c7kB6UNCiaczD": { + name: PROGRAM_NAMES.SERUM_SWAP, + }, + + "27haf8L6oxUeXrHrgEgsexjSY5hbVUWEmvv9Nyxg8vQv": { + name: PROGRAM_NAMES.RAYDIUM_LP_2, + }, + [StakeProgram.programId.toBase58()]: { + name: PROGRAM_NAMES.STAKE, + }, + [SystemProgram.programId.toBase58()]: { + name: PROGRAM_NAMES.SYSTEM, + }, + [VOTE_PROGRAM_ID.toBase58()]: { + name: PROGRAM_NAMES.VOTE, + }, + + // native precompiles + [Secp256k1Program.programId.toBase58()]: { + name: PROGRAM_NAMES.SECP256K1, + }, + [Ed25519Program.programId.toBase58()]: { + name: PROGRAM_NAMES.ED25519, + }, + + "3XXuUFfweXBwFgFfYaejLvZE4cGZiHgKiGfMtdxNzYmv": { + name: PROGRAM_NAMES.CLOCKWORK_1, + }, + + "5ZfZAwP2m93waazg8DkrrVmsupeiPEvaEHowiUP7UAbJ": { + name: PROGRAM_NAMES.SOLANART_GO, + }, + + "5fNfvyp5czQVX77yoACa3JJVEhdRaWjPuazuWgjhTqEH": { + name: PROGRAM_NAMES.MANGO_2, + }, + + "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8": { + name: PROGRAM_NAMES.RAYDIUM_AMM, + }, + + "7sPptkymzvayoSbLXzBsXEF8TSf3typNnAWkrKrDizNb": { + name: PROGRAM_NAMES.MANGO_ICO, + }, + + "82yxjeMsvaURa4MbZZ7WZZHfobirZYkH1zF8fmeGtyaQ": { + name: PROGRAM_NAMES.ORCA_AQUAFARM, + }, + + "9HzJyW1qZsEiSfMUf6L2jo3CcTKAyBmSyKdwQeYisHrC": { + name: PROGRAM_NAMES.RAYDIUM_IDO, + }, + + "9W959DqEETiGZocYWCQPaJ6sBmUzgfxXfqGeTEdp3aQP": { + name: PROGRAM_NAMES.ORCA_SWAP_2, + }, + + "9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin": { + name: PROGRAM_NAMES.SERUM_3, + }, + + // spl + ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL: { + name: PROGRAM_NAMES.ASSOCIATED_TOKEN, + }, + + // native built-ins + AddressLookupTab1e1111111111111111111111111: { + name: PROGRAM_NAMES.ADDRESS_LOOKUP_TABLE, + }, + + BJ3jrUzddfuSrZHXSCxMUUQsjKEyLmuuyZebkcaFp2fg: { + name: PROGRAM_NAMES.SERUM_1, + }, + + BrEAK7zGZ6dM71zUDACDqJnekihmwF15noTddWTsknjC: { + name: PROGRAM_NAMES.BREAK_SOLANA, + }, + // other + C64kTdg1Hzv5KoQmZrQRcm2Qz7PkxtFBgw7EpFhvYn8W: { + name: PROGRAM_NAMES.ACUMEN, + }, + CJsLwbP1iu5DuUikHEJnLfANgKy6stB2uFgvBBHoyxwz: { + name: PROGRAM_NAMES.SOLANART, + }, + CLoCKyJ6DXBJqqu2VWx9RLbgnwwR6BMHHuyasVmfMzBh: { + name: PROGRAM_NAMES.CLOCKWORK_2, + }, + ComputeBudget111111111111111111111111111111: { + name: PROGRAM_NAMES.COMPUTE_BUDGET, + }, + Config1111111111111111111111111111111111111: { + name: PROGRAM_NAMES.CONFIG, + }, + CrX7kMhLC3cSsXJdT7JDgqrRVWGnUpX3gfEfxxU2NVLi: { + name: PROGRAM_NAMES.SOLIDO, + }, + Crt7UoUR6QgrFrN7j8rmSQpUTNWNSitSwWvsWGf1qZ5t: { + name: PROGRAM_NAMES.SABER_ROUTER, + }, + + DjVE6JNiYqPL2QXyCUUh8rNjHrbz9hXHNYt99MQ59qw1: { + name: PROGRAM_NAMES.ORCA_SWAP_1, + }, + Dooar9JkhdZ7J3LHN3A7YCuoGRUggXhQaG4kijfLGU2j: { + name: PROGRAM_NAMES.STEPN_DEX, + }, + DtmE9D2CSB4L5D6A15mraeEjrGMm6auWVzgaD8hK2tZM: { + name: PROGRAM_NAMES.SWITCHBOARD, + }, + EUqojwWA2rd19FZrzeBncJsm38Jm1hEhE3zsmX3bRc2o: { + name: PROGRAM_NAMES.SERUM_2, + }, + EhhTKczWMGQt46ynNeRX1WfeagwwJd7ufHvCDjRxjo5Q: { + name: PROGRAM_NAMES.RAYDIUM_STAKING, + }, + Feat1YXHhH6t1juaWF74WLcfv4XoNocjXA6sPWHNgAse: { + name: PROGRAM_NAMES.FEATURE_PROPOSAL, + }, + FsJ3A3u2vn5cTVofAjvy6y5kwABJAqYWpe4975bi2epH: { + name: PROGRAM_NAMES.PYTH_MAINNET, + }, + GqTPL6qRf5aUuqscLh8Rg2HTxPUXfhhAXDptTLhp1t2J: { + name: PROGRAM_NAMES.MANGO_GOVERNANCE, + }, + HEvSKofvBgfaexv23kMabbYqxasxU3mQ4ibBMEmJWHny: { + name: PROGRAM_NAMES.CHAINLINK_STORE, + }, + JD3bq9hGdy38PuWQ4h2YJpELmHVGPPfFSuFkpzAd9zfu: { + name: PROGRAM_NAMES.MANGO_1, + }, + LendZqTs7gn5CTSJU1jWKhKuVpjJGom45nnwPb2AMTi: { + name: PROGRAM_NAMES.LENDING, + }, + MERLuDFBMmsHnsBPZw2sDQZHvXFMwp8EdjudcU2HKky: { + name: PROGRAM_NAMES.MERCURIAL, + }, + MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD: { + name: PROGRAM_NAMES.MARINADE, + }, + Memo1UhkJRfHyvLMcVucJwxXeuD728EqVDDwQDxFMNo: { + name: PROGRAM_NAMES.MEMO, + }, + MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr: { + name: PROGRAM_NAMES.MEMO_2, + }, + Port7uDYB3wk6GJAw4KT1WpTeMtSu9bTcChBHkX2LfR: { + name: PROGRAM_NAMES.PORT, + }, + QMMD16kjauP5knBwxNUJRZ1Z5o3deBuFrqVjBVmmqto: { + name: PROGRAM_NAMES.QUARRY_MERGE_MINE, + }, + QMNeHCGYnLVDn1icRAfQZpjPLBNkfGbSKRB83G5d8KB: { + name: PROGRAM_NAMES.QUARRY_MINE, + }, + QMWoBmAyJLAsA1Lh9ugMTw2gciTihncciphzdNzdZYV: { + name: PROGRAM_NAMES.QUARRY_MINT_WRAPPER, + }, + QRDxhMw1P2NEfiw5mYXG79bwfgHTdasY2xNP76XSea9: { + name: PROGRAM_NAMES.QUARRY_REDEEMER, + }, + QREGBnEj9Sa5uR91AV8u3FxThgP5ZCvdZUW2bHAkfNc: { + name: PROGRAM_NAMES.QUARRY_REGISTRY, + }, + RVKd61ztZW9GUwhRbbLoYVRE5Xf1B2tVscKqwZqXgEr: { + name: PROGRAM_NAMES.RAYDIUM_LP_1, + }, + SPoo1Ku8WFXoNDMHPsrGSTSG1Y47rzgn41SLUNakuHy: { + name: PROGRAM_NAMES.STAKE_POOL, + }, + SSwpMgqNDsyV7mAgN9ady4bDVu5ySjmmXejXvy2vLt1: { + name: PROGRAM_NAMES.STEP_SWAP, + }, + SSwpkEEcbUqx4vtoEByFjSkhKdCT862DNVb52nZg1UZ: { + name: PROGRAM_NAMES.SABER_SWAP, + }, + SWiMDJYFUGj6cPrQ6QYYYWZtvXQdRChSVAygDZDsCHC: { + name: PROGRAM_NAMES.SWIM_SWAP, + }, + So1endDq2YkqhipRh3WViPa8hdiSpxWy6z3Z6tMCpAo: { + name: PROGRAM_NAMES.SOLEND, + }, + SwaPpA9LAaLfeLi3a68M4DjnLqgtticKg6CnyNwgAC8: { + name: PROGRAM_NAMES.SWAP, + }, + TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA: { + name: PROGRAM_NAMES.TOKEN, + }, + WnFt12ZrnzZrFZkt2xsNsaNWoQribnuQ5B5FrDbwDhD: { + name: PROGRAM_NAMES.WORMHOLE_NFT, + }, + WormT3McKhFJ2RkiGpdw9GKvNCrB2aB54gb2uV9MfQC: { + name: PROGRAM_NAMES.WORMHOLE, + }, + WvmTNLpGMVbwJVYztYL4Hnsy82cJhQorxjnnXcRm3b6: { + name: PROGRAM_NAMES.SERUM_POOL, + }, + auctxRXPeJoc4817jDhf4HbjnhEcr1cCXenosMhK5R8: { + name: PROGRAM_NAMES.NFT_AUCTION, + }, + cjg3oHmg9uuPsP8D6g29NWvhySJkdYdAo9D25PRbKXJ: { + name: PROGRAM_NAMES.CHAINLINK_ORACLE, + }, + cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK: { + name: PROGRAM_NAMES.ACCOUNT_COMPRESSION, + }, + cndy3Z4yapfJBmL3ShUp5exZKqR3z33thTzeNMm2gRZ: { + name: PROGRAM_NAMES.NFT_CANDY_MACHINE_V2, + }, + cndyAnrLdpjq1Ssp1z8xxDsB8dxe7u4HL5Nxi2K5WXZ: { + name: PROGRAM_NAMES.NFT_CANDY_MACHINE, + }, + gSbePebfvPy7tRqimPoVecS2UsBvYv46ynrzWocc92s: { + name: PROGRAM_NAMES.PYTH_DEVNET, + }, + metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s: { + name: PROGRAM_NAMES.TOKEN_METADATA, + }, + mv3ekLzLbnVPNxjSKvqBpU3ZeZXPQdEC3bp5MDEBG68: { + name: PROGRAM_NAMES.MANGO_3, + }, + namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX: { + name: PROGRAM_NAMES.NAME, + }, + p1exdMJcjVao65QdewkaZRUnU6VPSXhus9n2GzWfh98: { + name: PROGRAM_NAMES.METAPLEX, + }, + vau1zxA2LbssAUEF7Gpw91zMM1LvXrvpzJtmZ58rPsn: { + name: PROGRAM_NAMES.TOKEN_VAULT, + }, + worm2ZoG2kUd4vFXhvjh93UUH596ayRfgQ2MgjNMTth: { + name: PROGRAM_NAMES.WORMHOLE_CORE, + }, + wormDTUJ6AWPNvk59vGQbDvGJmqbDTdgWgAqcLBCgUb: { + name: PROGRAM_NAMES.WORMHOLE_TOKEN, + }, +}; + +export type LoaderName = (typeof LOADER_IDS)[keyof typeof LOADER_IDS]; +export const LOADER_IDS = { + BPFLoaderUpgradeab1e11111111111111111111111: "BPF Upgradeable Loader", + MoveLdr111111111111111111111111111111111111: "Move Loader", + [BPF_LOADER_DEPRECATED_PROGRAM_ID.toBase58()]: "BPF Loader", + [BPF_LOADER_PROGRAM_ID.toBase58()]: "BPF Loader 2", + NativeLoader1111111111111111111111111111111: "Native Loader", +} as const; + +export const SPECIAL_IDS: { [key: string]: string } = { + "1nc1nerator11111111111111111111111111111111": "Incinerator", + Sysvar1111111111111111111111111111111111111: "SYSVAR", +}; + +export const SYSVAR_IDS = { + [SYSVAR_CLOCK_PUBKEY.toBase58()]: "Sysvar: Clock", + Sysvar1nstructions1111111111111111111111111: "Sysvar: Instructions", + SysvarEpochSchedu1e111111111111111111111111: "Sysvar: Epoch Schedule", + SysvarFees111111111111111111111111111111111: "Sysvar: Fees", + [SYSVAR_RENT_PUBKEY.toBase58()]: "Sysvar: Rent", + [SYSVAR_REWARDS_PUBKEY.toBase58()]: "Sysvar: Rewards", + SysvarRecentB1ockHashes11111111111111111111: "Sysvar: Recent Blockhashes", + SysvarS1otHashes111111111111111111111111111: "Sysvar: Slot Hashes", + [SYSVAR_STAKE_HISTORY_PUBKEY.toBase58()]: "Sysvar: Stake History", + SysvarS1otHistory11111111111111111111111111: "Sysvar: Slot History", +}; + +export function getDefaultProgramName(address: string): string { + const label = programLabel(address); + if (label) return label; + return `Unknown Program (${address})`; +} + +export function programLabel(address: string): string | undefined { + const programInfo = PROGRAM_INFO_BY_ID[address]; + if (programInfo) { + return programInfo.name; + } + + return LOADER_IDS[address]; +} + +export function getProgramName(address: string) { + const defaultProgramName = getDefaultProgramName(address); + + return defaultProgramName; +} diff --git a/apps/web/src/routes/tx/[tx]/+page.svelte b/apps/web/src/routes/tx/[tx]/+page.svelte index 93e5300c..bcf4f364 100644 --- a/apps/web/src/routes/tx/[tx]/+page.svelte +++ b/apps/web/src/routes/tx/[tx]/+page.svelte @@ -16,6 +16,7 @@ import IconCard from "$lib/components/icon-card.svelte"; import Icon from "$lib/components/icon.svelte"; import JSON from "$lib/components/json.svelte"; + import LogMessages from "$lib/components/log-messages.svelte"; import Transaction from "$lib/components/transaction.svelte"; import Collapse from "src/lib/components/collapse.svelte"; @@ -306,13 +307,7 @@ )} hideIcon={true} > - {#each rawData?.transaction?.meta?.logMessages || [] as message} -

- >{message} -

- {/each} +
{/if} From 850c83baab6d5bad52ea258ca0efb1347744ec1e Mon Sep 17 00:00:00 2001 From: scammo Date: Wed, 31 May 2023 19:39:49 -0700 Subject: [PATCH 22/55] switch back to rpc.helius.xyz (#185) * route addition * switch beta rpc link back to rpc.helius.xyz * delete unwanted files --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- apps/web/src/lib/trpc/routes/asset.ts | 2 +- packages/helius-sdk/src/utils/cluster.ts | 2 +- packages/xray/src/lib/connect.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/web/src/lib/trpc/routes/asset.ts b/apps/web/src/lib/trpc/routes/asset.ts index 68815385..0192347f 100644 --- a/apps/web/src/lib/trpc/routes/asset.ts +++ b/apps/web/src/lib/trpc/routes/asset.ts @@ -6,7 +6,7 @@ const { HELIUS_KEY } = process.env; // TODO: add output validation once this merges with the token endpoint export const asset = t.procedure.input(z.string()).query(async ({ input }) => { - const url = `https://mainnet-beta.solanarpc.network/?api-key=${HELIUS_KEY}`; + const url = `https://rpc.helius.xyz/?api-key=${HELIUS_KEY}`; const response = await fetch(url, { body: JSON.stringify({ diff --git a/packages/helius-sdk/src/utils/cluster.ts b/packages/helius-sdk/src/utils/cluster.ts index 1d7fa6c9..cb9aef40 100644 --- a/packages/helius-sdk/src/utils/cluster.ts +++ b/packages/helius-sdk/src/utils/cluster.ts @@ -9,7 +9,7 @@ export function heliusClusterApiUrl( case "devnet": return `https://rpc-devnet.helius.xyz/?api-key=${apiKey}`; case "mainnet-beta": - return `https://mainnet-beta.solanarpc.network/?api-key=${apiKey}`; + return `https://rpc.helius.xyz/?api-key=${apiKey}`; default: return ""; } diff --git a/packages/xray/src/lib/connect.ts b/packages/xray/src/lib/connect.ts index e5a2cd7a..016d8629 100644 --- a/packages/xray/src/lib/connect.ts +++ b/packages/xray/src/lib/connect.ts @@ -2,7 +2,7 @@ import { Connection } from "@solana/web3.js"; const networks = { devnet: `https://rpc-devnet.helius.xyz/`, - mainnet: `https://mainnet-beta.solanarpc.network/`, + mainnet: `https://rpc.helius.xyz/`, solanaMainnet: "https://api.mainnet-beta.solana.com", }; From ae66ea324d35c0acb6f996831579e74054ad1b60 Mon Sep 17 00:00:00 2001 From: scammo Date: Wed, 31 May 2023 19:40:16 -0700 Subject: [PATCH 23/55] compressed nft transfer fix (#178) * fix * futureproof --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- packages/xray/src/lib/parser/parsers/nft.ts | 62 +++++++++++---------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/packages/xray/src/lib/parser/parsers/nft.ts b/packages/xray/src/lib/parser/parsers/nft.ts index eb963cab..6e9483c2 100644 --- a/packages/xray/src/lib/parser/parsers/nft.ts +++ b/packages/xray/src/lib/parser/parsers/nft.ts @@ -400,29 +400,30 @@ export const parseCompressedNftMint: ProtonParser = (transaction, address) => { traverseAccountData(accountData, accounts); for (let i = 0; i < nftEvent.length; i++) { + const nftEventAction = nftEvent[i]; if (!address) { actions.push({ actionType: "TRANSFER", amount: 1, from: "", - sent: nftEvent[i].assetId, - to: nftEvent[i].newLeafOwner, + sent: nftEventAction.assetId, + to: nftEventAction.newLeafOwner, }); - } else if (address === nftEvent[i].newLeafOwner) { + } else if (address === nftEventAction.newLeafOwner) { actions.push({ actionType: "AIRDROP", amount: 1, from: "", - received: nftEvent[i].assetId, - to: nftEvent[i].newLeafOwner, + received: nftEventAction.assetId, + to: nftEventAction.newLeafOwner, }); } else { actions.push({ actionType: "RECEIVED", amount: 1, from: "", - received: nftEvent[i].assetId, - to: nftEvent[i].newLeafOwner, + received: nftEventAction.assetId, + to: nftEventAction.newLeafOwner, }); } } @@ -459,31 +460,34 @@ export const parseCompressedNftTransfer: ProtonParser = ( traverseAccountData(accountData, accounts); - if (!address) { - actions.push({ - actionType: "TRANSFER", - amount: 1, - from: nftEvent[0].oldLeafOwner, - sent: nftEvent[0].assetId, - to: nftEvent[0].newLeafOwner, - }); - } else { - if ((address = nftEvent[0].oldLeafOwner)) { - actions.push({ - actionType: "TRANSFER_SENT", - amount: 1, - from: nftEvent[0].oldLeafOwner, - sent: nftEvent[0].assetId, - to: nftEvent[0].newLeafOwner, - }); - } else if (address === nftEvent[0].newLeafOwner) { + for (let i = 0; i < nftEvent.length; i++) { + const nftEventAction = nftEvent[i]; + if (!address) { actions.push({ - actionType: "TRANSFER_RECEIVED", + actionType: "TRANSFER", amount: 1, - from: nftEvent[0].oldLeafOwner, - received: nftEvent[0].assetId, - to: nftEvent[0].newLeafOwner, + from: nftEventAction.oldLeafOwner, + sent: nftEventAction.assetId, + to: nftEventAction.newLeafOwner, }); + } else { + if (address === nftEventAction.oldLeafOwner) { + actions.push({ + actionType: "TRANSFER_SENT", + amount: 1, + from: nftEventAction.oldLeafOwner, + sent: nftEventAction.assetId, + to: nftEventAction.newLeafOwner, + }); + } else if (address === nftEventAction.newLeafOwner) { + actions.push({ + actionType: "TRANSFER_RECEIVED", + amount: 1, + from: nftEventAction.oldLeafOwner, + received: nftEventAction.assetId, + to: nftEventAction.newLeafOwner, + }); + } } } From 00ab884fa0f1eec3ecec629b9ed6c696a25e624b Mon Sep 17 00:00:00 2001 From: scammo Date: Wed, 31 May 2023 19:40:35 -0700 Subject: [PATCH 24/55] proton documentation redo (#165) * deleted outdated stuff * update --------- Co-authored-by: qudo <59782726+qudo-code@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- README.md | 50 +++++++++++--------------------------------------- 1 file changed, 11 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index ea3a4617..b44d2e3f 100644 --- a/README.md +++ b/README.md @@ -217,49 +217,21 @@ WIP - [TanstackQuery](https://tanstack.com/query/latest) - [SvelteKit tRPC SvelteQuery Adapter](https://github.com/vishalbalaji/trpc-svelte-query-adapter) -# 📦 @helius-labs/proton +# 📦 @helius-labs/xray -Used for parsing blockchain data and making it pretty for the UI. +A package that includes our parser, which helps make blockchain data pretty for the UI, and search function. ## Important Files & Folders -| | | -| -------------------------- | ------------------------------------------------------------------------------------- | -| 📄`./index.ts` | UI calls the function in this file to parse transactions | -| 📄`./src/types/index.ts` | Contains the types, interfaces, and enums needed to understand to work on the parser. | -| 📁`./src/parsers` | Contains all parser methods. | -| 📄`./src/parsers/index.ts` | Exports parser files in `./src/parsers`. | -| 📁`./src/utils` | Utility functions for parser functions | - -## General Work Flow When Adding a New Transaction Type - -1. Identify a transaction type that is not currently supported. - - [Helius API Docs](https://docs.helius.xyz/reference/transaction-types) - View all transaction types supported by Helius. -2. Get to know the transaction type. Here is the resource I personally like to use for it: - - [SwaggerHub](https://app.swaggerhub.com/apis-docs/Helius/HeliusAPI/1.1.0#/Transactions/getEnrichedTransactions) - Use `/v0/addresses/{address}/transactions ` for addresses with the specific transaction type or `/v0/transactions/` for a transaction (also supports multiple transactions). I like downloading the JSON file and looking through it constantly. More transactions + edge cases are better to battle test your parser function. -3. Add a new file or edit an existing one in `./src/parsers`. (refer to other files for general structures of what a parser function should look like) -4. Export the function in `./src/parsers/index.ts`, add the transaction type to the `ProtonSupportedType` object in `./src/types/index.ts`, and add the transaction type with the corresponding parser function to the `protonParsers` object in `./src/types/index.ts`. -5. Work on the parser function while testing it since it is now compatible with the UI. - -## Currently Supported Transactions - -| | | -| -------------------- | -------------------------- | -| **Transaction Type** | **File in `/src/parsers`** | -| TRANSFER | `/transfer.ts` | -| SWAP | `/swap.ts` | -| BURN | `/burn.ts` | -| BURN_NFT | `/burn.ts` | -| TOKEN_MINT | `/token.ts` | -| NFT_MINT | `/nft.ts` | -| NFT_SALE | `/nft.ts` | -| NFT_LISTING | `/nft.ts` | -| NFT_CANCEL_LISTING | `/nft.ts` | -| NFT_BID | `/nft.ts` | -| NFT_BID_CANCELLED | `/nft.ts` | -| BORROW_FOX | `/fox.ts` | -| LOAN_FOX | `/fox.ts` | -| UNKNOWN | `/unknown.ts` | +| | | +| --------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 📄`./src/lib/parser/index.ts` | UI calls the function in this file to parse transactions | +| 📄`./src/lib/parser/types.ts` | Contains the types, interfaces, and enums needed to understand to work on the parser. | +| 📁`./src/lib/parser/parsers` | Contains all parser methods. | +| 📄`./src/lib/parser/parsers/index.ts` | Exports parser files in `./src/parsers`. | +| 📄`./src/lib/parser/parsers/unknown.ts` | If there is no dedicated parser file for a Helius transaction type, they are parsed in this file. Changing the label on the UI is in `./apps/web/src/lib/config.ts`. | +| 📁`./src/lib/parser/utils` | Utility functions for the parser functions | +| 📄`./src/lib/search.ts` | The function that resolves search inputs to a URL parameter. | # 📦 @helius-labs/xray-database [WIP] From 9ecf6c5f983e3bcbdfefb45743fbcc70e180a744 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Mendon=C3=A7a?= Date: Thu, 1 Jun 2023 03:42:13 +0100 Subject: [PATCH 25/55] base hooks for linting and formatting pre commit and testing pre push (#187) --- .eslintignore | 3 +- .husky/pre-commit | 4 + .husky/pre-push | 4 + .prettierignore | 3 +- package-lock.json | 497 +++++++++++++++++++++++++++++++++++++++++++++- package.json | 12 +- 6 files changed, 513 insertions(+), 10 deletions(-) create mode 100755 .husky/pre-commit create mode 100755 .husky/pre-push diff --git a/.eslintignore b/.eslintignore index c4855b08..339b0c01 100644 --- a/.eslintignore +++ b/.eslintignore @@ -5,4 +5,5 @@ package.json tsconfig.cjs.json tsconfig.esm.json tsconfig.json -package-lock.json \ No newline at end of file +package-lock.json +packages \ No newline at end of file diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 00000000..d24fdfc6 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +npx lint-staged diff --git a/.husky/pre-push b/.husky/pre-push new file mode 100755 index 00000000..879e9351 --- /dev/null +++ b/.husky/pre-push @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +npm run test diff --git a/.prettierignore b/.prettierignore index 326c466e..4ecd1575 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,4 +1,5 @@ .eslint/**/* packages/**/dist/**/* apps/**/.sveltekit/**/* -tsconfig.json \ No newline at end of file +tsconfig.json +packages \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index b8cda2fd..92d65ed9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -40,6 +40,8 @@ "eslint-plugin-svelte3": "^4.0.0", "eslint-plugin-this": "^0.2.3", "eslint-plugin-write-good-comments": "^0.1.4", + "husky": "^8.0.3", + "lint-staged": "^13.2.2", "nodemon": "^2.0.20", "prettier": "^2.8.4", "prettier-plugin-css-order": "^1.3.0", @@ -4832,6 +4834,28 @@ "node": ">= 8.0.0" } }, + "node_modules/aggregate-error": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", + "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "dev": true, + "dependencies": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/aggregate-error/node_modules/clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -5962,6 +5986,112 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/cli-truncate": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-3.1.0.tgz", + "integrity": "sha512-wfOBkjXteqSnI59oPcJkcPl/ZmwvMMOj340qUIY1SKZCv0B9Cf4D4fAucRkIKQmsIuYK3x1rrgU7MeGRruiuiA==", + "dev": true, + "dependencies": { + "slice-ansi": "^5.0.0", + "string-width": "^5.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-truncate/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/cli-truncate/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/cli-truncate/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, + "node_modules/cli-truncate/node_modules/is-fullwidth-code-point": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz", + "integrity": "sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-truncate/node_modules/slice-ansi": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-5.0.0.tgz", + "integrity": "sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.0.0", + "is-fullwidth-code-point": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, + "node_modules/cli-truncate/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-truncate/node_modules/strip-ansi": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.0.1.tgz", + "integrity": "sha512-cXNxvT8dFNRVfhVME3JAe98mkXDYN2O1l7jmcwMnOslDeESg1rF/OZMtK0nRAhiari1unG5cD4jG3rapUAkLbw==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, "node_modules/cli-width": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz", @@ -6094,6 +6224,12 @@ "color-support": "bin.js" } }, + "node_modules/colorette": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", + "dev": true + }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -6852,6 +6988,12 @@ "dev": true, "license": "MIT" }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true + }, "node_modules/eip1193-provider": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/eip1193-provider/-/eip1193-provider-1.0.1.tgz", @@ -8574,6 +8716,68 @@ "safe-buffer": "^5.1.1" } }, + "node_modules/execa": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-7.1.1.tgz", + "integrity": "sha512-wH0eMf/UXckdUYnO21+HDztteVv05rq2GXksxT4fCGeHkBhw1DROXh40wcjMcRqDOWE7iPJ4n3M7e2+YFP+76Q==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.1", + "human-signals": "^4.3.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^3.0.7", + "strip-final-newline": "^3.0.0" + }, + "engines": { + "node": "^14.18.0 || ^16.14.0 || >=18.0.0" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/execa/node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/execa/node_modules/mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/execa/node_modules/onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dev": true, + "dependencies": { + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/exenv": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/exenv/-/exenv-1.2.2.tgz", @@ -8994,6 +9198,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/get-symbol-description": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", @@ -9286,6 +9502,15 @@ "node": ">= 6" } }, + "node_modules/human-signals": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz", + "integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==", + "dev": true, + "engines": { + "node": ">=14.18.0" + } + }, "node_modules/humanize-ms": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", @@ -9294,6 +9519,21 @@ "ms": "^2.0.0" } }, + "node_modules/husky": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.3.tgz", + "integrity": "sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==", + "dev": true, + "bin": { + "husky": "lib/bin.js" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" + } + }, "node_modules/iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -10417,9 +10657,9 @@ } }, "node_modules/lilconfig": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.0.6.tgz", - "integrity": "sha512-9JROoBW7pobfsx+Sq2JsASvCo6Pfo6WWoUW79HuB1BCoBXD4PLWJPqDF6fNj67pqBYTbAHkE57M1kS/+L1neOg==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", + "integrity": "sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==", "engines": { "node": ">=10" } @@ -10433,6 +10673,140 @@ "uc.micro": "^1.0.1" } }, + "node_modules/lint-staged": { + "version": "13.2.2", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-13.2.2.tgz", + "integrity": "sha512-71gSwXKy649VrSU09s10uAT0rWCcY3aewhMaHyl2N84oBk4Xs9HgxvUp3AYu+bNsK4NrOYYxvSgg7FyGJ+jGcA==", + "dev": true, + "dependencies": { + "chalk": "5.2.0", + "cli-truncate": "^3.1.0", + "commander": "^10.0.0", + "debug": "^4.3.4", + "execa": "^7.0.0", + "lilconfig": "2.1.0", + "listr2": "^5.0.7", + "micromatch": "^4.0.5", + "normalize-path": "^3.0.0", + "object-inspect": "^1.12.3", + "pidtree": "^0.6.0", + "string-argv": "^0.3.1", + "yaml": "^2.2.2" + }, + "bin": { + "lint-staged": "bin/lint-staged.js" + }, + "engines": { + "node": "^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/lint-staged" + } + }, + "node_modules/lint-staged/node_modules/chalk": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.2.0.tgz", + "integrity": "sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA==", + "dev": true, + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/lint-staged/node_modules/commander": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", + "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", + "dev": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/listr2": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/listr2/-/listr2-5.0.8.tgz", + "integrity": "sha512-mC73LitKHj9w6v30nLNGPetZIlfpUniNSsxxrbaPcWOjDb92SHPzJPi/t+v1YC/lxKz/AJ9egOjww0qUuFxBpA==", + "dev": true, + "dependencies": { + "cli-truncate": "^2.1.0", + "colorette": "^2.0.19", + "log-update": "^4.0.0", + "p-map": "^4.0.0", + "rfdc": "^1.3.0", + "rxjs": "^7.8.0", + "through": "^2.3.8", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": "^14.13.1 || >=16.0.0" + }, + "peerDependencies": { + "enquirer": ">= 2.3.0 < 3" + }, + "peerDependenciesMeta": { + "enquirer": { + "optional": true + } + } + }, + "node_modules/listr2/node_modules/cli-truncate": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-2.1.0.tgz", + "integrity": "sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg==", + "dev": true, + "dependencies": { + "slice-ansi": "^3.0.0", + "string-width": "^4.2.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/listr2/node_modules/rxjs": { + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", + "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", + "dev": true, + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/listr2/node_modules/slice-ansi": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-3.0.0.tgz", + "integrity": "sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/listr2/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, "node_modules/localStorage": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/localStorage/-/localStorage-1.0.4.tgz", @@ -10541,6 +10915,38 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/log-update": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/log-update/-/log-update-4.0.0.tgz", + "integrity": "sha512-9fkkDevMefjg0mmzWFBW8YkFP91OrizzkW3diF7CpG+S2EYdy4+TVfGwz1zeF8x7hCx1ovSPTOE9Ngib74qqUg==", + "dev": true, + "dependencies": { + "ansi-escapes": "^4.3.0", + "cli-cursor": "^3.1.0", + "slice-ansi": "^4.0.0", + "wrap-ansi": "^6.2.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-update/node_modules/wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/loglevel": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.8.1.tgz", @@ -10746,6 +11152,12 @@ "integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==", "dev": true }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, "node_modules/merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", @@ -11720,6 +12132,33 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, + "node_modules/npm-run-path": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz", + "integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==", + "dev": true, + "dependencies": { + "path-key": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm-run-path/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/npm/node_modules/@colors/colors": { "version": "1.5.0", "dev": true, @@ -14753,6 +15192,21 @@ "node": ">=6" } }, + "node_modules/p-map": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", + "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", + "dev": true, + "dependencies": { + "aggregate-error": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/p-try": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", @@ -14890,6 +15344,18 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/pidtree": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.6.0.tgz", + "integrity": "sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==", + "dev": true, + "bin": { + "pidtree": "bin/pidtree.js" + }, + "engines": { + "node": ">=0.10" + } + }, "node_modules/pify": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", @@ -15899,6 +16365,12 @@ "node": ">=0.10.0" } }, + "node_modules/rfdc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz", + "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==", + "dev": true + }, "node_modules/rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", @@ -16669,6 +17141,18 @@ "node": ">=4" } }, + "node_modules/strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/strip-indent": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", @@ -18116,11 +18600,10 @@ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, "node_modules/yaml": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.2.1.tgz", - "integrity": "sha512-e0WHiYql7+9wr4cWMx3TVQrNwejKaEe7/rHNmQmqRjazfOP5W8PB6Jpebb5o6fIapbz9o9+2ipcaTM2ZwDI6lw==", + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.2.2.tgz", + "integrity": "sha512-CBKFWExMn46Foo4cldiChEzn7S7SRV+wqiluAb6xmueD/fGyRHIhX8m14vVGgeFWjN540nKCNVj6P21eQjgTuA==", "dev": true, - "license": "ISC", "engines": { "node": ">= 14" } diff --git a/package.json b/package.json index 094c14c7..02d920fd 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,15 @@ "test": "turbo lint", "lint": "turbo lint", "lint:fix": "eslint . --fix", - "format": "prettier --write \"**/*.{ts,tsx,md,svelte}\"" + "format": "prettier --write \"**/*.{ts,tsx,md,svelte}\"", + "prepare": "husky install" + }, + "lint-staged": { + "*.{js,jsx,ts,tsx}": [ + "npm run lint", + "npm run format", + "git add" + ] }, "devDependencies": { "@typescript-eslint/eslint-plugin": "^5.52.0", @@ -51,6 +59,8 @@ "eslint-plugin-svelte3": "^4.0.0", "eslint-plugin-this": "^0.2.3", "eslint-plugin-write-good-comments": "^0.1.4", + "husky": "^8.0.3", + "lint-staged": "^13.2.2", "nodemon": "^2.0.20", "prettier": "^2.8.4", "prettier-plugin-css-order": "^1.3.0", From 072d44d62a177e1166ad5eff0cdc5f76a5b4aea4 Mon Sep 17 00:00:00 2001 From: scammo Date: Wed, 31 May 2023 19:42:50 -0700 Subject: [PATCH 26/55] more transaction type configs (#160) * add item and update item types * token market configs * extra tx configs --------- Co-authored-by: qudo <59782726+qudo-code@users.noreply.github.com> --- apps/web/src/lib/config.ts | 57 +++++++++++++++++++++++++++ packages/xray/src/lib/parser/types.ts | 26 ++++++++++++ 2 files changed, 83 insertions(+) diff --git a/apps/web/src/lib/config.ts b/apps/web/src/lib/config.ts index 4e11af85..e2b88caf 100644 --- a/apps/web/src/lib/config.ts +++ b/apps/web/src/lib/config.ts @@ -31,6 +31,10 @@ export const transactionActionsMetadata: Record< ProtonActionType, TransactionActionMetadata > = { + ADD_ITEM: { + icon: "plus", + label: "Add Item", + }, AIRDROP: { icon: "gift", label: "Airdropped", @@ -57,6 +61,10 @@ export const transactionActionsMetadata: Record< icon: "flame", label: "Burned NFT", }, + BUY_ITEM: { + icon: "sale", + label: "Buy Item", + }, CANCEL_LOAN_REQUEST: { icon: "close", label: "Cancel Loan Request", @@ -65,10 +73,21 @@ export const transactionActionsMetadata: Record< icon: "close", label: "Cancel Offer", }, + CANCEL_ORDER: { + icon: "close", + label: "Cancel Order", + }, CLAIM_NFT: { icon: "squareCheck", label: "Claim NFT", }, + CLOSE_ITEM: { + icon: "close", + label: "Close Item", + }, + CLOSE_ORDER: { + icon: "close", + label: "Close Item", COMPRESSED_NFT_BURN: { icon: "flame", label: "Burned NFT", @@ -81,11 +100,23 @@ export const transactionActionsMetadata: Record< icon: "lightning", label: "Transfer", }, + CREATE_ORDER: { + icon: "plus", + label: "Create Order", + }, + DELIST_ITEM: { + icon: "close", + label: "Delist Item", + }, EXECUTE_TRANSACTION: { filterLabel: "Multisig Transaction", icon: "squad", label: "Multisig Transaction", }, + FILL_ORDER: { + icon: "squareCheck", + label: "Fill Order", + }, FORECLOSE_LOAN: { icon: "squareCheck", label: "Foreclose Loan", @@ -98,10 +129,18 @@ export const transactionActionsMetadata: Record< icon: "handshake", label: "Lend", }, + LIST_ITEM: { + icon: "list", + label: "List Item", + }, LOAN_FOX: { icon: "handshake", label: "Loan Fox", }, + MIGRATE_TO_PNFT: { + icon: "arrowRight", + label: "Migrate to pNFT", + }, NFT_BID: { icon: "sale", label: "NFT Bid", @@ -225,6 +264,22 @@ export const transactionActionsMetadata: Record< icon: "cancel", label: "Unstake Token", }, + UPDATE_ITEM: { + icon: "arrowUp", + label: "Update Item", + }, + UPDATE_OFFER: { + icon: "cycle", + label: "Update Offer", + }, + UPDATE_ORDER: { + icon: "arrowUp", + label: "Update Order", + }, + UPGRADE_FOX_REQUEST: { + icon: "arrowUp", + label: "Upgrade Fox", + }, UPDATE_OFFER: { icon: "cycle", label: "Update Offer", @@ -368,6 +423,8 @@ export const enum IconPaths { squareCheck = ``, + list = ``, + key = ``, tree = ``, diff --git a/packages/xray/src/lib/parser/types.ts b/packages/xray/src/lib/parser/types.ts index a0347549..d31a7a7b 100644 --- a/packages/xray/src/lib/parser/types.ts +++ b/packages/xray/src/lib/parser/types.ts @@ -29,6 +29,8 @@ export enum ProtonSupportedType { RESCIND_LOAN, TAKE_LOAN, REPAY_LOAN, + ADD_ITEM, + UPDATE_ITEM, CANCEL_OFFER, LEND_FOR_NFT, REQUEST_LOAN, @@ -40,6 +42,17 @@ export enum ProtonSupportedType { FORECLOSE_LOAN, STAKE_TOKEN, UNSTAKE_TOKEN, + BUY_ITEM, + CLOSE_ITEM, + CLOSE_ORDER, + DELIST_ITEM, + LIST_ITEM, + CANCEL_ORDER, + CREATE_ORDER, + UPDATE_ORDER, + FILL_ORDER, + UPGRADE_FOX_REQUEST, + MIGRATE_TO_PNFT, COMPRESSED_NFT_BURN, } @@ -81,6 +94,8 @@ export enum ProtonSupportedActionType { "RESCIND_LOAN", "TAKE_LOAN", "REPAY_LOAN", + "ADD_ITEM", + "UPDATE_ITEM", "CANCEL_OFFER", "LEND_FOR_NFT", "REQUEST_LOAN", @@ -92,6 +107,17 @@ export enum ProtonSupportedActionType { "FORECLOSE_LOAN", "STAKE_TOKEN", "UNSTAKE_TOKEN", + "BUY_ITEM", + "CLOSE_ITEM", + "CLOSE_ORDER", + "DELIST_ITEM", + "LIST_ITEM", + "CANCEL_ORDER", + "CREATE_ORDER", + "UPDATE_ORDER", + "FILL_ORDER", + "UPGRADE_FOX_REQUEST", + "MIGRATE_TO_PNFT", "COMPRESSED_NFT_BURN", } From 81e63cb415c53c8b69be5d4ca0a42e94ef3b2c87 Mon Sep 17 00:00:00 2001 From: scammo Date: Wed, 31 May 2023 19:45:29 -0700 Subject: [PATCH 27/55] username provider (#141) * account page title replacement * backpack and bonfida username trpc route * account usernames route to router * temp * backpack username display * updated bonfida package * get bonfida domain * usernames alignment fix * ans domain username * tldparser fix * added fix to prev commit * ans test * added catch to ans method * alternating username color styles * simplified username functions & get multiple .sol * skeleton loader & temp layout changes * temp domain * bonfida domain * deleted a bunch of useless code in ans func * responsiveness for numerous domains * remove ans code * ui adjustments --- .../src/lib/components/account-header.svelte | 120 ++++++++++++++---- .../providers/username-provider.svelte | 23 ++++ apps/web/src/lib/trpc/router.ts | 2 + .../src/lib/trpc/routes/account-usernames.ts | 57 +++++++++ 4 files changed, 177 insertions(+), 25 deletions(-) create mode 100644 apps/web/src/lib/components/providers/username-provider.svelte create mode 100644 apps/web/src/lib/trpc/routes/account-usernames.ts diff --git a/apps/web/src/lib/components/account-header.svelte b/apps/web/src/lib/components/account-header.svelte index e60b43cf..c5c5c9fb 100644 --- a/apps/web/src/lib/components/account-header.svelte +++ b/apps/web/src/lib/components/account-header.svelte @@ -1,3 +1,24 @@ + + - {:else}
@@ -173,7 +173,7 @@ processed.
-
+
Success
@@ -339,8 +339,8 @@
{/if} {:else} -

+

Transaction not found. Try selecting another network.

- + {/if} From 15508f600c144d8907cf718d36050da5216900bf Mon Sep 17 00:00:00 2001 From: 0xIchigo <0xIchigo@protonmail.com> Date: Tue, 14 Nov 2023 15:00:26 -0500 Subject: [PATCH 52/55] Fix Lint Errors --- src/lib/components/transactions.svelte | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/lib/components/transactions.svelte b/src/lib/components/transactions.svelte index 25473dc5..f41cba09 100644 --- a/src/lib/components/transactions.svelte +++ b/src/lib/components/transactions.svelte @@ -31,15 +31,15 @@ }) => compressed ? client.cnftTransactions.createInfiniteQuery(input, { - getNextPageParam: (lastPage) => lastPage.oldest, - refetchOnMount: false, - refetchOnWindowFocus: false, - }) + getNextPageParam: (lastPage) => lastPage.oldest, + refetchOnMount: false, + refetchOnWindowFocus: false, + }) : client.transactions.createInfiniteQuery(input, { - getNextPageParam: (lastPage) => lastPage.oldest, - refetchOnMount: false, - refetchOnWindowFocus: false, - }); + getNextPageParam: (lastPage) => lastPage.oldest, + refetchOnMount: false, + refetchOnWindowFocus: false, + }); const loadMore = () => { $transactions.fetchNextPage(); From daa858344237327571ffc91c8568b5cd39b21c6c Mon Sep 17 00:00:00 2001 From: 0xIchigo <0xIchigo@protonmail.com> Date: Tue, 14 Nov 2023 15:02:25 -0500 Subject: [PATCH 53/55] Fix Build Error in vite.config.js --- vite.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/vite.config.js b/vite.config.js index 5134d0f6..504d953d 100644 --- a/vite.config.js +++ b/vite.config.js @@ -6,6 +6,7 @@ import { NodeGlobalsPolyfillPlugin } from "@esbuild-plugins/node-globals-polyfil import { NodeModulesPolyfillPlugin } from "@esbuild-plugins/node-modules-polyfill"; import pkg from "./package.json"; +import path from "path"; const heliusKey = process.env.HELIUS_API_KEY; From 13812dc50492debba0d5fb2b1b5b5acd76a727b6 Mon Sep 17 00:00:00 2001 From: 0xIchigo <0xIchigo@protonmail.com> Date: Tue, 14 Nov 2023 15:07:37 -0500 Subject: [PATCH 54/55] Disable Lint for transactions.svelte --- src/lib/components/transactions.svelte | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/components/transactions.svelte b/src/lib/components/transactions.svelte index f41cba09..bd1750df 100644 --- a/src/lib/components/transactions.svelte +++ b/src/lib/components/transactions.svelte @@ -1,3 +1,4 @@ +/* eslint-disable */