# aaajs

> General purpose library for the AAA blockchain.

Latest version **1.2.0** (published 2018-10-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install aaajs
pnpm add aaajs
yarn add aaajs
bun add aaajs
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2018-10-26 |
| First published | 2018-09-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 2.1 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1423 |
| Maintainers | aaachain |
| Keywords | EOS, Blockchain |

## Links

- npm: https://www.npmjs.com/package/aaajs
- Repository: https://github.com/EOSIO/eosjs
- Homepage: https://github.com/EOSIO/eosjs#readme
- Issues: https://github.com/EOSIO/eosjs/issues
- npm.io page: https://npm.io/package/aaajs

## Dependencies (6)

- [binaryen](https://npm.io/package/binaryen.md) ^37.0.0
- [fcbuffer](https://npm.io/package/fcbuffer.md) 2.2.1
- [eosjs-api](https://npm.io/package/eosjs-api.md) 7.0.4
- [eosjs-ecc](https://npm.io/package/eosjs-ecc.md) 4.0.4
- [create-hash](https://npm.io/package/create-hash.md) ^1.1.3
- [babel-runtime](https://npm.io/package/babel-runtime.md) 6.26.0

## Recent versions

- 1.2.0 (latest) — 2018-10-26
- 1.1.0 — 2018-10-11
- 1.0.1 — 2018-09-21
- 1.0.0 — 2018-09-21

## README

# AAAJS

General purpose library for AAA blockchains.

注：aaajs这个库fork自eosjs，并在其基础上增加了三个函数以提供一个支付系统。

### Usage

* Install with: `npm install aaajs`

### 实例

```js
AAA = require('aaajs')

config = {
  keyProvider: ['yourPrivateKey'], // WIF string or array of keys..
  keyPrefix: 'AAA',
  chainId: '1c6ae7719a2a3b4ecb19584a30ff510ba1b6ded86e1fd8b8fc22f1179c622a32',
  httpEndpoint: 'http://47.98.107.96:10180',
  expireInSeconds: 60
}

aaa = AAA(config)

const buyer = 'buyer1';    // 请修改为链上真实存在的账号名
const seller = 'seller1';    // 请修改为链上真实存在的账号名
const price = '2.0000 AAA'
const id = Math.floor(Math.random() * Math.floor(Number.MAX_SAFE_INTEGER)); // 随机Id

// 授权合约从买家帐号扣款（仅需授权一次）
aaa.authPermission(buyer).
  then(value => {console.log('authPermission OK. txid: ' + value.transaction_id)}).
  catch(e => {console.log("authPermission failed: " + e)});

// 买家预付款
aaa.payForGood(id, buyer, seller, price).
  then(value => {console.log('payForGood OK. txid: ' + value.transaction_id)}).
  catch(e => {console.log("payForGood failed: " + e)});

// 买家确认付款
aaa.confirmPayment(buyer, id).
  then(value => {console.log('confirmPayment OK. txid: ' + value.transaction_id)}).
  catch(e => {console.log("confirmPayment failed: " + e)});

```

---
_Source: https://npm.io/package/aaajs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
