@campnetwork/origin 1.3.0-alpha.10 → 1.3.0-alpha.11

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/core.cjs CHANGED
@@ -341,8 +341,8 @@ const n=function(e){const t={};for(let e=0;e<32;e++)t[ge[e]]=e;let n=0,i=0;const
341
341
  // For dag-pb with sha2-256: 0x01 + 0x70 + 0x12 + 0x20 + 32-byte digest
342
342
  if(1!==n[0]||36!==n.length)throw new Error("Invalid CIDv1: expected version 1 with 36 bytes");const i=n[1];if(85!==i&&112!==i)throw new Error(`Invalid CIDv1: unsupported codec 0x${i.toString(16)}`);if(18!==n[2]||32!==n[3])throw new Error("Invalid CIDv1: expected SHA-256 hash");t=n.slice(4)}}return`0x${Buffer.from(t).toString("hex")}`}
343
343
  /**
344
- * Decode bytes32 back to CIDv1 format (base32, dag-pb codec).
345
- * Returns a CID starting with "bafybei" that works with Pinata gateways.
344
+ * Decode bytes32 back to CIDv1 format (base32, raw codec).
345
+ * Returns a CID starting with "bafkrei" that works with Pinata gateways for raw data uploads.
346
346
  */
347
347
  /**
348
348
  * Raises a dispute with automatic evidence upload to IPFS.
@@ -1207,11 +1207,11 @@ if(!T&&(h.uuid||h.name))for(const e of f)try{if(h.uuid&&(null===(p=e.info)||void
1207
1207
  * @throws {Error} - Throws an error if the user is not authenticated.
1208
1208
  * @throws {APIError} - Throws an error if the request fails.
1209
1209
  */unlinkTelegram(){return a(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new f("User must be authenticated to unlink Telegram account");const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/telegram/disconnect-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({userId:this.userId})}).then((e=>e.json()));if(e.isError)throw new h(e.message||"Failed to unlink Telegram account");return e.data}))}},exports.BrowserStorage=l,exports.CustomSignerAdapter=u,exports.EthersSignerAdapter=d,exports.MemoryStorage=y,exports.Origin=wt,exports.ViemSignerAdapter=o,exports.campMainnet=m,exports.campTestnet=c,exports.createLicenseTerms=(e,t,n,i,a=exports.LicenseType.DURATION_BASED)=>{if(n<F||n>O)throw new Error(`Royalty basis points must be between ${F} and ${O}`);if(a===exports.LicenseType.DURATION_BASED){if(t<M||t>k)throw new Error(`Duration must be between ${M} and ${k} seconds for DURATION_BASED licenses`)}else if((a===exports.LicenseType.SINGLE_PAYMENT||a===exports.LicenseType.X402)&&t>0)throw new Error(`Duration must be 0 for ${exports.LicenseType[a]} licenses`);if(e<B)throw new Error(`Price must be at least ${B} wei`);return{price:e,duration:t,royaltyBps:n,paymentToken:i,licenseType:a}},exports.createNodeWalletClient=function(t,n,i){return e.createWalletClient({account:t,chain:n,transport:e.http(i)})},exports.createSignerAdapter=p,exports.decodeCidFromBytes32=function(e){const t=Buffer.from(e.slice(2),"hex");if(32!==t.length)throw new Error("Invalid bytes32: expected 32-byte digest");
1210
- // Build CIDv1: version (0x01) + dag-pb codec (0x70) + sha2-256 (0x12) + length (0x20) + digest
1210
+ // Build CIDv1: version (0x01) + raw codec (0x55) + sha2-256 (0x12) + length (0x20) + digest
1211
1211
  const n=new Uint8Array(36);
1212
1212
  // Encode with base32 and add 'b' multibase prefix
1213
1213
  return n[0]=1,// CIDv1
1214
- n[1]=112,// dag-pb codec (used by Pinata)
1214
+ n[1]=85,// raw codec (used by Pinata for raw data uploads like JSON)
1215
1215
  n[2]=18,// sha2-256 hash function
1216
1216
  n[3]=32,// 32 byte length
1217
1217
  n.set(t,4),"b"+function(e){let t="",n=0,i=0;for(const a of e)for(i=i<<8|a,n+=8;n>=5;)n-=5,t+=ge[i>>n&31];return n>0&&(t+=ge[i<<5-n&31]),t}(n)},exports.encodeCidToBytes32=be;
