@campnetwork/origin 1.0.0-alpha.2 → 1.0.0-alpha.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 +59 -31
- package/dist/core.d.ts +43 -6
- package/dist/core.esm.d.ts +43 -6
- package/dist/core.esm.js +102 -74
- package/dist/react/index.esm.d.ts +43 -6
- package/dist/react/index.esm.js +330 -92
- package/package.json +1 -1
package/dist/core.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import e from"axios";import{custom as t,createWalletClient as n,createPublicClient as i,http as a,erc20Abi as r,getAbiItem as s,encodeFunctionData as o,zeroAddress as d,checksumAddress as
|
|
1
|
+
import e from"axios";import{custom as t,createWalletClient as n,createPublicClient as i,http as a,erc20Abi as r,getAbiItem as s,encodeFunctionData as o,zeroAddress as d,formatEther as u,formatUnits as p,checksumAddress as l}from"viem";import{toAccount as y}from"viem/accounts";import{createSiweMessage as c}from"viem/siwe";
|
|
2
2
|
/******************************************************************************
|
|
3
3
|
Copyright (c) Microsoft Corporation.
|
|
4
4
|
|
|
@@ -13,7 +13,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
13
13
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
14
|
PERFORMANCE OF THIS SOFTWARE.
|
|
15
15
|
***************************************************************************** */
|
|
16
|
-
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */function
|
|
16
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */function h(e,t,n,i){return new(n||(n=Promise))((function(a,r){function s(e){try{d(i.next(e))}catch(e){r(e)}}function o(e){try{d(i.throw(e))}catch(e){r(e)}}function d(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,o)}d((i=i.apply(e,t||[])).next())}))}function m(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}"function"==typeof SuppressedError&&SuppressedError;class T extends Error{constructor(e,t){super(e),this.name="APIError",this.statusCode=t||500,Error.captureStackTrace(this,this.constructor)}toJSON(){return{error:this.name,message:this.message,statusCode:this.statusCode||500}}}
|
|
17
17
|
/**
|
|
18
18
|
* Makes a GET request to the given URL with the provided headers.
|
|
19
19
|
*
|
|
@@ -21,7 +21,7 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
|
21
21
|
* @param {object} headers - The headers to include in the request.
|
|
22
22
|
* @returns {Promise<object>} - The response data.
|
|
23
23
|
* @throws {APIError} - Throws an error if the request fails.
|
|
24
|
-
*/function
|
|
24
|
+
*/function f(t){return h(this,arguments,void 0,(function*(t,n={}){try{return(yield e.get(t,{headers:n})).data}catch(e){if(e.response)throw new T(e.response.data.message||"API request failed",e.response.status);throw new T("Network error or server is unavailable",500)}}))}
|
|
25
25
|
/**
|
|
26
26
|
* Constructs a query string from an object of query parameters.
|
|
27
27
|
*
|
|
@@ -35,13 +35,13 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
|
35
35
|
* @param {object} params - An object representing query parameters.
|
|
36
36
|
* @returns {string} - The complete URL with query string.
|
|
37
37
|
*/
|
|
38
|
-
function
|
|
38
|
+
function v(e,t={}){const n=function(e={}){return Object.keys(e).map((t=>`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`)).join("&")}(t);return n?`${e}?${n}`:e}const w="https://wv2h4to5qa.execute-api.us-east-2.amazonaws.com/dev/twitter",A="https://wv2h4to5qa.execute-api.us-east-2.amazonaws.com/dev/spotify";
|
|
39
39
|
/**
|
|
40
40
|
* The TwitterAPI class.
|
|
41
41
|
* @class
|
|
42
42
|
* @classdesc The TwitterAPI class is used to interact with the Twitter API.
|
|
43
43
|
*/
|
|
44
|
-
class
|
|
44
|
+
class I{
|
|
45
45
|
/**
|
|
46
46
|
* Constructor for the TwitterAPI class.
|
|
47
47
|
* @param {object} options - The options object.
|
|
@@ -53,7 +53,7 @@ constructor({apiKey:e}){this.apiKey=e}
|
|
|
53
53
|
* @param {string} twitterUserName - The Twitter username.
|
|
54
54
|
* @returns {Promise<object>} - The user details.
|
|
55
55
|
* @throws {APIError} - Throws an error if the request fails.
|
|
56
|
-
*/fetchUserByUsername(e){return
|
|
56
|
+
*/fetchUserByUsername(e){return h(this,void 0,void 0,(function*(){const t=v(`${w}/user`,{twitterUserName:e});return this._fetchDataWithAuth(t)}))}
|
|
57
57
|
/**
|
|
58
58
|
* Fetch tweets by Twitter username.
|
|
59
59
|
* @param {string} twitterUserName - The Twitter username.
|
|
@@ -61,7 +61,7 @@ constructor({apiKey:e}){this.apiKey=e}
|
|
|
61
61
|
* @param {number} limit - The number of items per page.
|
|
62
62
|
* @returns {Promise<object>} - The tweets.
|
|
63
63
|
* @throws {APIError} - Throws an error if the request fails.
|
|
64
|
-
*/fetchTweetsByUsername(e){return
|
|
64
|
+
*/fetchTweetsByUsername(e){return h(this,arguments,void 0,(function*(e,t=1,n=10){const i=v(`${w}/tweets`,{twitterUserName:e,page:t,limit:n});return this._fetchDataWithAuth(i)}))}
|
|
65
65
|
/**
|
|
66
66
|
* Fetch followers by Twitter username.
|
|
67
67
|
* @param {string} twitterUserName - The Twitter username.
|
|
@@ -69,7 +69,7 @@ constructor({apiKey:e}){this.apiKey=e}
|
|
|
69
69
|
* @param {number} limit - The number of items per page.
|
|
70
70
|
* @returns {Promise<object>} - The followers.
|
|
71
71
|
* @throws {APIError} - Throws an error if the request fails.
|
|
72
|
-
*/fetchFollowersByUsername(e){return
|
|
72
|
+
*/fetchFollowersByUsername(e){return h(this,arguments,void 0,(function*(e,t=1,n=10){const i=v(`${w}/followers`,{twitterUserName:e,page:t,limit:n});return this._fetchDataWithAuth(i)}))}
|
|
73
73
|
/**
|
|
74
74
|
* Fetch following by Twitter username.
|
|
75
75
|
* @param {string} twitterUserName - The Twitter username.
|
|
@@ -77,13 +77,13 @@ constructor({apiKey:e}){this.apiKey=e}
|
|
|
77
77
|
* @param {number} limit - The number of items per page.
|
|
78
78
|
* @returns {Promise<object>} - The following.
|
|
79
79
|
* @throws {APIError} - Throws an error if the request fails.
|
|
80
|
-
*/fetchFollowingByUsername(e){return
|
|
80
|
+
*/fetchFollowingByUsername(e){return h(this,arguments,void 0,(function*(e,t=1,n=10){const i=v(`${w}/following`,{twitterUserName:e,page:t,limit:n});return this._fetchDataWithAuth(i)}))}
|
|
81
81
|
/**
|
|
82
82
|
* Fetch tweet by tweet ID.
|
|
83
83
|
* @param {string} tweetId - The tweet ID.
|
|
84
84
|
* @returns {Promise<object>} - The tweet.
|
|
85
85
|
* @throws {APIError} - Throws an error if the request fails.
|
|
86
|
-
*/fetchTweetById(e){return
|
|
86
|
+
*/fetchTweetById(e){return h(this,void 0,void 0,(function*(){const t=v(`${w}/getTweetById`,{tweetId:e});return this._fetchDataWithAuth(t)}))}
|
|
87
87
|
/**
|
|
88
88
|
* Fetch user by wallet address.
|
|
89
89
|
* @param {string} walletAddress - The wallet address.
|
|
@@ -91,7 +91,7 @@ constructor({apiKey:e}){this.apiKey=e}
|
|
|
91
91
|
* @param {number} limit - The number of items per page.
|
|
92
92
|
* @returns {Promise<object>} - The user data.
|
|
93
93
|
* @throws {APIError} - Throws an error if the request fails.
|
|
94
|
-
*/fetchUserByWalletAddress(e){return
|
|
94
|
+
*/fetchUserByWalletAddress(e){return h(this,arguments,void 0,(function*(e,t=1,n=10){const i=v(`${w}/wallet-twitter-data`,{walletAddress:e,page:t,limit:n});return this._fetchDataWithAuth(i)}))}
|
|
95
95
|
/**
|
|
96
96
|
* Fetch reposted tweets by Twitter username.
|
|
97
97
|
* @param {string} twitterUserName - The Twitter username.
|
|
@@ -99,7 +99,7 @@ constructor({apiKey:e}){this.apiKey=e}
|
|
|
99
99
|
* @param {number} limit - The number of items per page.
|
|
100
100
|
* @returns {Promise<object>} - The reposted tweets.
|
|
101
101
|
* @throws {APIError} - Throws an error if the request fails.
|
|
102
|
-
*/fetchRepostedByUsername(e){return
|
|
102
|
+
*/fetchRepostedByUsername(e){return h(this,arguments,void 0,(function*(e,t=1,n=10){const i=v(`${w}/reposted`,{twitterUserName:e,page:t,limit:n});return this._fetchDataWithAuth(i)}))}
|
|
103
103
|
/**
|
|
104
104
|
* Fetch replies by Twitter username.
|
|
105
105
|
* @param {string} twitterUserName - The Twitter username.
|
|
@@ -107,7 +107,7 @@ constructor({apiKey:e}){this.apiKey=e}
|
|
|
107
107
|
* @param {number} limit - The number of items per page.
|
|
108
108
|
* @returns {Promise<object>} - The replies.
|
|
109
109
|
* @throws {APIError} - Throws an error if the request fails.
|
|
110
|
-
*/fetchRepliesByUsername(e){return
|
|
110
|
+
*/fetchRepliesByUsername(e){return h(this,arguments,void 0,(function*(e,t=1,n=10){const i=v(`${w}/replies`,{twitterUserName:e,page:t,limit:n});return this._fetchDataWithAuth(i)}))}
|
|
111
111
|
/**
|
|
112
112
|
* Fetch likes by Twitter username.
|
|
113
113
|
* @param {string} twitterUserName - The Twitter username.
|
|
@@ -115,7 +115,7 @@ constructor({apiKey:e}){this.apiKey=e}
|
|
|
115
115
|
* @param {number} limit - The number of items per page.
|
|
116
116
|
* @returns {Promise<object>} - The likes.
|
|
117
117
|
* @throws {APIError} - Throws an error if the request fails.
|
|
118
|
-
*/fetchLikesByUsername(e){return
|
|
118
|
+
*/fetchLikesByUsername(e){return h(this,arguments,void 0,(function*(e,t=1,n=10){const i=v(`${w}/event/likes/${e}`,{page:t,limit:n});return this._fetchDataWithAuth(i)}))}
|
|
119
119
|
/**
|
|
120
120
|
* Fetch follows by Twitter username.
|
|
121
121
|
* @param {string} twitterUserName - The Twitter username.
|
|
@@ -123,7 +123,7 @@ constructor({apiKey:e}){this.apiKey=e}
|
|
|
123
123
|
* @param {number} limit - The number of items per page.
|
|
124
124
|
* @returns {Promise<object>} - The follows.
|
|
125
125
|
* @throws {APIError} - Throws an error if the request fails.
|
|
126
|
-
*/fetchFollowsByUsername(e){return
|
|
126
|
+
*/fetchFollowsByUsername(e){return h(this,arguments,void 0,(function*(e,t=1,n=10){const i=v(`${w}/event/follows/${e}`,{page:t,limit:n});return this._fetchDataWithAuth(i)}))}
|
|
127
127
|
/**
|
|
128
128
|
* Fetch viewed tweets by Twitter username.
|
|
129
129
|
* @param {string} twitterUserName - The Twitter username.
|
|
@@ -131,17 +131,17 @@ constructor({apiKey:e}){this.apiKey=e}
|
|
|
131
131
|
* @param {number} limit - The number of items per page.
|
|
132
132
|
* @returns {Promise<object>} - The viewed tweets.
|
|
133
133
|
* @throws {APIError} - Throws an error if the request fails.
|
|
134
|
-
*/fetchViewedTweetsByUsername(e){return
|
|
134
|
+
*/fetchViewedTweetsByUsername(e){return h(this,arguments,void 0,(function*(e,t=1,n=10){const i=v(`${w}/event/viewed-tweets/${e}`,{page:t,limit:n});return this._fetchDataWithAuth(i)}))}
|
|
135
135
|
/**
|
|
136
136
|
* Private method to fetch data with authorization header.
|
|
137
137
|
* @param {string} url - The URL to fetch.
|
|
138
138
|
* @returns {Promise<object>} - The response data.
|
|
139
139
|
* @throws {APIError} - Throws an error if the request fails.
|
|
140
|
-
*/_fetchDataWithAuth(e){return
|
|
140
|
+
*/_fetchDataWithAuth(e){return h(this,void 0,void 0,(function*(){if(!this.apiKey)throw new T("API key is required for fetching data",401);try{return yield f(e,{"x-api-key":this.apiKey})}catch(e){throw new T(e.message,e.statusCode)}}))}}
|
|
141
141
|
/**
|
|
142
142
|
* The SpotifyAPI class.
|
|
143
143
|
* @class
|
|
144
|
-
*/class
|
|
144
|
+
*/class b{
|
|
145
145
|
/**
|
|
146
146
|
* Constructor for the SpotifyAPI class.
|
|
147
147
|
* @constructor
|
|
@@ -155,53 +155,53 @@ constructor(e){this.apiKey=e.apiKey}
|
|
|
155
155
|
* @param {string} spotifyId - The user's Spotify ID.
|
|
156
156
|
* @returns {Promise<object>} - The saved tracks.
|
|
157
157
|
* @throws {APIError} - Throws an error if the request fails.
|
|
158
|
-
*/fetchSavedTracksById(e){return
|
|
158
|
+
*/fetchSavedTracksById(e){return h(this,void 0,void 0,(function*(){const t=v(`${A}/save-tracks`,{spotifyId:e});return this._fetchDataWithAuth(t)}))}
|
|
159
159
|
/**
|
|
160
160
|
* Fetch the played tracks of a user by Spotify ID.
|
|
161
161
|
* @param {string} spotifyId - The user's Spotify ID.
|
|
162
162
|
* @returns {Promise<object>} - The played tracks.
|
|
163
163
|
* @throws {APIError} - Throws an error if the request fails.
|
|
164
|
-
*/fetchPlayedTracksById(e){return
|
|
164
|
+
*/fetchPlayedTracksById(e){return h(this,void 0,void 0,(function*(){const t=v(`${A}/played-tracks`,{spotifyId:e});return this._fetchDataWithAuth(t)}))}
|
|
165
165
|
/**
|
|
166
166
|
* Fetch the user's saved albums by Spotify user ID.
|
|
167
167
|
* @param {string} spotifyId - The user's Spotify ID.
|
|
168
168
|
* @returns {Promise<object>} - The saved albums.
|
|
169
169
|
* @throws {APIError} - Throws an error if the request fails.
|
|
170
|
-
*/fetchSavedAlbumsById(e){return
|
|
170
|
+
*/fetchSavedAlbumsById(e){return h(this,void 0,void 0,(function*(){const t=v(`${A}/saved-albums`,{spotifyId:e});return this._fetchDataWithAuth(t)}))}
|
|
171
171
|
/**
|
|
172
172
|
* Fetch the user's saved playlists by Spotify user ID.
|
|
173
173
|
* @param {string} spotifyId - The user's Spotify ID.
|
|
174
174
|
* @returns {Promise<object>} - The saved playlists.
|
|
175
175
|
* @throws {APIError} - Throws an error if the request fails.
|
|
176
|
-
*/fetchSavedPlaylistsById(e){return
|
|
176
|
+
*/fetchSavedPlaylistsById(e){return h(this,void 0,void 0,(function*(){const t=v(`${A}/saved-playlists`,{spotifyId:e});return this._fetchDataWithAuth(t)}))}
|
|
177
177
|
/**
|
|
178
178
|
* Fetch the tracks of an album by album ID.
|
|
179
179
|
* @param {string} spotifyId - The Spotify ID of the user.
|
|
180
180
|
* @param {string} albumId - The album ID.
|
|
181
181
|
* @returns {Promise<object>} - The tracks in the album.
|
|
182
182
|
* @throws {APIError} - Throws an error if the request fails.
|
|
183
|
-
*/fetchTracksInAlbum(e,t){return
|
|
183
|
+
*/fetchTracksInAlbum(e,t){return h(this,void 0,void 0,(function*(){const n=v(`${A}/album/tracks`,{spotifyId:e,albumId:t});return this._fetchDataWithAuth(n)}))}
|
|
184
184
|
/**
|
|
185
185
|
* Fetch the tracks in a playlist by playlist ID.
|
|
186
186
|
* @param {string} spotifyId - The Spotify ID of the user.
|
|
187
187
|
* @param {string} playlistId - The playlist ID.
|
|
188
188
|
* @returns {Promise<object>} - The tracks in the playlist.
|
|
189
189
|
* @throws {APIError} - Throws an error if the request fails.
|
|
190
|
-
*/fetchTracksInPlaylist(e,t){return
|
|
190
|
+
*/fetchTracksInPlaylist(e,t){return h(this,void 0,void 0,(function*(){const n=v(`${A}/playlist/tracks`,{spotifyId:e,playlistId:t});return this._fetchDataWithAuth(n)}))}
|
|
191
191
|
/**
|
|
192
192
|
* Fetch the user's Spotify data by wallet address.
|
|
193
193
|
* @param {string} walletAddress - The wallet address.
|
|
194
194
|
* @returns {Promise<object>} - The user's Spotify data.
|
|
195
195
|
* @throws {APIError} - Throws an error if the request fails.
|
|
196
|
-
*/fetchUserByWalletAddress(e){return
|
|
196
|
+
*/fetchUserByWalletAddress(e){return h(this,void 0,void 0,(function*(){const t=v(`${A}/wallet-spotify-data`,{walletAddress:e});return this._fetchDataWithAuth(t)}))}
|
|
197
197
|
/**
|
|
198
198
|
* Private method to fetch data with authorization header.
|
|
199
199
|
* @param {string} url - The URL to fetch.
|
|
200
200
|
* @returns {Promise<object>} - The response data.
|
|
201
201
|
* @throws {APIError} - Throws an error if the request fails.
|
|
202
|
-
*/_fetchDataWithAuth(e){return
|
|
202
|
+
*/_fetchDataWithAuth(e){return h(this,void 0,void 0,(function*(){if(!this.apiKey)throw new T("API key is required for fetching data",401);try{return yield f(e,{"x-api-key":this.apiKey})}catch(e){throw new T(e.message,e.statusCode)}}))}}const g={id:123420001114,name:"Basecamp",nativeCurrency:{decimals:18,name:"Camp",symbol:"CAMP"},rpcUrls:{default:{http:["https://rpc-campnetwork.xyz","https://rpc.basecamp.t.raas.gelato.cloud"]}},blockExplorers:{default:{name:"Explorer",url:"https://basecamp.cloud.blockscout.com/"}}};
|
|
203
203
|
// @ts-ignore
|
|
204
|
-
let b=null,g=null;const E=()=>(g||(g=i({chain:I,transport:a()})),g);var _=[{inputs:[{internalType:"string",name:"name_",type:"string"},{internalType:"string",name:"symbol_",type:"string"},{internalType:"uint256",name:"maxTermDuration_",type:"uint256"},{internalType:"address",name:"signer_",type:"address"},{internalType:"address",name:"wCAMP_",type:"address"},{internalType:"uint256",name:"minTermDuration_",type:"uint256"},{internalType:"uint256",name:"minPrice_",type:"uint256"},{internalType:"uint256",name:"maxRoyaltyBps_",type:"uint256"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"owner",type:"address"}],name:"ERC721IncorrectOwner",type:"error"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ERC721InsufficientApproval",type:"error"},{inputs:[{internalType:"address",name:"approver",type:"address"}],name:"ERC721InvalidApprover",type:"error"},{inputs:[{internalType:"address",name:"operator",type:"address"}],name:"ERC721InvalidOperator",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"ERC721InvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"receiver",type:"address"}],name:"ERC721InvalidReceiver",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"}],name:"ERC721InvalidSender",type:"error"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ERC721NonexistentToken",type:"error"},{inputs:[],name:"EnforcedPause",type:"error"},{inputs:[],name:"ExpectedPause",type:"error"},{inputs:[],name:"InvalidDeadline",type:"error"},{inputs:[],name:"InvalidDuration",type:"error"},{inputs:[],name:"InvalidPaymentToken",type:"error"},{inputs:[],name:"InvalidPrice",type:"error"},{inputs:[],name:"InvalidRoyalty",type:"error"},{inputs:[],name:"InvalidSignature",type:"error"},{inputs:[],name:"NotTokenOwner",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"OwnableInvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"OwnableUnauthorizedAccount",type:"error"},{inputs:[],name:"TokenAlreadyExists",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"buyer",type:"address"},{indexed:!1,internalType:"uint32",name:"periods",type:"uint32"},{indexed:!1,internalType:"uint256",name:"newExpiry",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amountPaid",type:"uint256"}],name:"AccessPurchased",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"uint256",name:"childIp",type:"uint256"},{indexed:!1,internalType:"uint256",name:"parentIp",type:"uint256"}],name:"ChildIpTagged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"}],name:"DataDeleted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"bytes32",name:"contentHash",type:"bytes32"},{indexed:!1,internalType:"uint256[]",name:"parents",type:"uint256[]"}],name:"DataMinted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"bytes32",name:"counterEvidenceHash",type:"bytes32"}],name:"DisputeAssertion",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"}],name:"DisputeCancelled",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"bool",name:"judgement",type:"bool"}],name:"DisputeJudged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"disputeModule",type:"address"}],name:"DisputeModuleUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"address",name:"initiator",type:"address"},{indexed:!0,internalType:"uint256",name:"targetId",type:"uint256"},{indexed:!1,internalType:"bytes32",name:"disputeTag",type:"bytes32"}],name:"DisputeRaised",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"marketPlace",type:"address"}],name:"MarketPlaceUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Paused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"royaltyAmount",type:"uint256"},{indexed:!1,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"uint256",name:"protocolAmount",type:"uint256"}],name:"RoyaltyPaid",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"signer",type:"address"}],name:"SignerUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"enum IIpNFT.DataStatus",name:"status",type:"uint8"}],name:"StatusUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint128",name:"newPrice",type:"uint128"},{indexed:!1,internalType:"uint32",name:"newDuration",type:"uint32"},{indexed:!1,internalType:"uint16",name:"newRoyaltyBps",type:"uint16"},{indexed:!1,internalType:"address",name:"paymentToken",type:"address"}],name:"TermsUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"dataStatus",outputs:[{internalType:"enum IIpNFT.DataStatus",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"disputeModule",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"finalizeDelete",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"tokenOwner",type:"address"}],name:"getOrCreateRoyaltyVault",outputs:[{internalType:"address",name:"vault",type:"address"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getTerms",outputs:[{components:[{internalType:"uint128",name:"price",type:"uint128"},{internalType:"uint32",name:"duration",type:"uint32"},{internalType:"uint16",name:"royaltyBps",type:"uint16"},{internalType:"address",name:"paymentToken",type:"address"}],internalType:"struct IIpNFT.LicenseTerms",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_tokenId",type:"uint256"}],name:"markDisputed",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"marketPlace",outputs:[{internalType:"contract IMarketplace",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"maxRoyaltyBps",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"maxTermDuration",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"minPrice",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"minTermDuration",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes32",name:"creatorContentHash",type:"bytes32"},{internalType:"string",name:"uri",type:"string"},{components:[{internalType:"uint128",name:"price",type:"uint128"},{internalType:"uint32",name:"duration",type:"uint32"},{internalType:"uint16",name:"royaltyBps",type:"uint16"},{internalType:"address",name:"paymentToken",type:"address"}],internalType:"struct IIpNFT.LicenseTerms",name:"licenseTerms",type:"tuple"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint256[]",name:"parents",type:"uint256[]"},{internalType:"bytes",name:"signature",type:"bytes"}],name:"mintWithSignature",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"pause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"paused",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_disputeModule",type:"address"}],name:"setDisputeModule",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_marketPlace",type:"address"}],name:"setMarketPlace",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_signer",type:"address"}],name:"setSigner",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"signer",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"tokenInfo",outputs:[{internalType:"string",name:"tokenURI",type:"string"},{internalType:"bytes32",name:"contentHash",type:"bytes32"},{components:[{internalType:"uint128",name:"price",type:"uint128"},{internalType:"uint32",name:"duration",type:"uint32"},{internalType:"uint16",name:"royaltyBps",type:"uint16"},{internalType:"address",name:"paymentToken",type:"address"}],internalType:"struct IIpNFT.LicenseTerms",name:"terms",type:"tuple"},{internalType:"enum IIpNFT.DataStatus",name:"status",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"unpause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{components:[{internalType:"uint128",name:"price",type:"uint128"},{internalType:"uint32",name:"duration",type:"uint32"},{internalType:"uint16",name:"royaltyBps",type:"uint16"},{internalType:"address",name:"paymentToken",type:"address"}],internalType:"struct IIpNFT.LicenseTerms",name:"newTerms",type:"tuple"}],name:"updateTerms",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"wCAMP",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"}],C=[{inputs:[{internalType:"address",name:"dataNFT_",type:"address"},{internalType:"uint16",name:"protocolFeeBps_",type:"uint16"},{internalType:"address",name:"treasury_",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"EnforcedPause",type:"error"},{inputs:[],name:"ExpectedPause",type:"error"},{inputs:[],name:"InvalidParentIp",type:"error"},{inputs:[],name:"InvalidPayment",type:"error"},{inputs:[],name:"InvalidRoyalty",type:"error"},{inputs:[],name:"MaxParentsExceeded",type:"error"},{inputs:[],name:"MaxRoyaltyExceeded",type:"error"},{inputs:[],name:"NoSubscriptionFound",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"OwnableInvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"OwnableUnauthorizedAccount",type:"error"},{inputs:[],name:"ParentAlreadyExists",type:"error"},{inputs:[],name:"ParentIpAlreadyDeleted",type:"error"},{inputs:[],name:"ParentIpAlreadyDisputed",type:"error"},{inputs:[],name:"TermsMismatch",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{inputs:[],name:"ZeroAddress",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"buyer",type:"address"},{indexed:!1,internalType:"uint32",name:"periods",type:"uint32"},{indexed:!1,internalType:"uint256",name:"newExpiry",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amountPaid",type:"uint256"}],name:"AccessPurchased",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"uint256",name:"childIp",type:"uint256"},{indexed:!1,internalType:"uint256",name:"parentIp",type:"uint256"}],name:"ChildIpTagged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"}],name:"DataDeleted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"bytes32",name:"contentHash",type:"bytes32"}],name:"DataMinted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"bytes32",name:"counterEvidenceHash",type:"bytes32"}],name:"DisputeAssertion",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"}],name:"DisputeCancelled",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"bool",name:"judgement",type:"bool"}],name:"DisputeJudged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"disputeModule",type:"address"}],name:"DisputeModuleUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"address",name:"initiator",type:"address"},{indexed:!0,internalType:"uint256",name:"targetId",type:"uint256"},{indexed:!1,internalType:"bytes32",name:"disputeTag",type:"bytes32"}],name:"DisputeRaised",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"marketPlace",type:"address"}],name:"MarketPlaceUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Paused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"royaltyAmount",type:"uint256"},{indexed:!1,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"uint256",name:"protocolAmount",type:"uint256"}],name:"RoyaltyPaid",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"signer",type:"address"}],name:"SignerUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"enum IIpNFT.DataStatus",name:"status",type:"uint8"}],name:"StatusUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint128",name:"newPrice",type:"uint128"},{indexed:!1,internalType:"uint32",name:"newDuration",type:"uint32"},{indexed:!1,internalType:"uint16",name:"newRoyaltyBps",type:"uint16"},{indexed:!1,internalType:"address",name:"paymentToken",type:"address"}],name:"TermsUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{inputs:[],name:"MAX_PARENTS",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"buyer",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"expectedPrice",type:"uint256"},{internalType:"uint32",name:"expectedDuration",type:"uint32"},{internalType:"address",name:"expectedPaymentToken",type:"address"}],name:"buyAccess",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"ipId",type:"uint256"},{internalType:"uint256",name:"parent",type:"uint256"}],name:"hasParentIp",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"ipToken",outputs:[{internalType:"contract IIpNFT",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"uint256",name:"",type:"uint256"}],name:"parentRoyaltyPercent",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"pause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"paused",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"protocolFeeBps",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"royaltyStack",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"childIpId",type:"uint256"},{internalType:"uint256[]",name:"parents",type:"uint256[]"},{internalType:"address",name:"creator",type:"address"}],name:"setParentIpsAndRoyaltyPercents",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"address",name:"",type:"address"}],name:"subscriptionExpiry",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"treasury",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"unpause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint16",name:"newFeeBps",type:"uint16"}],name:"updateProtocolFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newTreasury",type:"address"}],name:"updateTreasury",outputs:[],stateMutability:"nonpayable",type:"function"}],k="Connect with Camp Network",S={USER_CONNECTED:"ed42542d-b676-4112-b6d9-6db98048b2e0",USER_DISCONNECTED:"20af31ac-e602-442e-9e0e-b589f4dd4016",TWITTER_LINKED:"7fbea086-90ef-4679-ba69-f47f9255b34c",DISCORD_LINKED:"d73f5ae3-a8e8-48f2-8532-85e0c7780d6a",SPOTIFY_LINKED:"fc1788b4-c984-42c8-96f4-c87f6bb0b8f7",TIKTOK_LINKED:"4a2ffdd3-f0e9-4784-8b49-ff76ec1c0a6a",TELEGRAM_LINKED:"9006bc5d-bcc9-4d01-a860-4f1a201e8e47"};const D={DEVELOPMENT:{NAME:"DEVELOPMENT",AUTH_HUB_BASE_API:"https://wv2h4to5qa.execute-api.us-east-2.amazonaws.com/dev",AUTH_ENDPOINT:"auth-testnet",ORIGIN_DASHBOARD:"https://origin.campnetwork.xyz",DATANFT_CONTRACT_ADDRESS:"0x8EB0E8C3bA99c04F05ab01A5BED34F00c6c3BE4D",MARKETPLACE_CONTRACT_ADDRESS:"0x2947eE8a352158fda08F2cf5c0AE8e5b1DFCfDc9",CHAIN:I,IPNFT_ABI:_,MARKETPLACE_ABI:C},PRODUCTION:{NAME:"PRODUCTION",AUTH_HUB_BASE_API:"https://wv2h4to5qa.execute-api.us-east-2.amazonaws.com/dev",AUTH_ENDPOINT:"auth-mainnet",ORIGIN_DASHBOARD:"https://origin.campnetwork.xyz",DATANFT_CONTRACT_ADDRESS:"0x54d8490f034e3A4D07CD220a7Dc88D9B91B82c25",MARKETPLACE_CONTRACT_ADDRESS:"0x5D2be63c94931f82B602Ecd1538064ab4196F8e7",CHAIN:{id:484,name:"Camp Network",nativeCurrency:{decimals:18,name:"Camp",symbol:"CAMP"},rpcUrls:{default:{http:["https://rpc.camp.raas.gelato.cloud/"]}},blockExplorers:{default:{name:"Explorer",url:"https://camp.cloud.blockscout.com/"}}},IPNFT_ABI:_,MARKETPLACE_ABI:C}};let N=[];const P=()=>N,x=e=>{function t(t){N.some((e=>e.info.uuid===t.detail.info.uuid))||(N=[...N,t.detail],e(N))}if("undefined"!=typeof window)return window.addEventListener("eip6963:announceProvider",t),window.dispatchEvent(new Event("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",t)};
|
|
204
|
+
let E=null,_=null;const C=()=>(_||(_=i({chain:g,transport:a()})),_);var k=[{inputs:[{internalType:"string",name:"name_",type:"string"},{internalType:"string",name:"symbol_",type:"string"},{internalType:"uint256",name:"maxTermDuration_",type:"uint256"},{internalType:"address",name:"signer_",type:"address"},{internalType:"address",name:"wCAMP_",type:"address"},{internalType:"uint256",name:"minTermDuration_",type:"uint256"},{internalType:"uint256",name:"minPrice_",type:"uint256"},{internalType:"uint256",name:"maxRoyaltyBps_",type:"uint256"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"owner",type:"address"}],name:"ERC721IncorrectOwner",type:"error"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ERC721InsufficientApproval",type:"error"},{inputs:[{internalType:"address",name:"approver",type:"address"}],name:"ERC721InvalidApprover",type:"error"},{inputs:[{internalType:"address",name:"operator",type:"address"}],name:"ERC721InvalidOperator",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"ERC721InvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"receiver",type:"address"}],name:"ERC721InvalidReceiver",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"}],name:"ERC721InvalidSender",type:"error"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ERC721NonexistentToken",type:"error"},{inputs:[],name:"EnforcedPause",type:"error"},{inputs:[],name:"ExpectedPause",type:"error"},{inputs:[],name:"InvalidDeadline",type:"error"},{inputs:[],name:"InvalidDuration",type:"error"},{inputs:[],name:"InvalidPaymentToken",type:"error"},{inputs:[],name:"InvalidPrice",type:"error"},{inputs:[],name:"InvalidRoyalty",type:"error"},{inputs:[],name:"InvalidSignature",type:"error"},{inputs:[],name:"NotTokenOwner",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"OwnableInvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"OwnableUnauthorizedAccount",type:"error"},{inputs:[],name:"TokenAlreadyExists",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"buyer",type:"address"},{indexed:!1,internalType:"uint32",name:"periods",type:"uint32"},{indexed:!1,internalType:"uint256",name:"newExpiry",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amountPaid",type:"uint256"}],name:"AccessPurchased",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"uint256",name:"childIp",type:"uint256"},{indexed:!1,internalType:"uint256",name:"parentIp",type:"uint256"}],name:"ChildIpTagged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"}],name:"DataDeleted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"bytes32",name:"contentHash",type:"bytes32"},{indexed:!1,internalType:"uint256[]",name:"parents",type:"uint256[]"}],name:"DataMinted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"bytes32",name:"counterEvidenceHash",type:"bytes32"}],name:"DisputeAssertion",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"}],name:"DisputeCancelled",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"bool",name:"judgement",type:"bool"}],name:"DisputeJudged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"disputeModule",type:"address"}],name:"DisputeModuleUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"address",name:"initiator",type:"address"},{indexed:!0,internalType:"uint256",name:"targetId",type:"uint256"},{indexed:!1,internalType:"bytes32",name:"disputeTag",type:"bytes32"}],name:"DisputeRaised",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"marketPlace",type:"address"}],name:"MarketPlaceUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Paused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"royaltyAmount",type:"uint256"},{indexed:!1,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"uint256",name:"protocolAmount",type:"uint256"}],name:"RoyaltyPaid",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"signer",type:"address"}],name:"SignerUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"enum IIpNFT.DataStatus",name:"status",type:"uint8"}],name:"StatusUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint128",name:"newPrice",type:"uint128"},{indexed:!1,internalType:"uint32",name:"newDuration",type:"uint32"},{indexed:!1,internalType:"uint16",name:"newRoyaltyBps",type:"uint16"},{indexed:!1,internalType:"address",name:"paymentToken",type:"address"}],name:"TermsUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"dataStatus",outputs:[{internalType:"enum IIpNFT.DataStatus",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"disputeModule",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"finalizeDelete",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"tokenOwner",type:"address"}],name:"getOrCreateRoyaltyVault",outputs:[{internalType:"address",name:"vault",type:"address"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getTerms",outputs:[{components:[{internalType:"uint128",name:"price",type:"uint128"},{internalType:"uint32",name:"duration",type:"uint32"},{internalType:"uint16",name:"royaltyBps",type:"uint16"},{internalType:"address",name:"paymentToken",type:"address"}],internalType:"struct IIpNFT.LicenseTerms",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_tokenId",type:"uint256"}],name:"markDisputed",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"marketPlace",outputs:[{internalType:"contract IMarketplace",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"maxRoyaltyBps",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"maxTermDuration",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"minPrice",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"minTermDuration",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes32",name:"creatorContentHash",type:"bytes32"},{internalType:"string",name:"uri",type:"string"},{components:[{internalType:"uint128",name:"price",type:"uint128"},{internalType:"uint32",name:"duration",type:"uint32"},{internalType:"uint16",name:"royaltyBps",type:"uint16"},{internalType:"address",name:"paymentToken",type:"address"}],internalType:"struct IIpNFT.LicenseTerms",name:"licenseTerms",type:"tuple"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint256[]",name:"parents",type:"uint256[]"},{internalType:"bytes",name:"signature",type:"bytes"}],name:"mintWithSignature",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"pause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"paused",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_disputeModule",type:"address"}],name:"setDisputeModule",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_marketPlace",type:"address"}],name:"setMarketPlace",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_signer",type:"address"}],name:"setSigner",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"signer",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"tokenInfo",outputs:[{internalType:"string",name:"tokenURI",type:"string"},{internalType:"bytes32",name:"contentHash",type:"bytes32"},{components:[{internalType:"uint128",name:"price",type:"uint128"},{internalType:"uint32",name:"duration",type:"uint32"},{internalType:"uint16",name:"royaltyBps",type:"uint16"},{internalType:"address",name:"paymentToken",type:"address"}],internalType:"struct IIpNFT.LicenseTerms",name:"terms",type:"tuple"},{internalType:"enum IIpNFT.DataStatus",name:"status",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"unpause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{components:[{internalType:"uint128",name:"price",type:"uint128"},{internalType:"uint32",name:"duration",type:"uint32"},{internalType:"uint16",name:"royaltyBps",type:"uint16"},{internalType:"address",name:"paymentToken",type:"address"}],internalType:"struct IIpNFT.LicenseTerms",name:"newTerms",type:"tuple"}],name:"updateTerms",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"wCAMP",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"}],S=[{inputs:[{internalType:"address",name:"dataNFT_",type:"address"},{internalType:"uint16",name:"protocolFeeBps_",type:"uint16"},{internalType:"address",name:"treasury_",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"EnforcedPause",type:"error"},{inputs:[],name:"ExpectedPause",type:"error"},{inputs:[],name:"InvalidParentIp",type:"error"},{inputs:[],name:"InvalidPayment",type:"error"},{inputs:[],name:"InvalidRoyalty",type:"error"},{inputs:[],name:"MaxParentsExceeded",type:"error"},{inputs:[],name:"MaxRoyaltyExceeded",type:"error"},{inputs:[],name:"NoSubscriptionFound",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"OwnableInvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"OwnableUnauthorizedAccount",type:"error"},{inputs:[],name:"ParentAlreadyExists",type:"error"},{inputs:[],name:"ParentIpAlreadyDeleted",type:"error"},{inputs:[],name:"ParentIpAlreadyDisputed",type:"error"},{inputs:[],name:"TermsMismatch",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{inputs:[],name:"ZeroAddress",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"buyer",type:"address"},{indexed:!1,internalType:"uint32",name:"periods",type:"uint32"},{indexed:!1,internalType:"uint256",name:"newExpiry",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amountPaid",type:"uint256"}],name:"AccessPurchased",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"uint256",name:"childIp",type:"uint256"},{indexed:!1,internalType:"uint256",name:"parentIp",type:"uint256"}],name:"ChildIpTagged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"}],name:"DataDeleted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"bytes32",name:"contentHash",type:"bytes32"}],name:"DataMinted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"bytes32",name:"counterEvidenceHash",type:"bytes32"}],name:"DisputeAssertion",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"}],name:"DisputeCancelled",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"bool",name:"judgement",type:"bool"}],name:"DisputeJudged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"disputeModule",type:"address"}],name:"DisputeModuleUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"address",name:"initiator",type:"address"},{indexed:!0,internalType:"uint256",name:"targetId",type:"uint256"},{indexed:!1,internalType:"bytes32",name:"disputeTag",type:"bytes32"}],name:"DisputeRaised",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"marketPlace",type:"address"}],name:"MarketPlaceUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Paused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"royaltyAmount",type:"uint256"},{indexed:!1,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"uint256",name:"protocolAmount",type:"uint256"}],name:"RoyaltyPaid",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"signer",type:"address"}],name:"SignerUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"enum IIpNFT.DataStatus",name:"status",type:"uint8"}],name:"StatusUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint128",name:"newPrice",type:"uint128"},{indexed:!1,internalType:"uint32",name:"newDuration",type:"uint32"},{indexed:!1,internalType:"uint16",name:"newRoyaltyBps",type:"uint16"},{indexed:!1,internalType:"address",name:"paymentToken",type:"address"}],name:"TermsUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{inputs:[],name:"MAX_PARENTS",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"buyer",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"expectedPrice",type:"uint256"},{internalType:"uint32",name:"expectedDuration",type:"uint32"},{internalType:"address",name:"expectedPaymentToken",type:"address"}],name:"buyAccess",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"ipId",type:"uint256"},{internalType:"uint256",name:"parent",type:"uint256"}],name:"hasParentIp",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"ipToken",outputs:[{internalType:"contract IIpNFT",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"uint256",name:"",type:"uint256"}],name:"parentRoyaltyPercent",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"pause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"paused",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"protocolFeeBps",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"royaltyStack",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"childIpId",type:"uint256"},{internalType:"uint256[]",name:"parents",type:"uint256[]"},{internalType:"address",name:"creator",type:"address"}],name:"setParentIpsAndRoyaltyPercents",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"address",name:"",type:"address"}],name:"subscriptionExpiry",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"treasury",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"unpause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint16",name:"newFeeBps",type:"uint16"}],name:"updateProtocolFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newTreasury",type:"address"}],name:"updateTreasury",outputs:[],stateMutability:"nonpayable",type:"function"}],N=[{type:"constructor",inputs:[{name:"_owner",type:"address",internalType:"address"}],stateMutability:"nonpayable"},{type:"receive",stateMutability:"payable"},{type:"function",name:"claimRoyalty",inputs:[{name:"token",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"owner",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"renounceOwnership",inputs:[],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"transferOwnership",inputs:[{name:"newOwner",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"event",name:"OwnershipTransferred",inputs:[{name:"previousOwner",type:"address",indexed:!0,internalType:"address"},{name:"newOwner",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"error",name:"OwnableInvalidOwner",inputs:[{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"OwnableUnauthorizedAccount",inputs:[{name:"account",type:"address",internalType:"address"}]}],D="Connect with Camp Network",P={USER_CONNECTED:"ed42542d-b676-4112-b6d9-6db98048b2e0",USER_DISCONNECTED:"20af31ac-e602-442e-9e0e-b589f4dd4016",TWITTER_LINKED:"7fbea086-90ef-4679-ba69-f47f9255b34c",DISCORD_LINKED:"d73f5ae3-a8e8-48f2-8532-85e0c7780d6a",SPOTIFY_LINKED:"fc1788b4-c984-42c8-96f4-c87f6bb0b8f7",TIKTOK_LINKED:"4a2ffdd3-f0e9-4784-8b49-ff76ec1c0a6a",TELEGRAM_LINKED:"9006bc5d-bcc9-4d01-a860-4f1a201e8e47"};const x={DEVELOPMENT:{NAME:"DEVELOPMENT",AUTH_HUB_BASE_API:"https://wv2h4to5qa.execute-api.us-east-2.amazonaws.com/dev",AUTH_ENDPOINT:"auth-testnet",ORIGIN_DASHBOARD:"https://origin.campnetwork.xyz",DATANFT_CONTRACT_ADDRESS:"0x8EB0E8C3bA99c04F05ab01A5BED34F00c6c3BE4D",MARKETPLACE_CONTRACT_ADDRESS:"0x2947eE8a352158fda08F2cf5c0AE8e5b1DFCfDc9",CHAIN:g,IPNFT_ABI:k,MARKETPLACE_ABI:S,ROYALTY_VAULT_ABI:N},PRODUCTION:{NAME:"PRODUCTION",AUTH_HUB_BASE_API:"https://wv2h4to5qa.execute-api.us-east-2.amazonaws.com/dev",AUTH_ENDPOINT:"auth-mainnet",ORIGIN_DASHBOARD:"https://origin.campnetwork.xyz",DATANFT_CONTRACT_ADDRESS:"0x54d8490f034e3A4D07CD220a7Dc88D9B91B82c25",MARKETPLACE_CONTRACT_ADDRESS:"0x5D2be63c94931f82B602Ecd1538064ab4196F8e7",CHAIN:{id:484,name:"Camp Network",nativeCurrency:{decimals:18,name:"Camp",symbol:"CAMP"},rpcUrls:{default:{http:["https://rpc.camp.raas.gelato.cloud/"]}},blockExplorers:{default:{name:"Explorer",url:"https://camp.cloud.blockscout.com/"}}},IPNFT_ABI:k,MARKETPLACE_ABI:S,ROYALTY_VAULT_ABI:N}};let O=[];const U=()=>O,M=e=>{function t(t){O.some((e=>e.info.uuid===t.detail.info.uuid))||(O=[...O,t.detail],e(O))}if("undefined"!=typeof window)return window.addEventListener("eip6963:announceProvider",t),window.dispatchEvent(new Event("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",t)};
|
|
205
205
|
/**
|
|
206
206
|
* Mints a Data NFT with a signature.
|
|
207
207
|
* @param to The address to mint the NFT to.
|
|
@@ -213,56 +213,61 @@ let b=null,g=null;const E=()=>(g||(g=i({chain:I,transport:a()})),g);var _=[{inpu
|
|
|
213
213
|
* @param deadline The deadline for the minting operation.
|
|
214
214
|
* @param signature The signature for the minting operation.
|
|
215
215
|
* @returns A promise that resolves when the minting is complete.
|
|
216
|
-
*/function
|
|
216
|
+
*/function B(e,t,n,i,a,r,s,o){return h(this,void 0,void 0,(function*(){return yield this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"mintWithSignature",[e,t,i,a,r,s,n,o],{waitForReceipt:!0})}))}
|
|
217
217
|
/**
|
|
218
218
|
* Registers a Data NFT with the Origin service in order to obtain a signature for minting.
|
|
219
219
|
* @param source The source of the Data NFT (e.g., "spotify", "twitter", "tiktok", or "file").
|
|
220
220
|
* @param deadline The deadline for the registration operation.
|
|
221
221
|
* @param fileKey Optional file key for file uploads.
|
|
222
222
|
* @return A promise that resolves with the registration data.
|
|
223
|
-
*/function
|
|
223
|
+
*/function R(e,t,n,i,a,r){return h(this,void 0,void 0,(function*(){const s={source:e,deadline:Number(t),licenseTerms:{price:n.price.toString(),duration:n.duration,royaltyBps:n.royaltyBps,paymentToken:n.paymentToken},metadata:i,parentId:r||[]};void 0!==a&&(s.fileKey=a);const o=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/register`,{method:"POST",headers:{Authorization:`Bearer ${this.getJwt()}`,"Content-Type":"application/json"},body:JSON.stringify(s)});if(!o.ok)throw new Error(`Failed to get signature: ${o.statusText}`);const d=yield o.json();if(d.isError)throw new Error(`Failed to get signature: ${d.message}`);return d.data}))}
|
|
224
224
|
/**
|
|
225
225
|
* Updates the license terms of a specified IPNFT.
|
|
226
226
|
* @param tokenId The ID of the IPNFT to update.
|
|
227
227
|
* @param newTerms The new license terms to set.
|
|
228
228
|
* @returns A promise that resolves when the transaction is complete.
|
|
229
|
-
*/function
|
|
229
|
+
*/function F(e,t){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"updateTerms",[e,t],{waitForReceipt:!0})}
|
|
230
230
|
/**
|
|
231
231
|
* Sets the IPNFT as deleted
|
|
232
232
|
* @param tokenId The token ID to set as deleted.
|
|
233
233
|
* @returns A promise that resolves when the transaction is complete.
|
|
234
|
-
*/function
|
|
234
|
+
*/function $(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"finalizeDelete",[e])}
|
|
235
|
+
/**
|
|
236
|
+
* Calls the getOrCreateRoyaltyVault method on the IPNFT contract.
|
|
237
|
+
* @param tokenOwner The address of the token owner for whom to get or create the royalty vault.
|
|
238
|
+
* @returns The address of the royalty vault associated with the specified token owner.
|
|
239
|
+
*/function H(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"getOrCreateRoyaltyVault",[e])}
|
|
235
240
|
/**
|
|
236
241
|
* Returns the license terms associated with a specific token ID.
|
|
237
242
|
* @param tokenId The token ID to query.
|
|
238
243
|
* @returns The license terms of the token ID.
|
|
239
|
-
*/function
|
|
244
|
+
*/function j(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"getTerms",[e])}
|
|
240
245
|
/**
|
|
241
246
|
* Returns the owner of the specified IPNFT.
|
|
242
247
|
* @param tokenId The ID of the IPNFT to query.
|
|
243
248
|
* @returns The address of the owner of the IPNFT.
|
|
244
|
-
*/function
|
|
249
|
+
*/function L(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"ownerOf",[e])}
|
|
245
250
|
/**
|
|
246
251
|
* Returns the number of IPNFTs owned by the given address.
|
|
247
252
|
* @param owner The address to query.
|
|
248
253
|
* @returns The number of IPNFTs owned by the address.
|
|
249
|
-
*/function
|
|
254
|
+
*/function W(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"balanceOf",[e])}
|
|
250
255
|
/**
|
|
251
256
|
* Returns the metadata URI associated with a specific token ID.
|
|
252
257
|
* @param tokenId The token ID to query.
|
|
253
258
|
* @returns The metadata URI of the token ID.
|
|
254
|
-
*/function
|
|
259
|
+
*/function q(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"tokenURI",[e])}
|
|
255
260
|
/**
|
|
256
261
|
* Returns the data status of the given token ID.
|
|
257
262
|
* @param tokenId The token ID to query.
|
|
258
263
|
* @returns The data status of the token ID.
|
|
259
|
-
*/function
|
|
264
|
+
*/function z(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"dataStatus",[e])}
|
|
260
265
|
/**
|
|
261
266
|
* Checks if an operator is approved to manage all assets of a given owner.
|
|
262
267
|
* @param owner The address of the asset owner.
|
|
263
268
|
* @param operator The address of the operator to check.
|
|
264
269
|
* @return A promise that resolves to a boolean indicating if the operator is approved for all assets of the owner.
|
|
265
|
-
*/function
|
|
270
|
+
*/function K(e,t){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"isApprovedForAll",[e,t])}function J(e,t,n){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"transferFrom",[e,t,n])}function V(e,t,n,i){const a=i?[e,t,n,i]:[e,t,n];return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"safeTransferFrom",a)}function G(e,t){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"approve",[e,t])}function Y(e,t){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"setApprovalForAll",[e,t])}
|
|
266
271
|
/**
|
|
267
272
|
* Buys access to a data NFT for a specified duration.
|
|
268
273
|
* @param buyer The address of the buyer.
|
|
@@ -272,38 +277,38 @@ let b=null,g=null;const E=()=>(g||(g=i({chain:I,transport:a()})),g);var _=[{inpu
|
|
|
272
277
|
* @param expectedPaymentToken The address of the payment token (use zero address for native token).
|
|
273
278
|
* @param value The amount of native token to send (only required if paying with native token).
|
|
274
279
|
* @returns A promise that resolves when the transaction is confirmed.
|
|
275
|
-
*/function
|
|
280
|
+
*/function X(e,t,n,i,a,r){return this.callContractMethod(this.environment.MARKETPLACE_CONTRACT_ADDRESS,this.environment.MARKETPLACE_ABI,"buyAccess",[e,t,n,i,a],{waitForReceipt:!0,value:r})}
|
|
276
281
|
/**
|
|
277
282
|
* Checks if a user has access to a specific token based on subscription expiry.
|
|
278
283
|
* @param user - The address of the user.
|
|
279
284
|
* @param tokenId - The ID of the token.
|
|
280
285
|
* @returns A promise that resolves to a boolean indicating if the user has access.
|
|
281
|
-
*/function
|
|
286
|
+
*/function Z(e,t){return h(this,void 0,void 0,(function*(){try{const n=yield this.subscriptionExpiry(t,e);return n>BigInt(Math.floor(Date.now()/1e3))}catch(e){return!1}}))}function Q(e,t){return this.callContractMethod(this.environment.MARKETPLACE_CONTRACT_ADDRESS,this.environment.MARKETPLACE_ABI,"subscriptionExpiry",[e,t])}
|
|
282
287
|
/**
|
|
283
288
|
* Approves a spender to spend a specified amount of tokens on behalf of the owner.
|
|
284
289
|
* If the current allowance is less than the specified amount, it will perform the approval.
|
|
285
290
|
* @param {ApproveParams} params - The parameters for the approval.
|
|
286
|
-
*/var
|
|
291
|
+
*/var ee,te,ne,ie,ae,re,se,oe,de,ue,pe,le,ye,ce,he,me;
|
|
287
292
|
/**
|
|
288
293
|
* The Origin class
|
|
289
294
|
* Handles the upload of files to Origin, as well as querying the user's stats
|
|
290
|
-
*/class
|
|
291
|
-
if(!(d&&u&&p&&void 0!==l&&y))throw new Error("Failed to register IpNFT: Missing required fields in registration response.");const[c]=yield this.viemClient.request({method:"eth_requestAccounts",params:[]}),h=yield this.mintWithSignature(c,d,i||[],p,y,n,s,l);if("0x1"!==h.status)throw console.error("Minting failed:",h),new Error(`Minting failed with status: ${h.status}`);return d.toString()})),this.mintSocial=(e,t,n)=>y(this,void 0,void 0,(function*(){if(!this.viemClient)throw new Error("WalletClient not connected.");const i=BigInt(Math.floor(Date.now()/1e3)+600),a=yield this.registerIpNFT(e,i,n,t),{tokenId:r,signerAddress:s,creatorContentHash:o,signature:d,uri:u}=a;// 10 minutes from now
|
|
292
|
-
if(!(r&&s&&o&&void 0!==d&&u))throw new Error("Failed to register Social IpNFT: Missing required fields in registration response.");const[p]=yield this.viemClient.request({method:"eth_requestAccounts",params:[]}),l=yield this.mintWithSignature(p,r,[],o,u,n,i,d);if("0x1"!==l.status)throw new Error(`Minting Social IpNFT failed with status: ${l.status}`);return r.toString()})),this.getOriginUploads=()=>y(this,void 0,void 0,(function*(){const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/files`,{method:"GET",headers:{Authorization:`Bearer ${this.jwt}`}});if(!e.ok)return console.error("Failed to get origin uploads"),null;return(yield e.json()).data})),this.jwt=t,this.viemClient=i,this.environment=n,
|
|
295
|
+
*/class Te{constructor(e,t,n){ee.add(this),this.jwt=e,this.viemClient=n,this.environment=t,
|
|
293
296
|
// DataNFT methods
|
|
294
|
-
this.mintWithSignature=
|
|
297
|
+
this.mintWithSignature=B.bind(this),this.registerIpNFT=R.bind(this),this.updateTerms=F.bind(this),this.finalizeDelete=$.bind(this),this.getOrCreateRoyaltyVault=H.bind(this),this.getTerms=j.bind(this),this.ownerOf=L.bind(this),this.balanceOf=W.bind(this),this.tokenURI=q.bind(this),this.dataStatus=z.bind(this),this.isApprovedForAll=K.bind(this),this.transferFrom=J.bind(this),this.safeTransferFrom=V.bind(this),this.approve=G.bind(this),this.setApprovalForAll=Y.bind(this),
|
|
295
298
|
// Marketplace methods
|
|
296
|
-
this.buyAccess=
|
|
299
|
+
this.buyAccess=X.bind(this),this.hasAccess=Z.bind(this),this.subscriptionExpiry=Q.bind(this)}getJwt(){return this.jwt}setViemClient(e){this.viemClient=e}uploadFile(t,n){return h(this,void 0,void 0,(function*(){let i;try{i=yield m(this,ee,"m",te).call(this,t)}catch(e){throw console.error("Failed to generate upload URL:",e),new Error(`Failed to generate upload URL: ${e instanceof Error?e.message:String(e)}`)}if(!i)throw new Error("Failed to generate upload URL: No upload info returned");try{yield((t,n,i)=>new Promise(((a,r)=>{e.put(n,t,Object.assign({headers:{"Content-Type":t.type}},"undefined"!=typeof window&&"function"==typeof i?{onUploadProgress:e=>{if(e.total){const t=e.loaded/e.total*100;i(t)}}}:{})).then((e=>{a(e.data)})).catch((e=>{var t;const n=(null===(t=null==e?void 0:e.response)||void 0===t?void 0:t.data)||(null==e?void 0:e.message)||"Upload failed";r(n)}))})))(t,i.url,(null==n?void 0:n.progressCallback)||(()=>{}))}catch(e){try{yield m(this,ee,"m",ne).call(this,i.key,"failed")}catch(e){console.error("Failed to update status to failed:",e)}const t=e instanceof Error?e.message:String(e);throw new Error(`Failed to upload file: ${t}`)}try{yield m(this,ee,"m",ne).call(this,i.key,"success")}catch(e){console.error("Failed to update status to success:",e)}return i}))}mintFile(e,t,n,i,a){return h(this,void 0,void 0,(function*(){if(!this.viemClient)throw new Error("WalletClient not connected.");const r=yield this.uploadFile(e,a);if(!r||!r.key)throw new Error("Failed to upload file or get upload info.");const s=BigInt(Date.now()+6e5),o=yield this.registerIpNFT("file",s,n,t,r.key,i),{tokenId:d,signerAddress:u,creatorContentHash:p,signature:l,uri:y}=o;// 10 minutes from now
|
|
300
|
+
if(!(d&&u&&p&&void 0!==l&&y))throw new Error("Failed to register IpNFT: Missing required fields in registration response.");const[c]=yield this.viemClient.request({method:"eth_requestAccounts",params:[]}),h=yield this.mintWithSignature(c,d,i||[],p,y,n,s,l);if("0x1"!==h.status)throw console.error("Minting failed:",h),new Error(`Minting failed with status: ${h.status}`);return d.toString()}))}mintSocial(e,t,n){return h(this,void 0,void 0,(function*(){if(!this.viemClient)throw new Error("WalletClient not connected.");const i=BigInt(Math.floor(Date.now()/1e3)+600),a=yield this.registerIpNFT(e,i,n,t),{tokenId:r,signerAddress:s,creatorContentHash:o,signature:d,uri:u}=a;// 10 minutes from now
|
|
301
|
+
if(!(r&&s&&o&&void 0!==d&&u))throw new Error("Failed to register Social IpNFT: Missing required fields in registration response.");const[p]=yield this.viemClient.request({method:"eth_requestAccounts",params:[]}),l=yield this.mintWithSignature(p,r,[],o,u,n,i,d);if("0x1"!==l.status)throw new Error(`Minting Social IpNFT failed with status: ${l.status}`);return r.toString()}))}getOriginUploads(){return h(this,void 0,void 0,(function*(){const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/files`,{method:"GET",headers:{Authorization:`Bearer ${this.jwt}`}});if(!e.ok)return console.error("Failed to get origin uploads"),null;return(yield e.json()).data}))}
|
|
297
302
|
/**
|
|
298
303
|
* Get the user's Origin stats (multiplier, consent, usage, etc.).
|
|
299
304
|
* @returns {Promise<OriginUsageReturnType>} A promise that resolves with the user's Origin stats.
|
|
300
|
-
*/getOriginUsage(){return
|
|
305
|
+
*/getOriginUsage(){return h(this,void 0,void 0,(function*(){const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/usage`,{method:"GET",headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"}}).then((e=>e.json()));if(!e.isError&&e.data.user)return e;throw new T(e.message||"Failed to fetch Origin usage")}))}
|
|
301
306
|
/**
|
|
302
307
|
* Set the user's consent for Origin usage.
|
|
303
308
|
* @param {boolean} consent The user's consent.
|
|
304
309
|
* @returns {Promise<void>}
|
|
305
310
|
* @throws {Error|APIError} - Throws an error if the user is not authenticated. Also throws an error if the consent is not provided.
|
|
306
|
-
*/setOriginConsent(e){return
|
|
311
|
+
*/setOriginConsent(e){return h(this,void 0,void 0,(function*(){if(void 0===e)throw new T("Consent is required");const t=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/status`,{method:"PATCH",headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"},body:JSON.stringify({active:e})}).then((e=>e.json()));if(t.isError)throw new T(t.message||"Failed to set Origin consent")}))}
|
|
307
312
|
/**
|
|
308
313
|
* Call a contract method.
|
|
309
314
|
* @param {string} contractAddress The contract address.
|
|
@@ -313,22 +318,45 @@ this.buyAccess=J.bind(this),this.hasAccess=V.bind(this),this.subscriptionExpiry=
|
|
|
313
318
|
* @param {CallOptions} [options] The call options.
|
|
314
319
|
* @returns {Promise<any>} A promise that resolves with the result of the contract call or transaction hash.
|
|
315
320
|
* @throws {Error} - Throws an error if the wallet client is not connected and the method is not a view function.
|
|
316
|
-
*/callContractMethod(e,t,n,i){return
|
|
321
|
+
*/callContractMethod(e,t,n,i){return h(this,arguments,void 0,(function*(e,t,n,i,a={}){const r=s({abi:t,name:n}),d=r&&"stateMutability"in r&&("view"===r.stateMutability||"pure"===r.stateMutability);if(!d&&!this.viemClient)throw new Error("WalletClient not connected.");if(d){const a=C();return(yield a.readContract({address:e,abi:t,functionName:n,args:i}))||null}{const[r]=yield this.viemClient.request({method:"eth_requestAccounts",params:[]}),s=o({abi:t,functionName:n,args:i});yield m(this,ee,"m",ae).call(this,this.environment.CHAIN);try{const t=yield this.viemClient.sendTransaction({to:e,data:s,account:r,value:a.value,gas:a.gas});if("string"!=typeof t)throw new Error("Transaction failed to send.");if(!a.waitForReceipt)return t;return yield m(this,ee,"m",ie).call(this,t)}catch(e){throw console.error("Transaction failed:",e),new Error("Transaction failed: "+e)}}}))}
|
|
317
322
|
/**
|
|
318
323
|
* Buy access to an asset by first checking its price via getTerms, then calling buyAccess.
|
|
319
324
|
* @param {bigint} tokenId The token ID of the asset.
|
|
320
325
|
* @returns {Promise<any>} The result of the buyAccess call.
|
|
321
|
-
*/buyAccessSmart(e){return
|
|
326
|
+
*/buyAccessSmart(e){return h(this,void 0,void 0,(function*(){if(!this.viemClient)throw new Error("WalletClient not connected.");const t=yield this.getTerms(e);if(!t)throw new Error("Failed to fetch terms for asset");const{price:n,paymentToken:i,duration:a}=t;if(void 0===n||void 0===i||void 0===a)throw new Error("Terms missing price, paymentToken, or duration");const[s]=yield this.viemClient.request({method:"eth_requestAccounts",params:[]}),o=n;return i===d?this.buyAccess(s,e,o,a,i,o):(yield function(e){return h(this,arguments,void 0,(function*({walletClient:e,publicClient:t,tokenAddress:n,owner:i,spender:a,amount:s}){(yield t.readContract({address:n,abi:r,functionName:"allowance",args:[i,a]}))<s&&(yield e.writeContract({address:n,account:i,abi:r,functionName:"approve",args:[a,s],chain:g}))}))}({walletClient:this.viemClient,publicClient:C(),tokenAddress:i,owner:s,spender:this.environment.MARKETPLACE_CONTRACT_ADDRESS,amount:o}),this.buyAccess(s,e,o,a,i))}))}getData(e){return h(this,void 0,void 0,(function*(){const t=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/data/${e}`,{method:"GET",headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"}});if(!t.ok)throw new Error("Failed to fetch data");return t.json()}))}
|
|
327
|
+
/**
|
|
328
|
+
* Get royalty information for a wallet address, including the royalty vault address and its balance.
|
|
329
|
+
* @param {Address} [owner] - Optional wallet address to check royalties for. If not provided, uses the connected wallet.
|
|
330
|
+
* @returns {Promise<RoyaltyInfo>} A promise that resolves with the royalty vault address and balance information.
|
|
331
|
+
* @throws {Error} Throws an error if no wallet is connected and no owner address is provided.
|
|
332
|
+
* @example
|
|
333
|
+
* ```typescript
|
|
334
|
+
* // Get royalties for connected wallet
|
|
335
|
+
* const royalties = await origin.getRoyalties();
|
|
336
|
+
*
|
|
337
|
+
* // Get royalties for specific address
|
|
338
|
+
* const royalties = await origin.getRoyalties("0x1234...");
|
|
339
|
+
* ```
|
|
340
|
+
*/getRoyalties(e,t){return h(this,void 0,void 0,(function*(){const n=yield m(this,ee,"m",re).call(this,t);try{const t=yield this.getOrCreateRoyaltyVault(n),i=C();let a,r;if(e&&e!==d){
|
|
341
|
+
// erc20 (wrapped camp)
|
|
342
|
+
const n=[{inputs:[{name:"owner",type:"address"}],name:"balanceOf",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{name:"",type:"uint8"}],stateMutability:"view",type:"function"}];a=yield this.callContractMethod(e,n,"balanceOf",[t]);const i=yield this.callContractMethod(e,n,"decimals",[]);r=p(a,i)}else a=yield i.getBalance({address:t}),r=u(a);return{royaltyVault:t,balance:a,balanceFormatted:r}}catch(e){throw new Error(`Failed to retrieve royalties for address ${n}: ${e instanceof Error?e.message:String(e)}`)}}))}
|
|
343
|
+
/**
|
|
344
|
+
* Claim royalties from the royalty vault.
|
|
345
|
+
* @param {Address} [token] - Optional token address to claim royalties in. If not provided, claims in native token.
|
|
346
|
+
* @param {Address} [owner] - Optional wallet address to claim royalties for. If not provided, uses the connected wallet.
|
|
347
|
+
* @returns {Promise<any>} A promise that resolves when the claim transaction is confirmed.
|
|
348
|
+
* @throws {Error} Throws an error if no wallet is connected and no owner address is provided.
|
|
349
|
+
*/claimRoyalties(e,t){return h(this,void 0,void 0,(function*(){const n=yield m(this,ee,"m",re).call(this,t),i=yield this.getOrCreateRoyaltyVault(n);return this.callContractMethod(i,this.environment.ROYALTY_VAULT_ABI,"claimRoyalties",[null!=e?e:d],{waitForReceipt:!0})}))}}ee=new WeakSet,te=function(e){return h(this,void 0,void 0,(function*(){try{const t=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/upload-url`,{method:"POST",body:JSON.stringify({name:e.name,type:e.type}),headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"}});if(!t.ok)throw new Error(`HTTP ${t.status}: ${t.statusText}`);const n=yield t.json();if(n.isError)throw new Error(n.message||"Failed to generate upload URL");return n.data}catch(e){throw console.error("Failed to generate upload URL:",e),e}}))},ne=function(e,t){return h(this,void 0,void 0,(function*(){try{const n=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/update-status`,{method:"PATCH",body:JSON.stringify({status:t,fileKey:e}),headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"}});if(!n.ok){const e=yield n.text().catch((()=>"Unknown error"));throw new Error(`HTTP ${n.status}: ${e}`)}return!0}catch(e){throw console.error("Failed to update origin status:",e),e}}))},ie=function(e){return h(this,void 0,void 0,(function*(){if(!this.viemClient)throw new Error("WalletClient not connected.");for(;;){const t=yield this.viemClient.request({method:"eth_getTransactionReceipt",params:[e]});if(t&&t.blockNumber)return t;yield new Promise((e=>setTimeout(e,1e3)))}}))},ae=function(e){return h(this,void 0,void 0,(function*(){
|
|
322
350
|
// return;
|
|
323
351
|
if(!this.viemClient)throw new Error("WalletClient not connected.");let t=yield this.viemClient.request({method:"eth_chainId",params:[]});if("string"==typeof t&&(t=parseInt(t,16)),t!==e.id)try{yield this.viemClient.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x"+BigInt(e.id).toString(16)}]})}catch(t){
|
|
324
352
|
// Unrecognized chain
|
|
325
|
-
if(4902!==t.code)throw t;yield this.viemClient.request({method:"wallet_addEthereumChain",params:[{chainId:"0x"+BigInt(e.id).toString(16),chainName:e.name,rpcUrls:e.rpcUrls.default.http,nativeCurrency:e.nativeCurrency}]}),yield this.viemClient.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x"+BigInt(e.id).toString(16)}]})}}))};
|
|
353
|
+
if(4902!==t.code)throw t;yield this.viemClient.request({method:"wallet_addEthereumChain",params:[{chainId:"0x"+BigInt(e.id).toString(16),chainName:e.name,rpcUrls:e.rpcUrls.default.http,nativeCurrency:e.nativeCurrency}]}),yield this.viemClient.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x"+BigInt(e.id).toString(16)}]})}}))},re=function(e){return h(this,void 0,void 0,(function*(){if(e)return e;if(!this.viemClient)throw new Error("No wallet address provided and no wallet client connected. Please provide an owner address or connect a wallet.");try{const e=yield this.viemClient.request({method:"eth_requestAccounts",params:[]});if(!e||0===e.length)throw new Error("No accounts found in connected wallet.");return e[0]}catch(e){throw new Error(`Failed to get wallet address: ${e instanceof Error?e.message:String(e)}`)}}))};
|
|
326
354
|
/**
|
|
327
355
|
* The Auth class.
|
|
328
356
|
* @class
|
|
329
357
|
* @classdesc The Auth class is used to authenticate the user.
|
|
330
358
|
*/
|
|
331
|
-
class
|
|
359
|
+
class fe{
|
|
332
360
|
/**
|
|
333
361
|
* Constructor for the Auth class.
|
|
334
362
|
* @param {object} options The options object.
|
|
@@ -339,7 +367,7 @@ class ye{
|
|
|
339
367
|
* @param {("DEVELOPMENT"|"PRODUCTION")} [options.environment="DEVELOPMENT"] The environment to use.
|
|
340
368
|
* @throws {APIError} - Throws an error if the clientId is not provided.
|
|
341
369
|
*/
|
|
342
|
-
constructor({clientId:e,redirectUri:t,allowAnalytics:n=!0,ackeeInstance:i,environment:a="DEVELOPMENT"}){if(
|
|
370
|
+
constructor({clientId:e,redirectUri:t,allowAnalytics:n=!0,ackeeInstance:i,environment:a="DEVELOPMENT"}){if(se.add(this),oe.set(this,void 0),de.set(this,void 0),!e)throw new Error("clientId is required");if(-1===["PRODUCTION","DEVELOPMENT"].indexOf(a))throw new Error("Invalid environment, must be DEVELOPMENT or PRODUCTION");this.viem=null,this.environment=x[a],this.redirectUri=(e=>{const t=["twitter","discord","spotify"];return"object"==typeof e?t.reduce(((t,n)=>(t[n]=e[n]||("undefined"!=typeof window?window.location.href:""),t)),{}):"string"==typeof e?t.reduce(((t,n)=>(t[n]=e,t)),{}):e?{}:t.reduce(((e,t)=>(e[t]="undefined"!=typeof window?window.location.href:"",e)),{})})(t),this.clientId=e,this.isAuthenticated=!1,this.jwt=null,this.origin=null,this.walletAddress=null,this.userId=null,function(e,t,n,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===i?a.call(e,n):a?a.value=n:t.set(e,n)}(this,oe,{},"f"),M((e=>{m(this,se,"m",ue).call(this,"providers",e)})),m(this,se,"m",pe).call(this)}
|
|
343
371
|
/**
|
|
344
372
|
* Subscribe to an event. Possible events are "state", "provider", "providers", and "viem".
|
|
345
373
|
* @param {("state"|"provider"|"providers"|"viem")} event The event.
|
|
@@ -349,24 +377,24 @@ constructor({clientId:e,redirectUri:t,allowAnalytics:n=!0,ackeeInstance:i,enviro
|
|
|
349
377
|
* auth.on("state", (state) => {
|
|
350
378
|
* console.log(state);
|
|
351
379
|
* });
|
|
352
|
-
*/on(e,t){
|
|
380
|
+
*/on(e,t){m(this,oe,"f")[e]||(m(this,oe,"f")[e]=[]),m(this,oe,"f")[e].push(t),"providers"===e&&t(U())}
|
|
353
381
|
/**
|
|
354
382
|
* Set the loading state.
|
|
355
383
|
* @param {boolean} loading The loading state.
|
|
356
384
|
* @returns {void}
|
|
357
|
-
*/setLoading(e){
|
|
385
|
+
*/setLoading(e){m(this,se,"m",ue).call(this,"state",e?"loading":this.isAuthenticated?"authenticated":"unauthenticated")}
|
|
358
386
|
/**
|
|
359
387
|
* Set the provider. This is useful for setting the provider when the user selects a provider from the UI or when dApp wishes to use a specific provider.
|
|
360
388
|
* @param {object} options The options object. Includes the provider and the provider info.
|
|
361
389
|
* @returns {void}
|
|
362
390
|
* @throws {APIError} - Throws an error if the provider is not provided.
|
|
363
|
-
*/setProvider({provider:e,info:i,address:a}){if(!e)throw new
|
|
391
|
+
*/setProvider({provider:e,info:i,address:a}){if(!e)throw new T("provider is required");this.viem=((e,i="window.ethereum",
|
|
364
392
|
// chain: "mainnet" | "testnet" = "testnet",
|
|
365
|
-
a,r)=>{var s;if(!e&&!
|
|
393
|
+
a,r)=>{var s;if(!e&&!E)return console.warn("Provider is required to create a client."),null;if(!E||E.transport.name!==i&&e||r!==(null===(s=E.account)||void 0===s?void 0:s.address)&&e){const s={
|
|
366
394
|
// chain: chain === "mainnet" ? mainnet : testnet,
|
|
367
|
-
chain:a||
|
|
395
|
+
chain:a||g,transport:t(e,{name:i})};r&&(s.account=y(r)),E=n(s)}return E})(e,i.name,this.environment.CHAIN,a),this.origin&&this.origin.setViemClient(this.viem),
|
|
368
396
|
// TODO: only use one of these
|
|
369
|
-
|
|
397
|
+
m(this,se,"m",ue).call(this,"viem",this.viem),m(this,se,"m",ue).call(this,"provider",{provider:e,info:i}),localStorage.setItem("camp-sdk:provider",JSON.stringify(i))}
|
|
370
398
|
/**
|
|
371
399
|
* Set the wallet address. This is useful for edge cases where the provider can't return the wallet address. Don't use this unless you know what you're doing.
|
|
372
400
|
* @param {string} walletAddress The wallet address.
|
|
@@ -375,7 +403,7 @@ c(this,te,"m",ae).call(this,"viem",this.viem),c(this,te,"m",ae).call(this,"provi
|
|
|
375
403
|
/**
|
|
376
404
|
* Recover the provider from local storage.
|
|
377
405
|
* @returns {Promise<void>}
|
|
378
|
-
*/recoverProvider(){return
|
|
406
|
+
*/recoverProvider(){return h(this,void 0,void 0,(function*(){var e,t,n,i,a,r,s,o,d,u,p,l,y,c,h;if(!this.walletAddress)return void console.warn("No wallet address found in local storage. Please connect your wallet again.");const m=JSON.parse(localStorage.getItem("camp-sdk:provider")||"{}");let T;const f=null!==(e=U())&&void 0!==e?e:[];
|
|
379
407
|
// first pass: try to find provider by UUID/name and check if it has the right address
|
|
380
408
|
// without prompting (using eth_accounts)
|
|
381
409
|
for(const e of f)try{if(m.uuid&&(null===(t=e.info)||void 0===t?void 0:t.uuid)===m.uuid||m.name&&(null===(n=e.info)||void 0===n?void 0:n.name)===m.name){
|
|
@@ -392,12 +420,12 @@ if(!T&&(m.uuid||m.name))for(const e of f)try{if(m.uuid&&(null===(u=e.info)||void
|
|
|
392
420
|
/**
|
|
393
421
|
* Disconnect the user.
|
|
394
422
|
* @returns {Promise<void>}
|
|
395
|
-
*/disconnect(){return
|
|
423
|
+
*/disconnect(){return h(this,void 0,void 0,(function*(){this.isAuthenticated&&(m(this,se,"m",ue).call(this,"state","unauthenticated"),this.isAuthenticated=!1,this.walletAddress=null,this.userId=null,this.jwt=null,this.origin=null,localStorage.removeItem("camp-sdk:wallet-address"),localStorage.removeItem("camp-sdk:user-id"),localStorage.removeItem("camp-sdk:jwt"),localStorage.removeItem("camp-sdk:environment"))}))}
|
|
396
424
|
/**
|
|
397
425
|
* Connect the user's wallet and sign the message.
|
|
398
426
|
* @returns {Promise<{ success: boolean; message: string; walletAddress: string }>} A promise that resolves with the authentication result.
|
|
399
427
|
* @throws {APIError} - Throws an error if the user cannot be authenticated.
|
|
400
|
-
*/connect(){return
|
|
428
|
+
*/connect(){return h(this,void 0,void 0,(function*(){m(this,se,"m",ue).call(this,"state","loading");try{this.walletAddress||(yield m(this,se,"m",le).call(this)),this.walletAddress=l(this.walletAddress);const e=yield m(this,se,"m",ye).call(this),t=m(this,se,"m",he).call(this,e),n=yield this.viem.signMessage({account:this.walletAddress,message:t}),i=yield m(this,se,"m",ce).call(this,t,n);if(i.success)return this.isAuthenticated=!0,this.userId=i.userId,this.jwt=i.token,this.origin=new Te(this.jwt,this.environment,this.viem),localStorage.setItem("camp-sdk:jwt",this.jwt),localStorage.setItem("camp-sdk:wallet-address",this.walletAddress),localStorage.setItem("camp-sdk:user-id",this.userId),localStorage.setItem("camp-sdk:environment",this.environment.NAME),m(this,se,"m",ue).call(this,"state","authenticated"),yield m(this,se,"m",me).call(this,P.USER_CONNECTED,"User Connected"),{success:!0,message:"Successfully authenticated",walletAddress:this.walletAddress};throw this.isAuthenticated=!1,m(this,se,"m",ue).call(this,"state","unauthenticated"),new T("Failed to authenticate")}catch(e){throw this.isAuthenticated=!1,m(this,se,"m",ue).call(this,"state","unauthenticated"),new T(e)}}))}
|
|
401
429
|
/**
|
|
402
430
|
* Get the user's linked social accounts.
|
|
403
431
|
* @returns {Promise<Record<string, boolean>>} A promise that resolves with the user's linked social accounts.
|
|
@@ -406,34 +434,34 @@ if(!T&&(m.uuid||m.name))for(const e of f)try{if(m.uuid&&(null===(u=e.info)||void
|
|
|
406
434
|
* const auth = new Auth({ clientId: "your-client-id" });
|
|
407
435
|
* const socials = await auth.getLinkedSocials();
|
|
408
436
|
* console.log(socials);
|
|
409
|
-
*/getLinkedSocials(){return
|
|
437
|
+
*/getLinkedSocials(){return h(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/client-user/connections-sdk`,{method:"GET",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"}}).then((e=>e.json()));if(e.isError)throw new T(e.message||"Failed to fetch connections");{const t={};return Object.keys(e.data.data).forEach((n=>{t[n.split("User")[0]]=e.data.data[n]})),t}}))}
|
|
410
438
|
/**
|
|
411
439
|
* Link the user's Twitter account.
|
|
412
440
|
* @returns {Promise<void>}
|
|
413
441
|
* @throws {Error} - Throws an error if the user is not authenticated.
|
|
414
|
-
*/linkTwitter(){return
|
|
442
|
+
*/linkTwitter(){return h(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");window.location.href=`${this.environment.AUTH_HUB_BASE_API}/twitter/connect?clientId=${this.clientId}&userId=${this.userId}&redirect_url=${this.redirectUri.twitter}`}))}
|
|
415
443
|
/**
|
|
416
444
|
* Link the user's Discord account.
|
|
417
445
|
* @returns {Promise<void>}
|
|
418
446
|
* @throws {Error} - Throws an error if the user is not authenticated.
|
|
419
|
-
*/linkDiscord(){return
|
|
447
|
+
*/linkDiscord(){return h(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");window.location.href=`${this.environment.AUTH_HUB_BASE_API}/discord/connect?clientId=${this.clientId}&userId=${this.userId}&redirect_url=${this.redirectUri.discord}`}))}
|
|
420
448
|
/**
|
|
421
449
|
* Link the user's Spotify account.
|
|
422
450
|
* @returns {Promise<void>}
|
|
423
451
|
* @throws {Error} - Throws an error if the user is not authenticated.
|
|
424
|
-
*/linkSpotify(){return
|
|
452
|
+
*/linkSpotify(){return h(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");window.location.href=`${this.environment.AUTH_HUB_BASE_API}/spotify/connect?clientId=${this.clientId}&userId=${this.userId}&redirect_url=${this.redirectUri.spotify}`}))}
|
|
425
453
|
/**
|
|
426
454
|
* Link the user's TikTok account.
|
|
427
455
|
* @param {string} handle The user's TikTok handle.
|
|
428
456
|
* @returns {Promise<any>} A promise that resolves with the TikTok account data.
|
|
429
457
|
* @throws {Error|APIError} - Throws an error if the user is not authenticated.
|
|
430
|
-
*/linkTikTok(e){return
|
|
458
|
+
*/linkTikTok(e){return h(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");const t=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/tiktok/connect-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({userHandle:e,clientId:this.clientId,userId:this.userId})}).then((e=>e.json()));if(t.isError)throw"Request failed with status code 502"===t.message?new T("TikTok service is currently unavailable, try again later"):new T(t.message||"Failed to link TikTok account");return m(this,se,"m",me).call(this,P.TIKTOK_LINKED,"TikTok Linked"),t.data}))}
|
|
431
459
|
/**
|
|
432
460
|
* Send an OTP to the user's Telegram account.
|
|
433
461
|
* @param {string} phoneNumber The user's phone number.
|
|
434
462
|
* @returns {Promise<any>} A promise that resolves with the OTP data.
|
|
435
463
|
* @throws {Error|APIError} - Throws an error if the user is not authenticated.
|
|
436
|
-
*/sendTelegramOTP(e){return
|
|
464
|
+
*/sendTelegramOTP(e){return h(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");if(!e)throw new T("Phone number is required");yield this.unlinkTelegram();const t=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/telegram/sendOTP-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({phone:e})}).then((e=>e.json()));if(t.isError)throw new T(t.message||"Failed to send Telegram OTP");return t.data}))}
|
|
437
465
|
/**
|
|
438
466
|
* Link the user's Telegram account.
|
|
439
467
|
* @param {string} phoneNumber The user's phone number.
|
|
@@ -441,38 +469,38 @@ if(!T&&(m.uuid||m.name))for(const e of f)try{if(m.uuid&&(null===(u=e.info)||void
|
|
|
441
469
|
* @param {string} phoneCodeHash The phone code hash.
|
|
442
470
|
* @returns {Promise<object>} A promise that resolves with the Telegram account data.
|
|
443
471
|
* @throws {APIError|Error} - Throws an error if the user is not authenticated. Also throws an error if the phone number, OTP, and phone code hash are not provided.
|
|
444
|
-
*/linkTelegram(e,t,n){return
|
|
472
|
+
*/linkTelegram(e,t,n){return h(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");if(!e||!t||!n)throw new T("Phone number, OTP, and phone code hash are required");const i=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/telegram/signIn-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({phone:e,code:t,phone_code_hash:n,userId:this.userId,clientId:this.clientId})}).then((e=>e.json()));if(i.isError)throw new T(i.message||"Failed to link Telegram account");return m(this,se,"m",me).call(this,P.TELEGRAM_LINKED,"Telegram Linked"),i.data}))}
|
|
445
473
|
/**
|
|
446
474
|
* Unlink the user's Twitter account.
|
|
447
475
|
* @returns {Promise<any>} A promise that resolves with the unlink result.
|
|
448
476
|
* @throws {Error} - Throws an error if the user is not authenticated.
|
|
449
477
|
* @throws {APIError} - Throws an error if the request fails.
|
|
450
|
-
*/unlinkTwitter(){return
|
|
478
|
+
*/unlinkTwitter(){return h(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/twitter/disconnect-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({id:this.userId})}).then((e=>e.json()));if(e.isError)throw new T(e.message||"Failed to unlink Twitter account");return e.data}))}
|
|
451
479
|
/**
|
|
452
480
|
* Unlink the user's Discord account.
|
|
453
481
|
* @returns {Promise<any>} A promise that resolves with the unlink result.
|
|
454
482
|
* @throws {Error} - Throws an error if the user is not authenticated.
|
|
455
483
|
* @throws {APIError} - Throws an error if the request fails.
|
|
456
|
-
*/unlinkDiscord(){return
|
|
484
|
+
*/unlinkDiscord(){return h(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new T("User needs to be authenticated");const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/discord/disconnect-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({id:this.userId})}).then((e=>e.json()));if(e.isError)throw new T(e.message||"Failed to unlink Discord account");return e.data}))}
|
|
457
485
|
/**
|
|
458
486
|
* Unlink the user's Spotify account.
|
|
459
487
|
* @returns {Promise<any>} A promise that resolves with the unlink result.
|
|
460
488
|
* @throws {Error} - Throws an error if the user is not authenticated.
|
|
461
489
|
* @throws {APIError} - Throws an error if the request fails.
|
|
462
|
-
*/unlinkSpotify(){return
|
|
490
|
+
*/unlinkSpotify(){return h(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new T("User needs to be authenticated");const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/spotify/disconnect-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({id:this.userId})}).then((e=>e.json()));if(e.isError)throw new T(e.message||"Failed to unlink Spotify account");return e.data}))}
|
|
463
491
|
/**
|
|
464
492
|
* Unlink the user's TikTok account.
|
|
465
493
|
* @returns {Promise<any>} A promise that resolves with the unlink result.
|
|
466
494
|
* @throws {Error} - Throws an error if the user is not authenticated.
|
|
467
495
|
* @throws {APIError} - Throws an error if the request fails.
|
|
468
|
-
*/unlinkTikTok(){return
|
|
496
|
+
*/unlinkTikTok(){return h(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new T("User needs to be authenticated");const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/tiktok/disconnect-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({userId:this.userId})}).then((e=>e.json()));if(e.isError)throw new T(e.message||"Failed to unlink TikTok account");return e.data}))}
|
|
469
497
|
/**
|
|
470
498
|
* Unlink the user's Telegram account.
|
|
471
499
|
* @returns {Promise<any>} A promise that resolves with the unlink result.
|
|
472
500
|
* @throws {Error} - Throws an error if the user is not authenticated.
|
|
473
501
|
* @throws {APIError} - Throws an error if the request fails.
|
|
474
|
-
*/unlinkTelegram(){return
|
|
502
|
+
*/unlinkTelegram(){return h(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new T("User needs to be authenticated");const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/telegram/disconnect-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({userId:this.userId})}).then((e=>e.json()));if(e.isError)throw new T(e.message||"Failed to unlink Telegram account");return e.data}))}}oe=new WeakMap,de=new WeakMap,se=new WeakSet,ue=function(e,t){m(this,oe,"f")[e]&&m(this,oe,"f")[e].forEach((e=>e(t)))},pe=function(e){return h(this,void 0,void 0,(function*(){if("undefined"==typeof localStorage)return;const t=null===localStorage||void 0===localStorage?void 0:localStorage.getItem("camp-sdk:wallet-address"),n=null===localStorage||void 0===localStorage?void 0:localStorage.getItem("camp-sdk:user-id"),i=null===localStorage||void 0===localStorage?void 0:localStorage.getItem("camp-sdk:jwt"),a=null===localStorage||void 0===localStorage?void 0:localStorage.getItem("camp-sdk:environment");t&&n&&i&&(a===this.environment.NAME||!a)?(this.walletAddress=t,this.userId=n,this.jwt=i,this.origin=new Te(this.jwt,this.environment),this.isAuthenticated=!0,e?this.setProvider({provider:e.provider,info:e.info||{name:"Unknown"},address:t}):(console.warn("No matching provider was given for the stored wallet address. Trying to recover provider."),yield this.recoverProvider())):this.isAuthenticated=!1}))},le=function(){return h(this,void 0,void 0,(function*(){try{const[e]=yield this.viem.requestAddresses();return this.walletAddress=l(e),this.walletAddress}catch(e){throw new T(e)}}))},ye=function(){return h(this,void 0,void 0,(function*(){try{const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/client-user/nonce`,{method:"POST",headers:{"Content-Type":"application/json","x-client-id":this.clientId},body:JSON.stringify({walletAddress:this.walletAddress})}),t=yield e.json();return 200!==e.status?Promise.reject(t.message||"Failed to fetch nonce"):t.data}catch(e){throw new Error(e)}}))},ce=function(e,t){return h(this,void 0,void 0,(function*(){try{const n=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/client-user/verify`,{method:"POST",headers:{"Content-Type":"application/json","x-client-id":this.clientId},body:JSON.stringify({message:e,signature:t,walletAddress:this.walletAddress})}),i=yield n.json(),a=i.data.split(".")[1],r=JSON.parse(atob(a));return{success:!i.isError,userId:r.id,token:i.data}}catch(e){throw new T(e)}}))},he=function(e){return c({domain:window.location.host,address:this.walletAddress,statement:D,uri:window.location.origin,version:"1",chainId:this.viem.chain.id,nonce:e})},me=function(e,t){return h(this,arguments,void 0,(function*(e,t,n=1){
|
|
475
503
|
// if (this.#ackeeInstance)
|
|
476
504
|
// await sendAnalyticsEvent(this.#ackeeInstance, event, message, count);
|
|
477
505
|
// else return;
|
|
478
|
-
}))};export{
|
|
506
|
+
}))};export{fe as Auth,b as SpotifyAPI,I as TwitterAPI};
|