@campnetwork/origin 1.3.0-alpha.0 → 1.3.0-alpha.1
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/README.md +1 -1
- package/dist/core.cjs +154 -107
- package/dist/core.d.ts +48 -4
- package/dist/core.esm.d.ts +48 -4
- package/dist/core.esm.js +186 -139
- package/dist/react/index.esm.d.ts +50 -5
- package/dist/react/index.esm.js +274 -86
- package/package.json +1 -1
package/dist/core.d.ts
CHANGED
|
@@ -134,7 +134,6 @@ declare const mainnet: {
|
|
|
134
134
|
interface Environment {
|
|
135
135
|
NAME: string;
|
|
136
136
|
AUTH_HUB_BASE_API: string;
|
|
137
|
-
AUTH_ENDPOINT: string;
|
|
138
137
|
ORIGIN_DASHBOARD: string;
|
|
139
138
|
DATANFT_CONTRACT_ADDRESS: string;
|
|
140
139
|
MARKETPLACE_CONTRACT_ADDRESS: string;
|
|
@@ -142,6 +141,7 @@ interface Environment {
|
|
|
142
141
|
DISPUTE_CONTRACT_ADDRESS?: string;
|
|
143
142
|
FRACTIONALIZER_CONTRACT_ADDRESS?: string;
|
|
144
143
|
APP_REGISTRY_CONTRACT_ADDRESS?: string;
|
|
144
|
+
USDC_CONTRACT_ADDRESS: string;
|
|
145
145
|
CHAIN: any;
|
|
146
146
|
IPNFT_ABI?: any;
|
|
147
147
|
MARKETPLACE_ABI?: any;
|
|
@@ -269,7 +269,7 @@ type IpNFTSource = "spotify" | "twitter" | "tiktok" | "file";
|
|
|
269
269
|
* @param licenseTerms The terms of the license for the NFT.
|
|
270
270
|
* @param deadline The deadline for the minting operation.
|
|
271
271
|
* @param signature The signature for the minting operation.
|
|
272
|
-
* @param appId Optional app ID for the minting operation.
|
|
272
|
+
* @param appId Optional app ID for the minting operation.
|
|
273
273
|
* @returns A promise that resolves when the minting is complete.
|
|
274
274
|
*/
|
|
275
275
|
declare function mintWithSignature(this: Origin, to: Address, tokenId: bigint, parents: bigint[], isIp: boolean, hash: Hex, uri: string, licenseTerms: LicenseTerms, deadline: bigint, signature: Hex, appId?: string): Promise<any>;
|
|
@@ -283,7 +283,7 @@ declare function mintWithSignature(this: Origin, to: Address, tokenId: bigint, p
|
|
|
283
283
|
* @param parents The IDs of the parent NFTs, if applicable.
|
|
284
284
|
* @return A promise that resolves with the registration data.
|
|
285
285
|
*/
|
|
286
|
-
declare function registerIpNFT(this: Origin, source: IpNFTSource, deadline: bigint, licenseTerms: LicenseTerms, metadata: Record<string, unknown>, fileKey?: string | string[], parents?: bigint[]): Promise<any>;
|
|
286
|
+
declare function registerIpNFT(this: Origin, source: IpNFTSource, deadline: bigint, licenseTerms: LicenseTerms, metadata: Record<string, unknown>, isIp: boolean, fileKey?: string | string[], parents?: bigint[], appId?: string): Promise<any>;
|
|
287
287
|
|
|
288
288
|
/**
|
|
289
289
|
* Updates the license terms of a specified IPNFT.
|
|
@@ -451,6 +451,40 @@ declare function getDataWithIntent(this: Origin, tokenId: bigint, signer?: any,
|
|
|
451
451
|
*/
|
|
452
452
|
declare function raiseDispute(this: Origin, targetIpId: bigint, evidenceHash: Hex, disputeTag: Hex): Promise<any>;
|
|
453
453
|
|
|
454
|
+
interface RaiseDisputeSmartResult {
|
|
455
|
+
transactionResult: any;
|
|
456
|
+
evidenceCid: string;
|
|
457
|
+
evidenceHash: Hex;
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Raises a dispute with automatic evidence upload to IPFS.
|
|
461
|
+
* Uploads evidence JSON to IPFS, hashes the CID to bytes32 for on-chain storage,
|
|
462
|
+
* and calls raiseDispute.
|
|
463
|
+
*
|
|
464
|
+
* @param targetIpId The token ID of the IP NFT to dispute.
|
|
465
|
+
* @param evidence The evidence JSON object to upload to IPFS.
|
|
466
|
+
* @param disputeTag A tag identifying the type of dispute.
|
|
467
|
+
* @returns A promise that resolves with the transaction result, IPFS CID, and evidence hash.
|
|
468
|
+
*
|
|
469
|
+
* @example
|
|
470
|
+
* ```typescript
|
|
471
|
+
* const result = await origin.raiseDisputeSmart(
|
|
472
|
+
* 1n,
|
|
473
|
+
* { reason: "copyright", details: "Unauthorized use of copyrighted material" },
|
|
474
|
+
* "0x696e6672696e67656d656e74..." // dispute tag
|
|
475
|
+
* );
|
|
476
|
+
*
|
|
477
|
+
* // Store the CID for evidence retrieval
|
|
478
|
+
* console.log("Evidence CID:", result.evidenceCid);
|
|
479
|
+
*
|
|
480
|
+
* // Fetch evidence later via IPFS gateway
|
|
481
|
+
* // https://ipfs.io/ipfs/{result.evidenceCid}
|
|
482
|
+
*
|
|
483
|
+
* // Verify evidence hash matches on-chain: keccak256(toHex(evidenceCid)) === evidenceHash
|
|
484
|
+
* ```
|
|
485
|
+
*/
|
|
486
|
+
declare function raiseDisputeSmart(this: Origin, targetIpId: bigint, evidence: Record<string, any>, disputeTag: Hex): Promise<RaiseDisputeSmartResult>;
|
|
487
|
+
|
|
454
488
|
/**
|
|
455
489
|
* Asserts a dispute as the IP owner with counter-evidence.
|
|
456
490
|
* Must be called by the owner of the disputed IP within the cooldown period.
|
|
@@ -1014,6 +1048,7 @@ declare class Origin {
|
|
|
1014
1048
|
buildPurchaseParams: typeof buildPurchaseParams;
|
|
1015
1049
|
checkActiveStatus: typeof checkActiveStatus;
|
|
1016
1050
|
raiseDispute: typeof raiseDispute;
|
|
1051
|
+
raiseDisputeSmart: typeof raiseDisputeSmart;
|
|
1017
1052
|
disputeAssertion: typeof disputeAssertion;
|
|
1018
1053
|
voteOnDispute: typeof voteOnDispute;
|
|
1019
1054
|
resolveDispute: typeof resolveDispute;
|
|
@@ -1038,6 +1073,13 @@ declare class Origin {
|
|
|
1038
1073
|
constructor(environment?: Environment | string, jwt?: string, viemClient?: WalletClient, baseParentId?: bigint, appId?: string);
|
|
1039
1074
|
getJwt(): string | undefined;
|
|
1040
1075
|
setViemClient(client: WalletClient): void;
|
|
1076
|
+
/**
|
|
1077
|
+
* Uploads a JSON object to IPFS and returns the resulting CID.
|
|
1078
|
+
* @param data The JSON object to upload.
|
|
1079
|
+
* @returns The CID of the uploaded JSON.
|
|
1080
|
+
* @throws {APIError} If the upload fails.
|
|
1081
|
+
*/
|
|
1082
|
+
uploadJSONToIPFS(data: Record<string, any>): Promise<string>;
|
|
1041
1083
|
/**
|
|
1042
1084
|
* Mints a file-based IpNFT.
|
|
1043
1085
|
* @param file The file to mint.
|
|
@@ -1175,6 +1217,7 @@ declare class Auth {
|
|
|
1175
1217
|
#private;
|
|
1176
1218
|
redirectUri: Record<string, string>;
|
|
1177
1219
|
clientId: string;
|
|
1220
|
+
appId: string;
|
|
1178
1221
|
isAuthenticated: boolean;
|
|
1179
1222
|
jwt: string | null;
|
|
1180
1223
|
walletAddress: string | null;
|
|
@@ -1192,8 +1235,9 @@ declare class Auth {
|
|
|
1192
1235
|
* @param {StorageAdapter} [options.storage] Custom storage adapter. Defaults to localStorage in browser, memory storage in Node.js.
|
|
1193
1236
|
* @throws {APIError} - Throws an error if the clientId is not provided.
|
|
1194
1237
|
*/
|
|
1195
|
-
constructor({ clientId, redirectUri, environment, baseParentId, storage, }: {
|
|
1238
|
+
constructor({ clientId, appId, redirectUri, environment, baseParentId, storage, }: {
|
|
1196
1239
|
clientId: string;
|
|
1240
|
+
appId: string;
|
|
1197
1241
|
redirectUri: string | Record<string, string>;
|
|
1198
1242
|
environment?: "DEVELOPMENT" | "PRODUCTION";
|
|
1199
1243
|
baseParentId?: bigint;
|
package/dist/core.esm.d.ts
CHANGED
|
@@ -134,7 +134,6 @@ declare const mainnet: {
|
|
|
134
134
|
interface Environment {
|
|
135
135
|
NAME: string;
|
|
136
136
|
AUTH_HUB_BASE_API: string;
|
|
137
|
-
AUTH_ENDPOINT: string;
|
|
138
137
|
ORIGIN_DASHBOARD: string;
|
|
139
138
|
DATANFT_CONTRACT_ADDRESS: string;
|
|
140
139
|
MARKETPLACE_CONTRACT_ADDRESS: string;
|
|
@@ -142,6 +141,7 @@ interface Environment {
|
|
|
142
141
|
DISPUTE_CONTRACT_ADDRESS?: string;
|
|
143
142
|
FRACTIONALIZER_CONTRACT_ADDRESS?: string;
|
|
144
143
|
APP_REGISTRY_CONTRACT_ADDRESS?: string;
|
|
144
|
+
USDC_CONTRACT_ADDRESS: string;
|
|
145
145
|
CHAIN: any;
|
|
146
146
|
IPNFT_ABI?: any;
|
|
147
147
|
MARKETPLACE_ABI?: any;
|
|
@@ -269,7 +269,7 @@ type IpNFTSource = "spotify" | "twitter" | "tiktok" | "file";
|
|
|
269
269
|
* @param licenseTerms The terms of the license for the NFT.
|
|
270
270
|
* @param deadline The deadline for the minting operation.
|
|
271
271
|
* @param signature The signature for the minting operation.
|
|
272
|
-
* @param appId Optional app ID for the minting operation.
|
|
272
|
+
* @param appId Optional app ID for the minting operation.
|
|
273
273
|
* @returns A promise that resolves when the minting is complete.
|
|
274
274
|
*/
|
|
275
275
|
declare function mintWithSignature(this: Origin, to: Address, tokenId: bigint, parents: bigint[], isIp: boolean, hash: Hex, uri: string, licenseTerms: LicenseTerms, deadline: bigint, signature: Hex, appId?: string): Promise<any>;
|
|
@@ -283,7 +283,7 @@ declare function mintWithSignature(this: Origin, to: Address, tokenId: bigint, p
|
|
|
283
283
|
* @param parents The IDs of the parent NFTs, if applicable.
|
|
284
284
|
* @return A promise that resolves with the registration data.
|
|
285
285
|
*/
|
|
286
|
-
declare function registerIpNFT(this: Origin, source: IpNFTSource, deadline: bigint, licenseTerms: LicenseTerms, metadata: Record<string, unknown>, fileKey?: string | string[], parents?: bigint[]): Promise<any>;
|
|
286
|
+
declare function registerIpNFT(this: Origin, source: IpNFTSource, deadline: bigint, licenseTerms: LicenseTerms, metadata: Record<string, unknown>, isIp: boolean, fileKey?: string | string[], parents?: bigint[], appId?: string): Promise<any>;
|
|
287
287
|
|
|
288
288
|
/**
|
|
289
289
|
* Updates the license terms of a specified IPNFT.
|
|
@@ -451,6 +451,40 @@ declare function getDataWithIntent(this: Origin, tokenId: bigint, signer?: any,
|
|
|
451
451
|
*/
|
|
452
452
|
declare function raiseDispute(this: Origin, targetIpId: bigint, evidenceHash: Hex, disputeTag: Hex): Promise<any>;
|
|
453
453
|
|
|
454
|
+
interface RaiseDisputeSmartResult {
|
|
455
|
+
transactionResult: any;
|
|
456
|
+
evidenceCid: string;
|
|
457
|
+
evidenceHash: Hex;
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Raises a dispute with automatic evidence upload to IPFS.
|
|
461
|
+
* Uploads evidence JSON to IPFS, hashes the CID to bytes32 for on-chain storage,
|
|
462
|
+
* and calls raiseDispute.
|
|
463
|
+
*
|
|
464
|
+
* @param targetIpId The token ID of the IP NFT to dispute.
|
|
465
|
+
* @param evidence The evidence JSON object to upload to IPFS.
|
|
466
|
+
* @param disputeTag A tag identifying the type of dispute.
|
|
467
|
+
* @returns A promise that resolves with the transaction result, IPFS CID, and evidence hash.
|
|
468
|
+
*
|
|
469
|
+
* @example
|
|
470
|
+
* ```typescript
|
|
471
|
+
* const result = await origin.raiseDisputeSmart(
|
|
472
|
+
* 1n,
|
|
473
|
+
* { reason: "copyright", details: "Unauthorized use of copyrighted material" },
|
|
474
|
+
* "0x696e6672696e67656d656e74..." // dispute tag
|
|
475
|
+
* );
|
|
476
|
+
*
|
|
477
|
+
* // Store the CID for evidence retrieval
|
|
478
|
+
* console.log("Evidence CID:", result.evidenceCid);
|
|
479
|
+
*
|
|
480
|
+
* // Fetch evidence later via IPFS gateway
|
|
481
|
+
* // https://ipfs.io/ipfs/{result.evidenceCid}
|
|
482
|
+
*
|
|
483
|
+
* // Verify evidence hash matches on-chain: keccak256(toHex(evidenceCid)) === evidenceHash
|
|
484
|
+
* ```
|
|
485
|
+
*/
|
|
486
|
+
declare function raiseDisputeSmart(this: Origin, targetIpId: bigint, evidence: Record<string, any>, disputeTag: Hex): Promise<RaiseDisputeSmartResult>;
|
|
487
|
+
|
|
454
488
|
/**
|
|
455
489
|
* Asserts a dispute as the IP owner with counter-evidence.
|
|
456
490
|
* Must be called by the owner of the disputed IP within the cooldown period.
|
|
@@ -1014,6 +1048,7 @@ declare class Origin {
|
|
|
1014
1048
|
buildPurchaseParams: typeof buildPurchaseParams;
|
|
1015
1049
|
checkActiveStatus: typeof checkActiveStatus;
|
|
1016
1050
|
raiseDispute: typeof raiseDispute;
|
|
1051
|
+
raiseDisputeSmart: typeof raiseDisputeSmart;
|
|
1017
1052
|
disputeAssertion: typeof disputeAssertion;
|
|
1018
1053
|
voteOnDispute: typeof voteOnDispute;
|
|
1019
1054
|
resolveDispute: typeof resolveDispute;
|
|
@@ -1038,6 +1073,13 @@ declare class Origin {
|
|
|
1038
1073
|
constructor(environment?: Environment | string, jwt?: string, viemClient?: WalletClient, baseParentId?: bigint, appId?: string);
|
|
1039
1074
|
getJwt(): string | undefined;
|
|
1040
1075
|
setViemClient(client: WalletClient): void;
|
|
1076
|
+
/**
|
|
1077
|
+
* Uploads a JSON object to IPFS and returns the resulting CID.
|
|
1078
|
+
* @param data The JSON object to upload.
|
|
1079
|
+
* @returns The CID of the uploaded JSON.
|
|
1080
|
+
* @throws {APIError} If the upload fails.
|
|
1081
|
+
*/
|
|
1082
|
+
uploadJSONToIPFS(data: Record<string, any>): Promise<string>;
|
|
1041
1083
|
/**
|
|
1042
1084
|
* Mints a file-based IpNFT.
|
|
1043
1085
|
* @param file The file to mint.
|
|
@@ -1175,6 +1217,7 @@ declare class Auth {
|
|
|
1175
1217
|
#private;
|
|
1176
1218
|
redirectUri: Record<string, string>;
|
|
1177
1219
|
clientId: string;
|
|
1220
|
+
appId: string;
|
|
1178
1221
|
isAuthenticated: boolean;
|
|
1179
1222
|
jwt: string | null;
|
|
1180
1223
|
walletAddress: string | null;
|
|
@@ -1192,8 +1235,9 @@ declare class Auth {
|
|
|
1192
1235
|
* @param {StorageAdapter} [options.storage] Custom storage adapter. Defaults to localStorage in browser, memory storage in Node.js.
|
|
1193
1236
|
* @throws {APIError} - Throws an error if the clientId is not provided.
|
|
1194
1237
|
*/
|
|
1195
|
-
constructor({ clientId, redirectUri, environment, baseParentId, storage, }: {
|
|
1238
|
+
constructor({ clientId, appId, redirectUri, environment, baseParentId, storage, }: {
|
|
1196
1239
|
clientId: string;
|
|
1240
|
+
appId: string;
|
|
1197
1241
|
redirectUri: string | Record<string, string>;
|
|
1198
1242
|
environment?: "DEVELOPMENT" | "PRODUCTION";
|
|
1199
1243
|
baseParentId?: bigint;
|