Squid-js 0.5.6

JavaScript client library for Ocean Protocol

Ocean

Main interface for Ocean Protocol.

getInstance

Method
static
Returns the instance of Ocean.

Parameters

config

Ocean instance configuration.

Returns

Promise<>
ocean/Ocean.ts#L27

keeper

Property
Keeper instance.
ocean/Ocean.ts#L56

brizo

Property
Brizo instance.
ocean/Ocean.ts#L62

aquarius

Property
Aquarius instance.
ocean/Ocean.ts#L68

accounts

Property
Ocean account submodule
ocean/Ocean.ts#L74

assets

Property
Ocean assets submodule
ocean/Ocean.ts#L80

agreements

Property
Ocean agreements submodule
ocean/Ocean.ts#L86

secretStore

Property
Ocean secretStore submodule
ocean/Ocean.ts#L92

tokens

Property
Ocean tokens submodule
ocean/Ocean.ts#L98

utils

Property
Ocean utils submodule
ocean/Ocean.ts#L104

OceanAccounts

Account submodule of Ocean Protocol.

getInstance

Method
static
Returns the instance of OceanAccounts.

Parameters

Returns

Promise<>
ocean/OceanAccounts.ts#L14

list

Method
Returns the list of accounts.

Returns

Promise<>
ocean/OceanAccounts.ts#L25

balance

Method
Return account balance.

Parameters

account

Account instance.

Returns

Promise<>
ocean/OceanAccounts.ts#L38

requestTokens

Method
Request tokens for a account.

Parameters

account

Account instance.

amount
number

Token amount.

Returns

Promise<
boolean
>
ocean/OceanAccounts.ts#L48

OceanAssets

Assets submodule of Ocean Protocol.

getInstance

Method
static
Returns the instance of OceanAssets.

Parameters

Returns

Promise<>
ocean/OceanAssets.ts#L19

resolve

Method
Returns a DDO by DID.

Parameters

did
string

Decentralized ID.

Returns

Promise<>
ocean/OceanAssets.ts#L31

create

Method
Creates a new DDO.

Parameters

metadata

DDO metadata.

publisher

Publisher account.

services

Returns

Promise<>
ocean/OceanAssets.ts#L42

consume

Method

Parameters

agreementId
string

did
string

serviceDefinitionId
string

consumerAccount

resultPath
string

index?
number

Returns

Promise<
string
>
ocean/OceanAssets.ts#L150

order

Method
Start the purchase/order of an asset's service. Starts by signing the service agreement then sends the request to the publisher via the service endpoint (Brizo http service).

Parameters

did
string

Decentralized ID.

serviceDefinitionId
string

Service definition ID.

consumer

Consumer account.

Returns

Promise<
string
>
ocean/OceanAssets.ts#L202

owner

Method
Returns the owner of a asset.

Parameters

did
string

Decentralized ID.

Returns

Promise<
string
>
ocean/OceanAssets.ts#L267

ownerAssets

Method
Returns the assets of a owner.

Parameters

owner
string

Owner address.

Returns

Promise<
string[]
>
ocean/OceanAssets.ts#L285

consumerAssets

Method
Returns the assets of a consumer.

Parameters

consumer
string

Consumer address.

Returns

Promise<
string[]
>
ocean/OceanAssets.ts#L294

query

Method
Search over the assets using a query.

Parameters

query

Query to filter the assets.

Returns

Promise<>
ocean/OceanAssets.ts#L303

OceanAgreements

Agreements submodule of Ocean Protocol.

getInstance

Method
static
Returns the instance of OceanAgreements.

Parameters

Returns

ocean/OceanAgreements.ts#L25

conditions

Property
Agreements Conditions submodule.
ocean/OceanAgreements.ts#L37

prepare

Method
Creates a consumer signature for the specified asset service.

Parameters

did
string

Decentralized ID.

serviceDefinitionId
string

Service definition ID.

consumer

Consumer account.

Returns

ocean/OceanAgreements.ts#L46

send

Method
Submit a service agreement to the publisher to create the agreement on-chain.

Parameters

did
string

Decentralized ID.

agreementId
string

serviceDefinitionId
string

Service definition ID.

signature
string

consumer

Consumer account.

Returns

Promise<
void
>
ocean/OceanAgreements.ts#L79

create

Method
Create a service agreement on-chain. This should be called by the publisher of the asset. Consumer signature will be verified on-chain, but it is recommended to verify the signature in this method before submitting on-chain.

Parameters

did
string

Decentralized ID.

agreementId
string

Service agreement ID.

serviceDefinitionId
string

Service definition ID.

signature
string

Service agreement signature.

consumer

Consumer account.

publisher

Publisher account.

Returns

Promise<
boolean
>
ocean/OceanAgreements.ts#L113

status

Method
Get the status of a service agreement.

Parameters

agreementId
string

Service agreement ID.

extended?
false

Returns a complete status with dependencies.

Returns

Promise<
>
ocean/OceanAgreements.ts#L140

Account

Account information.

getId

Method

Returns

string
ocean/Account.ts#L20

setId

Method

Parameters

id
any

Returns

void
ocean/Account.ts#L24

setPassword

Method
Set account password.

Parameters

password
string

Password for account.

Returns

void
ocean/Account.ts#L32

getPassword

Method
Returns account password.

Returns

string
ocean/Account.ts#L40

getOceanBalance

Method
Balance of Ocean Token.

Returns

Promise<
number
>
ocean/Account.ts#L48

getEtherBalance

Method
Balance of Ether.

Returns

Promise<
number
>
ocean/Account.ts#L57

getBalance

Method
Balances of Ether and Ocean Token.

Returns

Promise<>
ocean/Account.ts#L70

requestTokens

Method
Request Ocean Tokens.

Parameters

amount
number

Tokens to be requested.

Returns

Promise<
number
>
ocean/Account.ts#L82

getPublicKey

Method
Returns the account public key.

Returns

Promise<
string
>
ocean/Account.ts#L99

getInstance

Method
static

Parameters

args
any[]

Returns

Promise<
any
>
Instantiable.abstract.ts#L64

DID

Decentralized ID.

parse

Method
static
Parses a DID from a string.

Parameters

didString
string

DID in string.

Returns

ocean/DID.ts#L15

generate

Method
static
Returns a new DID.

Returns

ocean/DID.ts#L34

getDid

Method
Returns the DID.

Returns

string
ocean/DID.ts#L52

getId

Method
Returns the ID.

Returns

string
ocean/DID.ts#L60

DDO

DID Descriptor Object. Contains all the data related to an asset.

serialize

Method
static
Serializes the DDO object.

Parameters

ddo

Returns

string
ddo/DDO.ts#L21

deserialize

Method
static
Deserializes the DDO object.

Parameters

ddoString
string

Returns

ddo/DDO.ts#L30

@context

Property
string
ddo/DDO.ts#L36

id

Property
DID, descentralized ID.
string
ddo/DDO.ts#L42

created

Property
string
ddo/DDO.ts#L43

publicKey

Property
ddo/DDO.ts#L44

authentication

Property
ddo/DDO.ts#L45

service

Property
ddo/DDO.ts#L46

proof

Property
ddo/DDO.ts#L47

shortId

Method

Returns

string
ddo/DDO.ts#L55

findServiceById

Method
Finds a service of a DDO by ID.

Parameters

serviceDefinitionId
string

Service ID.

Returns

ddo/DDO.ts#L64

findServiceByType

Method
Finds a service of a DDO by type.

Parameters

serviceType
T

Service type.

Returns

ddo/DDO.ts#L79

getChecksum

Method
Generate the checksum using the current content.

Returns

string
ddo/DDO.ts#L91

generateProof

Method
Generates proof using personal sing.

Parameters

ocean

publicKey
string

Public key to be used on personal sign.

password?
string

Password if it's requirted.

Returns

Promise<>
ddo/DDO.ts#L115

addChecksum

Method
Generated and adds the checksum.

Returns

void
ddo/DDO.ts#L131

addProof

Method
Generates and adds a proof using personal sing on the DDO.

Parameters

web3
Web3

Web3 instance.

publicKey
string

Public key to be used on personal sign.

password?
string

Password if it's requirted.

Returns

Promise<
void
>
ddo/DDO.ts#L147

ServiceAccess

Aquarius

Provides a interface with Aquarius. Aquarius provides an off-chain database store for metadata about data assets.

getAccessUrl

Method

Parameters

accessToken
any

payload
any

Returns

Promise<
string
>
aquarius/Aquarius.ts#L38

queryMetadata

Method
Search over the DDOs using a query.

Parameters

query

Query to filter the DDOs.

Returns

Promise<>
aquarius/Aquarius.ts#L65

queryMetadataByText

Method
Search over the DDOs using a query.

Parameters

query

Query to filter the DDOs.

Returns

Promise<>
aquarius/Aquarius.ts#L91

storeDDO

Method
Stores a DDO in Aquarius.

Parameters

ddo

DDO to be stored.

Returns

Promise<>
aquarius/Aquarius.ts#L122

retrieveDDO

Method
Retrieves a DDO by DID.

Parameters

did

DID of the asset.

Returns

Promise<>
aquarius/Aquarius.ts#L149

getServiceEndpoint

Method

Parameters

did

Returns

string
aquarius/Aquarius.ts#L171

getInstance

Method
static

Parameters

args
any[]

Returns

Promise<
any
>
Instantiable.abstract.ts#L64

Brizo

Provides a interface with Brizo. Brizo is the technical component executed by the Publishers allowing to them to provide extended data services.

getPurchaseEndpoint

Method

Returns

string
brizo/Brizo.ts#L26

getConsumeEndpoint

Method

Returns

string
brizo/Brizo.ts#L30

getEncryptEndpoint

Method

Returns

string
brizo/Brizo.ts#L34

getComputeEndpoint

Method

Parameters

pubKey
string

serviceId
string

algo
string

container
string

Returns

string
brizo/Brizo.ts#L38

initializeServiceAgreement

Method

Parameters

did
string

serviceAgreementId
string

serviceDefinitionId
string

signature
string

consumerAddress
string

Returns

Promise<
any
>
brizo/Brizo.ts#L43

consumeService

Method

Parameters

agreementId
string

serviceEndpoint
string

account

files

destination
string

index
number

Returns

Promise<
string
>
brizo/Brizo.ts#L72

encrypt

Method

Parameters

did
string

signedDid
string

document
any

publisher
string

Returns

Promise<
string
>
brizo/Brizo.ts#L105

getInstance

Method
static

Parameters

args
any[]

Returns

Promise<
any
>
Instantiable.abstract.ts#L64

Keeper

Interface with Ocean Keeper contracts. Ocean Keeper implementation where we put the following modules together: - TCRs: users create challenges and resolve them through voting to maintain registries. - Ocean Tokens: the intrinsic tokens circulated inside Ocean network, which is used in the voting of TCRs. - Marketplace: the core marketplace where people can transact with each other with Ocean tokens.

getInstance

Method
static
Returns Keeper instance.

Parameters

Returns

Promise<>
keeper/Keeper.ts#L25

token

Property
Ocean Token smart contract instance.
keeper/Keeper.ts#L80

dispenser

Property
Ocean Market smart contract instance.
keeper/Keeper.ts#L86

didRegistry

Property
DID registry smart contract instance.
keeper/Keeper.ts#L92

templateStoreManager

Property
Template store manager smart contract instance.
keeper/Keeper.ts#L98

agreementStoreManager

Property
Template store manager smart contract instance.
keeper/Keeper.ts#L104

conditionStoreManager

Property
Template store manager smart contract instance.
keeper/Keeper.ts#L110

conditions

Property
Conditions instances.
keeper/Keeper.ts#L115

templates

Property
Templates instances.
keeper/Keeper.ts#L124

utils

Property
Helpers for contracts.
keeper/Keeper.ts#L131

getConditionByAddress

Method
Returns a condition by address.

Parameters

address
string

Address of deployed condition.

Returns

keeper/Keeper.ts#L140

getTemplateByName

Method
Returns a template by name.

Parameters

name
string

Template name.

keeper/Keeper.ts#L150

getTemplateByAddress

Method
Returns a template by address.

Parameters

address
string

Template address.

keeper/Keeper.ts#L160

getNetworkId

Method
Returns network id.

Returns

Promise<
number
>
keeper/Keeper.ts#L169

getNetworkName

Method
Returns the network by name.

Returns

Promise<
string
>
keeper/Keeper.ts#L177

Web3Provider

getWeb3

Method
static
Returns Web3 instance.

Parameters

config
Partial<>

Returns

Web3
keeper/Web3Provider.ts#L10

Config

aquariusUri

Property
string
models/Config.ts#L7

brizoUri

Property
string
models/Config.ts#L11

brizoAddress

Property
string
models/Config.ts#L13

nodeUri

Property
string
models/Config.ts#L17

web3Provider

Property
any
models/Config.ts#L19

secretStoreUri

Property
string
models/Config.ts#L22

verbose

Property
models/Config.ts#L25

Balance

eth

Property
number
models/Balance.ts#L2

ocn

Property
number
models/Balance.ts#L3