mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-04-24 03:45:38 +08:00
Setup typescript subproject
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -67,3 +67,7 @@ Cargo.lock
|
||||
# These are backup files generated by rustfmt
|
||||
**/*.rs.bk
|
||||
|
||||
node_modules
|
||||
smart-contract-sdk/.nyc_output
|
||||
smart-contract-sdk/coverage
|
||||
smart-contract-sdk/lib
|
||||
|
||||
6
.vscode/settings.json
vendored
Normal file
6
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"lldb.adapterType": "native",
|
||||
"lldb.launch.sourceLanguages": ["rust"],
|
||||
"rust-client.updateOnStartup": true,
|
||||
"rust.all_features": true
|
||||
}
|
||||
15
sdk.code-workspace
Normal file
15
sdk.code-workspace
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": ".",
|
||||
"name": "rust"
|
||||
},
|
||||
{
|
||||
"path": "./smart-contract-sdk",
|
||||
"name": "smart-contract-sdk"
|
||||
}
|
||||
],
|
||||
"settings": {
|
||||
|
||||
}
|
||||
}
|
||||
16
smart-contract-sdk/.editorconfig
Normal file
16
smart-contract-sdk/.editorconfig
Normal file
@@ -0,0 +1,16 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
|
||||
[*.{js,ts,json}]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[{.eslintrc}]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
23
smart-contract-sdk/.eslintrc.js
Normal file
23
smart-contract-sdk/.eslintrc.js
Normal file
@@ -0,0 +1,23 @@
|
||||
module.exports = {
|
||||
parser: "@typescript-eslint/parser",
|
||||
parserOptions: {
|
||||
"project": "./tsconfig.json"
|
||||
},
|
||||
plugins: [
|
||||
"@typescript-eslint",
|
||||
"prettier"
|
||||
],
|
||||
parserOptions: {
|
||||
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
|
||||
sourceType: 'module', // Allows for the use of imports
|
||||
},
|
||||
extends: [
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"prettier/@typescript-eslint",
|
||||
"plugin:prettier/recommended"
|
||||
],
|
||||
rules: {
|
||||
"prettier/prettier": "error",
|
||||
"@typescript-eslint/explicit-function-return-type": "off"
|
||||
}
|
||||
}
|
||||
3
smart-contract-sdk/.prettierrc.js
Normal file
3
smart-contract-sdk/.prettierrc.js
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
singleQuote: true
|
||||
};
|
||||
37
smart-contract-sdk/.vscode/launch.json
vendored
Normal file
37
smart-contract-sdk/.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "sdk",
|
||||
"args": [
|
||||
"${workspaceFolder}/src/index.ts"
|
||||
],
|
||||
"runtimeArgs": [
|
||||
"--nolazy",
|
||||
"-r",
|
||||
"ts-node/register/transpile-only"
|
||||
],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"outputCapture": "std"
|
||||
},
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "sdk-tests",
|
||||
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
|
||||
"args": [
|
||||
"--require",
|
||||
"ts-node/register/transpile-only",
|
||||
"--colors",
|
||||
"--recursive",
|
||||
"${workspaceFolder}/src/test/**/*.ts"
|
||||
],
|
||||
"internalConsoleOptions": "openOnSessionStart"
|
||||
}
|
||||
]
|
||||
}
|
||||
3136
smart-contract-sdk/package-lock.json
generated
Normal file
3136
smart-contract-sdk/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
60
smart-contract-sdk/package.json
Normal file
60
smart-contract-sdk/package.json
Normal file
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"name": "smart-contract-sdk",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "lib/index.js",
|
||||
"scripts": {
|
||||
"compile": "tsc",
|
||||
"test": "nyc mocha --require ts-node/register/transpile-only --require source-map-support/register --recursive ./src/test/**/*.ts",
|
||||
"codecovUpload": "codecov",
|
||||
"lint": "eslint --ext .ts ./src",
|
||||
"lint-fix": "eslint --ext .ts ./src --fix",
|
||||
"prettier-fix": "prettier --write \"./src/**/*.ts\""
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"author": "",
|
||||
"license": "GPL-3.0",
|
||||
"devDependencies": {
|
||||
"@types/chai": "^4.1.7",
|
||||
"@types/mocha": "^5.2.6",
|
||||
"@types/node": "^10.14.6",
|
||||
"@typescript-eslint/eslint-plugin": "^1.7.0",
|
||||
"@typescript-eslint/parser": "^1.7.0",
|
||||
"chai": "^4.2.0",
|
||||
"codecov": "^3.3.0",
|
||||
"eslint": "^5.16.0",
|
||||
"eslint-config-prettier": "^4.2.0",
|
||||
"eslint-plugin-prettier": "^3.0.1",
|
||||
"mocha": "^6.1.4",
|
||||
"nyc": "^13.3.0",
|
||||
"prettier": "1.17.0",
|
||||
"source-map-support": "^0.5.12",
|
||||
"ts-node": "^8.1.0",
|
||||
"typescript": "^3.4.5"
|
||||
},
|
||||
"nyc": {
|
||||
"cache": false,
|
||||
"all": true,
|
||||
"extension": [
|
||||
".ts"
|
||||
],
|
||||
"include": [
|
||||
"src/**/*.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"**/*.d.ts",
|
||||
"src/test"
|
||||
],
|
||||
"require": [
|
||||
"ts-node/register/transpile-only",
|
||||
"source-map-support/register"
|
||||
],
|
||||
"reporter": [
|
||||
"text",
|
||||
"html",
|
||||
"lcov"
|
||||
]
|
||||
}
|
||||
}
|
||||
9
smart-contract-sdk/src/index.ts
Normal file
9
smart-contract-sdk/src/index.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import util from 'util';
|
||||
|
||||
function doLog() {
|
||||
console.log(util.inspect({ asdF: 4545, ggg: { '5656': true } }));
|
||||
}
|
||||
|
||||
doLog();
|
||||
|
||||
export { doLog };
|
||||
10
smart-contract-sdk/src/test/main.ts
Normal file
10
smart-contract-sdk/src/test/main.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { assert, expect } from 'chai';
|
||||
import * as main from '../index';
|
||||
|
||||
describe('main', () => {
|
||||
it('example', () => {
|
||||
main.doLog();
|
||||
const thing = true;
|
||||
assert.isTrue(thing, 'works');
|
||||
});
|
||||
});
|
||||
21
smart-contract-sdk/tsconfig.json
Normal file
21
smart-contract-sdk/tsconfig.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"moduleResolution": "node",
|
||||
"target": "es2018",
|
||||
"module": "commonjs",
|
||||
"lib": ["es2018"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"noImplicitReturns": true,
|
||||
"sourceMap": true,
|
||||
"declaration": true,
|
||||
"esModuleInterop": true,
|
||||
"outDir": "lib"
|
||||
},
|
||||
"include": [
|
||||
"src"
|
||||
],
|
||||
"exclude": [
|
||||
"src/test"
|
||||
]
|
||||
}
|
||||
@@ -499,7 +499,7 @@ mod tests {
|
||||
let secret_key: ed25519_PrivateKey = ed25519_PrivateKey::generate(&mut csprng);
|
||||
let public_key = ed25519_PublicKey::from(&secret_key);
|
||||
|
||||
let mut msg = [0u8, 1024];
|
||||
let mut msg = [0u8; 1024];
|
||||
csprng.fill_bytes(&mut msg);
|
||||
|
||||
let proof = ECVRF_prove(&secret_key, &msg.to_vec());
|
||||
|
||||
Reference in New Issue
Block a user