LogoLogo
These products have been deprecated and are no longer being maintained. For a better experience and support, please check out our new stack Aragon OSx.
Aragon Legacy Documentation
Aragon Legacy Documentation
  • 🔷Aragon
    • Aragon Legacy Documentation
    • Aragon Values, Finances, and Legal
      • Legal and technical infrastructure
      • Financial infrastructure
      • Meet your DAO support network
    • Learn about DAOs
      • What is a DAO?
      • Why do we need DAOs?
      • What is decentralized autonomous governance?
      • What is the AN DAO?
      • TAO Voting
      • Why use Aragon to build a DAO?
  • 🌐Products
    • Prerequisites
    • Quickstart
    • Setting up a Metamask Wallet
      • Getting started with Ethereum
      • Getting started with Goerli Testnet
      • Getting started with Polygon
      • Getting started with Mumbai Testnet
      • Getting started with Harmony
      • Getting started with Harmony testnet
      • Getting started with Metis Andromeda
      • Getting started with Stardust Testnet
      • Getting started with BSC Testnet
      • How to sign a transaction?
      • Import your seed wallet to Metamask
      • Gas Tracker
    • Setting up a Frame Wallet
    • Setting up a Gnosis Safe MultiSig Wallet
    • Aragon Client
      • What is Aragon Client
      • How to create a DAO
        • Templates
        • Using the Company Template
        • Using the Membership Template
        • Use the Reputation template
      • How to create a DAO on Polygon
      • How to create a DAO on Harmony
      • How to navigate your DAO
        • Home
        • The Apps
          • Tokens App
          • Voting App
          • Finance App
          • Agent App
            • How to install the Agent App in your DAO
            • Using Agent with Frame
        • System Setting
          • Permissions Setting
          • App Center
          • Organization Setting
      • After you've started a DAO
        • How to change the Quorum of your DAO
          • Change Quorum using Aragon Console
          • Change Quorum using EVMcrispr
        • How to create a Legal Wrapper for your DAO with Otoco
        • How to Operate your DAO from your Mobile Phone
      • How to Brick your DAO 🧱
    • Aragon Govern
      • What is Aragon Govern?
      • How to create a Govern DAO
      • Navigate into your Govern DAO
        • How to mint and assign DAO tokens to others
        • How to deposit funds
        • Challenging a transaction
      • Reasons for the delay period in the transaction
      • Collateral for scheduling or challenging a transaction. Why?
      • Acting as a guardian for an Aragon Govern dispute
      • Using the Client DAO with the Govern DAO
    • Aragon Voice
      • What is Aragon Voice?
      • Creating a voting proposal
      • Creating a voting proposal using your token
      • Voting on a proposal
    • Aragon Vocdoni
      • What is Aragon Vocdoni
      • Creating a Vodconi organization
      • Accessing your Vocdoni organization
      • Navigating your Vocdoni organization
        • Creating a voting proposal
        • Voting on a proposal (anonymous voting disabled)
        • Voting on a proposal (anonymous voting enabled)
    • Aragon Court
      • What is Aragon Court
      • Court Dashboard
      • Dispute lifecycle
      • Acting as guardian for a dispute
      • Glossary
  • 🛠️Developers
    • Legacy Developer Documentation
    • General Tools
      • The Basics
        • Before starting
        • Quick start
        • Tech Stack
        • App permissions
        • Forwarding
        • Upgradeability
        • Package management
        • Templates
        • Aragon client
        • Human readable transactions
      • Guides
        • How to create your first custom DAO using Aragon CLI!
        • How to use the Agent App
          • Installing Aragon Agent from aragonCLI
          • Setting and Checking permissions
          • Interacting with Aragon Agent
        • How to build your first Aragon App!
        • How to publish an Aragon App to aragonPM
        • How to migrate existing Aragon App to Buidler plugin
        • How to change the Quorum of your DAO
          • Change Quorum using Aragon Console
          • Change Quorum using EVMcrispr
        • Deploying Aragon Client in new Chains
          • Deployments information
            • Harmony testnet
            • BSC Tesnet
            • Harmony
            • Metis stardust
            • Metis Andromeda
        • How to Brick your DAO 🧱
        • How to sign with Web3 providers
          • Setting up a Metamask Wallet
            • Import your seed phrase into Metamask
            • Import your private key into Metamask
            • Sign a transaction with Metamask
          • Setting up a Frame Wallet
            • Sign a Transaction with Frame
        • Troubleshooting
      • aragonOS
        • Introduction
        • Motivations
        • Developing with aragonOS
        • Reference documentation
        • Migrating to aragonOS 4 from aragonOS 3
        • Reference (aragonOS 3)
        • Smart Contract References
          • ACL
            • ACL
            • ACLSyntaxSugar
            • ACLHelpers
            • IACL
            • IACLOracle
          • APM
            • APMNamehash
            • APMRegistry
            • APMInternalAppNames
            • Repo
          • APPS
            • AppProxyBase
            • AppProxyPinned
            • AppProxyUpgradeable
            • AppStorage
            • AragonApp
            • UnsafeAragonApp
          • COMMON
            • Autopetrified
            • ConversionHelpers
            • DelegateProxy
            • DepositableDelegateProxy
            • DepositableStorage
            • EtherTokenConstant
            • IForwarder
            • IForwarderFee
            • IVaultRecoverable
            • Initializable
            • IsContract
            • Petrifiable
            • ReentrancyGuard
            • SafeERC20
            • TimeHelpers
            • Uint256Helpers
            • UnstructuredStorage
            • VaultRecoverable
          • ENS
            • ENSConstants
            • ENSSubdomainRegistrar
          • EVMSCRIPT
            • EVMScriptRegistry
            • EVMScriptRunner
            • IEVMScriptExecutor
            • IEVMScriptRegistry
            • EVMScriptRegistryConstants
            • ScriptHelpers
          • EVMSCRIPT/EXECUTORS
            • BaseEVMScriptExecutor
            • CallsScript
          • FACTORY
            • APMRegistryFactory
            • AppProxyFactory
            • DAOFactory
            • ENSFactory
            • EVMScriptRegistryFactory
          • KERNEL
            • IKernel
            • IKernelEvents
            • Kernel
            • KernelAppIds
            • KernelNamespaceConstants
            • KernelProxy
            • KernelStorage
      • aragonCLI
        • Introduction
        • Main commands
        • DAO commands
        • APM commands
        • IPFS commands
        • Global configuration
      • aragonPM
        • Introduction
        • Architecture
        • Reference documentation
      • aragonAPI
        • Introduction
        • Javascript
          • Quick Start
          • App API
          • React API
          • Wrapper
          • Providers
          • Architecture of apps
          • Background Scripts
      • aragonUI
        • Getting started
        • How to upgrade
        • BASE
          • Spacing
          • Colors
          • Text styles
          • Icons
          • Main
        • ACTIONS
          • Button
          • ContextMenu
        • NAVIGATION
          • Tabs
          • Pagination
          • BackButton
          • Link
          • Header
        • STRUCTURE
          • Bar
          • Box
          • Card
          • Split
          • DataView
          • Table
          • EmptyStateCard
          • IdentityBadge
          • TransactionBadge
          • Tag
          • Accordion
          • Timer
          • TokenAmount
          • EthIdenticon
          • TransactionProgress
        • DATA ENTRY
          • AutoComplete
          • DateRangePicker
          • DropDown
          • Switch
          • Radio
          • CheckBox
          • Slider
          • TextInput
          • SearchInput
          • AddressField
          • RadioGroup
          • RadioList
          • TextCopy
          • Field
        • VISUALIZATION
          • CircleGraph
          • LineChart
          • Distribution
        • FEEDBACK
          • Info
          • ProgressBar
          • LoadingRing
          • Toast
          • SyncIndicator
          • FloatIndicator
        • OVERLAYS
          • Help
          • Popover
          • Modal
          • SidePanel
        • ADVANCES
          • ButtonBase
          • FocusVisible
          • PublicUrl
          • Redraw
          • RedrawFromDate
          • Root
          • RootPortal
          • Viewport
      • aragonDS
        • Guidelines
          • Layout
          • Color
          • Iconography
          • Typography
          • Illustrations
        • Components
          • Overview
      • Aragon Connect
        • Guides
          • Aragon Basics
          • Getting started
          • Usage with React
        • Advanced
          • Custom Subgraph queries
          • Writing an App Subgraph
          • Writing an App Connector
        • Connectors
          • Organizations
          • Tokens app
          • Voting app
          • Finance app
        • API reference
          • connect()
          • App
          • Connectors
          • Organization
          • Permission
          • Repo
          • Role
          • TransactionIntent
          • TransactionPath
          • TransactionRequest
          • Types
          • Errors
      • App Center
        • App Center
        • Preparing Assets
        • Submitting Your App to the App Center
    • Product Tools
      • Aragon Govern
        • README
        • Introduction
          • Concepts and background
            • Govern Core concepts
            • ERC3000
          • Developers
            • Getting started
            • Govern.js API
            • Historical deployments
            • GraphQL API
            • Smart contracts breakdown
        • Deployments
          • Mainnet
          • Rinkeby
        • Packages
          • ERC 3k
          • Govern Console
          • Govern contract utils
          • Types
          • govern-create
          • Govern Server
          • govern-subgraph
          • govern-token
          • govern.js
      • Aragon Vocdoni
    • Aragon Client Glossary
  • THE ANT TOKEN
    • Aragon Network Token
      • About ANT
      • Historical token sale
    • ANTv1
      • Non-standard behaviours and gotchas
      • About the MiniMe token
      • The initial token sale flow
    • ANTv2
      • Upgrade portal
        • Troubleshooting
      • Contract interaction
      • Migrating on-chain liquidity
    • Developers
      • Quick start
      • Integrating ANT
      • Historical deployments
      • Security policy
  • ‼️FAQ
    • Products
      • Aragon Client
        • Where is my DAO?
        • DAO creation taking a long time to confirm
        • DAO is taking a long time to load
        • Failed DAO creation transaction
        • Why do I see a Blue Screen?
        • An unexpected error has occurred
        • App does not appear in Firefox
        • Receiving funds directly to the Agent or Vault address
        • How to Recover Funds accidentally sent to an Aragon App address
        • Depositing EURS in the Finance app
        • Which templates are available on the Ethereum Network?
        • Which templates are available on the Polygon Network?
        • Which templates are available on the Harmony Network?
        • Which templates are available on the Metis Andromeda Network?
        • How to delete a DAO
      • Aragon Govern
        • Which was the wallet address used to create the Aragon Govern DAO?
        • Where are my DAO tokens?
        • How to delete a DAO
        • How can I transfer funds to the Aragon Govern DAO?
      • Aragon Vocdoni
        • Is Vocdoni easy to use?
        • Is Vocdoni anonymous?
        • Is Vocdoni free?
        • Is my data safe with Vocdoni?
        • As an Organization, what can I do with Vocdoni?
      • Aragon Court
        • What is the current duration of the different stages of a dispute?
        • Dispute - Which fees need to be paid to create a dispute?
        • Dispute - Do I need to put collateral to create a dispute?
        • Appeals - How much money is needed to appeal a dispute? And to confirm the appeal? What is it for?
        • Appeals - If I have tokens staked or activated, can I lose them if I appeal a dispute?
        • Appeals - What happens to the collateral put up
        • Voting - Is a majority needed to win a vote?
        • Voting - What happens if there is a tie?
        • Voting - What does "Refuse to vote" mean? What happens if it's the most voted option?
        • Voting - Another guardian tried to collude. Can I punish this guardian?
        • Voting - What's the penalty for leaked votes?
        • Governance - Which parameters of Court can be changed? How?
        • Governance - Do parameter changes affect ongoing disputes?
        • Technical - Where is the Court "hosted"?
        • Technical - Where can I find the source code and technical documentation for Aragon Court?
        • ANJ conversion - What date will the lock-up period end?
        • ANJ conversion - If I have not staked my $ANJ, do I still get the lockup period price?
        • ANJ conversion - Will I get the 0.044 conversion if I convert after September 5th 2021?
        • ANJ conversion - How much will it cost to be a Guardian in Aragon Court with $ANT?
        • I can't see my tokens in the Dashboard
        • I activated my tokens but I can't see my probability of being drafted
    • Miscellaneous
      • Metamask wallet transaction alert
      • Is Aragon open source?
      • Where can I browse through the DAOs created on Aragon?
      • How to migrate from "old" DAI to "new" DAI
      • Security notice for organizations created before Aragon 0.8
      • General troubleshooting tips
    • ANT Token
      • What can I do with ANT?
      • Who holds ANT?
      • Who are the biggest ANT holders?
      • Long-term holding ANT - What benefits?
      • Can I delegate my network votes to somebody else?
      • Can I do flash loans with ANT?
      • Is there an ANT options market?
      • Are you planning to launch new network tokens?
      • My wallet isn't available on the Upgrade Portal
      • How can connect my Ledger to the Upgrade Portal?
      • I accidentally sent my "old" ANT to an exchange
      • ANJ conversion - What is the minimum number of $ANJ I need to participate in the 0.044 conversion?
      • ANJ conversion - What is the conversion rate ANJ to ANT v2?
