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