approve
Approve the router to pull an amount of an ERC-20 token from the signer. Required before any swap with ERC-20 input.
rust
pub async fn approve(&self, token: Address, amount: U256) -> Result<H256>Usage
rust
use propamm::common::helpers::parse_units;
use propamm::common::tokens::USDC;
let hash = router.approve(USDC, parse_units("100", 6)?).await?;
router.client().wait_for_transaction(hash).await?;Returns
Result<H256>
The approval transaction hash.
Parameters
token
- Type:
Address
The ERC-20 token to approve.
amount
- Type:
U256
Allowance to grant the router, in atomic units.