The Sandbox SDK Integration
The Sandbox is a metaverse based on Polygon, where land plots (LAND), game assets (ASSET), and characters (Avatar) are NFTs. SDK (VoxEdit + Game Maker) allows creating games and interactive experiences without deep blockchain knowledge. For developers — an additional level via Sandbox Game SDK and Web3 integration.
The Sandbox Ecosystem Structure
| Tool | Purpose | Technology |
|---|---|---|
| VoxEdit | Creating 3D voxel assets | Desktop application |
| Game Maker | Game development without code | Visual scripting |
| Sandbox Game SDK | Game logic programming | TypeScript |
| Marketplace API | Trading ASSET NFTs | REST API |
| LAND API | Land plot data | GraphQL (The Graph) |
Web3 Integration via Sandbox API
import { ethers } from 'ethers';
// ABI for Sandbox main contracts
const LAND_ABI = [
'function ownerOf(uint256 tokenId) view returns (address)',
'function tokenOfOwnerByIndex(address owner, uint256 index) view returns (uint256)',
'function balanceOf(address owner) view returns (uint256)',
];
const ASSET_ABI = [
'function balanceOf(address account, uint256 id) view returns (uint256)',
'function balanceOfBatch(address[] accounts, uint256[] ids) view returns (uint256[])',
];
// Polygon Mainnet addresses
const LAND_CONTRACT = '0x50f5474724e0Ee42D9a4e711ccFB275809Fd6d4A';
const ASSET_CONTRACT = '0xa342f5D851E866E18ff98F351f2c6637f4478dB5';
async function getUserSandboxAssets(userAddress: string) {
const provider = new ethers.JsonRpcProvider('https://polygon-rpc.com');
const landContract = new ethers.Contract(LAND_CONTRACT, LAND_ABI, provider);
const assetContract = new ethers.Contract(ASSET_CONTRACT, ASSET_ABI, provider);
// Get number of LAND tokens
const landBalance = await landContract.balanceOf(userAddress);
// Get all LAND tokenIds
const landIds: bigint[] = [];
for (let i = 0; i < Number(landBalance); i++) {
const tokenId = await landContract.tokenOfOwnerByIndex(userAddress, i);
landIds.push(tokenId);
}
return { landIds, landCount: Number(landBalance) };
}
Game Maker SDK — Programmatic Logic
The Sandbox Game Maker supports TypeScript for custom game logic:
// Example game script in Game Maker SDK
import { engine, Entity, web3 } from '@sandbox/game-sdk';
// Event on player entering zone
engine.onPlayerEnter('exclusive_zone', async (player) => {
const walletAddress = await web3.getPlayerWallet(player.id);
// Check LAND ownership in required square
const hasLand = await checkLandOwnership(walletAddress);
if (hasLand) {
player.showMessage('Welcome, LAND owner!');
player.grantAccess('vip_area');
} else {
player.showMessage('LAND NFT required for access');
player.redirectTo('marketplace');
}
});
// In-game asset purchase
engine.onPlayerInteract('shop_npc', async (player, npc) => {
const items = await fetchAvailableItems();
npc.openShop(player, items);
});
Marketplace API Integration
const SANDBOX_API = 'https://api.sandbox.game';
async function getMarketplaceListing(assetId: string) {
const response = await fetch(`${SANDBOX_API}/v1/assets/${assetId}`);
return response.json();
}
async function getUserCreations(walletAddress: string) {
const response = await fetch(
`${SANDBOX_API}/v1/assets?creator=${walletAddress}&status=published`
);
return response.json();
}
// Listing own ASSET on marketplace
async function listAssetForSale(assetId: string, priceInSand: string) {
// Requires transaction signature via MetaMask
const provider = new ethers.BrowserProvider(window.ethereum);
const signer = await provider.getSigner();
// Approve SAND token for marketplace contract
const sandContract = new ethers.Contract(SAND_TOKEN, ERC20_ABI, signer);
await sandContract.approve(MARKETPLACE_CONTRACT, ethers.MaxUint256);
// Create listing via Exchange contract
const marketplace = new ethers.Contract(MARKETPLACE_CONTRACT, MARKETPLACE_ABI, signer);
await marketplace.createListing(assetId, ethers.parseEther(priceInSand));
}
LAND Coordinates and Metadata
LAND in Sandbox has coordinates (x, y) on the map. Via The Graph, you can get data:
query GetLandDetails($tokenId: String!) {
land(id: $tokenId) {
id
x
y
owner {
address
}
estate {
id
}
tokenURI
}
}
Development of The Sandbox integration (ownership verification, game logic, marketplace): 3–5 weeks depending on game experience complexity.







