{"_id":"@circles-market/offers","name":"@circles-market/offers","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@circles-market/offers","version":"0.1.0","private":false,"type":"module","main":"dist/index.cjs","module":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","require":"./dist/index.cjs","import":"./dist/index.js"}},"sideEffects":false,"scripts":{"build":"tsup src/index.ts --dts --format esm,cjs --sourcemap","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.json --noEmit"},"dependencies":{"@circles-market/core":"0.1.0","@circles-market/signers":"0.1.0","@circles-profile/core":"0.1.0"},"devDependencies":{"tsup":"^8.3.0","typescript":"^5.6.3"},"_id":"@circles-market/offers@0.1.0","gitHead":"2bfca7a6816434444613f8ca4349e796179480b5","description":"Publish and tombstone offers by writing product JSON-LD to IPFS and updating the avatar profile namespace.","_nodeVersion":"24.8.0","_npmVersion":"11.6.0","dist":{"integrity":"sha512-o63YavmrpQzr2t9GTcJWftDiuVMOV8CfPfwSJp6LR+QNpaEScvA27E3YmdJVilQI7Ggm/lwpB+O/WMl1U1hJ9Q==","shasum":"79594da48cd0b17c18d3f1120b69d730ae3f8788","tarball":"https://registry.npmjs.org/@circles-market/offers/-/offers-0.1.0.tgz","fileCount":16,"unpackedSize":81395,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIA/94Nv22WdPXjf50se8cfEn90jkcSaljuvcUOzn3b82AiEA+fN3tRRgdjcSOW55sygPgNPCr2FzD7ZXIt2NAFJu+3U="}]},"_npmUser":{"name":"jaensen","email":"daniel@djanz.de"},"directories":{},"maintainers":[{"name":"jaensen","email":"daniel@djanz.de"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/offers_0.1.0_1768922734582_0.7335743261580376"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-20T15:25:34.491Z","0.1.0":"2026-01-20T15:25:34.741Z","modified":"2026-01-20T15:25:34.981Z"},"maintainers":[{"name":"jaensen","email":"daniel@djanz.de"}],"description":"Publish and tombstone offers by writing product JSON-LD to IPFS and updating the avatar profile namespace.","readme":"# @circles-market/offers\n\nPublish and tombstone offers by writing product JSON-LD to IPFS and updating the avatar profile namespace.\n\n## Install\n\n```bash\npnpm add @circles-market/offers @circles-market/core @circles-market/signers\n```\n\n## Quickstart (publish)\n\n```ts\nimport { OffersClientImpl, buildProduct } from \"@circles-market/offers\";\n\nasync function publishExample(bindings: any, signer: any) {\n  const offers = new OffersClientImpl(bindings);\n\n  return await offers.publishOffer({\n    avatar: \"0x0000000000000000000000000000000000000000\",\n    operator: \"0x0000000000000000000000000000000000000000\",\n    signer,\n    chainId: 100,\n    product: {\n      sku: \"coffee-1\",\n      name: \"Coffee Beans\",\n      image: \"https://example.com/coffee.jpg\",\n    },\n    offer: {\n      price: 10,\n      priceCurrency: \"EUR\",\n      fulfillmentTrigger: \"confirmed\",\n    },\n  });\n}\n```\n\n## Quickstart (tombstone)\n\n```ts\nimport { OffersClientImpl } from \"@circles-market/offers\";\n\nasync function tombstoneExample(bindings: any, signer: any) {\n  const offers = new OffersClientImpl(bindings);\n  return await offers.tombstone({\n    avatar: \"0x0000000000000000000000000000000000000000\",\n    operator: \"0x0000000000000000000000000000000000000000\",\n    signer,\n    chainId: 100,\n    sku: \"coffee-1\",\n  });\n}\n```\n\n## Reference\n\n### Requirements\n\n* `ProfilesBindings` implementation (IPFS + chain update hooks)\n* `AvatarSigner` for the publishing avatar (Safe-based signing)\n\n### API and return values\n\n* `publishOffer({...})` → `{ productCid, headCid, indexCid, profileCid, digest32, txHash? }`\n  * `productCid`: CID of published product JSON-LD\n  * `headCid`, `indexCid`, `profileCid`: CIDs produced by the profile/index update\n  * `digest32`: 32-byte hex digest derived from `profileCid`\n  * `txHash?`: optional tx hash returned by bindings\n* `tombstone({...})` → `{ headCid, indexCid, profileCid, digest32, txHash? }`\n  * same meaning as `publishOffer`, but for tombstone payload\n\n### `buildProduct(product, offer)` output\n\nReturns a JSON-LD object with:\n- `@context`: schema.org + circles-market context\n- `@type`: \"Product\"\n- required: `sku`, `name`\n- optional: `description`, `url`, `brand`, `mpn`, `gtin13`, `category`, `image`\n- `offers`: array with a single `Offer` including `{ price, priceCurrency }` and optional fields like\n  `availabilityFeed`, `inventoryFeed`, `availableDeliveryMethod`, `requiredSlots`, `fulfillmentEndpoint`, `fulfillmentTrigger`\n\nValidation:\n- `price > 0`\n- `priceCurrency` is 3 uppercase letters\n- URL-ish fields are absolute URLs\n- JSON-LD size ≤ 8 MiB\n\n## Notes\n\n`tombstone()` writes a Tombstone JSON-LD payload and inserts a link for the same `product/<sku>` name, so the index consumers can treat it as removed.\n\n## Errors you’ll see\n\n* `Invalid SKU` → doesn’t match the allowed SKU pattern.\n* `UrlValidationError` → non-absolute URL in image/product/offer fields.\n* `ObjectTooLargeError` → JSON-LD exceeded 8 MiB cap.\n* `Signer avatar mismatch` / `Signer chainId mismatch` → you’re signing with the wrong Safe or wrong chain.\n\n## Related packages\n\n* `@circles-market/signers` to build an `AvatarSigner`\n* `@circles-profile/core` defines the `ProfilesBindings` shape you need to implement\n* `@circles-market/sdk` if you want this alongside catalog/cart/orders\n","readmeFilename":"README.md","_rev":"1-72fad1d43b29d66e1e5471143a8bd0c6"}