准备工作

(1)需要下载的JAVA SDK包;
(2)以下代码都是示例代码, 调用每个接口都会返回一个JSON数据, 数据包含错误码等信息, 错误码为0表示请求接口成功, 否则失败;
(3)示例代码中各接口中的传入参数都是必须的, 不能少, 可以根据需求增加自定义参数。
开发语言 下载版本 环境要求
Java版资源 SDK 适用于Java语言
C++版资源 SDK 适用于C++语言
*以下为java版使用说明
注册应用
   
 String result =  = safeRpcCall.registerApp(
  pp(
   "mySafeAsset",
   "TEST",
   1,
   "yourname",
   ""http://img3.imgtn.bdimg.com/it/u=3799560630,1610896717&fm=27&gp=0.jpg",
  ",
   ""http://img3.imgtn.bdimg.com/it/u=3799560630,1610896717&fm=27&gp=0.jpg",
  ",
   ""http://img3.imgtn.bdimg.com/it/u=3799560630,1610896717&fm=27&gp=0.jpg"
  "
  );
 System.out.println(res(result));
							 
设置权限
 
 String result = safeRpcCall.setAppAuth(
  1,
  "d89ef7a2abaab45f6f6c0485a99b7cf03e18bbba405f0d442bbd4aa34a2de110",
  "Xjy9sazMiKJkT6ae1fYehxqokXtMMaW5zL",
   1005
 );
 System.out.println(result);
							
创建外带数据

 String result = safeRpcCall.createExtendDataTx(
  2,
   "Xjy9sazMiKJkT6ae1fYehxqokXtMMaW5zL",
   "d89ef7a2abaab45f6f6c0485a99b7cf03e18bbba405f0d442bbd4aa34a2de110",
   1005,
   "1231fad##33"
 );
 System.out.println(result);
							
发行资产

 String result = safeRpcCall.issueAsset(
  "ggb1",
  "GouGouB1",
  "GouGouB1 is an asset",
  "g",
  new BigInteger("10000000000000"),
  new BigInteger("100000"),
  4,
  true,
  true,
  1000,
  1,
  "send 10000"
 );
							
转让资产

 String result = safeRpcCall.transferAsset(
  "Xg1wCDXKuv4rEfsR9Ldv2qmUHSS9Ds1VCL",
  "9f3994739b9442cd1cc6ad24a8731312816abf5579629085e99647c070e8944b",
  new BigDecimal("400"),
  1
 );
							
发送糖果

 String result = safeRpcCall.putCandy(
  "777ea32da8db89f6019b07b948657e485c924e036f037e60a0ba959a88624800",
  10,
  1,
  "测试发放糖果"
 );
						
领取糖果

 String result = safeRpcCall.getAvailableCandyList();
  Map rs = JSONObject.fromObject(result);
  Map rsData = (Map) rs.get("result");
  List> candyList = (List>) rsData.get("candyList");
  //Traverse, collect candy
  for(Map candy:candyList){
  String getCandyStr = safeRpcCall.getCandy((String)candy.get("assetId"));
  System.out.println(getCandyStr);
 }