UNPKG

@goat-sdk/plugin-betswirl

Version:

<div align="center"> <a href="https://github.com/goat-sdk/goat">

2 lines (1 loc) 1.21 kB
import{a as m}from"./chunk-3B2UKHHS.mjs";import{a as u}from"./chunk-OM6TDCYQ.mjs";import{a as p}from"./chunk-7XFS2U2Z.mjs";import{a as h}from"./chunk-ZY6UPUQ7.mjs";import{a as d}from"./chunk-SG734JE4.mjs";import{a as r}from"./chunk-YSXGDEY5.mjs";import{PluginBase as T}from"@goat-sdk/core";import{CASINO_GAME_TYPE as i,casinoChainById as y,casinoChains as G,getGamePausedFunctionData as g}from"@betswirl/sdk-core";var c=class extends T{static{r(this,"BetSwirlPlugin")}theGraphKey;constructor(a){super("betswirl",[]),this.theGraphKey=a}supportsChain=r(a=>a.type==="evm"&&G.some(e=>e.id===a.id),"supportsChain");async getTools(a){let e=await P(a),s=[];return s.push(h(a,this.theGraphKey)),s.push(p(a,this.theGraphKey)),e.includes(i.DICE)&&s.push(u(a)),e.includes(i.COINTOSS)&&s.push(m(a)),e.includes(i.ROULETTE)&&s.push(d(a)),s}};function B(o){return new c(o)}r(B,"betswirl");async function P(o){let a=o.getChain().id,e=y[a],s=Object.keys(e.contracts.games);return(await Promise.all(s.map(async t=>{let n=g(t,a),{value:f}=await o.read({address:n.data.to,functionName:n.data.functionName,abi:n.data.abi});return{name:t,paused:f}}))).filter(t=>!t.paused).map(t=>t.name)}r(P,"getCasinoGames");export{c as a,B as b};