Documentation Index
Fetch the complete documentation index at: https://mintlify.com/frol/near-connect-ios/llms.txt
Use this file to discover all available pages before exploring further.
NEARAccount
TheNEARAccount struct represents an authenticated NEAR blockchain account. It contains the account identifier, public key, and wallet information returned after a successful connection.
Overview
NEARAccount is a value type that conforms to Codable, Equatable, Hashable, and Sendable. It is automatically persisted by NEARWalletManager and restored on app launch.
Properties
accountId
The NEAR account identifier.The unique NEAR account ID (e.g., “alice.near”, “bob.testnet”).
publicKey
The account’s public key.The public key associated with this account, or
nil if not provided by the wallet.walletId
The identifier of the wallet that authenticated this account.The wallet identifier (e.g., “meteor-wallet”, “my-near-wallet”, “near-wallet”).
Computed Properties
displayName
The full account identifier for display purposes.Returns the
accountId unchanged. Use this for displaying the full account name.shortDisplayName
A truncated version of the account identifier for compact display.If the account ID is longer than 24 characters, returns a truncated version showing the first 12 and last 8 characters separated by ”…”. Otherwise returns the full account ID.
Initialization
init(accountId:publicKey:walletId:)
Creates a newNEARAccount instance.
The NEAR account identifier.
The account’s public key, or
nil if not available.The wallet identifier that authenticated this account.
NEARAccount instances manually. They are returned by NEARWalletManager after successful wallet connection.
Usage in SwiftUI
SinceNEARAccount is Codable, Equatable, Hashable, and Sendable, it works seamlessly with SwiftUI and Combine.
Example:
Persistence
NEARAccount is automatically persisted by NEARWalletManager using UserDefaults. When the app relaunches, the last connected account is restored.
Example:
Conformances
Codable
AllowsNEARAccount to be encoded/decoded for persistence.
Equatable
Enables comparison between account instances.Hashable
AllowsNEARAccount to be used in sets and as dictionary keys.
Sendable
MarksNEARAccount as safe to pass across concurrency domains.
See Also
- NEARWalletManager - Main wallet manager class
- Wallet Connection Guide - Connect wallets
- Quickstart - Get started with NEAR Connect iOS