near-ca
Version:
An SDK for controlling Ethereum Accounts from a Near Account.
56 lines (55 loc) • 2.17 kB
TypeScript
import { Hex, TransactionSerializable, TypedDataDomain } from "viem";
import { EIP712TypedData, KeyPairString, SignMethod } from ".";
/**
* Type guard to check if a value is a valid SignMethod
*
* @param method - The value to check
* @returns True if the value is a valid SignMethod
*/
export declare function isSignMethod(method: unknown): method is SignMethod;
/**
* Type guard to check if a value is a valid TypedDataDomain
* Validates all optional properties according to EIP-712 specification
*
* @param domain - The value to check
* @returns True if the value matches TypedDataDomain structure
*/
export declare const isTypedDataDomain: (domain: unknown) => domain is TypedDataDomain;
/**
* Type guard to check if a value is a valid EIP712TypedData
* Validates the structure according to EIP-712 specification
*
* @param obj - The value to check
* @returns True if the value matches EIP712TypedData structure
*/
export declare const isEIP712TypedData: (obj: unknown) => obj is EIP712TypedData;
/**
* Type guard to check if a value can be serialized as an Ethereum transaction
* Attempts to serialize the input and returns true if successful
*
* @param data - The value to check
* @returns True if the value can be serialized as a transaction
*/
export declare function isTransactionSerializable(data: unknown): data is TransactionSerializable;
/**
* Type guard to check if a value is a valid RLP-encoded transaction hex string
* Attempts to parse the input as a transaction and returns true if successful
*
* @param data - The value to check
* @returns True if the value is a valid RLP-encoded transaction hex
*/
export declare function isRlpHex(data: unknown): data is Hex;
/**
* Type guard to check if a value is a valid NEAR key pair string
*
* @param value - The value to check
* @returns True if the value is a valid KeyPairString format
* @example
* ```ts
* isKeyPairString("ed25519:ABC123") // true
* isKeyPairString("secp256k1:DEF456") // true
* isKeyPairString("invalid:GHI789") // false
* isKeyPairString("ed25519") // false
* ```
*/
export declare function isKeyPairString(value: unknown): value is KeyPairString;