Kotlin

Core SDK - Kotlin

The XpansionChain Core SDK provides convenient access to XpansionChain's APIs and smart contracts to help projects build better web3 games and marketplaces.

πŸ’‘ROLLUPS THIS SDK SUPPORTS

  • XpansionChain

CONTENTS

  • Installation

  • Standard API Requests

  • SDK Functions

  • Wallet connection

  • Further documentation


πŸ“šSDK LINKS

  • SDK reference

  • Github repository

Installation​

  1. Add Maven Central to your repositories

  1. Add dependency to your app build.gradle file

  1. Set the correct environment (defaults to Production)

Standard API Requests​

The Core SDK includes classes that interact with the XpansionChain APIs.

e.g. Get a list of collections ordered by name in ascending order

OR

View the OpenAPI spec for a full list of API requests available in the Core SDK.

SDK Functions​

Workflows​

These are utility functions that will chain necessary API calls to complete a process or perform a transaction, including:

  • Register a user with XpansionChain

  • Buy cryptocurrency via MoonPay

  • Buy ERC721

  • Sell ERC721

  • Cancel listing

  • Transfer ERC20/ERC721/ETH

  • Deposit ERC20/ERC721/ETH

  • Withdraw ERC20/ERC721/ETH

  • Check if user is registered on chain

Wallet connection​

In order to call authorised API and use workflow functions, you will need to pass in the connected wallet provider. This means you will need to implement your own Wallet L1 Signer and L2 StarkSigner.

L1 Signer​

Example implementation of the L1 Signer using web3j:

L2 StarkSigner​

Use StarkKey.generateStarkPrivateKey() to create an instance of StandardStarkSigner, an implementation of StarkSigner.

🚨🚨🚨 Warning πŸš¨πŸš¨πŸš¨β€‹

You will have to persist the Stark private key. The key is randomly generated so cannot be deterministically re-generated.

Further documentation​

  • See the Developer homepage for general information on building on XpansionChain.

  • Build on XpansionChain zkEVM:

    • Documentation

    • API reference

    • Support

  • Build onXpansionChain:

    • Documentation

    • API reference

    • Support

Last updated