@provable-games/budokan-sdk 0.1.23 → 0.1.25
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 +1742 -246
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +615 -3
- package/dist/index.d.ts +615 -3
- package/dist/index.js +1709 -248
- package/dist/index.js.map +1 -1
- package/dist/{player-BUynfv7D.d.cts → player-P6Dd1lNb.d.cts} +68 -9
- package/dist/{player-BUynfv7D.d.ts → player-P6Dd1lNb.d.ts} +68 -9
- package/dist/react.cjs +1014 -244
- 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 +1014 -244
- package/dist/react.js.map +1 -1
- package/package.json +3 -2
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var starknet = require('starknet');
|
|
4
|
+
var metagameSdk = require('@provable-games/metagame-sdk');
|
|
4
5
|
|
|
5
6
|
// src/errors/index.ts
|
|
6
7
|
var BudokanError = class extends Error {
|
|
@@ -214,7 +215,8 @@ function camelToSnake(obj) {
|
|
|
214
215
|
function normalizeTournament(raw) {
|
|
215
216
|
const t = snakeToCamel(raw);
|
|
216
217
|
const id = t.id ?? t.tournamentId;
|
|
217
|
-
|
|
218
|
+
const protocolFeeShare = t.protocolFeeShare ?? t.entryFee?.protocolFeeShare ?? null;
|
|
219
|
+
return { ...t, id, tournamentId: id, protocolFeeShare };
|
|
218
220
|
}
|
|
219
221
|
function fetchOpts(ctx) {
|
|
220
222
|
return {
|
|
@@ -546,16 +548,32 @@ var CHAINS = {
|
|
|
546
548
|
viewerAddress: "0x013c8239361fdbd7ec26db2c83f4ff270c5bba83a0bc105b4005b676ff57fdbe"
|
|
547
549
|
},
|
|
548
550
|
sepolia: {
|
|
549
|
-
rpcUrl: "https://starknet
|
|
551
|
+
rpcUrl: "https://api.cartridge.gg/x/starknet/sepolia/rpc/v0_10",
|
|
550
552
|
apiBaseUrl: "https://budokan-api-sepolia.up.railway.app",
|
|
551
553
|
wsUrl: "wss://budokan-api-sepolia.up.railway.app/ws",
|
|
552
|
-
budokanAddress: "
|
|
553
|
-
|
|
554
|
+
budokanAddress: "0x074cc823c382d98e6b8d657aa86776a57d85e1dc2912d54d83a4fef147472683",
|
|
555
|
+
// Redeployed 2026-06-18 to match the upgraded #264/#269 budokan class —
|
|
556
|
+
// the prior viewer (0x03da56…) was built against the old budokan interface
|
|
557
|
+
// (called the removed `tournament_entries`) and reverted RPC reads.
|
|
558
|
+
viewerAddress: "0x06b2773d5f1f8bfa5aa3b698fbbaea0472b30af003ea6058330ed52a1acaa283"
|
|
554
559
|
}
|
|
555
560
|
};
|
|
556
561
|
function getChainConfig(chain) {
|
|
557
562
|
return CHAINS[chain];
|
|
558
563
|
}
|
|
564
|
+
function explorerBaseUrl(chain) {
|
|
565
|
+
if (chain === "sepolia") return "https://sepolia.voyager.online";
|
|
566
|
+
return "https://voyager.online";
|
|
567
|
+
}
|
|
568
|
+
function explorerTxUrl(chain, txHash) {
|
|
569
|
+
return `${explorerBaseUrl(chain)}/tx/${txHash}`;
|
|
570
|
+
}
|
|
571
|
+
function explorerAddressUrl(chain, address) {
|
|
572
|
+
return `${explorerBaseUrl(chain)}/contract/${address}`;
|
|
573
|
+
}
|
|
574
|
+
function tournamentPageUrl(chain, tournamentId) {
|
|
575
|
+
return `https://budokan.gg/tournament/${tournamentId}?network=${chain}`;
|
|
576
|
+
}
|
|
559
577
|
|
|
560
578
|
// src/datasource/health.ts
|
|
561
579
|
var ConnectionStatus = class {
|
|
@@ -815,7 +833,7 @@ function phaseToRpcArg(phase) {
|
|
|
815
833
|
}
|
|
816
834
|
return new starknet.CairoCustomEnum(variants);
|
|
817
835
|
}
|
|
818
|
-
function parseTournament(raw, entryCount) {
|
|
836
|
+
function parseTournament(raw, entryCount, protocolFeeShare = null) {
|
|
819
837
|
const obj = raw;
|
|
820
838
|
const id = String(obj.id ?? "0");
|
|
821
839
|
const createdAt = Number(obj.created_at ?? 0);
|
|
@@ -851,23 +869,36 @@ function parseTournament(raw, entryCount) {
|
|
|
851
869
|
const lc = obj.leaderboard_config;
|
|
852
870
|
const ascending = Boolean(lc?.ascending);
|
|
853
871
|
const gameMustBeOver = Boolean(lc?.game_must_be_over);
|
|
854
|
-
const
|
|
872
|
+
const entryFeeKind = parseOption(obj.entry_fee);
|
|
855
873
|
let entryFeeToken = null;
|
|
856
874
|
let entryFeeAmount = null;
|
|
857
875
|
let entryFee = null;
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
876
|
+
let entryFeeKindTag = null;
|
|
877
|
+
let entryFeeExtension = null;
|
|
878
|
+
if (entryFeeKind) {
|
|
879
|
+
const variantBag = entryFeeKind.variant ?? entryFeeKind;
|
|
880
|
+
const ef = variantBag.BuiltIn;
|
|
881
|
+
const ext = variantBag.Extension;
|
|
882
|
+
if (ef) {
|
|
883
|
+
entryFeeKindTag = "builtin";
|
|
884
|
+
entryFeeToken = starknet.num.toHex(ef.token_address);
|
|
885
|
+
entryFeeAmount = String(ef.amount ?? "0");
|
|
886
|
+
entryFee = {
|
|
887
|
+
tokenAddress: entryFeeToken,
|
|
888
|
+
amount: entryFeeAmount,
|
|
889
|
+
tournamentCreatorShare: Number(ef.tournament_creator_share ?? 0),
|
|
890
|
+
gameCreatorShare: Number(ef.game_creator_share ?? 0),
|
|
891
|
+
refundShare: Number(ef.refund_share ?? 0),
|
|
892
|
+
distribution: ef.distribution ?? null,
|
|
893
|
+
distributionCount: Number(ef.distribution_count ?? 0)
|
|
894
|
+
};
|
|
895
|
+
} else if (ext) {
|
|
896
|
+
entryFeeKindTag = "extension";
|
|
897
|
+
entryFeeExtension = {
|
|
898
|
+
address: starknet.num.toHex(ext.address),
|
|
899
|
+
config: Array.isArray(ext.config) ? ext.config.map((x) => starknet.num.toHex(x)) : []
|
|
900
|
+
};
|
|
901
|
+
}
|
|
871
902
|
}
|
|
872
903
|
const entryRequirement = parseOption(obj.entry_requirement);
|
|
873
904
|
const hasEntryRequirement = entryRequirement !== null;
|
|
@@ -900,6 +931,8 @@ function parseTournament(raw, entryCount) {
|
|
|
900
931
|
leaderboardGameMustBeOver: gameMustBeOver,
|
|
901
932
|
entryFeeToken,
|
|
902
933
|
entryFeeAmount,
|
|
934
|
+
// Protocol-fee bps snapshot, surfaced by the viewer's TournamentFullState.
|
|
935
|
+
protocolFeeShare,
|
|
903
936
|
hasEntryRequirement,
|
|
904
937
|
schedule: {
|
|
905
938
|
registrationStartDelay,
|
|
@@ -917,6 +950,8 @@ function parseTournament(raw, entryCount) {
|
|
|
917
950
|
renderer
|
|
918
951
|
},
|
|
919
952
|
entryFee,
|
|
953
|
+
entryFeeKind: entryFeeKindTag,
|
|
954
|
+
entryFeeExtension,
|
|
920
955
|
entryRequirement,
|
|
921
956
|
leaderboardConfig: { ascending, gameMustBeOver },
|
|
922
957
|
entryCount,
|
|
@@ -947,8 +982,40 @@ function parseRegistration(raw, tournamentId) {
|
|
|
947
982
|
};
|
|
948
983
|
}
|
|
949
984
|
function parsePrize(raw) {
|
|
950
|
-
const
|
|
951
|
-
const
|
|
985
|
+
const record = raw;
|
|
986
|
+
const prizeEnum = record.prize;
|
|
987
|
+
if (!prizeEnum) {
|
|
988
|
+
throw new Error(`PrizeRecord missing prize field: ${JSON.stringify(raw)}`);
|
|
989
|
+
}
|
|
990
|
+
const activePrize = typeof prizeEnum.activeVariant === "function" ? prizeEnum.activeVariant() : prizeEnum.Token !== void 0 ? "Token" : prizeEnum.Extension !== void 0 ? "Extension" : null;
|
|
991
|
+
const prizeVariantBag = prizeEnum.variant ?? prizeEnum;
|
|
992
|
+
if (activePrize === "Extension") {
|
|
993
|
+
const ext = prizeVariantBag.Extension;
|
|
994
|
+
return {
|
|
995
|
+
prizeId: String(record.id ?? "0"),
|
|
996
|
+
tournamentId: String(record.context_id ?? "0"),
|
|
997
|
+
payoutPosition: 0,
|
|
998
|
+
tokenAddress: null,
|
|
999
|
+
tokenType: "extension",
|
|
1000
|
+
amount: null,
|
|
1001
|
+
tokenId: null,
|
|
1002
|
+
distributionType: null,
|
|
1003
|
+
distributionWeight: null,
|
|
1004
|
+
distributionShares: null,
|
|
1005
|
+
distributionCount: null,
|
|
1006
|
+
sponsorAddress: starknet.num.toHex(record.sponsor_address),
|
|
1007
|
+
extensionAddress: ext?.address != null ? starknet.num.toHex(ext.address) : null,
|
|
1008
|
+
extensionConfig: Array.isArray(ext?.config) ? ext.config.map((x) => starknet.num.toHex(x)) : null
|
|
1009
|
+
};
|
|
1010
|
+
}
|
|
1011
|
+
if (activePrize !== "Token") {
|
|
1012
|
+
throw new Error(`Unrecognised Prize variant: ${JSON.stringify(prizeEnum)}`);
|
|
1013
|
+
}
|
|
1014
|
+
const tokenPayload = prizeVariantBag.Token;
|
|
1015
|
+
if (!tokenPayload) {
|
|
1016
|
+
throw new Error(`Prize::Token missing payload: ${JSON.stringify(prizeEnum)}`);
|
|
1017
|
+
}
|
|
1018
|
+
const tokenTypeData = tokenPayload.token_type;
|
|
952
1019
|
let tokenType = "erc20";
|
|
953
1020
|
let amount = null;
|
|
954
1021
|
let tokenId = null;
|
|
@@ -989,10 +1056,10 @@ function parsePrize(raw) {
|
|
|
989
1056
|
}
|
|
990
1057
|
}
|
|
991
1058
|
return {
|
|
992
|
-
prizeId: String(
|
|
993
|
-
tournamentId: String(
|
|
1059
|
+
prizeId: String(record.id ?? "0"),
|
|
1060
|
+
tournamentId: String(record.context_id ?? "0"),
|
|
994
1061
|
payoutPosition,
|
|
995
|
-
tokenAddress: starknet.num.toHex(
|
|
1062
|
+
tokenAddress: starknet.num.toHex(tokenPayload.token_address),
|
|
996
1063
|
tokenType,
|
|
997
1064
|
amount,
|
|
998
1065
|
tokenId,
|
|
@@ -1000,7 +1067,9 @@ function parsePrize(raw) {
|
|
|
1000
1067
|
distributionWeight,
|
|
1001
1068
|
distributionShares,
|
|
1002
1069
|
distributionCount,
|
|
1003
|
-
sponsorAddress: starknet.num.toHex(
|
|
1070
|
+
sponsorAddress: starknet.num.toHex(record.sponsor_address),
|
|
1071
|
+
extensionAddress: null,
|
|
1072
|
+
extensionConfig: null
|
|
1004
1073
|
};
|
|
1005
1074
|
}
|
|
1006
1075
|
function parseOption(raw) {
|
|
@@ -1030,7 +1099,8 @@ function parseFilterResult(raw) {
|
|
|
1030
1099
|
function parseTournamentFullState(raw) {
|
|
1031
1100
|
const obj = raw;
|
|
1032
1101
|
const entryCount = Number(obj.entry_count ?? 0);
|
|
1033
|
-
|
|
1102
|
+
const protocolFeeShare = obj.protocol_fee_bps != null ? Number(obj.protocol_fee_bps) : null;
|
|
1103
|
+
return parseTournament(obj.tournament, entryCount, protocolFeeShare);
|
|
1034
1104
|
}
|
|
1035
1105
|
async function viewerTournaments(contract, offset, limit) {
|
|
1036
1106
|
return wrapRpcCall(async () => {
|
|
@@ -1125,6 +1195,20 @@ async function viewerPrizes(contract, tournamentId) {
|
|
|
1125
1195
|
return result.map(parsePrize);
|
|
1126
1196
|
}, contract.address);
|
|
1127
1197
|
}
|
|
1198
|
+
function rewardClaim(partial) {
|
|
1199
|
+
return {
|
|
1200
|
+
prizeId: null,
|
|
1201
|
+
payoutIndex: null,
|
|
1202
|
+
position: null,
|
|
1203
|
+
refundTokenId: null,
|
|
1204
|
+
extensionTokenId: null,
|
|
1205
|
+
extensionParams: null,
|
|
1206
|
+
...partial
|
|
1207
|
+
};
|
|
1208
|
+
}
|
|
1209
|
+
function spanToHex(v) {
|
|
1210
|
+
return Array.isArray(v) ? v.map((x) => starknet.num.toHex(x)) : [];
|
|
1211
|
+
}
|
|
1128
1212
|
function translateCairoRewardType(rewardType) {
|
|
1129
1213
|
if (!rewardType || typeof rewardType !== "object") {
|
|
1130
1214
|
throw new Error(`Unexpected RewardType payload: ${JSON.stringify(rewardType)}`);
|
|
@@ -1133,70 +1217,73 @@ function translateCairoRewardType(rewardType) {
|
|
|
1133
1217
|
const outer = typeof rt.activeVariant === "function" ? rt.activeVariant() : null;
|
|
1134
1218
|
const innerBag = typeof rt.activeVariant === "function" ? rt.variant : rt;
|
|
1135
1219
|
if (outer === "Prize" || innerBag.Prize !== void 0) {
|
|
1136
|
-
const
|
|
1220
|
+
const prizeClaim = innerBag.Prize;
|
|
1221
|
+
const pcBag = typeof prizeClaim?.activeVariant === "function" ? prizeClaim.variant : prizeClaim;
|
|
1222
|
+
if (pcBag?.Token === void 0 && pcBag?.Extension !== void 0) {
|
|
1223
|
+
const ext = pcBag.Extension;
|
|
1224
|
+
const tokenId = parseOption(ext.token_id);
|
|
1225
|
+
return rewardClaim({
|
|
1226
|
+
claimKind: "prize_extension",
|
|
1227
|
+
prizeId: BigInt(ext.prize_id ?? 0).toString(),
|
|
1228
|
+
extensionTokenId: tokenId != null ? starknet.num.toHex(tokenId) : null,
|
|
1229
|
+
extensionParams: spanToHex(ext.payout_params)
|
|
1230
|
+
});
|
|
1231
|
+
}
|
|
1232
|
+
const prize = pcBag?.Token ?? prizeClaim;
|
|
1137
1233
|
const subVariant = typeof prize?.activeVariant === "function" ? prize.activeVariant() : null;
|
|
1138
1234
|
const subBag = typeof prize?.activeVariant === "function" ? prize.variant : prize;
|
|
1139
1235
|
if (subVariant === "Single" || subBag?.Single !== void 0) {
|
|
1140
|
-
return {
|
|
1236
|
+
return rewardClaim({
|
|
1141
1237
|
claimKind: "prize_single",
|
|
1142
|
-
prizeId: BigInt(subBag.Single).toString()
|
|
1143
|
-
|
|
1144
|
-
position: null,
|
|
1145
|
-
refundTokenId: null
|
|
1146
|
-
};
|
|
1238
|
+
prizeId: BigInt(subBag.Single).toString()
|
|
1239
|
+
});
|
|
1147
1240
|
}
|
|
1148
1241
|
if (subVariant === "Distributed" || subBag?.Distributed !== void 0) {
|
|
1149
1242
|
const distributed = subBag.Distributed;
|
|
1150
1243
|
const prizeId = distributed?.["0"] ?? distributed?.[0];
|
|
1151
1244
|
const payoutIndex = distributed?.["1"] ?? distributed?.[1];
|
|
1152
|
-
return {
|
|
1245
|
+
return rewardClaim({
|
|
1153
1246
|
claimKind: "prize_distributed",
|
|
1154
1247
|
prizeId: BigInt(prizeId).toString(),
|
|
1155
|
-
payoutIndex: Number(payoutIndex)
|
|
1156
|
-
|
|
1157
|
-
refundTokenId: null
|
|
1158
|
-
};
|
|
1248
|
+
payoutIndex: Number(payoutIndex)
|
|
1249
|
+
});
|
|
1159
1250
|
}
|
|
1160
1251
|
}
|
|
1161
1252
|
if (outer === "EntryFee" || innerBag.EntryFee !== void 0) {
|
|
1162
|
-
const
|
|
1253
|
+
const entryFeeClaim = innerBag.EntryFee;
|
|
1254
|
+
const efBag = typeof entryFeeClaim?.activeVariant === "function" ? entryFeeClaim.variant : entryFeeClaim;
|
|
1255
|
+
if (efBag?.Token === void 0 && efBag?.Extension !== void 0) {
|
|
1256
|
+
const ext = efBag.Extension;
|
|
1257
|
+
const tokenId = parseOption(ext.token_id);
|
|
1258
|
+
return rewardClaim({
|
|
1259
|
+
claimKind: "entry_fee_extension",
|
|
1260
|
+
extensionTokenId: tokenId != null ? starknet.num.toHex(tokenId) : null,
|
|
1261
|
+
extensionParams: spanToHex(ext.claim_params)
|
|
1262
|
+
});
|
|
1263
|
+
}
|
|
1264
|
+
const entryFee = efBag?.Token ?? entryFeeClaim;
|
|
1163
1265
|
const subVariant = typeof entryFee?.activeVariant === "function" ? entryFee.activeVariant() : null;
|
|
1164
1266
|
const subBag = typeof entryFee?.activeVariant === "function" ? entryFee.variant : entryFee;
|
|
1165
1267
|
if (subVariant === "Position" || subBag?.Position !== void 0) {
|
|
1166
|
-
return {
|
|
1268
|
+
return rewardClaim({
|
|
1167
1269
|
claimKind: "entry_fee_position",
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
position: Number(subBag.Position),
|
|
1171
|
-
refundTokenId: null
|
|
1172
|
-
};
|
|
1270
|
+
position: Number(subBag.Position)
|
|
1271
|
+
});
|
|
1173
1272
|
}
|
|
1174
1273
|
if (subVariant === "TournamentCreator" || subBag?.TournamentCreator !== void 0) {
|
|
1175
|
-
return {
|
|
1176
|
-
claimKind: "entry_fee_tournament_creator",
|
|
1177
|
-
prizeId: null,
|
|
1178
|
-
payoutIndex: null,
|
|
1179
|
-
position: null,
|
|
1180
|
-
refundTokenId: null
|
|
1181
|
-
};
|
|
1274
|
+
return rewardClaim({ claimKind: "entry_fee_tournament_creator" });
|
|
1182
1275
|
}
|
|
1183
1276
|
if (subVariant === "GameCreator" || subBag?.GameCreator !== void 0) {
|
|
1184
|
-
return {
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
position: null,
|
|
1189
|
-
refundTokenId: null
|
|
1190
|
-
};
|
|
1277
|
+
return rewardClaim({ claimKind: "entry_fee_game_creator" });
|
|
1278
|
+
}
|
|
1279
|
+
if (subVariant === "ProtocolFee" || subBag?.ProtocolFee !== void 0) {
|
|
1280
|
+
return rewardClaim({ claimKind: "entry_fee_protocol_fee" });
|
|
1191
1281
|
}
|
|
1192
1282
|
if (subVariant === "Refund" || subBag?.Refund !== void 0) {
|
|
1193
|
-
return {
|
|
1283
|
+
return rewardClaim({
|
|
1194
1284
|
claimKind: "entry_fee_refund",
|
|
1195
|
-
prizeId: null,
|
|
1196
|
-
payoutIndex: null,
|
|
1197
|
-
position: null,
|
|
1198
1285
|
refundTokenId: `0x${BigInt(subBag.Refund).toString(16)}`
|
|
1199
|
-
};
|
|
1286
|
+
});
|
|
1200
1287
|
}
|
|
1201
1288
|
}
|
|
1202
1289
|
throw new Error(
|
|
@@ -1207,13 +1294,15 @@ async function viewerRewardClaims(contract, tournamentId, offset, limit) {
|
|
|
1207
1294
|
return wrapRpcCall(async () => {
|
|
1208
1295
|
const result = await contract.call("tournament_reward_claims", [tournamentId, offset, limit]);
|
|
1209
1296
|
const obj = result;
|
|
1210
|
-
const claims = obj.claims
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1297
|
+
const claims = (obj.claims ?? []).map(
|
|
1298
|
+
(raw) => {
|
|
1299
|
+
const claim = raw;
|
|
1300
|
+
return {
|
|
1301
|
+
...translateCairoRewardType(claim.reward_type),
|
|
1302
|
+
claimed: Boolean(claim.claimed)
|
|
1303
|
+
};
|
|
1304
|
+
}
|
|
1305
|
+
);
|
|
1217
1306
|
return {
|
|
1218
1307
|
claims,
|
|
1219
1308
|
total: Number(obj.total ?? 0),
|
|
@@ -1493,20 +1582,6 @@ var budokanViewer_default = [
|
|
|
1493
1582
|
}
|
|
1494
1583
|
]
|
|
1495
1584
|
},
|
|
1496
|
-
{
|
|
1497
|
-
type: "enum",
|
|
1498
|
-
name: "core::option::Option::<budokan_interfaces::budokan::EntryFee>",
|
|
1499
|
-
variants: [
|
|
1500
|
-
{
|
|
1501
|
-
name: "Some",
|
|
1502
|
-
type: "budokan_interfaces::budokan::EntryFee"
|
|
1503
|
-
},
|
|
1504
|
-
{
|
|
1505
|
-
name: "None",
|
|
1506
|
-
type: "()"
|
|
1507
|
-
}
|
|
1508
|
-
]
|
|
1509
|
-
},
|
|
1510
1585
|
{
|
|
1511
1586
|
type: "struct",
|
|
1512
1587
|
name: "core::array::Span::<core::felt252>",
|
|
@@ -1531,6 +1606,34 @@ var budokanViewer_default = [
|
|
|
1531
1606
|
}
|
|
1532
1607
|
]
|
|
1533
1608
|
},
|
|
1609
|
+
{
|
|
1610
|
+
type: "enum",
|
|
1611
|
+
name: "budokan_interfaces::budokan::EntryFeeKind",
|
|
1612
|
+
variants: [
|
|
1613
|
+
{
|
|
1614
|
+
name: "BuiltIn",
|
|
1615
|
+
type: "budokan_interfaces::budokan::EntryFee"
|
|
1616
|
+
},
|
|
1617
|
+
{
|
|
1618
|
+
name: "Extension",
|
|
1619
|
+
type: "metagame_extensions_interfaces::extension::ExtensionConfig"
|
|
1620
|
+
}
|
|
1621
|
+
]
|
|
1622
|
+
},
|
|
1623
|
+
{
|
|
1624
|
+
type: "enum",
|
|
1625
|
+
name: "core::option::Option::<budokan_interfaces::budokan::EntryFeeKind>",
|
|
1626
|
+
variants: [
|
|
1627
|
+
{
|
|
1628
|
+
name: "Some",
|
|
1629
|
+
type: "budokan_interfaces::budokan::EntryFeeKind"
|
|
1630
|
+
},
|
|
1631
|
+
{
|
|
1632
|
+
name: "None",
|
|
1633
|
+
type: "()"
|
|
1634
|
+
}
|
|
1635
|
+
]
|
|
1636
|
+
},
|
|
1534
1637
|
{
|
|
1535
1638
|
type: "enum",
|
|
1536
1639
|
name: "game_components_interfaces::entry_requirement::EntryRequirementType",
|
|
@@ -1621,7 +1724,7 @@ var budokanViewer_default = [
|
|
|
1621
1724
|
},
|
|
1622
1725
|
{
|
|
1623
1726
|
name: "entry_fee",
|
|
1624
|
-
type: "core::option::Option::<budokan_interfaces::budokan::
|
|
1727
|
+
type: "core::option::Option::<budokan_interfaces::budokan::EntryFeeKind>"
|
|
1625
1728
|
},
|
|
1626
1729
|
{
|
|
1627
1730
|
name: "entry_requirement",
|
|
@@ -1648,6 +1751,10 @@ var budokanViewer_default = [
|
|
|
1648
1751
|
{
|
|
1649
1752
|
name: "phase",
|
|
1650
1753
|
type: "budokan_interfaces::budokan::Phase"
|
|
1754
|
+
},
|
|
1755
|
+
{
|
|
1756
|
+
name: "protocol_fee_bps",
|
|
1757
|
+
type: "core::integer::u16"
|
|
1651
1758
|
}
|
|
1652
1759
|
]
|
|
1653
1760
|
},
|
|
@@ -1777,7 +1884,49 @@ var budokanViewer_default = [
|
|
|
1777
1884
|
},
|
|
1778
1885
|
{
|
|
1779
1886
|
type: "struct",
|
|
1780
|
-
name: "game_components_interfaces::prize::
|
|
1887
|
+
name: "game_components_interfaces::prize::TokenPrizePayload",
|
|
1888
|
+
members: [
|
|
1889
|
+
{
|
|
1890
|
+
name: "token_address",
|
|
1891
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
1892
|
+
},
|
|
1893
|
+
{
|
|
1894
|
+
name: "token_type",
|
|
1895
|
+
type: "game_components_interfaces::prize::TokenTypeData"
|
|
1896
|
+
}
|
|
1897
|
+
]
|
|
1898
|
+
},
|
|
1899
|
+
{
|
|
1900
|
+
type: "struct",
|
|
1901
|
+
name: "game_components_interfaces::prize::ExtensionPrizePayload",
|
|
1902
|
+
members: [
|
|
1903
|
+
{
|
|
1904
|
+
name: "address",
|
|
1905
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
1906
|
+
},
|
|
1907
|
+
{
|
|
1908
|
+
name: "config",
|
|
1909
|
+
type: "core::array::Span::<core::felt252>"
|
|
1910
|
+
}
|
|
1911
|
+
]
|
|
1912
|
+
},
|
|
1913
|
+
{
|
|
1914
|
+
type: "enum",
|
|
1915
|
+
name: "game_components_interfaces::prize::Prize",
|
|
1916
|
+
variants: [
|
|
1917
|
+
{
|
|
1918
|
+
name: "Token",
|
|
1919
|
+
type: "game_components_interfaces::prize::TokenPrizePayload"
|
|
1920
|
+
},
|
|
1921
|
+
{
|
|
1922
|
+
name: "Extension",
|
|
1923
|
+
type: "game_components_interfaces::prize::ExtensionPrizePayload"
|
|
1924
|
+
}
|
|
1925
|
+
]
|
|
1926
|
+
},
|
|
1927
|
+
{
|
|
1928
|
+
type: "struct",
|
|
1929
|
+
name: "game_components_interfaces::prize::PrizeRecord",
|
|
1781
1930
|
members: [
|
|
1782
1931
|
{
|
|
1783
1932
|
name: "id",
|
|
@@ -1788,16 +1937,12 @@ var budokanViewer_default = [
|
|
|
1788
1937
|
type: "core::integer::u64"
|
|
1789
1938
|
},
|
|
1790
1939
|
{
|
|
1791
|
-
name: "
|
|
1940
|
+
name: "sponsor_address",
|
|
1792
1941
|
type: "core::starknet::contract_address::ContractAddress"
|
|
1793
1942
|
},
|
|
1794
1943
|
{
|
|
1795
|
-
name: "
|
|
1796
|
-
type: "game_components_interfaces::prize::
|
|
1797
|
-
},
|
|
1798
|
-
{
|
|
1799
|
-
name: "sponsor_address",
|
|
1800
|
-
type: "core::starknet::contract_address::ContractAddress"
|
|
1944
|
+
name: "prize",
|
|
1945
|
+
type: "game_components_interfaces::prize::Prize"
|
|
1801
1946
|
}
|
|
1802
1947
|
]
|
|
1803
1948
|
},
|
|
@@ -1815,6 +1960,52 @@ var budokanViewer_default = [
|
|
|
1815
1960
|
}
|
|
1816
1961
|
]
|
|
1817
1962
|
},
|
|
1963
|
+
{
|
|
1964
|
+
type: "enum",
|
|
1965
|
+
name: "core::option::Option::<core::felt252>",
|
|
1966
|
+
variants: [
|
|
1967
|
+
{
|
|
1968
|
+
name: "Some",
|
|
1969
|
+
type: "core::felt252"
|
|
1970
|
+
},
|
|
1971
|
+
{
|
|
1972
|
+
name: "None",
|
|
1973
|
+
type: "()"
|
|
1974
|
+
}
|
|
1975
|
+
]
|
|
1976
|
+
},
|
|
1977
|
+
{
|
|
1978
|
+
type: "struct",
|
|
1979
|
+
name: "budokan_interfaces::budokan::ExtensionPrizeClaim",
|
|
1980
|
+
members: [
|
|
1981
|
+
{
|
|
1982
|
+
name: "prize_id",
|
|
1983
|
+
type: "core::integer::u64"
|
|
1984
|
+
},
|
|
1985
|
+
{
|
|
1986
|
+
name: "token_id",
|
|
1987
|
+
type: "core::option::Option::<core::felt252>"
|
|
1988
|
+
},
|
|
1989
|
+
{
|
|
1990
|
+
name: "payout_params",
|
|
1991
|
+
type: "core::array::Span::<core::felt252>"
|
|
1992
|
+
}
|
|
1993
|
+
]
|
|
1994
|
+
},
|
|
1995
|
+
{
|
|
1996
|
+
type: "enum",
|
|
1997
|
+
name: "budokan_interfaces::budokan::PrizeClaim",
|
|
1998
|
+
variants: [
|
|
1999
|
+
{
|
|
2000
|
+
name: "Token",
|
|
2001
|
+
type: "game_components_interfaces::prize::PrizeType"
|
|
2002
|
+
},
|
|
2003
|
+
{
|
|
2004
|
+
name: "Extension",
|
|
2005
|
+
type: "budokan_interfaces::budokan::ExtensionPrizeClaim"
|
|
2006
|
+
}
|
|
2007
|
+
]
|
|
2008
|
+
},
|
|
1818
2009
|
{
|
|
1819
2010
|
type: "enum",
|
|
1820
2011
|
name: "budokan_interfaces::budokan::EntryFeeRewardType",
|
|
@@ -1834,6 +2025,38 @@ var budokanViewer_default = [
|
|
|
1834
2025
|
{
|
|
1835
2026
|
name: "Refund",
|
|
1836
2027
|
type: "core::felt252"
|
|
2028
|
+
},
|
|
2029
|
+
{
|
|
2030
|
+
name: "ProtocolFee",
|
|
2031
|
+
type: "()"
|
|
2032
|
+
}
|
|
2033
|
+
]
|
|
2034
|
+
},
|
|
2035
|
+
{
|
|
2036
|
+
type: "struct",
|
|
2037
|
+
name: "budokan_interfaces::budokan::ExtensionEntryFeeClaim",
|
|
2038
|
+
members: [
|
|
2039
|
+
{
|
|
2040
|
+
name: "token_id",
|
|
2041
|
+
type: "core::option::Option::<core::felt252>"
|
|
2042
|
+
},
|
|
2043
|
+
{
|
|
2044
|
+
name: "claim_params",
|
|
2045
|
+
type: "core::array::Span::<core::felt252>"
|
|
2046
|
+
}
|
|
2047
|
+
]
|
|
2048
|
+
},
|
|
2049
|
+
{
|
|
2050
|
+
type: "enum",
|
|
2051
|
+
name: "budokan_interfaces::budokan::EntryFeeClaim",
|
|
2052
|
+
variants: [
|
|
2053
|
+
{
|
|
2054
|
+
name: "Token",
|
|
2055
|
+
type: "budokan_interfaces::budokan::EntryFeeRewardType"
|
|
2056
|
+
},
|
|
2057
|
+
{
|
|
2058
|
+
name: "Extension",
|
|
2059
|
+
type: "budokan_interfaces::budokan::ExtensionEntryFeeClaim"
|
|
1837
2060
|
}
|
|
1838
2061
|
]
|
|
1839
2062
|
},
|
|
@@ -1843,11 +2066,11 @@ var budokanViewer_default = [
|
|
|
1843
2066
|
variants: [
|
|
1844
2067
|
{
|
|
1845
2068
|
name: "Prize",
|
|
1846
|
-
type: "
|
|
2069
|
+
type: "budokan_interfaces::budokan::PrizeClaim"
|
|
1847
2070
|
},
|
|
1848
2071
|
{
|
|
1849
2072
|
name: "EntryFee",
|
|
1850
|
-
type: "budokan_interfaces::budokan::
|
|
2073
|
+
type: "budokan_interfaces::budokan::EntryFeeClaim"
|
|
1851
2074
|
}
|
|
1852
2075
|
]
|
|
1853
2076
|
},
|
|
@@ -2138,6 +2361,62 @@ var budokanViewer_default = [
|
|
|
2138
2361
|
],
|
|
2139
2362
|
state_mutability: "view"
|
|
2140
2363
|
},
|
|
2364
|
+
{
|
|
2365
|
+
type: "function",
|
|
2366
|
+
name: "tournament_registrations_by_owner",
|
|
2367
|
+
inputs: [
|
|
2368
|
+
{
|
|
2369
|
+
name: "tournament_id",
|
|
2370
|
+
type: "core::integer::u64"
|
|
2371
|
+
},
|
|
2372
|
+
{
|
|
2373
|
+
name: "owner",
|
|
2374
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
2375
|
+
},
|
|
2376
|
+
{
|
|
2377
|
+
name: "offset",
|
|
2378
|
+
type: "core::integer::u32"
|
|
2379
|
+
},
|
|
2380
|
+
{
|
|
2381
|
+
name: "limit",
|
|
2382
|
+
type: "core::integer::u32"
|
|
2383
|
+
}
|
|
2384
|
+
],
|
|
2385
|
+
outputs: [
|
|
2386
|
+
{
|
|
2387
|
+
type: "budokan_interfaces::viewer::RegistrationResult"
|
|
2388
|
+
}
|
|
2389
|
+
],
|
|
2390
|
+
state_mutability: "view"
|
|
2391
|
+
},
|
|
2392
|
+
{
|
|
2393
|
+
type: "function",
|
|
2394
|
+
name: "tournament_registrations_by_token_ids",
|
|
2395
|
+
inputs: [
|
|
2396
|
+
{
|
|
2397
|
+
name: "tournament_id",
|
|
2398
|
+
type: "core::integer::u64"
|
|
2399
|
+
},
|
|
2400
|
+
{
|
|
2401
|
+
name: "token_ids",
|
|
2402
|
+
type: "core::array::Array::<core::felt252>"
|
|
2403
|
+
},
|
|
2404
|
+
{
|
|
2405
|
+
name: "offset",
|
|
2406
|
+
type: "core::integer::u32"
|
|
2407
|
+
},
|
|
2408
|
+
{
|
|
2409
|
+
name: "limit",
|
|
2410
|
+
type: "core::integer::u32"
|
|
2411
|
+
}
|
|
2412
|
+
],
|
|
2413
|
+
outputs: [
|
|
2414
|
+
{
|
|
2415
|
+
type: "budokan_interfaces::viewer::RegistrationResult"
|
|
2416
|
+
}
|
|
2417
|
+
],
|
|
2418
|
+
state_mutability: "view"
|
|
2419
|
+
},
|
|
2141
2420
|
{
|
|
2142
2421
|
type: "function",
|
|
2143
2422
|
name: "leaderboard",
|
|
@@ -2173,7 +2452,7 @@ var budokanViewer_default = [
|
|
|
2173
2452
|
],
|
|
2174
2453
|
outputs: [
|
|
2175
2454
|
{
|
|
2176
|
-
type: "core::array::Array::<game_components_interfaces::prize::
|
|
2455
|
+
type: "core::array::Array::<game_components_interfaces::prize::PrizeRecord>"
|
|
2177
2456
|
}
|
|
2178
2457
|
],
|
|
2179
2458
|
state_mutability: "view"
|
|
@@ -2434,17 +2713,51 @@ var budokan_default = [
|
|
|
2434
2713
|
},
|
|
2435
2714
|
{
|
|
2436
2715
|
type: "impl",
|
|
2437
|
-
name: "
|
|
2438
|
-
interface_name: "
|
|
2716
|
+
name: "BudokanRewardsAdminImpl",
|
|
2717
|
+
interface_name: "budokan::budokan::Budokan::IBudokanRewardsAdmin"
|
|
2439
2718
|
},
|
|
2440
2719
|
{
|
|
2441
|
-
type: "
|
|
2442
|
-
name: "
|
|
2443
|
-
|
|
2720
|
+
type: "interface",
|
|
2721
|
+
name: "budokan::budokan::Budokan::IBudokanRewardsAdmin",
|
|
2722
|
+
items: [
|
|
2444
2723
|
{
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2724
|
+
type: "function",
|
|
2725
|
+
name: "set_rewards_class_hash",
|
|
2726
|
+
inputs: [
|
|
2727
|
+
{
|
|
2728
|
+
name: "new_class_hash",
|
|
2729
|
+
type: "core::starknet::class_hash::ClassHash"
|
|
2730
|
+
}
|
|
2731
|
+
],
|
|
2732
|
+
outputs: [],
|
|
2733
|
+
state_mutability: "external"
|
|
2734
|
+
},
|
|
2735
|
+
{
|
|
2736
|
+
type: "function",
|
|
2737
|
+
name: "rewards_class_hash",
|
|
2738
|
+
inputs: [],
|
|
2739
|
+
outputs: [
|
|
2740
|
+
{
|
|
2741
|
+
type: "core::starknet::class_hash::ClassHash"
|
|
2742
|
+
}
|
|
2743
|
+
],
|
|
2744
|
+
state_mutability: "view"
|
|
2745
|
+
}
|
|
2746
|
+
]
|
|
2747
|
+
},
|
|
2748
|
+
{
|
|
2749
|
+
type: "impl",
|
|
2750
|
+
name: "GameContextImpl",
|
|
2751
|
+
interface_name: "game_components_interfaces::metagame::context::IMetagameContext"
|
|
2752
|
+
},
|
|
2753
|
+
{
|
|
2754
|
+
type: "enum",
|
|
2755
|
+
name: "core::bool",
|
|
2756
|
+
variants: [
|
|
2757
|
+
{
|
|
2758
|
+
name: "False",
|
|
2759
|
+
type: "()"
|
|
2760
|
+
},
|
|
2448
2761
|
{
|
|
2449
2762
|
name: "True",
|
|
2450
2763
|
type: "()"
|
|
@@ -2516,11 +2829,11 @@ var budokan_default = [
|
|
|
2516
2829
|
members: [
|
|
2517
2830
|
{
|
|
2518
2831
|
name: "name",
|
|
2519
|
-
type: "core::
|
|
2832
|
+
type: "core::felt252"
|
|
2520
2833
|
},
|
|
2521
2834
|
{
|
|
2522
2835
|
name: "value",
|
|
2523
|
-
type: "core::
|
|
2836
|
+
type: "core::felt252"
|
|
2524
2837
|
}
|
|
2525
2838
|
]
|
|
2526
2839
|
},
|
|
@@ -2748,50 +3061,54 @@ var budokan_default = [
|
|
|
2748
3061
|
]
|
|
2749
3062
|
},
|
|
2750
3063
|
{
|
|
2751
|
-
type: "
|
|
2752
|
-
name: "core::
|
|
2753
|
-
|
|
2754
|
-
{
|
|
2755
|
-
name: "Some",
|
|
2756
|
-
type: "budokan_interfaces::budokan::EntryFee"
|
|
2757
|
-
},
|
|
3064
|
+
type: "struct",
|
|
3065
|
+
name: "core::array::Span::<core::felt252>",
|
|
3066
|
+
members: [
|
|
2758
3067
|
{
|
|
2759
|
-
name: "
|
|
2760
|
-
type: "
|
|
3068
|
+
name: "snapshot",
|
|
3069
|
+
type: "@core::array::Array::<core::felt252>"
|
|
2761
3070
|
}
|
|
2762
3071
|
]
|
|
2763
3072
|
},
|
|
2764
3073
|
{
|
|
2765
3074
|
type: "struct",
|
|
2766
|
-
name: "
|
|
3075
|
+
name: "metagame_extensions_interfaces::extension::ExtensionConfig",
|
|
2767
3076
|
members: [
|
|
2768
3077
|
{
|
|
2769
|
-
name: "
|
|
2770
|
-
type: "
|
|
3078
|
+
name: "address",
|
|
3079
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
3080
|
+
},
|
|
3081
|
+
{
|
|
3082
|
+
name: "config",
|
|
3083
|
+
type: "core::array::Span::<core::felt252>"
|
|
2771
3084
|
}
|
|
2772
3085
|
]
|
|
2773
3086
|
},
|
|
2774
3087
|
{
|
|
2775
|
-
type: "
|
|
2776
|
-
name: "
|
|
2777
|
-
|
|
3088
|
+
type: "enum",
|
|
3089
|
+
name: "budokan_interfaces::budokan::EntryFeeKind",
|
|
3090
|
+
variants: [
|
|
2778
3091
|
{
|
|
2779
|
-
name: "
|
|
2780
|
-
type: "
|
|
3092
|
+
name: "BuiltIn",
|
|
3093
|
+
type: "budokan_interfaces::budokan::EntryFee"
|
|
3094
|
+
},
|
|
3095
|
+
{
|
|
3096
|
+
name: "Extension",
|
|
3097
|
+
type: "metagame_extensions_interfaces::extension::ExtensionConfig"
|
|
2781
3098
|
}
|
|
2782
3099
|
]
|
|
2783
3100
|
},
|
|
2784
3101
|
{
|
|
2785
|
-
type: "
|
|
2786
|
-
name: "
|
|
2787
|
-
|
|
3102
|
+
type: "enum",
|
|
3103
|
+
name: "core::option::Option::<budokan_interfaces::budokan::EntryFeeKind>",
|
|
3104
|
+
variants: [
|
|
2788
3105
|
{
|
|
2789
|
-
name: "
|
|
2790
|
-
type: "
|
|
3106
|
+
name: "Some",
|
|
3107
|
+
type: "budokan_interfaces::budokan::EntryFeeKind"
|
|
2791
3108
|
},
|
|
2792
3109
|
{
|
|
2793
|
-
name: "
|
|
2794
|
-
type: "
|
|
3110
|
+
name: "None",
|
|
3111
|
+
type: "()"
|
|
2795
3112
|
}
|
|
2796
3113
|
]
|
|
2797
3114
|
},
|
|
@@ -2805,7 +3122,7 @@ var budokan_default = [
|
|
|
2805
3122
|
},
|
|
2806
3123
|
{
|
|
2807
3124
|
name: "extension",
|
|
2808
|
-
type: "
|
|
3125
|
+
type: "metagame_extensions_interfaces::extension::ExtensionConfig"
|
|
2809
3126
|
}
|
|
2810
3127
|
]
|
|
2811
3128
|
},
|
|
@@ -2885,7 +3202,7 @@ var budokan_default = [
|
|
|
2885
3202
|
},
|
|
2886
3203
|
{
|
|
2887
3204
|
name: "entry_fee",
|
|
2888
|
-
type: "core::option::Option::<budokan_interfaces::budokan::
|
|
3205
|
+
type: "core::option::Option::<budokan_interfaces::budokan::EntryFeeKind>"
|
|
2889
3206
|
},
|
|
2890
3207
|
{
|
|
2891
3208
|
name: "entry_requirement",
|
|
@@ -2927,6 +3244,20 @@ var budokan_default = [
|
|
|
2927
3244
|
}
|
|
2928
3245
|
]
|
|
2929
3246
|
},
|
|
3247
|
+
{
|
|
3248
|
+
type: "enum",
|
|
3249
|
+
name: "core::option::Option::<core::felt252>",
|
|
3250
|
+
variants: [
|
|
3251
|
+
{
|
|
3252
|
+
name: "Some",
|
|
3253
|
+
type: "core::felt252"
|
|
3254
|
+
},
|
|
3255
|
+
{
|
|
3256
|
+
name: "None",
|
|
3257
|
+
type: "()"
|
|
3258
|
+
}
|
|
3259
|
+
]
|
|
3260
|
+
},
|
|
2930
3261
|
{
|
|
2931
3262
|
type: "struct",
|
|
2932
3263
|
name: "core::integer::u256",
|
|
@@ -2959,10 +3290,6 @@ var budokan_default = [
|
|
|
2959
3290
|
name: "NFT",
|
|
2960
3291
|
type: "game_components_interfaces::entry_requirement::NFTQualification"
|
|
2961
3292
|
},
|
|
2962
|
-
{
|
|
2963
|
-
name: "Address",
|
|
2964
|
-
type: "core::starknet::contract_address::ContractAddress"
|
|
2965
|
-
},
|
|
2966
3293
|
{
|
|
2967
3294
|
name: "Extension",
|
|
2968
3295
|
type: "core::array::Span::<core::felt252>"
|
|
@@ -2983,6 +3310,38 @@ var budokan_default = [
|
|
|
2983
3310
|
}
|
|
2984
3311
|
]
|
|
2985
3312
|
},
|
|
3313
|
+
{
|
|
3314
|
+
type: "enum",
|
|
3315
|
+
name: "core::option::Option::<core::array::Span::<core::felt252>>",
|
|
3316
|
+
variants: [
|
|
3317
|
+
{
|
|
3318
|
+
name: "Some",
|
|
3319
|
+
type: "core::array::Span::<core::felt252>"
|
|
3320
|
+
},
|
|
3321
|
+
{
|
|
3322
|
+
name: "None",
|
|
3323
|
+
type: "()"
|
|
3324
|
+
}
|
|
3325
|
+
]
|
|
3326
|
+
},
|
|
3327
|
+
{
|
|
3328
|
+
type: "struct",
|
|
3329
|
+
name: "budokan_interfaces::budokan::TournamentRecipientParams",
|
|
3330
|
+
members: [
|
|
3331
|
+
{
|
|
3332
|
+
name: "player_address",
|
|
3333
|
+
type: "core::option::Option::<core::starknet::contract_address::ContractAddress>"
|
|
3334
|
+
},
|
|
3335
|
+
{
|
|
3336
|
+
name: "qualifier",
|
|
3337
|
+
type: "core::option::Option::<core::starknet::contract_address::ContractAddress>"
|
|
3338
|
+
},
|
|
3339
|
+
{
|
|
3340
|
+
name: "qualification",
|
|
3341
|
+
type: "core::option::Option::<game_components_interfaces::entry_requirement::QualificationProof>"
|
|
3342
|
+
}
|
|
3343
|
+
]
|
|
3344
|
+
},
|
|
2986
3345
|
{
|
|
2987
3346
|
type: "enum",
|
|
2988
3347
|
name: "game_components_interfaces::prize::PrizeType",
|
|
@@ -2997,6 +3356,38 @@ var budokan_default = [
|
|
|
2997
3356
|
}
|
|
2998
3357
|
]
|
|
2999
3358
|
},
|
|
3359
|
+
{
|
|
3360
|
+
type: "struct",
|
|
3361
|
+
name: "budokan_interfaces::budokan::ExtensionPrizeClaim",
|
|
3362
|
+
members: [
|
|
3363
|
+
{
|
|
3364
|
+
name: "prize_id",
|
|
3365
|
+
type: "core::integer::u64"
|
|
3366
|
+
},
|
|
3367
|
+
{
|
|
3368
|
+
name: "token_id",
|
|
3369
|
+
type: "core::option::Option::<core::felt252>"
|
|
3370
|
+
},
|
|
3371
|
+
{
|
|
3372
|
+
name: "payout_params",
|
|
3373
|
+
type: "core::array::Span::<core::felt252>"
|
|
3374
|
+
}
|
|
3375
|
+
]
|
|
3376
|
+
},
|
|
3377
|
+
{
|
|
3378
|
+
type: "enum",
|
|
3379
|
+
name: "budokan_interfaces::budokan::PrizeClaim",
|
|
3380
|
+
variants: [
|
|
3381
|
+
{
|
|
3382
|
+
name: "Token",
|
|
3383
|
+
type: "game_components_interfaces::prize::PrizeType"
|
|
3384
|
+
},
|
|
3385
|
+
{
|
|
3386
|
+
name: "Extension",
|
|
3387
|
+
type: "budokan_interfaces::budokan::ExtensionPrizeClaim"
|
|
3388
|
+
}
|
|
3389
|
+
]
|
|
3390
|
+
},
|
|
3000
3391
|
{
|
|
3001
3392
|
type: "enum",
|
|
3002
3393
|
name: "budokan_interfaces::budokan::EntryFeeRewardType",
|
|
@@ -3016,6 +3407,38 @@ var budokan_default = [
|
|
|
3016
3407
|
{
|
|
3017
3408
|
name: "Refund",
|
|
3018
3409
|
type: "core::felt252"
|
|
3410
|
+
},
|
|
3411
|
+
{
|
|
3412
|
+
name: "ProtocolFee",
|
|
3413
|
+
type: "()"
|
|
3414
|
+
}
|
|
3415
|
+
]
|
|
3416
|
+
},
|
|
3417
|
+
{
|
|
3418
|
+
type: "struct",
|
|
3419
|
+
name: "budokan_interfaces::budokan::ExtensionEntryFeeClaim",
|
|
3420
|
+
members: [
|
|
3421
|
+
{
|
|
3422
|
+
name: "token_id",
|
|
3423
|
+
type: "core::option::Option::<core::felt252>"
|
|
3424
|
+
},
|
|
3425
|
+
{
|
|
3426
|
+
name: "claim_params",
|
|
3427
|
+
type: "core::array::Span::<core::felt252>"
|
|
3428
|
+
}
|
|
3429
|
+
]
|
|
3430
|
+
},
|
|
3431
|
+
{
|
|
3432
|
+
type: "enum",
|
|
3433
|
+
name: "budokan_interfaces::budokan::EntryFeeClaim",
|
|
3434
|
+
variants: [
|
|
3435
|
+
{
|
|
3436
|
+
name: "Token",
|
|
3437
|
+
type: "budokan_interfaces::budokan::EntryFeeRewardType"
|
|
3438
|
+
},
|
|
3439
|
+
{
|
|
3440
|
+
name: "Extension",
|
|
3441
|
+
type: "budokan_interfaces::budokan::ExtensionEntryFeeClaim"
|
|
3019
3442
|
}
|
|
3020
3443
|
]
|
|
3021
3444
|
},
|
|
@@ -3025,11 +3448,11 @@ var budokan_default = [
|
|
|
3025
3448
|
variants: [
|
|
3026
3449
|
{
|
|
3027
3450
|
name: "Prize",
|
|
3028
|
-
type: "
|
|
3451
|
+
type: "budokan_interfaces::budokan::PrizeClaim"
|
|
3029
3452
|
},
|
|
3030
3453
|
{
|
|
3031
3454
|
name: "EntryFee",
|
|
3032
|
-
type: "budokan_interfaces::budokan::
|
|
3455
|
+
type: "budokan_interfaces::budokan::EntryFeeClaim"
|
|
3033
3456
|
}
|
|
3034
3457
|
]
|
|
3035
3458
|
},
|
|
@@ -3091,16 +3514,8 @@ var budokan_default = [
|
|
|
3091
3514
|
},
|
|
3092
3515
|
{
|
|
3093
3516
|
type: "struct",
|
|
3094
|
-
name: "game_components_interfaces::prize::
|
|
3517
|
+
name: "game_components_interfaces::prize::TokenPrizePayload",
|
|
3095
3518
|
members: [
|
|
3096
|
-
{
|
|
3097
|
-
name: "id",
|
|
3098
|
-
type: "core::integer::u64"
|
|
3099
|
-
},
|
|
3100
|
-
{
|
|
3101
|
-
name: "context_id",
|
|
3102
|
-
type: "core::integer::u64"
|
|
3103
|
-
},
|
|
3104
3519
|
{
|
|
3105
3520
|
name: "token_address",
|
|
3106
3521
|
type: "core::starknet::contract_address::ContractAddress"
|
|
@@ -3108,10 +3523,34 @@ var budokan_default = [
|
|
|
3108
3523
|
{
|
|
3109
3524
|
name: "token_type",
|
|
3110
3525
|
type: "game_components_interfaces::prize::TokenTypeData"
|
|
3111
|
-
}
|
|
3526
|
+
}
|
|
3527
|
+
]
|
|
3528
|
+
},
|
|
3529
|
+
{
|
|
3530
|
+
type: "struct",
|
|
3531
|
+
name: "game_components_interfaces::prize::ExtensionPrizePayload",
|
|
3532
|
+
members: [
|
|
3112
3533
|
{
|
|
3113
|
-
name: "
|
|
3534
|
+
name: "address",
|
|
3114
3535
|
type: "core::starknet::contract_address::ContractAddress"
|
|
3536
|
+
},
|
|
3537
|
+
{
|
|
3538
|
+
name: "config",
|
|
3539
|
+
type: "core::array::Span::<core::felt252>"
|
|
3540
|
+
}
|
|
3541
|
+
]
|
|
3542
|
+
},
|
|
3543
|
+
{
|
|
3544
|
+
type: "enum",
|
|
3545
|
+
name: "game_components_interfaces::prize::Prize",
|
|
3546
|
+
variants: [
|
|
3547
|
+
{
|
|
3548
|
+
name: "Token",
|
|
3549
|
+
type: "game_components_interfaces::prize::TokenPrizePayload"
|
|
3550
|
+
},
|
|
3551
|
+
{
|
|
3552
|
+
name: "Extension",
|
|
3553
|
+
type: "game_components_interfaces::prize::ExtensionPrizePayload"
|
|
3115
3554
|
}
|
|
3116
3555
|
]
|
|
3117
3556
|
},
|
|
@@ -3146,38 +3585,6 @@ var budokan_default = [
|
|
|
3146
3585
|
],
|
|
3147
3586
|
state_mutability: "view"
|
|
3148
3587
|
},
|
|
3149
|
-
{
|
|
3150
|
-
type: "function",
|
|
3151
|
-
name: "tournament_entries",
|
|
3152
|
-
inputs: [
|
|
3153
|
-
{
|
|
3154
|
-
name: "tournament_id",
|
|
3155
|
-
type: "core::integer::u64"
|
|
3156
|
-
}
|
|
3157
|
-
],
|
|
3158
|
-
outputs: [
|
|
3159
|
-
{
|
|
3160
|
-
type: "core::integer::u32"
|
|
3161
|
-
}
|
|
3162
|
-
],
|
|
3163
|
-
state_mutability: "view"
|
|
3164
|
-
},
|
|
3165
|
-
{
|
|
3166
|
-
type: "function",
|
|
3167
|
-
name: "get_leaderboard",
|
|
3168
|
-
inputs: [
|
|
3169
|
-
{
|
|
3170
|
-
name: "tournament_id",
|
|
3171
|
-
type: "core::integer::u64"
|
|
3172
|
-
}
|
|
3173
|
-
],
|
|
3174
|
-
outputs: [
|
|
3175
|
-
{
|
|
3176
|
-
type: "core::array::Array::<core::felt252>"
|
|
3177
|
-
}
|
|
3178
|
-
],
|
|
3179
|
-
state_mutability: "view"
|
|
3180
|
-
},
|
|
3181
3588
|
{
|
|
3182
3589
|
type: "function",
|
|
3183
3590
|
name: "current_phase",
|
|
@@ -3232,7 +3639,7 @@ var budokan_default = [
|
|
|
3232
3639
|
},
|
|
3233
3640
|
{
|
|
3234
3641
|
name: "entry_fee",
|
|
3235
|
-
type: "core::option::Option::<budokan_interfaces::budokan::
|
|
3642
|
+
type: "core::option::Option::<budokan_interfaces::budokan::EntryFeeKind>"
|
|
3236
3643
|
},
|
|
3237
3644
|
{
|
|
3238
3645
|
name: "entry_requirement",
|
|
@@ -3268,16 +3675,24 @@ var budokan_default = [
|
|
|
3268
3675
|
},
|
|
3269
3676
|
{
|
|
3270
3677
|
name: "player_name",
|
|
3271
|
-
type: "core::felt252"
|
|
3678
|
+
type: "core::option::Option::<core::felt252>"
|
|
3272
3679
|
},
|
|
3273
3680
|
{
|
|
3274
3681
|
name: "player_address",
|
|
3275
|
-
type: "core::starknet::contract_address::ContractAddress"
|
|
3682
|
+
type: "core::option::Option::<core::starknet::contract_address::ContractAddress>"
|
|
3683
|
+
},
|
|
3684
|
+
{
|
|
3685
|
+
name: "qualifier",
|
|
3686
|
+
type: "core::option::Option::<core::starknet::contract_address::ContractAddress>"
|
|
3276
3687
|
},
|
|
3277
3688
|
{
|
|
3278
3689
|
name: "qualification",
|
|
3279
3690
|
type: "core::option::Option::<game_components_interfaces::entry_requirement::QualificationProof>"
|
|
3280
3691
|
},
|
|
3692
|
+
{
|
|
3693
|
+
name: "entry_fee_pay_params",
|
|
3694
|
+
type: "core::option::Option::<core::array::Span::<core::felt252>>"
|
|
3695
|
+
},
|
|
3281
3696
|
{
|
|
3282
3697
|
name: "salt",
|
|
3283
3698
|
type: "core::integer::u16"
|
|
@@ -3296,23 +3711,55 @@ var budokan_default = [
|
|
|
3296
3711
|
},
|
|
3297
3712
|
{
|
|
3298
3713
|
type: "function",
|
|
3299
|
-
name: "
|
|
3714
|
+
name: "enter_tournament_for_recipients",
|
|
3300
3715
|
inputs: [
|
|
3301
3716
|
{
|
|
3302
3717
|
name: "tournament_id",
|
|
3303
3718
|
type: "core::integer::u64"
|
|
3304
3719
|
},
|
|
3305
3720
|
{
|
|
3306
|
-
name: "
|
|
3307
|
-
type: "core::
|
|
3721
|
+
name: "recipients",
|
|
3722
|
+
type: "core::array::Array::<budokan_interfaces::budokan::TournamentRecipientParams>"
|
|
3308
3723
|
},
|
|
3309
3724
|
{
|
|
3310
|
-
name: "
|
|
3311
|
-
type: "core::
|
|
3312
|
-
}
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3725
|
+
name: "player_name",
|
|
3726
|
+
type: "core::option::Option::<core::felt252>"
|
|
3727
|
+
},
|
|
3728
|
+
{
|
|
3729
|
+
name: "salt",
|
|
3730
|
+
type: "core::integer::u16"
|
|
3731
|
+
},
|
|
3732
|
+
{
|
|
3733
|
+
name: "metadata_value",
|
|
3734
|
+
type: "core::integer::u16"
|
|
3735
|
+
}
|
|
3736
|
+
],
|
|
3737
|
+
outputs: [
|
|
3738
|
+
{
|
|
3739
|
+
type: "core::array::Array::<core::felt252>"
|
|
3740
|
+
}
|
|
3741
|
+
],
|
|
3742
|
+
state_mutability: "external"
|
|
3743
|
+
},
|
|
3744
|
+
{
|
|
3745
|
+
type: "function",
|
|
3746
|
+
name: "ban_entry",
|
|
3747
|
+
inputs: [
|
|
3748
|
+
{
|
|
3749
|
+
name: "tournament_id",
|
|
3750
|
+
type: "core::integer::u64"
|
|
3751
|
+
},
|
|
3752
|
+
{
|
|
3753
|
+
name: "game_token_id",
|
|
3754
|
+
type: "core::felt252"
|
|
3755
|
+
},
|
|
3756
|
+
{
|
|
3757
|
+
name: "proof",
|
|
3758
|
+
type: "core::array::Span::<core::felt252>"
|
|
3759
|
+
}
|
|
3760
|
+
],
|
|
3761
|
+
outputs: [],
|
|
3762
|
+
state_mutability: "external"
|
|
3316
3763
|
},
|
|
3317
3764
|
{
|
|
3318
3765
|
type: "function",
|
|
@@ -3359,12 +3806,8 @@ var budokan_default = [
|
|
|
3359
3806
|
type: "core::integer::u64"
|
|
3360
3807
|
},
|
|
3361
3808
|
{
|
|
3362
|
-
name: "
|
|
3363
|
-
type: "
|
|
3364
|
-
},
|
|
3365
|
-
{
|
|
3366
|
-
name: "token_type",
|
|
3367
|
-
type: "game_components_interfaces::prize::TokenTypeData"
|
|
3809
|
+
name: "prize",
|
|
3810
|
+
type: "game_components_interfaces::prize::Prize"
|
|
3368
3811
|
},
|
|
3369
3812
|
{
|
|
3370
3813
|
name: "position",
|
|
@@ -3373,7 +3816,7 @@ var budokan_default = [
|
|
|
3373
3816
|
],
|
|
3374
3817
|
outputs: [
|
|
3375
3818
|
{
|
|
3376
|
-
type: "
|
|
3819
|
+
type: "core::integer::u64"
|
|
3377
3820
|
}
|
|
3378
3821
|
],
|
|
3379
3822
|
state_mutability: "external"
|
|
@@ -3547,6 +3990,14 @@ var budokan_default = [
|
|
|
3547
3990
|
{
|
|
3548
3991
|
name: "additional_shares",
|
|
3549
3992
|
type: "core::array::Span::<game_components_interfaces::entry_fee::AdditionalShare>"
|
|
3993
|
+
},
|
|
3994
|
+
{
|
|
3995
|
+
name: "distribution",
|
|
3996
|
+
type: "core::option::Option::<game_components_interfaces::distribution::Distribution>"
|
|
3997
|
+
},
|
|
3998
|
+
{
|
|
3999
|
+
name: "distribution_count",
|
|
4000
|
+
type: "core::integer::u32"
|
|
3550
4001
|
}
|
|
3551
4002
|
]
|
|
3552
4003
|
},
|
|
@@ -3656,6 +4107,28 @@ var budokan_default = [
|
|
|
3656
4107
|
name: "PrizeImpl",
|
|
3657
4108
|
interface_name: "game_components_interfaces::prize::IPrize"
|
|
3658
4109
|
},
|
|
4110
|
+
{
|
|
4111
|
+
type: "struct",
|
|
4112
|
+
name: "game_components_interfaces::prize::PrizeRecord",
|
|
4113
|
+
members: [
|
|
4114
|
+
{
|
|
4115
|
+
name: "id",
|
|
4116
|
+
type: "core::integer::u64"
|
|
4117
|
+
},
|
|
4118
|
+
{
|
|
4119
|
+
name: "context_id",
|
|
4120
|
+
type: "core::integer::u64"
|
|
4121
|
+
},
|
|
4122
|
+
{
|
|
4123
|
+
name: "sponsor_address",
|
|
4124
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
4125
|
+
},
|
|
4126
|
+
{
|
|
4127
|
+
name: "prize",
|
|
4128
|
+
type: "game_components_interfaces::prize::Prize"
|
|
4129
|
+
}
|
|
4130
|
+
]
|
|
4131
|
+
},
|
|
3659
4132
|
{
|
|
3660
4133
|
type: "interface",
|
|
3661
4134
|
name: "game_components_interfaces::prize::IPrize",
|
|
@@ -3671,7 +4144,7 @@ var budokan_default = [
|
|
|
3671
4144
|
],
|
|
3672
4145
|
outputs: [
|
|
3673
4146
|
{
|
|
3674
|
-
type: "game_components_interfaces::prize::
|
|
4147
|
+
type: "game_components_interfaces::prize::PrizeRecord"
|
|
3675
4148
|
}
|
|
3676
4149
|
],
|
|
3677
4150
|
state_mutability: "view"
|
|
@@ -3786,17 +4259,168 @@ var budokan_default = [
|
|
|
3786
4259
|
},
|
|
3787
4260
|
{
|
|
3788
4261
|
type: "function",
|
|
3789
|
-
name: "
|
|
4262
|
+
name: "is_token_banned",
|
|
4263
|
+
inputs: [
|
|
4264
|
+
{
|
|
4265
|
+
name: "token_id",
|
|
4266
|
+
type: "core::felt252"
|
|
4267
|
+
}
|
|
4268
|
+
],
|
|
4269
|
+
outputs: [
|
|
4270
|
+
{
|
|
4271
|
+
type: "core::bool"
|
|
4272
|
+
}
|
|
4273
|
+
],
|
|
4274
|
+
state_mutability: "view"
|
|
4275
|
+
},
|
|
4276
|
+
{
|
|
4277
|
+
type: "function",
|
|
4278
|
+
name: "get_entry_count",
|
|
4279
|
+
inputs: [
|
|
4280
|
+
{
|
|
4281
|
+
name: "context_id",
|
|
4282
|
+
type: "core::integer::u64"
|
|
4283
|
+
}
|
|
4284
|
+
],
|
|
4285
|
+
outputs: [
|
|
4286
|
+
{
|
|
4287
|
+
type: "core::integer::u32"
|
|
4288
|
+
}
|
|
4289
|
+
],
|
|
4290
|
+
state_mutability: "view"
|
|
4291
|
+
}
|
|
4292
|
+
]
|
|
4293
|
+
},
|
|
4294
|
+
{
|
|
4295
|
+
type: "impl",
|
|
4296
|
+
name: "LeaderboardImpl",
|
|
4297
|
+
interface_name: "game_components_interfaces::leaderboard::ILeaderboard"
|
|
4298
|
+
},
|
|
4299
|
+
{
|
|
4300
|
+
type: "struct",
|
|
4301
|
+
name: "game_components_interfaces::structs::leaderboard::LeaderboardEntry",
|
|
4302
|
+
members: [
|
|
4303
|
+
{
|
|
4304
|
+
name: "id",
|
|
4305
|
+
type: "core::felt252"
|
|
4306
|
+
},
|
|
4307
|
+
{
|
|
4308
|
+
name: "score",
|
|
4309
|
+
type: "core::integer::u64"
|
|
4310
|
+
}
|
|
4311
|
+
]
|
|
4312
|
+
},
|
|
4313
|
+
{
|
|
4314
|
+
type: "struct",
|
|
4315
|
+
name: "game_components_interfaces::structs::leaderboard::LeaderboardStoreConfig",
|
|
4316
|
+
members: [
|
|
4317
|
+
{
|
|
4318
|
+
name: "max_entries",
|
|
4319
|
+
type: "core::integer::u32"
|
|
4320
|
+
},
|
|
4321
|
+
{
|
|
4322
|
+
name: "ascending",
|
|
4323
|
+
type: "core::bool"
|
|
4324
|
+
},
|
|
4325
|
+
{
|
|
4326
|
+
name: "game_address",
|
|
4327
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
4328
|
+
}
|
|
4329
|
+
]
|
|
4330
|
+
},
|
|
4331
|
+
{
|
|
4332
|
+
type: "interface",
|
|
4333
|
+
name: "game_components_interfaces::leaderboard::ILeaderboard",
|
|
4334
|
+
items: [
|
|
4335
|
+
{
|
|
4336
|
+
type: "function",
|
|
4337
|
+
name: "get_leaderboard_entries",
|
|
4338
|
+
inputs: [
|
|
4339
|
+
{
|
|
4340
|
+
name: "context_id",
|
|
4341
|
+
type: "core::integer::u64"
|
|
4342
|
+
}
|
|
4343
|
+
],
|
|
4344
|
+
outputs: [
|
|
4345
|
+
{
|
|
4346
|
+
type: "core::array::Array::<game_components_interfaces::structs::leaderboard::LeaderboardEntry>"
|
|
4347
|
+
}
|
|
4348
|
+
],
|
|
4349
|
+
state_mutability: "view"
|
|
4350
|
+
},
|
|
4351
|
+
{
|
|
4352
|
+
type: "function",
|
|
4353
|
+
name: "get_leaderboard_entry",
|
|
3790
4354
|
inputs: [
|
|
3791
4355
|
{
|
|
3792
4356
|
name: "context_id",
|
|
3793
4357
|
type: "core::integer::u64"
|
|
3794
4358
|
},
|
|
3795
4359
|
{
|
|
3796
|
-
name: "
|
|
4360
|
+
name: "position",
|
|
3797
4361
|
type: "core::integer::u32"
|
|
3798
4362
|
}
|
|
3799
4363
|
],
|
|
4364
|
+
outputs: [
|
|
4365
|
+
{
|
|
4366
|
+
type: "game_components_interfaces::structs::leaderboard::LeaderboardEntry"
|
|
4367
|
+
}
|
|
4368
|
+
],
|
|
4369
|
+
state_mutability: "view"
|
|
4370
|
+
},
|
|
4371
|
+
{
|
|
4372
|
+
type: "function",
|
|
4373
|
+
name: "get_top_leaderboard_entries",
|
|
4374
|
+
inputs: [
|
|
4375
|
+
{
|
|
4376
|
+
name: "context_id",
|
|
4377
|
+
type: "core::integer::u64"
|
|
4378
|
+
},
|
|
4379
|
+
{
|
|
4380
|
+
name: "count",
|
|
4381
|
+
type: "core::integer::u32"
|
|
4382
|
+
}
|
|
4383
|
+
],
|
|
4384
|
+
outputs: [
|
|
4385
|
+
{
|
|
4386
|
+
type: "core::array::Array::<game_components_interfaces::structs::leaderboard::LeaderboardEntry>"
|
|
4387
|
+
}
|
|
4388
|
+
],
|
|
4389
|
+
state_mutability: "view"
|
|
4390
|
+
},
|
|
4391
|
+
{
|
|
4392
|
+
type: "function",
|
|
4393
|
+
name: "get_position",
|
|
4394
|
+
inputs: [
|
|
4395
|
+
{
|
|
4396
|
+
name: "context_id",
|
|
4397
|
+
type: "core::integer::u64"
|
|
4398
|
+
},
|
|
4399
|
+
{
|
|
4400
|
+
name: "token_id",
|
|
4401
|
+
type: "core::felt252"
|
|
4402
|
+
}
|
|
4403
|
+
],
|
|
4404
|
+
outputs: [
|
|
4405
|
+
{
|
|
4406
|
+
type: "core::option::Option::<core::integer::u32>"
|
|
4407
|
+
}
|
|
4408
|
+
],
|
|
4409
|
+
state_mutability: "view"
|
|
4410
|
+
},
|
|
4411
|
+
{
|
|
4412
|
+
type: "function",
|
|
4413
|
+
name: "qualifies",
|
|
4414
|
+
inputs: [
|
|
4415
|
+
{
|
|
4416
|
+
name: "context_id",
|
|
4417
|
+
type: "core::integer::u64"
|
|
4418
|
+
},
|
|
4419
|
+
{
|
|
4420
|
+
name: "score",
|
|
4421
|
+
type: "core::integer::u64"
|
|
4422
|
+
}
|
|
4423
|
+
],
|
|
3800
4424
|
outputs: [
|
|
3801
4425
|
{
|
|
3802
4426
|
type: "core::bool"
|
|
@@ -3806,7 +4430,23 @@ var budokan_default = [
|
|
|
3806
4430
|
},
|
|
3807
4431
|
{
|
|
3808
4432
|
type: "function",
|
|
3809
|
-
name: "
|
|
4433
|
+
name: "is_full",
|
|
4434
|
+
inputs: [
|
|
4435
|
+
{
|
|
4436
|
+
name: "context_id",
|
|
4437
|
+
type: "core::integer::u64"
|
|
4438
|
+
}
|
|
4439
|
+
],
|
|
4440
|
+
outputs: [
|
|
4441
|
+
{
|
|
4442
|
+
type: "core::bool"
|
|
4443
|
+
}
|
|
4444
|
+
],
|
|
4445
|
+
state_mutability: "view"
|
|
4446
|
+
},
|
|
4447
|
+
{
|
|
4448
|
+
type: "function",
|
|
4449
|
+
name: "get_leaderboard_length",
|
|
3810
4450
|
inputs: [
|
|
3811
4451
|
{
|
|
3812
4452
|
name: "context_id",
|
|
@@ -3819,6 +4459,46 @@ var budokan_default = [
|
|
|
3819
4459
|
}
|
|
3820
4460
|
],
|
|
3821
4461
|
state_mutability: "view"
|
|
4462
|
+
},
|
|
4463
|
+
{
|
|
4464
|
+
type: "function",
|
|
4465
|
+
name: "get_config",
|
|
4466
|
+
inputs: [
|
|
4467
|
+
{
|
|
4468
|
+
name: "context_id",
|
|
4469
|
+
type: "core::integer::u64"
|
|
4470
|
+
}
|
|
4471
|
+
],
|
|
4472
|
+
outputs: [
|
|
4473
|
+
{
|
|
4474
|
+
type: "game_components_interfaces::structs::leaderboard::LeaderboardStoreConfig"
|
|
4475
|
+
}
|
|
4476
|
+
],
|
|
4477
|
+
state_mutability: "view"
|
|
4478
|
+
},
|
|
4479
|
+
{
|
|
4480
|
+
type: "function",
|
|
4481
|
+
name: "find_position",
|
|
4482
|
+
inputs: [
|
|
4483
|
+
{
|
|
4484
|
+
name: "context_id",
|
|
4485
|
+
type: "core::integer::u64"
|
|
4486
|
+
},
|
|
4487
|
+
{
|
|
4488
|
+
name: "score",
|
|
4489
|
+
type: "core::integer::u64"
|
|
4490
|
+
},
|
|
4491
|
+
{
|
|
4492
|
+
name: "token_id",
|
|
4493
|
+
type: "core::felt252"
|
|
4494
|
+
}
|
|
4495
|
+
],
|
|
4496
|
+
outputs: [
|
|
4497
|
+
{
|
|
4498
|
+
type: "core::option::Option::<core::integer::u32>"
|
|
4499
|
+
}
|
|
4500
|
+
],
|
|
4501
|
+
state_mutability: "view"
|
|
3822
4502
|
}
|
|
3823
4503
|
]
|
|
3824
4504
|
},
|
|
@@ -3959,6 +4639,12 @@ var budokan_default = [
|
|
|
3959
4639
|
kind: "enum",
|
|
3960
4640
|
variants: []
|
|
3961
4641
|
},
|
|
4642
|
+
{
|
|
4643
|
+
type: "event",
|
|
4644
|
+
name: "openzeppelin_security::reentrancyguard::ReentrancyGuardComponent::Event",
|
|
4645
|
+
kind: "enum",
|
|
4646
|
+
variants: []
|
|
4647
|
+
},
|
|
3962
4648
|
{
|
|
3963
4649
|
type: "event",
|
|
3964
4650
|
name: "budokan::events::TournamentCreated",
|
|
@@ -3974,11 +4660,6 @@ var budokan_default = [
|
|
|
3974
4660
|
type: "core::starknet::contract_address::ContractAddress",
|
|
3975
4661
|
kind: "key"
|
|
3976
4662
|
},
|
|
3977
|
-
{
|
|
3978
|
-
name: "created_at",
|
|
3979
|
-
type: "core::integer::u64",
|
|
3980
|
-
kind: "data"
|
|
3981
|
-
},
|
|
3982
4663
|
{
|
|
3983
4664
|
name: "created_by",
|
|
3984
4665
|
type: "core::starknet::contract_address::ContractAddress",
|
|
@@ -3995,18 +4676,23 @@ var budokan_default = [
|
|
|
3995
4676
|
kind: "data"
|
|
3996
4677
|
},
|
|
3997
4678
|
{
|
|
3998
|
-
name: "
|
|
3999
|
-
type: "
|
|
4679
|
+
name: "config",
|
|
4680
|
+
type: "core::felt252",
|
|
4000
4681
|
kind: "data"
|
|
4001
4682
|
},
|
|
4002
4683
|
{
|
|
4003
|
-
name: "
|
|
4004
|
-
type: "
|
|
4684
|
+
name: "client_url",
|
|
4685
|
+
type: "core::option::Option::<core::byte_array::ByteArray>",
|
|
4686
|
+
kind: "data"
|
|
4687
|
+
},
|
|
4688
|
+
{
|
|
4689
|
+
name: "renderer",
|
|
4690
|
+
type: "core::option::Option::<core::starknet::contract_address::ContractAddress>",
|
|
4005
4691
|
kind: "data"
|
|
4006
4692
|
},
|
|
4007
4693
|
{
|
|
4008
4694
|
name: "entry_fee",
|
|
4009
|
-
type: "core::option::Option::<budokan_interfaces::budokan::
|
|
4695
|
+
type: "core::option::Option::<budokan_interfaces::budokan::EntryFeeKind>",
|
|
4010
4696
|
kind: "data"
|
|
4011
4697
|
},
|
|
4012
4698
|
{
|
|
@@ -4015,8 +4701,8 @@ var budokan_default = [
|
|
|
4015
4701
|
kind: "data"
|
|
4016
4702
|
},
|
|
4017
4703
|
{
|
|
4018
|
-
name: "
|
|
4019
|
-
type: "
|
|
4704
|
+
name: "protocol_fee_bps",
|
|
4705
|
+
type: "core::integer::u16",
|
|
4020
4706
|
kind: "data"
|
|
4021
4707
|
}
|
|
4022
4708
|
]
|
|
@@ -4036,36 +4722,21 @@ var budokan_default = [
|
|
|
4036
4722
|
type: "core::felt252",
|
|
4037
4723
|
kind: "key"
|
|
4038
4724
|
},
|
|
4039
|
-
{
|
|
4040
|
-
name: "game_address",
|
|
4041
|
-
type: "core::starknet::contract_address::ContractAddress",
|
|
4042
|
-
kind: "data"
|
|
4043
|
-
},
|
|
4044
4725
|
{
|
|
4045
4726
|
name: "player_address",
|
|
4046
4727
|
type: "core::starknet::contract_address::ContractAddress",
|
|
4047
4728
|
kind: "data"
|
|
4048
4729
|
},
|
|
4049
4730
|
{
|
|
4050
|
-
name: "entry_number",
|
|
4051
|
-
type: "core::integer::u32",
|
|
4052
|
-
kind: "data"
|
|
4053
|
-
},
|
|
4054
|
-
{
|
|
4055
|
-
name: "has_submitted",
|
|
4056
|
-
type: "core::bool",
|
|
4057
|
-
kind: "data"
|
|
4058
|
-
},
|
|
4059
|
-
{
|
|
4060
|
-
name: "is_banned",
|
|
4061
|
-
type: "core::bool",
|
|
4731
|
+
name: "entry_number",
|
|
4732
|
+
type: "core::integer::u32",
|
|
4062
4733
|
kind: "data"
|
|
4063
4734
|
}
|
|
4064
4735
|
]
|
|
4065
4736
|
},
|
|
4066
4737
|
{
|
|
4067
4738
|
type: "event",
|
|
4068
|
-
name: "budokan::events::
|
|
4739
|
+
name: "budokan::events::TournamentEntryStateChanged",
|
|
4069
4740
|
kind: "struct",
|
|
4070
4741
|
members: [
|
|
4071
4742
|
{
|
|
@@ -4074,8 +4745,18 @@ var budokan_default = [
|
|
|
4074
4745
|
kind: "key"
|
|
4075
4746
|
},
|
|
4076
4747
|
{
|
|
4077
|
-
name: "
|
|
4078
|
-
type: "core::
|
|
4748
|
+
name: "game_token_id",
|
|
4749
|
+
type: "core::felt252",
|
|
4750
|
+
kind: "key"
|
|
4751
|
+
},
|
|
4752
|
+
{
|
|
4753
|
+
name: "has_submitted",
|
|
4754
|
+
type: "core::bool",
|
|
4755
|
+
kind: "data"
|
|
4756
|
+
},
|
|
4757
|
+
{
|
|
4758
|
+
name: "is_banned",
|
|
4759
|
+
type: "core::bool",
|
|
4079
4760
|
kind: "data"
|
|
4080
4761
|
}
|
|
4081
4762
|
]
|
|
@@ -4101,13 +4782,8 @@ var budokan_default = [
|
|
|
4101
4782
|
kind: "data"
|
|
4102
4783
|
},
|
|
4103
4784
|
{
|
|
4104
|
-
name: "
|
|
4105
|
-
type: "
|
|
4106
|
-
kind: "data"
|
|
4107
|
-
},
|
|
4108
|
-
{
|
|
4109
|
-
name: "token_type",
|
|
4110
|
-
type: "game_components_interfaces::prize::TokenTypeData",
|
|
4785
|
+
name: "prize",
|
|
4786
|
+
type: "game_components_interfaces::prize::Prize",
|
|
4111
4787
|
kind: "data"
|
|
4112
4788
|
},
|
|
4113
4789
|
{
|
|
@@ -4216,6 +4892,11 @@ var budokan_default = [
|
|
|
4216
4892
|
type: "game_components_metagame::prize::prize_component::PrizeComponent::Event",
|
|
4217
4893
|
kind: "flat"
|
|
4218
4894
|
},
|
|
4895
|
+
{
|
|
4896
|
+
name: "ReentrancyGuardEvent",
|
|
4897
|
+
type: "openzeppelin_security::reentrancyguard::ReentrancyGuardComponent::Event",
|
|
4898
|
+
kind: "flat"
|
|
4899
|
+
},
|
|
4219
4900
|
{
|
|
4220
4901
|
name: "TournamentCreated",
|
|
4221
4902
|
type: "budokan::events::TournamentCreated",
|
|
@@ -4227,8 +4908,8 @@ var budokan_default = [
|
|
|
4227
4908
|
kind: "nested"
|
|
4228
4909
|
},
|
|
4229
4910
|
{
|
|
4230
|
-
name: "
|
|
4231
|
-
type: "budokan::events::
|
|
4911
|
+
name: "TournamentEntryStateChanged",
|
|
4912
|
+
type: "budokan::events::TournamentEntryStateChanged",
|
|
4232
4913
|
kind: "nested"
|
|
4233
4914
|
},
|
|
4234
4915
|
{
|
|
@@ -4245,6 +4926,108 @@ var budokan_default = [
|
|
|
4245
4926
|
name: "QualificationEntriesUpdated",
|
|
4246
4927
|
type: "budokan::events::QualificationEntriesUpdated",
|
|
4247
4928
|
kind: "nested"
|
|
4929
|
+
},
|
|
4930
|
+
{
|
|
4931
|
+
name: "ProtocolFeeBpsUpdated",
|
|
4932
|
+
type: "budokan::events::ProtocolFeeBpsUpdated",
|
|
4933
|
+
kind: "nested"
|
|
4934
|
+
},
|
|
4935
|
+
{
|
|
4936
|
+
name: "ProtocolFeeRecipientUpdated",
|
|
4937
|
+
type: "budokan::events::ProtocolFeeRecipientUpdated",
|
|
4938
|
+
kind: "nested"
|
|
4939
|
+
}
|
|
4940
|
+
]
|
|
4941
|
+
},
|
|
4942
|
+
{
|
|
4943
|
+
type: "interface",
|
|
4944
|
+
name: "budokan::budokan::Budokan::IBudokanProtocolFeeAdmin",
|
|
4945
|
+
items: [
|
|
4946
|
+
{
|
|
4947
|
+
type: "function",
|
|
4948
|
+
name: "set_protocol_fee_bps",
|
|
4949
|
+
inputs: [
|
|
4950
|
+
{
|
|
4951
|
+
name: "bps",
|
|
4952
|
+
type: "core::integer::u16"
|
|
4953
|
+
}
|
|
4954
|
+
],
|
|
4955
|
+
outputs: [],
|
|
4956
|
+
state_mutability: "external"
|
|
4957
|
+
},
|
|
4958
|
+
{
|
|
4959
|
+
type: "function",
|
|
4960
|
+
name: "set_protocol_fee_recipient",
|
|
4961
|
+
inputs: [
|
|
4962
|
+
{
|
|
4963
|
+
name: "recipient",
|
|
4964
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
4965
|
+
}
|
|
4966
|
+
],
|
|
4967
|
+
outputs: [],
|
|
4968
|
+
state_mutability: "external"
|
|
4969
|
+
},
|
|
4970
|
+
{
|
|
4971
|
+
type: "function",
|
|
4972
|
+
name: "protocol_fee_bps",
|
|
4973
|
+
inputs: [],
|
|
4974
|
+
outputs: [
|
|
4975
|
+
{
|
|
4976
|
+
type: "core::integer::u16"
|
|
4977
|
+
}
|
|
4978
|
+
],
|
|
4979
|
+
state_mutability: "view"
|
|
4980
|
+
},
|
|
4981
|
+
{
|
|
4982
|
+
type: "function",
|
|
4983
|
+
name: "protocol_fee_recipient",
|
|
4984
|
+
inputs: [],
|
|
4985
|
+
outputs: [
|
|
4986
|
+
{
|
|
4987
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
4988
|
+
}
|
|
4989
|
+
],
|
|
4990
|
+
state_mutability: "view"
|
|
4991
|
+
},
|
|
4992
|
+
{
|
|
4993
|
+
type: "function",
|
|
4994
|
+
name: "tournament_protocol_fee_bps",
|
|
4995
|
+
inputs: [
|
|
4996
|
+
{
|
|
4997
|
+
name: "tournament_id",
|
|
4998
|
+
type: "core::integer::u64"
|
|
4999
|
+
}
|
|
5000
|
+
],
|
|
5001
|
+
outputs: [
|
|
5002
|
+
{
|
|
5003
|
+
type: "core::integer::u16"
|
|
5004
|
+
}
|
|
5005
|
+
],
|
|
5006
|
+
state_mutability: "view"
|
|
5007
|
+
}
|
|
5008
|
+
]
|
|
5009
|
+
},
|
|
5010
|
+
{
|
|
5011
|
+
type: "event",
|
|
5012
|
+
name: "budokan::events::ProtocolFeeBpsUpdated",
|
|
5013
|
+
kind: "struct",
|
|
5014
|
+
members: [
|
|
5015
|
+
{
|
|
5016
|
+
name: "bps",
|
|
5017
|
+
type: "core::integer::u16",
|
|
5018
|
+
kind: "data"
|
|
5019
|
+
}
|
|
5020
|
+
]
|
|
5021
|
+
},
|
|
5022
|
+
{
|
|
5023
|
+
type: "event",
|
|
5024
|
+
name: "budokan::events::ProtocolFeeRecipientUpdated",
|
|
5025
|
+
kind: "struct",
|
|
5026
|
+
members: [
|
|
5027
|
+
{
|
|
5028
|
+
name: "recipient",
|
|
5029
|
+
type: "core::starknet::contract_address::ContractAddress",
|
|
5030
|
+
kind: "key"
|
|
4248
5031
|
}
|
|
4249
5032
|
]
|
|
4250
5033
|
}
|
|
@@ -4396,6 +5179,7 @@ var BudokanClient = class {
|
|
|
4396
5179
|
if (prizes.length === 0) return t;
|
|
4397
5180
|
const tokenMap = /* @__PURE__ */ new Map();
|
|
4398
5181
|
for (const p of prizes) {
|
|
5182
|
+
if (p.tokenType === "extension" || p.tokenAddress == null) continue;
|
|
4399
5183
|
const key = p.tokenAddress;
|
|
4400
5184
|
const existing = tokenMap.get(key);
|
|
4401
5185
|
if (existing) {
|
|
@@ -4711,6 +5495,683 @@ function createBudokanClient(config) {
|
|
|
4711
5495
|
return new BudokanClient(config);
|
|
4712
5496
|
}
|
|
4713
5497
|
|
|
5498
|
+
// src/utils/prizes.ts
|
|
5499
|
+
function isNonEmptyString(value) {
|
|
5500
|
+
return typeof value === "string" && value.length > 0;
|
|
5501
|
+
}
|
|
5502
|
+
function isNonNegativeIntegerString(value) {
|
|
5503
|
+
if (!isNonEmptyString(value) || value.trim() !== value) return false;
|
|
5504
|
+
if (!/^\d+$/.test(value)) return false;
|
|
5505
|
+
try {
|
|
5506
|
+
return BigInt(value) >= 0n;
|
|
5507
|
+
} catch {
|
|
5508
|
+
return false;
|
|
5509
|
+
}
|
|
5510
|
+
}
|
|
5511
|
+
function isNonNegativeIntegerNumber(value) {
|
|
5512
|
+
return typeof value === "number" && Number.isInteger(value) && value >= 0;
|
|
5513
|
+
}
|
|
5514
|
+
function isPositiveIntegerNumber(value) {
|
|
5515
|
+
return typeof value === "number" && Number.isInteger(value) && value > 0;
|
|
5516
|
+
}
|
|
5517
|
+
function isDistributionType(value) {
|
|
5518
|
+
return value === "linear" || value === "exponential" || value === "uniform" || value === "custom";
|
|
5519
|
+
}
|
|
5520
|
+
function hasNoDistributionFields(prize) {
|
|
5521
|
+
return prize.distributionType === null && prize.distributionWeight === null && prize.distributionShares === null && prize.distributionCount === null;
|
|
5522
|
+
}
|
|
5523
|
+
function hasValidDistributionFields(prize) {
|
|
5524
|
+
if (prize.distributionType === null) return hasNoDistributionFields(prize);
|
|
5525
|
+
if (!isDistributionType(prize.distributionType)) return false;
|
|
5526
|
+
if (!isPositiveIntegerNumber(prize.distributionCount)) return false;
|
|
5527
|
+
if (prize.distributionType === "custom") {
|
|
5528
|
+
return prize.distributionWeight === null && Array.isArray(prize.distributionShares) && prize.distributionShares.length === prize.distributionCount && prize.distributionShares.every(isNonNegativeIntegerNumber) && prize.distributionShares.reduce((sum, share) => sum + share, 0) === 1e4;
|
|
5529
|
+
}
|
|
5530
|
+
if (prize.distributionType === "uniform") {
|
|
5531
|
+
return prize.distributionWeight === null && prize.distributionShares === null;
|
|
5532
|
+
}
|
|
5533
|
+
return isNonNegativeIntegerNumber(prize.distributionWeight) && prize.distributionShares === null;
|
|
5534
|
+
}
|
|
5535
|
+
function hasBasePrizeFields(prize) {
|
|
5536
|
+
return isNonNegativeIntegerString(prize.prizeId) && isNonNegativeIntegerString(prize.tournamentId) && Number.isInteger(prize.payoutPosition) && prize.payoutPosition >= 0 && isNonEmptyString(prize.sponsorAddress);
|
|
5537
|
+
}
|
|
5538
|
+
function hasExtensionConfig(value) {
|
|
5539
|
+
return value === null || Array.isArray(value) && value.every((entry) => typeof entry === "string");
|
|
5540
|
+
}
|
|
5541
|
+
function describePrize(prize) {
|
|
5542
|
+
const prizeId = isNonEmptyString(prize.prizeId) ? prize.prizeId : "<invalid>";
|
|
5543
|
+
return `prizeId=${prizeId}, tokenType=${prize.tokenType}`;
|
|
5544
|
+
}
|
|
5545
|
+
function malformedTokenPrizeError(action, prize) {
|
|
5546
|
+
return new TypeError(
|
|
5547
|
+
`Cannot ${action} malformed Budokan token prize (${describePrize(prize)})`
|
|
5548
|
+
);
|
|
5549
|
+
}
|
|
5550
|
+
function malformedExtensionPrizeError(action, prize) {
|
|
5551
|
+
return new TypeError(
|
|
5552
|
+
`Cannot ${action} malformed Budokan extension prize (${describePrize(prize)})`
|
|
5553
|
+
);
|
|
5554
|
+
}
|
|
5555
|
+
function assertMetagameTokenPosition(prize) {
|
|
5556
|
+
if (Number.isInteger(prize.payoutPosition) && prize.payoutPosition > 0) {
|
|
5557
|
+
return;
|
|
5558
|
+
}
|
|
5559
|
+
if (prize.payoutPosition !== 0) {
|
|
5560
|
+
throw new TypeError(
|
|
5561
|
+
`Cannot adapt Budokan token prize with invalid payout position (${describePrize(prize)})`
|
|
5562
|
+
);
|
|
5563
|
+
}
|
|
5564
|
+
throw new TypeError(
|
|
5565
|
+
`Cannot adapt Budokan token prize with unhydrated payout position (${describePrize(prize)})`
|
|
5566
|
+
);
|
|
5567
|
+
}
|
|
5568
|
+
function assertMetagameExtensionPosition(prize) {
|
|
5569
|
+
if (Number.isInteger(prize.payoutPosition) && prize.payoutPosition > 0) {
|
|
5570
|
+
return;
|
|
5571
|
+
}
|
|
5572
|
+
if (prize.payoutPosition !== 0) {
|
|
5573
|
+
throw new TypeError(
|
|
5574
|
+
`Cannot adapt Budokan extension prize with invalid payout position (${describePrize(prize)})`
|
|
5575
|
+
);
|
|
5576
|
+
}
|
|
5577
|
+
throw new TypeError(
|
|
5578
|
+
`Cannot adapt Budokan extension prize with unhydrated payout position (${describePrize(prize)})`
|
|
5579
|
+
);
|
|
5580
|
+
}
|
|
5581
|
+
function hasHydratedPayoutPosition(prize) {
|
|
5582
|
+
return prize.payoutPosition > 0;
|
|
5583
|
+
}
|
|
5584
|
+
function isRawTokenPrize(prize) {
|
|
5585
|
+
if (!hasBasePrizeFields(prize) || !isNonEmptyString(prize.tokenAddress)) {
|
|
5586
|
+
return false;
|
|
5587
|
+
}
|
|
5588
|
+
return prize.tokenType === "erc20" ? isNonNegativeIntegerString(prize.amount) && prize.tokenId === null && prize.extensionAddress === null && prize.extensionConfig === null && hasValidDistributionFields(prize) : prize.tokenType === "erc721" && prize.amount === null && isNonNegativeIntegerString(prize.tokenId) && prize.extensionAddress === null && prize.extensionConfig === null && hasNoDistributionFields(prize);
|
|
5589
|
+
}
|
|
5590
|
+
function isRawExtensionPrize(prize) {
|
|
5591
|
+
return hasBasePrizeFields(prize) && prize.tokenType === "extension" && prize.tokenAddress === null && prize.amount === null && prize.tokenId === null && hasNoDistributionFields(prize) && isNonEmptyString(prize.extensionAddress) && hasExtensionConfig(prize.extensionConfig);
|
|
5592
|
+
}
|
|
5593
|
+
function isTokenPrize(prize) {
|
|
5594
|
+
return isRawTokenPrize(prize) && hasHydratedPayoutPosition(prize);
|
|
5595
|
+
}
|
|
5596
|
+
function isExtensionPrize(prize) {
|
|
5597
|
+
return isRawExtensionPrize(prize) && hasHydratedPayoutPosition(prize);
|
|
5598
|
+
}
|
|
5599
|
+
function isMetagameAdaptablePrize(prize) {
|
|
5600
|
+
return isTokenPrize(prize) || isExtensionPrize(prize);
|
|
5601
|
+
}
|
|
5602
|
+
function getRawTokenPrizes(prizes) {
|
|
5603
|
+
return prizes.flatMap((prize) => {
|
|
5604
|
+
if (isRawTokenPrize(prize)) return [prize];
|
|
5605
|
+
if (prize.tokenType === "extension") return [];
|
|
5606
|
+
throw malformedTokenPrizeError("read", prize);
|
|
5607
|
+
});
|
|
5608
|
+
}
|
|
5609
|
+
function getTokenPrizes(prizes) {
|
|
5610
|
+
return prizes.flatMap((prize) => {
|
|
5611
|
+
if (isTokenPrize(prize)) return [prize];
|
|
5612
|
+
if (isRawTokenPrize(prize) || prize.tokenType === "extension") return [];
|
|
5613
|
+
throw malformedTokenPrizeError("read", prize);
|
|
5614
|
+
});
|
|
5615
|
+
}
|
|
5616
|
+
function toMetagameTokenPrize(prize) {
|
|
5617
|
+
assertMetagameTokenPosition(prize);
|
|
5618
|
+
if (!isRawTokenPrize(prize)) {
|
|
5619
|
+
throw malformedTokenPrizeError("adapt", prize);
|
|
5620
|
+
}
|
|
5621
|
+
const adapted = {
|
|
5622
|
+
id: prize.prizeId,
|
|
5623
|
+
position: prize.payoutPosition,
|
|
5624
|
+
tokenAddress: prize.tokenAddress,
|
|
5625
|
+
tokenType: prize.tokenType,
|
|
5626
|
+
// Metagame token prizes use `amount` as the token id for ERC721 entries.
|
|
5627
|
+
amount: prize.tokenType === "erc20" ? prize.amount : prize.tokenId,
|
|
5628
|
+
sponsorAddress: prize.sponsorAddress
|
|
5629
|
+
};
|
|
5630
|
+
return adapted;
|
|
5631
|
+
}
|
|
5632
|
+
function toMetagameExtensionPrize(prize) {
|
|
5633
|
+
assertMetagameExtensionPosition(prize);
|
|
5634
|
+
if (!isRawExtensionPrize(prize)) {
|
|
5635
|
+
throw malformedExtensionPrizeError("adapt", prize);
|
|
5636
|
+
}
|
|
5637
|
+
const adapted = {
|
|
5638
|
+
id: prize.prizeId,
|
|
5639
|
+
position: prize.payoutPosition,
|
|
5640
|
+
tokenAddress: null,
|
|
5641
|
+
tokenType: "extension",
|
|
5642
|
+
amount: null,
|
|
5643
|
+
sponsorAddress: prize.sponsorAddress,
|
|
5644
|
+
extensionAddress: prize.extensionAddress,
|
|
5645
|
+
extensionConfig: prize.extensionConfig
|
|
5646
|
+
};
|
|
5647
|
+
return adapted;
|
|
5648
|
+
}
|
|
5649
|
+
function toMetagamePrize(prize) {
|
|
5650
|
+
if (isRawTokenPrize(prize)) return toMetagameTokenPrize(prize);
|
|
5651
|
+
if (isRawExtensionPrize(prize)) return toMetagameExtensionPrize(prize);
|
|
5652
|
+
throw new TypeError(
|
|
5653
|
+
`Cannot adapt malformed Budokan prize (${describePrize(prize)})`
|
|
5654
|
+
);
|
|
5655
|
+
}
|
|
5656
|
+
function tryToMetagamePrize(prize) {
|
|
5657
|
+
if (!isMetagameAdaptablePrize(prize)) return null;
|
|
5658
|
+
return prize.tokenType === "extension" ? toMetagameExtensionPrize(prize) : toMetagameTokenPrize(prize);
|
|
5659
|
+
}
|
|
5660
|
+
function toMetagamePrizes(prizes) {
|
|
5661
|
+
return prizes.map(toMetagamePrize);
|
|
5662
|
+
}
|
|
5663
|
+
function tryToMetagamePrizes(prizes) {
|
|
5664
|
+
return prizes.flatMap((prize) => {
|
|
5665
|
+
const adapted = tryToMetagamePrize(prize);
|
|
5666
|
+
return adapted ? [adapted] : [];
|
|
5667
|
+
});
|
|
5668
|
+
}
|
|
5669
|
+
function toMetagameTokenPrizes(prizes) {
|
|
5670
|
+
return prizes.flatMap((prize) => {
|
|
5671
|
+
if (isRawTokenPrize(prize)) return [toMetagameTokenPrize(prize)];
|
|
5672
|
+
if (prize.tokenType === "extension") return [];
|
|
5673
|
+
throw malformedTokenPrizeError("adapt", prize);
|
|
5674
|
+
});
|
|
5675
|
+
}
|
|
5676
|
+
|
|
5677
|
+
// src/games/whitelist.ts
|
|
5678
|
+
var STRK = "0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d";
|
|
5679
|
+
var MAINNET_GAMES_RAW = [
|
|
5680
|
+
{
|
|
5681
|
+
contractAddress: "0x4de0351ceab4ecd50be6ee09329b0dcb3b96a9da88cc158f453823a389722fa",
|
|
5682
|
+
name: "Death Mountain",
|
|
5683
|
+
url: "https://deathmountain.gg/",
|
|
5684
|
+
playUrl: "https://deathmountain.gg/play?id=",
|
|
5685
|
+
watchLink: "https://deathmountain.gg/watch?id=",
|
|
5686
|
+
replayLink: "https://deathmountain.gg/replay?id=",
|
|
5687
|
+
controllerOnly: true,
|
|
5688
|
+
minEntryFeeUsd: 0.25,
|
|
5689
|
+
defaultEntryFeeToken: STRK,
|
|
5690
|
+
defaultGameFeePercentage: 5,
|
|
5691
|
+
averageGasCostUsd: 0.25
|
|
5692
|
+
},
|
|
5693
|
+
{
|
|
5694
|
+
contractAddress: "0x642f228f70b1ca7edb4ab7ff0bab067369c2e276ddc2570ca18802d4e758edc",
|
|
5695
|
+
name: "zKube",
|
|
5696
|
+
imageUrl: "https://zkube-budokan-sepolia.vercel.app/assets/logo.png",
|
|
5697
|
+
url: "https://zkube.io",
|
|
5698
|
+
playUrl: "https://zkube.io/play/",
|
|
5699
|
+
minEntryFeeUsd: 0.25,
|
|
5700
|
+
defaultEntryFeeToken: STRK
|
|
5701
|
+
}
|
|
5702
|
+
];
|
|
5703
|
+
var SEPOLIA_GAMES_RAW = [
|
|
5704
|
+
{
|
|
5705
|
+
contractAddress: "0x04359aee29873cd9603207d29b4140468bac3e042aa10daab2e1a8b2dd60ef7b",
|
|
5706
|
+
name: "Dark Shuffle",
|
|
5707
|
+
imageUrl: "https://darkshuffle.dev/favicon.svg",
|
|
5708
|
+
url: "https://darkshuffle.dev",
|
|
5709
|
+
controllerOnly: true,
|
|
5710
|
+
minEntryFeeUsd: 0.25,
|
|
5711
|
+
defaultEntryFeeToken: STRK
|
|
5712
|
+
},
|
|
5713
|
+
{
|
|
5714
|
+
contractAddress: "0x07ae26eecf0274aabb31677753ff3a4e15beec7268fa1b104f73ce3c89202831",
|
|
5715
|
+
name: "Death Mountain",
|
|
5716
|
+
imageUrl: "https://darkshuffle.dev/favicon.svg",
|
|
5717
|
+
url: "https://lootsurvivor.io/",
|
|
5718
|
+
playUrl: "https://lootsurvivor.io/survivor/play?id=",
|
|
5719
|
+
controllerOnly: true,
|
|
5720
|
+
minEntryFeeUsd: 0.25,
|
|
5721
|
+
defaultEntryFeeToken: STRK
|
|
5722
|
+
},
|
|
5723
|
+
{
|
|
5724
|
+
contractAddress: "0x012ccc9a2d76c836d088203f6e9d62e22d1a9f7479d1aea8b503a1036c0f4487",
|
|
5725
|
+
name: "Nums",
|
|
5726
|
+
url: "https://nums-blond.vercel.app/",
|
|
5727
|
+
playUrl: "https://nums-blond.vercel.app/",
|
|
5728
|
+
controllerOnly: true,
|
|
5729
|
+
minEntryFeeUsd: 0.25,
|
|
5730
|
+
defaultEntryFeeToken: STRK
|
|
5731
|
+
},
|
|
5732
|
+
{
|
|
5733
|
+
contractAddress: "0x3a2ea07f0f49c770035eed9a010eb3d1e1bc3cb92e1d47eef2ad75a25c6bdb2",
|
|
5734
|
+
name: "Number Guess",
|
|
5735
|
+
url: "https://funfactory.gg/games/1",
|
|
5736
|
+
playUrl: "https://funfactory.gg/tokens/{tokenId}/play",
|
|
5737
|
+
controllerOnly: true,
|
|
5738
|
+
minEntryFeeUsd: 0.25,
|
|
5739
|
+
defaultEntryFeeToken: STRK,
|
|
5740
|
+
objectImage: true
|
|
5741
|
+
},
|
|
5742
|
+
{
|
|
5743
|
+
contractAddress: "0x5e02a1f750b3fa0e835d454705b664ecb23166cdb49459b1c96c1e3eaf9a2f4",
|
|
5744
|
+
name: "zKube",
|
|
5745
|
+
imageUrl: "https://zkube-budokan-sepolia.vercel.app/assets/logo.png",
|
|
5746
|
+
url: "https://zkube-budokan-sepolia.vercel.app",
|
|
5747
|
+
playUrl: "https://zkube-budokan-sepolia.vercel.app/play/",
|
|
5748
|
+
controllerOnly: true,
|
|
5749
|
+
minEntryFeeUsd: 0.25,
|
|
5750
|
+
defaultEntryFeeToken: STRK
|
|
5751
|
+
}
|
|
5752
|
+
];
|
|
5753
|
+
var MAINNET_GAMES = MAINNET_GAMES_RAW.map(canonicalize);
|
|
5754
|
+
var SEPOLIA_GAMES = SEPOLIA_GAMES_RAW.map(canonicalize);
|
|
5755
|
+
function canonicalize(game) {
|
|
5756
|
+
return {
|
|
5757
|
+
...game,
|
|
5758
|
+
contractAddress: normalizeAddress(game.contractAddress),
|
|
5759
|
+
defaultEntryFeeToken: game.defaultEntryFeeToken ? normalizeAddress(game.defaultEntryFeeToken) : void 0
|
|
5760
|
+
};
|
|
5761
|
+
}
|
|
5762
|
+
function getWhitelistedGames(chain) {
|
|
5763
|
+
const list = chain === "mainnet" ? MAINNET_GAMES : SEPOLIA_GAMES;
|
|
5764
|
+
return list.map((g) => ({ ...g })).sort((a, b) => {
|
|
5765
|
+
const aDisabled = a.disabled ?? false;
|
|
5766
|
+
const bDisabled = b.disabled ?? false;
|
|
5767
|
+
if (aDisabled !== bDisabled) return aDisabled ? 1 : -1;
|
|
5768
|
+
return a.name.localeCompare(b.name);
|
|
5769
|
+
});
|
|
5770
|
+
}
|
|
5771
|
+
function findWhitelistedGame(chain, contractAddress) {
|
|
5772
|
+
const target = normalizeAddress(contractAddress);
|
|
5773
|
+
return getWhitelistedGames(chain).find((g) => g.contractAddress === target);
|
|
5774
|
+
}
|
|
5775
|
+
function isGameWhitelisted(chain, contractAddress) {
|
|
5776
|
+
return findWhitelistedGame(chain, contractAddress) !== void 0;
|
|
5777
|
+
}
|
|
5778
|
+
function getGameDefaults(chain, contractAddress) {
|
|
5779
|
+
const game = findWhitelistedGame(chain, contractAddress);
|
|
5780
|
+
return {
|
|
5781
|
+
minEntryFeeUsd: game?.minEntryFeeUsd ?? 0.25,
|
|
5782
|
+
defaultEntryFeeToken: game?.defaultEntryFeeToken ?? STRK,
|
|
5783
|
+
defaultGameFeePercentage: game?.defaultGameFeePercentage ?? 1,
|
|
5784
|
+
averageGasCostUsd: game?.averageGasCostUsd,
|
|
5785
|
+
leaderboardAscending: game?.leaderboardAscending ?? false,
|
|
5786
|
+
leaderboardGameMustBeOver: game?.leaderboardGameMustBeOver ?? false
|
|
5787
|
+
};
|
|
5788
|
+
}
|
|
5789
|
+
function buildErc20ApproveCall(tokenAddress, spender, amount) {
|
|
5790
|
+
return {
|
|
5791
|
+
contractAddress: tokenAddress,
|
|
5792
|
+
entrypoint: "approve",
|
|
5793
|
+
calldata: starknet.CallData.compile([spender, starknet.uint256.bnToUint256(amount)])
|
|
5794
|
+
};
|
|
5795
|
+
}
|
|
5796
|
+
function buildEnterTournamentCall(budokanAddress, args) {
|
|
5797
|
+
const calldata = [
|
|
5798
|
+
starknet.num.toHex(args.tournamentId)
|
|
5799
|
+
// tournament_id u64
|
|
5800
|
+
];
|
|
5801
|
+
if (args.playerName) {
|
|
5802
|
+
calldata.push("0x0", felt252FromShortString(args.playerName));
|
|
5803
|
+
} else {
|
|
5804
|
+
calldata.push("0x1");
|
|
5805
|
+
}
|
|
5806
|
+
if (args.playerAddress) {
|
|
5807
|
+
calldata.push("0x0", args.playerAddress);
|
|
5808
|
+
} else {
|
|
5809
|
+
calldata.push("0x1");
|
|
5810
|
+
}
|
|
5811
|
+
if (args.qualifier) {
|
|
5812
|
+
calldata.push("0x0", args.qualifier);
|
|
5813
|
+
} else {
|
|
5814
|
+
calldata.push("0x1");
|
|
5815
|
+
}
|
|
5816
|
+
calldata.push("0x1");
|
|
5817
|
+
if (args.entryFeePayParams && args.entryFeePayParams.length > 0) {
|
|
5818
|
+
calldata.push(
|
|
5819
|
+
"0x0",
|
|
5820
|
+
starknet.num.toHex(args.entryFeePayParams.length),
|
|
5821
|
+
...args.entryFeePayParams
|
|
5822
|
+
);
|
|
5823
|
+
} else {
|
|
5824
|
+
calldata.push("0x1");
|
|
5825
|
+
}
|
|
5826
|
+
calldata.push(starknet.num.toHex(args.salt ?? 0));
|
|
5827
|
+
calldata.push(starknet.num.toHex(args.metadataValue ?? 0));
|
|
5828
|
+
return {
|
|
5829
|
+
contractAddress: budokanAddress,
|
|
5830
|
+
entrypoint: "enter_tournament",
|
|
5831
|
+
calldata
|
|
5832
|
+
};
|
|
5833
|
+
}
|
|
5834
|
+
function buildSubmitScoreCall(budokanAddress, args) {
|
|
5835
|
+
return {
|
|
5836
|
+
contractAddress: budokanAddress,
|
|
5837
|
+
entrypoint: "submit_score",
|
|
5838
|
+
calldata: starknet.CallData.compile([args.tournamentId, args.tokenId, args.position])
|
|
5839
|
+
};
|
|
5840
|
+
}
|
|
5841
|
+
function buildClaimRewardCall(budokanAddress, args) {
|
|
5842
|
+
const calldata = [starknet.num.toHex(args.tournamentId)];
|
|
5843
|
+
pushRewardTypeFelts(calldata, args.reward);
|
|
5844
|
+
return {
|
|
5845
|
+
contractAddress: budokanAddress,
|
|
5846
|
+
entrypoint: "claim_reward",
|
|
5847
|
+
calldata
|
|
5848
|
+
};
|
|
5849
|
+
}
|
|
5850
|
+
function buildCreateTournamentCall(budokanAddress, args) {
|
|
5851
|
+
const calldata = starknet.CallData.compile({
|
|
5852
|
+
creator_rewards_address: args.creatorRewardsAddress,
|
|
5853
|
+
metadata: {
|
|
5854
|
+
// name is a felt252 (≤31 ASCII bytes). starknet.js packs short
|
|
5855
|
+
// ASCII strings into a single felt automatically.
|
|
5856
|
+
name: args.name,
|
|
5857
|
+
// description is a Cairo ByteArray (multi-felt: data words +
|
|
5858
|
+
// pending word + pending word length). A plain JS string serializes
|
|
5859
|
+
// to a single felt and the deserializer reverts — wrap explicitly.
|
|
5860
|
+
description: starknet.byteArray.byteArrayFromString(args.description)
|
|
5861
|
+
},
|
|
5862
|
+
schedule: {
|
|
5863
|
+
registration_start_delay: args.schedule.registrationStartDelay,
|
|
5864
|
+
registration_end_delay: args.schedule.registrationEndDelay,
|
|
5865
|
+
game_start_delay: args.schedule.gameStartDelay,
|
|
5866
|
+
game_end_delay: args.schedule.gameEndDelay,
|
|
5867
|
+
submission_duration: args.schedule.submissionDuration
|
|
5868
|
+
},
|
|
5869
|
+
game_config: {
|
|
5870
|
+
game_address: args.gameAddress,
|
|
5871
|
+
settings_id: args.settingsId,
|
|
5872
|
+
soulbound: false,
|
|
5873
|
+
paymaster: false,
|
|
5874
|
+
// Options must be CairoOption — see file header for why.
|
|
5875
|
+
client_url: new starknet.CairoOption(starknet.CairoOptionVariant.None),
|
|
5876
|
+
renderer: new starknet.CairoOption(starknet.CairoOptionVariant.None)
|
|
5877
|
+
},
|
|
5878
|
+
entry_fee: encodeEntryFeeOption(args.entryFee),
|
|
5879
|
+
entry_requirement: encodeEntryRequirementOption(args.entryRequirement),
|
|
5880
|
+
leaderboard_config: {
|
|
5881
|
+
ascending: args.leaderboard.ascending,
|
|
5882
|
+
game_must_be_over: args.leaderboard.gameMustBeOver
|
|
5883
|
+
},
|
|
5884
|
+
salt: args.salt ?? 0,
|
|
5885
|
+
metadata_value: args.metadataValue ?? 0
|
|
5886
|
+
});
|
|
5887
|
+
return {
|
|
5888
|
+
contractAddress: budokanAddress,
|
|
5889
|
+
entrypoint: "create_tournament",
|
|
5890
|
+
calldata
|
|
5891
|
+
};
|
|
5892
|
+
}
|
|
5893
|
+
function buildAddPrizeCall(budokanAddress, args) {
|
|
5894
|
+
const prize = encodePrize(args.prize);
|
|
5895
|
+
const position = args.prize.kind === "token" && args.prize.position !== void 0 ? new starknet.CairoOption(starknet.CairoOptionVariant.Some, args.prize.position) : new starknet.CairoOption(starknet.CairoOptionVariant.None);
|
|
5896
|
+
const calldata = starknet.CallData.compile({
|
|
5897
|
+
tournament_id: args.tournamentId,
|
|
5898
|
+
prize,
|
|
5899
|
+
position
|
|
5900
|
+
});
|
|
5901
|
+
return {
|
|
5902
|
+
contractAddress: budokanAddress,
|
|
5903
|
+
entrypoint: "add_prize",
|
|
5904
|
+
calldata
|
|
5905
|
+
};
|
|
5906
|
+
}
|
|
5907
|
+
function encodePrize(spec) {
|
|
5908
|
+
if (spec.kind === "token") {
|
|
5909
|
+
return new starknet.CairoCustomEnum({
|
|
5910
|
+
Token: {
|
|
5911
|
+
token_address: spec.tokenAddress,
|
|
5912
|
+
token_type: encodeTokenType(spec.tokenType)
|
|
5913
|
+
},
|
|
5914
|
+
Extension: void 0
|
|
5915
|
+
});
|
|
5916
|
+
}
|
|
5917
|
+
return new starknet.CairoCustomEnum({
|
|
5918
|
+
Token: void 0,
|
|
5919
|
+
Extension: {
|
|
5920
|
+
address: spec.address,
|
|
5921
|
+
config: spec.config
|
|
5922
|
+
}
|
|
5923
|
+
});
|
|
5924
|
+
}
|
|
5925
|
+
function encodeTokenType(spec) {
|
|
5926
|
+
if (spec.kind === "erc20") {
|
|
5927
|
+
if (spec.distribution && spec.distributionCount === void 0) {
|
|
5928
|
+
throw new Error(
|
|
5929
|
+
"TokenTypeSpec.erc20: distributionCount is required when distribution is set"
|
|
5930
|
+
);
|
|
5931
|
+
}
|
|
5932
|
+
const distribution = spec.distribution ? new starknet.CairoOption(
|
|
5933
|
+
starknet.CairoOptionVariant.Some,
|
|
5934
|
+
encodeDistribution(spec.distribution)
|
|
5935
|
+
) : new starknet.CairoOption(starknet.CairoOptionVariant.None);
|
|
5936
|
+
const distributionCount = spec.distribution && spec.distributionCount !== void 0 ? new starknet.CairoOption(
|
|
5937
|
+
starknet.CairoOptionVariant.Some,
|
|
5938
|
+
spec.distributionCount
|
|
5939
|
+
) : new starknet.CairoOption(starknet.CairoOptionVariant.None);
|
|
5940
|
+
return new starknet.CairoCustomEnum({
|
|
5941
|
+
erc20: {
|
|
5942
|
+
amount: spec.amount,
|
|
5943
|
+
distribution,
|
|
5944
|
+
distribution_count: distributionCount
|
|
5945
|
+
},
|
|
5946
|
+
erc721: void 0
|
|
5947
|
+
});
|
|
5948
|
+
}
|
|
5949
|
+
return new starknet.CairoCustomEnum({
|
|
5950
|
+
erc20: void 0,
|
|
5951
|
+
erc721: { id: spec.tokenId }
|
|
5952
|
+
});
|
|
5953
|
+
}
|
|
5954
|
+
function encodeEntryFeeOption(fee) {
|
|
5955
|
+
if (!fee) return new starknet.CairoOption(starknet.CairoOptionVariant.None);
|
|
5956
|
+
const builtIn = {
|
|
5957
|
+
token_address: fee.tokenAddress,
|
|
5958
|
+
amount: fee.amount,
|
|
5959
|
+
tournament_creator_share: fee.tournamentCreatorShare,
|
|
5960
|
+
game_creator_share: fee.gameCreatorShare,
|
|
5961
|
+
refund_share: fee.refundShare,
|
|
5962
|
+
distribution: encodeDistribution(fee.distribution),
|
|
5963
|
+
distribution_count: fee.distributionCount
|
|
5964
|
+
};
|
|
5965
|
+
return new starknet.CairoOption(
|
|
5966
|
+
starknet.CairoOptionVariant.Some,
|
|
5967
|
+
new starknet.CairoCustomEnum({ BuiltIn: builtIn, Extension: void 0 })
|
|
5968
|
+
);
|
|
5969
|
+
}
|
|
5970
|
+
function encodeEntryRequirementOption(req) {
|
|
5971
|
+
if (!req)
|
|
5972
|
+
return new starknet.CairoOption(starknet.CairoOptionVariant.None);
|
|
5973
|
+
return new starknet.CairoOption(starknet.CairoOptionVariant.Some, {
|
|
5974
|
+
entry_limit: req.entryLimit,
|
|
5975
|
+
entry_requirement_type: encodeEntryRequirementType(req.type)
|
|
5976
|
+
});
|
|
5977
|
+
}
|
|
5978
|
+
function encodeEntryRequirementType(spec) {
|
|
5979
|
+
if (spec.kind === "token") {
|
|
5980
|
+
return new starknet.CairoCustomEnum({
|
|
5981
|
+
token: spec.tokenAddress,
|
|
5982
|
+
extension: void 0
|
|
5983
|
+
});
|
|
5984
|
+
}
|
|
5985
|
+
if (spec.kind === "extension") {
|
|
5986
|
+
return new starknet.CairoCustomEnum({
|
|
5987
|
+
token: void 0,
|
|
5988
|
+
extension: {
|
|
5989
|
+
address: spec.address,
|
|
5990
|
+
config: spec.config
|
|
5991
|
+
}
|
|
5992
|
+
});
|
|
5993
|
+
}
|
|
5994
|
+
throw new Error(
|
|
5995
|
+
`Unsupported entry requirement kind: ${spec.kind}`
|
|
5996
|
+
);
|
|
5997
|
+
}
|
|
5998
|
+
function scaleWeight(client) {
|
|
5999
|
+
return Math.round(client * 10);
|
|
6000
|
+
}
|
|
6001
|
+
function encodeDistribution(d) {
|
|
6002
|
+
if (d.kind === "linear") {
|
|
6003
|
+
return new starknet.CairoCustomEnum({
|
|
6004
|
+
Linear: scaleWeight(d.weight),
|
|
6005
|
+
Exponential: void 0,
|
|
6006
|
+
Uniform: void 0,
|
|
6007
|
+
Custom: void 0
|
|
6008
|
+
});
|
|
6009
|
+
}
|
|
6010
|
+
if (d.kind === "exponential") {
|
|
6011
|
+
return new starknet.CairoCustomEnum({
|
|
6012
|
+
Linear: void 0,
|
|
6013
|
+
Exponential: scaleWeight(d.weight),
|
|
6014
|
+
Uniform: void 0,
|
|
6015
|
+
Custom: void 0
|
|
6016
|
+
});
|
|
6017
|
+
}
|
|
6018
|
+
return new starknet.CairoCustomEnum({
|
|
6019
|
+
Linear: void 0,
|
|
6020
|
+
Exponential: void 0,
|
|
6021
|
+
Uniform: {},
|
|
6022
|
+
Custom: void 0
|
|
6023
|
+
});
|
|
6024
|
+
}
|
|
6025
|
+
function pushRewardTypeFelts(out, reward) {
|
|
6026
|
+
switch (reward.kind) {
|
|
6027
|
+
case "prize_single":
|
|
6028
|
+
out.push("0x0", "0x0", "0x0", starknet.num.toHex(reward.prizeId));
|
|
6029
|
+
return;
|
|
6030
|
+
case "prize_distributed":
|
|
6031
|
+
out.push(
|
|
6032
|
+
"0x0",
|
|
6033
|
+
"0x0",
|
|
6034
|
+
"0x1",
|
|
6035
|
+
starknet.num.toHex(reward.prizeId),
|
|
6036
|
+
starknet.num.toHex(reward.payoutPosition)
|
|
6037
|
+
);
|
|
6038
|
+
return;
|
|
6039
|
+
case "prize_extension":
|
|
6040
|
+
out.push("0x0", "0x1", starknet.num.toHex(reward.prizeId));
|
|
6041
|
+
if (reward.tokenId !== void 0) {
|
|
6042
|
+
out.push("0x0", reward.tokenId);
|
|
6043
|
+
} else {
|
|
6044
|
+
out.push("0x1");
|
|
6045
|
+
}
|
|
6046
|
+
out.push(
|
|
6047
|
+
starknet.num.toHex(reward.payoutParams.length),
|
|
6048
|
+
...reward.payoutParams.map((p) => starknet.num.toHex(p))
|
|
6049
|
+
);
|
|
6050
|
+
return;
|
|
6051
|
+
case "entry_fee_position":
|
|
6052
|
+
out.push("0x1", "0x0", "0x0", starknet.num.toHex(reward.position));
|
|
6053
|
+
return;
|
|
6054
|
+
case "entry_fee_tournament_creator":
|
|
6055
|
+
out.push("0x1", "0x0", "0x1");
|
|
6056
|
+
return;
|
|
6057
|
+
case "entry_fee_game_creator":
|
|
6058
|
+
out.push("0x1", "0x0", "0x2");
|
|
6059
|
+
return;
|
|
6060
|
+
case "entry_fee_refund":
|
|
6061
|
+
out.push("0x1", "0x0", "0x3", starknet.num.toHex(reward.tokenId));
|
|
6062
|
+
return;
|
|
6063
|
+
case "entry_fee_protocol_fee":
|
|
6064
|
+
out.push("0x1", "0x0", "0x4");
|
|
6065
|
+
return;
|
|
6066
|
+
case "entry_fee_extension": {
|
|
6067
|
+
out.push("0x1", "0x1");
|
|
6068
|
+
if (reward.tokenId !== void 0) {
|
|
6069
|
+
out.push("0x0", reward.tokenId);
|
|
6070
|
+
} else {
|
|
6071
|
+
out.push("0x1");
|
|
6072
|
+
}
|
|
6073
|
+
out.push(
|
|
6074
|
+
starknet.num.toHex(reward.claimParams.length),
|
|
6075
|
+
...reward.claimParams.map((p) => starknet.num.toHex(p))
|
|
6076
|
+
);
|
|
6077
|
+
return;
|
|
6078
|
+
}
|
|
6079
|
+
}
|
|
6080
|
+
}
|
|
6081
|
+
var TOURNAMENT_CREATED_SELECTOR = starknet.hash.getSelectorFromName(
|
|
6082
|
+
"TournamentCreated"
|
|
6083
|
+
);
|
|
6084
|
+
function parseTournamentIdFromReceipt(receipt, budokanAddress) {
|
|
6085
|
+
const normalise = (addr) => addr.toLowerCase().replace(/^0x0*/, "0x");
|
|
6086
|
+
const normContract = normalise(budokanAddress);
|
|
6087
|
+
const createdSelector = BigInt(TOURNAMENT_CREATED_SELECTOR);
|
|
6088
|
+
for (const event of receipt.events ?? []) {
|
|
6089
|
+
if (!event.from_address || !event.keys || event.keys.length < 2) continue;
|
|
6090
|
+
if (normalise(event.from_address) !== normContract) continue;
|
|
6091
|
+
if (BigInt(event.keys[0]) !== createdSelector) continue;
|
|
6092
|
+
return BigInt(event.keys[1]);
|
|
6093
|
+
}
|
|
6094
|
+
return void 0;
|
|
6095
|
+
}
|
|
6096
|
+
function felt252FromShortString(s) {
|
|
6097
|
+
if (s.length > 31)
|
|
6098
|
+
throw new Error(`String too long for felt252: ${s.length} bytes`);
|
|
6099
|
+
let value = 0n;
|
|
6100
|
+
for (const char of s) {
|
|
6101
|
+
const code = char.charCodeAt(0);
|
|
6102
|
+
if (code > 127) throw new Error("Felt252 short strings must be ASCII");
|
|
6103
|
+
value = value << 8n | BigInt(code);
|
|
6104
|
+
}
|
|
6105
|
+
return "0x" + value.toString(16);
|
|
6106
|
+
}
|
|
6107
|
+
function sdkChainId(chain) {
|
|
6108
|
+
return chain === "mainnet" ? "SN_MAIN" : "SN_SEPOLIA";
|
|
6109
|
+
}
|
|
6110
|
+
function extensionAddressFor(chain, kind) {
|
|
6111
|
+
const table = metagameSdk.getExtensionAddresses(sdkChainId(chain));
|
|
6112
|
+
switch (kind) {
|
|
6113
|
+
case "merkle":
|
|
6114
|
+
if (!table.merkleValidator)
|
|
6115
|
+
throw new Error(`No merkleValidator address for ${chain}`);
|
|
6116
|
+
return table.merkleValidator;
|
|
6117
|
+
case "erc20Balance":
|
|
6118
|
+
if (!table.erc20BalanceValidator)
|
|
6119
|
+
throw new Error(`No erc20BalanceValidator address for ${chain}`);
|
|
6120
|
+
return table.erc20BalanceValidator;
|
|
6121
|
+
case "opusTroves":
|
|
6122
|
+
if (!table.opusTrovesValidator)
|
|
6123
|
+
throw new Error(`No opusTrovesValidator address for ${chain}`);
|
|
6124
|
+
return table.opusTrovesValidator;
|
|
6125
|
+
case "tournament":
|
|
6126
|
+
if (!table.tournamentValidator)
|
|
6127
|
+
throw new Error(`No tournamentValidator address for ${chain}`);
|
|
6128
|
+
return table.tournamentValidator;
|
|
6129
|
+
}
|
|
6130
|
+
}
|
|
6131
|
+
var U256_MAX = (1n << 256n) - 1n;
|
|
6132
|
+
function u256ToLowHigh(value) {
|
|
6133
|
+
if (value < 0n) throw new Error("u256 cannot be negative");
|
|
6134
|
+
if (value > U256_MAX)
|
|
6135
|
+
throw new Error(`Value exceeds u256 max: ${value.toString()}`);
|
|
6136
|
+
const MASK = (1n << 128n) - 1n;
|
|
6137
|
+
return [(value & MASK).toString(), (value >> 128n).toString()];
|
|
6138
|
+
}
|
|
6139
|
+
function buildErc20BalanceConfig(cfg) {
|
|
6140
|
+
const [minLo, minHi] = u256ToLowHigh(cfg.minThreshold);
|
|
6141
|
+
const [maxLo, maxHi] = u256ToLowHigh(cfg.maxThreshold);
|
|
6142
|
+
const [vpeLo, vpeHi] = u256ToLowHigh(cfg.valuePerEntry);
|
|
6143
|
+
return [
|
|
6144
|
+
cfg.tokenAddress,
|
|
6145
|
+
minLo,
|
|
6146
|
+
minHi,
|
|
6147
|
+
maxLo,
|
|
6148
|
+
maxHi,
|
|
6149
|
+
vpeLo,
|
|
6150
|
+
vpeHi,
|
|
6151
|
+
String(cfg.maxEntries),
|
|
6152
|
+
cfg.bannable ? "1" : "0"
|
|
6153
|
+
];
|
|
6154
|
+
}
|
|
6155
|
+
function buildOpusTrovesConfig(cfg) {
|
|
6156
|
+
return [
|
|
6157
|
+
String(cfg.assetAddresses.length),
|
|
6158
|
+
...cfg.assetAddresses,
|
|
6159
|
+
cfg.threshold.toString(),
|
|
6160
|
+
cfg.valuePerEntry.toString(),
|
|
6161
|
+
String(cfg.maxEntries),
|
|
6162
|
+
cfg.bannable ? "1" : "0"
|
|
6163
|
+
];
|
|
6164
|
+
}
|
|
6165
|
+
function buildMerkleConfig(cfg) {
|
|
6166
|
+
return [String(cfg.treeId)];
|
|
6167
|
+
}
|
|
6168
|
+
function buildTournamentValidatorConfig(cfg) {
|
|
6169
|
+
const qualifierType = cfg.requirement === "won" ? "1" : "0";
|
|
6170
|
+
const qualifyingMode = String(cfg.qualifyingMode ?? 0);
|
|
6171
|
+
const topPositions = cfg.requirement === "won" ? String(cfg.topPositions) : "0";
|
|
6172
|
+
return [qualifierType, qualifyingMode, topPositions, ...cfg.tournamentIds];
|
|
6173
|
+
}
|
|
6174
|
+
|
|
4714
6175
|
exports.BudokanApiError = BudokanApiError;
|
|
4715
6176
|
exports.BudokanClient = BudokanClient;
|
|
4716
6177
|
exports.BudokanConnectionError = BudokanConnectionError;
|
|
@@ -4722,13 +6183,31 @@ exports.DataSourceError = DataSourceError;
|
|
|
4722
6183
|
exports.RpcError = RpcError;
|
|
4723
6184
|
exports.TournamentNotFoundError = TournamentNotFoundError;
|
|
4724
6185
|
exports.WSManager = WSManager;
|
|
6186
|
+
exports.buildAddPrizeCall = buildAddPrizeCall;
|
|
6187
|
+
exports.buildClaimRewardCall = buildClaimRewardCall;
|
|
6188
|
+
exports.buildCreateTournamentCall = buildCreateTournamentCall;
|
|
6189
|
+
exports.buildEnterTournamentCall = buildEnterTournamentCall;
|
|
6190
|
+
exports.buildErc20ApproveCall = buildErc20ApproveCall;
|
|
6191
|
+
exports.buildErc20BalanceConfig = buildErc20BalanceConfig;
|
|
6192
|
+
exports.buildMerkleConfig = buildMerkleConfig;
|
|
6193
|
+
exports.buildOpusTrovesConfig = buildOpusTrovesConfig;
|
|
6194
|
+
exports.buildSubmitScoreCall = buildSubmitScoreCall;
|
|
6195
|
+
exports.buildTournamentValidatorConfig = buildTournamentValidatorConfig;
|
|
4725
6196
|
exports.camelToSnake = camelToSnake;
|
|
4726
6197
|
exports.createBudokanClient = createBudokanClient;
|
|
6198
|
+
exports.explorerAddressUrl = explorerAddressUrl;
|
|
6199
|
+
exports.explorerBaseUrl = explorerBaseUrl;
|
|
6200
|
+
exports.explorerTxUrl = explorerTxUrl;
|
|
6201
|
+
exports.extensionAddressFor = extensionAddressFor;
|
|
6202
|
+
exports.findWhitelistedGame = findWhitelistedGame;
|
|
4727
6203
|
exports.getActivityStats = getActivityStats;
|
|
4728
6204
|
exports.getChainConfig = getChainConfig;
|
|
6205
|
+
exports.getGameDefaults = getGameDefaults;
|
|
4729
6206
|
exports.getGameStats = getGameStats;
|
|
4730
6207
|
exports.getGameTournaments = getGameTournaments;
|
|
4731
6208
|
exports.getPrizeStats = getPrizeStats;
|
|
6209
|
+
exports.getRawTokenPrizes = getRawTokenPrizes;
|
|
6210
|
+
exports.getTokenPrizes = getTokenPrizes;
|
|
4732
6211
|
exports.getTournament = getTournament;
|
|
4733
6212
|
exports.getTournamentPrizeAggregation = getTournamentPrizeAggregation;
|
|
4734
6213
|
exports.getTournamentPrizes = getTournamentPrizes;
|
|
@@ -4737,8 +6216,25 @@ exports.getTournamentRegistrations = getTournamentRegistrations;
|
|
|
4737
6216
|
exports.getTournamentRewardClaims = getTournamentRewardClaims;
|
|
4738
6217
|
exports.getTournamentRewardClaimsSummary = getTournamentRewardClaimsSummary;
|
|
4739
6218
|
exports.getTournaments = getTournaments;
|
|
6219
|
+
exports.getWhitelistedGames = getWhitelistedGames;
|
|
6220
|
+
exports.isExtensionPrize = isExtensionPrize;
|
|
6221
|
+
exports.isGameWhitelisted = isGameWhitelisted;
|
|
6222
|
+
exports.isMetagameAdaptablePrize = isMetagameAdaptablePrize;
|
|
6223
|
+
exports.isRawExtensionPrize = isRawExtensionPrize;
|
|
6224
|
+
exports.isRawTokenPrize = isRawTokenPrize;
|
|
6225
|
+
exports.isTokenPrize = isTokenPrize;
|
|
4740
6226
|
exports.normalizeAddress = normalizeAddress;
|
|
6227
|
+
exports.parseTournamentIdFromReceipt = parseTournamentIdFromReceipt;
|
|
4741
6228
|
exports.snakeToCamel = snakeToCamel;
|
|
6229
|
+
exports.toMetagameExtensionPrize = toMetagameExtensionPrize;
|
|
6230
|
+
exports.toMetagamePrize = toMetagamePrize;
|
|
6231
|
+
exports.toMetagamePrizes = toMetagamePrizes;
|
|
6232
|
+
exports.toMetagameTokenPrize = toMetagameTokenPrize;
|
|
6233
|
+
exports.toMetagameTokenPrizes = toMetagameTokenPrizes;
|
|
6234
|
+
exports.tournamentPageUrl = tournamentPageUrl;
|
|
6235
|
+
exports.tryToMetagamePrize = tryToMetagamePrize;
|
|
6236
|
+
exports.tryToMetagamePrizes = tryToMetagamePrizes;
|
|
6237
|
+
exports.u256ToLowHigh = u256ToLowHigh;
|
|
4742
6238
|
exports.withRetry = withRetry;
|
|
4743
6239
|
//# sourceMappingURL=index.cjs.map
|
|
4744
6240
|
//# sourceMappingURL=index.cjs.map
|