@omegax/protocol-sdk 0.4.4 → 0.6.0

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.
Files changed (57) hide show
  1. package/NOTICE +5 -0
  2. package/README.md +88 -20
  3. package/dist/claims.d.ts +1 -2
  4. package/dist/claims.js +101 -166
  5. package/dist/internal/protocol/all.d.ts +283 -0
  6. package/dist/internal/protocol/all.js +7195 -0
  7. package/dist/internal/protocol/builders.d.ts +1 -0
  8. package/dist/internal/protocol/builders.js +1 -0
  9. package/dist/internal/protocol/client.d.ts +1 -0
  10. package/dist/internal/protocol/client.js +1 -0
  11. package/dist/internal/protocol/constants.d.ts +1 -0
  12. package/dist/internal/protocol/constants.js +1 -0
  13. package/dist/internal/protocol/decoders.d.ts +1 -0
  14. package/dist/internal/protocol/decoders.js +1 -0
  15. package/dist/internal/protocol/fetchers.d.ts +1 -0
  16. package/dist/internal/protocol/fetchers.js +1 -0
  17. package/dist/internal/protocol/shared.d.ts +1 -0
  18. package/dist/internal/protocol/shared.js +1 -0
  19. package/dist/internal/protocol-seeds/all.d.ts +265 -0
  20. package/dist/internal/protocol-seeds/all.js +455 -0
  21. package/dist/internal/protocol-seeds/claims.d.ts +1 -0
  22. package/dist/internal/protocol-seeds/claims.js +1 -0
  23. package/dist/internal/protocol-seeds/core.d.ts +1 -0
  24. package/dist/internal/protocol-seeds/core.js +1 -0
  25. package/dist/internal/protocol-seeds/liquidity.d.ts +1 -0
  26. package/dist/internal/protocol-seeds/liquidity.js +1 -0
  27. package/dist/internal/protocol-seeds/oracle.d.ts +1 -0
  28. package/dist/internal/protocol-seeds/oracle.js +1 -0
  29. package/dist/internal/protocol-seeds/policy.d.ts +1 -0
  30. package/dist/internal/protocol-seeds/policy.js +1 -0
  31. package/dist/internal/reward-claim.d.ts +17 -0
  32. package/dist/internal/reward-claim.js +27 -0
  33. package/dist/internal/rpc.d.ts +15 -0
  34. package/dist/internal/rpc.js +26 -0
  35. package/dist/internal/types/all.d.ts +1952 -0
  36. package/dist/internal/types/all.js +1 -0
  37. package/dist/internal/types/builders.d.ts +1 -0
  38. package/dist/internal/types/builders.js +1 -0
  39. package/dist/internal/types/claims.d.ts +1 -0
  40. package/dist/internal/types/claims.js +1 -0
  41. package/dist/internal/types/oracle.d.ts +1 -0
  42. package/dist/internal/types/oracle.js +1 -0
  43. package/dist/internal/types/protocol.d.ts +1 -0
  44. package/dist/internal/types/protocol.js +1 -0
  45. package/dist/internal/types/rpc.d.ts +1 -0
  46. package/dist/internal/types/rpc.js +1 -0
  47. package/dist/oracle.js +3 -2
  48. package/dist/protocol.d.ts +3 -13
  49. package/dist/protocol.js +3 -4534
  50. package/dist/protocol_seeds.d.ts +1 -220
  51. package/dist/protocol_seeds.js +1 -324
  52. package/dist/rpc.js +51 -6
  53. package/dist/transactions.d.ts +1 -0
  54. package/dist/transactions.js +28 -6
  55. package/dist/types.d.ts +1 -1424
  56. package/dist/types.js +1 -1
  57. package/package.json +22 -5
