Skip to content
New issue

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

NotEnoughBalanceOrAllowance when place order in fusion mode #88

Open
sh7ning opened this issue Dec 18, 2024 · 4 comments
Open

NotEnoughBalanceOrAllowance when place order in fusion mode #88

sh7ning opened this issue Dec 18, 2024 · 4 comments

Comments

@sh7ning
Copy link

sh7ning commented Dec 18, 2024

when I run the example https://github.com/1inch/1inch-sdk-go/blob/main/sdk-clients/fusion/examples/place_order/main.go#L72

I got the err: {"error":"Bad Request","description":"NotEnoughBalanceOrAllowance","statusCode":400,"meta":[]}

How I can approve the transaction using 1inch api, can you give me some advice, like 1inch api doc link or or a complete approve allowance and place order example?

Thanks a lot, I am new to defi.

@Tanz0rz
Copy link
Collaborator

Tanz0rz commented Dec 18, 2024

Hi, the approval transaction for our router can be created using the aggregation API. Here is an example that checks allowance for a given amount and approves the token if needed: https://github.com/1inch/1inch-sdk-go/blob/ab94614df99977a526bfd7cc58e9dfb31eaa48b4/sdk-clients/aggregation/examples/approve/main.go

I may add this functionality to the Wallet object directly if it makes sense, but for now, just pull in the aggregation API to get this functionality.

@sh7ning
Copy link
Author

sh7ning commented Dec 19, 2024

the aggregation API need NodeUrl, but I don't have a NodeUrl, And if possible, I just want to use the 1inch api or the nodeurl provided by 1inch

The NodeUrl may be multiple different chains currently supported by 1inch API

@Tanz0rz
Copy link
Collaborator

Tanz0rz commented Dec 19, 2024

NODE_URL is where you put your JSON RPC endpoint. It is the main way to communicate with Ethereum-style blockchains (you can read more about the underlying spec here). For now, just find a free one from this website for the chain you are testing and put it in your environment: www.chainlist.org

@sh7ning
Copy link
Author

sh7ning commented Dec 19, 2024

Ok, thank you very much for your help,It's so kind of you, I will try it according to what you said.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants