@molpha/sdk 0.2.0-dev-20261001084453 → 0.2.0-dev-20261002062009
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 +80 -56
- package/dist/{chunk-DT6IKCWB.js → chunk-2X22JY7Q.js} +3 -15
- package/dist/chunk-2X22JY7Q.js.map +1 -0
- package/dist/index.d.ts +162 -33
- package/dist/index.js +2682 -1462
- package/dist/index.js.map +1 -1
- package/dist/utils.d.ts +2 -6
- package/dist/utils.js +2 -6
- package/dist/utils.js.map +1 -1
- package/dist/{wallet-DwdBZgl1.d.ts → wallet-HfGXPpOp.d.ts} +49 -15
- package/idl/molpha.json +2004 -1098
- package/package.json +1 -1
- package/dist/chunk-DT6IKCWB.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Address } from '@solana/kit';
|
|
2
2
|
import { Wallet, Idl, AnchorProvider } from '@anchor-lang/core';
|
|
3
|
-
import { U as UpstreamQuote, A as APIConfig, a as AssetDomain, b as UpstreamTerms, E as EvmSigner, R as RegistrySelectionConfig, S as Signer, N as NodeKeyVerifier, c as Node, d as NodesInfo, e as SourcePaymentOptions,
|
|
4
|
-
export {
|
|
3
|
+
import { U as UpstreamQuote, A as APIConfig, a as AssetDomain, b as UpstreamTerms, E as EvmSigner, R as RegistrySelectionConfig, S as Signer, N as NodeKeyVerifier, c as Node, d as NodesInfo, e as SourcePaymentOptions, f as Attestation, g as SolanaAccountMeta, h as SolanaConnection, i as SolanaAddress, j as NodeKeyVerifierArgs, k as AggregationConfig, M as MolphaWallet } from './wallet-HfGXPpOp.js';
|
|
4
|
+
export { l as AttestationPayload, m as EncKeyBundle, n as NumericConfig, o as RegistryInfo, p as SchnorrSignature, q as gatewaySignerFromWallet, s as signerFromKeypair } from './wallet-HfGXPpOp.js';
|
|
5
5
|
import BN from 'bn.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -105,7 +105,11 @@ interface RequestSignedDataOptions {
|
|
|
105
105
|
* same config (including `{{secret.*}}` placeholders) every time.
|
|
106
106
|
*/
|
|
107
107
|
apiConfig: APIConfig;
|
|
108
|
-
/**
|
|
108
|
+
/**
|
|
109
|
+
* Requested quorum (u8, ≥ the protocol `min_signers`). Median tolerance mode
|
|
110
|
+
* (`apiConfig.aggregation`) additionally requires `>= 3`; lower values are rejected
|
|
111
|
+
* before any request is made.
|
|
112
|
+
*/
|
|
109
113
|
signaturesRequired: number;
|
|
110
114
|
/**
|
|
111
115
|
* Solana pubkey (base58) of the subscription owner.
|
|
@@ -270,7 +274,7 @@ declare class MolphaGateway {
|
|
|
270
274
|
* fund it; without that, such a source throws
|
|
271
275
|
* {@link UpstreamPaymentRequiredError} carrying the gateway's quote.
|
|
272
276
|
*/
|
|
273
|
-
requestSignedData(opts: RequestSignedDataOptions): Promise<
|
|
277
|
+
requestSignedData(opts: RequestSignedDataOptions): Promise<Attestation>;
|
|
274
278
|
/**
|
|
275
279
|
* Resolve the round inputs, fetching only the fields absent from `cached`.
|
|
276
280
|
* Registry version, redundancy buffer and node count are treated as a unit (one
|
|
@@ -286,8 +290,31 @@ declare class MolphaGateway {
|
|
|
286
290
|
private fetchWithTimeout;
|
|
287
291
|
}
|
|
288
292
|
|
|
293
|
+
/** Affine coalition key, 32-byte big-endian coordinates (`CoalitionKey` in the program IDL). */
|
|
294
|
+
interface CoalitionKey {
|
|
295
|
+
x: Uint8Array;
|
|
296
|
+
y: Uint8Array;
|
|
297
|
+
}
|
|
298
|
+
/** A signer's public key: SEC1 compressed / uncompressed (bytes or hex), or affine `(x, y)`. */
|
|
299
|
+
type Secp256k1KeyInput = Uint8Array | string | {
|
|
300
|
+
x: Uint8Array | string;
|
|
301
|
+
y: Uint8Array | string;
|
|
302
|
+
};
|
|
303
|
+
/**
|
|
304
|
+
* Affine sum of `keys` as a {@link CoalitionKey}.
|
|
305
|
+
*
|
|
306
|
+
* @throws {Error} on an empty set, an invalid point, or a sum at infinity (the verifier
|
|
307
|
+
* rejects both of the latter as `InvalidAggregateSignature`).
|
|
308
|
+
*/
|
|
309
|
+
declare function computeCoalitionKey(keys: Iterable<Secp256k1KeyInput>): CoalitionKey;
|
|
310
|
+
|
|
289
311
|
/**
|
|
290
312
|
* Account views and remaining-accounts construction for `submit_attestation`.
|
|
313
|
+
*
|
|
314
|
+
* `submit_attestation` (program 3d01170, `utils/attestation.rs::verify_attestation_core`)
|
|
315
|
+
* takes exactly one `Node` account per set signer bit, read-only, in ascending bit order
|
|
316
|
+
* (`remaining_accounts.len() == popcount(signersBitmap)`); the verifier requires
|
|
317
|
+
* `account == registry.nodes[bit]` and reads each signer's secp256k1 key from it.
|
|
291
318
|
*/
|
|
292
319
|
|
|
293
320
|
/** On-chain `RegistryState` (Anchor camelCase): pointer to the current immutable snapshot. */
|
|
@@ -307,6 +334,8 @@ interface RegistryView {
|
|
|
307
334
|
nodes: Address[];
|
|
308
335
|
/** Unix seconds until which this superseded snapshot still verifies; `0n` while current. */
|
|
309
336
|
graceActiveUntil: bigint;
|
|
337
|
+
/** Inclusive creation time (unix seconds): a version cannot verify a round dated before it existed. */
|
|
338
|
+
activeFrom: bigint;
|
|
310
339
|
}
|
|
311
340
|
/** Set-bit indices of a 32-byte big-endian bitmap (full 256-bit scan). */
|
|
312
341
|
declare function bitmapToIndices(signersBitmapHex: string): number[];
|
|
@@ -342,7 +371,7 @@ declare function planIdFromVariant(variant: Record<string, unknown>): PlanId;
|
|
|
342
371
|
* `MolphaSolanaClient` — consumer on-chain surface only (subscribe, extend,
|
|
343
372
|
* submitAttestation, readFeed/readPlan/readSubscription/readRegistry,
|
|
344
373
|
* getRegistrySelectionConfig, verifyNodeKeysForPrivateApi). Built from an Anchor
|
|
345
|
-
* `Program` over the vendored IDL.
|
|
374
|
+
* `Program` over the vendored IDL (program `3d01170`, "Epoch settlements").
|
|
346
375
|
*/
|
|
347
376
|
|
|
348
377
|
type Commitment$1 = NonNullable<ConstructorParameters<typeof AnchorProvider>[2]>["commitment"];
|
|
@@ -362,12 +391,17 @@ interface PlanInfo {
|
|
|
362
391
|
privateApiEnabled: boolean;
|
|
363
392
|
isActive: boolean;
|
|
364
393
|
}
|
|
394
|
+
/**
|
|
395
|
+
* On-chain `Subscription`. The program no longer tracks usage: `used_rounds`,
|
|
396
|
+
* `prepaid_usdc` and the locked `price` were removed (round quota is counted by the
|
|
397
|
+
* gateway's off-chain outbox), so there is no on-chain "rounds used" figure to read.
|
|
398
|
+
*/
|
|
365
399
|
interface SubscriptionInfo {
|
|
366
400
|
owner: Address;
|
|
367
401
|
planType: PlanType;
|
|
368
402
|
/** Unix timestamp (seconds) until which the subscription is valid. */
|
|
369
403
|
validUntil: bigint;
|
|
370
|
-
|
|
404
|
+
/** Round quota per plan snapshot — enforced by the gateway at admission, not on chain. */
|
|
371
405
|
maxRounds: bigint;
|
|
372
406
|
delegateCount: number;
|
|
373
407
|
maxDelegates: number;
|
|
@@ -378,9 +412,15 @@ interface SubmitResult {
|
|
|
378
412
|
/** Feed PDA written by this submit (`["molpha_feed", sourceId, [signaturesRequired], submitter]`). */
|
|
379
413
|
feed: Address;
|
|
380
414
|
}
|
|
415
|
+
/**
|
|
416
|
+
* On-chain `Feed` (Anchor-decoded). `value` is always the signed
|
|
417
|
+
* `AttestationPayload.value` (32 bytes): the oracle value itself when `valueKind` is
|
|
418
|
+
* `value`, or `keccak256(rawValue)` when it is `hash` (the preimage travelled in the
|
|
419
|
+
* submitting instruction). For a tolerance-mode source it is a two's-complement `int256`
|
|
420
|
+
* (see `decodeInt256` / `formatInt256Decimal`).
|
|
421
|
+
*/
|
|
381
422
|
interface FeedAccount {
|
|
382
423
|
sourceId: number[];
|
|
383
|
-
/** Signed 32-byte value, or the keccak digest of the submitted raw-value preimage. */
|
|
384
424
|
value: Uint8Array | number[];
|
|
385
425
|
valueKind: {
|
|
386
426
|
value: Record<string, never>;
|
|
@@ -413,12 +453,21 @@ interface SubmitAttestationArgs {
|
|
|
413
453
|
};
|
|
414
454
|
/** Optional preimage when `payload.value` is `keccak256(rawValue)`. */
|
|
415
455
|
rawValue: Uint8Array | null;
|
|
456
|
+
coalitionKey: {
|
|
457
|
+
x: number[];
|
|
458
|
+
y: number[];
|
|
459
|
+
};
|
|
416
460
|
}
|
|
417
461
|
interface SubmitAttestationOptions {
|
|
418
462
|
computeUnitLimit?: number;
|
|
463
|
+
/**
|
|
464
|
+
* Precomputed signer coalition key. When omitted, the client fetches signer `Node`
|
|
465
|
+
* accounts and sums their secp256k1 keys ({@link computeCoalitionKey}).
|
|
466
|
+
*/
|
|
467
|
+
coalitionKey?: CoalitionKey;
|
|
419
468
|
/**
|
|
420
469
|
* Optional value preimage (maximum 256 bytes). Its keccak256 digest must equal
|
|
421
|
-
* `
|
|
470
|
+
* `attestation.payload.value`; the program stores that digest with `valueKind.hash`.
|
|
422
471
|
*/
|
|
423
472
|
rawValue?: Uint8Array;
|
|
424
473
|
}
|
|
@@ -487,13 +536,21 @@ declare class MolphaSolanaClient {
|
|
|
487
536
|
private confirmPlanPrice;
|
|
488
537
|
/**
|
|
489
538
|
* Submit a gateway attestation via `submit_attestation`. The feed account for
|
|
490
|
-
* `(sourceId, signaturesRequired, submitter)` is created on first use.
|
|
491
|
-
*
|
|
492
|
-
*
|
|
539
|
+
* `(sourceId, signaturesRequired, submitter)` is created on first use.
|
|
540
|
+
*
|
|
541
|
+
* Per the program, the instruction takes one read-only `Node` account per signer bit
|
|
542
|
+
* (ascending bit order, resolved from the registry snapshot the round was signed
|
|
543
|
+
* against) and a {@link CoalitionKey} argument. Unless `opts.coalitionKey` is given the
|
|
544
|
+
* SDK fetches those `Node` accounts and sums their secp256k1 keys client-side
|
|
545
|
+
* (`computeCoalitionKey`); the program only checks the key, so a wrong one fails the
|
|
546
|
+
* transaction and nothing else.
|
|
547
|
+
*
|
|
548
|
+
* `opts.rawValue` is for values longer than 32 bytes: the signed `payload.value` must be
|
|
549
|
+
* `keccak256(rawValue)`; {@link buildSubmitAttestationArgs} validates that before send.
|
|
493
550
|
*/
|
|
494
|
-
submitAttestation(
|
|
495
|
-
/**
|
|
496
|
-
|
|
551
|
+
submitAttestation(attestation: Attestation, opts?: SubmitAttestationOptions): Promise<SubmitResult>;
|
|
552
|
+
/** Sum of the signers' keys, read from their on-chain `Node` accounts (one batched fetch). */
|
|
553
|
+
private computeSignerCoalitionKey;
|
|
497
554
|
/**
|
|
498
555
|
* Read the feed written by `submitter` (default: this wallet) for
|
|
499
556
|
* `(sourceId, signaturesRequired)`, or `null` before its first submit.
|
|
@@ -511,10 +568,59 @@ declare class MolphaSolanaClient {
|
|
|
511
568
|
/** `usdc_mint` from `ProtocolConfig`; the treasury is its ATA owned by the config PDA. */
|
|
512
569
|
private fetchProtocolTokens;
|
|
513
570
|
}
|
|
514
|
-
/**
|
|
515
|
-
|
|
571
|
+
/**
|
|
572
|
+
* Build the Anchor `SubmitAttestationArgs` for a gateway result: `{ attestation: { payload,
|
|
573
|
+
* signature }, rawValue, coalitionKey }`. `coalitionKey` is the affine sum of the signers'
|
|
574
|
+
* keys (see `computeCoalitionKey`).
|
|
575
|
+
*/
|
|
576
|
+
declare function buildSubmitAttestationArgs(attestation: Attestation, coalitionKey: CoalitionKey, rawValue?: Uint8Array | null): SubmitAttestationArgs;
|
|
516
577
|
|
|
517
|
-
/**
|
|
578
|
+
/**
|
|
579
|
+
* Aggregation (tolerance mode) config validation and canonicalization.
|
|
580
|
+
*
|
|
581
|
+
* `aggregation` is part of the API config and therefore part of `sourceId`. It is OMITTED
|
|
582
|
+
* for exact mode: a config carrying `mode: "exact"` would hash differently from the same
|
|
583
|
+
* config without the key, so it is rejected rather than silently normalized. The node
|
|
584
|
+
* (`new/tolerance.Validate`) is the reference.
|
|
585
|
+
*/
|
|
586
|
+
|
|
587
|
+
/** Tolerance mode needs at least this many signers (`signaturesRequired >= 3`). */
|
|
588
|
+
declare const MIN_TOLERANCE_SIGNATURES = 3;
|
|
589
|
+
/** Thrown for an unusable `aggregation` config. */
|
|
590
|
+
declare class AggregationConfigError extends Error {
|
|
591
|
+
constructor(message: string);
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* Validate an `aggregation` config and return a fresh object with the canonical key order
|
|
595
|
+
* (`mode`, `rule`, `maxDeviationBps`, `maxAgeMs`, `numeric{type, decimals}`) — the order
|
|
596
|
+
* the source hash and the node's JSON blob use.
|
|
597
|
+
*
|
|
598
|
+
* The result is built field by field: unknown or reordered keys on the input can never
|
|
599
|
+
* reach the hash or the wire. `undefined` / `null` mean exact mode and return `undefined`.
|
|
600
|
+
*
|
|
601
|
+
* @throws {AggregationConfigError} on `mode: "exact"`, an unsupported mode / rule / numeric
|
|
602
|
+
* type, or an out-of-range number.
|
|
603
|
+
*/
|
|
604
|
+
declare function canonicalizeAggregation(aggregation: AggregationConfig | null | undefined): AggregationConfig | undefined;
|
|
605
|
+
/**
|
|
606
|
+
* Tolerance mode needs `signaturesRequired >= 3`; the node rejects anything lower.
|
|
607
|
+
* A no-op for exact mode (`aggregation` omitted).
|
|
608
|
+
*
|
|
609
|
+
* @throws {AggregationConfigError}
|
|
610
|
+
*/
|
|
611
|
+
declare function assertAggregationQuorum(aggregation: AggregationConfig | null | undefined, signaturesRequired: number): void;
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* Gateway wire shape — defaults applied before hash / encryption.
|
|
615
|
+
*
|
|
616
|
+
* Keys are emitted in the fixed order `url`, `method`, `headers`, `responseParser`,
|
|
617
|
+
* `valueTransform`, `aggregation`; `aggregation` is present only for tolerance mode and its
|
|
618
|
+
* nested keys are rebuilt in canonical order (`canonicalizeAggregation`), so no extra or
|
|
619
|
+
* reordered input key can reach the hash. A config without `aggregation` hashes exactly as
|
|
620
|
+
* before.
|
|
621
|
+
*
|
|
622
|
+
* @throws {AggregationConfigError} if `aggregation` is invalid (including `mode: "exact"`).
|
|
623
|
+
*/
|
|
518
624
|
declare function canonicalizeAPIConfig(apiConfig: APIConfig): APIConfig;
|
|
519
625
|
/**
|
|
520
626
|
* `sourceId = keccak256(JSON.stringify(canonical apiConfig))` — the 32-byte identity of a
|
|
@@ -525,15 +631,13 @@ declare function canonicalizeAPIConfig(apiConfig: APIConfig): APIConfig;
|
|
|
525
631
|
declare function deriveSourceId(apiConfig: APIConfig): Uint8Array;
|
|
526
632
|
/** Hex-encoded {@link deriveSourceId} (64 lowercase hex chars, no `0x`). */
|
|
527
633
|
declare function deriveSourceIdString(apiConfig: APIConfig): string;
|
|
528
|
-
/** @deprecated Renamed to {@link deriveSourceId}; identical bytes. */
|
|
529
|
-
declare const deriveApiConfigHash: typeof deriveSourceId;
|
|
530
634
|
|
|
531
635
|
/**
|
|
532
636
|
* Protocol-wide constants that must stay in sync with the vendored IDL. Kept as plain
|
|
533
637
|
* literals so gateway-only / browser bundles never pull in `idl/molpha.json`.
|
|
534
638
|
*/
|
|
535
639
|
/** Molpha program id (`idl/molpha.json` → `address`). Asserted equal in `test/gateway-auth.test.ts`. */
|
|
536
|
-
declare const MOLPHA_PROGRAM_ID = "
|
|
640
|
+
declare const MOLPHA_PROGRAM_ID = "chivcFQgxzwkpLvW41PV431HQ4dYpaW3povQH3AdpQt";
|
|
537
641
|
|
|
538
642
|
declare const utf8: (s: string) => Uint8Array;
|
|
539
643
|
declare const concatBytes: (...arrays: Uint8Array[]) => Uint8Array;
|
|
@@ -569,6 +673,30 @@ declare function bytesToBase64(bytes: Uint8Array): string;
|
|
|
569
673
|
/** Accepts padded or unpadded standard base64. */
|
|
570
674
|
declare function base64ToBytes(value: string): Uint8Array;
|
|
571
675
|
|
|
676
|
+
/** `2^255 - 1`. */
|
|
677
|
+
declare const INT256_MAX: bigint;
|
|
678
|
+
/** `-2^255`. */
|
|
679
|
+
declare const INT256_MIN: bigint;
|
|
680
|
+
/** Two's-complement `bytes32` (big-endian) of a signed integer in `[-2^255, 2^255)`. */
|
|
681
|
+
declare function encodeInt256(value: bigint): Uint8Array;
|
|
682
|
+
/** Signed integer of a two's-complement `bytes32` (bytes or hex, optional `0x`). */
|
|
683
|
+
declare function decodeInt256(value: Uint8Array | string): bigint;
|
|
684
|
+
/**
|
|
685
|
+
* Parse an ordinary decimal string (`[+-]digits[.digits]`, no exponent, no whitespace),
|
|
686
|
+
* scale by `10^decimals`, round half to even, and return the `int256` two's-complement
|
|
687
|
+
* `bytes32` the nodes sign for a tolerance-mode source.
|
|
688
|
+
*
|
|
689
|
+
* @throws {Error} `invalid decimal`, `decimal too long`, or `int256 overflow`.
|
|
690
|
+
*/
|
|
691
|
+
declare function encodeInt256Decimal(decimal: string, decimals: number): Uint8Array;
|
|
692
|
+
/**
|
|
693
|
+
* Render a signed integer — a two's-complement `bytes32` (bytes or hex), or an already
|
|
694
|
+
* decoded `bigint` — at the source's scale: `decimals` fractional places with trailing zeros
|
|
695
|
+
* trimmed (`-1.2`, `42`, `0.00000005`). Inverse of {@link encodeInt256Decimal} up to
|
|
696
|
+
* rounding.
|
|
697
|
+
*/
|
|
698
|
+
declare function formatInt256Decimal(value: Uint8Array | string | bigint, decimals: number): string;
|
|
699
|
+
|
|
572
700
|
/** `keccak256("MOLPHA_MESSAGE_V1")` domain separator. */
|
|
573
701
|
declare const MESSAGE_PREFIX: Uint8Array;
|
|
574
702
|
interface AttestationMessageFields {
|
|
@@ -586,8 +714,8 @@ interface AttestationMessageFields {
|
|
|
586
714
|
}
|
|
587
715
|
/** Compute the attestation message hash (32 bytes). */
|
|
588
716
|
declare function attestationMessageHash(fields: AttestationMessageFields): Uint8Array;
|
|
589
|
-
/** Message hash of a completed gateway
|
|
590
|
-
declare function
|
|
717
|
+
/** Message hash of a completed gateway attestation (`payload.value` is the signed word). */
|
|
718
|
+
declare function attestationMessageHashFromAttestation(attestation: Attestation): Uint8Array;
|
|
591
719
|
|
|
592
720
|
/**
|
|
593
721
|
* Parse a secp256k1 public key and return canonical compressed lower-case hex.
|
|
@@ -664,7 +792,7 @@ declare function verifyCodeName(code: number): VerifyCodeName | undefined;
|
|
|
664
792
|
* `setRedundancyBuffer`) and `Ownable` plumbing are deliberately left out.
|
|
665
793
|
*
|
|
666
794
|
* Mirrors `IVerifier.sol` in `molpha-core-contracts`. Struct member order is ABI-significant
|
|
667
|
-
* and equals the signed message order, so it is not the order
|
|
795
|
+
* and equals the signed message order, so it is not the flat gateway field order on `Attestation`.
|
|
668
796
|
*/
|
|
669
797
|
declare const MOLPHA_VERIFIER_ABI: readonly [{
|
|
670
798
|
readonly type: "function";
|
|
@@ -932,7 +1060,7 @@ declare function createEvmSignerFromPrivateKey(privateKey: string | Uint8Array):
|
|
|
932
1060
|
* `IVerifier.AttestationPayload` — the signed half of an attestation.
|
|
933
1061
|
*
|
|
934
1062
|
* Member order is the order of the signed message preimage and of the ABI tuple, so it is
|
|
935
|
-
* load bearing — it is not the order
|
|
1063
|
+
* load bearing — it is not the flat gateway field order on {@link Attestation}.
|
|
936
1064
|
*/
|
|
937
1065
|
interface EvmAttestationPayload {
|
|
938
1066
|
/** `bytes32` packed value. */
|
|
@@ -993,7 +1121,7 @@ interface EvmVerifyResult {
|
|
|
993
1121
|
declare function toFixedHex(value: string, bytes: number, label: string): `0x${string}`;
|
|
994
1122
|
/** Convert a 32-byte hex bitmap to a `uint256` bigint (big-endian). */
|
|
995
1123
|
declare function signersBitmapToUint256(value: string): bigint;
|
|
996
|
-
/** Decimal string form of the signers bitmap — useful for JSON logging
|
|
1124
|
+
/** Decimal string form of the signers bitmap — useful for JSON logging. */
|
|
997
1125
|
declare function signersBitmapToDecimal(value: string): string;
|
|
998
1126
|
/**
|
|
999
1127
|
* Build the `verify(attestation, maxAge)` arguments from a gateway result.
|
|
@@ -1003,7 +1131,7 @@ declare function signersBitmapToDecimal(value: string): string;
|
|
|
1003
1131
|
* await client.readContract({ abi: MOLPHA_VERIFIER_ABI, functionName: "verify", args: [attestation, maxAge], ... });
|
|
1004
1132
|
* ```
|
|
1005
1133
|
*/
|
|
1006
|
-
declare function buildEvmVerifierArgs(
|
|
1134
|
+
declare function buildEvmVerifierArgs(attestation: Attestation, options: BuildEvmVerifierArgsOptions): EvmVerifierArgs;
|
|
1007
1135
|
/**
|
|
1008
1136
|
* ABI calldata for `verify(attestation, maxAge)`: the 4-byte selector followed by nine
|
|
1009
1137
|
* 32-byte words. Both structs are static, so they encode inline with no offsets:
|
|
@@ -1043,7 +1171,7 @@ declare function getMolphaStarknetVerifierAddress(network: MolphaStarknetNetwork
|
|
|
1043
1171
|
* Starknet calldata shape for `AttestationPayload`.
|
|
1044
1172
|
*
|
|
1045
1173
|
* Member order is the order of the signed message preimage and of Cairo `Serde`, so it is
|
|
1046
|
-
* load bearing — it is not the order
|
|
1174
|
+
* load bearing — it is not the flat gateway field order on {@link Attestation}.
|
|
1047
1175
|
*/
|
|
1048
1176
|
interface StarknetAttestationPayload {
|
|
1049
1177
|
/** 32-byte packed value as `u256`. */
|
|
@@ -1110,7 +1238,7 @@ declare function signersBitmapToStarknetUint256(value: string): bigint;
|
|
|
1110
1238
|
* const { attestation, maxAge } = buildStarknetVerifierArgs(result, { maxAge: 300 });
|
|
1111
1239
|
* ```
|
|
1112
1240
|
*/
|
|
1113
|
-
declare function buildStarknetVerifierArgs(
|
|
1241
|
+
declare function buildStarknetVerifierArgs(attestation: Attestation, options: BuildStarknetVerifierArgsOptions): StarknetVerifierArgs;
|
|
1114
1242
|
/**
|
|
1115
1243
|
* Flat felt calldata for `verify(attestation, max_age)`, in Cairo `Serde` order — 13 felts:
|
|
1116
1244
|
*
|
|
@@ -1145,10 +1273,11 @@ declare const registryStatePda: (programId: SolanaAddress) => Address;
|
|
|
1145
1273
|
/** Immutable, version-addressed registry snapshot: `["molpha_registry", version u32 LE]`. */
|
|
1146
1274
|
declare const registryPda: (version: number, programId: SolanaAddress) => Address;
|
|
1147
1275
|
/**
|
|
1148
|
-
*
|
|
1149
|
-
* addresses directly in `nodes[i]`, so consumers rarely need to
|
|
1276
|
+
* Authority-keyed `Node` account: `["molpha_node", authority]` (`Node.authority`). Registry
|
|
1277
|
+
* snapshots store these addresses directly in `nodes[i]`, so consumers rarely need to
|
|
1278
|
+
* derive them.
|
|
1150
1279
|
*/
|
|
1151
|
-
declare const nodePda: (
|
|
1280
|
+
declare const nodePda: (authority: SolanaAddress, programId: SolanaAddress) => Address;
|
|
1152
1281
|
/** Bonded gateway account: `["molpha_gateway", gatewayAuthority]` — the `gateway` bound into `RequestAuth`. */
|
|
1153
1282
|
declare const gatewayPda: (authority: SolanaAddress, programId: SolanaAddress) => Address;
|
|
1154
1283
|
/** Plan PDA is `[b"molpha_plan", [planType as u8]]`. */
|
|
@@ -1207,10 +1336,10 @@ declare class MolphaSDK {
|
|
|
1207
1336
|
* on-chain registry version) and submit it via `submit_attestation`.
|
|
1208
1337
|
*/
|
|
1209
1338
|
requestAndSubmit(opts: RequestSignedDataOptions): Promise<{
|
|
1210
|
-
result:
|
|
1339
|
+
result: Attestation;
|
|
1211
1340
|
signature: string;
|
|
1212
1341
|
feed: Address;
|
|
1213
1342
|
}>;
|
|
1214
1343
|
}
|
|
1215
1344
|
|
|
1216
|
-
export { APIConfig, AssetDomain, type AttestationMessageFields, type BuildEvmVerifierArgsOptions, type BuildStarknetVerifierArgsOptions,
|
|
1345
|
+
export { APIConfig, AggregationConfig, AggregationConfigError, AssetDomain, Attestation, type AttestationMessageFields, type BuildEvmVerifierArgsOptions, type BuildStarknetVerifierArgsOptions, type CoalitionKey, DEFAULT_GATEWAY_ENDPOINT, EIP712_DOMAIN_TYPEHASH, type Eip712Domain, type EvmAttestation, type EvmAttestationPayload, type EvmSchnorrSignature, EvmSigner, type EvmVerifierArgs, type EvmVerifyResult, type FeedAccount, type GatewayEndpoint, type GatewayEndpointInput, GatewayError, type GatewayInfo, 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, type MolphaEvmNetwork, MolphaGateway, type MolphaGatewayOptions, MolphaSDK, type MolphaSDKOptions, MolphaSolanaClient, type MolphaStarknetNetwork, MolphaWallet, Node, NodeKeyVerifier, NodeKeyVerifierArgs, NodesInfo, type PlanId, type PlanInfo, PlanType, REQUEST_AUTH_DOMAIN, RegistrySelectionConfig, type RegistryStateView, type RegistryView, type RequestAuthFields, type RequestSignedDataOptions, type RoundContext, type Secp256k1KeyInput, Signer, SourcePaymentOptions, type StarknetAttestation, type StarknetAttestationPayload, type StarknetFeltLike, type StarknetSchnorrSignature, type StarknetVerifierArgs, type StarknetVerifyResult, type SubmitAttestationArgs, type SubmitAttestationOptions, type SubmitResult, type SubscribeResult, type SubscriptionInfo, TRANSFER_WITH_AUTHORIZATION_TYPEHASH, type TransferAuthorization, UpstreamPaymentRequiredError, UpstreamQuote, UpstreamTerms, VERIFY_CODES, type VerifyCode, type VerifyCodeName, 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, getMolphaStarknetVerifierAddress, hashRequestAuth, hexToBytes, nodePda, normalizeEndpoint, normalizeSecp256k1PublicKeyHex, parseEvmVerifyResult, parseGatewayInfo, parseStarknetVerifyResult, parseUpstreamQuote, planIdFromVariant, planPda, planVariant, probeSource, protocolConfigPda, registryPda, registryStatePda, resolveRemainingAccounts, secp256k1PublicKeyFromCoordinates, selectedIndices, signSourcePayments, signersBitmapToDecimal, signersBitmapToStarknetUint256, signersBitmapToUint256, subscriptionPda, toChecksumAddress, toFixedBytes, toFixedHex, transferWithAuthorizationDigest, transferWithAuthorizationHash, u256beFromBigInt, u32be, u32le, u64be, u64le, u8, utf8, validateSuppliedTerms, verifyCodeName };
|