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