Update api

This commit is contained in:
Arnaud 2025-02-25 23:18:29 +01:00
parent 621a4e4660
commit bf61eefea9
No known key found for this signature in database
GPG Key ID: 69D6CE281FCAE663
6 changed files with 16 additions and 16 deletions

View File

@ -88,7 +88,7 @@ if (slots.error) {
| SDK version | Codex version | Codex app | | SDK version | Codex version | Codex app |
| ----------- | ------------- | --------- | | ----------- | ------------- | --------- |
| latest | master | latest | | latest | master | latest |
| 0.0.21 | Testnet 0.2.0 | 0.0.14 | | 0.0.22 | Testnet 0.2.0 | 0.0.14 |
| 0.0.16 | Testnet 0.1.9 | 0.0.13 | | 0.0.16 | Testnet 0.1.9 | 0.0.13 |
### Marketplace ### Marketplace

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "@codex-storage/sdk-js", "name": "@codex-storage/sdk-js",
"version": "0.0.21", "version": "0.0.22",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@codex-storage/sdk-js", "name": "@codex-storage/sdk-js",
"version": "0.0.21", "version": "0.0.22",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"valibot": "^0.32.0" "valibot": "^0.32.0"

View File

@ -1,6 +1,6 @@
{ {
"name": "@codex-storage/sdk-js", "name": "@codex-storage/sdk-js",
"version": "0.0.21", "version": "0.0.22",
"description": "Codex SDK to interact with the Codex decentralized storage network.", "description": "Codex SDK to interact with the Codex decentralized storage network.",
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -247,9 +247,9 @@ describe("marketplace", () => {
it("returns an error when trying to update an availability without id", async () => { it("returns an error when trying to update an availability without id", async () => {
const response = await marketplace.updateAvailability({ const response = await marketplace.updateAvailability({
maxCollateral: 1, totalCollateral: 1,
totalSize: 3000, totalSize: 3000,
minPrice: 100, minPricePerBytePerSecond: 100,
duration: 100, duration: 100,
} as any); } as any);
@ -260,9 +260,9 @@ describe("marketplace", () => {
const response = await marketplace.updateAvailability({ const response = await marketplace.updateAvailability({
id: randomString(64), id: randomString(64),
totalSize: 0, totalSize: 0,
minPrice: 100, minPricePerBytePerSecond: 100,
duration: 100, duration: 100,
maxCollateral: 100, totalCollateral: 100,
}); });
assert.deepStrictEqual(response, minNumberValidationError("totalSize", 1)); assert.deepStrictEqual(response, minNumberValidationError("totalSize", 1));
@ -273,8 +273,8 @@ describe("marketplace", () => {
id: randomString(64), id: randomString(64),
totalSize: 100, totalSize: 100,
duration: 0, duration: 0,
minPrice: 100, minPricePerBytePerSecond: 100,
maxCollateral: 100, totalCollateral: 100,
}); });
assert.deepStrictEqual(response, minNumberValidationError("duration", 1)); assert.deepStrictEqual(response, minNumberValidationError("duration", 1));
@ -291,8 +291,8 @@ describe("marketplace", () => {
id: randomString(64), id: randomString(64),
totalSize: 3000, totalSize: 3000,
duration: 10, duration: 10,
minPrice: 100, minPricePerBytePerSecond: 100,
maxCollateral: 100, totalCollateral: 100,
}); });
assert.ok(!response.error); assert.ok(!response.error);

View File

@ -133,8 +133,8 @@ export class CodexMarketplace {
body: JSON.stringify({ body: JSON.stringify({
totalSize: body.totalSize.toString(), totalSize: body.totalSize.toString(),
duration: body.duration.toString(), duration: body.duration.toString(),
minPrice: body.minPrice.toString(), minPricePerBytePerSecond: body.minPricePerBytePerSecond.toString(),
maxCollateral: body.maxCollateral.toString(), totalCollateral: body.totalCollateral.toString(),
}), }),
}); });

View File

@ -187,8 +187,8 @@ export const CodexUpdateAvailabilityInput = v.strictObject({
id: v.string(), id: v.string(),
totalSize: v.pipe(v.number(), v.minValue(1)), totalSize: v.pipe(v.number(), v.minValue(1)),
duration: v.pipe(v.number(), v.minValue(1)), duration: v.pipe(v.number(), v.minValue(1)),
minPrice: v.number(), minPricePerBytePerSecond: v.number(),
maxCollateral: v.number(), totalCollateral: v.number(),
}); });
export type CodexUpdateAvailabilityInput = v.InferOutput< export type CodexUpdateAvailabilityInput = v.InferOutput<