raydium-io / raydium-sdk-V2-demo

Open-source Typescript SDK demos
50 stars 31 forks source link

Getting "429: Too Many Requests" error #64

Closed tushar-sahoo closed 2 months ago

tushar-sahoo commented 2 months ago
raydium = await Raydium.load({
    owner,
    connection,
    cluster,
    disableFeatureCheck: true,
    disableLoadToken: !params?.loadToken,
    blockhashCommitment: 'finalized',
    // urlConfigs: {
    //   BASE_HOST: '<API_HOST>', // api url configs, currently api doesn't support devnet
    // },
  })

Does this method call Raydium API? If yes is there any way to get this object without the API call. Also, if there is some premium service available that removes the API call limit that would be great.

Also is it possible to create a common raydium object and then use the raydium.setOwner function to change the owner while performing swaps.

cruzshia commented 2 months ago

Raydium.load only call api when pass disableLoadToken: false, if you don't want api call in beginning, can pass disableLoadToken: true, and there's no way to remove rate limit at this moment. and yes for sure, you can use raydium.setOwner to change owner while programming, and remember to call raydium.acccount.fetchWalletTokenAccounts({ forceUpdate: true }) after setting new owner. (note: you also can upgrade sdk to 0.1.46-alpha, it will auto clean token accounts data after call raydium.setOwner)

tushar-sahoo commented 2 months ago

Ok thanks @cruzshia. Works good now.