@molpha/sdk 0.1.0 → 0.2.0-dev-20260911113923
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/README.md +128 -82
- package/dist/{chunk-MFELBWSL.js → chunk-DT6IKCWB.js} +8 -4
- package/dist/chunk-DT6IKCWB.js.map +1 -0
- package/dist/index.d.ts +266 -99
- package/dist/index.js +6755 -2188
- package/dist/index.js.map +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/dist/{wallet-CbpYQO4l.d.ts → wallet-udLZ5Iy0.d.ts} +23 -12
- package/idl/molpha.json +6385 -2009
- package/package.json +26 -17
- package/dist/chunk-MFELBWSL.js.map +0 -1
package/dist/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { Wallet } from '@anchor-lang/core';
|
|
2
|
-
import { S as Signer, h as SolanaKeypair, M as MolphaWallet } from './wallet-
|
|
2
|
+
import { S as Signer, h as SolanaKeypair, M as MolphaWallet } from './wallet-udLZ5Iy0.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, signerFromKeypair } from './chunk-
|
|
1
|
+
import { keypairFromSecretKey, signerFromKeypair } from './chunk-DT6IKCWB.js';
|
|
2
2
|
import { readFileSync } from 'fs';
|
|
3
3
|
import { Wallet } from '@anchor-lang/core';
|
|
4
4
|
export { Wallet } from '@anchor-lang/core';
|
|
@@ -4,9 +4,13 @@ import { Address } from '@solana/kit';
|
|
|
4
4
|
/**
|
|
5
5
|
* Public protocol types (spec §8). Kept dependency-free so they can be imported
|
|
6
6
|
* from any entry point.
|
|
7
|
+
*
|
|
8
|
+
* Hex convention: every `*Id`, bitmap, scalar and address field typed `string` is plain
|
|
9
|
+
* lowercase hex without a `0x` prefix unless documented otherwise.
|
|
7
10
|
*/
|
|
8
11
|
/** A registered oracle node as returned by the gateway. */
|
|
9
12
|
interface Node {
|
|
13
|
+
/** Position in the registry snapshot; maps to signers-bitmap bit `index`. */
|
|
10
14
|
index: number;
|
|
11
15
|
peerId: string;
|
|
12
16
|
address: string;
|
|
@@ -15,8 +19,8 @@ interface Node {
|
|
|
15
19
|
}
|
|
16
20
|
/** Selected node-key material that must be authenticated before private API encryption. */
|
|
17
21
|
interface NodeKeyVerifierArgs {
|
|
18
|
-
/** 32-byte
|
|
19
|
-
|
|
22
|
+
/** 32-byte source id, hex. */
|
|
23
|
+
sourceId: string;
|
|
20
24
|
/** On-chain registry version the gateway round is bound to. */
|
|
21
25
|
registryVersion: number;
|
|
22
26
|
/** Canonical timestamp used to derive the selected indexes. */
|
|
@@ -31,7 +35,7 @@ interface NodeKeyVerifierArgs {
|
|
|
31
35
|
* private API request before secrets are encrypted or posted.
|
|
32
36
|
*/
|
|
33
37
|
type NodeKeyVerifier = (args: NodeKeyVerifierArgs) => void | Promise<void>;
|
|
34
|
-
/** The off-chain API definition a
|
|
38
|
+
/** The off-chain API definition a source resolves. */
|
|
35
39
|
interface APIConfig {
|
|
36
40
|
url: string;
|
|
37
41
|
method?: "GET" | "POST" | "PUT";
|
|
@@ -49,20 +53,26 @@ interface EncKeyBundle {
|
|
|
49
53
|
/** nodeIndex -> hex(nonceEnv || wrappedSymKey) */
|
|
50
54
|
envelopes: Record<string, string>;
|
|
51
55
|
}
|
|
52
|
-
/** Signs a message and returns a 64-byte ed25519 signature. */
|
|
56
|
+
/** Signs a 32-byte message and returns a 64-byte ed25519 signature. */
|
|
53
57
|
type Signer = (message: Uint8Array) => Promise<Uint8Array>;
|
|
54
58
|
/**
|
|
55
|
-
* On-chain registry fields a gateway selection round is bound to.
|
|
56
|
-
* `RegistryState
|
|
59
|
+
* On-chain registry fields a gateway selection round is bound to. `registryVersion`
|
|
60
|
+
* comes from `RegistryState.current_version`; `redundancyBuffer` and `nodeCount` from
|
|
61
|
+
* the version-addressed `Registry` snapshot.
|
|
57
62
|
*/
|
|
58
63
|
interface RegistrySelectionConfig {
|
|
59
64
|
registryVersion: number;
|
|
60
65
|
/** Selection padding: `min(signaturesRequired + redundancyBuffer, nodeCount)`. */
|
|
61
66
|
redundancyBuffer: number;
|
|
67
|
+
/**
|
|
68
|
+
* `Registry.node_count` of the snapshot — the value the chain derives selection from.
|
|
69
|
+
* Optional for standalone callers; when absent the gateway node-list length is used.
|
|
70
|
+
*/
|
|
71
|
+
nodeCount?: number;
|
|
62
72
|
}
|
|
63
73
|
/**
|
|
64
|
-
* Aggregate Schnorr signature in the commitment-address form the
|
|
65
|
-
*
|
|
74
|
+
* Aggregate Schnorr signature in the commitment-address form the program verifies over
|
|
75
|
+
* the attestation message (see `attestationMessageHash`).
|
|
66
76
|
*/
|
|
67
77
|
interface SchnorrSignature {
|
|
68
78
|
/** 32-byte scalar, hex. */
|
|
@@ -74,10 +84,11 @@ interface SchnorrSignature {
|
|
|
74
84
|
}
|
|
75
85
|
/** A completed gateway round, ready to submit on-chain. */
|
|
76
86
|
interface DataUpdateResult {
|
|
77
|
-
|
|
87
|
+
/** 32-byte source id, hex (`deriveSourceId(apiConfig)`). */
|
|
88
|
+
sourceId: string;
|
|
78
89
|
/** Human-readable value. */
|
|
79
90
|
value: string;
|
|
80
|
-
/** 32-byte packed value, hex. */
|
|
91
|
+
/** 32-byte packed value, hex — the bytes covered by the signature. */
|
|
81
92
|
valuePacked: string;
|
|
82
93
|
/** canonicalTimestamp (seconds). */
|
|
83
94
|
timestamp: number;
|
|
@@ -109,7 +120,7 @@ type SolanaAccountMeta = {
|
|
|
109
120
|
/** Anchor `Wallet` plus optional gateway auth override. */
|
|
110
121
|
type MolphaWallet = Wallet & {
|
|
111
122
|
/**
|
|
112
|
-
* Signs gateway `
|
|
123
|
+
* Signs gateway request-auth hashes (`hashRequestAuth`). When omitted, derived from Anchor
|
|
113
124
|
* `Wallet.payer` when the keypair secret is available (Node `Wallet`, etc.).
|
|
114
125
|
*/
|
|
115
126
|
signAuthMessage?: Signer;
|
|
@@ -119,4 +130,4 @@ declare function signerFromKeypair(keypair: SolanaKeypair): Signer;
|
|
|
119
130
|
/** Resolve the gateway auth signer for a Molpha wallet, if available. */
|
|
120
131
|
declare function gatewaySignerFromWallet(wallet: Wallet): Signer | undefined;
|
|
121
132
|
|
|
122
|
-
export { type APIConfig as A, type DataUpdateResult as D, type EncKeyBundle as E, type MolphaWallet as M, type NodeKeyVerifier as N, type RegistrySelectionConfig as R, type Signer as S, type Node as a, type
|
|
133
|
+
export { type APIConfig as A, type DataUpdateResult as D, type EncKeyBundle as E, type MolphaWallet as M, type NodeKeyVerifier as N, type RegistrySelectionConfig as R, type Signer as S, type Node as a, type SolanaAccountMeta as b, type SolanaConnection as c, type SolanaAddress as d, type NodeKeyVerifierArgs as e, type SchnorrSignature as f, gatewaySignerFromWallet as g, type SolanaKeypair as h, signerFromKeypair as s };
|