Squid-js 0.6.4

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<>
src/ocean/Ocean.ts#L31

keeper

Property
Keeper instance.
src/ocean/Ocean.ts#L64

brizo

Property
Brizo instance.
src/ocean/Ocean.ts#L70

aquarius

Property
Aquarius instance.
src/ocean/Ocean.ts#L76

accounts

Property
Ocean account submodule
src/ocean/Ocean.ts#L82

auth

Property
Ocean auth submodule
src/ocean/Ocean.ts#L88

assets

Property
Ocean assets submodule
src/ocean/Ocean.ts#L94

agreements

Property
Ocean agreements submodule
src/ocean/Ocean.ts#L100

secretStore

Property
Ocean secretStore submodule
src/ocean/Ocean.ts#L106

tokens

Property
Ocean tokens submodule
src/ocean/Ocean.ts#L112

versions

Property
Ocean versions submodule
src/ocean/Ocean.ts#L118

utils

Property
Ocean utils submodule
src/ocean/Ocean.ts#L124

OceanAccounts

Account submodule of Ocean Protocol.

getInstance

Method
static
Returns the instance of OceanAccounts.

Parameters

Returns

Promise<>
src/ocean/OceanAccounts.ts#L13

list

Method
Returns the list of accounts.

Returns

Promise<>
src/ocean/OceanAccounts.ts#L26

balance

Method
Return account balance.

Parameters

account

Account instance.

Returns

Promise<>
src/ocean/OceanAccounts.ts#L41

requestTokens

Method
Request tokens for a account.

Parameters

account

Account instance.

amount
number

Token amount.

Returns

Promise<
boolean
>
src/ocean/OceanAccounts.ts#L51

CreateProgressStep

OceanAgreements

Agreements submodule of Ocean Protocol.

getInstance

Method
static
Returns the instance of OceanAgreements.

Parameters

Returns

src/ocean/OceanAgreements.ts#L24

conditions

Property
Agreements Conditions submodule.
src/ocean/OceanAgreements.ts#L40

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

src/ocean/OceanAgreements.ts#L49

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
>
src/ocean/OceanAgreements.ts#L87

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
>
src/ocean/OceanAgreements.ts#L121

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<
>
src/ocean/OceanAgreements.ts#L154

OceanPlatformTechStatus

Account

Account information.

getId

Method

Returns

string
src/ocean/Account.ts#L20

setId

Method

Parameters

id
any

Returns

void
src/ocean/Account.ts#L24

setPassword

Method
Set account password.

Parameters

password
string

Password for account.

Returns

void
src/ocean/Account.ts#L32

getPassword

Method
Returns account password.

Returns

string
src/ocean/Account.ts#L40

setToken

Method
Set account token.

Parameters

token
string

Token for account.

Returns

void
src/ocean/Account.ts#L48

getToken

Method
Returns account token.

Returns

Promise<
string
>
src/ocean/Account.ts#L56

isTokenStored

Method
Returns if account token is stored.

Returns

Promise<
boolean
>
src/ocean/Account.ts#L64

authenticate

Method
Authenticate the account.

Returns

Promise<
void
>
src/ocean/Account.ts#L71

getOceanBalance

Method
Balance of Ocean Token.

Returns

Promise<
number
>
src/ocean/Account.ts#L79

getEtherBalance

Method
Balance of Ether.

Returns

Promise<
number
>
src/ocean/Account.ts#L88

getBalance

Method
Balances of Ether and Ocean Token.

Returns

Promise<>
src/ocean/Account.ts#L100

requestTokens

Method
Request Ocean Tokens.

Parameters

amount

Tokens to be requested.

Returns

Promise<
string
>
src/ocean/Account.ts#L112

getInstance

Method
static

Parameters

args
any[]

Returns

Promise<
any
>
src/Instantiable.abstract.ts#L68

DID

Decentralized ID.

parse

Method
static
Parses a DID from a string.

Parameters

didString

DID in string.

Returns

src/ocean/DID.ts#L14

generate

Method
static
Returns a new DID.

Returns

src/ocean/DID.ts#L36

getDid

Method
Returns the DID.

Returns

string
src/ocean/DID.ts#L54

getId

Method
Returns the ID.

Returns

string
src/ocean/DID.ts#L62

DDO

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

serialize

Method
static
Serializes the DDO object.

Parameters

ddo

Returns

string
src/ddo/DDO.ts#L20

deserialize

Method
static
Deserializes the DDO object.

Parameters

ddoString
string

Returns

src/ddo/DDO.ts#L29

@context

Property
string
src/ddo/DDO.ts#L35

id

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

created

Property
string
src/ddo/DDO.ts#L42

publicKey

Property
src/ddo/DDO.ts#L43

authentication

Property
src/ddo/DDO.ts#L44

service

Property
src/ddo/DDO.ts#L45

shortId

Method

Returns

string
src/ddo/DDO.ts#L56

findServiceById

Method
Finds a service of a DDO by ID.

Parameters

serviceDefinitionId
string

Service ID.

Returns

src/ddo/DDO.ts#L65

findServiceByType

Method
Finds a service of a DDO by type.

Parameters

serviceType
T

Service type.

Returns

src/ddo/DDO.ts#L84

getChecksum

Method
Generate the checksum using the current content.

Returns

string
src/ddo/DDO.ts#L98

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<>
src/ddo/DDO.ts#L122

addChecksum

Method
Generated and adds the checksum.

Returns

void
src/ddo/DDO.ts#L146

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
>
src/ddo/DDO.ts#L162

ServiceAccess

Aquarius

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

getVersionInfo

Method

Returns

Promise<
any
>
src/aquarius/Aquarius.ts#L37

getAccessUrl

Method

Parameters

accessToken
any

payload
any

Returns

Promise<
string
>
src/aquarius/Aquarius.ts#L41

queryMetadata

Method
Search over the DDOs using a query.

Parameters

query

Query to filter the DDOs.

Returns

Promise<>
src/aquarius/Aquarius.ts#L81

queryMetadataByText

Method
Search over the DDOs using a query.

Parameters

query

Query to filter the DDOs.

Returns

Promise<>
src/aquarius/Aquarius.ts#L111

storeDDO

Method
Stores a DDO in Aquarius.

Parameters

ddo

DDO to be stored.

Returns

Promise<>
src/aquarius/Aquarius.ts#L152

retrieveDDO

Method
Retrieves a DDO by DID.

Parameters

did

DID of the asset.

metadataServiceEndpoint?
string

Returns

Promise<>
src/aquarius/Aquarius.ts#L184

retrieveDDOByUrl

Method

Parameters

metadataServiceEndpoint?
string

Returns

Promise<>
src/aquarius/Aquarius.ts#L216

getServiceEndpoint

Method

Parameters

did

Returns

string
src/aquarius/Aquarius.ts#L220

getInstance

Method
static

Parameters

args
any[]

Returns

Promise<
any
>
src/Instantiable.abstract.ts#L68

Brizo

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

getVersionInfo

Method

Returns

Promise<
any
>
src/brizo/Brizo.ts#L22

getPurchaseEndpoint

Method

Returns

string
src/brizo/Brizo.ts#L26

getConsumeEndpoint

Method

Returns

string
src/brizo/Brizo.ts#L30

getEncryptEndpoint

Method

Returns

string
src/brizo/Brizo.ts#L34

getComputeEndpoint

Method

Parameters

pubKey
string

serviceId
string

_notUsed
string

container
string

Returns

string
src/brizo/Brizo.ts#L38

initializeServiceAgreement

Method

Parameters

did
string

serviceAgreementId
string

serviceDefinitionId
string

signature
string

consumerAddress
string

Returns

Promise<
any
>
src/brizo/Brizo.ts#L48

consumeService

Method

Parameters

agreementId
string

serviceEndpoint
string

account

files

destination
string

index
number

Returns

Promise<
string
>
src/brizo/Brizo.ts#L74

encrypt

Method

Parameters

did
string

signature
string

document
any

publisher
string

Returns

Promise<
string
>
src/brizo/Brizo.ts#L113

getInstance

Method
static

Parameters

args
any[]

Returns

Promise<
any
>
src/Instantiable.abstract.ts#L68

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<>
src/keeper/Keeper.ts#L39

connected

Property
Is connected to the correct network or not.
boolean
src/keeper/Keeper.ts#L121

token

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

dispenser

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

didRegistry

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

templateStoreManager

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

agreementStoreManager

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

conditionStoreManager

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

conditions

Property
Conditions instances.
src/keeper/Keeper.ts#L162

templates

Property
Templates instances.
src/keeper/Keeper.ts#L171

utils

Property
Helpers for contracts.
src/keeper/Keeper.ts#L178

getConditionByAddress

Method
Returns a condition by address.

Parameters

address
string

Address of deployed condition.

Returns

src/keeper/Keeper.ts#L189

getTemplateByName

Method
Returns a template by name.

Parameters

name
string

Template name.

src/keeper/Keeper.ts#L200

getTemplateByAddress

Method
Returns a template by address.

Parameters

address
string

Template address.

src/keeper/Keeper.ts#L211

getNetworkId

Method
Returns network id.

Returns

Promise<
number
>
src/keeper/Keeper.ts#L221

getNetworkName

Method
Returns the network by name.

Returns

Promise<
string
>
src/keeper/Keeper.ts#L229

getAllInstances

Method

Returns

src/keeper/Keeper.ts#L260

Web3Provider

getWeb3

Method
static
Returns Web3 instance.

Parameters

config
Partial<>

Returns

Web3
src/keeper/Web3Provider.ts#L9

Config

aquariusUri

Property
Aquarius URL.
string
src/models/Config.ts#L9

brizoUri

Property
Brizo URL.
string
src/models/Config.ts#L15

brizoAddress

Property
Address of Brizo.
string
src/models/Config.ts#L20

nodeUri

Property
Ethereum node URL.
string
src/models/Config.ts#L26

web3Provider

Property
Web3 Provider.
any
src/models/Config.ts#L31

secretStoreUri

Property
Secret Store URL.
string
src/models/Config.ts#L37

verbose

Property
Log level.
src/models/Config.ts#L43

authMessage

Property
Message shown when the user creates its own token.
string
src/models/Config.ts#L49

authTokenExpiration

Property
Token expiration time in ms.
number
src/models/Config.ts#L55

parityUri

Property
string
src/models/Config.ts#L58

threshold

Property
number
src/models/Config.ts#L59

Balance

eth

Property
number
src/models/Balance.ts#L2

ocn

Property
number
src/models/Balance.ts#L3