@swarm-tips/client 0.2.12 → 0.2.13

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/SBOM.spdx.json CHANGED
@@ -2,10 +2,10 @@
2
2
  "spdxVersion": "SPDX-2.3",
3
3
  "dataLicense": "CC0-1.0",
4
4
  "SPDXID": "SPDXRef-DOCUMENT",
5
- "name": "@swarm-tips/client-0.2.12",
6
- "documentNamespace": "https://swarm.tips/sbom/client/0.2.12",
5
+ "name": "@swarm-tips/client-0.2.13",
6
+ "documentNamespace": "https://swarm.tips/sbom/client/0.2.13",
7
7
  "creationInfo": {
8
- "created": "2026-10-16T05:41:05.183Z",
8
+ "created": "2026-11-06T04:27:18.192Z",
9
9
  "creators": [
10
10
  "Tool: sdk/client/scripts/generate-sbom.mjs",
11
11
  "Organization: Swarm Tips"
@@ -15,8 +15,8 @@
15
15
  {
16
16
  "name": "@swarm-tips/client",
17
17
  "SPDXID": "SPDXRef-Package",
18
- "versionInfo": "0.2.12",
19
- "downloadLocation": "https://www.npmjs.com/package/@swarm-tips/client/v/0.2.12",
18
+ "versionInfo": "0.2.13",
19
+ "downloadLocation": "https://www.npmjs.com/package/@swarm-tips/client/v/0.2.13",
20
20
  "filesAnalyzed": false,
21
21
  "licenseConcluded": "MIT",
22
22
  "licenseDeclared": "MIT"
@@ -2114,9 +2114,10 @@ export type Shillbot = {
2114
2114
  {
2115
2115
  "name": "switchboardFeed";
2116
2116
  "docs": [
2117
- "The Switchboard pull feed account containing the oracle-attested composite score.",
2118
- "`PullFeedAccountData::parse()` which checks the account discriminator.",
2119
- "Account ownership is verified by Switchboard's `Owner` implementation."
2117
+ "The oracle authority signer (`GlobalState.oracle_authority` or",
2118
+ "`GlobalState.authority`) or legacy Switchboard pull feed account.",
2119
+ "/ `global_state.authority`, or validated against `global_state.switchboard_feed`",
2120
+ "and parsed via `PullFeedAccountData::parse()`."
2120
2121
  ];
2121
2122
  }
2122
2123
  ];
@@ -2888,6 +2889,11 @@ export type Shillbot = {
2888
2889
  "code": 6056;
2889
2890
  "name": "invalidAccountOwner";
2890
2891
  "msg": "Account is not owned by this program";
2892
+ },
2893
+ {
2894
+ "code": 6057;
2895
+ "name": "invalidTimeoutOrdering";
2896
+ "msg": "verification_timeout must exceed attestation_delay + staleness_window";
2891
2897
  }
2892
2898
  ];
2893
2899
  "types": [
@@ -2108,9 +2108,10 @@
2108
2108
  {
2109
2109
  "name": "switchboard_feed",
2110
2110
  "docs": [
2111
- "The Switchboard pull feed account containing the oracle-attested composite score.",
2112
- "`PullFeedAccountData::parse()` which checks the account discriminator.",
2113
- "Account ownership is verified by Switchboard's `Owner` implementation."
2111
+ "The oracle authority signer (`GlobalState.oracle_authority` or",
2112
+ "`GlobalState.authority`) or legacy Switchboard pull feed account.",
2113
+ "/ `global_state.authority`, or validated against `global_state.switchboard_feed`",
2114
+ "and parsed via `PullFeedAccountData::parse()`."
2114
2115
  ]
2115
2116
  }
2116
2117
  ],
@@ -2882,6 +2883,11 @@
2882
2883
  "code": 6056,
2883
2884
  "name": "InvalidAccountOwner",
2884
2885
  "msg": "Account is not owned by this program"
2886
+ },
2887
+ {
2888
+ "code": 6057,
2889
+ "name": "InvalidTimeoutOrdering",
2890
+ "msg": "verification_timeout must exceed attestation_delay + staleness_window"
2885
2891
  }
2886
2892
  ],
