@liquid-af/sdk 0.9.1 → 0.10.0

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,4 +1,4 @@
1
1
  export type { TokenCreatedEvent, TradeEvent, MigrationCompletedEvent, CurveCompletedEvent, BondingCurveBuybackExecutedEvent, ReferralRewardsWithdrawnEvent, BondingCurveProtocolPausedEvent, BondingCurveProtocolUnpausedEvent, BuyAmounts, SellAmounts, TradeAmounts, SwapEvent, LpChangeEvent, PoolCreatedEvent, AmmBuybackExecutedEvent, AmmProtocolPausedEvent, AmmProtocolUnpausedEvent, FeesDistributedEvent, FeesClaimedEvent, FeeConfigRevokedEvent, FeeConfigUpdatedEvent, FeeConfigAuthorityOverriddenEvent, DealCreatedEvent, DealUpdatedEvent, DealClosedEvent, DealRedeemedEvent, SnapshotTakenEvent, UserUpdatedByAdminEvent, ReferrerSetEvent, CashbackModeActivatedEvent, CashbackEarnedEvent, CashbackSpentEvent, LiquidEventMap, LiquidEventName, } from "./types.js";
2
- export { parseTransactionEvents, addEventListener, waitForEvent, } from "./parser.js";
2
+ export { parseTransactionEvents, waitForEvent } from "./parser.js";
3
3
  export type { ParsedEvent } from "./parser.js";
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/events/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAEX,iBAAiB,EACjB,UAAU,EACV,uBAAuB,EACvB,mBAAmB,EACnB,gCAAgC,EAChC,6BAA6B,EAC7B,+BAA+B,EAC/B,iCAAiC,EACjC,UAAU,EACV,WAAW,EACX,YAAY,EAEZ,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,uBAAuB,EACvB,sBAAsB,EACtB,wBAAwB,EAExB,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,iCAAiC,EAEjC,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,EAChB,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,EAElB,cAAc,EACd,eAAe,GACf,MAAM,YAAY,CAAC;AAEpB,OAAO,EACN,sBAAsB,EACtB,gBAAgB,EAChB,YAAY,GACZ,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/events/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAEX,iBAAiB,EACjB,UAAU,EACV,uBAAuB,EACvB,mBAAmB,EACnB,gCAAgC,EAChC,6BAA6B,EAC7B,+BAA+B,EAC/B,iCAAiC,EACjC,UAAU,EACV,WAAW,EACX,YAAY,EAEZ,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,uBAAuB,EACvB,sBAAsB,EACtB,wBAAwB,EAExB,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,iCAAiC,EAEjC,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,EAChB,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,EAElB,cAAc,EACd,eAAe,GACf,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACnE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC"}
@@ -1,2 +1,2 @@
1
- export { parseTransactionEvents, addEventListener, waitForEvent, } from "./parser.js";
1
+ export { parseTransactionEvents, waitForEvent } from "./parser.js";
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/events/index.ts"],"names":[],"mappings":"AA0CA,OAAO,EACN,sBAAsB,EACtB,gBAAgB,EAChB,YAAY,GACZ,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/events/index.ts"],"names":[],"mappings":"AA0CA,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { type Program } from "@coral-xyz/anchor";
2
+ import { type TransactionResponse, type VersionedTransactionResponse } from "@solana/web3.js";
2
3
  import type { LiquidEvents } from "../idl/liquid_events.js";
3
4
  import type { LiquidEventMap, LiquidEventName } from "./types.js";
4
5
  /** Parsed event with name and data */
@@ -7,31 +8,23 @@ export interface ParsedEvent<T = unknown> {
7
8
  data: T;
8
9
  }
9
10
  /**
10
- * Parses events from transaction logs for the liquid-events program.
11
- * Unlike Anchor's built-in EventParser, this correctly identifies events
12
- * from programs invoked via CPI (not just top-level invocations).
11
+ * Parses events from a transaction by inspecting inner instructions
12
+ * (CPI calls to the liquid-events program) instead of transaction logs.
13
13
  *
14
- * @param logs - Transaction log messages
15
- * @param program - The liquid-events program instance
16
- * @returns Array of parsed events
17
- */
18
- export declare const parseTransactionEvents: (logs: string[], program: Program<LiquidEvents>) => ParsedEvent[];
19
- /**
20
- * Registers an event listener on the liquid-events program.
21
- * Returns the listener ID (use program.removeEventListener to unsubscribe).
14
+ * This approach is immune to log bleaching attacks since event data is
15
+ * encoded in the instruction data of CPI calls, not in transaction logs.
22
16
  *
17
+ * @param transaction - Full transaction response (from getTransaction)
23
18
  * @param program - The liquid-events program instance
24
- * @param eventName - Name of the event to listen for
25
- * @param callback - Handler called when event is received
26
- * @returns Listener ID for removal
19
+ * @returns Array of parsed events
27
20
  */
28
- export declare const addEventListener: <N extends LiquidEventName>(program: Program<LiquidEvents>, eventName: N, callback: (event: LiquidEventMap[N]) => void) => number;
21
+ export declare const parseTransactionEvents: (transaction: TransactionResponse | VersionedTransactionResponse | null | undefined, program: Program<LiquidEvents>) => ParsedEvent[];
29
22
  /**
30
- * Subscribes to logs via WebSocket, fires a trigger, and polls until the
31
- * event arrives or the timeout is exceeded.
23
+ * Subscribes to logs to capture the transaction signature, fires a trigger,
24
+ * then fetches the full transaction to parse events from inner instructions.
32
25
  *
33
- * Uses CPI-aware log parsing so events emitted by programs that are only
34
- * invoked via CPI (e.g., the centralized events program) are correctly detected.
26
+ * Immune to log bleaching: event data is decoded from CPI instruction data,
27
+ * not from transaction logs.
35
28
  *
36
29
  * @param program - The liquid-events program instance
37
30
  * @param eventName - Name of the event to wait for
@@ -1 +1 @@
1
- {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/events/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElE,sCAAsC;AACtC,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,OAAO;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,CAAC,CAAC;CACR;AAOD;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,GAClC,MAAM,MAAM,EAAE,EACd,SAAS,OAAO,CAAC,YAAY,CAAC,KAC5B,WAAW,EAMb,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,eAAe,EACzD,SAAS,OAAO,CAAC,YAAY,CAAC,EAC9B,WAAW,CAAC,EACZ,UAAU,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,KAAK,IAAI,KAC1C,MAOF,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAsB,YAAY,CAAC,CAAC,SAAS,eAAe,EAAE,OAAO,GAAG,MAAM,EAC7E,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,EAC9B,SAAS,EAAE,CAAC,EACZ,OAAO,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,EAC/B,SAAS,SAAO,GACd,OAAO,CAAC;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,CAAA;CAAE,CAAC,CAkCxD"}
1
+ {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/events/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,OAAO,EAAS,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EACN,KAAK,mBAAmB,EACxB,KAAK,4BAA4B,EAEjC,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElE,sCAAsC;AACtC,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,OAAO;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,CAAC,CAAC;CACR;AAuCD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sBAAsB,GAClC,aACG,mBAAmB,GACnB,4BAA4B,GAC5B,IAAI,GACJ,SAAS,EACZ,SAAS,OAAO,CAAC,YAAY,CAAC,KAC5B,WAAW,EA0Cb,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAsB,YAAY,CACjC,CAAC,SAAS,eAAe,EACzB,OAAO,GAAG,MAAM,EAEhB,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,EAC9B,SAAS,EAAE,CAAC,EACZ,OAAO,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,EAC/B,SAAS,SAAO,GACd,OAAO,CAAC;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,CAAA;CAAE,CAAC,CAwDxD"}
@@ -1,43 +1,96 @@
1
- import { BorshCoder } from "@coral-xyz/anchor";
2
- const PROGRAM_DATA = "Program data: ";
3
- const PROGRAM_LOG = "Program log: ";
4
- const INVOKE_RE = /^Program ([1-9A-HJ-NP-Za-km-z]+) invoke \[(\d+)\]$/;
5
- const EXIT_RE = /^Program ([1-9A-HJ-NP-Za-km-z]+) (success|failed)/;
1
+ import { BorshCoder, utils } from "@coral-xyz/anchor";
2
+ import { PublicKey } from "@solana/web3.js";
6
3
  /**
7
- * Parses events from transaction logs for the liquid-events program.
8
- * Unlike Anchor's built-in EventParser, this correctly identifies events
9
- * from programs invoked via CPI (not just top-level invocations).
10
- *
11
- * @param logs - Transaction log messages
12
- * @param program - The liquid-events program instance
13
- * @returns Array of parsed events
4
+ * Maps IDL instruction names (snake_case) to LiquidEventMap keys (camelCase).
5
+ * Anchor's BorshCoder.instruction.decode() returns camelCase names, so this
6
+ * maps those decoded names to our event type keys.
14
7
  */
