projects
/
crowdnode.js
/
.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
feat: add CrowdNode.stakeMinimum (Đ0.5), as per terms
[crowdnode.js/.git]
/
lib
/
crowdnode.js
diff --git
a/lib/crowdnode.js
b/lib/crowdnode.js
index 0ff758b0f17d288f622c3ef349297b60b6e77c8b..eec0f6180eec928b28106ffb194ddb29a4d84404 100644
(file)
--- a/
lib/crowdnode.js
+++ b/
lib/crowdnode.js
@@
-31,6
+31,7
@@
CrowdNode._baseUrl = CrowdNode.main.baseUrl;
CrowdNode.offset = 20000;
CrowdNode.duffs = 100000000;
CrowdNode.depositMinimum = 10000;
CrowdNode.offset = 20000;
CrowdNode.duffs = 100000000;
CrowdNode.depositMinimum = 10000;
+CrowdNode.stakeMinimum = toDuff(0.5);
/**
* @type {Record<String, Number>}
/**
* @type {Record<String, Number>}
@@
-71,6
+72,7
@@
CrowdNode.responses = {
/**
* @param {Object} opts
/**
* @param {Object} opts
+ * @param {String} opts.baseUrl
* @param {String} opts.insightBaseUrl
*/
CrowdNode.init = async function ({ baseUrl, insightBaseUrl }) {
* @param {String} opts.insightBaseUrl
*/
CrowdNode.init = async function ({ baseUrl, insightBaseUrl }) {
@@
-200,7
+202,7
@@
CrowdNode.accept = async function (wif, hotwallet) {
/**
* @param {String} wif
* @param {String} hotwallet
/**
* @param {String} wif
* @param {String} hotwallet
- * @param {Number} amount
+ * @param {Number} amount
- Duffs (1/100000000 Dash)
*/
CrowdNode.deposit = async function (wif, hotwallet, amount) {
// Send Request Message
*/
CrowdNode.deposit = async function (wif, hotwallet, amount) {
// Send Request Message
@@
-228,7
+230,7
@@
CrowdNode.deposit = async function (wif, hotwallet, amount) {
/**
* @param {String} wif
* @param {String} hotwallet
/**
* @param {String} wif
* @param {String} hotwallet
- * @param {Number} permil - 1/1000 (
percent, but per thousand)
+ * @param {Number} permil - 1/1000 (
1/10 of a percent) 500 permille = 50.0 percent
*/
CrowdNode.withdrawal = async function (wif, hotwallet, permil) {
let valid = permil > 0 && permil <= 1000;
*/
CrowdNode.withdrawal = async function (wif, hotwallet, permil) {
let valid = permil > 0 && permil <= 1000;
@@
-425,7
+427,7
@@
function createApi(tmplUrl) {
return async function () {
/** @type Array<String> */
//@ts-ignore - arguments
return async function () {
/** @type Array<String> */
//@ts-ignore - arguments
- let args = [].slice.call(arguments,
1
);
+ let args = [].slice.call(arguments,
0
);
// ex:
let url = `${CrowdNode._baseUrl}${tmplUrl}`;
// ex:
let url = `${CrowdNode._baseUrl}${tmplUrl}`;
@@
-488,9
+490,17
@@
function parseAddr(prefix, html) {
if (require.main === module) {
(async function main() {
//@ts-ignore
if (require.main === module) {
(async function main() {
//@ts-ignore
- await CrowdNode.init();
+ await CrowdNode.init({
+ //@ts-ignore
+ baseUrl: CrowdNode.main.baseUrl,
+ insightBaseUrl: "https://insight.dash.org",
+ });
console.info(CrowdNode);
})().catch(function (err) {
console.error(err);
});
}
console.info(CrowdNode);
})().catch(function (err) {
console.error(err);
});
}
+
+function toDuff(dash) {
+ return Math.round(parseFloat(dash) * DUFFS);
+}