@provable-games/metagame-sdk 0.1.1 → 0.1.2
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/index.cjs +0 -67
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -35
- package/dist/index.d.ts +24 -35
- package/dist/index.js +1 -66
- package/dist/index.js.map +1 -1
- package/dist/{prizeAggregation-CBHLCs6D.d.cts → prizeAggregation-CHwIJzXr.d.cts} +1 -7
- package/dist/{prizeAggregation-CBHLCs6D.d.ts → prizeAggregation-CHwIJzXr.d.ts} +1 -7
- package/dist/react.cjs +0 -67
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +3 -8
- package/dist/react.d.ts +3 -8
- package/dist/react.js +0 -67
- package/dist/react.js.map +1 -1
- package/package.json +10 -10
package/dist/index.d.cts
CHANGED
|
@@ -1,18 +1,31 @@
|
|
|
1
|
-
import { P as Prize, S as StatusTimestamps, a as StatusResult, E as ExtensionAddresses, Q as QualifyingModeInfo, b as ExtensionType, c as ERC20BalanceValidatorConfig, T as TournamentValidatorConfig, O as OpusTrovesValidatorConfig, d as SnapshotValidatorConfig, Z as ZkPassportValidatorConfig, G as GovernanceValidatorConfig, e as QualificationResult, f as EntryRequirementVariant, g as QualificationProof } from './prizeAggregation-
|
|
2
|
-
export { D as DistributionType, h as EntryFeeBreakdown, i as EntryFeeExtensionConfig, j as EntryFeeShares, k as ExtensionCategory, l as Participant, m as PositionPrizeGroup, n as PrizeExtensionConfig, o as QualificationEntry, p as QualifyingMode, q as SponsorContribution, r as StatusVariant, s as Token, t as aggregatePrizesByPosition, u as aggregatePrizesBySponsor, v as calculateDistribution, w as calculateEntryFeeBreakdown, x as calculatePayouts, y as distributePool, z as filterClaimablePrizes, A as filterZeroPrizes, B as formatNumber, C as formatPrizeAmount, F as formatScore, H as formatTime, I as formatUsdValue, J as getOrdinalSuffix } from './prizeAggregation-
|
|
1
|
+
import { P as Prize, S as StatusTimestamps, a as StatusResult, E as ExtensionAddresses, Q as QualifyingModeInfo, b as ExtensionType, c as ERC20BalanceValidatorConfig, T as TournamentValidatorConfig, O as OpusTrovesValidatorConfig, d as SnapshotValidatorConfig, Z as ZkPassportValidatorConfig, G as GovernanceValidatorConfig, e as QualificationResult, f as EntryRequirementVariant, g as QualificationProof } from './prizeAggregation-CHwIJzXr.cjs';
|
|
2
|
+
export { D as DistributionType, h as EntryFeeBreakdown, i as EntryFeeExtensionConfig, j as EntryFeeShares, k as ExtensionCategory, l as Participant, m as PositionPrizeGroup, n as PrizeExtensionConfig, o as QualificationEntry, p as QualifyingMode, q as SponsorContribution, r as StatusVariant, s as Token, t as aggregatePrizesByPosition, u as aggregatePrizesBySponsor, v as calculateDistribution, w as calculateEntryFeeBreakdown, x as calculatePayouts, y as distributePool, z as filterClaimablePrizes, A as filterZeroPrizes, B as formatNumber, C as formatPrizeAmount, F as formatScore, H as formatTime, I as formatUsdValue, J as getOrdinalSuffix } from './prizeAggregation-CHwIJzXr.cjs';
|
|
3
3
|
import { CairoOption, CairoCustomEnum } from 'starknet';
|
|
4
4
|
|
|
5
5
|
interface EntryFee {
|
|
6
6
|
tokenAddress: string;
|
|
7
7
|
amount: string;
|
|
8
|
-
|
|
8
|
+
tournamentCreatorShare?: number;
|
|
9
|
+
gameCreatorShare?: number;
|
|
9
10
|
refundShare?: number;
|
|
11
|
+
distribution?: Distribution | null;
|
|
12
|
+
distributionCount?: number;
|
|
10
13
|
}
|
|
11
14
|
interface EntryRequirement {
|
|
12
|
-
requirementType:
|
|
15
|
+
requirementType: "token" | "extension";
|
|
13
16
|
tokenAddress?: string;
|
|
14
17
|
entryLimit?: number;
|
|
18
|
+
extensionConfig?: Record<string, unknown>;
|
|
15
19
|
}
|
|
20
|
+
type Distribution = {
|
|
21
|
+
Linear: number;
|
|
22
|
+
} | {
|
|
23
|
+
Exponential: number;
|
|
24
|
+
} | {
|
|
25
|
+
Uniform: Record<string, never>;
|
|
26
|
+
} | {
|
|
27
|
+
Custom: [number, ...number[]];
|
|
28
|
+
};
|
|
16
29
|
|
|
17
30
|
declare function indexAddress(address: string): string;
|
|
18
31
|
declare function padAddress(address: string): string;
|
|
@@ -198,7 +211,7 @@ declare function formatCashToUSD(value: bigint): string;
|
|
|
198
211
|
* their own SDK, then passes it here for evaluation.
|
|
199
212
|
*
|
|
200
213
|
* The evaluation logic is the same across metagames because the entry
|
|
201
|
-
* requirement system (token gating,
|
|
214
|
+
* requirement system (token gating, extensions) is shared.
|
|
202
215
|
*/
|
|
203
216
|
|
|
204
217
|
interface TokenQualificationInput {
|
|
@@ -217,20 +230,6 @@ interface TokenQualificationInput {
|
|
|
217
230
|
* as the best proof.
|
|
218
231
|
*/
|
|
219
232
|
declare function evaluateTokenQualification(input: TokenQualificationInput): QualificationResult;
|
|
220
|
-
interface AllowlistQualificationInput {
|
|
221
|
-
/** The player's address */
|
|
222
|
-
playerAddress: string;
|
|
223
|
-
/** Addresses on the allowlist */
|
|
224
|
-
allowlist: string[];
|
|
225
|
-
/** How many times this address has already entered */
|
|
226
|
-
currentEntryCount: number;
|
|
227
|
-
/** Max entries per address (0 = unlimited) */
|
|
228
|
-
entryLimit: number;
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* Evaluate allowlist-based entry qualification.
|
|
232
|
-
*/
|
|
233
|
-
declare function evaluateAllowlistQualification(input: AllowlistQualificationInput): QualificationResult;
|
|
234
233
|
interface ExtensionQualificationInput {
|
|
235
234
|
/** Results from checking each qualification method against the extension contract */
|
|
236
235
|
checkedQualifications: Array<{
|
|
@@ -258,9 +257,6 @@ declare function evaluateExtensionQualification(input: ExtensionQualificationInp
|
|
|
258
257
|
declare function evaluateQualification(variant: EntryRequirementVariant, input: {
|
|
259
258
|
type: "token";
|
|
260
259
|
data: TokenQualificationInput;
|
|
261
|
-
} | {
|
|
262
|
-
type: "allowlist";
|
|
263
|
-
data: AllowlistQualificationInput;
|
|
264
260
|
} | {
|
|
265
261
|
type: "extension";
|
|
266
262
|
data: ExtensionQualificationInput;
|
|
@@ -275,15 +271,13 @@ declare function evaluateQualification(variant: EntryRequirementVariant, input:
|
|
|
275
271
|
* an event. The proof format matches the Cairo `QualificationProof` enum:
|
|
276
272
|
*
|
|
277
273
|
* enum QualificationProof {
|
|
278
|
-
*
|
|
279
|
-
*
|
|
280
|
-
* Address: ContractAddress,
|
|
281
|
-
* Extension: Array<felt252>,
|
|
274
|
+
* NFT: NFTQualification, // { token_id: u256 }
|
|
275
|
+
* Extension: Span<felt252>,
|
|
282
276
|
* }
|
|
283
277
|
*
|
|
284
|
-
*
|
|
285
|
-
*
|
|
286
|
-
*
|
|
278
|
+
* Extension-specific data (tournament IDs, positions, addresses, etc.)
|
|
279
|
+
* is encoded into the `Extension` variant's felt252 array by the
|
|
280
|
+
* extension's own logic.
|
|
287
281
|
*/
|
|
288
282
|
|
|
289
283
|
/**
|
|
@@ -301,11 +295,6 @@ declare function buildQualificationProof(proof: QualificationProof | null): Cair
|
|
|
301
295
|
* Used when entry requires holding a specific NFT collection.
|
|
302
296
|
*/
|
|
303
297
|
declare function buildNFTProof(tokenId: string): CairoOption<CairoCustomEnum>;
|
|
304
|
-
/**
|
|
305
|
-
* Build an address/allowlist proof.
|
|
306
|
-
* Used when entry is gated by an address allowlist.
|
|
307
|
-
*/
|
|
308
|
-
declare function buildAddressProof(address: string): CairoOption<CairoCustomEnum>;
|
|
309
298
|
/**
|
|
310
299
|
* Build a tournament validator extension proof.
|
|
311
300
|
* Used when entry requires participation/winning in a prior tournament.
|
|
@@ -497,4 +486,4 @@ declare function calculateTotalPrizeValueUSD(prizes: Prize[], prices: TokenPrice
|
|
|
497
486
|
*/
|
|
498
487
|
declare function calculatePaidPlaces(sponsoredPrizes: Prize[], entryFeeDistributionCount: number): number;
|
|
499
488
|
|
|
500
|
-
export { type
|
|
489
|
+
export { type Distribution, ERC20BalanceValidatorConfig, type EntryFee, type EntryFeeConfig, type EntryRequirement, EntryRequirementVariant, ExtensionAddresses, type ExtensionQualificationInput, ExtensionType, GovernanceValidatorConfig, type GroupedTokenPrize, type NftParseResult, type NftPrizeInput, OpusTrovesValidatorConfig, Prize, QualificationProof, QualificationResult, QualifyingModeInfo, SnapshotValidatorConfig, StatusResult, StatusTimestamps, type TokenDecimalsLookup, type TokenPriceLookup, type TokenQualificationInput, type TournamentLeaderboard, type TournamentQualificationInput, type TournamentRegistration, TournamentValidatorConfig, ZkPassportValidatorConfig, bigintToHex, buildEntryFeePrizes, buildExtensionProof, buildNFTProof, buildParticipationMap, buildQualificationProof, buildTournamentExtensionProof, buildWinMap, calculateOpusTrovesEntries, calculatePaidPlaces, calculatePrizeValue, calculateTotalPrizeValueUSD, computeStatus, displayAddress, evaluateExtensionQualification, evaluateQualification, evaluateTokenQualification, findAllBannableEntries, findBannableEntries, formatCashToUSD, formatTokenAmount, getExtensionAddresses, getOpusSupportedAssets, getQualifyingModeInfo, getWhitelistedExtensionAddresses, groupPrizesByToken, identifyExtensionType, indexAddress, isBefore, isWhitelistedExtension, padAddress, parseERC20BalanceValidatorConfig, parseExtensionConfig, parseGovernanceValidatorConfig, parseNFTBulkInput, parseOpusTrovesValidatorConfig, parseSnapshotValidatorConfig, parseTournamentValidatorConfig, parseZkPassportValidatorConfig, resolveTournamentQualifications };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,31 @@
|
|
|
1
|
-
import { P as Prize, S as StatusTimestamps, a as StatusResult, E as ExtensionAddresses, Q as QualifyingModeInfo, b as ExtensionType, c as ERC20BalanceValidatorConfig, T as TournamentValidatorConfig, O as OpusTrovesValidatorConfig, d as SnapshotValidatorConfig, Z as ZkPassportValidatorConfig, G as GovernanceValidatorConfig, e as QualificationResult, f as EntryRequirementVariant, g as QualificationProof } from './prizeAggregation-
|
|
2
|
-
export { D as DistributionType, h as EntryFeeBreakdown, i as EntryFeeExtensionConfig, j as EntryFeeShares, k as ExtensionCategory, l as Participant, m as PositionPrizeGroup, n as PrizeExtensionConfig, o as QualificationEntry, p as QualifyingMode, q as SponsorContribution, r as StatusVariant, s as Token, t as aggregatePrizesByPosition, u as aggregatePrizesBySponsor, v as calculateDistribution, w as calculateEntryFeeBreakdown, x as calculatePayouts, y as distributePool, z as filterClaimablePrizes, A as filterZeroPrizes, B as formatNumber, C as formatPrizeAmount, F as formatScore, H as formatTime, I as formatUsdValue, J as getOrdinalSuffix } from './prizeAggregation-
|
|
1
|
+
import { P as Prize, S as StatusTimestamps, a as StatusResult, E as ExtensionAddresses, Q as QualifyingModeInfo, b as ExtensionType, c as ERC20BalanceValidatorConfig, T as TournamentValidatorConfig, O as OpusTrovesValidatorConfig, d as SnapshotValidatorConfig, Z as ZkPassportValidatorConfig, G as GovernanceValidatorConfig, e as QualificationResult, f as EntryRequirementVariant, g as QualificationProof } from './prizeAggregation-CHwIJzXr.js';
|
|
2
|
+
export { D as DistributionType, h as EntryFeeBreakdown, i as EntryFeeExtensionConfig, j as EntryFeeShares, k as ExtensionCategory, l as Participant, m as PositionPrizeGroup, n as PrizeExtensionConfig, o as QualificationEntry, p as QualifyingMode, q as SponsorContribution, r as StatusVariant, s as Token, t as aggregatePrizesByPosition, u as aggregatePrizesBySponsor, v as calculateDistribution, w as calculateEntryFeeBreakdown, x as calculatePayouts, y as distributePool, z as filterClaimablePrizes, A as filterZeroPrizes, B as formatNumber, C as formatPrizeAmount, F as formatScore, H as formatTime, I as formatUsdValue, J as getOrdinalSuffix } from './prizeAggregation-CHwIJzXr.js';
|
|
3
3
|
import { CairoOption, CairoCustomEnum } from 'starknet';
|
|
4
4
|
|
|
5
5
|
interface EntryFee {
|
|
6
6
|
tokenAddress: string;
|
|
7
7
|
amount: string;
|
|
8
|
-
|
|
8
|
+
tournamentCreatorShare?: number;
|
|
9
|
+
gameCreatorShare?: number;
|
|
9
10
|
refundShare?: number;
|
|
11
|
+
distribution?: Distribution | null;
|
|
12
|
+
distributionCount?: number;
|
|
10
13
|
}
|
|
11
14
|
interface EntryRequirement {
|
|
12
|
-
requirementType:
|
|
15
|
+
requirementType: "token" | "extension";
|
|
13
16
|
tokenAddress?: string;
|
|
14
17
|
entryLimit?: number;
|
|
18
|
+
extensionConfig?: Record<string, unknown>;
|
|
15
19
|
}
|
|
20
|
+
type Distribution = {
|
|
21
|
+
Linear: number;
|
|
22
|
+
} | {
|
|
23
|
+
Exponential: number;
|
|
24
|
+
} | {
|
|
25
|
+
Uniform: Record<string, never>;
|
|
26
|
+
} | {
|
|
27
|
+
Custom: [number, ...number[]];
|
|
28
|
+
};
|
|
16
29
|
|
|
17
30
|
declare function indexAddress(address: string): string;
|
|
18
31
|
declare function padAddress(address: string): string;
|
|
@@ -198,7 +211,7 @@ declare function formatCashToUSD(value: bigint): string;
|
|
|
198
211
|
* their own SDK, then passes it here for evaluation.
|
|
199
212
|
*
|
|
200
213
|
* The evaluation logic is the same across metagames because the entry
|
|
201
|
-
* requirement system (token gating,
|
|
214
|
+
* requirement system (token gating, extensions) is shared.
|
|
202
215
|
*/
|
|
203
216
|
|
|
204
217
|
interface TokenQualificationInput {
|
|
@@ -217,20 +230,6 @@ interface TokenQualificationInput {
|
|
|
217
230
|
* as the best proof.
|
|
218
231
|
*/
|
|
219
232
|
declare function evaluateTokenQualification(input: TokenQualificationInput): QualificationResult;
|
|
220
|
-
interface AllowlistQualificationInput {
|
|
221
|
-
/** The player's address */
|
|
222
|
-
playerAddress: string;
|
|
223
|
-
/** Addresses on the allowlist */
|
|
224
|
-
allowlist: string[];
|
|
225
|
-
/** How many times this address has already entered */
|
|
226
|
-
currentEntryCount: number;
|
|
227
|
-
/** Max entries per address (0 = unlimited) */
|
|
228
|
-
entryLimit: number;
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* Evaluate allowlist-based entry qualification.
|
|
232
|
-
*/
|
|
233
|
-
declare function evaluateAllowlistQualification(input: AllowlistQualificationInput): QualificationResult;
|
|
234
233
|
interface ExtensionQualificationInput {
|
|
235
234
|
/** Results from checking each qualification method against the extension contract */
|
|
236
235
|
checkedQualifications: Array<{
|
|
@@ -258,9 +257,6 @@ declare function evaluateExtensionQualification(input: ExtensionQualificationInp
|
|
|
258
257
|
declare function evaluateQualification(variant: EntryRequirementVariant, input: {
|
|
259
258
|
type: "token";
|
|
260
259
|
data: TokenQualificationInput;
|
|
261
|
-
} | {
|
|
262
|
-
type: "allowlist";
|
|
263
|
-
data: AllowlistQualificationInput;
|
|
264
260
|
} | {
|
|
265
261
|
type: "extension";
|
|
266
262
|
data: ExtensionQualificationInput;
|
|
@@ -275,15 +271,13 @@ declare function evaluateQualification(variant: EntryRequirementVariant, input:
|
|
|
275
271
|
* an event. The proof format matches the Cairo `QualificationProof` enum:
|
|
276
272
|
*
|
|
277
273
|
* enum QualificationProof {
|
|
278
|
-
*
|
|
279
|
-
*
|
|
280
|
-
* Address: ContractAddress,
|
|
281
|
-
* Extension: Array<felt252>,
|
|
274
|
+
* NFT: NFTQualification, // { token_id: u256 }
|
|
275
|
+
* Extension: Span<felt252>,
|
|
282
276
|
* }
|
|
283
277
|
*
|
|
284
|
-
*
|
|
285
|
-
*
|
|
286
|
-
*
|
|
278
|
+
* Extension-specific data (tournament IDs, positions, addresses, etc.)
|
|
279
|
+
* is encoded into the `Extension` variant's felt252 array by the
|
|
280
|
+
* extension's own logic.
|
|
287
281
|
*/
|
|
288
282
|
|
|
289
283
|
/**
|
|
@@ -301,11 +295,6 @@ declare function buildQualificationProof(proof: QualificationProof | null): Cair
|
|
|
301
295
|
* Used when entry requires holding a specific NFT collection.
|
|
302
296
|
*/
|
|
303
297
|
declare function buildNFTProof(tokenId: string): CairoOption<CairoCustomEnum>;
|
|
304
|
-
/**
|
|
305
|
-
* Build an address/allowlist proof.
|
|
306
|
-
* Used when entry is gated by an address allowlist.
|
|
307
|
-
*/
|
|
308
|
-
declare function buildAddressProof(address: string): CairoOption<CairoCustomEnum>;
|
|
309
298
|
/**
|
|
310
299
|
* Build a tournament validator extension proof.
|
|
311
300
|
* Used when entry requires participation/winning in a prior tournament.
|
|
@@ -497,4 +486,4 @@ declare function calculateTotalPrizeValueUSD(prizes: Prize[], prices: TokenPrice
|
|
|
497
486
|
*/
|
|
498
487
|
declare function calculatePaidPlaces(sponsoredPrizes: Prize[], entryFeeDistributionCount: number): number;
|
|
499
488
|
|
|
500
|
-
export { type
|
|
489
|
+
export { type Distribution, ERC20BalanceValidatorConfig, type EntryFee, type EntryFeeConfig, type EntryRequirement, EntryRequirementVariant, ExtensionAddresses, type ExtensionQualificationInput, ExtensionType, GovernanceValidatorConfig, type GroupedTokenPrize, type NftParseResult, type NftPrizeInput, OpusTrovesValidatorConfig, Prize, QualificationProof, QualificationResult, QualifyingModeInfo, SnapshotValidatorConfig, StatusResult, StatusTimestamps, type TokenDecimalsLookup, type TokenPriceLookup, type TokenQualificationInput, type TournamentLeaderboard, type TournamentQualificationInput, type TournamentRegistration, TournamentValidatorConfig, ZkPassportValidatorConfig, bigintToHex, buildEntryFeePrizes, buildExtensionProof, buildNFTProof, buildParticipationMap, buildQualificationProof, buildTournamentExtensionProof, buildWinMap, calculateOpusTrovesEntries, calculatePaidPlaces, calculatePrizeValue, calculateTotalPrizeValueUSD, computeStatus, displayAddress, evaluateExtensionQualification, evaluateQualification, evaluateTokenQualification, findAllBannableEntries, findBannableEntries, formatCashToUSD, formatTokenAmount, getExtensionAddresses, getOpusSupportedAssets, getQualifyingModeInfo, getWhitelistedExtensionAddresses, groupPrizesByToken, identifyExtensionType, indexAddress, isBefore, isWhitelistedExtension, padAddress, parseERC20BalanceValidatorConfig, parseExtensionConfig, parseGovernanceValidatorConfig, parseNFTBulkInput, parseOpusTrovesValidatorConfig, parseSnapshotValidatorConfig, parseTournamentValidatorConfig, parseZkPassportValidatorConfig, resolveTournamentQualifications };
|
package/dist/index.js
CHANGED
|
@@ -742,45 +742,6 @@ function evaluateTokenQualification(input) {
|
|
|
742
742
|
totalEntriesLeft
|
|
743
743
|
};
|
|
744
744
|
}
|
|
745
|
-
function evaluateAllowlistQualification(input) {
|
|
746
|
-
const isInAllowlist = input.allowlist.some(
|
|
747
|
-
(addr) => addr.toLowerCase() === input.playerAddress.toLowerCase()
|
|
748
|
-
);
|
|
749
|
-
if (!isInAllowlist) {
|
|
750
|
-
return {
|
|
751
|
-
meetsRequirements: false,
|
|
752
|
-
bestProof: null,
|
|
753
|
-
qualifications: [],
|
|
754
|
-
totalEntriesLeft: 0
|
|
755
|
-
};
|
|
756
|
-
}
|
|
757
|
-
const remaining = input.entryLimit > 0 ? input.entryLimit - input.currentEntryCount : Infinity;
|
|
758
|
-
if (remaining <= 0) {
|
|
759
|
-
return {
|
|
760
|
-
meetsRequirements: false,
|
|
761
|
-
bestProof: null,
|
|
762
|
-
qualifications: [],
|
|
763
|
-
totalEntriesLeft: 0
|
|
764
|
-
};
|
|
765
|
-
}
|
|
766
|
-
const proof = {
|
|
767
|
-
type: "allowlist",
|
|
768
|
-
address: input.playerAddress
|
|
769
|
-
};
|
|
770
|
-
return {
|
|
771
|
-
meetsRequirements: true,
|
|
772
|
-
bestProof: proof,
|
|
773
|
-
qualifications: [
|
|
774
|
-
{
|
|
775
|
-
id: `allowlist-${input.playerAddress}`,
|
|
776
|
-
entriesLeft: remaining,
|
|
777
|
-
proof,
|
|
778
|
-
label: "Allowlist"
|
|
779
|
-
}
|
|
780
|
-
],
|
|
781
|
-
totalEntriesLeft: remaining === Infinity ? 1 : remaining
|
|
782
|
-
};
|
|
783
|
-
}
|
|
784
745
|
function evaluateExtensionQualification(input) {
|
|
785
746
|
const qualifications = input.checkedQualifications.filter((q) => q.entriesLeft > 0).map((q) => ({
|
|
786
747
|
id: q.id,
|
|
@@ -824,8 +785,6 @@ function evaluateQualification(variant, input) {
|
|
|
824
785
|
switch (input.type) {
|
|
825
786
|
case "token":
|
|
826
787
|
return evaluateTokenQualification(input.data);
|
|
827
|
-
case "allowlist":
|
|
828
|
-
return evaluateAllowlistQualification(input.data);
|
|
829
788
|
case "extension":
|
|
830
789
|
return evaluateExtensionQualification(input.data);
|
|
831
790
|
default:
|
|
@@ -844,16 +803,7 @@ function buildQualificationProof(proof) {
|
|
|
844
803
|
switch (proof.type) {
|
|
845
804
|
case "token":
|
|
846
805
|
return buildNFTProof(proof.tokenId ?? "0");
|
|
847
|
-
case "allowlist":
|
|
848
|
-
return buildAddressProof(proof.address ?? "0x0");
|
|
849
806
|
case "extension":
|
|
850
|
-
if (proof.tournamentId && proof.tokenId && proof.position !== void 0) {
|
|
851
|
-
return buildTournamentExtensionProof(
|
|
852
|
-
proof.tournamentId,
|
|
853
|
-
proof.tokenId,
|
|
854
|
-
proof.position
|
|
855
|
-
);
|
|
856
|
-
}
|
|
857
807
|
return buildExtensionProof(proof.extensionProof ?? []);
|
|
858
808
|
case "none":
|
|
859
809
|
return new CairoOption(CairoOptionVariant.None);
|
|
@@ -865,25 +815,12 @@ function buildNFTProof(tokenId) {
|
|
|
865
815
|
return new CairoOption(
|
|
866
816
|
CairoOptionVariant.Some,
|
|
867
817
|
new CairoCustomEnum({
|
|
868
|
-
Tournament: void 0,
|
|
869
818
|
NFT: {
|
|
870
819
|
token_id: {
|
|
871
820
|
low: tokenId,
|
|
872
821
|
high: "0"
|
|
873
822
|
}
|
|
874
823
|
},
|
|
875
|
-
Address: void 0,
|
|
876
|
-
Extension: void 0
|
|
877
|
-
})
|
|
878
|
-
);
|
|
879
|
-
}
|
|
880
|
-
function buildAddressProof(address) {
|
|
881
|
-
return new CairoOption(
|
|
882
|
-
CairoOptionVariant.Some,
|
|
883
|
-
new CairoCustomEnum({
|
|
884
|
-
Tournament: void 0,
|
|
885
|
-
NFT: void 0,
|
|
886
|
-
Address: address,
|
|
887
824
|
Extension: void 0
|
|
888
825
|
})
|
|
889
826
|
);
|
|
@@ -899,9 +836,7 @@ function buildExtensionProof(proofData) {
|
|
|
899
836
|
return new CairoOption(
|
|
900
837
|
CairoOptionVariant.Some,
|
|
901
838
|
new CairoCustomEnum({
|
|
902
|
-
Tournament: void 0,
|
|
903
839
|
NFT: void 0,
|
|
904
|
-
Address: void 0,
|
|
905
840
|
Extension: proofData
|
|
906
841
|
})
|
|
907
842
|
);
|
|
@@ -1075,6 +1010,6 @@ function calculatePaidPlaces(sponsoredPrizes, entryFeeDistributionCount) {
|
|
|
1075
1010
|
return Math.max(maxSponsoredPosition, entryFeeDistributionCount);
|
|
1076
1011
|
}
|
|
1077
1012
|
|
|
1078
|
-
export { QualifyingMode, aggregatePrizesByPosition, aggregatePrizesBySponsor, bigintToHex,
|
|
1013
|
+
export { QualifyingMode, aggregatePrizesByPosition, aggregatePrizesBySponsor, bigintToHex, buildEntryFeePrizes, buildExtensionProof, buildNFTProof, buildParticipationMap, buildQualificationProof, buildTournamentExtensionProof, buildWinMap, calculateDistribution, calculateEntryFeeBreakdown, calculateOpusTrovesEntries, calculatePaidPlaces, calculatePayouts, calculatePrizeValue, calculateTotalPrizeValueUSD, computeStatus, displayAddress, distributePool, evaluateExtensionQualification, evaluateQualification, evaluateTokenQualification, filterClaimablePrizes, filterZeroPrizes, findAllBannableEntries, findBannableEntries, formatCashToUSD, formatNumber, formatPrizeAmount, formatScore, formatTime, formatTokenAmount, formatUsdValue, getExtensionAddresses, getOpusSupportedAssets, getOrdinalSuffix, getQualifyingModeInfo, getWhitelistedExtensionAddresses, groupPrizesByToken, identifyExtensionType, indexAddress, isBefore, isWhitelistedExtension, padAddress, parseERC20BalanceValidatorConfig, parseExtensionConfig, parseGovernanceValidatorConfig, parseNFTBulkInput, parseOpusTrovesValidatorConfig, parseSnapshotValidatorConfig, parseTournamentValidatorConfig, parseZkPassportValidatorConfig, resolveTournamentQualifications };
|
|
1079
1014
|
//# sourceMappingURL=index.js.map
|
|
1080
1015
|
//# sourceMappingURL=index.js.map
|