-
Notifications
You must be signed in to change notification settings - Fork 7
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
Showing
11 changed files
with
1,289 additions
and
5 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,61 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
|
||
# next.js build output | ||
.next |
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,46 @@ | ||
const fetch = require("node-fetch"); | ||
const { broadcast, waitForTx, setScript, invokeScript } = require("@waves/waves-transactions"); | ||
const { address, base58Encode, publicKey } = require("@waves/waves-crypto"); | ||
const fs = require("fs"); | ||
const {extract_vk} = require("../zwaves_node/lib/index.js"); | ||
|
||
|
||
|
||
const env = process.env; | ||
if (env.NODE_ENV !== 'production') { | ||
require('dotenv').load(); | ||
} | ||
|
||
|
||
|
||
|
||
const seed = env.MNEMONIC; | ||
const rpc = env.WAVES_RPC; | ||
const chainId = env.WAVES_CHAINID; | ||
const dApp = address(env.MNEMONIC, chainId); | ||
|
||
const ridetpl = fs.readFileSync("ride/zwaves.ride", {encoding:"utf8"}); | ||
const transfer_mpc = fs.readFileSync("../zwaves_setup/mpc_params_transfer"); | ||
const accumulator_mpc = fs.readFileSync("../zwaves_setup/mpc_params_accumulator"); | ||
|
||
|
||
|
||
|
||
(async () => { | ||
const ridescript = ridetpl | ||
.replace(`let transferVK=base58''`, `let transferVK=base58'${base58Encode(extract_vk(transfer_mpc))}'`) | ||
.replace(`let utxoAccumulatorVK=base58''`, `let utxoAccumulatorVK=base58'${base58Encode(extract_vk(accumulator_mpc))}'`) | ||
|
||
|
||
let request = await fetch(`${env.WAVES_RPC}utils/script/compile`, { method: "POST", body: ridescript }) | ||
const {script} = await request.json(); | ||
|
||
|
||
let tx = setScript({ script, fee: 1400000, chainId}, seed); | ||
await broadcast(tx, rpc); | ||
await waitForTx(tx.id, { apiBase: rpc }); | ||
|
||
console.log(`Dapp is deployed with public key ${publicKey(seed)}. Specify DAPP property at .env file.`) | ||
|
||
process.exit(); | ||
})(); |
Oops, something went wrong.