Compile project

Compile a project

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

{
  "code": "Contract Foo() {\n pub fn foo() -> () {}\n }\n TxScript Main(id: ByteVec) {\n Foo(id).foo() \n}",
  "compilerOptions": {
    "ignoreUnusedConstantsWarnings": true
  }
}
{
  "contracts": [
    {
      "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"
    }
  ],
  "scripts": [
    {
      "version": "v0.0.1",
      "name": "Main",
      "bytecodeTemplate": "35d1b2a520a0da34c5eb8d712aa9cc",
      "bytecodeDebugPatch": "=1-1+ef",
      "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"
          ]
        }
      ],
      "warnings": [
        "Found unused field in Foo: a"
      ]
    }
  ],
  "structs": [
    {
      "name": "Foo",
      "fieldNames": [
        "amount",
        "id"
      ],
      "fieldTypes": [
        "U256",
        "ByteVec"
      ],
      "isMutable": [
        false,
        true
      ]
    }
  ]
}