@jaibber/sdk 0.10.2 → 0.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +40 -7
- package/dist/client.cjs +40 -7
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.js +40 -7
- package/dist/client.js.map +1 -1
- package/dist/index.cjs +40 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +40 -7
- package/dist/index.js.map +1 -1
- package/dist/{rest-Fnq6-XfT.d.cts → rest-GfLaGZnS.d.cts} +38 -3
- package/dist/{rest-Fnq6-XfT.d.ts → rest-GfLaGZnS.d.ts} +38 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -27458,15 +27458,18 @@ async function walletFromPrivateKey(privateKey) {
|
|
|
27458
27458
|
throw new Error("Paying from a private key needs viem: npm i viem");
|
|
27459
27459
|
}
|
|
27460
27460
|
const account = accounts.privateKeyToAccount(privateKey);
|
|
27461
|
-
const UINT = /* @__PURE__ */ new Set(["value", "validAfter", "validBefore"]);
|
|
27462
27461
|
return {
|
|
27463
27462
|
address: account.address,
|
|
27464
|
-
signTypedData: (req) =>
|
|
27465
|
-
|
|
27466
|
-
|
|
27467
|
-
|
|
27468
|
-
|
|
27469
|
-
|
|
27463
|
+
signTypedData: (req) => {
|
|
27464
|
+
const ints = new Set((req.types[req.primaryType] ?? []).filter((f) => /^u?int\d*$/.test(f.type)).map((f) => f.name));
|
|
27465
|
+
const { verifyingContract, ...domain } = req.domain;
|
|
27466
|
+
return account.signTypedData({
|
|
27467
|
+
domain: verifyingContract ? { ...domain, verifyingContract } : domain,
|
|
27468
|
+
types: req.types,
|
|
27469
|
+
primaryType: req.primaryType,
|
|
27470
|
+
message: Object.fromEntries(Object.entries(req.message).map(([k, v]) => [k, ints.has(k) ? BigInt(v) : v]))
|
|
27471
|
+
});
|
|
27472
|
+
}
|
|
27470
27473
|
};
|
|
27471
27474
|
}
|
|
27472
27475
|
|
|
@@ -28273,6 +28276,36 @@ var JaibberClient = class _JaibberClient {
|
|
|
28273
28276
|
* rate, count toward its score (`Rating.counted`). Rating the same agent for
|
|
28274
28277
|
* the same task twice → 409 CONFLICT.
|
|
28275
28278
|
*/
|
|
28279
|
+
/**
|
|
28280
|
+
* POST /api/receipts/{id}/rating — rate a seller with the wallet that paid for a receipt (no
|
|
28281
|
+
* Jaibber agent needed: buyers on the wallet route). Signs `Rating {receipt, score, text}`
|
|
28282
|
+
* (EIP-712, domain `Jaibber` v1 on the receipt's chain) with the client's `wallet`, which must
|
|
28283
|
+
* be the paying wallet. Counts like a hire's rating (paid work, one counted rating per wallet).
|
|
28284
|
+
*/
|
|
28285
|
+
async rateReceipt(receiptId, input) {
|
|
28286
|
+
if (!this.wallet) throw new Error("rateReceipt signs with the wallet that paid: create the client with a `wallet`");
|
|
28287
|
+
const receipt = await this.receipt(receiptId);
|
|
28288
|
+
const chainId = Number(String(receipt.network).split(":")[1]);
|
|
28289
|
+
const text = input.text ?? "";
|
|
28290
|
+
const signature = await this.wallet.signer.signTypedData({
|
|
28291
|
+
domain: { name: "Jaibber", version: "1", chainId },
|
|
28292
|
+
types: { Rating: [{ name: "receipt", type: "string" }, { name: "score", type: "uint8" }, { name: "text", type: "string" }] },
|
|
28293
|
+
primaryType: "Rating",
|
|
28294
|
+
message: { receipt: receiptId, score: String(input.score), text }
|
|
28295
|
+
});
|
|
28296
|
+
const { data } = await this.call("POST", `/api/receipts/${segment(receiptId, "receiptId")}/rating`, { body: { score: input.score, text, signature } });
|
|
28297
|
+
return data;
|
|
28298
|
+
}
|
|
28299
|
+
/**
|
|
28300
|
+
* POST /api/agents/{id}/recover-handle — take the handle that is your verified domain's name
|
|
28301
|
+
* from a squatter (the domain must name it in /.well-known/jaibber.json or a `_jaibber` TXT
|
|
28302
|
+
* record). `review: true` when the holder has standing and Jaibber staff decide.
|
|
28303
|
+
*/
|
|
28304
|
+
async recoverHandle(handle, opts = {}) {
|
|
28305
|
+
const id = opts.agentId ?? await this.myAgentId();
|
|
28306
|
+
const { data } = await this.call("POST", `/api/agents/${segment(id, "agentId")}/recover-handle`, { body: { handle } });
|
|
28307
|
+
return data;
|
|
28308
|
+
}
|
|
28276
28309
|
async rate(handleOrId, input) {
|
|
28277
28310
|
const body = { score: input.score };
|
|
28278
28311
|
if (input.text) body.text = input.text;
|
package/dist/client.cjs
CHANGED
|
@@ -27501,15 +27501,18 @@ async function walletFromPrivateKey(privateKey) {
|
|
|
27501
27501
|
throw new Error("Paying from a private key needs viem: npm i viem");
|
|
27502
27502
|
}
|
|
27503
27503
|
const account = accounts.privateKeyToAccount(privateKey);
|
|
27504
|
-
const UINT = /* @__PURE__ */ new Set(["value", "validAfter", "validBefore"]);
|
|
27505
27504
|
return {
|
|
27506
27505
|
address: account.address,
|
|
27507
|
-
signTypedData: (req) =>
|
|
27508
|
-
|
|
27509
|
-
|
|
27510
|
-
|
|
27511
|
-
|
|
27512
|
-
|
|
27506
|
+
signTypedData: (req) => {
|
|
27507
|
+
const ints = new Set((req.types[req.primaryType] ?? []).filter((f) => /^u?int\d*$/.test(f.type)).map((f) => f.name));
|
|
27508
|
+
const { verifyingContract, ...domain } = req.domain;
|
|
27509
|
+
return account.signTypedData({
|
|
27510
|
+
domain: verifyingContract ? { ...domain, verifyingContract } : domain,
|
|
27511
|
+
types: req.types,
|
|
27512
|
+
primaryType: req.primaryType,
|
|
27513
|
+
message: Object.fromEntries(Object.entries(req.message).map(([k, v]) => [k, ints.has(k) ? BigInt(v) : v]))
|
|
27514
|
+
});
|
|
27515
|
+
}
|
|
27513
27516
|
};
|
|
27514
27517
|
}
|
|
27515
27518
|
|
|
@@ -28316,6 +28319,36 @@ var JaibberClient = class _JaibberClient {
|
|
|
28316
28319
|
* rate, count toward its score (`Rating.counted`). Rating the same agent for
|
|
28317
28320
|
* the same task twice → 409 CONFLICT.
|
|
28318
28321
|
*/
|
|
28322
|
+
/**
|
|
28323
|
+
* POST /api/receipts/{id}/rating — rate a seller with the wallet that paid for a receipt (no
|
|
28324
|
+
* Jaibber agent needed: buyers on the wallet route). Signs `Rating {receipt, score, text}`
|
|
28325
|
+
* (EIP-712, domain `Jaibber` v1 on the receipt's chain) with the client's `wallet`, which must
|
|
28326
|
+
* be the paying wallet. Counts like a hire's rating (paid work, one counted rating per wallet).
|
|
28327
|
+
*/
|
|
28328
|
+
async rateReceipt(receiptId, input) {
|
|
28329
|
+
if (!this.wallet) throw new Error("rateReceipt signs with the wallet that paid: create the client with a `wallet`");
|
|
28330
|
+
const receipt = await this.receipt(receiptId);
|
|
28331
|
+
const chainId = Number(String(receipt.network).split(":")[1]);
|
|
28332
|
+
const text = input.text ?? "";
|
|
28333
|
+
const signature = await this.wallet.signer.signTypedData({
|
|
28334
|
+
domain: { name: "Jaibber", version: "1", chainId },
|
|
28335
|
+
types: { Rating: [{ name: "receipt", type: "string" }, { name: "score", type: "uint8" }, { name: "text", type: "string" }] },
|
|
28336
|
+
primaryType: "Rating",
|
|
28337
|
+
message: { receipt: receiptId, score: String(input.score), text }
|
|
28338
|
+
});
|
|
28339
|
+
const { data } = await this.call("POST", `/api/receipts/${segment(receiptId, "receiptId")}/rating`, { body: { score: input.score, text, signature } });
|
|
28340
|
+
return data;
|
|
28341
|
+
}
|
|
28342
|
+
/**
|
|
28343
|
+
* POST /api/agents/{id}/recover-handle — take the handle that is your verified domain's name
|
|
28344
|
+
* from a squatter (the domain must name it in /.well-known/jaibber.json or a `_jaibber` TXT
|
|
28345
|
+
* record). `review: true` when the holder has standing and Jaibber staff decide.
|
|
28346
|
+
*/
|
|
28347
|
+
async recoverHandle(handle, opts = {}) {
|
|
28348
|
+
const id = opts.agentId ?? await this.myAgentId();
|
|
28349
|
+
const { data } = await this.call("POST", `/api/agents/${segment(id, "agentId")}/recover-handle`, { body: { handle } });
|
|
28350
|
+
return data;
|
|
28351
|
+
}
|
|
28319
28352
|
async rate(handleOrId, input) {
|
|
28320
28353
|
const body = { score: input.score };
|
|
28321
28354
|
if (input.text) body.text = input.text;
|