@secondlayer/shared 11.14.0 → 11.14.1

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.
@@ -0,0 +1,46 @@
1
+ import { type Kysely, sql } from "kysely";
2
+ import { onChainPlane } from "../src/db/migration-role.ts";
3
+
4
+ /**
5
+ * Backfill: `claim-rewards`, `claim-staker-rewards-for-signer`,
6
+ * `grant-signer-key`, and `revoke-signer-grant` only ever printed
7
+ * `signer-manager` — never `signer` — even though the contract's own
8
+ * assertions make it the same principal (see the pox-5 decoder's
9
+ * `promoteTopicFields` comment). Rows decoded before that derivation shipped
10
+ * are missing `signer` on these four topics; fill it from `signer_manager` so
11
+ * `signer=` returns a pool's complete pox-5 activity for old rows too.
12
+ *
13
+ * Idempotent by its WHERE (only touches rows still missing `signer`), so it
14
+ * is safe to run more than once.
15
+ */
16
+ export async function up(db: Kysely<unknown>): Promise<void> {
17
+ await onChainPlane(async () => {
18
+ await sql`
19
+ UPDATE pox5_events
20
+ SET signer = signer_manager
21
+ WHERE signer IS NULL
22
+ AND signer_manager IS NOT NULL
23
+ AND topic IN (
24
+ 'claim-rewards',
25
+ 'claim-staker-rewards-for-signer',
26
+ 'grant-signer-key',
27
+ 'revoke-signer-grant'
28
+ )
29
+ `.execute(db);
30
+ });
31
+ }
32
+
33
+ export async function down(db: Kysely<unknown>): Promise<void> {
34
+ await onChainPlane(async () => {
35
+ await sql`
36
+ UPDATE pox5_events
37
+ SET signer = NULL
38
+ WHERE topic IN (
39
+ 'claim-rewards',
40
+ 'claim-staker-rewards-for-signer',
41
+ 'grant-signer-key',
42
+ 'revoke-signer-grant'
43
+ )
44
+ `.execute(db);
45
+ });
46
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@secondlayer/shared",
3
- "version": "11.14.0",
3
+ "version": "11.14.1",
4
4
  "description": "Internal building blocks shared across Secondlayer packages.",
5
5
  "license": "MIT",
6
6
  "repository": {