tfchain/TFChainWallet.py
def coins_new(self, recipient, amount, lock=None, data=None):
        """
        Create new (amount of) coins and give them to the defined recipient.
        Arbitrary data can be attached as well if desired.

        The recipient is one of:
            - None: recipient is the Free-For-All wallet
            - str (or unlockhash/bytes/bytearray): recipient is a personal wallet
            - list: recipient is a MultiSig wallet where all owners (specified as a list of addresses) have to sign
            - tuple (addresses, sigcount): recipient is a sigcount-of-addresscount MultiSig wallet

        The amount can be a str or an int:
            - when it is an int, you are defining the amount in the smallest unit (that is 1 == 0.000000001 TFT)
            - when defining as a str you can use the following space-stripped and case-insentive formats:
                - '123456789': same as when defining the amount as an int
                - '123.456': define the amount in TFT (that is '123.456' == 123.456 TFT == 123456000000)
                - '123456 TFT': define the amount in TFT (that is '123456 TFT' == 123456 TFT == 123456000000000)
                - '123.456 TFT': define the amount in TFT (that is '123.456 TFT' == 123.456 TFT == 123456000000)

        The lock can be a str, or int:
            - when it is an int it represents either a block height or an epoch timestamp (in seconds)
            - when a str it can be a Jumpscale Datetime (e.g. '12:00:10', '31/10/2012 12:30', ...) or a Jumpscale Duration (e.g. '+ 2h', '+7d12h', ...)

        Returns a TransactionSendResult.

        @param recipient: see explanation above
        @param amount: int or str that defines the amount of TFT to set, see explanation above
        @param lock: optional lock that can be used to lock the sent amount to a specific time or block height, see explation above
        @param data: optional data that can be attached ot the sent transaction (str or bytes), with a max length of 83
        """
        # create empty Mint Definition Txn, with a newly generated Nonce set already
        txn = tftransactions.mint_coin_creation_new()

        # add the minimum miner fee
        txn.miner_fee_add(self._minium_miner_fee)

        balance = self._wallet.balance

        # parse the output
        amount = Currency(value=amount)
        if amount <= 0:
            raise ValueError("no amount is defined to be sent")

        # define recipient
        recipient = ConditionTypes.from_recipient(recipient, lock=lock)
        # and add it is the output
        txn.coin_output_add(value=amount, condition=recipient)

        # optionally set the data
        if data is not None:
            txn.data = data

        # get and set the current mint condition
        txn.parent_mint_condition = self._current_mint_condition_get()
        # create a raw fulfillment based on the current mint condition
        txn.mint_fulfillment = FulfillmentTypes.from_condition(txn.parent_mint_condition)

        # get all signature requests
        sig_requests = txn.signature_requests_new()
        if len(sig_requests) == 0:
            raise Exception("BUG: sig requests should not be empty at this point, please fix or report as an issue")

        # fulfill the signature requests that we can fulfill
        for request in sig_requests:
            try:
                key_pair = self._wallet.key_pair_get(request.wallet_address)
                input_hash = request.input_hash_new(public_key=key_pair.public_key)
                signature = key_pair.sign(input_hash)
                request.signature_fulfill(public_key=key_pair.public_key, signature=signature)
            except KeyError:
                pass # this is acceptable due to how we directly try the key_pair_get method

        submit = txn.is_fulfilled()
        if submit:
            txn.id = self._transaction_put(transaction=txn)
            # update balance of wallet
            addresses = self._wallet.addresses + balance.addresses_multisig
            for idx, co in enumerate(txn.coin_outputs):
                if str(co.condition.unlockhash) in addresses:
                    # add the id to the coin_output, so we can track it has been spent
                    co.id = txn.coin_outputid_new(idx)
                    balance.output_add(co, confirmed=False, spent=False)

        # return the txn, as well as the submit status as a boolean
        return TransactionSendResult(txn, submit)

        Create new (amount of) coins and give them to the defined recipient.
        Arbitrary data can be attached as well if desired.

        The recipient is one of:
            - None: recipient is the Free-For-All wallet
            - str (or unlockhash/bytes/bytearray): recipient is a personal wallet
            - list: recipient is a MultiSig wallet where all owners (specified as a list of addresses) have to sign
            - tuple (addresses, sigcount): recipient is a sigcount-of-addresscount MultiSig wallet

        The amount can be a str or an int:
            - when it is an int, you are defining the amount in the smallest unit (that is 1 == 0.000000001 TFT)
            - when defining as a str you can use the following space-stripped and case-insentive formats:
                - '123456789': same as when defining the amount as an int
                - '123.456': define the amount in TFT (that is '123.456' == 123.456 TFT == 123456000000)
                - '123456 TFT': define the amount in TFT (that is '123456 TFT' == 123456 TFT == 123456000000000)
                - '123.456 TFT': define the amount in TFT (that is '123.456 TFT' == 123.456 TFT == 123456000000)

        The lock can be a str, or int:
            - when it is an int it represents either a block height or an epoch timestamp (in seconds)
            - when a str it can be a Jumpscale Datetime (e.g. '12:00:10', '31/10/2012 12:30', ...) or a Jumpscale Duration (e.g. '+ 2h', '+7d12h', ...)

        Returns a TransactionSendResult.

        @param recipient: see explanation above
        @param amount: int or str that defines the amount of TFT to set, see explanation above
        @param lock: optional lock that can be used to lock the sent amount to a specific time or block height, see explation above
        @param data: optional data that can be attached ot the sent transaction (str or bytes), with a max length of 83
        
