@ledgerhq/device-signer-kit-solana 0.0.0-patch-transactionInspector-20250910142959 → 0.0.0-patch-transactionInspector-20250912131813

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";var p=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var P=(i,e)=>{for(var t in e)p(i,t,{get:e[t],enumerable:!0})},S=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of x(e))!T.call(i,n)&&n!==t&&p(i,n,{get:()=>e[n],enumerable:!(r=b(e,n))||r.enumerable});return i};var h=i=>S(p({},"__esModule",{value:!0}),i);var D={};P(D,{SolanaTransactionTypes:()=>g,TransactionInspector:()=>k});module.exports=h(D);var d=require("@solana/web3.js"),I=require("buffer"),f=require("../../app-binder/services/utils/transactionDecoders"),g=(t=>(t.STANDARD="Standard",t.SPL="SPL",t))(g||{});class k{constructor(e){this.rawTransactionBytes=e}inspectTransactionType(){try{const e=this.normaliseMessage(this.rawTransactionBytes);for(const t of e.compiledInstructions){const r=e.allKeys[t.programIdIndex];if(!r)continue;const n=t.accountKeyIndexes.map(a=>e.allKeys[a]).filter(a=>!!a);if(n.length!==t.accountKeyIndexes.length)continue;const u=new d.TransactionInstruction({programId:r,keys:n.map(a=>({pubkey:a,isSigner:!1,isWritable:!1})),data:I.Buffer.from(t.data)}),y={programId:r,ixMeta:t,message:e,instruction:u};for(const a of f.DECODERS){if(!a.when(y))continue;const m=a.decode(y);if(m)return{transactionType:"SPL",data:m}}}return{transactionType:"Standard",data:{}}}catch{return{transactionType:"Standard",data:{}}}}normaliseMessage(e){const t=this.tryDeserialiseVersioned(e);if(t){const s=t.message;let o;return typeof s.getAccountKeys=="function"?o=s.getAccountKeys().keySegments().flat():o=[...s.staticAccountKeys],{compiledInstructions:s.compiledInstructions.map(c=>{const K=c,A=Array.from(K.accounts??c.accountKeyIndexes??[]);let l;return c.data instanceof Uint8Array?l=c.data:typeof c.data=="string"?l=I.Buffer.from(c.data,"base64"):l=Uint8Array.from(c.data??[]),{programIdIndex:c.programIdIndex,accountKeyIndexes:A,data:l}}),allKeys:o}}const r=d.Transaction.from(e),n=new Map,u=s=>{if(!s)return;const o=s.toBase58();n.has(o)||n.set(o,s)};u(r.feePayer??null);for(const s of r.instructions){u(s.programId);for(const o of s.keys)u(o.pubkey)}const y=Array.from(n.values()),a=new Map(y.map((s,o)=>[s.toBase58(),o]));return{compiledInstructions:r.instructions.map(s=>({programIdIndex:a.get(s.programId.toBase58())??-1,accountKeyIndexes:s.keys.map(o=>a.get(o.pubkey.toBase58())??-1),data:s.data})),allKeys:y}}tryDeserialiseVersioned(e){try{return d.VersionedTransaction.deserialize(e)}catch{try{return{message:d.VersionedMessage.deserialize(e)}}catch{return null}}}}0&&(module.exports={SolanaTransactionTypes,TransactionInspector});
1
+ "use strict";var I=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var S=(n,e)=>{for(var t in e)I(n,t,{get:e[t],enumerable:!0})},L=(n,e,t,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of x(e))!k.call(n,o)&&o!==t&&I(n,o,{get:()=>e[o],enumerable:!(a=P(e,o))||a.enumerable});return n};var M=n=>L(I({},"__esModule",{value:!0}),n);var C={};S(C,{SolanaTransactionTypes:()=>A,TransactionInspector:()=>w});module.exports=M(C);var m=require("@solana/spl-token"),i=require("@solana/web3.js"),K=require("buffer"),g=require("../../app-binder/services/utils/transactionDecoders"),A=(t=>(t.STANDARD="Standard",t.SPL="SPL",t))(A||{});const D="http://api.mainnet-beta.solana.com/",R=new i.Connection(D,{commitment:"confirmed"}),h=n=>!!n&&(n.equals(m.ASSOCIATED_TOKEN_PROGRAM_ID)||n.equals(m.TOKEN_PROGRAM_ID)||n.equals(m.TOKEN_2022_PROGRAM_ID));class w{constructor(e){this.rawTransactionBytes=e}async inspectTransactionType(){try{const e=await this.normaliseMessage(this.rawTransactionBytes);for(const t of e.compiledInstructions){const a=e.allKeys[t.programIdIndex];if(!a)continue;const o=t.accountKeyIndexes.map(r=>e.allKeys[r]).filter(r=>!!r),y=new i.TransactionInstruction({programId:a,keys:o.map(r=>({pubkey:r,isSigner:!1,isWritable:!1})),data:K.Buffer.from(t.data)}),u={programId:a,ixMeta:t,message:e,instruction:y};for(const r of g.DECODERS){if(!r.when(u))continue;const l=r.decode(u);if(l)return{transactionType:"SPL",data:l}}if(h(a))return{transactionType:"SPL",data:{}}}return{transactionType:"Standard",data:{}}}catch{return{transactionType:"Standard",data:{}}}}async normaliseMessage(e){const t=this.tryDeserialiseVersioned(e);if(t){const s=t.message,c=await N(s);let f;return typeof s.getAccountKeys=="function"?f=s.getAccountKeys(c?{accountKeysFromLookups:c}:void 0).keySegments().flat():f=[...s.staticAccountKeys],{compiledInstructions:s.compiledInstructions.map(d=>{const b=d,T=Array.from(b.accounts??d.accountKeyIndexes??[]);let p;return d.data instanceof Uint8Array?p=d.data:typeof d.data=="string"?p=K.Buffer.from(d.data,"base64"):p=Uint8Array.from(d.data??[]),{programIdIndex:d.programIdIndex,accountKeyIndexes:T,data:p}}),allKeys:f}}const a=i.Transaction.from(e),o=new Map,y=s=>{if(!s)return;const c=s.toBase58();o.has(c)||o.set(c,s)};y(a.feePayer??null);for(const s of a.instructions){y(s.programId);for(const c of s.keys)y(c.pubkey)}const u=Array.from(o.values()),r=new Map(u.map((s,c)=>[s.toBase58(),c]));return{compiledInstructions:a.instructions.map(s=>({programIdIndex:r.get(s.programId.toBase58())??-1,accountKeyIndexes:s.keys.map(c=>r.get(c.pubkey.toBase58())??-1),data:s.data})),allKeys:u}}tryDeserialiseVersioned(e){try{return i.VersionedTransaction.deserialize(e)}catch{try{return{message:i.VersionedMessage.deserialize(e)}}catch{return null}}}}async function N(n){const e=n.addressTableLookups??[];if(!e.length)return;const t=[],a=[];return await Promise.all(e.map(async o=>{const u=(await R.getAddressLookupTable(o.accountKey)).value;if(!u)return;const r=u.state.addresses;for(const l of o.writableIndexes??[]){const s=r[l];s&&t.push(s)}for(const l of o.readonlyIndexes??[]){const s=r[l];s&&a.push(s)}})),{writable:t,readonly:a}}0&&(module.exports={SolanaTransactionTypes,TransactionInspector});
2
2
  //# sourceMappingURL=TransactionInspector.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/app-binder/services/TransactionInspector.ts"],
