Constructors

  • Create a new TypedDataEncoder for %%types%%.

    This performs all necessary checking that types are valid and do not violate the [[link-eip-712]] structural constraints as well as computes the [[primaryType]].

    Parameters

    Returns TypedDataEncoder

Properties

primaryType: string

The primary type for the structured [[types]].

This is derived automatically from the [[types]], since no recursion is possible, once the DAG for the types is consturcted internally, the primary type must be the only remaining type with no parent nodes.

Accessors

Methods

  • @_ignore:

    Parameters

    • type: string
    • value: any
    • callback: ((type: string, data: any) => any)
        • (type, data): any
        • Parameters

          • type: string
          • data: any

          Returns any

    Returns any

  • Return the fulled encoded %%value%% for the [[types]].

    Parameters

    • value: Record<string, any>

    Returns string

  • Return the encoded %%value%% for the %%type%%.

    Parameters

    • type: string
    • value: any

    Returns string

  • Returnthe encoder for the specific %%type%%.

    Parameters

    • type: string

    Returns ((value: any) => string)

      • (value): string
      • Parameters

        • value: any

        Returns string

  • Return the hash of the fully encoded %%value%% for the [[types]].

    Parameters

    • value: Record<string, any>

    Returns string

  • Returns the hash of %%value%% for the type of %%name%%.

    Parameters

    • name: string
    • value: Record<string, any>

    Returns string

  • Call %%calback%% for each value in %%value%%, passing the type and component within %%value%%.

    This is useful for replacing addresses or other transformation that may be desired on each component, based on its type.

    Parameters

    • value: Record<string, any>
    • callback: ((type: string, data: any) => any)
        • (type, data): any
        • Parameters

          • type: string
          • data: any

          Returns any

    Returns any

  • Returns the JSON-encoded payload expected by nodes which implement the JSON-RPC [[link-eip-712]] method.

    Parameters

    Returns any

  • Return the hashed struct for %%value%% using %%types%% and %%name%%.

    Parameters

    • name: string
    • types: Record<string, TypedDataField[]>
    • value: Record<string, any>

    Returns string

  • Resolves to the value from resolving all addresses in %%value%% for %%types%% and the %%domain%%.

    Parameters

    • domain: TypedDataDomain
    • types: Record<string, TypedDataField[]>
    • value: Record<string, any>
    • resolveName: ((name: string) => Promise<string>)
        • (name): Promise<string>
        • Parameters

          • name: string

          Returns Promise<string>

    Returns Promise<{
        domain: TypedDataDomain;
        value: any;
    }>