How to use the @arkecosystem/crypto.Utils.formatSatoshi function in @arkecosystem/crypto

To help you get started, we’ve selected a few @arkecosystem/crypto examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ArkEcosystem / core / packages / core-tester-cli / src / commands / command.ts View on Github external
protected fromSatoshi(satoshi) {
        return Utils.formatSatoshi(satoshi);
    }
github ArkEcosystem / core / packages / core-transaction-pool / src / dynamic-fee.ts View on Github external
app.resolvePlugin("logger").debug(
                `Transaction ${id} not eligible to enter pool - fee of ${Utils.formatSatoshi(
                    fee,
                )} is smaller than minimum fee (${Utils.formatSatoshi(minFeePool)})`,
            );
        }
    } else {
        const staticFee: Utils.BigNumber = Managers.feeManager.getForTransaction(transaction.data);

        if (fee.isEqualTo(staticFee)) {
            broadcast = true;
            enterPool = true;

            app.resolvePlugin("logger").debug(
                `Transaction ${id} eligible for broadcast and to enter pool - fee of ${Utils.formatSatoshi(
                    fee,
                )} is equal to static fee (${Utils.formatSatoshi(staticFee)})`,
            );
        } else {
            broadcast = false;
            enterPool = false;

            app.resolvePlugin("logger").debug(
                `Transaction ${id} not eligible for broadcast and not eligible to enter pool - fee of ${Utils.formatSatoshi(
                    fee,
                )} does not match static fee (${Utils.formatSatoshi(staticFee)})`,
            );
        }
    }

    return { broadcast, enterPool };
github ArkEcosystem / core / packages / core-transaction-pool / src / dynamic-fee.ts View on Github external
`Transaction ${id} not eligible to enter pool - fee of ${Utils.formatSatoshi(
                    fee,
                )} is smaller than minimum fee (${Utils.formatSatoshi(minFeePool)})`,
            );
        }
    } else {
        const staticFee: Utils.BigNumber = Managers.feeManager.getForTransaction(transaction.data);

        if (fee.isEqualTo(staticFee)) {
            broadcast = true;
            enterPool = true;

            app.resolvePlugin("logger").debug(
                `Transaction ${id} eligible for broadcast and to enter pool - fee of ${Utils.formatSatoshi(
                    fee,
                )} is equal to static fee (${Utils.formatSatoshi(staticFee)})`,
            );
        } else {
            broadcast = false;
            enterPool = false;

            app.resolvePlugin("logger").debug(
                `Transaction ${id} not eligible for broadcast and not eligible to enter pool - fee of ${Utils.formatSatoshi(
                    fee,
                )} does not match static fee (${Utils.formatSatoshi(staticFee)})`,
            );
        }
    }

    return { broadcast, enterPool };
};
github ArkEcosystem / core / packages / core-transaction-pool / src / dynamic-fee.ts View on Github external
const { dynamicFees } = app.resolveOptions("transaction-pool");

    let broadcast: boolean;
    let enterPool: boolean;

    if (dynamicFees.enabled) {
        const minFeeBroadcast: Utils.BigNumber = calculateMinimumFee(dynamicFees.minFeeBroadcast, transaction);

        if (fee.isGreaterThanOrEqualTo(minFeeBroadcast)) {
            broadcast = true;

            app.resolvePlugin("logger").debug(
                `Transaction ${id} eligible for broadcast - fee of ${Utils.formatSatoshi(fee)} is ${
                    fee.isEqualTo(minFeeBroadcast) ? "equal to" : "greater than"
                } minimum fee (${Utils.formatSatoshi(minFeeBroadcast)})`,
            );
        } else {
            broadcast = false;

            app.resolvePlugin("logger").debug(
                `Transaction ${id} not eligible for broadcast - fee of ${Utils.formatSatoshi(
                    fee,
                )} is smaller than minimum fee (${Utils.formatSatoshi(minFeeBroadcast)})`,
            );
        }

        const minFeePool: Utils.BigNumber = calculateMinimumFee(dynamicFees.minFeePool, transaction);

        if (fee.isGreaterThanOrEqualTo(minFeePool)) {
            enterPool = true;
github ArkEcosystem / core / packages / core-state / src / wallets / wallet-manager.ts View on Github external
return { round: roundInfo ? roundInfo.round : 0, ...delegate, rate };
            });

        if (roundInfo) {
            delegateWallets = delegateWallets.slice(0, roundInfo.maxDelegates);

            for (const [voteBalance, set] of equalVotesMap.entries()) {
                const values: any[] = Array.from(set.values());
                if (delegateWallets.includes(values[0])) {
                    const mapped = values.map(v => `${v.username} (${v.publicKey})`);
                    this.logger.warn(
                        `Delegates ${JSON.stringify(
                            mapped,
                            undefined,
                            4,
                        )} have a matching vote balance of ${Utils.formatSatoshi(voteBalance)}`,
                    );
                }
            }
        }

        return delegateWallets;
    }