@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.
- package/README.md +75 -10
- package/dist/core.cjs +261 -221
- package/dist/core.d.ts +116 -56
- package/dist/core.esm.d.ts +116 -56
- package/dist/core.esm.js +282 -242
- package/dist/react/index.esm.d.ts +103 -52
- package/dist/react/index.esm.js +1099 -789
- package/package.json +1 -1
package/dist/core.d.ts
CHANGED
|
@@ -137,7 +137,7 @@ interface Environment {
|
|
|
137
137
|
ORIGIN_DASHBOARD: string;
|
|
138
138
|
DATANFT_CONTRACT_ADDRESS: string;
|
|
139
139
|
MARKETPLACE_CONTRACT_ADDRESS: string;
|
|
140
|
-
|
|
140
|
+
BATCH_OPERATIONS_CONTRACT_ADDRESS: string;
|
|
141
141
|
DISPUTE_CONTRACT_ADDRESS?: string;
|
|
142
142
|
FRACTIONALIZER_CONTRACT_ADDRESS?: string;
|
|
143
143
|
APP_REGISTRY_CONTRACT_ADDRESS?: string;
|
|
@@ -146,7 +146,7 @@ interface Environment {
|
|
|
146
146
|
IPNFT_ABI?: any;
|
|
147
147
|
MARKETPLACE_ABI?: any;
|
|
148
148
|
TBA_ABI?: any;
|
|
149
|
-
|
|
149
|
+
BATCH_OPERATIONS_ABI?: any;
|
|
150
150
|
DISPUTE_ABI?: any;
|
|
151
151
|
FRACTIONALIZER_ABI?: any;
|
|
152
152
|
APP_REGISTRY_ABI?: any;
|
|
@@ -383,54 +383,6 @@ declare function hasAccess(this: Origin, user: Address, tokenId: bigint): Promis
|
|
|
383
383
|
|
|
384
384
|
declare function subscriptionExpiry(this: Origin, tokenId: bigint, user: Address): Promise<bigint>;
|
|
385
385
|
|
|
386
|
-
/**
|
|
387
|
-
* Response from getDataWithX402 when payment is required
|
|
388
|
-
*/
|
|
389
|
-
interface X402Response {
|
|
390
|
-
error: string;
|
|
391
|
-
marketplaceAction?: {
|
|
392
|
-
kind: string;
|
|
393
|
-
contract: Address;
|
|
394
|
-
network: string;
|
|
395
|
-
chainId: number;
|
|
396
|
-
method: string;
|
|
397
|
-
payer: Address;
|
|
398
|
-
payTo: Address;
|
|
399
|
-
tokenId: string;
|
|
400
|
-
duration: number;
|
|
401
|
-
asset: Address;
|
|
402
|
-
amount: string;
|
|
403
|
-
amountFormatted: string;
|
|
404
|
-
};
|
|
405
|
-
}
|
|
406
|
-
interface TransactionResult {
|
|
407
|
-
txHash: string;
|
|
408
|
-
receipt?: any;
|
|
409
|
-
}
|
|
410
|
-
/**
|
|
411
|
-
* EXPERIMENTAL METHOD
|
|
412
|
-
* Settles a payment intent response by purchasing access if needed.
|
|
413
|
-
* This method checks if the user already has access to the item, and if not,
|
|
414
|
-
* it calls buyAccess with the parameters from the payment intent response.
|
|
415
|
-
* Supports viem WalletClient, ethers Signer, and custom signer implementations.
|
|
416
|
-
*
|
|
417
|
-
* @param paymentIntentResponse - The response from getDataWithIntent containing payment details.
|
|
418
|
-
* @param signer - Optional signer object used to interact with the blockchain. If not provided, uses the connected wallet client.
|
|
419
|
-
* @returns A promise that resolves with the transaction hash and receipt, or null if access already exists.
|
|
420
|
-
* @throws {Error} If the response doesn't contain marketplace action or if the method is not buyAccess.
|
|
421
|
-
*/
|
|
422
|
-
declare function settlePaymentIntent(this: Origin, paymentIntentResponse: X402Response, signer?: any): Promise<TransactionResult | null>;
|
|
423
|
-
|
|
424
|
-
/**
|
|
425
|
-
* EXPERIMENTAL METHOD
|
|
426
|
-
* Fetch data with X402 payment handling.
|
|
427
|
-
* @param {bigint} tokenId The token ID to fetch data for.
|
|
428
|
-
* @param {any} [signer] Optional signer object for signing the X402 intent.
|
|
429
|
-
* @returns {Promise<any>} A promise that resolves with the fetched data.
|
|
430
|
-
* @throws {Error} Throws an error if the data cannot be fetched or if no signer/wallet client is provided.
|
|
431
|
-
*/
|
|
432
|
-
declare function getDataWithIntent(this: Origin, tokenId: bigint, signer?: any, decide?: (terms: any) => Promise<boolean>): Promise<any>;
|
|
433
|
-
|
|
434
386
|
/**
|
|
435
387
|
* Raises a dispute against an IP NFT.
|
|
436
388
|
* Automatically handles token approval for ERC20 bonds or native token value.
|
|
@@ -489,12 +441,13 @@ interface RaiseDisputeSmartResult {
|
|
|
489
441
|
declare function raiseDisputeSmart(this: Origin, targetIpId: bigint, evidence: Record<string, any>, disputeTag: Hex): Promise<RaiseDisputeSmartResult>;
|
|
490
442
|
|
|
491
443
|
/**
|
|
492
|
-
* Encode
|
|
493
|
-
*
|
|
444
|
+
* Encode a CID to bytes32 by extracting the 32-byte SHA-256 digest.
|
|
445
|
+
* Supports both CIDv0 (starts with "Qm") and CIDv1 (starts with "bafy").
|
|
494
446
|
*/
|
|
495
447
|
declare function encodeCidToBytes32(cid: string): Hex;
|
|
496
448
|
/**
|
|
497
|
-
* Decode bytes32 back to
|
|
449
|
+
* Decode bytes32 back to CIDv1 format (base32, raw codec).
|
|
450
|
+
* Returns a CID starting with "bafkrei" that works with Pinata gateways for raw data uploads.
|
|
498
451
|
*/
|
|
499
452
|
declare function decodeCidFromBytes32(bytes32: Hex): string;
|
|
500
453
|
|
|
@@ -1078,11 +1031,86 @@ declare function bulkBuyAccessSmart(this: Origin, tokenIds: bigint[], options?:
|
|
|
1078
1031
|
tolerant?: boolean;
|
|
1079
1032
|
}): Promise<any>;
|
|
1080
1033
|
|
|
1034
|
+
/**
|
|
1035
|
+
* Parameters for a single mint in a bulk mint operation.
|
|
1036
|
+
* Maps to the contract's MintParams struct.
|
|
1037
|
+
*/
|
|
1038
|
+
interface MintParams {
|
|
1039
|
+
to: Address;
|
|
1040
|
+
tokenId: bigint;
|
|
1041
|
+
creatorContentHash: Hex;
|
|
1042
|
+
uri: string;
|
|
1043
|
+
licenseTerms: LicenseTerms;
|
|
1044
|
+
deadline: bigint;
|
|
1045
|
+
parents: bigint[];
|
|
1046
|
+
isIP: boolean;
|
|
1047
|
+
appId: string;
|
|
1048
|
+
signature: Hex;
|
|
1049
|
+
}
|
|
1050
|
+
/**
|
|
1051
|
+
* Result of a tolerant bulk mint operation.
|
|
1052
|
+
*/
|
|
1053
|
+
interface TolerantMintResult {
|
|
1054
|
+
successCount: bigint;
|
|
1055
|
+
failureCount: bigint;
|
|
1056
|
+
failedTokenIds: bigint[];
|
|
1057
|
+
}
|
|
1058
|
+
/**
|
|
1059
|
+
* Executes an atomic bulk mint of multiple IP-NFTs.
|
|
1060
|
+
* All mints succeed or all fail together.
|
|
1061
|
+
*
|
|
1062
|
+
* @param mints Array of mint parameters for each token.
|
|
1063
|
+
* @returns A promise that resolves with the transaction result.
|
|
1064
|
+
*
|
|
1065
|
+
* @example
|
|
1066
|
+
* ```typescript
|
|
1067
|
+
* const mints = [
|
|
1068
|
+
* {
|
|
1069
|
+
* to: "0x...",
|
|
1070
|
+
* tokenId: 1n,
|
|
1071
|
+
* creatorContentHash: "0x...",
|
|
1072
|
+
* uri: "ipfs://...",
|
|
1073
|
+
* licenseTerms: { price: 1000n, duration: 86400, royaltyBps: 500, paymentToken: zeroAddress, licenseType: 0 },
|
|
1074
|
+
* deadline: BigInt(Date.now() + 600000),
|
|
1075
|
+
* parents: [],
|
|
1076
|
+
* isIP: true,
|
|
1077
|
+
* appId: "myApp",
|
|
1078
|
+
* signature: "0x...",
|
|
1079
|
+
* },
|
|
1080
|
+
* ];
|
|
1081
|
+
* await origin.bulkMint(mints);
|
|
1082
|
+
* ```
|
|
1083
|
+
*/
|
|
1084
|
+
declare function bulkMint(this: Origin, mints: MintParams[]): Promise<any>;
|
|
1085
|
+
/**
|
|
1086
|
+
* Executes a fault-tolerant bulk mint of multiple IP-NFTs.
|
|
1087
|
+
* Individual mints can fail without reverting the entire transaction.
|
|
1088
|
+
*
|
|
1089
|
+
* @param mints Array of mint parameters for each token.
|
|
1090
|
+
* @returns A promise that resolves with the tolerant mint result including success/failure counts.
|
|
1091
|
+
*
|
|
1092
|
+
* @example
|
|
1093
|
+
* ```typescript
|
|
1094
|
+
* const result = await origin.bulkMintTolerant(mints);
|
|
1095
|
+
* console.log(`Minted ${result.successCount} of ${mints.length} tokens`);
|
|
1096
|
+
* console.log(`Failed tokens: ${result.failedTokenIds}`);
|
|
1097
|
+
* ```
|
|
1098
|
+
*/
|
|
1099
|
+
declare function bulkMintTolerant(this: Origin, mints: MintParams[]): Promise<any>;
|
|
1100
|
+
|
|
1081
1101
|
interface RoyaltyInfo {
|
|
1082
1102
|
tokenBoundAccount: Address;
|
|
1083
1103
|
balance: bigint;
|
|
1084
1104
|
balanceFormatted: string;
|
|
1085
1105
|
}
|
|
1106
|
+
interface BulkMintFileEntry {
|
|
1107
|
+
file: File;
|
|
1108
|
+
metadata: Record<string, unknown>;
|
|
1109
|
+
license: LicenseTerms;
|
|
1110
|
+
parents?: bigint[];
|
|
1111
|
+
previewImage?: File | null;
|
|
1112
|
+
useAssetAsPreview?: boolean;
|
|
1113
|
+
}
|
|
1086
1114
|
type CallOptions = {
|
|
1087
1115
|
value?: bigint;
|
|
1088
1116
|
gas?: bigint;
|
|
@@ -1113,14 +1141,14 @@ declare class Origin {
|
|
|
1113
1141
|
buyAccess: typeof buyAccess;
|
|
1114
1142
|
hasAccess: typeof hasAccess;
|
|
1115
1143
|
subscriptionExpiry: typeof subscriptionExpiry;
|
|
1116
|
-
settlePaymentIntent: typeof settlePaymentIntent;
|
|
1117
|
-
getDataWithIntent: typeof getDataWithIntent;
|
|
1118
1144
|
bulkBuyAccess: typeof bulkBuyAccess;
|
|
1119
1145
|
bulkBuyAccessTolerant: typeof bulkBuyAccessTolerant;
|
|
1120
1146
|
bulkBuyAccessSmart: typeof bulkBuyAccessSmart;
|
|
1121
1147
|
previewBulkCost: typeof previewBulkCost;
|
|
1122
1148
|
buildPurchaseParams: typeof buildPurchaseParams;
|
|
1123
1149
|
checkActiveStatus: typeof checkActiveStatus;
|
|
1150
|
+
bulkMint: typeof bulkMint;
|
|
1151
|
+
bulkMintTolerant: typeof bulkMintTolerant;
|
|
1124
1152
|
raiseDispute: typeof raiseDispute;
|
|
1125
1153
|
raiseDisputeSmart: typeof raiseDisputeSmart;
|
|
1126
1154
|
disputeAssertion: typeof disputeAssertion;
|
|
@@ -1178,6 +1206,38 @@ declare class Origin {
|
|
|
1178
1206
|
previewImage?: File | null;
|
|
1179
1207
|
useAssetAsPreview?: boolean;
|
|
1180
1208
|
}): Promise<string | null>;
|
|
1209
|
+
/**
|
|
1210
|
+
* Mints multiple file-based IpNFTs in a single transaction using the BatchOperations contract.
|
|
1211
|
+
* Each file is uploaded and registered individually, then all mints are batched into one on-chain call.
|
|
1212
|
+
*
|
|
1213
|
+
* @param entries Array of file entries to mint, each containing a file, metadata, license terms, and optional parents/preview.
|
|
1214
|
+
* @param options Optional configuration including tolerant mode and progress callback.
|
|
1215
|
+
* @returns A promise that resolves with an array of token ID strings for each entry, and the transaction result.
|
|
1216
|
+
*
|
|
1217
|
+
* @example
|
|
1218
|
+
* ```typescript
|
|
1219
|
+
* const result = await origin.bulkMintFile([
|
|
1220
|
+
* { file: file1, metadata: { name: "Asset 1" }, license: myLicense },
|
|
1221
|
+
* { file: file2, metadata: { name: "Asset 2" }, license: myLicense },
|
|
1222
|
+
* ]);
|
|
1223
|
+
* console.log(`Minted token IDs: ${result.tokenIds}`);
|
|
1224
|
+
*
|
|
1225
|
+
* // Tolerant mode - continue even if some mints fail
|
|
1226
|
+
* const result = await origin.bulkMintFile(entries, { tolerant: true });
|
|
1227
|
+
* ```
|
|
1228
|
+
*/
|
|
1229
|
+
bulkMintFile(entries: BulkMintFileEntry[], options?: {
|
|
1230
|
+
tolerant?: boolean;
|
|
1231
|
+
progressCallback?: (progress: {
|
|
1232
|
+
fileIndex: number;
|
|
1233
|
+
fileCount: number;
|
|
1234
|
+
stage: "uploading" | "registering";
|
|
1235
|
+
percent: number;
|
|
1236
|
+
}) => void;
|
|
1237
|
+
}): Promise<{
|
|
1238
|
+
tokenIds: string[];
|
|
1239
|
+
result: any;
|
|
1240
|
+
}>;
|
|
1181
1241
|
/**
|
|
1182
1242
|
* Mints a social IpNFT.
|
|
1183
1243
|
* @param source The social media source (spotify, twitter, tiktok).
|
|
@@ -1503,4 +1563,4 @@ declare class Auth {
|
|
|
1503
1563
|
unlinkTelegram(): Promise<any>;
|
|
1504
1564
|
}
|
|
1505
1565
|
|
|
1506
|
-
export { type AppInfo, Auth, type BaseSigner, BrowserStorage, type BulkCostPreview, type BuyParams, CustomSignerAdapter, DataStatus, type Dispute, type DisputeProgress, DisputeStatus, EthersSignerAdapter, type FractionOwnership, type FractionalizeEligibility, type LicenseTerms, LicenseType, MemoryStorage, Origin, type SignerAdapter, type SignerType, type StorageAdapter, type TokenInfo, type TolerantResult, ViemSignerAdapter, type VoteEligibility, mainnet as campMainnet, testnet as campTestnet, createLicenseTerms, createNodeWalletClient, createSignerAdapter, decodeCidFromBytes32, encodeCidToBytes32 };
|
|
1566
|
+
export { type AppInfo, Auth, type BaseSigner, BrowserStorage, type BulkCostPreview, type BulkMintFileEntry, type BuyParams, CustomSignerAdapter, DataStatus, type Dispute, type DisputeProgress, DisputeStatus, EthersSignerAdapter, type FractionOwnership, type FractionalizeEligibility, type LicenseTerms, LicenseType, MemoryStorage, type MintParams, Origin, type SignerAdapter, type SignerType, type StorageAdapter, type TokenInfo, type TolerantMintResult, type TolerantResult, ViemSignerAdapter, type VoteEligibility, mainnet as campMainnet, testnet as campTestnet, createLicenseTerms, createNodeWalletClient, createSignerAdapter, decodeCidFromBytes32, encodeCidToBytes32 };
|
package/dist/core.esm.d.ts
CHANGED
|
@@ -137,7 +137,7 @@ interface Environment {
|
|
|
137
137
|
ORIGIN_DASHBOARD: string;
|
|
138
138
|
DATANFT_CONTRACT_ADDRESS: string;
|
|
139
139
|
MARKETPLACE_CONTRACT_ADDRESS: string;
|
|
140
|
-
|
|
140
|
+
BATCH_OPERATIONS_CONTRACT_ADDRESS: string;
|
|
141
141
|
DISPUTE_CONTRACT_ADDRESS?: string;
|
|
142
142
|
FRACTIONALIZER_CONTRACT_ADDRESS?: string;
|
|
143
143
|
APP_REGISTRY_CONTRACT_ADDRESS?: string;
|
|
@@ -146,7 +146,7 @@ interface Environment {
|
|
|
146
146
|
IPNFT_ABI?: any;
|
|
147
147
|
MARKETPLACE_ABI?: any;
|
|
148
148
|
TBA_ABI?: any;
|
|
149
|
-
|
|
149
|
+
BATCH_OPERATIONS_ABI?: any;
|
|
150
150
|
DISPUTE_ABI?: any;
|
|
151
151
|
FRACTIONALIZER_ABI?: any;
|
|
152
152
|
APP_REGISTRY_ABI?: any;
|
|
@@ -383,54 +383,6 @@ declare function hasAccess(this: Origin, user: Address, tokenId: bigint): Promis
|
|
|
383
383
|
|
|
384
384
|
declare function subscriptionExpiry(this: Origin, tokenId: bigint, user: Address): Promise<bigint>;
|
|
385
385
|
|
|
386
|
-
/**
|
|
387
|
-
* Response from getDataWithX402 when payment is required
|
|
388
|
-
*/
|
|
389
|
-
interface X402Response {
|
|
390
|
-
error: string;
|
|
391
|
-
marketplaceAction?: {
|
|
392
|
-
kind: string;
|
|
393
|
-
contract: Address;
|
|
394
|
-
network: string;
|
|
395
|
-
chainId: number;
|
|
396
|
-
method: string;
|
|
397
|
-
payer: Address;
|
|
398
|
-
payTo: Address;
|
|
399
|
-
tokenId: string;
|
|
400
|
-
duration: number;
|
|
401
|
-
asset: Address;
|
|
402
|
-
amount: string;
|
|
403
|
-
amountFormatted: string;
|
|
404
|
-
};
|
|
405
|
-
}
|
|
406
|
-
interface TransactionResult {
|
|
407
|
-
txHash: string;
|
|
408
|
-
receipt?: any;
|
|
409
|
-
}
|
|
410
|
-
/**
|
|
411
|
-
* EXPERIMENTAL METHOD
|
|
412
|
-
* Settles a payment intent response by purchasing access if needed.
|
|
413
|
-
* This method checks if the user already has access to the item, and if not,
|
|
414
|
-
* it calls buyAccess with the parameters from the payment intent response.
|
|
415
|
-
* Supports viem WalletClient, ethers Signer, and custom signer implementations.
|
|
416
|
-
*
|
|
417
|
-
* @param paymentIntentResponse - The response from getDataWithIntent containing payment details.
|
|
418
|
-
* @param signer - Optional signer object used to interact with the blockchain. If not provided, uses the connected wallet client.
|
|
419
|
-
* @returns A promise that resolves with the transaction hash and receipt, or null if access already exists.
|
|
420
|
-
* @throws {Error} If the response doesn't contain marketplace action or if the method is not buyAccess.
|
|
421
|
-
*/
|
|
422
|
-
declare function settlePaymentIntent(this: Origin, paymentIntentResponse: X402Response, signer?: any): Promise<TransactionResult | null>;
|
|
423
|
-
|
|
424
|
-
/**
|
|
425
|
-
* EXPERIMENTAL METHOD
|
|
426
|
-
* Fetch data with X402 payment handling.
|
|
427
|
-
* @param {bigint} tokenId The token ID to fetch data for.
|
|
428
|
-
* @param {any} [signer] Optional signer object for signing the X402 intent.
|
|
429
|
-
* @returns {Promise<any>} A promise that resolves with the fetched data.
|
|
430
|
-
* @throws {Error} Throws an error if the data cannot be fetched or if no signer/wallet client is provided.
|
|
431
|
-
*/
|
|
432
|
-
declare function getDataWithIntent(this: Origin, tokenId: bigint, signer?: any, decide?: (terms: any) => Promise<boolean>): Promise<any>;
|
|
433
|
-
|
|
434
386
|
/**
|
|
435
387
|
* Raises a dispute against an IP NFT.
|
|
436
388
|
* Automatically handles token approval for ERC20 bonds or native token value.
|
|
@@ -489,12 +441,13 @@ interface RaiseDisputeSmartResult {
|
|
|
489
441
|
declare function raiseDisputeSmart(this: Origin, targetIpId: bigint, evidence: Record<string, any>, disputeTag: Hex): Promise<RaiseDisputeSmartResult>;
|
|
490
442
|
|
|
491
443
|
/**
|
|
492
|
-
* Encode
|
|
493
|
-
*
|
|
444
|
+
* Encode a CID to bytes32 by extracting the 32-byte SHA-256 digest.
|
|
445
|
+
* Supports both CIDv0 (starts with "Qm") and CIDv1 (starts with "bafy").
|
|
494
446
|
*/
|
|
495
447
|
declare function encodeCidToBytes32(cid: string): Hex;
|
|
496
448
|
/**
|
|
497
|
-
* Decode bytes32 back to
|
|
449
|
+
* Decode bytes32 back to CIDv1 format (base32, raw codec).
|
|
450
|
+
* Returns a CID starting with "bafkrei" that works with Pinata gateways for raw data uploads.
|
|
498
451
|
*/
|
|
499
452
|
declare function decodeCidFromBytes32(bytes32: Hex): string;
|
|
500
453
|
|
|
@@ -1078,11 +1031,86 @@ declare function bulkBuyAccessSmart(this: Origin, tokenIds: bigint[], options?:
|
|
|
1078
1031
|
tolerant?: boolean;
|
|
1079
1032
|
}): Promise<any>;
|
|
1080
1033
|
|
|
1034
|
+
/**
|
|
1035
|
+
* Parameters for a single mint in a bulk mint operation.
|
|
1036
|
+
* Maps to the contract's MintParams struct.
|
|
1037
|
+
*/
|
|
1038
|
+
interface MintParams {
|
|
1039
|
+
to: Address;
|
|
1040
|
+
tokenId: bigint;
|
|
1041
|
+
creatorContentHash: Hex;
|
|
1042
|
+
uri: string;
|
|
1043
|
+
licenseTerms: LicenseTerms;
|
|
1044
|
+
deadline: bigint;
|
|
1045
|
+
parents: bigint[];
|
|
1046
|
+
isIP: boolean;
|
|
1047
|
+
appId: string;
|
|
1048
|
+
signature: Hex;
|
|
1049
|
+
}
|
|
1050
|
+
/**
|
|
1051
|
+
* Result of a tolerant bulk mint operation.
|
|
1052
|
+
*/
|
|
1053
|
+
interface TolerantMintResult {
|
|
1054
|
+
successCount: bigint;
|
|
1055
|
+
failureCount: bigint;
|
|
1056
|
+
failedTokenIds: bigint[];
|
|
1057
|
+
}
|
|
1058
|
+
/**
|
|
1059
|
+
* Executes an atomic bulk mint of multiple IP-NFTs.
|
|
1060
|
+
* All mints succeed or all fail together.
|
|
1061
|
+
*
|
|
1062
|
+
* @param mints Array of mint parameters for each token.
|
|
1063
|
+
* @returns A promise that resolves with the transaction result.
|
|
1064
|
+
*
|
|
1065
|
+
* @example
|
|
1066
|
+
* ```typescript
|
|
1067
|
+
* const mints = [
|
|
1068
|
+
* {
|
|
1069
|
+
* to: "0x...",
|
|
1070
|
+
* tokenId: 1n,
|
|
1071
|
+
* creatorContentHash: "0x...",
|
|
1072
|
+
* uri: "ipfs://...",
|
|
1073
|
+
* licenseTerms: { price: 1000n, duration: 86400, royaltyBps: 500, paymentToken: zeroAddress, licenseType: 0 },
|
|
1074
|
+
* deadline: BigInt(Date.now() + 600000),
|
|
1075
|
+
* parents: [],
|
|
1076
|
+
* isIP: true,
|
|
1077
|
+
* appId: "myApp",
|
|
1078
|
+
* signature: "0x...",
|
|
1079
|
+
* },
|
|
1080
|
+
* ];
|
|
1081
|
+
* await origin.bulkMint(mints);
|
|
1082
|
+
* ```
|
|
1083
|
+
*/
|
|
1084
|
+
declare function bulkMint(this: Origin, mints: MintParams[]): Promise<any>;
|
|
1085
|
+
/**
|
|
1086
|
+
* Executes a fault-tolerant bulk mint of multiple IP-NFTs.
|
|
1087
|
+
* Individual mints can fail without reverting the entire transaction.
|
|
1088
|
+
*
|
|
1089
|
+
* @param mints Array of mint parameters for each token.
|
|
1090
|
+
* @returns A promise that resolves with the tolerant mint result including success/failure counts.
|
|
1091
|
+
*
|
|
1092
|
+
* @example
|
|
1093
|
+
* ```typescript
|
|
1094
|
+
* const result = await origin.bulkMintTolerant(mints);
|
|
1095
|
+
* console.log(`Minted ${result.successCount} of ${mints.length} tokens`);
|
|
1096
|
+
* console.log(`Failed tokens: ${result.failedTokenIds}`);
|
|
1097
|
+
* ```
|
|
1098
|
+
*/
|
|
1099
|
+
declare function bulkMintTolerant(this: Origin, mints: MintParams[]): Promise<any>;
|
|
1100
|
+
|
|
1081
1101
|
interface RoyaltyInfo {
|
|
1082
1102
|
tokenBoundAccount: Address;
|
|
1083
1103
|
balance: bigint;
|
|
1084
1104
|
balanceFormatted: string;
|
|
1085
1105
|
}
|
|
1106
|
+
interface BulkMintFileEntry {
|
|
1107
|
+
file: File;
|
|
1108
|
+
metadata: Record<string, unknown>;
|
|
1109
|
+
license: LicenseTerms;
|
|
1110
|
+
parents?: bigint[];
|
|
1111
|
+
previewImage?: File | null;
|
|
1112
|
+
useAssetAsPreview?: boolean;
|
|
1113
|
+
}
|
|
1086
1114
|
type CallOptions = {
|
|
1087
1115
|
value?: bigint;
|
|
1088
1116
|
gas?: bigint;
|
|
@@ -1113,14 +1141,14 @@ declare class Origin {
|
|
|
1113
1141
|
buyAccess: typeof buyAccess;
|
|
1114
1142
|
hasAccess: typeof hasAccess;
|
|
1115
1143
|
subscriptionExpiry: typeof subscriptionExpiry;
|
|
1116
|
-
settlePaymentIntent: typeof settlePaymentIntent;
|
|
1117
|
-
getDataWithIntent: typeof getDataWithIntent;
|
|
1118
1144
|
bulkBuyAccess: typeof bulkBuyAccess;
|
|
1119
1145
|
bulkBuyAccessTolerant: typeof bulkBuyAccessTolerant;
|
|
1120
1146
|
bulkBuyAccessSmart: typeof bulkBuyAccessSmart;
|
|
1121
1147
|
previewBulkCost: typeof previewBulkCost;
|
|
1122
1148
|
buildPurchaseParams: typeof buildPurchaseParams;
|
|
1123
1149
|
checkActiveStatus: typeof checkActiveStatus;
|
|
1150
|
+
bulkMint: typeof bulkMint;
|
|
1151
|
+
bulkMintTolerant: typeof bulkMintTolerant;
|
|
1124
1152
|
raiseDispute: typeof raiseDispute;
|
|
1125
1153
|
raiseDisputeSmart: typeof raiseDisputeSmart;
|
|
1126
1154
|
disputeAssertion: typeof disputeAssertion;
|
|
@@ -1178,6 +1206,38 @@ declare class Origin {
|
|
|
1178
1206
|
previewImage?: File | null;
|
|
1179
1207
|
useAssetAsPreview?: boolean;
|
|
1180
1208
|
}): Promise<string | null>;
|
|
1209
|
+
/**
|
|
1210
|
+
* Mints multiple file-based IpNFTs in a single transaction using the BatchOperations contract.
|
|
1211
|
+
* Each file is uploaded and registered individually, then all mints are batched into one on-chain call.
|
|
1212
|
+
*
|
|
1213
|
+
* @param entries Array of file entries to mint, each containing a file, metadata, license terms, and optional parents/preview.
|
|
1214
|
+
* @param options Optional configuration including tolerant mode and progress callback.
|
|
1215
|
+
* @returns A promise that resolves with an array of token ID strings for each entry, and the transaction result.
|
|
1216
|
+
*
|
|
1217
|
+
* @example
|
|
1218
|
+
* ```typescript
|
|
1219
|
+
* const result = await origin.bulkMintFile([
|
|
1220
|
+
* { file: file1, metadata: { name: "Asset 1" }, license: myLicense },
|
|
1221
|
+
* { file: file2, metadata: { name: "Asset 2" }, license: myLicense },
|
|
1222
|
+
* ]);
|
|
1223
|
+
* console.log(`Minted token IDs: ${result.tokenIds}`);
|
|
1224
|
+
*
|
|
1225
|
+
* // Tolerant mode - continue even if some mints fail
|
|
1226
|
+
* const result = await origin.bulkMintFile(entries, { tolerant: true });
|
|
1227
|
+
* ```
|
|
1228
|
+
*/
|
|
1229
|
+
bulkMintFile(entries: BulkMintFileEntry[], options?: {
|
|
1230
|
+
tolerant?: boolean;
|
|
1231
|
+
progressCallback?: (progress: {
|
|
1232
|
+
fileIndex: number;
|
|
1233
|
+
fileCount: number;
|
|
1234
|
+
stage: "uploading" | "registering";
|
|
1235
|
+
percent: number;
|
|
1236
|
+
}) => void;
|
|
1237
|
+
}): Promise<{
|
|
1238
|
+
tokenIds: string[];
|
|
1239
|
+
result: any;
|
|
1240
|
+
}>;
|
|
1181
1241
|
/**
|
|
1182
1242
|
* Mints a social IpNFT.
|
|
1183
1243
|
* @param source The social media source (spotify, twitter, tiktok).
|
|
@@ -1503,4 +1563,4 @@ declare class Auth {
|
|
|
1503
1563
|
unlinkTelegram(): Promise<any>;
|
|
1504
1564
|
}
|
|
1505
1565
|
|
|
1506
|
-
export { type AppInfo, Auth, type BaseSigner, BrowserStorage, type BulkCostPreview, type BuyParams, CustomSignerAdapter, DataStatus, type Dispute, type DisputeProgress, DisputeStatus, EthersSignerAdapter, type FractionOwnership, type FractionalizeEligibility, type LicenseTerms, LicenseType, MemoryStorage, Origin, type SignerAdapter, type SignerType, type StorageAdapter, type TokenInfo, type TolerantResult, ViemSignerAdapter, type VoteEligibility, mainnet as campMainnet, testnet as campTestnet, createLicenseTerms, createNodeWalletClient, createSignerAdapter, decodeCidFromBytes32, encodeCidToBytes32 };
|
|
1566
|
+
export { type AppInfo, Auth, type BaseSigner, BrowserStorage, type BulkCostPreview, type BulkMintFileEntry, type BuyParams, CustomSignerAdapter, DataStatus, type Dispute, type DisputeProgress, DisputeStatus, EthersSignerAdapter, type FractionOwnership, type FractionalizeEligibility, type LicenseTerms, LicenseType, MemoryStorage, type MintParams, Origin, type SignerAdapter, type SignerType, type StorageAdapter, type TokenInfo, type TolerantMintResult, type TolerantResult, ViemSignerAdapter, type VoteEligibility, mainnet as campMainnet, testnet as campTestnet, createLicenseTerms, createNodeWalletClient, createSignerAdapter, decodeCidFromBytes32, encodeCidToBytes32 };
|