@provable-games/budokan-sdk 0.1.23 → 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/{player-BUynfv7D.d.cts → player-C2GE9Lop.d.cts} +29 -4
- package/dist/{player-BUynfv7D.d.ts → player-C2GE9Lop.d.ts} +29 -4
- package/dist/react.cjs +893 -249
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +893 -249
- package/dist/react.js.map +1 -1
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { num, CairoCustomEnum } from 'starknet';
|
|
1
|
+
import { hash, CallData, uint256, num, CairoOption, CairoOptionVariant, byteArray, CairoCustomEnum } from 'starknet';
|
|
2
|
+
import { getExtensionAddresses } from '@provable-games/metagame-sdk';
|
|
2
3
|
|
|
3
4
|
// src/errors/index.ts
|
|
4
5
|
var BudokanError = class extends Error {
|
|
@@ -544,16 +545,32 @@ var CHAINS = {
|
|
|
544
545
|
viewerAddress: "0x013c8239361fdbd7ec26db2c83f4ff270c5bba83a0bc105b4005b676ff57fdbe"
|
|
545
546
|
},
|
|
546
547
|
sepolia: {
|
|
547
|
-
rpcUrl: "https://starknet
|
|
548
|
+
rpcUrl: "https://api.cartridge.gg/x/starknet/sepolia/rpc/v0_10",
|
|
548
549
|
apiBaseUrl: "https://budokan-api-sepolia.up.railway.app",
|
|
549
550
|
wsUrl: "wss://budokan-api-sepolia.up.railway.app/ws",
|
|
550
|
-
budokanAddress: "
|
|
551
|
-
|
|
551
|
+
budokanAddress: "0x074cc823c382d98e6b8d657aa86776a57d85e1dc2912d54d83a4fef147472683",
|
|
552
|
+
// Redeployed 2026-06-18 to match the upgraded #264/#269 budokan class —
|
|
553
|
+
// the prior viewer (0x03da56…) was built against the old budokan interface
|
|
554
|
+
// (called the removed `tournament_entries`) and reverted RPC reads.
|
|
555
|
+
viewerAddress: "0x06b2773d5f1f8bfa5aa3b698fbbaea0472b30af003ea6058330ed52a1acaa283"
|
|
552
556
|
}
|
|
553
557
|
};
|
|
554
558
|
function getChainConfig(chain) {
|
|
555
559
|
return CHAINS[chain];
|
|
556
560
|
}
|
|
561
|
+
function explorerBaseUrl(chain) {
|
|
562
|
+
if (chain === "sepolia") return "https://sepolia.voyager.online";
|
|
563
|
+
return "https://voyager.online";
|
|
564
|
+
}
|
|
565
|
+
function explorerTxUrl(chain, txHash) {
|
|
566
|
+
return `${explorerBaseUrl(chain)}/tx/${txHash}`;
|
|
567
|
+
}
|
|
568
|
+
function explorerAddressUrl(chain, address) {
|
|
569
|
+
return `${explorerBaseUrl(chain)}/contract/${address}`;
|
|
570
|
+
}
|
|
571
|
+
function tournamentPageUrl(chain, tournamentId) {
|
|
572
|
+
return `https://budokan.gg/tournament/${tournamentId}?network=${chain}`;
|
|
573
|
+
}
|
|
557
574
|
|
|
558
575
|
// src/datasource/health.ts
|
|
559
576
|
var ConnectionStatus = class {
|
|
@@ -849,23 +866,36 @@ function parseTournament(raw, entryCount) {
|
|
|
849
866
|
const lc = obj.leaderboard_config;
|
|
850
867
|
const ascending = Boolean(lc?.ascending);
|
|
851
868
|
const gameMustBeOver = Boolean(lc?.game_must_be_over);
|
|
852
|
-
const
|
|
869
|
+
const entryFeeKind = parseOption(obj.entry_fee);
|
|
853
870
|
let entryFeeToken = null;
|
|
854
871
|
let entryFeeAmount = null;
|
|
855
872
|
let entryFee = null;
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
873
|
+
let entryFeeKindTag = null;
|
|
874
|
+
let entryFeeExtension = null;
|
|
875
|
+
if (entryFeeKind) {
|
|
876
|
+
const variantBag = entryFeeKind.variant ?? entryFeeKind;
|
|
877
|
+
const ef = variantBag.BuiltIn;
|
|
878
|
+
const ext = variantBag.Extension;
|
|
879
|
+
if (ef) {
|
|
880
|
+
entryFeeKindTag = "builtin";
|
|
881
|
+
entryFeeToken = num.toHex(ef.token_address);
|
|
882
|
+
entryFeeAmount = String(ef.amount ?? "0");
|
|
883
|
+
entryFee = {
|
|
884
|
+
tokenAddress: entryFeeToken,
|
|
885
|
+
amount: entryFeeAmount,
|
|
886
|
+
tournamentCreatorShare: Number(ef.tournament_creator_share ?? 0),
|
|
887
|
+
gameCreatorShare: Number(ef.game_creator_share ?? 0),
|
|
888
|
+
refundShare: Number(ef.refund_share ?? 0),
|
|
889
|
+
distribution: ef.distribution ?? null,
|
|
890
|
+
distributionCount: Number(ef.distribution_count ?? 0)
|
|
891
|
+
};
|
|
892
|
+
} else if (ext) {
|
|
893
|
+
entryFeeKindTag = "extension";
|
|
894
|
+
entryFeeExtension = {
|
|
895
|
+
address: num.toHex(ext.address),
|
|
896
|
+
config: Array.isArray(ext.config) ? ext.config.map((x) => num.toHex(x)) : []
|
|
897
|
+
};
|
|
898
|
+
}
|
|
869
899
|
}
|
|
870
900
|
const entryRequirement = parseOption(obj.entry_requirement);
|
|
871
901
|
const hasEntryRequirement = entryRequirement !== null;
|
|
@@ -915,6 +945,8 @@ function parseTournament(raw, entryCount) {
|
|
|
915
945
|
renderer
|
|
916
946
|
},
|
|
917
947
|
entryFee,
|
|
948
|
+
entryFeeKind: entryFeeKindTag,
|
|
949
|
+
entryFeeExtension,
|
|
918
950
|
entryRequirement,
|
|
919
951
|
leaderboardConfig: { ascending, gameMustBeOver },
|
|
920
952
|
entryCount,
|
|
@@ -945,8 +977,40 @@ function parseRegistration(raw, tournamentId) {
|
|
|
945
977
|
};
|
|
946
978
|
}
|
|
947
979
|
function parsePrize(raw) {
|
|
948
|
-
const
|
|
949
|
-
const
|
|
980
|
+
const record = raw;
|
|
981
|
+
const prizeEnum = record.prize;
|
|
982
|
+
if (!prizeEnum) {
|
|
983
|
+
throw new Error(`PrizeRecord missing prize field: ${JSON.stringify(raw)}`);
|
|
984
|
+
}
|
|
985
|
+
const activePrize = typeof prizeEnum.activeVariant === "function" ? prizeEnum.activeVariant() : prizeEnum.Token !== void 0 ? "Token" : prizeEnum.Extension !== void 0 ? "Extension" : null;
|
|
986
|
+
const prizeVariantBag = prizeEnum.variant ?? prizeEnum;
|
|
987
|
+
if (activePrize === "Extension") {
|
|
988
|
+
const ext = prizeVariantBag.Extension;
|
|
989
|
+
return {
|
|
990
|
+
prizeId: String(record.id ?? "0"),
|
|
991
|
+
tournamentId: String(record.context_id ?? "0"),
|
|
992
|
+
payoutPosition: 0,
|
|
993
|
+
tokenAddress: null,
|
|
994
|
+
tokenType: "extension",
|
|
995
|
+
amount: null,
|
|
996
|
+
tokenId: null,
|
|
997
|
+
distributionType: null,
|
|
998
|
+
distributionWeight: null,
|
|
999
|
+
distributionShares: null,
|
|
1000
|
+
distributionCount: null,
|
|
1001
|
+
sponsorAddress: num.toHex(record.sponsor_address),
|
|
1002
|
+
extensionAddress: ext?.address != null ? num.toHex(ext.address) : null,
|
|
1003
|
+
extensionConfig: Array.isArray(ext?.config) ? ext.config.map((x) => num.toHex(x)) : null
|
|
1004
|
+
};
|
|
1005
|
+
}
|
|
1006
|
+
if (activePrize !== "Token") {
|
|
1007
|
+
throw new Error(`Unrecognised Prize variant: ${JSON.stringify(prizeEnum)}`);
|
|
1008
|
+
}
|
|
1009
|
+
const tokenPayload = prizeVariantBag.Token;
|
|
1010
|
+
if (!tokenPayload) {
|
|
1011
|
+
throw new Error(`Prize::Token missing payload: ${JSON.stringify(prizeEnum)}`);
|
|
1012
|
+
}
|
|
1013
|
+
const tokenTypeData = tokenPayload.token_type;
|
|
950
1014
|
let tokenType = "erc20";
|
|
951
1015
|
let amount = null;
|
|
952
1016
|
let tokenId = null;
|
|
@@ -987,10 +1051,10 @@ function parsePrize(raw) {
|
|
|
987
1051
|
}
|
|
988
1052
|
}
|
|
989
1053
|
return {
|
|
990
|
-
prizeId: String(
|
|
991
|
-
tournamentId: String(
|
|
1054
|
+
prizeId: String(record.id ?? "0"),
|
|
1055
|
+
tournamentId: String(record.context_id ?? "0"),
|
|
992
1056
|
payoutPosition,
|
|
993
|
-
tokenAddress: num.toHex(
|
|
1057
|
+
tokenAddress: num.toHex(tokenPayload.token_address),
|
|
994
1058
|
tokenType,
|
|
995
1059
|
amount,
|
|
996
1060
|
tokenId,
|
|
@@ -998,7 +1062,9 @@ function parsePrize(raw) {
|
|
|
998
1062
|
distributionWeight,
|
|
999
1063
|
distributionShares,
|
|
1000
1064
|
distributionCount,
|
|
1001
|
-
sponsorAddress: num.toHex(
|
|
1065
|
+
sponsorAddress: num.toHex(record.sponsor_address),
|
|
1066
|
+
extensionAddress: null,
|
|
1067
|
+
extensionConfig: null
|
|
1002
1068
|
};
|
|
1003
1069
|
}
|
|
1004
1070
|
function parseOption(raw) {
|
|
@@ -1123,6 +1189,20 @@ async function viewerPrizes(contract, tournamentId) {
|
|
|
1123
1189
|
return result.map(parsePrize);
|
|
1124
1190
|
}, contract.address);
|
|
1125
1191
|
}
|
|
1192
|
+
function rewardClaim(partial) {
|
|
1193
|
+
return {
|
|
1194
|
+
prizeId: null,
|
|
1195
|
+
payoutIndex: null,
|
|
1196
|
+
position: null,
|
|
1197
|
+
refundTokenId: null,
|
|
1198
|
+
extensionTokenId: null,
|
|
1199
|
+
extensionParams: null,
|
|
1200
|
+
...partial
|
|
1201
|
+
};
|
|
1202
|
+
}
|
|
1203
|
+
function spanToHex(v) {
|
|
1204
|
+
return Array.isArray(v) ? v.map((x) => num.toHex(x)) : [];
|
|
1205
|
+
}
|
|
1126
1206
|
function translateCairoRewardType(rewardType) {
|
|
1127
1207
|
if (!rewardType || typeof rewardType !== "object") {
|
|
1128
1208
|
throw new Error(`Unexpected RewardType payload: ${JSON.stringify(rewardType)}`);
|
|
@@ -1131,70 +1211,70 @@ function translateCairoRewardType(rewardType) {
|
|
|
1131
1211
|
const outer = typeof rt.activeVariant === "function" ? rt.activeVariant() : null;
|
|
1132
1212
|
const innerBag = typeof rt.activeVariant === "function" ? rt.variant : rt;
|
|
1133
1213
|
if (outer === "Prize" || innerBag.Prize !== void 0) {
|
|
1134
|
-
const
|
|
1214
|
+
const prizeClaim = innerBag.Prize;
|
|
1215
|
+
const pcBag = typeof prizeClaim?.activeVariant === "function" ? prizeClaim.variant : prizeClaim;
|
|
1216
|
+
if (pcBag?.Token === void 0 && pcBag?.Extension !== void 0) {
|
|
1217
|
+
const ext = pcBag.Extension;
|
|
1218
|
+
const tokenId = parseOption(ext.token_id);
|
|
1219
|
+
return rewardClaim({
|
|
1220
|
+
claimKind: "prize_extension",
|
|
1221
|
+
prizeId: BigInt(ext.prize_id ?? 0).toString(),
|
|
1222
|
+
extensionTokenId: tokenId != null ? num.toHex(tokenId) : null,
|
|
1223
|
+
extensionParams: spanToHex(ext.payout_params)
|
|
1224
|
+
});
|
|
1225
|
+
}
|
|
1226
|
+
const prize = pcBag?.Token ?? prizeClaim;
|
|
1135
1227
|
const subVariant = typeof prize?.activeVariant === "function" ? prize.activeVariant() : null;
|
|
1136
1228
|
const subBag = typeof prize?.activeVariant === "function" ? prize.variant : prize;
|
|
1137
1229
|
if (subVariant === "Single" || subBag?.Single !== void 0) {
|
|
1138
|
-
return {
|
|
1230
|
+
return rewardClaim({
|
|
1139
1231
|
claimKind: "prize_single",
|
|
1140
|
-
prizeId: BigInt(subBag.Single).toString()
|
|
1141
|
-
|
|
1142
|
-
position: null,
|
|
1143
|
-
refundTokenId: null
|
|
1144
|
-
};
|
|
1232
|
+
prizeId: BigInt(subBag.Single).toString()
|
|
1233
|
+
});
|
|
1145
1234
|
}
|
|
1146
1235
|
if (subVariant === "Distributed" || subBag?.Distributed !== void 0) {
|
|
1147
1236
|
const distributed = subBag.Distributed;
|
|
1148
1237
|
const prizeId = distributed?.["0"] ?? distributed?.[0];
|
|
1149
1238
|
const payoutIndex = distributed?.["1"] ?? distributed?.[1];
|
|
1150
|
-
return {
|
|
1239
|
+
return rewardClaim({
|
|
1151
1240
|
claimKind: "prize_distributed",
|
|
1152
1241
|
prizeId: BigInt(prizeId).toString(),
|
|
1153
|
-
payoutIndex: Number(payoutIndex)
|
|
1154
|
-
|
|
1155
|
-
refundTokenId: null
|
|
1156
|
-
};
|
|
1242
|
+
payoutIndex: Number(payoutIndex)
|
|
1243
|
+
});
|
|
1157
1244
|
}
|
|
1158
1245
|
}
|
|
1159
1246
|
if (outer === "EntryFee" || innerBag.EntryFee !== void 0) {
|
|
1160
|
-
const
|
|
1247
|
+
const entryFeeClaim = innerBag.EntryFee;
|
|
1248
|
+
const efBag = typeof entryFeeClaim?.activeVariant === "function" ? entryFeeClaim.variant : entryFeeClaim;
|
|
1249
|
+
if (efBag?.Token === void 0 && efBag?.Extension !== void 0) {
|
|
1250
|
+
const ext = efBag.Extension;
|
|
1251
|
+
const tokenId = parseOption(ext.token_id);
|
|
1252
|
+
return rewardClaim({
|
|
1253
|
+
claimKind: "entry_fee_extension",
|
|
1254
|
+
extensionTokenId: tokenId != null ? num.toHex(tokenId) : null,
|
|
1255
|
+
extensionParams: spanToHex(ext.claim_params)
|
|
1256
|
+
});
|
|
1257
|
+
}
|
|
1258
|
+
const entryFee = efBag?.Token ?? entryFeeClaim;
|
|
1161
1259
|
const subVariant = typeof entryFee?.activeVariant === "function" ? entryFee.activeVariant() : null;
|
|
1162
1260
|
const subBag = typeof entryFee?.activeVariant === "function" ? entryFee.variant : entryFee;
|
|
1163
1261
|
if (subVariant === "Position" || subBag?.Position !== void 0) {
|
|
1164
|
-
return {
|
|
1262
|
+
return rewardClaim({
|
|
1165
1263
|
claimKind: "entry_fee_position",
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
position: Number(subBag.Position),
|
|
1169
|
-
refundTokenId: null
|
|
1170
|
-
};
|
|
1264
|
+
position: Number(subBag.Position)
|
|
1265
|
+
});
|
|
1171
1266
|
}
|
|
1172
1267
|
if (subVariant === "TournamentCreator" || subBag?.TournamentCreator !== void 0) {
|
|
1173
|
-
return {
|
|
1174
|
-
claimKind: "entry_fee_tournament_creator",
|
|
1175
|
-
prizeId: null,
|
|
1176
|
-
payoutIndex: null,
|
|
1177
|
-
position: null,
|
|
1178
|
-
refundTokenId: null
|
|
1179
|
-
};
|
|
1268
|
+
return rewardClaim({ claimKind: "entry_fee_tournament_creator" });
|
|
1180
1269
|
}
|
|
1181
1270
|
if (subVariant === "GameCreator" || subBag?.GameCreator !== void 0) {
|
|
1182
|
-
return {
|
|
1183
|
-
claimKind: "entry_fee_game_creator",
|
|
1184
|
-
prizeId: null,
|
|
1185
|
-
payoutIndex: null,
|
|
1186
|
-
position: null,
|
|
1187
|
-
refundTokenId: null
|
|
1188
|
-
};
|
|
1271
|
+
return rewardClaim({ claimKind: "entry_fee_game_creator" });
|
|
1189
1272
|
}
|
|
1190
1273
|
if (subVariant === "Refund" || subBag?.Refund !== void 0) {
|
|
1191
|
-
return {
|
|
1274
|
+
return rewardClaim({
|
|
1192
1275
|
claimKind: "entry_fee_refund",
|
|
1193
|
-
prizeId: null,
|
|
1194
|
-
payoutIndex: null,
|
|
1195
|
-
position: null,
|
|
1196
1276
|
refundTokenId: `0x${BigInt(subBag.Refund).toString(16)}`
|
|
1197
|
-
};
|
|
1277
|
+
});
|
|
1198
1278
|
}
|
|
1199
1279
|
}
|
|
1200
1280
|
throw new Error(
|
|
@@ -1205,13 +1285,15 @@ async function viewerRewardClaims(contract, tournamentId, offset, limit) {
|
|
|
1205
1285
|
return wrapRpcCall(async () => {
|
|
1206
1286
|
const result = await contract.call("tournament_reward_claims", [tournamentId, offset, limit]);
|
|
1207
1287
|
const obj = result;
|
|
1208
|
-
const claims = obj.claims
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1288
|
+
const claims = (obj.claims ?? []).map(
|
|
1289
|
+
(raw) => {
|
|
1290
|
+
const claim = raw;
|
|
1291
|
+
return {
|
|
1292
|
+
...translateCairoRewardType(claim.reward_type),
|
|
1293
|
+
claimed: Boolean(claim.claimed)
|
|
1294
|
+
};
|
|
1295
|
+
}
|
|
1296
|
+
);
|
|
1215
1297
|
return {
|
|
1216
1298
|
claims,
|
|
1217
1299
|
total: Number(obj.total ?? 0),
|
|
@@ -1491,20 +1573,6 @@ var budokanViewer_default = [
|
|
|
1491
1573
|
}
|
|
1492
1574
|
]
|
|
1493
1575
|
},
|
|
1494
|
-
{
|
|
1495
|
-
type: "enum",
|
|
1496
|
-
name: "core::option::Option::<budokan_interfaces::budokan::EntryFee>",
|
|
1497
|
-
variants: [
|
|
1498
|
-
{
|
|
1499
|
-
name: "Some",
|
|
1500
|
-
type: "budokan_interfaces::budokan::EntryFee"
|
|
1501
|
-
},
|
|
1502
|
-
{
|
|
1503
|
-
name: "None",
|
|
1504
|
-
type: "()"
|
|
1505
|
-
}
|
|
1506
|
-
]
|
|
1507
|
-
},
|
|
1508
1576
|
{
|
|
1509
1577
|
type: "struct",
|
|
1510
1578
|
name: "core::array::Span::<core::felt252>",
|
|
@@ -1529,6 +1597,34 @@ var budokanViewer_default = [
|
|
|
1529
1597
|
}
|
|
1530
1598
|
]
|
|
1531
1599
|
},
|
|
1600
|
+
{
|
|
1601
|
+
type: "enum",
|
|
1602
|
+
name: "budokan_interfaces::budokan::EntryFeeKind",
|
|
1603
|
+
variants: [
|
|
1604
|
+
{
|
|
1605
|
+
name: "BuiltIn",
|
|
1606
|
+
type: "budokan_interfaces::budokan::EntryFee"
|
|
1607
|
+
},
|
|
1608
|
+
{
|
|
1609
|
+
name: "Extension",
|
|
1610
|
+
type: "metagame_extensions_interfaces::extension::ExtensionConfig"
|
|
1611
|
+
}
|
|
1612
|
+
]
|
|
1613
|
+
},
|
|
1614
|
+
{
|
|
1615
|
+
type: "enum",
|
|
1616
|
+
name: "core::option::Option::<budokan_interfaces::budokan::EntryFeeKind>",
|
|
1617
|
+
variants: [
|
|
1618
|
+
{
|
|
1619
|
+
name: "Some",
|
|
1620
|
+
type: "budokan_interfaces::budokan::EntryFeeKind"
|
|
1621
|
+
},
|
|
1622
|
+
{
|
|
1623
|
+
name: "None",
|
|
1624
|
+
type: "()"
|
|
1625
|
+
}
|
|
1626
|
+
]
|
|
1627
|
+
},
|
|
1532
1628
|
{
|
|
1533
1629
|
type: "enum",
|
|
1534
1630
|
name: "game_components_interfaces::entry_requirement::EntryRequirementType",
|
|
@@ -1619,7 +1715,7 @@ var budokanViewer_default = [
|
|
|
1619
1715
|
},
|
|
1620
1716
|
{
|
|
1621
1717
|
name: "entry_fee",
|
|
1622
|
-
type: "core::option::Option::<budokan_interfaces::budokan::
|
|
1718
|
+
type: "core::option::Option::<budokan_interfaces::budokan::EntryFeeKind>"
|
|
1623
1719
|
},
|
|
1624
1720
|
{
|
|
1625
1721
|
name: "entry_requirement",
|
|
@@ -1775,7 +1871,49 @@ var budokanViewer_default = [
|
|
|
1775
1871
|
},
|
|
1776
1872
|
{
|
|
1777
1873
|
type: "struct",
|
|
1778
|
-
name: "game_components_interfaces::prize::
|
|
1874
|
+
name: "game_components_interfaces::prize::TokenPrizePayload",
|
|
1875
|
+
members: [
|
|
1876
|
+
{
|
|
1877
|
+
name: "token_address",
|
|
1878
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
1879
|
+
},
|
|
1880
|
+
{
|
|
1881
|
+
name: "token_type",
|
|
1882
|
+
type: "game_components_interfaces::prize::TokenTypeData"
|
|
1883
|
+
}
|
|
1884
|
+
]
|
|
1885
|
+
},
|
|
1886
|
+
{
|
|
1887
|
+
type: "struct",
|
|
1888
|
+
name: "game_components_interfaces::prize::ExtensionPrizePayload",
|
|
1889
|
+
members: [
|
|
1890
|
+
{
|
|
1891
|
+
name: "address",
|
|
1892
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
1893
|
+
},
|
|
1894
|
+
{
|
|
1895
|
+
name: "config",
|
|
1896
|
+
type: "core::array::Span::<core::felt252>"
|
|
1897
|
+
}
|
|
1898
|
+
]
|
|
1899
|
+
},
|
|
1900
|
+
{
|
|
1901
|
+
type: "enum",
|
|
1902
|
+
name: "game_components_interfaces::prize::Prize",
|
|
1903
|
+
variants: [
|
|
1904
|
+
{
|
|
1905
|
+
name: "Token",
|
|
1906
|
+
type: "game_components_interfaces::prize::TokenPrizePayload"
|
|
1907
|
+
},
|
|
1908
|
+
{
|
|
1909
|
+
name: "Extension",
|
|
1910
|
+
type: "game_components_interfaces::prize::ExtensionPrizePayload"
|
|
1911
|
+
}
|
|
1912
|
+
]
|
|
1913
|
+
},
|
|
1914
|
+
{
|
|
1915
|
+
type: "struct",
|
|
1916
|
+
name: "game_components_interfaces::prize::PrizeRecord",
|
|
1779
1917
|
members: [
|
|
1780
1918
|
{
|
|
1781
1919
|
name: "id",
|
|
@@ -1786,16 +1924,12 @@ var budokanViewer_default = [
|
|
|
1786
1924
|
type: "core::integer::u64"
|
|
1787
1925
|
},
|
|
1788
1926
|
{
|
|
1789
|
-
name: "
|
|
1927
|
+
name: "sponsor_address",
|
|
1790
1928
|
type: "core::starknet::contract_address::ContractAddress"
|
|
1791
1929
|
},
|
|
1792
1930
|
{
|
|
1793
|
-
name: "
|
|
1794
|
-
type: "game_components_interfaces::prize::
|
|
1795
|
-
},
|
|
1796
|
-
{
|
|
1797
|
-
name: "sponsor_address",
|
|
1798
|
-
type: "core::starknet::contract_address::ContractAddress"
|
|
1931
|
+
name: "prize",
|
|
1932
|
+
type: "game_components_interfaces::prize::Prize"
|
|
1799
1933
|
}
|
|
1800
1934
|
]
|
|
1801
1935
|
},
|
|
@@ -1813,6 +1947,52 @@ var budokanViewer_default = [
|
|
|
1813
1947
|
}
|
|
1814
1948
|
]
|
|
1815
1949
|
},
|
|
1950
|
+
{
|
|
1951
|
+
type: "enum",
|
|
1952
|
+
name: "core::option::Option::<core::felt252>",
|
|
1953
|
+
variants: [
|
|
1954
|
+
{
|
|
1955
|
+
name: "Some",
|
|
1956
|
+
type: "core::felt252"
|
|
1957
|
+
},
|
|
1958
|
+
{
|
|
1959
|
+
name: "None",
|
|
1960
|
+
type: "()"
|
|
1961
|
+
}
|
|
1962
|
+
]
|
|
1963
|
+
},
|
|
1964
|
+
{
|
|
1965
|
+
type: "struct",
|
|
1966
|
+
name: "budokan_interfaces::budokan::ExtensionPrizeClaim",
|
|
1967
|
+
members: [
|
|
1968
|
+
{
|
|
1969
|
+
name: "prize_id",
|
|
1970
|
+
type: "core::integer::u64"
|
|
1971
|
+
},
|
|
1972
|
+
{
|
|
1973
|
+
name: "token_id",
|
|
1974
|
+
type: "core::option::Option::<core::felt252>"
|
|
1975
|
+
},
|
|
1976
|
+
{
|
|
1977
|
+
name: "payout_params",
|
|
1978
|
+
type: "core::array::Span::<core::felt252>"
|
|
1979
|
+
}
|
|
1980
|
+
]
|
|
1981
|
+
},
|
|
1982
|
+
{
|
|
1983
|
+
type: "enum",
|
|
1984
|
+
name: "budokan_interfaces::budokan::PrizeClaim",
|
|
1985
|
+
variants: [
|
|
1986
|
+
{
|
|
1987
|
+
name: "Token",
|
|
1988
|
+
type: "game_components_interfaces::prize::PrizeType"
|
|
1989
|
+
},
|
|
1990
|
+
{
|
|
1991
|
+
name: "Extension",
|
|
1992
|
+
type: "budokan_interfaces::budokan::ExtensionPrizeClaim"
|
|
1993
|
+
}
|
|
1994
|
+
]
|
|
1995
|
+
},
|
|
1816
1996
|
{
|
|
1817
1997
|
type: "enum",
|
|
1818
1998
|
name: "budokan_interfaces::budokan::EntryFeeRewardType",
|
|
@@ -1835,17 +2015,45 @@ var budokanViewer_default = [
|
|
|
1835
2015
|
}
|
|
1836
2016
|
]
|
|
1837
2017
|
},
|
|
2018
|
+
{
|
|
2019
|
+
type: "struct",
|
|
2020
|
+
name: "budokan_interfaces::budokan::ExtensionEntryFeeClaim",
|
|
2021
|
+
members: [
|
|
2022
|
+
{
|
|
2023
|
+
name: "token_id",
|
|
2024
|
+
type: "core::option::Option::<core::felt252>"
|
|
2025
|
+
},
|
|
2026
|
+
{
|
|
2027
|
+
name: "claim_params",
|
|
2028
|
+
type: "core::array::Span::<core::felt252>"
|
|
2029
|
+
}
|
|
2030
|
+
]
|
|
2031
|
+
},
|
|
2032
|
+
{
|
|
2033
|
+
type: "enum",
|
|
2034
|
+
name: "budokan_interfaces::budokan::EntryFeeClaim",
|
|
2035
|
+
variants: [
|
|
2036
|
+
{
|
|
2037
|
+
name: "Token",
|
|
2038
|
+
type: "budokan_interfaces::budokan::EntryFeeRewardType"
|
|
2039
|
+
},
|
|
2040
|
+
{
|
|
2041
|
+
name: "Extension",
|
|
2042
|
+
type: "budokan_interfaces::budokan::ExtensionEntryFeeClaim"
|
|
2043
|
+
}
|
|
2044
|
+
]
|
|
2045
|
+
},
|
|
1838
2046
|
{
|
|
1839
2047
|
type: "enum",
|
|
1840
2048
|
name: "budokan_interfaces::budokan::RewardType",
|
|
1841
2049
|
variants: [
|
|
1842
2050
|
{
|
|
1843
2051
|
name: "Prize",
|
|
1844
|
-
type: "
|
|
2052
|
+
type: "budokan_interfaces::budokan::PrizeClaim"
|
|
1845
2053
|
},
|
|
1846
2054
|
{
|
|
1847
2055
|
name: "EntryFee",
|
|
1848
|
-
type: "budokan_interfaces::budokan::
|
|
2056
|
+
type: "budokan_interfaces::budokan::EntryFeeClaim"
|
|
1849
2057
|
}
|
|
1850
2058
|
]
|
|
1851
2059
|
},
|
|
@@ -2136,6 +2344,62 @@ var budokanViewer_default = [
|
|
|
2136
2344
|
],
|
|
2137
2345
|
state_mutability: "view"
|
|
2138
2346
|
},
|
|
2347
|
+
{
|
|
2348
|
+
type: "function",
|
|
2349
|
+
name: "tournament_registrations_by_owner",
|
|
2350
|
+
inputs: [
|
|
2351
|
+
{
|
|
2352
|
+
name: "tournament_id",
|
|
2353
|
+
type: "core::integer::u64"
|
|
2354
|
+
},
|
|
2355
|
+
{
|
|
2356
|
+
name: "owner",
|
|
2357
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
2358
|
+
},
|
|
2359
|
+
{
|
|
2360
|
+
name: "offset",
|
|
2361
|
+
type: "core::integer::u32"
|
|
2362
|
+
},
|
|
2363
|
+
{
|
|
2364
|
+
name: "limit",
|
|
2365
|
+
type: "core::integer::u32"
|
|
2366
|
+
}
|
|
2367
|
+
],
|
|
2368
|
+
outputs: [
|
|
2369
|
+
{
|
|
2370
|
+
type: "budokan_interfaces::viewer::RegistrationResult"
|
|
2371
|
+
}
|
|
2372
|
+
],
|
|
2373
|
+
state_mutability: "view"
|
|
2374
|
+
},
|
|
2375
|
+
{
|
|
2376
|
+
type: "function",
|
|
2377
|
+
name: "tournament_registrations_by_token_ids",
|
|
2378
|
+
inputs: [
|
|
2379
|
+
{
|
|
2380
|
+
name: "tournament_id",
|
|
2381
|
+
type: "core::integer::u64"
|
|
2382
|
+
},
|
|
2383
|
+
{
|
|
2384
|
+
name: "token_ids",
|
|
2385
|
+
type: "core::array::Array::<core::felt252>"
|
|
2386
|
+
},
|
|
2387
|
+
{
|
|
2388
|
+
name: "offset",
|
|
2389
|
+
type: "core::integer::u32"
|
|
2390
|
+
},
|
|
2391
|
+
{
|
|
2392
|
+
name: "limit",
|
|
2393
|
+
type: "core::integer::u32"
|
|
2394
|
+
}
|
|
2395
|
+
],
|
|
2396
|
+
outputs: [
|
|
2397
|
+
{
|
|
2398
|
+
type: "budokan_interfaces::viewer::RegistrationResult"
|
|
2399
|
+
}
|
|
2400
|
+
],
|
|
2401
|
+
state_mutability: "view"
|
|
2402
|
+
},
|
|
2139
2403
|
{
|
|
2140
2404
|
type: "function",
|
|
2141
2405
|
name: "leaderboard",
|
|
@@ -2171,7 +2435,7 @@ var budokanViewer_default = [
|
|
|
2171
2435
|
],
|
|
2172
2436
|
outputs: [
|
|
2173
2437
|
{
|
|
2174
|
-
type: "core::array::Array::<game_components_interfaces::prize::
|
|
2438
|
+
type: "core::array::Array::<game_components_interfaces::prize::PrizeRecord>"
|
|
2175
2439
|
}
|
|
2176
2440
|
],
|
|
2177
2441
|
state_mutability: "view"
|
|
@@ -2432,26 +2696,60 @@ var budokan_default = [
|
|
|
2432
2696
|
},
|
|
2433
2697
|
{
|
|
2434
2698
|
type: "impl",
|
|
2435
|
-
name: "
|
|
2436
|
-
interface_name: "
|
|
2437
|
-
},
|
|
2438
|
-
{
|
|
2439
|
-
type: "enum",
|
|
2440
|
-
name: "core::bool",
|
|
2441
|
-
variants: [
|
|
2442
|
-
{
|
|
2443
|
-
name: "False",
|
|
2444
|
-
type: "()"
|
|
2445
|
-
},
|
|
2446
|
-
{
|
|
2447
|
-
name: "True",
|
|
2448
|
-
type: "()"
|
|
2449
|
-
}
|
|
2450
|
-
]
|
|
2699
|
+
name: "BudokanRewardsAdminImpl",
|
|
2700
|
+
interface_name: "budokan::budokan::Budokan::IBudokanRewardsAdmin"
|
|
2451
2701
|
},
|
|
2452
2702
|
{
|
|
2453
2703
|
type: "interface",
|
|
2454
|
-
name: "
|
|
2704
|
+
name: "budokan::budokan::Budokan::IBudokanRewardsAdmin",
|
|
2705
|
+
items: [
|
|
2706
|
+
{
|
|
2707
|
+
type: "function",
|
|
2708
|
+
name: "set_rewards_class_hash",
|
|
2709
|
+
inputs: [
|
|
2710
|
+
{
|
|
2711
|
+
name: "new_class_hash",
|
|
2712
|
+
type: "core::starknet::class_hash::ClassHash"
|
|
2713
|
+
}
|
|
2714
|
+
],
|
|
2715
|
+
outputs: [],
|
|
2716
|
+
state_mutability: "external"
|
|
2717
|
+
},
|
|
2718
|
+
{
|
|
2719
|
+
type: "function",
|
|
2720
|
+
name: "rewards_class_hash",
|
|
2721
|
+
inputs: [],
|
|
2722
|
+
outputs: [
|
|
2723
|
+
{
|
|
2724
|
+
type: "core::starknet::class_hash::ClassHash"
|
|
2725
|
+
}
|
|
2726
|
+
],
|
|
2727
|
+
state_mutability: "view"
|
|
2728
|
+
}
|
|
2729
|
+
]
|
|
2730
|
+
},
|
|
2731
|
+
{
|
|
2732
|
+
type: "impl",
|
|
2733
|
+
name: "GameContextImpl",
|
|
2734
|
+
interface_name: "game_components_interfaces::metagame::context::IMetagameContext"
|
|
2735
|
+
},
|
|
2736
|
+
{
|
|
2737
|
+
type: "enum",
|
|
2738
|
+
name: "core::bool",
|
|
2739
|
+
variants: [
|
|
2740
|
+
{
|
|
2741
|
+
name: "False",
|
|
2742
|
+
type: "()"
|
|
2743
|
+
},
|
|
2744
|
+
{
|
|
2745
|
+
name: "True",
|
|
2746
|
+
type: "()"
|
|
2747
|
+
}
|
|
2748
|
+
]
|
|
2749
|
+
},
|
|
2750
|
+
{
|
|
2751
|
+
type: "interface",
|
|
2752
|
+
name: "game_components_interfaces::metagame::context::IMetagameContext",
|
|
2455
2753
|
items: [
|
|
2456
2754
|
{
|
|
2457
2755
|
type: "function",
|
|
@@ -2514,11 +2812,11 @@ var budokan_default = [
|
|
|
2514
2812
|
members: [
|
|
2515
2813
|
{
|
|
2516
2814
|
name: "name",
|
|
2517
|
-
type: "core::
|
|
2815
|
+
type: "core::felt252"
|
|
2518
2816
|
},
|
|
2519
2817
|
{
|
|
2520
2818
|
name: "value",
|
|
2521
|
-
type: "core::
|
|
2819
|
+
type: "core::felt252"
|
|
2522
2820
|
}
|
|
2523
2821
|
]
|
|
2524
2822
|
},
|
|
@@ -2746,50 +3044,54 @@ var budokan_default = [
|
|
|
2746
3044
|
]
|
|
2747
3045
|
},
|
|
2748
3046
|
{
|
|
2749
|
-
type: "
|
|
2750
|
-
name: "core::
|
|
2751
|
-
|
|
2752
|
-
{
|
|
2753
|
-
name: "Some",
|
|
2754
|
-
type: "budokan_interfaces::budokan::EntryFee"
|
|
2755
|
-
},
|
|
3047
|
+
type: "struct",
|
|
3048
|
+
name: "core::array::Span::<core::felt252>",
|
|
3049
|
+
members: [
|
|
2756
3050
|
{
|
|
2757
|
-
name: "
|
|
2758
|
-
type: "
|
|
3051
|
+
name: "snapshot",
|
|
3052
|
+
type: "@core::array::Array::<core::felt252>"
|
|
2759
3053
|
}
|
|
2760
3054
|
]
|
|
2761
3055
|
},
|
|
2762
3056
|
{
|
|
2763
3057
|
type: "struct",
|
|
2764
|
-
name: "
|
|
3058
|
+
name: "metagame_extensions_interfaces::extension::ExtensionConfig",
|
|
2765
3059
|
members: [
|
|
2766
3060
|
{
|
|
2767
|
-
name: "
|
|
2768
|
-
type: "
|
|
3061
|
+
name: "address",
|
|
3062
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
3063
|
+
},
|
|
3064
|
+
{
|
|
3065
|
+
name: "config",
|
|
3066
|
+
type: "core::array::Span::<core::felt252>"
|
|
2769
3067
|
}
|
|
2770
3068
|
]
|
|
2771
3069
|
},
|
|
2772
3070
|
{
|
|
2773
|
-
type: "
|
|
2774
|
-
name: "
|
|
2775
|
-
|
|
3071
|
+
type: "enum",
|
|
3072
|
+
name: "budokan_interfaces::budokan::EntryFeeKind",
|
|
3073
|
+
variants: [
|
|
2776
3074
|
{
|
|
2777
|
-
name: "
|
|
2778
|
-
type: "
|
|
3075
|
+
name: "BuiltIn",
|
|
3076
|
+
type: "budokan_interfaces::budokan::EntryFee"
|
|
3077
|
+
},
|
|
3078
|
+
{
|
|
3079
|
+
name: "Extension",
|
|
3080
|
+
type: "metagame_extensions_interfaces::extension::ExtensionConfig"
|
|
2779
3081
|
}
|
|
2780
3082
|
]
|
|
2781
3083
|
},
|
|
2782
3084
|
{
|
|
2783
|
-
type: "
|
|
2784
|
-
name: "
|
|
2785
|
-
|
|
3085
|
+
type: "enum",
|
|
3086
|
+
name: "core::option::Option::<budokan_interfaces::budokan::EntryFeeKind>",
|
|
3087
|
+
variants: [
|
|
2786
3088
|
{
|
|
2787
|
-
name: "
|
|
2788
|
-
type: "
|
|
3089
|
+
name: "Some",
|
|
3090
|
+
type: "budokan_interfaces::budokan::EntryFeeKind"
|
|
2789
3091
|
},
|
|
2790
3092
|
{
|
|
2791
|
-
name: "
|
|
2792
|
-
type: "
|
|
3093
|
+
name: "None",
|
|
3094
|
+
type: "()"
|
|
2793
3095
|
}
|
|
2794
3096
|
]
|
|
2795
3097
|
},
|
|
@@ -2803,7 +3105,7 @@ var budokan_default = [
|
|
|
2803
3105
|
},
|
|
2804
3106
|
{
|
|
2805
3107
|
name: "extension",
|
|
2806
|
-
type: "
|
|
3108
|
+
type: "metagame_extensions_interfaces::extension::ExtensionConfig"
|
|
2807
3109
|
}
|
|
2808
3110
|
]
|
|
2809
3111
|
},
|
|
@@ -2883,7 +3185,7 @@ var budokan_default = [
|
|
|
2883
3185
|
},
|
|
2884
3186
|
{
|
|
2885
3187
|
name: "entry_fee",
|
|
2886
|
-
type: "core::option::Option::<budokan_interfaces::budokan::
|
|
3188
|
+
type: "core::option::Option::<budokan_interfaces::budokan::EntryFeeKind>"
|
|
2887
3189
|
},
|
|
2888
3190
|
{
|
|
2889
3191
|
name: "entry_requirement",
|
|
@@ -2925,6 +3227,20 @@ var budokan_default = [
|
|
|
2925
3227
|
}
|
|
2926
3228
|
]
|
|
2927
3229
|
},
|
|
3230
|
+
{
|
|
3231
|
+
type: "enum",
|
|
3232
|
+
name: "core::option::Option::<core::felt252>",
|
|
3233
|
+
variants: [
|
|
3234
|
+
{
|
|
3235
|
+
name: "Some",
|
|
3236
|
+
type: "core::felt252"
|
|
3237
|
+
},
|
|
3238
|
+
{
|
|
3239
|
+
name: "None",
|
|
3240
|
+
type: "()"
|
|
3241
|
+
}
|
|
3242
|
+
]
|
|
3243
|
+
},
|
|
2928
3244
|
{
|
|
2929
3245
|
type: "struct",
|
|
2930
3246
|
name: "core::integer::u256",
|
|
@@ -2957,10 +3273,6 @@ var budokan_default = [
|
|
|
2957
3273
|
name: "NFT",
|
|
2958
3274
|
type: "game_components_interfaces::entry_requirement::NFTQualification"
|
|
2959
3275
|
},
|
|
2960
|
-
{
|
|
2961
|
-
name: "Address",
|
|
2962
|
-
type: "core::starknet::contract_address::ContractAddress"
|
|
2963
|
-
},
|
|
2964
3276
|
{
|
|
2965
3277
|
name: "Extension",
|
|
2966
3278
|
type: "core::array::Span::<core::felt252>"
|
|
@@ -2981,6 +3293,38 @@ var budokan_default = [
|
|
|
2981
3293
|
}
|
|
2982
3294
|
]
|
|
2983
3295
|
},
|
|
3296
|
+
{
|
|
3297
|
+
type: "enum",
|
|
3298
|
+
name: "core::option::Option::<core::array::Span::<core::felt252>>",
|
|
3299
|
+
variants: [
|
|
3300
|
+
{
|
|
3301
|
+
name: "Some",
|
|
3302
|
+
type: "core::array::Span::<core::felt252>"
|
|
3303
|
+
},
|
|
3304
|
+
{
|
|
3305
|
+
name: "None",
|
|
3306
|
+
type: "()"
|
|
3307
|
+
}
|
|
3308
|
+
]
|
|
3309
|
+
},
|
|
3310
|
+
{
|
|
3311
|
+
type: "struct",
|
|
3312
|
+
name: "budokan_interfaces::budokan::TournamentRecipientParams",
|
|
3313
|
+
members: [
|
|
3314
|
+
{
|
|
3315
|
+
name: "player_address",
|
|
3316
|
+
type: "core::option::Option::<core::starknet::contract_address::ContractAddress>"
|
|
3317
|
+
},
|
|
3318
|
+
{
|
|
3319
|
+
name: "qualifier",
|
|
3320
|
+
type: "core::option::Option::<core::starknet::contract_address::ContractAddress>"
|
|
3321
|
+
},
|
|
3322
|
+
{
|
|
3323
|
+
name: "qualification",
|
|
3324
|
+
type: "core::option::Option::<game_components_interfaces::entry_requirement::QualificationProof>"
|
|
3325
|
+
}
|
|
3326
|
+
]
|
|
3327
|
+
},
|
|
2984
3328
|
{
|
|
2985
3329
|
type: "enum",
|
|
2986
3330
|
name: "game_components_interfaces::prize::PrizeType",
|
|
@@ -2995,6 +3339,38 @@ var budokan_default = [
|
|
|
2995
3339
|
}
|
|
2996
3340
|
]
|
|
2997
3341
|
},
|
|
3342
|
+
{
|
|
3343
|
+
type: "struct",
|
|
3344
|
+
name: "budokan_interfaces::budokan::ExtensionPrizeClaim",
|
|
3345
|
+
members: [
|
|
3346
|
+
{
|
|
3347
|
+
name: "prize_id",
|
|
3348
|
+
type: "core::integer::u64"
|
|
3349
|
+
},
|
|
3350
|
+
{
|
|
3351
|
+
name: "token_id",
|
|
3352
|
+
type: "core::option::Option::<core::felt252>"
|
|
3353
|
+
},
|
|
3354
|
+
{
|
|
3355
|
+
name: "payout_params",
|
|
3356
|
+
type: "core::array::Span::<core::felt252>"
|
|
3357
|
+
}
|
|
3358
|
+
]
|
|
3359
|
+
},
|
|
3360
|
+
{
|
|
3361
|
+
type: "enum",
|
|
3362
|
+
name: "budokan_interfaces::budokan::PrizeClaim",
|
|
3363
|
+
variants: [
|
|
3364
|
+
{
|
|
3365
|
+
name: "Token",
|
|
3366
|
+
type: "game_components_interfaces::prize::PrizeType"
|
|
3367
|
+
},
|
|
3368
|
+
{
|
|
3369
|
+
name: "Extension",
|
|
3370
|
+
type: "budokan_interfaces::budokan::ExtensionPrizeClaim"
|
|
3371
|
+
}
|
|
3372
|
+
]
|
|
3373
|
+
},
|
|
2998
3374
|
{
|
|
2999
3375
|
type: "enum",
|
|
3000
3376
|
name: "budokan_interfaces::budokan::EntryFeeRewardType",
|
|
@@ -3017,17 +3393,45 @@ var budokan_default = [
|
|
|
3017
3393
|
}
|
|
3018
3394
|
]
|
|
3019
3395
|
},
|
|
3396
|
+
{
|
|
3397
|
+
type: "struct",
|
|
3398
|
+
name: "budokan_interfaces::budokan::ExtensionEntryFeeClaim",
|
|
3399
|
+
members: [
|
|
3400
|
+
{
|
|
3401
|
+
name: "token_id",
|
|
3402
|
+
type: "core::option::Option::<core::felt252>"
|
|
3403
|
+
},
|
|
3404
|
+
{
|
|
3405
|
+
name: "claim_params",
|
|
3406
|
+
type: "core::array::Span::<core::felt252>"
|
|
3407
|
+
}
|
|
3408
|
+
]
|
|
3409
|
+
},
|
|
3410
|
+
{
|
|
3411
|
+
type: "enum",
|
|
3412
|
+
name: "budokan_interfaces::budokan::EntryFeeClaim",
|
|
3413
|
+
variants: [
|
|
3414
|
+
{
|
|
3415
|
+
name: "Token",
|
|
3416
|
+
type: "budokan_interfaces::budokan::EntryFeeRewardType"
|
|
3417
|
+
},
|
|
3418
|
+
{
|
|
3419
|
+
name: "Extension",
|
|
3420
|
+
type: "budokan_interfaces::budokan::ExtensionEntryFeeClaim"
|
|
3421
|
+
}
|
|
3422
|
+
]
|
|
3423
|
+
},
|
|
3020
3424
|
{
|
|
3021
3425
|
type: "enum",
|
|
3022
3426
|
name: "budokan_interfaces::budokan::RewardType",
|
|
3023
3427
|
variants: [
|
|
3024
3428
|
{
|
|
3025
3429
|
name: "Prize",
|
|
3026
|
-
type: "
|
|
3430
|
+
type: "budokan_interfaces::budokan::PrizeClaim"
|
|
3027
3431
|
},
|
|
3028
3432
|
{
|
|
3029
3433
|
name: "EntryFee",
|
|
3030
|
-
type: "budokan_interfaces::budokan::
|
|
3434
|
+
type: "budokan_interfaces::budokan::EntryFeeClaim"
|
|
3031
3435
|
}
|
|
3032
3436
|
]
|
|
3033
3437
|
},
|
|
@@ -3089,16 +3493,8 @@ var budokan_default = [
|
|
|
3089
3493
|
},
|
|
3090
3494
|
{
|
|
3091
3495
|
type: "struct",
|
|
3092
|
-
name: "game_components_interfaces::prize::
|
|
3496
|
+
name: "game_components_interfaces::prize::TokenPrizePayload",
|
|
3093
3497
|
members: [
|
|
3094
|
-
{
|
|
3095
|
-
name: "id",
|
|
3096
|
-
type: "core::integer::u64"
|
|
3097
|
-
},
|
|
3098
|
-
{
|
|
3099
|
-
name: "context_id",
|
|
3100
|
-
type: "core::integer::u64"
|
|
3101
|
-
},
|
|
3102
3498
|
{
|
|
3103
3499
|
name: "token_address",
|
|
3104
3500
|
type: "core::starknet::contract_address::ContractAddress"
|
|
@@ -3106,10 +3502,34 @@ var budokan_default = [
|
|
|
3106
3502
|
{
|
|
3107
3503
|
name: "token_type",
|
|
3108
3504
|
type: "game_components_interfaces::prize::TokenTypeData"
|
|
3109
|
-
}
|
|
3505
|
+
}
|
|
3506
|
+
]
|
|
3507
|
+
},
|
|
3508
|
+
{
|
|
3509
|
+
type: "struct",
|
|
3510
|
+
name: "game_components_interfaces::prize::ExtensionPrizePayload",
|
|
3511
|
+
members: [
|
|
3110
3512
|
{
|
|
3111
|
-
name: "
|
|
3513
|
+
name: "address",
|
|
3112
3514
|
type: "core::starknet::contract_address::ContractAddress"
|
|
3515
|
+
},
|
|
3516
|
+
{
|
|
3517
|
+
name: "config",
|
|
3518
|
+
type: "core::array::Span::<core::felt252>"
|
|
3519
|
+
}
|
|
3520
|
+
]
|
|
3521
|
+
},
|
|
3522
|
+
{
|
|
3523
|
+
type: "enum",
|
|
3524
|
+
name: "game_components_interfaces::prize::Prize",
|
|
3525
|
+
variants: [
|
|
3526
|
+
{
|
|
3527
|
+
name: "Token",
|
|
3528
|
+
type: "game_components_interfaces::prize::TokenPrizePayload"
|
|
3529
|
+
},
|
|
3530
|
+
{
|
|
3531
|
+
name: "Extension",
|
|
3532
|
+
type: "game_components_interfaces::prize::ExtensionPrizePayload"
|
|
3113
3533
|
}
|
|
3114
3534
|
]
|
|
3115
3535
|
},
|
|
@@ -3144,38 +3564,6 @@ var budokan_default = [
|
|
|
3144
3564
|
],
|
|
3145
3565
|
state_mutability: "view"
|
|
3146
3566
|
},
|
|
3147
|
-
{
|
|
3148
|
-
type: "function",
|
|
3149
|
-
name: "tournament_entries",
|
|
3150
|
-
inputs: [
|
|
3151
|
-
{
|
|
3152
|
-
name: "tournament_id",
|
|
3153
|
-
type: "core::integer::u64"
|
|
3154
|
-
}
|
|
3155
|
-
],
|
|
3156
|
-
outputs: [
|
|
3157
|
-
{
|
|
3158
|
-
type: "core::integer::u32"
|
|
3159
|
-
}
|
|
3160
|
-
],
|
|
3161
|
-
state_mutability: "view"
|
|
3162
|
-
},
|
|
3163
|
-
{
|
|
3164
|
-
type: "function",
|
|
3165
|
-
name: "get_leaderboard",
|
|
3166
|
-
inputs: [
|
|
3167
|
-
{
|
|
3168
|
-
name: "tournament_id",
|
|
3169
|
-
type: "core::integer::u64"
|
|
3170
|
-
}
|
|
3171
|
-
],
|
|
3172
|
-
outputs: [
|
|
3173
|
-
{
|
|
3174
|
-
type: "core::array::Array::<core::felt252>"
|
|
3175
|
-
}
|
|
3176
|
-
],
|
|
3177
|
-
state_mutability: "view"
|
|
3178
|
-
},
|
|
3179
3567
|
{
|
|
3180
3568
|
type: "function",
|
|
3181
3569
|
name: "current_phase",
|
|
@@ -3230,7 +3618,7 @@ var budokan_default = [
|
|
|
3230
3618
|
},
|
|
3231
3619
|
{
|
|
3232
3620
|
name: "entry_fee",
|
|
3233
|
-
type: "core::option::Option::<budokan_interfaces::budokan::
|
|
3621
|
+
type: "core::option::Option::<budokan_interfaces::budokan::EntryFeeKind>"
|
|
3234
3622
|
},
|
|
3235
3623
|
{
|
|
3236
3624
|
name: "entry_requirement",
|
|
@@ -3266,16 +3654,24 @@ var budokan_default = [
|
|
|
3266
3654
|
},
|
|
3267
3655
|
{
|
|
3268
3656
|
name: "player_name",
|
|
3269
|
-
type: "core::felt252"
|
|
3657
|
+
type: "core::option::Option::<core::felt252>"
|
|
3270
3658
|
},
|
|
3271
3659
|
{
|
|
3272
3660
|
name: "player_address",
|
|
3273
|
-
type: "core::starknet::contract_address::ContractAddress"
|
|
3661
|
+
type: "core::option::Option::<core::starknet::contract_address::ContractAddress>"
|
|
3662
|
+
},
|
|
3663
|
+
{
|
|
3664
|
+
name: "qualifier",
|
|
3665
|
+
type: "core::option::Option::<core::starknet::contract_address::ContractAddress>"
|
|
3274
3666
|
},
|
|
3275
3667
|
{
|
|
3276
3668
|
name: "qualification",
|
|
3277
3669
|
type: "core::option::Option::<game_components_interfaces::entry_requirement::QualificationProof>"
|
|
3278
3670
|
},
|
|
3671
|
+
{
|
|
3672
|
+
name: "entry_fee_pay_params",
|
|
3673
|
+
type: "core::option::Option::<core::array::Span::<core::felt252>>"
|
|
3674
|
+
},
|
|
3279
3675
|
{
|
|
3280
3676
|
name: "salt",
|
|
3281
3677
|
type: "core::integer::u16"
|
|
@@ -3294,7 +3690,39 @@ var budokan_default = [
|
|
|
3294
3690
|
},
|
|
3295
3691
|
{
|
|
3296
3692
|
type: "function",
|
|
3297
|
-
name: "
|
|
3693
|
+
name: "enter_tournament_for_recipients",
|
|
3694
|
+
inputs: [
|
|
3695
|
+
{
|
|
3696
|
+
name: "tournament_id",
|
|
3697
|
+
type: "core::integer::u64"
|
|
3698
|
+
},
|
|
3699
|
+
{
|
|
3700
|
+
name: "recipients",
|
|
3701
|
+
type: "core::array::Array::<budokan_interfaces::budokan::TournamentRecipientParams>"
|
|
3702
|
+
},
|
|
3703
|
+
{
|
|
3704
|
+
name: "player_name",
|
|
3705
|
+
type: "core::option::Option::<core::felt252>"
|
|
3706
|
+
},
|
|
3707
|
+
{
|
|
3708
|
+
name: "salt",
|
|
3709
|
+
type: "core::integer::u16"
|
|
3710
|
+
},
|
|
3711
|
+
{
|
|
3712
|
+
name: "metadata_value",
|
|
3713
|
+
type: "core::integer::u16"
|
|
3714
|
+
}
|
|
3715
|
+
],
|
|
3716
|
+
outputs: [
|
|
3717
|
+
{
|
|
3718
|
+
type: "core::array::Array::<core::felt252>"
|
|
3719
|
+
}
|
|
3720
|
+
],
|
|
3721
|
+
state_mutability: "external"
|
|
3722
|
+
},
|
|
3723
|
+
{
|
|
3724
|
+
type: "function",
|
|
3725
|
+
name: "ban_entry",
|
|
3298
3726
|
inputs: [
|
|
3299
3727
|
{
|
|
3300
3728
|
name: "tournament_id",
|
|
@@ -3357,12 +3785,8 @@ var budokan_default = [
|
|
|
3357
3785
|
type: "core::integer::u64"
|
|
3358
3786
|
},
|
|
3359
3787
|
{
|
|
3360
|
-
name: "
|
|
3361
|
-
type: "
|
|
3362
|
-
},
|
|
3363
|
-
{
|
|
3364
|
-
name: "token_type",
|
|
3365
|
-
type: "game_components_interfaces::prize::TokenTypeData"
|
|
3788
|
+
name: "prize",
|
|
3789
|
+
type: "game_components_interfaces::prize::Prize"
|
|
3366
3790
|
},
|
|
3367
3791
|
{
|
|
3368
3792
|
name: "position",
|
|
@@ -3371,7 +3795,7 @@ var budokan_default = [
|
|
|
3371
3795
|
],
|
|
3372
3796
|
outputs: [
|
|
3373
3797
|
{
|
|
3374
|
-
type: "
|
|
3798
|
+
type: "core::integer::u64"
|
|
3375
3799
|
}
|
|
3376
3800
|
],
|
|
3377
3801
|
state_mutability: "external"
|
|
@@ -3545,6 +3969,14 @@ var budokan_default = [
|
|
|
3545
3969
|
{
|
|
3546
3970
|
name: "additional_shares",
|
|
3547
3971
|
type: "core::array::Span::<game_components_interfaces::entry_fee::AdditionalShare>"
|
|
3972
|
+
},
|
|
3973
|
+
{
|
|
3974
|
+
name: "distribution",
|
|
3975
|
+
type: "core::option::Option::<game_components_interfaces::distribution::Distribution>"
|
|
3976
|
+
},
|
|
3977
|
+
{
|
|
3978
|
+
name: "distribution_count",
|
|
3979
|
+
type: "core::integer::u32"
|
|
3548
3980
|
}
|
|
3549
3981
|
]
|
|
3550
3982
|
},
|
|
@@ -3642,60 +4074,330 @@ var budokan_default = [
|
|
|
3642
4074
|
],
|
|
3643
4075
|
outputs: [
|
|
3644
4076
|
{
|
|
3645
|
-
type: "game_components_interfaces::entry_requirement::QualificationEntries"
|
|
4077
|
+
type: "game_components_interfaces::entry_requirement::QualificationEntries"
|
|
4078
|
+
}
|
|
4079
|
+
],
|
|
4080
|
+
state_mutability: "view"
|
|
4081
|
+
}
|
|
4082
|
+
]
|
|
4083
|
+
},
|
|
4084
|
+
{
|
|
4085
|
+
type: "impl",
|
|
4086
|
+
name: "PrizeImpl",
|
|
4087
|
+
interface_name: "game_components_interfaces::prize::IPrize"
|
|
4088
|
+
},
|
|
4089
|
+
{
|
|
4090
|
+
type: "struct",
|
|
4091
|
+
name: "game_components_interfaces::prize::PrizeRecord",
|
|
4092
|
+
members: [
|
|
4093
|
+
{
|
|
4094
|
+
name: "id",
|
|
4095
|
+
type: "core::integer::u64"
|
|
4096
|
+
},
|
|
4097
|
+
{
|
|
4098
|
+
name: "context_id",
|
|
4099
|
+
type: "core::integer::u64"
|
|
4100
|
+
},
|
|
4101
|
+
{
|
|
4102
|
+
name: "sponsor_address",
|
|
4103
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
4104
|
+
},
|
|
4105
|
+
{
|
|
4106
|
+
name: "prize",
|
|
4107
|
+
type: "game_components_interfaces::prize::Prize"
|
|
4108
|
+
}
|
|
4109
|
+
]
|
|
4110
|
+
},
|
|
4111
|
+
{
|
|
4112
|
+
type: "interface",
|
|
4113
|
+
name: "game_components_interfaces::prize::IPrize",
|
|
4114
|
+
items: [
|
|
4115
|
+
{
|
|
4116
|
+
type: "function",
|
|
4117
|
+
name: "get_prize",
|
|
4118
|
+
inputs: [
|
|
4119
|
+
{
|
|
4120
|
+
name: "prize_id",
|
|
4121
|
+
type: "core::integer::u64"
|
|
4122
|
+
}
|
|
4123
|
+
],
|
|
4124
|
+
outputs: [
|
|
4125
|
+
{
|
|
4126
|
+
type: "game_components_interfaces::prize::PrizeRecord"
|
|
4127
|
+
}
|
|
4128
|
+
],
|
|
4129
|
+
state_mutability: "view"
|
|
4130
|
+
},
|
|
4131
|
+
{
|
|
4132
|
+
type: "function",
|
|
4133
|
+
name: "get_total_prizes",
|
|
4134
|
+
inputs: [],
|
|
4135
|
+
outputs: [
|
|
4136
|
+
{
|
|
4137
|
+
type: "core::integer::u64"
|
|
4138
|
+
}
|
|
4139
|
+
],
|
|
4140
|
+
state_mutability: "view"
|
|
4141
|
+
},
|
|
4142
|
+
{
|
|
4143
|
+
type: "function",
|
|
4144
|
+
name: "is_prize_claimed",
|
|
4145
|
+
inputs: [
|
|
4146
|
+
{
|
|
4147
|
+
name: "context_id",
|
|
4148
|
+
type: "core::integer::u64"
|
|
4149
|
+
},
|
|
4150
|
+
{
|
|
4151
|
+
name: "prize_type",
|
|
4152
|
+
type: "game_components_interfaces::prize::PrizeType"
|
|
4153
|
+
}
|
|
4154
|
+
],
|
|
4155
|
+
outputs: [
|
|
4156
|
+
{
|
|
4157
|
+
type: "core::bool"
|
|
4158
|
+
}
|
|
4159
|
+
],
|
|
4160
|
+
state_mutability: "view"
|
|
4161
|
+
}
|
|
4162
|
+
]
|
|
4163
|
+
},
|
|
4164
|
+
{
|
|
4165
|
+
type: "impl",
|
|
4166
|
+
name: "RegistrationImpl",
|
|
4167
|
+
interface_name: "game_components_interfaces::registration::IRegistration"
|
|
4168
|
+
},
|
|
4169
|
+
{
|
|
4170
|
+
type: "struct",
|
|
4171
|
+
name: "game_components_interfaces::registration::Registration",
|
|
4172
|
+
members: [
|
|
4173
|
+
{
|
|
4174
|
+
name: "context_id",
|
|
4175
|
+
type: "core::integer::u64"
|
|
4176
|
+
},
|
|
4177
|
+
{
|
|
4178
|
+
name: "entry_id",
|
|
4179
|
+
type: "core::integer::u32"
|
|
4180
|
+
},
|
|
4181
|
+
{
|
|
4182
|
+
name: "game_token_id",
|
|
4183
|
+
type: "core::felt252"
|
|
4184
|
+
},
|
|
4185
|
+
{
|
|
4186
|
+
name: "has_submitted",
|
|
4187
|
+
type: "core::bool"
|
|
4188
|
+
},
|
|
4189
|
+
{
|
|
4190
|
+
name: "is_banned",
|
|
4191
|
+
type: "core::bool"
|
|
4192
|
+
}
|
|
4193
|
+
]
|
|
4194
|
+
},
|
|
4195
|
+
{
|
|
4196
|
+
type: "interface",
|
|
4197
|
+
name: "game_components_interfaces::registration::IRegistration",
|
|
4198
|
+
items: [
|
|
4199
|
+
{
|
|
4200
|
+
type: "function",
|
|
4201
|
+
name: "get_entry",
|
|
4202
|
+
inputs: [
|
|
4203
|
+
{
|
|
4204
|
+
name: "context_id",
|
|
4205
|
+
type: "core::integer::u64"
|
|
4206
|
+
},
|
|
4207
|
+
{
|
|
4208
|
+
name: "entry_id",
|
|
4209
|
+
type: "core::integer::u32"
|
|
4210
|
+
}
|
|
4211
|
+
],
|
|
4212
|
+
outputs: [
|
|
4213
|
+
{
|
|
4214
|
+
type: "game_components_interfaces::registration::Registration"
|
|
4215
|
+
}
|
|
4216
|
+
],
|
|
4217
|
+
state_mutability: "view"
|
|
4218
|
+
},
|
|
4219
|
+
{
|
|
4220
|
+
type: "function",
|
|
4221
|
+
name: "entry_exists",
|
|
4222
|
+
inputs: [
|
|
4223
|
+
{
|
|
4224
|
+
name: "context_id",
|
|
4225
|
+
type: "core::integer::u64"
|
|
4226
|
+
},
|
|
4227
|
+
{
|
|
4228
|
+
name: "entry_id",
|
|
4229
|
+
type: "core::integer::u32"
|
|
4230
|
+
}
|
|
4231
|
+
],
|
|
4232
|
+
outputs: [
|
|
4233
|
+
{
|
|
4234
|
+
type: "core::bool"
|
|
4235
|
+
}
|
|
4236
|
+
],
|
|
4237
|
+
state_mutability: "view"
|
|
4238
|
+
},
|
|
4239
|
+
{
|
|
4240
|
+
type: "function",
|
|
4241
|
+
name: "is_token_banned",
|
|
4242
|
+
inputs: [
|
|
4243
|
+
{
|
|
4244
|
+
name: "token_id",
|
|
4245
|
+
type: "core::felt252"
|
|
4246
|
+
}
|
|
4247
|
+
],
|
|
4248
|
+
outputs: [
|
|
4249
|
+
{
|
|
4250
|
+
type: "core::bool"
|
|
4251
|
+
}
|
|
4252
|
+
],
|
|
4253
|
+
state_mutability: "view"
|
|
4254
|
+
},
|
|
4255
|
+
{
|
|
4256
|
+
type: "function",
|
|
4257
|
+
name: "get_entry_count",
|
|
4258
|
+
inputs: [
|
|
4259
|
+
{
|
|
4260
|
+
name: "context_id",
|
|
4261
|
+
type: "core::integer::u64"
|
|
4262
|
+
}
|
|
4263
|
+
],
|
|
4264
|
+
outputs: [
|
|
4265
|
+
{
|
|
4266
|
+
type: "core::integer::u32"
|
|
4267
|
+
}
|
|
4268
|
+
],
|
|
4269
|
+
state_mutability: "view"
|
|
4270
|
+
}
|
|
4271
|
+
]
|
|
4272
|
+
},
|
|
4273
|
+
{
|
|
4274
|
+
type: "impl",
|
|
4275
|
+
name: "LeaderboardImpl",
|
|
4276
|
+
interface_name: "game_components_interfaces::leaderboard::ILeaderboard"
|
|
4277
|
+
},
|
|
4278
|
+
{
|
|
4279
|
+
type: "struct",
|
|
4280
|
+
name: "game_components_interfaces::structs::leaderboard::LeaderboardEntry",
|
|
4281
|
+
members: [
|
|
4282
|
+
{
|
|
4283
|
+
name: "id",
|
|
4284
|
+
type: "core::felt252"
|
|
4285
|
+
},
|
|
4286
|
+
{
|
|
4287
|
+
name: "score",
|
|
4288
|
+
type: "core::integer::u64"
|
|
4289
|
+
}
|
|
4290
|
+
]
|
|
4291
|
+
},
|
|
4292
|
+
{
|
|
4293
|
+
type: "struct",
|
|
4294
|
+
name: "game_components_interfaces::structs::leaderboard::LeaderboardStoreConfig",
|
|
4295
|
+
members: [
|
|
4296
|
+
{
|
|
4297
|
+
name: "max_entries",
|
|
4298
|
+
type: "core::integer::u32"
|
|
4299
|
+
},
|
|
4300
|
+
{
|
|
4301
|
+
name: "ascending",
|
|
4302
|
+
type: "core::bool"
|
|
4303
|
+
},
|
|
4304
|
+
{
|
|
4305
|
+
name: "game_address",
|
|
4306
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
4307
|
+
}
|
|
4308
|
+
]
|
|
4309
|
+
},
|
|
4310
|
+
{
|
|
4311
|
+
type: "interface",
|
|
4312
|
+
name: "game_components_interfaces::leaderboard::ILeaderboard",
|
|
4313
|
+
items: [
|
|
4314
|
+
{
|
|
4315
|
+
type: "function",
|
|
4316
|
+
name: "get_leaderboard_entries",
|
|
4317
|
+
inputs: [
|
|
4318
|
+
{
|
|
4319
|
+
name: "context_id",
|
|
4320
|
+
type: "core::integer::u64"
|
|
4321
|
+
}
|
|
4322
|
+
],
|
|
4323
|
+
outputs: [
|
|
4324
|
+
{
|
|
4325
|
+
type: "core::array::Array::<game_components_interfaces::structs::leaderboard::LeaderboardEntry>"
|
|
4326
|
+
}
|
|
4327
|
+
],
|
|
4328
|
+
state_mutability: "view"
|
|
4329
|
+
},
|
|
4330
|
+
{
|
|
4331
|
+
type: "function",
|
|
4332
|
+
name: "get_leaderboard_entry",
|
|
4333
|
+
inputs: [
|
|
4334
|
+
{
|
|
4335
|
+
name: "context_id",
|
|
4336
|
+
type: "core::integer::u64"
|
|
4337
|
+
},
|
|
4338
|
+
{
|
|
4339
|
+
name: "position",
|
|
4340
|
+
type: "core::integer::u32"
|
|
4341
|
+
}
|
|
4342
|
+
],
|
|
4343
|
+
outputs: [
|
|
4344
|
+
{
|
|
4345
|
+
type: "game_components_interfaces::structs::leaderboard::LeaderboardEntry"
|
|
3646
4346
|
}
|
|
3647
4347
|
],
|
|
3648
4348
|
state_mutability: "view"
|
|
3649
|
-
}
|
|
3650
|
-
]
|
|
3651
|
-
},
|
|
3652
|
-
{
|
|
3653
|
-
type: "impl",
|
|
3654
|
-
name: "PrizeImpl",
|
|
3655
|
-
interface_name: "game_components_interfaces::prize::IPrize"
|
|
3656
|
-
},
|
|
3657
|
-
{
|
|
3658
|
-
type: "interface",
|
|
3659
|
-
name: "game_components_interfaces::prize::IPrize",
|
|
3660
|
-
items: [
|
|
4349
|
+
},
|
|
3661
4350
|
{
|
|
3662
4351
|
type: "function",
|
|
3663
|
-
name: "
|
|
4352
|
+
name: "get_top_leaderboard_entries",
|
|
3664
4353
|
inputs: [
|
|
3665
4354
|
{
|
|
3666
|
-
name: "
|
|
4355
|
+
name: "context_id",
|
|
3667
4356
|
type: "core::integer::u64"
|
|
4357
|
+
},
|
|
4358
|
+
{
|
|
4359
|
+
name: "count",
|
|
4360
|
+
type: "core::integer::u32"
|
|
3668
4361
|
}
|
|
3669
4362
|
],
|
|
3670
4363
|
outputs: [
|
|
3671
4364
|
{
|
|
3672
|
-
type: "game_components_interfaces::
|
|
4365
|
+
type: "core::array::Array::<game_components_interfaces::structs::leaderboard::LeaderboardEntry>"
|
|
3673
4366
|
}
|
|
3674
4367
|
],
|
|
3675
4368
|
state_mutability: "view"
|
|
3676
4369
|
},
|
|
3677
4370
|
{
|
|
3678
4371
|
type: "function",
|
|
3679
|
-
name: "
|
|
3680
|
-
inputs: [
|
|
3681
|
-
outputs: [
|
|
4372
|
+
name: "get_position",
|
|
4373
|
+
inputs: [
|
|
3682
4374
|
{
|
|
4375
|
+
name: "context_id",
|
|
3683
4376
|
type: "core::integer::u64"
|
|
4377
|
+
},
|
|
4378
|
+
{
|
|
4379
|
+
name: "token_id",
|
|
4380
|
+
type: "core::felt252"
|
|
4381
|
+
}
|
|
4382
|
+
],
|
|
4383
|
+
outputs: [
|
|
4384
|
+
{
|
|
4385
|
+
type: "core::option::Option::<core::integer::u32>"
|
|
3684
4386
|
}
|
|
3685
4387
|
],
|
|
3686
4388
|
state_mutability: "view"
|
|
3687
4389
|
},
|
|
3688
4390
|
{
|
|
3689
4391
|
type: "function",
|
|
3690
|
-
name: "
|
|
4392
|
+
name: "qualifies",
|
|
3691
4393
|
inputs: [
|
|
3692
4394
|
{
|
|
3693
4395
|
name: "context_id",
|
|
3694
4396
|
type: "core::integer::u64"
|
|
3695
4397
|
},
|
|
3696
4398
|
{
|
|
3697
|
-
name: "
|
|
3698
|
-
type: "
|
|
4399
|
+
name: "score",
|
|
4400
|
+
type: "core::integer::u64"
|
|
3699
4401
|
}
|
|
3700
4402
|
],
|
|
3701
4403
|
outputs: [
|
|
@@ -3704,116 +4406,75 @@ var budokan_default = [
|
|
|
3704
4406
|
}
|
|
3705
4407
|
],
|
|
3706
4408
|
state_mutability: "view"
|
|
3707
|
-
}
|
|
3708
|
-
]
|
|
3709
|
-
},
|
|
3710
|
-
{
|
|
3711
|
-
type: "impl",
|
|
3712
|
-
name: "RegistrationImpl",
|
|
3713
|
-
interface_name: "game_components_interfaces::registration::IRegistration"
|
|
3714
|
-
},
|
|
3715
|
-
{
|
|
3716
|
-
type: "struct",
|
|
3717
|
-
name: "game_components_interfaces::registration::Registration",
|
|
3718
|
-
members: [
|
|
3719
|
-
{
|
|
3720
|
-
name: "context_id",
|
|
3721
|
-
type: "core::integer::u64"
|
|
3722
|
-
},
|
|
3723
|
-
{
|
|
3724
|
-
name: "entry_id",
|
|
3725
|
-
type: "core::integer::u32"
|
|
3726
|
-
},
|
|
3727
|
-
{
|
|
3728
|
-
name: "game_token_id",
|
|
3729
|
-
type: "core::felt252"
|
|
3730
|
-
},
|
|
3731
|
-
{
|
|
3732
|
-
name: "has_submitted",
|
|
3733
|
-
type: "core::bool"
|
|
3734
4409
|
},
|
|
3735
|
-
{
|
|
3736
|
-
name: "is_banned",
|
|
3737
|
-
type: "core::bool"
|
|
3738
|
-
}
|
|
3739
|
-
]
|
|
3740
|
-
},
|
|
3741
|
-
{
|
|
3742
|
-
type: "interface",
|
|
3743
|
-
name: "game_components_interfaces::registration::IRegistration",
|
|
3744
|
-
items: [
|
|
3745
4410
|
{
|
|
3746
4411
|
type: "function",
|
|
3747
|
-
name: "
|
|
4412
|
+
name: "is_full",
|
|
3748
4413
|
inputs: [
|
|
3749
4414
|
{
|
|
3750
4415
|
name: "context_id",
|
|
3751
4416
|
type: "core::integer::u64"
|
|
3752
|
-
},
|
|
3753
|
-
{
|
|
3754
|
-
name: "entry_id",
|
|
3755
|
-
type: "core::integer::u32"
|
|
3756
4417
|
}
|
|
3757
4418
|
],
|
|
3758
4419
|
outputs: [
|
|
3759
4420
|
{
|
|
3760
|
-
type: "
|
|
4421
|
+
type: "core::bool"
|
|
3761
4422
|
}
|
|
3762
4423
|
],
|
|
3763
4424
|
state_mutability: "view"
|
|
3764
4425
|
},
|
|
3765
4426
|
{
|
|
3766
4427
|
type: "function",
|
|
3767
|
-
name: "
|
|
4428
|
+
name: "get_leaderboard_length",
|
|
3768
4429
|
inputs: [
|
|
3769
4430
|
{
|
|
3770
4431
|
name: "context_id",
|
|
3771
4432
|
type: "core::integer::u64"
|
|
3772
|
-
},
|
|
3773
|
-
{
|
|
3774
|
-
name: "entry_id",
|
|
3775
|
-
type: "core::integer::u32"
|
|
3776
4433
|
}
|
|
3777
4434
|
],
|
|
3778
4435
|
outputs: [
|
|
3779
4436
|
{
|
|
3780
|
-
type: "core::
|
|
4437
|
+
type: "core::integer::u32"
|
|
3781
4438
|
}
|
|
3782
4439
|
],
|
|
3783
4440
|
state_mutability: "view"
|
|
3784
4441
|
},
|
|
3785
4442
|
{
|
|
3786
4443
|
type: "function",
|
|
3787
|
-
name: "
|
|
4444
|
+
name: "get_config",
|
|
3788
4445
|
inputs: [
|
|
3789
4446
|
{
|
|
3790
4447
|
name: "context_id",
|
|
3791
4448
|
type: "core::integer::u64"
|
|
3792
|
-
},
|
|
3793
|
-
{
|
|
3794
|
-
name: "entry_id",
|
|
3795
|
-
type: "core::integer::u32"
|
|
3796
4449
|
}
|
|
3797
4450
|
],
|
|
3798
4451
|
outputs: [
|
|
3799
4452
|
{
|
|
3800
|
-
type: "
|
|
4453
|
+
type: "game_components_interfaces::structs::leaderboard::LeaderboardStoreConfig"
|
|
3801
4454
|
}
|
|
3802
4455
|
],
|
|
3803
4456
|
state_mutability: "view"
|
|
3804
4457
|
},
|
|
3805
4458
|
{
|
|
3806
4459
|
type: "function",
|
|
3807
|
-
name: "
|
|
4460
|
+
name: "find_position",
|
|
3808
4461
|
inputs: [
|
|
3809
4462
|
{
|
|
3810
4463
|
name: "context_id",
|
|
3811
4464
|
type: "core::integer::u64"
|
|
4465
|
+
},
|
|
4466
|
+
{
|
|
4467
|
+
name: "score",
|
|
4468
|
+
type: "core::integer::u64"
|
|
4469
|
+
},
|
|
4470
|
+
{
|
|
4471
|
+
name: "token_id",
|
|
4472
|
+
type: "core::felt252"
|
|
3812
4473
|
}
|
|
3813
4474
|
],
|
|
3814
4475
|
outputs: [
|
|
3815
4476
|
{
|
|
3816
|
-
type: "core::integer::u32"
|
|
4477
|
+
type: "core::option::Option::<core::integer::u32>"
|
|
3817
4478
|
}
|
|
3818
4479
|
],
|
|
3819
4480
|
state_mutability: "view"
|
|
@@ -3957,6 +4618,12 @@ var budokan_default = [
|
|
|
3957
4618
|
kind: "enum",
|
|
3958
4619
|
variants: []
|
|
3959
4620
|
},
|
|
4621
|
+
{
|
|
4622
|
+
type: "event",
|
|
4623
|
+
name: "openzeppelin_security::reentrancyguard::ReentrancyGuardComponent::Event",
|
|
4624
|
+
kind: "enum",
|
|
4625
|
+
variants: []
|
|
4626
|
+
},
|
|
3960
4627
|
{
|
|
3961
4628
|
type: "event",
|
|
3962
4629
|
name: "budokan::events::TournamentCreated",
|
|
@@ -3972,11 +4639,6 @@ var budokan_default = [
|
|
|
3972
4639
|
type: "core::starknet::contract_address::ContractAddress",
|
|
3973
4640
|
kind: "key"
|
|
3974
4641
|
},
|
|
3975
|
-
{
|
|
3976
|
-
name: "created_at",
|
|
3977
|
-
type: "core::integer::u64",
|
|
3978
|
-
kind: "data"
|
|
3979
|
-
},
|
|
3980
4642
|
{
|
|
3981
4643
|
name: "created_by",
|
|
3982
4644
|
type: "core::starknet::contract_address::ContractAddress",
|
|
@@ -3993,28 +4655,28 @@ var budokan_default = [
|
|
|
3993
4655
|
kind: "data"
|
|
3994
4656
|
},
|
|
3995
4657
|
{
|
|
3996
|
-
name: "
|
|
3997
|
-
type: "
|
|
4658
|
+
name: "config",
|
|
4659
|
+
type: "core::felt252",
|
|
3998
4660
|
kind: "data"
|
|
3999
4661
|
},
|
|
4000
4662
|
{
|
|
4001
|
-
name: "
|
|
4002
|
-
type: "
|
|
4663
|
+
name: "client_url",
|
|
4664
|
+
type: "core::option::Option::<core::byte_array::ByteArray>",
|
|
4003
4665
|
kind: "data"
|
|
4004
4666
|
},
|
|
4005
4667
|
{
|
|
4006
|
-
name: "
|
|
4007
|
-
type: "core::option::Option::<
|
|
4668
|
+
name: "renderer",
|
|
4669
|
+
type: "core::option::Option::<core::starknet::contract_address::ContractAddress>",
|
|
4008
4670
|
kind: "data"
|
|
4009
4671
|
},
|
|
4010
4672
|
{
|
|
4011
|
-
name: "
|
|
4012
|
-
type: "core::option::Option::<
|
|
4673
|
+
name: "entry_fee",
|
|
4674
|
+
type: "core::option::Option::<budokan_interfaces::budokan::EntryFeeKind>",
|
|
4013
4675
|
kind: "data"
|
|
4014
4676
|
},
|
|
4015
4677
|
{
|
|
4016
|
-
name: "
|
|
4017
|
-
type: "
|
|
4678
|
+
name: "entry_requirement",
|
|
4679
|
+
type: "core::option::Option::<game_components_interfaces::entry_requirement::EntryRequirement>",
|
|
4018
4680
|
kind: "data"
|
|
4019
4681
|
}
|
|
4020
4682
|
]
|
|
@@ -4034,11 +4696,6 @@ var budokan_default = [
|
|
|
4034
4696
|
type: "core::felt252",
|
|
4035
4697
|
kind: "key"
|
|
4036
4698
|
},
|
|
4037
|
-
{
|
|
4038
|
-
name: "game_address",
|
|
4039
|
-
type: "core::starknet::contract_address::ContractAddress",
|
|
4040
|
-
kind: "data"
|
|
4041
|
-
},
|
|
4042
4699
|
{
|
|
4043
4700
|
name: "player_address",
|
|
4044
4701
|
type: "core::starknet::contract_address::ContractAddress",
|
|
@@ -4048,22 +4705,12 @@ var budokan_default = [
|
|
|
4048
4705
|
name: "entry_number",
|
|
4049
4706
|
type: "core::integer::u32",
|
|
4050
4707
|
kind: "data"
|
|
4051
|
-
},
|
|
4052
|
-
{
|
|
4053
|
-
name: "has_submitted",
|
|
4054
|
-
type: "core::bool",
|
|
4055
|
-
kind: "data"
|
|
4056
|
-
},
|
|
4057
|
-
{
|
|
4058
|
-
name: "is_banned",
|
|
4059
|
-
type: "core::bool",
|
|
4060
|
-
kind: "data"
|
|
4061
4708
|
}
|
|
4062
4709
|
]
|
|
4063
4710
|
},
|
|
4064
4711
|
{
|
|
4065
4712
|
type: "event",
|
|
4066
|
-
name: "budokan::events::
|
|
4713
|
+
name: "budokan::events::TournamentEntryStateChanged",
|
|
4067
4714
|
kind: "struct",
|
|
4068
4715
|
members: [
|
|
4069
4716
|
{
|
|
@@ -4072,8 +4719,18 @@ var budokan_default = [
|
|
|
4072
4719
|
kind: "key"
|
|
4073
4720
|
},
|
|
4074
4721
|
{
|
|
4075
|
-
name: "
|
|
4076
|
-
type: "core::
|
|
4722
|
+
name: "game_token_id",
|
|
4723
|
+
type: "core::felt252",
|
|
4724
|
+
kind: "key"
|
|
4725
|
+
},
|
|
4726
|
+
{
|
|
4727
|
+
name: "has_submitted",
|
|
4728
|
+
type: "core::bool",
|
|
4729
|
+
kind: "data"
|
|
4730
|
+
},
|
|
4731
|
+
{
|
|
4732
|
+
name: "is_banned",
|
|
4733
|
+
type: "core::bool",
|
|
4077
4734
|
kind: "data"
|
|
4078
4735
|
}
|
|
4079
4736
|
]
|
|
@@ -4099,13 +4756,8 @@ var budokan_default = [
|
|
|
4099
4756
|
kind: "data"
|
|
4100
4757
|
},
|
|
4101
4758
|
{
|
|
4102
|
-
name: "
|
|
4103
|
-
type: "
|
|
4104
|
-
kind: "data"
|
|
4105
|
-
},
|
|
4106
|
-
{
|
|
4107
|
-
name: "token_type",
|
|
4108
|
-
type: "game_components_interfaces::prize::TokenTypeData",
|
|
4759
|
+
name: "prize",
|
|
4760
|
+
type: "game_components_interfaces::prize::Prize",
|
|
4109
4761
|
kind: "data"
|
|
4110
4762
|
},
|
|
4111
4763
|
{
|
|
@@ -4214,6 +4866,11 @@ var budokan_default = [
|
|
|
4214
4866
|
type: "game_components_metagame::prize::prize_component::PrizeComponent::Event",
|
|
4215
4867
|
kind: "flat"
|
|
4216
4868
|
},
|
|
4869
|
+
{
|
|
4870
|
+
name: "ReentrancyGuardEvent",
|
|
4871
|
+
type: "openzeppelin_security::reentrancyguard::ReentrancyGuardComponent::Event",
|
|
4872
|
+
kind: "flat"
|
|
4873
|
+
},
|
|
4217
4874
|
{
|
|
4218
4875
|
name: "TournamentCreated",
|
|
4219
4876
|
type: "budokan::events::TournamentCreated",
|
|
@@ -4225,8 +4882,8 @@ var budokan_default = [
|
|
|
4225
4882
|
kind: "nested"
|
|
4226
4883
|
},
|
|
4227
4884
|
{
|
|
4228
|
-
name: "
|
|
4229
|
-
type: "budokan::events::
|
|
4885
|
+
name: "TournamentEntryStateChanged",
|
|
4886
|
+
type: "budokan::events::TournamentEntryStateChanged",
|
|
4230
4887
|
kind: "nested"
|
|
4231
4888
|
},
|
|
4232
4889
|
{
|
|
@@ -4394,6 +5051,7 @@ var BudokanClient = class {
|
|
|
4394
5051
|
if (prizes.length === 0) return t;
|
|
4395
5052
|
const tokenMap = /* @__PURE__ */ new Map();
|
|
4396
5053
|
for (const p of prizes) {
|
|
5054
|
+
if (p.tokenType === "extension" || p.tokenAddress == null) continue;
|
|
4397
5055
|
const key = p.tokenAddress;
|
|
4398
5056
|
const existing = tokenMap.get(key);
|
|
4399
5057
|
if (existing) {
|
|
@@ -4709,6 +5367,501 @@ function createBudokanClient(config) {
|
|
|
4709
5367
|
return new BudokanClient(config);
|
|
4710
5368
|
}
|
|
4711
5369
|
|
|
4712
|
-
|
|
5370
|
+
// src/games/whitelist.ts
|
|
5371
|
+
var STRK = "0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d";
|
|
5372
|
+
var MAINNET_GAMES_RAW = [
|
|
5373
|
+
{
|
|
5374
|
+
contractAddress: "0x4de0351ceab4ecd50be6ee09329b0dcb3b96a9da88cc158f453823a389722fa",
|
|
5375
|
+
name: "Death Mountain",
|
|
5376
|
+
url: "https://deathmountain.gg/",
|
|
5377
|
+
playUrl: "https://deathmountain.gg/play?id=",
|
|
5378
|
+
watchLink: "https://deathmountain.gg/watch?id=",
|
|
5379
|
+
replayLink: "https://deathmountain.gg/replay?id=",
|
|
5380
|
+
controllerOnly: true,
|
|
5381
|
+
minEntryFeeUsd: 0.25,
|
|
5382
|
+
defaultEntryFeeToken: STRK,
|
|
5383
|
+
defaultGameFeePercentage: 5,
|
|
5384
|
+
averageGasCostUsd: 0.25
|
|
5385
|
+
},
|
|
5386
|
+
{
|
|
5387
|
+
contractAddress: "0x642f228f70b1ca7edb4ab7ff0bab067369c2e276ddc2570ca18802d4e758edc",
|
|
5388
|
+
name: "zKube",
|
|
5389
|
+
imageUrl: "https://zkube-budokan-sepolia.vercel.app/assets/logo.png",
|
|
5390
|
+
url: "https://zkube.io",
|
|
5391
|
+
playUrl: "https://zkube.io/play/",
|
|
5392
|
+
minEntryFeeUsd: 0.25,
|
|
5393
|
+
defaultEntryFeeToken: STRK
|
|
5394
|
+
}
|
|
5395
|
+
];
|
|
5396
|
+
var SEPOLIA_GAMES_RAW = [
|
|
5397
|
+
{
|
|
5398
|
+
contractAddress: "0x04359aee29873cd9603207d29b4140468bac3e042aa10daab2e1a8b2dd60ef7b",
|
|
5399
|
+
name: "Dark Shuffle",
|
|
5400
|
+
imageUrl: "https://darkshuffle.dev/favicon.svg",
|
|
5401
|
+
url: "https://darkshuffle.dev",
|
|
5402
|
+
controllerOnly: true,
|
|
5403
|
+
minEntryFeeUsd: 0.25,
|
|
5404
|
+
defaultEntryFeeToken: STRK
|
|
5405
|
+
},
|
|
5406
|
+
{
|
|
5407
|
+
contractAddress: "0x07ae26eecf0274aabb31677753ff3a4e15beec7268fa1b104f73ce3c89202831",
|
|
5408
|
+
name: "Death Mountain",
|
|
5409
|
+
imageUrl: "https://darkshuffle.dev/favicon.svg",
|
|
5410
|
+
url: "https://lootsurvivor.io/",
|
|
5411
|
+
playUrl: "https://lootsurvivor.io/survivor/play?id=",
|
|
5412
|
+
controllerOnly: true,
|
|
5413
|
+
minEntryFeeUsd: 0.25,
|
|
5414
|
+
defaultEntryFeeToken: STRK
|
|
5415
|
+
},
|
|
5416
|
+
{
|
|
5417
|
+
contractAddress: "0x012ccc9a2d76c836d088203f6e9d62e22d1a9f7479d1aea8b503a1036c0f4487",
|
|
5418
|
+
name: "Nums",
|
|
5419
|
+
url: "https://nums-blond.vercel.app/",
|
|
5420
|
+
playUrl: "https://nums-blond.vercel.app/",
|
|
5421
|
+
controllerOnly: true,
|
|
5422
|
+
minEntryFeeUsd: 0.25,
|
|
5423
|
+
defaultEntryFeeToken: STRK
|
|
5424
|
+
},
|
|
5425
|
+
{
|
|
5426
|
+
contractAddress: "0x3a2ea07f0f49c770035eed9a010eb3d1e1bc3cb92e1d47eef2ad75a25c6bdb2",
|
|
5427
|
+
name: "Number Guess",
|
|
5428
|
+
url: "https://funfactory.gg/games/1",
|
|
5429
|
+
playUrl: "https://funfactory.gg/tokens/{tokenId}/play",
|
|
5430
|
+
controllerOnly: true,
|
|
5431
|
+
minEntryFeeUsd: 0.25,
|
|
5432
|
+
defaultEntryFeeToken: STRK,
|
|
5433
|
+
objectImage: true
|
|
5434
|
+
},
|
|
5435
|
+
{
|
|
5436
|
+
contractAddress: "0x5e02a1f750b3fa0e835d454705b664ecb23166cdb49459b1c96c1e3eaf9a2f4",
|
|
5437
|
+
name: "zKube",
|
|
5438
|
+
imageUrl: "https://zkube-budokan-sepolia.vercel.app/assets/logo.png",
|
|
5439
|
+
url: "https://zkube-budokan-sepolia.vercel.app",
|
|
5440
|
+
playUrl: "https://zkube-budokan-sepolia.vercel.app/play/",
|
|
5441
|
+
controllerOnly: true,
|
|
5442
|
+
minEntryFeeUsd: 0.25,
|
|
5443
|
+
defaultEntryFeeToken: STRK
|
|
5444
|
+
}
|
|
5445
|
+
];
|
|
5446
|
+
var MAINNET_GAMES = MAINNET_GAMES_RAW.map(canonicalize);
|
|
5447
|
+
var SEPOLIA_GAMES = SEPOLIA_GAMES_RAW.map(canonicalize);
|
|
5448
|
+
function canonicalize(game) {
|
|
5449
|
+
return {
|
|
5450
|
+
...game,
|
|
5451
|
+
contractAddress: normalizeAddress(game.contractAddress),
|
|
5452
|
+
defaultEntryFeeToken: game.defaultEntryFeeToken ? normalizeAddress(game.defaultEntryFeeToken) : void 0
|
|
5453
|
+
};
|
|
5454
|
+
}
|
|
5455
|
+
function getWhitelistedGames(chain) {
|
|
5456
|
+
const list = chain === "mainnet" ? MAINNET_GAMES : SEPOLIA_GAMES;
|
|
5457
|
+
return list.map((g) => ({ ...g })).sort((a, b) => {
|
|
5458
|
+
const aDisabled = a.disabled ?? false;
|
|
5459
|
+
const bDisabled = b.disabled ?? false;
|
|
5460
|
+
if (aDisabled !== bDisabled) return aDisabled ? 1 : -1;
|
|
5461
|
+
return a.name.localeCompare(b.name);
|
|
5462
|
+
});
|
|
5463
|
+
}
|
|
5464
|
+
function findWhitelistedGame(chain, contractAddress) {
|
|
5465
|
+
const target = normalizeAddress(contractAddress);
|
|
5466
|
+
return getWhitelistedGames(chain).find((g) => g.contractAddress === target);
|
|
5467
|
+
}
|
|
5468
|
+
function isGameWhitelisted(chain, contractAddress) {
|
|
5469
|
+
return findWhitelistedGame(chain, contractAddress) !== void 0;
|
|
5470
|
+
}
|
|
5471
|
+
function getGameDefaults(chain, contractAddress) {
|
|
5472
|
+
const game = findWhitelistedGame(chain, contractAddress);
|
|
5473
|
+
return {
|
|
5474
|
+
minEntryFeeUsd: game?.minEntryFeeUsd ?? 0.25,
|
|
5475
|
+
defaultEntryFeeToken: game?.defaultEntryFeeToken ?? STRK,
|
|
5476
|
+
defaultGameFeePercentage: game?.defaultGameFeePercentage ?? 1,
|
|
5477
|
+
averageGasCostUsd: game?.averageGasCostUsd,
|
|
5478
|
+
leaderboardAscending: game?.leaderboardAscending ?? false,
|
|
5479
|
+
leaderboardGameMustBeOver: game?.leaderboardGameMustBeOver ?? false
|
|
5480
|
+
};
|
|
5481
|
+
}
|
|
5482
|
+
function buildErc20ApproveCall(tokenAddress, spender, amount) {
|
|
5483
|
+
return {
|
|
5484
|
+
contractAddress: tokenAddress,
|
|
5485
|
+
entrypoint: "approve",
|
|
5486
|
+
calldata: CallData.compile([spender, uint256.bnToUint256(amount)])
|
|
5487
|
+
};
|
|
5488
|
+
}
|
|
5489
|
+
function buildEnterTournamentCall(budokanAddress, args) {
|
|
5490
|
+
const calldata = [
|
|
5491
|
+
num.toHex(args.tournamentId)
|
|
5492
|
+
// tournament_id u64
|
|
5493
|
+
];
|
|
5494
|
+
if (args.playerName) {
|
|
5495
|
+
calldata.push("0x0", felt252FromShortString(args.playerName));
|
|
5496
|
+
} else {
|
|
5497
|
+
calldata.push("0x1");
|
|
5498
|
+
}
|
|
5499
|
+
if (args.playerAddress) {
|
|
5500
|
+
calldata.push("0x0", args.playerAddress);
|
|
5501
|
+
} else {
|
|
5502
|
+
calldata.push("0x1");
|
|
5503
|
+
}
|
|
5504
|
+
if (args.qualifier) {
|
|
5505
|
+
calldata.push("0x0", args.qualifier);
|
|
5506
|
+
} else {
|
|
5507
|
+
calldata.push("0x1");
|
|
5508
|
+
}
|
|
5509
|
+
calldata.push("0x1");
|
|
5510
|
+
if (args.entryFeePayParams && args.entryFeePayParams.length > 0) {
|
|
5511
|
+
calldata.push(
|
|
5512
|
+
"0x0",
|
|
5513
|
+
num.toHex(args.entryFeePayParams.length),
|
|
5514
|
+
...args.entryFeePayParams
|
|
5515
|
+
);
|
|
5516
|
+
} else {
|
|
5517
|
+
calldata.push("0x1");
|
|
5518
|
+
}
|
|
5519
|
+
calldata.push(num.toHex(args.salt ?? 0));
|
|
5520
|
+
calldata.push(num.toHex(args.metadataValue ?? 0));
|
|
5521
|
+
return {
|
|
5522
|
+
contractAddress: budokanAddress,
|
|
5523
|
+
entrypoint: "enter_tournament",
|
|
5524
|
+
calldata
|
|
5525
|
+
};
|
|
5526
|
+
}
|
|
5527
|
+
function buildSubmitScoreCall(budokanAddress, args) {
|
|
5528
|
+
return {
|
|
5529
|
+
contractAddress: budokanAddress,
|
|
5530
|
+
entrypoint: "submit_score",
|
|
5531
|
+
calldata: CallData.compile([args.tournamentId, args.tokenId, args.position])
|
|
5532
|
+
};
|
|
5533
|
+
}
|
|
5534
|
+
function buildClaimRewardCall(budokanAddress, args) {
|
|
5535
|
+
const calldata = [num.toHex(args.tournamentId)];
|
|
5536
|
+
pushRewardTypeFelts(calldata, args.reward);
|
|
5537
|
+
return {
|
|
5538
|
+
contractAddress: budokanAddress,
|
|
5539
|
+
entrypoint: "claim_reward",
|
|
5540
|
+
calldata
|
|
5541
|
+
};
|
|
5542
|
+
}
|
|
5543
|
+
function buildCreateTournamentCall(budokanAddress, args) {
|
|
5544
|
+
const calldata = CallData.compile({
|
|
5545
|
+
creator_rewards_address: args.creatorRewardsAddress,
|
|
5546
|
+
metadata: {
|
|
5547
|
+
// name is a felt252 (≤31 ASCII bytes). starknet.js packs short
|
|
5548
|
+
// ASCII strings into a single felt automatically.
|
|
5549
|
+
name: args.name,
|
|
5550
|
+
// description is a Cairo ByteArray (multi-felt: data words +
|
|
5551
|
+
// pending word + pending word length). A plain JS string serializes
|
|
5552
|
+
// to a single felt and the deserializer reverts — wrap explicitly.
|
|
5553
|
+
description: byteArray.byteArrayFromString(args.description)
|
|
5554
|
+
},
|
|
5555
|
+
schedule: {
|
|
5556
|
+
registration_start_delay: args.schedule.registrationStartDelay,
|
|
5557
|
+
registration_end_delay: args.schedule.registrationEndDelay,
|
|
5558
|
+
game_start_delay: args.schedule.gameStartDelay,
|
|
5559
|
+
game_end_delay: args.schedule.gameEndDelay,
|
|
5560
|
+
submission_duration: args.schedule.submissionDuration
|
|
5561
|
+
},
|
|
5562
|
+
game_config: {
|
|
5563
|
+
game_address: args.gameAddress,
|
|
5564
|
+
settings_id: args.settingsId,
|
|
5565
|
+
soulbound: false,
|
|
5566
|
+
paymaster: false,
|
|
5567
|
+
// Options must be CairoOption — see file header for why.
|
|
5568
|
+
client_url: new CairoOption(CairoOptionVariant.None),
|
|
5569
|
+
renderer: new CairoOption(CairoOptionVariant.None)
|
|
5570
|
+
},
|
|
5571
|
+
entry_fee: encodeEntryFeeOption(args.entryFee),
|
|
5572
|
+
entry_requirement: encodeEntryRequirementOption(args.entryRequirement),
|
|
5573
|
+
leaderboard_config: {
|
|
5574
|
+
ascending: args.leaderboard.ascending,
|
|
5575
|
+
game_must_be_over: args.leaderboard.gameMustBeOver
|
|
5576
|
+
},
|
|
5577
|
+
salt: args.salt ?? 0,
|
|
5578
|
+
metadata_value: args.metadataValue ?? 0
|
|
5579
|
+
});
|
|
5580
|
+
return {
|
|
5581
|
+
contractAddress: budokanAddress,
|
|
5582
|
+
entrypoint: "create_tournament",
|
|
5583
|
+
calldata
|
|
5584
|
+
};
|
|
5585
|
+
}
|
|
5586
|
+
function buildAddPrizeCall(budokanAddress, args) {
|
|
5587
|
+
const prize = encodePrize(args.prize);
|
|
5588
|
+
const position = args.prize.kind === "token" && args.prize.position !== void 0 ? new CairoOption(CairoOptionVariant.Some, args.prize.position) : new CairoOption(CairoOptionVariant.None);
|
|
5589
|
+
const calldata = CallData.compile({
|
|
5590
|
+
tournament_id: args.tournamentId,
|
|
5591
|
+
prize,
|
|
5592
|
+
position
|
|
5593
|
+
});
|
|
5594
|
+
return {
|
|
5595
|
+
contractAddress: budokanAddress,
|
|
5596
|
+
entrypoint: "add_prize",
|
|
5597
|
+
calldata
|
|
5598
|
+
};
|
|
5599
|
+
}
|
|
5600
|
+
function encodePrize(spec) {
|
|
5601
|
+
if (spec.kind === "token") {
|
|
5602
|
+
return new CairoCustomEnum({
|
|
5603
|
+
Token: {
|
|
5604
|
+
token_address: spec.tokenAddress,
|
|
5605
|
+
token_type: encodeTokenType(spec.tokenType)
|
|
5606
|
+
},
|
|
5607
|
+
Extension: void 0
|
|
5608
|
+
});
|
|
5609
|
+
}
|
|
5610
|
+
return new CairoCustomEnum({
|
|
5611
|
+
Token: void 0,
|
|
5612
|
+
Extension: {
|
|
5613
|
+
address: spec.address,
|
|
5614
|
+
config: spec.config
|
|
5615
|
+
}
|
|
5616
|
+
});
|
|
5617
|
+
}
|
|
5618
|
+
function encodeTokenType(spec) {
|
|
5619
|
+
if (spec.kind === "erc20") {
|
|
5620
|
+
if (spec.distribution && spec.distributionCount === void 0) {
|
|
5621
|
+
throw new Error(
|
|
5622
|
+
"TokenTypeSpec.erc20: distributionCount is required when distribution is set"
|
|
5623
|
+
);
|
|
5624
|
+
}
|
|
5625
|
+
const distribution = spec.distribution ? new CairoOption(
|
|
5626
|
+
CairoOptionVariant.Some,
|
|
5627
|
+
encodeDistribution(spec.distribution)
|
|
5628
|
+
) : new CairoOption(CairoOptionVariant.None);
|
|
5629
|
+
const distributionCount = spec.distribution && spec.distributionCount !== void 0 ? new CairoOption(
|
|
5630
|
+
CairoOptionVariant.Some,
|
|
5631
|
+
spec.distributionCount
|
|
5632
|
+
) : new CairoOption(CairoOptionVariant.None);
|
|
5633
|
+
return new CairoCustomEnum({
|
|
5634
|
+
erc20: {
|
|
5635
|
+
amount: spec.amount,
|
|
5636
|
+
distribution,
|
|
5637
|
+
distribution_count: distributionCount
|
|
5638
|
+
},
|
|
5639
|
+
erc721: void 0
|
|
5640
|
+
});
|
|
5641
|
+
}
|
|
5642
|
+
return new CairoCustomEnum({
|
|
5643
|
+
erc20: void 0,
|
|
5644
|
+
erc721: { id: spec.tokenId }
|
|
5645
|
+
});
|
|
5646
|
+
}
|
|
5647
|
+
function encodeEntryFeeOption(fee) {
|
|
5648
|
+
if (!fee) return new CairoOption(CairoOptionVariant.None);
|
|
5649
|
+
const builtIn = {
|
|
5650
|
+
token_address: fee.tokenAddress,
|
|
5651
|
+
amount: fee.amount,
|
|
5652
|
+
tournament_creator_share: fee.tournamentCreatorShare,
|
|
5653
|
+
game_creator_share: fee.gameCreatorShare,
|
|
5654
|
+
refund_share: fee.refundShare,
|
|
5655
|
+
distribution: encodeDistribution(fee.distribution),
|
|
5656
|
+
distribution_count: fee.distributionCount
|
|
5657
|
+
};
|
|
5658
|
+
return new CairoOption(
|
|
5659
|
+
CairoOptionVariant.Some,
|
|
5660
|
+
new CairoCustomEnum({ BuiltIn: builtIn, Extension: void 0 })
|
|
5661
|
+
);
|
|
5662
|
+
}
|
|
5663
|
+
function encodeEntryRequirementOption(req) {
|
|
5664
|
+
if (!req)
|
|
5665
|
+
return new CairoOption(CairoOptionVariant.None);
|
|
5666
|
+
return new CairoOption(CairoOptionVariant.Some, {
|
|
5667
|
+
entry_limit: req.entryLimit,
|
|
5668
|
+
entry_requirement_type: encodeEntryRequirementType(req.type)
|
|
5669
|
+
});
|
|
5670
|
+
}
|
|
5671
|
+
function encodeEntryRequirementType(spec) {
|
|
5672
|
+
if (spec.kind === "token") {
|
|
5673
|
+
return new CairoCustomEnum({
|
|
5674
|
+
token: spec.tokenAddress,
|
|
5675
|
+
extension: void 0
|
|
5676
|
+
});
|
|
5677
|
+
}
|
|
5678
|
+
if (spec.kind === "extension") {
|
|
5679
|
+
return new CairoCustomEnum({
|
|
5680
|
+
token: void 0,
|
|
5681
|
+
extension: {
|
|
5682
|
+
address: spec.address,
|
|
5683
|
+
config: spec.config
|
|
5684
|
+
}
|
|
5685
|
+
});
|
|
5686
|
+
}
|
|
5687
|
+
throw new Error(
|
|
5688
|
+
`Unsupported entry requirement kind: ${spec.kind}`
|
|
5689
|
+
);
|
|
5690
|
+
}
|
|
5691
|
+
function scaleWeight(client) {
|
|
5692
|
+
return Math.round(client * 10);
|
|
5693
|
+
}
|
|
5694
|
+
function encodeDistribution(d) {
|
|
5695
|
+
if (d.kind === "linear") {
|
|
5696
|
+
return new CairoCustomEnum({
|
|
5697
|
+
Linear: scaleWeight(d.weight),
|
|
5698
|
+
Exponential: void 0,
|
|
5699
|
+
Uniform: void 0,
|
|
5700
|
+
Custom: void 0
|
|
5701
|
+
});
|
|
5702
|
+
}
|
|
5703
|
+
if (d.kind === "exponential") {
|
|
5704
|
+
return new CairoCustomEnum({
|
|
5705
|
+
Linear: void 0,
|
|
5706
|
+
Exponential: scaleWeight(d.weight),
|
|
5707
|
+
Uniform: void 0,
|
|
5708
|
+
Custom: void 0
|
|
5709
|
+
});
|
|
5710
|
+
}
|
|
5711
|
+
return new CairoCustomEnum({
|
|
5712
|
+
Linear: void 0,
|
|
5713
|
+
Exponential: void 0,
|
|
5714
|
+
Uniform: {},
|
|
5715
|
+
Custom: void 0
|
|
5716
|
+
});
|
|
5717
|
+
}
|
|
5718
|
+
function pushRewardTypeFelts(out, reward) {
|
|
5719
|
+
switch (reward.kind) {
|
|
5720
|
+
case "prize_single":
|
|
5721
|
+
out.push("0x0", "0x0", "0x0", num.toHex(reward.prizeId));
|
|
5722
|
+
return;
|
|
5723
|
+
case "prize_distributed":
|
|
5724
|
+
out.push(
|
|
5725
|
+
"0x0",
|
|
5726
|
+
"0x0",
|
|
5727
|
+
"0x1",
|
|
5728
|
+
num.toHex(reward.prizeId),
|
|
5729
|
+
num.toHex(reward.payoutPosition)
|
|
5730
|
+
);
|
|
5731
|
+
return;
|
|
5732
|
+
case "prize_extension":
|
|
5733
|
+
out.push("0x0", "0x1", num.toHex(reward.prizeId));
|
|
5734
|
+
if (reward.tokenId !== void 0) {
|
|
5735
|
+
out.push("0x0", reward.tokenId);
|
|
5736
|
+
} else {
|
|
5737
|
+
out.push("0x1");
|
|
5738
|
+
}
|
|
5739
|
+
out.push(
|
|
5740
|
+
num.toHex(reward.payoutParams.length),
|
|
5741
|
+
...reward.payoutParams.map((p) => num.toHex(p))
|
|
5742
|
+
);
|
|
5743
|
+
return;
|
|
5744
|
+
case "entry_fee_position":
|
|
5745
|
+
out.push("0x1", "0x0", "0x0", num.toHex(reward.position));
|
|
5746
|
+
return;
|
|
5747
|
+
case "entry_fee_tournament_creator":
|
|
5748
|
+
out.push("0x1", "0x0", "0x1");
|
|
5749
|
+
return;
|
|
5750
|
+
case "entry_fee_game_creator":
|
|
5751
|
+
out.push("0x1", "0x0", "0x2");
|
|
5752
|
+
return;
|
|
5753
|
+
case "entry_fee_refund":
|
|
5754
|
+
out.push("0x1", "0x0", "0x3", num.toHex(reward.tokenId));
|
|
5755
|
+
return;
|
|
5756
|
+
case "entry_fee_extension": {
|
|
5757
|
+
out.push("0x1", "0x1");
|
|
5758
|
+
if (reward.tokenId !== void 0) {
|
|
5759
|
+
out.push("0x0", reward.tokenId);
|
|
5760
|
+
} else {
|
|
5761
|
+
out.push("0x1");
|
|
5762
|
+
}
|
|
5763
|
+
out.push(
|
|
5764
|
+
num.toHex(reward.claimParams.length),
|
|
5765
|
+
...reward.claimParams.map((p) => num.toHex(p))
|
|
5766
|
+
);
|
|
5767
|
+
return;
|
|
5768
|
+
}
|
|
5769
|
+
}
|
|
5770
|
+
}
|
|
5771
|
+
var TOURNAMENT_CREATED_SELECTOR = hash.getSelectorFromName(
|
|
5772
|
+
"TournamentCreated"
|
|
5773
|
+
);
|
|
5774
|
+
function parseTournamentIdFromReceipt(receipt, budokanAddress) {
|
|
5775
|
+
const normalise = (addr) => addr.toLowerCase().replace(/^0x0*/, "0x");
|
|
5776
|
+
const normContract = normalise(budokanAddress);
|
|
5777
|
+
const createdSelector = BigInt(TOURNAMENT_CREATED_SELECTOR);
|
|
5778
|
+
for (const event of receipt.events ?? []) {
|
|
5779
|
+
if (!event.from_address || !event.keys || event.keys.length < 2) continue;
|
|
5780
|
+
if (normalise(event.from_address) !== normContract) continue;
|
|
5781
|
+
if (BigInt(event.keys[0]) !== createdSelector) continue;
|
|
5782
|
+
return BigInt(event.keys[1]);
|
|
5783
|
+
}
|
|
5784
|
+
return void 0;
|
|
5785
|
+
}
|
|
5786
|
+
function felt252FromShortString(s) {
|
|
5787
|
+
if (s.length > 31)
|
|
5788
|
+
throw new Error(`String too long for felt252: ${s.length} bytes`);
|
|
5789
|
+
let value = 0n;
|
|
5790
|
+
for (const char of s) {
|
|
5791
|
+
const code = char.charCodeAt(0);
|
|
5792
|
+
if (code > 127) throw new Error("Felt252 short strings must be ASCII");
|
|
5793
|
+
value = value << 8n | BigInt(code);
|
|
5794
|
+
}
|
|
5795
|
+
return "0x" + value.toString(16);
|
|
5796
|
+
}
|
|
5797
|
+
function sdkChainId(chain) {
|
|
5798
|
+
return chain === "mainnet" ? "SN_MAIN" : "SN_SEPOLIA";
|
|
5799
|
+
}
|
|
5800
|
+
function extensionAddressFor(chain, kind) {
|
|
5801
|
+
const table = getExtensionAddresses(sdkChainId(chain));
|
|
5802
|
+
switch (kind) {
|
|
5803
|
+
case "merkle":
|
|
5804
|
+
if (!table.merkleValidator)
|
|
5805
|
+
throw new Error(`No merkleValidator address for ${chain}`);
|
|
5806
|
+
return table.merkleValidator;
|
|
5807
|
+
case "erc20Balance":
|
|
5808
|
+
if (!table.erc20BalanceValidator)
|
|
5809
|
+
throw new Error(`No erc20BalanceValidator address for ${chain}`);
|
|
5810
|
+
return table.erc20BalanceValidator;
|
|
5811
|
+
case "opusTroves":
|
|
5812
|
+
if (!table.opusTrovesValidator)
|
|
5813
|
+
throw new Error(`No opusTrovesValidator address for ${chain}`);
|
|
5814
|
+
return table.opusTrovesValidator;
|
|
5815
|
+
case "tournament":
|
|
5816
|
+
if (!table.tournamentValidator)
|
|
5817
|
+
throw new Error(`No tournamentValidator address for ${chain}`);
|
|
5818
|
+
return table.tournamentValidator;
|
|
5819
|
+
}
|
|
5820
|
+
}
|
|
5821
|
+
var U256_MAX = (1n << 256n) - 1n;
|
|
5822
|
+
function u256ToLowHigh(value) {
|
|
5823
|
+
if (value < 0n) throw new Error("u256 cannot be negative");
|
|
5824
|
+
if (value > U256_MAX)
|
|
5825
|
+
throw new Error(`Value exceeds u256 max: ${value.toString()}`);
|
|
5826
|
+
const MASK = (1n << 128n) - 1n;
|
|
5827
|
+
return [(value & MASK).toString(), (value >> 128n).toString()];
|
|
5828
|
+
}
|
|
5829
|
+
function buildErc20BalanceConfig(cfg) {
|
|
5830
|
+
const [minLo, minHi] = u256ToLowHigh(cfg.minThreshold);
|
|
5831
|
+
const [maxLo, maxHi] = u256ToLowHigh(cfg.maxThreshold);
|
|
5832
|
+
const [vpeLo, vpeHi] = u256ToLowHigh(cfg.valuePerEntry);
|
|
5833
|
+
return [
|
|
5834
|
+
cfg.tokenAddress,
|
|
5835
|
+
minLo,
|
|
5836
|
+
minHi,
|
|
5837
|
+
maxLo,
|
|
5838
|
+
maxHi,
|
|
5839
|
+
vpeLo,
|
|
5840
|
+
vpeHi,
|
|
5841
|
+
String(cfg.maxEntries),
|
|
5842
|
+
cfg.bannable ? "1" : "0"
|
|
5843
|
+
];
|
|
5844
|
+
}
|
|
5845
|
+
function buildOpusTrovesConfig(cfg) {
|
|
5846
|
+
return [
|
|
5847
|
+
String(cfg.assetAddresses.length),
|
|
5848
|
+
...cfg.assetAddresses,
|
|
5849
|
+
cfg.threshold.toString(),
|
|
5850
|
+
cfg.valuePerEntry.toString(),
|
|
5851
|
+
String(cfg.maxEntries),
|
|
5852
|
+
cfg.bannable ? "1" : "0"
|
|
5853
|
+
];
|
|
5854
|
+
}
|
|
5855
|
+
function buildMerkleConfig(cfg) {
|
|
5856
|
+
return [String(cfg.treeId)];
|
|
5857
|
+
}
|
|
5858
|
+
function buildTournamentValidatorConfig(cfg) {
|
|
5859
|
+
const qualifierType = cfg.requirement === "won" ? "1" : "0";
|
|
5860
|
+
const qualifyingMode = String(cfg.qualifyingMode ?? 0);
|
|
5861
|
+
const topPositions = cfg.requirement === "won" ? String(cfg.topPositions) : "0";
|
|
5862
|
+
return [qualifierType, qualifyingMode, topPositions, ...cfg.tournamentIds];
|
|
5863
|
+
}
|
|
5864
|
+
|
|
5865
|
+
export { BudokanApiError, BudokanClient, BudokanConnectionError, BudokanError, BudokanTimeoutError, CHAINS, ConnectionStatus, DataSourceError, RpcError, TournamentNotFoundError, WSManager, buildAddPrizeCall, buildClaimRewardCall, buildCreateTournamentCall, buildEnterTournamentCall, buildErc20ApproveCall, buildErc20BalanceConfig, buildMerkleConfig, buildOpusTrovesConfig, buildSubmitScoreCall, buildTournamentValidatorConfig, camelToSnake, createBudokanClient, explorerAddressUrl, explorerBaseUrl, explorerTxUrl, extensionAddressFor, findWhitelistedGame, getActivityStats, getChainConfig, getGameDefaults, getGameStats, getGameTournaments, getPrizeStats, getTournament, getTournamentPrizeAggregation, getTournamentPrizes, getTournamentQualifications, getTournamentRegistrations, getTournamentRewardClaims, getTournamentRewardClaimsSummary, getTournaments, getWhitelistedGames, isGameWhitelisted, normalizeAddress, parseTournamentIdFromReceipt, snakeToCamel, tournamentPageUrl, u256ToLowHigh, withRetry };
|
|
4713
5866
|
//# sourceMappingURL=index.js.map
|
|
4714
5867
|
//# sourceMappingURL=index.js.map
|