Skip to content

Commit 7574eda

Browse files
author
Uriy Korotovskikh
authored
Merge pull request #574 from NilFoundation/rename-cometa-service-cometa-client
[niljs] rename cometaService to cometaClient
2 parents f50a676 + 7d36387 commit 7574eda

17 files changed

Lines changed: 61 additions & 61 deletions

File tree

clijs/src/base.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Command, Flags } from "@oclif/core";
33
import * as os from "node:os";
44
import * as path from "node:path";
55
import {
6-
CometaService,
6+
CometaClient,
77
FaucetClient,
88
type Hex,
99
HttpTransport,
@@ -58,7 +58,7 @@ abstract class BaseCommand extends Command {
5858
protected cfg?: Record<string, string>;
5959
protected rpcClient?: PublicClient;
6060
protected faucetClient?: FaucetClient;
61-
protected cometaClient?: CometaService;
61+
protected cometaClient?: CometaClient;
6262
protected quiet = false;
6363

6464
public async init(): Promise<void> {
@@ -112,7 +112,7 @@ abstract class BaseCommand extends Command {
112112
}
113113

114114
if (this.cfg[ConfigKeys.CometaEndpoint]) {
115-
this.cometaClient = new CometaService({
115+
this.cometaClient = new CometaClient({
116116
transport: new HttpTransport({
117117
endpoint: this.cfg[ConfigKeys.CometaEndpoint],
118118
}),

clijs/test/setup.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { mkdtemp } from "node:fs/promises";
33
import os from "node:os";
44
import path from "node:path";
55
import {
6-
CometaService,
6+
CometaClient,
77
FaucetClient,
88
type Hex,
99
HttpTransport,
@@ -37,7 +37,7 @@ interface CliTestFixture {
3737
stdout: string;
3838
}>;
3939

40-
cometaClient: CometaService;
40+
cometaClient: CometaClient;
4141
faucetClient: FaucetClient;
4242
rpcClient: PublicClient;
4343

@@ -80,7 +80,7 @@ export const CliTest = test.extend<CliTestFixture>({
8080
});
8181
},
8282

83-
cometaClient: new CometaService({
83+
cometaClient: new CometaClient({
8484
transport: new HttpTransport({
8585
endpoint: testEnv.cometaServiceEndpoint,
8686
}),

docs/nil/guides/cometa-and-debugging.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ To use the Cometa service with =nil; developer tools, it is necessary to to set
2525
cometa_endpoint: COMETA_ENDPOINT
2626
```
2727

28-
* For `Nil.js`, the endpoint should be set when creating an instance of `CometaService`:
28+
* For `Nil.js`, the endpoint should be set when creating an instance of `CometaClient`:
2929

3030
```ts showLineNumbers
31-
const service = new CometaService({
31+
const service = new CometaClient({
3232
transport: new HttpTransport({
3333
endpoint: COMETA_ENDPOINT,
3434
}),

docs/nil/migration-guides/november-0611-2024-release.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ nil contract top-up CONTRACT_ADDRESS AMOUNT Token_ID
3737

3838
* Use the new Cometa service bindings in `Nil.js` scripts
3939

40-
The `Nil.js` package now contains several 'helper' functions and classes for interacting with the Cometa service. To access the service, simply initialize a new `CometaService` and then call `compileContract()` and `registerContract()`.
40+
The `Nil.js` package now contains several 'helper' functions and classes for interacting with the Cometa service. To access the service, simply initialize a new `CometaClient` and then call `compileContract()` and `registerContract()`.
4141

4242
More information about the `Nil.js` Cometa bindings is given in [**the references section**](../reference/client/index.mdx).
4343

docs/nil/niljs/getting-started.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,16 @@ Here is a non-exhaustive list of 'helper' classes and functions provided by `Nil
4949
| `SmartAccountV1.sendMessage()` | Sends a message to a smart contract via previously deployed smart account. |
5050
| `FaucetClient` | Provides an instance of a client interacting with the faucet service. |
5151
| `FaucetClient.topUpAndWaitUntilCompletion()` | Tops up a smart contract from the specified faucet. |
52-
| `CometaService` | Allows for interacting with the Cometa service. |
53-
| `CometaService.registerContractData()` | Registers a smart contract inside the Cometa service. |
52+
| `CometaClient` | Allows for interacting with the Cometa service. |
53+
| `CometaClient.registerContractData()` | Registers a smart contract inside the Cometa service. |
5454

5555
To see all members exposed by `Nil.js`, proceed to [**the 'References' section**](../reference/client/index.mdx).
5656

5757
:::info
5858

5959
The testnet RPC endpoint provides access to the cluster and all related services including the faucet service and the Cometa service.
6060

61-
When running the cluster, the faucet service and the Cometa service locally, their endpoints will be different. This will require providing different endpoints when creating instances of `PublicClient`, `FaucetClient` and `CometaService`.
61+
When running the cluster, the faucet service and the Cometa service locally, their endpoints will be different. This will require providing different endpoints when creating instances of `PublicClient`, `FaucetClient` and `CometaClient`.
6262

6363
:::
6464

docs/tests/cometa-and-debugging.test.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010

1111
//startNilJSImport
1212
import {
13-
CometaService,
13+
CometaClient,
1414
HttpTransport,
1515
PublicClient,
1616
generateSmartAccount,
@@ -100,7 +100,7 @@ describe.sequential("CLI tutorial flows pass correctly for CounterBug", () => {
100100
describe.skip.sequential("Nil.js correctly interacts with Cometa", () => {
101101
test.sequential("Nil.js passes the Cometa tutorial flow", async () => {
102102
//startNilJSCometaTutorialSnippet
103-
const cometa = new CometaService({
103+
const cometa = new CometaClient({
104104
transport: new HttpTransport({
105105
endpoint: COMETA_ENDPOINT,
106106
}),

explorer_frontend/src/features/account/components/AccountInfo.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
import { useStyletron } from "baseui";
1111
import { useUnit } from "effector-react";
1212
import { useEffect } from "react";
13-
import { $cometaService } from "../../cometa/model";
13+
import { $cometaClient } from "../../cometa/model";
1414
import { addressRoute } from "../../routing";
1515
import { Divider } from "../../shared";
1616
import { Info } from "../../shared/components/Info";
@@ -43,14 +43,14 @@ export const AccountInfo = () => {
4343
loadAccountStateFx.pending,
4444
loadAccountCometaInfoFx.pending,
4545
addressRoute.$params,
46-
$cometaService,
46+
$cometaClient,
4747
]);
4848
const [css] = useStyletron();
4949
const sourceCode = accountCometaInfo?.sourceCode?.Compiled_Contracts;
5050

5151
useEffect(() => {
5252
loadAccountStateFx(params.address);
53-
loadAccountCometaInfoFx({ address: params.address, cometaService: cometa });
53+
loadAccountCometaInfoFx({ address: params.address, cometaClient: cometa });
5454
}, [params.address, cometa]);
5555

5656
if (isLoading) return <AccountLoading />;

explorer_frontend/src/features/account/init.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { sample } from "effector";
22
import { combine } from "effector";
3-
import { $cometaService } from "../cometa/model";
3+
import { $cometaClient } from "../cometa/model";
44
import { addressRoute } from "../routing";
55
import { $account, $accountCometaInfo, loadAccountCometaInfoFx, loadAccountStateFx } from "./model";
66

@@ -13,11 +13,11 @@ sample({
1313

1414
sample({
1515
clock: addressRoute.navigated,
16-
source: combine(addressRoute.$params, $cometaService, (params, cometaService) => ({
16+
source: combine(addressRoute.$params, $cometaClient, (params, cometaClient) => ({
1717
params,
18-
cometaService,
18+
cometaClient,
1919
})),
20-
filter: ({ cometaService }) => cometaService !== null,
20+
filter: ({ cometaClient }) => cometaClient !== null,
2121
fn: (params) => params.address,
2222
target: loadAccountCometaInfoFx,
2323
});

explorer_frontend/src/features/account/model.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { type CometaService, type Hex, addHexPrefix } from "@nilfoundation/niljs";
1+
import { type CometaClient, type Hex, addHexPrefix } from "@nilfoundation/niljs";
22
import { createDomain } from "effector";
33
import { fetchAccountState } from "../../api/account";
44
import type { AccountCometaInfo, AccountState } from "./types";
@@ -15,7 +15,7 @@ export const loadAccountStateFx = createEffect<string, AccountState>();
1515
export const loadAccountCometaInfoFx = createEffect<
1616
{
1717
address: Hex;
18-
cometaService: CometaService;
18+
cometaClient: CometaClient;
1919
},
2020
AccountCometaInfo
2121
>();
@@ -24,7 +24,7 @@ loadAccountStateFx.use(async (address) => {
2424
return fetchAccountState(address);
2525
});
2626

27-
loadAccountCometaInfoFx.use(async ({ address, cometaService }) => {
28-
const res = await cometaService.getContract(addHexPrefix(address));
27+
loadAccountCometaInfoFx.use(async ({ address, cometaClient }) => {
28+
const res = await cometaClient.getContract(addHexPrefix(address));
2929
return res;
3030
});

explorer_frontend/src/features/cometa/init.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { CometaService, HttpTransport } from "@nilfoundation/niljs";
1+
import { CometaClient, HttpTransport } from "@nilfoundation/niljs";
22
import { combine, sample } from "effector";
33
import { $rpcUrl } from "../account-connector/model";
4-
import { $cometaApiUrl, $cometaService, createCometaService, createCometaServiceFx } from "./model";
4+
import { $cometaApiUrl, $cometaClient, createCometaService, createCometaServiceFx } from "./model";
55

66
const $refinedCometaApiUrl = combine(
77
$rpcUrl,
@@ -16,14 +16,14 @@ $refinedCometaApiUrl.watch((url) => {
1616
});
1717

1818
createCometaServiceFx.use(async (endpoint) => {
19-
const cometaService = new CometaService({
19+
const cometaClient = new CometaClient({
2020
transport: new HttpTransport({ endpoint }),
2121
});
2222

23-
return cometaService;
23+
return cometaClient;
2424
});
2525

26-
$cometaService.on(createCometaServiceFx.doneData, (_, cometaService) => cometaService);
26+
$cometaClient.on(createCometaServiceFx.doneData, (_, cometaClient) => cometaClient);
2727

2828
sample({
2929
clock: createCometaService,

0 commit comments

Comments
 (0)