@campnetwork/origin 1.2.3 → 1.2.5
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 +2 -0
- package/dist/core.cjs +97 -76
- package/dist/core.d.ts +29 -9
- package/dist/core.esm.d.ts +29 -9
- package/dist/core.esm.js +92 -71
- package/dist/react/index.esm.d.ts +29 -9
- package/dist/react/index.esm.js +190 -27
- package/package.json +1 -1
|
@@ -193,26 +193,28 @@ interface TransactionResult {
|
|
|
193
193
|
receipt?: any;
|
|
194
194
|
}
|
|
195
195
|
/**
|
|
196
|
-
*
|
|
196
|
+
* EXPERIMENTAL METHOD
|
|
197
|
+
* Settles a payment intent response by purchasing access if needed.
|
|
197
198
|
* This method checks if the user already has access to the item, and if not,
|
|
198
|
-
* it calls buyAccess with the parameters from the
|
|
199
|
+
* it calls buyAccess with the parameters from the payment intent response.
|
|
199
200
|
* Supports viem WalletClient, ethers Signer, and custom signer implementations.
|
|
200
201
|
*
|
|
201
|
-
* @param
|
|
202
|
+
* @param paymentIntentResponse - The response from getDataWithIntent containing payment details.
|
|
202
203
|
* @param signer - Optional signer object used to interact with the blockchain. If not provided, uses the connected wallet client.
|
|
203
204
|
* @returns A promise that resolves with the transaction hash and receipt, or null if access already exists.
|
|
204
205
|
* @throws {Error} If the response doesn't contain marketplace action or if the method is not buyAccess.
|
|
205
206
|
*/
|
|
206
|
-
declare function
|
|
207
|
+
declare function settlePaymentIntent(this: Origin, paymentIntentResponse: X402Response, signer?: any): Promise<TransactionResult | null>;
|
|
207
208
|
|
|
208
209
|
/**
|
|
210
|
+
* EXPERIMENTAL METHOD
|
|
209
211
|
* Fetch data with X402 payment handling.
|
|
210
212
|
* @param {bigint} tokenId The token ID to fetch data for.
|
|
211
213
|
* @param {any} [signer] Optional signer object for signing the X402 intent.
|
|
212
214
|
* @returns {Promise<any>} A promise that resolves with the fetched data.
|
|
213
215
|
* @throws {Error} Throws an error if the data cannot be fetched or if no signer/wallet client is provided.
|
|
214
216
|
*/
|
|
215
|
-
declare function
|
|
217
|
+
declare function getDataWithIntent(this: Origin, tokenId: bigint, signer?: any, decide?: (terms: any) => Promise<boolean>): Promise<any>;
|
|
216
218
|
|
|
217
219
|
interface RoyaltyInfo {
|
|
218
220
|
tokenBoundAccount: Address;
|
|
@@ -227,7 +229,7 @@ type CallOptions = {
|
|
|
227
229
|
};
|
|
228
230
|
/**
|
|
229
231
|
* The Origin class
|
|
230
|
-
* Handles
|
|
232
|
+
* Handles interactions with Origin protocol.
|
|
231
233
|
*/
|
|
232
234
|
declare class Origin {
|
|
233
235
|
#private;
|
|
@@ -249,18 +251,36 @@ declare class Origin {
|
|
|
249
251
|
buyAccess: typeof buyAccess;
|
|
250
252
|
hasAccess: typeof hasAccess;
|
|
251
253
|
subscriptionExpiry: typeof subscriptionExpiry;
|
|
252
|
-
|
|
253
|
-
|
|
254
|
+
settlePaymentIntent: typeof settlePaymentIntent;
|
|
255
|
+
getDataWithIntent: typeof getDataWithIntent;
|
|
254
256
|
private jwt?;
|
|
255
257
|
environment: Environment;
|
|
256
258
|
private viemClient?;
|
|
257
259
|
baseParentId?: bigint;
|
|
258
|
-
constructor(environment
|
|
260
|
+
constructor(environment?: Environment | string, jwt?: string, viemClient?: WalletClient, baseParentId?: bigint);
|
|
259
261
|
getJwt(): string | undefined;
|
|
260
262
|
setViemClient(client: WalletClient): void;
|
|
263
|
+
/**
|
|
264
|
+
* Mints a file-based IpNFT.
|
|
265
|
+
* @param file The file to mint.
|
|
266
|
+
* @param metadata The metadata associated with the file.
|
|
267
|
+
* @param license The license terms for the IpNFT.
|
|
268
|
+
* @param parents Optional parent token IDs for lineage tracking.
|
|
269
|
+
* @param options Optional parameters including progress callback, preview image, and use asset as preview flag.
|
|
270
|
+
* @returns The token ID of the minted IpNFT as a string, or null if minting failed.
|
|
271
|
+
*/
|
|
261
272
|
mintFile(file: File, metadata: Record<string, unknown>, license: LicenseTerms, parents?: bigint[], options?: {
|
|
262
273
|
progressCallback?: (percent: number) => void;
|
|
274
|
+
previewImage?: File | null;
|
|
275
|
+
useAssetAsPreview?: boolean;
|
|
263
276
|
}): Promise<string | null>;
|
|
277
|
+
/**
|
|
278
|
+
* Mints a social IpNFT.
|
|
279
|
+
* @param source The social media source (spotify, twitter, tiktok).
|
|
280
|
+
* @param metadata The metadata associated with the social media content.
|
|
281
|
+
* @param license The license terms for the IpNFT.
|
|
282
|
+
* @return The token ID of the minted IpNFT as a string, or null if minting failed.
|
|
283
|
+
*/
|
|
264
284
|
mintSocial(source: "spotify" | "twitter" | "tiktok", metadata: Record<string, unknown>, license: LicenseTerms): Promise<string | null>;
|
|
265
285
|
/**
|
|
266
286
|
* Call a contract method.
|