All Projects → oceanprotocol → ocean.js

oceanprotocol / ocean.js

Licence: Apache-2.0 License
🦑 Ocean Protocol JavaScript library to privately & securely publish, exchange, and consume data.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to ocean.js

market
🧜‍♀️ THE Data Market
Stars: ✭ 149 (+93.51%)
Mutual labels:  defi, datatokens, balancer-exchange
web3together
🗣 Public open-ended discussions about Blockchain, Web3, NFTs, DeFi, ...
Stars: ✭ 58 (-24.68%)
Mutual labels:  web3, defi
mev-inspect-rs
Discover historic Miner Extractable Value (MEV) opportunities
Stars: ✭ 443 (+475.32%)
Mutual labels:  web3, defi
Solnet
Solana's .NET SDK and integration library.
Stars: ✭ 252 (+227.27%)
Mutual labels:  web3, defi
blockhead
Crypto portfolio tracker, DeFi dashboard, NFT viewer and data explorer for the Ethereum/EVM-based blockchain ecosystem and the web 3.0-powered metaverse https://gitcoin.co/grants/2966/blockhead
Stars: ✭ 41 (-46.75%)
Mutual labels:  web3, defi
airswap-web
AirSwap Web App
Stars: ✭ 94 (+22.08%)
Mutual labels:  web3, defi
NFT-Dapp-Boilerplate
A highly scalable NFT and DEFI boilerplate with pre added web3 and different wallets with a focus on performance and best practices
Stars: ✭ 51 (-33.77%)
Mutual labels:  web3, defi
augmented-finance-protocol
High-yield lending and low-rate borrowing DeFi protocol
Stars: ✭ 28 (-63.64%)
Mutual labels:  web3, defi
digital-copyright
Stamp your code with a trackable digital copyright
Stars: ✭ 17 (-77.92%)
Mutual labels:  web3, defi
MultiDexArbBot
This is an arbitrage bot that uses existing price aggregators such as 1inch, Paraswap, dex.ag, matcha and more to get the best exchange rates across different decentralized exchanges on different blockchains and ecosystems.
Stars: ✭ 67 (-12.99%)
Mutual labels:  web3, defi
awesome-waves
Curated list of awesome things for development on Waves blockchain.
Stars: ✭ 60 (-22.08%)
Mutual labels:  web3, defi
Graph-Academy-Hub
The Graph Hub is a free, open-source and community-driven knowledge base and documentation initiative on The Graph Protocol. The vision of The Graph Academy is to establish a single go-to-resource for essential information about The Graph Protocol.
Stars: ✭ 62 (-19.48%)
Mutual labels:  web3, defi
Wallet3
A secure mobile wallet for web3
Stars: ✭ 13 (-83.12%)
Mutual labels:  web3, defi
frontend-v2
Frontend app for the Balancer protocol
Stars: ✭ 127 (+64.94%)
Mutual labels:  web3, defi
stock-dex
As a response to the restrictions many have faced due to the $GME short squeeze mania, many have called for the creation of a decentralized stock exchange. This is what we are going to provide
Stars: ✭ 26 (-66.23%)
Mutual labels:  web3, defi
botdexdamar
🤖 multichain trading bot with sniper, frontrun, backrun, sandwich
Stars: ✭ 124 (+61.04%)
Mutual labels:  web3, defi
ape
The smart contract development tool for Pythonistas, Data Scientists, and Security Professionals
Stars: ✭ 339 (+340.26%)
Mutual labels:  web3, defi
wagmi
React Hooks for Ethereum
Stars: ✭ 1,691 (+2096.1%)
Mutual labels:  web3
awesome-web3-security
🕶 A high-level overview of the EVM security ecosystem
Stars: ✭ 42 (-45.45%)
Mutual labels:  web3
uniswap-skim
scripts to scan all of the uniswapV2🦄 contracts on ethereum and search for skim opportunities
Stars: ✭ 126 (+63.64%)
Mutual labels:  defi

banner

ocean.js

JavaScript library to privately & securely publish, exchange, and consume data.

npm Build Status Maintainability Test Coverage code style: prettier js oceanprotocol

