@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.cjs
CHANGED
|
@@ -744,45 +744,6 @@ function evaluateTokenQualification(input) {
|
|
|
744
744
|
totalEntriesLeft
|
|
745
745
|
};
|
|
746
746
|
}
|
|
747
|
-
function evaluateAllowlistQualification(input) {
|
|
748
|
-
const isInAllowlist = input.allowlist.some(
|
|
749
|
-
(addr) => addr.toLowerCase() === input.playerAddress.toLowerCase()
|
|
750
|
-
);
|
|
751
|
-
if (!isInAllowlist) {
|
|
752
|
-
return {
|
|
753
|
-
meetsRequirements: false,
|
|
754
|
-
bestProof: null,
|
|
755
|
-
qualifications: [],
|
|
756
|
-
totalEntriesLeft: 0
|
|
757
|
-
};
|
|
758
|
-
}
|
|
759
|
-
const remaining = input.entryLimit > 0 ? input.entryLimit - input.currentEntryCount : Infinity;
|
|
760
|
-
if (remaining <= 0) {
|
|
761
|
-
return {
|
|
762
|
-
meetsRequirements: false,
|
|
763
|
-
bestProof: null,
|
|
764
|
-
qualifications: [],
|
|
765
|
-
totalEntriesLeft: 0
|
|
766
|
-
};
|
|
767
|
-
}
|
|
768
|
-
const proof = {
|
|
769
|
-
type: "allowlist",
|
|
770
|
-
address: input.playerAddress
|
|
771
|
-
};
|
|
772
|
-
return {
|
|
773
|
-
meetsRequirements: true,
|
|
774
|
-
bestProof: proof,
|
|
775
|
-
qualifications: [
|
|
776
|
-
{
|
|
777
|
-
id: `allowlist-${input.playerAddress}`,
|
|
778
|
-
entriesLeft: remaining,
|
|
779
|
-
proof,
|
|
780
|
-
label: "Allowlist"
|
|
781
|
-
}
|
|
782
|
-
],
|
|
783
|
-
totalEntriesLeft: remaining === Infinity ? 1 : remaining
|
|
784
|
-
};
|
|
785
|
-
}
|
|
786
747
|
function evaluateExtensionQualification(input) {
|
|
787
748
|
const qualifications = input.checkedQualifications.filter((q) => q.entriesLeft > 0).map((q) => ({
|
|
788
749
|
id: q.id,
|
|
@@ -826,8 +787,6 @@ function evaluateQualification(variant, input) {
|
|
|
826
787
|
switch (input.type) {
|
|
827
788
|
case "token":
|
|
828
789
|
return evaluateTokenQualification(input.data);
|
|
829
|
-
case "allowlist":
|
|
830
|
-
return evaluateAllowlistQualification(input.data);
|
|
831
790
|
case "extension":
|
|
832
791
|
return evaluateExtensionQualification(input.data);
|
|
833
792
|
default:
|
|
@@ -846,16 +805,7 @@ function buildQualificationProof(proof) {
|
|
|
846
805
|
switch (proof.type) {
|
|
847
806
|
case "token":
|
|
848
807
|
return buildNFTProof(proof.tokenId ?? "0");
|
|
849
|
-
case "allowlist":
|
|
850
|
-
return buildAddressProof(proof.address ?? "0x0");
|
|
851
808
|
case "extension":
|
|
852
|
-
if (proof.tournamentId && proof.tokenId && proof.position !== void 0) {
|
|
853
|
-
return buildTournamentExtensionProof(
|
|
854
|
-
proof.tournamentId,
|
|
855
|
-
proof.tokenId,
|
|
856
|
-
proof.position
|
|
857
|
-
);
|
|
858
|
-
}
|
|
859
809
|
return buildExtensionProof(proof.extensionProof ?? []);
|
|
860
810
|
case "none":
|
|
861
811
|
return new starknet.CairoOption(starknet.CairoOptionVariant.None);
|
|
@@ -867,25 +817,12 @@ function buildNFTProof(tokenId) {
|
|
|
867
817
|
return new starknet.CairoOption(
|
|
868
818
|
starknet.CairoOptionVariant.Some,
|
|
869
819
|
new starknet.CairoCustomEnum({
|
|
870
|
-
Tournament: void 0,
|
|
871
820
|
NFT: {
|
|
872
821
|
token_id: {
|
|
873
822
|
low: tokenId,
|
|
874
823
|
high: "0"
|
|
875
824
|
}
|
|
876
825
|
},
|
|
877
|
-
Address: void 0,
|
|
878
|
-
Extension: void 0
|
|
879
|
-
})
|
|
880
|
-
);
|
|
881
|
-
}
|
|
882
|
-
function buildAddressProof(address) {
|
|
883
|
-
return new starknet.CairoOption(
|
|
884
|
-
starknet.CairoOptionVariant.Some,
|
|
885
|
-
new starknet.CairoCustomEnum({
|
|
886
|
-
Tournament: void 0,
|
|
887
|
-
NFT: void 0,
|
|
888
|
-
Address: address,
|
|
889
826
|
Extension: void 0
|
|
890
827
|
})
|
|
891
828
|
);
|
|
@@ -901,9 +838,7 @@ function buildExtensionProof(proofData) {
|
|
|
901
838
|
return new starknet.CairoOption(
|
|
902
839
|
starknet.CairoOptionVariant.Some,
|
|
903
840
|
new starknet.CairoCustomEnum({
|
|
904
|
-
Tournament: void 0,
|
|
905
841
|
NFT: void 0,
|
|
906
|
-
Address: void 0,
|
|
907
842
|
Extension: proofData
|
|
908
843
|
})
|
|
909
844
|
);
|
|
@@ -1081,7 +1016,6 @@ exports.QualifyingMode = QualifyingMode;
|
|
|
1081
1016
|
exports.aggregatePrizesByPosition = aggregatePrizesByPosition;
|
|
1082
1017
|
exports.aggregatePrizesBySponsor = aggregatePrizesBySponsor;
|
|
1083
1018
|
exports.bigintToHex = bigintToHex;
|
|
1084
|
-
exports.buildAddressProof = buildAddressProof;
|
|
1085
1019
|
exports.buildEntryFeePrizes = buildEntryFeePrizes;
|
|
1086
1020
|
exports.buildExtensionProof = buildExtensionProof;
|
|
1087
1021
|
exports.buildNFTProof = buildNFTProof;
|
|
@@ -1099,7 +1033,6 @@ exports.calculateTotalPrizeValueUSD = calculateTotalPrizeValueUSD;
|
|
|
1099
1033
|
exports.computeStatus = computeStatus;
|
|
1100
1034
|
exports.displayAddress = displayAddress;
|
|
1101
1035
|
exports.distributePool = distributePool;
|
|
1102
|
-
exports.evaluateAllowlistQualification = evaluateAllowlistQualification;
|
|
1103
1036
|
exports.evaluateExtensionQualification = evaluateExtensionQualification;
|
|
1104
1037
|
exports.evaluateQualification = evaluateQualification;
|
|
1105
1038
|
exports.evaluateTokenQualification = evaluateTokenQualification;
|