Brenner pfp
Brenner
@brenner.eth
For testing swaps routed through 0x on a fork pinned to a specific block, there used to be `0x/asset-swapper` but it's deprecated and doesn't work on apple silicon. Is there something else I should be using to be able to test a contract that will be using the 0x router? cc @0xproject @wwarren
1 reply
3 recasts
8 reactions

jessicalin.eth pfp
jessicalin.eth
@jessicalin
have you tried this example using Swap API with Foundry? test on a cheap chain or testnet https://github.com/0xProject/0x-examples/tree/main/swap-v2-with-foundry calling 0x Swap API is the recommended way now (the old convenience packages have been deprecated) here’s a run down of how to use it: https://0x.org/docs/0x-swap-api/guides/swap-tokens-with-0x-swap-api
1 reply
0 recast
2 reactions

Brenner pfp
Brenner
@brenner.eth
What led to the decision for this to be the only First Class way to test? The example code doesn’t let me: - use the real deployed 0x contracts onchain - test real tokens with real liquidity Testing live on a cheap chain doesn’t allow me to: - stress test large swaps - test on the actual chains we’ll be deploying on. There’s always nuances across each chain (And is also public - I’d prefer to chain sleuths to not be tracking this) I’m a big supporter of testing as close to prod as possible. Forking mainnet chains at a given block is the best way to do this I know of Very open (and hope) to be shown there’s a better way
1 reply
0 recast
0 reaction

jessicalin.eth pfp
jessicalin.eth
@jessicalin
You can definitely still test on a fork. Use Anvil to fork the chain you want to test with, and then point your dapp's RPC at Anvil. I've added a section in the example code's readme.
0 reply
0 recast
1 reaction