@ledgerhq/device-signer-kit-solana 0.0.0-patch-transactionInspector-20250911081347 → 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.
- package/lib/cjs/internal/app-binder/services/TransactionInspector.js +1 -1
- package/lib/cjs/internal/app-binder/services/TransactionInspector.js.map +3 -3
- package/lib/cjs/internal/app-binder/services/TransactionInspector.test.js +1 -1
- package/lib/cjs/internal/app-binder/services/TransactionInspector.test.js.map +4 -4
- package/lib/cjs/internal/app-binder/services/utils/transactionDecoders.js +1 -1
- package/lib/cjs/internal/app-binder/services/utils/transactionDecoders.js.map +3 -3
- package/lib/esm/internal/app-binder/services/TransactionInspector.js +1 -1
- package/lib/esm/internal/app-binder/services/TransactionInspector.js.map +3 -3
- package/lib/esm/internal/app-binder/services/TransactionInspector.test.js +0 -1
- package/lib/esm/internal/app-binder/services/TransactionInspector.test.js.map +4 -4
- package/lib/esm/internal/app-binder/services/utils/transactionDecoders.js +1 -1
- package/lib/esm/internal/app-binder/services/utils/transactionDecoders.js.map +3 -3
- package/lib/types/internal/app-binder/services/TransactionInspector.d.ts +4 -3
- package/lib/types/internal/app-binder/services/TransactionInspector.d.ts.map +1 -1
- package/lib/types/internal/app-binder/services/TransactionInspector.test.d.ts +0 -1
- package/lib/types/internal/app-binder/services/utils/transactionDecoders.d.ts.map +1 -1
- package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
- package/package.json +7 -7
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var I=Object.defineProperty;var
|
|
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 ASSOCIATED_TOKEN_PROGRAM_ID,\n TOKEN_2022_PROGRAM_ID,\n TOKEN_PROGRAM_ID,\n} from \"@solana/spl-token\";\nimport {\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 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 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
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4BAAAE,EAAA,yBAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAIO,6BACPC,
|
|
6
|
-
"names": ["TransactionInspector_exports", "__export", "SolanaTransactionTypes", "TransactionInspector", "__toCommonJS", "import_spl_token", "import_web3", "import_buffer", "import_transactionDecoders", "isSPLProgramId", "pid", "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,EAA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"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";
|
|
1
|
+
"use strict";
|
|
2
2
|
//# sourceMappingURL=TransactionInspector.test.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": [
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": [
|
|
3
|
+
"sources": [],
|
|
4
|
+
"sourcesContent": [],
|
|
5
|
+
"mappings": "",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
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?: { 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\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\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,
|
|
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,EAAoB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,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{ASSOCIATED_TOKEN_PROGRAM_ID as
|
|
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 ASSOCIATED_TOKEN_PROGRAM_ID,\n TOKEN_2022_PROGRAM_ID,\n TOKEN_PROGRAM_ID,\n} from \"@solana/spl-token\";\nimport {\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 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 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
|
|
5
|
-
"mappings": "AAAA,OACE,+BAAAA,EACA,yBAAAC,EACA,oBAAAC,MACK,oBACP,
|
|
6
|
-
"names": ["ASSOCIATED_TOKEN_PROGRAM_ID", "TOKEN_2022_PROGRAM_ID", "TOKEN_PROGRAM_ID", "Transaction", "TransactionInstruction", "VersionedMessage", "VersionedTransaction", "Buffer", "DECODERS", "SolanaTransactionTypes", "isSPLProgramId", "pid", "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,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,EAAQ,QAAQI,CAAC,CAAC,EAC7B,OAAQC,GAA0B,CAAC,CAACA,CAAG,EAGpCC,EAAc,IAAIlB,EAAuB,CAC7C,UAAAc,EACA,KAAMC,EAAa,IAAKE,IAAS,CAC/B,OAAQA,EACR,SAAU,GACV,WAAY,EACd,EAAE,EACF,KAAMd,EAAO,KAAKU,EAAO,IAAI,CAC/B,CAAC,EAEKM,EAAiB,CAAE,UAAAL,EAAW,OAAAD,EAAQ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MC,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": [
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": [
|
|
3
|
+
"sources": [],
|
|
4
|
+
"sourcesContent": [],
|
|
5
|
+
"mappings": "",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ASSOCIATED_TOKEN_PROGRAM_ID as
|
|
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?: { 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\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\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,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,oBA8BP,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,
|
|
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", "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,yBAAAC,EACA,iCAAAC,EACA,kCAAAC,EACA,uCAAAC,EACA,uCAAAC,EACA,sCAAAC,EACA,6CAAAC,EACA,+BAAAC,EACA,gCAAAC,EACA,oCAAAC,EACA,2CAAAC,EACA,6BAAAC,EACA,iCAAAC,EACA,yBAAAC,EACA,oBAAAC,MACK,oBA8BP,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,OAAOtB,CAA2B,EACrE,OAAQ,CAAC,CAAE,OAAAuB,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,EAC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CAAK,CACxB,EAAIhC,EAAsB8B,EAAaV,CAAS,EAChD,MAAO,CACL,aAAca,EAAQ,OAAO,SAAS,EACtC,YAAaD,EAAK,OAAO,SAAS,CACpC,CACF,CAAC,CACL,EAGA,CACE,KAAM,CAAC,CAAE,UAAAZ,CAAU,IAAML,EAAiBK,CAAS,EACnD,OAAQ,CAAC,CAAE,YAAAU,EAAa,UAAAV,CAAU,IAChCH,EAAK,IAAM,CACT,KAAM,CACJ,KAAM,CAAE,QAAAgB,EAAS,KAAAD,CAAK,CACxB,EAAI9B,EAA+B4B,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,IAAML,EAAiBK,CAAS,EACnD,OAAQ,CAAC,CAAE,YAAAU,EAAa,UAAAV,CAAU,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 {
|
|
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
|
-
*
|
|
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":"AAKA,OAAO,
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transactionDecoders.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/app-binder/services/utils/transactionDecoders.ts"],"names":[],"mappings":"
|
|
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"}
|