@provable-games/budokan-sdk 0.1.22 → 0.1.24
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/README.md +32 -0
- package/dist/index.cjs +1494 -320
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +538 -3
- package/dist/index.d.ts +538 -3
- package/dist/index.js +1475 -322
- package/dist/index.js.map +1 -1
- package/dist/{client-DlXvzneQ.d.cts → player-C2GE9Lop.d.cts} +65 -5
- package/dist/{client-DlXvzneQ.d.ts → player-C2GE9Lop.d.ts} +65 -5
- package/dist/react.cjs +1194 -352
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +45 -2
- package/dist/react.d.ts +45 -2
- package/dist/react.js +1195 -354
- package/dist/react.js.map +1 -1
- package/package.json +5 -7
package/dist/react.cjs
CHANGED
|
@@ -535,11 +535,14 @@ var CHAINS = {
|
|
|
535
535
|
viewerAddress: "0x013c8239361fdbd7ec26db2c83f4ff270c5bba83a0bc105b4005b676ff57fdbe"
|
|
536
536
|
},
|
|
537
537
|
sepolia: {
|
|
538
|
-
rpcUrl: "https://starknet
|
|
538
|
+
rpcUrl: "https://api.cartridge.gg/x/starknet/sepolia/rpc/v0_10",
|
|
539
539
|
apiBaseUrl: "https://budokan-api-sepolia.up.railway.app",
|
|
540
540
|
wsUrl: "wss://budokan-api-sepolia.up.railway.app/ws",
|
|
541
|
-
budokanAddress: "
|
|
542
|
-
|
|
541
|
+
budokanAddress: "0x074cc823c382d98e6b8d657aa86776a57d85e1dc2912d54d83a4fef147472683",
|
|
542
|
+
// Redeployed 2026-06-18 to match the upgraded #264/#269 budokan class —
|
|
543
|
+
// the prior viewer (0x03da56…) was built against the old budokan interface
|
|
544
|
+
// (called the removed `tournament_entries`) and reverted RPC reads.
|
|
545
|
+
viewerAddress: "0x06b2773d5f1f8bfa5aa3b698fbbaea0472b30af003ea6058330ed52a1acaa283"
|
|
543
546
|
}
|
|
544
547
|
};
|
|
545
548
|
function getChainConfig(chain) {
|
|
@@ -840,23 +843,36 @@ function parseTournament(raw, entryCount) {
|
|
|
840
843
|
const lc = obj.leaderboard_config;
|
|
841
844
|
const ascending = Boolean(lc?.ascending);
|
|
842
845
|
const gameMustBeOver = Boolean(lc?.game_must_be_over);
|
|
843
|
-
const
|
|
846
|
+
const entryFeeKind = parseOption(obj.entry_fee);
|
|
844
847
|
let entryFeeToken = null;
|
|
845
848
|
let entryFeeAmount = null;
|
|
846
849
|
let entryFee = null;
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
850
|
+
let entryFeeKindTag = null;
|
|
851
|
+
let entryFeeExtension = null;
|
|
852
|
+
if (entryFeeKind) {
|
|
853
|
+
const variantBag = entryFeeKind.variant ?? entryFeeKind;
|
|
854
|
+
const ef = variantBag.BuiltIn;
|
|
855
|
+
const ext = variantBag.Extension;
|
|
856
|
+
if (ef) {
|
|
857
|
+
entryFeeKindTag = "builtin";
|
|
858
|
+
entryFeeToken = starknet.num.toHex(ef.token_address);
|
|
859
|
+
entryFeeAmount = String(ef.amount ?? "0");
|
|
860
|
+
entryFee = {
|
|
861
|
+
tokenAddress: entryFeeToken,
|
|
862
|
+
amount: entryFeeAmount,
|
|
863
|
+
tournamentCreatorShare: Number(ef.tournament_creator_share ?? 0),
|
|
864
|
+
gameCreatorShare: Number(ef.game_creator_share ?? 0),
|
|
865
|
+
refundShare: Number(ef.refund_share ?? 0),
|
|
866
|
+
distribution: ef.distribution ?? null,
|
|
867
|
+
distributionCount: Number(ef.distribution_count ?? 0)
|
|
868
|
+
};
|
|
869
|
+
} else if (ext) {
|
|
870
|
+
entryFeeKindTag = "extension";
|
|
871
|
+
entryFeeExtension = {
|
|
872
|
+
address: starknet.num.toHex(ext.address),
|
|
873
|
+
config: Array.isArray(ext.config) ? ext.config.map((x) => starknet.num.toHex(x)) : []
|
|
874
|
+
};
|
|
875
|
+
}
|
|
860
876
|
}
|
|
861
877
|
const entryRequirement = parseOption(obj.entry_requirement);
|
|
862
878
|
const hasEntryRequirement = entryRequirement !== null;
|
|
@@ -906,6 +922,8 @@ function parseTournament(raw, entryCount) {
|
|
|
906
922
|
renderer
|
|
907
923
|
},
|
|
908
924
|
entryFee,
|
|
925
|
+
entryFeeKind: entryFeeKindTag,
|
|
926
|
+
entryFeeExtension,
|
|
909
927
|
entryRequirement,
|
|
910
928
|
leaderboardConfig: { ascending, gameMustBeOver },
|
|
911
929
|
entryCount,
|
|
@@ -936,8 +954,40 @@ function parseRegistration(raw, tournamentId) {
|
|
|
936
954
|
};
|
|
937
955
|
}
|
|
938
956
|
function parsePrize(raw) {
|
|
939
|
-
const
|
|
940
|
-
const
|
|
957
|
+
const record = raw;
|
|
958
|
+
const prizeEnum = record.prize;
|
|
959
|
+
if (!prizeEnum) {
|
|
960
|
+
throw new Error(`PrizeRecord missing prize field: ${JSON.stringify(raw)}`);
|
|
961
|
+
}
|
|
962
|
+
const activePrize = typeof prizeEnum.activeVariant === "function" ? prizeEnum.activeVariant() : prizeEnum.Token !== void 0 ? "Token" : prizeEnum.Extension !== void 0 ? "Extension" : null;
|
|
963
|
+
const prizeVariantBag = prizeEnum.variant ?? prizeEnum;
|
|
964
|
+
if (activePrize === "Extension") {
|
|
965
|
+
const ext = prizeVariantBag.Extension;
|
|
966
|
+
return {
|
|
967
|
+
prizeId: String(record.id ?? "0"),
|
|
968
|
+
tournamentId: String(record.context_id ?? "0"),
|
|
969
|
+
payoutPosition: 0,
|
|
970
|
+
tokenAddress: null,
|
|
971
|
+
tokenType: "extension",
|
|
972
|
+
amount: null,
|
|
973
|
+
tokenId: null,
|
|
974
|
+
distributionType: null,
|
|
975
|
+
distributionWeight: null,
|
|
976
|
+
distributionShares: null,
|
|
977
|
+
distributionCount: null,
|
|
978
|
+
sponsorAddress: starknet.num.toHex(record.sponsor_address),
|
|
979
|
+
extensionAddress: ext?.address != null ? starknet.num.toHex(ext.address) : null,
|
|
980
|
+
extensionConfig: Array.isArray(ext?.config) ? ext.config.map((x) => starknet.num.toHex(x)) : null
|
|
981
|
+
};
|
|
982
|
+
}
|
|
983
|
+
if (activePrize !== "Token") {
|
|
984
|
+
throw new Error(`Unrecognised Prize variant: ${JSON.stringify(prizeEnum)}`);
|
|
985
|
+
}
|
|
986
|
+
const tokenPayload = prizeVariantBag.Token;
|
|
987
|
+
if (!tokenPayload) {
|
|
988
|
+
throw new Error(`Prize::Token missing payload: ${JSON.stringify(prizeEnum)}`);
|
|
989
|
+
}
|
|
990
|
+
const tokenTypeData = tokenPayload.token_type;
|
|
941
991
|
let tokenType = "erc20";
|
|
942
992
|
let amount = null;
|
|
943
993
|
let tokenId = null;
|
|
@@ -978,10 +1028,10 @@ function parsePrize(raw) {
|
|
|
978
1028
|
}
|
|
979
1029
|
}
|
|
980
1030
|
return {
|
|
981
|
-
prizeId: String(
|
|
982
|
-
tournamentId: String(
|
|
1031
|
+
prizeId: String(record.id ?? "0"),
|
|
1032
|
+
tournamentId: String(record.context_id ?? "0"),
|
|
983
1033
|
payoutPosition,
|
|
984
|
-
tokenAddress: starknet.num.toHex(
|
|
1034
|
+
tokenAddress: starknet.num.toHex(tokenPayload.token_address),
|
|
985
1035
|
tokenType,
|
|
986
1036
|
amount,
|
|
987
1037
|
tokenId,
|
|
@@ -989,7 +1039,9 @@ function parsePrize(raw) {
|
|
|
989
1039
|
distributionWeight,
|
|
990
1040
|
distributionShares,
|
|
991
1041
|
distributionCount,
|
|
992
|
-
sponsorAddress: starknet.num.toHex(
|
|
1042
|
+
sponsorAddress: starknet.num.toHex(record.sponsor_address),
|
|
1043
|
+
extensionAddress: null,
|
|
1044
|
+
extensionConfig: null
|
|
993
1045
|
};
|
|
994
1046
|
}
|
|
995
1047
|
function parseOption(raw) {
|
|
@@ -1114,6 +1166,20 @@ async function viewerPrizes(contract, tournamentId) {
|
|
|
1114
1166
|
return result.map(parsePrize);
|
|
1115
1167
|
}, contract.address);
|
|
1116
1168
|
}
|
|
1169
|
+
function rewardClaim(partial) {
|
|
1170
|
+
return {
|
|
1171
|
+
prizeId: null,
|
|
1172
|
+
payoutIndex: null,
|
|
1173
|
+
position: null,
|
|
1174
|
+
refundTokenId: null,
|
|
1175
|
+
extensionTokenId: null,
|
|
1176
|
+
extensionParams: null,
|
|
1177
|
+
...partial
|
|
1178
|
+
};
|
|
1179
|
+
}
|
|
1180
|
+
function spanToHex(v) {
|
|
1181
|
+
return Array.isArray(v) ? v.map((x) => starknet.num.toHex(x)) : [];
|
|
1182
|
+
}
|
|
1117
1183
|
function translateCairoRewardType(rewardType) {
|
|
1118
1184
|
if (!rewardType || typeof rewardType !== "object") {
|
|
1119
1185
|
throw new Error(`Unexpected RewardType payload: ${JSON.stringify(rewardType)}`);
|
|
@@ -1122,70 +1188,70 @@ function translateCairoRewardType(rewardType) {
|
|
|
1122
1188
|
const outer = typeof rt.activeVariant === "function" ? rt.activeVariant() : null;
|
|
1123
1189
|
const innerBag = typeof rt.activeVariant === "function" ? rt.variant : rt;
|
|
1124
1190
|
if (outer === "Prize" || innerBag.Prize !== void 0) {
|
|
1125
|
-
const
|
|
1191
|
+
const prizeClaim = innerBag.Prize;
|
|
1192
|
+
const pcBag = typeof prizeClaim?.activeVariant === "function" ? prizeClaim.variant : prizeClaim;
|
|
1193
|
+
if (pcBag?.Token === void 0 && pcBag?.Extension !== void 0) {
|
|
1194
|
+
const ext = pcBag.Extension;
|
|
1195
|
+
const tokenId = parseOption(ext.token_id);
|
|
1196
|
+
return rewardClaim({
|
|
1197
|
+
claimKind: "prize_extension",
|
|
1198
|
+
prizeId: BigInt(ext.prize_id ?? 0).toString(),
|
|
1199
|
+
extensionTokenId: tokenId != null ? starknet.num.toHex(tokenId) : null,
|
|
1200
|
+
extensionParams: spanToHex(ext.payout_params)
|
|
1201
|
+
});
|
|
1202
|
+
}
|
|
1203
|
+
const prize = pcBag?.Token ?? prizeClaim;
|
|
1126
1204
|
const subVariant = typeof prize?.activeVariant === "function" ? prize.activeVariant() : null;
|
|
1127
1205
|
const subBag = typeof prize?.activeVariant === "function" ? prize.variant : prize;
|
|
1128
1206
|
if (subVariant === "Single" || subBag?.Single !== void 0) {
|
|
1129
|
-
return {
|
|
1207
|
+
return rewardClaim({
|
|
1130
1208
|
claimKind: "prize_single",
|
|
1131
|
-
prizeId: BigInt(subBag.Single).toString()
|
|
1132
|
-
|
|
1133
|
-
position: null,
|
|
1134
|
-
refundTokenId: null
|
|
1135
|
-
};
|
|
1209
|
+
prizeId: BigInt(subBag.Single).toString()
|
|
1210
|
+
});
|
|
1136
1211
|
}
|
|
1137
1212
|
if (subVariant === "Distributed" || subBag?.Distributed !== void 0) {
|
|
1138
1213
|
const distributed = subBag.Distributed;
|
|
1139
1214
|
const prizeId = distributed?.["0"] ?? distributed?.[0];
|
|
1140
1215
|
const payoutIndex = distributed?.["1"] ?? distributed?.[1];
|
|
1141
|
-
return {
|
|
1216
|
+
return rewardClaim({
|
|
1142
1217
|
claimKind: "prize_distributed",
|
|
1143
1218
|
prizeId: BigInt(prizeId).toString(),
|
|
1144
|
-
payoutIndex: Number(payoutIndex)
|
|
1145
|
-
|
|
1146
|
-
refundTokenId: null
|
|
1147
|
-
};
|
|
1219
|
+
payoutIndex: Number(payoutIndex)
|
|
1220
|
+
});
|
|
1148
1221
|
}
|
|
1149
1222
|
}
|
|
1150
1223
|
if (outer === "EntryFee" || innerBag.EntryFee !== void 0) {
|
|
1151
|
-
const
|
|
1224
|
+
const entryFeeClaim = innerBag.EntryFee;
|
|
1225
|
+
const efBag = typeof entryFeeClaim?.activeVariant === "function" ? entryFeeClaim.variant : entryFeeClaim;
|
|
1226
|
+
if (efBag?.Token === void 0 && efBag?.Extension !== void 0) {
|
|
1227
|
+
const ext = efBag.Extension;
|
|
1228
|
+
const tokenId = parseOption(ext.token_id);
|
|
1229
|
+
return rewardClaim({
|
|
1230
|
+
claimKind: "entry_fee_extension",
|
|
1231
|
+
extensionTokenId: tokenId != null ? starknet.num.toHex(tokenId) : null,
|
|
1232
|
+
extensionParams: spanToHex(ext.claim_params)
|
|
1233
|
+
});
|
|
1234
|
+
}
|
|
1235
|
+
const entryFee = efBag?.Token ?? entryFeeClaim;
|
|
1152
1236
|
const subVariant = typeof entryFee?.activeVariant === "function" ? entryFee.activeVariant() : null;
|
|
1153
1237
|
const subBag = typeof entryFee?.activeVariant === "function" ? entryFee.variant : entryFee;
|
|
1154
1238
|
if (subVariant === "Position" || subBag?.Position !== void 0) {
|
|
1155
|
-
return {
|
|
1239
|
+
return rewardClaim({
|
|
1156
1240
|
claimKind: "entry_fee_position",
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
position: Number(subBag.Position),
|
|
1160
|
-
refundTokenId: null
|
|
1161
|
-
};
|
|
1241
|
+
position: Number(subBag.Position)
|
|
1242
|
+
});
|
|
1162
1243
|
}
|
|
1163
1244
|
if (subVariant === "TournamentCreator" || subBag?.TournamentCreator !== void 0) {
|
|
1164
|
-
return {
|
|
1165
|
-
claimKind: "entry_fee_tournament_creator",
|
|
1166
|
-
prizeId: null,
|
|
1167
|
-
payoutIndex: null,
|
|
1168
|
-
position: null,
|
|
1169
|
-
refundTokenId: null
|
|
1170
|
-
};
|
|
1245
|
+
return rewardClaim({ claimKind: "entry_fee_tournament_creator" });
|
|
1171
1246
|
}
|
|
1172
1247
|
if (subVariant === "GameCreator" || subBag?.GameCreator !== void 0) {
|
|
1173
|
-
return {
|
|
1174
|
-
claimKind: "entry_fee_game_creator",
|
|
1175
|
-
prizeId: null,
|
|
1176
|
-
payoutIndex: null,
|
|
1177
|
-
position: null,
|
|
1178
|
-
refundTokenId: null
|
|
1179
|
-
};
|
|
1248
|
+
return rewardClaim({ claimKind: "entry_fee_game_creator" });
|
|
1180
1249
|
}
|
|
1181
1250
|
if (subVariant === "Refund" || subBag?.Refund !== void 0) {
|
|
1182
|
-
return {
|
|
1251
|
+
return rewardClaim({
|
|
1183
1252
|
claimKind: "entry_fee_refund",
|
|
1184
|
-
prizeId: null,
|
|
1185
|
-
payoutIndex: null,
|
|
1186
|
-
position: null,
|
|
1187
1253
|
refundTokenId: `0x${BigInt(subBag.Refund).toString(16)}`
|
|
1188
|
-
};
|
|
1254
|
+
});
|
|
1189
1255
|
}
|
|
1190
1256
|
}
|
|
1191
1257
|
throw new Error(
|
|
@@ -1196,13 +1262,15 @@ async function viewerRewardClaims(contract, tournamentId, offset, limit) {
|
|
|
1196
1262
|
return wrapRpcCall(async () => {
|
|
1197
1263
|
const result = await contract.call("tournament_reward_claims", [tournamentId, offset, limit]);
|
|
1198
1264
|
const obj = result;
|
|
1199
|
-
const claims = obj.claims
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1265
|
+
const claims = (obj.claims ?? []).map(
|
|
1266
|
+
(raw) => {
|
|
1267
|
+
const claim = raw;
|
|
1268
|
+
return {
|
|
1269
|
+
...translateCairoRewardType(claim.reward_type),
|
|
1270
|
+
claimed: Boolean(claim.claimed)
|
|
1271
|
+
};
|
|
1272
|
+
}
|
|
1273
|
+
);
|
|
1206
1274
|
return {
|
|
1207
1275
|
claims,
|
|
1208
1276
|
total: Number(obj.total ?? 0),
|
|
@@ -1482,20 +1550,6 @@ var budokanViewer_default = [
|
|
|
1482
1550
|
}
|
|
1483
1551
|
]
|
|
1484
1552
|
},
|
|
1485
|
-
{
|
|
1486
|
-
type: "enum",
|
|
1487
|
-
name: "core::option::Option::<budokan_interfaces::budokan::EntryFee>",
|
|
1488
|
-
variants: [
|
|
1489
|
-
{
|
|
1490
|
-
name: "Some",
|
|
1491
|
-
type: "budokan_interfaces::budokan::EntryFee"
|
|
1492
|
-
},
|
|
1493
|
-
{
|
|
1494
|
-
name: "None",
|
|
1495
|
-
type: "()"
|
|
1496
|
-
}
|
|
1497
|
-
]
|
|
1498
|
-
},
|
|
1499
1553
|
{
|
|
1500
1554
|
type: "struct",
|
|
1501
1555
|
name: "core::array::Span::<core::felt252>",
|
|
@@ -1520,6 +1574,34 @@ var budokanViewer_default = [
|
|
|
1520
1574
|
}
|
|
1521
1575
|
]
|
|
1522
1576
|
},
|
|
1577
|
+
{
|
|
1578
|
+
type: "enum",
|
|
1579
|
+
name: "budokan_interfaces::budokan::EntryFeeKind",
|
|
1580
|
+
variants: [
|
|
1581
|
+
{
|
|
1582
|
+
name: "BuiltIn",
|
|
1583
|
+
type: "budokan_interfaces::budokan::EntryFee"
|
|
1584
|
+
},
|
|
1585
|
+
{
|
|
1586
|
+
name: "Extension",
|
|
1587
|
+
type: "metagame_extensions_interfaces::extension::ExtensionConfig"
|
|
1588
|
+
}
|
|
1589
|
+
]
|
|
1590
|
+
},
|
|
1591
|
+
{
|
|
1592
|
+
type: "enum",
|
|
1593
|
+
name: "core::option::Option::<budokan_interfaces::budokan::EntryFeeKind>",
|
|
1594
|
+
variants: [
|
|
1595
|
+
{
|
|
1596
|
+
name: "Some",
|
|
1597
|
+
type: "budokan_interfaces::budokan::EntryFeeKind"
|
|
1598
|
+
},
|
|
1599
|
+
{
|
|
1600
|
+
name: "None",
|
|
1601
|
+
type: "()"
|
|
1602
|
+
}
|
|
1603
|
+
]
|
|
1604
|
+
},
|
|
1523
1605
|
{
|
|
1524
1606
|
type: "enum",
|
|
1525
1607
|
name: "game_components_interfaces::entry_requirement::EntryRequirementType",
|
|
@@ -1610,7 +1692,7 @@ var budokanViewer_default = [
|
|
|
1610
1692
|
},
|
|
1611
1693
|
{
|
|
1612
1694
|
name: "entry_fee",
|
|
1613
|
-
type: "core::option::Option::<budokan_interfaces::budokan::
|
|
1695
|
+
type: "core::option::Option::<budokan_interfaces::budokan::EntryFeeKind>"
|
|
1614
1696
|
},
|
|
1615
1697
|
{
|
|
1616
1698
|
name: "entry_requirement",
|
|
@@ -1766,7 +1848,49 @@ var budokanViewer_default = [
|
|
|
1766
1848
|
},
|
|
1767
1849
|
{
|
|
1768
1850
|
type: "struct",
|
|
1769
|
-
name: "game_components_interfaces::prize::
|
|
1851
|
+
name: "game_components_interfaces::prize::TokenPrizePayload",
|
|
1852
|
+
members: [
|
|
1853
|
+
{
|
|
1854
|
+
name: "token_address",
|
|
1855
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
1856
|
+
},
|
|
1857
|
+
{
|
|
1858
|
+
name: "token_type",
|
|
1859
|
+
type: "game_components_interfaces::prize::TokenTypeData"
|
|
1860
|
+
}
|
|
1861
|
+
]
|
|
1862
|
+
},
|
|
1863
|
+
{
|
|
1864
|
+
type: "struct",
|
|
1865
|
+
name: "game_components_interfaces::prize::ExtensionPrizePayload",
|
|
1866
|
+
members: [
|
|
1867
|
+
{
|
|
1868
|
+
name: "address",
|
|
1869
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
1870
|
+
},
|
|
1871
|
+
{
|
|
1872
|
+
name: "config",
|
|
1873
|
+
type: "core::array::Span::<core::felt252>"
|
|
1874
|
+
}
|
|
1875
|
+
]
|
|
1876
|
+
},
|
|
1877
|
+
{
|
|
1878
|
+
type: "enum",
|
|
1879
|
+
name: "game_components_interfaces::prize::Prize",
|
|
1880
|
+
variants: [
|
|
1881
|
+
{
|
|
1882
|
+
name: "Token",
|
|
1883
|
+
type: "game_components_interfaces::prize::TokenPrizePayload"
|
|
1884
|
+
},
|
|
1885
|
+
{
|
|
1886
|
+
name: "Extension",
|
|
1887
|
+
type: "game_components_interfaces::prize::ExtensionPrizePayload"
|
|
1888
|
+
}
|
|
1889
|
+
]
|
|
1890
|
+
},
|
|
1891
|
+
{
|
|
1892
|
+
type: "struct",
|
|
1893
|
+
name: "game_components_interfaces::prize::PrizeRecord",
|
|
1770
1894
|
members: [
|
|
1771
1895
|
{
|
|
1772
1896
|
name: "id",
|
|
@@ -1777,16 +1901,12 @@ var budokanViewer_default = [
|
|
|
1777
1901
|
type: "core::integer::u64"
|
|
1778
1902
|
},
|
|
1779
1903
|
{
|
|
1780
|
-
name: "
|
|
1904
|
+
name: "sponsor_address",
|
|
1781
1905
|
type: "core::starknet::contract_address::ContractAddress"
|
|
1782
1906
|
},
|
|
1783
1907
|
{
|
|
1784
|
-
name: "
|
|
1785
|
-
type: "game_components_interfaces::prize::
|
|
1786
|
-
},
|
|
1787
|
-
{
|
|
1788
|
-
name: "sponsor_address",
|
|
1789
|
-
type: "core::starknet::contract_address::ContractAddress"
|
|
1908
|
+
name: "prize",
|
|
1909
|
+
type: "game_components_interfaces::prize::Prize"
|
|
1790
1910
|
}
|
|
1791
1911
|
]
|
|
1792
1912
|
},
|
|
@@ -1804,6 +1924,52 @@ var budokanViewer_default = [
|
|
|
1804
1924
|
}
|
|
1805
1925
|
]
|
|
1806
1926
|
},
|
|
1927
|
+
{
|
|
1928
|
+
type: "enum",
|
|
1929
|
+
name: "core::option::Option::<core::felt252>",
|
|
1930
|
+
variants: [
|
|
1931
|
+
{
|
|
1932
|
+
name: "Some",
|
|
1933
|
+
type: "core::felt252"
|
|
1934
|
+
},
|
|
1935
|
+
{
|
|
1936
|
+
name: "None",
|
|
1937
|
+
type: "()"
|
|
1938
|
+
}
|
|
1939
|
+
]
|
|
1940
|
+
},
|
|
1941
|
+
{
|
|
1942
|
+
type: "struct",
|
|
1943
|
+
name: "budokan_interfaces::budokan::ExtensionPrizeClaim",
|
|
1944
|
+
members: [
|
|
1945
|
+
{
|
|
1946
|
+
name: "prize_id",
|
|
1947
|
+
type: "core::integer::u64"
|
|
1948
|
+
},
|
|
1949
|
+
{
|
|
1950
|
+
name: "token_id",
|
|
1951
|
+
type: "core::option::Option::<core::felt252>"
|
|
1952
|
+
},
|
|
1953
|
+
{
|
|
1954
|
+
name: "payout_params",
|
|
1955
|
+
type: "core::array::Span::<core::felt252>"
|
|
1956
|
+
}
|
|
1957
|
+
]
|
|
1958
|
+
},
|
|
1959
|
+
{
|
|
1960
|
+
type: "enum",
|
|
1961
|
+
name: "budokan_interfaces::budokan::PrizeClaim",
|
|
1962
|
+
variants: [
|
|
1963
|
+
{
|
|
1964
|
+
name: "Token",
|
|
1965
|
+
type: "game_components_interfaces::prize::PrizeType"
|
|
1966
|
+
},
|
|
1967
|
+
{
|
|
1968
|
+
name: "Extension",
|
|
1969
|
+
type: "budokan_interfaces::budokan::ExtensionPrizeClaim"
|
|
1970
|
+
}
|
|
1971
|
+
]
|
|
1972
|
+
},
|
|
1807
1973
|
{
|
|
1808
1974
|
type: "enum",
|
|
1809
1975
|
name: "budokan_interfaces::budokan::EntryFeeRewardType",
|
|
@@ -1826,17 +1992,45 @@ var budokanViewer_default = [
|
|
|
1826
1992
|
}
|
|
1827
1993
|
]
|
|
1828
1994
|
},
|
|
1995
|
+
{
|
|
1996
|
+
type: "struct",
|
|
1997
|
+
name: "budokan_interfaces::budokan::ExtensionEntryFeeClaim",
|
|
1998
|
+
members: [
|
|
1999
|
+
{
|
|
2000
|
+
name: "token_id",
|
|
2001
|
+
type: "core::option::Option::<core::felt252>"
|
|
2002
|
+
},
|
|
2003
|
+
{
|
|
2004
|
+
name: "claim_params",
|
|
2005
|
+
type: "core::array::Span::<core::felt252>"
|
|
2006
|
+
}
|
|
2007
|
+
]
|
|
2008
|
+
},
|
|
2009
|
+
{
|
|
2010
|
+
type: "enum",
|
|
2011
|
+
name: "budokan_interfaces::budokan::EntryFeeClaim",
|
|
2012
|
+
variants: [
|
|
2013
|
+
{
|
|
2014
|
+
name: "Token",
|
|
2015
|
+
type: "budokan_interfaces::budokan::EntryFeeRewardType"
|
|
2016
|
+
},
|
|
2017
|
+
{
|
|
2018
|
+
name: "Extension",
|
|
2019
|
+
type: "budokan_interfaces::budokan::ExtensionEntryFeeClaim"
|
|
2020
|
+
}
|
|
2021
|
+
]
|
|
2022
|
+
},
|
|
1829
2023
|
{
|
|
1830
2024
|
type: "enum",
|
|
1831
2025
|
name: "budokan_interfaces::budokan::RewardType",
|
|
1832
2026
|
variants: [
|
|
1833
2027
|
{
|
|
1834
2028
|
name: "Prize",
|
|
1835
|
-
type: "
|
|
2029
|
+
type: "budokan_interfaces::budokan::PrizeClaim"
|
|
1836
2030
|
},
|
|
1837
2031
|
{
|
|
1838
2032
|
name: "EntryFee",
|
|
1839
|
-
type: "budokan_interfaces::budokan::
|
|
2033
|
+
type: "budokan_interfaces::budokan::EntryFeeClaim"
|
|
1840
2034
|
}
|
|
1841
2035
|
]
|
|
1842
2036
|
},
|
|
@@ -2127,6 +2321,62 @@ var budokanViewer_default = [
|
|
|
2127
2321
|
],
|
|
2128
2322
|
state_mutability: "view"
|
|
2129
2323
|
},
|
|
2324
|
+
{
|
|
2325
|
+
type: "function",
|
|
2326
|
+
name: "tournament_registrations_by_owner",
|
|
2327
|
+
inputs: [
|
|
2328
|
+
{
|
|
2329
|
+
name: "tournament_id",
|
|
2330
|
+
type: "core::integer::u64"
|
|
2331
|
+
},
|
|
2332
|
+
{
|
|
2333
|
+
name: "owner",
|
|
2334
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
2335
|
+
},
|
|
2336
|
+
{
|
|
2337
|
+
name: "offset",
|
|
2338
|
+
type: "core::integer::u32"
|
|
2339
|
+
},
|
|
2340
|
+
{
|
|
2341
|
+
name: "limit",
|
|
2342
|
+
type: "core::integer::u32"
|
|
2343
|
+
}
|
|
2344
|
+
],
|
|
2345
|
+
outputs: [
|
|
2346
|
+
{
|
|
2347
|
+
type: "budokan_interfaces::viewer::RegistrationResult"
|
|
2348
|
+
}
|
|
2349
|
+
],
|
|
2350
|
+
state_mutability: "view"
|
|
2351
|
+
},
|
|
2352
|
+
{
|
|
2353
|
+
type: "function",
|
|
2354
|
+
name: "tournament_registrations_by_token_ids",
|
|
2355
|
+
inputs: [
|
|
2356
|
+
{
|
|
2357
|
+
name: "tournament_id",
|
|
2358
|
+
type: "core::integer::u64"
|
|
2359
|
+
},
|
|
2360
|
+
{
|
|
2361
|
+
name: "token_ids",
|
|
2362
|
+
type: "core::array::Array::<core::felt252>"
|
|
2363
|
+
},
|
|
2364
|
+
{
|
|
2365
|
+
name: "offset",
|
|
2366
|
+
type: "core::integer::u32"
|
|
2367
|
+
},
|
|
2368
|
+
{
|
|
2369
|
+
name: "limit",
|
|
2370
|
+
type: "core::integer::u32"
|
|
2371
|
+
}
|
|
2372
|
+
],
|
|
2373
|
+
outputs: [
|
|
2374
|
+
{
|
|
2375
|
+
type: "budokan_interfaces::viewer::RegistrationResult"
|
|
2376
|
+
}
|
|
2377
|
+
],
|
|
2378
|
+
state_mutability: "view"
|
|
2379
|
+
},
|
|
2130
2380
|
{
|
|
2131
2381
|
type: "function",
|
|
2132
2382
|
name: "leaderboard",
|
|
@@ -2162,7 +2412,7 @@ var budokanViewer_default = [
|
|
|
2162
2412
|
],
|
|
2163
2413
|
outputs: [
|
|
2164
2414
|
{
|
|
2165
|
-
type: "core::array::Array::<game_components_interfaces::prize::
|
|
2415
|
+
type: "core::array::Array::<game_components_interfaces::prize::PrizeRecord>"
|
|
2166
2416
|
}
|
|
2167
2417
|
],
|
|
2168
2418
|
state_mutability: "view"
|
|
@@ -2423,35 +2673,69 @@ var budokan_default = [
|
|
|
2423
2673
|
},
|
|
2424
2674
|
{
|
|
2425
2675
|
type: "impl",
|
|
2426
|
-
name: "
|
|
2427
|
-
interface_name: "
|
|
2428
|
-
},
|
|
2429
|
-
{
|
|
2430
|
-
type: "enum",
|
|
2431
|
-
name: "core::bool",
|
|
2432
|
-
variants: [
|
|
2433
|
-
{
|
|
2434
|
-
name: "False",
|
|
2435
|
-
type: "()"
|
|
2436
|
-
},
|
|
2437
|
-
{
|
|
2438
|
-
name: "True",
|
|
2439
|
-
type: "()"
|
|
2440
|
-
}
|
|
2441
|
-
]
|
|
2676
|
+
name: "BudokanRewardsAdminImpl",
|
|
2677
|
+
interface_name: "budokan::budokan::Budokan::IBudokanRewardsAdmin"
|
|
2442
2678
|
},
|
|
2443
2679
|
{
|
|
2444
2680
|
type: "interface",
|
|
2445
|
-
name: "
|
|
2681
|
+
name: "budokan::budokan::Budokan::IBudokanRewardsAdmin",
|
|
2446
2682
|
items: [
|
|
2447
2683
|
{
|
|
2448
2684
|
type: "function",
|
|
2449
|
-
name: "
|
|
2685
|
+
name: "set_rewards_class_hash",
|
|
2450
2686
|
inputs: [
|
|
2451
2687
|
{
|
|
2452
|
-
name: "
|
|
2453
|
-
type: "core::
|
|
2454
|
-
}
|
|
2688
|
+
name: "new_class_hash",
|
|
2689
|
+
type: "core::starknet::class_hash::ClassHash"
|
|
2690
|
+
}
|
|
2691
|
+
],
|
|
2692
|
+
outputs: [],
|
|
2693
|
+
state_mutability: "external"
|
|
2694
|
+
},
|
|
2695
|
+
{
|
|
2696
|
+
type: "function",
|
|
2697
|
+
name: "rewards_class_hash",
|
|
2698
|
+
inputs: [],
|
|
2699
|
+
outputs: [
|
|
2700
|
+
{
|
|
2701
|
+
type: "core::starknet::class_hash::ClassHash"
|
|
2702
|
+
}
|
|
2703
|
+
],
|
|
2704
|
+
state_mutability: "view"
|
|
2705
|
+
}
|
|
2706
|
+
]
|
|
2707
|
+
},
|
|
2708
|
+
{
|
|
2709
|
+
type: "impl",
|
|
2710
|
+
name: "GameContextImpl",
|
|
2711
|
+
interface_name: "game_components_interfaces::metagame::context::IMetagameContext"
|
|
2712
|
+
},
|
|
2713
|
+
{
|
|
2714
|
+
type: "enum",
|
|
2715
|
+
name: "core::bool",
|
|
2716
|
+
variants: [
|
|
2717
|
+
{
|
|
2718
|
+
name: "False",
|
|
2719
|
+
type: "()"
|
|
2720
|
+
},
|
|
2721
|
+
{
|
|
2722
|
+
name: "True",
|
|
2723
|
+
type: "()"
|
|
2724
|
+
}
|
|
2725
|
+
]
|
|
2726
|
+
},
|
|
2727
|
+
{
|
|
2728
|
+
type: "interface",
|
|
2729
|
+
name: "game_components_interfaces::metagame::context::IMetagameContext",
|
|
2730
|
+
items: [
|
|
2731
|
+
{
|
|
2732
|
+
type: "function",
|
|
2733
|
+
name: "has_context",
|
|
2734
|
+
inputs: [
|
|
2735
|
+
{
|
|
2736
|
+
name: "token_id",
|
|
2737
|
+
type: "core::felt252"
|
|
2738
|
+
}
|
|
2455
2739
|
],
|
|
2456
2740
|
outputs: [
|
|
2457
2741
|
{
|
|
@@ -2505,11 +2789,11 @@ var budokan_default = [
|
|
|
2505
2789
|
members: [
|
|
2506
2790
|
{
|
|
2507
2791
|
name: "name",
|
|
2508
|
-
type: "core::
|
|
2792
|
+
type: "core::felt252"
|
|
2509
2793
|
},
|
|
2510
2794
|
{
|
|
2511
2795
|
name: "value",
|
|
2512
|
-
type: "core::
|
|
2796
|
+
type: "core::felt252"
|
|
2513
2797
|
}
|
|
2514
2798
|
]
|
|
2515
2799
|
},
|
|
@@ -2737,50 +3021,54 @@ var budokan_default = [
|
|
|
2737
3021
|
]
|
|
2738
3022
|
},
|
|
2739
3023
|
{
|
|
2740
|
-
type: "
|
|
2741
|
-
name: "core::
|
|
2742
|
-
|
|
2743
|
-
{
|
|
2744
|
-
name: "Some",
|
|
2745
|
-
type: "budokan_interfaces::budokan::EntryFee"
|
|
2746
|
-
},
|
|
3024
|
+
type: "struct",
|
|
3025
|
+
name: "core::array::Span::<core::felt252>",
|
|
3026
|
+
members: [
|
|
2747
3027
|
{
|
|
2748
|
-
name: "
|
|
2749
|
-
type: "
|
|
3028
|
+
name: "snapshot",
|
|
3029
|
+
type: "@core::array::Array::<core::felt252>"
|
|
2750
3030
|
}
|
|
2751
3031
|
]
|
|
2752
3032
|
},
|
|
2753
3033
|
{
|
|
2754
3034
|
type: "struct",
|
|
2755
|
-
name: "
|
|
3035
|
+
name: "metagame_extensions_interfaces::extension::ExtensionConfig",
|
|
2756
3036
|
members: [
|
|
2757
3037
|
{
|
|
2758
|
-
name: "
|
|
2759
|
-
type: "
|
|
3038
|
+
name: "address",
|
|
3039
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
3040
|
+
},
|
|
3041
|
+
{
|
|
3042
|
+
name: "config",
|
|
3043
|
+
type: "core::array::Span::<core::felt252>"
|
|
2760
3044
|
}
|
|
2761
3045
|
]
|
|
2762
3046
|
},
|
|
2763
3047
|
{
|
|
2764
|
-
type: "
|
|
2765
|
-
name: "
|
|
2766
|
-
|
|
3048
|
+
type: "enum",
|
|
3049
|
+
name: "budokan_interfaces::budokan::EntryFeeKind",
|
|
3050
|
+
variants: [
|
|
2767
3051
|
{
|
|
2768
|
-
name: "
|
|
2769
|
-
type: "
|
|
3052
|
+
name: "BuiltIn",
|
|
3053
|
+
type: "budokan_interfaces::budokan::EntryFee"
|
|
3054
|
+
},
|
|
3055
|
+
{
|
|
3056
|
+
name: "Extension",
|
|
3057
|
+
type: "metagame_extensions_interfaces::extension::ExtensionConfig"
|
|
2770
3058
|
}
|
|
2771
3059
|
]
|
|
2772
3060
|
},
|
|
2773
3061
|
{
|
|
2774
|
-
type: "
|
|
2775
|
-
name: "
|
|
2776
|
-
|
|
3062
|
+
type: "enum",
|
|
3063
|
+
name: "core::option::Option::<budokan_interfaces::budokan::EntryFeeKind>",
|
|
3064
|
+
variants: [
|
|
2777
3065
|
{
|
|
2778
|
-
name: "
|
|
2779
|
-
type: "
|
|
3066
|
+
name: "Some",
|
|
3067
|
+
type: "budokan_interfaces::budokan::EntryFeeKind"
|
|
2780
3068
|
},
|
|
2781
3069
|
{
|
|
2782
|
-
name: "
|
|
2783
|
-
type: "
|
|
3070
|
+
name: "None",
|
|
3071
|
+
type: "()"
|
|
2784
3072
|
}
|
|
2785
3073
|
]
|
|
2786
3074
|
},
|
|
@@ -2794,7 +3082,7 @@ var budokan_default = [
|
|
|
2794
3082
|
},
|
|
2795
3083
|
{
|
|
2796
3084
|
name: "extension",
|
|
2797
|
-
type: "
|
|
3085
|
+
type: "metagame_extensions_interfaces::extension::ExtensionConfig"
|
|
2798
3086
|
}
|
|
2799
3087
|
]
|
|
2800
3088
|
},
|
|
@@ -2874,7 +3162,7 @@ var budokan_default = [
|
|
|
2874
3162
|
},
|
|
2875
3163
|
{
|
|
2876
3164
|
name: "entry_fee",
|
|
2877
|
-
type: "core::option::Option::<budokan_interfaces::budokan::
|
|
3165
|
+
type: "core::option::Option::<budokan_interfaces::budokan::EntryFeeKind>"
|
|
2878
3166
|
},
|
|
2879
3167
|
{
|
|
2880
3168
|
name: "entry_requirement",
|
|
@@ -2916,6 +3204,20 @@ var budokan_default = [
|
|
|
2916
3204
|
}
|
|
2917
3205
|
]
|
|
2918
3206
|
},
|
|
3207
|
+
{
|
|
3208
|
+
type: "enum",
|
|
3209
|
+
name: "core::option::Option::<core::felt252>",
|
|
3210
|
+
variants: [
|
|
3211
|
+
{
|
|
3212
|
+
name: "Some",
|
|
3213
|
+
type: "core::felt252"
|
|
3214
|
+
},
|
|
3215
|
+
{
|
|
3216
|
+
name: "None",
|
|
3217
|
+
type: "()"
|
|
3218
|
+
}
|
|
3219
|
+
]
|
|
3220
|
+
},
|
|
2919
3221
|
{
|
|
2920
3222
|
type: "struct",
|
|
2921
3223
|
name: "core::integer::u256",
|
|
@@ -2948,10 +3250,6 @@ var budokan_default = [
|
|
|
2948
3250
|
name: "NFT",
|
|
2949
3251
|
type: "game_components_interfaces::entry_requirement::NFTQualification"
|
|
2950
3252
|
},
|
|
2951
|
-
{
|
|
2952
|
-
name: "Address",
|
|
2953
|
-
type: "core::starknet::contract_address::ContractAddress"
|
|
2954
|
-
},
|
|
2955
3253
|
{
|
|
2956
3254
|
name: "Extension",
|
|
2957
3255
|
type: "core::array::Span::<core::felt252>"
|
|
@@ -2972,6 +3270,38 @@ var budokan_default = [
|
|
|
2972
3270
|
}
|
|
2973
3271
|
]
|
|
2974
3272
|
},
|
|
3273
|
+
{
|
|
3274
|
+
type: "enum",
|
|
3275
|
+
name: "core::option::Option::<core::array::Span::<core::felt252>>",
|
|
3276
|
+
variants: [
|
|
3277
|
+
{
|
|
3278
|
+
name: "Some",
|
|
3279
|
+
type: "core::array::Span::<core::felt252>"
|
|
3280
|
+
},
|
|
3281
|
+
{
|
|
3282
|
+
name: "None",
|
|
3283
|
+
type: "()"
|
|
3284
|
+
}
|
|
3285
|
+
]
|
|
3286
|
+
},
|
|
3287
|
+
{
|
|
3288
|
+
type: "struct",
|
|
3289
|
+
name: "budokan_interfaces::budokan::TournamentRecipientParams",
|
|
3290
|
+
members: [
|
|
3291
|
+
{
|
|
3292
|
+
name: "player_address",
|
|
3293
|
+
type: "core::option::Option::<core::starknet::contract_address::ContractAddress>"
|
|
3294
|
+
},
|
|
3295
|
+
{
|
|
3296
|
+
name: "qualifier",
|
|
3297
|
+
type: "core::option::Option::<core::starknet::contract_address::ContractAddress>"
|
|
3298
|
+
},
|
|
3299
|
+
{
|
|
3300
|
+
name: "qualification",
|
|
3301
|
+
type: "core::option::Option::<game_components_interfaces::entry_requirement::QualificationProof>"
|
|
3302
|
+
}
|
|
3303
|
+
]
|
|
3304
|
+
},
|
|
2975
3305
|
{
|
|
2976
3306
|
type: "enum",
|
|
2977
3307
|
name: "game_components_interfaces::prize::PrizeType",
|
|
@@ -2986,6 +3316,38 @@ var budokan_default = [
|
|
|
2986
3316
|
}
|
|
2987
3317
|
]
|
|
2988
3318
|
},
|
|
3319
|
+
{
|
|
3320
|
+
type: "struct",
|
|
3321
|
+
name: "budokan_interfaces::budokan::ExtensionPrizeClaim",
|
|
3322
|
+
members: [
|
|
3323
|
+
{
|
|
3324
|
+
name: "prize_id",
|
|
3325
|
+
type: "core::integer::u64"
|
|
3326
|
+
},
|
|
3327
|
+
{
|
|
3328
|
+
name: "token_id",
|
|
3329
|
+
type: "core::option::Option::<core::felt252>"
|
|
3330
|
+
},
|
|
3331
|
+
{
|
|
3332
|
+
name: "payout_params",
|
|
3333
|
+
type: "core::array::Span::<core::felt252>"
|
|
3334
|
+
}
|
|
3335
|
+
]
|
|
3336
|
+
},
|
|
3337
|
+
{
|
|
3338
|
+
type: "enum",
|
|
3339
|
+
name: "budokan_interfaces::budokan::PrizeClaim",
|
|
3340
|
+
variants: [
|
|
3341
|
+
{
|
|
3342
|
+
name: "Token",
|
|
3343
|
+
type: "game_components_interfaces::prize::PrizeType"
|
|
3344
|
+
},
|
|
3345
|
+
{
|
|
3346
|
+
name: "Extension",
|
|
3347
|
+
type: "budokan_interfaces::budokan::ExtensionPrizeClaim"
|
|
3348
|
+
}
|
|
3349
|
+
]
|
|
3350
|
+
},
|
|
2989
3351
|
{
|
|
2990
3352
|
type: "enum",
|
|
2991
3353
|
name: "budokan_interfaces::budokan::EntryFeeRewardType",
|
|
@@ -3008,17 +3370,45 @@ var budokan_default = [
|
|
|
3008
3370
|
}
|
|
3009
3371
|
]
|
|
3010
3372
|
},
|
|
3373
|
+
{
|
|
3374
|
+
type: "struct",
|
|
3375
|
+
name: "budokan_interfaces::budokan::ExtensionEntryFeeClaim",
|
|
3376
|
+
members: [
|
|
3377
|
+
{
|
|
3378
|
+
name: "token_id",
|
|
3379
|
+
type: "core::option::Option::<core::felt252>"
|
|
3380
|
+
},
|
|
3381
|
+
{
|
|
3382
|
+
name: "claim_params",
|
|
3383
|
+
type: "core::array::Span::<core::felt252>"
|
|
3384
|
+
}
|
|
3385
|
+
]
|
|
3386
|
+
},
|
|
3387
|
+
{
|
|
3388
|
+
type: "enum",
|
|
3389
|
+
name: "budokan_interfaces::budokan::EntryFeeClaim",
|
|
3390
|
+
variants: [
|
|
3391
|
+
{
|
|
3392
|
+
name: "Token",
|
|
3393
|
+
type: "budokan_interfaces::budokan::EntryFeeRewardType"
|
|
3394
|
+
},
|
|
3395
|
+
{
|
|
3396
|
+
name: "Extension",
|
|
3397
|
+
type: "budokan_interfaces::budokan::ExtensionEntryFeeClaim"
|
|
3398
|
+
}
|
|
3399
|
+
]
|
|
3400
|
+
},
|
|
3011
3401
|
{
|
|
3012
3402
|
type: "enum",
|
|
3013
3403
|
name: "budokan_interfaces::budokan::RewardType",
|
|
3014
3404
|
variants: [
|
|
3015
3405
|
{
|
|
3016
3406
|
name: "Prize",
|
|
3017
|
-
type: "
|
|
3407
|
+
type: "budokan_interfaces::budokan::PrizeClaim"
|
|
3018
3408
|
},
|
|
3019
3409
|
{
|
|
3020
3410
|
name: "EntryFee",
|
|
3021
|
-
type: "budokan_interfaces::budokan::
|
|
3411
|
+
type: "budokan_interfaces::budokan::EntryFeeClaim"
|
|
3022
3412
|
}
|
|
3023
3413
|
]
|
|
3024
3414
|
},
|
|
@@ -3080,16 +3470,8 @@ var budokan_default = [
|
|
|
3080
3470
|
},
|
|
3081
3471
|
{
|
|
3082
3472
|
type: "struct",
|
|
3083
|
-
name: "game_components_interfaces::prize::
|
|
3473
|
+
name: "game_components_interfaces::prize::TokenPrizePayload",
|
|
3084
3474
|
members: [
|
|
3085
|
-
{
|
|
3086
|
-
name: "id",
|
|
3087
|
-
type: "core::integer::u64"
|
|
3088
|
-
},
|
|
3089
|
-
{
|
|
3090
|
-
name: "context_id",
|
|
3091
|
-
type: "core::integer::u64"
|
|
3092
|
-
},
|
|
3093
3475
|
{
|
|
3094
3476
|
name: "token_address",
|
|
3095
3477
|
type: "core::starknet::contract_address::ContractAddress"
|
|
@@ -3097,10 +3479,34 @@ var budokan_default = [
|
|
|
3097
3479
|
{
|
|
3098
3480
|
name: "token_type",
|
|
3099
3481
|
type: "game_components_interfaces::prize::TokenTypeData"
|
|
3100
|
-
}
|
|
3482
|
+
}
|
|
3483
|
+
]
|
|
3484
|
+
},
|
|
3485
|
+
{
|
|
3486
|
+
type: "struct",
|
|
3487
|
+
name: "game_components_interfaces::prize::ExtensionPrizePayload",
|
|
3488
|
+
members: [
|
|
3101
3489
|
{
|
|
3102
|
-
name: "
|
|
3490
|
+
name: "address",
|
|
3103
3491
|
type: "core::starknet::contract_address::ContractAddress"
|
|
3492
|
+
},
|
|
3493
|
+
{
|
|
3494
|
+
name: "config",
|
|
3495
|
+
type: "core::array::Span::<core::felt252>"
|
|
3496
|
+
}
|
|
3497
|
+
]
|
|
3498
|
+
},
|
|
3499
|
+
{
|
|
3500
|
+
type: "enum",
|
|
3501
|
+
name: "game_components_interfaces::prize::Prize",
|
|
3502
|
+
variants: [
|
|
3503
|
+
{
|
|
3504
|
+
name: "Token",
|
|
3505
|
+
type: "game_components_interfaces::prize::TokenPrizePayload"
|
|
3506
|
+
},
|
|
3507
|
+
{
|
|
3508
|
+
name: "Extension",
|
|
3509
|
+
type: "game_components_interfaces::prize::ExtensionPrizePayload"
|
|
3104
3510
|
}
|
|
3105
3511
|
]
|
|
3106
3512
|
},
|
|
@@ -3135,38 +3541,6 @@ var budokan_default = [
|
|
|
3135
3541
|
],
|
|
3136
3542
|
state_mutability: "view"
|
|
3137
3543
|
},
|
|
3138
|
-
{
|
|
3139
|
-
type: "function",
|
|
3140
|
-
name: "tournament_entries",
|
|
3141
|
-
inputs: [
|
|
3142
|
-
{
|
|
3143
|
-
name: "tournament_id",
|
|
3144
|
-
type: "core::integer::u64"
|
|
3145
|
-
}
|
|
3146
|
-
],
|
|
3147
|
-
outputs: [
|
|
3148
|
-
{
|
|
3149
|
-
type: "core::integer::u32"
|
|
3150
|
-
}
|
|
3151
|
-
],
|
|
3152
|
-
state_mutability: "view"
|
|
3153
|
-
},
|
|
3154
|
-
{
|
|
3155
|
-
type: "function",
|
|
3156
|
-
name: "get_leaderboard",
|
|
3157
|
-
inputs: [
|
|
3158
|
-
{
|
|
3159
|
-
name: "tournament_id",
|
|
3160
|
-
type: "core::integer::u64"
|
|
3161
|
-
}
|
|
3162
|
-
],
|
|
3163
|
-
outputs: [
|
|
3164
|
-
{
|
|
3165
|
-
type: "core::array::Array::<core::felt252>"
|
|
3166
|
-
}
|
|
3167
|
-
],
|
|
3168
|
-
state_mutability: "view"
|
|
3169
|
-
},
|
|
3170
3544
|
{
|
|
3171
3545
|
type: "function",
|
|
3172
3546
|
name: "current_phase",
|
|
@@ -3221,7 +3595,7 @@ var budokan_default = [
|
|
|
3221
3595
|
},
|
|
3222
3596
|
{
|
|
3223
3597
|
name: "entry_fee",
|
|
3224
|
-
type: "core::option::Option::<budokan_interfaces::budokan::
|
|
3598
|
+
type: "core::option::Option::<budokan_interfaces::budokan::EntryFeeKind>"
|
|
3225
3599
|
},
|
|
3226
3600
|
{
|
|
3227
3601
|
name: "entry_requirement",
|
|
@@ -3257,16 +3631,24 @@ var budokan_default = [
|
|
|
3257
3631
|
},
|
|
3258
3632
|
{
|
|
3259
3633
|
name: "player_name",
|
|
3260
|
-
type: "core::felt252"
|
|
3634
|
+
type: "core::option::Option::<core::felt252>"
|
|
3261
3635
|
},
|
|
3262
3636
|
{
|
|
3263
3637
|
name: "player_address",
|
|
3264
|
-
type: "core::starknet::contract_address::ContractAddress"
|
|
3638
|
+
type: "core::option::Option::<core::starknet::contract_address::ContractAddress>"
|
|
3265
3639
|
},
|
|
3266
3640
|
{
|
|
3267
|
-
name: "
|
|
3641
|
+
name: "qualifier",
|
|
3642
|
+
type: "core::option::Option::<core::starknet::contract_address::ContractAddress>"
|
|
3643
|
+
},
|
|
3644
|
+
{
|
|
3645
|
+
name: "qualification",
|
|
3268
3646
|
type: "core::option::Option::<game_components_interfaces::entry_requirement::QualificationProof>"
|
|
3269
3647
|
},
|
|
3648
|
+
{
|
|
3649
|
+
name: "entry_fee_pay_params",
|
|
3650
|
+
type: "core::option::Option::<core::array::Span::<core::felt252>>"
|
|
3651
|
+
},
|
|
3270
3652
|
{
|
|
3271
3653
|
name: "salt",
|
|
3272
3654
|
type: "core::integer::u16"
|
|
@@ -3283,6 +3665,38 @@ var budokan_default = [
|
|
|
3283
3665
|
],
|
|
3284
3666
|
state_mutability: "external"
|
|
3285
3667
|
},
|
|
3668
|
+
{
|
|
3669
|
+
type: "function",
|
|
3670
|
+
name: "enter_tournament_for_recipients",
|
|
3671
|
+
inputs: [
|
|
3672
|
+
{
|
|
3673
|
+
name: "tournament_id",
|
|
3674
|
+
type: "core::integer::u64"
|
|
3675
|
+
},
|
|
3676
|
+
{
|
|
3677
|
+
name: "recipients",
|
|
3678
|
+
type: "core::array::Array::<budokan_interfaces::budokan::TournamentRecipientParams>"
|
|
3679
|
+
},
|
|
3680
|
+
{
|
|
3681
|
+
name: "player_name",
|
|
3682
|
+
type: "core::option::Option::<core::felt252>"
|
|
3683
|
+
},
|
|
3684
|
+
{
|
|
3685
|
+
name: "salt",
|
|
3686
|
+
type: "core::integer::u16"
|
|
3687
|
+
},
|
|
3688
|
+
{
|
|
3689
|
+
name: "metadata_value",
|
|
3690
|
+
type: "core::integer::u16"
|
|
3691
|
+
}
|
|
3692
|
+
],
|
|
3693
|
+
outputs: [
|
|
3694
|
+
{
|
|
3695
|
+
type: "core::array::Array::<core::felt252>"
|
|
3696
|
+
}
|
|
3697
|
+
],
|
|
3698
|
+
state_mutability: "external"
|
|
3699
|
+
},
|
|
3286
3700
|
{
|
|
3287
3701
|
type: "function",
|
|
3288
3702
|
name: "ban_entry",
|
|
@@ -3348,12 +3762,8 @@ var budokan_default = [
|
|
|
3348
3762
|
type: "core::integer::u64"
|
|
3349
3763
|
},
|
|
3350
3764
|
{
|
|
3351
|
-
name: "
|
|
3352
|
-
type: "
|
|
3353
|
-
},
|
|
3354
|
-
{
|
|
3355
|
-
name: "token_type",
|
|
3356
|
-
type: "game_components_interfaces::prize::TokenTypeData"
|
|
3765
|
+
name: "prize",
|
|
3766
|
+
type: "game_components_interfaces::prize::Prize"
|
|
3357
3767
|
},
|
|
3358
3768
|
{
|
|
3359
3769
|
name: "position",
|
|
@@ -3362,7 +3772,7 @@ var budokan_default = [
|
|
|
3362
3772
|
],
|
|
3363
3773
|
outputs: [
|
|
3364
3774
|
{
|
|
3365
|
-
type: "
|
|
3775
|
+
type: "core::integer::u64"
|
|
3366
3776
|
}
|
|
3367
3777
|
],
|
|
3368
3778
|
state_mutability: "external"
|
|
@@ -3536,6 +3946,14 @@ var budokan_default = [
|
|
|
3536
3946
|
{
|
|
3537
3947
|
name: "additional_shares",
|
|
3538
3948
|
type: "core::array::Span::<game_components_interfaces::entry_fee::AdditionalShare>"
|
|
3949
|
+
},
|
|
3950
|
+
{
|
|
3951
|
+
name: "distribution",
|
|
3952
|
+
type: "core::option::Option::<game_components_interfaces::distribution::Distribution>"
|
|
3953
|
+
},
|
|
3954
|
+
{
|
|
3955
|
+
name: "distribution_count",
|
|
3956
|
+
type: "core::integer::u32"
|
|
3539
3957
|
}
|
|
3540
3958
|
]
|
|
3541
3959
|
},
|
|
@@ -3547,19 +3965,273 @@ var budokan_default = [
|
|
|
3547
3965
|
name: "Some",
|
|
3548
3966
|
type: "game_components_interfaces::entry_fee::EntryFeeConfig"
|
|
3549
3967
|
},
|
|
3550
|
-
{
|
|
3551
|
-
name: "None",
|
|
3552
|
-
type: "()"
|
|
3553
|
-
}
|
|
3554
|
-
]
|
|
3555
|
-
},
|
|
3556
|
-
{
|
|
3557
|
-
type: "interface",
|
|
3558
|
-
name: "game_components_interfaces::entry_fee::IEntryFee",
|
|
3559
|
-
items: [
|
|
3968
|
+
{
|
|
3969
|
+
name: "None",
|
|
3970
|
+
type: "()"
|
|
3971
|
+
}
|
|
3972
|
+
]
|
|
3973
|
+
},
|
|
3974
|
+
{
|
|
3975
|
+
type: "interface",
|
|
3976
|
+
name: "game_components_interfaces::entry_fee::IEntryFee",
|
|
3977
|
+
items: [
|
|
3978
|
+
{
|
|
3979
|
+
type: "function",
|
|
3980
|
+
name: "get_entry_fee",
|
|
3981
|
+
inputs: [
|
|
3982
|
+
{
|
|
3983
|
+
name: "context_id",
|
|
3984
|
+
type: "core::integer::u64"
|
|
3985
|
+
}
|
|
3986
|
+
],
|
|
3987
|
+
outputs: [
|
|
3988
|
+
{
|
|
3989
|
+
type: "core::option::Option::<game_components_interfaces::entry_fee::EntryFeeConfig>"
|
|
3990
|
+
}
|
|
3991
|
+
],
|
|
3992
|
+
state_mutability: "view"
|
|
3993
|
+
}
|
|
3994
|
+
]
|
|
3995
|
+
},
|
|
3996
|
+
{
|
|
3997
|
+
type: "impl",
|
|
3998
|
+
name: "EntryRequirementImpl",
|
|
3999
|
+
interface_name: "game_components_interfaces::entry_requirement::IEntryRequirement"
|
|
4000
|
+
},
|
|
4001
|
+
{
|
|
4002
|
+
type: "struct",
|
|
4003
|
+
name: "game_components_interfaces::entry_requirement::QualificationEntries",
|
|
4004
|
+
members: [
|
|
4005
|
+
{
|
|
4006
|
+
name: "context_id",
|
|
4007
|
+
type: "core::integer::u64"
|
|
4008
|
+
},
|
|
4009
|
+
{
|
|
4010
|
+
name: "qualification_proof",
|
|
4011
|
+
type: "game_components_interfaces::entry_requirement::QualificationProof"
|
|
4012
|
+
},
|
|
4013
|
+
{
|
|
4014
|
+
name: "entry_count",
|
|
4015
|
+
type: "core::integer::u32"
|
|
4016
|
+
}
|
|
4017
|
+
]
|
|
4018
|
+
},
|
|
4019
|
+
{
|
|
4020
|
+
type: "interface",
|
|
4021
|
+
name: "game_components_interfaces::entry_requirement::IEntryRequirement",
|
|
4022
|
+
items: [
|
|
4023
|
+
{
|
|
4024
|
+
type: "function",
|
|
4025
|
+
name: "get_entry_requirement",
|
|
4026
|
+
inputs: [
|
|
4027
|
+
{
|
|
4028
|
+
name: "context_id",
|
|
4029
|
+
type: "core::integer::u64"
|
|
4030
|
+
}
|
|
4031
|
+
],
|
|
4032
|
+
outputs: [
|
|
4033
|
+
{
|
|
4034
|
+
type: "core::option::Option::<game_components_interfaces::entry_requirement::EntryRequirement>"
|
|
4035
|
+
}
|
|
4036
|
+
],
|
|
4037
|
+
state_mutability: "view"
|
|
4038
|
+
},
|
|
4039
|
+
{
|
|
4040
|
+
type: "function",
|
|
4041
|
+
name: "get_qualification_entries",
|
|
4042
|
+
inputs: [
|
|
4043
|
+
{
|
|
4044
|
+
name: "context_id",
|
|
4045
|
+
type: "core::integer::u64"
|
|
4046
|
+
},
|
|
4047
|
+
{
|
|
4048
|
+
name: "proof",
|
|
4049
|
+
type: "game_components_interfaces::entry_requirement::QualificationProof"
|
|
4050
|
+
}
|
|
4051
|
+
],
|
|
4052
|
+
outputs: [
|
|
4053
|
+
{
|
|
4054
|
+
type: "game_components_interfaces::entry_requirement::QualificationEntries"
|
|
4055
|
+
}
|
|
4056
|
+
],
|
|
4057
|
+
state_mutability: "view"
|
|
4058
|
+
}
|
|
4059
|
+
]
|
|
4060
|
+
},
|
|
4061
|
+
{
|
|
4062
|
+
type: "impl",
|
|
4063
|
+
name: "PrizeImpl",
|
|
4064
|
+
interface_name: "game_components_interfaces::prize::IPrize"
|
|
4065
|
+
},
|
|
4066
|
+
{
|
|
4067
|
+
type: "struct",
|
|
4068
|
+
name: "game_components_interfaces::prize::PrizeRecord",
|
|
4069
|
+
members: [
|
|
4070
|
+
{
|
|
4071
|
+
name: "id",
|
|
4072
|
+
type: "core::integer::u64"
|
|
4073
|
+
},
|
|
4074
|
+
{
|
|
4075
|
+
name: "context_id",
|
|
4076
|
+
type: "core::integer::u64"
|
|
4077
|
+
},
|
|
4078
|
+
{
|
|
4079
|
+
name: "sponsor_address",
|
|
4080
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
4081
|
+
},
|
|
4082
|
+
{
|
|
4083
|
+
name: "prize",
|
|
4084
|
+
type: "game_components_interfaces::prize::Prize"
|
|
4085
|
+
}
|
|
4086
|
+
]
|
|
4087
|
+
},
|
|
4088
|
+
{
|
|
4089
|
+
type: "interface",
|
|
4090
|
+
name: "game_components_interfaces::prize::IPrize",
|
|
4091
|
+
items: [
|
|
4092
|
+
{
|
|
4093
|
+
type: "function",
|
|
4094
|
+
name: "get_prize",
|
|
4095
|
+
inputs: [
|
|
4096
|
+
{
|
|
4097
|
+
name: "prize_id",
|
|
4098
|
+
type: "core::integer::u64"
|
|
4099
|
+
}
|
|
4100
|
+
],
|
|
4101
|
+
outputs: [
|
|
4102
|
+
{
|
|
4103
|
+
type: "game_components_interfaces::prize::PrizeRecord"
|
|
4104
|
+
}
|
|
4105
|
+
],
|
|
4106
|
+
state_mutability: "view"
|
|
4107
|
+
},
|
|
4108
|
+
{
|
|
4109
|
+
type: "function",
|
|
4110
|
+
name: "get_total_prizes",
|
|
4111
|
+
inputs: [],
|
|
4112
|
+
outputs: [
|
|
4113
|
+
{
|
|
4114
|
+
type: "core::integer::u64"
|
|
4115
|
+
}
|
|
4116
|
+
],
|
|
4117
|
+
state_mutability: "view"
|
|
4118
|
+
},
|
|
4119
|
+
{
|
|
4120
|
+
type: "function",
|
|
4121
|
+
name: "is_prize_claimed",
|
|
4122
|
+
inputs: [
|
|
4123
|
+
{
|
|
4124
|
+
name: "context_id",
|
|
4125
|
+
type: "core::integer::u64"
|
|
4126
|
+
},
|
|
4127
|
+
{
|
|
4128
|
+
name: "prize_type",
|
|
4129
|
+
type: "game_components_interfaces::prize::PrizeType"
|
|
4130
|
+
}
|
|
4131
|
+
],
|
|
4132
|
+
outputs: [
|
|
4133
|
+
{
|
|
4134
|
+
type: "core::bool"
|
|
4135
|
+
}
|
|
4136
|
+
],
|
|
4137
|
+
state_mutability: "view"
|
|
4138
|
+
}
|
|
4139
|
+
]
|
|
4140
|
+
},
|
|
4141
|
+
{
|
|
4142
|
+
type: "impl",
|
|
4143
|
+
name: "RegistrationImpl",
|
|
4144
|
+
interface_name: "game_components_interfaces::registration::IRegistration"
|
|
4145
|
+
},
|
|
4146
|
+
{
|
|
4147
|
+
type: "struct",
|
|
4148
|
+
name: "game_components_interfaces::registration::Registration",
|
|
4149
|
+
members: [
|
|
4150
|
+
{
|
|
4151
|
+
name: "context_id",
|
|
4152
|
+
type: "core::integer::u64"
|
|
4153
|
+
},
|
|
4154
|
+
{
|
|
4155
|
+
name: "entry_id",
|
|
4156
|
+
type: "core::integer::u32"
|
|
4157
|
+
},
|
|
4158
|
+
{
|
|
4159
|
+
name: "game_token_id",
|
|
4160
|
+
type: "core::felt252"
|
|
4161
|
+
},
|
|
4162
|
+
{
|
|
4163
|
+
name: "has_submitted",
|
|
4164
|
+
type: "core::bool"
|
|
4165
|
+
},
|
|
4166
|
+
{
|
|
4167
|
+
name: "is_banned",
|
|
4168
|
+
type: "core::bool"
|
|
4169
|
+
}
|
|
4170
|
+
]
|
|
4171
|
+
},
|
|
4172
|
+
{
|
|
4173
|
+
type: "interface",
|
|
4174
|
+
name: "game_components_interfaces::registration::IRegistration",
|
|
4175
|
+
items: [
|
|
4176
|
+
{
|
|
4177
|
+
type: "function",
|
|
4178
|
+
name: "get_entry",
|
|
4179
|
+
inputs: [
|
|
4180
|
+
{
|
|
4181
|
+
name: "context_id",
|
|
4182
|
+
type: "core::integer::u64"
|
|
4183
|
+
},
|
|
4184
|
+
{
|
|
4185
|
+
name: "entry_id",
|
|
4186
|
+
type: "core::integer::u32"
|
|
4187
|
+
}
|
|
4188
|
+
],
|
|
4189
|
+
outputs: [
|
|
4190
|
+
{
|
|
4191
|
+
type: "game_components_interfaces::registration::Registration"
|
|
4192
|
+
}
|
|
4193
|
+
],
|
|
4194
|
+
state_mutability: "view"
|
|
4195
|
+
},
|
|
4196
|
+
{
|
|
4197
|
+
type: "function",
|
|
4198
|
+
name: "entry_exists",
|
|
4199
|
+
inputs: [
|
|
4200
|
+
{
|
|
4201
|
+
name: "context_id",
|
|
4202
|
+
type: "core::integer::u64"
|
|
4203
|
+
},
|
|
4204
|
+
{
|
|
4205
|
+
name: "entry_id",
|
|
4206
|
+
type: "core::integer::u32"
|
|
4207
|
+
}
|
|
4208
|
+
],
|
|
4209
|
+
outputs: [
|
|
4210
|
+
{
|
|
4211
|
+
type: "core::bool"
|
|
4212
|
+
}
|
|
4213
|
+
],
|
|
4214
|
+
state_mutability: "view"
|
|
4215
|
+
},
|
|
4216
|
+
{
|
|
4217
|
+
type: "function",
|
|
4218
|
+
name: "is_token_banned",
|
|
4219
|
+
inputs: [
|
|
4220
|
+
{
|
|
4221
|
+
name: "token_id",
|
|
4222
|
+
type: "core::felt252"
|
|
4223
|
+
}
|
|
4224
|
+
],
|
|
4225
|
+
outputs: [
|
|
4226
|
+
{
|
|
4227
|
+
type: "core::bool"
|
|
4228
|
+
}
|
|
4229
|
+
],
|
|
4230
|
+
state_mutability: "view"
|
|
4231
|
+
},
|
|
3560
4232
|
{
|
|
3561
4233
|
type: "function",
|
|
3562
|
-
name: "
|
|
4234
|
+
name: "get_entry_count",
|
|
3563
4235
|
inputs: [
|
|
3564
4236
|
{
|
|
3565
4237
|
name: "context_id",
|
|
@@ -3568,7 +4240,7 @@ var budokan_default = [
|
|
|
3568
4240
|
],
|
|
3569
4241
|
outputs: [
|
|
3570
4242
|
{
|
|
3571
|
-
type: "core::
|
|
4243
|
+
type: "core::integer::u32"
|
|
3572
4244
|
}
|
|
3573
4245
|
],
|
|
3574
4246
|
state_mutability: "view"
|
|
@@ -3577,34 +4249,48 @@ var budokan_default = [
|
|
|
3577
4249
|
},
|
|
3578
4250
|
{
|
|
3579
4251
|
type: "impl",
|
|
3580
|
-
name: "
|
|
3581
|
-
interface_name: "game_components_interfaces::
|
|
4252
|
+
name: "LeaderboardImpl",
|
|
4253
|
+
interface_name: "game_components_interfaces::leaderboard::ILeaderboard"
|
|
3582
4254
|
},
|
|
3583
4255
|
{
|
|
3584
4256
|
type: "struct",
|
|
3585
|
-
name: "game_components_interfaces::
|
|
4257
|
+
name: "game_components_interfaces::structs::leaderboard::LeaderboardEntry",
|
|
3586
4258
|
members: [
|
|
3587
4259
|
{
|
|
3588
|
-
name: "
|
|
4260
|
+
name: "id",
|
|
4261
|
+
type: "core::felt252"
|
|
4262
|
+
},
|
|
4263
|
+
{
|
|
4264
|
+
name: "score",
|
|
3589
4265
|
type: "core::integer::u64"
|
|
4266
|
+
}
|
|
4267
|
+
]
|
|
4268
|
+
},
|
|
4269
|
+
{
|
|
4270
|
+
type: "struct",
|
|
4271
|
+
name: "game_components_interfaces::structs::leaderboard::LeaderboardStoreConfig",
|
|
4272
|
+
members: [
|
|
4273
|
+
{
|
|
4274
|
+
name: "max_entries",
|
|
4275
|
+
type: "core::integer::u32"
|
|
3590
4276
|
},
|
|
3591
4277
|
{
|
|
3592
|
-
name: "
|
|
3593
|
-
type: "
|
|
4278
|
+
name: "ascending",
|
|
4279
|
+
type: "core::bool"
|
|
3594
4280
|
},
|
|
3595
4281
|
{
|
|
3596
|
-
name: "
|
|
3597
|
-
type: "core::
|
|
4282
|
+
name: "game_address",
|
|
4283
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
3598
4284
|
}
|
|
3599
4285
|
]
|
|
3600
4286
|
},
|
|
3601
4287
|
{
|
|
3602
4288
|
type: "interface",
|
|
3603
|
-
name: "game_components_interfaces::
|
|
4289
|
+
name: "game_components_interfaces::leaderboard::ILeaderboard",
|
|
3604
4290
|
items: [
|
|
3605
4291
|
{
|
|
3606
4292
|
type: "function",
|
|
3607
|
-
name: "
|
|
4293
|
+
name: "get_leaderboard_entries",
|
|
3608
4294
|
inputs: [
|
|
3609
4295
|
{
|
|
3610
4296
|
name: "context_id",
|
|
@@ -3613,80 +4299,82 @@ var budokan_default = [
|
|
|
3613
4299
|
],
|
|
3614
4300
|
outputs: [
|
|
3615
4301
|
{
|
|
3616
|
-
type: "core::
|
|
4302
|
+
type: "core::array::Array::<game_components_interfaces::structs::leaderboard::LeaderboardEntry>"
|
|
3617
4303
|
}
|
|
3618
4304
|
],
|
|
3619
4305
|
state_mutability: "view"
|
|
3620
4306
|
},
|
|
3621
4307
|
{
|
|
3622
4308
|
type: "function",
|
|
3623
|
-
name: "
|
|
4309
|
+
name: "get_leaderboard_entry",
|
|
3624
4310
|
inputs: [
|
|
3625
4311
|
{
|
|
3626
4312
|
name: "context_id",
|
|
3627
4313
|
type: "core::integer::u64"
|
|
3628
4314
|
},
|
|
3629
4315
|
{
|
|
3630
|
-
name: "
|
|
3631
|
-
type: "
|
|
4316
|
+
name: "position",
|
|
4317
|
+
type: "core::integer::u32"
|
|
3632
4318
|
}
|
|
3633
4319
|
],
|
|
3634
4320
|
outputs: [
|
|
3635
4321
|
{
|
|
3636
|
-
type: "game_components_interfaces::
|
|
4322
|
+
type: "game_components_interfaces::structs::leaderboard::LeaderboardEntry"
|
|
3637
4323
|
}
|
|
3638
4324
|
],
|
|
3639
4325
|
state_mutability: "view"
|
|
3640
|
-
}
|
|
3641
|
-
]
|
|
3642
|
-
},
|
|
3643
|
-
{
|
|
3644
|
-
type: "impl",
|
|
3645
|
-
name: "PrizeImpl",
|
|
3646
|
-
interface_name: "game_components_interfaces::prize::IPrize"
|
|
3647
|
-
},
|
|
3648
|
-
{
|
|
3649
|
-
type: "interface",
|
|
3650
|
-
name: "game_components_interfaces::prize::IPrize",
|
|
3651
|
-
items: [
|
|
4326
|
+
},
|
|
3652
4327
|
{
|
|
3653
4328
|
type: "function",
|
|
3654
|
-
name: "
|
|
4329
|
+
name: "get_top_leaderboard_entries",
|
|
3655
4330
|
inputs: [
|
|
3656
4331
|
{
|
|
3657
|
-
name: "
|
|
4332
|
+
name: "context_id",
|
|
3658
4333
|
type: "core::integer::u64"
|
|
4334
|
+
},
|
|
4335
|
+
{
|
|
4336
|
+
name: "count",
|
|
4337
|
+
type: "core::integer::u32"
|
|
3659
4338
|
}
|
|
3660
4339
|
],
|
|
3661
4340
|
outputs: [
|
|
3662
4341
|
{
|
|
3663
|
-
type: "game_components_interfaces::
|
|
4342
|
+
type: "core::array::Array::<game_components_interfaces::structs::leaderboard::LeaderboardEntry>"
|
|
3664
4343
|
}
|
|
3665
4344
|
],
|
|
3666
4345
|
state_mutability: "view"
|
|
3667
4346
|
},
|
|
3668
4347
|
{
|
|
3669
4348
|
type: "function",
|
|
3670
|
-
name: "
|
|
3671
|
-
inputs: [
|
|
3672
|
-
outputs: [
|
|
4349
|
+
name: "get_position",
|
|
4350
|
+
inputs: [
|
|
3673
4351
|
{
|
|
4352
|
+
name: "context_id",
|
|
3674
4353
|
type: "core::integer::u64"
|
|
4354
|
+
},
|
|
4355
|
+
{
|
|
4356
|
+
name: "token_id",
|
|
4357
|
+
type: "core::felt252"
|
|
4358
|
+
}
|
|
4359
|
+
],
|
|
4360
|
+
outputs: [
|
|
4361
|
+
{
|
|
4362
|
+
type: "core::option::Option::<core::integer::u32>"
|
|
3675
4363
|
}
|
|
3676
4364
|
],
|
|
3677
4365
|
state_mutability: "view"
|
|
3678
4366
|
},
|
|
3679
4367
|
{
|
|
3680
4368
|
type: "function",
|
|
3681
|
-
name: "
|
|
4369
|
+
name: "qualifies",
|
|
3682
4370
|
inputs: [
|
|
3683
4371
|
{
|
|
3684
4372
|
name: "context_id",
|
|
3685
4373
|
type: "core::integer::u64"
|
|
3686
4374
|
},
|
|
3687
4375
|
{
|
|
3688
|
-
name: "
|
|
3689
|
-
type: "
|
|
4376
|
+
name: "score",
|
|
4377
|
+
type: "core::integer::u64"
|
|
3690
4378
|
}
|
|
3691
4379
|
],
|
|
3692
4380
|
outputs: [
|
|
@@ -3695,116 +4383,75 @@ var budokan_default = [
|
|
|
3695
4383
|
}
|
|
3696
4384
|
],
|
|
3697
4385
|
state_mutability: "view"
|
|
3698
|
-
}
|
|
3699
|
-
]
|
|
3700
|
-
},
|
|
3701
|
-
{
|
|
3702
|
-
type: "impl",
|
|
3703
|
-
name: "RegistrationImpl",
|
|
3704
|
-
interface_name: "game_components_interfaces::registration::IRegistration"
|
|
3705
|
-
},
|
|
3706
|
-
{
|
|
3707
|
-
type: "struct",
|
|
3708
|
-
name: "game_components_interfaces::registration::Registration",
|
|
3709
|
-
members: [
|
|
3710
|
-
{
|
|
3711
|
-
name: "context_id",
|
|
3712
|
-
type: "core::integer::u64"
|
|
3713
|
-
},
|
|
3714
|
-
{
|
|
3715
|
-
name: "entry_id",
|
|
3716
|
-
type: "core::integer::u32"
|
|
3717
|
-
},
|
|
3718
|
-
{
|
|
3719
|
-
name: "game_token_id",
|
|
3720
|
-
type: "core::felt252"
|
|
3721
|
-
},
|
|
3722
|
-
{
|
|
3723
|
-
name: "has_submitted",
|
|
3724
|
-
type: "core::bool"
|
|
3725
4386
|
},
|
|
3726
|
-
{
|
|
3727
|
-
name: "is_banned",
|
|
3728
|
-
type: "core::bool"
|
|
3729
|
-
}
|
|
3730
|
-
]
|
|
3731
|
-
},
|
|
3732
|
-
{
|
|
3733
|
-
type: "interface",
|
|
3734
|
-
name: "game_components_interfaces::registration::IRegistration",
|
|
3735
|
-
items: [
|
|
3736
4387
|
{
|
|
3737
4388
|
type: "function",
|
|
3738
|
-
name: "
|
|
4389
|
+
name: "is_full",
|
|
3739
4390
|
inputs: [
|
|
3740
4391
|
{
|
|
3741
4392
|
name: "context_id",
|
|
3742
4393
|
type: "core::integer::u64"
|
|
3743
|
-
},
|
|
3744
|
-
{
|
|
3745
|
-
name: "entry_id",
|
|
3746
|
-
type: "core::integer::u32"
|
|
3747
4394
|
}
|
|
3748
4395
|
],
|
|
3749
4396
|
outputs: [
|
|
3750
4397
|
{
|
|
3751
|
-
type: "
|
|
4398
|
+
type: "core::bool"
|
|
3752
4399
|
}
|
|
3753
4400
|
],
|
|
3754
4401
|
state_mutability: "view"
|
|
3755
4402
|
},
|
|
3756
4403
|
{
|
|
3757
4404
|
type: "function",
|
|
3758
|
-
name: "
|
|
4405
|
+
name: "get_leaderboard_length",
|
|
3759
4406
|
inputs: [
|
|
3760
4407
|
{
|
|
3761
4408
|
name: "context_id",
|
|
3762
4409
|
type: "core::integer::u64"
|
|
3763
|
-
},
|
|
3764
|
-
{
|
|
3765
|
-
name: "entry_id",
|
|
3766
|
-
type: "core::integer::u32"
|
|
3767
4410
|
}
|
|
3768
4411
|
],
|
|
3769
4412
|
outputs: [
|
|
3770
4413
|
{
|
|
3771
|
-
type: "core::
|
|
4414
|
+
type: "core::integer::u32"
|
|
3772
4415
|
}
|
|
3773
4416
|
],
|
|
3774
4417
|
state_mutability: "view"
|
|
3775
4418
|
},
|
|
3776
4419
|
{
|
|
3777
4420
|
type: "function",
|
|
3778
|
-
name: "
|
|
4421
|
+
name: "get_config",
|
|
3779
4422
|
inputs: [
|
|
3780
4423
|
{
|
|
3781
4424
|
name: "context_id",
|
|
3782
4425
|
type: "core::integer::u64"
|
|
3783
|
-
},
|
|
3784
|
-
{
|
|
3785
|
-
name: "entry_id",
|
|
3786
|
-
type: "core::integer::u32"
|
|
3787
4426
|
}
|
|
3788
4427
|
],
|
|
3789
4428
|
outputs: [
|
|
3790
4429
|
{
|
|
3791
|
-
type: "
|
|
4430
|
+
type: "game_components_interfaces::structs::leaderboard::LeaderboardStoreConfig"
|
|
3792
4431
|
}
|
|
3793
4432
|
],
|
|
3794
4433
|
state_mutability: "view"
|
|
3795
4434
|
},
|
|
3796
4435
|
{
|
|
3797
4436
|
type: "function",
|
|
3798
|
-
name: "
|
|
4437
|
+
name: "find_position",
|
|
3799
4438
|
inputs: [
|
|
3800
4439
|
{
|
|
3801
4440
|
name: "context_id",
|
|
3802
4441
|
type: "core::integer::u64"
|
|
4442
|
+
},
|
|
4443
|
+
{
|
|
4444
|
+
name: "score",
|
|
4445
|
+
type: "core::integer::u64"
|
|
4446
|
+
},
|
|
4447
|
+
{
|
|
4448
|
+
name: "token_id",
|
|
4449
|
+
type: "core::felt252"
|
|
3803
4450
|
}
|
|
3804
4451
|
],
|
|
3805
4452
|
outputs: [
|
|
3806
4453
|
{
|
|
3807
|
-
type: "core::integer::u32"
|
|
4454
|
+
type: "core::option::Option::<core::integer::u32>"
|
|
3808
4455
|
}
|
|
3809
4456
|
],
|
|
3810
4457
|
state_mutability: "view"
|
|
@@ -3948,6 +4595,12 @@ var budokan_default = [
|
|
|
3948
4595
|
kind: "enum",
|
|
3949
4596
|
variants: []
|
|
3950
4597
|
},
|
|
4598
|
+
{
|
|
4599
|
+
type: "event",
|
|
4600
|
+
name: "openzeppelin_security::reentrancyguard::ReentrancyGuardComponent::Event",
|
|
4601
|
+
kind: "enum",
|
|
4602
|
+
variants: []
|
|
4603
|
+
},
|
|
3951
4604
|
{
|
|
3952
4605
|
type: "event",
|
|
3953
4606
|
name: "budokan::events::TournamentCreated",
|
|
@@ -3963,11 +4616,6 @@ var budokan_default = [
|
|
|
3963
4616
|
type: "core::starknet::contract_address::ContractAddress",
|
|
3964
4617
|
kind: "key"
|
|
3965
4618
|
},
|
|
3966
|
-
{
|
|
3967
|
-
name: "created_at",
|
|
3968
|
-
type: "core::integer::u64",
|
|
3969
|
-
kind: "data"
|
|
3970
|
-
},
|
|
3971
4619
|
{
|
|
3972
4620
|
name: "created_by",
|
|
3973
4621
|
type: "core::starknet::contract_address::ContractAddress",
|
|
@@ -3984,28 +4632,28 @@ var budokan_default = [
|
|
|
3984
4632
|
kind: "data"
|
|
3985
4633
|
},
|
|
3986
4634
|
{
|
|
3987
|
-
name: "
|
|
3988
|
-
type: "
|
|
4635
|
+
name: "config",
|
|
4636
|
+
type: "core::felt252",
|
|
3989
4637
|
kind: "data"
|
|
3990
4638
|
},
|
|
3991
4639
|
{
|
|
3992
|
-
name: "
|
|
3993
|
-
type: "
|
|
4640
|
+
name: "client_url",
|
|
4641
|
+
type: "core::option::Option::<core::byte_array::ByteArray>",
|
|
3994
4642
|
kind: "data"
|
|
3995
4643
|
},
|
|
3996
4644
|
{
|
|
3997
|
-
name: "
|
|
3998
|
-
type: "core::option::Option::<
|
|
4645
|
+
name: "renderer",
|
|
4646
|
+
type: "core::option::Option::<core::starknet::contract_address::ContractAddress>",
|
|
3999
4647
|
kind: "data"
|
|
4000
4648
|
},
|
|
4001
4649
|
{
|
|
4002
|
-
name: "
|
|
4003
|
-
type: "core::option::Option::<
|
|
4650
|
+
name: "entry_fee",
|
|
4651
|
+
type: "core::option::Option::<budokan_interfaces::budokan::EntryFeeKind>",
|
|
4004
4652
|
kind: "data"
|
|
4005
4653
|
},
|
|
4006
4654
|
{
|
|
4007
|
-
name: "
|
|
4008
|
-
type: "
|
|
4655
|
+
name: "entry_requirement",
|
|
4656
|
+
type: "core::option::Option::<game_components_interfaces::entry_requirement::EntryRequirement>",
|
|
4009
4657
|
kind: "data"
|
|
4010
4658
|
}
|
|
4011
4659
|
]
|
|
@@ -4025,11 +4673,6 @@ var budokan_default = [
|
|
|
4025
4673
|
type: "core::felt252",
|
|
4026
4674
|
kind: "key"
|
|
4027
4675
|
},
|
|
4028
|
-
{
|
|
4029
|
-
name: "game_address",
|
|
4030
|
-
type: "core::starknet::contract_address::ContractAddress",
|
|
4031
|
-
kind: "data"
|
|
4032
|
-
},
|
|
4033
4676
|
{
|
|
4034
4677
|
name: "player_address",
|
|
4035
4678
|
type: "core::starknet::contract_address::ContractAddress",
|
|
@@ -4039,22 +4682,12 @@ var budokan_default = [
|
|
|
4039
4682
|
name: "entry_number",
|
|
4040
4683
|
type: "core::integer::u32",
|
|
4041
4684
|
kind: "data"
|
|
4042
|
-
},
|
|
4043
|
-
{
|
|
4044
|
-
name: "has_submitted",
|
|
4045
|
-
type: "core::bool",
|
|
4046
|
-
kind: "data"
|
|
4047
|
-
},
|
|
4048
|
-
{
|
|
4049
|
-
name: "is_banned",
|
|
4050
|
-
type: "core::bool",
|
|
4051
|
-
kind: "data"
|
|
4052
4685
|
}
|
|
4053
4686
|
]
|
|
4054
4687
|
},
|
|
4055
4688
|
{
|
|
4056
4689
|
type: "event",
|
|
4057
|
-
name: "budokan::events::
|
|
4690
|
+
name: "budokan::events::TournamentEntryStateChanged",
|
|
4058
4691
|
kind: "struct",
|
|
4059
4692
|
members: [
|
|
4060
4693
|
{
|
|
@@ -4063,8 +4696,18 @@ var budokan_default = [
|
|
|
4063
4696
|
kind: "key"
|
|
4064
4697
|
},
|
|
4065
4698
|
{
|
|
4066
|
-
name: "
|
|
4067
|
-
type: "core::
|
|
4699
|
+
name: "game_token_id",
|
|
4700
|
+
type: "core::felt252",
|
|
4701
|
+
kind: "key"
|
|
4702
|
+
},
|
|
4703
|
+
{
|
|
4704
|
+
name: "has_submitted",
|
|
4705
|
+
type: "core::bool",
|
|
4706
|
+
kind: "data"
|
|
4707
|
+
},
|
|
4708
|
+
{
|
|
4709
|
+
name: "is_banned",
|
|
4710
|
+
type: "core::bool",
|
|
4068
4711
|
kind: "data"
|
|
4069
4712
|
}
|
|
4070
4713
|
]
|
|
@@ -4090,13 +4733,8 @@ var budokan_default = [
|
|
|
4090
4733
|
kind: "data"
|
|
4091
4734
|
},
|
|
4092
4735
|
{
|
|
4093
|
-
name: "
|
|
4094
|
-
type: "
|
|
4095
|
-
kind: "data"
|
|
4096
|
-
},
|
|
4097
|
-
{
|
|
4098
|
-
name: "token_type",
|
|
4099
|
-
type: "game_components_interfaces::prize::TokenTypeData",
|
|
4736
|
+
name: "prize",
|
|
4737
|
+
type: "game_components_interfaces::prize::Prize",
|
|
4100
4738
|
kind: "data"
|
|
4101
4739
|
},
|
|
4102
4740
|
{
|
|
@@ -4205,6 +4843,11 @@ var budokan_default = [
|
|
|
4205
4843
|
type: "game_components_metagame::prize::prize_component::PrizeComponent::Event",
|
|
4206
4844
|
kind: "flat"
|
|
4207
4845
|
},
|
|
4846
|
+
{
|
|
4847
|
+
name: "ReentrancyGuardEvent",
|
|
4848
|
+
type: "openzeppelin_security::reentrancyguard::ReentrancyGuardComponent::Event",
|
|
4849
|
+
kind: "flat"
|
|
4850
|
+
},
|
|
4208
4851
|
{
|
|
4209
4852
|
name: "TournamentCreated",
|
|
4210
4853
|
type: "budokan::events::TournamentCreated",
|
|
@@ -4216,8 +4859,8 @@ var budokan_default = [
|
|
|
4216
4859
|
kind: "nested"
|
|
4217
4860
|
},
|
|
4218
4861
|
{
|
|
4219
|
-
name: "
|
|
4220
|
-
type: "budokan::events::
|
|
4862
|
+
name: "TournamentEntryStateChanged",
|
|
4863
|
+
type: "budokan::events::TournamentEntryStateChanged",
|
|
4221
4864
|
kind: "nested"
|
|
4222
4865
|
},
|
|
4223
4866
|
{
|
|
@@ -4385,6 +5028,7 @@ var BudokanClient = class {
|
|
|
4385
5028
|
if (prizes.length === 0) return t;
|
|
4386
5029
|
const tokenMap = /* @__PURE__ */ new Map();
|
|
4387
5030
|
for (const p of prizes) {
|
|
5031
|
+
if (p.tokenType === "extension" || p.tokenAddress == null) continue;
|
|
4388
5032
|
const key = p.tokenAddress;
|
|
4389
5033
|
const existing = tokenMap.get(key);
|
|
4390
5034
|
if (existing) {
|
|
@@ -4871,7 +5515,6 @@ function useOwnedTournamentIds(owner, contextId) {
|
|
|
4871
5515
|
enabled ? {
|
|
4872
5516
|
owner,
|
|
4873
5517
|
minterAddress: budokanAddress,
|
|
4874
|
-
hasContext: true,
|
|
4875
5518
|
...{},
|
|
4876
5519
|
limit: MAX_OWNED_TOKENS
|
|
4877
5520
|
} : void 0
|
|
@@ -4987,7 +5630,11 @@ function useRegistrationsByOwner(tournamentId, owner, params) {
|
|
|
4987
5630
|
}, [enabled, tokensResult]);
|
|
4988
5631
|
const inner = useRegistrations(
|
|
4989
5632
|
ownedGameTokenIds && ownedGameTokenIds.length > 0 ? tournamentId : void 0,
|
|
4990
|
-
ownedGameTokenIds && ownedGameTokenIds.length > 0 ? {
|
|
5633
|
+
ownedGameTokenIds && ownedGameTokenIds.length > 0 ? {
|
|
5634
|
+
limit: Math.min(ownedGameTokenIds.length, MAX_OWNED_TOKENS),
|
|
5635
|
+
...params,
|
|
5636
|
+
gameTokenIds: ownedGameTokenIds
|
|
5637
|
+
} : void 0
|
|
4991
5638
|
);
|
|
4992
5639
|
if (ownedGameTokenIds !== null && ownedGameTokenIds.length === 0) {
|
|
4993
5640
|
return {
|
|
@@ -5176,6 +5823,200 @@ function useActivityStats() {
|
|
|
5176
5823
|
}, [fetch2]);
|
|
5177
5824
|
return { stats, loading, error, refetch: fetch2 };
|
|
5178
5825
|
}
|
|
5826
|
+
function usePlayerRewards(address) {
|
|
5827
|
+
const budokan = useBudokanClient();
|
|
5828
|
+
const denshokan = react$1.useDenshokanClient();
|
|
5829
|
+
const budokanAddress = budokan.clientConfig.budokanAddress;
|
|
5830
|
+
const [rewards, setRewards] = react.useState(null);
|
|
5831
|
+
const [aggregating, setAggregating] = react.useState(false);
|
|
5832
|
+
const [error, setError] = react.useState(null);
|
|
5833
|
+
useResetOnClient(budokan, setRewards, setError);
|
|
5834
|
+
const tokensEnabled = !!address && !!budokanAddress;
|
|
5835
|
+
const { data: tokensResult, isLoading: tokensLoading } = react$1.useTokens(
|
|
5836
|
+
tokensEnabled ? {
|
|
5837
|
+
owner: address,
|
|
5838
|
+
minterAddress: budokanAddress,
|
|
5839
|
+
limit: 1e3
|
|
5840
|
+
} : void 0
|
|
5841
|
+
);
|
|
5842
|
+
const tokensByTournament = react.useMemo(() => {
|
|
5843
|
+
if (!tokensResult?.data) return null;
|
|
5844
|
+
const map = /* @__PURE__ */ new Map();
|
|
5845
|
+
for (const t of tokensResult.data) {
|
|
5846
|
+
if (t.contextId == null || !t.tokenId) continue;
|
|
5847
|
+
const tid = String(t.contextId);
|
|
5848
|
+
let list = map.get(tid);
|
|
5849
|
+
if (!list) {
|
|
5850
|
+
list = [];
|
|
5851
|
+
map.set(tid, list);
|
|
5852
|
+
}
|
|
5853
|
+
list.push(t.tokenId);
|
|
5854
|
+
}
|
|
5855
|
+
return map;
|
|
5856
|
+
}, [tokensResult]);
|
|
5857
|
+
const tournamentIds = react.useMemo(
|
|
5858
|
+
() => tokensByTournament ? Array.from(tokensByTournament.keys()) : [],
|
|
5859
|
+
[tokensByTournament]
|
|
5860
|
+
);
|
|
5861
|
+
const { tournaments: tournamentsPage, loading: tournamentsLoading } = useTournaments(
|
|
5862
|
+
tournamentIds.length > 0 ? { tournamentIds, limit: 1e3 } : void 0
|
|
5863
|
+
);
|
|
5864
|
+
const tournamentIdsKey = tournamentIds.join(",");
|
|
5865
|
+
const fetch2 = react.useCallback(async () => {
|
|
5866
|
+
if (!tokensEnabled) {
|
|
5867
|
+
setRewards(null);
|
|
5868
|
+
return;
|
|
5869
|
+
}
|
|
5870
|
+
if (!tokensByTournament) return;
|
|
5871
|
+
if (tokensByTournament.size === 0) {
|
|
5872
|
+
setRewards(emptyRewards());
|
|
5873
|
+
return;
|
|
5874
|
+
}
|
|
5875
|
+
if (!tournamentsPage?.data) return;
|
|
5876
|
+
const now = Math.floor(Date.now() / 1e3);
|
|
5877
|
+
const finalized = tournamentsPage.data.filter((t) => {
|
|
5878
|
+
const sub = Number(t.submissionEndTime ?? 0);
|
|
5879
|
+
return sub > 0 && sub <= now;
|
|
5880
|
+
});
|
|
5881
|
+
if (finalized.length === 0) {
|
|
5882
|
+
setRewards(emptyRewards());
|
|
5883
|
+
return;
|
|
5884
|
+
}
|
|
5885
|
+
setAggregating(true);
|
|
5886
|
+
setError(null);
|
|
5887
|
+
try {
|
|
5888
|
+
const settled = await Promise.allSettled(
|
|
5889
|
+
finalized.map(async (t) => {
|
|
5890
|
+
const tid = t.id;
|
|
5891
|
+
const tokenIds = tokensByTournament.get(tid) ?? [];
|
|
5892
|
+
if (tokenIds.length === 0) return null;
|
|
5893
|
+
const [prizes, allClaims, ranksResult] = await Promise.all([
|
|
5894
|
+
budokan.getTournamentPrizes(tid),
|
|
5895
|
+
fetchAllRewardClaims(budokan, tid),
|
|
5896
|
+
denshokan.getTokenRanks(tokenIds, {
|
|
5897
|
+
contextId: Number(tid),
|
|
5898
|
+
minterAddress: budokanAddress
|
|
5899
|
+
})
|
|
5900
|
+
]);
|
|
5901
|
+
let maxPaid = 0;
|
|
5902
|
+
for (const p of prizes) {
|
|
5903
|
+
if ((p.payoutPosition ?? 0) > 0) {
|
|
5904
|
+
maxPaid = Math.max(maxPaid, p.payoutPosition);
|
|
5905
|
+
}
|
|
5906
|
+
if ((p.distributionCount ?? 0) > 0) {
|
|
5907
|
+
maxPaid = Math.max(maxPaid, p.distributionCount);
|
|
5908
|
+
}
|
|
5909
|
+
}
|
|
5910
|
+
const efDistCount = Number(t.entryFee?.distributionCount ?? 0);
|
|
5911
|
+
if (efDistCount > 0) maxPaid = Math.max(maxPaid, efDistCount);
|
|
5912
|
+
if (maxPaid === 0) return null;
|
|
5913
|
+
const placements = ranksResult.data.filter((r) => r.rank > 0 && r.rank <= maxPaid).map((r) => ({
|
|
5914
|
+
tournamentId: tid,
|
|
5915
|
+
tokenId: r.tokenId,
|
|
5916
|
+
position: r.rank,
|
|
5917
|
+
score: String(r.score ?? "0")
|
|
5918
|
+
}));
|
|
5919
|
+
if (placements.length === 0) return null;
|
|
5920
|
+
return {
|
|
5921
|
+
tournament: t,
|
|
5922
|
+
prizes,
|
|
5923
|
+
rewardClaims: allClaims,
|
|
5924
|
+
placements
|
|
5925
|
+
};
|
|
5926
|
+
})
|
|
5927
|
+
);
|
|
5928
|
+
const valid = settled.map((s, i) => {
|
|
5929
|
+
if (s.status === "fulfilled") return s.value;
|
|
5930
|
+
console.warn(
|
|
5931
|
+
`usePlayerRewards: tournament ${finalized[i].id} fetch failed; skipping`,
|
|
5932
|
+
s.reason
|
|
5933
|
+
);
|
|
5934
|
+
return null;
|
|
5935
|
+
}).filter((r) => r !== null);
|
|
5936
|
+
const allPlacements = valid.flatMap(
|
|
5937
|
+
(r) => r.placements
|
|
5938
|
+
);
|
|
5939
|
+
const wins = allPlacements.length;
|
|
5940
|
+
const bestPlacement = wins > 0 ? Math.min(...allPlacements.map((p) => p.position)) : null;
|
|
5941
|
+
const tournamentsList = valid.map((r) => r.tournament);
|
|
5942
|
+
const prizesList = valid.flatMap((r) => r.prizes);
|
|
5943
|
+
const rewardClaimsList = valid.flatMap(
|
|
5944
|
+
(r) => r.rewardClaims
|
|
5945
|
+
);
|
|
5946
|
+
setRewards({
|
|
5947
|
+
wins,
|
|
5948
|
+
bestPlacement,
|
|
5949
|
+
placements: allPlacements,
|
|
5950
|
+
tournaments: tournamentsList,
|
|
5951
|
+
prizes: prizesList,
|
|
5952
|
+
rewardClaims: rewardClaimsList
|
|
5953
|
+
});
|
|
5954
|
+
} catch (e) {
|
|
5955
|
+
setError(e);
|
|
5956
|
+
} finally {
|
|
5957
|
+
setAggregating(false);
|
|
5958
|
+
}
|
|
5959
|
+
}, [
|
|
5960
|
+
tokensEnabled,
|
|
5961
|
+
tokensByTournament,
|
|
5962
|
+
tournamentsPage,
|
|
5963
|
+
tournamentIdsKey,
|
|
5964
|
+
budokan,
|
|
5965
|
+
denshokan,
|
|
5966
|
+
budokanAddress
|
|
5967
|
+
]);
|
|
5968
|
+
const lastRunRef = react.useRef("");
|
|
5969
|
+
react.useEffect(() => {
|
|
5970
|
+
if (!tokensEnabled) {
|
|
5971
|
+
setRewards(null);
|
|
5972
|
+
return;
|
|
5973
|
+
}
|
|
5974
|
+
if (!tokensByTournament || !tournamentsPage?.data) return;
|
|
5975
|
+
const fingerprint = `${address}|${tournamentIdsKey}|${tournamentsPage.data.length}`;
|
|
5976
|
+
if (fingerprint === lastRunRef.current) return;
|
|
5977
|
+
lastRunRef.current = fingerprint;
|
|
5978
|
+
fetch2();
|
|
5979
|
+
}, [
|
|
5980
|
+
address,
|
|
5981
|
+
tokensEnabled,
|
|
5982
|
+
tokensByTournament,
|
|
5983
|
+
tournamentsPage,
|
|
5984
|
+
tournamentIdsKey,
|
|
5985
|
+
fetch2
|
|
5986
|
+
]);
|
|
5987
|
+
const loading = tokensEnabled && (tokensLoading || tournamentsLoading) || aggregating;
|
|
5988
|
+
return { rewards, loading, error, refetch: fetch2 };
|
|
5989
|
+
}
|
|
5990
|
+
function emptyRewards() {
|
|
5991
|
+
return {
|
|
5992
|
+
wins: 0,
|
|
5993
|
+
bestPlacement: null,
|
|
5994
|
+
placements: [],
|
|
5995
|
+
tournaments: [],
|
|
5996
|
+
prizes: [],
|
|
5997
|
+
rewardClaims: []
|
|
5998
|
+
};
|
|
5999
|
+
}
|
|
6000
|
+
async function fetchAllRewardClaims(client, tournamentId) {
|
|
6001
|
+
const first = await client.getTournamentRewardClaims(tournamentId, {
|
|
6002
|
+
limit: 100
|
|
6003
|
+
});
|
|
6004
|
+
const accumulated = [...first.data];
|
|
6005
|
+
const total = first.total ?? accumulated.length;
|
|
6006
|
+
if (accumulated.length >= total) return accumulated;
|
|
6007
|
+
const pageSize = Math.max(first.data.length, 1);
|
|
6008
|
+
let offset = accumulated.length;
|
|
6009
|
+
while (offset < total) {
|
|
6010
|
+
const next = await client.getTournamentRewardClaims(tournamentId, {
|
|
6011
|
+
limit: pageSize,
|
|
6012
|
+
offset
|
|
6013
|
+
});
|
|
6014
|
+
if (next.data.length === 0) break;
|
|
6015
|
+
accumulated.push(...next.data);
|
|
6016
|
+
offset += next.data.length;
|
|
6017
|
+
}
|
|
6018
|
+
return accumulated;
|
|
6019
|
+
}
|
|
5179
6020
|
function useSubscription(channels, tournamentIds) {
|
|
5180
6021
|
const client = useBudokanClient();
|
|
5181
6022
|
const [lastMessage, setLastMessage] = react.useState(null);
|
|
@@ -5226,6 +6067,7 @@ exports.useActivityStats = useActivityStats;
|
|
|
5226
6067
|
exports.useBudokanClient = useBudokanClient;
|
|
5227
6068
|
exports.useConnectionStatus = useConnectionStatus;
|
|
5228
6069
|
exports.useLeaderboard = useLeaderboard;
|
|
6070
|
+
exports.usePlayerRewards = usePlayerRewards;
|
|
5229
6071
|
exports.usePrizeAggregation = usePrizeAggregation;
|
|
5230
6072
|
exports.usePrizeStats = usePrizeStats;
|
|
5231
6073
|
exports.usePrizes = usePrizes;
|