2025-06-21 23:30:33 +03:00

1 line
1.5 KiB
Plaintext

{"version":3,"sources":["../src/program-error.ts"],"names":["isSolanaError","SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM"],"mappings":";;;;;AAGO,SAAS,cACZ,CAAA,KAAA,EACA,kBACA,EAAA,cAAA,EACA,IAE4D,EAAA;AAC5D,EAAA,IAAI,CAACA,oBAAA,CAAc,KAAO,EAAAC,8CAAuC,CAAG,EAAA;AAChE,IAAO,OAAA,KAAA,CAAA;AAAA,GACX;AACA,EAAA,MAAM,4BAA4B,kBAAmB,CAAA,YAAA,CAAa,KAAM,CAAA,OAAA,CAAQ,KAAK,CAAG,EAAA,cAAA,CAAA;AACxF,EAAI,IAAA,CAAC,yBAA6B,IAAA,yBAAA,KAA8B,cAAgB,EAAA;AAC5E,IAAO,OAAA,KAAA,CAAA;AAAA,GACX;AACA,EAAA,OAAO,OAAO,IAAA,KAAS,WAAe,IAAA,KAAA,CAAM,QAAQ,IAAS,KAAA,IAAA,CAAA;AACjE","file":"index.node.cjs","sourcesContent":["import type { Address } from '@solana/addresses';\nimport { isSolanaError, SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM, SolanaError } from '@solana/errors';\n\nexport function isProgramError<TProgramErrorCode extends number>(\n error: unknown,\n transactionMessage: { instructions: Record<number, { programAddress: Address }> },\n programAddress: Address,\n code?: TProgramErrorCode,\n): error is Readonly<{ context: Readonly<{ code: TProgramErrorCode }> }> &\n SolanaError<typeof SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM> {\n if (!isSolanaError(error, SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM)) {\n return false;\n }\n const instructionProgramAddress = transactionMessage.instructions[error.context.index]?.programAddress;\n if (!instructionProgramAddress || instructionProgramAddress !== programAddress) {\n return false;\n }\n return typeof code === 'undefined' || error.context.code === code;\n}\n"]}