def get_balance(address = nil)
      outputs = get_unspent_outputs(address.nil? ? [] : [oa_address_to_address(address)])
      colored_outputs = outputs.map{|o|o.output}
      sorted_outputs = colored_outputs.sort_by { |o|o.script.to_string}
      groups = sorted_outputs.group_by{|o| o.script.to_string}
      result = groups.map{|k, v|
        btc_address = script_to_address(v[0].script)
        sorted_script_outputs = v.sort_by{|o|o.asset_id unless o.asset_id}
        group_assets = sorted_script_outputs.group_by{|o|o.asset_id}.select{|k,v| !k.nil?}
        assets = group_assets.map{|asset_id, outputs|
          {
              'asset_id' => asset_id,
              'quantity' => outputs.inject(0) { |sum, o| sum + o.asset_quantity }.to_s,
              'amount' => outputs.inject(0) { |sum, o| sum + o.asset_amount }.to_s,
              'asset_definition_url' => outputs[0].asset_definition_url,
              'proof_of_authenticity' => outputs[0].proof_of_authenticity
          }
        }
        {
            'address' => btc_address,
            'oa_address' => (btc_address.nil? || btc_address.is_a?(Array)) ? nil : address_to_oa_address(btc_address),
            'value' => satoshi_to_coin(v.inject(0) { |sum, o|sum +  o.value}),
            'assets' => assets,
            'account' => v[0].account
        }
      }
      address.nil? ? result : result.select{|r|r['oa_address'] == address}
    end
def get_balance(address = nil)
      outputs = get_unspent_outputs(address.nil? ? [] : [oa_address_to_address(address)])
      colored_outputs = outputs.map{|o|o.output}
      sorted_outputs = colored_outputs.sort_by { |o|o.script.to_string}
      groups = sorted_outputs.group_by{|o| o.script.to_string}
      result = groups.map{|k, v|
        btc_address = script_to_address(v[0].script)
        sorted_script_outputs = v.sort_by{|o|o.asset_id unless o.asset_id}
        group_assets = sorted_script_outputs.group_by{|o|o.asset_id}.select{|k,v| !k.nil?}
        assets = group_assets.map{|asset_id, outputs|
          {
              'asset_id' => asset_id,
              'quantity' => outputs.inject(0) { |sum, o| sum + o.asset_quantity }.to_s,
              'amount' => outputs.inject(0) { |sum, o| sum + o.asset_amount }.to_s,
              'asset_definition_url' => outputs[0].asset_definition_url,
              'proof_of_authenticity' => outputs[0].proof_of_authenticity
          }
        }
        {
            'address' => btc_address,
            'oa_address' => (btc_address.nil? || btc_address.is_a?(Array)) ? nil : address_to_oa_address(btc_address),
            'value' => satoshi_to_coin(v.inject(0) { |sum, o|sum +  o.value}),
            'assets' => assets,
            'account' => v[0].account
        }
      }
      address.nil? ? result : result.select{|r|r['oa_address'] == address}
    end
Returns the balance in both bitcoin and colored coin assets for all of the addresses available in your Bitcoin Core wallet.
 @param [String] address The open assets address. if unspecified nil.