@molpha/sdk 0.2.0-dev-20261002062009 → 0.2.0-dev-20261005191253

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/utils.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { Wallet } from '@anchor-lang/core';
2
- import { r as SolanaKeypair, M as MolphaWallet } from './wallet-HfGXPpOp.js';
2
+ import { r as SolanaKeypair, M as MolphaWallet } from './wallet--IGHoCtG.js';
3
3
  import '@solana/kit';
4
4
 
5
5
  /** Load a Solana CLI keypair JSON file (array of 64 bytes) into a `Keypair`. */
package/dist/utils.js CHANGED
@@ -1,4 +1,4 @@
1
- import { keypairFromSecretKey } from './chunk-2X22JY7Q.js';
1
+ import { keypairFromSecretKey } from './chunk-H77BBZOL.js';
2
2
  import { readFileSync } from 'fs';
3
3
  import { Wallet } from '@anchor-lang/core';
4
4
  export { Wallet } from '@anchor-lang/core';
@@ -17,21 +17,23 @@ interface Node {
17
17
  /** Node secp256k1 public key (hex). Used for ECDH config encryption. */
18
18
  signingKey: string;
19
19
  }
20
- /** Selected node-key material that must be authenticated before private API encryption. */
20
+ /**
21
+ * Node-key material that must be authenticated before private API encryption. Secrets are
22
+ * encrypted for every node of the registry, because the committee is not known until the
23
+ * gateway has assigned the round's timestamp.
24
+ */
21
25
  interface NodeKeyVerifierArgs {
22
26
  /** 32-byte source id, hex. */
23
27
  sourceId: string;
24
28
  /** On-chain registry version the gateway round is bound to. */
25
29
  registryVersion: number;
26
- /** Canonical timestamp used to derive the selected indexes. */
27
- timestamp: number;
28
- /** Selected node indexes derived from the round bitmap, ascending. */
29
- selectedIndexes: readonly number[];
30
- /** Gateway-provided selected nodes whose keys must be authenticated. */
31
- selectedNodes: readonly Node[];
30
+ /** Every node index of that registry version, ascending. */
31
+ nodeIndexes: readonly number[];
32
+ /** Gateway-provided nodes, one per index, whose keys must be authenticated. */
33
+ nodes: readonly Node[];
32
34
  }
33
35
  /**
34
- * Authenticates selected gateway node encryption keys. Throwing fails the
36
+ * Authenticates gateway-provided node encryption keys. Throwing fails the
35
37
  * private API request before secrets are encrypted or posted.
36
38
  */
37
39
  type NodeKeyVerifier = (args: NodeKeyVerifierArgs) => void | Promise<void>;
@@ -121,8 +123,8 @@ interface AttestationPayload {
121
123
  sourceId: string;
122
124
  registryVersion: number;
123
125
  signaturesRequired: number;
124
- /** Unix seconds (u64). */
125
- canonicalTimestamp: number;
126
+ /** Gateway-assigned round time in unix MILLISECONDS (u64). Divide by 1000 for seconds. */
127
+ timestamp: number;
126
128
  }
127
129
  /**
128
130
  * Threshold-signed oracle attestation from a completed gateway round, ready to submit on-chain.
@@ -224,7 +226,7 @@ type SolanaAccountMeta = {
224
226
  };
225
227
 
226
228
  /**
227
- * Unified wallet surface: Anchor txs + optional gateway authSig signing.
229
+ * Unified wallet surface: Anchor txs + gateway request-auth signing.
228
230
  */
229
231
 
230
232
  /** Anchor `Wallet` plus optional gateway auth override. */
@@ -240,4 +242,4 @@ declare function signerFromKeypair(keypair: SolanaKeypair): Signer;
240
242
  /** Resolve the gateway auth signer for a Molpha wallet, if available. */
241
243
  declare function gatewaySignerFromWallet(wallet: Wallet): Signer | undefined;
242
244
 
243
- export { type APIConfig as A, type EvmSigner as E, type MolphaWallet as M, type NodeKeyVerifier as N, type RegistrySelectionConfig as R, type Signer as S, type UpstreamQuote as U, type AssetDomain as a, type UpstreamTerms as b, type Node as c, type NodesInfo as d, type SourcePaymentOptions as e, type Attestation as f, type SolanaAccountMeta as g, type SolanaConnection as h, type SolanaAddress as i, type NodeKeyVerifierArgs as j, type AggregationConfig as k, type AttestationPayload as l, type EncKeyBundle as m, type NumericConfig as n, type RegistryInfo as o, type SchnorrSignature as p, gatewaySignerFromWallet as q, type SolanaKeypair as r, signerFromKeypair as s };
245
+ export { type APIConfig as A, type EvmSigner as E, type MolphaWallet as M, type Node as N, type RegistrySelectionConfig as R, type Signer as S, type UpstreamQuote as U, type AssetDomain as a, type UpstreamTerms as b, type SourcePaymentOptions as c, type NodeKeyVerifier as d, type NodesInfo as e, type Attestation as f, type SolanaAccountMeta as g, type SolanaConnection as h, type SolanaAddress as i, type NodeKeyVerifierArgs as j, type AggregationConfig as k, type AttestationPayload as l, type EncKeyBundle as m, type NumericConfig as n, type RegistryInfo as o, type SchnorrSignature as p, gatewaySignerFromWallet as q, type SolanaKeypair as r, signerFromKeypair as s };
package/idl/molpha.json CHANGED
@@ -4629,7 +4629,7 @@
4629
4629
  {
4630
4630
  "code": 6030,
4631
4631
  "name": "FeedNotNewer",
4632
- "msg": "canonical_timestamp <= feed.canonical_timestamp"
4632
+ "msg": "timestamp <= feed.timestamp"
4633
4633
  },
4634
4634
  {
4635
4635
  "code": 6031,
@@ -4774,12 +4774,12 @@
4774
4774
  {
4775
4775
  "code": 6059,
4776
4776
  "name": "AttestationTooStale",
4777
- "msg": "canonical_timestamp is older than now - max_settlement_delay_seconds"
4777
+ "msg": "timestamp is older than now - max_settlement_delay_seconds"
4778
4778
  },
4779
4779
  {
4780
4780
  "code": 6060,
4781
4781
  "name": "AttestationInFuture",
4782
- "msg": "canonical_timestamp is further ahead of cluster time than the allowed drift"
4782
+ "msg": "timestamp is further ahead of cluster time than the allowed drift"
4783
4783
  },
4784
4784
  {
4785
4785
  "code": 6061,
@@ -4904,7 +4904,7 @@
4904
4904
  {
4905
4905
  "code": 6085,
4906
4906
  "name": "RoundOutsideEpoch",
4907
- "msg": "canonical_timestamp is outside the epoch window"
4907
+ "msg": "timestamp is outside the epoch window"
4908
4908
  },
4909
4909
  {
4910
4910
  "code": 6086,
@@ -4980,6 +4980,11 @@
4980
4980
  "code": 6100,
4981
4981
  "name": "InvalidRentReceiver",
4982
4982
  "msg": "rent receiver must be the account that paid for the closed account"
4983
+ },
4984
+ {
4985
+ "code": 6101,
4986
+ "name": "InvalidInitialTau",
4987
+ "msg": "initial_tau is below the minimum ticket threshold"
4983
4988
  }
4984
4989
  ],
4985
4990
  "types": [
@@ -5061,7 +5066,7 @@
5061
5066
  "type": "u8"
5062
5067
  },
5063
5068
  {
5064
- "name": "canonical_timestamp",
5069
+ "name": "timestamp",
5065
5070
  "type": "u64"
5066
5071
  }
5067
5072
  ]
@@ -5712,7 +5717,7 @@
5712
5717
  "type": "pubkey"
5713
5718
  },
5714
5719
  {
5715
- "name": "canonical_timestamp",
5720
+ "name": "timestamp",
5716
5721
  "type": "u64"
5717
5722
  },
5718
5723
  {
@@ -5758,7 +5763,7 @@
5758
5763
  "type": "u32"
5759
5764
  },
