-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: janniks <[email protected]>
- Loading branch information
1 parent
4121c02
commit 0da97c2
Showing
15 changed files
with
1,169 additions
and
12 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { ContractInterface } from "../contractInterface.js"; | ||
|
||
// @todo: fix the type, the key is a contract identifier not a string | ||
export function generateTSLib(contractInterfaces: Map<string, ContractInterface>) { | ||
contractInterfaces.forEach((contractInterface, identifier) => { | ||
// @ts-ignore | ||
const name: string = identifier.name; | ||
|
||
console.log(name, JSON.stringify(contractInterface, null, 2)); | ||
}); | ||
} | ||
|
||
// input: contractInterface | ||
|
||
// output: | ||
// name-of-the-project.ts | ||
|
||
// export const countract1 = { | ||
// increment: () => { | ||
// // call increment function | ||
// }, | ||
// decrement: () => { | ||
// // call decrement function | ||
// } | ||
// } | ||
|
||
// export const countract2 = { | ||
// increment: () => { | ||
// // call increment function | ||
// }, | ||
// decrement: () => { | ||
// // call decrement function | ||
// } | ||
// } | ||
|
||
// import contracts from "/ts-gen/proxy" | ||
|
||
// const {counter }= contracts; | ||
|
||
// const {increment } = counter | ||
|
||
// // const res = vm.callPublicFn(contract, "increment", [], sender); | ||
|
||
// callReadOnlyFunction.bind(null, "ASDKLJASLDKJ", ) | ||
|
||
// contracts.counter.increment() | ||
|
||
// const res: = await counter.increment(arg1, arg2) | ||
|
||
// usage | ||
// counter.increment() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
**/settings/Mainnet.toml | ||
**/settings/Testnet.toml | ||
.cache/** | ||
history.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
{ | ||
"deno.enable": true, | ||
"files.eol": "\n" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
|
||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "check contracts", | ||
"group": "test", | ||
"type": "shell", | ||
"command": "clarinet check" | ||
}, | ||
{ | ||
"label": "test contracts", | ||
"group": "test", | ||
"type": "shell", | ||
"command": "clarinet test" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[project] | ||
name = 'counter' | ||
description = '' | ||
authors = [] | ||
telemetry = false | ||
cache_dir = './.cache' | ||
requirements = [] | ||
|
||
[contracts.counter] | ||
path = 'contracts/counter.clar' | ||
clarity_version = 2 | ||
epoch = 2.4 | ||
|
||
[repl.analysis] | ||
passes = [] | ||
|
||
[repl.analysis.check_checker] | ||
strict = false | ||
trusted_sender = false | ||
trusted_caller = false | ||
callee_filter = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
;; counter | ||
;; let's get started with smart contracts | ||
(define-data-var counter uint u1) | ||
|
||
(define-public (increment (step uint)) | ||
(let ((new-val (+ step (var-get counter)))) | ||
(var-set counter new-val) | ||
(print { object: "counter", action: "incremented", value: new-val }) | ||
(ok new-val) | ||
) | ||
) | ||
|
||
(define-public (decrement (step uint)) | ||
(let ((new-val (- step (var-get counter)))) | ||
(var-set counter new-val) | ||
(print { object: "counter", action: "decremented", value: new-val }) | ||
(ok new-val) | ||
) | ||
) | ||
|
||
(define-read-only (read-counter) | ||
(var-get counter) | ||
) |
Oops, something went wrong.