@campnetwork/origin 0.0.5 → 0.0.7

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 CHANGED
@@ -970,6 +970,89 @@ The difference between the `openXModal` functions and the `linkX / unlinkX` func
970
970
 
971
971
  For example, if the user is linked to Twitter, calling `openTwitterModal` will open the modal to _unlink_ their Twitter account, while calling `linkTwitter` will not do anything, and calling `unlinkTwitter` will open the modal to unlink their Twitter account.
972
972
 
973
+ ## Origin Methods (`auth.origin`)
974
+
975
+ The `Origin` class provides methods for interacting with Origin IpNFTs, uploading files, managing user stats, and more. You can access these methods via `auth.origin` after authentication.
976
+
977
+ ### Minting
978
+
979
+ #### `mintFile(file: File, license: LicenseTerms, options?: { progressCallback?: (percent: number) => void })`
980
+
981
+ Uploads a file and mints an IpNFT for it.
982
+
983
+ - `file`: The file to upload and mint.
984
+ - `license`: License terms for the IpNFT.
985
+ - `options.progressCallback`: Optional progress callback.
986
+ - **Returns:** The minted token ID as a string, or `null` on failure.
987
+
988
+ #### `mintSocial(source: "spotify" | "twitter" | "tiktok")`
989
+
990
+ Mints an IpNFT for a connected social account.
991
+
992
+ - `source`: The social platform.
993
+ - **Returns:** The minted token ID as a string, or `null` on failure.
994
+
995
+ ### IpNFT & Marketplace Methods
996
+
997
+ The following methods are available for interacting with IpNFTs and the marketplace. All methods mirror the smart contract functions and require appropriate permissions.
998
+
999
+ - `mintWithSignature(...)`
1000
+ - `registerIpNFT(...)`
1001
+ - `updateTerms(...)`
1002
+ - `requestDelete(...)`
1003
+ - `getTerms(tokenId: bigint)`
1004
+ - `ownerOf(tokenId: bigint)`
1005
+ - `balanceOf(owner: string)`
1006
+ - `contentHash(tokenId: bigint)`
1007
+ - `tokenURI(tokenId: bigint)`
1008
+ - `dataStatus(tokenId: bigint)`
1009
+ - `royaltyInfo(tokenId: bigint, value: bigint)`
1010
+ - `getApproved(tokenId: bigint)`
1011
+ - `isApprovedForAll(owner: string, operator: string)`
1012
+ - `transferFrom(from: string, to: string, tokenId: bigint)`
1013
+ - `safeTransferFrom(from: string, to: string, tokenId: bigint)`
1014
+ - `approve(to: string, tokenId: bigint)`
1015
+ - `setApprovalForAll(operator: string, approved: boolean)`
1016
+ - `buyAccess(tokenId: bigint, periods: number, value?: bigint)`
1017
+ - `renewAccess(tokenId: bigint, periods: number)`
1018
+ - `hasAccess(tokenId: bigint, user: string)`
1019
+ - `subscriptionExpiry(tokenId: bigint, user: string)`
1020
+
1021
+ > See the SDK source or contract ABI for full parameter details.
1022
+
1023
+ #### `buyAccessSmart(tokenId: bigint, periods: number)`
1024
+
1025
+ Buys access to an asset, handling payment approval if needed.
1026
+
1027
+ - `tokenId`: The IpNFT token ID.
1028
+ - `periods`: Number of periods to buy.
1029
+ - **Returns:** Result of the buy access transaction.
1030
+
1031
+ #### `getData(tokenId: bigint)`
1032
+
1033
+ Fetches metadata for a given IpNFT.
1034
+
1035
+ - `tokenId`: The IpNFT token ID.
1036
+ - **Returns:** Data object for the token.
1037
+
1038
+ ### User Data & Stats
1039
+
1040
+ #### `getOriginUsage()`
1041
+
1042
+ Fetches the user's Origin stats (multiplier, consent, usage, etc).
1043
+
1044
+ - **Returns:** Object with user stats and usage.
1045
+
1046
+ #### `setOriginConsent(consent: boolean)`
1047
+
1048
+ Sets the user's consent for Origin usage.
1049
+
1050
+ - `consent`: `true` or `false`.
1051
+
1052
+ ---
1053
+
1054
+ You can call these methods as `await auth.origin.methodName(...)` after authenticating with the SDK. For more details, see the inline code documentation.
1055
+
973
1056
  # Contributing
974
1057
 
975
1058
  Install the dependencies.