All Downloads are FREE. Search and download functionalities are using the official Maven repository.

elrond.esdt.builders.ESDTNFTTransferBuilder Maven / Gradle / Ivy

There is a newer version: 1.0.4
Show newest version
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());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy