Skip to content

Commit

Permalink
feat: initiateBond method
Browse files Browse the repository at this point in the history
  • Loading branch information
bucurdavid committed Mar 15, 2024
1 parent cbd5030 commit b6d7441
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/abis/core-mx-life-bonding-sc.abi.json
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,25 @@
}
]
},
{
"name": "initiateBond",
"mutability": "mutable",
"inputs": [
{
"name": "address",
"type": "Address"
},
{
"name": "token_identifier",
"type": "TokenIdentifier"
},
{
"name": "nonce",
"type": "u64"
}
],
"outputs": []
},
{
"name": "setBlacklist",
"mutability": "mutable",
Expand Down
29 changes: 29 additions & 0 deletions src/bond.ts
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,35 @@ export class BondContract extends Contract {
return tx;
}

/**
* Builds a `initiateBond` transaction to "whitelist" an address for being able to bond for a specific Data NFT
* @param senderAddress the address of the sender
* @param address the address to be whitelisted
* @param tokenIdentifier the token identifier
* @param nonce the token identifier nonce
*/
initiateBond(
senderAddress: IAddress,
address: IAddress,
tokenIdentifier: string,
nonce: number
): Transaction {
const tx = new Transaction({
value: 0,
data: new ContractCallPayloadBuilder()
.setFunction('initiateBond')
.addArg(new AddressValue(address))
.addArg(new TokenIdentifierValue(tokenIdentifier))
.addArg(new U64Value(nonce))
.build(),
receiver: this.contract.getAddress(),
sender: senderAddress,
gasLimit: 20_000_000,
chainID: this.chainID
});
return tx;
}

/**
* Builds a `addPeriodsBonds` transaction to set the periods and bonds
* @param senderAddress the address of the sender
Expand Down

0 comments on commit b6d7441

Please sign in to comment.