feedback's Issues
jup-ag/core package throws error while importing in react js (craco)
./node_modules/@jup-ag/core/dist/core.esm.js 1384:73
Module parse failed: Unexpected token (1384:73)
File was processed with these loaders:
- ./node_modules/react-scripts/node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| }
|
remainingAccounts.push(...prepareRemainingAccounts(amount, platformFee?.feeAccount));
| return JUPITER_PROGRAM.instruction.mercurialExchange(amount ? new BN$1(amount) : amount, new BN$1(minimumOutAmount), platformFee?.feeBps ?? 0, {
| accounts: stableSwapNPoolIntoMercurialExchange(stableSwapNPool, userSourceTokenAccountAddress, userDestinationTokenAccountAddress, user),
please fix this .this is the link (https://discord.com/channels/897540204506775583/910250162402779146/927391710311481384 ) suggested by a dev in you discord group..this might be helpfull in solving
TypeError: fields must be array of Layout instances
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'vaultSignerNonce')
I'm receiving this error when trying to execute swap through Serum.
It works for other AMMs, problem only with Serum.
core.esm.js?ad3d:1366 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'vaultSignerNonce')
at marketIntoSerumSwap (core.esm.js?ad3d:1366:1)
at createSerumSwapInstruction (core.esm.js?ad3d:1437:1)
at SerumAmm.createSwapInstructions (core.esm.js?ad3d:2153:1)
at routeToInstructions (core.esm.js?ad3d:3451:1)
at Jupiter.exchange (core.esm.js?ad3d:4030:1)
Loading routes like here
Performing a swap like this:
const { execute } = await jupiter.exchange({
route: swapRoute,
})
const executeResult = await execute({ wallet })
Can't resolve getPlatformFeeAccounts() with custom hook
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)
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
RangeError: Division by zero
RangeError: Division by zero
at Function.divide (/app/node_modules/jsbi/tsc-out/jsbi.mjs:240:19)
at ceilingDivision (/app/node_modules/@jup-ag/math/src/utils.ts:36:23)
at t.getOutputAmount (/app/node_modules/@jup-ag/math/src/amm/tokenswap-constant-product.ts:109:35)
at t.getExpectedOutputAmount (/app/node_modules/@jup-ag/math/src/amm/tokenswap-constant-product.ts:70:17)
at t.exchange (/app/node_modules/@jup-ag/math/src/amm/tokenswap-constant-product.ts:18:37)
at De.getQuote (/app/node_modules/@jup-ag/core/src/lib/aldrin/aldrinAmm.ts:106:34)
at map (/app/node_modules/@jup-ag/core/src/lib/computeRouteInfos.ts:53:40)
at Array.map (<anonymous>)
at computeRouteInfos (/app/node_modules/@jup-ag/core/src/lib/computeRouteInfos.ts:34:6)
at ut.computeRoutes (/app/node_modules/@jup-ag/core/src/lib/jupiter.ts:206:27)
When I tried to swap from USDC to USDC, the above error appeared.
I think this is the same thing that pkr mentioned in the developer-support channel on discord.
Please check it.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.