功能介绍#
平台方或终端用户可以通过调用该方法进行DDC的创建。方法定义:#
String safeMint(String to,BigInteger amount,String ddcURI);
调用者:#
核心逻辑:#
输入参数:#
字段名 | 字段 | 类型 | 必传 | 备注 |
---|
接收者账户 | to | String | 是 | |
DDC资源信息 | ddcURI | String | 是 | |
DDC数量 | amount | BigInteger | 是 | |
合约地址 | tokenTypeId | String | 是 | |
附加属性 | properties | EdnMap | 否 | |
输出参数:#
字段名 | 字段 | 类型 | 必传 | 备注 |
---|
| indexId | String | 是 | ddcId |
测试用例:#
铸造
*/
@Test
public void mint1155() throws Exception {
String to = "UUU1-consumerA_O=OPB-BeijingNode3,L=Beijing,C=CN";
String uri = "https://s-labs.cn/";
BigInteger amount = BigInteger.valueOf(10000000L);
System.out.println("铸造 : " + ddc1155Service.safeMint(to, amount, uri, null));
} @throws Exception
*/
@Test
public void mint1155Transaction() throws Exception {
//拥有者账户地址
String account = "Slabs:b6a14fcb043fbb457efdd196d71fcd6eb008ffc8_O=Slabs,L=Beijing,C=CN";
//图片地址
String ddcURI = "http://zunyilian.s-labs.cn";
//数量
BigInteger amount = BigInteger.valueOf(10000000L);
//附加属性
EdnMap properties = EdnMap.Companion.getEMPTY().assoc("颜色", "红色").assoc("气味", "无味");
SignedTransaction signedTransaction = ddc1155Service.mintTransaction(account, ddcURI, amount, ddc1155Addr, properties);
System.out.println("ddc1155 " + signedTransaction);
//解析交易hash
String txHash = ddc1155Service.getTxHash(signedTransaction);
//获取交易数据对象,得到indexId(ddcId)
Erc1155Token erc1155Token = ddc1155Service.getOutRefsOfType(signedTransaction, Erc1155Token.class);
System.out.println("交易hash:" + txHash);
System.out.println("交易数据对象:" + erc1155Token);
System.out.println("ddcId:" + erc1155Token.getIndexId());
System.out.println("合约地址:" + erc1155Token.getTokenTypeId().getId());
} 修改于 将近 3 年前