We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am trying to add platformFees, but the fee accounts are not refreshed when the hook resolve getPlatformFeeAccounts().
The custom hook:
export const usePlatformFees = () => { const [platformFeesAccount, setPlatformFeesAccount] = useState<PlatformFeeAndAccounts>(null); const { connection } = useConnection(); useEffect(() => { const setFeeAccount = async () => { let platformFeeAndAccounts = { feeBps: 250, feeAccounts: await getPlatformFeeAccounts( connection, new PublicKey(process.env.NEXT_PUBLIC_TREASURY_ADDRESS) // The platform fee account owner ) // map of mint to token account pubkey }; console.log(platformFeeAndAccounts.feeAccounts); setPlatformFeesAccount(platformFeeAndAccounts); }; setFeeAccount(); }, []); return platformFeesAccount; };
The Provider part using the hook:
const JupiterApp = ({ children }) => { const { connection } = useConnection(); const wallet = useWallet(); const platformFeeAndAccounts = usePlatformFees(); return ( <JupiterProvider cluster="mainnet-beta" connection={connection} userPublicKey={wallet.publicKey || undefined} platformFeeAndAccounts={platformFeeAndAccounts || undefined} > {children} </JupiterProvider> ); };
When I print platformFeeAndAccounts.feeAccounts & routeInfo.marketInfos[routeInfo.marketInfos.length - 1].platformFee.pct <= (when jupiter-hook update routes on inputMint update)
platformFeeAndAccounts.feeAccounts
routeInfo.marketInfos[routeInfo.marketInfos.length - 1].platformFee.pct
routes
I get my feeAccounts:
Map(12) {'7MC1...BPqQe' => PublicKey, 'mSoLzY...m7So' => PublicKey, '4k3Dy...QrkX6R' => PublicKey, 'SRMu...oKWRt' => PublicKey, 'Es9vM...nwNYB' => PublicKey, …}
and 0 for all platformFee.pct routes
platformFee.pct
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I am trying to add platformFees, but the fee accounts are not refreshed when the hook resolve getPlatformFeeAccounts().
The custom hook:
The Provider part using the hook:
When I print
platformFeeAndAccounts.feeAccounts
&routeInfo.marketInfos[routeInfo.marketInfos.length - 1].platformFee.pct
<= (when jupiter-hook updateroutes
on inputMint update)I get my feeAccounts:
and 0 for all
platformFee.pct
routesThe text was updated successfully, but these errors were encountered: