Skip to content

Commit 02f4afd

Browse files
Merge pull request #1 from BitGo/BTC-2650.add-wasm-utxo
feat: initialize with wasm-miniscript repo
2 parents 545212e + d7dff92 commit 02f4afd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+25144
-2
lines changed

.github/workflows/ci.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: wasm-miniscript
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
- rel/**
11+
12+
workflow_dispatch:
13+
14+
jobs:
15+
unit-test:
16+
runs-on: ubuntu-latest
17+
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
node-version: [18.x, 20.x]
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
with:
26+
ref: ${{ github.event.pull_request.head.sha }}
27+
28+
- name: Install Rust
29+
uses: dtolnay/rust-toolchain@v1
30+
with:
31+
toolchain: nightly
32+
33+
- name: Cache Rust dependencies
34+
uses: Swatinem/rust-cache@v2
35+
with:
36+
workspaces: "packages/wasm-miniscript"
37+
cache-on-failure: true
38+
39+
- name: Setup node ${{ matrix.node-version }}
40+
uses: actions/setup-node@v3
41+
with:
42+
node-version: ${{ matrix.node-version }}
43+
44+
- name: Install wasm tools
45+
run: |
46+
rustup component add rustfmt
47+
cargo install wasm-pack --version 0.13.1
48+
cargo install wasm-opt --version 0.116.1
49+
50+
- name: Build Info
51+
run: |
52+
echo "node $(node --version)"
53+
echo "npm $(npm --version)"
54+
echo "rustc $(rustc --version)"
55+
echo "wasm-pack $(wasm-pack --version)"
56+
echo "wasm-opt $(wasm-opt --version)"
57+
git --version
58+
echo "base ref $GITHUB_BASE_REF"
59+
echo "head ref $GITHUB_HEAD_REF"
60+
61+
- name: Fetch Base Ref
62+
run: |
63+
git fetch origin $GITHUB_BASE_REF
64+
65+
- name: Install Packages
66+
run: npm ci --workspaces --include-workspace-root
67+
68+
- name: test
69+
run: npx --version
70+
71+
- name: build packages
72+
run: npm --workspaces run build
73+
74+
- name: Check Source Code Formatting
75+
run: npm run check-fmt
76+
77+
- name: Unit Test
78+
run: npm --workspaces test

.github/workflows/publish.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Publish @wasm-miniscript
2+
on:
3+
push:
4+
branches:
5+
- master
6+
- beta
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
11+
jobs:
12+
publish:
13+
name: Publish Release
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Setup Node
23+
uses: actions/setup-node@v3
24+
with:
25+
node-version: 18
26+
27+
- name: Install Rust
28+
uses: dtolnay/rust-toolchain@v1
29+
with:
30+
toolchain: nightly
31+
32+
- name: Install wasm tools
33+
run: |
34+
rustup component add rustfmt
35+
cargo install wasm-pack --version 0.13.1
36+
cargo install wasm-opt --version 0.116.1
37+
38+
- name: Build Info
39+
run: |
40+
echo "node $(node --version)"
41+
echo "npm $(npm --version)"
42+
echo "rustc $(rustc --version)"
43+
echo "wasm-pack $(wasm-pack --version)"
44+
echo "wasm-opt $(wasm-opt --version)"
45+
git --version
46+
echo "base ref $GITHUB_BASE_REF"
47+
echo "head ref $GITHUB_HEAD_REF"
48+
49+
- name: Build Info
50+
run: |
51+
echo "node $(node --version)"
52+
echo "npm $(npm --version)"
53+
echo "rust $(rustup --version)"
54+
git --version
55+
56+
- name: Configure NPM
57+
run: |
58+
echo "workspaces-update = false" >> .npmrc
59+
echo "@bitgo:registry=https://registry.npmjs.org" >> .npmrc
60+
echo "//registry.npmjs.org/:always-auth=true" >> .npmrc
61+
62+
- name: Install Packages
63+
run: npm ci --workspaces --include-workspace-root
64+
65+
- name: build packages
66+
run: npm --workspaces run build
67+
68+
- name: Unit Test
69+
run: npm --workspaces test
70+
71+
- name: Release
72+
run: npx multi-semantic-release
73+
env:
74+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules/
2+
.idea/
3+
*.iml
4+
*.tsbuildinfo

.prettierrc.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# force trailing comma
2+
trailingComma: all
3+
printWidth: 100

.releaserc.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"branches": [
3+
"master",
4+
{
5+
"name": "beta",
6+
"prerelease": true
7+
}
8+
],
9+
"plugins": [
10+
"@semantic-release/commit-analyzer",
11+
"@semantic-release/release-notes-generator",
12+
"@semantic-release/npm"
13+
]
14+
}

CODEOWNERS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# BitGoJS code owners and first officers will automatically be requested for review whenever a pull request touches the files they own.
2+
# Each line is a file pattern followed by one or more owners.
3+
# Order is important. The last matching pattern has the most precedence.
4+
5+
# These owners and first officers will be the default owners for everything in the repo.
6+
* @BitGo/btc-team

README.md

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,31 @@
1-
# BitGoWASM
2-
WebAssembly SDK components for BitGo
1+
# wasm-miniscript
2+
3+
This is a wrapper around the [rust-miniscript](https://github.com/rust-bitcoin/rust-miniscript) crate that is compiled
4+
to WebAssembly. It allows you to use Miniscript in NodeJS and in the browser.
5+
6+
# WebUI playground
7+
8+
Go to https://bitgo.github.io/wasm-miniscript to see a live demo of the wasm-miniscript library in action.
9+
10+
# Dependencies
11+
12+
- [Rust](https://www.rust-lang.org/) nightly
13+
- [wasm-pack](https://rustwasm.github.io/wasm-pack/) (install with `cargo install wasm-pack`)
14+
- [NodeJS](https://nodejs.org/en/)
15+
16+
# Packages
17+
18+
## packages/wasm-miniscript
19+
20+
This contains the core library that is compiled to WebAssembly.
21+
It is a wrapper around the `rust-miniscript` crate.
22+
23+
### Building
24+
25+
If your system has problems with `wasm-pack` (Mac M1), you can use the `Container.mk` Makefile to build the wasm files:
26+
27+
```bash
28+
cd packages/wasm-miniscript
29+
make -f Container.mk build-image
30+
make -f Container.mk build-wasm
31+
```

0 commit comments

Comments
 (0)