Approve Position Calldata
The approvePositionCalldata
and approvePositionOperatorCalldata
methods generate the calldata required to approve the transfer of a specific Position token and to approve an operator to manage all of the caller’s note positions.
⚠️
Be careful when using the operator approve position method. It can approve or revoke an operator to manage ALL of the caller’s positions.
Approve Position (approvePositionCalldata)
The approvePositionCalldata
method generates the calldata required to approve the transfer of a specific Position token.
Usage
import { SupportedChainIds, approvePositionCalldata } from "@parabolfi/core";
const chainId = SupportedChainIds.ZKSYNC;
const tokenId = "6";
const approveCalldata = approvePositionCalldata(chainId, tokenId);
Parameters
chainId
:SupportedChainIds
- The chain ID of the network.tokenId
:string
- The ID of the Position token to approve.
Returns
string
- The generated calldata for approving the Position token transfer.
0x095ea7b3...
Notes
- The generated calldata approves the Reserve Stability Pool contract to manage the specified Position token.
- This approval is necessary before claiming a Position token.
- The method will throw a
ParabolSDKError
if the chain ID is invalid or if there’s an error generating the calldata.
Approve Operator Position (approvePositionOperatorCalldata)
The approvePositionOperatorCalldata
method generates the calldata required to approve an operator for managing note positions.
Usage
import {
SupportedChainIds,
approvePositionOperatorCalldata,
} from "@parabolfi/core";
const chainId = SupportedChainIds.ZKSYNC;
const approveCalldata = approvePositionOperatorCalldata(chainId);
console.log("approveCalldata", approveCalldata);
Parameters
chainId
:SupportedChainIds
- The chain ID of the network.
Returns
string
- The generated calldata for approving a position operator.
0xa22cb465...
Notes
- The generated calldata can be used in a transaction to approve an operator to manage all note positions for the caller.
- This approval is typically used for contracts that need to manage multiple note positions on behalf of the user.
- The method will throw a
ParabolSDKError
if the chain ID is invalid or if there’s an error generating the calldata.