@@ -1,220 +1 @@
1
- import { PublicKey } from '@solana/web3.js';
2
- export declare const SEED_CONFIG = "config";
3
- export declare const SEED_POOL = "pool";
4
- export declare const SEED_ORACLE = "oracle";
5
- export declare const SEED_ORACLE_PROFILE = "oracle_profile";
6
- export declare const SEED_POOL_ORACLE = "pool_oracle";
7
- export declare const SEED_MEMBERSHIP = "membership";
8
- export declare const SEED_CYCLE = "cycle";
9
- export declare const SEED_CYCLE_WINDOW = "cycle_window";
10
- export declare const SEED_REPLAY = "replay";
11
- export declare const SEED_CLAIM = "claim";
12
- export declare const SEED_CONFIG_V2 = "config_v2";
13
- export declare const SEED_ORACLE_STAKE = "oracle_stake";
14
- export declare const SEED_POOL_ORACLE_POLICY = "pool_oracle_policy";
15
- export declare const SEED_POOL_TERMS = "pool_terms";
16
- export declare const SEED_POOL_ASSET_VAULT = "pool_asset_vault";
17
- export declare const SEED_POOL_ORACLE_PERMISSIONS = "pool_oracle_permissions";
18
- export declare const SEED_MEMBER_CYCLE = "member_cycle";
19
- export declare const SEED_CYCLE_QUOTE_REPLAY = "cycle_quote_replay";
20
- export declare const SEED_POOL_TREASURY_RESERVE = "pool_treasury_reserve";
21
- export declare const SEED_PROTOCOL_FEE_VAULT = "protocol_fee_vault";
22
- export declare const SEED_POOL_ORACLE_FEE_VAULT = "pool_oracle_fee_vault";
23
- export declare const SEED_SCHEMA = "schema";
24
- export declare const SEED_POOL_RULE = "pool_rule";
25
- export declare const SEED_INVITE_ISSUER = "invite_issuer";
26
- export declare const SEED_ENROLLMENT_REPLAY = "enrollment_replay";
27
- export declare const SEED_ATTESTATION_VOTE = "attestation_vote";
28
- export declare const SEED_OUTCOME_AGGREGATE = "outcome_agg";
29
- export declare const SEED_CLAIM_DELEGATE = "claim_delegate";
30
- export declare const SEED_CLAIM_V2 = "claim_v2";
31
- export declare const SEED_COVERAGE_POLICY = "coverage_policy";
32
- export declare const SEED_COVERAGE_NFT = "coverage_nft";
33
- export declare const SEED_COVERAGE_PRODUCT = "coverage_product";
34
- export declare const SEED_COVERAGE_PRODUCT_PAYMENT_OPTION = "coverage_product_payment_option";
35
- export declare const SEED_PREMIUM_LEDGER = "premium_ledger";
36
- export declare const SEED_PREMIUM_REPLAY = "premium_replay";
37
- export declare const SEED_COVERAGE_CLAIM = "coverage_claim";
38
- export declare const ZERO_PUBKEY = "11111111111111111111111111111111";
39
- export declare function asPubkey(value: string | PublicKey): PublicKey;
40
- export declare function deriveConfigPda(programId: PublicKey): [PublicKey, number];
41
- export declare function derivePoolPda(params: {
42
- programId: string | PublicKey;
43
- authority: string | PublicKey;
44
- poolId: string;
45
- }): [PublicKey, number];
46
- export declare function deriveOraclePda(params: {
47
- programId: string | PublicKey;
48
- oracle: string | PublicKey;
49
- }): [PublicKey, number];
50
- export declare function deriveOracleProfilePda(params: {
51
- programId: string | PublicKey;
52
- oracle: string | PublicKey;
53
- }): [PublicKey, number];
54
- export declare function derivePoolOraclePda(params: {
55
- programId: string | PublicKey;
56
- poolAddress: string | PublicKey;
57
- oracle: string | PublicKey;
58
- }): [PublicKey, number];
59
- export declare function deriveMembershipPda(params: {
60
- programId: string | PublicKey;
61
- poolAddress: string | PublicKey;
62
- member: string | PublicKey;
63
- }): [PublicKey, number];
64
- export declare function deriveCycleOutcomePda(params: {
65
- programId: string | PublicKey;
66
- poolAddress: string | PublicKey;
67
- member: string | PublicKey;
68
- cycleHash: Uint8Array;
69
- }): [PublicKey, number];
70
- export declare function deriveCycleWindowPda(params: {
71
- programId: string | PublicKey;
72
- poolAddress: string | PublicKey;
73
- cycleHash: Uint8Array;
74
- }): [PublicKey, number];
75
- export declare function deriveReplayPda(params: {
76
- programId: string | PublicKey;
77
- poolAddress: string | PublicKey;
78
- replayHash: Uint8Array;
79
- }): [PublicKey, number];
80
- export declare function deriveClaimPda(params: {
81
- programId: string | PublicKey;
82
- poolAddress: string | PublicKey;
83
- member: string | PublicKey;
84
- cycleHash: Uint8Array;
85
- }): [PublicKey, number];
86
- export declare function deriveConfigV2Pda(programId: string | PublicKey): [PublicKey, number];
87
- export declare function deriveOracleStakePda(params: {
88
- programId: string | PublicKey;
89
- oracle: string | PublicKey;
90
- staker: string | PublicKey;
91
- }): [PublicKey, number];
92
- export declare function derivePoolOraclePolicyPda(params: {
93
- programId: string | PublicKey;
94
- poolAddress: string | PublicKey;
95
- }): [PublicKey, number];
96
- export declare function derivePoolTermsPda(params: {
97
- programId: string | PublicKey;
98
- poolAddress: string | PublicKey;
99
- }): [PublicKey, number];
100
- export declare function derivePoolAssetVaultPda(params: {
101
- programId: string | PublicKey;
102
- poolAddress: string | PublicKey;
103
- payoutMint: string | PublicKey;
104
- }): [PublicKey, number];
105
- export declare function deriveCoverageProductPaymentOptionPda(params: {
106
- programId: string | PublicKey;
107
- poolAddress: string | PublicKey;
108
- productIdHash: Uint8Array;
109
- paymentMint: string | PublicKey;
110
- }): [PublicKey, number];
111
- export declare function derivePoolOraclePermissionSetPda(params: {
112
- programId: string | PublicKey;
113
- poolAddress: string | PublicKey;
114
- oracle: string | PublicKey;
115
- }): [PublicKey, number];
116
- export declare function deriveMemberCyclePda(params: {
117
- programId: string | PublicKey;
118
- poolAddress: string | PublicKey;
119
- member: string | PublicKey;
120
- periodIndex: bigint | number;
121
- }): [PublicKey, number];
122
- export declare function deriveCycleQuoteReplayPda(params: {
123
- programId: string | PublicKey;
124
- poolAddress: string | PublicKey;
125
- member: string | PublicKey;
126
- nonceHash: Uint8Array;
127
- }): [PublicKey, number];
128
- export declare function derivePoolTreasuryReservePda(params: {
129
- programId: string | PublicKey;
130
- poolAddress: string | PublicKey;
131
- paymentMint: string | PublicKey;
132
- }): [PublicKey, number];
133
- export declare function deriveProtocolFeeVaultPda(params: {
134
- programId: string | PublicKey;
135
- paymentMint: string | PublicKey;
136
- }): [PublicKey, number];
137
- export declare function derivePoolOracleFeeVaultPda(params: {
138
- programId: string | PublicKey;
139
- poolAddress: string | PublicKey;
140
- oracle: string | PublicKey;
141
- paymentMint: string | PublicKey;
142
- }): [PublicKey, number];
143
- export declare function deriveSchemaPda(params: {
144
- programId: string | PublicKey;
145
- schemaKeyHash: Uint8Array;
146
- }): [PublicKey, number];
147
- export declare function derivePoolRulePda(params: {
148
- programId: string | PublicKey;
149
- poolAddress: string | PublicKey;
150
- ruleHash: Uint8Array;
151
- }): [PublicKey, number];
152
- export declare function deriveInviteIssuerPda(params: {
153
- programId: string | PublicKey;
154
- issuer: string | PublicKey;
155
- }): [PublicKey, number];
156
- export declare function deriveEnrollmentReplayPda(params: {
157
- programId: string | PublicKey;
158
- poolAddress: string | PublicKey;
159
- member: string | PublicKey;
160
- nonceHash: Uint8Array;
161
- }): [PublicKey, number];
162
- export declare function deriveAttestationVotePda(params: {
163
- programId: string | PublicKey;
164
- poolAddress: string | PublicKey;
165
- member: string | PublicKey;
166
- cycleHash: Uint8Array;
167
- ruleHash: Uint8Array;
168
- oracle: string | PublicKey;
169
- }): [PublicKey, number];
170
- export declare function deriveClaimDelegatePda(params: {
171
- programId: string | PublicKey;
172
- poolAddress: string | PublicKey;
173
- member: string | PublicKey;
174
- }): [PublicKey, number];
175
- export declare function deriveClaimV2Pda(params: {
176
- programId: string | PublicKey;
177
- poolAddress: string | PublicKey;
178
- member: string | PublicKey;
179
- cycleHash: Uint8Array;
180
- ruleHash: Uint8Array;
181
- }): [PublicKey, number];
182
- export declare function deriveOutcomeAggregatePda(params: {
183
- programId: string | PublicKey;
184
- poolAddress: string | PublicKey;
185
- member: string | PublicKey;
186
- cycleHash: Uint8Array;
187
- ruleHash: Uint8Array;
188
- }): [PublicKey, number];
189
- export declare function deriveCoveragePolicyPda(params: {
190
- programId: string | PublicKey;
191
- poolAddress: string | PublicKey;
192
- member: string | PublicKey;
193
- }): [PublicKey, number];
194
- export declare function deriveCoverageProductPda(params: {
195
- programId: string | PublicKey;
196
- poolAddress: string | PublicKey;
197
- productIdHash: Uint8Array;
198
- }): [PublicKey, number];
199
- export declare function deriveCoverageNftPda(params: {
200
- programId: string | PublicKey;
201
- poolAddress: string | PublicKey;
202
- member: string | PublicKey;
203
- }): [PublicKey, number];
204
- export declare function derivePremiumLedgerPda(params: {
205
- programId: string | PublicKey;
206
- poolAddress: string | PublicKey;
207
- member: string | PublicKey;
208
- }): [PublicKey, number];
209
- export declare function derivePremiumReplayPda(params: {
210
- programId: string | PublicKey;
211
- poolAddress: string | PublicKey;
212
- member: string | PublicKey;
213
- replayHash: Uint8Array;
214
- }): [PublicKey, number];
215
- export declare function deriveCoverageClaimPda(params: {
216
- programId: string | PublicKey;
217
- poolAddress: string | PublicKey;
218
- member: string | PublicKey;
219
- intentHash: Uint8Array;
220
- }): [PublicKey, number];
1
+ export * from './internal/protocol-seeds/all.js';
@@ -1,324 +1 @@
1
- import { PublicKey, } from '@solana/web3.js';
2
- export const SEED_CONFIG = 'config';
3
- export const SEED_POOL = 'pool';
4
- export const SEED_ORACLE = 'oracle';
5
- export const SEED_ORACLE_PROFILE = 'oracle_profile';
6
- export const SEED_POOL_ORACLE = 'pool_oracle';
7
- export const SEED_MEMBERSHIP = 'membership';
8
- export const SEED_CYCLE = 'cycle';
9
- export const SEED_CYCLE_WINDOW = 'cycle_window';
10
- export const SEED_REPLAY = 'replay';
11
- export const SEED_CLAIM = 'claim';
12
- export const SEED_CONFIG_V2 = 'config_v2';
13
- export const SEED_ORACLE_STAKE = 'oracle_stake';
14
- export const SEED_POOL_ORACLE_POLICY = 'pool_oracle_policy';
15
- export const SEED_POOL_TERMS = 'pool_terms';
16
- export const SEED_POOL_ASSET_VAULT = 'pool_asset_vault';
17
- export const SEED_POOL_ORACLE_PERMISSIONS = 'pool_oracle_permissions';
18
- export const SEED_MEMBER_CYCLE = 'member_cycle';
19
- export const SEED_CYCLE_QUOTE_REPLAY = 'cycle_quote_replay';
20
- export const SEED_POOL_TREASURY_RESERVE = 'pool_treasury_reserve';
21
- export const SEED_PROTOCOL_FEE_VAULT = 'protocol_fee_vault';
22
- export const SEED_POOL_ORACLE_FEE_VAULT = 'pool_oracle_fee_vault';
23
- export const SEED_SCHEMA = 'schema';
24
- export const SEED_POOL_RULE = 'pool_rule';
25
- export const SEED_INVITE_ISSUER = 'invite_issuer';
26
- export const SEED_ENROLLMENT_REPLAY = 'enrollment_replay';
27
- export const SEED_ATTESTATION_VOTE = 'attestation_vote';
28
- export const SEED_OUTCOME_AGGREGATE = 'outcome_agg';
29
- export const SEED_CLAIM_DELEGATE = 'claim_delegate';
30
- export const SEED_CLAIM_V2 = 'claim_v2';
31
- export const SEED_COVERAGE_POLICY = 'coverage_policy';
32
- export const SEED_COVERAGE_NFT = 'coverage_nft';
33
- export const SEED_COVERAGE_PRODUCT = 'coverage_product';
34
- export const SEED_COVERAGE_PRODUCT_PAYMENT_OPTION = 'coverage_product_payment_option';
35
- export const SEED_PREMIUM_LEDGER = 'premium_ledger';
36
- export const SEED_PREMIUM_REPLAY = 'premium_replay';
37
- export const SEED_COVERAGE_CLAIM = 'coverage_claim';
38
- export const ZERO_PUBKEY = '11111111111111111111111111111111';
39
- export function asPubkey(value) {
40
- if (value instanceof PublicKey)
41
- return value;
42
- return new PublicKey(value);
43
- }
44
- export function deriveConfigPda(programId) {
45
- return PublicKey.findProgramAddressSync([Buffer.from(SEED_CONFIG)], programId);
46
- }
47
- export function derivePoolPda(params) {
48
- const program = asPubkey(params.programId);
49
- const authority = asPubkey(params.authority);
50
- return PublicKey.findProgramAddressSync([
51
- Buffer.from(SEED_POOL),
52
- authority.toBuffer(),
53
- Buffer.from(params.poolId, 'utf8'),
54
- ], program);
55
- }
56
- export function deriveOraclePda(params) {
57
- const program = asPubkey(params.programId);
58
- const oracle = asPubkey(params.oracle);
59
- return PublicKey.findProgramAddressSync([Buffer.from(SEED_ORACLE), oracle.toBuffer()], program);
60
- }
61
- export function deriveOracleProfilePda(params) {
62
- const program = asPubkey(params.programId);
63
- const oracle = asPubkey(params.oracle);
64
- return PublicKey.findProgramAddressSync([Buffer.from(SEED_ORACLE_PROFILE), oracle.toBuffer()], program);
65
- }
66
- export function derivePoolOraclePda(params) {
67
- const program = asPubkey(params.programId);
68
- const pool = asPubkey(params.poolAddress);
69
- const oracle = asPubkey(params.oracle);
70
- return PublicKey.findProgramAddressSync([Buffer.from(SEED_POOL_ORACLE), pool.toBuffer(), oracle.toBuffer()], program);
71
- }
72
- export function deriveMembershipPda(params) {
73
- const program = asPubkey(params.programId);
74
- const pool = asPubkey(params.poolAddress);
75
- const member = asPubkey(params.member);
76
- return PublicKey.findProgramAddressSync([Buffer.from(SEED_MEMBERSHIP), pool.toBuffer(), member.toBuffer()], program);
77
- }
78
- export function deriveCycleOutcomePda(params) {
79
- const program = asPubkey(params.programId);
80
- const pool = asPubkey(params.poolAddress);
81
- const member = asPubkey(params.member);
82
- return PublicKey.findProgramAddressSync([
83
- Buffer.from(SEED_CYCLE),
84
- pool.toBuffer(),
85
- member.toBuffer(),
86
- Buffer.from(params.cycleHash),
87
- ], program);
88
- }
89
- export function deriveCycleWindowPda(params) {
90
- const program = asPubkey(params.programId);
91
- const pool = asPubkey(params.poolAddress);
92
- return PublicKey.findProgramAddressSync([
93
- Buffer.from(SEED_CYCLE_WINDOW),
94
- pool.toBuffer(),
95
- Buffer.from(params.cycleHash),
96
- ], program);
97
- }
98
- export function deriveReplayPda(params) {
99
- const program = asPubkey(params.programId);
100
- const pool = asPubkey(params.poolAddress);
101
- return PublicKey.findProgramAddressSync([Buffer.from(SEED_REPLAY), pool.toBuffer(), Buffer.from(params.replayHash)], program);
102
- }
103
- export function deriveClaimPda(params) {
104
- const program = asPubkey(params.programId);
105
- const pool = asPubkey(params.poolAddress);
106
- const member = asPubkey(params.member);
107
- return PublicKey.findProgramAddressSync([
108
- Buffer.from(SEED_CLAIM),
109
- pool.toBuffer(),
110
- member.toBuffer(),
111
- Buffer.from(params.cycleHash),
112
- ], program);
113
- }
114
- export function deriveConfigV2Pda(programId) {
115
- const program = asPubkey(programId);
116
- return PublicKey.findProgramAddressSync([Buffer.from(SEED_CONFIG_V2)], program);
117
- }
118
- export function deriveOracleStakePda(params) {
119
- const program = asPubkey(params.programId);
120
- const oracle = asPubkey(params.oracle);
121
- const staker = asPubkey(params.staker);
122
- return PublicKey.findProgramAddressSync([Buffer.from(SEED_ORACLE_STAKE), oracle.toBuffer(), staker.toBuffer()], program);
123
- }
124
- export function derivePoolOraclePolicyPda(params) {
125
- const program = asPubkey(params.programId);
126
- const pool = asPubkey(params.poolAddress);
127
- return PublicKey.findProgramAddressSync([Buffer.from(SEED_POOL_ORACLE_POLICY), pool.toBuffer()], program);
128
- }
129
- export function derivePoolTermsPda(params) {
130
- const program = asPubkey(params.programId);
131
- const pool = asPubkey(params.poolAddress);
132
- return PublicKey.findProgramAddressSync([Buffer.from(SEED_POOL_TERMS), pool.toBuffer()], program);
133
- }
134
- export function derivePoolAssetVaultPda(params) {
135
- const program = asPubkey(params.programId);
136
- const pool = asPubkey(params.poolAddress);
137
- const mint = asPubkey(params.payoutMint);
138
- return PublicKey.findProgramAddressSync([Buffer.from(SEED_POOL_ASSET_VAULT), pool.toBuffer(), mint.toBuffer()], program);
139
- }
140
- export function deriveCoverageProductPaymentOptionPda(params) {
141
- const program = asPubkey(params.programId);
142
- const pool = asPubkey(params.poolAddress);
143
- const mint = asPubkey(params.paymentMint);
144
- return PublicKey.findProgramAddressSync([
145
- Buffer.from(SEED_COVERAGE_PRODUCT_PAYMENT_OPTION),
146
- pool.toBuffer(),
147
- Buffer.from(params.productIdHash),
148
- mint.toBuffer(),
149
- ], program);
150
- }
151
- function encodeU64Seed(value) {
152
- const out = Buffer.alloc(8);
153
- out.writeBigUInt64LE(typeof value === 'bigint' ? value : BigInt(value));
154
- return out;
155
- }
156
- export function derivePoolOraclePermissionSetPda(params) {
157
- const program = asPubkey(params.programId);
158
- const pool = asPubkey(params.poolAddress);
159
- const oracle = asPubkey(params.oracle);
160
- return PublicKey.findProgramAddressSync([Buffer.from(SEED_POOL_ORACLE_PERMISSIONS), pool.toBuffer(), oracle.toBuffer()], program);
161
- }
162
- export function deriveMemberCyclePda(params) {
163
- const program = asPubkey(params.programId);
164
- const pool = asPubkey(params.poolAddress);
165
- const member = asPubkey(params.member);
166
- return PublicKey.findProgramAddressSync([
167
- Buffer.from(SEED_MEMBER_CYCLE),
168
- pool.toBuffer(),
169
- member.toBuffer(),
170
- encodeU64Seed(params.periodIndex),
171
- ], program);
172
- }
173
- export function deriveCycleQuoteReplayPda(params) {
174
- const program = asPubkey(params.programId);
175
- const pool = asPubkey(params.poolAddress);
176
- const member = asPubkey(params.member);
177
- return PublicKey.findProgramAddressSync([
178
- Buffer.from(SEED_CYCLE_QUOTE_REPLAY),
179
- pool.toBuffer(),
180
- member.toBuffer(),
181
- Buffer.from(params.nonceHash),
182
- ], program);
183
- }
184
- export function derivePoolTreasuryReservePda(params) {
185
- const program = asPubkey(params.programId);
186
- const pool = asPubkey(params.poolAddress);
187
- const paymentMint = asPubkey(params.paymentMint);
188
- return PublicKey.findProgramAddressSync([
189
- Buffer.from(SEED_POOL_TREASURY_RESERVE),
190
- pool.toBuffer(),
191
- paymentMint.toBuffer(),
192
- ], program);
193
- }
194
- export function deriveProtocolFeeVaultPda(params) {
195
- const program = asPubkey(params.programId);
196
- const paymentMint = asPubkey(params.paymentMint);
197
- return PublicKey.findProgramAddressSync([Buffer.from(SEED_PROTOCOL_FEE_VAULT), paymentMint.toBuffer()], program);
198
- }
199
- export function derivePoolOracleFeeVaultPda(params) {
200
- const program = asPubkey(params.programId);
201
- const pool = asPubkey(params.poolAddress);
202
- const oracle = asPubkey(params.oracle);
203
- const paymentMint = asPubkey(params.paymentMint);
204
- return PublicKey.findProgramAddressSync([
205
- Buffer.from(SEED_POOL_ORACLE_FEE_VAULT),
206
- pool.toBuffer(),
207
- oracle.toBuffer(),
208
- paymentMint.toBuffer(),
209
- ], program);
210
- }
211
- export function deriveSchemaPda(params) {
212
- const program = asPubkey(params.programId);
213
- return PublicKey.findProgramAddressSync([Buffer.from(SEED_SCHEMA), Buffer.from(params.schemaKeyHash)], program);
214
- }
215
- export function derivePoolRulePda(params) {
216
- const program = asPubkey(params.programId);
217
- const pool = asPubkey(params.poolAddress);
218
- return PublicKey.findProgramAddressSync([Buffer.from(SEED_POOL_RULE), pool.toBuffer(), Buffer.from(params.ruleHash)], program);
219
- }
220
- export function deriveInviteIssuerPda(params) {
221
- const program = asPubkey(params.programId);
222
- const issuer = asPubkey(params.issuer);
223
- return PublicKey.findProgramAddressSync([Buffer.from(SEED_INVITE_ISSUER), issuer.toBuffer()], program);
224
- }
225
- export function deriveEnrollmentReplayPda(params) {
226
- const program = asPubkey(params.programId);
227
- const pool = asPubkey(params.poolAddress);
228
- const member = asPubkey(params.member);
229
- return PublicKey.findProgramAddressSync([
230
- Buffer.from(SEED_ENROLLMENT_REPLAY),
231
- pool.toBuffer(),
232
- member.toBuffer(),
233
- Buffer.from(params.nonceHash),
234
- ], program);
235
- }
236
- export function deriveAttestationVotePda(params) {
237
- const program = asPubkey(params.programId);
238
- const pool = asPubkey(params.poolAddress);
239
- const member = asPubkey(params.member);
240
- const oracle = asPubkey(params.oracle);
241
- return PublicKey.findProgramAddressSync([
242
- Buffer.from(SEED_ATTESTATION_VOTE),
243
- pool.toBuffer(),
244
- member.toBuffer(),
245
- Buffer.from(params.cycleHash),
246
- Buffer.from(params.ruleHash),
247
- oracle.toBuffer(),
248
- ], program);
249
- }
250
- export function deriveClaimDelegatePda(params) {
251
- const program = asPubkey(params.programId);
252
- const pool = asPubkey(params.poolAddress);
253
- const member = asPubkey(params.member);
254
- return PublicKey.findProgramAddressSync([Buffer.from(SEED_CLAIM_DELEGATE), pool.toBuffer(), member.toBuffer()], program);
255
- }
256
- export function deriveClaimV2Pda(params) {
257
- const program = asPubkey(params.programId);
258
- const pool = asPubkey(params.poolAddress);
259
- const member = asPubkey(params.member);
260
- return PublicKey.findProgramAddressSync([
261
- Buffer.from(SEED_CLAIM_V2),
262
- pool.toBuffer(),
263
- member.toBuffer(),
264
- Buffer.from(params.cycleHash),
265
- Buffer.from(params.ruleHash),
266
- ], program);
267
- }
268
- export function deriveOutcomeAggregatePda(params) {
269
- const program = asPubkey(params.programId);
270
- const pool = asPubkey(params.poolAddress);
271
- const member = asPubkey(params.member);
272
- return PublicKey.findProgramAddressSync([
273
- Buffer.from(SEED_OUTCOME_AGGREGATE),
274
- pool.toBuffer(),
275
- member.toBuffer(),
276
- Buffer.from(params.cycleHash),
277
- Buffer.from(params.ruleHash),
278
- ], program);
279
- }
280
- export function deriveCoveragePolicyPda(params) {
281
- const program = asPubkey(params.programId);
282
- const pool = asPubkey(params.poolAddress);
283
- const member = asPubkey(params.member);
284
- return PublicKey.findProgramAddressSync([Buffer.from(SEED_COVERAGE_POLICY), pool.toBuffer(), member.toBuffer()], program);
285
- }
286
- export function deriveCoverageProductPda(params) {
287
- const program = asPubkey(params.programId);
288
- const pool = asPubkey(params.poolAddress);
289
- return PublicKey.findProgramAddressSync([Buffer.from(SEED_COVERAGE_PRODUCT), pool.toBuffer(), Buffer.from(params.productIdHash)], program);
290
- }
291
- export function deriveCoverageNftPda(params) {
292
- const program = asPubkey(params.programId);
293
- const pool = asPubkey(params.poolAddress);
294
- const member = asPubkey(params.member);
295
- return PublicKey.findProgramAddressSync([Buffer.from(SEED_COVERAGE_NFT), pool.toBuffer(), member.toBuffer()], program);
296
- }
297
- export function derivePremiumLedgerPda(params) {
298
- const program = asPubkey(params.programId);
299
- const pool = asPubkey(params.poolAddress);
300
- const member = asPubkey(params.member);
301
- return PublicKey.findProgramAddressSync([Buffer.from(SEED_PREMIUM_LEDGER), pool.toBuffer(), member.toBuffer()], program);
302
- }
303
- export function derivePremiumReplayPda(params) {
304
- const program = asPubkey(params.programId);
305
- const pool = asPubkey(params.poolAddress);
306
- const member = asPubkey(params.member);
307
- return PublicKey.findProgramAddressSync([
308
- Buffer.from(SEED_PREMIUM_REPLAY),
309
- pool.toBuffer(),
310
- member.toBuffer(),
311
- Buffer.from(params.replayHash),
312
- ], program);
313
- }
314
- export function deriveCoverageClaimPda(params) {
315
- const program = asPubkey(params.programId);
316
- const pool = asPubkey(params.poolAddress);
317
- const member = asPubkey(params.member);
318
- return PublicKey.findProgramAddressSync([
319
- Buffer.from(SEED_COVERAGE_CLAIM),
320
- pool.toBuffer(),
321
- member.toBuffer(),
322
- Buffer.from(params.intentHash),
323
- ], program);
324
- }
1
+ export * from './internal/protocol-seeds/all.js';
package/dist/rpc.js CHANGED
@@ -1,6 +1,11 @@
1
- import { Connection, } from '@solana/web3.js';
1
+ import { Connection } from '@solana/web3.js';
2
+ import { simulateSignedTransactionViaConnection } from './internal/rpc.js';
2
3
  import { normalizeClaimSimulationFailure } from './claims.js';
