From 621a4e4660c931d0b7931d8139f355d487ab16da Mon Sep 17 00:00:00 2001 From: Arnaud Date: Tue, 25 Feb 2025 21:54:51 +0100 Subject: [PATCH] Fix api --- README.md | 2 +- package-lock.json | 4 ++-- package.json | 2 +- src/marketplace/marketplace.test.ts | 16 ++++++++-------- src/marketplace/marketplace.ts | 4 ++-- src/marketplace/types.ts | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 0ac6fe2..1f7d749 100644 --- a/README.md +++ b/README.md @@ -88,7 +88,7 @@ if (slots.error) { | SDK version | Codex version | Codex app | | ----------- | ------------- | --------- | | latest | master | latest | -| 0.0.20 | Testnet 0.2.0 | 0.0.14 | +| 0.0.21 | Testnet 0.2.0 | 0.0.14 | | 0.0.16 | Testnet 0.1.9 | 0.0.13 | ### Marketplace diff --git a/package-lock.json b/package-lock.json index 5cedb61..1c6b2b7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@codex-storage/sdk-js", - "version": "0.0.20", + "version": "0.0.21", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@codex-storage/sdk-js", - "version": "0.0.20", + "version": "0.0.21", "license": "MIT", "dependencies": { "valibot": "^0.32.0" diff --git a/package.json b/package.json index 39a139a..d2d4bf9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@codex-storage/sdk-js", - "version": "0.0.20", + "version": "0.0.21", "description": "Codex SDK to interact with the Codex decentralized storage network.", "repository": { "type": "git", diff --git a/src/marketplace/marketplace.test.ts b/src/marketplace/marketplace.test.ts index 0b99bfa..6bdca40 100644 --- a/src/marketplace/marketplace.test.ts +++ b/src/marketplace/marketplace.test.ts @@ -145,8 +145,8 @@ describe("marketplace", () => { it("returns an error when trying to create an availability with zero total size", async () => { const response = await marketplace.createAvailability({ duration: 3000, - maxCollateral: 1, - minPrice: 100, + totalCollateral: 1, + minPricePerBytePerSecond: 100, totalSize: 0, }); @@ -166,8 +166,8 @@ describe("marketplace", () => { it("returns an error when trying to create an availability with zero duration", async () => { const response = await marketplace.createAvailability({ duration: 0, - maxCollateral: 1, - minPrice: 100, + totalCollateral: 1, + minPricePerBytePerSecond: 100, totalSize: 3000, }); @@ -216,9 +216,9 @@ describe("marketplace", () => { spy.mockImplementationOnce(() => Promise.resolve({ error: false, data })); const response = await marketplace.createAvailability({ - maxCollateral: 1, + totalCollateral: 1, totalSize: 3000, - minPrice: 100, + minPricePerBytePerSecond: 100, duration: 100, }); @@ -234,9 +234,9 @@ describe("marketplace", () => { spy.mockImplementationOnce(() => Promise.resolve({ error: false, data })); const response = await marketplace.createAvailability({ - maxCollateral: 1, + totalCollateral: 1, totalSize: 3000, - minPrice: 100, + minPricePerBytePerSecond: 100, duration: 100, }); diff --git a/src/marketplace/marketplace.ts b/src/marketplace/marketplace.ts index 684e888..f349dab 100644 --- a/src/marketplace/marketplace.ts +++ b/src/marketplace/marketplace.ts @@ -99,8 +99,8 @@ export class CodexMarketplace { body: JSON.stringify({ totalSize: body.totalSize.toString(), duration: body.duration.toString(), - minPrice: body.minPrice.toString(), - maxCollateral: body.maxCollateral.toString(), + minPricePerBytePerSecond: body.minPricePerBytePerSecond.toString(), + totalCollateral: body.totalCollateral.toString(), }), }); } diff --git a/src/marketplace/types.ts b/src/marketplace/types.ts index 8762329..7847f38 100644 --- a/src/marketplace/types.ts +++ b/src/marketplace/types.ts @@ -175,8 +175,8 @@ export type CodexAvailabilityCreateResponse = CodexAvailability & { export const CodexCreateAvailabilityInput = v.strictObject({ totalSize: v.pipe(v.number(), v.minValue(1)), duration: v.pipe(v.number(), v.minValue(1)), - minPrice: v.number(), - maxCollateral: v.number(), + minPricePerBytePerSecond: v.number(), + totalCollateral: v.number(), }); export type CodexCreateAvailabilityInput = v.InferOutput<