@campnetwork/origin 1.3.0-alpha.8 → 1.3.0

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.
@@ -8,7 +8,7 @@ interface Environment {
8
8
  ORIGIN_DASHBOARD: string;
9
9
  DATANFT_CONTRACT_ADDRESS: string;
10
10
  MARKETPLACE_CONTRACT_ADDRESS: string;
11
- BATCH_PURCHASE_CONTRACT_ADDRESS: string;
11
+ BATCH_OPERATIONS_CONTRACT_ADDRESS: string;
12
12
  DISPUTE_CONTRACT_ADDRESS?: string;
13
13
  FRACTIONALIZER_CONTRACT_ADDRESS?: string;
14
14
  APP_REGISTRY_CONTRACT_ADDRESS?: string;
@@ -17,7 +17,7 @@ interface Environment {
17
17
  IPNFT_ABI?: any;
18
18
  MARKETPLACE_ABI?: any;
19
19
  TBA_ABI?: any;
20
- BATCH_PURCHASE_ABI?: any;
20
+ BATCH_OPERATIONS_ABI?: any;
21
21
  DISPUTE_ABI?: any;
22
22
  FRACTIONALIZER_ABI?: any;
23
23
  APP_REGISTRY_ABI?: any;
@@ -244,54 +244,6 @@ declare function hasAccess(this: Origin, user: Address, tokenId: bigint): Promis
244
244
 
245
245
  declare function subscriptionExpiry(this: Origin, tokenId: bigint, user: Address): Promise<bigint>;
246
246
 
247
- /**
248
- * Response from getDataWithX402 when payment is required
249
- */
250
- interface X402Response {
251
- error: string;
252
- marketplaceAction?: {
253
- kind: string;
254
- contract: Address;
255
- network: string;
256
- chainId: number;
257
- method: string;
258
- payer: Address;
259
- payTo: Address;
260
- tokenId: string;
261
- duration: number;
262
- asset: Address;
263
- amount: string;
264
- amountFormatted: string;
265
- };
266
- }
267
- interface TransactionResult {
268
- txHash: string;
269
- receipt?: any;
270
- }
271
- /**
272
- * EXPERIMENTAL METHOD
273
- * Settles a payment intent response by purchasing access if needed.
274
- * This method checks if the user already has access to the item, and if not,
275
- * it calls buyAccess with the parameters from the payment intent response.
276
- * Supports viem WalletClient, ethers Signer, and custom signer implementations.
277
- *
278
- * @param paymentIntentResponse - The response from getDataWithIntent containing payment details.
279
- * @param signer - Optional signer object used to interact with the blockchain. If not provided, uses the connected wallet client.
280
- * @returns A promise that resolves with the transaction hash and receipt, or null if access already exists.
281
- * @throws {Error} If the response doesn't contain marketplace action or if the method is not buyAccess.
282
- */
283
- declare function settlePaymentIntent(this: Origin, paymentIntentResponse: X402Response, signer?: any): Promise<TransactionResult | null>;
284
-
285
- /**
286
- * EXPERIMENTAL METHOD
287
- * Fetch data with X402 payment handling.
288
- * @param {bigint} tokenId The token ID to fetch data for.
289
- * @param {any} [signer] Optional signer object for signing the X402 intent.
290
- * @returns {Promise<any>} A promise that resolves with the fetched data.
291
- * @throws {Error} Throws an error if the data cannot be fetched or if no signer/wallet client is provided.
292
- */
293
- declare function getDataWithIntent(this: Origin, tokenId: bigint, signer?: any, decide?: (terms: any) => Promise<boolean>): Promise<any>;
294
-
295
247
  /**
296
248
  * Raises a dispute against an IP NFT.
297
249
  * Automatically handles token approval for ERC20 bonds or native token value.
@@ -919,11 +871,78 @@ declare function bulkBuyAccessSmart(this: Origin, tokenIds: bigint[], options?:
919
871
  tolerant?: boolean;
920
872
  }): Promise<any>;
921
873
 
874
+ /**
875
+ * Parameters for a single mint in a bulk mint operation.
876
+ * Maps to the contract's MintParams struct.
877
+ */
878
+ interface MintParams {
879
+ to: Address;
880
+ tokenId: bigint;
881
+ creatorContentHash: Hex;
882
+ uri: string;
883
+ licenseTerms: LicenseTerms;
884
+ deadline: bigint;
885
+ parents: bigint[];
886
+ isIP: boolean;
887
+ appId: string;
888
+ signature: Hex;
889
+ }
890
+ /**
891
+ * Executes an atomic bulk mint of multiple IP-NFTs.
892
+ * All mints succeed or all fail together.
893
+ *
894
+ * @param mints Array of mint parameters for each token.
895
+ * @returns A promise that resolves with the transaction result.
896
+ *
897
+ * @example
898
+ * ```typescript
899
+ * const mints = [
900
+ * {
901
+ * to: "0x...",
902
+ * tokenId: 1n,
903
+ * creatorContentHash: "0x...",
904
+ * uri: "ipfs://...",
905
+ * licenseTerms: { price: 1000n, duration: 86400, royaltyBps: 500, paymentToken: zeroAddress, licenseType: 0 },
906
+ * deadline: BigInt(Date.now() + 600000),
907
+ * parents: [],
908
+ * isIP: true,
909
+ * appId: "myApp",
910
+ * signature: "0x...",
911
+ * },
912
+ * ];
913
+ * await origin.bulkMint(mints);
914
+ * ```
915
+ */
916
+ declare function bulkMint(this: Origin, mints: MintParams[]): Promise<any>;
917
+ /**
918
+ * Executes a fault-tolerant bulk mint of multiple IP-NFTs.
919
+ * Individual mints can fail without reverting the entire transaction.
920
+ *
921
+ * @param mints Array of mint parameters for each token.
922
+ * @returns A promise that resolves with the tolerant mint result including success/failure counts.
923
+ *
924
+ * @example
925
+ * ```typescript
926
+ * const result = await origin.bulkMintTolerant(mints);
927
+ * console.log(`Minted ${result.successCount} of ${mints.length} tokens`);
928
+ * console.log(`Failed tokens: ${result.failedTokenIds}`);
929
+ * ```
930
+ */
931
+ declare function bulkMintTolerant(this: Origin, mints: MintParams[]): Promise<any>;
932
+
922
933
  interface RoyaltyInfo {
923
934
  tokenBoundAccount: Address;
924
935
  balance: bigint;
925
936
  balanceFormatted: string;
926
937
  }
938
+ interface BulkMintFileEntry {
939
+ file: File;
940
+ metadata: Record<string, unknown>;
941
+ license: LicenseTerms;
942
+ parents?: bigint[];
943
+ previewImage?: File | null;
944
+ useAssetAsPreview?: boolean;
945
+ }
927
946
  type CallOptions = {
928
947
  value?: bigint;
929
948
  gas?: bigint;
@@ -954,14 +973,14 @@ declare class Origin {
954
973
  buyAccess: typeof buyAccess;
955
974
  hasAccess: typeof hasAccess;
956
975
  subscriptionExpiry: typeof subscriptionExpiry;
957
- settlePaymentIntent: typeof settlePaymentIntent;
958
- getDataWithIntent: typeof getDataWithIntent;
959
976
  bulkBuyAccess: typeof bulkBuyAccess;
960
977
  bulkBuyAccessTolerant: typeof bulkBuyAccessTolerant;
961
978
  bulkBuyAccessSmart: typeof bulkBuyAccessSmart;
962
979
  previewBulkCost: typeof previewBulkCost;
963
980
  buildPurchaseParams: typeof buildPurchaseParams;
964
981
  checkActiveStatus: typeof checkActiveStatus;
982
+ bulkMint: typeof bulkMint;
983
+ bulkMintTolerant: typeof bulkMintTolerant;
965
984
  raiseDispute: typeof raiseDispute;
966
985
  raiseDisputeSmart: typeof raiseDisputeSmart;
967
986
  disputeAssertion: typeof disputeAssertion;
@@ -1019,6 +1038,38 @@ declare class Origin {
1019
1038
  previewImage?: File | null;
1020
1039
  useAssetAsPreview?: boolean;
1021
1040
  }): Promise<string | null>;
1041
+ /**
1042
+ * Mints multiple file-based IpNFTs in a single transaction using the BatchOperations contract.
1043
+ * Each file is uploaded and registered individually, then all mints are batched into one on-chain call.
1044
+ *
1045
+ * @param entries Array of file entries to mint, each containing a file, metadata, license terms, and optional parents/preview.
1046
+ * @param options Optional configuration including tolerant mode and progress callback.
1047
+ * @returns A promise that resolves with an array of token ID strings for each entry, and the transaction result.
1048
+ *
1049
+ * @example
1050
+ * ```typescript
1051
+ * const result = await origin.bulkMintFile([
1052
+ * { file: file1, metadata: { name: "Asset 1" }, license: myLicense },
1053
+ * { file: file2, metadata: { name: "Asset 2" }, license: myLicense },
1054
+ * ]);
1055
+ * console.log(`Minted token IDs: ${result.tokenIds}`);
1056
+ *
1057
+ * // Tolerant mode - continue even if some mints fail
1058
+ * const result = await origin.bulkMintFile(entries, { tolerant: true });
1059
+ * ```
1060
+ */
1061
+ bulkMintFile(entries: BulkMintFileEntry[], options?: {
1062
+ tolerant?: boolean;
1063
+ progressCallback?: (progress: {
1064
+ fileIndex: number;
1065
+ fileCount: number;
1066
+ stage: "uploading" | "registering";
1067
+ percent: number;
1068
+ }) => void;
1069
+ }): Promise<{
1070
+ tokenIds: string[];
1071
+ result: any;
1072
+ }>;
1022
1073
  /**
1023
1074
  * Mints a social IpNFT.
1024
1075
  * @param source The social media source (spotify, twitter, tiktok).