With ocean.js, you can:

  • Publish data services: downloadable files or compute-to-data. Create an ERC721 data NFT for each service, and ERC20 datatoken for access (1.0 datatokens to access).
  • Sell datatokens via an OCEAN-datatoken Balancer pool (for auto price discovery), or for a fixed price. Sell data NFTs.
  • Stake OCEAN on datatoken pools
  • Transfer data NFTs & datatokens to another owner, and all other ERC721 & ERC20 actions using web3.js etc.

ocean.js is part of the Ocean Protocol toolset.

This is in alpha state. If you run into problems, please open up a new issue.

📚 Prerequisites

Note

Any function that uses getPastEvents() will only work on Eth (see: #741). This includes:

  • searchPoolforDT()
  • getPoolsbyCreator()
  • getPoolSharesByAddress()
  • getAllPoolLogs()
  • getPreviousValidOrders()
  • searchforDT()
  • getExchangesbyCreator()
  • getExchangeSwaps()
  • getAllExchangesSwaps()

🏗 Installation

npm install @oceanprotocol/lib

🏄 Quickstart

import { Ocean, Config, ConfigHelper, Logger } from '@oceanprotocol/lib'

const defaultConfig: Config = new ConfigHelper().getConfig(
  'rinkeby',
  'YOUR_INFURA_PROJECT_ID'
)

const config = {
  ...defaultConfig,
  metadataCacheUri: 'https://your-metadata-cache.com',
  providerUri: 'https://your-provider.com'
}

async function init() {
  const ocean = await Ocean.getInstance(config)
  return ocean
}

Here are flows to try out, from beginners to advanced.

  • Beginners guide - for developers who are completely new to blockchain, no coding experience is required.
  • Simple flow - the essence of Ocean - creating a data NFT & datatoken.
  • Marketplace flow - a data asset is posted for sale in a datatoken pool, then purchased. Includes metadata and Compute-to-Data.

📖 Learn more

If you have any difficulties with the quickstarts, or if you have further questions about how to use ocean.js please reach out to us on Discord.

If you notice any bugs or issues with ocean.js please open an issue on github.

🦑 Development

The project is authored with TypeScript and compiled with tsc.

To start compiler in watch mode:

npm install
npm start

Code Style

For linting and auto-formatting you can use from the root of the project:

# lint all js with eslint
npm run lint

# auto format all js & css with prettier, taking all configs into account
npm run format

👩‍🔬 Testing

Test suite for unit & integration tests is setup with Mocha as test runner, and nyc for coverage reporting. A combined coverage report is sent to CodeClimate via the coverage GitHub Actions job.

Running all tests requires running Ocean Protocol components beforehand with Barge, which also runs a ganache-cli instance:

git clone https://github.com/oceanprotocol/barge
cd barge

./start_ocean.sh --with-provider2 --no-dashboard

You can then proceed to run in another terminal.

Let ocean.js know where to pickup the smart contract addresses, which has been written out by Barge in this location:

export ADDRESS_FILE="${HOME}/.ocean/ocean-contracts/artifacts/address.json"

Build metadata:

npm run build:metadata

Executing linting, type checking, unit, and integration tests with coverage reporting all in one go:

npm test

Unit Tests

You can execute the unit tests individually with:

npm run test:unit
# same thing, but with coverage reporting
npm run test:unit:cover

Integration Tests

You can execute the integration tests individually with:

npm run test:integration
# same thing, but with coverage reporting
npm run test:integration:cover

🛳 Production

To create a production build, run from the root of the project:

npm run build

⬆️ Releases

Releases are managed semi-automatically. They are always manually triggered from a developer's machine with release scripts.

Production

From a clean main branch you can run the release task bumping the version accordingly based on semantic versioning:

npm run release

The task does the following:

  • bumps the project version in package.json, package-lock.json
  • auto-generates and updates the CHANGELOG.md file from commit messages
  • creates a Git tag
  • commits and pushes everything
  • creates a GitHub release with commit messages as description
  • Git tag push will trigger a GitHub Action workflow to do a npm release

For the GitHub releases steps a GitHub personal access token, exported as GITHUB_TOKEN is required. Setup

Pre-Releases

For pre-releases, this is required for the first one like v0.18.0-next.0:

./node_modules/.bin/release-it major|minor|patch --preRelease=next

Further releases afterwards can be done with npm run release again and selecting the appropriate next version, in this case v0.18.0-next.1 and so on.

🏛 License

Copyright ((C)) 2022 Ocean Protocol Foundation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].