mirror of
https://github.com/logos-storage/logos-storage-js.git
synced 2026-01-03 14:03:06 +00:00
Use pricePerBytePerSecond instead of reward
This commit is contained in:
parent
af70ee5330
commit
0961b50327
@ -192,7 +192,7 @@ Example:
|
||||
```js
|
||||
const request = await marketplace.createStorageRequest({
|
||||
duration: 3000,
|
||||
reward: 100,
|
||||
pricePerBytePerSecond: 1,
|
||||
proofProbability: 1,
|
||||
nodes: 1,
|
||||
tolerance: 0,
|
||||
|
||||
@ -12,7 +12,7 @@ function createStorageRequest() {
|
||||
return {
|
||||
cid: randomString(64),
|
||||
duration: randomInt(1, 64000),
|
||||
reward: randomInt(1, 100),
|
||||
pricePerBytePerSecond: randomInt(1, 100),
|
||||
proofProbability: randomInt(1, 100),
|
||||
nodes: randomInt(1, 5),
|
||||
tolerance: randomInt(1, 100),
|
||||
@ -325,12 +325,15 @@ describe("marketplace", () => {
|
||||
assert.deepStrictEqual(response, minNumberValidationError("duration", 1));
|
||||
});
|
||||
|
||||
it("returns an error when trying to create a storage request without reward", async () => {
|
||||
const { reward, ...rest } = createStorageRequest();
|
||||
it("returns an error when trying to create a storage request without pricePerBytePerSecond", async () => {
|
||||
const { pricePerBytePerSecond, ...rest } = createStorageRequest();
|
||||
|
||||
const response = await marketplace.createStorageRequest(rest as any);
|
||||
|
||||
assert.deepStrictEqual(response, missingNumberValidationError("reward"));
|
||||
assert.deepStrictEqual(
|
||||
response,
|
||||
missingNumberValidationError("pricePerBytePerSecond")
|
||||
);
|
||||
});
|
||||
|
||||
it("returns an error when trying to create a storage request without proof probability", async () => {
|
||||
|
||||
@ -236,7 +236,7 @@ export class CodexMarketplace {
|
||||
const {
|
||||
cid,
|
||||
duration,
|
||||
reward,
|
||||
pricePerBytePerSecond,
|
||||
proofProbability,
|
||||
nodes,
|
||||
collateral,
|
||||
@ -249,7 +249,7 @@ export class CodexMarketplace {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
duration: duration.toString(),
|
||||
reward: reward.toString(),
|
||||
pricePerBytePerSecond: pricePerBytePerSecond.toString(),
|
||||
proofProbability: proofProbability.toString(),
|
||||
nodes,
|
||||
collateral: collateral.toString(),
|
||||
|
||||
@ -30,10 +30,9 @@ export type CodexStorageRequest = {
|
||||
proofProbability: string;
|
||||
|
||||
/**
|
||||
* The maximum amount of tokens paid per second per slot to hosts
|
||||
* the client is willing to pay.
|
||||
* The amount of tokens paid per byte per second per slot to hosts the client is willing to pay
|
||||
*/
|
||||
reward: string;
|
||||
pricePerBytePerSecond: string;
|
||||
|
||||
/**
|
||||
* Max slots that can be lost without data considered to be lost.
|
||||
@ -215,7 +214,7 @@ export type CodexPurchase = {
|
||||
export const CodexCreateStorageRequestInput = v.strictObject({
|
||||
cid: v.string(),
|
||||
duration: v.pipe(v.number(), v.minValue(1)),
|
||||
reward: v.number(),
|
||||
pricePerBytePerSecond: v.number(),
|
||||
proofProbability: v.number(),
|
||||
nodes: v.optional(v.number(), 1),
|
||||
tolerance: v.optional(v.number(), 0),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user