4
- "sourcesContent": ["import {\n type PublicKey,\n Transaction,\n TransactionInstruction,\n VersionedMessage,\n VersionedTransaction,\n} from \"@solana/web3.js\";\nimport { Buffer } from \"buffer\";\n\nimport {\n DECODERS,\n type IxContext,\n type TxInspectorResult,\n} from \"@internal/app-binder/services/utils/transactionDecoders\";\n\nexport enum SolanaTransactionTypes {\n STANDARD = \"Standard\",\n SPL = \"SPL\",\n}\n\nexport type NormalizedCompiledIx = {\n programIdIndex: number;\n accountKeyIndexes: number[];\n data: Uint8Array;\n};\n\nexport type NormalizedMessage = {\n compiledInstructions: NormalizedCompiledIx[];\n allKeys: PublicKey[];\n};\n\ntype LoadedAddresses = { writable: PublicKey[]; readonly: PublicKey[] };\n\nexport class TransactionInspector {\n constructor(private readonly rawTransactionBytes: Uint8Array) {}\n\n public inspectTransactionType(): TxInspectorResult {\n try {\n const message = this.normaliseMessage(this.rawTransactionBytes);\n\n for (const ixMeta of message.compiledInstructions) {\n const programId = message.allKeys[ixMeta.programIdIndex];\n if (!programId) continue;\n\n // resolve all referenced keys, if any are missing skip this\n const resolvedKeys = ixMeta.accountKeyIndexes\n .map((i) => message.allKeys[i])\n .filter((key): key is PublicKey => !!key);\n\n if (resolvedKeys.length !== ixMeta.accountKeyIndexes.length) {\n // unresolved keys, can't decode reliably\n continue;\n }\n\n const instruction = new TransactionInstruction({\n programId,\n keys: resolvedKeys.map((key) => ({\n pubkey: key,\n isSigner: false,\n isWritable: false,\n })),\n data: Buffer.from(ixMeta.data),\n });\n\n const ctx: IxContext = { programId, ixMeta, message, instruction };\n\n for (const decoder of DECODERS) {\n if (!decoder.when(ctx)) continue;\n const data = decoder.decode(ctx);\n if (data) {\n return { transactionType: SolanaTransactionTypes.SPL, data };\n }\n }\n }\n\n return { transactionType: SolanaTransactionTypes.STANDARD, data: {} };\n } catch {\n return { transactionType: SolanaTransactionTypes.STANDARD, data: {} };\n }\n }\n\n /**\n * Normalise any tx (legacy or v0) into { compiledInstructions, allKeys }.\n * If LUT accounts are provided, looked-up keys are included in allKeys.\n */\n private normaliseMessage(rawBytes: Uint8Array): NormalizedMessage {\n const versionedTX = this.tryDeserialiseVersioned(rawBytes);\n if (versionedTX) {\n const msg = versionedTX.message as VersionedMessage & {\n getAccountKeys?: (options?: {\n accountKeysFromLookups?: LoadedAddresses;\n }) => {\n staticAccountKeys: PublicKey[];\n accountKeysFromLookups?: LoadedAddresses;\n keySegments: () => PublicKey[][];\n };\n compiledInstructions: Array<{\n programIdIndex: number;\n accountKeyIndexes?: number[]; // legacy field name\n accounts?: number[]; // v0 field name\n data: Uint8Array | string | number[];\n }>;\n staticAccountKeys: PublicKey[];\n };\n\n // build the full key array in the exact index order used by compiledInstructions\n let allKeys: PublicKey[];\n if (typeof msg.getAccountKeys === \"function\") {\n const messageAccountKeys = msg.getAccountKeys();\n allKeys = messageAccountKeys.keySegments().flat();\n } else {\n // fallback to statics\n allKeys = [...msg.staticAccountKeys];\n }\n\n const compiledInstructions: NormalizedCompiledIx[] =\n msg.compiledInstructions.map((ix) => {\n // prefer v0 `accounts`, fall back to legacy `accountKeyIndexes`\n const ixWithAccounts = ix as typeof ix & { accounts?: number[] };\n const accountKeyIndexes = Array.from(\n ixWithAccounts.accounts ?? ix.accountKeyIndexes ?? [],\n ) as number[];\n\n // normalise data\n let data: Uint8Array;\n if (ix.data instanceof Uint8Array) {\n data = ix.data;\n } else if (typeof ix.data === \"string\") {\n // v0 encodes instruction data as base64 strings\n data = Buffer.from(ix.data, \"base64\");\n } else {\n data = Uint8Array.from(ix.data ?? []);\n }\n\n return {\n programIdIndex: ix.programIdIndex,\n accountKeyIndexes,\n data,\n };\n });\n\n return { compiledInstructions, allKeys };\n }\n\n // legacy fallback\n const legacy = Transaction.from(rawBytes);\n\n const allKeyMap = new Map<string, PublicKey>();\n const add = (pubkey?: PublicKey | null) => {\n if (!pubkey) return;\n const key = pubkey.toBase58();\n if (!allKeyMap.has(key)) allKeyMap.set(key, pubkey);\n };\n\n add(legacy.feePayer ?? null);\n for (const ix of legacy.instructions) {\n add(ix.programId);\n for (const key of ix.keys) add(key.pubkey);\n }\n const allKeys = Array.from(allKeyMap.values());\n const indexByB58 = new Map(allKeys.map((pk, i) => [pk.toBase58(), i]));\n\n const compiledInstructions: NormalizedCompiledIx[] =\n legacy.instructions.map((ix) => ({\n programIdIndex: indexByB58.get(ix.programId.toBase58()) ?? -1,\n accountKeyIndexes: ix.keys.map(\n (key) => indexByB58.get(key.pubkey.toBase58()) ?? -1,\n ),\n data: ix.data,\n }));\n\n return { compiledInstructions, allKeys };\n }\n\n private tryDeserialiseVersioned(\n rawBytes: Uint8Array,\n ): VersionedTransaction | null {\n try {\n return VersionedTransaction.deserialize(rawBytes);\n } catch {\n try {\n const msg = VersionedMessage.deserialize(rawBytes);\n // wrap in a dummy VersionedTransaction-like shape just for uniform handling\n return { message: msg } as VersionedTransaction;\n } catch {\n return null;\n }\n }\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4BAAAE,EAAA,yBAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAMO,2BACPC,EAAuB,kBAEvBC,EAIO,mEAEKL,OACVA,EAAA,SAAW,WACXA,EAAA,IAAM,MAFIA,OAAA,IAkBL,MAAMC,CAAqB,CAChC,YAA6BK,EAAiC,CAAjC,yBAAAA,CAAkC,CAExD,wBAA4C,CACjD,GAAI,CACF,MAAMC,EAAU,KAAK,iBAAi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AQ,CACN,OAAO,IACT,CACF,CACF,CACF",
6
- "names": ["TransactionInspector_exports", "__export", "SolanaTransactionTypes", "TransactionInspector", "__toCommonJS", "import_web3", "import_buffer", "import_transactionDecoders", "rawTransactionBytes", "message", "ixMeta", "programId", "resolvedKeys", "i", "key", "instruction", "ctx", "decoder", "data", "rawBytes", "versionedTX", "msg", "allKeys", "ix", "ixWithAccounts", "accountKeyIndexes", "legacy", "allKeyMap", "add", "pubkey", "indexByB58", "pk"]
4
+ "sourcesContent": ["import {\n ASSOCIATED_TOKEN_PROGRAM_ID,\n TOKEN_2022_PROGRAM_ID,\n TOKEN_PROGRAM_ID,\n} from \"@solana/spl-token\";\nimport {\n Connection, // runtime import so we can instantiate it\n type PublicKey,\n Transaction,\n TransactionInstruction,\n VersionedMessage,\n VersionedTransaction,\n} from \"@solana/web3.js\";\nimport { Buffer } from \"buffer\";\n\nimport {\n DECODERS,\n type IxContext,\n type TxInspectorResult,\n} from \"@internal/app-binder/services/utils/transactionDecoders\";\n\nexport enum SolanaTransactionTypes {\n STANDARD = \"Standard\",\n SPL = \"SPL\",\n}\n\nexport type NormalizedCompiledIx = {\n programIdIndex: number;\n accountKeyIndexes: number[];\n data: Uint8Array;\n};\n\nexport type NormalizedMessage = {\n compiledInstructions: NormalizedCompiledIx[];\n allKeys: PublicKey[];\n};\n\ntype LoadedAddresses = { writable: PublicKey[]; readonly: PublicKey[] };\n\nconst RPC_URL = \"http://api.mainnet-beta.solana.com/\";\n\nconst defaultConnection = new Connection(RPC_URL, { commitment: \"confirmed\" });\n\nconst isSPLProgramId = (pid: PublicKey | undefined) =>\n !!pid &&\n (pid.equals(ASSOCIATED_TOKEN_PROGRAM_ID) ||\n pid.equals(TOKEN_PROGRAM_ID) ||\n pid.equals(TOKEN_2022_PROGRAM_ID));\n\nexport class TransactionInspector {\n constructor(private readonly rawTransactionBytes: Uint8Array) {}\n\n public async inspectTransactionType(): Promise<TxInspectorResult> {\n try {\n const message = await this.normaliseMessage(this.rawTransactionBytes);\n\n for (const ixMeta of message.compiledInstructions) {\n const programId = message.allKeys[ixMeta.programIdIndex];\n if (!programId) continue;\n\n const resolvedKeys = ixMeta.accountKeyIndexes\n .map((i) => message.allKeys[i])\n .filter((key): key is PublicKey => !!key);\n\n // Build an instruction even with partial keys; decoders handle missing fields gracefully.\n const instruction = new TransactionInstruction({\n programId,\n keys: resolvedKeys.map((key) => ({\n pubkey: key,\n isSigner: false,\n isWritable: false,\n })),\n data: Buffer.from(ixMeta.data),\n });\n\n const ctx: IxContext = { programId, ixMeta, message, instruction };\n\n for (const decoder of DECODERS) {\n if (!decoder.when(ctx)) continue;\n const data = decoder.decode(ctx);\n if (data) {\n return { transactionType: SolanaTransactionTypes.SPL, data };\n }\n }\n\n if (isSPLProgramId(programId)) {\n return { transactionType: SolanaTransactionTypes.SPL, data: {} };\n }\n }\n\n return { transactionType: SolanaTransactionTypes.STANDARD, data: {} };\n } catch {\n return { transactionType: SolanaTransactionTypes.STANDARD, data: {} };\n }\n }\n\n /**\n * Normalise any tx (legacy or v0) into { compiledInstructions, allKeys }.\n * For v0, we auto-fetch looked-up addresses from ALT(s) via the baked-in connection.\n */\n private async normaliseMessage(\n rawBytes: Uint8Array,\n ): Promise<NormalizedMessage> {\n const versionedTX = this.tryDeserialiseVersioned(rawBytes);\n if (versionedTX) {\n const msg = versionedTX.message as VersionedMessage & {\n getAccountKeys?: (options?: {\n accountKeysFromLookups?: LoadedAddresses;\n }) => {\n staticAccountKeys: PublicKey[];\n accountKeysFromLookups?: LoadedAddresses;\n keySegments: () => PublicKey[][];\n };\n compiledInstructions: Array<{\n programIdIndex: number;\n accountKeyIndexes?: number[]; // legacy field name\n accounts?: number[]; // v0 field name\n data: Uint8Array | string | number[];\n }>;\n staticAccountKeys: PublicKey[];\n };\n\n const lookedUp = await resolveLookedUpAddressesFromMessage(msg);\n\n let allKeys: PublicKey[];\n if (typeof msg.getAccountKeys === \"function\") {\n const messageAccountKeys = msg.getAccountKeys(\n lookedUp ? { accountKeysFromLookups: lookedUp } : undefined,\n );\n allKeys = messageAccountKeys.keySegments().flat();\n } else {\n allKeys = [...msg.staticAccountKeys];\n }\n\n const compiledInstructions: NormalizedCompiledIx[] =\n msg.compiledInstructions.map((ix) => {\n const ixWithAccounts = ix as typeof ix & { accounts?: number[] };\n const accountKeyIndexes = Array.from(\n ixWithAccounts.accounts ?? ix.accountKeyIndexes ?? [],\n ) as number[];\n\n let data: Uint8Array;\n if (ix.data instanceof Uint8Array) {\n data = ix.data;\n } else if (typeof ix.data === \"string\") {\n data = Buffer.from(ix.data, \"base64\"); // v0 encodes instruction data as base64\n } else {\n data = Uint8Array.from(ix.data ?? []);\n }\n\n return {\n programIdIndex: ix.programIdIndex,\n accountKeyIndexes,\n data,\n };\n });\n\n return { compiledInstructions, allKeys };\n }\n\n // Legacy (no ALTs)\n const legacy = Transaction.from(rawBytes);\n\n const allKeyMap = new Map<string, PublicKey>();\n const add = (pubkey?: PublicKey | null) => {\n if (!pubkey) return;\n const key = pubkey.toBase58();\n if (!allKeyMap.has(key)) allKeyMap.set(key, pubkey);\n };\n\n add(legacy.feePayer ?? null);\n for (const ix of legacy.instructions) {\n add(ix.programId);\n for (const key of ix.keys) add(key.pubkey);\n }\n const allKeys = Array.from(allKeyMap.values());\n const indexByB58 = new Map(allKeys.map((pk, i) => [pk.toBase58(), i]));\n\n const compiledInstructions: NormalizedCompiledIx[] =\n legacy.instructions.map((ix) => ({\n programIdIndex: indexByB58.get(ix.programId.toBase58()) ?? -1,\n accountKeyIndexes: ix.keys.map(\n (key) => indexByB58.get(key.pubkey.toBase58()) ?? -1,\n ),\n data: ix.data,\n }));\n\n return { compiledInstructions, allKeys };\n }\n\n private tryDeserialiseVersioned(\n rawBytes: Uint8Array,\n ): VersionedTransaction | null {\n try {\n return VersionedTransaction.deserialize(rawBytes);\n } catch {\n try {\n const msg = VersionedMessage.deserialize(rawBytes);\n // Wrap in a dummy VersionedTransaction-like shape just for uniform handling\n return { message: msg } as VersionedTransaction;\n } catch {\n return null;\n }\n }\n }\n}\n\n/** Internal: fetch looked-up addresses for a VersionedMessage via the baked-in connection. */\nasync function resolveLookedUpAddressesFromMessage(\n msg: VersionedMessage,\n): Promise<LoadedAddresses | undefined> {\n const lookups = msg.addressTableLookups ?? [];\n if (!lookups.length) return;\n\n const writable: PublicKey[] = [];\n const readonly: PublicKey[] = [];\n\n await Promise.all(\n lookups.map(async (lu) => {\n const res = await defaultConnection.getAddressLookupTable(lu.accountKey);\n const table = res.value;\n if (!table) return;\n const addrs = table.state.addresses;\n\n for (const i of lu.writableIndexes ?? []) {\n const pk = addrs[i];\n if (pk) writable.push(pk);\n }\n for (const i of lu.readonlyIndexes ?? []) {\n const pk = addrs[i];\n if (pk) readonly.push(pk);\n }\n }),\n );\n\n return { writable, readonly };\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4BAAAE,EAAA,yBAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAIO,6BACPC,EAOO,2BACPC,EAAuB,kBAEvBC,EAIO,mEAEKN,OACVA,EAAA,SAAW,WACXA,EAAA,IAAM,MAFIA,OAAA,IAkBZ,MAAMO,EAAU,sCAEVC,EAAoB,IAAI,aAAWD,EAAS,CAAE,WAAY,WAAY,CAAC,EAEvEE,EAAkBC,GACtB,CAAC,CAACA,IACDA,EAAI,OAAO,6BAA2B,GACrCA,EAAI,OAAO,kBAAgB,GAC3BA,EAAI,OAAO,uBAAqB,GAE7B,MAAMT,CAAqB,CAChC,YAA6BU,EAAiC,CAAjC,yBAAAA,CAAkC,CAE/D,MAAa,wBAAqD,CAChE,GAAI,CACF,MAAMC,EAAU,MAAM,KAAK,iBAAiB,KAAK,mBAAmB,EAEpE,UAAWC,KAAUD,EAAQ,qBAAsB,CACjD,MAAME,EAAYF,EAAQ,QAAQC,EAAO,cAAc,EACvD,GAAI,CAACC,EAAW,SAEhB,MAAMC,EAAeF,EAAO,kBACzB,IAAKG,GAAMJ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C,CACtC,MAAMa,EAAUb,EAAI,qBAAuB,CAAC,EAC5C,GAAI,CAACa,EAAQ,OAAQ,OAErB,MAAMC,EAAwB,CAAC,EACzBC,EAAwB,CAAC,EAE/B,aAAM,QAAQ,IACZF,EAAQ,IAAI,MAAOG,GAAO,CAExB,MAAMC,GADM,MAAMjC,EAAkB,sBAAsBgC,EAAG,UAAU,GACrD,MAClB,GAAI,CAACC,EAAO,OACZ,MAAMC,EAAQD,EAAM,MAAM,UAE1B,UAAWzB,KAAKwB,EAAG,iBAAmB,CAAC,EAAG,CACxC,MAAMJ,EAAKM,EAAM1B,CAAC,EACdoB,GAAIE,EAAS,KAAKF,CAAE,CAC1B,CACA,UAAWpB,KAAKwB,EAAG,iBAAmB,CAAC,EAAG,CACxC,MAAMJ,EAAKM,EAAM1B,CAAC,EACdoB,GAAIG,EAAS,KAAKH,CAAE,CAC1B,CACF,CAAC,CACH,EAEO,CAAE,SAAAE,EAAU,SAAAC,CAAS,CAC9B",
6
+ "names": ["TransactionInspector_exports", "__export", "SolanaTransactionTypes", "TransactionInspector", "__toCommonJS", "import_spl_token", "import_web3", "import_buffer", "import_transactionDecoders", "RPC_URL", "defaultConnection", "isSPLProgramId", "pid", "rawTransactionBytes", "message", "ixMeta", "programId", "resolvedKeys", "i", "key", "instruction", "ctx", "decoder", "data", "rawBytes", "versionedTX", "msg", "lookedUp", "resolveLookedUpAddressesFromMessage", "allKeys", "ix", "ixWithAccounts", "accountKeyIndexes", "legacy", "allKeyMap", "add", "pubkey", "indexByB58", "pk", "lookups", "writable", "readonly", "lu", "table", "addrs"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var T=Object.create;var d=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty;var m=(e,t,r,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of A(t))!g.call(e,n)&&n!==r&&d(e,n,{get:()=>t[n],enumerable:!(c=b(t,n))||c.enumerable});return e};var K=(e,t,r)=>(r=e!=null?T(f(e)):{},m(t||!e||!e.__esModule?d(r,"default",{value:e,enumerable:!0}):r,e));var p=require("@solana/spl-token"),a=require("@solana/web3.js"),u=K(require("bs58")),s=require("vitest"),o=require("./TransactionInspector");const l=u.default.encode(new Uint8Array(32).fill(1));(0,s.describe)("TransactionInspector",()=>{(0,s.it)("falls back to STANDARD for a plain SystemProgram transfer",()=>{const e=a.Keypair.generate(),t=a.Keypair.generate().publicKey,r=new a.Transaction().add(a.SystemProgram.transfer({fromPubkey:e.publicKey,toPubkey:t,lamports:1e3}));r.recentBlockhash=l,r.feePayer=e.publicKey,r.sign(e);const c=r.serialize(),n=new o.TransactionInspector(c).inspectTransactionType();(0,s.expect)(n.transactionType).toBe(o.SolanaTransactionTypes.STANDARD),(0,s.expect)(n.data).toEqual({})}),(0,s.it)("detects an SPL Transfer and returns the destination address",()=>{const e=a.Keypair.generate(),t=a.Keypair.generate().publicKey,r=a.Keypair.generate().publicKey,c=e.publicKey,n=new a.Transaction().add((0,p.createTransferInstruction)(t,r,c,42n,[],p.TOKEN_PROGRAM_ID));n.recentBlockhash=l,n.feePayer=e.publicKey,n.sign(e);const i=new o.TransactionInspector(n.serialize()).inspectTransactionType();(0,s.expect)(i.transactionType).toBe(o.SolanaTransactionTypes.SPL),(0,s.expect)(i.data.tokenAddress).toBe(r.toBase58())}),(0,s.it)("detects an SPL TransferChecked and returns the destination address",()=>{const e=a.Keypair.generate(),t=a.Keypair.generate().publicKey,r=a.Keypair.generate().publicKey,c=a.Keypair.generate().publicKey,n=e.publicKey,i=new a.Transaction().add((0,p.createTransferCheckedInstruction)(r,t,c,n,123n,0,[],p.TOKEN_PROGRAM_ID));i.recentBlockhash=l,i.feePayer=e.publicKey,i.sign(e);const y=new o.TransactionInspector(i.serialize()).inspectTransactionType();(0,s.expect)(y.transactionType).toBe(o.SolanaTransactionTypes.SPL),(0,s.expect)(y.data.tokenAddress).toBe(c.toBase58())}),(0,s.it)("detects an SPL InitializeAccount and returns the new ATA and mint",()=>{const e=a.Keypair.generate(),t=a.Keypair.generate().publicKey,r=a.Keypair.generate().publicKey,c=e.publicKey,n=new a.Transaction().add((0,p.createInitializeAccountInstruction)(r,t,c,p.TOKEN_PROGRAM_ID));n.recentBlockhash=l,n.feePayer=e.publicKey,n.sign(e);const i=new o.TransactionInspector(n.serialize()).inspectTransactionType();(0,s.expect)(i.transactionType).toBe(o.SolanaTransactionTypes.SPL),(0,s.expect)(i.data.createATA).toEqual({address:r.toBase58(),mintAddress:t.toBase58()})}),(0,s.it)("falls back to STANDARD if the payload is unparseable",()=>{const e=new Uint8Array([0,1,2,3,4,5]),t=new o.TransactionInspector(e).inspectTransactionType();(0,s.expect)(t.transactionType).toBe(o.SolanaTransactionTypes.STANDARD),(0,s.expect)(t.data).toEqual({})})});
1
+ "use strict";
2
2
  //# sourceMappingURL=TransactionInspector.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../../../src/internal/app-binder/services/TransactionInspector.test.ts"],
4
- "sourcesContent": ["import {\n createInitializeAccountInstruction,\n createTransferCheckedInstruction,\n createTransferInstruction,\n TOKEN_PROGRAM_ID,\n} from \"@solana/spl-token\";\nimport { Keypair, SystemProgram, Transaction } from \"@solana/web3.js\";\nimport bs58 from \"bs58\";\nimport { describe, expect, it } from \"vitest\";\n\nimport {\n SolanaTransactionTypes,\n TransactionInspector,\n} from \"./TransactionInspector\";\n\nconst DUMMY_BLOCKHASH = bs58.encode(new Uint8Array(32).fill(1));\n\ndescribe(\"TransactionInspector\", () => {\n it(\"falls back to STANDARD for a plain SystemProgram transfer\", () => {\n const payer = Keypair.generate();\n const dest = Keypair.generate().publicKey;\n\n const tx = new Transaction().add(\n SystemProgram.transfer({\n fromPubkey: payer.publicKey,\n toPubkey: dest,\n lamports: 1_000,\n }),\n );\n tx.recentBlockhash = DUMMY_BLOCKHASH;\n tx.feePayer = payer.publicKey;\n tx.sign(payer);\n\n const raw = tx.serialize();\n const result = new TransactionInspector(raw).inspectTransactionType();\n\n expect(result.transactionType).toBe(SolanaTransactionTypes.STANDARD);\n expect(result.data).toEqual({});\n });\n\n it(\"detects an SPL Transfer and returns the destination address\", () => {\n const payer = Keypair.generate();\n const source = Keypair.generate().publicKey;\n const destination = Keypair.generate().publicKey;\n const owner = payer.publicKey;\n\n const tx = new Transaction().add(\n createTransferInstruction(\n source,\n destination,\n owner,\n 42n,\n [],\n TOKEN_PROGRAM_ID,\n ),\n );\n tx.recentBlockhash = DUMMY_BLOCKHASH;\n tx.feePayer = payer.publicKey;\n tx.sign(payer);\n\n const result = new TransactionInspector(\n tx.serialize(),\n ).inspectTransactionType();\n\n expect(result.transactionType).toBe(SolanaTransactionTypes.SPL);\n expect(result.data.tokenAddress).toBe(destination.toBase58());\n });\n\n it(\"detects an SPL TransferChecked and returns the destination address\", () => {\n const payer = Keypair.generate();\n const mint = Keypair.generate().publicKey;\n const source = Keypair.generate().publicKey;\n const destination = Keypair.generate().publicKey;\n const owner = payer.publicKey;\n\n const tx = new Transaction().add(\n createTransferCheckedInstruction(\n source,\n mint,\n destination,\n owner,\n 123n,\n 0,\n [],\n TOKEN_PROGRAM_ID,\n ),\n );\n tx.recentBlockhash = DUMMY_BLOCKHASH;\n tx.feePayer = payer.publicKey;\n tx.sign(payer);\n\n const result = new TransactionInspector(\n tx.serialize(),\n ).inspectTransactionType();\n\n expect(result.transactionType).toBe(SolanaTransactionTypes.SPL);\n expect(result.data.tokenAddress).toBe(destination.toBase58());\n });\n\n it(\"detects an SPL InitializeAccount and returns the new ATA and mint\", () => {\n const payer = Keypair.generate();\n const mint = Keypair.generate().publicKey;\n const newAccount = Keypair.generate().publicKey;\n const owner = payer.publicKey;\n\n const tx = new Transaction().add(\n createInitializeAccountInstruction(\n newAccount,\n mint,\n owner,\n TOKEN_PROGRAM_ID,\n ),\n );\n tx.recentBlockhash = DUMMY_BLOCKHASH;\n tx.feePayer = payer.publicKey;\n tx.sign(payer);\n\n const result = new TransactionInspector(\n tx.serialize(),\n ).inspectTransactionType();\n\n expect(result.transactionType).toBe(SolanaTransactionTypes.SPL);\n expect(result.data.createATA).toEqual({\n address: newAccount.toBase58(),\n mintAddress: mint.toBase58(),\n });\n });\n\n it(\"falls back to STANDARD if the payload is unparseable\", () => {\n const garbage = new Uint8Array([0, 1, 2, 3, 4, 5]);\n const result = new TransactionInspector(garbage).inspectTransactionType();\n\n expect(result.transactionType).toBe(SolanaTransactionTypes.STANDARD);\n expect(result.data).toEqual({});\n });\n});\n"],
5
- "mappings": "wdAAA,IAAAA,EAKO,6BACPC,EAAoD,2BACpDC,EAAiB,mBACjBC,EAAqC,kBAErCC,EAGO,kCAEP,MAAMC,EAAkB,EAAAC,QAAK,OAAO,IAAI,WAAW,EAAE,EAAE,KAAK,CAAC,CAAC,KAE9D,YAAS,uBAAwB,IAAM,IACrC,MAAG,4DAA6D,IAAM,CACpE,MAAMC,EAAQ,UAAQ,SAAS,EACzBC,EAAO,UAAQ,SAAS,EAAE,UAE1BC,EAAK,IAAI,cAAY,EAAE,IAC3B,gBAAc,SAAS,CACrB,WAAYF,EAAM,UAClB,SAAUC,EACV,SAAU,GACZ,CAAC,CACH,EACAC,EAAG,gBAAkBJ,EACrBI,EAAG,SAAWF,EAAM,UACpBE,EAAG,KAAKF,CAAK,EAEb,MAAMG,EAAMD,EAAG,UAAU,EACnBE,EAAS,IAAI,uBAAqBD,CAAG,EAAE,uBAAuB,KAEpE,UAAOC,EAAO,eAAe,EAAE,KAAK,yBAAuB,QAAQ,KACnE,UAAOA,EAAO,IAAI,EAAE,QAAQ,CAAC,CAAC,CAChC,CAAC,KAED,MAAG,8DAA+D,IAAM,CACtE,MAAMJ,EAAQ,UAAQ,SAAS,EACzBK,EAAS,UAAQ,SAAS,EAAE,UAC5BC,EAAc,UAAQ,SAAS,EAAE,UACjCC,EAAQP,EAAM,UAEdE,EAAK,IAAI,cAAY,EAAE,OAC3B,6BACEG,EACAC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AAOE,EAAO,eAAe,EAAE,KAAK,yBAAuB,GAAG,KAC9D,UAAOA,EAAO,KAAK,SAAS,EAAE,QAAQ,CACpC,QAASK,EAAW,SAAS,EAC7B,YAAaD,EAAK,SAAS,CAC7B,CAAC,CACH,CAAC,KAED,MAAG,uDAAwD,IAAM,CAC/D,MAAME,EAAU,IAAI,WAAW,CAAC,EAAG,EAAG,EAAG,EAAG,EAAG,CAAC,CAAC,EAC3CN,EAAS,IAAI,uBAAqBM,CAAO,EAAE,uBAAuB,KAExE,UAAON,EAAO,eAAe,EAAE,KAAK,yBAAuB,QAAQ,KACnE,UAAOA,EAAO,IAAI,EAAE,QAAQ,CAAC,CAAC,CAChC,CAAC,CACH,CAAC",
6
- "names": ["import_spl_token", "import_web3", "import_bs58", "import_vitest", "import_TransactionInspector", "DUMMY_BLOCKHASH", "bs58", "payer", "dest", "tx", "raw", "result", "source", "destination", "owner", "mint", "newAccount", "garbage"]
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var a=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var p=(e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},A=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of k(t))!y.call(e,r)&&r!==n&&a(e,r,{get:()=>t[r],enumerable:!(o=i(t,r))||o.enumerable});return e};var m=e=>A(a({},"__esModule",{value:!0}),e);var I={};p(I,{DECODERS:()=>l});module.exports=m(I);var s=require("@solana/spl-token");const c=e=>e.equals(s.TOKEN_PROGRAM_ID)||e.equals(s.TOKEN_2022_PROGRAM_ID),d=e=>{try{return e()}catch{return null}},l=[{when:({programId:e})=>e.equals(s.ASSOCIATED_TOKEN_PROGRAM_ID),decode:({ixMeta:e,message:t})=>{const n=e.accountKeyIndexes.map(u=>t.allKeys[u]).filter(Boolean),o=n[1],r=n[3];return o&&r?{createATA:{address:o.toBase58(),mintAddress:r.toBase58()}}:null}},{when:({programId:e})=>e.equals(s.TOKEN_2022_PROGRAM_ID),decode:({instruction:e,programId:t})=>d(()=>{const{keys:{destination:n,mint:o}}=(0,s.decodeTransferCheckedWithFeeInstruction)(e,t);return{tokenAddress:n.pubkey.toBase58(),mintAddress:o.pubkey.toBase58()}})},{when:({programId:e})=>c(e),decode:({instruction:e,programId:t})=>d(()=>{const{keys:{destination:n}}=(0,s.decodeTransferInstruction)(e,t);return{tokenAddress:n.pubkey.toBase58()}})},{when:({programId:e})=>c(e),decode:({instruction:e,programId:t})=>d(()=>{const{keys:{destination:n,mint:o}}=(0,s.decodeTransferCheckedInstruction)(e,t);return{tokenAddress:n.pubkey.toBase58(),mintAddress:o.pubkey.toBase58()}})},{when:({programId:e})=>c(e),decode:({instruction:e,programId:t})=>d(()=>{const{keys:{account:n,mint:o}}=(0,s.decodeInitializeAccountInstruction)(e,t);return{createATA:{address:n.pubkey.toBase58(),mintAddress:o.pubkey.toBase58()}}})},{when:({programId:e})=>c(e),decode:({instruction:e,programId:t})=>d(()=>{const{keys:{account:n,mint:o}}=(0,s.decodeInitializeAccount2Instruction)(e,t);return{createATA:{address:n.pubkey.toBase58(),mintAddress:o.pubkey.toBase58()}}})},{when:({programId:e})=>c(e),decode:({instruction:e,programId:t})=>d(()=>{const{keys:{account:n,mint:o}}=(0,s.decodeInitializeAccount3Instruction)(e,t);return{createATA:{address:n.pubkey.toBase58(),mintAddress:o.pubkey.toBase58()}}})},{when:({programId:e})=>c(e),decode:({instruction:e,programId:t})=>d(()=>{const{keys:{account:n}}=(0,s.decodeInitializeImmutableOwnerInstruction)(e,t);return{tokenAddress:n.pubkey.toBase58()}})},{when:({programId:e})=>c(e),decode:({instruction:e,programId:t})=>d(()=>{const{keys:{account:n}}=(0,s.decodeCloseAccountInstruction)(e,t);return{tokenAddress:n.pubkey.toBase58()}})},{when:({programId:e})=>c(e),decode:({instruction:e,programId:t})=>d(()=>{const{keys:{account:n}}=(0,s.decodeSyncNativeInstruction)(e,t);return{tokenAddress:n.pubkey.toBase58()}})},{when:({programId:e})=>c(e),decode:({instruction:e,programId:t})=>d(()=>{const{keys:{account:n,mint:o}}=(0,s.decodeBurnCheckedInstruction)(e,t);return{tokenAddress:n.pubkey.toBase58(),mintAddress:o.pubkey.toBase58()}})},{when:({programId:e})=>c(e),decode:({instruction:e,programId:t})=>d(()=>{const{keys:{account:n,mint:o}}=(0,s.decodeBurnInstruction)(e,t);return{tokenAddress:n.pubkey.toBase58(),mintAddress:o.pubkey.toBase58()}})},{when:({programId:e})=>c(e),decode:({instruction:e,programId:t})=>d(()=>{const{keys:{account:n,mint:o}}=(0,s.decodeFreezeAccountInstruction)(e,t);return{tokenAddress:n.pubkey.toBase58(),mintAddress:o.pubkey.toBase58()}})},{when:({programId:e})=>c(e),decode:({instruction:e,programId:t})=>d(()=>{const{keys:{account:n,mint:o}}=(0,s.decodeThawAccountInstruction)(e,t);return{tokenAddress:n.pubkey.toBase58(),mintAddress:o.pubkey.toBase58()}})}];0&&(module.exports={DECODERS});
1
+ "use strict";var i=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var p=(e,n)=>{for(var s in n)i(e,s,{get:n[s],enumerable:!0})},m=(e,n,s,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of A(n))!l.call(e,r)&&r!==s&&i(e,r,{get:()=>n[r],enumerable:!(o=y(n,r))||o.enumerable});return e};var I=e=>m(i({},"__esModule",{value:!0}),e);var T={};p(T,{DECODERS:()=>B});module.exports=I(T);var t=require("@solana/spl-token");const c=e=>e.equals(t.TOKEN_PROGRAM_ID)||e.equals(t.TOKEN_2022_PROGRAM_ID),d=e=>{try{return e()}catch{return null}},B=[{when:({programId:e})=>e.equals(t.ASSOCIATED_TOKEN_PROGRAM_ID),decode:({ixMeta:e,message:n})=>{const s=e.accountKeyIndexes.map(u=>n.allKeys[u]).filter(Boolean),o=s[1],r=s[2],a=s[3],k=s[5];if(!o&&r&&a){const u=k?.equals(t.TOKEN_2022_PROGRAM_ID)??!1;return{createATA:{address:(0,t.getAssociatedTokenAddressSync)(a,r,!0,u?t.TOKEN_2022_PROGRAM_ID:t.TOKEN_PROGRAM_ID,t.ASSOCIATED_TOKEN_PROGRAM_ID).toBase58(),mintAddress:a.toBase58()}}}return o&&a?{createATA:{address:o.toBase58(),mintAddress:a.toBase58()}}:null}},{when:({programId:e})=>e.equals(t.TOKEN_2022_PROGRAM_ID),decode:({instruction:e,programId:n})=>d(()=>{const{keys:{destination:s,mint:o}}=(0,t.decodeTransferCheckedWithFeeInstruction)(e,n);return{tokenAddress:s.pubkey.toBase58(),mintAddress:o.pubkey.toBase58()}})},{when:({programId:e})=>c(e),decode:({instruction:e,programId:n})=>d(()=>{const{keys:{destination:s}}=(0,t.decodeTransferInstruction)(e,n);return{tokenAddress:s.pubkey.toBase58()}})},{when:({programId:e})=>c(e),decode:({instruction:e,programId:n})=>d(()=>{const{keys:{destination:s,mint:o}}=(0,t.decodeTransferCheckedInstruction)(e,n);return{tokenAddress:s.pubkey.toBase58(),mintAddress:o.pubkey.toBase58()}})},{when:({programId:e})=>c(e),decode:({instruction:e,programId:n})=>d(()=>{const{keys:{account:s,mint:o}}=(0,t.decodeInitializeAccountInstruction)(e,n);return{createATA:{address:s.pubkey.toBase58(),mintAddress:o.pubkey.toBase58()}}})},{when:({programId:e})=>c(e),decode:({instruction:e,programId:n})=>d(()=>{const{keys:{account:s,mint:o}}=(0,t.decodeInitializeAccount2Instruction)(e,n);return{createATA:{address:s.pubkey.toBase58(),mintAddress:o.pubkey.toBase58()}}})},{when:({programId:e})=>c(e),decode:({instruction:e,programId:n})=>d(()=>{const{keys:{account:s,mint:o}}=(0,t.decodeInitializeAccount3Instruction)(e,n);return{createATA:{address:s.pubkey.toBase58(),mintAddress:o.pubkey.toBase58()}}})},{when:({programId:e})=>c(e),decode:({instruction:e,programId:n})=>d(()=>{const{keys:{account:s}}=(0,t.decodeInitializeImmutableOwnerInstruction)(e,n);return{tokenAddress:s.pubkey.toBase58()}})},{when:({programId:e})=>c(e),decode:({instruction:e,programId:n})=>d(()=>{const{keys:{account:s}}=(0,t.decodeCloseAccountInstruction)(e,n);return{tokenAddress:s.pubkey.toBase58()}})},{when:({programId:e})=>c(e),decode:({instruction:e,programId:n})=>d(()=>{const{keys:{account:s}}=(0,t.decodeSyncNativeInstruction)(e,n);return{tokenAddress:s.pubkey.toBase58()}})},{when:({programId:e})=>c(e),decode:({instruction:e,programId:n})=>d(()=>{const{keys:{account:s,mint:o}}=(0,t.decodeBurnCheckedInstruction)(e,n);return{tokenAddress:s.pubkey.toBase58(),mintAddress:o.pubkey.toBase58()}})},{when:({programId:e})=>c(e),decode:({instruction:e,programId:n})=>d(()=>{const{keys:{account:s,mint:o}}=(0,t.decodeBurnInstruction)(e,n);return{tokenAddress:s.pubkey.toBase58(),mintAddress:o.pubkey.toBase58()}})},{when:({programId:e})=>c(e),decode:({instruction:e,programId:n})=>d(()=>{const{keys:{account:s,mint:o}}=(0,t.decodeFreezeAccountInstruction)(e,n);return{tokenAddress:s.pubkey.toBase58(),mintAddress:o.pubkey.toBase58()}})},{when:({programId:e})=>c(e),decode:({instruction:e,programId:n})=>d(()=>{const{keys:{account:s,mint:o}}=(0,t.decodeThawAccountInstruction)(e,n);return{tokenAddress:s.pubkey.toBase58(),mintAddress:o.pubkey.toBase58()}})},{when:({programId:e})=>e.equals(t.ASSOCIATED_TOKEN_PROGRAM_ID)||e.equals(t.TOKEN_PROGRAM_ID)||e.equals(t.TOKEN_2022_PROGRAM_ID),decode:()=>({})}];0&&(module.exports={DECODERS});
2
2
  //# sourceMappingURL=transactionDecoders.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/app-binder/services/utils/transactionDecoders.ts"],
