How to use @aragon/wrapper - 8 common examples

To help you get started, we’ve selected a few @aragon/wrapper examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pandonetwork / pando / packages / pando.js / src / organization / index.ts View on Github external
return new Promise(async (resolve, reject) => {
      const aragon = new Aragon(this.kernel.address, {
        accounts:
          { providedAccounts: [this.pando.options.ethereum.account] },
        provider: this.pando.options.ethereum.provider,
        apm: { ensRegistryAddress: this.pando.options.apm.ens }
      })

      console.log(aragon)

      await aragon.init({
        accounts:
          { providedAccounts: [this.pando.options.ethereum.account] }
        // provider: this.pando.options.ethereum.provider,
        // apm: { ensRegistryAddress: this.pando.options.apm.ens }
      })
      // await aragon.initApps()
github floating / frame / main / accounts / aragon / index.js View on Github external
return new Promise(async (resolve, reject) => {
    try {
      // Look up registry address based on current network connection
      const domain = name.indexOf('.') > -1 ? name : `${name}.aragonid.eth`
      const options = {
        provider: require('../../provider'),
        apm: {
          ipfs: {
            gateway: 'https://ipfs.eth.aragon.network/ipfs'
          },
          ensRegistryAddress: registryAddress()
        }
      }
      const address = await resolveAragon(domain, options.apm.ensRegistryAddress)
      const wrap = new Wrapper(address, options)
      await wrap.init()
      const subscription = wrap.apps.subscribe(apps => {
        subscription.unsubscribe()
        const appsSummary = {}
        apps.forEach(app => {
          const { appId, proxyAddress } = app
          const name = appNames[appId]
          if (name) appsSummary[name] = { proxyAddress }
        })
        if (!appsSummary['kernel']) return reject(new Error('Unable to locate DAO kernel'))
        if (!appsSummary['agent']) return reject(new Error('Unable to locate DAO agent, make sure it is installed'))
        resolve({ name: domain.split('.')[0], domain, apps: appsSummary, ens: address, network: store('main.connection.network') })
      })
    } catch (e) {
      reject(e)
    }
github pandonetwork / pando / packages / git-pando / src / commands / repository / subcommands / deploy.ts View on Github external
const handler = async argv => {
  try {
    let txHash
    let spinner

    const pando = await Pando.create(defaultsDeep(options(), { ethereum: { network: argv.network } }))
    const appId = pando.options.ethereum.network === 'devchain' ? namehash.hash('pando-colony.aragonpm.eth') : namehash.hash('pando-colony.open.aragonpm.eth')
    const wrapper = new Aragon(argv.organization, {
      apm: {
        ensRegistryAddress: pando.options.apm.ens,
        ipfs: pando.options.ipfs.gateway,
      },
      defaultGasPriceFn: () => String(5e9), // gwei
      provider: pando.options.ethereum.provider,
    })
    await wrapper.init({ accounts: { providedAccounts: [pando.options.ethereum.account] } })
    const apps = await _apps(wrapper)
    const colonyAddress = apps.filter(app => app.appId === appId)[0].proxyAddress
    const colony = await pando.artifacts.PandoColony.at(colonyAddress)

    try {
      spinner = ora(`Deploying repository '${argv.name}' on ${pando.options.ethereum.network}`).start()

      colony
github pandonetwork / pando / packages / git-pando / src / lib / repository / factory.ts View on Github external
public async deploy(organization: string, name: string, description: string): Promise {
    // TODO: assert that organization address is the one of an Aragon DAO
    // TODO: if we are in a git directory also try to resolve the organization by the name of the remote
    // TODO: handle transaction pathing

    const wrapper = new Aragon(organization, {
      provider: this.pando.options.ethereum.provider,
      defaultGasPriceFn: () => String(5e9), // gwei
      apm: {
        ipfs: {},
        ensRegistryAddress: this.pando.options.apm.ens,
      },
    })

    await wrapper.init({ accounts: { providedAccounts: [this.pando.options.ethereum.account] } })
    const apps = await this._apps(wrapper)
    const address = apps.filter(app => app.appId === COLONY_APP_ID)[0].proxyAddress
    const colony = await this.pando.artifacts.PandoColony.at(address)
    const receipt = await colony.createRepository(name, '')

    return this._getRepositoryAddressFromReceipt(receipt)
  }
github floating / frame / main / contracts / contractMetadata / aragonProxy / index.js View on Github external
module.exports = async function (to, web3) {
  const proxy = new web3.eth.Contract(require('./AppProxyBase.json').abi, to)
  const kernel = await proxy.methods.kernel().call()
  const options = {
    provider: require('../../../provider'),
    apm: {
      ipfs: {
        gateway: 'https://ipfs.eth.aragon.network/ipfs'
      },
      ensRegistryAddress: registryAddress()
    }
  }
  const wrap = new Wrapper(kernel, options)
  await wrap.init()
  const apps = await wrap.apps.pipe(first()).toPromise()
  const app = apps.find((app) => addressesEqual(app.proxyAddress, to))
  var detailed = {
    abi: app.abi,
    userdoc: {
      methods: {}
    }
  }
  app.functions.forEach(func => { detailed.userdoc.methods[func.sig] = { notice: func.notice } })
  return detailed
}
github floating / frame / main / accounts / aragon / index.js View on Github external
setup () {
    const connection = store('main.connection')
    const status = [connection.local.status, connection.secondary.status]
    if (status.indexOf('connected') > -1 && this.network === connection.network && !this.wrap && !this.inSetup) {
      log.info('\n ** Setting Up Aragon DAO:', this.dao)
      this.inSetup = true
      this.provider = require('../../provider')
      const options = {
        provider: this.provider,
        apm: { ipfs: { gateway: 'https://ipfs.eth.aragon.network/ipfs' }, ensRegistryAddress: registryAddress() }
      }
      const wrap = new Wrapper(this.dao, options)
      wrap.init().then(() => {
        this.wrap = wrap
        this.inSetup = false
      }).catch(err => {
        log.error(err)
        this.inSetup = false
      })
    }
  }
github floating / frame / main / accounts / aragon / index.js View on Github external
return new Promise(async (resolve, reject) => {
    try {
      let address = await ensResolve(domain, { provider: require('../../provider'), registryAddress })
      if (address.replace('0x', '')) return resolve(address)
      throw new Error('Invalid address')
    } catch (e) {
      reject(new Error(`Unable to resolve DAO ${domain} on current network`))
    }
  })
}
github AutarkLabs / open-enterprise / cypress / integration / rewards.spec.js View on Github external
import Web3 from '@aragon/wrapper/node_modules/web3'
import { addDays } from 'date-fns'
const PrivateKeyProvider = require('truffle-privatekey-provider')

const ProviderEngine = require('truffle-privatekey-provider/node_modules/web3-provider-engine')
const CacheSubprovider = require('truffle-privatekey-provider/node_modules/web3-provider-engine/subproviders/cache.js')
const FixtureSubprovider = require('truffle-privatekey-provider/node_modules/web3-provider-engine/subproviders/fixture.js')
const FilterSubprovider = require('truffle-privatekey-provider/node_modules/web3-provider-engine/subproviders/filters.js')
const VmSubprovider = require('truffle-privatekey-provider/node_modules/web3-provider-engine/subproviders/vm.js')
const NonceSubprovider = require('truffle-privatekey-provider/node_modules/web3-provider-engine/subproviders/nonce-tracker.js')
const RpcSubprovider = require('truffle-privatekey-provider/node_modules/web3-provider-engine/subproviders/rpc.js')

var engine = new ProviderEngine()
var web3 = new Web3(engine)

engine.addProvider(
  new FixtureSubprovider({
    web3_clientVersion: 'ProviderEngine/v0.0.0/javascript',
    net_listening: true,
    eth_hashrate: '0x00',
    eth_mining: false,
    eth_syncing: true,
  })
)

engine.addProvider(new CacheSubprovider())
engine.addProvider(new FilterSubprovider())
engine.addProvider(new NonceSubprovider())
engine.addProvider(new VmSubprovider())

@aragon/wrapper

Library for Aragon client implementations

AGPL-3.0
Latest version published 2 years ago

Package Health Score

48 / 100
Full package analysis