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
Parameter | Type |
---|---|
|
Returns
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
Parameter | Type | Description |
---|---|---|
|
| 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
Parameter | Type | Description |
---|---|---|
|
| 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
Parameter | Type | Description |
---|---|---|
|
| Address of the contract. |
|
| 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
Parameter | Type | Description |
---|---|---|
|
| The JSON input for compiler. |
|
| 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
Parameter | Type | Description |
---|---|---|
| The contract data. | |
|
| 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 |
---|
|
Parameters
Parameter | Type | Description |
---|---|---|
|
| 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
Parameter | Type | Description |
---|---|---|
|
| 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