By Andy Grüning Andy Grüning

Building the Right Abstraction Levels in Web3 Game SDKs

3 min read

Each developer comes with their own level of experience and different requirements when integrating features into a product. Some integrations are highly complex—like interacting with smart contracts—while others are as simple as creating a wallet through Google Sign-In.

When it comes to smart contract interactions in Unity, developers may need to:

  • Handle wallet references to use the correct wallet before sending a transaction.
  • Define token contract types (ERC1155 or ERC721) or custom ABIs for smart contract encoding/decoding.
  • Manage ERC20 approvals when performing swaps or primary sales.

But not everyone needs that level of control. A developer who just wants a wallet doesn’t care about ABIs, relayers, or contract calls—they’re often overwhelmed by it all. This is especially true in Web3 gaming, where developers may be experts in gameplay but not in Web3 primitives.

Our goal is to create a great developer experience for both groups. That’s why our SDK is built with different levels of abstraction, tailored to very different needs.

What are abstraction levels?

When we talk about abstraction, we mean simplifying underlying complexity. Think of it as a pyramid—each level reduces the complexity of the one below it.

Let’s say we want to interact with smart contracts. Normally you need to encode the function data, sign it locally, and send it to a relayer. If you want to handle all of that, our SDK supports you. If not, you can move up the pyramid, where those steps are abstracted into a single function call to send a transaction.

At this level, you can choose how to define your transactions—for example, batching multiple calls or specifying the type of contract or token. But if all you want to do is send some tokens to another user, you don’t need to know about batching at all. You just provide a recipient address, the token amount, and the token contract address. That’s where our Services Adapter comes in.

To make things even simpler, we also provide boilerplates with built-in user interfaces. With these, you can quickstart any integration—no extra coding required.

When is complexity a problem?

High Complexity

An SDK is too complex when developers need to learn too many new concepts just to get started. This happens often in Web3 gaming—game developers know how to build great games but may not know (or want to know) Web3 details. This can lead to:

  • Inefficient smart contract interactions (e.g., storing game state on-chain unnecessarily).
  • Insecure reward systems (e.g., allowing players to mint tokens directly from the game client).

Low Complexity

On the other hand, if an SDK hides too much, developers lose the ability to:

  • Debug problems effectively.
  • Optimize specific use cases, such as batching multiple calls to save gas.

The best SDK strikes a balance: expose technical depth when needed, while keeping things approachable for newcomers.

How does this work in Sequence's Unity SDK?

Take token swaps as another example.

At the low-level, you have full control:

Address walletAddress = Wallet.GetWalletAddress();
CurrencySwap swap = new CurrencySwap(Chain.TestnetArbitrumSepolia);
SwapQuote quote = await swap.GetSwapQuote(walletAddress, new Address(buyToken), new Address(sellToken), buyAmount.ToString(), true);
            
TransactionReturn transactionReturn = await Wallet.SendTransaction(Chain.TestnetArbitrumSepolia, new Transaction[]
    { 
        new RawTransaction(sellToken, string.Empty, quote.approveData),
        new RawTransaction(quote.to, quote.transactionValue, quote.transactionData),
    }
);

if (transactionReturn is SuccessfulTransactionReturn successfulTransactionReturn)
    Debug.Log($"Transaction successful: {successfulTransactionReturn.txHash}");
else if (transactionReturn is FailedTransactionReturn failedTransactionReturn)
    Debug.Log($"Error while sending transaction: {failedTransactionReturn.error}");

This is ideal if you want to batch transactions with other contract interactions or have more control over handling the transactions results.

At the high-level, if you don’t care about the details and just want it done, you can write:

string txnHash = await EmbeddedWalletAdapter.GetInstance().SwapToken("<sellToken>", "<buyToken>", <buyAmount>); // add a try-catch block for error handling

It can be so simple!

Get started!

Whether you need deep control or a one-liner integration, we’ve got you covered. Our Unity and Unreal SDKs provide multiple abstraction levels so you can build Web3 games your way.

👉 Check out our Unity SDK Quickstart Guide and start adding Web3 to your game with just a few lines of code.