Skip to content

isValidNearAccountId()

SIP Protocol API Reference v0.7.0


SIP Protocol API Reference / isValidNearAccountId

isValidNearAccountId(accountId): boolean

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:1659

Check if a string is a valid NEAR account ID (named or implicit)

Supports both:

  • Named accounts: alice.near, bob.testnet
  • Implicit accounts: 64 hex characters

string

Account ID to validate

boolean

true if valid NEAR account ID

isValidNearAccountId("alice.near") // true
isValidNearAccountId("bob.testnet") // true
isValidNearAccountId("ab12cd34...") // true (64 hex chars)
isValidNearAccountId("ALICE.near") // false (uppercase)
isValidNearAccountId("a") // false (too short)