Do a transfer with `target` with the given `amount` of `token_address`.
13124
def transfer_and_wait(
            self,
            registry_address: PaymentNetworkID,
            token_address: TokenAddress,
            amount: TokenAmount,
            target: Address,
            identifier: PaymentID = None,
            transfer_timeout: int = None,
            secret: Secret = None,
            secret_hash: SecretHash = None,
    ):
        
        # pylint: disable=too-many-arguments

        payment_status = self.transfer_async(
            registry_address=registry_address,
            token_address=token_address,
            amount=amount,
            target=target,
            identifier=identifier,
            secret=secret,
            secret_hash=secret_hash,
        )
        payment_status.payment_done.wait(timeout=transfer_timeout)
        return payment_status
782773
def transfer_funds(self, to, amount, denom, msg):
        ''' 
        '''
        try:
            self.steem_instance().commit.transfer(to, 
                float(amount), denom, msg, self.mainaccount)
        except Exception as e:
            self.msg.error_message(e)
            return False
        else:
            return True
228725
def start(self, segment):
        """"""

        if self.closed:
            raise UserCritical(msg='attempt to transfer wal after closing',
                               hint='report a bug')

        g = gevent.Greenlet(self.transferer, segment)
        g.link(self._complete_execution)
        self.greenlets.add(g)

        # Increment .expect before starting the greenlet, or else a
        # very unlucky .join could be fooled as to when pool is
        # complete.
        self.expect += 1

        g.start()
906616
def transfer(self, receiver_address, amount, from_account):
        
        tx_hash = self.send_transaction(
            'transfer',
            (receiver_address,
             amount),
            transact={'from': from_account.address,
                      'passphrase': from_account.password}
        )
        return self.get_tx_receipt(tx_hash).status == 1
515581
def send(self, wallet_id, passcode, address, amount, message='', fee=None, fan_unspend=10):
        
        MINIMAL_FEE = 20000
        MINIMAL_SPLIT = 10000000

        wallet = self.get_wallet(wallet_id)

        if not wallet['spendingAccount']:
            raise NotSpendableWallet()

        if not wallet['isActive']:
            raise NotActiveWallet()

        if amount < 10000:
            raise Exception('amount to small')

        if wallet['confirmedBalance'] < amount:
            raise NotEnoughFunds('Not enough funds: balance %s amount %s' %
                                 (wallet['confirmedBalance'], amount)
            )

        change_address = self.create_address(wallet_id, chain=1)
        usableKeychain = False
        spendables = []
        chain_paths = []
        p2sh = []
        payables = [(address, amount)]
        keychain_path = ""

        for keychain in wallet['private']['keychains']:
            keychain_path = keychain['path'][1:]
            keychain = self.get_keychain(keychain['xpub'])
            if 'encryptedXprv' not in keychain:
                continue
            usableKeychain = True
            break

        if not usableKeychain:
            raise BitGoError("didn't found a spendable keychain")

        data = json.loads(keychain['encryptedXprv'])
        #add base64 paddings
        for k in ['iv', 'salt', 'ct']:
            data[k] = data[k] + "=="
        cipher = sjcl.SJCL()
        xprv = cipher.decrypt(data, passcode)

        unspents = self.get_unspents(wallet_id)
        unspents = filter(lambda u: u['confirmations'] > 0, unspents['unspents'][::-1])

        total_value = 0
        for d in unspents:
            path = keychain_path + d['chainPath']
            chain_paths.append(path)
            p2sh.append(h2b(d["redeemScript"]))
            spendables.append(Spendable(d["value"],
                                  h2b(d["script"]),
                                  h2b_rev(d["tx_hash"]),
                                  d["tx_output_n"]))

            total_value += d['value']
            if total_value > amount:
                break

        # make many outputs?
        if len(unspents) < 5 and (total_value > (amount + MINIMAL_SPLIT)) and fan_unspend > 0:
            fee = self.calculate_fee(len(spendables), fan_unspend)
            value = (total_value - amount - fee) / fan_unspend
            for i in range(fan_unspend):
                payables.append((change_address, value))
        elif total_value > (amount + MINIMAL_FEE):
            # add a change address
            if fee is None:
                fee = self.calculate_fee(len(spendables), 2)
            value = total_value - amount - fee
            if value > 10000: #avoid dust
                payables.append((change_address, value))

        p2sh_lookup = build_p2sh_lookup(p2sh)

        spendable_keys = []

        priv_key = BIP32Node.from_hwif(xprv)

        spendable_keys = [priv_key.subkey_for_path(path) for path in chain_paths]

        hash160_lookup = build_hash160_lookup([key.secret_exponent() for key in spendable_keys])

        tx = create_tx(spendables, payables)

        tx.sign(hash160_lookup=hash160_lookup, p2sh_lookup=p2sh_lookup)

        r = requests.post(self.url + '/tx/send', {
                'tx': tx.as_hex(),
                'message': message
            }, headers={
                'Authorization': 'Bearer %s' % self.access_token,
            })

        return r.json()
