[关闭]
@sqfasd 2017-01-16T13:37:49.000000Z 字数 4491 阅读 1606

asch uia 前端接口整理

未分类


1 获取全网所有发行商

get /uia/issuers?offset=0&limit=1

  1. {
  2. "success": true,
  3. "issuers": [
  4. {
  5. "name": "issuername",
  6. "desc": "issuer1_desc",
  7. "issuerId": "14762548536863074694"
  8. }
  9. "count": 9
  10. }

2 查询一个发行商

get /uia/issuers/:name

其中name可以为发行商名称或账户地址

  1. {
  2. "success": true,
  3. "issuer": {
  4. "name": "eiSHesctQCbXA",
  5. "desc": "valid desc",
  6. "issuerId": "2592056580277537382"
  7. }
  8. }

3 获取全网所有资产

get /uia/assets?offset=0&limit=1

  1. {
  2. "success": true,
  3. "assets": [
  4. {
  5. "name": "issuername.BTC", // 资产名称
  6. "desc": "asset1_desc", // 资产简介
  7. "maximum": "10000000000000", // 发行上限
  8. "precision": 6, // 精度,表示小数点后有几位数字
  9. "strategy": "", // 发行策略
  10. "quantity": "10000000000", // 现存总量
  11. "height": 4, // 发行交易所在区块高度
  12. "issuerId": "14762548536863074694", // 发行商账户地址
  13. "acl": 1, // 1表示白名单,0表示黑名单
  14. "writeoff": 0 //是否注销
  15. }
  16. ],
  17. "count": 9

4 获取某个发行商注册的资产

get /uia/issuers/:name/assets?offset=0&limit=1

  1. {
  2. "success": true,
  3. "assets": [
  4. {
  5. "name": "eiSHesctQCbXA.RUBY",
  6. "desc": "valid desc",
  7. "maximum": "10000",
  8. "precision": 1,
  9. "strategy": "quantity <= maximum / 10 * (height - genesisHeight)",
  10. "quantity": "3000",
  11. "height": 25,
  12. "issuerId": "2592056580277537382",
  13. "acl": 0,
  14. "writeoff": 0
  15. }
  16. ],
  17. "count": 1
  18. }

5 获取某个资产

get /uia/assets/:name

  1. {
  2. "success": true,
  3. "asset": {
  4. "name": "eiSHesctQCbXA.RUBY",
  5. "desc": "valid desc",
  6. "maximum": "10000",
  7. "precision": 1,
  8. "strategy": "quantity <= maximum / 10 * (height - genesisHeight)",
  9. "quantity": "3000",
  10. "height": 25,
  11. "issuerId": "2592056580277537382",
  12. "acl": 0,
  13. "writeoff": 0
  14. }
  15. }

6 获取资产访问控制列表

get /uia/assets/:name/acl/:flag?offset=0&limit=1

flag可选值为0和1, 0表示黑名单,1表示白名单

  1. {
  2. "success": true,
  3. "list": [
  4. {
  5. "address": "2592056580277537382"
  6. }
  7. ],
  8. "count": 1
  9. }

7 获取资产余额

get /uia/balances/:address?offset=0&limit=1

address 表示账户地址

  1. {
  2. "success": true,
  3. "balances": [
  4. {
  5. "currency": "issuername.BTC",
  6. "balance": "9999999970",
  7. "maximum": "10000000000000",
  8. "precision": 6,
  9. "quantity": "10000000000",
  10. "writeoff": 0
  11. }
  12. ],
  13. "count": 1
  14. }

8 获取资产活动记录

get /uia/transactions?ownerPublicKey=8065a105c785a08757727fded3a06f8f312e73ad40f1f3502e0232ea42e67efd&offset=0&limit=1

  1. {
  2. "success": true,
  3. "transactions": [
  4. {
  5. "id": "260434858608363290",
  6. "height": "3",
  7. "blockId": "8276663638992099850",
  8. "type": 9,
  9. "timestamp": 16361139,
  10. "senderPublicKey": "8065a105c785a08757727fded3a06f8f312e73ad40f1f3502e0232ea42e67efd",
  11. "senderId": "14762548536863074694",
  12. "recipientId": "",
  13. "amount": 0,
  14. "fee": 10000000,
  15. "signature": "db3f1e968ce26e59e89b20591d764ee87b056a6fa78ebb7fa2af074951cd4ebb380d9f4d4cfe0d451ae64c66fa9c8228b332b5fca517a5e592ccdd436e21e50b",
  16. "signSignature": "",
  17. "signatures": null,
  18. "confirmations": "391",
  19. "asset": {
  20. "issuer": {
  21. "transactionId": "260434858608363290",
  22. "name": "issuername",
  23. "desc": "issuer1_desc"
  24. }
  25. },
  26. "t_id": "260434858608363290"
  27. }
  28. ],
  29. "count": 8
  30. }

注意这里asset与type相关,9 <= type <= 14, 根据不同的type从asset中取出不同的值

type=9

  1. "asset": {
  2. "uiaIssuer": {
  3. "transactionId": "260434858608363290",
  4. "name": "issuername",
  5. "desc": "issuer1_desc"
  6. }
  7. },

展示: 注册了发行商 $name

type=10

  1. "asset": {
  2. "uiaAsset": {
  3. "transactionId": "11613326283813789432",
  4. "name": "issuername.BTC",
  5. "desc": "asset1_desc",
  6. "maximum": "10000000000000",
  7. "precision": "6",
  8. "strategy": ""
  9. }
  10. },

展示: 注册了资产 $name

type=11

  1. "asset": {
  2. "uiaFlags": {
  3. "transactionId": "14649028077581400942",
  4. "currency": "issuername.BTC",
  5. "flagType": "1",
  6. "flag": "1"
  7. }
  8. },

展示:
如果flagType==1 : 资产访currency 被注销

type=12

  1. "asset": {
  2. "uiaAcl": {
  3. "transactionId": "16597707943986371131",
  4. "currency": "issuername.BTC",
  5. "operator": "+",
  6. "flag": "1",
  7. "list": [
  8. "196751217687897827",
  9. "11053997261735317227"
  10. ]
  11. }
  12. },

展示:资产$currency 更新了访问控制列表

type=13

  1. "asset": {
  2. "uiaIssue": {
  3. "transactionId": "10646196155790595088",
  4. "currency": "issuername.BTC",
  5. "amount": "10000000000"
  6. }
  7. },

展示: 资产amount

type=14

  1. "asset": {
  2. "uiaTransfer": {
  3. "transactionId": "9105235822289198060",
  4. "currency": "issuername.BTC",
  5. "amount": "10"
  6. }
  7. },

展示:资产amount 到recipientId

9 创建UIA交易

9.1 注册发行商

  1. var name = '发行商名称'
  2. var desc = '发行商描述'
  3. var trs = AschJS.uia.createIssuer(name, desc, secret, secondSecret)

9.2 注册资产

  1. var name = '资产名'
  2. var desc = '资产描述'
  3. var maximum = '1000000'
  4. var precision = 3
  5. var strategy = ''
  6. var trs = AschJS.uia.createAsset(name, desc, maximum , precision, strategy, secret, secondSecret)

9.3 设置acl模式

  1. var currency = '资产名'
  2. var flagType = 1
  3. var flag = 0 // 0为黑名单, 1为白名单
  4. var trs = AschJS.uia.createFlags(currency, flagType, flag, secret, secondSecret)

9.4 注销资产

  1. var currency = '资产名'
  2. var flagType = 2
  3. var flag =1
  4. var trs = AschJS.uia.createFlags(currency, flagType, flag, secret, secondSecret)

9.5 更新acl(访问控制列表)

  1. var currency = '资产名'
  2. var operator = '+' // '+'表示增加, ‘-’表示删除
  3. var flag =0 // 0表示黑名单, 1表示白名单
  4. var list = [
  5. '14762548536863074694'
  6. ]
  7. var trs = AschJS.uia.createAcl(currency, operator, flag, list, secret, secondSecret)

9.6 发行资产

  1. var currency = '资产名'
  2. var amount = '100000'
  3. var trs = AschJS.uia.createIssue(currency, amount, secret, secondSecret)

9.7 转移资产

  1. var currency = '资产名'
  2. var amount = '100000'
  3. var recipientId = '14762548536863074694'
  4. var trs = AschJS.uia.createTransfer(currency, amount, recipientId, secret, secondSecret)
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注