> ## Documentation Index
> Fetch the complete documentation index at: https://kit.near.tools/llms.txt
> Use this file to discover all available pages before exploring further.

# Data Structures

This reference details the shape of objects returned by the `Near` client. Use this to understand exactly what fields are available when parsing results.

## Transaction Result (`FinalExecutionOutcome`)

Returned by `.send()` and `near.call()`.

```typescript theme={null}
type FinalExecutionOutcome = {
  // High-level status of the transaction execution
  final_execution_status:
    | "NONE"
    | "INCLUDED"
    | "INCLUDED_FINAL"
    | "EXECUTED_OPTIMISTIC"
    | "EXECUTED"
    | "FINAL";

  // Detailed status of the transaction
  status:
    | { SuccessValue: string } // Base64 encoded return value
    | { SuccessReceiptId: string } // ID of the final receipt
    | { Failure: object }; // Error object if failed

  // The transaction itself
  transaction: {
    signer_id: string;
    public_key: string;
    nonce: number;
    receiver_id: string;
    actions: Action[];
    signature: string;
    hash: string;
  };

  // Execution outcome of the transaction (initial receipt)
  transaction_outcome: ExecutionOutcomeWithId;

  // Execution outcomes of all subsequent receipts (cross-contract calls)
  receipts_outcome: ExecutionOutcomeWithId[];
};
```

## Execution Outcome (`ExecutionOutcomeWithId`)

Contains gas usage and logs.

```typescript theme={null}
type ExecutionOutcomeWithId = {
  id: string; // Receipt ID
  block_hash: string;
  outcome: {
    logs: string[]; // Console logs from the contract
    receipt_ids: string[]; // IDs of receipts generated by this execution
    gas_burnt: number; // Gas used in Tgas units * 1e12
    tokens_burnt: string; // NEAR burnt (yoctoNEAR)
    executor_id: string; // The account that executed this receipt
    status: ExecutionStatus;
  };
};
```

## Account Details (`AccountView`)

Returned by `near.getAccountDetails(accountId)`.

```typescript theme={null}
type AccountView = {
  amount: string; // Balance in yoctoNEAR
  locked: string; // Staked balance in yoctoNEAR
  code_hash: string; // Hash of the contract code (111111... if none)
  storage_usage: number; // Storage used in bytes
  storage_paid_at: number;
  block_height: number;
  block_hash: string;
};
```

## Access Key (`AccessKeyView`)

Returned by `near.getAccessKey(accountId, publicKey)`.

```typescript theme={null}
type AccessKeyView = {
  nonce: number;
  permission:
    | "FullAccess"
    | {
        FunctionCall: {
          receiver_id: string;
          method_names: string[];
          allowance: string | null;
        };
      };
};
```

## Errors

### `FunctionCallError`

Thrown when a smart contract panics.

```typescript theme={null}
class FunctionCallError extends NearError {
  code: "FUNCTION_CALL_ERROR";
  contractId: string; // The contract that failed
  methodName?: string; // The method that failed
  panic?: string; // The panic message (e.g. "ERR_NO_DEPOSIT")
  logs: string[]; // Logs leading up to the failure
}
```

### `InvalidTransactionError`

Thrown when the network rejects a transaction.

```typescript theme={null}
class InvalidTransactionError extends NearError {
  code: "INVALID_TRANSACTION";
  retryable: boolean; // True if it was a transient network issue
  shardCongested: boolean;
  shardStuck: boolean;
}
```

## Utility Functions

### Deterministic Account IDs (NEP-616)

#### `deriveAccountId(stateInit)`

Computes the deterministic account ID from initialization state.

```typescript theme={null}
import { deriveAccountId } from "near-kit";

const encoder = new TextEncoder();
deriveAccountId({
  code: { accountId: "publisher.near" },
  data: new Map([
    [encoder.encode("owner"), encoder.encode("alice.near")]
  ]),
});
// => "0s1234567890abcdef1234567890abcdef12345678"
```

#### `isDeterministicAccountId(accountId)`

Checks if an account ID is deterministic (starts with `0s`).

```typescript theme={null}
isDeterministicAccountId("0s123..."); // true
isDeterministicAccountId("alice.near"); // false
```

#### `verifyDeterministicAccountId(accountId, stateInit)`

Verifies an account ID matches the expected derivation.

```typescript theme={null}
const encoder = new TextEncoder();
verifyDeterministicAccountId("0s123...", {
  code: { accountId: "publisher.near" },
  data: new Map([
    [encoder.encode("owner"), encoder.encode("alice.near")]
  ]),
});
// => true if matches
```

See [Global Contracts](/in-depth/global-contracts#3-deterministic-account-ids-nep-616).
