Skip to content

Commit 72a09c1

Browse files
ValeryAntopolgithub-actions[bot]
authored andcommitted
Apply automatic changes
1 parent ae66201 commit 72a09c1

File tree

7 files changed

+32
-15
lines changed

7 files changed

+32
-15
lines changed

packages/cli/package/docs/commands/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ Create offers. You have to be registered as a provider to do that. Alias: fluenc
671671
```
672672
USAGE
673673
$ fluence provider offer-create [--no-input] [--env <testnet | mainnet | stage | local>] [--priv-key <private-key>]
674-
[--offers <offer-1,offer-2>]
674+
[--offers <offer-1,offer-2>] [--provider <address>]
675675
676676
FLAGS
677677
--env=<testnet | mainnet | stage | local> Fluence Environment to use when running the command
@@ -682,6 +682,7 @@ FLAGS
682682
unsecure. On local env
683683
0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 is used
684684
by default when CLI is used in non-interactive mode
685+
--provider=<address> Provider address. In case using managmenent address to sign transactions
685686
686687
DESCRIPTION
687688
Create offers. You have to be registered as a provider to do that. Alias: fluence provider oc

packages/cli/package/src/commands/provider/offer-access-address.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {
2222
} from "../../lib/chain/offer/offer.js";
2323
import {
2424
getOfferOwner,
25-
makeProviderAddressValidator
25+
makeProviderAddressValidator,
2626
} from "../../lib/chain/providerInfo.js";
2727
import { commandObj } from "../../lib/commandObj.js";
2828
import {

packages/cli/package/src/commands/provider/offer-create.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@
1717

1818
import { BaseCommand } from "../../baseCommand.js";
1919
import { createOffers } from "../../lib/chain/offer/offer.js";
20-
import { OFFER_FLAG, CHAIN_FLAGS, PROVIDER_ADDRESS_FLAG } from "../../lib/const.js";
20+
import {
21+
OFFER_FLAG,
22+
CHAIN_FLAGS,
23+
PROVIDER_ADDRESS_FLAG,
24+
} from "../../lib/const.js";
2125
import { aliasesText } from "../../lib/helpers/aliasesText.js";
2226
import { initCli } from "../../lib/lifeCycle.js";
2327

@@ -27,7 +31,7 @@ export default class CreateOffer extends BaseCommand<typeof CreateOffer> {
2731
static override flags = {
2832
...CHAIN_FLAGS,
2933
...OFFER_FLAG,
30-
...PROVIDER_ADDRESS_FLAG
34+
...PROVIDER_ADDRESS_FLAG,
3135
};
3236

3337
async run(): Promise<void> {

packages/cli/package/src/lib/chain/offer/offer.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ import {
5050
PROVIDER_CONFIG_FULL_FILE_NAME,
5151
SINGLE_OFFER_FLAG_NAME,
5252
SINGLE_OFFER_ID_FLAG_NAME,
53-
VCPU_PER_CU
53+
VCPU_PER_CU,
5454
} from "../../const.js";
5555
import {
5656
getContracts,
@@ -97,7 +97,10 @@ export type SingleOffersArgs = {
9797
[SINGLE_OFFER_ID_FLAG_NAME]?: string | undefined;
9898
};
9999

100-
export async function createOffers(flags: CreateOffersArgs, maybeProviderAddress?: string) {
100+
export async function createOffers(
101+
flags: CreateOffersArgs,
102+
maybeProviderAddress?: string,
103+
) {
101104
const allOffers = await resolveOffersFromProviderConfig(flags);
102105
const providerConfig = await ensureReadonlyProviderConfig();
103106
const providerConfigPath = providerConfig.$getPath();
@@ -171,6 +174,7 @@ export async function createOffers(flags: CreateOffersArgs, maybeProviderAddress
171174

172175
const signerAddress = await getSignerAddress();
173176
const providerAddress = maybeProviderAddress ?? signerAddress;
177+
174178
try {
175179
({
176180
sliceIndex: registeredCUsCount,
@@ -185,7 +189,7 @@ export async function createOffers(flags: CreateOffersArgs, maybeProviderAddress
185189
contracts.deployment.usdc,
186190
resourcePricesArray,
187191
setCPUSupplyForCP(computePeersToRegister),
188-
dataCenter.id
192+
dataCenter.id,
189193
];
190194
},
191195
getTitle() {

packages/cli/package/src/lib/chain/offer/updateOffers.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ import {
3535
resourceSupplyFromChainToConfig,
3636
} from "../conversions.js";
3737
import { ptFormatWithSymbol } from "../currencies.js";
38-
import { getOfferOwner, makeProviderAddressValidator } from "../providerInfo.js";
38+
import {
39+
getOfferOwner,
40+
makeProviderAddressValidator,
41+
} from "../providerInfo.js";
3942

4043
import {
4144
type OffersArgs,

packages/cli/package/src/lib/chain/providerInfo.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,9 @@ Provider address: ${signerAddress}
110110
async function getProviderInfoByAddress(address: string) {
111111
const { contracts } = await getContracts();
112112
const { name } = await contracts.diamond.getProviderInfo(address);
113-
const managementAddress = await contracts.diamond.getProviderManagementAddress(address);
114-
return { name: name === "" ? null : name, address, managementAddress};
113+
const managementAddress =
114+
await contracts.diamond.getProviderManagementAddress(address);
115+
return { name: name === "" ? null : name, address, managementAddress };
115116
}
116117

117118
export async function getProviderInfo(address?: string) {
@@ -128,14 +129,17 @@ export function makeProviderAddressValidator(providerAddress?: string) {
128129
commandObj.error(
129130
`You have to register as a provider first. Use '${CLI_NAME} provider register' command for that`,
130131
);
131-
} else if (address !== providerAddress && address !== providerInfo.managementAddress) {
132+
} else if (
133+
address !== providerAddress &&
134+
address !== providerInfo.managementAddress
135+
) {
132136
commandObj.error(
133137
`You have using nor provider address not provider management address to sign the transaction.`,
134138
);
135139
}
136140

137-
return
138-
}
141+
return;
142+
};
139143
}
140144

141145
export async function getOfferOwner(offerId: string): Promise<string> {

packages/cli/package/src/lib/const.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ export const PRIV_KEY_FLAG = {
198198
}),
199199
};
200200

201-
export const ADDRESS_FLAG_NAME = "address"
201+
export const ADDRESS_FLAG_NAME = "address";
202202
export const PROVIDER_ADDRESS_FLAG_NAME = "provider";
203203

204204
export const ADDRESS_FLAG = {
@@ -217,7 +217,8 @@ export const CLUSTER_ADDRESS_FLAG = {
217217

218218
export const PROVIDER_ADDRESS_FLAG = {
219219
[PROVIDER_ADDRESS_FLAG_NAME]: Flags.string({
220-
description: "Provider address. In case using managmenent address to sign transactions",
220+
description:
221+
"Provider address. In case using managmenent address to sign transactions",
221222
helpValue: "<address>",
222223
}),
223224
};

0 commit comments

Comments
 (0)