Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/scrypt-inc/counter-demos
https://github.com/scrypt-inc/counter-demos
Last synced: 19 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/scrypt-inc/counter-demos
- Owner: sCrypt-Inc
- Created: 2023-07-29T17:09:42.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-08-02T03:16:57.000Z (over 1 year ago)
- Last Synced: 2024-11-05T09:37:25.265Z (2 months ago)
- Size: 4.88 KB
- Stars: 4
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# counter-demos
![](https://aaron67-public.oss-cn-beijing.aliyuncs.com/202307151317201.png)
## deployments
- [React](https://counter-react-pearl.vercel.app/)
- [Next.js](https://counter-next-psi.vercel.app/)
- [Angular](https://counter-angular-sigma.vercel.app/)
- [Svelte](https://counter-svelte-eight.vercel.app/)
- Vue 3.x
- [bundled with Vite](https://counter-vue3-vite.vercel.app/)
- [bundled with Webpack](https://counter-vue3-webpack.vercel.app/)
- Vue 2.x
- [bundled with Vite](https://counter-vue2-vite.vercel.app/)
- [bundled with Webpack](https://counter-vue2-webpack.vercel.app/)## contract
```ts
import { method, prop, SmartContract, hash256, assert, ByteString, SigHash } from 'scrypt-ts'export class Counter extends SmartContract {
@prop(true)
count: bigintconstructor(count: bigint) {
super(count)
this.count = count
}@method(SigHash.SINGLE)
public increment() {
this.count++// make sure balance in the contract does not change
const amount: bigint = this.ctx.utxo.value
// output containing the latest state
const output: ByteString = this.buildStateOutput(amount)
// verify current tx has this single output
assert(this.ctx.hashOutputs === hash256(output), 'hashOutputs mismatch')
}
}
```