Class KIP37Wrapper


  • public class KIP37Wrapper
    extends java.lang.Object
    Representing a KIP37Wrapper 1. This class wraps all static methods of KIP37 2. This class should be accessed via `caver.kct.kip37`
    • Constructor Detail

      • KIP37Wrapper

        public KIP37Wrapper​(Caver caver)
        Creates a KIP37Wrapper instance
        Parameters:
        caver - A Caver instance
    • Method Detail

      • create

        public KIP37 create()
                     throws java.io.IOException
        Creates a KIP37 instance.
        Example
         
         KIP37 kip37 = caver.kct.kip37.create();
         
         
        Returns:
        KIP37
        Throws:
        java.io.IOException
      • create

        public KIP37 create​(java.lang.String contractAddress)
                     throws java.io.IOException
        Creates a KIP37 instance.
        Example
         
         String contractAddress = "0x{contractAddress}";
         KIP37 kip37 = caver.kct.kip37.create(contractAddress);
         
         
        Parameters:
        contractAddress - A contract address
        Returns:
        KIP37
        Throws:
        java.io.IOException
      • deploy

        public KIP37 deploy​(java.lang.String uri,
                            java.lang.String deployer)
                     throws java.io.IOException,
                            java.lang.NoSuchMethodException,
                            java.lang.InstantiationException,
                            java.lang.ClassNotFoundException,
                            java.lang.IllegalAccessException,
                            java.lang.reflect.InvocationTargetException,
                            org.web3j.protocol.exceptions.TransactionException
        Deploy a KIP-37 contract.

        The deployer's keyring should be existed in `caver.wallet`. See KeyringContainer and IWallet.

        Example :
         
         String deployerAddress = "0x{deployerAddress}";
         String uri = "uri";
        
         KIP37 kip37 = caver.kct.kip37.deploy(uri, deployerAddress);
         
         
        Parameters:
        uri - The URI for token type.
        deployer - A deployer's address.
        Returns:
        KIP37
        Throws:
        java.io.IOException
        java.lang.NoSuchMethodException
        java.lang.InstantiationException
        java.lang.ClassNotFoundException
        java.lang.IllegalAccessException
        java.lang.reflect.InvocationTargetException
        org.web3j.protocol.exceptions.TransactionException
      • deploy

        public KIP37 deploy​(java.lang.String uri,
                            SendOptions sendOptions)
                     throws java.io.IOException,
                            java.lang.NoSuchMethodException,
                            java.lang.InstantiationException,
                            java.lang.ClassNotFoundException,
                            java.lang.IllegalAccessException,
                            java.lang.reflect.InvocationTargetException,
                            org.web3j.protocol.exceptions.TransactionException
        Deploy a KIP-37 contract.

        The deployer's keyring should be existed in `caver.wallet`. See KeyringContainer and IWallet.

        If you want to deploy a contract using fee delegation transaction, you can create and send a fee delegated transaction through setting a fee delegation field in SendOptions.

         Example :
         
         String uri = "uri";
        
         SendOptions sendOptions = new SendOptions();
         sendOptions.setFrom("0x{deployerAddress}");
         sendOptions.setGas(BigInteger.valueOf(gas value));
         sendOptions.setFeeDelegation(true);
         sendOptions.setFeePayer("0x{feePayerAddress}");
        
         KIP37 kip37 = caver.kct.kip37.deploy(uri, sendOptions);
         
         
        Parameters:
        uri - The URI for token type.
        sendOptions - The send options to deploy a contract.
        Returns:
        KIP37
        Throws:
        java.io.IOException
        java.lang.NoSuchMethodException
        java.lang.InstantiationException
        java.lang.ClassNotFoundException
        java.lang.IllegalAccessException
        java.lang.reflect.InvocationTargetException
        org.web3j.protocol.exceptions.TransactionException
      • deploy

        public KIP37 deploy​(java.lang.String uri,
                            java.lang.String deployer,
                            IWallet wallet)
                     throws java.io.IOException,
                            java.lang.NoSuchMethodException,
                            java.lang.InstantiationException,
                            java.lang.ClassNotFoundException,
                            java.lang.IllegalAccessException,
                            java.lang.reflect.InvocationTargetException,
                            org.web3j.protocol.exceptions.TransactionException
        Deploy a KIP-37 contract.

        The deployer's keyring should be existed in `caver.wallet`.

        The wallet used in the contract is set with the wallet that implements the IWallet interface passed as a parameter of the method.

        Example :
         
         String deployerAddress = "0x{deployerAddress}";
         String uri = "uri";
        
         KIP37 kip37 = caver.kct.kip37.deploy(uri, deployerAddress, caver.getWallet());
         
         
        Parameters:
        uri - The URI for token type.
        deployer - A deployer's address.
        wallet - The class instance implemented IWallet to sign transaction.
        Returns:
        KIP37
        Throws:
        java.io.IOException
        java.lang.NoSuchMethodException
        java.lang.InstantiationException
        java.lang.ClassNotFoundException
        java.lang.IllegalAccessException
        java.lang.reflect.InvocationTargetException
        org.web3j.protocol.exceptions.TransactionException
      • deploy

        public KIP37 deploy​(java.lang.String uri,
                            SendOptions sendOptions,
                            IWallet wallet)
                     throws java.io.IOException,
                            java.lang.NoSuchMethodException,
                            java.lang.InstantiationException,
                            java.lang.ClassNotFoundException,
                            java.lang.IllegalAccessException,
                            java.lang.reflect.InvocationTargetException,
                            org.web3j.protocol.exceptions.TransactionException
        Deploy a KIP-37 contract.

        The deployer's keyring should be existed in `caver.wallet`.

        The wallet used in the contract is set with the wallet that implements the IWallet interface passed as a parameter of the method.

        If you want to deploy a contract using fee delegation transaction, you can create and send a fee delegated transaction through setting a fee delegation field in SendOptions.

         Example :
         
         String uri = "uri";
        
         SendOptions sendOptions = new SendOptions();
         sendOptions.setFrom("0x{deployerAddress}");
         sendOptions.setGas(BigInteger.valueOf(gas value));
         sendOptions.setFeeDelegation(true);
         sendOptions.setFeePayer("0x{feePayerAddress}");
        
         KIP37 kip37 = caver.kct.kip37.deploy(uri, sendOptions, caver.getWallet());
         
         
        Parameters:
        uri - The URI for token type.
        sendOptions - The send options to deploy a contract.
        wallet - The class instance implemented IWallet to sign transaction.
        Returns:
        Throws:
        java.io.IOException
        java.lang.NoSuchMethodException
        java.lang.InstantiationException
        java.lang.ClassNotFoundException
        java.lang.IllegalAccessException
        java.lang.reflect.InvocationTargetException
        org.web3j.protocol.exceptions.TransactionException
      • deploy

        public KIP37 deploy​(KIP37DeployParams tokenInfo,
                            java.lang.String deployer)
                     throws org.web3j.protocol.exceptions.TransactionException,
                            java.io.IOException,
                            java.lang.ClassNotFoundException,
                            java.lang.reflect.InvocationTargetException,
                            java.lang.NoSuchMethodException,
                            java.lang.InstantiationException,
                            java.lang.IllegalAccessException
        Deploy a KIP-37 contract.

        The deployer's keyring should be existed in `caver.wallet`.

        Example :
         
         String deployerAddress = "0x{deployerAddress}";
         String uri = "uri";
         KIP37DeployParams deployInfo = new KIP37DeployParams(uri);
        
         KIP37 kip37 = caver.kct.kip37.deploy(deployInfo, deployerAddress);
         
         
        Parameters:
        tokenInfo - The KIP-37 contract's deploy parameter values.
        deployer - A deployer's address
        Returns:
        KIP37
        Throws:
        org.web3j.protocol.exceptions.TransactionException
        java.io.IOException
        java.lang.ClassNotFoundException
        java.lang.reflect.InvocationTargetException
        java.lang.NoSuchMethodException
        java.lang.InstantiationException
        java.lang.IllegalAccessException
      • deploy

        public KIP37 deploy​(KIP37DeployParams tokenInfo,
                            SendOptions sendOptions)
                     throws org.web3j.protocol.exceptions.TransactionException,
                            java.io.IOException,
                            java.lang.ClassNotFoundException,
                            java.lang.reflect.InvocationTargetException,
                            java.lang.NoSuchMethodException,
                            java.lang.InstantiationException,
                            java.lang.IllegalAccessException
        Deploy a KIP-37 contract.

        The deployer's keyring should be existed in `caver.wallet`.

        If you want to deploy a contract using fee delegation transaction, you can create and send a fee delegated transaction through setting a fee delegation field in SendOptions.

        Example :
         
         String uri = "uri";
         KIP37DeployParams deployInfo = new KIP37DeployParams(uri);
        
         SendOptions sendOptions = new SendOptions();
         sendOptions.setFrom("0x{deployerAddress}");
         sendOptions.setGas(BigInteger.valueOf(gas value));
         sendOptions.setFeeDelegation(true);
         sendOptions.setFeePayer("0x{feePayerAddress}");
        
         KIP37 kip37 = caver.kct.kip37.deploy(deployInfo, sendOptions);
         
         
        Parameters:
        tokenInfo - The KIP-37 contract's deploy parameter values.
        sendOptions - The send options to deploy a contract.
        Returns:
        KIP37
        Throws:
        org.web3j.protocol.exceptions.TransactionException
        java.io.IOException
        java.lang.ClassNotFoundException
        java.lang.reflect.InvocationTargetException
        java.lang.NoSuchMethodException
        java.lang.InstantiationException
        java.lang.IllegalAccessException
      • deploy

        public KIP37 deploy​(KIP37DeployParams tokenInfo,
                            java.lang.String deployer,
                            IWallet wallet)
                     throws java.io.IOException,
                            java.lang.NoSuchMethodException,
                            java.lang.InstantiationException,
                            java.lang.ClassNotFoundException,
                            java.lang.IllegalAccessException,
                            java.lang.reflect.InvocationTargetException,
                            org.web3j.protocol.exceptions.TransactionException
        Deploy a KIP-37 contract.

        The deployer's keyring should be existed in `caver.wallet`.

        The wallet used in the contract is set with the wallet that implements the IWallet interface passed as a parameter of the method.

        Example :
         
         String uri = "uri";
         KIP37DeployParams deployInfo = new KIP37DeployParams(uri);
        
         KIP37 kip37 = caver.kct.kip37.deploy(deployInfo, sendOptions, caver.getWallet());
         
         
        Parameters:
        tokenInfo - The KIP-37 contract's deploy parameter values.
        deployer - A deployer's address
        wallet - The class instance implemented IWallet to sign transaction.
        Returns:
        KIP37
        Throws:
        java.io.IOException
        java.lang.NoSuchMethodException
        java.lang.InstantiationException
        java.lang.ClassNotFoundException
        java.lang.IllegalAccessException
        java.lang.reflect.InvocationTargetException
        org.web3j.protocol.exceptions.TransactionException
      • deploy

        public KIP37 deploy​(KIP37DeployParams tokenInfo,
                            SendOptions sendOptions,
                            IWallet wallet)
                     throws org.web3j.protocol.exceptions.TransactionException,
                            java.io.IOException,
                            java.lang.ClassNotFoundException,
                            java.lang.reflect.InvocationTargetException,
                            java.lang.NoSuchMethodException,
                            java.lang.InstantiationException,
                            java.lang.IllegalAccessException
        Deploy a KIP-37 contract.

        The deployer's keyring should be existed in `caver.wallet`.

        The wallet used in the contract is set with the wallet that implements the IWallet interface passed as a parameter of the method.

        Example :
         
         String uri = "uri";
         KIP37DeployParams deployInfo = new KIP37DeployParams(uri);
        
         SendOptions sendOptions = new SendOptions();
         sendOptions.setFrom("0x{deployerAddress}");
         sendOptions.setGas(BigInteger.valueOf(gas value));
         sendOptions.setFeeDelegation(true);
         sendOptions.setFeePayer("0x{feePayerAddress}");
        
         KIP37 kip37 = caver.kct.kip37.deploy(deployInfo, sendOptions, caver.getWallet());
         
         
        Parameters:
        tokenInfo - The KIP-37 contract's deploy parameter values.
        sendOptions - The send options to deploy a contract.
        wallet - The class instance implemented IWallet to sign transaction.
        Returns:
        KIP37
        Throws:
        org.web3j.protocol.exceptions.TransactionException
        java.io.IOException
        java.lang.ClassNotFoundException
        java.lang.reflect.InvocationTargetException
        java.lang.NoSuchMethodException
        java.lang.InstantiationException
        java.lang.IllegalAccessException
      • detectInterface

        public java.util.Map<java.lang.String,​java.lang.Boolean> detectInterface​(java.lang.String contractAddress)
        Detects which interface the KIP-37 token contract supports.

        Example :

        
         Map<String, Boolean> result = KIP37.detectInterface();
         result.get(KIP37.INTERFACE_ID_IKIP37);
         result.get(KIP37.INTERFACE_ID_IKIP37_BURNABLE);
         result.get(KIP37.INTERFACE_ID_IKIP37_METADATA);
         result.get(KIP37.INTERFACE_ID_IKIP37_MINTABLE);
         result.get(KIP37.INTERFACE_ID_IKIP37_PAUSABLE);
         
        Parameters:
        contractAddress - A contract instance
        Returns:
        Map<String, Boolean>