Type alias WalletTemplateScenarioData

WalletTemplateScenarioData: {
    bytecode?: {
        [fullIdentifier: string]: string;
    };
    currentBlockHeight?: number;
    currentBlockTime?: number;
    hdKeys?: {
        addressIndex?: number;
        hdPrivateKeys?: {
            [entityId: string]: string;
        };
        hdPublicKeys?: {
            [entityId: string]: string;
        };
    };
    keys?: {
        privateKeys?: {
            [variableId: string]: string;
        };
    };
}

An object defining the data to use while compiling a scenario.

Type declaration

  • Optional bytecode?: {
        [fullIdentifier: string]: string;
    }

    A map of full identifiers to CashAssembly scripts that compile to each identifier's value for this scenario. Allowing bytecode to be specified as scripts (rather than e.g. hex) offers greater power and flexibility.

    Bytecode scripts have access to each other and all other template scripts and defined variables, however, cyclical references will produce an error at compile time. Also, because the results of these compilations will be used to generate the compilation context for this scenario, these scripts may not use compiler operations that themselves require access to compilation context (e.g. signatures).

    The provided fullIdentifier should match the complete identifier for each item, e.g. some_wallet_data, variable_id.public_key, or variable_id.schnorr_signature.all_outputs.

    All AddressData and WalletData variables must be provided via bytecode (though the default scenario automatically includes reasonable values), and pre-computed results for operations of other variable types (e.g. key.public_key) may also be provided via this property.

    Because each bytecode identifier may precisely match the identifier of the variable it defines for this scenario, references between these scripts must refer to the target script with a _scenario. prefix. E.g. to reference a sibling script my_foo from my_bar, the my_bar script must use the identifier _scenario.my_foo.

    • [fullIdentifier: string]: string
  • Optional currentBlockHeight?: number

    The current block height at the "address creation time" implied in this scenario.

  • Optional currentBlockTime?: number

    The current MTP block time as a UNIX timestamp at the "address creation time" implied in this scenario.

    Note, this is never a current timestamp, but rather the median timestamp of the last 11 blocks. It is therefore approximately one hour in the past.

    Every block has a precise MTP block time, much like a block height. See BIP113 for details.

  • Optional hdKeys?: {
        addressIndex?: number;
        hdPrivateKeys?: {
            [entityId: string]: string;
        };
        hdPublicKeys?: {
            [entityId: string]: string;
        };
    }

    An object describing the settings used for HdKey variables in this scenario.

    • Optional addressIndex?: number

      The current address index to be used for this scenario. The addressIndex gets added to each HdKeys addressOffset to calculate the dynamic index (i) used in each privateDerivationPath or publicDerivationPath.

      This is required for any compiler operation that requires derivation. Typically, the value is incremented by one for each address in a wallet.

      Defaults to 0.

    • Optional hdPrivateKeys?: {
          [entityId: string]: string;
      }

      A map of entity IDs to master HD private keys. These master HD private keys are used to derive each HdKey variable assigned to that entity according to its privateDerivationPath.

      HD private keys may be encoded for either mainnet or testnet (the network information is ignored).

      If both an HD private key (in hdPrivateKeys) and HD public key (in hdPublicKeys) are provided for the same entity in the same scenario (not recommended), the HD private key is used.

      • [entityId: string]: string
    • Optional hdPublicKeys?: {
          [entityId: string]: string;
      }

      A map of entity IDs to HD public keys. These HD public keys are used to derive public keys for each HdKey variable assigned to that entity according to its publicDerivationPath.

      HD public keys may be encoded for either mainnet or testnet (the network information is ignored).

      If both an HD private key (in hdPrivateKeys) and HD public key (in hdPublicKeys) are provided for the same entity in the same scenario (not recommended), the HD private key is used.

      • [entityId: string]: string
  • Optional keys?: {
        privateKeys?: {
            [variableId: string]: string;
        };
    }

    An object describing the settings used for Key variables in this scenario.

    • Optional privateKeys?: {
          [variableId: string]: string;
      }

      A map of Key variable IDs to their 32-byte, hexadecimal-encoded private key values.

      • [variableId: string]: string

Generated using TypeDoc