@molpha/sdk 0.2.0-dev-20261001125531 → 0.2.0-dev-20261005112114

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/dist/index.js CHANGED
@@ -313,18 +313,19 @@ function secp256k1PublicKeyFromCoordinates(x, y, label = "secp256k1 public key c
313
313
  }
314
314
  var SELECTION_SEED_DOMAIN = keccak_256(utf8("MOLPHA_SELECTION_V1"));
315
315
  var SELECTION_DERIVE_DOMAIN = keccak_256(utf8("MOLPHA_SELECTION_DERIVE"));
316
+ var SELECTION_WINDOW_MS = 1000n;
316
317
  var MAX_ROUNDS = 65536;
317
318
  var BITMAP_BYTES = 32;
318
319
  var MAX_NODES = BITMAP_BYTES * 8;
319
320
  var U32_MAX = 4294967295;
320
- function deriveSelectionSeed(sourceId, registryVersion, canonicalTimestamp) {
321
+ function deriveSelectionSeed(sourceId, registryVersion, timestamp) {
321
322
  ensureLength(sourceId, 32, "sourceId");
322
323
  return keccak_256(
323
324
  concatBytes(
324
325
  SELECTION_SEED_DOMAIN,
325
326
  sourceId,
326
327
  u32be(registryVersion),
327
- u64be(canonicalTimestamp)
328
+ u64be(BigInt(timestamp) / SELECTION_WINDOW_MS)
328
329
  )
329
330
  );
330
331
  }
@@ -390,7 +391,7 @@ function deriveGroupBitmap(seed, nodeCount, groupSize) {
390
391
  }
391
392
  return bitmap;
392
393
  }
