@omegax/protocol-sdk 0.4.2 → 0.4.4

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/types.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { PublicKey, Connection, Transaction } from '@solana/web3.js';
2
2
  export type ClaimLifecycleStatus = 'prepared' | 'submitted' | 'confirmed' | 'failed' | 'expired';
3
- export type ClaimFailureCode = 'invalid_claimant_wallet' | 'wallet_mismatch' | 'pool_not_found' | 'pool_not_active' | 'membership_not_active' | 'claim_window_not_set' | 'claim_window_not_open' | 'claim_window_closed' | 'no_passing_outcomes' | 'intent_expired' | 'intent_message_mismatch' | 'required_signer_mismatch' | 'simulation_failed_insufficient_funds' | 'simulation_failed_pool_paused' | 'simulation_failed_membership_invalid' | 'simulation_failed_unknown' | 'rpc_rejected' | 'rpc_timeout' | 'already_claimed' | 'unknown';
3
+ export type ClaimFailureCode = 'invalid_claimant_wallet' | 'wallet_mismatch' | 'pool_not_found' | 'pool_not_active' | 'membership_not_active' | 'claim_window_not_set' | 'claim_window_not_open' | 'claim_window_closed' | 'no_passing_outcomes' | 'seeker_rule_misconfigured' | 'seeker_commitment_disabled' | 'intent_expired' | 'intent_message_mismatch' | 'required_signer_mismatch' | 'simulation_failed_insufficient_funds' | 'simulation_failed_pool_paused' | 'simulation_failed_membership_invalid' | 'simulation_failed_unknown' | 'rpc_rejected' | 'rpc_timeout' | 'already_claimed' | 'unknown';
4
4
  export interface ClaimFailureDetail {
5
5
  code: ClaimFailureCode;
6
6
  message: string;
@@ -25,6 +25,8 @@ export interface RewardSummary {
25
25
  claimableRaw: string;
26
26
  claimableUi: string;
27
27
  status: 'eligible' | 'not_eligible' | 'pending' | 'claimed' | 'failed';
28
+ errorCode?: string | null;
29
+ errorMessage?: string | null;
28
30
  };
29
31
  }
