diff --git a/package-lock.json b/package-lock.json
index 7312694..93bb2d6 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -10,7 +10,7 @@
"license": "MIT",
"dependencies": {
"@codex-storage/marketplace-ui-components": "^0.0.51",
- "@codex-storage/sdk-js": "^0.0.18",
+ "@codex-storage/sdk-js": "^0.0.19",
"@sentry/browser": "^8.32.0",
"@sentry/react": "^8.31.0",
"@tanstack/react-query": "^5.51.15",
@@ -433,9 +433,9 @@
}
},
"node_modules/@codex-storage/sdk-js": {
- "version": "0.0.18",
- "resolved": "https://registry.npmjs.org/@codex-storage/sdk-js/-/sdk-js-0.0.18.tgz",
- "integrity": "sha512-FbQFRJgSuol6P00Wk76XShSGDIlQpTEr4Zgt3Ze1uRxC8gVpVRiHME2Z5/EOq7Fm25So9aCSD7MSKDULanHDpQ==",
+ "version": "0.0.19",
+ "resolved": "https://registry.npmjs.org/@codex-storage/sdk-js/-/sdk-js-0.0.19.tgz",
+ "integrity": "sha512-MLA7Q593pzLszcpaaZ5gu62jKCItXub1FpN19/sWlqEvQ9e1kzAMsN+pl915EQCuNT/sf5nmR3PVELde3l/yIA==",
"license": "MIT",
"dependencies": {
"valibot": "^0.32.0"
diff --git a/package.json b/package.json
index 22aa159..61f4509 100644
--- a/package.json
+++ b/package.json
@@ -27,7 +27,7 @@
],
"dependencies": {
"@codex-storage/marketplace-ui-components": "^0.0.51",
- "@codex-storage/sdk-js": "^0.0.18",
+ "@codex-storage/sdk-js": "^0.0.19",
"@sentry/browser": "^8.32.0",
"@sentry/react": "^8.31.0",
"@tanstack/react-query": "^5.51.15",
diff --git a/src/components/Purchase/PurchasesTable.tsx b/src/components/Purchase/PurchasesTable.tsx
index 120349c..c771879 100644
--- a/src/components/Purchase/PurchasesTable.tsx
+++ b/src/components/Purchase/PurchasesTable.tsx
@@ -80,7 +80,7 @@ export function PurchasesTable() {
["request id"],
["duration", onSortByDuration],
["slots"],
- ["reward", onSortByReward],
+ ["price per byte", onSortByReward],
["proof probability"],
["state", onSortByState],
] satisfies [string, ((state: TabSortState) => void)?][];
@@ -92,7 +92,6 @@ export function PurchasesTable() {
const ask = p.request.ask;
const duration = parseInt(ask.duration, 10);
const pf = parseInt(ask.proofProbability, 10);
- const reward = PurchaseUtils.calculatePrice(p.request);
return (
,
{Times.pretty(duration)} | ,
{ask.slots.toString()} | ,
- {reward + " CDX"} | ,
+ {p.request.ask.pricePerBytePerSecond + " CDX"} | ,
{pf.toString()} | ,
,
]}>
diff --git a/src/components/Purchase/purchase.utils.ts b/src/components/Purchase/purchase.utils.ts
index 6ee7977..4d77736 100644
--- a/src/components/Purchase/purchase.utils.ts
+++ b/src/components/Purchase/purchase.utils.ts
@@ -21,12 +21,11 @@ export const PurchaseUtils = {
? Number(b.request.ask.duration) - Number(a.request.ask.duration)
: Number(a.request.ask.duration) - Number(b.request.ask.duration),
sortByReward:
- (state: TabSortState) => (a: CodexPurchase, b: CodexPurchase) =>
- state === "desc"
- ? PurchaseUtils.calculatePrice(b.request) -
- PurchaseUtils.calculatePrice(a.request)
- : PurchaseUtils.calculatePrice(a.request) -
- PurchaseUtils.calculatePrice(b.request),
+ (state: TabSortState) => (a: CodexPurchase, b: CodexPurchase) => {
+ const aPrice = parseInt(a.request.ask.pricePerBytePerSecond, 10);
+ const bPrice = parseInt(b.request.ask.pricePerBytePerSecond, 10);
+ return state === "desc" ? bPrice - aPrice : aPrice - bPrice;
+ },
sortByUploadedAt:
(state: TabSortState, table: Record) =>
(a: CodexPurchase, b: CodexPurchase) => {
diff --git a/src/components/StorageRequestSetup/StorageRequestCreate.tsx b/src/components/StorageRequestSetup/StorageRequestCreate.tsx
index 3300982..f2a674b 100644
--- a/src/components/StorageRequestSetup/StorageRequestCreate.tsx
+++ b/src/components/StorageRequestSetup/StorageRequestCreate.tsx
@@ -83,13 +83,26 @@ export function StorageRequestCreate() {
WebStorage.set("storage-request-step", step);
if (step == CONFIRM_STATE) {
- const { availability, availabilityUnit, expiration, reward, ...rest } =
- storageRequest;
+ const {
+ availability,
+ availabilityUnit,
+ expiration,
+ reward,
+ collateral,
+ proofProbability,
+ cid,
+ nodes,
+ tolerance,
+ } = storageRequest;
mutateAsync({
- ...rest,
- pricePerBytePerSecond: reward,
duration: Math.trunc(availability * Times.value(availabilityUnit)),
+ pricePerBytePerSecond: reward,
+ proofProbability,
+ collateralPerByte: collateral,
expiry: expiration * 60,
+ cid,
+ nodes,
+ tolerance,
});
} else {
dispatch({
diff --git a/src/components/StorageRequestSetup/StorageRequestReview.tsx b/src/components/StorageRequestSetup/StorageRequestReview.tsx
index 45f4895..c04b8c6 100644
--- a/src/components/StorageRequestSetup/StorageRequestReview.tsx
+++ b/src/components/StorageRequestSetup/StorageRequestReview.tsx
@@ -282,7 +282,7 @@ export function StorageRequestReview({
onChange={onAvailabilityChange}
onValidation={isInvalidAvailability}>
> {
@@ -31,26 +28,29 @@ class CodexMarketplaceMock extends CodexMarketplace {
// }
/**
- * Maintains a temporary link between the CID and the file metadata.
- * When the metadata is available in the manifest, the CID link
- * should still be maintained, but the metadata should be retrieved
+ * Maintains a temporary link between the CID and the file metadata.
+ * When the metadata is available in the manifest, the CID link
+ * should still be maintained, but the metadata should be retrieved
* using a REST API call.
*/
- override async createStorageRequest(input: CodexCreateStorageRequestInput): Promise> {
- const res = await super.createStorageRequest(input)
+ override async createStorageRequest(
+ input: CodexCreateStorageRequestInput
+ ): Promise> {
+ console.info(input);
+ const res = await super.createStorageRequest(input);
if (res.error) {
- return res
+ console.error(res.data);
+ return res;
}
- await WebStorage.purchases.set("0x" + res.data, input.cid)
+ await WebStorage.purchases.set("0x" + res.data, input.cid);
// await PurchaseDatesStorage.set(res.data, new Date().toJSON())
- return res
+ return res;
}
-
// override createStorageRequest(
// input: CodexCreateStorageRequestInput
// ): Promise> {
@@ -139,5 +139,3 @@ export const CodexSdk = {
marketplace: () => new CodexMarketplaceMock(CodexSdk.url()),
data: () => new CodexDataMock(CodexSdk.url()),
};
-
-