5760
5765
  {
5761
- "name": "canonical_timestamp",
5766
+ "name": "timestamp",
5762
5767
  "type": "u64"
5763
5768
  },
5764
5769
  {
@@ -6019,6 +6024,18 @@
6019
6024
  {
6020
6025
  "name": "protocol_fee_bps",
6021
6026
  "type": "u16"
6027
+ },
6028
+ {
6029
+ "name": "initial_tau",
6030
+ "docs": [
6031
+ "Ticket threshold of the two genesis epochs: a round is a ticket when the 64-bit prefix of its",
6032
+ "ticket hash is below it, so the sampling probability is `initial_tau / 2^64`. Size it as",
6033
+ "`2^64 * target_tickets_per_epoch / expected_rounds_per_epoch`. `u64::MAX` samples every round",
6034
+ "(every round then costs a ticket transaction until the controller, which moves the",
6035
+ "threshold at most 8x per epoch with a two-epoch lag, brings it down). Must be at least",
6036
+ "`TAU_MIN`."
6037
+ ],
6038
+ "type": "u64"
6022
6039
  }
6023
6040
  ]
6024
6041
  }
@@ -6813,7 +6830,7 @@
6813
6830
  {
6814
6831
  "name": "max_settlement_delay_seconds",
6815
6832
  "docs": [
6816
- "Max age in seconds of `canonical_timestamp` relative to cluster time at attestation",
6833
+ "Max age in seconds of `timestamp` relative to cluster time at attestation",
6817
6834
  "ingress, and the grace period of a superseded registry version."
6818
6835
  ],
6819
6836
  "type": "u64"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molpha/sdk",
3
- "version": "0.2.0-dev-20261002062009",
3
+ "version": "0.2.0-dev-20261005191253",
4
4
  "description": "Molpha Consumer SDK — subscribe, request signed data from the gateway, submit attestations and read on-chain feeds.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/solana/kit.ts"],"names":[],"mappings":";;;;AAaO,IAAM,qBAAA,GAAwB,QAAQ,6CAA6C;AACnF,IAAM,gCAAA,GAAmC,OAAA;AAAA,EAC9C;AACF,CAAA;AACO,IAAM,sBAAA,GAAyB,QAAQ,kCAAkC;AAEhF,IAAM,iBAAiB,iBAAA,EAAkB;AACzC,IAAM,iBAAiB,iBAAA,EAAkB;AAElC,SAAS,gBAAgB,KAAA,EAA+B;AAC7D,EAAA,OAAO,QAAQ,OAAO,KAAA,KAAU,WAAW,KAAA,GAAQ,KAAA,CAAM,UAAU,CAAA;AACrE;AAEO,SAAS,YAAY,KAAA,EAA2D;AACrF,EAAA,OAAO,iBAAiB,IAAA,CAAK,SAAA,GAAY,QAAQ,IAAI,IAAA,CAAK,UAAU,KAAK,CAAA;AAC3E;AAEO,SAAS,aAAa,KAAA,EAAkC;AAC7D,EAAA,OAAO,WAAW,IAAA,CAAK,cAAA,CAAe,OAAO,eAAA,CAAgB,KAAK,CAAC,CAAC,CAAA;AACtE;AAGO,SAAS,iBAAiB,KAAA,EAA4B;AAC3D,EAAA,OAAO,cAAA,CAAe,OAAO,KAAK,CAAA;AACpC;AAEO,SAAS,sBAAA,CACd,OACA,cAAA,EACS;AACT,EAAA,MAAM,CAAC,GAAG,CAAA,GAAI,IAAA,CAAK,UAAU,sBAAA,CAAuB,KAAA,EAAO,WAAA,CAAY,cAAc,CAAC,CAAA;AACtF,EAAA,OAAO,gBAAgB,GAAG,CAAA;AAC5B;AAUO,SAAS,6BAAA,CACd,IAAA,EACA,KAAA,EACA,YAAA,GAA8B,qBAAA,EACrB;AACT,EAAA,OAAO,sBAAA;AAAA,IACL,CAAC,aAAa,KAAK,CAAA,EAAG,aAAa,YAAY,CAAA,EAAG,YAAA,CAAa,IAAI,CAAC,CAAA;AAAA,IACpE;AAAA,GACF;AACF;AAEO,SAAS,oBAAoB,KAAA,EAAkC;AACpE,EAAA,OAAO,IAAA,CAAK,oBAAA,CAAqB,mBAAA,CAAoB,EAAE,OAAO,CAAA;AAChE;AAEO,SAAS,qBAAqB,SAAA,EAAsC;AACzE,EAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,aAAA,CAAc,SAAS,CAAA;AAC7C","file":"chunk-2X22JY7Q.js","sourcesContent":["import { web3 } from \"@anchor-lang/core\";\nimport { address, getAddressDecoder, getAddressEncoder, type Address } from \"@solana/kit\";\n\nexport type SolanaAddress = Address | string | InstanceType<typeof web3.PublicKey>;\nexport type SolanaConnection = InstanceType<typeof web3.Connection>;\nexport type SolanaKeypair = InstanceType<typeof web3.Keypair>;\nexport type SolanaInstruction = InstanceType<typeof web3.TransactionInstruction>;\nexport type SolanaAccountMeta = {\n pubkey: InstanceType<typeof web3.PublicKey>;\n isSigner: boolean;\n isWritable: boolean;\n};\n\nexport const TOKEN_PROGRAM_ADDRESS = address(\"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA\");\nexport const ASSOCIATED_TOKEN_PROGRAM_ADDRESS = address(\n \"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL\",\n);\nexport const SYSTEM_PROGRAM_ADDRESS = address(\"11111111111111111111111111111111\");\n\nconst addressEncoder = getAddressEncoder();\nconst addressDecoder = getAddressDecoder();\n\nexport function toSolanaAddress(value: SolanaAddress): Address {\n return address(typeof value === \"string\" ? value : value.toBase58());\n}\n\nexport function toPublicKey(value: SolanaAddress): InstanceType<typeof web3.PublicKey> {\n return value instanceof web3.PublicKey ? value : new web3.PublicKey(value);\n}\n\nexport function addressBytes(value: SolanaAddress): Uint8Array {\n return Uint8Array.from(addressEncoder.encode(toSolanaAddress(value)));\n}\n\n/** Base58 `Address` from 32 raw bytes (e.g. a `Registry.nodes[i]` entry). */\nexport function addressFromBytes(bytes: Uint8Array): Address {\n return addressDecoder.decode(bytes);\n}\n\nexport function findProgramAddressSync(\n seeds: Uint8Array[],\n programAddress: SolanaAddress,\n): Address {\n const [pda] = web3.PublicKey.findProgramAddressSync(seeds, toPublicKey(programAddress));\n return toSolanaAddress(pda);\n}\n\nexport function findProgramPublicKeySync(\n seeds: Uint8Array[],\n programAddress: SolanaAddress,\n): InstanceType<typeof web3.PublicKey> {\n const [pda] = web3.PublicKey.findProgramAddressSync(seeds, toPublicKey(programAddress));\n return pda;\n}\n\nexport function getAssociatedTokenAddressSync(\n mint: SolanaAddress,\n owner: SolanaAddress,\n tokenProgram: SolanaAddress = TOKEN_PROGRAM_ADDRESS,\n): Address {\n return findProgramAddressSync(\n [addressBytes(owner), addressBytes(tokenProgram), addressBytes(mint)],\n ASSOCIATED_TOKEN_PROGRAM_ADDRESS,\n );\n}\n\nexport function setComputeUnitLimit(units: number): SolanaInstruction {\n return web3.ComputeBudgetProgram.setComputeUnitLimit({ units });\n}\n\nexport function keypairFromSecretKey(secretKey: Uint8Array): SolanaKeypair {\n return web3.Keypair.fromSecretKey(secretKey);\n}\n\nexport function generateKeypair(): SolanaKeypair {\n return web3.Keypair.generate();\n}\n"]}