30
32
  export interface ClaimIntent {
@@ -348,6 +350,166 @@ export interface BuildSubmitClaimTxParams {
348
350
  recentBlockhash: string;
349
351
  programId: string;
350
352
  }
353
+ export interface ProtocolCycleQuoteFields {
354
+ poolAddress: string;
355
+ member: string;
356
+ productIdHashHex: string;
357
+ paymentMint: string;
358
+ premiumAmountRaw: bigint;
359
+ canonicalPremiumAmount: bigint;
360
+ periodIndex: bigint;
361
+ commitmentEnabled: boolean;
362
+ bondAmountRaw: bigint;
363
+ shieldFeeRaw: bigint;
364
+ protocolFeeRaw: bigint;
365
+ oracleFeeRaw: bigint;
366
+ netPoolPremiumRaw: bigint;
367
+ totalAmountRaw: bigint;
368
+ includedShieldCount: number;
369
+ thresholdBps: number;
370
+ expiresAtTs: bigint;
371
+ nonceHashHex: string;
372
+ quoteMetaHashHex: string;
373
+ }
374
+ export interface BuildActivateCycleWithQuoteSolTxParams {
375
+ payer: string;
376
+ member: string;
377
+ poolAddress: string;
378
+ oracle: string;
379
+ productIdHashHex: string;
380
+ premiumAmountRaw: bigint;
381
+ canonicalPremiumAmount: bigint;
382
+ periodIndex: bigint;
383
+ commitmentEnabled: boolean;
384
+ bondAmountRaw: bigint;
385
+ shieldFeeRaw: bigint;
386
+ protocolFeeRaw: bigint;
387
+ oracleFeeRaw: bigint;
388
+ netPoolPremiumRaw: bigint;
389
+ totalAmountRaw: bigint;
390
+ includedShieldCount: number;
391
+ thresholdBps: number;
392
+ expiresAtTs: bigint;
393
+ nonceHashHex: string;
394
+ quoteMetaHashHex: string;
395
+ quoteMessage: Uint8Array;
396
+ oracleSecretKey: Uint8Array;
397
+ computeUnitLimit?: number;
398
+ recentBlockhash: string;
399
+ programId: string;
400
+ }
401
+ export interface BuildActivateCycleWithQuoteSplTxParams {
402
+ payer: string;
403
+ member: string;
404
+ poolAddress: string;
405
+ oracle: string;
406
+ productIdHashHex: string;
407
+ paymentMint: string;
408
+ premiumAmountRaw: bigint;
409
+ canonicalPremiumAmount: bigint;
410
+ periodIndex: bigint;
411
+ commitmentEnabled: boolean;
412
+ bondAmountRaw: bigint;
413
+ shieldFeeRaw: bigint;
414
+ protocolFeeRaw: bigint;
415
+ oracleFeeRaw: bigint;
416
+ netPoolPremiumRaw: bigint;
417
+ totalAmountRaw: bigint;
418
+ includedShieldCount: number;
419
+ thresholdBps: number;
420
+ expiresAtTs: bigint;
421
+ nonceHashHex: string;
422
+ quoteMetaHashHex: string;
423
+ quoteMessage: Uint8Array;
424
+ oracleSecretKey: Uint8Array;
425
+ computeUnitLimit?: number;
426
+ recentBlockhash: string;
427
+ programId: string;
428
+ }
429
+ export interface BuildSettleCycleCommitmentTxParams {
430
+ payer: string;
431
+ oracle: string;
432
+ member: string;
433
+ poolAddress: string;
434
+ productIdHashHex: string;
435
+ paymentMint: string;
436
+ periodIndex: bigint;
437
+ passed: boolean;
438
+ shieldConsumed: boolean;
439
+ recentBlockhash: string;
440
+ programId: string;
441
+ }
442
+ export interface BuildSettleCycleCommitmentSolTxParams {
443
+ payer: string;
444
+ oracle: string;
445
+ member: string;
446
+ poolAddress: string;
447
+ productIdHashHex: string;
448
+ periodIndex: bigint;
449
+ passed: boolean;
450
+ shieldConsumed: boolean;
451
+ recentBlockhash: string;
452
+ programId: string;
453
+ }
454
+ export interface BuildWithdrawPoolTreasurySplTxParams {
455
+ payer: string;
456
+ oracle: string;
457
+ poolAddress: string;
458
+ paymentMint: string;
459
+ amount: bigint;
460
+ recipientTokenAccount: string;
461
+ recentBlockhash: string;
462
+ programId: string;
463
+ }
464
+ export interface BuildWithdrawPoolTreasurySolTxParams {
465
+ payer: string;
466
+ oracle: string;
467
+ poolAddress: string;
468
+ amount: bigint;
469
+ recipientSystemAccount: string;
470
+ recentBlockhash: string;
471
+ programId: string;
472
+ }
473
+ export interface BuildSetPoolCoverageReserveFloorTxParams {
474
+ authority: string;
475
+ poolAddress: string;
476
+ paymentMint: string;
477
+ amount: bigint;
478
+ recentBlockhash: string;
479
+ programId: string;
480
+ }
481
+ export interface BuildWithdrawProtocolFeeSplTxParams {
482
+ governanceAuthority: string;
483
+ paymentMint: string;
484
+ amount: bigint;
485
+ recipientTokenAccount: string;
486
+ recentBlockhash: string;
487
+ programId: string;
488
+ }
489
+ export interface BuildWithdrawProtocolFeeSolTxParams {
490
+ governanceAuthority: string;
491
+ amount: bigint;
492
+ recipientSystemAccount: string;
493
+ recentBlockhash: string;
494
+ programId: string;
495
+ }
496
+ export interface BuildWithdrawPoolOracleFeeSplTxParams {
497
+ oracle: string;
498
+ poolAddress: string;
499
+ paymentMint: string;
500
+ amount: bigint;
501
+ recipientTokenAccount: string;
502
+ recentBlockhash: string;
503
+ programId: string;
504
+ }
505
+ export interface BuildWithdrawPoolOracleFeeSolTxParams {
506
+ oracle: string;
507
+ poolAddress: string;
508
+ amount: bigint;
509
+ recipientSystemAccount: string;
510
+ recentBlockhash: string;
511
+ programId: string;
512
+ }
351
513
  export interface ProtocolClient {
352
514
  connection: Connection;
353
515
  programId: PublicKey;
@@ -363,6 +525,17 @@ export interface ProtocolClient {
363
525
  buildRevokeMemberTx?: (params: BuildRevokeMemberTxParams) => Transaction;
364
526
  buildSubmitOutcomeAttestationTx?: (params: BuildSubmitOutcomeAttestationTxParams) => Transaction;
365
527
  buildSubmitClaimTx?: (params: BuildSubmitClaimTxParams) => Transaction;
528
+ buildActivateCycleWithQuoteSolTx?: (params: BuildActivateCycleWithQuoteSolTxParams) => Transaction;
529
+ buildActivateCycleWithQuoteSplTx?: (params: BuildActivateCycleWithQuoteSplTxParams) => Transaction;
530
+ buildSettleCycleCommitmentTx?: (params: BuildSettleCycleCommitmentTxParams) => Transaction;
531
+ buildSettleCycleCommitmentSolTx?: (params: BuildSettleCycleCommitmentSolTxParams) => Transaction;
532
+ buildWithdrawPoolTreasurySplTx?: (params: BuildWithdrawPoolTreasurySplTxParams) => Transaction;
533
+ buildWithdrawPoolTreasurySolTx?: (params: BuildWithdrawPoolTreasurySolTxParams) => Transaction;
534
+ buildSetPoolCoverageReserveFloorTx?: (params: BuildSetPoolCoverageReserveFloorTxParams) => Transaction;
535
+ buildWithdrawProtocolFeeSplTx?: (params: BuildWithdrawProtocolFeeSplTxParams) => Transaction;
536
+ buildWithdrawProtocolFeeSolTx?: (params: BuildWithdrawProtocolFeeSolTxParams) => Transaction;
537
+ buildWithdrawPoolOracleFeeSplTx?: (params: BuildWithdrawPoolOracleFeeSplTxParams) => Transaction;
538
+ buildWithdrawPoolOracleFeeSolTx?: (params: BuildWithdrawPoolOracleFeeSolTxParams) => Transaction;
366
539
  fetchProtocolConfig?: () => Promise<ProtocolConfigAccount | null>;
367
540
  fetchPool?: (poolAddress: string) => Promise<ProtocolPoolAccount | null>;
368
541
  fetchOracleRegistryEntry?: (oracle: string) => Promise<ProtocolOracleRegistryEntryAccount | null>;
@@ -401,6 +574,7 @@ export interface ProtocolClient {
401
574
  buildSlashOracleTx?: (params: BuildSlashOracleTxParams) => Transaction;
402
575
  buildCreatePoolV2Tx?: (params: BuildCreatePoolV2TxParams) => Transaction;
403
576
  buildSetPoolOraclePolicyTx?: (params: BuildSetPoolOraclePolicyTxParams) => Transaction;
577
+ buildSetPoolOraclePermissionsTx?: (params: BuildSetPoolOraclePermissionsTxParams) => Transaction;
404
578
  buildSetPoolTermsHashTx?: (params: BuildSetPoolTermsHashTxParams) => Transaction;
405
579
  buildRegisterOutcomeSchemaTx?: (params: BuildRegisterOutcomeSchemaTxParams) => Transaction;
406
580
  buildVerifyOutcomeSchemaTx?: (params: BuildVerifyOutcomeSchemaTxParams) => Transaction;
@@ -417,6 +591,7 @@ export interface ProtocolClient {
417
591
  buildSubmitRewardClaimTx?: (params: BuildSubmitRewardClaimTxParams) => Transaction;
418
592
  buildRegisterCoverageProductV2Tx?: (params: BuildRegisterCoverageProductV2TxParams) => Transaction;
419
593
  buildUpdateCoverageProductV2Tx?: (params: BuildUpdateCoverageProductV2TxParams) => Transaction;
594
+ buildUpsertCoverageProductPaymentOptionTx?: (params: BuildUpsertCoverageProductPaymentOptionTxParams) => Transaction;
420
595
  buildSubscribeCoverageProductV2Tx?: (params: BuildSubscribeCoverageProductV2TxParams) => Transaction;
421
596
  buildIssueCoveragePolicyFromProductV2Tx?: (params: BuildIssueCoveragePolicyFromProductV2TxParams) => Transaction;
422
597
  buildCreateCoveragePolicyTx?: (params: BuildCreateCoveragePolicyTxParams) => Transaction;
@@ -439,6 +614,16 @@ export interface ProtocolClient {
439
614
  poolAddress: string;
440
615
  payoutMint: string;
441
616
  }) => Promise<ProtocolPoolAssetVaultAccount | null>;
617
+ fetchProtocolFeeVault?: (paymentMint: string) => Promise<ProtocolFeeVaultAccount | null>;
618
+ fetchPoolOracleFeeVault?: (params: {
619
+ poolAddress: string;
620
+ oracle: string;
621
+ paymentMint: string;
622
+ }) => Promise<ProtocolPoolOracleFeeVaultAccount | null>;
623
+ fetchPoolOraclePermissionSet?: (params: {
624
+ poolAddress: string;
625
+ oracle: string;
626
+ }) => Promise<ProtocolPoolOraclePermissionSetAccount | null>;
442
627
  fetchOutcomeSchema?: (schemaKeyHashHex: string) => Promise<ProtocolOutcomeSchemaRegistryEntryAccount | null>;
443
628
  fetchPoolOutcomeRule?: (params: {
444
629
  poolAddress: string;
@@ -477,6 +662,11 @@ export interface ProtocolClient {
477
662
  poolAddress: string;
478
663
  productIdHashHex: string;
479
664
  }) => Promise<ProtocolCoverageProductAccount | null>;
665
+ fetchCoverageProductPaymentOption?: (params: {
666
+ poolAddress: string;
667
+ productIdHashHex: string;
668
+ paymentMint: string;
669
+ }) => Promise<ProtocolCoverageProductPaymentOptionAccount | null>;
480
670
  fetchCoveragePolicy?: (params: {
481
671
  poolAddress: string;
482
672
  member: string;
@@ -485,6 +675,20 @@ export interface ProtocolClient {
485
675
  poolAddress: string;
486
676
  member: string;
487
677
  }) => Promise<ProtocolCoveragePolicyPositionNftAccount | null>;
678
+ fetchMemberCycle?: (params: {
679
+ poolAddress: string;
680
+ member: string;
681
+ periodIndex: bigint | number;
682
+ }) => Promise<ProtocolMemberCycleAccount | null>;
683
+ fetchCycleQuoteReplay?: (params: {
684
+ poolAddress: string;
685
+ member: string;
686
+ nonceHashHex: string;
687
+ }) => Promise<ProtocolCycleQuoteReplayAccount | null>;
688
+ fetchPoolTreasuryReserve?: (params: {
689
+ poolAddress: string;
690
+ paymentMint: string;
691
+ }) => Promise<ProtocolPoolTreasuryReserveAccount | null>;
488
692
  fetchPremiumLedger?: (params: {
489
693
  poolAddress: string;
490
694
  member: string;
@@ -532,6 +736,7 @@ export interface ProtocolPoolOraclePolicyAccount {
532
736
  quorumM: number;
533
737
  quorumN: number;
534
738
  requireVerifiedSchema: boolean;
739
+ oracleFeeBps: number;
535
740
  allowDelegateClaim: boolean;
536
741
  bump: number;
537
742
  }
@@ -555,6 +760,71 @@ export interface ProtocolPoolAssetVaultAccount {
555
760
  active: boolean;
556
761
  bump: number;
557
762
  }
763
+ export interface ProtocolFeeVaultAccount {
764
+ address: string;
765
+ paymentMint: string;
766
+ bump: number;
767
+ }
768
+ export interface ProtocolPoolOracleFeeVaultAccount {
769
+ address: string;
770
+ pool: string;
771
+ oracle: string;
772
+ paymentMint: string;
773
+ bump: number;
774
+ }
775
+ export interface ProtocolPoolOraclePermissionSetAccount {
776
+ address: string;
777
+ pool: string;
778
+ oracle: string;
779
+ permissions: number;
780
+ bump: number;
781
+ }
782
+ export type ProtocolMemberCycleStatus = 'active' | 'settled' | 'unknown';
783
+ export interface ProtocolMemberCycleAccount {
784
+ address: string;
785
+ pool: string;
786
+ member: string;
787
+ productIdHashHex: string;
788
+ periodIndex: bigint;
789
+ paymentMint: string;
790
+ premiumAmountRaw: bigint;
791
+ bondAmountRaw: bigint;
792
+ shieldFeeRaw: bigint;
793
+ protocolFeeRaw: bigint;
794
+ oracleFeeRaw: bigint;
795
+ netPoolPremiumRaw: bigint;
796
+ totalAmountRaw: bigint;
797
+ canonicalPremiumAmount: bigint;
798
+ commitmentEnabled: boolean;
799
+ thresholdBps: number;
800
+ includedShieldCount: number;
801
+ shieldConsumed: boolean;
802
+ statusCode: number;
803
+ status: ProtocolMemberCycleStatus;
804
+ passed: boolean;
805
+ activatedAt: number;
806
+ settledAt: number;
807
+ quoteHashHex: string;
808
+ bump: number;
809
+ }
810
+ export interface ProtocolCycleQuoteReplayAccount {
811
+ address: string;
812
+ pool: string;
813
+ member: string;
814
+ nonceHashHex: string;
815
+ quoteHashHex: string;
816
+ createdAt: number;
817
+ bump: number;
818
+ }
819
+ export interface ProtocolPoolTreasuryReserveAccount {
820
+ address: string;
821
+ pool: string;
822
+ paymentMint: string;
823
+ reservedRefundAmount: bigint;
824
+ reservedRewardAmount: bigint;
825
+ manualCoverageReserveAmount: bigint;
826
+ bump: number;
827
+ }
558
828
  export interface ProtocolOutcomeSchemaRegistryEntryAccount {
559
829
  address: string;
560
830
  schemaKeyHashHex: string;
@@ -599,6 +869,7 @@ export interface ProtocolCycleOutcomeAggregateAccount {
599
869
  finalized: boolean;
600
870
  passed: boolean;
601
871
  claimed: boolean;
872
+ rewardLiabilityReserved: boolean;
602
873
  latestAsOfTs: number;
603
874
  bump: number;
604
875
  }
@@ -689,6 +960,15 @@ export interface ProtocolCoverageProductAccount {
689
960
  updatedAtTs: number;
690
961
  bump: number;
691
962
  }
963
+ export interface ProtocolCoverageProductPaymentOptionAccount {
964
+ address: string;
965
+ pool: string;
966
+ productIdHashHex: string;
967
+ paymentMint: string;
968
+ paymentAmount: bigint;
969
+ active: boolean;
970
+ bump: number;
971
+ }
692
972
  export interface ProtocolCoveragePolicyPositionNftAccount {
693
973
  address: string;
694
974
  pool: string;
@@ -844,10 +1124,19 @@ export interface BuildSetPoolOraclePolicyTxParams {
844
1124
  quorumM: number;
845
1125
  quorumN: number;
846
1126
  requireVerifiedSchema: boolean;
1127
+ oracleFeeBps: number;
847
1128
  allowDelegateClaim: boolean;
848
1129
  recentBlockhash: string;
849
1130
  programId: string;
850
1131
  }
1132
+ export interface BuildSetPoolOraclePermissionsTxParams {
1133
+ authority: string;
1134
+ poolAddress: string;
1135
+ oracle: string;
1136
+ permissions: number;
1137
+ recentBlockhash: string;
1138
+ programId: string;
1139
+ }
851
1140
  export interface BuildSetPoolTermsHashTxParams {
852
1141
  authority: string;
853
1142
  poolAddress: string;
@@ -954,6 +1243,7 @@ export interface BuildSubmitOutcomeAttestationVoteTxParams {
954
1243
  cycleId: string;
955
1244
  ruleHashHex: string;
956
1245
  schemaKeyHashHex: string;
1246
+ payoutMint: string;
957
1247
  attestationDigestHex: string;
958
1248
  observedValueHashHex: string;
959
1249
  asOfTs: number;
@@ -966,6 +1256,7 @@ export interface BuildFinalizeCycleOutcomeTxParams {
966
1256
  member: string;
967
1257
  cycleId: string;
968
1258
  ruleHashHex: string;
1259
+ payoutMint: string;
969
1260
  recentBlockhash: string;
970
1261
  payer: string;
971
1262
  programId: string;
@@ -978,6 +1269,7 @@ export interface BuildSubmitRewardClaimTxParams {
978
1269
  ruleHashHex: string;
979
1270
  intentHashHex: string;
980
1271
  payoutAmount: bigint;
1272
+ payoutMint: string;
981
1273
  recipient: string;
982
1274
  recipientSystemAccount: string;
983
1275
  claimDelegate?: string;
@@ -1070,6 +1362,16 @@ export interface BuildRegisterCoverageProductV2TxParams {
1070
1362
  recentBlockhash: string;
1071
1363
  programId: string;
1072
1364
  }
1365
+ export interface BuildUpsertCoverageProductPaymentOptionTxParams {
1366
+ authority: string;
1367
+ poolAddress: string;
1368
+ productIdHashHex: string;
1369
+ paymentMint: string;
1370
+ paymentAmount: bigint;
1371
+ active: boolean;
1372
+ recentBlockhash: string;
1373
+ programId: string;
1374
+ }
1073
1375
  export interface BuildUpdateCoverageProductV2TxParams {
1074
1376
  authority: string;
1075
1377
  poolAddress: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omegax/protocol-sdk",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "TypeScript SDK for OmegaX protocol integrations on Solana devnet beta (mainnet coming soon).",
5
5
  "keywords": [
6
6
  "omegax",
@@ -79,6 +79,7 @@
79
79
  "dev": "tsx watch src/index.ts"
80
80
  },
81
81
  "dependencies": {
82
+ "@noble/hashes": "^1.8.0",
82
83
  "@solana/web3.js": "^1.98.4",
83
84
  "bs58": "^6.0.0",
84
85
  "tweetnacl": "^1.0.3"