def send_coins(self, asset, target_addrs, raw_colorvalues): """Sends coins to address <target_addr> of asset/color <asset> of amount <colorvalue> Satoshis. """ tx_spec = BasicTxSpec(self.model) adm = self.model.get_asset_definition_manager() colormap = self.model.get_color_map() for target_addr, raw_colorvalue in zip(target_addrs, raw_colorvalues): # decode the address address_asset, address = adm.get_asset_and_address(target_addr) if asset != address_asset: raise AssetMismatchError( "Address and asset don't match: %s %s" % (asset, address_asset)) assettarget = AssetTarget( address, AdditiveAssetValue(asset=asset, value=raw_colorvalue)) tx_spec.add_target(assettarget) signed_tx_spec = self.model.transform_tx_spec(tx_spec, 'signed') if self.debug: print("In:") for txin in signed_tx_spec.composed_tx_spec.txins: print(txin.prevout) print("Out:") for txout in signed_tx_spec.composed_tx_spec.txouts: print(txout.value) txhash = self.publish_tx(signed_tx_spec) # scan the tx so that the rest of the system knows self.model.ccc.colordata.cdbuilder_manager.scan_txhash( asset.color_set.color_id_set, txhash)
def send_coins(self, asset, target_addrs, raw_colorvalues): """Sends coins to address <target_addr> of asset/color <asset> of amount <colorvalue> Satoshis. """ tx_spec = BasicTxSpec(self.model) adm = self.model.get_asset_definition_manager() colormap = self.model.get_color_map() for target_addr, raw_colorvalue in zip(target_addrs, raw_colorvalues): # decode the address address_asset, address = adm.get_asset_and_address(target_addr) if asset != address_asset: raise AssetMismatchError("Address and asset don't match: %s %s" % (asset, address_asset)) assettarget = AssetTarget(address, AdditiveAssetValue(asset=asset, value=raw_colorvalue)) tx_spec.add_target(assettarget) signed_tx_spec = self.model.transform_tx_spec(tx_spec, "signed") if self.debug: print "In:" for txin in signed_tx_spec.composed_tx_spec.txins: print txin.prevout print "Out:" for txout in signed_tx_spec.composed_tx_spec.txouts: print txout.value txhash = self.publish_tx(signed_tx_spec) # scan the tx so that the rest of the system knows self.model.ccc.colordata.cdbuilder_manager.scan_txhash(asset.color_set.color_id_set, txhash)
def send_coins(self, asset, target_addrs, raw_colorvalues): """Sends coins to address <target_addr> of asset/color <asset> of amount <colorvalue> Satoshis. """ tx_spec = BasicTxSpec(self.model) adm = self.model.get_asset_definition_manager() colormap = self.model.get_color_map() for target_addr, raw_colorvalue in zip(target_addrs, raw_colorvalues): # decode the address address_asset, address = adm.get_asset_and_address(target_addr) if asset != address_asset: raise AssetMismatchError("Address and asset don't match: %s %s" % (asset, address_asset)) assettarget = AssetTarget(address, AdditiveAssetValue(asset=asset, value=raw_colorvalue)) tx_spec.add_target(assettarget) signed_tx_spec = self.model.transform_tx_spec(tx_spec, 'signed') if self.debug: print ("In:") for txin in signed_tx_spec.composed_tx_spec.txins: print (txin.prevout) print ("Out:") for txout in signed_tx_spec.composed_tx_spec.txouts: print (txout.value) txhash = self.publish_tx(signed_tx_spec)
def send_coins(self, asset, target_addrs, colorvalues): """Sends coins to address <target_addr> of asset/color <asset> of amount <colorvalue> Satoshis. """ tx_spec = BasicTxSpec(self.model) adm = self.model.get_asset_definition_manager() for target_addr, colorvalue in zip(target_addrs, colorvalues): # decode the address address_asset, address = adm.get_asset_and_address(target_addr) if asset != address_asset: raise Exception("Address and asset don't match: %s %s" % (asset, address_asset)) tx_spec.add_target(address, asset, colorvalue) signed_tx_spec = self.model.transform_tx_spec(tx_spec, 'signed') if self.debug: print "In:" for txin in signed_tx_spec.composed_tx_spec.txins: print txin.utxo.value print "Out:" for txout in signed_tx_spec.composed_tx_spec.txouts: print txout.value txhash = self.publish_tx(signed_tx_spec) # scan the tx so that the rest of the system knows self.model.ccc.colordata.cdbuilder_manager.scan_txhash( asset.color_set.color_id_set, txhash)
def send_coins(self, asset, target_addrs, raw_colorvalues): """Sends coins to address <target_addr> of asset/color <asset> of amount <colorvalue> Satoshis. """ tx_spec = BasicTxSpec(self.model) adm = self.model.get_asset_definition_manager() for target_addr, raw_colorvalue in zip(target_addrs, raw_colorvalues): # decode the address address_asset, address = adm.get_asset_and_address(target_addr) if asset != address_asset: msg = "Address and asset don't match: %s %s!" raise AssetMismatchError(msg % (asset, address_asset)) assettarget = AssetTarget( address, AdditiveAssetValue(asset=asset, value=raw_colorvalue)) tx_spec.add_target(assettarget) signed_tx_spec = self.model.transform_tx_spec(tx_spec, 'signed') txhash = self.publish_tx(signed_tx_spec) self.model.tx_history.add_send_entry(txhash, asset, target_addrs, raw_colorvalues) return txhash
def send_coins(self, asset, target_addrs, raw_colorvalues): """Sends coins to address <target_addr> of asset/color <asset> of amount <colorvalue> Satoshis. """ tx_spec = BasicTxSpec(self.model) adm = self.model.get_asset_definition_manager() for target_addr, raw_colorvalue in zip(target_addrs, raw_colorvalues): # decode the address address_asset, address = adm.get_asset_and_address(target_addr) if asset != address_asset: msg = "Address and asset don't match: %s %s!" raise AssetMismatchError(msg % (asset, address_asset)) assettarget = AssetTarget(address, AdditiveAssetValue(asset=asset, value=raw_colorvalue)) tx_spec.add_target(assettarget) signed_tx_spec = self.model.transform_tx_spec(tx_spec, 'signed') txhash = self.publish_tx(signed_tx_spec) self.model.tx_history.add_send_entry( txhash, asset, target_addrs, raw_colorvalues ) return txhash