AzuroSDK: A Low-code Fast Track to a dApp

Azuro
azuroprotocol
Published in
5 min readApr 4, 2024

--

Building a betting dapp. Sounds complex, doesn’t it? In this article, we introduce you to the AzuroSDK — a toolkit for developers to smoothly and quickly build live betting apps on blockchain relying on the Azuro Protocol. Let’s dive in!

What is an SDK?

A software development kit (SDK) is a set of building tools for developers packaged all together in one neat installation. It’s a one-stop for making an app, equipped not only with development tools but also accompanied by resources such as API frameworks, tutorials, guides, and documentation to simplify the application building process.

Why use an SDK?

SDKs bring a number of benefits to the app development lifecycle:

1. Low-code development

SDKs often suggest low-code development, since all is usually needed from the developers is install and sometimes adapt the SDK. It simplifies development by supplying ready-made components and libraries. These elements significantly reduce the time developers spend on coding and debugging from the ground up.

2. Fast-track to launch

The tools within an SDK cover the most things needed to build an app and integrate the features that are created on the backend of the SDK provider, which allows for quick deployment across various systems.

3. Seamless integration

SDKs come with a suite of pre-assembled modules and components, simplifying the process of building, testing, and integrating all the required functionality.

4. Reduced development costs

By providing an array of pre-built tools and components, as well as supplying new feature updates through simple upgrades, SDKs decrease the time and effort for app development and maintenance.

Azuro SDK: Web dApp in less than a day

AzuroSDK stands out as the ultimate toolkit for developing a dApp on the Azuro Protocol. With a straightforward installation process, you gain access to a basic betting dApp, which can be tailored to meet your specific requirements.

This SDK contains practical React hooks and utilities tailored for crafting a betting dApp on Azuro. It takes away the complexity of initial setup processes, allowing developers to focus more on customization and unique UI features.

The SDK can be installed and updated in a couple of easy steps right from your terminal. It starts with cloning the project from https://github.com/Azuro-protocol/sdk, and in a couple of minutes one can already see a sample betting dApp on localhost in their browser.

AzuroSDK installation

Elements of the Azuro SDK

The elements within the Azuro SDK are designed to work in a cohesive manner, providing a seamless experience for developers building decentralized betting applications.

Elements of the Azuro SDK
  • Providers: This includes the main AzuroSDKProvider for initializing the SDK and other important providers like Chain, Live, Apollo, Socket, and Betslip. At the base, providers like the AzuroSDKProvider set up the necessary context for the application, enabling access to blockchain functionality and other services. Providers are essential for initializing the environment in which the hooks operate. For instance, the ChainProvider connects the app to a specific blockchain, while the SocketProvider sets up real-time communication channels for live updates.
  • Utilities: Utilities like calcMinOdds, calcPrematchOdds, calcLiveOdds, getGameStatus, and getBetStatus help in managing game and bet states, as well as calculations needed for betting logic. They function as standalone tools that can be invoked wherever necessary to interact with providers to fetch the necessary data and then process it to return useful information.
  • Data Hooks: There are hooks for fetching and managing sports data (useSports), games (useGames), and navigation within sports sections (useSportsNavigation) within the React components. Additionally, hooks like useGame, useConditions, useGameMarkets, usePrematchBets, and useLiveBets provide methods to interact with game-related information and live bet management. They interact with the providers to retrieve data from the blockchain and other services set up in the providers. For instance, useSports might interact with the ApolloProvider to fetch data through GraphQL.
  • Write Hooks: These hooks are action-oriented and are used to perform write operations like placing bets or redeeming them. They would interact with providers to ensure these transactions are correctly signed and sent to the blockchain. These include usePrepareBet and useRedeemBet for handling the actions of preparing and redeeming bets within the app.
  • Watch Hooks: These hooks are generally used to observe certain data points like betting odds or the status of a game. They would depend on SocketProvider or similar providers to get real-time updates, which they can then pass on to the components that require this data. These hooks, such as useSelection, useOdds, and useStatuses, watch for changes in selections, odds, and statuses to update the UI accordingly.
  • Other Hooks: There are also additional hooks like useGameStatus, useBetTokenBalance, and useNativeBalance for further managing game states and financial balances within the app. To achieve this, they would work closely with the ChainProvider and wallet management functionality provided by the WagmiProvider.

In practice, when building a dApp, a developer might set up the AzuroSDKProvider first to establish a connection to the Azuro protocol. Then, using data hooks, they would pull information about sports events, which has been fetched through the providers' setup. Write Hooks would enable the application to execute transactions such as placing or redeeming bets, interacting with the blockchain through the initialized providers. Watch Hooks would keep the UI updated with the latest data, and utilities would be used throughout to perform necessary calculations and status checks.

This synergistic interaction ensures that developers can focus on the business logic and user experience of their dApps, rather than the complexities of blockchain communication and data management.

By creating and continuously improving the SDK, Azuro aims to empower creators to bring their visions to life with speed and precision, which gives apps on Azuro competitive edge in the the fast-paced onchain environment.

Azuro is the onchain predictions layer. It consists of modular tooling, oracle and liquidity solutions for EVM chains to host powerful prediction and gaming apps.

With its unique infrastructure layer approach, Azuro makes onchain predictions and gaming portable and composable. It allows anyone to engage and monetize users by building apps, integrations, and products quickly, permissionlessly and with zero upfront or running costs.

Disclaimer: This content is provided for informational purposes only, and should not be relied upon as legal, business, investment, financial or tax advice. References to any digital assets, projects and platforms do not constitute any recommendation for any action or an offer to provide investment, financial or other advisory services. This content may not under any circumstances be relied upon when making a decision to purchase any digital asset referenced herein.

--

--

Azuro
azuroprotocol

🌊 Dive into the Azure: Empowering decentralized sports markets & games with deep liquidity & prediction contracts. 🌊