Hierarchy

  • ContractRuleBuilder
    • TransactionRuleBuilder

Constructors

  • This builder should not be constructed directly. Call mockNode.forSendTransaction() or mockNode.forSendTransactionTo() instead.

    Parameters

    • targetAddress: undefined | `0x${string}`
    • addRuleCallback: ((rule: RequestRuleData) => Promise<MockedEndpoint>)
        • (rule: RequestRuleData): Promise<MockedEndpoint>
        • Parameters

          • rule: RequestRuleData

          Returns Promise<MockedEndpoint>

    • addReceiptCallback: ((id: string, receipt: Partial<RawTransactionReceipt>) => Promise<void>)

    Returns TransactionRuleBuilder

Methods

  • Close the connection immediately after receiving the matching request, without sending any response.

    This method completes the rule definition, and returns a promise that resolves to a MockedContract once the rule is active. The MockedContract can be used later to query the seen requests that this rule has matched.

    Returns Promise<MockedContract>

  • Reject the transaction submission immediately with the given error message and properties.

    This method completes the rule definition, and returns a promise that resolves to a MockedContract once the rule is active. The MockedContract can be used later to query the seen requests that this rule has matched.

    Parameters

    Returns Promise<MockedContract>

  • Return a successful transaction submission, with a random transaction id, and provide the given failed & revert transaction receipt when the transaction status is queried later.

    The receipt can be any subset of the Ethereum receipt fields, and default values for a failed transaction will be used for any missing fields.

    This method completes the rule definition, and returns a promise that resolves to a MockedContract once the rule is active. The MockedContract can be used later to query the seen requests that this rule has matched.

    Parameters

    Returns Promise<MockedContract>

  • Return a successful transaction submission, with a random transaction id, and provide the given successfully completed transaction receipt when the transaction status is queried later.

    The receipt can be any subset of the Ethereum receipt fields, and default values for a successful transaction will be used for any missing fields.

    This method completes the rule definition, and returns a promise that resolves to a MockedContract once the rule is active. The MockedContract can be used later to query the seen requests that this rule has matched.

    Parameters

    Returns Promise<MockedContract>

  • Timeout, accepting the request but never returning a response.

    This method completes the rule definition, and returns a promise that resolves to a MockedContract once the rule is active. The MockedContract can be used later to query the seen requests that this rule has matched.

    Returns Promise<MockedContract>

Generated using TypeDoc