Пример #1
0
  /**
   * 异步资产发放
   *
   * @param currentString 随机字符串,不长于32位
   * @param accPwd 资产转出方的账户密码
   * @param tradeNo 开发者内部的凭据号,如:2015121822992
   * @param assetCode 资产CODE,转出方给转入方转让的资产标识(全网唯一)
   * @param assetAmount 资产转移数量,参数不带小数点
   * @param fromBubiId 资产转出方布比账号地址
   * @param toBubiId 资产转入方布比账号地址
   * @param assetDetails 资产明细
   * @param metadata 扩展字段
   * @return
   * @throws Exception
   */
  public String grantAssetAsync(
      String currentString,
      String accPwd,
      String tradeNo,
      String assetCode,
      String assetAmount,
      String fromBubiId,
      String toBubiId,
      List<Detail> assetDetails,
      String metadata)
      throws Exception {
    String url = Constants.ASSET_GRANT_ASYNC_URL + "?access_token=" + access_token;
    Map<String, Object> sParaTemp = new HashMap<String, Object>();
    sParaTemp.put("current_string", currentString);
    sParaTemp.put("trade_no", tradeNo);
    sParaTemp.put("asset_code", assetCode);
    sParaTemp.put("asset_amount", assetAmount);
    sParaTemp.put("from_bubi_address", fromBubiId);
    sParaTemp.put("to_bubi_address", toBubiId);
    // [必填]签名,签名原理详见API文档中的"签名算法"
    sParaTemp.put("sign", Tools.buildRequestMySign(sParaTemp));

    sParaTemp.put("password", accPwd);
    sParaTemp.put("details", assetDetails);
    sParaTemp.put("metadata", metadata);
    return HttpKit.post(url, JSON.toJSONString(sParaTemp));
  }
Пример #2
0
 /**
  * 获取交易信息
  *
  * @param bubiId 待查询布比账号地址
  * @return 服务器响应
  */
 public String transation(String bubiId) throws Exception {
   String url =
       Constants.ACCOUNT_TRANSATION_URL
           + "?access_token="
           + access_token
           + "&bubi_address="
           + bubiId;
   return HttpKit.get(url);
 }
Пример #3
0
 /**
  * 异步追加发行资产
  *
  * @param accPwd 资产转出方的账户密码
  * @param tradeNo 开发者内部的凭据号,如:2015121822992
  * @param assetCode 资产CODE,转出方给转入方转让的资产标识(全网唯一)
  * @param assetAmount 资产转移数量,参数不带小数点
  * @param metadata 扩展字段
  */
 public String add2IssueAsync(
     String accPwd, String tradeNo, String assetCode, String assetAmount, String metadata)
     throws Exception {
   String url = Constants.ASSET_ADD2ISSUE_ASYNC_URL + "?access_token=" + access_token;
   Map<String, Object> sParaTemp = new HashMap<String, Object>();
   sParaTemp.put("trade_no", tradeNo);
   sParaTemp.put("asset_code", assetCode);
   sParaTemp.put("asset_amount", assetAmount);
   sParaTemp.put("password", accPwd);
   sParaTemp.put("metadata", metadata);
   return HttpKit.post(url, JSON.toJSONString(sParaTemp));
 }
Пример #4
0
 /**
  * 资产发行
  *
  * @param assetIssuer 资产发行商布比地址
  * @param accPwd 资产发行商密码
  * @param tradeNo 凭据号
  * @param assetName 待发行资产名称
  * @param assetUnit 待发行资产单位
  * @param assetAmount 待发行资产数量
  * @param body 说明,如,资产描述或摘要
  * @param metadata 扩展字段
  * @return
  * @throws Exception
  */
 public String issue(
     String assetIssuer,
     String accPwd,
     String tradeNo,
     String assetName,
     String assetUnit,
     String assetAmount,
     String body,
     String metadata)
     throws Exception {
   String url = Constants.ASSET_ISSUE_URL + "?access_token=" + access_token;
   Map<String, String> sParaTemp = new HashMap<String, String>();
   sParaTemp.put("trade_no", tradeNo);
   sParaTemp.put("asset_issuer", assetIssuer);
   sParaTemp.put("asset_name", assetName);
   sParaTemp.put("asset_unit", assetUnit);
   sParaTemp.put("asset_amount", assetAmount);
   sParaTemp.put("password", accPwd);
   sParaTemp.put("body", body);
   sParaTemp.put("metadata", metadata);
   return HttpKit.post(url, JSON.toJSONString(sParaTemp));
 }
Пример #5
0
 /**
  * 获取账户信息
  *
  * @param bubiId 待查询布比账号地址
  * @return 服务器响应
  */
 public String info(String bubiId) throws Exception {
   String url =
       Constants.ACCOUNT_INFO_URL + "?access_token=" + access_token + "&bubi_address=" + bubiId;
   return HttpKit.get(url);
 }
Пример #6
0
 /**
  * 修改布比区块链账户密码
  *
  * @param dataJson 请求参数
  * @return 服务器响应
  * @throws Exception
  */
 public String alterPwd(String dataJson) throws Exception {
   String url = Constants.ACCOUNT_ALTERPWD_URL + "?access_token=" + access_token;
   return HttpKit.post(url, dataJson);
 }
Пример #7
0
 /**
  * 注册布比区块链账户
  *
  * @param dataJson 请求参数
  * @return 服务器响应
  * @throws Exception
  */
 public String registerBubiAccount(String dataJson) throws Exception {
   String url = Constants.ACCOUNT_REGISTER_URL + "?access_token=" + access_token;
   return HttpKit.post(url, dataJson);
 }