diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..636ca85 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,9 @@ +## v2.0.0 + +- Update packages +- Migrate from @project-serum/anchor -> @coral-xyz/anchor + +### Breaking changes +- Token instruction `setAuthority`, arg `authorityType` changed from `@solana/spl-token AuthorityType` to IDL enum +- Token instruction `initializeAccount3`, arg `authority` renamed to `owner` +- Token instruction `initializeAccount2`, arg `authority` renamed to `owner` \ No newline at end of file diff --git a/dist/browser/index.js b/dist/browser/index.js index 7f8b432..4d3a0b6 100644 --- a/dist/browser/index.js +++ b/dist/browser/index.js @@ -1,4 +1,4 @@ -import{PublicKey as t,TransactionInstruction as e,SystemProgram as n,Transaction as r,SystemInstruction as o}from"@solana/web3.js";import{utils as i,BN as s,BorshInstructionCoder as a}from"@project-serum/anchor";for(var u={},c={byteLength:function(t){var e=y(t),n=e[0],r=e[1];return 3*(n+r)/4-r},toByteArray:function(t){var e,n,r=y(t),o=r[0],i=r[1],s=new d(function(t,e,n){return 3*(e+n)/4-n}(0,o,i)),a=0,u=i>0?o-4:o;for(n=0;n>16&255,s[a++]=e>>8&255,s[a++]=255&e;2===i&&(e=h[t.charCodeAt(n)]<<2|h[t.charCodeAt(n+1)]>>4,s[a++]=255&e);1===i&&(e=h[t.charCodeAt(n)]<<10|h[t.charCodeAt(n+1)]<<4|h[t.charCodeAt(n+2)]>>2,s[a++]=e>>8&255,s[a++]=255&e);return s},fromByteArray:function(t){for(var e,n=t.length,r=n%3,o=[],i=16383,s=0,a=n-r;sa?a:s+i));1===r?(e=t[n-1],o.push(f[e>>2]+f[e<<4&63]+"==")):2===r&&(e=(t[n-2]<<8)+t[n-1],o.push(f[e>>10]+f[e>>4&63]+f[e<<2&63]+"="));return o.join("")}},f=[],h=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,g=l.length;p0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function m(t,e,n){for(var r,o,i=[],s=e;s>18&63]+f[o>>12&63]+f[o>>6&63]+f[63&o]);return i.join("")}h["-".charCodeAt(0)]=62,h["_".charCodeAt(0)]=63;var w={ +import{PublicKey as t,TransactionInstruction as e,SystemProgram as n,Transaction as r,SystemInstruction as o}from"@solana/web3.js";import{utils as i,BN as s,BorshInstructionCoder as a}from"@coral-xyz/anchor";for(var u={},c={byteLength:function(t){var e=g(t),n=e[0],r=e[1];return 3*(n+r)/4-r},toByteArray:function(t){var e,n,r=g(t),o=r[0],i=r[1],s=new d(function(t,e,n){return 3*(e+n)/4-n}(0,o,i)),a=0,u=i>0?o-4:o;for(n=0;n>16&255,s[a++]=e>>8&255,s[a++]=255&e;2===i&&(e=h[t.charCodeAt(n)]<<2|h[t.charCodeAt(n+1)]>>4,s[a++]=255&e);1===i&&(e=h[t.charCodeAt(n)]<<10|h[t.charCodeAt(n+1)]<<4|h[t.charCodeAt(n+2)]>>2,s[a++]=e>>8&255,s[a++]=255&e);return s},fromByteArray:function(t){for(var e,n=t.length,r=n%3,o=[],i=16383,s=0,a=n-r;sa?a:s+i));1===r?(e=t[n-1],o.push(f[e>>2]+f[e<<4&63]+"==")):2===r&&(e=(t[n-2]<<8)+t[n-1],o.push(f[e>>10]+f[e>>4&63]+f[e<<2&63]+"="));return o.join("")}},f=[],h=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0;p<64;++p)f[p]=l[p],h[l.charCodeAt(p)]=p;function g(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function y(t,e,n){for(var r,o,i=[],s=e;s>18&63]+f[o>>12&63]+f[o>>6&63]+f[63&o]);return i.join("")}h["-".charCodeAt(0)]=62,h["_".charCodeAt(0)]=63;var m={ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ read:function(t,e,n,r,o){var i,s,a=8*o-r-1,u=(1<>1,f=-7,h=n?o-1:0,d=n?-1:1,l=t[e+h];for(h+=d,i=l&(1<<-f)-1,l>>=-f,f+=a;f>0;i=256*i+t[e+h],h+=d,f-=8);for(s=i&(1<<-f)-1,i>>=-f,f+=r;f>0;s=256*s+t[e+h],h+=d,f-=8);if(0===i)i=1-c;else{if(i===u)return s?NaN:1/0*(l?-1:1);s+=Math.pow(2,r),i-=c}return(l?-1:1)*s*Math.pow(2,i-r)},write:function(t,e,n,r,o,i){var s,a,u,c=8*i-o-1,f=(1<>1,d=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,l=r?0:i-1,p=r?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=f):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+h>=1?d/u:d*Math.pow(2,1-h))*u>=2&&(s++,u/=2),s+h>=f?(a=0,s=f):s+h>=1?(a=(e*u-1)*Math.pow(2,o),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,o),s=0));o>=8;t[n+l]=255&a,l+=p,a/=256,o-=8);for(s=s<0;t[n+l]=255&s,l+=p,s/=256,c-=8);t[n+l-p]|=128*g}}; /*! @@ -7,5 +7,5 @@ read:function(t,e,n,r,o){var i,s,a=8*o-r-1,u=(1<>1,f=-7,h=n?o-1:0,d=n? * @author Feross Aboukhadijeh * @license MIT */ -!function(t){const e=c,n=w,r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=s,t.SlowBuffer=function(t){+t!=t&&(t=0);return s.alloc(+t)},t.INSPECT_MAX_BYTES=50;const o=2147483647;function i(t){if(t>o)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,s.prototype),e}function s(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return f(t)}return a(t,e,n)}function a(t,e,n){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const n=0|p(t,e);let r=i(n);const o=r.write(t,e);o!==n&&(r=r.slice(0,o));return r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Y(t,Uint8Array)){const e=new Uint8Array(t);return d(e.buffer,e.byteOffset,e.byteLength)}return h(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Y(t,ArrayBuffer)||t&&Y(t.buffer,ArrayBuffer))return d(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(Y(t,SharedArrayBuffer)||t&&Y(t.buffer,SharedArrayBuffer)))return d(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return s.from(r,e,n);const o=function(t){if(s.isBuffer(t)){const e=0|l(t.length),n=i(e);return 0===n.length||t.copy(n,0,0,e),n}if(void 0!==t.length)return"number"!=typeof t.length||Z(t.length)?i(0):h(t);if("Buffer"===t.type&&Array.isArray(t.data))return h(t.data)}(t);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return s.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function u(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function f(t){return u(t),i(t<0?0:0|l(t))}function h(t){const e=t.length<0?0:0|l(t.length),n=i(e);for(let r=0;r=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|t}function p(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Y(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let o=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return G(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return H(t).length;default:if(o)return r?-1:G(t).length;e=(""+e).toLowerCase(),o=!0}}function g(t,e,n){let r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return P(this,e,n);case"utf8":case"utf-8":return B(this,e,n);case"ascii":return U(this,e,n);case"latin1":case"binary":return x(this,e,n);case"base64":return v(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function y(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function m(t,e,n,r,o){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),Z(n=+n)&&(n=o?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(o)return-1;n=t.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof e&&(e=s.from(e,r)),s.isBuffer(e))return 0===e.length?-1:b(t,e,n,r,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):b(t,[e],n,r,o);throw new TypeError("val must be string, number or Buffer")}function b(t,e,n,r,o){let i,s=1,a=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,n/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(o){let r=-1;for(i=n;ia&&(n=a-u),i=n;i>=0;i--){let n=!0;for(let r=0;ro&&(r=o):r=o;const i=e.length;let s;for(r>i/2&&(r=i/2),s=0;s>8,o=n%256,i.push(o),i.push(r);return i}(e,t.length-n),t,n,r)}function v(t,n,r){return 0===n&&r===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(n,r))}function B(t,e,n){n=Math.min(t.length,n);const r=[];let o=e;for(;o239?4:e>223?3:e>191?2:1;if(o+s<=n){let n,r,a,u;switch(s){case 1:e<128&&(i=e);break;case 2:n=t[o+1],128==(192&n)&&(u=(31&e)<<6|63&n,u>127&&(i=u));break;case 3:n=t[o+1],r=t[o+2],128==(192&n)&&128==(192&r)&&(u=(15&e)<<12|(63&n)<<6|63&r,u>2047&&(u<55296||u>57343)&&(i=u));break;case 4:n=t[o+1],r=t[o+2],a=t[o+3],128==(192&n)&&128==(192&r)&&128==(192&a)&&(u=(15&e)<<18|(63&n)<<12|(63&r)<<6|63&a,u>65535&&u<1114112&&(i=u))}}null===i?(i=65533,s=1):i>65535&&(i-=65536,r.push(i>>>10&1023|55296),i=56320|1023&i),r.push(i),o+=s}return function(t){const e=t.length;if(e<=T)return String.fromCharCode.apply(String,t);let n="",r=0;for(;rr.length?(s.isBuffer(e)||(e=s.from(e)),e.copy(r,o)):Uint8Array.prototype.set.call(r,e,o);else{if(!s.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,o)}o+=e.length}return r},s.byteLength=p,s.prototype._isBuffer=!0,s.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;en&&(e+=" ... "),""},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(t,e,n,r,o){if(Y(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),e<0||n>t.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&e>=n)return 0;if(r>=o)return-1;if(e>=n)return 1;if(this===t)return 0;let i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(e>>>=0);const u=Math.min(i,a),c=this.slice(r,o),f=t.slice(e,n);for(let t=0;t>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const o=this.length-e;if((void 0===n||n>o)&&(n=o),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let i=!1;for(;;)switch(r){case"hex":return k(this,t,e,n);case"utf8":case"utf-8":return I(this,t,e,n);case"ascii":case"latin1":case"binary":return A(this,t,e,n);case"base64":return E(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,e,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const T=4096;function U(t,e,n){let r="";n=Math.min(t.length,n);for(let o=e;or)&&(n=r);let o="";for(let r=e;rn)throw new RangeError("Trying to access beyond buffer length")}function M(t,e,n,r,o,i){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||et.length)throw new RangeError("Index out of range")}function z(t,e,n,r,o){W(e,r,o,t,n,7);let i=Number(e&BigInt(4294967295));t[n++]=i,i>>=8,t[n++]=i,i>>=8,t[n++]=i,i>>=8,t[n++]=i;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,n}function R(t,e,n,r,o){W(e,r,o,t,n,7);let i=Number(e&BigInt(4294967295));t[n+7]=i,i>>=8,t[n+6]=i,i>>=8,t[n+5]=i,i>>=8,t[n+4]=i;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=s,s>>=8,t[n+2]=s,s>>=8,t[n+1]=s,s>>=8,t[n]=s,n+8}function O(t,e,n,r,o,i){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function F(t,e,r,o,i){return e=+e,r>>>=0,i||O(t,0,r,4),n.write(t,e,r,o,23,4),r+4}function N(t,e,r,o,i){return e=+e,r>>>=0,i||O(t,0,r,8),n.write(t,e,r,o,52,8),r+8}s.prototype.slice=function(t,e){const n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e>>=0,e>>>=0,n||C(t,e,this.length);let r=this[t],o=1,i=0;for(;++i>>=0,e>>>=0,n||C(t,e,this.length);let r=this[t+--e],o=1;for(;e>0&&(o*=256);)r+=this[t+--e]*o;return r},s.prototype.readUint8=s.prototype.readUInt8=function(t,e){return t>>>=0,e||C(t,1,this.length),this[t]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||C(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||C(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||C(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(t,e){return t>>>=0,e||C(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readBigUInt64LE=X((function(t){j(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||q(t,this.length-8);const r=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,o=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(r)+(BigInt(o)<>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||q(t,this.length-8);const r=e*2**24+65536*this[++t]+256*this[++t]+this[++t],o=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(r)<>>=0,e>>>=0,n||C(t,e,this.length);let r=this[t],o=1,i=0;for(;++i=o&&(r-=Math.pow(2,8*e)),r},s.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||C(t,e,this.length);let r=e,o=1,i=this[t+--r];for(;r>0&&(o*=256);)i+=this[t+--r]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i},s.prototype.readInt8=function(t,e){return t>>>=0,e||C(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||C(t,2,this.length);const n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt16BE=function(t,e){t>>>=0,e||C(t,2,this.length);const n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt32LE=function(t,e){return t>>>=0,e||C(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return t>>>=0,e||C(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readBigInt64LE=X((function(t){j(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||q(t,this.length-8);const r=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||q(t,this.length-8);const r=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(r)<>>=0,e||C(t,4,this.length),n.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||C(t,4,this.length),n.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||C(t,8,this.length),n.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||C(t,8,this.length),n.read(this,t,!1,52,8)},s.prototype.writeUintLE=s.prototype.writeUIntLE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){M(this,t,e,n,Math.pow(2,8*n)-1,0)}let o=1,i=0;for(this[e]=255&t;++i>>=0,n>>>=0,!r){M(this,t,e,n,Math.pow(2,8*n)-1,0)}let o=n-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||M(this,t,e,1,255,0),this[e]=255&t,e+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||M(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||M(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||M(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||M(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeBigUInt64LE=X((function(t,e=0){return z(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeBigUInt64BE=X((function(t,e=0){return R(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);M(this,t,e,n,r-1,-r)}let o=0,i=1,s=0;for(this[e]=255&t;++o>0)-s&255;return e+n},s.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);M(this,t,e,n,r-1,-r)}let o=n-1,i=1,s=0;for(this[e+o]=255&t;--o>=0&&(i*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/i>>0)-s&255;return e+n},s.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||M(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||M(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||M(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||M(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},s.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||M(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeBigInt64LE=X((function(t,e=0){return z(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeBigInt64BE=X((function(t,e=0){return R(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeFloatLE=function(t,e,n){return F(this,t,e,!0,n)},s.prototype.writeFloatBE=function(t,e,n){return F(this,t,e,!1,n)},s.prototype.writeDoubleLE=function(t,e,n){return N(this,t,e,!0,n)},s.prototype.writeDoubleBE=function(t,e,n){return N(this,t,e,!1,n)},s.prototype.copy=function(t,e,n,r){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function W(t,e,n,r,o,i){if(t>n||t3?0===e||e===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(i+1)}${r}`:`>= -(2${r} ** ${8*(i+1)-1}${r}) and < 2 ** ${8*(i+1)-1}${r}`:`>= ${e}${r} and <= ${n}${r}`,new _.ERR_OUT_OF_RANGE("value",o,t)}!function(t,e,n){j(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||q(e,t.length-(n+1))}(r,o,i)}function j(t,e){if("number"!=typeof t)throw new _.ERR_INVALID_ARG_TYPE(e,"number",t)}function q(t,e,n){if(Math.floor(t)!==t)throw j(t,n),new _.ERR_OUT_OF_RANGE(n||"offset","an integer",t);if(e<0)throw new _.ERR_BUFFER_OUT_OF_BOUNDS;throw new _.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}D("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),D("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),D("ERR_OUT_OF_RANGE",(function(t,e,n){let r=`The value of "${t}" is out of range.`,o=n;return Number.isInteger(n)&&Math.abs(n)>2**32?o=$(String(n)):"bigint"==typeof n&&(o=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(o=$(o)),o+="n"),r+=` It must be ${e}. Received ${o}`,r}),RangeError);const V=/[^+/0-9A-Za-z-_]/g;function G(t,e){let n;e=e||1/0;const r=t.length;let o=null;const i=[];for(let s=0;s55295&&n<57344){if(!o){if(n>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(e-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((e-=1)<0)break;i.push(n)}else if(n<2048){if((e-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function H(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(V,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function J(t,e,n,r){let o;for(o=0;o=e.length||o>=t.length);++o)e[o+n]=t[o];return o}function Y(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function Z(t){return t!=t}const K=function(){const t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let o=0;o<16;++o)e[r+o]=t[n]+t[o]}return e}();function X(t){return"undefined"==typeof BigInt?Q:t}function Q(){throw new Error("BigInt not supported")}}(u);const b=new t("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");new t("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");const k=new t("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");new t("So11111111111111111111111111111111111111112"),new t("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");var I={};Object.defineProperty(I,"__esModule",{value:!0});var A=I.s16=I.s8=I.nu64be=I.u48be=I.u40be=I.u32be=I.u24be=I.u16be=I.nu64=I.u48=I.u40=ut=I.u32=I.u24=at=I.u16=st=I.u8=I.offset=I.greedy=I.Constant=I.UTF8=I.CString=I.Blob=I.Boolean=I.BitField=I.BitStructure=I.VariantLayout=I.Union=I.UnionLayoutDiscriminator=I.UnionDiscriminator=I.Structure=I.Sequence=I.DoubleBE=I.Double=I.FloatBE=I.Float=I.NearInt64BE=I.NearInt64=I.NearUInt64BE=I.NearUInt64=I.IntBE=I.Int=I.UIntBE=I.UInt=I.OffsetLayout=I.GreedyCount=I.ExternalLayout=I.bindConstructorLayout=I.nameWithProperty=I.Layout=I.uint8ArrayToBuffer=I.checkUint8Array=void 0;I.constant=I.utf8=I.cstr=ht=I.blob=I.unionLayoutDiscriminator=I.union=I.seq=I.bits=ft=I.struct=I.f64be=I.f64=I.f32be=I.f32=I.ns64be=I.s48be=I.s40be=I.s32be=I.s24be=I.s16be=ct=I.ns64=I.s48=I.s40=I.s32=I.s24=void 0;const E=u;function S(t){if(!(t instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}function v(t){return S(t),E.Buffer.from(t.buffer,t.byteOffset,t.length)}I.checkUint8Array=S,I.uint8ArrayToBuffer=v;class B{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}function T(t,e){return e.property?t+"["+e.property+"]":t}I.Layout=B,I.nameWithProperty=T,I.bindConstructorLayout=function(t,e){if("function"!=typeof t)throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(t,"layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof B))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(e,"boundConstructor_"))throw new Error("layout is already bound to a constructor");t.layout_=e,e.boundConstructor_=t,e.makeDestinationObject=()=>new t,Object.defineProperty(t.prototype,"encode",{value(t,n){return e.encode(this,t,n)},writable:!0}),Object.defineProperty(t,"decode",{value:(t,n)=>e.decode(t,n),writable:!0})};class U extends B{isCount(){throw new Error("ExternalLayout is abstract")}}I.ExternalLayout=U;class x extends U{constructor(t=1,e){if(!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,e),this.elementSpan=t}isCount(){return!0}decode(t,e=0){S(t);const n=t.length-e;return Math.floor(n/this.elementSpan)}encode(t,e,n){return 0}}I.GreedyCount=x;class P extends U{constructor(t,e=0,n){if(!(t instanceof B))throw new TypeError("layout must be a Layout");if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof L||this.layout instanceof C}decode(t,e=0){return this.layout.decode(t,e+this.offset)}encode(t,e,n=0){return this.layout.encode(t,e,n+this.offset)}}I.OffsetLayout=P;class L extends B{constructor(t,e){if(super(t,e),6t+r.encode(o,e,n+t)),0);return this.count instanceof U&&this.count.encode(t.length,e,n),o}}I.Sequence=G;class H extends B{constructor(t,e,n){if(!Array.isArray(t)||!t.reduce(((t,e)=>t&&e instanceof B),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof e&&void 0===n&&(n=e,e=void 0);for(const e of t)if(0>e.span&&void 0===e.property)throw new Error("fields cannot contain unnamed variable-length layout");let r=-1;try{r=t.reduce(((t,e)=>t+e.getSpan()),0)}catch(t){}super(r,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e=0){if(0<=this.span)return this.span;let n=0;try{n=this.fields.reduce(((n,r)=>{const o=r.getSpan(t,e);return e+=o,n+o}),0)}catch(t){throw new RangeError("indeterminate span")}return n}decode(t,e=0){S(t);const n=this.makeDestinationObject();for(const r of this.fields)if(void 0!==r.property&&(n[r.property]=r.decode(t,e)),e+=r.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n=0){const r=n;let o=0,i=0;for(const r of this.fields){let s=r.span;if(i=0s&&(s=r.getSpan(e,n)))}o=n,n+=s}return o+i-r}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)void 0!==n.property&&0n.span?e=-1:0<=e&&(e+=n.span)}}}I.Structure=H;class J{constructor(t){this.property=t}decode(t,e){throw new Error("UnionDiscriminator is abstract")}encode(t,e,n){throw new Error("UnionDiscriminator is abstract")}}I.UnionDiscriminator=J;class Y extends J{constructor(t,e){if(!(t instanceof U&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}}I.UnionLayoutDiscriminator=Y;class Z extends B{constructor(t,e,n){let r;if(t instanceof L||t instanceof C)r=new Y(new P(t));else if(t instanceof U&&t.isCount())r=new Y(t);else{if(!(t instanceof J))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");r=t}if(void 0===e&&(e=null),!(null===e||e instanceof B))throw new TypeError("defaultLayout must be null or a Layout");if(null!==e){if(0>e.span)throw new Error("defaultLayout must have constant span");void 0===e.property&&(e=e.replicate("content"))}let o=-1;e&&(o=e.span,0<=o&&(t instanceof L||t instanceof C)&&(o+=r.layout.span)),super(o,n),this.discriminator=r,this.usesPrefixDiscriminator=t instanceof L||t instanceof C,this.defaultLayout=e,this.registry={};let i=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(t){return i(t)},this.configGetSourceVariant=function(t){i=t.bind(this)}}getSpan(t,e=0){if(0<=this.span)return this.span;const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(Object.prototype.hasOwnProperty.call(t,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(t,this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||e.property&&Object.prototype.hasOwnProperty.call(t,e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(n.property&&Object.prototype.hasOwnProperty.call(t,n.property))return n}throw new Error("unable to infer src variant")}decode(t,e=0){let n;const r=this.discriminator,o=r.decode(t,e),i=this.registry[o];if(void 0===i){const i=this.defaultLayout;let s=0;this.usesPrefixDiscriminator&&(s=r.layout.span),n=this.makeDestinationObject(),n[r.property]=o,n[i.property]=i.decode(t,e+s)}else n=i.decode(t,e);return n}encode(t,e,n=0){const r=this.getSourceVariant(t);if(void 0===r){const r=this.discriminator,o=this.defaultLayout;let i=0;return this.usesPrefixDiscriminator&&(i=r.layout.span),r.encode(t[r.property],e,n),i+o.encode(t[o.property],e,n+i)}return r.encode(t,e,n)}addVariant(t,e,n){const r=new K(this,t,e,n);return this.registry[t]=r,r}getVariant(t,e=0){let n;return n=t instanceof Uint8Array?this.discriminator.decode(t,e):t,this.registry[n]}}I.Union=Z;class K extends B{constructor(t,e,n,r){if(!(t instanceof Z))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if("string"==typeof n&&void 0===r&&(r=n,n=null),n){if(!(n instanceof B))throw new TypeError("layout must be a Layout");if(null!==t.defaultLayout&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if("string"!=typeof r)throw new TypeError("variant must have a String property")}let o=t.span;0>t.span&&(o=n?n.span:0,0<=o&&t.usesPrefixDiscriminator&&(o+=t.discriminator.layout.span)),super(o,r),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e=0){if(0<=this.span)return this.span;let n=0;this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span);let r=0;return this.layout&&(r=this.layout.getSpan(t,e+n)),n+r}decode(t,e=0){const n=this.makeDestinationObject();if(this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let r=0;return this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n=0){let r=0;if(this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(t,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let o=r;if(this.layout&&(this.layout.encode(t[this.property],e,n+r),o+=this.layout.getSpan(e,n+r),0<=this.union.span&&o>this.union.span))throw new Error("encoded variant overruns containing union");return o}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}function X(t){return 0>t&&(t+=4294967296),t}I.VariantLayout=K;class Q extends B{constructor(t,e,n){if(!(t instanceof L||t instanceof C))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof e&&void 0===n&&(n=e,e=!1),4=e)throw new TypeError("bits must be positive integer");const r=8*t.span,o=t.fields.reduce(((t,e)=>t+e.bits),0);if(e+o>r)throw new Error("bits too long for span remainder ("+(r-o)+" of "+r+" remain)");this.container=t,this.bits=e,this.valueMask=(1<>>this.start}encode(t){if("number"!=typeof t||!Number.isInteger(t)||t!==X(t&this.valueMask))throw new TypeError(T("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),n=X(t<n&&(n=this.length.decode(t,e)),n}decode(t,e=0){let n=this.span;return 0>n&&(n=this.length.decode(t,e)),v(t).slice(e,e+n)}encode(t,e,n){let r=this.length;if(this.length instanceof U&&(r=t.length),!(t instanceof Uint8Array&&r===t.length))throw new TypeError(T("Blob.encode",this)+" requires (length "+r+") Uint8Array as src");if(n+r>e.length)throw new RangeError("encoding overruns Uint8Array");const o=v(t);return v(e).write(o.toString("hex"),n,r,"hex"),this.length instanceof U&&this.length.encode(r,e,n),r}}I.Blob=nt;class rt extends B{constructor(t){super(-1,t)}getSpan(t,e=0){S(t);let n=e;for(;ne.length)throw new RangeError("encoding overruns Buffer");const i=v(e);return r.copy(i,n),i[n+o]=0,o+1}}I.CString=rt;class ot extends B{constructor(t,e){if("string"==typeof t&&void 0===e&&(e=t,t=void 0),void 0===t)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,e),this.maxSpan=t}getSpan(t,e=0){return S(t),t.length-e}decode(t,e=0){const n=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpane.length)throw new RangeError("encoding overruns Buffer");return r.copy(v(e),n),o}}I.UTF8=ot;class it extends B{constructor(t,e){super(0,e),this.value=t}decode(t,e){return this.value}encode(t,e,n){return 0}}I.Constant=it,I.greedy=(t,e)=>new x(t,e),I.offset=(t,e,n)=>new P(t,e,n);var st=I.u8=t=>new L(1,t),at=I.u16=t=>new L(2,t);I.u24=t=>new L(3,t);var ut=I.u32=t=>new L(4,t);I.u40=t=>new L(5,t),I.u48=t=>new L(6,t),I.nu64=t=>new N(t),I.u16be=t=>new C(2,t),I.u24be=t=>new C(3,t),I.u32be=t=>new C(4,t),I.u40be=t=>new C(5,t),I.u48be=t=>new C(6,t),I.nu64be=t=>new _(t),I.s8=t=>new M(1,t),A=I.s16=t=>new M(2,t),I.s24=t=>new M(3,t),I.s32=t=>new M(4,t),I.s40=t=>new M(5,t),I.s48=t=>new M(6,t);var ct=I.ns64=t=>new D(t);I.s16be=t=>new z(2,t),I.s24be=t=>new z(3,t),I.s32be=t=>new z(4,t),I.s40be=t=>new z(5,t),I.s48be=t=>new z(6,t),I.ns64be=t=>new $(t),I.f32=t=>new W(t),I.f32be=t=>new j(t),I.f64=t=>new q(t),I.f64be=t=>new V(t);var ft=I.struct=(t,e,n)=>new H(t,e,n);I.bits=(t,e,n)=>new Q(t,e,n),I.seq=(t,e,n)=>new G(t,e,n),I.union=(t,e,n)=>new Z(t,e,n),I.unionLayoutDiscriminator=(t,e)=>new Y(t,e);var ht=I.blob=(t,e)=>new nt(t,e);I.cstr=t=>new rt(t),I.utf8=(t,e)=>new ot(t,e),I.constant=(t,e)=>new it(t,e);const dt=t=>({decode:t.decode.bind(t),encode:t.encode.bind(t)});var lt={};Object.defineProperty(lt,"__esModule",{value:!0});var pt=lt.toBigIntLE=function(t){{const e=Buffer.from(t);e.reverse();const n=e.toString("hex");return 0===n.length?BigInt(0):BigInt(`0x${n}`)}};lt.toBigIntBE=function(t){{const e=t.toString("hex");return 0===e.length?BigInt(0):BigInt(`0x${e}`)}};var gt=lt.toBufferLE=function(t,e){{const n=t.toString(16),r=Buffer.from(n.padStart(2*e,"0").slice(0,2*e),"hex");return r.reverse(),r}};lt.toBufferBE=function(t,e){{const n=t.toString(16);return Buffer.from(n.padStart(2*e,"0").slice(0,2*e),"hex")}};const yt=(mt=8,t=>{const e=ht(mt,t),{encode:n,decode:r}=dt(e),o=e;return o.decode=(t,e)=>{const n=r(t,e);return pt(Buffer.from(n))},o.encode=(t,e,r)=>{const o=gt(t,mt);return n(o,e,r)},o});var mt;const wt=t=>{const e=st(t),{encode:n,decode:r}=dt(e),o=e;return o.decode=(t,e)=>!!r(t,e),o.encode=(t,e,r)=>{const o=Number(t);return n(o,e,r)},o},bt=e=>{const n=ht(32,e),{encode:r,decode:o}=dt(n),i=n;return i.decode=(e,n)=>{const r=o(e,n);return new t(r)},i.encode=(t,e,n)=>{const o=t.toBuffer();return r(o,e,n)},i};class kt extends Error{constructor(t){super(t)}}class It extends kt{constructor(){super(...arguments),this.name="TokenInvalidInstructionProgramError"}}class At extends kt{constructor(){super(...arguments),this.name="TokenInvalidInstructionKeysError"}}class Et extends kt{constructor(){super(...arguments),this.name="TokenInvalidInstructionDataError"}}class St extends kt{constructor(){super(...arguments),this.name="TokenInvalidInstructionTypeError"}}var vt;!function(t){t[t.InitializeMint=0]="InitializeMint",t[t.InitializeAccount=1]="InitializeAccount",t[t.InitializeMultisig=2]="InitializeMultisig",t[t.Transfer=3]="Transfer",t[t.Approve=4]="Approve",t[t.Revoke=5]="Revoke",t[t.SetAuthority=6]="SetAuthority",t[t.MintTo=7]="MintTo",t[t.Burn=8]="Burn",t[t.CloseAccount=9]="CloseAccount",t[t.FreezeAccount=10]="FreezeAccount",t[t.ThawAccount=11]="ThawAccount",t[t.TransferChecked=12]="TransferChecked",t[t.ApproveChecked=13]="ApproveChecked",t[t.MintToChecked=14]="MintToChecked",t[t.BurnChecked=15]="BurnChecked",t[t.InitializeAccount2=16]="InitializeAccount2",t[t.SyncNative=17]="SyncNative",t[t.InitializeAccount3=18]="InitializeAccount3",t[t.InitializeMultisig2=19]="InitializeMultisig2",t[t.InitializeMint2=20]="InitializeMint2",t[t.GetAccountDataSize=21]="GetAccountDataSize",t[t.InitializeImmutableOwner=22]="InitializeImmutableOwner",t[t.AmountToUiAmount=23]="AmountToUiAmount",t[t.UiAmountToAmount=24]="UiAmountToAmount",t[t.InitializeMintCloseAuthority=25]="InitializeMintCloseAuthority",t[t.TransferFeeExtension=26]="TransferFeeExtension",t[t.ConfidentialTransferExtension=27]="ConfidentialTransferExtension",t[t.DefaultAccountStateExtension=28]="DefaultAccountStateExtension",t[t.Reallocate=29]="Reallocate",t[t.MemoTransferExtension=30]="MemoTransferExtension",t[t.CreateNativeMint=31]="CreateNativeMint",t[t.InitializeNonTransferableMint=32]="InitializeNonTransferableMint",t[t.InterestBearingMintExtension=33]="InterestBearingMintExtension",t[t.CpiGuardExtension=34]="CpiGuardExtension",t[t.InitializePermanentDelegate=35]="InitializePermanentDelegate"}(vt||(vt={})),ft([st("instruction"),yt("amount")]);const Bt=ft([st("instruction"),yt("amount")]);function Tt(t,e=b){if(!t.programId.equals(e))throw new It;if(t.data.length!==Bt.span)throw new Et;const{keys:{account:n,delegate:r,owner:o,multiSigners:i},data:s}=function({programId:t,keys:[e,n,r,...o],data:i}){return{programId:t,keys:{account:e,delegate:n,owner:r,multiSigners:o},data:Bt.decode(i)}}(t);if(s.instruction!==vt.Approve)throw new St;if(!n||!r||!o)throw new At;return{programId:e,keys:{account:n,delegate:r,owner:o,multiSigners:i},data:s}}const Ut=ft([st("instruction"),yt("amount"),st("decimals")]);function xt(t,e=b){if(!t.programId.equals(e))throw new It;if(t.data.length!==Ut.span)throw new Et;const{keys:{account:n,mint:r,delegate:o,owner:i,multiSigners:s},data:a}=function({programId:t,keys:[e,n,r,o,...i],data:s}){return{programId:t,keys:{account:e,mint:n,delegate:r,owner:o,multiSigners:i},data:Ut.decode(s)}}(t);if(a.instruction!==vt.ApproveChecked)throw new St;if(!(n&&r&&o&&i))throw new At;return{programId:e,keys:{account:n,mint:r,delegate:o,owner:i,multiSigners:s},data:a}}const Pt=ft([st("instruction"),yt("amount")]);function Lt(t,e=b){if(!t.programId.equals(e))throw new It;if(t.data.length!==Pt.span)throw new Et;const{keys:{account:n,mint:r,owner:o,multiSigners:i},data:s}=function({programId:t,keys:[e,n,r,...o],data:i}){return{programId:t,keys:{account:e,mint:n,owner:r,multiSigners:o},data:Pt.decode(i)}}(t);if(s.instruction!==vt.Burn)throw new St;if(!n||!r||!o)throw new At;return{programId:e,keys:{account:n,mint:r,owner:o,multiSigners:i},data:s}}const Ct=ft([st("instruction"),yt("amount"),st("decimals")]);function Mt(t,e=b){if(!t.programId.equals(e))throw new It;if(t.data.length!==Ct.span)throw new Et;const{keys:{account:n,mint:r,owner:o,multiSigners:i},data:s}=function({programId:t,keys:[e,n,r,...o],data:i}){return{programId:t,keys:{account:e,mint:n,owner:r,multiSigners:o},data:Ct.decode(i)}}(t);if(s.instruction!==vt.BurnChecked)throw new St;if(!n||!r||!o)throw new At;return{programId:e,keys:{account:n,mint:r,owner:o,multiSigners:i},data:s}}const zt=ft([st("instruction")]);function Rt(t,e=b){if(!t.programId.equals(e))throw new It;if(t.data.length!==zt.span)throw new Et;const{keys:{account:n,destination:r,authority:o,multiSigners:i},data:s}=function({programId:t,keys:[e,n,r,...o],data:i}){return{programId:t,keys:{account:e,destination:n,authority:r,multiSigners:o},data:zt.decode(i)}}(t);if(s.instruction!==vt.CloseAccount)throw new St;if(!n||!r||!o)throw new At;return{programId:e,keys:{account:n,destination:r,authority:o,multiSigners:i},data:s}}var Ot;!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Mint=1]="Mint",t[t.Account=2]="Account"}(Ot||(Ot={}));var Ft;ft([st("m"),st("n"),wt("isInitialized"),bt("signer1"),bt("signer2"),bt("signer3"),bt("signer4"),bt("signer5"),bt("signer6"),bt("signer7"),bt("signer8"),bt("signer9"),bt("signer10"),bt("signer11")]).span,function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initialized=1]="Initialized",t[t.Frozen=2]="Frozen"}(Ft||(Ft={}));ft([bt("mint"),bt("owner"),yt("amount"),ut("delegateOption"),bt("delegate"),st("state"),ut("isNativeOption"),yt("isNative"),yt("delegatedAmount"),ut("closeAuthorityOption"),bt("closeAuthority")]).span;var Nt;ft([ut("mintAuthorityOption"),bt("mintAuthority"),yt("supply"),st("decimals"),wt("isInitialized"),ut("freezeAuthorityOption"),bt("freezeAuthority")]).span,function(t){t[t.Enable=0]="Enable",t[t.Disable=1]="Disable"}(Nt||(Nt={})),ft([st("instruction"),st("cpiGuardInstruction")]);var _t;ft([wt("lockCpi")]).span,function(t){t[t.Initialize=0]="Initialize",t[t.Update=1]="Update"}(_t||(_t={})),ft([st("instruction"),st("defaultAccountStateInstruction"),st("accountState")]);ft([st("state")]).span;ft([]).span;var Dt;ft([bt("rateAuthority"),ct("initializationTimestamp"),A("preUpdateAverageRate"),ct("lastUpdateTimestamp"),A("currentRate")]).span,function(t){t[t.Enable=0]="Enable",t[t.Disable=1]="Disable"}(Dt||(Dt={})),ft([st("instruction"),st("memoTransferInstruction")]);ft([wt("requireIncomingTransferMemos")]).span;ft([bt("closeAuthority")]).span;ft([]).span;var $t;function Wt(t){return ft([yt("epoch"),yt("maximumFee"),at("transferFeeBasisPoints")],t)}ft([bt("delegate")]).span,function(t){t[t.InitializeTransferFeeConfig=0]="InitializeTransferFeeConfig",t[t.TransferCheckedWithFee=1]="TransferCheckedWithFee",t[t.WithdrawWithheldTokensFromMint=2]="WithdrawWithheldTokensFromMint",t[t.WithdrawWithheldTokensFromAccounts=3]="WithdrawWithheldTokensFromAccounts",t[t.HarvestWithheldTokensToMint=4]="HarvestWithheldTokensToMint",t[t.SetTransferFee=5]="SetTransferFee"}($t||($t={})),ft([st("instruction"),st("transferFeeInstruction"),st("transferFeeConfigAuthorityOption"),bt("transferFeeConfigAuthority"),st("withdrawWithheldAuthorityOption"),bt("withdrawWithheldAuthority"),at("transferFeeBasisPoints"),yt("maximumFee")]),ft([st("instruction"),st("transferFeeInstruction"),yt("amount"),st("decimals"),yt("fee")]),ft([st("instruction"),st("transferFeeInstruction")]),ft([st("instruction"),st("transferFeeInstruction"),st("numTokenAccounts")]),ft([st("instruction"),st("transferFeeInstruction")]);ft([bt("transferFeeConfigAuthority"),bt("withdrawWithheldAuthority"),yt("withheldAmount"),Wt("olderTransferFee"),Wt("newerTransferFee")]).span;var jt;ft([yt("withheldAmount")]).span,function(t){t[t.Uninitialized=0]="Uninitialized",t[t.TransferFeeConfig=1]="TransferFeeConfig",t[t.TransferFeeAmount=2]="TransferFeeAmount",t[t.MintCloseAuthority=3]="MintCloseAuthority",t[t.ConfidentialTransferMint=4]="ConfidentialTransferMint",t[t.ConfidentialTransferAccount=5]="ConfidentialTransferAccount",t[t.DefaultAccountState=6]="DefaultAccountState",t[t.ImmutableOwner=7]="ImmutableOwner",t[t.MemoTransfer=8]="MemoTransfer",t[t.NonTransferable=9]="NonTransferable",t[t.InterestBearingConfig=10]="InterestBearingConfig",t[t.CpiGuard=11]="CpiGuard",t[t.PermanentDelegate=12]="PermanentDelegate"}(jt||(jt={}));const qt=ft([st("instruction")]);function Vt(t,e=b){if(!t.programId.equals(e))throw new It;if(t.data.length!==qt.span)throw new Et;const{keys:{account:n,mint:r,owner:o,rent:i},data:s}=function({programId:t,keys:[e,n,r,o],data:i}){return{programId:t,keys:{account:e,mint:n,owner:r,rent:o},data:qt.decode(i)}}(t);if(s.instruction!==vt.InitializeAccount)throw new St;if(!(n&&r&&o&&i))throw new At;return{programId:e,keys:{account:n,mint:r,owner:o,rent:i},data:s}}ft([st("instruction"),st("decimals"),bt("mintAuthority"),st("freezeAuthorityOption"),bt("freezeAuthority")]);const Gt=ft([st("instruction"),st("m")]);function Ht(t,e=b){if(!t.programId.equals(e))throw new It;if(t.data.length!==Gt.span)throw new Et;const{keys:{account:n,rent:r,signers:o},data:i}=function({programId:t,keys:[e,n,...r],data:o}){return{programId:t,keys:{account:e,rent:n,signers:r},data:Gt.decode(o)}}(t);if(i.instruction!==vt.InitializeMultisig)throw new St;if(!n||!r||!o.length)throw new At;return{programId:e,keys:{account:n,rent:r,signers:o},data:i}}ft([st("instruction")]),ft([st("instruction")]);const Jt=ft([st("instruction")]);function Yt(t,e=b){if(!t.programId.equals(e))throw new It;if(t.data.length!==Jt.span)throw new Et;const{keys:{account:n,mint:r,authority:o,multiSigners:i},data:s}=function({programId:t,keys:[e,n,r,...o],data:i}){return{programId:t,keys:{account:e,mint:n,authority:r,multiSigners:o},data:Jt.decode(i)}}(t);if(s.instruction!==vt.FreezeAccount)throw new St;if(!n||!r||!o)throw new At;return{programId:e,keys:{account:n,mint:r,authority:o,multiSigners:i},data:s}}const Zt=ft([st("instruction"),yt("amount")]);function Kt(t,e=b){if(!t.programId.equals(e))throw new It;if(t.data.length!==Zt.span)throw new Et;const{keys:{mint:n,destination:r,authority:o,multiSigners:i},data:s}=function({programId:t,keys:[e,n,r,...o],data:i}){return{programId:t,keys:{mint:e,destination:n,authority:r,multiSigners:o},data:Zt.decode(i)}}(t);if(s.instruction!==vt.MintTo)throw new St;if(!n||!r||!o)throw new At;return{programId:e,keys:{mint:n,destination:r,authority:o,multiSigners:i},data:s}}const Xt=ft([st("instruction"),yt("amount"),st("decimals")]);function Qt(t,e=b){if(!t.programId.equals(e))throw new It;if(t.data.length!==Xt.span)throw new Et;const{keys:{mint:n,destination:r,authority:o,multiSigners:i},data:s}=function({programId:t,keys:[e,n,r,...o],data:i}){return{programId:t,keys:{mint:e,destination:n,authority:r,multiSigners:o},data:Xt.decode(i)}}(t);if(s.instruction!==vt.MintToChecked)throw new St;if(!n||!r||!o)throw new At;return{programId:e,keys:{mint:n,destination:r,authority:o,multiSigners:i},data:s}}const te=ft([st("instruction")]);function ee(t,e=b){if(!t.programId.equals(e))throw new It;if(t.data.length!==te.span)throw new Et;const{keys:{account:n,owner:r,multiSigners:o},data:i}=function({programId:t,keys:[e,n,...r],data:o}){return{programId:t,keys:{account:e,owner:n,multiSigners:r},data:te.decode(o)}}(t);if(i.instruction!==vt.Revoke)throw new St;if(!n||!r)throw new At;return{programId:e,keys:{account:n,owner:r,multiSigners:o},data:i}}var ne;!function(t){t[t.MintTokens=0]="MintTokens",t[t.FreezeAccount=1]="FreezeAccount",t[t.AccountOwner=2]="AccountOwner",t[t.CloseAccount=3]="CloseAccount"}(ne||(ne={}));const re=ft([st("instruction"),st("authorityType"),st("newAuthorityOption"),bt("newAuthority")]);function oe(t,e=b){if(!t.programId.equals(e))throw new It;if(t.data.length!==re.span)throw new Et;const{keys:{account:n,currentAuthority:r,multiSigners:o},data:i}=function({programId:t,keys:[e,n,...r],data:o}){const{instruction:i,authorityType:s,newAuthorityOption:a,newAuthority:u}=re.decode(o);return{programId:t,keys:{account:e,currentAuthority:n,multiSigners:r},data:{instruction:i,authorityType:s,newAuthority:a?u:null}}}(t);if(i.instruction!==vt.SetAuthority)throw new St;if(!n||!r)throw new At;return{programId:e,keys:{account:n,currentAuthority:r,multiSigners:o},data:i}}const ie=ft([st("instruction")]);function se(t,e=b){if(!t.programId.equals(e))throw new It;if(t.data.length!==ie.span)throw new Et;const{keys:{account:n,mint:r,authority:o,multiSigners:i},data:s}=function({programId:t,keys:[e,n,r,...o],data:i}){return{programId:t,keys:{account:e,mint:n,authority:r,multiSigners:o},data:ie.decode(i)}}(t);if(s.instruction!==vt.ThawAccount)throw new St;if(!n||!r||!o)throw new At;return{programId:e,keys:{account:n,mint:r,authority:o,multiSigners:i},data:s}}const ae=ft([st("instruction"),yt("amount")]);function ue(t,e=b){if(!t.programId.equals(e))throw new It;if(t.data.length!==ae.span)throw new Et;const{keys:{source:n,destination:r,owner:o,multiSigners:i},data:s}=function({programId:t,keys:[e,n,r,...o],data:i}){return{programId:t,keys:{source:e,destination:n,owner:r,multiSigners:o},data:ae.decode(i)}}(t);if(s.instruction!==vt.Transfer)throw new St;if(!n||!r||!o)throw new At;return{programId:e,keys:{source:n,destination:r,owner:o,multiSigners:i},data:s}}const ce=ft([st("instruction"),yt("amount"),st("decimals")]);function fe(t,e=b){if(!t.programId.equals(e))throw new It;if(t.data.length!==ce.span)throw new Et;const{keys:{source:n,mint:r,destination:o,owner:i,multiSigners:s},data:a}=function({programId:t,keys:[e,n,r,o,...i],data:s}){return{programId:t,keys:{source:e,mint:n,destination:r,owner:o,multiSigners:i},data:ce.decode(s)}}(t);if(a.instruction!==vt.TransferChecked)throw new St;if(!(n&&r&&o&&i))throw new At;return{programId:e,keys:{source:n,mint:r,destination:o,owner:i,multiSigners:s},data:a}}const he=ft([st("instruction"),st("decimals"),bt("mintAuthority"),st("freezeAuthorityOption"),bt("freezeAuthority")]);function de({programId:t,keys:[e,n],data:r}){const{instruction:o,decimals:i,mintAuthority:s,freezeAuthorityOption:a,freezeAuthority:u}=he.decode(r);return{programId:t,keys:{mint:e,rent:n},data:{instruction:o,decimals:i,mintAuthority:s,freezeAuthority:a?u:null}}}var le;function pe(t){const e=t.startsWith("0x")?t.slice(2):t;return Buffer.from(e)}function ge(e,n){const r="legacy"===e.version?e.accountKeys:e.staticAccountKeys,o=e.header.numReadonlySignedAccounts,i=e.header.numReadonlyUnsignedAccounts,s=e.header.numRequiredSignatures,a=r.length;let u=r.map(((e,n)=>({isSigner:n=s&&n({isSigner:!1,isWritable:!0,pubkey:t})))]),f&&(u=[...u,...f.map((t=>({isSigner:!1,isWritable:!1,pubkey:t})))]),u}function ye(t,n){if("string"==typeof t.data){const r=t;return new e({data:i.bytes.bs58.decode(r.data),programId:n[r.programIdIndex].pubkey,keys:r.accounts.map((t=>n[t]))})}{const r=t;return new e({data:Buffer.from(r.data),programId:n[r.programIdIndex].pubkey,keys:r.accountKeyIndexes.map((t=>{if(t>=n.length)throw new Error(`Trying to resolve account at index ${t} while parsedAccounts is only ${n.length}. \t\t\t\t\t\tLooks like you're trying to parse versioned transaction, make sure that LoadedAddresses are passed to the \t\t\t\t\t\tparseTransactionAccounts function`);return n[t]}))})}}function me(t,e){const n=e.map((t=>({pk:t.pubkey.toString(),...t})));return t.map((t=>{const e=t.toString(),r=n.find((t=>t.pk===e));if(!r)throw new Error(`Account ${e} not present in account meta!`);return r}))}function we(t,n){return new e({data:i.bytes.bs58.decode(t.data),programId:t.programId,keys:me(t.accounts,n)})}function be(t){var e,n,r;const o=[];if(null==t)return[];const i=t.transaction.message.compiledInstructions,s=ge(t.transaction.message,null===(e=t.meta)||void 0===e?void 0:e.loadedAddresses),a=((null===(n=null==t?void 0:t.meta)||void 0===n?void 0:n.innerInstructions)||[]).sort(((t,e)=>t.index-e.index)),u=((null===(r=t.meta)||void 0===r?void 0:r.innerInstructions)||[]).reduce(((t,e)=>t+e.instructions.length),0)+i.length;let c=-1,f=-1;for(const t of a){for(;c!==t.index;)c+=1,f+=1,o.push(ye(i[c],s));for(const e of t.instructions)o.push(ye(e,s)),f+=1}for(;f^Log truncated$)|(?^Program (?[1-9A-HJ-NP-Za-km-z]{32,}) invoke \[(?\d+)\]$)|(?^Program (?[1-9A-HJ-NP-Za-km-z]{32,}) success$)|(?^Program (?[1-9A-HJ-NP-Za-km-z]{32,}) failed: (?.*)$)|(?^Program failed to complete: (?.*)$)|(?^^Program log: (?.*)$)|(?^Program data: (?.*)$)|(?^Program (?[1-9A-HJ-NP-Za-km-z]{32,}) consumed (?\d*) of (?\d*) compute units$)|(?^Program return: (?[1-9A-HJ-NP-Za-km-z]{32,}) (?.*)$)/s,n=[];let r=-1,o=0,i=0;const s=[],a=[];for(const u of t){const t=e.exec(u);if(!t||!t.groups)throw new Error(`Failed to parse log line: ${u}`);if(t.groups.logTruncated)n[a[a.length-1]].invokeResult="Log truncated";else if(t.groups.programInvoke){if(s.push(t.groups.invokeProgramId),r+=1,i+=1,a.push(r),t.groups.level!=i.toString())throw new Error(`invoke depth mismatch, log: ${t.groups.level}, expected: ${i}`);n.push(ke(s[s.length-1],s.length,r,o)),n[n.length-1].rawLogs.push(u)}else if(t.groups.programSuccessResult){const e=s.pop(),r=a.pop();if(void 0===r)throw new Error("callIds malformed");if(e!=t.groups.successResultProgramId)throw new Error("[ProramSuccess] callstack mismatch");n[r].rawLogs.push(u),i-=1,0===i&&(o+=1)}else if(t.groups.programFailedResult){if(s.pop()!=t.groups.failedResultProgramId)throw new Error("[ProgramFailed] callstack mismatch");n[a[a.length-1]].rawLogs.push(u),n[a[a.length-1]].errors.push(t.groups.failedResultErr)}else if(t.groups.programCompleteFailedResult)n[a[a.length-1]].rawLogs.push(u),n[a[a.length-1]].errors.push(t.groups.failedCompleteError);else if(t.groups.programLog)n[a[a.length-1]].rawLogs.push(u),n[a[a.length-1]].logMessages.push(t.groups.logMessage);else if(t.groups.programData)n[a[a.length-1]].rawLogs.push(u),n[a[a.length-1]].dataLogs.push(t.groups.data);else if(t.groups.programConsumed)n[a[a.length-1]].rawLogs.push(u);else if(t.groups.programReturn){if(s[s.length-1]!=t.groups.returnProgramId)throw new Error("[InvokeReturn]: callstack mismatch");n[a[a.length-1]].invokeResult=t.groups.returnMessage}}return n}function Ae(t){let e;switch(o.decodeInstructionType(t)){case"AdvanceNonceAccount":{const n=o.decodeNonceAdvance(t);e={name:"advanceNonceAccount",accounts:[{name:"nonce",pubkey:n.noncePubkey,isSigner:!1,isWritable:!0},{name:"recentBlockhashSysvar",...t.keys[1]},{name:"nonceAuthority",pubkey:n.authorizedPubkey,isSigner:!0,isWritable:!1}],args:{}};break}case"Allocate":{const n=o.decodeAllocate(t);e={name:"allocate",accounts:[{name:"newAccount",pubkey:n.accountPubkey,isSigner:!0,isWritable:!0}],args:{space:new s(n.space)}};break}case"AllocateWithSeed":{const n=o.decodeAllocateWithSeed(t);e={name:"allocateWithSeed",accounts:[{name:"newAccount",pubkey:n.accountPubkey,isSigner:!1,isWritable:!0},{name:"base",pubkey:n.basePubkey,isSigner:!0,isWritable:!1}],args:{seed:n.seed,space:new s(n.space),owner:n.programId,base:n.basePubkey}};break}case"Assign":{const n=o.decodeAssign(t);e={name:"assign",accounts:[{name:"assignedAccount",pubkey:n.accountPubkey,isSigner:!0,isWritable:!0}],args:{owner:n.programId}};break}case"AssignWithSeed":{const n=o.decodeAssignWithSeed(t);e={name:"assignWithSeed",accounts:[{name:"assigned",pubkey:n.accountPubkey,isSigner:!1,isWritable:!0},{name:"base",pubkey:n.basePubkey,isSigner:!0,isWritable:!1}],args:{seed:n.seed,owner:n.programId,base:n.basePubkey}};break}case"AuthorizeNonceAccount":{const n=o.decodeNonceAuthorize(t);e={name:"authorizeNonceAccount",accounts:[{name:"nonce",isSigner:!1,isWritable:!0,pubkey:n.noncePubkey},{name:"nonceAuthority",isSigner:!0,isWritable:!1,pubkey:n.authorizedPubkey}],args:{authorized:n.newAuthorizedPubkey}};break}case"Create":{const n=o.decodeCreateAccount(t);e={name:"createAccount",accounts:[{name:"payer",pubkey:n.fromPubkey,isSigner:!0,isWritable:!0},{name:"newAccount",pubkey:n.newAccountPubkey,isSigner:!0,isWritable:!0}],args:{lamports:new s(n.lamports),owner:n.programId,space:new s(n.space)}};break}case"CreateWithSeed":{const n=o.decodeCreateWithSeed(t);e={name:"createAccountWithSeed",accounts:[{name:"payer",pubkey:n.fromPubkey,isSigner:!0,isWritable:!0},{name:"created",pubkey:n.newAccountPubkey,isSigner:!1,isWritable:!0},{name:"base",pubkey:n.basePubkey,isSigner:!0,isWritable:!1}],args:{lamports:new s(n.lamports),owner:n.programId,space:new s(n.space),seed:n.seed,base:n.basePubkey}};break}case"InitializeNonceAccount":{const n=o.decodeNonceInitialize(t);e={name:"initializeNonceAccount",accounts:[{name:"nonce",pubkey:n.noncePubkey,isSigner:!1,isWritable:!0},{name:"recentBlockhashSysvar",...t.keys[1]},{name:"rentSysvar",...t.keys[2]}],args:{authorized:n.authorizedPubkey}};break}case"Transfer":{const n=o.decodeTransfer(t);e={name:"transfer",accounts:[{name:"sender",pubkey:n.fromPubkey,isSigner:!0,isWritable:!0},{name:"receiver",pubkey:n.toPubkey,isWritable:!0,isSigner:!1}],args:{lamports:new s(n.lamports.toString())}};break}case"TransferWithSeed":{const n=o.decodeTransferWithSeed(t);e={name:"transferWithSeed",accounts:[{name:"sender",pubkey:n.fromPubkey,isSigner:!1,isWritable:!0},{name:"base",pubkey:n.basePubkey,isSigner:!0,isWritable:!1},{name:"receiver",pubkey:n.toPubkey,isSigner:!1,isWritable:!0}],args:{owner:n.programId,lamports:new s(n.lamports.toString()),seed:n.seed}};break}case"WithdrawNonceAccount":{const n=o.decodeNonceWithdraw(t);e={name:"withdrawNonceAccount",accounts:[{name:"nonce",pubkey:n.noncePubkey,isSigner:!1,isWritable:!0},{name:"recepient",pubkey:n.toPubkey,isSigner:!1,isWritable:!0},{name:"recentBlockhashSysvar",...t.keys[2]},{name:"rentSysvar",...t.keys[3]},{name:"nonceAuthority",pubkey:n.noncePubkey,isSigner:!0,isWritable:!1}],args:{lamports:new s(n.lamports)}};break}default:e=null}return e?{...e,programId:n.programId}:{programId:n.programId,name:"unknown",accounts:t.keys,args:{unknown:t.data}}}function Ee(e){let n;switch(st().decode(e.data)){case vt.InitializeMint:{const t=function(t,e=b){if(!t.programId.equals(e))throw new It;if(t.data.length!==he.span)throw new Et;const{keys:{mint:n,rent:r},data:o}=de(t);if(o.instruction!==vt.InitializeMint)throw new St;if(!n||!r)throw new At;return{programId:e,keys:{mint:n,rent:r},data:o}}(e);n={name:"initializeMint",accounts:[{name:"tokenMint",...t.keys.mint},{name:"rentSysvar",...t.keys.rent}],args:{decimals:t.data.decimals,mintAuthority:t.data.mintAuthority,freezeAuthority:t.data.freezeAuthority}};break}case vt.InitializeAccount:{const t=Vt(e);n={name:"initializeAccount",accounts:[{name:"newAccount",...t.keys.account},{name:"tokenMint",...t.keys.mint},{name:"owner",...t.keys.owner},{name:"rentSysvar",...t.keys.rent}],args:{}};break}case vt.InitializeMultisig:{const t=Ht(e),r=t.keys.signers.map(((t,e)=>({name:`signer_${e}`,...t})));n={name:"initializeMultisig",accounts:[{name:"multisig",...t.keys.account},{name:"rentSysvar",...t.keys.rent},...r],args:{m:t.data.m}};break}case vt.Transfer:{const t=ue(e),r=t.keys.multiSigners.map(((t,e)=>({name:`signer_${e}`,...t})));n={name:"transfer",accounts:[{name:"source",...t.keys.source},{name:"destination",...t.keys.destination},{name:"owner",...t.keys.owner},...r],args:{amount:new s(t.data.amount.toString())}};break}case vt.Approve:{const t=Tt(e),r=t.keys.multiSigners.map(((t,e)=>({name:`signer_${e}`,...t})));n={name:"approve",accounts:[{name:"source",...t.keys.account},{name:"delegate",...t.keys.delegate},{name:"owner",...t.keys.owner},...r],args:{amount:new s(t.data.amount.toString())}};break}case vt.Revoke:{const t=ee(e),r=t.keys.multiSigners.map(((t,e)=>({name:`signer_${e}`,...t})));n={name:"revoke",accounts:[{name:"source",...t.keys.account},{name:"owner",...t.keys.owner},...r],args:{}};break}case vt.SetAuthority:{const t=oe(e),r=t.keys.multiSigners.map(((t,e)=>({name:`signer_${e}`,...t})));n={name:"setAuthority",accounts:[{name:"account",...t.keys.account},{name:"currentAuthority",...t.keys.currentAuthority},...r],args:{authorityType:t.data.authorityType,newAuthority:t.data.newAuthority}};break}case vt.MintTo:{const t=Kt(e),r=t.keys.multiSigners.map(((t,e)=>({name:`signer_${e}`,...t})));n={name:"mintTo",accounts:[{name:"tokenMint",...t.keys.mint},{name:"mintTo",...t.keys.destination},{name:"authority",...t.keys.authority},...r],args:{amount:new s(t.data.amount.toString())}};break}case vt.Burn:{const t=Lt(e),r=t.keys.multiSigners.map(((t,e)=>({name:`signer_${e}`,...t})));n={name:"burn",accounts:[{name:"burnFrom",...t.keys.account},{name:"tokenMint",...t.keys.mint},{name:"owner",...t.keys.owner},...r],args:{amount:new s(t.data.amount.toString())}};break}case vt.CloseAccount:{const t=Rt(e),r=t.keys.multiSigners.map(((t,e)=>({name:`signer_${e}`,...t})));n={name:"closeAccount",accounts:[{name:"account",...t.keys.account},{name:"destination",...t.keys.destination},{name:"owner",...t.keys.authority},...r],args:{}};break}case vt.FreezeAccount:{const t=Yt(e),r=t.keys.multiSigners.map(((t,e)=>({name:`signer_${e}`,...t})));n={name:"freezeAccount",accounts:[{name:"account",...t.keys.account},{name:"tokenMint",...t.keys.mint},{name:"authority",...t.keys.authority},...r],args:{}};break}case vt.ThawAccount:{const t=se(e),r=t.keys.multiSigners.map(((t,e)=>({name:`signer_${e}`,...t})));n={name:"thawAccount",accounts:[{name:"account",...t.keys.account},{name:"tokenMint",...t.keys.mint},{name:"authority",...t.keys.authority},...r],args:{}};break}case vt.TransferChecked:{const t=fe(e),r=t.keys.multiSigners.map(((t,e)=>({name:`signer_${e}`,...t})));n={name:"transferChecked",accounts:[{name:"source",...t.keys.source},{name:"tokenMint",...t.keys.mint},{name:"destination",...t.keys.destination},{name:"owner",...t.keys.owner},...r],args:{amount:new s(t.data.amount.toString()),decimals:t.data.decimals}};break}case vt.ApproveChecked:{const t=xt(e),r=t.keys.multiSigners.map(((t,e)=>({name:`signer_${e}`,...t})));n={name:"approveChecked",accounts:[{name:"source",...t.keys.account},{name:"tokenMint",...t.keys.mint},{name:"delegate",...t.keys.delegate},{name:"owner",...t.keys.owner},...r],args:{amount:new s(t.data.amount.toString()),decimals:t.data.decimals}};break}case vt.MintToChecked:{const t=Qt(e),r=t.keys.multiSigners.map(((t,e)=>({name:`signer_${e}`,...t})));n={name:"mintToChecked",accounts:[{name:"tokenMint",...t.keys.mint},{name:"mintTo",...t.keys.destination},{name:"authority",...t.keys.authority},...r],args:{amount:new s(t.data.amount.toString()),decimals:t.data.decimals}};break}case vt.BurnChecked:{const t=Mt(e),r=t.keys.multiSigners.map(((t,e)=>({name:`signer_${e}`,...t})));n={name:"burnChecked",accounts:[{name:"burnFrom",...t.keys.account},{name:"tokenMint",...t.keys.mint},{name:"owner",...t.keys.owner},...r],args:{amount:new s(t.data.amount.toString()),decimals:t.data.decimals}};break}case vt.InitializeAccount2:{const r=ft([st("instruction"),ht(32,"owner")]).decode(e.data);n={name:"initializeAccount2",accounts:[{name:"newAccount",...e.keys[0]},{name:"tokenMint",...e.keys[1]},{name:"rentSysvar",...e.keys[2]}],args:{authority:new t(r.owner)}};break}case vt.SyncNative:n={name:"syncNative",accounts:[{name:"account",...e.keys[0]}],args:{}};break;case vt.InitializeAccount3:{const r=ft([st("instruction"),ht(32,"owner")]).decode(e.data);n={name:"initializeAccount3",accounts:[{name:"newAccount",...e.keys[0]},{name:"tokenMint",...e.keys[1]}],args:{authority:new t(r.owner)}};break}case vt.InitializeMultisig2:{const t=e.keys.slice(1).map(((t,e)=>({name:`signer_${e}`,...t})));n={name:"initializeMultisig2",accounts:[{name:"multisig",...e.keys[0]},...t],args:{m:e.data[1]}};break}case vt.InitializeMint2:{const t=de(e);if(!t.keys.mint)throw new Error("Failed to parse InitializeMint2 instruction");n={name:"initializeMint2",accounts:[{name:"tokenMint",...t.keys.mint}],args:{decimals:t.data.decimals,mintAuthority:t.data.mintAuthority,freezeAuthority:t.data.freezeAuthority}};break}default:n=null}return n?{...n,programId:b}:{programId:b,name:"unknown",accounts:e.keys,args:{unknown:e.data}}}function Se(t){return{name:"createAssociatedTokenAccount",accounts:[{name:"fundingAccount",...t.keys[0]},{name:"newAccount",...t.keys[1]},{name:"wallet",...t.keys[2]},{name:"tokenMint",...t.keys[3]},{name:"systemProgram",...t.keys[4]},{name:"tokenProgram",...t.keys[5]},t.keys.length>5?{name:"rentSysvar",...t.keys[6]}:void 0],args:{},programId:k}}function ve(t,e){return t.map((t=>{const n=t.name;if(Object.prototype.hasOwnProperty.call(t,"accounts")){const r=e?`${e} > ${n}`:n;return ve(t.accounts,r)}return{...t,name:e?`${e} > ${n}`:n}})).flat()}!function(t){t[t.Initialize=0]="Initialize",t[t.UpdateRate=1]="UpdateRate"}(le||(le={})),ft([st("instruction"),st("interestBearingMintInstruction"),bt("rateAuthority"),A("rate")]),ft([st("instruction"),st("interestBearingMintInstruction"),A("rate")]),ft([st("instruction"),bt("owner")]),ft([st("instruction"),bt("owner")]),ft([st("instruction")]),ft([st("instruction"),st("closeAuthorityOption"),bt("closeAuthority")]),ft([st("instruction")]),ft([st("instruction"),bt("delegate")]);class Be{constructor(e,r){const o=[[n.programId.toBase58(),Ae],[b.toBase58(),Ee],[k.toBase58(),Se]];let i;r=r||[];for(const n of e)r.push(this.buildIdlParser(new t(n.programId),n.idl));if(r){i=new Map(r);for(const t of o)i.has(t[0])||i.set(...t)}else i=new Map(o);this.instructionParsers=i}addParser(t,e){this.instructionParsers.set(t.toBase58(),e)}addParserFromIdl(e,n){this.instructionParsers.set(...this.buildIdlParser(new t(e),n))}buildIdlParser(t,e){return[t.toBase58(),(t=>{const n=new a(e).decode(t.data);if(n){const r=e.instructions.find((t=>t.name===n.name));if(!r)return this.buildUnknownParsedInstruction(t.programId,t.keys,t.data,n.name);const o=ve(r.accounts),i=t.keys.map(((t,e)=>ethis.parseInstruction(ye(t,n))))}parseTransactionParsedData(t){const e=t.accountKeys.map((t=>({isSigner:t.signer,isWritable:t.writable,pubkey:t.pubkey})));return t.instructions.map((t=>this.parseInstruction(we(t,e))))}async parseTransaction(t,e,n=!1,r="confirmed"){var o;const i=await t.getTransaction(e,{commitment:r,maxSupportedTransactionVersion:0});if(!i)return null;if(n){return be(i).map((t=>this.parseInstruction(t)))}return this.parseTransactionData(i.transaction.message,null===(o=i.meta)||void 0===o?void 0:o.loadedAddresses)}parseTransactionDump(t){t instanceof u.Buffer||(t=u.Buffer.from(t,"base64"));const e=r.from(t).compileMessage();return this.parseTransactionData(e)}}export{Be as SolanaParser,ye as compiledInstructionToInstruction,be as flattenTransactionResponse,pe as hexToBuffer,Ie as parseLogs,ge as parseTransactionAccounts,we as parsedInstructionToInstruction}; +!function(t){const e=c,n=m,r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=s,t.SlowBuffer=function(t){+t!=t&&(t=0);return s.alloc(+t)},t.INSPECT_MAX_BYTES=50;const o=2147483647;function i(t){if(t>o)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,s.prototype),e}function s(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return f(t)}return a(t,e,n)}function a(t,e,n){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const n=0|p(t,e);let r=i(n);const o=r.write(t,e);o!==n&&(r=r.slice(0,o));return r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Y(t,Uint8Array)){const e=new Uint8Array(t);return d(e.buffer,e.byteOffset,e.byteLength)}return h(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Y(t,ArrayBuffer)||t&&Y(t.buffer,ArrayBuffer))return d(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(Y(t,SharedArrayBuffer)||t&&Y(t.buffer,SharedArrayBuffer)))return d(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return s.from(r,e,n);const o=function(t){if(s.isBuffer(t)){const e=0|l(t.length),n=i(e);return 0===n.length||t.copy(n,0,0,e),n}if(void 0!==t.length)return"number"!=typeof t.length||Z(t.length)?i(0):h(t);if("Buffer"===t.type&&Array.isArray(t.data))return h(t.data)}(t);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return s.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function u(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function f(t){return u(t),i(t<0?0:0|l(t))}function h(t){const e=t.length<0?0:0|l(t.length),n=i(e);for(let r=0;r=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|t}function p(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Y(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let o=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return G(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return H(t).length;default:if(o)return r?-1:G(t).length;e=(""+e).toLowerCase(),o=!0}}function g(t,e,n){let r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return P(this,e,n);case"utf8":case"utf-8":return B(this,e,n);case"ascii":return U(this,e,n);case"latin1":case"binary":return x(this,e,n);case"base64":return v(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function y(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function w(t,e,n,r,o){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),Z(n=+n)&&(n=o?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(o)return-1;n=t.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof e&&(e=s.from(e,r)),s.isBuffer(e))return 0===e.length?-1:b(t,e,n,r,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):b(t,[e],n,r,o);throw new TypeError("val must be string, number or Buffer")}function b(t,e,n,r,o){let i,s=1,a=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,n/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(o){let r=-1;for(i=n;ia&&(n=a-u),i=n;i>=0;i--){let n=!0;for(let r=0;ro&&(r=o):r=o;const i=e.length;let s;for(r>i/2&&(r=i/2),s=0;s>8,o=n%256,i.push(o),i.push(r);return i}(e,t.length-n),t,n,r)}function v(t,n,r){return 0===n&&r===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(n,r))}function B(t,e,n){n=Math.min(t.length,n);const r=[];let o=e;for(;o239?4:e>223?3:e>191?2:1;if(o+s<=n){let n,r,a,u;switch(s){case 1:e<128&&(i=e);break;case 2:n=t[o+1],128==(192&n)&&(u=(31&e)<<6|63&n,u>127&&(i=u));break;case 3:n=t[o+1],r=t[o+2],128==(192&n)&&128==(192&r)&&(u=(15&e)<<12|(63&n)<<6|63&r,u>2047&&(u<55296||u>57343)&&(i=u));break;case 4:n=t[o+1],r=t[o+2],a=t[o+3],128==(192&n)&&128==(192&r)&&128==(192&a)&&(u=(15&e)<<18|(63&n)<<12|(63&r)<<6|63&a,u>65535&&u<1114112&&(i=u))}}null===i?(i=65533,s=1):i>65535&&(i-=65536,r.push(i>>>10&1023|55296),i=56320|1023&i),r.push(i),o+=s}return function(t){const e=t.length;if(e<=T)return String.fromCharCode.apply(String,t);let n="",r=0;for(;rr.length?(s.isBuffer(e)||(e=s.from(e)),e.copy(r,o)):Uint8Array.prototype.set.call(r,e,o);else{if(!s.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,o)}o+=e.length}return r},s.byteLength=p,s.prototype._isBuffer=!0,s.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;en&&(e+=" ... "),""},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(t,e,n,r,o){if(Y(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),e<0||n>t.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&e>=n)return 0;if(r>=o)return-1;if(e>=n)return 1;if(this===t)return 0;let i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(e>>>=0);const u=Math.min(i,a),c=this.slice(r,o),f=t.slice(e,n);for(let t=0;t>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const o=this.length-e;if((void 0===n||n>o)&&(n=o),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let i=!1;for(;;)switch(r){case"hex":return k(this,t,e,n);case"utf8":case"utf-8":return I(this,t,e,n);case"ascii":case"latin1":case"binary":return A(this,t,e,n);case"base64":return E(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,e,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const T=4096;function U(t,e,n){let r="";n=Math.min(t.length,n);for(let o=e;or)&&(n=r);let o="";for(let r=e;rn)throw new RangeError("Trying to access beyond buffer length")}function M(t,e,n,r,o,i){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||et.length)throw new RangeError("Index out of range")}function z(t,e,n,r,o){W(e,r,o,t,n,7);let i=Number(e&BigInt(4294967295));t[n++]=i,i>>=8,t[n++]=i,i>>=8,t[n++]=i,i>>=8,t[n++]=i;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,n}function O(t,e,n,r,o){W(e,r,o,t,n,7);let i=Number(e&BigInt(4294967295));t[n+7]=i,i>>=8,t[n+6]=i,i>>=8,t[n+5]=i,i>>=8,t[n+4]=i;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=s,s>>=8,t[n+2]=s,s>>=8,t[n+1]=s,s>>=8,t[n]=s,n+8}function R(t,e,n,r,o,i){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function F(t,e,r,o,i){return e=+e,r>>>=0,i||R(t,0,r,4),n.write(t,e,r,o,23,4),r+4}function N(t,e,r,o,i){return e=+e,r>>>=0,i||R(t,0,r,8),n.write(t,e,r,o,52,8),r+8}s.prototype.slice=function(t,e){const n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e>>=0,e>>>=0,n||C(t,e,this.length);let r=this[t],o=1,i=0;for(;++i>>=0,e>>>=0,n||C(t,e,this.length);let r=this[t+--e],o=1;for(;e>0&&(o*=256);)r+=this[t+--e]*o;return r},s.prototype.readUint8=s.prototype.readUInt8=function(t,e){return t>>>=0,e||C(t,1,this.length),this[t]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||C(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||C(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||C(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(t,e){return t>>>=0,e||C(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readBigUInt64LE=X((function(t){j(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||q(t,this.length-8);const r=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,o=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(r)+(BigInt(o)<>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||q(t,this.length-8);const r=e*2**24+65536*this[++t]+256*this[++t]+this[++t],o=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(r)<>>=0,e>>>=0,n||C(t,e,this.length);let r=this[t],o=1,i=0;for(;++i=o&&(r-=Math.pow(2,8*e)),r},s.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||C(t,e,this.length);let r=e,o=1,i=this[t+--r];for(;r>0&&(o*=256);)i+=this[t+--r]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i},s.prototype.readInt8=function(t,e){return t>>>=0,e||C(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||C(t,2,this.length);const n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt16BE=function(t,e){t>>>=0,e||C(t,2,this.length);const n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt32LE=function(t,e){return t>>>=0,e||C(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return t>>>=0,e||C(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readBigInt64LE=X((function(t){j(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||q(t,this.length-8);const r=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||q(t,this.length-8);const r=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(r)<>>=0,e||C(t,4,this.length),n.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||C(t,4,this.length),n.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||C(t,8,this.length),n.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||C(t,8,this.length),n.read(this,t,!1,52,8)},s.prototype.writeUintLE=s.prototype.writeUIntLE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){M(this,t,e,n,Math.pow(2,8*n)-1,0)}let o=1,i=0;for(this[e]=255&t;++i>>=0,n>>>=0,!r){M(this,t,e,n,Math.pow(2,8*n)-1,0)}let o=n-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||M(this,t,e,1,255,0),this[e]=255&t,e+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||M(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||M(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||M(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||M(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeBigUInt64LE=X((function(t,e=0){return z(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeBigUInt64BE=X((function(t,e=0){return O(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);M(this,t,e,n,r-1,-r)}let o=0,i=1,s=0;for(this[e]=255&t;++o>0)-s&255;return e+n},s.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);M(this,t,e,n,r-1,-r)}let o=n-1,i=1,s=0;for(this[e+o]=255&t;--o>=0&&(i*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/i>>0)-s&255;return e+n},s.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||M(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||M(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||M(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||M(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},s.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||M(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeBigInt64LE=X((function(t,e=0){return z(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeBigInt64BE=X((function(t,e=0){return O(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeFloatLE=function(t,e,n){return F(this,t,e,!0,n)},s.prototype.writeFloatBE=function(t,e,n){return F(this,t,e,!1,n)},s.prototype.writeDoubleLE=function(t,e,n){return N(this,t,e,!0,n)},s.prototype.writeDoubleBE=function(t,e,n){return N(this,t,e,!1,n)},s.prototype.copy=function(t,e,n,r){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function W(t,e,n,r,o,i){if(t>n||t3?0===e||e===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(i+1)}${r}`:`>= -(2${r} ** ${8*(i+1)-1}${r}) and < 2 ** ${8*(i+1)-1}${r}`:`>= ${e}${r} and <= ${n}${r}`,new _.ERR_OUT_OF_RANGE("value",o,t)}!function(t,e,n){j(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||q(e,t.length-(n+1))}(r,o,i)}function j(t,e){if("number"!=typeof t)throw new _.ERR_INVALID_ARG_TYPE(e,"number",t)}function q(t,e,n){if(Math.floor(t)!==t)throw j(t,n),new _.ERR_OUT_OF_RANGE(n||"offset","an integer",t);if(e<0)throw new _.ERR_BUFFER_OUT_OF_BOUNDS;throw new _.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}D("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),D("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),D("ERR_OUT_OF_RANGE",(function(t,e,n){let r=`The value of "${t}" is out of range.`,o=n;return Number.isInteger(n)&&Math.abs(n)>2**32?o=$(String(n)):"bigint"==typeof n&&(o=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(o=$(o)),o+="n"),r+=` It must be ${e}. Received ${o}`,r}),RangeError);const V=/[^+/0-9A-Za-z-_]/g;function G(t,e){let n;e=e||1/0;const r=t.length;let o=null;const i=[];for(let s=0;s55295&&n<57344){if(!o){if(n>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(e-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((e-=1)<0)break;i.push(n)}else if(n<2048){if((e-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function H(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(V,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function J(t,e,n,r){let o;for(o=0;o=e.length||o>=t.length);++o)e[o+n]=t[o];return o}function Y(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function Z(t){return t!=t}const K=function(){const t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let o=0;o<16;++o)e[r+o]=t[n]+t[o]}return e}();function X(t){return"undefined"==typeof BigInt?Q:t}function Q(){throw new Error("BigInt not supported")}}(u);const w=new t("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");new t("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");const b=new t("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");new t("So11111111111111111111111111111111111111112"),new t("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");var k={};Object.defineProperty(k,"__esModule",{value:!0});var I=k.s16=k.s8=k.nu64be=k.u48be=k.u40be=k.u32be=k.u24be=k.u16be=k.nu64=k.u48=k.u40=at=k.u32=k.u24=st=k.u16=it=k.u8=k.offset=k.greedy=k.Constant=k.UTF8=k.CString=k.Blob=k.Boolean=k.BitField=k.BitStructure=k.VariantLayout=k.Union=k.UnionLayoutDiscriminator=k.UnionDiscriminator=k.Structure=k.Sequence=k.DoubleBE=k.Double=k.FloatBE=k.Float=k.NearInt64BE=k.NearInt64=k.NearUInt64BE=k.NearUInt64=k.IntBE=k.Int=k.UIntBE=k.UInt=k.OffsetLayout=k.GreedyCount=k.ExternalLayout=k.bindConstructorLayout=k.nameWithProperty=k.Layout=k.uint8ArrayToBuffer=k.checkUint8Array=void 0;k.constant=k.utf8=k.cstr=ft=k.blob=k.unionLayoutDiscriminator=k.union=k.seq=k.bits=ct=k.struct=k.f64be=k.f64=k.f32be=k.f32=k.ns64be=k.s48be=k.s40be=k.s32be=k.s24be=k.s16be=ut=k.ns64=k.s48=k.s40=k.s32=k.s24=void 0;const A=u;function E(t){if(!(t instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}function S(t){return E(t),A.Buffer.from(t.buffer,t.byteOffset,t.length)}k.checkUint8Array=E,k.uint8ArrayToBuffer=S;class v{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}function B(t,e){return e.property?t+"["+e.property+"]":t}k.Layout=v,k.nameWithProperty=B,k.bindConstructorLayout=function(t,e){if("function"!=typeof t)throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(t,"layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof v))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(e,"boundConstructor_"))throw new Error("layout is already bound to a constructor");t.layout_=e,e.boundConstructor_=t,e.makeDestinationObject=()=>new t,Object.defineProperty(t.prototype,"encode",{value(t,n){return e.encode(this,t,n)},writable:!0}),Object.defineProperty(t,"decode",{value:(t,n)=>e.decode(t,n),writable:!0})};class T extends v{isCount(){throw new Error("ExternalLayout is abstract")}}k.ExternalLayout=T;class U extends T{constructor(t=1,e){if(!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,e),this.elementSpan=t}isCount(){return!0}decode(t,e=0){E(t);const n=t.length-e;return Math.floor(n/this.elementSpan)}encode(t,e,n){return 0}}k.GreedyCount=U;class x extends T{constructor(t,e=0,n){if(!(t instanceof v))throw new TypeError("layout must be a Layout");if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof P||this.layout instanceof L}decode(t,e=0){return this.layout.decode(t,e+this.offset)}encode(t,e,n=0){return this.layout.encode(t,e,n+this.offset)}}k.OffsetLayout=x;class P extends v{constructor(t,e){if(super(t,e),6t+r.encode(o,e,n+t)),0);return this.count instanceof T&&this.count.encode(t.length,e,n),o}}k.Sequence=V;class G extends v{constructor(t,e,n){if(!Array.isArray(t)||!t.reduce(((t,e)=>t&&e instanceof v),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof e&&void 0===n&&(n=e,e=void 0);for(const e of t)if(0>e.span&&void 0===e.property)throw new Error("fields cannot contain unnamed variable-length layout");let r=-1;try{r=t.reduce(((t,e)=>t+e.getSpan()),0)}catch(t){}super(r,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e=0){if(0<=this.span)return this.span;let n=0;try{n=this.fields.reduce(((n,r)=>{const o=r.getSpan(t,e);return e+=o,n+o}),0)}catch(t){throw new RangeError("indeterminate span")}return n}decode(t,e=0){E(t);const n=this.makeDestinationObject();for(const r of this.fields)if(void 0!==r.property&&(n[r.property]=r.decode(t,e)),e+=r.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n=0){const r=n;let o=0,i=0;for(const r of this.fields){let s=r.span;if(i=0s&&(s=r.getSpan(e,n)))}o=n,n+=s}return o+i-r}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)void 0!==n.property&&0n.span?e=-1:0<=e&&(e+=n.span)}}}k.Structure=G;class H{constructor(t){this.property=t}decode(t,e){throw new Error("UnionDiscriminator is abstract")}encode(t,e,n){throw new Error("UnionDiscriminator is abstract")}}k.UnionDiscriminator=H;class J extends H{constructor(t,e){if(!(t instanceof T&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}}k.UnionLayoutDiscriminator=J;class Y extends v{constructor(t,e,n){let r;if(t instanceof P||t instanceof L)r=new J(new x(t));else if(t instanceof T&&t.isCount())r=new J(t);else{if(!(t instanceof H))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");r=t}if(void 0===e&&(e=null),!(null===e||e instanceof v))throw new TypeError("defaultLayout must be null or a Layout");if(null!==e){if(0>e.span)throw new Error("defaultLayout must have constant span");void 0===e.property&&(e=e.replicate("content"))}let o=-1;e&&(o=e.span,0<=o&&(t instanceof P||t instanceof L)&&(o+=r.layout.span)),super(o,n),this.discriminator=r,this.usesPrefixDiscriminator=t instanceof P||t instanceof L,this.defaultLayout=e,this.registry={};let i=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(t){return i(t)},this.configGetSourceVariant=function(t){i=t.bind(this)}}getSpan(t,e=0){if(0<=this.span)return this.span;const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(Object.prototype.hasOwnProperty.call(t,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(t,this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||e.property&&Object.prototype.hasOwnProperty.call(t,e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(n.property&&Object.prototype.hasOwnProperty.call(t,n.property))return n}throw new Error("unable to infer src variant")}decode(t,e=0){let n;const r=this.discriminator,o=r.decode(t,e),i=this.registry[o];if(void 0===i){const i=this.defaultLayout;let s=0;this.usesPrefixDiscriminator&&(s=r.layout.span),n=this.makeDestinationObject(),n[r.property]=o,n[i.property]=i.decode(t,e+s)}else n=i.decode(t,e);return n}encode(t,e,n=0){const r=this.getSourceVariant(t);if(void 0===r){const r=this.discriminator,o=this.defaultLayout;let i=0;return this.usesPrefixDiscriminator&&(i=r.layout.span),r.encode(t[r.property],e,n),i+o.encode(t[o.property],e,n+i)}return r.encode(t,e,n)}addVariant(t,e,n){const r=new Z(this,t,e,n);return this.registry[t]=r,r}getVariant(t,e=0){let n;return n=t instanceof Uint8Array?this.discriminator.decode(t,e):t,this.registry[n]}}k.Union=Y;class Z extends v{constructor(t,e,n,r){if(!(t instanceof Y))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if("string"==typeof n&&void 0===r&&(r=n,n=null),n){if(!(n instanceof v))throw new TypeError("layout must be a Layout");if(null!==t.defaultLayout&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if("string"!=typeof r)throw new TypeError("variant must have a String property")}let o=t.span;0>t.span&&(o=n?n.span:0,0<=o&&t.usesPrefixDiscriminator&&(o+=t.discriminator.layout.span)),super(o,r),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e=0){if(0<=this.span)return this.span;let n=0;this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span);let r=0;return this.layout&&(r=this.layout.getSpan(t,e+n)),n+r}decode(t,e=0){const n=this.makeDestinationObject();if(this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let r=0;return this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n=0){let r=0;if(this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(t,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let o=r;if(this.layout&&(this.layout.encode(t[this.property],e,n+r),o+=this.layout.getSpan(e,n+r),0<=this.union.span&&o>this.union.span))throw new Error("encoded variant overruns containing union");return o}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}function K(t){return 0>t&&(t+=4294967296),t}k.VariantLayout=Z;class X extends v{constructor(t,e,n){if(!(t instanceof P||t instanceof L))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof e&&void 0===n&&(n=e,e=!1),4=e)throw new TypeError("bits must be positive integer");const r=8*t.span,o=t.fields.reduce(((t,e)=>t+e.bits),0);if(e+o>r)throw new Error("bits too long for span remainder ("+(r-o)+" of "+r+" remain)");this.container=t,this.bits=e,this.valueMask=(1<>>this.start}encode(t){if("number"!=typeof t||!Number.isInteger(t)||t!==K(t&this.valueMask))throw new TypeError(B("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),n=K(t<n&&(n=this.length.decode(t,e)),n}decode(t,e=0){let n=this.span;return 0>n&&(n=this.length.decode(t,e)),S(t).slice(e,e+n)}encode(t,e,n){let r=this.length;if(this.length instanceof T&&(r=t.length),!(t instanceof Uint8Array&&r===t.length))throw new TypeError(B("Blob.encode",this)+" requires (length "+r+") Uint8Array as src");if(n+r>e.length)throw new RangeError("encoding overruns Uint8Array");const o=S(t);return S(e).write(o.toString("hex"),n,r,"hex"),this.length instanceof T&&this.length.encode(r,e,n),r}}k.Blob=et;class nt extends v{constructor(t){super(-1,t)}getSpan(t,e=0){E(t);let n=e;for(;ne.length)throw new RangeError("encoding overruns Buffer");const i=S(e);return r.copy(i,n),i[n+o]=0,o+1}}k.CString=nt;class rt extends v{constructor(t,e){if("string"==typeof t&&void 0===e&&(e=t,t=void 0),void 0===t)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,e),this.maxSpan=t}getSpan(t,e=0){return E(t),t.length-e}decode(t,e=0){const n=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpane.length)throw new RangeError("encoding overruns Buffer");return r.copy(S(e),n),o}}k.UTF8=rt;class ot extends v{constructor(t,e){super(0,e),this.value=t}decode(t,e){return this.value}encode(t,e,n){return 0}}k.Constant=ot,k.greedy=(t,e)=>new U(t,e),k.offset=(t,e,n)=>new x(t,e,n);var it=k.u8=t=>new P(1,t),st=k.u16=t=>new P(2,t);k.u24=t=>new P(3,t);var at=k.u32=t=>new P(4,t);k.u40=t=>new P(5,t),k.u48=t=>new P(6,t),k.nu64=t=>new F(t),k.u16be=t=>new L(2,t),k.u24be=t=>new L(3,t),k.u32be=t=>new L(4,t),k.u40be=t=>new L(5,t),k.u48be=t=>new L(6,t),k.nu64be=t=>new N(t),k.s8=t=>new C(1,t),I=k.s16=t=>new C(2,t),k.s24=t=>new C(3,t),k.s32=t=>new C(4,t),k.s40=t=>new C(5,t),k.s48=t=>new C(6,t);var ut=k.ns64=t=>new _(t);k.s16be=t=>new M(2,t),k.s24be=t=>new M(3,t),k.s32be=t=>new M(4,t),k.s40be=t=>new M(5,t),k.s48be=t=>new M(6,t),k.ns64be=t=>new D(t),k.f32=t=>new $(t),k.f32be=t=>new W(t),k.f64=t=>new j(t),k.f64be=t=>new q(t);var ct=k.struct=(t,e,n)=>new G(t,e,n);k.bits=(t,e,n)=>new X(t,e,n),k.seq=(t,e,n)=>new V(t,e,n),k.union=(t,e,n)=>new Y(t,e,n),k.unionLayoutDiscriminator=(t,e)=>new J(t,e);var ft=k.blob=(t,e)=>new et(t,e);k.cstr=t=>new nt(t),k.utf8=(t,e)=>new rt(t,e),k.constant=(t,e)=>new ot(t,e);const ht=t=>({decode:t.decode.bind(t),encode:t.encode.bind(t)});var dt={};Object.defineProperty(dt,"__esModule",{value:!0});var lt=dt.toBigIntLE=function(t){{const e=Buffer.from(t);e.reverse();const n=e.toString("hex");return 0===n.length?BigInt(0):BigInt(`0x${n}`)}};dt.toBigIntBE=function(t){{const e=t.toString("hex");return 0===e.length?BigInt(0):BigInt(`0x${e}`)}};var pt=dt.toBufferLE=function(t,e){{const n=t.toString(16),r=Buffer.from(n.padStart(2*e,"0").slice(0,2*e),"hex");return r.reverse(),r}};dt.toBufferBE=function(t,e){{const n=t.toString(16);return Buffer.from(n.padStart(2*e,"0").slice(0,2*e),"hex")}};const gt=(yt=8,t=>{const e=ft(yt,t),{encode:n,decode:r}=ht(e),o=e;return o.decode=(t,e)=>{const n=r(t,e);return lt(Buffer.from(n))},o.encode=(t,e,r)=>{const o=pt(t,yt);return n(o,e,r)},o});var yt;const mt=t=>{const e=it(t),{encode:n,decode:r}=ht(e),o=e;return o.decode=(t,e)=>!!r(t,e),o.encode=(t,e,r)=>{const o=Number(t);return n(o,e,r)},o},wt=e=>{const n=ft(32,e),{encode:r,decode:o}=ht(n),i=n;return i.decode=(e,n)=>{const r=o(e,n);return new t(r)},i.encode=(t,e,n)=>{const o=t.toBuffer();return r(o,e,n)},i};class bt extends Error{constructor(t){super(t)}}class kt extends bt{constructor(){super(...arguments),this.name="TokenInvalidInstructionProgramError"}}class It extends bt{constructor(){super(...arguments),this.name="TokenInvalidInstructionKeysError"}}class At extends bt{constructor(){super(...arguments),this.name="TokenInvalidInstructionDataError"}}class Et extends bt{constructor(){super(...arguments),this.name="TokenInvalidInstructionTypeError"}}var St;!function(t){t[t.InitializeMint=0]="InitializeMint",t[t.InitializeAccount=1]="InitializeAccount",t[t.InitializeMultisig=2]="InitializeMultisig",t[t.Transfer=3]="Transfer",t[t.Approve=4]="Approve",t[t.Revoke=5]="Revoke",t[t.SetAuthority=6]="SetAuthority",t[t.MintTo=7]="MintTo",t[t.Burn=8]="Burn",t[t.CloseAccount=9]="CloseAccount",t[t.FreezeAccount=10]="FreezeAccount",t[t.ThawAccount=11]="ThawAccount",t[t.TransferChecked=12]="TransferChecked",t[t.ApproveChecked=13]="ApproveChecked",t[t.MintToChecked=14]="MintToChecked",t[t.BurnChecked=15]="BurnChecked",t[t.InitializeAccount2=16]="InitializeAccount2",t[t.SyncNative=17]="SyncNative",t[t.InitializeAccount3=18]="InitializeAccount3",t[t.InitializeMultisig2=19]="InitializeMultisig2",t[t.InitializeMint2=20]="InitializeMint2",t[t.GetAccountDataSize=21]="GetAccountDataSize",t[t.InitializeImmutableOwner=22]="InitializeImmutableOwner",t[t.AmountToUiAmount=23]="AmountToUiAmount",t[t.UiAmountToAmount=24]="UiAmountToAmount",t[t.InitializeMintCloseAuthority=25]="InitializeMintCloseAuthority",t[t.TransferFeeExtension=26]="TransferFeeExtension",t[t.ConfidentialTransferExtension=27]="ConfidentialTransferExtension",t[t.DefaultAccountStateExtension=28]="DefaultAccountStateExtension",t[t.Reallocate=29]="Reallocate",t[t.MemoTransferExtension=30]="MemoTransferExtension",t[t.CreateNativeMint=31]="CreateNativeMint",t[t.InitializeNonTransferableMint=32]="InitializeNonTransferableMint",t[t.InterestBearingMintExtension=33]="InterestBearingMintExtension",t[t.CpiGuardExtension=34]="CpiGuardExtension",t[t.InitializePermanentDelegate=35]="InitializePermanentDelegate"}(St||(St={})),ct([it("instruction"),gt("amount")]);const vt=ct([it("instruction"),gt("amount")]);function Bt(t,e=w){if(!t.programId.equals(e))throw new kt;if(t.data.length!==vt.span)throw new At;const{keys:{account:n,delegate:r,owner:o,multiSigners:i},data:s}=function({programId:t,keys:[e,n,r,...o],data:i}){return{programId:t,keys:{account:e,delegate:n,owner:r,multiSigners:o},data:vt.decode(i)}}(t);if(s.instruction!==St.Approve)throw new Et;if(!n||!r||!o)throw new It;return{programId:e,keys:{account:n,delegate:r,owner:o,multiSigners:i},data:s}}const Tt=ct([it("instruction"),gt("amount"),it("decimals")]);function Ut(t,e=w){if(!t.programId.equals(e))throw new kt;if(t.data.length!==Tt.span)throw new At;const{keys:{account:n,mint:r,delegate:o,owner:i,multiSigners:s},data:a}=function({programId:t,keys:[e,n,r,o,...i],data:s}){return{programId:t,keys:{account:e,mint:n,delegate:r,owner:o,multiSigners:i},data:Tt.decode(s)}}(t);if(a.instruction!==St.ApproveChecked)throw new Et;if(!(n&&r&&o&&i))throw new It;return{programId:e,keys:{account:n,mint:r,delegate:o,owner:i,multiSigners:s},data:a}}const xt=ct([it("instruction"),gt("amount")]);function Pt(t,e=w){if(!t.programId.equals(e))throw new kt;if(t.data.length!==xt.span)throw new At;const{keys:{account:n,mint:r,owner:o,multiSigners:i},data:s}=function({programId:t,keys:[e,n,r,...o],data:i}){return{programId:t,keys:{account:e,mint:n,owner:r,multiSigners:o},data:xt.decode(i)}}(t);if(s.instruction!==St.Burn)throw new Et;if(!n||!r||!o)throw new It;return{programId:e,keys:{account:n,mint:r,owner:o,multiSigners:i},data:s}}const Lt=ct([it("instruction"),gt("amount"),it("decimals")]);function Ct(t,e=w){if(!t.programId.equals(e))throw new kt;if(t.data.length!==Lt.span)throw new At;const{keys:{account:n,mint:r,owner:o,multiSigners:i},data:s}=function({programId:t,keys:[e,n,r,...o],data:i}){return{programId:t,keys:{account:e,mint:n,owner:r,multiSigners:o},data:Lt.decode(i)}}(t);if(s.instruction!==St.BurnChecked)throw new Et;if(!n||!r||!o)throw new It;return{programId:e,keys:{account:n,mint:r,owner:o,multiSigners:i},data:s}}const Mt=ct([it("instruction")]);function zt(t,e=w){if(!t.programId.equals(e))throw new kt;if(t.data.length!==Mt.span)throw new At;const{keys:{account:n,destination:r,authority:o,multiSigners:i},data:s}=function({programId:t,keys:[e,n,r,...o],data:i}){return{programId:t,keys:{account:e,destination:n,authority:r,multiSigners:o},data:Mt.decode(i)}}(t);if(s.instruction!==St.CloseAccount)throw new Et;if(!n||!r||!o)throw new It;return{programId:e,keys:{account:n,destination:r,authority:o,multiSigners:i},data:s}}var Ot;!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Mint=1]="Mint",t[t.Account=2]="Account"}(Ot||(Ot={}));var Rt;ct([it("m"),it("n"),mt("isInitialized"),wt("signer1"),wt("signer2"),wt("signer3"),wt("signer4"),wt("signer5"),wt("signer6"),wt("signer7"),wt("signer8"),wt("signer9"),wt("signer10"),wt("signer11")]).span,function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initialized=1]="Initialized",t[t.Frozen=2]="Frozen"}(Rt||(Rt={}));ct([wt("mint"),wt("owner"),gt("amount"),at("delegateOption"),wt("delegate"),it("state"),at("isNativeOption"),gt("isNative"),gt("delegatedAmount"),at("closeAuthorityOption"),wt("closeAuthority")]).span;var Ft;ct([at("mintAuthorityOption"),wt("mintAuthority"),gt("supply"),it("decimals"),mt("isInitialized"),at("freezeAuthorityOption"),wt("freezeAuthority")]).span,function(t){t[t.Enable=0]="Enable",t[t.Disable=1]="Disable"}(Ft||(Ft={})),ct([it("instruction"),it("cpiGuardInstruction")]);var Nt;ct([mt("lockCpi")]).span,function(t){t[t.Initialize=0]="Initialize",t[t.Update=1]="Update"}(Nt||(Nt={})),ct([it("instruction"),it("defaultAccountStateInstruction"),it("accountState")]);ct([it("state")]).span;ct([]).span;var _t;ct([wt("rateAuthority"),ut("initializationTimestamp"),I("preUpdateAverageRate"),ut("lastUpdateTimestamp"),I("currentRate")]).span,function(t){t[t.Enable=0]="Enable",t[t.Disable=1]="Disable"}(_t||(_t={})),ct([it("instruction"),it("memoTransferInstruction")]);ct([mt("requireIncomingTransferMemos")]).span;ct([wt("closeAuthority")]).span;const Dt=ct([]);Dt.span,Dt.span;var $t;function Wt(t){return ct([gt("epoch"),gt("maximumFee"),st("transferFeeBasisPoints")],t)}ct([wt("delegate")]).span,function(t){t[t.InitializeTransferFeeConfig=0]="InitializeTransferFeeConfig",t[t.TransferCheckedWithFee=1]="TransferCheckedWithFee",t[t.WithdrawWithheldTokensFromMint=2]="WithdrawWithheldTokensFromMint",t[t.WithdrawWithheldTokensFromAccounts=3]="WithdrawWithheldTokensFromAccounts",t[t.HarvestWithheldTokensToMint=4]="HarvestWithheldTokensToMint",t[t.SetTransferFee=5]="SetTransferFee"}($t||($t={})),ct([it("instruction"),it("transferFeeInstruction"),it("transferFeeConfigAuthorityOption"),wt("transferFeeConfigAuthority"),it("withdrawWithheldAuthorityOption"),wt("withdrawWithheldAuthority"),st("transferFeeBasisPoints"),gt("maximumFee")]),ct([it("instruction"),it("transferFeeInstruction"),gt("amount"),it("decimals"),gt("fee")]),ct([it("instruction"),it("transferFeeInstruction")]),ct([it("instruction"),it("transferFeeInstruction"),it("numTokenAccounts")]),ct([it("instruction"),it("transferFeeInstruction")]);ct([wt("transferFeeConfigAuthority"),wt("withdrawWithheldAuthority"),gt("withheldAmount"),Wt("olderTransferFee"),Wt("newerTransferFee")]).span;var jt;ct([gt("withheldAmount")]).span,function(t){t[t.Uninitialized=0]="Uninitialized",t[t.TransferFeeConfig=1]="TransferFeeConfig",t[t.TransferFeeAmount=2]="TransferFeeAmount",t[t.MintCloseAuthority=3]="MintCloseAuthority",t[t.ConfidentialTransferMint=4]="ConfidentialTransferMint",t[t.ConfidentialTransferAccount=5]="ConfidentialTransferAccount",t[t.DefaultAccountState=6]="DefaultAccountState",t[t.ImmutableOwner=7]="ImmutableOwner",t[t.MemoTransfer=8]="MemoTransfer",t[t.NonTransferable=9]="NonTransferable",t[t.InterestBearingConfig=10]="InterestBearingConfig",t[t.CpiGuard=11]="CpiGuard",t[t.PermanentDelegate=12]="PermanentDelegate",t[t.NonTransferableAccount=13]="NonTransferableAccount"}(jt||(jt={}));const qt=ct([it("instruction")]);function Vt(t,e=w){if(!t.programId.equals(e))throw new kt;if(t.data.length!==qt.span)throw new At;const{keys:{account:n,mint:r,owner:o,rent:i},data:s}=function({programId:t,keys:[e,n,r,o],data:i}){return{programId:t,keys:{account:e,mint:n,owner:r,rent:o},data:qt.decode(i)}}(t);if(s.instruction!==St.InitializeAccount)throw new Et;if(!(n&&r&&o&&i))throw new It;return{programId:e,keys:{account:n,mint:r,owner:o,rent:i},data:s}}ct([it("instruction"),it("decimals"),wt("mintAuthority"),it("freezeAuthorityOption"),wt("freezeAuthority")]);const Gt=ct([it("instruction"),it("m")]);function Ht(t,e=w){if(!t.programId.equals(e))throw new kt;if(t.data.length!==Gt.span)throw new At;const{keys:{account:n,rent:r,signers:o},data:i}=function({programId:t,keys:[e,n,...r],data:o}){return{programId:t,keys:{account:e,rent:n,signers:r},data:Gt.decode(o)}}(t);if(i.instruction!==St.InitializeMultisig)throw new Et;if(!n||!r||!o.length)throw new It;return{programId:e,keys:{account:n,rent:r,signers:o},data:i}}ct([it("instruction")]),ct([it("instruction")]);const Jt=ct([it("instruction")]);function Yt(t,e=w){if(!t.programId.equals(e))throw new kt;if(t.data.length!==Jt.span)throw new At;const{keys:{account:n,mint:r,authority:o,multiSigners:i},data:s}=function({programId:t,keys:[e,n,r,...o],data:i}){return{programId:t,keys:{account:e,mint:n,authority:r,multiSigners:o},data:Jt.decode(i)}}(t);if(s.instruction!==St.FreezeAccount)throw new Et;if(!n||!r||!o)throw new It;return{programId:e,keys:{account:n,mint:r,authority:o,multiSigners:i},data:s}}const Zt=ct([it("instruction"),gt("amount")]);function Kt(t,e=w){if(!t.programId.equals(e))throw new kt;if(t.data.length!==Zt.span)throw new At;const{keys:{mint:n,destination:r,authority:o,multiSigners:i},data:s}=function({programId:t,keys:[e,n,r,...o],data:i}){return{programId:t,keys:{mint:e,destination:n,authority:r,multiSigners:o},data:Zt.decode(i)}}(t);if(s.instruction!==St.MintTo)throw new Et;if(!n||!r||!o)throw new It;return{programId:e,keys:{mint:n,destination:r,authority:o,multiSigners:i},data:s}}const Xt=ct([it("instruction"),gt("amount"),it("decimals")]);function Qt(t,e=w){if(!t.programId.equals(e))throw new kt;if(t.data.length!==Xt.span)throw new At;const{keys:{mint:n,destination:r,authority:o,multiSigners:i},data:s}=function({programId:t,keys:[e,n,r,...o],data:i}){return{programId:t,keys:{mint:e,destination:n,authority:r,multiSigners:o},data:Xt.decode(i)}}(t);if(s.instruction!==St.MintToChecked)throw new Et;if(!n||!r||!o)throw new It;return{programId:e,keys:{mint:n,destination:r,authority:o,multiSigners:i},data:s}}const te=ct([it("instruction")]);function ee(t,e=w){if(!t.programId.equals(e))throw new kt;if(t.data.length!==te.span)throw new At;const{keys:{account:n,owner:r,multiSigners:o},data:i}=function({programId:t,keys:[e,n,...r],data:o}){return{programId:t,keys:{account:e,owner:n,multiSigners:r},data:te.decode(o)}}(t);if(i.instruction!==St.Revoke)throw new Et;if(!n||!r)throw new It;return{programId:e,keys:{account:n,owner:r,multiSigners:o},data:i}}var ne;!function(t){t[t.MintTokens=0]="MintTokens",t[t.FreezeAccount=1]="FreezeAccount",t[t.AccountOwner=2]="AccountOwner",t[t.CloseAccount=3]="CloseAccount"}(ne||(ne={}));const re=ct([it("instruction"),it("authorityType"),it("newAuthorityOption"),wt("newAuthority")]);function oe(t,e=w){if(!t.programId.equals(e))throw new kt;if(t.data.length!==re.span)throw new At;const{keys:{account:n,currentAuthority:r,multiSigners:o},data:i}=function({programId:t,keys:[e,n,...r],data:o}){const{instruction:i,authorityType:s,newAuthorityOption:a,newAuthority:u}=re.decode(o);return{programId:t,keys:{account:e,currentAuthority:n,multiSigners:r},data:{instruction:i,authorityType:s,newAuthority:a?u:null}}}(t);if(i.instruction!==St.SetAuthority)throw new Et;if(!n||!r)throw new It;return{programId:e,keys:{account:n,currentAuthority:r,multiSigners:o},data:i}}const ie=ct([it("instruction")]);function se(t,e=w){if(!t.programId.equals(e))throw new kt;if(t.data.length!==ie.span)throw new At;const{keys:{account:n,mint:r,authority:o,multiSigners:i},data:s}=function({programId:t,keys:[e,n,r,...o],data:i}){return{programId:t,keys:{account:e,mint:n,authority:r,multiSigners:o},data:ie.decode(i)}}(t);if(s.instruction!==St.ThawAccount)throw new Et;if(!n||!r||!o)throw new It;return{programId:e,keys:{account:n,mint:r,authority:o,multiSigners:i},data:s}}const ae=ct([it("instruction"),gt("amount")]);function ue(t,e=w){if(!t.programId.equals(e))throw new kt;if(t.data.length!==ae.span)throw new At;const{keys:{source:n,destination:r,owner:o,multiSigners:i},data:s}=function({programId:t,keys:[e,n,r,...o],data:i}){return{programId:t,keys:{source:e,destination:n,owner:r,multiSigners:o},data:ae.decode(i)}}(t);if(s.instruction!==St.Transfer)throw new Et;if(!n||!r||!o)throw new It;return{programId:e,keys:{source:n,destination:r,owner:o,multiSigners:i},data:s}}const ce=ct([it("instruction"),gt("amount"),it("decimals")]);function fe(t,e=w){if(!t.programId.equals(e))throw new kt;if(t.data.length!==ce.span)throw new At;const{keys:{source:n,mint:r,destination:o,owner:i,multiSigners:s},data:a}=function({programId:t,keys:[e,n,r,o,...i],data:s}){return{programId:t,keys:{source:e,mint:n,destination:r,owner:o,multiSigners:i},data:ce.decode(s)}}(t);if(a.instruction!==St.TransferChecked)throw new Et;if(!(n&&r&&o&&i))throw new It;return{programId:e,keys:{source:n,mint:r,destination:o,owner:i,multiSigners:s},data:a}}const he=ct([it("instruction"),it("decimals"),wt("mintAuthority"),it("freezeAuthorityOption"),wt("freezeAuthority")]);function de({programId:t,keys:[e,n],data:r}){const{instruction:o,decimals:i,mintAuthority:s,freezeAuthorityOption:a,freezeAuthority:u}=he.decode(r);return{programId:t,keys:{mint:e,rent:n},data:{instruction:o,decimals:i,mintAuthority:s,freezeAuthority:a?u:null}}}var le;function pe(t){const e=t.startsWith("0x")?t.slice(2):t;return Buffer.from(e)}function ge(e,n=void 0){const r="legacy"===e.version?e.accountKeys:e.staticAccountKeys,o=e.header.numReadonlySignedAccounts,i=e.header.numReadonlyUnsignedAccounts,s=e.header.numRequiredSignatures,a=r.length;let u=r.map(((e,n)=>({isSigner:n=s&&n({isSigner:!1,isWritable:!0,pubkey:t})))]),f&&(u=[...u,...f.map((t=>({isSigner:!1,isWritable:!1,pubkey:t})))]),u}function ye(t,n){if("string"==typeof t.data){const r=t;return new e({data:i.bytes.bs58.decode(r.data),programId:n[r.programIdIndex].pubkey,keys:r.accounts.map((t=>n[t]))})}{const r=t;return new e({data:Buffer.from(r.data),programId:n[r.programIdIndex].pubkey,keys:r.accountKeyIndexes.map((t=>{if(t>=n.length)throw new Error(`Trying to resolve account at index ${t} while parsedAccounts is only ${n.length}. \t\t\t\t\t\tLooks like you're trying to parse versioned transaction, make sure that LoadedAddresses are passed to the \t\t\t\t\t\tparseTransactionAccounts function`);return n[t]}))})}}function me(t,e){const n=e.map((t=>({pk:t.pubkey.toString(),...t})));return t.map((t=>{const e=t.toString(),r=n.find((t=>t.pk===e));if(!r)throw new Error(`Account ${e} not present in account meta!`);return r}))}function we(t,n){return new e({data:i.bytes.bs58.decode(t.data),programId:t.programId,keys:me(t.accounts,n)})}function be(t){var e,n,r;const o=[];if(null==t)return[];const i=t.transaction.message.compiledInstructions,s=ge(t.transaction.message,null===(e=t.meta)||void 0===e?void 0:e.loadedAddresses),a=((null===(n=null==t?void 0:t.meta)||void 0===n?void 0:n.innerInstructions)||[]).sort(((t,e)=>t.index-e.index)),u=((null===(r=t.meta)||void 0===r?void 0:r.innerInstructions)||[]).reduce(((t,e)=>t+e.instructions.length),0)+i.length;let c=-1,f=-1;for(const t of a){for(;c!==t.index;)c+=1,f+=1,o.push(ye(i[c],s));for(const e of t.instructions)o.push(ye(e,s)),f+=1}for(;f^Log truncated$)|(?^Program (?[1-9A-HJ-NP-Za-km-z]{32,}) invoke \[(?\d+)\]$)|(?^Program (?[1-9A-HJ-NP-Za-km-z]{32,}) success$)|(?^Program (?[1-9A-HJ-NP-Za-km-z]{32,}) failed: (?.*)$)|(?^Program failed to complete: (?.*)$)|(?^^Program log: (?.*)$)|(?^Program data: (?.*)$)|(?^Program (?[1-9A-HJ-NP-Za-km-z]{32,}) consumed (?\d*) of (?\d*) compute units$)|(?^Program return: (?[1-9A-HJ-NP-Za-km-z]{32,}) (?.*)$)/s,n=[];let r=-1,o=0,i=0;const s=[],a=[];for(const u of t){const t=e.exec(u);if(!t||!t.groups)throw new Error(`Failed to parse log line: ${u}`);if(t.groups.logTruncated)n[a[a.length-1]].invokeResult="Log truncated";else if(t.groups.programInvoke){if(s.push(t.groups.invokeProgramId),r+=1,i+=1,a.push(r),t.groups.level!=i.toString())throw new Error(`invoke depth mismatch, log: ${t.groups.level}, expected: ${i}`);n.push(ke(s[s.length-1],s.length,r,o)),n[n.length-1].rawLogs.push(u)}else if(t.groups.programSuccessResult){const e=s.pop(),r=a.pop();if(void 0===r)throw new Error("callIds malformed");if(e!=t.groups.successResultProgramId)throw new Error("[ProramSuccess] callstack mismatch");n[r].rawLogs.push(u),i-=1,0===i&&(o+=1)}else if(t.groups.programFailedResult){if(s.pop()!=t.groups.failedResultProgramId)throw new Error("[ProgramFailed] callstack mismatch");n[a[a.length-1]].rawLogs.push(u),n[a[a.length-1]].errors.push(t.groups.failedResultErr)}else if(t.groups.programCompleteFailedResult)n[a[a.length-1]].rawLogs.push(u),n[a[a.length-1]].errors.push(t.groups.failedCompleteError);else if(t.groups.programLog)n[a[a.length-1]].rawLogs.push(u),n[a[a.length-1]].logMessages.push(t.groups.logMessage);else if(t.groups.programData)n[a[a.length-1]].rawLogs.push(u),n[a[a.length-1]].dataLogs.push(t.groups.data);else if(t.groups.programConsumed)n[a[a.length-1]].rawLogs.push(u);else if(t.groups.programReturn){if(s[s.length-1]!=t.groups.returnProgramId)throw new Error("[InvokeReturn]: callstack mismatch");n[a[a.length-1]].invokeResult=t.groups.returnMessage}}return n}function Ae(t){let e;switch(o.decodeInstructionType(t)){case"AdvanceNonceAccount":{const n=o.decodeNonceAdvance(t);e={name:"advanceNonceAccount",accounts:[{name:"nonce",pubkey:n.noncePubkey,isSigner:!1,isWritable:!0},{name:"recentBlockhashSysvar",...t.keys[1]},{name:"nonceAuthority",pubkey:n.authorizedPubkey,isSigner:!0,isWritable:!1}],args:{}};break}case"Allocate":{const n=o.decodeAllocate(t);e={name:"allocate",accounts:[{name:"newAccount",pubkey:n.accountPubkey,isSigner:!0,isWritable:!0}],args:{space:new s(n.space)}};break}case"AllocateWithSeed":{const n=o.decodeAllocateWithSeed(t);e={name:"allocateWithSeed",accounts:[{name:"newAccount",pubkey:n.accountPubkey,isSigner:!1,isWritable:!0},{name:"base",pubkey:n.basePubkey,isSigner:!0,isWritable:!1}],args:{seed:n.seed,space:new s(n.space),owner:n.programId,base:n.basePubkey}};break}case"Assign":{const n=o.decodeAssign(t);e={name:"assign",accounts:[{name:"assignedAccount",pubkey:n.accountPubkey,isSigner:!0,isWritable:!0}],args:{owner:n.programId}};break}case"AssignWithSeed":{const n=o.decodeAssignWithSeed(t);e={name:"assignWithSeed",accounts:[{name:"assigned",pubkey:n.accountPubkey,isSigner:!1,isWritable:!0},{name:"base",pubkey:n.basePubkey,isSigner:!0,isWritable:!1}],args:{seed:n.seed,owner:n.programId,base:n.basePubkey}};break}case"AuthorizeNonceAccount":{const n=o.decodeNonceAuthorize(t);e={name:"authorizeNonceAccount",accounts:[{name:"nonce",isSigner:!1,isWritable:!0,pubkey:n.noncePubkey},{name:"nonceAuthority",isSigner:!0,isWritable:!1,pubkey:n.authorizedPubkey}],args:{authorized:n.newAuthorizedPubkey}};break}case"Create":{const n=o.decodeCreateAccount(t);e={name:"createAccount",accounts:[{name:"payer",pubkey:n.fromPubkey,isSigner:!0,isWritable:!0},{name:"newAccount",pubkey:n.newAccountPubkey,isSigner:!0,isWritable:!0}],args:{lamports:new s(n.lamports),owner:n.programId,space:new s(n.space)}};break}case"CreateWithSeed":{const n=o.decodeCreateWithSeed(t);e={name:"createAccountWithSeed",accounts:[{name:"payer",pubkey:n.fromPubkey,isSigner:!0,isWritable:!0},{name:"created",pubkey:n.newAccountPubkey,isSigner:!1,isWritable:!0},{name:"base",pubkey:n.basePubkey,isSigner:!0,isWritable:!1}],args:{lamports:new s(n.lamports),owner:n.programId,space:new s(n.space),seed:n.seed,base:n.basePubkey}};break}case"InitializeNonceAccount":{const n=o.decodeNonceInitialize(t);e={name:"initializeNonceAccount",accounts:[{name:"nonce",pubkey:n.noncePubkey,isSigner:!1,isWritable:!0},{name:"recentBlockhashSysvar",...t.keys[1]},{name:"rentSysvar",...t.keys[2]}],args:{authorized:n.authorizedPubkey}};break}case"Transfer":{const n=o.decodeTransfer(t);e={name:"transfer",accounts:[{name:"sender",pubkey:n.fromPubkey,isSigner:!0,isWritable:!0},{name:"receiver",pubkey:n.toPubkey,isWritable:!0,isSigner:!1}],args:{lamports:new s(n.lamports.toString())}};break}case"TransferWithSeed":{const n=o.decodeTransferWithSeed(t);e={name:"transferWithSeed",accounts:[{name:"sender",pubkey:n.fromPubkey,isSigner:!1,isWritable:!0},{name:"base",pubkey:n.basePubkey,isSigner:!0,isWritable:!1},{name:"receiver",pubkey:n.toPubkey,isSigner:!1,isWritable:!0}],args:{owner:n.programId,lamports:new s(n.lamports.toString()),seed:n.seed}};break}case"WithdrawNonceAccount":{const n=o.decodeNonceWithdraw(t);e={name:"withdrawNonceAccount",accounts:[{name:"nonce",pubkey:n.noncePubkey,isSigner:!1,isWritable:!0},{name:"recepient",pubkey:n.toPubkey,isSigner:!1,isWritable:!0},{name:"recentBlockhashSysvar",...t.keys[2]},{name:"rentSysvar",...t.keys[3]},{name:"nonceAuthority",pubkey:n.noncePubkey,isSigner:!0,isWritable:!1}],args:{lamports:new s(n.lamports)}};break}default:e=null}return e?{...e,programId:n.programId}:{programId:n.programId,name:"unknown",accounts:t.keys,args:{unknown:t.data}}}function Ee(e){let n;switch(it().decode(e.data)){case St.InitializeMint:{const t=function(t,e=w){if(!t.programId.equals(e))throw new kt;if(t.data.length!==he.span)throw new At;const{keys:{mint:n,rent:r},data:o}=de(t);if(o.instruction!==St.InitializeMint)throw new Et;if(!n||!r)throw new It;return{programId:e,keys:{mint:n,rent:r},data:o}}(e);n={name:"initializeMint",accounts:[{name:"tokenMint",...t.keys.mint},{name:"rentSysvar",...t.keys.rent}],args:{decimals:t.data.decimals,mintAuthority:t.data.mintAuthority,freezeAuthority:t.data.freezeAuthority}};break}case St.InitializeAccount:{const t=Vt(e);n={name:"initializeAccount",accounts:[{name:"newAccount",...t.keys.account},{name:"tokenMint",...t.keys.mint},{name:"owner",...t.keys.owner},{name:"rentSysvar",...t.keys.rent}],args:{}};break}case St.InitializeMultisig:{const t=Ht(e),r=t.keys.signers.map(((t,e)=>({name:`signer_${e}`,...t})));n={name:"initializeMultisig",accounts:[{name:"multisig",...t.keys.account},{name:"rentSysvar",...t.keys.rent},...r],args:{m:t.data.m}};break}case St.Transfer:{const t=ue(e),r=t.keys.multiSigners.map(((t,e)=>({name:`signer_${e}`,...t})));n={name:"transfer",accounts:[{name:"source",...t.keys.source},{name:"destination",...t.keys.destination},{name:"owner",...t.keys.owner},...r],args:{amount:new s(t.data.amount.toString())}};break}case St.Approve:{const t=Bt(e),r=t.keys.multiSigners.map(((t,e)=>({name:`signer_${e}`,...t})));n={name:"approve",accounts:[{name:"source",...t.keys.account},{name:"delegate",...t.keys.delegate},{name:"owner",...t.keys.owner},...r],args:{amount:new s(t.data.amount.toString())}};break}case St.Revoke:{const t=ee(e),r=t.keys.multiSigners.map(((t,e)=>({name:`signer_${e}`,...t})));n={name:"revoke",accounts:[{name:"source",...t.keys.account},{name:"owner",...t.keys.owner},...r],args:{}};break}case St.SetAuthority:{const t=oe(e),r={[ne.AccountOwner]:{accountOwner:{}},[ne.CloseAccount]:{closeAccount:{}},[ne.FreezeAccount]:{freezeAccount:{}},[ne.MintTokens]:{mintTokens:{}}},o=t.keys.multiSigners.map(((t,e)=>({name:`signer_${e}`,...t})));n={name:"setAuthority",accounts:[{name:"account",...t.keys.account},{name:"currentAuthority",...t.keys.currentAuthority},...o],args:{authorityType:r[t.data.authorityType],newAuthority:t.data.newAuthority}};break}case St.MintTo:{const t=Kt(e),r=t.keys.multiSigners.map(((t,e)=>({name:`signer_${e}`,...t})));n={name:"mintTo",accounts:[{name:"tokenMint",...t.keys.mint},{name:"mintTo",...t.keys.destination},{name:"authority",...t.keys.authority},...r],args:{amount:new s(t.data.amount.toString())}};break}case St.Burn:{const t=Pt(e),r=t.keys.multiSigners.map(((t,e)=>({name:`signer_${e}`,...t})));n={name:"burn",accounts:[{name:"burnFrom",...t.keys.account},{name:"tokenMint",...t.keys.mint},{name:"owner",...t.keys.owner},...r],args:{amount:new s(t.data.amount.toString())}};break}case St.CloseAccount:{const t=zt(e),r=t.keys.multiSigners.map(((t,e)=>({name:`signer_${e}`,...t})));n={name:"closeAccount",accounts:[{name:"account",...t.keys.account},{name:"destination",...t.keys.destination},{name:"owner",...t.keys.authority},...r],args:{}};break}case St.FreezeAccount:{const t=Yt(e),r=t.keys.multiSigners.map(((t,e)=>({name:`signer_${e}`,...t})));n={name:"freezeAccount",accounts:[{name:"account",...t.keys.account},{name:"tokenMint",...t.keys.mint},{name:"authority",...t.keys.authority},...r],args:{}};break}case St.ThawAccount:{const t=se(e),r=t.keys.multiSigners.map(((t,e)=>({name:`signer_${e}`,...t})));n={name:"thawAccount",accounts:[{name:"account",...t.keys.account},{name:"tokenMint",...t.keys.mint},{name:"authority",...t.keys.authority},...r],args:{}};break}case St.TransferChecked:{const t=fe(e),r=t.keys.multiSigners.map(((t,e)=>({name:`signer_${e}`,...t})));n={name:"transferChecked",accounts:[{name:"source",...t.keys.source},{name:"tokenMint",...t.keys.mint},{name:"destination",...t.keys.destination},{name:"owner",...t.keys.owner},...r],args:{amount:new s(t.data.amount.toString()),decimals:t.data.decimals}};break}case St.ApproveChecked:{const t=Ut(e),r=t.keys.multiSigners.map(((t,e)=>({name:`signer_${e}`,...t})));n={name:"approveChecked",accounts:[{name:"source",...t.keys.account},{name:"tokenMint",...t.keys.mint},{name:"delegate",...t.keys.delegate},{name:"owner",...t.keys.owner},...r],args:{amount:new s(t.data.amount.toString()),decimals:t.data.decimals}};break}case St.MintToChecked:{const t=Qt(e),r=t.keys.multiSigners.map(((t,e)=>({name:`signer_${e}`,...t})));n={name:"mintToChecked",accounts:[{name:"tokenMint",...t.keys.mint},{name:"mintTo",...t.keys.destination},{name:"authority",...t.keys.authority},...r],args:{amount:new s(t.data.amount.toString()),decimals:t.data.decimals}};break}case St.BurnChecked:{const t=Ct(e),r=t.keys.multiSigners.map(((t,e)=>({name:`signer_${e}`,...t})));n={name:"burnChecked",accounts:[{name:"burnFrom",...t.keys.account},{name:"tokenMint",...t.keys.mint},{name:"owner",...t.keys.owner},...r],args:{amount:new s(t.data.amount.toString()),decimals:t.data.decimals}};break}case St.InitializeAccount2:{const r=ct([it("instruction"),ft(32,"owner")]).decode(e.data);n={name:"initializeAccount2",accounts:[{name:"newAccount",...e.keys[0]},{name:"tokenMint",...e.keys[1]},{name:"rentSysvar",...e.keys[2]}],args:{owner:new t(r.owner)}};break}case St.SyncNative:n={name:"syncNative",accounts:[{name:"account",...e.keys[0]}],args:{}};break;case St.InitializeAccount3:{const r=ct([it("instruction"),ft(32,"owner")]).decode(e.data);n={name:"initializeAccount3",accounts:[{name:"newAccount",...e.keys[0]},{name:"tokenMint",...e.keys[1]}],args:{owner:new t(r.owner)}};break}case St.InitializeMultisig2:{const t=e.keys.slice(1).map(((t,e)=>({name:`signer_${e}`,...t})));n={name:"initializeMultisig2",accounts:[{name:"multisig",...e.keys[0]},...t],args:{m:e.data[1]}};break}case St.InitializeMint2:{const t=de(e);if(!t.keys.mint)throw new Error("Failed to parse InitializeMint2 instruction");n={name:"initializeMint2",accounts:[{name:"tokenMint",...t.keys.mint}],args:{decimals:t.data.decimals,mintAuthority:t.data.mintAuthority,freezeAuthority:t.data.freezeAuthority}};break}default:n=null}return n?{...n,programId:w}:{programId:w,name:"unknown",accounts:e.keys,args:{unknown:e.data}}}function Se(t){return{name:"createAssociatedTokenAccount",accounts:[{name:"fundingAccount",...t.keys[0]},{name:"newAccount",...t.keys[1]},{name:"wallet",...t.keys[2]},{name:"tokenMint",...t.keys[3]},{name:"systemProgram",...t.keys[4]},{name:"tokenProgram",...t.keys[5]},t.keys.length>5?{name:"rentSysvar",...t.keys[6]}:void 0],args:{},programId:b}}function ve(t,e){return t.map((t=>{const n=t.name;if(Object.prototype.hasOwnProperty.call(t,"accounts")){const r=e?`${e} > ${n}`:n;return ve(t.accounts,r)}return{...t,name:e?`${e} > ${n}`:n}})).flat()}!function(t){t[t.Initialize=0]="Initialize",t[t.UpdateRate=1]="UpdateRate"}(le||(le={})),ct([it("instruction"),it("interestBearingMintInstruction"),wt("rateAuthority"),I("rate")]),ct([it("instruction"),it("interestBearingMintInstruction"),I("rate")]),ct([it("instruction"),wt("owner")]),ct([it("instruction"),wt("owner")]),ct([it("instruction")]),ct([it("instruction"),it("closeAuthorityOption"),wt("closeAuthority")]),ct([it("instruction")]),ct([it("instruction"),wt("delegate")]);class Be{constructor(e,r){const o=[[n.programId.toBase58(),Ae],[w.toBase58(),Ee],[b.toBase58(),Se]];let i;r=r||[];for(const n of e)r.push(this.buildIdlParser(new t(n.programId),n.idl));if(r){i=new Map(r);for(const t of o)i.has(t[0])||i.set(...t)}else i=new Map(o);this.instructionParsers=i}addParser(t,e){this.instructionParsers.set(t.toBase58(),e)}addParserFromIdl(e,n){this.instructionParsers.set(...this.buildIdlParser(new t(e),n))}buildIdlParser(t,e){return[t.toBase58(),(t=>{const n=new a(e).decode(t.data);if(n){const r=e.instructions.find((t=>t.name===n.name));if(!r)return this.buildUnknownParsedInstruction(t.programId,t.keys,t.data,n.name);const o=ve(r.accounts),i=t.keys.map(((t,e)=>ethis.parseInstruction(ye(t,n))))}parseTransactionParsedData(t){const e=t.accountKeys.map((t=>({isSigner:t.signer,isWritable:t.writable,pubkey:t.pubkey})));return t.instructions.map((t=>this.parseInstruction(we(t,e))))}async parseTransaction(t,e,n=!1,r="confirmed"){var o;const i=await t.getTransaction(e,{commitment:r,maxSupportedTransactionVersion:0});if(!i)return null;if(n){return be(i).map((t=>this.parseInstruction(t)))}return this.parseTransactionData(i.transaction.message,null===(o=i.meta)||void 0===o?void 0:o.loadedAddresses)}parseTransactionDump(t){t instanceof u.Buffer||(t=u.Buffer.from(t,"base64"));const e=r.from(t).compileMessage();return this.parseTransactionData(e)}}export{Be as SolanaParser,ye as compiledInstructionToInstruction,be as flattenTransactionResponse,pe as hexToBuffer,Ie as parseLogs,ge as parseTransactionAccounts,we as parsedInstructionToInstruction}; //# sourceMappingURL=index.js.map diff --git a/dist/browser/index.js.map b/dist/browser/index.js.map index 9d36856..a46011e 100644 --- a/dist/browser/index.js.map +++ b/dist/browser/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sources":["../../node_modules/base64-js/index.js","../../node_modules/ieee754/index.js","../../node_modules/buffer/index.js","../../node_modules/@solana/spl-token/lib/esm/constants.js","../../node_modules/@solana/buffer-layout/lib/Layout.js","../../node_modules/@solana/buffer-layout-utils/lib/esm/base.mjs","../../node_modules/bigint-buffer/dist/browser.js","../../node_modules/@solana/buffer-layout-utils/lib/esm/bigint.mjs","../../node_modules/@solana/buffer-layout-utils/lib/esm/native.mjs","../../node_modules/@solana/buffer-layout-utils/lib/esm/web3.mjs","../../node_modules/@solana/spl-token/lib/esm/errors.js","../../node_modules/@solana/spl-token/lib/esm/instructions/types.js","../../node_modules/@solana/spl-token/lib/esm/instructions/amountToUiAmount.js","../../node_modules/@solana/spl-token/lib/esm/instructions/approve.js","../../node_modules/@solana/spl-token/lib/esm/instructions/approveChecked.js","../../node_modules/@solana/spl-token/lib/esm/instructions/burn.js","../../node_modules/@solana/spl-token/lib/esm/instructions/burnChecked.js","../../node_modules/@solana/spl-token/lib/esm/instructions/closeAccount.js","../../node_modules/@solana/spl-token/lib/esm/extensions/accountType.js","../../node_modules/@solana/spl-token/lib/esm/state/account.js","../../node_modules/@solana/spl-token/lib/esm/state/multisig.js","../../node_modules/@solana/spl-token/lib/esm/extensions/cpiGuard/instructions.js","../../node_modules/@solana/spl-token/lib/esm/state/mint.js","../../node_modules/@solana/spl-token/lib/esm/extensions/defaultAccountState/instructions.js","../../node_modules/@solana/spl-token/lib/esm/extensions/cpiGuard/state.js","../../node_modules/@solana/spl-token/lib/esm/extensions/defaultAccountState/state.js","../../node_modules/@solana/spl-token/lib/esm/extensions/immutableOwner.js","../../node_modules/@solana/spl-token/lib/esm/extensions/memoTransfer/instructions.js","../../node_modules/@solana/spl-token/lib/esm/extensions/interestBearingMint/state.js","../../node_modules/@solana/spl-token/lib/esm/extensions/memoTransfer/state.js","../../node_modules/@solana/spl-token/lib/esm/extensions/mintCloseAuthority.js","../../node_modules/@solana/spl-token/lib/esm/extensions/nonTransferable.js","../../node_modules/@solana/spl-token/lib/esm/extensions/transferFee/instructions.js","../../node_modules/@solana/spl-token/lib/esm/extensions/transferFee/state.js","../../node_modules/@solana/spl-token/lib/esm/extensions/permanentDelegate.js","../../node_modules/@solana/spl-token/lib/esm/extensions/extensionType.js","../../node_modules/@solana/spl-token/lib/esm/instructions/initializeAccount.js","../../node_modules/@solana/spl-token/lib/esm/instructions/initializeMint2.js","../../node_modules/@solana/spl-token/lib/esm/instructions/initializeMultisig.js","../../node_modules/@solana/spl-token/lib/esm/instructions/createNativeMint.js","../../node_modules/@solana/spl-token/lib/esm/instructions/syncNative.js","../../node_modules/@solana/spl-token/lib/esm/instructions/freezeAccount.js","../../node_modules/@solana/spl-token/lib/esm/instructions/mintTo.js","../../node_modules/@solana/spl-token/lib/esm/instructions/mintToChecked.js","../../node_modules/@solana/spl-token/lib/esm/instructions/revoke.js","../../node_modules/@solana/spl-token/lib/esm/instructions/setAuthority.js","../../node_modules/@solana/spl-token/lib/esm/instructions/thawAccount.js","../../node_modules/@solana/spl-token/lib/esm/instructions/transfer.js","../../node_modules/@solana/spl-token/lib/esm/instructions/transferChecked.js","../../node_modules/@solana/spl-token/lib/esm/instructions/initializeMint.js","../../node_modules/@solana/spl-token/lib/esm/extensions/interestBearingMint/instructions.js","../../../src/helpers.ts","../../../src/parsers.ts","../../node_modules/@solana/spl-token/lib/esm/instructions/initializeAccount2.js","../../node_modules/@solana/spl-token/lib/esm/instructions/initializeAccount3.js","../../node_modules/@solana/spl-token/lib/esm/instructions/initializeImmutableOwner.js","../../node_modules/@solana/spl-token/lib/esm/instructions/initializeMintCloseAuthority.js","../../node_modules/@solana/spl-token/lib/esm/instructions/initializeNonTransferableMint.js","../../node_modules/@solana/spl-token/lib/esm/instructions/initializePermanentDelegate.js"],"sourcesContent":["'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n","/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nconst base64 = require('base64-js')\nconst ieee754 = require('ieee754')\nconst customInspectSymbol =\n (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation\n ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation\n : null\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\nconst K_MAX_LENGTH = 0x7fffffff\nexports.kMaxLength = K_MAX_LENGTH\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Print warning and recommend using `buffer` v4.x which has an Object\n * implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * We report that the browser does not support typed arrays if the are not subclassable\n * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`\n * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support\n * for __proto__ and has a buggy typed array implementation.\n */\nBuffer.TYPED_ARRAY_SUPPORT = typedArraySupport()\n\nif (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&\n typeof console.error === 'function') {\n console.error(\n 'This browser lacks typed array (Uint8Array) support which is required by ' +\n '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'\n )\n}\n\nfunction typedArraySupport () {\n // Can typed array instances can be augmented?\n try {\n const arr = new Uint8Array(1)\n const proto = { foo: function () { return 42 } }\n Object.setPrototypeOf(proto, Uint8Array.prototype)\n Object.setPrototypeOf(arr, proto)\n return arr.foo() === 42\n } catch (e) {\n return false\n }\n}\n\nObject.defineProperty(Buffer.prototype, 'parent', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.buffer\n }\n})\n\nObject.defineProperty(Buffer.prototype, 'offset', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.byteOffset\n }\n})\n\nfunction createBuffer (length) {\n if (length > K_MAX_LENGTH) {\n throw new RangeError('The value \"' + length + '\" is invalid for option \"size\"')\n }\n // Return an augmented `Uint8Array` instance\n const buf = new Uint8Array(length)\n Object.setPrototypeOf(buf, Buffer.prototype)\n return buf\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new TypeError(\n 'The \"string\" argument must be of type string. Received type number'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\nfunction from (value, encodingOrOffset, length) {\n if (typeof value === 'string') {\n return fromString(value, encodingOrOffset)\n }\n\n if (ArrayBuffer.isView(value)) {\n return fromArrayView(value)\n }\n\n if (value == null) {\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n }\n\n if (isInstance(value, ArrayBuffer) ||\n (value && isInstance(value.buffer, ArrayBuffer))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof SharedArrayBuffer !== 'undefined' &&\n (isInstance(value, SharedArrayBuffer) ||\n (value && isInstance(value.buffer, SharedArrayBuffer)))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof value === 'number') {\n throw new TypeError(\n 'The \"value\" argument must not be of type number. Received type number'\n )\n }\n\n const valueOf = value.valueOf && value.valueOf()\n if (valueOf != null && valueOf !== value) {\n return Buffer.from(valueOf, encodingOrOffset, length)\n }\n\n const b = fromObject(value)\n if (b) return b\n\n if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&\n typeof value[Symbol.toPrimitive] === 'function') {\n return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length)\n }\n\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(value, encodingOrOffset, length)\n}\n\n// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:\n// https://github.com/feross/buffer/pull/148\nObject.setPrototypeOf(Buffer.prototype, Uint8Array.prototype)\nObject.setPrototypeOf(Buffer, Uint8Array)\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be of type number')\n } else if (size < 0) {\n throw new RangeError('The value \"' + size + '\" is invalid for option \"size\"')\n }\n}\n\nfunction alloc (size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpreted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(size).fill(fill, encoding)\n : createBuffer(size).fill(fill)\n }\n return createBuffer(size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(size, fill, encoding)\n}\n\nfunction allocUnsafe (size) {\n assertSize(size)\n return createBuffer(size < 0 ? 0 : checked(size) | 0)\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(size)\n}\n\nfunction fromString (string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n\n const length = byteLength(string, encoding) | 0\n let buf = createBuffer(length)\n\n const actual = buf.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n buf = buf.slice(0, actual)\n }\n\n return buf\n}\n\nfunction fromArrayLike (array) {\n const length = array.length < 0 ? 0 : checked(array.length) | 0\n const buf = createBuffer(length)\n for (let i = 0; i < length; i += 1) {\n buf[i] = array[i] & 255\n }\n return buf\n}\n\nfunction fromArrayView (arrayView) {\n if (isInstance(arrayView, Uint8Array)) {\n const copy = new Uint8Array(arrayView)\n return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)\n }\n return fromArrayLike(arrayView)\n}\n\nfunction fromArrayBuffer (array, byteOffset, length) {\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\"offset\" is outside of buffer bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\"length\" is outside of buffer bounds')\n }\n\n let buf\n if (byteOffset === undefined && length === undefined) {\n buf = new Uint8Array(array)\n } else if (length === undefined) {\n buf = new Uint8Array(array, byteOffset)\n } else {\n buf = new Uint8Array(array, byteOffset, length)\n }\n\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(buf, Buffer.prototype)\n\n return buf\n}\n\nfunction fromObject (obj) {\n if (Buffer.isBuffer(obj)) {\n const len = checked(obj.length) | 0\n const buf = createBuffer(len)\n\n if (buf.length === 0) {\n return buf\n }\n\n obj.copy(buf, 0, 0, len)\n return buf\n }\n\n if (obj.length !== undefined) {\n if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {\n return createBuffer(0)\n }\n return fromArrayLike(obj)\n }\n\n if (obj.type === 'Buffer' && Array.isArray(obj.data)) {\n return fromArrayLike(obj.data)\n }\n}\n\nfunction checked (length) {\n // Note: cannot use `length < K_MAX_LENGTH` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= K_MAX_LENGTH) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return b != null && b._isBuffer === true &&\n b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false\n}\n\nBuffer.compare = function compare (a, b) {\n if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)\n if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError(\n 'The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array'\n )\n }\n\n if (a === b) return 0\n\n let x = a.length\n let y = b.length\n\n for (let i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!Array.isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n let i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n const buffer = Buffer.allocUnsafe(length)\n let pos = 0\n for (i = 0; i < list.length; ++i) {\n let buf = list[i]\n if (isInstance(buf, Uint8Array)) {\n if (pos + buf.length > buffer.length) {\n if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)\n buf.copy(buffer, pos)\n } else {\n Uint8Array.prototype.set.call(\n buffer,\n buf,\n pos\n )\n }\n } else if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n } else {\n buf.copy(buffer, pos)\n }\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n throw new TypeError(\n 'The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. ' +\n 'Received type ' + typeof string\n )\n }\n\n const len = string.length\n const mustMatch = (arguments.length > 2 && arguments[2] === true)\n if (!mustMatch && len === 0) return 0\n\n // Use a for loop to avoid recursion\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) {\n return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8\n }\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n let loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coercion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)\n// to detect a Buffer instance. It's not possible to use `instanceof Buffer`\n// reliably in a browserify context because there could be multiple different\n// copies of the 'buffer' package in use. This method works even for Buffer\n// instances that were created from another copy of the `buffer` package.\n// See: https://github.com/feross/buffer/issues/154\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n const i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n const len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (let i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n const len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (let i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n const len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (let i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n const length = this.length\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.toLocaleString = Buffer.prototype.toString\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n let str = ''\n const max = exports.INSPECT_MAX_BYTES\n str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()\n if (this.length > max) str += ' ... '\n return ''\n}\nif (customInspectSymbol) {\n Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (isInstance(target, Uint8Array)) {\n target = Buffer.from(target, target.offset, target.byteLength)\n }\n if (!Buffer.isBuffer(target)) {\n throw new TypeError(\n 'The \"target\" argument must be one of type Buffer or Uint8Array. ' +\n 'Received type ' + (typeof target)\n )\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n let x = thisEnd - thisStart\n let y = end - start\n const len = Math.min(x, y)\n\n const thisCopy = this.slice(thisStart, thisEnd)\n const targetCopy = target.slice(start, end)\n\n for (let i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (numberIsNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n let indexSize = 1\n let arrLength = arr.length\n let valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n let i\n if (dir) {\n let foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n let found = true\n for (let j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n const remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n const strLen = string.length\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n let i\n for (i = 0; i < length; ++i) {\n const parsed = parseInt(string.substr(i * 2, 2), 16)\n if (numberIsNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset >>> 0\n if (isFinite(length)) {\n length = length >>> 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n const remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n case 'latin1':\n case 'binary':\n return asciiWrite(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n const res = []\n\n let i = start\n while (i < end) {\n const firstByte = buf[i]\n let codePoint = null\n let bytesPerSequence = (firstByte > 0xEF)\n ? 4\n : (firstByte > 0xDF)\n ? 3\n : (firstByte > 0xBF)\n ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n let secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nconst MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n const len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n let res = ''\n let i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n const len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n let out = ''\n for (let i = start; i < end; ++i) {\n out += hexSliceLookupTable[buf[i]]\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n const bytes = buf.slice(start, end)\n let res = ''\n // If bytes.length is odd, the last 8 bits must be ignored (same as node.js)\n for (let i = 0; i < bytes.length - 1; i += 2) {\n res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n const len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n const newBuf = this.subarray(start, end)\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(newBuf, Buffer.prototype)\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUintLE =\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUintBE =\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n let val = this[offset + --byteLength]\n let mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUint8 =\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUint16LE =\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUint16BE =\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUint32LE =\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUint32BE =\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const lo = first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24\n\n const hi = this[++offset] +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n last * 2 ** 24\n\n return BigInt(lo) + (BigInt(hi) << BigInt(32))\n})\n\nBuffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const hi = first * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n const lo = this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last\n\n return (BigInt(hi) << BigInt(32)) + BigInt(lo)\n})\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let i = byteLength\n let mul = 1\n let val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = this[offset + 4] +\n this[offset + 5] * 2 ** 8 +\n this[offset + 6] * 2 ** 16 +\n (last << 24) // Overflow\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24)\n})\n\nBuffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = (first << 24) + // Overflow\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last)\n})\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUintLE =\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let mul = 1\n let i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUintBE =\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let i = byteLength - 1\n let mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUint8 =\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeUint16LE =\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeUint16BE =\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeUint32LE =\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeUint32BE =\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nfunction wrtBigUInt64LE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n return offset\n}\n\nfunction wrtBigUInt64BE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset + 7] = lo\n lo = lo >> 8\n buf[offset + 6] = lo\n lo = lo >> 8\n buf[offset + 5] = lo\n lo = lo >> 8\n buf[offset + 4] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset + 3] = hi\n hi = hi >> 8\n buf[offset + 2] = hi\n hi = hi >> 8\n buf[offset + 1] = hi\n hi = hi >> 8\n buf[offset] = hi\n return offset + 8\n}\n\nBuffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = 0\n let mul = 1\n let sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = byteLength - 1\n let mul = 1\n let sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nBuffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('Index out of range')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n const len = end - start\n\n if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {\n // Use built-in when available, missing from IE11\n this.copyWithin(targetStart, start, end)\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, end),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n if (val.length === 1) {\n const code = val.charCodeAt(0)\n if ((encoding === 'utf8' && code < 128) ||\n encoding === 'latin1') {\n // Fast path: If `val` fits into a single byte, use that numeric value.\n val = code\n }\n }\n } else if (typeof val === 'number') {\n val = val & 255\n } else if (typeof val === 'boolean') {\n val = Number(val)\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n let i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n const bytes = Buffer.isBuffer(val)\n ? val\n : Buffer.from(val, encoding)\n const len = bytes.length\n if (len === 0) {\n throw new TypeError('The value \"' + val +\n '\" is invalid for argument \"value\"')\n }\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// CUSTOM ERRORS\n// =============\n\n// Simplified versions from Node, changed for Buffer-only usage\nconst errors = {}\nfunction E (sym, getMessage, Base) {\n errors[sym] = class NodeError extends Base {\n constructor () {\n super()\n\n Object.defineProperty(this, 'message', {\n value: getMessage.apply(this, arguments),\n writable: true,\n configurable: true\n })\n\n // Add the error code to the name to include it in the stack trace.\n this.name = `${this.name} [${sym}]`\n // Access the stack to generate the error message including the error code\n // from the name.\n this.stack // eslint-disable-line no-unused-expressions\n // Reset the name to the actual name.\n delete this.name\n }\n\n get code () {\n return sym\n }\n\n set code (value) {\n Object.defineProperty(this, 'code', {\n configurable: true,\n enumerable: true,\n value,\n writable: true\n })\n }\n\n toString () {\n return `${this.name} [${sym}]: ${this.message}`\n }\n }\n}\n\nE('ERR_BUFFER_OUT_OF_BOUNDS',\n function (name) {\n if (name) {\n return `${name} is outside of buffer bounds`\n }\n\n return 'Attempt to access memory outside buffer bounds'\n }, RangeError)\nE('ERR_INVALID_ARG_TYPE',\n function (name, actual) {\n return `The \"${name}\" argument must be of type number. Received type ${typeof actual}`\n }, TypeError)\nE('ERR_OUT_OF_RANGE',\n function (str, range, input) {\n let msg = `The value of \"${str}\" is out of range.`\n let received = input\n if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {\n received = addNumericalSeparator(String(input))\n } else if (typeof input === 'bigint') {\n received = String(input)\n if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {\n received = addNumericalSeparator(received)\n }\n received += 'n'\n }\n msg += ` It must be ${range}. Received ${received}`\n return msg\n }, RangeError)\n\nfunction addNumericalSeparator (val) {\n let res = ''\n let i = val.length\n const start = val[0] === '-' ? 1 : 0\n for (; i >= start + 4; i -= 3) {\n res = `_${val.slice(i - 3, i)}${res}`\n }\n return `${val.slice(0, i)}${res}`\n}\n\n// CHECK FUNCTIONS\n// ===============\n\nfunction checkBounds (buf, offset, byteLength) {\n validateNumber(offset, 'offset')\n if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {\n boundsError(offset, buf.length - (byteLength + 1))\n }\n}\n\nfunction checkIntBI (value, min, max, buf, offset, byteLength) {\n if (value > max || value < min) {\n const n = typeof min === 'bigint' ? 'n' : ''\n let range\n if (byteLength > 3) {\n if (min === 0 || min === BigInt(0)) {\n range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`\n } else {\n range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` +\n `${(byteLength + 1) * 8 - 1}${n}`\n }\n } else {\n range = `>= ${min}${n} and <= ${max}${n}`\n }\n throw new errors.ERR_OUT_OF_RANGE('value', range, value)\n }\n checkBounds(buf, offset, byteLength)\n}\n\nfunction validateNumber (value, name) {\n if (typeof value !== 'number') {\n throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)\n }\n}\n\nfunction boundsError (value, length, type) {\n if (Math.floor(value) !== value) {\n validateNumber(value, type)\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value)\n }\n\n if (length < 0) {\n throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()\n }\n\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset',\n `>= ${type ? 1 : 0} and <= ${length}`,\n value)\n}\n\n// HELPER FUNCTIONS\n// ================\n\nconst INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node takes equal signs as end of the Base64 encoding\n str = str.split('=')[0]\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = str.trim().replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n let codePoint\n const length = string.length\n let leadSurrogate = null\n const bytes = []\n\n for (let i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n let c, hi, lo\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n let i\n for (i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\n// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass\n// the `instanceof` check but they should be treated as of that type.\n// See: https://github.com/feross/buffer/issues/166\nfunction isInstance (obj, type) {\n return obj instanceof type ||\n (obj != null && obj.constructor != null && obj.constructor.name != null &&\n obj.constructor.name === type.name)\n}\nfunction numberIsNaN (obj) {\n // For IE11 support\n return obj !== obj // eslint-disable-line no-self-compare\n}\n\n// Create lookup table for `toString('hex')`\n// See: https://github.com/feross/buffer/issues/219\nconst hexSliceLookupTable = (function () {\n const alphabet = '0123456789abcdef'\n const table = new Array(256)\n for (let i = 0; i < 16; ++i) {\n const i16 = i * 16\n for (let j = 0; j < 16; ++j) {\n table[i16 + j] = alphabet[i] + alphabet[j]\n }\n }\n return table\n})()\n\n// Return not function with Error if BigInt not supported\nfunction defineBigIntMethod (fn) {\n return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn\n}\n\nfunction BufferBigIntNotDefined () {\n throw new Error('BigInt not supported')\n}\n","import { PublicKey } from '@solana/web3.js';\n/** Address of the SPL Token program */\nexport const TOKEN_PROGRAM_ID = new PublicKey('TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA');\n/** Address of the SPL Token 2022 program */\nexport const TOKEN_2022_PROGRAM_ID = new PublicKey('TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb');\n/** Address of the SPL Associated Token Account program */\nexport const ASSOCIATED_TOKEN_PROGRAM_ID = new PublicKey('ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL');\n/** Address of the special mint for wrapped native SOL in spl-token */\nexport const NATIVE_MINT = new PublicKey('So11111111111111111111111111111111111111112');\n/** Address of the special mint for wrapped native SOL in spl-token-2022 */\nexport const NATIVE_MINT_2022 = new PublicKey('9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP');\n/** Check that the token program provided is not `Tokenkeg...`, useful when using extensions */\nexport function programSupportsExtensions(programId) {\n if (programId === TOKEN_PROGRAM_ID) {\n return false;\n }\n else {\n return true;\n }\n}\n//# sourceMappingURL=constants.js.map","/* The MIT License (MIT)\n *\n * Copyright 2015-2018 Peter A. Bigot\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n/**\n * Support for translating between Uint8Array instances and JavaScript\n * native types.\n *\n * {@link module:Layout~Layout|Layout} is the basis of a class\n * hierarchy that associates property names with sequences of encoded\n * bytes.\n *\n * Layouts are supported for these scalar (numeric) types:\n * * {@link module:Layout~UInt|Unsigned integers in little-endian\n * format} with {@link module:Layout.u8|8-bit}, {@link\n * module:Layout.u16|16-bit}, {@link module:Layout.u24|24-bit},\n * {@link module:Layout.u32|32-bit}, {@link\n * module:Layout.u40|40-bit}, and {@link module:Layout.u48|48-bit}\n * representation ranges;\n * * {@link module:Layout~UIntBE|Unsigned integers in big-endian\n * format} with {@link module:Layout.u16be|16-bit}, {@link\n * module:Layout.u24be|24-bit}, {@link module:Layout.u32be|32-bit},\n * {@link module:Layout.u40be|40-bit}, and {@link\n * module:Layout.u48be|48-bit} representation ranges;\n * * {@link module:Layout~Int|Signed integers in little-endian\n * format} with {@link module:Layout.s8|8-bit}, {@link\n * module:Layout.s16|16-bit}, {@link module:Layout.s24|24-bit},\n * {@link module:Layout.s32|32-bit}, {@link\n * module:Layout.s40|40-bit}, and {@link module:Layout.s48|48-bit}\n * representation ranges;\n * * {@link module:Layout~IntBE|Signed integers in big-endian format}\n * with {@link module:Layout.s16be|16-bit}, {@link\n * module:Layout.s24be|24-bit}, {@link module:Layout.s32be|32-bit},\n * {@link module:Layout.s40be|40-bit}, and {@link\n * module:Layout.s48be|48-bit} representation ranges;\n * * 64-bit integral values that decode to an exact (if magnitude is\n * less than 2^53) or nearby integral Number in {@link\n * module:Layout.nu64|unsigned little-endian}, {@link\n * module:Layout.nu64be|unsigned big-endian}, {@link\n * module:Layout.ns64|signed little-endian}, and {@link\n * module:Layout.ns64be|unsigned big-endian} encodings;\n * * 32-bit floating point values with {@link\n * module:Layout.f32|little-endian} and {@link\n * module:Layout.f32be|big-endian} representations;\n * * 64-bit floating point values with {@link\n * module:Layout.f64|little-endian} and {@link\n * module:Layout.f64be|big-endian} representations;\n * * {@link module:Layout.const|Constants} that take no space in the\n * encoded expression.\n *\n * and for these aggregate types:\n * * {@link module:Layout.seq|Sequence}s of instances of a {@link\n * module:Layout~Layout|Layout}, with JavaScript representation as\n * an Array and constant or data-dependent {@link\n * module:Layout~Sequence#count|length};\n * * {@link module:Layout.struct|Structure}s that aggregate a\n * heterogeneous sequence of {@link module:Layout~Layout|Layout}\n * instances, with JavaScript representation as an Object;\n * * {@link module:Layout.union|Union}s that support multiple {@link\n * module:Layout~VariantLayout|variant layouts} over a fixed\n * (padded) or variable (not padded) span of bytes, using an\n * unsigned integer at the start of the data or a separate {@link\n * module:Layout.unionLayoutDiscriminator|layout element} to\n * determine which layout to use when interpreting the buffer\n * contents;\n * * {@link module:Layout.bits|BitStructure}s that contain a sequence\n * of individual {@link\n * module:Layout~BitStructure#addField|BitField}s packed into an 8,\n * 16, 24, or 32-bit unsigned integer starting at the least- or\n * most-significant bit;\n * * {@link module:Layout.cstr|C strings} of varying length;\n * * {@link module:Layout.blob|Blobs} of fixed- or variable-{@link\n * module:Layout~Blob#length|length} raw data.\n *\n * All {@link module:Layout~Layout|Layout} instances are immutable\n * after construction, to prevent internal state from becoming\n * inconsistent.\n *\n * @local Layout\n * @local ExternalLayout\n * @local GreedyCount\n * @local OffsetLayout\n * @local UInt\n * @local UIntBE\n * @local Int\n * @local IntBE\n * @local NearUInt64\n * @local NearUInt64BE\n * @local NearInt64\n * @local NearInt64BE\n * @local Float\n * @local FloatBE\n * @local Double\n * @local DoubleBE\n * @local Sequence\n * @local Structure\n * @local UnionDiscriminator\n * @local UnionLayoutDiscriminator\n * @local Union\n * @local VariantLayout\n * @local BitStructure\n * @local BitField\n * @local Boolean\n * @local Blob\n * @local CString\n * @local Constant\n * @local bindConstructorLayout\n * @module Layout\n * @license MIT\n * @author Peter A. Bigot\n * @see {@link https://github.com/pabigot/buffer-layout|buffer-layout on GitHub}\n */\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.s16 = exports.s8 = exports.nu64be = exports.u48be = exports.u40be = exports.u32be = exports.u24be = exports.u16be = exports.nu64 = exports.u48 = exports.u40 = exports.u32 = exports.u24 = exports.u16 = exports.u8 = exports.offset = exports.greedy = exports.Constant = exports.UTF8 = exports.CString = exports.Blob = exports.Boolean = exports.BitField = exports.BitStructure = exports.VariantLayout = exports.Union = exports.UnionLayoutDiscriminator = exports.UnionDiscriminator = exports.Structure = exports.Sequence = exports.DoubleBE = exports.Double = exports.FloatBE = exports.Float = exports.NearInt64BE = exports.NearInt64 = exports.NearUInt64BE = exports.NearUInt64 = exports.IntBE = exports.Int = exports.UIntBE = exports.UInt = exports.OffsetLayout = exports.GreedyCount = exports.ExternalLayout = exports.bindConstructorLayout = exports.nameWithProperty = exports.Layout = exports.uint8ArrayToBuffer = exports.checkUint8Array = void 0;\nexports.constant = exports.utf8 = exports.cstr = exports.blob = exports.unionLayoutDiscriminator = exports.union = exports.seq = exports.bits = exports.struct = exports.f64be = exports.f64 = exports.f32be = exports.f32 = exports.ns64be = exports.s48be = exports.s40be = exports.s32be = exports.s24be = exports.s16be = exports.ns64 = exports.s48 = exports.s40 = exports.s32 = exports.s24 = void 0;\nconst buffer_1 = require(\"buffer\");\n/* Check if a value is a Uint8Array.\n *\n * @ignore */\nfunction checkUint8Array(b) {\n if (!(b instanceof Uint8Array)) {\n throw new TypeError('b must be a Uint8Array');\n }\n}\nexports.checkUint8Array = checkUint8Array;\n/* Create a Buffer instance from a Uint8Array.\n *\n * @ignore */\nfunction uint8ArrayToBuffer(b) {\n checkUint8Array(b);\n return buffer_1.Buffer.from(b.buffer, b.byteOffset, b.length);\n}\nexports.uint8ArrayToBuffer = uint8ArrayToBuffer;\n/**\n * Base class for layout objects.\n *\n * **NOTE** This is an abstract base class; you can create instances\n * if it amuses you, but they won't support the {@link\n * Layout#encode|encode} or {@link Layout#decode|decode} functions.\n *\n * @param {Number} span - Initializer for {@link Layout#span|span}. The\n * parameter must be an integer; a negative value signifies that the\n * span is {@link Layout#getSpan|value-specific}.\n *\n * @param {string} [property] - Initializer for {@link\n * Layout#property|property}.\n *\n * @abstract\n */\nclass Layout {\n constructor(span, property) {\n if (!Number.isInteger(span)) {\n throw new TypeError('span must be an integer');\n }\n /** The span of the layout in bytes.\n *\n * Positive values are generally expected.\n *\n * Zero will only appear in {@link Constant}s and in {@link\n * Sequence}s where the {@link Sequence#count|count} is zero.\n *\n * A negative value indicates that the span is value-specific, and\n * must be obtained using {@link Layout#getSpan|getSpan}. */\n this.span = span;\n /** The property name used when this layout is represented in an\n * Object.\n *\n * Used only for layouts that {@link Layout#decode|decode} to Object\n * instances. If left undefined the span of the unnamed layout will\n * be treated as padding: it will not be mutated by {@link\n * Layout#encode|encode} nor represented as a property in the\n * decoded Object. */\n this.property = property;\n }\n /** Function to create an Object into which decoded properties will\n * be written.\n *\n * Used only for layouts that {@link Layout#decode|decode} to Object\n * instances, which means:\n * * {@link Structure}\n * * {@link Union}\n * * {@link VariantLayout}\n * * {@link BitStructure}\n *\n * If left undefined the JavaScript representation of these layouts\n * will be Object instances.\n *\n * See {@link bindConstructorLayout}.\n */\n makeDestinationObject() {\n return {};\n }\n /**\n * Calculate the span of a specific instance of a layout.\n *\n * @param {Uint8Array} b - the buffer that contains an encoded instance.\n *\n * @param {Number} [offset] - the offset at which the encoded instance\n * starts. If absent a zero offset is inferred.\n *\n * @return {Number} - the number of bytes covered by the layout\n * instance. If this method is not overridden in a subclass the\n * definition-time constant {@link Layout#span|span} will be\n * returned.\n *\n * @throws {RangeError} - if the length of the value cannot be\n * determined.\n */\n getSpan(b, offset) {\n if (0 > this.span) {\n throw new RangeError('indeterminate span');\n }\n return this.span;\n }\n /**\n * Replicate the layout using a new property.\n *\n * This function must be used to get a structurally-equivalent layout\n * with a different name since all {@link Layout} instances are\n * immutable.\n *\n * **NOTE** This is a shallow copy. All fields except {@link\n * Layout#property|property} are strictly equal to the origin layout.\n *\n * @param {String} property - the value for {@link\n * Layout#property|property} in the replica.\n *\n * @returns {Layout} - the copy with {@link Layout#property|property}\n * set to `property`.\n */\n replicate(property) {\n const rv = Object.create(this.constructor.prototype);\n Object.assign(rv, this);\n rv.property = property;\n return rv;\n }\n /**\n * Create an object from layout properties and an array of values.\n *\n * **NOTE** This function returns `undefined` if invoked on a layout\n * that does not return its value as an Object. Objects are\n * returned for things that are a {@link Structure}, which includes\n * {@link VariantLayout|variant layouts} if they are structures, and\n * excludes {@link Union}s. If you want this feature for a union\n * you must use {@link Union.getVariant|getVariant} to select the\n * desired layout.\n *\n * @param {Array} values - an array of values that correspond to the\n * default order for properties. As with {@link Layout#decode|decode}\n * layout elements that have no property name are skipped when\n * iterating over the array values. Only the top-level properties are\n * assigned; arguments are not assigned to properties of contained\n * layouts. Any unused values are ignored.\n *\n * @return {(Object|undefined)}\n */\n fromArray(values) {\n return undefined;\n }\n}\nexports.Layout = Layout;\n/* Provide text that carries a name (such as for a function that will\n * be throwing an error) annotated with the property of a given layout\n * (such as one for which the value was unacceptable).\n *\n * @ignore */\nfunction nameWithProperty(name, lo) {\n if (lo.property) {\n return name + '[' + lo.property + ']';\n }\n return name;\n}\nexports.nameWithProperty = nameWithProperty;\n/**\n * Augment a class so that instances can be encoded/decoded using a\n * given layout.\n *\n * Calling this function couples `Class` with `layout` in several ways:\n *\n * * `Class.layout_` becomes a static member property equal to `layout`;\n * * `layout.boundConstructor_` becomes a static member property equal\n * to `Class`;\n * * The {@link Layout#makeDestinationObject|makeDestinationObject()}\n * property of `layout` is set to a function that returns a `new\n * Class()`;\n * * `Class.decode(b, offset)` becomes a static member function that\n * delegates to {@link Layout#decode|layout.decode}. The\n * synthesized function may be captured and extended.\n * * `Class.prototype.encode(b, offset)` provides an instance member\n * function that delegates to {@link Layout#encode|layout.encode}\n * with `src` set to `this`. The synthesized function may be\n * captured and extended, but when the extension is invoked `this`\n * must be explicitly bound to the instance.\n *\n * @param {class} Class - a JavaScript class with a nullary\n * constructor.\n *\n * @param {Layout} layout - the {@link Layout} instance used to encode\n * instances of `Class`.\n */\n// `Class` must be a constructor Function, but the assignment of a `layout_` property to it makes it difficult to type\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nfunction bindConstructorLayout(Class, layout) {\n if ('function' !== typeof Class) {\n throw new TypeError('Class must be constructor');\n }\n if (Object.prototype.hasOwnProperty.call(Class, 'layout_')) {\n throw new Error('Class is already bound to a layout');\n }\n if (!(layout && (layout instanceof Layout))) {\n throw new TypeError('layout must be a Layout');\n }\n if (Object.prototype.hasOwnProperty.call(layout, 'boundConstructor_')) {\n throw new Error('layout is already bound to a constructor');\n }\n Class.layout_ = layout;\n layout.boundConstructor_ = Class;\n layout.makeDestinationObject = (() => new Class());\n Object.defineProperty(Class.prototype, 'encode', {\n value(b, offset) {\n return layout.encode(this, b, offset);\n },\n writable: true,\n });\n Object.defineProperty(Class, 'decode', {\n value(b, offset) {\n return layout.decode(b, offset);\n },\n writable: true,\n });\n}\nexports.bindConstructorLayout = bindConstructorLayout;\n/**\n * An object that behaves like a layout but does not consume space\n * within its containing layout.\n *\n * This is primarily used to obtain metadata about a member, such as a\n * {@link OffsetLayout} that can provide data about a {@link\n * Layout#getSpan|value-specific span}.\n *\n * **NOTE** This is an abstract base class; you can create instances\n * if it amuses you, but they won't support {@link\n * ExternalLayout#isCount|isCount} or other {@link Layout} functions.\n *\n * @param {Number} span - initializer for {@link Layout#span|span}.\n * The parameter can range from 1 through 6.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @abstract\n * @augments {Layout}\n */\nclass ExternalLayout extends Layout {\n /**\n * Return `true` iff the external layout decodes to an unsigned\n * integer layout.\n *\n * In that case it can be used as the source of {@link\n * Sequence#count|Sequence counts}, {@link Blob#length|Blob lengths},\n * or as {@link UnionLayoutDiscriminator#layout|external union\n * discriminators}.\n *\n * @abstract\n */\n isCount() {\n throw new Error('ExternalLayout is abstract');\n }\n}\nexports.ExternalLayout = ExternalLayout;\n/**\n * An {@link ExternalLayout} that determines its {@link\n * Layout#decode|value} based on offset into and length of the buffer\n * on which it is invoked.\n *\n * *Factory*: {@link module:Layout.greedy|greedy}\n *\n * @param {Number} [elementSpan] - initializer for {@link\n * GreedyCount#elementSpan|elementSpan}.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {ExternalLayout}\n */\nclass GreedyCount extends ExternalLayout {\n constructor(elementSpan = 1, property) {\n if ((!Number.isInteger(elementSpan)) || (0 >= elementSpan)) {\n throw new TypeError('elementSpan must be a (positive) integer');\n }\n super(-1, property);\n /** The layout for individual elements of the sequence. The value\n * must be a positive integer. If not provided, the value will be\n * 1. */\n this.elementSpan = elementSpan;\n }\n /** @override */\n isCount() {\n return true;\n }\n /** @override */\n decode(b, offset = 0) {\n checkUint8Array(b);\n const rem = b.length - offset;\n return Math.floor(rem / this.elementSpan);\n }\n /** @override */\n encode(src, b, offset) {\n return 0;\n }\n}\nexports.GreedyCount = GreedyCount;\n/**\n * An {@link ExternalLayout} that supports accessing a {@link Layout}\n * at a fixed offset from the start of another Layout. The offset may\n * be before, within, or after the base layout.\n *\n * *Factory*: {@link module:Layout.offset|offset}\n *\n * @param {Layout} layout - initializer for {@link\n * OffsetLayout#layout|layout}, modulo `property`.\n *\n * @param {Number} [offset] - Initializes {@link\n * OffsetLayout#offset|offset}. Defaults to zero.\n *\n * @param {string} [property] - Optional new property name for a\n * {@link Layout#replicate| replica} of `layout` to be used as {@link\n * OffsetLayout#layout|layout}. If not provided the `layout` is used\n * unchanged.\n *\n * @augments {Layout}\n */\nclass OffsetLayout extends ExternalLayout {\n constructor(layout, offset = 0, property) {\n if (!(layout instanceof Layout)) {\n throw new TypeError('layout must be a Layout');\n }\n if (!Number.isInteger(offset)) {\n throw new TypeError('offset must be integer or undefined');\n }\n super(layout.span, property || layout.property);\n /** The subordinated layout. */\n this.layout = layout;\n /** The location of {@link OffsetLayout#layout} relative to the\n * start of another layout.\n *\n * The value may be positive or negative, but an error will thrown\n * if at the point of use it goes outside the span of the Uint8Array\n * being accessed. */\n this.offset = offset;\n }\n /** @override */\n isCount() {\n return ((this.layout instanceof UInt)\n || (this.layout instanceof UIntBE));\n }\n /** @override */\n decode(b, offset = 0) {\n return this.layout.decode(b, offset + this.offset);\n }\n /** @override */\n encode(src, b, offset = 0) {\n return this.layout.encode(src, b, offset + this.offset);\n }\n}\nexports.OffsetLayout = OffsetLayout;\n/**\n * Represent an unsigned integer in little-endian format.\n *\n * *Factory*: {@link module:Layout.u8|u8}, {@link\n * module:Layout.u16|u16}, {@link module:Layout.u24|u24}, {@link\n * module:Layout.u32|u32}, {@link module:Layout.u40|u40}, {@link\n * module:Layout.u48|u48}\n *\n * @param {Number} span - initializer for {@link Layout#span|span}.\n * The parameter can range from 1 through 6.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass UInt extends Layout {\n constructor(span, property) {\n super(span, property);\n if (6 < this.span) {\n throw new RangeError('span must not exceed 6 bytes');\n }\n }\n /** @override */\n decode(b, offset = 0) {\n return uint8ArrayToBuffer(b).readUIntLE(offset, this.span);\n }\n /** @override */\n encode(src, b, offset = 0) {\n uint8ArrayToBuffer(b).writeUIntLE(src, offset, this.span);\n return this.span;\n }\n}\nexports.UInt = UInt;\n/**\n * Represent an unsigned integer in big-endian format.\n *\n * *Factory*: {@link module:Layout.u8be|u8be}, {@link\n * module:Layout.u16be|u16be}, {@link module:Layout.u24be|u24be},\n * {@link module:Layout.u32be|u32be}, {@link\n * module:Layout.u40be|u40be}, {@link module:Layout.u48be|u48be}\n *\n * @param {Number} span - initializer for {@link Layout#span|span}.\n * The parameter can range from 1 through 6.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass UIntBE extends Layout {\n constructor(span, property) {\n super(span, property);\n if (6 < this.span) {\n throw new RangeError('span must not exceed 6 bytes');\n }\n }\n /** @override */\n decode(b, offset = 0) {\n return uint8ArrayToBuffer(b).readUIntBE(offset, this.span);\n }\n /** @override */\n encode(src, b, offset = 0) {\n uint8ArrayToBuffer(b).writeUIntBE(src, offset, this.span);\n return this.span;\n }\n}\nexports.UIntBE = UIntBE;\n/**\n * Represent a signed integer in little-endian format.\n *\n * *Factory*: {@link module:Layout.s8|s8}, {@link\n * module:Layout.s16|s16}, {@link module:Layout.s24|s24}, {@link\n * module:Layout.s32|s32}, {@link module:Layout.s40|s40}, {@link\n * module:Layout.s48|s48}\n *\n * @param {Number} span - initializer for {@link Layout#span|span}.\n * The parameter can range from 1 through 6.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass Int extends Layout {\n constructor(span, property) {\n super(span, property);\n if (6 < this.span) {\n throw new RangeError('span must not exceed 6 bytes');\n }\n }\n /** @override */\n decode(b, offset = 0) {\n return uint8ArrayToBuffer(b).readIntLE(offset, this.span);\n }\n /** @override */\n encode(src, b, offset = 0) {\n uint8ArrayToBuffer(b).writeIntLE(src, offset, this.span);\n return this.span;\n }\n}\nexports.Int = Int;\n/**\n * Represent a signed integer in big-endian format.\n *\n * *Factory*: {@link module:Layout.s8be|s8be}, {@link\n * module:Layout.s16be|s16be}, {@link module:Layout.s24be|s24be},\n * {@link module:Layout.s32be|s32be}, {@link\n * module:Layout.s40be|s40be}, {@link module:Layout.s48be|s48be}\n *\n * @param {Number} span - initializer for {@link Layout#span|span}.\n * The parameter can range from 1 through 6.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass IntBE extends Layout {\n constructor(span, property) {\n super(span, property);\n if (6 < this.span) {\n throw new RangeError('span must not exceed 6 bytes');\n }\n }\n /** @override */\n decode(b, offset = 0) {\n return uint8ArrayToBuffer(b).readIntBE(offset, this.span);\n }\n /** @override */\n encode(src, b, offset = 0) {\n uint8ArrayToBuffer(b).writeIntBE(src, offset, this.span);\n return this.span;\n }\n}\nexports.IntBE = IntBE;\nconst V2E32 = Math.pow(2, 32);\n/* True modulus high and low 32-bit words, where low word is always\n * non-negative. */\nfunction divmodInt64(src) {\n const hi32 = Math.floor(src / V2E32);\n const lo32 = src - (hi32 * V2E32);\n return { hi32, lo32 };\n}\n/* Reconstruct Number from quotient and non-negative remainder */\nfunction roundedInt64(hi32, lo32) {\n return hi32 * V2E32 + lo32;\n}\n/**\n * Represent an unsigned 64-bit integer in little-endian format when\n * encoded and as a near integral JavaScript Number when decoded.\n *\n * *Factory*: {@link module:Layout.nu64|nu64}\n *\n * **NOTE** Values with magnitude greater than 2^52 may not decode to\n * the exact value of the encoded representation.\n *\n * @augments {Layout}\n */\nclass NearUInt64 extends Layout {\n constructor(property) {\n super(8, property);\n }\n /** @override */\n decode(b, offset = 0) {\n const buffer = uint8ArrayToBuffer(b);\n const lo32 = buffer.readUInt32LE(offset);\n const hi32 = buffer.readUInt32LE(offset + 4);\n return roundedInt64(hi32, lo32);\n }\n /** @override */\n encode(src, b, offset = 0) {\n const split = divmodInt64(src);\n const buffer = uint8ArrayToBuffer(b);\n buffer.writeUInt32LE(split.lo32, offset);\n buffer.writeUInt32LE(split.hi32, offset + 4);\n return 8;\n }\n}\nexports.NearUInt64 = NearUInt64;\n/**\n * Represent an unsigned 64-bit integer in big-endian format when\n * encoded and as a near integral JavaScript Number when decoded.\n *\n * *Factory*: {@link module:Layout.nu64be|nu64be}\n *\n * **NOTE** Values with magnitude greater than 2^52 may not decode to\n * the exact value of the encoded representation.\n *\n * @augments {Layout}\n */\nclass NearUInt64BE extends Layout {\n constructor(property) {\n super(8, property);\n }\n /** @override */\n decode(b, offset = 0) {\n const buffer = uint8ArrayToBuffer(b);\n const hi32 = buffer.readUInt32BE(offset);\n const lo32 = buffer.readUInt32BE(offset + 4);\n return roundedInt64(hi32, lo32);\n }\n /** @override */\n encode(src, b, offset = 0) {\n const split = divmodInt64(src);\n const buffer = uint8ArrayToBuffer(b);\n buffer.writeUInt32BE(split.hi32, offset);\n buffer.writeUInt32BE(split.lo32, offset + 4);\n return 8;\n }\n}\nexports.NearUInt64BE = NearUInt64BE;\n/**\n * Represent a signed 64-bit integer in little-endian format when\n * encoded and as a near integral JavaScript Number when decoded.\n *\n * *Factory*: {@link module:Layout.ns64|ns64}\n *\n * **NOTE** Values with magnitude greater than 2^52 may not decode to\n * the exact value of the encoded representation.\n *\n * @augments {Layout}\n */\nclass NearInt64 extends Layout {\n constructor(property) {\n super(8, property);\n }\n /** @override */\n decode(b, offset = 0) {\n const buffer = uint8ArrayToBuffer(b);\n const lo32 = buffer.readUInt32LE(offset);\n const hi32 = buffer.readInt32LE(offset + 4);\n return roundedInt64(hi32, lo32);\n }\n /** @override */\n encode(src, b, offset = 0) {\n const split = divmodInt64(src);\n const buffer = uint8ArrayToBuffer(b);\n buffer.writeUInt32LE(split.lo32, offset);\n buffer.writeInt32LE(split.hi32, offset + 4);\n return 8;\n }\n}\nexports.NearInt64 = NearInt64;\n/**\n * Represent a signed 64-bit integer in big-endian format when\n * encoded and as a near integral JavaScript Number when decoded.\n *\n * *Factory*: {@link module:Layout.ns64be|ns64be}\n *\n * **NOTE** Values with magnitude greater than 2^52 may not decode to\n * the exact value of the encoded representation.\n *\n * @augments {Layout}\n */\nclass NearInt64BE extends Layout {\n constructor(property) {\n super(8, property);\n }\n /** @override */\n decode(b, offset = 0) {\n const buffer = uint8ArrayToBuffer(b);\n const hi32 = buffer.readInt32BE(offset);\n const lo32 = buffer.readUInt32BE(offset + 4);\n return roundedInt64(hi32, lo32);\n }\n /** @override */\n encode(src, b, offset = 0) {\n const split = divmodInt64(src);\n const buffer = uint8ArrayToBuffer(b);\n buffer.writeInt32BE(split.hi32, offset);\n buffer.writeUInt32BE(split.lo32, offset + 4);\n return 8;\n }\n}\nexports.NearInt64BE = NearInt64BE;\n/**\n * Represent a 32-bit floating point number in little-endian format.\n *\n * *Factory*: {@link module:Layout.f32|f32}\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass Float extends Layout {\n constructor(property) {\n super(4, property);\n }\n /** @override */\n decode(b, offset = 0) {\n return uint8ArrayToBuffer(b).readFloatLE(offset);\n }\n /** @override */\n encode(src, b, offset = 0) {\n uint8ArrayToBuffer(b).writeFloatLE(src, offset);\n return 4;\n }\n}\nexports.Float = Float;\n/**\n * Represent a 32-bit floating point number in big-endian format.\n *\n * *Factory*: {@link module:Layout.f32be|f32be}\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass FloatBE extends Layout {\n constructor(property) {\n super(4, property);\n }\n /** @override */\n decode(b, offset = 0) {\n return uint8ArrayToBuffer(b).readFloatBE(offset);\n }\n /** @override */\n encode(src, b, offset = 0) {\n uint8ArrayToBuffer(b).writeFloatBE(src, offset);\n return 4;\n }\n}\nexports.FloatBE = FloatBE;\n/**\n * Represent a 64-bit floating point number in little-endian format.\n *\n * *Factory*: {@link module:Layout.f64|f64}\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass Double extends Layout {\n constructor(property) {\n super(8, property);\n }\n /** @override */\n decode(b, offset = 0) {\n return uint8ArrayToBuffer(b).readDoubleLE(offset);\n }\n /** @override */\n encode(src, b, offset = 0) {\n uint8ArrayToBuffer(b).writeDoubleLE(src, offset);\n return 8;\n }\n}\nexports.Double = Double;\n/**\n * Represent a 64-bit floating point number in big-endian format.\n *\n * *Factory*: {@link module:Layout.f64be|f64be}\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass DoubleBE extends Layout {\n constructor(property) {\n super(8, property);\n }\n /** @override */\n decode(b, offset = 0) {\n return uint8ArrayToBuffer(b).readDoubleBE(offset);\n }\n /** @override */\n encode(src, b, offset = 0) {\n uint8ArrayToBuffer(b).writeDoubleBE(src, offset);\n return 8;\n }\n}\nexports.DoubleBE = DoubleBE;\n/**\n * Represent a contiguous sequence of a specific layout as an Array.\n *\n * *Factory*: {@link module:Layout.seq|seq}\n *\n * @param {Layout} elementLayout - initializer for {@link\n * Sequence#elementLayout|elementLayout}.\n *\n * @param {(Number|ExternalLayout)} count - initializer for {@link\n * Sequence#count|count}. The parameter must be either a positive\n * integer or an instance of {@link ExternalLayout}.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass Sequence extends Layout {\n constructor(elementLayout, count, property) {\n if (!(elementLayout instanceof Layout)) {\n throw new TypeError('elementLayout must be a Layout');\n }\n if (!(((count instanceof ExternalLayout) && count.isCount())\n || (Number.isInteger(count) && (0 <= count)))) {\n throw new TypeError('count must be non-negative integer '\n + 'or an unsigned integer ExternalLayout');\n }\n let span = -1;\n if ((!(count instanceof ExternalLayout))\n && (0 < elementLayout.span)) {\n span = count * elementLayout.span;\n }\n super(span, property);\n /** The layout for individual elements of the sequence. */\n this.elementLayout = elementLayout;\n /** The number of elements in the sequence.\n *\n * This will be either a non-negative integer or an instance of\n * {@link ExternalLayout} for which {@link\n * ExternalLayout#isCount|isCount()} is `true`. */\n this.count = count;\n }\n /** @override */\n getSpan(b, offset = 0) {\n if (0 <= this.span) {\n return this.span;\n }\n let span = 0;\n let count = this.count;\n if (count instanceof ExternalLayout) {\n count = count.decode(b, offset);\n }\n if (0 < this.elementLayout.span) {\n span = count * this.elementLayout.span;\n }\n else {\n let idx = 0;\n while (idx < count) {\n span += this.elementLayout.getSpan(b, offset + span);\n ++idx;\n }\n }\n return span;\n }\n /** @override */\n decode(b, offset = 0) {\n const rv = [];\n let i = 0;\n let count = this.count;\n if (count instanceof ExternalLayout) {\n count = count.decode(b, offset);\n }\n while (i < count) {\n rv.push(this.elementLayout.decode(b, offset));\n offset += this.elementLayout.getSpan(b, offset);\n i += 1;\n }\n return rv;\n }\n /** Implement {@link Layout#encode|encode} for {@link Sequence}.\n *\n * **NOTE** If `src` is shorter than {@link Sequence#count|count} then\n * the unused space in the buffer is left unchanged. If `src` is\n * longer than {@link Sequence#count|count} the unneeded elements are\n * ignored.\n *\n * **NOTE** If {@link Layout#count|count} is an instance of {@link\n * ExternalLayout} then the length of `src` will be encoded as the\n * count after `src` is encoded. */\n encode(src, b, offset = 0) {\n const elo = this.elementLayout;\n const span = src.reduce((span, v) => {\n return span + elo.encode(v, b, offset + span);\n }, 0);\n if (this.count instanceof ExternalLayout) {\n this.count.encode(src.length, b, offset);\n }\n return span;\n }\n}\nexports.Sequence = Sequence;\n/**\n * Represent a contiguous sequence of arbitrary layout elements as an\n * Object.\n *\n * *Factory*: {@link module:Layout.struct|struct}\n *\n * **NOTE** The {@link Layout#span|span} of the structure is variable\n * if any layout in {@link Structure#fields|fields} has a variable\n * span. When {@link Layout#encode|encoding} we must have a value for\n * all variable-length fields, or we wouldn't be able to figure out\n * how much space to use for storage. We can only identify the value\n * for a field when it has a {@link Layout#property|property}. As\n * such, although a structure may contain both unnamed fields and\n * variable-length fields, it cannot contain an unnamed\n * variable-length field.\n *\n * @param {Layout[]} fields - initializer for {@link\n * Structure#fields|fields}. An error is raised if this contains a\n * variable-length field for which a {@link Layout#property|property}\n * is not defined.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @param {Boolean} [decodePrefixes] - initializer for {@link\n * Structure#decodePrefixes|property}.\n *\n * @throws {Error} - if `fields` contains an unnamed variable-length\n * layout.\n *\n * @augments {Layout}\n */\nclass Structure extends Layout {\n constructor(fields, property, decodePrefixes) {\n if (!(Array.isArray(fields)\n && fields.reduce((acc, v) => acc && (v instanceof Layout), true))) {\n throw new TypeError('fields must be array of Layout instances');\n }\n if (('boolean' === typeof property)\n && (undefined === decodePrefixes)) {\n decodePrefixes = property;\n property = undefined;\n }\n /* Verify absence of unnamed variable-length fields. */\n for (const fd of fields) {\n if ((0 > fd.span)\n && (undefined === fd.property)) {\n throw new Error('fields cannot contain unnamed variable-length layout');\n }\n }\n let span = -1;\n try {\n span = fields.reduce((span, fd) => span + fd.getSpan(), 0);\n }\n catch (e) {\n // ignore error\n }\n super(span, property);\n /** The sequence of {@link Layout} values that comprise the\n * structure.\n *\n * The individual elements need not be the same type, and may be\n * either scalar or aggregate layouts. If a member layout leaves\n * its {@link Layout#property|property} undefined the\n * corresponding region of the buffer associated with the element\n * will not be mutated.\n *\n * @type {Layout[]} */\n this.fields = fields;\n /** Control behavior of {@link Layout#decode|decode()} given short\n * buffers.\n *\n * In some situations a structure many be extended with additional\n * fields over time, with older installations providing only a\n * prefix of the full structure. If this property is `true`\n * decoding will accept those buffers and leave subsequent fields\n * undefined, as long as the buffer ends at a field boundary.\n * Defaults to `false`. */\n this.decodePrefixes = !!decodePrefixes;\n }\n /** @override */\n getSpan(b, offset = 0) {\n if (0 <= this.span) {\n return this.span;\n }\n let span = 0;\n try {\n span = this.fields.reduce((span, fd) => {\n const fsp = fd.getSpan(b, offset);\n offset += fsp;\n return span + fsp;\n }, 0);\n }\n catch (e) {\n throw new RangeError('indeterminate span');\n }\n return span;\n }\n /** @override */\n decode(b, offset = 0) {\n checkUint8Array(b);\n const dest = this.makeDestinationObject();\n for (const fd of this.fields) {\n if (undefined !== fd.property) {\n dest[fd.property] = fd.decode(b, offset);\n }\n offset += fd.getSpan(b, offset);\n if (this.decodePrefixes\n && (b.length === offset)) {\n break;\n }\n }\n return dest;\n }\n /** Implement {@link Layout#encode|encode} for {@link Structure}.\n *\n * If `src` is missing a property for a member with a defined {@link\n * Layout#property|property} the corresponding region of the buffer is\n * left unmodified. */\n encode(src, b, offset = 0) {\n const firstOffset = offset;\n let lastOffset = 0;\n let lastWrote = 0;\n for (const fd of this.fields) {\n let span = fd.span;\n lastWrote = (0 < span) ? span : 0;\n if (undefined !== fd.property) {\n const fv = src[fd.property];\n if (undefined !== fv) {\n lastWrote = fd.encode(fv, b, offset);\n if (0 > span) {\n /* Read the as-encoded span, which is not necessarily the\n * same as what we wrote. */\n span = fd.getSpan(b, offset);\n }\n }\n }\n lastOffset = offset;\n offset += span;\n }\n /* Use (lastOffset + lastWrote) instead of offset because the last\n * item may have had a dynamic length and we don't want to include\n * the padding between it and the end of the space reserved for\n * it. */\n return (lastOffset + lastWrote) - firstOffset;\n }\n /** @override */\n fromArray(values) {\n const dest = this.makeDestinationObject();\n for (const fd of this.fields) {\n if ((undefined !== fd.property)\n && (0 < values.length)) {\n dest[fd.property] = values.shift();\n }\n }\n return dest;\n }\n /**\n * Get access to the layout of a given property.\n *\n * @param {String} property - the structure member of interest.\n *\n * @return {Layout} - the layout associated with `property`, or\n * undefined if there is no such property.\n */\n layoutFor(property) {\n if ('string' !== typeof property) {\n throw new TypeError('property must be string');\n }\n for (const fd of this.fields) {\n if (fd.property === property) {\n return fd;\n }\n }\n return undefined;\n }\n /**\n * Get the offset of a structure member.\n *\n * @param {String} property - the structure member of interest.\n *\n * @return {Number} - the offset in bytes to the start of `property`\n * within the structure, or undefined if `property` is not a field\n * within the structure. If the property is a member but follows a\n * variable-length structure member a negative number will be\n * returned.\n */\n offsetOf(property) {\n if ('string' !== typeof property) {\n throw new TypeError('property must be string');\n }\n let offset = 0;\n for (const fd of this.fields) {\n if (fd.property === property) {\n return offset;\n }\n if (0 > fd.span) {\n offset = -1;\n }\n else if (0 <= offset) {\n offset += fd.span;\n }\n }\n return undefined;\n }\n}\nexports.Structure = Structure;\n/**\n * An object that can provide a {@link\n * Union#discriminator|discriminator} API for {@link Union}.\n *\n * **NOTE** This is an abstract base class; you can create instances\n * if it amuses you, but they won't support the {@link\n * UnionDiscriminator#encode|encode} or {@link\n * UnionDiscriminator#decode|decode} functions.\n *\n * @param {string} [property] - Default for {@link\n * UnionDiscriminator#property|property}.\n *\n * @abstract\n */\nclass UnionDiscriminator {\n constructor(property) {\n /** The {@link Layout#property|property} to be used when the\n * discriminator is referenced in isolation (generally when {@link\n * Union#decode|Union decode} cannot delegate to a specific\n * variant). */\n this.property = property;\n }\n /** Analog to {@link Layout#decode|Layout decode} for union discriminators.\n *\n * The implementation of this method need not reference the buffer if\n * variant information is available through other means. */\n decode(b, offset) {\n throw new Error('UnionDiscriminator is abstract');\n }\n /** Analog to {@link Layout#decode|Layout encode} for union discriminators.\n *\n * The implementation of this method need not store the value if\n * variant information is maintained through other means. */\n encode(src, b, offset) {\n throw new Error('UnionDiscriminator is abstract');\n }\n}\nexports.UnionDiscriminator = UnionDiscriminator;\n/**\n * An object that can provide a {@link\n * UnionDiscriminator|discriminator API} for {@link Union} using an\n * unsigned integral {@link Layout} instance located either inside or\n * outside the union.\n *\n * @param {ExternalLayout} layout - initializes {@link\n * UnionLayoutDiscriminator#layout|layout}. Must satisfy {@link\n * ExternalLayout#isCount|isCount()}.\n *\n * @param {string} [property] - Default for {@link\n * UnionDiscriminator#property|property}, superseding the property\n * from `layout`, but defaulting to `variant` if neither `property`\n * nor layout provide a property name.\n *\n * @augments {UnionDiscriminator}\n */\nclass UnionLayoutDiscriminator extends UnionDiscriminator {\n constructor(layout, property) {\n if (!((layout instanceof ExternalLayout)\n && layout.isCount())) {\n throw new TypeError('layout must be an unsigned integer ExternalLayout');\n }\n super(property || layout.property || 'variant');\n /** The {@link ExternalLayout} used to access the discriminator\n * value. */\n this.layout = layout;\n }\n /** Delegate decoding to {@link UnionLayoutDiscriminator#layout|layout}. */\n decode(b, offset) {\n return this.layout.decode(b, offset);\n }\n /** Delegate encoding to {@link UnionLayoutDiscriminator#layout|layout}. */\n encode(src, b, offset) {\n return this.layout.encode(src, b, offset);\n }\n}\nexports.UnionLayoutDiscriminator = UnionLayoutDiscriminator;\n/**\n * Represent any number of span-compatible layouts.\n *\n * *Factory*: {@link module:Layout.union|union}\n *\n * If the union has a {@link Union#defaultLayout|default layout} that\n * layout must have a non-negative {@link Layout#span|span}. The span\n * of a fixed-span union includes its {@link\n * Union#discriminator|discriminator} if the variant is a {@link\n * Union#usesPrefixDiscriminator|prefix of the union}, plus the span\n * of its {@link Union#defaultLayout|default layout}.\n *\n * If the union does not have a default layout then the encoded span\n * of the union depends on the encoded span of its variant (which may\n * be fixed or variable).\n *\n * {@link VariantLayout#layout|Variant layout}s are added through\n * {@link Union#addVariant|addVariant}. If the union has a default\n * layout, the span of the {@link VariantLayout#layout|layout\n * contained by the variant} must not exceed the span of the {@link\n * Union#defaultLayout|default layout} (minus the span of a {@link\n * Union#usesPrefixDiscriminator|prefix disriminator}, if used). The\n * span of the variant will equal the span of the union itself.\n *\n * The variant for a buffer can only be identified from the {@link\n * Union#discriminator|discriminator} {@link\n * UnionDiscriminator#property|property} (in the case of the {@link\n * Union#defaultLayout|default layout}), or by using {@link\n * Union#getVariant|getVariant} and examining the resulting {@link\n * VariantLayout} instance.\n *\n * A variant compatible with a JavaScript object can be identified\n * using {@link Union#getSourceVariant|getSourceVariant}.\n *\n * @param {(UnionDiscriminator|ExternalLayout|Layout)} discr - How to\n * identify the layout used to interpret the union contents. The\n * parameter must be an instance of {@link UnionDiscriminator}, an\n * {@link ExternalLayout} that satisfies {@link\n * ExternalLayout#isCount|isCount()}, or {@link UInt} (or {@link\n * UIntBE}). When a non-external layout element is passed the layout\n * appears at the start of the union. In all cases the (synthesized)\n * {@link UnionDiscriminator} instance is recorded as {@link\n * Union#discriminator|discriminator}.\n *\n * @param {(Layout|null)} defaultLayout - initializer for {@link\n * Union#defaultLayout|defaultLayout}. If absent defaults to `null`.\n * If `null` there is no default layout: the union has data-dependent\n * length and attempts to decode or encode unrecognized variants will\n * throw an exception. A {@link Layout} instance must have a\n * non-negative {@link Layout#span|span}, and if it lacks a {@link\n * Layout#property|property} the {@link\n * Union#defaultLayout|defaultLayout} will be a {@link\n * Layout#replicate|replica} with property `content`.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass Union extends Layout {\n constructor(discr, defaultLayout, property) {\n let discriminator;\n if ((discr instanceof UInt)\n || (discr instanceof UIntBE)) {\n discriminator = new UnionLayoutDiscriminator(new OffsetLayout(discr));\n }\n else if ((discr instanceof ExternalLayout)\n && discr.isCount()) {\n discriminator = new UnionLayoutDiscriminator(discr);\n }\n else if (!(discr instanceof UnionDiscriminator)) {\n throw new TypeError('discr must be a UnionDiscriminator '\n + 'or an unsigned integer layout');\n }\n else {\n discriminator = discr;\n }\n if (undefined === defaultLayout) {\n defaultLayout = null;\n }\n if (!((null === defaultLayout)\n || (defaultLayout instanceof Layout))) {\n throw new TypeError('defaultLayout must be null or a Layout');\n }\n if (null !== defaultLayout) {\n if (0 > defaultLayout.span) {\n throw new Error('defaultLayout must have constant span');\n }\n if (undefined === defaultLayout.property) {\n defaultLayout = defaultLayout.replicate('content');\n }\n }\n /* The union span can be estimated only if there's a default\n * layout. The union spans its default layout, plus any prefix\n * variant layout. By construction both layouts, if present, have\n * non-negative span. */\n let span = -1;\n if (defaultLayout) {\n span = defaultLayout.span;\n if ((0 <= span) && ((discr instanceof UInt)\n || (discr instanceof UIntBE))) {\n span += discriminator.layout.span;\n }\n }\n super(span, property);\n /** The interface for the discriminator value in isolation.\n *\n * This a {@link UnionDiscriminator} either passed to the\n * constructor or synthesized from the `discr` constructor\n * argument. {@link\n * Union#usesPrefixDiscriminator|usesPrefixDiscriminator} will be\n * `true` iff the `discr` parameter was a non-offset {@link\n * Layout} instance. */\n this.discriminator = discriminator;\n /** `true` if the {@link Union#discriminator|discriminator} is the\n * first field in the union.\n *\n * If `false` the discriminator is obtained from somewhere\n * else. */\n this.usesPrefixDiscriminator = (discr instanceof UInt)\n || (discr instanceof UIntBE);\n /** The layout for non-discriminator content when the value of the\n * discriminator is not recognized.\n *\n * This is the value passed to the constructor. It is\n * structurally equivalent to the second component of {@link\n * Union#layout|layout} but may have a different property\n * name. */\n this.defaultLayout = defaultLayout;\n /** A registry of allowed variants.\n *\n * The keys are unsigned integers which should be compatible with\n * {@link Union.discriminator|discriminator}. The property value\n * is the corresponding {@link VariantLayout} instances assigned\n * to this union by {@link Union#addVariant|addVariant}.\n *\n * **NOTE** The registry remains mutable so that variants can be\n * {@link Union#addVariant|added} at any time. Users should not\n * manipulate the content of this property. */\n this.registry = {};\n /* Private variable used when invoking getSourceVariant */\n let boundGetSourceVariant = this.defaultGetSourceVariant.bind(this);\n /** Function to infer the variant selected by a source object.\n *\n * Defaults to {@link\n * Union#defaultGetSourceVariant|defaultGetSourceVariant} but may\n * be overridden using {@link\n * Union#configGetSourceVariant|configGetSourceVariant}.\n *\n * @param {Object} src - as with {@link\n * Union#defaultGetSourceVariant|defaultGetSourceVariant}.\n *\n * @returns {(undefined|VariantLayout)} The default variant\n * (`undefined`) or first registered variant that uses a property\n * available in `src`. */\n this.getSourceVariant = function (src) {\n return boundGetSourceVariant(src);\n };\n /** Function to override the implementation of {@link\n * Union#getSourceVariant|getSourceVariant}.\n *\n * Use this if the desired variant cannot be identified using the\n * algorithm of {@link\n * Union#defaultGetSourceVariant|defaultGetSourceVariant}.\n *\n * **NOTE** The provided function will be invoked bound to this\n * Union instance, providing local access to {@link\n * Union#registry|registry}.\n *\n * @param {Function} gsv - a function that follows the API of\n * {@link Union#defaultGetSourceVariant|defaultGetSourceVariant}. */\n this.configGetSourceVariant = function (gsv) {\n boundGetSourceVariant = gsv.bind(this);\n };\n }\n /** @override */\n getSpan(b, offset = 0) {\n if (0 <= this.span) {\n return this.span;\n }\n /* Default layouts always have non-negative span, so we don't have\n * one and we have to recognize the variant which will in turn\n * determine the span. */\n const vlo = this.getVariant(b, offset);\n if (!vlo) {\n throw new Error('unable to determine span for unrecognized variant');\n }\n return vlo.getSpan(b, offset);\n }\n /**\n * Method to infer a registered Union variant compatible with `src`.\n *\n * The first satisfied rule in the following sequence defines the\n * return value:\n * * If `src` has properties matching the Union discriminator and\n * the default layout, `undefined` is returned regardless of the\n * value of the discriminator property (this ensures the default\n * layout will be used);\n * * If `src` has a property matching the Union discriminator, the\n * value of the discriminator identifies a registered variant, and\n * either (a) the variant has no layout, or (b) `src` has the\n * variant's property, then the variant is returned (because the\n * source satisfies the constraints of the variant it identifies);\n * * If `src` does not have a property matching the Union\n * discriminator, but does have a property matching a registered\n * variant, then the variant is returned (because the source\n * matches a variant without an explicit conflict);\n * * An error is thrown (because we either can't identify a variant,\n * or we were explicitly told the variant but can't satisfy it).\n *\n * @param {Object} src - an object presumed to be compatible with\n * the content of the Union.\n *\n * @return {(undefined|VariantLayout)} - as described above.\n *\n * @throws {Error} - if `src` cannot be associated with a default or\n * registered variant.\n */\n defaultGetSourceVariant(src) {\n if (Object.prototype.hasOwnProperty.call(src, this.discriminator.property)) {\n if (this.defaultLayout && this.defaultLayout.property\n && Object.prototype.hasOwnProperty.call(src, this.defaultLayout.property)) {\n return undefined;\n }\n const vlo = this.registry[src[this.discriminator.property]];\n if (vlo\n && ((!vlo.layout)\n || (vlo.property && Object.prototype.hasOwnProperty.call(src, vlo.property)))) {\n return vlo;\n }\n }\n else {\n for (const tag in this.registry) {\n const vlo = this.registry[tag];\n if (vlo.property && Object.prototype.hasOwnProperty.call(src, vlo.property)) {\n return vlo;\n }\n }\n }\n throw new Error('unable to infer src variant');\n }\n /** Implement {@link Layout#decode|decode} for {@link Union}.\n *\n * If the variant is {@link Union#addVariant|registered} the return\n * value is an instance of that variant, with no explicit\n * discriminator. Otherwise the {@link Union#defaultLayout|default\n * layout} is used to decode the content. */\n decode(b, offset = 0) {\n let dest;\n const dlo = this.discriminator;\n const discr = dlo.decode(b, offset);\n const clo = this.registry[discr];\n if (undefined === clo) {\n const defaultLayout = this.defaultLayout;\n let contentOffset = 0;\n if (this.usesPrefixDiscriminator) {\n contentOffset = dlo.layout.span;\n }\n dest = this.makeDestinationObject();\n dest[dlo.property] = discr;\n // defaultLayout.property can be undefined, but this is allowed by buffer-layout\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n dest[defaultLayout.property] = defaultLayout.decode(b, offset + contentOffset);\n }\n else {\n dest = clo.decode(b, offset);\n }\n return dest;\n }\n /** Implement {@link Layout#encode|encode} for {@link Union}.\n *\n * This API assumes the `src` object is consistent with the union's\n * {@link Union#defaultLayout|default layout}. To encode variants\n * use the appropriate variant-specific {@link VariantLayout#encode}\n * method. */\n encode(src, b, offset = 0) {\n const vlo = this.getSourceVariant(src);\n if (undefined === vlo) {\n const dlo = this.discriminator;\n // this.defaultLayout is not undefined when vlo is undefined\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const clo = this.defaultLayout;\n let contentOffset = 0;\n if (this.usesPrefixDiscriminator) {\n contentOffset = dlo.layout.span;\n }\n dlo.encode(src[dlo.property], b, offset);\n // clo.property is not undefined when vlo is undefined\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return contentOffset + clo.encode(src[clo.property], b, offset + contentOffset);\n }\n return vlo.encode(src, b, offset);\n }\n /** Register a new variant structure within a union. The newly\n * created variant is returned.\n *\n * @param {Number} variant - initializer for {@link\n * VariantLayout#variant|variant}.\n *\n * @param {Layout} layout - initializer for {@link\n * VariantLayout#layout|layout}.\n *\n * @param {String} property - initializer for {@link\n * Layout#property|property}.\n *\n * @return {VariantLayout} */\n addVariant(variant, layout, property) {\n const rv = new VariantLayout(this, variant, layout, property);\n this.registry[variant] = rv;\n return rv;\n }\n /**\n * Get the layout associated with a registered variant.\n *\n * If `vb` does not produce a registered variant the function returns\n * `undefined`.\n *\n * @param {(Number|Uint8Array)} vb - either the variant number, or a\n * buffer from which the discriminator is to be read.\n *\n * @param {Number} offset - offset into `vb` for the start of the\n * union. Used only when `vb` is an instance of {Uint8Array}.\n *\n * @return {({VariantLayout}|undefined)}\n */\n getVariant(vb, offset = 0) {\n let variant;\n if (vb instanceof Uint8Array) {\n variant = this.discriminator.decode(vb, offset);\n }\n else {\n variant = vb;\n }\n return this.registry[variant];\n }\n}\nexports.Union = Union;\n/**\n * Represent a specific variant within a containing union.\n *\n * **NOTE** The {@link Layout#span|span} of the variant may include\n * the span of the {@link Union#discriminator|discriminator} used to\n * identify it, but values read and written using the variant strictly\n * conform to the content of {@link VariantLayout#layout|layout}.\n *\n * **NOTE** User code should not invoke this constructor directly. Use\n * the union {@link Union#addVariant|addVariant} helper method.\n *\n * @param {Union} union - initializer for {@link\n * VariantLayout#union|union}.\n *\n * @param {Number} variant - initializer for {@link\n * VariantLayout#variant|variant}.\n *\n * @param {Layout} [layout] - initializer for {@link\n * VariantLayout#layout|layout}. If absent the variant carries no\n * data.\n *\n * @param {String} [property] - initializer for {@link\n * Layout#property|property}. Unlike many other layouts, variant\n * layouts normally include a property name so they can be identified\n * within their containing {@link Union}. The property identifier may\n * be absent only if `layout` is is absent.\n *\n * @augments {Layout}\n */\nclass VariantLayout extends Layout {\n constructor(union, variant, layout, property) {\n if (!(union instanceof Union)) {\n throw new TypeError('union must be a Union');\n }\n if ((!Number.isInteger(variant)) || (0 > variant)) {\n throw new TypeError('variant must be a (non-negative) integer');\n }\n if (('string' === typeof layout)\n && (undefined === property)) {\n property = layout;\n layout = null;\n }\n if (layout) {\n if (!(layout instanceof Layout)) {\n throw new TypeError('layout must be a Layout');\n }\n if ((null !== union.defaultLayout)\n && (0 <= layout.span)\n && (layout.span > union.defaultLayout.span)) {\n throw new Error('variant span exceeds span of containing union');\n }\n if ('string' !== typeof property) {\n throw new TypeError('variant must have a String property');\n }\n }\n let span = union.span;\n if (0 > union.span) {\n span = layout ? layout.span : 0;\n if ((0 <= span) && union.usesPrefixDiscriminator) {\n span += union.discriminator.layout.span;\n }\n }\n super(span, property);\n /** The {@link Union} to which this variant belongs. */\n this.union = union;\n /** The unsigned integral value identifying this variant within\n * the {@link Union#discriminator|discriminator} of the containing\n * union. */\n this.variant = variant;\n /** The {@link Layout} to be used when reading/writing the\n * non-discriminator part of the {@link\n * VariantLayout#union|union}. If `null` the variant carries no\n * data. */\n this.layout = layout || null;\n }\n /** @override */\n getSpan(b, offset = 0) {\n if (0 <= this.span) {\n /* Will be equal to the containing union span if that is not\n * variable. */\n return this.span;\n }\n let contentOffset = 0;\n if (this.union.usesPrefixDiscriminator) {\n contentOffset = this.union.discriminator.layout.span;\n }\n /* Span is defined solely by the variant (and prefix discriminator) */\n let span = 0;\n if (this.layout) {\n span = this.layout.getSpan(b, offset + contentOffset);\n }\n return contentOffset + span;\n }\n /** @override */\n decode(b, offset = 0) {\n const dest = this.makeDestinationObject();\n if (this !== this.union.getVariant(b, offset)) {\n throw new Error('variant mismatch');\n }\n let contentOffset = 0;\n if (this.union.usesPrefixDiscriminator) {\n contentOffset = this.union.discriminator.layout.span;\n }\n if (this.layout) {\n dest[this.property] = this.layout.decode(b, offset + contentOffset);\n }\n else if (this.property) {\n dest[this.property] = true;\n }\n else if (this.union.usesPrefixDiscriminator) {\n dest[this.union.discriminator.property] = this.variant;\n }\n return dest;\n }\n /** @override */\n encode(src, b, offset = 0) {\n let contentOffset = 0;\n if (this.union.usesPrefixDiscriminator) {\n contentOffset = this.union.discriminator.layout.span;\n }\n if (this.layout\n && (!Object.prototype.hasOwnProperty.call(src, this.property))) {\n throw new TypeError('variant lacks property ' + this.property);\n }\n this.union.discriminator.encode(this.variant, b, offset);\n let span = contentOffset;\n if (this.layout) {\n this.layout.encode(src[this.property], b, offset + contentOffset);\n span += this.layout.getSpan(b, offset + contentOffset);\n if ((0 <= this.union.span)\n && (span > this.union.span)) {\n throw new Error('encoded variant overruns containing union');\n }\n }\n return span;\n }\n /** Delegate {@link Layout#fromArray|fromArray} to {@link\n * VariantLayout#layout|layout}. */\n fromArray(values) {\n if (this.layout) {\n return this.layout.fromArray(values);\n }\n return undefined;\n }\n}\nexports.VariantLayout = VariantLayout;\n/** JavaScript chose to define bitwise operations as operating on\n * signed 32-bit values in 2's complement form, meaning any integer\n * with bit 31 set is going to look negative. For right shifts that's\n * not a problem, because `>>>` is a logical shift, but for every\n * other bitwise operator we have to compensate for possible negative\n * results. */\nfunction fixBitwiseResult(v) {\n if (0 > v) {\n v += 0x100000000;\n }\n return v;\n}\n/**\n * Contain a sequence of bit fields as an unsigned integer.\n *\n * *Factory*: {@link module:Layout.bits|bits}\n *\n * This is a container element; within it there are {@link BitField}\n * instances that provide the extracted properties. The container\n * simply defines the aggregate representation and its bit ordering.\n * The representation is an object containing properties with numeric\n * or {@link Boolean} values.\n *\n * {@link BitField}s are added with the {@link\n * BitStructure#addField|addField} and {@link\n * BitStructure#addBoolean|addBoolean} methods.\n\n * @param {Layout} word - initializer for {@link\n * BitStructure#word|word}. The parameter must be an instance of\n * {@link UInt} (or {@link UIntBE}) that is no more than 4 bytes wide.\n *\n * @param {bool} [msb] - `true` if the bit numbering starts at the\n * most significant bit of the containing word; `false` (default) if\n * it starts at the least significant bit of the containing word. If\n * the parameter at this position is a string and `property` is\n * `undefined` the value of this argument will instead be used as the\n * value of `property`.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass BitStructure extends Layout {\n constructor(word, msb, property) {\n if (!((word instanceof UInt)\n || (word instanceof UIntBE))) {\n throw new TypeError('word must be a UInt or UIntBE layout');\n }\n if (('string' === typeof msb)\n && (undefined === property)) {\n property = msb;\n msb = false;\n }\n if (4 < word.span) {\n throw new RangeError('word cannot exceed 32 bits');\n }\n super(word.span, property);\n /** The layout used for the packed value. {@link BitField}\n * instances are packed sequentially depending on {@link\n * BitStructure#msb|msb}. */\n this.word = word;\n /** Whether the bit sequences are packed starting at the most\n * significant bit growing down (`true`), or the least significant\n * bit growing up (`false`).\n *\n * **NOTE** Regardless of this value, the least significant bit of\n * any {@link BitField} value is the least significant bit of the\n * corresponding section of the packed value. */\n this.msb = !!msb;\n /** The sequence of {@link BitField} layouts that comprise the\n * packed structure.\n *\n * **NOTE** The array remains mutable to allow fields to be {@link\n * BitStructure#addField|added} after construction. Users should\n * not manipulate the content of this property.*/\n this.fields = [];\n /* Storage for the value. Capture a variable instead of using an\n * instance property because we don't want anything to change the\n * value without going through the mutator. */\n let value = 0;\n this._packedSetValue = function (v) {\n value = fixBitwiseResult(v);\n return this;\n };\n this._packedGetValue = function () {\n return value;\n };\n }\n /** @override */\n decode(b, offset = 0) {\n const dest = this.makeDestinationObject();\n const value = this.word.decode(b, offset);\n this._packedSetValue(value);\n for (const fd of this.fields) {\n if (undefined !== fd.property) {\n dest[fd.property] = fd.decode(b);\n }\n }\n return dest;\n }\n /** Implement {@link Layout#encode|encode} for {@link BitStructure}.\n *\n * If `src` is missing a property for a member with a defined {@link\n * Layout#property|property} the corresponding region of the packed\n * value is left unmodified. Unused bits are also left unmodified. */\n encode(src, b, offset = 0) {\n const value = this.word.decode(b, offset);\n this._packedSetValue(value);\n for (const fd of this.fields) {\n if (undefined !== fd.property) {\n const fv = src[fd.property];\n if (undefined !== fv) {\n fd.encode(fv);\n }\n }\n }\n return this.word.encode(this._packedGetValue(), b, offset);\n }\n /** Register a new bitfield with a containing bit structure. The\n * resulting bitfield is returned.\n *\n * @param {Number} bits - initializer for {@link BitField#bits|bits}.\n *\n * @param {string} property - initializer for {@link\n * Layout#property|property}.\n *\n * @return {BitField} */\n addField(bits, property) {\n const bf = new BitField(this, bits, property);\n this.fields.push(bf);\n return bf;\n }\n /** As with {@link BitStructure#addField|addField} for single-bit\n * fields with `boolean` value representation.\n *\n * @param {string} property - initializer for {@link\n * Layout#property|property}.\n *\n * @return {Boolean} */\n // `Boolean` conflicts with the native primitive type\n // eslint-disable-next-line @typescript-eslint/ban-types\n addBoolean(property) {\n // This is my Boolean, not the Javascript one.\n const bf = new Boolean(this, property);\n this.fields.push(bf);\n return bf;\n }\n /**\n * Get access to the bit field for a given property.\n *\n * @param {String} property - the bit field of interest.\n *\n * @return {BitField} - the field associated with `property`, or\n * undefined if there is no such property.\n */\n fieldFor(property) {\n if ('string' !== typeof property) {\n throw new TypeError('property must be string');\n }\n for (const fd of this.fields) {\n if (fd.property === property) {\n return fd;\n }\n }\n return undefined;\n }\n}\nexports.BitStructure = BitStructure;\n/**\n * Represent a sequence of bits within a {@link BitStructure}.\n *\n * All bit field values are represented as unsigned integers.\n *\n * **NOTE** User code should not invoke this constructor directly.\n * Use the container {@link BitStructure#addField|addField} helper\n * method.\n *\n * **NOTE** BitField instances are not instances of {@link Layout}\n * since {@link Layout#span|span} measures 8-bit units.\n *\n * @param {BitStructure} container - initializer for {@link\n * BitField#container|container}.\n *\n * @param {Number} bits - initializer for {@link BitField#bits|bits}.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n */\nclass BitField {\n constructor(container, bits, property) {\n if (!(container instanceof BitStructure)) {\n throw new TypeError('container must be a BitStructure');\n }\n if ((!Number.isInteger(bits)) || (0 >= bits)) {\n throw new TypeError('bits must be positive integer');\n }\n const totalBits = 8 * container.span;\n const usedBits = container.fields.reduce((sum, fd) => sum + fd.bits, 0);\n if ((bits + usedBits) > totalBits) {\n throw new Error('bits too long for span remainder ('\n + (totalBits - usedBits) + ' of '\n + totalBits + ' remain)');\n }\n /** The {@link BitStructure} instance to which this bit field\n * belongs. */\n this.container = container;\n /** The span of this value in bits. */\n this.bits = bits;\n /** A mask of {@link BitField#bits|bits} bits isolating value bits\n * that fit within the field.\n *\n * That is, it masks a value that has not yet been shifted into\n * position within its containing packed integer. */\n this.valueMask = (1 << bits) - 1;\n if (32 === bits) { // shifted value out of range\n this.valueMask = 0xFFFFFFFF;\n }\n /** The offset of the value within the containing packed unsigned\n * integer. The least significant bit of the packed value is at\n * offset zero, regardless of bit ordering used. */\n this.start = usedBits;\n if (this.container.msb) {\n this.start = totalBits - usedBits - bits;\n }\n /** A mask of {@link BitField#bits|bits} isolating the field value\n * within the containing packed unsigned integer. */\n this.wordMask = fixBitwiseResult(this.valueMask << this.start);\n /** The property name used when this bitfield is represented in an\n * Object.\n *\n * Intended to be functionally equivalent to {@link\n * Layout#property}.\n *\n * If left undefined the corresponding span of bits will be\n * treated as padding: it will not be mutated by {@link\n * Layout#encode|encode} nor represented as a property in the\n * decoded Object. */\n this.property = property;\n }\n /** Store a value into the corresponding subsequence of the containing\n * bit field. */\n decode(b, offset) {\n const word = this.container._packedGetValue();\n const wordValue = fixBitwiseResult(word & this.wordMask);\n const value = wordValue >>> this.start;\n return value;\n }\n /** Store a value into the corresponding subsequence of the containing\n * bit field.\n *\n * **NOTE** This is not a specialization of {@link\n * Layout#encode|Layout.encode} and there is no return value. */\n encode(value) {\n if ('number' !== typeof value\n || !Number.isInteger(value)\n || (value !== fixBitwiseResult(value & this.valueMask))) {\n throw new TypeError(nameWithProperty('BitField.encode', this)\n + ' value must be integer not exceeding ' + this.valueMask);\n }\n const word = this.container._packedGetValue();\n const wordValue = fixBitwiseResult(value << this.start);\n this.container._packedSetValue(fixBitwiseResult(word & ~this.wordMask)\n | wordValue);\n }\n}\nexports.BitField = BitField;\n/**\n * Represent a single bit within a {@link BitStructure} as a\n * JavaScript boolean.\n *\n * **NOTE** User code should not invoke this constructor directly.\n * Use the container {@link BitStructure#addBoolean|addBoolean} helper\n * method.\n *\n * @param {BitStructure} container - initializer for {@link\n * BitField#container|container}.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {BitField}\n */\n/* eslint-disable no-extend-native */\nclass Boolean extends BitField {\n constructor(container, property) {\n super(container, 1, property);\n }\n /** Override {@link BitField#decode|decode} for {@link Boolean|Boolean}.\n *\n * @returns {boolean} */\n decode(b, offset) {\n return !!super.decode(b, offset);\n }\n /** @override */\n encode(value) {\n if ('boolean' === typeof value) {\n // BitField requires integer values\n value = +value;\n }\n super.encode(value);\n }\n}\nexports.Boolean = Boolean;\n/* eslint-enable no-extend-native */\n/**\n * Contain a fixed-length block of arbitrary data, represented as a\n * Uint8Array.\n *\n * *Factory*: {@link module:Layout.blob|blob}\n *\n * @param {(Number|ExternalLayout)} length - initializes {@link\n * Blob#length|length}.\n *\n * @param {String} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass Blob extends Layout {\n constructor(length, property) {\n if (!(((length instanceof ExternalLayout) && length.isCount())\n || (Number.isInteger(length) && (0 <= length)))) {\n throw new TypeError('length must be positive integer '\n + 'or an unsigned integer ExternalLayout');\n }\n let span = -1;\n if (!(length instanceof ExternalLayout)) {\n span = length;\n }\n super(span, property);\n /** The number of bytes in the blob.\n *\n * This may be a non-negative integer, or an instance of {@link\n * ExternalLayout} that satisfies {@link\n * ExternalLayout#isCount|isCount()}. */\n this.length = length;\n }\n /** @override */\n getSpan(b, offset) {\n let span = this.span;\n if (0 > span) {\n span = this.length.decode(b, offset);\n }\n return span;\n }\n /** @override */\n decode(b, offset = 0) {\n let span = this.span;\n if (0 > span) {\n span = this.length.decode(b, offset);\n }\n return uint8ArrayToBuffer(b).slice(offset, offset + span);\n }\n /** Implement {@link Layout#encode|encode} for {@link Blob}.\n *\n * **NOTE** If {@link Layout#count|count} is an instance of {@link\n * ExternalLayout} then the length of `src` will be encoded as the\n * count after `src` is encoded. */\n encode(src, b, offset) {\n let span = this.length;\n if (this.length instanceof ExternalLayout) {\n span = src.length;\n }\n if (!(src instanceof Uint8Array && span === src.length)) {\n throw new TypeError(nameWithProperty('Blob.encode', this)\n + ' requires (length ' + span + ') Uint8Array as src');\n }\n if ((offset + span) > b.length) {\n throw new RangeError('encoding overruns Uint8Array');\n }\n const srcBuffer = uint8ArrayToBuffer(src);\n uint8ArrayToBuffer(b).write(srcBuffer.toString('hex'), offset, span, 'hex');\n if (this.length instanceof ExternalLayout) {\n this.length.encode(span, b, offset);\n }\n return span;\n }\n}\nexports.Blob = Blob;\n/**\n * Contain a `NUL`-terminated UTF8 string.\n *\n * *Factory*: {@link module:Layout.cstr|cstr}\n *\n * **NOTE** Any UTF8 string that incorporates a zero-valued byte will\n * not be correctly decoded by this layout.\n *\n * @param {String} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass CString extends Layout {\n constructor(property) {\n super(-1, property);\n }\n /** @override */\n getSpan(b, offset = 0) {\n checkUint8Array(b);\n let idx = offset;\n while ((idx < b.length) && (0 !== b[idx])) {\n idx += 1;\n }\n return 1 + idx - offset;\n }\n /** @override */\n decode(b, offset = 0) {\n const span = this.getSpan(b, offset);\n return uint8ArrayToBuffer(b).slice(offset, offset + span - 1).toString('utf-8');\n }\n /** @override */\n encode(src, b, offset = 0) {\n /* Must force this to a string, lest it be a number and the\n * \"utf8-encoding\" below actually allocate a buffer of length\n * src */\n if ('string' !== typeof src) {\n src = String(src);\n }\n const srcb = buffer_1.Buffer.from(src, 'utf8');\n const span = srcb.length;\n if ((offset + span) > b.length) {\n throw new RangeError('encoding overruns Buffer');\n }\n const buffer = uint8ArrayToBuffer(b);\n srcb.copy(buffer, offset);\n buffer[offset + span] = 0;\n return span + 1;\n }\n}\nexports.CString = CString;\n/**\n * Contain a UTF8 string with implicit length.\n *\n * *Factory*: {@link module:Layout.utf8|utf8}\n *\n * **NOTE** Because the length is implicit in the size of the buffer\n * this layout should be used only in isolation, or in a situation\n * where the length can be expressed by operating on a slice of the\n * containing buffer.\n *\n * @param {Number} [maxSpan] - the maximum length allowed for encoded\n * string content. If not provided there is no bound on the allowed\n * content.\n *\n * @param {String} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass UTF8 extends Layout {\n constructor(maxSpan, property) {\n if (('string' === typeof maxSpan) && (undefined === property)) {\n property = maxSpan;\n maxSpan = undefined;\n }\n if (undefined === maxSpan) {\n maxSpan = -1;\n }\n else if (!Number.isInteger(maxSpan)) {\n throw new TypeError('maxSpan must be an integer');\n }\n super(-1, property);\n /** The maximum span of the layout in bytes.\n *\n * Positive values are generally expected. Zero is abnormal.\n * Attempts to encode or decode a value that exceeds this length\n * will throw a `RangeError`.\n *\n * A negative value indicates that there is no bound on the length\n * of the content. */\n this.maxSpan = maxSpan;\n }\n /** @override */\n getSpan(b, offset = 0) {\n checkUint8Array(b);\n return b.length - offset;\n }\n /** @override */\n decode(b, offset = 0) {\n const span = this.getSpan(b, offset);\n if ((0 <= this.maxSpan)\n && (this.maxSpan < span)) {\n throw new RangeError('text length exceeds maxSpan');\n }\n return uint8ArrayToBuffer(b).slice(offset, offset + span).toString('utf-8');\n }\n /** @override */\n encode(src, b, offset = 0) {\n /* Must force this to a string, lest it be a number and the\n * \"utf8-encoding\" below actually allocate a buffer of length\n * src */\n if ('string' !== typeof src) {\n src = String(src);\n }\n const srcb = buffer_1.Buffer.from(src, 'utf8');\n const span = srcb.length;\n if ((0 <= this.maxSpan)\n && (this.maxSpan < span)) {\n throw new RangeError('text length exceeds maxSpan');\n }\n if ((offset + span) > b.length) {\n throw new RangeError('encoding overruns Buffer');\n }\n srcb.copy(uint8ArrayToBuffer(b), offset);\n return span;\n }\n}\nexports.UTF8 = UTF8;\n/**\n * Contain a constant value.\n *\n * This layout may be used in cases where a JavaScript value can be\n * inferred without an expression in the binary encoding. An example\n * would be a {@link VariantLayout|variant layout} where the content\n * is implied by the union {@link Union#discriminator|discriminator}.\n *\n * @param {Object|Number|String} value - initializer for {@link\n * Constant#value|value}. If the value is an object (or array) and\n * the application intends the object to remain unchanged regardless\n * of what is done to values decoded by this layout, the value should\n * be frozen prior passing it to this constructor.\n *\n * @param {String} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass Constant extends Layout {\n constructor(value, property) {\n super(0, property);\n /** The value produced by this constant when the layout is {@link\n * Constant#decode|decoded}.\n *\n * Any JavaScript value including `null` and `undefined` is\n * permitted.\n *\n * **WARNING** If `value` passed in the constructor was not\n * frozen, it is possible for users of decoded values to change\n * the content of the value. */\n this.value = value;\n }\n /** @override */\n decode(b, offset) {\n return this.value;\n }\n /** @override */\n encode(src, b, offset) {\n /* Constants take no space */\n return 0;\n }\n}\nexports.Constant = Constant;\n/** Factory for {@link GreedyCount}. */\nexports.greedy = ((elementSpan, property) => new GreedyCount(elementSpan, property));\n/** Factory for {@link OffsetLayout}. */\nexports.offset = ((layout, offset, property) => new OffsetLayout(layout, offset, property));\n/** Factory for {@link UInt|unsigned int layouts} spanning one\n * byte. */\nexports.u8 = ((property) => new UInt(1, property));\n/** Factory for {@link UInt|little-endian unsigned int layouts}\n * spanning two bytes. */\nexports.u16 = ((property) => new UInt(2, property));\n/** Factory for {@link UInt|little-endian unsigned int layouts}\n * spanning three bytes. */\nexports.u24 = ((property) => new UInt(3, property));\n/** Factory for {@link UInt|little-endian unsigned int layouts}\n * spanning four bytes. */\nexports.u32 = ((property) => new UInt(4, property));\n/** Factory for {@link UInt|little-endian unsigned int layouts}\n * spanning five bytes. */\nexports.u40 = ((property) => new UInt(5, property));\n/** Factory for {@link UInt|little-endian unsigned int layouts}\n * spanning six bytes. */\nexports.u48 = ((property) => new UInt(6, property));\n/** Factory for {@link NearUInt64|little-endian unsigned int\n * layouts} interpreted as Numbers. */\nexports.nu64 = ((property) => new NearUInt64(property));\n/** Factory for {@link UInt|big-endian unsigned int layouts}\n * spanning two bytes. */\nexports.u16be = ((property) => new UIntBE(2, property));\n/** Factory for {@link UInt|big-endian unsigned int layouts}\n * spanning three bytes. */\nexports.u24be = ((property) => new UIntBE(3, property));\n/** Factory for {@link UInt|big-endian unsigned int layouts}\n * spanning four bytes. */\nexports.u32be = ((property) => new UIntBE(4, property));\n/** Factory for {@link UInt|big-endian unsigned int layouts}\n * spanning five bytes. */\nexports.u40be = ((property) => new UIntBE(5, property));\n/** Factory for {@link UInt|big-endian unsigned int layouts}\n * spanning six bytes. */\nexports.u48be = ((property) => new UIntBE(6, property));\n/** Factory for {@link NearUInt64BE|big-endian unsigned int\n * layouts} interpreted as Numbers. */\nexports.nu64be = ((property) => new NearUInt64BE(property));\n/** Factory for {@link Int|signed int layouts} spanning one\n * byte. */\nexports.s8 = ((property) => new Int(1, property));\n/** Factory for {@link Int|little-endian signed int layouts}\n * spanning two bytes. */\nexports.s16 = ((property) => new Int(2, property));\n/** Factory for {@link Int|little-endian signed int layouts}\n * spanning three bytes. */\nexports.s24 = ((property) => new Int(3, property));\n/** Factory for {@link Int|little-endian signed int layouts}\n * spanning four bytes. */\nexports.s32 = ((property) => new Int(4, property));\n/** Factory for {@link Int|little-endian signed int layouts}\n * spanning five bytes. */\nexports.s40 = ((property) => new Int(5, property));\n/** Factory for {@link Int|little-endian signed int layouts}\n * spanning six bytes. */\nexports.s48 = ((property) => new Int(6, property));\n/** Factory for {@link NearInt64|little-endian signed int layouts}\n * interpreted as Numbers. */\nexports.ns64 = ((property) => new NearInt64(property));\n/** Factory for {@link Int|big-endian signed int layouts}\n * spanning two bytes. */\nexports.s16be = ((property) => new IntBE(2, property));\n/** Factory for {@link Int|big-endian signed int layouts}\n * spanning three bytes. */\nexports.s24be = ((property) => new IntBE(3, property));\n/** Factory for {@link Int|big-endian signed int layouts}\n * spanning four bytes. */\nexports.s32be = ((property) => new IntBE(4, property));\n/** Factory for {@link Int|big-endian signed int layouts}\n * spanning five bytes. */\nexports.s40be = ((property) => new IntBE(5, property));\n/** Factory for {@link Int|big-endian signed int layouts}\n * spanning six bytes. */\nexports.s48be = ((property) => new IntBE(6, property));\n/** Factory for {@link NearInt64BE|big-endian signed int layouts}\n * interpreted as Numbers. */\nexports.ns64be = ((property) => new NearInt64BE(property));\n/** Factory for {@link Float|little-endian 32-bit floating point} values. */\nexports.f32 = ((property) => new Float(property));\n/** Factory for {@link FloatBE|big-endian 32-bit floating point} values. */\nexports.f32be = ((property) => new FloatBE(property));\n/** Factory for {@link Double|little-endian 64-bit floating point} values. */\nexports.f64 = ((property) => new Double(property));\n/** Factory for {@link DoubleBE|big-endian 64-bit floating point} values. */\nexports.f64be = ((property) => new DoubleBE(property));\n/** Factory for {@link Structure} values. */\nexports.struct = ((fields, property, decodePrefixes) => new Structure(fields, property, decodePrefixes));\n/** Factory for {@link BitStructure} values. */\nexports.bits = ((word, msb, property) => new BitStructure(word, msb, property));\n/** Factory for {@link Sequence} values. */\nexports.seq = ((elementLayout, count, property) => new Sequence(elementLayout, count, property));\n/** Factory for {@link Union} values. */\nexports.union = ((discr, defaultLayout, property) => new Union(discr, defaultLayout, property));\n/** Factory for {@link UnionLayoutDiscriminator} values. */\nexports.unionLayoutDiscriminator = ((layout, property) => new UnionLayoutDiscriminator(layout, property));\n/** Factory for {@link Blob} values. */\nexports.blob = ((length, property) => new Blob(length, property));\n/** Factory for {@link CString} values. */\nexports.cstr = ((property) => new CString(property));\n/** Factory for {@link UTF8} values. */\nexports.utf8 = ((maxSpan, property) => new UTF8(maxSpan, property));\n/** Factory for {@link Constant} values. */\nexports.constant = ((value, property) => new Constant(value, property));\n//# sourceMappingURL=Layout.js.map","export const encodeDecode = (layout) => {\n const decode = layout.decode.bind(layout);\n const encode = layout.encode.bind(layout);\n return { decode, encode };\n};\n//# sourceMappingURL=base.js.map","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nlet converter;\n/**\n * Convert a little-endian buffer into a BigInt.\n * @param buf The little-endian buffer to convert\n * @returns A BigInt with the little-endian representation of buf.\n */\nfunction toBigIntLE(buf) {\n {\n const reversed = Buffer.from(buf);\n reversed.reverse();\n const hex = reversed.toString('hex');\n if (hex.length === 0) {\n return BigInt(0);\n }\n return BigInt(`0x${hex}`);\n }\n return converter.toBigInt(buf, false);\n}\nexports.toBigIntLE = toBigIntLE;\n/**\n * Convert a big-endian buffer into a BigInt\n * @param buf The big-endian buffer to convert.\n * @returns A BigInt with the big-endian representation of buf.\n */\nfunction toBigIntBE(buf) {\n {\n const hex = buf.toString('hex');\n if (hex.length === 0) {\n return BigInt(0);\n }\n return BigInt(`0x${hex}`);\n }\n return converter.toBigInt(buf, true);\n}\nexports.toBigIntBE = toBigIntBE;\n/**\n * Convert a BigInt to a little-endian buffer.\n * @param num The BigInt to convert.\n * @param width The number of bytes that the resulting buffer should be.\n * @returns A little-endian buffer representation of num.\n */\nfunction toBufferLE(num, width) {\n {\n const hex = num.toString(16);\n const buffer = Buffer.from(hex.padStart(width * 2, '0').slice(0, width * 2), 'hex');\n buffer.reverse();\n return buffer;\n }\n // Allocation is done here, since it is slower using napi in C\n return converter.fromBigInt(num, Buffer.allocUnsafe(width), false);\n}\nexports.toBufferLE = toBufferLE;\n/**\n * Convert a BigInt to a big-endian buffer.\n * @param num The BigInt to convert.\n * @param width The number of bytes that the resulting buffer should be.\n * @returns A big-endian buffer representation of num.\n */\nfunction toBufferBE(num, width) {\n {\n const hex = num.toString(16);\n return Buffer.from(hex.padStart(width * 2, '0').slice(0, width * 2), 'hex');\n }\n return converter.fromBigInt(num, Buffer.allocUnsafe(width), true);\n}\nexports.toBufferBE = toBufferBE;\n","import { blob } from '@solana/buffer-layout';\nimport { toBigIntBE, toBigIntLE, toBufferBE, toBufferLE } from 'bigint-buffer';\nimport { encodeDecode } from './base.mjs';\nexport const bigInt = (length) => (property) => {\n const layout = blob(length, property);\n const { encode, decode } = encodeDecode(layout);\n const bigIntLayout = layout;\n bigIntLayout.decode = (buffer, offset) => {\n const src = decode(buffer, offset);\n return toBigIntLE(Buffer.from(src));\n };\n bigIntLayout.encode = (bigInt, buffer, offset) => {\n const src = toBufferLE(bigInt, length);\n return encode(src, buffer, offset);\n };\n return bigIntLayout;\n};\nexport const bigIntBE = (length) => (property) => {\n const layout = blob(length, property);\n const { encode, decode } = encodeDecode(layout);\n const bigIntLayout = layout;\n bigIntLayout.decode = (buffer, offset) => {\n const src = decode(buffer, offset);\n return toBigIntBE(Buffer.from(src));\n };\n bigIntLayout.encode = (bigInt, buffer, offset) => {\n const src = toBufferBE(bigInt, length);\n return encode(src, buffer, offset);\n };\n return bigIntLayout;\n};\nexport const u64 = bigInt(8);\nexport const u64be = bigIntBE(8);\nexport const u128 = bigInt(16);\nexport const u128be = bigIntBE(16);\nexport const u192 = bigInt(24);\nexport const u192be = bigIntBE(24);\nexport const u256 = bigInt(32);\nexport const u256be = bigIntBE(32);\n//# sourceMappingURL=bigint.js.map","import { u8 } from '@solana/buffer-layout';\nimport { encodeDecode } from './base.mjs';\nexport const bool = (property) => {\n const layout = u8(property);\n const { encode, decode } = encodeDecode(layout);\n const boolLayout = layout;\n boolLayout.decode = (buffer, offset) => {\n const src = decode(buffer, offset);\n return !!src;\n };\n boolLayout.encode = (bool, buffer, offset) => {\n const src = Number(bool);\n return encode(src, buffer, offset);\n };\n return boolLayout;\n};\n//# sourceMappingURL=native.js.map","import { blob } from '@solana/buffer-layout';\nimport { PublicKey } from '@solana/web3.js';\nimport { encodeDecode } from './base.mjs';\nexport const publicKey = (property) => {\n const layout = blob(32, property);\n const { encode, decode } = encodeDecode(layout);\n const publicKeyLayout = layout;\n publicKeyLayout.decode = (buffer, offset) => {\n const src = decode(buffer, offset);\n return new PublicKey(src);\n };\n publicKeyLayout.encode = (publicKey, buffer, offset) => {\n const src = publicKey.toBuffer();\n return encode(src, buffer, offset);\n };\n return publicKeyLayout;\n};\n//# sourceMappingURL=web3.js.map","/** Base class for errors */\nexport class TokenError extends Error {\n constructor(message) {\n super(message);\n }\n}\n/** Thrown if an account is not found at the expected address */\nexport class TokenAccountNotFoundError extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenAccountNotFoundError';\n }\n}\n/** Thrown if a program state account is not a valid Account */\nexport class TokenInvalidAccountError extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenInvalidAccountError';\n }\n}\n/** Thrown if a program state account is not owned by the expected token program */\nexport class TokenInvalidAccountOwnerError extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenInvalidAccountOwnerError';\n }\n}\n/** Thrown if the byte length of an program state account doesn't match the expected size */\nexport class TokenInvalidAccountSizeError extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenInvalidAccountSizeError';\n }\n}\n/** Thrown if the mint of a token account doesn't match the expected mint */\nexport class TokenInvalidMintError extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenInvalidMintError';\n }\n}\n/** Thrown if the owner of a token account doesn't match the expected owner */\nexport class TokenInvalidOwnerError extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenInvalidOwnerError';\n }\n}\n/** Thrown if the owner of a token account is a PDA (Program Derived Address) */\nexport class TokenOwnerOffCurveError extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenOwnerOffCurveError';\n }\n}\n/** Thrown if an instruction's program is invalid */\nexport class TokenInvalidInstructionProgramError extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenInvalidInstructionProgramError';\n }\n}\n/** Thrown if an instruction's keys are invalid */\nexport class TokenInvalidInstructionKeysError extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenInvalidInstructionKeysError';\n }\n}\n/** Thrown if an instruction's data is invalid */\nexport class TokenInvalidInstructionDataError extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenInvalidInstructionDataError';\n }\n}\n/** Thrown if an instruction's type is invalid */\nexport class TokenInvalidInstructionTypeError extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenInvalidInstructionTypeError';\n }\n}\n/** Thrown if the program does not support the desired instruction */\nexport class TokenUnsupportedInstructionError extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenUnsupportedInstructionError';\n }\n}\n//# sourceMappingURL=errors.js.map","/** Instructions defined by the program */\nexport var TokenInstruction;\n(function (TokenInstruction) {\n TokenInstruction[TokenInstruction[\"InitializeMint\"] = 0] = \"InitializeMint\";\n TokenInstruction[TokenInstruction[\"InitializeAccount\"] = 1] = \"InitializeAccount\";\n TokenInstruction[TokenInstruction[\"InitializeMultisig\"] = 2] = \"InitializeMultisig\";\n TokenInstruction[TokenInstruction[\"Transfer\"] = 3] = \"Transfer\";\n TokenInstruction[TokenInstruction[\"Approve\"] = 4] = \"Approve\";\n TokenInstruction[TokenInstruction[\"Revoke\"] = 5] = \"Revoke\";\n TokenInstruction[TokenInstruction[\"SetAuthority\"] = 6] = \"SetAuthority\";\n TokenInstruction[TokenInstruction[\"MintTo\"] = 7] = \"MintTo\";\n TokenInstruction[TokenInstruction[\"Burn\"] = 8] = \"Burn\";\n TokenInstruction[TokenInstruction[\"CloseAccount\"] = 9] = \"CloseAccount\";\n TokenInstruction[TokenInstruction[\"FreezeAccount\"] = 10] = \"FreezeAccount\";\n TokenInstruction[TokenInstruction[\"ThawAccount\"] = 11] = \"ThawAccount\";\n TokenInstruction[TokenInstruction[\"TransferChecked\"] = 12] = \"TransferChecked\";\n TokenInstruction[TokenInstruction[\"ApproveChecked\"] = 13] = \"ApproveChecked\";\n TokenInstruction[TokenInstruction[\"MintToChecked\"] = 14] = \"MintToChecked\";\n TokenInstruction[TokenInstruction[\"BurnChecked\"] = 15] = \"BurnChecked\";\n TokenInstruction[TokenInstruction[\"InitializeAccount2\"] = 16] = \"InitializeAccount2\";\n TokenInstruction[TokenInstruction[\"SyncNative\"] = 17] = \"SyncNative\";\n TokenInstruction[TokenInstruction[\"InitializeAccount3\"] = 18] = \"InitializeAccount3\";\n TokenInstruction[TokenInstruction[\"InitializeMultisig2\"] = 19] = \"InitializeMultisig2\";\n TokenInstruction[TokenInstruction[\"InitializeMint2\"] = 20] = \"InitializeMint2\";\n TokenInstruction[TokenInstruction[\"GetAccountDataSize\"] = 21] = \"GetAccountDataSize\";\n TokenInstruction[TokenInstruction[\"InitializeImmutableOwner\"] = 22] = \"InitializeImmutableOwner\";\n TokenInstruction[TokenInstruction[\"AmountToUiAmount\"] = 23] = \"AmountToUiAmount\";\n TokenInstruction[TokenInstruction[\"UiAmountToAmount\"] = 24] = \"UiAmountToAmount\";\n TokenInstruction[TokenInstruction[\"InitializeMintCloseAuthority\"] = 25] = \"InitializeMintCloseAuthority\";\n TokenInstruction[TokenInstruction[\"TransferFeeExtension\"] = 26] = \"TransferFeeExtension\";\n TokenInstruction[TokenInstruction[\"ConfidentialTransferExtension\"] = 27] = \"ConfidentialTransferExtension\";\n TokenInstruction[TokenInstruction[\"DefaultAccountStateExtension\"] = 28] = \"DefaultAccountStateExtension\";\n TokenInstruction[TokenInstruction[\"Reallocate\"] = 29] = \"Reallocate\";\n TokenInstruction[TokenInstruction[\"MemoTransferExtension\"] = 30] = \"MemoTransferExtension\";\n TokenInstruction[TokenInstruction[\"CreateNativeMint\"] = 31] = \"CreateNativeMint\";\n TokenInstruction[TokenInstruction[\"InitializeNonTransferableMint\"] = 32] = \"InitializeNonTransferableMint\";\n TokenInstruction[TokenInstruction[\"InterestBearingMintExtension\"] = 33] = \"InterestBearingMintExtension\";\n TokenInstruction[TokenInstruction[\"CpiGuardExtension\"] = 34] = \"CpiGuardExtension\";\n TokenInstruction[TokenInstruction[\"InitializePermanentDelegate\"] = 35] = \"InitializePermanentDelegate\";\n})(TokenInstruction || (TokenInstruction = {}));\n//# sourceMappingURL=types.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { u64 } from '@solana/buffer-layout-utils';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const amountToUiAmountInstructionData = struct([\n u8('instruction'),\n u64('amount'),\n]);\n/**\n * Construct a AmountToUiAmount instruction\n *\n * @param mint Public key of the mint\n * @param amount Amount of tokens to be converted to UiAmount\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createAmountToUiAmountInstruction(mint, amount, programId = TOKEN_PROGRAM_ID) {\n const keys = [{ pubkey: mint, isSigner: false, isWritable: false }];\n const data = Buffer.alloc(amountToUiAmountInstructionData.span);\n amountToUiAmountInstructionData.encode({\n instruction: TokenInstruction.AmountToUiAmount,\n amount: BigInt(amount),\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode a AmountToUiAmount instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeAmountToUiAmountInstruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== amountToUiAmountInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { mint }, data, } = decodeAmountToUiAmountInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.AmountToUiAmount)\n throw new TokenInvalidInstructionTypeError();\n if (!mint)\n throw new TokenInvalidInstructionKeysError();\n return {\n programId,\n keys: {\n mint,\n },\n data,\n };\n}\n/**\n * Decode a AmountToUiAmount instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeAmountToUiAmountInstructionUnchecked({ programId, keys: [mint], data, }) {\n return {\n programId,\n keys: {\n mint,\n },\n data: amountToUiAmountInstructionData.decode(data),\n };\n}\n//# sourceMappingURL=amountToUiAmount.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { u64 } from '@solana/buffer-layout-utils';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { addSigners } from './internal.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const approveInstructionData = struct([u8('instruction'), u64('amount')]);\n/**\n * Construct an Approve instruction\n *\n * @param account Account to set the delegate for\n * @param delegate Account authorized to transfer tokens from the account\n * @param owner Owner of the account\n * @param amount Maximum number of tokens the delegate may transfer\n * @param multiSigners Signing accounts if `owner` is a multisig\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createApproveInstruction(account, delegate, owner, amount, multiSigners = [], programId = TOKEN_PROGRAM_ID) {\n const keys = addSigners([\n { pubkey: account, isSigner: false, isWritable: true },\n { pubkey: delegate, isSigner: false, isWritable: false },\n ], owner, multiSigners);\n const data = Buffer.alloc(approveInstructionData.span);\n approveInstructionData.encode({\n instruction: TokenInstruction.Approve,\n amount: BigInt(amount),\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode an Approve instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeApproveInstruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== approveInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { account, delegate, owner, multiSigners }, data, } = decodeApproveInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.Approve)\n throw new TokenInvalidInstructionTypeError();\n if (!account || !delegate || !owner)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n account,\n delegate,\n owner,\n multiSigners,\n },\n data,\n };\n}\n/**\n * Decode an Approve instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeApproveInstructionUnchecked({ programId, keys: [account, delegate, owner, ...multiSigners], data, }) {\n return {\n programId,\n keys: {\n account,\n delegate,\n owner,\n multiSigners,\n },\n data: approveInstructionData.decode(data),\n };\n}\n//# sourceMappingURL=approve.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { u64 } from '@solana/buffer-layout-utils';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { addSigners } from './internal.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const approveCheckedInstructionData = struct([\n u8('instruction'),\n u64('amount'),\n u8('decimals'),\n]);\n/**\n * Construct an ApproveChecked instruction\n *\n * @param account Account to set the delegate for\n * @param mint Mint account\n * @param delegate Account authorized to transfer of tokens from the account\n * @param owner Owner of the account\n * @param amount Maximum number of tokens the delegate may transfer\n * @param decimals Number of decimals in approve amount\n * @param multiSigners Signing accounts if `owner` is a multisig\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createApproveCheckedInstruction(account, mint, delegate, owner, amount, decimals, multiSigners = [], programId = TOKEN_PROGRAM_ID) {\n const keys = addSigners([\n { pubkey: account, isSigner: false, isWritable: true },\n { pubkey: mint, isSigner: false, isWritable: false },\n { pubkey: delegate, isSigner: false, isWritable: false },\n ], owner, multiSigners);\n const data = Buffer.alloc(approveCheckedInstructionData.span);\n approveCheckedInstructionData.encode({\n instruction: TokenInstruction.ApproveChecked,\n amount: BigInt(amount),\n decimals,\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode an ApproveChecked instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeApproveCheckedInstruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== approveCheckedInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { account, mint, delegate, owner, multiSigners }, data, } = decodeApproveCheckedInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.ApproveChecked)\n throw new TokenInvalidInstructionTypeError();\n if (!account || !mint || !delegate || !owner)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n account,\n mint,\n delegate,\n owner,\n multiSigners,\n },\n data,\n };\n}\n/**\n * Decode an ApproveChecked instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeApproveCheckedInstructionUnchecked({ programId, keys: [account, mint, delegate, owner, ...multiSigners], data, }) {\n return {\n programId,\n keys: {\n account,\n mint,\n delegate,\n owner,\n multiSigners,\n },\n data: approveCheckedInstructionData.decode(data),\n };\n}\n//# sourceMappingURL=approveChecked.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { u64 } from '@solana/buffer-layout-utils';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { addSigners } from './internal.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const burnInstructionData = struct([u8('instruction'), u64('amount')]);\n/**\n * Construct a Burn instruction\n *\n * @param account Account to burn tokens from\n * @param mint Mint for the account\n * @param owner Owner of the account\n * @param amount Number of tokens to burn\n * @param multiSigners Signing accounts if `owner` is a multisig\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createBurnInstruction(account, mint, owner, amount, multiSigners = [], programId = TOKEN_PROGRAM_ID) {\n const keys = addSigners([\n { pubkey: account, isSigner: false, isWritable: true },\n { pubkey: mint, isSigner: false, isWritable: true },\n ], owner, multiSigners);\n const data = Buffer.alloc(burnInstructionData.span);\n burnInstructionData.encode({\n instruction: TokenInstruction.Burn,\n amount: BigInt(amount),\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode a Burn instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeBurnInstruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== burnInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { account, mint, owner, multiSigners }, data, } = decodeBurnInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.Burn)\n throw new TokenInvalidInstructionTypeError();\n if (!account || !mint || !owner)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n account,\n mint,\n owner,\n multiSigners,\n },\n data,\n };\n}\n/**\n * Decode a Burn instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeBurnInstructionUnchecked({ programId, keys: [account, mint, owner, ...multiSigners], data, }) {\n return {\n programId,\n keys: {\n account,\n mint,\n owner,\n multiSigners,\n },\n data: burnInstructionData.decode(data),\n };\n}\n//# sourceMappingURL=burn.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { u64 } from '@solana/buffer-layout-utils';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { addSigners } from './internal.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const burnCheckedInstructionData = struct([\n u8('instruction'),\n u64('amount'),\n u8('decimals'),\n]);\n/**\n * Construct a BurnChecked instruction\n *\n * @param mint Mint for the account\n * @param account Account to burn tokens from\n * @param owner Owner of the account\n * @param amount Number of tokens to burn\n * @param decimals Number of decimals in burn amount\n * @param multiSigners Signing accounts if `owner` is a multisig\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createBurnCheckedInstruction(account, mint, owner, amount, decimals, multiSigners = [], programId = TOKEN_PROGRAM_ID) {\n const keys = addSigners([\n { pubkey: account, isSigner: false, isWritable: true },\n { pubkey: mint, isSigner: false, isWritable: true },\n ], owner, multiSigners);\n const data = Buffer.alloc(burnCheckedInstructionData.span);\n burnCheckedInstructionData.encode({\n instruction: TokenInstruction.BurnChecked,\n amount: BigInt(amount),\n decimals,\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode a BurnChecked instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeBurnCheckedInstruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== burnCheckedInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { account, mint, owner, multiSigners }, data, } = decodeBurnCheckedInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.BurnChecked)\n throw new TokenInvalidInstructionTypeError();\n if (!account || !mint || !owner)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n account,\n mint,\n owner,\n multiSigners,\n },\n data,\n };\n}\n/**\n * Decode a BurnChecked instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeBurnCheckedInstructionUnchecked({ programId, keys: [account, mint, owner, ...multiSigners], data, }) {\n return {\n programId,\n keys: {\n account,\n mint,\n owner,\n multiSigners,\n },\n data: burnCheckedInstructionData.decode(data),\n };\n}\n//# sourceMappingURL=burnChecked.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { addSigners } from './internal.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const closeAccountInstructionData = struct([u8('instruction')]);\n/**\n * Construct a CloseAccount instruction\n *\n * @param account Account to close\n * @param destination Account to receive the remaining balance of the closed account\n * @param authority Account close authority\n * @param multiSigners Signing accounts if `authority` is a multisig\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createCloseAccountInstruction(account, destination, authority, multiSigners = [], programId = TOKEN_PROGRAM_ID) {\n const keys = addSigners([\n { pubkey: account, isSigner: false, isWritable: true },\n { pubkey: destination, isSigner: false, isWritable: true },\n ], authority, multiSigners);\n const data = Buffer.alloc(closeAccountInstructionData.span);\n closeAccountInstructionData.encode({ instruction: TokenInstruction.CloseAccount }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode a CloseAccount instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeCloseAccountInstruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== closeAccountInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { account, destination, authority, multiSigners }, data, } = decodeCloseAccountInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.CloseAccount)\n throw new TokenInvalidInstructionTypeError();\n if (!account || !destination || !authority)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n account,\n destination,\n authority,\n multiSigners,\n },\n data,\n };\n}\n/**\n * Decode a CloseAccount instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeCloseAccountInstructionUnchecked({ programId, keys: [account, destination, authority, ...multiSigners], data, }) {\n return {\n programId,\n keys: {\n account,\n destination,\n authority,\n multiSigners,\n },\n data: closeAccountInstructionData.decode(data),\n };\n}\n//# sourceMappingURL=closeAccount.js.map","export var AccountType;\n(function (AccountType) {\n AccountType[AccountType[\"Uninitialized\"] = 0] = \"Uninitialized\";\n AccountType[AccountType[\"Mint\"] = 1] = \"Mint\";\n AccountType[AccountType[\"Account\"] = 2] = \"Account\";\n})(AccountType || (AccountType = {}));\nexport const ACCOUNT_TYPE_SIZE = 1;\n//# sourceMappingURL=accountType.js.map","import { struct, u32, u8 } from '@solana/buffer-layout';\nimport { publicKey, u64 } from '@solana/buffer-layout-utils';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenAccountNotFoundError, TokenInvalidAccountError, TokenInvalidAccountOwnerError, TokenInvalidAccountSizeError, } from '../errors.js';\nimport { ACCOUNT_TYPE_SIZE, AccountType } from '../extensions/accountType.js';\nimport { getAccountLen } from '../extensions/extensionType.js';\nimport { MULTISIG_SIZE } from './multisig.js';\n/** Token account state as stored by the program */\nexport var AccountState;\n(function (AccountState) {\n AccountState[AccountState[\"Uninitialized\"] = 0] = \"Uninitialized\";\n AccountState[AccountState[\"Initialized\"] = 1] = \"Initialized\";\n AccountState[AccountState[\"Frozen\"] = 2] = \"Frozen\";\n})(AccountState || (AccountState = {}));\n/** Buffer layout for de/serializing a token account */\nexport const AccountLayout = struct([\n publicKey('mint'),\n publicKey('owner'),\n u64('amount'),\n u32('delegateOption'),\n publicKey('delegate'),\n u8('state'),\n u32('isNativeOption'),\n u64('isNative'),\n u64('delegatedAmount'),\n u32('closeAuthorityOption'),\n publicKey('closeAuthority'),\n]);\n/** Byte length of a token account */\nexport const ACCOUNT_SIZE = AccountLayout.span;\n/**\n * Retrieve information about a token account\n *\n * @param connection Connection to use\n * @param address Token account\n * @param commitment Desired level of commitment for querying the state\n * @param programId SPL Token program account\n *\n * @return Token account information\n */\nexport async function getAccount(connection, address, commitment, programId = TOKEN_PROGRAM_ID) {\n const info = await connection.getAccountInfo(address, commitment);\n return unpackAccount(address, info, programId);\n}\n/**\n * Retrieve information about multiple token accounts in a single RPC call\n *\n * @param connection Connection to use\n * @param addresses Token accounts\n * @param commitment Desired level of commitment for querying the state\n * @param programId SPL Token program account\n *\n * @return Token account information\n */\nexport async function getMultipleAccounts(connection, addresses, commitment, programId = TOKEN_PROGRAM_ID) {\n const infos = await connection.getMultipleAccountsInfo(addresses, commitment);\n return addresses.map((address, i) => unpackAccount(address, infos[i], programId));\n}\n/** Get the minimum lamport balance for a base token account to be rent exempt\n *\n * @param connection Connection to use\n * @param commitment Desired level of commitment for querying the state\n *\n * @return Amount of lamports required\n */\nexport async function getMinimumBalanceForRentExemptAccount(connection, commitment) {\n return await getMinimumBalanceForRentExemptAccountWithExtensions(connection, [], commitment);\n}\n/** Get the minimum lamport balance for a rent-exempt token account with extensions\n *\n * @param connection Connection to use\n * @param commitment Desired level of commitment for querying the state\n *\n * @return Amount of lamports required\n */\nexport async function getMinimumBalanceForRentExemptAccountWithExtensions(connection, extensions, commitment) {\n const accountLen = getAccountLen(extensions);\n return await connection.getMinimumBalanceForRentExemption(accountLen, commitment);\n}\n/**\n * Unpack a token account\n *\n * @param address Token account\n * @param info Token account data\n * @param programId SPL Token program account\n *\n * @return Unpacked token account\n */\nexport function unpackAccount(address, info, programId = TOKEN_PROGRAM_ID) {\n if (!info)\n throw new TokenAccountNotFoundError();\n if (!info.owner.equals(programId))\n throw new TokenInvalidAccountOwnerError();\n if (info.data.length < ACCOUNT_SIZE)\n throw new TokenInvalidAccountSizeError();\n const rawAccount = AccountLayout.decode(info.data.slice(0, ACCOUNT_SIZE));\n let tlvData = Buffer.alloc(0);\n if (info.data.length > ACCOUNT_SIZE) {\n if (info.data.length === MULTISIG_SIZE)\n throw new TokenInvalidAccountSizeError();\n if (info.data[ACCOUNT_SIZE] != AccountType.Account)\n throw new TokenInvalidAccountError();\n tlvData = info.data.slice(ACCOUNT_SIZE + ACCOUNT_TYPE_SIZE);\n }\n return {\n address,\n mint: rawAccount.mint,\n owner: rawAccount.owner,\n amount: rawAccount.amount,\n delegate: rawAccount.delegateOption ? rawAccount.delegate : null,\n delegatedAmount: rawAccount.delegatedAmount,\n isInitialized: rawAccount.state !== AccountState.Uninitialized,\n isFrozen: rawAccount.state === AccountState.Frozen,\n isNative: !!rawAccount.isNativeOption,\n rentExemptReserve: rawAccount.isNativeOption ? rawAccount.isNative : null,\n closeAuthority: rawAccount.closeAuthorityOption ? rawAccount.closeAuthority : null,\n tlvData,\n };\n}\n//# sourceMappingURL=account.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { bool, publicKey } from '@solana/buffer-layout-utils';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenAccountNotFoundError, TokenInvalidAccountOwnerError, TokenInvalidAccountSizeError } from '../errors.js';\n/** Buffer layout for de/serializing a multisig */\nexport const MultisigLayout = struct([\n u8('m'),\n u8('n'),\n bool('isInitialized'),\n publicKey('signer1'),\n publicKey('signer2'),\n publicKey('signer3'),\n publicKey('signer4'),\n publicKey('signer5'),\n publicKey('signer6'),\n publicKey('signer7'),\n publicKey('signer8'),\n publicKey('signer9'),\n publicKey('signer10'),\n publicKey('signer11'),\n]);\n/** Byte length of a multisig */\nexport const MULTISIG_SIZE = MultisigLayout.span;\n/**\n * Retrieve information about a multisig\n *\n * @param connection Connection to use\n * @param address Multisig account\n * @param commitment Desired level of commitment for querying the state\n * @param programId SPL Token program account\n *\n * @return Multisig information\n */\nexport async function getMultisig(connection, address, commitment, programId = TOKEN_PROGRAM_ID) {\n const info = await connection.getAccountInfo(address, commitment);\n return unpackMultisig(address, info, programId);\n}\n/**\n * Unpack a multisig\n *\n * @param address Multisig account\n * @param info Multisig account data\n * @param programId SPL Token program account\n *\n * @return Unpacked multisig\n */\nexport function unpackMultisig(address, info, programId = TOKEN_PROGRAM_ID) {\n if (!info)\n throw new TokenAccountNotFoundError();\n if (!info.owner.equals(programId))\n throw new TokenInvalidAccountOwnerError();\n if (info.data.length != MULTISIG_SIZE)\n throw new TokenInvalidAccountSizeError();\n const multisig = MultisigLayout.decode(info.data);\n return { address, ...multisig };\n}\n/** Get the minimum lamport balance for a multisig to be rent exempt\n *\n * @param connection Connection to use\n * @param commitment Desired level of commitment for querying the state\n *\n * @return Amount of lamports required\n */\nexport async function getMinimumBalanceForRentExemptMultisig(connection, commitment) {\n return await connection.getMinimumBalanceForRentExemption(MULTISIG_SIZE, commitment);\n}\n//# sourceMappingURL=multisig.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { programSupportsExtensions, TOKEN_2022_PROGRAM_ID } from '../../constants.js';\nimport { TokenUnsupportedInstructionError } from '../../errors.js';\nimport { addSigners } from '../../instructions/internal.js';\nimport { TokenInstruction } from '../../instructions/types.js';\nexport var CpiGuardInstruction;\n(function (CpiGuardInstruction) {\n CpiGuardInstruction[CpiGuardInstruction[\"Enable\"] = 0] = \"Enable\";\n CpiGuardInstruction[CpiGuardInstruction[\"Disable\"] = 1] = \"Disable\";\n})(CpiGuardInstruction || (CpiGuardInstruction = {}));\n/** TODO: docs */\nexport const cpiGuardInstructionData = struct([u8('instruction'), u8('cpiGuardInstruction')]);\n/**\n * Construct an EnableCpiGuard instruction\n *\n * @param account Token account to update\n * @param authority The account's owner/delegate\n * @param signers The signer account(s)\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createEnableCpiGuardInstruction(account, authority, multiSigners = [], programId = TOKEN_2022_PROGRAM_ID) {\n return createCpiGuardInstruction(CpiGuardInstruction.Enable, account, authority, multiSigners, programId);\n}\n/**\n * Construct a DisableCpiGuard instruction\n *\n * @param account Token account to update\n * @param authority The account's owner/delegate\n * @param signers The signer account(s)\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createDisableCpiGuardInstruction(account, authority, multiSigners = [], programId = TOKEN_2022_PROGRAM_ID) {\n return createCpiGuardInstruction(CpiGuardInstruction.Disable, account, authority, multiSigners, programId);\n}\nfunction createCpiGuardInstruction(cpiGuardInstruction, account, authority, multiSigners, programId) {\n if (!programSupportsExtensions(programId)) {\n throw new TokenUnsupportedInstructionError();\n }\n const keys = addSigners([{ pubkey: account, isSigner: false, isWritable: true }], authority, multiSigners);\n const data = Buffer.alloc(cpiGuardInstructionData.span);\n cpiGuardInstructionData.encode({\n instruction: TokenInstruction.CpiGuardExtension,\n cpiGuardInstruction,\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n//# sourceMappingURL=instructions.js.map","import { struct, u32, u8 } from '@solana/buffer-layout';\nimport { bool, publicKey, u64 } from '@solana/buffer-layout-utils';\nimport { PublicKey } from '@solana/web3.js';\nimport { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenAccountNotFoundError, TokenInvalidAccountOwnerError, TokenInvalidAccountSizeError, TokenInvalidMintError, TokenOwnerOffCurveError, } from '../errors.js';\nimport { ACCOUNT_TYPE_SIZE, AccountType } from '../extensions/accountType.js';\nimport { getMintLen } from '../extensions/extensionType.js';\nimport { ACCOUNT_SIZE } from './account.js';\nimport { MULTISIG_SIZE } from './multisig.js';\n/** Buffer layout for de/serializing a mint */\nexport const MintLayout = struct([\n u32('mintAuthorityOption'),\n publicKey('mintAuthority'),\n u64('supply'),\n u8('decimals'),\n bool('isInitialized'),\n u32('freezeAuthorityOption'),\n publicKey('freezeAuthority'),\n]);\n/** Byte length of a mint */\nexport const MINT_SIZE = MintLayout.span;\n/**\n * Retrieve information about a mint\n *\n * @param connection Connection to use\n * @param address Mint account\n * @param commitment Desired level of commitment for querying the state\n * @param programId SPL Token program account\n *\n * @return Mint information\n */\nexport async function getMint(connection, address, commitment, programId = TOKEN_PROGRAM_ID) {\n const info = await connection.getAccountInfo(address, commitment);\n return unpackMint(address, info, programId);\n}\n/**\n * Unpack a mint\n *\n * @param address Mint account\n * @param info Mint account data\n * @param programId SPL Token program account\n *\n * @return Unpacked mint\n */\nexport function unpackMint(address, info, programId = TOKEN_PROGRAM_ID) {\n if (!info)\n throw new TokenAccountNotFoundError();\n if (!info.owner.equals(programId))\n throw new TokenInvalidAccountOwnerError();\n if (info.data.length < MINT_SIZE)\n throw new TokenInvalidAccountSizeError();\n const rawMint = MintLayout.decode(info.data.slice(0, MINT_SIZE));\n let tlvData = Buffer.alloc(0);\n if (info.data.length > MINT_SIZE) {\n if (info.data.length <= ACCOUNT_SIZE)\n throw new TokenInvalidAccountSizeError();\n if (info.data.length === MULTISIG_SIZE)\n throw new TokenInvalidAccountSizeError();\n if (info.data[ACCOUNT_SIZE] != AccountType.Mint)\n throw new TokenInvalidMintError();\n tlvData = info.data.slice(ACCOUNT_SIZE + ACCOUNT_TYPE_SIZE);\n }\n return {\n address,\n mintAuthority: rawMint.mintAuthorityOption ? rawMint.mintAuthority : null,\n supply: rawMint.supply,\n decimals: rawMint.decimals,\n isInitialized: rawMint.isInitialized,\n freezeAuthority: rawMint.freezeAuthorityOption ? rawMint.freezeAuthority : null,\n tlvData,\n };\n}\n/** Get the minimum lamport balance for a mint to be rent exempt\n *\n * @param connection Connection to use\n * @param commitment Desired level of commitment for querying the state\n *\n * @return Amount of lamports required\n */\nexport async function getMinimumBalanceForRentExemptMint(connection, commitment) {\n return await getMinimumBalanceForRentExemptMintWithExtensions(connection, [], commitment);\n}\n/** Get the minimum lamport balance for a rent-exempt mint with extensions\n *\n * @param connection Connection to use\n * @param extensions Extension types included in the mint\n * @param commitment Desired level of commitment for querying the state\n *\n * @return Amount of lamports required\n */\nexport async function getMinimumBalanceForRentExemptMintWithExtensions(connection, extensions, commitment) {\n const mintLen = getMintLen(extensions);\n return await connection.getMinimumBalanceForRentExemption(mintLen, commitment);\n}\n/**\n * Async version of getAssociatedTokenAddressSync\n * For backwards compatibility\n *\n * @param mint Token mint account\n * @param owner Owner of the new account\n * @param allowOwnerOffCurve Allow the owner account to be a PDA (Program Derived Address)\n * @param programId SPL Token program account\n * @param associatedTokenProgramId SPL Associated Token program account\n *\n * @return Promise containing the address of the associated token account\n */\nexport async function getAssociatedTokenAddress(mint, owner, allowOwnerOffCurve = false, programId = TOKEN_PROGRAM_ID, associatedTokenProgramId = ASSOCIATED_TOKEN_PROGRAM_ID) {\n if (!allowOwnerOffCurve && !PublicKey.isOnCurve(owner.toBuffer()))\n throw new TokenOwnerOffCurveError();\n const [address] = await PublicKey.findProgramAddress([owner.toBuffer(), programId.toBuffer(), mint.toBuffer()], associatedTokenProgramId);\n return address;\n}\n/**\n * Get the address of the associated token account for a given mint and owner\n *\n * @param mint Token mint account\n * @param owner Owner of the new account\n * @param allowOwnerOffCurve Allow the owner account to be a PDA (Program Derived Address)\n * @param programId SPL Token program account\n * @param associatedTokenProgramId SPL Associated Token program account\n *\n * @return Address of the associated token account\n */\nexport function getAssociatedTokenAddressSync(mint, owner, allowOwnerOffCurve = false, programId = TOKEN_PROGRAM_ID, associatedTokenProgramId = ASSOCIATED_TOKEN_PROGRAM_ID) {\n if (!allowOwnerOffCurve && !PublicKey.isOnCurve(owner.toBuffer()))\n throw new TokenOwnerOffCurveError();\n const [address] = PublicKey.findProgramAddressSync([owner.toBuffer(), programId.toBuffer(), mint.toBuffer()], associatedTokenProgramId);\n return address;\n}\n//# sourceMappingURL=mint.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { programSupportsExtensions, TOKEN_2022_PROGRAM_ID } from '../../constants.js';\nimport { TokenUnsupportedInstructionError } from '../../errors.js';\nimport { addSigners } from '../../instructions/internal.js';\nimport { TokenInstruction } from '../../instructions/types.js';\nexport var DefaultAccountStateInstruction;\n(function (DefaultAccountStateInstruction) {\n DefaultAccountStateInstruction[DefaultAccountStateInstruction[\"Initialize\"] = 0] = \"Initialize\";\n DefaultAccountStateInstruction[DefaultAccountStateInstruction[\"Update\"] = 1] = \"Update\";\n})(DefaultAccountStateInstruction || (DefaultAccountStateInstruction = {}));\n/** TODO: docs */\nexport const defaultAccountStateInstructionData = struct([\n u8('instruction'),\n u8('defaultAccountStateInstruction'),\n u8('accountState'),\n]);\n/**\n * Construct an InitializeDefaultAccountState instruction\n *\n * @param mint Mint to initialize\n * @param accountState Default account state to set on all new accounts\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createInitializeDefaultAccountStateInstruction(mint, accountState, programId = TOKEN_2022_PROGRAM_ID) {\n if (!programSupportsExtensions(programId)) {\n throw new TokenUnsupportedInstructionError();\n }\n const keys = [{ pubkey: mint, isSigner: false, isWritable: true }];\n const data = Buffer.alloc(defaultAccountStateInstructionData.span);\n defaultAccountStateInstructionData.encode({\n instruction: TokenInstruction.DefaultAccountStateExtension,\n defaultAccountStateInstruction: DefaultAccountStateInstruction.Initialize,\n accountState,\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Construct an UpdateDefaultAccountState instruction\n *\n * @param mint Mint to update\n * @param accountState Default account state to set on all accounts\n * @param freezeAuthority The mint's freeze authority\n * @param signers The signer account(s) for a multisig\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createUpdateDefaultAccountStateInstruction(mint, accountState, freezeAuthority, multiSigners = [], programId = TOKEN_2022_PROGRAM_ID) {\n if (!programSupportsExtensions(programId)) {\n throw new TokenUnsupportedInstructionError();\n }\n const keys = addSigners([{ pubkey: mint, isSigner: false, isWritable: true }], freezeAuthority, multiSigners);\n const data = Buffer.alloc(defaultAccountStateInstructionData.span);\n defaultAccountStateInstructionData.encode({\n instruction: TokenInstruction.DefaultAccountStateExtension,\n defaultAccountStateInstruction: DefaultAccountStateInstruction.Update,\n accountState,\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n//# sourceMappingURL=instructions.js.map","import { struct } from '@solana/buffer-layout';\nimport { bool } from '@solana/buffer-layout-utils';\nimport { ExtensionType, getExtensionData } from '../extensionType.js';\n/** Buffer layout for de/serializing a CPI Guard extension */\nexport const CpiGuardLayout = struct([bool('lockCpi')]);\nexport const CPI_GUARD_SIZE = CpiGuardLayout.span;\nexport function getCpiGuard(account) {\n const extensionData = getExtensionData(ExtensionType.CpiGuard, account.tlvData);\n if (extensionData !== null) {\n return CpiGuardLayout.decode(extensionData);\n }\n else {\n return null;\n }\n}\n//# sourceMappingURL=state.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { ExtensionType, getExtensionData } from '../extensionType.js';\n/** Buffer layout for de/serializing a transfer fee config extension */\nexport const DefaultAccountStateLayout = struct([u8('state')]);\nexport const DEFAULT_ACCOUNT_STATE_SIZE = DefaultAccountStateLayout.span;\nexport function getDefaultAccountState(mint) {\n const extensionData = getExtensionData(ExtensionType.DefaultAccountState, mint.tlvData);\n if (extensionData !== null) {\n return DefaultAccountStateLayout.decode(extensionData);\n }\n else {\n return null;\n }\n}\n//# sourceMappingURL=state.js.map","import { struct } from '@solana/buffer-layout';\nimport { ExtensionType, getExtensionData } from './extensionType.js';\n/** Buffer layout for de/serializing an account */\nexport const ImmutableOwnerLayout = struct([]);\nexport const IMMUTABLE_OWNER_SIZE = ImmutableOwnerLayout.span;\nexport function getImmutableOwner(account) {\n const extensionData = getExtensionData(ExtensionType.ImmutableOwner, account.tlvData);\n if (extensionData !== null) {\n return ImmutableOwnerLayout.decode(extensionData);\n }\n else {\n return null;\n }\n}\n//# sourceMappingURL=immutableOwner.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { programSupportsExtensions, TOKEN_2022_PROGRAM_ID } from '../../constants.js';\nimport { TokenUnsupportedInstructionError } from '../../errors.js';\nimport { addSigners } from '../../instructions/internal.js';\nimport { TokenInstruction } from '../../instructions/types.js';\nexport var MemoTransferInstruction;\n(function (MemoTransferInstruction) {\n MemoTransferInstruction[MemoTransferInstruction[\"Enable\"] = 0] = \"Enable\";\n MemoTransferInstruction[MemoTransferInstruction[\"Disable\"] = 1] = \"Disable\";\n})(MemoTransferInstruction || (MemoTransferInstruction = {}));\n/** TODO: docs */\nexport const memoTransferInstructionData = struct([\n u8('instruction'),\n u8('memoTransferInstruction'),\n]);\n/**\n * Construct an EnableRequiredMemoTransfers instruction\n *\n * @param account Token account to update\n * @param authority The account's owner/delegate\n * @param signers The signer account(s)\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createEnableRequiredMemoTransfersInstruction(account, authority, multiSigners = [], programId = TOKEN_2022_PROGRAM_ID) {\n return createMemoTransferInstruction(MemoTransferInstruction.Enable, account, authority, multiSigners, programId);\n}\n/**\n * Construct a DisableMemoTransfer instruction\n *\n * @param account Token account to update\n * @param authority The account's owner/delegate\n * @param signers The signer account(s)\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createDisableRequiredMemoTransfersInstruction(account, authority, multiSigners = [], programId = TOKEN_2022_PROGRAM_ID) {\n return createMemoTransferInstruction(MemoTransferInstruction.Disable, account, authority, multiSigners, programId);\n}\nfunction createMemoTransferInstruction(memoTransferInstruction, account, authority, multiSigners, programId) {\n if (!programSupportsExtensions(programId)) {\n throw new TokenUnsupportedInstructionError();\n }\n const keys = addSigners([{ pubkey: account, isSigner: false, isWritable: true }], authority, multiSigners);\n const data = Buffer.alloc(memoTransferInstructionData.span);\n memoTransferInstructionData.encode({\n instruction: TokenInstruction.MemoTransferExtension,\n memoTransferInstruction,\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n//# sourceMappingURL=instructions.js.map","import { ns64, s16, struct } from '@solana/buffer-layout';\nimport { publicKey } from '@solana/buffer-layout-utils';\nimport { ExtensionType, getExtensionData } from '../extensionType.js';\nexport const InterestBearingMintConfigStateLayout = struct([\n publicKey('rateAuthority'),\n ns64('initializationTimestamp'),\n s16('preUpdateAverageRate'),\n ns64('lastUpdateTimestamp'),\n s16('currentRate'),\n]);\nexport const INTEREST_BEARING_MINT_CONFIG_STATE_SIZE = InterestBearingMintConfigStateLayout.span;\nexport function getInterestBearingMintConfigState(mint) {\n const extensionData = getExtensionData(ExtensionType.InterestBearingConfig, mint.tlvData);\n if (extensionData !== null) {\n return InterestBearingMintConfigStateLayout.decode(extensionData);\n }\n return null;\n}\n//# sourceMappingURL=state.js.map","import { struct } from '@solana/buffer-layout';\nimport { bool } from '@solana/buffer-layout-utils';\nimport { ExtensionType, getExtensionData } from '../extensionType.js';\n/** Buffer layout for de/serializing a memo transfer extension */\nexport const MemoTransferLayout = struct([bool('requireIncomingTransferMemos')]);\nexport const MEMO_TRANSFER_SIZE = MemoTransferLayout.span;\nexport function getMemoTransfer(account) {\n const extensionData = getExtensionData(ExtensionType.MemoTransfer, account.tlvData);\n if (extensionData !== null) {\n return MemoTransferLayout.decode(extensionData);\n }\n else {\n return null;\n }\n}\n//# sourceMappingURL=state.js.map","import { struct } from '@solana/buffer-layout';\nimport { publicKey } from '@solana/buffer-layout-utils';\nimport { ExtensionType, getExtensionData } from './extensionType.js';\n/** Buffer layout for de/serializing a mint */\nexport const MintCloseAuthorityLayout = struct([publicKey('closeAuthority')]);\nexport const MINT_CLOSE_AUTHORITY_SIZE = MintCloseAuthorityLayout.span;\nexport function getMintCloseAuthority(mint) {\n const extensionData = getExtensionData(ExtensionType.MintCloseAuthority, mint.tlvData);\n if (extensionData !== null) {\n return MintCloseAuthorityLayout.decode(extensionData);\n }\n else {\n return null;\n }\n}\n//# sourceMappingURL=mintCloseAuthority.js.map","import { struct } from '@solana/buffer-layout';\nimport { ExtensionType, getExtensionData } from './extensionType.js';\n/** Buffer layout for de/serializing an account */\nexport const NonTransferableLayout = struct([]);\nexport const NON_TRANSFERABLE_SIZE = NonTransferableLayout.span;\nexport function getNonTransferable(mint) {\n const extensionData = getExtensionData(ExtensionType.NonTransferable, mint.tlvData);\n if (extensionData !== null) {\n return NonTransferableLayout.decode(extensionData);\n }\n else {\n return null;\n }\n}\n//# sourceMappingURL=nonTransferable.js.map","import { struct, u16, u8 } from '@solana/buffer-layout';\nimport { publicKey, u64 } from '@solana/buffer-layout-utils';\nimport { PublicKey, TransactionInstruction } from '@solana/web3.js';\nimport { programSupportsExtensions, TOKEN_2022_PROGRAM_ID } from '../../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, TokenUnsupportedInstructionError, } from '../../errors.js';\nimport { addSigners } from '../../instructions/internal.js';\nimport { TokenInstruction } from '../../instructions/types.js';\nexport var TransferFeeInstruction;\n(function (TransferFeeInstruction) {\n TransferFeeInstruction[TransferFeeInstruction[\"InitializeTransferFeeConfig\"] = 0] = \"InitializeTransferFeeConfig\";\n TransferFeeInstruction[TransferFeeInstruction[\"TransferCheckedWithFee\"] = 1] = \"TransferCheckedWithFee\";\n TransferFeeInstruction[TransferFeeInstruction[\"WithdrawWithheldTokensFromMint\"] = 2] = \"WithdrawWithheldTokensFromMint\";\n TransferFeeInstruction[TransferFeeInstruction[\"WithdrawWithheldTokensFromAccounts\"] = 3] = \"WithdrawWithheldTokensFromAccounts\";\n TransferFeeInstruction[TransferFeeInstruction[\"HarvestWithheldTokensToMint\"] = 4] = \"HarvestWithheldTokensToMint\";\n TransferFeeInstruction[TransferFeeInstruction[\"SetTransferFee\"] = 5] = \"SetTransferFee\";\n})(TransferFeeInstruction || (TransferFeeInstruction = {}));\n/** TODO: docs */\nexport const initializeTransferFeeConfigInstructionData = struct([\n u8('instruction'),\n u8('transferFeeInstruction'),\n u8('transferFeeConfigAuthorityOption'),\n publicKey('transferFeeConfigAuthority'),\n u8('withdrawWithheldAuthorityOption'),\n publicKey('withdrawWithheldAuthority'),\n u16('transferFeeBasisPoints'),\n u64('maximumFee'),\n]);\n/**\n * Construct an InitializeTransferFeeConfig instruction\n *\n * @param mint Token mint account\n * @param transferFeeConfigAuthority Optional authority that can update the fees\n * @param withdrawWithheldAuthority Optional authority that can withdraw fees\n * @param transferFeeBasisPoints Amount of transfer collected as fees, expressed as basis points of the transfer amount\n * @param maximumFee Maximum fee assessed on transfers\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createInitializeTransferFeeConfigInstruction(mint, transferFeeConfigAuthority, withdrawWithheldAuthority, transferFeeBasisPoints, maximumFee, programId = TOKEN_2022_PROGRAM_ID) {\n if (!programSupportsExtensions(programId)) {\n throw new TokenUnsupportedInstructionError();\n }\n const keys = [{ pubkey: mint, isSigner: false, isWritable: true }];\n const data = Buffer.alloc(initializeTransferFeeConfigInstructionData.span);\n initializeTransferFeeConfigInstructionData.encode({\n instruction: TokenInstruction.TransferFeeExtension,\n transferFeeInstruction: TransferFeeInstruction.InitializeTransferFeeConfig,\n transferFeeConfigAuthorityOption: transferFeeConfigAuthority ? 1 : 0,\n transferFeeConfigAuthority: transferFeeConfigAuthority || new PublicKey(0),\n withdrawWithheldAuthorityOption: withdrawWithheldAuthority ? 1 : 0,\n withdrawWithheldAuthority: withdrawWithheldAuthority || new PublicKey(0),\n transferFeeBasisPoints: transferFeeBasisPoints,\n maximumFee: maximumFee,\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode an InitializeTransferFeeConfig instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeInitializeTransferFeeConfigInstruction(instruction, programId) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== initializeTransferFeeConfigInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { mint }, data, } = decodeInitializeTransferFeeConfigInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.TransferFeeExtension ||\n data.transferFeeInstruction !== TransferFeeInstruction.InitializeTransferFeeConfig)\n throw new TokenInvalidInstructionTypeError();\n if (!mint)\n throw new TokenInvalidInstructionKeysError();\n return {\n programId,\n keys: {\n mint,\n },\n data,\n };\n}\n/**\n * Decode an InitializeTransferFeeConfig instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeInitializeTransferFeeConfigInstructionUnchecked({ programId, keys: [mint], data, }) {\n const { instruction, transferFeeInstruction, transferFeeConfigAuthorityOption, transferFeeConfigAuthority, withdrawWithheldAuthorityOption, withdrawWithheldAuthority, transferFeeBasisPoints, maximumFee, } = initializeTransferFeeConfigInstructionData.decode(data);\n return {\n programId,\n keys: {\n mint,\n },\n data: {\n instruction,\n transferFeeInstruction,\n transferFeeConfigAuthority: transferFeeConfigAuthorityOption ? transferFeeConfigAuthority : null,\n withdrawWithheldAuthority: withdrawWithheldAuthorityOption ? withdrawWithheldAuthority : null,\n transferFeeBasisPoints,\n maximumFee,\n },\n };\n}\nexport const transferCheckedWithFeeInstructionData = struct([\n u8('instruction'),\n u8('transferFeeInstruction'),\n u64('amount'),\n u8('decimals'),\n u64('fee'),\n]);\n/**\n * Construct an TransferCheckedWithFee instruction\n *\n * @param source The source account\n * @param mint The token mint\n * @param destination The destination account\n * @param authority The source account's owner/delegate\n * @param signers The signer account(s)\n * @param amount The amount of tokens to transfer\n * @param decimals The expected number of base 10 digits to the right of the decimal place\n * @param fee The expected fee assesed on this transfer, calculated off-chain based on the transferFeeBasisPoints and maximumFee of the mint.\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createTransferCheckedWithFeeInstruction(source, mint, destination, authority, amount, decimals, fee, multiSigners = [], programId = TOKEN_2022_PROGRAM_ID) {\n if (!programSupportsExtensions(programId)) {\n throw new TokenUnsupportedInstructionError();\n }\n const data = Buffer.alloc(transferCheckedWithFeeInstructionData.span);\n transferCheckedWithFeeInstructionData.encode({\n instruction: TokenInstruction.TransferFeeExtension,\n transferFeeInstruction: TransferFeeInstruction.TransferCheckedWithFee,\n amount,\n decimals,\n fee,\n }, data);\n const keys = addSigners([\n { pubkey: source, isSigner: false, isWritable: true },\n { pubkey: mint, isSigner: false, isWritable: false },\n { pubkey: destination, isSigner: false, isWritable: true },\n ], authority, multiSigners);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode a TransferCheckedWithFee instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeTransferCheckedWithFeeInstruction(instruction, programId) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== transferCheckedWithFeeInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { source, mint, destination, authority, signers }, data, } = decodeTransferCheckedWithFeeInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.TransferFeeExtension ||\n data.transferFeeInstruction !== TransferFeeInstruction.TransferCheckedWithFee)\n throw new TokenInvalidInstructionTypeError();\n if (!mint)\n throw new TokenInvalidInstructionKeysError();\n return {\n programId,\n keys: {\n source,\n mint,\n destination,\n authority,\n signers: signers ? signers : null,\n },\n data,\n };\n}\n/**\n * Decode a TransferCheckedWithFees instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeTransferCheckedWithFeeInstructionUnchecked({ programId, keys: [source, mint, destination, authority, ...signers], data, }) {\n const { instruction, transferFeeInstruction, amount, decimals, fee } = transferCheckedWithFeeInstructionData.decode(data);\n return {\n programId,\n keys: {\n source,\n mint,\n destination,\n authority,\n signers,\n },\n data: {\n instruction,\n transferFeeInstruction,\n amount,\n decimals,\n fee,\n },\n };\n}\nexport const withdrawWithheldTokensFromMintInstructionData = struct([\n u8('instruction'),\n u8('transferFeeInstruction'),\n]);\n/**\n * Construct a WithdrawWithheldTokensFromMint instruction\n *\n * @param mint The token mint\n * @param destination The destination account\n * @param authority The source account's owner/delegate\n * @param signers The signer account(s)\n * @param programID SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createWithdrawWithheldTokensFromMintInstruction(mint, destination, authority, signers = [], programId = TOKEN_2022_PROGRAM_ID) {\n if (!programSupportsExtensions(programId)) {\n throw new TokenUnsupportedInstructionError();\n }\n const data = Buffer.alloc(withdrawWithheldTokensFromMintInstructionData.span);\n withdrawWithheldTokensFromMintInstructionData.encode({\n instruction: TokenInstruction.TransferFeeExtension,\n transferFeeInstruction: TransferFeeInstruction.WithdrawWithheldTokensFromMint,\n }, data);\n const keys = addSigners([\n { pubkey: mint, isSigner: false, isWritable: true },\n { pubkey: destination, isSigner: false, isWritable: true },\n ], authority, signers);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode a WithdrawWithheldTokensFromMint instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeWithdrawWithheldTokensFromMintInstruction(instruction, programId) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== withdrawWithheldTokensFromMintInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { mint, destination, authority, signers }, data, } = decodeWithdrawWithheldTokensFromMintInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.TransferFeeExtension ||\n data.transferFeeInstruction !== TransferFeeInstruction.WithdrawWithheldTokensFromMint)\n throw new TokenInvalidInstructionTypeError();\n if (!mint)\n throw new TokenInvalidInstructionKeysError();\n return {\n programId,\n keys: {\n mint,\n destination,\n authority,\n signers: signers ? signers : null,\n },\n data,\n };\n}\n/**\n * Decode a WithdrawWithheldTokensFromMint instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeWithdrawWithheldTokensFromMintInstructionUnchecked({ programId, keys: [mint, destination, authority, ...signers], data, }) {\n const { instruction, transferFeeInstruction } = withdrawWithheldTokensFromMintInstructionData.decode(data);\n return {\n programId,\n keys: {\n mint,\n destination,\n authority,\n signers,\n },\n data: {\n instruction,\n transferFeeInstruction,\n },\n };\n}\nexport const withdrawWithheldTokensFromAccountsInstructionData = struct([\n u8('instruction'),\n u8('transferFeeInstruction'),\n u8('numTokenAccounts'),\n]);\n/**\n * Construct a WithdrawWithheldTokensFromAccounts instruction\n *\n * @param mint The token mint\n * @param destination The destination account\n * @param authority The source account's owner/delegate\n * @param signers The signer account(s)\n * @param sources The source accounts to withdraw from\n * @param programID SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createWithdrawWithheldTokensFromAccountsInstruction(mint, destination, authority, signers, sources, programId = TOKEN_2022_PROGRAM_ID) {\n if (!programSupportsExtensions(programId)) {\n throw new TokenUnsupportedInstructionError();\n }\n const data = Buffer.alloc(withdrawWithheldTokensFromAccountsInstructionData.span);\n withdrawWithheldTokensFromAccountsInstructionData.encode({\n instruction: TokenInstruction.TransferFeeExtension,\n transferFeeInstruction: TransferFeeInstruction.WithdrawWithheldTokensFromAccounts,\n numTokenAccounts: sources.length,\n }, data);\n const keys = addSigners([\n { pubkey: mint, isSigner: false, isWritable: true },\n { pubkey: destination, isSigner: false, isWritable: true },\n ], authority, signers);\n for (const source of sources) {\n keys.push({ pubkey: source, isSigner: false, isWritable: true });\n }\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode a WithdrawWithheldTokensFromAccounts instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeWithdrawWithheldTokensFromAccountsInstruction(instruction, programId) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== withdrawWithheldTokensFromAccountsInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { mint, destination, authority, signers, sources }, data, } = decodeWithdrawWithheldTokensFromAccountsInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.TransferFeeExtension ||\n data.transferFeeInstruction !== TransferFeeInstruction.WithdrawWithheldTokensFromAccounts)\n throw new TokenInvalidInstructionTypeError();\n if (!mint)\n throw new TokenInvalidInstructionKeysError();\n return {\n programId,\n keys: {\n mint,\n destination,\n authority,\n signers: signers ? signers : null,\n sources: sources ? sources : null,\n },\n data,\n };\n}\n/**\n * Decode a WithdrawWithheldTokensFromAccount instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeWithdrawWithheldTokensFromAccountsInstructionUnchecked({ programId, keys, data, }) {\n const { instruction, transferFeeInstruction, numTokenAccounts } = withdrawWithheldTokensFromAccountsInstructionData.decode(data);\n const [mint, destination, authority, signers, sources] = [\n keys[0],\n keys[1],\n keys[2],\n keys.slice(3, 3 + numTokenAccounts),\n keys.slice(-1 * numTokenAccounts),\n ];\n return {\n programId,\n keys: {\n mint,\n destination,\n authority,\n signers,\n sources,\n },\n data: {\n instruction,\n transferFeeInstruction,\n numTokenAccounts,\n },\n };\n}\nexport const harvestWithheldTokensToMintInstructionData = struct([\n u8('instruction'),\n u8('transferFeeInstruction'),\n]);\n/**\n * Construct a HarvestWithheldTokensToMint instruction\n *\n * @param mint The token mint\n * @param sources The source accounts to withdraw from\n * @param programID SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createHarvestWithheldTokensToMintInstruction(mint, sources, programId = TOKEN_2022_PROGRAM_ID) {\n if (!programSupportsExtensions(programId)) {\n throw new TokenUnsupportedInstructionError();\n }\n const data = Buffer.alloc(harvestWithheldTokensToMintInstructionData.span);\n harvestWithheldTokensToMintInstructionData.encode({\n instruction: TokenInstruction.TransferFeeExtension,\n transferFeeInstruction: TransferFeeInstruction.HarvestWithheldTokensToMint,\n }, data);\n const keys = [];\n keys.push({ pubkey: mint, isSigner: false, isWritable: true });\n for (const source of sources) {\n keys.push({ pubkey: source, isSigner: false, isWritable: true });\n }\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode a HarvestWithheldTokensToMint instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeHarvestWithheldTokensToMintInstruction(instruction, programId) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== harvestWithheldTokensToMintInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { mint, sources }, data, } = decodeHarvestWithheldTokensToMintInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.TransferFeeExtension ||\n data.transferFeeInstruction !== TransferFeeInstruction.HarvestWithheldTokensToMint)\n throw new TokenInvalidInstructionTypeError();\n if (!mint)\n throw new TokenInvalidInstructionKeysError();\n return {\n programId,\n keys: {\n mint,\n sources,\n },\n data,\n };\n}\n/**\n * Decode a HarvestWithheldTokensToMint instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeHarvestWithheldTokensToMintInstructionUnchecked({ programId, keys: [mint, ...sources], data, }) {\n const { instruction, transferFeeInstruction } = harvestWithheldTokensToMintInstructionData.decode(data);\n return {\n programId,\n keys: {\n mint,\n sources,\n },\n data: {\n instruction,\n transferFeeInstruction,\n },\n };\n}\n//# sourceMappingURL=instructions.js.map","import { struct, u16 } from '@solana/buffer-layout';\nimport { publicKey, u64 } from '@solana/buffer-layout-utils';\nimport { ExtensionType, getExtensionData } from '../extensionType.js';\nexport const MAX_FEE_BASIS_POINTS = 10000;\nexport const ONE_IN_BASIS_POINTS = MAX_FEE_BASIS_POINTS;\n/** Buffer layout for de/serializing a transfer fee */\nexport function transferFeeLayout(property) {\n return struct([u64('epoch'), u64('maximumFee'), u16('transferFeeBasisPoints')], property);\n}\n/** Buffer layout for de/serializing a transfer fee config extension */\nexport const TransferFeeConfigLayout = struct([\n publicKey('transferFeeConfigAuthority'),\n publicKey('withdrawWithheldAuthority'),\n u64('withheldAmount'),\n transferFeeLayout('olderTransferFee'),\n transferFeeLayout('newerTransferFee'),\n]);\nexport const TRANSFER_FEE_CONFIG_SIZE = TransferFeeConfigLayout.span;\n/** Buffer layout for de/serializing */\nexport const TransferFeeAmountLayout = struct([u64('withheldAmount')]);\nexport const TRANSFER_FEE_AMOUNT_SIZE = TransferFeeAmountLayout.span;\nexport function getTransferFeeConfig(mint) {\n const extensionData = getExtensionData(ExtensionType.TransferFeeConfig, mint.tlvData);\n if (extensionData !== null) {\n return TransferFeeConfigLayout.decode(extensionData);\n }\n else {\n return null;\n }\n}\nexport function getTransferFeeAmount(account) {\n const extensionData = getExtensionData(ExtensionType.TransferFeeAmount, account.tlvData);\n if (extensionData !== null) {\n return TransferFeeAmountLayout.decode(extensionData);\n }\n else {\n return null;\n }\n}\n//# sourceMappingURL=state.js.map","import { struct } from '@solana/buffer-layout';\nimport { publicKey } from '@solana/buffer-layout-utils';\nimport { ExtensionType, getExtensionData } from './extensionType.js';\n/** Buffer layout for de/serializing a mint */\nexport const PermanentDelegateLayout = struct([publicKey('delegate')]);\nexport const PERMANENT_DELEGATE_SIZE = PermanentDelegateLayout.span;\nexport function getPermanentDelegate(mint) {\n const extensionData = getExtensionData(ExtensionType.PermanentDelegate, mint.tlvData);\n if (extensionData !== null) {\n return PermanentDelegateLayout.decode(extensionData);\n }\n else {\n return null;\n }\n}\n//# sourceMappingURL=permanentDelegate.js.map","import { ACCOUNT_SIZE } from '../state/account.js';\nimport { MINT_SIZE } from '../state/mint.js';\nimport { MULTISIG_SIZE } from '../state/multisig.js';\nimport { ACCOUNT_TYPE_SIZE } from './accountType.js';\nimport { CPI_GUARD_SIZE } from './cpiGuard/index.js';\nimport { DEFAULT_ACCOUNT_STATE_SIZE } from './defaultAccountState/index.js';\nimport { IMMUTABLE_OWNER_SIZE } from './immutableOwner.js';\nimport { INTEREST_BEARING_MINT_CONFIG_STATE_SIZE } from './interestBearingMint/state.js';\nimport { MEMO_TRANSFER_SIZE } from './memoTransfer/index.js';\nimport { MINT_CLOSE_AUTHORITY_SIZE } from './mintCloseAuthority.js';\nimport { NON_TRANSFERABLE_SIZE } from './nonTransferable.js';\nimport { PERMANENT_DELEGATE_SIZE } from './permanentDelegate.js';\nimport { TRANSFER_FEE_AMOUNT_SIZE, TRANSFER_FEE_CONFIG_SIZE } from './transferFee/index.js';\nexport var ExtensionType;\n(function (ExtensionType) {\n ExtensionType[ExtensionType[\"Uninitialized\"] = 0] = \"Uninitialized\";\n ExtensionType[ExtensionType[\"TransferFeeConfig\"] = 1] = \"TransferFeeConfig\";\n ExtensionType[ExtensionType[\"TransferFeeAmount\"] = 2] = \"TransferFeeAmount\";\n ExtensionType[ExtensionType[\"MintCloseAuthority\"] = 3] = \"MintCloseAuthority\";\n ExtensionType[ExtensionType[\"ConfidentialTransferMint\"] = 4] = \"ConfidentialTransferMint\";\n ExtensionType[ExtensionType[\"ConfidentialTransferAccount\"] = 5] = \"ConfidentialTransferAccount\";\n ExtensionType[ExtensionType[\"DefaultAccountState\"] = 6] = \"DefaultAccountState\";\n ExtensionType[ExtensionType[\"ImmutableOwner\"] = 7] = \"ImmutableOwner\";\n ExtensionType[ExtensionType[\"MemoTransfer\"] = 8] = \"MemoTransfer\";\n ExtensionType[ExtensionType[\"NonTransferable\"] = 9] = \"NonTransferable\";\n ExtensionType[ExtensionType[\"InterestBearingConfig\"] = 10] = \"InterestBearingConfig\";\n ExtensionType[ExtensionType[\"CpiGuard\"] = 11] = \"CpiGuard\";\n ExtensionType[ExtensionType[\"PermanentDelegate\"] = 12] = \"PermanentDelegate\";\n})(ExtensionType || (ExtensionType = {}));\nexport const TYPE_SIZE = 2;\nexport const LENGTH_SIZE = 2;\n// NOTE: All of these should eventually use their type's Span instead of these\n// constants. This is provided for at least creation to work.\nexport function getTypeLen(e) {\n switch (e) {\n case ExtensionType.Uninitialized:\n return 0;\n case ExtensionType.TransferFeeConfig:\n return TRANSFER_FEE_CONFIG_SIZE;\n case ExtensionType.TransferFeeAmount:\n return TRANSFER_FEE_AMOUNT_SIZE;\n case ExtensionType.MintCloseAuthority:\n return MINT_CLOSE_AUTHORITY_SIZE;\n case ExtensionType.ConfidentialTransferMint:\n return 97;\n case ExtensionType.ConfidentialTransferAccount:\n return 286;\n case ExtensionType.CpiGuard:\n return CPI_GUARD_SIZE;\n case ExtensionType.DefaultAccountState:\n return DEFAULT_ACCOUNT_STATE_SIZE;\n case ExtensionType.ImmutableOwner:\n return IMMUTABLE_OWNER_SIZE;\n case ExtensionType.MemoTransfer:\n return MEMO_TRANSFER_SIZE;\n case ExtensionType.NonTransferable:\n return NON_TRANSFERABLE_SIZE;\n case ExtensionType.InterestBearingConfig:\n return INTEREST_BEARING_MINT_CONFIG_STATE_SIZE;\n case ExtensionType.PermanentDelegate:\n return PERMANENT_DELEGATE_SIZE;\n default:\n throw Error(`Unknown extension type: ${e}`);\n }\n}\nexport function isMintExtension(e) {\n switch (e) {\n case ExtensionType.TransferFeeConfig:\n case ExtensionType.MintCloseAuthority:\n case ExtensionType.ConfidentialTransferMint:\n case ExtensionType.DefaultAccountState:\n case ExtensionType.NonTransferable:\n case ExtensionType.InterestBearingConfig:\n case ExtensionType.PermanentDelegate:\n return true;\n case ExtensionType.Uninitialized:\n case ExtensionType.TransferFeeAmount:\n case ExtensionType.ConfidentialTransferAccount:\n case ExtensionType.ImmutableOwner:\n case ExtensionType.MemoTransfer:\n case ExtensionType.CpiGuard:\n return false;\n default:\n throw Error(`Unknown extension type: ${e}`);\n }\n}\nexport function isAccountExtension(e) {\n switch (e) {\n case ExtensionType.TransferFeeAmount:\n case ExtensionType.ConfidentialTransferAccount:\n case ExtensionType.ImmutableOwner:\n case ExtensionType.MemoTransfer:\n case ExtensionType.CpiGuard:\n return true;\n case ExtensionType.Uninitialized:\n case ExtensionType.TransferFeeConfig:\n case ExtensionType.MintCloseAuthority:\n case ExtensionType.ConfidentialTransferMint:\n case ExtensionType.DefaultAccountState:\n case ExtensionType.NonTransferable:\n case ExtensionType.InterestBearingConfig:\n case ExtensionType.PermanentDelegate:\n return false;\n default:\n throw Error(`Unknown extension type: ${e}`);\n }\n}\nexport function getAccountTypeOfMintType(e) {\n switch (e) {\n case ExtensionType.TransferFeeConfig:\n return ExtensionType.TransferFeeAmount;\n case ExtensionType.ConfidentialTransferMint:\n return ExtensionType.ConfidentialTransferAccount;\n case ExtensionType.TransferFeeAmount:\n case ExtensionType.ConfidentialTransferAccount:\n case ExtensionType.CpiGuard:\n case ExtensionType.DefaultAccountState:\n case ExtensionType.ImmutableOwner:\n case ExtensionType.MemoTransfer:\n case ExtensionType.MintCloseAuthority:\n case ExtensionType.NonTransferable:\n case ExtensionType.Uninitialized:\n case ExtensionType.InterestBearingConfig:\n case ExtensionType.PermanentDelegate:\n return ExtensionType.Uninitialized;\n }\n}\nfunction getLen(extensionTypes, baseSize) {\n if (extensionTypes.length === 0) {\n return baseSize;\n }\n else {\n const accountLength = ACCOUNT_SIZE +\n ACCOUNT_TYPE_SIZE +\n extensionTypes\n .filter((element, i) => i === extensionTypes.indexOf(element))\n .map((element) => getTypeLen(element) + TYPE_SIZE + LENGTH_SIZE)\n .reduce((a, b) => a + b);\n if (accountLength === MULTISIG_SIZE) {\n return accountLength + TYPE_SIZE;\n }\n else {\n return accountLength;\n }\n }\n}\nexport function getMintLen(extensionTypes) {\n return getLen(extensionTypes, MINT_SIZE);\n}\nexport function getAccountLen(extensionTypes) {\n return getLen(extensionTypes, ACCOUNT_SIZE);\n}\nexport function getExtensionData(extension, tlvData) {\n let extensionTypeIndex = 0;\n while (extensionTypeIndex + TYPE_SIZE + LENGTH_SIZE <= tlvData.length) {\n const entryType = tlvData.readUInt16LE(extensionTypeIndex);\n const entryLength = tlvData.readUInt16LE(extensionTypeIndex + TYPE_SIZE);\n const typeIndex = extensionTypeIndex + TYPE_SIZE + LENGTH_SIZE;\n if (entryType == extension) {\n return tlvData.slice(typeIndex, typeIndex + entryLength);\n }\n extensionTypeIndex = typeIndex + entryLength;\n }\n return null;\n}\nexport function getExtensionTypes(tlvData) {\n const extensionTypes = [];\n let extensionTypeIndex = 0;\n while (extensionTypeIndex < tlvData.length) {\n const entryType = tlvData.readUInt16LE(extensionTypeIndex);\n extensionTypes.push(entryType);\n const entryLength = tlvData.readUInt16LE(extensionTypeIndex + TYPE_SIZE);\n extensionTypeIndex += TYPE_SIZE + LENGTH_SIZE + entryLength;\n }\n return extensionTypes;\n}\nexport function getAccountLenForMint(mint) {\n const extensionTypes = getExtensionTypes(mint.tlvData);\n const accountExtensions = extensionTypes.map(getAccountTypeOfMintType);\n return getAccountLen(accountExtensions);\n}\n//# sourceMappingURL=extensionType.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { SYSVAR_RENT_PUBKEY, TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const initializeAccountInstructionData = struct([u8('instruction')]);\n/**\n * Construct an InitializeAccount instruction\n *\n * @param account New token account\n * @param mint Mint account\n * @param owner Owner of the new account\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createInitializeAccountInstruction(account, mint, owner, programId = TOKEN_PROGRAM_ID) {\n const keys = [\n { pubkey: account, isSigner: false, isWritable: true },\n { pubkey: mint, isSigner: false, isWritable: false },\n { pubkey: owner, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false },\n ];\n const data = Buffer.alloc(initializeAccountInstructionData.span);\n initializeAccountInstructionData.encode({ instruction: TokenInstruction.InitializeAccount }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode an InitializeAccount instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeInitializeAccountInstruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== initializeAccountInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { account, mint, owner, rent }, data, } = decodeInitializeAccountInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.InitializeAccount)\n throw new TokenInvalidInstructionTypeError();\n if (!account || !mint || !owner || !rent)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n account,\n mint,\n owner,\n rent,\n },\n data,\n };\n}\n/**\n * Decode an InitializeAccount instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeInitializeAccountInstructionUnchecked({ programId, keys: [account, mint, owner, rent], data, }) {\n return {\n programId,\n keys: {\n account,\n mint,\n owner,\n rent,\n },\n data: initializeAccountInstructionData.decode(data),\n };\n}\n//# sourceMappingURL=initializeAccount.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { publicKey } from '@solana/buffer-layout-utils';\nimport { PublicKey, TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const initializeMint2InstructionData = struct([\n u8('instruction'),\n u8('decimals'),\n publicKey('mintAuthority'),\n u8('freezeAuthorityOption'),\n publicKey('freezeAuthority'),\n]);\n/**\n * Construct an InitializeMint2 instruction\n *\n * @param mint Token mint account\n * @param decimals Number of decimals in token account amounts\n * @param mintAuthority Minting authority\n * @param freezeAuthority Optional authority that can freeze token accounts\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createInitializeMint2Instruction(mint, decimals, mintAuthority, freezeAuthority, programId = TOKEN_PROGRAM_ID) {\n const keys = [{ pubkey: mint, isSigner: false, isWritable: true }];\n const data = Buffer.alloc(initializeMint2InstructionData.span);\n initializeMint2InstructionData.encode({\n instruction: TokenInstruction.InitializeMint2,\n decimals,\n mintAuthority,\n freezeAuthorityOption: freezeAuthority ? 1 : 0,\n freezeAuthority: freezeAuthority || new PublicKey(0),\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode an InitializeMint2 instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeInitializeMint2Instruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== initializeMint2InstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { mint }, data, } = decodeInitializeMint2InstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.InitializeMint2)\n throw new TokenInvalidInstructionTypeError();\n if (!mint)\n throw new TokenInvalidInstructionKeysError();\n return {\n programId,\n keys: {\n mint,\n },\n data,\n };\n}\n/**\n * Decode an InitializeMint2 instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeInitializeMint2InstructionUnchecked({ programId, keys: [mint], data, }) {\n const { instruction, decimals, mintAuthority, freezeAuthorityOption, freezeAuthority } = initializeMint2InstructionData.decode(data);\n return {\n programId,\n keys: {\n mint,\n },\n data: {\n instruction,\n decimals,\n mintAuthority,\n freezeAuthority: freezeAuthorityOption ? freezeAuthority : null,\n },\n };\n}\n//# sourceMappingURL=initializeMint2.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { PublicKey, SYSVAR_RENT_PUBKEY, TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const initializeMultisigInstructionData = struct([\n u8('instruction'),\n u8('m'),\n]);\n/**\n * Construct an InitializeMultisig instruction\n *\n * @param account Multisig account\n * @param signers Full set of signers\n * @param m Number of required signatures\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createInitializeMultisigInstruction(account, signers, m, programId = TOKEN_PROGRAM_ID) {\n const keys = [\n { pubkey: account, isSigner: false, isWritable: true },\n { pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false },\n ];\n for (const signer of signers) {\n keys.push({\n pubkey: signer instanceof PublicKey ? signer : signer.publicKey,\n isSigner: false,\n isWritable: false,\n });\n }\n const data = Buffer.alloc(initializeMultisigInstructionData.span);\n initializeMultisigInstructionData.encode({\n instruction: TokenInstruction.InitializeMultisig,\n m,\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode an InitializeMultisig instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeInitializeMultisigInstruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== initializeMultisigInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { account, rent, signers }, data, } = decodeInitializeMultisigInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.InitializeMultisig)\n throw new TokenInvalidInstructionTypeError();\n if (!account || !rent || !signers.length)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n account,\n rent,\n signers,\n },\n data,\n };\n}\n/**\n * Decode an InitializeMultisig instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeInitializeMultisigInstructionUnchecked({ programId, keys: [account, rent, ...signers], data, }) {\n return {\n programId,\n keys: {\n account,\n rent,\n signers,\n },\n data: initializeMultisigInstructionData.decode(data),\n };\n}\n//# sourceMappingURL=initializeMultisig.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { SystemProgram, TransactionInstruction } from '@solana/web3.js';\nimport { NATIVE_MINT_2022, programSupportsExtensions, TOKEN_2022_PROGRAM_ID } from '../constants.js';\nimport { TokenUnsupportedInstructionError } from '../errors.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const createNativeMintInstructionData = struct([u8('instruction')]);\n/**\n * Construct a CreateNativeMint instruction\n *\n * @param account New token account\n * @param mint Mint account\n * @param owner Owner of the new account\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createCreateNativeMintInstruction(payer, nativeMintId = NATIVE_MINT_2022, programId = TOKEN_2022_PROGRAM_ID) {\n if (!programSupportsExtensions(programId)) {\n throw new TokenUnsupportedInstructionError();\n }\n const keys = [\n { pubkey: payer, isSigner: true, isWritable: true },\n { pubkey: nativeMintId, isSigner: false, isWritable: true },\n { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },\n ];\n const data = Buffer.alloc(createNativeMintInstructionData.span);\n createNativeMintInstructionData.encode({ instruction: TokenInstruction.CreateNativeMint }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n//# sourceMappingURL=createNativeMint.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const syncNativeInstructionData = struct([u8('instruction')]);\n/**\n * Construct a SyncNative instruction\n *\n * @param account Native account to sync lamports from\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createSyncNativeInstruction(account, programId = TOKEN_PROGRAM_ID) {\n const keys = [{ pubkey: account, isSigner: false, isWritable: true }];\n const data = Buffer.alloc(syncNativeInstructionData.span);\n syncNativeInstructionData.encode({ instruction: TokenInstruction.SyncNative }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode a SyncNative instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeSyncNativeInstruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== syncNativeInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { account }, data, } = decodeSyncNativeInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.SyncNative)\n throw new TokenInvalidInstructionTypeError();\n if (!account)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n account,\n },\n data,\n };\n}\n/**\n * Decode a SyncNative instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeSyncNativeInstructionUnchecked({ programId, keys: [account], data, }) {\n return {\n programId,\n keys: {\n account,\n },\n data: syncNativeInstructionData.decode(data),\n };\n}\n//# sourceMappingURL=syncNative.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { addSigners } from './internal.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const freezeAccountInstructionData = struct([u8('instruction')]);\n/**\n * Construct a FreezeAccount instruction\n *\n * @param account Account to freeze\n * @param mint Mint account\n * @param authority Mint freeze authority\n * @param multiSigners Signing accounts if `authority` is a multisig\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createFreezeAccountInstruction(account, mint, authority, multiSigners = [], programId = TOKEN_PROGRAM_ID) {\n const keys = addSigners([\n { pubkey: account, isSigner: false, isWritable: true },\n { pubkey: mint, isSigner: false, isWritable: false },\n ], authority, multiSigners);\n const data = Buffer.alloc(freezeAccountInstructionData.span);\n freezeAccountInstructionData.encode({ instruction: TokenInstruction.FreezeAccount }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode a FreezeAccount instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeFreezeAccountInstruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== freezeAccountInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { account, mint, authority, multiSigners }, data, } = decodeFreezeAccountInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.FreezeAccount)\n throw new TokenInvalidInstructionTypeError();\n if (!account || !mint || !authority)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n account,\n mint,\n authority,\n multiSigners,\n },\n data,\n };\n}\n/**\n * Decode a FreezeAccount instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeFreezeAccountInstructionUnchecked({ programId, keys: [account, mint, authority, ...multiSigners], data, }) {\n return {\n programId,\n keys: {\n account,\n mint,\n authority,\n multiSigners,\n },\n data: freezeAccountInstructionData.decode(data),\n };\n}\n//# sourceMappingURL=freezeAccount.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { u64 } from '@solana/buffer-layout-utils';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { addSigners } from './internal.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const mintToInstructionData = struct([u8('instruction'), u64('amount')]);\n/**\n * Construct a MintTo instruction\n *\n * @param mint Public key of the mint\n * @param destination Address of the token account to mint to\n * @param authority The mint authority\n * @param amount Amount to mint\n * @param multiSigners Signing accounts if `authority` is a multisig\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createMintToInstruction(mint, destination, authority, amount, multiSigners = [], programId = TOKEN_PROGRAM_ID) {\n const keys = addSigners([\n { pubkey: mint, isSigner: false, isWritable: true },\n { pubkey: destination, isSigner: false, isWritable: true },\n ], authority, multiSigners);\n const data = Buffer.alloc(mintToInstructionData.span);\n mintToInstructionData.encode({\n instruction: TokenInstruction.MintTo,\n amount: BigInt(amount),\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode a MintTo instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeMintToInstruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== mintToInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { mint, destination, authority, multiSigners }, data, } = decodeMintToInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.MintTo)\n throw new TokenInvalidInstructionTypeError();\n if (!mint || !destination || !authority)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n mint,\n destination,\n authority,\n multiSigners,\n },\n data,\n };\n}\n/**\n * Decode a MintTo instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeMintToInstructionUnchecked({ programId, keys: [mint, destination, authority, ...multiSigners], data, }) {\n return {\n programId,\n keys: {\n mint,\n destination,\n authority,\n multiSigners,\n },\n data: mintToInstructionData.decode(data),\n };\n}\n//# sourceMappingURL=mintTo.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { u64 } from '@solana/buffer-layout-utils';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { addSigners } from './internal.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const mintToCheckedInstructionData = struct([\n u8('instruction'),\n u64('amount'),\n u8('decimals'),\n]);\n/**\n * Construct a MintToChecked instruction\n *\n * @param mint Public key of the mint\n * @param destination Address of the token account to mint to\n * @param authority The mint authority\n * @param amount Amount to mint\n * @param decimals Number of decimals in amount to mint\n * @param multiSigners Signing accounts if `authority` is a multisig\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createMintToCheckedInstruction(mint, destination, authority, amount, decimals, multiSigners = [], programId = TOKEN_PROGRAM_ID) {\n const keys = addSigners([\n { pubkey: mint, isSigner: false, isWritable: true },\n { pubkey: destination, isSigner: false, isWritable: true },\n ], authority, multiSigners);\n const data = Buffer.alloc(mintToCheckedInstructionData.span);\n mintToCheckedInstructionData.encode({\n instruction: TokenInstruction.MintToChecked,\n amount: BigInt(amount),\n decimals,\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode a MintToChecked instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeMintToCheckedInstruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== mintToCheckedInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { mint, destination, authority, multiSigners }, data, } = decodeMintToCheckedInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.MintToChecked)\n throw new TokenInvalidInstructionTypeError();\n if (!mint || !destination || !authority)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n mint,\n destination,\n authority,\n multiSigners,\n },\n data,\n };\n}\n/**\n * Decode a MintToChecked instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeMintToCheckedInstructionUnchecked({ programId, keys: [mint, destination, authority, ...multiSigners], data, }) {\n return {\n programId,\n keys: {\n mint,\n destination,\n authority,\n multiSigners,\n },\n data: mintToCheckedInstructionData.decode(data),\n };\n}\n//# sourceMappingURL=mintToChecked.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { addSigners } from './internal.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const revokeInstructionData = struct([u8('instruction')]);\n/**\n * Construct a Revoke instruction\n *\n * @param account Address of the token account\n * @param owner Owner of the account\n * @param multiSigners Signing accounts if `owner` is a multisig\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createRevokeInstruction(account, owner, multiSigners = [], programId = TOKEN_PROGRAM_ID) {\n const keys = addSigners([{ pubkey: account, isSigner: false, isWritable: true }], owner, multiSigners);\n const data = Buffer.alloc(revokeInstructionData.span);\n revokeInstructionData.encode({ instruction: TokenInstruction.Revoke }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode a Revoke instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeRevokeInstruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== revokeInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { account, owner, multiSigners }, data, } = decodeRevokeInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.Revoke)\n throw new TokenInvalidInstructionTypeError();\n if (!account || !owner)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n account,\n owner,\n multiSigners,\n },\n data,\n };\n}\n/**\n * Decode a Revoke instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeRevokeInstructionUnchecked({ programId, keys: [account, owner, ...multiSigners], data, }) {\n return {\n programId,\n keys: {\n account,\n owner,\n multiSigners,\n },\n data: revokeInstructionData.decode(data),\n };\n}\n//# sourceMappingURL=revoke.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { publicKey } from '@solana/buffer-layout-utils';\nimport { PublicKey, TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { addSigners } from './internal.js';\nimport { TokenInstruction } from './types.js';\n/** Authority types defined by the program */\nexport var AuthorityType;\n(function (AuthorityType) {\n AuthorityType[AuthorityType[\"MintTokens\"] = 0] = \"MintTokens\";\n AuthorityType[AuthorityType[\"FreezeAccount\"] = 1] = \"FreezeAccount\";\n AuthorityType[AuthorityType[\"AccountOwner\"] = 2] = \"AccountOwner\";\n AuthorityType[AuthorityType[\"CloseAccount\"] = 3] = \"CloseAccount\";\n})(AuthorityType || (AuthorityType = {}));\n/** TODO: docs */\nexport const setAuthorityInstructionData = struct([\n u8('instruction'),\n u8('authorityType'),\n u8('newAuthorityOption'),\n publicKey('newAuthority'),\n]);\n/**\n * Construct a SetAuthority instruction\n *\n * @param account Address of the token account\n * @param currentAuthority Current authority of the specified type\n * @param authorityType Type of authority to set\n * @param newAuthority New authority of the account\n * @param multiSigners Signing accounts if `currentAuthority` is a multisig\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createSetAuthorityInstruction(account, currentAuthority, authorityType, newAuthority, multiSigners = [], programId = TOKEN_PROGRAM_ID) {\n const keys = addSigners([{ pubkey: account, isSigner: false, isWritable: true }], currentAuthority, multiSigners);\n const data = Buffer.alloc(setAuthorityInstructionData.span);\n setAuthorityInstructionData.encode({\n instruction: TokenInstruction.SetAuthority,\n authorityType,\n newAuthorityOption: newAuthority ? 1 : 0,\n newAuthority: newAuthority || new PublicKey(0),\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode a SetAuthority instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeSetAuthorityInstruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== setAuthorityInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { account, currentAuthority, multiSigners }, data, } = decodeSetAuthorityInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.SetAuthority)\n throw new TokenInvalidInstructionTypeError();\n if (!account || !currentAuthority)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n account,\n currentAuthority,\n multiSigners,\n },\n data,\n };\n}\n/**\n * Decode a SetAuthority instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeSetAuthorityInstructionUnchecked({ programId, keys: [account, currentAuthority, ...multiSigners], data, }) {\n const { instruction, authorityType, newAuthorityOption, newAuthority } = setAuthorityInstructionData.decode(data);\n return {\n programId,\n keys: {\n account,\n currentAuthority,\n multiSigners,\n },\n data: {\n instruction,\n authorityType,\n newAuthority: newAuthorityOption ? newAuthority : null,\n },\n };\n}\n//# sourceMappingURL=setAuthority.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { addSigners } from './internal.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const thawAccountInstructionData = struct([u8('instruction')]);\n/**\n * Construct a ThawAccount instruction\n *\n * @param account Account to thaw\n * @param mint Mint account\n * @param authority Mint freeze authority\n * @param multiSigners Signing accounts if `authority` is a multisig\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createThawAccountInstruction(account, mint, authority, multiSigners = [], programId = TOKEN_PROGRAM_ID) {\n const keys = addSigners([\n { pubkey: account, isSigner: false, isWritable: true },\n { pubkey: mint, isSigner: false, isWritable: false },\n ], authority, multiSigners);\n const data = Buffer.alloc(thawAccountInstructionData.span);\n thawAccountInstructionData.encode({ instruction: TokenInstruction.ThawAccount }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode a ThawAccount instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeThawAccountInstruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== thawAccountInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { account, mint, authority, multiSigners }, data, } = decodeThawAccountInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.ThawAccount)\n throw new TokenInvalidInstructionTypeError();\n if (!account || !mint || !authority)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n account,\n mint,\n authority,\n multiSigners,\n },\n data,\n };\n}\n/**\n * Decode a ThawAccount instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeThawAccountInstructionUnchecked({ programId, keys: [account, mint, authority, ...multiSigners], data, }) {\n return {\n programId,\n keys: {\n account,\n mint,\n authority,\n multiSigners,\n },\n data: thawAccountInstructionData.decode(data),\n };\n}\n//# sourceMappingURL=thawAccount.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { u64 } from '@solana/buffer-layout-utils';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { addSigners } from './internal.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const transferInstructionData = struct([u8('instruction'), u64('amount')]);\n/**\n * Construct a Transfer instruction\n *\n * @param source Source account\n * @param destination Destination account\n * @param owner Owner of the source account\n * @param amount Number of tokens to transfer\n * @param multiSigners Signing accounts if `owner` is a multisig\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createTransferInstruction(source, destination, owner, amount, multiSigners = [], programId = TOKEN_PROGRAM_ID) {\n const keys = addSigners([\n { pubkey: source, isSigner: false, isWritable: true },\n { pubkey: destination, isSigner: false, isWritable: true },\n ], owner, multiSigners);\n const data = Buffer.alloc(transferInstructionData.span);\n transferInstructionData.encode({\n instruction: TokenInstruction.Transfer,\n amount: BigInt(amount),\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode a Transfer instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeTransferInstruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== transferInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { source, destination, owner, multiSigners }, data, } = decodeTransferInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.Transfer)\n throw new TokenInvalidInstructionTypeError();\n if (!source || !destination || !owner)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n source,\n destination,\n owner,\n multiSigners,\n },\n data,\n };\n}\n/**\n * Decode a Transfer instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeTransferInstructionUnchecked({ programId, keys: [source, destination, owner, ...multiSigners], data, }) {\n return {\n programId,\n keys: {\n source,\n destination,\n owner,\n multiSigners,\n },\n data: transferInstructionData.decode(data),\n };\n}\n//# sourceMappingURL=transfer.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { u64 } from '@solana/buffer-layout-utils';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { addSigners } from './internal.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const transferCheckedInstructionData = struct([\n u8('instruction'),\n u64('amount'),\n u8('decimals'),\n]);\n/**\n * Construct a TransferChecked instruction\n *\n * @param source Source account\n * @param mint Mint account\n * @param destination Destination account\n * @param owner Owner of the source account\n * @param amount Number of tokens to transfer\n * @param decimals Number of decimals in transfer amount\n * @param multiSigners Signing accounts if `owner` is a multisig\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createTransferCheckedInstruction(source, mint, destination, owner, amount, decimals, multiSigners = [], programId = TOKEN_PROGRAM_ID) {\n const keys = addSigners([\n { pubkey: source, isSigner: false, isWritable: true },\n { pubkey: mint, isSigner: false, isWritable: false },\n { pubkey: destination, isSigner: false, isWritable: true },\n ], owner, multiSigners);\n const data = Buffer.alloc(transferCheckedInstructionData.span);\n transferCheckedInstructionData.encode({\n instruction: TokenInstruction.TransferChecked,\n amount: BigInt(amount),\n decimals,\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode a TransferChecked instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeTransferCheckedInstruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== transferCheckedInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { source, mint, destination, owner, multiSigners }, data, } = decodeTransferCheckedInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.TransferChecked)\n throw new TokenInvalidInstructionTypeError();\n if (!source || !mint || !destination || !owner)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n source,\n mint,\n destination,\n owner,\n multiSigners,\n },\n data,\n };\n}\n/**\n * Decode a TransferChecked instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeTransferCheckedInstructionUnchecked({ programId, keys: [source, mint, destination, owner, ...multiSigners], data, }) {\n return {\n programId,\n keys: {\n source,\n mint,\n destination,\n owner,\n multiSigners,\n },\n data: transferCheckedInstructionData.decode(data),\n };\n}\n//# sourceMappingURL=transferChecked.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { publicKey } from '@solana/buffer-layout-utils';\nimport { PublicKey, SYSVAR_RENT_PUBKEY, TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const initializeMintInstructionData = struct([\n u8('instruction'),\n u8('decimals'),\n publicKey('mintAuthority'),\n u8('freezeAuthorityOption'),\n publicKey('freezeAuthority'),\n]);\n/**\n * Construct an InitializeMint instruction\n *\n * @param mint Token mint account\n * @param decimals Number of decimals in token account amounts\n * @param mintAuthority Minting authority\n * @param freezeAuthority Optional authority that can freeze token accounts\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createInitializeMintInstruction(mint, decimals, mintAuthority, freezeAuthority, programId = TOKEN_PROGRAM_ID) {\n const keys = [\n { pubkey: mint, isSigner: false, isWritable: true },\n { pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false },\n ];\n const data = Buffer.alloc(initializeMintInstructionData.span);\n initializeMintInstructionData.encode({\n instruction: TokenInstruction.InitializeMint,\n decimals,\n mintAuthority,\n freezeAuthorityOption: freezeAuthority ? 1 : 0,\n freezeAuthority: freezeAuthority || new PublicKey(0),\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode an InitializeMint instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeInitializeMintInstruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== initializeMintInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { mint, rent }, data, } = decodeInitializeMintInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.InitializeMint)\n throw new TokenInvalidInstructionTypeError();\n if (!mint || !rent)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n mint,\n rent,\n },\n data,\n };\n}\n/**\n * Decode an InitializeMint instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeInitializeMintInstructionUnchecked({ programId, keys: [mint, rent], data, }) {\n const { instruction, decimals, mintAuthority, freezeAuthorityOption, freezeAuthority } = initializeMintInstructionData.decode(data);\n return {\n programId,\n keys: {\n mint,\n rent,\n },\n data: {\n instruction,\n decimals,\n mintAuthority,\n freezeAuthority: freezeAuthorityOption ? freezeAuthority : null,\n },\n };\n}\n//# sourceMappingURL=initializeMint.js.map","import { s16, struct, u8 } from '@solana/buffer-layout';\nimport { publicKey } from '@solana/buffer-layout-utils';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_2022_PROGRAM_ID } from '../../constants.js';\nimport { addSigners } from '../../instructions/internal.js';\nimport { TokenInstruction } from '../../instructions/types.js';\nexport var InterestBearingMintInstruction;\n(function (InterestBearingMintInstruction) {\n InterestBearingMintInstruction[InterestBearingMintInstruction[\"Initialize\"] = 0] = \"Initialize\";\n InterestBearingMintInstruction[InterestBearingMintInstruction[\"UpdateRate\"] = 1] = \"UpdateRate\";\n})(InterestBearingMintInstruction || (InterestBearingMintInstruction = {}));\nexport const interestBearingMintInitializeInstructionData = struct([\n u8('instruction'),\n u8('interestBearingMintInstruction'),\n // TODO: Make this an optional public key\n publicKey('rateAuthority'),\n s16('rate'),\n]);\nexport const interestBearingMintUpdateRateInstructionData = struct([\n u8('instruction'),\n u8('interestBearingMintInstruction'),\n s16('rate'),\n]);\n/**\n * Construct an InitializeInterestBearingMint instruction\n *\n * @param mint Mint to initialize\n * @param rateAuthority The public key for the account that can update the rate\n * @param rate The initial interest rate\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createInitializeInterestBearingMintInstruction(mint, rateAuthority, rate, programId = TOKEN_2022_PROGRAM_ID) {\n const keys = [{ pubkey: mint, isSigner: false, isWritable: true }];\n const data = Buffer.alloc(interestBearingMintInitializeInstructionData.span);\n interestBearingMintInitializeInstructionData.encode({\n instruction: TokenInstruction.InterestBearingMintExtension,\n interestBearingMintInstruction: InterestBearingMintInstruction.Initialize,\n rateAuthority,\n rate,\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Construct an UpdateRateInterestBearingMint instruction\n *\n * @param mint Mint to initialize\n * @param rateAuthority The public key for the account that can update the rate\n * @param rate The updated interest rate\n * @param multiSigners Signing accounts if `rateAuthority` is a multisig\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createUpdateRateInterestBearingMintInstruction(mint, rateAuthority, rate, multiSigners = [], programId = TOKEN_2022_PROGRAM_ID) {\n const keys = addSigners([\n { pubkey: mint, isSigner: false, isWritable: true },\n { pubkey: rateAuthority, isSigner: !multiSigners.length, isWritable: false },\n ], rateAuthority, multiSigners);\n const data = Buffer.alloc(interestBearingMintUpdateRateInstructionData.span);\n interestBearingMintUpdateRateInstructionData.encode({\n instruction: TokenInstruction.InterestBearingMintExtension,\n interestBearingMintInstruction: InterestBearingMintInstruction.UpdateRate,\n rate,\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n//# sourceMappingURL=instructions.js.map",null,null,"import { struct, u8 } from '@solana/buffer-layout';\nimport { publicKey } from '@solana/buffer-layout-utils';\nimport { SYSVAR_RENT_PUBKEY, TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { TokenInstruction } from './types.js';\nexport const initializeAccount2InstructionData = struct([\n u8('instruction'),\n publicKey('owner'),\n]);\n/**\n * Construct an InitializeAccount2 instruction\n *\n * @param account New token account\n * @param mint Mint account\n * @param owner New account's owner/multisignature\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createInitializeAccount2Instruction(account, mint, owner, programId = TOKEN_PROGRAM_ID) {\n const keys = [\n { pubkey: account, isSigner: false, isWritable: true },\n { pubkey: mint, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false },\n ];\n const data = Buffer.alloc(initializeAccount2InstructionData.span);\n initializeAccount2InstructionData.encode({ instruction: TokenInstruction.InitializeAccount2, owner }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode an InitializeAccount2 instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeInitializeAccount2Instruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== initializeAccount2InstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { account, mint, rent }, data, } = decodeInitializeAccount2InstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.InitializeAccount2)\n throw new TokenInvalidInstructionTypeError();\n if (!account || !mint || !rent)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n account,\n mint,\n rent,\n },\n data,\n };\n}\n/**\n * Decode an InitializeAccount2 instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeInitializeAccount2InstructionUnchecked({ programId, keys: [account, mint, rent], data, }) {\n return {\n programId,\n keys: {\n account,\n mint,\n rent,\n },\n data: initializeAccount2InstructionData.decode(data),\n };\n}\n//# sourceMappingURL=initializeAccount2.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { publicKey } from '@solana/buffer-layout-utils';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { TokenInstruction } from './types.js';\nexport const initializeAccount3InstructionData = struct([\n u8('instruction'),\n publicKey('owner'),\n]);\n/**\n * Construct an InitializeAccount3 instruction\n *\n * @param account New token account\n * @param mint Mint account\n * @param owner New account's owner/multisignature\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createInitializeAccount3Instruction(account, mint, owner, programId = TOKEN_PROGRAM_ID) {\n const keys = [\n { pubkey: account, isSigner: false, isWritable: true },\n { pubkey: mint, isSigner: false, isWritable: false },\n ];\n const data = Buffer.alloc(initializeAccount3InstructionData.span);\n initializeAccount3InstructionData.encode({ instruction: TokenInstruction.InitializeAccount3, owner }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode an InitializeAccount3 instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeInitializeAccount3Instruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== initializeAccount3InstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { account, mint }, data, } = decodeInitializeAccount3InstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.InitializeAccount3)\n throw new TokenInvalidInstructionTypeError();\n if (!account || !mint)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n account,\n mint,\n },\n data,\n };\n}\n/**\n * Decode an InitializeAccount3 instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeInitializeAccount3InstructionUnchecked({ programId, keys: [account, mint], data, }) {\n return {\n programId,\n keys: {\n account,\n mint,\n },\n data: initializeAccount3InstructionData.decode(data),\n };\n}\n//# sourceMappingURL=initializeAccount3.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { TokenInstruction } from './types.js';\n/** The struct that represents the instruction data as it is read by the program */\nexport const initializeImmutableOwnerInstructionData = struct([\n u8('instruction'),\n]);\n/**\n * Construct an InitializeImmutableOwner instruction\n *\n * @param account Immutable Owner Account\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createInitializeImmutableOwnerInstruction(account, programId) {\n const keys = [{ pubkey: account, isSigner: false, isWritable: true }];\n const data = Buffer.alloc(initializeImmutableOwnerInstructionData.span);\n initializeImmutableOwnerInstructionData.encode({\n instruction: TokenInstruction.InitializeImmutableOwner,\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode an InitializeImmutableOwner instruction and validate it\n *\n * @param instruction InitializeImmutableOwner instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeInitializeImmutableOwnerInstruction(instruction, programId) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== initializeImmutableOwnerInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { account }, data, } = decodeInitializeImmutableOwnerInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.InitializeImmutableOwner)\n throw new TokenInvalidInstructionTypeError();\n if (!account)\n throw new TokenInvalidInstructionKeysError();\n return {\n programId,\n keys: {\n account,\n },\n data,\n };\n}\n/**\n * Decode an InitializeImmutableOwner instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeInitializeImmutableOwnerInstructionUnchecked({ programId, keys: [account], data, }) {\n const { instruction } = initializeImmutableOwnerInstructionData.decode(data);\n return {\n programId,\n keys: {\n account: account,\n },\n data: {\n instruction,\n },\n };\n}\n//# sourceMappingURL=initializeImmutableOwner.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { publicKey } from '@solana/buffer-layout-utils';\nimport { PublicKey, TransactionInstruction } from '@solana/web3.js';\nimport { programSupportsExtensions } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, TokenUnsupportedInstructionError, } from '../errors.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const initializeMintCloseAuthorityInstructionData = struct([\n u8('instruction'),\n u8('closeAuthorityOption'),\n publicKey('closeAuthority'),\n]);\n/**\n * Construct an InitializeMintCloseAuthority instruction\n *\n * @param mint Token mint account\n * @param closeAuthority Optional authority that can close the mint\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createInitializeMintCloseAuthorityInstruction(mint, closeAuthority, programId) {\n if (!programSupportsExtensions(programId)) {\n throw new TokenUnsupportedInstructionError();\n }\n const keys = [{ pubkey: mint, isSigner: false, isWritable: true }];\n const data = Buffer.alloc(initializeMintCloseAuthorityInstructionData.span);\n initializeMintCloseAuthorityInstructionData.encode({\n instruction: TokenInstruction.InitializeMintCloseAuthority,\n closeAuthorityOption: closeAuthority ? 1 : 0,\n closeAuthority: closeAuthority || new PublicKey(0),\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode an InitializeMintCloseAuthority instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeInitializeMintCloseAuthorityInstruction(instruction, programId) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== initializeMintCloseAuthorityInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { mint }, data, } = decodeInitializeMintCloseAuthorityInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.InitializeMintCloseAuthority)\n throw new TokenInvalidInstructionTypeError();\n if (!mint)\n throw new TokenInvalidInstructionKeysError();\n return {\n programId,\n keys: {\n mint,\n },\n data,\n };\n}\n/**\n * Decode an InitializeMintCloseAuthority instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeInitializeMintCloseAuthorityInstructionUnchecked({ programId, keys: [mint], data, }) {\n const { instruction, closeAuthorityOption, closeAuthority } = initializeMintCloseAuthorityInstructionData.decode(data);\n return {\n programId,\n keys: {\n mint,\n },\n data: {\n instruction,\n closeAuthority: closeAuthorityOption ? closeAuthority : null,\n },\n };\n}\n//# sourceMappingURL=initializeMintCloseAuthority.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { programSupportsExtensions } from '../constants.js';\nimport { TokenUnsupportedInstructionError } from '../errors.js';\nimport { TokenInstruction } from './types.js';\n/** The struct that represents the instruction data as it is read by the program */\nexport const initializeNonTransferableMintInstructionData = struct([\n u8('instruction'),\n]);\n/**\n * Construct an InitializeNonTransferableMint instruction\n *\n * @param mint Mint Account to make non-transferable\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createInitializeNonTransferableMintInstruction(mint, programId) {\n if (!programSupportsExtensions(programId)) {\n throw new TokenUnsupportedInstructionError();\n }\n const keys = [{ pubkey: mint, isSigner: false, isWritable: true }];\n const data = Buffer.alloc(initializeNonTransferableMintInstructionData.span);\n initializeNonTransferableMintInstructionData.encode({\n instruction: TokenInstruction.InitializeNonTransferableMint,\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n//# sourceMappingURL=initializeNonTransferableMint.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { publicKey } from '@solana/buffer-layout-utils';\nimport { PublicKey } from '@solana/web3.js';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { programSupportsExtensions } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, TokenUnsupportedInstructionError, } from '../errors.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const initializePermanentDelegateInstructionData = struct([\n u8('instruction'),\n publicKey('delegate'),\n]);\n/**\n * Construct an InitializePermanentDelegate instruction\n *\n * @param mint Token mint account\n * @param permanentDelegate Authority that may sign for `Transfer`s and `Burn`s on any account\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createInitializePermanentDelegateInstruction(mint, permanentDelegate, programId) {\n if (!programSupportsExtensions(programId)) {\n throw new TokenUnsupportedInstructionError();\n }\n const keys = [{ pubkey: mint, isSigner: false, isWritable: true }];\n const data = Buffer.alloc(initializePermanentDelegateInstructionData.span);\n initializePermanentDelegateInstructionData.encode({\n instruction: TokenInstruction.InitializePermanentDelegate,\n delegate: permanentDelegate || new PublicKey(0),\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode an InitializePermanentDelegate instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeInitializePermanentDelegateInstruction(instruction, programId) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== initializePermanentDelegateInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { mint }, data, } = decodeInitializePermanentDelegateInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.InitializePermanentDelegate)\n throw new TokenInvalidInstructionTypeError();\n if (!mint)\n throw new TokenInvalidInstructionKeysError();\n return {\n programId,\n keys: {\n mint,\n },\n data,\n };\n}\n/**\n * Decode an InitializePermanentDelegate instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeInitializePermanentDelegateInstructionUnchecked({ programId, keys: [mint], data, }) {\n const { instruction, delegate } = initializePermanentDelegateInstructionData.decode(data);\n return {\n programId,\n keys: {\n mint,\n },\n data: {\n instruction,\n delegate,\n },\n };\n}\n//# sourceMappingURL=initializePermanentDelegate.js.map"],"names":["base64Js","b64","lens","getLens","validLen","placeHoldersLen","tmp","i","arr","Arr","_byteLength","curByte","len","revLookup","charCodeAt","uint8","length","extraBytes","parts","maxChunkLength","len2","push","encodeChunk","lookup","join","Uint8Array","Array","code","Error","indexOf","start","end","num","output","ieee754","buffer","offset","isLE","mLen","nBytes","e","m","eLen","eMax","eBias","nBits","d","s","NaN","Infinity","Math","pow","value","c","rt","abs","isNaN","floor","log","LN2","base64","require$$0","require$$1","customInspectSymbol","Symbol","exports","Buffer","SlowBuffer","alloc","INSPECT_MAX_BYTES","K_MAX_LENGTH","createBuffer","RangeError","buf","Object","setPrototypeOf","prototype","arg","encodingOrOffset","TypeError","allocUnsafe","from","string","encoding","isEncoding","byteLength","actual","write","slice","fromString","ArrayBuffer","isView","arrayView","isInstance","copy","fromArrayBuffer","byteOffset","fromArrayLike","fromArrayView","SharedArrayBuffer","valueOf","b","obj","isBuffer","checked","undefined","numberIsNaN","type","isArray","data","fromObject","toPrimitive","assertSize","size","array","toString","mustMatch","arguments","loweredCase","utf8ToBytes","base64ToBytes","toLowerCase","slowToString","this","hexSlice","utf8Slice","asciiSlice","latin1Slice","base64Slice","utf16leSlice","swap","n","bidirectionalIndexOf","val","dir","arrayIndexOf","call","lastIndexOf","indexSize","arrLength","valLength","String","read","readUInt16BE","foundIndex","found","j","hexWrite","Number","remaining","strLen","parsed","parseInt","substr","utf8Write","blitBuffer","asciiWrite","str","byteArray","asciiToBytes","base64Write","ucs2Write","units","hi","lo","utf16leToBytes","fromByteArray","min","res","firstByte","codePoint","bytesPerSequence","secondByte","thirdByte","fourthByte","tempCodePoint","codePoints","MAX_ARGUMENTS_LENGTH","fromCharCode","apply","decodeCodePointsArray","kMaxLength","TYPED_ARRAY_SUPPORT","proto","foo","typedArraySupport","console","error","defineProperty","enumerable","get","poolSize","fill","allocUnsafeSlow","_isBuffer","compare","a","x","y","concat","list","pos","set","swap16","swap32","swap64","toLocaleString","equals","inspect","max","replace","trim","target","thisStart","thisEnd","thisCopy","targetCopy","includes","isFinite","toJSON","_arr","ret","out","hexSliceLookupTable","bytes","checkOffset","ext","checkInt","wrtBigUInt64LE","checkIntBI","BigInt","wrtBigUInt64BE","checkIEEE754","writeFloat","littleEndian","noAssert","writeDouble","newBuf","subarray","readUintLE","readUIntLE","mul","readUintBE","readUIntBE","readUint8","readUInt8","readUint16LE","readUInt16LE","readUint16BE","readUint32LE","readUInt32LE","readUint32BE","readUInt32BE","readBigUInt64LE","defineBigIntMethod","validateNumber","first","last","boundsError","readBigUInt64BE","readIntLE","readIntBE","readInt8","readInt16LE","readInt16BE","readInt32LE","readInt32BE","readBigInt64LE","readBigInt64BE","readFloatLE","readFloatBE","readDoubleLE","readDoubleBE","writeUintLE","writeUIntLE","writeUintBE","writeUIntBE","writeUint8","writeUInt8","writeUint16LE","writeUInt16LE","writeUint16BE","writeUInt16BE","writeUint32LE","writeUInt32LE","writeUint32BE","writeUInt32BE","writeBigUInt64LE","writeBigUInt64BE","writeIntLE","limit","sub","writeIntBE","writeInt8","writeInt16LE","writeInt16BE","writeInt32LE","writeInt32BE","writeBigInt64LE","writeBigInt64BE","writeFloatLE","writeFloatBE","writeDoubleLE","writeDoubleBE","targetStart","copyWithin","errors","E","sym","getMessage","Base","constructor","super","writable","configurable","name","stack","message","addNumericalSeparator","range","ERR_OUT_OF_RANGE","checkBounds","ERR_INVALID_ARG_TYPE","ERR_BUFFER_OUT_OF_BOUNDS","input","msg","received","isInteger","INVALID_BASE64_RE","leadSurrogate","toByteArray","split","base64clean","src","dst","alphabet","table","i16","fn","BufferBigIntNotDefined","TOKEN_PROGRAM_ID","PublicKey","ASSOCIATED_TOKEN_PROGRAM_ID","Layout_1","s16","nu64be","u48be","u40be","u32be","u16be","nu64","u40","u32","u24","u16","u8","greedy","Constant","UTF8","Blob","Boolean","BitStructure","VariantLayout","Union","UnionLayoutDiscriminator","Structure","Sequence","DoubleBE","Double","Float","NearInt64BE","NearUInt64BE","NearUInt64","IntBE","Int","UInt","OffsetLayout","GreedyCount","ExternalLayout","nameWithProperty","Layout","uint8ArrayToBuffer","checkUint8Array","constant","cstr","blob","unionLayoutDiscriminator","union","bits","struct","f64","f32be","f32","ns64be","s40be","s32be","s24be","s16be","ns64","s48","s40","s32","s24","buffer_1","span","property","makeDestinationObject","getSpan","replicate","rv","create","assign","fromArray","values","bindConstructorLayout","Class","layout","hasOwnProperty","layout_","boundConstructor_","encode","decode","isCount","elementSpan","rem","UIntBE","V2E32","divmodInt64","hi32","lo32","roundedInt64","NearInt64","FloatBE","elementLayout","count","idx","elo","reduce","v","fields","decodePrefixes","acc","fd","fsp","dest","firstOffset","lastOffset","lastWrote","fv","shift","layoutFor","offsetOf","UnionDiscriminator","discr","defaultLayout","discriminator","usesPrefixDiscriminator","registry","boundGetSourceVariant","defaultGetSourceVariant","bind","getSourceVariant","configGetSourceVariant","gsv","vlo","getVariant","tag","dlo","clo","contentOffset","addVariant","variant","vb","fixBitwiseResult","word","msb","_packedSetValue","_packedGetValue","addField","bf","BitField","addBoolean","fieldFor","container","totalBits","usedBits","sum","valueMask","wordMask","wordValue","srcBuffer","CString","srcb","maxSpan","u48","u24be","s8","s48be","f64be","seq","utf8","encodeDecode","browser","toBigIntLE_1","toBigIntLE","reversed","reverse","hex","toBigIntBE","toBufferLE_1","toBufferLE","width","padStart","toBufferBE","u64","bigIntLayout","bigInt","bool","boolLayout","publicKey","publicKeyLayout","toBuffer","TokenError","TokenInvalidInstructionProgramError","TokenInvalidInstructionKeysError","TokenInvalidInstructionDataError","TokenInvalidInstructionTypeError","TokenInstruction","approveInstructionData","decodeApproveInstruction","instruction","programId","keys","account","delegate","owner","multiSigners","decodeApproveInstructionUnchecked","Approve","approveCheckedInstructionData","decodeApproveCheckedInstruction","mint","decodeApproveCheckedInstructionUnchecked","ApproveChecked","burnInstructionData","decodeBurnInstruction","decodeBurnInstructionUnchecked","Burn","burnCheckedInstructionData","decodeBurnCheckedInstruction","decodeBurnCheckedInstructionUnchecked","BurnChecked","closeAccountInstructionData","decodeCloseAccountInstruction","destination","authority","decodeCloseAccountInstructionUnchecked","CloseAccount","AccountType","AccountState","CpiGuardInstruction","DefaultAccountStateInstruction","MemoTransferInstruction","TransferFeeInstruction","transferFeeLayout","ExtensionType","initializeAccountInstructionData","decodeInitializeAccountInstruction","rent","decodeInitializeAccountInstructionUnchecked","InitializeAccount","initializeMultisigInstructionData","decodeInitializeMultisigInstruction","signers","decodeInitializeMultisigInstructionUnchecked","InitializeMultisig","freezeAccountInstructionData","decodeFreezeAccountInstruction","decodeFreezeAccountInstructionUnchecked","FreezeAccount","mintToInstructionData","decodeMintToInstruction","decodeMintToInstructionUnchecked","MintTo","mintToCheckedInstructionData","decodeMintToCheckedInstruction","decodeMintToCheckedInstructionUnchecked","MintToChecked","revokeInstructionData","decodeRevokeInstruction","decodeRevokeInstructionUnchecked","Revoke","AuthorityType","setAuthorityInstructionData","decodeSetAuthorityInstruction","currentAuthority","authorityType","newAuthorityOption","newAuthority","decodeSetAuthorityInstructionUnchecked","SetAuthority","thawAccountInstructionData","decodeThawAccountInstruction","decodeThawAccountInstructionUnchecked","ThawAccount","transferInstructionData","decodeTransferInstruction","source","decodeTransferInstructionUnchecked","Transfer","transferCheckedInstructionData","decodeTransferCheckedInstruction","decodeTransferCheckedInstructionUnchecked","TransferChecked","initializeMintInstructionData","decodeInitializeMintInstructionUnchecked","decimals","mintAuthority","freezeAuthorityOption","freezeAuthority","InterestBearingMintInstruction","hexToBuffer","rawHex","startsWith","parseTransactionAccounts","loadedAddresses","accounts","version","accountKeys","staticAccountKeys","readonlySignedAccountsCount","header","numReadonlySignedAccounts","readonlyUnsignedAccountsCount","numReadonlyUnsignedAccounts","requiredSignaturesAccountsCount","numRequiredSignatures","totalAccounts","parsedAccounts","map","isSigner","isWritable","pubkey","ALTWritable","ALTReadOnly","readonly","compiledInstructionToInstruction","compiledInstruction","ci","TransactionInstruction","utils","bs58","programIdIndex","accountIdx","accountKeyIndexes","accountIndex","parsedAccountsToMeta","accountMeta","meta","pk","encoded","find","item","parsedInstructionToInstruction","parsedInstruction","flattenTransactionResponse","transaction","result","txInstructions","compiledInstructions","accountsMeta","_a","orderedCII","_b","innerInstructions","sort","index","totalCalls","_c","accumulator","cii","instructions","lastPushedIx","callIndex","CII","CIIEntry","newLogContext","depth","id","instructionIndex","logMessages","dataLogs","rawLogs","parseLogs","logs","parserRe","currentInstruction","currentDepth","callStack","callIds","match","exec","groups","logTruncated","invokeResult","programInvoke","invokeProgramId","level","programSuccessResult","lastProgram","pop","lastCallIndex","successResultProgramId","programFailedResult","failedResultProgramId","failedResultErr","programCompleteFailedResult","failedCompleteError","programLog","logMessage","programData","programConsumed","programReturn","returnProgramId","returnMessage","decodeSystemInstruction","SystemInstruction","decodeInstructionType","decoded","decodeNonceAdvance","noncePubkey","authorizedPubkey","args","decodeAllocate","accountPubkey","space","BN","decodeAllocateWithSeed","basePubkey","seed","base","decodeAssign","decodeAssignWithSeed","decodeNonceAuthorize","authorized","newAuthorizedPubkey","decodeCreateAccount","fromPubkey","newAccountPubkey","lamports","decodeCreateWithSeed","decodeNonceInitialize","decodeTransfer","toPubkey","decodeTransferWithSeed","decodeNonceWithdraw","SystemProgram","unknown","decodeTokenInstruction","spl.TokenInstruction","InitializeMint","decodedIx","spl.decodeInitializeMintInstruction","spl.decodeInitializeAccountInstruction","spl.decodeInitializeMultisigInstruction","multisig","spl.decodeTransferInstruction","amount","spl.decodeApproveInstruction","spl.decodeRevokeInstruction","spl.decodeSetAuthorityInstruction","spl.decodeMintToInstruction","spl.decodeBurnInstruction","spl.decodeCloseAccountInstruction","spl.decodeFreezeAccountInstruction","spl.decodeThawAccountInstruction","spl.decodeTransferCheckedInstruction","spl.decodeApproveCheckedInstruction","spl.decodeMintToCheckedInstruction","spl.decodeBurnCheckedInstruction","InitializeAccount2","SyncNative","InitializeAccount3","InitializeMultisig2","InitializeMint2","spl.decodeInitializeMintInstructionUnchecked","spl.TOKEN_PROGRAM_ID","decodeAssociatedTokenInstruction","spl.ASSOCIATED_TOKEN_PROGRAM_ID","flattenIdlAccounts","prefix","accName","newPrefix","flat","SolanaParser","programInfos","parsers","standartParsers","toBase58","programInfo","buildIdlParser","idl","Map","parserInfo","has","instructionParsers","addParser","parser","addParserFromIdl","parsedIx","BorshInstructionCoder","ix","instr","buildUnknownParsedInstruction","flatIdlAccounts","removeParser","delete","argData","parseInstruction","parseTransactionData","txMessage","altLoadedAddresses","parseTransactionParsedData","txParsedMessage","metaLike","signer","async","connection","txId","flatten","commitment","getTransaction","maxSupportedTransact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,EAAYA,YAAY7V,QAA2B,UAAlB6V,EAAYR,YAAM,IAAAa,OAAA,EAAAA,EAAA9C,gBACpF,CAODgN,qBAAqBC,GACdA,aAAkBhwB,WAASgwB,EAAShwB,EAAAA,OAAOe,KAAKivB,EAAQ,WAC9D,MACMrgB,EADKsgB,EAAYlvB,KAAKivB,GACTE,iBAEnB,OAAOzsB,KAAKwrB,qBAAqBtf,EACjC"} \ No newline at end of file +{"version":3,"file":"index.js","sources":["../../node_modules/base64-js/index.js","../../node_modules/ieee754/index.js","../../node_modules/buffer/index.js","../../node_modules/@solana/spl-token/lib/esm/constants.js","../../node_modules/@solana/buffer-layout/lib/Layout.js","../../node_modules/@solana/buffer-layout-utils/lib/esm/base.mjs","../../node_modules/bigint-buffer/dist/browser.js","../../node_modules/@solana/buffer-layout-utils/lib/esm/bigint.mjs","../../node_modules/@solana/buffer-layout-utils/lib/esm/native.mjs","../../node_modules/@solana/buffer-layout-utils/lib/esm/web3.mjs","../../node_modules/@solana/spl-token/lib/esm/errors.js","../../node_modules/@solana/spl-token/lib/esm/instructions/types.js","../../node_modules/@solana/spl-token/lib/esm/instructions/amountToUiAmount.js","../../node_modules/@solana/spl-token/lib/esm/instructions/approve.js","../../node_modules/@solana/spl-token/lib/esm/instructions/approveChecked.js","../../node_modules/@solana/spl-token/lib/esm/instructions/burn.js","../../node_modules/@solana/spl-token/lib/esm/instructions/burnChecked.js","../../node_modules/@solana/spl-token/lib/esm/instructions/closeAccount.js","../../node_modules/@solana/spl-token/lib/esm/extensions/accountType.js","../../node_modules/@solana/spl-token/lib/esm/state/account.js","../../node_modules/@solana/spl-token/lib/esm/state/multisig.js","../../node_modules/@solana/spl-token/lib/esm/extensions/cpiGuard/instructions.js","../../node_modules/@solana/spl-token/lib/esm/state/mint.js","../../node_modules/@solana/spl-token/lib/esm/extensions/defaultAccountState/instructions.js","../../node_modules/@solana/spl-token/lib/esm/extensions/cpiGuard/state.js","../../node_modules/@solana/spl-token/lib/esm/extensions/defaultAccountState/state.js","../../node_modules/@solana/spl-token/lib/esm/extensions/immutableOwner.js","../../node_modules/@solana/spl-token/lib/esm/extensions/memoTransfer/instructions.js","../../node_modules/@solana/spl-token/lib/esm/extensions/interestBearingMint/state.js","../../node_modules/@solana/spl-token/lib/esm/extensions/memoTransfer/state.js","../../node_modules/@solana/spl-token/lib/esm/extensions/mintCloseAuthority.js","../../node_modules/@solana/spl-token/lib/esm/extensions/nonTransferable.js","../../node_modules/@solana/spl-token/lib/esm/extensions/transferFee/instructions.js","../../node_modules/@solana/spl-token/lib/esm/extensions/transferFee/state.js","../../node_modules/@solana/spl-token/lib/esm/extensions/permanentDelegate.js","../../node_modules/@solana/spl-token/lib/esm/extensions/extensionType.js","../../node_modules/@solana/spl-token/lib/esm/instructions/initializeAccount.js","../../node_modules/@solana/spl-token/lib/esm/instructions/initializeMint2.js","../../node_modules/@solana/spl-token/lib/esm/instructions/initializeMultisig.js","../../node_modules/@solana/spl-token/lib/esm/instructions/createNativeMint.js","../../node_modules/@solana/spl-token/lib/esm/instructions/syncNative.js","../../node_modules/@solana/spl-token/lib/esm/instructions/freezeAccount.js","../../node_modules/@solana/spl-token/lib/esm/instructions/mintTo.js","../../node_modules/@solana/spl-token/lib/esm/instructions/mintToChecked.js","../../node_modules/@solana/spl-token/lib/esm/instructions/revoke.js","../../node_modules/@solana/spl-token/lib/esm/instructions/setAuthority.js","../../node_modules/@solana/spl-token/lib/esm/instructions/thawAccount.js","../../node_modules/@solana/spl-token/lib/esm/instructions/transfer.js","../../node_modules/@solana/spl-token/lib/esm/instructions/transferChecked.js","../../node_modules/@solana/spl-token/lib/esm/instructions/initializeMint.js","../../node_modules/@solana/spl-token/lib/esm/extensions/interestBearingMint/instructions.js","../../../src/helpers.ts","../../../src/parsers.ts","../../node_modules/@solana/spl-token/lib/esm/instructions/initializeAccount2.js","../../node_modules/@solana/spl-token/lib/esm/instructions/initializeAccount3.js","../../node_modules/@solana/spl-token/lib/esm/instructions/initializeImmutableOwner.js","../../node_modules/@solana/spl-token/lib/esm/instructions/initializeMintCloseAuthority.js","../../node_modules/@solana/spl-token/lib/esm/instructions/initializeNonTransferableMint.js","../../node_modules/@solana/spl-token/lib/esm/instructions/initializePermanentDelegate.js"],"sourcesContent":["'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n","/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nconst base64 = require('base64-js')\nconst ieee754 = require('ieee754')\nconst customInspectSymbol =\n (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation\n ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation\n : null\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\nconst K_MAX_LENGTH = 0x7fffffff\nexports.kMaxLength = K_MAX_LENGTH\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Print warning and recommend using `buffer` v4.x which has an Object\n * implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * We report that the browser does not support typed arrays if the are not subclassable\n * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`\n * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support\n * for __proto__ and has a buggy typed array implementation.\n */\nBuffer.TYPED_ARRAY_SUPPORT = typedArraySupport()\n\nif (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&\n typeof console.error === 'function') {\n console.error(\n 'This browser lacks typed array (Uint8Array) support which is required by ' +\n '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'\n )\n}\n\nfunction typedArraySupport () {\n // Can typed array instances can be augmented?\n try {\n const arr = new Uint8Array(1)\n const proto = { foo: function () { return 42 } }\n Object.setPrototypeOf(proto, Uint8Array.prototype)\n Object.setPrototypeOf(arr, proto)\n return arr.foo() === 42\n } catch (e) {\n return false\n }\n}\n\nObject.defineProperty(Buffer.prototype, 'parent', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.buffer\n }\n})\n\nObject.defineProperty(Buffer.prototype, 'offset', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.byteOffset\n }\n})\n\nfunction createBuffer (length) {\n if (length > K_MAX_LENGTH) {\n throw new RangeError('The value \"' + length + '\" is invalid for option \"size\"')\n }\n // Return an augmented `Uint8Array` instance\n const buf = new Uint8Array(length)\n Object.setPrototypeOf(buf, Buffer.prototype)\n return buf\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new TypeError(\n 'The \"string\" argument must be of type string. Received type number'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\nfunction from (value, encodingOrOffset, length) {\n if (typeof value === 'string') {\n return fromString(value, encodingOrOffset)\n }\n\n if (ArrayBuffer.isView(value)) {\n return fromArrayView(value)\n }\n\n if (value == null) {\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n }\n\n if (isInstance(value, ArrayBuffer) ||\n (value && isInstance(value.buffer, ArrayBuffer))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof SharedArrayBuffer !== 'undefined' &&\n (isInstance(value, SharedArrayBuffer) ||\n (value && isInstance(value.buffer, SharedArrayBuffer)))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof value === 'number') {\n throw new TypeError(\n 'The \"value\" argument must not be of type number. Received type number'\n )\n }\n\n const valueOf = value.valueOf && value.valueOf()\n if (valueOf != null && valueOf !== value) {\n return Buffer.from(valueOf, encodingOrOffset, length)\n }\n\n const b = fromObject(value)\n if (b) return b\n\n if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&\n typeof value[Symbol.toPrimitive] === 'function') {\n return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length)\n }\n\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(value, encodingOrOffset, length)\n}\n\n// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:\n// https://github.com/feross/buffer/pull/148\nObject.setPrototypeOf(Buffer.prototype, Uint8Array.prototype)\nObject.setPrototypeOf(Buffer, Uint8Array)\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be of type number')\n } else if (size < 0) {\n throw new RangeError('The value \"' + size + '\" is invalid for option \"size\"')\n }\n}\n\nfunction alloc (size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpreted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(size).fill(fill, encoding)\n : createBuffer(size).fill(fill)\n }\n return createBuffer(size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(size, fill, encoding)\n}\n\nfunction allocUnsafe (size) {\n assertSize(size)\n return createBuffer(size < 0 ? 0 : checked(size) | 0)\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(size)\n}\n\nfunction fromString (string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n\n const length = byteLength(string, encoding) | 0\n let buf = createBuffer(length)\n\n const actual = buf.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n buf = buf.slice(0, actual)\n }\n\n return buf\n}\n\nfunction fromArrayLike (array) {\n const length = array.length < 0 ? 0 : checked(array.length) | 0\n const buf = createBuffer(length)\n for (let i = 0; i < length; i += 1) {\n buf[i] = array[i] & 255\n }\n return buf\n}\n\nfunction fromArrayView (arrayView) {\n if (isInstance(arrayView, Uint8Array)) {\n const copy = new Uint8Array(arrayView)\n return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)\n }\n return fromArrayLike(arrayView)\n}\n\nfunction fromArrayBuffer (array, byteOffset, length) {\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\"offset\" is outside of buffer bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\"length\" is outside of buffer bounds')\n }\n\n let buf\n if (byteOffset === undefined && length === undefined) {\n buf = new Uint8Array(array)\n } else if (length === undefined) {\n buf = new Uint8Array(array, byteOffset)\n } else {\n buf = new Uint8Array(array, byteOffset, length)\n }\n\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(buf, Buffer.prototype)\n\n return buf\n}\n\nfunction fromObject (obj) {\n if (Buffer.isBuffer(obj)) {\n const len = checked(obj.length) | 0\n const buf = createBuffer(len)\n\n if (buf.length === 0) {\n return buf\n }\n\n obj.copy(buf, 0, 0, len)\n return buf\n }\n\n if (obj.length !== undefined) {\n if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {\n return createBuffer(0)\n }\n return fromArrayLike(obj)\n }\n\n if (obj.type === 'Buffer' && Array.isArray(obj.data)) {\n return fromArrayLike(obj.data)\n }\n}\n\nfunction checked (length) {\n // Note: cannot use `length < K_MAX_LENGTH` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= K_MAX_LENGTH) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return b != null && b._isBuffer === true &&\n b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false\n}\n\nBuffer.compare = function compare (a, b) {\n if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)\n if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError(\n 'The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array'\n )\n }\n\n if (a === b) return 0\n\n let x = a.length\n let y = b.length\n\n for (let i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!Array.isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n let i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n const buffer = Buffer.allocUnsafe(length)\n let pos = 0\n for (i = 0; i < list.length; ++i) {\n let buf = list[i]\n if (isInstance(buf, Uint8Array)) {\n if (pos + buf.length > buffer.length) {\n if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)\n buf.copy(buffer, pos)\n } else {\n Uint8Array.prototype.set.call(\n buffer,\n buf,\n pos\n )\n }\n } else if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n } else {\n buf.copy(buffer, pos)\n }\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n throw new TypeError(\n 'The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. ' +\n 'Received type ' + typeof string\n )\n }\n\n const len = string.length\n const mustMatch = (arguments.length > 2 && arguments[2] === true)\n if (!mustMatch && len === 0) return 0\n\n // Use a for loop to avoid recursion\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) {\n return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8\n }\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n let loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coercion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)\n// to detect a Buffer instance. It's not possible to use `instanceof Buffer`\n// reliably in a browserify context because there could be multiple different\n// copies of the 'buffer' package in use. This method works even for Buffer\n// instances that were created from another copy of the `buffer` package.\n// See: https://github.com/feross/buffer/issues/154\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n const i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n const len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (let i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n const len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (let i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n const len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (let i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n const length = this.length\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.toLocaleString = Buffer.prototype.toString\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n let str = ''\n const max = exports.INSPECT_MAX_BYTES\n str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()\n if (this.length > max) str += ' ... '\n return ''\n}\nif (customInspectSymbol) {\n Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (isInstance(target, Uint8Array)) {\n target = Buffer.from(target, target.offset, target.byteLength)\n }\n if (!Buffer.isBuffer(target)) {\n throw new TypeError(\n 'The \"target\" argument must be one of type Buffer or Uint8Array. ' +\n 'Received type ' + (typeof target)\n )\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n let x = thisEnd - thisStart\n let y = end - start\n const len = Math.min(x, y)\n\n const thisCopy = this.slice(thisStart, thisEnd)\n const targetCopy = target.slice(start, end)\n\n for (let i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (numberIsNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n let indexSize = 1\n let arrLength = arr.length\n let valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n let i\n if (dir) {\n let foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n let found = true\n for (let j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n const remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n const strLen = string.length\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n let i\n for (i = 0; i < length; ++i) {\n const parsed = parseInt(string.substr(i * 2, 2), 16)\n if (numberIsNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset >>> 0\n if (isFinite(length)) {\n length = length >>> 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n const remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n case 'latin1':\n case 'binary':\n return asciiWrite(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n const res = []\n\n let i = start\n while (i < end) {\n const firstByte = buf[i]\n let codePoint = null\n let bytesPerSequence = (firstByte > 0xEF)\n ? 4\n : (firstByte > 0xDF)\n ? 3\n : (firstByte > 0xBF)\n ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n let secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nconst MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n const len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n let res = ''\n let i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n const len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n let out = ''\n for (let i = start; i < end; ++i) {\n out += hexSliceLookupTable[buf[i]]\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n const bytes = buf.slice(start, end)\n let res = ''\n // If bytes.length is odd, the last 8 bits must be ignored (same as node.js)\n for (let i = 0; i < bytes.length - 1; i += 2) {\n res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n const len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n const newBuf = this.subarray(start, end)\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(newBuf, Buffer.prototype)\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUintLE =\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUintBE =\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n let val = this[offset + --byteLength]\n let mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUint8 =\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUint16LE =\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUint16BE =\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUint32LE =\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUint32BE =\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const lo = first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24\n\n const hi = this[++offset] +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n last * 2 ** 24\n\n return BigInt(lo) + (BigInt(hi) << BigInt(32))\n})\n\nBuffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const hi = first * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n const lo = this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last\n\n return (BigInt(hi) << BigInt(32)) + BigInt(lo)\n})\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let i = byteLength\n let mul = 1\n let val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = this[offset + 4] +\n this[offset + 5] * 2 ** 8 +\n this[offset + 6] * 2 ** 16 +\n (last << 24) // Overflow\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24)\n})\n\nBuffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = (first << 24) + // Overflow\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last)\n})\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUintLE =\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let mul = 1\n let i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUintBE =\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let i = byteLength - 1\n let mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUint8 =\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeUint16LE =\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeUint16BE =\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeUint32LE =\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeUint32BE =\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nfunction wrtBigUInt64LE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n return offset\n}\n\nfunction wrtBigUInt64BE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset + 7] = lo\n lo = lo >> 8\n buf[offset + 6] = lo\n lo = lo >> 8\n buf[offset + 5] = lo\n lo = lo >> 8\n buf[offset + 4] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset + 3] = hi\n hi = hi >> 8\n buf[offset + 2] = hi\n hi = hi >> 8\n buf[offset + 1] = hi\n hi = hi >> 8\n buf[offset] = hi\n return offset + 8\n}\n\nBuffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = 0\n let mul = 1\n let sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = byteLength - 1\n let mul = 1\n let sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nBuffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('Index out of range')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n const len = end - start\n\n if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {\n // Use built-in when available, missing from IE11\n this.copyWithin(targetStart, start, end)\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, end),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n if (val.length === 1) {\n const code = val.charCodeAt(0)\n if ((encoding === 'utf8' && code < 128) ||\n encoding === 'latin1') {\n // Fast path: If `val` fits into a single byte, use that numeric value.\n val = code\n }\n }\n } else if (typeof val === 'number') {\n val = val & 255\n } else if (typeof val === 'boolean') {\n val = Number(val)\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n let i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n const bytes = Buffer.isBuffer(val)\n ? val\n : Buffer.from(val, encoding)\n const len = bytes.length\n if (len === 0) {\n throw new TypeError('The value \"' + val +\n '\" is invalid for argument \"value\"')\n }\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// CUSTOM ERRORS\n// =============\n\n// Simplified versions from Node, changed for Buffer-only usage\nconst errors = {}\nfunction E (sym, getMessage, Base) {\n errors[sym] = class NodeError extends Base {\n constructor () {\n super()\n\n Object.defineProperty(this, 'message', {\n value: getMessage.apply(this, arguments),\n writable: true,\n configurable: true\n })\n\n // Add the error code to the name to include it in the stack trace.\n this.name = `${this.name} [${sym}]`\n // Access the stack to generate the error message including the error code\n // from the name.\n this.stack // eslint-disable-line no-unused-expressions\n // Reset the name to the actual name.\n delete this.name\n }\n\n get code () {\n return sym\n }\n\n set code (value) {\n Object.defineProperty(this, 'code', {\n configurable: true,\n enumerable: true,\n value,\n writable: true\n })\n }\n\n toString () {\n return `${this.name} [${sym}]: ${this.message}`\n }\n }\n}\n\nE('ERR_BUFFER_OUT_OF_BOUNDS',\n function (name) {\n if (name) {\n return `${name} is outside of buffer bounds`\n }\n\n return 'Attempt to access memory outside buffer bounds'\n }, RangeError)\nE('ERR_INVALID_ARG_TYPE',\n function (name, actual) {\n return `The \"${name}\" argument must be of type number. Received type ${typeof actual}`\n }, TypeError)\nE('ERR_OUT_OF_RANGE',\n function (str, range, input) {\n let msg = `The value of \"${str}\" is out of range.`\n let received = input\n if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {\n received = addNumericalSeparator(String(input))\n } else if (typeof input === 'bigint') {\n received = String(input)\n if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {\n received = addNumericalSeparator(received)\n }\n received += 'n'\n }\n msg += ` It must be ${range}. Received ${received}`\n return msg\n }, RangeError)\n\nfunction addNumericalSeparator (val) {\n let res = ''\n let i = val.length\n const start = val[0] === '-' ? 1 : 0\n for (; i >= start + 4; i -= 3) {\n res = `_${val.slice(i - 3, i)}${res}`\n }\n return `${val.slice(0, i)}${res}`\n}\n\n// CHECK FUNCTIONS\n// ===============\n\nfunction checkBounds (buf, offset, byteLength) {\n validateNumber(offset, 'offset')\n if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {\n boundsError(offset, buf.length - (byteLength + 1))\n }\n}\n\nfunction checkIntBI (value, min, max, buf, offset, byteLength) {\n if (value > max || value < min) {\n const n = typeof min === 'bigint' ? 'n' : ''\n let range\n if (byteLength > 3) {\n if (min === 0 || min === BigInt(0)) {\n range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`\n } else {\n range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` +\n `${(byteLength + 1) * 8 - 1}${n}`\n }\n } else {\n range = `>= ${min}${n} and <= ${max}${n}`\n }\n throw new errors.ERR_OUT_OF_RANGE('value', range, value)\n }\n checkBounds(buf, offset, byteLength)\n}\n\nfunction validateNumber (value, name) {\n if (typeof value !== 'number') {\n throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)\n }\n}\n\nfunction boundsError (value, length, type) {\n if (Math.floor(value) !== value) {\n validateNumber(value, type)\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value)\n }\n\n if (length < 0) {\n throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()\n }\n\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset',\n `>= ${type ? 1 : 0} and <= ${length}`,\n value)\n}\n\n// HELPER FUNCTIONS\n// ================\n\nconst INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node takes equal signs as end of the Base64 encoding\n str = str.split('=')[0]\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = str.trim().replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n let codePoint\n const length = string.length\n let leadSurrogate = null\n const bytes = []\n\n for (let i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n let c, hi, lo\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n let i\n for (i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\n// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass\n// the `instanceof` check but they should be treated as of that type.\n// See: https://github.com/feross/buffer/issues/166\nfunction isInstance (obj, type) {\n return obj instanceof type ||\n (obj != null && obj.constructor != null && obj.constructor.name != null &&\n obj.constructor.name === type.name)\n}\nfunction numberIsNaN (obj) {\n // For IE11 support\n return obj !== obj // eslint-disable-line no-self-compare\n}\n\n// Create lookup table for `toString('hex')`\n// See: https://github.com/feross/buffer/issues/219\nconst hexSliceLookupTable = (function () {\n const alphabet = '0123456789abcdef'\n const table = new Array(256)\n for (let i = 0; i < 16; ++i) {\n const i16 = i * 16\n for (let j = 0; j < 16; ++j) {\n table[i16 + j] = alphabet[i] + alphabet[j]\n }\n }\n return table\n})()\n\n// Return not function with Error if BigInt not supported\nfunction defineBigIntMethod (fn) {\n return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn\n}\n\nfunction BufferBigIntNotDefined () {\n throw new Error('BigInt not supported')\n}\n","import { PublicKey } from '@solana/web3.js';\n/** Address of the SPL Token program */\nexport const TOKEN_PROGRAM_ID = new PublicKey('TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA');\n/** Address of the SPL Token 2022 program */\nexport const TOKEN_2022_PROGRAM_ID = new PublicKey('TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb');\n/** Address of the SPL Associated Token Account program */\nexport const ASSOCIATED_TOKEN_PROGRAM_ID = new PublicKey('ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL');\n/** Address of the special mint for wrapped native SOL in spl-token */\nexport const NATIVE_MINT = new PublicKey('So11111111111111111111111111111111111111112');\n/** Address of the special mint for wrapped native SOL in spl-token-2022 */\nexport const NATIVE_MINT_2022 = new PublicKey('9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP');\n/** Check that the token program provided is not `Tokenkeg...`, useful when using extensions */\nexport function programSupportsExtensions(programId) {\n if (programId === TOKEN_PROGRAM_ID) {\n return false;\n }\n else {\n return true;\n }\n}\n//# sourceMappingURL=constants.js.map","/* The MIT License (MIT)\n *\n * Copyright 2015-2018 Peter A. Bigot\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n/**\n * Support for translating between Uint8Array instances and JavaScript\n * native types.\n *\n * {@link module:Layout~Layout|Layout} is the basis of a class\n * hierarchy that associates property names with sequences of encoded\n * bytes.\n *\n * Layouts are supported for these scalar (numeric) types:\n * * {@link module:Layout~UInt|Unsigned integers in little-endian\n * format} with {@link module:Layout.u8|8-bit}, {@link\n * module:Layout.u16|16-bit}, {@link module:Layout.u24|24-bit},\n * {@link module:Layout.u32|32-bit}, {@link\n * module:Layout.u40|40-bit}, and {@link module:Layout.u48|48-bit}\n * representation ranges;\n * * {@link module:Layout~UIntBE|Unsigned integers in big-endian\n * format} with {@link module:Layout.u16be|16-bit}, {@link\n * module:Layout.u24be|24-bit}, {@link module:Layout.u32be|32-bit},\n * {@link module:Layout.u40be|40-bit}, and {@link\n * module:Layout.u48be|48-bit} representation ranges;\n * * {@link module:Layout~Int|Signed integers in little-endian\n * format} with {@link module:Layout.s8|8-bit}, {@link\n * module:Layout.s16|16-bit}, {@link module:Layout.s24|24-bit},\n * {@link module:Layout.s32|32-bit}, {@link\n * module:Layout.s40|40-bit}, and {@link module:Layout.s48|48-bit}\n * representation ranges;\n * * {@link module:Layout~IntBE|Signed integers in big-endian format}\n * with {@link module:Layout.s16be|16-bit}, {@link\n * module:Layout.s24be|24-bit}, {@link module:Layout.s32be|32-bit},\n * {@link module:Layout.s40be|40-bit}, and {@link\n * module:Layout.s48be|48-bit} representation ranges;\n * * 64-bit integral values that decode to an exact (if magnitude is\n * less than 2^53) or nearby integral Number in {@link\n * module:Layout.nu64|unsigned little-endian}, {@link\n * module:Layout.nu64be|unsigned big-endian}, {@link\n * module:Layout.ns64|signed little-endian}, and {@link\n * module:Layout.ns64be|unsigned big-endian} encodings;\n * * 32-bit floating point values with {@link\n * module:Layout.f32|little-endian} and {@link\n * module:Layout.f32be|big-endian} representations;\n * * 64-bit floating point values with {@link\n * module:Layout.f64|little-endian} and {@link\n * module:Layout.f64be|big-endian} representations;\n * * {@link module:Layout.const|Constants} that take no space in the\n * encoded expression.\n *\n * and for these aggregate types:\n * * {@link module:Layout.seq|Sequence}s of instances of a {@link\n * module:Layout~Layout|Layout}, with JavaScript representation as\n * an Array and constant or data-dependent {@link\n * module:Layout~Sequence#count|length};\n * * {@link module:Layout.struct|Structure}s that aggregate a\n * heterogeneous sequence of {@link module:Layout~Layout|Layout}\n * instances, with JavaScript representation as an Object;\n * * {@link module:Layout.union|Union}s that support multiple {@link\n * module:Layout~VariantLayout|variant layouts} over a fixed\n * (padded) or variable (not padded) span of bytes, using an\n * unsigned integer at the start of the data or a separate {@link\n * module:Layout.unionLayoutDiscriminator|layout element} to\n * determine which layout to use when interpreting the buffer\n * contents;\n * * {@link module:Layout.bits|BitStructure}s that contain a sequence\n * of individual {@link\n * module:Layout~BitStructure#addField|BitField}s packed into an 8,\n * 16, 24, or 32-bit unsigned integer starting at the least- or\n * most-significant bit;\n * * {@link module:Layout.cstr|C strings} of varying length;\n * * {@link module:Layout.blob|Blobs} of fixed- or variable-{@link\n * module:Layout~Blob#length|length} raw data.\n *\n * All {@link module:Layout~Layout|Layout} instances are immutable\n * after construction, to prevent internal state from becoming\n * inconsistent.\n *\n * @local Layout\n * @local ExternalLayout\n * @local GreedyCount\n * @local OffsetLayout\n * @local UInt\n * @local UIntBE\n * @local Int\n * @local IntBE\n * @local NearUInt64\n * @local NearUInt64BE\n * @local NearInt64\n * @local NearInt64BE\n * @local Float\n * @local FloatBE\n * @local Double\n * @local DoubleBE\n * @local Sequence\n * @local Structure\n * @local UnionDiscriminator\n * @local UnionLayoutDiscriminator\n * @local Union\n * @local VariantLayout\n * @local BitStructure\n * @local BitField\n * @local Boolean\n * @local Blob\n * @local CString\n * @local Constant\n * @local bindConstructorLayout\n * @module Layout\n * @license MIT\n * @author Peter A. Bigot\n * @see {@link https://github.com/pabigot/buffer-layout|buffer-layout on GitHub}\n */\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.s16 = exports.s8 = exports.nu64be = exports.u48be = exports.u40be = exports.u32be = exports.u24be = exports.u16be = exports.nu64 = exports.u48 = exports.u40 = exports.u32 = exports.u24 = exports.u16 = exports.u8 = exports.offset = exports.greedy = exports.Constant = exports.UTF8 = exports.CString = exports.Blob = exports.Boolean = exports.BitField = exports.BitStructure = exports.VariantLayout = exports.Union = exports.UnionLayoutDiscriminator = exports.UnionDiscriminator = exports.Structure = exports.Sequence = exports.DoubleBE = exports.Double = exports.FloatBE = exports.Float = exports.NearInt64BE = exports.NearInt64 = exports.NearUInt64BE = exports.NearUInt64 = exports.IntBE = exports.Int = exports.UIntBE = exports.UInt = exports.OffsetLayout = exports.GreedyCount = exports.ExternalLayout = exports.bindConstructorLayout = exports.nameWithProperty = exports.Layout = exports.uint8ArrayToBuffer = exports.checkUint8Array = void 0;\nexports.constant = exports.utf8 = exports.cstr = exports.blob = exports.unionLayoutDiscriminator = exports.union = exports.seq = exports.bits = exports.struct = exports.f64be = exports.f64 = exports.f32be = exports.f32 = exports.ns64be = exports.s48be = exports.s40be = exports.s32be = exports.s24be = exports.s16be = exports.ns64 = exports.s48 = exports.s40 = exports.s32 = exports.s24 = void 0;\nconst buffer_1 = require(\"buffer\");\n/* Check if a value is a Uint8Array.\n *\n * @ignore */\nfunction checkUint8Array(b) {\n if (!(b instanceof Uint8Array)) {\n throw new TypeError('b must be a Uint8Array');\n }\n}\nexports.checkUint8Array = checkUint8Array;\n/* Create a Buffer instance from a Uint8Array.\n *\n * @ignore */\nfunction uint8ArrayToBuffer(b) {\n checkUint8Array(b);\n return buffer_1.Buffer.from(b.buffer, b.byteOffset, b.length);\n}\nexports.uint8ArrayToBuffer = uint8ArrayToBuffer;\n/**\n * Base class for layout objects.\n *\n * **NOTE** This is an abstract base class; you can create instances\n * if it amuses you, but they won't support the {@link\n * Layout#encode|encode} or {@link Layout#decode|decode} functions.\n *\n * @param {Number} span - Initializer for {@link Layout#span|span}. The\n * parameter must be an integer; a negative value signifies that the\n * span is {@link Layout#getSpan|value-specific}.\n *\n * @param {string} [property] - Initializer for {@link\n * Layout#property|property}.\n *\n * @abstract\n */\nclass Layout {\n constructor(span, property) {\n if (!Number.isInteger(span)) {\n throw new TypeError('span must be an integer');\n }\n /** The span of the layout in bytes.\n *\n * Positive values are generally expected.\n *\n * Zero will only appear in {@link Constant}s and in {@link\n * Sequence}s where the {@link Sequence#count|count} is zero.\n *\n * A negative value indicates that the span is value-specific, and\n * must be obtained using {@link Layout#getSpan|getSpan}. */\n this.span = span;\n /** The property name used when this layout is represented in an\n * Object.\n *\n * Used only for layouts that {@link Layout#decode|decode} to Object\n * instances. If left undefined the span of the unnamed layout will\n * be treated as padding: it will not be mutated by {@link\n * Layout#encode|encode} nor represented as a property in the\n * decoded Object. */\n this.property = property;\n }\n /** Function to create an Object into which decoded properties will\n * be written.\n *\n * Used only for layouts that {@link Layout#decode|decode} to Object\n * instances, which means:\n * * {@link Structure}\n * * {@link Union}\n * * {@link VariantLayout}\n * * {@link BitStructure}\n *\n * If left undefined the JavaScript representation of these layouts\n * will be Object instances.\n *\n * See {@link bindConstructorLayout}.\n */\n makeDestinationObject() {\n return {};\n }\n /**\n * Calculate the span of a specific instance of a layout.\n *\n * @param {Uint8Array} b - the buffer that contains an encoded instance.\n *\n * @param {Number} [offset] - the offset at which the encoded instance\n * starts. If absent a zero offset is inferred.\n *\n * @return {Number} - the number of bytes covered by the layout\n * instance. If this method is not overridden in a subclass the\n * definition-time constant {@link Layout#span|span} will be\n * returned.\n *\n * @throws {RangeError} - if the length of the value cannot be\n * determined.\n */\n getSpan(b, offset) {\n if (0 > this.span) {\n throw new RangeError('indeterminate span');\n }\n return this.span;\n }\n /**\n * Replicate the layout using a new property.\n *\n * This function must be used to get a structurally-equivalent layout\n * with a different name since all {@link Layout} instances are\n * immutable.\n *\n * **NOTE** This is a shallow copy. All fields except {@link\n * Layout#property|property} are strictly equal to the origin layout.\n *\n * @param {String} property - the value for {@link\n * Layout#property|property} in the replica.\n *\n * @returns {Layout} - the copy with {@link Layout#property|property}\n * set to `property`.\n */\n replicate(property) {\n const rv = Object.create(this.constructor.prototype);\n Object.assign(rv, this);\n rv.property = property;\n return rv;\n }\n /**\n * Create an object from layout properties and an array of values.\n *\n * **NOTE** This function returns `undefined` if invoked on a layout\n * that does not return its value as an Object. Objects are\n * returned for things that are a {@link Structure}, which includes\n * {@link VariantLayout|variant layouts} if they are structures, and\n * excludes {@link Union}s. If you want this feature for a union\n * you must use {@link Union.getVariant|getVariant} to select the\n * desired layout.\n *\n * @param {Array} values - an array of values that correspond to the\n * default order for properties. As with {@link Layout#decode|decode}\n * layout elements that have no property name are skipped when\n * iterating over the array values. Only the top-level properties are\n * assigned; arguments are not assigned to properties of contained\n * layouts. Any unused values are ignored.\n *\n * @return {(Object|undefined)}\n */\n fromArray(values) {\n return undefined;\n }\n}\nexports.Layout = Layout;\n/* Provide text that carries a name (such as for a function that will\n * be throwing an error) annotated with the property of a given layout\n * (such as one for which the value was unacceptable).\n *\n * @ignore */\nfunction nameWithProperty(name, lo) {\n if (lo.property) {\n return name + '[' + lo.property + ']';\n }\n return name;\n}\nexports.nameWithProperty = nameWithProperty;\n/**\n * Augment a class so that instances can be encoded/decoded using a\n * given layout.\n *\n * Calling this function couples `Class` with `layout` in several ways:\n *\n * * `Class.layout_` becomes a static member property equal to `layout`;\n * * `layout.boundConstructor_` becomes a static member property equal\n * to `Class`;\n * * The {@link Layout#makeDestinationObject|makeDestinationObject()}\n * property of `layout` is set to a function that returns a `new\n * Class()`;\n * * `Class.decode(b, offset)` becomes a static member function that\n * delegates to {@link Layout#decode|layout.decode}. The\n * synthesized function may be captured and extended.\n * * `Class.prototype.encode(b, offset)` provides an instance member\n * function that delegates to {@link Layout#encode|layout.encode}\n * with `src` set to `this`. The synthesized function may be\n * captured and extended, but when the extension is invoked `this`\n * must be explicitly bound to the instance.\n *\n * @param {class} Class - a JavaScript class with a nullary\n * constructor.\n *\n * @param {Layout} layout - the {@link Layout} instance used to encode\n * instances of `Class`.\n */\n// `Class` must be a constructor Function, but the assignment of a `layout_` property to it makes it difficult to type\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nfunction bindConstructorLayout(Class, layout) {\n if ('function' !== typeof Class) {\n throw new TypeError('Class must be constructor');\n }\n if (Object.prototype.hasOwnProperty.call(Class, 'layout_')) {\n throw new Error('Class is already bound to a layout');\n }\n if (!(layout && (layout instanceof Layout))) {\n throw new TypeError('layout must be a Layout');\n }\n if (Object.prototype.hasOwnProperty.call(layout, 'boundConstructor_')) {\n throw new Error('layout is already bound to a constructor');\n }\n Class.layout_ = layout;\n layout.boundConstructor_ = Class;\n layout.makeDestinationObject = (() => new Class());\n Object.defineProperty(Class.prototype, 'encode', {\n value(b, offset) {\n return layout.encode(this, b, offset);\n },\n writable: true,\n });\n Object.defineProperty(Class, 'decode', {\n value(b, offset) {\n return layout.decode(b, offset);\n },\n writable: true,\n });\n}\nexports.bindConstructorLayout = bindConstructorLayout;\n/**\n * An object that behaves like a layout but does not consume space\n * within its containing layout.\n *\n * This is primarily used to obtain metadata about a member, such as a\n * {@link OffsetLayout} that can provide data about a {@link\n * Layout#getSpan|value-specific span}.\n *\n * **NOTE** This is an abstract base class; you can create instances\n * if it amuses you, but they won't support {@link\n * ExternalLayout#isCount|isCount} or other {@link Layout} functions.\n *\n * @param {Number} span - initializer for {@link Layout#span|span}.\n * The parameter can range from 1 through 6.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @abstract\n * @augments {Layout}\n */\nclass ExternalLayout extends Layout {\n /**\n * Return `true` iff the external layout decodes to an unsigned\n * integer layout.\n *\n * In that case it can be used as the source of {@link\n * Sequence#count|Sequence counts}, {@link Blob#length|Blob lengths},\n * or as {@link UnionLayoutDiscriminator#layout|external union\n * discriminators}.\n *\n * @abstract\n */\n isCount() {\n throw new Error('ExternalLayout is abstract');\n }\n}\nexports.ExternalLayout = ExternalLayout;\n/**\n * An {@link ExternalLayout} that determines its {@link\n * Layout#decode|value} based on offset into and length of the buffer\n * on which it is invoked.\n *\n * *Factory*: {@link module:Layout.greedy|greedy}\n *\n * @param {Number} [elementSpan] - initializer for {@link\n * GreedyCount#elementSpan|elementSpan}.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {ExternalLayout}\n */\nclass GreedyCount extends ExternalLayout {\n constructor(elementSpan = 1, property) {\n if ((!Number.isInteger(elementSpan)) || (0 >= elementSpan)) {\n throw new TypeError('elementSpan must be a (positive) integer');\n }\n super(-1, property);\n /** The layout for individual elements of the sequence. The value\n * must be a positive integer. If not provided, the value will be\n * 1. */\n this.elementSpan = elementSpan;\n }\n /** @override */\n isCount() {\n return true;\n }\n /** @override */\n decode(b, offset = 0) {\n checkUint8Array(b);\n const rem = b.length - offset;\n return Math.floor(rem / this.elementSpan);\n }\n /** @override */\n encode(src, b, offset) {\n return 0;\n }\n}\nexports.GreedyCount = GreedyCount;\n/**\n * An {@link ExternalLayout} that supports accessing a {@link Layout}\n * at a fixed offset from the start of another Layout. The offset may\n * be before, within, or after the base layout.\n *\n * *Factory*: {@link module:Layout.offset|offset}\n *\n * @param {Layout} layout - initializer for {@link\n * OffsetLayout#layout|layout}, modulo `property`.\n *\n * @param {Number} [offset] - Initializes {@link\n * OffsetLayout#offset|offset}. Defaults to zero.\n *\n * @param {string} [property] - Optional new property name for a\n * {@link Layout#replicate| replica} of `layout` to be used as {@link\n * OffsetLayout#layout|layout}. If not provided the `layout` is used\n * unchanged.\n *\n * @augments {Layout}\n */\nclass OffsetLayout extends ExternalLayout {\n constructor(layout, offset = 0, property) {\n if (!(layout instanceof Layout)) {\n throw new TypeError('layout must be a Layout');\n }\n if (!Number.isInteger(offset)) {\n throw new TypeError('offset must be integer or undefined');\n }\n super(layout.span, property || layout.property);\n /** The subordinated layout. */\n this.layout = layout;\n /** The location of {@link OffsetLayout#layout} relative to the\n * start of another layout.\n *\n * The value may be positive or negative, but an error will thrown\n * if at the point of use it goes outside the span of the Uint8Array\n * being accessed. */\n this.offset = offset;\n }\n /** @override */\n isCount() {\n return ((this.layout instanceof UInt)\n || (this.layout instanceof UIntBE));\n }\n /** @override */\n decode(b, offset = 0) {\n return this.layout.decode(b, offset + this.offset);\n }\n /** @override */\n encode(src, b, offset = 0) {\n return this.layout.encode(src, b, offset + this.offset);\n }\n}\nexports.OffsetLayout = OffsetLayout;\n/**\n * Represent an unsigned integer in little-endian format.\n *\n * *Factory*: {@link module:Layout.u8|u8}, {@link\n * module:Layout.u16|u16}, {@link module:Layout.u24|u24}, {@link\n * module:Layout.u32|u32}, {@link module:Layout.u40|u40}, {@link\n * module:Layout.u48|u48}\n *\n * @param {Number} span - initializer for {@link Layout#span|span}.\n * The parameter can range from 1 through 6.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass UInt extends Layout {\n constructor(span, property) {\n super(span, property);\n if (6 < this.span) {\n throw new RangeError('span must not exceed 6 bytes');\n }\n }\n /** @override */\n decode(b, offset = 0) {\n return uint8ArrayToBuffer(b).readUIntLE(offset, this.span);\n }\n /** @override */\n encode(src, b, offset = 0) {\n uint8ArrayToBuffer(b).writeUIntLE(src, offset, this.span);\n return this.span;\n }\n}\nexports.UInt = UInt;\n/**\n * Represent an unsigned integer in big-endian format.\n *\n * *Factory*: {@link module:Layout.u8be|u8be}, {@link\n * module:Layout.u16be|u16be}, {@link module:Layout.u24be|u24be},\n * {@link module:Layout.u32be|u32be}, {@link\n * module:Layout.u40be|u40be}, {@link module:Layout.u48be|u48be}\n *\n * @param {Number} span - initializer for {@link Layout#span|span}.\n * The parameter can range from 1 through 6.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass UIntBE extends Layout {\n constructor(span, property) {\n super(span, property);\n if (6 < this.span) {\n throw new RangeError('span must not exceed 6 bytes');\n }\n }\n /** @override */\n decode(b, offset = 0) {\n return uint8ArrayToBuffer(b).readUIntBE(offset, this.span);\n }\n /** @override */\n encode(src, b, offset = 0) {\n uint8ArrayToBuffer(b).writeUIntBE(src, offset, this.span);\n return this.span;\n }\n}\nexports.UIntBE = UIntBE;\n/**\n * Represent a signed integer in little-endian format.\n *\n * *Factory*: {@link module:Layout.s8|s8}, {@link\n * module:Layout.s16|s16}, {@link module:Layout.s24|s24}, {@link\n * module:Layout.s32|s32}, {@link module:Layout.s40|s40}, {@link\n * module:Layout.s48|s48}\n *\n * @param {Number} span - initializer for {@link Layout#span|span}.\n * The parameter can range from 1 through 6.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass Int extends Layout {\n constructor(span, property) {\n super(span, property);\n if (6 < this.span) {\n throw new RangeError('span must not exceed 6 bytes');\n }\n }\n /** @override */\n decode(b, offset = 0) {\n return uint8ArrayToBuffer(b).readIntLE(offset, this.span);\n }\n /** @override */\n encode(src, b, offset = 0) {\n uint8ArrayToBuffer(b).writeIntLE(src, offset, this.span);\n return this.span;\n }\n}\nexports.Int = Int;\n/**\n * Represent a signed integer in big-endian format.\n *\n * *Factory*: {@link module:Layout.s8be|s8be}, {@link\n * module:Layout.s16be|s16be}, {@link module:Layout.s24be|s24be},\n * {@link module:Layout.s32be|s32be}, {@link\n * module:Layout.s40be|s40be}, {@link module:Layout.s48be|s48be}\n *\n * @param {Number} span - initializer for {@link Layout#span|span}.\n * The parameter can range from 1 through 6.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass IntBE extends Layout {\n constructor(span, property) {\n super(span, property);\n if (6 < this.span) {\n throw new RangeError('span must not exceed 6 bytes');\n }\n }\n /** @override */\n decode(b, offset = 0) {\n return uint8ArrayToBuffer(b).readIntBE(offset, this.span);\n }\n /** @override */\n encode(src, b, offset = 0) {\n uint8ArrayToBuffer(b).writeIntBE(src, offset, this.span);\n return this.span;\n }\n}\nexports.IntBE = IntBE;\nconst V2E32 = Math.pow(2, 32);\n/* True modulus high and low 32-bit words, where low word is always\n * non-negative. */\nfunction divmodInt64(src) {\n const hi32 = Math.floor(src / V2E32);\n const lo32 = src - (hi32 * V2E32);\n return { hi32, lo32 };\n}\n/* Reconstruct Number from quotient and non-negative remainder */\nfunction roundedInt64(hi32, lo32) {\n return hi32 * V2E32 + lo32;\n}\n/**\n * Represent an unsigned 64-bit integer in little-endian format when\n * encoded and as a near integral JavaScript Number when decoded.\n *\n * *Factory*: {@link module:Layout.nu64|nu64}\n *\n * **NOTE** Values with magnitude greater than 2^52 may not decode to\n * the exact value of the encoded representation.\n *\n * @augments {Layout}\n */\nclass NearUInt64 extends Layout {\n constructor(property) {\n super(8, property);\n }\n /** @override */\n decode(b, offset = 0) {\n const buffer = uint8ArrayToBuffer(b);\n const lo32 = buffer.readUInt32LE(offset);\n const hi32 = buffer.readUInt32LE(offset + 4);\n return roundedInt64(hi32, lo32);\n }\n /** @override */\n encode(src, b, offset = 0) {\n const split = divmodInt64(src);\n const buffer = uint8ArrayToBuffer(b);\n buffer.writeUInt32LE(split.lo32, offset);\n buffer.writeUInt32LE(split.hi32, offset + 4);\n return 8;\n }\n}\nexports.NearUInt64 = NearUInt64;\n/**\n * Represent an unsigned 64-bit integer in big-endian format when\n * encoded and as a near integral JavaScript Number when decoded.\n *\n * *Factory*: {@link module:Layout.nu64be|nu64be}\n *\n * **NOTE** Values with magnitude greater than 2^52 may not decode to\n * the exact value of the encoded representation.\n *\n * @augments {Layout}\n */\nclass NearUInt64BE extends Layout {\n constructor(property) {\n super(8, property);\n }\n /** @override */\n decode(b, offset = 0) {\n const buffer = uint8ArrayToBuffer(b);\n const hi32 = buffer.readUInt32BE(offset);\n const lo32 = buffer.readUInt32BE(offset + 4);\n return roundedInt64(hi32, lo32);\n }\n /** @override */\n encode(src, b, offset = 0) {\n const split = divmodInt64(src);\n const buffer = uint8ArrayToBuffer(b);\n buffer.writeUInt32BE(split.hi32, offset);\n buffer.writeUInt32BE(split.lo32, offset + 4);\n return 8;\n }\n}\nexports.NearUInt64BE = NearUInt64BE;\n/**\n * Represent a signed 64-bit integer in little-endian format when\n * encoded and as a near integral JavaScript Number when decoded.\n *\n * *Factory*: {@link module:Layout.ns64|ns64}\n *\n * **NOTE** Values with magnitude greater than 2^52 may not decode to\n * the exact value of the encoded representation.\n *\n * @augments {Layout}\n */\nclass NearInt64 extends Layout {\n constructor(property) {\n super(8, property);\n }\n /** @override */\n decode(b, offset = 0) {\n const buffer = uint8ArrayToBuffer(b);\n const lo32 = buffer.readUInt32LE(offset);\n const hi32 = buffer.readInt32LE(offset + 4);\n return roundedInt64(hi32, lo32);\n }\n /** @override */\n encode(src, b, offset = 0) {\n const split = divmodInt64(src);\n const buffer = uint8ArrayToBuffer(b);\n buffer.writeUInt32LE(split.lo32, offset);\n buffer.writeInt32LE(split.hi32, offset + 4);\n return 8;\n }\n}\nexports.NearInt64 = NearInt64;\n/**\n * Represent a signed 64-bit integer in big-endian format when\n * encoded and as a near integral JavaScript Number when decoded.\n *\n * *Factory*: {@link module:Layout.ns64be|ns64be}\n *\n * **NOTE** Values with magnitude greater than 2^52 may not decode to\n * the exact value of the encoded representation.\n *\n * @augments {Layout}\n */\nclass NearInt64BE extends Layout {\n constructor(property) {\n super(8, property);\n }\n /** @override */\n decode(b, offset = 0) {\n const buffer = uint8ArrayToBuffer(b);\n const hi32 = buffer.readInt32BE(offset);\n const lo32 = buffer.readUInt32BE(offset + 4);\n return roundedInt64(hi32, lo32);\n }\n /** @override */\n encode(src, b, offset = 0) {\n const split = divmodInt64(src);\n const buffer = uint8ArrayToBuffer(b);\n buffer.writeInt32BE(split.hi32, offset);\n buffer.writeUInt32BE(split.lo32, offset + 4);\n return 8;\n }\n}\nexports.NearInt64BE = NearInt64BE;\n/**\n * Represent a 32-bit floating point number in little-endian format.\n *\n * *Factory*: {@link module:Layout.f32|f32}\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass Float extends Layout {\n constructor(property) {\n super(4, property);\n }\n /** @override */\n decode(b, offset = 0) {\n return uint8ArrayToBuffer(b).readFloatLE(offset);\n }\n /** @override */\n encode(src, b, offset = 0) {\n uint8ArrayToBuffer(b).writeFloatLE(src, offset);\n return 4;\n }\n}\nexports.Float = Float;\n/**\n * Represent a 32-bit floating point number in big-endian format.\n *\n * *Factory*: {@link module:Layout.f32be|f32be}\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass FloatBE extends Layout {\n constructor(property) {\n super(4, property);\n }\n /** @override */\n decode(b, offset = 0) {\n return uint8ArrayToBuffer(b).readFloatBE(offset);\n }\n /** @override */\n encode(src, b, offset = 0) {\n uint8ArrayToBuffer(b).writeFloatBE(src, offset);\n return 4;\n }\n}\nexports.FloatBE = FloatBE;\n/**\n * Represent a 64-bit floating point number in little-endian format.\n *\n * *Factory*: {@link module:Layout.f64|f64}\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass Double extends Layout {\n constructor(property) {\n super(8, property);\n }\n /** @override */\n decode(b, offset = 0) {\n return uint8ArrayToBuffer(b).readDoubleLE(offset);\n }\n /** @override */\n encode(src, b, offset = 0) {\n uint8ArrayToBuffer(b).writeDoubleLE(src, offset);\n return 8;\n }\n}\nexports.Double = Double;\n/**\n * Represent a 64-bit floating point number in big-endian format.\n *\n * *Factory*: {@link module:Layout.f64be|f64be}\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass DoubleBE extends Layout {\n constructor(property) {\n super(8, property);\n }\n /** @override */\n decode(b, offset = 0) {\n return uint8ArrayToBuffer(b).readDoubleBE(offset);\n }\n /** @override */\n encode(src, b, offset = 0) {\n uint8ArrayToBuffer(b).writeDoubleBE(src, offset);\n return 8;\n }\n}\nexports.DoubleBE = DoubleBE;\n/**\n * Represent a contiguous sequence of a specific layout as an Array.\n *\n * *Factory*: {@link module:Layout.seq|seq}\n *\n * @param {Layout} elementLayout - initializer for {@link\n * Sequence#elementLayout|elementLayout}.\n *\n * @param {(Number|ExternalLayout)} count - initializer for {@link\n * Sequence#count|count}. The parameter must be either a positive\n * integer or an instance of {@link ExternalLayout}.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass Sequence extends Layout {\n constructor(elementLayout, count, property) {\n if (!(elementLayout instanceof Layout)) {\n throw new TypeError('elementLayout must be a Layout');\n }\n if (!(((count instanceof ExternalLayout) && count.isCount())\n || (Number.isInteger(count) && (0 <= count)))) {\n throw new TypeError('count must be non-negative integer '\n + 'or an unsigned integer ExternalLayout');\n }\n let span = -1;\n if ((!(count instanceof ExternalLayout))\n && (0 < elementLayout.span)) {\n span = count * elementLayout.span;\n }\n super(span, property);\n /** The layout for individual elements of the sequence. */\n this.elementLayout = elementLayout;\n /** The number of elements in the sequence.\n *\n * This will be either a non-negative integer or an instance of\n * {@link ExternalLayout} for which {@link\n * ExternalLayout#isCount|isCount()} is `true`. */\n this.count = count;\n }\n /** @override */\n getSpan(b, offset = 0) {\n if (0 <= this.span) {\n return this.span;\n }\n let span = 0;\n let count = this.count;\n if (count instanceof ExternalLayout) {\n count = count.decode(b, offset);\n }\n if (0 < this.elementLayout.span) {\n span = count * this.elementLayout.span;\n }\n else {\n let idx = 0;\n while (idx < count) {\n span += this.elementLayout.getSpan(b, offset + span);\n ++idx;\n }\n }\n return span;\n }\n /** @override */\n decode(b, offset = 0) {\n const rv = [];\n let i = 0;\n let count = this.count;\n if (count instanceof ExternalLayout) {\n count = count.decode(b, offset);\n }\n while (i < count) {\n rv.push(this.elementLayout.decode(b, offset));\n offset += this.elementLayout.getSpan(b, offset);\n i += 1;\n }\n return rv;\n }\n /** Implement {@link Layout#encode|encode} for {@link Sequence}.\n *\n * **NOTE** If `src` is shorter than {@link Sequence#count|count} then\n * the unused space in the buffer is left unchanged. If `src` is\n * longer than {@link Sequence#count|count} the unneeded elements are\n * ignored.\n *\n * **NOTE** If {@link Layout#count|count} is an instance of {@link\n * ExternalLayout} then the length of `src` will be encoded as the\n * count after `src` is encoded. */\n encode(src, b, offset = 0) {\n const elo = this.elementLayout;\n const span = src.reduce((span, v) => {\n return span + elo.encode(v, b, offset + span);\n }, 0);\n if (this.count instanceof ExternalLayout) {\n this.count.encode(src.length, b, offset);\n }\n return span;\n }\n}\nexports.Sequence = Sequence;\n/**\n * Represent a contiguous sequence of arbitrary layout elements as an\n * Object.\n *\n * *Factory*: {@link module:Layout.struct|struct}\n *\n * **NOTE** The {@link Layout#span|span} of the structure is variable\n * if any layout in {@link Structure#fields|fields} has a variable\n * span. When {@link Layout#encode|encoding} we must have a value for\n * all variable-length fields, or we wouldn't be able to figure out\n * how much space to use for storage. We can only identify the value\n * for a field when it has a {@link Layout#property|property}. As\n * such, although a structure may contain both unnamed fields and\n * variable-length fields, it cannot contain an unnamed\n * variable-length field.\n *\n * @param {Layout[]} fields - initializer for {@link\n * Structure#fields|fields}. An error is raised if this contains a\n * variable-length field for which a {@link Layout#property|property}\n * is not defined.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @param {Boolean} [decodePrefixes] - initializer for {@link\n * Structure#decodePrefixes|property}.\n *\n * @throws {Error} - if `fields` contains an unnamed variable-length\n * layout.\n *\n * @augments {Layout}\n */\nclass Structure extends Layout {\n constructor(fields, property, decodePrefixes) {\n if (!(Array.isArray(fields)\n && fields.reduce((acc, v) => acc && (v instanceof Layout), true))) {\n throw new TypeError('fields must be array of Layout instances');\n }\n if (('boolean' === typeof property)\n && (undefined === decodePrefixes)) {\n decodePrefixes = property;\n property = undefined;\n }\n /* Verify absence of unnamed variable-length fields. */\n for (const fd of fields) {\n if ((0 > fd.span)\n && (undefined === fd.property)) {\n throw new Error('fields cannot contain unnamed variable-length layout');\n }\n }\n let span = -1;\n try {\n span = fields.reduce((span, fd) => span + fd.getSpan(), 0);\n }\n catch (e) {\n // ignore error\n }\n super(span, property);\n /** The sequence of {@link Layout} values that comprise the\n * structure.\n *\n * The individual elements need not be the same type, and may be\n * either scalar or aggregate layouts. If a member layout leaves\n * its {@link Layout#property|property} undefined the\n * corresponding region of the buffer associated with the element\n * will not be mutated.\n *\n * @type {Layout[]} */\n this.fields = fields;\n /** Control behavior of {@link Layout#decode|decode()} given short\n * buffers.\n *\n * In some situations a structure many be extended with additional\n * fields over time, with older installations providing only a\n * prefix of the full structure. If this property is `true`\n * decoding will accept those buffers and leave subsequent fields\n * undefined, as long as the buffer ends at a field boundary.\n * Defaults to `false`. */\n this.decodePrefixes = !!decodePrefixes;\n }\n /** @override */\n getSpan(b, offset = 0) {\n if (0 <= this.span) {\n return this.span;\n }\n let span = 0;\n try {\n span = this.fields.reduce((span, fd) => {\n const fsp = fd.getSpan(b, offset);\n offset += fsp;\n return span + fsp;\n }, 0);\n }\n catch (e) {\n throw new RangeError('indeterminate span');\n }\n return span;\n }\n /** @override */\n decode(b, offset = 0) {\n checkUint8Array(b);\n const dest = this.makeDestinationObject();\n for (const fd of this.fields) {\n if (undefined !== fd.property) {\n dest[fd.property] = fd.decode(b, offset);\n }\n offset += fd.getSpan(b, offset);\n if (this.decodePrefixes\n && (b.length === offset)) {\n break;\n }\n }\n return dest;\n }\n /** Implement {@link Layout#encode|encode} for {@link Structure}.\n *\n * If `src` is missing a property for a member with a defined {@link\n * Layout#property|property} the corresponding region of the buffer is\n * left unmodified. */\n encode(src, b, offset = 0) {\n const firstOffset = offset;\n let lastOffset = 0;\n let lastWrote = 0;\n for (const fd of this.fields) {\n let span = fd.span;\n lastWrote = (0 < span) ? span : 0;\n if (undefined !== fd.property) {\n const fv = src[fd.property];\n if (undefined !== fv) {\n lastWrote = fd.encode(fv, b, offset);\n if (0 > span) {\n /* Read the as-encoded span, which is not necessarily the\n * same as what we wrote. */\n span = fd.getSpan(b, offset);\n }\n }\n }\n lastOffset = offset;\n offset += span;\n }\n /* Use (lastOffset + lastWrote) instead of offset because the last\n * item may have had a dynamic length and we don't want to include\n * the padding between it and the end of the space reserved for\n * it. */\n return (lastOffset + lastWrote) - firstOffset;\n }\n /** @override */\n fromArray(values) {\n const dest = this.makeDestinationObject();\n for (const fd of this.fields) {\n if ((undefined !== fd.property)\n && (0 < values.length)) {\n dest[fd.property] = values.shift();\n }\n }\n return dest;\n }\n /**\n * Get access to the layout of a given property.\n *\n * @param {String} property - the structure member of interest.\n *\n * @return {Layout} - the layout associated with `property`, or\n * undefined if there is no such property.\n */\n layoutFor(property) {\n if ('string' !== typeof property) {\n throw new TypeError('property must be string');\n }\n for (const fd of this.fields) {\n if (fd.property === property) {\n return fd;\n }\n }\n return undefined;\n }\n /**\n * Get the offset of a structure member.\n *\n * @param {String} property - the structure member of interest.\n *\n * @return {Number} - the offset in bytes to the start of `property`\n * within the structure, or undefined if `property` is not a field\n * within the structure. If the property is a member but follows a\n * variable-length structure member a negative number will be\n * returned.\n */\n offsetOf(property) {\n if ('string' !== typeof property) {\n throw new TypeError('property must be string');\n }\n let offset = 0;\n for (const fd of this.fields) {\n if (fd.property === property) {\n return offset;\n }\n if (0 > fd.span) {\n offset = -1;\n }\n else if (0 <= offset) {\n offset += fd.span;\n }\n }\n return undefined;\n }\n}\nexports.Structure = Structure;\n/**\n * An object that can provide a {@link\n * Union#discriminator|discriminator} API for {@link Union}.\n *\n * **NOTE** This is an abstract base class; you can create instances\n * if it amuses you, but they won't support the {@link\n * UnionDiscriminator#encode|encode} or {@link\n * UnionDiscriminator#decode|decode} functions.\n *\n * @param {string} [property] - Default for {@link\n * UnionDiscriminator#property|property}.\n *\n * @abstract\n */\nclass UnionDiscriminator {\n constructor(property) {\n /** The {@link Layout#property|property} to be used when the\n * discriminator is referenced in isolation (generally when {@link\n * Union#decode|Union decode} cannot delegate to a specific\n * variant). */\n this.property = property;\n }\n /** Analog to {@link Layout#decode|Layout decode} for union discriminators.\n *\n * The implementation of this method need not reference the buffer if\n * variant information is available through other means. */\n decode(b, offset) {\n throw new Error('UnionDiscriminator is abstract');\n }\n /** Analog to {@link Layout#decode|Layout encode} for union discriminators.\n *\n * The implementation of this method need not store the value if\n * variant information is maintained through other means. */\n encode(src, b, offset) {\n throw new Error('UnionDiscriminator is abstract');\n }\n}\nexports.UnionDiscriminator = UnionDiscriminator;\n/**\n * An object that can provide a {@link\n * UnionDiscriminator|discriminator API} for {@link Union} using an\n * unsigned integral {@link Layout} instance located either inside or\n * outside the union.\n *\n * @param {ExternalLayout} layout - initializes {@link\n * UnionLayoutDiscriminator#layout|layout}. Must satisfy {@link\n * ExternalLayout#isCount|isCount()}.\n *\n * @param {string} [property] - Default for {@link\n * UnionDiscriminator#property|property}, superseding the property\n * from `layout`, but defaulting to `variant` if neither `property`\n * nor layout provide a property name.\n *\n * @augments {UnionDiscriminator}\n */\nclass UnionLayoutDiscriminator extends UnionDiscriminator {\n constructor(layout, property) {\n if (!((layout instanceof ExternalLayout)\n && layout.isCount())) {\n throw new TypeError('layout must be an unsigned integer ExternalLayout');\n }\n super(property || layout.property || 'variant');\n /** The {@link ExternalLayout} used to access the discriminator\n * value. */\n this.layout = layout;\n }\n /** Delegate decoding to {@link UnionLayoutDiscriminator#layout|layout}. */\n decode(b, offset) {\n return this.layout.decode(b, offset);\n }\n /** Delegate encoding to {@link UnionLayoutDiscriminator#layout|layout}. */\n encode(src, b, offset) {\n return this.layout.encode(src, b, offset);\n }\n}\nexports.UnionLayoutDiscriminator = UnionLayoutDiscriminator;\n/**\n * Represent any number of span-compatible layouts.\n *\n * *Factory*: {@link module:Layout.union|union}\n *\n * If the union has a {@link Union#defaultLayout|default layout} that\n * layout must have a non-negative {@link Layout#span|span}. The span\n * of a fixed-span union includes its {@link\n * Union#discriminator|discriminator} if the variant is a {@link\n * Union#usesPrefixDiscriminator|prefix of the union}, plus the span\n * of its {@link Union#defaultLayout|default layout}.\n *\n * If the union does not have a default layout then the encoded span\n * of the union depends on the encoded span of its variant (which may\n * be fixed or variable).\n *\n * {@link VariantLayout#layout|Variant layout}s are added through\n * {@link Union#addVariant|addVariant}. If the union has a default\n * layout, the span of the {@link VariantLayout#layout|layout\n * contained by the variant} must not exceed the span of the {@link\n * Union#defaultLayout|default layout} (minus the span of a {@link\n * Union#usesPrefixDiscriminator|prefix disriminator}, if used). The\n * span of the variant will equal the span of the union itself.\n *\n * The variant for a buffer can only be identified from the {@link\n * Union#discriminator|discriminator} {@link\n * UnionDiscriminator#property|property} (in the case of the {@link\n * Union#defaultLayout|default layout}), or by using {@link\n * Union#getVariant|getVariant} and examining the resulting {@link\n * VariantLayout} instance.\n *\n * A variant compatible with a JavaScript object can be identified\n * using {@link Union#getSourceVariant|getSourceVariant}.\n *\n * @param {(UnionDiscriminator|ExternalLayout|Layout)} discr - How to\n * identify the layout used to interpret the union contents. The\n * parameter must be an instance of {@link UnionDiscriminator}, an\n * {@link ExternalLayout} that satisfies {@link\n * ExternalLayout#isCount|isCount()}, or {@link UInt} (or {@link\n * UIntBE}). When a non-external layout element is passed the layout\n * appears at the start of the union. In all cases the (synthesized)\n * {@link UnionDiscriminator} instance is recorded as {@link\n * Union#discriminator|discriminator}.\n *\n * @param {(Layout|null)} defaultLayout - initializer for {@link\n * Union#defaultLayout|defaultLayout}. If absent defaults to `null`.\n * If `null` there is no default layout: the union has data-dependent\n * length and attempts to decode or encode unrecognized variants will\n * throw an exception. A {@link Layout} instance must have a\n * non-negative {@link Layout#span|span}, and if it lacks a {@link\n * Layout#property|property} the {@link\n * Union#defaultLayout|defaultLayout} will be a {@link\n * Layout#replicate|replica} with property `content`.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass Union extends Layout {\n constructor(discr, defaultLayout, property) {\n let discriminator;\n if ((discr instanceof UInt)\n || (discr instanceof UIntBE)) {\n discriminator = new UnionLayoutDiscriminator(new OffsetLayout(discr));\n }\n else if ((discr instanceof ExternalLayout)\n && discr.isCount()) {\n discriminator = new UnionLayoutDiscriminator(discr);\n }\n else if (!(discr instanceof UnionDiscriminator)) {\n throw new TypeError('discr must be a UnionDiscriminator '\n + 'or an unsigned integer layout');\n }\n else {\n discriminator = discr;\n }\n if (undefined === defaultLayout) {\n defaultLayout = null;\n }\n if (!((null === defaultLayout)\n || (defaultLayout instanceof Layout))) {\n throw new TypeError('defaultLayout must be null or a Layout');\n }\n if (null !== defaultLayout) {\n if (0 > defaultLayout.span) {\n throw new Error('defaultLayout must have constant span');\n }\n if (undefined === defaultLayout.property) {\n defaultLayout = defaultLayout.replicate('content');\n }\n }\n /* The union span can be estimated only if there's a default\n * layout. The union spans its default layout, plus any prefix\n * variant layout. By construction both layouts, if present, have\n * non-negative span. */\n let span = -1;\n if (defaultLayout) {\n span = defaultLayout.span;\n if ((0 <= span) && ((discr instanceof UInt)\n || (discr instanceof UIntBE))) {\n span += discriminator.layout.span;\n }\n }\n super(span, property);\n /** The interface for the discriminator value in isolation.\n *\n * This a {@link UnionDiscriminator} either passed to the\n * constructor or synthesized from the `discr` constructor\n * argument. {@link\n * Union#usesPrefixDiscriminator|usesPrefixDiscriminator} will be\n * `true` iff the `discr` parameter was a non-offset {@link\n * Layout} instance. */\n this.discriminator = discriminator;\n /** `true` if the {@link Union#discriminator|discriminator} is the\n * first field in the union.\n *\n * If `false` the discriminator is obtained from somewhere\n * else. */\n this.usesPrefixDiscriminator = (discr instanceof UInt)\n || (discr instanceof UIntBE);\n /** The layout for non-discriminator content when the value of the\n * discriminator is not recognized.\n *\n * This is the value passed to the constructor. It is\n * structurally equivalent to the second component of {@link\n * Union#layout|layout} but may have a different property\n * name. */\n this.defaultLayout = defaultLayout;\n /** A registry of allowed variants.\n *\n * The keys are unsigned integers which should be compatible with\n * {@link Union.discriminator|discriminator}. The property value\n * is the corresponding {@link VariantLayout} instances assigned\n * to this union by {@link Union#addVariant|addVariant}.\n *\n * **NOTE** The registry remains mutable so that variants can be\n * {@link Union#addVariant|added} at any time. Users should not\n * manipulate the content of this property. */\n this.registry = {};\n /* Private variable used when invoking getSourceVariant */\n let boundGetSourceVariant = this.defaultGetSourceVariant.bind(this);\n /** Function to infer the variant selected by a source object.\n *\n * Defaults to {@link\n * Union#defaultGetSourceVariant|defaultGetSourceVariant} but may\n * be overridden using {@link\n * Union#configGetSourceVariant|configGetSourceVariant}.\n *\n * @param {Object} src - as with {@link\n * Union#defaultGetSourceVariant|defaultGetSourceVariant}.\n *\n * @returns {(undefined|VariantLayout)} The default variant\n * (`undefined`) or first registered variant that uses a property\n * available in `src`. */\n this.getSourceVariant = function (src) {\n return boundGetSourceVariant(src);\n };\n /** Function to override the implementation of {@link\n * Union#getSourceVariant|getSourceVariant}.\n *\n * Use this if the desired variant cannot be identified using the\n * algorithm of {@link\n * Union#defaultGetSourceVariant|defaultGetSourceVariant}.\n *\n * **NOTE** The provided function will be invoked bound to this\n * Union instance, providing local access to {@link\n * Union#registry|registry}.\n *\n * @param {Function} gsv - a function that follows the API of\n * {@link Union#defaultGetSourceVariant|defaultGetSourceVariant}. */\n this.configGetSourceVariant = function (gsv) {\n boundGetSourceVariant = gsv.bind(this);\n };\n }\n /** @override */\n getSpan(b, offset = 0) {\n if (0 <= this.span) {\n return this.span;\n }\n /* Default layouts always have non-negative span, so we don't have\n * one and we have to recognize the variant which will in turn\n * determine the span. */\n const vlo = this.getVariant(b, offset);\n if (!vlo) {\n throw new Error('unable to determine span for unrecognized variant');\n }\n return vlo.getSpan(b, offset);\n }\n /**\n * Method to infer a registered Union variant compatible with `src`.\n *\n * The first satisfied rule in the following sequence defines the\n * return value:\n * * If `src` has properties matching the Union discriminator and\n * the default layout, `undefined` is returned regardless of the\n * value of the discriminator property (this ensures the default\n * layout will be used);\n * * If `src` has a property matching the Union discriminator, the\n * value of the discriminator identifies a registered variant, and\n * either (a) the variant has no layout, or (b) `src` has the\n * variant's property, then the variant is returned (because the\n * source satisfies the constraints of the variant it identifies);\n * * If `src` does not have a property matching the Union\n * discriminator, but does have a property matching a registered\n * variant, then the variant is returned (because the source\n * matches a variant without an explicit conflict);\n * * An error is thrown (because we either can't identify a variant,\n * or we were explicitly told the variant but can't satisfy it).\n *\n * @param {Object} src - an object presumed to be compatible with\n * the content of the Union.\n *\n * @return {(undefined|VariantLayout)} - as described above.\n *\n * @throws {Error} - if `src` cannot be associated with a default or\n * registered variant.\n */\n defaultGetSourceVariant(src) {\n if (Object.prototype.hasOwnProperty.call(src, this.discriminator.property)) {\n if (this.defaultLayout && this.defaultLayout.property\n && Object.prototype.hasOwnProperty.call(src, this.defaultLayout.property)) {\n return undefined;\n }\n const vlo = this.registry[src[this.discriminator.property]];\n if (vlo\n && ((!vlo.layout)\n || (vlo.property && Object.prototype.hasOwnProperty.call(src, vlo.property)))) {\n return vlo;\n }\n }\n else {\n for (const tag in this.registry) {\n const vlo = this.registry[tag];\n if (vlo.property && Object.prototype.hasOwnProperty.call(src, vlo.property)) {\n return vlo;\n }\n }\n }\n throw new Error('unable to infer src variant');\n }\n /** Implement {@link Layout#decode|decode} for {@link Union}.\n *\n * If the variant is {@link Union#addVariant|registered} the return\n * value is an instance of that variant, with no explicit\n * discriminator. Otherwise the {@link Union#defaultLayout|default\n * layout} is used to decode the content. */\n decode(b, offset = 0) {\n let dest;\n const dlo = this.discriminator;\n const discr = dlo.decode(b, offset);\n const clo = this.registry[discr];\n if (undefined === clo) {\n const defaultLayout = this.defaultLayout;\n let contentOffset = 0;\n if (this.usesPrefixDiscriminator) {\n contentOffset = dlo.layout.span;\n }\n dest = this.makeDestinationObject();\n dest[dlo.property] = discr;\n // defaultLayout.property can be undefined, but this is allowed by buffer-layout\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n dest[defaultLayout.property] = defaultLayout.decode(b, offset + contentOffset);\n }\n else {\n dest = clo.decode(b, offset);\n }\n return dest;\n }\n /** Implement {@link Layout#encode|encode} for {@link Union}.\n *\n * This API assumes the `src` object is consistent with the union's\n * {@link Union#defaultLayout|default layout}. To encode variants\n * use the appropriate variant-specific {@link VariantLayout#encode}\n * method. */\n encode(src, b, offset = 0) {\n const vlo = this.getSourceVariant(src);\n if (undefined === vlo) {\n const dlo = this.discriminator;\n // this.defaultLayout is not undefined when vlo is undefined\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const clo = this.defaultLayout;\n let contentOffset = 0;\n if (this.usesPrefixDiscriminator) {\n contentOffset = dlo.layout.span;\n }\n dlo.encode(src[dlo.property], b, offset);\n // clo.property is not undefined when vlo is undefined\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return contentOffset + clo.encode(src[clo.property], b, offset + contentOffset);\n }\n return vlo.encode(src, b, offset);\n }\n /** Register a new variant structure within a union. The newly\n * created variant is returned.\n *\n * @param {Number} variant - initializer for {@link\n * VariantLayout#variant|variant}.\n *\n * @param {Layout} layout - initializer for {@link\n * VariantLayout#layout|layout}.\n *\n * @param {String} property - initializer for {@link\n * Layout#property|property}.\n *\n * @return {VariantLayout} */\n addVariant(variant, layout, property) {\n const rv = new VariantLayout(this, variant, layout, property);\n this.registry[variant] = rv;\n return rv;\n }\n /**\n * Get the layout associated with a registered variant.\n *\n * If `vb` does not produce a registered variant the function returns\n * `undefined`.\n *\n * @param {(Number|Uint8Array)} vb - either the variant number, or a\n * buffer from which the discriminator is to be read.\n *\n * @param {Number} offset - offset into `vb` for the start of the\n * union. Used only when `vb` is an instance of {Uint8Array}.\n *\n * @return {({VariantLayout}|undefined)}\n */\n getVariant(vb, offset = 0) {\n let variant;\n if (vb instanceof Uint8Array) {\n variant = this.discriminator.decode(vb, offset);\n }\n else {\n variant = vb;\n }\n return this.registry[variant];\n }\n}\nexports.Union = Union;\n/**\n * Represent a specific variant within a containing union.\n *\n * **NOTE** The {@link Layout#span|span} of the variant may include\n * the span of the {@link Union#discriminator|discriminator} used to\n * identify it, but values read and written using the variant strictly\n * conform to the content of {@link VariantLayout#layout|layout}.\n *\n * **NOTE** User code should not invoke this constructor directly. Use\n * the union {@link Union#addVariant|addVariant} helper method.\n *\n * @param {Union} union - initializer for {@link\n * VariantLayout#union|union}.\n *\n * @param {Number} variant - initializer for {@link\n * VariantLayout#variant|variant}.\n *\n * @param {Layout} [layout] - initializer for {@link\n * VariantLayout#layout|layout}. If absent the variant carries no\n * data.\n *\n * @param {String} [property] - initializer for {@link\n * Layout#property|property}. Unlike many other layouts, variant\n * layouts normally include a property name so they can be identified\n * within their containing {@link Union}. The property identifier may\n * be absent only if `layout` is is absent.\n *\n * @augments {Layout}\n */\nclass VariantLayout extends Layout {\n constructor(union, variant, layout, property) {\n if (!(union instanceof Union)) {\n throw new TypeError('union must be a Union');\n }\n if ((!Number.isInteger(variant)) || (0 > variant)) {\n throw new TypeError('variant must be a (non-negative) integer');\n }\n if (('string' === typeof layout)\n && (undefined === property)) {\n property = layout;\n layout = null;\n }\n if (layout) {\n if (!(layout instanceof Layout)) {\n throw new TypeError('layout must be a Layout');\n }\n if ((null !== union.defaultLayout)\n && (0 <= layout.span)\n && (layout.span > union.defaultLayout.span)) {\n throw new Error('variant span exceeds span of containing union');\n }\n if ('string' !== typeof property) {\n throw new TypeError('variant must have a String property');\n }\n }\n let span = union.span;\n if (0 > union.span) {\n span = layout ? layout.span : 0;\n if ((0 <= span) && union.usesPrefixDiscriminator) {\n span += union.discriminator.layout.span;\n }\n }\n super(span, property);\n /** The {@link Union} to which this variant belongs. */\n this.union = union;\n /** The unsigned integral value identifying this variant within\n * the {@link Union#discriminator|discriminator} of the containing\n * union. */\n this.variant = variant;\n /** The {@link Layout} to be used when reading/writing the\n * non-discriminator part of the {@link\n * VariantLayout#union|union}. If `null` the variant carries no\n * data. */\n this.layout = layout || null;\n }\n /** @override */\n getSpan(b, offset = 0) {\n if (0 <= this.span) {\n /* Will be equal to the containing union span if that is not\n * variable. */\n return this.span;\n }\n let contentOffset = 0;\n if (this.union.usesPrefixDiscriminator) {\n contentOffset = this.union.discriminator.layout.span;\n }\n /* Span is defined solely by the variant (and prefix discriminator) */\n let span = 0;\n if (this.layout) {\n span = this.layout.getSpan(b, offset + contentOffset);\n }\n return contentOffset + span;\n }\n /** @override */\n decode(b, offset = 0) {\n const dest = this.makeDestinationObject();\n if (this !== this.union.getVariant(b, offset)) {\n throw new Error('variant mismatch');\n }\n let contentOffset = 0;\n if (this.union.usesPrefixDiscriminator) {\n contentOffset = this.union.discriminator.layout.span;\n }\n if (this.layout) {\n dest[this.property] = this.layout.decode(b, offset + contentOffset);\n }\n else if (this.property) {\n dest[this.property] = true;\n }\n else if (this.union.usesPrefixDiscriminator) {\n dest[this.union.discriminator.property] = this.variant;\n }\n return dest;\n }\n /** @override */\n encode(src, b, offset = 0) {\n let contentOffset = 0;\n if (this.union.usesPrefixDiscriminator) {\n contentOffset = this.union.discriminator.layout.span;\n }\n if (this.layout\n && (!Object.prototype.hasOwnProperty.call(src, this.property))) {\n throw new TypeError('variant lacks property ' + this.property);\n }\n this.union.discriminator.encode(this.variant, b, offset);\n let span = contentOffset;\n if (this.layout) {\n this.layout.encode(src[this.property], b, offset + contentOffset);\n span += this.layout.getSpan(b, offset + contentOffset);\n if ((0 <= this.union.span)\n && (span > this.union.span)) {\n throw new Error('encoded variant overruns containing union');\n }\n }\n return span;\n }\n /** Delegate {@link Layout#fromArray|fromArray} to {@link\n * VariantLayout#layout|layout}. */\n fromArray(values) {\n if (this.layout) {\n return this.layout.fromArray(values);\n }\n return undefined;\n }\n}\nexports.VariantLayout = VariantLayout;\n/** JavaScript chose to define bitwise operations as operating on\n * signed 32-bit values in 2's complement form, meaning any integer\n * with bit 31 set is going to look negative. For right shifts that's\n * not a problem, because `>>>` is a logical shift, but for every\n * other bitwise operator we have to compensate for possible negative\n * results. */\nfunction fixBitwiseResult(v) {\n if (0 > v) {\n v += 0x100000000;\n }\n return v;\n}\n/**\n * Contain a sequence of bit fields as an unsigned integer.\n *\n * *Factory*: {@link module:Layout.bits|bits}\n *\n * This is a container element; within it there are {@link BitField}\n * instances that provide the extracted properties. The container\n * simply defines the aggregate representation and its bit ordering.\n * The representation is an object containing properties with numeric\n * or {@link Boolean} values.\n *\n * {@link BitField}s are added with the {@link\n * BitStructure#addField|addField} and {@link\n * BitStructure#addBoolean|addBoolean} methods.\n\n * @param {Layout} word - initializer for {@link\n * BitStructure#word|word}. The parameter must be an instance of\n * {@link UInt} (or {@link UIntBE}) that is no more than 4 bytes wide.\n *\n * @param {bool} [msb] - `true` if the bit numbering starts at the\n * most significant bit of the containing word; `false` (default) if\n * it starts at the least significant bit of the containing word. If\n * the parameter at this position is a string and `property` is\n * `undefined` the value of this argument will instead be used as the\n * value of `property`.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass BitStructure extends Layout {\n constructor(word, msb, property) {\n if (!((word instanceof UInt)\n || (word instanceof UIntBE))) {\n throw new TypeError('word must be a UInt or UIntBE layout');\n }\n if (('string' === typeof msb)\n && (undefined === property)) {\n property = msb;\n msb = false;\n }\n if (4 < word.span) {\n throw new RangeError('word cannot exceed 32 bits');\n }\n super(word.span, property);\n /** The layout used for the packed value. {@link BitField}\n * instances are packed sequentially depending on {@link\n * BitStructure#msb|msb}. */\n this.word = word;\n /** Whether the bit sequences are packed starting at the most\n * significant bit growing down (`true`), or the least significant\n * bit growing up (`false`).\n *\n * **NOTE** Regardless of this value, the least significant bit of\n * any {@link BitField} value is the least significant bit of the\n * corresponding section of the packed value. */\n this.msb = !!msb;\n /** The sequence of {@link BitField} layouts that comprise the\n * packed structure.\n *\n * **NOTE** The array remains mutable to allow fields to be {@link\n * BitStructure#addField|added} after construction. Users should\n * not manipulate the content of this property.*/\n this.fields = [];\n /* Storage for the value. Capture a variable instead of using an\n * instance property because we don't want anything to change the\n * value without going through the mutator. */\n let value = 0;\n this._packedSetValue = function (v) {\n value = fixBitwiseResult(v);\n return this;\n };\n this._packedGetValue = function () {\n return value;\n };\n }\n /** @override */\n decode(b, offset = 0) {\n const dest = this.makeDestinationObject();\n const value = this.word.decode(b, offset);\n this._packedSetValue(value);\n for (const fd of this.fields) {\n if (undefined !== fd.property) {\n dest[fd.property] = fd.decode(b);\n }\n }\n return dest;\n }\n /** Implement {@link Layout#encode|encode} for {@link BitStructure}.\n *\n * If `src` is missing a property for a member with a defined {@link\n * Layout#property|property} the corresponding region of the packed\n * value is left unmodified. Unused bits are also left unmodified. */\n encode(src, b, offset = 0) {\n const value = this.word.decode(b, offset);\n this._packedSetValue(value);\n for (const fd of this.fields) {\n if (undefined !== fd.property) {\n const fv = src[fd.property];\n if (undefined !== fv) {\n fd.encode(fv);\n }\n }\n }\n return this.word.encode(this._packedGetValue(), b, offset);\n }\n /** Register a new bitfield with a containing bit structure. The\n * resulting bitfield is returned.\n *\n * @param {Number} bits - initializer for {@link BitField#bits|bits}.\n *\n * @param {string} property - initializer for {@link\n * Layout#property|property}.\n *\n * @return {BitField} */\n addField(bits, property) {\n const bf = new BitField(this, bits, property);\n this.fields.push(bf);\n return bf;\n }\n /** As with {@link BitStructure#addField|addField} for single-bit\n * fields with `boolean` value representation.\n *\n * @param {string} property - initializer for {@link\n * Layout#property|property}.\n *\n * @return {Boolean} */\n // `Boolean` conflicts with the native primitive type\n // eslint-disable-next-line @typescript-eslint/ban-types\n addBoolean(property) {\n // This is my Boolean, not the Javascript one.\n const bf = new Boolean(this, property);\n this.fields.push(bf);\n return bf;\n }\n /**\n * Get access to the bit field for a given property.\n *\n * @param {String} property - the bit field of interest.\n *\n * @return {BitField} - the field associated with `property`, or\n * undefined if there is no such property.\n */\n fieldFor(property) {\n if ('string' !== typeof property) {\n throw new TypeError('property must be string');\n }\n for (const fd of this.fields) {\n if (fd.property === property) {\n return fd;\n }\n }\n return undefined;\n }\n}\nexports.BitStructure = BitStructure;\n/**\n * Represent a sequence of bits within a {@link BitStructure}.\n *\n * All bit field values are represented as unsigned integers.\n *\n * **NOTE** User code should not invoke this constructor directly.\n * Use the container {@link BitStructure#addField|addField} helper\n * method.\n *\n * **NOTE** BitField instances are not instances of {@link Layout}\n * since {@link Layout#span|span} measures 8-bit units.\n *\n * @param {BitStructure} container - initializer for {@link\n * BitField#container|container}.\n *\n * @param {Number} bits - initializer for {@link BitField#bits|bits}.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n */\nclass BitField {\n constructor(container, bits, property) {\n if (!(container instanceof BitStructure)) {\n throw new TypeError('container must be a BitStructure');\n }\n if ((!Number.isInteger(bits)) || (0 >= bits)) {\n throw new TypeError('bits must be positive integer');\n }\n const totalBits = 8 * container.span;\n const usedBits = container.fields.reduce((sum, fd) => sum + fd.bits, 0);\n if ((bits + usedBits) > totalBits) {\n throw new Error('bits too long for span remainder ('\n + (totalBits - usedBits) + ' of '\n + totalBits + ' remain)');\n }\n /** The {@link BitStructure} instance to which this bit field\n * belongs. */\n this.container = container;\n /** The span of this value in bits. */\n this.bits = bits;\n /** A mask of {@link BitField#bits|bits} bits isolating value bits\n * that fit within the field.\n *\n * That is, it masks a value that has not yet been shifted into\n * position within its containing packed integer. */\n this.valueMask = (1 << bits) - 1;\n if (32 === bits) { // shifted value out of range\n this.valueMask = 0xFFFFFFFF;\n }\n /** The offset of the value within the containing packed unsigned\n * integer. The least significant bit of the packed value is at\n * offset zero, regardless of bit ordering used. */\n this.start = usedBits;\n if (this.container.msb) {\n this.start = totalBits - usedBits - bits;\n }\n /** A mask of {@link BitField#bits|bits} isolating the field value\n * within the containing packed unsigned integer. */\n this.wordMask = fixBitwiseResult(this.valueMask << this.start);\n /** The property name used when this bitfield is represented in an\n * Object.\n *\n * Intended to be functionally equivalent to {@link\n * Layout#property}.\n *\n * If left undefined the corresponding span of bits will be\n * treated as padding: it will not be mutated by {@link\n * Layout#encode|encode} nor represented as a property in the\n * decoded Object. */\n this.property = property;\n }\n /** Store a value into the corresponding subsequence of the containing\n * bit field. */\n decode(b, offset) {\n const word = this.container._packedGetValue();\n const wordValue = fixBitwiseResult(word & this.wordMask);\n const value = wordValue >>> this.start;\n return value;\n }\n /** Store a value into the corresponding subsequence of the containing\n * bit field.\n *\n * **NOTE** This is not a specialization of {@link\n * Layout#encode|Layout.encode} and there is no return value. */\n encode(value) {\n if ('number' !== typeof value\n || !Number.isInteger(value)\n || (value !== fixBitwiseResult(value & this.valueMask))) {\n throw new TypeError(nameWithProperty('BitField.encode', this)\n + ' value must be integer not exceeding ' + this.valueMask);\n }\n const word = this.container._packedGetValue();\n const wordValue = fixBitwiseResult(value << this.start);\n this.container._packedSetValue(fixBitwiseResult(word & ~this.wordMask)\n | wordValue);\n }\n}\nexports.BitField = BitField;\n/**\n * Represent a single bit within a {@link BitStructure} as a\n * JavaScript boolean.\n *\n * **NOTE** User code should not invoke this constructor directly.\n * Use the container {@link BitStructure#addBoolean|addBoolean} helper\n * method.\n *\n * @param {BitStructure} container - initializer for {@link\n * BitField#container|container}.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {BitField}\n */\n/* eslint-disable no-extend-native */\nclass Boolean extends BitField {\n constructor(container, property) {\n super(container, 1, property);\n }\n /** Override {@link BitField#decode|decode} for {@link Boolean|Boolean}.\n *\n * @returns {boolean} */\n decode(b, offset) {\n return !!super.decode(b, offset);\n }\n /** @override */\n encode(value) {\n if ('boolean' === typeof value) {\n // BitField requires integer values\n value = +value;\n }\n super.encode(value);\n }\n}\nexports.Boolean = Boolean;\n/* eslint-enable no-extend-native */\n/**\n * Contain a fixed-length block of arbitrary data, represented as a\n * Uint8Array.\n *\n * *Factory*: {@link module:Layout.blob|blob}\n *\n * @param {(Number|ExternalLayout)} length - initializes {@link\n * Blob#length|length}.\n *\n * @param {String} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass Blob extends Layout {\n constructor(length, property) {\n if (!(((length instanceof ExternalLayout) && length.isCount())\n || (Number.isInteger(length) && (0 <= length)))) {\n throw new TypeError('length must be positive integer '\n + 'or an unsigned integer ExternalLayout');\n }\n let span = -1;\n if (!(length instanceof ExternalLayout)) {\n span = length;\n }\n super(span, property);\n /** The number of bytes in the blob.\n *\n * This may be a non-negative integer, or an instance of {@link\n * ExternalLayout} that satisfies {@link\n * ExternalLayout#isCount|isCount()}. */\n this.length = length;\n }\n /** @override */\n getSpan(b, offset) {\n let span = this.span;\n if (0 > span) {\n span = this.length.decode(b, offset);\n }\n return span;\n }\n /** @override */\n decode(b, offset = 0) {\n let span = this.span;\n if (0 > span) {\n span = this.length.decode(b, offset);\n }\n return uint8ArrayToBuffer(b).slice(offset, offset + span);\n }\n /** Implement {@link Layout#encode|encode} for {@link Blob}.\n *\n * **NOTE** If {@link Layout#count|count} is an instance of {@link\n * ExternalLayout} then the length of `src` will be encoded as the\n * count after `src` is encoded. */\n encode(src, b, offset) {\n let span = this.length;\n if (this.length instanceof ExternalLayout) {\n span = src.length;\n }\n if (!(src instanceof Uint8Array && span === src.length)) {\n throw new TypeError(nameWithProperty('Blob.encode', this)\n + ' requires (length ' + span + ') Uint8Array as src');\n }\n if ((offset + span) > b.length) {\n throw new RangeError('encoding overruns Uint8Array');\n }\n const srcBuffer = uint8ArrayToBuffer(src);\n uint8ArrayToBuffer(b).write(srcBuffer.toString('hex'), offset, span, 'hex');\n if (this.length instanceof ExternalLayout) {\n this.length.encode(span, b, offset);\n }\n return span;\n }\n}\nexports.Blob = Blob;\n/**\n * Contain a `NUL`-terminated UTF8 string.\n *\n * *Factory*: {@link module:Layout.cstr|cstr}\n *\n * **NOTE** Any UTF8 string that incorporates a zero-valued byte will\n * not be correctly decoded by this layout.\n *\n * @param {String} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass CString extends Layout {\n constructor(property) {\n super(-1, property);\n }\n /** @override */\n getSpan(b, offset = 0) {\n checkUint8Array(b);\n let idx = offset;\n while ((idx < b.length) && (0 !== b[idx])) {\n idx += 1;\n }\n return 1 + idx - offset;\n }\n /** @override */\n decode(b, offset = 0) {\n const span = this.getSpan(b, offset);\n return uint8ArrayToBuffer(b).slice(offset, offset + span - 1).toString('utf-8');\n }\n /** @override */\n encode(src, b, offset = 0) {\n /* Must force this to a string, lest it be a number and the\n * \"utf8-encoding\" below actually allocate a buffer of length\n * src */\n if ('string' !== typeof src) {\n src = String(src);\n }\n const srcb = buffer_1.Buffer.from(src, 'utf8');\n const span = srcb.length;\n if ((offset + span) > b.length) {\n throw new RangeError('encoding overruns Buffer');\n }\n const buffer = uint8ArrayToBuffer(b);\n srcb.copy(buffer, offset);\n buffer[offset + span] = 0;\n return span + 1;\n }\n}\nexports.CString = CString;\n/**\n * Contain a UTF8 string with implicit length.\n *\n * *Factory*: {@link module:Layout.utf8|utf8}\n *\n * **NOTE** Because the length is implicit in the size of the buffer\n * this layout should be used only in isolation, or in a situation\n * where the length can be expressed by operating on a slice of the\n * containing buffer.\n *\n * @param {Number} [maxSpan] - the maximum length allowed for encoded\n * string content. If not provided there is no bound on the allowed\n * content.\n *\n * @param {String} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass UTF8 extends Layout {\n constructor(maxSpan, property) {\n if (('string' === typeof maxSpan) && (undefined === property)) {\n property = maxSpan;\n maxSpan = undefined;\n }\n if (undefined === maxSpan) {\n maxSpan = -1;\n }\n else if (!Number.isInteger(maxSpan)) {\n throw new TypeError('maxSpan must be an integer');\n }\n super(-1, property);\n /** The maximum span of the layout in bytes.\n *\n * Positive values are generally expected. Zero is abnormal.\n * Attempts to encode or decode a value that exceeds this length\n * will throw a `RangeError`.\n *\n * A negative value indicates that there is no bound on the length\n * of the content. */\n this.maxSpan = maxSpan;\n }\n /** @override */\n getSpan(b, offset = 0) {\n checkUint8Array(b);\n return b.length - offset;\n }\n /** @override */\n decode(b, offset = 0) {\n const span = this.getSpan(b, offset);\n if ((0 <= this.maxSpan)\n && (this.maxSpan < span)) {\n throw new RangeError('text length exceeds maxSpan');\n }\n return uint8ArrayToBuffer(b).slice(offset, offset + span).toString('utf-8');\n }\n /** @override */\n encode(src, b, offset = 0) {\n /* Must force this to a string, lest it be a number and the\n * \"utf8-encoding\" below actually allocate a buffer of length\n * src */\n if ('string' !== typeof src) {\n src = String(src);\n }\n const srcb = buffer_1.Buffer.from(src, 'utf8');\n const span = srcb.length;\n if ((0 <= this.maxSpan)\n && (this.maxSpan < span)) {\n throw new RangeError('text length exceeds maxSpan');\n }\n if ((offset + span) > b.length) {\n throw new RangeError('encoding overruns Buffer');\n }\n srcb.copy(uint8ArrayToBuffer(b), offset);\n return span;\n }\n}\nexports.UTF8 = UTF8;\n/**\n * Contain a constant value.\n *\n * This layout may be used in cases where a JavaScript value can be\n * inferred without an expression in the binary encoding. An example\n * would be a {@link VariantLayout|variant layout} where the content\n * is implied by the union {@link Union#discriminator|discriminator}.\n *\n * @param {Object|Number|String} value - initializer for {@link\n * Constant#value|value}. If the value is an object (or array) and\n * the application intends the object to remain unchanged regardless\n * of what is done to values decoded by this layout, the value should\n * be frozen prior passing it to this constructor.\n *\n * @param {String} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass Constant extends Layout {\n constructor(value, property) {\n super(0, property);\n /** The value produced by this constant when the layout is {@link\n * Constant#decode|decoded}.\n *\n * Any JavaScript value including `null` and `undefined` is\n * permitted.\n *\n * **WARNING** If `value` passed in the constructor was not\n * frozen, it is possible for users of decoded values to change\n * the content of the value. */\n this.value = value;\n }\n /** @override */\n decode(b, offset) {\n return this.value;\n }\n /** @override */\n encode(src, b, offset) {\n /* Constants take no space */\n return 0;\n }\n}\nexports.Constant = Constant;\n/** Factory for {@link GreedyCount}. */\nexports.greedy = ((elementSpan, property) => new GreedyCount(elementSpan, property));\n/** Factory for {@link OffsetLayout}. */\nexports.offset = ((layout, offset, property) => new OffsetLayout(layout, offset, property));\n/** Factory for {@link UInt|unsigned int layouts} spanning one\n * byte. */\nexports.u8 = ((property) => new UInt(1, property));\n/** Factory for {@link UInt|little-endian unsigned int layouts}\n * spanning two bytes. */\nexports.u16 = ((property) => new UInt(2, property));\n/** Factory for {@link UInt|little-endian unsigned int layouts}\n * spanning three bytes. */\nexports.u24 = ((property) => new UInt(3, property));\n/** Factory for {@link UInt|little-endian unsigned int layouts}\n * spanning four bytes. */\nexports.u32 = ((property) => new UInt(4, property));\n/** Factory for {@link UInt|little-endian unsigned int layouts}\n * spanning five bytes. */\nexports.u40 = ((property) => new UInt(5, property));\n/** Factory for {@link UInt|little-endian unsigned int layouts}\n * spanning six bytes. */\nexports.u48 = ((property) => new UInt(6, property));\n/** Factory for {@link NearUInt64|little-endian unsigned int\n * layouts} interpreted as Numbers. */\nexports.nu64 = ((property) => new NearUInt64(property));\n/** Factory for {@link UInt|big-endian unsigned int layouts}\n * spanning two bytes. */\nexports.u16be = ((property) => new UIntBE(2, property));\n/** Factory for {@link UInt|big-endian unsigned int layouts}\n * spanning three bytes. */\nexports.u24be = ((property) => new UIntBE(3, property));\n/** Factory for {@link UInt|big-endian unsigned int layouts}\n * spanning four bytes. */\nexports.u32be = ((property) => new UIntBE(4, property));\n/** Factory for {@link UInt|big-endian unsigned int layouts}\n * spanning five bytes. */\nexports.u40be = ((property) => new UIntBE(5, property));\n/** Factory for {@link UInt|big-endian unsigned int layouts}\n * spanning six bytes. */\nexports.u48be = ((property) => new UIntBE(6, property));\n/** Factory for {@link NearUInt64BE|big-endian unsigned int\n * layouts} interpreted as Numbers. */\nexports.nu64be = ((property) => new NearUInt64BE(property));\n/** Factory for {@link Int|signed int layouts} spanning one\n * byte. */\nexports.s8 = ((property) => new Int(1, property));\n/** Factory for {@link Int|little-endian signed int layouts}\n * spanning two bytes. */\nexports.s16 = ((property) => new Int(2, property));\n/** Factory for {@link Int|little-endian signed int layouts}\n * spanning three bytes. */\nexports.s24 = ((property) => new Int(3, property));\n/** Factory for {@link Int|little-endian signed int layouts}\n * spanning four bytes. */\nexports.s32 = ((property) => new Int(4, property));\n/** Factory for {@link Int|little-endian signed int layouts}\n * spanning five bytes. */\nexports.s40 = ((property) => new Int(5, property));\n/** Factory for {@link Int|little-endian signed int layouts}\n * spanning six bytes. */\nexports.s48 = ((property) => new Int(6, property));\n/** Factory for {@link NearInt64|little-endian signed int layouts}\n * interpreted as Numbers. */\nexports.ns64 = ((property) => new NearInt64(property));\n/** Factory for {@link Int|big-endian signed int layouts}\n * spanning two bytes. */\nexports.s16be = ((property) => new IntBE(2, property));\n/** Factory for {@link Int|big-endian signed int layouts}\n * spanning three bytes. */\nexports.s24be = ((property) => new IntBE(3, property));\n/** Factory for {@link Int|big-endian signed int layouts}\n * spanning four bytes. */\nexports.s32be = ((property) => new IntBE(4, property));\n/** Factory for {@link Int|big-endian signed int layouts}\n * spanning five bytes. */\nexports.s40be = ((property) => new IntBE(5, property));\n/** Factory for {@link Int|big-endian signed int layouts}\n * spanning six bytes. */\nexports.s48be = ((property) => new IntBE(6, property));\n/** Factory for {@link NearInt64BE|big-endian signed int layouts}\n * interpreted as Numbers. */\nexports.ns64be = ((property) => new NearInt64BE(property));\n/** Factory for {@link Float|little-endian 32-bit floating point} values. */\nexports.f32 = ((property) => new Float(property));\n/** Factory for {@link FloatBE|big-endian 32-bit floating point} values. */\nexports.f32be = ((property) => new FloatBE(property));\n/** Factory for {@link Double|little-endian 64-bit floating point} values. */\nexports.f64 = ((property) => new Double(property));\n/** Factory for {@link DoubleBE|big-endian 64-bit floating point} values. */\nexports.f64be = ((property) => new DoubleBE(property));\n/** Factory for {@link Structure} values. */\nexports.struct = ((fields, property, decodePrefixes) => new Structure(fields, property, decodePrefixes));\n/** Factory for {@link BitStructure} values. */\nexports.bits = ((word, msb, property) => new BitStructure(word, msb, property));\n/** Factory for {@link Sequence} values. */\nexports.seq = ((elementLayout, count, property) => new Sequence(elementLayout, count, property));\n/** Factory for {@link Union} values. */\nexports.union = ((discr, defaultLayout, property) => new Union(discr, defaultLayout, property));\n/** Factory for {@link UnionLayoutDiscriminator} values. */\nexports.unionLayoutDiscriminator = ((layout, property) => new UnionLayoutDiscriminator(layout, property));\n/** Factory for {@link Blob} values. */\nexports.blob = ((length, property) => new Blob(length, property));\n/** Factory for {@link CString} values. */\nexports.cstr = ((property) => new CString(property));\n/** Factory for {@link UTF8} values. */\nexports.utf8 = ((maxSpan, property) => new UTF8(maxSpan, property));\n/** Factory for {@link Constant} values. */\nexports.constant = ((value, property) => new Constant(value, property));\n//# sourceMappingURL=Layout.js.map","export const encodeDecode = (layout) => {\n const decode = layout.decode.bind(layout);\n const encode = layout.encode.bind(layout);\n return { decode, encode };\n};\n//# sourceMappingURL=base.js.map","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nlet converter;\n/**\n * Convert a little-endian buffer into a BigInt.\n * @param buf The little-endian buffer to convert\n * @returns A BigInt with the little-endian representation of buf.\n */\nfunction toBigIntLE(buf) {\n {\n const reversed = Buffer.from(buf);\n reversed.reverse();\n const hex = reversed.toString('hex');\n if (hex.length === 0) {\n return BigInt(0);\n }\n return BigInt(`0x${hex}`);\n }\n return converter.toBigInt(buf, false);\n}\nexports.toBigIntLE = toBigIntLE;\n/**\n * Convert a big-endian buffer into a BigInt\n * @param buf The big-endian buffer to convert.\n * @returns A BigInt with the big-endian representation of buf.\n */\nfunction toBigIntBE(buf) {\n {\n const hex = buf.toString('hex');\n if (hex.length === 0) {\n return BigInt(0);\n }\n return BigInt(`0x${hex}`);\n }\n return converter.toBigInt(buf, true);\n}\nexports.toBigIntBE = toBigIntBE;\n/**\n * Convert a BigInt to a little-endian buffer.\n * @param num The BigInt to convert.\n * @param width The number of bytes that the resulting buffer should be.\n * @returns A little-endian buffer representation of num.\n */\nfunction toBufferLE(num, width) {\n {\n const hex = num.toString(16);\n const buffer = Buffer.from(hex.padStart(width * 2, '0').slice(0, width * 2), 'hex');\n buffer.reverse();\n return buffer;\n }\n // Allocation is done here, since it is slower using napi in C\n return converter.fromBigInt(num, Buffer.allocUnsafe(width), false);\n}\nexports.toBufferLE = toBufferLE;\n/**\n * Convert a BigInt to a big-endian buffer.\n * @param num The BigInt to convert.\n * @param width The number of bytes that the resulting buffer should be.\n * @returns A big-endian buffer representation of num.\n */\nfunction toBufferBE(num, width) {\n {\n const hex = num.toString(16);\n return Buffer.from(hex.padStart(width * 2, '0').slice(0, width * 2), 'hex');\n }\n return converter.fromBigInt(num, Buffer.allocUnsafe(width), true);\n}\nexports.toBufferBE = toBufferBE;\n","import { blob } from '@solana/buffer-layout';\nimport { toBigIntBE, toBigIntLE, toBufferBE, toBufferLE } from 'bigint-buffer';\nimport { encodeDecode } from './base.mjs';\nexport const bigInt = (length) => (property) => {\n const layout = blob(length, property);\n const { encode, decode } = encodeDecode(layout);\n const bigIntLayout = layout;\n bigIntLayout.decode = (buffer, offset) => {\n const src = decode(buffer, offset);\n return toBigIntLE(Buffer.from(src));\n };\n bigIntLayout.encode = (bigInt, buffer, offset) => {\n const src = toBufferLE(bigInt, length);\n return encode(src, buffer, offset);\n };\n return bigIntLayout;\n};\nexport const bigIntBE = (length) => (property) => {\n const layout = blob(length, property);\n const { encode, decode } = encodeDecode(layout);\n const bigIntLayout = layout;\n bigIntLayout.decode = (buffer, offset) => {\n const src = decode(buffer, offset);\n return toBigIntBE(Buffer.from(src));\n };\n bigIntLayout.encode = (bigInt, buffer, offset) => {\n const src = toBufferBE(bigInt, length);\n return encode(src, buffer, offset);\n };\n return bigIntLayout;\n};\nexport const u64 = bigInt(8);\nexport const u64be = bigIntBE(8);\nexport const u128 = bigInt(16);\nexport const u128be = bigIntBE(16);\nexport const u192 = bigInt(24);\nexport const u192be = bigIntBE(24);\nexport const u256 = bigInt(32);\nexport const u256be = bigIntBE(32);\n//# sourceMappingURL=bigint.js.map","import { u8 } from '@solana/buffer-layout';\nimport { encodeDecode } from './base.mjs';\nexport const bool = (property) => {\n const layout = u8(property);\n const { encode, decode } = encodeDecode(layout);\n const boolLayout = layout;\n boolLayout.decode = (buffer, offset) => {\n const src = decode(buffer, offset);\n return !!src;\n };\n boolLayout.encode = (bool, buffer, offset) => {\n const src = Number(bool);\n return encode(src, buffer, offset);\n };\n return boolLayout;\n};\n//# sourceMappingURL=native.js.map","import { blob } from '@solana/buffer-layout';\nimport { PublicKey } from '@solana/web3.js';\nimport { encodeDecode } from './base.mjs';\nexport const publicKey = (property) => {\n const layout = blob(32, property);\n const { encode, decode } = encodeDecode(layout);\n const publicKeyLayout = layout;\n publicKeyLayout.decode = (buffer, offset) => {\n const src = decode(buffer, offset);\n return new PublicKey(src);\n };\n publicKeyLayout.encode = (publicKey, buffer, offset) => {\n const src = publicKey.toBuffer();\n return encode(src, buffer, offset);\n };\n return publicKeyLayout;\n};\n//# sourceMappingURL=web3.js.map","/** Base class for errors */\nexport class TokenError extends Error {\n constructor(message) {\n super(message);\n }\n}\n/** Thrown if an account is not found at the expected address */\nexport class TokenAccountNotFoundError extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenAccountNotFoundError';\n }\n}\n/** Thrown if a program state account is not a valid Account */\nexport class TokenInvalidAccountError extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenInvalidAccountError';\n }\n}\n/** Thrown if a program state account is not owned by the expected token program */\nexport class TokenInvalidAccountOwnerError extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenInvalidAccountOwnerError';\n }\n}\n/** Thrown if the byte length of an program state account doesn't match the expected size */\nexport class TokenInvalidAccountSizeError extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenInvalidAccountSizeError';\n }\n}\n/** Thrown if the mint of a token account doesn't match the expected mint */\nexport class TokenInvalidMintError extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenInvalidMintError';\n }\n}\n/** Thrown if the owner of a token account doesn't match the expected owner */\nexport class TokenInvalidOwnerError extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenInvalidOwnerError';\n }\n}\n/** Thrown if the owner of a token account is a PDA (Program Derived Address) */\nexport class TokenOwnerOffCurveError extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenOwnerOffCurveError';\n }\n}\n/** Thrown if an instruction's program is invalid */\nexport class TokenInvalidInstructionProgramError extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenInvalidInstructionProgramError';\n }\n}\n/** Thrown if an instruction's keys are invalid */\nexport class TokenInvalidInstructionKeysError extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenInvalidInstructionKeysError';\n }\n}\n/** Thrown if an instruction's data is invalid */\nexport class TokenInvalidInstructionDataError extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenInvalidInstructionDataError';\n }\n}\n/** Thrown if an instruction's type is invalid */\nexport class TokenInvalidInstructionTypeError extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenInvalidInstructionTypeError';\n }\n}\n/** Thrown if the program does not support the desired instruction */\nexport class TokenUnsupportedInstructionError extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenUnsupportedInstructionError';\n }\n}\n//# sourceMappingURL=errors.js.map","/** Instructions defined by the program */\nexport var TokenInstruction;\n(function (TokenInstruction) {\n TokenInstruction[TokenInstruction[\"InitializeMint\"] = 0] = \"InitializeMint\";\n TokenInstruction[TokenInstruction[\"InitializeAccount\"] = 1] = \"InitializeAccount\";\n TokenInstruction[TokenInstruction[\"InitializeMultisig\"] = 2] = \"InitializeMultisig\";\n TokenInstruction[TokenInstruction[\"Transfer\"] = 3] = \"Transfer\";\n TokenInstruction[TokenInstruction[\"Approve\"] = 4] = \"Approve\";\n TokenInstruction[TokenInstruction[\"Revoke\"] = 5] = \"Revoke\";\n TokenInstruction[TokenInstruction[\"SetAuthority\"] = 6] = \"SetAuthority\";\n TokenInstruction[TokenInstruction[\"MintTo\"] = 7] = \"MintTo\";\n TokenInstruction[TokenInstruction[\"Burn\"] = 8] = \"Burn\";\n TokenInstruction[TokenInstruction[\"CloseAccount\"] = 9] = \"CloseAccount\";\n TokenInstruction[TokenInstruction[\"FreezeAccount\"] = 10] = \"FreezeAccount\";\n TokenInstruction[TokenInstruction[\"ThawAccount\"] = 11] = \"ThawAccount\";\n TokenInstruction[TokenInstruction[\"TransferChecked\"] = 12] = \"TransferChecked\";\n TokenInstruction[TokenInstruction[\"ApproveChecked\"] = 13] = \"ApproveChecked\";\n TokenInstruction[TokenInstruction[\"MintToChecked\"] = 14] = \"MintToChecked\";\n TokenInstruction[TokenInstruction[\"BurnChecked\"] = 15] = \"BurnChecked\";\n TokenInstruction[TokenInstruction[\"InitializeAccount2\"] = 16] = \"InitializeAccount2\";\n TokenInstruction[TokenInstruction[\"SyncNative\"] = 17] = \"SyncNative\";\n TokenInstruction[TokenInstruction[\"InitializeAccount3\"] = 18] = \"InitializeAccount3\";\n TokenInstruction[TokenInstruction[\"InitializeMultisig2\"] = 19] = \"InitializeMultisig2\";\n TokenInstruction[TokenInstruction[\"InitializeMint2\"] = 20] = \"InitializeMint2\";\n TokenInstruction[TokenInstruction[\"GetAccountDataSize\"] = 21] = \"GetAccountDataSize\";\n TokenInstruction[TokenInstruction[\"InitializeImmutableOwner\"] = 22] = \"InitializeImmutableOwner\";\n TokenInstruction[TokenInstruction[\"AmountToUiAmount\"] = 23] = \"AmountToUiAmount\";\n TokenInstruction[TokenInstruction[\"UiAmountToAmount\"] = 24] = \"UiAmountToAmount\";\n TokenInstruction[TokenInstruction[\"InitializeMintCloseAuthority\"] = 25] = \"InitializeMintCloseAuthority\";\n TokenInstruction[TokenInstruction[\"TransferFeeExtension\"] = 26] = \"TransferFeeExtension\";\n TokenInstruction[TokenInstruction[\"ConfidentialTransferExtension\"] = 27] = \"ConfidentialTransferExtension\";\n TokenInstruction[TokenInstruction[\"DefaultAccountStateExtension\"] = 28] = \"DefaultAccountStateExtension\";\n TokenInstruction[TokenInstruction[\"Reallocate\"] = 29] = \"Reallocate\";\n TokenInstruction[TokenInstruction[\"MemoTransferExtension\"] = 30] = \"MemoTransferExtension\";\n TokenInstruction[TokenInstruction[\"CreateNativeMint\"] = 31] = \"CreateNativeMint\";\n TokenInstruction[TokenInstruction[\"InitializeNonTransferableMint\"] = 32] = \"InitializeNonTransferableMint\";\n TokenInstruction[TokenInstruction[\"InterestBearingMintExtension\"] = 33] = \"InterestBearingMintExtension\";\n TokenInstruction[TokenInstruction[\"CpiGuardExtension\"] = 34] = \"CpiGuardExtension\";\n TokenInstruction[TokenInstruction[\"InitializePermanentDelegate\"] = 35] = \"InitializePermanentDelegate\";\n})(TokenInstruction || (TokenInstruction = {}));\n//# sourceMappingURL=types.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { u64 } from '@solana/buffer-layout-utils';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const amountToUiAmountInstructionData = struct([\n u8('instruction'),\n u64('amount'),\n]);\n/**\n * Construct a AmountToUiAmount instruction\n *\n * @param mint Public key of the mint\n * @param amount Amount of tokens to be converted to UiAmount\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createAmountToUiAmountInstruction(mint, amount, programId = TOKEN_PROGRAM_ID) {\n const keys = [{ pubkey: mint, isSigner: false, isWritable: false }];\n const data = Buffer.alloc(amountToUiAmountInstructionData.span);\n amountToUiAmountInstructionData.encode({\n instruction: TokenInstruction.AmountToUiAmount,\n amount: BigInt(amount),\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode a AmountToUiAmount instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeAmountToUiAmountInstruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== amountToUiAmountInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { mint }, data, } = decodeAmountToUiAmountInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.AmountToUiAmount)\n throw new TokenInvalidInstructionTypeError();\n if (!mint)\n throw new TokenInvalidInstructionKeysError();\n return {\n programId,\n keys: {\n mint,\n },\n data,\n };\n}\n/**\n * Decode a AmountToUiAmount instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeAmountToUiAmountInstructionUnchecked({ programId, keys: [mint], data, }) {\n return {\n programId,\n keys: {\n mint,\n },\n data: amountToUiAmountInstructionData.decode(data),\n };\n}\n//# sourceMappingURL=amountToUiAmount.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { u64 } from '@solana/buffer-layout-utils';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { addSigners } from './internal.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const approveInstructionData = struct([u8('instruction'), u64('amount')]);\n/**\n * Construct an Approve instruction\n *\n * @param account Account to set the delegate for\n * @param delegate Account authorized to transfer tokens from the account\n * @param owner Owner of the account\n * @param amount Maximum number of tokens the delegate may transfer\n * @param multiSigners Signing accounts if `owner` is a multisig\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createApproveInstruction(account, delegate, owner, amount, multiSigners = [], programId = TOKEN_PROGRAM_ID) {\n const keys = addSigners([\n { pubkey: account, isSigner: false, isWritable: true },\n { pubkey: delegate, isSigner: false, isWritable: false },\n ], owner, multiSigners);\n const data = Buffer.alloc(approveInstructionData.span);\n approveInstructionData.encode({\n instruction: TokenInstruction.Approve,\n amount: BigInt(amount),\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode an Approve instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeApproveInstruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== approveInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { account, delegate, owner, multiSigners }, data, } = decodeApproveInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.Approve)\n throw new TokenInvalidInstructionTypeError();\n if (!account || !delegate || !owner)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n account,\n delegate,\n owner,\n multiSigners,\n },\n data,\n };\n}\n/**\n * Decode an Approve instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeApproveInstructionUnchecked({ programId, keys: [account, delegate, owner, ...multiSigners], data, }) {\n return {\n programId,\n keys: {\n account,\n delegate,\n owner,\n multiSigners,\n },\n data: approveInstructionData.decode(data),\n };\n}\n//# sourceMappingURL=approve.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { u64 } from '@solana/buffer-layout-utils';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { addSigners } from './internal.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const approveCheckedInstructionData = struct([\n u8('instruction'),\n u64('amount'),\n u8('decimals'),\n]);\n/**\n * Construct an ApproveChecked instruction\n *\n * @param account Account to set the delegate for\n * @param mint Mint account\n * @param delegate Account authorized to transfer of tokens from the account\n * @param owner Owner of the account\n * @param amount Maximum number of tokens the delegate may transfer\n * @param decimals Number of decimals in approve amount\n * @param multiSigners Signing accounts if `owner` is a multisig\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createApproveCheckedInstruction(account, mint, delegate, owner, amount, decimals, multiSigners = [], programId = TOKEN_PROGRAM_ID) {\n const keys = addSigners([\n { pubkey: account, isSigner: false, isWritable: true },\n { pubkey: mint, isSigner: false, isWritable: false },\n { pubkey: delegate, isSigner: false, isWritable: false },\n ], owner, multiSigners);\n const data = Buffer.alloc(approveCheckedInstructionData.span);\n approveCheckedInstructionData.encode({\n instruction: TokenInstruction.ApproveChecked,\n amount: BigInt(amount),\n decimals,\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode an ApproveChecked instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeApproveCheckedInstruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== approveCheckedInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { account, mint, delegate, owner, multiSigners }, data, } = decodeApproveCheckedInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.ApproveChecked)\n throw new TokenInvalidInstructionTypeError();\n if (!account || !mint || !delegate || !owner)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n account,\n mint,\n delegate,\n owner,\n multiSigners,\n },\n data,\n };\n}\n/**\n * Decode an ApproveChecked instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeApproveCheckedInstructionUnchecked({ programId, keys: [account, mint, delegate, owner, ...multiSigners], data, }) {\n return {\n programId,\n keys: {\n account,\n mint,\n delegate,\n owner,\n multiSigners,\n },\n data: approveCheckedInstructionData.decode(data),\n };\n}\n//# sourceMappingURL=approveChecked.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { u64 } from '@solana/buffer-layout-utils';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { addSigners } from './internal.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const burnInstructionData = struct([u8('instruction'), u64('amount')]);\n/**\n * Construct a Burn instruction\n *\n * @param account Account to burn tokens from\n * @param mint Mint for the account\n * @param owner Owner of the account\n * @param amount Number of tokens to burn\n * @param multiSigners Signing accounts if `owner` is a multisig\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createBurnInstruction(account, mint, owner, amount, multiSigners = [], programId = TOKEN_PROGRAM_ID) {\n const keys = addSigners([\n { pubkey: account, isSigner: false, isWritable: true },\n { pubkey: mint, isSigner: false, isWritable: true },\n ], owner, multiSigners);\n const data = Buffer.alloc(burnInstructionData.span);\n burnInstructionData.encode({\n instruction: TokenInstruction.Burn,\n amount: BigInt(amount),\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode a Burn instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeBurnInstruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== burnInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { account, mint, owner, multiSigners }, data, } = decodeBurnInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.Burn)\n throw new TokenInvalidInstructionTypeError();\n if (!account || !mint || !owner)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n account,\n mint,\n owner,\n multiSigners,\n },\n data,\n };\n}\n/**\n * Decode a Burn instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeBurnInstructionUnchecked({ programId, keys: [account, mint, owner, ...multiSigners], data, }) {\n return {\n programId,\n keys: {\n account,\n mint,\n owner,\n multiSigners,\n },\n data: burnInstructionData.decode(data),\n };\n}\n//# sourceMappingURL=burn.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { u64 } from '@solana/buffer-layout-utils';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { addSigners } from './internal.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const burnCheckedInstructionData = struct([\n u8('instruction'),\n u64('amount'),\n u8('decimals'),\n]);\n/**\n * Construct a BurnChecked instruction\n *\n * @param mint Mint for the account\n * @param account Account to burn tokens from\n * @param owner Owner of the account\n * @param amount Number of tokens to burn\n * @param decimals Number of decimals in burn amount\n * @param multiSigners Signing accounts if `owner` is a multisig\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createBurnCheckedInstruction(account, mint, owner, amount, decimals, multiSigners = [], programId = TOKEN_PROGRAM_ID) {\n const keys = addSigners([\n { pubkey: account, isSigner: false, isWritable: true },\n { pubkey: mint, isSigner: false, isWritable: true },\n ], owner, multiSigners);\n const data = Buffer.alloc(burnCheckedInstructionData.span);\n burnCheckedInstructionData.encode({\n instruction: TokenInstruction.BurnChecked,\n amount: BigInt(amount),\n decimals,\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode a BurnChecked instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeBurnCheckedInstruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== burnCheckedInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { account, mint, owner, multiSigners }, data, } = decodeBurnCheckedInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.BurnChecked)\n throw new TokenInvalidInstructionTypeError();\n if (!account || !mint || !owner)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n account,\n mint,\n owner,\n multiSigners,\n },\n data,\n };\n}\n/**\n * Decode a BurnChecked instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeBurnCheckedInstructionUnchecked({ programId, keys: [account, mint, owner, ...multiSigners], data, }) {\n return {\n programId,\n keys: {\n account,\n mint,\n owner,\n multiSigners,\n },\n data: burnCheckedInstructionData.decode(data),\n };\n}\n//# sourceMappingURL=burnChecked.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { addSigners } from './internal.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const closeAccountInstructionData = struct([u8('instruction')]);\n/**\n * Construct a CloseAccount instruction\n *\n * @param account Account to close\n * @param destination Account to receive the remaining balance of the closed account\n * @param authority Account close authority\n * @param multiSigners Signing accounts if `authority` is a multisig\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createCloseAccountInstruction(account, destination, authority, multiSigners = [], programId = TOKEN_PROGRAM_ID) {\n const keys = addSigners([\n { pubkey: account, isSigner: false, isWritable: true },\n { pubkey: destination, isSigner: false, isWritable: true },\n ], authority, multiSigners);\n const data = Buffer.alloc(closeAccountInstructionData.span);\n closeAccountInstructionData.encode({ instruction: TokenInstruction.CloseAccount }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode a CloseAccount instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeCloseAccountInstruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== closeAccountInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { account, destination, authority, multiSigners }, data, } = decodeCloseAccountInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.CloseAccount)\n throw new TokenInvalidInstructionTypeError();\n if (!account || !destination || !authority)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n account,\n destination,\n authority,\n multiSigners,\n },\n data,\n };\n}\n/**\n * Decode a CloseAccount instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeCloseAccountInstructionUnchecked({ programId, keys: [account, destination, authority, ...multiSigners], data, }) {\n return {\n programId,\n keys: {\n account,\n destination,\n authority,\n multiSigners,\n },\n data: closeAccountInstructionData.decode(data),\n };\n}\n//# sourceMappingURL=closeAccount.js.map","export var AccountType;\n(function (AccountType) {\n AccountType[AccountType[\"Uninitialized\"] = 0] = \"Uninitialized\";\n AccountType[AccountType[\"Mint\"] = 1] = \"Mint\";\n AccountType[AccountType[\"Account\"] = 2] = \"Account\";\n})(AccountType || (AccountType = {}));\nexport const ACCOUNT_TYPE_SIZE = 1;\n//# sourceMappingURL=accountType.js.map","import { struct, u32, u8 } from '@solana/buffer-layout';\nimport { publicKey, u64 } from '@solana/buffer-layout-utils';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenAccountNotFoundError, TokenInvalidAccountError, TokenInvalidAccountOwnerError, TokenInvalidAccountSizeError, } from '../errors.js';\nimport { ACCOUNT_TYPE_SIZE, AccountType } from '../extensions/accountType.js';\nimport { getAccountLen } from '../extensions/extensionType.js';\nimport { MULTISIG_SIZE } from './multisig.js';\n/** Token account state as stored by the program */\nexport var AccountState;\n(function (AccountState) {\n AccountState[AccountState[\"Uninitialized\"] = 0] = \"Uninitialized\";\n AccountState[AccountState[\"Initialized\"] = 1] = \"Initialized\";\n AccountState[AccountState[\"Frozen\"] = 2] = \"Frozen\";\n})(AccountState || (AccountState = {}));\n/** Buffer layout for de/serializing a token account */\nexport const AccountLayout = struct([\n publicKey('mint'),\n publicKey('owner'),\n u64('amount'),\n u32('delegateOption'),\n publicKey('delegate'),\n u8('state'),\n u32('isNativeOption'),\n u64('isNative'),\n u64('delegatedAmount'),\n u32('closeAuthorityOption'),\n publicKey('closeAuthority'),\n]);\n/** Byte length of a token account */\nexport const ACCOUNT_SIZE = AccountLayout.span;\n/**\n * Retrieve information about a token account\n *\n * @param connection Connection to use\n * @param address Token account\n * @param commitment Desired level of commitment for querying the state\n * @param programId SPL Token program account\n *\n * @return Token account information\n */\nexport async function getAccount(connection, address, commitment, programId = TOKEN_PROGRAM_ID) {\n const info = await connection.getAccountInfo(address, commitment);\n return unpackAccount(address, info, programId);\n}\n/**\n * Retrieve information about multiple token accounts in a single RPC call\n *\n * @param connection Connection to use\n * @param addresses Token accounts\n * @param commitment Desired level of commitment for querying the state\n * @param programId SPL Token program account\n *\n * @return Token account information\n */\nexport async function getMultipleAccounts(connection, addresses, commitment, programId = TOKEN_PROGRAM_ID) {\n const infos = await connection.getMultipleAccountsInfo(addresses, commitment);\n return addresses.map((address, i) => unpackAccount(address, infos[i], programId));\n}\n/** Get the minimum lamport balance for a base token account to be rent exempt\n *\n * @param connection Connection to use\n * @param commitment Desired level of commitment for querying the state\n *\n * @return Amount of lamports required\n */\nexport async function getMinimumBalanceForRentExemptAccount(connection, commitment) {\n return await getMinimumBalanceForRentExemptAccountWithExtensions(connection, [], commitment);\n}\n/** Get the minimum lamport balance for a rent-exempt token account with extensions\n *\n * @param connection Connection to use\n * @param commitment Desired level of commitment for querying the state\n *\n * @return Amount of lamports required\n */\nexport async function getMinimumBalanceForRentExemptAccountWithExtensions(connection, extensions, commitment) {\n const accountLen = getAccountLen(extensions);\n return await connection.getMinimumBalanceForRentExemption(accountLen, commitment);\n}\n/**\n * Unpack a token account\n *\n * @param address Token account\n * @param info Token account data\n * @param programId SPL Token program account\n *\n * @return Unpacked token account\n */\nexport function unpackAccount(address, info, programId = TOKEN_PROGRAM_ID) {\n if (!info)\n throw new TokenAccountNotFoundError();\n if (!info.owner.equals(programId))\n throw new TokenInvalidAccountOwnerError();\n if (info.data.length < ACCOUNT_SIZE)\n throw new TokenInvalidAccountSizeError();\n const rawAccount = AccountLayout.decode(info.data.slice(0, ACCOUNT_SIZE));\n let tlvData = Buffer.alloc(0);\n if (info.data.length > ACCOUNT_SIZE) {\n if (info.data.length === MULTISIG_SIZE)\n throw new TokenInvalidAccountSizeError();\n if (info.data[ACCOUNT_SIZE] != AccountType.Account)\n throw new TokenInvalidAccountError();\n tlvData = info.data.slice(ACCOUNT_SIZE + ACCOUNT_TYPE_SIZE);\n }\n return {\n address,\n mint: rawAccount.mint,\n owner: rawAccount.owner,\n amount: rawAccount.amount,\n delegate: rawAccount.delegateOption ? rawAccount.delegate : null,\n delegatedAmount: rawAccount.delegatedAmount,\n isInitialized: rawAccount.state !== AccountState.Uninitialized,\n isFrozen: rawAccount.state === AccountState.Frozen,\n isNative: !!rawAccount.isNativeOption,\n rentExemptReserve: rawAccount.isNativeOption ? rawAccount.isNative : null,\n closeAuthority: rawAccount.closeAuthorityOption ? rawAccount.closeAuthority : null,\n tlvData,\n };\n}\n//# sourceMappingURL=account.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { bool, publicKey } from '@solana/buffer-layout-utils';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenAccountNotFoundError, TokenInvalidAccountOwnerError, TokenInvalidAccountSizeError } from '../errors.js';\n/** Buffer layout for de/serializing a multisig */\nexport const MultisigLayout = struct([\n u8('m'),\n u8('n'),\n bool('isInitialized'),\n publicKey('signer1'),\n publicKey('signer2'),\n publicKey('signer3'),\n publicKey('signer4'),\n publicKey('signer5'),\n publicKey('signer6'),\n publicKey('signer7'),\n publicKey('signer8'),\n publicKey('signer9'),\n publicKey('signer10'),\n publicKey('signer11'),\n]);\n/** Byte length of a multisig */\nexport const MULTISIG_SIZE = MultisigLayout.span;\n/**\n * Retrieve information about a multisig\n *\n * @param connection Connection to use\n * @param address Multisig account\n * @param commitment Desired level of commitment for querying the state\n * @param programId SPL Token program account\n *\n * @return Multisig information\n */\nexport async function getMultisig(connection, address, commitment, programId = TOKEN_PROGRAM_ID) {\n const info = await connection.getAccountInfo(address, commitment);\n return unpackMultisig(address, info, programId);\n}\n/**\n * Unpack a multisig\n *\n * @param address Multisig account\n * @param info Multisig account data\n * @param programId SPL Token program account\n *\n * @return Unpacked multisig\n */\nexport function unpackMultisig(address, info, programId = TOKEN_PROGRAM_ID) {\n if (!info)\n throw new TokenAccountNotFoundError();\n if (!info.owner.equals(programId))\n throw new TokenInvalidAccountOwnerError();\n if (info.data.length != MULTISIG_SIZE)\n throw new TokenInvalidAccountSizeError();\n const multisig = MultisigLayout.decode(info.data);\n return { address, ...multisig };\n}\n/** Get the minimum lamport balance for a multisig to be rent exempt\n *\n * @param connection Connection to use\n * @param commitment Desired level of commitment for querying the state\n *\n * @return Amount of lamports required\n */\nexport async function getMinimumBalanceForRentExemptMultisig(connection, commitment) {\n return await connection.getMinimumBalanceForRentExemption(MULTISIG_SIZE, commitment);\n}\n//# sourceMappingURL=multisig.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { programSupportsExtensions, TOKEN_2022_PROGRAM_ID } from '../../constants.js';\nimport { TokenUnsupportedInstructionError } from '../../errors.js';\nimport { addSigners } from '../../instructions/internal.js';\nimport { TokenInstruction } from '../../instructions/types.js';\nexport var CpiGuardInstruction;\n(function (CpiGuardInstruction) {\n CpiGuardInstruction[CpiGuardInstruction[\"Enable\"] = 0] = \"Enable\";\n CpiGuardInstruction[CpiGuardInstruction[\"Disable\"] = 1] = \"Disable\";\n})(CpiGuardInstruction || (CpiGuardInstruction = {}));\n/** TODO: docs */\nexport const cpiGuardInstructionData = struct([u8('instruction'), u8('cpiGuardInstruction')]);\n/**\n * Construct an EnableCpiGuard instruction\n *\n * @param account Token account to update\n * @param authority The account's owner/delegate\n * @param signers The signer account(s)\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createEnableCpiGuardInstruction(account, authority, multiSigners = [], programId = TOKEN_2022_PROGRAM_ID) {\n return createCpiGuardInstruction(CpiGuardInstruction.Enable, account, authority, multiSigners, programId);\n}\n/**\n * Construct a DisableCpiGuard instruction\n *\n * @param account Token account to update\n * @param authority The account's owner/delegate\n * @param signers The signer account(s)\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createDisableCpiGuardInstruction(account, authority, multiSigners = [], programId = TOKEN_2022_PROGRAM_ID) {\n return createCpiGuardInstruction(CpiGuardInstruction.Disable, account, authority, multiSigners, programId);\n}\nfunction createCpiGuardInstruction(cpiGuardInstruction, account, authority, multiSigners, programId) {\n if (!programSupportsExtensions(programId)) {\n throw new TokenUnsupportedInstructionError();\n }\n const keys = addSigners([{ pubkey: account, isSigner: false, isWritable: true }], authority, multiSigners);\n const data = Buffer.alloc(cpiGuardInstructionData.span);\n cpiGuardInstructionData.encode({\n instruction: TokenInstruction.CpiGuardExtension,\n cpiGuardInstruction,\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n//# sourceMappingURL=instructions.js.map","import { struct, u32, u8 } from '@solana/buffer-layout';\nimport { bool, publicKey, u64 } from '@solana/buffer-layout-utils';\nimport { PublicKey } from '@solana/web3.js';\nimport { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenAccountNotFoundError, TokenInvalidAccountOwnerError, TokenInvalidAccountSizeError, TokenInvalidMintError, TokenOwnerOffCurveError, } from '../errors.js';\nimport { ACCOUNT_TYPE_SIZE, AccountType } from '../extensions/accountType.js';\nimport { getMintLen } from '../extensions/extensionType.js';\nimport { ACCOUNT_SIZE } from './account.js';\nimport { MULTISIG_SIZE } from './multisig.js';\n/** Buffer layout for de/serializing a mint */\nexport const MintLayout = struct([\n u32('mintAuthorityOption'),\n publicKey('mintAuthority'),\n u64('supply'),\n u8('decimals'),\n bool('isInitialized'),\n u32('freezeAuthorityOption'),\n publicKey('freezeAuthority'),\n]);\n/** Byte length of a mint */\nexport const MINT_SIZE = MintLayout.span;\n/**\n * Retrieve information about a mint\n *\n * @param connection Connection to use\n * @param address Mint account\n * @param commitment Desired level of commitment for querying the state\n * @param programId SPL Token program account\n *\n * @return Mint information\n */\nexport async function getMint(connection, address, commitment, programId = TOKEN_PROGRAM_ID) {\n const info = await connection.getAccountInfo(address, commitment);\n return unpackMint(address, info, programId);\n}\n/**\n * Unpack a mint\n *\n * @param address Mint account\n * @param info Mint account data\n * @param programId SPL Token program account\n *\n * @return Unpacked mint\n */\nexport function unpackMint(address, info, programId = TOKEN_PROGRAM_ID) {\n if (!info)\n throw new TokenAccountNotFoundError();\n if (!info.owner.equals(programId))\n throw new TokenInvalidAccountOwnerError();\n if (info.data.length < MINT_SIZE)\n throw new TokenInvalidAccountSizeError();\n const rawMint = MintLayout.decode(info.data.slice(0, MINT_SIZE));\n let tlvData = Buffer.alloc(0);\n if (info.data.length > MINT_SIZE) {\n if (info.data.length <= ACCOUNT_SIZE)\n throw new TokenInvalidAccountSizeError();\n if (info.data.length === MULTISIG_SIZE)\n throw new TokenInvalidAccountSizeError();\n if (info.data[ACCOUNT_SIZE] != AccountType.Mint)\n throw new TokenInvalidMintError();\n tlvData = info.data.slice(ACCOUNT_SIZE + ACCOUNT_TYPE_SIZE);\n }\n return {\n address,\n mintAuthority: rawMint.mintAuthorityOption ? rawMint.mintAuthority : null,\n supply: rawMint.supply,\n decimals: rawMint.decimals,\n isInitialized: rawMint.isInitialized,\n freezeAuthority: rawMint.freezeAuthorityOption ? rawMint.freezeAuthority : null,\n tlvData,\n };\n}\n/** Get the minimum lamport balance for a mint to be rent exempt\n *\n * @param connection Connection to use\n * @param commitment Desired level of commitment for querying the state\n *\n * @return Amount of lamports required\n */\nexport async function getMinimumBalanceForRentExemptMint(connection, commitment) {\n return await getMinimumBalanceForRentExemptMintWithExtensions(connection, [], commitment);\n}\n/** Get the minimum lamport balance for a rent-exempt mint with extensions\n *\n * @param connection Connection to use\n * @param extensions Extension types included in the mint\n * @param commitment Desired level of commitment for querying the state\n *\n * @return Amount of lamports required\n */\nexport async function getMinimumBalanceForRentExemptMintWithExtensions(connection, extensions, commitment) {\n const mintLen = getMintLen(extensions);\n return await connection.getMinimumBalanceForRentExemption(mintLen, commitment);\n}\n/**\n * Async version of getAssociatedTokenAddressSync\n * For backwards compatibility\n *\n * @param mint Token mint account\n * @param owner Owner of the new account\n * @param allowOwnerOffCurve Allow the owner account to be a PDA (Program Derived Address)\n * @param programId SPL Token program account\n * @param associatedTokenProgramId SPL Associated Token program account\n *\n * @return Promise containing the address of the associated token account\n */\nexport async function getAssociatedTokenAddress(mint, owner, allowOwnerOffCurve = false, programId = TOKEN_PROGRAM_ID, associatedTokenProgramId = ASSOCIATED_TOKEN_PROGRAM_ID) {\n if (!allowOwnerOffCurve && !PublicKey.isOnCurve(owner.toBuffer()))\n throw new TokenOwnerOffCurveError();\n const [address] = await PublicKey.findProgramAddress([owner.toBuffer(), programId.toBuffer(), mint.toBuffer()], associatedTokenProgramId);\n return address;\n}\n/**\n * Get the address of the associated token account for a given mint and owner\n *\n * @param mint Token mint account\n * @param owner Owner of the new account\n * @param allowOwnerOffCurve Allow the owner account to be a PDA (Program Derived Address)\n * @param programId SPL Token program account\n * @param associatedTokenProgramId SPL Associated Token program account\n *\n * @return Address of the associated token account\n */\nexport function getAssociatedTokenAddressSync(mint, owner, allowOwnerOffCurve = false, programId = TOKEN_PROGRAM_ID, associatedTokenProgramId = ASSOCIATED_TOKEN_PROGRAM_ID) {\n if (!allowOwnerOffCurve && !PublicKey.isOnCurve(owner.toBuffer()))\n throw new TokenOwnerOffCurveError();\n const [address] = PublicKey.findProgramAddressSync([owner.toBuffer(), programId.toBuffer(), mint.toBuffer()], associatedTokenProgramId);\n return address;\n}\n//# sourceMappingURL=mint.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { programSupportsExtensions, TOKEN_2022_PROGRAM_ID } from '../../constants.js';\nimport { TokenUnsupportedInstructionError } from '../../errors.js';\nimport { addSigners } from '../../instructions/internal.js';\nimport { TokenInstruction } from '../../instructions/types.js';\nexport var DefaultAccountStateInstruction;\n(function (DefaultAccountStateInstruction) {\n DefaultAccountStateInstruction[DefaultAccountStateInstruction[\"Initialize\"] = 0] = \"Initialize\";\n DefaultAccountStateInstruction[DefaultAccountStateInstruction[\"Update\"] = 1] = \"Update\";\n})(DefaultAccountStateInstruction || (DefaultAccountStateInstruction = {}));\n/** TODO: docs */\nexport const defaultAccountStateInstructionData = struct([\n u8('instruction'),\n u8('defaultAccountStateInstruction'),\n u8('accountState'),\n]);\n/**\n * Construct an InitializeDefaultAccountState instruction\n *\n * @param mint Mint to initialize\n * @param accountState Default account state to set on all new accounts\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createInitializeDefaultAccountStateInstruction(mint, accountState, programId = TOKEN_2022_PROGRAM_ID) {\n if (!programSupportsExtensions(programId)) {\n throw new TokenUnsupportedInstructionError();\n }\n const keys = [{ pubkey: mint, isSigner: false, isWritable: true }];\n const data = Buffer.alloc(defaultAccountStateInstructionData.span);\n defaultAccountStateInstructionData.encode({\n instruction: TokenInstruction.DefaultAccountStateExtension,\n defaultAccountStateInstruction: DefaultAccountStateInstruction.Initialize,\n accountState,\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Construct an UpdateDefaultAccountState instruction\n *\n * @param mint Mint to update\n * @param accountState Default account state to set on all accounts\n * @param freezeAuthority The mint's freeze authority\n * @param signers The signer account(s) for a multisig\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createUpdateDefaultAccountStateInstruction(mint, accountState, freezeAuthority, multiSigners = [], programId = TOKEN_2022_PROGRAM_ID) {\n if (!programSupportsExtensions(programId)) {\n throw new TokenUnsupportedInstructionError();\n }\n const keys = addSigners([{ pubkey: mint, isSigner: false, isWritable: true }], freezeAuthority, multiSigners);\n const data = Buffer.alloc(defaultAccountStateInstructionData.span);\n defaultAccountStateInstructionData.encode({\n instruction: TokenInstruction.DefaultAccountStateExtension,\n defaultAccountStateInstruction: DefaultAccountStateInstruction.Update,\n accountState,\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n//# sourceMappingURL=instructions.js.map","import { struct } from '@solana/buffer-layout';\nimport { bool } from '@solana/buffer-layout-utils';\nimport { ExtensionType, getExtensionData } from '../extensionType.js';\n/** Buffer layout for de/serializing a CPI Guard extension */\nexport const CpiGuardLayout = struct([bool('lockCpi')]);\nexport const CPI_GUARD_SIZE = CpiGuardLayout.span;\nexport function getCpiGuard(account) {\n const extensionData = getExtensionData(ExtensionType.CpiGuard, account.tlvData);\n if (extensionData !== null) {\n return CpiGuardLayout.decode(extensionData);\n }\n else {\n return null;\n }\n}\n//# sourceMappingURL=state.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { ExtensionType, getExtensionData } from '../extensionType.js';\n/** Buffer layout for de/serializing a transfer fee config extension */\nexport const DefaultAccountStateLayout = struct([u8('state')]);\nexport const DEFAULT_ACCOUNT_STATE_SIZE = DefaultAccountStateLayout.span;\nexport function getDefaultAccountState(mint) {\n const extensionData = getExtensionData(ExtensionType.DefaultAccountState, mint.tlvData);\n if (extensionData !== null) {\n return DefaultAccountStateLayout.decode(extensionData);\n }\n else {\n return null;\n }\n}\n//# sourceMappingURL=state.js.map","import { struct } from '@solana/buffer-layout';\nimport { ExtensionType, getExtensionData } from './extensionType.js';\n/** Buffer layout for de/serializing an account */\nexport const ImmutableOwnerLayout = struct([]);\nexport const IMMUTABLE_OWNER_SIZE = ImmutableOwnerLayout.span;\nexport function getImmutableOwner(account) {\n const extensionData = getExtensionData(ExtensionType.ImmutableOwner, account.tlvData);\n if (extensionData !== null) {\n return ImmutableOwnerLayout.decode(extensionData);\n }\n else {\n return null;\n }\n}\n//# sourceMappingURL=immutableOwner.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { programSupportsExtensions, TOKEN_2022_PROGRAM_ID } from '../../constants.js';\nimport { TokenUnsupportedInstructionError } from '../../errors.js';\nimport { addSigners } from '../../instructions/internal.js';\nimport { TokenInstruction } from '../../instructions/types.js';\nexport var MemoTransferInstruction;\n(function (MemoTransferInstruction) {\n MemoTransferInstruction[MemoTransferInstruction[\"Enable\"] = 0] = \"Enable\";\n MemoTransferInstruction[MemoTransferInstruction[\"Disable\"] = 1] = \"Disable\";\n})(MemoTransferInstruction || (MemoTransferInstruction = {}));\n/** TODO: docs */\nexport const memoTransferInstructionData = struct([\n u8('instruction'),\n u8('memoTransferInstruction'),\n]);\n/**\n * Construct an EnableRequiredMemoTransfers instruction\n *\n * @param account Token account to update\n * @param authority The account's owner/delegate\n * @param signers The signer account(s)\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createEnableRequiredMemoTransfersInstruction(account, authority, multiSigners = [], programId = TOKEN_2022_PROGRAM_ID) {\n return createMemoTransferInstruction(MemoTransferInstruction.Enable, account, authority, multiSigners, programId);\n}\n/**\n * Construct a DisableMemoTransfer instruction\n *\n * @param account Token account to update\n * @param authority The account's owner/delegate\n * @param signers The signer account(s)\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createDisableRequiredMemoTransfersInstruction(account, authority, multiSigners = [], programId = TOKEN_2022_PROGRAM_ID) {\n return createMemoTransferInstruction(MemoTransferInstruction.Disable, account, authority, multiSigners, programId);\n}\nfunction createMemoTransferInstruction(memoTransferInstruction, account, authority, multiSigners, programId) {\n if (!programSupportsExtensions(programId)) {\n throw new TokenUnsupportedInstructionError();\n }\n const keys = addSigners([{ pubkey: account, isSigner: false, isWritable: true }], authority, multiSigners);\n const data = Buffer.alloc(memoTransferInstructionData.span);\n memoTransferInstructionData.encode({\n instruction: TokenInstruction.MemoTransferExtension,\n memoTransferInstruction,\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n//# sourceMappingURL=instructions.js.map","import { ns64, s16, struct } from '@solana/buffer-layout';\nimport { publicKey } from '@solana/buffer-layout-utils';\nimport { ExtensionType, getExtensionData } from '../extensionType.js';\nexport const InterestBearingMintConfigStateLayout = struct([\n publicKey('rateAuthority'),\n ns64('initializationTimestamp'),\n s16('preUpdateAverageRate'),\n ns64('lastUpdateTimestamp'),\n s16('currentRate'),\n]);\nexport const INTEREST_BEARING_MINT_CONFIG_STATE_SIZE = InterestBearingMintConfigStateLayout.span;\nexport function getInterestBearingMintConfigState(mint) {\n const extensionData = getExtensionData(ExtensionType.InterestBearingConfig, mint.tlvData);\n if (extensionData !== null) {\n return InterestBearingMintConfigStateLayout.decode(extensionData);\n }\n return null;\n}\n//# sourceMappingURL=state.js.map","import { struct } from '@solana/buffer-layout';\nimport { bool } from '@solana/buffer-layout-utils';\nimport { ExtensionType, getExtensionData } from '../extensionType.js';\n/** Buffer layout for de/serializing a memo transfer extension */\nexport const MemoTransferLayout = struct([bool('requireIncomingTransferMemos')]);\nexport const MEMO_TRANSFER_SIZE = MemoTransferLayout.span;\nexport function getMemoTransfer(account) {\n const extensionData = getExtensionData(ExtensionType.MemoTransfer, account.tlvData);\n if (extensionData !== null) {\n return MemoTransferLayout.decode(extensionData);\n }\n else {\n return null;\n }\n}\n//# sourceMappingURL=state.js.map","import { struct } from '@solana/buffer-layout';\nimport { publicKey } from '@solana/buffer-layout-utils';\nimport { ExtensionType, getExtensionData } from './extensionType.js';\n/** Buffer layout for de/serializing a mint */\nexport const MintCloseAuthorityLayout = struct([publicKey('closeAuthority')]);\nexport const MINT_CLOSE_AUTHORITY_SIZE = MintCloseAuthorityLayout.span;\nexport function getMintCloseAuthority(mint) {\n const extensionData = getExtensionData(ExtensionType.MintCloseAuthority, mint.tlvData);\n if (extensionData !== null) {\n return MintCloseAuthorityLayout.decode(extensionData);\n }\n else {\n return null;\n }\n}\n//# sourceMappingURL=mintCloseAuthority.js.map","import { struct } from '@solana/buffer-layout';\nimport { ExtensionType, getExtensionData } from './extensionType.js';\n/** Buffer layout for de/serializing an account */\nexport const NonTransferableLayout = struct([]);\nexport const NON_TRANSFERABLE_SIZE = NonTransferableLayout.span;\nexport const NON_TRANSFERABLE_ACCOUNT_SIZE = NonTransferableLayout.span;\nexport function getNonTransferable(mint) {\n const extensionData = getExtensionData(ExtensionType.NonTransferable, mint.tlvData);\n if (extensionData !== null) {\n return NonTransferableLayout.decode(extensionData);\n }\n else {\n return null;\n }\n}\nexport function getNonTransferableAccount(account) {\n const extensionData = getExtensionData(ExtensionType.NonTransferableAccount, account.tlvData);\n if (extensionData !== null) {\n return NonTransferableLayout.decode(extensionData);\n }\n else {\n return null;\n }\n}\n//# sourceMappingURL=nonTransferable.js.map","import { struct, u16, u8 } from '@solana/buffer-layout';\nimport { publicKey, u64 } from '@solana/buffer-layout-utils';\nimport { PublicKey, TransactionInstruction } from '@solana/web3.js';\nimport { programSupportsExtensions, TOKEN_2022_PROGRAM_ID } from '../../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, TokenUnsupportedInstructionError, } from '../../errors.js';\nimport { addSigners } from '../../instructions/internal.js';\nimport { TokenInstruction } from '../../instructions/types.js';\nexport var TransferFeeInstruction;\n(function (TransferFeeInstruction) {\n TransferFeeInstruction[TransferFeeInstruction[\"InitializeTransferFeeConfig\"] = 0] = \"InitializeTransferFeeConfig\";\n TransferFeeInstruction[TransferFeeInstruction[\"TransferCheckedWithFee\"] = 1] = \"TransferCheckedWithFee\";\n TransferFeeInstruction[TransferFeeInstruction[\"WithdrawWithheldTokensFromMint\"] = 2] = \"WithdrawWithheldTokensFromMint\";\n TransferFeeInstruction[TransferFeeInstruction[\"WithdrawWithheldTokensFromAccounts\"] = 3] = \"WithdrawWithheldTokensFromAccounts\";\n TransferFeeInstruction[TransferFeeInstruction[\"HarvestWithheldTokensToMint\"] = 4] = \"HarvestWithheldTokensToMint\";\n TransferFeeInstruction[TransferFeeInstruction[\"SetTransferFee\"] = 5] = \"SetTransferFee\";\n})(TransferFeeInstruction || (TransferFeeInstruction = {}));\n/** TODO: docs */\nexport const initializeTransferFeeConfigInstructionData = struct([\n u8('instruction'),\n u8('transferFeeInstruction'),\n u8('transferFeeConfigAuthorityOption'),\n publicKey('transferFeeConfigAuthority'),\n u8('withdrawWithheldAuthorityOption'),\n publicKey('withdrawWithheldAuthority'),\n u16('transferFeeBasisPoints'),\n u64('maximumFee'),\n]);\n/**\n * Construct an InitializeTransferFeeConfig instruction\n *\n * @param mint Token mint account\n * @param transferFeeConfigAuthority Optional authority that can update the fees\n * @param withdrawWithheldAuthority Optional authority that can withdraw fees\n * @param transferFeeBasisPoints Amount of transfer collected as fees, expressed as basis points of the transfer amount\n * @param maximumFee Maximum fee assessed on transfers\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createInitializeTransferFeeConfigInstruction(mint, transferFeeConfigAuthority, withdrawWithheldAuthority, transferFeeBasisPoints, maximumFee, programId = TOKEN_2022_PROGRAM_ID) {\n if (!programSupportsExtensions(programId)) {\n throw new TokenUnsupportedInstructionError();\n }\n const keys = [{ pubkey: mint, isSigner: false, isWritable: true }];\n const data = Buffer.alloc(initializeTransferFeeConfigInstructionData.span);\n initializeTransferFeeConfigInstructionData.encode({\n instruction: TokenInstruction.TransferFeeExtension,\n transferFeeInstruction: TransferFeeInstruction.InitializeTransferFeeConfig,\n transferFeeConfigAuthorityOption: transferFeeConfigAuthority ? 1 : 0,\n transferFeeConfigAuthority: transferFeeConfigAuthority || new PublicKey(0),\n withdrawWithheldAuthorityOption: withdrawWithheldAuthority ? 1 : 0,\n withdrawWithheldAuthority: withdrawWithheldAuthority || new PublicKey(0),\n transferFeeBasisPoints: transferFeeBasisPoints,\n maximumFee: maximumFee,\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode an InitializeTransferFeeConfig instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeInitializeTransferFeeConfigInstruction(instruction, programId) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== initializeTransferFeeConfigInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { mint }, data, } = decodeInitializeTransferFeeConfigInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.TransferFeeExtension ||\n data.transferFeeInstruction !== TransferFeeInstruction.InitializeTransferFeeConfig)\n throw new TokenInvalidInstructionTypeError();\n if (!mint)\n throw new TokenInvalidInstructionKeysError();\n return {\n programId,\n keys: {\n mint,\n },\n data,\n };\n}\n/**\n * Decode an InitializeTransferFeeConfig instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeInitializeTransferFeeConfigInstructionUnchecked({ programId, keys: [mint], data, }) {\n const { instruction, transferFeeInstruction, transferFeeConfigAuthorityOption, transferFeeConfigAuthority, withdrawWithheldAuthorityOption, withdrawWithheldAuthority, transferFeeBasisPoints, maximumFee, } = initializeTransferFeeConfigInstructionData.decode(data);\n return {\n programId,\n keys: {\n mint,\n },\n data: {\n instruction,\n transferFeeInstruction,\n transferFeeConfigAuthority: transferFeeConfigAuthorityOption ? transferFeeConfigAuthority : null,\n withdrawWithheldAuthority: withdrawWithheldAuthorityOption ? withdrawWithheldAuthority : null,\n transferFeeBasisPoints,\n maximumFee,\n },\n };\n}\nexport const transferCheckedWithFeeInstructionData = struct([\n u8('instruction'),\n u8('transferFeeInstruction'),\n u64('amount'),\n u8('decimals'),\n u64('fee'),\n]);\n/**\n * Construct an TransferCheckedWithFee instruction\n *\n * @param source The source account\n * @param mint The token mint\n * @param destination The destination account\n * @param authority The source account's owner/delegate\n * @param signers The signer account(s)\n * @param amount The amount of tokens to transfer\n * @param decimals The expected number of base 10 digits to the right of the decimal place\n * @param fee The expected fee assesed on this transfer, calculated off-chain based on the transferFeeBasisPoints and maximumFee of the mint.\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createTransferCheckedWithFeeInstruction(source, mint, destination, authority, amount, decimals, fee, multiSigners = [], programId = TOKEN_2022_PROGRAM_ID) {\n if (!programSupportsExtensions(programId)) {\n throw new TokenUnsupportedInstructionError();\n }\n const data = Buffer.alloc(transferCheckedWithFeeInstructionData.span);\n transferCheckedWithFeeInstructionData.encode({\n instruction: TokenInstruction.TransferFeeExtension,\n transferFeeInstruction: TransferFeeInstruction.TransferCheckedWithFee,\n amount,\n decimals,\n fee,\n }, data);\n const keys = addSigners([\n { pubkey: source, isSigner: false, isWritable: true },\n { pubkey: mint, isSigner: false, isWritable: false },\n { pubkey: destination, isSigner: false, isWritable: true },\n ], authority, multiSigners);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode a TransferCheckedWithFee instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeTransferCheckedWithFeeInstruction(instruction, programId) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== transferCheckedWithFeeInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { source, mint, destination, authority, signers }, data, } = decodeTransferCheckedWithFeeInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.TransferFeeExtension ||\n data.transferFeeInstruction !== TransferFeeInstruction.TransferCheckedWithFee)\n throw new TokenInvalidInstructionTypeError();\n if (!mint)\n throw new TokenInvalidInstructionKeysError();\n return {\n programId,\n keys: {\n source,\n mint,\n destination,\n authority,\n signers: signers ? signers : null,\n },\n data,\n };\n}\n/**\n * Decode a TransferCheckedWithFees instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeTransferCheckedWithFeeInstructionUnchecked({ programId, keys: [source, mint, destination, authority, ...signers], data, }) {\n const { instruction, transferFeeInstruction, amount, decimals, fee } = transferCheckedWithFeeInstructionData.decode(data);\n return {\n programId,\n keys: {\n source,\n mint,\n destination,\n authority,\n signers,\n },\n data: {\n instruction,\n transferFeeInstruction,\n amount,\n decimals,\n fee,\n },\n };\n}\nexport const withdrawWithheldTokensFromMintInstructionData = struct([\n u8('instruction'),\n u8('transferFeeInstruction'),\n]);\n/**\n * Construct a WithdrawWithheldTokensFromMint instruction\n *\n * @param mint The token mint\n * @param destination The destination account\n * @param authority The source account's owner/delegate\n * @param signers The signer account(s)\n * @param programID SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createWithdrawWithheldTokensFromMintInstruction(mint, destination, authority, signers = [], programId = TOKEN_2022_PROGRAM_ID) {\n if (!programSupportsExtensions(programId)) {\n throw new TokenUnsupportedInstructionError();\n }\n const data = Buffer.alloc(withdrawWithheldTokensFromMintInstructionData.span);\n withdrawWithheldTokensFromMintInstructionData.encode({\n instruction: TokenInstruction.TransferFeeExtension,\n transferFeeInstruction: TransferFeeInstruction.WithdrawWithheldTokensFromMint,\n }, data);\n const keys = addSigners([\n { pubkey: mint, isSigner: false, isWritable: true },\n { pubkey: destination, isSigner: false, isWritable: true },\n ], authority, signers);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode a WithdrawWithheldTokensFromMint instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeWithdrawWithheldTokensFromMintInstruction(instruction, programId) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== withdrawWithheldTokensFromMintInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { mint, destination, authority, signers }, data, } = decodeWithdrawWithheldTokensFromMintInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.TransferFeeExtension ||\n data.transferFeeInstruction !== TransferFeeInstruction.WithdrawWithheldTokensFromMint)\n throw new TokenInvalidInstructionTypeError();\n if (!mint)\n throw new TokenInvalidInstructionKeysError();\n return {\n programId,\n keys: {\n mint,\n destination,\n authority,\n signers: signers ? signers : null,\n },\n data,\n };\n}\n/**\n * Decode a WithdrawWithheldTokensFromMint instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeWithdrawWithheldTokensFromMintInstructionUnchecked({ programId, keys: [mint, destination, authority, ...signers], data, }) {\n const { instruction, transferFeeInstruction } = withdrawWithheldTokensFromMintInstructionData.decode(data);\n return {\n programId,\n keys: {\n mint,\n destination,\n authority,\n signers,\n },\n data: {\n instruction,\n transferFeeInstruction,\n },\n };\n}\nexport const withdrawWithheldTokensFromAccountsInstructionData = struct([\n u8('instruction'),\n u8('transferFeeInstruction'),\n u8('numTokenAccounts'),\n]);\n/**\n * Construct a WithdrawWithheldTokensFromAccounts instruction\n *\n * @param mint The token mint\n * @param destination The destination account\n * @param authority The source account's owner/delegate\n * @param signers The signer account(s)\n * @param sources The source accounts to withdraw from\n * @param programID SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createWithdrawWithheldTokensFromAccountsInstruction(mint, destination, authority, signers, sources, programId = TOKEN_2022_PROGRAM_ID) {\n if (!programSupportsExtensions(programId)) {\n throw new TokenUnsupportedInstructionError();\n }\n const data = Buffer.alloc(withdrawWithheldTokensFromAccountsInstructionData.span);\n withdrawWithheldTokensFromAccountsInstructionData.encode({\n instruction: TokenInstruction.TransferFeeExtension,\n transferFeeInstruction: TransferFeeInstruction.WithdrawWithheldTokensFromAccounts,\n numTokenAccounts: sources.length,\n }, data);\n const keys = addSigners([\n { pubkey: mint, isSigner: false, isWritable: true },\n { pubkey: destination, isSigner: false, isWritable: true },\n ], authority, signers);\n for (const source of sources) {\n keys.push({ pubkey: source, isSigner: false, isWritable: true });\n }\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode a WithdrawWithheldTokensFromAccounts instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeWithdrawWithheldTokensFromAccountsInstruction(instruction, programId) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== withdrawWithheldTokensFromAccountsInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { mint, destination, authority, signers, sources }, data, } = decodeWithdrawWithheldTokensFromAccountsInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.TransferFeeExtension ||\n data.transferFeeInstruction !== TransferFeeInstruction.WithdrawWithheldTokensFromAccounts)\n throw new TokenInvalidInstructionTypeError();\n if (!mint)\n throw new TokenInvalidInstructionKeysError();\n return {\n programId,\n keys: {\n mint,\n destination,\n authority,\n signers: signers ? signers : null,\n sources: sources ? sources : null,\n },\n data,\n };\n}\n/**\n * Decode a WithdrawWithheldTokensFromAccount instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeWithdrawWithheldTokensFromAccountsInstructionUnchecked({ programId, keys, data, }) {\n const { instruction, transferFeeInstruction, numTokenAccounts } = withdrawWithheldTokensFromAccountsInstructionData.decode(data);\n const [mint, destination, authority, signers, sources] = [\n keys[0],\n keys[1],\n keys[2],\n keys.slice(3, 3 + numTokenAccounts),\n keys.slice(-1 * numTokenAccounts),\n ];\n return {\n programId,\n keys: {\n mint,\n destination,\n authority,\n signers,\n sources,\n },\n data: {\n instruction,\n transferFeeInstruction,\n numTokenAccounts,\n },\n };\n}\nexport const harvestWithheldTokensToMintInstructionData = struct([\n u8('instruction'),\n u8('transferFeeInstruction'),\n]);\n/**\n * Construct a HarvestWithheldTokensToMint instruction\n *\n * @param mint The token mint\n * @param sources The source accounts to withdraw from\n * @param programID SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createHarvestWithheldTokensToMintInstruction(mint, sources, programId = TOKEN_2022_PROGRAM_ID) {\n if (!programSupportsExtensions(programId)) {\n throw new TokenUnsupportedInstructionError();\n }\n const data = Buffer.alloc(harvestWithheldTokensToMintInstructionData.span);\n harvestWithheldTokensToMintInstructionData.encode({\n instruction: TokenInstruction.TransferFeeExtension,\n transferFeeInstruction: TransferFeeInstruction.HarvestWithheldTokensToMint,\n }, data);\n const keys = [];\n keys.push({ pubkey: mint, isSigner: false, isWritable: true });\n for (const source of sources) {\n keys.push({ pubkey: source, isSigner: false, isWritable: true });\n }\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode a HarvestWithheldTokensToMint instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeHarvestWithheldTokensToMintInstruction(instruction, programId) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== harvestWithheldTokensToMintInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { mint, sources }, data, } = decodeHarvestWithheldTokensToMintInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.TransferFeeExtension ||\n data.transferFeeInstruction !== TransferFeeInstruction.HarvestWithheldTokensToMint)\n throw new TokenInvalidInstructionTypeError();\n if (!mint)\n throw new TokenInvalidInstructionKeysError();\n return {\n programId,\n keys: {\n mint,\n sources,\n },\n data,\n };\n}\n/**\n * Decode a HarvestWithheldTokensToMint instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeHarvestWithheldTokensToMintInstructionUnchecked({ programId, keys: [mint, ...sources], data, }) {\n const { instruction, transferFeeInstruction } = harvestWithheldTokensToMintInstructionData.decode(data);\n return {\n programId,\n keys: {\n mint,\n sources,\n },\n data: {\n instruction,\n transferFeeInstruction,\n },\n };\n}\n//# sourceMappingURL=instructions.js.map","import { struct, u16 } from '@solana/buffer-layout';\nimport { publicKey, u64 } from '@solana/buffer-layout-utils';\nimport { ExtensionType, getExtensionData } from '../extensionType.js';\nexport const MAX_FEE_BASIS_POINTS = 10000;\nexport const ONE_IN_BASIS_POINTS = MAX_FEE_BASIS_POINTS;\n/** Buffer layout for de/serializing a transfer fee */\nexport function transferFeeLayout(property) {\n return struct([u64('epoch'), u64('maximumFee'), u16('transferFeeBasisPoints')], property);\n}\n/** Buffer layout for de/serializing a transfer fee config extension */\nexport const TransferFeeConfigLayout = struct([\n publicKey('transferFeeConfigAuthority'),\n publicKey('withdrawWithheldAuthority'),\n u64('withheldAmount'),\n transferFeeLayout('olderTransferFee'),\n transferFeeLayout('newerTransferFee'),\n]);\nexport const TRANSFER_FEE_CONFIG_SIZE = TransferFeeConfigLayout.span;\n/** Buffer layout for de/serializing */\nexport const TransferFeeAmountLayout = struct([u64('withheldAmount')]);\nexport const TRANSFER_FEE_AMOUNT_SIZE = TransferFeeAmountLayout.span;\nexport function getTransferFeeConfig(mint) {\n const extensionData = getExtensionData(ExtensionType.TransferFeeConfig, mint.tlvData);\n if (extensionData !== null) {\n return TransferFeeConfigLayout.decode(extensionData);\n }\n else {\n return null;\n }\n}\nexport function getTransferFeeAmount(account) {\n const extensionData = getExtensionData(ExtensionType.TransferFeeAmount, account.tlvData);\n if (extensionData !== null) {\n return TransferFeeAmountLayout.decode(extensionData);\n }\n else {\n return null;\n }\n}\n//# sourceMappingURL=state.js.map","import { struct } from '@solana/buffer-layout';\nimport { publicKey } from '@solana/buffer-layout-utils';\nimport { ExtensionType, getExtensionData } from './extensionType.js';\n/** Buffer layout for de/serializing a mint */\nexport const PermanentDelegateLayout = struct([publicKey('delegate')]);\nexport const PERMANENT_DELEGATE_SIZE = PermanentDelegateLayout.span;\nexport function getPermanentDelegate(mint) {\n const extensionData = getExtensionData(ExtensionType.PermanentDelegate, mint.tlvData);\n if (extensionData !== null) {\n return PermanentDelegateLayout.decode(extensionData);\n }\n else {\n return null;\n }\n}\n//# sourceMappingURL=permanentDelegate.js.map","import { ACCOUNT_SIZE } from '../state/account.js';\nimport { MINT_SIZE } from '../state/mint.js';\nimport { MULTISIG_SIZE } from '../state/multisig.js';\nimport { ACCOUNT_TYPE_SIZE } from './accountType.js';\nimport { CPI_GUARD_SIZE } from './cpiGuard/index.js';\nimport { DEFAULT_ACCOUNT_STATE_SIZE } from './defaultAccountState/index.js';\nimport { IMMUTABLE_OWNER_SIZE } from './immutableOwner.js';\nimport { INTEREST_BEARING_MINT_CONFIG_STATE_SIZE } from './interestBearingMint/state.js';\nimport { MEMO_TRANSFER_SIZE } from './memoTransfer/index.js';\nimport { MINT_CLOSE_AUTHORITY_SIZE } from './mintCloseAuthority.js';\nimport { NON_TRANSFERABLE_SIZE, NON_TRANSFERABLE_ACCOUNT_SIZE } from './nonTransferable.js';\nimport { PERMANENT_DELEGATE_SIZE } from './permanentDelegate.js';\nimport { TRANSFER_FEE_AMOUNT_SIZE, TRANSFER_FEE_CONFIG_SIZE } from './transferFee/index.js';\nexport var ExtensionType;\n(function (ExtensionType) {\n ExtensionType[ExtensionType[\"Uninitialized\"] = 0] = \"Uninitialized\";\n ExtensionType[ExtensionType[\"TransferFeeConfig\"] = 1] = \"TransferFeeConfig\";\n ExtensionType[ExtensionType[\"TransferFeeAmount\"] = 2] = \"TransferFeeAmount\";\n ExtensionType[ExtensionType[\"MintCloseAuthority\"] = 3] = \"MintCloseAuthority\";\n ExtensionType[ExtensionType[\"ConfidentialTransferMint\"] = 4] = \"ConfidentialTransferMint\";\n ExtensionType[ExtensionType[\"ConfidentialTransferAccount\"] = 5] = \"ConfidentialTransferAccount\";\n ExtensionType[ExtensionType[\"DefaultAccountState\"] = 6] = \"DefaultAccountState\";\n ExtensionType[ExtensionType[\"ImmutableOwner\"] = 7] = \"ImmutableOwner\";\n ExtensionType[ExtensionType[\"MemoTransfer\"] = 8] = \"MemoTransfer\";\n ExtensionType[ExtensionType[\"NonTransferable\"] = 9] = \"NonTransferable\";\n ExtensionType[ExtensionType[\"InterestBearingConfig\"] = 10] = \"InterestBearingConfig\";\n ExtensionType[ExtensionType[\"CpiGuard\"] = 11] = \"CpiGuard\";\n ExtensionType[ExtensionType[\"PermanentDelegate\"] = 12] = \"PermanentDelegate\";\n ExtensionType[ExtensionType[\"NonTransferableAccount\"] = 13] = \"NonTransferableAccount\";\n})(ExtensionType || (ExtensionType = {}));\nexport const TYPE_SIZE = 2;\nexport const LENGTH_SIZE = 2;\n// NOTE: All of these should eventually use their type's Span instead of these\n// constants. This is provided for at least creation to work.\nexport function getTypeLen(e) {\n switch (e) {\n case ExtensionType.Uninitialized:\n return 0;\n case ExtensionType.TransferFeeConfig:\n return TRANSFER_FEE_CONFIG_SIZE;\n case ExtensionType.TransferFeeAmount:\n return TRANSFER_FEE_AMOUNT_SIZE;\n case ExtensionType.MintCloseAuthority:\n return MINT_CLOSE_AUTHORITY_SIZE;\n case ExtensionType.ConfidentialTransferMint:\n return 97;\n case ExtensionType.ConfidentialTransferAccount:\n return 286;\n case ExtensionType.CpiGuard:\n return CPI_GUARD_SIZE;\n case ExtensionType.DefaultAccountState:\n return DEFAULT_ACCOUNT_STATE_SIZE;\n case ExtensionType.ImmutableOwner:\n return IMMUTABLE_OWNER_SIZE;\n case ExtensionType.MemoTransfer:\n return MEMO_TRANSFER_SIZE;\n case ExtensionType.NonTransferable:\n return NON_TRANSFERABLE_SIZE;\n case ExtensionType.InterestBearingConfig:\n return INTEREST_BEARING_MINT_CONFIG_STATE_SIZE;\n case ExtensionType.PermanentDelegate:\n return PERMANENT_DELEGATE_SIZE;\n case ExtensionType.NonTransferableAccount:\n return NON_TRANSFERABLE_ACCOUNT_SIZE;\n default:\n throw Error(`Unknown extension type: ${e}`);\n }\n}\nexport function isMintExtension(e) {\n switch (e) {\n case ExtensionType.TransferFeeConfig:\n case ExtensionType.MintCloseAuthority:\n case ExtensionType.ConfidentialTransferMint:\n case ExtensionType.DefaultAccountState:\n case ExtensionType.NonTransferable:\n case ExtensionType.InterestBearingConfig:\n case ExtensionType.PermanentDelegate:\n return true;\n case ExtensionType.Uninitialized:\n case ExtensionType.TransferFeeAmount:\n case ExtensionType.ConfidentialTransferAccount:\n case ExtensionType.ImmutableOwner:\n case ExtensionType.MemoTransfer:\n case ExtensionType.CpiGuard:\n case ExtensionType.NonTransferableAccount:\n return false;\n default:\n throw Error(`Unknown extension type: ${e}`);\n }\n}\nexport function isAccountExtension(e) {\n switch (e) {\n case ExtensionType.TransferFeeAmount:\n case ExtensionType.ConfidentialTransferAccount:\n case ExtensionType.ImmutableOwner:\n case ExtensionType.MemoTransfer:\n case ExtensionType.CpiGuard:\n case ExtensionType.NonTransferableAccount:\n return true;\n case ExtensionType.Uninitialized:\n case ExtensionType.TransferFeeConfig:\n case ExtensionType.MintCloseAuthority:\n case ExtensionType.ConfidentialTransferMint:\n case ExtensionType.DefaultAccountState:\n case ExtensionType.NonTransferable:\n case ExtensionType.InterestBearingConfig:\n case ExtensionType.PermanentDelegate:\n return false;\n default:\n throw Error(`Unknown extension type: ${e}`);\n }\n}\nexport function getAccountTypeOfMintType(e) {\n switch (e) {\n case ExtensionType.TransferFeeConfig:\n return ExtensionType.TransferFeeAmount;\n case ExtensionType.ConfidentialTransferMint:\n return ExtensionType.ConfidentialTransferAccount;\n case ExtensionType.NonTransferable:\n return ExtensionType.NonTransferableAccount;\n case ExtensionType.TransferFeeAmount:\n case ExtensionType.ConfidentialTransferAccount:\n case ExtensionType.CpiGuard:\n case ExtensionType.DefaultAccountState:\n case ExtensionType.ImmutableOwner:\n case ExtensionType.MemoTransfer:\n case ExtensionType.MintCloseAuthority:\n case ExtensionType.Uninitialized:\n case ExtensionType.InterestBearingConfig:\n case ExtensionType.PermanentDelegate:\n case ExtensionType.NonTransferableAccount:\n return ExtensionType.Uninitialized;\n }\n}\nfunction getLen(extensionTypes, baseSize) {\n if (extensionTypes.length === 0) {\n return baseSize;\n }\n else {\n const accountLength = ACCOUNT_SIZE +\n ACCOUNT_TYPE_SIZE +\n extensionTypes\n .filter((element, i) => i === extensionTypes.indexOf(element))\n .map((element) => getTypeLen(element) + TYPE_SIZE + LENGTH_SIZE)\n .reduce((a, b) => a + b);\n if (accountLength === MULTISIG_SIZE) {\n return accountLength + TYPE_SIZE;\n }\n else {\n return accountLength;\n }\n }\n}\nexport function getMintLen(extensionTypes) {\n return getLen(extensionTypes, MINT_SIZE);\n}\nexport function getAccountLen(extensionTypes) {\n return getLen(extensionTypes, ACCOUNT_SIZE);\n}\nexport function getExtensionData(extension, tlvData) {\n let extensionTypeIndex = 0;\n while (extensionTypeIndex + TYPE_SIZE + LENGTH_SIZE <= tlvData.length) {\n const entryType = tlvData.readUInt16LE(extensionTypeIndex);\n const entryLength = tlvData.readUInt16LE(extensionTypeIndex + TYPE_SIZE);\n const typeIndex = extensionTypeIndex + TYPE_SIZE + LENGTH_SIZE;\n if (entryType == extension) {\n return tlvData.slice(typeIndex, typeIndex + entryLength);\n }\n extensionTypeIndex = typeIndex + entryLength;\n }\n return null;\n}\nexport function getExtensionTypes(tlvData) {\n const extensionTypes = [];\n let extensionTypeIndex = 0;\n while (extensionTypeIndex < tlvData.length) {\n const entryType = tlvData.readUInt16LE(extensionTypeIndex);\n extensionTypes.push(entryType);\n const entryLength = tlvData.readUInt16LE(extensionTypeIndex + TYPE_SIZE);\n extensionTypeIndex += TYPE_SIZE + LENGTH_SIZE + entryLength;\n }\n return extensionTypes;\n}\nexport function getAccountLenForMint(mint) {\n const extensionTypes = getExtensionTypes(mint.tlvData);\n const accountExtensions = extensionTypes.map(getAccountTypeOfMintType);\n return getAccountLen(accountExtensions);\n}\n//# sourceMappingURL=extensionType.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { SYSVAR_RENT_PUBKEY, TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const initializeAccountInstructionData = struct([u8('instruction')]);\n/**\n * Construct an InitializeAccount instruction\n *\n * @param account New token account\n * @param mint Mint account\n * @param owner Owner of the new account\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createInitializeAccountInstruction(account, mint, owner, programId = TOKEN_PROGRAM_ID) {\n const keys = [\n { pubkey: account, isSigner: false, isWritable: true },\n { pubkey: mint, isSigner: false, isWritable: false },\n { pubkey: owner, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false },\n ];\n const data = Buffer.alloc(initializeAccountInstructionData.span);\n initializeAccountInstructionData.encode({ instruction: TokenInstruction.InitializeAccount }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode an InitializeAccount instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeInitializeAccountInstruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== initializeAccountInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { account, mint, owner, rent }, data, } = decodeInitializeAccountInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.InitializeAccount)\n throw new TokenInvalidInstructionTypeError();\n if (!account || !mint || !owner || !rent)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n account,\n mint,\n owner,\n rent,\n },\n data,\n };\n}\n/**\n * Decode an InitializeAccount instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeInitializeAccountInstructionUnchecked({ programId, keys: [account, mint, owner, rent], data, }) {\n return {\n programId,\n keys: {\n account,\n mint,\n owner,\n rent,\n },\n data: initializeAccountInstructionData.decode(data),\n };\n}\n//# sourceMappingURL=initializeAccount.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { publicKey } from '@solana/buffer-layout-utils';\nimport { PublicKey, TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const initializeMint2InstructionData = struct([\n u8('instruction'),\n u8('decimals'),\n publicKey('mintAuthority'),\n u8('freezeAuthorityOption'),\n publicKey('freezeAuthority'),\n]);\n/**\n * Construct an InitializeMint2 instruction\n *\n * @param mint Token mint account\n * @param decimals Number of decimals in token account amounts\n * @param mintAuthority Minting authority\n * @param freezeAuthority Optional authority that can freeze token accounts\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createInitializeMint2Instruction(mint, decimals, mintAuthority, freezeAuthority, programId = TOKEN_PROGRAM_ID) {\n const keys = [{ pubkey: mint, isSigner: false, isWritable: true }];\n const data = Buffer.alloc(initializeMint2InstructionData.span);\n initializeMint2InstructionData.encode({\n instruction: TokenInstruction.InitializeMint2,\n decimals,\n mintAuthority,\n freezeAuthorityOption: freezeAuthority ? 1 : 0,\n freezeAuthority: freezeAuthority || new PublicKey(0),\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode an InitializeMint2 instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeInitializeMint2Instruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== initializeMint2InstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { mint }, data, } = decodeInitializeMint2InstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.InitializeMint2)\n throw new TokenInvalidInstructionTypeError();\n if (!mint)\n throw new TokenInvalidInstructionKeysError();\n return {\n programId,\n keys: {\n mint,\n },\n data,\n };\n}\n/**\n * Decode an InitializeMint2 instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeInitializeMint2InstructionUnchecked({ programId, keys: [mint], data, }) {\n const { instruction, decimals, mintAuthority, freezeAuthorityOption, freezeAuthority } = initializeMint2InstructionData.decode(data);\n return {\n programId,\n keys: {\n mint,\n },\n data: {\n instruction,\n decimals,\n mintAuthority,\n freezeAuthority: freezeAuthorityOption ? freezeAuthority : null,\n },\n };\n}\n//# sourceMappingURL=initializeMint2.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { PublicKey, SYSVAR_RENT_PUBKEY, TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const initializeMultisigInstructionData = struct([\n u8('instruction'),\n u8('m'),\n]);\n/**\n * Construct an InitializeMultisig instruction\n *\n * @param account Multisig account\n * @param signers Full set of signers\n * @param m Number of required signatures\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createInitializeMultisigInstruction(account, signers, m, programId = TOKEN_PROGRAM_ID) {\n const keys = [\n { pubkey: account, isSigner: false, isWritable: true },\n { pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false },\n ];\n for (const signer of signers) {\n keys.push({\n pubkey: signer instanceof PublicKey ? signer : signer.publicKey,\n isSigner: false,\n isWritable: false,\n });\n }\n const data = Buffer.alloc(initializeMultisigInstructionData.span);\n initializeMultisigInstructionData.encode({\n instruction: TokenInstruction.InitializeMultisig,\n m,\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode an InitializeMultisig instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeInitializeMultisigInstruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== initializeMultisigInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { account, rent, signers }, data, } = decodeInitializeMultisigInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.InitializeMultisig)\n throw new TokenInvalidInstructionTypeError();\n if (!account || !rent || !signers.length)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n account,\n rent,\n signers,\n },\n data,\n };\n}\n/**\n * Decode an InitializeMultisig instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeInitializeMultisigInstructionUnchecked({ programId, keys: [account, rent, ...signers], data, }) {\n return {\n programId,\n keys: {\n account,\n rent,\n signers,\n },\n data: initializeMultisigInstructionData.decode(data),\n };\n}\n//# sourceMappingURL=initializeMultisig.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { SystemProgram, TransactionInstruction } from '@solana/web3.js';\nimport { NATIVE_MINT_2022, programSupportsExtensions, TOKEN_2022_PROGRAM_ID } from '../constants.js';\nimport { TokenUnsupportedInstructionError } from '../errors.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const createNativeMintInstructionData = struct([u8('instruction')]);\n/**\n * Construct a CreateNativeMint instruction\n *\n * @param account New token account\n * @param mint Mint account\n * @param owner Owner of the new account\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createCreateNativeMintInstruction(payer, nativeMintId = NATIVE_MINT_2022, programId = TOKEN_2022_PROGRAM_ID) {\n if (!programSupportsExtensions(programId)) {\n throw new TokenUnsupportedInstructionError();\n }\n const keys = [\n { pubkey: payer, isSigner: true, isWritable: true },\n { pubkey: nativeMintId, isSigner: false, isWritable: true },\n { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },\n ];\n const data = Buffer.alloc(createNativeMintInstructionData.span);\n createNativeMintInstructionData.encode({ instruction: TokenInstruction.CreateNativeMint }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n//# sourceMappingURL=createNativeMint.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const syncNativeInstructionData = struct([u8('instruction')]);\n/**\n * Construct a SyncNative instruction\n *\n * @param account Native account to sync lamports from\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createSyncNativeInstruction(account, programId = TOKEN_PROGRAM_ID) {\n const keys = [{ pubkey: account, isSigner: false, isWritable: true }];\n const data = Buffer.alloc(syncNativeInstructionData.span);\n syncNativeInstructionData.encode({ instruction: TokenInstruction.SyncNative }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode a SyncNative instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeSyncNativeInstruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== syncNativeInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { account }, data, } = decodeSyncNativeInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.SyncNative)\n throw new TokenInvalidInstructionTypeError();\n if (!account)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n account,\n },\n data,\n };\n}\n/**\n * Decode a SyncNative instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeSyncNativeInstructionUnchecked({ programId, keys: [account], data, }) {\n return {\n programId,\n keys: {\n account,\n },\n data: syncNativeInstructionData.decode(data),\n };\n}\n//# sourceMappingURL=syncNative.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { addSigners } from './internal.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const freezeAccountInstructionData = struct([u8('instruction')]);\n/**\n * Construct a FreezeAccount instruction\n *\n * @param account Account to freeze\n * @param mint Mint account\n * @param authority Mint freeze authority\n * @param multiSigners Signing accounts if `authority` is a multisig\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createFreezeAccountInstruction(account, mint, authority, multiSigners = [], programId = TOKEN_PROGRAM_ID) {\n const keys = addSigners([\n { pubkey: account, isSigner: false, isWritable: true },\n { pubkey: mint, isSigner: false, isWritable: false },\n ], authority, multiSigners);\n const data = Buffer.alloc(freezeAccountInstructionData.span);\n freezeAccountInstructionData.encode({ instruction: TokenInstruction.FreezeAccount }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode a FreezeAccount instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeFreezeAccountInstruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== freezeAccountInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { account, mint, authority, multiSigners }, data, } = decodeFreezeAccountInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.FreezeAccount)\n throw new TokenInvalidInstructionTypeError();\n if (!account || !mint || !authority)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n account,\n mint,\n authority,\n multiSigners,\n },\n data,\n };\n}\n/**\n * Decode a FreezeAccount instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeFreezeAccountInstructionUnchecked({ programId, keys: [account, mint, authority, ...multiSigners], data, }) {\n return {\n programId,\n keys: {\n account,\n mint,\n authority,\n multiSigners,\n },\n data: freezeAccountInstructionData.decode(data),\n };\n}\n//# sourceMappingURL=freezeAccount.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { u64 } from '@solana/buffer-layout-utils';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { addSigners } from './internal.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const mintToInstructionData = struct([u8('instruction'), u64('amount')]);\n/**\n * Construct a MintTo instruction\n *\n * @param mint Public key of the mint\n * @param destination Address of the token account to mint to\n * @param authority The mint authority\n * @param amount Amount to mint\n * @param multiSigners Signing accounts if `authority` is a multisig\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createMintToInstruction(mint, destination, authority, amount, multiSigners = [], programId = TOKEN_PROGRAM_ID) {\n const keys = addSigners([\n { pubkey: mint, isSigner: false, isWritable: true },\n { pubkey: destination, isSigner: false, isWritable: true },\n ], authority, multiSigners);\n const data = Buffer.alloc(mintToInstructionData.span);\n mintToInstructionData.encode({\n instruction: TokenInstruction.MintTo,\n amount: BigInt(amount),\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode a MintTo instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeMintToInstruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== mintToInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { mint, destination, authority, multiSigners }, data, } = decodeMintToInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.MintTo)\n throw new TokenInvalidInstructionTypeError();\n if (!mint || !destination || !authority)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n mint,\n destination,\n authority,\n multiSigners,\n },\n data,\n };\n}\n/**\n * Decode a MintTo instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeMintToInstructionUnchecked({ programId, keys: [mint, destination, authority, ...multiSigners], data, }) {\n return {\n programId,\n keys: {\n mint,\n destination,\n authority,\n multiSigners,\n },\n data: mintToInstructionData.decode(data),\n };\n}\n//# sourceMappingURL=mintTo.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { u64 } from '@solana/buffer-layout-utils';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { addSigners } from './internal.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const mintToCheckedInstructionData = struct([\n u8('instruction'),\n u64('amount'),\n u8('decimals'),\n]);\n/**\n * Construct a MintToChecked instruction\n *\n * @param mint Public key of the mint\n * @param destination Address of the token account to mint to\n * @param authority The mint authority\n * @param amount Amount to mint\n * @param decimals Number of decimals in amount to mint\n * @param multiSigners Signing accounts if `authority` is a multisig\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createMintToCheckedInstruction(mint, destination, authority, amount, decimals, multiSigners = [], programId = TOKEN_PROGRAM_ID) {\n const keys = addSigners([\n { pubkey: mint, isSigner: false, isWritable: true },\n { pubkey: destination, isSigner: false, isWritable: true },\n ], authority, multiSigners);\n const data = Buffer.alloc(mintToCheckedInstructionData.span);\n mintToCheckedInstructionData.encode({\n instruction: TokenInstruction.MintToChecked,\n amount: BigInt(amount),\n decimals,\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode a MintToChecked instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeMintToCheckedInstruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== mintToCheckedInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { mint, destination, authority, multiSigners }, data, } = decodeMintToCheckedInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.MintToChecked)\n throw new TokenInvalidInstructionTypeError();\n if (!mint || !destination || !authority)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n mint,\n destination,\n authority,\n multiSigners,\n },\n data,\n };\n}\n/**\n * Decode a MintToChecked instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeMintToCheckedInstructionUnchecked({ programId, keys: [mint, destination, authority, ...multiSigners], data, }) {\n return {\n programId,\n keys: {\n mint,\n destination,\n authority,\n multiSigners,\n },\n data: mintToCheckedInstructionData.decode(data),\n };\n}\n//# sourceMappingURL=mintToChecked.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { addSigners } from './internal.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const revokeInstructionData = struct([u8('instruction')]);\n/**\n * Construct a Revoke instruction\n *\n * @param account Address of the token account\n * @param owner Owner of the account\n * @param multiSigners Signing accounts if `owner` is a multisig\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createRevokeInstruction(account, owner, multiSigners = [], programId = TOKEN_PROGRAM_ID) {\n const keys = addSigners([{ pubkey: account, isSigner: false, isWritable: true }], owner, multiSigners);\n const data = Buffer.alloc(revokeInstructionData.span);\n revokeInstructionData.encode({ instruction: TokenInstruction.Revoke }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode a Revoke instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeRevokeInstruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== revokeInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { account, owner, multiSigners }, data, } = decodeRevokeInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.Revoke)\n throw new TokenInvalidInstructionTypeError();\n if (!account || !owner)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n account,\n owner,\n multiSigners,\n },\n data,\n };\n}\n/**\n * Decode a Revoke instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeRevokeInstructionUnchecked({ programId, keys: [account, owner, ...multiSigners], data, }) {\n return {\n programId,\n keys: {\n account,\n owner,\n multiSigners,\n },\n data: revokeInstructionData.decode(data),\n };\n}\n//# sourceMappingURL=revoke.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { publicKey } from '@solana/buffer-layout-utils';\nimport { PublicKey, TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { addSigners } from './internal.js';\nimport { TokenInstruction } from './types.js';\n/** Authority types defined by the program */\nexport var AuthorityType;\n(function (AuthorityType) {\n AuthorityType[AuthorityType[\"MintTokens\"] = 0] = \"MintTokens\";\n AuthorityType[AuthorityType[\"FreezeAccount\"] = 1] = \"FreezeAccount\";\n AuthorityType[AuthorityType[\"AccountOwner\"] = 2] = \"AccountOwner\";\n AuthorityType[AuthorityType[\"CloseAccount\"] = 3] = \"CloseAccount\";\n})(AuthorityType || (AuthorityType = {}));\n/** TODO: docs */\nexport const setAuthorityInstructionData = struct([\n u8('instruction'),\n u8('authorityType'),\n u8('newAuthorityOption'),\n publicKey('newAuthority'),\n]);\n/**\n * Construct a SetAuthority instruction\n *\n * @param account Address of the token account\n * @param currentAuthority Current authority of the specified type\n * @param authorityType Type of authority to set\n * @param newAuthority New authority of the account\n * @param multiSigners Signing accounts if `currentAuthority` is a multisig\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createSetAuthorityInstruction(account, currentAuthority, authorityType, newAuthority, multiSigners = [], programId = TOKEN_PROGRAM_ID) {\n const keys = addSigners([{ pubkey: account, isSigner: false, isWritable: true }], currentAuthority, multiSigners);\n const data = Buffer.alloc(setAuthorityInstructionData.span);\n setAuthorityInstructionData.encode({\n instruction: TokenInstruction.SetAuthority,\n authorityType,\n newAuthorityOption: newAuthority ? 1 : 0,\n newAuthority: newAuthority || new PublicKey(0),\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode a SetAuthority instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeSetAuthorityInstruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== setAuthorityInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { account, currentAuthority, multiSigners }, data, } = decodeSetAuthorityInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.SetAuthority)\n throw new TokenInvalidInstructionTypeError();\n if (!account || !currentAuthority)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n account,\n currentAuthority,\n multiSigners,\n },\n data,\n };\n}\n/**\n * Decode a SetAuthority instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeSetAuthorityInstructionUnchecked({ programId, keys: [account, currentAuthority, ...multiSigners], data, }) {\n const { instruction, authorityType, newAuthorityOption, newAuthority } = setAuthorityInstructionData.decode(data);\n return {\n programId,\n keys: {\n account,\n currentAuthority,\n multiSigners,\n },\n data: {\n instruction,\n authorityType,\n newAuthority: newAuthorityOption ? newAuthority : null,\n },\n };\n}\n//# sourceMappingURL=setAuthority.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { addSigners } from './internal.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const thawAccountInstructionData = struct([u8('instruction')]);\n/**\n * Construct a ThawAccount instruction\n *\n * @param account Account to thaw\n * @param mint Mint account\n * @param authority Mint freeze authority\n * @param multiSigners Signing accounts if `authority` is a multisig\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createThawAccountInstruction(account, mint, authority, multiSigners = [], programId = TOKEN_PROGRAM_ID) {\n const keys = addSigners([\n { pubkey: account, isSigner: false, isWritable: true },\n { pubkey: mint, isSigner: false, isWritable: false },\n ], authority, multiSigners);\n const data = Buffer.alloc(thawAccountInstructionData.span);\n thawAccountInstructionData.encode({ instruction: TokenInstruction.ThawAccount }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode a ThawAccount instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeThawAccountInstruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== thawAccountInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { account, mint, authority, multiSigners }, data, } = decodeThawAccountInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.ThawAccount)\n throw new TokenInvalidInstructionTypeError();\n if (!account || !mint || !authority)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n account,\n mint,\n authority,\n multiSigners,\n },\n data,\n };\n}\n/**\n * Decode a ThawAccount instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeThawAccountInstructionUnchecked({ programId, keys: [account, mint, authority, ...multiSigners], data, }) {\n return {\n programId,\n keys: {\n account,\n mint,\n authority,\n multiSigners,\n },\n data: thawAccountInstructionData.decode(data),\n };\n}\n//# sourceMappingURL=thawAccount.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { u64 } from '@solana/buffer-layout-utils';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { addSigners } from './internal.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const transferInstructionData = struct([u8('instruction'), u64('amount')]);\n/**\n * Construct a Transfer instruction\n *\n * @param source Source account\n * @param destination Destination account\n * @param owner Owner of the source account\n * @param amount Number of tokens to transfer\n * @param multiSigners Signing accounts if `owner` is a multisig\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createTransferInstruction(source, destination, owner, amount, multiSigners = [], programId = TOKEN_PROGRAM_ID) {\n const keys = addSigners([\n { pubkey: source, isSigner: false, isWritable: true },\n { pubkey: destination, isSigner: false, isWritable: true },\n ], owner, multiSigners);\n const data = Buffer.alloc(transferInstructionData.span);\n transferInstructionData.encode({\n instruction: TokenInstruction.Transfer,\n amount: BigInt(amount),\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode a Transfer instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeTransferInstruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== transferInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { source, destination, owner, multiSigners }, data, } = decodeTransferInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.Transfer)\n throw new TokenInvalidInstructionTypeError();\n if (!source || !destination || !owner)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n source,\n destination,\n owner,\n multiSigners,\n },\n data,\n };\n}\n/**\n * Decode a Transfer instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeTransferInstructionUnchecked({ programId, keys: [source, destination, owner, ...multiSigners], data, }) {\n return {\n programId,\n keys: {\n source,\n destination,\n owner,\n multiSigners,\n },\n data: transferInstructionData.decode(data),\n };\n}\n//# sourceMappingURL=transfer.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { u64 } from '@solana/buffer-layout-utils';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { addSigners } from './internal.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const transferCheckedInstructionData = struct([\n u8('instruction'),\n u64('amount'),\n u8('decimals'),\n]);\n/**\n * Construct a TransferChecked instruction\n *\n * @param source Source account\n * @param mint Mint account\n * @param destination Destination account\n * @param owner Owner of the source account\n * @param amount Number of tokens to transfer\n * @param decimals Number of decimals in transfer amount\n * @param multiSigners Signing accounts if `owner` is a multisig\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createTransferCheckedInstruction(source, mint, destination, owner, amount, decimals, multiSigners = [], programId = TOKEN_PROGRAM_ID) {\n const keys = addSigners([\n { pubkey: source, isSigner: false, isWritable: true },\n { pubkey: mint, isSigner: false, isWritable: false },\n { pubkey: destination, isSigner: false, isWritable: true },\n ], owner, multiSigners);\n const data = Buffer.alloc(transferCheckedInstructionData.span);\n transferCheckedInstructionData.encode({\n instruction: TokenInstruction.TransferChecked,\n amount: BigInt(amount),\n decimals,\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode a TransferChecked instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeTransferCheckedInstruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== transferCheckedInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { source, mint, destination, owner, multiSigners }, data, } = decodeTransferCheckedInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.TransferChecked)\n throw new TokenInvalidInstructionTypeError();\n if (!source || !mint || !destination || !owner)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n source,\n mint,\n destination,\n owner,\n multiSigners,\n },\n data,\n };\n}\n/**\n * Decode a TransferChecked instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeTransferCheckedInstructionUnchecked({ programId, keys: [source, mint, destination, owner, ...multiSigners], data, }) {\n return {\n programId,\n keys: {\n source,\n mint,\n destination,\n owner,\n multiSigners,\n },\n data: transferCheckedInstructionData.decode(data),\n };\n}\n//# sourceMappingURL=transferChecked.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { publicKey } from '@solana/buffer-layout-utils';\nimport { PublicKey, SYSVAR_RENT_PUBKEY, TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const initializeMintInstructionData = struct([\n u8('instruction'),\n u8('decimals'),\n publicKey('mintAuthority'),\n u8('freezeAuthorityOption'),\n publicKey('freezeAuthority'),\n]);\n/**\n * Construct an InitializeMint instruction\n *\n * @param mint Token mint account\n * @param decimals Number of decimals in token account amounts\n * @param mintAuthority Minting authority\n * @param freezeAuthority Optional authority that can freeze token accounts\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createInitializeMintInstruction(mint, decimals, mintAuthority, freezeAuthority, programId = TOKEN_PROGRAM_ID) {\n const keys = [\n { pubkey: mint, isSigner: false, isWritable: true },\n { pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false },\n ];\n const data = Buffer.alloc(initializeMintInstructionData.span);\n initializeMintInstructionData.encode({\n instruction: TokenInstruction.InitializeMint,\n decimals,\n mintAuthority,\n freezeAuthorityOption: freezeAuthority ? 1 : 0,\n freezeAuthority: freezeAuthority || new PublicKey(0),\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode an InitializeMint instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeInitializeMintInstruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== initializeMintInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { mint, rent }, data, } = decodeInitializeMintInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.InitializeMint)\n throw new TokenInvalidInstructionTypeError();\n if (!mint || !rent)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n mint,\n rent,\n },\n data,\n };\n}\n/**\n * Decode an InitializeMint instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeInitializeMintInstructionUnchecked({ programId, keys: [mint, rent], data, }) {\n const { instruction, decimals, mintAuthority, freezeAuthorityOption, freezeAuthority } = initializeMintInstructionData.decode(data);\n return {\n programId,\n keys: {\n mint,\n rent,\n },\n data: {\n instruction,\n decimals,\n mintAuthority,\n freezeAuthority: freezeAuthorityOption ? freezeAuthority : null,\n },\n };\n}\n//# sourceMappingURL=initializeMint.js.map","import { s16, struct, u8 } from '@solana/buffer-layout';\nimport { publicKey } from '@solana/buffer-layout-utils';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_2022_PROGRAM_ID } from '../../constants.js';\nimport { addSigners } from '../../instructions/internal.js';\nimport { TokenInstruction } from '../../instructions/types.js';\nexport var InterestBearingMintInstruction;\n(function (InterestBearingMintInstruction) {\n InterestBearingMintInstruction[InterestBearingMintInstruction[\"Initialize\"] = 0] = \"Initialize\";\n InterestBearingMintInstruction[InterestBearingMintInstruction[\"UpdateRate\"] = 1] = \"UpdateRate\";\n})(InterestBearingMintInstruction || (InterestBearingMintInstruction = {}));\nexport const interestBearingMintInitializeInstructionData = struct([\n u8('instruction'),\n u8('interestBearingMintInstruction'),\n // TODO: Make this an optional public key\n publicKey('rateAuthority'),\n s16('rate'),\n]);\nexport const interestBearingMintUpdateRateInstructionData = struct([\n u8('instruction'),\n u8('interestBearingMintInstruction'),\n s16('rate'),\n]);\n/**\n * Construct an InitializeInterestBearingMint instruction\n *\n * @param mint Mint to initialize\n * @param rateAuthority The public key for the account that can update the rate\n * @param rate The initial interest rate\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createInitializeInterestBearingMintInstruction(mint, rateAuthority, rate, programId = TOKEN_2022_PROGRAM_ID) {\n const keys = [{ pubkey: mint, isSigner: false, isWritable: true }];\n const data = Buffer.alloc(interestBearingMintInitializeInstructionData.span);\n interestBearingMintInitializeInstructionData.encode({\n instruction: TokenInstruction.InterestBearingMintExtension,\n interestBearingMintInstruction: InterestBearingMintInstruction.Initialize,\n rateAuthority,\n rate,\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Construct an UpdateRateInterestBearingMint instruction\n *\n * @param mint Mint to initialize\n * @param rateAuthority The public key for the account that can update the rate\n * @param rate The updated interest rate\n * @param multiSigners Signing accounts if `rateAuthority` is a multisig\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createUpdateRateInterestBearingMintInstruction(mint, rateAuthority, rate, multiSigners = [], programId = TOKEN_2022_PROGRAM_ID) {\n const keys = addSigners([\n { pubkey: mint, isSigner: false, isWritable: true },\n { pubkey: rateAuthority, isSigner: !multiSigners.length, isWritable: false },\n ], rateAuthority, multiSigners);\n const data = Buffer.alloc(interestBearingMintUpdateRateInstructionData.span);\n interestBearingMintUpdateRateInstructionData.encode({\n instruction: TokenInstruction.InterestBearingMintExtension,\n interestBearingMintInstruction: InterestBearingMintInstruction.UpdateRate,\n rate,\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n//# sourceMappingURL=instructions.js.map",null,null,"import { struct, u8 } from '@solana/buffer-layout';\nimport { publicKey } from '@solana/buffer-layout-utils';\nimport { SYSVAR_RENT_PUBKEY, TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { TokenInstruction } from './types.js';\nexport const initializeAccount2InstructionData = struct([\n u8('instruction'),\n publicKey('owner'),\n]);\n/**\n * Construct an InitializeAccount2 instruction\n *\n * @param account New token account\n * @param mint Mint account\n * @param owner New account's owner/multisignature\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createInitializeAccount2Instruction(account, mint, owner, programId = TOKEN_PROGRAM_ID) {\n const keys = [\n { pubkey: account, isSigner: false, isWritable: true },\n { pubkey: mint, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false },\n ];\n const data = Buffer.alloc(initializeAccount2InstructionData.span);\n initializeAccount2InstructionData.encode({ instruction: TokenInstruction.InitializeAccount2, owner }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode an InitializeAccount2 instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeInitializeAccount2Instruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== initializeAccount2InstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { account, mint, rent }, data, } = decodeInitializeAccount2InstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.InitializeAccount2)\n throw new TokenInvalidInstructionTypeError();\n if (!account || !mint || !rent)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n account,\n mint,\n rent,\n },\n data,\n };\n}\n/**\n * Decode an InitializeAccount2 instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeInitializeAccount2InstructionUnchecked({ programId, keys: [account, mint, rent], data, }) {\n return {\n programId,\n keys: {\n account,\n mint,\n rent,\n },\n data: initializeAccount2InstructionData.decode(data),\n };\n}\n//# sourceMappingURL=initializeAccount2.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { publicKey } from '@solana/buffer-layout-utils';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { TokenInstruction } from './types.js';\nexport const initializeAccount3InstructionData = struct([\n u8('instruction'),\n publicKey('owner'),\n]);\n/**\n * Construct an InitializeAccount3 instruction\n *\n * @param account New token account\n * @param mint Mint account\n * @param owner New account's owner/multisignature\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createInitializeAccount3Instruction(account, mint, owner, programId = TOKEN_PROGRAM_ID) {\n const keys = [\n { pubkey: account, isSigner: false, isWritable: true },\n { pubkey: mint, isSigner: false, isWritable: false },\n ];\n const data = Buffer.alloc(initializeAccount3InstructionData.span);\n initializeAccount3InstructionData.encode({ instruction: TokenInstruction.InitializeAccount3, owner }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode an InitializeAccount3 instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeInitializeAccount3Instruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== initializeAccount3InstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { account, mint }, data, } = decodeInitializeAccount3InstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.InitializeAccount3)\n throw new TokenInvalidInstructionTypeError();\n if (!account || !mint)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n account,\n mint,\n },\n data,\n };\n}\n/**\n * Decode an InitializeAccount3 instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeInitializeAccount3InstructionUnchecked({ programId, keys: [account, mint], data, }) {\n return {\n programId,\n keys: {\n account,\n mint,\n },\n data: initializeAccount3InstructionData.decode(data),\n };\n}\n//# sourceMappingURL=initializeAccount3.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { TokenInstruction } from './types.js';\n/** The struct that represents the instruction data as it is read by the program */\nexport const initializeImmutableOwnerInstructionData = struct([\n u8('instruction'),\n]);\n/**\n * Construct an InitializeImmutableOwner instruction\n *\n * @param account Immutable Owner Account\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createInitializeImmutableOwnerInstruction(account, programId) {\n const keys = [{ pubkey: account, isSigner: false, isWritable: true }];\n const data = Buffer.alloc(initializeImmutableOwnerInstructionData.span);\n initializeImmutableOwnerInstructionData.encode({\n instruction: TokenInstruction.InitializeImmutableOwner,\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode an InitializeImmutableOwner instruction and validate it\n *\n * @param instruction InitializeImmutableOwner instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeInitializeImmutableOwnerInstruction(instruction, programId) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== initializeImmutableOwnerInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { account }, data, } = decodeInitializeImmutableOwnerInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.InitializeImmutableOwner)\n throw new TokenInvalidInstructionTypeError();\n if (!account)\n throw new TokenInvalidInstructionKeysError();\n return {\n programId,\n keys: {\n account,\n },\n data,\n };\n}\n/**\n * Decode an InitializeImmutableOwner instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeInitializeImmutableOwnerInstructionUnchecked({ programId, keys: [account], data, }) {\n const { instruction } = initializeImmutableOwnerInstructionData.decode(data);\n return {\n programId,\n keys: {\n account: account,\n },\n data: {\n instruction,\n },\n };\n}\n//# sourceMappingURL=initializeImmutableOwner.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { publicKey } from '@solana/buffer-layout-utils';\nimport { PublicKey, TransactionInstruction } from '@solana/web3.js';\nimport { programSupportsExtensions } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, TokenUnsupportedInstructionError, } from '../errors.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const initializeMintCloseAuthorityInstructionData = struct([\n u8('instruction'),\n u8('closeAuthorityOption'),\n publicKey('closeAuthority'),\n]);\n/**\n * Construct an InitializeMintCloseAuthority instruction\n *\n * @param mint Token mint account\n * @param closeAuthority Optional authority that can close the mint\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createInitializeMintCloseAuthorityInstruction(mint, closeAuthority, programId) {\n if (!programSupportsExtensions(programId)) {\n throw new TokenUnsupportedInstructionError();\n }\n const keys = [{ pubkey: mint, isSigner: false, isWritable: true }];\n const data = Buffer.alloc(initializeMintCloseAuthorityInstructionData.span);\n initializeMintCloseAuthorityInstructionData.encode({\n instruction: TokenInstruction.InitializeMintCloseAuthority,\n closeAuthorityOption: closeAuthority ? 1 : 0,\n closeAuthority: closeAuthority || new PublicKey(0),\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode an InitializeMintCloseAuthority instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeInitializeMintCloseAuthorityInstruction(instruction, programId) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== initializeMintCloseAuthorityInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { mint }, data, } = decodeInitializeMintCloseAuthorityInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.InitializeMintCloseAuthority)\n throw new TokenInvalidInstructionTypeError();\n if (!mint)\n throw new TokenInvalidInstructionKeysError();\n return {\n programId,\n keys: {\n mint,\n },\n data,\n };\n}\n/**\n * Decode an InitializeMintCloseAuthority instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeInitializeMintCloseAuthorityInstructionUnchecked({ programId, keys: [mint], data, }) {\n const { instruction, closeAuthorityOption, closeAuthority } = initializeMintCloseAuthorityInstructionData.decode(data);\n return {\n programId,\n keys: {\n mint,\n },\n data: {\n instruction,\n closeAuthority: closeAuthorityOption ? closeAuthority : null,\n },\n };\n}\n//# sourceMappingURL=initializeMintCloseAuthority.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { programSupportsExtensions } from '../constants.js';\nimport { TokenUnsupportedInstructionError } from '../errors.js';\nimport { TokenInstruction } from './types.js';\n/** The struct that represents the instruction data as it is read by the program */\nexport const initializeNonTransferableMintInstructionData = struct([\n u8('instruction'),\n]);\n/**\n * Construct an InitializeNonTransferableMint instruction\n *\n * @param mint Mint Account to make non-transferable\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createInitializeNonTransferableMintInstruction(mint, programId) {\n if (!programSupportsExtensions(programId)) {\n throw new TokenUnsupportedInstructionError();\n }\n const keys = [{ pubkey: mint, isSigner: false, isWritable: true }];\n const data = Buffer.alloc(initializeNonTransferableMintInstructionData.span);\n initializeNonTransferableMintInstructionData.encode({\n instruction: TokenInstruction.InitializeNonTransferableMint,\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n//# sourceMappingURL=initializeNonTransferableMint.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { publicKey } from '@solana/buffer-layout-utils';\nimport { PublicKey } from '@solana/web3.js';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { programSupportsExtensions } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, TokenUnsupportedInstructionError, } from '../errors.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const initializePermanentDelegateInstructionData = struct([\n u8('instruction'),\n publicKey('delegate'),\n]);\n/**\n * Construct an InitializePermanentDelegate instruction\n *\n * @param mint Token mint account\n * @param permanentDelegate Authority that may sign for `Transfer`s and `Burn`s on any account\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createInitializePermanentDelegateInstruction(mint, permanentDelegate, programId) {\n if (!programSupportsExtensions(programId)) {\n throw new TokenUnsupportedInstructionError();\n }\n const keys = [{ pubkey: mint, isSigner: false, isWritable: true }];\n const data = Buffer.alloc(initializePermanentDelegateInstructionData.span);\n initializePermanentDelegateInstructionData.encode({\n instruction: TokenInstruction.InitializePermanentDelegate,\n delegate: permanentDelegate || new PublicKey(0),\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode an InitializePermanentDelegate instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeInitializePermanentDelegateInstruction(instruction, programId) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== initializePermanentDelegateInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { mint }, data, } = decodeInitializePermanentDelegateInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.InitializePermanentDelegate)\n throw new TokenInvalidInstructionTypeError();\n if (!mint)\n throw new TokenInvalidInstructionKeysError();\n return {\n programId,\n keys: {\n mint,\n },\n data,\n };\n}\n/**\n * Decode an InitializePermanentDelegate instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeInitializePermanentDelegateInstructionUnchecked({ programId, keys: [mint], data, }) {\n const { instruction, delegate } = initializePermanentDelegateInstructionData.decode(data);\n return {\n programId,\n keys: {\n mint,\n },\n data: {\n instruction,\n delegate,\n },\n };\n}\n//# sourceMappingURL=initializePermanentDelegate.js.map"],"names":["base64Js","b64","lens","getLens","validLen","placeHoldersLen","tmp","i","arr","Arr","_byteLength","curByte","len","revLookup","charCodeAt","uint8","length","extraBytes","parts","maxChunkLength","len2","push","encodeChunk","lookup","join","Uint8Array","Array","code","Error","indexOf","start","end","num","output","ieee754","buffer","offset","isLE","mLen","nBytes","e","m","eLen","eMax","eBias","nBits","d","s","NaN","Infinity","Math","pow","value","c","rt","abs","isNaN","floor","log","LN2","base64","require$$0","require$$1","customInspectSymbol","Symbol","exports","Buffer","SlowBuffer","alloc","INSPECT_MAX_BYTES","K_MAX_LENGTH","createBuffer","RangeError","buf","Object","setPrototypeOf","prototype","arg","encodingOrOffset","TypeError","allocUnsafe","from","string","encoding","isEncoding","byteLength","actual","write","slice","fromString","ArrayBuffer","isView","arrayView","isInstance","copy","fromArrayBuffer","byteOffset","fromArrayLike","fromArrayView","SharedArrayBuffer","valueOf","b","obj","isBuffer","checked","undefined","numberIsNaN","type","isArray","data","fromObject","toPrimitive","assertSize","size","array","toString","mustMatch","arguments","loweredCase","utf8ToBytes","base64ToBytes","toLowerCase","slowToString","this","hexSlice","utf8Slice","asciiSlice","latin1Slice","base64Slice","utf16leSlice","swap","n","bidirectionalIndexOf","val","dir","arrayIndexOf","call","lastIndexOf","indexSize","arrLength","valLength","String","read","readUInt16BE","foundIndex","found","j","hexWrite","Number","remaining","strLen","parsed","parseInt","substr","utf8Write","blitBuffer","asciiWrite","str","byteArray","asciiToBytes","base64Write","ucs2Write","units","hi","lo","utf16leToBytes","fromByteArray","min","res","firstByte","codePoint","bytesPerSequence","secondByte","thirdByte","fourthByte","tempCodePoint","codePoints","MAX_ARGUMENTS_LENGTH","fromCharCode","apply","decodeCodePointsArray","kMaxLength","TYPED_ARRAY_SUPPORT","proto","foo","typedArraySupport","console","error","defineProperty","enumerable","get","poolSize","fill","allocUnsafeSlow","_isBuffer","compare","a","x","y","concat","list","pos","set","swap16","swap32","swap64","toLocaleString","equals","inspect","max","replace","trim","target","thisStart","thisEnd","thisCopy","targetCopy","includes","isFinite","toJSON","_arr","ret","out","hexSliceLookupTable","bytes","checkOffset","ext","checkInt","wrtBigUInt64LE","checkIntBI","BigInt","wrtBigUInt64BE","checkIEEE754","writeFloat","littleEndian","noAssert","writeDouble","newBuf","subarray","readUintLE","readUIntLE","mul","readUintBE","readUIntBE","readUint8","readUInt8","readUint16LE","readUInt16LE","readUint16BE","readUint32LE","readUInt32LE","readUint32BE","readUInt32BE","readBigUInt64LE","defineBigIntMethod","validateNumber","first","last","boundsError","readBigUInt64BE","readIntLE","readIntBE","readInt8","readInt16LE","readInt16BE","readInt32LE","readInt32BE","readBigInt64LE","readBigInt64BE","readFloatLE","readFloatBE","readDoubleLE","readDoubleBE","writeUintLE","writeUIntLE","writeUintBE","writeUIntBE","writeUint8","writeUInt8","writeUint16LE","writeUInt16LE","writeUint16BE","writeUInt16BE","writeUint32LE","writeUInt32LE","writeUint32BE","writeUInt32BE","writeBigUInt64LE","writeBigUInt64BE","writeIntLE","limit","sub","writeIntBE","writeInt8","writeInt16LE","writeInt16BE","writeInt32LE","writeInt32BE","writeBigInt64LE","writeBigInt64BE","writeFloatLE","writeFloatBE","writeDoubleLE","writeDoubleBE","targetStart","copyWithin","errors","E","sym","getMessage","Base","constructor","super","writable","configurable","name","stack","message","addNumericalSeparator","range","ERR_OUT_OF_RANGE","checkBounds","ERR_INVALID_ARG_TYPE","ERR_BUFFER_OUT_OF_BOUNDS","input","msg","received","isInteger","INVALID_BASE64_RE","leadSurrogate","toByteArray","split","base64clean","src","dst","alphabet","table","i16","fn","BufferBigIntNotDefined","TOKEN_PROGRAM_ID","PublicKey","ASSOCIATED_TOKEN_PROGRAM_ID","Layout_1","s16","nu64be","u48be","u40be","u32be","u16be","nu64","u40","u32","u24","u16","u8","greedy","Constant","UTF8","Blob","Boolean","BitStructure","VariantLayout","Union","UnionLayoutDiscriminator","Structure","Sequence","DoubleBE","Double","Float","NearInt64BE","NearUInt64BE","NearUInt64","IntBE","Int","UInt","OffsetLayout","GreedyCount","ExternalLayout","nameWithProperty","Layout","uint8ArrayToBuffer","checkUint8Array","constant","cstr","blob","unionLayoutDiscriminator","union","bits","struct","f64","f32be","f32","ns64be","s40be","s32be","s24be","s16be","ns64","s48","s40","s32","s24","buffer_1","span","property","makeDestinationObject","getSpan","replicate","rv","create","assign","fromArray","values","bindConstructorLayout","Class","layout","hasOwnProperty","layout_","boundConstructor_","encode","decode","isCount","elementSpan","rem","UIntBE","V2E32","divmodInt64","hi32","lo32","roundedInt64","NearInt64","FloatBE","elementLayout","count","idx","elo","reduce","v","fields","decodePrefixes","acc","fd","fsp","dest","firstOffset","lastOffset","lastWrote","fv","shift","layoutFor","offsetOf","UnionDiscriminator","discr","defaultLayout","discriminator","usesPrefixDiscriminator","registry","boundGetSourceVariant","defaultGetSourceVariant","bind","getSourceVariant","configGetSourceVariant","gsv","vlo","getVariant","tag","dlo","clo","contentOffset","addVariant","variant","vb","fixBitwiseResult","word","msb","_packedSetValue","_packedGetValue","addField","bf","BitField","addBoolean","fieldFor","container","totalBits","usedBits","sum","valueMask","wordMask","wordValue","srcBuffer","CString","srcb","maxSpan","u48","u24be","s8","s48be","f64be","seq","utf8","encodeDecode","browser","toBigIntLE_1","toBigIntLE","reversed","reverse","hex","toBigIntBE","toBufferLE_1","toBufferLE","width","padStart","toBufferBE","u64","bigIntLayout","bigInt","bool","boolLayout","publicKey","publicKeyLayout","toBuffer","TokenError","TokenInvalidInstructionProgramError","TokenInvalidInstructionKeysError","TokenInvalidInstructionDataError","TokenInvalidInstructionTypeError","TokenInstruction","approveInstructionData","decodeApproveInstruction","instruction","programId","keys","account","delegate","owner","multiSigners","decodeApproveInstructionUnchecked","Approve","approveCheckedInstructionData","decodeApproveCheckedInstruction","mint","decodeApproveCheckedInstructionUnchecked","ApproveChecked","burnInstructionData","decodeBurnInstruction","decodeBurnInstructionUnchecked","Burn","burnCheckedInstructionData","decodeBurnCheckedInstruction","decodeBurnCheckedInstructionUnchecked","BurnChecked","closeAccountInstructionData","decodeCloseAccountInstruction","destination","authority","decodeCloseAccountInstructionUnchecked","CloseAccount","AccountType","AccountState","CpiGuardInstruction","DefaultAccountStateInstruction","MemoTransferInstruction","NonTransferableLayout","TransferFeeInstruction","transferFeeLayout","ExtensionType","initializeAccountInstructionData","decodeInitializeAccountInstruction","rent","decodeInitializeAccountInstructionUnchecked","InitializeAccount","initializeMultisigInstructionData","decodeInitializeMultisigInstruction","signers","decodeInitializeMultisigInstructionUnchecked","InitializeMultisig","freezeAccountInstructionData","decodeFreezeAccountInstruction","decodeFreezeAccountInstructionUnchecked","FreezeAccount","mintToInstructionData","decodeMintToInstruction","decodeMintToInstructionUnchecked","MintTo","mintToCheckedInstructionData","decodeMintToCheckedInstruction","decodeMintToCheckedInstructionUnchecked","MintToChecked","revokeInstructionData","decodeRevokeInstruction","decodeRevokeInstructionUnchecked","Revoke","AuthorityType","setAuthorityInstructionData","decodeSetAuthorityInstruction","currentAuthority","authorityType","newAuthorityOption","newAuthority","decodeSetAuthorityInstructionUnchecked","SetAuthority","thawAccountInstructionData","decodeThawAccountInstruction","decodeThawAccountInstructionUnchecked","ThawAccount","transferInstructionData","decodeTransferInstruction","source","decodeTransferInstructionUnchecked","Transfer","transferCheckedInstructionData","decodeTransferCheckedInstruction","decodeTransferCheckedInstructionUnchecked","TransferChecked","initializeMintInstructionData","decodeInitializeMintInstructionUnchecked","decimals","mintAuthority","freezeAuthorityOption","freezeAuthority","InterestBearingMintInstruction","hexToBuffer","rawHex","startsWith","parseTransactionAccounts","loadedAddresses","accounts","version","accountKeys","staticAccountKeys","readonlySignedAccountsCount","header","numReadonlySignedAccounts","readonlyUnsignedAccountsCount","numReadonlyUnsignedAccounts","requiredSignaturesAccountsCount","numRequiredSignatures","totalAccounts","parsedAccounts","map","isSigner","isWritable","pubkey","ALTWritable","ALTReadOnly","readonly","compiledInstructionToInstruction","compiledInstruction","ci","TransactionInstruction","utils","bs58","programIdIndex","accountIdx","accountKeyIndexes","accountIndex","parsedAccountsToMeta","accountMeta","meta","pk","encoded","find","item","parsedInstructionToInstruction","parsedInstruction","flattenTransactionResponse","transaction","result","txInstructions","compiledInstructions","accountsMeta","_a","orderedCII","_b","innerInstructions","sort","index","totalCalls","_c","accumulator","cii","instructions","lastPushedIx","callIndex","CII","CIIEntry","newLogContext","depth","id","instructionIndex","logMessages","dataLogs","rawLogs","parseLogs","logs","parserRe","currentInstruction","currentDepth","callStack","callIds","match","exec","groups","logTruncated","invokeResult","programInvoke","invokeProgramId","level","programSuccessResult","lastProgram","pop","lastCallIndex","successResultProgramId","programFailedResult","failedResultProgramId","failedResultErr","programCompleteFailedResult","failedCompleteError","programLog","logMessage","programData","programConsumed","programReturn","returnProgramId","returnMessage","decodeSystemInstruction","SystemInstruction","decodeInstructionType","decoded","decodeNonceAdvance","noncePubkey","authorizedPubkey","args","decodeAllocate","accountPubkey","space","BN","decodeAllocateWithSeed","basePubkey","seed","base","decodeAssign","decodeAssignWithSeed","decodeNonceAuthorize","authorized","newAuthorizedPubkey","decodeCreateAccount","fromPubkey","newAccountPubkey","lamports","decodeCreateWithSeed","decodeNonceInitialize","decodeTransfer","toPubkey","decodeTransferWithSeed","decodeNonceWithdraw","SystemProgram","unknown","decodeTokenInstruction","InitializeMint","decodedIx","decodeInitializeMintInstruction","multisig","amount","authrorityTypeMap","AccountOwner","accountOwner","closeAccount","freezeAccount","MintTokens","mintTokens","InitializeAccount2","SyncNative","InitializeAccount3","InitializeMultisig2","InitializeMint2","decodeAssociatedTokenInstruction","flattenIdlAccounts","prefix","accName","newPrefix","flat","SolanaParser","programInfos","parsers","standartParsers","toBase58","programInfo","buildIdlParser","idl","Map","parserInfo","has","instructionParsers","addParser","parser","addParserFromIdl","parsedIx","BorshInstructionCoder","ix","instr","buildUnknownParsedInstruction","flatIdlAccounts","removeParser","delete","argData","parseInstruction","parseTransactionData","txMessage","altLoadedAddresses","parseTransactionParsedData","txParsedMessage","metaLike","signer","parseTransaction","connection","txId","flatten","commitment","getTransaction","maxSupportedTransactionVersion","parseTransactionDump","txDump","Transaction","compileMessage"],"mappings":"gNAWA,gBATAA,WAuCA,SAAqBC,GACnB,IAAIC,EAAOC,EAAQF,GACfG,EAAWF,EAAK,GAChBG,EAAkBH,EAAK,GAC3B,OAAuC,GAA9BE,EAAWC,GAAuB,EAAKA,CAClD,EA3CAL,YAiDA,SAAsBC,GACpB,IAAIK,EAcAC,EAbAL,EAAOC,EAAQF,GACfG,EAAWF,EAAK,GAChBG,EAAkBH,EAAK,GAEvBM,EAAM,IAAIC,EAVhB,SAAsBR,EAAKG,EAAUC,GACnC,OAAuC,GAA9BD,EAAWC,GAAuB,EAAKA,CAClD,CAQoBK,CAAYT,EAAKG,EAAUC,IAEzCM,EAAU,EAGVC,EAAMP,EAAkB,EACxBD,EAAW,EACXA,EAGJ,IAAKG,EAAI,EAAGA,EAAIK,EAAKL,GAAK,EACxBD,EACGO,EAAUZ,EAAIa,WAAWP,KAAO,GAChCM,EAAUZ,EAAIa,WAAWP,EAAI,KAAO,GACpCM,EAAUZ,EAAIa,WAAWP,EAAI,KAAO,EACrCM,EAAUZ,EAAIa,WAAWP,EAAI,IAC/BC,EAAIG,KAAcL,GAAO,GAAM,IAC/BE,EAAIG,KAAcL,GAAO,EAAK,IAC9BE,EAAIG,KAAmB,IAANL,EAGK,IAApBD,IACFC,EACGO,EAAUZ,EAAIa,WAAWP,KAAO,EAChCM,EAAUZ,EAAIa,WAAWP,EAAI,KAAO,EACvCC,EAAIG,KAAmB,IAANL,GAGK,IAApBD,IACFC,EACGO,EAAUZ,EAAIa,WAAWP,KAAO,GAChCM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A9C,gBACpF,CAOD,oBAAAoM,CAAqBC,GACdA,aAAkBrvB,WAASqvB,EAASrvB,EAAAA,OAAOe,KAAKsuB,EAAQ,WAC9D,MACM1f,EADK2f,EAAYvuB,KAAKsuB,GACTE,iBAEnB,OAAO9rB,KAAK6qB,qBAAqB3e,EACjC"} \ No newline at end of file diff --git a/dist/cjs/helpers.js b/dist/cjs/helpers.js index 07f4f05..4a12638 100644 --- a/dist/cjs/helpers.js +++ b/dist/cjs/helpers.js @@ -1,7 +1,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.parseLogs = exports.flattenTransactionResponse = exports.parsedInstructionToInstruction = exports.compiledInstructionToInstruction = exports.parseTransactionAccounts = exports.hexToBuffer = void 0; -const anchor_1 = require("@project-serum/anchor"); +const anchor_1 = require("@coral-xyz/anchor"); const web3_js_1 = require("@solana/web3.js"); function hexToBuffer(data) { const rawHex = data.startsWith("0x") ? data.slice(2) : data; diff --git a/dist/cjs/helpers.js.map b/dist/cjs/helpers.js.map index a949943..cf690fb 100644 --- a/dist/cjs/helpers.js.map +++ b/dist/cjs/helpers.js.map @@ -1 +1 @@ -{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":";;;AAAA,kDAA8C;AAC9C,6CAWyB;AAIzB,SAAgB,WAAW,CAAC,IAAY;IACvC,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAE5D,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC;AAJD,kCAIC;AAED;;;;GAIG;AACH,SAAgB,wBAAwB,CACvC,OAAU,EACV,kBAAwF,SAAS;IAEjG,MAAM,QAAQ,GAAgB,OAAO,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAA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C,MAAM,CAAC,eAAe,EAAE;YACxC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACtD;aAAM,IAAI,KAAK,CAAC,MAAM,CAAC,aAAa,EAAE;YACtC,IAAI,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,eAAe;gBAAE,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;YAC3H,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC;SAC9E;KACD;IAED,OAAO,MAAM,CAAC;AACf,CAAC;AA1DD,8BA0DC"} \ No newline at end of file diff --git a/dist/cjs/interfaces.d.ts b/dist/cjs/interfaces.d.ts index 7dc296e..d1b0fc8 100644 --- a/dist/cjs/interfaces.d.ts +++ b/dist/cjs/interfaces.d.ts @@ -1,6 +1,8 @@ /// -import { BN, Idl, IdlTypes } from "@project-serum/anchor"; +import { splTokenProgram } from "@coral-xyz/spl-token"; +import { BN, Idl, IdlTypes } from "@coral-xyz/anchor"; import { AccountMeta, PublicKey, Transaction, TransactionInstruction } from "@solana/web3.js"; +export type SplToken = ReturnType["idl"]; /** * Context of logs for specific instruction */ diff --git a/dist/cjs/interfaces.d.ts.map b/dist/cjs/interfaces.d.ts.map index f24dd52..c5c5852 100644 --- a/dist/cjs/interfaces.d.ts.map +++ b/dist/cjs/interfaces.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../src/interfaces.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,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C;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE;QACb;YACC,IAAI,EAAE,8BAA8B,CAAC;YACrC,QAAQ,EAAE;gBACT;oBACC,IAAI,EAAE,gBAAgB,CAAC;oBACvB,KAAK,EAAE,IAAI,CAAC;oBACZ,QAAQ,EAAE,IAAI,CAAC;iBACf;gBACD;oBACC,IAAI,EAAE,YAAY,CAAC;oBACnB,KAAK,EAAE,IAAI,CAAC;oBACZ,QAAQ,EAAE,KAAK,CAAC;iBAChB;gBACD;oBACC,IAAI,EAAE,QAAQ,CAAC;oBACf,KAAK,EAAE,KAAK,CAAC;oBACb,QAAQ,EAAE,KAAK,CAAC;iBAChB;gBACD;oBACC,IAAI,EAAE,WAAW,CAAC;oBAClB,KAAK,EAAE,KAAK,CAAC;oBACb,QAAQ,EAAE,KAAK,CAAC;iBAChB;gBACD;oBACC,IAAI,EAAE,eAAe,CAAC;oBACtB,KAAK,EAAE,KAAK,CAAC;oBACb,QAAQ,EAAE,KAAK,CAAC;iBAChB;gBACD;oBACC,IAAI,EAAE,cAAc,CAAC;oBACrB,KAAK,EAAE,KAAK,CAAC;oBACb,QAAQ,EAAE,KAAK,CAAC;iBAChB;gBACD;oBACC,IAAI,EAAE,YAAY,CAAC;oBACnB,KAAK,EAAE,KAAK,CAAC;oBACb,QAAQ,EAAE,KAAK,CAAC;iBAChB;aACD,CAAC;YACF,IAAI,EAAE,EAAE,CAAC;SACT;KACD,CAAC;CACF,CAAC"} \ No newline at end of file +{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../src/interfaces.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAE9F,MAAM,MAAM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G;IAC3C,IAAI,EAAE,0BAA0B,CAAC;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE;QACb;YACC,IAAI,EAAE,8BAA8B,CAAC;YACrC,QAAQ,EAAE;gBACT;oBACC,IAAI,EAAE,gBAAgB,CAAC;oBACvB,KAAK,EAAE,IAAI,CAAC;oBACZ,QAAQ,EAAE,IAAI,CAAC;iBACf;gBACD;oBACC,IAAI,EAAE,YAAY,CAAC;oBACnB,KAAK,EAAE,IAAI,CAAC;oBACZ,QAAQ,EAAE,KAAK,CAAC;iBAChB;gBACD;oBACC,IAAI,EAAE,QAAQ,CAAC;oBACf,KAAK,EAAE,KAAK,CAAC;oBACb,QAAQ,EAAE,KAAK,CAAC;iBAChB;gBACD;oBACC,IAAI,EAAE,WAAW,CAAC;oBAClB,KAAK,EAAE,KAAK,CAAC;oBACb,QAAQ,EAAE,KAAK,CAAC;iBAChB;gBACD;oBACC,IAAI,EAAE,eAAe,CAAC;oBACtB,KAAK,EAAE,KAAK,CAAC;oBACb,QAAQ,EAAE,KAAK,CAAC;iBAChB;gBACD;oBACC,IAAI,EAAE,cAAc,CAAC;oBACrB,KAAK,EAAE,KAAK,CAAC;oBACb,QAAQ,EAAE,KAAK,CAAC;iBAChB;gBACD;oBACC,IAAI,EAAE,YAAY,CAAC;oBACnB,KAAK,EAAE,KAAK,CAAC;oBACb,QAAQ,EAAE,KAAK,CAAC;iBAChB;aACD,CAAC;YACF,IAAI,EAAE,EAAE,CAAC;SACT;KACD,CAAC;CACF,CAAC"} \ No newline at end of file diff --git a/dist/cjs/parsers.d.ts b/dist/cjs/parsers.d.ts index dafc0e4..751cae8 100644 --- a/dist/cjs/parsers.d.ts +++ b/dist/cjs/parsers.d.ts @@ -1,7 +1,7 @@ /// import { Buffer } from "buffer"; import { PublicKey, TransactionInstruction, Connection, Message, ParsedMessage, Finality, VersionedMessage, LoadedAddresses } from "@solana/web3.js"; -import { Idl } from "@project-serum/anchor"; +import { Idl } from "@coral-xyz/anchor"; import { InstructionNames, InstructionParserInfo, ParsedInstruction, ParserFunction, ProgramInfoType } from "./interfaces"; /** * Class for parsing arbitrary solana transactions in various formats diff --git a/dist/cjs/parsers.d.ts.map b/dist/cjs/parsers.d.ts.map index eaf5b57..17d39c0 100644 --- a/dist/cjs/parsers.d.ts.map +++ b/dist/cjs/parsers.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"parsers.d.ts","sourceRoot":"","sources":["../../src/parsers.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EACN,SAAS,EACT,sBAAsB,EAGtB,UAAU,EACV,OAAO,EAGP,aAAa,EAEb,QAAQ,EACR,gBAAgB,EAChB,eAAe,EACf,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAA6B,GAAG,EAA+C,MAAM,uBAAuB,CAAC;AAGpH,OAAO,EAKN,gBAAgB,EAChB,qBAAqB,EAIrB,iBAAiB,EACjB,cAAc,EACd,eAAe,EAEf,MAAM,cAAc,CAAC;AAohBtB;;;;;;;GAOG;AACH,qBAAa,YAAY;IACxB,OAAO,CAAC,kBAAkB,CAAqB;IAE/C;;;;;;OAMG;gBACS,YAAY,EAAE,eAAe,EAAE,EAAE,OAAO,CAAC,EAAE,qBAAqB,EAAE;IA4B9E;;;;OAIG;IACH,SAAS,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC;IAInE;;;;OAIG;IACH,gBAAgB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,EAAE,GAAG,EAAE,GAAG;IAIxD,OAAO,CAAC,cAAc;IAwCtB;;;OAGG;IACH,YAAY,CAAC,SAAS,EAAE,SAAS;IAIjC,OAAO,CAAC,6BAA6B;IASrC;;;;OAIG;IACH,gBAAgB,CAAC,CAAC,SAAS,GAAG,EAAE,MAAM,SAAS,gBAAgB,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,sBA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b/dist/cjs/parsers.js index 1287f21..e853def 100644 --- a/dist/cjs/parsers.js +++ b/dist/cjs/parsers.js @@ -1,11 +1,10 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SolanaParser = void 0; -const tslib_1 = require("tslib"); const buffer_1 = require("buffer"); const web3_js_1 = require("@solana/web3.js"); -const spl = tslib_1.__importStar(require("@solana/spl-token")); -const anchor_1 = require("@project-serum/anchor"); +const spl_token_1 = require("@solana/spl-token"); +const anchor_1 = require("@coral-xyz/anchor"); const buffer_layout_1 = require("@solana/buffer-layout"); const helpers_1 = require("./helpers"); function decodeSystemInstruction(instruction) { @@ -192,8 +191,8 @@ function decodeTokenInstruction(instruction) { let parsed; const decoded = (0, buffer_layout_1.u8)().decode(instruction.data); switch (decoded) { - case spl.TokenInstruction.InitializeMint: { - const decodedIx = spl.decodeInitializeMintInstruction(instruction); + case spl_token_1.TokenInstruction.InitializeMint: { + const decodedIx = (0, spl_token_1.decodeInitializeMintInstruction)(instruction); parsed = { name: "initializeMint", accounts: [ @@ -204,8 +203,8 @@ function decodeTokenInstruction(instruction) { }; break; } - case spl.TokenInstruction.InitializeAccount: { - const decodedIx = spl.decodeInitializeAccountInstruction(instruction); + case spl_token_1.TokenInstruction.InitializeAccount: { + const decodedIx = (0, spl_token_1.decodeInitializeAccountInstruction)(instruction); parsed = { name: "initializeAccount", accounts: [ @@ -218,8 +217,8 @@ function decodeTokenInstruction(instruction) { }; break; } - case spl.TokenInstruction.InitializeMultisig: { - const decodedIx = spl.decodeInitializeMultisigInstruction(instruction); + case spl_token_1.TokenInstruction.InitializeMultisig: { + const decodedIx = (0, spl_token_1.decodeInitializeMultisigInstruction)(instruction); const multisig = decodedIx.keys.signers.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "initializeMultisig", @@ -228,8 +227,8 @@ function decodeTokenInstruction(instruction) { }; break; } - case spl.TokenInstruction.Transfer: { - const decodedIx = spl.decodeTransferInstruction(instruction); + case spl_token_1.TokenInstruction.Transfer: { + const decodedIx = (0, spl_token_1.decodeTransferInstruction)(instruction); const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "transfer", @@ -243,8 +242,8 @@ function decodeTokenInstruction(instruction) { }; break; } - case spl.TokenInstruction.Approve: { - const decodedIx = spl.decodeApproveInstruction(instruction); + case spl_token_1.TokenInstruction.Approve: { + const decodedIx = (0, spl_token_1.decodeApproveInstruction)(instruction); const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "approve", @@ -258,8 +257,8 @@ function decodeTokenInstruction(instruction) { }; break; } - case spl.TokenInstruction.Revoke: { - const decodedIx = spl.decodeRevokeInstruction(instruction); + case spl_token_1.TokenInstruction.Revoke: { + const decodedIx = (0, spl_token_1.decodeRevokeInstruction)(instruction); const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "revoke", @@ -268,18 +267,24 @@ function decodeTokenInstruction(instruction) { }; break; } - case spl.TokenInstruction.SetAuthority: { - const decodedIx = spl.decodeSetAuthorityInstruction(instruction); + case spl_token_1.TokenInstruction.SetAuthority: { + const decodedIx = (0, spl_token_1.decodeSetAuthorityInstruction)(instruction); + const authrorityTypeMap = { + [spl_token_1.AuthorityType.AccountOwner]: { accountOwner: {} }, + [spl_token_1.AuthorityType.CloseAccount]: { closeAccount: {} }, + [spl_token_1.AuthorityType.FreezeAccount]: { freezeAccount: {} }, + [spl_token_1.AuthorityType.MintTokens]: { mintTokens: {} }, + }; const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "setAuthority", accounts: [{ name: "account", ...decodedIx.keys.account }, { name: "currentAuthority", ...decodedIx.keys.currentAuthority }, ...multisig], - args: { authorityType: decodedIx.data.authorityType, newAuthority: decodedIx.data.newAuthority }, + args: { authorityType: authrorityTypeMap[decodedIx.data.authorityType], newAuthority: decodedIx.data.newAuthority }, }; break; } - case spl.TokenInstruction.MintTo: { - const decodedIx = spl.decodeMintToInstruction(instruction); + case spl_token_1.TokenInstruction.MintTo: { + const decodedIx = (0, spl_token_1.decodeMintToInstruction)(instruction); const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "mintTo", @@ -293,8 +298,8 @@ function decodeTokenInstruction(instruction) { }; break; } - case spl.TokenInstruction.Burn: { - const decodedIx = spl.decodeBurnInstruction(instruction); + case spl_token_1.TokenInstruction.Burn: { + const decodedIx = (0, spl_token_1.decodeBurnInstruction)(instruction); const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "burn", @@ -308,8 +313,8 @@ function decodeTokenInstruction(instruction) { }; break; } - case spl.TokenInstruction.CloseAccount: { - const decodedIx = spl.decodeCloseAccountInstruction(instruction); + case spl_token_1.TokenInstruction.CloseAccount: { + const decodedIx = (0, spl_token_1.decodeCloseAccountInstruction)(instruction); const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "closeAccount", @@ -323,8 +328,8 @@ function decodeTokenInstruction(instruction) { }; break; } - case spl.TokenInstruction.FreezeAccount: { - const decodedIx = spl.decodeFreezeAccountInstruction(instruction); + case spl_token_1.TokenInstruction.FreezeAccount: { + const decodedIx = (0, spl_token_1.decodeFreezeAccountInstruction)(instruction); const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "freezeAccount", @@ -338,8 +343,8 @@ function decodeTokenInstruction(instruction) { }; break; } - case spl.TokenInstruction.ThawAccount: { - const decodedIx = spl.decodeThawAccountInstruction(instruction); + case spl_token_1.TokenInstruction.ThawAccount: { + const decodedIx = (0, spl_token_1.decodeThawAccountInstruction)(instruction); const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "thawAccount", @@ -353,8 +358,8 @@ function decodeTokenInstruction(instruction) { }; break; } - case spl.TokenInstruction.TransferChecked: { - const decodedIx = spl.decodeTransferCheckedInstruction(instruction); + case spl_token_1.TokenInstruction.TransferChecked: { + const decodedIx = (0, spl_token_1.decodeTransferCheckedInstruction)(instruction); const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "transferChecked", @@ -369,8 +374,8 @@ function decodeTokenInstruction(instruction) { }; break; } - case spl.TokenInstruction.ApproveChecked: { - const decodedIx = spl.decodeApproveCheckedInstruction(instruction); + case spl_token_1.TokenInstruction.ApproveChecked: { + const decodedIx = (0, spl_token_1.decodeApproveCheckedInstruction)(instruction); const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "approveChecked", @@ -385,8 +390,8 @@ function decodeTokenInstruction(instruction) { }; break; } - case spl.TokenInstruction.MintToChecked: { - const decodedIx = spl.decodeMintToCheckedInstruction(instruction); + case spl_token_1.TokenInstruction.MintToChecked: { + const decodedIx = (0, spl_token_1.decodeMintToCheckedInstruction)(instruction); const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "mintToChecked", @@ -400,8 +405,8 @@ function decodeTokenInstruction(instruction) { }; break; } - case spl.TokenInstruction.BurnChecked: { - const decodedIx = spl.decodeBurnCheckedInstruction(instruction); + case spl_token_1.TokenInstruction.BurnChecked: { + const decodedIx = (0, spl_token_1.decodeBurnCheckedInstruction)(instruction); const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "burnChecked", @@ -415,7 +420,7 @@ function decodeTokenInstruction(instruction) { }; break; } - case spl.TokenInstruction.InitializeAccount2: { + case spl_token_1.TokenInstruction.InitializeAccount2: { const initializeAccount2InstructionData = (0, buffer_layout_1.struct)([(0, buffer_layout_1.u8)("instruction"), (0, buffer_layout_1.blob)(32, "owner")]); const decodedIx = initializeAccount2InstructionData.decode(instruction.data); parsed = { @@ -425,11 +430,11 @@ function decodeTokenInstruction(instruction) { { name: "tokenMint", ...instruction.keys[1] }, { name: "rentSysvar", ...instruction.keys[2] }, ], - args: { authority: new web3_js_1.PublicKey(decodedIx.owner) }, + args: { owner: new web3_js_1.PublicKey(decodedIx.owner) }, }; break; } - case spl.TokenInstruction.SyncNative: { + case spl_token_1.TokenInstruction.SyncNative: { parsed = { name: "syncNative", accounts: [{ name: "account", ...instruction.keys[0] }], @@ -437,7 +442,7 @@ function decodeTokenInstruction(instruction) { }; break; } - case spl.TokenInstruction.InitializeAccount3: { + case spl_token_1.TokenInstruction.InitializeAccount3: { const initializeAccount3InstructionData = (0, buffer_layout_1.struct)([(0, buffer_layout_1.u8)("instruction"), (0, buffer_layout_1.blob)(32, "owner")]); const decodedIx = initializeAccount3InstructionData.decode(instruction.data); parsed = { @@ -446,11 +451,11 @@ function decodeTokenInstruction(instruction) { { name: "newAccount", ...instruction.keys[0] }, { name: "tokenMint", ...instruction.keys[1] }, ], - args: { authority: new web3_js_1.PublicKey(decodedIx.owner) }, + args: { owner: new web3_js_1.PublicKey(decodedIx.owner) }, }; break; } - case spl.TokenInstruction.InitializeMultisig2: { + case spl_token_1.TokenInstruction.InitializeMultisig2: { const multisig = instruction.keys.slice(1).map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "initializeMultisig2", @@ -459,8 +464,8 @@ function decodeTokenInstruction(instruction) { }; break; } - case spl.TokenInstruction.InitializeMint2: { - const decodedIx = spl.decodeInitializeMintInstructionUnchecked(instruction); + case spl_token_1.TokenInstruction.InitializeMint2: { + const decodedIx = (0, spl_token_1.decodeInitializeMintInstructionUnchecked)(instruction); const tokenMint = decodedIx.keys.mint; if (!tokenMint) throw new Error(`Failed to parse InitializeMint2 instruction`); @@ -478,10 +483,10 @@ function decodeTokenInstruction(instruction) { return parsed ? { ...parsed, - programId: spl.TOKEN_PROGRAM_ID, + programId: spl_token_1.TOKEN_PROGRAM_ID, } : { - programId: spl.TOKEN_PROGRAM_ID, + programId: spl_token_1.TOKEN_PROGRAM_ID, name: "unknown", accounts: instruction.keys, args: { unknown: instruction.data }, @@ -500,7 +505,7 @@ function decodeAssociatedTokenInstruction(instruction) { ...[instruction.keys.length > 5 ? { name: "rentSysvar", ...instruction.keys[6] } : undefined], ], args: {}, - programId: spl.ASSOCIATED_TOKEN_PROGRAM_ID, + programId: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID, }; } function flattenIdlAccounts(accounts, prefix) { @@ -539,8 +544,8 @@ class SolanaParser { constructor(programInfos, parsers) { const standartParsers = [ [web3_js_1.SystemProgram.programId.toBase58(), decodeSystemInstruction], - [spl.TOKEN_PROGRAM_ID.toBase58(), decodeTokenInstruction], - [spl.ASSOCIATED_TOKEN_PROGRAM_ID.toBase58(), decodeAssociatedTokenInstruction], + [spl_token_1.TOKEN_PROGRAM_ID.toBase58(), decodeTokenInstruction], + [spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID.toBase58(), decodeAssociatedTokenInstruction], ]; let result; parsers = parsers || []; diff --git a/dist/cjs/parsers.js.map b/dist/cjs/parsers.js.map index f598eb0..9b81de8 100644 --- a/dist/cjs/parsers.js.map +++ b/dist/cjs/parsers.js.map @@ -1 +1 @@ -{"version":3,"file":"parsers.js","sourceRoot":"","sources":["../../src/parsers.ts"],"names":[],"mappings":";;;;AAAA,mCAAgC;AAEhC,6CAcyB;AACzB,+DAAyC;AACzC,kDAAoH;AACpH,yDAAyD;AAiBzD,uCAAmJ;AAEnJ,SAAS,uBAAuB,CAAC,WAAmC;IACnE,MAAM,MAAM,GAAG,2BAAiB,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC;IACpE,IAAI,MAAqD,CAAC;IAC1D,QAAQ,MAAM,EAAE;QACf,KAAK,qBAAqB,CAAC,CAAC;YAC3B,MAAM,OAAO,GAAG,2BAAiB,CAAC,kBAAkB,CAAC,WAA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AgB,CAAC,IAAA,wCAA8B,EAAC,QAAuC,EAAE,cAAc,CAAC,CAAC,CAC9G,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,gBAAgB,CACrB,UAAsB,EACtB,IAAY,EACZ,UAAmB,KAAK,EACxB,aAAuB,WAAW;;QAElC,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC,cAAc,CAAC,IAAI,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,8BAA8B,EAAE,CAAC,EAAE,CAAC,CAAC;QACzH,IAAI,CAAC,WAAW;YAAE,OAAO,IAAI,CAAC;QAC9B,IAAI,OAAO,EAAE;YACZ,MAAM,SAAS,GAAG,IAAA,oCAA0B,EAAC,WAAW,CAAC,CAAC;YAE1D,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,CAAC;SACxD;QAED,OAAO,IAAI,CAAC,oBAAoB,CAAC,WAAW,CAAC,WAAW,CAAC,OAAO,EAAE,MAAA,WAAW,CAAC,IAAI,0CAAE,eAAe,CAAC,CAAC;IACtG,CAAC;IAED;;;;OAIG;IACH,oBAAoB,CAAC,MAAuB;QAC3C,IAAI,CAAC,CAAC,MAAM,YAAY,eAAM,CAAC;YAAE,MAAM,GAAG,eAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QACxE,MAAM,EAAE,GAAG,qBAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACpC,MAAM,OAAO,GAAG,EAAE,CAAC,cAAc,EAAE,CAAC;QAEpC,OAAO,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAC3C,CAAC;CACD;AApMD,oCAoMC"} \ No newline at end of file diff --git a/dist/esm/helpers.js b/dist/esm/helpers.js index 24e8a01..8815c52 100644 --- a/dist/esm/helpers.js +++ b/dist/esm/helpers.js @@ -1,4 +1,4 @@ -import { utils } from "@project-serum/anchor"; +import { utils } from "@coral-xyz/anchor"; import { PublicKey, TransactionInstruction, } from "@solana/web3.js"; export function hexToBuffer(data) { const rawHex = data.startsWith("0x") ? data.slice(2) : data; diff --git a/dist/esm/helpers.js.map b/dist/esm/helpers.js.map index fac7aff..464fd06 100644 --- a/dist/esm/helpers.js.map +++ b/dist/esm/helpers.js.map @@ -1 +1 @@ -{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAON,SAAS,EACT,sBAAsB,GAGtB,MAAM,iBAAiB,CAAC;AAIzB,MAAM,UAAU,WAAW,CAAC,IAAY;IACvC,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAE5D,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CACvC,OAAU,EACV,kBAAwF,SAAS;IAEjG,MAAM,QAAQ,GAAgB,OAAO,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC;IAC7G,MAAM,2BAA2B,GAAG,OAAO,CAAC,MAAM,CAAC,yBAAyB,CAAC;IAC7E,MAAM,6BAA6B,GAAG,OAAO,CAAC,MAAM,CAAC,2BAA2B,CAAC;IACjF,MAAM,+BAA+B,GAAG,OAAO,CAAC,MAAM,CAAC,qBAAqB,CAAC;IAC7E,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC;IACtC,IAAI,cAAc,GAAkB,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE;QACjE,MAAM,UAAU,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AAC,CAAC,CAAC,CAAC,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC;SAC9E;KACD;IAED,OAAO,MAAM,CAAC;AACf,CAAC"} \ No newline at end of file diff --git a/dist/esm/parsers.js b/dist/esm/parsers.js index 2ccb98a..33ac44d 100644 --- a/dist/esm/parsers.js +++ b/dist/esm/parsers.js @@ -1,7 +1,7 @@ import { Buffer } from "buffer"; import { PublicKey, SystemInstruction, SystemProgram, Transaction, } from "@solana/web3.js"; -import * as spl from "@solana/spl-token"; -import { BN, BorshInstructionCoder } from "@project-serum/anchor"; +import { ASSOCIATED_TOKEN_PROGRAM_ID, AuthorityType, TOKEN_PROGRAM_ID, TokenInstruction, decodeApproveCheckedInstruction, decodeApproveInstruction, decodeBurnCheckedInstruction, decodeBurnInstruction, decodeCloseAccountInstruction, decodeFreezeAccountInstruction, decodeInitializeAccountInstruction, decodeInitializeMintInstruction, decodeInitializeMintInstructionUnchecked, decodeInitializeMultisigInstruction, decodeMintToCheckedInstruction, decodeMintToInstruction, decodeRevokeInstruction, decodeSetAuthorityInstruction, decodeThawAccountInstruction, decodeTransferCheckedInstruction, decodeTransferInstruction, } from "@solana/spl-token"; +import { BN, BorshInstructionCoder } from "@coral-xyz/anchor"; import { blob, struct, u8 } from "@solana/buffer-layout"; import { compiledInstructionToInstruction, flattenTransactionResponse, parsedInstructionToInstruction, parseTransactionAccounts } from "./helpers"; function decodeSystemInstruction(instruction) { @@ -188,8 +188,8 @@ function decodeTokenInstruction(instruction) { let parsed; const decoded = u8().decode(instruction.data); switch (decoded) { - case spl.TokenInstruction.InitializeMint: { - const decodedIx = spl.decodeInitializeMintInstruction(instruction); + case TokenInstruction.InitializeMint: { + const decodedIx = decodeInitializeMintInstruction(instruction); parsed = { name: "initializeMint", accounts: [ @@ -200,8 +200,8 @@ function decodeTokenInstruction(instruction) { }; break; } - case spl.TokenInstruction.InitializeAccount: { - const decodedIx = spl.decodeInitializeAccountInstruction(instruction); + case TokenInstruction.InitializeAccount: { + const decodedIx = decodeInitializeAccountInstruction(instruction); parsed = { name: "initializeAccount", accounts: [ @@ -214,8 +214,8 @@ function decodeTokenInstruction(instruction) { }; break; } - case spl.TokenInstruction.InitializeMultisig: { - const decodedIx = spl.decodeInitializeMultisigInstruction(instruction); + case TokenInstruction.InitializeMultisig: { + const decodedIx = decodeInitializeMultisigInstruction(instruction); const multisig = decodedIx.keys.signers.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "initializeMultisig", @@ -224,8 +224,8 @@ function decodeTokenInstruction(instruction) { }; break; } - case spl.TokenInstruction.Transfer: { - const decodedIx = spl.decodeTransferInstruction(instruction); + case TokenInstruction.Transfer: { + const decodedIx = decodeTransferInstruction(instruction); const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "transfer", @@ -239,8 +239,8 @@ function decodeTokenInstruction(instruction) { }; break; } - case spl.TokenInstruction.Approve: { - const decodedIx = spl.decodeApproveInstruction(instruction); + case TokenInstruction.Approve: { + const decodedIx = decodeApproveInstruction(instruction); const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "approve", @@ -254,8 +254,8 @@ function decodeTokenInstruction(instruction) { }; break; } - case spl.TokenInstruction.Revoke: { - const decodedIx = spl.decodeRevokeInstruction(instruction); + case TokenInstruction.Revoke: { + const decodedIx = decodeRevokeInstruction(instruction); const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "revoke", @@ -264,18 +264,24 @@ function decodeTokenInstruction(instruction) { }; break; } - case spl.TokenInstruction.SetAuthority: { - const decodedIx = spl.decodeSetAuthorityInstruction(instruction); + case TokenInstruction.SetAuthority: { + const decodedIx = decodeSetAuthorityInstruction(instruction); + const authrorityTypeMap = { + [AuthorityType.AccountOwner]: { accountOwner: {} }, + [AuthorityType.CloseAccount]: { closeAccount: {} }, + [AuthorityType.FreezeAccount]: { freezeAccount: {} }, + [AuthorityType.MintTokens]: { mintTokens: {} }, + }; const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "setAuthority", accounts: [{ name: "account", ...decodedIx.keys.account }, { name: "currentAuthority", ...decodedIx.keys.currentAuthority }, ...multisig], - args: { authorityType: decodedIx.data.authorityType, newAuthority: decodedIx.data.newAuthority }, + args: { authorityType: authrorityTypeMap[decodedIx.data.authorityType], newAuthority: decodedIx.data.newAuthority }, }; break; } - case spl.TokenInstruction.MintTo: { - const decodedIx = spl.decodeMintToInstruction(instruction); + case TokenInstruction.MintTo: { + const decodedIx = decodeMintToInstruction(instruction); const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "mintTo", @@ -289,8 +295,8 @@ function decodeTokenInstruction(instruction) { }; break; } - case spl.TokenInstruction.Burn: { - const decodedIx = spl.decodeBurnInstruction(instruction); + case TokenInstruction.Burn: { + const decodedIx = decodeBurnInstruction(instruction); const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "burn", @@ -304,8 +310,8 @@ function decodeTokenInstruction(instruction) { }; break; } - case spl.TokenInstruction.CloseAccount: { - const decodedIx = spl.decodeCloseAccountInstruction(instruction); + case TokenInstruction.CloseAccount: { + const decodedIx = decodeCloseAccountInstruction(instruction); const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "closeAccount", @@ -319,8 +325,8 @@ function decodeTokenInstruction(instruction) { }; break; } - case spl.TokenInstruction.FreezeAccount: { - const decodedIx = spl.decodeFreezeAccountInstruction(instruction); + case TokenInstruction.FreezeAccount: { + const decodedIx = decodeFreezeAccountInstruction(instruction); const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "freezeAccount", @@ -334,8 +340,8 @@ function decodeTokenInstruction(instruction) { }; break; } - case spl.TokenInstruction.ThawAccount: { - const decodedIx = spl.decodeThawAccountInstruction(instruction); + case TokenInstruction.ThawAccount: { + const decodedIx = decodeThawAccountInstruction(instruction); const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "thawAccount", @@ -349,8 +355,8 @@ function decodeTokenInstruction(instruction) { }; break; } - case spl.TokenInstruction.TransferChecked: { - const decodedIx = spl.decodeTransferCheckedInstruction(instruction); + case TokenInstruction.TransferChecked: { + const decodedIx = decodeTransferCheckedInstruction(instruction); const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "transferChecked", @@ -365,8 +371,8 @@ function decodeTokenInstruction(instruction) { }; break; } - case spl.TokenInstruction.ApproveChecked: { - const decodedIx = spl.decodeApproveCheckedInstruction(instruction); + case TokenInstruction.ApproveChecked: { + const decodedIx = decodeApproveCheckedInstruction(instruction); const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "approveChecked", @@ -381,8 +387,8 @@ function decodeTokenInstruction(instruction) { }; break; } - case spl.TokenInstruction.MintToChecked: { - const decodedIx = spl.decodeMintToCheckedInstruction(instruction); + case TokenInstruction.MintToChecked: { + const decodedIx = decodeMintToCheckedInstruction(instruction); const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "mintToChecked", @@ -396,8 +402,8 @@ function decodeTokenInstruction(instruction) { }; break; } - case spl.TokenInstruction.BurnChecked: { - const decodedIx = spl.decodeBurnCheckedInstruction(instruction); + case TokenInstruction.BurnChecked: { + const decodedIx = decodeBurnCheckedInstruction(instruction); const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "burnChecked", @@ -411,7 +417,7 @@ function decodeTokenInstruction(instruction) { }; break; } - case spl.TokenInstruction.InitializeAccount2: { + case TokenInstruction.InitializeAccount2: { const initializeAccount2InstructionData = struct([u8("instruction"), blob(32, "owner")]); const decodedIx = initializeAccount2InstructionData.decode(instruction.data); parsed = { @@ -421,11 +427,11 @@ function decodeTokenInstruction(instruction) { { name: "tokenMint", ...instruction.keys[1] }, { name: "rentSysvar", ...instruction.keys[2] }, ], - args: { authority: new PublicKey(decodedIx.owner) }, + args: { owner: new PublicKey(decodedIx.owner) }, }; break; } - case spl.TokenInstruction.SyncNative: { + case TokenInstruction.SyncNative: { parsed = { name: "syncNative", accounts: [{ name: "account", ...instruction.keys[0] }], @@ -433,7 +439,7 @@ function decodeTokenInstruction(instruction) { }; break; } - case spl.TokenInstruction.InitializeAccount3: { + case TokenInstruction.InitializeAccount3: { const initializeAccount3InstructionData = struct([u8("instruction"), blob(32, "owner")]); const decodedIx = initializeAccount3InstructionData.decode(instruction.data); parsed = { @@ -442,11 +448,11 @@ function decodeTokenInstruction(instruction) { { name: "newAccount", ...instruction.keys[0] }, { name: "tokenMint", ...instruction.keys[1] }, ], - args: { authority: new PublicKey(decodedIx.owner) }, + args: { owner: new PublicKey(decodedIx.owner) }, }; break; } - case spl.TokenInstruction.InitializeMultisig2: { + case TokenInstruction.InitializeMultisig2: { const multisig = instruction.keys.slice(1).map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "initializeMultisig2", @@ -455,8 +461,8 @@ function decodeTokenInstruction(instruction) { }; break; } - case spl.TokenInstruction.InitializeMint2: { - const decodedIx = spl.decodeInitializeMintInstructionUnchecked(instruction); + case TokenInstruction.InitializeMint2: { + const decodedIx = decodeInitializeMintInstructionUnchecked(instruction); const tokenMint = decodedIx.keys.mint; if (!tokenMint) throw new Error(`Failed to parse InitializeMint2 instruction`); @@ -474,10 +480,10 @@ function decodeTokenInstruction(instruction) { return parsed ? { ...parsed, - programId: spl.TOKEN_PROGRAM_ID, + programId: TOKEN_PROGRAM_ID, } : { - programId: spl.TOKEN_PROGRAM_ID, + programId: TOKEN_PROGRAM_ID, name: "unknown", accounts: instruction.keys, args: { unknown: instruction.data }, @@ -496,7 +502,7 @@ function decodeAssociatedTokenInstruction(instruction) { ...[instruction.keys.length > 5 ? { name: "rentSysvar", ...instruction.keys[6] } : undefined], ], args: {}, - programId: spl.ASSOCIATED_TOKEN_PROGRAM_ID, + programId: ASSOCIATED_TOKEN_PROGRAM_ID, }; } function flattenIdlAccounts(accounts, prefix) { @@ -535,8 +541,8 @@ export class SolanaParser { constructor(programInfos, parsers) { const standartParsers = [ [SystemProgram.programId.toBase58(), decodeSystemInstruction], - [spl.TOKEN_PROGRAM_ID.toBase58(), decodeTokenInstruction], - [spl.ASSOCIATED_TOKEN_PROGRAM_ID.toBase58(), decodeAssociatedTokenInstruction], + [TOKEN_PROGRAM_ID.toBase58(), decodeTokenInstruction], + [ASSOCIATED_TOKEN_PROGRAM_ID.toBase58(), decodeAssociatedTokenInstruction], ]; let result; parsers = parsers || []; diff --git a/dist/esm/parsers.js.map b/dist/esm/parsers.js.map index f5ad412..55d46ea 100644 --- a/dist/esm/parsers.js.map +++ b/dist/esm/parsers.js.map @@ -1 +1 @@ -{"version":3,"file":"parsers.js","sourceRoot":"","sources":["../../src/parsers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EACN,SAAS,EAET,iBAAiB,EACjB,aAAa,EAGb,WAAW,GAOX,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,GAAG,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,EAAE,EAAE,qBAAqB,EAAoD,MAAM,uBAAuB,CAAC;AACpH,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,uBAAuB,CAAC;AAiBzD,OAAO,EAAE,gCAAgC,EAAE,0BAA0B,EAAE,8BAA8B,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAEnJ,SAAS,uBAAuB,CAAC,WAAmC;IACnE,MAAM,MAA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0CAAE,eAAe,CAAC,CAAC;IACtG,CAAC;IAED;;;;OAIG;IACH,oBAAoB,CAAC,MAAuB;QAC3C,IAAI,CAAC,CAAC,MAAM,YAAY,MAAM,CAAC;YAAE,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QACxE,MAAM,EAAE,GAAG,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACpC,MAAM,OAAO,GAAG,EAAE,CAAC,cAAc,EAAE,CAAC;QAEpC,OAAO,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAC3C,CAAC;CACD"} \ No newline at end of file diff --git a/package.json b/package.json index 9816aeb..6b9a0e8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@debridge-finance/solana-transaction-parser", "description": "Tool for parsing arbitrary Solana transactions with IDL/custom parsers", - "version": "1.1.1", + "version": "2.0.0", "author": "deBridge", "license": "LGPL-2.1", "homepage": "https://debridge.finance", @@ -36,6 +36,7 @@ "test:custom": "mocha -r ts-node/register -b -t 200000 ./tests/customParser.test.ts", "prettify": "prettier --write ./**/*.ts", "lint": "eslint --config .eslintrc \"./{src,tests}/**/*.{js,ts}\"", + "lint:fix": "eslint --config .eslintrc \"./{src,tests}/**/*.{js,ts}\" --fix", "lint:dump": "eslint --print-config ./.eslintrc.json" }, "devDependencies": { @@ -53,20 +54,22 @@ "eslint-config-prettier": "^8.3.0", "eslint-plugin-eslint-comments": "^3.2.0", "eslint-plugin-import": "^2.25.3", - "eslint-plugin-prettier": "^4.0.0", + "eslint-plugin-prettier": "^5.0.0", "mocha": "^10.0.0", "rollup": "^2.77.2", "rollup-plugin-terser": "^7.0.2", "snake-case": "^3.0.4", "ts-node": "^10.9.1", - "typedoc": "^0.23.2", - "typedoc-plugin-markdown": "^3.13.1" + "tslib": "^2.6.1", + "typedoc": "^0.24.8", + "typedoc-plugin-markdown": "^3.15.4" }, "dependencies": { - "@project-serum/anchor": "0.25.0", + "@coral-xyz/anchor": "^0.28.1-beta.1", + "@coral-xyz/spl-token": "^0.28.1-beta.1", "@solana/buffer-layout": "4.0.0", - "@solana/spl-token": "0.3.7", - "@solana/web3.js": "1.73.0", + "@solana/spl-token": "^0.3.8", + "@solana/web3.js": "^1.73.0", "buffer": "6.0.3" } } diff --git a/rollup.config.js b/rollup.config.js index 6157b18..e2dad88 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -22,7 +22,7 @@ export default { }), terser(), ], - external: ["@solana/web3.js", "@project-serum/anchor"], + external: ["@solana/web3.js", "@coral-xyz/anchor"], output: { file: "dist/browser/index.js", format: "es", diff --git a/src/helpers.ts b/src/helpers.ts index 7229043..8db5710 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -1,4 +1,4 @@ -import { utils } from "@project-serum/anchor"; +import { utils } from "@coral-xyz/anchor"; import { AccountMeta, CompiledInstruction, diff --git a/src/interfaces.ts b/src/interfaces.ts index e1840c4..f24a260 100644 --- a/src/interfaces.ts +++ b/src/interfaces.ts @@ -1,6 +1,9 @@ -import { BN, Idl, IdlTypes } from "@project-serum/anchor"; +import { splTokenProgram } from "@coral-xyz/spl-token"; +import { BN, Idl, IdlTypes } from "@coral-xyz/anchor"; import { AccountMeta, PublicKey, Transaction, TransactionInstruction } from "@solana/web3.js"; +export type SplToken = ReturnType["idl"]; + /** * Context of logs for specific instruction */ diff --git a/src/parsers.ts b/src/parsers.ts index d247f6a..1951229 100644 --- a/src/parsers.ts +++ b/src/parsers.ts @@ -15,8 +15,30 @@ import { VersionedMessage, LoadedAddresses, } from "@solana/web3.js"; -import * as spl from "@solana/spl-token"; -import { BN, BorshInstructionCoder, Idl, SystemProgram as SystemProgramIdl, SplToken } from "@project-serum/anchor"; +import { + ASSOCIATED_TOKEN_PROGRAM_ID, + AuthorityType, + TOKEN_PROGRAM_ID, + TokenInstruction, + decodeApproveCheckedInstruction, + decodeApproveInstruction, + decodeBurnCheckedInstruction, + decodeBurnInstruction, + decodeCloseAccountInstruction, + decodeFreezeAccountInstruction, + decodeInitializeAccountInstruction, + decodeInitializeMintInstruction, + decodeInitializeMintInstructionUnchecked, + decodeInitializeMultisigInstruction, + decodeMintToCheckedInstruction, + decodeMintToInstruction, + decodeRevokeInstruction, + decodeSetAuthorityInstruction, + decodeThawAccountInstruction, + decodeTransferCheckedInstruction, + decodeTransferInstruction, +} from "@solana/spl-token"; +import { BN, BorshInstructionCoder, Idl, SystemProgram as SystemProgramIdl } from "@coral-xyz/anchor"; import { blob, struct, u8 } from "@solana/buffer-layout"; import { @@ -32,6 +54,7 @@ import { ParsedInstruction, ParserFunction, ProgramInfoType, + SplToken, UnknownInstruction, } from "./interfaces"; import { compiledInstructionToInstruction, flattenTransactionResponse, parsedInstructionToInstruction, parseTransactionAccounts } from "./helpers"; @@ -222,8 +245,8 @@ function decodeTokenInstruction(instruction: TransactionInstruction): ParsedInst let parsed: ParsedIdlInstruction | null; const decoded = u8().decode(instruction.data); switch (decoded) { - case spl.TokenInstruction.InitializeMint: { - const decodedIx = spl.decodeInitializeMintInstruction(instruction); + case TokenInstruction.InitializeMint: { + const decodedIx = decodeInitializeMintInstruction(instruction); parsed = { name: "initializeMint", accounts: [ @@ -234,8 +257,8 @@ function decodeTokenInstruction(instruction: TransactionInstruction): ParsedInst } as ParsedIdlInstruction; break; } - case spl.TokenInstruction.InitializeAccount: { - const decodedIx = spl.decodeInitializeAccountInstruction(instruction); + case TokenInstruction.InitializeAccount: { + const decodedIx = decodeInitializeAccountInstruction(instruction); parsed = { name: "initializeAccount", accounts: [ @@ -248,8 +271,8 @@ function decodeTokenInstruction(instruction: TransactionInstruction): ParsedInst } as ParsedIdlInstruction; break; } - case spl.TokenInstruction.InitializeMultisig: { - const decodedIx = spl.decodeInitializeMultisigInstruction(instruction); + case TokenInstruction.InitializeMultisig: { + const decodedIx = decodeInitializeMultisigInstruction(instruction); const multisig = decodedIx.keys.signers.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "initializeMultisig", @@ -258,8 +281,8 @@ function decodeTokenInstruction(instruction: TransactionInstruction): ParsedInst } as ParsedIdlInstruction; break; } - case spl.TokenInstruction.Transfer: { - const decodedIx = spl.decodeTransferInstruction(instruction); + case TokenInstruction.Transfer: { + const decodedIx = decodeTransferInstruction(instruction); const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "transfer", @@ -273,8 +296,8 @@ function decodeTokenInstruction(instruction: TransactionInstruction): ParsedInst } as ParsedIdlInstruction; break; } - case spl.TokenInstruction.Approve: { - const decodedIx = spl.decodeApproveInstruction(instruction); + case TokenInstruction.Approve: { + const decodedIx = decodeApproveInstruction(instruction); const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "approve", @@ -288,8 +311,8 @@ function decodeTokenInstruction(instruction: TransactionInstruction): ParsedInst } as ParsedIdlInstruction; break; } - case spl.TokenInstruction.Revoke: { - const decodedIx = spl.decodeRevokeInstruction(instruction); + case TokenInstruction.Revoke: { + const decodedIx = decodeRevokeInstruction(instruction); const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "revoke", @@ -298,18 +321,24 @@ function decodeTokenInstruction(instruction: TransactionInstruction): ParsedInst } as ParsedIdlInstruction; break; } - case spl.TokenInstruction.SetAuthority: { - const decodedIx = spl.decodeSetAuthorityInstruction(instruction); + case TokenInstruction.SetAuthority: { + const decodedIx = decodeSetAuthorityInstruction(instruction); + const authrorityTypeMap = { + [AuthorityType.AccountOwner]: { accountOwner: {} }, + [AuthorityType.CloseAccount]: { closeAccount: {} }, + [AuthorityType.FreezeAccount]: { freezeAccount: {} }, + [AuthorityType.MintTokens]: { mintTokens: {} }, + }; const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "setAuthority", accounts: [{ name: "account", ...decodedIx.keys.account }, { name: "currentAuthority", ...decodedIx.keys.currentAuthority }, ...multisig], - args: { authorityType: decodedIx.data.authorityType, newAuthority: decodedIx.data.newAuthority }, + args: { authorityType: authrorityTypeMap[decodedIx.data.authorityType], newAuthority: decodedIx.data.newAuthority }, } as ParsedIdlInstruction; break; } - case spl.TokenInstruction.MintTo: { - const decodedIx = spl.decodeMintToInstruction(instruction); + case TokenInstruction.MintTo: { + const decodedIx = decodeMintToInstruction(instruction); const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "mintTo", @@ -323,8 +352,8 @@ function decodeTokenInstruction(instruction: TransactionInstruction): ParsedInst } as ParsedIdlInstruction; break; } - case spl.TokenInstruction.Burn: { - const decodedIx = spl.decodeBurnInstruction(instruction); + case TokenInstruction.Burn: { + const decodedIx = decodeBurnInstruction(instruction); const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "burn", @@ -338,8 +367,8 @@ function decodeTokenInstruction(instruction: TransactionInstruction): ParsedInst } as ParsedIdlInstruction; break; } - case spl.TokenInstruction.CloseAccount: { - const decodedIx = spl.decodeCloseAccountInstruction(instruction); + case TokenInstruction.CloseAccount: { + const decodedIx = decodeCloseAccountInstruction(instruction); const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "closeAccount", @@ -353,8 +382,8 @@ function decodeTokenInstruction(instruction: TransactionInstruction): ParsedInst } as ParsedIdlInstruction; break; } - case spl.TokenInstruction.FreezeAccount: { - const decodedIx = spl.decodeFreezeAccountInstruction(instruction); + case TokenInstruction.FreezeAccount: { + const decodedIx = decodeFreezeAccountInstruction(instruction); const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "freezeAccount", @@ -368,8 +397,8 @@ function decodeTokenInstruction(instruction: TransactionInstruction): ParsedInst } as ParsedIdlInstruction; break; } - case spl.TokenInstruction.ThawAccount: { - const decodedIx = spl.decodeThawAccountInstruction(instruction); + case TokenInstruction.ThawAccount: { + const decodedIx = decodeThawAccountInstruction(instruction); const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "thawAccount", @@ -383,8 +412,8 @@ function decodeTokenInstruction(instruction: TransactionInstruction): ParsedInst } as ParsedIdlInstruction; break; } - case spl.TokenInstruction.TransferChecked: { - const decodedIx = spl.decodeTransferCheckedInstruction(instruction); + case TokenInstruction.TransferChecked: { + const decodedIx = decodeTransferCheckedInstruction(instruction); const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "transferChecked", @@ -399,8 +428,8 @@ function decodeTokenInstruction(instruction: TransactionInstruction): ParsedInst } as ParsedIdlInstruction; break; } - case spl.TokenInstruction.ApproveChecked: { - const decodedIx = spl.decodeApproveCheckedInstruction(instruction); + case TokenInstruction.ApproveChecked: { + const decodedIx = decodeApproveCheckedInstruction(instruction); const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "approveChecked", @@ -415,8 +444,8 @@ function decodeTokenInstruction(instruction: TransactionInstruction): ParsedInst } as ParsedIdlInstruction; break; } - case spl.TokenInstruction.MintToChecked: { - const decodedIx = spl.decodeMintToCheckedInstruction(instruction); + case TokenInstruction.MintToChecked: { + const decodedIx = decodeMintToCheckedInstruction(instruction); const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "mintToChecked", @@ -430,8 +459,8 @@ function decodeTokenInstruction(instruction: TransactionInstruction): ParsedInst } as ParsedIdlInstruction; break; } - case spl.TokenInstruction.BurnChecked: { - const decodedIx = spl.decodeBurnCheckedInstruction(instruction); + case TokenInstruction.BurnChecked: { + const decodedIx = decodeBurnCheckedInstruction(instruction); const multisig = decodedIx.keys.multiSigners.map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "burnChecked", @@ -445,9 +474,9 @@ function decodeTokenInstruction(instruction: TransactionInstruction): ParsedInst } as ParsedIdlInstruction; break; } - case spl.TokenInstruction.InitializeAccount2: { + case TokenInstruction.InitializeAccount2: { interface InitializeAccount2InstructionData { - instruction: spl.TokenInstruction.InitializeAccount2; + instruction: TokenInstruction.InitializeAccount2; owner: Uint8Array; } @@ -461,11 +490,11 @@ function decodeTokenInstruction(instruction: TransactionInstruction): ParsedInst { name: "tokenMint", ...instruction.keys[1] }, { name: "rentSysvar", ...instruction.keys[2] }, ], - args: { authority: new PublicKey(decodedIx.owner) }, + args: { owner: new PublicKey(decodedIx.owner) }, } as ParsedIdlInstruction; break; } - case spl.TokenInstruction.SyncNative: { + case TokenInstruction.SyncNative: { parsed = { name: "syncNative", accounts: [{ name: "account", ...instruction.keys[0] }], @@ -473,9 +502,9 @@ function decodeTokenInstruction(instruction: TransactionInstruction): ParsedInst } as ParsedIdlInstruction; break; } - case spl.TokenInstruction.InitializeAccount3: { + case TokenInstruction.InitializeAccount3: { interface InitializeAccount3InstructionData { - instruction: spl.TokenInstruction.InitializeAccount3; + instruction: TokenInstruction.InitializeAccount3; owner: Uint8Array; } @@ -488,11 +517,11 @@ function decodeTokenInstruction(instruction: TransactionInstruction): ParsedInst { name: "newAccount", ...instruction.keys[0] }, { name: "tokenMint", ...instruction.keys[1] }, ], - args: { authority: new PublicKey(decodedIx.owner) }, + args: { owner: new PublicKey(decodedIx.owner) }, } as ParsedIdlInstruction; break; } - case spl.TokenInstruction.InitializeMultisig2: { + case TokenInstruction.InitializeMultisig2: { const multisig = instruction.keys.slice(1).map((meta, idx) => ({ name: `signer_${idx}`, ...meta })); parsed = { name: "initializeMultisig2", @@ -501,8 +530,8 @@ function decodeTokenInstruction(instruction: TransactionInstruction): ParsedInst } as ParsedIdlInstruction; break; } - case spl.TokenInstruction.InitializeMint2: { - const decodedIx = spl.decodeInitializeMintInstructionUnchecked(instruction); + case TokenInstruction.InitializeMint2: { + const decodedIx = decodeInitializeMintInstructionUnchecked(instruction); const tokenMint = decodedIx.keys.mint; if (!tokenMint) throw new Error(`Failed to parse InitializeMint2 instruction`); parsed = { @@ -520,10 +549,10 @@ function decodeTokenInstruction(instruction: TransactionInstruction): ParsedInst return parsed ? { ...parsed, - programId: spl.TOKEN_PROGRAM_ID, + programId: TOKEN_PROGRAM_ID, } : { - programId: spl.TOKEN_PROGRAM_ID, + programId: TOKEN_PROGRAM_ID, name: "unknown", accounts: instruction.keys, args: { unknown: instruction.data }, @@ -543,7 +572,7 @@ function decodeAssociatedTokenInstruction(instruction: TransactionInstruction): ...[instruction.keys.length > 5 ? { name: "rentSysvar", ...instruction.keys[6] } : undefined], ], args: {}, - programId: spl.ASSOCIATED_TOKEN_PROGRAM_ID, + programId: ASSOCIATED_TOKEN_PROGRAM_ID, } as ParsedInstruction; } @@ -586,8 +615,8 @@ export class SolanaParser { constructor(programInfos: ProgramInfoType[], parsers?: InstructionParserInfo[]) { const standartParsers: InstructionParserInfo[] = [ [SystemProgram.programId.toBase58(), decodeSystemInstruction], - [spl.TOKEN_PROGRAM_ID.toBase58(), decodeTokenInstruction], - [spl.ASSOCIATED_TOKEN_PROGRAM_ID.toBase58(), decodeAssociatedTokenInstruction], + [TOKEN_PROGRAM_ID.toBase58(), decodeTokenInstruction], + [ASSOCIATED_TOKEN_PROGRAM_ID.toBase58(), decodeAssociatedTokenInstruction], ]; let result: InstructionParsers; parsers = parsers || []; @@ -661,7 +690,7 @@ export class SolanaParser { name: parsedIx.name, accounts, programId: instruction.programId, - args: parsedIx.data as ParsedIdlArgs, // as IxArgsMap, + args: parsedIx.data as ParsedIdlArgs, // as IxArgsMap, }; } }; diff --git a/tests/parseIx.test.ts b/tests/parseIx.test.ts index 7803a19..3809c1f 100644 --- a/tests/parseIx.test.ts +++ b/tests/parseIx.test.ts @@ -1,12 +1,11 @@ import "mocha"; import assert from "assert"; -import { SplToken } from "@project-serum/anchor"; import { TransactionInstruction, Keypair } from "@solana/web3.js"; -import * as spl from "@solana/spl-token"; +import { TOKEN_PROGRAM_ID, TokenInstruction } from "@solana/spl-token"; import { SolanaParser } from "../src/index"; -import { ParsedIdlInstruction } from "../src/interfaces"; +import { ParsedIdlInstruction, SplToken } from "../src/interfaces"; function parseInstructionTest() { const parser = new SolanaParser([]); @@ -15,15 +14,15 @@ function parseInstructionTest() { const kp2 = Keypair.generate(); const kp3 = Keypair.generate(); const init3Ix = new TransactionInstruction({ - programId: spl.TOKEN_PROGRAM_ID, + programId: TOKEN_PROGRAM_ID, keys: [ { isSigner: false, isWritable: true, pubkey: kp1.publicKey }, { isSigner: false, isWritable: false, pubkey: kp2.publicKey }, ], - data: Buffer.concat([Buffer.from([spl.TokenInstruction.InitializeAccount3]), kp3.publicKey.toBuffer()]), + data: Buffer.concat([Buffer.from([TokenInstruction.InitializeAccount3]), kp3.publicKey.toBuffer()]), }); const parsed = parser.parseInstruction(init3Ix) as ParsedIdlInstruction; - assert.equal(parsed.args.authority.toBase58(), kp3.publicKey.toBase58()); + assert.equal(parsed.args.owner.toBase58(), kp3.publicKey.toBase58()); assert.equal(parsed.name, "initializeAccount3"); }); } diff --git a/tests/parseTransaction.test.ts b/tests/parseTransaction.test.ts index 19f44f2..b6d5ad7 100644 --- a/tests/parseTransaction.test.ts +++ b/tests/parseTransaction.test.ts @@ -2,8 +2,8 @@ import "mocha"; import assert from "assert"; -import { BN, Idl } from "@project-serum/anchor"; -import { PublicKey, Connection } from "@solana/web3.js"; +import { BN, Idl } from "@coral-xyz/anchor"; +import { PublicKey, Connection, clusterApiUrl } from "@solana/web3.js"; import { SolanaParser } from "../src"; import { ParsedAccount, ParsedIdlInstruction, ParsedInstruction } from "../src/interfaces"; @@ -51,7 +51,7 @@ function printParsedIx(parsedIx: ParsedInstruction) { function parseTransactionTest() { it("can parse jupiter tx", async () => { - const rpcConnection = new Connection("https://jupiter.genesysgo.net"); + const rpcConnection = new Connection(clusterApiUrl("mainnet-beta")); const txParser = new SolanaParser([{ idl: JupiterIdl as unknown as Idl, programId: "JUP2jxvXaqu7NQY1GmNF4m1vodw12LVXYxbFL2uJvfo" }]); const parsed = await txParser.parseTransaction( rpcConnection,