Powered by GitBook
On this page
  • Install
  • Import
  • API Reference
  • AragonApp
  • Important Concepts / APIs
  • store
  • Available APIs

Was this helpful?

  1. Developers
  2. General Tools
  3. aragonAPI
  4. Javascript

App API

PreviousQuick StartNextReact API

Last updated 2 years ago

Was this helpful?

Install

npm install --save @aragon/api

Import

ES6

import AragonApp, { providers } from '@aragon/api'

ES5 (CommonJS)

const AragonApp = require('@aragon/api').default
const providers = require('@aragon/api').providers

API Reference

AragonApp

This class is used to communicate with the wrapper in which the app is run.

Every method in this class sends an RPC message to the wrapper.

The app communicates with the wrapper using a messaging provider. The default provider uses the , but you may specify another provider to use (see the exported to learn more about them). You will most likely want to use the in your frontend.

Parameters

Examples

import AragonApp, { providers } from '@aragon/api'

// The default provider should be used in background scripts
const backgroundScriptOfApp = new AragonApp()

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

Note Most of the returned observables will propagate errors from @aragon/wrapper (e.g. the Aragon client) if an RPC request failed. An example would be trying to use api.call('nonexistentFunction'). Multi-emission observables (e.g. api.accounts()) will forward the error without stopping the stream, leaving the subscriber to handle the error case.

