Awarizon
DOCS/TypeScript Types

TypeScript Types

All exported types across the Awarizon SDK packages.

TS
// ── @awarizon/web3 ───────────────────────────────────────────────────────────
import type {
  AwarizonConfig, ContractInstance, TransactionResult, TransactionReceipt,
  Erc20Contract, Erc721Contract, Erc1155Contract, WalletInfo,
} from "@awarizon/web3"

interface AwarizonConfig {
  chain:    string        // chain alias string or viem Chain object
  apiKey:   string        // "awz_live_..."
  rpcUrl?:  string
  signer?:  WalletClient  // pre-connected external signer
}

interface TransactionResult {
  hash:    `0x${string}`
  receipt: TransactionReceipt
}

interface TransactionReceipt {
  blockNumber: bigint
  blockHash:   `0x${string}`
  gasUsed:     bigint
  status:      "success" | "reverted"
}

// ── @awarizon/react ───────────────────────────────────────────────────────────
import type {
  ContractRef, CallDescriptor, BoundMethod,  // contract binding API
  UseWalletReturn, UseTokenReturn, UseNFTReturn,
  UseNativeBalanceReturn, UseReadContractReturn, UseWriteContractReturn,
} from "@awarizon/react"

// contract() types
interface CallDescriptor {
  address: `0x${string}`; abi: Abi; method: string; args: unknown[]
}
type BoundMethod = ((...args: unknown[]) => CallDescriptor) & CallDescriptor

// ── @awarizon/react-native ────────────────────────────────────────────────────
import type {
  UseRNWalletReturn, UseRNWalletOptions, SecureStorageAdapter,
  ContractRef, CallDescriptor, BoundMethod,  // same binding API
} from "@awarizon/react-native"

interface UseRNWalletOptions {
  awarizon: AwarizonWeb3; storage: SecureStorageAdapter
  walletId?: string; autoRestore?: boolean
}

interface SecureStorageAdapter {
  get(key: string): Promise<string | null>
  set(key: string, value: string): Promise<void>
  delete(key: string): Promise<void>
}

// ── @awarizon/auth ────────────────────────────────────────────────────────────
import type {
  SiweParams, SiweSession, SignInResult, UseSiweOptions, UseSiweReturn,
} from "@awarizon/auth"

interface SiweSession {
  address: string; chainId: number
  issuedAt: string; expiresAt?: string
  message: string; signature: string
  serverData?: unknown  // whatever your onVerify returned
}