cashscript icon indicating copy to clipboard operation
cashscript copied to clipboard

Generalize 'Artifact' format so it can be used across high level languages

Open mr-zwets opened this issue 10 months ago • 1 comments

Rosco wrote in July 2019:

Perhaps Tendo would be interested in working together to flesh out this artifact format a bit more, and maybe have both languages compile into a common interface, that can be used by the same client-side libraries, like cashscript JS lib / Spedn JS lib

and later also october 2019:

tendo_pein, what do you think by the way about collaborating on an artifact format (like I have with CashScript, but expanded/streamlined), that would be shared between Spedn and CashScript?

Would be nice. the biggest problem here is the mismatch of the types in both especially that upcoming version introduces user-defined types

That makes sense yes. I guess we'll hold off the format until those things are more fleshed out.

We have put a lot of work into the SDK and extending the arifact with sourcemaps and requires & logs

This would all become infrastructure that can be reused by alternative high-level languages

mr-zwets avatar Apr 16 '25 07:04 mr-zwets

we can compare also with the 'scrypt' artifct interface

https://github.com/sCrypt-Inc/scryptlib/blob/master/src/contract.ts#L44C1-L77C2

export interface Artifact {
  /** version of artifact file */
  version: number;
  /** version of compiler used to produce this file */
  compilerVersion: string;
  /** build type, can be debug or release */
  buildType: string;
  /** name of the contract */
  contract: string;
  /** md5 of the contract source code */
  md5: string;
  /** all stateful properties defined in the contracts */
  stateProps: Array<ParamEntity>;
  /** all structures defined in the contracts, including dependent contracts */
  structs: Array<StructEntity>;
  /** all library defined in the contracts, including dependent contracts */
  library: Array<LibraryEntity>;
  /** all typealias defined in the contracts, including dependent contracts */
  alias: Array<AliasEntity>
  /** ABI of the contract: interfaces of its public functions and constructor */
  abi: Array<ABIEntity>;
  /** @deprecated locking script of the contract in ASM format, including placeholders for constructor parameters */
  asm?: string;
  /** locking script of the contract in hex format, including placeholders for constructor parameters */
  hex: string;
  /** relative file uri of the main contract source code file */
  file: string;
  /** @deprecated **/
  sources?: Array<string>;
  /** @deprecated **/
  sourceMap?: Array<string>;
  /** file uri of source map file **/
  sourceMapFile: string;
}

mr-zwets avatar Apr 16 '25 10:04 mr-zwets