Skip to content

Commit

Permalink
πŸ‘¨β€πŸš€πŸš€ Release 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ricricucit authored Nov 28, 2018
2 parents 503df7f + 9014314 commit eb42b54
Show file tree
Hide file tree
Showing 28 changed files with 542 additions and 153 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
TAG=v0.25.0
TAG=v1.0.0
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@
All notable changes to this project will be documented in this file. This change
log follows the conventions of [keepachangelog.com](http://keepachangelog.com/).

## [1.0.0]
### Added
- Contract native Transactions

### Changed
- Rolled back to bignumbers.js for easier fix with axios.get/post

### Removed
- Support for Epoch < 1.0.0

### Breaking Changes
- New NETWORK_ID (also used in docker/sdk.env for CI tests)
- Encoding of transaction (and other objects) [changed from base58check to base64check](https://github.com/aeternity/protocol/blob/epoch-v1.0.0/epoch/api/api_encoding.md)

### Notes and known Issues
- State Channels have been excluded for problems with CI, will be included in next release


## [0.25.0-0.1.1]
### Added
- see [0.25.0-0.1.0]
Expand Down Expand Up @@ -218,3 +236,4 @@ log follows the conventions of [keepachangelog.com](http://keepachangelog.com/).
[0.25.0-0.1.0-next]: https://github.com/aeternity/aepp-sdk-js/compare/v0.24.0-0.2.0...v0.25.0-0.1.0-next
[0.25.0-0.1.0]: https://github.com/aeternity/aepp-sdk-js/compare/v0.25.0-0.1.0-next...v0.25.0-0.1.0
[0.25.0-0.1.1]: https://github.com/aeternity/aepp-sdk-js/compare/v0.25.0-0.1.0...v0.25.0-0.1.1
[1.0.0]: https://github.com/aeternity/aepp-sdk-js/compare/v0.25.0-0.1.0...1.0.0
22 changes: 17 additions & 5 deletions docker/epoch_node_mean16.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
---
peers:
- aenode://pp_28uQUgsPcsy7TQwnRxhF8GMKU4ykFLKsgf4TwDwPMNaSCXwWV8@node2:3015
peers: []
# - aenode://pp_HdcpgTX2C1aZ5sjGGysFEuup67K9XiFsWqSPJs4RahEcSyF7X@sync.sdk-testnet.aepps.com:3015
# - aenode://pp_HdcpgTX2C1aZ5sjGGysFEuup67K9XiFsWqSPJs4RahEcSyF7X@localhost:3016
#- aenode://pp_HdcpgTX2C1aZ5sjGGysFEuup67K9XiFsWqSPJs4RahEcSyF7X@af5621d1de36f11e8bb0b1215f72bd59-742041481.us-east-1.elb.amazonaws.com:3015

http:
external:
port: 3013
internal:
port: 3113
listen_address: 0.0.0.0
endpoints:
debug: true
debug: true


websocket:
channel:
Expand All @@ -22,9 +29,14 @@ chain:

mining:
autostart: true
beneficiary: "ak_25MZX3BXYP32YDPGWsJqYZ6CgWnqD93VdpCYaTk6KsThEbeFJX"
beneficiary: "ak_2iBPH7HUz3cSDVEUWiHg76MZJ6tZooVNBmmxcgVK6VV8KAE688"
expected_mine_rate: 4000
micro_block_cycle: 1000
cuckoo:
miner:
executable: mean16s-generic
executable: mean15-generic
extra_args: ""
node_bits: 16
edge_bits: 15

fork_management:
network_id: "ae_devnet"
1 change: 1 addition & 0 deletions docker/sdk.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
TEST_NODE=node:3013
TEST_URL=http://node:3013
TEST_INTERNAL_URL=http://node:3113
TEST_NETWORK_ID=ae_devnet

23 changes: 14 additions & 9 deletions docs/api/tx/js.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,28 @@
## @aeternity/aepp-sdk/es/tx/js
Js Tx module

**Export**: JsTx
**Example**
**Export**: JsTx
**Example**
```js
import JsTx from '@aeternity/aepp-sdk/es/tx/js'
```
<a id="exp_module_@aeternity/aepp-sdk/es/tx/js--JsTx"></a>
### JsTx([options]) β‡’ `Object` ⏏
<a id="exp_module_@aeternity/aepp-sdk/es/tx/js--base64Types"></a>

### base64Types([options]) β‡’ `Object` ⏏
JavaScript-based Tx Stamp
This incomplete implementation of [Tx](#exp_module_@aeternity/aepp-sdk/es/tx--Tx)

This incomplete implementation of [Tx](#exp_module_@aeternity/aepp-sdk/es/tx--Tx)
will eventually provide native code to produce transactions from scratch.
**Kind**: Exported function
**Returns**: `Object` - Tx instance

**Kind**: Exported function
**Returns**: `Object` - Tx instance
**rtype**: `Stamp`
| Param | Type | Default | Description |

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [options] | `Object` | <code>{}</code> | Initializer object |
**Example**

**Example**
```js
JsTx()
```
28 changes: 28 additions & 0 deletions docs/api/utils/crypto.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import * as Crypto from '@aeternity/aepp-sdk/es/utils/crypto'
* [.nameId(input)](#module_@aeternity/aepp-sdk/es/utils/crypto.nameId) β‡’ `String`
* [.sha256hash(input)](#module_@aeternity/aepp-sdk/es/utils/crypto.sha256hash) β‡’ `String`
* [.salt()](#module_@aeternity/aepp-sdk/es/utils/crypto.salt) β‡’ `Number`
* [.encodeBase64Check(input)](#module_@aeternity/aepp-sdk/es/utils/crypto.encodeBase64Check) β‡’ `Buffer`
* [.decodeBase64Check(str)](#module_@aeternity/aepp-sdk/es/utils/crypto.decodeBase64Check) β‡’ `Buffer`
* [.encodeBase58Check(input)](#module_@aeternity/aepp-sdk/es/utils/crypto.encodeBase58Check) β‡’ `Buffer`
* [.decodeBase58Check(str)](#module_@aeternity/aepp-sdk/es/utils/crypto.decodeBase58Check) β‡’ `Buffer`
* [.hexStringToByte(str)](#module_@aeternity/aepp-sdk/es/utils/crypto.hexStringToByte) β‡’ `Uint8Array`
Expand Down Expand Up @@ -101,6 +103,32 @@ Generate a random salt (positive integer)
**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto)
**Returns**: `Number` - random salt
**rtype**: `() => salt: Number`
<a id="module_@aeternity/aepp-sdk/es/utils/crypto.encodeBase64Check"></a>

### @aeternity/aepp-sdk/es/utils/crypto.encodeBase64Check(input) β‡’ `Buffer`
Base64 encode given `input`

**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto)
**Returns**: `Buffer` - Base64 encoded data
**rtype**: `(input: String|buffer) => Buffer`

| Param | Type | Description |
| --- | --- | --- |
| input | `String` | Data to encode |

<a id="module_@aeternity/aepp-sdk/es/utils/crypto.decodeBase64Check"></a>

### @aeternity/aepp-sdk/es/utils/crypto.decodeBase64Check(str) β‡’ `Buffer`
Base64 decode given `str`

**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto)
**Returns**: `Buffer` - Base64 decoded data
**rtype**: `(str: String) => Buffer`

| Param | Type | Description |
| --- | --- | --- |
| str | `String` | Data to decode |

<a id="module_@aeternity/aepp-sdk/es/utils/crypto.encodeBase58Check"></a>

### @aeternity/aepp-sdk/es/utils/crypto.encodeBase58Check(input) β‡’ `Buffer`
Expand Down
6 changes: 3 additions & 3 deletions docs/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ As aepp-sdk follows the [git-flow strategy] for develoment, the release process
is modelled after that strategy accordingly, with a few additions.

Branch out from `develop` to a dedicated release branch denoting the target
version number, e.g. `release/v0.20.0-0.1.0` for a hypothetical first release
version number, e.g. `release/0.20.0-0.1.0` for a hypothetical first release
targeting Epoch 0.20.0.

[git-flow strategy]: https://danielkummer.github.io/git-flow-cheatsheet/
Expand Down Expand Up @@ -91,8 +91,8 @@ At this point, the release should already be in npmjs.com. The final step is to
also tag the release on GitHub and push the tag, *which requires direct write
access*.

1. `git tag v$VERSION`
2. `git push tag v$VERSION`
1. `git tag $VERSION`
2. `git push tag $VERSION`

> Recommendation: Use signed tags using the -s option to increase community's
> trust in the project!
Expand Down
2 changes: 1 addition & 1 deletion es/account/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import * as Crypto from '../utils/crypto'
* @return {String} Signed transaction
*/
async function signTransaction (tx) {
const binaryTx = Crypto.decodeBase58Check(Crypto.assertedType(tx, 'tx'))
const binaryTx = Crypto.decodeBase64Check(Crypto.assertedType(tx, 'tx'))
// Prepend `NETWORK_ID` to begin of data binary
const txWithNetworkId = Buffer.concat([Buffer.from(this.networkId), binaryTx])

Expand Down
2 changes: 1 addition & 1 deletion es/ae/aens.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ const Aens = Ae.compose({
},
deepProps: { Ae: { defaults: {
clientTtl: 1,
nameTtl: 50000 // aec_governance:name_claim_max_expiration() => 50000
nameTtl: 10000 // aec_governance:name_claim_max_expiration() => 50000
} } }
})

Expand Down
11 changes: 5 additions & 6 deletions es/ae/contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,10 @@ async function call (code, abi, address, name, { args = '()', options = {}, call
opt.gas = this.Ae.defaults.gas
}

const tx = await this.contractCallComputeTx(R.merge(opt, {
call,
fn: name,
args,
const tx = await this.contractCallTx(R.merge(opt, {
callerId: await this.address(),
contractId: address,
callerId: await this.address()
callData: await this.contractEncodeCall(code, abi, name, args, call)
}))

const { hash } = await this.send(tx, opt)
Expand Down Expand Up @@ -99,6 +97,7 @@ async function deploy (code, abi, { initState = '()', options = {} } = {}) {
transaction: hash,
address: contractId,
call: async (name, options) => this.contractCall(code, abi, contractId, name, options),
callStatic: async (name, options) => this.contractCallStatic(contractId, 'sophia-address', name, options),
createdAt: new Date()
})
}
Expand All @@ -108,7 +107,7 @@ async function compile (code, options = {}) {

return Object.freeze(Object.assign({
encodeCall: async (name, args, { call, abi }) => this.contractEncodeCall(o.bytecode, R.defaultTo('sophia', abi), name, args, call),
call: async (name, options = {}) => this.contractCallStatic(o.bytecode, R.defaultTo('sophia', options.abi), name, options),
// call: async (name, options = {}) => this.contractCallStatic(o.bytecode, R.defaultTo('sophia', options.abi), name, options),
deploy: async (options = {}) => this.contractDeploy(o.bytecode, R.defaultTo('sophia', options.abi), options)
}, o))
}
Expand Down
1 change: 0 additions & 1 deletion es/ae/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ const Ae = stampit(Tx, Account, Chain, Contract, {
methods: { send, spend },
deepProperties: { Ae: { defaults: {
ttl: 500,
fee: 1,
payload: ''
} } }
})
Expand Down
3 changes: 1 addition & 2 deletions es/chain/epoch.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import * as R from 'ramda'
import Chain from './'
import Epoch from '../epoch'
import { parseBigNumber } from '../utils/bignumber'

async function sendTransaction (tx, options = {}) {
const { waitMined } = R.merge(this.Chain.defaults, options)
Expand All @@ -26,7 +25,7 @@ async function sendTransaction (tx, options = {}) {
}

async function balance (address, { height, hash } = {}) {
return parseBigNumber((await this.api.getAccountByPubkey(address, { height, hash })).balance)
return (await this.api.getAccountByPubkey(address, { height, hash })).balance.toString()
}

async function tx (hash) {
Expand Down
29 changes: 24 additions & 5 deletions es/contract/epoch.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,22 @@ import Epoch from '../epoch'

const TYPE_CHECKED_ABI = ['sophia', 'sophia-address']

async function contractEpochEncodeCallData (code, abi, name, arg, call) {
async function contractEpochEncodeCallData (codeOrAddress, abi, name, arg, call) {
// Get contract bytecode from epoch if we want to get callData using { abi: 'sophia-address', code: 'contract address' }
let code = codeOrAddress
if (abi === 'sophia-address' && codeOrAddress.slice(0, 2) === 'ct') {
code = (await this.getContractByteCode(code)).bytecode
abi = 'sophia'
}
// If we pass `call` argument we use type-checked call
if (call && TYPE_CHECKED_ABI.includes(abi)) return (await this.api.encodeCalldata({ abi, code, call })).calldata

return (await this.api.encodeCalldata({ abi, code, 'function': name, arg })).calldata
}

async function contractEpochCall (code, abi, name, arg = '()', call) {
if (call && TYPE_CHECKED_ABI.includes(abi)) return this.api.callContract({ abi, code, call })
return this.api.callContract({ abi, code, 'function': name, arg })
async function contractEpochCall (address, abi = 'sophia-address', name, arg = '()', call) {
if (call && TYPE_CHECKED_ABI.includes(abi)) return this.api.callContract({ abi, code: address, call })
return this.api.callContract({ abi, code: address, 'function': name, arg })
}

async function contractEpochDecodeData (type, data) {
Expand All @@ -48,12 +56,23 @@ async function compileEpochContract (code, options = {}) {
return this.api.compileContract(R.mergeAll([this.Ae.defaults, options, { code }]))
}

/**
* Get bytecode by contract public key
*
* @param {string} contractId
* @return {number} Contract byte code
*/
async function getContractByteCode (contractId) {
return this.api.getContractCode(contractId)
}

const EpochContract = ContractBase.compose(Epoch, {
methods: {
contractEpochEncodeCallData,
contractEpochCall,
contractEpochDecodeData,
compileEpochContract
compileEpochContract,
getContractByteCode
}
})

Expand Down
2 changes: 1 addition & 1 deletion es/epoch.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,6 @@ const Epoch = stampit({
})

// Array with compatible epoch node versions
export const COMPATIBILITY = ['0.25.0']
export const COMPATIBILITY = ['1.0.0']

export default Epoch
Loading

0 comments on commit eb42b54

Please sign in to comment.