Squid-js 0.2.8

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#L42

getAccounts

Method
Returns the list of accounts.

Returns

Promise<>
ocean/Ocean.ts#L71

resolveDID

Method
Deprecated: use resolveAssetDID instead
ocean/Ocean.ts#L86

resolveAssetDID

Method
Returns a DDO by DID.

Parameters

did
string

Decentralized ID.

Returns

Promise<>
ocean/Ocean.ts#L95

registerAsset

Method
Registers a new DDO.

Parameters

metadata

DDO metadata.

publisher

Publicher account.

Returns

Promise<>
ocean/Ocean.ts#L106

signServiceAgreement

Method
Deprecated: use purchaseAssetService instead
ocean/Ocean.ts#L207

purchaseAssetService

Method
Signs a service agreement by DID.

Parameters

did
string

Decentralized ID.

serviceDefinitionId
string

Service definition ID.

consumer

Consumer account.

Returns

Promise<
any
>
ocean/Ocean.ts#L222

executeServiceAgreement

Method
Executes a service agreement.

Parameters

did
string

Decentralized ID.

serviceDefinitionId
string

Service definition ID.

serviceAgreementId
string

Service agreement ID.

serviceAgreementSignature
string

Service agreement signature.

consumer

Consumer account.

publisher

Publisher account.

Returns

ocean/Ocean.ts#L341

searchAssets

Method
Search over the assets using a query.

Parameters

query

Query to filter the assets.

Returns

Promise<
DDO[]
>
ocean/Ocean.ts#L370

searchAssetsByText

Method
Search over the assets using a keyword.

Parameters

text
string

Text to filter the assets.

Returns

Promise<
DDO[]
>
ocean/Ocean.ts#L379

Account

Account information.

getOceanBalance

Method
Balance of Ocean Token.

Returns

Promise<
number
>
ocean/Account.ts#L19

getEtherBalance

Method
Balance of Ether.

Returns

Promise<
number
>
ocean/Account.ts#L27

getBalance

Method
Balances of Ether and Ocean Token.

Returns

Promise<>
ocean/Account.ts#L43

requestTokens

Method
Request Ocean Tokens.

Parameters

amount
number

Tokens to be requested.

Returns

Promise<
number
>
ocean/Account.ts#L60

getPublicKey

Method
Returns the account public key.

Returns

Promise<
string
>
ocean/Account.ts#L77

getId

Method

Returns

string
ocean/OceanBase.ts#L11

setId

Method

Parameters

id
any

Returns

void
ocean/OceanBase.ts#L15

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

ServiceAgreement

signServiceAgreement

Method
static

Parameters

ddo

serviceDefinitionId
string

serviceAgreementId
string

consumer

Returns

Promise<
string
>
ocean/ServiceAgreements/ServiceAgreement.ts#L15

executeServiceAgreement

Method
static

Parameters

did

ddo

serviceDefinitionId
string

serviceAgreementId
string

serviceAgreementHashSignature
string

consumer

publisher

Returns

ocean/ServiceAgreements/ServiceAgreement.ts#L39

payAsset

Method

Parameters

assetId
string

price
number

consumer

Returns

Promise<
boolean
>
ocean/ServiceAgreements/ServiceAgreement.ts#L220

grantAccess

Method

Parameters

assetId
string

documentId
string

publisher

Returns

Promise<
boolean
>
ocean/ServiceAgreements/ServiceAgreement.ts#L232

getStatus

Method

Returns

Promise<
any
>
ocean/ServiceAgreements/ServiceAgreement.ts#L241

getId

Method

Returns

string
ocean/OceanBase.ts#L11

setId

Method

Parameters

id
any

Returns

void
ocean/OceanBase.ts#L15

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#L16

deserialize

Method
static
Deserializes the DDO object.

Parameters

ddoString
string

Returns

ddo/DDO.ts#L25

@context

Property
string
ddo/DDO.ts#L31

id

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

publicKey

Property
ddo/DDO.ts#L37

authentication

Property
ddo/DDO.ts#L38

service

Property
ddo/DDO.ts#L39

findServiceById

Method
Finds a service of a DDO by ID.

Parameters

serviceDefinitionId
string

Service ID.

Returns

ddo/DDO.ts#L58

findServiceByType

Method
Finds a service of a DDO by type.

Parameters

serviceType
string

Service type.

Returns

ddo/DDO.ts#L73

Service

type

Property
string
ddo/Service.ts#L6

serviceDefinitionId

Property
string
ddo/Service.ts#L7

templateId

Property
string
ddo/Service.ts#L8

serviceEndpoint

Property
string
ddo/Service.ts#L9

purchaseEndpoint

Property
string
ddo/Service.ts#L10

description

Property
string
ddo/Service.ts#L11

serviceAgreementContract

Property
ddo/Service.ts#L13

conditions

Property
ddo/Service.ts#L14

AquariusProvider

Provides the Aquarius instance.

setAquarius

Method
static
Set an Aquarius instance.

Parameters

aquarius

New Aquarius instance.

Returns

void
aquarius/AquariusProvider.ts#L13

getAquarius

Method
static
Returns Acuarius instance. It creates a new one if it's not defined.

Returns

aquarius/AquariusProvider.ts#L21

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#L22

queryMetadata

Method
Search over the DDOs using a query.

Parameters

query

Query to filter the DDOs.

Returns

Promise<
DDO[]
>
aquarius/Aquarius.ts#L49

queryMetadataByText

Method
Search over the DDOs using a query.

Parameters

query

Query to filter the DDOs.

Returns

Promise<
DDO[]
>
aquarius/Aquarius.ts#L77

storeDDO

Method
Stores a DDO in Aquarius.

Parameters

ddo

DDO to be stored.

Returns

Promise<>
aquarius/Aquarius.ts#L110

retrieveDDO

Method
Retrieves a DDO by DID.

Parameters

did

DID of the asset.

Returns

Promise<>
aquarius/Aquarius.ts#L137

getServiceEndpoint

Method

Parameters

did

Returns

string
aquarius/Aquarius.ts#L159

BrizoProvider

Provides the Brizo instance.

setBrizo

Method
static
Set an Brizo instance.

Parameters

brizo

New Brizo instance.

Returns

void
brizo/BrizoProvider.ts#L13

getBrizo

Method
static
Returns Acuarius instance. It creates a new one if it's not defined.

Returns

brizo/BrizoProvider.ts#L21

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#L17

getConsumeEndpoint

Method

Returns

string
brizo/Brizo.ts#L21

getComputeEndpoint

Method

Parameters

pubKey
string

serviceId
string

algo
string

container
string

Returns

string
brizo/Brizo.ts#L25

initializeServiceAgreement

Method

Parameters

did
string

serviceAgreementId
string

serviceDefinitionId
string

signature
string

consumerAddress
string

Returns

Promise<
any
>
brizo/Brizo.ts#L30

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.

Returns

Promise<>
keeper/Keeper.ts#L24

token

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

market

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

auth

Property
Ocean Auth smart contract instance.
keeper/Keeper.ts#L62

serviceAgreement

Property
Service agreement smart contract instance.
keeper/Keeper.ts#L68

accessConditions

Property
Access conditions smart contract instance.
keeper/Keeper.ts#L74

paymentConditions

Property
Payment conditions smart contract instance.
keeper/Keeper.ts#L80

didRegistry

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

getNetworkName

Method
Returns the network by name.

Returns

Promise<
string
>
keeper/Keeper.ts#L92

Web3Provider

getWeb3

Method
static
Returns Web3 instance.

Returns

Web3
keeper/Web3Provider.ts#L10

SecretStoreProvider

setSecretStore

Method
static

Parameters

secretStore
SecretStore

Returns

void
secretstore/SecretStoreProvider.ts#L6

getSecretStore

Method
static

Returns

SecretStore
secretstore/SecretStoreProvider.ts#L11

Config

aquariusUri

Property
string
models/Config.ts#L4

brizoUri

Property
string
models/Config.ts#L8

nodeUri

Property
string
models/Config.ts#L12

web3Provider

Property
any
models/Config.ts#L14

secretStoreUri

Property
string
models/Config.ts#L18

parityUri

Property
string
models/Config.ts#L20

password

Property
string
models/Config.ts#L22

address

Property
string
models/Config.ts#L24

threshold

Property
number
models/Config.ts#L26

verbose

Property
boolean
models/Config.ts#L29

Balance

eth

Property
number
models/Balance.ts#L2

ocn

Property
number
models/Balance.ts#L3