Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into simplify-get-acl-wi…
Browse files Browse the repository at this point in the history
…th-cache

* origin/master: (29 commits)
  Update README.md (aragon#291)
  Wrapper: clarify comments about forwarding path finding strategy (aragon#289)
  Split quick start doc from intro (aragon#287)
  @aragon/wrapper 5.0.0-rc.2
  wrapper: prettify setApp() descriptions (aragon#284)
  wrapper: fix callsscripts decoding (aragon#283)
  Wrapper: add installedRepos observable (aragon#268)
  fix: avoid infinitely looping through forwarders when looking for a transaction path (aragon#285)
  wrapper: enforce message to sign is string (aragon#282)
  api: v1.1.0
  rpc-messenger: v1.1.0
  feat: @aragon/wrapper api cleanup (aragon#279)
  Wrapper: handle SetApp for updated apps (aragon#267)
  feat: Add message signing (aragon#276)
  Wrapper: don't assign initializationBlock on non-kernel proxies when unneeded (aragon#266)
  chore: ignore package-lock.jsons (aragon#280)
  API: propagate errors to single-response APIs (aragon#277)
  Rpc Messenger: dedupe message bus across requests (aragon#278)
  Fix: changes after review (aragon#274)
  Docs update: include react api, aragon app architecture & fixes (aragon#271)
  ...
  • Loading branch information
2color committed Apr 26, 2019
2 parents 52dcc8b + 922d8bf commit 7e29de7
Show file tree
Hide file tree
Showing 45 changed files with 3,078 additions and 438 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
# Dependencies
node_modules

# Ignore lock files
package-lock.json
yarn.lock

# Artifacts
dist

Expand Down
6 changes: 6 additions & 0 deletions .size-limit.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,11 @@ module.exports = [
name: '@aragon/wrapper',
path: "packages/aragon-wrapper/dist/index.js",
limit: "850 KB"
},
{
name: '@aragon/api-react',
path: "packages/aragon-api-react/dist/index.js",
limit: "5 KB",
webpack: false,
}
]
27 changes: 21 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@

<div align="center">
<h4>
<a href="https://aragon.org">
Website
</a>
<span> | </span>
<a href="https://hack.aragon.org/docs/aragonjs-intro.html">
<a href="https://hack.aragon.org/docs/api-intro.html">
Documentation
</a>
<span> | </span>
Expand All @@ -43,7 +39,7 @@
</h4>
</div>

# aragon.js Basic Overview
## Overview

The layer between [aragonOS](https://github.com/aragon/aragonOS), [Aragon](https://github.com/aragon/aragon) and the [Aragon Apps](https://github.com/aragon/aragon-apps). Use it to build your own Aragon app.

Expand Down Expand Up @@ -71,6 +67,25 @@ The layer between [aragonOS](https://github.com/aragon/aragonOS), [Aragon](https
</a>
</td>
</tr>
<tr>
<td>
@aragon/api-react
</td>
<td>
<!-- NPM version -->
<a href="https://npmjs.org/package/@aragon/api-react">
<img src="https://img.shields.io/npm/v/@aragon/api-react.svg?style=flat-square"
alt="NPM version" />
</a>
</td>
<td>
<!-- Downloads -->
<a href="https://npmjs.org/package/@aragon/api-react">
<img src="https://img.shields.io/npm/dm/@aragon/api-react.svg?style=flat-square"
alt="Downloads" />
</a>
</td>
</tr>
<tr>
<td>
@aragon/rpc-messenger
Expand Down
100 changes: 74 additions & 26 deletions docs/APP.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# App
# aragonAPI for Apps

## Install

Expand Down Expand Up @@ -46,10 +46,12 @@ For example, to execute the `increment` function in your app's smart contract:
const app = new AragonApp()

// Sends an intent to the wrapper that we wish to invoke `increment` on our app's smart contract
app.increment(1).subscribe(
(txHash) => console.log(`Success! Incremented in tx ${txHash}`),
(err) => console.log(`Could not increment: ${err}`)
)
app
.increment(1)
.subscribe(
txHash => console.log(`Success! Incremented in tx ${txHash}`),
err => console.log(`Could not increment: ${err}`)
)
```

The intent function returns an [RxJS observable](http://reactivex.io/rxjs/class/es6/Observable.js~Observable.html) that emits the hash of the transaction that was sent.
Expand All @@ -73,12 +75,12 @@ app.deposit(tokenAddress, amount, reference, intentParams)

Some caveats to customizing transaction parameters:

- `from`, `to`, `data`: will be ignored as aragon.js will calculate those.
- `gas`: If the intent cannot be performed directly (needs to be forwarded), the gas amount will be interpreted as the minimum amount of gas to send in the transaction. Because forwarding performs a heavier transaction gas-wise, if the gas estimation done by aragon.js results in more gas than provided in the parameter, the estimated gas will prevail.
- `from`, `to`, `data`: will be ignored as aragon.js will calculate those.
- `gas`: If the intent cannot be performed directly (needs to be forwarded), the gas amount will be interpreted as the minimum amount of gas to send in the transaction. Because forwarding performs a heavier transaction gas-wise, if the gas estimation done by aragon.js results in more gas than provided in the parameter, the estimated gas will prevail.

### Parameters

- `provider` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A provider used to send and receive messages to and from the wrapper. See [providers](/docs/PROVIDERS.md). (optional, default `MessagePortMessage`)
- `provider` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A provider used to send and receive messages to and from the wrapper. See [providers](/docs/PROVIDERS.md). (optional, default `MessagePortMessage`)

### Examples

Expand All @@ -89,9 +91,7 @@ import AragonApp, { providers } from '@aragon/api'
const backgroundScriptOfApp = new AragonApp()

// The WindowMessage provider should be used for front-ends
const frontendOfApp = new AragonApp(
new providers.WindowMessage(window.parent)
)
const frontendOfApp = new AragonApp(new providers.WindowMessage(window.parent))
```

### accounts
Expand All @@ -118,7 +118,7 @@ the type of content that a TCR is curating, the name of a group etc.

#### Parameters

- `identifier` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The identifier of the app.
- `identifier` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The identifier of the app.

#### Examples

Expand All @@ -130,6 +130,27 @@ app.identify('Employee counter')

Returns **void**

### resolveAddressIdentity

Resolve an address' identity, using the highest priority provider.

#### Parameters

- `address` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Address to resolve.

Returns a single-emission observable that emits the resolved identity or null if not found

### requestAddressIdentityModification

Request an address' identity be modified with the highest priority provider.
The request is typically handled by the aragon client.

#### Parameters

- `address` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Address to modify.

Returns a single-emission observable that emits if the modification succeeded or was cancelled by the user.

### events

Listens for events on your app's smart contract from the last unhandled block.
Expand All @@ -142,8 +163,8 @@ Creates a handle to interact with an external contract (i.e. a contract that is

#### Parameters

- `address` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The address of the external contract
- `jsonInterface` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>** The [JSON interface](https://web3js.readthedocs.io/en/1.0/glossary.html#glossary-json-interface) of the external contract.
- `address` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The address of the external contract
- `jsonInterface` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>** The [JSON interface](https://web3js.readthedocs.io/en/1.0/glossary.html#glossary-json-interface) of the external contract.

#### Examples

Expand All @@ -154,7 +175,9 @@ const token = app.external(tokenAddress, tokenJsonInterface)
token.symbol().subscribe(symbol => console.log(`The token symbol is ${symbol}`))

// Retrieve the token balance of an account
token.balanceOf(someAccountAddress).subscribe(balance => console.log(`The balance of the account is ${balance}`))
token
.balanceOf(someAccountAddress)
.subscribe(balance => console.log(`The balance of the account is ${balance}`))
```

Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** An external smart contract handle. Calling any function on this object will send a call to the smart contract and return an [RxJS observable](http://reactivex.io/rxjs/class/es6/Observable.js~Observable.html) that emits the value of the call.
Expand All @@ -165,8 +188,8 @@ Set a value in the application cache.

#### Parameters

- `key` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The cache key to set a value for
- `value` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The value to persist in the cache
- `key` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The cache key to set a value for
- `value` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The value to persist in the cache

Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** This method passes through `value`

Expand All @@ -192,8 +215,8 @@ Optionally takes an array of other `Observable`s to merge with this app's events

#### Parameters

- `reducer` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that reduces events to a state. This can return a Promise that resolves to a new state.
- `events` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;Observable>?** An optional array of `Observable`s to merge in with the internal events observable (optional, default `[empty()]`)
- `reducer` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that reduces events to a state. This can return a Promise that resolves to a new state.
- `events` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;Observable>?** An optional array of `Observable`s to merge in with the internal events observable (optional, default `[empty()]`)

#### Examples

Expand Down Expand Up @@ -239,11 +262,36 @@ Perform a read-only call on the app's smart contract.

#### Parameters

- `method` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The name of the method to call.
- `params` **...any** An optional variadic number of parameters. The last parameter can be the call options (optional). See the [web3.js doc](https://web3js.readthedocs.io/en/1.0/web3-eth-contract.html#id16) for more details.
- `method` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The name of the method to call.
- `params` **...any** An optional variadic number of parameters. The last parameter can be the call options (optional). See the [web3.js doc](https://web3js.readthedocs.io/en/1.0/web3-eth-contract.html#id16) for more details.

Returns **Observable** An [RxJS observable](http://reactivex.io/rxjs/class/es6/Observable.js~Observable.html) that emits the result of the call.

### requestSignMessage

Perform a signature using the [personal_sign](https://web3js.readthedocs.io/en/1.0/web3-eth-personal.html#sign) method.

#### Parameters

- `message` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The message to sign.

Returns **Observable** An [RxJS observable](http://reactivex.io/rxjs/class/es6/Observable.js~Observable.html) that emits the result of the signature.

#### Examples

```javascript
app
.requestSignMessage('messageToSign')
.subscribe(
signature => {
// use signature hash
},
err => {
// handle error (including the user denying the signature request)
}
)
```

### notify

**NOTE: This call is not currently handled by the wrapper**
Expand All @@ -252,10 +300,10 @@ Send a notification.

#### Parameters

- `title` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The title of the notification.
- `body` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The body of the notification.
- `context` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** An optional context that will be sent back to the app if the notification is clicked. (optional, default `{}`)
- `date` **[Date](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date)** An optional date that specifies when the notification originally occured. (optional, default `newDate()`)
- `title` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The title of the notification.
- `body` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The body of the notification.
- `context` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** An optional context that will be sent back to the app if the notification is clicked. (optional, default `{}`)
- `date` **[Date](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date)** An optional date that specifies when the notification originally occured. (optional, default `newDate()`)

Returns **void**

Expand All @@ -279,6 +327,6 @@ Decodes an EVM callscript and tries to describe the transaction path that the sc

#### Parameters

- `script` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The EVM callscript to describe
- `script` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The EVM callscript to describe

Returns **Observable** An [RxJS observable](http://reactivex.io/rxjs/class/es6/Observable.js~Observable.html) that emits the described transaction path. The emitted transaction path is an array of objects, where each item has a `destination`, `data` and `description` key.
Loading

0 comments on commit 7e29de7

Please sign in to comment.