3
4
  import { decodeSolanaTransaction, } from './transactions.js';
5
+ function shouldRetrySignedSimulationWithoutSigVerify(params) {
6
+ const message = params.error instanceof Error ? params.error.message : String(params.error);
7
+ return params.sigVerify && /invalid arguments/i.test(message);
8
+ }
4
9
  export const OMEGAX_NETWORKS = {
5
10
  devnet: {
6
11
  network: 'devnet',
@@ -20,7 +25,9 @@ export const OMEGAX_NETWORKS = {
20
25
  },
21
26
  };
22
27
  function normalizeOmegaXNetwork(input) {
23
- const normalized = String(input ?? 'devnet').trim().toLowerCase();
28
+ const normalized = String(input ?? 'devnet')
29
+ .trim()
30
+ .toLowerCase();
24
31
  if (normalized === 'devnet')
25
32
  return 'devnet';
26
33
  if (normalized === 'mainnet' || normalized === 'mainnet-beta')
@@ -85,11 +92,49 @@ export function createRpcClient(connection) {
85
92
  failure: normalizeClaimSimulationFailure({ err: error, logs: [] }),
86
93
  };
87
94
  }
88
- const result = await connection.simulateTransaction(tx, {
95
+ const replaceRecentBlockhash = params.replaceRecentBlockhash ?? true;
96
+ const sigVerify = params.sigVerify ?? true;
97
+ const baseOptions = {
89
98
  commitment: params.commitment ?? 'confirmed',
90
- replaceRecentBlockhash: params.replaceRecentBlockhash ?? true,
91
- sigVerify: params.sigVerify ?? true,
92
- });
99
+ replaceRecentBlockhash,
100
+ sigVerify,
101
+ };
102
+ let result;
103
+ try {
104
+ result = await simulateSignedTransactionViaConnection(connection, tx, baseOptions);
105
+ }
106
+ catch (error) {
107
+ if (!shouldRetrySignedSimulationWithoutSigVerify({
108
+ error,
109
+ sigVerify,
110
+ })) {
111
+ return {
112
+ ok: false,
113
+ logs: [],
114
+ unitsConsumed: null,
115
+ err: error,
116
+ failure: normalizeClaimSimulationFailure({ err: error, logs: [] }),
117
+ };
118
+ }
119
+ try {
120
+ result = await simulateSignedTransactionViaConnection(connection, tx, {
121
+ ...baseOptions,
122
+ sigVerify: false,
123
+ });
124
+ }
125
+ catch (retryError) {
126
+ return {
127
+ ok: false,
128
+ logs: [],
129
+ unitsConsumed: null,
130
+ err: retryError,
131
+ failure: normalizeClaimSimulationFailure({
132
+ err: retryError,
133
+ logs: [],
134
+ }),
135
+ };
136
+ }
137
+ }
93
138
  const logs = result.value.logs ?? [];
94
139
  const unitsConsumed = typeof result.value.unitsConsumed === 'number'
95
140
  ? result.value.unitsConsumed
@@ -4,6 +4,7 @@ export declare function decodeSolanaTransaction(input: string | Uint8Array | Buf
4
4
  export declare function serializeSolanaTransaction(transaction: SolanaTransaction): Buffer;
5
5
  export declare function serializeSolanaTransactionBase64(transaction: SolanaTransaction): string;
6
6
  export declare function solanaTransactionMessageBytes(transaction: SolanaTransaction): Uint8Array;
7
+ export declare function solanaTransactionIntentMessageBytes(transaction: SolanaTransaction): Uint8Array;
7
8
  export declare function solanaTransactionMessageBase64(input: SolanaTransaction | string | Uint8Array | Buffer): string;
8
9
  export declare function solanaTransactionRequiredSigner(transaction: SolanaTransaction): string | null;
9
10
  export declare function solanaTransactionFirstSignature(transaction: SolanaTransaction): string | null;