Note All methods returning observables will only send their RPC requests upon the returned observable being subscribed. For example, calling api.increment() will NOT send an intent until you have subscribed to the returned observable. This is to ensure that responses cannot be accidentally skipped.

If you're not interested in the response, you can either make an "empty" subscription (i.e. api.increment().subscribe()), or turn it into a promise and await it (i.e. await api.increment().toPromise()).

Important Concepts / APIs

intents

To send an intent to the wrapper (i.e. invoke a method on your smart contract), simply call it on the instance of this class as if it was a JavaScript function.

For example, to execute the increment function in your app's smart contract:

const api = new AragonApp()

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

Some caveats to customizing transaction parameters:

  • from, to, data: will be ignored as aragonAPI 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 aragonAPI results in more gas than provided in the parameter, the estimated gas will prevail.

Pretransactions

Note Some intents may require additional transactions ahead of the actual intent, such as a token approval if the intent is to transfer tokens on the user's behalf. We use the concept of "pretransactions" to allow apps to easily declare that they require these actions.

Token Approvals

intentParams = {
  token: { address: tokenAddress, value: amount }
  gas: 500000
}

api.deposit(tokenAddress, amount, reference, intentParams)

If you want to grant the token allowance to a different contract from the current app, you can pass along a spender paramater in the token object as follows:

intentParams = {
  token: { address: tokenAddress, value: amount, spender: otherContractAddress }
  gas: 500000
}

api.deposit(tokenAddress, amount, reference, intentParams)

store

Should be used as the main "event loop" in an application's background script (running inside a WebWorker). Listens for events, passes them through reducer, caches the resulting state, and re-emits that state for easy chaining.

The store has block caching automatically applied, such that subsequent loads of the application only fetch new events from a cached ("committed") block height (rather than from 0 or the app's initialization block).

The reducer takes the signature (state, event) à la Redux. Note that it must always return a state, even if it is unaltered by the event. Returning undefined will reset the reduced state to its initial null state.

Optionally takes a configuration object comprised of an init function, to re-initialize cached state, and an externals array for subscribing to external contract events. See below for more details.

Parameters

Lifecycle

A simple representation of the store's lifecycle:

  1. Obtain the store's initial state by fetching any cached ("committed") state for the app, else use null as the initial state

  2. Fetch past events from the contract and, starting with the initial state, reduce new state based on the incoming events

  • Note that there are some "custom" built-in events at this step:

    • SYNC_STATUS_SYNCING: triggered when event fetching starts

    • SYNC_STATUS_SYNCED: triggered when event fetching is complete

  1. Cache the state at the end of this initial sync as the app's "committed" state to date

  2. Subscribe to new events from the contract and reduce new state based on the incoming events. Note that this state is not cached as "commited" state and will not be available on the app's next start

  • Note that there are some "custom" built-in events at this step:

    • ACCOUNT_TRIGGER: triggered whenever the currently connected account changes

If options.init and options.externals are given, the lifecycle becomes a bit more complicated:

  1. Obtain the initial "committed" state, as before

  2. If options.init is available, feed the initial state into options.init. Use the returned state from options.init as the new current state.

  3. Fetch past events from the application contract and any given options.externals contracts, reducing new state from found events. Note that new events from both the application contract and external contracts are not fetched until all past events have been found.

  4. Cache the state at the end of the initial sync as "committed" state, as before

  5. Subscribe to new events from the contract and any given options.externals contracts, reducing new state based on the incoming events.

Note The custom events are symbols and can be fetched from the events export of @aragon/api (e.g. import { events } from '@aragon/api'). All custom events conform to the web3 event schema of event (string) and returnValues (object).

Examples

A simple example:

// A simple reducer for a counter app

const state$ = api.store((state, event) => {
  // Initial state is always null
  if (state === null) state = 0

  switch (event.event) {
    case 'Increment':
      state++
      return state
    case 'Decrement':
      state--
      return state
  }

  // We must always return a state, even if unaltered
  return state
})

A more complicated example that also includes options.init and options.external

// A reducer that also reduces events from an external smart contract and uses
// an initialization function

const token = api.external(tokenAddress, tokenJsonInterface)

const initStore = async (cachedStoreState) => {
  // Perform any re-initializations on the cached committed state
  // This is useful for updating state (e.g. token balances, etc.) that may not
  // be // dependent on events
  const reinitializedStoreState = { ...cachedStoreState }

  // The state returned here will be used to start the reducer
  // (rather than the cached state)
  return reinitializedStoreState
}

const state$ = api.store(
  (state, event) => {
    // ...
  },
  {
    externals: {
      contract: token,
      initializationBlock: 0 // By default this uses the current AragonApp's initialization block
    },
    init: initStore,
  }
)

Available APIs

accounts

Get an array of the accounts the user currently controls over time.

network

Get the network the app is connected to over time.

currentApp

Get information about this app (e.g. appAddress, appId, etc.).

  • abi: this app's ABI

  • appAddress: this app's contract address

  • appId: this app's appId

  • appImplementationAddress: this app's implementation contract address, if any (only available if this app is a proxied AragonApp)

  • identifier: this app's self-declared identifier, if any

  • isForwarder: whether this app is a forwarder

  • kernelAddress: this app's attached kernel address (i.e. organization address)

  • name: this app's name, if available

  • roles (experimental): an array of this app's roles

Each app detail also includes an icon(size) function, that allows you to query for the app's icon (if available) based on a preferred size.

installedApps

Get the list of installed applications on the Kernel (organization) this app is attached to.

To get information about just the current app, use currentApp() instead.

guiStyle

Can be ignored by non-GUI apps.

Get the current style of the client running this app.

appearance is currently one of light or dark. Other values could be passed in the future (e.g. black for OLED screens). It is always present and should be respected by apps to display a corresponding theme, unless theme is present.

path

Get the current path for the app over time. Useful with requestPath() to request and respond to in-app navigation changes.

requestPath

Request the current app be allowed to navigate to a different path. Different clients may behave differently, such as requesting user interaction, but all clients should only allow an app to change its path if it is currently visible to users.

Parameters

call

Perform a read-only call on the app's smart contract.

Parameters

describeScript

Decodes an EVM callscript and tries to describe the transaction path that the script encodes.

Parameters

describeTransaction

Tries to describe an Ethereum transaction based on its input data.

Parameters

  • description: a string description

  • annotatedDescription: (if available) an array of objects annotating the description

events

Subscribe for events on your app's smart contract.

Parameters

pastEvents

Fetch events from past blocks on your app's smart contract.

Parameters

external

Creates a handle to interact with an external contract (i.e. a contract that is not your app's smart contract, such as a token).

Parameters

Examples

const token = api.external(tokenAddress, tokenJsonInterface)

// Retrieve the symbol of the token
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}`))
  • Any other method on the handle will respond based on the given contract ABI:

    • Calling any constant method (e.g. view, pure) will send a call to the smart contract and return a single emission observable with the result

requestSignMessage

Parameters

Examples

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

web3Eth

Currently the white-list includes:

  • estimateGas,

  • getAccounts,

  • getBalance,

  • getBlock,

  • getBlockNumber,

  • getBlockTransactionCount,

  • getCode,

  • getCoinbase,

  • getCompilers,

  • getGasPrice,

  • getHashrate,

  • getPastLogs,

  • getProtocolVersion,

  • getStorageAt,

  • getTransaction,

  • getTransactionCount,

  • getTransactionFromBlock,

  • getTransactionReceipt,

  • getWork,

  • getUncle,

  • isMining,

  • isSyncing

Parameters

Examples

api.web3Eth('getTransactionReceipt', trxHash).subscribe(
  receipt => {
    // use receipt
  },
  err => {
    // handle error
  }
)
const block = api.web3Eth('getBlock', blockNumber).toPromise()
const balance = await api.web3Eth('getBalance', connectedAccount).toPromise()

cache

Set a value in the application cache.

Parameters

state

Observe the cached application state over time.

This method is also used to share state between the background script and front-end of your application.

store

triggers

Observe any emitted event triggers for this application.

emitTrigger

Emit an event trigger to all running aragonAPI instances of your application, including the triggering instance. For example, if an application's frontend emits an event trigger, both the frontend and the background script's aragonAPI instances will receive it.

A common use case is to emit non-Ethereum event triggers from an application's frontend to its background script to recalculate reduced state based on a timer, user action, or external API request.

Parameters

Returns void.

identify

Set the app identifier.

This identifier is used to distinguish multiple instances of your app, so choose something that provides additional context to the app instance.

Examples include: the name of a token that the app manages, the type of content that a TCR is curating, the name of a group etc.

Parameters

Examples

api.identify('Customer counter')
// or
api.identify('Employee counter')

Returns void.

resolveAddressIdentity

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

Parameters

requestAddressIdentityModification

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

Parameters

searchIdentities

Search for identities that match a given search term.

Parameters

provider (optional, default MessagePortMessage): A provider used to send and receive messages to and from the wrapper. See .

Note Although many of the API methods return observables, many of them are single-emission observables that you can turn directly into a . While this is seen as an "antipattern" by experienced RxJS users, it is highly convenient when you're not working fully in the context of streams and just need a particular async value (e.g. api.call('getVoteDetails', voteId)). The Aragon One team recommends this approach when first developing your apps if you are not already experienced with RxJS.

You can use the method on all single-emission observables safely (e.g. await api.call('getVoteDetails', voteId).toPromise()). If you receive a multi-emission observable (e.g. api.accounts()) but only care about its current value, you can use the operator, e.g. api.accounts().pipe(first()).toPromise().

The intent function returns a single-emission that emits the hash of the transaction that was sent or an error if the user choose not to sign the transaction.

You can also pass an optional object after all the required function arguments to specify some transaction options. They are the same values that can be passed to web3.eth.sendTransaction() and the full list can be seen in the .

You can include a token parameter in the final options object if you need to grant the app an token allowance before a transaction. A slightly modified from the Finance app:

Also note that the initial state is always null, not undefined, because of limitations.

reducer : A function that reduces events to a state. The function is allowed to be async and can return a Promise that resolves to the new state.

options (optional, default {}): Optional configuration for the store:

options.init (optional): An initialization function for the state that takes the cached state (null if no cached state exists) as a parameter and returns re-initialized state. The function is allowed to be async and can return a Promise that resolves to the state.

options.externals (optional): An array of external contracts whose events the store will also be subscribed to. Each element in the array is an object containing:

contract : an external contract handle returned from api.external()

initializationBlock (optional, defaults to the application's own initialization block): block from which the external contract's events should be fetched from.

Returns : A multi-emission observable that emits the application state every time it changes.

If the application emits its own triggers (see ), the triggers will appear in the reducer only once the syncing phase for past events starts. Any triggers emitted before this will be ignored. Triggers are implicitly transformed into the web3 event schema of event (string) and returnValues (object).

Returns : A multi-emission observable that emits an array of account addresses every time a change is detected.

Returns : A multi-emission observable that emits an object with the connected network's id and type every time the network changes.

Returns : A single-emission observable that emits this app's details, including:

Returns : A multi-emission observable that emits an array of installed application objects every time a change to the installed applications is detected. Each object contains the same details as currentApp().

Returns : A multi-emission observable that emits an object containing two entries: appearance and theme.

theme contains an entire theme object () that should be applied to the app. It is optional and apps should respect it when present. If not possible, apps should respect the value of appearance.

Returns : A multi-emission observable that emits a string for the app's current path every time the path changes.

path : The path to navigate to

Returns : A single-emission observable that emits null on success or an error if the path request was rejected.

method : 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 for more details.

Returns : A single-emission observable that emits the result of the call.

script : The EVM callscript to describe

Returns : A single-emission observable that emits the described transaction path. The emitted transaction path is an array of objects, where each item has a to, data, and description key.

transaction : Transaction object, holding to and data.

Returns : A single-emission observable that emits the description, if describable. The result is an object with:

options (optional): . Unless explicitly provided, fromBlock is always defaulted to the current app's initialization block.

Returns : A multi-emission observable that emits . Note that in the background, an eth_getLogs will first be done to retrieve events from the last unhandled block and only afterwards will an eth_subscribe be made to subscribe to new events.

options (optional): . Unless explicity provided, fromBlock is always defaulted to the current app's initialization block.

Returns : An single-emission observable that emits an array of from past blocks.

address : The address of the external contract

jsonInterface <>: The of the external contract

Returns : An external smart contract handle, containing the following methods:

events(options): returns a multi-emission observable with individual events found, similar to

pastEvents(options): returns a single-emission observable with an array of events found in past blocks, similar to

Calling any non-constant method will send an "external intent" to prompt a real transaction to the smart contract and return a single emission observable with the signature status (signed or not; similar to

Perform a signature using the method.

message : The message to sign

Returns : A single-emission observable that emits the signature hash on success or an error if the user chose not to sign the message.

Request a white-listed function call.

params ...any: An optional variadic number of parameters for the function. See the for more details.

Returns : A single-emission observable with the result of the call.

key : The cache key for the value

value any: The value to persist in the cache (must conform to the )

Returns : A single-emission observable that emits when the cache operation has been commited.

Returns : A multi-emission observable that emits the application state every time it changes. The type of the emitted values is application specific.

Reduce and cache application state based on events. See .

Returns : A multi-emission observable that emits on every emitted event trigger for this application (see ).

name : The name of the event

data (optional, default {}): event data

identifier : The identifier of the app

address : Address to resolve

Returns : A single-emission observable that emits the resolved identity or null if not found.

address : Address to modify

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

searchTerm : String to search for. Must be above a certain length, as defined by the handler (e.g. Aragon client uses minimum length of 3).

Returns : A single-emission observable that emits with an array of any matching identities.

🛠️
Object
providers
Promise
.toPromise()
first()
RxJS observable
web3.js documentation
example
JSONRPC
Function
Object
Function
Array
Object
Number
Observable
emitTrigger
Observable
Observable
Observable
Observable
Observable
e.g. aragonUI's light theme
Observable
string
Observable
string
web3.js doc
Observable
string
Observable
Object
Observable
Object
web3.eth.Contract.events()' options
Observable
Web3 events
Object
web3.eth.Contract.getPastEvents()' options
Observable
Web3 events
string
Array
Object
JSON interface
Object
personal_sign
string
Observable
web3.eth
web3.eth docs
Observable
string
structured cloning algorithm
Observable
Observable
store documentation above
Observable
emitTrigger()
string
Object
string
string
Observable
string
Observable
string
Observable
events
pastEvents
intents
MessageChannel PostMessage API
providers
WindowMessage provider