393
- function deriveSelectionBitmap(sourceId, registryVersion, nodeCount, signaturesRequired, redundancy = 0, ts = Math.floor(Date.now() / 1e3)) {
394
+ function deriveSelectionBitmap(sourceId, registryVersion, nodeCount, signaturesRequired, redundancy = 0, ts = Date.now()) {
394
395
  const seed = deriveSelectionSeed(sourceId, registryVersion, ts);
395
396
  const size = effectiveSelectionSize(signaturesRequired, redundancy, nodeCount);
396
397
  return deriveGroupBitmap(seed, nodeCount, size);
@@ -405,7 +406,7 @@ function encodeRequestAuth(fields) {
405
406
  ensureLength(fields.gateway, 32, "gateway"),
406
407
  toFixedBytes(fields.sourceId, 32, "sourceId"),
407
408
  Uint8Array.of(fields.signaturesRequired),
408
- u64le(fields.timestamp)
409
+ u64le(fields.authTimestamp)
409
410
  );
410
411
  }
411
412
  function hashRequestAuth(fields) {
@@ -779,6 +780,12 @@ function parseGatewayInfo(data) {
779
780
 
780
781
  // src/gateway/index.ts
781
782
  var ZERO_AUTH_SIG = new Uint8Array(64);
783
+ var authTimestampNow = () => Math.floor(Date.now() / 1e3);
784
+ var DEFAULT_TICK_MS = 1e3;
785
+ function msUntilNextTick(nowMs, tickMs) {
786
+ return tickMs - nowMs % tickMs + 1;
787
+ }
788
+ var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
782
789
  var DEFAULT_GATEWAY_ENDPOINT = "https://dev-gateway.molpha.io/";
783
790
  var GatewayError = class extends Error {
784
791
  constructor(message, status) {
@@ -831,13 +838,12 @@ var MolphaGateway = class {
831
838
  * selection policy, which sizes the eligible set a paid source must fund.
832
839
  *
833
840
  * The `registry` block is advisory: it is whatever the gateway read from the
834
- * chain, and is absent on older gateways or when that read failed. Prefer the
841
+ * chain, and is absent when that read failed. Prefer the
835
842
  * on-chain read (`MolphaSolanaClient.getRegistrySelectionConfig`) whenever a
836
843
  * Solana connection is available — `requestSignedData` already does.
837
844
  */
838
845
  async getNodesInfo() {
839
846
  const data = await this.firstReachableData("/v1/nodes");
840
- if (Array.isArray(data)) return { nodes: data };
841
847
  return {
842
848
  nodes: data.nodes,
843
849
  ...data.registry ? { registry: data.registry } : {}
@@ -890,12 +896,23 @@ var MolphaGateway = class {
890
896
  }
891
897
  /**
892
898
  * Request a threshold-signed data update from the gateway, with retry +
893
- * failover. Per attempt a fresh timestamp yields a fresh selection bitmap; the
894
- * body is POSTed to each endpoint in order until one `completed`s.
899
+ * failover. The body is POSTed to each endpoint in order until one `completed`s.
900
+ *
901
+ * The round's `sourceId` is derived from `apiConfig`. The request carries no round timestamp:
902
+ * the gateway assigns the round's `timestamp` (unix milliseconds) from its own clock
903
+ * on a tick grid, and the committee follows from it. The result carries the assigned
904
+ * timestamp and the signers' bitmap. A retry waits for a later tick, because a round that was
905
+ * already reserved or dispatched cannot run again in the same one (HTTP 409).
906
+ *
907
+ * The request is authorized by a `RequestAuth` signature (`authSig`) over the program id, the
908
+ * endpoint's Gateway PDA, the source id, the quorum and `authTimestamp` (unix seconds, read
909
+ * from the local clock for every attempt). It only proves the caller may spend the
910
+ * subscription's rounds; it is not part of the round, so the signature is recomputed for every
911
+ * endpoint tried.
895
912
  *
896
- * The round's `sourceId` is derived from `apiConfig`. The request authorization
897
- * binds the program id and each gateway's on-chain account, so the auth signature
898
- * is recomputed for every endpoint tried.
913
+ * Because the committee is unknown until the gateway stamps the round, private API
914
+ * secrets are encrypted for **every** node of the registry; the gateway forwards only the
915
+ * selected nodes' envelopes.
899
916
  *
900
917
  * By default this fetches the registry selection config up front and the node
901
918
  * set only when the round needs it (private API encryption, or when the registry
@@ -970,28 +987,23 @@ var MolphaGateway = class {
970
987
  }
971
988
  }
972
989
  let lastError;
973
- let lastTimestamp = 0;
990
+ const tickMs = opts.tickMs ?? DEFAULT_TICK_MS;
991
+ const groupSize = effectiveSelectionSize(signaturesRequired, redundancyBuffer, nodeCount);
992
+ const registryIndexes = Array.from({ length: nodeCount }, (_, index) => index);
974
993
  for (let attempt = 0; attempt < maxRetries; attempt++) {
975
- let timestamp = Math.floor(Date.now() / 1e3);
976
- if (timestamp <= lastTimestamp) timestamp = lastTimestamp + 1;
977
- lastTimestamp = timestamp;
978
- const seed = deriveSelectionSeed(sourceIdBytes, registryVersion, timestamp);
979
- const groupSize = effectiveSelectionSize(signaturesRequired, redundancyBuffer, nodeCount);
980
- const bitmap = deriveGroupBitmap(seed, nodeCount, groupSize);
981
- const indices = selectedIndices(bitmap, nodeCount);
994
+ if (attempt > 0) await sleep(msUntilNextTick(Date.now(), tickMs));
982
995
  let encKeyBundle;
983
996
  if (encrypt) {
984
- const selected = selectedNodesForPrivateApiEncryption(round.nodes ?? [], indices);
997
+ const recipients = selectedNodesForPrivateApiEncryption(round.nodes ?? [], registryIndexes);
985
998
  if (verifyNodeKeys) {
986
999
  await verifyNodeKeys({
987
1000
  sourceId,
988
1001
  registryVersion,
989
- timestamp,
990
- selectedIndexes: [...indices],
991
- selectedNodes: selected.map((node) => ({ ...node }))
1002
+ nodeIndexes: [...registryIndexes],
1003
+ nodes: recipients.map((node) => ({ ...node }))
992
1004
  });
993
1005
  }
994
- encKeyBundle = encryptForNodes(requestApiConfig, encrypt.secrets, selected);
1006
+ encKeyBundle = encryptForNodes(requestApiConfig, encrypt.secrets, recipients);
995
1007
  }
996
1008
  let sourcePayments;
997
1009
  if (terms && sourcePayment && authorizations > 0) {
@@ -1004,7 +1016,6 @@ var MolphaGateway = class {
1004
1016
  const baseBody = {
1005
1017
  sourceId,
1006
1018
  registryVersion,
1007
- timestamp,
1008
1019
  maxAge,
1009
1020
  signaturesRequired,
1010
1021
  subscriptionOwner,
@@ -1017,19 +1028,21 @@ var MolphaGateway = class {
1017
1028
  for (const endpoint of this.endpoints) {
1018
1029
  try {
1019
1030
  let authSig = ZERO_AUTH_SIG;
1031
+ let authTimestamp = authTimestampNow();
1020
1032
  if (authSigner) {
1021
1033
  const gateway = await this.resolveGatewayPda(endpoint, timeoutMs);
1034
+ authTimestamp = authTimestampNow();
1022
1035
  authSig = await authSigner(
1023
1036
  hashRequestAuth({
1024
1037
  programId: this.programIdBytes,
1025
1038
  gateway,
1026
1039
  sourceId: sourceIdBytes,
1027
1040
  signaturesRequired,
1028
- timestamp
1041
+ authTimestamp
1029
1042
  })
1030
1043
  );
1031
1044
  }
1032
- const body = { ...baseBody, authSig: bytesToHex0x(authSig) };
1045
+ const body = { ...baseBody, authSig: bytesToHex0x(authSig), authTimestamp };
1033
1046
  const res = await this.post(
1034
1047
  `${endpoint.url}/v1/round/execute`,
1035
1048
  body,
@@ -1106,14 +1119,10 @@ var MolphaGateway = class {
1106
1119
  continue;
1107
1120
  }
1108
1121
  const json = await res.json();
1109
- const payload = json.data ?? (json.status === "completed" ? json : void 0);
1110
- if (json.status === "completed" && payload) {
1111
- return toResult(payload, {
1122
+ if (json.status === "completed" && json.data) {
1123
+ return toResult(json.data, {
1112
1124
  sourceId,
1113
- registryVersion,
1114
- timestamp,
1115
1125
  signaturesRequired,
1116
- bitmap,
1117
1126
  ...requestApiConfig.aggregation ? { aggregation: requestApiConfig.aggregation } : {}
1118
1127
  });
1119
1128
  }
@@ -1216,14 +1225,11 @@ function assertSignaturesRequired(value) {
1216
1225
  return value;
1217
1226
  }
1218
1227
  function unwrapEnvelope(json, path, status) {
1219
- if (json && typeof json === "object" && "data" in json) {
1220
- const wrapped = json;
1221
- if (wrapped.data === void 0) {
1222
- throw new GatewayError(`GET ${path} returned malformed payload`, status);
1223
- }
1224
- return wrapped.data;
1228
+ const wrapped = json;
1229
+ if (wrapped === null || typeof wrapped !== "object" || wrapped.data === void 0) {
1230
+ throw new GatewayError(`GET ${path} returned malformed payload`, status);
1225
1231
  }
1226
- return json;
1232
+ return wrapped.data;
1227
1233
  }
1228
1234
  function selectedNodesForPrivateApiEncryption(nodes, selectedIndexes) {
1229
1235
  if (!Array.isArray(nodes)) {
@@ -1304,7 +1310,32 @@ async function parseGatewayErrorDetail(res) {
1304
1310
  function normalizeHex(value) {
1305
1311
  return (value.startsWith("0x") || value.startsWith("0X") ? value.slice(2) : value).toLowerCase();
1306
1312
  }
1307
- function toResult(data, ctx) {
1313
+ function flattenGatewayData(data) {
1314
+ const nested = data.attestation;
1315
+ if (!nested) return data;
1316
+ const { attestation: _nested, ...rest } = data;
1317
+ const { payload, signature } = nested;
1318
+ const timestamp = payload?.timestamp ?? payload?.canonicalTimestamp;
1319
+ return {
1320
+ ...rest,
1321
+ ...payload?.sourceId !== void 0 ? { sourceId: payload.sourceId } : {},
1322
+ ...payload?.value !== void 0 ? { valuePacked: payload.value } : {},
1323
+ ...timestamp !== void 0 ? { timestamp } : {},
1324
+ ...payload?.registryVersion !== void 0 ? { registryVersion: payload.registryVersion } : {},
1325
+ ...payload?.signaturesRequired !== void 0 ? { signaturesRequired: payload.signaturesRequired } : {},
1326
+ ...signature?.signersBitmap !== void 0 ? { signersBitmap: signature.signersBitmap } : {},
1327
+ ...signature?.signature !== void 0 ? { s: signature.signature } : {},
1328
+ ...signature?.commitment !== void 0 ? { commitmentAddr: signature.commitment } : {}
1329
+ };
1330
+ }
1331
+ function toResult(raw, ctx) {
1332
+ if (raw.attestation) {
1333
+ const { payload, signature } = raw.attestation;
1334
+ if (!payload || !signature) {
1335
+ throw new GatewayError("Gateway response is missing the attestation");
1336
+ }
1337
+ }
1338
+ const data = flattenGatewayData(raw);
1308
1339
  if (data.sourceId !== void 0 && normalizeHex(data.sourceId) !== ctx.sourceId) {
1309
1340
  throw new GatewayError(
1310
1341
  `Gateway response sourceId ${data.sourceId} does not match the requested ${ctx.sourceId}`
@@ -1340,33 +1371,41 @@ function toResult(data, ctx) {
1340
1371
  );
1341
1372
  }
1342
1373
  }
1374
+ const fields = {
1375
+ timestamp: data.timestamp,
1376
+ registryVersion: data.registryVersion,
1377
+ value: data.valuePacked,
1378
+ signersBitmap: data.signersBitmap,
1379
+ s: data.s,
1380
+ commitmentAddr: data.commitmentAddr
1381
+ };
1382
+ for (const [name, field] of Object.entries(fields)) {
1383
+ if (field === void 0 || field === "") {
1384
+ throw new GatewayError(`Gateway response is missing ${name}`);
1385
+ }
1386
+ }
1343
1387
  let value = data.value ?? "";
1344
1388
  if (ctx.aggregation) {
1345
- for (const field of ["valuePacked", "signersBitmap", "s", "commitmentAddr"]) {
1346
- if (!data[field]) {
1347
- throw new GatewayError(`Gateway tolerance response is missing ${field}`);
1348
- }
1349
- }
1350
1389
  try {
1351
- value = formatInt256Decimal(data.valuePacked, ctx.aggregation.numeric.decimals);
1390
+ value = formatInt256Decimal(fields.value, ctx.aggregation.numeric.decimals);
1352
1391
  } catch (err) {
1353
1392
  throw new GatewayError(
1354
- `Gateway tolerance response valuePacked is not an int256 word: ${err instanceof Error ? err.message : String(err)}`
1393
+ `Gateway tolerance response value is not an int256 word: ${err instanceof Error ? err.message : String(err)}`
1355
1394
  );
1356
1395
  }
1357
1396
  }
1358
1397
  return {
1359
1398
  payload: {
1360
1399
  sourceId: ctx.sourceId,
1361
- value: data.valuePacked ?? "",
1362
- canonicalTimestamp: data.timestamp ?? ctx.timestamp,
1363
- registryVersion: data.registryVersion ?? ctx.registryVersion,
1400
+ value: fields.value,
1401
+ timestamp: fields.timestamp,
1402
+ registryVersion: fields.registryVersion,
1364
1403
  signaturesRequired: ctx.signaturesRequired
1365
1404
  },
1366
1405
  signature: {
1367
- signersBitmap: data.signersBitmap ?? bytesToHex(ctx.bitmap),
1368
- s: data.s ?? "",
1369
- commitmentAddr: data.commitmentAddr ?? ""
1406
+ signersBitmap: fields.signersBitmap,
1407
+ s: fields.s,
1408
+ commitmentAddr: fields.commitmentAddr
1370
1409
  },
1371
1410
  value,
1372
1411
  fresh: data.fresh ?? true
@@ -6085,7 +6124,7 @@ var molpha_default = {
6085
6124
  {
6086
6125
  code: 6030,
6087
6126
  name: "FeedNotNewer",
6088
- msg: "canonical_timestamp <= feed.canonical_timestamp"
6127
+ msg: "timestamp <= feed.timestamp"
6089
6128
  },
6090
6129
  {
6091
6130
  code: 6031,
@@ -6230,12 +6269,12 @@ var molpha_default = {
6230
6269
  {
6231
6270
  code: 6059,
6232
6271
  name: "AttestationTooStale",
6233
- msg: "canonical_timestamp is older than now - max_settlement_delay_seconds"
6272
+ msg: "timestamp is older than now - max_settlement_delay_seconds"
6234
6273
  },
6235
6274
  {
6236
6275
  code: 6060,
6237
6276
  name: "AttestationInFuture",
6238
- msg: "canonical_timestamp is further ahead of cluster time than the allowed drift"
6277
+ msg: "timestamp is further ahead of cluster time than the allowed drift"
6239
6278
  },
6240
6279
  {
6241
6280
  code: 6061,
@@ -6360,7 +6399,7 @@ var molpha_default = {
6360
6399
  {
6361
6400
  code: 6085,
6362
6401
  name: "RoundOutsideEpoch",
6363
- msg: "canonical_timestamp is outside the epoch window"
6402
+ msg: "timestamp is outside the epoch window"
6364
6403
  },
6365
6404
  {
6366
6405
  code: 6086,
@@ -6517,7 +6556,7 @@ var molpha_default = {
6517
6556
  type: "u8"
6518
6557
  },
6519
6558
  {
6520
- name: "canonical_timestamp",
6559
+ name: "timestamp",
6521
6560
  type: "u64"
6522
6561
  }
6523
6562
  ]
@@ -7168,7 +7207,7 @@ var molpha_default = {
7168
7207
  type: "pubkey"
7169
7208
  },
7170
7209
  {
7171
- name: "canonical_timestamp",
7210
+ name: "timestamp",
7172
7211
  type: "u64"
7173
7212
  },
7174
7213
  {
@@ -7214,7 +7253,7 @@ var molpha_default = {
7214
7253
  type: "u32"
7215
7254
  },
7216
7255
  {
7217
- name: "canonical_timestamp",
7256
+ name: "timestamp",
7218
7257
  type: "u64"
7219
7258
  },
7220
7259
  {
@@ -8269,7 +8308,7 @@ var molpha_default = {
8269
8308
  {
8270
8309
  name: "max_settlement_delay_seconds",
8271
8310
  docs: [
8272
- "Max age in seconds of `canonical_timestamp` relative to cluster time at attestation",
8311
+ "Max age in seconds of `timestamp` relative to cluster time at attestation",
8273
8312
  "ingress, and the grace period of a superseded registry version."
8274
8313
  ],
8275
8314
  type: "u64"
@@ -9625,7 +9664,7 @@ function buildSubmitAttestationArgs(attestation, coalitionKey, rawValue) {
9625
9664
  sourceId: Array.from(toFixedBytes(payload.sourceId, 32, "sourceId")),
9626
9665
  registryVersion: payload.registryVersion,
9627
9666
  signaturesRequired: payload.signaturesRequired,
9628
- canonicalTimestamp: new BN(payload.canonicalTimestamp)
9667
+ timestamp: new BN(payload.timestamp)
9629
9668
  },
9630
9669
  signature: {
9631
9670
  aggSigS: Array.from(toFixedBytes(signature.s, 32, "signature.s")),
@@ -9681,16 +9720,16 @@ function nodeCoordinate(account, camelCaseField, snakeCaseField) {
9681
9720
  return toFixedBytes(Uint8Array.from(value), 32, `Node.${camelCaseField}`);
9682
9721
  }
9683
9722
  function selectedNodesForVerifier(args) {
9684
- if (args.selectedIndexes.length === 0) {
9723
+ if (args.nodeIndexes.length === 0) {
9685
9724
  throw new Error("Private API node-key verification requires at least one selected index");
9686
9725
  }
9687
- if (args.selectedNodes.length !== args.selectedIndexes.length) {
9726
+ if (args.nodes.length !== args.nodeIndexes.length) {
9688
9727
  throw new Error(
9689
- `Private API node-key verification expected ${args.selectedIndexes.length} selected nodes, got ${args.selectedNodes.length}`
9728
+ `Private API node-key verification expected ${args.nodeIndexes.length} selected nodes, got ${args.nodes.length}`
9690
9729
  );
9691
9730
  }
9692
9731
  const expected = /* @__PURE__ */ new Set();
9693
- for (const index of args.selectedIndexes) {
9732
+ for (const index of args.nodeIndexes) {
9694
9733
  if (!Number.isInteger(index) || index < 0) {
9695
9734
  throw new Error(`Private API selected index must be a non-negative integer: ${index}`);
9696
9735
  }
@@ -9700,7 +9739,7 @@ function selectedNodesForVerifier(args) {
9700
9739
  expected.add(index);
9701
9740
  }
9702
9741
  const byIndex = /* @__PURE__ */ new Map();
9703
- for (const node of args.selectedNodes) {
9742
+ for (const node of args.nodes) {
9704
9743
  if (!Number.isInteger(node.index) || node.index < 0) {
9705
9744
  throw new Error(
9706
9745
  `Private API selected node index must be a non-negative integer: ${node.index}`
@@ -9714,7 +9753,7 @@ function selectedNodesForVerifier(args) {
9714
9753
  }
9715
9754
  byIndex.set(node.index, node);
9716
9755
  }
9717
- return args.selectedIndexes.map((index) => {
9756
+ return args.nodeIndexes.map((index) => {
9718
9757
  const node = byIndex.get(index);
9719
9758
  if (!node) {
9720
9759
  throw new Error(`Private API selected node is missing for index: ${index}`);
@@ -9745,7 +9784,7 @@ function attestationMessageHash(fields) {
9745
9784
  toFixedBytes(fields.sourceId, 32, "sourceId"),
9746
9785
  u32be(fields.registryVersion),
9747
9786
  u8(fields.signaturesRequired),
9748
- u64be(fields.canonicalTimestamp),
9787
+ u64be(fields.timestamp),
9749
9788
  toFixedBytes(fields.signersBitmap, 32, "signersBitmap")
9750
9789
  )
9751
9790
  );
@@ -9758,10 +9797,20 @@ function attestationMessageHashFromAttestation(attestation) {
9758
9797
  signaturesRequired: payload.signaturesRequired,
9759
9798
  signersBitmap: signature.signersBitmap,
9760
9799
  value: payload.value,
9761
- canonicalTimestamp: payload.canonicalTimestamp
9800
+ timestamp: payload.timestamp
9762
9801
  });
9763
9802
  }
9764
9803
 
9804
+ // src/core/timestamp.ts
9805
+ function timestampSeconds(timestamp) {
9806
+ const ms = typeof timestamp === "bigint" ? timestamp : BigInt(timestamp);
9807
+ if (ms < 0n) throw new RangeError("timestamp must not be negative");
9808
+ return Number(ms / 1000n);
9809
+ }
9810
+ function timestampAgeSeconds(timestamp, nowSeconds) {
9811
+ return Math.max(0, nowSeconds - timestampSeconds(timestamp));
9812
+ }
9813
+
9765
9814
  // src/core/verifyCodes.ts
9766
9815
  var VERIFY_CODES = {
9767
9816
  OK: 0,
@@ -9769,11 +9818,11 @@ var VERIFY_CODES = {
9769
9818
  FEED_WITNESS: 1,
9770
9819
  /** The payload's `registryVersion` does not exist on this verifier. */
9771
9820
  BAD_REGISTRY_VERSION: 2,
9772
- /** Structurally invalid input, or a `canonicalTimestamp` in the future when `maxAge != 0`. */
9821
+ /** Structurally invalid input, or a `timestamp` in the future when `maxAge != 0`. */
9773
9822
  MALFORMED: 3,
9774
- /** `canonicalTimestamp` predates the registry version's activation. */
9823
+ /** `timestamp` predates the registry version's activation. */
9775
9824
  NOT_YET_ACTIVE: 4,
9776
- /** The registry version was superseded more than the grace window before `canonicalTimestamp`. */
9825
+ /** The registry version was superseded more than the grace window before `timestamp`. */
9777
9826
  VERSION_EXPIRED: 5,
9778
9827
  /** Reserved. Never returned. */
9779
9828
  COMPROMISED_QUORUM: 6,
@@ -9817,7 +9866,7 @@ var MOLPHA_VERIFIER_ABI = [
9817
9866
  { name: "sourceId", type: "bytes32", internalType: "bytes32" },
9818
9867
  { name: "registryVersion", type: "uint32", internalType: "uint32" },
9819
9868
  { name: "signaturesRequired", type: "uint8", internalType: "uint8" },
9820
- { name: "canonicalTimestamp", type: "uint64", internalType: "uint64" }
9869
+ { name: "timestamp", type: "uint64", internalType: "uint64" }
9821
9870
  ]
9822
9871
  },
9823
9872
  {
@@ -9990,7 +10039,7 @@ function buildEvmVerifierArgs(attestation, options) {
9990
10039
  sourceId: toFixedHex(signed.sourceId, 32, "sourceId"),
9991
10040
  registryVersion: assertUint2(signed.registryVersion, U32_MAX2, "registryVersion"),
9992
10041
  signaturesRequired: assertUint2(signed.signaturesRequired, U8_MAX, "signaturesRequired"),
9993
- canonicalTimestamp: assertBigUint(signed.canonicalTimestamp, U64_MAX, "canonicalTimestamp")
10042
+ timestamp: assertBigUint(signed.timestamp, U64_MAX, "timestamp")
9994
10043
  };
9995
10044
  const signature = {
9996
10045
  signature: toFixedHex(sig.s, 32, "signature"),
@@ -10012,7 +10061,7 @@ function encodeEvmVerifyCalldata(args) {
10012
10061
  u256beFromBigInt(
10013
10062
  BigInt(assertUint2(payload.signaturesRequired, U8_MAX, "signaturesRequired"))
10014
10063
  ),
10015
- u256beFromBigInt(assertBigUint(payload.canonicalTimestamp, U64_MAX, "canonicalTimestamp")),
10064
+ u256beFromBigInt(assertBigUint(payload.timestamp, U64_MAX, "timestamp")),
10016
10065
  word2(signature.signature, 32, "signature"),
10017
10066
  word2(signature.commitment, 20, "commitment"),
10018
10067
  u256beFromBigInt(assertBigUint(signature.signersBitmap, U256_MAX, "signersBitmap")),
@@ -10142,7 +10191,7 @@ function buildStarknetVerifierArgs(attestation, options) {
10142
10191
  source_id: fixedHexToBigInt(signed.sourceId, 32, "sourceId"),
10143
10192
  registry_version: assertUint3(signed.registryVersion, U32_MAX3, "registryVersion"),
10144
10193
  signatures_required: assertUint3(signed.signaturesRequired, U8_MAX2, "signaturesRequired"),
10145
- canonical_timestamp: assertUint3(signed.canonicalTimestamp, U64_MAX2, "canonicalTimestamp")
10194
+ timestamp: assertUint3(signed.timestamp, U64_MAX2, "timestamp")
10146
10195
  };
10147
10196
  const signature = {
10148
10197
  signature: fixedHexToBigInt(sig.s, 32, "signature"),
@@ -10161,7 +10210,7 @@ function encodeStarknetVerifyCalldata(args) {
10161
10210
  ...u256Felts(payload.source_id, "source_id"),
10162
10211
  toFelt(assertUint3(payload.registry_version, U32_MAX3, "registry_version")),
10163
10212
  toFelt(assertUint3(payload.signatures_required, U8_MAX2, "signatures_required")),
10164
- toFelt(assertUint3(payload.canonical_timestamp, U64_MAX2, "canonical_timestamp")),
10213
+ toFelt(assertUint3(payload.timestamp, U64_MAX2, "timestamp")),
10165
10214
  ...u256Felts(signature.signature, "signature"),
10166
10215
  // An Ethereum-style address, so it must fit 160 bits (the verifier reports a wider one
10167
10216
  // as `MALFORMED`; one past the field prime would not even deserialize).
@@ -10228,6 +10277,6 @@ var MolphaSDK = class {
10228
10277
  }
10229
10278
  };
10230
10279
 
10231
- export { AggregationConfigError, DEFAULT_GATEWAY_ENDPOINT, EIP712_DOMAIN_TYPEHASH, GatewayError, INT256_MAX, INT256_MIN, MESSAGE_PREFIX, MIN_TOLERANCE_SIGNATURES, MOLPHA_IDL, MOLPHA_PROGRAM_ADDRESS, MOLPHA_PROGRAM_ID, MOLPHA_VERIFIER_ABI, MOLPHA_VERIFIER_ADDRESS, MOLPHA_VERIFIER_STARKNET_ADDRESSES, MOLPHA_VERIFIER_STARKNET_SEPOLIA, MolphaGateway, MolphaSDK, MolphaSolanaClient, PlanType, REQUEST_AUTH_DOMAIN, TRANSFER_WITH_AUTHORIZATION_TYPEHASH, UpstreamPaymentRequiredError, VERIFY_CODES, addressToBytes, assertAggregationQuorum, attestationMessageHash, attestationMessageHashFromAttestation, base64ToBytes, bigIntFromBytesBe, bitmapBitSet, bitmapToIndices, buildEvmVerifierArgs, buildStarknetVerifierArgs, buildSubmitAttestationArgs, bytesToBase64, bytesToHex, bytesToHex0x, canonicalizeAPIConfig, canonicalizeAggregation, commitmentAddressToStarknetFelt, computeCoalitionKey, concatBytes, createEvmSignerFromPrivateKey, decodeInt256, deriveGatewayPda, deriveGatewayPdaAddress, deriveGroupBitmap, deriveSelectionBitmap, deriveSelectionSeed, deriveSourceId, deriveSourceIdString, domainSeparator, effectiveSelectionSize, eligibleSetSize, encodeEvmVerifyCalldata, encodeInt256, encodeInt256Decimal, encodeRequestAuth, encodeStarknetVerifyCalldata, ensureLength, evmAddressFromPrivateKey, feedPda, formatInt256Decimal, gatewayPda, gatewaySignerFromWallet, getMolphaStarknetVerifierAddress, hashRequestAuth, hexToBytes, nodePda, normalizeEndpoint, normalizeSecp256k1PublicKeyHex, parseEvmVerifyResult, parseGatewayInfo, parseStarknetVerifyResult, parseUpstreamQuote, planIdFromVariant, planPda, planVariant, probeSource, protocolConfigPda, registryPda, registryStatePda, resolveRemainingAccounts, secp256k1PublicKeyFromCoordinates, selectedIndices, signSourcePayments, signerFromKeypair, signersBitmapToDecimal, signersBitmapToStarknetUint256, signersBitmapToUint256, subscriptionPda, toChecksumAddress, toFixedBytes, toFixedHex, transferWithAuthorizationDigest, transferWithAuthorizationHash, u256beFromBigInt, u32be, u32le, u64be, u64le, u8, utf8, validateSuppliedTerms, verifyCodeName };
10280
+ export { AggregationConfigError, DEFAULT_GATEWAY_ENDPOINT, EIP712_DOMAIN_TYPEHASH, GatewayError, INT256_MAX, INT256_MIN, MESSAGE_PREFIX, MIN_TOLERANCE_SIGNATURES, MOLPHA_IDL, MOLPHA_PROGRAM_ADDRESS, MOLPHA_PROGRAM_ID, MOLPHA_VERIFIER_ABI, MOLPHA_VERIFIER_ADDRESS, MOLPHA_VERIFIER_STARKNET_ADDRESSES, MOLPHA_VERIFIER_STARKNET_SEPOLIA, MolphaGateway, MolphaSDK, MolphaSolanaClient, PlanType, REQUEST_AUTH_DOMAIN, SELECTION_WINDOW_MS, TRANSFER_WITH_AUTHORIZATION_TYPEHASH, UpstreamPaymentRequiredError, VERIFY_CODES, addressToBytes, assertAggregationQuorum, attestationMessageHash, attestationMessageHashFromAttestation, base64ToBytes, bigIntFromBytesBe, bitmapBitSet, bitmapToIndices, buildEvmVerifierArgs, buildStarknetVerifierArgs, buildSubmitAttestationArgs, bytesToBase64, bytesToHex, bytesToHex0x, canonicalizeAPIConfig, canonicalizeAggregation, commitmentAddressToStarknetFelt, computeCoalitionKey, concatBytes, createEvmSignerFromPrivateKey, decodeInt256, deriveGatewayPda, deriveGatewayPdaAddress, deriveGroupBitmap, deriveSelectionBitmap, deriveSelectionSeed, deriveSourceId, deriveSourceIdString, domainSeparator, effectiveSelectionSize, eligibleSetSize, encodeEvmVerifyCalldata, encodeInt256, encodeInt256Decimal, encodeRequestAuth, encodeStarknetVerifyCalldata, ensureLength, evmAddressFromPrivateKey, feedPda, formatInt256Decimal, gatewayPda, gatewaySignerFromWallet, getMolphaStarknetVerifierAddress, hashRequestAuth, hexToBytes, msUntilNextTick, nodePda, normalizeEndpoint, normalizeSecp256k1PublicKeyHex, parseEvmVerifyResult, parseGatewayInfo, parseStarknetVerifyResult, parseUpstreamQuote, planIdFromVariant, planPda, planVariant, probeSource, protocolConfigPda, registryPda, registryStatePda, resolveRemainingAccounts, secp256k1PublicKeyFromCoordinates, selectedIndices, signSourcePayments, signerFromKeypair, signersBitmapToDecimal, signersBitmapToStarknetUint256, signersBitmapToUint256, subscriptionPda, timestampAgeSeconds, timestampSeconds, toChecksumAddress, toFixedBytes, toFixedHex, transferWithAuthorizationDigest, transferWithAuthorizationHash, u256beFromBigInt, u32be, u32le, u64be, u64le, u8, utf8, validateSuppliedTerms, verifyCodeName };
10232
10281
  //# sourceMappingURL=index.js.map
10233
10282
  //# sourceMappingURL=index.js.map