15
- export const parseTransactionEvents = (logs, program) => {
16
- return parseCpiLogs(logs, program.programId.toString(), new BorshCoder(program.idl));
8
+ const INSTRUCTION_TO_EVENT = {
9
+ logTokenCreated: "tokenCreated",
10
+ logTrade: "tradeEvent",
11
+ logMigrationCompleted: "migrationCompleted",
12
+ logCurveCompleted: "curveCompleted",
13
+ logCurveBuyback: "curveBuybackExecuted",
14
+ logReferralWithdrawn: "referralRewardsWithdrawn",
15
+ logCurvePaused: "curveProtocolPaused",
16
+ logCurveUnpaused: "curveProtocolUnpaused",
17
+ logPoolCreated: "poolCreated",
18
+ logSwap: "swapEvent",
19
+ logLpChange: "lpChangeEvent",
20
+ logAmmBuyback: "ammBuybackExecuted",
21
+ logAmmPaused: "ammProtocolPaused",
22
+ logAmmUnpaused: "ammProtocolUnpaused",
23
+ logFeesDistributed: "feesDistributed",
24
+ logFeesClaimed: "feesClaimed",
25
+ logFeeConfigRevoked: "feeConfigRevoked",
26
+ logFeeConfigUpdated: "feeConfigUpdated",
27
+ logFeeConfigAuthorityOverridden: "feeConfigAuthorityOverridden",
28
+ logDealCreated: "dealCreated",
29
+ logDealUpdated: "dealUpdated",
30
+ logDealClosed: "dealClosed",
31
+ logDealRedeemed: "dealRedeemed",
32
+ logSnapshotTaken: "snapshotTaken",
33
+ logUserUpdated: "userUpdatedByAdmin",
34
+ logReferrerSet: "referrerSet",
35
+ logCashbackMode: "cashbackModeActivated",
36
+ logCashbackEarned: "cashbackEarned",
37
+ logCashbackSpent: "cashbackSpent",
17
38
  };
18
39
  /**
19
- * Registers an event listener on the liquid-events program.
20
- * Returns the listener ID (use program.removeEventListener to unsubscribe).
40
+ * Parses events from a transaction by inspecting inner instructions
41
+ * (CPI calls to the liquid-events program) instead of transaction logs.
42
+ *
43
+ * This approach is immune to log bleaching attacks since event data is
44
+ * encoded in the instruction data of CPI calls, not in transaction logs.
21
45
  *
46
+ * @param transaction - Full transaction response (from getTransaction)
22
47
  * @param program - The liquid-events program instance
23
- * @param eventName - Name of the event to listen for
24
- * @param callback - Handler called when event is received
25
- * @returns Listener ID for removal
48
+ * @returns Array of parsed events
26
49
  */
27
- export const addEventListener = (program, eventName, callback) => {
28
- // Cast needed: Anchor's IdlEvents types differ structurally from our
29
- // hand-written interfaces (e.g. enum variant wrapping), but the runtime
30
- // data is identical.
31
- return program.addEventListener(eventName, (data) => {
32
- callback(data);
33
- });
50
+ export const parseTransactionEvents = (transaction, program) => {
51
+ if (!transaction?.meta?.innerInstructions)
52
+ return [];
53
+ const coder = new BorshCoder(program.idl);
54
+ const programId = program.programId;
55
+ const events = [];
56
+ // Get account keys from the transaction message
57
+ const message = transaction.transaction.message;
58
+ const accountKeys = "staticAccountKeys" in message
59
+ ? message.staticAccountKeys
60
+ : message.accountKeys;
61
+ for (const innerIxGroup of transaction.meta.innerInstructions) {
62
+ for (const innerIx of innerIxGroup.instructions) {
63
+ // Check if this inner instruction targets the events program
64
+ const ixProgramKey = accountKeys[innerIx.programIdIndex];
65
+ if (!ixProgramKey || !programId.equals(new PublicKey(ixProgramKey)))
66
+ continue;
67
+ // Decode the instruction data (base58-encoded in RPC responses)
68
+ const rawData = utils.bytes.bs58.decode(innerIx.data);
69
+ if (rawData.length < 8)
70
+ continue;
71
+ // Use Anchor's instruction coder to decode
72
+ const decoded = coder.instruction.decode(Buffer.from(rawData));
73
+ if (!decoded)
74
+ continue;
75
+ // Map instruction name to event name
76
+ const eventName = INSTRUCTION_TO_EVENT[decoded.name];
77
+ if (!eventName)
78
+ continue;
79
+ // The instruction has a single "data" argument containing the event struct
80
+ events.push({
81
+ name: eventName,
82
+ data: decoded.data.data,
83
+ });
84
+ }
85
+ }
86
+ return events;
34
87
  };
35
88
  /**
36
- * Subscribes to logs via WebSocket, fires a trigger, and polls until the
37
- * event arrives or the timeout is exceeded.
89
+ * Subscribes to logs to capture the transaction signature, fires a trigger,
90
+ * then fetches the full transaction to parse events from inner instructions.
38
91
  *
39
- * Uses CPI-aware log parsing so events emitted by programs that are only
40
- * invoked via CPI (e.g., the centralized events program) are correctly detected.
92
+ * Immune to log bleaching: event data is decoded from CPI instruction data,
93
+ * not from transaction logs.
41
94
  *
42
95
  * @param program - The liquid-events program instance
43
96
  * @param eventName - Name of the event to wait for
@@ -47,77 +100,48 @@ export const addEventListener = (program, eventName, callback) => {
47
100
  * @throws If the event is not received within the timeout period
48
101
  */
49
102
  export async function waitForEvent(program, eventName, trigger, timeoutMs = 5000) {
50
- let eventData = null;
51
- const programId = program.programId.toString();
52
- const coder = new BorshCoder(program.idl);
53
- // Subscribe to logs mentioning this program (includes CPI invocations)
54
- const subscriptionId = program.provider.connection.onLogs(program.programId, (logs) => {
55
- if (logs.err)
103
+ const connection = program.provider.connection;
104
+ let capturedSignature = null;
105
+ // Subscribe to logs to capture the transaction signature
106
+ // (invoke/exit logs are always present even without emit!)
107
+ const subscriptionId = connection.onLogs(program.programId, (logInfo) => {
108
+ if (logInfo.err)
56
109
  return;
57
- const events = parseCpiLogs(logs.logs, programId, coder);
58
- for (const event of events) {
59
- if (event.name === eventName) {
60
- eventData = event.data;
61
- }
62
- }
110
+ capturedSignature = logInfo.signature;
63
111
  });
64
112
  try {
65
113
  const result = await trigger();
114
+ // If the trigger returned a string, use it as the signature directly
115
+ if (typeof result === "string") {
116
+ capturedSignature = result;
117
+ }
118
+ // Wait for the signature to be captured
66
119
  const start = Date.now();
67
- while (!eventData && Date.now() - start < timeoutMs) {
120
+ while (!capturedSignature && Date.now() - start < timeoutMs) {
68
121
  await new Promise((r) => setTimeout(r, 200));
69
122
  }
70
- if (!eventData) {
71
- throw new Error(`Event '${eventName}' not received within ${timeoutMs}ms`);
123
+ if (!capturedSignature) {
124
+ throw new Error(`No transaction signature captured within ${timeoutMs}ms`);
72
125
  }
73
- return { result, event: eventData };
74
- }
75
- finally {
76
- await program.provider.connection.removeOnLogsListener(subscriptionId);
77
- }
78
- }
79
- /**
80
- * Parses events from transaction logs, properly handling CPI contexts.
81
- *
82
- * Anchor's built-in EventParser pushes a generic "cpi" string onto its
83
- * execution stack for nested invocations, so it cannot identify events
84
- * emitted by a CPI-only program. This parser extracts the actual program
85
- * ID from each `invoke` log line, enabling correct attribution of events
86
- * to programs at any CPI depth.
87
- */
88
- function parseCpiLogs(logs, programId, coder) {
89
- const events = [];
90
- const stack = [];
91
- for (const log of logs) {
92
- if (!log.startsWith("Program "))
93
- continue;
94
- const invokeMatch = INVOKE_RE.exec(log);
95
- if (invokeMatch) {
96
- stack.push(invokeMatch[1]);
97
- continue;
98
- }
99
- const exitMatch = EXIT_RE.exec(log);
100
- if (exitMatch) {
101
- stack.pop();
102
- continue;
126
+ // Fetch the full transaction to get inner instructions
127
+ const tx = await connection.getTransaction(capturedSignature, {
128
+ commitment: "confirmed",
129
+ maxSupportedTransactionVersion: 0,
130
+ });
131
+ if (!tx) {
132
+ throw new Error(`Transaction not found: ${capturedSignature}`);
103
133
  }
104
- // Only try to decode events when inside the target program's context
105
- if (stack.length > 0 && stack[stack.length - 1] === programId) {
106
- let logStr = null;
107
- if (log.startsWith(PROGRAM_DATA)) {
108
- logStr = log.slice(PROGRAM_DATA.length);
109
- }
110
- else if (log.startsWith(PROGRAM_LOG)) {
111
- logStr = log.slice(PROGRAM_LOG.length);
112
- }
113
- if (logStr) {
114
- const event = coder.events.decode(logStr);
115
- if (event) {
116
- events.push({ name: event.name, data: event.data });
117
- }
118
- }
134
+ // Parse events from inner instructions
135
+ const events = parseTransactionEvents(tx, program);
136
+ const event = events.find((e) => e.name === eventName);
137
+ if (!event) {
138
+ throw new Error(`Event '${eventName}' not found in transaction ${capturedSignature}. ` +
139
+ `Found events: [${events.map((e) => e.name).join(", ")}]`);
119
140
  }
141
+ return { result, event: event.data };
142
+ }
143
+ finally {
144
+ await connection.removeOnLogsListener(subscriptionId);
120
145
  }
121
- return events;
122
146
  }
123
147
  //# sourceMappingURL=parser.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"parser.js","sourceRoot":"","sources":["../../src/events/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAgB,MAAM,mBAAmB,CAAC;AAU7D,MAAM,YAAY,GAAG,gBAAgB,CAAC;AACtC,MAAM,WAAW,GAAG,eAAe,CAAC;AACpC,MAAM,SAAS,GAAG,oDAAoD,CAAC;AACvE,MAAM,OAAO,GAAG,mDAAmD,CAAC;AAEpE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACrC,IAAc,EACd,OAA8B,EACd,EAAE;IAClB,OAAO,YAAY,CAClB,IAAI,EACJ,OAAO,CAAC,SAAS,CAAC,QAAQ,EAAE,EAC5B,IAAI,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,CAC3B,CAAC;AACH,CAAC,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC/B,OAA8B,EAC9B,SAAY,EACZ,QAA4C,EACnC,EAAE;IACX,qEAAqE;IACrE,wEAAwE;IACxE,qBAAqB;IACrB,OAAO,OAAO,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC,IAAa,EAAE,EAAE;QAC5D,QAAQ,CAAC,IAAyB,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;;;;;;;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AO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;QAC9C,CAAC;QACD,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CACd,4CAA4C,SAAS,IAAI,CACzD,CAAC;QACH,CAAC;QAED,uDAAuD;QACvD,MAAM,EAAE,GAAG,MAAM,UAAU,CAAC,cAAc,CAAC,iBAAiB,EAAE;YAC7D,UAAU,EAAE,WAAW;YACvB,8BAA8B,EAAE,CAAC;SACjC,CAAC,CAAC;QACH,IAAI,CAAC,EAAE,EAAE,CAAC;YACT,MAAM,IAAI,KAAK,CAAC,0BAA0B,iBAAiB,EAAE,CAAC,CAAC;QAChE,CAAC;QAED,uCAAuC;QACvC,MAAM,MAAM,GAAG,sBAAsB,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QACnD,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;QACvD,IAAI,CAAC,KAAK,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CACd,UAAU,SAAS,8BAA8B,iBAAiB,IAAI;gBACtE,kBAAkB,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CACzD,CAAC;QACH,CAAC;QAED,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,IAAyB,EAAE,CAAC;IAC3D,CAAC;YAAS,CAAC;QACV,MAAM,UAAU,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC;IACvD,CAAC;AACF,CAAC"}
@@ -1103,6 +1103,13 @@ export type Liquid = {
1103
1103
  "Liquid events program for centralized event emission."
1104
1104
  ];
1105
1105
  "address": "EventsQeXA43nLKR69DhHwNsJ6aM512AweMCgG3wG8zG";
1106
+ },
1107
+ {
1108
+ "name": "instructions";
1109
+ "docs": [
1110
+ "Instructions sysvar for CPI caller detection."
1111
+ ];
1112
+ "address": "Sysvar1nstructions1111111111111111111111111";
1106
1113
  }
1107
1114
  ];
1108
1115
  "args": [
@@ -2114,6 +2121,13 @@ export type Liquid = {
2114
2121
  "Liquid events program for centralized event emission."
2115
2122
  ];
2116
2123
  "address": "EventsQeXA43nLKR69DhHwNsJ6aM512AweMCgG3wG8zG";
2124
+ },
2125
+ {
2126
+ "name": "instructions";
2127
+ "docs": [
2128
+ "Instructions sysvar for CPI caller detection."
2129
+ ];
2130
+ "address": "Sysvar1nstructions1111111111111111111111111";
2117
2131
  }
2118
2132
  ];
2119
2133
  "args": [
@@ -3033,6 +3047,13 @@ export type Liquid = {
3033
3047
  "Liquid events program for centralized event emission."
3034
3048
  ];
3035
3049
  "address": "EventsQeXA43nLKR69DhHwNsJ6aM512AweMCgG3wG8zG";
3050
+ },
3051
+ {
3052
+ "name": "instructions";
3053
+ "docs": [
3054
+ "Instructions sysvar for CPI caller detection."
3055
+ ];
3056
+ "address": "Sysvar1nstructions1111111111111111111111111";
3036
3057
  }
3037
3058
  ];
3038
3059
  "args": [
@@ -4044,6 +4065,13 @@ export type Liquid = {
4044
4065
  "Liquid events program for centralized event emission."
4045
4066
  ];
4046
4067
  "address": "EventsQeXA43nLKR69DhHwNsJ6aM512AweMCgG3wG8zG";
4068
+ },
4069
+ {
4070
+ "name": "instructions";
4071
+ "docs": [
4072
+ "Instructions sysvar for CPI caller detection."
4073
+ ];
4074
+ "address": "Sysvar1nstructions1111111111111111111111111";
4047
4075
  }
4048
4076
  ];
4049
4077
  "args": [
@@ -9250,6 +9278,13 @@ export type Liquid = {
9250
9278
  "Liquid events program for centralized event emission."
9251
9279
  ];
9252
9280
  "address": "EventsQeXA43nLKR69DhHwNsJ6aM512AweMCgG3wG8zG";
9281
+ },
9282
+ {
9283
+ "name": "instructions";
9284
+ "docs": [
9285
+ "Instructions sysvar for CPI caller detection."
9286
+ ];
9287
+ "address": "Sysvar1nstructions1111111111111111111111111";
9253
9288
  }
9254
9289
  ];
9255
9290
  "args": [
@@ -10261,6 +10296,13 @@ export type Liquid = {
10261
10296
  "Liquid events program for centralized event emission."
10262
10297
  ];
10263
10298
  "address": "EventsQeXA43nLKR69DhHwNsJ6aM512AweMCgG3wG8zG";
10299
+ },
10300
+ {
10301
+ "name": "instructions";
10302
+ "docs": [
10303
+ "Instructions sysvar for CPI caller detection."
10304
+ ];
10305
+ "address": "Sysvar1nstructions1111111111111111111111111";
10264
10306
  }
10265
10307
  ];
10266
10308
  "args": [
@@ -11180,6 +11222,13 @@ export type Liquid = {
11180
11222
  "Liquid events program for centralized event emission."
11181
11223
  ];
11182
11224
  "address": "EventsQeXA43nLKR69DhHwNsJ6aM512AweMCgG3wG8zG";
11225
+ },
11226
+ {
11227
+ "name": "instructions";
11228
+ "docs": [
11229
+ "Instructions sysvar for CPI caller detection."
11230
+ ];
11231
+ "address": "Sysvar1nstructions1111111111111111111111111";
11183
11232
  }
11184
11233
  ];
11185
11234
  "args": [
@@ -12191,6 +12240,13 @@ export type Liquid = {
12191
12240
  "Liquid events program for centralized event emission."
12192
12241
  ];
12193
12242
  "address": "EventsQeXA43nLKR69DhHwNsJ6aM512AweMCgG3wG8zG";
12243
+ },
12244
+ {
12245
+ "name": "instructions";
12246
+ "docs": [
12247
+ "Instructions sysvar for CPI caller detection."
12248
+ ];
12249
+ "address": "Sysvar1nstructions1111111111111111111111111";
12194
12250
  }
12195
12251
  ];
12196
12252
  "args": [
@@ -13141,6 +13197,11 @@ export type Liquid = {
13141
13197
  "code": 6045;
13142
13198
  "name": "buybackVaultNotDrained";
13143
13199
  "msg": "Buyback vault must be drained before migration";
13200
+ },
13201
+ {
13202
+ "code": 6046;
13203
+ "name": "callerBlacklisted";
13204
+ "msg": "CPI caller is blacklisted";
13144
13205
  }
13145
13206
  ];
13146
13207
  "types": [