4
- "sourcesContent": ["import {\n ASSOCIATED_TOKEN_PROGRAM_ID,\n decodeBurnCheckedInstruction,\n decodeBurnInstruction,\n decodeCloseAccountInstruction,\n decodeFreezeAccountInstruction,\n decodeInitializeAccount2Instruction,\n decodeInitializeAccount3Instruction,\n decodeInitializeAccountInstruction,\n decodeInitializeImmutableOwnerInstruction,\n decodeSyncNativeInstruction,\n decodeThawAccountInstruction,\n decodeTransferCheckedInstruction,\n decodeTransferCheckedWithFeeInstruction,\n decodeTransferInstruction,\n TOKEN_2022_PROGRAM_ID,\n TOKEN_PROGRAM_ID,\n} from \"@solana/spl-token\";\nimport { type PublicKey, type TransactionInstruction } from \"@solana/web3.js\";\n\nimport {\n type NormalizedCompiledIx,\n type NormalizedMessage,\n type SolanaTransactionTypes,\n} from \"@internal/app-binder/services/TransactionInspector\";\n\nexport interface TxInspectorResult {\n transactionType: SolanaTransactionTypes;\n data: {\n tokenAddress?: string;\n mintAddress?: string;\n createATA?: {\n address: string;\n mintAddress: string;\n };\n };\n}\n\nexport type IxContext = {\n programId: PublicKey;\n ixMeta: NormalizedCompiledIx;\n message: NormalizedMessage;\n instruction: TransactionInstruction;\n};\n\nexport type Decoder = {\n when: (ctx: IxContext) => boolean;\n decode: (ctx: IxContext) => TxInspectorResult[\"data\"] | null;\n};\n\nconst isTokenProgramId = (pid: PublicKey) =>\n pid.equals(TOKEN_PROGRAM_ID) || pid.equals(TOKEN_2022_PROGRAM_ID);\n\nconst safe = <T>(fn: () => T): T | null => {\n try {\n return fn();\n } catch {\n return null;\n }\n};\n\nexport const DECODERS: Decoder[] = [\n // ATA creation (Associated Token Account Program)\n {\n when: ({ programId }) => programId.equals(ASSOCIATED_TOKEN_PROGRAM_ID),\n decode: ({ ixMeta, message }) => {\n const accountPks = ixMeta.accountKeyIndexes\n .map((i) => message.allKeys[i])\n .filter(Boolean) as PublicKey[];\n const ataPk = accountPks[1];\n const mintPk = accountPks[3];\n return ataPk && mintPk\n ? {\n createATA: {\n address: ataPk.toBase58(),\n mintAddress: mintPk.toBase58(),\n },\n }\n : null;\n },\n },\n\n // token-2022 fee'd transfers \u2014 first for Token-2022\n {\n when: ({ programId }) => programId.equals(TOKEN_2022_PROGRAM_ID),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { destination, mint },\n } = decodeTransferCheckedWithFeeInstruction(instruction, programId);\n return {\n tokenAddress: destination.pubkey.toBase58(),\n mintAddress: mint.pubkey.toBase58(),\n };\n }),\n },\n\n // generic SPL decoders (classic & 2022)\n // transfers\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { destination },\n } = decodeTransferInstruction(instruction, programId);\n return { tokenAddress: destination.pubkey.toBase58() };\n }),\n },\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { destination, mint },\n } = decodeTransferCheckedInstruction(instruction, programId);\n return {\n tokenAddress: destination.pubkey.toBase58(),\n mintAddress: mint.pubkey.toBase58(),\n };\n }),\n },\n\n // account initialisation (non-ATA included)\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account, mint },\n } = decodeInitializeAccountInstruction(instruction, programId);\n return {\n createATA: {\n address: account.pubkey.toBase58(),\n mintAddress: mint.pubkey.toBase58(),\n },\n };\n }),\n },\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account, mint },\n } = decodeInitializeAccount2Instruction(instruction, programId);\n return {\n createATA: {\n address: account.pubkey.toBase58(),\n mintAddress: mint.pubkey.toBase58(),\n },\n };\n }),\n },\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account, mint },\n } = decodeInitializeAccount3Instruction(instruction, programId);\n return {\n createATA: {\n address: account.pubkey.toBase58(),\n mintAddress: mint.pubkey.toBase58(),\n },\n };\n }),\n },\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account },\n } = decodeInitializeImmutableOwnerInstruction(instruction, programId);\n return { tokenAddress: account.pubkey.toBase58() };\n }),\n },\n\n // lifecycle / WSOL\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account },\n } = decodeCloseAccountInstruction(instruction, programId);\n return { tokenAddress: account.pubkey.toBase58() };\n }),\n },\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account },\n } = decodeSyncNativeInstruction(instruction, programId);\n return { tokenAddress: account.pubkey.toBase58() };\n }),\n },\n\n // mint / burn\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account, mint },\n } = decodeBurnCheckedInstruction(instruction, programId);\n return {\n tokenAddress: account.pubkey.toBase58(),\n mintAddress: mint.pubkey.toBase58(),\n };\n }),\n },\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account, mint },\n } = decodeBurnInstruction(instruction, programId);\n return {\n tokenAddress: account.pubkey.toBase58(),\n mintAddress: mint.pubkey.toBase58(),\n };\n }),\n },\n\n // freeze / thaw\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account, mint },\n } = decodeFreezeAccountInstruction(instruction, programId);\n return {\n tokenAddress: account.pubkey.toBase58(),\n mintAddress: mint.pubkey.toBase58(),\n };\n }),\n },\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account, mint },\n } = decodeThawAccountInstruction(instruction, programId);\n return {\n tokenAddress: account.pubkey.toBase58(),\n mintAddress: mint.pubkey.toBase58(),\n };\n }),\n },\n];\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAA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tC,YAAaD,EAAK,OAAO,SAAS,CACpC,CACF,CAAC,CACL,EACA,CACE,KAAM,CAAC,CAAE,UAAAT,CAAU,IAAMJ,EAAiBI,CAAS,EACnD,OAAQ,CAAC,CAAE,YAAAO,EAAa,UAAAP,CAAU,IAChCF,EAAK,IAAM,CACT,KAAM,CACJ,KAAM,CAAE,QAAAY,EAAS,KAAAD,CAAK,CACxB,KAAI,yBAAsBF,EAAaP,CAAS,EAChD,MAAO,CACL,aAAcU,EAAQ,OAAO,SAAS,EACtC,YAAaD,EAAK,OAAO,SAAS,CACpC,CACF,CAAC,CACL,EAGA,CACE,KAAM,CAAC,CAAE,UAAAT,CAAU,IAAMJ,EAAiBI,CAAS,EACnD,OAAQ,CAAC,CAAE,YAAAO,EAAa,UAAAP,CAAU,IAChCF,EAAK,IAAM,CACT,KAAM,CACJ,KAAM,CAAE,QAAAY,EAAS,KAAAD,CAAK,CACxB,KAAI,kCAA+BF,EAAaP,CAAS,EACzD,MAAO,CACL,aAAcU,EAAQ,OAAO,SAAS,EACtC,YAAaD,EAAK,OAAO,SAAS,CACpC,CACF,CAAC,CACL,EACA,CACE,KAAM,CAAC,CAAE,UAAAT,CAAU,IAAMJ,EAAiBI,CAAS,EACnD,OAAQ,CAAC,CAAE,YAAAO,EAAa,UAAAP,CAAU,IAChCF,EAAK,IAAM,CACT,KAAM,CACJ,KAAM,CAAE,QAAAY,EAAS,KAAAD,CAAK,CACxB,KAAI,gCAA6BF,EAAaP,CAAS,EACvD,MAAO,CACL,aAAcU,EAAQ,OAAO,SAAS,EACtC,YAAaD,EAAK,OAAO,SAAS,CACpC,CACF,CAAC,CACL,CACF",
6
- "names": ["transactionDecoders_exports", "__export", "DECODERS", "__toCommonJS", "import_spl_token", "isTokenProgramId", "pid", "safe", "fn", "programId", "ixMeta", "message", "accountPks", "i", "ataPk", "mintPk", "instruction", "destination", "mint", "account"]
4
+ "sourcesContent": ["import {\n ASSOCIATED_TOKEN_PROGRAM_ID,\n decodeBurnCheckedInstruction,\n decodeBurnInstruction,\n decodeCloseAccountInstruction,\n decodeFreezeAccountInstruction,\n decodeInitializeAccount2Instruction,\n decodeInitializeAccount3Instruction,\n decodeInitializeAccountInstruction,\n decodeInitializeImmutableOwnerInstruction,\n decodeSyncNativeInstruction,\n decodeThawAccountInstruction,\n decodeTransferCheckedInstruction,\n decodeTransferCheckedWithFeeInstruction,\n decodeTransferInstruction,\n getAssociatedTokenAddressSync,\n TOKEN_2022_PROGRAM_ID,\n TOKEN_PROGRAM_ID,\n} from \"@solana/spl-token\";\nimport { type PublicKey, type TransactionInstruction } from \"@solana/web3.js\";\n\nimport {\n type NormalizedCompiledIx,\n type NormalizedMessage,\n type SolanaTransactionTypes,\n} from \"@internal/app-binder/services/TransactionInspector\";\n\nexport interface TxInspectorResult {\n transactionType: SolanaTransactionTypes;\n data: {\n tokenAddress?: string;\n mintAddress?: string;\n createATA?: { address: string; mintAddress: string };\n };\n}\n\nexport type IxContext = {\n programId: PublicKey;\n ixMeta: NormalizedCompiledIx;\n message: NormalizedMessage;\n instruction: TransactionInstruction;\n};\n\nexport type Decoder = {\n when: (ctx: IxContext) => boolean;\n decode: (ctx: IxContext) => TxInspectorResult[\"data\"] | null;\n};\n\nconst isTokenProgramId = (pid: PublicKey) =>\n pid.equals(TOKEN_PROGRAM_ID) || pid.equals(TOKEN_2022_PROGRAM_ID);\n\nconst safe = <T>(fn: () => T): T | null => {\n try {\n return fn();\n } catch {\n return null;\n }\n};\n\nexport const DECODERS: Decoder[] = [\n // ATA creation (with derivation fallback)\n {\n when: ({ programId }) => programId.equals(ASSOCIATED_TOKEN_PROGRAM_ID),\n decode: ({ ixMeta, message }) => {\n const accountPks = ixMeta.accountKeyIndexes\n .map((i) => message.allKeys[i])\n .filter(Boolean) as PublicKey[];\n\n // Canonical indices for create ATA:\n // [0] payer, [1] ata, [2] owner, [3] mint, [4] system, [5] token program, [6] rent? (optional)\n const ataPk = accountPks[1];\n const ownerPk = accountPks[2];\n const mintPk = accountPks[3];\n const tokenProgramPk = accountPks[5];\n\n // If ata is missing but we have owner+mint, derive it.\n if (!ataPk && ownerPk && mintPk) {\n const isToken2022 =\n tokenProgramPk?.equals(TOKEN_2022_PROGRAM_ID) ?? false;\n const derived = getAssociatedTokenAddressSync(\n mintPk,\n ownerPk,\n true, // allowOwnerOffCurve: owners can be PDAs\n isToken2022 ? TOKEN_2022_PROGRAM_ID : TOKEN_PROGRAM_ID,\n ASSOCIATED_TOKEN_PROGRAM_ID,\n );\n return {\n createATA: {\n address: derived.toBase58(),\n mintAddress: mintPk.toBase58(),\n },\n };\n }\n\n return ataPk && mintPk\n ? {\n createATA: {\n address: ataPk.toBase58(),\n mintAddress: mintPk.toBase58(),\n },\n }\n : null;\n },\n },\n\n // Token-2022 fee\u2019d transfer (CWIF)\n {\n when: ({ programId }) => programId.equals(TOKEN_2022_PROGRAM_ID),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { destination, mint },\n } = decodeTransferCheckedWithFeeInstruction(instruction, programId);\n return {\n tokenAddress: destination.pubkey.toBase58(),\n mintAddress: mint.pubkey.toBase58(),\n };\n }),\n },\n\n // Transfers\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { destination },\n } = decodeTransferInstruction(instruction, programId);\n return { tokenAddress: destination.pubkey.toBase58() };\n }),\n },\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { destination, mint },\n } = decodeTransferCheckedInstruction(instruction, programId);\n return {\n tokenAddress: destination.pubkey.toBase58(),\n mintAddress: mint.pubkey.toBase58(),\n };\n }),\n },\n\n // Account init\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account, mint },\n } = decodeInitializeAccountInstruction(instruction, programId);\n return {\n createATA: {\n address: account.pubkey.toBase58(),\n mintAddress: mint.pubkey.toBase58(),\n },\n };\n }),\n },\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account, mint },\n } = decodeInitializeAccount2Instruction(instruction, programId);\n return {\n createATA: {\n address: account.pubkey.toBase58(),\n mintAddress: mint.pubkey.toBase58(),\n },\n };\n }),\n },\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account, mint },\n } = decodeInitializeAccount3Instruction(instruction, programId);\n return {\n createATA: {\n address: account.pubkey.toBase58(),\n mintAddress: mint.pubkey.toBase58(),\n },\n };\n }),\n },\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account },\n } = decodeInitializeImmutableOwnerInstruction(instruction, programId);\n return { tokenAddress: account.pubkey.toBase58() };\n }),\n },\n\n // Lifecycle / WSOL\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account },\n } = decodeCloseAccountInstruction(instruction, programId);\n return { tokenAddress: account.pubkey.toBase58() };\n }),\n },\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account },\n } = decodeSyncNativeInstruction(instruction, programId);\n return { tokenAddress: account.pubkey.toBase58() };\n }),\n },\n\n // Mint / Burn\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account, mint },\n } = decodeBurnCheckedInstruction(instruction, programId);\n return {\n tokenAddress: account.pubkey.toBase58(),\n mintAddress: mint.pubkey.toBase58(),\n };\n }),\n },\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account, mint },\n } = decodeBurnInstruction(instruction, programId);\n return {\n tokenAddress: account.pubkey.toBase58(),\n mintAddress: mint.pubkey.toBase58(),\n };\n }),\n },\n\n // Freeze / Thaw\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account, mint },\n } = decodeFreezeAccountInstruction(instruction, programId);\n return {\n tokenAddress: account.pubkey.toBase58(),\n mintAddress: mint.pubkey.toBase58(),\n };\n }),\n },\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account, mint },\n } = decodeThawAccountInstruction(instruction, programId);\n return {\n tokenAddress: account.pubkey.toBase58(),\n mintAddress: mint.pubkey.toBase58(),\n };\n }),\n },\n\n // LAST-RESORT: tag as SPL by program id only (when decoders can't run)\n {\n when: ({ programId }) =>\n programId.equals(ASSOCIATED_TOKEN_PROGRAM_ID) ||\n programId.equals(TOKEN_PROGRAM_ID) ||\n programId.equals(TOKEN_2022_PROGRAM_ID),\n decode: () => ({}),\n },\n];\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,cAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAkBO,6BA8BP,MAAMC,EAAoBC,GACxBA,EAAI,OAAO,kBAAgB,GAAKA,EAAI,OAAO,uBAAqB,EAE5DC,EAAWC,GAA0B,CACzC,GAAI,CACF,OAAOA,EAAG,CACZ,MAAQ,CACN,OAAO,IACT,CACF,EAEaN,EAAsB,CAEjC,CACE,KAAM,CAAC,CAAE,UAAAO,CAAU,IAAMA,EAAU,OAAO,6BAA2B,EACrE,OAAQ,CAAC,CAAE,OAAAC,EAAQ,QAAAC,CAAQ,IAAM,CAC/B,MAAMC,EAAaF,EAAO,kBACvB,IAAKG,GAAMF,EAAQ,QAAQE,CAAC,CAAC,EAC7B,OAAO,OAAO,EAIXC,EAAQF,EAAW,CAAC,EACpBG,EAAUH,EAAW,CAAC,EACtBI,EAASJ,EAAW,CAAC,EACrBK,EAAiBL,EAAW,CAAC,EAGnC,GAAI,CAACE,GAASC,GAAWC,EAAQ,CAC/B,MAA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S,CACpC,CACF,CAAC,CACL,EAGA,CACE,KAAM,CAAC,CAAE,UAAAZ,CAAU,IAAMJ,EAAiBI,CAAS,EACnD,OAAQ,CAAC,CAAE,YAAAU,EAAa,UAAAV,CAAU,IAChCF,EAAK,IAAM,CACT,KAAM,CACJ,KAAM,CAAE,QAAAe,EAAS,KAAAD,CAAK,CACxB,KAAI,kCAA+BF,EAAaV,CAAS,EACzD,MAAO,CACL,aAAca,EAAQ,OAAO,SAAS,EACtC,YAAaD,EAAK,OAAO,SAAS,CACpC,CACF,CAAC,CACL,EACA,CACE,KAAM,CAAC,CAAE,UAAAZ,CAAU,IAAMJ,EAAiBI,CAAS,EACnD,OAAQ,CAAC,CAAE,YAAAU,EAAa,UAAAV,CAAU,IAChCF,EAAK,IAAM,CACT,KAAM,CACJ,KAAM,CAAE,QAAAe,EAAS,KAAAD,CAAK,CACxB,KAAI,gCAA6BF,EAAaV,CAAS,EACvD,MAAO,CACL,aAAca,EAAQ,OAAO,SAAS,EACtC,YAAaD,EAAK,OAAO,SAAS,CACpC,CACF,CAAC,CACL,EAGA,CACE,KAAM,CAAC,CAAE,UAAAZ,CAAU,IACjBA,EAAU,OAAO,6BAA2B,GAC5CA,EAAU,OAAO,kBAAgB,GACjCA,EAAU,OAAO,uBAAqB,EACxC,OAAQ,KAAO,CAAC,EAClB,CACF",
6
+ "names": ["transactionDecoders_exports", "__export", "DECODERS", "__toCommonJS", "import_spl_token", "isTokenProgramId", "pid", "safe", "fn", "programId", "ixMeta", "message", "accountPks", "i", "ataPk", "ownerPk", "mintPk", "tokenProgramPk", "isToken2022", "instruction", "destination", "mint", "account"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{Transaction as I,TransactionInstruction as f,VersionedMessage as g,VersionedTransaction as K}from"@solana/web3.js";import{Buffer as l}from"buffer";import{DECODERS as A}from"../../app-binder/services/utils/transactionDecoders";var b=(t=>(t.STANDARD="Standard",t.SPL="SPL",t))(b||{});class k{constructor(n){this.rawTransactionBytes=n}inspectTransactionType(){try{const n=this.normaliseMessage(this.rawTransactionBytes);for(const t of n.compiledInstructions){const r=n.allKeys[t.programIdIndex];if(!r)continue;const c=t.accountKeyIndexes.map(o=>n.allKeys[o]).filter(o=>!!o);if(c.length!==t.accountKeyIndexes.length)continue;const i=new f({programId:r,keys:c.map(o=>({pubkey:o,isSigner:!1,isWritable:!1})),data:l.from(t.data)}),d={programId:r,ixMeta:t,message:n,instruction:i};for(const o of A){if(!o.when(d))continue;const y=o.decode(d);if(y)return{transactionType:"SPL",data:y}}}return{transactionType:"Standard",data:{}}}catch{return{transactionType:"Standard",data:{}}}}normaliseMessage(n){const t=this.tryDeserialiseVersioned(n);if(t){const e=t.message;let s;return typeof e.getAccountKeys=="function"?s=e.getAccountKeys().keySegments().flat():s=[...e.staticAccountKeys],{compiledInstructions:e.compiledInstructions.map(a=>{const m=a,p=Array.from(m.accounts??a.accountKeyIndexes??[]);let u;return a.data instanceof Uint8Array?u=a.data:typeof a.data=="string"?u=l.from(a.data,"base64"):u=Uint8Array.from(a.data??[]),{programIdIndex:a.programIdIndex,accountKeyIndexes:p,data:u}}),allKeys:s}}const r=I.from(n),c=new Map,i=e=>{if(!e)return;const s=e.toBase58();c.has(s)||c.set(s,e)};i(r.feePayer??null);for(const e of r.instructions){i(e.programId);for(const s of e.keys)i(s.pubkey)}const d=Array.from(c.values()),o=new Map(d.map((e,s)=>[e.toBase58(),s]));return{compiledInstructions:r.instructions.map(e=>({programIdIndex:o.get(e.programId.toBase58())??-1,accountKeyIndexes:e.keys.map(s=>o.get(s.pubkey.toBase58())??-1),data:e.data})),allKeys:d}}tryDeserialiseVersioned(n){try{return K.deserialize(n)}catch{try{return{message:g.deserialize(n)}}catch{return null}}}}export{b as SolanaTransactionTypes,k as TransactionInspector};
1
+ import{ASSOCIATED_TOKEN_PROGRAM_ID as K,TOKEN_2022_PROGRAM_ID as g,TOKEN_PROGRAM_ID as A}from"@solana/spl-token";import{Connection as b,Transaction as T,TransactionInstruction as P,VersionedMessage as x,VersionedTransaction as k}from"@solana/web3.js";import{Buffer as p}from"buffer";import{DECODERS as S}from"../../app-binder/services/utils/transactionDecoders";var L=(t=>(t.STANDARD="Standard",t.SPL="SPL",t))(L||{});const M="http://api.mainnet-beta.solana.com/",D=new b(M,{commitment:"confirmed"}),R=d=>!!d&&(d.equals(K)||d.equals(A)||d.equals(g));class v{constructor(s){this.rawTransactionBytes=s}async inspectTransactionType(){try{const s=await this.normaliseMessage(this.rawTransactionBytes);for(const t of s.compiledInstructions){const o=s.allKeys[t.programIdIndex];if(!o)continue;const r=t.accountKeyIndexes.map(n=>s.allKeys[n]).filter(n=>!!n),l=new P({programId:o,keys:r.map(n=>({pubkey:n,isSigner:!1,isWritable:!1})),data:p.from(t.data)}),i={programId:o,ixMeta:t,message:s,instruction:l};for(const n of S){if(!n.when(i))continue;const u=n.decode(i);if(u)return{transactionType:"SPL",data:u}}if(R(o))return{transactionType:"SPL",data:{}}}return{transactionType:"Standard",data:{}}}catch{return{transactionType:"Standard",data:{}}}}async normaliseMessage(s){const t=this.tryDeserialiseVersioned(s);if(t){const e=t.message,a=await h(e);let m;return typeof e.getAccountKeys=="function"?m=e.getAccountKeys(a?{accountKeysFromLookups:a}:void 0).keySegments().flat():m=[...e.staticAccountKeys],{compiledInstructions:e.compiledInstructions.map(c=>{const f=c,I=Array.from(f.accounts??c.accountKeyIndexes??[]);let y;return c.data instanceof Uint8Array?y=c.data:typeof c.data=="string"?y=p.from(c.data,"base64"):y=Uint8Array.from(c.data??[]),{programIdIndex:c.programIdIndex,accountKeyIndexes:I,data:y}}),allKeys:m}}const o=T.from(s),r=new Map,l=e=>{if(!e)return;const a=e.toBase58();r.has(a)||r.set(a,e)};l(o.feePayer??null);for(const e of o.instructions){l(e.programId);for(const a of e.keys)l(a.pubkey)}const i=Array.from(r.values()),n=new Map(i.map((e,a)=>[e.toBase58(),a]));return{compiledInstructions:o.instructions.map(e=>({programIdIndex:n.get(e.programId.toBase58())??-1,accountKeyIndexes:e.keys.map(a=>n.get(a.pubkey.toBase58())??-1),data:e.data})),allKeys:i}}tryDeserialiseVersioned(s){try{return k.deserialize(s)}catch{try{return{message:x.deserialize(s)}}catch{return null}}}}async function h(d){const s=d.addressTableLookups??[];if(!s.length)return;const t=[],o=[];return await Promise.all(s.map(async r=>{const i=(await D.getAddressLookupTable(r.accountKey)).value;if(!i)return;const n=i.state.addresses;for(const u of r.writableIndexes??[]){const e=n[u];e&&t.push(e)}for(const u of r.readonlyIndexes??[]){const e=n[u];e&&o.push(e)}})),{writable:t,readonly:o}}export{L as SolanaTransactionTypes,v as TransactionInspector};
2
2
  //# sourceMappingURL=TransactionInspector.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/app-binder/services/TransactionInspector.ts"],
4
- "sourcesContent": ["import {\n type PublicKey,\n Transaction,\n TransactionInstruction,\n VersionedMessage,\n VersionedTransaction,\n} from \"@solana/web3.js\";\nimport { Buffer } from \"buffer\";\n\nimport {\n DECODERS,\n type IxContext,\n type TxInspectorResult,\n} from \"@internal/app-binder/services/utils/transactionDecoders\";\n\nexport enum SolanaTransactionTypes {\n STANDARD = \"Standard\",\n SPL = \"SPL\",\n}\n\nexport type NormalizedCompiledIx = {\n programIdIndex: number;\n accountKeyIndexes: number[];\n data: Uint8Array;\n};\n\nexport type NormalizedMessage = {\n compiledInstructions: NormalizedCompiledIx[];\n allKeys: PublicKey[];\n};\n\ntype LoadedAddresses = { writable: PublicKey[]; readonly: PublicKey[] };\n\nexport class TransactionInspector {\n constructor(private readonly rawTransactionBytes: Uint8Array) {}\n\n public inspectTransactionType(): TxInspectorResult {\n try {\n const message = this.normaliseMessage(this.rawTransactionBytes);\n\n for (const ixMeta of message.compiledInstructions) {\n const programId = message.allKeys[ixMeta.programIdIndex];\n if (!programId) continue;\n\n // resolve all referenced keys, if any are missing skip this\n const resolvedKeys = ixMeta.accountKeyIndexes\n .map((i) => message.allKeys[i])\n .filter((key): key is PublicKey => !!key);\n\n if (resolvedKeys.length !== ixMeta.accountKeyIndexes.length) {\n // unresolved keys, can't decode reliably\n continue;\n }\n\n const instruction = new TransactionInstruction({\n programId,\n keys: resolvedKeys.map((key) => ({\n pubkey: key,\n isSigner: false,\n isWritable: false,\n })),\n data: Buffer.from(ixMeta.data),\n });\n\n const ctx: IxContext = { programId, ixMeta, message, instruction };\n\n for (const decoder of DECODERS) {\n if (!decoder.when(ctx)) continue;\n const data = decoder.decode(ctx);\n if (data) {\n return { transactionType: SolanaTransactionTypes.SPL, data };\n }\n }\n }\n\n return { transactionType: SolanaTransactionTypes.STANDARD, data: {} };\n } catch {\n return { transactionType: SolanaTransactionTypes.STANDARD, data: {} };\n }\n }\n\n /**\n * Normalise any tx (legacy or v0) into { compiledInstructions, allKeys }.\n * If LUT accounts are provided, looked-up keys are included in allKeys.\n */\n private normaliseMessage(rawBytes: Uint8Array): NormalizedMessage {\n const versionedTX = this.tryDeserialiseVersioned(rawBytes);\n if (versionedTX) {\n const msg = versionedTX.message as VersionedMessage & {\n getAccountKeys?: (options?: {\n accountKeysFromLookups?: LoadedAddresses;\n }) => {\n staticAccountKeys: PublicKey[];\n accountKeysFromLookups?: LoadedAddresses;\n keySegments: () => PublicKey[][];\n };\n compiledInstructions: Array<{\n programIdIndex: number;\n accountKeyIndexes?: number[]; // legacy field name\n accounts?: number[]; // v0 field name\n data: Uint8Array | string | number[];\n }>;\n staticAccountKeys: PublicKey[];\n };\n\n // build the full key array in the exact index order used by compiledInstructions\n let allKeys: PublicKey[];\n if (typeof msg.getAccountKeys === \"function\") {\n const messageAccountKeys = msg.getAccountKeys();\n allKeys = messageAccountKeys.keySegments().flat();\n } else {\n // fallback to statics\n allKeys = [...msg.staticAccountKeys];\n }\n\n const compiledInstructions: NormalizedCompiledIx[] =\n msg.compiledInstructions.map((ix) => {\n // prefer v0 `accounts`, fall back to legacy `accountKeyIndexes`\n const ixWithAccounts = ix as typeof ix & { accounts?: number[] };\n const accountKeyIndexes = Array.from(\n ixWithAccounts.accounts ?? ix.accountKeyIndexes ?? [],\n ) as number[];\n\n // normalise data\n let data: Uint8Array;\n if (ix.data instanceof Uint8Array) {\n data = ix.data;\n } else if (typeof ix.data === \"string\") {\n // v0 encodes instruction data as base64 strings\n data = Buffer.from(ix.data, \"base64\");\n } else {\n data = Uint8Array.from(ix.data ?? []);\n }\n\n return {\n programIdIndex: ix.programIdIndex,\n accountKeyIndexes,\n data,\n };\n });\n\n return { compiledInstructions, allKeys };\n }\n\n // legacy fallback\n const legacy = Transaction.from(rawBytes);\n\n const allKeyMap = new Map<string, PublicKey>();\n const add = (pubkey?: PublicKey | null) => {\n if (!pubkey) return;\n const key = pubkey.toBase58();\n if (!allKeyMap.has(key)) allKeyMap.set(key, pubkey);\n };\n\n add(legacy.feePayer ?? null);\n for (const ix of legacy.instructions) {\n add(ix.programId);\n for (const key of ix.keys) add(key.pubkey);\n }\n const allKeys = Array.from(allKeyMap.values());\n const indexByB58 = new Map(allKeys.map((pk, i) => [pk.toBase58(), i]));\n\n const compiledInstructions: NormalizedCompiledIx[] =\n legacy.instructions.map((ix) => ({\n programIdIndex: indexByB58.get(ix.programId.toBase58()) ?? -1,\n accountKeyIndexes: ix.keys.map(\n (key) => indexByB58.get(key.pubkey.toBase58()) ?? -1,\n ),\n data: ix.data,\n }));\n\n return { compiledInstructions, allKeys };\n }\n\n private tryDeserialiseVersioned(\n rawBytes: Uint8Array,\n ): VersionedTransaction | null {\n try {\n return VersionedTransaction.deserialize(rawBytes);\n } catch {\n try {\n const msg = VersionedMessage.deserialize(rawBytes);\n // wrap in a dummy VersionedTransaction-like shape just for uniform handling\n return { message: msg } as VersionedTransaction;\n } catch {\n return null;\n }\n }\n }\n}\n"],
5
- "mappings": "AAAA,OAEE,eAAAA,EACA,0BAAAC,EACA,oBAAAC,EACA,wBAAAC,MACK,kBACP,OAAS,UAAAC,MAAc,SAEvB,OACE,YAAAC,MAGK,0DAEA,IAAKC,OACVA,EAAA,SAAW,W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zC,CAEQ,wBACNH,EAC6B,CAC7B,GAAI,CACF,OAAOhB,EAAqB,YAAYgB,CAAQ,CAClD,MAAQ,CACN,GAAI,CAGF,MAAO,CAAE,QAFGjB,EAAiB,YAAYiB,CAAQ,CAE3B,CACxB,MAAQ,CACN,OAAO,IACT,CACF,CACF,CACF",
6
- "names": ["Transaction", "TransactionInstruction", "VersionedMessage", "VersionedTransaction", "Buffer", "DECODERS", "SolanaTransactionTypes", "TransactionInspector", "rawTransactionBytes", "message", "ixMeta", "programId", "resolvedKeys", "i", "key", "instruction", "ctx", "decoder", "data", "rawBytes", "versionedTX", "msg", "allKeys", "ix", "ixWithAccounts", "accountKeyIndexes", "legacy", "allKeyMap", "add", "pubkey", "indexByB58", "pk"]
4
+ "sourcesContent": ["import {\n ASSOCIATED_TOKEN_PROGRAM_ID,\n TOKEN_2022_PROGRAM_ID,\n TOKEN_PROGRAM_ID,\n} from \"@solana/spl-token\";\nimport {\n Connection, // runtime import so we can instantiate it\n type PublicKey,\n Transaction,\n TransactionInstruction,\n VersionedMessage,\n VersionedTransaction,\n} from \"@solana/web3.js\";\nimport { Buffer } from \"buffer\";\n\nimport {\n DECODERS,\n type IxContext,\n type TxInspectorResult,\n} from \"@internal/app-binder/services/utils/transactionDecoders\";\n\nexport enum SolanaTransactionTypes {\n STANDARD = \"Standard\",\n SPL = \"SPL\",\n}\n\nexport type NormalizedCompiledIx = {\n programIdIndex: number;\n accountKeyIndexes: number[];\n data: Uint8Array;\n};\n\nexport type NormalizedMessage = {\n compiledInstructions: NormalizedCompiledIx[];\n allKeys: PublicKey[];\n};\n\ntype LoadedAddresses = { writable: PublicKey[]; readonly: PublicKey[] };\n\nconst RPC_URL = \"http://api.mainnet-beta.solana.com/\";\n\nconst defaultConnection = new Connection(RPC_URL, { commitment: \"confirmed\" });\n\nconst isSPLProgramId = (pid: PublicKey | undefined) =>\n !!pid &&\n (pid.equals(ASSOCIATED_TOKEN_PROGRAM_ID) ||\n pid.equals(TOKEN_PROGRAM_ID) ||\n pid.equals(TOKEN_2022_PROGRAM_ID));\n\nexport class TransactionInspector {\n constructor(private readonly rawTransactionBytes: Uint8Array) {}\n\n public async inspectTransactionType(): Promise<TxInspectorResult> {\n try {\n const message = await this.normaliseMessage(this.rawTransactionBytes);\n\n for (const ixMeta of message.compiledInstructions) {\n const programId = message.allKeys[ixMeta.programIdIndex];\n if (!programId) continue;\n\n const resolvedKeys = ixMeta.accountKeyIndexes\n .map((i) => message.allKeys[i])\n .filter((key): key is PublicKey => !!key);\n\n // Build an instruction even with partial keys; decoders handle missing fields gracefully.\n const instruction = new TransactionInstruction({\n programId,\n keys: resolvedKeys.map((key) => ({\n pubkey: key,\n isSigner: false,\n isWritable: false,\n })),\n data: Buffer.from(ixMeta.data),\n });\n\n const ctx: IxContext = { programId, ixMeta, message, instruction };\n\n for (const decoder of DECODERS) {\n if (!decoder.when(ctx)) continue;\n const data = decoder.decode(ctx);\n if (data) {\n return { transactionType: SolanaTransactionTypes.SPL, data };\n }\n }\n\n if (isSPLProgramId(programId)) {\n return { transactionType: SolanaTransactionTypes.SPL, data: {} };\n }\n }\n\n return { transactionType: SolanaTransactionTypes.STANDARD, data: {} };\n } catch {\n return { transactionType: SolanaTransactionTypes.STANDARD, data: {} };\n }\n }\n\n /**\n * Normalise any tx (legacy or v0) into { compiledInstructions, allKeys }.\n * For v0, we auto-fetch looked-up addresses from ALT(s) via the baked-in connection.\n */\n private async normaliseMessage(\n rawBytes: Uint8Array,\n ): Promise<NormalizedMessage> {\n const versionedTX = this.tryDeserialiseVersioned(rawBytes);\n if (versionedTX) {\n const msg = versionedTX.message as VersionedMessage & {\n getAccountKeys?: (options?: {\n accountKeysFromLookups?: LoadedAddresses;\n }) => {\n staticAccountKeys: PublicKey[];\n accountKeysFromLookups?: LoadedAddresses;\n keySegments: () => PublicKey[][];\n };\n compiledInstructions: Array<{\n programIdIndex: number;\n accountKeyIndexes?: number[]; // legacy field name\n accounts?: number[]; // v0 field name\n data: Uint8Array | string | number[];\n }>;\n staticAccountKeys: PublicKey[];\n };\n\n const lookedUp = await resolveLookedUpAddressesFromMessage(msg);\n\n let allKeys: PublicKey[];\n if (typeof msg.getAccountKeys === \"function\") {\n const messageAccountKeys = msg.getAccountKeys(\n lookedUp ? { accountKeysFromLookups: lookedUp } : undefined,\n );\n allKeys = messageAccountKeys.keySegments().flat();\n } else {\n allKeys = [...msg.staticAccountKeys];\n }\n\n const compiledInstructions: NormalizedCompiledIx[] =\n msg.compiledInstructions.map((ix) => {\n const ixWithAccounts = ix as typeof ix & { accounts?: number[] };\n const accountKeyIndexes = Array.from(\n ixWithAccounts.accounts ?? ix.accountKeyIndexes ?? [],\n ) as number[];\n\n let data: Uint8Array;\n if (ix.data instanceof Uint8Array) {\n data = ix.data;\n } else if (typeof ix.data === \"string\") {\n data = Buffer.from(ix.data, \"base64\"); // v0 encodes instruction data as base64\n } else {\n data = Uint8Array.from(ix.data ?? []);\n }\n\n return {\n programIdIndex: ix.programIdIndex,\n accountKeyIndexes,\n data,\n };\n });\n\n return { compiledInstructions, allKeys };\n }\n\n // Legacy (no ALTs)\n const legacy = Transaction.from(rawBytes);\n\n const allKeyMap = new Map<string, PublicKey>();\n const add = (pubkey?: PublicKey | null) => {\n if (!pubkey) return;\n const key = pubkey.toBase58();\n if (!allKeyMap.has(key)) allKeyMap.set(key, pubkey);\n };\n\n add(legacy.feePayer ?? null);\n for (const ix of legacy.instructions) {\n add(ix.programId);\n for (const key of ix.keys) add(key.pubkey);\n }\n const allKeys = Array.from(allKeyMap.values());\n const indexByB58 = new Map(allKeys.map((pk, i) => [pk.toBase58(), i]));\n\n const compiledInstructions: NormalizedCompiledIx[] =\n legacy.instructions.map((ix) => ({\n programIdIndex: indexByB58.get(ix.programId.toBase58()) ?? -1,\n accountKeyIndexes: ix.keys.map(\n (key) => indexByB58.get(key.pubkey.toBase58()) ?? -1,\n ),\n data: ix.data,\n }));\n\n return { compiledInstructions, allKeys };\n }\n\n private tryDeserialiseVersioned(\n rawBytes: Uint8Array,\n ): VersionedTransaction | null {\n try {\n return VersionedTransaction.deserialize(rawBytes);\n } catch {\n try {\n const msg = VersionedMessage.deserialize(rawBytes);\n // Wrap in a dummy VersionedTransaction-like shape just for uniform handling\n return { message: msg } as VersionedTransaction;\n } catch {\n return null;\n }\n }\n }\n}\n\n/** Internal: fetch looked-up addresses for a VersionedMessage via the baked-in connection. */\nasync function resolveLookedUpAddressesFromMessage(\n msg: VersionedMessage,\n): Promise<LoadedAddresses | undefined> {\n const lookups = msg.addressTableLookups ?? [];\n if (!lookups.length) return;\n\n const writable: PublicKey[] = [];\n const readonly: PublicKey[] = [];\n\n await Promise.all(\n lookups.map(async (lu) => {\n const res = await defaultConnection.getAddressLookupTable(lu.accountKey);\n const table = res.value;\n if (!table) return;\n const addrs = table.state.addresses;\n\n for (const i of lu.writableIndexes ?? []) {\n const pk = addrs[i];\n if (pk) writable.push(pk);\n }\n for (const i of lu.readonlyIndexes ?? []) {\n const pk = addrs[i];\n if (pk) readonly.push(pk);\n }\n }),\n );\n\n return { writable, readonly };\n}\n"],
5
+ "mappings": "AAAA,OACE,+BAAAA,EACA,yBAAAC,EACA,oBAAAC,MACK,oBACP,OACE,cAAAC,EAEA,eAAAC,EACA,0BAAAC,EACA,oBAAAC,EACA,wBAAAC,MACK,kBACP,OAAS,UAAAC,MAAc,SAEvB,OACE,YAAAC,MAGK,0DAEA,IAAKC,OACVA,EAAA,SAAW,WACXA,EAAA,IAAM,MAFIA,OAAA,IAkBZ,MAAMC,EAAU,sCAEVC,EAAoB,IAAIT,EAAWQ,EAAS,CAAE,WAAY,WAAY,CAAC,EAEvEE,EAAkBC,GACtB,CAAC,CAACA,IACDA,EAAI,OAAOd,CAA2B,GACrCc,EAAI,OAAOZ,CAAgB,GAC3BY,EAAI,OAAOb,CAAqB,GAE7B,MAAMc,CAAqB,CAChC,YAA6BC,EAAiC,CAAjC,yBAAAA,CAAkC,CAE/D,MAAa,wBAAqD,CAChE,GAAI,CACF,MAA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Q,wBACNL,EAC6B,CAC7B,GAAI,CACF,OAAOpB,EAAqB,YAAYoB,CAAQ,CAClD,MAAQ,CACN,GAAI,CAGF,MAAO,CAAE,QAFGrB,EAAiB,YAAYqB,CAAQ,CAE3B,CACxB,MAAQ,CACN,OAAO,IACT,CACF,CACF,CACF,CAGA,eAAeI,EACbF,EACsC,CACtC,MAAMa,EAAUb,EAAI,qBAAuB,CAAC,EAC5C,GAAI,CAACa,EAAQ,OAAQ,OAErB,MAAMC,EAAwB,CAAC,EACzBC,EAAwB,CAAC,EAE/B,aAAM,QAAQ,IACZF,EAAQ,IAAI,MAAOG,GAAO,CAExB,MAAMC,GADM,MAAMlC,EAAkB,sBAAsBiC,EAAG,UAAU,GACrD,MAClB,GAAI,CAACC,EAAO,OACZ,MAAMC,EAAQD,EAAM,MAAM,UAE1B,UAAWzB,KAAKwB,EAAG,iBAAmB,CAAC,EAAG,CACxC,MAAMJ,EAAKM,EAAM1B,CAAC,EACdoB,GAAIE,EAAS,KAAKF,CAAE,CAC1B,CACA,UAAWpB,KAAKwB,EAAG,iBAAmB,CAAC,EAAG,CACxC,MAAMJ,EAAKM,EAAM1B,CAAC,EACdoB,GAAIG,EAAS,KAAKH,CAAE,CAC1B,CACF,CAAC,CACH,EAEO,CAAE,SAAAE,EAAU,SAAAC,CAAS,CAC9B",
6
+ "names": ["ASSOCIATED_TOKEN_PROGRAM_ID", "TOKEN_2022_PROGRAM_ID", "TOKEN_PROGRAM_ID", "Connection", "Transaction", "TransactionInstruction", "VersionedMessage", "VersionedTransaction", "Buffer", "DECODERS", "SolanaTransactionTypes", "RPC_URL", "defaultConnection", "isSPLProgramId", "pid", "TransactionInspector", "rawTransactionBytes", "message", "ixMeta", "programId", "resolvedKeys", "i", "key", "instruction", "ctx", "decoder", "data", "rawBytes", "versionedTX", "msg", "lookedUp", "resolveLookedUpAddressesFromMessage", "allKeys", "ix", "ixWithAccounts", "accountKeyIndexes", "legacy", "allKeyMap", "add", "pubkey", "indexByB58", "pk", "lookups", "writable", "readonly", "lu", "table", "addrs"]
7
7
  }
@@ -1,2 +1 @@
1
- import{createInitializeAccountInstruction as b,createTransferCheckedInstruction as A,createTransferInstruction as f,TOKEN_PROGRAM_ID as u}from"@solana/spl-token";import{Keypair as a,SystemProgram as g,Transaction as y}from"@solana/web3.js";import m from"bs58";import{describe as K,expect as o,it as i}from"vitest";import{SolanaTransactionTypes as p,TransactionInspector as l}from"./TransactionInspector";const d=m.encode(new Uint8Array(32).fill(1));K("TransactionInspector",()=>{i("falls back to STANDARD for a plain SystemProgram transfer",()=>{const e=a.generate(),s=a.generate().publicKey,n=new y().add(g.transfer({fromPubkey:e.publicKey,toPubkey:s,lamports:1e3}));n.recentBlockhash=d,n.feePayer=e.publicKey,n.sign(e);const c=n.serialize(),t=new l(c).inspectTransactionType();o(t.transactionType).toBe(p.STANDARD),o(t.data).toEqual({})}),i("detects an SPL Transfer and returns the destination address",()=>{const e=a.generate(),s=a.generate().publicKey,n=a.generate().publicKey,c=e.publicKey,t=new y().add(f(s,n,c,42n,[],u));t.recentBlockhash=d,t.feePayer=e.publicKey,t.sign(e);const r=new l(t.serialize()).inspectTransactionType();o(r.transactionType).toBe(p.SPL),o(r.data.tokenAddress).toBe(n.toBase58())}),i("detects an SPL TransferChecked and returns the destination address",()=>{const e=a.generate(),s=a.generate().publicKey,n=a.generate().publicKey,c=a.generate().publicKey,t=e.publicKey,r=new y().add(A(n,s,c,t,123n,0,[],u));r.recentBlockhash=d,r.feePayer=e.publicKey,r.sign(e);const T=new l(r.serialize()).inspectTransactionType();o(T.transactionType).toBe(p.SPL),o(T.data.tokenAddress).toBe(c.toBase58())}),i("detects an SPL InitializeAccount and returns the new ATA and mint",()=>{const e=a.generate(),s=a.generate().publicKey,n=a.generate().publicKey,c=e.publicKey,t=new y().add(b(n,s,c,u));t.recentBlockhash=d,t.feePayer=e.publicKey,t.sign(e);const r=new l(t.serialize()).inspectTransactionType();o(r.transactionType).toBe(p.SPL),o(r.data.createATA).toEqual({address:n.toBase58(),mintAddress:s.toBase58()})}),i("falls back to STANDARD if the payload is unparseable",()=>{const e=new Uint8Array([0,1,2,3,4,5]),s=new l(e).inspectTransactionType();o(s.transactionType).toBe(p.STANDARD),o(s.data).toEqual({})})});
2
1
  //# sourceMappingURL=TransactionInspector.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../../../src/internal/app-binder/services/TransactionInspector.test.ts"],
4
- "sourcesContent": ["import {\n createInitializeAccountInstruction,\n createTransferCheckedInstruction,\n createTransferInstruction,\n TOKEN_PROGRAM_ID,\n} from \"@solana/spl-token\";\nimport { Keypair, SystemProgram, Transaction } from \"@solana/web3.js\";\nimport bs58 from \"bs58\";\nimport { describe, expect, it } from \"vitest\";\n\nimport {\n SolanaTransactionTypes,\n TransactionInspector,\n} from \"./TransactionInspector\";\n\nconst DUMMY_BLOCKHASH = bs58.encode(new Uint8Array(32).fill(1));\n\ndescribe(\"TransactionInspector\", () => {\n it(\"falls back to STANDARD for a plain SystemProgram transfer\", () => {\n const payer = Keypair.generate();\n const dest = Keypair.generate().publicKey;\n\n const tx = new Transaction().add(\n SystemProgram.transfer({\n fromPubkey: payer.publicKey,\n toPubkey: dest,\n lamports: 1_000,\n }),\n );\n tx.recentBlockhash = DUMMY_BLOCKHASH;\n tx.feePayer = payer.publicKey;\n tx.sign(payer);\n\n const raw = tx.serialize();\n const result = new TransactionInspector(raw).inspectTransactionType();\n\n expect(result.transactionType).toBe(SolanaTransactionTypes.STANDARD);\n expect(result.data).toEqual({});\n });\n\n it(\"detects an SPL Transfer and returns the destination address\", () => {\n const payer = Keypair.generate();\n const source = Keypair.generate().publicKey;\n const destination = Keypair.generate().publicKey;\n const owner = payer.publicKey;\n\n const tx = new Transaction().add(\n createTransferInstruction(\n source,\n destination,\n owner,\n 42n,\n [],\n TOKEN_PROGRAM_ID,\n ),\n );\n tx.recentBlockhash = DUMMY_BLOCKHASH;\n tx.feePayer = payer.publicKey;\n tx.sign(payer);\n\n const result = new TransactionInspector(\n tx.serialize(),\n ).inspectTransactionType();\n\n expect(result.transactionType).toBe(SolanaTransactionTypes.SPL);\n expect(result.data.tokenAddress).toBe(destination.toBase58());\n });\n\n it(\"detects an SPL TransferChecked and returns the destination address\", () => {\n const payer = Keypair.generate();\n const mint = Keypair.generate().publicKey;\n const source = Keypair.generate().publicKey;\n const destination = Keypair.generate().publicKey;\n const owner = payer.publicKey;\n\n const tx = new Transaction().add(\n createTransferCheckedInstruction(\n source,\n mint,\n destination,\n owner,\n 123n,\n 0,\n [],\n TOKEN_PROGRAM_ID,\n ),\n );\n tx.recentBlockhash = DUMMY_BLOCKHASH;\n tx.feePayer = payer.publicKey;\n tx.sign(payer);\n\n const result = new TransactionInspector(\n tx.serialize(),\n ).inspectTransactionType();\n\n expect(result.transactionType).toBe(SolanaTransactionTypes.SPL);\n expect(result.data.tokenAddress).toBe(destination.toBase58());\n });\n\n it(\"detects an SPL InitializeAccount and returns the new ATA and mint\", () => {\n const payer = Keypair.generate();\n const mint = Keypair.generate().publicKey;\n const newAccount = Keypair.generate().publicKey;\n const owner = payer.publicKey;\n\n const tx = new Transaction().add(\n createInitializeAccountInstruction(\n newAccount,\n mint,\n owner,\n TOKEN_PROGRAM_ID,\n ),\n );\n tx.recentBlockhash = DUMMY_BLOCKHASH;\n tx.feePayer = payer.publicKey;\n tx.sign(payer);\n\n const result = new TransactionInspector(\n tx.serialize(),\n ).inspectTransactionType();\n\n expect(result.transactionType).toBe(SolanaTransactionTypes.SPL);\n expect(result.data.createATA).toEqual({\n address: newAccount.toBase58(),\n mintAddress: mint.toBase58(),\n });\n });\n\n it(\"falls back to STANDARD if the payload is unparseable\", () => {\n const garbage = new Uint8Array([0, 1, 2, 3, 4, 5]);\n const result = new TransactionInspector(garbage).inspectTransactionType();\n\n expect(result.transactionType).toBe(SolanaTransactionTypes.STANDARD);\n expect(result.data).toEqual({});\n });\n});\n"],
5
- "mappings": "AAAA,OACE,sCAAAA,E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,MAAMc,EAAU,IAAI,WAAW,CAAC,EAAG,EAAG,EAAG,EAAG,EAAG,CAAC,CAAC,EAC3CN,EAAS,IAAIN,EAAqBY,CAAO,EAAE,uBAAuB,EAExEf,EAAOS,EAAO,eAAe,EAAE,KAAKP,EAAuB,QAAQ,EACnEF,EAAOS,EAAO,IAAI,EAAE,QAAQ,CAAC,CAAC,CAChC,CAAC,CACH,CAAC",
6
- "names": ["createInitializeAccountInstruction", "createTransferCheckedInstruction", "createTransferInstruction", "TOKEN_PROGRAM_ID", "Keypair", "SystemProgram", "Transaction", "bs58", "describe", "expect", "it", "SolanaTransactionTypes", "TransactionInspector", "DUMMY_BLOCKHASH", "payer", "dest", "tx", "raw", "result", "source", "destination", "owner", "mint", "newAccount", "garbage"]
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
7
  }
@@ -1,2 +1,2 @@
1
- import{ASSOCIATED_TOKEN_PROGRAM_ID as u,decodeBurnCheckedInstruction as i,decodeBurnInstruction as k,decodeCloseAccountInstruction as y,decodeFreezeAccountInstruction as p,decodeInitializeAccount2Instruction as A,decodeInitializeAccount3Instruction as m,decodeInitializeAccountInstruction as l,decodeInitializeImmutableOwnerInstruction as I,decodeSyncNativeInstruction as b,decodeThawAccountInstruction as B,decodeTransferCheckedInstruction as T,decodeTransferCheckedWithFeeInstruction as h,decodeTransferInstruction as x,TOKEN_2022_PROGRAM_ID as r,TOKEN_PROGRAM_ID as w}from"@solana/spl-token";const d=e=>e.equals(w)||e.equals(r),o=e=>{try{return e()}catch{return null}},P=[{when:({programId:e})=>e.equals(u),decode:({ixMeta:e,message:n})=>{const t=e.accountKeyIndexes.map(a=>n.allKeys[a]).filter(Boolean),s=t[1],c=t[3];return s&&c?{createATA:{address:s.toBase58(),mintAddress:c.toBase58()}}:null}},{when:({programId:e})=>e.equals(r),decode:({instruction:e,programId:n})=>o(()=>{const{keys:{destination:t,mint:s}}=h(e,n);return{tokenAddress:t.pubkey.toBase58(),mintAddress:s.pubkey.toBase58()}})},{when:({programId:e})=>d(e),decode:({instruction:e,programId:n})=>o(()=>{const{keys:{destination:t}}=x(e,n);return{tokenAddress:t.pubkey.toBase58()}})},{when:({programId:e})=>d(e),decode:({instruction:e,programId:n})=>o(()=>{const{keys:{destination:t,mint:s}}=T(e,n);return{tokenAddress:t.pubkey.toBase58(),mintAddress:s.pubkey.toBase58()}})},{when:({programId:e})=>d(e),decode:({instruction:e,programId:n})=>o(()=>{const{keys:{account:t,mint:s}}=l(e,n);return{createATA:{address:t.pubkey.toBase58(),mintAddress:s.pubkey.toBase58()}}})},{when:({programId:e})=>d(e),decode:({instruction:e,programId:n})=>o(()=>{const{keys:{account:t,mint:s}}=A(e,n);return{createATA:{address:t.pubkey.toBase58(),mintAddress:s.pubkey.toBase58()}}})},{when:({programId:e})=>d(e),decode:({instruction:e,programId:n})=>o(()=>{const{keys:{account:t,mint:s}}=m(e,n);return{createATA:{address:t.pubkey.toBase58(),mintAddress:s.pubkey.toBase58()}}})},{when:({programId:e})=>d(e),decode:({instruction:e,programId:n})=>o(()=>{const{keys:{account:t}}=I(e,n);return{tokenAddress:t.pubkey.toBase58()}})},{when:({programId:e})=>d(e),decode:({instruction:e,programId:n})=>o(()=>{const{keys:{account:t}}=y(e,n);return{tokenAddress:t.pubkey.toBase58()}})},{when:({programId:e})=>d(e),decode:({instruction:e,programId:n})=>o(()=>{const{keys:{account:t}}=b(e,n);return{tokenAddress:t.pubkey.toBase58()}})},{when:({programId:e})=>d(e),decode:({instruction:e,programId:n})=>o(()=>{const{keys:{account:t,mint:s}}=i(e,n);return{tokenAddress:t.pubkey.toBase58(),mintAddress:s.pubkey.toBase58()}})},{when:({programId:e})=>d(e),decode:({instruction:e,programId:n})=>o(()=>{const{keys:{account:t,mint:s}}=k(e,n);return{tokenAddress:t.pubkey.toBase58(),mintAddress:s.pubkey.toBase58()}})},{when:({programId:e})=>d(e),decode:({instruction:e,programId:n})=>o(()=>{const{keys:{account:t,mint:s}}=p(e,n);return{tokenAddress:t.pubkey.toBase58(),mintAddress:s.pubkey.toBase58()}})},{when:({programId:e})=>d(e),decode:({instruction:e,programId:n})=>o(()=>{const{keys:{account:t,mint:s}}=B(e,n);return{tokenAddress:t.pubkey.toBase58(),mintAddress:s.pubkey.toBase58()}})}];export{P as DECODERS};
1
+ import{ASSOCIATED_TOKEN_PROGRAM_ID as u,decodeBurnCheckedInstruction as A,decodeBurnInstruction as l,decodeCloseAccountInstruction as p,decodeFreezeAccountInstruction as m,decodeInitializeAccount2Instruction as I,decodeInitializeAccount3Instruction as B,decodeInitializeAccountInstruction as T,decodeInitializeImmutableOwnerInstruction as b,decodeSyncNativeInstruction as h,decodeThawAccountInstruction as w,decodeTransferCheckedInstruction as x,decodeTransferCheckedWithFeeInstruction as P,decodeTransferInstruction as f,getAssociatedTokenAddressSync as C,TOKEN_2022_PROGRAM_ID as r,TOKEN_PROGRAM_ID as i}from"@solana/spl-token";const d=e=>e.equals(i)||e.equals(r),o=e=>{try{return e()}catch{return null}},K=[{when:({programId:e})=>e.equals(u),decode:({ixMeta:e,message:n})=>{const t=e.accountKeyIndexes.map(a=>n.allKeys[a]).filter(Boolean),s=t[1],k=t[2],c=t[3],y=t[5];if(!s&&k&&c){const a=y?.equals(r)??!1;return{createATA:{address:C(c,k,!0,a?r:i,u).toBase58(),mintAddress:c.toBase58()}}}return s&&c?{createATA:{address:s.toBase58(),mintAddress:c.toBase58()}}:null}},{when:({programId:e})=>e.equals(r),decode:({instruction:e,programId:n})=>o(()=>{const{keys:{destination:t,mint:s}}=P(e,n);return{tokenAddress:t.pubkey.toBase58(),mintAddress:s.pubkey.toBase58()}})},{when:({programId:e})=>d(e),decode:({instruction:e,programId:n})=>o(()=>{const{keys:{destination:t}}=f(e,n);return{tokenAddress:t.pubkey.toBase58()}})},{when:({programId:e})=>d(e),decode:({instruction:e,programId:n})=>o(()=>{const{keys:{destination:t,mint:s}}=x(e,n);return{tokenAddress:t.pubkey.toBase58(),mintAddress:s.pubkey.toBase58()}})},{when:({programId:e})=>d(e),decode:({instruction:e,programId:n})=>o(()=>{const{keys:{account:t,mint:s}}=T(e,n);return{createATA:{address:t.pubkey.toBase58(),mintAddress:s.pubkey.toBase58()}}})},{when:({programId:e})=>d(e),decode:({instruction:e,programId:n})=>o(()=>{const{keys:{account:t,mint:s}}=I(e,n);return{createATA:{address:t.pubkey.toBase58(),mintAddress:s.pubkey.toBase58()}}})},{when:({programId:e})=>d(e),decode:({instruction:e,programId:n})=>o(()=>{const{keys:{account:t,mint:s}}=B(e,n);return{createATA:{address:t.pubkey.toBase58(),mintAddress:s.pubkey.toBase58()}}})},{when:({programId:e})=>d(e),decode:({instruction:e,programId:n})=>o(()=>{const{keys:{account:t}}=b(e,n);return{tokenAddress:t.pubkey.toBase58()}})},{when:({programId:e})=>d(e),decode:({instruction:e,programId:n})=>o(()=>{const{keys:{account:t}}=p(e,n);return{tokenAddress:t.pubkey.toBase58()}})},{when:({programId:e})=>d(e),decode:({instruction:e,programId:n})=>o(()=>{const{keys:{account:t}}=h(e,n);return{tokenAddress:t.pubkey.toBase58()}})},{when:({programId:e})=>d(e),decode:({instruction:e,programId:n})=>o(()=>{const{keys:{account:t,mint:s}}=A(e,n);return{tokenAddress:t.pubkey.toBase58(),mintAddress:s.pubkey.toBase58()}})},{when:({programId:e})=>d(e),decode:({instruction:e,programId:n})=>o(()=>{const{keys:{account:t,mint:s}}=l(e,n);return{tokenAddress:t.pubkey.toBase58(),mintAddress:s.pubkey.toBase58()}})},{when:({programId:e})=>d(e),decode:({instruction:e,programId:n})=>o(()=>{const{keys:{account:t,mint:s}}=m(e,n);return{tokenAddress:t.pubkey.toBase58(),mintAddress:s.pubkey.toBase58()}})},{when:({programId:e})=>d(e),decode:({instruction:e,programId:n})=>o(()=>{const{keys:{account:t,mint:s}}=w(e,n);return{tokenAddress:t.pubkey.toBase58(),mintAddress:s.pubkey.toBase58()}})},{when:({programId:e})=>e.equals(u)||e.equals(i)||e.equals(r),decode:()=>({})}];export{K as DECODERS};
2
2
  //# sourceMappingURL=transactionDecoders.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/app-binder/services/utils/transactionDecoders.ts"],
4
- "sourcesContent": ["import {\n ASSOCIATED_TOKEN_PROGRAM_ID,\n decodeBurnCheckedInstruction,\n decodeBurnInstruction,\n decodeCloseAccountInstruction,\n decodeFreezeAccountInstruction,\n decodeInitializeAccount2Instruction,\n decodeInitializeAccount3Instruction,\n decodeInitializeAccountInstruction,\n decodeInitializeImmutableOwnerInstruction,\n decodeSyncNativeInstruction,\n decodeThawAccountInstruction,\n decodeTransferCheckedInstruction,\n decodeTransferCheckedWithFeeInstruction,\n decodeTransferInstruction,\n TOKEN_2022_PROGRAM_ID,\n TOKEN_PROGRAM_ID,\n} from \"@solana/spl-token\";\nimport { type PublicKey, type TransactionInstruction } from \"@solana/web3.js\";\n\nimport {\n type NormalizedCompiledIx,\n type NormalizedMessage,\n type SolanaTransactionTypes,\n} from \"@internal/app-binder/services/TransactionInspector\";\n\nexport interface TxInspectorResult {\n transactionType: SolanaTransactionTypes;\n data: {\n tokenAddress?: string;\n mintAddress?: string;\n createATA?: {\n address: string;\n mintAddress: string;\n };\n };\n}\n\nexport type IxContext = {\n programId: PublicKey;\n ixMeta: NormalizedCompiledIx;\n message: NormalizedMessage;\n instruction: TransactionInstruction;\n};\n\nexport type Decoder = {\n when: (ctx: IxContext) => boolean;\n decode: (ctx: IxContext) => TxInspectorResult[\"data\"] | null;\n};\n\nconst isTokenProgramId = (pid: PublicKey) =>\n pid.equals(TOKEN_PROGRAM_ID) || pid.equals(TOKEN_2022_PROGRAM_ID);\n\nconst safe = <T>(fn: () => T): T | null => {\n try {\n return fn();\n } catch {\n return null;\n }\n};\n\nexport const DECODERS: Decoder[] = [\n // ATA creation (Associated Token Account Program)\n {\n when: ({ programId }) => programId.equals(ASSOCIATED_TOKEN_PROGRAM_ID),\n decode: ({ ixMeta, message }) => {\n const accountPks = ixMeta.accountKeyIndexes\n .map((i) => message.allKeys[i])\n .filter(Boolean) as PublicKey[];\n const ataPk = accountPks[1];\n const mintPk = accountPks[3];\n return ataPk && mintPk\n ? {\n createATA: {\n address: ataPk.toBase58(),\n mintAddress: mintPk.toBase58(),\n },\n }\n : null;\n },\n },\n\n // token-2022 fee'd transfers \u2014 first for Token-2022\n {\n when: ({ programId }) => programId.equals(TOKEN_2022_PROGRAM_ID),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { destination, mint },\n } = decodeTransferCheckedWithFeeInstruction(instruction, programId);\n return {\n tokenAddress: destination.pubkey.toBase58(),\n mintAddress: mint.pubkey.toBase58(),\n };\n }),\n },\n\n // generic SPL decoders (classic & 2022)\n // transfers\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { destination },\n } = decodeTransferInstruction(instruction, programId);\n return { tokenAddress: destination.pubkey.toBase58() };\n }),\n },\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { destination, mint },\n } = decodeTransferCheckedInstruction(instruction, programId);\n return {\n tokenAddress: destination.pubkey.toBase58(),\n mintAddress: mint.pubkey.toBase58(),\n };\n }),\n },\n\n // account initialisation (non-ATA included)\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account, mint },\n } = decodeInitializeAccountInstruction(instruction, programId);\n return {\n createATA: {\n address: account.pubkey.toBase58(),\n mintAddress: mint.pubkey.toBase58(),\n },\n };\n }),\n },\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account, mint },\n } = decodeInitializeAccount2Instruction(instruction, programId);\n return {\n createATA: {\n address: account.pubkey.toBase58(),\n mintAddress: mint.pubkey.toBase58(),\n },\n };\n }),\n },\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account, mint },\n } = decodeInitializeAccount3Instruction(instruction, programId);\n return {\n createATA: {\n address: account.pubkey.toBase58(),\n mintAddress: mint.pubkey.toBase58(),\n },\n };\n }),\n },\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account },\n } = decodeInitializeImmutableOwnerInstruction(instruction, programId);\n return { tokenAddress: account.pubkey.toBase58() };\n }),\n },\n\n // lifecycle / WSOL\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account },\n } = decodeCloseAccountInstruction(instruction, programId);\n return { tokenAddress: account.pubkey.toBase58() };\n }),\n },\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account },\n } = decodeSyncNativeInstruction(instruction, programId);\n return { tokenAddress: account.pubkey.toBase58() };\n }),\n },\n\n // mint / burn\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account, mint },\n } = decodeBurnCheckedInstruction(instruction, programId);\n return {\n tokenAddress: account.pubkey.toBase58(),\n mintAddress: mint.pubkey.toBase58(),\n };\n }),\n },\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account, mint },\n } = decodeBurnInstruction(instruction, programId);\n return {\n tokenAddress: account.pubkey.toBase58(),\n mintAddress: mint.pubkey.toBase58(),\n };\n }),\n },\n\n // freeze / thaw\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account, mint },\n } = decodeFreezeAccountInstruction(instruction, programId);\n return {\n tokenAddress: account.pubkey.toBase58(),\n mintAddress: mint.pubkey.toBase58(),\n };\n }),\n },\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account, mint },\n } = decodeThawAccountInstruction(instruction, programId);\n return {\n tokenAddress: account.pubkey.toBase58(),\n mintAddress: mint.pubkey.toBase58(),\n };\n }),\n },\n];\n"],
5
- "mappings": "AAAA,OACE,+BAAAA,EACA,gCAAAC,EACA,yBAAAC,EACA,iCAAAC,EACA,kCAAAC,EACA,uCAAAC,EACA,uCAAAC,EACA,sCAAAC,EACA,6CAAAC,EACA,+BAAAC,EACA,gCAAAC,EACA,oCAAAC,EACA,2CAAAC,EACA,6BAAAC,EACA,yBAAAC,EACA,oBAAAC,MACK,oBAiCP,MAAMC,EAAoBC,GACxBA,EAAI,OAAOF,CAAgB,GAAKE,EAAI,OAAOH,CAAqB,EAE5DI,EAAWC,GAA0B,CACzC,GAAI,CACF,OAAOA,EAAG,CACZ,MAAQ,CACN,OAAO,IACT,CACF,EAEaC,EAAsB,CAEjC,CACE,KAAM,CAAC,CAAE,UAAAC,CAAU,IAAMA,EAAU,OAAOrB,CAA2B,EACrE,OAAQ,CAAC,CAAE,OAAAsB,EAAQ,QAAAC,CAAQ,IAAM,CAC/B,MAAMC,EAAaF,EAAO,kBACvB,IAAKG,GAAMF,EAAQ,QAAQE,CAAC,CAAC,EAC7B,OAAO,OAAO,EACXC,EAAQF,EAAW,CAAC,EACpBG,EAASH,EAAW,CAAC,EAC3B,OAAOE,GAASC,EACZ,CACE,UAAW,CACT,QAASD,EAAM,SAAS,EACxB,YAAaC,EAAO,SAAS,CAC/B,CACF,EACA,IACN,CACF,EAGA,CACE,KAAM,CAAC,CAAE,UAAAN,CAAU,IAAMA,EAAU,OAAOP,CAAqB,EAC/D,OAAQ,CAAC,CAAE,YAAAc,EAAa,UAAAP,CAAU,IAChCH,EAAK,IAAM,CACT,KAAM,CACJ,KAAM,CAAE,YAAAW,EAAa,KAAAC,CAAK,CAC5B,EAAIlB,EAAwCgB,EAAaP,CAAS,EAClE,MAAO,CACL,aAAcQ,EAAY,OAA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EAAaP,CAAS,EACvD,MAAO,CACL,aAAcU,EAAQ,OAAO,SAAS,EACtC,YAAaD,EAAK,OAAO,SAAS,CACpC,CACF,CAAC,CACL,CACF",
6
- "names": ["ASSOCIATED_TOKEN_PROGRAM_ID", "decodeBurnCheckedInstruction", "decodeBurnInstruction", "decodeCloseAccountInstruction", "decodeFreezeAccountInstruction", "decodeInitializeAccount2Instruction", "decodeInitializeAccount3Instruction", "decodeInitializeAccountInstruction", "decodeInitializeImmutableOwnerInstruction", "decodeSyncNativeInstruction", "decodeThawAccountInstruction", "decodeTransferCheckedInstruction", "decodeTransferCheckedWithFeeInstruction", "decodeTransferInstruction", "TOKEN_2022_PROGRAM_ID", "TOKEN_PROGRAM_ID", "isTokenProgramId", "pid", "safe", "fn", "DECODERS", "programId", "ixMeta", "message", "accountPks", "i", "ataPk", "mintPk", "instruction", "destination", "mint", "account"]
4
+ "sourcesContent": ["import {\n ASSOCIATED_TOKEN_PROGRAM_ID,\n decodeBurnCheckedInstruction,\n decodeBurnInstruction,\n decodeCloseAccountInstruction,\n decodeFreezeAccountInstruction,\n decodeInitializeAccount2Instruction,\n decodeInitializeAccount3Instruction,\n decodeInitializeAccountInstruction,\n decodeInitializeImmutableOwnerInstruction,\n decodeSyncNativeInstruction,\n decodeThawAccountInstruction,\n decodeTransferCheckedInstruction,\n decodeTransferCheckedWithFeeInstruction,\n decodeTransferInstruction,\n getAssociatedTokenAddressSync,\n TOKEN_2022_PROGRAM_ID,\n TOKEN_PROGRAM_ID,\n} from \"@solana/spl-token\";\nimport { type PublicKey, type TransactionInstruction } from \"@solana/web3.js\";\n\nimport {\n type NormalizedCompiledIx,\n type NormalizedMessage,\n type SolanaTransactionTypes,\n} from \"@internal/app-binder/services/TransactionInspector\";\n\nexport interface TxInspectorResult {\n transactionType: SolanaTransactionTypes;\n data: {\n tokenAddress?: string;\n mintAddress?: string;\n createATA?: { address: string; mintAddress: string };\n };\n}\n\nexport type IxContext = {\n programId: PublicKey;\n ixMeta: NormalizedCompiledIx;\n message: NormalizedMessage;\n instruction: TransactionInstruction;\n};\n\nexport type Decoder = {\n when: (ctx: IxContext) => boolean;\n decode: (ctx: IxContext) => TxInspectorResult[\"data\"] | null;\n};\n\nconst isTokenProgramId = (pid: PublicKey) =>\n pid.equals(TOKEN_PROGRAM_ID) || pid.equals(TOKEN_2022_PROGRAM_ID);\n\nconst safe = <T>(fn: () => T): T | null => {\n try {\n return fn();\n } catch {\n return null;\n }\n};\n\nexport const DECODERS: Decoder[] = [\n // ATA creation (with derivation fallback)\n {\n when: ({ programId }) => programId.equals(ASSOCIATED_TOKEN_PROGRAM_ID),\n decode: ({ ixMeta, message }) => {\n const accountPks = ixMeta.accountKeyIndexes\n .map((i) => message.allKeys[i])\n .filter(Boolean) as PublicKey[];\n\n // Canonical indices for create ATA:\n // [0] payer, [1] ata, [2] owner, [3] mint, [4] system, [5] token program, [6] rent? (optional)\n const ataPk = accountPks[1];\n const ownerPk = accountPks[2];\n const mintPk = accountPks[3];\n const tokenProgramPk = accountPks[5];\n\n // If ata is missing but we have owner+mint, derive it.\n if (!ataPk && ownerPk && mintPk) {\n const isToken2022 =\n tokenProgramPk?.equals(TOKEN_2022_PROGRAM_ID) ?? false;\n const derived = getAssociatedTokenAddressSync(\n mintPk,\n ownerPk,\n true, // allowOwnerOffCurve: owners can be PDAs\n isToken2022 ? TOKEN_2022_PROGRAM_ID : TOKEN_PROGRAM_ID,\n ASSOCIATED_TOKEN_PROGRAM_ID,\n );\n return {\n createATA: {\n address: derived.toBase58(),\n mintAddress: mintPk.toBase58(),\n },\n };\n }\n\n return ataPk && mintPk\n ? {\n createATA: {\n address: ataPk.toBase58(),\n mintAddress: mintPk.toBase58(),\n },\n }\n : null;\n },\n },\n\n // Token-2022 fee\u2019d transfer (CWIF)\n {\n when: ({ programId }) => programId.equals(TOKEN_2022_PROGRAM_ID),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { destination, mint },\n } = decodeTransferCheckedWithFeeInstruction(instruction, programId);\n return {\n tokenAddress: destination.pubkey.toBase58(),\n mintAddress: mint.pubkey.toBase58(),\n };\n }),\n },\n\n // Transfers\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { destination },\n } = decodeTransferInstruction(instruction, programId);\n return { tokenAddress: destination.pubkey.toBase58() };\n }),\n },\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { destination, mint },\n } = decodeTransferCheckedInstruction(instruction, programId);\n return {\n tokenAddress: destination.pubkey.toBase58(),\n mintAddress: mint.pubkey.toBase58(),\n };\n }),\n },\n\n // Account init\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account, mint },\n } = decodeInitializeAccountInstruction(instruction, programId);\n return {\n createATA: {\n address: account.pubkey.toBase58(),\n mintAddress: mint.pubkey.toBase58(),\n },\n };\n }),\n },\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account, mint },\n } = decodeInitializeAccount2Instruction(instruction, programId);\n return {\n createATA: {\n address: account.pubkey.toBase58(),\n mintAddress: mint.pubkey.toBase58(),\n },\n };\n }),\n },\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account, mint },\n } = decodeInitializeAccount3Instruction(instruction, programId);\n return {\n createATA: {\n address: account.pubkey.toBase58(),\n mintAddress: mint.pubkey.toBase58(),\n },\n };\n }),\n },\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account },\n } = decodeInitializeImmutableOwnerInstruction(instruction, programId);\n return { tokenAddress: account.pubkey.toBase58() };\n }),\n },\n\n // Lifecycle / WSOL\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account },\n } = decodeCloseAccountInstruction(instruction, programId);\n return { tokenAddress: account.pubkey.toBase58() };\n }),\n },\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account },\n } = decodeSyncNativeInstruction(instruction, programId);\n return { tokenAddress: account.pubkey.toBase58() };\n }),\n },\n\n // Mint / Burn\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account, mint },\n } = decodeBurnCheckedInstruction(instruction, programId);\n return {\n tokenAddress: account.pubkey.toBase58(),\n mintAddress: mint.pubkey.toBase58(),\n };\n }),\n },\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account, mint },\n } = decodeBurnInstruction(instruction, programId);\n return {\n tokenAddress: account.pubkey.toBase58(),\n mintAddress: mint.pubkey.toBase58(),\n };\n }),\n },\n\n // Freeze / Thaw\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account, mint },\n } = decodeFreezeAccountInstruction(instruction, programId);\n return {\n tokenAddress: account.pubkey.toBase58(),\n mintAddress: mint.pubkey.toBase58(),\n };\n }),\n },\n {\n when: ({ programId }) => isTokenProgramId(programId),\n decode: ({ instruction, programId }) =>\n safe(() => {\n const {\n keys: { account, mint },\n } = decodeThawAccountInstruction(instruction, programId);\n return {\n tokenAddress: account.pubkey.toBase58(),\n mintAddress: mint.pubkey.toBase58(),\n };\n }),\n },\n\n // LAST-RESORT: tag as SPL by program id only (when decoders can't run)\n {\n when: ({ programId }) =>\n programId.equals(ASSOCIATED_TOKEN_PROGRAM_ID) ||\n programId.equals(TOKEN_PROGRAM_ID) ||\n programId.equals(TOKEN_2022_PROGRAM_ID),\n decode: () => ({}),\n },\n];\n"],
5
+ "mappings": "AAAA,OACE,+BAAAA,EACA,gCAAAC,EACA,yBA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AU,IAChCH,EAAK,IAAM,CACT,KAAM,CACJ,KAAM,CAAE,QAAAgB,EAAS,KAAAD,CAAK,CACxB,EAAIxB,EAA6BsB,EAAaV,CAAS,EACvD,MAAO,CACL,aAAca,EAAQ,OAAO,SAAS,EACtC,YAAaD,EAAK,OAAO,SAAS,CACpC,CACF,CAAC,CACL,EAGA,CACE,KAAM,CAAC,CAAE,UAAAZ,CAAU,IACjBA,EAAU,OAAOtB,CAA2B,GAC5CsB,EAAU,OAAON,CAAgB,GACjCM,EAAU,OAAOP,CAAqB,EACxC,OAAQ,KAAO,CAAC,EAClB,CACF",
6
+ "names": ["ASSOCIATED_TOKEN_PROGRAM_ID", "decodeBurnCheckedInstruction", "decodeBurnInstruction", "decodeCloseAccountInstruction", "decodeFreezeAccountInstruction", "decodeInitializeAccount2Instruction", "decodeInitializeAccount3Instruction", "decodeInitializeAccountInstruction", "decodeInitializeImmutableOwnerInstruction", "decodeSyncNativeInstruction", "decodeThawAccountInstruction", "decodeTransferCheckedInstruction", "decodeTransferCheckedWithFeeInstruction", "decodeTransferInstruction", "getAssociatedTokenAddressSync", "TOKEN_2022_PROGRAM_ID", "TOKEN_PROGRAM_ID", "isTokenProgramId", "pid", "safe", "fn", "DECODERS", "programId", "ixMeta", "message", "accountPks", "i", "ataPk", "ownerPk", "mintPk", "tokenProgramPk", "isToken2022", "instruction", "destination", "mint", "account"]
7
7
  }
