时光链.事务库(已废弃):供前后端调用,前端用来创建并签名事务,后台用来验证、准备、执行事务。
.gitignore | ||
Action.js | ||
ActionLockProof.js | ||
ActionMultisig.js | ||
ActionRegisterChain.js | ||
ActionStore.js | ||
ActionTac.js | ||
ActionTransfer.js | ||
index.js | ||
package.json | ||
README.md |
tic.action
时光链事务库:前后端通用的事务库。前端用来生成用户指定的事务并签名,后台用来验证、准备、执行用户提交的事务。
Table of Contents
1. Installation Guide
在前后端软件的 package.json 的依赖清单中引入本库:
npm install git+https://git.faronear.org/tic/tic.action#latest_stable --save
2. Usage
首先在前端JS里创建事务:
let ActTransfer=require('tic.action/ActTransfer') // 引用
let action=new ActTransfer({ amount: 金额, toAddress: 对方地址}) // 组装事务对象
action.packMe(keypair) // 用当前用户的公私钥,对该事务进行签名
然后把事务发送到时光链,例如通过 jQuery:
$.post(
'https://test.bittic.net/api/Action/prepare',
{ Action:action },
'json'
)