mirror of
https://github.com/aljazceru/cdk.git
synced 2026-02-10 15:45:59 +01:00
bindings/cashu-js add npm files and fix duplicate names
This commit is contained in:
7
bindings/cashu-js/.gitignore
vendored
Normal file
7
bindings/cashu-js/.gitignore
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/target
|
||||
**/*.rs.bk
|
||||
Cargo.lock
|
||||
bin/
|
||||
pkg/
|
||||
wasm-pack.log
|
||||
*.tgz
|
||||
12
bindings/cashu-js/.npmignore
Normal file
12
bindings/cashu-js/.npmignore
Normal file
@@ -0,0 +1,12 @@
|
||||
.cargo/
|
||||
target/
|
||||
src/
|
||||
scripts/
|
||||
examples/
|
||||
pkg/package.json
|
||||
pkg/*.md
|
||||
pkg/*.wasm
|
||||
.gitignore
|
||||
Cargo.toml
|
||||
Cargo.lock
|
||||
*.tgz
|
||||
@@ -5,6 +5,8 @@ edition = "2021"
|
||||
description = "Cashu rust implementation, for JavaScript"
|
||||
authors = ["thesimplekid <tsk@thesimplekid.com>"]
|
||||
publish = false
|
||||
repository.workspace = true
|
||||
license.workspace = true
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
[lib]
|
||||
|
||||
29
bindings/cashu-js/LICENSE
Normal file
29
bindings/cashu-js/LICENSE
Normal file
@@ -0,0 +1,29 @@
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2023, thesimplekid
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
21
bindings/cashu-js/LICENSES/NOSTR-MIT
Normal file
21
bindings/cashu-js/LICENSES/NOSTR-MIT
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022-2023 Yuki Kishimoto
|
||||
|
||||
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 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.
|
||||
44
bindings/cashu-js/package.json
Normal file
44
bindings/cashu-js/package.json
Normal file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"name": "@rust-cashu/cashu",
|
||||
"version": "0.0.1",
|
||||
"description": "Cashu protocol implementation, for JavaScript",
|
||||
"keywords": [
|
||||
"cashu",
|
||||
"protocol",
|
||||
"rust",
|
||||
"bindings"
|
||||
],
|
||||
"license": "BSD-3-Clause",
|
||||
"homepage": "https://github.com/thesimplekid/cashu-crab",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/thesimplekid/cashu-crab"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/thesimplekid/cashu-crab/issues"
|
||||
},
|
||||
"author": {
|
||||
"name": "thesimplekid",
|
||||
"email": "tsk@thesimplekid.com",
|
||||
"url": "https://github.com/thesimplekid"
|
||||
},
|
||||
"main": "pkg/cashu_js.js",
|
||||
"types": "pkg/cashu_js.d.ts",
|
||||
"files": [
|
||||
"pkg/cashu_js_bg.wasm.js",
|
||||
"pkg/cashu_js_bg.wasm.d.ts",
|
||||
"pkg/cashu_js.js",
|
||||
"pkg/cashu_js.d.ts"
|
||||
],
|
||||
"devDependencies": {
|
||||
"wasm-pack": "^0.10.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "WASM_PACK_ARGS=--release ./scripts/build.sh",
|
||||
"build:dev": "WASM_PACK_ARGS=--dev ./scripts/build.sh",
|
||||
"package": "npm run build && npm pack"
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ use wasm_bindgen::prelude::*;
|
||||
|
||||
use crate::{nuts::nut01::JsPublicKey, nuts::nut02::JsId, types::JsAmount, types::JsSecret};
|
||||
|
||||
#[wasm_bindgen(js_name = Token)]
|
||||
#[wasm_bindgen(js_name = Proof)]
|
||||
pub struct JsProof {
|
||||
inner: Proof,
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ use std::ops::Deref;
|
||||
use cashu::nuts::nut01::SecretKey;
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[wasm_bindgen(js_name = PublicKey)]
|
||||
#[wasm_bindgen(js_name = SecretKey)]
|
||||
pub struct JsSecretKey {
|
||||
inner: SecretKey,
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ impl JsMintVersion {
|
||||
}
|
||||
}
|
||||
|
||||
#[wasm_bindgen(js_name = MintVersion)]
|
||||
#[wasm_bindgen(js_name = MintInfo)]
|
||||
pub struct JsMintInfo {
|
||||
inner: MintInfo,
|
||||
}
|
||||
@@ -65,7 +65,7 @@ impl From<MintInfo> for JsMintInfo {
|
||||
}
|
||||
}
|
||||
|
||||
#[wasm_bindgen(js_class = MintVersion)]
|
||||
#[wasm_bindgen(js_class = MintInfo)]
|
||||
impl JsMintInfo {
|
||||
#[wasm_bindgen(constructor)]
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
|
||||
9
bindings/cashu-js/tsconfig.json
Normal file
9
bindings/cashu-js/tsconfig.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"strict": true
|
||||
},
|
||||
"typedocOptions": {
|
||||
"entryPoints": ["pkg/nostr_js.d.ts"],
|
||||
"readme": "README.md"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user