Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@azuro-protocol/sdk

Package Overview
Dependencies
Maintainers
2
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@azuro-protocol/sdk - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

dist/api/redeemBetPrize.d.ts

2

dist/api/index.d.ts

@@ -9,3 +9,3 @@ export { checkTestTokensClaimable, default as claimTestTokens } from './claimTestTokens';

export { default as fetchUserBets } from './fetchUserBets';
export { default as claimPrize } from './claimPrize';
export { default as redeemPrize } from './redeemBetPrize';
//# sourceMappingURL=index.d.ts.map

@@ -1,1 +0,1 @@

import{Contract}from"@ethersproject/contracts";import{JsonRpcProvider,InfuraProvider,AlchemyProvider}from"@ethersproject/providers";import{utils}from"ethers";import axios from"axios";import{formatUnits,parseUnits}from"@ethersproject/units";var CoreABI=[{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"conditionID",type:"uint256"},{indexed:!1,internalType:"uint256",name:"timestamp",type:"uint256"}],name:"ConditionCreated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"conditionID",type:"uint256"},{indexed:!1,internalType:"uint256",name:"outcomeWin",type:"uint256"},{indexed:!1,internalType:"uint256",name:"state",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amountForLP",type:"uint256"}],name:"ConditionResolved",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"conditionID",type:"uint256"},{indexed:!1,internalType:"uint256",name:"newTimestamp",type:"uint256"}],name:"ConditionShifted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{inputs:[{internalType:"address",name:"maintainer",type:"address"},{internalType:"bool",name:"active",type:"bool"}],name:"addMaintainer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"bets",outputs:[{internalType:"uint256",name:"conditionID",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"odds",type:"uint256"},{internalType:"uint256",name:"outcome",type:"uint256"},{internalType:"bool",name:"payed",type:"bool"},{internalType:"uint256",name:"createdAt",type:"uint256"},{internalType:"address",name:"affiliate",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"outcomeWin",type:"uint256"}],name:"calculateOdds",outputs:[{internalType:"uint256",name:"odds",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"}],name:"cancel",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"conditions",outputs:[{internalType:"uint256",name:"reinforcement",type:"uint256"},{internalType:"uint256",name:"margin",type:"uint256"},{internalType:"bytes32",name:"ipfsHash",type:"bytes32"},{internalType:"uint256",name:"outcomeWin",type:"uint256"},{internalType:"enum Core.conditionState",name:"state",type:"uint8"},{internalType:"uint256",name:"maxPayout",type:"uint256"},{internalType:"uint256",name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"conditionsMargin",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"conditionsReinforcementFix",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"oracleConditionID",type:"uint256"},{internalType:"uint256[2]",name:"odds",type:"uint256[2]"},{internalType:"uint256[2]",name:"outcomes",type:"uint256[2]"},{internalType:"uint256",name:"timestamp",type:"uint256"},{internalType:"bytes32",name:"ipfsHash",type:"bytes32"}],name:"createCondition",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"betId",type:"uint256"}],name:"getBetInfo",outputs:[{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"odds",type:"uint256"},{internalType:"uint256",name:"createdAt",type:"uint256"},{internalType:"address",name:"affiliate",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"}],name:"getCondition",outputs:[{components:[{internalType:"uint256",name:"reinforcement",type:"uint256"},{internalType:"uint256[2]",name:"fundBank",type:"uint256[2]"},{internalType:"uint256[2]",name:"payouts",type:"uint256[2]"},{internalType:"uint256[2]",name:"totalNetBets",type:"uint256[2]"},{internalType:"uint256[2]",name:"outcomes",type:"uint256[2]"},{internalType:"uint256",name:"margin",type:"uint256"},{internalType:"bytes32",name:"ipfsHash",type:"bytes32"},{internalType:"uint256",name:"outcomeWin",type:"uint256"},{internalType:"enum Core.conditionState",name:"state",type:"uint8"},{internalType:"uint256",name:"maxPayout",type:"uint256"},{internalType:"uint256",name:"timestamp",type:"uint256"}],internalType:"struct Core.Condition",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"}],name:"getConditionFunds",outputs:[{internalType:"uint256[2]",name:"fundBank",type:"uint256[2]"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentReinforcement",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLockedPayout",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"reinforcement_",type:"uint256"},{internalType:"address",name:"oracle_",type:"address"},{internalType:"uint256",name:"margin_",type:"uint256"},{internalType:"address",name:"math_",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"},{internalType:"uint256",name:"outcomeWin",type:"uint256"}],name:"isOutComeCorrect",outputs:[{internalType:"bool",name:"correct",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"lastBetID",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"lpAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"maintainers",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"mathAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"oracles",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"outcomeWin",type:"uint256"},{internalType:"uint256",name:"minOdds",type:"uint256"},{internalType:"address",name:"affiliate",type:"address"}],name:"putBet",outputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"oracle_",type:"address"}],name:"renounceOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"},{internalType:"uint256",name:"outcomeWin",type:"uint256"}],name:"resolveCondition",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenID",type:"uint256"}],name:"resolvePayout",outputs:[{internalType:"bool",name:"success",type:"bool"},{internalType:"uint256",name:"amount",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"lpAddress_",type:"address"}],name:"setLP",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"oracle_",type:"address"}],name:"setOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"},{internalType:"uint256",name:"newTimestamp",type:"uint256"}],name:"shift",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"totalLockedPayout",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenID_",type:"uint256"}],name:"viewPayout",outputs:[{internalType:"bool",name:"success",type:"bool"},{internalType:"uint256",name:"amount",type:"uint256"}],stateMutability:"view",type:"function"}],LpABI=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"better",type:"address"},{indexed:!1,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"BetterWin",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"LiquidityAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"LiquidityRemoved",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"requestWallet",type:"address"},{indexed:!1,internalType:"uint256",name:"requestedValueLP",type:"uint256"}],name:"LiquidityRequested",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"uint256",name:"betID",type:"uint256"},{indexed:!0,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"outcomeId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"odds",type:"uint256"},{indexed:!1,internalType:"uint256",name:"fund1",type:"uint256"},{indexed:!1,internalType:"uint256",name:"fund2",type:"uint256"}],name:"NewBet",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"addLiquidity",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"initReserve",type:"uint256"},{internalType:"uint256",name:"profitReserve",type:"uint256"}],name:"addReserve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"affiliates",outputs:[{internalType:"uint256",name:"claimed",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"azuroBet",outputs:[{internalType:"contract IAzuroBet",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"outcomeID",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint256",name:"minOdds",type:"uint256"},{internalType:"address",name:"affiliate_",type:"address"}],name:"bet",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"bettingLiquidity",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"addr",type:"address"}],name:"changeCore",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"newPeriod",type:"uint256"}],name:"changePeriod",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"newOdds_",type:"uint256"}],name:"changeRewardOdds",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"claimReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"core",outputs:[{internalType:"contract ICore",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"wallet",type:"address"}],name:"getLiquidityRequests",outputs:[{internalType:"uint256[3]",name:"beginDates",type:"uint256[3]"},{internalType:"uint256[3]",name:"personal",type:"uint256[3]"},{internalType:"uint256[3]",name:"total",type:"uint256[3]"}],stateMutability:"view",type:"function"},{inputs:[],name:"getPeriodsDates",outputs:[{internalType:"uint256[3]",name:"beginDates",type:"uint256[3]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"reinforcementAmount",type:"uint256"}],name:"getPossibilityOfReinforcement",outputs:[{internalType:"bool",name:"status",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"getPossibilityOfReinforcementFromCore",outputs:[{internalType:"bool",name:"status",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"getReserve",outputs:[{internalType:"uint256",name:"reserve",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"initStartDate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"token_",type:"address"},{internalType:"address",name:"azuroBetAddress",type:"address"},{internalType:"uint256",name:"_periodLen",type:"uint256"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"valueLP",type:"uint256"}],name:"liquidityRequest",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"lockReserve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"lockedLiquidity",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"oddsDecimals",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"affiliate_",type:"address"}],name:"pendingReward",outputs:[{internalType:"uint256",name:"reward",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"periodLen",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"phase2end",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"reinforcementAbility",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"requests",outputs:[{internalType:"uint256",name:"totalValue",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"rewardFeeOdds",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"savedPeriods",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"addr",type:"address"}],name:"setAzuroBet",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"token",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalBetsAmount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalReserve",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalRewards",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"viewPayout",outputs:[{internalType:"bool",name:"",type:"bool"},{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"amountLP",type:"uint256"}],name:"withdrawLiquidity",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"withdrawPayout",outputs:[],stateMutability:"nonpayable",type:"function"}],BetABI=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"id",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"freeze",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bool",name:"active",type:"bool"}],name:"freezeTransfers",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"lpAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"id",type:"uint256"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOftoken",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"_data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"lpAddress_",type:"address"}],name:"setLP",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenOfOwnerByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"}],ERC20ABI=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"bool",name:"active",type:"bool"}],name:"addPrivilegedAccounts",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"availableToClaim",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"newPrice",type:"uint256"}],name:"changePrice",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"claim",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"contestsDuration",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"contestsStartDate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"ethBalance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getTokens",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"price",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_contestsDuration",type:"uint256"}],name:"setContestDuration",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"startDate",type:"uint256"}],name:"setContestStartDate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],CONTRACTS={core:{address:"0x1023DB1EFE371CC798f775284D5f2B46e83FdfFd",abi:CoreABI,decimals:18},lp:{address:"0x6Cb354C4844634509a59B0BabBa9b41aEe4d5617",abi:LpABI,decimals:18},bet:{address:"0x10F39e8e1f1ea645Ab1959e10114059e9A23B079",abi:BetABI,decimals:18},usdt:{address:"0x1267e4e7D0f17c9D390d6bEeE5655A58Df35af34",abi:ERC20ABI,decimals:18}},createContract=function(e,t){var e=CONTRACTS[e.toLowerCase()],n=e.address,e=e.abi;return new Contract(n,e,t)},state={walletProvider:null,selectedChainId:null,readContracts:{},writeContracts:{}},setWallerProvider=function(e){state.walletProvider=e},setSelectedChainId=function(e){state.selectedChainId=e},__assign=function(){return(__assign=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function __awaiter(e,s,r,p){return new(r=r||Promise)(function(n,t){function a(e){try{u(p.next(e))}catch(e){t(e)}}function i(e){try{u(p.throw(e))}catch(e){t(e)}}function u(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,i)}u((p=p.apply(e,s||[])).next())})}function __generator(a,i){var u,s,r,p={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(n){return function(e){var t=[n,e];if(u)throw new TypeError("Generator is already executing.");for(;p;)try{if(u=1,s&&(r=2&t[0]?s.return:t[0]?s.throw||((r=s.return)&&r.call(s),0):s.next)&&!(r=r.call(s,t[1])).done)return r;switch(s=0,(t=r?[2&t[0],r.value]:t)[0]){case 0:case 1:r=t;break;case 4:return p.label++,{value:t[1],done:!1};case 5:p.label++,s=t[1],t=[0];continue;case 7:t=p.ops.pop(),p.trys.pop();continue;default:if(!(r=0<(r=p.trys).length&&r[r.length-1])&&(6===t[0]||2===t[0])){p=0;continue}if(3===t[0]&&(!r||t[1]>r[0]&&t[1]<r[3])){p.label=t[1];break}if(6===t[0]&&p.label<r[1]){p.label=r[1],r=t;break}if(r&&p.label<r[2]){p.label=r[2],p.ops.push(t);break}r[2]&&p.ops.pop(),p.trys.pop();continue}t=i.call(a,p)}catch(e){t=[6,e],s=0}finally{u=r=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}}function __read(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var a,i,u=n.call(e),s=[];try{for(;(void 0===t||0<t--)&&!(a=u.next()).done;)s.push(a.value)}catch(e){i={error:e}}finally{try{a&&!a.done&&(n=u.return)&&n.call(u)}finally{if(i)throw i.error}}return s}function __spread(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(__read(arguments[t]));return e}var ConditionStatus,config={infuraKey:null,alchemyKey:null},configure=function(e){Object.entries(e).forEach(function(e){var e=__read(e,2),t=e[0],e=e[1];config[t]=e})},getProvider=function(e){return 1337===state.selectedChainId?new JsonRpcProvider:state.walletProvider?e?state.walletProvider.getSigner():state.walletProvider:5!==state.selectedChainId&&config.alchemyKey?new AlchemyProvider(state.selectedChainId,config.alchemyKey):new InfuraProvider(state.selectedChainId,config.infuraKey)},getContract=function(e,t){var n=t?state.writeContracts:state.readContracts;return n[e]||(t=getProvider(t),t=createContract(e,t),n[e]=t),n[e]},checkTestTokensClaimable=function(e){return getContract("usdt").availableToClaim(e)},claimTestTokens=function(e){return getContract("usdt",!0).claim(e)},fetchBalance=function(e){return getContract("usdt").balanceOf(e)},calculateOdd=function(e,t){var n=1/(1-1/e),t=1+t,a=t*(n-1)/(e-1),n=((n-1)/(e-1)+1)*(t-1),e=2-t;return(-1*n+Math.pow(Math.pow(n,2)+4*a*e,.5))/(2*a)+1},calculateInitialOdds=function(e,t){return[calculateOdd(e[0],t),calculateOdd(e[1],t)]},fetchGameIpfsData=function(p){return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,s,r;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,axios.get("https://azuro.mypinata.cloud/ipfs/"+p)];case 1:return s=e.sent().data,r=s.gameId,t=s.entity1Name,n=s.entity1Image,a=s.entity2Name,i=s.entity2Image,u=s.titleCountry,s=s.titleLeague,[2,{id:r,country:u,league:s,participants:[{name:t,image:n},{name:a,image:i}]}];case 2:return r=e.sent(),console.error(r),[2,null];case 3:return[2]}})})},_calculateInitialOdds=(!function(e){e[e.CREATED=0]="CREATED",e[e.RESOLVED=1]="RESOLVED",e[e.CANCELED=2]="CANCELED"}(ConditionStatus=ConditionStatus||{}),function(e,t){var n=e[0].add(e[1]).toString(),e=e.map(function(e){return n/e.toString()}),t=t.toString()/1e9;return calculateInitialOdds(e,t)}),fetchConditions=function(a){return void 0===a&&(a={}),__awaiter(void 0,void 0,void 0,function(){var p,o,y,t,n;return __generator(this,function(e){switch(e.label){case 0:return t=a.filters,n=(t=void 0===t?{}:t).resolved,p=void 0===n||n,n=t.canceled,o=void 0===n||n,y=getContract("core"),t=y.filters.ConditionCreated(),[4,y.queryFilter(t)];case 1:return n=e.sent(),[4,Promise.all(n.map(function(e){var r=e.args.conditionID;return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,s;return __generator(this,function(e){switch(e.label){case 0:return t=r.toNumber(),[4,y.getCondition(r)];case 1:return(s=e.sent(),n=s.state,p||n!==ConditionStatus.RESOLVED)?o||n!==ConditionStatus.CANCELED?(a=_calculateInitialOdds(s.fundBank,s.margin),i=s.outcomes.map(function(e){return e.toNumber()}),u=1e3*s.timestamp.toNumber(),s=utils.arrayify(s.ipfsHash),s=utils.base58.encode(__spread([18,32],s)),[4,fetchGameIpfsData(s)]):[2]:[2];case 2:return s=e.sent(),[2,{id:t,outcomes:i,odds:a,gameInfo:__assign(__assign({},s),{state:n,startsAt:u})}]}})})}))];case 2:return[2,e.sent().filter(Boolean)]}})})},betTypeOdd={1:{outcomeRegistryId:180,marketRegistryId:9,paramId:1},2:{outcomeRegistryId:181,marketRegistryId:9,paramId:1},3:{outcomeRegistryId:7,marketRegistryId:3,paramId:96},4:{outcomeRegistryId:8,marketRegistryId:3,paramId:32},5:{outcomeRegistryId:7,marketRegistryId:3,paramId:94},6:{outcomeRegistryId:8,marketRegistryId:3,paramId:6},7:{outcomeRegistryId:7,marketRegistryId:3,paramId:36},8:{outcomeRegistryId:8,marketRegistryId:3,paramId:5},9:{outcomeRegistryId:7,marketRegistryId:3,paramId:7},10:{outcomeRegistryId:8,marketRegistryId:3,paramId:4},11:{outcomeRegistryId:7,marketRegistryId:3,paramId:1},12:{outcomeRegistryId:8,marketRegistryId:3,paramId:1},13:{outcomeRegistryId:7,marketRegistryId:3,paramId:4},14:{outcomeRegistryId:8,marketRegistryId:3,paramId:7},15:{outcomeRegistryId:7,marketRegistryId:3,paramId:5},16:{outcomeRegistryId:8,marketRegistryId:3,paramId:36},17:{outcomeRegistryId:7,marketRegistryId:3,paramId:6},18:{outcomeRegistryId:8,marketRegistryId:3,paramId:94},19:{outcomeRegistryId:7,marketRegistryId:3,paramId:32},20:{outcomeRegistryId:8,marketRegistryId:3,paramId:96},21:{outcomeRegistryId:9,marketRegistryId:4,paramId:4},22:{outcomeRegistryId:10,marketRegistryId:4,paramId:4},23:{outcomeRegistryId:9,marketRegistryId:4,paramId:5},24:{outcomeRegistryId:10,marketRegistryId:4,paramId:5},25:{outcomeRegistryId:9,marketRegistryId:4,paramId:6},26:{outcomeRegistryId:10,marketRegistryId:4,paramId:6},27:{outcomeRegistryId:9,marketRegistryId:4,paramId:32},28:{outcomeRegistryId:10,marketRegistryId:4,paramId:32},29:{outcomeRegistryId:1,marketRegistryId:1,paramId:1},30:{outcomeRegistryId:2,marketRegistryId:1,paramId:1},31:{outcomeRegistryId:3,marketRegistryId:1,paramId:1},32:{outcomeRegistryId:10009,marketRegistryId:19,paramId:1},33:{outcomeRegistryId:10010,marketRegistryId:19,paramId:1},34:{outcomeRegistryId:10009,marketRegistryId:20,paramId:1},35:{outcomeRegistryId:10010,marketRegistryId:20,paramId:1},36:{outcomeRegistryId:10009,marketRegistryId:21,paramId:1},37:{outcomeRegistryId:10010,marketRegistryId:21,paramId:1},38:{outcomeRegistryId:4,marketRegistryId:2,paramId:1},39:{outcomeRegistryId:5,marketRegistryId:2,paramId:1},40:{outcomeRegistryId:6,marketRegistryId:2,paramId:1}},gamesInfo={},gameBets={},groupBetVariants=function(e){var t={};return e.forEach(function(e){t[e.paramId]||(t[e.paramId]=[]),t[e.paramId].push(e)}),t},groupGames=function(){return Object.keys(gameBets).map(function(e){var e=gameBets[e],t=e.gameId,n=e.marketRegistryId,e=e.betVariants,a=groupBetVariants(e),e=Object.keys(a);return e=1===e.length?[{paramId:null,odds:a[e[0]].sort(function(e,t){return e.outcomeId-t.outcomeId})}]:Object.keys(a).map(function(e){return{paramId:parseInt(e),odds:a[e].sort(function(e,t){return t.outcomeId-e.outcomeId})}}),__assign(__assign({},gamesInfo[t]),{conditions:e,marketRegistryId:n})})},groupOddsByOutcomes=function(e){var s=e.gameId,r=e.conditionId,t=e.outcomes,p=e.odds;return t.map(function(e,t){var t=p[t],n=betTypeOdd[e],a=n.outcomeRegistryId,i=n.marketRegistryId,n=n.paramId,u=s+"-"+i,i=(gameBets[u]||(gameBets[u]={gameId:s,marketRegistryId:i,betVariants:[]}),{conditionId:r,outcomeId:e,outcomeRegistryId:a,paramId:n,value:t});gameBets[u].betVariants.push(i)})},fetchGames=function(t){return void 0===t&&(t={}),__awaiter(void 0,void 0,void 0,function(){return __generator(this,function(e){switch(e.label){case 0:return[4,fetchConditions(t)];case 1:return e.sent().forEach(function(e){var t=e.id,n=e.outcomes,a=e.odds,e=e.gameInfo;gamesInfo[e.id]=e,groupOddsByOutcomes({gameId:e.id,conditionId:t,outcomes:n,odds:a})}),[2,groupGames().sort(function(e,t){return e.startsAt-t.startsAt})]}})})},RATE_DECIMALS=9,USDT_DECIMALS=18,calculateActualOdds=function(e){var a=e.conditionId,i=e.outcomeId,u=e.betAmount;return __awaiter(void 0,void 0,void 0,function(){var t,n;return __generator(this,function(e){switch(e.label){case 0:return t=parseUnits(String(u),USDT_DECIMALS),[4,getContract("core").calculateOdds(a,t,i)];case 1:return t=e.sent(),n=formatUnits(t,RATE_DECIMALS),[2,parseFloat(n)]}})})},fetchAllowance=function(e){return getContract("usdt").allowance(e,CONTRACTS.usdt.address)},approve=function(e){return getContract("usdt",!0).approve(CONTRACTS.usdt.address,e)},placeBet=function(p){return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,s,r;return __generator(this,function(e){return t=p.conditionId,n=p.outcomeId,u=p.amount,r=p.betRate,s=p.slippage,a=p.affiliate,a=void 0===a?"0x0000000000000000000000000000000000000000":a,i=getContract("lp",!0),u=parseUnits(String(u),USDT_DECIMALS),r=(1+(r-1)*(100-s)/100).toFixed(8),s=parseUnits(r,RATE_DECIMALS),r=Math.floor(Date.now()/1e3)+2e3,[2,i.bet(t,u,n,r,s,a)]})})},fetchBet=function(w){return __awaiter(void 0,void 0,void 0,function(){var t,n,d,l,m,c,a,i,f,u,T,s,b,I,r,v,p,g,o,y;return __generator(this,function(e){switch(e.label){case 0:t=getContract("core"),e.label=1;case 1:return e.trys.push([1,5,,6]),[4,t.bets(w)];case 2:return a=e.sent(),n=a.conditionID,d=a.amount,l=a.outcome,m=a.odds,c=a.payed,a=a.createdAt,[4,t.getCondition(n)];case 3:return u=e.sent(),i=u.state,s=u.ipfsHash,f=u.timestamp,u=u.outcomeWin,T=n.toNumber(),s=utils.arrayify(s),s=utils.base58.encode(__spread([18,32],s)),[4,fetchGameIpfsData(s)];case 4:return s=e.sent(),b=1e3*f.toNumber(),y=l.toNumber(),o=u.toNumber(),r=betTypeOdd[y],I=r.outcomeRegistryId,r=r.paramId,v=parseFloat(formatUnits(m,RATE_DECIMALS)),p=parseFloat(formatUnits(d,USDT_DECIMALS)),g=void 0,g=i===ConditionStatus.CANCELED?p:0===o?null:o===y?(p*v).toFixed(6):-1*p,o=__assign(__assign({},s),{startsAt:b,state:i}),[2,{nftId:w,conditionId:T,paramId:r,outcomeRegistryId:I,rate:v,amount:p,result:g,createdAt:1e3*a.toNumber(),isRedeemed:c,gameInfo:o}];case 5:return y=e.sent(),console.error(y),[3,6];case 6:return[2]}})})},fetchUserBets=function(e){var s=e.account;return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u;return __generator(this,function(e){switch(e.label){case 0:e.trys.push([0,8,,9]),n=void(t=0),a=[],i=getContract("bet"),e.label=1;case 1:if(0!==t&&!n)return[3,6];e.label=2;case 2:return e.trys.push([2,4,,5]),[4,i.tokenOfOwnerByIndex(s,t++)];case 3:return n=e.sent(),a.push(n.toNumber()),[3,5];case 4:return e.sent(),n=null,[3,5];case 5:return[3,1];case 6:return[4,Promise.all(a.map(fetchBet))];case 7:return[2,e.sent().filter(Boolean).sort(function(e,t){return t.createdAt-e.createdAt})];case 8:return u=e.sent(),console.error(u),[2,[]];case 9:return[2]}})})},claimPrize=function(){};export{RATE_DECIMALS,USDT_DECIMALS,approve,calculateActualOdds,checkTestTokensClaimable,claimPrize,claimTestTokens,configure,fetchAllowance,fetchBalance,fetchGames,fetchUserBets,placeBet,setSelectedChainId,setWallerProvider};
import{Contract}from"@ethersproject/contracts";import{JsonRpcProvider,InfuraProvider,AlchemyProvider}from"@ethersproject/providers";import{utils}from"ethers";import axios from"axios";import{formatUnits,parseUnits}from"@ethersproject/units";var CoreABI=[{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"conditionID",type:"uint256"},{indexed:!1,internalType:"uint256",name:"timestamp",type:"uint256"}],name:"ConditionCreated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"conditionID",type:"uint256"},{indexed:!1,internalType:"uint256",name:"outcomeWin",type:"uint256"},{indexed:!1,internalType:"uint256",name:"state",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amountForLP",type:"uint256"}],name:"ConditionResolved",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"conditionID",type:"uint256"},{indexed:!1,internalType:"uint256",name:"newTimestamp",type:"uint256"}],name:"ConditionShifted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{inputs:[{internalType:"address",name:"maintainer",type:"address"},{internalType:"bool",name:"active",type:"bool"}],name:"addMaintainer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"bets",outputs:[{internalType:"uint256",name:"conditionID",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"odds",type:"uint256"},{internalType:"uint256",name:"outcome",type:"uint256"},{internalType:"bool",name:"payed",type:"bool"},{internalType:"uint256",name:"createdAt",type:"uint256"},{internalType:"address",name:"affiliate",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"outcomeWin",type:"uint256"}],name:"calculateOdds",outputs:[{internalType:"uint256",name:"odds",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"}],name:"cancel",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"conditions",outputs:[{internalType:"uint256",name:"reinforcement",type:"uint256"},{internalType:"uint256",name:"margin",type:"uint256"},{internalType:"bytes32",name:"ipfsHash",type:"bytes32"},{internalType:"uint256",name:"outcomeWin",type:"uint256"},{internalType:"enum Core.conditionState",name:"state",type:"uint8"},{internalType:"uint256",name:"maxPayout",type:"uint256"},{internalType:"uint256",name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"conditionsMargin",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"conditionsReinforcementFix",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"oracleConditionID",type:"uint256"},{internalType:"uint256[2]",name:"odds",type:"uint256[2]"},{internalType:"uint256[2]",name:"outcomes",type:"uint256[2]"},{internalType:"uint256",name:"timestamp",type:"uint256"},{internalType:"bytes32",name:"ipfsHash",type:"bytes32"}],name:"createCondition",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"betId",type:"uint256"}],name:"getBetInfo",outputs:[{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"odds",type:"uint256"},{internalType:"uint256",name:"createdAt",type:"uint256"},{internalType:"address",name:"affiliate",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"}],name:"getCondition",outputs:[{components:[{internalType:"uint256",name:"reinforcement",type:"uint256"},{internalType:"uint256[2]",name:"fundBank",type:"uint256[2]"},{internalType:"uint256[2]",name:"payouts",type:"uint256[2]"},{internalType:"uint256[2]",name:"totalNetBets",type:"uint256[2]"},{internalType:"uint256[2]",name:"outcomes",type:"uint256[2]"},{internalType:"uint256",name:"margin",type:"uint256"},{internalType:"bytes32",name:"ipfsHash",type:"bytes32"},{internalType:"uint256",name:"outcomeWin",type:"uint256"},{internalType:"enum Core.conditionState",name:"state",type:"uint8"},{internalType:"uint256",name:"maxPayout",type:"uint256"},{internalType:"uint256",name:"timestamp",type:"uint256"}],internalType:"struct Core.Condition",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"}],name:"getConditionFunds",outputs:[{internalType:"uint256[2]",name:"fundBank",type:"uint256[2]"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentReinforcement",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLockedPayout",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"reinforcement_",type:"uint256"},{internalType:"address",name:"oracle_",type:"address"},{internalType:"uint256",name:"margin_",type:"uint256"},{internalType:"address",name:"math_",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"},{internalType:"uint256",name:"outcomeWin",type:"uint256"}],name:"isOutComeCorrect",outputs:[{internalType:"bool",name:"correct",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"lastBetID",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"lpAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"maintainers",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"mathAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"oracles",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"outcomeWin",type:"uint256"},{internalType:"uint256",name:"minOdds",type:"uint256"},{internalType:"address",name:"affiliate",type:"address"}],name:"putBet",outputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"oracle_",type:"address"}],name:"renounceOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"},{internalType:"uint256",name:"outcomeWin",type:"uint256"}],name:"resolveCondition",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenID",type:"uint256"}],name:"resolvePayout",outputs:[{internalType:"bool",name:"success",type:"bool"},{internalType:"uint256",name:"amount",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"lpAddress_",type:"address"}],name:"setLP",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"oracle_",type:"address"}],name:"setOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"},{internalType:"uint256",name:"newTimestamp",type:"uint256"}],name:"shift",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"totalLockedPayout",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenID_",type:"uint256"}],name:"viewPayout",outputs:[{internalType:"bool",name:"success",type:"bool"},{internalType:"uint256",name:"amount",type:"uint256"}],stateMutability:"view",type:"function"}],LpABI=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"better",type:"address"},{indexed:!1,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"BetterWin",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"LiquidityAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"LiquidityRemoved",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"requestWallet",type:"address"},{indexed:!1,internalType:"uint256",name:"requestedValueLP",type:"uint256"}],name:"LiquidityRequested",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"uint256",name:"betID",type:"uint256"},{indexed:!0,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"outcomeId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"odds",type:"uint256"},{indexed:!1,internalType:"uint256",name:"fund1",type:"uint256"},{indexed:!1,internalType:"uint256",name:"fund2",type:"uint256"}],name:"NewBet",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"addLiquidity",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"initReserve",type:"uint256"},{internalType:"uint256",name:"profitReserve",type:"uint256"}],name:"addReserve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"affiliates",outputs:[{internalType:"uint256",name:"claimed",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"azuroBet",outputs:[{internalType:"contract IAzuroBet",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"outcomeID",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint256",name:"minOdds",type:"uint256"},{internalType:"address",name:"affiliate_",type:"address"}],name:"bet",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"bettingLiquidity",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"addr",type:"address"}],name:"changeCore",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"newPeriod",type:"uint256"}],name:"changePeriod",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"newOdds_",type:"uint256"}],name:"changeRewardOdds",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"claimReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"core",outputs:[{internalType:"contract ICore",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"wallet",type:"address"}],name:"getLiquidityRequests",outputs:[{internalType:"uint256[3]",name:"beginDates",type:"uint256[3]"},{internalType:"uint256[3]",name:"personal",type:"uint256[3]"},{internalType:"uint256[3]",name:"total",type:"uint256[3]"}],stateMutability:"view",type:"function"},{inputs:[],name:"getPeriodsDates",outputs:[{internalType:"uint256[3]",name:"beginDates",type:"uint256[3]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"reinforcementAmount",type:"uint256"}],name:"getPossibilityOfReinforcement",outputs:[{internalType:"bool",name:"status",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"getPossibilityOfReinforcementFromCore",outputs:[{internalType:"bool",name:"status",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"getReserve",outputs:[{internalType:"uint256",name:"reserve",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"initStartDate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"token_",type:"address"},{internalType:"address",name:"azuroBetAddress",type:"address"},{internalType:"uint256",name:"_periodLen",type:"uint256"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"valueLP",type:"uint256"}],name:"liquidityRequest",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"lockReserve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"lockedLiquidity",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"oddsDecimals",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"affiliate_",type:"address"}],name:"pendingReward",outputs:[{internalType:"uint256",name:"reward",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"periodLen",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"phase2end",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"reinforcementAbility",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"requests",outputs:[{internalType:"uint256",name:"totalValue",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"rewardFeeOdds",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"savedPeriods",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"addr",type:"address"}],name:"setAzuroBet",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"token",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalBetsAmount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalReserve",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalRewards",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"viewPayout",outputs:[{internalType:"bool",name:"",type:"bool"},{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"amountLP",type:"uint256"}],name:"withdrawLiquidity",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"withdrawPayout",outputs:[],stateMutability:"nonpayable",type:"function"}],BetABI=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"id",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"freeze",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bool",name:"active",type:"bool"}],name:"freezeTransfers",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"lpAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"id",type:"uint256"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOftoken",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"_data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"lpAddress_",type:"address"}],name:"setLP",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenOfOwnerByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"}],ERC20ABI=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"bool",name:"active",type:"bool"}],name:"addPrivilegedAccounts",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"availableToClaim",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"newPrice",type:"uint256"}],name:"changePrice",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"claim",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"contestsDuration",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"contestsStartDate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"ethBalance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getTokens",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"price",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_contestsDuration",type:"uint256"}],name:"setContestDuration",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"startDate",type:"uint256"}],name:"setContestStartDate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],CONTRACTS={core:{address:"0x1023DB1EFE371CC798f775284D5f2B46e83FdfFd",abi:CoreABI,decimals:18},lp:{address:"0x6Cb354C4844634509a59B0BabBa9b41aEe4d5617",abi:LpABI,decimals:18},bet:{address:"0x10F39e8e1f1ea645Ab1959e10114059e9A23B079",abi:BetABI,decimals:18},usdt:{address:"0x1267e4e7D0f17c9D390d6bEeE5655A58Df35af34",abi:ERC20ABI,decimals:18}},createContract=function(e,t){var e=CONTRACTS[e.toLowerCase()],n=e.address,e=e.abi;return new Contract(n,e,t)},state={walletProvider:null,selectedChainId:null,readContracts:{},writeContracts:{}},setWallerProvider=function(e){state.walletProvider=e},setSelectedChainId=function(e){state.selectedChainId=e},__assign=function(){return(__assign=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function __awaiter(e,s,r,p){return new(r=r||Promise)(function(n,t){function a(e){try{u(p.next(e))}catch(e){t(e)}}function i(e){try{u(p.throw(e))}catch(e){t(e)}}function u(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,i)}u((p=p.apply(e,s||[])).next())})}function __generator(a,i){var u,s,r,p={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(n){return function(e){var t=[n,e];if(u)throw new TypeError("Generator is already executing.");for(;p;)try{if(u=1,s&&(r=2&t[0]?s.return:t[0]?s.throw||((r=s.return)&&r.call(s),0):s.next)&&!(r=r.call(s,t[1])).done)return r;switch(s=0,(t=r?[2&t[0],r.value]:t)[0]){case 0:case 1:r=t;break;case 4:return p.label++,{value:t[1],done:!1};case 5:p.label++,s=t[1],t=[0];continue;case 7:t=p.ops.pop(),p.trys.pop();continue;default:if(!(r=0<(r=p.trys).length&&r[r.length-1])&&(6===t[0]||2===t[0])){p=0;continue}if(3===t[0]&&(!r||t[1]>r[0]&&t[1]<r[3])){p.label=t[1];break}if(6===t[0]&&p.label<r[1]){p.label=r[1],r=t;break}if(r&&p.label<r[2]){p.label=r[2],p.ops.push(t);break}r[2]&&p.ops.pop(),p.trys.pop();continue}t=i.call(a,p)}catch(e){t=[6,e],s=0}finally{u=r=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}}function __read(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var a,i,u=n.call(e),s=[];try{for(;(void 0===t||0<t--)&&!(a=u.next()).done;)s.push(a.value)}catch(e){i={error:e}}finally{try{a&&!a.done&&(n=u.return)&&n.call(u)}finally{if(i)throw i.error}}return s}function __spread(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(__read(arguments[t]));return e}var ConditionStatus,config={infuraKey:null,alchemyKey:null},configure=function(e){Object.entries(e).forEach(function(e){var e=__read(e,2),t=e[0],e=e[1];config[t]=e})},getProvider=function(e){return 1337===state.selectedChainId?new JsonRpcProvider:state.walletProvider?e?state.walletProvider.getSigner():state.walletProvider:5!==state.selectedChainId&&config.alchemyKey?new AlchemyProvider(state.selectedChainId,config.alchemyKey):new InfuraProvider(state.selectedChainId,config.infuraKey)},getContract=function(e,t){var n=t?state.writeContracts:state.readContracts;return n[e]||(t=getProvider(t),t=createContract(e,t),n[e]=t),n[e]},checkTestTokensClaimable=function(e){return getContract("usdt").availableToClaim(e)},claimTestTokens=function(e){return getContract("usdt",!0).claim(e)},fetchBalance=function(e){return getContract("usdt").balanceOf(e)},calculateOdd=function(e,t){var n=1/(1-1/e),t=1+t,a=t*(n-1)/(e-1),n=((n-1)/(e-1)+1)*(t-1),e=2-t;return(-1*n+Math.pow(Math.pow(n,2)+4*a*e,.5))/(2*a)+1},calculateInitialOdds=function(e,t){return[calculateOdd(e[0],t),calculateOdd(e[1],t)]},fetchGameIpfsData=function(p){return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,s,r;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,axios.get("https://azuro.mypinata.cloud/ipfs/"+p)];case 1:return s=e.sent().data,r=s.gameId,t=s.entity1Name,n=s.entity1Image,a=s.entity2Name,i=s.entity2Image,u=s.titleCountry,s=s.titleLeague,[2,{id:r,country:u,league:s,participants:[{name:t,image:n},{name:a,image:i}]}];case 2:return r=e.sent(),console.error(r),[2,null];case 3:return[2]}})})},_calculateInitialOdds=(!function(e){e[e.CREATED=0]="CREATED",e[e.RESOLVED=1]="RESOLVED",e[e.CANCELED=2]="CANCELED"}(ConditionStatus=ConditionStatus||{}),function(e,t){var n=e[0].add(e[1]).toString(),e=e.map(function(e){return n/e.toString()}),t=t.toString()/1e9;return calculateInitialOdds(e,t)}),fetchConditions=function(a){return void 0===a&&(a={}),__awaiter(void 0,void 0,void 0,function(){var p,o,y,t,n;return __generator(this,function(e){switch(e.label){case 0:return t=a.filters,n=(t=void 0===t?{}:t).resolved,p=void 0===n||n,n=t.canceled,o=void 0===n||n,y=getContract("core"),t=y.filters.ConditionCreated(),[4,y.queryFilter(t)];case 1:return n=e.sent(),[4,Promise.all(n.map(function(e){var r=e.args.conditionID;return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,s;return __generator(this,function(e){switch(e.label){case 0:return t=r.toNumber(),[4,y.getCondition(r)];case 1:return(s=e.sent(),n=s.state,p||n!==ConditionStatus.RESOLVED)?o||n!==ConditionStatus.CANCELED?(a=_calculateInitialOdds(s.fundBank,s.margin),i=s.outcomes.map(function(e){return e.toNumber()}),u=1e3*s.timestamp.toNumber(),s=utils.arrayify(s.ipfsHash),s=utils.base58.encode(__spread([18,32],s)),[4,fetchGameIpfsData(s)]):[2]:[2];case 2:return s=e.sent(),[2,{id:t,outcomes:i,odds:a,gameInfo:__assign(__assign({},s),{state:n,startsAt:u})}]}})})}))];case 2:return[2,e.sent().filter(Boolean)]}})})},betTypeOdd={1:{outcomeRegistryId:180,marketRegistryId:9,paramId:1},2:{outcomeRegistryId:181,marketRegistryId:9,paramId:1},3:{outcomeRegistryId:7,marketRegistryId:3,paramId:96},4:{outcomeRegistryId:8,marketRegistryId:3,paramId:32},5:{outcomeRegistryId:7,marketRegistryId:3,paramId:94},6:{outcomeRegistryId:8,marketRegistryId:3,paramId:6},7:{outcomeRegistryId:7,marketRegistryId:3,paramId:36},8:{outcomeRegistryId:8,marketRegistryId:3,paramId:5},9:{outcomeRegistryId:7,marketRegistryId:3,paramId:7},10:{outcomeRegistryId:8,marketRegistryId:3,paramId:4},11:{outcomeRegistryId:7,marketRegistryId:3,paramId:1},12:{outcomeRegistryId:8,marketRegistryId:3,paramId:1},13:{outcomeRegistryId:7,marketRegistryId:3,paramId:4},14:{outcomeRegistryId:8,marketRegistryId:3,paramId:7},15:{outcomeRegistryId:7,marketRegistryId:3,paramId:5},16:{outcomeRegistryId:8,marketRegistryId:3,paramId:36},17:{outcomeRegistryId:7,marketRegistryId:3,paramId:6},18:{outcomeRegistryId:8,marketRegistryId:3,paramId:94},19:{outcomeRegistryId:7,marketRegistryId:3,paramId:32},20:{outcomeRegistryId:8,marketRegistryId:3,paramId:96},21:{outcomeRegistryId:9,marketRegistryId:4,paramId:4},22:{outcomeRegistryId:10,marketRegistryId:4,paramId:4},23:{outcomeRegistryId:9,marketRegistryId:4,paramId:5},24:{outcomeRegistryId:10,marketRegistryId:4,paramId:5},25:{outcomeRegistryId:9,marketRegistryId:4,paramId:6},26:{outcomeRegistryId:10,marketRegistryId:4,paramId:6},27:{outcomeRegistryId:9,marketRegistryId:4,paramId:32},28:{outcomeRegistryId:10,marketRegistryId:4,paramId:32},29:{outcomeRegistryId:1,marketRegistryId:1,paramId:1},30:{outcomeRegistryId:2,marketRegistryId:1,paramId:1},31:{outcomeRegistryId:3,marketRegistryId:1,paramId:1},32:{outcomeRegistryId:10009,marketRegistryId:19,paramId:1},33:{outcomeRegistryId:10010,marketRegistryId:19,paramId:1},34:{outcomeRegistryId:10009,marketRegistryId:20,paramId:1},35:{outcomeRegistryId:10010,marketRegistryId:20,paramId:1},36:{outcomeRegistryId:10009,marketRegistryId:21,paramId:1},37:{outcomeRegistryId:10010,marketRegistryId:21,paramId:1},38:{outcomeRegistryId:4,marketRegistryId:2,paramId:1},39:{outcomeRegistryId:5,marketRegistryId:2,paramId:1},40:{outcomeRegistryId:6,marketRegistryId:2,paramId:1}},gamesInfo={},gameBets={},groupBetVariants=function(e){var t={};return e.forEach(function(e){t[e.paramId]||(t[e.paramId]=[]),t[e.paramId].push(e)}),t},groupGames=function(){return Object.keys(gameBets).map(function(e){var e=gameBets[e],t=e.gameId,n=e.marketRegistryId,e=e.betVariants,a=groupBetVariants(e),e=Object.keys(a);return e=1===e.length?[{paramId:null,odds:a[e[0]].sort(function(e,t){return e.outcomeId-t.outcomeId})}]:Object.keys(a).map(function(e){return{paramId:parseInt(e),odds:a[e].sort(function(e,t){return t.outcomeId-e.outcomeId})}}),__assign(__assign({},gamesInfo[t]),{conditions:e,marketRegistryId:n})})},groupOddsByOutcomes=function(e){var s=e.gameId,r=e.conditionId,t=e.outcomes,p=e.odds;return t.map(function(e,t){var t=p[t],n=betTypeOdd[e],a=n.outcomeRegistryId,i=n.marketRegistryId,n=n.paramId,u=s+"-"+i,i=(gameBets[u]||(gameBets[u]={gameId:s,marketRegistryId:i,betVariants:[]}),{conditionId:r,outcomeId:e,outcomeRegistryId:a,paramId:n,value:t});gameBets[u].betVariants.push(i)})},fetchGames=function(t){return void 0===t&&(t={}),__awaiter(void 0,void 0,void 0,function(){return __generator(this,function(e){switch(e.label){case 0:return[4,fetchConditions(t)];case 1:return e.sent().forEach(function(e){var t=e.id,n=e.outcomes,a=e.odds,e=e.gameInfo;gamesInfo[e.id]=e,groupOddsByOutcomes({gameId:e.id,conditionId:t,outcomes:n,odds:a})}),[2,groupGames().sort(function(e,t){return e.startsAt-t.startsAt})]}})})},RATE_DECIMALS=9,USDT_DECIMALS=18,calculateActualOdds=function(e){var a=e.conditionId,i=e.outcomeId,u=e.betAmount;return __awaiter(void 0,void 0,void 0,function(){var t,n;return __generator(this,function(e){switch(e.label){case 0:return t=parseUnits(String(u),USDT_DECIMALS),[4,getContract("core").calculateOdds(a,t,i)];case 1:return t=e.sent(),n=formatUnits(t,RATE_DECIMALS),[2,parseFloat(n)]}})})},fetchAllowance=function(e){return getContract("usdt").allowance(e,CONTRACTS.usdt.address)},approve=function(e){return getContract("usdt",!0).approve(CONTRACTS.usdt.address,e)},placeBet=function(p){return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,s,r;return __generator(this,function(e){return t=p.conditionId,n=p.outcomeId,u=p.amount,r=p.betRate,s=p.slippage,a=p.affiliate,a=void 0===a?"0x0000000000000000000000000000000000000000":a,i=getContract("lp",!0),u=parseUnits(String(u),USDT_DECIMALS),r=(1+(r-1)*(100-s)/100).toFixed(8),s=parseUnits(r,RATE_DECIMALS),r=Math.floor(Date.now()/1e3)+2e3,[2,i.bet(t,u,n,r,s,a)]})})},fetchBet=function(w){return __awaiter(void 0,void 0,void 0,function(){var t,n,d,l,m,c,a,i,f,u,T,s,b,I,r,v,p,g,o,y;return __generator(this,function(e){switch(e.label){case 0:t=getContract("core"),e.label=1;case 1:return e.trys.push([1,5,,6]),[4,t.bets(w)];case 2:return a=e.sent(),n=a.conditionID,d=a.amount,l=a.outcome,m=a.odds,c=a.payed,a=a.createdAt,[4,t.getCondition(n)];case 3:return u=e.sent(),i=u.state,s=u.ipfsHash,f=u.timestamp,u=u.outcomeWin,T=n.toNumber(),s=utils.arrayify(s),s=utils.base58.encode(__spread([18,32],s)),[4,fetchGameIpfsData(s)];case 4:return s=e.sent(),b=1e3*f.toNumber(),y=l.toNumber(),o=u.toNumber(),r=betTypeOdd[y],I=r.outcomeRegistryId,r=r.paramId,v=parseFloat(formatUnits(m,RATE_DECIMALS)),p=parseFloat(formatUnits(d,USDT_DECIMALS)),g=void 0,g=i===ConditionStatus.CANCELED?p:0===o?null:o===y?(p*v).toFixed(6):-1*p,o=__assign(__assign({},s),{startsAt:b,state:i}),[2,{nftId:w,conditionId:T,paramId:r,outcomeRegistryId:I,rate:v,amount:p,result:g,createdAt:1e3*a.toNumber(),isRedeemed:c,gameInfo:o}];case 5:return y=e.sent(),console.error(y),[3,6];case 6:return[2]}})})},fetchUserBets=function(e){var s=e.account;return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u;return __generator(this,function(e){switch(e.label){case 0:e.trys.push([0,8,,9]),n=void(t=0),a=[],i=getContract("bet"),e.label=1;case 1:if(0!==t&&!n)return[3,6];e.label=2;case 2:return e.trys.push([2,4,,5]),[4,i.tokenOfOwnerByIndex(s,t++)];case 3:return n=e.sent(),a.push(n.toNumber()),[3,5];case 4:return e.sent(),n=null,[3,5];case 5:return[3,1];case 6:return[4,Promise.all(a.map(fetchBet))];case 7:return[2,e.sent().filter(Boolean).sort(function(e,t){return t.createdAt-e.createdAt})];case 8:return u=e.sent(),console.error(u),[2,[]];case 9:return[2]}})})},redeemBetPrize=function(e){return getContract("lp",!0).withdrawPayout(e)};export{RATE_DECIMALS,USDT_DECIMALS,approve,calculateActualOdds,checkTestTokensClaimable,claimTestTokens,configure,fetchAllowance,fetchBalance,fetchGames,fetchUserBets,placeBet,redeemBetPrize as redeemPrize,setSelectedChainId,setWallerProvider};

