Last active
August 11, 2021 14:17
-
-
Save axiomatic-aardvark/c460d1305f79b077b9d2be512451767d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { assert, createMockedFunction } from "matchstick-as/assembly/index"; | |
import { Contract } from "../../generated/MyDataSource/Example"; | |
import { Address, ethereum } from "@graphprotocol/graph-ts"; | |
let contractAddress = Address.fromString("0x89205A3A3b2A69De6Dbf7f01ED13B2108B2c43e7"); | |
let arg = ethereum.Value.fromString("example string arg"); | |
createMockedFunction(contractAddress, "functionName", "functionName(string):(string)") | |
.withArgs([arg]) | |
.returns([ethereum.Value.fromString("result")]); | |
let contract = Contract.bind(contractAddress); | |
let result = contract.try_functionName(arg); | |
assert.equals(ethereum.Value.fromString("result"), ethereum.Value.fromString(result)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment