You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//args参数示例letname='TEST'letdesc='my first issuer'letargs=[name,desc]
2.2 注册资产
type:101
fee: 500*xAX
args: [symbol,desc,maximum,precsion]
名称
类型
说明
symbol
string
资产名称
desc
string
一些文字描述
maximum
string
最大发行量
precsion
number
精度
代码示例
//args参数示例letsymbol='TXC'//资产名由三个大写字母组成letdesc='my first asset'letmaximum='100000000000'letprecsion=1//取值范围是1-16之间的整数//组成argsletargs=[symbol,desc,maximum,precsion]
//args参数示例lettitle='title fo propose'// len: 10-100letdesc='some describes of this propose'lettopic='提案的类型(下面详细介绍)'letcontent='提案类型所需要的参数(下面详细介绍)'letendHeight=50000//结束高度//构造argsletargs=[title,desc,topic,content,endHeight]
对不同提案类型给出不同的参数
新增网关
//提案类型lettopic='gateway_register'//下面构造content,对于新增网关提案,需要提供提案的名称,描述,最少成员,更新间隔,资产信息等letname='aschCoin'//3-16位大小写字母数字letdesc='aschyu: test the gateway register'letminimumMembers=3//网关最少成员数,这个数值的范围应当在3-33之间的整数,letupdateInterval=8640//更新频率,这个值应当是大于8640的letsymbol='TEC'//比如发行的币叫TECletcurrencyDesc='some describes of currency'//资产描述letprecsion=1//资产精度letcurrency={symbol:symbol,
currencyDesccurrencyDesc,precsion:precsion}//下面构造这个contentletcontent={name:name,desc:desc,minimumMembers:minimumMembers,updateInterval:updateInterval,currency:currency}
//args参数示例letgateway='bitcoin'letpublicKey='c03e43c7e8aefe3b5a83e02a7b4dc8cce84bb787202650338e85d1b7758065d6'letdesc='aschyu: some describes of resgiter member'//构造argsletargs=[gateway,publicKey,desc]
ASCH 合约文档
合约使用说明
请求过程说明
通过asch-js里面封装好的transaction.createTransactionEx(params)方法获得到transaction,然后将这个transaction POST 发送到peer/transactions路由。
params是一个对象,先介绍下它的所含属性。
type: 合约编号
fee: 手续费
args: 合约所需参数
message:备注
secret: 发送者密码
secondSecret:二级密码
对于不同的合约,合约编号,手续费及合约所需要的参数是不同的。
下面列举一个转账合约的例子
以上就是调用一次合约的全部过程,其实对于不同的合约,所需要变换的变量有type,fee,args这三个属性。
下面枚举所有合约所需要的这三个属性(主要是这三个属性)
XAS的精度是小数点后八位,所以使用XAS币的时候需要乘上100000000,为了简洁,下面使用XAS的时候替换如下:
const xAS = 100000000
合约
1. 基础
1.1 转账
type:1
fee: 0.1*xAS
args: [amount,recipient]
代码示例
1.2 设置昵称
type:2
*fee: 1/10/40/80/100/200 xAX
args: [name]
这里对手续费要左下说明,对于名字越长,手续费越便宜(有上限)
len-fee关系表
代码示例
1.3 设置二级密码
type:3
fee: 0.1*xAX
args: [secondSecret]
1.4 锁仓
type:4
fee: 0.1*xAX
args: [height,amount]
代码示例
1.5 解锁仓库
type:5
fee: 0*xAX
args: []
说明:解锁仓库合约没有参数,所以args里不需要传数据
1.6 设置理事会
1.7 注册代理人
type:7
fee: 100*xAX
args: []
说明:无需传入参数
1.8 设置代理人
type:8
fee: 0.1*xAX
args: [agent]
1.9 取消代理人
1.10 注册委托人
1.11 给委托人投票
type:11
fee: 0.1*xAX
args: [delegates]
代码示例
代码举例
1.12 取消给委托人投票
type:12
fee: 0.1*xAX
args: [delegates]
代码示例
2 资产
2.1 注册发行商
type:100
fee: 100*xAX
args: [name,desc]
代码示例
2.2 注册资产
type:101
fee: 500*xAX
args: [symbol,desc,maximum,precsion]
代码示例
2.3 发行资产
type:102
fee: 0.1*xAX
args: [name,amount]
代码示例
2.4 内部转账
type:103
fee: 0.1*xAX
args: [currency,amount,recipient]
代码示例
3 DApp管理相关合约
3.1 注册dapp
type:200
fee: 100*xAX
args: [name,desc,link,icon,delegates,unlockNumber]
代码示例
3.2 置换委托人
3.3 增加委托人
3.4 删减委托人
3.5 存款
type:204
fee: 0.1*xAX
args: [chainName,currency,amount]
代码示例
3.6 提现
type:205
fee: 0.1*xAX
args: [chainName,recipient,currency,amount,oid,seq]
4 提案相关合约
4.1 发起提案
type:301
fee: 10*xAX
args: [title,desc,topic,content,endHeight]
代码示例
对不同提案类型给出不同的参数
4.2 投票
type:302
fee: 0.1*xAX
args: [pid]
代码示例
4.3 激活提案
type:303
fee: 0*xAX
args: [pid]
代码示例
5 网关相关合约
5.1 开启网关
type:400
fee: 0.1*xAX
args: [gateway]
代码示例
5.2 注册成员
type:401
fee: 100*xAX
args: [pid]
代码示例
5.3 存款
type:402
fee: 0.01*xAX
args: [gateway,address,currency,amount,oid]
代码示例
5.4 提现
type:403
fee: 0*xAX
args: [pid]
代码示例
5.5 提交提现交易
type:404
fee: 0.01*xAX
args: [wid,ot,ots]
代码示例
5.6 提交交易签名
type:405
fee: 0.01*xAX
args: [wid,signature]
代码示例
5.7 提交交易协议
type:406
fee: 0.01*xAX
args: [wid,oid]
6 理事会合约
6.1 投票
type:500
fee: 0*xAX
args: [targetId]
代码示例
6.2 激活
type:501
fee: 0*xAX
args: [targetId]
代码示例
6.3 增加成员
type:502
fee: 1*xAX
args: [address,weight,m]
代码示例
6.4 移除成员
type:503
fee: 1*xAX
args: [address,m]
代码示例
6.5 置换成员
type:504
fee: 1*xAX
args: [form,to,weight,m]
The text was updated successfully, but these errors were encountered: