*Initial version

This commit is contained in:
Derrick Hammer 2023-02-19 14:42:15 -05:00
parent f066859df9
commit bf72ae3695
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
4 changed files with 79 additions and 4 deletions

20
LICENSE
View File

@ -1,9 +1,21 @@
MIT License
Copyright (c) <year> <copyright holders>
Copyright (c) 2022 Hammer Technologies LLC
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

19
package.json Normal file
View File

@ -0,0 +1,19 @@
{
"name": "@lumeweb/kernel-handshake-client",
"version": "0.1.0",
"type": "module",
"main": "dist/index.js",
"dependencies": {
"@lumeweb/libkernel-universal": "git+https://git.lumeweb.com/LumeWeb/libkernel-universal.git",
"@noble/hashes": "^1.2.0",
"@siaweb/libweb": "git+https://git.lumeweb.com/LumeWeb/libsiaweb.git",
"backoff.js": "^1.0.4",
"eventemitter3": "^5.0.0"
},
"devDependencies": {
"@types/node": "^18.13.0",
"prettier": "^2.8.4",
"pretty": "^2.0.0",
"typescript": "^4.9.5"
}
}

21
src/index.ts Normal file
View File

@ -0,0 +1,21 @@
import { Client, factory } from "@lumeweb/libkernel-universal";
const MODULE = "AAAWj15-dWy44kfNabXtrcgt9Hae2klbZoHRK9bci5x2nQ";
export interface Response {
id?: number;
error?: string;
result: any;
}
export class HandshakeClient extends Client {
public async ready(): Promise<void> {
return this.callModuleReturn("ready");
}
public async query(method: string, params: any): Promise<Response> {
return this.callModuleReturn("query", { method, params });
}
}
export const createClient = factory<HandshakeClient>(HandshakeClient, MODULE);

23
tsconfig.json Normal file
View File

@ -0,0 +1,23 @@
{
"compilerOptions": {
"declaration": true,
"strict": true,
"module": "esnext",
"target": "esnext",
"esModuleInterop": true,
"sourceMap": false,
"rootDir": "src",
"outDir": "dist",
"typeRoots": [
"node_modules/@types",
],
"moduleResolution": "node",
"declarationMap": true,
"declarationDir": "dist",
"emitDeclarationOnly": false,
"allowJs": true
},
"include": [
"src"
]
}