Sponsor subscriptions
Last updated
Last updated
The sub2 SDK can be used to generate EIP-712 signatures used for sponsoring new subscriptions. As mentioned , sponsoring a subscription means that all processing fees are paid by you.
To sponsor a subscription, we first have to specify the details of the subscription we wish to sponsor. This is done by creating a SponsorPermit
object which can be imported directly from sub2-sdk:
The nonce an uint256
value which cannot be used by a signature previously. In practice this can be set to a random uint256
value as the chance of collision is infinitely small. The deadline is the UNIX time in seconds when the signature will expire. After this time, the signature will no longer be valid.
Once we have a sponsor permit, we can use the SDK to generate a signature:
Now we have a signature which you can use to sponsor a subscription!