Skip to content

Commit a513c09

Browse files
committed
new freebet fields
1 parent b31f0ec commit a513c09

File tree

7 files changed

+170
-27
lines changed

7 files changed

+170
-27
lines changed
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
22
"overview": "Overview",
3-
"distribute-freebets": "Distribute Freebets",
3+
"distribute-freebets": {
4+
"title": "Distribute Freebets",
5+
"type": "hidden"
6+
},
47
"use-freebets": "Use Freebets"
58
}

pages/hub/apps/sdk/bonus/useAvailableFreebets.mdx

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,30 @@ type Selection = {
3737
conditionId: string
3838
}
3939

40-
export enum BonusType {
40+
enum BonusType {
4141
FreeBet = 'FreeBet',
4242
}
4343

44-
export enum BonusStatus {
44+
enum BonusStatus {
4545
Used = 'Used',
4646
Available = 'Available',
4747
}
4848

49+
enum FreebetType {
50+
OnlyWin = 'OnlyWin',
51+
AllWin = 'AllWin',
52+
}
53+
54+
enum BetRestrictionType {
55+
Ordinar = 'Ordinar',
56+
Combo = 'Combo',
57+
}
58+
59+
enum EventRestrictionState {
60+
Live = 'Live',
61+
Prematch = 'Prematch',
62+
}
63+
4964
type BonusBase = {
5065
id: string
5166
type: BonusType,
@@ -57,13 +72,26 @@ type BonusBase = {
5772
createdAt: number
5873
}
5974

60-
export type Freebet = {
61-
type: BonusType.FreeBet,
75+
type Freebet = {
76+
type: BonusType.FreeBet
6277
params: {
63-
isBetSponsored: boolean,
64-
isFeeSponsored: boolean,
78+
isBetSponsored: boolean
79+
isFeeSponsored: boolean
6580
isSponsoredBetReturnable: boolean
6681
}
82+
settings: {
83+
type: FreebetType
84+
feeSponsored: boolean
85+
betRestriction: {
86+
type: BetRestrictionType | undefined
87+
minOdds: string
88+
maxOdds: string | undefined
89+
}
90+
eventRestriction: {
91+
state: EventRestrictionState | undefined
92+
}
93+
periodOfValidityMs: number
94+
}
6795
} & BonusBase
6896
```
6997

pages/hub/apps/sdk/bonus/useBonuses.mdx

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,30 @@ const activeFreebets = bonuses?.filter((freebet) => {
3838

3939

4040
```ts
41-
export enum BonusType {
41+
enum BonusType {
4242
FreeBet = 'FreeBet',
4343
}
4444

45-
export enum BonusStatus {
45+
enum BonusStatus {
4646
Used = 'Used',
4747
Available = 'Available',
4848
}
4949

50+
enum FreebetType {
51+
OnlyWin = 'OnlyWin',
52+
AllWin = 'AllWin',
53+
}
54+
55+
enum BetRestrictionType {
56+
Ordinar = 'Ordinar',
57+
Combo = 'Combo',
58+
}
59+
60+
enum EventRestrictionState {
61+
Live = 'Live',
62+
Prematch = 'Prematch',
63+
}
64+
5065
type BonusBase = {
5166
id: string
5267
type: BonusType,
@@ -58,13 +73,26 @@ type BonusBase = {
5873
createdAt: number
5974
}
6075

61-
export type Freebet = {
62-
type: BonusType.FreeBet,
76+
type Freebet = {
77+
type: BonusType.FreeBet
6378
params: {
64-
isBetSponsored: boolean,
65-
isFeeSponsored: boolean,
79+
isBetSponsored: boolean
80+
isFeeSponsored: boolean
6681
isSponsoredBetReturnable: boolean
6782
}
83+
settings: {
84+
type: FreebetType
85+
feeSponsored: boolean
86+
betRestriction: {
87+
type: BetRestrictionType | undefined
88+
minOdds: string
89+
maxOdds: string | undefined
90+
}
91+
eventRestriction: {
92+
state: EventRestrictionState | undefined
93+
}
94+
periodOfValidityMs: number
95+
}
6896
} & BonusBase
6997

7098
export type Bonus = Freebet

pages/hub/apps/sdk/write-hooks/useBet.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ const {...} = useBet({
107107
affiliate: Address // your affiliate address
108108
odds: Record<string, number>, // odds
109109
totalOdds: number, // total odds
110-
freebet?: FreeBet // freeBet info
110+
freebet?: Pick<Freebet, 'id' | 'params'> // freeBet info
111111
betGas?: Pick<SendTransactionParameters, 'gas' | 'gasPrice' | 'maxFeePerGas' | 'maxFeePerBlobGas' | 'maxPriorityFeePerGas'> // transaction gas parameters, prematch only
112112
selections: Selection[] // user's choice for bet
113113
liveEIP712Attention?: string // attention text for eip-712 sign (up to 160 chars)

pages/hub/apps/toolkit/bonus/getAvailableFreebets.mdx

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,21 @@ enum BonusStatus {
6868
Available = 'Available',
6969
}
7070

71+
enum FreebetType {
72+
OnlyWin = 'OnlyWin',
73+
AllWin = 'AllWin',
74+
}
75+
76+
enum BetRestrictionType {
77+
Ordinar = 'Ordinar',
78+
Combo = 'Combo',
79+
}
80+
81+
enum EventRestrictionState {
82+
Live = 'Live',
83+
Prematch = 'Prematch',
84+
}
85+
7186
type BonusBase = {
7287
id: string
7388
type: BonusType,
@@ -80,11 +95,24 @@ type BonusBase = {
8095
}
8196

8297
type Freebet = {
83-
type: BonusType.FreeBet,
98+
type: BonusType.FreeBet
8499
params: {
85-
isBetSponsored: boolean,
86-
isFeeSponsored: boolean,
100+
isBetSponsored: boolean
101+
isFeeSponsored: boolean
87102
isSponsoredBetReturnable: boolean
88103
}
104+
settings: {
105+
type: FreebetType
106+
feeSponsored: boolean
107+
betRestriction: {
108+
type: BetRestrictionType | undefined
109+
minOdds: string
110+
maxOdds: string | undefined
111+
}
112+
eventRestriction: {
113+
state: EventRestrictionState | undefined
114+
}
115+
periodOfValidityMs: number
116+
}
89117
} & BonusBase
90118
```

pages/hub/apps/toolkit/bonus/getBonuses.mdx

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,21 @@ enum BonusStatus {
6565
Available = 'Available',
6666
}
6767

68+
enum FreebetType {
69+
OnlyWin = 'OnlyWin',
70+
AllWin = 'AllWin',
71+
}
72+
73+
enum BetRestrictionType {
74+
Ordinar = 'Ordinar',
75+
Combo = 'Combo',
76+
}
77+
78+
enum EventRestrictionState {
79+
Live = 'Live',
80+
Prematch = 'Prematch',
81+
}
82+
6883
type BonusBase = {
6984
id: string
7085
type: BonusType,
@@ -77,12 +92,25 @@ type BonusBase = {
7792
}
7893

7994
type Freebet = {
80-
type: BonusType.FreeBet,
95+
type: BonusType.FreeBet
8196
params: {
82-
isBetSponsored: boolean,
83-
isFeeSponsored: boolean,
97+
isBetSponsored: boolean
98+
isFeeSponsored: boolean
8499
isSponsoredBetReturnable: boolean
85100
}
101+
settings: {
102+
type: FreebetType
103+
feeSponsored: boolean
104+
betRestriction: {
105+
type: BetRestrictionType | undefined
106+
minOdds: string
107+
maxOdds: string | undefined
108+
}
109+
eventRestriction: {
110+
state: EventRestrictionState | undefined
111+
}
112+
periodOfValidityMs: number
113+
}
86114
} & BonusBase
87115

88116
type Bonus = Freebet

pages/hub/protocol-v3/sdk-migration-guide-v6.mdx

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -476,15 +476,30 @@ type Selection = {
476476
conditionId: string
477477
}
478478

479-
export enum BonusType {
479+
enum BonusType {
480480
FreeBet = 'FreeBet',
481481
}
482482

483-
export enum BonusStatus {
483+
enum BonusStatus {
484484
Used = 'Used',
485485
Available = 'Available',
486486
}
487487

488+
enum FreebetType {
489+
OnlyWin = 'OnlyWin',
490+
AllWin = 'AllWin',
491+
}
492+
493+
enum BetRestrictionType {
494+
Ordinar = 'Ordinar',
495+
Combo = 'Combo',
496+
}
497+
498+
enum EventRestrictionState {
499+
Live = 'Live',
500+
Prematch = 'Prematch',
501+
}
502+
488503
type BonusBase = {
489504
id: string
490505
type: BonusType,
@@ -496,16 +511,29 @@ type BonusBase = {
496511
createdAt: number
497512
}
498513

499-
export type Freebet = {
500-
type: BonusType.FreeBet,
514+
type Freebet = {
515+
type: BonusType.FreeBet
501516
params: {
502-
isBetSponsored: boolean,
503-
isFeeSponsored: boolean,
517+
isBetSponsored: boolean
518+
isFeeSponsored: boolean
504519
isSponsoredBetReturnable: boolean
505520
}
521+
settings: {
522+
type: FreebetType
523+
feeSponsored: boolean
524+
betRestriction: {
525+
type: BetRestrictionType | undefined
526+
minOdds: string
527+
maxOdds: string | undefined
528+
}
529+
eventRestriction: {
530+
state: EventRestrictionState | undefined
531+
}
532+
periodOfValidityMs: number
533+
}
506534
} & BonusBase
507535

508-
export type Bonus = Freebet
536+
type Bonus = Freebet
509537
```
510538
511539
### Retrieve All Bonuses

0 commit comments

Comments
 (0)