elrond.esdt.builders.ESDTNFTTransferBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of erdjava Show documentation
Show all versions of erdjava Show documentation
The Java 1.8 SDK for interacting with the Elrond blockchain
package elrond.esdt.builders;
import elrond.Address;
import elrond.esdt.common.Constants;
import elrond.esdt.common.TokenPayment;
import org.apache.commons.codec.binary.Hex;
import java.math.BigInteger;
public class ESDTNFTTransferBuilder {
private TokenPayment payment;
private Address receiver;
public ESDTNFTTransferBuilder() {
}
public ESDTNFTTransferBuilder setPayment(TokenPayment payment) {
this.payment = payment;
return this;
}
public ESDTNFTTransferBuilder setReceiver(Address receiver) {
this.receiver = receiver;
return this;
}
public String build() {
BigInteger nonceBI = new BigInteger(this.payment.getNonce().toString());
String nonceHex = Hex.encodeHexString(nonceBI.toByteArray());
return String.join(Constants.ArgsDelimiter,
Constants.ESDTNFTTransferFunction,
this.payment.getTokenIdentifier().toHexString(),
nonceHex,
this.payment.valueToHexString(),
this.receiver.hex());
}
}