Compile contract

Compile a smart contract

post
Body
codestringRequired
Responses
200
Ok
application/json
post
POST /contracts/compile-contract HTTP/1.1
Host: alephium.nownodes.io
Content-Type: application/json
Accept: */*
Content-Length: 156

{
  "code": "Contract Foo(bar: ByteVec) {\n pub fn baz(amount: U256) -> () {\nissueToken!(amount)\n}}",
  "compilerOptions": {
    "ignoreUnusedConstantsWarnings": true
  }
}
{
  "version": "v0.0.1",
  "name": "Foo",
  "bytecode": "35d1b2a520a0da34c5eb8d712aa9cc",
  "bytecodeDebugPatch": "=1-1+ef",
  "codeHash": "798e9e137aec7c2d59d9655b4ffa640f301f628bf7c365083bb255f6aa5f89ef",
  "codeHashDebug": "798e9e137aec7c2d59d9655b4ffa640f301f628bf7c365083bb255f6aa5f89ef",
  "fields": {
    "names": [
      "aa",
      "bb",
      "cc",
      "dd",
      "ee"
    ],
    "types": [
      "Bool",
      "U256",
      "I256",
      "ByteVec",
      "Address"
    ],
    "isMutable": [
      false,
      true,
      false,
      true,
      false
    ]
  },
  "functions": [
    {
      "name": "bar",
      "usePreapprovedAssets": false,
      "useAssetsInContract": false,
      "isPublic": true,
      "paramNames": [
        "a",
        "b",
        "c",
        "d",
        "e"
      ],
      "paramTypes": [
        "Bool",
        "U256",
        "I256",
        "ByteVec",
        "Address"
      ],
      "paramIsMutable": [
        false,
        true,
        false,
        true,
        false
      ],
      "returnTypes": [
        "U256",
        "I256",
        "ByteVec",
        "Address"
      ]
    }
  ],
  "constants": [
    {
      "name": "A",
      "value": {
        "type": "Bool",
        "value": true
      }
    }
  ],
  "enums": [
    {
      "name": "Color",
      "fields": [
        {
          "name": "Red",
          "value": {
            "type": "U256",
            "value": "0"
          }
        },
        {
          "name": "Blue",
          "value": {
            "type": "U256",
            "value": "1"
          }
        }
      ]
    }
  ],
  "events": [
    {
      "name": "Bar",
      "fieldNames": [
        "a",
        "b",
        "d",
        "e"
      ],
      "fieldTypes": [
        "Bool",
        "U256",
        "ByteVec",
        "Address"
      ]
    }
  ],
  "warnings": [
    "Found unused field in Foo: a"
  ],
  "maps": {
    "names": [
      "foo"
    ],
    "types": [
      "Map[U256,U256]"
    ]
  },
  "stdInterfaceId": "0001"
}