-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
aaa
committed
May 3, 2024
0 parents
commit 5610e01
Showing
147 changed files
with
31,576 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
ELECTRUMX_PROXY_BASE_URL= | ||
WALLET_PATH=./wallets | ||
WALLET_FILE=wallet.tokens.json | ||
# testnet or livenet or regtest | ||
NETWORK=livenet | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Bitcoin: | ||
# ELECTRUMX_PROXY_BASE_URL=https://epproxy.your-atomicals-electrumx-indexer/proxy | ||
# | ||
ELECTRUMX_PROXY_BASE_URL= | ||
WALLET_PATH=./wallets | ||
WALLET_FILE=wallet.json | ||
# testnet or livenet or regtest | ||
NETWORK=livenet | ||
CONCURRENCY=4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
branches: | ||
- '**' | ||
pull_request: | ||
branches: | ||
- 'master' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [18.x, 20.x] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Setup yarn | ||
run: npm install -g yarn | ||
- name: Use Node.js ${{ matrix.node-version }} with yarn caching | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: yarn | ||
- name: Install dependencies | ||
run: yarn | ||
- name: Build | ||
run: yarn build | ||
- name: Run tests | ||
run: yarn test | ||
- name: Run e2e tests | ||
run: yarn e2e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
dist/ | ||
.DS_Store | ||
node_modules/ | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
/test/e2e/reports/ | ||
selenium-debug.log | ||
reveal_txs/ | ||
update_txs/ | ||
payment_txs/ | ||
download_txs/ | ||
transfer_txs/ | ||
wallets/ | ||
wallets/* | ||
wallet.json | ||
wallet.json.* | ||
keypairs.json | ||
owners.json | ||
commit-command-output*.json | ||
# Editor directories and files | ||
.idea | ||
.vscode | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
.gitkeep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
############################################################################### | ||
############## Stage 1: Build the code using a full node image ################ | ||
############################################################################### | ||
|
||
FROM node:20.2-alpine AS build | ||
|
||
WORKDIR /app | ||
|
||
COPY . . | ||
|
||
RUN yarn install --frozen-lockfile --network-timeout 1800000 | ||
RUN yarn build | ||
|
||
############################################################################### | ||
########## Stage 2: Copy over the built code to a leaner image ################ | ||
############################################################################### | ||
|
||
FROM node:20.2-alpine | ||
|
||
WORKDIR /app | ||
RUN mkdir /app/wallets | ||
|
||
COPY --from=build /app/.env /app/.env | ||
COPY --from=build /app/dist /app/dist | ||
COPY --from=build /app/node_modules /app/node_modules | ||
|
||
ENTRYPOINT ["node", "dist/cli.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 The Atomicals Developers | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# Atomicals Javascript Library | ||
|
||
Use `yarn` package manager instead of `npm`. Instructions below (They are: `npm install -g yarn`) | ||
|
||
In the latest version of the CLI processing library the option switches (the settings starting with `--`) are not processed correctly and it would lead to | ||
too small of a fee being set and result in your transactions not being mined. | ||
|
||
Workaround: Use `yarn` instead of `npm` | ||
|
||
|
||
### Install, Build and Run Tests | ||
|
||
## Install | ||
|
||
``` | ||
# Download the GitHub repo: | ||
git clone https://github.com/atomicals/atomicals-js.git | ||
cd atomicals-js | ||
# Build: | ||
# If you don't have yarn & node installed | ||
# npm install -g node | ||
# npm install -g yarn | ||
yarn install | ||
yarn run build | ||
#See all commands at: | ||
yarn run cli --help | ||
``` | ||
|
||
### Quick Start - Command Line (CLI) | ||
|
||
First, install packages and build, then follow the steps here to create your first Atomical and query the status. Use `yarn cli`to get a list of all commands available. | ||
|
||
#### 0. Environment File (.env) | ||
|
||
The environment file comes with defaults (`.env.example`), but it is highly recommended to install and operate your own ElectrumX server. Web browser communication is possible through the `wss` (secure websockets) interface of ElectrumX. | ||
|
||
``` | ||
ELECTRUMX_PROXY_BASE_URL=https://ep.your-atomicals-electrumx-host/proxy | ||
// Optional | ||
WALLET_PATH=./wallets | ||
WALLET_FILE=wallet.json | ||
// The number of concurrent processes to be used. This should not exceed the number of CPU cores available. If not set, the default behavior is to use all available CPU cores minus one. | ||
CONCURRENCY=4 | ||
``` | ||
|
||
|
||
#### 1. Wallet Setup | ||
|
||
The purpose of the wallet is to create p2tr (pay-to-taproot) spend scripts and to receive change from the transactions made for the various operations. _Do not put more funds than you can afford to lose, as this is still beta!_ | ||
|
||
To initialize a new `wallet.json` file that will store your address for receiving change use the `wallet-init` command. Alternatively, you may populate the `wallet.json` manually, ensuring that the address at `m/44'/0'/0'/0/0` equals the address and the derivePath is set correctly. | ||
|
||
Configure the path in the environment `.env` file to point to your wallet file. defaults to `./wallet.json` | ||
|
||
Default: | ||
|
||
``` | ||
WALLET_PATH=. | ||
WALLET_FILE=wallet.json | ||
``` | ||
|
||
Update to `wallets/` directory: | ||
|
||
``` | ||
WALLET_PATH=./wallets | ||
WALLET_FILE=wallet.json | ||
``` | ||
|
||
Create the wallet: | ||
|
||
``` | ||
yarn cli wallet-init | ||
>>> | ||
Wallet created at wallet.json | ||
phrase: maple maple maple maple maple maple maple maple maple maple maple maple | ||
Legacy address (for change): 1FXL2CJ9nAC...u3e9Evdsa2pKrPhkag | ||
Derive Path: m/44'/0'/0'/0/0 | ||
WIF: L5Sa65gNR6QsBjqK.....r6o4YzcqNRnJ1p4a6GPxqQQ | ||
------------------------------------------------------ | ||
``` | ||
|
||
#### 2. Explore the CLI | ||
|
||
Get all of the commands available: | ||
|
||
``` | ||
yarn cli --help | ||
``` | ||
|
||
|
||
## ElectrumX Server RPC Interface | ||
|
||
Atomicals ElectrumX (https://github.com/atomicals/atomicals-electrumx) | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
|
||
// using data from package.json | ||
var pkg = require('./package.json'); | ||
var source = require('vinyl-source-stream'); | ||
var banner = ['/**', | ||
' * <%= pkg.name %> - <%= pkg.description %>', | ||
' * @version v<%= pkg.version %>', | ||
' * @link <%= pkg.homepage %>', | ||
' *', | ||
' * Copyright (c) 2024 The Atomicals Developers', | ||
' *', | ||
' * This program is free software: you can redistribute it and/or modify', | ||
' * it under the terms of the GNU General Public License as published by', | ||
' * the Free Software Foundation, either version 3 of the License, or', | ||
' * (at your option) any later version.', | ||
' * ', | ||
' * This program is distributed in the hope that it will be useful,', | ||
' * but WITHOUT ANY WARRANTY; without even the implied warranty of', | ||
' * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the', | ||
' * GNU General Public License for more details.', | ||
' * ', | ||
' * You should have received a copy of the GNU General Public License', | ||
' * along with this program. If not, see <https://www.gnu.org/licenses/>.', | ||
' */', | ||
''].join('\n'); | ||
|
||
var gulp = require('gulp'); | ||
var ts = require('gulp-typescript'); | ||
var header = require('gulp-header'); | ||
var rename = require("gulp-rename"); | ||
|
||
var uglify = require('gulp-uglify'); | ||
|
||
// Load plugins | ||
|
||
gulp.task('build', function () { | ||
return gulp.src('lib/**/*.ts') | ||
.pipe(ts({ | ||
noImplicitAny: false, | ||
// outFile: 'atomicals.js', | ||
// module: 'amd' | ||
})) | ||
.pipe(header(banner, { pkg : pkg } )) | ||
.pipe(uglify()) | ||
.pipe(rename("atomicals.js")) | ||
.pipe(gulp.dest('dist')); | ||
}); |
Oops, something went wrong.