Skip to content

Commit

Permalink
fix: deadline in seconds everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
vacekj committed Dec 11, 2023
1 parent ae8d3ed commit fde06a5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function PermitExample() {
spenderAddress: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", // vitalik.eth
contractAddress: "0xa2327a938febf5fec13bacfb16ae10ecbc4cbdcf", // usdc on mainnet
value: parseEther("10"),
deadline: BigInt(Date.now() + 100_000),
deadline: BigInt(Math.floor(Date.now() / 1000) + 100_000),
});

return (
Expand Down Expand Up @@ -90,7 +90,7 @@ const { signPermit, signature } = usePermit({
spenderAddress: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", // vitalik.eth
contractAddress: "0xa2327a938febf5fec13bacfb16ae10ecbc4cbdcf", // usdc on mainnet
value: parseEther("10"),
deadline: BigInt(Date.now() + 100_000),
deadline: BigInt(Math.floor(Date.now() / 1000) + 100_000),
/** Overrides */
nonce: 2n,
erc20Name: "Overriden Token Name",
Expand Down Expand Up @@ -132,7 +132,7 @@ function DaiPermitExample() {
spenderAddress: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", // vitalik.eth
contractAddress: "0x6b175474e89094c44da98b954eedeac495271d0f", // dai on mainnet
value: parseEther("10"),
deadline: BigInt(Date.now() + 100_000),
deadline: BigInt(Math.floor(Date.now() / 1000) + 100_000),
});

return (
Expand Down Expand Up @@ -167,7 +167,7 @@ async function signPermitForUSDC(walletClient: WalletClient) {
contractAddress: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
erc20Name: "USD Coin",
version: "2",
deadline: BigInt(Date.now() + 100_000),
deadline: BigInt(Math.floor(Date.now() / 1000) + 100_000),
nonce: 0n,
chainId: 1,
value: 1_000_000_000n,
Expand Down
2 changes: 1 addition & 1 deletion src/permit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const spenderAddress = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266";
const ownerAddress = "0x70997970C51812dc3A010C7d01b50e0d17dc79C8";
const contractAddress = "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC";
const erc20Name = "Test Token";
const deadline = BigInt(Date.now() + 100_000);
const deadline = BigInt(Math.floor(Date.now() / 1000) + 100_000);
const nonce = 0n;
const chainId = 1;
const value = parseEther("10");
Expand Down

0 comments on commit fde06a5

Please sign in to comment.