@omegax/protocol-sdk 0.4.3 → 0.5.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.
- package/NOTICE +5 -0
- package/README.md +74 -16
- package/dist/claims.d.ts +1 -2
- package/dist/claims.js +85 -153
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/protocol.d.ts +4 -1
- package/dist/protocol.js +3204 -1163
- package/dist/protocol_seeds.d.ts +81 -29
- package/dist/protocol_seeds.js +174 -43
- package/dist/rpc.js +67 -6
- package/dist/transactions.d.ts +11 -0
- package/dist/transactions.js +121 -0
- package/dist/types.d.ts +858 -300
- package/package.json +11 -3
package/dist/protocol_seeds.d.ts
CHANGED
|
@@ -6,31 +6,38 @@ export declare const SEED_ORACLE_PROFILE = "oracle_profile";
|
|
|
6
6
|
export declare const SEED_POOL_ORACLE = "pool_oracle";
|
|
7
7
|
export declare const SEED_MEMBERSHIP = "membership";
|
|
8
8
|
export declare const SEED_CYCLE = "cycle";
|
|
9
|
-
export declare const SEED_CYCLE_WINDOW = "cycle_window";
|
|
10
|
-
export declare const SEED_REPLAY = "replay";
|
|
11
9
|
export declare const SEED_CLAIM = "claim";
|
|
12
|
-
export declare const SEED_CONFIG_V2 = "config_v2";
|
|
13
10
|
export declare const SEED_ORACLE_STAKE = "oracle_stake";
|
|
14
11
|
export declare const SEED_POOL_ORACLE_POLICY = "pool_oracle_policy";
|
|
15
12
|
export declare const SEED_POOL_TERMS = "pool_terms";
|
|
16
13
|
export declare const SEED_POOL_ASSET_VAULT = "pool_asset_vault";
|
|
14
|
+
export declare const SEED_POOL_RISK_CONFIG = "pool_risk_config";
|
|
15
|
+
export declare const SEED_POOL_CAPITAL_CLASS = "pool_capital_class";
|
|
16
|
+
export declare const SEED_POLICY_SERIES = "policy_series";
|
|
17
|
+
export declare const SEED_POLICY_SERIES_PAYMENT_OPTION = "policy_series_payment_option";
|
|
18
|
+
export declare const SEED_POLICY_POSITION = "policy_position";
|
|
19
|
+
export declare const SEED_POLICY_POSITION_NFT = "policy_position_nft";
|
|
20
|
+
export declare const SEED_POOL_COMPLIANCE_POLICY = "pool_compliance_policy";
|
|
21
|
+
export declare const SEED_POOL_CONTROL_AUTHORITY = "pool_control_authority";
|
|
22
|
+
export declare const SEED_POOL_AUTOMATION_POLICY = "pool_automation_policy";
|
|
23
|
+
export declare const SEED_POOL_LIQUIDITY_CONFIG = "pool_liquidity_config";
|
|
17
24
|
export declare const SEED_POOL_ORACLE_PERMISSIONS = "pool_oracle_permissions";
|
|
18
25
|
export declare const SEED_MEMBER_CYCLE = "member_cycle";
|
|
19
26
|
export declare const SEED_CYCLE_QUOTE_REPLAY = "cycle_quote_replay";
|
|
20
27
|
export declare const SEED_POOL_TREASURY_RESERVE = "pool_treasury_reserve";
|
|
28
|
+
export declare const SEED_POOL_SHARE_MINT = "pool_share_mint";
|
|
29
|
+
export declare const SEED_REDEMPTION_REQUEST = "redemption_request";
|
|
30
|
+
export declare const SEED_COHORT_SETTLEMENT_ROOT = "cohort_settlement_root";
|
|
21
31
|
export declare const SEED_PROTOCOL_FEE_VAULT = "protocol_fee_vault";
|
|
22
32
|
export declare const SEED_POOL_ORACLE_FEE_VAULT = "pool_oracle_fee_vault";
|
|
23
33
|
export declare const SEED_SCHEMA = "schema";
|
|
34
|
+
export declare const SEED_SCHEMA_DEPENDENCY = "schema_dependency";
|
|
24
35
|
export declare const SEED_POOL_RULE = "pool_rule";
|
|
25
36
|
export declare const SEED_INVITE_ISSUER = "invite_issuer";
|
|
26
37
|
export declare const SEED_ENROLLMENT_REPLAY = "enrollment_replay";
|
|
27
38
|
export declare const SEED_ATTESTATION_VOTE = "attestation_vote";
|
|
28
39
|
export declare const SEED_OUTCOME_AGGREGATE = "outcome_agg";
|
|
29
40
|
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
41
|
export declare const SEED_PREMIUM_LEDGER = "premium_ledger";
|
|
35
42
|
export declare const SEED_PREMIUM_REPLAY = "premium_replay";
|
|
36
43
|
export declare const SEED_COVERAGE_CLAIM = "coverage_claim";
|
|
@@ -66,23 +73,14 @@ export declare function deriveCycleOutcomePda(params: {
|
|
|
66
73
|
member: string | PublicKey;
|
|
67
74
|
cycleHash: Uint8Array;
|
|
68
75
|
}): [PublicKey, number];
|
|
69
|
-
export declare function deriveCycleWindowPda(params: {
|
|
70
|
-
programId: string | PublicKey;
|
|
71
|
-
poolAddress: string | PublicKey;
|
|
72
|
-
cycleHash: Uint8Array;
|
|
73
|
-
}): [PublicKey, number];
|
|
74
|
-
export declare function deriveReplayPda(params: {
|
|
75
|
-
programId: string | PublicKey;
|
|
76
|
-
poolAddress: string | PublicKey;
|
|
77
|
-
replayHash: Uint8Array;
|
|
78
|
-
}): [PublicKey, number];
|
|
79
76
|
export declare function deriveClaimPda(params: {
|
|
80
77
|
programId: string | PublicKey;
|
|
81
78
|
poolAddress: string | PublicKey;
|
|
79
|
+
seriesRefHash: Uint8Array;
|
|
82
80
|
member: string | PublicKey;
|
|
83
81
|
cycleHash: Uint8Array;
|
|
82
|
+
ruleHash: Uint8Array;
|
|
84
83
|
}): [PublicKey, number];
|
|
85
|
-
export declare function deriveConfigV2Pda(programId: string | PublicKey): [PublicKey, number];
|
|
86
84
|
export declare function deriveOracleStakePda(params: {
|
|
87
85
|
programId: string | PublicKey;
|
|
88
86
|
oracle: string | PublicKey;
|
|
@@ -101,6 +99,31 @@ export declare function derivePoolAssetVaultPda(params: {
|
|
|
101
99
|
poolAddress: string | PublicKey;
|
|
102
100
|
payoutMint: string | PublicKey;
|
|
103
101
|
}): [PublicKey, number];
|
|
102
|
+
export declare function derivePoolRiskConfigPda(params: {
|
|
103
|
+
programId: string | PublicKey;
|
|
104
|
+
poolAddress: string | PublicKey;
|
|
105
|
+
}): [PublicKey, number];
|
|
106
|
+
export declare function derivePoolLiquidityConfigPda(params: {
|
|
107
|
+
programId: string | PublicKey;
|
|
108
|
+
poolAddress: string | PublicKey;
|
|
109
|
+
}): [PublicKey, number];
|
|
110
|
+
export declare function derivePoolCapitalClassPda(params: {
|
|
111
|
+
programId: string | PublicKey;
|
|
112
|
+
poolAddress: string | PublicKey;
|
|
113
|
+
shareMint: string | PublicKey;
|
|
114
|
+
}): [PublicKey, number];
|
|
115
|
+
export declare function derivePoolCompliancePolicyPda(params: {
|
|
116
|
+
programId: string | PublicKey;
|
|
117
|
+
poolAddress: string | PublicKey;
|
|
118
|
+
}): [PublicKey, number];
|
|
119
|
+
export declare function derivePoolControlAuthorityPda(params: {
|
|
120
|
+
programId: string | PublicKey;
|
|
121
|
+
poolAddress: string | PublicKey;
|
|
122
|
+
}): [PublicKey, number];
|
|
123
|
+
export declare function derivePoolAutomationPolicyPda(params: {
|
|
124
|
+
programId: string | PublicKey;
|
|
125
|
+
poolAddress: string | PublicKey;
|
|
126
|
+
}): [PublicKey, number];
|
|
104
127
|
export declare function derivePoolOraclePermissionSetPda(params: {
|
|
105
128
|
programId: string | PublicKey;
|
|
106
129
|
poolAddress: string | PublicKey;
|
|
@@ -109,12 +132,14 @@ export declare function derivePoolOraclePermissionSetPda(params: {
|
|
|
109
132
|
export declare function deriveMemberCyclePda(params: {
|
|
110
133
|
programId: string | PublicKey;
|
|
111
134
|
poolAddress: string | PublicKey;
|
|
135
|
+
seriesRefHash: Uint8Array;
|
|
112
136
|
member: string | PublicKey;
|
|
113
137
|
periodIndex: bigint | number;
|
|
114
138
|
}): [PublicKey, number];
|
|
115
139
|
export declare function deriveCycleQuoteReplayPda(params: {
|
|
116
140
|
programId: string | PublicKey;
|
|
117
141
|
poolAddress: string | PublicKey;
|
|
142
|
+
seriesRefHash: Uint8Array;
|
|
118
143
|
member: string | PublicKey;
|
|
119
144
|
nonceHash: Uint8Array;
|
|
120
145
|
}): [PublicKey, number];
|
|
@@ -123,6 +148,22 @@ export declare function derivePoolTreasuryReservePda(params: {
|
|
|
123
148
|
poolAddress: string | PublicKey;
|
|
124
149
|
paymentMint: string | PublicKey;
|
|
125
150
|
}): [PublicKey, number];
|
|
151
|
+
export declare function derivePoolShareMintPda(params: {
|
|
152
|
+
programId: string | PublicKey;
|
|
153
|
+
poolAddress: string | PublicKey;
|
|
154
|
+
}): [PublicKey, number];
|
|
155
|
+
export declare function deriveRedemptionRequestPda(params: {
|
|
156
|
+
programId: string | PublicKey;
|
|
157
|
+
poolAddress: string | PublicKey;
|
|
158
|
+
redeemer: string | PublicKey;
|
|
159
|
+
requestHash: Uint8Array;
|
|
160
|
+
}): [PublicKey, number];
|
|
161
|
+
export declare function deriveCohortSettlementRootPda(params: {
|
|
162
|
+
programId: string | PublicKey;
|
|
163
|
+
poolAddress: string | PublicKey;
|
|
164
|
+
seriesRefHash: Uint8Array;
|
|
165
|
+
cohortHash: Uint8Array;
|
|
166
|
+
}): [PublicKey, number];
|
|
126
167
|
export declare function deriveProtocolFeeVaultPda(params: {
|
|
127
168
|
programId: string | PublicKey;
|
|
128
169
|
paymentMint: string | PublicKey;
|
|
@@ -137,9 +178,14 @@ export declare function deriveSchemaPda(params: {
|
|
|
137
178
|
programId: string | PublicKey;
|
|
138
179
|
schemaKeyHash: Uint8Array;
|
|
139
180
|
}): [PublicKey, number];
|
|
181
|
+
export declare function deriveSchemaDependencyPda(params: {
|
|
182
|
+
programId: string | PublicKey;
|
|
183
|
+
schemaKeyHash: Uint8Array;
|
|
184
|
+
}): [PublicKey, number];
|
|
140
185
|
export declare function derivePoolRulePda(params: {
|
|
141
186
|
programId: string | PublicKey;
|
|
142
187
|
poolAddress: string | PublicKey;
|
|
188
|
+
seriesRefHash: Uint8Array;
|
|
143
189
|
ruleHash: Uint8Array;
|
|
144
190
|
}): [PublicKey, number];
|
|
145
191
|
export declare function deriveInviteIssuerPda(params: {
|
|
@@ -155,6 +201,7 @@ export declare function deriveEnrollmentReplayPda(params: {
|
|
|
155
201
|
export declare function deriveAttestationVotePda(params: {
|
|
156
202
|
programId: string | PublicKey;
|
|
157
203
|
poolAddress: string | PublicKey;
|
|
204
|
+
seriesRefHash: Uint8Array;
|
|
158
205
|
member: string | PublicKey;
|
|
159
206
|
cycleHash: Uint8Array;
|
|
160
207
|
ruleHash: Uint8Array;
|
|
@@ -165,49 +212,54 @@ export declare function deriveClaimDelegatePda(params: {
|
|
|
165
212
|
poolAddress: string | PublicKey;
|
|
166
213
|
member: string | PublicKey;
|
|
167
214
|
}): [PublicKey, number];
|
|
168
|
-
export declare function deriveClaimV2Pda(params: {
|
|
169
|
-
programId: string | PublicKey;
|
|
170
|
-
poolAddress: string | PublicKey;
|
|
171
|
-
member: string | PublicKey;
|
|
172
|
-
cycleHash: Uint8Array;
|
|
173
|
-
ruleHash: Uint8Array;
|
|
174
|
-
}): [PublicKey, number];
|
|
175
215
|
export declare function deriveOutcomeAggregatePda(params: {
|
|
176
216
|
programId: string | PublicKey;
|
|
177
217
|
poolAddress: string | PublicKey;
|
|
218
|
+
seriesRefHash: Uint8Array;
|
|
178
219
|
member: string | PublicKey;
|
|
179
220
|
cycleHash: Uint8Array;
|
|
180
221
|
ruleHash: Uint8Array;
|
|
181
222
|
}): [PublicKey, number];
|
|
182
|
-
export declare function
|
|
223
|
+
export declare function derivePolicyPositionPda(params: {
|
|
183
224
|
programId: string | PublicKey;
|
|
184
225
|
poolAddress: string | PublicKey;
|
|
226
|
+
seriesRefHash: Uint8Array;
|
|
185
227
|
member: string | PublicKey;
|
|
186
228
|
}): [PublicKey, number];
|
|
187
|
-
export declare function
|
|
229
|
+
export declare function derivePolicySeriesPda(params: {
|
|
188
230
|
programId: string | PublicKey;
|
|
189
231
|
poolAddress: string | PublicKey;
|
|
190
|
-
|
|
232
|
+
seriesRefHash: Uint8Array;
|
|
191
233
|
}): [PublicKey, number];
|
|
192
|
-
export declare function
|
|
234
|
+
export declare function derivePolicyPositionNftPda(params: {
|
|
193
235
|
programId: string | PublicKey;
|
|
194
236
|
poolAddress: string | PublicKey;
|
|
237
|
+
seriesRefHash: Uint8Array;
|
|
195
238
|
member: string | PublicKey;
|
|
196
239
|
}): [PublicKey, number];
|
|
197
240
|
export declare function derivePremiumLedgerPda(params: {
|
|
198
241
|
programId: string | PublicKey;
|
|
199
242
|
poolAddress: string | PublicKey;
|
|
243
|
+
seriesRefHash: Uint8Array;
|
|
200
244
|
member: string | PublicKey;
|
|
201
245
|
}): [PublicKey, number];
|
|
202
246
|
export declare function derivePremiumReplayPda(params: {
|
|
203
247
|
programId: string | PublicKey;
|
|
204
248
|
poolAddress: string | PublicKey;
|
|
249
|
+
seriesRefHash: Uint8Array;
|
|
205
250
|
member: string | PublicKey;
|
|
206
251
|
replayHash: Uint8Array;
|
|
207
252
|
}): [PublicKey, number];
|
|
253
|
+
export declare function derivePolicySeriesPaymentOptionPda(params: {
|
|
254
|
+
programId: string | PublicKey;
|
|
255
|
+
poolAddress: string | PublicKey;
|
|
256
|
+
seriesRefHash: Uint8Array;
|
|
257
|
+
paymentMint: string | PublicKey;
|
|
258
|
+
}): [PublicKey, number];
|
|
208
259
|
export declare function deriveCoverageClaimPda(params: {
|
|
209
260
|
programId: string | PublicKey;
|
|
210
261
|
poolAddress: string | PublicKey;
|
|
262
|
+
seriesRefHash: Uint8Array;
|
|
211
263
|
member: string | PublicKey;
|
|
212
264
|
intentHash: Uint8Array;
|
|
213
265
|
}): [PublicKey, number];
|
package/dist/protocol_seeds.js
CHANGED
|
@@ -6,31 +6,38 @@ export const SEED_ORACLE_PROFILE = 'oracle_profile';
|
|
|
6
6
|
export const SEED_POOL_ORACLE = 'pool_oracle';
|
|
7
7
|
export const SEED_MEMBERSHIP = 'membership';
|
|
8
8
|
export const SEED_CYCLE = 'cycle';
|
|
9
|
-
export const SEED_CYCLE_WINDOW = 'cycle_window';
|
|
10
|
-
export const SEED_REPLAY = 'replay';
|
|
11
9
|
export const SEED_CLAIM = 'claim';
|
|
12
|
-
export const SEED_CONFIG_V2 = 'config_v2';
|
|
13
10
|
export const SEED_ORACLE_STAKE = 'oracle_stake';
|
|
14
11
|
export const SEED_POOL_ORACLE_POLICY = 'pool_oracle_policy';
|
|
15
12
|
export const SEED_POOL_TERMS = 'pool_terms';
|
|
16
13
|
export const SEED_POOL_ASSET_VAULT = 'pool_asset_vault';
|
|
14
|
+
export const SEED_POOL_RISK_CONFIG = 'pool_risk_config';
|
|
15
|
+
export const SEED_POOL_CAPITAL_CLASS = 'pool_capital_class';
|
|
16
|
+
export const SEED_POLICY_SERIES = 'policy_series';
|
|
17
|
+
export const SEED_POLICY_SERIES_PAYMENT_OPTION = 'policy_series_payment_option';
|
|
18
|
+
export const SEED_POLICY_POSITION = 'policy_position';
|
|
19
|
+
export const SEED_POLICY_POSITION_NFT = 'policy_position_nft';
|
|
20
|
+
export const SEED_POOL_COMPLIANCE_POLICY = 'pool_compliance_policy';
|
|
21
|
+
export const SEED_POOL_CONTROL_AUTHORITY = 'pool_control_authority';
|
|
22
|
+
export const SEED_POOL_AUTOMATION_POLICY = 'pool_automation_policy';
|
|
23
|
+
export const SEED_POOL_LIQUIDITY_CONFIG = 'pool_liquidity_config';
|
|
17
24
|
export const SEED_POOL_ORACLE_PERMISSIONS = 'pool_oracle_permissions';
|
|
18
25
|
export const SEED_MEMBER_CYCLE = 'member_cycle';
|
|
19
26
|
export const SEED_CYCLE_QUOTE_REPLAY = 'cycle_quote_replay';
|
|
20
27
|
export const SEED_POOL_TREASURY_RESERVE = 'pool_treasury_reserve';
|
|
28
|
+
export const SEED_POOL_SHARE_MINT = 'pool_share_mint';
|
|
29
|
+
export const SEED_REDEMPTION_REQUEST = 'redemption_request';
|
|
30
|
+
export const SEED_COHORT_SETTLEMENT_ROOT = 'cohort_settlement_root';
|
|
21
31
|
export const SEED_PROTOCOL_FEE_VAULT = 'protocol_fee_vault';
|
|
22
32
|
export const SEED_POOL_ORACLE_FEE_VAULT = 'pool_oracle_fee_vault';
|
|
23
33
|
export const SEED_SCHEMA = 'schema';
|
|
34
|
+
export const SEED_SCHEMA_DEPENDENCY = 'schema_dependency';
|
|
24
35
|
export const SEED_POOL_RULE = 'pool_rule';
|
|
25
36
|
export const SEED_INVITE_ISSUER = 'invite_issuer';
|
|
26
37
|
export const SEED_ENROLLMENT_REPLAY = 'enrollment_replay';
|
|
27
38
|
export const SEED_ATTESTATION_VOTE = 'attestation_vote';
|
|
28
39
|
export const SEED_OUTCOME_AGGREGATE = 'outcome_agg';
|
|
29
40
|
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
41
|
export const SEED_PREMIUM_LEDGER = 'premium_ledger';
|
|
35
42
|
export const SEED_PREMIUM_REPLAY = 'premium_replay';
|
|
36
43
|
export const SEED_COVERAGE_CLAIM = 'coverage_claim';
|
|
@@ -85,35 +92,25 @@ export function deriveCycleOutcomePda(params) {
|
|
|
85
92
|
Buffer.from(params.cycleHash),
|
|
86
93
|
], program);
|
|
87
94
|
}
|
|
88
|
-
export function deriveCycleWindowPda(params) {
|
|
89
|
-
const program = asPubkey(params.programId);
|
|
90
|
-
const pool = asPubkey(params.poolAddress);
|
|
91
|
-
return PublicKey.findProgramAddressSync([
|
|
92
|
-
Buffer.from(SEED_CYCLE_WINDOW),
|
|
93
|
-
pool.toBuffer(),
|
|
94
|
-
Buffer.from(params.cycleHash),
|
|
95
|
-
], program);
|
|
96
|
-
}
|
|
97
|
-
export function deriveReplayPda(params) {
|
|
98
|
-
const program = asPubkey(params.programId);
|
|
99
|
-
const pool = asPubkey(params.poolAddress);
|
|
100
|
-
return PublicKey.findProgramAddressSync([Buffer.from(SEED_REPLAY), pool.toBuffer(), Buffer.from(params.replayHash)], program);
|
|
101
|
-
}
|
|
102
95
|
export function deriveClaimPda(params) {
|
|
96
|
+
if (params.seriesRefHash.length !== 32) {
|
|
97
|
+
throw new Error('seriesRefHash must be exactly 32 bytes');
|
|
98
|
+
}
|
|
99
|
+
if (params.ruleHash.length !== 32) {
|
|
100
|
+
throw new Error('ruleHash must be exactly 32 bytes');
|
|
101
|
+
}
|
|
103
102
|
const program = asPubkey(params.programId);
|
|
104
103
|
const pool = asPubkey(params.poolAddress);
|
|
105
104
|
const member = asPubkey(params.member);
|
|
106
105
|
return PublicKey.findProgramAddressSync([
|
|
107
106
|
Buffer.from(SEED_CLAIM),
|
|
108
107
|
pool.toBuffer(),
|
|
108
|
+
Buffer.from(params.seriesRefHash),
|
|
109
109
|
member.toBuffer(),
|
|
110
110
|
Buffer.from(params.cycleHash),
|
|
111
|
+
Buffer.from(params.ruleHash),
|
|
111
112
|
], program);
|
|
112
113
|
}
|
|
113
|
-
export function deriveConfigV2Pda(programId) {
|
|
114
|
-
const program = asPubkey(programId);
|
|
115
|
-
return PublicKey.findProgramAddressSync([Buffer.from(SEED_CONFIG_V2)], program);
|
|
116
|
-
}
|
|
117
114
|
export function deriveOracleStakePda(params) {
|
|
118
115
|
const program = asPubkey(params.programId);
|
|
119
116
|
const oracle = asPubkey(params.oracle);
|
|
@@ -136,6 +133,37 @@ export function derivePoolAssetVaultPda(params) {
|
|
|
136
133
|
const mint = asPubkey(params.payoutMint);
|
|
137
134
|
return PublicKey.findProgramAddressSync([Buffer.from(SEED_POOL_ASSET_VAULT), pool.toBuffer(), mint.toBuffer()], program);
|
|
138
135
|
}
|
|
136
|
+
export function derivePoolRiskConfigPda(params) {
|
|
137
|
+
const program = asPubkey(params.programId);
|
|
138
|
+
const pool = asPubkey(params.poolAddress);
|
|
139
|
+
return PublicKey.findProgramAddressSync([Buffer.from(SEED_POOL_RISK_CONFIG), pool.toBuffer()], program);
|
|
140
|
+
}
|
|
141
|
+
export function derivePoolLiquidityConfigPda(params) {
|
|
142
|
+
const program = asPubkey(params.programId);
|
|
143
|
+
const pool = asPubkey(params.poolAddress);
|
|
144
|
+
return PublicKey.findProgramAddressSync([Buffer.from(SEED_POOL_LIQUIDITY_CONFIG), pool.toBuffer()], program);
|
|
145
|
+
}
|
|
146
|
+
export function derivePoolCapitalClassPda(params) {
|
|
147
|
+
const program = asPubkey(params.programId);
|
|
148
|
+
const pool = asPubkey(params.poolAddress);
|
|
149
|
+
const shareMint = asPubkey(params.shareMint);
|
|
150
|
+
return PublicKey.findProgramAddressSync([Buffer.from(SEED_POOL_CAPITAL_CLASS), pool.toBuffer(), shareMint.toBuffer()], program);
|
|
151
|
+
}
|
|
152
|
+
export function derivePoolCompliancePolicyPda(params) {
|
|
153
|
+
const program = asPubkey(params.programId);
|
|
154
|
+
const pool = asPubkey(params.poolAddress);
|
|
155
|
+
return PublicKey.findProgramAddressSync([Buffer.from(SEED_POOL_COMPLIANCE_POLICY), pool.toBuffer()], program);
|
|
156
|
+
}
|
|
157
|
+
export function derivePoolControlAuthorityPda(params) {
|
|
158
|
+
const program = asPubkey(params.programId);
|
|
159
|
+
const pool = asPubkey(params.poolAddress);
|
|
160
|
+
return PublicKey.findProgramAddressSync([Buffer.from(SEED_POOL_CONTROL_AUTHORITY), pool.toBuffer()], program);
|
|
161
|
+
}
|
|
162
|
+
export function derivePoolAutomationPolicyPda(params) {
|
|
163
|
+
const program = asPubkey(params.programId);
|
|
164
|
+
const pool = asPubkey(params.poolAddress);
|
|
165
|
+
return PublicKey.findProgramAddressSync([Buffer.from(SEED_POOL_AUTOMATION_POLICY), pool.toBuffer()], program);
|
|
166
|
+
}
|
|
139
167
|
function encodeU64Seed(value) {
|
|
140
168
|
const out = Buffer.alloc(8);
|
|
141
169
|
out.writeBigUInt64LE(typeof value === 'bigint' ? value : BigInt(value));
|
|
@@ -148,23 +176,31 @@ export function derivePoolOraclePermissionSetPda(params) {
|
|
|
148
176
|
return PublicKey.findProgramAddressSync([Buffer.from(SEED_POOL_ORACLE_PERMISSIONS), pool.toBuffer(), oracle.toBuffer()], program);
|
|
149
177
|
}
|
|
150
178
|
export function deriveMemberCyclePda(params) {
|
|
179
|
+
if (params.seriesRefHash.length !== 32) {
|
|
180
|
+
throw new Error('seriesRefHash must be exactly 32 bytes');
|
|
181
|
+
}
|
|
151
182
|
const program = asPubkey(params.programId);
|
|
152
183
|
const pool = asPubkey(params.poolAddress);
|
|
153
184
|
const member = asPubkey(params.member);
|
|
154
185
|
return PublicKey.findProgramAddressSync([
|
|
155
186
|
Buffer.from(SEED_MEMBER_CYCLE),
|
|
156
187
|
pool.toBuffer(),
|
|
188
|
+
Buffer.from(params.seriesRefHash),
|
|
157
189
|
member.toBuffer(),
|
|
158
190
|
encodeU64Seed(params.periodIndex),
|
|
159
191
|
], program);
|
|
160
192
|
}
|
|
161
193
|
export function deriveCycleQuoteReplayPda(params) {
|
|
194
|
+
if (params.seriesRefHash.length !== 32) {
|
|
195
|
+
throw new Error('seriesRefHash must be exactly 32 bytes');
|
|
196
|
+
}
|
|
162
197
|
const program = asPubkey(params.programId);
|
|
163
198
|
const pool = asPubkey(params.poolAddress);
|
|
164
199
|
const member = asPubkey(params.member);
|
|
165
200
|
return PublicKey.findProgramAddressSync([
|
|
166
201
|
Buffer.from(SEED_CYCLE_QUOTE_REPLAY),
|
|
167
202
|
pool.toBuffer(),
|
|
203
|
+
Buffer.from(params.seriesRefHash),
|
|
168
204
|
member.toBuffer(),
|
|
169
205
|
Buffer.from(params.nonceHash),
|
|
170
206
|
], program);
|
|
@@ -179,6 +215,38 @@ export function derivePoolTreasuryReservePda(params) {
|
|
|
179
215
|
paymentMint.toBuffer(),
|
|
180
216
|
], program);
|
|
181
217
|
}
|
|
218
|
+
export function derivePoolShareMintPda(params) {
|
|
219
|
+
const program = asPubkey(params.programId);
|
|
220
|
+
const pool = asPubkey(params.poolAddress);
|
|
221
|
+
return PublicKey.findProgramAddressSync([Buffer.from(SEED_POOL_SHARE_MINT), pool.toBuffer()], program);
|
|
222
|
+
}
|
|
223
|
+
export function deriveRedemptionRequestPda(params) {
|
|
224
|
+
if (params.requestHash.length !== 32) {
|
|
225
|
+
throw new Error('requestHash must be exactly 32 bytes');
|
|
226
|
+
}
|
|
227
|
+
const program = asPubkey(params.programId);
|
|
228
|
+
const pool = asPubkey(params.poolAddress);
|
|
229
|
+
const redeemer = asPubkey(params.redeemer);
|
|
230
|
+
return PublicKey.findProgramAddressSync([
|
|
231
|
+
Buffer.from(SEED_REDEMPTION_REQUEST),
|
|
232
|
+
pool.toBuffer(),
|
|
233
|
+
redeemer.toBuffer(),
|
|
234
|
+
Buffer.from(params.requestHash),
|
|
235
|
+
], program);
|
|
236
|
+
}
|
|
237
|
+
export function deriveCohortSettlementRootPda(params) {
|
|
238
|
+
if (params.seriesRefHash.length !== 32) {
|
|
239
|
+
throw new Error('seriesRefHash must be exactly 32 bytes');
|
|
240
|
+
}
|
|
241
|
+
const program = asPubkey(params.programId);
|
|
242
|
+
const pool = asPubkey(params.poolAddress);
|
|
243
|
+
return PublicKey.findProgramAddressSync([
|
|
244
|
+
Buffer.from(SEED_COHORT_SETTLEMENT_ROOT),
|
|
245
|
+
pool.toBuffer(),
|
|
246
|
+
Buffer.from(params.seriesRefHash),
|
|
247
|
+
Buffer.from(params.cohortHash),
|
|
248
|
+
], program);
|
|
249
|
+
}
|
|
182
250
|
export function deriveProtocolFeeVaultPda(params) {
|
|
183
251
|
const program = asPubkey(params.programId);
|
|
184
252
|
const paymentMint = asPubkey(params.paymentMint);
|
|
@@ -200,10 +268,28 @@ export function deriveSchemaPda(params) {
|
|
|
200
268
|
const program = asPubkey(params.programId);
|
|
201
269
|
return PublicKey.findProgramAddressSync([Buffer.from(SEED_SCHEMA), Buffer.from(params.schemaKeyHash)], program);
|
|
202
270
|
}
|
|
271
|
+
export function deriveSchemaDependencyPda(params) {
|
|
272
|
+
if (params.schemaKeyHash.length !== 32) {
|
|
273
|
+
throw new Error('schemaKeyHash must be 32 bytes');
|
|
274
|
+
}
|
|
275
|
+
const program = asPubkey(params.programId);
|
|
276
|
+
return PublicKey.findProgramAddressSync([Buffer.from(SEED_SCHEMA_DEPENDENCY), Buffer.from(params.schemaKeyHash)], program);
|
|
277
|
+
}
|
|
203
278
|
export function derivePoolRulePda(params) {
|
|
279
|
+
if (params.seriesRefHash.length !== 32) {
|
|
280
|
+
throw new Error('seriesRefHash must be exactly 32 bytes');
|
|
281
|
+
}
|
|
282
|
+
if (params.ruleHash.length !== 32) {
|
|
283
|
+
throw new Error('ruleHash must be exactly 32 bytes');
|
|
284
|
+
}
|
|
204
285
|
const program = asPubkey(params.programId);
|
|
205
286
|
const pool = asPubkey(params.poolAddress);
|
|
206
|
-
return PublicKey.findProgramAddressSync([
|
|
287
|
+
return PublicKey.findProgramAddressSync([
|
|
288
|
+
Buffer.from(SEED_POOL_RULE),
|
|
289
|
+
pool.toBuffer(),
|
|
290
|
+
Buffer.from(params.seriesRefHash),
|
|
291
|
+
Buffer.from(params.ruleHash),
|
|
292
|
+
], program);
|
|
207
293
|
}
|
|
208
294
|
export function deriveInviteIssuerPda(params) {
|
|
209
295
|
const program = asPubkey(params.programId);
|
|
@@ -222,6 +308,9 @@ export function deriveEnrollmentReplayPda(params) {
|
|
|
222
308
|
], program);
|
|
223
309
|
}
|
|
224
310
|
export function deriveAttestationVotePda(params) {
|
|
311
|
+
if (params.seriesRefHash.length !== 32) {
|
|
312
|
+
throw new Error('seriesRefHash must be exactly 32 bytes');
|
|
313
|
+
}
|
|
225
314
|
const program = asPubkey(params.programId);
|
|
226
315
|
const pool = asPubkey(params.poolAddress);
|
|
227
316
|
const member = asPubkey(params.member);
|
|
@@ -229,6 +318,7 @@ export function deriveAttestationVotePda(params) {
|
|
|
229
318
|
return PublicKey.findProgramAddressSync([
|
|
230
319
|
Buffer.from(SEED_ATTESTATION_VOTE),
|
|
231
320
|
pool.toBuffer(),
|
|
321
|
+
Buffer.from(params.seriesRefHash),
|
|
232
322
|
member.toBuffer(),
|
|
233
323
|
Buffer.from(params.cycleHash),
|
|
234
324
|
Buffer.from(params.ruleHash),
|
|
@@ -241,71 +331,112 @@ export function deriveClaimDelegatePda(params) {
|
|
|
241
331
|
const member = asPubkey(params.member);
|
|
242
332
|
return PublicKey.findProgramAddressSync([Buffer.from(SEED_CLAIM_DELEGATE), pool.toBuffer(), member.toBuffer()], program);
|
|
243
333
|
}
|
|
244
|
-
export function
|
|
334
|
+
export function deriveOutcomeAggregatePda(params) {
|
|
335
|
+
if (params.seriesRefHash.length !== 32) {
|
|
336
|
+
throw new Error('seriesRefHash must be exactly 32 bytes');
|
|
337
|
+
}
|
|
245
338
|
const program = asPubkey(params.programId);
|
|
246
339
|
const pool = asPubkey(params.poolAddress);
|
|
247
340
|
const member = asPubkey(params.member);
|
|
248
341
|
return PublicKey.findProgramAddressSync([
|
|
249
|
-
Buffer.from(
|
|
342
|
+
Buffer.from(SEED_OUTCOME_AGGREGATE),
|
|
250
343
|
pool.toBuffer(),
|
|
344
|
+
Buffer.from(params.seriesRefHash),
|
|
251
345
|
member.toBuffer(),
|
|
252
346
|
Buffer.from(params.cycleHash),
|
|
253
347
|
Buffer.from(params.ruleHash),
|
|
254
348
|
], program);
|
|
255
349
|
}
|
|
256
|
-
export function
|
|
350
|
+
export function derivePolicyPositionPda(params) {
|
|
351
|
+
if (params.seriesRefHash.length !== 32) {
|
|
352
|
+
throw new Error('seriesRefHash must be exactly 32 bytes');
|
|
353
|
+
}
|
|
257
354
|
const program = asPubkey(params.programId);
|
|
258
355
|
const pool = asPubkey(params.poolAddress);
|
|
259
356
|
const member = asPubkey(params.member);
|
|
260
357
|
return PublicKey.findProgramAddressSync([
|
|
261
|
-
Buffer.from(
|
|
358
|
+
Buffer.from(SEED_POLICY_POSITION),
|
|
262
359
|
pool.toBuffer(),
|
|
360
|
+
Buffer.from(params.seriesRefHash),
|
|
263
361
|
member.toBuffer(),
|
|
264
|
-
Buffer.from(params.cycleHash),
|
|
265
|
-
Buffer.from(params.ruleHash),
|
|
266
362
|
], program);
|
|
267
363
|
}
|
|
268
|
-
export function
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
return PublicKey.findProgramAddressSync([Buffer.from(SEED_COVERAGE_POLICY), pool.toBuffer(), member.toBuffer()], program);
|
|
273
|
-
}
|
|
274
|
-
export function deriveCoverageProductPda(params) {
|
|
364
|
+
export function derivePolicySeriesPda(params) {
|
|
365
|
+
if (params.seriesRefHash.length !== 32) {
|
|
366
|
+
throw new Error('seriesRefHash must be exactly 32 bytes');
|
|
367
|
+
}
|
|
275
368
|
const program = asPubkey(params.programId);
|
|
276
369
|
const pool = asPubkey(params.poolAddress);
|
|
277
|
-
return PublicKey.findProgramAddressSync([Buffer.from(
|
|
370
|
+
return PublicKey.findProgramAddressSync([Buffer.from(SEED_POLICY_SERIES), pool.toBuffer(), Buffer.from(params.seriesRefHash)], program);
|
|
278
371
|
}
|
|
279
|
-
export function
|
|
372
|
+
export function derivePolicyPositionNftPda(params) {
|
|
373
|
+
if (params.seriesRefHash.length !== 32) {
|
|
374
|
+
throw new Error('seriesRefHash must be exactly 32 bytes');
|
|
375
|
+
}
|
|
280
376
|
const program = asPubkey(params.programId);
|
|
281
377
|
const pool = asPubkey(params.poolAddress);
|
|
282
378
|
const member = asPubkey(params.member);
|
|
283
|
-
return PublicKey.findProgramAddressSync([
|
|
379
|
+
return PublicKey.findProgramAddressSync([
|
|
380
|
+
Buffer.from(SEED_POLICY_POSITION_NFT),
|
|
381
|
+
pool.toBuffer(),
|
|
382
|
+
Buffer.from(params.seriesRefHash),
|
|
383
|
+
member.toBuffer(),
|
|
384
|
+
], program);
|
|
284
385
|
}
|
|
285
386
|
export function derivePremiumLedgerPda(params) {
|
|
387
|
+
if (params.seriesRefHash.length !== 32) {
|
|
388
|
+
throw new Error('seriesRefHash must be exactly 32 bytes');
|
|
389
|
+
}
|
|
286
390
|
const program = asPubkey(params.programId);
|
|
287
391
|
const pool = asPubkey(params.poolAddress);
|
|
288
392
|
const member = asPubkey(params.member);
|
|
289
|
-
return PublicKey.findProgramAddressSync([
|
|
393
|
+
return PublicKey.findProgramAddressSync([
|
|
394
|
+
Buffer.from(SEED_PREMIUM_LEDGER),
|
|
395
|
+
pool.toBuffer(),
|
|
396
|
+
Buffer.from(params.seriesRefHash),
|
|
397
|
+
member.toBuffer(),
|
|
398
|
+
], program);
|
|
290
399
|
}
|
|
291
400
|
export function derivePremiumReplayPda(params) {
|
|
401
|
+
if (params.seriesRefHash.length !== 32) {
|
|
402
|
+
throw new Error('seriesRefHash must be exactly 32 bytes');
|
|
403
|
+
}
|
|
292
404
|
const program = asPubkey(params.programId);
|
|
293
405
|
const pool = asPubkey(params.poolAddress);
|
|
294
406
|
const member = asPubkey(params.member);
|
|
295
407
|
return PublicKey.findProgramAddressSync([
|
|
296
408
|
Buffer.from(SEED_PREMIUM_REPLAY),
|
|
297
409
|
pool.toBuffer(),
|
|
410
|
+
Buffer.from(params.seriesRefHash),
|
|
298
411
|
member.toBuffer(),
|
|
299
412
|
Buffer.from(params.replayHash),
|
|
300
413
|
], program);
|
|
301
414
|
}
|
|
415
|
+
export function derivePolicySeriesPaymentOptionPda(params) {
|
|
416
|
+
if (params.seriesRefHash.length !== 32) {
|
|
417
|
+
throw new Error('seriesRefHash must be exactly 32 bytes');
|
|
418
|
+
}
|
|
419
|
+
const program = asPubkey(params.programId);
|
|
420
|
+
const pool = asPubkey(params.poolAddress);
|
|
421
|
+
const paymentMint = asPubkey(params.paymentMint);
|
|
422
|
+
return PublicKey.findProgramAddressSync([
|
|
423
|
+
Buffer.from(SEED_POLICY_SERIES_PAYMENT_OPTION),
|
|
424
|
+
pool.toBuffer(),
|
|
425
|
+
Buffer.from(params.seriesRefHash),
|
|
426
|
+
paymentMint.toBuffer(),
|
|
427
|
+
], program);
|
|
428
|
+
}
|
|
302
429
|
export function deriveCoverageClaimPda(params) {
|
|
430
|
+
if (params.seriesRefHash.length !== 32) {
|
|
431
|
+
throw new Error('seriesRefHash must be exactly 32 bytes');
|
|
432
|
+
}
|
|
303
433
|
const program = asPubkey(params.programId);
|
|
304
434
|
const pool = asPubkey(params.poolAddress);
|
|
305
435
|
const member = asPubkey(params.member);
|
|
306
436
|
return PublicKey.findProgramAddressSync([
|
|
307
437
|
Buffer.from(SEED_COVERAGE_CLAIM),
|
|
308
438
|
pool.toBuffer(),
|
|
439
|
+
Buffer.from(params.seriesRefHash),
|
|
309
440
|
member.toBuffer(),
|
|
310
441
|
Buffer.from(params.intentHash),
|
|
311
442
|
], program);
|