2887
2893
  "types": [
@@ -56,5 +56,6 @@ export declare const resolveShillbotState: StateResolver;
56
56
  * account, so post-finalize the attestation is permanently unverifiable. */
57
57
  export declare const shillbotValidStates: (accountKind: string) => readonly string[];
58
58
  export declare const SHILLBOT_VOW_PROGRAM_ID = "2tR37nqMpwdV4DVUHjzUmL1rH2DtkA8zrRA4EAhT7KMi";
59
+ export declare const SHILLBOT_SCORE_MAX = 1000000n;
59
60
  /** Convenience bundle for callers that just want the canonical Shillbot triple. */
60
61
  export declare const shillbotProtocol: ProtocolHandler;
@@ -114,12 +114,14 @@ export const shillbotValidStates = (accountKind) => {
114
114
  return ["verified"];
115
115
  };
116
116
  export const SHILLBOT_VOW_PROGRAM_ID = "2tR37nqMpwdV4DVUHjzUmL1rH2DtkA8zrRA4EAhT7KMi";
117
+ export const SHILLBOT_SCORE_MAX = 1000000n;
117
118
  /** Convenience bundle for callers that just want the canonical Shillbot triple. */
118
119
  export const shillbotProtocol = {
119
120
  decode: decodeShillbotTask,
120
121
  resolveState: resolveShillbotState,
121
122
  validStates: shillbotValidStates,
122
123
  programId: SHILLBOT_VOW_PROGRAM_ID,
124
+ scoreMax: SHILLBOT_SCORE_MAX,
123
125
  };
124
126
  function bytesToHex(b) {
125
127
  let s = "";
@@ -106,4 +106,5 @@ export interface ProtocolHandler {
106
106
  resolveState: StateResolver;
107
107
  validStates: ValidStates;
108
108
  programId?: string;
109
+ scoreMax?: bigint | number | string;
109
110
  }
@@ -1,5 +1,6 @@
1
1
  import { Connection } from "@solana/web3.js";
2
2
  import type { AasV1Attestation, FailureReason, ProtocolHandler, Verdict } from "./types.js";
3
+ export declare const DEFAULT_SCORE_MAX = 1000000n;
3
4
  /**
4
5
  * Step-by-step verifier per `docs/specs/vow-v1.md` §4.
5
6
  *
@@ -10,7 +11,7 @@ import type { AasV1Attestation, FailureReason, ProtocolHandler, Verdict } from "
10
11
  *
11
12
  * Splitting lets unit tests cover the pure parts without an RPC.
12
13
  */
13
- export declare function verifyV1(attestation: unknown, protocol: ProtocolHandler, rpc: Connection): Promise<Verdict>;
14
+ export declare function verifyV1(attestation: unknown, protocol: ProtocolHandler, rpc: Connection, expectedScoreMax?: bigint | number | string): Promise<Verdict>;
14
15
  /**
15
16
  * Pure step 1 + step 6 of the protocol. Returns null on success or
16
17
  * the first failure reason.
@@ -20,4 +21,4 @@ export declare function verifyV1Schema(attestation: unknown): FailureReason | nu
20
21
  * Steps 2-5 + 7 — touches RPC. Returns null on success or the first
21
22
  * failure reason.
22
23
  */
23
- export declare function verifyV1OnChain(a: AasV1Attestation, protocol: ProtocolHandler, rpc: Connection): Promise<FailureReason | null>;
24
+ export declare function verifyV1OnChain(a: AasV1Attestation, protocol: ProtocolHandler, rpc: Connection, expectedScoreMax?: bigint | number | string): Promise<FailureReason | null>;
@@ -1,6 +1,7 @@
1
1
  import { PublicKey } from "@solana/web3.js";
2
2
  import { anchorDiscriminator, bytesEqual } from "./discriminator.js";
3
3
  import { asV1, checkSchema } from "./schema.js";
4
+ export const DEFAULT_SCORE_MAX = 1000000n;
4
5
  /**
5
6
  * Step-by-step verifier per `docs/specs/vow-v1.md` §4.
6
7
  *
@@ -11,7 +12,7 @@ import { asV1, checkSchema } from "./schema.js";
11
12
  *
12
13
  * Splitting lets unit tests cover the pure parts without an RPC.
13
14
  */
14
- export async function verifyV1(attestation, protocol, rpc) {
15
+ export async function verifyV1(attestation, protocol, rpc, expectedScoreMax) {
15
16
  const checkedAt = nowRfc3339();
16
17
  const rpcEndpoint = rpc.rpcEndpoint;
17
18
  const schemaFail = verifyV1Schema(attestation);
@@ -25,7 +26,7 @@ export async function verifyV1(attestation, protocol, rpc) {
25
26
  };
26
27
  }
27
28
  const a = asV1(attestation);
28
- const onChainFail = await verifyV1OnChain(a, protocol, rpc);
29
+ const onChainFail = await verifyV1OnChain(a, protocol, rpc, expectedScoreMax);
29
30
  if (onChainFail) {
30
31
  return {
31
32
  valid: false,
@@ -61,7 +62,11 @@ export function verifyV1Schema(attestation) {
61
62
  * Steps 2-5 + 7 — touches RPC. Returns null on success or the first
62
63
  * failure reason.
63
64
  */
64
- export async function verifyV1OnChain(a, protocol, rpc) {
65
+ export async function verifyV1OnChain(a, protocol, rpc, expectedScoreMax) {
66
+ const expectedMax = BigInt(expectedScoreMax ?? protocol.scoreMax ?? DEFAULT_SCORE_MAX);
67
+ if (BigInt(a.score_max) !== expectedMax) {
68
+ return "field_mismatch:score_max";
69
+ }
65
70
  // Step 2 — fetch the on-chain account.
66
71
  const accountInfo = await rpc.getAccountInfo(new PublicKey(a.account));
67
72
  if (accountInfo === null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swarm-tips/client",
3
- "version": "0.2.12",
3
+ "version": "0.2.13",
4
4
  "description": "Typed browser and Node.js clients for Swarm Tips, Shillbot, and Coordination Game",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",