Git Product home page Git Product logo

feedback's People

Contributors

siong1987 avatar zhengyutay avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

feedback's Issues

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.

image

I think this is the same thing that pkr mentioned in the developer-support channel on discord.
Please check it.

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),

image

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

I can't integrate jup-ag/sdk to nuxt project

foreach try we got this error for the Jupiter integration:

ERROR in ./node_modules/@jup-ag/core/dist/core.esm.js friendly-errors 13:59:56
Module parse failed: Unexpected token (1401:73) friendly-errors 13:59:56
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#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),
friendly-errors 13:59:56
@ ./node_modules/babel-loader/lib??ref--12-0!./node_modules/ts-loader??ref--12-1!./node_modules/vue-loader/lib??vue-loader-options!./src/pages/swap.vue?vue&type=script&lang=ts& 44:0-39 178:25-32

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 })

image

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.