Icon HelpCircleForumIcon Link

⌘K

Icon HelpCircleForumIcon Link
ABI Typegen

Icon LinkABI Typegen

Icon LinkThe JSON ABI file

Whether you want to deploy or connect to a pre-existing smart contract, the JSON ABI Icon Link file is what makes it possible.

It tells the SDK about the ABI methods Icon Link in your Smart Contracts Icon Link and Scripts Icon Link

Given the following Sway smart contract:

contract;
 
abi MyContract {
    fn test_function() -> bool;
}
 
impl MyContract for Contract {
    fn test_function() -> bool {
        true
    }
}

The JSON ABI file would look something like this:

$ cat out/debug/my-test-abi.json
[
  {
    "type": "function",
    "inputs": [],
    "name": "test_function",
    "outputs": [
      {
        "name": "",
        "type": "bool",
        "components": null
      }
    ]
  }
]

See also: