Skip to main content

Class: CometaService

CometaService is a client that interacts with the Cometa service. Cometa service is used to store contract metadata: source code, ABI, etc. CometaService

Example

import { CometaService } from '@nilfoundation/niljs';

const service = new CometaService({
transport: new HttpTransport({
endpoint: COMETA_ENDPOINT,
}),
});

Extends

  • BaseClient

Constructors

new CometaService()

new CometaService(config): CometaService

Parameters

ParameterType

config

IClientBaseConfig

Returns

CometaService

Overrides

BaseClient.constructor

Defined

@nilfoundation/niljs/src/clients/CometaService.ts:22

Properties

shardId?

protected optional shardId: number;

The ID of the shard with which the client needs to interact. The shard with this ID will be used in every call made by the client.

Inherited from

BaseClient.shardId

Defined

@nilfoundation/niljs/src/clients/BaseClient.ts:26


transport

protected transport: ITransport;

The ITransport to be used in the client. See ITransport.

Inherited from

BaseClient.transport

Defined

@nilfoundation/niljs/src/clients/BaseClient.ts:18

Methods

compileContract()

compileContract(inputJson): Promise<ContractData>

Compiles the contract.

Parameters

ParameterTypeDescription

inputJson

string

The JSON input.

Returns

Promise<ContractData>

The contract metadata.

Defined

@nilfoundation/niljs/src/clients/CometaService.ts:56


getContract()

getContract(address): Promise<ContractData>

Returns the contract metadata.

Parameters

ParameterTypeDescription

address

0x${string}

Address of the contract.

Returns

Promise<ContractData>

The contract metadata.

Defined

@nilfoundation/niljs/src/clients/CometaService.ts:31


getLocation()

getLocation(address, pc): Promise<Location>

Returns the contract metadata.

Parameters

ParameterTypeDescription

address

0x${string}

Address of the contract.

pc

number

Program counter.

Returns

Promise<Location>

The contract metadata.

Defined

@nilfoundation/niljs/src/clients/CometaService.ts:44


getShardId()

getShardId(): undefined | number

Returns the shard ID.

Returns

undefined | number

The shard ID.

Inherited from

BaseClient.getShardId

Defined

@nilfoundation/niljs/src/clients/BaseClient.ts:51


registerContract()

registerContract(inputJson, address): Promise<unknown>

Register the contract.

Parameters

ParameterTypeDescription

inputJson

string

The JSON input for compiler.

address

0x${string}

Address of the contract.

Returns

Promise<unknown>

Defined

@nilfoundation/niljs/src/clients/CometaService.ts:80


registerContractData()

registerContractData(contractData, address): Promise<unknown>

Register the contract by compilation result.

Parameters

ParameterTypeDescription

contractData

ContractData

The contract data.

address

0x${string}

Address of the contract.

Returns

Promise<unknown>

Defined

@nilfoundation/niljs/src/clients/CometaService.ts:68


request()

protected request<T>(requestObject): Promise<T>

Sends a request.

Type Parameters

Type Parameter

T

Parameters

ParameterTypeDescription

requestObject

RequestArguments

The request object. It contains the request method and parameters.

Returns

Promise<T>

The response.

Inherited from

BaseClient.request

Defined

@nilfoundation/niljs/src/clients/BaseClient.ts:43


setShardId()

setShardId(shardId): void

Sets the shard ID.

Parameters

ParameterTypeDescription

shardId

number

The shard ID.

Returns

void

Throws

Will throw an error if the provided shard ID is invalid.

Example

client.setShardId(1);

Inherited from

BaseClient.setShardId

Defined

@nilfoundation/niljs/src/clients/BaseClient.ts:62