Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
179 lines (110 sloc) 7.12 KB
id title sidebar_label hide_title
aragonjs-ref-wrapper
aragonAPI - Wrapper
Wrapper
true

Wrapper

Install

npm install --save @aragon/wrapper

Import

ES6

import AragonWrapper, { providers } from '@aragon/wrapper'

ES5 (CommonJS)

const AragonWrapper = require('@aragon/wrapper').default
const providers = require('@aragon/wrapper').providers

API Reference

AragonWrapper

Parameters

  • daoAddress string The address of the DAO.
  • options Object Wrapper options. (optional, default {})
    • options.provider any The Web3 provider to use for blockchain communication. Defaults to web3.currentProvider if web3 is injected, otherwise will fallback to wss://rinkeby.eth.aragon.network/ws (optional)
    • options.apm Object Primarily used to set an alternative ipfs provider (optional, default {})
    • options.apm.ensRegistryAddress String The address of the ENS registry (optional, default null)

Examples

const aragon = new Aragon('0xdeadbeef')

// Initialises the wrapper
await aragon.init({
  accounts: {
    providedAccounts: ["0xbeefdead", "0xbeefbeef"]
  }
})

init

Initialise the wrapper.

Parameters

  • options Object An optional options object for configuring the wrapper.

Returns Promise<void>

Throws Error if the daoAddress provided during constructor is detected to not be a Kernel instance

initAccounts

Initialise user-controlled accounts.

Parameters

  • options Object
    • fetchFromWeb3 boolean Whether accounts should also be fetched from the Web3 instance provided to the wrapper
    • providedAccounts Array<string> An array of accounts that the user controls

Returns Promise<void>

initAcl

Initialise the ACL.

Parameters

  • options Object
    • aclAddress string Address of the ACL instance to use, defaults to the daoAddress's default ACL

Returns Promise<void>

getProxyValues

Get proxy metadata (appId, address of the kernel, ...).

Parameters

  • proxyAddress string The address of the proxy to get metadata from

Returns Promise<Object>

isApp

Check if an object is an app.

Parameters

Returns boolean

initApps

Initialise apps observable.

Returns void

initForwarders

Initialise forwarder observable.

Returns void

initNetwork

Initialise connected network details observable.

Returns Promise<void>

runApp

Run an app.

Parameters

  • sandbox Object An object that is compatible with the PostMessage API.
  • proxyAddress string The address of the app proxy.

Returns Object

getAccounts

Get the available accounts for the current user.

Returns Promise<Array<string>> An array of addresses

getTransactionPath

Calculate the transaction path for a transaction to destination that invokes methodName with params.

Parameters

Returns Array<Object> An array of Ethereum transactions that describe each step in the path

calculateTransactionPath

Calculate the transaction path for a transaction to destination that invokes methodName with params.

Parameters

Returns Array<Object> An array of Ethereum transactions that describe each step in the path