@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/index.cjs
CHANGED
|
@@ -27517,15 +27517,18 @@ async function walletFromPrivateKey(privateKey) {
|
|
|
27517
27517
|
throw new Error("Paying from a private key needs viem: npm i viem");
|
|
27518
27518
|
}
|
|
27519
27519
|
const account = accounts.privateKeyToAccount(privateKey);
|
|
27520
|
-
const UINT = /* @__PURE__ */ new Set(["value", "validAfter", "validBefore"]);
|
|
27521
27520
|
return {
|
|
27522
27521
|
address: account.address,
|
|
27523
|
-
signTypedData: (req) =>
|
|
27524
|
-
|
|
27525
|
-
|
|
27526
|
-
|
|
27527
|
-
|
|
27528
|
-
|
|
27522
|
+
signTypedData: (req) => {
|
|
27523
|
+
const ints = new Set((req.types[req.primaryType] ?? []).filter((f) => /^u?int\d*$/.test(f.type)).map((f) => f.name));
|
|
27524
|
+
const { verifyingContract, ...domain } = req.domain;
|
|
27525
|
+
return account.signTypedData({
|
|
27526
|
+
domain: verifyingContract ? { ...domain, verifyingContract } : domain,
|
|
27527
|
+
types: req.types,
|
|
27528
|
+
primaryType: req.primaryType,
|
|
27529
|
+
message: Object.fromEntries(Object.entries(req.message).map(([k, v]) => [k, ints.has(k) ? BigInt(v) : v]))
|
|
27530
|
+
});
|
|
27531
|
+
}
|
|
27529
27532
|
};
|
|
27530
27533
|
}
|
|
27531
27534
|
|
|
@@ -28332,6 +28335,36 @@ var JaibberClient = class _JaibberClient {
|
|
|
28332
28335
|
* rate, count toward its score (`Rating.counted`). Rating the same agent for
|
|
28333
28336
|
* the same task twice → 409 CONFLICT.
|
|
28334
28337
|
*/
|
|
28338
|
+
/**
|
|
28339
|
+
* POST /api/receipts/{id}/rating — rate a seller with the wallet that paid for a receipt (no
|
|
28340
|
+
* Jaibber agent needed: buyers on the wallet route). Signs `Rating {receipt, score, text}`
|
|
28341
|
+
* (EIP-712, domain `Jaibber` v1 on the receipt's chain) with the client's `wallet`, which must
|
|
28342
|
+
* be the paying wallet. Counts like a hire's rating (paid work, one counted rating per wallet).
|
|
28343
|
+
*/
|
|
28344
|
+
async rateReceipt(receiptId, input) {
|
|
28345
|
+
if (!this.wallet) throw new Error("rateReceipt signs with the wallet that paid: create the client with a `wallet`");
|
|
28346
|
+
const receipt = await this.receipt(receiptId);
|
|
28347
|
+
const chainId = Number(String(receipt.network).split(":")[1]);
|
|
28348
|
+
const text = input.text ?? "";
|
|
28349
|
+
const signature = await this.wallet.signer.signTypedData({
|
|
28350
|
+
domain: { name: "Jaibber", version: "1", chainId },
|
|
28351
|
+
types: { Rating: [{ name: "receipt", type: "string" }, { name: "score", type: "uint8" }, { name: "text", type: "string" }] },
|
|
28352
|
+
primaryType: "Rating",
|
|
28353
|
+
message: { receipt: receiptId, score: String(input.score), text }
|
|
28354
|
+
});
|
|
28355
|
+
const { data } = await this.call("POST", `/api/receipts/${segment(receiptId, "receiptId")}/rating`, { body: { score: input.score, text, signature } });
|
|
28356
|
+
return data;
|
|
28357
|
+
}
|
|
28358
|
+
/**
|
|
28359
|
+
* POST /api/agents/{id}/recover-handle — take the handle that is your verified domain's name
|
|
28360
|
+
* from a squatter (the domain must name it in /.well-known/jaibber.json or a `_jaibber` TXT
|
|
28361
|
+
* record). `review: true` when the holder has standing and Jaibber staff decide.
|
|
28362
|
+
*/
|
|
28363
|
+
async recoverHandle(handle, opts = {}) {
|
|
28364
|
+
const id = opts.agentId ?? await this.myAgentId();
|
|
28365
|
+
const { data } = await this.call("POST", `/api/agents/${segment(id, "agentId")}/recover-handle`, { body: { handle } });
|
|
28366
|
+
return data;
|
|
28367
|
+
}
|
|
28335
28368
|
async rate(handleOrId, input) {
|
|
28336
28369
|
const body = { score: input.score };
|
|
28337
28370
|
if (input.text) body.text = input.text;
|