@story-protocol/ipkit 0.4.1 → 0.4.2
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.
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e,t,r=require("react"),n=require("@tanstack/react-query");exports.API_URL=void 0,(e=exports.API_URL||(exports.API_URL={})).STAGING="https://staging-api.storyprotocol.net/api/v4",e.PRODUCTION="https://api.storyapis.com/api/v4",exports.IPKIT_SUPPORTED_CHAIN=void 0,(t=exports.IPKIT_SUPPORTED_CHAIN||(exports.IPKIT_SUPPORTED_CHAIN={})).AENEID_TESTNET="story-aeneid",t.STORY_MAINNET="story";var i,o={name:"Wrapped IP",address:"0x1514000000000000000000000000000000000000",symbol:"WIP"},s={id:1315,name:"story-aeneid",apiVersion:"v3",displayName:"Story Aeneid Testnet",rpcUrl:"https://aeneid.storyrpc.io/",blockExplorerUrl:"https://aeneid.storyscan.io",protocolExplorerUrl:"https://aeneid.explorer.story.foundation",defaultCurrency:o},a={id:1514,name:"story",apiVersion:"v3",displayName:"Story Mainnet",rpcUrl:"https://mainnet.storyrpc.io",blockExplorerUrl:"https://storyscan.io",protocolExplorerUrl:"https://explorer.story.foundation",defaultCurrency:o},u=((i={})[s.name]=s,i[a.name]=a,i),p=function(){return p=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},p.apply(this,arguments)};function l(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))}function c(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}"function"==typeof SuppressedError&&SuppressedError;const d=/\{[^{}]+\}/g;function y(e){let{baseUrl:t="",Request:r=globalThis.Request,fetch:n=globalThis.fetch,querySerializer:i,bodySerializer:o,headers:s,requestInitExt:a,...u}={...e};a="object"==typeof process&&Number.parseInt(process?.versions?.node?.substring(0,2))>=18&&process.versions.undici?a:void 0,t=w(t);const p=[];async function l(e,l){const{baseUrl:c,fetch:y=n,Request:C=r,headers:x,params:A={},parseAs:g="json",querySerializer:q,bodySerializer:K=o??b,body:T,...E}=l||{};c&&(t=w(c));let R="function"==typeof i?i:I(i);q&&(R="function"==typeof q?q:I({..."object"==typeof i?i:{},...q}));const O=void 0===T?void 0:K(T),P=void 0===O||O instanceof FormData?{}:{"Content-Type":"application/json"},S={redirect:"follow",...u,...E,body:O,headers:m(P,s,x,A.header)};let N,U,_,j=new r(function(e,t){let r=`${t.baseUrl}${e}`;t.params?.path&&(r=function(e,t){let r=e;for(const n of e.match(d)??[]){let e=n.substring(1,n.length-1),i=!1,o="simple";if(e.endsWith("*")&&(i=!0,e=e.substring(0,e.length-1)),e.startsWith(".")?(o="label",e=e.substring(1)):e.startsWith(";")&&(o="matrix",e=e.substring(1)),!t||void 0===t[e]||null===t[e])continue;const s=t[e];Array.isArray(s)?r=r.replace(n,v(e,s,{style:o,explode:i})):r="object"!=typeof s?"matrix"!==o?r.replace(n,"label"===o?`.${encodeURIComponent(s)}`:encodeURIComponent(s)):r.replace(n,`;${f(e,s)}`):r.replace(n,h(e,s,{style:o,explode:i}))}return r}(r,t.params.path));let n=t.querySerializer(t.params.query??{});n.startsWith("?")&&(n=n.substring(1));n&&(r+=`?${n}`);return r}(e,{baseUrl:t,params:A,querySerializer:R}),S);for(const e in E)e in j||(j[e]=E[e]);if(p.length){N=Math.random().toString(36).slice(2,11),U=Object.freeze({baseUrl:t,fetch:y,parseAs:g,querySerializer:R,bodySerializer:K});for(const t of p)if(t&&"object"==typeof t&&"function"==typeof t.onRequest){const n=await t.onRequest({request:j,schemaPath:e,params:A,options:U,id:N});if(n){if(!(n instanceof r)){if(n instanceof Response){_=n;break}throw new Error("onRequest: must return new Request() or Response() when modifying the request")}j=n}}}if(!_){try{_=await y(j,a)}catch(D){let t=D;if(p.length)for(let r=p.length-1;r>=0;r--){const n=p[r];if(n&&"object"==typeof n&&"function"==typeof n.onError){const r=await n.onError({request:j,error:t,schemaPath:e,params:A,options:U,id:N});if(r){if(r instanceof Response){t=void 0,_=r;break}if(r instanceof Error){t=r;continue}throw new Error("onError: must return new Response() or instance of Error")}}}if(t)throw t}if(p.length)for(let t=p.length-1;t>=0;t--){const r=p[t];if(r&&"object"==typeof r&&"function"==typeof r.onResponse){const t=await r.onResponse({request:j,response:_,schemaPath:e,params:A,options:U,id:N});if(t){if(!(t instanceof Response))throw new Error("onResponse: must return new Response() when modifying the response");_=t}}}}if(204===_.status||"0"===_.headers.get("Content-Length"))return _.ok?{data:void 0,response:_}:{error:void 0,response:_};if(_.ok)return"stream"===g?{data:_.body,response:_}:{data:await _[g](),response:_};let D=await _.text();try{D=JSON.parse(D)}catch{}return{error:D,response:_}}return{request:(e,t,r)=>l(t,{...r,method:e.toUpperCase()}),GET:(e,t)=>l(e,{...t,method:"GET"}),PUT:(e,t)=>l(e,{...t,method:"PUT"}),POST:(e,t)=>l(e,{...t,method:"POST"}),DELETE:(e,t)=>l(e,{...t,method:"DELETE"}),OPTIONS:(e,t)=>l(e,{...t,method:"OPTIONS"}),HEAD:(e,t)=>l(e,{...t,method:"HEAD"}),PATCH:(e,t)=>l(e,{...t,method:"PATCH"}),TRACE:(e,t)=>l(e,{...t,method:"TRACE"}),use(...e){for(const t of e)if(t){if("object"!=typeof t||!("onRequest"in t||"onResponse"in t||"onError"in t))throw new Error("Middleware must be an object with one of `onRequest()`, `onResponse() or `onError()`");p.push(t)}},eject(...e){for(const t of e){const e=p.indexOf(t);-1!==e&&p.splice(e,1)}}}}function f(e,t,r){if(null==t)return"";if("object"==typeof t)throw new Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${e}=${!0===r?.allowReserved?t:encodeURIComponent(t)}`}function h(e,t,r){if(!t||"object"!=typeof t)return"";const n=[],i={simple:",",label:".",matrix:";"}[r.style]||"&";if("deepObject"!==r.style&&!1===r.explode){for(const e in t)n.push(e,!0===r.allowReserved?t[e]:encodeURIComponent(t[e]));const i=n.join(",");switch(r.style){case"form":return`${e}=${i}`;case"label":return`.${i}`;case"matrix":return`;${e}=${i}`;default:return i}}for(const i in t){const o="deepObject"===r.style?`${e}[${i}]`:i;n.push(f(o,t[i],r))}const o=n.join(i);return"label"===r.style||"matrix"===r.style?`${i}${o}`:o}function v(e,t,r){if(!Array.isArray(t))return"";if(!1===r.explode){const n={form:",",spaceDelimited:"%20",pipeDelimited:"|"}[r.style]||",",i=(!0===r.allowReserved?t:t.map((e=>encodeURIComponent(e)))).join(n);switch(r.style){case"simple":return i;case"label":return`.${i}`;case"matrix":return`;${e}=${i}`;default:return`${e}=${i}`}}const n={simple:",",label:".",matrix:";"}[r.style]||"&",i=[];for(const n of t)"simple"===r.style||"label"===r.style?i.push(!0===r.allowReserved?n:encodeURIComponent(n)):i.push(f(e,n,r));return"label"===r.style||"matrix"===r.style?`${n}${i.join(n)}`:i.join(n)}function I(e){return function(t){const r=[];if(t&&"object"==typeof t)for(const n in t){const i=t[n];if(null!=i)if(Array.isArray(i)){if(0===i.length)continue;r.push(v(n,i,{style:"form",explode:!0,...e?.array,allowReserved:e?.allowReserved||!1}))}else"object"!=typeof i?r.push(f(n,i,e)):r.push(h(n,i,{style:"deepObject",explode:!0,...e?.object,allowReserved:e?.allowReserved||!1}))}return r.join("&")}}function b(e){return e instanceof FormData?e:JSON.stringify(e)}function m(...e){const t=new Headers;for(const r of e){if(!r||"object"!=typeof r)continue;const e=r instanceof Headers?r.entries():Object.entries(r);for(const[r,n]of e)if(null===n)t.delete(r);else if(Array.isArray(n))for(const e of n)t.append(r,e);else void 0!==n&&t.set(r,n)}return t}function w(e){return e.endsWith("/")?e.substring(0,e.length-1):e}var C,x={onRequest:function(e){return l(this,arguments,void 0,(function(e){var t=e.request;return c(this,(function(e){return t.headers.set("Content-Type","application/json"),[2,t]}))}))}},A=function(e){var t=y({baseUrl:e});return t.use(x),t},g=A(exports.API_URL.STAGING),q=A(exports.API_URL.PRODUCTION),K=r.createContext(null),T=function(){var e=r.useContext(K);if(!e)throw new Error("useIpKit must be used within an IpKitProvider");return e};function E(e){var t=e.apiClient,r=e.path,n=e.apiKey,i=e.body,o=e.additionalHeaders,s={params:{header:p({"X-Api-Key":n},o)}},a={body:i||{}};return t.POST(r,p(p({},s),a))}function R(e){var t=e.collectionAddresses,r=e.apiClient,n=e.options,i=e.apiKey;return E({apiClient:r,path:"/collections",body:p(p({orderBy:"updatedAt",orderDirection:"desc"},n),{where:p(p({},null==n?void 0:n.where),t?{collectionAddresses:t}:{})}),apiKey:i})}function O(e){return function(e){var t=e.apiClient,r=e.path,n=e.apiKey,i=e.pathParams,o=e.additionalHeaders,s={params:{path:i,header:p({"X-Api-Key":n},o)}};return t.GET(r,s)}({apiClient:e.apiClient,path:"/disputes/{disputeId}",pathParams:{disputeId:e.disputeId},apiKey:e.apiKey})}function P(e){var t=e.apiClient,r=e.initiator,n=e.targetIpId,i=e.options,o=e.apiKey;return E({apiClient:t,path:"/disputes",body:p(p({orderBy:"blockNumber",orderDirection:"desc"},i),{where:p(p(p({},null==i?void 0:i.where),r?{initiator:r}:{}),n?{targetIpId:n}:{})}),apiKey:o})}function S(e){var t=e.apiClient,r=e.ipId,n=e.parentIpId,i=e.options,o=e.apiKey;return E({apiClient:t,path:"/assets/edges",body:p(p({orderBy:"blockNumber",orderDirection:"desc"},i),{where:p(p(p({},null==i?void 0:i.where),r?{childIpId:r}:{}),n?{parentIpId:n}:{})}),apiKey:o})}function N(e){var t=e.apiClient,r=e.ownerAddress,n=e.tokenContract,i=e.includeLicenses,o=e.moderated,s=e.ipIds,a=e.options,u=e.apiKey;return E({apiClient:t,path:"/assets",body:p(p({orderBy:"blockNumber",orderDirection:"desc",includeLicenses:null!=i&&i,moderated:null!=o&&o},a),{where:p(p(p(p({},null==a?void 0:a.where),s?{ipIds:s}:{}),r?{ownerAddress:r}:{}),n?{tokenContract:n}:{})}),apiKey:u})}function U(e){var t=e.apiClient,r=e.ownerAddress,n=e.licensorIpId,i=e.options,o=e.apiKey;return E({apiClient:t,path:"/licenses/tokens",body:p(p({orderBy:"blockNumber",orderDirection:"desc"},i),{where:p(p(p({},null==i?void 0:i.where),(null==r?void 0:r.length)?{ownerAddress:r}:{}),(null==n?void 0:n.length)?{licensorIpId:n}:{})}),apiKey:o})}function _(e){var t=e.apiClient,r=e.query,n=e.mediaType,i=e.options,o=e.apiKey;return E({apiClient:t,path:"/search",body:p(p({query:r},n?{mediaType:n}:{}),i),apiKey:o})}function j(e){var t=e.apiClient,r=e.txHashes,n=e.ipIds,i=e.initiators,o=e.eventTypes,s=e.options,a=e.apiKey;return E({apiClient:t,path:"/transactions",body:p(p({orderBy:"blockNumber",orderDirection:"desc"},s),{where:p(p(p(p(p({},null==s?void 0:s.where),r?{txHashes:r}:{}),n?{ipIds:n}:{}),i?{initiators:i}:{}),o?{eventTypes:o}:{})}),apiKey:a})}exports.PIL_FLAVOR=void 0,(C=exports.PIL_FLAVOR||(exports.PIL_FLAVOR={})).NON_COMMERCIAL_SOCIAL_REMIXING="Non-Commercial Social Remixing",C.COMMERCIAL_USE="Commercial Use",C.COMMERCIAL_REMIX="Commercial Remix",C.CUSTOM="Custom",C.OPEN_USE="Open Use",exports.CHAINID_TO_CHAINNAME={1315:"story-aeneid",1514:"story"},exports.CHAINS=u,exports.IpKitProvider=function(e){var t=e.apiKey,n=e.appId,i=e.children,o=e.isTestnet,s=r.useMemo((function(){return u[o?exports.IPKIT_SUPPORTED_CHAIN.AENEID_TESTNET:exports.IPKIT_SUPPORTED_CHAIN.STORY_MAINNET]}),[o]),a=r.useMemo((function(){return o?exports.API_URL.STAGING:exports.API_URL.PRODUCTION}),[o]),p=r.useMemo((function(){return A(a)}),[a]);return r.createElement(K.Provider,{value:{apiBaseUrl:a,apiClient:p,apiKey:t,appId:n,chain:s}},i)},exports.STORY_AENEID=s,exports.STORY_MAINNET=a,exports.WRAPPED_IP=o,exports.createApiClient=A,exports.getCollections=R,exports.getDispute=O,exports.getDisputes=P,exports.getIpAssetEdges=S,exports.getIpAssets=N,exports.getLicenseTokens=U,exports.getSearch=_,exports.getTransactions=j,exports.prodClient=q,exports.stagingClient=g,exports.useCollection=function(e){var t=this,r=e.collectionAddress,i=e.queryOptions,o=T(),s=o.apiKey,a=o.apiClient;return n.useQuery(p({queryKey:["getCollection",r],queryFn:function(){return l(t,void 0,void 0,(function(){var e,t,n,i;return c(this,(function(o){switch(o.label){case 0:return[4,R({collectionAddresses:[r],apiKey:s,apiClient:a})];case 1:if(e=o.sent(),t=e.data,n=e.error)throw n;return[2,(null===(i=null==t?void 0:t.data)||void 0===i?void 0:i[0])||null]}}))}))},enabled:!!(null==r?void 0:r.length)},i))},exports.useCollections=function(e){var t=this,r=void 0===e?{}:e,i=r.collectionAddresses,o=r.options,s=r.queryOptions,a=T(),u=a.apiKey,d=a.apiClient;return n.useQuery(p({queryKey:["getCollections",i,o],queryFn:function(){return l(t,void 0,void 0,(function(){var e,t,r;return c(this,(function(n){switch(n.label){case 0:return[4,R({collectionAddresses:i,options:o,apiKey:u,apiClient:d})];case 1:if(e=n.sent(),t=e.data,r=e.error)throw r;return[2,t]}}))}))}},s))},exports.useDispute=function(e){var t=this,r=e.disputeId,i=e.queryOptions,o=T(),s=o.apiKey,a=o.apiClient;return n.useQuery(p({queryKey:["getDispute",r],queryFn:function(){return l(t,void 0,void 0,(function(){var e,t,n;return c(this,(function(i){switch(i.label){case 0:return[4,O({disputeId:r,apiKey:s,apiClient:a})];case 1:if(e=i.sent(),t=e.data,n=e.error)throw n;return[2,(null==t?void 0:t.data)||null]}}))}))},enabled:!!(null==r?void 0:r.length)},i))},exports.useDisputes=function(e){var t=this,r=void 0===e?{}:e,i=r.initiator,o=r.targetIpId,s=r.options,a=r.queryOptions,u=T(),d=u.apiKey,y=u.apiClient;return n.useQuery(p({queryKey:["getDisputes",s,i,o],queryFn:function(){return l(t,void 0,void 0,(function(){var e,t,r;return c(this,(function(n){switch(n.label){case 0:return[4,P({initiator:i,targetIpId:o,options:s,apiKey:d,apiClient:y})];case 1:if(e=n.sent(),t=e.data,r=e.error)throw r;return[2,t]}}))}))}},a))},exports.useIpAsset=function(e){var t=this,r=e.ipId,i=e.includeLicenses,o=e.queryOptions,s=T(),a=s.apiKey,u=s.apiClient;return n.useQuery(p({queryKey:["getIpAsset",r,i],queryFn:function(){return l(t,void 0,void 0,(function(){var e,t,n,o;return c(this,(function(s){switch(s.label){case 0:return[4,N({ipIds:[r],includeLicenses:i,apiKey:a,apiClient:u})];case 1:if(e=s.sent(),t=e.data,n=e.error)throw n;return[2,(null===(o=null==t?void 0:t.data)||void 0===o?void 0:o[0])||null]}}))}))},enabled:!!(null==r?void 0:r.length)},o))},exports.useIpAssetChildren=function(e){var t=this,r=void 0===e?{}:e,i=r.ipId,o=r.options,s=r.queryOptions,a=T(),u=a.apiKey,d=a.apiClient;return n.useQuery(p({queryKey:["getIpAssetEdges",void 0,i,o],queryFn:function(){return l(t,void 0,void 0,(function(){var e,t,r;return c(this,(function(n){switch(n.label){case 0:return[4,S({parentIpId:i,options:o,apiKey:u,apiClient:d})];case 1:if(e=n.sent(),t=e.data,r=e.error)throw r;return[2,t]}}))}))}},s))},exports.useIpAssetEdges=function(e){var t=this,r=void 0===e?{}:e,i=r.ipId,o=r.parentIpId,s=r.options,a=r.queryOptions,u=T(),d=u.apiKey,y=u.apiClient;return n.useQuery(p({queryKey:["getIpAssetEdges",i,o,s],queryFn:function(){return l(t,void 0,void 0,(function(){var e,t,r;return c(this,(function(n){switch(n.label){case 0:return[4,S({ipId:i,parentIpId:o,options:s,apiKey:d,apiClient:y})];case 1:if(e=n.sent(),t=e.data,r=e.error)throw r;return[2,t]}}))}))}},a))},exports.useIpAssetLicenses=function(e){var t=this,r=e.ipId,i=e.queryOptions,o=T(),s=o.apiKey,a=o.apiClient;return n.useQuery(p({queryKey:["getIpAsset",r,!0],queryFn:function(){return l(t,void 0,void 0,(function(){var e,t,n,i;return c(this,(function(o){switch(o.label){case 0:return[4,N({ipIds:[r],includeLicenses:!0,apiKey:s,apiClient:a})];case 1:if(e=o.sent(),t=e.data,n=e.error)throw n;return[2,(null===(i=null==t?void 0:t.data)||void 0===i?void 0:i[0].licenses)||null]}}))}))},enabled:!!(null==r?void 0:r.length)},i))},exports.useIpAssetParents=function(e){var t=this,r=void 0===e?{}:e,i=r.ipId,o=r.options,s=r.queryOptions,a=T(),u=a.apiKey,d=a.apiClient;return n.useQuery(p({queryKey:["getIpAssetEdges",i,void 0,o],queryFn:function(){return l(t,void 0,void 0,(function(){var e,t,r;return c(this,(function(n){switch(n.label){case 0:return[4,S({ipId:i,options:o,apiKey:u,apiClient:d})];case 1:if(e=n.sent(),t=e.data,r=e.error)throw r;return[2,t]}}))}))}},s))},exports.useIpAssets=function(e){var t=this,r=void 0===e?{}:e,i=r.ipIds,o=r.tokenContract,s=r.includeLicenses,a=r.moderated,u=r.options,d=r.queryOptions,y=T(),f=y.apiKey,h=y.apiClient;return n.useQuery(p({queryKey:["getIpAssets",i,o,s,a,u],queryFn:function(){return l(t,void 0,void 0,(function(){var e,t,r;return c(this,(function(n){switch(n.label){case 0:return[4,N({ipIds:i,tokenContract:o,includeLicenses:s,moderated:a,options:u,apiKey:f,apiClient:h})];case 1:if(e=n.sent(),t=e.data,r=e.error)throw r;return[2,t]}}))}))}},d))},exports.useIpAssetsByOwner=function(e){var t=this,r=void 0===e?{}:e,i=r.ownerAddress,o=r.includeLicenses,s=r.moderated,a=r.options,u=r.queryOptions,d=T(),y=d.apiKey,f=d.apiClient;return n.useQuery(p({queryKey:["getIpAssets",i,o,s,a],queryFn:function(){return l(t,void 0,void 0,(function(){var e,t,r;return c(this,(function(n){switch(n.label){case 0:return[4,N({ownerAddress:i,includeLicenses:o,moderated:s,options:a,apiKey:y,apiClient:f})];case 1:if(e=n.sent(),t=e.data,r=e.error)throw r;return[2,t]}}))}))}},u))},exports.useIpKit=T,exports.useLicenseTokens=function(e){var t=this,r=e.ownerAddress,i=e.licensorIpId,o=e.options,s=e.queryOptions,a=T(),u=a.apiKey,d=a.apiClient;return n.useQuery(p({queryKey:["getLicenseTokens",r,i,o],queryFn:function(){return l(t,void 0,void 0,(function(){var e,t,n;return c(this,(function(s){switch(s.label){case 0:return[4,U({ownerAddress:r,licensorIpId:i,options:o,apiKey:u,apiClient:d})];case 1:if(e=s.sent(),t=e.data,n=e.error)throw n;return[2,t]}}))}))}},s))},exports.useSearch=function(e){var t=this,r=e.query,i=e.mediaType,o=e.queryOptions,s=T(),a=s.apiKey,u=s.apiClient;return n.useQuery(p({queryKey:["getSearch",r,i],queryFn:function(){return l(t,void 0,void 0,(function(){var e,t,n;return c(this,(function(o){switch(o.label){case 0:return[4,_({query:r,mediaType:i,apiKey:a,apiClient:u})];case 1:if(e=o.sent(),t=e.data,n=e.error)throw n;return[2,t]}}))}))},enabled:!!(null==r?void 0:r.length)},o))},exports.useTransaction=function(e){var t=this,r=e.txHash,i=e.queryOptions,o=T(),s=o.apiKey,a=o.apiClient;return n.useQuery(p({queryKey:["getTransactions",r],queryFn:function(){return l(t,void 0,void 0,(function(){var e,t,n,i;return c(this,(function(o){switch(o.label){case 0:return[4,j({txHashes:[r],apiKey:s,apiClient:a})];case 1:if(e=o.sent(),t=e.data,n=e.error)throw n;return[2,(null===(i=null==t?void 0:t.data)||void 0===i?void 0:i[0])||null]}}))}))},enabled:!!(null==r?void 0:r.length)},i))},exports.useTransactions=function(e){var t=this,r=void 0===e?{}:e,i=r.txHashes,o=r.ipIds,s=r.initiators,a=r.eventTypes,u=r.options,d=r.queryOptions,y=T(),f=y.apiKey,h=y.apiClient;return n.useQuery(p({queryKey:["getTransactions",i,o,s,a,u],queryFn:function(){return l(t,void 0,void 0,(function(){var e,t,r;return c(this,(function(n){switch(n.label){case 0:return[4,j({txHashes:i,ipIds:o,initiators:s,eventTypes:a,options:u,apiKey:f,apiClient:h})];case 1:if(e=n.sent(),t=e.data,r=e.error)throw r;return[2,t]}}))}))}},d))};
|
|
1
|
+
"use strict";var e,t,r=require("react"),n=require("@tanstack/react-query");exports.API_URL=void 0,(e=exports.API_URL||(exports.API_URL={})).STAGING="https://staging-api.storyprotocol.net/api/v4",e.PRODUCTION="https://api.storyapis.com/api/v4",exports.IPKIT_SUPPORTED_CHAIN=void 0,(t=exports.IPKIT_SUPPORTED_CHAIN||(exports.IPKIT_SUPPORTED_CHAIN={})).AENEID_TESTNET="story-aeneid",t.STORY_MAINNET="story";var i,o={name:"Wrapped IP",address:"0x1514000000000000000000000000000000000000",symbol:"WIP"},s={id:1315,name:"story-aeneid",apiVersion:"v3",displayName:"Story Aeneid Testnet",rpcUrl:"https://aeneid.storyrpc.io/",blockExplorerUrl:"https://aeneid.storyscan.io",protocolExplorerUrl:"https://aeneid.explorer.story.foundation",defaultCurrency:o},a={id:1514,name:"story",apiVersion:"v3",displayName:"Story Mainnet",rpcUrl:"https://mainnet.storyrpc.io",blockExplorerUrl:"https://storyscan.io",protocolExplorerUrl:"https://explorer.story.foundation",defaultCurrency:o},u=((i={})[s.name]=s,i[a.name]=a,i),p=function(){return p=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},p.apply(this,arguments)};function c(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))}function l(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}"function"==typeof SuppressedError&&SuppressedError;const d=/\{[^{}]+\}/g;function y(e){let{baseUrl:t="",Request:r=globalThis.Request,fetch:n=globalThis.fetch,querySerializer:i,bodySerializer:o,headers:s,requestInitExt:a,...u}={...e};a="object"==typeof process&&Number.parseInt(process?.versions?.node?.substring(0,2))>=18&&process.versions.undici?a:void 0,t=w(t);const p=[];async function c(e,c){const{baseUrl:l,fetch:y=n,Request:C=r,headers:x,params:A={},parseAs:g="json",querySerializer:q,bodySerializer:K=o??b,body:T,...E}=c||{};l&&(t=w(l));let R="function"==typeof i?i:I(i);q&&(R="function"==typeof q?q:I({..."object"==typeof i?i:{},...q}));const O=void 0===T?void 0:K(T),P=void 0===O||O instanceof FormData?{}:{"Content-Type":"application/json"},S={redirect:"follow",...u,...E,body:O,headers:m(P,s,x,A.header)};let N,U,_,j=new r(function(e,t){let r=`${t.baseUrl}${e}`;t.params?.path&&(r=function(e,t){let r=e;for(const n of e.match(d)??[]){let e=n.substring(1,n.length-1),i=!1,o="simple";if(e.endsWith("*")&&(i=!0,e=e.substring(0,e.length-1)),e.startsWith(".")?(o="label",e=e.substring(1)):e.startsWith(";")&&(o="matrix",e=e.substring(1)),!t||void 0===t[e]||null===t[e])continue;const s=t[e];Array.isArray(s)?r=r.replace(n,v(e,s,{style:o,explode:i})):r="object"!=typeof s?"matrix"!==o?r.replace(n,"label"===o?`.${encodeURIComponent(s)}`:encodeURIComponent(s)):r.replace(n,`;${f(e,s)}`):r.replace(n,h(e,s,{style:o,explode:i}))}return r}(r,t.params.path));let n=t.querySerializer(t.params.query??{});n.startsWith("?")&&(n=n.substring(1));n&&(r+=`?${n}`);return r}(e,{baseUrl:t,params:A,querySerializer:R}),S);for(const e in E)e in j||(j[e]=E[e]);if(p.length){N=Math.random().toString(36).slice(2,11),U=Object.freeze({baseUrl:t,fetch:y,parseAs:g,querySerializer:R,bodySerializer:K});for(const t of p)if(t&&"object"==typeof t&&"function"==typeof t.onRequest){const n=await t.onRequest({request:j,schemaPath:e,params:A,options:U,id:N});if(n){if(!(n instanceof r)){if(n instanceof Response){_=n;break}throw new Error("onRequest: must return new Request() or Response() when modifying the request")}j=n}}}if(!_){try{_=await y(j,a)}catch(D){let t=D;if(p.length)for(let r=p.length-1;r>=0;r--){const n=p[r];if(n&&"object"==typeof n&&"function"==typeof n.onError){const r=await n.onError({request:j,error:t,schemaPath:e,params:A,options:U,id:N});if(r){if(r instanceof Response){t=void 0,_=r;break}if(r instanceof Error){t=r;continue}throw new Error("onError: must return new Response() or instance of Error")}}}if(t)throw t}if(p.length)for(let t=p.length-1;t>=0;t--){const r=p[t];if(r&&"object"==typeof r&&"function"==typeof r.onResponse){const t=await r.onResponse({request:j,response:_,schemaPath:e,params:A,options:U,id:N});if(t){if(!(t instanceof Response))throw new Error("onResponse: must return new Response() when modifying the response");_=t}}}}if(204===_.status||"0"===_.headers.get("Content-Length"))return _.ok?{data:void 0,response:_}:{error:void 0,response:_};if(_.ok)return"stream"===g?{data:_.body,response:_}:{data:await _[g](),response:_};let D=await _.text();try{D=JSON.parse(D)}catch{}return{error:D,response:_}}return{request:(e,t,r)=>c(t,{...r,method:e.toUpperCase()}),GET:(e,t)=>c(e,{...t,method:"GET"}),PUT:(e,t)=>c(e,{...t,method:"PUT"}),POST:(e,t)=>c(e,{...t,method:"POST"}),DELETE:(e,t)=>c(e,{...t,method:"DELETE"}),OPTIONS:(e,t)=>c(e,{...t,method:"OPTIONS"}),HEAD:(e,t)=>c(e,{...t,method:"HEAD"}),PATCH:(e,t)=>c(e,{...t,method:"PATCH"}),TRACE:(e,t)=>c(e,{...t,method:"TRACE"}),use(...e){for(const t of e)if(t){if("object"!=typeof t||!("onRequest"in t||"onResponse"in t||"onError"in t))throw new Error("Middleware must be an object with one of `onRequest()`, `onResponse() or `onError()`");p.push(t)}},eject(...e){for(const t of e){const e=p.indexOf(t);-1!==e&&p.splice(e,1)}}}}function f(e,t,r){if(null==t)return"";if("object"==typeof t)throw new Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${e}=${!0===r?.allowReserved?t:encodeURIComponent(t)}`}function h(e,t,r){if(!t||"object"!=typeof t)return"";const n=[],i={simple:",",label:".",matrix:";"}[r.style]||"&";if("deepObject"!==r.style&&!1===r.explode){for(const e in t)n.push(e,!0===r.allowReserved?t[e]:encodeURIComponent(t[e]));const i=n.join(",");switch(r.style){case"form":return`${e}=${i}`;case"label":return`.${i}`;case"matrix":return`;${e}=${i}`;default:return i}}for(const i in t){const o="deepObject"===r.style?`${e}[${i}]`:i;n.push(f(o,t[i],r))}const o=n.join(i);return"label"===r.style||"matrix"===r.style?`${i}${o}`:o}function v(e,t,r){if(!Array.isArray(t))return"";if(!1===r.explode){const n={form:",",spaceDelimited:"%20",pipeDelimited:"|"}[r.style]||",",i=(!0===r.allowReserved?t:t.map((e=>encodeURIComponent(e)))).join(n);switch(r.style){case"simple":return i;case"label":return`.${i}`;case"matrix":return`;${e}=${i}`;default:return`${e}=${i}`}}const n={simple:",",label:".",matrix:";"}[r.style]||"&",i=[];for(const n of t)"simple"===r.style||"label"===r.style?i.push(!0===r.allowReserved?n:encodeURIComponent(n)):i.push(f(e,n,r));return"label"===r.style||"matrix"===r.style?`${n}${i.join(n)}`:i.join(n)}function I(e){return function(t){const r=[];if(t&&"object"==typeof t)for(const n in t){const i=t[n];if(null!=i)if(Array.isArray(i)){if(0===i.length)continue;r.push(v(n,i,{style:"form",explode:!0,...e?.array,allowReserved:e?.allowReserved||!1}))}else"object"!=typeof i?r.push(f(n,i,e)):r.push(h(n,i,{style:"deepObject",explode:!0,...e?.object,allowReserved:e?.allowReserved||!1}))}return r.join("&")}}function b(e){return e instanceof FormData?e:JSON.stringify(e)}function m(...e){const t=new Headers;for(const r of e){if(!r||"object"!=typeof r)continue;const e=r instanceof Headers?r.entries():Object.entries(r);for(const[r,n]of e)if(null===n)t.delete(r);else if(Array.isArray(n))for(const e of n)t.append(r,e);else void 0!==n&&t.set(r,n)}return t}function w(e){return e.endsWith("/")?e.substring(0,e.length-1):e}var C,x={onRequest:function(e){return c(this,arguments,void 0,(function(e){var t=e.request;return l(this,(function(e){return t.headers.set("Content-Type","application/json"),[2,t]}))}))}},A=function(e){var t=y({baseUrl:e});return t.use(x),t},g=A(exports.API_URL.STAGING),q=A(exports.API_URL.PRODUCTION),K=r.createContext(null),T=function(){var e=r.useContext(K);if(!e)throw new Error("useIpKit must be used within an IpKitProvider");return e};function E(e){var t=e.apiClient,r=e.path,n=e.apiKey,i=e.body,o=e.additionalHeaders,s={params:{header:p({"X-Api-Key":n},o)}},a={body:i||{}};return t.POST(r,p(p({},s),a))}function R(e){var t=e.collectionAddresses,r=e.apiClient,n=e.options,i=e.apiKey;return E({apiClient:r,path:"/collections",body:p(p({orderBy:"updatedAt",orderDirection:"desc"},n),{where:p(p({},null==n?void 0:n.where),t?{collectionAddresses:t}:{})}),apiKey:i})}function O(e){return function(e){var t=e.apiClient,r=e.path,n=e.apiKey,i=e.pathParams,o=e.additionalHeaders,s={params:{path:i,header:p({"X-Api-Key":n},o)}};return t.GET(r,s)}({apiClient:e.apiClient,path:"/disputes/{disputeId}",pathParams:{disputeId:e.disputeId},apiKey:e.apiKey})}function P(e){var t=e.apiClient,r=e.initiator,n=e.targetIpId,i=e.options,o=e.apiKey;return E({apiClient:t,path:"/disputes",body:p(p({orderBy:"blockNumber",orderDirection:"desc"},i),{where:p(p(p({},null==i?void 0:i.where),r?{initiator:r}:{}),n?{targetIpId:n}:{})}),apiKey:o})}function S(e){var t=e.apiClient,r=e.ipId,n=e.parentIpId,i=e.options,o=e.apiKey;return E({apiClient:t,path:"/assets/edges",body:p(p({orderBy:"blockNumber",orderDirection:"desc"},i),{where:p(p(p({},null==i?void 0:i.where),r?{childIpId:r}:{}),n?{parentIpId:n}:{})}),apiKey:o})}function N(e){var t=e.apiClient,r=e.ownerAddress,n=e.tokenContract,i=e.includeLicenses,o=e.moderated,s=e.ipIds,a=e.options,u=e.apiKey;return E({apiClient:t,path:"/assets",body:p(p({orderBy:"blockNumber",orderDirection:"desc",includeLicenses:null!=i&&i,moderated:null!=o&&o},a),{where:p(p(p(p({},null==a?void 0:a.where),s?{ipIds:s}:{}),r?{ownerAddress:r}:{}),n?{tokenContract:n}:{})}),apiKey:u})}function U(e){var t=e.apiClient,r=e.ownerAddress,n=e.licensorIpId,i=e.options,o=e.apiKey;return E({apiClient:t,path:"/licenses/tokens",body:p(p({orderBy:"blockNumber",orderDirection:"desc"},i),{where:p(p(p({},null==i?void 0:i.where),(null==r?void 0:r.length)?{ownerAddress:r}:{}),(null==n?void 0:n.length)?{licensorIpId:n}:{})}),apiKey:o})}function _(e){var t=e.apiClient,r=e.query,n=e.mediaType,i=e.options,o=e.apiKey;return E({apiClient:t,path:"/search",body:p(p({query:r},n?{mediaType:n}:{}),i),apiKey:o})}function j(e){var t=e.apiClient,r=e.txHashes,n=e.ipIds,i=e.initiators,o=e.eventTypes,s=e.options,a=e.apiKey;return E({apiClient:t,path:"/transactions",body:p(p({orderBy:"blockNumber",orderDirection:"desc"},s),{where:p(p(p(p(p({},null==s?void 0:s.where),r?{txHashes:r}:{}),n?{ipIds:n}:{}),i?{initiators:i}:{}),o?{eventTypes:o}:{})}),apiKey:a})}exports.PIL_FLAVOR=void 0,(C=exports.PIL_FLAVOR||(exports.PIL_FLAVOR={})).NON_COMMERCIAL_SOCIAL_REMIXING="Non-Commercial Social Remixing",C.COMMERCIAL_USE="Commercial Use",C.COMMERCIAL_REMIX="Commercial Remix",C.CUSTOM="Custom",C.OPEN_USE="Open Use",exports.CHAINID_TO_CHAINNAME={1315:"story-aeneid",1514:"story"},exports.CHAINS=u,exports.IpKitProvider=function(e){var t=e.apiKey,n=e.appId,i=e.children,o=e.isTestnet,s=r.useMemo((function(){return u[o?exports.IPKIT_SUPPORTED_CHAIN.AENEID_TESTNET:exports.IPKIT_SUPPORTED_CHAIN.STORY_MAINNET]}),[o]),a=r.useMemo((function(){return o?exports.API_URL.STAGING:exports.API_URL.PRODUCTION}),[o]),p=r.useMemo((function(){return A(a)}),[a]);return r.createElement(K.Provider,{value:{apiBaseUrl:a,apiClient:p,apiKey:t,appId:n,chain:s}},i)},exports.STORY_AENEID=s,exports.STORY_MAINNET=a,exports.WRAPPED_IP=o,exports.createApiClient=A,exports.getCollections=R,exports.getDispute=O,exports.getDisputes=P,exports.getIpAssetEdges=S,exports.getIpAssets=N,exports.getLicenseTokens=U,exports.getSearch=_,exports.getTransactions=j,exports.prodClient=q,exports.stagingClient=g,exports.useCollection=function(e){var t=this,r=e.collectionAddress,i=e.queryOptions,o=T(),s=o.apiKey,a=o.apiClient,u=o.chain;return n.useQuery(p({queryKey:[u.id,"getCollection",r],queryFn:function(){return c(t,void 0,void 0,(function(){var e,t,n,i;return l(this,(function(o){switch(o.label){case 0:return[4,R({collectionAddresses:[r],apiKey:s,apiClient:a})];case 1:if(e=o.sent(),t=e.data,n=e.error)throw n;return[2,(null===(i=null==t?void 0:t.data)||void 0===i?void 0:i[0])||null]}}))}))},enabled:!!(null==r?void 0:r.length)},i))},exports.useCollections=function(e){var t=this,r=void 0===e?{}:e,i=r.collectionAddresses,o=r.options,s=r.queryOptions,a=T(),u=a.apiKey,d=a.apiClient,y=a.chain;return n.useQuery(p({queryKey:[y.id,"getCollections",i,o],queryFn:function(){return c(t,void 0,void 0,(function(){var e,t,r;return l(this,(function(n){switch(n.label){case 0:return[4,R({collectionAddresses:i,options:o,apiKey:u,apiClient:d})];case 1:if(e=n.sent(),t=e.data,r=e.error)throw r;return[2,t]}}))}))}},s))},exports.useDispute=function(e){var t=this,r=e.disputeId,i=e.queryOptions,o=T(),s=o.apiKey,a=o.apiClient,u=o.chain;return n.useQuery(p({queryKey:[u.id,"getDispute",r],queryFn:function(){return c(t,void 0,void 0,(function(){var e,t,n;return l(this,(function(i){switch(i.label){case 0:return[4,O({disputeId:r,apiKey:s,apiClient:a})];case 1:if(e=i.sent(),t=e.data,n=e.error)throw n;return[2,(null==t?void 0:t.data)||null]}}))}))},enabled:!!(null==r?void 0:r.length)},i))},exports.useDisputes=function(e){var t=this,r=void 0===e?{}:e,i=r.initiator,o=r.targetIpId,s=r.options,a=r.queryOptions,u=T(),d=u.apiKey,y=u.apiClient,f=u.chain;return n.useQuery(p({queryKey:[f.id,"getDisputes",s,i,o],queryFn:function(){return c(t,void 0,void 0,(function(){var e,t,r;return l(this,(function(n){switch(n.label){case 0:return[4,P({initiator:i,targetIpId:o,options:s,apiKey:d,apiClient:y})];case 1:if(e=n.sent(),t=e.data,r=e.error)throw r;return[2,t]}}))}))}},a))},exports.useIpAsset=function(e){var t=this,r=e.ipId,i=e.includeLicenses,o=e.queryOptions,s=T(),a=s.apiKey,u=s.apiClient,d=s.chain;return n.useQuery(p({queryKey:[d.id,"getIpAsset",r,i],queryFn:function(){return c(t,void 0,void 0,(function(){var e,t,n,o;return l(this,(function(s){switch(s.label){case 0:return[4,N({ipIds:[r],includeLicenses:i,apiKey:a,apiClient:u})];case 1:if(e=s.sent(),t=e.data,n=e.error)throw n;return[2,(null===(o=null==t?void 0:t.data)||void 0===o?void 0:o[0])||null]}}))}))},enabled:!!(null==r?void 0:r.length)},o))},exports.useIpAssetChildren=function(e){var t=this,r=void 0===e?{}:e,i=r.ipId,o=r.options,s=r.queryOptions,a=T(),u=a.apiKey,d=a.apiClient,y=a.chain;return n.useQuery(p({queryKey:[y.id,"getIpAssetEdges",void 0,i,o],queryFn:function(){return c(t,void 0,void 0,(function(){var e,t,r;return l(this,(function(n){switch(n.label){case 0:return[4,S({parentIpId:i,options:o,apiKey:u,apiClient:d})];case 1:if(e=n.sent(),t=e.data,r=e.error)throw r;return[2,t]}}))}))}},s))},exports.useIpAssetEdges=function(e){var t=this,r=void 0===e?{}:e,i=r.ipId,o=r.parentIpId,s=r.options,a=r.queryOptions,u=T(),d=u.apiKey,y=u.apiClient,f=u.chain;return n.useQuery(p({queryKey:[f.id,"getIpAssetEdges",i,o,s],queryFn:function(){return c(t,void 0,void 0,(function(){var e,t,r;return l(this,(function(n){switch(n.label){case 0:return[4,S({ipId:i,parentIpId:o,options:s,apiKey:d,apiClient:y})];case 1:if(e=n.sent(),t=e.data,r=e.error)throw r;return[2,t]}}))}))}},a))},exports.useIpAssetLicenses=function(e){var t=this,r=e.ipId,i=e.queryOptions,o=T(),s=o.apiKey,a=o.apiClient,u=o.chain;return n.useQuery(p({queryKey:[u.id,"getIpAsset",r,!0],queryFn:function(){return c(t,void 0,void 0,(function(){var e,t,n,i;return l(this,(function(o){switch(o.label){case 0:return[4,N({ipIds:[r],includeLicenses:!0,apiKey:s,apiClient:a})];case 1:if(e=o.sent(),t=e.data,n=e.error)throw n;return[2,(null===(i=null==t?void 0:t.data)||void 0===i?void 0:i[0].licenses)||null]}}))}))},enabled:!!(null==r?void 0:r.length)},i))},exports.useIpAssetParents=function(e){var t=this,r=void 0===e?{}:e,i=r.ipId,o=r.options,s=r.queryOptions,a=T(),u=a.apiKey,d=a.apiClient,y=a.chain;return n.useQuery(p({queryKey:[y.id,"getIpAssetEdges",i,void 0,o],queryFn:function(){return c(t,void 0,void 0,(function(){var e,t,r;return l(this,(function(n){switch(n.label){case 0:return[4,S({ipId:i,options:o,apiKey:u,apiClient:d})];case 1:if(e=n.sent(),t=e.data,r=e.error)throw r;return[2,t]}}))}))}},s))},exports.useIpAssets=function(e){var t=this,r=void 0===e?{}:e,i=r.ipIds,o=r.tokenContract,s=r.includeLicenses,a=r.moderated,u=r.options,d=r.queryOptions,y=T(),f=y.apiKey,h=y.apiClient,v=y.chain;return n.useQuery(p({queryKey:[v.id,"getIpAssets",i,o,s,a,u],queryFn:function(){return c(t,void 0,void 0,(function(){var e,t,r;return l(this,(function(n){switch(n.label){case 0:return[4,N({ipIds:i,tokenContract:o,includeLicenses:s,moderated:a,options:u,apiKey:f,apiClient:h})];case 1:if(e=n.sent(),t=e.data,r=e.error)throw r;return[2,t]}}))}))}},d))},exports.useIpAssetsByOwner=function(e){var t=this,r=void 0===e?{}:e,i=r.ownerAddress,o=r.includeLicenses,s=r.moderated,a=r.options,u=r.queryOptions,d=T(),y=d.apiKey,f=d.apiClient,h=d.chain;return n.useQuery(p({queryKey:[h.id,"getIpAssets",i,o,s,a],queryFn:function(){return c(t,void 0,void 0,(function(){var e,t,r;return l(this,(function(n){switch(n.label){case 0:return[4,N({ownerAddress:i,includeLicenses:o,moderated:s,options:a,apiKey:y,apiClient:f})];case 1:if(e=n.sent(),t=e.data,r=e.error)throw r;return[2,t]}}))}))}},u))},exports.useIpKit=T,exports.useLicenseTokens=function(e){var t=this,r=e.ownerAddress,i=e.licensorIpId,o=e.options,s=e.queryOptions,a=T(),u=a.apiKey,d=a.apiClient,y=a.chain;return n.useQuery(p({queryKey:[y.id,"getLicenseTokens",r,i,o],queryFn:function(){return c(t,void 0,void 0,(function(){var e,t,n;return l(this,(function(s){switch(s.label){case 0:return[4,U({ownerAddress:r,licensorIpId:i,options:o,apiKey:u,apiClient:d})];case 1:if(e=s.sent(),t=e.data,n=e.error)throw n;return[2,t]}}))}))}},s))},exports.useSearch=function(e){var t=this,r=e.query,i=e.mediaType,o=e.queryOptions,s=T(),a=s.apiKey,u=s.apiClient,d=s.chain;return n.useQuery(p({queryKey:[d.id,"getSearch",r,i],queryFn:function(){return c(t,void 0,void 0,(function(){var e,t,n;return l(this,(function(o){switch(o.label){case 0:return[4,_({query:r,mediaType:i,apiKey:a,apiClient:u})];case 1:if(e=o.sent(),t=e.data,n=e.error)throw n;return[2,t]}}))}))},enabled:!!(null==r?void 0:r.length)},o))},exports.useTransaction=function(e){var t=this,r=e.txHash,i=e.queryOptions,o=T(),s=o.apiKey,a=o.apiClient,u=o.chain;return n.useQuery(p({queryKey:[u.id,"getTransactions",r],queryFn:function(){return c(t,void 0,void 0,(function(){var e,t,n,i;return l(this,(function(o){switch(o.label){case 0:return[4,j({txHashes:[r],apiKey:s,apiClient:a})];case 1:if(e=o.sent(),t=e.data,n=e.error)throw n;return[2,(null===(i=null==t?void 0:t.data)||void 0===i?void 0:i[0])||null]}}))}))},enabled:!!(null==r?void 0:r.length)},i))},exports.useTransactions=function(e){var t=this,r=void 0===e?{}:e,i=r.txHashes,o=r.ipIds,s=r.initiators,a=r.eventTypes,u=r.options,d=r.queryOptions,y=T(),f=y.apiKey,h=y.apiClient,v=y.chain;return n.useQuery(p({queryKey:[v.id,"getTransactions",i,o,s,a,u],queryFn:function(){return c(t,void 0,void 0,(function(){var e,t,r;return l(this,(function(n){switch(n.label){case 0:return[4,j({txHashes:i,ipIds:o,initiators:s,eventTypes:a,options:u,apiKey:f,apiClient:h})];case 1:if(e=n.sent(),t=e.data,r=e.error)throw r;return[2,t]}}))}))}},d))};
|
|
2
2
|
//# sourceMappingURL=storyprotocol-storykit.cjs.js.map
|