@azuro-org/toolkit 5.0.0-beta.10 → 5.0.0-beta.12
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/docs/feed/navigation.d.ts +0 -1
- package/dist/docs/feed/sportsNavigation.d.ts +0 -1
- package/dist/global.d.ts +1 -0
- package/dist/index.js +58 -42
- package/dist/utils/cashout/createCashout.d.ts +1 -2
- package/dist/utils/cashout/getCalculatedCashout.d.ts +1 -2
- package/dist/utils/cashout/getCashoutTypedData.d.ts +1 -2
- package/dist/utils/cashout/getPrecalculatedCashouts.d.ts +5 -3
- package/dist/utils/getEndpoints.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as Types from './types';
|
|
2
2
|
export type NavigationQueryVariables = Types.Exact<{
|
|
3
|
-
first?: Types.InputMaybe<Types.Scalars['Int']['input']>;
|
|
4
3
|
sportFilter?: Types.InputMaybe<Types.Sport_Filter>;
|
|
5
4
|
countryFilter?: Types.InputMaybe<Types.Country_Filter>;
|
|
6
5
|
leagueFilter?: Types.InputMaybe<Types.League_Filter>;
|
package/dist/global.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -4829,8 +4829,18 @@ const isDev = (chainId) => {
|
|
|
4829
4829
|
chainId === spicy.id ||
|
|
4830
4830
|
chainId === baseSepolia.id);
|
|
4831
4831
|
};
|
|
4832
|
-
const getFeedGraphqlEndpoint = (chainId) =>
|
|
4833
|
-
|
|
4832
|
+
const getFeedGraphqlEndpoint = (chainId) => {
|
|
4833
|
+
if (isDev(chainId)) {
|
|
4834
|
+
return (`https://thegraph.onchainfeed.org/subgraphs/name/azuro-protocol/azuro-data-feed-${endpointNameByChainId[chainId]}`);
|
|
4835
|
+
}
|
|
4836
|
+
return (`https://thegraph-1.onchainfeed.org/subgraphs/name/azuro-protocol/azuro-data-feed-${endpointNameByChainId[chainId]}`);
|
|
4837
|
+
};
|
|
4838
|
+
const getBetsGraphqlEndpoint = (chainId) => {
|
|
4839
|
+
if (isDev(chainId)) {
|
|
4840
|
+
return (`https://thegraph.azuro.org/subgraphs/name/azuro-protocol/azuro-api-${endpointNameByChainId[chainId]}-v3`);
|
|
4841
|
+
}
|
|
4842
|
+
return (`https://thegraph-0.onchainfeed.org/subgraphs/name/azuro-protocol/azuro-api-${endpointNameByChainId[chainId]}-v3`);
|
|
4843
|
+
};
|
|
4834
4844
|
/**
|
|
4835
4845
|
* @deprecated Only for v2 feed
|
|
4836
4846
|
*/
|
|
@@ -4859,7 +4869,7 @@ const getApiEndpoint = (chainId) => {
|
|
|
4859
4869
|
// if (chainId === polygonAmoy.id) {
|
|
4860
4870
|
// return 'https://preprod-api.azuro.org/api/v1/public'
|
|
4861
4871
|
// }
|
|
4862
|
-
return 'https://api.
|
|
4872
|
+
return 'https://api.onchainfeed.org/api/v1/public';
|
|
4863
4873
|
};const ODDS_DECIMALS = 12;
|
|
4864
4874
|
const MIN_BET_AMOUNT = 1;
|
|
4865
4875
|
const CLIENT_DATA_TYPES = [
|
|
@@ -4929,11 +4939,11 @@ const gnosisData = {
|
|
|
4929
4939
|
api: getApiEndpoint(gnosis.id),
|
|
4930
4940
|
environment: environments[gnosis.id],
|
|
4931
4941
|
contracts: setupContracts({
|
|
4932
|
-
lp: '
|
|
4933
|
-
core: '
|
|
4934
|
-
relayer: '
|
|
4935
|
-
azuroBet: '
|
|
4936
|
-
cashout: '
|
|
4942
|
+
lp: '0xeb7cDA87D00d677A6Dc73EB569723b0fA51D97E7',
|
|
4943
|
+
core: '0x0e00E6ffcb5E207B800eec9e02999D1Fd9e448f2',
|
|
4944
|
+
relayer: '0x40eb85018fA18dDd10a433C8c40ca8D6744d8B32',
|
|
4945
|
+
azuroBet: '0xd7cd9342A14962C2dCB14569CB6fcA2759999089',
|
|
4946
|
+
cashout: '0x25de227af58188e656524d1C32cCf7C078cdC891',
|
|
4937
4947
|
}),
|
|
4938
4948
|
betToken: {
|
|
4939
4949
|
address: '0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d',
|
|
@@ -4975,11 +4985,11 @@ const polygonData = {
|
|
|
4975
4985
|
api: getApiEndpoint(polygon.id),
|
|
4976
4986
|
environment: environments[polygon.id],
|
|
4977
4987
|
contracts: setupContracts({
|
|
4978
|
-
lp: '
|
|
4979
|
-
core: '
|
|
4980
|
-
relayer: '
|
|
4981
|
-
azuroBet: '
|
|
4982
|
-
cashout: '
|
|
4988
|
+
lp: '0x0FA7FB5407eA971694652E6E16C12A52625DE1b8',
|
|
4989
|
+
core: '0xF9548Be470A4e130c90ceA8b179FCD66D2972AC7',
|
|
4990
|
+
relayer: '0x8dA05c0021e6b35865FDC959c54dCeF3A4AbBa9d',
|
|
4991
|
+
azuroBet: '0x7A1c3FEf712753374C4DCe34254B96faF2B7265B',
|
|
4992
|
+
cashout: '0x4a2BB4211cCF9b9eA6eF01D0a61448154ED19095',
|
|
4983
4993
|
}),
|
|
4984
4994
|
betToken: {
|
|
4985
4995
|
address: '0xc2132d05d31c914a87c6611c10748aeb04b58e8f',
|
|
@@ -5044,14 +5054,14 @@ const chilizData = {
|
|
|
5044
5054
|
api: getApiEndpoint(chiliz.id),
|
|
5045
5055
|
environment: environments[chiliz.id],
|
|
5046
5056
|
contracts: setupContracts({
|
|
5047
|
-
lp: '
|
|
5048
|
-
core: '
|
|
5049
|
-
relayer: '
|
|
5050
|
-
azuroBet: '
|
|
5051
|
-
cashout: '
|
|
5057
|
+
lp: '0xEf6b12580301b04CD2551182C88623524B6e47b8',
|
|
5058
|
+
core: '0xa5061617Ee6565CF48d7f0FEF06910b9fb9dE2b0',
|
|
5059
|
+
relayer: '0x81F72B93ABaf061535aaF5D831F05e0CC4084b32',
|
|
5060
|
+
azuroBet: '0x3777B4F27F4B36f14454dbB1f79278bcba694B52',
|
|
5061
|
+
cashout: '0x3995eebB51793Ee353162E7400DB455B17dE3692',
|
|
5052
5062
|
}),
|
|
5053
5063
|
betToken: {
|
|
5054
|
-
address: '
|
|
5064
|
+
address: '0x677F7e16C7Dd57be1D4C8aD1244883214953DC47',
|
|
5055
5065
|
symbol: 'WCHZ',
|
|
5056
5066
|
decimals: 18,
|
|
5057
5067
|
},
|
|
@@ -5113,11 +5123,11 @@ const baseData = {
|
|
|
5113
5123
|
api: getApiEndpoint(base.id),
|
|
5114
5124
|
environment: environments[base.id],
|
|
5115
5125
|
contracts: setupContracts({
|
|
5116
|
-
lp: '
|
|
5117
|
-
core: '
|
|
5118
|
-
relayer: '
|
|
5119
|
-
azuroBet: '
|
|
5120
|
-
cashout: '
|
|
5126
|
+
lp: '0x1eD7368bc515E928A4007cEa61FB8a6F8863Af87',
|
|
5127
|
+
core: '0xF40cF1dD7d16C098cff5F8B5650A8FaEf1F4640d',
|
|
5128
|
+
relayer: '0xD2D508d66dB4fCE4B384e4C3EA2fa53BA43e73b5',
|
|
5129
|
+
azuroBet: '0xF328404Dbc8c997d12dC55a1A179AF7F8cb7df90',
|
|
5130
|
+
cashout: '0x6EDff24761F4473611B45BDAe4a779ff31af14Be',
|
|
5121
5131
|
}),
|
|
5122
5132
|
betToken: {
|
|
5123
5133
|
address: '0x4200000000000000000000000000000000000006',
|
|
@@ -5540,7 +5550,7 @@ ${LegacyLiveBetFragmentDoc}`;const GameBetsDocument = gql `
|
|
|
5540
5550
|
}
|
|
5541
5551
|
}
|
|
5542
5552
|
${GameInfoFragmentDoc}`;const NavigationDocument = gql `
|
|
5543
|
-
query Navigation($
|
|
5553
|
+
query Navigation($sportFilter: Sport_filter, $countryFilter: Country_filter, $leagueFilter: League_filter) {
|
|
5544
5554
|
sports(where: $sportFilter, subgraphError: allow) {
|
|
5545
5555
|
id
|
|
5546
5556
|
slug
|
|
@@ -5607,7 +5617,7 @@ ${LegacyLiveBetFragmentDoc}`;const GameBetsDocument = gql `
|
|
|
5607
5617
|
}
|
|
5608
5618
|
}
|
|
5609
5619
|
${GameInfoFragmentDoc}`;const SportsNavigationDocument = gql `
|
|
5610
|
-
query SportsNavigation($
|
|
5620
|
+
query SportsNavigation($sportFilter: Sport_filter) {
|
|
5611
5621
|
sports(where: $sportFilter, subgraphError: allow) {
|
|
5612
5622
|
id
|
|
5613
5623
|
slug
|
|
@@ -6950,10 +6960,14 @@ const getFreeBets = async ({ chainId, account, affiliate }) => {
|
|
|
6950
6960
|
if (response.status === 404) {
|
|
6951
6961
|
return null;
|
|
6952
6962
|
}
|
|
6963
|
+
const data = await response.json();
|
|
6953
6964
|
if (!response.ok) {
|
|
6954
|
-
|
|
6965
|
+
const error = new Error(data?.errorMessage || `Status: ${response.status}`);
|
|
6966
|
+
if (data?.error) {
|
|
6967
|
+
error.cause = new Error(data.error);
|
|
6968
|
+
}
|
|
6969
|
+
throw error;
|
|
6955
6970
|
}
|
|
6956
|
-
const data = await response.json();
|
|
6957
6971
|
return data;
|
|
6958
6972
|
};const createComboBet = async (props) => {
|
|
6959
6973
|
const { account, amount, minOdds, nonce, clientData, bets, signature } = props;
|
|
@@ -6986,10 +7000,14 @@ const getFreeBets = async ({ chainId, account, affiliate }) => {
|
|
|
6986
7000
|
if (response.status === 404) {
|
|
6987
7001
|
return null;
|
|
6988
7002
|
}
|
|
7003
|
+
const data = await response.json();
|
|
6989
7004
|
if (!response.ok) {
|
|
6990
|
-
|
|
7005
|
+
const error = new Error(data?.errorMessage || `Status: ${response.status}`);
|
|
7006
|
+
if (data?.error) {
|
|
7007
|
+
error.cause = new Error(data.error);
|
|
7008
|
+
}
|
|
7009
|
+
throw error;
|
|
6991
7010
|
}
|
|
6992
|
-
const data = await response.json();
|
|
6993
7011
|
return data;
|
|
6994
7012
|
};const getBet = async ({ chainId, orderId }) => {
|
|
6995
7013
|
const { api } = chainsData[chainId];
|
|
@@ -7131,7 +7149,7 @@ const getWaveLevels = async ({ waveId, chainId } = { waveId: 'active', chainId:
|
|
|
7131
7149
|
if (!contracts.cashout?.address) {
|
|
7132
7150
|
throw new Error('provided chainId is not supported for cashout');
|
|
7133
7151
|
}
|
|
7134
|
-
const response = await fetch(`${api}/cashout/get-
|
|
7152
|
+
const response = await fetch(`${api}/cashout/get-available`, {
|
|
7135
7153
|
method: 'POST',
|
|
7136
7154
|
headers: {
|
|
7137
7155
|
'Accept': 'application/json',
|
|
@@ -7147,10 +7165,10 @@ const getWaveLevels = async ({ waveId, chainId } = { waveId: 'active', chainId:
|
|
|
7147
7165
|
if (!response.ok) {
|
|
7148
7166
|
throw new Error(`Status ${response.status}: ${response.statusText}`);
|
|
7149
7167
|
}
|
|
7150
|
-
const
|
|
7151
|
-
return
|
|
7168
|
+
const data = await response.json();
|
|
7169
|
+
return data;
|
|
7152
7170
|
};const getCalculatedCashout = async (props) => {
|
|
7153
|
-
const { chainId, account, graphBetId
|
|
7171
|
+
const { chainId, account, graphBetId } = props;
|
|
7154
7172
|
const { api, environment, contracts } = chainsData[chainId];
|
|
7155
7173
|
if (!contracts.cashout?.address) {
|
|
7156
7174
|
throw new Error('provided chainId is not supported for cashout');
|
|
@@ -7165,7 +7183,6 @@ const getWaveLevels = async ({ waveId, chainId } = { waveId: 'active', chainId:
|
|
|
7165
7183
|
environment,
|
|
7166
7184
|
owner: account,
|
|
7167
7185
|
betId: graphBetId,
|
|
7168
|
-
isLive,
|
|
7169
7186
|
}),
|
|
7170
7187
|
});
|
|
7171
7188
|
if (response.status === 404) {
|
|
@@ -7174,15 +7191,14 @@ const getWaveLevels = async ({ waveId, chainId } = { waveId: 'active', chainId:
|
|
|
7174
7191
|
if (!response.ok) {
|
|
7175
7192
|
throw new Error(`Status ${response.status}: ${response.statusText}`);
|
|
7176
7193
|
}
|
|
7177
|
-
const {
|
|
7194
|
+
const { owner, betId, ...rest } = await response.json();
|
|
7178
7195
|
return {
|
|
7179
|
-
multiplier: cashoutOdds,
|
|
7180
7196
|
account: owner,
|
|
7181
7197
|
tokenId: betId,
|
|
7182
7198
|
...rest,
|
|
7183
7199
|
};
|
|
7184
7200
|
};const getCashoutTypedData = (props) => {
|
|
7185
|
-
const { account, chainId, attention, tokenId,
|
|
7201
|
+
const { account, chainId, attention, tokenId, cashoutOdds, expiredAt } = props;
|
|
7186
7202
|
const { contracts } = chainsData[chainId];
|
|
7187
7203
|
if (!contracts.cashout?.address) {
|
|
7188
7204
|
throw new Error('provided chainId is not supported for cashout');
|
|
@@ -7204,8 +7220,8 @@ const getWaveLevels = async ({ waveId, chainId } = { waveId: 'active', chainId:
|
|
|
7204
7220
|
items: [
|
|
7205
7221
|
{
|
|
7206
7222
|
betId: BigInt(tokenId),
|
|
7207
|
-
bettingContract:
|
|
7208
|
-
minOdds: typeof
|
|
7223
|
+
bettingContract: contracts.core.address,
|
|
7224
|
+
minOdds: typeof cashoutOdds === 'string' ? (parseUnits(cashoutOdds, ODDS_DECIMALS)) : cashoutOdds,
|
|
7209
7225
|
},
|
|
7210
7226
|
],
|
|
7211
7227
|
expiresAt: BigInt(expiredAt),
|
|
@@ -7219,7 +7235,7 @@ const getWaveLevels = async ({ waveId, chainId } = { waveId: 'active', chainId:
|
|
|
7219
7235
|
CashoutState["Open"] = "OPEN";
|
|
7220
7236
|
})(CashoutState || (CashoutState = {}));
|
|
7221
7237
|
const createCashout = async (props) => {
|
|
7222
|
-
const { chainId, calculationId,
|
|
7238
|
+
const { chainId, calculationId, attention, signature } = props;
|
|
7223
7239
|
const { api, contracts } = chainsData[chainId];
|
|
7224
7240
|
if (!contracts.cashout?.address) {
|
|
7225
7241
|
throw new Error('provided chainId is not supported for cashout');
|
|
@@ -7228,7 +7244,7 @@ const createCashout = async (props) => {
|
|
|
7228
7244
|
calculationId,
|
|
7229
7245
|
signature: {
|
|
7230
7246
|
verifyingContract: contracts.cashout.address,
|
|
7231
|
-
bettingContract:
|
|
7247
|
+
bettingContract: contracts.core.address,
|
|
7232
7248
|
attention,
|
|
7233
7249
|
chainId,
|
|
7234
7250
|
ownerSignature: signature,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Hex
|
|
1
|
+
import { type Hex } from 'viem';
|
|
2
2
|
import { type ChainId } from '../../config';
|
|
3
3
|
export declare enum CashoutState {
|
|
4
4
|
Processing = "PROCESSING",
|
|
@@ -14,7 +14,6 @@ export type CreateCashoutResponse = {
|
|
|
14
14
|
type Props = {
|
|
15
15
|
chainId: ChainId;
|
|
16
16
|
calculationId: string;
|
|
17
|
-
betCoreAddress: Address | string;
|
|
18
17
|
attention: string;
|
|
19
18
|
signature: Hex;
|
|
20
19
|
};
|
|
@@ -7,7 +7,7 @@ export type GetCalculatedCashout = {
|
|
|
7
7
|
environment: Environment;
|
|
8
8
|
tokenId: string;
|
|
9
9
|
cashoutAmount: string;
|
|
10
|
-
|
|
10
|
+
cashoutOdds: string;
|
|
11
11
|
expiredAt: number;
|
|
12
12
|
approveExpiredAt: number;
|
|
13
13
|
isLive: boolean;
|
|
@@ -16,7 +16,6 @@ type Props = {
|
|
|
16
16
|
chainId: ChainId;
|
|
17
17
|
account: Address;
|
|
18
18
|
graphBetId: string;
|
|
19
|
-
isLive: boolean;
|
|
20
19
|
};
|
|
21
20
|
export declare const getCalculatedCashout: (props: Props) => Promise<GetCalculatedCashout>;
|
|
22
21
|
export {};
|
|
@@ -5,8 +5,7 @@ type Props = {
|
|
|
5
5
|
account: Address;
|
|
6
6
|
attention: string;
|
|
7
7
|
tokenId: string | bigint;
|
|
8
|
-
|
|
9
|
-
multiplier: string | bigint;
|
|
8
|
+
cashoutOdds: string | bigint;
|
|
10
9
|
expiredAt: number;
|
|
11
10
|
};
|
|
12
11
|
export declare const getCashoutTypedData: (props: Props) => SignTypedDataParameters<typeof CASHOUT_DATA_TYPES>;
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { type ChainId } from '../../config';
|
|
2
2
|
type GetPrecalculatedCashoutsResponse = {
|
|
3
|
-
|
|
3
|
+
margin: string;
|
|
4
|
+
marginMin: string;
|
|
5
|
+
availables: {
|
|
4
6
|
conditionId: string;
|
|
5
7
|
available: boolean;
|
|
6
8
|
outcomes: {
|
|
7
9
|
outcomeId: number;
|
|
8
|
-
|
|
10
|
+
price: string;
|
|
9
11
|
}[];
|
|
10
12
|
}[];
|
|
11
13
|
};
|
|
12
|
-
export type GetPrecalculatedCashouts = GetPrecalculatedCashoutsResponse
|
|
14
|
+
export type GetPrecalculatedCashouts = GetPrecalculatedCashoutsResponse | null;
|
|
13
15
|
type Props = {
|
|
14
16
|
chainId: ChainId;
|
|
15
17
|
conditionIds: string[];
|
|
@@ -6,4 +6,4 @@ export declare const getBetsGraphqlEndpoint: (chainId: ChainId) => string;
|
|
|
6
6
|
*/
|
|
7
7
|
export declare const getLegacyLiveGraphqlEndpoint: (chainId: ChainId) => "https://thegraph.azuro.org/subgraphs/name/azuro-protocol/azuro-api-live-data-feed-dev" | "https://thegraph.azuro.org/subgraphs/name/azuro-protocol/azuro-api-live-data-feed";
|
|
8
8
|
export declare const getSocketEndpoint: (chainId: ChainId) => "wss://dev-streams.onchainfeed.org/v1/streams" | "wss://streams.onchainfeed.org/v1/streams";
|
|
9
|
-
export declare const getApiEndpoint: (chainId: ChainId) => "https://dev-api.onchainfeed.org/api/v1/public" | "https://api.
|
|
9
|
+
export declare const getApiEndpoint: (chainId: ChainId) => "https://dev-api.onchainfeed.org/api/v1/public" | "https://api.onchainfeed.org/api/v1/public";
|