@imtbl/orderbook 2.16.1-alpha.0 → 2.16.1-alpha.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.
- package/dist/browser/index.js +4 -4
- package/dist/node/index.cjs +12 -12
- package/dist/node/index.js +4 -4
- package/dist/types/api-client/api-client.d.ts +6 -3
- package/dist/types/openapi/mapper.d.ts +2 -1
- package/dist/types/openapi/mapper.test.d.ts +1 -0
- package/dist/types/openapi/sdk/index.d.ts +4 -0
- package/dist/types/openapi/sdk/models/CreateTraitBidRequestBody.d.ts +42 -0
- package/dist/types/openapi/sdk/models/ListTraitBidsResult.d.ts +6 -0
- package/dist/types/openapi/sdk/models/Order.d.ts +7 -1
- package/dist/types/openapi/sdk/models/TraitBidResult.d.ts +4 -0
- package/dist/types/openapi/sdk/models/TraitFilter.d.ts +10 -0
- package/dist/types/openapi/sdk/services/OrdersService.d.ts +71 -0
- package/dist/types/orderbook.d.ts +29 -1
- package/dist/types/types.d.ts +30 -1
- package/package.json +3 -3
package/dist/browser/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { track } from '@imtbl/metrics';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import st from 'axios';
|
|
3
|
+
import at from 'form-data';
|
|
4
4
|
import { zeroPadValue, FetchRequest, JsonRpcProvider, JsonRpcSigner, toBeHex, ZeroHash, TypedDataEncoder, keccak256, toUtf8Bytes, concat, ZeroAddress, AbiCoder } from 'ethers';
|
|
5
5
|
import { MerkleTree } from 'merkletreejs';
|
|
6
6
|
import { Environment } from '@imtbl/config';
|
|
7
7
|
import { Seaport } from '@opensea/seaport-js';
|
|
8
8
|
|
|
9
|
-
var te={},tt=!1;function Kt(){if(tt)return te;tt=!0,te.byteLength=h,te.toByteArray=f,te.fromByteArray=g;for(var r=[],n=[],l=typeof Uint8Array<"u"?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c=0,p=a.length;c<p;++c)r[c]=a[c],n[a.charCodeAt(c)]=c;n[45]=62,n[95]=63;function o(C){var I=C.length;if(I%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var _=C.indexOf("=");_===-1&&(_=I);var L=_===I?0:4-_%4;return [_,L]}function h(C){var I=o(C),_=I[0],L=I[1];return (_+L)*3/4-L}function E(C,I,_){return (I+_)*3/4-_}function f(C){var I,_=o(C),L=_[0],k=_[1],x=new l(E(C,L,k)),D=0,q=k>0?L-4:L,N;for(N=0;N<q;N+=4)I=n[C.charCodeAt(N)]<<18|n[C.charCodeAt(N+1)]<<12|n[C.charCodeAt(N+2)]<<6|n[C.charCodeAt(N+3)],x[D++]=I>>16&255,x[D++]=I>>8&255,x[D++]=I&255;return k===2&&(I=n[C.charCodeAt(N)]<<2|n[C.charCodeAt(N+1)]>>4,x[D++]=I&255),k===1&&(I=n[C.charCodeAt(N)]<<10|n[C.charCodeAt(N+1)]<<4|n[C.charCodeAt(N+2)]>>2,x[D++]=I>>8&255,x[D++]=I&255),x}function y(C){return r[C>>18&63]+r[C>>12&63]+r[C>>6&63]+r[C&63]}function R(C,I,_){for(var L,k=[],x=I;x<_;x+=3)L=(C[x]<<16&16711680)+(C[x+1]<<8&65280)+(C[x+2]&255),k.push(y(L));return k.join("")}function g(C){for(var I,_=C.length,L=_%3,k=[],x=16383,D=0,q=_-L;D<q;D+=x)k.push(R(C,D,D+x>q?q:D+x));return L===1?(I=C[_-1],k.push(r[I>>2]+r[I<<4&63]+"==")):L===2&&(I=(C[_-2]<<8)+C[_-1],k.push(r[I>>10]+r[I>>4&63]+r[I<<2&63]+"=")),k.join("")}return te}var de={},rt=!1;function Jt(){if(rt)return de;rt=!0;return de.read=function(r,n,l,a,c){var p,o,h=c*8-a-1,E=(1<<h)-1,f=E>>1,y=-7,R=l?c-1:0,g=l?-1:1,C=r[n+R];for(R+=g,p=C&(1<<-y)-1,C>>=-y,y+=h;y>0;p=p*256+r[n+R],R+=g,y-=8);for(o=p&(1<<-y)-1,p>>=-y,y+=a;y>0;o=o*256+r[n+R],R+=g,y-=8);if(p===0)p=1-f;else {if(p===E)return o?NaN:(C?-1:1)*(1/0);o=o+Math.pow(2,a),p=p-f;}return (C?-1:1)*o*Math.pow(2,p-a)},de.write=function(r,n,l,a,c,p){var o,h,E,f=p*8-c-1,y=(1<<f)-1,R=y>>1,g=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,C=a?0:p-1,I=a?1:-1,_=n<0||n===0&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(h=isNaN(n)?1:0,o=y):(o=Math.floor(Math.log(n)/Math.LN2),n*(E=Math.pow(2,-o))<1&&(o--,E*=2),o+R>=1?n+=g/E:n+=g*Math.pow(2,1-R),n*E>=2&&(o++,E/=2),o+R>=y?(h=0,o=y):o+R>=1?(h=(n*E-1)*Math.pow(2,c),o=o+R):(h=n*Math.pow(2,R-1)*Math.pow(2,c),o=0));c>=8;r[l+C]=h&255,C+=I,h/=256,c-=8);for(o=o<<c|h,f+=c;f>0;r[l+C]=o&255,C+=I,o/=256,f-=8);r[l+C-I]|=_*128;},de}var G={},nt=!1;function Xt(){if(nt)return G;nt=!0;let r=Kt(),n=Jt(),l=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;G.Buffer=o,G.SlowBuffer=k,G.INSPECT_MAX_BYTES=50;let a=2147483647;G.kMaxLength=a,o.TYPED_ARRAY_SUPPORT=c(),!o.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function c(){try{let i=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(i,e),i.foo()===42}catch{return !1}}Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}});function p(i){if(i>a)throw new RangeError('The value "'+i+'" is invalid for option "size"');let e=new Uint8Array(i);return Object.setPrototypeOf(e,o.prototype),e}function o(i,e,t){if(typeof i=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return y(i)}return h(i,e,t)}o.poolSize=8192;function h(i,e,t){if(typeof i=="string")return R(i,e);if(ArrayBuffer.isView(i))return C(i);if(i==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof i);if(M(i,ArrayBuffer)||i&&M(i.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(M(i,SharedArrayBuffer)||i&&M(i.buffer,SharedArrayBuffer)))return I(i,e,t);if(typeof i=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let s=i.valueOf&&i.valueOf();if(s!=null&&s!==i)return o.from(s,e,t);let u=_(i);if(u)return u;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof i[Symbol.toPrimitive]=="function")return o.from(i[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof i)}o.from=function(i,e,t){return h(i,e,t)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function E(i){if(typeof i!="number")throw new TypeError('"size" argument must be of type number');if(i<0)throw new RangeError('The value "'+i+'" is invalid for option "size"')}function f(i,e,t){return E(i),i<=0?p(i):e!==void 0?typeof t=="string"?p(i).fill(e,t):p(i).fill(e):p(i)}o.alloc=function(i,e,t){return f(i,e,t)};function y(i){return E(i),p(i<0?0:L(i)|0)}o.allocUnsafe=function(i){return y(i)},o.allocUnsafeSlow=function(i){return y(i)};function R(i,e){if((typeof e!="string"||e==="")&&(e="utf8"),!o.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=x(i,e)|0,s=p(t),u=s.write(i,e);return u!==t&&(s=s.slice(0,u)),s}function g(i){let e=i.length<0?0:L(i.length)|0,t=p(e);for(let s=0;s<e;s+=1)t[s]=i[s]&255;return t}function C(i){if(M(i,Uint8Array)){let e=new Uint8Array(i);return I(e.buffer,e.byteOffset,e.byteLength)}return g(i)}function I(i,e,t){if(e<0||i.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(i.byteLength<e+(t||0))throw new RangeError('"length" is outside of buffer bounds');let s;return e===void 0&&t===void 0?s=new Uint8Array(i):t===void 0?s=new Uint8Array(i,e):s=new Uint8Array(i,e,t),Object.setPrototypeOf(s,o.prototype),s}function _(i){if(o.isBuffer(i)){let e=L(i.length)|0,t=p(e);return t.length===0||i.copy(t,0,0,e),t}if(i.length!==void 0)return typeof i.length!="number"||Ne(i.length)?p(0):g(i);if(i.type==="Buffer"&&Array.isArray(i.data))return g(i.data)}function L(i){if(i>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return i|0}function k(i){return +i!=i&&(i=0),o.alloc(+i)}o.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==o.prototype},o.compare=function(e,t){if(M(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),M(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let s=e.length,u=t.length;for(let d=0,m=Math.min(s,u);d<m;++d)if(e[d]!==t[d]){s=e[d],u=t[d];break}return s<u?-1:u<s?1:0},o.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return !0;default:return !1}},o.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return o.alloc(0);let s;if(t===void 0)for(t=0,s=0;s<e.length;++s)t+=e[s].length;let u=o.allocUnsafe(t),d=0;for(s=0;s<e.length;++s){let m=e[s];if(M(m,Uint8Array))d+m.length>u.length?(o.isBuffer(m)||(m=o.from(m)),m.copy(u,d)):Uint8Array.prototype.set.call(u,m,d);else if(o.isBuffer(m))m.copy(u,d);else throw new TypeError('"list" argument must be an Array of Buffers');d+=m.length;}return u};function x(i,e){if(o.isBuffer(i))return i.length;if(ArrayBuffer.isView(i)||M(i,ArrayBuffer))return i.byteLength;if(typeof i!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof i);let t=i.length,s=arguments.length>2&&arguments[2]===!0;if(!s&&t===0)return 0;let u=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return Pe(i).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return et(i).length;default:if(u)return s?-1:Pe(i).length;e=(""+e).toLowerCase(),u=!0;}}o.byteLength=x;function D(i,e,t){let s=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return "";for(i||(i="utf8");;)switch(i){case"hex":return Ht(this,e,t);case"utf8":case"utf-8":return Ge(this,e,t);case"ascii":return Ut(this,e,t);case"latin1":case"binary":return qt(this,e,t);case"base64":return Ft(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Mt(this,e,t);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(i+"").toLowerCase(),s=!0;}}o.prototype._isBuffer=!0;function q(i,e,t){let s=i[e];i[e]=i[t],i[t]=s;}o.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)q(this,t,t+1);return this},o.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)q(this,t,t+3),q(this,t+1,t+2);return this},o.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)q(this,t,t+7),q(this,t+1,t+6),q(this,t+2,t+5),q(this,t+3,t+4);return this},o.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?Ge(this,0,e):D.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(e){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:o.compare(this,e)===0},o.prototype.inspect=function(){let e="",t=G.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},l&&(o.prototype[l]=o.prototype.inspect),o.prototype.compare=function(e,t,s,u,d){if(M(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),s===void 0&&(s=e?e.length:0),u===void 0&&(u=0),d===void 0&&(d=this.length),t<0||s>e.length||u<0||d>this.length)throw new RangeError("out of range index");if(u>=d&&t>=s)return 0;if(u>=d)return -1;if(t>=s)return 1;if(t>>>=0,s>>>=0,u>>>=0,d>>>=0,this===e)return 0;let m=d-u,A=s-t,b=Math.min(m,A),w=this.slice(u,d),S=e.slice(t,s);for(let B=0;B<b;++B)if(w[B]!==S[B]){m=w[B],A=S[B];break}return m<A?-1:A<m?1:0};function N(i,e,t,s,u){if(i.length===0)return -1;if(typeof t=="string"?(s=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,Ne(t)&&(t=u?0:i.length-1),t<0&&(t=i.length+t),t>=i.length){if(u)return -1;t=i.length-1;}else if(t<0)if(u)t=0;else return -1;if(typeof e=="string"&&(e=o.from(e,s)),o.isBuffer(e))return e.length===0?-1:ze(i,e,t,s,u);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?u?Uint8Array.prototype.indexOf.call(i,e,t):Uint8Array.prototype.lastIndexOf.call(i,e,t):ze(i,[e],t,s,u);throw new TypeError("val must be string, number or Buffer")}function ze(i,e,t,s,u){let d=1,m=i.length,A=e.length;if(s!==void 0&&(s=String(s).toLowerCase(),s==="ucs2"||s==="ucs-2"||s==="utf16le"||s==="utf-16le")){if(i.length<2||e.length<2)return -1;d=2,m/=2,A/=2,t/=2;}function b(S,B){return d===1?S[B]:S.readUInt16BE(B*d)}let w;if(u){let S=-1;for(w=t;w<m;w++)if(b(i,w)===b(e,S===-1?0:w-S)){if(S===-1&&(S=w),w-S+1===A)return S*d}else S!==-1&&(w-=w-S),S=-1;}else for(t+A>m&&(t=m-A),w=t;w>=0;w--){let S=!0;for(let B=0;B<A;B++)if(b(i,w+B)!==b(e,B)){S=!1;break}if(S)return w}return -1}o.prototype.includes=function(e,t,s){return this.indexOf(e,t,s)!==-1},o.prototype.indexOf=function(e,t,s){return N(this,e,t,s,!0)},o.prototype.lastIndexOf=function(e,t,s){return N(this,e,t,s,!1)};function xt(i,e,t,s){t=Number(t)||0;let u=i.length-t;s?(s=Number(s),s>u&&(s=u)):s=u;let d=e.length;s>d/2&&(s=d/2);let m;for(m=0;m<s;++m){let A=parseInt(e.substr(m*2,2),16);if(Ne(A))return m;i[t+m]=A;}return m}function Pt(i,e,t,s){return ce(Pe(e,i.length-t),i,t,s)}function Nt(i,e,t,s){return ce(Gt(e),i,t,s)}function kt(i,e,t,s){return ce(et(e),i,t,s)}function Dt(i,e,t,s){return ce(jt(e,i.length-t),i,t,s)}o.prototype.write=function(e,t,s,u){if(t===void 0)u="utf8",s=this.length,t=0;else if(s===void 0&&typeof t=="string")u=t,s=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(s)?(s=s>>>0,u===void 0&&(u="utf8")):(u=s,s=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let d=this.length-t;if((s===void 0||s>d)&&(s=d),e.length>0&&(s<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");u||(u="utf8");let m=!1;for(;;)switch(u){case"hex":return xt(this,e,t,s);case"utf8":case"utf-8":return Pt(this,e,t,s);case"ascii":case"latin1":case"binary":return Nt(this,e,t,s);case"base64":return kt(this,e,t,s);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Dt(this,e,t,s);default:if(m)throw new TypeError("Unknown encoding: "+u);u=(""+u).toLowerCase(),m=!0;}},o.prototype.toJSON=function(){return {type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ft(i,e,t){return e===0&&t===i.length?r.fromByteArray(i):r.fromByteArray(i.slice(e,t))}function Ge(i,e,t){t=Math.min(i.length,t);let s=[],u=e;for(;u<t;){let d=i[u],m=null,A=d>239?4:d>223?3:d>191?2:1;if(u+A<=t){let b,w,S,B;switch(A){case 1:d<128&&(m=d);break;case 2:b=i[u+1],(b&192)===128&&(B=(d&31)<<6|b&63,B>127&&(m=B));break;case 3:b=i[u+1],w=i[u+2],(b&192)===128&&(w&192)===128&&(B=(d&15)<<12|(b&63)<<6|w&63,B>2047&&(B<55296||B>57343)&&(m=B));break;case 4:b=i[u+1],w=i[u+2],S=i[u+3],(b&192)===128&&(w&192)===128&&(S&192)===128&&(B=(d&15)<<18|(b&63)<<12|(w&63)<<6|S&63,B>65535&&B<1114112&&(m=B));}}m===null?(m=65533,A=1):m>65535&&(m-=65536,s.push(m>>>10&1023|55296),m=56320|m&1023),s.push(m),u+=A;}return vt(s)}let je=4096;function vt(i){let e=i.length;if(e<=je)return String.fromCharCode.apply(String,i);let t="",s=0;for(;s<e;)t+=String.fromCharCode.apply(String,i.slice(s,s+=je));return t}function Ut(i,e,t){let s="";t=Math.min(i.length,t);for(let u=e;u<t;++u)s+=String.fromCharCode(i[u]&127);return s}function qt(i,e,t){let s="";t=Math.min(i.length,t);for(let u=e;u<t;++u)s+=String.fromCharCode(i[u]);return s}function Ht(i,e,t){let s=i.length;(!e||e<0)&&(e=0),(!t||t<0||t>s)&&(t=s);let u="";for(let d=e;d<t;++d)u+=Wt[i[d]];return u}function Mt(i,e,t){let s=i.slice(e,t),u="";for(let d=0;d<s.length-1;d+=2)u+=String.fromCharCode(s[d]+s[d+1]*256);return u}o.prototype.slice=function(e,t){let s=this.length;e=~~e,t=t===void 0?s:~~t,e<0?(e+=s,e<0&&(e=0)):e>s&&(e=s),t<0?(t+=s,t<0&&(t=0)):t>s&&(t=s),t<e&&(t=e);let u=this.subarray(e,t);return Object.setPrototypeOf(u,o.prototype),u};function P(i,e,t){if(i%1!==0||i<0)throw new RangeError("offset is not uint");if(i+e>t)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(e,t,s){e=e>>>0,t=t>>>0,s||P(e,t,this.length);let u=this[e],d=1,m=0;for(;++m<t&&(d*=256);)u+=this[e+m]*d;return u},o.prototype.readUintBE=o.prototype.readUIntBE=function(e,t,s){e=e>>>0,t=t>>>0,s||P(e,t,this.length);let u=this[e+--t],d=1;for(;t>0&&(d*=256);)u+=this[e+--t]*d;return u},o.prototype.readUint8=o.prototype.readUInt8=function(e,t){return e=e>>>0,t||P(e,1,this.length),this[e]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||P(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||P(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||P(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readBigUInt64LE=$(function(e){e=e>>>0,J(e,"offset");let t=this[e],s=this[e+7];(t===void 0||s===void 0)&&ee(e,this.length-8);let u=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,d=this[++e]+this[++e]*2**8+this[++e]*2**16+s*2**24;return BigInt(u)+(BigInt(d)<<BigInt(32))}),o.prototype.readBigUInt64BE=$(function(e){e=e>>>0,J(e,"offset");let t=this[e],s=this[e+7];(t===void 0||s===void 0)&&ee(e,this.length-8);let u=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],d=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+s;return (BigInt(u)<<BigInt(32))+BigInt(d)}),o.prototype.readIntLE=function(e,t,s){e=e>>>0,t=t>>>0,s||P(e,t,this.length);let u=this[e],d=1,m=0;for(;++m<t&&(d*=256);)u+=this[e+m]*d;return d*=128,u>=d&&(u-=Math.pow(2,8*t)),u},o.prototype.readIntBE=function(e,t,s){e=e>>>0,t=t>>>0,s||P(e,t,this.length);let u=t,d=1,m=this[e+--u];for(;u>0&&(d*=256);)m+=this[e+--u]*d;return d*=128,m>=d&&(m-=Math.pow(2,8*t)),m},o.prototype.readInt8=function(e,t){return e=e>>>0,t||P(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},o.prototype.readInt16LE=function(e,t){e=e>>>0,t||P(e,2,this.length);let s=this[e]|this[e+1]<<8;return s&32768?s|4294901760:s},o.prototype.readInt16BE=function(e,t){e=e>>>0,t||P(e,2,this.length);let s=this[e+1]|this[e]<<8;return s&32768?s|4294901760:s},o.prototype.readInt32LE=function(e,t){return e=e>>>0,t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e=e>>>0,t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readBigInt64LE=$(function(e){e=e>>>0,J(e,"offset");let t=this[e],s=this[e+7];(t===void 0||s===void 0)&&ee(e,this.length-8);let u=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(s<<24);return (BigInt(u)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),o.prototype.readBigInt64BE=$(function(e){e=e>>>0,J(e,"offset");let t=this[e],s=this[e+7];(t===void 0||s===void 0)&&ee(e,this.length-8);let u=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return (BigInt(u)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+s)}),o.prototype.readFloatLE=function(e,t){return e=e>>>0,t||P(e,4,this.length),n.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e=e>>>0,t||P(e,4,this.length),n.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||P(e,8,this.length),n.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||P(e,8,this.length),n.read(this,e,!1,52,8)};function F(i,e,t,s,u,d){if(!o.isBuffer(i))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>u||e<d)throw new RangeError('"value" argument is out of bounds');if(t+s>i.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(e,t,s,u){if(e=+e,t=t>>>0,s=s>>>0,!u){let A=Math.pow(2,8*s)-1;F(this,e,t,s,A,0);}let d=1,m=0;for(this[t]=e&255;++m<s&&(d*=256);)this[t+m]=e/d&255;return t+s},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(e,t,s,u){if(e=+e,t=t>>>0,s=s>>>0,!u){let A=Math.pow(2,8*s)-1;F(this,e,t,s,A,0);}let d=s-1,m=1;for(this[t+d]=e&255;--d>=0&&(m*=256);)this[t+d]=e/m&255;return t+s},o.prototype.writeUint8=o.prototype.writeUInt8=function(e,t,s){return e=+e,t=t>>>0,s||F(this,e,t,1,255,0),this[t]=e&255,t+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(e,t,s){return e=+e,t=t>>>0,s||F(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(e,t,s){return e=+e,t=t>>>0,s||F(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(e,t,s){return e=+e,t=t>>>0,s||F(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(e,t,s){return e=+e,t=t>>>0,s||F(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function We(i,e,t,s,u){Qe(e,s,u,i,t,7);let d=Number(e&BigInt(4294967295));i[t++]=d,d=d>>8,i[t++]=d,d=d>>8,i[t++]=d,d=d>>8,i[t++]=d;let m=Number(e>>BigInt(32)&BigInt(4294967295));return i[t++]=m,m=m>>8,i[t++]=m,m=m>>8,i[t++]=m,m=m>>8,i[t++]=m,t}function Ye(i,e,t,s,u){Qe(e,s,u,i,t,7);let d=Number(e&BigInt(4294967295));i[t+7]=d,d=d>>8,i[t+6]=d,d=d>>8,i[t+5]=d,d=d>>8,i[t+4]=d;let m=Number(e>>BigInt(32)&BigInt(4294967295));return i[t+3]=m,m=m>>8,i[t+2]=m,m=m>>8,i[t+1]=m,m=m>>8,i[t]=m,t+8}o.prototype.writeBigUInt64LE=$(function(e,t=0){return We(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=$(function(e,t=0){return Ye(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(e,t,s,u){if(e=+e,t=t>>>0,!u){let b=Math.pow(2,8*s-1);F(this,e,t,s,b-1,-b);}let d=0,m=1,A=0;for(this[t]=e&255;++d<s&&(m*=256);)e<0&&A===0&&this[t+d-1]!==0&&(A=1),this[t+d]=(e/m>>0)-A&255;return t+s},o.prototype.writeIntBE=function(e,t,s,u){if(e=+e,t=t>>>0,!u){let b=Math.pow(2,8*s-1);F(this,e,t,s,b-1,-b);}let d=s-1,m=1,A=0;for(this[t+d]=e&255;--d>=0&&(m*=256);)e<0&&A===0&&this[t+d+1]!==0&&(A=1),this[t+d]=(e/m>>0)-A&255;return t+s},o.prototype.writeInt8=function(e,t,s){return e=+e,t=t>>>0,s||F(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},o.prototype.writeInt16LE=function(e,t,s){return e=+e,t=t>>>0,s||F(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,s){return e=+e,t=t>>>0,s||F(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},o.prototype.writeInt32LE=function(e,t,s){return e=+e,t=t>>>0,s||F(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},o.prototype.writeInt32BE=function(e,t,s){return e=+e,t=t>>>0,s||F(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},o.prototype.writeBigInt64LE=$(function(e,t=0){return We(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=$(function(e,t=0){return Ye(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Ke(i,e,t,s,u,d){if(t+s>i.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function Je(i,e,t,s,u){return e=+e,t=t>>>0,u||Ke(i,e,t,4),n.write(i,e,t,s,23,4),t+4}o.prototype.writeFloatLE=function(e,t,s){return Je(this,e,t,!0,s)},o.prototype.writeFloatBE=function(e,t,s){return Je(this,e,t,!1,s)};function Xe(i,e,t,s,u){return e=+e,t=t>>>0,u||Ke(i,e,t,8),n.write(i,e,t,s,52,8),t+8}o.prototype.writeDoubleLE=function(e,t,s){return Xe(this,e,t,!0,s)},o.prototype.writeDoubleBE=function(e,t,s){return Xe(this,e,t,!1,s)},o.prototype.copy=function(e,t,s,u){if(!o.isBuffer(e))throw new TypeError("argument should be a Buffer");if(s||(s=0),!u&&u!==0&&(u=this.length),t>=e.length&&(t=e.length),t||(t=0),u>0&&u<s&&(u=s),u===s||e.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(s<0||s>=this.length)throw new RangeError("Index out of range");if(u<0)throw new RangeError("sourceEnd out of bounds");u>this.length&&(u=this.length),e.length-t<u-s&&(u=e.length-t+s);let d=u-s;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,s,u):Uint8Array.prototype.set.call(e,this.subarray(s,u),t),d},o.prototype.fill=function(e,t,s,u){if(typeof e=="string"){if(typeof t=="string"?(u=t,t=0,s=this.length):typeof s=="string"&&(u=s,s=this.length),u!==void 0&&typeof u!="string")throw new TypeError("encoding must be a string");if(typeof u=="string"&&!o.isEncoding(u))throw new TypeError("Unknown encoding: "+u);if(e.length===1){let m=e.charCodeAt(0);(u==="utf8"&&m<128||u==="latin1")&&(e=m);}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(t<0||this.length<t||this.length<s)throw new RangeError("Out of range index");if(s<=t)return this;t=t>>>0,s=s===void 0?this.length:s>>>0,e||(e=0);let d;if(typeof e=="number")for(d=t;d<s;++d)this[d]=e;else {let m=o.isBuffer(e)?e:o.from(e,u),A=m.length;if(A===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(d=0;d<s-t;++d)this[d+t]=m[d%A];}return this};let K={};function xe(i,e,t){K[i]=class extends t{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${i}]`,this.stack,delete this.name;}get code(){return i}set code(u){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:u,writable:!0});}toString(){return `${this.name} [${i}]: ${this.message}`}};}xe("ERR_BUFFER_OUT_OF_BOUNDS",function(i){return i?`${i} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),xe("ERR_INVALID_ARG_TYPE",function(i,e){return `The "${i}" argument must be of type number. Received type ${typeof e}`},TypeError),xe("ERR_OUT_OF_RANGE",function(i,e,t){let s=`The value of "${i}" is out of range.`,u=t;return Number.isInteger(t)&&Math.abs(t)>2**32?u=Ze(String(t)):typeof t=="bigint"&&(u=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(u=Ze(u)),u+="n"),s+=` It must be ${e}. Received ${u}`,s},RangeError);function Ze(i){let e="",t=i.length,s=i[0]==="-"?1:0;for(;t>=s+4;t-=3)e=`_${i.slice(t-3,t)}${e}`;return `${i.slice(0,t)}${e}`}function $t(i,e,t){J(e,"offset"),(i[e]===void 0||i[e+t]===void 0)&&ee(e,i.length-(t+1));}function Qe(i,e,t,s,u,d){if(i>t||i<e){let m=typeof e=="bigint"?"n":"",A;throw e===0||e===BigInt(0)?A=`>= 0${m} and < 2${m} ** ${(d+1)*8}${m}`:A=`>= -(2${m} ** ${(d+1)*8-1}${m}) and < 2 ** ${(d+1)*8-1}${m}`,new K.ERR_OUT_OF_RANGE("value",A,i)}$t(s,u,d);}function J(i,e){if(typeof i!="number")throw new K.ERR_INVALID_ARG_TYPE(e,"number",i)}function ee(i,e,t){throw Math.floor(i)!==i?(J(i,t),new K.ERR_OUT_OF_RANGE("offset","an integer",i)):e<0?new K.ERR_BUFFER_OUT_OF_BOUNDS:new K.ERR_OUT_OF_RANGE("offset",`>= ${0} and <= ${e}`,i)}let Vt=/[^+/0-9A-Za-z-_]/g;function zt(i){if(i=i.split("=")[0],i=i.trim().replace(Vt,""),i.length<2)return "";for(;i.length%4!==0;)i=i+"=";return i}function Pe(i,e){e=e||1/0;let t,s=i.length,u=null,d=[];for(let m=0;m<s;++m){if(t=i.charCodeAt(m),t>55295&&t<57344){if(!u){if(t>56319){(e-=3)>-1&&d.push(239,191,189);continue}else if(m+1===s){(e-=3)>-1&&d.push(239,191,189);continue}u=t;continue}if(t<56320){(e-=3)>-1&&d.push(239,191,189),u=t;continue}t=(u-55296<<10|t-56320)+65536;}else u&&(e-=3)>-1&&d.push(239,191,189);if(u=null,t<128){if((e-=1)<0)break;d.push(t);}else if(t<2048){if((e-=2)<0)break;d.push(t>>6|192,t&63|128);}else if(t<65536){if((e-=3)<0)break;d.push(t>>12|224,t>>6&63|128,t&63|128);}else if(t<1114112){if((e-=4)<0)break;d.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128);}else throw new Error("Invalid code point")}return d}function Gt(i){let e=[];for(let t=0;t<i.length;++t)e.push(i.charCodeAt(t)&255);return e}function jt(i,e){let t,s,u,d=[];for(let m=0;m<i.length&&!((e-=2)<0);++m)t=i.charCodeAt(m),s=t>>8,u=t%256,d.push(u),d.push(s);return d}function et(i){return r.toByteArray(zt(i))}function ce(i,e,t,s){let u;for(u=0;u<s&&!(u+t>=e.length||u>=i.length);++u)e[u+t]=i[u];return u}function M(i,e){return i instanceof e||i!=null&&i.constructor!=null&&i.constructor.name!=null&&i.constructor.name===e.name}function Ne(i){return i!==i}let Wt=function(){let i="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let s=t*16;for(let u=0;u<16;++u)e[s+u]=i[t]+i[u];}return e}();function $(i){return typeof BigInt>"u"?Yt:i}function Yt(){throw new Error("BigInt not supported")}return G}var j=Xt();j.Buffer;j.SlowBuffer;j.INSPECT_MAX_BYTES;j.kMaxLength;var T=j.Buffer;j.INSPECT_MAX_BYTES;j.kMaxLength;var re=class{constructor(n){this.config=n;}};var X=class extends Error{url;status;statusText;body;request;constructor(n,l,a){super(a),this.name="ApiError",this.url=l.url,this.status=l.status,this.statusText=l.statusText,this.body=l.body,this.request=n;}};var me=class extends Error{constructor(n){super(n),this.name="CancelError";}get isCancelled(){return !0}},ne=class{[Symbol.toStringTag];_isResolved;_isRejected;_isCancelled;_cancelHandlers;_promise;_resolve;_reject;constructor(n){this._isResolved=!1,this._isRejected=!1,this._isCancelled=!1,this._cancelHandlers=[],this._promise=new Promise((l,a)=>{this._resolve=l,this._reject=a;let c=h=>{this._isResolved||this._isRejected||this._isCancelled||(this._isResolved=!0,this._resolve?.(h));},p=h=>{this._isResolved||this._isRejected||this._isCancelled||(this._isRejected=!0,this._reject?.(h));},o=h=>{this._isResolved||this._isRejected||this._isCancelled||this._cancelHandlers.push(h);};return Object.defineProperty(o,"isResolved",{get:()=>this._isResolved}),Object.defineProperty(o,"isRejected",{get:()=>this._isRejected}),Object.defineProperty(o,"isCancelled",{get:()=>this._isCancelled}),n(c,p,o)});}then(n,l){return this._promise.then(n,l)}catch(n){return this._promise.catch(n)}finally(n){return this._promise.finally(n)}cancel(){if(!(this._isResolved||this._isRejected||this._isCancelled)){if(this._isCancelled=!0,this._cancelHandlers.length)try{for(let n of this._cancelHandlers)n();}catch(n){console.warn("Cancellation threw an error",n);return}this._cancelHandlers.length=0,this._reject?.(new me("Request aborted"));}}get isCancelled(){return this._isCancelled}};var De=r=>r!=null,he=r=>typeof r=="string",ke=r=>he(r)&&r!=="",st=r=>typeof r=="object"&&typeof r.type=="string"&&typeof r.stream=="function"&&typeof r.arrayBuffer=="function"&&typeof r.constructor=="function"&&typeof r.constructor.name=="string"&&/^(Blob|File)$/.test(r.constructor.name)&&/^(Blob|File)$/.test(r[Symbol.toStringTag]),Zt=r=>r instanceof ot,Qt=r=>r>=200&&r<300,er=r=>{try{return btoa(r)}catch{return T.from(r).toString("base64")}},tr=r=>{let n=[],l=(c,p)=>{n.push(`${encodeURIComponent(c)}=${encodeURIComponent(String(p))}`);},a=(c,p)=>{De(p)&&(Array.isArray(p)?p.forEach(o=>{a(c,o);}):typeof p=="object"?Object.entries(p).forEach(([o,h])=>{a(`${c}[${o}]`,h);}):l(c,p));};return Object.entries(r).forEach(([c,p])=>{a(c,p);}),n.length>0?`?${n.join("&")}`:""},rr=(r,n)=>{let l=r.ENCODE_PATH||encodeURI,a=n.url.replace("{api-version}",r.VERSION).replace(/{(.*?)}/g,(p,o)=>n.path?.hasOwnProperty(o)?l(String(n.path[o])):p),c=`${r.BASE}${a}`;return n.query?`${c}${tr(n.query)}`:c},nr=r=>{if(r.formData){let n=new ot,l=(a,c)=>{he(c)||st(c)?n.append(a,c):n.append(a,JSON.stringify(c));};return Object.entries(r.formData).filter(([a,c])=>De(c)).forEach(([a,c])=>{Array.isArray(c)?c.forEach(p=>l(a,p)):l(a,c);}),n}},fe=async(r,n)=>typeof n=="function"?n(r):n,ir=async(r,n,l)=>{let a=await fe(n,r.TOKEN),c=await fe(n,r.USERNAME),p=await fe(n,r.PASSWORD),o=await fe(n,r.HEADERS),h=typeof l?.getHeaders=="function"&&l?.getHeaders()||{},E=Object.entries({Accept:"application/json",...o,...n.headers,...h}).filter(([f,y])=>De(y)).reduce((f,[y,R])=>({...f,[y]:String(R)}),{});if(ke(a)&&(E.Authorization=`Bearer ${a}`),ke(c)&&ke(p)){let f=er(`${c}:${p}`);E.Authorization=`Basic ${f}`;}return n.body&&(n.mediaType?E["Content-Type"]=n.mediaType:st(n.body)?E["Content-Type"]=n.body.type||"application/octet-stream":he(n.body)?E["Content-Type"]="text/plain":Zt(n.body)||(E["Content-Type"]="application/json")),E},or=r=>{if(r.body)return r.body},sr=async(r,n,l,a,c,p,o)=>{let h=it.CancelToken.source(),E={url:l,headers:p,data:a??c,method:n.method,withCredentials:r.WITH_CREDENTIALS,cancelToken:h.token};o(()=>h.cancel("The user aborted a request."));try{return await it.request(E)}catch(f){let y=f;if(y.response)return y.response;throw f}},ar=(r,n)=>{if(n){let l=r.headers[n];if(he(l))return l}},lr=r=>{if(r.status!==204)return r.data},ur=(r,n)=>{let a={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable",...r.errors}[n.status];if(a)throw new X(r,n,a);if(!n.ok)throw new X(r,n,"Generic Error")},at=(r,n)=>new ne(async(l,a,c)=>{try{let p=rr(r,n),o=nr(n),h=or(n),E=await ir(r,n,o);if(!c.isCancelled){let f=await sr(r,n,p,h,o,E,c),y=lr(f),R=ar(f,n.responseHeader),g={url:p,ok:Qt(f.status),status:f.status,statusText:f.statusText,body:R??y};ur(n,g),l(g.body);}}catch(p){a(p);}});var ye=class extends re{constructor(n){super(n);}request(n){return at(this.config,n)}};var ie=class{constructor(n){this.httpRequest=n;}cancelOrders({chainName:n,requestBody:l}){return this.httpRequest.request({method:"POST",url:"/v1/chains/{chain_name}/orders/cancel",path:{chain_name:n},body:l,mediaType:"application/json",errors:{400:"Bad Request (400)",401:"Unauthorised Request (401)",404:"The specified resource was not found (404)",429:"Too Many Requests (429)",500:"Internal Server Error (500)",501:"Not Implemented Error (501)"}})}listListings({chainName:n,status:l,sellItemContractAddress:a,buyItemType:c,buyItemContractAddress:p,accountAddress:o,sellItemMetadataId:h,sellItemTokenId:E,fromUpdatedAt:f,pageSize:y,sortBy:R,sortDirection:g,pageCursor:C}){return this.httpRequest.request({method:"GET",url:"/v1/chains/{chain_name}/orders/listings",path:{chain_name:n},query:{status:l,sell_item_contract_address:a,buy_item_type:c,buy_item_contract_address:p,account_address:o,sell_item_metadata_id:h,sell_item_token_id:E,from_updated_at:f,page_size:y,sort_by:R,sort_direction:g,page_cursor:C},errors:{400:"Bad Request (400)",404:"The specified resource was not found (404)",500:"Internal Server Error (500)"}})}createListing({chainName:n,requestBody:l}){return this.httpRequest.request({method:"POST",url:"/v1/chains/{chain_name}/orders/listings",path:{chain_name:n},body:l,mediaType:"application/json",errors:{400:"Bad Request (400)",404:"The specified resource was not found (404)",500:"Internal Server Error (500)"}})}listBids({chainName:n,status:l,buyItemContractAddress:a,sellItemContractAddress:c,accountAddress:p,buyItemMetadataId:o,buyItemTokenId:h,fromUpdatedAt:E,pageSize:f,sortBy:y,sortDirection:R,pageCursor:g}){return this.httpRequest.request({method:"GET",url:"/v1/chains/{chain_name}/orders/bids",path:{chain_name:n},query:{status:l,buy_item_contract_address:a,sell_item_contract_address:c,account_address:p,buy_item_metadata_id:o,buy_item_token_id:h,from_updated_at:E,page_size:f,sort_by:y,sort_direction:R,page_cursor:g},errors:{400:"Bad Request (400)",404:"The specified resource was not found (404)",500:"Internal Server Error (500)"}})}createBid({chainName:n,requestBody:l}){return this.httpRequest.request({method:"POST",url:"/v1/chains/{chain_name}/orders/bids",path:{chain_name:n},body:l,mediaType:"application/json",errors:{400:"Bad Request (400)",404:"The specified resource was not found (404)",500:"Internal Server Error (500)",501:"Not Implemented Error (501)"}})}listCollectionBids({chainName:n,status:l,buyItemContractAddress:a,sellItemContractAddress:c,accountAddress:p,fromUpdatedAt:o,pageSize:h,sortBy:E,sortDirection:f,pageCursor:y}){return this.httpRequest.request({method:"GET",url:"/v1/chains/{chain_name}/orders/collection-bids",path:{chain_name:n},query:{status:l,buy_item_contract_address:a,sell_item_contract_address:c,account_address:p,from_updated_at:o,page_size:h,sort_by:E,sort_direction:f,page_cursor:y},errors:{400:"Bad Request (400)",404:"The specified resource was not found (404)",500:"Internal Server Error (500)"}})}createCollectionBid({chainName:n,requestBody:l}){return this.httpRequest.request({method:"POST",url:"/v1/chains/{chain_name}/orders/collection-bids",path:{chain_name:n},body:l,mediaType:"application/json",errors:{400:"Bad Request (400)",404:"The specified resource was not found (404)",500:"Internal Server Error (500)",501:"Not Implemented Error (501)"}})}getListing({chainName:n,listingId:l}){return this.httpRequest.request({method:"GET",url:"/v1/chains/{chain_name}/orders/listings/{listing_id}",path:{chain_name:n,listing_id:l},errors:{400:"Bad Request (400)",404:"The specified resource was not found (404)",500:"Internal Server Error (500)"}})}getBid({chainName:n,bidId:l}){return this.httpRequest.request({method:"GET",url:"/v1/chains/{chain_name}/orders/bids/{bid_id}",path:{chain_name:n,bid_id:l},errors:{400:"Bad Request (400)",404:"The specified resource was not found (404)",500:"Internal Server Error (500)"}})}getCollectionBid({chainName:n,collectionBidId:l}){return this.httpRequest.request({method:"GET",url:"/v1/chains/{chain_name}/orders/collection-bids/{collection_bid_id}",path:{chain_name:n,collection_bid_id:l},errors:{400:"Bad Request (400)",404:"The specified resource was not found (404)",500:"Internal Server Error (500)"}})}fulfillmentData({chainName:n,requestBody:l}){return this.httpRequest.request({method:"POST",url:"/v1/chains/{chain_name}/orders/fulfillment-data",path:{chain_name:n},body:l,mediaType:"application/json",errors:{400:"Bad Request (400)",404:"The specified resource was not found (404)",500:"Internal Server Error (500)"}})}listTrades({chainName:n,accountAddress:l,sellItemContractAddress:a,fromIndexedAt:c,pageSize:p,sortBy:o,sortDirection:h,pageCursor:E}){return this.httpRequest.request({method:"GET",url:"/v1/chains/{chain_name}/trades",path:{chain_name:n},query:{account_address:l,sell_item_contract_address:a,from_indexed_at:c,page_size:p,sort_by:o,sort_direction:h,page_cursor:E},errors:{400:"Bad Request (400)",404:"The specified resource was not found (404)",500:"Internal Server Error (500)"}})}getTrade({chainName:n,tradeId:l}){return this.httpRequest.request({method:"GET",url:"/v1/chains/{chain_name}/trades/{trade_id}",path:{chain_name:n,trade_id:l},errors:{400:"Bad Request (400)",404:"The specified resource was not found (404)",500:"Internal Server Error (500)"}})}};var oe=class{orders;request;constructor(n,l=ye){this.request=new l({BASE:n?.BASE??"https://api.immutable.com",VERSION:n?.VERSION??"1.0.0",WITH_CREDENTIALS:n?.WITH_CREDENTIALS??!1,CREDENTIALS:n?.CREDENTIALS??"include",TOKEN:n?.TOKEN,USERNAME:n?.USERNAME,PASSWORD:n?.PASSWORD,HEADERS:n?.HEADERS,ENCODE_PATH:n?.ENCODE_PATH}),this.orders=new ie(this.request);}};var lt;(n=>{(p=>(p.ON_CHAIN="ON_CHAIN",p.OFF_CHAIN="OFF_CHAIN",p.UNDERFUNDED="UNDERFUNDED"))(n.cancellation_type||={});})(lt||={});var ut;(n=>{(a=>a.FILLED="FILLED")(n.reason_code||={});})(ut||={});var v;(n=>{(o=>(o.ROYALTY="ROYALTY",o.MAKER_ECOSYSTEM="MAKER_ECOSYSTEM",o.TAKER_ECOSYSTEM="TAKER_ECOSYSTEM",o.PROTOCOL="PROTOCOL"))(n.type||={});})(v||={});var H;(n=>{(p=>(p.LISTING="LISTING",p.BID="BID",p.COLLECTION_BID="COLLECTION_BID"))(n.type||={});})(H||={});var Ce=(o=>(o.PENDING="PENDING",o.ACTIVE="ACTIVE",o.INACTIVE="INACTIVE",o.FILLED="FILLED",o.EXPIRED="EXPIRED",o.CANCELLED="CANCELLED",o))(Ce||{});var V;(n=>{(c=>(c.FULL_RESTRICTED="FULL_RESTRICTED",c.PARTIAL_RESTRICTED="PARTIAL_RESTRICTED"))(n.order_type||={});})(V||={});function U(r){throw new Error("Unreachable")}function W(r){if(r.type!==H.type.LISTING)throw new Error("Order type must be LISTING");let n=r.sell.map(a=>{if(a.type==="ERC721")return {type:"ERC721",contractAddress:a.contract_address,tokenId:a.token_id};if(a.type==="ERC1155")return {type:"ERC1155",contractAddress:a.contract_address,tokenId:a.token_id,amount:a.amount};throw new Error("Listing sell items must either ERC721 or ERC1155")}),l=r.buy.map(a=>{if(a.type==="NATIVE")return {type:"NATIVE",amount:a.amount};if(a.type==="ERC20")return {type:"ERC20",contractAddress:a.contract_address,amount:a.amount};throw new Error("Listing buy items must be either NATIVE or ERC20")});return {id:r.id,type:r.type,chain:r.chain,accountAddress:r.account_address,sell:n,buy:l,fees:r.fees.map(a=>({amount:a.amount,recipientAddress:a.recipient_address,type:a.type})),status:r.status,fillStatus:r.fill_status,startAt:r.start_at,endAt:r.end_at,salt:r.salt,signature:r.signature,orderHash:r.order_hash,protocolData:{orderType:r.protocol_data.order_type,counter:r.protocol_data.counter,seaportAddress:r.protocol_data.seaport_address,seaportVersion:r.protocol_data.seaport_version,zoneAddress:r.protocol_data.zone_address},createdAt:r.created_at,updatedAt:r.updated_at}}function se(r){if(r.type!==H.type.BID)throw new Error("Order type must be BID");let n=r.sell.map(a=>{if(a.type==="ERC20")return {type:"ERC20",contractAddress:a.contract_address,amount:a.amount};throw new Error("Bid sell items must be ERC20")}),l=r.buy.map(a=>{if(a.type==="ERC721")return {type:"ERC721",contractAddress:a.contract_address,tokenId:a.token_id};if(a.type==="ERC1155")return {type:"ERC1155",contractAddress:a.contract_address,tokenId:a.token_id,amount:a.amount};throw new Error("Bid buy items must either ERC721 or ERC1155")});return {id:r.id,type:r.type,chain:r.chain,accountAddress:r.account_address,sell:n,buy:l,fees:r.fees.map(a=>({amount:a.amount,recipientAddress:a.recipient_address,type:a.type})),status:r.status,fillStatus:r.fill_status,startAt:r.start_at,endAt:r.end_at,salt:r.salt,signature:r.signature,orderHash:r.order_hash,protocolData:{orderType:r.protocol_data.order_type,counter:r.protocol_data.counter,seaportAddress:r.protocol_data.seaport_address,seaportVersion:r.protocol_data.seaport_version,zoneAddress:r.protocol_data.zone_address},createdAt:r.created_at,updatedAt:r.updated_at}}function ae(r){if(r.type!==H.type.COLLECTION_BID)throw new Error("Order type must be COLLECTION_BID");let n=r.sell.map(a=>{if(a.type==="ERC20")return {type:"ERC20",contractAddress:a.contract_address,amount:a.amount};throw new Error("Collection bid sell items must be ERC20")}),l=r.buy.map(a=>{if(a.type==="ERC721_COLLECTION")return {type:"ERC721_COLLECTION",contractAddress:a.contract_address,amount:a.amount};if(a.type==="ERC1155_COLLECTION")return {type:"ERC1155_COLLECTION",contractAddress:a.contract_address,amount:a.amount};throw new Error("Collection bid buy items must either ERC721_COLLECTION or ERC1155_COLLECTION")});return {id:r.id,type:r.type,chain:r.chain,accountAddress:r.account_address,sell:n,buy:l,fees:r.fees.map(a=>({amount:a.amount,recipientAddress:a.recipient_address,type:a.type})),status:r.status,fillStatus:r.fill_status,startAt:r.start_at,endAt:r.end_at,salt:r.salt,signature:r.signature,orderHash:r.order_hash,protocolData:{orderType:r.protocol_data.order_type,counter:r.protocol_data.counter,seaportAddress:r.protocol_data.seaport_address,seaportVersion:r.protocol_data.seaport_version,zoneAddress:r.protocol_data.zone_address},createdAt:r.created_at,updatedAt:r.updated_at}}function le(r){switch(r.type){case H.type.LISTING:return W(r);case H.type.BID:return se(r);case H.type.COLLECTION_BID:return ae(r);default:return U(r.type)}}function Fe(r){let n=r.buy.map(a=>{if(a.type==="NATIVE")return {type:"NATIVE",amount:a.amount};if(a.type==="ERC20")return {type:"ERC20",contractAddress:a.contract_address,amount:a.amount};if(a.type==="ERC721")return {type:"ERC721",contractAddress:a.contract_address,tokenId:a.token_id};if(a.type==="ERC1155")return {type:"ERC1155",contractAddress:a.contract_address,tokenId:a.token_id,amount:a.amount};throw new Error("Buy items must be NATIVE, ERC20, ERC721 or ERC1155")}),l=r.sell.map(a=>{if(a.type==="ERC20")return {type:"ERC20",contractAddress:a.contract_address,amount:a.amount};if(a.type==="ERC721")return {type:"ERC721",contractAddress:a.contract_address,tokenId:a.token_id};if(a.type==="ERC1155")return {type:"ERC1155",contractAddress:a.contract_address,tokenId:a.token_id,amount:a.amount};throw new Error("Sell items must be ERC20, ERC721 or ERC1155")});return {id:r.id,orderId:r.order_id,buy:n,sell:l,buyerFees:r.buyer_fees.map(a=>({amount:a.amount,recipientAddress:a.recipient_address,type:a.type})),fees:r.fees.map(a=>({amount:a.amount,recipientAddress:a.recipient_address,type:a.type})),chain:r.chain,indexedAt:r.indexed_at,blockchainMetadata:{blockNumber:r.blockchain_metadata.block_number,logIndex:r.blockchain_metadata.log_index,transactionHash:r.blockchain_metadata.transaction_hash,transactionIndex:r.blockchain_metadata.transaction_index},buyerAddress:r.buyer_address,makerAddress:r.maker_address,sellerAddress:r.seller_address,takerAddress:r.taker_address}}function ue(r){return {nextCursor:r.next_cursor,previousCursor:r.previous_cursor}}var pr=(c=>(c[c.MAKER_ECOSYSTEM=v.type.MAKER_ECOSYSTEM]="MAKER_ECOSYSTEM",c[c.TAKER_ECOSYSTEM=v.type.TAKER_ECOSYSTEM]="TAKER_ECOSYSTEM",c[c.PROTOCOL=v.type.PROTOCOL]="PROTOCOL",c[c.ROYALTY=v.type.ROYALTY]="ROYALTY",c))(pr||{}),ve=(l=>(l.TRANSACTION="TRANSACTION",l.SIGNABLE="SIGNABLE",l))(ve||{}),pt=(a=>(a.APPROVAL="APPROVAL",a.FULFILL_ORDER="FULFILL_ORDER",a.CANCEL="CANCEL",a))(pt||{}),Ue=(a=>(a.CREATE_LISTING="CREATE_ORDER",a.CREATE_ORDER="CREATE_ORDER",a.OFF_CHAIN_CANCELLATION="OFF_CHAIN_CANCELLATION",a))(Ue||{});var qe="ImmutableSeaport",Y="1.5",Ee={OrderComponents:[{name:"offerer",type:"address"},{name:"zone",type:"address"},{name:"offer",type:"OfferItem[]"},{name:"consideration",type:"ConsiderationItem[]"},{name:"orderType",type:"uint8"},{name:"startTime",type:"uint256"},{name:"endTime",type:"uint256"},{name:"zoneHash",type:"bytes32"},{name:"salt",type:"uint256"},{name:"conduitKey",type:"bytes32"},{name:"counter",type:"uint256"}],OfferItem:[{name:"itemType",type:"uint8"},{name:"token",type:"address"},{name:"identifierOrCriteria",type:"uint256"},{name:"startAmount",type:"uint256"},{name:"endAmount",type:"uint256"}],ConsiderationItem:[{name:"itemType",type:"uint8"},{name:"token",type:"address"},{name:"identifierOrCriteria",type:"uint256"},{name:"startAmount",type:"uint256"},{name:"endAmount",type:"uint256"},{name:"recipient",type:"address"}]};var cr={integer:0,address:zeroPadValue("0x",20),bool:!1,bytes:"0x",string:""},He=r=>r===void 0?!1:r!=null&&(["string","number"].includes(typeof r)&&BigInt(r)===0n||Array.isArray(r)&&r.every(He)||typeof r=="object"&&Object.values(r).every(He)||typeof r=="boolean"&&r===!1);function dr(r){let[,n]=r.match(/^bytes(\d+)$/)??[];return n?zeroPadValue("0x",parseInt(n)):(r.match(/^(u?)int(\d*)$/)&&(r="integer"),cr[r])}var Z=class r{constructor(n){this.types=n;for(let l in n){let a=this.getDefaultValue(l);if(this.defaultValues[l]=a,!He(a))throw new Error(`Got non-empty value for type ${l} in default generator: ${a}`)}}defaultValues={};static from(n,l){let{defaultValues:a}=new r(n);return l?a[l]:a}getDefaultValue(n){if(this.defaultValues[n])return this.defaultValues[n];let l=dr(n);if(l!==void 0)return l;let a=n.match(/^(.*)(\x5b(\d*)\x5d)$/);if(a){let p=a[1],o=parseInt(a[3]);if(o>0){let h=this.getDefaultValue(p);return Array(o).fill(h)}return []}let c=this.types[n];if(c)return c.reduce((p,{name:o,type:h})=>({...p,[o]:this.getDefaultValue(h)}),{});throw new Error(`unknown type: ${n}`)}};var yr=(r,n)=>Array(r).fill(0).map((l,a)=>n(a)),Me=(r,n)=>yr(Math.ceil(r.length/n),l=>r.slice(l*n,(l+1)*n)),dt=r=>toBeHex(r.toString("hex")),Q=r=>T.from(r.slice(2),"hex"),ge=r=>Q(keccak256(r)),Cr=r=>ge(concat(r)),pe=(r,n,l)=>(n>r.length&&r.push(...Array(n-r.length).fill(l)),r),mt=(r,n=!0)=>{if(r.length===0)throw new Error("empty tree");let a=[r.map(c=>{let p=T.isBuffer(c)?c:Q(c);return n?ge(p):p})];for(;a[a.length-1].length>1;)a.push(Er(a[a.length-1]));return a[a.length-1][0]},Er=r=>Me(r,2).map(Cr);var Ar=(r,n)=>new MerkleTree(r.map(Q),ge,{complete:!0,sort:!1,hashLeaves:!1,fillDefaultHash:Q(n)}),Or=(r,n,l=`0x${"ff".repeat(64)}`)=>concat([l,`0x${r.toString(16).padStart(6,"0")}`,AbiCoder.defaultAbiCoder().encode([`uint256[${n.length}]`],[n])]),Re=class{constructor(n,l,a,c,p){this.types=n;this.rootType=l;this.leafType=a;this.elements=c;this.depth=p;let o=TypedDataEncoder.from(n);this.encoder=o,this.leafHasher=h=>o.hashStruct(a,h),this.defaultNode=Z.from(n,a),this.defaultLeaf=this.leafHasher(this.defaultNode),this.tree=Ar(this.getCompleteLeaves(),this.defaultLeaf);}tree;leafHasher;defaultNode;defaultLeaf;encoder;get completedSize(){return 2**this.depth}getCompleteElements(){let{elements:n}=this;return pe([...n],this.completedSize,this.defaultNode)}getCompleteLeaves(){let n=this.elements.map(this.leafHasher);return pe([...n],this.completedSize,this.defaultLeaf)}get root(){return this.tree.getHexRoot()}getProof(n){let a=this.getCompleteLeaves()[n],c=this.tree.getHexProof(a,n),p=this.tree.getHexRoot();return {leaf:a,proof:c,root:p}}getEncodedProofAndSignature(n,l){let{proof:a}=this.getProof(n);return Or(n,a,l)}getDataToSign(){let n=this.getCompleteElements();for(;n.length>2;)n=Me(n,2);return n}add(n){this.elements.push(n);}getBulkOrderHash(){let n=this.encoder.hashStruct("BulkOrder",{tree:this.getDataToSign()}),l=this.getCompleteLeaves().map(Q),a=dt(mt(l,!1)),c=keccak256(toUtf8Bytes(this.encoder.types.BulkOrder[0].type));if(keccak256(concat([c,a]))!==n)throw new Error("expected derived bulk order hash to match");return n}};function _r(r){return {...Ee,BulkOrder:[{name:"tree",type:`OrderComponents${"[2]".repeat(r)}`}]}}function Br(r){return Math.max(Math.ceil(Math.log2(r)),1)}function yt(r,n=0,l=Br(r.length+n)){let a=_r(l),c=Z.from(a,"OrderComponents"),p=[...r];return n>0&&(p=[...pe([],n,c),...r]),new Re(a,"BulkOrder","OrderComponents",p,l)}function gt(r){if([0,1,2,3].includes(Number(r)))return Number(r);throw new Error(`Unknown order type ${r}`)}function Ie(r){if([0,1,2,3,4,5].includes(Number(r)))return Number(r);throw new Error(`Unknown item type ${r}`)}function Rt(r){let l=JSON.parse(r).message;return {...l,orderType:gt(l.orderType),salt:toBeHex(BigInt(l.salt)),offer:l.offer.map(a=>({...a,itemType:Ie(a.itemType)})),consideration:l.consideration.map(a=>({...a,itemType:Ie(a.itemType)}))}}function It(r){let n=JSON.parse(r);return {components:n.message.tree.flat(1/0).filter(a=>a.offerer!=="0x0000000000000000000000000000000000000000").map(a=>({...a,orderType:gt(a.orderType),salt:toBeHex(BigInt(a.salt)),offer:a.offer.map(c=>({...c,itemType:Ie(c.itemType)})),consideration:a.consideration.map(c=>({...c,itemType:Ie(c.itemType)}))})),types:n.types,value:n.message}}function Tt(r,n){let l=yt(n);return n.map((a,c)=>l.getEncodedProofAndSignature(c,r))}function br(r){switch(r.type){case"NATIVE":throw new Error("NATIVE items are not supported in the offer");case"ERC20":return {itemType:1 .valueOf(),token:r.contract_address,identifierOrCriteria:"0",startAmount:r.amount,endAmount:r.amount};case"ERC721":return {itemType:2 .valueOf(),token:r.contract_address,identifierOrCriteria:r.token_id,startAmount:"1",endAmount:"1"};case"ERC1155":return {itemType:3 .valueOf(),token:r.contract_address,identifierOrCriteria:r.token_id,startAmount:r.amount,endAmount:r.amount};case"ERC721_COLLECTION":throw new Error("ERC721_COLLECTION items are not supported in the offer");case"ERC1155_COLLECTION":throw new Error("ERC1155_COLLECTION items are not supported in the offer");default:return U()}}function Sr(r,n){switch(r.type){case"NATIVE":return {itemType:0 .valueOf(),startAmount:r.amount,endAmount:r.amount,token:ZeroAddress,identifierOrCriteria:"0",recipient:n};case"ERC20":return {itemType:1 .valueOf(),startAmount:r.amount,endAmount:r.amount,token:r.contract_address,identifierOrCriteria:"0",recipient:n};case"ERC721":return {itemType:2 .valueOf(),startAmount:"1",endAmount:"1",token:r.contract_address,identifierOrCriteria:r.token_id,recipient:n};case"ERC1155":return {itemType:3 .valueOf(),startAmount:r.amount,endAmount:r.amount,token:r.contract_address,identifierOrCriteria:r.token_id,recipient:n};case"ERC721_COLLECTION":return {itemType:4 .valueOf(),startAmount:r.amount,endAmount:r.amount,token:r.contract_address,identifierOrCriteria:"0",recipient:n};case"ERC1155_COLLECTION":return {itemType:5 .valueOf(),startAmount:r.amount,endAmount:r.amount,token:r.contract_address,identifierOrCriteria:"0",recipient:n};default:return U()}}function Ae(r){let n=r.sell.map(br),l=r.buy.map(o=>Sr(o,r.account_address)),a=function(o){switch(o){case H.type.LISTING:return l[0];case H.type.BID:case H.type.COLLECTION_BID:return n[0];default:return U()}}(r.type),c=function(o){switch(o){case V.order_type.FULL_RESTRICTED:return 2;case V.order_type.PARTIAL_RESTRICTED:return 3;default:return U()}}(r.protocol_data.order_type),p=r.fees.map(o=>({amount:o.amount,itemType:a.itemType,recipient:o.recipient_address,token:a.token,identifierOrCriteria:a.identifierOrCriteria}));return {orderComponents:{offerer:r.account_address,zone:r.protocol_data.zone_address,offer:n,consideration:l,orderType:c.valueOf(),startTime:Math.round(new Date(r.start_at).getTime()/1e3).toString(),endTime:Math.round(new Date(r.end_at).getTime()/1e3).toString(),zoneHash:ZeroHash,salt:r.salt,conduitKey:ZeroHash,counter:r.protocol_data.counter,totalOriginalConsiderationItems:l.length},tips:p}}function z(r,n,l){return async()=>{let a=await r.buildTransaction(),c={to:a.to,from:l,type:a.type,maxFeePerGas:a.maxFeePerGas?BigInt(a.maxFeePerGas):void 0,maxPriorityFeePerGas:a.maxPriorityFeePerGas?BigInt(a.maxPriorityFeePerGas):void 0,value:a.value?BigInt(a.value):void 0,data:a.data,nonce:a.nonce,chainId:n};return c.gasLimit=BigInt(await r.estimateGas()),c.gasLimit+=c.gasLimit/BigInt(5),c}}function Ot(r){switch(r.type){case"ERC20":return {token:r.contractAddress,amount:r.amount};case"ERC721":return {itemType:2 .valueOf(),token:r.contractAddress,identifier:r.tokenId};case"ERC1155":return {itemType:3 .valueOf(),token:r.contractAddress,identifier:r.tokenId,amount:r.amount};default:return U()}}function _t(r,n){switch(r.type){case"NATIVE":return {amount:r.amount,recipient:n};case"ERC20":return {token:r.contractAddress,amount:r.amount,recipient:n};case"ERC721":return {itemType:2 .valueOf(),token:r.contractAddress,identifier:r.tokenId,recipient:n};case"ERC1155":return {itemType:3 .valueOf(),token:r.contractAddress,identifier:r.tokenId,amount:r.amount,recipient:n};case"ERC721_COLLECTION":return {itemType:2 .valueOf(),token:r.contractAddress,amount:r.amount,identifiers:[],recipient:n};case"ERC1155_COLLECTION":return {itemType:3 .valueOf(),token:r.contractAddress,amount:r.amount,identifiers:[],recipient:n};default:return U()}}var Oe=class r{constructor(n,l,a,c,p){this.seaportLibFactory=n;this.provider=l;this.seaportContractAddress=a;this.zoneContractAddress=c;this.rateLimitingKey=p;}async prepareBulkSeaportOrders(n,l){let{actions:a}=await this.createSeaportOrders(n,l),c=a.filter(g=>g.type==="approval"),p=await this.provider.getNetwork(),o=c.map(g=>({type:"TRANSACTION",purpose:"APPROVAL",buildTransaction:z(g.transactionMethods,p.chainId,n)})),h=a.find(g=>g.type==="createBulk");if(!h)throw new Error("No create bulk order action found");let E=await h.getMessageToSign(),{components:f,types:y,value:R}=It(E);return o.push({type:"SIGNABLE",purpose:"CREATE_ORDER",message:await this.getTypedDataFromBulkOrderComponents(y,R)}),{actions:o,preparedOrders:f.map(g=>({orderComponents:g,orderHash:this.getSeaportLib().getOrderHash(g)}))}}async prepareSeaportOrder(n,l,a,c,p,o){let{actions:h}=await this.createSeaportOrder(n,l,a,c,p,o),E=[],f=h.find(C=>C.type==="approval");f&&E.push({type:"TRANSACTION",purpose:"APPROVAL",buildTransaction:z(f.transactionMethods,(await this.provider.getNetwork()).chainId,n)});let y=h.find(C=>C.type==="create");if(!y)throw new Error("No create order action found");let R=await y.getMessageToSign(),g=Rt(R);return E.push({type:"SIGNABLE",purpose:"CREATE_ORDER",message:await this.getTypedDataFromOrderComponents(g)}),{actions:E,orderComponents:g,orderHash:this.getSeaportLib().getOrderHash(g)}}async fulfillOrder(n,l,a,c,p){let{orderComponents:o,tips:h}=Ae(n),E=this.getSeaportLib(n),f=(await this.provider.getNetwork()).chainId,y={order:{parameters:o,signature:n.signature},unitsToFill:c,extraData:a,tips:h};p&&(y.considerationCriteria=p);let{actions:R}=await E.fulfillOrders({accountAddress:l,fulfillOrderDetails:[y]}),g=[],C=R.filter(_=>_.type==="approval");C.length>0&&C.forEach(_=>{g.push({type:"TRANSACTION",buildTransaction:z(_.transactionMethods,f,l),purpose:"APPROVAL"});});let I=R.find(_=>_.type==="exchange");if(!I)throw new Error("No exchange action found");return g.push({type:"TRANSACTION",buildTransaction:z(I.transactionMethods,f,l),purpose:"FULFILL_ORDER"}),{actions:g,expiration:r.getExpirationISOTimeFromExtraData(a),order:le(n)}}async fulfillBulkOrders(n,l){let a=n.map(f=>{let{orderComponents:y,tips:R}=Ae(f.order),g={order:{parameters:y,signature:f.order.signature},unitsToFill:f.unitsToFill,extraData:f.extraData,tips:R};return f.considerationCriteria&&f.considerationCriteria.length>0&&(g.considerationCriteria=f.considerationCriteria),g}),{actions:c}=await this.getSeaportLib().fulfillOrders({fulfillOrderDetails:a,accountAddress:l}),p=[],o=c.filter(f=>f.type==="approval"),h=(await this.provider.getNetwork()).chainId;o.length>0&&o.forEach(f=>{p.push({type:"TRANSACTION",buildTransaction:z(f.transactionMethods,h,l),purpose:"APPROVAL"});});let E=c.find(f=>f.type==="exchange");if(!E)throw new Error("No exchange action found");return p.push({type:"TRANSACTION",buildTransaction:z(E.transactionMethods,(await this.provider.getNetwork()).chainId,l),purpose:"FULFILL_ORDER"}),{actions:p,expiration:a.map(f=>r.getExpirationISOTimeFromExtraData(f.extraData)).reduce((f,y)=>new Date(f)<new Date(y)?f:y)}}async cancelOrders(n,l){let a=n.map(o=>Ae(o).orderComponents),p=await this.getSeaportLib(n[0]).cancelOrders(a,l);return {type:"TRANSACTION",buildTransaction:z(p,(await this.provider.getNetwork()).chainId,l),purpose:"CANCEL"}}createSeaportOrders(n,l){return this.getSeaportLib().createBulkOrders(l.map(c=>{let{offerItem:p,considerationItem:o,allowPartialFills:h,orderStart:E,orderExpiry:f}=c;return {allowPartialFills:h,offer:[Ot(p)],consideration:[_t(o,n)],startTime:(E.getTime()/1e3).toFixed(0),endTime:(f.getTime()/1e3).toFixed(0),zone:this.zoneContractAddress,restrictedByZone:!0}}),n)}createSeaportOrder(n,l,a,c,p,o){return this.getSeaportLib().createOrder({allowPartialFills:c,offer:[Ot(l)],consideration:[_t(a,n)],startTime:(p.getTime()/1e3).toFixed(0),endTime:(o.getTime()/1e3).toFixed(0),zone:this.zoneContractAddress,restrictedByZone:!0},n)}async getTypedDataFromBulkOrderComponents(n,l){delete n.EIP712Domain;let{chainId:a}=await this.provider.getNetwork();return {domain:{name:qe,version:Y,chainId:a,verifyingContract:this.seaportContractAddress},types:n,value:l}}async getTypedDataFromOrderComponents(n){let{chainId:l}=await this.provider.getNetwork();return {domain:{name:qe,version:Y,chainId:l,verifyingContract:this.seaportContractAddress},types:Ee,value:n}}getSeaportLib(n){let l=n?.protocol_data?.seaport_address??this.seaportContractAddress;return this.seaportLibFactory.create(l)}static getExpirationISOTimeFromExtraData(n){let l=n.slice(44,60),a=parseInt(l,16);return new Date(a*1e3).toISOString()}};function _e(r){switch(r.itemType){case 0:return {type:"NATIVE",amount:r.startAmount};case 1:return {type:"ERC20",contract_address:r.token,amount:r.startAmount};case 2:return {type:"ERC721",contract_address:r.token,token_id:r.identifierOrCriteria};case 3:return {type:"ERC1155",contract_address:r.token,token_id:r.identifierOrCriteria,amount:r.startAmount};case 4:return {type:"ERC721_COLLECTION",contract_address:r.token,amount:r.startAmount};case 5:return {type:"ERC1155_COLLECTION",contract_address:r.token,amount:r.startAmount};default:return U(r.itemType)}}function $e(r){if(r.itemType!==1)throw new Error(`Expected ERC20 item, got ${r.itemType}`);return {type:"ERC20",contract_address:r.token,amount:r.startAmount}}function Bt(r){switch(r.itemType){case 4:return {type:"ERC721_COLLECTION",contract_address:r.token,amount:r.startAmount};case 5:return {type:"ERC1155_COLLECTION",contract_address:r.token,amount:r.startAmount};case 1:case 0:case 2:case 3:throw new Error(`Unsupported item type ${r.itemType}`);default:return U(r.itemType)}}function Be(r){switch(r){case 2:return V.order_type.FULL_RESTRICTED;case 3:return V.order_type.PARTIAL_RESTRICTED;case 0:case 1:throw new Error(`Unsupported order type ${r}`);default:return U()}}var we=class{constructor(n,l,a){this.orderbookService=n;this.chainName=l;this.seaportAddress=a;}async fulfillmentData(n){return this.orderbookService.fulfillmentData({chainName:this.chainName,requestBody:n})}async getListing(n){return this.orderbookService.getListing({chainName:this.chainName,listingId:n})}async getBid(n){return this.orderbookService.getBid({chainName:this.chainName,bidId:n})}async getCollectionBid(n){return this.orderbookService.getCollectionBid({chainName:this.chainName,collectionBidId:n})}async getTrade(n){return this.orderbookService.getTrade({chainName:this.chainName,tradeId:n})}async listListings(n){return this.orderbookService.listListings({chainName:this.chainName,...n})}async listBids(n){return this.orderbookService.listBids({chainName:this.chainName,...n})}async listCollectionBids(n){return this.orderbookService.listCollectionBids({chainName:this.chainName,...n})}async listTrades(n){return this.orderbookService.listTrades({chainName:this.chainName,...n})}async cancelOrders(n,l,a){return this.orderbookService.cancelOrders({chainName:this.chainName,requestBody:{account_address:l,orders:n,signature:a}})}async createListing({orderHash:n,orderComponents:l,orderSignature:a,makerFees:c}){if(l.offer.length!==1)throw new Error("Only one item can be listed for a listing");if(l.consideration.length!==1)throw new Error("Only one item can be used as currency for a listing");if(![2,3].includes(l.offer[0].itemType))throw new Error("Only ERC721 / ERC1155 tokens can be listed");if(![0,1].includes(l.consideration[0].itemType))throw new Error("Only Native / ERC20 tokens can be used as currency items in a listing");return this.orderbookService.createListing({chainName:this.chainName,requestBody:{account_address:l.offerer,buy:l.consideration.map(_e),fees:c.map(p=>({type:v.type.MAKER_ECOSYSTEM,amount:p.amount,recipient_address:p.recipientAddress})),end_at:new Date(parseInt(`${l.endTime.toString()}000`,10)).toISOString(),order_hash:n,protocol_data:{order_type:Be(l.orderType),zone_address:l.zone,seaport_address:this.seaportAddress,seaport_version:Y,counter:l.counter.toString()},salt:l.salt,sell:l.offer.map(_e),signature:a,start_at:new Date(parseInt(`${l.startTime.toString()}000`,10)).toISOString()}})}async createBid({orderHash:n,orderComponents:l,orderSignature:a,makerFees:c}){if(l.offer.length!==1)throw new Error("Only one item can be listed for a bid");if(l.consideration.length!==1)throw new Error("Only one item can be used as currency for a bid");if(1!==l.offer[0].itemType)throw new Error("Only ERC20 tokens can be used as the currency item in a bid");if(![2,3].includes(l.consideration[0].itemType))throw new Error("Only ERC721 / ERC1155 tokens can be bid against");return this.orderbookService.createBid({chainName:this.chainName,requestBody:{account_address:l.offerer,buy:l.consideration.map(_e),fees:c.map(p=>({type:v.type.MAKER_ECOSYSTEM,amount:p.amount,recipient_address:p.recipientAddress})),end_at:new Date(parseInt(`${l.endTime.toString()}000`,10)).toISOString(),order_hash:n,protocol_data:{order_type:Be(l.orderType),zone_address:l.zone,seaport_address:this.seaportAddress,seaport_version:Y,counter:l.counter.toString()},salt:l.salt,sell:l.offer.map($e),signature:a,start_at:new Date(parseInt(`${l.startTime.toString()}000`,10)).toISOString()}})}async createCollectionBid({orderHash:n,orderComponents:l,orderSignature:a,makerFees:c}){if(l.offer.length!==1)throw new Error("Only one item can be listed for a collection bid");if(l.consideration.length!==1)throw new Error("Only one item can be used as currency for a collection bid");if(1!==l.offer[0].itemType)throw new Error("Only ERC20 tokens can be used as the currency item in a collection bid");if(![4,5].includes(l.consideration[0].itemType))throw new Error("Only ERC721 / ERC1155 collection based tokens can be bid against");return this.orderbookService.createCollectionBid({chainName:this.chainName,requestBody:{account_address:l.offerer,buy:l.consideration.map(Bt),fees:c.map(p=>({type:v.type.MAKER_ECOSYSTEM,amount:p.amount,recipient_address:p.recipientAddress})),end_at:new Date(parseInt(`${l.endTime.toString()}000`,10)).toISOString(),order_hash:n,protocol_data:{order_type:Be(l.orderType),zone_address:l.zone,seaport_address:this.seaportAddress,seaport_version:Y,counter:l.counter.toString()},salt:l.salt,sell:l.offer.map($e),signature:a,start_at:new Date(parseInt(`${l.startTime.toString()}000`,10)).toISOString()}})}};var be=class{constructor(n,l,a,c){this.chainName=l;this.seaportAddress=a;this.orderbookClient=new oe({BASE:n,HEADERS:c?{"x-api-key":c}:void 0});}orderbookClient;create(){return new we(this.orderbookClient.orders,this.chainName,this.seaportAddress)}};var Pr="imtbl-zkevm-testnet",Nr="imtbl-zkevm-mainnet";function Se(r,n){let l=new FetchRequest(r);return n&&l.setHeader("x-api-key",n),new JsonRpcProvider(l)}function bt(r){switch(r.baseConfig.environment){case Environment.SANDBOX:return {seaportContractAddress:"0x7d117aA8BD6D31c4fa91722f246388f38ab1942c",zoneContractAddress:"0x1004f9615E79462c711Ff05a386BdbA91a7628C3",apiEndpoint:"https://api.sandbox.immutable.com",chainName:Pr,provider:Se("https://rpc.testnet.immutable.com",r.baseConfig.rateLimitingKey)};case Environment.PRODUCTION:return {seaportContractAddress:"0x6c12aD6F0bD274191075Eb2E78D7dA5ba6453424",zoneContractAddress:"0x1004f9615E79462c711Ff05a386BdbA91a7628C3",apiEndpoint:"https://api.immutable.com",chainName:Nr,provider:Se("https://rpc.immutable.com",r.baseConfig.rateLimitingKey)};default:return null}}var Le=class{constructor(n,l){this.defaultSeaportContractAddress=n;this.provider=l;}create(n){let l=n??this.defaultSeaportContractAddress,a=this.provider;return a.getSigner=async function(p){p==null&&(p=0);let o=this.send("eth_accounts",[]);if(typeof p=="number"){let h=await o;if(p>=h.length)throw new Error("no such account");return new JsonRpcSigner(this,h[p])}return new JsonRpcSigner(this,p)},new Seaport(a,{balanceAndApprovalChecksOnOrderCreation:!0,overrides:{contractAddress:l}})}};var Ve=class r{apiClient;seaport;orderbookConfig;constructor(n){let a={...bt(n),...n.overrides};if(n.overrides?.jsonRpcProviderUrl&&(a.provider=Se(n.overrides?.jsonRpcProviderUrl,n.baseConfig.rateLimitingKey)),!a)throw new Error("Orderbook configuration not passed, please specify the environment under config.baseConfig.environment");this.orderbookConfig=a;let{apiEndpoint:c,chainName:p}=this.orderbookConfig;if(!c)throw new Error("API endpoint must be provided");this.apiClient=new be(c,p,this.orderbookConfig.seaportContractAddress,n.baseConfig.rateLimitingKey).create();let o=new Le(this.orderbookConfig.seaportContractAddress,this.orderbookConfig.provider);this.seaport=new Oe(o,this.orderbookConfig.provider,this.orderbookConfig.seaportContractAddress,this.orderbookConfig.zoneContractAddress,n.baseConfig.rateLimitingKey);}static defaultOrderExpiry(){return new Date(Date.now()+1e3*60*60*24*365*2)}config(){return this.orderbookConfig}async getListing(n){let l=await this.apiClient.getListing(n);return {result:W(l.result)}}async getBid(n){let l=await this.apiClient.getBid(n);return {result:se(l.result)}}async getCollectionBid(n){let l=await this.apiClient.getCollectionBid(n);return {result:ae(l.result)}}async getTrade(n){let l=await this.apiClient.getTrade(n);return {result:Fe(l.result)}}async listListings(n){let l=await this.apiClient.listListings(n);return {page:ue(l.page),result:l.result.map(W)}}async listBids(n){let l=await this.apiClient.listBids(n);return {page:ue(l.page),result:l.result.map(se)}}async listCollectionBids(n){let l=await this.apiClient.listCollectionBids(n);return {page:ue(l.page),result:l.result.map(ae)}}async listTrades(n){let l=await this.apiClient.listTrades(n);return {page:ue(l.page),result:l.result.map(Fe)}}async prepareBulkListings({makerAddress:n,listingParams:l}){if(l.length>20)throw new Error("Bulk listing creation is limited to 20 orders");if(l.length===1){let o=await this.seaport.prepareSeaportOrder(n,l[0].sell,l[0].buy,l[0].sell.type==="ERC1155",l[0].orderStart||new Date,l[0].orderExpiry||r.defaultOrderExpiry());return {actions:o.actions,completeListings:async h=>{let E=await this.createListing({makerFees:l[0].makerFees,orderComponents:o.orderComponents,orderHash:o.orderHash,orderSignature:typeof h=="string"?h:h[0]});return {result:[{success:!0,orderHash:o.orderHash,order:E.result}]}}}}if(await this.orderbookConfig.provider.getCode(n)!=="0x"){track("orderbookmr","bulkListings",{walletType:"Passport",makerAddress:n,listingsCount:l.length});let o=await Promise.all(l.map(f=>this.seaport.prepareSeaportOrder(n,f.sell,f.buy,f.sell.type==="ERC1155",f.orderStart||new Date,f.orderExpiry||r.defaultOrderExpiry()))),h=[];return {actions:o.flatMap(f=>{let y=[];return f.actions.forEach(R=>{if(R.type==="TRANSACTION"){let g=f.orderComponents.offer[0].token;h.includes(g)||(h.push(g),y.push(R));}else y.push(R);}),y}),completeListings:async f=>{if(typeof f=="string")throw new Error("A signature per listing must be provided for smart contract wallets");return {result:(await Promise.all(o.map((g,C)=>{let I=f[C];return this.apiClient.createListing({makerFees:l[C].makerFees,orderComponents:g.orderComponents,orderHash:g.orderHash,orderSignature:I}).catch(()=>{})}))).map((g,C)=>({success:!!g,orderHash:o[C].orderHash,order:g?W(g.result):void 0}))}}}}track("orderbookmr","bulkListings",{walletType:"EOA",makerAddress:n,listingsCount:l.length});let{actions:c,preparedOrders:p}=await this.seaport.prepareBulkSeaportOrders(n,l.map(o=>({offerItem:o.sell,considerationItem:o.buy,allowPartialFills:o.sell.type==="ERC1155",orderStart:o.orderStart||new Date,orderExpiry:o.orderExpiry||r.defaultOrderExpiry()})));return {actions:c,completeListings:async o=>{let h=typeof o=="object";if(h&&o.length!==1)throw new Error("Only a single signature is expected for bulk listing creation");let E=p.map(g=>g.orderComponents),f=h?o[0]:o,y=Tt(f,E);return {result:(await Promise.all(E.map((g,C)=>{let I=y[C],_=p[C],L=l[C];return this.apiClient.createListing({orderComponents:g,orderHash:_.orderHash,orderSignature:I,makerFees:L.makerFees}).catch(()=>{})}))).map((g,C)=>({success:!!g,orderHash:p[C].orderHash,order:g?W(g.result):void 0}))}}}}async prepareListing({makerAddress:n,sell:l,buy:a,orderStart:c,orderExpiry:p}){return this.seaport.prepareSeaportOrder(n,l,a,l.type==="ERC1155",c||new Date,p||r.defaultOrderExpiry())}async createListing(n){let l=await this.apiClient.createListing(n);return {result:W(l.result)}}async prepareBid({makerAddress:n,sell:l,buy:a,orderStart:c,orderExpiry:p}){return this.seaport.prepareSeaportOrder(n,l,a,a.type==="ERC1155",c||new Date,p||r.defaultOrderExpiry())}async createBid(n){let l=await this.apiClient.createBid(n);return {result:se(l.result)}}async prepareCollectionBid({makerAddress:n,sell:l,buy:a,orderStart:c,orderExpiry:p}){return this.seaport.prepareSeaportOrder(n,l,a,!0,c||new Date,p||r.defaultOrderExpiry())}async createCollectionBid(n){let l=await this.apiClient.createCollectionBid(n);return {result:ae(l.result)}}async fulfillOrder(n,l,a,c,p){let o={order_id:n,taker_address:l,fees:a.map(R=>({type:v.type.TAKER_ECOSYSTEM,amount:R.amount,recipient_address:R.recipientAddress}))},h=p?[{identifier:p,proof:[]}]:void 0;p&&(o.token_id=p);let E=await this.apiClient.fulfillmentData([o]);if(E.result.unfulfillable_orders?.length>0)throw new Error(`Unable to prepare fulfillment data: ${E.result.unfulfillable_orders[0].reason}`);if(E.result.fulfillable_orders?.length!==1)throw new Error("unexpected fulfillable order result length");let f=E.result.fulfillable_orders[0].extra_data,y=E.result.fulfillable_orders[0].order;if(y.status.name!=="ACTIVE")throw new Error(`Cannot fulfil order that is not active. Current status: ${y.status}`);return this.seaport.fulfillOrder(y,l,f,c,h)}async fulfillBulkOrders(n,l){let a=n.map(p=>{let o="listingId"in p;return {orderId:o?p.listingId:p.orderId,takerFees:p.takerFees,amountToFill:p.amountToFill,tokenId:o?void 0:p.tokenId}}),c=await this.apiClient.fulfillmentData(a.map(p=>({order_id:p.orderId,taker_address:l,fees:p.takerFees.map(o=>({type:v.type.TAKER_ECOSYSTEM,amount:o.amount,recipient_address:o.recipientAddress})),token_id:p?.tokenId})));try{let p=c.result.fulfillable_orders.map(o=>{let h=a.find(f=>f.orderId===o.order.id&&f.tokenId===o.token_id);if(!h){let f=`Could not find order for order ${o.order.id}`;throw o.token_id&&(f+=` and token ID ${o.token_id}`),new Error(f)}let E=[];return h.tokenId&&E.push({identifier:h.tokenId,proof:[]}),{extraData:o.extra_data,order:o.order,unitsToFill:h.amountToFill,considerationCriteria:E}});return {...await this.seaport.fulfillBulkOrders(p,l),fulfillableOrders:c.result.fulfillable_orders.map(o=>le(o.order)),unfulfillableOrders:c.result.unfulfillable_orders.map(o=>({orderId:o.order_id,tokenId:o.token_id,reason:o.reason})),sufficientBalance:!0}}catch(p){if(String(p).includes("The fulfiller does not have the balances needed to fulfill."))return {fulfillableOrders:c.result.fulfillable_orders.map(o=>le(o.order)),unfulfillableOrders:c.result.unfulfillable_orders.map(o=>({orderId:o.order_id,reason:o.reason})),sufficientBalance:!1};throw p}}async prepareOrderCancellations(n){let l=await this.orderbookConfig.provider.getNetwork(),a={name:"imtbl-order-book",chainId:Number(l.chainId),verifyingContract:this.orderbookConfig.seaportContractAddress},c={CancelPayload:[{name:"orders",type:"Order[]"}],Order:[{name:"id",type:"string"}]},p={orders:n.map(o=>({id:o}))};return {signableAction:{purpose:"OFF_CHAIN_CANCELLATION",type:"SIGNABLE",message:{domain:a,types:c,value:p}}}}async cancelOrders(n,l,a){return this.apiClient.cancelOrders(n,l,a)}async cancelOrdersOnChain(n,l){let a=Promise.all(n.map(y=>this.apiClient.getListing(y).catch(R=>{if(R.status!==404)throw R}))),c=Promise.all(n.map(y=>this.apiClient.getBid(y).catch(R=>{if(R.status!==404)throw R}))),p=Promise.all(n.map(y=>this.apiClient.getCollectionBid(y).catch(R=>{if(R.status!==404)throw R}))),o=[await Promise.all([a,c,p])].flat(2).filter(y=>y!==void 0).map(y=>y.result);if(o.length!==n.length){let y=n.filter(R=>!o.some(g=>g.id===R));throw new Error(`Orders ${y} not found`)}for(let y of o)if(y.account_address!==l.toLowerCase())throw new Error(`Only account ${y.account_address} can cancel order ${y.id}`);let h=o.map(y=>y.protocol_data.seaport_address);if(new Set(h).size!==1)throw new Error("Cannot cancel multiple orders from different seaport contracts. Please group your orderIds accordingly");return {cancellationAction:await this.seaport.cancelOrders(o,l)}}};var Dr={estimatedFulfillmentGasGwei:4e5};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
9
|
+
var re={},it=!1;function Jt(){if(it)return re;it=!0,re.byteLength=f,re.toByteArray=h,re.fromByteArray=y;for(var r=[],i=[],s=typeof Uint8Array<"u"?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,u=a.length;p<u;++p)r[p]=a[p],i[a.charCodeAt(p)]=p;i[45]=62,i[95]=63;function o(C){var I=C.length;if(I%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var _=C.indexOf("=");_===-1&&(_=I);var S=_===I?0:4-_%4;return [_,S]}function f(C){var I=o(C),_=I[0],S=I[1];return (_+S)*3/4-S}function E(C,I,_){return (I+_)*3/4-_}function h(C){var I,_=o(C),S=_[0],F=_[1],P=new s(E(C,S,F)),v=0,H=F>0?S-4:S,k;for(k=0;k<H;k+=4)I=i[C.charCodeAt(k)]<<18|i[C.charCodeAt(k+1)]<<12|i[C.charCodeAt(k+2)]<<6|i[C.charCodeAt(k+3)],P[v++]=I>>16&255,P[v++]=I>>8&255,P[v++]=I&255;return F===2&&(I=i[C.charCodeAt(k)]<<2|i[C.charCodeAt(k+1)]>>4,P[v++]=I&255),F===1&&(I=i[C.charCodeAt(k)]<<10|i[C.charCodeAt(k+1)]<<4|i[C.charCodeAt(k+2)]>>2,P[v++]=I>>8&255,P[v++]=I&255),P}function g(C){return r[C>>18&63]+r[C>>12&63]+r[C>>6&63]+r[C&63]}function R(C,I,_){for(var S,F=[],P=I;P<_;P+=3)S=(C[P]<<16&16711680)+(C[P+1]<<8&65280)+(C[P+2]&255),F.push(g(S));return F.join("")}function y(C){for(var I,_=C.length,S=_%3,F=[],P=16383,v=0,H=_-S;v<H;v+=P)F.push(R(C,v,v+P>H?H:v+P));return S===1?(I=C[_-1],F.push(r[I>>2]+r[I<<4&63]+"==")):S===2&&(I=(C[_-2]<<8)+C[_-1],F.push(r[I>>10]+r[I>>4&63]+r[I<<2&63]+"=")),F.join("")}return re}var fe={},nt=!1;function Xt(){if(nt)return fe;nt=!0;return fe.read=function(r,i,s,a,p){var u,o,f=p*8-a-1,E=(1<<f)-1,h=E>>1,g=-7,R=s?p-1:0,y=s?-1:1,C=r[i+R];for(R+=y,u=C&(1<<-g)-1,C>>=-g,g+=f;g>0;u=u*256+r[i+R],R+=y,g-=8);for(o=u&(1<<-g)-1,u>>=-g,g+=a;g>0;o=o*256+r[i+R],R+=y,g-=8);if(u===0)u=1-h;else {if(u===E)return o?NaN:(C?-1:1)*(1/0);o=o+Math.pow(2,a),u=u-h;}return (C?-1:1)*o*Math.pow(2,u-a)},fe.write=function(r,i,s,a,p,u){var o,f,E,h=u*8-p-1,g=(1<<h)-1,R=g>>1,y=p===23?Math.pow(2,-24)-Math.pow(2,-77):0,C=a?0:u-1,I=a?1:-1,_=i<0||i===0&&1/i<0?1:0;for(i=Math.abs(i),isNaN(i)||i===1/0?(f=isNaN(i)?1:0,o=g):(o=Math.floor(Math.log(i)/Math.LN2),i*(E=Math.pow(2,-o))<1&&(o--,E*=2),o+R>=1?i+=y/E:i+=y*Math.pow(2,1-R),i*E>=2&&(o++,E/=2),o+R>=g?(f=0,o=g):o+R>=1?(f=(i*E-1)*Math.pow(2,p),o=o+R):(f=i*Math.pow(2,R-1)*Math.pow(2,p),o=0));p>=8;r[s+C]=f&255,C+=I,f/=256,p-=8);for(o=o<<p|f,h+=p;h>0;r[s+C]=o&255,C+=I,o/=256,h-=8);r[s+C-I]|=_*128;},fe}var j={},ot=!1;function Zt(){if(ot)return j;ot=!0;let r=Jt(),i=Xt(),s=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;j.Buffer=o,j.SlowBuffer=F,j.INSPECT_MAX_BYTES=50;let a=2147483647;j.kMaxLength=a,o.TYPED_ARRAY_SUPPORT=p(),!o.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function p(){try{let n=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(n,e),n.foo()===42}catch{return !1}}Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}});function u(n){if(n>a)throw new RangeError('The value "'+n+'" is invalid for option "size"');let e=new Uint8Array(n);return Object.setPrototypeOf(e,o.prototype),e}function o(n,e,t){if(typeof n=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return g(n)}return f(n,e,t)}o.poolSize=8192;function f(n,e,t){if(typeof n=="string")return R(n,e);if(ArrayBuffer.isView(n))return C(n);if(n==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof n);if(M(n,ArrayBuffer)||n&&M(n.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(M(n,SharedArrayBuffer)||n&&M(n.buffer,SharedArrayBuffer)))return I(n,e,t);if(typeof n=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let l=n.valueOf&&n.valueOf();if(l!=null&&l!==n)return o.from(l,e,t);let d=_(n);if(d)return d;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof n[Symbol.toPrimitive]=="function")return o.from(n[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof n)}o.from=function(n,e,t){return f(n,e,t)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function E(n){if(typeof n!="number")throw new TypeError('"size" argument must be of type number');if(n<0)throw new RangeError('The value "'+n+'" is invalid for option "size"')}function h(n,e,t){return E(n),n<=0?u(n):e!==void 0?typeof t=="string"?u(n).fill(e,t):u(n).fill(e):u(n)}o.alloc=function(n,e,t){return h(n,e,t)};function g(n){return E(n),u(n<0?0:S(n)|0)}o.allocUnsafe=function(n){return g(n)},o.allocUnsafeSlow=function(n){return g(n)};function R(n,e){if((typeof e!="string"||e==="")&&(e="utf8"),!o.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=P(n,e)|0,l=u(t),d=l.write(n,e);return d!==t&&(l=l.slice(0,d)),l}function y(n){let e=n.length<0?0:S(n.length)|0,t=u(e);for(let l=0;l<e;l+=1)t[l]=n[l]&255;return t}function C(n){if(M(n,Uint8Array)){let e=new Uint8Array(n);return I(e.buffer,e.byteOffset,e.byteLength)}return y(n)}function I(n,e,t){if(e<0||n.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(n.byteLength<e+(t||0))throw new RangeError('"length" is outside of buffer bounds');let l;return e===void 0&&t===void 0?l=new Uint8Array(n):t===void 0?l=new Uint8Array(n,e):l=new Uint8Array(n,e,t),Object.setPrototypeOf(l,o.prototype),l}function _(n){if(o.isBuffer(n)){let e=S(n.length)|0,t=u(e);return t.length===0||n.copy(t,0,0,e),t}if(n.length!==void 0)return typeof n.length!="number"||De(n.length)?u(0):y(n);if(n.type==="Buffer"&&Array.isArray(n.data))return y(n.data)}function S(n){if(n>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return n|0}function F(n){return +n!=n&&(n=0),o.alloc(+n)}o.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==o.prototype},o.compare=function(e,t){if(M(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),M(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let l=e.length,d=t.length;for(let c=0,m=Math.min(l,d);c<m;++c)if(e[c]!==t[c]){l=e[c],d=t[c];break}return l<d?-1:d<l?1:0},o.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return !0;default:return !1}},o.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return o.alloc(0);let l;if(t===void 0)for(t=0,l=0;l<e.length;++l)t+=e[l].length;let d=o.allocUnsafe(t),c=0;for(l=0;l<e.length;++l){let m=e[l];if(M(m,Uint8Array))c+m.length>d.length?(o.isBuffer(m)||(m=o.from(m)),m.copy(d,c)):Uint8Array.prototype.set.call(d,m,c);else if(o.isBuffer(m))m.copy(d,c);else throw new TypeError('"list" argument must be an Array of Buffers');c+=m.length;}return d};function P(n,e){if(o.isBuffer(n))return n.length;if(ArrayBuffer.isView(n)||M(n,ArrayBuffer))return n.byteLength;if(typeof n!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof n);let t=n.length,l=arguments.length>2&&arguments[2]===!0;if(!l&&t===0)return 0;let d=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return ke(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return rt(n).length;default:if(d)return l?-1:ke(n).length;e=(""+e).toLowerCase(),d=!0;}}o.byteLength=P;function v(n,e,t){let l=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return "";for(n||(n="utf8");;)switch(n){case"hex":return Mt(this,e,t);case"utf8":case"utf-8":return We(this,e,t);case"ascii":return Ut(this,e,t);case"latin1":case"binary":return Ht(this,e,t);case"base64":return vt(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $t(this,e,t);default:if(l)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),l=!0;}}o.prototype._isBuffer=!0;function H(n,e,t){let l=n[e];n[e]=n[t],n[t]=l;}o.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)H(this,t,t+1);return this},o.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)H(this,t,t+3),H(this,t+1,t+2);return this},o.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)H(this,t,t+7),H(this,t+1,t+6),H(this,t+2,t+5),H(this,t+3,t+4);return this},o.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?We(this,0,e):v.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(e){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:o.compare(this,e)===0},o.prototype.inspect=function(){let e="",t=j.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},s&&(o.prototype[s]=o.prototype.inspect),o.prototype.compare=function(e,t,l,d,c){if(M(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),l===void 0&&(l=e?e.length:0),d===void 0&&(d=0),c===void 0&&(c=this.length),t<0||l>e.length||d<0||c>this.length)throw new RangeError("out of range index");if(d>=c&&t>=l)return 0;if(d>=c)return -1;if(t>=l)return 1;if(t>>>=0,l>>>=0,d>>>=0,c>>>=0,this===e)return 0;let m=c-d,A=l-t,b=Math.min(m,A),w=this.slice(d,c),L=e.slice(t,l);for(let B=0;B<b;++B)if(w[B]!==L[B]){m=w[B],A=L[B];break}return m<A?-1:A<m?1:0};function k(n,e,t,l,d){if(n.length===0)return -1;if(typeof t=="string"?(l=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,De(t)&&(t=d?0:n.length-1),t<0&&(t=n.length+t),t>=n.length){if(d)return -1;t=n.length-1;}else if(t<0)if(d)t=0;else return -1;if(typeof e=="string"&&(e=o.from(e,l)),o.isBuffer(e))return e.length===0?-1:je(n,e,t,l,d);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?d?Uint8Array.prototype.indexOf.call(n,e,t):Uint8Array.prototype.lastIndexOf.call(n,e,t):je(n,[e],t,l,d);throw new TypeError("val must be string, number or Buffer")}function je(n,e,t,l,d){let c=1,m=n.length,A=e.length;if(l!==void 0&&(l=String(l).toLowerCase(),l==="ucs2"||l==="ucs-2"||l==="utf16le"||l==="utf-16le")){if(n.length<2||e.length<2)return -1;c=2,m/=2,A/=2,t/=2;}function b(L,B){return c===1?L[B]:L.readUInt16BE(B*c)}let w;if(d){let L=-1;for(w=t;w<m;w++)if(b(n,w)===b(e,L===-1?0:w-L)){if(L===-1&&(L=w),w-L+1===A)return L*c}else L!==-1&&(w-=w-L),L=-1;}else for(t+A>m&&(t=m-A),w=t;w>=0;w--){let L=!0;for(let B=0;B<A;B++)if(b(n,w+B)!==b(e,B)){L=!1;break}if(L)return w}return -1}o.prototype.includes=function(e,t,l){return this.indexOf(e,t,l)!==-1},o.prototype.indexOf=function(e,t,l){return k(this,e,t,l,!0)},o.prototype.lastIndexOf=function(e,t,l){return k(this,e,t,l,!1)};function xt(n,e,t,l){t=Number(t)||0;let d=n.length-t;l?(l=Number(l),l>d&&(l=d)):l=d;let c=e.length;l>c/2&&(l=c/2);let m;for(m=0;m<l;++m){let A=parseInt(e.substr(m*2,2),16);if(De(A))return m;n[t+m]=A;}return m}function Nt(n,e,t,l){return me(ke(e,n.length-t),n,t,l)}function kt(n,e,t,l){return me(jt(e),n,t,l)}function Dt(n,e,t,l){return me(rt(e),n,t,l)}function Ft(n,e,t,l){return me(Wt(e,n.length-t),n,t,l)}o.prototype.write=function(e,t,l,d){if(t===void 0)d="utf8",l=this.length,t=0;else if(l===void 0&&typeof t=="string")d=t,l=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(l)?(l=l>>>0,d===void 0&&(d="utf8")):(d=l,l=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let c=this.length-t;if((l===void 0||l>c)&&(l=c),e.length>0&&(l<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");d||(d="utf8");let m=!1;for(;;)switch(d){case"hex":return xt(this,e,t,l);case"utf8":case"utf-8":return Nt(this,e,t,l);case"ascii":case"latin1":case"binary":return kt(this,e,t,l);case"base64":return Dt(this,e,t,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ft(this,e,t,l);default:if(m)throw new TypeError("Unknown encoding: "+d);d=(""+d).toLowerCase(),m=!0;}},o.prototype.toJSON=function(){return {type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function vt(n,e,t){return e===0&&t===n.length?r.fromByteArray(n):r.fromByteArray(n.slice(e,t))}function We(n,e,t){t=Math.min(n.length,t);let l=[],d=e;for(;d<t;){let c=n[d],m=null,A=c>239?4:c>223?3:c>191?2:1;if(d+A<=t){let b,w,L,B;switch(A){case 1:c<128&&(m=c);break;case 2:b=n[d+1],(b&192)===128&&(B=(c&31)<<6|b&63,B>127&&(m=B));break;case 3:b=n[d+1],w=n[d+2],(b&192)===128&&(w&192)===128&&(B=(c&15)<<12|(b&63)<<6|w&63,B>2047&&(B<55296||B>57343)&&(m=B));break;case 4:b=n[d+1],w=n[d+2],L=n[d+3],(b&192)===128&&(w&192)===128&&(L&192)===128&&(B=(c&15)<<18|(b&63)<<12|(w&63)<<6|L&63,B>65535&&B<1114112&&(m=B));}}m===null?(m=65533,A=1):m>65535&&(m-=65536,l.push(m>>>10&1023|55296),m=56320|m&1023),l.push(m),d+=A;}return qt(l)}let Ye=4096;function qt(n){let e=n.length;if(e<=Ye)return String.fromCharCode.apply(String,n);let t="",l=0;for(;l<e;)t+=String.fromCharCode.apply(String,n.slice(l,l+=Ye));return t}function Ut(n,e,t){let l="";t=Math.min(n.length,t);for(let d=e;d<t;++d)l+=String.fromCharCode(n[d]&127);return l}function Ht(n,e,t){let l="";t=Math.min(n.length,t);for(let d=e;d<t;++d)l+=String.fromCharCode(n[d]);return l}function Mt(n,e,t){let l=n.length;(!e||e<0)&&(e=0),(!t||t<0||t>l)&&(t=l);let d="";for(let c=e;c<t;++c)d+=Yt[n[c]];return d}function $t(n,e,t){let l=n.slice(e,t),d="";for(let c=0;c<l.length-1;c+=2)d+=String.fromCharCode(l[c]+l[c+1]*256);return d}o.prototype.slice=function(e,t){let l=this.length;e=~~e,t=t===void 0?l:~~t,e<0?(e+=l,e<0&&(e=0)):e>l&&(e=l),t<0?(t+=l,t<0&&(t=0)):t>l&&(t=l),t<e&&(t=e);let d=this.subarray(e,t);return Object.setPrototypeOf(d,o.prototype),d};function x(n,e,t){if(n%1!==0||n<0)throw new RangeError("offset is not uint");if(n+e>t)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(e,t,l){e=e>>>0,t=t>>>0,l||x(e,t,this.length);let d=this[e],c=1,m=0;for(;++m<t&&(c*=256);)d+=this[e+m]*c;return d},o.prototype.readUintBE=o.prototype.readUIntBE=function(e,t,l){e=e>>>0,t=t>>>0,l||x(e,t,this.length);let d=this[e+--t],c=1;for(;t>0&&(c*=256);)d+=this[e+--t]*c;return d},o.prototype.readUint8=o.prototype.readUInt8=function(e,t){return e=e>>>0,t||x(e,1,this.length),this[e]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||x(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||x(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||x(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||x(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readBigUInt64LE=$(function(e){e=e>>>0,J(e,"offset");let t=this[e],l=this[e+7];(t===void 0||l===void 0)&&te(e,this.length-8);let d=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,c=this[++e]+this[++e]*2**8+this[++e]*2**16+l*2**24;return BigInt(d)+(BigInt(c)<<BigInt(32))}),o.prototype.readBigUInt64BE=$(function(e){e=e>>>0,J(e,"offset");let t=this[e],l=this[e+7];(t===void 0||l===void 0)&&te(e,this.length-8);let d=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],c=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+l;return (BigInt(d)<<BigInt(32))+BigInt(c)}),o.prototype.readIntLE=function(e,t,l){e=e>>>0,t=t>>>0,l||x(e,t,this.length);let d=this[e],c=1,m=0;for(;++m<t&&(c*=256);)d+=this[e+m]*c;return c*=128,d>=c&&(d-=Math.pow(2,8*t)),d},o.prototype.readIntBE=function(e,t,l){e=e>>>0,t=t>>>0,l||x(e,t,this.length);let d=t,c=1,m=this[e+--d];for(;d>0&&(c*=256);)m+=this[e+--d]*c;return c*=128,m>=c&&(m-=Math.pow(2,8*t)),m},o.prototype.readInt8=function(e,t){return e=e>>>0,t||x(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},o.prototype.readInt16LE=function(e,t){e=e>>>0,t||x(e,2,this.length);let l=this[e]|this[e+1]<<8;return l&32768?l|4294901760:l},o.prototype.readInt16BE=function(e,t){e=e>>>0,t||x(e,2,this.length);let l=this[e+1]|this[e]<<8;return l&32768?l|4294901760:l},o.prototype.readInt32LE=function(e,t){return e=e>>>0,t||x(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e=e>>>0,t||x(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readBigInt64LE=$(function(e){e=e>>>0,J(e,"offset");let t=this[e],l=this[e+7];(t===void 0||l===void 0)&&te(e,this.length-8);let d=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(l<<24);return (BigInt(d)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),o.prototype.readBigInt64BE=$(function(e){e=e>>>0,J(e,"offset");let t=this[e],l=this[e+7];(t===void 0||l===void 0)&&te(e,this.length-8);let d=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return (BigInt(d)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+l)}),o.prototype.readFloatLE=function(e,t){return e=e>>>0,t||x(e,4,this.length),i.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e=e>>>0,t||x(e,4,this.length),i.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||x(e,8,this.length),i.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||x(e,8,this.length),i.read(this,e,!1,52,8)};function q(n,e,t,l,d,c){if(!o.isBuffer(n))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>d||e<c)throw new RangeError('"value" argument is out of bounds');if(t+l>n.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(e,t,l,d){if(e=+e,t=t>>>0,l=l>>>0,!d){let A=Math.pow(2,8*l)-1;q(this,e,t,l,A,0);}let c=1,m=0;for(this[t]=e&255;++m<l&&(c*=256);)this[t+m]=e/c&255;return t+l},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(e,t,l,d){if(e=+e,t=t>>>0,l=l>>>0,!d){let A=Math.pow(2,8*l)-1;q(this,e,t,l,A,0);}let c=l-1,m=1;for(this[t+c]=e&255;--c>=0&&(m*=256);)this[t+c]=e/m&255;return t+l},o.prototype.writeUint8=o.prototype.writeUInt8=function(e,t,l){return e=+e,t=t>>>0,l||q(this,e,t,1,255,0),this[t]=e&255,t+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(e,t,l){return e=+e,t=t>>>0,l||q(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(e,t,l){return e=+e,t=t>>>0,l||q(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(e,t,l){return e=+e,t=t>>>0,l||q(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(e,t,l){return e=+e,t=t>>>0,l||q(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function Ke(n,e,t,l,d){tt(e,l,d,n,t,7);let c=Number(e&BigInt(4294967295));n[t++]=c,c=c>>8,n[t++]=c,c=c>>8,n[t++]=c,c=c>>8,n[t++]=c;let m=Number(e>>BigInt(32)&BigInt(4294967295));return n[t++]=m,m=m>>8,n[t++]=m,m=m>>8,n[t++]=m,m=m>>8,n[t++]=m,t}function Je(n,e,t,l,d){tt(e,l,d,n,t,7);let c=Number(e&BigInt(4294967295));n[t+7]=c,c=c>>8,n[t+6]=c,c=c>>8,n[t+5]=c,c=c>>8,n[t+4]=c;let m=Number(e>>BigInt(32)&BigInt(4294967295));return n[t+3]=m,m=m>>8,n[t+2]=m,m=m>>8,n[t+1]=m,m=m>>8,n[t]=m,t+8}o.prototype.writeBigUInt64LE=$(function(e,t=0){return Ke(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=$(function(e,t=0){return Je(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(e,t,l,d){if(e=+e,t=t>>>0,!d){let b=Math.pow(2,8*l-1);q(this,e,t,l,b-1,-b);}let c=0,m=1,A=0;for(this[t]=e&255;++c<l&&(m*=256);)e<0&&A===0&&this[t+c-1]!==0&&(A=1),this[t+c]=(e/m>>0)-A&255;return t+l},o.prototype.writeIntBE=function(e,t,l,d){if(e=+e,t=t>>>0,!d){let b=Math.pow(2,8*l-1);q(this,e,t,l,b-1,-b);}let c=l-1,m=1,A=0;for(this[t+c]=e&255;--c>=0&&(m*=256);)e<0&&A===0&&this[t+c+1]!==0&&(A=1),this[t+c]=(e/m>>0)-A&255;return t+l},o.prototype.writeInt8=function(e,t,l){return e=+e,t=t>>>0,l||q(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},o.prototype.writeInt16LE=function(e,t,l){return e=+e,t=t>>>0,l||q(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,l){return e=+e,t=t>>>0,l||q(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},o.prototype.writeInt32LE=function(e,t,l){return e=+e,t=t>>>0,l||q(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},o.prototype.writeInt32BE=function(e,t,l){return e=+e,t=t>>>0,l||q(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},o.prototype.writeBigInt64LE=$(function(e,t=0){return Ke(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=$(function(e,t=0){return Je(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Xe(n,e,t,l,d,c){if(t+l>n.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function Ze(n,e,t,l,d){return e=+e,t=t>>>0,d||Xe(n,e,t,4),i.write(n,e,t,l,23,4),t+4}o.prototype.writeFloatLE=function(e,t,l){return Ze(this,e,t,!0,l)},o.prototype.writeFloatBE=function(e,t,l){return Ze(this,e,t,!1,l)};function Qe(n,e,t,l,d){return e=+e,t=t>>>0,d||Xe(n,e,t,8),i.write(n,e,t,l,52,8),t+8}o.prototype.writeDoubleLE=function(e,t,l){return Qe(this,e,t,!0,l)},o.prototype.writeDoubleBE=function(e,t,l){return Qe(this,e,t,!1,l)},o.prototype.copy=function(e,t,l,d){if(!o.isBuffer(e))throw new TypeError("argument should be a Buffer");if(l||(l=0),!d&&d!==0&&(d=this.length),t>=e.length&&(t=e.length),t||(t=0),d>0&&d<l&&(d=l),d===l||e.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(l<0||l>=this.length)throw new RangeError("Index out of range");if(d<0)throw new RangeError("sourceEnd out of bounds");d>this.length&&(d=this.length),e.length-t<d-l&&(d=e.length-t+l);let c=d-l;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,l,d):Uint8Array.prototype.set.call(e,this.subarray(l,d),t),c},o.prototype.fill=function(e,t,l,d){if(typeof e=="string"){if(typeof t=="string"?(d=t,t=0,l=this.length):typeof l=="string"&&(d=l,l=this.length),d!==void 0&&typeof d!="string")throw new TypeError("encoding must be a string");if(typeof d=="string"&&!o.isEncoding(d))throw new TypeError("Unknown encoding: "+d);if(e.length===1){let m=e.charCodeAt(0);(d==="utf8"&&m<128||d==="latin1")&&(e=m);}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(t<0||this.length<t||this.length<l)throw new RangeError("Out of range index");if(l<=t)return this;t=t>>>0,l=l===void 0?this.length:l>>>0,e||(e=0);let c;if(typeof e=="number")for(c=t;c<l;++c)this[c]=e;else {let m=o.isBuffer(e)?e:o.from(e,d),A=m.length;if(A===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(c=0;c<l-t;++c)this[c+t]=m[c%A];}return this};let K={};function Ne(n,e,t){K[n]=class extends t{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${n}]`,this.stack,delete this.name;}get code(){return n}set code(d){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:d,writable:!0});}toString(){return `${this.name} [${n}]: ${this.message}`}};}Ne("ERR_BUFFER_OUT_OF_BOUNDS",function(n){return n?`${n} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Ne("ERR_INVALID_ARG_TYPE",function(n,e){return `The "${n}" argument must be of type number. Received type ${typeof e}`},TypeError),Ne("ERR_OUT_OF_RANGE",function(n,e,t){let l=`The value of "${n}" is out of range.`,d=t;return Number.isInteger(t)&&Math.abs(t)>2**32?d=et(String(t)):typeof t=="bigint"&&(d=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(d=et(d)),d+="n"),l+=` It must be ${e}. Received ${d}`,l},RangeError);function et(n){let e="",t=n.length,l=n[0]==="-"?1:0;for(;t>=l+4;t-=3)e=`_${n.slice(t-3,t)}${e}`;return `${n.slice(0,t)}${e}`}function Vt(n,e,t){J(e,"offset"),(n[e]===void 0||n[e+t]===void 0)&&te(e,n.length-(t+1));}function tt(n,e,t,l,d,c){if(n>t||n<e){let m=typeof e=="bigint"?"n":"",A;throw e===0||e===BigInt(0)?A=`>= 0${m} and < 2${m} ** ${(c+1)*8}${m}`:A=`>= -(2${m} ** ${(c+1)*8-1}${m}) and < 2 ** ${(c+1)*8-1}${m}`,new K.ERR_OUT_OF_RANGE("value",A,n)}Vt(l,d,c);}function J(n,e){if(typeof n!="number")throw new K.ERR_INVALID_ARG_TYPE(e,"number",n)}function te(n,e,t){throw Math.floor(n)!==n?(J(n,t),new K.ERR_OUT_OF_RANGE("offset","an integer",n)):e<0?new K.ERR_BUFFER_OUT_OF_BOUNDS:new K.ERR_OUT_OF_RANGE("offset",`>= ${0} and <= ${e}`,n)}let zt=/[^+/0-9A-Za-z-_]/g;function Gt(n){if(n=n.split("=")[0],n=n.trim().replace(zt,""),n.length<2)return "";for(;n.length%4!==0;)n=n+"=";return n}function ke(n,e){e=e||1/0;let t,l=n.length,d=null,c=[];for(let m=0;m<l;++m){if(t=n.charCodeAt(m),t>55295&&t<57344){if(!d){if(t>56319){(e-=3)>-1&&c.push(239,191,189);continue}else if(m+1===l){(e-=3)>-1&&c.push(239,191,189);continue}d=t;continue}if(t<56320){(e-=3)>-1&&c.push(239,191,189),d=t;continue}t=(d-55296<<10|t-56320)+65536;}else d&&(e-=3)>-1&&c.push(239,191,189);if(d=null,t<128){if((e-=1)<0)break;c.push(t);}else if(t<2048){if((e-=2)<0)break;c.push(t>>6|192,t&63|128);}else if(t<65536){if((e-=3)<0)break;c.push(t>>12|224,t>>6&63|128,t&63|128);}else if(t<1114112){if((e-=4)<0)break;c.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128);}else throw new Error("Invalid code point")}return c}function jt(n){let e=[];for(let t=0;t<n.length;++t)e.push(n.charCodeAt(t)&255);return e}function Wt(n,e){let t,l,d,c=[];for(let m=0;m<n.length&&!((e-=2)<0);++m)t=n.charCodeAt(m),l=t>>8,d=t%256,c.push(d),c.push(l);return c}function rt(n){return r.toByteArray(Gt(n))}function me(n,e,t,l){let d;for(d=0;d<l&&!(d+t>=e.length||d>=n.length);++d)e[d+t]=n[d];return d}function M(n,e){return n instanceof e||n!=null&&n.constructor!=null&&n.constructor.name!=null&&n.constructor.name===e.name}function De(n){return n!==n}let Yt=function(){let n="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let l=t*16;for(let d=0;d<16;++d)e[l+d]=n[t]+n[d];}return e}();function $(n){return typeof BigInt>"u"?Kt:n}function Kt(){throw new Error("BigInt not supported")}return j}var W=Zt();W.Buffer;W.SlowBuffer;W.INSPECT_MAX_BYTES;W.kMaxLength;var T=W.Buffer;W.INSPECT_MAX_BYTES;W.kMaxLength;var ie=class{constructor(i){this.config=i;}};var X=class extends Error{url;status;statusText;body;request;constructor(i,s,a){super(a),this.name="ApiError",this.url=s.url,this.status=s.status,this.statusText=s.statusText,this.body=s.body,this.request=i;}};var he=class extends Error{constructor(i){super(i),this.name="CancelError";}get isCancelled(){return !0}},ne=class{[Symbol.toStringTag];_isResolved;_isRejected;_isCancelled;_cancelHandlers;_promise;_resolve;_reject;constructor(i){this._isResolved=!1,this._isRejected=!1,this._isCancelled=!1,this._cancelHandlers=[],this._promise=new Promise((s,a)=>{this._resolve=s,this._reject=a;let p=f=>{this._isResolved||this._isRejected||this._isCancelled||(this._isResolved=!0,this._resolve?.(f));},u=f=>{this._isResolved||this._isRejected||this._isCancelled||(this._isRejected=!0,this._reject?.(f));},o=f=>{this._isResolved||this._isRejected||this._isCancelled||this._cancelHandlers.push(f);};return Object.defineProperty(o,"isResolved",{get:()=>this._isResolved}),Object.defineProperty(o,"isRejected",{get:()=>this._isRejected}),Object.defineProperty(o,"isCancelled",{get:()=>this._isCancelled}),i(p,u,o)});}then(i,s){return this._promise.then(i,s)}catch(i){return this._promise.catch(i)}finally(i){return this._promise.finally(i)}cancel(){if(!(this._isResolved||this._isRejected||this._isCancelled)){if(this._isCancelled=!0,this._cancelHandlers.length)try{for(let i of this._cancelHandlers)i();}catch(i){console.warn("Cancellation threw an error",i);return}this._cancelHandlers.length=0,this._reject?.(new he("Request aborted"));}}get isCancelled(){return this._isCancelled}};var ve=r=>r!=null,Ce=r=>typeof r=="string",Fe=r=>Ce(r)&&r!=="",lt=r=>typeof r=="object"&&typeof r.type=="string"&&typeof r.stream=="function"&&typeof r.arrayBuffer=="function"&&typeof r.constructor=="function"&&typeof r.constructor.name=="string"&&/^(Blob|File)$/.test(r.constructor.name)&&/^(Blob|File)$/.test(r[Symbol.toStringTag]),Qt=r=>r instanceof at,er=r=>r>=200&&r<300,tr=r=>{try{return btoa(r)}catch{return T.from(r).toString("base64")}},rr=r=>{let i=[],s=(p,u)=>{i.push(`${encodeURIComponent(p)}=${encodeURIComponent(String(u))}`);},a=(p,u)=>{ve(u)&&(Array.isArray(u)?u.forEach(o=>{a(p,o);}):typeof u=="object"?Object.entries(u).forEach(([o,f])=>{a(`${p}[${o}]`,f);}):s(p,u));};return Object.entries(r).forEach(([p,u])=>{a(p,u);}),i.length>0?`?${i.join("&")}`:""},ir=(r,i)=>{let s=r.ENCODE_PATH||encodeURI,a=i.url.replace("{api-version}",r.VERSION).replace(/{(.*?)}/g,(u,o)=>i.path?.hasOwnProperty(o)?s(String(i.path[o])):u),p=`${r.BASE}${a}`;return i.query?`${p}${rr(i.query)}`:p},nr=r=>{if(r.formData){let i=new at,s=(a,p)=>{Ce(p)||lt(p)?i.append(a,p):i.append(a,JSON.stringify(p));};return Object.entries(r.formData).filter(([a,p])=>ve(p)).forEach(([a,p])=>{Array.isArray(p)?p.forEach(u=>s(a,u)):s(a,p);}),i}},ye=async(r,i)=>typeof i=="function"?i(r):i,or=async(r,i,s)=>{let a=await ye(i,r.TOKEN),p=await ye(i,r.USERNAME),u=await ye(i,r.PASSWORD),o=await ye(i,r.HEADERS),f=typeof s?.getHeaders=="function"&&s?.getHeaders()||{},E=Object.entries({Accept:"application/json",...o,...i.headers,...f}).filter(([h,g])=>ve(g)).reduce((h,[g,R])=>({...h,[g]:String(R)}),{});if(Fe(a)&&(E.Authorization=`Bearer ${a}`),Fe(p)&&Fe(u)){let h=tr(`${p}:${u}`);E.Authorization=`Basic ${h}`;}return i.body&&(i.mediaType?E["Content-Type"]=i.mediaType:lt(i.body)?E["Content-Type"]=i.body.type||"application/octet-stream":Ce(i.body)?E["Content-Type"]="text/plain":Qt(i.body)||(E["Content-Type"]="application/json")),E},sr=r=>{if(r.body)return r.body},ar=async(r,i,s,a,p,u,o)=>{let f=st.CancelToken.source(),E={url:s,headers:u,data:a??p,method:i.method,withCredentials:r.WITH_CREDENTIALS,cancelToken:f.token};o(()=>f.cancel("The user aborted a request."));try{return await st.request(E)}catch(h){let g=h;if(g.response)return g.response;throw h}},lr=(r,i)=>{if(i){let s=r.headers[i];if(Ce(s))return s}},dr=r=>{if(r.status!==204)return r.data},ur=(r,i)=>{let a={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable",...r.errors}[i.status];if(a)throw new X(r,i,a);if(!i.ok)throw new X(r,i,"Generic Error")},dt=(r,i)=>new ne(async(s,a,p)=>{try{let u=ir(r,i),o=nr(i),f=sr(i),E=await or(r,i,o);if(!p.isCancelled){let h=await ar(r,i,u,f,o,E,p),g=dr(h),R=lr(h,i.responseHeader),y={url:u,ok:er(h.status),status:h.status,statusText:h.statusText,body:R??g};ur(i,y),s(y.body);}}catch(u){a(u);}});var Ee=class extends ie{constructor(i){super(i);}request(i){return dt(this.config,i)}};var oe=class{constructor(i){this.httpRequest=i;}cancelOrders({chainName:i,requestBody:s}){return this.httpRequest.request({method:"POST",url:"/v1/chains/{chain_name}/orders/cancel",path:{chain_name:i},body:s,mediaType:"application/json",errors:{400:"Bad Request (400)",401:"Unauthorised Request (401)",404:"The specified resource was not found (404)",429:"Too Many Requests (429)",500:"Internal Server Error (500)",501:"Not Implemented Error (501)"}})}listListings({chainName:i,status:s,sellItemContractAddress:a,buyItemType:p,buyItemContractAddress:u,accountAddress:o,sellItemMetadataId:f,sellItemTokenId:E,fromUpdatedAt:h,pageSize:g,sortBy:R,sortDirection:y,pageCursor:C}){return this.httpRequest.request({method:"GET",url:"/v1/chains/{chain_name}/orders/listings",path:{chain_name:i},query:{status:s,sell_item_contract_address:a,buy_item_type:p,buy_item_contract_address:u,account_address:o,sell_item_metadata_id:f,sell_item_token_id:E,from_updated_at:h,page_size:g,sort_by:R,sort_direction:y,page_cursor:C},errors:{400:"Bad Request (400)",404:"The specified resource was not found (404)",500:"Internal Server Error (500)"}})}createListing({chainName:i,requestBody:s}){return this.httpRequest.request({method:"POST",url:"/v1/chains/{chain_name}/orders/listings",path:{chain_name:i},body:s,mediaType:"application/json",errors:{400:"Bad Request (400)",404:"The specified resource was not found (404)",500:"Internal Server Error (500)"}})}listBids({chainName:i,status:s,buyItemContractAddress:a,sellItemContractAddress:p,accountAddress:u,buyItemMetadataId:o,buyItemTokenId:f,fromUpdatedAt:E,pageSize:h,sortBy:g,sortDirection:R,pageCursor:y}){return this.httpRequest.request({method:"GET",url:"/v1/chains/{chain_name}/orders/bids",path:{chain_name:i},query:{status:s,buy_item_contract_address:a,sell_item_contract_address:p,account_address:u,buy_item_metadata_id:o,buy_item_token_id:f,from_updated_at:E,page_size:h,sort_by:g,sort_direction:R,page_cursor:y},errors:{400:"Bad Request (400)",404:"The specified resource was not found (404)",500:"Internal Server Error (500)"}})}createBid({chainName:i,requestBody:s}){return this.httpRequest.request({method:"POST",url:"/v1/chains/{chain_name}/orders/bids",path:{chain_name:i},body:s,mediaType:"application/json",errors:{400:"Bad Request (400)",404:"The specified resource was not found (404)",500:"Internal Server Error (500)",501:"Not Implemented Error (501)"}})}listCollectionBids({chainName:i,status:s,buyItemContractAddress:a,sellItemContractAddress:p,accountAddress:u,fromUpdatedAt:o,pageSize:f,sortBy:E,sortDirection:h,pageCursor:g}){return this.httpRequest.request({method:"GET",url:"/v1/chains/{chain_name}/orders/collection-bids",path:{chain_name:i},query:{status:s,buy_item_contract_address:a,sell_item_contract_address:p,account_address:u,from_updated_at:o,page_size:f,sort_by:E,sort_direction:h,page_cursor:g},errors:{400:"Bad Request (400)",404:"The specified resource was not found (404)",500:"Internal Server Error (500)"}})}createCollectionBid({chainName:i,requestBody:s}){return this.httpRequest.request({method:"POST",url:"/v1/chains/{chain_name}/orders/collection-bids",path:{chain_name:i},body:s,mediaType:"application/json",errors:{400:"Bad Request (400)",404:"The specified resource was not found (404)",500:"Internal Server Error (500)",501:"Not Implemented Error (501)"}})}listTraitBids({chainName:i,status:s,buyItemContractAddress:a,sellItemContractAddress:p,accountAddress:u,fromUpdatedAt:o,pageSize:f,sortBy:E,sortDirection:h,pageCursor:g}){return this.httpRequest.request({method:"GET",url:"/v1/chains/{chain_name}/orders/trait-bids",path:{chain_name:i},query:{status:s,buy_item_contract_address:a,sell_item_contract_address:p,account_address:u,from_updated_at:o,page_size:f,sort_by:E,sort_direction:h,page_cursor:g},errors:{400:"Bad Request (400)",404:"The specified resource was not found (404)",500:"Internal Server Error (500)"}})}createTraitBid({chainName:i,requestBody:s}){return this.httpRequest.request({method:"POST",url:"/v1/chains/{chain_name}/orders/trait-bids",path:{chain_name:i},body:s,mediaType:"application/json",errors:{400:"Bad Request (400)",404:"The specified resource was not found (404)",500:"Internal Server Error (500)",501:"Not Implemented Error (501)"}})}getListing({chainName:i,listingId:s}){return this.httpRequest.request({method:"GET",url:"/v1/chains/{chain_name}/orders/listings/{listing_id}",path:{chain_name:i,listing_id:s},errors:{400:"Bad Request (400)",404:"The specified resource was not found (404)",500:"Internal Server Error (500)"}})}getBid({chainName:i,bidId:s}){return this.httpRequest.request({method:"GET",url:"/v1/chains/{chain_name}/orders/bids/{bid_id}",path:{chain_name:i,bid_id:s},errors:{400:"Bad Request (400)",404:"The specified resource was not found (404)",500:"Internal Server Error (500)"}})}getCollectionBid({chainName:i,collectionBidId:s}){return this.httpRequest.request({method:"GET",url:"/v1/chains/{chain_name}/orders/collection-bids/{collection_bid_id}",path:{chain_name:i,collection_bid_id:s},errors:{400:"Bad Request (400)",404:"The specified resource was not found (404)",500:"Internal Server Error (500)"}})}getTraitBid({chainName:i,traitBidId:s}){return this.httpRequest.request({method:"GET",url:"/v1/chains/{chain_name}/orders/trait-bids/{trait_bid_id}",path:{chain_name:i,trait_bid_id:s},errors:{400:"Bad Request (400)",404:"The specified resource was not found (404)",500:"Internal Server Error (500)"}})}fulfillmentData({chainName:i,requestBody:s}){return this.httpRequest.request({method:"POST",url:"/v1/chains/{chain_name}/orders/fulfillment-data",path:{chain_name:i},body:s,mediaType:"application/json",errors:{400:"Bad Request (400)",404:"The specified resource was not found (404)",500:"Internal Server Error (500)"}})}listTrades({chainName:i,accountAddress:s,sellItemContractAddress:a,fromIndexedAt:p,pageSize:u,sortBy:o,sortDirection:f,pageCursor:E}){return this.httpRequest.request({method:"GET",url:"/v1/chains/{chain_name}/trades",path:{chain_name:i},query:{account_address:s,sell_item_contract_address:a,from_indexed_at:p,page_size:u,sort_by:o,sort_direction:f,page_cursor:E},errors:{400:"Bad Request (400)",404:"The specified resource was not found (404)",500:"Internal Server Error (500)"}})}getTrade({chainName:i,tradeId:s}){return this.httpRequest.request({method:"GET",url:"/v1/chains/{chain_name}/trades/{trade_id}",path:{chain_name:i,trade_id:s},errors:{400:"Bad Request (400)",404:"The specified resource was not found (404)",500:"Internal Server Error (500)"}})}};var se=class{orders;request;constructor(i,s=Ee){this.request=new s({BASE:i?.BASE??"https://api.immutable.com",VERSION:i?.VERSION??"1.0.0",WITH_CREDENTIALS:i?.WITH_CREDENTIALS??!1,CREDENTIALS:i?.CREDENTIALS??"include",TOKEN:i?.TOKEN,USERNAME:i?.USERNAME,PASSWORD:i?.PASSWORD,HEADERS:i?.HEADERS,ENCODE_PATH:i?.ENCODE_PATH}),this.orders=new oe(this.request);}};var ut;(i=>{(u=>(u.ON_CHAIN="ON_CHAIN",u.OFF_CHAIN="OFF_CHAIN",u.UNDERFUNDED="UNDERFUNDED"))(i.cancellation_type||={});})(ut||={});var pt;(i=>{(a=>a.FILLED="FILLED")(i.reason_code||={});})(pt||={});var D;(i=>{(o=>(o.ROYALTY="ROYALTY",o.MAKER_ECOSYSTEM="MAKER_ECOSYSTEM",o.TAKER_ECOSYSTEM="TAKER_ECOSYSTEM",o.PROTOCOL="PROTOCOL"))(i.type||={});})(D||={});var N;(i=>{(o=>(o.LISTING="LISTING",o.BID="BID",o.COLLECTION_BID="COLLECTION_BID",o.TRAIT_BID="TRAIT_BID"))(i.type||={});})(N||={});var ge=(o=>(o.PENDING="PENDING",o.ACTIVE="ACTIVE",o.INACTIVE="INACTIVE",o.FILLED="FILLED",o.EXPIRED="EXPIRED",o.CANCELLED="CANCELLED",o))(ge||{});var V;(i=>{(p=>(p.FULL_RESTRICTED="FULL_RESTRICTED",p.PARTIAL_RESTRICTED="PARTIAL_RESTRICTED"))(i.order_type||={});})(V||={});function U(r){throw new Error("Unreachable")}function Y(r){if(r.type!==N.type.LISTING)throw new Error("Order type must be LISTING");let i=r.sell.map(a=>{if(a.type==="ERC721")return {type:"ERC721",contractAddress:a.contract_address,tokenId:a.token_id};if(a.type==="ERC1155")return {type:"ERC1155",contractAddress:a.contract_address,tokenId:a.token_id,amount:a.amount};throw new Error("Listing sell items must either ERC721 or ERC1155")}),s=r.buy.map(a=>{if(a.type==="NATIVE")return {type:"NATIVE",amount:a.amount};if(a.type==="ERC20")return {type:"ERC20",contractAddress:a.contract_address,amount:a.amount};throw new Error("Listing buy items must be either NATIVE or ERC20")});return {id:r.id,type:r.type,chain:r.chain,accountAddress:r.account_address,sell:i,buy:s,fees:r.fees.map(a=>({amount:a.amount,recipientAddress:a.recipient_address,type:a.type})),status:r.status,fillStatus:r.fill_status,startAt:r.start_at,endAt:r.end_at,salt:r.salt,signature:r.signature,orderHash:r.order_hash,protocolData:{orderType:r.protocol_data.order_type,counter:r.protocol_data.counter,seaportAddress:r.protocol_data.seaport_address,seaportVersion:r.protocol_data.seaport_version,zoneAddress:r.protocol_data.zone_address},createdAt:r.created_at,updatedAt:r.updated_at}}function ae(r){if(r.type!==N.type.BID)throw new Error("Order type must be BID");let i=r.sell.map(a=>{if(a.type==="ERC20")return {type:"ERC20",contractAddress:a.contract_address,amount:a.amount};throw new Error("Bid sell items must be ERC20")}),s=r.buy.map(a=>{if(a.type==="ERC721")return {type:"ERC721",contractAddress:a.contract_address,tokenId:a.token_id};if(a.type==="ERC1155")return {type:"ERC1155",contractAddress:a.contract_address,tokenId:a.token_id,amount:a.amount};throw new Error("Bid buy items must either ERC721 or ERC1155")});return {id:r.id,type:r.type,chain:r.chain,accountAddress:r.account_address,sell:i,buy:s,fees:r.fees.map(a=>({amount:a.amount,recipientAddress:a.recipient_address,type:a.type})),status:r.status,fillStatus:r.fill_status,startAt:r.start_at,endAt:r.end_at,salt:r.salt,signature:r.signature,orderHash:r.order_hash,protocolData:{orderType:r.protocol_data.order_type,counter:r.protocol_data.counter,seaportAddress:r.protocol_data.seaport_address,seaportVersion:r.protocol_data.seaport_version,zoneAddress:r.protocol_data.zone_address},createdAt:r.created_at,updatedAt:r.updated_at}}function pr(r){return r?.length?r.map(i=>({traitType:i.trait_type,values:[...i.values]})):[]}function le(r){if(r.type!==N.type.COLLECTION_BID)throw new Error("Order type must be COLLECTION_BID");let i=r.sell.map(a=>{if(a.type==="ERC20")return {type:"ERC20",contractAddress:a.contract_address,amount:a.amount};throw new Error("Collection bid sell items must be ERC20")}),s=r.buy.map(a=>{if(a.type==="ERC721_COLLECTION")return {type:"ERC721_COLLECTION",contractAddress:a.contract_address,amount:a.amount};if(a.type==="ERC1155_COLLECTION")return {type:"ERC1155_COLLECTION",contractAddress:a.contract_address,amount:a.amount};throw new Error("Collection bid buy items must either ERC721_COLLECTION or ERC1155_COLLECTION")});return {id:r.id,type:r.type,chain:r.chain,accountAddress:r.account_address,sell:i,buy:s,fees:r.fees.map(a=>({amount:a.amount,recipientAddress:a.recipient_address,type:a.type})),status:r.status,fillStatus:r.fill_status,startAt:r.start_at,endAt:r.end_at,salt:r.salt,signature:r.signature,orderHash:r.order_hash,protocolData:{orderType:r.protocol_data.order_type,counter:r.protocol_data.counter,seaportAddress:r.protocol_data.seaport_address,seaportVersion:r.protocol_data.seaport_version,zoneAddress:r.protocol_data.zone_address},createdAt:r.created_at,updatedAt:r.updated_at}}function de(r){if(r.type!==N.type.TRAIT_BID)throw new Error("Order type must be TRAIT_BID");let i=r.sell.map(a=>{if(a.type==="ERC20")return {type:"ERC20",contractAddress:a.contract_address,amount:a.amount};throw new Error("Trait bid sell items must be ERC20")}),s=r.buy.map(a=>{if(a.type==="ERC721_COLLECTION")return {type:"ERC721_COLLECTION",contractAddress:a.contract_address,amount:a.amount};if(a.type==="ERC1155_COLLECTION")return {type:"ERC1155_COLLECTION",contractAddress:a.contract_address,amount:a.amount};throw new Error("Trait bid buy items must either ERC721_COLLECTION or ERC1155_COLLECTION")});return {id:r.id,type:r.type,chain:r.chain,accountAddress:r.account_address,sell:i,buy:s,fees:r.fees.map(a=>({amount:a.amount,recipientAddress:a.recipient_address,type:a.type})),status:r.status,fillStatus:r.fill_status,startAt:r.start_at,endAt:r.end_at,salt:r.salt,signature:r.signature,orderHash:r.order_hash,protocolData:{orderType:r.protocol_data.order_type,counter:r.protocol_data.counter,seaportAddress:r.protocol_data.seaport_address,seaportVersion:r.protocol_data.seaport_version,zoneAddress:r.protocol_data.zone_address},createdAt:r.created_at,updatedAt:r.updated_at,traitCriteria:pr(r.trait_criteria)}}function ue(r){switch(r.type){case N.type.LISTING:return Y(r);case N.type.BID:return ae(r);case N.type.COLLECTION_BID:return le(r);case N.type.TRAIT_BID:return de(r);default:return U(r.type)}}function qe(r){let i=r.buy.map(a=>{if(a.type==="NATIVE")return {type:"NATIVE",amount:a.amount};if(a.type==="ERC20")return {type:"ERC20",contractAddress:a.contract_address,amount:a.amount};if(a.type==="ERC721")return {type:"ERC721",contractAddress:a.contract_address,tokenId:a.token_id};if(a.type==="ERC1155")return {type:"ERC1155",contractAddress:a.contract_address,tokenId:a.token_id,amount:a.amount};throw new Error("Buy items must be NATIVE, ERC20, ERC721 or ERC1155")}),s=r.sell.map(a=>{if(a.type==="ERC20")return {type:"ERC20",contractAddress:a.contract_address,amount:a.amount};if(a.type==="ERC721")return {type:"ERC721",contractAddress:a.contract_address,tokenId:a.token_id};if(a.type==="ERC1155")return {type:"ERC1155",contractAddress:a.contract_address,tokenId:a.token_id,amount:a.amount};throw new Error("Sell items must be ERC20, ERC721 or ERC1155")});return {id:r.id,orderId:r.order_id,buy:i,sell:s,buyerFees:r.buyer_fees.map(a=>({amount:a.amount,recipientAddress:a.recipient_address,type:a.type})),fees:r.fees.map(a=>({amount:a.amount,recipientAddress:a.recipient_address,type:a.type})),chain:r.chain,indexedAt:r.indexed_at,blockchainMetadata:{blockNumber:r.blockchain_metadata.block_number,logIndex:r.blockchain_metadata.log_index,transactionHash:r.blockchain_metadata.transaction_hash,transactionIndex:r.blockchain_metadata.transaction_index},buyerAddress:r.buyer_address,makerAddress:r.maker_address,sellerAddress:r.seller_address,takerAddress:r.taker_address}}function Z(r){return {nextCursor:r.next_cursor,previousCursor:r.previous_cursor}}var cr=(p=>(p[p.MAKER_ECOSYSTEM=D.type.MAKER_ECOSYSTEM]="MAKER_ECOSYSTEM",p[p.TAKER_ECOSYSTEM=D.type.TAKER_ECOSYSTEM]="TAKER_ECOSYSTEM",p[p.PROTOCOL=D.type.PROTOCOL]="PROTOCOL",p[p.ROYALTY=D.type.ROYALTY]="ROYALTY",p))(cr||{}),Ue=(s=>(s.TRANSACTION="TRANSACTION",s.SIGNABLE="SIGNABLE",s))(Ue||{}),ct=(a=>(a.APPROVAL="APPROVAL",a.FULFILL_ORDER="FULFILL_ORDER",a.CANCEL="CANCEL",a))(ct||{}),He=(a=>(a.CREATE_LISTING="CREATE_ORDER",a.CREATE_ORDER="CREATE_ORDER",a.OFF_CHAIN_CANCELLATION="OFF_CHAIN_CANCELLATION",a))(He||{});var Me="ImmutableSeaport",z="1.5",Re={OrderComponents:[{name:"offerer",type:"address"},{name:"zone",type:"address"},{name:"offer",type:"OfferItem[]"},{name:"consideration",type:"ConsiderationItem[]"},{name:"orderType",type:"uint8"},{name:"startTime",type:"uint256"},{name:"endTime",type:"uint256"},{name:"zoneHash",type:"bytes32"},{name:"salt",type:"uint256"},{name:"conduitKey",type:"bytes32"},{name:"counter",type:"uint256"}],OfferItem:[{name:"itemType",type:"uint8"},{name:"token",type:"address"},{name:"identifierOrCriteria",type:"uint256"},{name:"startAmount",type:"uint256"},{name:"endAmount",type:"uint256"}],ConsiderationItem:[{name:"itemType",type:"uint8"},{name:"token",type:"address"},{name:"identifierOrCriteria",type:"uint256"},{name:"startAmount",type:"uint256"},{name:"endAmount",type:"uint256"},{name:"recipient",type:"address"}]};var mr={integer:0,address:zeroPadValue("0x",20),bool:!1,bytes:"0x",string:""},$e=r=>r===void 0?!1:r!=null&&(["string","number"].includes(typeof r)&&BigInt(r)===0n||Array.isArray(r)&&r.every($e)||typeof r=="object"&&Object.values(r).every($e)||typeof r=="boolean"&&r===!1);function fr(r){let[,i]=r.match(/^bytes(\d+)$/)??[];return i?zeroPadValue("0x",parseInt(i)):(r.match(/^(u?)int(\d*)$/)&&(r="integer"),mr[r])}var Q=class r{constructor(i){this.types=i;for(let s in i){let a=this.getDefaultValue(s);if(this.defaultValues[s]=a,!$e(a))throw new Error(`Got non-empty value for type ${s} in default generator: ${a}`)}}defaultValues={};static from(i,s){let{defaultValues:a}=new r(i);return s?a[s]:a}getDefaultValue(i){if(this.defaultValues[i])return this.defaultValues[i];let s=fr(i);if(s!==void 0)return s;let a=i.match(/^(.*)(\x5b(\d*)\x5d)$/);if(a){let u=a[1],o=parseInt(a[3]);if(o>0){let f=this.getDefaultValue(u);return Array(o).fill(f)}return []}let p=this.types[i];if(p)return p.reduce((u,{name:o,type:f})=>({...u,[o]:this.getDefaultValue(f)}),{});throw new Error(`unknown type: ${i}`)}};var Er=(r,i)=>Array(r).fill(0).map((s,a)=>i(a)),Ve=(r,i)=>Er(Math.ceil(r.length/i),s=>r.slice(s*i,(s+1)*i)),ft=r=>toBeHex(r.toString("hex")),ee=r=>T.from(r.slice(2),"hex"),Ie=r=>ee(keccak256(r)),gr=r=>Ie(concat(r)),pe=(r,i,s)=>(i>r.length&&r.push(...Array(i-r.length).fill(s)),r),ht=(r,i=!0)=>{if(r.length===0)throw new Error("empty tree");let a=[r.map(p=>{let u=T.isBuffer(p)?p:ee(p);return i?Ie(u):u})];for(;a[a.length-1].length>1;)a.push(Rr(a[a.length-1]));return a[a.length-1][0]},Rr=r=>Ve(r,2).map(gr);var _r=(r,i)=>new MerkleTree(r.map(ee),Ie,{complete:!0,sort:!1,hashLeaves:!1,fillDefaultHash:ee(i)}),Br=(r,i,s=`0x${"ff".repeat(64)}`)=>concat([s,`0x${r.toString(16).padStart(6,"0")}`,AbiCoder.defaultAbiCoder().encode([`uint256[${i.length}]`],[i])]),Te=class{constructor(i,s,a,p,u){this.types=i;this.rootType=s;this.leafType=a;this.elements=p;this.depth=u;let o=TypedDataEncoder.from(i);this.encoder=o,this.leafHasher=f=>o.hashStruct(a,f),this.defaultNode=Q.from(i,a),this.defaultLeaf=this.leafHasher(this.defaultNode),this.tree=_r(this.getCompleteLeaves(),this.defaultLeaf);}tree;leafHasher;defaultNode;defaultLeaf;encoder;get completedSize(){return 2**this.depth}getCompleteElements(){let{elements:i}=this;return pe([...i],this.completedSize,this.defaultNode)}getCompleteLeaves(){let i=this.elements.map(this.leafHasher);return pe([...i],this.completedSize,this.defaultLeaf)}get root(){return this.tree.getHexRoot()}getProof(i){let a=this.getCompleteLeaves()[i],p=this.tree.getHexProof(a,i),u=this.tree.getHexRoot();return {leaf:a,proof:p,root:u}}getEncodedProofAndSignature(i,s){let{proof:a}=this.getProof(i);return Br(i,a,s)}getDataToSign(){let i=this.getCompleteElements();for(;i.length>2;)i=Ve(i,2);return i}add(i){this.elements.push(i);}getBulkOrderHash(){let i=this.encoder.hashStruct("BulkOrder",{tree:this.getDataToSign()}),s=this.getCompleteLeaves().map(ee),a=ft(ht(s,!1)),p=keccak256(toUtf8Bytes(this.encoder.types.BulkOrder[0].type));if(keccak256(concat([p,a]))!==i)throw new Error("expected derived bulk order hash to match");return i}};function wr(r){return {...Re,BulkOrder:[{name:"tree",type:`OrderComponents${"[2]".repeat(r)}`}]}}function br(r){return Math.max(Math.ceil(Math.log2(r)),1)}function Et(r,i=0,s=br(r.length+i)){let a=wr(s),p=Q.from(a,"OrderComponents"),u=[...r];return i>0&&(u=[...pe([],i,p),...r]),new Te(a,"BulkOrder","OrderComponents",u,s)}function It(r){if([0,1,2,3].includes(Number(r)))return Number(r);throw new Error(`Unknown order type ${r}`)}function Ae(r){if([0,1,2,3,4,5].includes(Number(r)))return Number(r);throw new Error(`Unknown item type ${r}`)}function Tt(r){let s=JSON.parse(r).message;return {...s,orderType:It(s.orderType),salt:toBeHex(BigInt(s.salt)),offer:s.offer.map(a=>({...a,itemType:Ae(a.itemType)})),consideration:s.consideration.map(a=>({...a,itemType:Ae(a.itemType)}))}}function At(r){let i=JSON.parse(r);return {components:i.message.tree.flat(1/0).filter(a=>a.offerer!=="0x0000000000000000000000000000000000000000").map(a=>({...a,orderType:It(a.orderType),salt:toBeHex(BigInt(a.salt)),offer:a.offer.map(p=>({...p,itemType:Ae(p.itemType)})),consideration:a.consideration.map(p=>({...p,itemType:Ae(p.itemType)}))})),types:i.types,value:i.message}}function Ot(r,i){let s=Et(i);return i.map((a,p)=>s.getEncodedProofAndSignature(p,r))}function Sr(r){switch(r.type){case"NATIVE":throw new Error("NATIVE items are not supported in the offer");case"ERC20":return {itemType:1 .valueOf(),token:r.contract_address,identifierOrCriteria:"0",startAmount:r.amount,endAmount:r.amount};case"ERC721":return {itemType:2 .valueOf(),token:r.contract_address,identifierOrCriteria:r.token_id,startAmount:"1",endAmount:"1"};case"ERC1155":return {itemType:3 .valueOf(),token:r.contract_address,identifierOrCriteria:r.token_id,startAmount:r.amount,endAmount:r.amount};case"ERC721_COLLECTION":throw new Error("ERC721_COLLECTION items are not supported in the offer");case"ERC1155_COLLECTION":throw new Error("ERC1155_COLLECTION items are not supported in the offer");default:return U()}}function Pr(r,i){switch(r.type){case"NATIVE":return {itemType:0 .valueOf(),startAmount:r.amount,endAmount:r.amount,token:ZeroAddress,identifierOrCriteria:"0",recipient:i};case"ERC20":return {itemType:1 .valueOf(),startAmount:r.amount,endAmount:r.amount,token:r.contract_address,identifierOrCriteria:"0",recipient:i};case"ERC721":return {itemType:2 .valueOf(),startAmount:"1",endAmount:"1",token:r.contract_address,identifierOrCriteria:r.token_id,recipient:i};case"ERC1155":return {itemType:3 .valueOf(),startAmount:r.amount,endAmount:r.amount,token:r.contract_address,identifierOrCriteria:r.token_id,recipient:i};case"ERC721_COLLECTION":return {itemType:4 .valueOf(),startAmount:r.amount,endAmount:r.amount,token:r.contract_address,identifierOrCriteria:"0",recipient:i};case"ERC1155_COLLECTION":return {itemType:5 .valueOf(),startAmount:r.amount,endAmount:r.amount,token:r.contract_address,identifierOrCriteria:"0",recipient:i};default:return U()}}function _e(r){let i=r.sell.map(Sr),s=r.buy.map(o=>Pr(o,r.account_address)),a=function(o){switch(o){case N.type.LISTING:return s[0];case N.type.BID:case N.type.COLLECTION_BID:case N.type.TRAIT_BID:return i[0];default:return U()}}(r.type),p=function(o){switch(o){case V.order_type.FULL_RESTRICTED:return 2;case V.order_type.PARTIAL_RESTRICTED:return 3;default:return U()}}(r.protocol_data.order_type),u=r.fees.map(o=>({amount:o.amount,itemType:a.itemType,recipient:o.recipient_address,token:a.token,identifierOrCriteria:a.identifierOrCriteria}));return {orderComponents:{offerer:r.account_address,zone:r.protocol_data.zone_address,offer:i,consideration:s,orderType:p.valueOf(),startTime:Math.round(new Date(r.start_at).getTime()/1e3).toString(),endTime:Math.round(new Date(r.end_at).getTime()/1e3).toString(),zoneHash:ZeroHash,salt:r.salt,conduitKey:ZeroHash,counter:r.protocol_data.counter,totalOriginalConsiderationItems:s.length},tips:u}}function G(r,i,s){return async()=>{let a=await r.buildTransaction(),p={to:a.to,from:s,type:a.type,maxFeePerGas:a.maxFeePerGas?BigInt(a.maxFeePerGas):void 0,maxPriorityFeePerGas:a.maxPriorityFeePerGas?BigInt(a.maxPriorityFeePerGas):void 0,value:a.value?BigInt(a.value):void 0,data:a.data,nonce:a.nonce,chainId:i};return p.gasLimit=BigInt(await r.estimateGas()),p.gasLimit+=p.gasLimit/BigInt(5),p}}function Bt(r){switch(r.type){case"ERC20":return {token:r.contractAddress,amount:r.amount};case"ERC721":return {itemType:2 .valueOf(),token:r.contractAddress,identifier:r.tokenId};case"ERC1155":return {itemType:3 .valueOf(),token:r.contractAddress,identifier:r.tokenId,amount:r.amount};default:return U()}}function wt(r,i){switch(r.type){case"NATIVE":return {amount:r.amount,recipient:i};case"ERC20":return {token:r.contractAddress,amount:r.amount,recipient:i};case"ERC721":return {itemType:2 .valueOf(),token:r.contractAddress,identifier:r.tokenId,recipient:i};case"ERC1155":return {itemType:3 .valueOf(),token:r.contractAddress,identifier:r.tokenId,amount:r.amount,recipient:i};case"ERC721_COLLECTION":return {itemType:2 .valueOf(),token:r.contractAddress,amount:r.amount,identifiers:[],recipient:i};case"ERC1155_COLLECTION":return {itemType:3 .valueOf(),token:r.contractAddress,amount:r.amount,identifiers:[],recipient:i};default:return U()}}var Be=class r{constructor(i,s,a,p,u){this.seaportLibFactory=i;this.provider=s;this.seaportContractAddress=a;this.zoneContractAddress=p;this.rateLimitingKey=u;}async prepareBulkSeaportOrders(i,s){let{actions:a}=await this.createSeaportOrders(i,s),p=a.filter(y=>y.type==="approval"),u=await this.provider.getNetwork(),o=p.map(y=>({type:"TRANSACTION",purpose:"APPROVAL",buildTransaction:G(y.transactionMethods,u.chainId,i)})),f=a.find(y=>y.type==="createBulk");if(!f)throw new Error("No create bulk order action found");let E=await f.getMessageToSign(),{components:h,types:g,value:R}=At(E);return o.push({type:"SIGNABLE",purpose:"CREATE_ORDER",message:await this.getTypedDataFromBulkOrderComponents(g,R)}),{actions:o,preparedOrders:h.map(y=>({orderComponents:y,orderHash:this.getSeaportLib().getOrderHash(y)}))}}async prepareSeaportOrder(i,s,a,p,u,o){let{actions:f}=await this.createSeaportOrder(i,s,a,p,u,o),E=[],h=f.find(C=>C.type==="approval");h&&E.push({type:"TRANSACTION",purpose:"APPROVAL",buildTransaction:G(h.transactionMethods,(await this.provider.getNetwork()).chainId,i)});let g=f.find(C=>C.type==="create");if(!g)throw new Error("No create order action found");let R=await g.getMessageToSign(),y=Tt(R);return E.push({type:"SIGNABLE",purpose:"CREATE_ORDER",message:await this.getTypedDataFromOrderComponents(y)}),{actions:E,orderComponents:y,orderHash:this.getSeaportLib().getOrderHash(y)}}async fulfillOrder(i,s,a,p,u){let{orderComponents:o,tips:f}=_e(i),E=this.getSeaportLib(i),h=(await this.provider.getNetwork()).chainId,g={order:{parameters:o,signature:i.signature},unitsToFill:p,extraData:a,tips:f};u&&(g.considerationCriteria=u);let{actions:R}=await E.fulfillOrders({accountAddress:s,fulfillOrderDetails:[g]}),y=[],C=R.filter(_=>_.type==="approval");C.length>0&&C.forEach(_=>{y.push({type:"TRANSACTION",buildTransaction:G(_.transactionMethods,h,s),purpose:"APPROVAL"});});let I=R.find(_=>_.type==="exchange");if(!I)throw new Error("No exchange action found");return y.push({type:"TRANSACTION",buildTransaction:G(I.transactionMethods,h,s),purpose:"FULFILL_ORDER"}),{actions:y,expiration:r.getExpirationISOTimeFromExtraData(a),order:ue(i)}}async fulfillBulkOrders(i,s){let a=i.map(h=>{let{orderComponents:g,tips:R}=_e(h.order),y={order:{parameters:g,signature:h.order.signature},unitsToFill:h.unitsToFill,extraData:h.extraData,tips:R};return h.considerationCriteria&&h.considerationCriteria.length>0&&(y.considerationCriteria=h.considerationCriteria),y}),{actions:p}=await this.getSeaportLib().fulfillOrders({fulfillOrderDetails:a,accountAddress:s}),u=[],o=p.filter(h=>h.type==="approval"),f=(await this.provider.getNetwork()).chainId;o.length>0&&o.forEach(h=>{u.push({type:"TRANSACTION",buildTransaction:G(h.transactionMethods,f,s),purpose:"APPROVAL"});});let E=p.find(h=>h.type==="exchange");if(!E)throw new Error("No exchange action found");return u.push({type:"TRANSACTION",buildTransaction:G(E.transactionMethods,(await this.provider.getNetwork()).chainId,s),purpose:"FULFILL_ORDER"}),{actions:u,expiration:a.map(h=>r.getExpirationISOTimeFromExtraData(h.extraData)).reduce((h,g)=>new Date(h)<new Date(g)?h:g)}}async cancelOrders(i,s){let a=i.map(o=>_e(o).orderComponents),u=await this.getSeaportLib(i[0]).cancelOrders(a,s);return {type:"TRANSACTION",buildTransaction:G(u,(await this.provider.getNetwork()).chainId,s),purpose:"CANCEL"}}createSeaportOrders(i,s){return this.getSeaportLib().createBulkOrders(s.map(p=>{let{offerItem:u,considerationItem:o,allowPartialFills:f,orderStart:E,orderExpiry:h}=p;return {allowPartialFills:f,offer:[Bt(u)],consideration:[wt(o,i)],startTime:(E.getTime()/1e3).toFixed(0),endTime:(h.getTime()/1e3).toFixed(0),zone:this.zoneContractAddress,restrictedByZone:!0}}),i)}createSeaportOrder(i,s,a,p,u,o){return this.getSeaportLib().createOrder({allowPartialFills:p,offer:[Bt(s)],consideration:[wt(a,i)],startTime:(u.getTime()/1e3).toFixed(0),endTime:(o.getTime()/1e3).toFixed(0),zone:this.zoneContractAddress,restrictedByZone:!0},i)}async getTypedDataFromBulkOrderComponents(i,s){delete i.EIP712Domain;let{chainId:a}=await this.provider.getNetwork();return {domain:{name:Me,version:z,chainId:a,verifyingContract:this.seaportContractAddress},types:i,value:s}}async getTypedDataFromOrderComponents(i){let{chainId:s}=await this.provider.getNetwork();return {domain:{name:Me,version:z,chainId:s,verifyingContract:this.seaportContractAddress},types:Re,value:i}}getSeaportLib(i){let s=i?.protocol_data?.seaport_address??this.seaportContractAddress;return this.seaportLibFactory.create(s)}static getExpirationISOTimeFromExtraData(i){let s=i.slice(44,60),a=parseInt(s,16);return new Date(a*1e3).toISOString()}};function we(r){switch(r.itemType){case 0:return {type:"NATIVE",amount:r.startAmount};case 1:return {type:"ERC20",contract_address:r.token,amount:r.startAmount};case 2:return {type:"ERC721",contract_address:r.token,token_id:r.identifierOrCriteria};case 3:return {type:"ERC1155",contract_address:r.token,token_id:r.identifierOrCriteria,amount:r.startAmount};case 4:return {type:"ERC721_COLLECTION",contract_address:r.token,amount:r.startAmount};case 5:return {type:"ERC1155_COLLECTION",contract_address:r.token,amount:r.startAmount};default:return U(r.itemType)}}function be(r){if(r.itemType!==1)throw new Error(`Expected ERC20 item, got ${r.itemType}`);return {type:"ERC20",contract_address:r.token,amount:r.startAmount}}function ze(r){switch(r.itemType){case 4:return {type:"ERC721_COLLECTION",contract_address:r.token,amount:r.startAmount};case 5:return {type:"ERC1155_COLLECTION",contract_address:r.token,amount:r.startAmount};case 1:case 0:case 2:case 3:throw new Error(`Unsupported item type ${r.itemType}`);default:return U(r.itemType)}}function ce(r){switch(r){case 2:return V.order_type.FULL_RESTRICTED;case 3:return V.order_type.PARTIAL_RESTRICTED;case 0:case 1:throw new Error(`Unsupported order type ${r}`);default:return U()}}var Le=class{constructor(i,s,a){this.orderbookService=i;this.chainName=s;this.seaportAddress=a;}async fulfillmentData(i){return this.orderbookService.fulfillmentData({chainName:this.chainName,requestBody:i})}async getListing(i){return this.orderbookService.getListing({chainName:this.chainName,listingId:i})}async getBid(i){return this.orderbookService.getBid({chainName:this.chainName,bidId:i})}async getCollectionBid(i){return this.orderbookService.getCollectionBid({chainName:this.chainName,collectionBidId:i})}async getTraitBid(i){return this.orderbookService.getTraitBid({chainName:this.chainName,traitBidId:i})}async getTrade(i){return this.orderbookService.getTrade({chainName:this.chainName,tradeId:i})}async listListings(i){return this.orderbookService.listListings({chainName:this.chainName,...i})}async listBids(i){return this.orderbookService.listBids({chainName:this.chainName,...i})}async listCollectionBids(i){return this.orderbookService.listCollectionBids({chainName:this.chainName,...i})}async listTraitBids(i){return this.orderbookService.listTraitBids({chainName:this.chainName,...i})}async listTrades(i){return this.orderbookService.listTrades({chainName:this.chainName,...i})}async cancelOrders(i,s,a){return this.orderbookService.cancelOrders({chainName:this.chainName,requestBody:{account_address:s,orders:i,signature:a}})}async createListing({orderHash:i,orderComponents:s,orderSignature:a,makerFees:p}){if(s.offer.length!==1)throw new Error("Only one item can be listed for a listing");if(s.consideration.length!==1)throw new Error("Only one item can be used as currency for a listing");if(![2,3].includes(s.offer[0].itemType))throw new Error("Only ERC721 / ERC1155 tokens can be listed");if(![0,1].includes(s.consideration[0].itemType))throw new Error("Only Native / ERC20 tokens can be used as currency items in a listing");return this.orderbookService.createListing({chainName:this.chainName,requestBody:{account_address:s.offerer,buy:s.consideration.map(we),fees:p.map(u=>({type:D.type.MAKER_ECOSYSTEM,amount:u.amount,recipient_address:u.recipientAddress})),end_at:new Date(parseInt(`${s.endTime.toString()}000`,10)).toISOString(),order_hash:i,protocol_data:{order_type:ce(s.orderType),zone_address:s.zone,seaport_address:this.seaportAddress,seaport_version:z,counter:s.counter.toString()},salt:s.salt,sell:s.offer.map(we),signature:a,start_at:new Date(parseInt(`${s.startTime.toString()}000`,10)).toISOString()}})}async createBid({orderHash:i,orderComponents:s,orderSignature:a,makerFees:p}){if(s.offer.length!==1)throw new Error("Only one item can be listed for a bid");if(s.consideration.length!==1)throw new Error("Only one item can be used as currency for a bid");if(1!==s.offer[0].itemType)throw new Error("Only ERC20 tokens can be used as the currency item in a bid");if(![2,3].includes(s.consideration[0].itemType))throw new Error("Only ERC721 / ERC1155 tokens can be bid against");return this.orderbookService.createBid({chainName:this.chainName,requestBody:{account_address:s.offerer,buy:s.consideration.map(we),fees:p.map(u=>({type:D.type.MAKER_ECOSYSTEM,amount:u.amount,recipient_address:u.recipientAddress})),end_at:new Date(parseInt(`${s.endTime.toString()}000`,10)).toISOString(),order_hash:i,protocol_data:{order_type:ce(s.orderType),zone_address:s.zone,seaport_address:this.seaportAddress,seaport_version:z,counter:s.counter.toString()},salt:s.salt,sell:s.offer.map(be),signature:a,start_at:new Date(parseInt(`${s.startTime.toString()}000`,10)).toISOString()}})}async createCollectionBid({orderHash:i,orderComponents:s,orderSignature:a,makerFees:p}){if(s.offer.length!==1)throw new Error("Only one item can be listed for a collection bid");if(s.consideration.length!==1)throw new Error("Only one item can be used as currency for a collection bid");if(1!==s.offer[0].itemType)throw new Error("Only ERC20 tokens can be used as the currency item in a collection bid");if(![4,5].includes(s.consideration[0].itemType))throw new Error("Only ERC721 / ERC1155 collection based tokens can be bid against");return this.orderbookService.createCollectionBid({chainName:this.chainName,requestBody:{account_address:s.offerer,buy:s.consideration.map(ze),fees:p.map(u=>({type:D.type.MAKER_ECOSYSTEM,amount:u.amount,recipient_address:u.recipientAddress})),end_at:new Date(parseInt(`${s.endTime.toString()}000`,10)).toISOString(),order_hash:i,protocol_data:{order_type:ce(s.orderType),zone_address:s.zone,seaport_address:this.seaportAddress,seaport_version:z,counter:s.counter.toString()},salt:s.salt,sell:s.offer.map(be),signature:a,start_at:new Date(parseInt(`${s.startTime.toString()}000`,10)).toISOString()}})}async createTraitBid({orderHash:i,orderComponents:s,orderSignature:a,makerFees:p,traitCriteria:u}){if(s.offer.length!==1)throw new Error("Only one item can be listed for a trait bid");if(s.consideration.length!==1)throw new Error("Only one item can be used as currency for a trait bid");if(1!==s.offer[0].itemType)throw new Error("Only ERC20 tokens can be used as the currency item in a trait bid");if(![4,5].includes(s.consideration[0].itemType))throw new Error("Only ERC721 / ERC1155 collection based tokens can be bid against");if(!u?.length)throw new Error("At least one trait criterion is required for a trait bid");return this.orderbookService.createTraitBid({chainName:this.chainName,requestBody:{account_address:s.offerer,buy:s.consideration.map(ze),fees:p.map(o=>({type:D.type.MAKER_ECOSYSTEM,amount:o.amount,recipient_address:o.recipientAddress})),end_at:new Date(parseInt(`${s.endTime.toString()}000`,10)).toISOString(),order_hash:i,protocol_data:{order_type:ce(s.orderType),zone_address:s.zone,seaport_address:this.seaportAddress,seaport_version:z,counter:s.counter.toString()},salt:s.salt,sell:s.offer.map(be),signature:a,start_at:new Date(parseInt(`${s.startTime.toString()}000`,10)).toISOString(),trait_criteria:u.map(o=>({trait_type:o.traitType,values:o.values}))}})}};var Se=class{constructor(i,s,a,p){this.chainName=s;this.seaportAddress=a;this.orderbookClient=new se({BASE:i,HEADERS:p?{"x-api-key":p}:void 0});}orderbookClient;create(){return new Le(this.orderbookClient.orders,this.chainName,this.seaportAddress)}};var kr="imtbl-zkevm-testnet",Dr="imtbl-zkevm-mainnet";function Pe(r,i){let s=new FetchRequest(r);return i&&s.setHeader("x-api-key",i),new JsonRpcProvider(s)}function Lt(r){switch(r.baseConfig.environment){case Environment.SANDBOX:return {seaportContractAddress:"0x7d117aA8BD6D31c4fa91722f246388f38ab1942c",zoneContractAddress:"0x1004f9615E79462c711Ff05a386BdbA91a7628C3",apiEndpoint:"https://api.sandbox.immutable.com",chainName:kr,provider:Pe("https://rpc.testnet.immutable.com",r.baseConfig.rateLimitingKey)};case Environment.PRODUCTION:return {seaportContractAddress:"0x6c12aD6F0bD274191075Eb2E78D7dA5ba6453424",zoneContractAddress:"0x1004f9615E79462c711Ff05a386BdbA91a7628C3",apiEndpoint:"https://api.immutable.com",chainName:Dr,provider:Pe("https://rpc.immutable.com",r.baseConfig.rateLimitingKey)};default:return null}}var xe=class{constructor(i,s){this.defaultSeaportContractAddress=i;this.provider=s;}create(i){let s=i??this.defaultSeaportContractAddress,a=this.provider;return a.getSigner=async function(u){u==null&&(u=0);let o=this.send("eth_accounts",[]);if(typeof u=="number"){let f=await o;if(u>=f.length)throw new Error("no such account");return new JsonRpcSigner(this,f[u])}return new JsonRpcSigner(this,u)},new Seaport(a,{balanceAndApprovalChecksOnOrderCreation:!0,overrides:{contractAddress:s}})}};var Ge=class r{apiClient;seaport;orderbookConfig;constructor(i){let a={...Lt(i),...i.overrides};if(i.overrides?.jsonRpcProviderUrl&&(a.provider=Pe(i.overrides?.jsonRpcProviderUrl,i.baseConfig.rateLimitingKey)),!a)throw new Error("Orderbook configuration not passed, please specify the environment under config.baseConfig.environment");this.orderbookConfig=a;let{apiEndpoint:p,chainName:u}=this.orderbookConfig;if(!p)throw new Error("API endpoint must be provided");this.apiClient=new Se(p,u,this.orderbookConfig.seaportContractAddress,i.baseConfig.rateLimitingKey).create();let o=new xe(this.orderbookConfig.seaportContractAddress,this.orderbookConfig.provider);this.seaport=new Be(o,this.orderbookConfig.provider,this.orderbookConfig.seaportContractAddress,this.orderbookConfig.zoneContractAddress,i.baseConfig.rateLimitingKey);}static defaultOrderExpiry(){return new Date(Date.now()+1e3*60*60*24*365*2)}config(){return this.orderbookConfig}async getListing(i){let s=await this.apiClient.getListing(i);return {result:Y(s.result)}}async getBid(i){let s=await this.apiClient.getBid(i);return {result:ae(s.result)}}async getCollectionBid(i){let s=await this.apiClient.getCollectionBid(i);return {result:le(s.result)}}async getTraitBid(i){let s=await this.apiClient.getTraitBid(i);return {result:de(s.result)}}async getTrade(i){let s=await this.apiClient.getTrade(i);return {result:qe(s.result)}}async listListings(i){let s=await this.apiClient.listListings(i);return {page:Z(s.page),result:s.result.map(Y)}}async listBids(i){let s=await this.apiClient.listBids(i);return {page:Z(s.page),result:s.result.map(ae)}}async listCollectionBids(i){let s=await this.apiClient.listCollectionBids(i);return {page:Z(s.page),result:s.result.map(le)}}async listTraitBids(i){let s=await this.apiClient.listTraitBids(i);return {page:Z(s.page),result:s.result.map(de)}}async listTrades(i){let s=await this.apiClient.listTrades(i);return {page:Z(s.page),result:s.result.map(qe)}}async prepareBulkListings({makerAddress:i,listingParams:s}){if(s.length>20)throw new Error("Bulk listing creation is limited to 20 orders");if(s.length===1){let o=await this.seaport.prepareSeaportOrder(i,s[0].sell,s[0].buy,s[0].sell.type==="ERC1155",s[0].orderStart||new Date,s[0].orderExpiry||r.defaultOrderExpiry());return {actions:o.actions,completeListings:async f=>{let E=await this.createListing({makerFees:s[0].makerFees,orderComponents:o.orderComponents,orderHash:o.orderHash,orderSignature:typeof f=="string"?f:f[0]});return {result:[{success:!0,orderHash:o.orderHash,order:E.result}]}}}}if(await this.orderbookConfig.provider.getCode(i)!=="0x"){track("orderbookmr","bulkListings",{walletType:"Passport",makerAddress:i,listingsCount:s.length});let o=await Promise.all(s.map(h=>this.seaport.prepareSeaportOrder(i,h.sell,h.buy,h.sell.type==="ERC1155",h.orderStart||new Date,h.orderExpiry||r.defaultOrderExpiry()))),f=[];return {actions:o.flatMap(h=>{let g=[];return h.actions.forEach(R=>{if(R.type==="TRANSACTION"){let y=h.orderComponents.offer[0].token;f.includes(y)||(f.push(y),g.push(R));}else g.push(R);}),g}),completeListings:async h=>{if(typeof h=="string")throw new Error("A signature per listing must be provided for smart contract wallets");return {result:(await Promise.all(o.map((y,C)=>{let I=h[C];return this.apiClient.createListing({makerFees:s[C].makerFees,orderComponents:y.orderComponents,orderHash:y.orderHash,orderSignature:I}).catch(()=>{})}))).map((y,C)=>({success:!!y,orderHash:o[C].orderHash,order:y?Y(y.result):void 0}))}}}}track("orderbookmr","bulkListings",{walletType:"EOA",makerAddress:i,listingsCount:s.length});let{actions:p,preparedOrders:u}=await this.seaport.prepareBulkSeaportOrders(i,s.map(o=>({offerItem:o.sell,considerationItem:o.buy,allowPartialFills:o.sell.type==="ERC1155",orderStart:o.orderStart||new Date,orderExpiry:o.orderExpiry||r.defaultOrderExpiry()})));return {actions:p,completeListings:async o=>{let f=typeof o=="object";if(f&&o.length!==1)throw new Error("Only a single signature is expected for bulk listing creation");let E=u.map(y=>y.orderComponents),h=f?o[0]:o,g=Ot(h,E);return {result:(await Promise.all(E.map((y,C)=>{let I=g[C],_=u[C],S=s[C];return this.apiClient.createListing({orderComponents:y,orderHash:_.orderHash,orderSignature:I,makerFees:S.makerFees}).catch(()=>{})}))).map((y,C)=>({success:!!y,orderHash:u[C].orderHash,order:y?Y(y.result):void 0}))}}}}async prepareListing({makerAddress:i,sell:s,buy:a,orderStart:p,orderExpiry:u}){return this.seaport.prepareSeaportOrder(i,s,a,s.type==="ERC1155",p||new Date,u||r.defaultOrderExpiry())}async createListing(i){let s=await this.apiClient.createListing(i);return {result:Y(s.result)}}async prepareBid({makerAddress:i,sell:s,buy:a,orderStart:p,orderExpiry:u}){return this.seaport.prepareSeaportOrder(i,s,a,a.type==="ERC1155",p||new Date,u||r.defaultOrderExpiry())}async createBid(i){let s=await this.apiClient.createBid(i);return {result:ae(s.result)}}async prepareCollectionBid({makerAddress:i,sell:s,buy:a,orderStart:p,orderExpiry:u}){return this.seaport.prepareSeaportOrder(i,s,a,!0,p||new Date,u||r.defaultOrderExpiry())}async createCollectionBid(i){let s=await this.apiClient.createCollectionBid(i);return {result:le(s.result)}}async prepareTraitBid({makerAddress:i,sell:s,buy:a,orderStart:p,orderExpiry:u}){return this.seaport.prepareSeaportOrder(i,s,a,!0,p||new Date,u||r.defaultOrderExpiry())}async createTraitBid(i){let s=await this.apiClient.createTraitBid(i);return {result:de(s.result)}}async fulfillOrder(i,s,a,p,u){let o={order_id:i,taker_address:s,fees:a.map(R=>({type:D.type.TAKER_ECOSYSTEM,amount:R.amount,recipient_address:R.recipientAddress}))},f=u?[{identifier:u,proof:[]}]:void 0;u&&(o.token_id=u);let E=await this.apiClient.fulfillmentData([o]);if(E.result.unfulfillable_orders?.length>0)throw new Error(`Unable to prepare fulfillment data: ${E.result.unfulfillable_orders[0].reason}`);if(E.result.fulfillable_orders?.length!==1)throw new Error("unexpected fulfillable order result length");let h=E.result.fulfillable_orders[0].extra_data,g=E.result.fulfillable_orders[0].order;if(g.status.name!=="ACTIVE")throw new Error(`Cannot fulfil order that is not active. Current status: ${g.status}`);return this.seaport.fulfillOrder(g,s,h,p,f)}async fulfillBulkOrders(i,s){let a=i.map(u=>{let o="listingId"in u;return {orderId:o?u.listingId:u.orderId,takerFees:u.takerFees,amountToFill:u.amountToFill,tokenId:o?void 0:u.tokenId}}),p=await this.apiClient.fulfillmentData(a.map(u=>({order_id:u.orderId,taker_address:s,fees:u.takerFees.map(o=>({type:D.type.TAKER_ECOSYSTEM,amount:o.amount,recipient_address:o.recipientAddress})),token_id:u?.tokenId})));try{let u=p.result.fulfillable_orders.map(o=>{let f=a.find(h=>h.orderId===o.order.id&&h.tokenId===o.token_id);if(!f){let h=`Could not find order for order ${o.order.id}`;throw o.token_id&&(h+=` and token ID ${o.token_id}`),new Error(h)}let E=[];return f.tokenId&&E.push({identifier:f.tokenId,proof:[]}),{extraData:o.extra_data,order:o.order,unitsToFill:f.amountToFill,considerationCriteria:E}});return {...await this.seaport.fulfillBulkOrders(u,s),fulfillableOrders:p.result.fulfillable_orders.map(o=>ue(o.order)),unfulfillableOrders:p.result.unfulfillable_orders.map(o=>({orderId:o.order_id,tokenId:o.token_id,reason:o.reason})),sufficientBalance:!0}}catch(u){if(String(u).includes("The fulfiller does not have the balances needed to fulfill."))return {fulfillableOrders:p.result.fulfillable_orders.map(o=>ue(o.order)),unfulfillableOrders:p.result.unfulfillable_orders.map(o=>({orderId:o.order_id,reason:o.reason})),sufficientBalance:!1};throw u}}async prepareOrderCancellations(i){let s=await this.orderbookConfig.provider.getNetwork(),a={name:"imtbl-order-book",chainId:Number(s.chainId),verifyingContract:this.orderbookConfig.seaportContractAddress},p={CancelPayload:[{name:"orders",type:"Order[]"}],Order:[{name:"id",type:"string"}]},u={orders:i.map(o=>({id:o}))};return {signableAction:{purpose:"OFF_CHAIN_CANCELLATION",type:"SIGNABLE",message:{domain:a,types:p,value:u}}}}async cancelOrders(i,s,a){return this.apiClient.cancelOrders(i,s,a)}async cancelOrdersOnChain(i,s){let a=Promise.all(i.map(R=>this.apiClient.getListing(R).catch(y=>{if(y.status!==404)throw y}))),p=Promise.all(i.map(R=>this.apiClient.getBid(R).catch(y=>{if(y.status!==404)throw y}))),u=Promise.all(i.map(R=>this.apiClient.getCollectionBid(R).catch(y=>{if(y.status!==404)throw y}))),o=Promise.all(i.map(R=>this.apiClient.getTraitBid(R).catch(y=>{if(y.status!==404)throw y}))),f=[await Promise.all([a,p,u,o])].flat(2).filter(R=>R!==void 0).map(R=>R.result);if(f.length!==i.length){let R=i.filter(y=>!f.some(C=>C.id===y));throw new Error(`Orders ${R} not found`)}for(let R of f)if(R.account_address!==s.toLowerCase())throw new Error(`Only account ${R.account_address} can cancel order ${R.id}`);let E=f.map(R=>R.protocol_data.seaport_address);if(new Set(E).size!==1)throw new Error("Cannot cancel multiple orders from different seaport contracts. Please group your orderIds accordingly");return {cancellationAction:await this.seaport.cancelOrders(f,s)}}};var vr={estimatedFulfillmentGasGwei:4e5};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
10
10
|
|
|
11
|
-
export {
|
|
11
|
+
export { Ue as ActionType, cr as FeeType, ge as OrderStatusName, Ge as Orderbook, He as SignablePurpose, ct as TransactionPurpose, vr as constants };
|