CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-solana--web3-js

Comprehensive JavaScript SDK for building Solana blockchain applications with modern architecture and type safety

93

1.29x

Evaluation93%

1.29x

Agent success when using this tile

Overview
Eval results
Files

task.mdevals/scenario-2/

Address Validator and Parser

A utility module for validating and parsing Solana blockchain addresses from various input sources.

Capabilities

Address Creation and Validation

Implement a validator that can create and verify Solana addresses from string inputs.

  • Given a valid base58-encoded address string "4Ujf5fXfLx2PAwRqcECCLtgDxHKPznoJpa43jUBxFfMz", the validator should successfully create an Address type @test
  • Given an invalid base58-encoded address string with incorrect characters "InvalidAddress!", the validator should throw an error @test
  • When checking if a string is a valid address using a type guard, it should return true for valid addresses and false for invalid ones @test

Batch Address Validation

Process multiple address strings and filter out invalid ones.

  • Given an array of mixed valid and invalid address strings, the validator should return only the valid addresses as Address types @test

Address Comparison

Compare two addresses to determine if they are equal.

  • Given two identical address strings, comparing them should confirm they represent the same address @test

Implementation

@generates

API

/**
 * Validates and creates a Solana Address from a string
 * @param addressString - Base58-encoded address string
 * @returns Validated Address type
 * @throws Error if the address string is invalid
 */
export function createAddress(addressString: string): Address;

/**
 * Type guard to check if a string is a valid Solana address
 * @param input - String to validate
 * @returns True if input is a valid address, false otherwise
 */
export function isValidAddress(input: string): boolean;

/**
 * Validates multiple address strings and returns only valid ones
 * @param addresses - Array of address strings to validate
 * @returns Array of validated Address types (invalid addresses are filtered out)
 */
export function validateAddresses(addresses: string[]): Address[];

/**
 * Compares two addresses for equality
 * @param address1 - First address
 * @param address2 - Second address
 * @returns True if addresses are equal, false otherwise
 */
export function areAddressesEqual(address1: Address, address2: Address): boolean;

Dependencies { .dependencies }

@solana/web3.js { .dependency }

Provides core Solana blockchain primitives and address validation functionality.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-solana--web3-js

tile.json