Skip to content

EVM Transaction Approval Amount Change From UInt256 Max -> requiredApproval.amount #130

@yu-jeffy

Description

@yu-jeffy

Hi,

Currently when approving the tokens for a EVM transaction, it attempts to approve the max uint 256 amount of tokens. It should approve the amount specified in the transaction itself, to avoid giving permission to extra tokens than needed for the transaction.

Here is the diff that solved my problem:

diff --git a/node_modules/@skip-go/core/dist/index.js b/node_modules/@skip-go/core/dist/index.js
index 1ae6767..a06491a 100644
--- a/node_modules/@skip-go/core/dist/index.js
+++ b/node_modules/@skip-go/core/dist/index.js
@@ -1310,7 +1310,7 @@ var SkipRouter = class {
           address: requiredApproval.tokenContract,
           abi: erc20ABI,
           functionName: "approve",
-          args: [requiredApproval.spender, viem.maxUint256],
+          args: [requiredApproval.spender, requiredApproval.amount],
           chain: signer.chain
         });
         const receipt2 = yield extendedSigner.waitForTransactionReceipt({

This issue body was partially generated by patch-package.

Thanks,
Jeffy

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions