@azuro-org/toolkit 4.5.4 → 4.6.0-beta.1

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.
@@ -0,0 +1,302 @@
1
+ declare const _default: readonly [{
2
+ readonly inputs: readonly [];
3
+ readonly name: "CashBackExpired";
4
+ readonly type: "error";
5
+ }, {
6
+ readonly inputs: readonly [];
7
+ readonly name: "CashBackIdAlreadyWithdrawn";
8
+ readonly type: "error";
9
+ }, {
10
+ readonly inputs: readonly [];
11
+ readonly name: "ECDSAInvalidSignature";
12
+ readonly type: "error";
13
+ }, {
14
+ readonly inputs: readonly [{
15
+ readonly internalType: "uint256";
16
+ readonly name: "length";
17
+ readonly type: "uint256";
18
+ }];
19
+ readonly name: "ECDSAInvalidSignatureLength";
20
+ readonly type: "error";
21
+ }, {
22
+ readonly inputs: readonly [{
23
+ readonly internalType: "bytes32";
24
+ readonly name: "s";
25
+ readonly type: "bytes32";
26
+ }];
27
+ readonly name: "ECDSAInvalidSignatureS";
28
+ readonly type: "error";
29
+ }, {
30
+ readonly inputs: readonly [];
31
+ readonly name: "IncorrectAccount";
32
+ readonly type: "error";
33
+ }, {
34
+ readonly inputs: readonly [];
35
+ readonly name: "IncorrectAffiliate";
36
+ readonly type: "error";
37
+ }, {
38
+ readonly inputs: readonly [];
39
+ readonly name: "IncorrectCashBackContractAddress";
40
+ readonly type: "error";
41
+ }, {
42
+ readonly inputs: readonly [];
43
+ readonly name: "IncorrectChainId";
44
+ readonly type: "error";
45
+ }, {
46
+ readonly inputs: readonly [];
47
+ readonly name: "InsufficientContractBalance";
48
+ readonly type: "error";
49
+ }, {
50
+ readonly inputs: readonly [];
51
+ readonly name: "InvalidInitialization";
52
+ readonly type: "error";
53
+ }, {
54
+ readonly inputs: readonly [];
55
+ readonly name: "InvalidSignature";
56
+ readonly type: "error";
57
+ }, {
58
+ readonly inputs: readonly [];
59
+ readonly name: "NotInitializing";
60
+ readonly type: "error";
61
+ }, {
62
+ readonly inputs: readonly [{
63
+ readonly internalType: "address";
64
+ readonly name: "owner";
65
+ readonly type: "address";
66
+ }];
67
+ readonly name: "OwnableInvalidOwner";
68
+ readonly type: "error";
69
+ }, {
70
+ readonly inputs: readonly [{
71
+ readonly internalType: "address";
72
+ readonly name: "account";
73
+ readonly type: "address";
74
+ }];
75
+ readonly name: "OwnableUnauthorizedAccount";
76
+ readonly type: "error";
77
+ }, {
78
+ readonly inputs: readonly [{
79
+ readonly internalType: "address";
80
+ readonly name: "token";
81
+ readonly type: "address";
82
+ }];
83
+ readonly name: "SafeERC20FailedOperation";
84
+ readonly type: "error";
85
+ }, {
86
+ readonly anonymous: false;
87
+ readonly inputs: readonly [{
88
+ readonly components: readonly [{
89
+ readonly internalType: "uint256";
90
+ readonly name: "chainId";
91
+ readonly type: "uint256";
92
+ }, {
93
+ readonly internalType: "address";
94
+ readonly name: "cashBackContract";
95
+ readonly type: "address";
96
+ }, {
97
+ readonly internalType: "address";
98
+ readonly name: "affiliate";
99
+ readonly type: "address";
100
+ }, {
101
+ readonly internalType: "address";
102
+ readonly name: "token";
103
+ readonly type: "address";
104
+ }, {
105
+ readonly internalType: "address";
106
+ readonly name: "account";
107
+ readonly type: "address";
108
+ }, {
109
+ readonly internalType: "uint256";
110
+ readonly name: "amount";
111
+ readonly type: "uint256";
112
+ }, {
113
+ readonly internalType: "uint256";
114
+ readonly name: "id";
115
+ readonly type: "uint256";
116
+ }, {
117
+ readonly internalType: "uint256";
118
+ readonly name: "expiresAt";
119
+ readonly type: "uint256";
120
+ }];
121
+ readonly indexed: false;
122
+ readonly internalType: "struct ICashBack.CashBackData";
123
+ readonly name: "data";
124
+ readonly type: "tuple";
125
+ }];
126
+ readonly name: "CashBackWithdrawn";
127
+ readonly type: "event";
128
+ }, {
129
+ readonly anonymous: false;
130
+ readonly inputs: readonly [{
131
+ readonly indexed: false;
132
+ readonly internalType: "uint64";
133
+ readonly name: "version";
134
+ readonly type: "uint64";
135
+ }];
136
+ readonly name: "Initialized";
137
+ readonly type: "event";
138
+ }, {
139
+ readonly anonymous: false;
140
+ readonly inputs: readonly [{
141
+ readonly indexed: false;
142
+ readonly internalType: "address";
143
+ readonly name: "newManager";
144
+ readonly type: "address";
145
+ }];
146
+ readonly name: "ManagerChanged";
147
+ readonly type: "event";
148
+ }, {
149
+ readonly anonymous: false;
150
+ readonly inputs: readonly [{
151
+ readonly indexed: true;
152
+ readonly internalType: "address";
153
+ readonly name: "previousOwner";
154
+ readonly type: "address";
155
+ }, {
156
+ readonly indexed: true;
157
+ readonly internalType: "address";
158
+ readonly name: "newOwner";
159
+ readonly type: "address";
160
+ }];
161
+ readonly name: "OwnershipTransferred";
162
+ readonly type: "event";
163
+ }, {
164
+ readonly inputs: readonly [{
165
+ readonly internalType: "address";
166
+ readonly name: "affiliate";
167
+ readonly type: "address";
168
+ }, {
169
+ readonly internalType: "address";
170
+ readonly name: "manager_";
171
+ readonly type: "address";
172
+ }];
173
+ readonly name: "initialize";
174
+ readonly outputs: readonly [];
175
+ readonly stateMutability: "nonpayable";
176
+ readonly type: "function";
177
+ }, {
178
+ readonly inputs: readonly [{
179
+ readonly internalType: "uint256";
180
+ readonly name: "";
181
+ readonly type: "uint256";
182
+ }];
183
+ readonly name: "isWithdrawn";
184
+ readonly outputs: readonly [{
185
+ readonly internalType: "bool";
186
+ readonly name: "";
187
+ readonly type: "bool";
188
+ }];
189
+ readonly stateMutability: "view";
190
+ readonly type: "function";
191
+ }, {
192
+ readonly inputs: readonly [];
193
+ readonly name: "manager";
194
+ readonly outputs: readonly [{
195
+ readonly internalType: "address";
196
+ readonly name: "";
197
+ readonly type: "address";
198
+ }];
199
+ readonly stateMutability: "view";
200
+ readonly type: "function";
201
+ }, {
202
+ readonly inputs: readonly [];
203
+ readonly name: "owner";
204
+ readonly outputs: readonly [{
205
+ readonly internalType: "address";
206
+ readonly name: "";
207
+ readonly type: "address";
208
+ }];
209
+ readonly stateMutability: "view";
210
+ readonly type: "function";
211
+ }, {
212
+ readonly inputs: readonly [];
213
+ readonly name: "renounceOwnership";
214
+ readonly outputs: readonly [];
215
+ readonly stateMutability: "nonpayable";
216
+ readonly type: "function";
217
+ }, {
218
+ readonly inputs: readonly [{
219
+ readonly internalType: "address";
220
+ readonly name: "manager_";
221
+ readonly type: "address";
222
+ }];
223
+ readonly name: "setManager";
224
+ readonly outputs: readonly [];
225
+ readonly stateMutability: "nonpayable";
226
+ readonly type: "function";
227
+ }, {
228
+ readonly inputs: readonly [{
229
+ readonly internalType: "address";
230
+ readonly name: "newOwner";
231
+ readonly type: "address";
232
+ }];
233
+ readonly name: "transferOwnership";
234
+ readonly outputs: readonly [];
235
+ readonly stateMutability: "nonpayable";
236
+ readonly type: "function";
237
+ }, {
238
+ readonly inputs: readonly [{
239
+ readonly components: readonly [{
240
+ readonly internalType: "uint256";
241
+ readonly name: "chainId";
242
+ readonly type: "uint256";
243
+ }, {
244
+ readonly internalType: "address";
245
+ readonly name: "cashBackContract";
246
+ readonly type: "address";
247
+ }, {
248
+ readonly internalType: "address";
249
+ readonly name: "affiliate";
250
+ readonly type: "address";
251
+ }, {
252
+ readonly internalType: "address";
253
+ readonly name: "token";
254
+ readonly type: "address";
255
+ }, {
256
+ readonly internalType: "address";
257
+ readonly name: "account";
258
+ readonly type: "address";
259
+ }, {
260
+ readonly internalType: "uint256";
261
+ readonly name: "amount";
262
+ readonly type: "uint256";
263
+ }, {
264
+ readonly internalType: "uint256";
265
+ readonly name: "id";
266
+ readonly type: "uint256";
267
+ }, {
268
+ readonly internalType: "uint256";
269
+ readonly name: "expiresAt";
270
+ readonly type: "uint256";
271
+ }];
272
+ readonly internalType: "struct ICashBack.CashBackData";
273
+ readonly name: "data";
274
+ readonly type: "tuple";
275
+ }, {
276
+ readonly internalType: "bytes";
277
+ readonly name: "signature";
278
+ readonly type: "bytes";
279
+ }];
280
+ readonly name: "withdrawCashBack";
281
+ readonly outputs: readonly [];
282
+ readonly stateMutability: "nonpayable";
283
+ readonly type: "function";
284
+ }, {
285
+ readonly inputs: readonly [{
286
+ readonly internalType: "address";
287
+ readonly name: "token";
288
+ readonly type: "address";
289
+ }, {
290
+ readonly internalType: "uint256";
291
+ readonly name: "amount";
292
+ readonly type: "uint256";
293
+ }];
294
+ readonly name: "withdrawReserve";
295
+ readonly outputs: readonly [];
296
+ readonly stateMutability: "nonpayable";
297
+ readonly type: "function";
298
+ }, {
299
+ readonly stateMutability: "payable";
300
+ readonly type: "receive";
301
+ }];
302
+ export default _default;
@@ -4,3 +4,4 @@ export { default as prematchComboCoreAbi } from './PrematchComboCore';
4
4
  export { default as prematchCoreAbi } from './PrematchCore';
