@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 +4 -4
- package/dist/core.d.ts +2 -2
- package/dist/core.esm.d.ts +2 -2
- package/dist/core.esm.js +4 -4
- package/package.json +1 -1
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,
|
|
345
|
-
* Returns a CID starting with "
|
|
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) +
|
|
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]=
|
|
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,
|
|
498
|
-
* Returns a CID starting with "
|
|
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.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,
|
|
498
|
-
* Returns a CID starting with "
|
|
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,
|
|
328
|
-
* Returns a CID starting with "
|
|
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) +
|
|
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]=
|
|
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)}
|