Wrapper

aragonAPI for Aragon client implementations

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 Options for fetching information from aragonPM

    • options.apm.ensRegistryAddress String The address of the ENS registry

    • options.apm.ipfs Object IPFS options for fetching information from aragonPM (optional)

    • options.apm.ipfs.gateway String The IPFS gateway to use for fetching information (optional)

    • options.apm.ipfs.fetchTimeout Number The timeout before a request to IPFS is automatically failed in milliseconds (optional, default 10s)

    • options.cache Object Cache options (optional)

    • options.cache.forceLocalStorage boolean On browser environments, downgrade to localStorage even if IndexedDB is available (optional)

Examples

const aragon = new Aragon(
  '0xdeadbeef',
  { apm: { ensRegistryAddress: '0x...' } }
)

// 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

modifyAddressIdentity

Modify the identity metadata for an address using the highest priority provider.

Parameters

  • address string Address to modify

  • metadata Object Identity metadata

Returns a Promise<void> that resolves if the modification was successful.

resolveAddressIdentity

Resolve the identity metadata for an address using the highest priority provider.

Parameters

  • address string Address to resolve

Returns a Promise<Object> that resolves with the identity or null if not found.

requestAddressIdentityModification

Request an identity modification using the highest priority provider.

Parameters

  • address string Address to request modification

Returns a Promise<void> that delegates resolution to the handler.

removeLocalIdentities

Remove specific local identities.

Parameters

  • addresses Array<string> Addresses to remove from local identities

searchIdentities

Search identites using the highest priority provider.

Parameters

  • searchTerm string String to search for

Returns a Promise<Array<string>> which resolves with the found identities or an empty array.

setGuiStyle

Set the current GUI style of the client to the apps.

Parameters

  • appearance string Either light or dark. Other values could be passed in the future (e.g. black for OLED screens). Apps should display a corresponding theme, unless theme has also been set.

  • theme Object An entire theme (e.g. aragonUI's light theme) that should be displayed by app frontends. It is optional and apps should respect it when present. If not possible, apps should respect the value of appearance.

Returns void.

Last updated