5
5
  export { default as proxyFrontAbi } from './ProxyFront';
6
6
  export { default as freeBetAbi } from './FreeBet';
7
+ export { default as cashbackAbi } from './Cashback';
@@ -10,6 +10,7 @@ export type GameBetsQuery = {
10
10
  rawAmount: string;
11
11
  rawPotentialPayout: string;
12
12
  result?: Types.BetResult | null;
13
+ isCashedOut: boolean;
13
14
  selections: Array<{
14
15
  __typename?: 'Selection';
15
16
  rawOdds: string;
@@ -36,6 +37,7 @@ export type GameBetsQuery = {
36
37
  rawAmount: string;
37
38
  rawPotentialPayout: string;
38
39
  result?: Types.BetResult | null;
40
+ isCashedOut: boolean;
39
41
  selections: Array<{
40
42
  __typename?: 'LiveSelection';
41
43
  outcome: {
package/dist/index.d.ts CHANGED
@@ -32,3 +32,5 @@ export { getCalculatedCashout, type GetCalculatedCashout } from './utils/cashout
32
32
  export { getCashoutTypedData } from './utils/cashout/getCashoutTypedData';
33
33
  export { createCashout, CashoutState, type CreateCashoutResponse } from './utils/cashout/createCashout';
34
34
  export { getCashout, type GetCashoutResponse } from './utils/cashout/getCashout';
35
+ export { getCashbackBalance, type GetCashbackBalance } from './utils/cashback/getCashbackBalance';
36
+ export { createCashbackTransaction, type CashbackTransaction } from './utils/cashback/createCashbackTransaction';
package/dist/index.js CHANGED
@@ -3859,7 +3859,7 @@ const environments = {
3859
3859
  'stateMutability': 'payable',
3860
3860
  'type': 'receive',
3861
3861
  },
3862
- ];var FreeBet = [{ 'inputs': [], 'name': 'AlreadyResolved', 'type': 'error' }, { 'inputs': [], 'name': 'BetAlreadyClaimed', 'type': 'error' }, { 'inputs': [], 'name': 'BetExpired', 'type': 'error' }, { 'inputs': [], 'name': 'IncorrectChainId', 'type': 'error' }, { 'inputs': [], 'name': 'InsufficientContractBalance', 'type': 'error' }, { 'inputs': [], 'name': 'InvalidSignature', 'type': 'error' }, { 'inputs': [], 'name': 'OnlyBetOwner', 'type': 'error' }, { 'inputs': [], 'name': 'OnlyFreeBetOwner', 'type': 'error' }, { 'inputs': [], 'name': 'OnlyManager', 'type': 'error' }, { 'inputs': [], 'name': 'SmallMinOdds', 'type': 'error' }, { 'anonymous': false, 'inputs': [{ 'indexed': false, 'internalType': 'address', 'name': 'newAffiliate', 'type': 'address' }], 'name': 'AffiliateChanged', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': true, 'internalType': 'address', 'name': 'core', 'type': 'address' }, { 'indexed': true, 'internalType': 'address', 'name': 'bettor', 'type': 'address' }, { 'indexed': true, 'internalType': 'uint256', 'name': 'freeBetId', 'type': 'uint256' }, { 'indexed': false, 'internalType': 'uint256', 'name': 'amount', 'type': 'uint256' }], 'name': 'BettorWin', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': false, 'internalType': 'uint8', 'name': 'version', 'type': 'uint8' }], 'name': 'Initialized', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': true, 'internalType': 'address', 'name': 'newLp', 'type': 'address' }], 'name': 'LpChanged', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': false, 'internalType': 'address', 'name': 'newManager', 'type': 'address' }], 'name': 'ManagerChanged', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': true, 'internalType': 'uint256', 'name': 'freeBetId', 'type': 'uint256' }, { 'indexed': false, 'internalType': 'address', 'name': 'core', 'type': 'address' }, { 'indexed': true, 'internalType': 'address', 'name': 'bettor', 'type': 'address' }, { 'indexed': true, 'internalType': 'uint256', 'name': 'azuroBetId', 'type': 'uint256' }, { 'indexed': false, 'internalType': 'uint128', 'name': 'amount', 'type': 'uint128' }, { 'indexed': false, 'internalType': 'uint64', 'name': 'minOdds', 'type': 'uint64' }, { 'indexed': false, 'internalType': 'uint64', 'name': 'expiresAt', 'type': 'uint64' }], 'name': 'NewBet', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': true, 'internalType': 'address', 'name': 'previousOwner', 'type': 'address' }, { 'indexed': true, 'internalType': 'address', 'name': 'newOwner', 'type': 'address' }], 'name': 'OwnershipTransferred', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': false, 'internalType': 'uint256[]', 'name': 'azuroBetId', 'type': 'uint256[]' }], 'name': 'PayoutsResolved', 'type': 'event' }, { 'inputs': [], 'name': 'affiliate', 'outputs': [{ 'internalType': 'address', 'name': '', 'type': 'address' }], 'stateMutability': 'view', 'type': 'function' }, { 'inputs': [{ 'components': [{ 'internalType': 'uint256', 'name': 'chainId', 'type': 'uint256' }, { 'internalType': 'uint256', 'name': 'freeBetId', 'type': 'uint256' }, { 'internalType': 'address', 'name': 'owner', 'type': 'address' }, { 'internalType': 'uint128', 'name': 'amount', 'type': 'uint128' }, { 'internalType': 'uint64', 'name': 'minOdds', 'type': 'uint64' }, { 'internalType': 'uint64', 'name': 'expiresAt', 'type': 'uint64' }], 'internalType': 'struct IFreeBet.FreeBetData', 'name': 'freeBetData', 'type': 'tuple' }, { 'internalType': 'bytes', 'name': 'signature', 'type': 'bytes' }, { 'internalType': 'address', 'name': 'core', 'type': 'address' }, { 'internalType': 'uint256', 'name': 'conditionId', 'type': 'uint256' }, { 'internalType': 'uint64', 'name': 'outcomeId', 'type': 'uint64' }, { 'internalType': 'uint64', 'name': 'deadline', 'type': 'uint64' }, { 'internalType': 'uint64', 'name': 'minOdds', 'type': 'uint64' }], 'name': 'bet', 'outputs': [{ 'internalType': 'uint256', 'name': 'azuroBetId', 'type': 'uint256' }], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [{ 'internalType': 'address', 'name': 'account', 'type': 'address' }], 'name': 'checkOwner', 'outputs': [], 'stateMutability': 'view', 'type': 'function' }, { 'inputs': [{ 'internalType': 'uint256', 'name': '', 'type': 'uint256' }], 'name': 'freeBets', 'outputs': [{ 'internalType': 'address', 'name': 'owner', 'type': 'address' }, { 'internalType': 'address', 'name': 'core', 'type': 'address' }, { 'internalType': 'uint256', 'name': 'azuroBetId', 'type': 'uint256' }, { 'internalType': 'uint128', 'name': 'amount', 'type': 'uint128' }, { 'internalType': 'uint128', 'name': 'payout', 'type': 'uint128' }], 'stateMutability': 'view', 'type': 'function' }, { 'inputs': [{ 'internalType': 'address', 'name': 'lpAddress', 'type': 'address' }, { 'internalType': 'address', 'name': 'affiliate_', 'type': 'address' }, { 'internalType': 'address', 'name': 'manager_', 'type': 'address' }], 'name': 'initialize', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [], 'name': 'lockedReserve', 'outputs': [{ 'internalType': 'uint256', 'name': '', 'type': 'uint256' }], 'stateMutability': 'view', 'type': 'function' }, { 'inputs': [], 'name': 'lp', 'outputs': [{ 'internalType': 'contract ILP', 'name': '', 'type': 'address' }], 'stateMutability': 'view', 'type': 'function' }, { 'inputs': [], 'name': 'manager', 'outputs': [{ 'internalType': 'address', 'name': '', 'type': 'address' }], 'stateMutability': 'view', 'type': 'function' }, { 'inputs': [], 'name': 'owner', 'outputs': [{ 'internalType': 'address', 'name': '', 'type': 'address' }], 'stateMutability': 'view', 'type': 'function' }, { 'inputs': [{ 'internalType': 'uint256[]', 'name': 'freeBetIds', 'type': 'uint256[]' }], 'name': 'resolvePayout', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [{ 'internalType': 'address', 'name': 'affiliate_', 'type': 'address' }], 'name': 'setAffiliate', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [{ 'internalType': 'address', 'name': 'lp_', 'type': 'address' }], 'name': 'setLp', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [{ 'internalType': 'address', 'name': 'manager_', 'type': 'address' }], 'name': 'setManager', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [], 'name': 'token', 'outputs': [{ 'internalType': 'address', 'name': '', 'type': 'address' }], 'stateMutability': 'view', 'type': 'function' }, { 'inputs': [{ 'internalType': 'address', 'name': 'newOwner', 'type': 'address' }], 'name': 'transferOwnership', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [{ 'internalType': 'uint256', 'name': 'freeBetId', 'type': 'uint256' }], 'name': 'withdrawPayout', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [{ 'internalType': 'uint256', 'name': 'amount', 'type': 'uint256' }], 'name': 'withdrawReserve', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'stateMutability': 'payable', 'type': 'receive' }];const setupContracts = ({ lp, prematchCore, prematchComboCore, proxyFront, azuroBet, cashout, liveRelayer, liveCore, }) => {
3862
+ ];var FreeBet = [{ 'inputs': [], 'name': 'AlreadyResolved', 'type': 'error' }, { 'inputs': [], 'name': 'BetAlreadyClaimed', 'type': 'error' }, { 'inputs': [], 'name': 'BetExpired', 'type': 'error' }, { 'inputs': [], 'name': 'IncorrectChainId', 'type': 'error' }, { 'inputs': [], 'name': 'InsufficientContractBalance', 'type': 'error' }, { 'inputs': [], 'name': 'InvalidSignature', 'type': 'error' }, { 'inputs': [], 'name': 'OnlyBetOwner', 'type': 'error' }, { 'inputs': [], 'name': 'OnlyFreeBetOwner', 'type': 'error' }, { 'inputs': [], 'name': 'OnlyManager', 'type': 'error' }, { 'inputs': [], 'name': 'SmallMinOdds', 'type': 'error' }, { 'anonymous': false, 'inputs': [{ 'indexed': false, 'internalType': 'address', 'name': 'newAffiliate', 'type': 'address' }], 'name': 'AffiliateChanged', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': true, 'internalType': 'address', 'name': 'core', 'type': 'address' }, { 'indexed': true, 'internalType': 'address', 'name': 'bettor', 'type': 'address' }, { 'indexed': true, 'internalType': 'uint256', 'name': 'freeBetId', 'type': 'uint256' }, { 'indexed': false, 'internalType': 'uint256', 'name': 'amount', 'type': 'uint256' }], 'name': 'BettorWin', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': false, 'internalType': 'uint8', 'name': 'version', 'type': 'uint8' }], 'name': 'Initialized', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': true, 'internalType': 'address', 'name': 'newLp', 'type': 'address' }], 'name': 'LpChanged', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': false, 'internalType': 'address', 'name': 'newManager', 'type': 'address' }], 'name': 'ManagerChanged', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': true, 'internalType': 'uint256', 'name': 'freeBetId', 'type': 'uint256' }, { 'indexed': false, 'internalType': 'address', 'name': 'core', 'type': 'address' }, { 'indexed': true, 'internalType': 'address', 'name': 'bettor', 'type': 'address' }, { 'indexed': true, 'internalType': 'uint256', 'name': 'azuroBetId', 'type': 'uint256' }, { 'indexed': false, 'internalType': 'uint128', 'name': 'amount', 'type': 'uint128' }, { 'indexed': false, 'internalType': 'uint64', 'name': 'minOdds', 'type': 'uint64' }, { 'indexed': false, 'internalType': 'uint64', 'name': 'expiresAt', 'type': 'uint64' }], 'name': 'NewBet', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': true, 'internalType': 'address', 'name': 'previousOwner', 'type': 'address' }, { 'indexed': true, 'internalType': 'address', 'name': 'newOwner', 'type': 'address' }], 'name': 'OwnershipTransferred', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': false, 'internalType': 'uint256[]', 'name': 'azuroBetId', 'type': 'uint256[]' }], 'name': 'PayoutsResolved', 'type': 'event' }, { 'inputs': [], 'name': 'affiliate', 'outputs': [{ 'internalType': 'address', 'name': '', 'type': 'address' }], 'stateMutability': 'view', 'type': 'function' }, { 'inputs': [{ 'components': [{ 'internalType': 'uint256', 'name': 'chainId', 'type': 'uint256' }, { 'internalType': 'uint256', 'name': 'freeBetId', 'type': 'uint256' }, { 'internalType': 'address', 'name': 'owner', 'type': 'address' }, { 'internalType': 'uint128', 'name': 'amount', 'type': 'uint128' }, { 'internalType': 'uint64', 'name': 'minOdds', 'type': 'uint64' }, { 'internalType': 'uint64', 'name': 'expiresAt', 'type': 'uint64' }], 'internalType': 'struct IFreeBet.FreeBetData', 'name': 'freeBetData', 'type': 'tuple' }, { 'internalType': 'bytes', 'name': 'signature', 'type': 'bytes' }, { 'internalType': 'address', 'name': 'core', 'type': 'address' }, { 'internalType': 'uint256', 'name': 'conditionId', 'type': 'uint256' }, { 'internalType': 'uint64', 'name': 'outcomeId', 'type': 'uint64' }, { 'internalType': 'uint64', 'name': 'deadline', 'type': 'uint64' }, { 'internalType': 'uint64', 'name': 'minOdds', 'type': 'uint64' }], 'name': 'bet', 'outputs': [{ 'internalType': 'uint256', 'name': 'azuroBetId', 'type': 'uint256' }], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [{ 'internalType': 'address', 'name': 'account', 'type': 'address' }], 'name': 'checkOwner', 'outputs': [], 'stateMutability': 'view', 'type': 'function' }, { 'inputs': [{ 'internalType': 'uint256', 'name': '', 'type': 'uint256' }], 'name': 'freeBets', 'outputs': [{ 'internalType': 'address', 'name': 'owner', 'type': 'address' }, { 'internalType': 'address', 'name': 'core', 'type': 'address' }, { 'internalType': 'uint256', 'name': 'azuroBetId', 'type': 'uint256' }, { 'internalType': 'uint128', 'name': 'amount', 'type': 'uint128' }, { 'internalType': 'uint128', 'name': 'payout', 'type': 'uint128' }], 'stateMutability': 'view', 'type': 'function' }, { 'inputs': [{ 'internalType': 'address', 'name': 'lpAddress', 'type': 'address' }, { 'internalType': 'address', 'name': 'affiliate_', 'type': 'address' }, { 'internalType': 'address', 'name': 'manager_', 'type': 'address' }], 'name': 'initialize', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [], 'name': 'lockedReserve', 'outputs': [{ 'internalType': 'uint256', 'name': '', 'type': 'uint256' }], 'stateMutability': 'view', 'type': 'function' }, { 'inputs': [], 'name': 'lp', 'outputs': [{ 'internalType': 'contract ILP', 'name': '', 'type': 'address' }], 'stateMutability': 'view', 'type': 'function' }, { 'inputs': [], 'name': 'manager', 'outputs': [{ 'internalType': 'address', 'name': '', 'type': 'address' }], 'stateMutability': 'view', 'type': 'function' }, { 'inputs': [], 'name': 'owner', 'outputs': [{ 'internalType': 'address', 'name': '', 'type': 'address' }], 'stateMutability': 'view', 'type': 'function' }, { 'inputs': [{ 'internalType': 'uint256[]', 'name': 'freeBetIds', 'type': 'uint256[]' }], 'name': 'resolvePayout', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [{ 'internalType': 'address', 'name': 'affiliate_', 'type': 'address' }], 'name': 'setAffiliate', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [{ 'internalType': 'address', 'name': 'lp_', 'type': 'address' }], 'name': 'setLp', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [{ 'internalType': 'address', 'name': 'manager_', 'type': 'address' }], 'name': 'setManager', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [], 'name': 'token', 'outputs': [{ 'internalType': 'address', 'name': '', 'type': 'address' }], 'stateMutability': 'view', 'type': 'function' }, { 'inputs': [{ 'internalType': 'address', 'name': 'newOwner', 'type': 'address' }], 'name': 'transferOwnership', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [{ 'internalType': 'uint256', 'name': 'freeBetId', 'type': 'uint256' }], 'name': 'withdrawPayout', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [{ 'internalType': 'uint256', 'name': 'amount', 'type': 'uint256' }], 'name': 'withdrawReserve', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'stateMutability': 'payable', 'type': 'receive' }];var cashbackAbi = [{ 'inputs': [], 'name': 'CashBackExpired', 'type': 'error' }, { 'inputs': [], 'name': 'CashBackIdAlreadyWithdrawn', 'type': 'error' }, { 'inputs': [], 'name': 'ECDSAInvalidSignature', 'type': 'error' }, { 'inputs': [{ 'internalType': 'uint256', 'name': 'length', 'type': 'uint256' }], 'name': 'ECDSAInvalidSignatureLength', 'type': 'error' }, { 'inputs': [{ 'internalType': 'bytes32', 'name': 's', 'type': 'bytes32' }], 'name': 'ECDSAInvalidSignatureS', 'type': 'error' }, { 'inputs': [], 'name': 'IncorrectAccount', 'type': 'error' }, { 'inputs': [], 'name': 'IncorrectAffiliate', 'type': 'error' }, { 'inputs': [], 'name': 'IncorrectCashBackContractAddress', 'type': 'error' }, { 'inputs': [], 'name': 'IncorrectChainId', 'type': 'error' }, { 'inputs': [], 'name': 'InsufficientContractBalance', 'type': 'error' }, { 'inputs': [], 'name': 'InvalidInitialization', 'type': 'error' }, { 'inputs': [], 'name': 'InvalidSignature', 'type': 'error' }, { 'inputs': [], 'name': 'NotInitializing', 'type': 'error' }, { 'inputs': [{ 'internalType': 'address', 'name': 'owner', 'type': 'address' }], 'name': 'OwnableInvalidOwner', 'type': 'error' }, { 'inputs': [{ 'internalType': 'address', 'name': 'account', 'type': 'address' }], 'name': 'OwnableUnauthorizedAccount', 'type': 'error' }, { 'inputs': [{ 'internalType': 'address', 'name': 'token', 'type': 'address' }], 'name': 'SafeERC20FailedOperation', 'type': 'error' }, { 'anonymous': false, 'inputs': [{ 'components': [{ 'internalType': 'uint256', 'name': 'chainId', 'type': 'uint256' }, { 'internalType': 'address', 'name': 'cashBackContract', 'type': 'address' }, { 'internalType': 'address', 'name': 'affiliate', 'type': 'address' }, { 'internalType': 'address', 'name': 'token', 'type': 'address' }, { 'internalType': 'address', 'name': 'account', 'type': 'address' }, { 'internalType': 'uint256', 'name': 'amount', 'type': 'uint256' }, { 'internalType': 'uint256', 'name': 'id', 'type': 'uint256' }, { 'internalType': 'uint256', 'name': 'expiresAt', 'type': 'uint256' }], 'indexed': false, 'internalType': 'struct ICashBack.CashBackData', 'name': 'data', 'type': 'tuple' }], 'name': 'CashBackWithdrawn', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': false, 'internalType': 'uint64', 'name': 'version', 'type': 'uint64' }], 'name': 'Initialized', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': false, 'internalType': 'address', 'name': 'newManager', 'type': 'address' }], 'name': 'ManagerChanged', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': true, 'internalType': 'address', 'name': 'previousOwner', 'type': 'address' }, { 'indexed': true, 'internalType': 'address', 'name': 'newOwner', 'type': 'address' }], 'name': 'OwnershipTransferred', 'type': 'event' }, { 'inputs': [{ 'internalType': 'address', 'name': 'affiliate', 'type': 'address' }, { 'internalType': 'address', 'name': 'manager_', 'type': 'address' }], 'name': 'initialize', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [{ 'internalType': 'uint256', 'name': '', 'type': 'uint256' }], 'name': 'isWithdrawn', 'outputs': [{ 'internalType': 'bool', 'name': '', 'type': 'bool' }], 'stateMutability': 'view', 'type': 'function' }, { 'inputs': [], 'name': 'manager', 'outputs': [{ 'internalType': 'address', 'name': '', 'type': 'address' }], 'stateMutability': 'view', 'type': 'function' }, { 'inputs': [], 'name': 'owner', 'outputs': [{ 'internalType': 'address', 'name': '', 'type': 'address' }], 'stateMutability': 'view', 'type': 'function' }, { 'inputs': [], 'name': 'renounceOwnership', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [{ 'internalType': 'address', 'name': 'manager_', 'type': 'address' }], 'name': 'setManager', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [{ 'internalType': 'address', 'name': 'newOwner', 'type': 'address' }], 'name': 'transferOwnership', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [{ 'components': [{ 'internalType': 'uint256', 'name': 'chainId', 'type': 'uint256' }, { 'internalType': 'address', 'name': 'cashBackContract', 'type': 'address' }, { 'internalType': 'address', 'name': 'affiliate', 'type': 'address' }, { 'internalType': 'address', 'name': 'token', 'type': 'address' }, { 'internalType': 'address', 'name': 'account', 'type': 'address' }, { 'internalType': 'uint256', 'name': 'amount', 'type': 'uint256' }, { 'internalType': 'uint256', 'name': 'id', 'type': 'uint256' }, { 'internalType': 'uint256', 'name': 'expiresAt', 'type': 'uint256' }], 'internalType': 'struct ICashBack.CashBackData', 'name': 'data', 'type': 'tuple' }, { 'internalType': 'bytes', 'name': 'signature', 'type': 'bytes' }], 'name': 'withdrawCashBack', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [{ 'internalType': 'address', 'name': 'token', 'type': 'address' }, { 'internalType': 'uint256', 'name': 'amount', 'type': 'uint256' }], 'name': 'withdrawReserve', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'stateMutability': 'payable', 'type': 'receive' }];const setupContracts = ({ lp, prematchCore, prematchComboCore, proxyFront, azuroBet, cashout, liveRelayer, liveCore, }) => {
3863
3863
  const contracts = {
3864
3864
  lp: {
3865
3865
  address: lp,
@@ -4462,6 +4462,7 @@ const chainsDataByEnv = {
4462
4462
  rawAmount
4463
4463
  rawPotentialPayout
4464
4464
  result
4465
+ isCashedOut
4465
4466
  selections {
4466
4467
  rawOdds
4467
4468
  outcome {
@@ -4482,6 +4483,7 @@ const chainsDataByEnv = {
4482
4483
  rawAmount
4483
4484
  rawPotentialPayout
4484
4485
  result
4486
+ isCashedOut
4485
4487
  selections {
4486
4488
  outcome {
4487
4489
  outcomeId
@@ -6226,4 +6228,65 @@ const createCashout = async (props) => {
6226
6228
  }
6227
6229
  const data = await response.json();
6228
6230
  return data;
6229
- };export{BetResult,BetStatus,Bet_OrderBy,BettorFragmentDoc,BettorsDocument,CASHOUT_DATA_TYPES,CASHOUT_TYPED_DATA_DOMAIN_NAME,CASHOUT_TYPED_DATA_DOMAIN_VERSION,CashoutState,ConditionStatus$1 as ConditionStatus,DeBridgeExternalCallStatus,DeBridgeOrderStatus,Environment,FreeBetStatus,GameBetsDocument,GameDocument,GameStatus,Game_OrderBy$1 as Game_OrderBy,GamesDocument,BetStatus$1 as GraphBetStatus,LIVE_BET_DATA_TYPES,LIVE_TYPED_DATA_DOMAIN_NAME,LIVE_TYPED_DATA_DOMAIN_VERSION,LiveBetFragmentDoc,LiveBetState,LiveBetsDocument,LiveConditionDocument,LiveConditionFragmentDoc,Condition_OrderBy as LiveConditionOrderBy,LiveConditionsDocument,GameStatus$1 as LiveGraphGameStatus,MARGIN_DECIMALS,MIN_LIVE_BET_AMOUNT,MainGameInfoFragmentDoc,NavigationDocument,ODDS_DECIMALS,OrderDirection$1 as OrderDirection,PrematchBetFragmentDoc,PrematchBetsDocument,PrematchConditionDocument,PrematchConditionFragmentDoc,Condition_OrderBy$1 as PrematchConditionOrderBy,PrematchConditionsBatchDocument,PrematchConditionsDocument,GameStatus$2 as PrematchGraphGameStatus,SelectionResult$1 as SelectionResult,SportsDocument,SportsNavigationDocument,WaveLevelName,activateWave,calcLiveOdds,calcMindOdds,calcPrematchOdds,chainsData,chainsDataByEnv,createCashout,createDeBridgeBet,createLiveBet,deBridgeChainIdByOriginalChainId,deBridgeTxUrl,deBridgeUrl,environments,FreeBet as freeBetAbi,getApiEndpoint,getBetStatus,getCalculatedCashout,getCashout,getCashoutTypedData,getDeBridgeOrder,getDeBridgeSupportedChains,getDeBridgeSupportedTokens,getFreeBets,getGameStatus,getLiveBet,getLiveBetFee,getLiveBetTypedData,getLiveGraphqlEndpoint,getPrecalculatedCashouts,getPrematchBetDataBytes,getPrematchGraphqlEndpoint,getProviderFromId,getSocketEndpoint,getWaveLeaderBoard,getWaveLevels,getWavePeriods,getWaveStats,groupByConditionId,groupConditionsByMarket,liveCoreAbi,liveHostAddress,liveSupportedChains,lpAbi,prematchComboCoreAbi,prematchCoreAbi,proxyFrontAbi,setupContracts};
6231
+ };const getCashbackBalance = async ({ account, affiliate, chainId = polygon.id }) => {
6232
+ const api = getApiEndpoint(chainId);
6233
+ const params = new URLSearchParams({
6234
+ userAddress: account,
6235
+ affiliateAddress: affiliate,
6236
+ networks: environments[chainId],
6237
+ });
6238
+ const response = await fetch(`${api}/cashback/user-balance?${params}`);
6239
+ if (response.status === 404) {
6240
+ return null;
6241
+ }
6242
+ if (!response.ok) {
6243
+ throw new Error(`Status ${response.status}: ${response.statusText}`);
6244
+ }
6245
+ const data = await response.json();
6246
+ return data[0];
6247
+ };const createCashbackTransaction = async (props) => {
6248
+ const { account, affiliate, expiresAt, chainId = polygon.id } = props;
6249
+ const { api, environment, betToken } = chainsData[chainId];
6250
+ const response = await fetch(`${api}/cashback/take`, {
6251
+ method: 'POST',
6252
+ headers: {
6253
+ 'Accept': 'application/json',
6254
+ 'Content-Type': 'application/json',
6255
+ },
6256
+ body: JSON.stringify({
6257
+ userAddress: account,
6258
+ affiliateAddress: affiliate,
6259
+ network: environment,
6260
+ currency: betToken.symbol,
6261
+ expiresAt,
6262
+ }),
6263
+ });
6264
+ if (response.status === 404) {
6265
+ return null;
6266
+ }
6267
+ if (!response.ok) {
6268
+ throw new Error(`Status ${response.status}: ${response.statusText}`);
6269
+ }
6270
+ const { id, cashbackContractAddress, amount, signature } = await response.json();
6271
+ const tx = {
6272
+ to: cashbackContractAddress,
6273
+ data: encodeFunctionData({
6274
+ abi: cashbackAbi,
6275
+ functionName: 'withdrawCashBack',
6276
+ args: [
6277
+ {
6278
+ id: BigInt(id),
6279
+ chainId: BigInt(chainId),
6280
+ cashBackContract: cashbackContractAddress,
6281
+ affiliate,
6282
+ token: betToken.address,
6283
+ account,
6284
+ amount: parseUnits(amount, betToken.decimals),
6285
+ expiresAt: BigInt(expiresAt),
6286
+ },
6287
+ signature,
6288
+ ],
6289
+ }),
6290
+ };
6291
+ return tx;
6292
+ };export{BetResult,BetStatus,Bet_OrderBy,BettorFragmentDoc,BettorsDocument,CASHOUT_DATA_TYPES,CASHOUT_TYPED_DATA_DOMAIN_NAME,CASHOUT_TYPED_DATA_DOMAIN_VERSION,CashoutState,ConditionStatus$1 as ConditionStatus,DeBridgeExternalCallStatus,DeBridgeOrderStatus,Environment,FreeBetStatus,GameBetsDocument,GameDocument,GameStatus,Game_OrderBy$1 as Game_OrderBy,GamesDocument,BetStatus$1 as GraphBetStatus,LIVE_BET_DATA_TYPES,LIVE_TYPED_DATA_DOMAIN_NAME,LIVE_TYPED_DATA_DOMAIN_VERSION,LiveBetFragmentDoc,LiveBetState,LiveBetsDocument,LiveConditionDocument,LiveConditionFragmentDoc,Condition_OrderBy as LiveConditionOrderBy,LiveConditionsDocument,GameStatus$1 as LiveGraphGameStatus,MARGIN_DECIMALS,MIN_LIVE_BET_AMOUNT,MainGameInfoFragmentDoc,NavigationDocument,ODDS_DECIMALS,OrderDirection$1 as OrderDirection,PrematchBetFragmentDoc,PrematchBetsDocument,PrematchConditionDocument,PrematchConditionFragmentDoc,Condition_OrderBy$1 as PrematchConditionOrderBy,PrematchConditionsBatchDocument,PrematchConditionsDocument,GameStatus$2 as PrematchGraphGameStatus,SelectionResult$1 as SelectionResult,SportsDocument,SportsNavigationDocument,WaveLevelName,activateWave,calcLiveOdds,calcMindOdds,calcPrematchOdds,cashbackAbi,chainsData,chainsDataByEnv,createCashbackTransaction,createCashout,createDeBridgeBet,createLiveBet,deBridgeChainIdByOriginalChainId,deBridgeTxUrl,deBridgeUrl,environments,FreeBet as freeBetAbi,getApiEndpoint,getBetStatus,getCalculatedCashout,getCashbackBalance,getCashout,getCashoutTypedData,getDeBridgeOrder,getDeBridgeSupportedChains,getDeBridgeSupportedTokens,getFreeBets,getGameStatus,getLiveBet,getLiveBetFee,getLiveBetTypedData,getLiveGraphqlEndpoint,getPrecalculatedCashouts,getPrematchBetDataBytes,getPrematchGraphqlEndpoint,getProviderFromId,getSocketEndpoint,getWaveLeaderBoard,getWaveLevels,getWavePeriods,getWaveStats,groupByConditionId,groupConditionsByMarket,liveCoreAbi,liveHostAddress,liveSupportedChains,lpAbi,prematchComboCoreAbi,prematchCoreAbi,proxyFrontAbi,setupContracts};
@@ -0,0 +1,14 @@
1
+ import { type Hex, type Address } from 'viem';
2
+ import { type ChainId } from '../../config';
3
+ export type CashbackTransaction = {
4
+ to: Address;
5
+ data: Hex;
6
+ };
7
+ type Props = {
8
+ account: Address;
9
+ affiliate: Address;
10
+ expiresAt: number;
11
+ chainId?: ChainId;
12
+ };
13
+ export declare const createCashbackTransaction: (props: Props) => Promise<CashbackTransaction | null>;
14
+ export {};
@@ -0,0 +1,18 @@
1
+ import { type Address } from 'viem';
2
+ import { type ChainId } from '../../config';
3
+ import { type Environment } from '../../envs';
4
+ type CashbackBalanceResponse = {
5
+ userAddress: Address;
6
+ network: Environment;
7
+ currency: string;
8
+ updatedAt: string;
9
+ amount: string;
10
+ }[];
11
+ export type GetCashbackBalance = CashbackBalanceResponse[0];
12
+ type Props = {
13
+ account: Address;
14
+ affiliate: Address;
15
+ chainId?: ChainId;
16
+ };
17
+ export declare const getCashbackBalance: ({ account, affiliate, chainId }: Props) => Promise<GetCashbackBalance | null | undefined>;
18
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azuro-org/toolkit",
3
- "version": "4.5.4",
3
+ "version": "4.6.0-beta.1",
4
4
  "description": "Set of helpers to work with Azuro protocol",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",