Skip to content
This repository was archived by the owner on Apr 8, 2026. It is now read-only.

Commit d760683

Browse files
authored
feat!: update deal-ts-clients@0.22.0 (#1061)
* feat: update deal-ts-clients@0.21.1 * show only relevant contracts * fix * up * fix * fix and improve * up * allow custom url, ids and other overrides for any env * Apply automatic changes * fix and add deployment addrs * Apply automatic changes * fix blockscout url * some improvements * up * up * improvements --------- Co-authored-by: shamsartem <shamsartem@users.noreply.github.com>
1 parent e90c087 commit d760683

48 files changed

Lines changed: 1175 additions & 1235 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cli/docs/commands/README.md

Lines changed: 429 additions & 451 deletions
Large diffs are not rendered by default.

cli/docs/configs/env.md

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,26 @@ Defines user project preferences
44

55
## Properties
66

7-
| Property | Type | Required | Description |
8-
|--------------|---------|----------|----------------------------------------------------------------------------------------------------------|
9-
| `version` | integer | **Yes** | |
10-
| `fluenceEnv` | string | No | Fluence environment to connect to Possible values are: `testnet`, `mainnet`, `stage`, `local`, `custom`. |
7+
| Property | Type | Required | Description |
8+
|-----------------|-----------------------|----------|------------------------------------------------------------------------------------------------|
9+
| `version` | integer | **Yes** | |
10+
| `blockScoutUrl` | string | No | BlockScout URL to use |
11+
| `chainId` | number | No | Chain ID to use |
12+
| `deployment` | [object](#deployment) | No | Deployed contract address overrides |
13+
| `fluenceEnv` | string | No | Fluence environment to connect to Possible values are: `testnet`, `mainnet`, `stage`, `local`. |
14+
| `relays` | string[] | No | List of custom relay multiaddresses to use when connecting to Fluence network |
15+
| `rpcUrl` | string | No | RPC URL to use |
16+
| `subgraphUrl` | string | No | Subgraph URL to use |
17+
18+
## deployment
19+
20+
Deployed contract address overrides
21+
22+
### Properties
23+
24+
| Property | Type | Required | Description |
25+
|--------------|--------|----------|-------------|
26+
| `diamond` | string | No | |
27+
| `multicall3` | string | No | |
28+
| `usdc` | string | No | |
1129

cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"@fluencelabs/air-beautify-wasm": "0.3.9",
6060
"@fluencelabs/aqua-api": "0.14.10",
6161
"@fluencelabs/aqua-to-js": "0.3.13",
62-
"@fluencelabs/deal-ts-clients": "0.20.0",
62+
"@fluencelabs/deal-ts-clients": "0.22.0",
6363
"@fluencelabs/fluence-network-environment": "1.2.3",
6464
"@fluencelabs/js-client": "0.9.0",
6565
"@fluencelabs/npm-aqua-compiler": "0.0.3",

cli/src/commands/chain/info.ts

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,16 @@
1616
*/
1717

1818
import { BaseCommand, baseFlags } from "../../baseCommand.js";
19+
import { jsonStringify, LOCAL_NET_DEFAULT_ACCOUNTS } from "../../common.js";
1920
import {
20-
BLOCK_SCOUT_URLS,
21-
jsonStringify,
22-
LOCAL_NET_DEFAULT_ACCOUNTS,
23-
} from "../../common.js";
24-
import { CHAIN_URLS } from "../../common.js";
25-
import { getChainId } from "../../lib/chain/chainId.js";
21+
getBlockScoutUrl,
22+
getChainId,
23+
getRpcUrl,
24+
getSubgraphUrl,
25+
} from "../../lib/chain/chainConfig.js";
2626
import { commandObj } from "../../lib/commandObj.js";
2727
import { CHAIN_FLAGS } from "../../lib/const.js";
28+
import { resolveDeployment } from "../../lib/dealClient.js";
2829
import { ensureChainEnv } from "../../lib/ensureChainNetwork.js";
2930
import { initCli } from "../../lib/lifeCycle.js";
3031

@@ -40,25 +41,16 @@ export default class Info extends BaseCommand<typeof Info> {
4041
await initCli(this, await this.parse(Info));
4142
const chainEnv = await ensureChainEnv();
4243

43-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
44-
const { default: contracts }: { default: unknown } = await import(
45-
`@fluencelabs/deal-ts-clients/dist/deployments/${chainEnv === "testnet" ? "dar" : chainEnv}.json`,
46-
{
47-
assert: { type: "json" },
48-
}
49-
);
50-
5144
commandObj.log(
5245
jsonStringify({
5346
...(chainEnv === "local"
5447
? { defaultAccountsForLocalEnv: LOCAL_NET_DEFAULT_ACCOUNTS }
5548
: {}),
56-
contracts,
49+
contracts: await resolveDeployment(),
50+
subgraphUrl: await getSubgraphUrl(),
5751
chainId: await getChainId(),
58-
chainRPC: CHAIN_URLS[chainEnv],
59-
...(chainEnv === "local"
60-
? {}
61-
: { blockScoutUrl: BLOCK_SCOUT_URLS[chainEnv] }),
52+
chainRPC: await getRpcUrl(),
53+
...(await getBlockScoutUrl()),
6254
}),
6355
);
6456
}

cli/src/commands/deal/stop.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {
2525
DEPLOYMENT_NAMES_ARG,
2626
} from "../../lib/const.js";
2727
import { getDeals } from "../../lib/deal.js";
28-
import { getDealClient, sign } from "../../lib/dealClient.js";
28+
import { getContracts, sign } from "../../lib/dealClient.js";
2929
import { initCli } from "../../lib/lifeCycle.js";
3030

3131
export default class Stop extends BaseCommand<typeof Stop> {
@@ -43,10 +43,10 @@ export default class Stop extends BaseCommand<typeof Stop> {
4343
async run(): Promise<void> {
4444
const flagsAndArgs = await initCli(this, await this.parse(Stop), true);
4545
const deals = await getDeals(flagsAndArgs);
46-
const { dealClient } = await getDealClient();
46+
const { contracts } = await getContracts();
4747

4848
for (const { dealId, dealName } of deals) {
49-
const deal = dealClient.getDeal(dealId);
49+
const deal = contracts.getDeal(dealId);
5050

5151
await sign({
5252
title: `Stop the deal ${dealName} (${dealId})`,

cli/src/commands/deal/withdraw.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import {
2828
PT_SYMBOL,
2929
} from "../../lib/const.js";
3030
import { getDeals } from "../../lib/deal.js";
31-
import { getDealClient, sign } from "../../lib/dealClient.js";
31+
import { getContracts, sign } from "../../lib/dealClient.js";
3232
import { initCli } from "../../lib/lifeCycle.js";
3333
import { input } from "../../lib/prompt.js";
3434

@@ -49,7 +49,7 @@ export default class Withdraw extends BaseCommand<typeof Withdraw> {
4949

5050
async run(): Promise<void> {
5151
const flagsAndArgs = await initCli(this, await this.parse(Withdraw));
52-
const { dealClient } = await getDealClient();
52+
const { contracts } = await getContracts();
5353
const deals = await getDeals(flagsAndArgs);
5454

5555
const amount =
@@ -65,7 +65,7 @@ export default class Withdraw extends BaseCommand<typeof Withdraw> {
6565
);
6666

6767
for (const { dealId, dealName } of deals) {
68-
const deal = dealClient.getDeal(dealId);
68+
const deal = contracts.getDeal(dealId);
6969

7070
await sign({
7171
title: `Withdraw ${await ptFormatWithSymbol(parsedAmount)} tokens from the deal ${dealName}`,

cli/src/commands/deal/workers-remove.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import {
2626
WORKERS_CONFIG_FULL_FILE_NAME,
2727
} from "../../lib/const.js";
2828
import { getDeal } from "../../lib/deal.js";
29-
import { sign, getDealClient } from "../../lib/dealClient.js";
29+
import { sign, getContracts } from "../../lib/dealClient.js";
3030
import { commaSepStrToArr } from "../../lib/helpers/utils.js";
3131
import { initCli } from "../../lib/lifeCycle.js";
3232
import { input } from "../../lib/prompt.js";
@@ -57,9 +57,9 @@ export default class WorkersRemove extends BaseCommand<typeof WorkersRemove> {
5757
await this.parse(WorkersRemove),
5858
);
5959

60-
const { dealClient } = await getDealClient();
60+
const { contracts } = await getContracts();
6161
const { dealId } = await getDeal({ flags });
62-
const dealContract = dealClient.getDeal(dealId);
62+
const dealContract = contracts.getDeal(dealId);
6363

6464
const workerIds = commaSepStrToArr(
6565
args["WORKER-IDS"] ??

cli/src/commands/default/env.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import { ENV_ARG } from "../../lib/const.js";
2626
import { ensureAquaFileWithWorkerInfo } from "../../lib/deployWorkers.js";
2727
import { initCli } from "../../lib/lifeCycle.js";
2828
import { updateRelaysJSON } from "../../lib/multiaddres.js";
29-
import { ensureCustomAddrsAndPeerIds } from "../../lib/multiaddresWithoutLocal.js";
3029
import { ensureValidFluenceEnv } from "../../lib/resolveFluenceEnv.js";
3130

3231
export default class Env extends BaseCommand<typeof Env> {
@@ -48,13 +47,6 @@ export default class Env extends BaseCommand<typeof Env> {
4847
setEnvConfig(newEnvConfig);
4948
const fluenceEnv = await ensureValidFluenceEnv(args.ENV);
5049

51-
if (
52-
fluenceEnv === "custom" &&
53-
fluenceConfig?.customFluenceEnv === undefined
54-
) {
55-
await ensureCustomAddrsAndPeerIds();
56-
}
57-
5850
newEnvConfig.fluenceEnv = fluenceEnv;
5951
await newEnvConfig.$commit();
6052

cli/src/commands/default/peers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { setChainFlags } from "../../lib/chainFlags.js";
2020
import { commandObj } from "../../lib/commandObj.js";
2121
import { ENV_ARG, ENV_ARG_NAME, ENV_FLAG_NAME } from "../../lib/const.js";
2222
import { initCli } from "../../lib/lifeCycle.js";
23-
import { resolveRelays } from "../../lib/multiaddres.js";
23+
import { resolveDefaultRelays } from "../../lib/multiaddres.js";
2424

2525
export default class Peers extends BaseCommand<typeof Peers> {
2626
static override description = "Print default Fluence network peer addresses";
@@ -34,7 +34,7 @@ export default class Peers extends BaseCommand<typeof Peers> {
3434
async run(): Promise<void> {
3535
const { args } = await initCli(this, await this.parse(Peers));
3636
setChainFlags({ [ENV_FLAG_NAME]: args[ENV_ARG_NAME] });
37-
const relays = await resolveRelays();
37+
const relays = await resolveDefaultRelays();
3838
commandObj.log(relays.join("\n"));
3939
}
4040
}

cli/src/commands/provider/deal-exit.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {
2525
DEAL_IDS_FLAG_NAME,
2626
} from "../../lib/const.js";
2727
import {
28-
getDealClient,
28+
getContracts,
2929
getSignerAddress,
3030
populateTx,
3131
signBatch,
@@ -50,13 +50,11 @@ export default class DealExit extends BaseCommand<typeof DealExit> {
5050

5151
async run(): Promise<void> {
5252
const { flags } = await initCli(this, await this.parse(DealExit));
53-
const { dealClient } = await getDealClient();
53+
const { contracts } = await getContracts();
5454
const signerAddress = await getSignerAddress();
5555

5656
const dealIds = flags.all
57-
? (await getProviderDeals()).map(({ id }) => {
58-
return id;
59-
})
57+
? await getProviderDeals()
6058
: commaSepStrToArr(
6159
flags[DEAL_IDS_FLAG_NAME] ??
6260
(await input({
@@ -67,7 +65,7 @@ export default class DealExit extends BaseCommand<typeof DealExit> {
6765
const workers = (
6866
await Promise.all(
6967
dealIds.map(async (id) => {
70-
const deal = dealClient.getDeal(id);
68+
const deal = contracts.getDeal(id);
7169
return (await deal.getWorkers()).map((worker) => {
7270
return { deal, worker };
7371
});

0 commit comments

Comments
 (0)