Update to use collatealPerByte

This commit is contained in:
Arnaud 2025-02-10 22:49:32 +01:00
parent ee7e4ee9e8
commit c910f4d668
No known key found for this signature in database
GPG Key ID: 69D6CE281FCAE663
3 changed files with 7 additions and 7 deletions

View File

@ -17,7 +17,7 @@ function createStorageRequest() {
nodes: randomInt(1, 5),
tolerance: randomInt(1, 100),
expiry: randomInt(1, 100),
collateral: randomInt(1, 100),
collateralPerByte: randomInt(1, 100),
};
}
@ -366,14 +366,14 @@ describe("marketplace", () => {
assert.deepStrictEqual(response, minNumberValidationError("expiry", 1));
});
it("returns an error when trying to create a storage request without collateral", async () => {
const { collateral, ...rest } = createStorageRequest();
it("returns an error when trying to create a storage request without collateralPerByte", async () => {
const { collateralPerByte, ...rest } = createStorageRequest();
const response = await marketplace.createStorageRequest(rest as any);
assert.deepStrictEqual(
response,
missingNumberValidationError("collateral")
missingNumberValidationError("collateralPerByte")
);
});
});

View File

@ -239,7 +239,7 @@ export class CodexMarketplace {
pricePerBytePerSecond,
proofProbability,
nodes,
collateral,
collateralPerByte,
expiry,
tolerance,
} = result.output;
@ -252,7 +252,7 @@ export class CodexMarketplace {
pricePerBytePerSecond: pricePerBytePerSecond.toString(),
proofProbability: proofProbability.toString(),
nodes,
collateral: collateral.toString(),
collateral: collateralPerByte.toString(),
expiry: expiry.toString(),
tolerance,
}),

View File

@ -219,7 +219,7 @@ export const CodexCreateStorageRequestInput = v.strictObject({
nodes: v.optional(v.number(), 1),
tolerance: v.optional(v.number(), 0),
expiry: v.pipe(v.number(), v.minValue(1)),
collateral: v.number(),
collateralPerByte: v.number(),
});
export type CodexCreateStorageRequestInput = v.InferOutput<