1188137
def xrp_withdrawal(self, amount, address, destination_tag=None):
        
        data = {'amount': amount, 'address': address}
        if destination_tag:
            data['destination_tag'] = destination_tag

        return self._post("xrp_withdrawal/", data=data, return_json=True,
                          version=2)["id"]
534050
def request_transfer(subject, recipient, comment):
    ''''''
    TransferPermission(subject).test()
    if recipient == (subject.organization or subject.owner):
        raise ValueError(
            'Recipient should be different than the current owner')
    transfer = Transfer.objects.create(
        owner=subject.organization or subject.owner,
        recipient=recipient,
        subject=subject,
        comment=comment
    )
    return transfer
983545
def transfer_to_main(self, amount, currency, subaccount=None):
        
        data = {'amount': amount,
                'currency': currency,}
        if subaccount is not None:
            data['subAccount'] = subaccount
        return self._post("transfer-to-main/", data=data, return_json=True,
                          version=2)
1162666
def transfer_all(cls, field_mappings, sources, destination_factory=None):
    """"""
    for index, source in enumerate(sources):
      try:
        yield cls.transfer(field_mappings, source, destination_factory or (lambda x: x))
      except Exception as ex:
        raise Exception("Error with source #{0}: {1}".format(index, ex)) from ex
138263
def put(self, target, callback = None, name = None, *args, **kargs):
        
        self.count_lock.acquire()
        if not self.shared['workers']:
            self.add(name = name)
        self.count_lock.release()
        self.queue.put_nowait((target, callback, name, args, kargs))
961164
def get_balance(self, address):
        
        url_append = "/balance?token=%s" % self.api_key
        url = self.base_url("addrs/%s" % (address + url_append))
        result = json.loads(urlopen(url).read().decode("utf8"))
        return result
861974
def project_transfer(object_id, input_params={}, always_retry=True, **kwargs):
    
    return DXHTTPRequest('/%s/transfer' % object_id, input_params, always_retry=always_retry, **kwargs)
1163417
def start_transfer(self):
        '''  '''
        try:
            if not self.is_done():
                faspmanager2.startTransfer(self.get_transfer_id(),
                                           None,
                                           self.get_transfer_spec(),
                                           self)
        except Exception as ex:
            self.notify_exception(ex)
329376
def litecoin_withdrawal(self, amount, address):
        
        data = {'amount': amount, 'address': address}
        return self._post("ltc_withdrawal/", data=data, return_json=True,
                          version=2)
255758
def _join_partner(self, partner: Address):
        
        try:
            self.api.channel_open(
                self.registry_address,
                self.token_address,
                partner,
            )
        except DuplicatedChannelError:
            # If channel already exists (either because partner created it,
            # or it's nonfunded channel), continue to ensure it's funded
            pass

        total_deposit = self._initial_funding_per_partner
        if total_deposit == 0:
            return

        try:
            self.api.set_total_channel_deposit(
                registry_address=self.registry_address,
                token_address=self.token_address,
                partner_address=partner,
                total_deposit=total_deposit,
            )
        except InvalidDBData:
            raise
        except RECOVERABLE_ERRORS:
            log.info(
                'Deposit failed',
                node=pex(self.raiden.address),
                partner=pex(partner),
            )
        except RaidenUnrecoverableError:
            should_crash = (
                self.raiden.config['environment_type'] != Environment.PRODUCTION or
                self.raiden.config['unrecoverable_error_should_crash']
            )
            if should_crash:
                raise

            log.critical(
                'Deposit failed',
                node=pex(self.raiden.address),
                partner=pex(partner),
            )
1077982
def increment(self, member, amount=1):
        """"""
        return self.client.zincrby(self.name, member, amount)
453924
def token_approve(self, spender_address, price, from_account):
        
        if not Web3Provider.get_web3().isChecksumAddress(spender_address):
            spender_address = Web3Provider.get_web3().toChecksumAddress(spender_address)

        tx_hash = self.send_transaction(
            'approve',
            (spender_address,
             price),
            transact={'from': from_account.address,
                      'passphrase': from_account.password}
        )
        return self.get_tx_receipt(tx_hash).status == 1