@campnetwork/origin 1.3.0-alpha.0 → 1.3.0-alpha.2
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 +270 -86
- package/package.json +1 -1
|
@@ -5,7 +5,6 @@ import { UseQueryResult } from '@tanstack/react-query';
|
|
|
5
5
|
interface Environment {
|
|
6
6
|
NAME: string;
|
|
7
7
|
AUTH_HUB_BASE_API: string;
|
|
8
|
-
AUTH_ENDPOINT: string;
|
|
9
8
|
ORIGIN_DASHBOARD: string;
|
|
10
9
|
DATANFT_CONTRACT_ADDRESS: string;
|
|
11
10
|
MARKETPLACE_CONTRACT_ADDRESS: string;
|
|
@@ -13,6 +12,7 @@ interface Environment {
|
|
|
13
12
|
DISPUTE_CONTRACT_ADDRESS?: string;
|
|
14
13
|
FRACTIONALIZER_CONTRACT_ADDRESS?: string;
|
|
15
14
|
APP_REGISTRY_CONTRACT_ADDRESS?: string;
|
|
15
|
+
USDC_CONTRACT_ADDRESS: string;
|
|
16
16
|
CHAIN: any;
|
|
17
17
|
IPNFT_ABI?: any;
|
|
18
18
|
MARKETPLACE_ABI?: any;
|
|
@@ -130,7 +130,7 @@ type IpNFTSource = "spotify" | "twitter" | "tiktok" | "file";
|
|
|
130
130
|
* @param licenseTerms The terms of the license for the NFT.
|
|
131
131
|
* @param deadline The deadline for the minting operation.
|
|
132
132
|
* @param signature The signature for the minting operation.
|
|
133
|
-
* @param appId Optional app ID for the minting operation.
|
|
133
|
+
* @param appId Optional app ID for the minting operation.
|
|
134
134
|
* @returns A promise that resolves when the minting is complete.
|
|
135
135
|
*/
|
|
136
136
|
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>;
|
|
@@ -144,7 +144,7 @@ declare function mintWithSignature(this: Origin, to: Address, tokenId: bigint, p
|
|
|
144
144
|
* @param parents The IDs of the parent NFTs, if applicable.
|
|
145
145
|
* @return A promise that resolves with the registration data.
|
|
146
146
|
*/
|
|
147
|
-
declare function registerIpNFT(this: Origin, source: IpNFTSource, deadline: bigint, licenseTerms: LicenseTerms, metadata: Record<string, unknown>, fileKey?: string | string[], parents?: bigint[]): Promise<any>;
|
|
147
|
+
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>;
|
|
148
148
|
|
|
149
149
|
/**
|
|
150
150
|
* Updates the license terms of a specified IPNFT.
|
|
@@ -312,6 +312,40 @@ declare function getDataWithIntent(this: Origin, tokenId: bigint, signer?: any,
|
|
|
312
312
|
*/
|
|
313
313
|
declare function raiseDispute(this: Origin, targetIpId: bigint, evidenceHash: Hex, disputeTag: Hex): Promise<any>;
|
|
314
314
|
|
|
315
|
+
interface RaiseDisputeSmartResult {
|
|
316
|
+
transactionResult: any;
|
|
317
|
+
evidenceCid: string;
|
|
318
|
+
evidenceHash: Hex;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Raises a dispute with automatic evidence upload to IPFS.
|
|
322
|
+
* Uploads evidence JSON to IPFS, hashes the CID to bytes32 for on-chain storage,
|
|
323
|
+
* and calls raiseDispute.
|
|
324
|
+
*
|
|
325
|
+
* @param targetIpId The token ID of the IP NFT to dispute.
|
|
326
|
+
* @param evidence The evidence JSON object to upload to IPFS.
|
|
327
|
+
* @param disputeTag A tag identifying the type of dispute.
|
|
328
|
+
* @returns A promise that resolves with the transaction result, IPFS CID, and evidence hash.
|
|
329
|
+
*
|
|
330
|
+
* @example
|
|
331
|
+
* ```typescript
|
|
332
|
+
* const result = await origin.raiseDisputeSmart(
|
|
333
|
+
* 1n,
|
|
334
|
+
* { reason: "copyright", details: "Unauthorized use of copyrighted material" },
|
|
335
|
+
* "0x696e6672696e67656d656e74..." // dispute tag
|
|
336
|
+
* );
|
|
337
|
+
*
|
|
338
|
+
* // Store the CID for evidence retrieval
|
|
339
|
+
* console.log("Evidence CID:", result.evidenceCid);
|
|
340
|
+
*
|
|
341
|
+
* // Fetch evidence later via IPFS gateway
|
|
342
|
+
* // https://ipfs.io/ipfs/{result.evidenceCid}
|
|
343
|
+
*
|
|
344
|
+
* // Verify evidence hash matches on-chain: keccak256(toHex(evidenceCid)) === evidenceHash
|
|
345
|
+
* ```
|
|
346
|
+
*/
|
|
347
|
+
declare function raiseDisputeSmart(this: Origin, targetIpId: bigint, evidence: Record<string, any>, disputeTag: Hex): Promise<RaiseDisputeSmartResult>;
|
|
348
|
+
|
|
315
349
|
/**
|
|
316
350
|
* Asserts a dispute as the IP owner with counter-evidence.
|
|
317
351
|
* Must be called by the owner of the disputed IP within the cooldown period.
|
|
@@ -865,6 +899,7 @@ declare class Origin {
|
|
|
865
899
|
buildPurchaseParams: typeof buildPurchaseParams;
|
|
866
900
|
checkActiveStatus: typeof checkActiveStatus;
|
|
867
901
|
raiseDispute: typeof raiseDispute;
|
|
902
|
+
raiseDisputeSmart: typeof raiseDisputeSmart;
|
|
868
903
|
disputeAssertion: typeof disputeAssertion;
|
|
869
904
|
voteOnDispute: typeof voteOnDispute;
|
|
870
905
|
resolveDispute: typeof resolveDispute;
|
|
@@ -889,6 +924,13 @@ declare class Origin {
|
|
|
889
924
|
constructor(environment?: Environment | string, jwt?: string, viemClient?: WalletClient, baseParentId?: bigint, appId?: string);
|
|
890
925
|
getJwt(): string | undefined;
|
|
891
926
|
setViemClient(client: WalletClient): void;
|
|
927
|
+
/**
|
|
928
|
+
* Uploads a JSON object to IPFS and returns the resulting CID.
|
|
929
|
+
* @param data The JSON object to upload.
|
|
930
|
+
* @returns The CID of the uploaded JSON.
|
|
931
|
+
* @throws {APIError} If the upload fails.
|
|
932
|
+
*/
|
|
933
|
+
uploadJSONToIPFS(data: Record<string, any>): Promise<string>;
|
|
892
934
|
/**
|
|
893
935
|
* Mints a file-based IpNFT.
|
|
894
936
|
* @param file The file to mint.
|
|
@@ -1032,6 +1074,7 @@ declare class Auth {
|
|
|
1032
1074
|
#private;
|
|
1033
1075
|
redirectUri: Record<string, string>;
|
|
1034
1076
|
clientId: string;
|
|
1077
|
+
appId: string;
|
|
1035
1078
|
isAuthenticated: boolean;
|
|
1036
1079
|
jwt: string | null;
|
|
1037
1080
|
walletAddress: string | null;
|
|
@@ -1049,8 +1092,9 @@ declare class Auth {
|
|
|
1049
1092
|
* @param {StorageAdapter} [options.storage] Custom storage adapter. Defaults to localStorage in browser, memory storage in Node.js.
|
|
1050
1093
|
* @throws {APIError} - Throws an error if the clientId is not provided.
|
|
1051
1094
|
*/
|
|
1052
|
-
constructor({ clientId, redirectUri, environment, baseParentId, storage, }: {
|
|
1095
|
+
constructor({ clientId, appId, redirectUri, environment, baseParentId, storage, }: {
|
|
1053
1096
|
clientId: string;
|
|
1097
|
+
appId: string;
|
|
1054
1098
|
redirectUri: string | Record<string, string>;
|
|
1055
1099
|
environment?: "DEVELOPMENT" | "PRODUCTION";
|
|
1056
1100
|
baseParentId?: bigint;
|
|
@@ -1258,8 +1302,9 @@ declare const CampContext: React.Context<CampContextType>;
|
|
|
1258
1302
|
* @param {string} props.environment The environment to use ("DEVELOPMENT" or "PRODUCTION")
|
|
1259
1303
|
* @returns {JSX.Element} The CampProvider component
|
|
1260
1304
|
*/
|
|
1261
|
-
declare const CampProvider: ({ clientId, redirectUri, children, environment, baseParentId, }: {
|
|
1305
|
+
declare const CampProvider: ({ clientId, appId, redirectUri, children, environment, baseParentId, }: {
|
|
1262
1306
|
clientId: string;
|
|
1307
|
+
appId: string;
|
|
1263
1308
|
redirectUri?: string;
|
|
1264
1309
|
children: React.ReactNode;
|
|
1265
1310
|
environment?: "DEVELOPMENT" | "PRODUCTION";
|