4.9.1 • Published 7 months ago

@circles/core v4.9.1

Weekly downloads
100
License
AGPL-3.0
Repository
github
Last release
7 months ago

This library provides common methods for JavaScript clients and wallets to interact with the circles-contracts and off-chain services.

Features

  • Interact with circles-contracts and off-chain services like safe-relay-service, graph and circles-api
  • Register and maintain user accounts and organizations
  • Create and search off-chain data like transfer descriptions, usernames and profile pictures
  • Trust other users in the network and retreive trust network
  • List owned Circles tokens and their current balance
  • Show last activities like transfers, trusts and Safe ownership changes
  • Calculate transitive transfer steps to send Circles
  • Update the Version of the Safe contract to v1.3.0

Example

import CirclesCore from '@circles/core';
import Web3 from 'web3';

// Initialize web3
const web3 = new Web3();

// Initialize core with default configs when running against local `circles-docker` setup
const core = new CirclesCore(web3, {
  hubAddress: '0xCfEB869F69431e42cdB54A4F4f105C19C080A601',
  proxyFactoryAddress: '0x9b1f7F645351AF3631a656421eD2e40f2802E6c0',
  safeMasterAddress: '0x59d3631c86BbE35EF041872d502F218A39FBa150',
  apiServiceEndpoint: 'http://api.circles.local',
  pathfinderServiceEndpoint: 'http://pathfinder.circles.local',
  pathfinderType: 'server', // other option: 'cli'
  graphNodeEndpoint: 'http://graph.circles.local',
  databaseSource: 'graph',
  relayServiceEndpoint: 'http://relay.circles.local',
  subgraphName: 'circlesubi/circles-subgraph',
  fallbackHandlerAddress: '0x67B5656d60a809915323Bf2C40A8bEF15A152e3e',
});

// Create existing account from private key which owns a Safe
const account = web3.eth.accounts.privateKeyToAccount('0x...');

// Find out the address of the owned Safe
const [safeAddress] = await core.safe.getAddresses(account, {
  ownerAddress: account.address,
});

// Request Circles UBI payout
await core.token.requestUBIPayout(account, {
  safeAddress,
});

Installation

npm i @circles/core

Make sure you have all peer dependencies isomorphic-fetch and web3 installed as well. Check out the circles-docker repository for running your code locally against Circles services during development.

Development

circles-core is a JavaScript module, tested with Jest, transpiled with Babel and bundled with Rollup. Most of the tests are designed to test end-to-end against all external services and require a running circles-docker environment to work in your development setup.

# Install NodeJS dependencies
npm install

# Copy config file and edit variables according to your needs.
# When running against the default docker setup no changes are required here
cp .env.example .env

# Run e2e test suite. Make sure services are running in the background
# via `circles-docker` repository
npm run test

# Run tests automatically during development when changes have been made
npm run test:watch

# Check code formatting
npm run lint

# Build it!
npm run build

License

GNU Affero General Public License v3.0 AGPL-3.0

4.9.0

7 months ago

5.2.4-beta-not-use

7 months ago

4.9.1

7 months ago

4.9.0-6-g572c794

7 months ago

4.8.0

8 months ago

5.0.0-beta-not-use

8 months ago

5.1.0-beta-not-use

7 months ago

4.8.0-9-gfe2a842

7 months ago

5.2.2-beta-not-use

7 months ago

4.7.0

9 months ago

4.9.0-5-g8c4003c

7 months ago

4.7.2

9 months ago

4.7.1

9 months ago

4.7.3

8 months ago

5.2.3-beta-not-use

7 months ago

5.2.1-beta-not-use

7 months ago

4.6.0

10 months ago

4.7.1-14-g13446762

9 months ago

5.2.0-beta-not-use

7 months ago

4.7.0-8-gb3ccbcf

9 months ago

4.7.2-1-g04c1630

8 months ago

4.5.0

11 months ago

4.4.1

1 year ago

4.4.0

1 year ago

4.4.2

1 year ago

4.3.1

1 year ago

4.3.0

1 year ago

4.2.1-0

1 year ago

4.2.0

1 year ago

4.0.1

1 year ago

4.0.0

1 year ago

4.1.0

1 year ago

3.2.1

1 year ago

3.2.0

1 year ago

3.0.0

1 year ago

3.1.4-0

1 year ago

3.1.3

1 year ago

3.1.2

1 year ago

3.1.1

1 year ago

3.1.0

1 year ago

2.11.0

2 years ago

2.11.1

2 years ago

2.11.2

2 years ago

2.12.0

2 years ago

2.10.12

2 years ago

2.10.11

2 years ago

2.10.10

3 years ago

2.10.9

3 years ago

2.10.7

3 years ago

2.10.8

3 years ago

2.10.6

4 years ago

2.10.5

4 years ago

2.10.4

4 years ago

2.10.3

4 years ago

2.10.2

4 years ago

2.10.1

4 years ago

2.9.6

4 years ago

2.10.0

4 years ago

2.9.3

4 years ago

2.9.5

4 years ago

2.9.2

4 years ago

2.9.1

4 years ago

2.9.0

4 years ago

2.8.0

4 years ago

2.7.3

4 years ago

2.7.2

4 years ago

2.7.1

4 years ago

2.7.0

4 years ago

2.6.0

4 years ago

2.5.0

4 years ago

2.4.0

4 years ago

2.3.0

4 years ago

2.2.4

4 years ago

2.2.3

4 years ago

2.2.2

4 years ago

2.2.1

4 years ago

2.1.1

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.2

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.11.1

4 years ago

0.11.0

4 years ago

0.10.6

4 years ago

0.10.5

4 years ago

0.10.4

4 years ago

0.10.3

4 years ago

0.10.1

4 years ago

0.10.2

4 years ago

0.10.0

4 years ago

0.9.2

4 years ago

0.9.1

4 years ago

0.9.0

4 years ago

0.8.6

4 years ago

0.8.5

4 years ago

0.8.4

4 years ago

0.8.3

4 years ago

0.8.2

4 years ago

0.8.1

4 years ago

0.8.0

4 years ago

0.7.0

4 years ago

0.6.9

4 years ago

0.6.7

4 years ago

0.6.6

4 years ago

0.6.8

4 years ago

0.6.5

5 years ago

0.6.3

5 years ago

0.6.2

5 years ago

0.6.4

5 years ago

0.6.1

5 years ago

0.5.0

5 years ago