@@ -53,7 +53,7 @@ func CompileContract(sourcePath string, constructorArgs map[string]interface{})
5353 return nil , fmt .Errorf ("parse errors: %v" , parseResult .Errors )
5454 }
5555 if parseResult .Contract == nil {
56- return nil , fmt .Errorf ("no contract found in %s" , sourcePath )
56+ return nil , fmt .Errorf ("no contract found in %s" , absPath )
5757 }
5858
5959 validResult := frontend .Validate (parseResult .Contract )
@@ -124,10 +124,21 @@ func compileFromProgram(program *ir.ANFProgram) (*Artifact, error) {
124124 }, nil
125125}
126126
127- // CompileToSDKArtifact compiles a source file and returns a runar.RunarArtifact
128- // suitable for use with RunarContract from the SDK.
127+ // CompileToSDKArtifactAbs compiles a source file at an absolute path and
128+ // returns a runar.RunarArtifact suitable for use with RunarContract.
129+ // Use this when the contract source is outside the Rúnar project tree.
130+ func CompileToSDKArtifactAbs (absPath string ) (* runar.RunarArtifact , error ) {
131+ return compileToSDKArtifact (absPath )
132+ }
133+
134+ // CompileToSDKArtifact compiles a source file relative to the Rúnar project
135+ // root and returns a runar.RunarArtifact suitable for use with RunarContract.
129136func CompileToSDKArtifact (sourcePath string , constructorArgs map [string ]interface {}) (* runar.RunarArtifact , error ) {
130137 absPath := filepath .Join (projectRoot (), sourcePath )
138+ return compileToSDKArtifact (absPath )
139+ }
140+
141+ func compileToSDKArtifact (absPath string ) (* runar.RunarArtifact , error ) {
131142 source , err := os .ReadFile (absPath )
132143 if err != nil {
133144 return nil , fmt .Errorf ("reading source: %w" , err )
@@ -138,7 +149,7 @@ func CompileToSDKArtifact(sourcePath string, constructorArgs map[string]interfac
138149 return nil , fmt .Errorf ("parse errors: %v" , parseResult .Errors )
139150 }
140151 if parseResult .Contract == nil {
141- return nil , fmt .Errorf ("no contract found in %s" , sourcePath )
152+ return nil , fmt .Errorf ("no contract found in %s" , absPath )
142153 }
143154
144155 validResult := frontend .Validate (parseResult .Contract )
0 commit comments