@@ -9,3 +9,3 @@ export { checkTestTokensClaimable, default as claimTestTokens } from './claimTestTokens';

export { default as fetchUserBets } from './fetchUserBets';
export { default as claimPrize } from './claimPrize';
export { default as redeemPrize } from './redeemBetPrize';
//# sourceMappingURL=index.d.ts.map

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var contracts=require("@ethersproject/contracts"),providers=require("@ethersproject/providers"),ethers=require("ethers"),axios=require("axios"),units=require("@ethersproject/units");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var axios__default=_interopDefaultLegacy(axios),CoreABI=[{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"conditionID",type:"uint256"},{indexed:!1,internalType:"uint256",name:"timestamp",type:"uint256"}],name:"ConditionCreated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"conditionID",type:"uint256"},{indexed:!1,internalType:"uint256",name:"outcomeWin",type:"uint256"},{indexed:!1,internalType:"uint256",name:"state",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amountForLP",type:"uint256"}],name:"ConditionResolved",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"conditionID",type:"uint256"},{indexed:!1,internalType:"uint256",name:"newTimestamp",type:"uint256"}],name:"ConditionShifted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{inputs:[{internalType:"address",name:"maintainer",type:"address"},{internalType:"bool",name:"active",type:"bool"}],name:"addMaintainer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"bets",outputs:[{internalType:"uint256",name:"conditionID",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"odds",type:"uint256"},{internalType:"uint256",name:"outcome",type:"uint256"},{internalType:"bool",name:"payed",type:"bool"},{internalType:"uint256",name:"createdAt",type:"uint256"},{internalType:"address",name:"affiliate",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"outcomeWin",type:"uint256"}],name:"calculateOdds",outputs:[{internalType:"uint256",name:"odds",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"}],name:"cancel",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"conditions",outputs:[{internalType:"uint256",name:"reinforcement",type:"uint256"},{internalType:"uint256",name:"margin",type:"uint256"},{internalType:"bytes32",name:"ipfsHash",type:"bytes32"},{internalType:"uint256",name:"outcomeWin",type:"uint256"},{internalType:"enum Core.conditionState",name:"state",type:"uint8"},{internalType:"uint256",name:"maxPayout",type:"uint256"},{internalType:"uint256",name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"conditionsMargin",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"conditionsReinforcementFix",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"oracleConditionID",type:"uint256"},{internalType:"uint256[2]",name:"odds",type:"uint256[2]"},{internalType:"uint256[2]",name:"outcomes",type:"uint256[2]"},{internalType:"uint256",name:"timestamp",type:"uint256"},{internalType:"bytes32",name:"ipfsHash",type:"bytes32"}],name:"createCondition",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"betId",type:"uint256"}],name:"getBetInfo",outputs:[{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"odds",type:"uint256"},{internalType:"uint256",name:"createdAt",type:"uint256"},{internalType:"address",name:"affiliate",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"}],name:"getCondition",outputs:[{components:[{internalType:"uint256",name:"reinforcement",type:"uint256"},{internalType:"uint256[2]",name:"fundBank",type:"uint256[2]"},{internalType:"uint256[2]",name:"payouts",type:"uint256[2]"},{internalType:"uint256[2]",name:"totalNetBets",type:"uint256[2]"},{internalType:"uint256[2]",name:"outcomes",type:"uint256[2]"},{internalType:"uint256",name:"margin",type:"uint256"},{internalType:"bytes32",name:"ipfsHash",type:"bytes32"},{internalType:"uint256",name:"outcomeWin",type:"uint256"},{internalType:"enum Core.conditionState",name:"state",type:"uint8"},{internalType:"uint256",name:"maxPayout",type:"uint256"},{internalType:"uint256",name:"timestamp",type:"uint256"}],internalType:"struct Core.Condition",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"}],name:"getConditionFunds",outputs:[{internalType:"uint256[2]",name:"fundBank",type:"uint256[2]"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentReinforcement",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLockedPayout",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"reinforcement_",type:"uint256"},{internalType:"address",name:"oracle_",type:"address"},{internalType:"uint256",name:"margin_",type:"uint256"},{internalType:"address",name:"math_",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"},{internalType:"uint256",name:"outcomeWin",type:"uint256"}],name:"isOutComeCorrect",outputs:[{internalType:"bool",name:"correct",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"lastBetID",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"lpAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"maintainers",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"mathAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"oracles",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"outcomeWin",type:"uint256"},{internalType:"uint256",name:"minOdds",type:"uint256"},{internalType:"address",name:"affiliate",type:"address"}],name:"putBet",outputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"oracle_",type:"address"}],name:"renounceOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"},{internalType:"uint256",name:"outcomeWin",type:"uint256"}],name:"resolveCondition",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenID",type:"uint256"}],name:"resolvePayout",outputs:[{internalType:"bool",name:"success",type:"bool"},{internalType:"uint256",name:"amount",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"lpAddress_",type:"address"}],name:"setLP",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"oracle_",type:"address"}],name:"setOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"},{internalType:"uint256",name:"newTimestamp",type:"uint256"}],name:"shift",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"totalLockedPayout",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenID_",type:"uint256"}],name:"viewPayout",outputs:[{internalType:"bool",name:"success",type:"bool"},{internalType:"uint256",name:"amount",type:"uint256"}],stateMutability:"view",type:"function"}],LpABI=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"better",type:"address"},{indexed:!1,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"BetterWin",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"LiquidityAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"LiquidityRemoved",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"requestWallet",type:"address"},{indexed:!1,internalType:"uint256",name:"requestedValueLP",type:"uint256"}],name:"LiquidityRequested",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"uint256",name:"betID",type:"uint256"},{indexed:!0,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"outcomeId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"odds",type:"uint256"},{indexed:!1,internalType:"uint256",name:"fund1",type:"uint256"},{indexed:!1,internalType:"uint256",name:"fund2",type:"uint256"}],name:"NewBet",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"addLiquidity",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"initReserve",type:"uint256"},{internalType:"uint256",name:"profitReserve",type:"uint256"}],name:"addReserve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"affiliates",outputs:[{internalType:"uint256",name:"claimed",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"azuroBet",outputs:[{internalType:"contract IAzuroBet",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"outcomeID",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint256",name:"minOdds",type:"uint256"},{internalType:"address",name:"affiliate_",type:"address"}],name:"bet",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"bettingLiquidity",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"addr",type:"address"}],name:"changeCore",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"newPeriod",type:"uint256"}],name:"changePeriod",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"newOdds_",type:"uint256"}],name:"changeRewardOdds",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"claimReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"core",outputs:[{internalType:"contract ICore",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"wallet",type:"address"}],name:"getLiquidityRequests",outputs:[{internalType:"uint256[3]",name:"beginDates",type:"uint256[3]"},{internalType:"uint256[3]",name:"personal",type:"uint256[3]"},{internalType:"uint256[3]",name:"total",type:"uint256[3]"}],stateMutability:"view",type:"function"},{inputs:[],name:"getPeriodsDates",outputs:[{internalType:"uint256[3]",name:"beginDates",type:"uint256[3]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"reinforcementAmount",type:"uint256"}],name:"getPossibilityOfReinforcement",outputs:[{internalType:"bool",name:"status",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"getPossibilityOfReinforcementFromCore",outputs:[{internalType:"bool",name:"status",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"getReserve",outputs:[{internalType:"uint256",name:"reserve",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"initStartDate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"token_",type:"address"},{internalType:"address",name:"azuroBetAddress",type:"address"},{internalType:"uint256",name:"_periodLen",type:"uint256"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"valueLP",type:"uint256"}],name:"liquidityRequest",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"lockReserve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"lockedLiquidity",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"oddsDecimals",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"affiliate_",type:"address"}],name:"pendingReward",outputs:[{internalType:"uint256",name:"reward",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"periodLen",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"phase2end",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"reinforcementAbility",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"requests",outputs:[{internalType:"uint256",name:"totalValue",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"rewardFeeOdds",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"savedPeriods",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"addr",type:"address"}],name:"setAzuroBet",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"token",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalBetsAmount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalReserve",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalRewards",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"viewPayout",outputs:[{internalType:"bool",name:"",type:"bool"},{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"amountLP",type:"uint256"}],name:"withdrawLiquidity",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"withdrawPayout",outputs:[],stateMutability:"nonpayable",type:"function"}],BetABI=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"id",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"freeze",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bool",name:"active",type:"bool"}],name:"freezeTransfers",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"lpAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"id",type:"uint256"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOftoken",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"_data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"lpAddress_",type:"address"}],name:"setLP",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenOfOwnerByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"}],ERC20ABI=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"bool",name:"active",type:"bool"}],name:"addPrivilegedAccounts",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"availableToClaim",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"newPrice",type:"uint256"}],name:"changePrice",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"claim",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"contestsDuration",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"contestsStartDate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"ethBalance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getTokens",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"price",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_contestsDuration",type:"uint256"}],name:"setContestDuration",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"startDate",type:"uint256"}],name:"setContestStartDate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],CONTRACTS={core:{address:"0x1023DB1EFE371CC798f775284D5f2B46e83FdfFd",abi:CoreABI,decimals:18},lp:{address:"0x6Cb354C4844634509a59B0BabBa9b41aEe4d5617",abi:LpABI,decimals:18},bet:{address:"0x10F39e8e1f1ea645Ab1959e10114059e9A23B079",abi:BetABI,decimals:18},usdt:{address:"0x1267e4e7D0f17c9D390d6bEeE5655A58Df35af34",abi:ERC20ABI,decimals:18}},createContract=function(e,t){var e=CONTRACTS[e.toLowerCase()],n=e.address,e=e.abi;return new contracts.Contract(n,e,t)},state={walletProvider:null,selectedChainId:null,readContracts:{},writeContracts:{}},setWallerProvider=function(e){state.walletProvider=e},setSelectedChainId=function(e){state.selectedChainId=e},__assign=function(){return(__assign=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function __awaiter(e,s,r,p){return new(r=r||Promise)(function(n,t){function a(e){try{u(p.next(e))}catch(e){t(e)}}function i(e){try{u(p.throw(e))}catch(e){t(e)}}function u(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,i)}u((p=p.apply(e,s||[])).next())})}function __generator(a,i){var u,s,r,p={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(n){return function(e){var t=[n,e];if(u)throw new TypeError("Generator is already executing.");for(;p;)try{if(u=1,s&&(r=2&t[0]?s.return:t[0]?s.throw||((r=s.return)&&r.call(s),0):s.next)&&!(r=r.call(s,t[1])).done)return r;switch(s=0,(t=r?[2&t[0],r.value]:t)[0]){case 0:case 1:r=t;break;case 4:return p.label++,{value:t[1],done:!1};case 5:p.label++,s=t[1],t=[0];continue;case 7:t=p.ops.pop(),p.trys.pop();continue;default:if(!(r=0<(r=p.trys).length&&r[r.length-1])&&(6===t[0]||2===t[0])){p=0;continue}if(3===t[0]&&(!r||t[1]>r[0]&&t[1]<r[3])){p.label=t[1];break}if(6===t[0]&&p.label<r[1]){p.label=r[1],r=t;break}if(r&&p.label<r[2]){p.label=r[2],p.ops.push(t);break}r[2]&&p.ops.pop(),p.trys.pop();continue}t=i.call(a,p)}catch(e){t=[6,e],s=0}finally{u=r=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}}function __read(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var a,i,u=n.call(e),s=[];try{for(;(void 0===t||0<t--)&&!(a=u.next()).done;)s.push(a.value)}catch(e){i={error:e}}finally{try{a&&!a.done&&(n=u.return)&&n.call(u)}finally{if(i)throw i.error}}return s}function __spread(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(__read(arguments[t]));return e}var ConditionStatus,config={infuraKey:null,alchemyKey:null},configure=function(e){Object.entries(e).forEach(function(e){var e=__read(e,2),t=e[0],e=e[1];config[t]=e})},getProvider=function(e){return 1337===state.selectedChainId?new providers.JsonRpcProvider:state.walletProvider?e?state.walletProvider.getSigner():state.walletProvider:5!==state.selectedChainId&&config.alchemyKey?new providers.AlchemyProvider(state.selectedChainId,config.alchemyKey):new providers.InfuraProvider(state.selectedChainId,config.infuraKey)},getContract=function(e,t){var n=t?state.writeContracts:state.readContracts;return n[e]||(t=getProvider(t),t=createContract(e,t),n[e]=t),n[e]},checkTestTokensClaimable=function(e){return getContract("usdt").availableToClaim(e)},claimTestTokens=function(e){return getContract("usdt",!0).claim(e)},fetchBalance=function(e){return getContract("usdt").balanceOf(e)},calculateOdd=function(e,t){var n=1/(1-1/e),t=1+t,a=t*(n-1)/(e-1),n=((n-1)/(e-1)+1)*(t-1),e=2-t;return(-1*n+Math.pow(Math.pow(n,2)+4*a*e,.5))/(2*a)+1},calculateInitialOdds=function(e,t){return[calculateOdd(e[0],t),calculateOdd(e[1],t)]},fetchGameIpfsData=function(p){return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,s,r;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,axios__default.default.get("https://azuro.mypinata.cloud/ipfs/"+p)];case 1:return s=e.sent().data,r=s.gameId,t=s.entity1Name,n=s.entity1Image,a=s.entity2Name,i=s.entity2Image,u=s.titleCountry,s=s.titleLeague,[2,{id:r,country:u,league:s,participants:[{name:t,image:n},{name:a,image:i}]}];case 2:return r=e.sent(),console.error(r),[2,null];case 3:return[2]}})})},_calculateInitialOdds=(!function(e){e[e.CREATED=0]="CREATED",e[e.RESOLVED=1]="RESOLVED",e[e.CANCELED=2]="CANCELED"}(ConditionStatus=ConditionStatus||{}),function(e,t){var n=e[0].add(e[1]).toString(),e=e.map(function(e){return n/e.toString()}),t=t.toString()/1e9;return calculateInitialOdds(e,t)}),fetchConditions=function(a){return void 0===a&&(a={}),__awaiter(void 0,void 0,void 0,function(){var p,o,y,t,n;return __generator(this,function(e){switch(e.label){case 0:return t=a.filters,n=(t=void 0===t?{}:t).resolved,p=void 0===n||n,n=t.canceled,o=void 0===n||n,y=getContract("core"),t=y.filters.ConditionCreated(),[4,y.queryFilter(t)];case 1:return n=e.sent(),[4,Promise.all(n.map(function(e){var r=e.args.conditionID;return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,s;return __generator(this,function(e){switch(e.label){case 0:return t=r.toNumber(),[4,y.getCondition(r)];case 1:return(s=e.sent(),n=s.state,p||n!==ConditionStatus.RESOLVED)?o||n!==ConditionStatus.CANCELED?(a=_calculateInitialOdds(s.fundBank,s.margin),i=s.outcomes.map(function(e){return e.toNumber()}),u=1e3*s.timestamp.toNumber(),s=ethers.utils.arrayify(s.ipfsHash),s=ethers.utils.base58.encode(__spread([18,32],s)),[4,fetchGameIpfsData(s)]):[2]:[2];case 2:return s=e.sent(),[2,{id:t,outcomes:i,odds:a,gameInfo:__assign(__assign({},s),{state:n,startsAt:u})}]}})})}))];case 2:return[2,e.sent().filter(Boolean)]}})})},betTypeOdd={1:{outcomeRegistryId:180,marketRegistryId:9,paramId:1},2:{outcomeRegistryId:181,marketRegistryId:9,paramId:1},3:{outcomeRegistryId:7,marketRegistryId:3,paramId:96},4:{outcomeRegistryId:8,marketRegistryId:3,paramId:32},5:{outcomeRegistryId:7,marketRegistryId:3,paramId:94},6:{outcomeRegistryId:8,marketRegistryId:3,paramId:6},7:{outcomeRegistryId:7,marketRegistryId:3,paramId:36},8:{outcomeRegistryId:8,marketRegistryId:3,paramId:5},9:{outcomeRegistryId:7,marketRegistryId:3,paramId:7},10:{outcomeRegistryId:8,marketRegistryId:3,paramId:4},11:{outcomeRegistryId:7,marketRegistryId:3,paramId:1},12:{outcomeRegistryId:8,marketRegistryId:3,paramId:1},13:{outcomeRegistryId:7,marketRegistryId:3,paramId:4},14:{outcomeRegistryId:8,marketRegistryId:3,paramId:7},15:{outcomeRegistryId:7,marketRegistryId:3,paramId:5},16:{outcomeRegistryId:8,marketRegistryId:3,paramId:36},17:{outcomeRegistryId:7,marketRegistryId:3,paramId:6},18:{outcomeRegistryId:8,marketRegistryId:3,paramId:94},19:{outcomeRegistryId:7,marketRegistryId:3,paramId:32},20:{outcomeRegistryId:8,marketRegistryId:3,paramId:96},21:{outcomeRegistryId:9,marketRegistryId:4,paramId:4},22:{outcomeRegistryId:10,marketRegistryId:4,paramId:4},23:{outcomeRegistryId:9,marketRegistryId:4,paramId:5},24:{outcomeRegistryId:10,marketRegistryId:4,paramId:5},25:{outcomeRegistryId:9,marketRegistryId:4,paramId:6},26:{outcomeRegistryId:10,marketRegistryId:4,paramId:6},27:{outcomeRegistryId:9,marketRegistryId:4,paramId:32},28:{outcomeRegistryId:10,marketRegistryId:4,paramId:32},29:{outcomeRegistryId:1,marketRegistryId:1,paramId:1},30:{outcomeRegistryId:2,marketRegistryId:1,paramId:1},31:{outcomeRegistryId:3,marketRegistryId:1,paramId:1},32:{outcomeRegistryId:10009,marketRegistryId:19,paramId:1},33:{outcomeRegistryId:10010,marketRegistryId:19,paramId:1},34:{outcomeRegistryId:10009,marketRegistryId:20,paramId:1},35:{outcomeRegistryId:10010,marketRegistryId:20,paramId:1},36:{outcomeRegistryId:10009,marketRegistryId:21,paramId:1},37:{outcomeRegistryId:10010,marketRegistryId:21,paramId:1},38:{outcomeRegistryId:4,marketRegistryId:2,paramId:1},39:{outcomeRegistryId:5,marketRegistryId:2,paramId:1},40:{outcomeRegistryId:6,marketRegistryId:2,paramId:1}},gamesInfo={},gameBets={},groupBetVariants=function(e){var t={};return e.forEach(function(e){t[e.paramId]||(t[e.paramId]=[]),t[e.paramId].push(e)}),t},groupGames=function(){return Object.keys(gameBets).map(function(e){var e=gameBets[e],t=e.gameId,n=e.marketRegistryId,e=e.betVariants,a=groupBetVariants(e),e=Object.keys(a);return e=1===e.length?[{paramId:null,odds:a[e[0]].sort(function(e,t){return e.outcomeId-t.outcomeId})}]:Object.keys(a).map(function(e){return{paramId:parseInt(e),odds:a[e].sort(function(e,t){return t.outcomeId-e.outcomeId})}}),__assign(__assign({},gamesInfo[t]),{conditions:e,marketRegistryId:n})})},groupOddsByOutcomes=function(e){var s=e.gameId,r=e.conditionId,t=e.outcomes,p=e.odds;return t.map(function(e,t){var t=p[t],n=betTypeOdd[e],a=n.outcomeRegistryId,i=n.marketRegistryId,n=n.paramId,u=s+"-"+i,i=(gameBets[u]||(gameBets[u]={gameId:s,marketRegistryId:i,betVariants:[]}),{conditionId:r,outcomeId:e,outcomeRegistryId:a,paramId:n,value:t});gameBets[u].betVariants.push(i)})},fetchGames=function(t){return void 0===t&&(t={}),__awaiter(void 0,void 0,void 0,function(){return __generator(this,function(e){switch(e.label){case 0:return[4,fetchConditions(t)];case 1:return e.sent().forEach(function(e){var t=e.id,n=e.outcomes,a=e.odds,e=e.gameInfo;gamesInfo[e.id]=e,groupOddsByOutcomes({gameId:e.id,conditionId:t,outcomes:n,odds:a})}),[2,groupGames().sort(function(e,t){return e.startsAt-t.startsAt})]}})})},RATE_DECIMALS=9,USDT_DECIMALS=18,calculateActualOdds=function(e){var a=e.conditionId,i=e.outcomeId,u=e.betAmount;return __awaiter(void 0,void 0,void 0,function(){var t,n;return __generator(this,function(e){switch(e.label){case 0:return t=units.parseUnits(String(u),USDT_DECIMALS),[4,getContract("core").calculateOdds(a,t,i)];case 1:return t=e.sent(),n=units.formatUnits(t,RATE_DECIMALS),[2,parseFloat(n)]}})})},fetchAllowance=function(e){return getContract("usdt").allowance(e,CONTRACTS.usdt.address)},approve=function(e){return getContract("usdt",!0).approve(CONTRACTS.usdt.address,e)},placeBet=function(p){return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,s,r;return __generator(this,function(e){return t=p.conditionId,n=p.outcomeId,u=p.amount,r=p.betRate,s=p.slippage,a=p.affiliate,a=void 0===a?"0x0000000000000000000000000000000000000000":a,i=getContract("lp",!0),u=units.parseUnits(String(u),USDT_DECIMALS),r=(1+(r-1)*(100-s)/100).toFixed(8),s=units.parseUnits(r,RATE_DECIMALS),r=Math.floor(Date.now()/1e3)+2e3,[2,i.bet(t,u,n,r,s,a)]})})},fetchBet=function(w){return __awaiter(void 0,void 0,void 0,function(){var t,n,d,l,m,c,a,i,f,u,T,s,b,I,r,v,p,g,o,y;return __generator(this,function(e){switch(e.label){case 0:t=getContract("core"),e.label=1;case 1:return e.trys.push([1,5,,6]),[4,t.bets(w)];case 2:return a=e.sent(),n=a.conditionID,d=a.amount,l=a.outcome,m=a.odds,c=a.payed,a=a.createdAt,[4,t.getCondition(n)];case 3:return u=e.sent(),i=u.state,s=u.ipfsHash,f=u.timestamp,u=u.outcomeWin,T=n.toNumber(),s=ethers.utils.arrayify(s),s=ethers.utils.base58.encode(__spread([18,32],s)),[4,fetchGameIpfsData(s)];case 4:return s=e.sent(),b=1e3*f.toNumber(),y=l.toNumber(),o=u.toNumber(),r=betTypeOdd[y],I=r.outcomeRegistryId,r=r.paramId,v=parseFloat(units.formatUnits(m,RATE_DECIMALS)),p=parseFloat(units.formatUnits(d,USDT_DECIMALS)),g=void 0,g=i===ConditionStatus.CANCELED?p:0===o?null:o===y?(p*v).toFixed(6):-1*p,o=__assign(__assign({},s),{startsAt:b,state:i}),[2,{nftId:w,conditionId:T,paramId:r,outcomeRegistryId:I,rate:v,amount:p,result:g,createdAt:1e3*a.toNumber(),isRedeemed:c,gameInfo:o}];case 5:return y=e.sent(),console.error(y),[3,6];case 6:return[2]}})})},fetchUserBets=function(e){var s=e.account;return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u;return __generator(this,function(e){switch(e.label){case 0:e.trys.push([0,8,,9]),n=void(t=0),a=[],i=getContract("bet"),e.label=1;case 1:if(0!==t&&!n)return[3,6];e.label=2;case 2:return e.trys.push([2,4,,5]),[4,i.tokenOfOwnerByIndex(s,t++)];case 3:return n=e.sent(),a.push(n.toNumber()),[3,5];case 4:return e.sent(),n=null,[3,5];case 5:return[3,1];case 6:return[4,Promise.all(a.map(fetchBet))];case 7:return[2,e.sent().filter(Boolean).sort(function(e,t){return t.createdAt-e.createdAt})];case 8:return u=e.sent(),console.error(u),[2,[]];case 9:return[2]}})})},claimPrize=function(){};exports.RATE_DECIMALS=RATE_DECIMALS,exports.USDT_DECIMALS=USDT_DECIMALS,exports.approve=approve,exports.calculateActualOdds=calculateActualOdds,exports.checkTestTokensClaimable=checkTestTokensClaimable,exports.claimPrize=claimPrize,exports.claimTestTokens=claimTestTokens,exports.configure=configure,exports.fetchAllowance=fetchAllowance,exports.fetchBalance=fetchBalance,exports.fetchGames=fetchGames,exports.fetchUserBets=fetchUserBets,exports.placeBet=placeBet,exports.setSelectedChainId=setSelectedChainId,exports.setWallerProvider=setWallerProvider;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var contracts=require("@ethersproject/contracts"),providers=require("@ethersproject/providers"),ethers=require("ethers"),axios=require("axios"),units=require("@ethersproject/units");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var axios__default=_interopDefaultLegacy(axios),CoreABI=[{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"conditionID",type:"uint256"},{indexed:!1,internalType:"uint256",name:"timestamp",type:"uint256"}],name:"ConditionCreated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"conditionID",type:"uint256"},{indexed:!1,internalType:"uint256",name:"outcomeWin",type:"uint256"},{indexed:!1,internalType:"uint256",name:"state",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amountForLP",type:"uint256"}],name:"ConditionResolved",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"conditionID",type:"uint256"},{indexed:!1,internalType:"uint256",name:"newTimestamp",type:"uint256"}],name:"ConditionShifted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{inputs:[{internalType:"address",name:"maintainer",type:"address"},{internalType:"bool",name:"active",type:"bool"}],name:"addMaintainer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"bets",outputs:[{internalType:"uint256",name:"conditionID",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"odds",type:"uint256"},{internalType:"uint256",name:"outcome",type:"uint256"},{internalType:"bool",name:"payed",type:"bool"},{internalType:"uint256",name:"createdAt",type:"uint256"},{internalType:"address",name:"affiliate",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"outcomeWin",type:"uint256"}],name:"calculateOdds",outputs:[{internalType:"uint256",name:"odds",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"}],name:"cancel",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"conditions",outputs:[{internalType:"uint256",name:"reinforcement",type:"uint256"},{internalType:"uint256",name:"margin",type:"uint256"},{internalType:"bytes32",name:"ipfsHash",type:"bytes32"},{internalType:"uint256",name:"outcomeWin",type:"uint256"},{internalType:"enum Core.conditionState",name:"state",type:"uint8"},{internalType:"uint256",name:"maxPayout",type:"uint256"},{internalType:"uint256",name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"conditionsMargin",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"conditionsReinforcementFix",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"oracleConditionID",type:"uint256"},{internalType:"uint256[2]",name:"odds",type:"uint256[2]"},{internalType:"uint256[2]",name:"outcomes",type:"uint256[2]"},{internalType:"uint256",name:"timestamp",type:"uint256"},{internalType:"bytes32",name:"ipfsHash",type:"bytes32"}],name:"createCondition",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"betId",type:"uint256"}],name:"getBetInfo",outputs:[{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"odds",type:"uint256"},{internalType:"uint256",name:"createdAt",type:"uint256"},{internalType:"address",name:"affiliate",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"}],name:"getCondition",outputs:[{components:[{internalType:"uint256",name:"reinforcement",type:"uint256"},{internalType:"uint256[2]",name:"fundBank",type:"uint256[2]"},{internalType:"uint256[2]",name:"payouts",type:"uint256[2]"},{internalType:"uint256[2]",name:"totalNetBets",type:"uint256[2]"},{internalType:"uint256[2]",name:"outcomes",type:"uint256[2]"},{internalType:"uint256",name:"margin",type:"uint256"},{internalType:"bytes32",name:"ipfsHash",type:"bytes32"},{internalType:"uint256",name:"outcomeWin",type:"uint256"},{internalType:"enum Core.conditionState",name:"state",type:"uint8"},{internalType:"uint256",name:"maxPayout",type:"uint256"},{internalType:"uint256",name:"timestamp",type:"uint256"}],internalType:"struct Core.Condition",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"}],name:"getConditionFunds",outputs:[{internalType:"uint256[2]",name:"fundBank",type:"uint256[2]"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentReinforcement",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLockedPayout",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"reinforcement_",type:"uint256"},{internalType:"address",name:"oracle_",type:"address"},{internalType:"uint256",name:"margin_",type:"uint256"},{internalType:"address",name:"math_",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"},{internalType:"uint256",name:"outcomeWin",type:"uint256"}],name:"isOutComeCorrect",outputs:[{internalType:"bool",name:"correct",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"lastBetID",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"lpAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"maintainers",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"mathAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"oracles",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"outcomeWin",type:"uint256"},{internalType:"uint256",name:"minOdds",type:"uint256"},{internalType:"address",name:"affiliate",type:"address"}],name:"putBet",outputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"oracle_",type:"address"}],name:"renounceOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"},{internalType:"uint256",name:"outcomeWin",type:"uint256"}],name:"resolveCondition",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenID",type:"uint256"}],name:"resolvePayout",outputs:[{internalType:"bool",name:"success",type:"bool"},{internalType:"uint256",name:"amount",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"lpAddress_",type:"address"}],name:"setLP",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"oracle_",type:"address"}],name:"setOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"},{internalType:"uint256",name:"newTimestamp",type:"uint256"}],name:"shift",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"totalLockedPayout",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenID_",type:"uint256"}],name:"viewPayout",outputs:[{internalType:"bool",name:"success",type:"bool"},{internalType:"uint256",name:"amount",type:"uint256"}],stateMutability:"view",type:"function"}],LpABI=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"better",type:"address"},{indexed:!1,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"BetterWin",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"LiquidityAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"LiquidityRemoved",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"requestWallet",type:"address"},{indexed:!1,internalType:"uint256",name:"requestedValueLP",type:"uint256"}],name:"LiquidityRequested",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"uint256",name:"betID",type:"uint256"},{indexed:!0,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"outcomeId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"odds",type:"uint256"},{indexed:!1,internalType:"uint256",name:"fund1",type:"uint256"},{indexed:!1,internalType:"uint256",name:"fund2",type:"uint256"}],name:"NewBet",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"addLiquidity",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"initReserve",type:"uint256"},{internalType:"uint256",name:"profitReserve",type:"uint256"}],name:"addReserve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"affiliates",outputs:[{internalType:"uint256",name:"claimed",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"azuroBet",outputs:[{internalType:"contract IAzuroBet",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"outcomeID",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint256",name:"minOdds",type:"uint256"},{internalType:"address",name:"affiliate_",type:"address"}],name:"bet",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"bettingLiquidity",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"addr",type:"address"}],name:"changeCore",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"newPeriod",type:"uint256"}],name:"changePeriod",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"newOdds_",type:"uint256"}],name:"changeRewardOdds",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"claimReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"core",outputs:[{internalType:"contract ICore",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"wallet",type:"address"}],name:"getLiquidityRequests",outputs:[{internalType:"uint256[3]",name:"beginDates",type:"uint256[3]"},{internalType:"uint256[3]",name:"personal",type:"uint256[3]"},{internalType:"uint256[3]",name:"total",type:"uint256[3]"}],stateMutability:"view",type:"function"},{inputs:[],name:"getPeriodsDates",outputs:[{internalType:"uint256[3]",name:"beginDates",type:"uint256[3]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"reinforcementAmount",type:"uint256"}],name:"getPossibilityOfReinforcement",outputs:[{internalType:"bool",name:"status",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"getPossibilityOfReinforcementFromCore",outputs:[{internalType:"bool",name:"status",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"getReserve",outputs:[{internalType:"uint256",name:"reserve",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"initStartDate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"token_",type:"address"},{internalType:"address",name:"azuroBetAddress",type:"address"},{internalType:"uint256",name:"_periodLen",type:"uint256"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"valueLP",type:"uint256"}],name:"liquidityRequest",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"lockReserve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"lockedLiquidity",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"oddsDecimals",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"affiliate_",type:"address"}],name:"pendingReward",outputs:[{internalType:"uint256",name:"reward",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"periodLen",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"phase2end",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"reinforcementAbility",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"requests",outputs:[{internalType:"uint256",name:"totalValue",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"rewardFeeOdds",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"savedPeriods",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"addr",type:"address"}],name:"setAzuroBet",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"token",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalBetsAmount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalReserve",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalRewards",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"viewPayout",outputs:[{internalType:"bool",name:"",type:"bool"},{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"amountLP",type:"uint256"}],name:"withdrawLiquidity",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"withdrawPayout",outputs:[],stateMutability:"nonpayable",type:"function"}],BetABI=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"id",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"freeze",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bool",name:"active",type:"bool"}],name:"freezeTransfers",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"lpAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"id",type:"uint256"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOftoken",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"_data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"lpAddress_",type:"address"}],name:"setLP",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenOfOwnerByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"}],ERC20ABI=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"bool",name:"active",type:"bool"}],name:"addPrivilegedAccounts",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"availableToClaim",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"newPrice",type:"uint256"}],name:"changePrice",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"claim",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"contestsDuration",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"contestsStartDate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"ethBalance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getTokens",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"price",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_contestsDuration",type:"uint256"}],name:"setContestDuration",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"startDate",type:"uint256"}],name:"setContestStartDate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],CONTRACTS={core:{address:"0x1023DB1EFE371CC798f775284D5f2B46e83FdfFd",abi:CoreABI,decimals:18},lp:{address:"0x6Cb354C4844634509a59B0BabBa9b41aEe4d5617",abi:LpABI,decimals:18},bet:{address:"0x10F39e8e1f1ea645Ab1959e10114059e9A23B079",abi:BetABI,decimals:18},usdt:{address:"0x1267e4e7D0f17c9D390d6bEeE5655A58Df35af34",abi:ERC20ABI,decimals:18}},createContract=function(e,t){var e=CONTRACTS[e.toLowerCase()],n=e.address,e=e.abi;return new contracts.Contract(n,e,t)},state={walletProvider:null,selectedChainId:null,readContracts:{},writeContracts:{}},setWallerProvider=function(e){state.walletProvider=e},setSelectedChainId=function(e){state.selectedChainId=e},__assign=function(){return(__assign=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function __awaiter(e,s,r,p){return new(r=r||Promise)(function(n,t){function a(e){try{u(p.next(e))}catch(e){t(e)}}function i(e){try{u(p.throw(e))}catch(e){t(e)}}function u(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,i)}u((p=p.apply(e,s||[])).next())})}function __generator(a,i){var u,s,r,p={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(n){return function(e){var t=[n,e];if(u)throw new TypeError("Generator is already executing.");for(;p;)try{if(u=1,s&&(r=2&t[0]?s.return:t[0]?s.throw||((r=s.return)&&r.call(s),0):s.next)&&!(r=r.call(s,t[1])).done)return r;switch(s=0,(t=r?[2&t[0],r.value]:t)[0]){case 0:case 1:r=t;break;case 4:return p.label++,{value:t[1],done:!1};case 5:p.label++,s=t[1],t=[0];continue;case 7:t=p.ops.pop(),p.trys.pop();continue;default:if(!(r=0<(r=p.trys).length&&r[r.length-1])&&(6===t[0]||2===t[0])){p=0;continue}if(3===t[0]&&(!r||t[1]>r[0]&&t[1]<r[3])){p.label=t[1];break}if(6===t[0]&&p.label<r[1]){p.label=r[1],r=t;break}if(r&&p.label<r[2]){p.label=r[2],p.ops.push(t);break}r[2]&&p.ops.pop(),p.trys.pop();continue}t=i.call(a,p)}catch(e){t=[6,e],s=0}finally{u=r=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}}function __read(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var a,i,u=n.call(e),s=[];try{for(;(void 0===t||0<t--)&&!(a=u.next()).done;)s.push(a.value)}catch(e){i={error:e}}finally{try{a&&!a.done&&(n=u.return)&&n.call(u)}finally{if(i)throw i.error}}return s}function __spread(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(__read(arguments[t]));return e}var ConditionStatus,config={infuraKey:null,alchemyKey:null},configure=function(e){Object.entries(e).forEach(function(e){var e=__read(e,2),t=e[0],e=e[1];config[t]=e})},getProvider=function(e){return 1337===state.selectedChainId?new providers.JsonRpcProvider:state.walletProvider?e?state.walletProvider.getSigner():state.walletProvider:5!==state.selectedChainId&&config.alchemyKey?new providers.AlchemyProvider(state.selectedChainId,config.alchemyKey):new providers.InfuraProvider(state.selectedChainId,config.infuraKey)},getContract=function(e,t){var n=t?state.writeContracts:state.readContracts;return n[e]||(t=getProvider(t),t=createContract(e,t),n[e]=t),n[e]},checkTestTokensClaimable=function(e){return getContract("usdt").availableToClaim(e)},claimTestTokens=function(e){return getContract("usdt",!0).claim(e)},fetchBalance=function(e){return getContract("usdt").balanceOf(e)},calculateOdd=function(e,t){var n=1/(1-1/e),t=1+t,a=t*(n-1)/(e-1),n=((n-1)/(e-1)+1)*(t-1),e=2-t;return(-1*n+Math.pow(Math.pow(n,2)+4*a*e,.5))/(2*a)+1},calculateInitialOdds=function(e,t){return[calculateOdd(e[0],t),calculateOdd(e[1],t)]},fetchGameIpfsData=function(p){return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,s,r;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,axios__default.default.get("https://azuro.mypinata.cloud/ipfs/"+p)];case 1:return s=e.sent().data,r=s.gameId,t=s.entity1Name,n=s.entity1Image,a=s.entity2Name,i=s.entity2Image,u=s.titleCountry,s=s.titleLeague,[2,{id:r,country:u,league:s,participants:[{name:t,image:n},{name:a,image:i}]}];case 2:return r=e.sent(),console.error(r),[2,null];case 3:return[2]}})})},_calculateInitialOdds=(!function(e){e[e.CREATED=0]="CREATED",e[e.RESOLVED=1]="RESOLVED",e[e.CANCELED=2]="CANCELED"}(ConditionStatus=ConditionStatus||{}),function(e,t){var n=e[0].add(e[1]).toString(),e=e.map(function(e){return n/e.toString()}),t=t.toString()/1e9;return calculateInitialOdds(e,t)}),fetchConditions=function(a){return void 0===a&&(a={}),__awaiter(void 0,void 0,void 0,function(){var p,o,y,t,n;return __generator(this,function(e){switch(e.label){case 0:return t=a.filters,n=(t=void 0===t?{}:t).resolved,p=void 0===n||n,n=t.canceled,o=void 0===n||n,y=getContract("core"),t=y.filters.ConditionCreated(),[4,y.queryFilter(t)];case 1:return n=e.sent(),[4,Promise.all(n.map(function(e){var r=e.args.conditionID;return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,s;return __generator(this,function(e){switch(e.label){case 0:return t=r.toNumber(),[4,y.getCondition(r)];case 1:return(s=e.sent(),n=s.state,p||n!==ConditionStatus.RESOLVED)?o||n!==ConditionStatus.CANCELED?(a=_calculateInitialOdds(s.fundBank,s.margin),i=s.outcomes.map(function(e){return e.toNumber()}),u=1e3*s.timestamp.toNumber(),s=ethers.utils.arrayify(s.ipfsHash),s=ethers.utils.base58.encode(__spread([18,32],s)),[4,fetchGameIpfsData(s)]):[2]:[2];case 2:return s=e.sent(),[2,{id:t,outcomes:i,odds:a,gameInfo:__assign(__assign({},s),{state:n,startsAt:u})}]}})})}))];case 2:return[2,e.sent().filter(Boolean)]}})})},betTypeOdd={1:{outcomeRegistryId:180,marketRegistryId:9,paramId:1},2:{outcomeRegistryId:181,marketRegistryId:9,paramId:1},3:{outcomeRegistryId:7,marketRegistryId:3,paramId:96},4:{outcomeRegistryId:8,marketRegistryId:3,paramId:32},5:{outcomeRegistryId:7,marketRegistryId:3,paramId:94},6:{outcomeRegistryId:8,marketRegistryId:3,paramId:6},7:{outcomeRegistryId:7,marketRegistryId:3,paramId:36},8:{outcomeRegistryId:8,marketRegistryId:3,paramId:5},9:{outcomeRegistryId:7,marketRegistryId:3,paramId:7},10:{outcomeRegistryId:8,marketRegistryId:3,paramId:4},11:{outcomeRegistryId:7,marketRegistryId:3,paramId:1},12:{outcomeRegistryId:8,marketRegistryId:3,paramId:1},13:{outcomeRegistryId:7,marketRegistryId:3,paramId:4},14:{outcomeRegistryId:8,marketRegistryId:3,paramId:7},15:{outcomeRegistryId:7,marketRegistryId:3,paramId:5},16:{outcomeRegistryId:8,marketRegistryId:3,paramId:36},17:{outcomeRegistryId:7,marketRegistryId:3,paramId:6},18:{outcomeRegistryId:8,marketRegistryId:3,paramId:94},19:{outcomeRegistryId:7,marketRegistryId:3,paramId:32},20:{outcomeRegistryId:8,marketRegistryId:3,paramId:96},21:{outcomeRegistryId:9,marketRegistryId:4,paramId:4},22:{outcomeRegistryId:10,marketRegistryId:4,paramId:4},23:{outcomeRegistryId:9,marketRegistryId:4,paramId:5},24:{outcomeRegistryId:10,marketRegistryId:4,paramId:5},25:{outcomeRegistryId:9,marketRegistryId:4,paramId:6},26:{outcomeRegistryId:10,marketRegistryId:4,paramId:6},27:{outcomeRegistryId:9,marketRegistryId:4,paramId:32},28:{outcomeRegistryId:10,marketRegistryId:4,paramId:32},29:{outcomeRegistryId:1,marketRegistryId:1,paramId:1},30:{outcomeRegistryId:2,marketRegistryId:1,paramId:1},31:{outcomeRegistryId:3,marketRegistryId:1,paramId:1},32:{outcomeRegistryId:10009,marketRegistryId:19,paramId:1},33:{outcomeRegistryId:10010,marketRegistryId:19,paramId:1},34:{outcomeRegistryId:10009,marketRegistryId:20,paramId:1},35:{outcomeRegistryId:10010,marketRegistryId:20,paramId:1},36:{outcomeRegistryId:10009,marketRegistryId:21,paramId:1},37:{outcomeRegistryId:10010,marketRegistryId:21,paramId:1},38:{outcomeRegistryId:4,marketRegistryId:2,paramId:1},39:{outcomeRegistryId:5,marketRegistryId:2,paramId:1},40:{outcomeRegistryId:6,marketRegistryId:2,paramId:1}},gamesInfo={},gameBets={},groupBetVariants=function(e){var t={};return e.forEach(function(e){t[e.paramId]||(t[e.paramId]=[]),t[e.paramId].push(e)}),t},groupGames=function(){return Object.keys(gameBets).map(function(e){var e=gameBets[e],t=e.gameId,n=e.marketRegistryId,e=e.betVariants,a=groupBetVariants(e),e=Object.keys(a);return e=1===e.length?[{paramId:null,odds:a[e[0]].sort(function(e,t){return e.outcomeId-t.outcomeId})}]:Object.keys(a).map(function(e){return{paramId:parseInt(e),odds:a[e].sort(function(e,t){return t.outcomeId-e.outcomeId})}}),__assign(__assign({},gamesInfo[t]),{conditions:e,marketRegistryId:n})})},groupOddsByOutcomes=function(e){var s=e.gameId,r=e.conditionId,t=e.outcomes,p=e.odds;return t.map(function(e,t){var t=p[t],n=betTypeOdd[e],a=n.outcomeRegistryId,i=n.marketRegistryId,n=n.paramId,u=s+"-"+i,i=(gameBets[u]||(gameBets[u]={gameId:s,marketRegistryId:i,betVariants:[]}),{conditionId:r,outcomeId:e,outcomeRegistryId:a,paramId:n,value:t});gameBets[u].betVariants.push(i)})},fetchGames=function(t){return void 0===t&&(t={}),__awaiter(void 0,void 0,void 0,function(){return __generator(this,function(e){switch(e.label){case 0:return[4,fetchConditions(t)];case 1:return e.sent().forEach(function(e){var t=e.id,n=e.outcomes,a=e.odds,e=e.gameInfo;gamesInfo[e.id]=e,groupOddsByOutcomes({gameId:e.id,conditionId:t,outcomes:n,odds:a})}),[2,groupGames().sort(function(e,t){return e.startsAt-t.startsAt})]}})})},RATE_DECIMALS=9,USDT_DECIMALS=18,calculateActualOdds=function(e){var a=e.conditionId,i=e.outcomeId,u=e.betAmount;return __awaiter(void 0,void 0,void 0,function(){var t,n;return __generator(this,function(e){switch(e.label){case 0:return t=units.parseUnits(String(u),USDT_DECIMALS),[4,getContract("core").calculateOdds(a,t,i)];case 1:return t=e.sent(),n=units.formatUnits(t,RATE_DECIMALS),[2,parseFloat(n)]}})})},fetchAllowance=function(e){return getContract("usdt").allowance(e,CONTRACTS.usdt.address)},approve=function(e){return getContract("usdt",!0).approve(CONTRACTS.usdt.address,e)},placeBet=function(p){return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,s,r;return __generator(this,function(e){return t=p.conditionId,n=p.outcomeId,u=p.amount,r=p.betRate,s=p.slippage,a=p.affiliate,a=void 0===a?"0x0000000000000000000000000000000000000000":a,i=getContract("lp",!0),u=units.parseUnits(String(u),USDT_DECIMALS),r=(1+(r-1)*(100-s)/100).toFixed(8),s=units.parseUnits(r,RATE_DECIMALS),r=Math.floor(Date.now()/1e3)+2e3,[2,i.bet(t,u,n,r,s,a)]})})},fetchBet=function(w){return __awaiter(void 0,void 0,void 0,function(){var t,n,d,l,m,c,a,i,f,u,T,s,b,I,r,v,p,g,o,y;return __generator(this,function(e){switch(e.label){case 0:t=getContract("core"),e.label=1;case 1:return e.trys.push([1,5,,6]),[4,t.bets(w)];case 2:return a=e.sent(),n=a.conditionID,d=a.amount,l=a.outcome,m=a.odds,c=a.payed,a=a.createdAt,[4,t.getCondition(n)];case 3:return u=e.sent(),i=u.state,s=u.ipfsHash,f=u.timestamp,u=u.outcomeWin,T=n.toNumber(),s=ethers.utils.arrayify(s),s=ethers.utils.base58.encode(__spread([18,32],s)),[4,fetchGameIpfsData(s)];case 4:return s=e.sent(),b=1e3*f.toNumber(),y=l.toNumber(),o=u.toNumber(),r=betTypeOdd[y],I=r.outcomeRegistryId,r=r.paramId,v=parseFloat(units.formatUnits(m,RATE_DECIMALS)),p=parseFloat(units.formatUnits(d,USDT_DECIMALS)),g=void 0,g=i===ConditionStatus.CANCELED?p:0===o?null:o===y?(p*v).toFixed(6):-1*p,o=__assign(__assign({},s),{startsAt:b,state:i}),[2,{nftId:w,conditionId:T,paramId:r,outcomeRegistryId:I,rate:v,amount:p,result:g,createdAt:1e3*a.toNumber(),isRedeemed:c,gameInfo:o}];case 5:return y=e.sent(),console.error(y),[3,6];case 6:return[2]}})})},fetchUserBets=function(e){var s=e.account;return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u;return __generator(this,function(e){switch(e.label){case 0:e.trys.push([0,8,,9]),n=void(t=0),a=[],i=getContract("bet"),e.label=1;case 1:if(0!==t&&!n)return[3,6];e.label=2;case 2:return e.trys.push([2,4,,5]),[4,i.tokenOfOwnerByIndex(s,t++)];case 3:return n=e.sent(),a.push(n.toNumber()),[3,5];case 4:return e.sent(),n=null,[3,5];case 5:return[3,1];case 6:return[4,Promise.all(a.map(fetchBet))];case 7:return[2,e.sent().filter(Boolean).sort(function(e,t){return t.createdAt-e.createdAt})];case 8:return u=e.sent(),console.error(u),[2,[]];case 9:return[2]}})})},redeemBetPrize=function(e){return getContract("lp",!0).withdrawPayout(e)};exports.RATE_DECIMALS=RATE_DECIMALS,exports.USDT_DECIMALS=USDT_DECIMALS,exports.approve=approve,exports.calculateActualOdds=calculateActualOdds,exports.checkTestTokensClaimable=checkTestTokensClaimable,exports.claimTestTokens=claimTestTokens,exports.configure=configure,exports.fetchAllowance=fetchAllowance,exports.fetchBalance=fetchBalance,exports.fetchGames=fetchGames,exports.fetchUserBets=fetchUserBets,exports.placeBet=placeBet,exports.redeemPrize=redeemBetPrize,exports.setSelectedChainId=setSelectedChainId,exports.setWallerProvider=setWallerProvider;
{
"name": "@azuro-protocol/sdk",
"version": "0.0.3",
"version": "0.0.4",
"engines": {

@@ -5,0 +5,0 @@ "node": "=14.17.4",

@@ -6,3 +6,3 @@ # sdk

```
import * as AzuroSDK from '@azuro/sdk'
import * as AzuroSDK from '@azuro-protocol/sdk'

@@ -9,0 +9,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc