diff --git a/package.json b/package.json index 2d714dd..99f995a 100644 --- a/package.json +++ b/package.json @@ -18,16 +18,17 @@ "@coral-xyz/anchor": "^0.27.0", "@headlessui/react": "1.7.13", "@headlessui/tailwindcss": "0.1.2", + "@helium/account-fetch-cache": "^0.2.5", "@helium/address": "^4.8.1", - "@helium/helium-react-hooks": "^0.0.51", - "@helium/helium-sub-daos-sdk": "^0.0.51", - "@helium/idls": "^0.0.51", - "@helium/spl-utils": "^0.0.51", - "@helium/treasury-management-sdk": "^0.0.51", + "@helium/helium-react-hooks": "^0.2.11", + "@helium/helium-sub-daos-sdk": "^0.2.5", + "@helium/idls": "^0.2.5", + "@helium/spl-utils": "^0.2.13", + "@helium/treasury-management-sdk": "^0.2.5", "@helium/voter-stake-registry-sdk": "^0.1.4", "@heroicons/react": "2.0.17", "@metaplex-foundation/mpl-token-metadata": "^2.9.1", - "@solana/spl-account-compression": "^0.1.7", + "@solana/spl-account-compression": "0.1.7", "@solana/spl-token": "^0.3.7", "@solana/web3.js": "^1.75.0", "@tailwindcss/forms": "0.5.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e99012b..5f26788 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,24 +14,27 @@ dependencies: "@headlessui/tailwindcss": specifier: 0.1.2 version: 0.1.2(tailwindcss@3.3.1) + "@helium/account-fetch-cache": + specifier: ^0.2.5 + version: 0.2.5(encoding@0.1.13) "@helium/address": specifier: ^4.8.1 version: 4.8.1 "@helium/helium-react-hooks": - specifier: ^0.0.51 - version: 0.0.51(encoding@0.1.13)(react-dom@18.2.0)(react@18.2.0) + specifier: ^0.2.11 + version: 0.2.11(encoding@0.1.13)(react-dom@18.2.0)(react@18.2.0) "@helium/helium-sub-daos-sdk": - specifier: ^0.0.51 - version: 0.0.51(@solana/web3.js@1.75.0)(encoding@0.1.13) + specifier: ^0.2.5 + version: 0.2.5(@solana/web3.js@1.75.0)(encoding@0.1.13) "@helium/idls": - specifier: ^0.0.51 - version: 0.0.51(encoding@0.1.13) + specifier: ^0.2.5 + version: 0.2.5(encoding@0.1.13) "@helium/spl-utils": - specifier: ^0.0.51 - version: 0.0.51(encoding@0.1.13) + specifier: ^0.2.13 + version: 0.2.13(encoding@0.1.13) "@helium/treasury-management-sdk": - specifier: ^0.0.51 - version: 0.0.51(@solana/web3.js@1.75.0)(encoding@0.1.13) + specifier: ^0.2.5 + version: 0.2.5(encoding@0.1.13) "@helium/voter-stake-registry-sdk": specifier: ^0.1.4 version: 0.1.4(@solana/web3.js@1.75.0)(encoding@0.1.13) @@ -42,7 +45,7 @@ dependencies: specifier: ^2.9.1 version: 2.9.1(encoding@0.1.13) "@solana/spl-account-compression": - specifier: ^0.1.7 + specifier: 0.1.7 version: 0.1.7(@solana/web3.js@1.75.0)(encoding@0.1.13) "@solana/spl-token": specifier: ^0.3.7 @@ -841,6 +844,52 @@ packages: tailwindcss: 3.3.1(postcss@8.4.21)(ts-node@10.9.1) dev: false + /@helium/account-fetch-cache-hooks@0.2.11(encoding@0.1.13)(react-dom@18.2.0)(react@18.2.0): + resolution: + { + integrity: sha512-pHHbsQlZQjS/P2y96oWC1Mne+U+W1axmuHixzI6GpRK+MZSaffegqtGbuANS8dR1HMU/lpef2Izz6n0MwhFNIg==, + } + peerDependencies: + react: ^16.8 || ^17 || ^18 + react-dom: ^16.8 || ^17 || ^18 + dependencies: + "@helium/account-fetch-cache": 0.2.5(encoding@0.1.13) + "@solana/web3.js": 1.75.0(encoding@0.1.13) + react: 18.2.0 + react-async-hook: 4.0.0(react@18.2.0) + react-dom: 18.2.0(react@18.2.0) + transitivePeerDependencies: + - bufferutil + - encoding + - supports-color + - utf-8-validate + dev: false + + /@helium/account-fetch-cache@0.2.5(encoding@0.1.13): + resolution: + { + integrity: sha512-Cv8ST15awWpaHJGkY3SGeb+BuZ0wzbS3AMtQ8ZAeUr+XuJ5mbaGZUE9QPI9dNPKV1txzgn4JkEs+BQywt8LwRg==, + } + dependencies: + "@solana/web3.js": 1.75.0(encoding@0.1.13) + transitivePeerDependencies: + - bufferutil + - encoding + - supports-color + - utf-8-validate + dev: false + + /@helium/address@4.10.2: + resolution: + { + integrity: sha512-qCswC7Z3GXuJyHv36RcOSnffeghjqJQx0fdu2Lxpf9fgOnIi1JZO2tjjk1mBaqOwCyp+0YzrTPUoEukL/WCtsA==, + } + dependencies: + bs58: 5.0.0 + js-sha256: 0.9.0 + multiformats: 9.9.0 + dev: false + /@helium/address@4.8.1: resolution: { @@ -852,40 +901,58 @@ packages: multiformats: 9.9.0 dev: false - /@helium/circuit-breaker-sdk@0.0.51(@solana/web3.js@1.75.0)(encoding@0.1.13): + /@helium/anchor-resolvers@0.2.5(@coral-xyz/anchor@0.26.0)(encoding@0.1.13): resolution: { - integrity: sha512-xl6C23Wqu93CPnQQEk1AgCmlRv5NHh+rIezEEPg+SNJGvtTL5hCHpEjUWmOM24hMwXn5sJq0vwOASrbGwoNMCA==, + integrity: sha512-AOVa93cbFEUSDHR6OWHk5SlwwrnyStAZbjM1AGGUJdZEVzR1YnkYCl8aFZtVBCkCPmFz5iZDBjEx32chhRsEJA==, } + peerDependencies: + "@coral-xyz/anchor": ^0.26.0 dependencies: "@coral-xyz/anchor": 0.26.0(encoding@0.1.13) - "@helium/idls": 0.0.51(encoding@0.1.13) - "@helium/spl-utils": 0.0.51(encoding@0.1.13) "@solana/spl-token": 0.3.7(@solana/web3.js@1.75.0)(encoding@0.1.13) + "@solana/web3.js": 1.75.0(encoding@0.1.13) + transitivePeerDependencies: + - bufferutil + - encoding + - supports-color + - utf-8-validate + dev: false + + /@helium/circuit-breaker-sdk@0.2.5(encoding@0.1.13): + resolution: + { + integrity: sha512-IG/f0ffY+lWPVOAYTH/yyloXRfCShUydwsyAjdYz4tI1tGVlysf88rR9kYWY/cJpep3ftemxZdvOwOSdhVt72A==, + } + dependencies: + "@coral-xyz/anchor": 0.26.0(encoding@0.1.13) + "@helium/anchor-resolvers": 0.2.5(@coral-xyz/anchor@0.26.0)(encoding@0.1.13) + "@helium/idls": 0.2.5(encoding@0.1.13) bn.js: 5.2.1 bs58: 4.0.1 transitivePeerDependencies: - - "@solana/web3.js" - bufferutil - encoding - supports-color - utf-8-validate dev: false - /@helium/helium-react-hooks@0.0.51(encoding@0.1.13)(react-dom@18.2.0)(react@18.2.0): + /@helium/helium-react-hooks@0.2.11(encoding@0.1.13)(react-dom@18.2.0)(react@18.2.0): resolution: { - integrity: sha512-vENlWxL1YCBjT39Aw6IKJzuNRY0TJPXTO66KwqQfLFs51pTWinVPjuMCxUHvt1vXuejH5eAA+rNaHv2STB4bsA==, + integrity: sha512-smfZR0iOr41HFW4xUoIb0vd9vrGGWYrCmak5eMmLB8btNRQxtQ/Df2qSjQkT/DpUsnJFlNL9OCt6AJWyiM55UQ==, } peerDependencies: react: ^16.8 || ^17 || ^18 react-dom: ^16.8 || ^17 || ^18 dependencies: "@coral-xyz/anchor": 0.26.0(encoding@0.1.13) - "@helium/spl-utils": 0.0.51(encoding@0.1.13) + "@helium/account-fetch-cache": 0.2.5(encoding@0.1.13) + "@helium/account-fetch-cache-hooks": 0.2.11(encoding@0.1.13)(react-dom@18.2.0)(react@18.2.0) "@solana/spl-token": 0.3.7(@solana/web3.js@1.75.0)(encoding@0.1.13) "@solana/web3.js": 1.75.0(encoding@0.1.13) bs58: 5.0.0 + pako: 2.1.0 react: 18.2.0 react-async-hook: 4.0.0(react@18.2.0) react-dom: 18.2.0(react@18.2.0) @@ -896,17 +963,17 @@ packages: - utf-8-validate dev: false - /@helium/helium-sub-daos-sdk@0.0.51(@solana/web3.js@1.75.0)(encoding@0.1.13): + /@helium/helium-sub-daos-sdk@0.2.5(@solana/web3.js@1.75.0)(encoding@0.1.13): resolution: { - integrity: sha512-tTj6L+ttshoAPvKsnZKYLYpoxgisVPLu4lCeMHvfotX7BtxrfmsY8mcshKZGz18+rM4R3vXmvBtKB/tQIdzVVQ==, + integrity: sha512-U+AT8t3wJhZTambCtSHnvXBl+5fVw2NhQ49AgbzKm3Yo3JBnyXJ31mdTGyeT67QrviOW2nOmU8adozp7AXsiOw==, } dependencies: "@coral-xyz/anchor": 0.26.0(encoding@0.1.13) - "@helium/circuit-breaker-sdk": 0.0.51(@solana/web3.js@1.75.0)(encoding@0.1.13) - "@helium/spl-utils": 0.0.51(encoding@0.1.13) - "@helium/treasury-management-sdk": 0.0.51(@solana/web3.js@1.75.0)(encoding@0.1.13) - "@helium/voter-stake-registry-sdk": 0.0.51(@solana/web3.js@1.75.0)(encoding@0.1.13) + "@helium/anchor-resolvers": 0.2.5(@coral-xyz/anchor@0.26.0)(encoding@0.1.13) + "@helium/circuit-breaker-sdk": 0.2.5(encoding@0.1.13) + "@helium/treasury-management-sdk": 0.2.5(encoding@0.1.13) + "@helium/voter-stake-registry-sdk": 0.2.5(@solana/web3.js@1.75.0)(encoding@0.1.13) bn.js: 5.2.1 bs58: 4.0.1 transitivePeerDependencies: @@ -917,10 +984,10 @@ packages: - utf-8-validate dev: false - /@helium/idls@0.0.51(encoding@0.1.13): + /@helium/idls@0.1.1(encoding@0.1.13): resolution: { - integrity: sha512-qaR/CmgWqhUPuksJxnMNOrF9IkXduQrQ3B8xKAQ4fJ/qO/bItiBe/iZCzp4KbqMrrfvvbusQwcY0i9EtDEnINg==, + integrity: sha512-1uHs1Jv1/bjbe2SATDUukicy7iz7OWA79sSxNuSzZeL8eXJEAAe5yaP0ZXEb1x2jRhRCzhjFkZDKLz9snnfE2g==, } dependencies: "@coral-xyz/anchor": 0.26.0(encoding@0.1.13) @@ -935,10 +1002,10 @@ packages: - utf-8-validate dev: false - /@helium/idls@0.1.1(encoding@0.1.13): + /@helium/idls@0.2.5(encoding@0.1.13): resolution: { - integrity: sha512-1uHs1Jv1/bjbe2SATDUukicy7iz7OWA79sSxNuSzZeL8eXJEAAe5yaP0ZXEb1x2jRhRCzhjFkZDKLz9snnfE2g==, + integrity: sha512-KzoKeWnfvQJiRDi6eiDADbUTvVyOLre8ht46LeSq02Nx/UQO2SmgymI/YjwlO0o8Zm7L/r8dxym0+MYG++lLHw==, } dependencies: "@coral-xyz/anchor": 0.26.0(encoding@0.1.13) @@ -953,14 +1020,15 @@ packages: - utf-8-validate dev: false - /@helium/spl-utils@0.0.51(encoding@0.1.13): + /@helium/spl-utils@0.1.4(encoding@0.1.13): resolution: { - integrity: sha512-ng+VibSs3F7G62qhxzyvNAQJtz4f8GMb0qGNu1evpnaE0TrfiP42kCXM9ntWkDslJUN0EHLoGReyPSoFq6/MSg==, + integrity: sha512-QhEhJuOd9P8GbUKx5f9zI1m2zjN9si/IrAlDQk4gkFBDFsi4szzY03rj4CwyhmwIYJk/qi1b4JiMoRIinFutJg==, } dependencies: "@coral-xyz/anchor": 0.26.0(encoding@0.1.13) "@helium/address": 4.8.1 + "@solana/spl-account-compression": 0.1.7(@solana/web3.js@1.75.0)(encoding@0.1.13) "@solana/spl-token": 0.3.7(@solana/web3.js@1.75.0)(encoding@0.1.13) "@solana/web3.js": 1.75.0(encoding@0.1.13) bn.js: 5.2.1 @@ -973,14 +1041,17 @@ packages: - utf-8-validate dev: false - /@helium/spl-utils@0.1.4(encoding@0.1.13): + /@helium/spl-utils@0.2.13(encoding@0.1.13): resolution: { - integrity: sha512-QhEhJuOd9P8GbUKx5f9zI1m2zjN9si/IrAlDQk4gkFBDFsi4szzY03rj4CwyhmwIYJk/qi1b4JiMoRIinFutJg==, + integrity: sha512-N68djQJI3HiX6MFLfjAteYzpxhd6pAee0rzy92OdoK0vT6iIL4F0Q9kx385n+Wtda8xbItWtqsNHKkdra8rSCg==, } dependencies: "@coral-xyz/anchor": 0.26.0(encoding@0.1.13) - "@helium/address": 4.8.1 + "@helium/account-fetch-cache": 0.2.5(encoding@0.1.13) + "@helium/address": 4.10.2 + "@helium/anchor-resolvers": 0.2.5(@coral-xyz/anchor@0.26.0)(encoding@0.1.13) + "@metaplex-foundation/mpl-token-metadata": 2.9.1(encoding@0.1.13) "@solana/spl-account-compression": 0.1.7(@solana/web3.js@1.75.0)(encoding@0.1.13) "@solana/spl-token": 0.3.7(@solana/web3.js@1.75.0)(encoding@0.1.13) "@solana/web3.js": 1.75.0(encoding@0.1.13) @@ -994,36 +1065,34 @@ packages: - utf-8-validate dev: false - /@helium/treasury-management-sdk@0.0.51(@solana/web3.js@1.75.0)(encoding@0.1.13): + /@helium/treasury-management-sdk@0.2.5(encoding@0.1.13): resolution: { - integrity: sha512-oCqGpP4IPZ1LrpM+DgLpsduGmvwaTk8jVTcuL/vQFmKdeq2/Gcssj8mQWFcwPe6bm0zVStJ9UmszlrAVIKl7Aw==, + integrity: sha512-j1faBZ52KLAaCz5GHmK5Xugg7PvOi5kpP4PmB0DmTRdhF8f7mfTIPWvD/SVI1vIQ4p1ng8ucURKTpCWRGRzIqA==, } dependencies: "@coral-xyz/anchor": 0.26.0(encoding@0.1.13) - "@helium/circuit-breaker-sdk": 0.0.51(@solana/web3.js@1.75.0)(encoding@0.1.13) - "@helium/idls": 0.0.51(encoding@0.1.13) - "@helium/spl-utils": 0.0.51(encoding@0.1.13) - "@solana/spl-token": 0.3.7(@solana/web3.js@1.75.0)(encoding@0.1.13) + "@helium/anchor-resolvers": 0.2.5(@coral-xyz/anchor@0.26.0)(encoding@0.1.13) + "@helium/circuit-breaker-sdk": 0.2.5(encoding@0.1.13) + "@helium/idls": 0.2.5(encoding@0.1.13) bn.js: 5.2.1 bs58: 4.0.1 transitivePeerDependencies: - - "@solana/web3.js" - bufferutil - encoding - supports-color - utf-8-validate dev: false - /@helium/voter-stake-registry-sdk@0.0.51(@solana/web3.js@1.75.0)(encoding@0.1.13): + /@helium/voter-stake-registry-sdk@0.1.4(@solana/web3.js@1.75.0)(encoding@0.1.13): resolution: { - integrity: sha512-1a0aK9oHUb6IjtCEc7ATws4wk9EYuYIpA4FXULaDDd+HmZ5ZnfX8yeeWeRVRt8pBzoGE9EzPEbkH+pLV55zs1A==, + integrity: sha512-8f+dWaS1IbSuybrvyvchuOd/NP9fCx8jCVyl02pKkURFZC0WdPckiaw+5kh2/y29nwwZJlVqdu7I7C2TR/6uyQ==, } dependencies: "@coral-xyz/anchor": 0.26.0(encoding@0.1.13) - "@helium/idls": 0.0.51(encoding@0.1.13) - "@helium/spl-utils": 0.0.51(encoding@0.1.13) + "@helium/idls": 0.1.1(encoding@0.1.13) + "@helium/spl-utils": 0.1.4(encoding@0.1.13) "@metaplex-foundation/mpl-token-metadata": 2.9.1(encoding@0.1.13) "@solana/spl-token": 0.3.7(@solana/web3.js@1.75.0)(encoding@0.1.13) bn.js: 5.2.1 @@ -1036,15 +1105,15 @@ packages: - utf-8-validate dev: false - /@helium/voter-stake-registry-sdk@0.1.4(@solana/web3.js@1.75.0)(encoding@0.1.13): + /@helium/voter-stake-registry-sdk@0.2.5(@solana/web3.js@1.75.0)(encoding@0.1.13): resolution: { - integrity: sha512-8f+dWaS1IbSuybrvyvchuOd/NP9fCx8jCVyl02pKkURFZC0WdPckiaw+5kh2/y29nwwZJlVqdu7I7C2TR/6uyQ==, + integrity: sha512-+u87bpAHDZRosMEjqa3xTGSGEvFjrC6Mq6b0AqzMOAc0z3rYxNCRaSXRZ9fpOoGwm+hJfVTdP9JEHt82dqs6wQ==, } dependencies: "@coral-xyz/anchor": 0.26.0(encoding@0.1.13) - "@helium/idls": 0.1.1(encoding@0.1.13) - "@helium/spl-utils": 0.1.4(encoding@0.1.13) + "@helium/anchor-resolvers": 0.2.5(@coral-xyz/anchor@0.26.0)(encoding@0.1.13) + "@helium/idls": 0.2.5(encoding@0.1.13) "@metaplex-foundation/mpl-token-metadata": 2.9.1(encoding@0.1.13) "@solana/spl-token": 0.3.7(@solana/web3.js@1.75.0)(encoding@0.1.13) bn.js: 5.2.1 diff --git a/src/app/stats/components/HntInfo.tsx b/src/app/stats/components/HntInfo.tsx index 26354f3..277b5b9 100644 --- a/src/app/stats/components/HntInfo.tsx +++ b/src/app/stats/components/HntInfo.tsx @@ -66,7 +66,7 @@ export const HntInfo = async () => { getRemainingEmissions(new Date(), "hnt") ) const maxSupply = - hntMint.info?.info.supply + + hntMint.info?.info.supply! + BigInt(remainingHntEmissions) * BigInt(100000000) + BigInt( Math.ceil( @@ -101,8 +101,8 @@ export const HntInfo = async () => { { label="Max Supply" value={`~${humanReadableBigint( maxSupply, - hntMint?.info?.info || 8, + hntMint?.info?.info.decimals || 8, 0 )}`} tooltip={{ diff --git a/src/app/stats/components/SubDaoInfo.tsx b/src/app/stats/components/SubDaoInfo.tsx index 2c00953..c02e756 100644 --- a/src/app/stats/components/SubDaoInfo.tsx +++ b/src/app/stats/components/SubDaoInfo.tsx @@ -84,7 +84,7 @@ export const SubDaoInfo = async ({ subDao }: { subDao: SubDao }) => { getRemainingEmissions(new Date(), subDao) ) const maxSupply = - mintInfo.info?.info.supply + BigInt(remainingEmissions) * BigInt(1000000) + mintInfo.info?.info.supply! + BigInt(remainingEmissions) * BigInt(1000000) return ( @@ -143,8 +143,8 @@ export const SubDaoInfo = async ({ subDao }: { subDao: SubDao }) => { { /> { diff --git a/src/app/stats/utils/fetchAccount.ts b/src/app/stats/utils/fetchAccount.ts index 7891320..c8f3117 100644 --- a/src/app/stats/utils/fetchAccount.ts +++ b/src/app/stats/utils/fetchAccount.ts @@ -1,11 +1,11 @@ import { accountCache } from "@/app/stats/utils/accountCache" -import { TypedAccountParser } from "@helium/spl-utils" +import { TypedAccountParser } from "@helium/account-fetch-cache" import { AccountInfo, PublicKey } from "@solana/web3.js" -export interface ParsedAccountBase { +export interface ParsedAccountBase { pubkey: PublicKey account: AccountInfo - info: any // TODO: change to unkown + info: T } export interface AccountState { @@ -24,7 +24,7 @@ export interface AccountState { */ export async function fetchAccount( key: null | undefined | PublicKey, - parser?: TypedAccountParser, + parser: TypedAccountParser, isStatic = false // Set if the accounts data will never change, optimisation to lower websocket usage. ): Promise> { const cache = accountCache @@ -32,29 +32,17 @@ export async function fetchAccount( const parsedAccountBaseParser = ( pubkey: PublicKey, data: AccountInfo - ): ParsedAccountBase => { + ): ParsedAccountBase => { try { - if (parser) { - const info = parser(pubkey, data) - return { - pubkey, - account: data, - info, - } - } - + const info = parser(pubkey, data) return { pubkey, account: data, - info: undefined, + info, } } catch (e) { console.error(`Error while parsing: ${(e as Error).message}`) - return { - pubkey, - account: data, - info: undefined, - } + throw e } } @@ -64,23 +52,21 @@ export async function fetchAccount( if (!id || !cache) { return reject("No pubkey or cache") } - return cache - .search(id, parser ? parsedAccountBaseParser : undefined, isStatic) - .then((acc) => { - if (acc) { - try { - const nextInfo = parser && parser(acc.pubkey, acc?.account) - resolve({ - info: nextInfo, - account: acc.account, - }) - } catch (e) { - return reject(`Error while parsing: ${(e as Error).message}`) - } - } else { - return reject("No account") + return cache.search(id, parsedAccountBaseParser, isStatic).then((acc) => { + if (acc) { + try { + const nextInfo = parser && parser(acc.pubkey, acc?.account) + resolve({ + info: nextInfo, + account: acc.account, + }) + } catch (e) { + return reject(`Error while parsing: ${(e as Error).message}`) } - }) + } else { + return reject("No account") + } + }) }).then((result) => { if (!result.info) throw new Error("No info") return result diff --git a/src/app/stats/utils/fetchDelegatedPositions.ts b/src/app/stats/utils/fetchDelegatedPositions.ts index 0a4ddab..d23f21e 100644 --- a/src/app/stats/utils/fetchDelegatedPositions.ts +++ b/src/app/stats/utils/fetchDelegatedPositions.ts @@ -4,7 +4,7 @@ import { HeliumSubDaos } from "@helium/idls/lib/types/helium_sub_daos" import { accountCache } from "./accountCache" import { getIdlParser } from "./getIdlParser" // @ts-ignore -import { IDL as subDaosIDL } from "@helium/idls/helium_sub_daos" +import { IDL as subDaosIDL } from "@helium/idls/lib/cjs/helium_sub_daos" import { DelegatedPosition } from "./types" const IOT_SUBDAO = "39Lw1RH6zt8AJvKn3BTxmUDofzduCM2J3kSaGDZ8L7Sk" diff --git a/src/app/stats/utils/fetchIdlAccount.ts b/src/app/stats/utils/fetchIdlAccount.ts index 485903b..d3782d6 100644 --- a/src/app/stats/utils/fetchIdlAccount.ts +++ b/src/app/stats/utils/fetchIdlAccount.ts @@ -1,5 +1,5 @@ import { BorshAccountsCoder, Idl, IdlAccounts } from "@coral-xyz/anchor" -import { TypedAccountParser } from "@helium/spl-utils" +import { TypedAccountParser } from "@helium/account-fetch-cache" import { PublicKey } from "@solana/web3.js" import { AccountState, fetchAccount } from "./fetchAccount" diff --git a/src/app/stats/utils/fetchMint.ts b/src/app/stats/utils/fetchMint.ts index 5be9f65..b1c19cc 100644 --- a/src/app/stats/utils/fetchMint.ts +++ b/src/app/stats/utils/fetchMint.ts @@ -1,4 +1,4 @@ -import { unpackMint } from "@solana/spl-token" +import { Mint, unpackMint } from "@solana/spl-token" import { AccountInfo, PublicKey } from "@solana/web3.js" import { ParsedAccountBase, fetchAccount } from "./fetchAccount" @@ -11,11 +11,11 @@ export const MintParser = (pubKey: PublicKey, info: AccountInfo) => { ...info, }, info: data, - } as ParsedAccountBase + } as ParsedAccountBase return details } export function fetchMint(key: PublicKey | undefined | null) { - return fetchAccount(key, MintParser) + return fetchAccount>(key, MintParser) } diff --git a/src/app/stats/utils/fetchPositions.ts b/src/app/stats/utils/fetchPositions.ts index 605cee7..0ab0fe1 100644 --- a/src/app/stats/utils/fetchPositions.ts +++ b/src/app/stats/utils/fetchPositions.ts @@ -6,7 +6,7 @@ import { getIdlParser } from "./getIdlParser" import { Position } from "./types" // @ts-ignore -import { IDL as vsrRegistryIDL } from "@helium/idls/voter_stake_registry" +import { IDL as vsrRegistryIDL } from "@helium/idls/lib/cjs/voter_stake_registry" import { HNT_MINT, IOT_MINT, MOBILE_MINT } from "@helium/spl-utils" import { registrarKey } from "@helium/voter-stake-registry-sdk" diff --git a/src/app/stats/utils/fetchRegistrar.ts b/src/app/stats/utils/fetchRegistrar.ts index c010b46..9408b7c 100644 --- a/src/app/stats/utils/fetchRegistrar.ts +++ b/src/app/stats/utils/fetchRegistrar.ts @@ -1,7 +1,7 @@ import { VoterStakeRegistry } from "@helium/idls/lib/types/voter_stake_registry" import { PublicKey } from "@solana/web3.js" // @ts-ignore -import { IDL as VSRegistryIDL } from "@helium/idls/voter_stake_registry" +import { IDL as VSRegistryIDL } from "@helium/idls/lib/cjs/voter_stake_registry" import { fetchIdlAccount } from "./fetchIdlAccount" export const fetchRegistrar = (key: PublicKey) => { diff --git a/src/app/stats/utils/fetchSubDaoEpochInfo.ts b/src/app/stats/utils/fetchSubDaoEpochInfo.ts index e358baf..45ed336 100644 --- a/src/app/stats/utils/fetchSubDaoEpochInfo.ts +++ b/src/app/stats/utils/fetchSubDaoEpochInfo.ts @@ -3,7 +3,7 @@ import { HeliumSubDaos } from "@helium/idls/lib/types/helium_sub_daos" import { PublicKey } from "@solana/web3.js" import { ONE_DAY_UNIX } from "../utils" // @ts-ignore -import { IDL as subDaosIDL } from "@helium/idls/helium_sub_daos" +import { IDL as subDaosIDL } from "@helium/idls/lib/cjs/helium_sub_daos" import { IOT_MINT, MOBILE_MINT } from "@helium/spl-utils" import { cache } from "react" import { fetchIdlAccount } from "./fetchIdlAccount" diff --git a/src/app/stats/utils/fetchSubDaoTreasuryInfo.ts b/src/app/stats/utils/fetchSubDaoTreasuryInfo.ts index eed7eaf..8c7ff47 100644 --- a/src/app/stats/utils/fetchSubDaoTreasuryInfo.ts +++ b/src/app/stats/utils/fetchSubDaoTreasuryInfo.ts @@ -2,7 +2,7 @@ import { TreasuryManagement } from "@helium/idls/lib/types/treasury_management" import { treasuryManagementKey } from "@helium/treasury-management-sdk" import { PublicKey } from "@solana/web3.js" // @ts-ignore -import { IDL as treasuryMgmtIDL } from "@helium/idls/treasury_management" +import { IDL as treasuryMgmtIDL } from "@helium/idls/lib/cjs/treasury_management" import { fetchIdlAccount } from "./fetchIdlAccount" export const fetchSubDaoTreasuryInfo = (subDaoMint: PublicKey) => { diff --git a/src/app/stats/utils/getIdlParser.ts b/src/app/stats/utils/getIdlParser.ts index 06791a5..8fdac26 100644 --- a/src/app/stats/utils/getIdlParser.ts +++ b/src/app/stats/utils/getIdlParser.ts @@ -1,10 +1,5 @@ import { BorshAccountsCoder, Idl, IdlAccounts } from "@coral-xyz/anchor" -import { AccountInfo, PublicKey } from "@solana/web3.js" - -export type TypedAccountParser = ( - pubkey: PublicKey, - data: AccountInfo -) => T +import { TypedAccountParser } from "@helium/account-fetch-cache" export function getIdlParser( idl: IDL,