Features/ethers (#1696)
* add ethers * global updates * ve updates * ve tests * contract updates * first test passing * downgrade to ethers 5.7.2 * add log * add tx wait * full NftFactory.test * add wait * add Router tests * fix dispenser * Nft test * add dispenser tests * add fre tests part 1 * WIP datatoken unit tests * add DFRewards test * increase gas estimate * increase gas estimate * Work datatoken unit tests * datatoken test more tests * finished datatoken tests * fix nft get data * fix nft transfer tests * Provider int tests * Updating CodeExamples.md * update provider & fix publish flow int test * wip publish edit consume integration test * more work on publish edit consume integration test * fix edit publish edit consume integration test * add 3 int tests * Updating ComputeExamples.md * fix signature and download * fix compute flow integration test * udapte handleComputeOrder helper * update datatoken instance * update datatoken global variable * mint ocean tokens to consumer as well and added logs * update compute exammples * Updating ComputeExamples.md * wip code examples readme * update code examples readme * Updating CodeExamples.md * run all tests * update dep in readme * update readme * code examples update metadata flags * update dt instance in code examples md * set metadata updates * Updating CodeExamples.md * update code examples readme structure * Updating CodeExamples.md * update readmes table links * Updating CodeExamples.md * Updating ComputeExamples.md * clean-up * Updating CodeExamples.md * added missing unit tests for usdc fixed rate exchange tests * more cleanup and jsdoc updates * more jsdoc updates * donw with jsdoc updates * handle provider errors * add missing error handling file * adds most of the provider errors * update get compute env return type * Release 3.0.0-next.0 * adding Typedoc to ethers branch * update provider signature message * fix lint * Release 3.0.0-next.1 * fix lint * adding Typedoc to ethers branch * Updating CI to build and commit the documentation * Updating documentation * Updating script permissions * fix todos add missing logic to send tx * npm package cleanups * Release 3.0.0-next.2 * update log messages for errors * Release 3.0.0-next.3 * fix gasFee issue on sendTx * Release 3.0.0-next.4 * add consume params typings (#1731) * fix gas fee estimate * remove comments * add some delays before resolving datasets * adds delay to Publish flow tests * Release 3.0.0-next.5 --------- Co-authored-by: Bogdan Fazakas <bogdan.fazakas@gmail.com> Co-authored-by: GitHub Actions Bot <> Co-authored-by: Jamie Hewitt <jamie.hewitt15@gmail.com> Co-authored-by: Jamie Hewitt <jamie@oceanprotocol.com>
This commit is contained in:
parent
e3dfa2997a
commit
9bf71ba4f0
|
@ -213,3 +213,28 @@ jobs:
|
|||
|
||||
- name: Create Guide & Commit if there are changes
|
||||
run: npm run commit:guides
|
||||
|
||||
update_docs:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [test_unit, test_integration]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '16'
|
||||
|
||||
- name: checkout ocean.js repo
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: 'oceanprotocol/ocean.js'
|
||||
path: 'ocean.js'
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
|
||||
- name: setup git config
|
||||
run: |
|
||||
# setup the username and email. I tend to use 'GitHub Actions Bot' with no email by default
|
||||
git config user.name "GitHub Actions Bot"
|
||||
git config user.email "<>"
|
||||
|
||||
- name: Create updated docs & commit changes
|
||||
run: npm run commit:docs
|
||||
|
|
63
CHANGELOG.md
63
CHANGELOG.md
|
@ -4,13 +4,76 @@ All notable changes to this project will be documented in this file. Dates are d
|
|||
|
||||
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
||||
|
||||
#### [v3.0.0-next.5](https://github.com/oceanprotocol/ocean.js/compare/v3.0.0-next.4...v3.0.0-next.5)
|
||||
|
||||
- Add consumer parameter types [`#1730`](https://github.com/oceanprotocol/ocean.js/pull/1730)
|
||||
- add consume params typings [`#1731`](https://github.com/oceanprotocol/ocean.js/pull/1731)
|
||||
- Merge 8ad834e2a84ce5b2deb8c7c6117e657e69f86e81 into e3dfa2997acbcfad40a1fc302795c07d2ff1c3fa [`778eab6`](https://github.com/oceanprotocol/ocean.js/commit/778eab6b8641cb9dea93b7f389b45e0a46ebaebd)
|
||||
- fix gas fee estimate [`a9eedac`](https://github.com/oceanprotocol/ocean.js/commit/a9eedac21824436e1925314690e7c8932bf59ce9)
|
||||
- add some delays before resolving datasets [`09d15b3`](https://github.com/oceanprotocol/ocean.js/commit/09d15b39472387d1fdcc558130edf8dbff3b2ab6)
|
||||
|
||||
#### [v3.0.0-next.4](https://github.com/oceanprotocol/ocean.js/compare/v3.0.0-next.3...v3.0.0-next.4)
|
||||
|
||||
> 10 May 2023
|
||||
|
||||
- Release 3.0.0-next.4 [`b9eaff6`](https://github.com/oceanprotocol/ocean.js/commit/b9eaff605571ac8ea002a2fe1a6d59d3645ce1d7)
|
||||
- Merge 1ee38f518b5a69905cfe1270f85f6fc506e71d8a into 59568d292ee1455f8418a3cbbb1756ff7a4fac30 [`fd7144c`](https://github.com/oceanprotocol/ocean.js/commit/fd7144c876d74e0344dc1409eb7e854057d63c1c)
|
||||
- fix gasFee issue on sendTx [`1ee38f5`](https://github.com/oceanprotocol/ocean.js/commit/1ee38f518b5a69905cfe1270f85f6fc506e71d8a)
|
||||
|
||||
#### [v3.0.0-next.3](https://github.com/oceanprotocol/ocean.js/compare/v3.0.0-next.2...v3.0.0-next.3)
|
||||
|
||||
> 9 May 2023
|
||||
|
||||
- Release 3.0.0-next.3 [`1b0821b`](https://github.com/oceanprotocol/ocean.js/commit/1b0821b6efe1deefc77e392c7eb1037fbd2b7fa2)
|
||||
- Merge dfc8ba3d64dda812c79ece3e33270f9feb7001ee into 59568d292ee1455f8418a3cbbb1756ff7a4fac30 [`f5abc40`](https://github.com/oceanprotocol/ocean.js/commit/f5abc4094a87885044a6871d4c9e75e3e9e448cc)
|
||||
- update log messages for errors [`dfc8ba3`](https://github.com/oceanprotocol/ocean.js/commit/dfc8ba3d64dda812c79ece3e33270f9feb7001ee)
|
||||
|
||||
#### [v3.0.0-next.2](https://github.com/oceanprotocol/ocean.js/compare/v3.0.0-next.1...v3.0.0-next.2)
|
||||
|
||||
> 9 May 2023
|
||||
|
||||
- Adding docs with Typedoc [`#1724`](https://github.com/oceanprotocol/ocean.js/pull/1724)
|
||||
- update get compute env return type [`#1721`](https://github.com/oceanprotocol/ocean.js/pull/1721)
|
||||
- Bump @truffle/hdwallet-provider from 2.1.5 to 2.1.10 [`#1725`](https://github.com/oceanprotocol/ocean.js/pull/1725)
|
||||
- Bump vm2 from 3.9.11 to 3.9.17 [`#1722`](https://github.com/oceanprotocol/ocean.js/pull/1722)
|
||||
- Bump chai from 4.3.6 to 4.3.7 [`#1726`](https://github.com/oceanprotocol/ocean.js/pull/1726)
|
||||
- Fix c2d restart job with valid fees and order [`#1729`](https://github.com/oceanprotocol/ocean.js/pull/1729)
|
||||
- Make FRE withMint = True [`#1719`](https://github.com/oceanprotocol/ocean.js/pull/1719)
|
||||
- Bump @types/node from 18.11.18 to 18.15.11 [`#1712`](https://github.com/oceanprotocol/ocean.js/pull/1712)
|
||||
- Bump bignumber.js from 9.1.0 to 9.1.1 [`#1713`](https://github.com/oceanprotocol/ocean.js/pull/1713)
|
||||
- Bump @typescript-eslint/eslint-plugin from 5.54.0 to 5.57.0 [`#1711`](https://github.com/oceanprotocol/ocean.js/pull/1711)
|
||||
- Bump @oceanprotocol/contracts from 1.1.8 to 1.1.12 [`#1709`](https://github.com/oceanprotocol/ocean.js/pull/1709)
|
||||
- Release 3.0.0-next.2 [`11cb8d3`](https://github.com/oceanprotocol/ocean.js/commit/11cb8d32fd3e86ab3be7a4c655b127fb59bd91fe)
|
||||
- merge main fix conflicts [`a038f24`](https://github.com/oceanprotocol/ocean.js/commit/a038f24af4ff10adaab38cf2973febabc199aadb)
|
||||
- adding Typedoc to ethers branch [`bc1f537`](https://github.com/oceanprotocol/ocean.js/commit/bc1f537d09855b84f96514f02e651db7e4fa8559)
|
||||
|
||||
#### [v3.0.0-next.1](https://github.com/oceanprotocol/ocean.js/compare/v3.0.0-next.0...v3.0.0-next.1)
|
||||
|
||||
> 28 April 2023
|
||||
|
||||
- update provider signature message [`05c4030`](https://github.com/oceanprotocol/ocean.js/commit/05c4030afdf7756307cf65483222bbeb3ac53712)
|
||||
- Release 3.0.0-next.1 [`eb67d4c`](https://github.com/oceanprotocol/ocean.js/commit/eb67d4c7f070fb17fb0dc151b22cf223ee7f60f4)
|
||||
- fix lint [`304b53a`](https://github.com/oceanprotocol/ocean.js/commit/304b53ad16067ede69e5274acfcb2ff205f591a6)
|
||||
|
||||
#### [v3.0.0-next.0](https://github.com/oceanprotocol/ocean.js/compare/v2.7.0...v3.0.0-next.0)
|
||||
|
||||
> 18 April 2023
|
||||
|
||||
- Cover all storage type support [`#1685`](https://github.com/oceanprotocol/ocean.js/pull/1685)
|
||||
- fix compute flow integration test [`0750d98`](https://github.com/oceanprotocol/ocean.js/commit/0750d98b986bad063dff0dd1e14458010665fcca)
|
||||
- more cleanup and jsdoc updates [`967f664`](https://github.com/oceanprotocol/ocean.js/commit/967f6642fb1a0cf9c20d4f4fa28d36527d8e43ba)
|
||||
- Updating CodeExamples.md [`815ee37`](https://github.com/oceanprotocol/ocean.js/commit/815ee37c52f9aa64f2cac4948fb137f447d1c6b4)
|
||||
|
||||
#### [v2.7.0](https://github.com/oceanprotocol/ocean.js/compare/v2.7.0-next.2...v2.7.0)
|
||||
|
||||
> 20 March 2023
|
||||
|
||||
- Multichain Provider [`#1698`](https://github.com/oceanprotocol/ocean.js/pull/1698)
|
||||
- Bump release-it from 15.6.0 to 15.6.1 [`#1704`](https://github.com/oceanprotocol/ocean.js/pull/1704)
|
||||
- Bump prettier from 2.8.1 to 2.8.4 [`#1703`](https://github.com/oceanprotocol/ocean.js/pull/1703)
|
||||
- Bump @typescript-eslint/eslint-plugin from 5.47.1 to 5.54.0 [`#1702`](https://github.com/oceanprotocol/ocean.js/pull/1702)
|
||||
- Updated copyright year. [`#1700`](https://github.com/oceanprotocol/ocean.js/pull/1700)
|
||||
- Release 2.7.0 [`a2e9901`](https://github.com/oceanprotocol/ocean.js/commit/a2e9901697b32c6aaaa489c3bec1a19fcfa185ab)
|
||||
|
||||
#### [v2.7.0-next.2](https://github.com/oceanprotocol/ocean.js/compare/v2.7.0-next.1...v2.7.0-next.2)
|
||||
|
||||
|
|
439
CodeExamples.md
439
CodeExamples.md
|
@ -17,14 +17,17 @@ Here are the steps we will be following throughout the article:
|
|||
|
||||
Here are the steps:
|
||||
|
||||
0. [Prerequisites](#-Prerequisites)
|
||||
1. [Initialize services](#-initialize-services)
|
||||
2. [Create a new node.js project](#-create-a-new-node.js-project)
|
||||
3. [Install dependencies](#-install-dependencies)
|
||||
4. [Initialize accounts and deploy contracts](#-initialize-accounts-and-deploy-contracts)
|
||||
5. [Import dependencies and add variables and constants](#-import-dependencies-and-add-variables-and-constants)
|
||||
6. [Publish Data NFT and a Datatoken with a fixed rate exchange](#-publish-data-nft-and-a-datatoken-with-a-fixed-rate-exchange)
|
||||
7. [Publish Data NFT and a Datatoken with a dispenser](#-publish-data-nft-and-a-datatoken-with-a-dispenser)
|
||||
0. [Prerequisites](#0-prerequisites)
|
||||
1. [Initialize services](#1-initialize-services)
|
||||
2. [Create a new node.js project](#2-create-a-new-nodejs-project)
|
||||
3. [Install dependencies](#3-install-dependancies)
|
||||
4. [Import dependencies and add variables and constants](#4-import-dependencies-and-add-variables-and-constants)
|
||||
5. [Load the configuration, initialize accounts and deploy contracts](#5-load-the-configuration-initialize-accounts-and-deploy-contracts)
|
||||
6. [Publish Data NFT and a Datatoken with a fixed rate exchange](#6-publish-data-nft-and-a-datatoken-with-a-fixed-rate-exchange)
|
||||
7. [Consume a fixed rate asset data asset'](#7-consume-a-fixed-rate-asset-data-asset)
|
||||
8. [Publish Data NFT and a Datatoken with a dispenser](#8-publish-data-nft-and-a-datatoken-with-a-dispenserr)
|
||||
9. [Consume a dispenser data asset](#9-consume-a-dispenser-data-asset)
|
||||
10. [Using ERC725 Key-Value Store](#10-using-erc725-key-value-store)
|
||||
|
||||
## 0. Prerequisites
|
||||
Before we start it is important that you have all of the necessary prerequisites installed on your computer.
|
||||
|
@ -67,7 +70,7 @@ Open the package.json file in a text editor and update the dependancies to inclu
|
|||
"@oceanprotocol/contracts": "1.0.0-alpha.28",
|
||||
"@oceanprotocol/lib": "1.0.0-next.37",
|
||||
"crypto-js": "^4.1.1",
|
||||
"web3": "^1.7.3"
|
||||
"ethers": "^5.7.2"
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -84,9 +87,11 @@ Now open the `marketplace.js` file in your text editor.
|
|||
Start by importing all of the necessary dependencies
|
||||
|
||||
```Typescript
|
||||
import fs from 'fs'
|
||||
|
||||
import { AbiItem } from 'web3-utils'
|
||||
import { ethers, providers, Signer } from 'ethers'
|
||||
import { SHA256 } from 'crypto-js'
|
||||
import { homedir } from 'os'
|
||||
import {
|
||||
approve,
|
||||
Aquarius,
|
||||
|
@ -108,10 +113,14 @@ import {
|
|||
ProviderInstance,
|
||||
transfer,
|
||||
ZERO_ADDRESS,
|
||||
calculateEstimatedGas,
|
||||
sendTx
|
||||
sendTx,
|
||||
ConfigHelper,
|
||||
configHelperNetworks,
|
||||
amountToUnits,
|
||||
ValidateMetadata,
|
||||
getEventFromTx,
|
||||
DDO
|
||||
} from '@oceanprotocol/lib'
|
||||
import { getAddresses, getTestConfig, web3 } from '../config'
|
||||
```
|
||||
|
||||
<!--
|
||||
|
@ -121,12 +130,14 @@ describe('Marketplace flow tests
|
|||
Now we define the variables which we will need later
|
||||
|
||||
```Typescript
|
||||
let provider: ethers.providers.JsonRpcProvider
|
||||
let config: Config
|
||||
let aquarius: Aquarius
|
||||
let datatoken: Datatoken
|
||||
let providerUrl: any
|
||||
let publisherAccount: string
|
||||
let consumerAccount: string
|
||||
let stakerAccount: string
|
||||
let publisherAccount: Signer
|
||||
let consumerAccount: Signer
|
||||
let stakerAccount: Signer
|
||||
let addresses: any
|
||||
let freNftAddress: string
|
||||
let freDatatokenAddress: string
|
||||
|
@ -135,6 +146,7 @@ Now we define the variables which we will need later
|
|||
let dispenserNftAddress: string
|
||||
let dispenserDatatokenAddress: string
|
||||
let dispenserAddress: string
|
||||
let fixedDDO
|
||||
```
|
||||
|
||||
We also define some constants that we will use:
|
||||
|
@ -162,11 +174,11 @@ We also define some constants that we will use:
|
|||
|
||||
Next, we define the metadata that will describe our data asset. This is what we call the DDO
|
||||
```Typescript
|
||||
const DDO = {
|
||||
const genericAsset: DDO = {
|
||||
'@context': ['https://w3id.org/did/v1'],
|
||||
id: '',
|
||||
version: '4.1.0',
|
||||
chainId: 5,
|
||||
chainId: 4,
|
||||
nftAddress: '0x0',
|
||||
metadata: {
|
||||
created: '2021-12-20T14:35:20Z',
|
||||
|
@ -175,56 +187,65 @@ Next, we define the metadata that will describe our data asset. This is what we
|
|||
name: 'dataset-name',
|
||||
description: 'Ocean protocol test dataset description',
|
||||
author: 'oceanprotocol-team',
|
||||
license: 'MIT'
|
||||
license: 'MIT',
|
||||
tags: ['white-papers'],
|
||||
additionalInformation: { 'test-key': 'test-value' },
|
||||
links: ['http://data.ceda.ac.uk/badc/ukcp09/']
|
||||
},
|
||||
services: [
|
||||
{
|
||||
id: 'testFakeId',
|
||||
type: 'access',
|
||||
description: 'Download service',
|
||||
files: '',
|
||||
datatokenAddress: '0x0',
|
||||
serviceEndpoint: 'https://v4.provider.goerli.oceanprotocol.com',
|
||||
serviceEndpoint: 'http://172.15.0.4:8030',
|
||||
timeout: 0
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
We load the configuration:
|
||||
## 5. Load the configuration, initialize accounts and deploy contracts
|
||||
```Typescript
|
||||
|
||||
config = await getTestConfig(web3)
|
||||
aquarius = new Aquarius(config.metadataCacheUri)
|
||||
providerUrl = config.providerUri
|
||||
provider = new providers.JsonRpcProvider(
|
||||
process.env.NODE_URI || configHelperNetworks[1].nodeUri
|
||||
)
|
||||
publisherAccount = (await provider.getSigner(0)) as Signer
|
||||
consumerAccount = (await provider.getSigner(1)) as Signer
|
||||
stakerAccount = (await provider.getSigner(2)) as Signer
|
||||
const config = new ConfigHelper().getConfig(
|
||||
parseInt(String((await publisherAccount.provider.getNetwork()).chainId))
|
||||
)
|
||||
config.providerUri = process.env.PROVIDER_URL || config.providerUri
|
||||
aquarius = new Aquarius(config?.metadataCacheUri)
|
||||
providerUrl = config?.providerUri
|
||||
addresses = JSON.parse(
|
||||
// eslint-disable-next-line security/detect-non-literal-fs-filename
|
||||
fs.readFileSync(
|
||||
process.env.ADDRESS_FILE ||
|
||||
`${homedir}/.ocean/ocean-contracts/artifacts/address.json`,
|
||||
'utf8'
|
||||
)
|
||||
).development
|
||||
```
|
||||
As we go along it's a good idea to console log the values so that you check they are right
|
||||
```Typescript
|
||||
console.log(`Aquarius URL: ${config.metadataCacheUri}`)
|
||||
console.log(`Provider URL: ${providerUrl}`)
|
||||
console.log(`Deployed contracts address: ${addresses}`)
|
||||
console.log(`Publisher account address: ${await publisherAccount.getAddress()}`)
|
||||
console.log(`Consumer account address: ${await consumerAccount.getAddress()}`)
|
||||
console.log(`Staker account address: ${await stakerAccount.getAddress()}`)
|
||||
|
||||
```
|
||||
|
||||
## 5. Initialize accounts and deploy contracts
|
||||
### 5.1 Next, lets get the address of the deployed contracts
|
||||
```Typescript
|
||||
addresses = getAddresses()
|
||||
|
||||
```
|
||||
### 5.1 Mint OCEAN to publisher account
|
||||
You can skip this step if you are running your script against a remote network,
|
||||
you need to mint oceans to mentioned accounts only if you are using barge to test your script
|
||||
|
||||
### 5.2 Initialize accounts
|
||||
```Typescript
|
||||
const accounts = await web3.eth.getAccounts()
|
||||
publisherAccount = accounts[0]
|
||||
consumerAccount = accounts[1]
|
||||
stakerAccount = accounts[2]
|
||||
```
|
||||
Again, lets console log the values so that we can check that they have been saved properly
|
||||
```Typescript
|
||||
console.log(`Publisher account address: ${publisherAccount}`)
|
||||
console.log(`Consumer account address: ${consumerAccount}`)
|
||||
console.log(`Staker account address: ${stakerAccount}`)
|
||||
<!--
|
||||
// mint ocean to publisherAccount
|
||||
const minAbi = [
|
||||
{
|
||||
constant: false,
|
||||
|
@ -238,37 +259,40 @@ Again, lets console log the values so that we can check that they have been save
|
|||
stateMutability: 'nonpayable',
|
||||
type: 'function'
|
||||
}
|
||||
] as AbiItem[]
|
||||
const tokenContract = new web3.eth.Contract(minAbi, addresses.Ocean)
|
||||
const estGas = await calculateEstimatedGas(
|
||||
publisherAccount,
|
||||
tokenContract.methods.mint,
|
||||
publisherAccount,
|
||||
web3.utils.toWei('1000')
|
||||
]
|
||||
|
||||
const tokenContract = new ethers.Contract(addresses.Ocean, minAbi, publisherAccount)
|
||||
const estGasPublisher = await tokenContract.estimateGas.mint(
|
||||
await publisherAccount.getAddress(),
|
||||
amountToUnits(null, null, '1000', 18)
|
||||
)
|
||||
await sendTx(
|
||||
estGasPublisher,
|
||||
publisherAccount,
|
||||
estGas,
|
||||
web3,
|
||||
1,
|
||||
tokenContract.methods.mint,
|
||||
publisherAccount,
|
||||
web3.utils.toWei('1000')
|
||||
tokenContract.mint,
|
||||
await publisherAccount.getAddress(),
|
||||
amountToUnits(null, null, '1000', 18)
|
||||
)
|
||||
-->
|
||||
|
||||
```
|
||||
|
||||
### 5.2 Next, lets get the address of the deployed contracts
|
||||
```Typescript
|
||||
addresses = getAddresses()
|
||||
|
||||
```
|
||||
|
||||
### 5.3 We send some OCEAN to consumer and staker accounts
|
||||
```Typescript
|
||||
transfer(web3, config, publisherAccount, addresses.Ocean, consumerAccount, '100')
|
||||
transfer(web3, config, publisherAccount, addresses.Ocean, stakerAccount, '100')
|
||||
transfer(
|
||||
publisherAccount,
|
||||
config,
|
||||
addresses.Ocean,
|
||||
await consumerAccount.getAddress(),
|
||||
'100'
|
||||
)
|
||||
transfer(
|
||||
publisherAccount,
|
||||
config,
|
||||
addresses.Ocean,
|
||||
await stakerAccount.getAddress(),
|
||||
'100'
|
||||
)
|
||||
|
||||
```
|
||||
|
||||
|
@ -276,7 +300,7 @@ Again, lets console log the values so that we can check that they have been save
|
|||
|
||||
### 6.1 Publish a dataset (create NFT + Datatoken) with a fixed rate exchange
|
||||
```Typescript
|
||||
const factory = new NftFactory(addresses.ERC721Factory, web3)
|
||||
const factory = new NftFactory(addresses.ERC721Factory, publisherAccount)
|
||||
|
||||
const nftParams: NftCreateData = {
|
||||
name: FRE_NFT_NAME,
|
||||
|
@ -284,7 +308,7 @@ Again, lets console log the values so that we can check that they have been save
|
|||
templateIndex: 1,
|
||||
tokenURI: '',
|
||||
transferable: true,
|
||||
owner: publisherAccount
|
||||
owner: await publisherAccount.getAddress()
|
||||
}
|
||||
|
||||
const datatokenParams: DatatokenCreateParams = {
|
||||
|
@ -293,15 +317,15 @@ Again, lets console log the values so that we can check that they have been save
|
|||
feeAmount: '0',
|
||||
paymentCollector: ZERO_ADDRESS,
|
||||
feeToken: ZERO_ADDRESS,
|
||||
minter: publisherAccount,
|
||||
minter: await publisherAccount.getAddress(),
|
||||
mpFeeAddress: ZERO_ADDRESS
|
||||
}
|
||||
|
||||
const freParams: FreCreationParams = {
|
||||
fixedRateAddress: addresses.FixedPrice,
|
||||
baseTokenAddress: addresses.Ocean,
|
||||
owner: publisherAccount,
|
||||
marketFeeCollector: publisherAccount,
|
||||
owner: await publisherAccount.getAddress(),
|
||||
marketFeeCollector: await publisherAccount.getAddress(),
|
||||
baseTokenDecimals: 18,
|
||||
datatokenDecimals: 18,
|
||||
fixedRate: '1',
|
||||
|
@ -310,17 +334,22 @@ Again, lets console log the values so that we can check that they have been save
|
|||
withMint: true
|
||||
}
|
||||
|
||||
const tx = await factory.createNftWithDatatokenWithFixedRate(
|
||||
publisherAccount,
|
||||
const bundleNFT = await factory.createNftWithDatatokenWithFixedRate(
|
||||
nftParams,
|
||||
datatokenParams,
|
||||
freParams
|
||||
)
|
||||
|
||||
freNftAddress = tx.events.NFTCreated.returnValues[0]
|
||||
freDatatokenAddress = tx.events.TokenCreated.returnValues[0]
|
||||
freAddress = tx.events.NewFixedRate.returnValues.exchangeContract
|
||||
freId = tx.events.NewFixedRate.returnValues.exchangeId
|
||||
const trxReceipt = await bundleNFT.wait()
|
||||
// events have been emitted
|
||||
const nftCreatedEvent = getEventFromTx(trxReceipt, 'NFTCreated')
|
||||
const tokenCreatedEvent = getEventFromTx(trxReceipt, 'TokenCreated')
|
||||
const newFreEvent = getEventFromTx(trxReceipt, 'NewFixedRate')
|
||||
|
||||
freNftAddress = nftCreatedEvent.args.newTokenAddress
|
||||
freDatatokenAddress = tokenCreatedEvent.args.newTokenAddress
|
||||
freAddress = newFreEvent.args.exchangeContract
|
||||
freId = newFreEvent.args.exchangeId
|
||||
|
||||
```
|
||||
Now let's console log each of those values to check everything is working
|
||||
|
@ -334,54 +363,64 @@ Now let's console log each of those values to check everything is working
|
|||
|
||||
### 6.2 Set metadata in the fixed rate exchange NFT
|
||||
```Typescript
|
||||
const nft = new Nft(web3)
|
||||
const nft = new Nft(
|
||||
publisherAccount,
|
||||
(await publisherAccount.provider.getNetwork()).chainId
|
||||
)
|
||||
|
||||
fixedDDO = { ...genericAsset }
|
||||
|
||||
```
|
||||
Now we are going to update the ddo and set the did
|
||||
```Typescript
|
||||
DDO.chainId = await web3.eth.getChainId()
|
||||
DDO.id =
|
||||
|
||||
fixedDDO.chainId = (await publisherAccount.provider.getNetwork()).chainId
|
||||
fixedDDO.id =
|
||||
'did:op:' +
|
||||
SHA256(web3.utils.toChecksumAddress(freNftAddress) + DDO.chainId.toString(10))
|
||||
DDO.nftAddress = freNftAddress
|
||||
SHA256(ethers.utils.getAddress(freNftAddress) + fixedDDO.chainId.toString(10))
|
||||
fixedDDO.nftAddress = freNftAddress
|
||||
|
||||
```
|
||||
Next, let's encrypt the file(s) using provider
|
||||
```Typescript
|
||||
ASSET_URL.datatokenAddress = freDatatokenAddress
|
||||
ASSET_URL.nftAddress = freNftAddress
|
||||
const encryptedFiles = await ProviderInstance.encrypt(
|
||||
fixedDDO.services[0].files = await ProviderInstance.encrypt(
|
||||
ASSET_URL,
|
||||
DDO.chainId,
|
||||
fixedDDO.chainId,
|
||||
providerUrl
|
||||
)
|
||||
DDO.services[0].files = await encryptedFiles
|
||||
DDO.services[0].datatokenAddress = freDatatokenAddress
|
||||
fixedDDO.services[0].datatokenAddress = freDatatokenAddress
|
||||
|
||||
```
|
||||
Now let's console log the DID to check everything is working
|
||||
```Typescript
|
||||
console.log(`DID: ${DDO.id}`)
|
||||
console.log(`DID: ${fixedDDO.id}`)
|
||||
|
||||
const providerResponse = await ProviderInstance.encrypt(DDO, DDO.chainId, providerUrl)
|
||||
const providerResponse = await ProviderInstance.encrypt(
|
||||
fixedDDO,
|
||||
fixedDDO.chainId,
|
||||
providerUrl
|
||||
)
|
||||
const encryptedDDO = await providerResponse
|
||||
const metadataHash = getHash(JSON.stringify(DDO))
|
||||
const isAssetValid: ValidateMetadata = await aquarius.validate(fixedDDO)
|
||||
assert(isAssetValid.valid === true, 'Published asset is not valid')
|
||||
await nft.setMetadata(
|
||||
freNftAddress,
|
||||
publisherAccount,
|
||||
await publisherAccount.getAddress(),
|
||||
0,
|
||||
providerUrl,
|
||||
'',
|
||||
'0x2',
|
||||
ethers.utils.hexlify(2),
|
||||
encryptedDDO,
|
||||
'0x' + metadataHash
|
||||
isAssetValid.hash
|
||||
)
|
||||
})
|
||||
```
|
||||
|
||||
### 6.3 Marketplace displays fixed rate asset for sale
|
||||
```Typescript
|
||||
const fixedRate = new FixedRateExchange(freAddress, web3)
|
||||
const fixedRate = new FixedRateExchange(freAddress, publisherAccount)
|
||||
const oceanAmount = await (
|
||||
await fixedRate.calcBaseInGivenDatatokensOut(freId, '1')
|
||||
).baseTokenAmount
|
||||
|
@ -392,49 +431,79 @@ Now that the market has fetched those values it can display the asset on the fro
|
|||
|
||||
```
|
||||
|
||||
### 6.4 Consumer buys a fixed rate asset data asset, and downloads it
|
||||
## 7. Consume a fixed rate asset data asset
|
||||
|
||||
### 7.1 Consumer buys a fixed rate asset data asset, and downloads it
|
||||
```Typescript
|
||||
const datatoken = new Datatoken(web3)
|
||||
datatoken = new Datatoken(publisherAccount)
|
||||
const DATATOKEN_AMOUNT = '10000'
|
||||
|
||||
await datatoken.mint(freDatatokenAddress, publisherAccount, DATATOKEN_AMOUNT)
|
||||
await datatoken.mint(
|
||||
freDatatokenAddress,
|
||||
await publisherAccount.getAddress(),
|
||||
DATATOKEN_AMOUNT
|
||||
)
|
||||
|
||||
const consumerETHBalance = await web3.eth.getBalance(consumerAccount)
|
||||
const consumerBalance = await provider.getBalance(await consumerAccount.getAddress())
|
||||
const consumerETHBalance = ethers.utils.formatEther(consumerBalance)
|
||||
|
||||
```
|
||||
Let's do a quick check of the consumer ETH balance before the swap
|
||||
```Typescript
|
||||
console.log(`Consumer ETH balance: ${consumerETHBalance}`)
|
||||
let consumerOCEANBalance = await balance(web3, addresses.Ocean, consumerAccount)
|
||||
let consumerOCEANBalance = await balance(
|
||||
consumerAccount,
|
||||
addresses.Ocean,
|
||||
await consumerAccount.getAddress()
|
||||
)
|
||||
console.log(`Consumer OCEAN balance before swap: ${consumerOCEANBalance}`)
|
||||
let consumerDTBalance = await balance(web3, freDatatokenAddress, consumerAccount)
|
||||
let consumerDTBalance = await balance(
|
||||
consumerAccount,
|
||||
freDatatokenAddress,
|
||||
await consumerAccount.getAddress()
|
||||
)
|
||||
console.log(`Consumer ${FRE_NFT_SYMBOL} balance before swap: ${consumerDTBalance}`)
|
||||
|
||||
```
|
||||
Before we call the contract we have to call `approve` so that the contract can move our tokens. This is standard when using any ERC20 Datatokens
|
||||
```Typescript
|
||||
await approve(web3, config, consumerAccount, addresses.Ocean, freAddress, '100')
|
||||
await approve(
|
||||
web3,
|
||||
consumerAccount,
|
||||
config,
|
||||
await consumerAccount.getAddress(),
|
||||
addresses.Ocean,
|
||||
freAddress,
|
||||
'100'
|
||||
)
|
||||
await approve(
|
||||
publisherAccount,
|
||||
config,
|
||||
await publisherAccount.getAddress(),
|
||||
freDatatokenAddress,
|
||||
freAddress,
|
||||
DATATOKEN_AMOUNT
|
||||
)
|
||||
|
||||
const fixedRate = new FixedRateExchange(freAddress, web3)
|
||||
const fixedRate = new FixedRateExchange(freAddress, consumerAccount)
|
||||
```
|
||||
Now we can make the contract call
|
||||
```Typescript
|
||||
await fixedRate.buyDatatokens(consumerAccount, freId, '1', '2')
|
||||
await fixedRate.buyDatatokens(freId, '1', '2')
|
||||
|
||||
consumerOCEANBalance = await balance(web3, addresses.Ocean, consumerAccount)
|
||||
consumerOCEANBalance = await balance(
|
||||
consumerAccount,
|
||||
addresses.Ocean,
|
||||
await consumerAccount.getAddress()
|
||||
)
|
||||
console.log(`Consumer OCEAN balance after swap: ${consumerOCEANBalance}`)
|
||||
consumerDTBalance = await balance(web3, freDatatokenAddress, consumerAccount)
|
||||
consumerDTBalance = await balance(
|
||||
consumerAccount,
|
||||
freDatatokenAddress,
|
||||
await consumerAccount.getAddress()
|
||||
)
|
||||
console.log(`Consumer ${FRE_NFT_SYMBOL} balance after swap: ${consumerDTBalance}`)
|
||||
|
||||
const resolvedDDO = await aquarius.waitForAqua(DDO.id)
|
||||
const resolvedDDO = await aquarius.waitForAqua(fixedDDO.id)
|
||||
assert(resolvedDDO, 'Cannot fetch DDO from Aquarius')
|
||||
|
||||
```
|
||||
|
@ -444,7 +513,7 @@ Next, we need to initialize the provider
|
|||
resolvedDDO.id,
|
||||
resolvedDDO.services[0].id,
|
||||
0,
|
||||
consumerAccount,
|
||||
await consumerAccount.getAddress(),
|
||||
providerUrl
|
||||
)
|
||||
|
||||
|
@ -459,27 +528,29 @@ Next, we need to initialize the provider
|
|||
validUntil: initializeData.providerFee.validUntil
|
||||
}
|
||||
|
||||
datatoken = new Datatoken(consumerAccount)
|
||||
|
||||
```
|
||||
Lets now make the payment
|
||||
```Typescript
|
||||
const tx = await datatoken.startOrder(
|
||||
freDatatokenAddress,
|
||||
consumerAccount,
|
||||
consumerAccount,
|
||||
await consumerAccount.getAddress(),
|
||||
0,
|
||||
providerFees
|
||||
)
|
||||
const orderTx = await tx.wait()
|
||||
const orderStartedTx = getEventFromTx(orderTx, 'OrderStarted')
|
||||
```
|
||||
Now we can get the url
|
||||
```Typescript
|
||||
const downloadURL = await ProviderInstance.getDownloadUrl(
|
||||
DDO.id,
|
||||
consumerAccount,
|
||||
DDO.services[0].id,
|
||||
fixedDDO.id,
|
||||
fixedDDO.services[0].id,
|
||||
0,
|
||||
tx.transactionHash,
|
||||
orderStartedTx.transactionHash,
|
||||
providerUrl,
|
||||
web3
|
||||
consumerAccount
|
||||
)
|
||||
|
||||
```
|
||||
|
@ -487,9 +558,17 @@ Lets check that the download URL was successfully received
|
|||
```Typescript
|
||||
console.log(`Download URL: ${downloadURL}`)
|
||||
|
||||
consumerOCEANBalance = await balance(web3, addresses.Ocean, consumerAccount)
|
||||
consumerOCEANBalance = await balance(
|
||||
consumerAccount,
|
||||
addresses.Ocean,
|
||||
await consumerAccount.getAddress()
|
||||
)
|
||||
console.log(`Consumer OCEAN balance after order: ${consumerOCEANBalance}`)
|
||||
consumerDTBalance = await balance(web3, freDatatokenAddress, consumerAccount)
|
||||
consumerDTBalance = await balance(
|
||||
consumerAccount,
|
||||
freDatatokenAddress,
|
||||
await consumerAccount.getAddress()
|
||||
)
|
||||
console.log(`Consumer ${FRE_NFT_SYMBOL} balance after order: ${consumerDTBalance}`)
|
||||
|
||||
try {
|
||||
|
@ -501,11 +580,11 @@ Lets check that the download URL was successfully received
|
|||
|
||||
```
|
||||
|
||||
## 7. Publish Data NFT and a Datatoken with a dispenser
|
||||
## 8. Publish Data NFT and a Datatoken with a dispenser
|
||||
|
||||
### 7.1 Publish a dataset (create NFT + Datatoken) with a dispenser
|
||||
### 8.1 Publish a dataset (create NFT + Datatoken) with a dispenser
|
||||
```Typescript
|
||||
const factory = new NftFactory(addresses.ERC721Factory, web3)
|
||||
const factory = new NftFactory(addresses.ERC721Factory, publisherAccount)
|
||||
|
||||
const nftParams: NftCreateData = {
|
||||
name: DISP_NFT_NAME,
|
||||
|
@ -513,7 +592,7 @@ Lets check that the download URL was successfully received
|
|||
templateIndex: 1,
|
||||
tokenURI: '',
|
||||
transferable: true,
|
||||
owner: publisherAccount
|
||||
owner: await publisherAccount.getAddress()
|
||||
}
|
||||
|
||||
const datatokenParams: DatatokenCreateParams = {
|
||||
|
@ -522,7 +601,7 @@ Lets check that the download URL was successfully received
|
|||
feeAmount: '0',
|
||||
paymentCollector: ZERO_ADDRESS,
|
||||
feeToken: ZERO_ADDRESS,
|
||||
minter: publisherAccount,
|
||||
minter: await publisherAccount.getAddress(),
|
||||
mpFeeAddress: ZERO_ADDRESS
|
||||
}
|
||||
|
||||
|
@ -534,16 +613,19 @@ Lets check that the download URL was successfully received
|
|||
allowedSwapper: ZERO_ADDRESS
|
||||
}
|
||||
|
||||
const tx = await factory.createNftWithDatatokenWithDispenser(
|
||||
publisherAccount,
|
||||
const bundleNFT = await factory.createNftWithDatatokenWithDispenser(
|
||||
nftParams,
|
||||
datatokenParams,
|
||||
dispenserParams
|
||||
)
|
||||
const trxReceipt = await bundleNFT.wait()
|
||||
const nftCreatedEvent = getEventFromTx(trxReceipt, 'NFTCreated')
|
||||
const tokenCreatedEvent = getEventFromTx(trxReceipt, 'TokenCreated')
|
||||
const dispenserCreatedEvent = getEventFromTx(trxReceipt, 'DispenserCreated')
|
||||
|
||||
dispenserNftAddress = tx.events.NFTCreated.returnValues[0]
|
||||
dispenserDatatokenAddress = tx.events.TokenCreated.returnValues[0]
|
||||
dispenserAddress = tx.events.DispenserCreated.returnValues[0]
|
||||
dispenserNftAddress = nftCreatedEvent.args.newTokenAddress
|
||||
dispenserDatatokenAddress = tokenCreatedEvent.args.newTokenAddress
|
||||
dispenserAddress = dispenserCreatedEvent.args.newTokenAddress // double check this
|
||||
```
|
||||
Lets check that we managed to received all of those values without any problems
|
||||
```Typescript
|
||||
|
@ -553,59 +635,67 @@ Lets check that we managed to received all of those values without any problems
|
|||
|
||||
```
|
||||
|
||||
### 7.2 Set metadata in the dispenser NFT
|
||||
### 8.2 Set metadata in the dispenser NFT
|
||||
```Typescript
|
||||
const nft = new Nft(web3)
|
||||
const nft = new Nft(
|
||||
publisherAccount,
|
||||
(await publisherAccount.provider.getNetwork()).chainId
|
||||
)
|
||||
|
||||
```
|
||||
Lets start by updating the ddo and setting the did
|
||||
```Typescript
|
||||
DDO.chainId = await web3.eth.getChainId()
|
||||
DDO.id =
|
||||
'did:op:' +
|
||||
SHA256(web3.utils.toChecksumAddress(dispenserNftAddress) + DDO.chainId.toString(10))
|
||||
DDO.nftAddress = dispenserNftAddress
|
||||
fixedDDO.chainId = (await publisherAccount.provider.getNetwork()).chainId
|
||||
|
||||
fixedDDO.id =
|
||||
'did:op:' +
|
||||
SHA256(ethers.utils.getAddress(dispenserNftAddress) + fixedDDO.chainId.toString(10))
|
||||
fixedDDO.nftAddress = dispenserNftAddress
|
||||
```
|
||||
Now we need to encrypt file(s) using provider
|
||||
```Typescript
|
||||
ASSET_URL.datatokenAddress = dispenserDatatokenAddress
|
||||
ASSET_URL.nftAddress = dispenserNftAddress
|
||||
const encryptedFiles = await ProviderInstance.encrypt(
|
||||
fixedDDO.services[0].files = await ProviderInstance.encrypt(
|
||||
ASSET_URL,
|
||||
DDO.chainId,
|
||||
fixedDDO.chainId,
|
||||
providerUrl
|
||||
)
|
||||
DDO.services[0].files = await encryptedFiles
|
||||
DDO.services[0].datatokenAddress = dispenserDatatokenAddress
|
||||
fixedDDO.services[0].datatokenAddress = dispenserDatatokenAddress
|
||||
|
||||
console.log(`DID: ${DDO.id}`)
|
||||
console.log(`DID: ${fixedDDO.id}`)
|
||||
|
||||
const providerResponse = await ProviderInstance.encrypt(DDO, DDO.chainId, providerUrl)
|
||||
const encryptedDDO = await providerResponse
|
||||
const metadataHash = getHash(JSON.stringify(DDO))
|
||||
const encryptedDDO = await ProviderInstance.encrypt(
|
||||
fixedDDO,
|
||||
fixedDDO.chainId,
|
||||
providerUrl
|
||||
)
|
||||
const isAssetValid: ValidateMetadata = await aquarius.validate(fixedDDO)
|
||||
assert(isAssetValid.valid === true, 'Published asset is not valid')
|
||||
await nft.setMetadata(
|
||||
dispenserNftAddress,
|
||||
publisherAccount,
|
||||
await publisherAccount.getAddress(),
|
||||
0,
|
||||
providerUrl,
|
||||
'',
|
||||
'0x2',
|
||||
ethers.utils.hexlify(2),
|
||||
encryptedDDO,
|
||||
'0x' + metadataHash
|
||||
isAssetValid.hash
|
||||
)
|
||||
|
||||
```
|
||||
|
||||
### 7.3 Consumer gets a dispenser data asset, and downloads it
|
||||
## 9. Consume a dispenser data asset
|
||||
|
||||
### 9.1 Consumer gets a dispenser data asset, and downloads it
|
||||
```Typescript
|
||||
const datatoken = new Datatoken(web3)
|
||||
const dispenser = new Dispenser(addresses.Dispenser, web3)
|
||||
datatoken = new Datatoken(publisherAccount)
|
||||
const dispenser = new Dispenser(addresses.Dispenser, consumerAccount)
|
||||
|
||||
let consumerDTBalance = await balance(
|
||||
web3,
|
||||
consumerAccount,
|
||||
dispenserDatatokenAddress,
|
||||
consumerAccount
|
||||
await consumerAccount.getAddress()
|
||||
)
|
||||
console.log(
|
||||
`Consumer ${DISP_NFT_SYMBOL} balance before dispense: ${consumerDTBalance}`
|
||||
|
@ -613,18 +703,24 @@ Now we need to encrypt file(s) using provider
|
|||
|
||||
await dispenser.dispense(
|
||||
dispenserDatatokenAddress,
|
||||
consumerAccount,
|
||||
'1',
|
||||
consumerAccount
|
||||
await consumerAccount.getAddress()
|
||||
)
|
||||
|
||||
consumerDTBalance = await balance(web3, dispenserDatatokenAddress, consumerAccount)
|
||||
consumerDTBalance = await balance(
|
||||
consumerAccount,
|
||||
dispenserDatatokenAddress,
|
||||
await consumerAccount.getAddress()
|
||||
)
|
||||
console.log(
|
||||
`Consumer ${DISP_NFT_SYMBOL} balance after dispense: ${consumerDTBalance}`
|
||||
)
|
||||
|
||||
const resolvedDDO = await aquarius.waitForAqua(DDO.id)
|
||||
const resolvedDDO = await aquarius.waitForAqua(fixedDDO.id)
|
||||
assert(resolvedDDO, 'Cannot fetch DDO from Aquarius')
|
||||
|
||||
datatoken = new Datatoken(consumerAccount)
|
||||
|
||||
```
|
||||
At this point we need to encrypt file(s) using provider
|
||||
```Typescript
|
||||
|
@ -632,7 +728,7 @@ At this point we need to encrypt file(s) using provider
|
|||
resolvedDDO.id,
|
||||
resolvedDDO.services[0].id,
|
||||
0,
|
||||
consumerAccount,
|
||||
await consumerAccount.getAddress(),
|
||||
providerUrl
|
||||
)
|
||||
|
||||
|
@ -651,29 +747,33 @@ Now we need to make the payment
|
|||
```Typescript
|
||||
const tx = await datatoken.startOrder(
|
||||
dispenserDatatokenAddress,
|
||||
consumerAccount,
|
||||
consumerAccount,
|
||||
await consumerAccount.getAddress(),
|
||||
0,
|
||||
providerFees
|
||||
)
|
||||
const orderTx = await tx.wait()
|
||||
const orderStartedTx = getEventFromTx(orderTx, 'OrderStarted')
|
||||
```
|
||||
Now we can get the download URL
|
||||
```Typescript
|
||||
const downloadURL = await ProviderInstance.getDownloadUrl(
|
||||
DDO.id,
|
||||
consumerAccount,
|
||||
DDO.services[0].id,
|
||||
fixedDDO.id,
|
||||
fixedDDO.services[0].id,
|
||||
0,
|
||||
tx.transactionHash,
|
||||
orderStartedTx.transactionHash,
|
||||
providerUrl,
|
||||
web3
|
||||
consumerAccount
|
||||
)
|
||||
```
|
||||
Let's check we received the download URL ok
|
||||
```Typescript
|
||||
console.log(`Download URL: ${downloadURL}`)
|
||||
|
||||
consumerDTBalance = await balance(web3, dispenserDatatokenAddress, consumerAccount)
|
||||
consumerDTBalance = await balance(
|
||||
consumerAccount,
|
||||
dispenserDatatokenAddress,
|
||||
await consumerAccount.getAddress()
|
||||
)
|
||||
console.log(`Consumer ${DISP_NFT_SYMBOL} balance after order: ${consumerDTBalance}`)
|
||||
|
||||
try {
|
||||
|
@ -685,7 +785,7 @@ Let's check we received the download URL ok
|
|||
|
||||
```
|
||||
|
||||
## 8. Using ERC725 Key-Value Store
|
||||
## 10. Using ERC725 Key-Value Store
|
||||
|
||||
Data NFTs can store arbitrary key-value pairs on-chain. This opens up their usage for a broad variety of applications, such as comments & ratings, attestations, and privately sharing data (when the value is encrypted).
|
||||
|
||||
|
@ -698,33 +798,40 @@ Here are the steps:
|
|||
3. Add key-value pair to data NFT (use the `setData` method)
|
||||
4. Retrieve value from data NFT (use the `getData` method)
|
||||
|
||||
### 8.1 Add key-value pair to data NFT
|
||||
### 10.1 Add key-value pair to data NFT
|
||||
Let's start by using the `setData` method to update the nft key value store with some data
|
||||
```Typescript
|
||||
const nft = new Nft(web3)
|
||||
const nft = new Nft(publisherAccount)
|
||||
const data = 'SomeData'
|
||||
try {
|
||||
await nft.setData(freNftAddress, publisherAccount, '1', data)
|
||||
await nft.setData(
|
||||
freNftAddress,
|
||||
await publisherAccount.getAddress(),
|
||||
'0x1234',
|
||||
data
|
||||
)
|
||||
} catch (e) {
|
||||
console.log('e = ', e)
|
||||
assert.fail('Failed to set data in NFT ERC725 key value store', e)
|
||||
}
|
||||
```
|
||||
|
||||
Under the hood, this uses [ERC725](https://erc725alliance.org/), which augments ERC721 with a well-defined way to set and get key-value pairs.
|
||||
|
||||
### 8.2 get the key-value pair data from the NFT'
|
||||
### 10.2 get the key-value pair data from the NFT'
|
||||
|
||||
Use the `getData` method to get the data stored in the nft key value store
|
||||
|
||||
```Typescript
|
||||
try {
|
||||
const response = await nft.getData(freNftAddress, '1')
|
||||
const response = await nft.getData(freNftAddress, '0x1234')
|
||||
console.log('getData response: ', response)
|
||||
assert(
|
||||
response === data,
|
||||
'Wrong data received when getting data from NFT ERC725 key value store'
|
||||
)
|
||||
} catch (e) {
|
||||
console.log('e = ', e)
|
||||
assert.fail('Failed to get data from NFT ERC725 key value store', e)
|
||||
}
|
||||
```
|
||||
|
|
|
@ -2,18 +2,18 @@
|
|||
|
||||
Here are the steps:
|
||||
|
||||
0. [Prerequisites](#-Prerequisites)
|
||||
1. [Initialize services](#-initialize-services)
|
||||
2. [Create a new node.js project](#-create-a-new-node.js-project)
|
||||
3. [Install dependencies](#-install-dependencies)
|
||||
4. [Import dependencies and add variables and constants](#-import-dependencies-and-add-variables-and-constants)
|
||||
0. [Prerequisites](#0-prerequisites)
|
||||
1. [Initialize services](#1-initialize-services)
|
||||
2. [Create a new node.js project](#2-create-a-new-nodejs-project-with-typescript)
|
||||
3. [Install dependencies](#3-install-dependencies)
|
||||
4. [Import dependencies and add variables and constants](#4-import-dependencies-and-add-variables-constants-and-helper-methods)
|
||||
5. [Initialize accounts and deploy contracts](#-initialize-accounts-and-deploy-contracts)
|
||||
6. [Publish a dataset and an algorithm](#-publish-a-dataset-data-nft-and-datatoken)
|
||||
7. [Resolve published datasets and algorithms](#-resolve-published-datasets-and-algorithms)
|
||||
8. [Send datatokens to consumer](#-send-datatokens-to-consumer)
|
||||
9. [Consumer fetches compute environment](#-consumer-starts-a-compute-job-using-a-free-c2D-environment)
|
||||
10. [Consumer starts a compute job using a free C2D environment](#-consumer-starts-a-compute-job-using-a-free-c2D-environment)
|
||||
11. [Check compute status and get download compute results url](#-check-compute-status-and-get-download-compute-results-url)
|
||||
6. [Publish a dataset and an algorithm](#6-publish-assets-dataset-and-algorithm)
|
||||
7. [Resolve published datasets and algorithms](#7-resolve-assets)
|
||||
8. [Send datatokens to consumer](#8-send-datatokens-to-consumer)
|
||||
9. [Consumer fetches compute environment](#9-get-compute-environments)
|
||||
10. [Consumer starts a compute job using a free C2D environment](#10-consumer-starts-a-compute-job)
|
||||
11. [Check compute status and get download compute results url](#11-check-compute-status-and-get-download-compute-results-url)
|
||||
|
||||
Let's go through each step.
|
||||
|
||||
|
@ -104,7 +104,7 @@ node dist/compute.js
|
|||
Install dependencies running the following command in your terminal:
|
||||
|
||||
```bash
|
||||
npm install @oceanprotocol/lib crypto-js web3 web3-utils typescript @types/node ts-node
|
||||
npm install @oceanprotocol/lib crypto-js ethers typescript @types/node ts-node
|
||||
```
|
||||
|
||||
## 4. Import dependencies and add variables, constants and helper methods
|
||||
|
@ -120,8 +120,7 @@ import fs from 'fs'
|
|||
import { homedir } from 'os'
|
||||
|
||||
import { SHA256 } from 'crypto-js'
|
||||
import Web3 from 'web3'
|
||||
import { AbiItem } from 'web3-utils'
|
||||
import { ethers, providers, Signer } from 'ethers'
|
||||
import {
|
||||
ProviderInstance,
|
||||
Aquarius,
|
||||
|
@ -141,12 +140,12 @@ import {
|
|||
DDO,
|
||||
NftCreateData,
|
||||
DatatokenCreateParams,
|
||||
calculateEstimatedGas,
|
||||
sendTx,
|
||||
configHelperNetworks,
|
||||
ConfigHelper
|
||||
ConfigHelper,
|
||||
getEventFromTx,
|
||||
amountToUnits
|
||||
} from '@oceanprotocol/lib'
|
||||
|
||||
```
|
||||
|
||||
### 4.2. Constants and variables
|
||||
|
@ -260,13 +259,12 @@ const ALGORITHM_DDO: DDO = {
|
|||
|
||||
Now we define the variables which we will need later
|
||||
```Typescript
|
||||
let web3: Web3
|
||||
let config: Config
|
||||
let aquarius: Aquarius
|
||||
let aquariusInstance: Aquarius
|
||||
let datatoken: Datatoken
|
||||
let providerUrl: string
|
||||
let publisherAccount: string
|
||||
let consumerAccount: string
|
||||
let publisherAccount: Signer
|
||||
let consumerAccount: Signer
|
||||
let addresses
|
||||
let computeEnvs
|
||||
|
||||
|
@ -287,16 +285,17 @@ Add a `createAsset()`function.
|
|||
async function createAsset(
|
||||
name: string,
|
||||
symbol: string,
|
||||
owner: string,
|
||||
owner: Signer,
|
||||
assetUrl: Files,
|
||||
ddo: DDO,
|
||||
providerUrl: string
|
||||
) {
|
||||
const nft = new Nft(web3)
|
||||
const Factory = new NftFactory(addresses.ERC721Factory, web3)
|
||||
const nft = new Nft(owner, (await owner.provider.getNetwork()).chainId)
|
||||
|
||||
const nftFactory = new NftFactory(addresses.ERC721Factory, owner)
|
||||
|
||||
const chain = (await owner.provider.getNetwork()).chainId
|
||||
|
||||
// Now we update the DDO and set the right did
|
||||
const chain = await web3.eth.getChainId()
|
||||
ddo.chainId = parseInt(chain.toString(10))
|
||||
const nftParamsAsset: NftCreateData = {
|
||||
name,
|
||||
|
@ -304,7 +303,7 @@ async function createAsset(
|
|||
templateIndex: 1,
|
||||
tokenURI: 'aaa',
|
||||
transferable: true,
|
||||
owner
|
||||
owner: await owner.getAddress()
|
||||
}
|
||||
const datatokenParams: DatatokenCreateParams = {
|
||||
templateIndex: 1,
|
||||
|
@ -312,45 +311,41 @@ async function createAsset(
|
|||
feeAmount: '0',
|
||||
paymentCollector: ZERO_ADDRESS,
|
||||
feeToken: ZERO_ADDRESS,
|
||||
minter: owner,
|
||||
minter: await owner.getAddress(),
|
||||
mpFeeAddress: ZERO_ADDRESS
|
||||
}
|
||||
// Now we can make the contract call createNftWithDatatoken
|
||||
const result = await Factory.createNftWithDatatoken(
|
||||
owner,
|
||||
|
||||
const bundleNFT = await nftFactory.createNftWithDatatoken(
|
||||
nftParamsAsset,
|
||||
datatokenParams
|
||||
)
|
||||
|
||||
const nftAddress = result.events.NFTCreated.returnValues[0]
|
||||
const datatokenAddressAsset = result.events.TokenCreated.returnValues[0]
|
||||
ddo.nftAddress = web3.utils.toChecksumAddress(nftAddress)
|
||||
const trxReceipt = await bundleNFT.wait()
|
||||
// events have been emitted
|
||||
const nftCreatedEvent = getEventFromTx(trxReceipt, 'NFTCreated')
|
||||
const tokenCreatedEvent = getEventFromTx(trxReceipt, 'TokenCreated')
|
||||
|
||||
// Next we encrypt the file or files using Ocean Provider. The provider is an off chain proxy built specifically for this task
|
||||
const nftAddress = nftCreatedEvent.args.newTokenAddress
|
||||
const datatokenAddressAsset = tokenCreatedEvent.args.newTokenAddress
|
||||
// create the files encrypted string
|
||||
assetUrl.datatokenAddress = datatokenAddressAsset
|
||||
assetUrl.nftAddress = ddo.nftAddress
|
||||
let providerResponse = await ProviderInstance.encrypt(assetUrl, chain, providerUrl)
|
||||
ddo.services[0].files = await providerResponse
|
||||
assetUrl.nftAddress = nftAddress
|
||||
ddo.services[0].files = await ProviderInstance.encrypt(assetUrl, chain, providerUrl)
|
||||
ddo.services[0].datatokenAddress = datatokenAddressAsset
|
||||
ddo.services[0].serviceEndpoint = providerUrl
|
||||
ddo.services[0].serviceEndpoint = 'http://172.15.0.4:8030' // put back proviederUrl
|
||||
|
||||
// Next we update ddo and set the right did
|
||||
ddo.nftAddress = web3.utils.toChecksumAddress(nftAddress)
|
||||
ddo.id =
|
||||
'did:op:' + SHA256(web3.utils.toChecksumAddress(nftAddress) + chain.toString(10))
|
||||
providerResponse = await ProviderInstance.encrypt(ddo, chain, providerUrl)
|
||||
const encryptedResponse = await providerResponse
|
||||
const validateResult = await aquarius.validate(ddo)
|
||||
|
||||
// Next you can check if if the ddo is valid by checking if validateResult.valid returned true
|
||||
ddo.nftAddress = nftAddress
|
||||
ddo.id = 'did:op:' + SHA256(ethers.utils.getAddress(nftAddress) + chain.toString(10))
|
||||
|
||||
const encryptedResponse = await ProviderInstance.encrypt(ddo, chain, providerUrl)
|
||||
const validateResult = await aquariusInstance.validate(ddo)
|
||||
await nft.setMetadata(
|
||||
nftAddress,
|
||||
owner,
|
||||
await owner.getAddress(),
|
||||
0,
|
||||
providerUrl,
|
||||
'http://172.15.0.4:8030', // put back proviederUrl
|
||||
'',
|
||||
'0x2',
|
||||
ethers.utils.hexlify(2),
|
||||
encryptedResponse,
|
||||
validateResult.hash
|
||||
)
|
||||
|
@ -363,7 +358,7 @@ Add a `handleOrder()`function.
|
|||
async function handleOrder(
|
||||
order: ProviderComputeInitialize,
|
||||
datatokenAddress: string,
|
||||
payerAccount: string,
|
||||
payerAccount: Signer,
|
||||
consumerAccount: string,
|
||||
serviceIndex: number,
|
||||
consumeMarkerFee?: ConsumeMarketFee
|
||||
|
@ -375,9 +370,9 @@ async function handleOrder(
|
|||
*/
|
||||
if (order.providerFee && order.providerFee.providerFeeAmount) {
|
||||
await approveWei(
|
||||
web3,
|
||||
config,
|
||||
payerAccount,
|
||||
config,
|
||||
await payerAccount.getAddress(),
|
||||
order.providerFee.providerFeeToken,
|
||||
datatokenAddress,
|
||||
order.providerFee.providerFeeAmount
|
||||
|
@ -387,21 +382,23 @@ async function handleOrder(
|
|||
if (!order.providerFee) return order.validOrder
|
||||
const tx = await datatoken.reuseOrder(
|
||||
datatokenAddress,
|
||||
payerAccount,
|
||||
order.validOrder,
|
||||
order.providerFee
|
||||
)
|
||||
return tx.transactionHash
|
||||
const reusedTx = await tx.wait()
|
||||
const orderReusedTx = getEventFromTx(reusedTx, 'OrderReused')
|
||||
return orderReusedTx.transactionHash
|
||||
}
|
||||
const tx = await datatoken.startOrder(
|
||||
datatokenAddress,
|
||||
payerAccount,
|
||||
consumerAccount,
|
||||
serviceIndex,
|
||||
order.providerFee,
|
||||
consumeMarkerFee
|
||||
)
|
||||
return tx.transactionHash
|
||||
const orderTx = await tx.wait()
|
||||
const orderStartedTx = getEventFromTx(orderTx, 'OrderStarted')
|
||||
return orderStartedTx.transactionHash
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -413,9 +410,17 @@ describe('Compute-to-data example tests
|
|||
We need to load the configuration. Add the following code into your `run(){ }` function
|
||||
```Typescript
|
||||
|
||||
web3 = new Web3(process.env.NODE_URI || configHelperNetworks[1].nodeUri)
|
||||
config = new ConfigHelper().getConfig(await web3.eth.getChainId())
|
||||
const provider = new providers.JsonRpcProvider(
|
||||
process.env.NODE_URI || configHelperNetworks[1].nodeUri
|
||||
)
|
||||
publisherAccount = (await provider.getSigner(0)) as Signer
|
||||
consumerAccount = (await provider.getSigner(1)) as Signer
|
||||
const config = new ConfigHelper().getConfig(
|
||||
parseInt(String((await publisherAccount.provider.getNetwork()).chainId))
|
||||
)
|
||||
config.providerUri = process.env.PROVIDER_URL || config.providerUri
|
||||
aquariusInstance = new Aquarius(config?.metadataCacheUri)
|
||||
providerUrl = config?.providerUri
|
||||
addresses = JSON.parse(
|
||||
// eslint-disable-next-line security/detect-non-literal-fs-filename
|
||||
fs.readFileSync(
|
||||
|
@ -424,37 +429,24 @@ We need to load the configuration. Add the following code into your `run(){ }` f
|
|||
'utf8'
|
||||
)
|
||||
).development
|
||||
aquarius = new Aquarius(config.metadataCacheUri)
|
||||
providerUrl = config.providerUri
|
||||
datatoken = new Datatoken(web3)
|
||||
|
||||
```
|
||||
As we go along it's a good idea to console log the values so that you check they are right. At the end of your `run(){ ... }` function add the following logs:
|
||||
```Typescript
|
||||
console.log(`Aquarius URL: ${config.metadataCacheUri}`)
|
||||
console.log(`Provider URL: ${providerUrl}`)
|
||||
console.log(`Deployed contracts address: ${addresses}`)
|
||||
|
||||
```
|
||||
|
||||
Now at the end of your compute.ts file call you `run()` function. Next, let's compile the file with the `tsc` command in the console and run `node dist/compute.js`.
|
||||
If everything is working you should see the logs in the console and no errors.
|
||||
## 5. Initialize accounts
|
||||
### 5.1 Initialize accounts
|
||||
We will use all of the following code snippets in the same way. Add the code snippet and the logs to the end of your `run(){ ... }` function as well as the logs.
|
||||
Then compile your file with the `tsc` command and run it with `node dist/compute.js`
|
||||
```Typescript
|
||||
const accounts = await web3.eth.getAccounts()
|
||||
publisherAccount = accounts[0]
|
||||
consumerAccount = accounts[1]
|
||||
```
|
||||
Again, lets console log the values so that we can check that they have been saved properly
|
||||
```Typescript
|
||||
console.log(`Publisher account address: ${publisherAccount}`)
|
||||
console.log(`Consumer account address: ${consumerAccount}`)
|
||||
|
||||
```
|
||||
|
||||
### 5.2 Mint OCEAN to publisher account
|
||||
Now at the end of your compute.ts file call you `run()` function. Next, let's compile the file with the `tsc` command in the console and run `node dist/compute.js`.
|
||||
If everything is working you should see the logs in the console and no errors.
|
||||
We will use all of the following code snippets in the same way. Add the code snippet and the logs to the end of your `run(){ ... }` function as well as the logs.
|
||||
Then compile your file with the `tsc` command and run it with `node dist/compute.js`
|
||||
|
||||
### 5.1 Mint OCEAN to publisher account
|
||||
You can skip this step if you are running your script against a remote network,
|
||||
you need to mint oceans to mentioned accounts only if you are using barge to test your script
|
||||
|
||||
|
@ -472,29 +464,33 @@ you need to mint oceans to mentioned accounts only if you are using barge to tes
|
|||
stateMutability: 'nonpayable',
|
||||
type: 'function'
|
||||
}
|
||||
] as AbiItem[]
|
||||
const tokenContract = new web3.eth.Contract(minAbi, addresses.Ocean)
|
||||
const estGas = await calculateEstimatedGas(
|
||||
publisherAccount,
|
||||
tokenContract.methods.mint,
|
||||
publisherAccount,
|
||||
web3.utils.toWei('1000')
|
||||
]
|
||||
|
||||
const tokenContract = new ethers.Contract(addresses.Ocean, minAbi, publisherAccount)
|
||||
const estGasPublisher = await tokenContract.estimateGas.mint(
|
||||
await publisherAccount.getAddress(),
|
||||
amountToUnits(null, null, '1000', 18)
|
||||
)
|
||||
await sendTx(
|
||||
estGasPublisher,
|
||||
publisherAccount,
|
||||
estGas,
|
||||
web3,
|
||||
1,
|
||||
tokenContract.methods.mint,
|
||||
publisherAccount,
|
||||
web3.utils.toWei('1000')
|
||||
tokenContract.mint,
|
||||
await publisherAccount.getAddress(),
|
||||
amountToUnits(null, null, '1000', 18)
|
||||
)
|
||||
|
||||
```
|
||||
|
||||
### 5.3 Send some OCEAN to consumer account
|
||||
### 5.2 Send some OCEAN to consumer account
|
||||
```Typescript
|
||||
transfer(web3, config, publisherAccount, addresses.Ocean, consumerAccount, '100')
|
||||
transfer(
|
||||
publisherAccount,
|
||||
config,
|
||||
addresses.Ocean,
|
||||
await consumerAccount.getAddress(),
|
||||
'100'
|
||||
)
|
||||
|
||||
```
|
||||
|
||||
|
@ -538,8 +534,8 @@ Now, let's check that we successfully published a algorithm (create NFT + Datato
|
|||
|
||||
### 7.1 Resolve published datasets and algorithms
|
||||
```Typescript
|
||||
resolvedDatasetDdo = await aquarius.waitForAqua(datasetId)
|
||||
resolvedAlgorithmDdo = await aquarius.waitForAqua(algorithmId)
|
||||
resolvedDatasetDdo = await aquariusInstance.waitForAqua(datasetId)
|
||||
resolvedAlgorithmDdo = await aquariusInstance.waitForAqua(algorithmId)
|
||||
```
|
||||
<!--
|
||||
assert(resolvedDatasetDdo, 'Cannot fetch DDO from Aquarius')
|
||||
|
@ -551,18 +547,22 @@ Now, let's check that we successfully published a algorithm (create NFT + Datato
|
|||
|
||||
### 8.1 Mint dataset and algorithm datatokens to publisher
|
||||
```Typescript
|
||||
const datatoken = new Datatoken(
|
||||
publisherAccount,
|
||||
(await publisherAccount.provider.getNetwork()).chainId
|
||||
)
|
||||
await datatoken.mint(
|
||||
resolvedDatasetDdo.services[0].datatokenAddress,
|
||||
publisherAccount,
|
||||
await publisherAccount.getAddress(),
|
||||
'10',
|
||||
consumerAccount
|
||||
await consumerAccount.getAddress()
|
||||
)
|
||||
|
||||
await datatoken.mint(
|
||||
resolvedAlgorithmDdo.services[0].datatokenAddress,
|
||||
publisherAccount,
|
||||
await publisherAccount.getAddress(),
|
||||
'10',
|
||||
consumerAccount
|
||||
await consumerAccount.getAddress()
|
||||
)
|
||||
|
||||
```
|
||||
|
@ -581,6 +581,11 @@ Now, let's check that we successfully published a algorithm (create NFT + Datato
|
|||
## 10. Consumer starts a compute job
|
||||
|
||||
### 10.1 Start a compute job using a free C2D environment
|
||||
datatoken = new Datatoken(
|
||||
consumerAccount,
|
||||
(await consumerAccount.provider.getNetwork()).chainId
|
||||
)
|
||||
|
||||
let's check the free compute environment
|
||||
```Typescript
|
||||
const computeEnv = computeEnvs[resolvedDatasetDdo.chainId].find(
|
||||
|
@ -617,7 +622,7 @@ Let's have 5 minute of compute access
|
|||
computeEnv.id,
|
||||
computeValidUntil,
|
||||
providerUrl,
|
||||
consumerAccount
|
||||
await consumerAccount.getAddress()
|
||||
)
|
||||
```
|
||||
<!--
|
||||
|
@ -640,14 +645,15 @@ Let's have 5 minute of compute access
|
|||
0
|
||||
)
|
||||
}
|
||||
|
||||
const computeJobs = await ProviderInstance.computeStart(
|
||||
providerUrl,
|
||||
web3,
|
||||
consumerAccount,
|
||||
computeEnv.id,
|
||||
assets[0],
|
||||
algo
|
||||
)
|
||||
|
||||
```
|
||||
<!--
|
||||
assert(computeJobs, 'Cannot start compute job')
|
||||
|
@ -664,7 +670,7 @@ You can also add various delays so you see the various states of the compute job
|
|||
```Typescript
|
||||
const jobStatus = await ProviderInstance.computeStatus(
|
||||
providerUrl,
|
||||
consumerAccount,
|
||||
await consumerAccount.getAddress(),
|
||||
computeJobId,
|
||||
DATASET_DDO.id
|
||||
)
|
||||
|
@ -683,7 +689,6 @@ Now, let's see the current status of the previously started computer job
|
|||
await sleep(10000)
|
||||
const downloadURL = await ProviderInstance.getComputeResultUrl(
|
||||
providerUrl,
|
||||
web3,
|
||||
consumerAccount,
|
||||
computeJobId,
|
||||
0
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.
|
|
@ -0,0 +1,192 @@
|
|||
@oceanprotocol/lib / [Exports](modules.md)
|
||||
|
||||
[![banner](https://raw.githubusercontent.com/oceanprotocol/art/master/github/repo-banner%402x.png)](https://oceanprotocol.com)
|
||||
|
||||
<h1 align="center">ocean.js</h1>
|
||||
|
||||
> JavaScript library to privately & securely publish, exchange, and consume data.
|
||||
|
||||
[![npm](https://img.shields.io/npm/v/@oceanprotocol/lib.svg)](https://www.npmjs.com/package/@oceanprotocol/lib)
|
||||
[![Build Status](https://github.com/oceanprotocol/ocean.js/workflows/CI/badge.svg)](https://github.com/oceanprotocol/ocean.js/actions)
|
||||
[![Maintainability](https://api.codeclimate.com/v1/badges/6381c81b8ac568a53537/maintainability)](https://codeclimate.com/github/oceanprotocol/ocean.js/maintainability)
|
||||
[![Test Coverage](https://api.codeclimate.com/v1/badges/6381c81b8ac568a53537/test_coverage)](https://codeclimate.com/github/oceanprotocol/ocean.js/test_coverage)
|
||||
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-7b1173.svg?style=flat-square)](https://github.com/prettier/prettier)
|
||||
[![js oceanprotocol](https://img.shields.io/badge/js-oceanprotocol-7b1173.svg)](https://github.com/oceanprotocol/eslint-config-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 for a fixed price. Sell data NFTs.
|
||||
- **Transfer** data NFTs & datatokens to another owner, and **all other ERC721 & ERC20 actions** using [web3.js](https://web3js.readthedocs.io/en/v1.2.9/web3-eth-contract.html) etc.
|
||||
|
||||
ocean.js is part of the [Ocean Protocol](https://oceanprotocol.com) toolset.
|
||||
|
||||
This is in alpha state. If you run into problems, please open up a [new issue](https://github.com/oceanprotocol/ocean.js/issues/new?assignees=&labels=bug&template=bug_report.md&title=).
|
||||
|
||||
- [📚 Prerequisites](#-prerequisites)
|
||||
- [🏗 Installation & Usage](#-installation--usage)
|
||||
- [🦑 Development](#-development)
|
||||
- [✨ Code Style](#-code-style)
|
||||
- [👩🔬 Testing](#-testing)
|
||||
- [Unit Tests](#unit-tests)
|
||||
- [Integration Tests](#integration-tests)
|
||||
- [🛳 Production](#-production)
|
||||
- [⬆️ Releases](#️-releases)
|
||||
- [Production](#production)
|
||||
- [Pre-Releases](#pre-releases)
|
||||
- [🏛 License](#-license)
|
||||
|
||||
## 📚 Prerequisites
|
||||
|
||||
- node.js ([Install from here](https://nodejs.org/en/download/))
|
||||
- Docker ([Managed as a non-root user](https://docs.docker.com/engine/install/linux-postinstall/))
|
||||
- A Unix based operating system (Mac or Linux)
|
||||
|
||||
## 🏗 Installation & Usage
|
||||
|
||||
```bash
|
||||
npm install @oceanprotocol/lib
|
||||
```
|
||||
|
||||
- Checkout our [code examples](CodeExamples.md) or [compute to data examples](C2DExamples.md) to see how you can use ocean.js.
|
||||
- Refer to the [Ocean Protocol documentation](https://docs.oceanprotocol.com/) for more guides and tutorials.
|
||||
- Visit the [Ocean Protocol website](https://docs.oceanprotocol.com/) for general information about Ocean Protocol.
|
||||
- If you have any difficulties or if you have further questions about how to use ocean.js please reach out to us on [Discord](https://discord.gg/TnXjkR5).
|
||||
- If you notice any bugs or issues with ocean.js please [open an issue on github](https://github.com/oceanprotocol/ocean.js/issues/new?assignees=&labels=bug&template=bug_report.md&title=).
|
||||
|
||||
## 🦑 Development
|
||||
|
||||
The project is authored with TypeScript and compiled with `tsc`.
|
||||
|
||||
To start compiler in watch mode:
|
||||
|
||||
```bash
|
||||
npm install
|
||||
npm start
|
||||
```
|
||||
|
||||
## ✨ Code Style
|
||||
|
||||
For linting and auto-formatting you can use from the root of the project:
|
||||
|
||||
```bash
|
||||
# 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](https://mochajs.org) as test runner, and [nyc](https://github.com/istanbuljs/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](https://github.com/oceanprotocol/barge), which also runs a `ganache-cli` instance:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/oceanprotocol/barge
|
||||
cd barge
|
||||
|
||||
./start_ocean.sh --with-provider2 --no-dashboard --with-c2d
|
||||
```
|
||||
|
||||
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:
|
||||
|
||||
```bash
|
||||
npm test
|
||||
```
|
||||
|
||||
### Unit Tests
|
||||
|
||||
You can execute the unit tests individually with:
|
||||
|
||||
```bash
|
||||
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:
|
||||
|
||||
```bash
|
||||
npm run test:integration
|
||||
# same thing, but with coverage reporting
|
||||
npm run test:integration:cover
|
||||
```
|
||||
|
||||
> Note: On macOS, changes to the `provider`, `metadataCache` and `subgraph` URLs are required, as their default `barge` IPs can not be accessed due to network constraints on macOS. Instead use `http://127.0.0.1` for each direct call to the mentioned services, but keep the internal `provider` URL (`http://172.15.0.4:8030`) hardcoded inside all DDO's `serviceEndpoint`, and when calling `nft.setMetadata()`.
|
||||
|
||||
## 🛳 Production
|
||||
|
||||
To create a production build, run from the root of the project:
|
||||
|
||||
```bash
|
||||
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:
|
||||
|
||||
```bash
|
||||
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](https://github.com/release-it/release-it#github-releases)
|
||||
|
||||
### Pre-Releases
|
||||
|
||||
For pre-releases, this is required for the first one like `v0.18.0-next.0`:
|
||||
|
||||
```bash
|
||||
./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)) 2023 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.
|
||||
```
|
|
@ -0,0 +1,171 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / Aquarius
|
||||
|
||||
# Class: Aquarius
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Constructors
|
||||
|
||||
- [constructor](Aquarius.md#constructor)
|
||||
|
||||
### Properties
|
||||
|
||||
- [aquariusURL](Aquarius.md#aquariusurl)
|
||||
|
||||
### Methods
|
||||
|
||||
- [getAssetMetadata](Aquarius.md#getassetmetadata)
|
||||
- [querySearch](Aquarius.md#querysearch)
|
||||
- [resolve](Aquarius.md#resolve)
|
||||
- [validate](Aquarius.md#validate)
|
||||
- [waitForAqua](Aquarius.md#waitforaqua)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new Aquarius**(`aquariusURL`)
|
||||
|
||||
Instantiate Aquarius
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `aquariusURL` | `string` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/Aquarius.ts:21](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Aquarius.ts#L21)
|
||||
|
||||
## Properties
|
||||
|
||||
### aquariusURL
|
||||
|
||||
• **aquariusURL**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/Aquarius.ts:15](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Aquarius.ts#L15)
|
||||
|
||||
## Methods
|
||||
|
||||
### getAssetMetadata
|
||||
|
||||
▸ **getAssetMetadata**(`did`, `signal?`): `Promise`<`any`\>
|
||||
|
||||
Search over the DDOs using a query.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `did` | `string` | DID of the asset |
|
||||
| `signal?` | `AbortSignal` | abort signal |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/Aquarius.ts:135](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Aquarius.ts#L135)
|
||||
|
||||
___
|
||||
|
||||
### querySearch
|
||||
|
||||
▸ **querySearch**(`query`, `signal?`): `Promise`<`any`\>
|
||||
|
||||
Search over the DDOs using a query.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `query` | [`SearchQuery`](../interfaces/SearchQuery.md) | Query to filter the DDOs. |
|
||||
| `signal?` | `AbortSignal` | abort signal |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/Aquarius.ts:166](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Aquarius.ts#L166)
|
||||
|
||||
___
|
||||
|
||||
### resolve
|
||||
|
||||
▸ **resolve**(`did`, `signal?`): `Promise`<[`Asset`](../interfaces/Asset.md)\>
|
||||
|
||||
Resolves a DID
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `did` | `string` | DID of the asset. |
|
||||
| `signal?` | `AbortSignal` | abort signal |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Asset`](../interfaces/Asset.md)\>
|
||||
|
||||
Asset
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/Aquarius.ts:30](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Aquarius.ts#L30)
|
||||
|
||||
___
|
||||
|
||||
### validate
|
||||
|
||||
▸ **validate**(`ddo`, `signal?`): `Promise`<[`ValidateMetadata`](../interfaces/ValidateMetadata.md)\>
|
||||
|
||||
Validate DDO content
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `ddo` | [`DDO`](../interfaces/DDO.md) | DID Descriptor Object content. |
|
||||
| `signal?` | `AbortSignal` | abort signal |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ValidateMetadata`](../interfaces/ValidateMetadata.md)\>
|
||||
|
||||
.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/Aquarius.ts:94](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Aquarius.ts#L94)
|
||||
|
||||
___
|
||||
|
||||
### waitForAqua
|
||||
|
||||
▸ **waitForAqua**(`did`, `txid?`, `signal?`): `Promise`<[`Asset`](../interfaces/Asset.md)\>
|
||||
|
||||
Blocks until Aqua will cache the did (or the update for that did) or timeouts
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `did` | `string` | DID of the asset. |
|
||||
| `txid?` | `string` | used when the did exists and we expect an update with that txid. |
|
||||
| `signal?` | `AbortSignal` | abort signal |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Asset`](../interfaces/Asset.md)\>
|
||||
|
||||
DDO of the asset.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/Aquarius.ts:58](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Aquarius.ts#L58)
|
|
@ -0,0 +1,481 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / Config
|
||||
|
||||
# Class: Config
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Constructors
|
||||
|
||||
- [constructor](Config.md#constructor)
|
||||
|
||||
### Properties
|
||||
|
||||
- [DFRewards](Config.md#dfrewards)
|
||||
- [DFStrategyV1](Config.md#dfstrategyv1)
|
||||
- [authMessage](Config.md#authmessage)
|
||||
- [authTokenExpiration](Config.md#authtokenexpiration)
|
||||
- [chainId](Config.md#chainid)
|
||||
- [datatokensABI](Config.md#datatokensabi)
|
||||
- [dispenserABI](Config.md#dispenserabi)
|
||||
- [dispenserAddress](Config.md#dispenseraddress)
|
||||
- [explorerUri](Config.md#exploreruri)
|
||||
- [fixedRateExchangeAddress](Config.md#fixedrateexchangeaddress)
|
||||
- [fixedRateExchangeAddressABI](Config.md#fixedrateexchangeaddressabi)
|
||||
- [gasFeeMultiplier](Config.md#gasfeemultiplier)
|
||||
- [metadataCacheUri](Config.md#metadatacacheuri)
|
||||
- [network](Config.md#network)
|
||||
- [nftFactoryAddress](Config.md#nftfactoryaddress)
|
||||
- [nodeUri](Config.md#nodeuri)
|
||||
- [oceanTokenAddress](Config.md#oceantokenaddress)
|
||||
- [oceanTokenSymbol](Config.md#oceantokensymbol)
|
||||
- [opfCommunityFeeCollector](Config.md#opfcommunityfeecollector)
|
||||
- [parityUri](Config.md#parityuri)
|
||||
- [providerAddress](Config.md#provideraddress)
|
||||
- [providerUri](Config.md#provideruri)
|
||||
- [sideStakingAddress](Config.md#sidestakingaddress)
|
||||
- [startBlock](Config.md#startblock)
|
||||
- [subgraphUri](Config.md#subgraphuri)
|
||||
- [threshold](Config.md#threshold)
|
||||
- [transactionBlockTimeout](Config.md#transactionblocktimeout)
|
||||
- [transactionConfirmationBlocks](Config.md#transactionconfirmationblocks)
|
||||
- [transactionPollingTimeout](Config.md#transactionpollingtimeout)
|
||||
- [veAllocate](Config.md#veallocate)
|
||||
- [veDelegation](Config.md#vedelegation)
|
||||
- [veDelegationProxy](Config.md#vedelegationproxy)
|
||||
- [veFeeDistributor](Config.md#vefeedistributor)
|
||||
- [veFeeEstimate](Config.md#vefeeestimate)
|
||||
- [veOCEAN](Config.md#veocean)
|
||||
- [verbose](Config.md#verbose)
|
||||
- [web3Provider](Config.md#web3provider)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new Config**()
|
||||
|
||||
## Properties
|
||||
|
||||
### DFRewards
|
||||
|
||||
• `Optional` **DFRewards**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/Config.ts:180](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/Config.ts#L180)
|
||||
|
||||
___
|
||||
|
||||
### DFStrategyV1
|
||||
|
||||
• `Optional` **DFStrategyV1**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/Config.ts:181](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/Config.ts#L181)
|
||||
|
||||
___
|
||||
|
||||
### authMessage
|
||||
|
||||
• `Optional` **authMessage**: `string`
|
||||
|
||||
Message shown when the user creates its own token.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/Config.ts:105](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/Config.ts#L105)
|
||||
|
||||
___
|
||||
|
||||
### authTokenExpiration
|
||||
|
||||
• `Optional` **authTokenExpiration**: `number`
|
||||
|
||||
Token expiration time in ms.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/Config.ts:111](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/Config.ts#L111)
|
||||
|
||||
___
|
||||
|
||||
### chainId
|
||||
|
||||
• **chainId**: `number`
|
||||
|
||||
Chain ID
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/Config.ts:125](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/Config.ts#L125)
|
||||
|
||||
___
|
||||
|
||||
### datatokensABI
|
||||
|
||||
• `Optional` **datatokensABI**: [`AbiItem`](../interfaces/AbiItem.md) \| [`AbiItem`](../interfaces/AbiItem.md)[]
|
||||
|
||||
datatokens ABI
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/Config.ts:52](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/Config.ts#L52)
|
||||
|
||||
___
|
||||
|
||||
### dispenserABI
|
||||
|
||||
• `Optional` **dispenserABI**: [`AbiItem`](../interfaces/AbiItem.md) \| [`AbiItem`](../interfaces/AbiItem.md)[]
|
||||
|
||||
DispenserABI
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/Config.ts:76](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/Config.ts#L76)
|
||||
|
||||
___
|
||||
|
||||
### dispenserAddress
|
||||
|
||||
• `Optional` **dispenserAddress**: `string`
|
||||
|
||||
DispenserAddress
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/Config.ts:70](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/Config.ts#L70)
|
||||
|
||||
___
|
||||
|
||||
### explorerUri
|
||||
|
||||
• **explorerUri**: `string`
|
||||
|
||||
Url of the blockchain exporer ex: https://etherscan.io
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/Config.ts:143](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/Config.ts#L143)
|
||||
|
||||
___
|
||||
|
||||
### fixedRateExchangeAddress
|
||||
|
||||
• `Optional` **fixedRateExchangeAddress**: `string`
|
||||
|
||||
FixedRateExchangeAddress
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/Config.ts:58](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/Config.ts#L58)
|
||||
|
||||
___
|
||||
|
||||
### fixedRateExchangeAddressABI
|
||||
|
||||
• `Optional` **fixedRateExchangeAddressABI**: [`AbiItem`](../interfaces/AbiItem.md) \| [`AbiItem`](../interfaces/AbiItem.md)[]
|
||||
|
||||
FixedRateExchangeAddressABI
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/Config.ts:64](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/Config.ts#L64)
|
||||
|
||||
___
|
||||
|
||||
### gasFeeMultiplier
|
||||
|
||||
• **gasFeeMultiplier**: `number`
|
||||
|
||||
Specify the multiplier for the gas fee
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/Config.ts:173](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/Config.ts#L173)
|
||||
|
||||
___
|
||||
|
||||
### metadataCacheUri
|
||||
|
||||
• `Optional` **metadataCacheUri**: `string`
|
||||
|
||||
Metadata Store URL.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/Config.ts:21](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/Config.ts#L21)
|
||||
|
||||
___
|
||||
|
||||
### network
|
||||
|
||||
• **network**: `string`
|
||||
|
||||
Network name ex: mainnet, goerli, polygon
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/Config.ts:131](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/Config.ts#L131)
|
||||
|
||||
___
|
||||
|
||||
### nftFactoryAddress
|
||||
|
||||
• `Optional` **nftFactoryAddress**: `string`
|
||||
|
||||
Factory address
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/Config.ts:46](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/Config.ts#L46)
|
||||
|
||||
___
|
||||
|
||||
### nodeUri
|
||||
|
||||
• `Optional` **nodeUri**: `string`
|
||||
|
||||
Ethereum node URL.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/Config.ts:9](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/Config.ts#L9)
|
||||
|
||||
___
|
||||
|
||||
### oceanTokenAddress
|
||||
|
||||
• `Optional` **oceanTokenAddress**: `string`
|
||||
|
||||
Ocean Token address
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/Config.ts:40](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/Config.ts#L40)
|
||||
|
||||
___
|
||||
|
||||
### oceanTokenSymbol
|
||||
|
||||
• **oceanTokenSymbol**: `string`
|
||||
|
||||
Ocean toke symbol on the chain, it's used just for convenience to reduce number of calls
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/Config.ts:149](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/Config.ts#L149)
|
||||
|
||||
___
|
||||
|
||||
### opfCommunityFeeCollector
|
||||
|
||||
• `Optional` **opfCommunityFeeCollector**: `string`
|
||||
|
||||
OPFCommunityFeeCollector
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/Config.ts:82](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/Config.ts#L82)
|
||||
|
||||
___
|
||||
|
||||
### parityUri
|
||||
|
||||
• `Optional` **parityUri**: `string`
|
||||
|
||||
Parity config
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/Config.ts:117](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/Config.ts#L117)
|
||||
|
||||
___
|
||||
|
||||
### providerAddress
|
||||
|
||||
• `Optional` **providerAddress**: `string`
|
||||
|
||||
Address of Provider.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/Config.ts:15](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/Config.ts#L15)
|
||||
|
||||
___
|
||||
|
||||
### providerUri
|
||||
|
||||
• `Optional` **providerUri**: `string`
|
||||
|
||||
Provider URL.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/Config.ts:27](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/Config.ts#L27)
|
||||
|
||||
___
|
||||
|
||||
### sideStakingAddress
|
||||
|
||||
• `Optional` **sideStakingAddress**: `string`
|
||||
|
||||
SideStaking address
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/Config.ts:88](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/Config.ts#L88)
|
||||
|
||||
___
|
||||
|
||||
### startBlock
|
||||
|
||||
• `Optional` **startBlock**: `number`
|
||||
|
||||
block number of the deployment
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/Config.ts:94](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/Config.ts#L94)
|
||||
|
||||
___
|
||||
|
||||
### subgraphUri
|
||||
|
||||
• **subgraphUri**: `string`
|
||||
|
||||
Url of the relevant subgraph instance ex: https://subgraph.mainnet.oceanprotocol.com
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/Config.ts:137](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/Config.ts#L137)
|
||||
|
||||
___
|
||||
|
||||
### threshold
|
||||
|
||||
• `Optional` **threshold**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/Config.ts:119](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/Config.ts#L119)
|
||||
|
||||
___
|
||||
|
||||
### transactionBlockTimeout
|
||||
|
||||
• **transactionBlockTimeout**: `number`
|
||||
|
||||
Specify the transaction Block Timeout
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/Config.ts:155](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/Config.ts#L155)
|
||||
|
||||
___
|
||||
|
||||
### transactionConfirmationBlocks
|
||||
|
||||
• **transactionConfirmationBlocks**: `number`
|
||||
|
||||
Specify the transaction Confirmation Blocks
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/Config.ts:161](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/Config.ts#L161)
|
||||
|
||||
___
|
||||
|
||||
### transactionPollingTimeout
|
||||
|
||||
• **transactionPollingTimeout**: `number`
|
||||
|
||||
Specify the transaction Polling Blocks Timeout
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/Config.ts:167](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/Config.ts#L167)
|
||||
|
||||
___
|
||||
|
||||
### veAllocate
|
||||
|
||||
• `Optional` **veAllocate**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/Config.ts:175](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/Config.ts#L175)
|
||||
|
||||
___
|
||||
|
||||
### veDelegation
|
||||
|
||||
• `Optional` **veDelegation**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/Config.ts:177](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/Config.ts#L177)
|
||||
|
||||
___
|
||||
|
||||
### veDelegationProxy
|
||||
|
||||
• `Optional` **veDelegationProxy**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/Config.ts:179](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/Config.ts#L179)
|
||||
|
||||
___
|
||||
|
||||
### veFeeDistributor
|
||||
|
||||
• `Optional` **veFeeDistributor**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/Config.ts:178](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/Config.ts#L178)
|
||||
|
||||
___
|
||||
|
||||
### veFeeEstimate
|
||||
|
||||
• `Optional` **veFeeEstimate**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/Config.ts:182](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/Config.ts#L182)
|
||||
|
||||
___
|
||||
|
||||
### veOCEAN
|
||||
|
||||
• `Optional` **veOCEAN**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/Config.ts:176](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/Config.ts#L176)
|
||||
|
||||
___
|
||||
|
||||
### verbose
|
||||
|
||||
• `Optional` **verbose**: `boolean` \| [`LogLevel`](../enums/LogLevel.md)
|
||||
|
||||
Log level.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/Config.ts:99](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/Config.ts#L99)
|
||||
|
||||
___
|
||||
|
||||
### web3Provider
|
||||
|
||||
• `Optional` **web3Provider**: `any`
|
||||
|
||||
Web3 Provider.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/Config.ts:34](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/Config.ts#L34)
|
|
@ -0,0 +1,66 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / ConfigHelper
|
||||
|
||||
# Class: ConfigHelper
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Constructors
|
||||
|
||||
- [constructor](ConfigHelper.md#constructor)
|
||||
|
||||
### Methods
|
||||
|
||||
- [getAddressesFromEnv](ConfigHelper.md#getaddressesfromenv)
|
||||
- [getConfig](ConfigHelper.md#getconfig)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new ConfigHelper**()
|
||||
|
||||
## Methods
|
||||
|
||||
### getAddressesFromEnv
|
||||
|
||||
▸ **getAddressesFromEnv**(`network`, `customAddresses?`): `Partial`<[`Config`](Config.md)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `network` | `string` |
|
||||
| `customAddresses?` | `any` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Partial`<[`Config`](Config.md)\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/ConfigHelper.ts:124](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/ConfigHelper.ts#L124)
|
||||
|
||||
___
|
||||
|
||||
### getConfig
|
||||
|
||||
▸ **getConfig**(`network`, `infuraProjectId?`): [`Config`](Config.md)
|
||||
|
||||
Returns the config object for a specific network supported by the oceanprotocol stack
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `network` | `string` \| `number` | the network's chainId or name |
|
||||
| `infuraProjectId?` | `string` | optional infura project id that will replace the configs node URI |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Config`](Config.md)
|
||||
|
||||
Config obhjedct
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/ConfigHelper.ts:214](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/ConfigHelper.ts#L214)
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,345 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / DfRewards
|
||||
|
||||
# Class: DfRewards
|
||||
|
||||
Provides an interface for DFRewards contract
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- [`SmartContractWithAddress`](SmartContractWithAddress.md)
|
||||
|
||||
↳ **`DfRewards`**
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Constructors
|
||||
|
||||
- [constructor](DfRewards.md#constructor)
|
||||
|
||||
### Properties
|
||||
|
||||
- [abi](DfRewards.md#abi)
|
||||
- [address](DfRewards.md#address)
|
||||
- [config](DfRewards.md#config)
|
||||
- [contract](DfRewards.md#contract)
|
||||
- [signer](DfRewards.md#signer)
|
||||
|
||||
### Methods
|
||||
|
||||
- [allocateRewards](DfRewards.md#allocaterewards)
|
||||
- [amountToUnits](DfRewards.md#amounttounits)
|
||||
- [claimRewards](DfRewards.md#claimrewards)
|
||||
- [getAvailableRewards](DfRewards.md#getavailablerewards)
|
||||
- [getContract](DfRewards.md#getcontract)
|
||||
- [getDefaultAbi](DfRewards.md#getdefaultabi)
|
||||
- [getFairGasPrice](DfRewards.md#getfairgasprice)
|
||||
- [unitsToAmount](DfRewards.md#unitstoamount)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new DfRewards**(`address`, `signer`, `network?`, `config?`, `abi?`)
|
||||
|
||||
Instantiate the smart contract.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `address` | `string` | The address of the contract. |
|
||||
| `signer` | `Signer` | The signer object. |
|
||||
| `network?` | `string` \| `number` | Network id or name |
|
||||
| `config?` | [`Config`](Config.md) | The configuration object. |
|
||||
| `abi?` | [`AbiItem`](../interfaces/AbiItem.md)[] | ABI array of the smart contract |
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[constructor](SmartContractWithAddress.md#constructor)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContractWithAddress.ts:17](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L17)
|
||||
|
||||
## Properties
|
||||
|
||||
### abi
|
||||
|
||||
• **abi**: [`AbiItem`](../interfaces/AbiItem.md)[]
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[abi](SmartContractWithAddress.md#abi)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:14](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### address
|
||||
|
||||
• **address**: `string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[address](SmartContractWithAddress.md#address)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContractWithAddress.ts:6](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L6)
|
||||
|
||||
___
|
||||
|
||||
### config
|
||||
|
||||
• **config**: [`Config`](Config.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[config](SmartContractWithAddress.md#config)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:13](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### contract
|
||||
|
||||
• **contract**: `Contract`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[contract](SmartContractWithAddress.md#contract)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContractWithAddress.ts:7](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L7)
|
||||
|
||||
___
|
||||
|
||||
### signer
|
||||
|
||||
• **signer**: `Signer`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[signer](SmartContractWithAddress.md#signer)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:12](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L12)
|
||||
|
||||
## Methods
|
||||
|
||||
### allocateRewards
|
||||
|
||||
▸ **allocateRewards**<`G`\>(`userAddresses`, `amounts`, `tokenAddress`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
allocate rewards to address. An approve must exist before calling this function.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `userAddresses` | `string`[] | array of users that will receive rewards |
|
||||
| `amounts` | `string`[] | array of amounts |
|
||||
| `tokenAddress` | `string` | token address |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/df/DfRewards.ts:64](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/df/DfRewards.ts#L64)
|
||||
|
||||
___
|
||||
|
||||
### amountToUnits
|
||||
|
||||
▸ `Protected` **amountToUnits**(`token`, `amount`, `tokenDecimals?`): `Promise`<`string`\>
|
||||
|
||||
Converts an amount of tokens to units
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `token` | `string` | The token to convert |
|
||||
| `amount` | `string` | The amount of tokens to convert |
|
||||
| `tokenDecimals?` | `number` | The number of decimals of the token |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The converted amount in units
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[amountToUnits](SmartContractWithAddress.md#amounttounits)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:43](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L43)
|
||||
|
||||
___
|
||||
|
||||
### claimRewards
|
||||
|
||||
▸ **claimRewards**<`G`\>(`userAddress`, `tokenAddress`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
claim rewards for any address
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `userAddress` | `string` | user address to claim |
|
||||
| `tokenAddress` | `string` | token address |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/df/DfRewards.ts:36](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/df/DfRewards.ts#L36)
|
||||
|
||||
___
|
||||
|
||||
### getAvailableRewards
|
||||
|
||||
▸ **getAvailableRewards**(`userAddress`, `tokenAddress`): `Promise`<`string`\>
|
||||
|
||||
Get available DF Rewards for a token
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `userAddress` | `string` | user address |
|
||||
| `tokenAddress` | `string` | token address |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/df/DfRewards.ts:19](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/df/DfRewards.ts#L19)
|
||||
|
||||
___
|
||||
|
||||
### getContract
|
||||
|
||||
▸ `Protected` **getContract**(`address`, `abi?`): `Contract`
|
||||
|
||||
Returns a contract instance for the given address
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `address` | `string` | The address of the contract |
|
||||
| `abi?` | [`AbiItem`](../interfaces/AbiItem.md)[] | The ABI of the contract |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Contract`
|
||||
|
||||
- The contract instance
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[getContract](SmartContractWithAddress.md#getcontract)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:80](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L80)
|
||||
|
||||
___
|
||||
|
||||
### getDefaultAbi
|
||||
|
||||
▸ **getDefaultAbi**(): [`AbiItem`](../interfaces/AbiItem.md)[]
|
||||
|
||||
#### Returns
|
||||
|
||||
[`AbiItem`](../interfaces/AbiItem.md)[]
|
||||
|
||||
#### Overrides
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[getDefaultAbi](SmartContractWithAddress.md#getdefaultabi)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/df/DfRewards.ts:10](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/df/DfRewards.ts#L10)
|
||||
|
||||
___
|
||||
|
||||
### getFairGasPrice
|
||||
|
||||
▸ `Protected` **getFairGasPrice**(): `Promise`<`string`\>
|
||||
|
||||
Retruns the gas price
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The fair gas price
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[getFairGasPrice](SmartContractWithAddress.md#getfairgasprice)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:70](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L70)
|
||||
|
||||
___
|
||||
|
||||
### unitsToAmount
|
||||
|
||||
▸ `Protected` **unitsToAmount**(`token`, `amount`, `tokenDecimals?`): `Promise`<`string`\>
|
||||
|
||||
Converts an amount of units to tokens
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `token` | `string` | The token to convert |
|
||||
| `amount` | `string` | The amount of units to convert |
|
||||
| `tokenDecimals?` | `number` | The number of decimals in the token |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The converted amount in tokens
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[unitsToAmount](SmartContractWithAddress.md#unitstoamount)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:58](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L58)
|
|
@ -0,0 +1,313 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / DfStrategyV1
|
||||
|
||||
# Class: DfStrategyV1
|
||||
|
||||
Provides an interface for dfStrategyV1 contract
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- [`SmartContractWithAddress`](SmartContractWithAddress.md)
|
||||
|
||||
↳ **`DfStrategyV1`**
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Constructors
|
||||
|
||||
- [constructor](DfStrategyV1.md#constructor)
|
||||
|
||||
### Properties
|
||||
|
||||
- [abi](DfStrategyV1.md#abi)
|
||||
- [address](DfStrategyV1.md#address)
|
||||
- [config](DfStrategyV1.md#config)
|
||||
- [contract](DfStrategyV1.md#contract)
|
||||
- [signer](DfStrategyV1.md#signer)
|
||||
|
||||
### Methods
|
||||
|
||||
- [amountToUnits](DfStrategyV1.md#amounttounits)
|
||||
- [claimMultipleRewards](DfStrategyV1.md#claimmultiplerewards)
|
||||
- [getContract](DfStrategyV1.md#getcontract)
|
||||
- [getDefaultAbi](DfStrategyV1.md#getdefaultabi)
|
||||
- [getFairGasPrice](DfStrategyV1.md#getfairgasprice)
|
||||
- [getMultipleAvailableRewards](DfStrategyV1.md#getmultipleavailablerewards)
|
||||
- [unitsToAmount](DfStrategyV1.md#unitstoamount)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new DfStrategyV1**(`address`, `signer`, `network?`, `config?`, `abi?`)
|
||||
|
||||
Instantiate the smart contract.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `address` | `string` | The address of the contract. |
|
||||
| `signer` | `Signer` | The signer object. |
|
||||
| `network?` | `string` \| `number` | Network id or name |
|
||||
| `config?` | [`Config`](Config.md) | The configuration object. |
|
||||
| `abi?` | [`AbiItem`](../interfaces/AbiItem.md)[] | ABI array of the smart contract |
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[constructor](SmartContractWithAddress.md#constructor)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContractWithAddress.ts:17](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L17)
|
||||
|
||||
## Properties
|
||||
|
||||
### abi
|
||||
|
||||
• **abi**: [`AbiItem`](../interfaces/AbiItem.md)[]
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[abi](SmartContractWithAddress.md#abi)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:14](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### address
|
||||
|
||||
• **address**: `string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[address](SmartContractWithAddress.md#address)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContractWithAddress.ts:6](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L6)
|
||||
|
||||
___
|
||||
|
||||
### config
|
||||
|
||||
• **config**: [`Config`](Config.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[config](SmartContractWithAddress.md#config)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:13](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### contract
|
||||
|
||||
• **contract**: `Contract`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[contract](SmartContractWithAddress.md#contract)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContractWithAddress.ts:7](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L7)
|
||||
|
||||
___
|
||||
|
||||
### signer
|
||||
|
||||
• **signer**: `Signer`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[signer](SmartContractWithAddress.md#signer)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:12](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L12)
|
||||
|
||||
## Methods
|
||||
|
||||
### amountToUnits
|
||||
|
||||
▸ `Protected` **amountToUnits**(`token`, `amount`, `tokenDecimals?`): `Promise`<`string`\>
|
||||
|
||||
Converts an amount of tokens to units
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `token` | `string` | The token to convert |
|
||||
| `amount` | `string` | The amount of tokens to convert |
|
||||
| `tokenDecimals?` | `number` | The number of decimals of the token |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The converted amount in units
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[amountToUnits](SmartContractWithAddress.md#amounttounits)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:43](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L43)
|
||||
|
||||
___
|
||||
|
||||
### claimMultipleRewards
|
||||
|
||||
▸ **claimMultipleRewards**<`G`\>(`userAddress`, `tokenAddresses`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
claim multiple token rewards for any address
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `userAddress` | `string` | user address to claim |
|
||||
| `tokenAddresses` | `string`[] | array of tokens |
|
||||
| `estimateGas?` | `G` | - |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/df/DfStrategyV1.ts:36](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/df/DfStrategyV1.ts#L36)
|
||||
|
||||
___
|
||||
|
||||
### getContract
|
||||
|
||||
▸ `Protected` **getContract**(`address`, `abi?`): `Contract`
|
||||
|
||||
Returns a contract instance for the given address
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `address` | `string` | The address of the contract |
|
||||
| `abi?` | [`AbiItem`](../interfaces/AbiItem.md)[] | The ABI of the contract |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Contract`
|
||||
|
||||
- The contract instance
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[getContract](SmartContractWithAddress.md#getcontract)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:80](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L80)
|
||||
|
||||
___
|
||||
|
||||
### getDefaultAbi
|
||||
|
||||
▸ **getDefaultAbi**(): [`AbiItem`](../interfaces/AbiItem.md)[]
|
||||
|
||||
#### Returns
|
||||
|
||||
[`AbiItem`](../interfaces/AbiItem.md)[]
|
||||
|
||||
#### Overrides
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[getDefaultAbi](SmartContractWithAddress.md#getdefaultabi)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/df/DfStrategyV1.ts:9](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/df/DfStrategyV1.ts#L9)
|
||||
|
||||
___
|
||||
|
||||
### getFairGasPrice
|
||||
|
||||
▸ `Protected` **getFairGasPrice**(): `Promise`<`string`\>
|
||||
|
||||
Retruns the gas price
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The fair gas price
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[getFairGasPrice](SmartContractWithAddress.md#getfairgasprice)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:70](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L70)
|
||||
|
||||
___
|
||||
|
||||
### getMultipleAvailableRewards
|
||||
|
||||
▸ **getMultipleAvailableRewards**(`userAddress`, `tokenAddresses`): `Promise`<`string`[]\>
|
||||
|
||||
Get available DF Rewards for multiple tokens
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `userAddress` | `string` | user address |
|
||||
| `tokenAddresses` | `string`[] | array of tokens |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`[]\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/df/DfStrategyV1.ts:18](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/df/DfStrategyV1.ts#L18)
|
||||
|
||||
___
|
||||
|
||||
### unitsToAmount
|
||||
|
||||
▸ `Protected` **unitsToAmount**(`token`, `amount`, `tokenDecimals?`): `Promise`<`string`\>
|
||||
|
||||
Converts an amount of units to tokens
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `token` | `string` | The token to convert |
|
||||
| `amount` | `string` | The amount of units to convert |
|
||||
| `tokenDecimals?` | `number` | The number of decimals in the token |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The converted amount in tokens
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[unitsToAmount](SmartContractWithAddress.md#unitstoamount)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:58](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L58)
|
|
@ -0,0 +1,502 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / Dispenser
|
||||
|
||||
# Class: Dispenser
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- [`SmartContractWithAddress`](SmartContractWithAddress.md)
|
||||
|
||||
↳ **`Dispenser`**
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Constructors
|
||||
|
||||
- [constructor](Dispenser.md#constructor)
|
||||
|
||||
### Properties
|
||||
|
||||
- [abi](Dispenser.md#abi)
|
||||
- [address](Dispenser.md#address)
|
||||
- [config](Dispenser.md#config)
|
||||
- [contract](Dispenser.md#contract)
|
||||
- [signer](Dispenser.md#signer)
|
||||
|
||||
### Methods
|
||||
|
||||
- [activate](Dispenser.md#activate)
|
||||
- [amountToUnits](Dispenser.md#amounttounits)
|
||||
- [create](Dispenser.md#create)
|
||||
- [deactivate](Dispenser.md#deactivate)
|
||||
- [dispense](Dispenser.md#dispense)
|
||||
- [getContract](Dispenser.md#getcontract)
|
||||
- [getDefaultAbi](Dispenser.md#getdefaultabi)
|
||||
- [getFairGasPrice](Dispenser.md#getfairgasprice)
|
||||
- [isDispensable](Dispenser.md#isdispensable)
|
||||
- [ownerWithdraw](Dispenser.md#ownerwithdraw)
|
||||
- [setAllowedSwapper](Dispenser.md#setallowedswapper)
|
||||
- [status](Dispenser.md#status)
|
||||
- [unitsToAmount](Dispenser.md#unitstoamount)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new Dispenser**(`address`, `signer`, `network?`, `config?`, `abi?`)
|
||||
|
||||
Instantiate the smart contract.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `address` | `string` | The address of the contract. |
|
||||
| `signer` | `Signer` | The signer object. |
|
||||
| `network?` | `string` \| `number` | Network id or name |
|
||||
| `config?` | [`Config`](Config.md) | The configuration object. |
|
||||
| `abi?` | [`AbiItem`](../interfaces/AbiItem.md)[] | ABI array of the smart contract |
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[constructor](SmartContractWithAddress.md#constructor)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContractWithAddress.ts:17](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L17)
|
||||
|
||||
## Properties
|
||||
|
||||
### abi
|
||||
|
||||
• **abi**: [`AbiItem`](../interfaces/AbiItem.md)[]
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[abi](SmartContractWithAddress.md#abi)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:14](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### address
|
||||
|
||||
• **address**: `string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[address](SmartContractWithAddress.md#address)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContractWithAddress.ts:6](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L6)
|
||||
|
||||
___
|
||||
|
||||
### config
|
||||
|
||||
• **config**: [`Config`](Config.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[config](SmartContractWithAddress.md#config)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:13](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### contract
|
||||
|
||||
• **contract**: `Contract`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[contract](SmartContractWithAddress.md#contract)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContractWithAddress.ts:7](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L7)
|
||||
|
||||
___
|
||||
|
||||
### signer
|
||||
|
||||
• **signer**: `Signer`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[signer](SmartContractWithAddress.md#signer)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:12](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L12)
|
||||
|
||||
## Methods
|
||||
|
||||
### activate
|
||||
|
||||
▸ **activate**<`G`\>(`dtAddress`, `maxTokens`, `maxBalance`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Activates a dispener.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `dtAddress` | `string` | refers to datatoken address. |
|
||||
| `maxTokens` | `string` | max amount of tokens to dispense |
|
||||
| `maxBalance` | `string` | max balance of user. If user balance is >, then dispense will be rejected |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
TransactionReceipt
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/Dispenser.ts:86](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Dispenser.ts#L86)
|
||||
|
||||
___
|
||||
|
||||
### amountToUnits
|
||||
|
||||
▸ `Protected` **amountToUnits**(`token`, `amount`, `tokenDecimals?`): `Promise`<`string`\>
|
||||
|
||||
Converts an amount of tokens to units
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `token` | `string` | The token to convert |
|
||||
| `amount` | `string` | The amount of tokens to convert |
|
||||
| `tokenDecimals?` | `number` | The number of decimals of the token |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The converted amount in units
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[amountToUnits](SmartContractWithAddress.md#amounttounits)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:43](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L43)
|
||||
|
||||
___
|
||||
|
||||
### create
|
||||
|
||||
▸ **create**<`G`\>(`dtAddress`, `address`, `maxTokens`, `maxBalance`, `allowedSwapper`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Creates a new Dispenser
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `dtAddress` | `string` | Datatoken address |
|
||||
| `address` | `string` | Owner address |
|
||||
| `maxTokens` | `string` | max tokens to dispense |
|
||||
| `maxBalance` | `string` | max balance of requester |
|
||||
| `allowedSwapper` | `string` | only account that can ask tokens. set address(0) if not required |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
transactionId
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/Dispenser.ts:45](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Dispenser.ts#L45)
|
||||
|
||||
___
|
||||
|
||||
### deactivate
|
||||
|
||||
▸ **deactivate**<`G`\>(`dtAddress`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Deactivate an existing dispenser.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `dtAddress` | `string` | refers to datatoken address. |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
TransactionReceipt
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/Dispenser.ts:118](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Dispenser.ts#L118)
|
||||
|
||||
___
|
||||
|
||||
### dispense
|
||||
|
||||
▸ **dispense**<`G`\>(`dtAddress`, `amount?`, `destination`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Dispense datatokens to caller.
|
||||
The dispenser must be active, hold enough datatokens (or be able to mint more)
|
||||
and respect maxTokens/maxBalance requirements
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| :------ | :------ | :------ | :------ |
|
||||
| `dtAddress` | `string` | `undefined` | Datatoken address. |
|
||||
| `amount` | `string` | `'1'` | Amount of datatokens required. |
|
||||
| `destination` | `string` | `undefined` | address of tokens receiver |
|
||||
| `estimateGas?` | `G` | `undefined` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/Dispenser.ts:175](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Dispenser.ts#L175)
|
||||
|
||||
___
|
||||
|
||||
### getContract
|
||||
|
||||
▸ `Protected` **getContract**(`address`, `abi?`): `Contract`
|
||||
|
||||
Returns a contract instance for the given address
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `address` | `string` | The address of the contract |
|
||||
| `abi?` | [`AbiItem`](../interfaces/AbiItem.md)[] | The ABI of the contract |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Contract`
|
||||
|
||||
- The contract instance
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[getContract](SmartContractWithAddress.md#getcontract)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:80](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L80)
|
||||
|
||||
___
|
||||
|
||||
### getDefaultAbi
|
||||
|
||||
▸ **getDefaultAbi**(): [`AbiItem`](../interfaces/AbiItem.md)[]
|
||||
|
||||
#### Returns
|
||||
|
||||
[`AbiItem`](../interfaces/AbiItem.md)[]
|
||||
|
||||
#### Overrides
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[getDefaultAbi](SmartContractWithAddress.md#getdefaultabi)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/Dispenser.ts:9](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Dispenser.ts#L9)
|
||||
|
||||
___
|
||||
|
||||
### getFairGasPrice
|
||||
|
||||
▸ `Protected` **getFairGasPrice**(): `Promise`<`string`\>
|
||||
|
||||
Retruns the gas price
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The fair gas price
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[getFairGasPrice](SmartContractWithAddress.md#getfairgasprice)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:70](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L70)
|
||||
|
||||
___
|
||||
|
||||
### isDispensable
|
||||
|
||||
▸ **isDispensable**(`dtAddress`, `datatoken`, `address`, `amount?`): `Promise`<`Boolean`\>
|
||||
|
||||
Check if tokens can be dispensed
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| :------ | :------ | :------ | :------ |
|
||||
| `dtAddress` | `string` | `undefined` | Datatoken address |
|
||||
| `datatoken` | [`Datatoken`](Datatoken.md) | `undefined` | - |
|
||||
| `address` | `string` | `undefined` | User address that will receive datatokens |
|
||||
| `amount` | `string` | `'1'` | amount of datatokens required. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Boolean`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/Dispenser.ts:231](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Dispenser.ts#L231)
|
||||
|
||||
___
|
||||
|
||||
### ownerWithdraw
|
||||
|
||||
▸ **ownerWithdraw**<`G`\>(`dtAddress`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Withdraw all tokens from the dispenser
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `dtAddress` | `string` | Datatoken address. |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/Dispenser.ts:206](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Dispenser.ts#L206)
|
||||
|
||||
___
|
||||
|
||||
### setAllowedSwapper
|
||||
|
||||
▸ **setAllowedSwapper**<`G`\>(`dtAddress`, `newAllowedSwapper`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Sets a new allowed swapper.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `dtAddress` | `string` | Datatoken address. |
|
||||
| `newAllowedSwapper` | `string` | The address of the new allowed swapper. |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/Dispenser.ts:143](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Dispenser.ts#L143)
|
||||
|
||||
___
|
||||
|
||||
### status
|
||||
|
||||
▸ **status**(`dtAdress`): `Promise`<[`DispenserToken`](../interfaces/DispenserToken.md)\>
|
||||
|
||||
Get information about a datatoken dispenser
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `dtAdress` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`DispenserToken`](../interfaces/DispenserToken.md)\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/Dispenser.ts:18](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Dispenser.ts#L18)
|
||||
|
||||
___
|
||||
|
||||
### unitsToAmount
|
||||
|
||||
▸ `Protected` **unitsToAmount**(`token`, `amount`, `tokenDecimals?`): `Promise`<`string`\>
|
||||
|
||||
Converts an amount of units to tokens
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `token` | `string` | The token to convert |
|
||||
| `amount` | `string` | The amount of units to convert |
|
||||
| `tokenDecimals?` | `number` | The number of decimals in the token |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The converted amount in tokens
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[unitsToAmount](SmartContractWithAddress.md#unitstoamount)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:58](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L58)
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,191 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / Logger
|
||||
|
||||
# Class: Logger
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Constructors
|
||||
|
||||
- [constructor](Logger.md#constructor)
|
||||
|
||||
### Properties
|
||||
|
||||
- [logLevel](Logger.md#loglevel)
|
||||
|
||||
### Methods
|
||||
|
||||
- [bypass](Logger.md#bypass)
|
||||
- [debug](Logger.md#debug)
|
||||
- [dispatch](Logger.md#dispatch)
|
||||
- [error](Logger.md#error)
|
||||
- [log](Logger.md#log)
|
||||
- [setLevel](Logger.md#setlevel)
|
||||
- [warn](Logger.md#warn)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new Logger**(`logLevel?`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value |
|
||||
| :------ | :------ | :------ |
|
||||
| `logLevel` | [`LogLevel`](../enums/LogLevel.md) | `LogLevel.Error` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/Logger.ts:12](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/Logger.ts#L12)
|
||||
|
||||
## Properties
|
||||
|
||||
### logLevel
|
||||
|
||||
• `Private` **logLevel**: [`LogLevel`](../enums/LogLevel.md) = `LogLevel.Error`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/Logger.ts:12](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/Logger.ts#L12)
|
||||
|
||||
## Methods
|
||||
|
||||
### bypass
|
||||
|
||||
▸ **bypass**(`...args`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `...args` | `any`[] |
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/Logger.ts:18](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/Logger.ts#L18)
|
||||
|
||||
___
|
||||
|
||||
### debug
|
||||
|
||||
▸ **debug**(`...args`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `...args` | `any`[] |
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/Logger.ts:22](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/Logger.ts#L22)
|
||||
|
||||
___
|
||||
|
||||
### dispatch
|
||||
|
||||
▸ `Private` **dispatch**(`verb`, `level`, `...args`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `verb` | `string` |
|
||||
| `level` | [`LogLevel`](../enums/LogLevel.md) |
|
||||
| `...args` | `any`[] |
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/Logger.ts:38](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/Logger.ts#L38)
|
||||
|
||||
___
|
||||
|
||||
### error
|
||||
|
||||
▸ **error**(`...args`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `...args` | `any`[] |
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/Logger.ts:34](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/Logger.ts#L34)
|
||||
|
||||
___
|
||||
|
||||
### log
|
||||
|
||||
▸ **log**(`...args`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `...args` | `any`[] |
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/Logger.ts:26](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/Logger.ts#L26)
|
||||
|
||||
___
|
||||
|
||||
### setLevel
|
||||
|
||||
▸ **setLevel**(`logLevel`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `logLevel` | [`LogLevel`](../enums/LogLevel.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/Logger.ts:14](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/Logger.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### warn
|
||||
|
||||
▸ **warn**(`...args`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `...args` | `any`[] |
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/Logger.ts:30](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/Logger.ts#L30)
|
|
@ -0,0 +1,970 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / Nft
|
||||
|
||||
# Class: Nft
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- [`SmartContract`](SmartContract.md)
|
||||
|
||||
↳ **`Nft`**
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Constructors
|
||||
|
||||
- [constructor](Nft.md#constructor)
|
||||
|
||||
### Properties
|
||||
|
||||
- [abi](Nft.md#abi)
|
||||
- [config](Nft.md#config)
|
||||
- [signer](Nft.md#signer)
|
||||
|
||||
### Methods
|
||||
|
||||
- [addDatatokenDeployer](Nft.md#adddatatokendeployer)
|
||||
- [addManager](Nft.md#addmanager)
|
||||
- [addMetadataUpdater](Nft.md#addmetadataupdater)
|
||||
- [addStoreUpdater](Nft.md#addstoreupdater)
|
||||
- [amountToUnits](Nft.md#amounttounits)
|
||||
- [cleanPermissions](Nft.md#cleanpermissions)
|
||||
- [createDatatoken](Nft.md#createdatatoken)
|
||||
- [getContract](Nft.md#getcontract)
|
||||
- [getData](Nft.md#getdata)
|
||||
- [getDefaultAbi](Nft.md#getdefaultabi)
|
||||
- [getFairGasPrice](Nft.md#getfairgasprice)
|
||||
- [getMetadata](Nft.md#getmetadata)
|
||||
- [getNftOwner](Nft.md#getnftowner)
|
||||
- [getNftPermissions](Nft.md#getnftpermissions)
|
||||
- [getTokenURI](Nft.md#gettokenuri)
|
||||
- [isDatatokenDeployer](Nft.md#isdatatokendeployer)
|
||||
- [removeDatatokenDeployer](Nft.md#removedatatokendeployer)
|
||||
- [removeManager](Nft.md#removemanager)
|
||||
- [removeMetadataUpdater](Nft.md#removemetadataupdater)
|
||||
- [removeStoreUpdater](Nft.md#removestoreupdater)
|
||||
- [safeTransferNft](Nft.md#safetransfernft)
|
||||
- [setData](Nft.md#setdata)
|
||||
- [setMetadata](Nft.md#setmetadata)
|
||||
- [setMetadataAndTokenURI](Nft.md#setmetadataandtokenuri)
|
||||
- [setMetadataState](Nft.md#setmetadatastate)
|
||||
- [setTokenURI](Nft.md#settokenuri)
|
||||
- [transferNft](Nft.md#transfernft)
|
||||
- [unitsToAmount](Nft.md#unitstoamount)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new Nft**(`signer`, `network?`, `config?`, `abi?`)
|
||||
|
||||
Instantiate the smart contract.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `signer` | `Signer` | The signer object. |
|
||||
| `network?` | `string` \| `number` | Network id or name |
|
||||
| `config?` | [`Config`](Config.md) | The configuration object. |
|
||||
| `abi?` | [`AbiItem`](../interfaces/AbiItem.md)[] | ABI array of the smart contract |
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContract](SmartContract.md).[constructor](SmartContract.md#constructor)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:25](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L25)
|
||||
|
||||
## Properties
|
||||
|
||||
### abi
|
||||
|
||||
• **abi**: [`AbiItem`](../interfaces/AbiItem.md)[]
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContract](SmartContract.md).[abi](SmartContract.md#abi)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:14](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### config
|
||||
|
||||
• **config**: [`Config`](Config.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContract](SmartContract.md).[config](SmartContract.md#config)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:13](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### signer
|
||||
|
||||
• **signer**: `Signer`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContract](SmartContract.md).[signer](SmartContract.md#signer)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:12](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L12)
|
||||
|
||||
## Methods
|
||||
|
||||
### addDatatokenDeployer
|
||||
|
||||
▸ **addDatatokenDeployer**<`G`\>(`nftAddress`, `address`, `datatokenDeployer`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Add DatatokenDeployer permission - only Manager can succeed
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `nftAddress` | `string` | NFT contract address |
|
||||
| `address` | `string` | NFT Manager adress |
|
||||
| `datatokenDeployer` | `string` | User adress which is going to have DatatokenDeployer permission |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
trxReceipt
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFT.ts:169](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFT.ts#L169)
|
||||
|
||||
___
|
||||
|
||||
### addManager
|
||||
|
||||
▸ **addManager**<`G`\>(`nftAddress`, `address`, `manager`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Add Manager for NFT Contract (only NFT Owner can succeed)
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `nftAddress` | `string` | NFT contract address |
|
||||
| `address` | `string` | NFT Owner adress |
|
||||
| `manager` | `string` | User adress which is going to be assing manager |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
trxReceipt
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFT.ts:101](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFT.ts#L101)
|
||||
|
||||
___
|
||||
|
||||
### addMetadataUpdater
|
||||
|
||||
▸ **addMetadataUpdater**<`G`\>(`nftAddress`, `address`, `metadataUpdater`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Add Metadata Updater permission - only Manager can succeed
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `nftAddress` | `string` | NFT contract address |
|
||||
| `address` | `string` | NFT Manager adress |
|
||||
| `metadataUpdater` | `string` | User adress which is going to have Metadata Updater permission |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
trxReceipt
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFT.ts:243](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFT.ts#L243)
|
||||
|
||||
___
|
||||
|
||||
### addStoreUpdater
|
||||
|
||||
▸ **addStoreUpdater**<`G`\>(`nftAddress`, `address`, `storeUpdater`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Add Store Updater permission - only Manager can succeed
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `nftAddress` | `string` | NFT contract address |
|
||||
| `address` | `string` | NFT Manager adress |
|
||||
| `storeUpdater` | `string` | User adress which is going to have Store Updater permission |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
trxReceipt
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFT.ts:313](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFT.ts#L313)
|
||||
|
||||
___
|
||||
|
||||
### amountToUnits
|
||||
|
||||
▸ `Protected` **amountToUnits**(`token`, `amount`, `tokenDecimals?`): `Promise`<`string`\>
|
||||
|
||||
Converts an amount of tokens to units
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `token` | `string` | The token to convert |
|
||||
| `amount` | `string` | The amount of tokens to convert |
|
||||
| `tokenDecimals?` | `number` | The number of decimals of the token |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The converted amount in units
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContract](SmartContract.md).[amountToUnits](SmartContract.md#amounttounits)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:43](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L43)
|
||||
|
||||
___
|
||||
|
||||
### cleanPermissions
|
||||
|
||||
▸ **cleanPermissions**<`G`\>(`nftAddress`, `address`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
This function allows to remove all ROLES at NFT level: Managers, DatatokenDeployer, MetadataUpdater, StoreUpdater
|
||||
Even NFT Owner has to readd himself as Manager
|
||||
Permissions at Datatoken level stay.
|
||||
Only NFT Owner can call it.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `nftAddress` | `string` | NFT contract address |
|
||||
| `address` | `string` | NFT Owner adress |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
trxReceipt
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFT.ts:387](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFT.ts#L387)
|
||||
|
||||
___
|
||||
|
||||
### createDatatoken
|
||||
|
||||
▸ **createDatatoken**<`G`\>(`nftAddress`, `address`, `minter`, `paymentCollector`, `mpFeeAddress`, `feeToken`, `feeAmount`, `cap`, `name?`, `symbol?`, `templateIndex?`, `estimateGas?`): `Promise`<`G` extends ``false`` ? `string` : `BigNumber`\>
|
||||
|
||||
Create new ERC20 Datatoken - only user with DatatokenDeployer permission can succeed
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `nftAddress` | `string` | NFT address |
|
||||
| `address` | `string` | User address |
|
||||
| `minter` | `string` | User set as initial minter for the Datatoken |
|
||||
| `paymentCollector` | `string` | initial paymentCollector for this DT |
|
||||
| `mpFeeAddress` | `string` | Consume marketplace fee address |
|
||||
| `feeToken` | `string` | address of the token marketplace wants to add fee on top |
|
||||
| `feeAmount` | `string` | amount of feeToken to be transferred to mpFeeAddress on top, will be converted to WEI |
|
||||
| `cap` | `string` | Maximum cap (Number) - will be converted to wei |
|
||||
| `name?` | `string` | Token name |
|
||||
| `symbol?` | `string` | Token symbol |
|
||||
| `templateIndex?` | `number` | NFT template index |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`G` extends ``false`` ? `string` : `BigNumber`\>
|
||||
|
||||
ERC20 Datatoken address
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFT.ts:34](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFT.ts#L34)
|
||||
|
||||
___
|
||||
|
||||
### getContract
|
||||
|
||||
▸ `Protected` **getContract**(`address`, `abi?`): `Contract`
|
||||
|
||||
Returns a contract instance for the given address
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `address` | `string` | The address of the contract |
|
||||
| `abi?` | [`AbiItem`](../interfaces/AbiItem.md)[] | The ABI of the contract |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Contract`
|
||||
|
||||
- The contract instance
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContract](SmartContract.md).[getContract](SmartContract.md#getcontract)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:80](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L80)
|
||||
|
||||
___
|
||||
|
||||
### getData
|
||||
|
||||
▸ **getData**(`nftAddress`, `key`): `Promise`<`string`\>
|
||||
|
||||
Gets stored data at a given `key` in an NFT
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `nftAddress` | `string` | The address of the NFT. |
|
||||
| `key` | `string` | The key of the data to get. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
The data stored at the key
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFT.ts:753](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFT.ts#L753)
|
||||
|
||||
___
|
||||
|
||||
### getDefaultAbi
|
||||
|
||||
▸ **getDefaultAbi**(): [`AbiItem`](../interfaces/AbiItem.md)[]
|
||||
|
||||
#### Returns
|
||||
|
||||
[`AbiItem`](../interfaces/AbiItem.md)[]
|
||||
|
||||
#### Overrides
|
||||
|
||||
[SmartContract](SmartContract.md).[getDefaultAbi](SmartContract.md#getdefaultabi)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFT.ts:14](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFT.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### getFairGasPrice
|
||||
|
||||
▸ `Protected` **getFairGasPrice**(): `Promise`<`string`\>
|
||||
|
||||
Retruns the gas price
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The fair gas price
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContract](SmartContract.md).[getFairGasPrice](SmartContract.md#getfairgasprice)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:70](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L70)
|
||||
|
||||
___
|
||||
|
||||
### getMetadata
|
||||
|
||||
▸ **getMetadata**(`nftAddress`): `Promise`<`Object`\>
|
||||
|
||||
Returns Metadata details for an NFT
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `nftAddress` | `string` | NFT contract address |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Object`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFT.ts:687](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFT.ts#L687)
|
||||
|
||||
___
|
||||
|
||||
### getNftOwner
|
||||
|
||||
▸ **getNftOwner**(`nftAddress`): `Promise`<`string`\>
|
||||
|
||||
Get NFT Owner
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `nftAddress` | `string` | NFT contract address |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
string
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFT.ts:664](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFT.ts#L664)
|
||||
|
||||
___
|
||||
|
||||
### getNftPermissions
|
||||
|
||||
▸ **getNftPermissions**(`nftAddress`, `address`): `Promise`<[`NftRoles`](../interfaces/NftRoles.md)\>
|
||||
|
||||
Gets NFT Permissions for a specified user
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `nftAddress` | `string` | NFT contract address |
|
||||
| `address` | `string` | user adress |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`NftRoles`](../interfaces/NftRoles.md)\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFT.ts:676](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFT.ts#L676)
|
||||
|
||||
___
|
||||
|
||||
### getTokenURI
|
||||
|
||||
▸ **getTokenURI**(`nftAddress`, `id`): `Promise`<`string`\>
|
||||
|
||||
Gets the token URI of an NFT.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `nftAddress` | `string` | The address of the NFT. |
|
||||
| `id` | `number` | The ID of the token. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFT.ts:766](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFT.ts#L766)
|
||||
|
||||
___
|
||||
|
||||
### isDatatokenDeployer
|
||||
|
||||
▸ **isDatatokenDeployer**(`nftAddress`, `address`): `Promise`<`boolean`\>
|
||||
|
||||
Checks if user has DatatokenDeployer role
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `nftAddress` | `string` | NFT contract address |
|
||||
| `address` | `string` | user adress |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`boolean`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFT.ts:698](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFT.ts#L698)
|
||||
|
||||
___
|
||||
|
||||
### removeDatatokenDeployer
|
||||
|
||||
▸ **removeDatatokenDeployer**<`G`\>(`nftAddress`, `address`, `datatokenDeployer`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Remove DatatokenDeployer permission - only Manager can succeed
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `nftAddress` | `string` | NFT contract address |
|
||||
| `address` | `string` | NFT Manager adress |
|
||||
| `datatokenDeployer` | `string` | Address of the user to be revoked DatatokenDeployer Permission |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
trxReceipt
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFT.ts:204](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFT.ts#L204)
|
||||
|
||||
___
|
||||
|
||||
### removeManager
|
||||
|
||||
▸ **removeManager**<`G`\>(`nftAddress`, `address`, `manager`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Removes a specific manager for NFT Contract (only NFT Owner can succeed)
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `nftAddress` | `string` | NFT contract address |
|
||||
| `address` | `string` | NFT Owner adress |
|
||||
| `manager` | `string` | User adress which is going to be removed as manager |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
trxReceipt
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFT.ts:135](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFT.ts#L135)
|
||||
|
||||
___
|
||||
|
||||
### removeMetadataUpdater
|
||||
|
||||
▸ **removeMetadataUpdater**<`G`\>(`nftAddress`, `address`, `metadataUpdater`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Remove Metadata Updater permission - only Manager can succeed
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `nftAddress` | `string` | NFT contract address |
|
||||
| `address` | `string` | NFT Manager adress |
|
||||
| `metadataUpdater` | `string` | Address of the user to be revoked Metadata updater Permission |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
trxReceipt
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFT.ts:276](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFT.ts#L276)
|
||||
|
||||
___
|
||||
|
||||
### removeStoreUpdater
|
||||
|
||||
▸ **removeStoreUpdater**<`G`\>(`nftAddress`, `address`, `storeUpdater`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Remove Store Updater permission - only Manager can succeed
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `nftAddress` | `string` | NFT contract address |
|
||||
| `address` | `string` | NFT Manager adress |
|
||||
| `storeUpdater` | `string` | Address of the user to be revoked Store Updater Permission |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
trxReceipt
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFT.ts:347](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFT.ts#L347)
|
||||
|
||||
___
|
||||
|
||||
### safeTransferNft
|
||||
|
||||
▸ **safeTransferNft**<`G`\>(`nftAddress`, `nftOwner`, `nftReceiver`, `tokenId?`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
safeTransferNFT Used for transferring the NFT, can be used by an approved relayer
|
||||
will clean all permissions both on NFT and Datatoken level.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `nftAddress` | `string` | NFT contract address |
|
||||
| `nftOwner` | `string` | Current NFT Owner adress |
|
||||
| `nftReceiver` | `string` | User which will receive the NFT, will also be set as Manager |
|
||||
| `tokenId?` | `number` | The id of the token to be transfered |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
trxReceipt
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFT.ts:466](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFT.ts#L466)
|
||||
|
||||
___
|
||||
|
||||
### setData
|
||||
|
||||
▸ **setData**<`G`\>(`nftAddress`, `address`, `key`, `value`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Allows users to store data with a preset key (keccak256(ERC20Address)) into NFT 725 Store
|
||||
only ERC20Deployer can succeed
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `nftAddress` | `string` | Nft datatoken adress |
|
||||
| `address` | `string` | User adress |
|
||||
| `key` | `string` | Key of the data to be stored into 725Y standard |
|
||||
| `value` | `string` | Data to be stored into 725Y standard |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
transactionId
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFT.ts:717](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFT.ts#L717)
|
||||
|
||||
___
|
||||
|
||||
### setMetadata
|
||||
|
||||
▸ **setMetadata**<`G`\>(`nftAddress`, `address`, `metadataState`, `metadataDecryptorUrl`, `metadataDecryptorAddress`, `flags`, `data`, `metadataHash`, `metadataProofs?`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Creates or update Metadata cached by Aquarius. Also, updates the METADATA_DECRYPTOR key
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `nftAddress` | `string` | NFT contract address |
|
||||
| `address` | `string` | Caller address NFT Owner adress |
|
||||
| `metadataState` | `number` | |
|
||||
| `metadataDecryptorUrl` | `string` | |
|
||||
| `metadataDecryptorAddress` | `string` | |
|
||||
| `flags` | `string` | |
|
||||
| `data` | `string` | |
|
||||
| `metadataHash` | `string` | |
|
||||
| `metadataProofs?` | [`MetadataProof`](../interfaces/MetadataProof.md)[] | |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
trxReceipt
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFT.ts:515](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFT.ts#L515)
|
||||
|
||||
___
|
||||
|
||||
### setMetadataAndTokenURI
|
||||
|
||||
▸ **setMetadataAndTokenURI**<`G`\>(`nftAddress`, `metadataUpdater`, `metadataAndTokenURI`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Helper function to improve UX sets both MetaData & TokenURI in one tx
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `nftAddress` | `string` | NFT contract address |
|
||||
| `metadataUpdater` | `string` | - |
|
||||
| `metadataAndTokenURI` | [`MetadataAndTokenURI`](../interfaces/MetadataAndTokenURI.md) | metaDataAndTokenURI object |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
trxReceipt
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFT.ts:568](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFT.ts#L568)
|
||||
|
||||
___
|
||||
|
||||
### setMetadataState
|
||||
|
||||
▸ **setMetadataState**<`G`\>(`nftAddress`, `address`, `metadataState`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
setMetadataState Used for updating the metadata State
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `nftAddress` | `string` | NFT contract address |
|
||||
| `address` | `string` | Caller address => metadata updater |
|
||||
| `metadataState` | `number` | new metadata state |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
trxReceipt
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFT.ts:606](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFT.ts#L606)
|
||||
|
||||
___
|
||||
|
||||
### setTokenURI
|
||||
|
||||
▸ **setTokenURI**<`G`\>(`nftAddress`, `data`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
set TokenURI on an nft
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `nftAddress` | `string` | NFT contract address |
|
||||
| `data` | `string` | input data for TokenURI |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
transaction receipt
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFT.ts:638](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFT.ts#L638)
|
||||
|
||||
___
|
||||
|
||||
### transferNft
|
||||
|
||||
▸ **transferNft**<`G`\>(`nftAddress`, `nftOwner`, `nftReceiver`, `tokenId?`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Transfers the NFT
|
||||
will clean all permissions both on NFT and Datatoken level.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `nftAddress` | `string` | NFT contract address |
|
||||
| `nftOwner` | `string` | Current NFT Owner adress |
|
||||
| `nftReceiver` | `string` | User which will receive the NFT, will also be set as Manager |
|
||||
| `tokenId?` | `number` | The id of the token to be transfered |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
trxReceipt
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFT.ts:421](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFT.ts#L421)
|
||||
|
||||
___
|
||||
|
||||
### unitsToAmount
|
||||
|
||||
▸ `Protected` **unitsToAmount**(`token`, `amount`, `tokenDecimals?`): `Promise`<`string`\>
|
||||
|
||||
Converts an amount of units to tokens
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `token` | `string` | The token to convert |
|
||||
| `amount` | `string` | The amount of units to convert |
|
||||
| `tokenDecimals?` | `number` | The number of decimals in the token |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The converted amount in tokens
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContract](SmartContract.md).[unitsToAmount](SmartContract.md#unitstoamount)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:58](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L58)
|
|
@ -0,0 +1,861 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / NftFactory
|
||||
|
||||
# Class: NftFactory
|
||||
|
||||
Provides an interface for NFT Factory contract
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- [`SmartContractWithAddress`](SmartContractWithAddress.md)
|
||||
|
||||
↳ **`NftFactory`**
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Constructors
|
||||
|
||||
- [constructor](NftFactory.md#constructor)
|
||||
|
||||
### Properties
|
||||
|
||||
- [abi](NftFactory.md#abi)
|
||||
- [address](NftFactory.md#address)
|
||||
- [config](NftFactory.md#config)
|
||||
- [contract](NftFactory.md#contract)
|
||||
- [signer](NftFactory.md#signer)
|
||||
|
||||
### Methods
|
||||
|
||||
- [addNFTTemplate](NftFactory.md#addnfttemplate)
|
||||
- [addTokenTemplate](NftFactory.md#addtokentemplate)
|
||||
- [amountToUnits](NftFactory.md#amounttounits)
|
||||
- [checkDatatoken](NftFactory.md#checkdatatoken)
|
||||
- [checkNFT](NftFactory.md#checknft)
|
||||
- [createNFT](NftFactory.md#createnft)
|
||||
- [createNftWithDatatoken](NftFactory.md#createnftwithdatatoken)
|
||||
- [createNftWithDatatokenWithDispenser](NftFactory.md#createnftwithdatatokenwithdispenser)
|
||||
- [createNftWithDatatokenWithFixedRate](NftFactory.md#createnftwithdatatokenwithfixedrate)
|
||||
- [disableNFTTemplate](NftFactory.md#disablenfttemplate)
|
||||
- [disableTokenTemplate](NftFactory.md#disabletokentemplate)
|
||||
- [getContract](NftFactory.md#getcontract)
|
||||
- [getCurrentNFTCount](NftFactory.md#getcurrentnftcount)
|
||||
- [getCurrentNFTTemplateCount](NftFactory.md#getcurrentnfttemplatecount)
|
||||
- [getCurrentTokenCount](NftFactory.md#getcurrenttokencount)
|
||||
- [getCurrentTokenTemplateCount](NftFactory.md#getcurrenttokentemplatecount)
|
||||
- [getDefaultAbi](NftFactory.md#getdefaultabi)
|
||||
- [getErcCreationParams](NftFactory.md#geterccreationparams)
|
||||
- [getFairGasPrice](NftFactory.md#getfairgasprice)
|
||||
- [getFreCreationParams](NftFactory.md#getfrecreationparams)
|
||||
- [getNFTTemplate](NftFactory.md#getnfttemplate)
|
||||
- [getOwner](NftFactory.md#getowner)
|
||||
- [getTokenTemplate](NftFactory.md#gettokentemplate)
|
||||
- [reactivateNFTTemplate](NftFactory.md#reactivatenfttemplate)
|
||||
- [reactivateTokenTemplate](NftFactory.md#reactivatetokentemplate)
|
||||
- [startMultipleTokenOrder](NftFactory.md#startmultipletokenorder)
|
||||
- [unitsToAmount](NftFactory.md#unitstoamount)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new NftFactory**(`address`, `signer`, `network?`, `config?`, `abi?`)
|
||||
|
||||
Instantiate the smart contract.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `address` | `string` | The address of the contract. |
|
||||
| `signer` | `Signer` | The signer object. |
|
||||
| `network?` | `string` \| `number` | Network id or name |
|
||||
| `config?` | [`Config`](Config.md) | The configuration object. |
|
||||
| `abi?` | [`AbiItem`](../interfaces/AbiItem.md)[] | ABI array of the smart contract |
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[constructor](SmartContractWithAddress.md#constructor)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContractWithAddress.ts:17](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L17)
|
||||
|
||||
## Properties
|
||||
|
||||
### abi
|
||||
|
||||
• **abi**: [`AbiItem`](../interfaces/AbiItem.md)[]
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[abi](SmartContractWithAddress.md#abi)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:14](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### address
|
||||
|
||||
• **address**: `string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[address](SmartContractWithAddress.md#address)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContractWithAddress.ts:6](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L6)
|
||||
|
||||
___
|
||||
|
||||
### config
|
||||
|
||||
• **config**: [`Config`](Config.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[config](SmartContractWithAddress.md#config)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:13](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### contract
|
||||
|
||||
• **contract**: `Contract`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[contract](SmartContractWithAddress.md#contract)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContractWithAddress.ts:7](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L7)
|
||||
|
||||
___
|
||||
|
||||
### signer
|
||||
|
||||
• **signer**: `Signer`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[signer](SmartContractWithAddress.md#signer)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:12](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L12)
|
||||
|
||||
## Methods
|
||||
|
||||
### addNFTTemplate
|
||||
|
||||
▸ **addNFTTemplate**<`G`\>(`address`, `templateAddress`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Add a new NFT token template - only factory Owner
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `address` | `string` | caller address |
|
||||
| `templateAddress` | `string` | template address to add |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFTFactory.ts:181](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFTFactory.ts#L181)
|
||||
|
||||
___
|
||||
|
||||
### addTokenTemplate
|
||||
|
||||
▸ **addTokenTemplate**<`G`\>(`address`, `templateAddress`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Add a new NFT token template - only factory Owner
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `address` | `string` | caller address |
|
||||
| `templateAddress` | `string` | template address to add |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFTFactory.ts:288](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFTFactory.ts#L288)
|
||||
|
||||
___
|
||||
|
||||
### amountToUnits
|
||||
|
||||
▸ `Protected` **amountToUnits**(`token`, `amount`, `tokenDecimals?`): `Promise`<`string`\>
|
||||
|
||||
Converts an amount of tokens to units
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `token` | `string` | The token to convert |
|
||||
| `amount` | `string` | The amount of tokens to convert |
|
||||
| `tokenDecimals?` | `number` | The number of decimals of the token |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The converted amount in units
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[amountToUnits](SmartContractWithAddress.md#amounttounits)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:43](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L43)
|
||||
|
||||
___
|
||||
|
||||
### checkDatatoken
|
||||
|
||||
▸ **checkDatatoken**(`datatoken`): `Promise`<`Boolean`\>
|
||||
|
||||
Check if Datatoken is deployed from the factory
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `datatoken` | `string` | Datatoken address to check |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Boolean`\>
|
||||
|
||||
return true if deployed from this factory
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFTFactory.ts:159](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFTFactory.ts#L159)
|
||||
|
||||
___
|
||||
|
||||
### checkNFT
|
||||
|
||||
▸ **checkNFT**(`nftAddress`): `Promise`<`String`\>
|
||||
|
||||
Check if NFT is deployed from the factory
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `nftAddress` | `string` | nftAddress address to check |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`String`\>
|
||||
|
||||
return address(0) if it's not, or the nftAddress if true
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFTFactory.ts:169](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFTFactory.ts#L169)
|
||||
|
||||
___
|
||||
|
||||
### createNFT
|
||||
|
||||
▸ **createNFT**<`G`\>(`nftData`, `estimateGas?`): `Promise`<`G` extends ``false`` ? `string` : `BigNumber`\>
|
||||
|
||||
Create new data NFT
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `nftData` | [`NftCreateData`](../interfaces/NftCreateData.md) | The data needed to create an NFT. |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`G` extends ``false`` ? `string` : `BigNumber`\>
|
||||
|
||||
The transaction hash or the gas estimate.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFTFactory.ts:30](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFTFactory.ts#L30)
|
||||
|
||||
___
|
||||
|
||||
### createNftWithDatatoken
|
||||
|
||||
▸ **createNftWithDatatoken**<`G`\>(`nftCreateData`, `dtParams`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Creates a new NFT, then a datatoken,all in one call
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `nftCreateData` | [`NftCreateData`](../interfaces/NftCreateData.md) | The data required to create an NFT. |
|
||||
| `dtParams` | [`DatatokenCreateParams`](../interfaces/DatatokenCreateParams.md) | The parameters required to create a datatoken. |
|
||||
| `estimateGas?` | `G` | Whether to return only estimate gas or not. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
transaction receipt
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFTFactory.ts:434](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFTFactory.ts#L434)
|
||||
|
||||
___
|
||||
|
||||
### createNftWithDatatokenWithDispenser
|
||||
|
||||
▸ **createNftWithDatatokenWithDispenser**<`G`\>(`nftCreateData`, `dtParams`, `dispenserParams`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Creates an NFT with a datatoken with a dispenser in one call.
|
||||
Be aware if Fixed Rate creation fails, you are still going to pay a lot of gas
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `nftCreateData` | [`NftCreateData`](../interfaces/NftCreateData.md) | The data required to create an NFT. |
|
||||
| `dtParams` | [`DatatokenCreateParams`](../interfaces/DatatokenCreateParams.md) | The parameters required to create a datatoken. |
|
||||
| `dispenserParams` | [`DispenserCreationParams`](../interfaces/DispenserCreationParams.md) | The parameters required to create a dispenser contract. |
|
||||
| `estimateGas?` | `G` | Whether to estimate gas or not. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFTFactory.ts:505](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFTFactory.ts#L505)
|
||||
|
||||
___
|
||||
|
||||
### createNftWithDatatokenWithFixedRate
|
||||
|
||||
▸ **createNftWithDatatokenWithFixedRate**<`G`\>(`nftCreateData`, `dtParams`, `freParams`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Creates an NFT with a datatoken with a fixed rate all in one call.
|
||||
be aware if Fixed Rate creation fails, you are still going to pay a lot of gas
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `nftCreateData` | [`NftCreateData`](../interfaces/NftCreateData.md) | The data required to create an NFT. |
|
||||
| `dtParams` | [`DatatokenCreateParams`](../interfaces/DatatokenCreateParams.md) | The parameters required to create a datatoken. |
|
||||
| `freParams` | [`FreCreationParams`](../interfaces/FreCreationParams.md) | The parameters required to create a fixed-rate exchange contract. |
|
||||
| `estimateGas?` | `G` | Whether to return only estimate gas or not. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFTFactory.ts:467](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFTFactory.ts#L467)
|
||||
|
||||
___
|
||||
|
||||
### disableNFTTemplate
|
||||
|
||||
▸ **disableNFTTemplate**<`G`\>(`address`, `templateIndex`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Disable token template - only factory Owner
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `address` | `string` | |
|
||||
| `templateIndex` | `number` | index of the template we want to disable |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
current token template count
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFTFactory.ts:213](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFTFactory.ts#L213)
|
||||
|
||||
___
|
||||
|
||||
### disableTokenTemplate
|
||||
|
||||
▸ **disableTokenTemplate**<`G`\>(`address`, `templateIndex`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Disable token template - only factory Owner
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `address` | `string` | caller address |
|
||||
| `templateIndex` | `number` | index of the template we want to disable |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
current token template count
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFTFactory.ts:321](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFTFactory.ts#L321)
|
||||
|
||||
___
|
||||
|
||||
### getContract
|
||||
|
||||
▸ `Protected` **getContract**(`address`, `abi?`): `Contract`
|
||||
|
||||
Returns a contract instance for the given address
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `address` | `string` | The address of the contract |
|
||||
| `abi?` | [`AbiItem`](../interfaces/AbiItem.md)[] | The ABI of the contract |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Contract`
|
||||
|
||||
- The contract instance
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[getContract](SmartContractWithAddress.md#getcontract)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:80](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L80)
|
||||
|
||||
___
|
||||
|
||||
### getCurrentNFTCount
|
||||
|
||||
▸ **getCurrentNFTCount**(): `Promise`<`number`\>
|
||||
|
||||
Get Current NFT Count (NFT created)
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`number`\>
|
||||
|
||||
Number of NFT created from this factory
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFTFactory.ts:86](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFTFactory.ts#L86)
|
||||
|
||||
___
|
||||
|
||||
### getCurrentNFTTemplateCount
|
||||
|
||||
▸ **getCurrentNFTTemplateCount**(): `Promise`<`number`\>
|
||||
|
||||
Get Current NFT Template Count
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`number`\>
|
||||
|
||||
Number of NFT Template added to this factory
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFTFactory.ts:113](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFTFactory.ts#L113)
|
||||
|
||||
___
|
||||
|
||||
### getCurrentTokenCount
|
||||
|
||||
▸ **getCurrentTokenCount**(): `Promise`<`number`\>
|
||||
|
||||
Get Current Datatoken Count
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`number`\>
|
||||
|
||||
Number of DTs created from this factory
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFTFactory.ts:95](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFTFactory.ts#L95)
|
||||
|
||||
___
|
||||
|
||||
### getCurrentTokenTemplateCount
|
||||
|
||||
▸ **getCurrentTokenTemplateCount**(): `Promise`<`number`\>
|
||||
|
||||
Get Current Template Datatoken (ERC20) Count
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`number`\>
|
||||
|
||||
Number of Datatoken Template added to this factory
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFTFactory.ts:122](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFTFactory.ts#L122)
|
||||
|
||||
___
|
||||
|
||||
### getDefaultAbi
|
||||
|
||||
▸ **getDefaultAbi**(): [`AbiItem`](../interfaces/AbiItem.md)[]
|
||||
|
||||
#### Returns
|
||||
|
||||
[`AbiItem`](../interfaces/AbiItem.md)[]
|
||||
|
||||
#### Overrides
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[getDefaultAbi](SmartContractWithAddress.md#getdefaultabi)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFTFactory.ts:20](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFTFactory.ts#L20)
|
||||
|
||||
___
|
||||
|
||||
### getErcCreationParams
|
||||
|
||||
▸ `Private` **getErcCreationParams**(`dtParams`): `Promise`<`any`\>
|
||||
|
||||
Gets the parameters required to create an ERC20 token.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `dtParams` | [`DatatokenCreateParams`](../interfaces/DatatokenCreateParams.md) | The parameters required to create a datatoken. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFTFactory.ts:550](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFTFactory.ts#L550)
|
||||
|
||||
___
|
||||
|
||||
### getFairGasPrice
|
||||
|
||||
▸ `Protected` **getFairGasPrice**(): `Promise`<`string`\>
|
||||
|
||||
Retruns the gas price
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The fair gas price
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[getFairGasPrice](SmartContractWithAddress.md#getfairgasprice)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:70](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L70)
|
||||
|
||||
___
|
||||
|
||||
### getFreCreationParams
|
||||
|
||||
▸ `Private` **getFreCreationParams**(`freParams`): `Promise`<`any`\>
|
||||
|
||||
Gets the parameters required to create a fixed-rate exchange contract.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `freParams` | [`FreCreationParams`](../interfaces/FreCreationParams.md) | The parameters required to create a fixed-rate exchange contract. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFTFactory.ts:578](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFTFactory.ts#L578)
|
||||
|
||||
___
|
||||
|
||||
### getNFTTemplate
|
||||
|
||||
▸ **getNFTTemplate**(`index`): `Promise`<[`Template`](../interfaces/Template.md)\>
|
||||
|
||||
Get NFT Template
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `index` | `number` | Template index |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Template`](../interfaces/Template.md)\>
|
||||
|
||||
Number of Template added to this factory
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFTFactory.ts:132](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFTFactory.ts#L132)
|
||||
|
||||
___
|
||||
|
||||
### getOwner
|
||||
|
||||
▸ **getOwner**(): `Promise`<`string`\>
|
||||
|
||||
Get Factory Owner
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
Factory Owner address
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFTFactory.ts:104](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFTFactory.ts#L104)
|
||||
|
||||
___
|
||||
|
||||
### getTokenTemplate
|
||||
|
||||
▸ **getTokenTemplate**(`index`): `Promise`<[`Template`](../interfaces/Template.md)\>
|
||||
|
||||
Get Datatoken (ERC20) Template
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `index` | `number` | Template index |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Template`](../interfaces/Template.md)\>
|
||||
|
||||
DT Template info
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFTFactory.ts:149](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFTFactory.ts#L149)
|
||||
|
||||
___
|
||||
|
||||
### reactivateNFTTemplate
|
||||
|
||||
▸ **reactivateNFTTemplate**<`G`\>(`address`, `templateIndex`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Reactivate a previously disabled token template - only factory Owner
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `address` | `string` | |
|
||||
| `templateIndex` | `number` | index of the template we want to reactivate |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
current token template count
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFTFactory.ts:249](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFTFactory.ts#L249)
|
||||
|
||||
___
|
||||
|
||||
### reactivateTokenTemplate
|
||||
|
||||
▸ **reactivateTokenTemplate**<`G`\>(`address`, `templateIndex`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Reactivate a previously disabled token template - only factory Owner
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `address` | `string` | caller address |
|
||||
| `templateIndex` | `number` | index of the template we want to reactivate |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
current token template count
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFTFactory.ts:360](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFTFactory.ts#L360)
|
||||
|
||||
___
|
||||
|
||||
### startMultipleTokenOrder
|
||||
|
||||
▸ **startMultipleTokenOrder**<`G`\>(`orders`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Used as a proxy to order multiple services
|
||||
Users can have inifinite approvals for fees for factory instead of having one approval/ Datatoken contract
|
||||
Requires previous approval of all :
|
||||
- consumeFeeTokens
|
||||
- publishMarketFeeTokens
|
||||
- ERC20 Datatokens
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `orders` | [`TokenOrder`](../interfaces/TokenOrder.md)[] | array of of orders |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
transaction receipt
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/NFTFactory.ts:404](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/NFTFactory.ts#L404)
|
||||
|
||||
___
|
||||
|
||||
### unitsToAmount
|
||||
|
||||
▸ `Protected` **unitsToAmount**(`token`, `amount`, `tokenDecimals?`): `Promise`<`string`\>
|
||||
|
||||
Converts an amount of units to tokens
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `token` | `string` | The token to convert |
|
||||
| `amount` | `string` | The amount of units to convert |
|
||||
| `tokenDecimals?` | `number` | The number of decimals in the token |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The converted amount in tokens
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[unitsToAmount](SmartContractWithAddress.md#unitstoamount)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:58](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L58)
|
|
@ -0,0 +1,628 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / Provider
|
||||
|
||||
# Class: Provider
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Constructors
|
||||
|
||||
- [constructor](Provider.md#constructor)
|
||||
|
||||
### Methods
|
||||
|
||||
- [checkDidFiles](Provider.md#checkdidfiles)
|
||||
- [computeDelete](Provider.md#computedelete)
|
||||
- [computeStart](Provider.md#computestart)
|
||||
- [computeStatus](Provider.md#computestatus)
|
||||
- [computeStop](Provider.md#computestop)
|
||||
- [encrypt](Provider.md#encrypt)
|
||||
- [getComputeEnvironments](Provider.md#getcomputeenvironments)
|
||||
- [getComputeResultUrl](Provider.md#getcomputeresulturl)
|
||||
- [getData](Provider.md#getdata)
|
||||
- [getDownloadUrl](Provider.md#getdownloadurl)
|
||||
- [getEndpointURL](Provider.md#getendpointurl)
|
||||
- [getEndpoints](Provider.md#getendpoints)
|
||||
- [getFileInfo](Provider.md#getfileinfo)
|
||||
- [getNonce](Provider.md#getnonce)
|
||||
- [getServiceEndpoints](Provider.md#getserviceendpoints)
|
||||
- [initialize](Provider.md#initialize)
|
||||
- [initializeCompute](Provider.md#initializecompute)
|
||||
- [inputMatch](Provider.md#inputmatch)
|
||||
- [isValidProvider](Provider.md#isvalidprovider)
|
||||
- [noZeroX](Provider.md#nozerox)
|
||||
- [signProviderRequest](Provider.md#signproviderrequest)
|
||||
- [zeroXTransformer](Provider.md#zeroxtransformer)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new Provider**()
|
||||
|
||||
## Methods
|
||||
|
||||
### checkDidFiles
|
||||
|
||||
▸ **checkDidFiles**(`did`, `serviceId`, `providerUri`, `withChecksum?`, `signal?`): `Promise`<[`FileInfo`](../interfaces/FileInfo.md)[]\>
|
||||
|
||||
Get file details for a given DID and service ID.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| :------ | :------ | :------ | :------ |
|
||||
| `did` | `string` | `undefined` | The DID to check. |
|
||||
| `serviceId` | `string` | `undefined` | The service ID to check. |
|
||||
| `providerUri` | `string` | `undefined` | The URI of the provider. |
|
||||
| `withChecksum?` | `boolean` | `false` | Whether or not to include a checksum. |
|
||||
| `signal?` | `AbortSignal` | `undefined` | An optional abort signal. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`FileInfo`](../interfaces/FileInfo.md)[]\>
|
||||
|
||||
A promise that resolves with an array of file info objects.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/Provider.ts:181](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Provider.ts#L181)
|
||||
|
||||
___
|
||||
|
||||
### computeDelete
|
||||
|
||||
▸ **computeDelete**(`did`, `consumer`, `jobId`, `providerUri`, `signal?`): `Promise`<[`ComputeJob`](../interfaces/ComputeJob.md) \| [`ComputeJob`](../interfaces/ComputeJob.md)[]\>
|
||||
|
||||
Deletes a compute job.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `did` | `string` | asset did |
|
||||
| `consumer` | `Signer` | consumer Signer wallet object |
|
||||
| `jobId` | `string` | the compute job ID |
|
||||
| `providerUri` | `string` | The URI of the provider we want to query |
|
||||
| `signal?` | `AbortSignal` | abort signal |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ComputeJob`](../interfaces/ComputeJob.md) \| [`ComputeJob`](../interfaces/ComputeJob.md)[]\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/Provider.ts:764](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Provider.ts#L764)
|
||||
|
||||
___
|
||||
|
||||
### computeStart
|
||||
|
||||
▸ **computeStart**(`providerUri`, `consumer`, `computeEnv`, `dataset`, `algorithm`, `signal?`, `additionalDatasets?`, `output?`): `Promise`<[`ComputeJob`](../interfaces/ComputeJob.md) \| [`ComputeJob`](../interfaces/ComputeJob.md)[]\>
|
||||
|
||||
Instruct the provider to start a compute job
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `providerUri` | `string` | The provider URI. |
|
||||
| `consumer` | `Signer` | - |
|
||||
| `computeEnv` | `string` | The compute environment. |
|
||||
| `dataset` | [`ComputeAsset`](../interfaces/ComputeAsset.md) | The dataset to start compute on |
|
||||
| `algorithm` | [`ComputeAlgorithm`](../interfaces/ComputeAlgorithm.md) | The algorithm to start compute with. |
|
||||
| `signal?` | `AbortSignal` | abort signal |
|
||||
| `additionalDatasets?` | [`ComputeAsset`](../interfaces/ComputeAsset.md)[] | The additional datasets if that is the case. |
|
||||
| `output?` | [`ComputeOutput`](../interfaces/ComputeOutput.md) | The compute job output settings. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ComputeJob`](../interfaces/ComputeJob.md) \| [`ComputeJob`](../interfaces/ComputeJob.md)[]\>
|
||||
|
||||
The compute job or jobs.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/Provider.ts:516](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Provider.ts#L516)
|
||||
|
||||
___
|
||||
|
||||
### computeStatus
|
||||
|
||||
▸ **computeStatus**(`providerUri`, `consumerAddress`, `jobId?`, `did?`, `signal?`): `Promise`<[`ComputeJob`](../interfaces/ComputeJob.md) \| [`ComputeJob`](../interfaces/ComputeJob.md)[]\>
|
||||
|
||||
Get compute status for a specific jobId/documentId/owner.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `providerUri` | `string` | The URI of the provider we want to query |
|
||||
| `consumerAddress` | `string` | The consumer ethereum address |
|
||||
| `jobId?` | `string` | The ID of a compute job. |
|
||||
| `did?` | `string` | The ID of the asset |
|
||||
| `signal?` | `AbortSignal` | abort signal |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ComputeJob`](../interfaces/ComputeJob.md) \| [`ComputeJob`](../interfaces/ComputeJob.md)[]\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/Provider.ts:662](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Provider.ts#L662)
|
||||
|
||||
___
|
||||
|
||||
### computeStop
|
||||
|
||||
▸ **computeStop**(`did`, `consumerAddress`, `jobId`, `providerUri`, `signer`, `signal?`): `Promise`<[`ComputeJob`](../interfaces/ComputeJob.md) \| [`ComputeJob`](../interfaces/ComputeJob.md)[]\>
|
||||
|
||||
Instruct the provider to Stop the execution of a to stop a compute job.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `did` | `string` | the asset did |
|
||||
| `consumerAddress` | `string` | The consumer address. |
|
||||
| `jobId` | `string` | the compute job id |
|
||||
| `providerUri` | `string` | The provider URI. |
|
||||
| `signer` | `Signer` | The consumer signer object. |
|
||||
| `signal?` | `AbortSignal` | abort signal |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ComputeJob`](../interfaces/ComputeJob.md) \| [`ComputeJob`](../interfaces/ComputeJob.md)[]\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/Provider.ts:587](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Provider.ts#L587)
|
||||
|
||||
___
|
||||
|
||||
### encrypt
|
||||
|
||||
▸ **encrypt**(`data`, `chainId`, `providerUri`, `signal?`): `Promise`<`string`\>
|
||||
|
||||
Encrypt data using the Provider's own symmetric key
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `data` | `any` | data in json format that needs to be sent , it can either be a DDO or a File array |
|
||||
| `chainId` | `number` | network's id so provider can choose the corresponding Signer object |
|
||||
| `providerUri` | `string` | provider uri address |
|
||||
| `signal?` | `AbortSignal` | abort signal |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
urlDetails
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/Provider.ts:142](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Provider.ts#L142)
|
||||
|
||||
___
|
||||
|
||||
### getComputeEnvironments
|
||||
|
||||
▸ **getComputeEnvironments**(`providerUri`, `signal?`): `Promise`<{ `[chainId: number]`: [`ComputeEnvironment`](../interfaces/ComputeEnvironment.md)[]; }\>
|
||||
|
||||
Returns compute environments from a provider.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `providerUri` | `string` | The URI of the provider. |
|
||||
| `signal?` | `AbortSignal` | An optional abort signal. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<{ `[chainId: number]`: [`ComputeEnvironment`](../interfaces/ComputeEnvironment.md)[]; }\>
|
||||
|
||||
A promise that resolves with an object containing compute environments for each chain ID.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/Provider.ts:290](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Provider.ts#L290)
|
||||
|
||||
___
|
||||
|
||||
### getComputeResultUrl
|
||||
|
||||
▸ **getComputeResultUrl**(`providerUri`, `consumer`, `jobId`, `index`): `Promise`<`string`\>
|
||||
|
||||
Get compute result url
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `providerUri` | `string` | The URI of the provider we want to query |
|
||||
| `consumer` | `Signer` | consumer Signer wallet object |
|
||||
| `jobId` | `string` | The ID of a compute job. |
|
||||
| `index` | `number` | Result index |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/Provider.ts:725](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Provider.ts#L725)
|
||||
|
||||
___
|
||||
|
||||
### getData
|
||||
|
||||
▸ `Private` **getData**(`url`): `Promise`<`Response`\>
|
||||
|
||||
Private method that fetches data from a URL using the GET method.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `url` | `string` | The URL to fetch data from. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Response`\>
|
||||
|
||||
A Promise that resolves to a Response object.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/Provider.ts:906](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Provider.ts#L906)
|
||||
|
||||
___
|
||||
|
||||
### getDownloadUrl
|
||||
|
||||
▸ **getDownloadUrl**(`did`, `serviceId`, `fileIndex`, `transferTxId`, `providerUri`, `signer`, `userCustomParameters?`): `Promise`<`any`\>
|
||||
|
||||
Gets the download URL.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `did` | `string` | The DID. |
|
||||
| `serviceId` | `string` | The service ID. |
|
||||
| `fileIndex` | `number` | The file index. |
|
||||
| `transferTxId` | `string` | The transfer transaction ID. |
|
||||
| `providerUri` | `string` | The provider URI. |
|
||||
| `signer` | `Signer` | The signer. |
|
||||
| `userCustomParameters?` | [`UserCustomParameters`](../interfaces/UserCustomParameters.md) | The user custom parameters. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
The download URL.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/Provider.ts:472](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Provider.ts#L472)
|
||||
|
||||
___
|
||||
|
||||
### getEndpointURL
|
||||
|
||||
▸ **getEndpointURL**(`servicesEndpoints`, `serviceName`): [`ServiceEndpoint`](../interfaces/ServiceEndpoint.md)
|
||||
|
||||
This function returns the endpoint URL for a given service name.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `servicesEndpoints` | [`ServiceEndpoint`](../interfaces/ServiceEndpoint.md)[] | The array of service endpoints |
|
||||
| `serviceName` | `string` | The name of the service |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`ServiceEndpoint`](../interfaces/ServiceEndpoint.md)
|
||||
|
||||
The endpoint URL for the given service name
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/Provider.ts:44](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Provider.ts#L44)
|
||||
|
||||
___
|
||||
|
||||
### getEndpoints
|
||||
|
||||
▸ **getEndpoints**(`providerUri`): `Promise`<`any`\>
|
||||
|
||||
Returns the provider endpoints
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `providerUri` | `string` | the provider url |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/Provider.ts:28](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Provider.ts#L28)
|
||||
|
||||
___
|
||||
|
||||
### getFileInfo
|
||||
|
||||
▸ **getFileInfo**(`file`, `providerUri`, `withChecksum?`, `signal?`): `Promise`<[`FileInfo`](../interfaces/FileInfo.md)[]\>
|
||||
|
||||
Get File details (if possible)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| :------ | :------ | :------ | :------ |
|
||||
| `file` | [`UrlFile`](../interfaces/UrlFile.md) \| [`GraphqlQuery`](../interfaces/GraphqlQuery.md) \| [`Arweave`](../interfaces/Arweave.md) \| [`Ipfs`](../interfaces/Ipfs.md) \| [`Smartcontract`](../interfaces/Smartcontract-1.md) | `undefined` | one of the supported file structures |
|
||||
| `providerUri` | `string` | `undefined` | uri of the provider that will be used to check the file |
|
||||
| `withChecksum?` | `boolean` | `false` | Whether or not to include a checksum. |
|
||||
| `signal?` | `AbortSignal` | `undefined` | An optional abort signal. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`FileInfo`](../interfaces/FileInfo.md)[]\>
|
||||
|
||||
A promise that resolves with an array of file info objects.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/Provider.ts:237](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Provider.ts#L237)
|
||||
|
||||
___
|
||||
|
||||
### getNonce
|
||||
|
||||
▸ **getNonce**(`providerUri`, `consumerAddress`, `signal?`, `providerEndpoints?`, `serviceEndpoints?`): `Promise`<`string`\>
|
||||
|
||||
Get current nonce from the provider.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `providerUri` | `string` | provider uri address |
|
||||
| `consumerAddress` | `string` | Publisher address |
|
||||
| `signal?` | `AbortSignal` | abort signal |
|
||||
| `providerEndpoints?` | `any` | Identifier of the asset to be registered in ocean |
|
||||
| `serviceEndpoints?` | [`ServiceEndpoint`](../interfaces/ServiceEndpoint.md)[] | document description object (DDO)= |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
urlDetails
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/Provider.ts:80](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Provider.ts#L80)
|
||||
|
||||
___
|
||||
|
||||
### getServiceEndpoints
|
||||
|
||||
▸ **getServiceEndpoints**(`providerEndpoint`, `endpoints`): `Promise`<[`ServiceEndpoint`](../interfaces/ServiceEndpoint.md)[]\>
|
||||
|
||||
This function returns an array of service endpoints for a given provider endpoint.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `providerEndpoint` | `string` | The provider endpoint |
|
||||
| `endpoints` | `any` | The endpoints object |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ServiceEndpoint`](../interfaces/ServiceEndpoint.md)[]\>
|
||||
|
||||
An array of service endpoints
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/Provider.ts:58](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Provider.ts#L58)
|
||||
|
||||
___
|
||||
|
||||
### initialize
|
||||
|
||||
▸ **initialize**(`did`, `serviceId`, `fileIndex`, `consumerAddress`, `providerUri`, `signal?`, `userCustomParameters?`, `computeEnv?`, `validUntil?`): `Promise`<[`ProviderInitialize`](../interfaces/ProviderInitialize.md)\>
|
||||
|
||||
Initializes the provider for a service request.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `did` | `string` | The asset DID . |
|
||||
| `serviceId` | `string` | The asset service ID. |
|
||||
| `fileIndex` | `number` | The file index. |
|
||||
| `consumerAddress` | `string` | The consumer address. |
|
||||
| `providerUri` | `string` | The URI of the provider. |
|
||||
| `signal?` | `AbortSignal` | The abort signal if any. |
|
||||
| `userCustomParameters?` | [`UserCustomParameters`](../interfaces/UserCustomParameters.md) | The custom parameters if any. |
|
||||
| `computeEnv?` | `string` | The compute environment if any. |
|
||||
| `validUntil?` | `number` | The validity time if any. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ProviderInitialize`](../interfaces/ProviderInitialize.md)\>
|
||||
|
||||
A promise that resolves with ProviderInitialize response.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/Provider.ts:344](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Provider.ts#L344)
|
||||
|
||||
___
|
||||
|
||||
### initializeCompute
|
||||
|
||||
▸ **initializeCompute**(`assets`, `algorithm`, `computeEnv`, `validUntil`, `providerUri`, `accountId`, `signal?`): `Promise`<[`ProviderComputeInitializeResults`](../interfaces/ProviderComputeInitializeResults.md)\>
|
||||
|
||||
Initializes the provider for a compute request.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `assets` | [`ComputeAsset`](../interfaces/ComputeAsset.md)[] | The datasets array to initialize compute request. |
|
||||
| `algorithm` | [`ComputeAlgorithm`](../interfaces/ComputeAlgorithm.md) | The algorithm to use. |
|
||||
| `computeEnv` | `string` | The compute environment. |
|
||||
| `validUntil` | `number` | The job expiration date. |
|
||||
| `providerUri` | `string` | The provider URI. |
|
||||
| `accountId` | `string` | caller address |
|
||||
| `signal?` | `AbortSignal` | abort signal |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ProviderComputeInitializeResults`](../interfaces/ProviderComputeInitializeResults.md)\>
|
||||
|
||||
ProviderComputeInitialize data
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/Provider.ts:409](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Provider.ts#L409)
|
||||
|
||||
___
|
||||
|
||||
### inputMatch
|
||||
|
||||
▸ `Private` **inputMatch**(`input`, `regexp`, `conversorName`): `Object`
|
||||
|
||||
Private method that matches an input string against a regular expression and returns the first capture group.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `input` | `string` | The input string to match. |
|
||||
| `regexp` | `RegExp` | The regular expression to match against. |
|
||||
| `conversorName` | `string` | The name of the method calling this function. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Object`
|
||||
|
||||
An object with two properties: `valid` (a boolean indicating whether the input matched the regular expression) and `output` (the first capture group of the match, or the original input if there was no match).
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `output` | `string` |
|
||||
| `valid` | `boolean` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/Provider.ts:883](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Provider.ts#L883)
|
||||
|
||||
___
|
||||
|
||||
### isValidProvider
|
||||
|
||||
▸ **isValidProvider**(`url`, `signal?`): `Promise`<`boolean`\>
|
||||
|
||||
Check for a valid provider at URL
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `url` | `string` | provider uri address |
|
||||
| `signal?` | `AbortSignal` | abort signal |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`boolean`\>
|
||||
|
||||
valid or not
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/Provider.ts:834](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Provider.ts#L834)
|
||||
|
||||
___
|
||||
|
||||
### noZeroX
|
||||
|
||||
▸ `Private` **noZeroX**(`input`): `string`
|
||||
|
||||
Private method that removes the leading 0x from a string.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `input` | `string` | The input string. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
The transformed string.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/Provider.ts:857](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Provider.ts#L857)
|
||||
|
||||
___
|
||||
|
||||
### signProviderRequest
|
||||
|
||||
▸ **signProviderRequest**(`signer`, `message`): `Promise`<`string`\>
|
||||
|
||||
Sign a provider request with a signer.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `signer` | `Signer` | The signer to use. |
|
||||
| `message` | `string` | The message to sign. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
A promise that resolves with the signature.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/Provider.ts:116](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Provider.ts#L116)
|
||||
|
||||
___
|
||||
|
||||
### zeroXTransformer
|
||||
|
||||
▸ `Private` **zeroXTransformer**(`input?`, `zeroOutput`): `string`
|
||||
|
||||
Private method that removes the leading 0x from a string.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| :------ | :------ | :------ | :------ |
|
||||
| `input` | `string` | `''` | The input string. |
|
||||
| `zeroOutput` | `boolean` | `undefined` | Whether to include 0x in the output if the input is valid and zeroOutput is true. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
The transformed string.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/Provider.ts:867](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Provider.ts#L867)
|
|
@ -0,0 +1,645 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / Router
|
||||
|
||||
# Class: Router
|
||||
|
||||
Provides an interface for FactoryRouter contract
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- [`SmartContractWithAddress`](SmartContractWithAddress.md)
|
||||
|
||||
↳ **`Router`**
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Constructors
|
||||
|
||||
- [constructor](Router.md#constructor)
|
||||
|
||||
### Properties
|
||||
|
||||
- [abi](Router.md#abi)
|
||||
- [address](Router.md#address)
|
||||
- [config](Router.md#config)
|
||||
- [contract](Router.md#contract)
|
||||
- [signer](Router.md#signer)
|
||||
|
||||
### Methods
|
||||
|
||||
- [addApprovedToken](Router.md#addapprovedtoken)
|
||||
- [addDispenserContract](Router.md#adddispensercontract)
|
||||
- [addFixedRateContract](Router.md#addfixedratecontract)
|
||||
- [amountToUnits](Router.md#amounttounits)
|
||||
- [buyDatatokenBatch](Router.md#buydatatokenbatch)
|
||||
- [getContract](Router.md#getcontract)
|
||||
- [getCurrentOPCFee](Router.md#getcurrentopcfee)
|
||||
- [getDefaultAbi](Router.md#getdefaultabi)
|
||||
- [getFairGasPrice](Router.md#getfairgasprice)
|
||||
- [getNFTFactory](Router.md#getnftfactory)
|
||||
- [getOPCFee](Router.md#getopcfee)
|
||||
- [getOwner](Router.md#getowner)
|
||||
- [isApprovedToken](Router.md#isapprovedtoken)
|
||||
- [isFixedPrice](Router.md#isfixedprice)
|
||||
- [removeApprovedToken](Router.md#removeapprovedtoken)
|
||||
- [removeDispenserContract](Router.md#removedispensercontract)
|
||||
- [removeFixedRateContract](Router.md#removefixedratecontract)
|
||||
- [unitsToAmount](Router.md#unitstoamount)
|
||||
- [updateOPCFee](Router.md#updateopcfee)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new Router**(`address`, `signer`, `network?`, `config?`, `abi?`)
|
||||
|
||||
Instantiate the smart contract.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `address` | `string` | The address of the contract. |
|
||||
| `signer` | `Signer` | The signer object. |
|
||||
| `network?` | `string` \| `number` | Network id or name |
|
||||
| `config?` | [`Config`](Config.md) | The configuration object. |
|
||||
| `abi?` | [`AbiItem`](../interfaces/AbiItem.md)[] | ABI array of the smart contract |
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[constructor](SmartContractWithAddress.md#constructor)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContractWithAddress.ts:17](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L17)
|
||||
|
||||
## Properties
|
||||
|
||||
### abi
|
||||
|
||||
• **abi**: [`AbiItem`](../interfaces/AbiItem.md)[]
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[abi](SmartContractWithAddress.md#abi)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:14](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### address
|
||||
|
||||
• **address**: `string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[address](SmartContractWithAddress.md#address)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContractWithAddress.ts:6](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L6)
|
||||
|
||||
___
|
||||
|
||||
### config
|
||||
|
||||
• **config**: [`Config`](Config.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[config](SmartContractWithAddress.md#config)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:13](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### contract
|
||||
|
||||
• **contract**: `Contract`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[contract](SmartContractWithAddress.md#contract)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContractWithAddress.ts:7](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L7)
|
||||
|
||||
___
|
||||
|
||||
### signer
|
||||
|
||||
• **signer**: `Signer`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[signer](SmartContractWithAddress.md#signer)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:12](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L12)
|
||||
|
||||
## Methods
|
||||
|
||||
### addApprovedToken
|
||||
|
||||
▸ **addApprovedToken**<`G`\>(`address`, `tokenAddress`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Adds a token to the list of tokens with reduced fees
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `address` | `string` | caller address |
|
||||
| `tokenAddress` | `string` | token address to add |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/Router.ts:82](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Router.ts#L82)
|
||||
|
||||
___
|
||||
|
||||
### addDispenserContract
|
||||
|
||||
▸ **addDispenserContract**<`G`\>(`address`, `tokenAddress`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Adds an address to the list of dispensers
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `address` | `string` | caller address |
|
||||
| `tokenAddress` | `string` | contract address to add |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/Router.ts:201](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Router.ts#L201)
|
||||
|
||||
___
|
||||
|
||||
### addFixedRateContract
|
||||
|
||||
▸ **addFixedRateContract**<`G`\>(`address`, `tokenAddress`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Adds an address to the list of fixed rate contracts
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `address` | `string` | caller address |
|
||||
| `tokenAddress` | `string` | contract address to add |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/Router.ts:141](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Router.ts#L141)
|
||||
|
||||
___
|
||||
|
||||
### amountToUnits
|
||||
|
||||
▸ `Protected` **amountToUnits**(`token`, `amount`, `tokenDecimals?`): `Promise`<`string`\>
|
||||
|
||||
Converts an amount of tokens to units
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `token` | `string` | The token to convert |
|
||||
| `amount` | `string` | The amount of tokens to convert |
|
||||
| `tokenDecimals?` | `number` | The number of decimals of the token |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The converted amount in units
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[amountToUnits](SmartContractWithAddress.md#amounttounits)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:43](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L43)
|
||||
|
||||
___
|
||||
|
||||
### buyDatatokenBatch
|
||||
|
||||
▸ **buyDatatokenBatch**<`G`\>(`operations`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
* Buys a batch of datatokens.
|
||||
one single call to buy multiple DT for multiple assets.
|
||||
require tokenIn approvals for router from user. (except for dispenser operations)
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `operations` | [`Operation`](../interfaces/Operation.md)[] | The operations to execute. |
|
||||
| `estimateGas?` | `G` | Whether to return only the estimate gas or not. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Transaction receipt
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/Router.ts:22](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Router.ts#L22)
|
||||
|
||||
___
|
||||
|
||||
### getContract
|
||||
|
||||
▸ `Protected` **getContract**(`address`, `abi?`): `Contract`
|
||||
|
||||
Returns a contract instance for the given address
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `address` | `string` | The address of the contract |
|
||||
| `abi?` | [`AbiItem`](../interfaces/AbiItem.md)[] | The ABI of the contract |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Contract`
|
||||
|
||||
- The contract instance
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[getContract](SmartContractWithAddress.md#getcontract)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:80](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L80)
|
||||
|
||||
___
|
||||
|
||||
### getCurrentOPCFee
|
||||
|
||||
▸ **getCurrentOPCFee**(): `Promise`<`number`\>
|
||||
|
||||
Get Current OPF Fee
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`number`\>
|
||||
|
||||
OPF fee
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/Router.ts:262](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Router.ts#L262)
|
||||
|
||||
___
|
||||
|
||||
### getDefaultAbi
|
||||
|
||||
▸ **getDefaultAbi**(): [`AbiItem`](../interfaces/AbiItem.md)[]
|
||||
|
||||
#### Returns
|
||||
|
||||
[`AbiItem`](../interfaces/AbiItem.md)[]
|
||||
|
||||
#### Overrides
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[getDefaultAbi](SmartContractWithAddress.md#getdefaultabi)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/Router.ts:10](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Router.ts#L10)
|
||||
|
||||
___
|
||||
|
||||
### getFairGasPrice
|
||||
|
||||
▸ `Protected` **getFairGasPrice**(): `Promise`<`string`\>
|
||||
|
||||
Retruns the gas price
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The fair gas price
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[getFairGasPrice](SmartContractWithAddress.md#getfairgasprice)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:70](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L70)
|
||||
|
||||
___
|
||||
|
||||
### getNFTFactory
|
||||
|
||||
▸ **getNFTFactory**(): `Promise`<`string`\>
|
||||
|
||||
Get NFT Factory address
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
NFT Factory address
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/Router.ts:71](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Router.ts#L71)
|
||||
|
||||
___
|
||||
|
||||
### getOPCFee
|
||||
|
||||
▸ **getOPCFee**(`baseToken`): `Promise`<`number`\>
|
||||
|
||||
Get OPF Fee per token
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `baseToken` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`number`\>
|
||||
|
||||
OPC fee for a specific baseToken
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/Router.ts:255](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Router.ts#L255)
|
||||
|
||||
___
|
||||
|
||||
### getOwner
|
||||
|
||||
▸ **getOwner**(): `Promise`<`string`\>
|
||||
|
||||
Get Router Owner
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
Router Owner address
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/Router.ts:63](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Router.ts#L63)
|
||||
|
||||
___
|
||||
|
||||
### isApprovedToken
|
||||
|
||||
▸ **isApprovedToken**(`address`): `Promise`<`boolean`\>
|
||||
|
||||
Checks if a token is on approved tokens list,
|
||||
if true opfFee is lower in pools with that token/DT
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `address` | `string` | The address of the token to check. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`boolean`\>
|
||||
|
||||
true if is on the list.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/Router.ts:46](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Router.ts#L46)
|
||||
|
||||
___
|
||||
|
||||
### isFixedPrice
|
||||
|
||||
▸ **isFixedPrice**(`address`): `Promise`<`boolean`\>
|
||||
|
||||
Check if an address is a Fixed Rate contract.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `address` | `string` | The address of the fixed rate exchange to check. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`boolean`\>
|
||||
|
||||
true if is a Fixed Rate contract
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/Router.ts:55](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Router.ts#L55)
|
||||
|
||||
___
|
||||
|
||||
### removeApprovedToken
|
||||
|
||||
▸ **removeApprovedToken**<`G`\>(`address`, `tokenAddress`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Removes a token if exists from the list of tokens with reduced fees
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `address` | `string` | caller address |
|
||||
| `tokenAddress` | `string` | token address to remove |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/Router.ts:112](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Router.ts#L112)
|
||||
|
||||
___
|
||||
|
||||
### removeDispenserContract
|
||||
|
||||
▸ **removeDispenserContract**<`G`\>(`address`, `tokenAddress`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Removes an address from the list of dispensers
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `address` | `string` | caller address |
|
||||
| `tokenAddress` | `string` | address Contract to be removed |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/Router.ts:230](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Router.ts#L230)
|
||||
|
||||
___
|
||||
|
||||
### removeFixedRateContract
|
||||
|
||||
▸ **removeFixedRateContract**<`G`\>(`address`, `tokenAddress`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Removes an address from the list of fixed rate contracts
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `address` | `string` | caller address |
|
||||
| `tokenAddress` | `string` | contract address to add |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/Router.ts:171](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Router.ts#L171)
|
||||
|
||||
___
|
||||
|
||||
### unitsToAmount
|
||||
|
||||
▸ `Protected` **unitsToAmount**(`token`, `amount`, `tokenDecimals?`): `Promise`<`string`\>
|
||||
|
||||
Converts an amount of units to tokens
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `token` | `string` | The token to convert |
|
||||
| `amount` | `string` | The amount of units to convert |
|
||||
| `tokenDecimals?` | `number` | The number of decimals in the token |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The converted amount in tokens
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[unitsToAmount](SmartContractWithAddress.md#unitstoamount)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:58](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L58)
|
||||
|
||||
___
|
||||
|
||||
### updateOPCFee
|
||||
|
||||
▸ **updateOPCFee**<`G`\>(`address`, `newSwapOceanFee`, `newSwapNonOceanFee`, `newConsumeFee`, `newProviderFee`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Updates OP Community Fees
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `address` | `string` | caller address |
|
||||
| `newSwapOceanFee` | `number` | Amount charged for swapping with ocean approved tokens |
|
||||
| `newSwapNonOceanFee` | `number` | Amount charged for swapping with non ocean approved tokens |
|
||||
| `newConsumeFee` | `number` | Amount charged from consumeFees |
|
||||
| `newProviderFee` | `number` | Amount charged for providerFees |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/Router.ts:276](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Router.ts#L276)
|
|
@ -0,0 +1,193 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / SmartContract
|
||||
|
||||
# Class: SmartContract
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- **`SmartContract`**
|
||||
|
||||
↳ [`SmartContractWithAddress`](SmartContractWithAddress.md)
|
||||
|
||||
↳ [`Datatoken`](Datatoken.md)
|
||||
|
||||
↳ [`Nft`](Nft.md)
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Constructors
|
||||
|
||||
- [constructor](SmartContract.md#constructor)
|
||||
|
||||
### Properties
|
||||
|
||||
- [abi](SmartContract.md#abi)
|
||||
- [config](SmartContract.md#config)
|
||||
- [signer](SmartContract.md#signer)
|
||||
|
||||
### Methods
|
||||
|
||||
- [amountToUnits](SmartContract.md#amounttounits)
|
||||
- [getContract](SmartContract.md#getcontract)
|
||||
- [getDefaultAbi](SmartContract.md#getdefaultabi)
|
||||
- [getFairGasPrice](SmartContract.md#getfairgasprice)
|
||||
- [unitsToAmount](SmartContract.md#unitstoamount)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new SmartContract**(`signer`, `network?`, `config?`, `abi?`)
|
||||
|
||||
Instantiate the smart contract.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `signer` | `Signer` | The signer object. |
|
||||
| `network?` | `string` \| `number` | Network id or name |
|
||||
| `config?` | [`Config`](Config.md) | The configuration object. |
|
||||
| `abi?` | [`AbiItem`](../interfaces/AbiItem.md)[] | ABI array of the smart contract |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:25](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L25)
|
||||
|
||||
## Properties
|
||||
|
||||
### abi
|
||||
|
||||
• **abi**: [`AbiItem`](../interfaces/AbiItem.md)[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:14](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### config
|
||||
|
||||
• **config**: [`Config`](Config.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:13](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### signer
|
||||
|
||||
• **signer**: `Signer`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:12](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L12)
|
||||
|
||||
## Methods
|
||||
|
||||
### amountToUnits
|
||||
|
||||
▸ `Protected` **amountToUnits**(`token`, `amount`, `tokenDecimals?`): `Promise`<`string`\>
|
||||
|
||||
Converts an amount of tokens to units
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `token` | `string` | The token to convert |
|
||||
| `amount` | `string` | The amount of tokens to convert |
|
||||
| `tokenDecimals?` | `number` | The number of decimals of the token |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The converted amount in units
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:43](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L43)
|
||||
|
||||
___
|
||||
|
||||
### getContract
|
||||
|
||||
▸ `Protected` **getContract**(`address`, `abi?`): `Contract`
|
||||
|
||||
Returns a contract instance for the given address
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `address` | `string` | The address of the contract |
|
||||
| `abi?` | [`AbiItem`](../interfaces/AbiItem.md)[] | The ABI of the contract |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Contract`
|
||||
|
||||
- The contract instance
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:80](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L80)
|
||||
|
||||
___
|
||||
|
||||
### getDefaultAbi
|
||||
|
||||
▸ `Abstract` **getDefaultAbi**(): `any`
|
||||
|
||||
#### Returns
|
||||
|
||||
`any`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:16](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L16)
|
||||
|
||||
___
|
||||
|
||||
### getFairGasPrice
|
||||
|
||||
▸ `Protected` **getFairGasPrice**(): `Promise`<`string`\>
|
||||
|
||||
Retruns the gas price
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The fair gas price
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:70](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L70)
|
||||
|
||||
___
|
||||
|
||||
### unitsToAmount
|
||||
|
||||
▸ `Protected` **unitsToAmount**(`token`, `amount`, `tokenDecimals?`): `Promise`<`string`\>
|
||||
|
||||
Converts an amount of units to tokens
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `token` | `string` | The token to convert |
|
||||
| `amount` | `string` | The amount of units to convert |
|
||||
| `tokenDecimals?` | `number` | The number of decimals in the token |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The converted amount in tokens
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:58](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L58)
|
|
@ -0,0 +1,268 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / SmartContractWithAddress
|
||||
|
||||
# Class: SmartContractWithAddress
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- [`SmartContract`](SmartContract.md)
|
||||
|
||||
↳ **`SmartContractWithAddress`**
|
||||
|
||||
↳↳ [`Dispenser`](Dispenser.md)
|
||||
|
||||
↳↳ [`FixedRateExchange`](FixedRateExchange.md)
|
||||
|
||||
↳↳ [`Router`](Router.md)
|
||||
|
||||
↳↳ [`NftFactory`](NftFactory.md)
|
||||
|
||||
↳↳ [`VeOcean`](VeOcean.md)
|
||||
|
||||
↳↳ [`VeFeeDistributor`](VeFeeDistributor.md)
|
||||
|
||||
↳↳ [`VeFeeEstimate`](VeFeeEstimate.md)
|
||||
|
||||
↳↳ [`VeAllocate`](VeAllocate.md)
|
||||
|
||||
↳↳ [`DfRewards`](DfRewards.md)
|
||||
|
||||
↳↳ [`DfStrategyV1`](DfStrategyV1.md)
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Constructors
|
||||
|
||||
- [constructor](SmartContractWithAddress.md#constructor)
|
||||
|
||||
### Properties
|
||||
|
||||
- [abi](SmartContractWithAddress.md#abi)
|
||||
- [address](SmartContractWithAddress.md#address)
|
||||
- [config](SmartContractWithAddress.md#config)
|
||||
- [contract](SmartContractWithAddress.md#contract)
|
||||
- [signer](SmartContractWithAddress.md#signer)
|
||||
|
||||
### Methods
|
||||
|
||||
- [amountToUnits](SmartContractWithAddress.md#amounttounits)
|
||||
- [getContract](SmartContractWithAddress.md#getcontract)
|
||||
- [getDefaultAbi](SmartContractWithAddress.md#getdefaultabi)
|
||||
- [getFairGasPrice](SmartContractWithAddress.md#getfairgasprice)
|
||||
- [unitsToAmount](SmartContractWithAddress.md#unitstoamount)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new SmartContractWithAddress**(`address`, `signer`, `network?`, `config?`, `abi?`)
|
||||
|
||||
Instantiate the smart contract.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `address` | `string` | The address of the contract. |
|
||||
| `signer` | `Signer` | The signer object. |
|
||||
| `network?` | `string` \| `number` | Network id or name |
|
||||
| `config?` | [`Config`](Config.md) | The configuration object. |
|
||||
| `abi?` | [`AbiItem`](../interfaces/AbiItem.md)[] | ABI array of the smart contract |
|
||||
|
||||
#### Overrides
|
||||
|
||||
[SmartContract](SmartContract.md).[constructor](SmartContract.md#constructor)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContractWithAddress.ts:17](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L17)
|
||||
|
||||
## Properties
|
||||
|
||||
### abi
|
||||
|
||||
• **abi**: [`AbiItem`](../interfaces/AbiItem.md)[]
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContract](SmartContract.md).[abi](SmartContract.md#abi)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:14](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### address
|
||||
|
||||
• **address**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContractWithAddress.ts:6](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L6)
|
||||
|
||||
___
|
||||
|
||||
### config
|
||||
|
||||
• **config**: [`Config`](Config.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContract](SmartContract.md).[config](SmartContract.md#config)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:13](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### contract
|
||||
|
||||
• **contract**: `Contract`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContractWithAddress.ts:7](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L7)
|
||||
|
||||
___
|
||||
|
||||
### signer
|
||||
|
||||
• **signer**: `Signer`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContract](SmartContract.md).[signer](SmartContract.md#signer)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:12](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L12)
|
||||
|
||||
## Methods
|
||||
|
||||
### amountToUnits
|
||||
|
||||
▸ `Protected` **amountToUnits**(`token`, `amount`, `tokenDecimals?`): `Promise`<`string`\>
|
||||
|
||||
Converts an amount of tokens to units
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `token` | `string` | The token to convert |
|
||||
| `amount` | `string` | The amount of tokens to convert |
|
||||
| `tokenDecimals?` | `number` | The number of decimals of the token |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The converted amount in units
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContract](SmartContract.md).[amountToUnits](SmartContract.md#amounttounits)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:43](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L43)
|
||||
|
||||
___
|
||||
|
||||
### getContract
|
||||
|
||||
▸ `Protected` **getContract**(`address`, `abi?`): `Contract`
|
||||
|
||||
Returns a contract instance for the given address
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `address` | `string` | The address of the contract |
|
||||
| `abi?` | [`AbiItem`](../interfaces/AbiItem.md)[] | The ABI of the contract |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Contract`
|
||||
|
||||
- The contract instance
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContract](SmartContract.md).[getContract](SmartContract.md#getcontract)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:80](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L80)
|
||||
|
||||
___
|
||||
|
||||
### getDefaultAbi
|
||||
|
||||
▸ `Abstract` **getDefaultAbi**(): `any`
|
||||
|
||||
#### Returns
|
||||
|
||||
`any`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContract](SmartContract.md).[getDefaultAbi](SmartContract.md#getdefaultabi)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:16](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L16)
|
||||
|
||||
___
|
||||
|
||||
### getFairGasPrice
|
||||
|
||||
▸ `Protected` **getFairGasPrice**(): `Promise`<`string`\>
|
||||
|
||||
Retruns the gas price
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The fair gas price
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContract](SmartContract.md).[getFairGasPrice](SmartContract.md#getfairgasprice)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:70](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L70)
|
||||
|
||||
___
|
||||
|
||||
### unitsToAmount
|
||||
|
||||
▸ `Protected` **unitsToAmount**(`token`, `amount`, `tokenDecimals?`): `Promise`<`string`\>
|
||||
|
||||
Converts an amount of units to tokens
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `token` | `string` | The token to convert |
|
||||
| `amount` | `string` | The amount of units to convert |
|
||||
| `tokenDecimals?` | `number` | The number of decimals in the token |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The converted amount in tokens
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContract](SmartContract.md).[unitsToAmount](SmartContract.md#unitstoamount)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:58](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L58)
|
|
@ -0,0 +1,372 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / VeAllocate
|
||||
|
||||
# Class: VeAllocate
|
||||
|
||||
Provides an interface for veOcean contract
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- [`SmartContractWithAddress`](SmartContractWithAddress.md)
|
||||
|
||||
↳ **`VeAllocate`**
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Constructors
|
||||
|
||||
- [constructor](VeAllocate.md#constructor)
|
||||
|
||||
### Properties
|
||||
|
||||
- [abi](VeAllocate.md#abi)
|
||||
- [address](VeAllocate.md#address)
|
||||
- [config](VeAllocate.md#config)
|
||||
- [contract](VeAllocate.md#contract)
|
||||
- [signer](VeAllocate.md#signer)
|
||||
|
||||
### Methods
|
||||
|
||||
- [amountToUnits](VeAllocate.md#amounttounits)
|
||||
- [getContract](VeAllocate.md#getcontract)
|
||||
- [getDefaultAbi](VeAllocate.md#getdefaultabi)
|
||||
- [getFairGasPrice](VeAllocate.md#getfairgasprice)
|
||||
- [getTotalAllocation](VeAllocate.md#gettotalallocation)
|
||||
- [getVeAllocation](VeAllocate.md#getveallocation)
|
||||
- [setAllocation](VeAllocate.md#setallocation)
|
||||
- [setBatchAllocation](VeAllocate.md#setbatchallocation)
|
||||
- [unitsToAmount](VeAllocate.md#unitstoamount)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new VeAllocate**(`address`, `signer`, `network?`, `config?`, `abi?`)
|
||||
|
||||
Instantiate the smart contract.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `address` | `string` | The address of the contract. |
|
||||
| `signer` | `Signer` | The signer object. |
|
||||
| `network?` | `string` \| `number` | Network id or name |
|
||||
| `config?` | [`Config`](Config.md) | The configuration object. |
|
||||
| `abi?` | [`AbiItem`](../interfaces/AbiItem.md)[] | ABI array of the smart contract |
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[constructor](SmartContractWithAddress.md#constructor)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContractWithAddress.ts:17](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L17)
|
||||
|
||||
## Properties
|
||||
|
||||
### abi
|
||||
|
||||
• **abi**: [`AbiItem`](../interfaces/AbiItem.md)[]
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[abi](SmartContractWithAddress.md#abi)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:14](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### address
|
||||
|
||||
• **address**: `string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[address](SmartContractWithAddress.md#address)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContractWithAddress.ts:6](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L6)
|
||||
|
||||
___
|
||||
|
||||
### config
|
||||
|
||||
• **config**: [`Config`](Config.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[config](SmartContractWithAddress.md#config)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:13](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### contract
|
||||
|
||||
• **contract**: `Contract`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[contract](SmartContractWithAddress.md#contract)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContractWithAddress.ts:7](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L7)
|
||||
|
||||
___
|
||||
|
||||
### signer
|
||||
|
||||
• **signer**: `Signer`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[signer](SmartContractWithAddress.md#signer)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:12](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L12)
|
||||
|
||||
## Methods
|
||||
|
||||
### amountToUnits
|
||||
|
||||
▸ `Protected` **amountToUnits**(`token`, `amount`, `tokenDecimals?`): `Promise`<`string`\>
|
||||
|
||||
Converts an amount of tokens to units
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `token` | `string` | The token to convert |
|
||||
| `amount` | `string` | The amount of tokens to convert |
|
||||
| `tokenDecimals?` | `number` | The number of decimals of the token |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The converted amount in units
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[amountToUnits](SmartContractWithAddress.md#amounttounits)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:43](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L43)
|
||||
|
||||
___
|
||||
|
||||
### getContract
|
||||
|
||||
▸ `Protected` **getContract**(`address`, `abi?`): `Contract`
|
||||
|
||||
Returns a contract instance for the given address
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `address` | `string` | The address of the contract |
|
||||
| `abi?` | [`AbiItem`](../interfaces/AbiItem.md)[] | The ABI of the contract |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Contract`
|
||||
|
||||
- The contract instance
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[getContract](SmartContractWithAddress.md#getcontract)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:80](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L80)
|
||||
|
||||
___
|
||||
|
||||
### getDefaultAbi
|
||||
|
||||
▸ **getDefaultAbi**(): [`AbiItem`](../interfaces/AbiItem.md)[]
|
||||
|
||||
#### Returns
|
||||
|
||||
[`AbiItem`](../interfaces/AbiItem.md)[]
|
||||
|
||||
#### Overrides
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[getDefaultAbi](SmartContractWithAddress.md#getdefaultabi)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/ve/VeAllocate.ts:9](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/ve/VeAllocate.ts#L9)
|
||||
|
||||
___
|
||||
|
||||
### getFairGasPrice
|
||||
|
||||
▸ `Protected` **getFairGasPrice**(): `Promise`<`string`\>
|
||||
|
||||
Retruns the gas price
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The fair gas price
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[getFairGasPrice](SmartContractWithAddress.md#getfairgasprice)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:70](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L70)
|
||||
|
||||
___
|
||||
|
||||
### getTotalAllocation
|
||||
|
||||
▸ **getTotalAllocation**(`userAddress`): `Promise`<`number`\>
|
||||
|
||||
Get totalAllocation for address
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `userAddress` | `string` | user address |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`number`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/ve/VeAllocate.ts:81](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/ve/VeAllocate.ts#L81)
|
||||
|
||||
___
|
||||
|
||||
### getVeAllocation
|
||||
|
||||
▸ **getVeAllocation**(`userAddress`, `nft`, `chainId`): `Promise`<`number`\>
|
||||
|
||||
Get getveAllocation for address, nft, chainId
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `userAddress` | `string` | user address |
|
||||
| `nft` | `string` | NFT address to allocate to |
|
||||
| `chainId` | `string` | chainId of NFT |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`number`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/ve/VeAllocate.ts:92](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/ve/VeAllocate.ts#L92)
|
||||
|
||||
___
|
||||
|
||||
### setAllocation
|
||||
|
||||
▸ **setAllocation**<`G`\>(`amount`, `nft`, `chainId`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
set a specific percentage of veOcean to a specific nft
|
||||
Maximum allocated percentage is 10000, so 1% is specified as 100
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `amount` | `string` | Percentage used |
|
||||
| `nft` | `string` | NFT address to allocate to |
|
||||
| `chainId` | `number` | chainId of NFT |
|
||||
| `estimateGas?` | `G` | - |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/ve/VeAllocate.ts:21](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/ve/VeAllocate.ts#L21)
|
||||
|
||||
___
|
||||
|
||||
### setBatchAllocation
|
||||
|
||||
▸ **setBatchAllocation**<`G`\>(`amount`, `nft`, `chainId`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
set specific percetage of veOcean to multiple nfts
|
||||
Maximum allocated percentage is 10000, so 1% is specified as 100
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `amount` | `string`[] | Array of percentages used |
|
||||
| `nft` | `string`[] | Array of NFT addresses |
|
||||
| `chainId` | `number`[] | Array of chainIds |
|
||||
| `estimateGas?` | `G` | - |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/ve/VeAllocate.ts:51](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/ve/VeAllocate.ts#L51)
|
||||
|
||||
___
|
||||
|
||||
### unitsToAmount
|
||||
|
||||
▸ `Protected` **unitsToAmount**(`token`, `amount`, `tokenDecimals?`): `Promise`<`string`\>
|
||||
|
||||
Converts an amount of units to tokens
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `token` | `string` | The token to convert |
|
||||
| `amount` | `string` | The amount of units to convert |
|
||||
| `tokenDecimals?` | `number` | The number of decimals in the token |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The converted amount in tokens
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[unitsToAmount](SmartContractWithAddress.md#unitstoamount)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:58](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L58)
|
|
@ -0,0 +1,325 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / VeFeeDistributor
|
||||
|
||||
# Class: VeFeeDistributor
|
||||
|
||||
Provides an interface for veOcean contract
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- [`SmartContractWithAddress`](SmartContractWithAddress.md)
|
||||
|
||||
↳ **`VeFeeDistributor`**
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Constructors
|
||||
|
||||
- [constructor](VeFeeDistributor.md#constructor)
|
||||
|
||||
### Properties
|
||||
|
||||
- [abi](VeFeeDistributor.md#abi)
|
||||
- [address](VeFeeDistributor.md#address)
|
||||
- [config](VeFeeDistributor.md#config)
|
||||
- [contract](VeFeeDistributor.md#contract)
|
||||
- [signer](VeFeeDistributor.md#signer)
|
||||
|
||||
### Methods
|
||||
|
||||
- [amountToUnits](VeFeeDistributor.md#amounttounits)
|
||||
- [claim](VeFeeDistributor.md#claim)
|
||||
- [claimMany](VeFeeDistributor.md#claimmany)
|
||||
- [getContract](VeFeeDistributor.md#getcontract)
|
||||
- [getDefaultAbi](VeFeeDistributor.md#getdefaultabi)
|
||||
- [getFairGasPrice](VeFeeDistributor.md#getfairgasprice)
|
||||
- [unitsToAmount](VeFeeDistributor.md#unitstoamount)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new VeFeeDistributor**(`address`, `signer`, `network?`, `config?`, `abi?`)
|
||||
|
||||
Instantiate the smart contract.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `address` | `string` | The address of the contract. |
|
||||
| `signer` | `Signer` | The signer object. |
|
||||
| `network?` | `string` \| `number` | Network id or name |
|
||||
| `config?` | [`Config`](Config.md) | The configuration object. |
|
||||
| `abi?` | [`AbiItem`](../interfaces/AbiItem.md)[] | ABI array of the smart contract |
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[constructor](SmartContractWithAddress.md#constructor)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContractWithAddress.ts:17](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L17)
|
||||
|
||||
## Properties
|
||||
|
||||
### abi
|
||||
|
||||
• **abi**: [`AbiItem`](../interfaces/AbiItem.md)[]
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[abi](SmartContractWithAddress.md#abi)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:14](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### address
|
||||
|
||||
• **address**: `string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[address](SmartContractWithAddress.md#address)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContractWithAddress.ts:6](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L6)
|
||||
|
||||
___
|
||||
|
||||
### config
|
||||
|
||||
• **config**: [`Config`](Config.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[config](SmartContractWithAddress.md#config)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:13](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### contract
|
||||
|
||||
• **contract**: `Contract`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[contract](SmartContractWithAddress.md#contract)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContractWithAddress.ts:7](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L7)
|
||||
|
||||
___
|
||||
|
||||
### signer
|
||||
|
||||
• **signer**: `Signer`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[signer](SmartContractWithAddress.md#signer)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:12](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L12)
|
||||
|
||||
## Methods
|
||||
|
||||
### amountToUnits
|
||||
|
||||
▸ `Protected` **amountToUnits**(`token`, `amount`, `tokenDecimals?`): `Promise`<`string`\>
|
||||
|
||||
Converts an amount of tokens to units
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `token` | `string` | The token to convert |
|
||||
| `amount` | `string` | The amount of tokens to convert |
|
||||
| `tokenDecimals?` | `number` | The number of decimals of the token |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The converted amount in units
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[amountToUnits](SmartContractWithAddress.md#amounttounits)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:43](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L43)
|
||||
|
||||
___
|
||||
|
||||
### claim
|
||||
|
||||
▸ **claim**<`G`\>(`estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Claim fees for `userAddress`
|
||||
Each call to claim look at a maximum of 50 user veOCEAN points.
|
||||
For accounts with many veOCEAN related actions, this function
|
||||
may need to be called more than once to claim all available
|
||||
fees. In the `Claimed` event that fires, if `claim_epoch` is
|
||||
less than `max_epoch`, the account may claim again
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/ve/VeFeeDistributor.ts:23](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/ve/VeFeeDistributor.ts#L23)
|
||||
|
||||
___
|
||||
|
||||
### claimMany
|
||||
|
||||
▸ **claimMany**<`G`\>(`addresses`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Make multiple fee claims in a single call
|
||||
Used to claim for many accounts at once, or to make
|
||||
multiple claims for the same address when that address
|
||||
has significant veOCEAN history
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `addresses` | `string`[] | array of addresses to claim |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/ve/VeFeeDistributor.ts:48](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/ve/VeFeeDistributor.ts#L48)
|
||||
|
||||
___
|
||||
|
||||
### getContract
|
||||
|
||||
▸ `Protected` **getContract**(`address`, `abi?`): `Contract`
|
||||
|
||||
Returns a contract instance for the given address
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `address` | `string` | The address of the contract |
|
||||
| `abi?` | [`AbiItem`](../interfaces/AbiItem.md)[] | The ABI of the contract |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Contract`
|
||||
|
||||
- The contract instance
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[getContract](SmartContractWithAddress.md#getcontract)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:80](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L80)
|
||||
|
||||
___
|
||||
|
||||
### getDefaultAbi
|
||||
|
||||
▸ **getDefaultAbi**(): [`AbiItem`](../interfaces/AbiItem.md)[]
|
||||
|
||||
#### Returns
|
||||
|
||||
[`AbiItem`](../interfaces/AbiItem.md)[]
|
||||
|
||||
#### Overrides
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[getDefaultAbi](SmartContractWithAddress.md#getdefaultabi)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/ve/VeFeeDistributor.ts:9](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/ve/VeFeeDistributor.ts#L9)
|
||||
|
||||
___
|
||||
|
||||
### getFairGasPrice
|
||||
|
||||
▸ `Protected` **getFairGasPrice**(): `Promise`<`string`\>
|
||||
|
||||
Retruns the gas price
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The fair gas price
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[getFairGasPrice](SmartContractWithAddress.md#getfairgasprice)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:70](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L70)
|
||||
|
||||
___
|
||||
|
||||
### unitsToAmount
|
||||
|
||||
▸ `Protected` **unitsToAmount**(`token`, `amount`, `tokenDecimals?`): `Promise`<`string`\>
|
||||
|
||||
Converts an amount of units to tokens
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `token` | `string` | The token to convert |
|
||||
| `amount` | `string` | The amount of units to convert |
|
||||
| `tokenDecimals?` | `number` | The number of decimals in the token |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The converted amount in tokens
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[unitsToAmount](SmartContractWithAddress.md#unitstoamount)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:58](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L58)
|
|
@ -0,0 +1,281 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / VeFeeEstimate
|
||||
|
||||
# Class: VeFeeEstimate
|
||||
|
||||
Provides an interface for veOcean contract
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- [`SmartContractWithAddress`](SmartContractWithAddress.md)
|
||||
|
||||
↳ **`VeFeeEstimate`**
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Constructors
|
||||
|
||||
- [constructor](VeFeeEstimate.md#constructor)
|
||||
|
||||
### Properties
|
||||
|
||||
- [abi](VeFeeEstimate.md#abi)
|
||||
- [address](VeFeeEstimate.md#address)
|
||||
- [config](VeFeeEstimate.md#config)
|
||||
- [contract](VeFeeEstimate.md#contract)
|
||||
- [signer](VeFeeEstimate.md#signer)
|
||||
|
||||
### Methods
|
||||
|
||||
- [amountToUnits](VeFeeEstimate.md#amounttounits)
|
||||
- [estimateClaim](VeFeeEstimate.md#estimateclaim)
|
||||
- [getContract](VeFeeEstimate.md#getcontract)
|
||||
- [getDefaultAbi](VeFeeEstimate.md#getdefaultabi)
|
||||
- [getFairGasPrice](VeFeeEstimate.md#getfairgasprice)
|
||||
- [unitsToAmount](VeFeeEstimate.md#unitstoamount)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new VeFeeEstimate**(`address`, `signer`, `network?`, `config?`, `abi?`)
|
||||
|
||||
Instantiate the smart contract.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `address` | `string` | The address of the contract. |
|
||||
| `signer` | `Signer` | The signer object. |
|
||||
| `network?` | `string` \| `number` | Network id or name |
|
||||
| `config?` | [`Config`](Config.md) | The configuration object. |
|
||||
| `abi?` | [`AbiItem`](../interfaces/AbiItem.md)[] | ABI array of the smart contract |
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[constructor](SmartContractWithAddress.md#constructor)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContractWithAddress.ts:17](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L17)
|
||||
|
||||
## Properties
|
||||
|
||||
### abi
|
||||
|
||||
• **abi**: [`AbiItem`](../interfaces/AbiItem.md)[]
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[abi](SmartContractWithAddress.md#abi)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:14](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### address
|
||||
|
||||
• **address**: `string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[address](SmartContractWithAddress.md#address)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContractWithAddress.ts:6](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L6)
|
||||
|
||||
___
|
||||
|
||||
### config
|
||||
|
||||
• **config**: [`Config`](Config.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[config](SmartContractWithAddress.md#config)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:13](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### contract
|
||||
|
||||
• **contract**: `Contract`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[contract](SmartContractWithAddress.md#contract)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContractWithAddress.ts:7](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L7)
|
||||
|
||||
___
|
||||
|
||||
### signer
|
||||
|
||||
• **signer**: `Signer`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[signer](SmartContractWithAddress.md#signer)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:12](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L12)
|
||||
|
||||
## Methods
|
||||
|
||||
### amountToUnits
|
||||
|
||||
▸ `Protected` **amountToUnits**(`token`, `amount`, `tokenDecimals?`): `Promise`<`string`\>
|
||||
|
||||
Converts an amount of tokens to units
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `token` | `string` | The token to convert |
|
||||
| `amount` | `string` | The amount of tokens to convert |
|
||||
| `tokenDecimals?` | `number` | The number of decimals of the token |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The converted amount in units
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[amountToUnits](SmartContractWithAddress.md#amounttounits)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:43](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L43)
|
||||
|
||||
___
|
||||
|
||||
### estimateClaim
|
||||
|
||||
▸ **estimateClaim**(`userAddress`): `Promise`<`string`\>
|
||||
|
||||
estimateClaim
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `userAddress` | `string` | user address |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/ve/VeFeeEstimate.ts:18](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/ve/VeFeeEstimate.ts#L18)
|
||||
|
||||
___
|
||||
|
||||
### getContract
|
||||
|
||||
▸ `Protected` **getContract**(`address`, `abi?`): `Contract`
|
||||
|
||||
Returns a contract instance for the given address
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `address` | `string` | The address of the contract |
|
||||
| `abi?` | [`AbiItem`](../interfaces/AbiItem.md)[] | The ABI of the contract |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Contract`
|
||||
|
||||
- The contract instance
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[getContract](SmartContractWithAddress.md#getcontract)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:80](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L80)
|
||||
|
||||
___
|
||||
|
||||
### getDefaultAbi
|
||||
|
||||
▸ **getDefaultAbi**(): [`AbiItem`](../interfaces/AbiItem.md)[]
|
||||
|
||||
#### Returns
|
||||
|
||||
[`AbiItem`](../interfaces/AbiItem.md)[]
|
||||
|
||||
#### Overrides
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[getDefaultAbi](SmartContractWithAddress.md#getdefaultabi)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/ve/VeFeeEstimate.ts:9](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/ve/VeFeeEstimate.ts#L9)
|
||||
|
||||
___
|
||||
|
||||
### getFairGasPrice
|
||||
|
||||
▸ `Protected` **getFairGasPrice**(): `Promise`<`string`\>
|
||||
|
||||
Retruns the gas price
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The fair gas price
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[getFairGasPrice](SmartContractWithAddress.md#getfairgasprice)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:70](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L70)
|
||||
|
||||
___
|
||||
|
||||
### unitsToAmount
|
||||
|
||||
▸ `Protected` **unitsToAmount**(`token`, `amount`, `tokenDecimals?`): `Promise`<`string`\>
|
||||
|
||||
Converts an amount of units to tokens
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `token` | `string` | The token to convert |
|
||||
| `amount` | `string` | The amount of units to convert |
|
||||
| `tokenDecimals?` | `number` | The number of decimals in the token |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The converted amount in tokens
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[unitsToAmount](SmartContractWithAddress.md#unitstoamount)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:58](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L58)
|
|
@ -0,0 +1,513 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / VeOcean
|
||||
|
||||
# Class: VeOcean
|
||||
|
||||
Provides an interface for veOcean contract
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- [`SmartContractWithAddress`](SmartContractWithAddress.md)
|
||||
|
||||
↳ **`VeOcean`**
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Constructors
|
||||
|
||||
- [constructor](VeOcean.md#constructor)
|
||||
|
||||
### Properties
|
||||
|
||||
- [abi](VeOcean.md#abi)
|
||||
- [address](VeOcean.md#address)
|
||||
- [config](VeOcean.md#config)
|
||||
- [contract](VeOcean.md#contract)
|
||||
- [signer](VeOcean.md#signer)
|
||||
|
||||
### Methods
|
||||
|
||||
- [amountToUnits](VeOcean.md#amounttounits)
|
||||
- [depositFor](VeOcean.md#depositfor)
|
||||
- [getContract](VeOcean.md#getcontract)
|
||||
- [getDefaultAbi](VeOcean.md#getdefaultabi)
|
||||
- [getFairGasPrice](VeOcean.md#getfairgasprice)
|
||||
- [getLockedAmount](VeOcean.md#getlockedamount)
|
||||
- [getToken](VeOcean.md#gettoken)
|
||||
- [getVotingPower](VeOcean.md#getvotingpower)
|
||||
- [increaseAmount](VeOcean.md#increaseamount)
|
||||
- [increaseUnlockTime](VeOcean.md#increaseunlocktime)
|
||||
- [lockEnd](VeOcean.md#lockend)
|
||||
- [lockTokens](VeOcean.md#locktokens)
|
||||
- [totalSupply](VeOcean.md#totalsupply)
|
||||
- [unitsToAmount](VeOcean.md#unitstoamount)
|
||||
- [withdraw](VeOcean.md#withdraw)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new VeOcean**(`address`, `signer`, `network?`, `config?`, `abi?`)
|
||||
|
||||
Instantiate the smart contract.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `address` | `string` | The address of the contract. |
|
||||
| `signer` | `Signer` | The signer object. |
|
||||
| `network?` | `string` \| `number` | Network id or name |
|
||||
| `config?` | [`Config`](Config.md) | The configuration object. |
|
||||
| `abi?` | [`AbiItem`](../interfaces/AbiItem.md)[] | ABI array of the smart contract |
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[constructor](SmartContractWithAddress.md#constructor)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContractWithAddress.ts:17](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L17)
|
||||
|
||||
## Properties
|
||||
|
||||
### abi
|
||||
|
||||
• **abi**: [`AbiItem`](../interfaces/AbiItem.md)[]
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[abi](SmartContractWithAddress.md#abi)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:14](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### address
|
||||
|
||||
• **address**: `string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[address](SmartContractWithAddress.md#address)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContractWithAddress.ts:6](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L6)
|
||||
|
||||
___
|
||||
|
||||
### config
|
||||
|
||||
• **config**: [`Config`](Config.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[config](SmartContractWithAddress.md#config)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:13](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### contract
|
||||
|
||||
• **contract**: `Contract`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[contract](SmartContractWithAddress.md#contract)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContractWithAddress.ts:7](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L7)
|
||||
|
||||
___
|
||||
|
||||
### signer
|
||||
|
||||
• **signer**: `Signer`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[signer](SmartContractWithAddress.md#signer)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:12](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L12)
|
||||
|
||||
## Methods
|
||||
|
||||
### amountToUnits
|
||||
|
||||
▸ `Protected` **amountToUnits**(`token`, `amount`, `tokenDecimals?`): `Promise`<`string`\>
|
||||
|
||||
Converts an amount of tokens to units
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `token` | `string` | The token to convert |
|
||||
| `amount` | `string` | The amount of tokens to convert |
|
||||
| `tokenDecimals?` | `number` | The number of decimals of the token |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The converted amount in units
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[amountToUnits](SmartContractWithAddress.md#amounttounits)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:43](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L43)
|
||||
|
||||
___
|
||||
|
||||
### depositFor
|
||||
|
||||
▸ **depositFor**<`G`\>(`toAddress`, `amount`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Deposit `amount` tokens for `toAddress` and add to the existing lock
|
||||
Anyone (even a smart contract) can deposit for someone else, but cannot extend their locktime and deposit for a brand new user
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `toAddress` | `string` | user address to deposit for |
|
||||
| `amount` | `string` | Amount of tokens to be locked |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/ve/VeOcean.ts:52](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/ve/VeOcean.ts#L52)
|
||||
|
||||
___
|
||||
|
||||
### getContract
|
||||
|
||||
▸ `Protected` **getContract**(`address`, `abi?`): `Contract`
|
||||
|
||||
Returns a contract instance for the given address
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `address` | `string` | The address of the contract |
|
||||
| `abi?` | [`AbiItem`](../interfaces/AbiItem.md)[] | The ABI of the contract |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Contract`
|
||||
|
||||
- The contract instance
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[getContract](SmartContractWithAddress.md#getcontract)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:80](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L80)
|
||||
|
||||
___
|
||||
|
||||
### getDefaultAbi
|
||||
|
||||
▸ **getDefaultAbi**(): [`AbiItem`](../interfaces/AbiItem.md)[]
|
||||
|
||||
#### Returns
|
||||
|
||||
[`AbiItem`](../interfaces/AbiItem.md)[]
|
||||
|
||||
#### Overrides
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[getDefaultAbi](SmartContractWithAddress.md#getdefaultabi)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/ve/VeOcean.ts:9](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/ve/VeOcean.ts#L9)
|
||||
|
||||
___
|
||||
|
||||
### getFairGasPrice
|
||||
|
||||
▸ `Protected` **getFairGasPrice**(): `Promise`<`string`\>
|
||||
|
||||
Retruns the gas price
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The fair gas price
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[getFairGasPrice](SmartContractWithAddress.md#getfairgasprice)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:70](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L70)
|
||||
|
||||
___
|
||||
|
||||
### getLockedAmount
|
||||
|
||||
▸ **getLockedAmount**(`userAddress`): `Promise`<`string`\>
|
||||
|
||||
Get locked balance
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `userAddress` | `string` | user address |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/ve/VeOcean.ts:156](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/ve/VeOcean.ts#L156)
|
||||
|
||||
___
|
||||
|
||||
### getToken
|
||||
|
||||
▸ **getToken**(): `Promise`<`string`\>
|
||||
|
||||
Get token
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/ve/VeOcean.ts:189](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/ve/VeOcean.ts#L189)
|
||||
|
||||
___
|
||||
|
||||
### getVotingPower
|
||||
|
||||
▸ **getVotingPower**(`userAddress`): `Promise`<`number`\>
|
||||
|
||||
Get voting power for address
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `userAddress` | `string` | user address |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`number`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/ve/VeOcean.ts:147](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/ve/VeOcean.ts#L147)
|
||||
|
||||
___
|
||||
|
||||
### increaseAmount
|
||||
|
||||
▸ **increaseAmount**<`G`\>(`amount`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Deposit `amount` additional tokens for `userAddress` without modifying the unlock time
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `amount` | `string` | Amount of tokens to be locked |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/ve/VeOcean.ts:79](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/ve/VeOcean.ts#L79)
|
||||
|
||||
___
|
||||
|
||||
### increaseUnlockTime
|
||||
|
||||
▸ **increaseUnlockTime**<`G`\>(`unlockTime`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Extend the unlock time for `userAddress` to `unlockTime`
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `unlockTime` | `number` | Timestamp for new unlock time |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/ve/VeOcean.ts:104](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/ve/VeOcean.ts#L104)
|
||||
|
||||
___
|
||||
|
||||
### lockEnd
|
||||
|
||||
▸ **lockEnd**(`userAddress`): `Promise`<`number`\>
|
||||
|
||||
Get untilLock for address
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `userAddress` | `string` | user address |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`number`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/ve/VeOcean.ts:170](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/ve/VeOcean.ts#L170)
|
||||
|
||||
___
|
||||
|
||||
### lockTokens
|
||||
|
||||
▸ **lockTokens**<`G`\>(`amount`, `unlockTime`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Deposit `amount` tokens for `userAddress` and lock until `unlockTime`
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `amount` | `string` | Amount of tokens to be locked |
|
||||
| `unlockTime` | `number` | Timestamp for unlock |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/ve/VeOcean.ts:20](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/ve/VeOcean.ts#L20)
|
||||
|
||||
___
|
||||
|
||||
### totalSupply
|
||||
|
||||
▸ **totalSupply**(): `Promise`<`string`\>
|
||||
|
||||
Get total supply
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/ve/VeOcean.ts:178](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/ve/VeOcean.ts#L178)
|
||||
|
||||
___
|
||||
|
||||
### unitsToAmount
|
||||
|
||||
▸ `Protected` **unitsToAmount**(`token`, `amount`, `tokenDecimals?`): `Promise`<`string`\>
|
||||
|
||||
Converts an amount of units to tokens
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `token` | `string` | The token to convert |
|
||||
| `amount` | `string` | The amount of units to convert |
|
||||
| `tokenDecimals?` | `number` | The number of decimals in the token |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The converted amount in tokens
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[SmartContractWithAddress](SmartContractWithAddress.md).[unitsToAmount](SmartContractWithAddress.md#unitstoamount)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/SmartContract.ts:58](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L58)
|
||||
|
||||
___
|
||||
|
||||
### withdraw
|
||||
|
||||
▸ **withdraw**<`G`\>(`estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Withdraw all tokens for `userAddress`
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `estimateGas?` | `G` | if True, return gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[contracts/ve/VeOcean.ts:127](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/ve/VeOcean.ts#L127)
|
|
@ -0,0 +1,63 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / LogLevel
|
||||
|
||||
# Enumeration: LogLevel
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Enumeration Members
|
||||
|
||||
- [Error](LogLevel.md#error)
|
||||
- [Log](LogLevel.md#log)
|
||||
- [None](LogLevel.md#none)
|
||||
- [Verbose](LogLevel.md#verbose)
|
||||
- [Warn](LogLevel.md#warn)
|
||||
|
||||
## Enumeration Members
|
||||
|
||||
### Error
|
||||
|
||||
• **Error** = ``0``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/Logger.ts:4](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/Logger.ts#L4)
|
||||
|
||||
___
|
||||
|
||||
### Log
|
||||
|
||||
• **Log** = ``2``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/Logger.ts:6](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/Logger.ts#L6)
|
||||
|
||||
___
|
||||
|
||||
### None
|
||||
|
||||
• **None** = ``-1``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/Logger.ts:3](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/Logger.ts#L3)
|
||||
|
||||
___
|
||||
|
||||
### Verbose
|
||||
|
||||
• **Verbose** = ``3``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/Logger.ts:7](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/Logger.ts#L7)
|
||||
|
||||
___
|
||||
|
||||
### Warn
|
||||
|
||||
• **Warn** = ``1``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/Logger.ts:5](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/Logger.ts#L5)
|
|
@ -0,0 +1,63 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / AbiInput
|
||||
|
||||
# Interface: AbiInput
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [components](AbiInput.md#components)
|
||||
- [indexed](AbiInput.md#indexed)
|
||||
- [internalType](AbiInput.md#internaltype)
|
||||
- [name](AbiInput.md#name)
|
||||
- [type](AbiInput.md#type)
|
||||
|
||||
## Properties
|
||||
|
||||
### components
|
||||
|
||||
• `Optional` **components**: [`AbiInput`](AbiInput.md)[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Contracts.ts:8](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Contracts.ts#L8)
|
||||
|
||||
___
|
||||
|
||||
### indexed
|
||||
|
||||
• `Optional` **indexed**: `boolean`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Contracts.ts:7](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Contracts.ts#L7)
|
||||
|
||||
___
|
||||
|
||||
### internalType
|
||||
|
||||
• `Optional` **internalType**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Contracts.ts:9](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Contracts.ts#L9)
|
||||
|
||||
___
|
||||
|
||||
### name
|
||||
|
||||
• **name**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Contracts.ts:5](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Contracts.ts#L5)
|
||||
|
||||
___
|
||||
|
||||
### type
|
||||
|
||||
• **type**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Contracts.ts:6](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Contracts.ts#L6)
|
|
@ -0,0 +1,107 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / AbiItem
|
||||
|
||||
# Interface: AbiItem
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [anonymous](AbiItem.md#anonymous)
|
||||
- [constant](AbiItem.md#constant)
|
||||
- [gas](AbiItem.md#gas)
|
||||
- [inputs](AbiItem.md#inputs)
|
||||
- [name](AbiItem.md#name)
|
||||
- [outputs](AbiItem.md#outputs)
|
||||
- [payable](AbiItem.md#payable)
|
||||
- [stateMutability](AbiItem.md#statemutability)
|
||||
- [type](AbiItem.md#type)
|
||||
|
||||
## Properties
|
||||
|
||||
### anonymous
|
||||
|
||||
• `Optional` **anonymous**: `boolean`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Contracts.ts:20](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Contracts.ts#L20)
|
||||
|
||||
___
|
||||
|
||||
### constant
|
||||
|
||||
• `Optional` **constant**: `boolean`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Contracts.ts:21](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Contracts.ts#L21)
|
||||
|
||||
___
|
||||
|
||||
### gas
|
||||
|
||||
• `Optional` **gas**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Contracts.ts:28](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Contracts.ts#L28)
|
||||
|
||||
___
|
||||
|
||||
### inputs
|
||||
|
||||
• `Optional` **inputs**: [`AbiInput`](AbiInput.md)[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Contracts.ts:22](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Contracts.ts#L22)
|
||||
|
||||
___
|
||||
|
||||
### name
|
||||
|
||||
• `Optional` **name**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Contracts.ts:23](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Contracts.ts#L23)
|
||||
|
||||
___
|
||||
|
||||
### outputs
|
||||
|
||||
• `Optional` **outputs**: [`AbiOutput`](AbiOutput.md)[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Contracts.ts:24](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Contracts.ts#L24)
|
||||
|
||||
___
|
||||
|
||||
### payable
|
||||
|
||||
• `Optional` **payable**: `boolean`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Contracts.ts:25](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Contracts.ts#L25)
|
||||
|
||||
___
|
||||
|
||||
### stateMutability
|
||||
|
||||
• `Optional` **stateMutability**: [`StateMutabilityType`](../modules.md#statemutabilitytype)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Contracts.ts:26](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Contracts.ts#L26)
|
||||
|
||||
___
|
||||
|
||||
### type
|
||||
|
||||
• **type**: [`AbiType`](../modules.md#abitype)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Contracts.ts:27](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Contracts.ts#L27)
|
|
@ -0,0 +1,52 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / AbiOutput
|
||||
|
||||
# Interface: AbiOutput
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [components](AbiOutput.md#components)
|
||||
- [internalType](AbiOutput.md#internaltype)
|
||||
- [name](AbiOutput.md#name)
|
||||
- [type](AbiOutput.md#type)
|
||||
|
||||
## Properties
|
||||
|
||||
### components
|
||||
|
||||
• `Optional` **components**: [`AbiOutput`](AbiOutput.md)[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Contracts.ts:15](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Contracts.ts#L15)
|
||||
|
||||
___
|
||||
|
||||
### internalType
|
||||
|
||||
• `Optional` **internalType**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Contracts.ts:16](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Contracts.ts#L16)
|
||||
|
||||
___
|
||||
|
||||
### name
|
||||
|
||||
• **name**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Contracts.ts:13](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Contracts.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### type
|
||||
|
||||
• **type**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Contracts.ts:14](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Contracts.ts#L14)
|
|
@ -0,0 +1,32 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / Arweave
|
||||
|
||||
# Interface: Arweave
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [transactionId](Arweave.md#transactionid)
|
||||
- [type](Arweave.md#type)
|
||||
|
||||
## Properties
|
||||
|
||||
### transactionId
|
||||
|
||||
• **transactionId**: `string`
|
||||
|
||||
transactionId
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/File.ts:68](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/File.ts#L68)
|
||||
|
||||
___
|
||||
|
||||
### type
|
||||
|
||||
• **type**: ``"arweave"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/File.ts:62](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/File.ts#L62)
|
|
@ -0,0 +1,227 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / Asset
|
||||
|
||||
# Interface: Asset
|
||||
|
||||
DID Descriptor Object.
|
||||
Contains metadata about the asset, and define access in at least one service.
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- [`DDO`](DDO.md)
|
||||
|
||||
↳ **`Asset`**
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [@context](Asset.md#@context)
|
||||
- [chainId](Asset.md#chainid)
|
||||
- [credentials](Asset.md#credentials)
|
||||
- [datatokens](Asset.md#datatokens)
|
||||
- [event](Asset.md#event)
|
||||
- [id](Asset.md#id)
|
||||
- [metadata](Asset.md#metadata)
|
||||
- [nft](Asset.md#nft)
|
||||
- [nftAddress](Asset.md#nftaddress)
|
||||
- [purgatory](Asset.md#purgatory)
|
||||
- [services](Asset.md#services)
|
||||
- [stats](Asset.md#stats)
|
||||
- [version](Asset.md#version)
|
||||
|
||||
## Properties
|
||||
|
||||
### @context
|
||||
|
||||
• **@context**: `string`[]
|
||||
|
||||
Contexts used for validation.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[DDO](DDO.md).[@context](DDO.md#@context)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/DDO.ts:12](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/DDO.ts#L12)
|
||||
|
||||
___
|
||||
|
||||
### chainId
|
||||
|
||||
• **chainId**: `number`
|
||||
|
||||
ChainId of the network the DDO was published to.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[DDO](DDO.md).[chainId](DDO.md#chainid)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/DDO.ts:38](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/DDO.ts#L38)
|
||||
|
||||
___
|
||||
|
||||
### credentials
|
||||
|
||||
• `Optional` **credentials**: [`Credentials`](Credentials.md)
|
||||
|
||||
Describes the credentials needed to access a dataset
|
||||
in addition to the services definition.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[DDO](DDO.md).[credentials](DDO.md#credentials)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/DDO.ts:57](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/DDO.ts#L57)
|
||||
|
||||
___
|
||||
|
||||
### datatokens
|
||||
|
||||
• **datatokens**: [`AssetDatatoken`](AssetDatatoken.md)[]
|
||||
|
||||
Contains information about the ERC20 Datatokens attached to asset services.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Asset.ts:151](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Asset.ts#L151)
|
||||
|
||||
___
|
||||
|
||||
### event
|
||||
|
||||
• **event**: [`AssetLastEvent`](AssetLastEvent.md)
|
||||
|
||||
Contains information about the last transaction that created or updated the DDO.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[DDO](DDO.md).[event](DDO.md#event)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Asset.ts:157](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Asset.ts#L157)
|
||||
|
||||
___
|
||||
|
||||
### id
|
||||
|
||||
• **id**: `string`
|
||||
|
||||
DID, descentralized ID.
|
||||
Computed as sha256(address of NFT contract + chainId)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[DDO](DDO.md).[id](DDO.md#id)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/DDO.ts:19](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/DDO.ts#L19)
|
||||
|
||||
___
|
||||
|
||||
### metadata
|
||||
|
||||
• **metadata**: [`Metadata`](Metadata.md)
|
||||
|
||||
Stores an object describing the asset.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[DDO](DDO.md).[metadata](DDO.md#metadata)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/DDO.ts:44](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/DDO.ts#L44)
|
||||
|
||||
___
|
||||
|
||||
### nft
|
||||
|
||||
• **nft**: [`AssetNft`](AssetNft.md)
|
||||
|
||||
Contains information about the ERC721 NFT contract which represents the intellectual property of the publisher.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Asset.ts:145](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Asset.ts#L145)
|
||||
|
||||
___
|
||||
|
||||
### nftAddress
|
||||
|
||||
• **nftAddress**: `string`
|
||||
|
||||
NFT contract address
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[DDO](DDO.md).[nftAddress](DDO.md#nftaddress)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/DDO.ts:32](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/DDO.ts#L32)
|
||||
|
||||
___
|
||||
|
||||
### purgatory
|
||||
|
||||
• **purgatory**: [`Purgatory`](Purgatory.md)
|
||||
|
||||
Contains information about an asset's purgatory status defined in
|
||||
[`list-purgatory`](https://github.com/oceanprotocol/list-purgatory).
|
||||
Marketplace interfaces are encouraged to prevent certain user actions like downloading on assets in purgatory.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Asset.ts:171](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Asset.ts#L171)
|
||||
|
||||
___
|
||||
|
||||
### services
|
||||
|
||||
• **services**: [`Service`](Service.md)[]
|
||||
|
||||
Stores an array of services defining access to the asset.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[DDO](DDO.md).[services](DDO.md#services)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/DDO.ts:50](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/DDO.ts#L50)
|
||||
|
||||
___
|
||||
|
||||
### stats
|
||||
|
||||
• **stats**: [`Stats`](Stats.md)
|
||||
|
||||
The stats section contains different statistics fields. This section is added by Aquarius
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Asset.ts:163](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Asset.ts#L163)
|
||||
|
||||
___
|
||||
|
||||
### version
|
||||
|
||||
• **version**: `string`
|
||||
|
||||
Version information in SemVer notation
|
||||
referring to the DDO spec version
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[DDO](DDO.md).[version](DDO.md#version)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/DDO.ts:26](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/DDO.ts#L26)
|
|
@ -0,0 +1,60 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / AssetDatatoken
|
||||
|
||||
# Interface: AssetDatatoken
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [address](AssetDatatoken.md#address)
|
||||
- [name](AssetDatatoken.md#name)
|
||||
- [serviceId](AssetDatatoken.md#serviceid)
|
||||
- [symbol](AssetDatatoken.md#symbol)
|
||||
|
||||
## Properties
|
||||
|
||||
### address
|
||||
|
||||
• **address**: `string`
|
||||
|
||||
Contract address of the deployed Datatoken contract.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Asset.ts:72](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Asset.ts#L72)
|
||||
|
||||
___
|
||||
|
||||
### name
|
||||
|
||||
• **name**: `string`
|
||||
|
||||
Name of NFT set in contract.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Asset.ts:78](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Asset.ts#L78)
|
||||
|
||||
___
|
||||
|
||||
### serviceId
|
||||
|
||||
• **serviceId**: `string`
|
||||
|
||||
ID of the service the datatoken is attached to.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Asset.ts:90](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Asset.ts#L90)
|
||||
|
||||
___
|
||||
|
||||
### symbol
|
||||
|
||||
• **symbol**: `string`
|
||||
|
||||
Symbol of NFT set in contract.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Asset.ts:84](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Asset.ts#L84)
|
|
@ -0,0 +1,63 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / AssetLastEvent
|
||||
|
||||
# Interface: AssetLastEvent
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [block](AssetLastEvent.md#block)
|
||||
- [contract](AssetLastEvent.md#contract)
|
||||
- [datetime](AssetLastEvent.md#datetime)
|
||||
- [from](AssetLastEvent.md#from)
|
||||
- [tx](AssetLastEvent.md#tx)
|
||||
|
||||
## Properties
|
||||
|
||||
### block
|
||||
|
||||
• **block**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Asset.ts:134](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Asset.ts#L134)
|
||||
|
||||
___
|
||||
|
||||
### contract
|
||||
|
||||
• **contract**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Asset.ts:136](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Asset.ts#L136)
|
||||
|
||||
___
|
||||
|
||||
### datetime
|
||||
|
||||
• **datetime**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Asset.ts:137](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Asset.ts#L137)
|
||||
|
||||
___
|
||||
|
||||
### from
|
||||
|
||||
• **from**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Asset.ts:135](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Asset.ts#L135)
|
||||
|
||||
___
|
||||
|
||||
### tx
|
||||
|
||||
• **tx**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Asset.ts:133](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Asset.ts#L133)
|
|
@ -0,0 +1,105 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / AssetNft
|
||||
|
||||
# Interface: AssetNft
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [address](AssetNft.md#address)
|
||||
- [created](AssetNft.md#created)
|
||||
- [name](AssetNft.md#name)
|
||||
- [owner](AssetNft.md#owner)
|
||||
- [state](AssetNft.md#state)
|
||||
- [symbol](AssetNft.md#symbol)
|
||||
- [tokenURI](AssetNft.md#tokenuri)
|
||||
|
||||
## Properties
|
||||
|
||||
### address
|
||||
|
||||
• **address**: `string`
|
||||
|
||||
Contract address of the deployed ERC721 NFT contract.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Asset.ts:8](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Asset.ts#L8)
|
||||
|
||||
___
|
||||
|
||||
### created
|
||||
|
||||
• **created**: `string`
|
||||
|
||||
Contains the date of NFT creation.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Asset.ts:44](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Asset.ts#L44)
|
||||
|
||||
___
|
||||
|
||||
### name
|
||||
|
||||
• **name**: `string`
|
||||
|
||||
Name of NFT set in contract.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Asset.ts:14](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Asset.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### owner
|
||||
|
||||
• **owner**: `string`
|
||||
|
||||
ETH account address of the NFT owner.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Asset.ts:26](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Asset.ts#L26)
|
||||
|
||||
___
|
||||
|
||||
### state
|
||||
|
||||
• **state**: ``0`` \| ``2`` \| ``1`` \| ``3`` \| ``4`` \| ``5``
|
||||
|
||||
State of the asset reflecting the NFT contract value.
|
||||
0 Active.
|
||||
1 End-of-life.
|
||||
2 Deprecated (by another asset).
|
||||
3 Revoked by publisher.
|
||||
4 Ordering is temporary disabled.
|
||||
5 Unlisted in markets.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Asset.ts:38](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Asset.ts#L38)
|
||||
|
||||
___
|
||||
|
||||
### symbol
|
||||
|
||||
• **symbol**: `string`
|
||||
|
||||
Symbol of NFT set in contract.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Asset.ts:20](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Asset.ts#L20)
|
||||
|
||||
___
|
||||
|
||||
### tokenURI
|
||||
|
||||
• **tokenURI**: `string`
|
||||
|
||||
NFT token URI.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Asset.ts:50](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Asset.ts#L50)
|
|
@ -0,0 +1,47 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / AssetPrice
|
||||
|
||||
# Interface: AssetPrice
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [tokenAddress](AssetPrice.md#tokenaddress)
|
||||
- [tokenSymbol](AssetPrice.md#tokensymbol)
|
||||
- [value](AssetPrice.md#value)
|
||||
|
||||
## Properties
|
||||
|
||||
### tokenAddress
|
||||
|
||||
• `Optional` **tokenAddress**: `string`
|
||||
|
||||
The address of the token that the price needs to be paid in.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Asset.ts:110](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Asset.ts#L110)
|
||||
|
||||
___
|
||||
|
||||
### tokenSymbol
|
||||
|
||||
• `Optional` **tokenSymbol**: `string`
|
||||
|
||||
The symbol that the price of the asset is expressed in.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Asset.ts:104](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Asset.ts#L104)
|
||||
|
||||
___
|
||||
|
||||
### value
|
||||
|
||||
• **value**: `number`
|
||||
|
||||
The price of the asset expressed as a number. If 0 then the price is FREE.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Asset.ts:98](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Asset.ts#L98)
|
|
@ -0,0 +1,82 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / ComputeAlgorithm
|
||||
|
||||
# Interface: ComputeAlgorithm
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [algocustomdata](ComputeAlgorithm.md#algocustomdata)
|
||||
- [documentId](ComputeAlgorithm.md#documentid)
|
||||
- [meta](ComputeAlgorithm.md#meta)
|
||||
- [serviceId](ComputeAlgorithm.md#serviceid)
|
||||
- [transferTxId](ComputeAlgorithm.md#transfertxid)
|
||||
- [userdata](ComputeAlgorithm.md#userdata)
|
||||
|
||||
## Properties
|
||||
|
||||
### algocustomdata
|
||||
|
||||
• `Optional` **algocustomdata**: `Object`
|
||||
|
||||
#### Index signature
|
||||
|
||||
▪ [key: `string`]: `any`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:74](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L74)
|
||||
|
||||
___
|
||||
|
||||
### documentId
|
||||
|
||||
• `Optional` **documentId**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:70](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L70)
|
||||
|
||||
___
|
||||
|
||||
### meta
|
||||
|
||||
• `Optional` **meta**: [`MetadataAlgorithm`](MetadataAlgorithm.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:72](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L72)
|
||||
|
||||
___
|
||||
|
||||
### serviceId
|
||||
|
||||
• `Optional` **serviceId**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:71](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L71)
|
||||
|
||||
___
|
||||
|
||||
### transferTxId
|
||||
|
||||
• `Optional` **transferTxId**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:73](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L73)
|
||||
|
||||
___
|
||||
|
||||
### userdata
|
||||
|
||||
• `Optional` **userdata**: `Object`
|
||||
|
||||
#### Index signature
|
||||
|
||||
▪ [key: `string`]: `any`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:75](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L75)
|
|
@ -0,0 +1,56 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / ComputeAsset
|
||||
|
||||
# Interface: ComputeAsset
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [documentId](ComputeAsset.md#documentid)
|
||||
- [serviceId](ComputeAsset.md#serviceid)
|
||||
- [transferTxId](ComputeAsset.md#transfertxid)
|
||||
- [userdata](ComputeAsset.md#userdata)
|
||||
|
||||
## Properties
|
||||
|
||||
### documentId
|
||||
|
||||
• **documentId**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:63](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L63)
|
||||
|
||||
___
|
||||
|
||||
### serviceId
|
||||
|
||||
• **serviceId**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:64](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L64)
|
||||
|
||||
___
|
||||
|
||||
### transferTxId
|
||||
|
||||
• `Optional` **transferTxId**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:65](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L65)
|
||||
|
||||
___
|
||||
|
||||
### userdata
|
||||
|
||||
• `Optional` **userdata**: `Object`
|
||||
|
||||
#### Index signature
|
||||
|
||||
▪ [key: `string`]: `any`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:66](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L66)
|
|
@ -0,0 +1,173 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / ComputeEnvironment
|
||||
|
||||
# Interface: ComputeEnvironment
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [consumerAddress](ComputeEnvironment.md#consumeraddress)
|
||||
- [cpuNumber](ComputeEnvironment.md#cpunumber)
|
||||
- [cpuType](ComputeEnvironment.md#cputype)
|
||||
- [currentJobs](ComputeEnvironment.md#currentjobs)
|
||||
- [desc](ComputeEnvironment.md#desc)
|
||||
- [diskGB](ComputeEnvironment.md#diskgb)
|
||||
- [gpuNumber](ComputeEnvironment.md#gpunumber)
|
||||
- [gpuType](ComputeEnvironment.md#gputype)
|
||||
- [id](ComputeEnvironment.md#id)
|
||||
- [lastSeen](ComputeEnvironment.md#lastseen)
|
||||
- [maxJobDuration](ComputeEnvironment.md#maxjobduration)
|
||||
- [maxJobs](ComputeEnvironment.md#maxjobs)
|
||||
- [priceMin](ComputeEnvironment.md#pricemin)
|
||||
- [ramGB](ComputeEnvironment.md#ramgb)
|
||||
- [storageExpiry](ComputeEnvironment.md#storageexpiry)
|
||||
|
||||
## Properties
|
||||
|
||||
### consumerAddress
|
||||
|
||||
• **consumerAddress**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:21](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L21)
|
||||
|
||||
___
|
||||
|
||||
### cpuNumber
|
||||
|
||||
• **cpuNumber**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:11](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L11)
|
||||
|
||||
___
|
||||
|
||||
### cpuType
|
||||
|
||||
• **cpuType**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:12](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L12)
|
||||
|
||||
___
|
||||
|
||||
### currentJobs
|
||||
|
||||
• **currentJobs**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:19](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L19)
|
||||
|
||||
___
|
||||
|
||||
### desc
|
||||
|
||||
• **desc**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:18](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L18)
|
||||
|
||||
___
|
||||
|
||||
### diskGB
|
||||
|
||||
• **diskGB**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:16](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L16)
|
||||
|
||||
___
|
||||
|
||||
### gpuNumber
|
||||
|
||||
• **gpuNumber**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:13](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### gpuType
|
||||
|
||||
• **gpuType**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:14](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### id
|
||||
|
||||
• **id**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:10](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L10)
|
||||
|
||||
___
|
||||
|
||||
### lastSeen
|
||||
|
||||
• **lastSeen**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:24](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L24)
|
||||
|
||||
___
|
||||
|
||||
### maxJobDuration
|
||||
|
||||
• **maxJobDuration**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:23](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L23)
|
||||
|
||||
___
|
||||
|
||||
### maxJobs
|
||||
|
||||
• **maxJobs**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:20](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L20)
|
||||
|
||||
___
|
||||
|
||||
### priceMin
|
||||
|
||||
• **priceMin**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:17](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L17)
|
||||
|
||||
___
|
||||
|
||||
### ramGB
|
||||
|
||||
• **ramGB**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:15](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L15)
|
||||
|
||||
___
|
||||
|
||||
### storageExpiry
|
||||
|
||||
• **storageExpiry**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:22](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L22)
|
|
@ -0,0 +1,140 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / ComputeJob
|
||||
|
||||
# Interface: ComputeJob
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [agreementId](ComputeJob.md#agreementid)
|
||||
- [algoDID](ComputeJob.md#algodid)
|
||||
- [dateCreated](ComputeJob.md#datecreated)
|
||||
- [dateFinished](ComputeJob.md#datefinished)
|
||||
- [did](ComputeJob.md#did)
|
||||
- [expireTimestamp](ComputeJob.md#expiretimestamp)
|
||||
- [inputDID](ComputeJob.md#inputdid)
|
||||
- [jobId](ComputeJob.md#jobid)
|
||||
- [owner](ComputeJob.md#owner)
|
||||
- [results](ComputeJob.md#results)
|
||||
- [status](ComputeJob.md#status)
|
||||
- [statusText](ComputeJob.md#statustext)
|
||||
|
||||
## Properties
|
||||
|
||||
### agreementId
|
||||
|
||||
• `Optional` **agreementId**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:45](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L45)
|
||||
|
||||
___
|
||||
|
||||
### algoDID
|
||||
|
||||
• `Optional` **algoDID**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:44](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L44)
|
||||
|
||||
___
|
||||
|
||||
### dateCreated
|
||||
|
||||
• **dateCreated**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:38](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L38)
|
||||
|
||||
___
|
||||
|
||||
### dateFinished
|
||||
|
||||
• **dateFinished**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:39](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L39)
|
||||
|
||||
___
|
||||
|
||||
### did
|
||||
|
||||
• `Optional` **did**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:36](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L36)
|
||||
|
||||
___
|
||||
|
||||
### expireTimestamp
|
||||
|
||||
• **expireTimestamp**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:46](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L46)
|
||||
|
||||
___
|
||||
|
||||
### inputDID
|
||||
|
||||
• `Optional` **inputDID**: `string`[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:43](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L43)
|
||||
|
||||
___
|
||||
|
||||
### jobId
|
||||
|
||||
• **jobId**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:37](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L37)
|
||||
|
||||
___
|
||||
|
||||
### owner
|
||||
|
||||
• **owner**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:35](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L35)
|
||||
|
||||
___
|
||||
|
||||
### results
|
||||
|
||||
• **results**: [`ComputeResult`](ComputeResult.md)[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:42](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L42)
|
||||
|
||||
___
|
||||
|
||||
### status
|
||||
|
||||
• **status**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:40](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L40)
|
||||
|
||||
___
|
||||
|
||||
### statusText
|
||||
|
||||
• **statusText**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:41](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L41)
|
|
@ -0,0 +1,118 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / ComputeOutput
|
||||
|
||||
# Interface: ComputeOutput
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [metadata](ComputeOutput.md#metadata)
|
||||
- [metadataUri](ComputeOutput.md#metadatauri)
|
||||
- [nodeUri](ComputeOutput.md#nodeuri)
|
||||
- [owner](ComputeOutput.md#owner)
|
||||
- [providerAddress](ComputeOutput.md#provideraddress)
|
||||
- [providerUri](ComputeOutput.md#provideruri)
|
||||
- [publishAlgorithmLog](ComputeOutput.md#publishalgorithmlog)
|
||||
- [publishOutput](ComputeOutput.md#publishoutput)
|
||||
- [secretStoreUri](ComputeOutput.md#secretstoreuri)
|
||||
- [whitelist](ComputeOutput.md#whitelist)
|
||||
|
||||
## Properties
|
||||
|
||||
### metadata
|
||||
|
||||
• `Optional` **metadata**: [`Metadata`](Metadata.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:54](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L54)
|
||||
|
||||
___
|
||||
|
||||
### metadataUri
|
||||
|
||||
• `Optional` **metadataUri**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:55](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L55)
|
||||
|
||||
___
|
||||
|
||||
### nodeUri
|
||||
|
||||
• `Optional` **nodeUri**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:56](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L56)
|
||||
|
||||
___
|
||||
|
||||
### owner
|
||||
|
||||
• `Optional` **owner**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:57](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L57)
|
||||
|
||||
___
|
||||
|
||||
### providerAddress
|
||||
|
||||
• `Optional` **providerAddress**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:52](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L52)
|
||||
|
||||
___
|
||||
|
||||
### providerUri
|
||||
|
||||
• `Optional` **providerUri**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:53](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L53)
|
||||
|
||||
___
|
||||
|
||||
### publishAlgorithmLog
|
||||
|
||||
• `Optional` **publishAlgorithmLog**: `boolean`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:50](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L50)
|
||||
|
||||
___
|
||||
|
||||
### publishOutput
|
||||
|
||||
• `Optional` **publishOutput**: `boolean`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:51](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L51)
|
||||
|
||||
___
|
||||
|
||||
### secretStoreUri
|
||||
|
||||
• `Optional` **secretStoreUri**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:58](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L58)
|
||||
|
||||
___
|
||||
|
||||
### whitelist
|
||||
|
||||
• `Optional` **whitelist**: `string`[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:59](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L59)
|
|
@ -0,0 +1,52 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / ComputeResult
|
||||
|
||||
# Interface: ComputeResult
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [filename](ComputeResult.md#filename)
|
||||
- [filesize](ComputeResult.md#filesize)
|
||||
- [index](ComputeResult.md#index)
|
||||
- [type](ComputeResult.md#type)
|
||||
|
||||
## Properties
|
||||
|
||||
### filename
|
||||
|
||||
• **filename**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:28](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L28)
|
||||
|
||||
___
|
||||
|
||||
### filesize
|
||||
|
||||
• **filesize**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:29](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L29)
|
||||
|
||||
___
|
||||
|
||||
### index
|
||||
|
||||
• `Optional` **index**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:31](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L31)
|
||||
|
||||
___
|
||||
|
||||
### type
|
||||
|
||||
• **type**: [`ComputeResultType`](../modules.md#computeresulttype)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:30](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L30)
|
|
@ -0,0 +1,41 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / ConsumeMarketFee
|
||||
|
||||
# Interface: ConsumeMarketFee
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [consumeMarketFeeAddress](ConsumeMarketFee.md#consumemarketfeeaddress)
|
||||
- [consumeMarketFeeAmount](ConsumeMarketFee.md#consumemarketfeeamount)
|
||||
- [consumeMarketFeeToken](ConsumeMarketFee.md#consumemarketfeetoken)
|
||||
|
||||
## Properties
|
||||
|
||||
### consumeMarketFeeAddress
|
||||
|
||||
• **consumeMarketFeeAddress**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Datatoken.ts:16](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Datatoken.ts#L16)
|
||||
|
||||
___
|
||||
|
||||
### consumeMarketFeeAmount
|
||||
|
||||
• **consumeMarketFeeAmount**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Datatoken.ts:18](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Datatoken.ts#L18)
|
||||
|
||||
___
|
||||
|
||||
### consumeMarketFeeToken
|
||||
|
||||
• **consumeMarketFeeToken**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Datatoken.ts:17](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Datatoken.ts#L17)
|
|
@ -0,0 +1,30 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / Credential
|
||||
|
||||
# Interface: Credential
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [type](Credential.md#type)
|
||||
- [values](Credential.md#values)
|
||||
|
||||
## Properties
|
||||
|
||||
### type
|
||||
|
||||
• **type**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Credentials.ts:2](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Credentials.ts#L2)
|
||||
|
||||
___
|
||||
|
||||
### values
|
||||
|
||||
• **values**: `string`[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Credentials.ts:3](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Credentials.ts#L3)
|
|
@ -0,0 +1,30 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / Credentials
|
||||
|
||||
# Interface: Credentials
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [allow](Credentials.md#allow)
|
||||
- [deny](Credentials.md#deny)
|
||||
|
||||
## Properties
|
||||
|
||||
### allow
|
||||
|
||||
• **allow**: [`Credential`](Credential.md)[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Credentials.ts:7](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Credentials.ts#L7)
|
||||
|
||||
___
|
||||
|
||||
### deny
|
||||
|
||||
• **deny**: [`Credential`](Credential.md)[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Credentials.ts:8](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Credentials.ts#L8)
|
|
@ -0,0 +1,137 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / DDO
|
||||
|
||||
# Interface: DDO
|
||||
|
||||
DID Descriptor Object.
|
||||
Contains metadata about the asset, and define access in at least one service.
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- **`DDO`**
|
||||
|
||||
↳ [`Asset`](Asset.md)
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [@context](DDO.md#@context)
|
||||
- [chainId](DDO.md#chainid)
|
||||
- [credentials](DDO.md#credentials)
|
||||
- [event](DDO.md#event)
|
||||
- [id](DDO.md#id)
|
||||
- [metadata](DDO.md#metadata)
|
||||
- [nftAddress](DDO.md#nftaddress)
|
||||
- [services](DDO.md#services)
|
||||
- [version](DDO.md#version)
|
||||
|
||||
## Properties
|
||||
|
||||
### @context
|
||||
|
||||
• **@context**: `string`[]
|
||||
|
||||
Contexts used for validation.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/DDO.ts:12](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/DDO.ts#L12)
|
||||
|
||||
___
|
||||
|
||||
### chainId
|
||||
|
||||
• **chainId**: `number`
|
||||
|
||||
ChainId of the network the DDO was published to.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/DDO.ts:38](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/DDO.ts#L38)
|
||||
|
||||
___
|
||||
|
||||
### credentials
|
||||
|
||||
• `Optional` **credentials**: [`Credentials`](Credentials.md)
|
||||
|
||||
Describes the credentials needed to access a dataset
|
||||
in addition to the services definition.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/DDO.ts:57](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/DDO.ts#L57)
|
||||
|
||||
___
|
||||
|
||||
### event
|
||||
|
||||
• `Optional` **event**: [`Event`](Event.md)
|
||||
|
||||
Describes the event of last metadata event
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/DDO.ts:63](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/DDO.ts#L63)
|
||||
|
||||
___
|
||||
|
||||
### id
|
||||
|
||||
• **id**: `string`
|
||||
|
||||
DID, descentralized ID.
|
||||
Computed as sha256(address of NFT contract + chainId)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/DDO.ts:19](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/DDO.ts#L19)
|
||||
|
||||
___
|
||||
|
||||
### metadata
|
||||
|
||||
• **metadata**: [`Metadata`](Metadata.md)
|
||||
|
||||
Stores an object describing the asset.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/DDO.ts:44](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/DDO.ts#L44)
|
||||
|
||||
___
|
||||
|
||||
### nftAddress
|
||||
|
||||
• **nftAddress**: `string`
|
||||
|
||||
NFT contract address
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/DDO.ts:32](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/DDO.ts#L32)
|
||||
|
||||
___
|
||||
|
||||
### services
|
||||
|
||||
• **services**: [`Service`](Service.md)[]
|
||||
|
||||
Stores an array of services defining access to the asset.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/DDO.ts:50](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/DDO.ts#L50)
|
||||
|
||||
___
|
||||
|
||||
### version
|
||||
|
||||
• **version**: `string`
|
||||
|
||||
Version information in SemVer notation
|
||||
referring to the DDO spec version
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/DDO.ts:26](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/DDO.ts#L26)
|
|
@ -0,0 +1,107 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / DatatokenCreateParams
|
||||
|
||||
# Interface: DatatokenCreateParams
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [cap](DatatokenCreateParams.md#cap)
|
||||
- [feeAmount](DatatokenCreateParams.md#feeamount)
|
||||
- [feeToken](DatatokenCreateParams.md#feetoken)
|
||||
- [minter](DatatokenCreateParams.md#minter)
|
||||
- [mpFeeAddress](DatatokenCreateParams.md#mpfeeaddress)
|
||||
- [name](DatatokenCreateParams.md#name)
|
||||
- [paymentCollector](DatatokenCreateParams.md#paymentcollector)
|
||||
- [symbol](DatatokenCreateParams.md#symbol)
|
||||
- [templateIndex](DatatokenCreateParams.md#templateindex)
|
||||
|
||||
## Properties
|
||||
|
||||
### cap
|
||||
|
||||
• **cap**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Datatoken.ts:10](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Datatoken.ts#L10)
|
||||
|
||||
___
|
||||
|
||||
### feeAmount
|
||||
|
||||
• **feeAmount**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Datatoken.ts:9](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Datatoken.ts#L9)
|
||||
|
||||
___
|
||||
|
||||
### feeToken
|
||||
|
||||
• **feeToken**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Datatoken.ts:8](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Datatoken.ts#L8)
|
||||
|
||||
___
|
||||
|
||||
### minter
|
||||
|
||||
• **minter**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Datatoken.ts:5](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Datatoken.ts#L5)
|
||||
|
||||
___
|
||||
|
||||
### mpFeeAddress
|
||||
|
||||
• **mpFeeAddress**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Datatoken.ts:7](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Datatoken.ts#L7)
|
||||
|
||||
___
|
||||
|
||||
### name
|
||||
|
||||
• `Optional` **name**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Datatoken.ts:11](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Datatoken.ts#L11)
|
||||
|
||||
___
|
||||
|
||||
### paymentCollector
|
||||
|
||||
• **paymentCollector**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Datatoken.ts:6](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Datatoken.ts#L6)
|
||||
|
||||
___
|
||||
|
||||
### symbol
|
||||
|
||||
• `Optional` **symbol**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Datatoken.ts:12](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Datatoken.ts#L12)
|
||||
|
||||
___
|
||||
|
||||
### templateIndex
|
||||
|
||||
• **templateIndex**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Datatoken.ts:4](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Datatoken.ts#L4)
|
|
@ -0,0 +1,30 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / DatatokenRoles
|
||||
|
||||
# Interface: DatatokenRoles
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [minter](DatatokenRoles.md#minter)
|
||||
- [paymentManager](DatatokenRoles.md#paymentmanager)
|
||||
|
||||
## Properties
|
||||
|
||||
### minter
|
||||
|
||||
• **minter**: `boolean`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Datatoken.ts:28](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Datatoken.ts#L28)
|
||||
|
||||
___
|
||||
|
||||
### paymentManager
|
||||
|
||||
• **paymentManager**: `boolean`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Datatoken.ts:29](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Datatoken.ts#L29)
|
|
@ -0,0 +1,63 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / DispenserCreationParams
|
||||
|
||||
# Interface: DispenserCreationParams
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [allowedSwapper](DispenserCreationParams.md#allowedswapper)
|
||||
- [dispenserAddress](DispenserCreationParams.md#dispenseraddress)
|
||||
- [maxBalance](DispenserCreationParams.md#maxbalance)
|
||||
- [maxTokens](DispenserCreationParams.md#maxtokens)
|
||||
- [withMint](DispenserCreationParams.md#withmint)
|
||||
|
||||
## Properties
|
||||
|
||||
### allowedSwapper
|
||||
|
||||
• `Optional` **allowedSwapper**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Dispenser.ts:6](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Dispenser.ts#L6)
|
||||
|
||||
___
|
||||
|
||||
### dispenserAddress
|
||||
|
||||
• **dispenserAddress**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Dispenser.ts:2](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Dispenser.ts#L2)
|
||||
|
||||
___
|
||||
|
||||
### maxBalance
|
||||
|
||||
• **maxBalance**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Dispenser.ts:4](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Dispenser.ts#L4)
|
||||
|
||||
___
|
||||
|
||||
### maxTokens
|
||||
|
||||
• **maxTokens**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Dispenser.ts:3](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Dispenser.ts#L3)
|
||||
|
||||
___
|
||||
|
||||
### withMint
|
||||
|
||||
• `Optional` **withMint**: `boolean`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Dispenser.ts:5](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Dispenser.ts#L5)
|
|
@ -0,0 +1,52 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / DispenserParams
|
||||
|
||||
# Interface: DispenserParams
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [allowedSwapper](DispenserParams.md#allowedswapper)
|
||||
- [maxBalance](DispenserParams.md#maxbalance)
|
||||
- [maxTokens](DispenserParams.md#maxtokens)
|
||||
- [withMint](DispenserParams.md#withmint)
|
||||
|
||||
## Properties
|
||||
|
||||
### allowedSwapper
|
||||
|
||||
• `Optional` **allowedSwapper**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Datatoken.ts:43](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Datatoken.ts#L43)
|
||||
|
||||
___
|
||||
|
||||
### maxBalance
|
||||
|
||||
• **maxBalance**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Datatoken.ts:41](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Datatoken.ts#L41)
|
||||
|
||||
___
|
||||
|
||||
### maxTokens
|
||||
|
||||
• **maxTokens**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Datatoken.ts:40](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Datatoken.ts#L40)
|
||||
|
||||
___
|
||||
|
||||
### withMint
|
||||
|
||||
• `Optional` **withMint**: `boolean`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Datatoken.ts:42](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Datatoken.ts#L42)
|
|
@ -0,0 +1,85 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / DispenserToken
|
||||
|
||||
# Interface: DispenserToken
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [active](DispenserToken.md#active)
|
||||
- [allowedSwapper](DispenserToken.md#allowedswapper)
|
||||
- [balance](DispenserToken.md#balance)
|
||||
- [isMinter](DispenserToken.md#isminter)
|
||||
- [maxBalance](DispenserToken.md#maxbalance)
|
||||
- [maxTokens](DispenserToken.md#maxtokens)
|
||||
- [owner](DispenserToken.md#owner)
|
||||
|
||||
## Properties
|
||||
|
||||
### active
|
||||
|
||||
• **active**: `boolean`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Dispenser.ts:10](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Dispenser.ts#L10)
|
||||
|
||||
___
|
||||
|
||||
### allowedSwapper
|
||||
|
||||
• **allowedSwapper**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Dispenser.ts:16](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Dispenser.ts#L16)
|
||||
|
||||
___
|
||||
|
||||
### balance
|
||||
|
||||
• **balance**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Dispenser.ts:14](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Dispenser.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### isMinter
|
||||
|
||||
• **isMinter**: `boolean`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Dispenser.ts:15](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Dispenser.ts#L15)
|
||||
|
||||
___
|
||||
|
||||
### maxBalance
|
||||
|
||||
• **maxBalance**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Dispenser.ts:13](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Dispenser.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### maxTokens
|
||||
|
||||
• **maxTokens**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Dispenser.ts:12](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Dispenser.ts#L12)
|
||||
|
||||
___
|
||||
|
||||
### owner
|
||||
|
||||
• **owner**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Dispenser.ts:11](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Dispenser.ts#L11)
|
|
@ -0,0 +1,30 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / DownloadResponse
|
||||
|
||||
# Interface: DownloadResponse
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [data](DownloadResponse.md#data)
|
||||
- [filename](DownloadResponse.md#filename)
|
||||
|
||||
## Properties
|
||||
|
||||
### data
|
||||
|
||||
• **data**: `ArrayBuffer`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DownloadResponse.ts:2](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DownloadResponse.ts#L2)
|
||||
|
||||
___
|
||||
|
||||
### filename
|
||||
|
||||
• **filename**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DownloadResponse.ts:3](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DownloadResponse.ts#L3)
|
|
@ -0,0 +1,73 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / Event
|
||||
|
||||
# Interface: Event
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [block](Event.md#block)
|
||||
- [contract](Event.md#contract)
|
||||
- [datetime](Event.md#datetime)
|
||||
- [from](Event.md#from)
|
||||
- [txid](Event.md#txid)
|
||||
|
||||
## Properties
|
||||
|
||||
### block
|
||||
|
||||
• `Optional` **block**: `number`
|
||||
|
||||
Block of txid
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Event.ts:12](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Event.ts#L12)
|
||||
|
||||
___
|
||||
|
||||
### contract
|
||||
|
||||
• `Optional` **contract**: `string`
|
||||
|
||||
Contract
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Event.ts:24](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Event.ts#L24)
|
||||
|
||||
___
|
||||
|
||||
### datetime
|
||||
|
||||
• `Optional` **datetime**: `string`
|
||||
|
||||
datetime of tx
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Event.ts:30](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Event.ts#L30)
|
||||
|
||||
___
|
||||
|
||||
### from
|
||||
|
||||
• `Optional` **from**: `string`
|
||||
|
||||
Sender of tx
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Event.ts:18](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Event.ts#L18)
|
||||
|
||||
___
|
||||
|
||||
### txid
|
||||
|
||||
• `Optional` **txid**: `string`
|
||||
|
||||
TX id of the last create/update
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Event.ts:6](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Event.ts#L6)
|
|
@ -0,0 +1,74 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / FeesInfo
|
||||
|
||||
# Interface: FeesInfo
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [exchangeId](FeesInfo.md#exchangeid)
|
||||
- [marketFee](FeesInfo.md#marketfee)
|
||||
- [marketFeeAvailable](FeesInfo.md#marketfeeavailable)
|
||||
- [marketFeeCollector](FeesInfo.md#marketfeecollector)
|
||||
- [oceanFeeAvailable](FeesInfo.md#oceanfeeavailable)
|
||||
- [opcFee](FeesInfo.md#opcfee)
|
||||
|
||||
## Properties
|
||||
|
||||
### exchangeId
|
||||
|
||||
• **exchangeId**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:54](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L54)
|
||||
|
||||
___
|
||||
|
||||
### marketFee
|
||||
|
||||
• **marketFee**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:50](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L50)
|
||||
|
||||
___
|
||||
|
||||
### marketFeeAvailable
|
||||
|
||||
• **marketFeeAvailable**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:52](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L52)
|
||||
|
||||
___
|
||||
|
||||
### marketFeeCollector
|
||||
|
||||
• **marketFeeCollector**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:51](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L51)
|
||||
|
||||
___
|
||||
|
||||
### oceanFeeAvailable
|
||||
|
||||
• **oceanFeeAvailable**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:53](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L53)
|
||||
|
||||
___
|
||||
|
||||
### opcFee
|
||||
|
||||
• **opcFee**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:49](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L49)
|
|
@ -0,0 +1,118 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / FileInfo
|
||||
|
||||
# Interface: FileInfo
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [checksum](FileInfo.md#checksum)
|
||||
- [contentLength](FileInfo.md#contentlength)
|
||||
- [contentType](FileInfo.md#contenttype)
|
||||
- [index](FileInfo.md#index)
|
||||
- [method](FileInfo.md#method)
|
||||
- [type](FileInfo.md#type)
|
||||
- [url](FileInfo.md#url)
|
||||
- [valid](FileInfo.md#valid)
|
||||
|
||||
## Properties
|
||||
|
||||
### checksum
|
||||
|
||||
• `Optional` **checksum**: `string`
|
||||
|
||||
Computed file checksum
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FileInfo.ts:43](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FileInfo.ts#L43)
|
||||
|
||||
___
|
||||
|
||||
### contentLength
|
||||
|
||||
• `Optional` **contentLength**: `string`
|
||||
|
||||
File content length.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FileInfo.ts:19](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FileInfo.ts#L19)
|
||||
|
||||
___
|
||||
|
||||
### contentType
|
||||
|
||||
• `Optional` **contentType**: `string`
|
||||
|
||||
File format, if applicable.
|
||||
|
||||
**`Example`**
|
||||
|
||||
```ts
|
||||
"text/csv"
|
||||
```
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FileInfo.ts:13](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FileInfo.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### index
|
||||
|
||||
• `Optional` **index**: `number`
|
||||
|
||||
File index.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FileInfo.ts:25](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FileInfo.ts#L25)
|
||||
|
||||
___
|
||||
|
||||
### method
|
||||
|
||||
• `Optional` **method**: `string`
|
||||
|
||||
HTTP method used
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FileInfo.ts:37](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FileInfo.ts#L37)
|
||||
|
||||
___
|
||||
|
||||
### type
|
||||
|
||||
• **type**: `string`
|
||||
|
||||
File URL.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FileInfo.ts:6](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FileInfo.ts#L6)
|
||||
|
||||
___
|
||||
|
||||
### url
|
||||
|
||||
• `Optional` **url**: `string`
|
||||
|
||||
File URL.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FileInfo.ts:31](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FileInfo.ts#L31)
|
||||
|
||||
___
|
||||
|
||||
### valid
|
||||
|
||||
• `Optional` **valid**: `boolean`
|
||||
|
||||
check if file exists
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FileInfo.ts:49](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FileInfo.ts#L49)
|
|
@ -0,0 +1,41 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / Files
|
||||
|
||||
# Interface: Files
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [datatokenAddress](Files.md#datatokenaddress)
|
||||
- [files](Files.md#files)
|
||||
- [nftAddress](Files.md#nftaddress)
|
||||
|
||||
## Properties
|
||||
|
||||
### datatokenAddress
|
||||
|
||||
• **datatokenAddress**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/File.ts:105](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/File.ts#L105)
|
||||
|
||||
___
|
||||
|
||||
### files
|
||||
|
||||
• **files**: [`UrlFile`](UrlFile.md)[] \| [`GraphqlQuery`](GraphqlQuery.md)[] \| [`Arweave`](Arweave.md)[] \| [`Smartcontract`](Smartcontract-1.md)[] \| [`Ipfs`](Ipfs.md)[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/File.ts:106](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/File.ts#L106)
|
||||
|
||||
___
|
||||
|
||||
### nftAddress
|
||||
|
||||
• **nftAddress**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/File.ts:104](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/File.ts#L104)
|
|
@ -0,0 +1,162 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / FixedPriceExchange
|
||||
|
||||
# Interface: FixedPriceExchange
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [active](FixedPriceExchange.md#active)
|
||||
- [allowedSwapper](FixedPriceExchange.md#allowedswapper)
|
||||
- [baseToken](FixedPriceExchange.md#basetoken)
|
||||
- [btBalance](FixedPriceExchange.md#btbalance)
|
||||
- [btDecimals](FixedPriceExchange.md#btdecimals)
|
||||
- [btSupply](FixedPriceExchange.md#btsupply)
|
||||
- [datatoken](FixedPriceExchange.md#datatoken)
|
||||
- [dtBalance](FixedPriceExchange.md#dtbalance)
|
||||
- [dtDecimals](FixedPriceExchange.md#dtdecimals)
|
||||
- [dtSupply](FixedPriceExchange.md#dtsupply)
|
||||
- [exchangeId](FixedPriceExchange.md#exchangeid)
|
||||
- [exchangeOwner](FixedPriceExchange.md#exchangeowner)
|
||||
- [fixedRate](FixedPriceExchange.md#fixedrate)
|
||||
- [withMint](FixedPriceExchange.md#withmint)
|
||||
|
||||
## Properties
|
||||
|
||||
### active
|
||||
|
||||
• **active**: `boolean`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:32](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L32)
|
||||
|
||||
___
|
||||
|
||||
### allowedSwapper
|
||||
|
||||
• **allowedSwapper**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:44](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L44)
|
||||
|
||||
___
|
||||
|
||||
### baseToken
|
||||
|
||||
• **baseToken**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:35](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L35)
|
||||
|
||||
___
|
||||
|
||||
### btBalance
|
||||
|
||||
• **btBalance**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:40](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L40)
|
||||
|
||||
___
|
||||
|
||||
### btDecimals
|
||||
|
||||
• **btDecimals**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:38](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L38)
|
||||
|
||||
___
|
||||
|
||||
### btSupply
|
||||
|
||||
• **btSupply**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:42](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L42)
|
||||
|
||||
___
|
||||
|
||||
### datatoken
|
||||
|
||||
• **datatoken**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:34](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L34)
|
||||
|
||||
___
|
||||
|
||||
### dtBalance
|
||||
|
||||
• **dtBalance**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:39](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L39)
|
||||
|
||||
___
|
||||
|
||||
### dtDecimals
|
||||
|
||||
• **dtDecimals**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:37](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L37)
|
||||
|
||||
___
|
||||
|
||||
### dtSupply
|
||||
|
||||
• **dtSupply**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:41](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L41)
|
||||
|
||||
___
|
||||
|
||||
### exchangeId
|
||||
|
||||
• `Optional` **exchangeId**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:45](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L45)
|
||||
|
||||
___
|
||||
|
||||
### exchangeOwner
|
||||
|
||||
• **exchangeOwner**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:33](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L33)
|
||||
|
||||
___
|
||||
|
||||
### fixedRate
|
||||
|
||||
• **fixedRate**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:36](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L36)
|
||||
|
||||
___
|
||||
|
||||
### withMint
|
||||
|
||||
• **withMint**: `boolean`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:43](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L43)
|
|
@ -0,0 +1,118 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / FreCreationParams
|
||||
|
||||
# Interface: FreCreationParams
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [allowedConsumer](FreCreationParams.md#allowedconsumer)
|
||||
- [baseTokenAddress](FreCreationParams.md#basetokenaddress)
|
||||
- [baseTokenDecimals](FreCreationParams.md#basetokendecimals)
|
||||
- [datatokenDecimals](FreCreationParams.md#datatokendecimals)
|
||||
- [fixedRate](FreCreationParams.md#fixedrate)
|
||||
- [fixedRateAddress](FreCreationParams.md#fixedrateaddress)
|
||||
- [marketFee](FreCreationParams.md#marketfee)
|
||||
- [marketFeeCollector](FreCreationParams.md#marketfeecollector)
|
||||
- [owner](FreCreationParams.md#owner)
|
||||
- [withMint](FreCreationParams.md#withmint)
|
||||
|
||||
## Properties
|
||||
|
||||
### allowedConsumer
|
||||
|
||||
• `Optional` **allowedConsumer**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:11](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L11)
|
||||
|
||||
___
|
||||
|
||||
### baseTokenAddress
|
||||
|
||||
• **baseTokenAddress**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:3](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L3)
|
||||
|
||||
___
|
||||
|
||||
### baseTokenDecimals
|
||||
|
||||
• **baseTokenDecimals**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:6](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L6)
|
||||
|
||||
___
|
||||
|
||||
### datatokenDecimals
|
||||
|
||||
• **datatokenDecimals**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:7](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L7)
|
||||
|
||||
___
|
||||
|
||||
### fixedRate
|
||||
|
||||
• **fixedRate**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:8](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L8)
|
||||
|
||||
___
|
||||
|
||||
### fixedRateAddress
|
||||
|
||||
• **fixedRateAddress**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:2](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L2)
|
||||
|
||||
___
|
||||
|
||||
### marketFee
|
||||
|
||||
• **marketFee**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:9](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L9)
|
||||
|
||||
___
|
||||
|
||||
### marketFeeCollector
|
||||
|
||||
• **marketFeeCollector**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:5](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L5)
|
||||
|
||||
___
|
||||
|
||||
### owner
|
||||
|
||||
• **owner**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:4](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L4)
|
||||
|
||||
___
|
||||
|
||||
### withMint
|
||||
|
||||
• `Optional` **withMint**: `boolean`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:10](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L10)
|
|
@ -0,0 +1,85 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / FreOrderParams
|
||||
|
||||
# Interface: FreOrderParams
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [baseTokenAddress](FreOrderParams.md#basetokenaddress)
|
||||
- [baseTokenDecimals](FreOrderParams.md#basetokendecimals)
|
||||
- [exchangeContract](FreOrderParams.md#exchangecontract)
|
||||
- [exchangeId](FreOrderParams.md#exchangeid)
|
||||
- [marketFeeAddress](FreOrderParams.md#marketfeeaddress)
|
||||
- [maxBaseTokenAmount](FreOrderParams.md#maxbasetokenamount)
|
||||
- [swapMarketFee](FreOrderParams.md#swapmarketfee)
|
||||
|
||||
## Properties
|
||||
|
||||
### baseTokenAddress
|
||||
|
||||
• **baseTokenAddress**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:18](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L18)
|
||||
|
||||
___
|
||||
|
||||
### baseTokenDecimals
|
||||
|
||||
• `Optional` **baseTokenDecimals**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:19](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L19)
|
||||
|
||||
___
|
||||
|
||||
### exchangeContract
|
||||
|
||||
• **exchangeContract**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:15](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L15)
|
||||
|
||||
___
|
||||
|
||||
### exchangeId
|
||||
|
||||
• **exchangeId**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:16](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L16)
|
||||
|
||||
___
|
||||
|
||||
### marketFeeAddress
|
||||
|
||||
• **marketFeeAddress**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:21](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L21)
|
||||
|
||||
___
|
||||
|
||||
### maxBaseTokenAmount
|
||||
|
||||
• **maxBaseTokenAmount**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:17](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L17)
|
||||
|
||||
___
|
||||
|
||||
### swapMarketFee
|
||||
|
||||
• **swapMarketFee**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:20](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L20)
|
|
@ -0,0 +1,69 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / GraphqlQuery
|
||||
|
||||
# Interface: GraphqlQuery
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [headers](GraphqlQuery.md#headers)
|
||||
- [index](GraphqlQuery.md#index)
|
||||
- [query](GraphqlQuery.md#query)
|
||||
- [type](GraphqlQuery.md#type)
|
||||
- [url](GraphqlQuery.md#url)
|
||||
|
||||
## Properties
|
||||
|
||||
### headers
|
||||
|
||||
• `Optional` **headers**: `FileTypeHeaders`
|
||||
|
||||
Headers key value pairs associated with the asset GET request
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/File.ts:58](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/File.ts#L58)
|
||||
|
||||
___
|
||||
|
||||
### index
|
||||
|
||||
• `Optional` **index**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/File.ts:40](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/File.ts#L40)
|
||||
|
||||
___
|
||||
|
||||
### query
|
||||
|
||||
• **query**: `string`
|
||||
|
||||
query
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/File.ts:52](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/File.ts#L52)
|
||||
|
||||
___
|
||||
|
||||
### type
|
||||
|
||||
• **type**: ``"graphql"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/File.ts:35](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/File.ts#L35)
|
||||
|
||||
___
|
||||
|
||||
### url
|
||||
|
||||
• **url**: `string`
|
||||
|
||||
Endpoint URL
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/File.ts:46](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/File.ts#L46)
|
|
@ -0,0 +1,32 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / Ipfs
|
||||
|
||||
# Interface: Ipfs
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [hash](Ipfs.md#hash)
|
||||
- [type](Ipfs.md#type)
|
||||
|
||||
## Properties
|
||||
|
||||
### hash
|
||||
|
||||
• **hash**: `string`
|
||||
|
||||
hash
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/File.ts:78](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/File.ts#L78)
|
||||
|
||||
___
|
||||
|
||||
### type
|
||||
|
||||
• **type**: ``"ipfs"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/File.ts:72](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/File.ts#L72)
|
|
@ -0,0 +1,193 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / Metadata
|
||||
|
||||
# Interface: Metadata
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [additionalInformation](Metadata.md#additionalinformation)
|
||||
- [algorithm](Metadata.md#algorithm)
|
||||
- [author](Metadata.md#author)
|
||||
- [categories](Metadata.md#categories)
|
||||
- [contentLanguage](Metadata.md#contentlanguage)
|
||||
- [copyrightHolder](Metadata.md#copyrightholder)
|
||||
- [created](Metadata.md#created)
|
||||
- [description](Metadata.md#description)
|
||||
- [license](Metadata.md#license)
|
||||
- [links](Metadata.md#links)
|
||||
- [name](Metadata.md#name)
|
||||
- [tags](Metadata.md#tags)
|
||||
- [type](Metadata.md#type)
|
||||
- [updated](Metadata.md#updated)
|
||||
|
||||
## Properties
|
||||
|
||||
### additionalInformation
|
||||
|
||||
• `Optional` **additionalInformation**: `any`
|
||||
|
||||
Stores additional information, this is customizable by publisher
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Metadata.ts:137](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Metadata.ts#L137)
|
||||
|
||||
___
|
||||
|
||||
### algorithm
|
||||
|
||||
• `Optional` **algorithm**: [`MetadataAlgorithm`](MetadataAlgorithm.md)
|
||||
|
||||
Information about asset of type algorithm. Required for algorithm assets.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Metadata.ts:131](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Metadata.ts#L131)
|
||||
|
||||
___
|
||||
|
||||
### author
|
||||
|
||||
• **author**: `string`
|
||||
|
||||
Name of the entity generating this data (e.g. Tfl, Disney Corp, etc.).
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Metadata.ts:87](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Metadata.ts#L87)
|
||||
|
||||
___
|
||||
|
||||
### categories
|
||||
|
||||
• `Optional` **categories**: `string`[]
|
||||
|
||||
Array of categories associated to the asset. Note: recommended to use tags instead of this.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Metadata.ts:113](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Metadata.ts#L113)
|
||||
|
||||
___
|
||||
|
||||
### contentLanguage
|
||||
|
||||
• `Optional` **contentLanguage**: `string`
|
||||
|
||||
The language of the content. Use one of the language codes from the IETF BCP 47 standard
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Metadata.ts:125](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Metadata.ts#L125)
|
||||
|
||||
___
|
||||
|
||||
### copyrightHolder
|
||||
|
||||
• `Optional` **copyrightHolder**: `string`
|
||||
|
||||
The party holding the legal copyright. Empty by default.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Metadata.ts:119](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Metadata.ts#L119)
|
||||
|
||||
___
|
||||
|
||||
### created
|
||||
|
||||
• **created**: `string`
|
||||
|
||||
Contains the date of publishing in ISO Date Time
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Metadata.ts:56](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Metadata.ts#L56)
|
||||
|
||||
___
|
||||
|
||||
### description
|
||||
|
||||
• **description**: `string`
|
||||
|
||||
Details of what the resource is.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Metadata.ts:74](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Metadata.ts#L74)
|
||||
|
||||
___
|
||||
|
||||
### license
|
||||
|
||||
• **license**: `string`
|
||||
|
||||
Short name referencing the license of the asset.
|
||||
If it’s not specified, the following value will be added: “No License Specified”.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Metadata.ts:94](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Metadata.ts#L94)
|
||||
|
||||
___
|
||||
|
||||
### links
|
||||
|
||||
• `Optional` **links**: `string`[]
|
||||
|
||||
Mapping of URL strings for data samples, or links to find out more information.
|
||||
Links may be to either a URL or another asset.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Metadata.ts:101](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Metadata.ts#L101)
|
||||
|
||||
___
|
||||
|
||||
### name
|
||||
|
||||
• **name**: `string`
|
||||
|
||||
Descriptive name or title of the asset.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Metadata.ts:68](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Metadata.ts#L68)
|
||||
|
||||
___
|
||||
|
||||
### tags
|
||||
|
||||
• `Optional` **tags**: `string`[]
|
||||
|
||||
Array of keywords or tags used to describe this content. Empty by default.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Metadata.ts:107](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Metadata.ts#L107)
|
||||
|
||||
___
|
||||
|
||||
### type
|
||||
|
||||
• **type**: ``"dataset"`` \| ``"algorithm"``
|
||||
|
||||
Asset type. Includes "dataset" (e.g. csv file), "algorithm" (e.g. Python script).
|
||||
Each type needs a different subset of metadata attributes.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Metadata.ts:81](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Metadata.ts#L81)
|
||||
|
||||
___
|
||||
|
||||
### updated
|
||||
|
||||
• **updated**: `string`
|
||||
|
||||
Contains the the date of last update in ISO Date Time
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Metadata.ts:62](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Metadata.ts#L62)
|
|
@ -0,0 +1,69 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / MetadataAlgorithm
|
||||
|
||||
# Interface: MetadataAlgorithm
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [container](MetadataAlgorithm.md#container)
|
||||
- [language](MetadataAlgorithm.md#language)
|
||||
- [rawcode](MetadataAlgorithm.md#rawcode)
|
||||
- [version](MetadataAlgorithm.md#version)
|
||||
|
||||
## Properties
|
||||
|
||||
### container
|
||||
|
||||
• **container**: `Object`
|
||||
|
||||
Object describing the Docker container image.
|
||||
|
||||
#### Type declaration
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `checksum` | `string` | Checksum of the Docker image. |
|
||||
| `entrypoint` | `string` | The command to execute, or script to run inside the Docker image. |
|
||||
| `image` | `string` | Name of the Docker image. |
|
||||
| `tag` | `string` | Tag of the Docker image. |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Metadata.ts:24](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Metadata.ts#L24)
|
||||
|
||||
___
|
||||
|
||||
### language
|
||||
|
||||
• `Optional` **language**: `string`
|
||||
|
||||
Programming language used to implement the software.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Metadata.ts:6](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Metadata.ts#L6)
|
||||
|
||||
___
|
||||
|
||||
### rawcode
|
||||
|
||||
• `Optional` **rawcode**: `string`
|
||||
|
||||
Rawcode
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Metadata.ts:18](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Metadata.ts#L18)
|
||||
|
||||
___
|
||||
|
||||
### version
|
||||
|
||||
• `Optional` **version**: `string`
|
||||
|
||||
Version of the software preferably in SemVer notation.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Metadata.ts:12](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Metadata.ts#L12)
|
|
@ -0,0 +1,107 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / MetadataAndTokenURI
|
||||
|
||||
# Interface: MetadataAndTokenURI
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [data](MetadataAndTokenURI.md#data)
|
||||
- [flags](MetadataAndTokenURI.md#flags)
|
||||
- [metaDataDecryptorAddress](MetadataAndTokenURI.md#metadatadecryptoraddress)
|
||||
- [metaDataDecryptorUrl](MetadataAndTokenURI.md#metadatadecryptorurl)
|
||||
- [metaDataHash](MetadataAndTokenURI.md#metadatahash)
|
||||
- [metaDataState](MetadataAndTokenURI.md#metadatastate)
|
||||
- [metadataProofs](MetadataAndTokenURI.md#metadataproofs)
|
||||
- [tokenId](MetadataAndTokenURI.md#tokenid)
|
||||
- [tokenURI](MetadataAndTokenURI.md#tokenuri)
|
||||
|
||||
## Properties
|
||||
|
||||
### data
|
||||
|
||||
• **data**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/NFT.ts:8](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/NFT.ts#L8)
|
||||
|
||||
___
|
||||
|
||||
### flags
|
||||
|
||||
• **flags**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/NFT.ts:7](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/NFT.ts#L7)
|
||||
|
||||
___
|
||||
|
||||
### metaDataDecryptorAddress
|
||||
|
||||
• **metaDataDecryptorAddress**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/NFT.ts:6](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/NFT.ts#L6)
|
||||
|
||||
___
|
||||
|
||||
### metaDataDecryptorUrl
|
||||
|
||||
• **metaDataDecryptorUrl**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/NFT.ts:5](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/NFT.ts#L5)
|
||||
|
||||
___
|
||||
|
||||
### metaDataHash
|
||||
|
||||
• **metaDataHash**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/NFT.ts:9](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/NFT.ts#L9)
|
||||
|
||||
___
|
||||
|
||||
### metaDataState
|
||||
|
||||
• **metaDataState**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/NFT.ts:4](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/NFT.ts#L4)
|
||||
|
||||
___
|
||||
|
||||
### metadataProofs
|
||||
|
||||
• `Optional` **metadataProofs**: [`MetadataProof`](MetadataProof.md)[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/NFT.ts:12](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/NFT.ts#L12)
|
||||
|
||||
___
|
||||
|
||||
### tokenId
|
||||
|
||||
• **tokenId**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/NFT.ts:10](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/NFT.ts#L10)
|
||||
|
||||
___
|
||||
|
||||
### tokenURI
|
||||
|
||||
• **tokenURI**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/NFT.ts:11](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/NFT.ts#L11)
|
|
@ -0,0 +1,52 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / MetadataProof
|
||||
|
||||
# Interface: MetadataProof
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [r](MetadataProof.md#r)
|
||||
- [s](MetadataProof.md#s)
|
||||
- [v](MetadataProof.md#v)
|
||||
- [validatorAddress](MetadataProof.md#validatoraddress)
|
||||
|
||||
## Properties
|
||||
|
||||
### r
|
||||
|
||||
• `Optional` **r**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Metadata.ts:142](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Metadata.ts#L142)
|
||||
|
||||
___
|
||||
|
||||
### s
|
||||
|
||||
• `Optional` **s**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Metadata.ts:143](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Metadata.ts#L143)
|
||||
|
||||
___
|
||||
|
||||
### v
|
||||
|
||||
• `Optional` **v**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Metadata.ts:144](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Metadata.ts#L144)
|
||||
|
||||
___
|
||||
|
||||
### validatorAddress
|
||||
|
||||
• `Optional` **validatorAddress**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Metadata.ts:141](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Metadata.ts#L141)
|
|
@ -0,0 +1,74 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / NftCreateData
|
||||
|
||||
# Interface: NftCreateData
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [name](NftCreateData.md#name)
|
||||
- [owner](NftCreateData.md#owner)
|
||||
- [symbol](NftCreateData.md#symbol)
|
||||
- [templateIndex](NftCreateData.md#templateindex)
|
||||
- [tokenURI](NftCreateData.md#tokenuri)
|
||||
- [transferable](NftCreateData.md#transferable)
|
||||
|
||||
## Properties
|
||||
|
||||
### name
|
||||
|
||||
• **name**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/NFTFactory.ts:17](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/NFTFactory.ts#L17)
|
||||
|
||||
___
|
||||
|
||||
### owner
|
||||
|
||||
• **owner**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/NFTFactory.ts:22](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/NFTFactory.ts#L22)
|
||||
|
||||
___
|
||||
|
||||
### symbol
|
||||
|
||||
• **symbol**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/NFTFactory.ts:18](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/NFTFactory.ts#L18)
|
||||
|
||||
___
|
||||
|
||||
### templateIndex
|
||||
|
||||
• **templateIndex**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/NFTFactory.ts:19](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/NFTFactory.ts#L19)
|
||||
|
||||
___
|
||||
|
||||
### tokenURI
|
||||
|
||||
• **tokenURI**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/NFTFactory.ts:20](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/NFTFactory.ts#L20)
|
||||
|
||||
___
|
||||
|
||||
### transferable
|
||||
|
||||
• **transferable**: `boolean`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/NFTFactory.ts:21](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/NFTFactory.ts#L21)
|
|
@ -0,0 +1,52 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / NftRoles
|
||||
|
||||
# Interface: NftRoles
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [deployERC20](NftRoles.md#deployerc20)
|
||||
- [manager](NftRoles.md#manager)
|
||||
- [store](NftRoles.md#store)
|
||||
- [updateMetadata](NftRoles.md#updatemetadata)
|
||||
|
||||
## Properties
|
||||
|
||||
### deployERC20
|
||||
|
||||
• **deployERC20**: `boolean`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/NFT.ts:17](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/NFT.ts#L17)
|
||||
|
||||
___
|
||||
|
||||
### manager
|
||||
|
||||
• **manager**: `boolean`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/NFT.ts:16](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/NFT.ts#L16)
|
||||
|
||||
___
|
||||
|
||||
### store
|
||||
|
||||
• **store**: `boolean`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/NFT.ts:19](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/NFT.ts#L19)
|
||||
|
||||
___
|
||||
|
||||
### updateMetadata
|
||||
|
||||
• **updateMetadata**: `boolean`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/NFT.ts:18](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/NFT.ts#L18)
|
|
@ -0,0 +1,145 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / Operation
|
||||
|
||||
# Interface: Operation
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [amountsIn](Operation.md#amountsin)
|
||||
- [amountsOut](Operation.md#amountsout)
|
||||
- [exchangeIds](Operation.md#exchangeids)
|
||||
- [marketFeeAddress](Operation.md#marketfeeaddress)
|
||||
- [maxPrice](Operation.md#maxprice)
|
||||
- [operation](Operation.md#operation)
|
||||
- [source](Operation.md#source)
|
||||
- [swapMarketFee](Operation.md#swapmarketfee)
|
||||
- [tokenIn](Operation.md#tokenin)
|
||||
- [tokenOut](Operation.md#tokenout)
|
||||
|
||||
## Properties
|
||||
|
||||
### amountsIn
|
||||
|
||||
• **amountsIn**: `string` \| `number`
|
||||
|
||||
when swapExactAmountIn is EXACT amount IN
|
||||
expressed in Wei
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Router.ts:31](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Router.ts#L31)
|
||||
|
||||
___
|
||||
|
||||
### amountsOut
|
||||
|
||||
• **amountsOut**: `string` \| `number`
|
||||
|
||||
when swapExactAmountIn is MIN amount OUT
|
||||
expressed in Wei
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Router.ts:42](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Router.ts#L42)
|
||||
|
||||
___
|
||||
|
||||
### exchangeIds
|
||||
|
||||
• **exchangeIds**: `string`
|
||||
|
||||
used for FixedRate or Dispenser
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Router.ts:6](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Router.ts#L6)
|
||||
|
||||
___
|
||||
|
||||
### marketFeeAddress
|
||||
|
||||
• **marketFeeAddress**: `string`
|
||||
|
||||
market fee address to receive fees
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Router.ts:58](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Router.ts#L58)
|
||||
|
||||
___
|
||||
|
||||
### maxPrice
|
||||
|
||||
• **maxPrice**: `string` \| `number`
|
||||
|
||||
max price (only for pools)
|
||||
expressed in Wei
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Router.ts:48](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Router.ts#L48)
|
||||
|
||||
___
|
||||
|
||||
### operation
|
||||
|
||||
• **operation**: `number`
|
||||
|
||||
operation:
|
||||
0 - swapExactAmountIn
|
||||
1 - swapExactAmountOut
|
||||
2 - FixedRateExchange
|
||||
3 - Dispenser
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Router.ts:20](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Router.ts#L20)
|
||||
|
||||
___
|
||||
|
||||
### source
|
||||
|
||||
• **source**: `string`
|
||||
|
||||
pool Address
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Router.ts:11](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Router.ts#L11)
|
||||
|
||||
___
|
||||
|
||||
### swapMarketFee
|
||||
|
||||
• **swapMarketFee**: `string`
|
||||
|
||||
swap fee amount
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Router.ts:53](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Router.ts#L53)
|
||||
|
||||
___
|
||||
|
||||
### tokenIn
|
||||
|
||||
• **tokenIn**: `string`
|
||||
|
||||
token in address
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Router.ts:25](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Router.ts#L25)
|
||||
|
||||
___
|
||||
|
||||
### tokenOut
|
||||
|
||||
• **tokenOut**: `string`
|
||||
|
||||
token out address
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Router.ts:36](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Router.ts#L36)
|
|
@ -0,0 +1,52 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / OrderParams
|
||||
|
||||
# Interface: OrderParams
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [\_consumeMarketFee](OrderParams.md#_consumemarketfee)
|
||||
- [\_providerFee](OrderParams.md#_providerfee)
|
||||
- [consumer](OrderParams.md#consumer)
|
||||
- [serviceIndex](OrderParams.md#serviceindex)
|
||||
|
||||
## Properties
|
||||
|
||||
### \_consumeMarketFee
|
||||
|
||||
• **\_consumeMarketFee**: [`ConsumeMarketFee`](ConsumeMarketFee.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Datatoken.ts:36](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Datatoken.ts#L36)
|
||||
|
||||
___
|
||||
|
||||
### \_providerFee
|
||||
|
||||
• **\_providerFee**: [`ProviderFees`](ProviderFees.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Datatoken.ts:35](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Datatoken.ts#L35)
|
||||
|
||||
___
|
||||
|
||||
### consumer
|
||||
|
||||
• **consumer**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Datatoken.ts:33](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Datatoken.ts#L33)
|
||||
|
||||
___
|
||||
|
||||
### serviceIndex
|
||||
|
||||
• **serviceIndex**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Datatoken.ts:34](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Datatoken.ts#L34)
|
|
@ -0,0 +1,52 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / PriceAndFees
|
||||
|
||||
# Interface: PriceAndFees
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [baseTokenAmount](PriceAndFees.md#basetokenamount)
|
||||
- [consumeMarketFeeAmount](PriceAndFees.md#consumemarketfeeamount)
|
||||
- [marketFeeAmount](PriceAndFees.md#marketfeeamount)
|
||||
- [oceanFeeAmount](PriceAndFees.md#oceanfeeamount)
|
||||
|
||||
## Properties
|
||||
|
||||
### baseTokenAmount
|
||||
|
||||
• **baseTokenAmount**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:25](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L25)
|
||||
|
||||
___
|
||||
|
||||
### consumeMarketFeeAmount
|
||||
|
||||
• **consumeMarketFeeAmount**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:28](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L28)
|
||||
|
||||
___
|
||||
|
||||
### marketFeeAmount
|
||||
|
||||
• **marketFeeAmount**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:27](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L27)
|
||||
|
||||
___
|
||||
|
||||
### oceanFeeAmount
|
||||
|
||||
• **oceanFeeAmount**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/FixedPrice.ts:26](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/FixedPrice.ts#L26)
|
|
@ -0,0 +1,41 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / ProviderComputeInitialize
|
||||
|
||||
# Interface: ProviderComputeInitialize
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [datatoken](ProviderComputeInitialize.md#datatoken)
|
||||
- [providerFee](ProviderComputeInitialize.md#providerfee)
|
||||
- [validOrder](ProviderComputeInitialize.md#validorder)
|
||||
|
||||
## Properties
|
||||
|
||||
### datatoken
|
||||
|
||||
• `Optional` **datatoken**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Provider.ts:20](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Provider.ts#L20)
|
||||
|
||||
___
|
||||
|
||||
### providerFee
|
||||
|
||||
• `Optional` **providerFee**: [`ProviderFees`](ProviderFees.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Provider.ts:22](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Provider.ts#L22)
|
||||
|
||||
___
|
||||
|
||||
### validOrder
|
||||
|
||||
• `Optional` **validOrder**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Provider.ts:21](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Provider.ts#L21)
|
|
@ -0,0 +1,30 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / ProviderComputeInitializeResults
|
||||
|
||||
# Interface: ProviderComputeInitializeResults
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [algorithm](ProviderComputeInitializeResults.md#algorithm)
|
||||
- [datasets](ProviderComputeInitializeResults.md#datasets)
|
||||
|
||||
## Properties
|
||||
|
||||
### algorithm
|
||||
|
||||
• `Optional` **algorithm**: [`ProviderComputeInitialize`](ProviderComputeInitialize.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Provider.ts:26](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Provider.ts#L26)
|
||||
|
||||
___
|
||||
|
||||
### datasets
|
||||
|
||||
• `Optional` **datasets**: [`ProviderComputeInitialize`](ProviderComputeInitialize.md)[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Provider.ts:27](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Provider.ts#L27)
|
|
@ -0,0 +1,96 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / ProviderFees
|
||||
|
||||
# Interface: ProviderFees
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [providerData](ProviderFees.md#providerdata)
|
||||
- [providerFeeAddress](ProviderFees.md#providerfeeaddress)
|
||||
- [providerFeeAmount](ProviderFees.md#providerfeeamount)
|
||||
- [providerFeeToken](ProviderFees.md#providerfeetoken)
|
||||
- [r](ProviderFees.md#r)
|
||||
- [s](ProviderFees.md#s)
|
||||
- [v](ProviderFees.md#v)
|
||||
- [validUntil](ProviderFees.md#validuntil)
|
||||
|
||||
## Properties
|
||||
|
||||
### providerData
|
||||
|
||||
• **providerData**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Provider.ts:8](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Provider.ts#L8)
|
||||
|
||||
___
|
||||
|
||||
### providerFeeAddress
|
||||
|
||||
• **providerFeeAddress**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Provider.ts:2](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Provider.ts#L2)
|
||||
|
||||
___
|
||||
|
||||
### providerFeeAmount
|
||||
|
||||
• **providerFeeAmount**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Provider.ts:4](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Provider.ts#L4)
|
||||
|
||||
___
|
||||
|
||||
### providerFeeToken
|
||||
|
||||
• **providerFeeToken**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Provider.ts:3](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Provider.ts#L3)
|
||||
|
||||
___
|
||||
|
||||
### r
|
||||
|
||||
• **r**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Provider.ts:6](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Provider.ts#L6)
|
||||
|
||||
___
|
||||
|
||||
### s
|
||||
|
||||
• **s**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Provider.ts:7](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Provider.ts#L7)
|
||||
|
||||
___
|
||||
|
||||
### v
|
||||
|
||||
• **v**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Provider.ts:5](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Provider.ts#L5)
|
||||
|
||||
___
|
||||
|
||||
### validUntil
|
||||
|
||||
• **validUntil**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Provider.ts:9](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Provider.ts#L9)
|
|
@ -0,0 +1,52 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / ProviderInitialize
|
||||
|
||||
# Interface: ProviderInitialize
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [computeAddress](ProviderInitialize.md#computeaddress)
|
||||
- [datatoken](ProviderInitialize.md#datatoken)
|
||||
- [nonce](ProviderInitialize.md#nonce)
|
||||
- [providerFee](ProviderInitialize.md#providerfee)
|
||||
|
||||
## Properties
|
||||
|
||||
### computeAddress
|
||||
|
||||
• **computeAddress**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Provider.ts:15](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Provider.ts#L15)
|
||||
|
||||
___
|
||||
|
||||
### datatoken
|
||||
|
||||
• **datatoken**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Provider.ts:13](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Provider.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### nonce
|
||||
|
||||
• **nonce**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Provider.ts:14](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Provider.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### providerFee
|
||||
|
||||
• **providerFee**: [`ProviderFees`](ProviderFees.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Provider.ts:16](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Provider.ts#L16)
|
|
@ -0,0 +1,47 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / PublisherTrustedAlgorithm
|
||||
|
||||
# Interface: PublisherTrustedAlgorithm
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [containerSectionChecksum](PublisherTrustedAlgorithm.md#containersectionchecksum)
|
||||
- [did](PublisherTrustedAlgorithm.md#did)
|
||||
- [filesChecksum](PublisherTrustedAlgorithm.md#fileschecksum)
|
||||
|
||||
## Properties
|
||||
|
||||
### containerSectionChecksum
|
||||
|
||||
• **containerSectionChecksum**: `string`
|
||||
|
||||
Hash of algorithm’s metadata.algorithm.container section.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Service.ts:18](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Service.ts#L18)
|
||||
|
||||
___
|
||||
|
||||
### did
|
||||
|
||||
• **did**: `string`
|
||||
|
||||
The DID of the algorithm which is trusted by the publisher.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Service.ts:6](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Service.ts#L6)
|
||||
|
||||
___
|
||||
|
||||
### filesChecksum
|
||||
|
||||
• **filesChecksum**: `string`
|
||||
|
||||
Hash of algorithm’s files section.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Service.ts:12](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Service.ts#L12)
|
|
@ -0,0 +1,41 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / PublishingMarketFee
|
||||
|
||||
# Interface: PublishingMarketFee
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [publishMarketFeeAddress](PublishingMarketFee.md#publishmarketfeeaddress)
|
||||
- [publishMarketFeeAmount](PublishingMarketFee.md#publishmarketfeeamount)
|
||||
- [publishMarketFeeToken](PublishingMarketFee.md#publishmarketfeetoken)
|
||||
|
||||
## Properties
|
||||
|
||||
### publishMarketFeeAddress
|
||||
|
||||
• **publishMarketFeeAddress**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Datatoken.ts:22](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Datatoken.ts#L22)
|
||||
|
||||
___
|
||||
|
||||
### publishMarketFeeAmount
|
||||
|
||||
• **publishMarketFeeAmount**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Datatoken.ts:24](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Datatoken.ts#L24)
|
||||
|
||||
___
|
||||
|
||||
### publishMarketFeeToken
|
||||
|
||||
• **publishMarketFeeToken**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Datatoken.ts:23](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Datatoken.ts#L23)
|
|
@ -0,0 +1,34 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / Purgatory
|
||||
|
||||
# Interface: Purgatory
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [reason](Purgatory.md#reason)
|
||||
- [state](Purgatory.md#state)
|
||||
|
||||
## Properties
|
||||
|
||||
### reason
|
||||
|
||||
• **reason**: `string`
|
||||
|
||||
If asset is in purgatory, contains the reason for being there as defined in `list-purgatory`.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Asset.ts:64](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Asset.ts#L64)
|
||||
|
||||
___
|
||||
|
||||
### state
|
||||
|
||||
• **state**: `boolean`
|
||||
|
||||
If `true`, asset is in purgatory.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Asset.ts:58](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Asset.ts#L58)
|
|
@ -0,0 +1,67 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / SearchQuery
|
||||
|
||||
# Interface: SearchQuery
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [aggs](SearchQuery.md#aggs)
|
||||
- [from](SearchQuery.md#from)
|
||||
- [query](SearchQuery.md#query)
|
||||
- [size](SearchQuery.md#size)
|
||||
- [sort](SearchQuery.md#sort)
|
||||
|
||||
## Properties
|
||||
|
||||
### aggs
|
||||
|
||||
• `Optional` **aggs**: `any`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/Aquarius.ts:11](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Aquarius.ts#L11)
|
||||
|
||||
___
|
||||
|
||||
### from
|
||||
|
||||
• `Optional` **from**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/Aquarius.ts:6](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Aquarius.ts#L6)
|
||||
|
||||
___
|
||||
|
||||
### query
|
||||
|
||||
• **query**: `any`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/Aquarius.ts:9](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Aquarius.ts#L9)
|
||||
|
||||
___
|
||||
|
||||
### size
|
||||
|
||||
• `Optional` **size**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/Aquarius.ts:7](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Aquarius.ts#L7)
|
||||
|
||||
___
|
||||
|
||||
### sort
|
||||
|
||||
• `Optional` **sort**: `Object`
|
||||
|
||||
#### Index signature
|
||||
|
||||
▪ [jsonPath: `string`]: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/Aquarius.ts:10](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Aquarius.ts#L10)
|
|
@ -0,0 +1,138 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / Service
|
||||
|
||||
# Interface: Service
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [additionalInformation](Service.md#additionalinformation)
|
||||
- [compute](Service.md#compute)
|
||||
- [datatokenAddress](Service.md#datatokenaddress)
|
||||
- [description](Service.md#description)
|
||||
- [files](Service.md#files)
|
||||
- [id](Service.md#id)
|
||||
- [name](Service.md#name)
|
||||
- [serviceEndpoint](Service.md#serviceendpoint)
|
||||
- [timeout](Service.md#timeout)
|
||||
- [type](Service.md#type)
|
||||
|
||||
## Properties
|
||||
|
||||
### additionalInformation
|
||||
|
||||
• `Optional` **additionalInformation**: `any`
|
||||
|
||||
Stores service specific additional information, this is customizable by publisher
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Service.ts:109](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Service.ts#L109)
|
||||
|
||||
___
|
||||
|
||||
### compute
|
||||
|
||||
• `Optional` **compute**: [`ServiceComputeOptions`](ServiceComputeOptions.md)
|
||||
|
||||
If service is of type compute, holds information about the compute-related privacy settings & resources.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Service.ts:103](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Service.ts#L103)
|
||||
|
||||
___
|
||||
|
||||
### datatokenAddress
|
||||
|
||||
• **datatokenAddress**: `string`
|
||||
|
||||
Datatoken address
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Service.ts:73](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Service.ts#L73)
|
||||
|
||||
___
|
||||
|
||||
### description
|
||||
|
||||
• `Optional` **description**: `string`
|
||||
|
||||
Service description
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Service.ts:97](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Service.ts#L97)
|
||||
|
||||
___
|
||||
|
||||
### files
|
||||
|
||||
• **files**: `string`
|
||||
|
||||
Encrypted file URLs.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Service.ts:67](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Service.ts#L67)
|
||||
|
||||
___
|
||||
|
||||
### id
|
||||
|
||||
• **id**: `string`
|
||||
|
||||
Unique ID
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Service.ts:55](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Service.ts#L55)
|
||||
|
||||
___
|
||||
|
||||
### name
|
||||
|
||||
• `Optional` **name**: `string`
|
||||
|
||||
Service friendly name
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Service.ts:91](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Service.ts#L91)
|
||||
|
||||
___
|
||||
|
||||
### serviceEndpoint
|
||||
|
||||
• **serviceEndpoint**: `string`
|
||||
|
||||
Provider URL (schema + host).
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Service.ts:79](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Service.ts#L79)
|
||||
|
||||
___
|
||||
|
||||
### timeout
|
||||
|
||||
• **timeout**: `number`
|
||||
|
||||
Describing how long the service can be used after consumption is initiated.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Service.ts:85](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Service.ts#L85)
|
||||
|
||||
___
|
||||
|
||||
### type
|
||||
|
||||
• **type**: `string`
|
||||
|
||||
Type of service (access, compute, wss.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Service.ts:61](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Service.ts#L61)
|
|
@ -0,0 +1,63 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / ServiceComputeOptions
|
||||
|
||||
# Interface: ServiceComputeOptions
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [allowNetworkAccess](ServiceComputeOptions.md#allownetworkaccess)
|
||||
- [allowRawAlgorithm](ServiceComputeOptions.md#allowrawalgorithm)
|
||||
- [publisherTrustedAlgorithmPublishers](ServiceComputeOptions.md#publishertrustedalgorithmpublishers)
|
||||
- [publisherTrustedAlgorithms](ServiceComputeOptions.md#publishertrustedalgorithms)
|
||||
|
||||
## Properties
|
||||
|
||||
### allowNetworkAccess
|
||||
|
||||
• **allowNetworkAccess**: `boolean`
|
||||
|
||||
If true, the algorithm job will have network access.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Service.ts:34](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Service.ts#L34)
|
||||
|
||||
___
|
||||
|
||||
### allowRawAlgorithm
|
||||
|
||||
• **allowRawAlgorithm**: `boolean`
|
||||
|
||||
If true, any passed raw text will be allowed to run.
|
||||
Useful for an algorithm drag & drop use case, but increases risk of data escape through malicious user input.
|
||||
Should be false by default in all implementations.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Service.ts:28](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Service.ts#L28)
|
||||
|
||||
___
|
||||
|
||||
### publisherTrustedAlgorithmPublishers
|
||||
|
||||
• **publisherTrustedAlgorithmPublishers**: `string`[]
|
||||
|
||||
If empty, then any published algorithm is allowed.
|
||||
Otherwise, only published algorithms by some publishers are allowed
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Service.ts:41](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Service.ts#L41)
|
||||
|
||||
___
|
||||
|
||||
### publisherTrustedAlgorithms
|
||||
|
||||
• **publisherTrustedAlgorithms**: [`PublisherTrustedAlgorithm`](PublisherTrustedAlgorithm.md)[]
|
||||
|
||||
If empty, then any published algorithm is allowed. (see below)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Service.ts:47](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Service.ts#L47)
|
|
@ -0,0 +1,41 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / ServiceEndpoint
|
||||
|
||||
# Interface: ServiceEndpoint
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [method](ServiceEndpoint.md#method)
|
||||
- [serviceName](ServiceEndpoint.md#servicename)
|
||||
- [urlPath](ServiceEndpoint.md#urlpath)
|
||||
|
||||
## Properties
|
||||
|
||||
### method
|
||||
|
||||
• **method**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Provider.ts:32](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Provider.ts#L32)
|
||||
|
||||
___
|
||||
|
||||
### serviceName
|
||||
|
||||
• **serviceName**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Provider.ts:31](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Provider.ts#L31)
|
||||
|
||||
___
|
||||
|
||||
### urlPath
|
||||
|
||||
• **urlPath**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Provider.ts:33](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Provider.ts#L33)
|
|
@ -0,0 +1,58 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / Smartcontract
|
||||
|
||||
# Interface: Smartcontract
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [abi](Smartcontract-1.md#abi)
|
||||
- [address](Smartcontract-1.md#address)
|
||||
- [chainId](Smartcontract-1.md#chainid)
|
||||
- [type](Smartcontract-1.md#type)
|
||||
|
||||
## Properties
|
||||
|
||||
### abi
|
||||
|
||||
• **abi**: [`AbiItem`](AbiItem.md)
|
||||
|
||||
Function ABI (not the entire smartcontract abi)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/File.ts:100](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/File.ts#L100)
|
||||
|
||||
___
|
||||
|
||||
### address
|
||||
|
||||
• **address**: `string`
|
||||
|
||||
Smartcontract address
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/File.ts:88](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/File.ts#L88)
|
||||
|
||||
___
|
||||
|
||||
### chainId
|
||||
|
||||
• **chainId**: `number`
|
||||
|
||||
ChainId
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/File.ts:94](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/File.ts#L94)
|
||||
|
||||
___
|
||||
|
||||
### type
|
||||
|
||||
• **type**: ``"smartcontract"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/File.ts:82](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/File.ts#L82)
|
|
@ -0,0 +1,47 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / Stats
|
||||
|
||||
# Interface: Stats
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [allocated](Stats.md#allocated)
|
||||
- [orders](Stats.md#orders)
|
||||
- [price](Stats.md#price)
|
||||
|
||||
## Properties
|
||||
|
||||
### allocated
|
||||
|
||||
• `Optional` **allocated**: `number`
|
||||
|
||||
Total amount of veOCEAN allocated on this asset.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Asset.ts:129](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Asset.ts#L129)
|
||||
|
||||
___
|
||||
|
||||
### orders
|
||||
|
||||
• **orders**: `number`
|
||||
|
||||
How often an asset was consumed, meaning how often it was either downloaded or used as part of a compute job.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Asset.ts:117](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Asset.ts#L117)
|
||||
|
||||
___
|
||||
|
||||
### price
|
||||
|
||||
• **price**: [`AssetPrice`](AssetPrice.md)
|
||||
|
||||
Contains information about the price of this asset.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Asset.ts:123](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Asset.ts#L123)
|
|
@ -0,0 +1,30 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / Template
|
||||
|
||||
# Interface: Template
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [isActive](Template.md#isactive)
|
||||
- [templateAddress](Template.md#templateaddress)
|
||||
|
||||
## Properties
|
||||
|
||||
### isActive
|
||||
|
||||
• **isActive**: `boolean`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/NFTFactory.ts:5](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/NFTFactory.ts#L5)
|
||||
|
||||
___
|
||||
|
||||
### templateAddress
|
||||
|
||||
• **templateAddress**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/NFTFactory.ts:4](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/NFTFactory.ts#L4)
|
|
@ -0,0 +1,63 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / TokenOrder
|
||||
|
||||
# Interface: TokenOrder
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [\_consumeMarketFee](TokenOrder.md#_consumemarketfee)
|
||||
- [\_providerFee](TokenOrder.md#_providerfee)
|
||||
- [consumer](TokenOrder.md#consumer)
|
||||
- [serviceIndex](TokenOrder.md#serviceindex)
|
||||
- [tokenAddress](TokenOrder.md#tokenaddress)
|
||||
|
||||
## Properties
|
||||
|
||||
### \_consumeMarketFee
|
||||
|
||||
• **\_consumeMarketFee**: [`ConsumeMarketFee`](ConsumeMarketFee.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/NFTFactory.ts:13](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/NFTFactory.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### \_providerFee
|
||||
|
||||
• **\_providerFee**: [`ProviderFees`](ProviderFees.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/NFTFactory.ts:12](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/NFTFactory.ts#L12)
|
||||
|
||||
___
|
||||
|
||||
### consumer
|
||||
|
||||
• **consumer**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/NFTFactory.ts:10](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/NFTFactory.ts#L10)
|
||||
|
||||
___
|
||||
|
||||
### serviceIndex
|
||||
|
||||
• **serviceIndex**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/NFTFactory.ts:11](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/NFTFactory.ts#L11)
|
||||
|
||||
___
|
||||
|
||||
### tokenAddress
|
||||
|
||||
• **tokenAddress**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/NFTFactory.ts:9](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/NFTFactory.ts#L9)
|
|
@ -0,0 +1,71 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / UrlFile
|
||||
|
||||
# Interface: UrlFile
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [headers](UrlFile.md#headers)
|
||||
- [index](UrlFile.md#index)
|
||||
- [method](UrlFile.md#method)
|
||||
- [type](UrlFile.md#type)
|
||||
- [url](UrlFile.md#url)
|
||||
|
||||
## Properties
|
||||
|
||||
### headers
|
||||
|
||||
• `Optional` **headers**: `FileTypeHeaders`
|
||||
|
||||
Headers key value pairs associated with the asset GET request
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/File.ts:32](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/File.ts#L32)
|
||||
|
||||
___
|
||||
|
||||
### index
|
||||
|
||||
• `Optional` **index**: `number`
|
||||
|
||||
File index.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/File.ts:14](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/File.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### method
|
||||
|
||||
• **method**: `string`
|
||||
|
||||
HTTP method used
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/File.ts:26](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/File.ts#L26)
|
||||
|
||||
___
|
||||
|
||||
### type
|
||||
|
||||
• **type**: ``"url"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/File.ts:8](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/File.ts#L8)
|
||||
|
||||
___
|
||||
|
||||
### url
|
||||
|
||||
• **url**: `string`
|
||||
|
||||
File URL.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/File.ts:20](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/File.ts#L20)
|
|
@ -0,0 +1,7 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / UserCustomParameters
|
||||
|
||||
# Interface: UserCustomParameters
|
||||
|
||||
## Indexable
|
||||
|
||||
▪ [key: `string`]: `any`
|
|
@ -0,0 +1,52 @@
|
|||
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / ValidateMetadata
|
||||
|
||||
# Interface: ValidateMetadata
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Properties
|
||||
|
||||
- [errors](ValidateMetadata.md#errors)
|
||||
- [hash](ValidateMetadata.md#hash)
|
||||
- [proof](ValidateMetadata.md#proof)
|
||||
- [valid](ValidateMetadata.md#valid)
|
||||
|
||||
## Properties
|
||||
|
||||
### errors
|
||||
|
||||
• `Optional` **errors**: `Object`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Metadata.ts:148](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Metadata.ts#L148)
|
||||
|
||||
___
|
||||
|
||||
### hash
|
||||
|
||||
• `Optional` **hash**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Metadata.ts:149](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Metadata.ts#L149)
|
||||
|
||||
___
|
||||
|
||||
### proof
|
||||
|
||||
• `Optional` **proof**: [`MetadataProof`](MetadataProof.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Metadata.ts:150](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Metadata.ts#L150)
|
||||
|
||||
___
|
||||
|
||||
### valid
|
||||
|
||||
• **valid**: `Boolean`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/DDO/Metadata.ts:147](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/DDO/Metadata.ts#L147)
|
|
@ -0,0 +1,856 @@
|
|||
[@oceanprotocol/lib](README.md) / Exports
|
||||
|
||||
# @oceanprotocol/lib
|
||||
|
||||
## Table of contents
|
||||
|
||||
### Enumerations
|
||||
|
||||
- [LogLevel](enums/LogLevel.md)
|
||||
|
||||
### Classes
|
||||
|
||||
- [Aquarius](classes/Aquarius.md)
|
||||
- [Config](classes/Config.md)
|
||||
- [ConfigHelper](classes/ConfigHelper.md)
|
||||
- [Datatoken](classes/Datatoken.md)
|
||||
- [DfRewards](classes/DfRewards.md)
|
||||
- [DfStrategyV1](classes/DfStrategyV1.md)
|
||||
- [Dispenser](classes/Dispenser.md)
|
||||
- [FixedRateExchange](classes/FixedRateExchange.md)
|
||||
- [Logger](classes/Logger.md)
|
||||
- [Nft](classes/Nft.md)
|
||||
- [NftFactory](classes/NftFactory.md)
|
||||
- [Provider](classes/Provider.md)
|
||||
- [Router](classes/Router.md)
|
||||
- [SmartContract](classes/SmartContract.md)
|
||||
- [SmartContractWithAddress](classes/SmartContractWithAddress.md)
|
||||
- [VeAllocate](classes/VeAllocate.md)
|
||||
- [VeFeeDistributor](classes/VeFeeDistributor.md)
|
||||
- [VeFeeEstimate](classes/VeFeeEstimate.md)
|
||||
- [VeOcean](classes/VeOcean.md)
|
||||
|
||||
### Interfaces
|
||||
|
||||
- [AbiInput](interfaces/AbiInput.md)
|
||||
- [AbiItem](interfaces/AbiItem.md)
|
||||
- [AbiOutput](interfaces/AbiOutput.md)
|
||||
- [Arweave](interfaces/Arweave.md)
|
||||
- [Asset](interfaces/Asset.md)
|
||||
- [AssetDatatoken](interfaces/AssetDatatoken.md)
|
||||
- [AssetLastEvent](interfaces/AssetLastEvent.md)
|
||||
- [AssetNft](interfaces/AssetNft.md)
|
||||
- [AssetPrice](interfaces/AssetPrice.md)
|
||||
- [ComputeAlgorithm](interfaces/ComputeAlgorithm.md)
|
||||
- [ComputeAsset](interfaces/ComputeAsset.md)
|
||||
- [ComputeEnvironment](interfaces/ComputeEnvironment.md)
|
||||
- [ComputeJob](interfaces/ComputeJob.md)
|
||||
- [ComputeOutput](interfaces/ComputeOutput.md)
|
||||
- [ComputeResult](interfaces/ComputeResult.md)
|
||||
- [ConsumeMarketFee](interfaces/ConsumeMarketFee.md)
|
||||
- [Credential](interfaces/Credential.md)
|
||||
- [Credentials](interfaces/Credentials.md)
|
||||
- [DDO](interfaces/DDO.md)
|
||||
- [DatatokenCreateParams](interfaces/DatatokenCreateParams.md)
|
||||
- [DatatokenRoles](interfaces/DatatokenRoles.md)
|
||||
- [DispenserCreationParams](interfaces/DispenserCreationParams.md)
|
||||
- [DispenserParams](interfaces/DispenserParams.md)
|
||||
- [DispenserToken](interfaces/DispenserToken.md)
|
||||
- [DownloadResponse](interfaces/DownloadResponse.md)
|
||||
- [Event](interfaces/Event.md)
|
||||
- [FeesInfo](interfaces/FeesInfo.md)
|
||||
- [FileInfo](interfaces/FileInfo.md)
|
||||
- [Files](interfaces/Files.md)
|
||||
- [FixedPriceExchange](interfaces/FixedPriceExchange.md)
|
||||
- [FreCreationParams](interfaces/FreCreationParams.md)
|
||||
- [FreOrderParams](interfaces/FreOrderParams.md)
|
||||
- [GraphqlQuery](interfaces/GraphqlQuery.md)
|
||||
- [Ipfs](interfaces/Ipfs.md)
|
||||
- [Metadata](interfaces/Metadata.md)
|
||||
- [MetadataAlgorithm](interfaces/MetadataAlgorithm.md)
|
||||
- [MetadataAndTokenURI](interfaces/MetadataAndTokenURI.md)
|
||||
- [MetadataProof](interfaces/MetadataProof.md)
|
||||
- [NftCreateData](interfaces/NftCreateData.md)
|
||||
- [NftRoles](interfaces/NftRoles.md)
|
||||
- [Operation](interfaces/Operation.md)
|
||||
- [OrderParams](interfaces/OrderParams.md)
|
||||
- [PriceAndFees](interfaces/PriceAndFees.md)
|
||||
- [ProviderComputeInitialize](interfaces/ProviderComputeInitialize.md)
|
||||
- [ProviderComputeInitializeResults](interfaces/ProviderComputeInitializeResults.md)
|
||||
- [ProviderFees](interfaces/ProviderFees.md)
|
||||
- [ProviderInitialize](interfaces/ProviderInitialize.md)
|
||||
- [PublisherTrustedAlgorithm](interfaces/PublisherTrustedAlgorithm.md)
|
||||
- [PublishingMarketFee](interfaces/PublishingMarketFee.md)
|
||||
- [Purgatory](interfaces/Purgatory.md)
|
||||
- [SearchQuery](interfaces/SearchQuery.md)
|
||||
- [Service](interfaces/Service.md)
|
||||
- [ServiceComputeOptions](interfaces/ServiceComputeOptions.md)
|
||||
- [ServiceEndpoint](interfaces/ServiceEndpoint.md)
|
||||
- [Smartcontract](interfaces/Smartcontract-1.md)
|
||||
- [Stats](interfaces/Stats.md)
|
||||
- [Template](interfaces/Template.md)
|
||||
- [TokenOrder](interfaces/TokenOrder.md)
|
||||
- [UrlFile](interfaces/UrlFile.md)
|
||||
- [UserCustomParameters](interfaces/UserCustomParameters.md)
|
||||
- [ValidateMetadata](interfaces/ValidateMetadata.md)
|
||||
|
||||
### Type Aliases
|
||||
|
||||
- [AbiType](modules.md#abitype)
|
||||
- [ComputeResultType](modules.md#computeresulttype)
|
||||
- [ReceiptOrDecimal](modules.md#receiptordecimal)
|
||||
- [ReceiptOrEstimate](modules.md#receiptorestimate)
|
||||
- [StateMutabilityType](modules.md#statemutabilitytype)
|
||||
|
||||
### Variables
|
||||
|
||||
- [FEE\_HISTORY\_NOT\_SUPPORTED](modules.md#fee_history_not_supported)
|
||||
- [GASLIMIT\_DEFAULT](modules.md#gaslimit_default)
|
||||
- [LoggerInstance](modules.md#loggerinstance)
|
||||
- [MAX\_UINT\_256](modules.md#max_uint_256)
|
||||
- [ProviderInstance](modules.md#providerinstance)
|
||||
- [ZERO\_ADDRESS](modules.md#zero_address)
|
||||
- [configHelperNetworks](modules.md#confighelpernetworks)
|
||||
- [minAbi](modules.md#minabi)
|
||||
|
||||
### Functions
|
||||
|
||||
- [allowance](modules.md#allowance)
|
||||
- [allowanceWei](modules.md#allowancewei)
|
||||
- [amountToUnits](modules.md#amounttounits)
|
||||
- [approve](modules.md#approve)
|
||||
- [approveWei](modules.md#approvewei)
|
||||
- [balance](modules.md#balance)
|
||||
- [decimals](modules.md#decimals)
|
||||
- [downloadFile](modules.md#downloadfile)
|
||||
- [downloadFileBrowser](modules.md#downloadfilebrowser)
|
||||
- [generateDid](modules.md#generatedid)
|
||||
- [generateDtName](modules.md#generatedtname)
|
||||
- [getErrorMessage](modules.md#geterrormessage)
|
||||
- [getEventFromTx](modules.md#geteventfromtx)
|
||||
- [getFairGasPrice](modules.md#getfairgasprice)
|
||||
- [getHash](modules.md#gethash)
|
||||
- [getTokenDecimals](modules.md#gettokendecimals)
|
||||
- [sendTx](modules.md#sendtx)
|
||||
- [setContractDefaults](modules.md#setcontractdefaults)
|
||||
- [signHash](modules.md#signhash)
|
||||
- [sleep](modules.md#sleep)
|
||||
- [transfer](modules.md#transfer)
|
||||
- [unitsToAmount](modules.md#unitstoamount)
|
||||
|
||||
## Type Aliases
|
||||
|
||||
### AbiType
|
||||
|
||||
Ƭ **AbiType**: ``"function"`` \| ``"constructor"`` \| ``"event"`` \| ``"fallback"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Contracts.ts:1](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Contracts.ts#L1)
|
||||
|
||||
___
|
||||
|
||||
### ComputeResultType
|
||||
|
||||
Ƭ **ComputeResultType**: ``"algorithmLog"`` \| ``"output"`` \| ``"configrationLog"`` \| ``"publishLog"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Compute.ts:3](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L3)
|
||||
|
||||
___
|
||||
|
||||
### ReceiptOrDecimal
|
||||
|
||||
Ƭ **ReceiptOrDecimal**<`G`\>: `G` extends ``false`` ? `providers.TransactionResponse` : `number`
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/ReturnTypes.ts:5](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/ReturnTypes.ts#L5)
|
||||
|
||||
___
|
||||
|
||||
### ReceiptOrEstimate
|
||||
|
||||
Ƭ **ReceiptOrEstimate**<`G`\>: `G` extends ``false`` ? `providers.TransactionResponse` : `BigNumber`
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/ReturnTypes.ts:2](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/ReturnTypes.ts#L2)
|
||||
|
||||
___
|
||||
|
||||
### StateMutabilityType
|
||||
|
||||
Ƭ **StateMutabilityType**: ``"pure"`` \| ``"view"`` \| ``"nonpayable"`` \| ``"payable"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[@types/Contracts.ts:2](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Contracts.ts#L2)
|
||||
|
||||
## Variables
|
||||
|
||||
### FEE\_HISTORY\_NOT\_SUPPORTED
|
||||
|
||||
• `Const` **FEE\_HISTORY\_NOT\_SUPPORTED**: ``"Returned error: Method eth_feeHistory not supported."``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/Constants.ts:5](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/Constants.ts#L5)
|
||||
|
||||
___
|
||||
|
||||
### GASLIMIT\_DEFAULT
|
||||
|
||||
• `Const` **GASLIMIT\_DEFAULT**: ``1000000``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/Constants.ts:2](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/Constants.ts#L2)
|
||||
|
||||
___
|
||||
|
||||
### LoggerInstance
|
||||
|
||||
• `Const` **LoggerInstance**: [`Logger`](classes/Logger.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/Logger.ts:45](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/Logger.ts#L45)
|
||||
|
||||
___
|
||||
|
||||
### MAX\_UINT\_256
|
||||
|
||||
• `Const` **MAX\_UINT\_256**: ``"115792089237316195423570985008687907853269984665640564039457584007913129639934"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/Constants.ts:3](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/Constants.ts#L3)
|
||||
|
||||
___
|
||||
|
||||
### ProviderInstance
|
||||
|
||||
• `Const` **ProviderInstance**: [`Provider`](classes/Provider.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/Provider.ts:916](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Provider.ts#L916)
|
||||
|
||||
___
|
||||
|
||||
### ZERO\_ADDRESS
|
||||
|
||||
• `Const` **ZERO\_ADDRESS**: ``"0x0000000000000000000000000000000000000000"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/Constants.ts:1](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/Constants.ts#L1)
|
||||
|
||||
___
|
||||
|
||||
### configHelperNetworks
|
||||
|
||||
• `Const` **configHelperNetworks**: [`Config`](classes/Config.md)[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config/ConfigHelper.ts:25](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/ConfigHelper.ts#L25)
|
||||
|
||||
___
|
||||
|
||||
### minAbi
|
||||
|
||||
• `Const` **minAbi**: ({ `anonymous?`: `undefined` = false; `constant`: `boolean` = false; `inputs`: { `name`: `string` = '\_spender'; `type`: `string` = 'address' }[] ; `name`: `string` = 'approve'; `outputs`: { `name`: `string` = ''; `type`: `string` = 'bool' }[] ; `payable`: `boolean` = false; `stateMutability`: `string` = 'nonpayable'; `type`: `string` = 'function' } \| { `anonymous?`: `undefined` = false; `constant?`: `undefined` = false; `inputs?`: `undefined` ; `name?`: `undefined` = 'Approval'; `outputs?`: `undefined` ; `payable`: `boolean` = true; `stateMutability`: `string` = 'payable'; `type`: `string` = 'fallback' } \| { `anonymous`: `boolean` = false; `constant?`: `undefined` = false; `inputs`: { `indexed`: `boolean` = true; `name`: `string` = 'owner'; `type`: `string` = 'address' }[] ; `name`: `string` = 'Approval'; `outputs?`: `undefined` ; `payable?`: `undefined` = true; `stateMutability?`: `undefined` = 'payable'; `type`: `string` = 'event' })[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/minAbi.ts:1](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/minAbi.ts#L1)
|
||||
|
||||
## Functions
|
||||
|
||||
### allowance
|
||||
|
||||
▸ **allowance**(`signer`, `tokenAddress`, `account`, `spender`, `tokenDecimals?`): `Promise`<`string`\>
|
||||
|
||||
Get Allowance for any Datatoken
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `signer` | `Signer` | The signer object |
|
||||
| `tokenAddress` | `string` | The address of the token |
|
||||
| `account` | `string` | The address of the caller |
|
||||
| `spender` | `string` | The address of the spender |
|
||||
| `tokenDecimals?` | `number` | optional number of decimals of the token |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/TokenUtils.ts:143](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/TokenUtils.ts#L143)
|
||||
|
||||
___
|
||||
|
||||
### allowanceWei
|
||||
|
||||
▸ **allowanceWei**(`signer`, `tokenAddress`, `account`, `spender`): `Promise`<`string`\>
|
||||
|
||||
Get Allowance in wei for any erc20
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `signer` | `Signer` | The signer object |
|
||||
| `tokenAddress` | `string` | The address of the token |
|
||||
| `account` | `string` | The address of the caller |
|
||||
| `spender` | `string` | The address of the spneder |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/TokenUtils.ts:182](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/TokenUtils.ts#L182)
|
||||
|
||||
___
|
||||
|
||||
### amountToUnits
|
||||
|
||||
▸ **amountToUnits**(`signer`, `token`, `amount`, `tokenDecimals?`): `Promise`<`string`\>
|
||||
|
||||
Converts an amount of tokens to units
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `signer` | `Signer` | The signer object to use. |
|
||||
| `token` | `string` | The token to convert |
|
||||
| `amount` | `string` | The amount of tokens to convert |
|
||||
| `tokenDecimals?` | `number` | The number of decimals of the token |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The converted amount in units
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/ContractUtils.ts:82](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/ContractUtils.ts#L82)
|
||||
|
||||
___
|
||||
|
||||
### approve
|
||||
|
||||
▸ **approve**<`G`\>(`signer`, `config`, `account`, `tokenAddress`, `spender`, `amount`, `force?`, `tokenDecimals?`, `estimateGas?`): `Promise`<[`ReceiptOrDecimal`](modules.md#receiptordecimal)<`G`\> \| `number`\>
|
||||
|
||||
Approve spender to spent amount tokens
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| :------ | :------ | :------ | :------ |
|
||||
| `signer` | `Signer` | `undefined` | The signer object |
|
||||
| `config` | [`Config`](classes/Config.md) | `undefined` | The config object |
|
||||
| `account` | `string` | `undefined` | The address of the caller |
|
||||
| `tokenAddress` | `string` | `undefined` | The address of the token |
|
||||
| `spender` | `string` | `undefined` | The address of the spender |
|
||||
| `amount` | `string` | `undefined` | amount of ERC20 Datatokens (always expressed as wei) |
|
||||
| `force` | `boolean` | `false` | if true, will overwrite any previous allowence. Else, will check if allowence is enough and will not send a transaction if it's not needed |
|
||||
| `tokenDecimals?` | `number` | `undefined` | optional number of decimals of the token |
|
||||
| `estimateGas?` | `G` | `undefined` | if true, returns the estimate gas cost for calling the method |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrDecimal`](modules.md#receiptordecimal)<`G`\> \| `number`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/TokenUtils.ts:19](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/TokenUtils.ts#L19)
|
||||
|
||||
___
|
||||
|
||||
### approveWei
|
||||
|
||||
▸ **approveWei**<`G`\>(`signer`, `config`, `account`, `tokenAddress`, `spender`, `amount`, `force?`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Approve spender to spent amount tokens
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| :------ | :------ | :------ | :------ |
|
||||
| `signer` | `Signer` | `undefined` | The signer object |
|
||||
| `config` | [`Config`](classes/Config.md) | `undefined` | The config object |
|
||||
| `account` | `string` | `undefined` | The address of the caller |
|
||||
| `tokenAddress` | `string` | `undefined` | The address of the token |
|
||||
| `spender` | `string` | `undefined` | The address of the spender |
|
||||
| `amount` | `string` | `undefined` | amount of ERC20 tokens (always expressed as wei) |
|
||||
| `force` | `boolean` | `false` | if true, will overwrite any previous allowence. Else, will check if allowence is enough and will not send a transaction if it's not needed |
|
||||
| `estimateGas?` | `G` | `undefined` | if true, returns the estimate gas cost for calling the method |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/TokenUtils.ts:63](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/TokenUtils.ts#L63)
|
||||
|
||||
___
|
||||
|
||||
### balance
|
||||
|
||||
▸ **balance**(`signer`, `tokenAddress`, `account`, `tokenDecimals?`): `Promise`<`string`\>
|
||||
|
||||
Get balance for any Datatoken
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `signer` | `Signer` | The signer object |
|
||||
| `tokenAddress` | `string` | The address of the token |
|
||||
| `account` | `string` | The address of the caller |
|
||||
| `tokenDecimals?` | `number` | optional number of decimals of the token |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/TokenUtils.ts:163](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/TokenUtils.ts#L163)
|
||||
|
||||
___
|
||||
|
||||
### decimals
|
||||
|
||||
▸ **decimals**(`signer`, `tokenAddress`): `Promise`<`number`\>
|
||||
|
||||
Get decimals for any Datatoken
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `signer` | `Signer` | The signer object |
|
||||
| `tokenAddress` | `string` | The address of the token |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`number`\>
|
||||
|
||||
Number of decimals of the token
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/TokenUtils.ts:198](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/TokenUtils.ts#L198)
|
||||
|
||||
___
|
||||
|
||||
### downloadFile
|
||||
|
||||
▸ **downloadFile**(`url`, `index?`): `Promise`<[`DownloadResponse`](interfaces/DownloadResponse.md)\>
|
||||
|
||||
Triggers a file download from the specified URL when called from a browser context.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `url` | `string` | The URL of the file to download |
|
||||
| `index?` | `number` | The file index |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`DownloadResponse`](interfaces/DownloadResponse.md)\>
|
||||
|
||||
- A Promise that resolves when the file has been downloaded
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/FetchHelper.ts:35](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/FetchHelper.ts#L35)
|
||||
|
||||
___
|
||||
|
||||
### downloadFileBrowser
|
||||
|
||||
▸ **downloadFileBrowser**(`url`): `Promise`<`void`\>
|
||||
|
||||
Triggers a file download from the specified URL when called from a browser context.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `url` | `string` | The URL of the file to download |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
- A Promise that resolves when the file has been downloaded
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/FetchHelper.ts:9](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/FetchHelper.ts#L9)
|
||||
|
||||
___
|
||||
|
||||
### generateDid
|
||||
|
||||
▸ **generateDid**(`nftAddress`, `chainId`): `string`
|
||||
|
||||
Generates a valid DID
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `nftAddress` | `string` | The NFT address |
|
||||
| `chainId` | `number` | The chain ID |
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
- The DID
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/DdoHelpers.ts:10](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/DdoHelpers.ts#L10)
|
||||
|
||||
___
|
||||
|
||||
### generateDtName
|
||||
|
||||
▸ **generateDtName**(`wordList?`): `Object`
|
||||
|
||||
This function generates a datatoken name and symbol from a given word list.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `wordList?` | `Object` | An object containing an array of nouns and adjectives. |
|
||||
| `wordList.adjectives` | `string`[] | An array of adjectives. |
|
||||
| `wordList.nouns` | `string`[] | An array of nouns. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Object`
|
||||
|
||||
Returns an object containing the generated name and symbol. Produces e.g. "Endemic Jellyfish Token" & "ENDJEL-45"
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `name` | `string` |
|
||||
| `symbol` | `string` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/DatatokenName.ts:10](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/DatatokenName.ts#L10)
|
||||
|
||||
___
|
||||
|
||||
### getErrorMessage
|
||||
|
||||
▸ **getErrorMessage**(`error`): `string`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `error` | `Object` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/ProviderErrors.ts:77](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/ProviderErrors.ts#L77)
|
||||
|
||||
___
|
||||
|
||||
### getEventFromTx
|
||||
|
||||
▸ **getEventFromTx**(`txReceipt`, `eventName`): `any`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `txReceipt` | `any` |
|
||||
| `eventName` | `any` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`any`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/ContractUtils.ts:96](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/ContractUtils.ts#L96)
|
||||
|
||||
___
|
||||
|
||||
### getFairGasPrice
|
||||
|
||||
▸ **getFairGasPrice**(`signer`, `gasFeeMultiplier`): `Promise`<`string`\>
|
||||
|
||||
Asynchronous function that returns a fair gas price based on the current gas price and a multiplier.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `signer` | `Signer` | The signer object to use for fetching the current gas price. |
|
||||
| `gasFeeMultiplier` | `number` | The multiplier to apply to the current gas price. If not provided, the current gas price is returned as a string. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
A Promise that resolves to a string representation of the fair gas price.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/ContractUtils.ts:30](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/ContractUtils.ts#L30)
|
||||
|
||||
___
|
||||
|
||||
### getHash
|
||||
|
||||
▸ **getHash**(`data`): `string`
|
||||
|
||||
Returns the SHA256 hash of the input data
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `data` | `any` | The input data |
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
- The SHA256 hash of the input data
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/DdoHelpers.ts:21](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/DdoHelpers.ts#L21)
|
||||
|
||||
___
|
||||
|
||||
### getTokenDecimals
|
||||
|
||||
▸ **getTokenDecimals**(`signer`, `token`): `Promise`<`any`\>
|
||||
|
||||
Asynchronous function that returns the number of decimal places for a given token.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `signer` | `Signer` | The signer object to use for fetching the token decimals. |
|
||||
| `token` | `string` | The address of the token contract. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
A Promise that resolves to the number of decimal places for the token.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/ContractUtils.ts:46](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/ContractUtils.ts#L46)
|
||||
|
||||
___
|
||||
|
||||
### sendTx
|
||||
|
||||
▸ **sendTx**(`estGas`, `signer`, `gasFeeMultiplier`, `functionToSend`, `...args`): `Promise`<`providers.TransactionResponse`\>
|
||||
|
||||
Send the transation on chain
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `estGas` | `BigNumber` | estimated gas for the transaction |
|
||||
| `signer` | `Signer` | signer object |
|
||||
| `gasFeeMultiplier` | `number` | number represinting the multiplier we apply to gas fees |
|
||||
| `functionToSend` | `ContractFunction`<`any`\> | function that we need to send |
|
||||
| `...args` | `any`[] | arguments of the function |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`providers.TransactionResponse`\>
|
||||
|
||||
transaction receipt
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/ContractUtils.ts:111](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/ContractUtils.ts#L111)
|
||||
|
||||
___
|
||||
|
||||
### setContractDefaults
|
||||
|
||||
▸ **setContractDefaults**(`contract`, `config`): `Contract`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `contract` | `Contract` |
|
||||
| `config` | [`Config`](classes/Config.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Contract`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/ContractUtils.ts:10](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/ContractUtils.ts#L10)
|
||||
|
||||
___
|
||||
|
||||
### signHash
|
||||
|
||||
▸ **signHash**(`signer`, `message`): `Promise`<{ `r`: `string` ; `s`: `string` ; `v`: `string` }\>
|
||||
|
||||
Signs the hash of a message using the provided signer.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `signer` | `Signer` | The signer to use for signing the hash. |
|
||||
| `message` | `string` | The message to sign. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<{ `r`: `string` ; `s`: `string` ; `v`: `string` }\>
|
||||
|
||||
- A Promise that resolves to the signature of the hash of the message.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/SignatureUtils.ts:9](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/SignatureUtils.ts#L9)
|
||||
|
||||
___
|
||||
|
||||
### sleep
|
||||
|
||||
▸ **sleep**(`ms`): `Promise`<`unknown`\>
|
||||
|
||||
Simple blocking sleep function
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `ms` | `number` | Number of miliseconds to wait |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`unknown`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/General.ts:5](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/General.ts#L5)
|
||||
|
||||
___
|
||||
|
||||
### transfer
|
||||
|
||||
▸ **transfer**<`G`\>(`signer`, `config`, `tokenAddress`, `recipient`, `amount`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
Moves amount tokens from the caller’s account to recipient.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `G` | extends `boolean` = ``false`` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `signer` | `Signer` | The signer object |
|
||||
| `config` | [`Config`](classes/Config.md) | The config object |
|
||||
| `tokenAddress` | `string` | The address of the token |
|
||||
| `recipient` | `string` | The address of the tokens receiver |
|
||||
| `amount` | `string` | amount of ERC20 Datatokens (not as wei) |
|
||||
| `estimateGas?` | `G` | if true returns the gas estimate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReceiptOrEstimate`](modules.md#receiptorestimate)<`G`\>\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/TokenUtils.ts:111](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/TokenUtils.ts#L111)
|
||||
|
||||
___
|
||||
|
||||
### unitsToAmount
|
||||
|
||||
▸ **unitsToAmount**(`signer`, `token`, `amount`, `tokenDecimals?`): `Promise`<`string`\>
|
||||
|
||||
Converts an amount of units to tokens
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `signer` | `Signer` | The signer object to use. |
|
||||
| `token` | `string` | The token to convert |
|
||||
| `amount` | `string` | The amount of units to convert |
|
||||
| `tokenDecimals?` | `number` | The number of decimals in the token |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
- The converted amount in tokens
|
||||
|
||||
#### Defined in
|
||||
|
||||
[utils/ContractUtils.ts:59](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/ContractUtils.ts#L59)
|
File diff suppressed because it is too large
Load Diff
16
package.json
16
package.json
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@oceanprotocol/lib",
|
||||
"source": "./src/index.ts",
|
||||
"version": "2.7.0",
|
||||
"version": "3.0.0-next.5",
|
||||
"description": "JavaScript client library for Ocean Protocol",
|
||||
"main": "./dist/lib.js",
|
||||
"umd:main": "dist/lib.umd.js",
|
||||
|
@ -22,6 +22,7 @@
|
|||
"format": "prettier --parser typescript --ignore-path .gitignore --write '**/*.{js,jsx,ts,tsx}'",
|
||||
"type-check": "npm run build:metadata && tsc --noEmit",
|
||||
"doc:json": "node ./scripts/typedoc.js",
|
||||
"docs": "typedoc --options typedoc.json --plugin typedoc-plugin-markdown",
|
||||
"run": "ts-node",
|
||||
"release": "release-it --non-interactive",
|
||||
"changelog": "auto-changelog -p",
|
||||
|
@ -29,12 +30,13 @@
|
|||
"mocha": "TS_NODE_PROJECT='./test/tsconfig.json' mocha --config=test/.mocharc.json --node-env=test --exit",
|
||||
"test": "npm run lint && npm run test:unit:cover && npm run test:integration:cover",
|
||||
"test:unit": "npm run mocha -- 'test/unit/**/*.test.ts'",
|
||||
"test:integration": "npm run mocha -- 'test/integration/**/*.test.ts'",
|
||||
"test:unit:cover": "nyc --report-dir coverage/unit npm run test:unit",
|
||||
"test:integration": "npm run mocha -- 'test/integration/**/*.test.ts'",
|
||||
"test:integration:cover": "nyc --report-dir coverage/integration --no-clean npm run test:integration",
|
||||
"create:guide": "./scripts/createCodeExamples.sh test/integration/CodeExamples.test.ts",
|
||||
"create:guidec2d": "./scripts/createCodeExamples.sh test/integration/ComputeExamples.test.ts",
|
||||
"commit:guides": "./scripts/commitChanges.sh"
|
||||
"commit:guides": "./scripts/commitChanges.sh",
|
||||
"commit:docs": "./scripts/updateDocs.sh"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -52,13 +54,10 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@oceanprotocol/contracts": "^1.1.8",
|
||||
"bignumber.js": "^9.1.0",
|
||||
"cross-fetch": "^3.1.5",
|
||||
"crypto-js": "^4.1.1",
|
||||
"decimal.js": "^10.4.1",
|
||||
"web3-core": "^1.8.1",
|
||||
"web3-eth-contract": "^1.8.1",
|
||||
"web3": "^1.8.1"
|
||||
"ethers": "^5.7.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@truffle/hdwallet-provider": "^2.0.14",
|
||||
|
@ -89,7 +88,8 @@
|
|||
"source-map-support": "^0.5.19",
|
||||
"ts-node": "^10.9.1",
|
||||
"ts-node-register": "^1.0.0",
|
||||
"typedoc": "0.23.19",
|
||||
"typedoc": "^0.24.6",
|
||||
"typedoc-plugin-markdown": "^3.15.2",
|
||||
"typescript": "^4.7.4"
|
||||
},
|
||||
"nyc": {
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
# Create updated documentation
|
||||
npm run docs
|
||||
|
||||
# Stage the file, commit and push
|
||||
git status
|
||||
git add ./docs
|
||||
git commit -m "Updating documentation"
|
||||
branch=${GITHUB_HEAD_REF#refs/heads/}
|
||||
echo Pushing changes to branch: ${branch}
|
||||
git push origin HEAD:${branch} --force
|
|
@ -0,0 +1,29 @@
|
|||
export type AbiType = 'function' | 'constructor' | 'event' | 'fallback'
|
||||
export type StateMutabilityType = 'pure' | 'view' | 'nonpayable' | 'payable'
|
||||
|
||||
export interface AbiInput {
|
||||
name: string
|
||||
type: string
|
||||
indexed?: boolean
|
||||
components?: AbiInput[]
|
||||
internalType?: string
|
||||
}
|
||||
|
||||
export interface AbiOutput {
|
||||
name: string
|
||||
type: string
|
||||
components?: AbiOutput[]
|
||||
internalType?: string
|
||||
}
|
||||
|
||||
export interface AbiItem {
|
||||
anonymous?: boolean
|
||||
constant?: boolean
|
||||
inputs?: AbiInput[]
|
||||
name?: string
|
||||
outputs?: AbiOutput[]
|
||||
payable?: boolean
|
||||
stateMutability?: StateMutabilityType
|
||||
type: AbiType
|
||||
gas?: number
|
||||
}
|
|
@ -2,7 +2,7 @@ import { ConsumerParameter } from './ConsumerParameter'
|
|||
|
||||
export interface MetadataAlgorithm {
|
||||
/**
|
||||
* Language used to implement the software.
|
||||
* Programming language used to implement the software.
|
||||
* @type {string}
|
||||
*/
|
||||
language?: string
|
||||
|
@ -47,6 +47,12 @@ export interface MetadataAlgorithm {
|
|||
* @type {string}
|
||||
*/
|
||||
checksum: string
|
||||
|
||||
/**
|
||||
* Array of objects describing the consumer parameters
|
||||
* @type {ConsumerParameter[]}
|
||||
*/
|
||||
consumerParameters?: ConsumerParameter[]
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -133,7 +139,7 @@ export interface Metadata {
|
|||
contentLanguage?: string
|
||||
|
||||
/**
|
||||
* Information about asset of typealgorithm
|
||||
* Information about asset of type algorithm. Required for algorithm assets.
|
||||
* @type {MetadataAlgorithm}
|
||||
*/
|
||||
algorithm?: MetadataAlgorithm
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { AbiItem } from 'web3-utils'
|
||||
import { AbiItem } from './Contracts'
|
||||
|
||||
interface FileTypeHeaders {
|
||||
[key: string]: string
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import { TransactionReceipt } from 'web3-core'
|
||||
|
||||
import { BigNumber, providers } from 'ethers'
|
||||
export type ReceiptOrEstimate<G extends boolean = false> = G extends false
|
||||
? TransactionReceipt
|
||||
? providers.TransactionResponse
|
||||
: BigNumber
|
||||
export type ReceiptOrDecimal<G extends boolean = false> = G extends false
|
||||
? providers.TransactionResponse
|
||||
: number
|
||||
|
|
|
@ -5,6 +5,7 @@ export * from './DDO/Metadata'
|
|||
export * from './DDO/ConsumerParameter'
|
||||
export * from './DDO/Service'
|
||||
export * from './Asset'
|
||||
export * from './Contracts'
|
||||
export * from './File'
|
||||
export * from './FileInfo'
|
||||
export * from './Compute'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { AbiItem } from 'web3-utils/types'
|
||||
import { AbiItem } from '../@types'
|
||||
import { LogLevel } from '../utils'
|
||||
|
||||
export class Config {
|
||||
|
|
|
@ -31,9 +31,14 @@ export const configHelperNetworks: Config[] = [
|
|||
...configHelperNetworksBase,
|
||||
chainId: 8996,
|
||||
network: 'development',
|
||||
metadataCacheUri: 'http://172.15.0.5:5000', // use http://127.0.0.1:5000/ if running on macOS
|
||||
providerUri: 'http://172.15.0.4:8030', // use http://127.0.0.1:8030/ if running on macOS
|
||||
subgraphUri: 'https://172.15.0.15:8000' // use http://127.0.0.1:9000/ if running on macOS
|
||||
// comment th following configs if running on macOS
|
||||
metadataCacheUri: 'http://172.15.0.5:5000',
|
||||
providerUri: 'http://172.15.0.4:8030',
|
||||
subgraphUri: 'https://172.15.0.15:8000'
|
||||
// uncomment the following configs if running on macOS
|
||||
// metadataCacheUri: 'http://127.0.0.1:5000',
|
||||
// providerUri: 'http://127.0.0.1:8030/',
|
||||
// subgraphUri: 'http://127.0.0.1:9000/'
|
||||
},
|
||||
{
|
||||
...configHelperNetworksBase,
|
||||
|
@ -200,6 +205,12 @@ export class ConfigHelper {
|
|||
return configAddresses
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the config object for a specific network supported by the oceanprotocol stack
|
||||
* @param {string | number} network the network's chainId or name
|
||||
* @param {string} infuraProjectId optional infura project id that will replace the configs node URI
|
||||
* @return {Config} Config obhjedct
|
||||
*/
|
||||
public getConfig(network: string | number, infuraProjectId?: string): Config {
|
||||
const filterBy = typeof network === 'string' ? 'network' : 'chainId'
|
||||
let config = configHelperNetworks.find((c) => c[filterBy] === network)
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
import Web3 from 'web3'
|
||||
import { AbiItem } from 'web3-utils'
|
||||
import { TransactionReceipt } from 'web3-eth'
|
||||
import { ethers, Signer } from 'ethers'
|
||||
import Decimal from 'decimal.js'
|
||||
import ERC20Template from '@oceanprotocol/contracts/artifacts/contracts/templates/ERC20Template.sol/ERC20Template.json'
|
||||
import ERC20TemplateEnterprise from '@oceanprotocol/contracts/artifacts/contracts/templates/ERC20TemplateEnterprise.sol/ERC20TemplateEnterprise.json'
|
||||
import { amountToUnits, sendTx, calculateEstimatedGas, ZERO_ADDRESS } from '../utils'
|
||||
import { amountToUnits, sendTx, ZERO_ADDRESS } from '../utils'
|
||||
import {
|
||||
AbiItem,
|
||||
ConsumeMarketFee,
|
||||
FreOrderParams,
|
||||
FreCreationParams,
|
||||
|
@ -21,63 +20,62 @@ import { Config } from '../config'
|
|||
import { SmartContract } from './SmartContract'
|
||||
|
||||
export class Datatoken extends SmartContract {
|
||||
public abiEnterprise: AbiItem | AbiItem[]
|
||||
public abiEnterprise: AbiItem[]
|
||||
public nft: Nft
|
||||
|
||||
getDefaultAbi(): AbiItem | AbiItem[] {
|
||||
getDefaultAbi() {
|
||||
return ERC20Template.abi as AbiItem[]
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiate ERC20 Datatokens
|
||||
* @param {AbiItem | AbiItem[]} datatokensAbi
|
||||
* @param {Web3} web3
|
||||
* Instantiate Datatoken class
|
||||
* @param {Signer} signer The signer object.
|
||||
* @param {string | number} [network] Network id or name
|
||||
* @param {Config} [config] The configuration object.
|
||||
* @param {AbiItem[]} [abi] ABI array of the smart contract
|
||||
* @param {AbiItem[]} abiEnterprise Enterprise ABI array of the smart contract
|
||||
*/
|
||||
constructor(
|
||||
web3: Web3,
|
||||
signer: Signer,
|
||||
network?: string | number,
|
||||
config?: Config,
|
||||
abi?: AbiItem | AbiItem[],
|
||||
abiEnterprise?: AbiItem | AbiItem[]
|
||||
abi?: AbiItem[],
|
||||
abiEnterprise?: AbiItem[]
|
||||
) {
|
||||
super(web3, network, config, abi)
|
||||
super(signer, network, config, abi)
|
||||
this.abiEnterprise = abiEnterprise || (ERC20TemplateEnterprise.abi as AbiItem[])
|
||||
this.nft = new Nft(this.web3)
|
||||
this.nft = new Nft(this.signer)
|
||||
}
|
||||
|
||||
/**
|
||||
* Approve
|
||||
* Approves a spender to spend a certain amount of datatokens.
|
||||
* @param {String} dtAddress Datatoken address
|
||||
* @param {String} spender Spender address
|
||||
* @param {string} amount Number of datatokens, as number. Will be converted to wei
|
||||
* @param {String} address User adress
|
||||
* @return {Promise<ReceiptOrEstimate>} trxReceipt
|
||||
* @param {Boolean} estimateGas if True, return gas estimate
|
||||
* @return {Promise<ReceiptOrEstimate>}
|
||||
*/
|
||||
public async approve<G extends boolean = false>(
|
||||
dtAddress: string,
|
||||
spender: string,
|
||||
amount: string,
|
||||
address: string,
|
||||
estimateGas?: G
|
||||
): Promise<ReceiptOrEstimate<G>> {
|
||||
const dtContract = this.getContract(dtAddress)
|
||||
|
||||
const estGas = await calculateEstimatedGas(
|
||||
address,
|
||||
dtContract.methods.approve,
|
||||
const estGas = await dtContract.estimateGas.approve(
|
||||
spender,
|
||||
this.web3.utils.toWei(amount)
|
||||
amountToUnits(null, null, amount, 18)
|
||||
)
|
||||
if (estimateGas) return <ReceiptOrEstimate<G>>estGas
|
||||
|
||||
const trxReceipt = await sendTx(
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
estGas,
|
||||
this.signer,
|
||||
this.config?.gasFeeMultiplier,
|
||||
dtContract.methods.approve,
|
||||
dtContract.approve,
|
||||
spender,
|
||||
this.web3.utils.toWei(amount)
|
||||
amountToUnits(null, null, amount, 18)
|
||||
)
|
||||
return <ReceiptOrEstimate<G>>trxReceipt
|
||||
}
|
||||
|
@ -86,9 +84,9 @@ export class Datatoken extends SmartContract {
|
|||
* Creates a new FixedRateExchange setup.
|
||||
* @param {String} dtAddress Datatoken address
|
||||
* @param {String} address Caller address
|
||||
* @param {String} fixedPriceAddress
|
||||
* @param {FixedRateParams} fixedRateParams
|
||||
* @return {Promise<ReceiptOrEstimate>} transactionId
|
||||
* @param {FixedRateParams} fixedRateParams The parameters required to create a fixed-rate exchange contract.
|
||||
* @param {Boolean} estimateGas if True, return gas estimate
|
||||
* @return {Promise<ReceiptOrEstimate>}
|
||||
*/
|
||||
public async createFixedRate<G extends boolean = false>(
|
||||
dtAddress: string,
|
||||
|
@ -106,9 +104,7 @@ export class Datatoken extends SmartContract {
|
|||
|
||||
// should check DatatokenDeployer role using NFT level ..
|
||||
|
||||
const estGas = await calculateEstimatedGas(
|
||||
address,
|
||||
dtContract.methods.createFixedRate,
|
||||
const estGas = await dtContract.estimateGas.createFixedRate(
|
||||
fixedRateParams.fixedRateAddress,
|
||||
[
|
||||
fixedRateParams.baseTokenAddress,
|
||||
|
@ -127,11 +123,10 @@ export class Datatoken extends SmartContract {
|
|||
if (estimateGas) return <ReceiptOrEstimate<G>>estGas
|
||||
|
||||
const trxReceipt = await sendTx(
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
estGas,
|
||||
this.signer,
|
||||
this.config?.gasFeeMultiplier,
|
||||
dtContract.methods.createFixedRate,
|
||||
dtContract.createFixedRate,
|
||||
fixedRateParams.fixedRateAddress,
|
||||
[
|
||||
fixedRateParams.baseTokenAddress,
|
||||
|
@ -154,8 +149,9 @@ export class Datatoken extends SmartContract {
|
|||
* Creates a new Dispenser
|
||||
* @param {String} dtAddress Datatoken address
|
||||
* @param {String} address Caller address
|
||||
* @param {String} dispenserAddress ispenser contract address
|
||||
* @param {String} dispenserParams
|
||||
* @param {String} dispenserAddress Dispenser contract address
|
||||
* @param {DispenserParams} dispenserParams The parameters required to create a dispenser contract.
|
||||
* @param {Boolean} estimateGas if True, return gas estimate
|
||||
* @return {Promise<ReceiptOrEstimate>} transactionId
|
||||
*/
|
||||
public async createDispenser<G extends boolean = false>(
|
||||
|
@ -177,9 +173,7 @@ export class Datatoken extends SmartContract {
|
|||
|
||||
// should check DatatokenDeployer role using NFT level ..
|
||||
|
||||
const estGas = await calculateEstimatedGas(
|
||||
address,
|
||||
dtContract.methods.createDispenser,
|
||||
const estGas = await dtContract.estimateGas.createDispenser(
|
||||
dispenserAddress,
|
||||
dispenserParams.maxTokens,
|
||||
dispenserParams.maxBalance,
|
||||
|
@ -189,11 +183,10 @@ export class Datatoken extends SmartContract {
|
|||
if (estimateGas) return <ReceiptOrEstimate<G>>estGas
|
||||
|
||||
const trxReceipt = await sendTx(
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
estGas,
|
||||
this.signer,
|
||||
this.config?.gasFeeMultiplier,
|
||||
dtContract.methods.createDispenser,
|
||||
dtContract.createDispenser,
|
||||
dispenserAddress,
|
||||
dispenserParams.maxTokens,
|
||||
dispenserParams.maxBalance,
|
||||
|
@ -204,11 +197,12 @@ export class Datatoken extends SmartContract {
|
|||
}
|
||||
|
||||
/**
|
||||
* Mint
|
||||
* Mints datatokens
|
||||
* @param {String} dtAddress Datatoken address
|
||||
* @param {String} address Minter address
|
||||
* @param {String} amount Number of datatokens, as number. Will be converted to wei
|
||||
* @param {String} toAddress only if toAddress is different from the minter
|
||||
* @param {Boolean} estimateGas if True, return gas estimate
|
||||
* @return {Promise<ReceiptOrEstimate>} transactionId
|
||||
*/
|
||||
public async mint<G extends boolean = false>(
|
||||
|
@ -226,22 +220,19 @@ export class Datatoken extends SmartContract {
|
|||
|
||||
const capAvailble = await this.getCap(dtAddress)
|
||||
if (new Decimal(capAvailble).gte(amount)) {
|
||||
const estGas = await calculateEstimatedGas(
|
||||
address,
|
||||
dtContract.methods.mint,
|
||||
const estGas = await dtContract.estimateGas.mint(
|
||||
toAddress || address,
|
||||
this.web3.utils.toWei(amount)
|
||||
amountToUnits(null, null, amount, 18)
|
||||
)
|
||||
if (estimateGas) return <ReceiptOrEstimate<G>>estGas
|
||||
|
||||
const trxReceipt = await sendTx(
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
estGas,
|
||||
this.signer,
|
||||
this.config?.gasFeeMultiplier,
|
||||
dtContract.methods.mint,
|
||||
dtContract.mint,
|
||||
toAddress || address,
|
||||
this.web3.utils.toWei(amount)
|
||||
amountToUnits(null, null, amount, 18)
|
||||
)
|
||||
return <ReceiptOrEstimate<G>>trxReceipt
|
||||
} else {
|
||||
|
@ -253,8 +244,9 @@ export class Datatoken extends SmartContract {
|
|||
* Add Minter for an ERC20 Datatoken
|
||||
* only DatatokenDeployer can succeed
|
||||
* @param {String} dtAddress Datatoken address
|
||||
* @param {String} address User address
|
||||
* @param {String} minter User which is going to be a Minter
|
||||
* @param {String} address caller address
|
||||
* @param {String} minter address which is going to be a Minter
|
||||
* @param {Boolean} estimateGas if True, return gas estimate
|
||||
* @return {Promise<ReceiptOrEstimate>} transactionId
|
||||
*/
|
||||
public async addMinter<G extends boolean = false>(
|
||||
|
@ -269,19 +261,14 @@ export class Datatoken extends SmartContract {
|
|||
throw new Error(`Caller is not DatatokenDeployer`)
|
||||
}
|
||||
// Estimate gas cost for addMinter method
|
||||
const estGas = await calculateEstimatedGas(
|
||||
address,
|
||||
dtContract.methods.addMinter,
|
||||
minter
|
||||
)
|
||||
const estGas = await dtContract.estimateGas.addMinter(minter)
|
||||
if (estimateGas) return <ReceiptOrEstimate<G>>estGas
|
||||
|
||||
const trxReceipt = await sendTx(
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
estGas,
|
||||
this.signer,
|
||||
this.config?.gasFeeMultiplier,
|
||||
dtContract.methods.addMinter,
|
||||
dtContract.addMinter,
|
||||
minter
|
||||
)
|
||||
|
||||
|
@ -292,10 +279,10 @@ export class Datatoken extends SmartContract {
|
|||
* Revoke Minter permission for an ERC20 Datatoken
|
||||
* only DatatokenDeployer can succeed
|
||||
* @param {String} dtAddress Datatoken address
|
||||
* @param {String} address User address
|
||||
* @param {String} minter User which will be removed from Minter permission
|
||||
* @param {Contract} contractInstance optional contract instance
|
||||
* @return {Promise<any>}
|
||||
* @param {String} address caller address
|
||||
* @param {String} minter address which will have removed the Minter permission
|
||||
* @param {Boolean} estimateGas if True, return gas estimate
|
||||
* @return {Promise<ReceiptOrEstimate>}
|
||||
*/
|
||||
public async removeMinter<G extends boolean = false>(
|
||||
dtAddress: string,
|
||||
|
@ -309,19 +296,14 @@ export class Datatoken extends SmartContract {
|
|||
throw new Error(`Caller is not DatatokenDeployer`)
|
||||
}
|
||||
|
||||
const estGas = await calculateEstimatedGas(
|
||||
address,
|
||||
dtContract.methods.removeMinter,
|
||||
minter
|
||||
)
|
||||
const estGas = await dtContract.estimateGas.removeMinter(minter)
|
||||
if (estimateGas) return <ReceiptOrEstimate<G>>estGas
|
||||
|
||||
const trxReceipt = await sendTx(
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
estGas,
|
||||
this.signer,
|
||||
this.config?.gasFeeMultiplier,
|
||||
dtContract.methods.removeMinter,
|
||||
dtContract.removeMinter,
|
||||
minter
|
||||
)
|
||||
|
||||
|
@ -329,11 +311,12 @@ export class Datatoken extends SmartContract {
|
|||
}
|
||||
|
||||
/**
|
||||
* Add addPaymentManager (can set who's going to collect fee when consuming orders)
|
||||
* Adds a payment manager on a datatoken to a desired address.(can set who's going to collect fee when consuming orders)
|
||||
* only DatatokenDeployer can succeed
|
||||
* @param {String} dtAddress Datatoken address
|
||||
* @param {String} address User address
|
||||
* @param {String} paymentManager User which is going to be a Minter
|
||||
* @param {String} address Caller address
|
||||
* @param {String} paymentManager The address of the payment manager
|
||||
* @param {Boolean} estimateGas if True, return gas estimate
|
||||
* @return {Promise<ReceiptOrEstimate>} transactionId
|
||||
*/
|
||||
public async addPaymentManager<G extends boolean = false>(
|
||||
|
@ -348,19 +331,14 @@ export class Datatoken extends SmartContract {
|
|||
throw new Error(`Caller is not DatatokenDeployer`)
|
||||
}
|
||||
|
||||
const estGas = await calculateEstimatedGas(
|
||||
address,
|
||||
dtContract.methods.addPaymentManager,
|
||||
paymentManager
|
||||
)
|
||||
const estGas = await dtContract.estimateGas.addPaymentManager(paymentManager)
|
||||
if (estimateGas) return <ReceiptOrEstimate<G>>estGas
|
||||
|
||||
const trxReceipt = await sendTx(
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
estGas,
|
||||
this.signer,
|
||||
this.config?.gasFeeMultiplier,
|
||||
dtContract.methods.addPaymentManager,
|
||||
dtContract.addPaymentManager,
|
||||
paymentManager
|
||||
)
|
||||
|
||||
|
@ -373,6 +351,7 @@ export class Datatoken extends SmartContract {
|
|||
* @param {String} dtAddress Datatoken address
|
||||
* @param {String} address User address
|
||||
* @param {String} paymentManager User which will be removed from paymentManager permission
|
||||
* @param {Boolean} estimateGas if True, return gas estimate
|
||||
* @return {Promise<ReceiptOrEstimate>} trxReceipt
|
||||
*/
|
||||
public async removePaymentManager<G extends boolean = false>(
|
||||
|
@ -387,19 +366,14 @@ export class Datatoken extends SmartContract {
|
|||
throw new Error(`Caller is not DatatokenDeployer`)
|
||||
}
|
||||
|
||||
const estGas = await calculateEstimatedGas(
|
||||
address,
|
||||
dtContract.methods.removePaymentManager,
|
||||
paymentManager
|
||||
)
|
||||
const estGas = await dtContract.estimateGas.removePaymentManager(paymentManager)
|
||||
if (estimateGas) return <ReceiptOrEstimate<G>>estGas
|
||||
|
||||
const trxReceipt = await sendTx(
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
estGas,
|
||||
this.signer,
|
||||
this.config?.gasFeeMultiplier,
|
||||
dtContract.methods.removePaymentManager,
|
||||
dtContract.removePaymentManager,
|
||||
paymentManager
|
||||
)
|
||||
|
||||
|
@ -410,9 +384,10 @@ export class Datatoken extends SmartContract {
|
|||
* This function allows to set a new PaymentCollector (receives DT when consuming)
|
||||
* If not set the paymentCollector is the NFT Owner
|
||||
* only NFT owner can call
|
||||
* @param dtAddress datatoken address
|
||||
* @param dtAddress Datatoken address
|
||||
* @param address Caller address
|
||||
* @param paymentCollector User to be set as new payment collector
|
||||
* @param {Boolean} estimateGas if True, return gas estimate
|
||||
* @return {Promise<ReceiptOrEstimate>} trxReceipt
|
||||
*/
|
||||
public async setPaymentCollector<G extends boolean = false>(
|
||||
|
@ -433,101 +408,94 @@ export class Datatoken extends SmartContract {
|
|||
throw new Error(`Caller is not Fee Manager, owner or Datatoken Deployer`)
|
||||
}
|
||||
|
||||
const estGas = await calculateEstimatedGas(
|
||||
address,
|
||||
dtContract.methods.setPaymentCollector,
|
||||
paymentCollector
|
||||
)
|
||||
const estGas = await dtContract.estimateGas.setPaymentCollector(paymentCollector)
|
||||
if (estimateGas) return <ReceiptOrEstimate<G>>estGas
|
||||
|
||||
const trxReceipt = await sendTx(
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
estGas,
|
||||
this.signer,
|
||||
this.config?.gasFeeMultiplier,
|
||||
dtContract.methods.setPaymentCollector,
|
||||
dtContract.setPaymentCollector,
|
||||
paymentCollector
|
||||
)
|
||||
return <ReceiptOrEstimate<G>>trxReceipt
|
||||
}
|
||||
|
||||
/** getPaymentCollector - It returns the current paymentCollector
|
||||
/**
|
||||
* getPaymentCollector - It returns the current paymentCollector
|
||||
* @param dtAddress datatoken address
|
||||
* @return {Promise<string>}
|
||||
*/
|
||||
public async getPaymentCollector(dtAddress: string): Promise<string> {
|
||||
const dtContract = this.getContract(dtAddress)
|
||||
const paymentCollector = await dtContract.methods.getPaymentCollector().call()
|
||||
const paymentCollector = await dtContract.getPaymentCollector()
|
||||
return paymentCollector
|
||||
}
|
||||
|
||||
/**
|
||||
* Transfer as number from address to toAddress
|
||||
* Transfer tokens(as number) from address to toAddress
|
||||
* @param {String} dtAddress Datatoken address
|
||||
* @param {String} toAddress Receiver address
|
||||
* @param {String} amount Number of datatokens, as number. To be converted to wei.
|
||||
* @param {String} address User adress
|
||||
* @param {String} amount Number of datatokens, as number. Will be converted to wei.
|
||||
* @param {Boolean} estimateGas if True, return gas estimate
|
||||
* @return {Promise<ReceiptOrEstimate>} transactionId
|
||||
*/
|
||||
public async transfer(
|
||||
public async transfer<G extends boolean = false>(
|
||||
dtAddress: string,
|
||||
toAddress: string,
|
||||
amount: string,
|
||||
address: string
|
||||
): Promise<TransactionReceipt> {
|
||||
const weiAmount = this.web3.utils.toWei(amount)
|
||||
return this.transferWei(dtAddress, toAddress, weiAmount, address)
|
||||
estimateGas?: G
|
||||
): Promise<ReceiptOrEstimate<G>> {
|
||||
return this.transferWei(
|
||||
dtAddress,
|
||||
toAddress,
|
||||
await amountToUnits(null, null, amount, 18),
|
||||
estimateGas
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Transfer in wei from address to toAddress
|
||||
* @param {String} dtAddress Datatoken address
|
||||
* @param {String} toAddress Receiver address
|
||||
* @param {String} amount Number of datatokens, as number. Expressed as wei
|
||||
* @param {String} address User adress
|
||||
* @param {String} amount Number of datatokens (number) expressed as wei
|
||||
* @param {Boolean} estimateGas if True, return gas estimate
|
||||
* @return {Promise<ReceiptOrEstimate>} transactionId
|
||||
*/
|
||||
public async transferWei<G extends boolean = false>(
|
||||
dtAddress: string,
|
||||
toAddress: string,
|
||||
amount: string,
|
||||
address: string,
|
||||
estimateGas?: G
|
||||
): Promise<ReceiptOrEstimate<G>> {
|
||||
const dtContract = this.getContract(dtAddress)
|
||||
|
||||
const estGas = await calculateEstimatedGas(
|
||||
address,
|
||||
dtContract.methods.transfer,
|
||||
toAddress,
|
||||
amount
|
||||
)
|
||||
const estGas = await dtContract.estimateGas.transfer(toAddress, amount)
|
||||
if (estimateGas) return <ReceiptOrEstimate<G>>estGas
|
||||
|
||||
const trxReceipt = await sendTx(
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
estGas,
|
||||
this.signer,
|
||||
this.config?.gasFeeMultiplier,
|
||||
dtContract.methods.transfer,
|
||||
dtContract.transfer,
|
||||
toAddress,
|
||||
amount
|
||||
)
|
||||
return <ReceiptOrEstimate<G>>trxReceipt
|
||||
}
|
||||
|
||||
/** Start Order: called by payer or consumer prior ordering a service consume on a marketplace.
|
||||
/**
|
||||
* Start Order: called by payer or consumer prior ordering a service consume on a marketplace.
|
||||
* @param {String} dtAddress Datatoken address
|
||||
* @param {String} address User address which calls
|
||||
* @param {String} consumer Consumer Address
|
||||
* @param {Number} serviceIndex Service index in the metadata
|
||||
* @param {providerFees} providerFees provider fees
|
||||
* @param {consumeMarketFee} ConsumeMarketFee consume market fees
|
||||
* @param {Boolean} estimateGas if True, return gas estimate
|
||||
* @return {Promise<ReceiptOrEstimate>} string
|
||||
*/
|
||||
public async startOrder<G extends boolean = false>(
|
||||
dtAddress: string,
|
||||
address: string,
|
||||
consumer: string,
|
||||
serviceIndex: number,
|
||||
providerFees: ProviderFees,
|
||||
|
@ -543,9 +511,7 @@ export class Datatoken extends SmartContract {
|
|||
}
|
||||
}
|
||||
|
||||
const estGas = await calculateEstimatedGas(
|
||||
address,
|
||||
dtContract.methods.startOrder,
|
||||
const estGas = await dtContract.estimateGas.startOrder(
|
||||
consumer,
|
||||
serviceIndex,
|
||||
providerFees,
|
||||
|
@ -554,11 +520,10 @@ export class Datatoken extends SmartContract {
|
|||
if (estimateGas) return <ReceiptOrEstimate<G>>estGas
|
||||
|
||||
const trxReceipt = await sendTx(
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
estGas,
|
||||
this.signer,
|
||||
this.config?.gasFeeMultiplier,
|
||||
dtContract.methods.startOrder,
|
||||
dtContract.startOrder,
|
||||
consumer,
|
||||
serviceIndex,
|
||||
providerFees,
|
||||
|
@ -567,112 +532,100 @@ export class Datatoken extends SmartContract {
|
|||
return <ReceiptOrEstimate<G>>trxReceipt
|
||||
}
|
||||
|
||||
/** Reuse Order: called by payer or consumer having a valid order, but with expired provider access.
|
||||
/**
|
||||
* Reuse Order: called by payer or consumer having a valid order, but with expired provider access.
|
||||
* Pays the provider fee again, but it will not require a new datatoken payment
|
||||
* Requires previous approval of provider fee.
|
||||
* @param {String} dtAddress Datatoken address
|
||||
* @param {String} address User address which calls
|
||||
* @param {String} orderTxId previous valid order
|
||||
* @param {providerFees} providerFees provider fees
|
||||
* @param {Boolean} estimateGas if True, return gas estimate
|
||||
* @return {Promise<ReceiptOrEstimate>} string
|
||||
*/
|
||||
public async reuseOrder<G extends boolean = false>(
|
||||
dtAddress: string,
|
||||
address: string,
|
||||
orderTxId: string,
|
||||
providerFees: ProviderFees,
|
||||
estimateGas?: G
|
||||
): Promise<ReceiptOrEstimate<G>> {
|
||||
const dtContract = this.getContract(dtAddress)
|
||||
|
||||
const estGas = await calculateEstimatedGas(
|
||||
address,
|
||||
dtContract.methods.reuseOrder,
|
||||
orderTxId,
|
||||
providerFees
|
||||
)
|
||||
const estGas = await dtContract.estimateGas.reuseOrder(orderTxId, providerFees)
|
||||
if (estimateGas) return <ReceiptOrEstimate<G>>estGas
|
||||
|
||||
const trxReceipt = await sendTx(
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
estGas,
|
||||
this.signer,
|
||||
this.config?.gasFeeMultiplier,
|
||||
dtContract.methods.reuseOrder,
|
||||
dtContract.reuseOrder,
|
||||
orderTxId,
|
||||
providerFees
|
||||
)
|
||||
return <ReceiptOrEstimate<G>>trxReceipt
|
||||
}
|
||||
|
||||
/** Buys 1 DT from the FRE and then startsOrder, while burning that DT
|
||||
/**
|
||||
* Buys 1 DT from the FRE and then startsOrder, while burning that DT
|
||||
* @param {String} dtAddress Datatoken address
|
||||
* @param {String} address User address which calls
|
||||
* @param {OrderParams} orderParams Consumer Address
|
||||
* @param {FreParams} freParams Amount of tokens that is going to be transfered
|
||||
* @param {OrderParams} orderParams The parameters required to place an order.
|
||||
* @param {FreParams} freParams The parameters required to buy from a fixed-rate exchange.
|
||||
* @param {Boolean} estimateGas if True, return gas estimate
|
||||
* @return {Promise<ReceiptOrEstimate>}
|
||||
*/
|
||||
public async buyFromFreAndOrder<G extends boolean = false>(
|
||||
dtAddress: string,
|
||||
address: string,
|
||||
orderParams: OrderParams,
|
||||
freParams: FreOrderParams,
|
||||
estimateGas?: G
|
||||
): Promise<ReceiptOrEstimate<G>> {
|
||||
const dtContract = this.getContract(dtAddress, null, this.abiEnterprise)
|
||||
const dtContract = this.getContract(dtAddress, this.abiEnterprise)
|
||||
|
||||
const freContractParams = await this.getFreOrderParams(freParams)
|
||||
|
||||
const estGas = await calculateEstimatedGas(
|
||||
address,
|
||||
dtContract.methods.buyFromFreAndOrder,
|
||||
const estGas = await dtContract.estimateGas.buyFromFreAndOrder(
|
||||
orderParams,
|
||||
freContractParams
|
||||
)
|
||||
if (estimateGas) return <ReceiptOrEstimate<G>>estGas
|
||||
|
||||
const trxReceipt = await sendTx(
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
estGas,
|
||||
this.signer,
|
||||
this.config?.gasFeeMultiplier,
|
||||
dtContract.methods.buyFromFreAndOrder,
|
||||
dtContract.buyFromFreAndOrder,
|
||||
orderParams,
|
||||
freContractParams
|
||||
)
|
||||
return <ReceiptOrEstimate<G>>trxReceipt
|
||||
}
|
||||
|
||||
/** Gets DT from dispenser and then startsOrder, while burning that DT
|
||||
/**
|
||||
* Gets 1 DT from dispenser and then startsOrder, while burning that DT
|
||||
* @param {String} dtAddress Datatoken address
|
||||
* @param {String} address User address which calls
|
||||
* @param {OrderParams} orderParams
|
||||
* @param {String} dispenserContract
|
||||
* @param {OrderParams} orderParams - The parameters required to place an order.
|
||||
* @param {String} dispenserContract dispenser address
|
||||
* @param {Boolean} estimateGas if True, return gas estimate
|
||||
* @return {Promise<ReceiptOrEstimate>}
|
||||
*/
|
||||
public async buyFromDispenserAndOrder<G extends boolean = false>(
|
||||
dtAddress: string,
|
||||
address: string,
|
||||
orderParams: OrderParams,
|
||||
dispenserContract: string,
|
||||
estimateGas?: G
|
||||
): Promise<ReceiptOrEstimate<G>> {
|
||||
const dtContract = this.getContract(dtAddress, null, this.abiEnterprise)
|
||||
const dtContract = this.getContract(dtAddress, this.abiEnterprise)
|
||||
|
||||
const estGas = await calculateEstimatedGas(
|
||||
address,
|
||||
dtContract.methods.buyFromDispenserAndOrder,
|
||||
const estGas = await dtContract.estimateGas.buyFromDispenserAndOrder(
|
||||
orderParams,
|
||||
dispenserContract
|
||||
)
|
||||
if (estimateGas) return <ReceiptOrEstimate<G>>estGas
|
||||
|
||||
const trxReceipt = await sendTx(
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
estGas,
|
||||
this.signer,
|
||||
this.config?.gasFeeMultiplier,
|
||||
dtContract.methods.buyFromDispenserAndOrder,
|
||||
dtContract.buyFromDispenserAndOrder,
|
||||
orderParams,
|
||||
dispenserContract
|
||||
)
|
||||
|
@ -685,6 +638,7 @@ export class Datatoken extends SmartContract {
|
|||
* @param {String} dtAddress Datatoken address
|
||||
* @param {String} address User address
|
||||
* @param {String} value Data to be stored into 725Y standard
|
||||
* @param {Boolean} estimateGas if True, return gas estimate
|
||||
* @return {Promise<ReceiptOrEstimate>} transactionId
|
||||
*/
|
||||
public async setData<G extends boolean = false>(
|
||||
|
@ -699,21 +653,16 @@ export class Datatoken extends SmartContract {
|
|||
|
||||
const dtContract = this.getContract(dtAddress)
|
||||
|
||||
const valueHex = this.web3.utils.asciiToHex(value)
|
||||
const valueHex = ethers.utils.hexlify(ethers.utils.toUtf8Bytes(value))
|
||||
|
||||
const estGas = await calculateEstimatedGas(
|
||||
address,
|
||||
dtContract.methods.setData,
|
||||
valueHex
|
||||
)
|
||||
const estGas = await dtContract.estimateGas.setData(valueHex)
|
||||
if (estimateGas) return <ReceiptOrEstimate<G>>estGas
|
||||
|
||||
const trxReceipt = await sendTx(
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
estGas,
|
||||
this.signer,
|
||||
this.config?.gasFeeMultiplier,
|
||||
dtContract.methods.setData,
|
||||
dtContract.setData,
|
||||
valueHex
|
||||
)
|
||||
|
||||
|
@ -723,8 +672,9 @@ export class Datatoken extends SmartContract {
|
|||
/**
|
||||
* Clean Datatoken level Permissions (minters, paymentManager and reset the paymentCollector) for an ERC20 Datatoken
|
||||
* Only NFT Owner (at 721 level) can call it.
|
||||
* @param dtAddress Datatoken address where we want to clean permissions
|
||||
* @param address User adress
|
||||
* @param {string} dtAddress Datatoken address where we want to clean permissions
|
||||
* @param {string} address User adress
|
||||
* @param {Boolean} estimateGas if True, return gas estimate
|
||||
* @return {Promise<ReceiptOrEstimate>} transactionId
|
||||
*/
|
||||
public async cleanPermissions<G extends boolean = false>(
|
||||
|
@ -737,24 +687,21 @@ export class Datatoken extends SmartContract {
|
|||
}
|
||||
const dtContract = this.getContract(dtAddress)
|
||||
|
||||
const estGas = await calculateEstimatedGas(
|
||||
address,
|
||||
dtContract.methods.cleanPermissions
|
||||
)
|
||||
const estGas = await dtContract.estimateGas.cleanPermissions()
|
||||
if (estimateGas) return <ReceiptOrEstimate<G>>estGas
|
||||
|
||||
const trxReceipt = await sendTx(
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
estGas,
|
||||
this.signer,
|
||||
this.config?.gasFeeMultiplier,
|
||||
dtContract.methods.cleanPermissions
|
||||
dtContract.cleanPermissions
|
||||
)
|
||||
|
||||
return <ReceiptOrEstimate<G>>trxReceipt
|
||||
}
|
||||
|
||||
/** Returns ERC20 Datatoken user's permissions for a datatoken
|
||||
/**
|
||||
* Returns ERC20 Datatoken user's permissions for a datatoken
|
||||
* @param {String} dtAddress Datatoken adress
|
||||
* @param {String} address user adress
|
||||
* @return {Promise<DatatokenRoles>}
|
||||
|
@ -764,68 +711,74 @@ export class Datatoken extends SmartContract {
|
|||
address: string
|
||||
): Promise<DatatokenRoles> {
|
||||
const dtContract = this.getContract(dtAddress)
|
||||
const roles = await dtContract.methods.permissions(address).call()
|
||||
const roles = await dtContract.permissions(address)
|
||||
return roles
|
||||
}
|
||||
|
||||
/** Returns the Datatoken capital
|
||||
/**
|
||||
* Returns the Datatoken cap
|
||||
* @param {String} dtAddress Datatoken adress
|
||||
* @return {Promise<string>}
|
||||
*/
|
||||
public async getCap(dtAddress: string): Promise<string> {
|
||||
const dtContract = this.getContract(dtAddress)
|
||||
const cap = await dtContract.methods.cap().call()
|
||||
return this.web3.utils.fromWei(cap)
|
||||
const cap = await dtContract.cap()
|
||||
return await this.unitsToAmount(null, cap, 18)
|
||||
}
|
||||
|
||||
/** It returns the token decimals, how many supported decimal points
|
||||
/**
|
||||
* It returns the token decimals, how many supported decimal points
|
||||
* @param {String} dtAddress Datatoken adress
|
||||
* @return {Promise<number>}
|
||||
*/
|
||||
public async getDecimals(dtAddress: string): Promise<string> {
|
||||
public async getDecimals(dtAddress: string): Promise<number> {
|
||||
const dtContract = this.getContract(dtAddress)
|
||||
const decimals = await dtContract.methods.decimals().call()
|
||||
const decimals = await dtContract.decimals()
|
||||
return decimals
|
||||
}
|
||||
|
||||
/** It returns the token symbol
|
||||
/**
|
||||
* It returns the token symbol
|
||||
* @param {String} dtAddress Datatoken adress
|
||||
* @return {Promise<number>}
|
||||
*/
|
||||
public async getSymbol(dtAddress: string): Promise<string> {
|
||||
const dtContract = this.getContract(dtAddress)
|
||||
const symbol = await dtContract.methods.symbol().call()
|
||||
const symbol = await dtContract.symbol()
|
||||
return symbol
|
||||
}
|
||||
|
||||
/** It returns the name of the token
|
||||
/**
|
||||
* It returns the name of the token
|
||||
* @param {String} dtAddress Datatoken adress
|
||||
* @return {Promise<number>}
|
||||
*/
|
||||
public async getName(dtAddress: string): Promise<string> {
|
||||
const dtContract = this.getContract(dtAddress)
|
||||
const name = await dtContract.methods.name().call()
|
||||
const name = await dtContract.name()
|
||||
return name
|
||||
}
|
||||
|
||||
/** It returns the token decimals, how many supported decimal points
|
||||
/**
|
||||
* It returns the token decimals, how many supported decimal points
|
||||
* @param {String} dtAddress Datatoken adress
|
||||
* @return {Promise<number>}
|
||||
*/
|
||||
public async getNFTAddress(dtAddress: string): Promise<string> {
|
||||
const dtContract = this.getContract(dtAddress)
|
||||
const nftAddress = await dtContract.methods.getERC721Address().call()
|
||||
const nftAddress = await dtContract.getERC721Address()
|
||||
return nftAddress
|
||||
}
|
||||
|
||||
/** Returns true if address has deployERC20 role
|
||||
/**
|
||||
* Returns true if address has deployERC20 role
|
||||
* @param {String} dtAddress Datatoken adress
|
||||
* @param {String} dtAddress Datatoken adress
|
||||
* @return {Promise<boolean>}
|
||||
*/
|
||||
public async isDatatokenDeployer(dtAddress: string, address: string): Promise<boolean> {
|
||||
const dtContract = this.getContract(dtAddress)
|
||||
const isDatatokenDeployer = await dtContract.methods.isERC20Deployer(address).call()
|
||||
const isDatatokenDeployer = await dtContract.isERC20Deployer(address)
|
||||
return isDatatokenDeployer
|
||||
}
|
||||
|
||||
|
@ -836,20 +789,20 @@ export class Datatoken extends SmartContract {
|
|||
* @return {Promise<String>} balance Number of datatokens. Will be converted from wei
|
||||
*/
|
||||
public async balance(datatokenAddress: string, address: string): Promise<string> {
|
||||
const dtContract = this.getContract(datatokenAddress, address)
|
||||
const balance = await dtContract.methods.balanceOf(address).call()
|
||||
return this.web3.utils.fromWei(balance)
|
||||
const dtContract = this.getContract(datatokenAddress)
|
||||
const balance = await dtContract.balanceOf(address)
|
||||
return await this.unitsToAmount(null, balance, 18)
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev setPublishingMarketFee
|
||||
* Only publishMarketFeeAddress can call it
|
||||
* This function allows to set the fee required by the publisherMarket
|
||||
* Allows to set the fee required by the publisherMarket
|
||||
* only publishMarketFeeAddress can call it
|
||||
* @param {string} datatokenAddress Datatoken adress
|
||||
* @param {string} publishMarketFeeAddress new publish Market Fee Address
|
||||
* @param {string} publishMarketFeeToken new publish Market Fee Token
|
||||
* @param {string} publishMarketFeeAmount new fee amount
|
||||
* @param {String} address user adress
|
||||
* @param {Boolean} estimateGas if True, return gas estimate
|
||||
*/
|
||||
public async setPublishingMarketFee<G extends boolean = false>(
|
||||
datatokenAddress: string,
|
||||
|
@ -859,14 +812,12 @@ export class Datatoken extends SmartContract {
|
|||
address: string,
|
||||
estimateGas?: G
|
||||
): Promise<ReceiptOrEstimate<G>> {
|
||||
const dtContract = this.getContract(datatokenAddress, address)
|
||||
const mktFeeAddress = (await dtContract.methods.getPublishingMarketFee().call())[0]
|
||||
const dtContract = this.getContract(datatokenAddress)
|
||||
const mktFeeAddress = (await dtContract.getPublishingMarketFee())[0]
|
||||
if (mktFeeAddress !== address) {
|
||||
throw new Error(`Caller is not the Publishing Market Fee Address`)
|
||||
}
|
||||
const estGas = await calculateEstimatedGas(
|
||||
address,
|
||||
dtContract.methods.setPublishingMarketFee,
|
||||
const estGas = await dtContract.estimateGas.setPublishingMarketFee(
|
||||
publishMarketFeeAddress,
|
||||
publishMarketFeeToken,
|
||||
publishMarketFeeAmount
|
||||
|
@ -874,11 +825,10 @@ export class Datatoken extends SmartContract {
|
|||
if (estimateGas) return <ReceiptOrEstimate<G>>estGas
|
||||
|
||||
const trxReceipt = await sendTx(
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
estGas,
|
||||
this.signer,
|
||||
this.config?.gasFeeMultiplier,
|
||||
dtContract.methods.setPublishingMarketFee,
|
||||
dtContract.setPublishingMarketFee,
|
||||
publishMarketFeeAddress,
|
||||
publishMarketFeeToken,
|
||||
publishMarketFeeAmount
|
||||
|
@ -888,24 +838,20 @@ export class Datatoken extends SmartContract {
|
|||
}
|
||||
|
||||
/**
|
||||
* @dev getPublishingMarketFee
|
||||
* Get publishingMarket Fee
|
||||
* This function allows to get the current fee set by the publishing market
|
||||
* Returns the current fee set by the publishing market
|
||||
* @param {String} datatokenAddress Datatoken adress
|
||||
* @param {String} address user adress
|
||||
* @return {Promise<PublishingMarketFee>} Current fee set by the publishing market
|
||||
*/
|
||||
public async getPublishingMarketFee(
|
||||
datatokenAddress: string,
|
||||
address: string
|
||||
datatokenAddress: string
|
||||
): Promise<PublishingMarketFee> {
|
||||
const dtContract = this.getContract(datatokenAddress, address)
|
||||
const dtContract = this.getContract(datatokenAddress)
|
||||
|
||||
const publishingMarketFee = await dtContract.methods.getPublishingMarketFee().call()
|
||||
const publishingMarketFee = await dtContract.getPublishingMarketFee()
|
||||
const returnValues = {
|
||||
publishMarketFeeAddress: publishingMarketFee[0],
|
||||
publishMarketFeeToken: publishingMarketFee[1],
|
||||
publishMarketFeeAmount: publishingMarketFee[2]
|
||||
publishMarketFeeAmount: publishingMarketFee[2].toString()
|
||||
}
|
||||
return returnValues
|
||||
}
|
||||
|
@ -915,13 +861,13 @@ export class Datatoken extends SmartContract {
|
|||
exchangeContract: freParams.exchangeContract,
|
||||
exchangeId: freParams.exchangeId,
|
||||
maxBaseTokenAmount: await amountToUnits(
|
||||
this.web3,
|
||||
this.signer,
|
||||
freParams.baseTokenAddress,
|
||||
freParams.maxBaseTokenAmount,
|
||||
freParams.baseTokenDecimals
|
||||
),
|
||||
swapMarketFee: await amountToUnits(
|
||||
this.web3,
|
||||
this.signer,
|
||||
freParams.baseTokenAddress,
|
||||
freParams.swapMarketFee,
|
||||
freParams.baseTokenDecimals
|
||||
|
|
|
@ -1,29 +1,34 @@
|
|||
import { AbiItem } from 'web3-utils'
|
||||
import Decimal from 'decimal.js'
|
||||
import DispenserAbi from '@oceanprotocol/contracts/artifacts/contracts/pools/dispenser/Dispenser.sol/Dispenser.json'
|
||||
import { calculateEstimatedGas, sendTx } from '../utils'
|
||||
import { sendTx } from '../utils'
|
||||
import { Datatoken } from './Datatoken'
|
||||
import { SmartContractWithAddress } from './SmartContractWithAddress'
|
||||
import { DispenserToken, ReceiptOrEstimate } from '../@types'
|
||||
import { DispenserToken, ReceiptOrEstimate, AbiItem } from '../@types'
|
||||
|
||||
export class Dispenser extends SmartContractWithAddress {
|
||||
getDefaultAbi(): AbiItem | AbiItem[] {
|
||||
getDefaultAbi() {
|
||||
return DispenserAbi.abi as AbiItem[]
|
||||
}
|
||||
|
||||
/**
|
||||
* Get information about a datatoken dispenser
|
||||
* @param {String} dtAddress
|
||||
* @return {Promise<FixedPricedExchange>} Exchange details
|
||||
* @return {Promise<DispenserToken>}
|
||||
*/
|
||||
public async status(dtAdress: string): Promise<DispenserToken> {
|
||||
const status: DispenserToken = await this.contract.methods.status(dtAdress).call()
|
||||
if (!status) {
|
||||
const status2: DispenserToken = await this.contract.status(dtAdress)
|
||||
if (!status2) {
|
||||
throw new Error(`Np dispenser found for the given datatoken address`)
|
||||
}
|
||||
status.maxTokens = this.web3.utils.fromWei(status.maxTokens)
|
||||
status.maxBalance = this.web3.utils.fromWei(status.maxBalance)
|
||||
status.balance = this.web3.utils.fromWei(status.balance)
|
||||
const status = {
|
||||
active: status2[0],
|
||||
owner: status2[1],
|
||||
isMinter: status2[2],
|
||||
maxTokens: await this.unitsToAmount(null, status2[3], 18),
|
||||
maxBalance: await this.unitsToAmount(null, status2[4], 18),
|
||||
balance: await this.unitsToAmount(null, status2[5], 18),
|
||||
allowedSwapper: status2[6]
|
||||
}
|
||||
return status
|
||||
}
|
||||
|
||||
|
@ -34,6 +39,7 @@ export class Dispenser extends SmartContractWithAddress {
|
|||
* @param {String} maxTokens max tokens to dispense
|
||||
* @param {String} maxBalance max balance of requester
|
||||
* @param {String} allowedSwapper only account that can ask tokens. set address(0) if not required
|
||||
* @param {Boolean} estimateGas if True, return gas estimate
|
||||
* @return {Promise<ReceiptOrEstimate>} transactionId
|
||||
*/
|
||||
public async create<G extends boolean = false>(
|
||||
|
@ -44,12 +50,10 @@ export class Dispenser extends SmartContractWithAddress {
|
|||
allowedSwapper: string,
|
||||
estimateGas?: G
|
||||
): Promise<ReceiptOrEstimate<G>> {
|
||||
const estGas = await calculateEstimatedGas(
|
||||
address,
|
||||
this.contract.methods.create,
|
||||
const estGas = await this.contract.estimateGas.create(
|
||||
dtAddress,
|
||||
this.web3.utils.toWei(maxTokens),
|
||||
this.web3.utils.toWei(maxBalance),
|
||||
this.amountToUnits(null, maxTokens, 18),
|
||||
this.amountToUnits(null, maxBalance, 18),
|
||||
address,
|
||||
allowedSwapper
|
||||
)
|
||||
|
@ -57,14 +61,13 @@ export class Dispenser extends SmartContractWithAddress {
|
|||
|
||||
// Call createFixedRate contract method
|
||||
const trxReceipt = await sendTx(
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
estGas,
|
||||
this.signer,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.create,
|
||||
this.contract.create,
|
||||
dtAddress,
|
||||
this.web3.utils.toWei(maxTokens),
|
||||
this.web3.utils.toWei(maxBalance),
|
||||
this.amountToUnits(null, maxTokens, 18),
|
||||
this.amountToUnits(null, maxBalance, 18),
|
||||
address,
|
||||
allowedSwapper
|
||||
)
|
||||
|
@ -73,38 +76,34 @@ export class Dispenser extends SmartContractWithAddress {
|
|||
}
|
||||
|
||||
/**
|
||||
* Activates a new dispener.
|
||||
* Activates a dispener.
|
||||
* @param {String} dtAddress refers to datatoken address.
|
||||
* @param {Number} maxTokens max amount of tokens to dispense
|
||||
* @param {Number} maxBalance max balance of user. If user balance is >, then dispense will be rejected
|
||||
* @param {String} address User address (must be owner of the datatoken)
|
||||
* @param {Boolean} estimateGas if True, return gas estimate
|
||||
* @return {Promise<ReceiptOrEstimate>} TransactionReceipt
|
||||
*/
|
||||
public async activate<G extends boolean = false>(
|
||||
dtAddress: string,
|
||||
maxTokens: string,
|
||||
maxBalance: string,
|
||||
address: string,
|
||||
estimateGas?: G
|
||||
): Promise<ReceiptOrEstimate<G>> {
|
||||
const estGas = await calculateEstimatedGas(
|
||||
address,
|
||||
this.contract.methods.activate,
|
||||
const estGas = await this.contract.estimateGas.activate(
|
||||
dtAddress,
|
||||
this.web3.utils.toWei(maxTokens),
|
||||
this.web3.utils.toWei(maxBalance)
|
||||
this.amountToUnits(null, maxTokens, 18),
|
||||
this.amountToUnits(null, maxBalance, 18)
|
||||
)
|
||||
if (estimateGas) return <ReceiptOrEstimate<G>>estGas
|
||||
|
||||
const trxReceipt = await sendTx(
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
estGas,
|
||||
this.signer,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.activate,
|
||||
this.contract.activate,
|
||||
dtAddress,
|
||||
this.web3.utils.toWei(maxTokens),
|
||||
this.web3.utils.toWei(maxBalance)
|
||||
this.amountToUnits(null, maxTokens, 18),
|
||||
this.amountToUnits(null, maxBalance, 18)
|
||||
)
|
||||
|
||||
return <ReceiptOrEstimate<G>>trxReceipt
|
||||
|
@ -113,27 +112,21 @@ export class Dispenser extends SmartContractWithAddress {
|
|||
/**
|
||||
* Deactivate an existing dispenser.
|
||||
* @param {String} dtAddress refers to datatoken address.
|
||||
* @param {String} address User address (must be owner of the datatoken)
|
||||
* @param {Boolean} estimateGas if True, return gas estimate
|
||||
* @return {Promise<ReceiptOrEstimate>} TransactionReceipt
|
||||
*/
|
||||
public async deactivate<G extends boolean = false>(
|
||||
dtAddress: string,
|
||||
address: string,
|
||||
estimateGas?: G
|
||||
): Promise<ReceiptOrEstimate<G>> {
|
||||
const estGas = await calculateEstimatedGas(
|
||||
address,
|
||||
this.contract.methods.deactivate,
|
||||
dtAddress
|
||||
)
|
||||
const estGas = await this.contract.estimateGas.deactivate(dtAddress)
|
||||
if (estimateGas) return <ReceiptOrEstimate<G>>estGas
|
||||
|
||||
const trxReceipt = await sendTx(
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
estGas,
|
||||
this.signer,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.deactivate,
|
||||
this.contract.deactivate,
|
||||
dtAddress
|
||||
)
|
||||
|
||||
|
@ -141,32 +134,28 @@ export class Dispenser extends SmartContractWithAddress {
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets a new allowedSwapper.
|
||||
* @param {String} dtAddress refers to datatoken address.
|
||||
* @param {String} address User address (must be owner of the datatoken)
|
||||
* @param {String} newAllowedSwapper refers to the new allowedSwapper
|
||||
* @return {Promise<ReceiptOrEstimate>} TransactionReceipt
|
||||
* Sets a new allowed swapper.
|
||||
* @param {String} dtAddress Datatoken address.
|
||||
* @param {String} newAllowedSwapper The address of the new allowed swapper.
|
||||
* @param {Boolean} estimateGas if True, return gas estimate
|
||||
* @return {Promise<ReceiptOrEstimate>}
|
||||
*/
|
||||
public async setAllowedSwapper<G extends boolean = false>(
|
||||
dtAddress: string,
|
||||
address: string,
|
||||
newAllowedSwapper: string,
|
||||
estimateGas?: G
|
||||
): Promise<ReceiptOrEstimate<G>> {
|
||||
const estGas = await calculateEstimatedGas(
|
||||
address,
|
||||
this.contract.methods.setAllowedSwapper,
|
||||
const estGas = await this.contract.estimateGas.setAllowedSwapper(
|
||||
dtAddress,
|
||||
newAllowedSwapper
|
||||
)
|
||||
if (estimateGas) return <ReceiptOrEstimate<G>>estGas
|
||||
|
||||
const trxReceipt = await sendTx(
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
estGas,
|
||||
this.signer,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.setAllowedSwapper,
|
||||
this.contract.setAllowedSwapper,
|
||||
dtAddress,
|
||||
newAllowedSwapper
|
||||
)
|
||||
|
@ -175,38 +164,34 @@ export class Dispenser extends SmartContractWithAddress {
|
|||
|
||||
/**
|
||||
* Dispense datatokens to caller.
|
||||
* The dispenser must be active, hold enough DT (or be able to mint more)
|
||||
* The dispenser must be active, hold enough datatokens (or be able to mint more)
|
||||
* and respect maxTokens/maxBalance requirements
|
||||
* @param {String} dtAddress refers to datatoken address.
|
||||
* @param {String} address User address
|
||||
* @param {String} amount amount of datatokens required.
|
||||
* @param {String} destination who will receive the tokens
|
||||
* @return {Promise<ReceiptOrEstimate>} TransactionReceipt
|
||||
* @param {String} dtAddress Datatoken address.
|
||||
* @param {String} amount Amount of datatokens required.
|
||||
* @param {String} destination address of tokens receiver
|
||||
* @param {Boolean} estimateGas if True, return gas estimate
|
||||
* @return {Promise<ReceiptOrEstimate>}
|
||||
*/
|
||||
public async dispense<G extends boolean = false>(
|
||||
dtAddress: string,
|
||||
address: string,
|
||||
amount: string = '1',
|
||||
destination: string,
|
||||
estimateGas?: G
|
||||
): Promise<ReceiptOrEstimate<G>> {
|
||||
const estGas = await calculateEstimatedGas(
|
||||
address,
|
||||
this.contract.methods.dispense,
|
||||
const estGas = await this.contract.estimateGas.dispense(
|
||||
dtAddress,
|
||||
this.web3.utils.toWei(amount),
|
||||
this.amountToUnits(null, amount, 18),
|
||||
destination
|
||||
)
|
||||
if (estimateGas) return <ReceiptOrEstimate<G>>estGas
|
||||
|
||||
const trxReceipt = await sendTx(
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
estGas,
|
||||
this.signer,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.dispense,
|
||||
this.contract.dispense,
|
||||
dtAddress,
|
||||
this.web3.utils.toWei(amount),
|
||||
this.amountToUnits(null, amount, 18),
|
||||
destination
|
||||
)
|
||||
return <ReceiptOrEstimate<G>>trxReceipt
|
||||
|
@ -214,28 +199,22 @@ export class Dispenser extends SmartContractWithAddress {
|
|||
|
||||
/**
|
||||
* Withdraw all tokens from the dispenser
|
||||
* @param {String} dtAddress refers to datatoken address.
|
||||
* @param {String} address User address (must be owner of the dispenser)
|
||||
* @return {Promise<ReceiptOrEstimate>} TransactionReceipt
|
||||
* @param {String} dtAddress Datatoken address.
|
||||
* @param {Boolean} estimateGas if True, return gas estimate
|
||||
* @return {Promise<ReceiptOrEstimate>}
|
||||
*/
|
||||
public async ownerWithdraw<G extends boolean = false>(
|
||||
dtAddress: string,
|
||||
address: string,
|
||||
estimateGas?: G
|
||||
): Promise<ReceiptOrEstimate<G>> {
|
||||
const estGas = await calculateEstimatedGas(
|
||||
address,
|
||||
this.contract.methods.ownerWithdraw,
|
||||
dtAddress
|
||||
)
|
||||
const estGas = await this.contract.estimateGas.ownerWithdraw(dtAddress)
|
||||
if (estimateGas) return <ReceiptOrEstimate<G>>estGas
|
||||
|
||||
const trxReceipt = await sendTx(
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
estGas,
|
||||
this.signer,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.ownerWithdraw,
|
||||
this.contract.ownerWithdraw,
|
||||
dtAddress
|
||||
)
|
||||
|
||||
|
@ -244,7 +223,7 @@ export class Dispenser extends SmartContractWithAddress {
|
|||
|
||||
/**
|
||||
* Check if tokens can be dispensed
|
||||
* @param {String} dtAddress
|
||||
* @param {String} dtAddress Datatoken address
|
||||
* @param {String} address User address that will receive datatokens
|
||||
* @param {String} amount amount of datatokens required.
|
||||
* @return {Promise<Boolean>}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue