4.10.1 • Published 10 months ago

@circles/core v4.10.1

Weekly downloads
100
License
AGPL-3.0
Repository
github
Last release
10 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.10.1

10 months ago

4.10.0

12 months ago

4.9.0

2 years ago

4.9.1

2 years ago

4.9.0-6-g572c794

2 years ago

4.8.0

2 years ago

4.8.0-9-gfe2a842

2 years ago

4.7.0

2 years ago

4.9.0-5-g8c4003c

2 years ago

4.7.2

2 years ago

4.7.1

2 years ago

4.7.3

2 years ago

4.6.0

2 years ago

4.7.0-8-gb3ccbcf

2 years ago

4.7.2-1-g04c1630

2 years ago

4.5.0

2 years ago

4.4.1

2 years ago

4.4.0

2 years ago

4.4.2

2 years ago

4.3.1

2 years ago

4.3.0

2 years ago

4.2.1-0

2 years ago

4.2.0

2 years ago

4.0.1

2 years ago

4.0.0

2 years ago

4.1.0

2 years ago

3.2.1

2 years ago

3.2.0

2 years ago

3.0.0

3 years ago

3.1.4-0

3 years ago

3.1.3

3 years ago

3.1.2

3 years ago

3.1.1

3 years ago

3.1.0

3 years ago

2.11.0

3 years ago

2.11.1

3 years ago

2.11.2

3 years ago

2.12.0

3 years ago

2.10.12

3 years ago

2.10.11

3 years ago

2.10.10

4 years ago

2.10.9

4 years ago

2.10.7

5 years ago

2.10.8

5 years ago

2.10.6

5 years ago

2.10.5

5 years ago

2.10.4

5 years ago

2.10.3

5 years ago

2.10.2

5 years ago

2.10.1

5 years ago

2.9.6

5 years ago

2.10.0

5 years ago

2.9.3

5 years ago

2.9.5

5 years ago

2.9.2

5 years ago

2.9.1

5 years ago

2.9.0

5 years ago

2.8.0

5 years ago

2.7.3

5 years ago

2.7.2

5 years ago

2.7.1

5 years ago

2.7.0

5 years ago

2.6.0

5 years ago

2.5.0

5 years ago

2.4.0

5 years ago

2.3.0

5 years ago

2.2.4

5 years ago

2.2.3

5 years ago

2.2.2

5 years ago

2.2.1

5 years ago

2.1.1

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.2

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.11.1

5 years ago

0.11.0

5 years ago

0.10.6

5 years ago

0.10.5

5 years ago

0.10.4

5 years ago

0.10.3

5 years ago

0.10.1

5 years ago

0.10.2

5 years ago

0.10.0

5 years ago

0.9.2

5 years ago

0.9.1

5 years ago

0.9.0

5 years ago

0.8.6

5 years ago

0.8.5

5 years ago

0.8.4

5 years ago

0.8.3

5 years ago

0.8.2

5 years ago

0.8.1

5 years ago

0.8.0

5 years ago

0.7.0

5 years ago

0.6.9

5 years ago

0.6.7

6 years ago

0.6.6

6 years ago

0.6.8

6 years ago

0.6.5

6 years ago

0.6.3

6 years ago

0.6.2

6 years ago

0.6.4

6 years ago

0.6.1

6 years ago

0.5.0

6 years ago