@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
|
@@ -53,6 +53,14 @@ interface Tournament {
|
|
|
53
53
|
leaderboardGameMustBeOver: boolean | null;
|
|
54
54
|
entryFeeToken: string | null;
|
|
55
55
|
entryFeeAmount: string | null;
|
|
56
|
+
/**
|
|
57
|
+
* Effective protocol-fee rate (basis points) snapshotted for this tournament
|
|
58
|
+
* at creation — the slice of the built-in entry-fee pool routed to the DAO
|
|
59
|
+
* buyback/treasury. `0` when no protocol fee applies. Sourced from the
|
|
60
|
+
* `TournamentCreated` event via the indexer/API; `null` over the RPC/viewer
|
|
61
|
+
* data source (the per-tournament snapshot has no on-chain getter).
|
|
62
|
+
*/
|
|
63
|
+
protocolFeeShare: number | null;
|
|
56
64
|
hasEntryRequirement: boolean | null;
|
|
57
65
|
schedule: Schedule | null;
|
|
58
66
|
gameConfig: GameConfig | null;
|
|
@@ -189,14 +197,40 @@ interface Prize {
|
|
|
189
197
|
/** Opaque `Span<felt252>` config; only set when `tokenType === "extension"`. */
|
|
190
198
|
extensionConfig: string[] | null;
|
|
191
199
|
}
|
|
200
|
+
type Erc20Prize = Prize & {
|
|
201
|
+
tokenType: "erc20";
|
|
202
|
+
tokenAddress: string;
|
|
203
|
+
amount: string;
|
|
204
|
+
tokenId: null;
|
|
205
|
+
extensionAddress: null;
|
|
206
|
+
extensionConfig: null;
|
|
207
|
+
};
|
|
208
|
+
type Erc721Prize = Prize & {
|
|
209
|
+
tokenType: "erc721";
|
|
210
|
+
tokenAddress: string;
|
|
211
|
+
amount: null;
|
|
212
|
+
tokenId: string;
|
|
213
|
+
extensionAddress: null;
|
|
214
|
+
extensionConfig: null;
|
|
215
|
+
};
|
|
216
|
+
type TokenPrize = Erc20Prize | Erc721Prize;
|
|
217
|
+
type ExtensionPrize = Prize & {
|
|
218
|
+
tokenType: "extension";
|
|
219
|
+
tokenAddress: null;
|
|
220
|
+
amount: null;
|
|
221
|
+
tokenId: null;
|
|
222
|
+
extensionAddress: string;
|
|
223
|
+
extensionConfig: string[] | null;
|
|
224
|
+
};
|
|
192
225
|
/**
|
|
193
|
-
* Discriminator for `RewardClaim.claimKind`. Picks one of the
|
|
226
|
+
* Discriminator for `RewardClaim.claimKind`. Picks one of the seven terminal
|
|
194
227
|
* variants of the on-chain `RewardType` enum (Prize::Single, Prize::Distributed,
|
|
195
|
-
* EntryFee::Position / TournamentCreator / GameCreator / Refund).
|
|
196
|
-
* variant-specific fields below are populated only for the kinds that carry
|
|
197
|
-
* them; the
|
|
228
|
+
* EntryFee::Position / TournamentCreator / GameCreator / Refund / ProtocolFee).
|
|
229
|
+
* The variant-specific fields below are populated only for the kinds that carry
|
|
230
|
+
* them; the three pure-marker kinds (tournament_creator, game_creator,
|
|
231
|
+
* protocol_fee) leave all four nullable fields null.
|
|
198
232
|
*/
|
|
199
|
-
type RewardClaimKind = "prize_single" | "prize_distributed" | "entry_fee_position" | "entry_fee_tournament_creator" | "entry_fee_game_creator" | "entry_fee_refund" | "prize_extension" | "entry_fee_extension";
|
|
233
|
+
type RewardClaimKind = "prize_single" | "prize_distributed" | "entry_fee_position" | "entry_fee_tournament_creator" | "entry_fee_game_creator" | "entry_fee_protocol_fee" | "entry_fee_refund" | "prize_extension" | "entry_fee_extension";
|
|
200
234
|
interface RewardClaim {
|
|
201
235
|
tournamentId: string;
|
|
202
236
|
claimKind: RewardClaimKind;
|
|
@@ -542,4 +576,4 @@ interface PlayerRewards {
|
|
|
542
576
|
rewardClaims: RewardClaim[];
|
|
543
577
|
}
|
|
544
578
|
|
|
545
|
-
export { BudokanClient as B, type ConnectionMode as C, type DataSource as D, type GameConfig as G, type LeaderboardConfig as L, type PrizeAggregation as P, type QualificationEntry as Q, type Registration as R, type Schedule as S, type Tournament as T, type WSSubscribeOptions as W, type Prize as a, type PaginatedResult as b, type RewardClaim as c, type RewardClaimSummary as d, type TournamentListParams as e, type PlatformStats as f, type PrizeStats as g, type WSEventHandler as h, type
|
|
579
|
+
export { BudokanClient as B, type ConnectionMode as C, type DataSource as D, type ExtensionPrize as E, type GameConfig as G, type LeaderboardConfig as L, type PrizeAggregation as P, type QualificationEntry as Q, type Registration as R, type Schedule as S, type Tournament as T, type WSSubscribeOptions as W, type Prize as a, type PaginatedResult as b, type RewardClaim as c, type RewardClaimSummary as d, type TournamentListParams as e, type PlatformStats as f, type PrizeStats as g, type WSEventHandler as h, type TokenPrize as i, type BudokanClientConfig as j, ConnectionStatus as k, type ConnectionStatusState as l, type Erc20Prize as m, type Erc721Prize as n, type LeaderboardEntry as o, type Phase as p, type PlayerPlacement as q, type PlayerRewards as r, type WSChannel as s, type WSEventMessage as t, type WSMessage as u, type WSSubscribeMessage as v, type WSUnsubscribeMessage as w, createBudokanClient as x };
|
|
@@ -53,6 +53,14 @@ interface Tournament {
|
|
|
53
53
|
leaderboardGameMustBeOver: boolean | null;
|
|
54
54
|
entryFeeToken: string | null;
|
|
55
55
|
entryFeeAmount: string | null;
|
|
56
|
+
/**
|
|
57
|
+
* Effective protocol-fee rate (basis points) snapshotted for this tournament
|
|
58
|
+
* at creation — the slice of the built-in entry-fee pool routed to the DAO
|
|
59
|
+
* buyback/treasury. `0` when no protocol fee applies. Sourced from the
|
|
60
|
+
* `TournamentCreated` event via the indexer/API; `null` over the RPC/viewer
|
|
61
|
+
* data source (the per-tournament snapshot has no on-chain getter).
|
|
62
|
+
*/
|
|
63
|
+
protocolFeeShare: number | null;
|
|
56
64
|
hasEntryRequirement: boolean | null;
|
|
57
65
|
schedule: Schedule | null;
|
|
58
66
|
gameConfig: GameConfig | null;
|
|
@@ -189,14 +197,40 @@ interface Prize {
|
|
|
189
197
|
/** Opaque `Span<felt252>` config; only set when `tokenType === "extension"`. */
|
|
190
198
|
extensionConfig: string[] | null;
|
|
191
199
|
}
|
|
200
|
+
type Erc20Prize = Prize & {
|
|
201
|
+
tokenType: "erc20";
|
|
202
|
+
tokenAddress: string;
|
|
203
|
+
amount: string;
|
|
204
|
+
tokenId: null;
|
|
205
|
+
extensionAddress: null;
|
|
206
|
+
extensionConfig: null;
|
|
207
|
+
};
|
|
208
|
+
type Erc721Prize = Prize & {
|
|
209
|
+
tokenType: "erc721";
|
|
210
|
+
tokenAddress: string;
|
|
211
|
+
amount: null;
|
|
212
|
+
tokenId: string;
|
|
213
|
+
extensionAddress: null;
|
|
214
|
+
extensionConfig: null;
|
|
215
|
+
};
|
|
216
|
+
type TokenPrize = Erc20Prize | Erc721Prize;
|
|
217
|
+
type ExtensionPrize = Prize & {
|
|
218
|
+
tokenType: "extension";
|
|
219
|
+
tokenAddress: null;
|
|
220
|
+
amount: null;
|
|
221
|
+
tokenId: null;
|
|
222
|
+
extensionAddress: string;
|
|
223
|
+
extensionConfig: string[] | null;
|
|
224
|
+
};
|
|
192
225
|
/**
|
|
193
|
-
* Discriminator for `RewardClaim.claimKind`. Picks one of the
|
|
226
|
+
* Discriminator for `RewardClaim.claimKind`. Picks one of the seven terminal
|
|
194
227
|
* variants of the on-chain `RewardType` enum (Prize::Single, Prize::Distributed,
|
|
195
|
-
* EntryFee::Position / TournamentCreator / GameCreator / Refund).
|
|
196
|
-
* variant-specific fields below are populated only for the kinds that carry
|
|
197
|
-
* them; the
|
|
228
|
+
* EntryFee::Position / TournamentCreator / GameCreator / Refund / ProtocolFee).
|
|
229
|
+
* The variant-specific fields below are populated only for the kinds that carry
|
|
230
|
+
* them; the three pure-marker kinds (tournament_creator, game_creator,
|
|
231
|
+
* protocol_fee) leave all four nullable fields null.
|
|
198
232
|
*/
|
|
199
|
-
type RewardClaimKind = "prize_single" | "prize_distributed" | "entry_fee_position" | "entry_fee_tournament_creator" | "entry_fee_game_creator" | "entry_fee_refund" | "prize_extension" | "entry_fee_extension";
|
|
233
|
+
type RewardClaimKind = "prize_single" | "prize_distributed" | "entry_fee_position" | "entry_fee_tournament_creator" | "entry_fee_game_creator" | "entry_fee_protocol_fee" | "entry_fee_refund" | "prize_extension" | "entry_fee_extension";
|
|
200
234
|
interface RewardClaim {
|
|
201
235
|
tournamentId: string;
|
|
202
236
|
claimKind: RewardClaimKind;
|
|
@@ -542,4 +576,4 @@ interface PlayerRewards {
|
|
|
542
576
|
rewardClaims: RewardClaim[];
|
|
543
577
|
}
|
|
544
578
|
|
|
545
|
-
export { BudokanClient as B, type ConnectionMode as C, type DataSource as D, type GameConfig as G, type LeaderboardConfig as L, type PrizeAggregation as P, type QualificationEntry as Q, type Registration as R, type Schedule as S, type Tournament as T, type WSSubscribeOptions as W, type Prize as a, type PaginatedResult as b, type RewardClaim as c, type RewardClaimSummary as d, type TournamentListParams as e, type PlatformStats as f, type PrizeStats as g, type WSEventHandler as h, type
|
|
579
|
+
export { BudokanClient as B, type ConnectionMode as C, type DataSource as D, type ExtensionPrize as E, type GameConfig as G, type LeaderboardConfig as L, type PrizeAggregation as P, type QualificationEntry as Q, type Registration as R, type Schedule as S, type Tournament as T, type WSSubscribeOptions as W, type Prize as a, type PaginatedResult as b, type RewardClaim as c, type RewardClaimSummary as d, type TournamentListParams as e, type PlatformStats as f, type PrizeStats as g, type WSEventHandler as h, type TokenPrize as i, type BudokanClientConfig as j, ConnectionStatus as k, type ConnectionStatusState as l, type Erc20Prize as m, type Erc721Prize as n, type LeaderboardEntry as o, type Phase as p, type PlayerPlacement as q, type PlayerRewards as r, type WSChannel as s, type WSEventMessage as t, type WSMessage as u, type WSSubscribeMessage as v, type WSUnsubscribeMessage as w, createBudokanClient as x };
|
package/dist/react.cjs
CHANGED
|
@@ -203,7 +203,8 @@ function snakeToCamel(obj) {
|
|
|
203
203
|
function normalizeTournament(raw) {
|
|
204
204
|
const t = snakeToCamel(raw);
|
|
205
205
|
const id = t.id ?? t.tournamentId;
|
|
206
|
-
|
|
206
|
+
const protocolFeeShare = t.protocolFeeShare ?? t.entryFee?.protocolFeeShare ?? null;
|
|
207
|
+
return { ...t, id, tournamentId: id, protocolFeeShare };
|
|
207
208
|
}
|
|
208
209
|
function fetchOpts(ctx) {
|
|
209
210
|
return {
|
|
@@ -807,7 +808,7 @@ function phaseToRpcArg(phase) {
|
|
|
807
808
|
}
|
|
808
809
|
return new starknet.CairoCustomEnum(variants);
|
|
809
810
|
}
|
|
810
|
-
function parseTournament(raw, entryCount) {
|
|
811
|
+
function parseTournament(raw, entryCount, protocolFeeShare = null) {
|
|
811
812
|
const obj = raw;
|
|
812
813
|
const id = String(obj.id ?? "0");
|
|
813
814
|
const createdAt = Number(obj.created_at ?? 0);
|
|
@@ -905,6 +906,8 @@ function parseTournament(raw, entryCount) {
|
|
|
905
906
|
leaderboardGameMustBeOver: gameMustBeOver,
|
|
906
907
|
entryFeeToken,
|
|
907
908
|
entryFeeAmount,
|
|
909
|
+
// Protocol-fee bps snapshot, surfaced by the viewer's TournamentFullState.
|
|
910
|
+
protocolFeeShare,
|
|
908
911
|
hasEntryRequirement,
|
|
909
912
|
schedule: {
|
|
910
913
|
registrationStartDelay,
|
|
@@ -1071,7 +1074,8 @@ function parseFilterResult(raw) {
|
|
|
1071
1074
|
function parseTournamentFullState(raw) {
|
|
1072
1075
|
const obj = raw;
|
|
1073
1076
|
const entryCount = Number(obj.entry_count ?? 0);
|
|
1074
|
-
|
|
1077
|
+
const protocolFeeShare = obj.protocol_fee_bps != null ? Number(obj.protocol_fee_bps) : null;
|
|
1078
|
+
return parseTournament(obj.tournament, entryCount, protocolFeeShare);
|
|
1075
1079
|
}
|
|
1076
1080
|
async function viewerTournaments(contract, offset, limit) {
|
|
1077
1081
|
return wrapRpcCall(async () => {
|
|
@@ -1247,6 +1251,9 @@ function translateCairoRewardType(rewardType) {
|
|
|
1247
1251
|
if (subVariant === "GameCreator" || subBag?.GameCreator !== void 0) {
|
|
1248
1252
|
return rewardClaim({ claimKind: "entry_fee_game_creator" });
|
|
1249
1253
|
}
|
|
1254
|
+
if (subVariant === "ProtocolFee" || subBag?.ProtocolFee !== void 0) {
|
|
1255
|
+
return rewardClaim({ claimKind: "entry_fee_protocol_fee" });
|
|
1256
|
+
}
|
|
1250
1257
|
if (subVariant === "Refund" || subBag?.Refund !== void 0) {
|
|
1251
1258
|
return rewardClaim({
|
|
1252
1259
|
claimKind: "entry_fee_refund",
|
|
@@ -1719,6 +1726,10 @@ var budokanViewer_default = [
|
|
|
1719
1726
|
{
|
|
1720
1727
|
name: "phase",
|
|
1721
1728
|
type: "budokan_interfaces::budokan::Phase"
|
|
1729
|
+
},
|
|
1730
|
+
{
|
|
1731
|
+
name: "protocol_fee_bps",
|
|
1732
|
+
type: "core::integer::u16"
|
|
1722
1733
|
}
|
|
1723
1734
|
]
|
|
1724
1735
|
},
|
|
@@ -1989,6 +2000,10 @@ var budokanViewer_default = [
|
|
|
1989
2000
|
{
|
|
1990
2001
|
name: "Refund",
|
|
1991
2002
|
type: "core::felt252"
|
|
2003
|
+
},
|
|
2004
|
+
{
|
|
2005
|
+
name: "ProtocolFee",
|
|
2006
|
+
type: "()"
|
|
1992
2007
|
}
|
|
1993
2008
|
]
|
|
1994
2009
|
},
|
|
@@ -3367,6 +3382,10 @@ var budokan_default = [
|
|
|
3367
3382
|
{
|
|
3368
3383
|
name: "Refund",
|
|
3369
3384
|
type: "core::felt252"
|
|
3385
|
+
},
|
|
3386
|
+
{
|
|
3387
|
+
name: "ProtocolFee",
|
|
3388
|
+
type: "()"
|
|
3370
3389
|
}
|
|
3371
3390
|
]
|
|
3372
3391
|
},
|
|
@@ -4655,6 +4674,11 @@ var budokan_default = [
|
|
|
4655
4674
|
name: "entry_requirement",
|
|
4656
4675
|
type: "core::option::Option::<game_components_interfaces::entry_requirement::EntryRequirement>",
|
|
4657
4676
|
kind: "data"
|
|
4677
|
+
},
|
|
4678
|
+
{
|
|
4679
|
+
name: "protocol_fee_bps",
|
|
4680
|
+
type: "core::integer::u16",
|
|
4681
|
+
kind: "data"
|
|
4658
4682
|
}
|
|
4659
4683
|
]
|
|
4660
4684
|
},
|
|
@@ -4877,6 +4901,108 @@ var budokan_default = [
|
|
|
4877
4901
|
name: "QualificationEntriesUpdated",
|
|
4878
4902
|
type: "budokan::events::QualificationEntriesUpdated",
|
|
4879
4903
|
kind: "nested"
|
|
4904
|
+
},
|
|
4905
|
+
{
|
|
4906
|
+
name: "ProtocolFeeBpsUpdated",
|
|
4907
|
+
type: "budokan::events::ProtocolFeeBpsUpdated",
|
|
4908
|
+
kind: "nested"
|
|
4909
|
+
},
|
|
4910
|
+
{
|
|
4911
|
+
name: "ProtocolFeeRecipientUpdated",
|
|
4912
|
+
type: "budokan::events::ProtocolFeeRecipientUpdated",
|
|
4913
|
+
kind: "nested"
|
|
4914
|
+
}
|
|
4915
|
+
]
|
|
4916
|
+
},
|
|
4917
|
+
{
|
|
4918
|
+
type: "interface",
|
|
4919
|
+
name: "budokan::budokan::Budokan::IBudokanProtocolFeeAdmin",
|
|
4920
|
+
items: [
|
|
4921
|
+
{
|
|
4922
|
+
type: "function",
|
|
4923
|
+
name: "set_protocol_fee_bps",
|
|
4924
|
+
inputs: [
|
|
4925
|
+
{
|
|
4926
|
+
name: "bps",
|
|
4927
|
+
type: "core::integer::u16"
|
|
4928
|
+
}
|
|
4929
|
+
],
|
|
4930
|
+
outputs: [],
|
|
4931
|
+
state_mutability: "external"
|
|
4932
|
+
},
|
|
4933
|
+
{
|
|
4934
|
+
type: "function",
|
|
4935
|
+
name: "set_protocol_fee_recipient",
|
|
4936
|
+
inputs: [
|
|
4937
|
+
{
|
|
4938
|
+
name: "recipient",
|
|
4939
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
4940
|
+
}
|
|
4941
|
+
],
|
|
4942
|
+
outputs: [],
|
|
4943
|
+
state_mutability: "external"
|
|
4944
|
+
},
|
|
4945
|
+
{
|
|
4946
|
+
type: "function",
|
|
4947
|
+
name: "protocol_fee_bps",
|
|
4948
|
+
inputs: [],
|
|
4949
|
+
outputs: [
|
|
4950
|
+
{
|
|
4951
|
+
type: "core::integer::u16"
|
|
4952
|
+
}
|
|
4953
|
+
],
|
|
4954
|
+
state_mutability: "view"
|
|
4955
|
+
},
|
|
4956
|
+
{
|
|
4957
|
+
type: "function",
|
|
4958
|
+
name: "protocol_fee_recipient",
|
|
4959
|
+
inputs: [],
|
|
4960
|
+
outputs: [
|
|
4961
|
+
{
|
|
4962
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
4963
|
+
}
|
|
4964
|
+
],
|
|
4965
|
+
state_mutability: "view"
|
|
4966
|
+
},
|
|
4967
|
+
{
|
|
4968
|
+
type: "function",
|
|
4969
|
+
name: "tournament_protocol_fee_bps",
|
|
4970
|
+
inputs: [
|
|
4971
|
+
{
|
|
4972
|
+
name: "tournament_id",
|
|
4973
|
+
type: "core::integer::u64"
|
|
4974
|
+
}
|
|
4975
|
+
],
|
|
4976
|
+
outputs: [
|
|
4977
|
+
{
|
|
4978
|
+
type: "core::integer::u16"
|
|
4979
|
+
}
|
|
4980
|
+
],
|
|
4981
|
+
state_mutability: "view"
|
|
4982
|
+
}
|
|
4983
|
+
]
|
|
4984
|
+
},
|
|
4985
|
+
{
|
|
4986
|
+
type: "event",
|
|
4987
|
+
name: "budokan::events::ProtocolFeeBpsUpdated",
|
|
4988
|
+
kind: "struct",
|
|
4989
|
+
members: [
|
|
4990
|
+
{
|
|
4991
|
+
name: "bps",
|
|
4992
|
+
type: "core::integer::u16",
|
|
4993
|
+
kind: "data"
|
|
4994
|
+
}
|
|
4995
|
+
]
|
|
4996
|
+
},
|
|
4997
|
+
{
|
|
4998
|
+
type: "event",
|
|
4999
|
+
name: "budokan::events::ProtocolFeeRecipientUpdated",
|
|
5000
|
+
kind: "struct",
|
|
5001
|
+
members: [
|
|
5002
|
+
{
|
|
5003
|
+
name: "recipient",
|
|
5004
|
+
type: "core::starknet::contract_address::ContractAddress",
|
|
5005
|
+
kind: "key"
|
|
4880
5006
|
}
|
|
4881
5007
|
]
|
|
4882
5008
|
}
|