@molpha/sdk 0.2.0-dev-20260913100330 → 0.2.0-dev-20261001084453
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 +93 -52
- package/dist/index.d.ts +321 -72
- package/dist/index.js +2111 -4933
- package/dist/index.js.map +1 -1
- package/idl/molpha.json +1780 -4801
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -365,10 +365,6 @@ interface PlanInfo {
|
|
|
365
365
|
interface SubscriptionInfo {
|
|
366
366
|
owner: Address;
|
|
367
367
|
planType: PlanType;
|
|
368
|
-
/** USDC base units prepaid on the subscription vault. */
|
|
369
|
-
prepaidUsdc: bigint;
|
|
370
|
-
/** Locked subscription price in USDC base units for the current period. */
|
|
371
|
-
price: bigint;
|
|
372
368
|
/** Unix timestamp (seconds) until which the subscription is valid. */
|
|
373
369
|
validUntil: bigint;
|
|
374
370
|
usedRounds: bigint;
|
|
@@ -384,13 +380,14 @@ interface SubmitResult {
|
|
|
384
380
|
}
|
|
385
381
|
interface FeedAccount {
|
|
386
382
|
sourceId: number[];
|
|
387
|
-
/**
|
|
383
|
+
/** Signed 32-byte value, or the keccak digest of the submitted raw-value preimage. */
|
|
388
384
|
value: Uint8Array | number[];
|
|
389
385
|
valueKind: {
|
|
390
386
|
value: Record<string, never>;
|
|
391
387
|
} | {
|
|
392
388
|
hash: Record<string, never>;
|
|
393
389
|
};
|
|
390
|
+
submitter: Address;
|
|
394
391
|
/** u64 unix seconds. */
|
|
395
392
|
canonicalTimestamp: BN;
|
|
396
393
|
signaturesRequired: number;
|
|
@@ -400,14 +397,30 @@ interface FeedAccount {
|
|
|
400
397
|
}
|
|
401
398
|
/** Anchor-encoded `SubmitAttestationArgs` (camelCase field names). */
|
|
402
399
|
interface SubmitAttestationArgs {
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
400
|
+
attestation: {
|
|
401
|
+
payload: {
|
|
402
|
+
value: number[];
|
|
403
|
+
sourceId: number[];
|
|
404
|
+
registryVersion: number;
|
|
405
|
+
signaturesRequired: number;
|
|
406
|
+
canonicalTimestamp: BN;
|
|
407
|
+
};
|
|
408
|
+
signature: {
|
|
409
|
+
aggSigS: number[];
|
|
410
|
+
commitment: number[];
|
|
411
|
+
signersBitmap: number[];
|
|
412
|
+
};
|
|
413
|
+
};
|
|
414
|
+
/** Optional preimage when `payload.value` is `keccak256(rawValue)`. */
|
|
415
|
+
rawValue: Uint8Array | null;
|
|
416
|
+
}
|
|
417
|
+
interface SubmitAttestationOptions {
|
|
418
|
+
computeUnitLimit?: number;
|
|
419
|
+
/**
|
|
420
|
+
* Optional value preimage (maximum 256 bytes). Its keccak256 digest must equal
|
|
421
|
+
* `result.valuePacked`; the program stores that digest with `valueKind.hash`.
|
|
422
|
+
*/
|
|
423
|
+
rawValue?: Uint8Array;
|
|
411
424
|
}
|
|
412
425
|
interface CreateClientOpts {
|
|
413
426
|
connection: SolanaConnection;
|
|
@@ -478,13 +491,9 @@ declare class MolphaSolanaClient {
|
|
|
478
491
|
* `Node` accounts are resolved from the registry snapshot the round was signed
|
|
479
492
|
* against and passed as remaining accounts.
|
|
480
493
|
*/
|
|
481
|
-
submitAttestation(result: DataUpdateResult, opts?:
|
|
482
|
-
computeUnitLimit?: number;
|
|
483
|
-
}): Promise<SubmitResult>;
|
|
494
|
+
submitAttestation(result: DataUpdateResult, opts?: SubmitAttestationOptions): Promise<SubmitResult>;
|
|
484
495
|
/** @deprecated Renamed to {@link submitAttestation}. */
|
|
485
|
-
submitDataUpdate(result: DataUpdateResult, opts?:
|
|
486
|
-
computeUnitLimit?: number;
|
|
487
|
-
}): Promise<SubmitResult>;
|
|
496
|
+
submitDataUpdate(result: DataUpdateResult, opts?: SubmitAttestationOptions): Promise<SubmitResult>;
|
|
488
497
|
/**
|
|
489
498
|
* Read the feed written by `submitter` (default: this wallet) for
|
|
490
499
|
* `(sourceId, signaturesRequired)`, or `null` before its first submit.
|
|
@@ -502,8 +511,8 @@ declare class MolphaSolanaClient {
|
|
|
502
511
|
/** `usdc_mint` from `ProtocolConfig`; the treasury is its ATA owned by the config PDA. */
|
|
503
512
|
private fetchProtocolTokens;
|
|
504
513
|
}
|
|
505
|
-
/** Build the Anchor `SubmitAttestationArgs` for a gateway result. */
|
|
506
|
-
declare function buildSubmitAttestationArgs(result: DataUpdateResult): SubmitAttestationArgs;
|
|
514
|
+
/** Build the current program's nested Anchor `SubmitAttestationArgs` for a gateway result. */
|
|
515
|
+
declare function buildSubmitAttestationArgs(result: DataUpdateResult, rawValue?: Uint8Array): SubmitAttestationArgs;
|
|
507
516
|
|
|
508
517
|
/** Gateway wire shape — defaults applied before hash / encryption. */
|
|
509
518
|
declare function canonicalizeAPIConfig(apiConfig: APIConfig): APIConfig;
|
|
@@ -534,6 +543,8 @@ declare const bytesToHex: (bytes: Uint8Array) => string;
|
|
|
534
543
|
declare function hexToBytes(hex: string): Uint8Array;
|
|
535
544
|
/** Hex with a leading `0x`. */
|
|
536
545
|
declare const bytesToHex0x: (bytes: Uint8Array) => string;
|
|
546
|
+
/** u8 → 1 byte. Range-checked: `Uint8Array.of` would silently wrap an out-of-range value. */
|
|
547
|
+
declare function u8(value: number): Uint8Array;
|
|
537
548
|
/** Big-endian u32 → 4 bytes. */
|
|
538
549
|
declare function u32be(value: number): Uint8Array;
|
|
539
550
|
/** Little-endian u32 → 4 bytes (used for PDA seeds like the registry index). */
|
|
@@ -564,7 +575,7 @@ interface AttestationMessageFields {
|
|
|
564
575
|
/** 32-byte source id (hex or bytes). */
|
|
565
576
|
sourceId: string | Uint8Array;
|
|
566
577
|
registryVersion: number;
|
|
567
|
-
/** Encoded as
|
|
578
|
+
/** Encoded as a single byte (`uint8`); throws `RangeError` outside `0..255`. */
|
|
568
579
|
signaturesRequired: number;
|
|
569
580
|
/** 32-byte big-endian signers bitmap (hex or bytes). */
|
|
570
581
|
signersBitmap: string | Uint8Array;
|
|
@@ -648,51 +659,77 @@ type VerifyCode = (typeof VERIFY_CODES)[VerifyCodeName];
|
|
|
648
659
|
declare function verifyCodeName(code: number): VerifyCodeName | undefined;
|
|
649
660
|
|
|
650
661
|
/**
|
|
651
|
-
*
|
|
652
|
-
*
|
|
653
|
-
*
|
|
654
|
-
*
|
|
662
|
+
* Molpha EVM verifier ABI: `verify(Attestation, uint64 maxAge) -> (bool, uint8)` plus every
|
|
663
|
+
* read-only registry view on `IVerifier`. Owner-only mutators (`addNode`, `removeNode`,
|
|
664
|
+
* `setRedundancyBuffer`) and `Ownable` plumbing are deliberately left out.
|
|
665
|
+
*
|
|
666
|
+
* 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 of `DataUpdateResult`.
|
|
655
668
|
*/
|
|
656
669
|
declare const MOLPHA_VERIFIER_ABI: readonly [{
|
|
657
670
|
readonly type: "function";
|
|
658
671
|
readonly name: "verify";
|
|
659
672
|
readonly stateMutability: "view";
|
|
660
673
|
readonly inputs: readonly [{
|
|
661
|
-
readonly name: "
|
|
674
|
+
readonly name: "attestation";
|
|
662
675
|
readonly type: "tuple";
|
|
676
|
+
readonly internalType: "struct IVerifier.Attestation";
|
|
663
677
|
readonly components: readonly [{
|
|
664
|
-
readonly name: "
|
|
665
|
-
readonly type: "
|
|
678
|
+
readonly name: "payload";
|
|
679
|
+
readonly type: "tuple";
|
|
680
|
+
readonly internalType: "struct IVerifier.AttestationPayload";
|
|
681
|
+
readonly components: readonly [{
|
|
682
|
+
readonly name: "value";
|
|
683
|
+
readonly type: "bytes32";
|
|
684
|
+
readonly internalType: "bytes32";
|
|
685
|
+
}, {
|
|
686
|
+
readonly name: "sourceId";
|
|
687
|
+
readonly type: "bytes32";
|
|
688
|
+
readonly internalType: "bytes32";
|
|
689
|
+
}, {
|
|
690
|
+
readonly name: "registryVersion";
|
|
691
|
+
readonly type: "uint32";
|
|
692
|
+
readonly internalType: "uint32";
|
|
693
|
+
}, {
|
|
694
|
+
readonly name: "signaturesRequired";
|
|
695
|
+
readonly type: "uint8";
|
|
696
|
+
readonly internalType: "uint8";
|
|
697
|
+
}, {
|
|
698
|
+
readonly name: "canonicalTimestamp";
|
|
699
|
+
readonly type: "uint64";
|
|
700
|
+
readonly internalType: "uint64";
|
|
701
|
+
}];
|
|
666
702
|
}, {
|
|
667
|
-
readonly name: "registryVersion";
|
|
668
|
-
readonly type: "uint32";
|
|
669
|
-
}, {
|
|
670
|
-
readonly name: "signaturesRequired";
|
|
671
|
-
readonly type: "uint32";
|
|
672
|
-
}, {
|
|
673
|
-
readonly name: "value";
|
|
674
|
-
readonly type: "bytes32";
|
|
675
|
-
}, {
|
|
676
|
-
readonly name: "canonicalTimestamp";
|
|
677
|
-
readonly type: "uint64";
|
|
678
|
-
}];
|
|
679
|
-
}, {
|
|
680
|
-
readonly name: "schnorrData";
|
|
681
|
-
readonly type: "tuple";
|
|
682
|
-
readonly components: readonly [{
|
|
683
703
|
readonly name: "signature";
|
|
684
|
-
readonly type: "
|
|
685
|
-
|
|
686
|
-
readonly
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
704
|
+
readonly type: "tuple";
|
|
705
|
+
readonly internalType: "struct IVerifier.SchnorrSignature";
|
|
706
|
+
readonly components: readonly [{
|
|
707
|
+
readonly name: "signature";
|
|
708
|
+
readonly type: "bytes32";
|
|
709
|
+
readonly internalType: "bytes32";
|
|
710
|
+
}, {
|
|
711
|
+
readonly name: "commitment";
|
|
712
|
+
readonly type: "address";
|
|
713
|
+
readonly internalType: "address";
|
|
714
|
+
}, {
|
|
715
|
+
readonly name: "signersBitmap";
|
|
716
|
+
readonly type: "uint256";
|
|
717
|
+
readonly internalType: "uint256";
|
|
718
|
+
}];
|
|
691
719
|
}];
|
|
720
|
+
}, {
|
|
721
|
+
readonly name: "maxAge";
|
|
722
|
+
readonly type: "uint64";
|
|
723
|
+
readonly internalType: "uint64";
|
|
692
724
|
}];
|
|
693
725
|
readonly outputs: readonly [{
|
|
694
|
-
readonly name: "";
|
|
726
|
+
readonly name: "success";
|
|
695
727
|
readonly type: "bool";
|
|
728
|
+
readonly internalType: "bool";
|
|
729
|
+
}, {
|
|
730
|
+
readonly name: "code";
|
|
731
|
+
readonly type: "uint8";
|
|
732
|
+
readonly internalType: "uint8";
|
|
696
733
|
}];
|
|
697
734
|
}, {
|
|
698
735
|
readonly type: "function";
|
|
@@ -702,7 +739,150 @@ declare const MOLPHA_VERIFIER_ABI: readonly [{
|
|
|
702
739
|
readonly outputs: readonly [{
|
|
703
740
|
readonly name: "registryVersion";
|
|
704
741
|
readonly type: "uint256";
|
|
742
|
+
readonly internalType: "uint256";
|
|
743
|
+
}];
|
|
744
|
+
}, {
|
|
745
|
+
readonly type: "function";
|
|
746
|
+
readonly name: "getTotalNodes";
|
|
747
|
+
readonly stateMutability: "view";
|
|
748
|
+
readonly inputs: readonly [];
|
|
749
|
+
readonly outputs: readonly [{
|
|
750
|
+
readonly name: "totalNodes";
|
|
751
|
+
readonly type: "uint256";
|
|
752
|
+
readonly internalType: "uint256";
|
|
753
|
+
}];
|
|
754
|
+
}, {
|
|
755
|
+
readonly type: "function";
|
|
756
|
+
readonly name: "redundancyBuffer";
|
|
757
|
+
readonly stateMutability: "view";
|
|
758
|
+
readonly inputs: readonly [];
|
|
759
|
+
readonly outputs: readonly [{
|
|
760
|
+
readonly name: "";
|
|
761
|
+
readonly type: "uint256";
|
|
762
|
+
readonly internalType: "uint256";
|
|
763
|
+
}];
|
|
764
|
+
}, {
|
|
765
|
+
readonly type: "function";
|
|
766
|
+
readonly name: "getRegistryRoot";
|
|
767
|
+
readonly stateMutability: "view";
|
|
768
|
+
readonly inputs: readonly [];
|
|
769
|
+
readonly outputs: readonly [{
|
|
770
|
+
readonly name: "root";
|
|
771
|
+
readonly type: "bytes32";
|
|
772
|
+
readonly internalType: "bytes32";
|
|
773
|
+
}];
|
|
774
|
+
}, {
|
|
775
|
+
readonly type: "function";
|
|
776
|
+
readonly name: "getRegistryRoot";
|
|
777
|
+
readonly stateMutability: "view";
|
|
778
|
+
readonly inputs: readonly [{
|
|
779
|
+
readonly name: "registryVersion";
|
|
780
|
+
readonly type: "uint256";
|
|
781
|
+
readonly internalType: "uint256";
|
|
782
|
+
}];
|
|
783
|
+
readonly outputs: readonly [{
|
|
784
|
+
readonly name: "root";
|
|
785
|
+
readonly type: "bytes32";
|
|
786
|
+
readonly internalType: "bytes32";
|
|
787
|
+
}];
|
|
788
|
+
}, {
|
|
789
|
+
readonly type: "function";
|
|
790
|
+
readonly name: "getRegistryPointer";
|
|
791
|
+
readonly stateMutability: "view";
|
|
792
|
+
readonly inputs: readonly [];
|
|
793
|
+
readonly outputs: readonly [{
|
|
794
|
+
readonly name: "registryPointer";
|
|
795
|
+
readonly type: "address";
|
|
796
|
+
readonly internalType: "address";
|
|
797
|
+
}];
|
|
798
|
+
}, {
|
|
799
|
+
readonly type: "function";
|
|
800
|
+
readonly name: "getRegistryPointer";
|
|
801
|
+
readonly stateMutability: "view";
|
|
802
|
+
readonly inputs: readonly [{
|
|
803
|
+
readonly name: "registryVersion";
|
|
804
|
+
readonly type: "uint256";
|
|
805
|
+
readonly internalType: "uint256";
|
|
806
|
+
}];
|
|
807
|
+
readonly outputs: readonly [{
|
|
808
|
+
readonly name: "registryPointer";
|
|
809
|
+
readonly type: "address";
|
|
810
|
+
readonly internalType: "address";
|
|
811
|
+
}];
|
|
812
|
+
}, {
|
|
813
|
+
readonly type: "function";
|
|
814
|
+
readonly name: "activatesAt";
|
|
815
|
+
readonly stateMutability: "view";
|
|
816
|
+
readonly inputs: readonly [{
|
|
817
|
+
readonly name: "registryVersion";
|
|
818
|
+
readonly type: "uint256";
|
|
819
|
+
readonly internalType: "uint256";
|
|
820
|
+
}];
|
|
821
|
+
readonly outputs: readonly [{
|
|
822
|
+
readonly name: "ts";
|
|
823
|
+
readonly type: "uint256";
|
|
824
|
+
readonly internalType: "uint256";
|
|
825
|
+
}];
|
|
826
|
+
}, {
|
|
827
|
+
readonly type: "function";
|
|
828
|
+
readonly name: "retiredAt";
|
|
829
|
+
readonly stateMutability: "view";
|
|
830
|
+
readonly inputs: readonly [{
|
|
831
|
+
readonly name: "registryVersion";
|
|
832
|
+
readonly type: "uint256";
|
|
833
|
+
readonly internalType: "uint256";
|
|
834
|
+
}];
|
|
835
|
+
readonly outputs: readonly [{
|
|
836
|
+
readonly name: "ts";
|
|
837
|
+
readonly type: "uint256";
|
|
838
|
+
readonly internalType: "uint256";
|
|
839
|
+
}];
|
|
840
|
+
}, {
|
|
841
|
+
readonly type: "function";
|
|
842
|
+
readonly name: "isLatestVersion";
|
|
843
|
+
readonly stateMutability: "view";
|
|
844
|
+
readonly inputs: readonly [{
|
|
845
|
+
readonly name: "registryVersion";
|
|
846
|
+
readonly type: "uint256";
|
|
847
|
+
readonly internalType: "uint256";
|
|
848
|
+
}];
|
|
849
|
+
readonly outputs: readonly [{
|
|
850
|
+
readonly name: "latest";
|
|
851
|
+
readonly type: "bool";
|
|
852
|
+
readonly internalType: "bool";
|
|
705
853
|
}];
|
|
854
|
+
}, {
|
|
855
|
+
readonly type: "function";
|
|
856
|
+
readonly name: "nodeStatus";
|
|
857
|
+
readonly stateMutability: "view";
|
|
858
|
+
readonly inputs: readonly [{
|
|
859
|
+
readonly name: "node";
|
|
860
|
+
readonly type: "address";
|
|
861
|
+
readonly internalType: "address";
|
|
862
|
+
}];
|
|
863
|
+
readonly outputs: readonly [{
|
|
864
|
+
readonly name: "";
|
|
865
|
+
readonly type: "uint8";
|
|
866
|
+
readonly internalType: "uint8";
|
|
867
|
+
}];
|
|
868
|
+
}, {
|
|
869
|
+
readonly type: "function";
|
|
870
|
+
readonly name: "isNode";
|
|
871
|
+
readonly stateMutability: "view";
|
|
872
|
+
readonly inputs: readonly [{
|
|
873
|
+
readonly name: "node";
|
|
874
|
+
readonly type: "address";
|
|
875
|
+
readonly internalType: "address";
|
|
876
|
+
}];
|
|
877
|
+
readonly outputs: readonly [{
|
|
878
|
+
readonly name: "";
|
|
879
|
+
readonly type: "bool";
|
|
880
|
+
readonly internalType: "bool";
|
|
881
|
+
}];
|
|
882
|
+
}, {
|
|
883
|
+
readonly type: "error";
|
|
884
|
+
readonly name: "InvalidRegistryVersion";
|
|
885
|
+
readonly inputs: readonly [];
|
|
706
886
|
}];
|
|
707
887
|
|
|
708
888
|
/**
|
|
@@ -748,23 +928,63 @@ declare function evmAddressFromPrivateKey(privateKey: string | Uint8Array): stri
|
|
|
748
928
|
*/
|
|
749
929
|
declare function createEvmSignerFromPrivateKey(privateKey: string | Uint8Array): EvmSigner;
|
|
750
930
|
|
|
751
|
-
/**
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
931
|
+
/**
|
|
932
|
+
* `IVerifier.AttestationPayload` — the signed half of an attestation.
|
|
933
|
+
*
|
|
934
|
+
* 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 of `DataUpdateResult`.
|
|
936
|
+
*/
|
|
937
|
+
interface EvmAttestationPayload {
|
|
938
|
+
/** `bytes32` packed value. */
|
|
939
|
+
value: `0x${string}`;
|
|
940
|
+
/** `bytes32` source id. */
|
|
941
|
+
sourceId: `0x${string}`;
|
|
942
|
+
/** `uint32`. */
|
|
943
|
+
registryVersion: number;
|
|
944
|
+
/** `uint8`. */
|
|
945
|
+
signaturesRequired: number;
|
|
946
|
+
/** `uint64`, unix seconds. */
|
|
947
|
+
canonicalTimestamp: bigint;
|
|
948
|
+
}
|
|
949
|
+
/** `IVerifier.SchnorrSignature`. */
|
|
950
|
+
interface EvmSchnorrSignature {
|
|
951
|
+
/** `bytes32` Schnorr scalar `s`. */
|
|
952
|
+
signature: `0x${string}`;
|
|
953
|
+
/** `address` of the nonce point `R`. */
|
|
954
|
+
commitment: `0x${string}`;
|
|
955
|
+
/** `uint256` signers bitmap; bit `i` is node `i` of the registry version. */
|
|
956
|
+
signersBitmap: bigint;
|
|
957
|
+
}
|
|
958
|
+
/** `IVerifier.Attestation`. */
|
|
959
|
+
interface EvmAttestation {
|
|
960
|
+
payload: EvmAttestationPayload;
|
|
961
|
+
signature: EvmSchnorrSignature;
|
|
962
|
+
}
|
|
963
|
+
/** Positional arguments for `verify(attestation, maxAge)`. */
|
|
765
964
|
interface EvmVerifierArgs {
|
|
766
|
-
|
|
767
|
-
|
|
965
|
+
attestation: EvmAttestation;
|
|
966
|
+
/** Freshness window in seconds (`uint64`). `0n` disables the check. */
|
|
967
|
+
maxAge: bigint;
|
|
968
|
+
}
|
|
969
|
+
interface BuildEvmVerifierArgsOptions {
|
|
970
|
+
/**
|
|
971
|
+
* Freshness window in seconds. The verifier rejects the attestation with `STALE` when it
|
|
972
|
+
* is older than this, and as `MALFORMED` when it is dated in the future.
|
|
973
|
+
*
|
|
974
|
+
* Required on purpose. `0` disables the check entirely, and that is not a neutral
|
|
975
|
+
* default: the verifier is stateless, so without a window it accepts a correctly signed
|
|
976
|
+
* attestation forever. Pass `0` only when the consuming contract enforces freshness or
|
|
977
|
+
* ordering itself.
|
|
978
|
+
*/
|
|
979
|
+
maxAge: number | bigint;
|
|
980
|
+
}
|
|
981
|
+
/** Decoded `verify` return value. */
|
|
982
|
+
interface EvmVerifyResult {
|
|
983
|
+
success: boolean;
|
|
984
|
+
/** Raw result code — see `VERIFY_CODES`. */
|
|
985
|
+
code: number;
|
|
986
|
+
/** Name of `code`, or `"UNKNOWN"` for a code newer than this SDK. */
|
|
987
|
+
reason: VerifyCodeName | "UNKNOWN";
|
|
768
988
|
}
|
|
769
989
|
/**
|
|
770
990
|
* Normalize hex to a fixed-size `0x`-prefixed value.
|
|
@@ -773,10 +993,39 @@ interface EvmVerifierArgs {
|
|
|
773
993
|
declare function toFixedHex(value: string, bytes: number, label: string): `0x${string}`;
|
|
774
994
|
/** Convert a 32-byte hex bitmap to a `uint256` bigint (big-endian). */
|
|
775
995
|
declare function signersBitmapToUint256(value: string): bigint;
|
|
776
|
-
/** Build verifier `DataUpdate` and `SchnorrSignature` tuples from a gateway result. */
|
|
777
|
-
declare function buildEvmVerifierArgs(result: DataUpdateResult): EvmVerifierArgs;
|
|
778
996
|
/** Decimal string form of the signers bitmap — useful for JSON logging or legacy tooling. */
|
|
779
997
|
declare function signersBitmapToDecimal(value: string): string;
|
|
998
|
+
/**
|
|
999
|
+
* Build the `verify(attestation, maxAge)` arguments from a gateway result.
|
|
1000
|
+
*
|
|
1001
|
+
* ```ts
|
|
1002
|
+
* const { attestation, maxAge } = buildEvmVerifierArgs(result, { maxAge: 300 });
|
|
1003
|
+
* await client.readContract({ abi: MOLPHA_VERIFIER_ABI, functionName: "verify", args: [attestation, maxAge], ... });
|
|
1004
|
+
* ```
|
|
1005
|
+
*/
|
|
1006
|
+
declare function buildEvmVerifierArgs(result: DataUpdateResult, options: BuildEvmVerifierArgsOptions): EvmVerifierArgs;
|
|
1007
|
+
/**
|
|
1008
|
+
* ABI calldata for `verify(attestation, maxAge)`: the 4-byte selector followed by nine
|
|
1009
|
+
* 32-byte words. Both structs are static, so they encode inline with no offsets:
|
|
1010
|
+
*
|
|
1011
|
+
* `value, sourceId, registryVersion, signaturesRequired, canonicalTimestamp, signature,
|
|
1012
|
+
* commitment, signersBitmap, maxAge`
|
|
1013
|
+
*
|
|
1014
|
+
* For a raw `eth_call` (`{ to: verifier, data }`).
|
|
1015
|
+
*/
|
|
1016
|
+
declare function encodeEvmVerifyCalldata(args: EvmVerifierArgs): `0x${string}`;
|
|
1017
|
+
/**
|
|
1018
|
+
* Decode the `(bool, uint8)` returned by `verify`.
|
|
1019
|
+
*
|
|
1020
|
+
* Accepts the raw 64-byte return data from `eth_call`, or the tuple an ABI-aware client
|
|
1021
|
+
* decodes (viem `readContract` returns `[true, 0]`; an ethers `Result` indexes the same way).
|
|
1022
|
+
* Throws when the two halves disagree (`success` with a non-zero code, or failure with
|
|
1023
|
+
* `OK`), which means the call did not reach a Molpha verifier of this interface.
|
|
1024
|
+
*/
|
|
1025
|
+
declare function parseEvmVerifyResult(result: string | {
|
|
1026
|
+
readonly 0: boolean | number | bigint;
|
|
1027
|
+
readonly 1: number | bigint;
|
|
1028
|
+
}): EvmVerifyResult;
|
|
780
1029
|
|
|
781
1030
|
/**
|
|
782
1031
|
* Deployed Molpha verifier contract addresses on Starknet testnets.
|
|
@@ -964,4 +1213,4 @@ declare class MolphaSDK {
|
|
|
964
1213
|
}>;
|
|
965
1214
|
}
|
|
966
1215
|
|
|
967
|
-
export { APIConfig, AssetDomain, type AttestationMessageFields, type BuildStarknetVerifierArgsOptions, DEFAULT_GATEWAY_ENDPOINT, DataUpdateResult, EIP712_DOMAIN_TYPEHASH, type Eip712Domain, type
|
|
1216
|
+
export { APIConfig, AssetDomain, type AttestationMessageFields, type BuildEvmVerifierArgsOptions, type BuildStarknetVerifierArgsOptions, DEFAULT_GATEWAY_ENDPOINT, DataUpdateResult, 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, MESSAGE_PREFIX, 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, 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, attestationMessageHash, attestationMessageHashFromResult, base64ToBytes, bigIntFromBytesBe, bitmapBitSet, bitmapToIndices, buildEvmVerifierArgs, buildStarknetVerifierArgs, buildSubmitAttestationArgs, bytesToBase64, bytesToHex, bytesToHex0x, canonicalizeAPIConfig, commitmentAddressToStarknetFelt, concatBytes, createEvmSignerFromPrivateKey, deriveApiConfigHash, deriveGatewayPda, deriveGatewayPdaAddress, deriveGroupBitmap, deriveSelectionBitmap, deriveSelectionSeed, deriveSourceId, deriveSourceIdString, domainSeparator, effectiveSelectionSize, eligibleSetSize, encodeEvmVerifyCalldata, encodeRequestAuth, encodeStarknetVerifyCalldata, ensureLength, evmAddressFromPrivateKey, feedPda, 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 };
|