ERC20
Utility class for interacting with ERC20 tokens.Constructor
The ERC20 class is automatically instantiated and available asdsa.erc20.
Methods
transfer
Transfer ERC20 tokens or ETH.Token address or symbol (e.g., “DAI”, “USDC”, “eth”)
Amount to transfer. Use “-1” or
dsa.maxValue for maximum balance (ERC20 only)Recipient address. Defaults to DSA instance address
Sender address. Auto-detected if not provided
Gas limit for the transaction
Gas price in wei (required in node mode)
Maximum fee per gas for EIP-1559 transactions
Maximum priority fee per gas for EIP-1559 transactions
Transaction nonce (required in node mode)
transferTxObj
Get the transaction object for transferring tokens without sending it.transfer()
Returns: TransactionConfig object ready to be signed and sent
Example:
approve
Approve an address to spend ERC20 tokens.Token address or symbol (cannot be “eth”)
Approval amount. Use
dsa.maxValue for unlimited approvalSpender address to approve
Token owner address. Auto-detected if not provided
Gas limit for the transaction
Gas price in wei (required in node mode)
Maximum fee per gas for EIP-1559 transactions
Maximum priority fee per gas for EIP-1559 transactions
Transaction nonce (required in node mode)
ETH does not require approval. Attempting to approve ETH will throw an error.
approveTxObj
Get the transaction object for approving tokens without sending it.approve()
Returns: TransactionConfig object ready to be signed and sent
ERC721
Utility class for interacting with ERC721 (NFT) tokens.Constructor
The ERC721 class is automatically instantiated and available asdsa.erc721.
Methods
transfer
Transfer ERC721 tokens (NFTs) usingsafeTransferFrom.
NFT contract address or symbol
Token ID of the NFT to transfer
Recipient address. Defaults to DSA instance address
Sender address. Auto-detected if not provided
Gas limit for the transaction
Gas price in wei (required in node mode)
Maximum fee per gas for EIP-1559 transactions
Maximum priority fee per gas for EIP-1559 transactions
Transaction nonce (required in node mode)
transferTxObj
Get the transaction object for transferring NFTs without sending it.transfer()
Returns: TransactionConfig object ready to be signed and sent
approve
Approve an address to transfer a specific ERC721 token.NFT contract address or symbol
Token ID to approve
Approved address
Token owner address. Auto-detected if not provided
Gas limit for the transaction
Gas price in wei (required in node mode)
Maximum fee per gas for EIP-1559 transactions
Maximum priority fee per gas for EIP-1559 transactions
Transaction nonce (required in node mode)
approveTxObj
Get the transaction object for approving NFT transfers without sending it.approve()
Returns: TransactionConfig object ready to be signed and sent