@campnetwork/origin 0.0.1 → 0.0.3
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/dist/core.cjs +108 -124
- package/dist/core.d.ts +149 -94
- package/dist/core.esm.d.ts +149 -94
- package/dist/core.esm.js +113 -129
- package/dist/react/index.esm.d.ts +361 -2
- package/dist/react/index.esm.js +3153 -566
- package/package.json +1 -1
package/dist/core.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Abi } from 'viem';
|
|
1
|
+
import { Address, Hex, Abi } from 'viem';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* The TwitterAPI class.
|
|
@@ -196,6 +196,99 @@ declare class SpotifyAPI {
|
|
|
196
196
|
_fetchDataWithAuth(url: string): Promise<object>;
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
+
/**
|
|
200
|
+
* Represents the terms of a license for a digital asset.
|
|
201
|
+
* @property price - The price of the asset in wei.
|
|
202
|
+
* @property duration - The duration of the license in seconds.
|
|
203
|
+
* @property royaltyBps - The royalty percentage in basis points (0-10000).
|
|
204
|
+
* @property paymentToken - The address of the payment token (ERC20 / address(0) for native currency).
|
|
205
|
+
*/
|
|
206
|
+
type LicenseTerms = {
|
|
207
|
+
price: bigint;
|
|
208
|
+
duration: number;
|
|
209
|
+
royaltyBps: number;
|
|
210
|
+
paymentToken: Address;
|
|
211
|
+
};
|
|
212
|
+
/**
|
|
213
|
+
* Enum representing the status of data in the system.
|
|
214
|
+
* * - ACTIVE: The data is currently active and available.
|
|
215
|
+
* * - PENDING_DELETE: The data is scheduled for deletion but not yet removed.
|
|
216
|
+
* * - DELETED: The data has been deleted and is no longer available.
|
|
217
|
+
*/
|
|
218
|
+
declare enum DataStatus {
|
|
219
|
+
ACTIVE = 0,
|
|
220
|
+
PENDING_DELETE = 1,
|
|
221
|
+
DELETED = 2
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Represents the source of a Data NFT.
|
|
225
|
+
* This can be one of the supported social media platforms or a file upload.
|
|
226
|
+
*/
|
|
227
|
+
type DataNFTSource = "spotify" | "twitter" | "tiktok" | "file";
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Mints a Data NFT with a signature.
|
|
231
|
+
* @param to The address to mint the NFT to.
|
|
232
|
+
* @param tokenId The ID of the token to mint.
|
|
233
|
+
* @param hash The hash of the data associated with the NFT.
|
|
234
|
+
* @param uri The URI of the NFT metadata.
|
|
235
|
+
* @param licenseTerms The terms of the license for the NFT.
|
|
236
|
+
* @param deadline The deadline for the minting operation.
|
|
237
|
+
* @param signature The signature for the minting operation.
|
|
238
|
+
* @returns A promise that resolves when the minting is complete.
|
|
239
|
+
*/
|
|
240
|
+
declare function mintWithSignature(this: Origin, to: Address, tokenId: bigint, hash: Hex, uri: string, licenseTerms: LicenseTerms, deadline: bigint, signature: {
|
|
241
|
+
v: number;
|
|
242
|
+
r: Hex;
|
|
243
|
+
s: Hex;
|
|
244
|
+
}): Promise<any>;
|
|
245
|
+
/**
|
|
246
|
+
* Registers a Data NFT with the Origin service in order to obtain a signature for minting.
|
|
247
|
+
* @param source The source of the Data NFT (e.g., "spotify", "twitter", "tiktok", or "file").
|
|
248
|
+
* @param deadline The deadline for the registration operation.
|
|
249
|
+
* @param fileKey Optional file key for file uploads.
|
|
250
|
+
* @return A promise that resolves with the registration data.
|
|
251
|
+
*/
|
|
252
|
+
declare function registerDataNFT(this: Origin, source: DataNFTSource, deadline: bigint, fileKey?: string | string[]): Promise<any>;
|
|
253
|
+
|
|
254
|
+
declare function updateTerms(this: Origin, tokenId: bigint, newTerms: LicenseTerms): Promise<any>;
|
|
255
|
+
|
|
256
|
+
declare function requestDelete(this: Origin, tokenId: bigint): Promise<any>;
|
|
257
|
+
|
|
258
|
+
declare function getTerms(this: Origin, tokenId: bigint): Promise<any>;
|
|
259
|
+
|
|
260
|
+
declare function ownerOf(this: Origin, tokenId: bigint): Promise<any>;
|
|
261
|
+
|
|
262
|
+
declare function balanceOf(this: Origin, owner: Address): Promise<any>;
|
|
263
|
+
|
|
264
|
+
declare function contentHash(this: Origin, tokenId: bigint): Promise<any>;
|
|
265
|
+
|
|
266
|
+
declare function tokenURI(this: Origin, tokenId: bigint): Promise<any>;
|
|
267
|
+
|
|
268
|
+
declare function dataStatus(this: Origin, tokenId: bigint): Promise<DataStatus>;
|
|
269
|
+
|
|
270
|
+
declare function royaltyInfo(this: Origin, tokenId: bigint, salePrice: bigint): Promise<[Address, bigint]>;
|
|
271
|
+
|
|
272
|
+
declare function getApproved(this: Origin, tokenId: bigint): Promise<Address>;
|
|
273
|
+
|
|
274
|
+
declare function isApprovedForAll(this: Origin, owner: Address, operator: Address): Promise<boolean>;
|
|
275
|
+
|
|
276
|
+
declare function transferFrom(this: Origin, from: Address, to: Address, tokenId: bigint): Promise<any>;
|
|
277
|
+
|
|
278
|
+
declare function safeTransferFrom(this: Origin, from: Address, to: Address, tokenId: bigint, data?: Hex): Promise<any>;
|
|
279
|
+
|
|
280
|
+
declare function approve(this: Origin, to: Address, tokenId: bigint): Promise<any>;
|
|
281
|
+
|
|
282
|
+
declare function setApprovalForAll(this: Origin, operator: Address, approved: boolean): Promise<any>;
|
|
283
|
+
|
|
284
|
+
declare function buyAccess(this: Origin, tokenId: bigint, periods: number, value?: bigint): Promise<any>;
|
|
285
|
+
|
|
286
|
+
declare function renewAccess(this: Origin, tokenId: bigint, buyer: Address, periods: number, value?: bigint): Promise<any>;
|
|
287
|
+
|
|
288
|
+
declare function hasAccess(this: Origin, user: Address, tokenId: bigint): Promise<boolean>;
|
|
289
|
+
|
|
290
|
+
declare function subscriptionExpiry(this: Origin, tokenId: bigint, user: Address): Promise<bigint>;
|
|
291
|
+
|
|
199
292
|
interface OriginUsageReturnType {
|
|
200
293
|
user: {
|
|
201
294
|
multiplier: number;
|
|
@@ -205,17 +298,50 @@ interface OriginUsageReturnType {
|
|
|
205
298
|
teams: Array<any>;
|
|
206
299
|
dataSources: Array<any>;
|
|
207
300
|
}
|
|
301
|
+
type CallOptions = {
|
|
302
|
+
value?: bigint;
|
|
303
|
+
gas?: bigint;
|
|
304
|
+
waitForReceipt?: boolean;
|
|
305
|
+
};
|
|
208
306
|
/**
|
|
209
307
|
* The Origin class
|
|
210
308
|
* Handles the upload of files to Origin, as well as querying the user's stats
|
|
211
309
|
*/
|
|
212
310
|
declare class Origin {
|
|
213
311
|
#private;
|
|
312
|
+
mintWithSignature: typeof mintWithSignature;
|
|
313
|
+
registerDataNFT: typeof registerDataNFT;
|
|
314
|
+
updateTerms: typeof updateTerms;
|
|
315
|
+
requestDelete: typeof requestDelete;
|
|
316
|
+
getTerms: typeof getTerms;
|
|
317
|
+
ownerOf: typeof ownerOf;
|
|
318
|
+
balanceOf: typeof balanceOf;
|
|
319
|
+
contentHash: typeof contentHash;
|
|
320
|
+
tokenURI: typeof tokenURI;
|
|
321
|
+
dataStatus: typeof dataStatus;
|
|
322
|
+
royaltyInfo: typeof royaltyInfo;
|
|
323
|
+
getApproved: typeof getApproved;
|
|
324
|
+
isApprovedForAll: typeof isApprovedForAll;
|
|
325
|
+
transferFrom: typeof transferFrom;
|
|
326
|
+
safeTransferFrom: typeof safeTransferFrom;
|
|
327
|
+
approve: typeof approve;
|
|
328
|
+
setApprovalForAll: typeof setApprovalForAll;
|
|
329
|
+
buyAccess: typeof buyAccess;
|
|
330
|
+
renewAccess: typeof renewAccess;
|
|
331
|
+
hasAccess: typeof hasAccess;
|
|
332
|
+
subscriptionExpiry: typeof subscriptionExpiry;
|
|
214
333
|
private jwt;
|
|
215
|
-
|
|
334
|
+
private viemClient?;
|
|
335
|
+
constructor(jwt: string, viemClient?: any);
|
|
336
|
+
getJwt(): string;
|
|
337
|
+
setViemClient(client: any): void;
|
|
216
338
|
uploadFile: (file: File, options?: {
|
|
217
339
|
progressCallback?: (percent: number) => void;
|
|
218
|
-
}) => Promise<
|
|
340
|
+
}) => Promise<any>;
|
|
341
|
+
mintFile: (file: File, license: LicenseTerms, options?: {
|
|
342
|
+
progressCallback?: (percent: number) => void;
|
|
343
|
+
}) => Promise<string | null>;
|
|
344
|
+
mintSocial: (source: "spotify" | "twitter" | "tiktok") => Promise<string | null>;
|
|
219
345
|
getOriginUploads: () => Promise<any>;
|
|
220
346
|
/**
|
|
221
347
|
* Get the user's Origin stats (multiplier, consent, usage, etc.).
|
|
@@ -236,6 +362,25 @@ declare class Origin {
|
|
|
236
362
|
* @throws {Error|APIError} - Throws an error if the user is not authenticated. Also throws an error if the multiplier is not provided.
|
|
237
363
|
*/
|
|
238
364
|
setOriginMultiplier(multiplier: number): Promise<void>;
|
|
365
|
+
/**
|
|
366
|
+
* Call a contract method.
|
|
367
|
+
* @param {string} contractAddress The contract address.
|
|
368
|
+
* @param {Abi} abi The contract ABI.
|
|
369
|
+
* @param {string} methodName The method name.
|
|
370
|
+
* @param {any[]} params The method parameters.
|
|
371
|
+
* @param {CallOptions} [options] The call options.
|
|
372
|
+
* @returns {Promise<any>} A promise that resolves with the result of the contract call or transaction hash.
|
|
373
|
+
* @throws {Error} - Throws an error if the wallet client is not connected and the method is not a view function.
|
|
374
|
+
*/
|
|
375
|
+
callContractMethod(contractAddress: string, abi: Abi, methodName: string, params: any[], options?: CallOptions): Promise<any>;
|
|
376
|
+
/**
|
|
377
|
+
* Buy access to an asset by first checking its price via getTerms, then calling buyAccess.
|
|
378
|
+
* @param {bigint} tokenId The token ID of the asset.
|
|
379
|
+
* @param {number} periods The number of periods to buy access for.
|
|
380
|
+
* @returns {Promise<any>} The result of the buyAccess call.
|
|
381
|
+
*/
|
|
382
|
+
buyAccessSmart(tokenId: bigint, periods: number): Promise<any>;
|
|
383
|
+
getData(tokenId: bigint): Promise<any>;
|
|
239
384
|
}
|
|
240
385
|
|
|
241
386
|
declare global {
|
|
@@ -243,11 +388,6 @@ declare global {
|
|
|
243
388
|
ethereum?: any;
|
|
244
389
|
}
|
|
245
390
|
}
|
|
246
|
-
type CallOptions = {
|
|
247
|
-
value?: bigint;
|
|
248
|
-
gas?: bigint;
|
|
249
|
-
waitForReceipt?: boolean;
|
|
250
|
-
};
|
|
251
391
|
/**
|
|
252
392
|
* The Auth class.
|
|
253
393
|
* @class
|
|
@@ -413,91 +553,6 @@ declare class Auth {
|
|
|
413
553
|
* @throws {APIError} - Throws an error if the request fails.
|
|
414
554
|
*/
|
|
415
555
|
unlinkTelegram(): Promise<any>;
|
|
416
|
-
/**
|
|
417
|
-
* Call a contract method.
|
|
418
|
-
* @param {string} contractAddress The contract address.
|
|
419
|
-
* @param {Abi} abi The contract ABI.
|
|
420
|
-
* @param {string} methodName The method name.
|
|
421
|
-
* @param {any[]} params The method parameters.
|
|
422
|
-
* @param {CallOptions} [options] The call options.
|
|
423
|
-
* @returns {Promise<any>} A promise that resolves with the result of the contract call or transaction hash.
|
|
424
|
-
* @throws {Error} - Throws an error if the wallet client is not connected or if the method is not a view function.
|
|
425
|
-
*/
|
|
426
|
-
callContractMethod(contractAddress: string, abi: Abi, methodName: string, params: any[], options?: CallOptions): Promise<any>;
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
/**
|
|
430
|
-
The MIT License (MIT)
|
|
431
|
-
|
|
432
|
-
Copyright (c) Tobias Reich
|
|
433
|
-
|
|
434
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
435
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
436
|
-
in the Software without restriction, including without limitation the rights
|
|
437
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
438
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
439
|
-
furnished to do so, subject to the following conditions:
|
|
440
|
-
|
|
441
|
-
The above copyright notice and this permission notice shall be included in
|
|
442
|
-
all copies or substantial portions of the Software.
|
|
443
|
-
|
|
444
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
445
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
446
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
447
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
448
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
449
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
450
|
-
THE SOFTWARE.
|
|
451
|
-
*/
|
|
452
|
-
interface Options {
|
|
453
|
-
detailed?: boolean;
|
|
454
|
-
ignoreLocalhost?: boolean;
|
|
455
|
-
ignoreOwnVisits?: boolean;
|
|
456
|
-
}
|
|
457
|
-
interface Attributes {
|
|
458
|
-
siteLocation: string;
|
|
459
|
-
siteReferrer: string;
|
|
460
|
-
source?: string;
|
|
461
|
-
siteLanguage?: string;
|
|
462
|
-
screenWidth?: number;
|
|
463
|
-
screenHeight?: number;
|
|
464
|
-
screenColorDepth?: number;
|
|
465
|
-
browserWidth?: number;
|
|
466
|
-
browserHeight?: number;
|
|
467
|
-
}
|
|
468
|
-
/**
|
|
469
|
-
* Gathers all platform-, screen- and user-related information.
|
|
470
|
-
* @param {Boolean} detailed - Include personal data.
|
|
471
|
-
* @returns {Object} attributes - User-related information.
|
|
472
|
-
*/
|
|
473
|
-
declare const attributes: (detailed?: boolean) => Attributes;
|
|
474
|
-
/**
|
|
475
|
-
* Looks for an element with Ackee attributes and executes Ackee with the given attributes.
|
|
476
|
-
* Fails silently.
|
|
477
|
-
*/
|
|
478
|
-
declare const detect: () => void;
|
|
479
|
-
/**
|
|
480
|
-
* Creates a new instance.
|
|
481
|
-
* @param {String} server - URL of the Ackee server.
|
|
482
|
-
* @param {?Object} opts
|
|
483
|
-
* @returns {Object} instance
|
|
484
|
-
*/
|
|
485
|
-
declare const create: (server: string, opts?: Options) => {
|
|
486
|
-
record: (domainId: string, attrs?: Attributes, next?: (recordId: string) => void) => {
|
|
487
|
-
stop: () => void;
|
|
488
|
-
};
|
|
489
|
-
updateRecord: (recordId: string) => {
|
|
490
|
-
stop: () => void;
|
|
491
|
-
};
|
|
492
|
-
action: (eventId: string, attrs: any, next?: (actionId: string) => void) => void;
|
|
493
|
-
updateAction: (actionId: string, attrs: any) => void;
|
|
494
|
-
};
|
|
495
|
-
|
|
496
|
-
declare const ackeeUtil_attributes: typeof attributes;
|
|
497
|
-
declare const ackeeUtil_create: typeof create;
|
|
498
|
-
declare const ackeeUtil_detect: typeof detect;
|
|
499
|
-
declare namespace ackeeUtil {
|
|
500
|
-
export { ackeeUtil_attributes as attributes, ackeeUtil_create as create, ackeeUtil_detect as detect };
|
|
501
556
|
}
|
|
502
557
|
|
|
503
|
-
export {
|
|
558
|
+
export { Auth, SpotifyAPI, TwitterAPI };
|
package/dist/core.esm.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Abi } from 'viem';
|
|
1
|
+
import { Address, Hex, Abi } from 'viem';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* The TwitterAPI class.
|
|
@@ -196,6 +196,99 @@ declare class SpotifyAPI {
|
|
|
196
196
|
_fetchDataWithAuth(url: string): Promise<object>;
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
+
/**
|
|
200
|
+
* Represents the terms of a license for a digital asset.
|
|
201
|
+
* @property price - The price of the asset in wei.
|
|
202
|
+
* @property duration - The duration of the license in seconds.
|
|
203
|
+
* @property royaltyBps - The royalty percentage in basis points (0-10000).
|
|
204
|
+
* @property paymentToken - The address of the payment token (ERC20 / address(0) for native currency).
|
|
205
|
+
*/
|
|
206
|
+
type LicenseTerms = {
|
|
207
|
+
price: bigint;
|
|
208
|
+
duration: number;
|
|
209
|
+
royaltyBps: number;
|
|
210
|
+
paymentToken: Address;
|
|
211
|
+
};
|
|
212
|
+
/**
|
|
213
|
+
* Enum representing the status of data in the system.
|
|
214
|
+
* * - ACTIVE: The data is currently active and available.
|
|
215
|
+
* * - PENDING_DELETE: The data is scheduled for deletion but not yet removed.
|
|
216
|
+
* * - DELETED: The data has been deleted and is no longer available.
|
|
217
|
+
*/
|
|
218
|
+
declare enum DataStatus {
|
|
219
|
+
ACTIVE = 0,
|
|
220
|
+
PENDING_DELETE = 1,
|
|
221
|
+
DELETED = 2
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Represents the source of a Data NFT.
|
|
225
|
+
* This can be one of the supported social media platforms or a file upload.
|
|
226
|
+
*/
|
|
227
|
+
type DataNFTSource = "spotify" | "twitter" | "tiktok" | "file";
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Mints a Data NFT with a signature.
|
|
231
|
+
* @param to The address to mint the NFT to.
|
|
232
|
+
* @param tokenId The ID of the token to mint.
|
|
233
|
+
* @param hash The hash of the data associated with the NFT.
|
|
234
|
+
* @param uri The URI of the NFT metadata.
|
|
235
|
+
* @param licenseTerms The terms of the license for the NFT.
|
|
236
|
+
* @param deadline The deadline for the minting operation.
|
|
237
|
+
* @param signature The signature for the minting operation.
|
|
238
|
+
* @returns A promise that resolves when the minting is complete.
|
|
239
|
+
*/
|
|
240
|
+
declare function mintWithSignature(this: Origin, to: Address, tokenId: bigint, hash: Hex, uri: string, licenseTerms: LicenseTerms, deadline: bigint, signature: {
|
|
241
|
+
v: number;
|
|
242
|
+
r: Hex;
|
|
243
|
+
s: Hex;
|
|
244
|
+
}): Promise<any>;
|
|
245
|
+
/**
|
|
246
|
+
* Registers a Data NFT with the Origin service in order to obtain a signature for minting.
|
|
247
|
+
* @param source The source of the Data NFT (e.g., "spotify", "twitter", "tiktok", or "file").
|
|
248
|
+
* @param deadline The deadline for the registration operation.
|
|
249
|
+
* @param fileKey Optional file key for file uploads.
|
|
250
|
+
* @return A promise that resolves with the registration data.
|
|
251
|
+
*/
|
|
252
|
+
declare function registerDataNFT(this: Origin, source: DataNFTSource, deadline: bigint, fileKey?: string | string[]): Promise<any>;
|
|
253
|
+
|
|
254
|
+
declare function updateTerms(this: Origin, tokenId: bigint, newTerms: LicenseTerms): Promise<any>;
|
|
255
|
+
|
|
256
|
+
declare function requestDelete(this: Origin, tokenId: bigint): Promise<any>;
|
|
257
|
+
|
|
258
|
+
declare function getTerms(this: Origin, tokenId: bigint): Promise<any>;
|
|
259
|
+
|
|
260
|
+
declare function ownerOf(this: Origin, tokenId: bigint): Promise<any>;
|
|
261
|
+
|
|
262
|
+
declare function balanceOf(this: Origin, owner: Address): Promise<any>;
|
|
263
|
+
|
|
264
|
+
declare function contentHash(this: Origin, tokenId: bigint): Promise<any>;
|
|
265
|
+
|
|
266
|
+
declare function tokenURI(this: Origin, tokenId: bigint): Promise<any>;
|
|
267
|
+
|
|
268
|
+
declare function dataStatus(this: Origin, tokenId: bigint): Promise<DataStatus>;
|
|
269
|
+
|
|
270
|
+
declare function royaltyInfo(this: Origin, tokenId: bigint, salePrice: bigint): Promise<[Address, bigint]>;
|
|
271
|
+
|
|
272
|
+
declare function getApproved(this: Origin, tokenId: bigint): Promise<Address>;
|
|
273
|
+
|
|
274
|
+
declare function isApprovedForAll(this: Origin, owner: Address, operator: Address): Promise<boolean>;
|
|
275
|
+
|
|
276
|
+
declare function transferFrom(this: Origin, from: Address, to: Address, tokenId: bigint): Promise<any>;
|
|
277
|
+
|
|
278
|
+
declare function safeTransferFrom(this: Origin, from: Address, to: Address, tokenId: bigint, data?: Hex): Promise<any>;
|
|
279
|
+
|
|
280
|
+
declare function approve(this: Origin, to: Address, tokenId: bigint): Promise<any>;
|
|
281
|
+
|
|
282
|
+
declare function setApprovalForAll(this: Origin, operator: Address, approved: boolean): Promise<any>;
|
|
283
|
+
|
|
284
|
+
declare function buyAccess(this: Origin, tokenId: bigint, periods: number, value?: bigint): Promise<any>;
|
|
285
|
+
|
|
286
|
+
declare function renewAccess(this: Origin, tokenId: bigint, buyer: Address, periods: number, value?: bigint): Promise<any>;
|
|
287
|
+
|
|
288
|
+
declare function hasAccess(this: Origin, user: Address, tokenId: bigint): Promise<boolean>;
|
|
289
|
+
|
|
290
|
+
declare function subscriptionExpiry(this: Origin, tokenId: bigint, user: Address): Promise<bigint>;
|
|
291
|
+
|
|
199
292
|
interface OriginUsageReturnType {
|
|
200
293
|
user: {
|
|
201
294
|
multiplier: number;
|
|
@@ -205,17 +298,50 @@ interface OriginUsageReturnType {
|
|
|
205
298
|
teams: Array<any>;
|
|
206
299
|
dataSources: Array<any>;
|
|
207
300
|
}
|
|
301
|
+
type CallOptions = {
|
|
302
|
+
value?: bigint;
|
|
303
|
+
gas?: bigint;
|
|
304
|
+
waitForReceipt?: boolean;
|
|
305
|
+
};
|
|
208
306
|
/**
|
|
209
307
|
* The Origin class
|
|
210
308
|
* Handles the upload of files to Origin, as well as querying the user's stats
|
|
211
309
|
*/
|
|
212
310
|
declare class Origin {
|
|
213
311
|
#private;
|
|
312
|
+
mintWithSignature: typeof mintWithSignature;
|
|
313
|
+
registerDataNFT: typeof registerDataNFT;
|
|
314
|
+
updateTerms: typeof updateTerms;
|
|
315
|
+
requestDelete: typeof requestDelete;
|
|
316
|
+
getTerms: typeof getTerms;
|
|
317
|
+
ownerOf: typeof ownerOf;
|
|
318
|
+
balanceOf: typeof balanceOf;
|
|
319
|
+
contentHash: typeof contentHash;
|
|
320
|
+
tokenURI: typeof tokenURI;
|
|
321
|
+
dataStatus: typeof dataStatus;
|
|
322
|
+
royaltyInfo: typeof royaltyInfo;
|
|
323
|
+
getApproved: typeof getApproved;
|
|
324
|
+
isApprovedForAll: typeof isApprovedForAll;
|
|
325
|
+
transferFrom: typeof transferFrom;
|
|
326
|
+
safeTransferFrom: typeof safeTransferFrom;
|
|
327
|
+
approve: typeof approve;
|
|
328
|
+
setApprovalForAll: typeof setApprovalForAll;
|
|
329
|
+
buyAccess: typeof buyAccess;
|
|
330
|
+
renewAccess: typeof renewAccess;
|
|
331
|
+
hasAccess: typeof hasAccess;
|
|
332
|
+
subscriptionExpiry: typeof subscriptionExpiry;
|
|
214
333
|
private jwt;
|
|
215
|
-
|
|
334
|
+
private viemClient?;
|
|
335
|
+
constructor(jwt: string, viemClient?: any);
|
|
336
|
+
getJwt(): string;
|
|
337
|
+
setViemClient(client: any): void;
|
|
216
338
|
uploadFile: (file: File, options?: {
|
|
217
339
|
progressCallback?: (percent: number) => void;
|
|
218
|
-
}) => Promise<
|
|
340
|
+
}) => Promise<any>;
|
|
341
|
+
mintFile: (file: File, license: LicenseTerms, options?: {
|
|
342
|
+
progressCallback?: (percent: number) => void;
|
|
343
|
+
}) => Promise<string | null>;
|
|
344
|
+
mintSocial: (source: "spotify" | "twitter" | "tiktok") => Promise<string | null>;
|
|
219
345
|
getOriginUploads: () => Promise<any>;
|
|
220
346
|
/**
|
|
221
347
|
* Get the user's Origin stats (multiplier, consent, usage, etc.).
|
|
@@ -236,6 +362,25 @@ declare class Origin {
|
|
|
236
362
|
* @throws {Error|APIError} - Throws an error if the user is not authenticated. Also throws an error if the multiplier is not provided.
|
|
237
363
|
*/
|
|
238
364
|
setOriginMultiplier(multiplier: number): Promise<void>;
|
|
365
|
+
/**
|
|
366
|
+
* Call a contract method.
|
|
367
|
+
* @param {string} contractAddress The contract address.
|
|
368
|
+
* @param {Abi} abi The contract ABI.
|
|
369
|
+
* @param {string} methodName The method name.
|
|
370
|
+
* @param {any[]} params The method parameters.
|
|
371
|
+
* @param {CallOptions} [options] The call options.
|
|
372
|
+
* @returns {Promise<any>} A promise that resolves with the result of the contract call or transaction hash.
|
|
373
|
+
* @throws {Error} - Throws an error if the wallet client is not connected and the method is not a view function.
|
|
374
|
+
*/
|
|
375
|
+
callContractMethod(contractAddress: string, abi: Abi, methodName: string, params: any[], options?: CallOptions): Promise<any>;
|
|
376
|
+
/**
|
|
377
|
+
* Buy access to an asset by first checking its price via getTerms, then calling buyAccess.
|
|
378
|
+
* @param {bigint} tokenId The token ID of the asset.
|
|
379
|
+
* @param {number} periods The number of periods to buy access for.
|
|
380
|
+
* @returns {Promise<any>} The result of the buyAccess call.
|
|
381
|
+
*/
|
|
382
|
+
buyAccessSmart(tokenId: bigint, periods: number): Promise<any>;
|
|
383
|
+
getData(tokenId: bigint): Promise<any>;
|
|
239
384
|
}
|
|
240
385
|
|
|
241
386
|
declare global {
|
|
@@ -243,11 +388,6 @@ declare global {
|
|
|
243
388
|
ethereum?: any;
|
|
244
389
|
}
|
|
245
390
|
}
|
|
246
|
-
type CallOptions = {
|
|
247
|
-
value?: bigint;
|
|
248
|
-
gas?: bigint;
|
|
249
|
-
waitForReceipt?: boolean;
|
|
250
|
-
};
|
|
251
391
|
/**
|
|
252
392
|
* The Auth class.
|
|
253
393
|
* @class
|
|
@@ -413,91 +553,6 @@ declare class Auth {
|
|
|
413
553
|
* @throws {APIError} - Throws an error if the request fails.
|
|
414
554
|
*/
|
|
415
555
|
unlinkTelegram(): Promise<any>;
|
|
416
|
-
/**
|
|
417
|
-
* Call a contract method.
|
|
418
|
-
* @param {string} contractAddress The contract address.
|
|
419
|
-
* @param {Abi} abi The contract ABI.
|
|
420
|
-
* @param {string} methodName The method name.
|
|
421
|
-
* @param {any[]} params The method parameters.
|
|
422
|
-
* @param {CallOptions} [options] The call options.
|
|
423
|
-
* @returns {Promise<any>} A promise that resolves with the result of the contract call or transaction hash.
|
|
424
|
-
* @throws {Error} - Throws an error if the wallet client is not connected or if the method is not a view function.
|
|
425
|
-
*/
|
|
426
|
-
callContractMethod(contractAddress: string, abi: Abi, methodName: string, params: any[], options?: CallOptions): Promise<any>;
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
/**
|
|
430
|
-
The MIT License (MIT)
|
|
431
|
-
|
|
432
|
-
Copyright (c) Tobias Reich
|
|
433
|
-
|
|
434
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
435
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
436
|
-
in the Software without restriction, including without limitation the rights
|
|
437
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
438
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
439
|
-
furnished to do so, subject to the following conditions:
|
|
440
|
-
|
|
441
|
-
The above copyright notice and this permission notice shall be included in
|
|
442
|
-
all copies or substantial portions of the Software.
|
|
443
|
-
|
|
444
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
445
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
446
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
447
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
448
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
449
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
450
|
-
THE SOFTWARE.
|
|
451
|
-
*/
|
|
452
|
-
interface Options {
|
|
453
|
-
detailed?: boolean;
|
|
454
|
-
ignoreLocalhost?: boolean;
|
|
455
|
-
ignoreOwnVisits?: boolean;
|
|
456
|
-
}
|
|
457
|
-
interface Attributes {
|
|
458
|
-
siteLocation: string;
|
|
459
|
-
siteReferrer: string;
|
|
460
|
-
source?: string;
|
|
461
|
-
siteLanguage?: string;
|
|
462
|
-
screenWidth?: number;
|
|
463
|
-
screenHeight?: number;
|
|
464
|
-
screenColorDepth?: number;
|
|
465
|
-
browserWidth?: number;
|
|
466
|
-
browserHeight?: number;
|
|
467
|
-
}
|
|
468
|
-
/**
|
|
469
|
-
* Gathers all platform-, screen- and user-related information.
|
|
470
|
-
* @param {Boolean} detailed - Include personal data.
|
|
471
|
-
* @returns {Object} attributes - User-related information.
|
|
472
|
-
*/
|
|
473
|
-
declare const attributes: (detailed?: boolean) => Attributes;
|
|
474
|
-
/**
|
|
475
|
-
* Looks for an element with Ackee attributes and executes Ackee with the given attributes.
|
|
476
|
-
* Fails silently.
|
|
477
|
-
*/
|
|
478
|
-
declare const detect: () => void;
|
|
479
|
-
/**
|
|
480
|
-
* Creates a new instance.
|
|
481
|
-
* @param {String} server - URL of the Ackee server.
|
|
482
|
-
* @param {?Object} opts
|
|
483
|
-
* @returns {Object} instance
|
|
484
|
-
*/
|
|
485
|
-
declare const create: (server: string, opts?: Options) => {
|
|
486
|
-
record: (domainId: string, attrs?: Attributes, next?: (recordId: string) => void) => {
|
|
487
|
-
stop: () => void;
|
|
488
|
-
};
|
|
489
|
-
updateRecord: (recordId: string) => {
|
|
490
|
-
stop: () => void;
|
|
491
|
-
};
|
|
492
|
-
action: (eventId: string, attrs: any, next?: (actionId: string) => void) => void;
|
|
493
|
-
updateAction: (actionId: string, attrs: any) => void;
|
|
494
|
-
};
|
|
495
|
-
|
|
496
|
-
declare const ackeeUtil_attributes: typeof attributes;
|
|
497
|
-
declare const ackeeUtil_create: typeof create;
|
|
498
|
-
declare const ackeeUtil_detect: typeof detect;
|
|
499
|
-
declare namespace ackeeUtil {
|
|
500
|
-
export { ackeeUtil_attributes as attributes, ackeeUtil_create as create, ackeeUtil_detect as detect };
|
|
501
556
|
}
|
|
502
557
|
|
|
503
|
-
export {
|
|
558
|
+
export { Auth, SpotifyAPI, TwitterAPI };
|