wallet_defined_by_addresses.js
function sendSharedAddressToPeer(device_address, shared_address, handle){
	var arrDefinition;
	var assocSignersByPath={};
	async.series([
		function(cb){
			db.query("SELECT definition FROM shared_addresses WHERE shared_address=?", [shared_address], function(rows){
				if (!rows[0])
					return cb("Definition not found for " + shared_address);
				arrDefinition = JSON.parse(rows[0].definition);
				return cb(null);
			});
		},
		function(cb){
			db.query("SELECT signing_path,address,member_signing_path,device_address FROM shared_address_signing_paths WHERE shared_address=?", [shared_address], function(rows){
				if (rows.length<2)
					return cb("Less than 2 signing paths found for " + shared_address);
				rows.forEach(function(row){
					assocSignersByPath[row.signing_path] = {address: row.address, member_signing_path: row.member_signing_path, device_address: row.device_address};
				});
				return cb(null);
			});
		}
	],
	function(err){
		if (err)
			return handle(err);
		sendNewSharedAddress(device_address, shared_address, arrDefinition, assocSignersByPath);
		return handle(null);
	});
}
function sendSharedAddressToPeer(device_address, shared_address, handle){
	var arrDefinition;
	var assocSignersByPath={};
	async.series([
		function(cb){
			db.query("SELECT definition FROM shared_addresses WHERE shared_address=?", [shared_address], function(rows){
				if (!rows[0])
					return cb("Definition not found for " + shared_address);
				arrDefinition = JSON.parse(rows[0].definition);
				return cb(null);
			});
		},
		function(cb){
			db.query("SELECT signing_path,address,member_signing_path,device_address FROM shared_address_signing_paths WHERE shared_address=?", [shared_address], function(rows){
				if (rows.length<2)
					return cb("Less than 2 signing paths found for " + shared_address);
				rows.forEach(function(row){
					assocSignersByPath[row.signing_path] = {address: row.address, member_signing_path: row.member_signing_path, device_address: row.device_address};
				});
				return cb(null);
			});
		}
	],
	function(err){
		if (err)
			return handle(err);
		sendNewSharedAddress(device_address, shared_address, arrDefinition, assocSignersByPath);
		return handle(null);
	});
}
function sendSharedAddressToPeer ( device_address , shared_address , handle ) { var arrDefinition ; var assocSignersByPath = { } ; async . series ( [ function ( cb ) { db . query ( "SELECT definition FROM shared_addresses WHERE shared_address=?" , [ shared_address ] , function ( rows ) { if ( ! rows [ 0 ] ) return cb ( "Definition not found for " + shared_address ) ; arrDefinition = JSON . parse ( rows [ 0 ] . definition ) ; return cb ( null ) ; } ) ; } , function ( cb ) { db . query ( "SELECT signing_path,address,member_signing_path,device_address FROM shared_address_signing_paths WHERE shared_address=?" , [ shared_address ] , function ( rows ) { if ( rows . length < 2 ) return cb ( "Less than 2 signing paths found for " + shared_address ) ; rows . forEach ( function ( row ) { assocSignersByPath [ row . signing_path ] = { address : row . address , member_signing_path : row . member_signing_path , device_address : row . device_address } ; } ) ; return cb ( null ) ; } ) ; } ] , function ( err ) { if ( err ) return handle ( err ) ; sendNewSharedAddress ( device_address , shared_address , arrDefinition , assocSignersByPath ) ; return handle ( null ) ; } ) ; }
read shared address definition and signing paths then send them to peer
read shared address definition and signing paths then send them to peer