package/dist/core.d.ts CHANGED
@@ -494,8 +494,8 @@ declare function raiseDisputeSmart(this: Origin, targetIpId: bigint, evidence: R
494
494
  */
495
495
  declare function encodeCidToBytes32(cid: string): Hex;
496
496
  /**
497
- * Decode bytes32 back to CIDv1 format (base32, dag-pb codec).
498
- * Returns a CID starting with "bafybei" that works with Pinata gateways.
497
+ * Decode bytes32 back to CIDv1 format (base32, raw codec).
498
+ * Returns a CID starting with "bafkrei" that works with Pinata gateways for raw data uploads.
499
499
  */
500
500
  declare function decodeCidFromBytes32(bytes32: Hex): string;
501
501
 
@@ -494,8 +494,8 @@ declare function raiseDisputeSmart(this: Origin, targetIpId: bigint, evidence: R
494
494
  */
495
495
  declare function encodeCidToBytes32(cid: string): Hex;
496
496
  /**
497
- * Decode bytes32 back to CIDv1 format (base32, dag-pb codec).
498
- * Returns a CID starting with "bafybei" that works with Pinata gateways.
497
+ * Decode bytes32 back to CIDv1 format (base32, raw codec).
498
+ * Returns a CID starting with "bafkrei" that works with Pinata gateways for raw data uploads.
499
499
  */
500
500
  declare function decodeCidFromBytes32(bytes32: Hex): string;
501
501
 
package/dist/core.esm.js CHANGED
@@ -324,14 +324,14 @@ const n=function(e){const t={};for(let e=0;e<32;e++)t[Fe[e]]=e;let n=0,i=0;const
324
324
  // For dag-pb with sha2-256: 0x01 + 0x70 + 0x12 + 0x20 + 32-byte digest
325
325
  if(1!==n[0]||36!==n.length)throw new Error("Invalid CIDv1: expected version 1 with 36 bytes");const i=n[1];if(85!==i&&112!==i)throw new Error(`Invalid CIDv1: unsupported codec 0x${i.toString(16)}`);if(18!==n[2]||32!==n[3])throw new Error("Invalid CIDv1: expected SHA-256 hash");t=n.slice(4)}}return`0x${Buffer.from(t).toString("hex")}`}
326
326
  /**
327
- * Decode bytes32 back to CIDv1 format (base32, dag-pb codec).
328
- * Returns a CID starting with "bafybei" that works with Pinata gateways.
327
+ * Decode bytes32 back to CIDv1 format (base32, raw codec).
328
+ * Returns a CID starting with "bafkrei" that works with Pinata gateways for raw data uploads.
329
329
  */function Ue(e){const t=Buffer.from(e.slice(2),"hex");if(32!==t.length)throw new Error("Invalid bytes32: expected 32-byte digest");
330
- // Build CIDv1: version (0x01) + dag-pb codec (0x70) + sha2-256 (0x12) + length (0x20) + digest
330
+ // Build CIDv1: version (0x01) + raw codec (0x55) + sha2-256 (0x12) + length (0x20) + digest
331
331
  const n=new Uint8Array(36);
332
332
  // Encode with base32 and add 'b' multibase prefix
333
333
  return n[0]=1,// CIDv1
334
- n[1]=112,// dag-pb codec (used by Pinata)
334
+ n[1]=85,// raw codec (used by Pinata for raw data uploads like JSON)
335
335
  n[2]=18,// sha2-256 hash function
336
336
  n[3]=32,// 32 byte length
337
337
  n.set(t,4),"b"+function(e){let t="",n=0,i=0;for(const a of e)for(i=i<<8|a,n+=8;n>=5;)n-=5,t+=Fe[i>>n&31];return n>0&&(t+=Fe[i<<5-n&31]),t}(n)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@campnetwork/origin",
3
- "version": "1.3.0-alpha.10",
3
+ "version": "1.3.0-alpha.11",
4
4
  "main": "dist/core.cjs",
5
5
  "exports": {
6
6
  ".": {