Credit Transfers with Permit
A full code example that transfers a Credit token from a holder account to a receiver.
In order to make token transfers more efficient and user-friendly Credit tokens created in our API implement the EIP-2612 specification.
The EIP-2612 allows for token holders to approve transfers on their behalf by creating an off-chain signed permit. A third party will use this signed permit to execute the transfer in an on-chain transaction. Token holder do not need to spend gas or interact with the blockchain. This is particularly useful for onboarding new users who may not have Ether to pay for gas.
OPENFORMAT provides two endpoint to simplify this process, making it more straightforward.
In order to execute a Credit token transfer you need to follow this steps**:**
- Obtain Permit Data: Calling the Request Permit Data endpoint.
- Sign the Permit Data: The token holder signs the permit data hash using their wallet.
- Create Transfer Transaction: Calling the Transfer Credit Token endpoint with the permit signature.
- Sign and Broadcast the Transaction: The unsigned transaction needs to be signed with the RECEIVER ‘s wallet and then you can broadcast it using the Execute Transaction or Execute Transaction and Wait endpoints.
The following code presents a scenario where a Credit token is transferred from a User account(token holder) to your account(receiver).