@@ -1,4 +1,5 @@
1
- import { type PublicKey } from "@solana/web3.js";
1
+ import { // runtime import so we can instantiate it
2
+ type PublicKey } from "@solana/web3.js";
2
3
  import { type TxInspectorResult } from "../../app-binder/services/utils/transactionDecoders";
3
4
  export declare enum SolanaTransactionTypes {
4
5
  STANDARD = "Standard",
@@ -16,10 +17,10 @@ export type NormalizedMessage = {
16
17
  export declare class TransactionInspector {
17
18
  private readonly rawTransactionBytes;
18
19
  constructor(rawTransactionBytes: Uint8Array);
19
- inspectTransactionType(): TxInspectorResult;
20
+ inspectTransactionType(): Promise<TxInspectorResult>;
20
21
  /**
21
22
  * Normalise any tx (legacy or v0) into { compiledInstructions, allKeys }.
22
- * If LUT accounts are provided, looked-up keys are included in allKeys.
23
+ * For v0, we auto-fetch looked-up addresses from ALT(s) via the baked-in connection.
23
24
  */
24
25
  private normaliseMessage;
25
26
  private tryDeserialiseVersioned;
@@ -1 +1 @@
1
- {"version":3,"file":"TransactionInspector.d.ts","sourceRoot":"","sources":["../../../../../src/internal/app-binder/services/TransactionInspector.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,SAAS,EAKf,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,yDAAyD,CAAC;AAEjE,oBAAY,sBAAsB;IAChC,QAAQ,aAAa;IACrB,GAAG,QAAQ;CACZ;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,IAAI,EAAE,UAAU,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,oBAAoB,EAAE,oBAAoB,EAAE,CAAC;IAC7C,OAAO,EAAE,SAAS,EAAE,CAAC;CACtB,CAAC;AAIF,qBAAa,oBAAoB;IACnB,OAAO,CAAC,QAAQ,CAAC,mBAAmB;gBAAnB,mBAAmB,EAAE,UAAU;IAErD,sBAAsB,IAAI,iBAAiB;IA6ClD;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAyFxB,OAAO,CAAC,uBAAuB;CAehC"}
1
+ {"version":3,"file":"TransactionInspector.d.ts","sourceRoot":"","sources":["../../../../../src/internal/app-binder/services/TransactionInspector.ts"],"names":[],"mappings":"AAKA,OAAO,EACO,0CAA0C;AACtD,KAAK,SAAS,EAKf,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,yDAAyD,CAAC;AAEjE,oBAAY,sBAAsB;IAChC,QAAQ,aAAa;IACrB,GAAG,QAAQ;CACZ;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,IAAI,EAAE,UAAU,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,oBAAoB,EAAE,oBAAoB,EAAE,CAAC;IAC7C,OAAO,EAAE,SAAS,EAAE,CAAC;CACtB,CAAC;AAcF,qBAAa,oBAAoB;IACnB,OAAO,CAAC,QAAQ,CAAC,mBAAmB;gBAAnB,mBAAmB,EAAE,UAAU;IAE/C,sBAAsB,IAAI,OAAO,CAAC,iBAAiB,CAAC;IA4CjE;;;OAGG;YACW,gBAAgB;IA0F9B,OAAO,CAAC,uBAAuB;CAehC"}
@@ -1,2 +1 @@
1
- export {};
2
1
  //# sourceMappingURL=TransactionInspector.test.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transactionDecoders.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/app-binder/services/utils/transactionDecoders.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAE9E,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC5B,MAAM,oDAAoD,CAAC;AAE5D,MAAM,WAAW,iBAAiB;IAChC,eAAe,EAAE,sBAAsB,CAAC;IACxC,IAAI,EAAE;QACJ,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,SAAS,CAAC,EAAE;YACV,OAAO,EAAE,MAAM,CAAC;YAChB,WAAW,EAAE,MAAM,CAAC;SACrB,CAAC;KACH,CAAC;CACH;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,SAAS,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,oBAAoB,CAAC;IAC7B,OAAO,EAAE,iBAAiB,CAAC;IAC3B,WAAW,EAAE,sBAAsB,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,IAAI,EAAE,CAAC,GAAG,EAAE,SAAS,KAAK,OAAO,CAAC;IAClC,MAAM,EAAE,CAAC,GAAG,EAAE,SAAS,KAAK,iBAAiB,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;CAC9D,CAAC;AAaF,eAAO,MAAM,QAAQ,EAAE,OAAO,EAoM7B,CAAC"}
1
+ {"version":3,"file":"transactionDecoders.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/app-binder/services/utils/transactionDecoders.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAE9E,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC5B,MAAM,oDAAoD,CAAC;AAE5D,MAAM,WAAW,iBAAiB;IAChC,eAAe,EAAE,sBAAsB,CAAC;IACxC,IAAI,EAAE;QACJ,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,SAAS,CAAC,EAAE;YAAE,OAAO,EAAE,MAAM,CAAC;YAAC,WAAW,EAAE,MAAM,CAAA;SAAE,CAAC;KACtD,CAAC;CACH;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,SAAS,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,oBAAoB,CAAC;IAC7B,OAAO,EAAE,iBAAiB,CAAC;IAC3B,WAAW,EAAE,sBAAsB,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,IAAI,EAAE,CAAC,GAAG,EAAE,SAAS,KAAK,OAAO,CAAC;IAClC,MAAM,EAAE,CAAC,GAAG,EAAE,SAAS,KAAK,iBAAiB,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;CAC9D,CAAC;AAaF,eAAO,MAAM,QAAQ,EAAE,OAAO,EAqO7B,CAAC"}