As the interaction is directly on-chain, this is not an endpoint. Steps to create a PAWN plan are detailed below!
For the best experience, please refer to the SDK documentation. You'll be able to install our library and get started in not only creating PAWN plans but interacting with the Cyan Protocol as well.
Prior to creating a PAWN Plan, the user must grant Cyan the approval to move the NFT. To receive the user's approval, please call the
approve
function of the NFT or when using the SDK, just call theGet Approval
method.
In order to create a new PAWN Plan, call the createPawn
function from the smart contract with data retrieved from the endpoint Pawn Pricer Step 2
createPawn
function accepts the following parameters:
Example:
const signer = this.provider.getSigner();
const item = {...}; // Item object
const plan = {...}; // Plan object
const planId = 123; // Plan ID from the pricer
const blockNum = 1000; // Latest block number of the chain
const signature = '0x123abc' // Signature from the pricer
const contract = new Contract(
paymentContractAddress, // Cyan payment contract address
abi // Cyan ABI
signer // signer from Web3
);
const transaction = await contract.createPawn(
item,
plan,
planId,
blockNum,
signature,
);