Skip to content

Commit

Permalink
Merge PR #18 SmartC to npm package
Browse files Browse the repository at this point in the history
  • Loading branch information
deleterium authored May 15, 2022
2 parents 691cc6f + c25c504 commit 3222e24
Show file tree
Hide file tree
Showing 91 changed files with 2,641 additions and 8,030 deletions.
File renamed without changes.
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ jobs:
node-version: 14

- name: Run SmartC Tests
working-directory: ./dev
working-directory: ./
run: |
npm ci
npm run test:ci
- name: fix code coverage paths
working-directory: ./dev/coverage
working-directory: ./coverage
run: sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' lcov.info

- name: SonarCloud Scan
Expand Down
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
dev/node_modules/*
dev/lib
dev/coverage
stable
node_modules/*
dist
coverage
57 changes: 49 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,57 @@
## Objective
To empower developers, allowing them to create complex and highly optimized smart contracts.

## Usage
[Run on gitpages](https://deleterium.github.io/SmartC/stable/index.html) the latest stable version.
Optionally run the development version at [Vercel](https://smart-c.vercel.app) or choose a previous compiler version at [https://deleterium.info/SmartC/](https://deleterium.info/SmartC/).
After compiling, information to create the Smart Contract is presented and it is possible to deploy the contract on your own local node.
# Setup
This library can be obtained through npm:
```
npm install smartc-signum-compiler
```

# Usage
## Node
```ts
import { SmartC } from 'smartc-signum-compiler';

// Example: Simple compilation test
try {
const startUpTest = new SmartC({
language: 'C',
sourceCode: '#pragma maxAuxVars 1\nlong a, b, c; a=b/~c;'
})
startUpTest.compile()
const assemblyText = startUpTest.getAssemblyCode()
const machineObject = startUpTest.getMachineCode()
// Do something
} catch (e) {
return "Compilation error: " + e.message
}
```

## Browser
Your javascript file must be imported as module in the html.
```ts
import { SmartC } from 'https://cdn.jsdelivr.net/npm/[email protected]/dist/smartc.min.js';

// Example: Simple compilation test
try {
const startUpTest = new SmartC({
language: 'C',
sourceCode: '#pragma maxAuxVars 1\nlong a, b, c; a=b/~c;'
})
startUpTest.compile()
const assemblyText = startUpTest.getAssemblyCode()
const machineObject = startUpTest.getMachineCode()
// Do something
} catch (e) {
return "Compilation error: " + e.message
}
```

## Web User Interface
To be done

## Documentation / FAQ / Lessons
Detailed technical information about the project can be found in compiler's page.
After opening the desired version, click the **Help** button.
A window will open with all avaliable documentation for that specific release.
Check also [SmartC playlist on Youtube](https://www.youtube.com/playlist?list=PLyu0NNtb1eg3Gcg2JCrOle8MjtuFPb-Gi), with videos for starting, simulating and deploying a smart contract.
Docs files can be found in this repo, at `doc` folder.

## Changelog
Find [here](https://deleterium.github.io/SmartC/CHANGELOG) major upgrades between releases.
Expand Down
340 changes: 0 additions & 340 deletions dev/3rd-party/highlight.min.js

This file was deleted.

173 changes: 0 additions & 173 deletions dev/3rd-party/styles/tomorrow.css

This file was deleted.

23 changes: 0 additions & 23 deletions dev/3rd-party/winbox.bundle.js

This file was deleted.

Binary file removed dev/assets/SmartC-Watermark.png
Binary file not shown.
Binary file removed dev/assets/favicon-16.png
Binary file not shown.
Binary file removed dev/assets/favicon-32.png
Binary file not shown.
Binary file removed dev/assets/favicon.png
Binary file not shown.
Binary file removed dev/assets/whiteLogo.png
Binary file not shown.
27 changes: 0 additions & 27 deletions dev/esbuild.config.js

This file was deleted.

Loading

0 comments on commit 3222e24

Please sign in to comment.