Create new (amount of) coins and give them to the defined recipient.
Arbitrary data can be attached as well if desired.





The lock can be a str, or int:
when it is an int it represents either a block height or an epoch timestamp (in seconds)
when a str it can be a Jumpscale Datetime  or a Jumpscale Duration


Create new ( amount of ) coins and give them to the defined recipient . Arbitrary data can be attached as well if desired . The lock can be a str or int : when it is an int it represents either a block height or an epoch timestamp ( in seconds ) when a str it can be a Jumpscale Datetime or a Jumpscale Duration
def coins_new(self, recipient, amount, lock=None, data=None):
        txn = tftransactions.mint_coin_creation_new()
        txn.miner_fee_add(self._minium_miner_fee)
        balance = self._wallet.balance
        amount = Currency(value=amount)
        if amount <= 0:
            raise ValueError("no amount is defined to be sent")
        recipient = ConditionTypes.from_recipient(recipient, lock=lock)
        txn.coin_output_add(value=amount, condition=recipient)
        if data is not None:
            txn.data = data
        txn.parent_mint_condition = self._current_mint_condition_get()
        txn.mint_fulfillment = FulfillmentTypes.from_condition(txn.parent_mint_condition)
        sig_requests = txn.signature_requests_new()
        if len(sig_requests) == 0:
            raise Exception("BUG: sig requests should not be empty at this point, please fix or report as an issue")
        for request in sig_requests:
            try:
                key_pair = self._wallet.key_pair_get(request.wallet_address)
                input_hash = request.input_hash_new(public_key=key_pair.public_key)
                signature = key_pair.sign(input_hash)
                request.signature_fulfill(public_key=key_pair.public_key, signature=signature)
            except KeyError:
                pass 
        submit = txn.is_fulfilled()
        if submit:
            txn.id = self._transaction_put(transaction=txn)
            addresses = self._wallet.addresses + balance.addresses_multisig
            for idx, co in enumerate(txn.coin_outputs):
                if str(co.condition.unlockhash) in addresses:
                    co.id = txn.coin_outputid_new(idx)
                    balance.output_add(co, confirmed=False, spent=False)
        return TransactionSendResult(txn, submit)
def coins_new ( self , recipient , amount , lock = None , data = None ) : txn = tftransactions . mint_coin_creation_new ( ) txn . miner_fee_add ( self . _minium_miner_fee ) balance = self . _wallet . balance amount = Currency ( value = amount ) if amount <= 0 : raise ValueError ( "no amount is defined to be sent" ) recipient = ConditionTypes . from_recipient ( recipient , lock = lock ) txn . coin_output_add ( value = amount , condition = recipient ) if data is not None : txn . data = data txn . parent_mint_condition = self . _current_mint_condition_get ( ) txn . mint_fulfillment = FulfillmentTypes . from_condition ( txn . parent_mint_condition ) sig_requests = txn . signature_requests_new ( ) if len ( sig_requests ) == 0 : raise Exception ( "BUG: sig requests should not be empty at this point, please fix or report as an issue" ) for request in sig_requests : try : key_pair = self . _wallet . key_pair_get ( request . wallet_address ) input_hash = request . input_hash_new ( public_key = key_pair . public_key ) signature = key_pair . sign ( input_hash ) request . signature_fulfill ( public_key = key_pair . public_key , signature = signature ) except KeyError : pass submit = txn . is_fulfilled ( ) if submit : txn . id = self . _transaction_put ( transaction = txn ) addresses = self . _wallet . addresses + balance . addresses_multisig for idx , co in enumerate ( txn . coin_outputs ) : if str ( co . condition . unlockhash ) in addresses : co . id = txn . coin_outputid_new ( idx ) balance . output_add ( co , confirmed = False , spent = False ) return TransactionSendResult ( txn , submit )
Create new (amount of) coins and give them to the defined recipient.
Create new ( amount of ) coins and give them to the defined recipient .
"""
        Create new (amount of) coins and give them to the defined recipient.
        Arbitrary data can be attached as well if desired.

        The recipient is one of:
            - None: recipient is the Free-For-All wallet
            - str (or unlockhash/bytes/bytearray): recipient is a personal wallet
            - list: recipient is a MultiSig wallet where all owners (specified as a list of addresses) have to sign
            - tuple (addresses, sigcount): recipient is a sigcount-of-addresscount MultiSig wallet

        The amount can be a str or an int:
            - when it is an int, you are defining the amount in the smallest unit (that is 1 == 0.000000001 TFT)
            - when defining as a str you can use the following space-stripped and case-insentive formats:
                - '123456789': same as when defining the amount as an int
                - '123.456': define the amount in TFT (that is '123.456' == 123.456 TFT == 123456000000)
                - '123456 TFT': define the amount in TFT (that is '123456 TFT' == 123456 TFT == 123456000000000)
                - '123.456 TFT': define the amount in TFT (that is '123.456 TFT' == 123.456 TFT == 123456000000)

        The lock can be a str, or int:
            - when it is an int it represents either a block height or an epoch timestamp (in seconds)
            - when a str it can be a Jumpscale Datetime (e.g. '12:00:10', '31/10/2012 12:30', ...) or a Jumpscale Duration (e.g. '+ 2h', '+7d12h', ...)

        Returns a TransactionSendResult.

        @param recipient: see explanation above
        @param amount: int or str that defines the amount of TFT to set, see explanation above
        @param lock: optional lock that can be used to lock the sent amount to a specific time or block height, see explation above
        @param data: optional data that can be attached ot the sent transaction (str or bytes), with a max length of 83
        """ # create empty Mint Definition Txn, with a newly generated Nonce set already # add the minimum miner fee # parse the output # define recipient # and add it is the output # optionally set the data # get and set the current mint condition # create a raw fulfillment based on the current mint condition # get all signature requests # fulfill the signature requests that we can fulfill # this is acceptable due to how we directly try the key_pair_get method # update balance of wallet # add the id to the coin_output, so we can track it has been spent # return the txn, as well as the submit status as a boolean
self
recipient
see explanation above
see explanation above
amount
int or str that defines the amount of TFT to set, see explanation above
int or str that defines the amount of TFT to set see explanation above
lock
optional lock that can be used to lock the sent amount to a specific time or block height, see explation above
optional lock that can be used to lock the sent amount to a specific time or block height see explation above
data
optional data that can be attached ot the sent transaction (str or bytes), with a max length of 83
optional data that can be attached ot the sent transaction ( str or bytes ) with a max length of 83