"use strict";const T=require("./platform-CCG_jgOO.js"),r=require("./unsignedTransaction-DA4tlY5u.js"),o=require("./web3-DdUeM7iQ.js"),c=new r.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),b=new r.PublicKey("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"),f=new r.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"),O=new r.PublicKey("So11111111111111111111111111111111111111112");new r.PublicKey("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");class u extends Error{constructor(e){super(e)}}class g extends u{constructor(){super(...arguments),this.name="TokenAccountNotFoundError"}}class K extends u{constructor(){super(...arguments),this.name="TokenInvalidAccountError"}}class E extends u{constructor(){super(...arguments),this.name="TokenInvalidAccountOwnerError"}}class l extends u{constructor(){super(...arguments),this.name="TokenInvalidAccountSizeError"}}class N extends u{constructor(){super(...arguments),this.name="TokenInvalidMintError"}}class h extends u{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}}class v extends u{constructor(){super(...arguments),this.name="TokenTransferHookAccountNotFound"}}class x extends u{constructor(){super(...arguments),this.name="TokenTransferHookInvalidSeed"}}class z extends u{constructor(){super(...arguments),this.name="TokenTransferHookAccountDataNotFound"}}var d;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Mint=1]="Mint",t[t.Account=2]="Account"})(d||(d={}));const w=1,P=r.LayoutExports.struct([r.LayoutExports.u8("m"),r.LayoutExports.u8("n"),o.bool("isInitialized"),o.publicKey("signer1"),o.publicKey("signer2"),o.publicKey("signer3"),o.publicKey("signer4"),o.publicKey("signer5"),o.publicKey("signer6"),o.publicKey("signer7"),o.publicKey("signer8"),o.publicKey("signer9"),o.publicKey("signer10"),o.publicKey("signer11")]),k=P.span;var A;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initialized=1]="Initialized",t[t.Frozen=2]="Frozen"})(A||(A={}));const m=r.LayoutExports.struct([o.publicKey("mint"),o.publicKey("owner"),o.u64("amount"),r.LayoutExports.u32("delegateOption"),o.publicKey("delegate"),r.LayoutExports.u8("state"),r.LayoutExports.u32("isNativeOption"),o.u64("isNative"),o.u64("delegatedAmount"),r.LayoutExports.u32("closeAuthorityOption"),o.publicKey("closeAuthority")]),a=m.span;async function _(t,e,s,n=c){const i=await t.getAccountInfo(e,s);return M(e,i,n)}function M(t,e,s=c){if(!e)throw new g;if(!e.owner.equals(s))throw new E;if(e.data.length<a)throw new l;const n=m.decode(e.data.slice(0,a));let i=T.Buffer.alloc(0);if(e.data.length>a){if(e.data.length===k)throw new l;if(e.data[a]!=d.Account)throw new K;i=e.data.slice(a+w)}return{address:t,mint:n.mint,owner:n.owner,amount:n.amount,delegate:n.delegateOption?n.delegate:null,delegatedAmount:n.delegatedAmount,isInitialized:n.state!==A.Uninitialized,isFrozen:n.state===A.Frozen,isNative:!!n.isNativeOption,rentExemptReserve:n.isNativeOption?n.isNative:null,closeAuthority:n.closeAuthorityOption?n.closeAuthority:null,tlvData:i}}const I=r.LayoutExports.struct([r.LayoutExports.u32("mintAuthorityOption"),o.publicKey("mintAuthority"),o.u64("supply"),r.LayoutExports.u8("decimals"),o.bool("isInitialized"),r.LayoutExports.u32("freezeAuthorityOption"),o.publicKey("freezeAuthority")]),p=I.span;async function L(t,e,s,n=c){const i=await t.getAccountInfo(e,s);return S(e,i,n)}function S(t,e,s=c){if(!e)throw new g;if(!e.owner.equals(s))throw new E;if(e.data.length<p)throw new l;const n=I.decode(e.data.slice(0,p));let i=T.Buffer.alloc(0);if(e.data.length>p){if(e.data.length<=a)throw new l;if(e.data.length===k)throw new l;if(e.data[a]!=d.Mint)throw new N;i=e.data.slice(a+w)}return{address:t,mintAuthority:n.mintAuthorityOption?n.mintAuthority:null,supply:n.supply,decimals:n.decimals,isInitialized:n.isInitialized,freezeAuthority:n.freezeAuthorityOption?n.freezeAuthority:null,tlvData:i}}async function D(t,e,s=!1,n=c,i=f){if(!s&&!r.PublicKey.isOnCurve(e.toBuffer()))throw new h;const[y]=await r.PublicKey.findProgramAddress([e.toBuffer(),n.toBuffer(),t.toBuffer()],i);return y}function B(t,e,s=!1,n=c,i=f){if(!s&&!r.PublicKey.isOnCurve(e.toBuffer()))throw new h;const[y]=r.PublicKey.findProgramAddressSync([e.toBuffer(),n.toBuffer(),t.toBuffer()],i);return y}exports.ASSOCIATED_TOKEN_PROGRAM_ID=f;exports.NATIVE_MINT=O;exports.TOKEN_2022_PROGRAM_ID=b;exports.TOKEN_PROGRAM_ID=c;exports.TokenTransferHookAccountDataNotFound=z;exports.TokenTransferHookAccountNotFound=v;exports.TokenTransferHookInvalidSeed=x;exports.getAccount=_;exports.getAssociatedTokenAddress=D;exports.getAssociatedTokenAddressSync=B;exports.getMint=L;
