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