Function importWalletTemplate

  • Safely parse and validate a wallet template, returning either an error message as a string or a valid WalletTemplate. The template may be provided either as an untrusted JSON string or as a pre-parsed object.

    This method validates both the structure and the contents of a template:

    • All properties and sub-properties are verified to be of the expected type.
    • The template contains no unknown properties.
    • The ID of each entity, script, and scenario is confirmed to be unique.
    • Script IDs referenced by entities and other scripts (via unlocks) are confirmed to exist.
    • The derivation paths of each HdKey are validated against each other.

    This method does not validate the CashAssembly contents of scripts (by attempting compilation, evaluating WalletTemplateScriptTests, or testing scenario generation).

    Parameters

    • untrustedJsonOrObject: unknown

      the JSON string or object to validate as a wallet template

    Returns string | WalletTemplate

Generated using TypeDoc