@provable-games/budokan-sdk 0.1.24 → 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/dist/index.cjs +325 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +80 -3
- package/dist/index.d.ts +80 -3
- package/dist/index.js +312 -4
- package/dist/index.js.map +1 -1
- package/dist/{player-C2GE9Lop.d.cts → player-P6Dd1lNb.d.cts} +40 -6
- package/dist/{player-C2GE9Lop.d.ts → player-P6Dd1lNb.d.ts} +40 -6
- package/dist/react.cjs +129 -3
- 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 +129 -3
- package/dist/react.js.map +1 -1
- package/package.json +2 -2
package/dist/react.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { j as BudokanClientConfig, B as BudokanClient, T as Tournament, b as PaginatedResult, e as TournamentListParams, p as Phase, o as LeaderboardEntry, R as Registration, c as RewardClaim, d as RewardClaimSummary, g as PrizeStats, a as Prize, P as PrizeAggregation, Q as QualificationEntry, f as PlatformStats, r as PlayerRewards, t as WSEventMessage, s as WSChannel, C as ConnectionMode } from './player-P6Dd1lNb.cjs';
|
|
4
4
|
import 'starknet';
|
|
5
5
|
import '@provable-games/metagame-sdk';
|
|
6
6
|
|
package/dist/react.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { j as BudokanClientConfig, B as BudokanClient, T as Tournament, b as PaginatedResult, e as TournamentListParams, p as Phase, o as LeaderboardEntry, R as Registration, c as RewardClaim, d as RewardClaimSummary, g as PrizeStats, a as Prize, P as PrizeAggregation, Q as QualificationEntry, f as PlatformStats, r as PlayerRewards, t as WSEventMessage, s as WSChannel, C as ConnectionMode } from './player-P6Dd1lNb.js';
|
|
4
4
|
import 'starknet';
|
|
5
5
|
import '@provable-games/metagame-sdk';
|
|
6
6
|
|
package/dist/react.js
CHANGED
|
@@ -201,7 +201,8 @@ function snakeToCamel(obj) {
|
|
|
201
201
|
function normalizeTournament(raw) {
|
|
202
202
|
const t = snakeToCamel(raw);
|
|
203
203
|
const id = t.id ?? t.tournamentId;
|
|
204
|
-
|
|
204
|
+
const protocolFeeShare = t.protocolFeeShare ?? t.entryFee?.protocolFeeShare ?? null;
|
|
205
|
+
return { ...t, id, tournamentId: id, protocolFeeShare };
|
|
205
206
|
}
|
|
206
207
|
function fetchOpts(ctx) {
|
|
207
208
|
return {
|
|
@@ -805,7 +806,7 @@ function phaseToRpcArg(phase) {
|
|
|
805
806
|
}
|
|
806
807
|
return new CairoCustomEnum(variants);
|
|
807
808
|
}
|
|
808
|
-
function parseTournament(raw, entryCount) {
|
|
809
|
+
function parseTournament(raw, entryCount, protocolFeeShare = null) {
|
|
809
810
|
const obj = raw;
|
|
810
811
|
const id = String(obj.id ?? "0");
|
|
811
812
|
const createdAt = Number(obj.created_at ?? 0);
|
|
@@ -903,6 +904,8 @@ function parseTournament(raw, entryCount) {
|
|
|
903
904
|
leaderboardGameMustBeOver: gameMustBeOver,
|
|
904
905
|
entryFeeToken,
|
|
905
906
|
entryFeeAmount,
|
|
907
|
+
// Protocol-fee bps snapshot, surfaced by the viewer's TournamentFullState.
|
|
908
|
+
protocolFeeShare,
|
|
906
909
|
hasEntryRequirement,
|
|
907
910
|
schedule: {
|
|
908
911
|
registrationStartDelay,
|
|
@@ -1069,7 +1072,8 @@ function parseFilterResult(raw) {
|
|
|
1069
1072
|
function parseTournamentFullState(raw) {
|
|
1070
1073
|
const obj = raw;
|
|
1071
1074
|
const entryCount = Number(obj.entry_count ?? 0);
|
|
1072
|
-
|
|
1075
|
+
const protocolFeeShare = obj.protocol_fee_bps != null ? Number(obj.protocol_fee_bps) : null;
|
|
1076
|
+
return parseTournament(obj.tournament, entryCount, protocolFeeShare);
|
|
1073
1077
|
}
|
|
1074
1078
|
async function viewerTournaments(contract, offset, limit) {
|
|
1075
1079
|
return wrapRpcCall(async () => {
|
|
@@ -1245,6 +1249,9 @@ function translateCairoRewardType(rewardType) {
|
|
|
1245
1249
|
if (subVariant === "GameCreator" || subBag?.GameCreator !== void 0) {
|
|
1246
1250
|
return rewardClaim({ claimKind: "entry_fee_game_creator" });
|
|
1247
1251
|
}
|
|
1252
|
+
if (subVariant === "ProtocolFee" || subBag?.ProtocolFee !== void 0) {
|
|
1253
|
+
return rewardClaim({ claimKind: "entry_fee_protocol_fee" });
|
|
1254
|
+
}
|
|
1248
1255
|
if (subVariant === "Refund" || subBag?.Refund !== void 0) {
|
|
1249
1256
|
return rewardClaim({
|
|
1250
1257
|
claimKind: "entry_fee_refund",
|
|
@@ -1717,6 +1724,10 @@ var budokanViewer_default = [
|
|
|
1717
1724
|
{
|
|
1718
1725
|
name: "phase",
|
|
1719
1726
|
type: "budokan_interfaces::budokan::Phase"
|
|
1727
|
+
},
|
|
1728
|
+
{
|
|
1729
|
+
name: "protocol_fee_bps",
|
|
1730
|
+
type: "core::integer::u16"
|
|
1720
1731
|
}
|
|
1721
1732
|
]
|
|
1722
1733
|
},
|
|
@@ -1987,6 +1998,10 @@ var budokanViewer_default = [
|
|
|
1987
1998
|
{
|
|
1988
1999
|
name: "Refund",
|
|
1989
2000
|
type: "core::felt252"
|
|
2001
|
+
},
|
|
2002
|
+
{
|
|
2003
|
+
name: "ProtocolFee",
|
|
2004
|
+
type: "()"
|
|
1990
2005
|
}
|
|
1991
2006
|
]
|
|
1992
2007
|
},
|
|
@@ -3365,6 +3380,10 @@ var budokan_default = [
|
|
|
3365
3380
|
{
|
|
3366
3381
|
name: "Refund",
|
|
3367
3382
|
type: "core::felt252"
|
|
3383
|
+
},
|
|
3384
|
+
{
|
|
3385
|
+
name: "ProtocolFee",
|
|
3386
|
+
type: "()"
|
|
3368
3387
|
}
|
|
3369
3388
|
]
|
|
3370
3389
|
},
|
|
@@ -4653,6 +4672,11 @@ var budokan_default = [
|
|
|
4653
4672
|
name: "entry_requirement",
|
|
4654
4673
|
type: "core::option::Option::<game_components_interfaces::entry_requirement::EntryRequirement>",
|
|
4655
4674
|
kind: "data"
|
|
4675
|
+
},
|
|
4676
|
+
{
|
|
4677
|
+
name: "protocol_fee_bps",
|
|
4678
|
+
type: "core::integer::u16",
|
|
4679
|
+
kind: "data"
|
|
4656
4680
|
}
|
|
4657
4681
|
]
|
|
4658
4682
|
},
|
|
@@ -4875,6 +4899,108 @@ var budokan_default = [
|
|
|
4875
4899
|
name: "QualificationEntriesUpdated",
|
|
4876
4900
|
type: "budokan::events::QualificationEntriesUpdated",
|
|
4877
4901
|
kind: "nested"
|
|
4902
|
+
},
|
|
4903
|
+
{
|
|
4904
|
+
name: "ProtocolFeeBpsUpdated",
|
|
4905
|
+
type: "budokan::events::ProtocolFeeBpsUpdated",
|
|
4906
|
+
kind: "nested"
|
|
4907
|
+
},
|
|
4908
|
+
{
|
|
4909
|
+
name: "ProtocolFeeRecipientUpdated",
|
|
4910
|
+
type: "budokan::events::ProtocolFeeRecipientUpdated",
|
|
4911
|
+
kind: "nested"
|
|
4912
|
+
}
|
|
4913
|
+
]
|
|
4914
|
+
},
|
|
4915
|
+
{
|
|
4916
|
+
type: "interface",
|
|
4917
|
+
name: "budokan::budokan::Budokan::IBudokanProtocolFeeAdmin",
|
|
4918
|
+
items: [
|
|
4919
|
+
{
|
|
4920
|
+
type: "function",
|
|
4921
|
+
name: "set_protocol_fee_bps",
|
|
4922
|
+
inputs: [
|
|
4923
|
+
{
|
|
4924
|
+
name: "bps",
|
|
4925
|
+
type: "core::integer::u16"
|
|
4926
|
+
}
|
|
4927
|
+
],
|
|
4928
|
+
outputs: [],
|
|
4929
|
+
state_mutability: "external"
|
|
4930
|
+
},
|
|
4931
|
+
{
|
|
4932
|
+
type: "function",
|
|
4933
|
+
name: "set_protocol_fee_recipient",
|
|
4934
|
+
inputs: [
|
|
4935
|
+
{
|
|
4936
|
+
name: "recipient",
|
|
4937
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
4938
|
+
}
|
|
4939
|
+
],
|
|
4940
|
+
outputs: [],
|
|
4941
|
+
state_mutability: "external"
|
|
4942
|
+
},
|
|
4943
|
+
{
|
|
4944
|
+
type: "function",
|
|
4945
|
+
name: "protocol_fee_bps",
|
|
4946
|
+
inputs: [],
|
|
4947
|
+
outputs: [
|
|
4948
|
+
{
|
|
4949
|
+
type: "core::integer::u16"
|
|
4950
|
+
}
|
|
4951
|
+
],
|
|
4952
|
+
state_mutability: "view"
|
|
4953
|
+
},
|
|
4954
|
+
{
|
|
4955
|
+
type: "function",
|
|
4956
|
+
name: "protocol_fee_recipient",
|
|
4957
|
+
inputs: [],
|
|
4958
|
+
outputs: [
|
|
4959
|
+
{
|
|
4960
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
4961
|
+
}
|
|
4962
|
+
],
|
|
4963
|
+
state_mutability: "view"
|
|
4964
|
+
},
|
|
4965
|
+
{
|
|
4966
|
+
type: "function",
|
|
4967
|
+
name: "tournament_protocol_fee_bps",
|
|
4968
|
+
inputs: [
|
|
4969
|
+
{
|
|
4970
|
+
name: "tournament_id",
|
|
4971
|
+
type: "core::integer::u64"
|
|
4972
|
+
}
|
|
4973
|
+
],
|
|
4974
|
+
outputs: [
|
|
4975
|
+
{
|
|
4976
|
+
type: "core::integer::u16"
|
|
4977
|
+
}
|
|
4978
|
+
],
|
|
4979
|
+
state_mutability: "view"
|
|
4980
|
+
}
|
|
4981
|
+
]
|
|
4982
|
+
},
|
|
4983
|
+
{
|
|
4984
|
+
type: "event",
|
|
4985
|
+
name: "budokan::events::ProtocolFeeBpsUpdated",
|
|
4986
|
+
kind: "struct",
|
|
4987
|
+
members: [
|
|
4988
|
+
{
|
|
4989
|
+
name: "bps",
|
|
4990
|
+
type: "core::integer::u16",
|
|
4991
|
+
kind: "data"
|
|
4992
|
+
}
|
|
4993
|
+
]
|
|
4994
|
+
},
|
|
4995
|
+
{
|
|
4996
|
+
type: "event",
|
|
4997
|
+
name: "budokan::events::ProtocolFeeRecipientUpdated",
|
|
4998
|
+
kind: "struct",
|
|
4999
|
+
members: [
|
|
5000
|
+
{
|
|
5001
|
+
name: "recipient",
|
|
5002
|
+
type: "core::starknet::contract_address::ContractAddress",
|
|
5003
|
+
kind: "key"
|
|
4878
5004
|
}
|
|
4879
5005
|
]
|
|
4880
5006
|
}
|