Skip to content

Getting started ​

Use the TABLETS proxy as the destination for normal contract reads and writes. The implementation address is published for verification; it is not the normal transaction destination.

Before constructing a call:

  1. connect to Robinhood Chain, chain ID 4663;
  2. use the TABLETS proxy and CLAY token addresses listed on the Robinhood Chain deployment page;
  3. load the published TABLETS ABI; and
  4. read CLAY decimals before converting a displayed amount into token units.

The examples use TypeScript and viem. Use the ABI, addresses and token settings published for the current Robinhood Chain deployment.

Example: create clients and load the deployment ​

This reference module demonstrates an injected EIP-1193 wallet. Its contract-reading and transaction rules are provider-independent; developers using another signer should supply an equivalent viem wallet client without placing secret material in source code.

ts
const candidateDeployment = tabletsProductionDeployment as unknown as {
  readonly status: string;
  readonly chain: typeof tabletsProductionDeployment.chain;
  readonly contracts: {
    readonly protocol: Address | null;
    readonly protocolDeploymentBlock: number | null;
    readonly protocolCodeHash: Hex | null;
    readonly implementation: Address | null;
    readonly implementationCodeHash: Hex | null;
    readonly token: Address | null;
    readonly tokenCodeHash: Hex | null;
  };
  readonly token: {
    readonly name: string;
    readonly symbol: string;
    readonly decimals: number;
  } | null;
};
const protocol = candidateDeployment.contracts.protocol;
const protocolDeploymentBlock =
  candidateDeployment.contracts.protocolDeploymentBlock;
const protocolCodeHash = candidateDeployment.contracts.protocolCodeHash;
const implementation = candidateDeployment.contracts.implementation;
const implementationCodeHash =
  candidateDeployment.contracts.implementationCodeHash;
const tokenAddress = candidateDeployment.contracts.token;
const tokenCodeHash = candidateDeployment.contracts.tokenCodeHash;
const tokenMetadata = candidateDeployment.token;
if (
  candidateDeployment.status !== "active" ||
  protocol === null ||
  protocolDeploymentBlock === null ||
  protocolCodeHash === null ||
  implementation === null ||
  implementationCodeHash === null ||
  tokenAddress === null ||
  tokenCodeHash === null ||
  tokenMetadata === null
) {
  throw new Error("Deployment metadata is incomplete or inactive");
}
export const deployment = {
  ...candidateDeployment,
  status: "active" as const,
  contracts: {
    protocol,
    protocolDeploymentBlock,
    protocolCodeHash,
    implementation,
    implementationCodeHash,
    token: tokenAddress,
    tokenCodeHash,
  },
  token: tokenMetadata,
};
export const TABLETS_ADDRESS = getAddress(deployment.contracts.protocol);
export const CLAY_ADDRESS = getAddress(deployment.contracts.token);
export const DEPLOYMENT_BLOCK = BigInt(
  deployment.contracts.protocolDeploymentBlock,
);
export const MAX_UINT256 = (1n << 256n) - 1n;
export const confirmationPolicy = Object.freeze({
  confirmationDepth: 12n,
  receiptConfirmations: 1,
});

const rpcUrl = deployment.chain.publicRpcUrls.at(0);
if (!rpcUrl) throw new Error("No public RPC URL is configured");

export const robinhoodMainnet = defineChain({
  id: deployment.chain.id,
  name: deployment.chain.name,
  nativeCurrency: deployment.chain.nativeCurrency,
  rpcUrls: { default: { http: [rpcUrl] } },
  blockExplorers: {
    default: {
      name: "Robinhood Chain Explorer",
      url: deployment.chain.explorerUrl,
    },
  },
});

export const publicClient = createPublicClient({
  chain: robinhoodMainnet,
  transport: http(rpcUrl),
});

type InjectedProvider = Parameters<typeof custom>[0];
const injected = (window as Window & { ethereum?: InjectedProvider }).ethereum;
if (!injected) throw new Error("No injected EIP-1193 wallet was found");

export const walletClient = createWalletClient({
  chain: robinhoodMainnet,
  transport: custom(injected),
});

The full client reference contains the TypeScript reference helper, including the error-decoding, receipt and event-validation functions described above.

Transaction rules used throughout this Guide ​

  • Read transaction-critical state from the target chain immediately before simulation.
  • Use the TABLETS proxy as the destination.
  • Simulate a write before requesting a signature.
  • If the auction, leader, bid requirement or finalization state changes, refresh state and rebuild the transaction.
  • Use bounded CLAY approval. Do not request an unlimited approval.
  • Wait for a confirmed receipt and decode the expected event.
  • Never automatically retry, increment, replace or resubmit a transaction.
  • Never place a private key, seed phrase, provider credential or signing secret in example code.