nano-sdk 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +262 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +38 -0
- package/dist/nano/blocks/block.d.ts +39 -0
- package/dist/nano/blocks/block.js +11 -0
- package/dist/nano/blocks/index.d.ts +6 -0
- package/dist/nano/blocks/index.js +15 -0
- package/dist/nano/blocks/legacy-change-block.d.ts +9 -0
- package/dist/nano/blocks/legacy-change-block.js +17 -0
- package/dist/nano/blocks/legacy-open-block.d.ts +10 -0
- package/dist/nano/blocks/legacy-open-block.js +18 -0
- package/dist/nano/blocks/legacy-receive-block.d.ts +9 -0
- package/dist/nano/blocks/legacy-receive-block.js +16 -0
- package/dist/nano/blocks/legacy-send-block.d.ts +10 -0
- package/dist/nano/blocks/legacy-send-block.js +19 -0
- package/dist/nano/blocks/state-block.d.ts +13 -0
- package/dist/nano/blocks/state-block.js +23 -0
- package/dist/nano/crypto/conversion/account-converter.d.ts +17 -0
- package/dist/nano/crypto/conversion/account-converter.js +68 -0
- package/dist/nano/crypto/conversion/base32-converter.d.ts +16 -0
- package/dist/nano/crypto/conversion/base32-converter.js +98 -0
- package/dist/nano/crypto/conversion/hash-converter.d.ts +17 -0
- package/dist/nano/crypto/conversion/hash-converter.js +65 -0
- package/dist/nano/crypto/conversion/hex-converter.d.ts +17 -0
- package/dist/nano/crypto/conversion/hex-converter.js +82 -0
- package/dist/nano/crypto/conversion/private-key-converter.d.ts +17 -0
- package/dist/nano/crypto/conversion/private-key-converter.js +65 -0
- package/dist/nano/crypto/conversion/public-key-converter.d.ts +17 -0
- package/dist/nano/crypto/conversion/public-key-converter.js +65 -0
- package/dist/nano/crypto/conversion/seed-converter.d.ts +17 -0
- package/dist/nano/crypto/conversion/seed-converter.js +65 -0
- package/dist/nano/crypto/conversion/signature-converter.d.ts +17 -0
- package/dist/nano/crypto/conversion/signature-converter.js +65 -0
- package/dist/nano/crypto/conversion/work-converter.d.ts +17 -0
- package/dist/nano/crypto/conversion/work-converter.js +65 -0
- package/dist/nano/crypto/derive-account-from-link.d.ts +12 -0
- package/dist/nano/crypto/derive-account-from-link.js +34 -0
- package/dist/nano/crypto/derive-account-from-private-key.d.ts +12 -0
- package/dist/nano/crypto/derive-account-from-private-key.js +31 -0
- package/dist/nano/crypto/derive-account-from-public-key.d.ts +13 -0
- package/dist/nano/crypto/derive-account-from-public-key.js +56 -0
- package/dist/nano/crypto/derive-private-key-from-seed.d.ts +13 -0
- package/dist/nano/crypto/derive-private-key-from-seed.js +60 -0
- package/dist/nano/crypto/derive-public-key-from-account.d.ts +12 -0
- package/dist/nano/crypto/derive-public-key-from-account.js +41 -0
- package/dist/nano/crypto/derive-public-key-from-private-key.d.ts +12 -0
- package/dist/nano/crypto/derive-public-key-from-private-key.js +42 -0
- package/dist/nano/crypto/generate-private-key.d.ts +10 -0
- package/dist/nano/crypto/generate-private-key.js +34 -0
- package/dist/nano/crypto/generate-public-key.d.ts +10 -0
- package/dist/nano/crypto/generate-public-key.js +31 -0
- package/dist/nano/crypto/generate-random-bytes.d.ts +10 -0
- package/dist/nano/crypto/generate-random-bytes.js +57 -0
- package/dist/nano/crypto/generate-seed.d.ts +10 -0
- package/dist/nano/crypto/generate-seed.js +31 -0
- package/dist/nano/crypto/hash-block.d.ts +18 -0
- package/dist/nano/crypto/hash-block.js +81 -0
- package/dist/nano/crypto/index.d.ts +14 -0
- package/dist/nano/crypto/index.js +31 -0
- package/dist/nano/crypto/sign-hash.d.ts +14 -0
- package/dist/nano/crypto/sign-hash.js +40 -0
- package/dist/nano/crypto/verify-hash.d.ts +22 -0
- package/dist/nano/crypto/verify-hash.js +35 -0
- package/dist/nano/crypto/verify-signature.d.ts +15 -0
- package/dist/nano/crypto/verify-signature.js +40 -0
- package/dist/nano/crypto/verify-work.d.ts +14 -0
- package/dist/nano/crypto/verify-work.js +48 -0
- package/dist/nano/index.d.ts +7 -0
- package/dist/nano/index.js +51 -0
- package/dist/nano/math/comparison.d.ts +6 -0
- package/dist/nano/math/comparison.js +20 -0
- package/dist/nano/math/format-raw.d.ts +17 -0
- package/dist/nano/math/format-raw.js +94 -0
- package/dist/nano/math/index.d.ts +14 -0
- package/dist/nano/math/index.js +31 -0
- package/dist/nano/math/nano-to-raw.d.ts +11 -0
- package/dist/nano/math/nano-to-raw.js +38 -0
- package/dist/nano/math/raw-divide.d.ts +19 -0
- package/dist/nano/math/raw-divide.js +73 -0
- package/dist/nano/math/raw-is-equal-to.d.ts +9 -0
- package/dist/nano/math/raw-is-equal-to.js +29 -0
- package/dist/nano/math/raw-is-greater-than-or-equal-to.d.ts +9 -0
- package/dist/nano/math/raw-is-greater-than-or-equal-to.js +29 -0
- package/dist/nano/math/raw-is-greater-than.d.ts +9 -0
- package/dist/nano/math/raw-is-greater-than.js +29 -0
- package/dist/nano/math/raw-is-less-than-or-equal-to.d.ts +9 -0
- package/dist/nano/math/raw-is-less-than-or-equal-to.js +29 -0
- package/dist/nano/math/raw-is-less-than.d.ts +9 -0
- package/dist/nano/math/raw-is-less-than.js +29 -0
- package/dist/nano/math/raw-is-zero.d.ts +11 -0
- package/dist/nano/math/raw-is-zero.js +33 -0
- package/dist/nano/math/raw-minus.d.ts +19 -0
- package/dist/nano/math/raw-minus.js +66 -0
- package/dist/nano/math/raw-modulo.d.ts +19 -0
- package/dist/nano/math/raw-modulo.js +69 -0
- package/dist/nano/math/raw-multiply.d.ts +19 -0
- package/dist/nano/math/raw-multiply.js +66 -0
- package/dist/nano/math/raw-plus.d.ts +19 -0
- package/dist/nano/math/raw-plus.js +66 -0
- package/dist/nano/math/raw-to-nano.d.ts +15 -0
- package/dist/nano/math/raw-to-nano.js +32 -0
- package/dist/nano/rpc/http/http-client.d.ts +20 -0
- package/dist/nano/rpc/http/http-client.js +76 -0
- package/dist/nano/rpc/http/index.d.ts +5 -0
- package/dist/nano/rpc/http/index.js +20 -0
- package/dist/nano/rpc/http/post-error.d.ts +8 -0
- package/dist/nano/rpc/http/post-error.js +12 -0
- package/dist/nano/rpc/http/post-result.d.ts +15 -0
- package/dist/nano/rpc/http/post-result.js +2 -0
- package/dist/nano/rpc/http/post.d.ts +9 -0
- package/dist/nano/rpc/http/post.js +77 -0
- package/dist/nano/rpc/http/request-config.d.ts +13 -0
- package/dist/nano/rpc/http/request-config.js +2 -0
- package/dist/nano/rpc/index.d.ts +4 -0
- package/dist/nano/rpc/index.js +20 -0
- package/dist/nano/rpc/methods/account-balance.d.ts +20 -0
- package/dist/nano/rpc/methods/account-balance.js +7 -0
- package/dist/nano/rpc/methods/account-block-count.d.ts +14 -0
- package/dist/nano/rpc/methods/account-block-count.js +7 -0
- package/dist/nano/rpc/methods/account-get.d.ts +14 -0
- package/dist/nano/rpc/methods/account-get.js +7 -0
- package/dist/nano/rpc/methods/account-history.d.ts +15 -0
- package/dist/nano/rpc/methods/account-history.js +22 -0
- package/dist/nano/rpc/methods/account-info.d.ts +16 -0
- package/dist/nano/rpc/methods/account-info.js +24 -0
- package/dist/nano/rpc/methods/account-key.d.ts +14 -0
- package/dist/nano/rpc/methods/account-key.js +7 -0
- package/dist/nano/rpc/methods/account-representative.d.ts +14 -0
- package/dist/nano/rpc/methods/account-representative.js +7 -0
- package/dist/nano/rpc/methods/account-weight.d.ts +14 -0
- package/dist/nano/rpc/methods/account-weight.js +7 -0
- package/dist/nano/rpc/methods/accounts-balances.d.ts +26 -0
- package/dist/nano/rpc/methods/accounts-balances.js +7 -0
- package/dist/nano/rpc/methods/accounts-frontiers.d.ts +16 -0
- package/dist/nano/rpc/methods/accounts-frontiers.js +7 -0
- package/dist/nano/rpc/methods/accounts-receivable.d.ts +15 -0
- package/dist/nano/rpc/methods/accounts-receivable.js +20 -0
- package/dist/nano/rpc/methods/accounts-representatives.d.ts +16 -0
- package/dist/nano/rpc/methods/accounts-representatives.js +7 -0
- package/dist/nano/rpc/methods/available-supply.d.ts +12 -0
- package/dist/nano/rpc/methods/available-supply.js +7 -0
- package/dist/nano/rpc/methods/block-account.d.ts +14 -0
- package/dist/nano/rpc/methods/block-account.js +7 -0
- package/dist/nano/rpc/methods/block-confirm.d.ts +14 -0
- package/dist/nano/rpc/methods/block-confirm.js +7 -0
- package/dist/nano/rpc/methods/block-count.d.ts +16 -0
- package/dist/nano/rpc/methods/block-count.js +7 -0
- package/dist/nano/rpc/methods/block-create.d.ts +13 -0
- package/dist/nano/rpc/methods/block-create.js +18 -0
- package/dist/nano/rpc/methods/block-hash.d.ts +44 -0
- package/dist/nano/rpc/methods/block-hash.js +7 -0
- package/dist/nano/rpc/methods/block-info.d.ts +14 -0
- package/dist/nano/rpc/methods/block-info.js +20 -0
- package/dist/nano/rpc/methods/blocks-info.d.ts +18 -0
- package/dist/nano/rpc/methods/blocks-info.js +28 -0
- package/dist/nano/rpc/methods/blocks.d.ts +13 -0
- package/dist/nano/rpc/methods/blocks.js +18 -0
- package/dist/nano/rpc/methods/bootstrap-any.d.ts +10 -0
- package/dist/nano/rpc/methods/bootstrap-any.js +7 -0
- package/dist/nano/rpc/methods/bootstrap-lazy.d.ts +10 -0
- package/dist/nano/rpc/methods/bootstrap-lazy.js +7 -0
- package/dist/nano/rpc/methods/bootstrap-priorities.d.ts +28 -0
- package/dist/nano/rpc/methods/bootstrap-priorities.js +7 -0
- package/dist/nano/rpc/methods/bootstrap-reset.d.ts +12 -0
- package/dist/nano/rpc/methods/bootstrap-reset.js +7 -0
- package/dist/nano/rpc/methods/bootstrap-status.d.ts +14 -0
- package/dist/nano/rpc/methods/bootstrap-status.js +7 -0
- package/dist/nano/rpc/methods/bootstrap.d.ts +12 -0
- package/dist/nano/rpc/methods/bootstrap.js +7 -0
- package/dist/nano/rpc/methods/chain.d.ts +20 -0
- package/dist/nano/rpc/methods/chain.js +7 -0
- package/dist/nano/rpc/methods/conditional-types/bool-flag.d.ts +1 -0
- package/dist/nano/rpc/methods/conditional-types/bool-flag.js +2 -0
- package/dist/nano/rpc/methods/conditional-types/index.d.ts +6 -0
- package/dist/nano/rpc/methods/conditional-types/index.js +22 -0
- package/dist/nano/rpc/methods/conditional-types/not-undefined-flag.d.ts +1 -0
- package/dist/nano/rpc/methods/conditional-types/not-undefined-flag.js +2 -0
- package/dist/nano/rpc/methods/conditional-types/string-flag.d.ts +1 -0
- package/dist/nano/rpc/methods/conditional-types/string-flag.js +2 -0
- package/dist/nano/rpc/methods/conditional-types/string-or-number-flag.d.ts +1 -0
- package/dist/nano/rpc/methods/conditional-types/string-or-number-flag.js +2 -0
- package/dist/nano/rpc/methods/conditional-types/threshold-flag.d.ts +1 -0
- package/dist/nano/rpc/methods/conditional-types/threshold-flag.js +2 -0
- package/dist/nano/rpc/methods/conditional-types/with-default.d.ts +5 -0
- package/dist/nano/rpc/methods/conditional-types/with-default.js +2 -0
- package/dist/nano/rpc/methods/confirmation-active.d.ts +18 -0
- package/dist/nano/rpc/methods/confirmation-active.js +7 -0
- package/dist/nano/rpc/methods/confirmation-history.d.ts +40 -0
- package/dist/nano/rpc/methods/confirmation-history.js +7 -0
- package/dist/nano/rpc/methods/confirmation-info.d.ts +15 -0
- package/dist/nano/rpc/methods/confirmation-info.js +22 -0
- package/dist/nano/rpc/methods/confirmation-quorum.d.ts +13 -0
- package/dist/nano/rpc/methods/confirmation-quorum.js +18 -0
- package/dist/nano/rpc/methods/database-txn-tracker.d.ts +36 -0
- package/dist/nano/rpc/methods/database-txn-tracker.js +7 -0
- package/dist/nano/rpc/methods/delegators-count.d.ts +14 -0
- package/dist/nano/rpc/methods/delegators-count.js +7 -0
- package/dist/nano/rpc/methods/delegators.d.ts +20 -0
- package/dist/nano/rpc/methods/delegators.js +7 -0
- package/dist/nano/rpc/methods/deterministic-key.d.ts +20 -0
- package/dist/nano/rpc/methods/deterministic-key.js +7 -0
- package/dist/nano/rpc/methods/election-statistics.d.ts +26 -0
- package/dist/nano/rpc/methods/election-statistics.js +7 -0
- package/dist/nano/rpc/methods/epoch-upgrade.d.ts +20 -0
- package/dist/nano/rpc/methods/epoch-upgrade.js +7 -0
- package/dist/nano/rpc/methods/frontier-count.d.ts +12 -0
- package/dist/nano/rpc/methods/frontier-count.js +7 -0
- package/dist/nano/rpc/methods/frontiers.d.ts +16 -0
- package/dist/nano/rpc/methods/frontiers.js +7 -0
- package/dist/nano/rpc/methods/index.d.ts +75 -0
- package/dist/nano/rpc/methods/index.js +91 -0
- package/dist/nano/rpc/methods/keepalive.d.ts +16 -0
- package/dist/nano/rpc/methods/keepalive.js +7 -0
- package/dist/nano/rpc/methods/key-create.d.ts +16 -0
- package/dist/nano/rpc/methods/key-create.js +7 -0
- package/dist/nano/rpc/methods/key-expand.d.ts +18 -0
- package/dist/nano/rpc/methods/key-expand.js +7 -0
- package/dist/nano/rpc/methods/ledger.d.ts +15 -0
- package/dist/nano/rpc/methods/ledger.js +22 -0
- package/dist/nano/rpc/methods/nano-to-raw.d.ts +14 -0
- package/dist/nano/rpc/methods/nano-to-raw.js +7 -0
- package/dist/nano/rpc/methods/node-id.d.ts +16 -0
- package/dist/nano/rpc/methods/node-id.js +7 -0
- package/dist/nano/rpc/methods/peers.d.ts +13 -0
- package/dist/nano/rpc/methods/peers.js +18 -0
- package/dist/nano/rpc/methods/populate-backlog.d.ts +12 -0
- package/dist/nano/rpc/methods/populate-backlog.js +7 -0
- package/dist/nano/rpc/methods/process.d.ts +13 -0
- package/dist/nano/rpc/methods/process.js +18 -0
- package/dist/nano/rpc/methods/raw-to-nano.d.ts +14 -0
- package/dist/nano/rpc/methods/raw-to-nano.js +7 -0
- package/dist/nano/rpc/methods/receivable-exists.d.ts +18 -0
- package/dist/nano/rpc/methods/receivable-exists.js +7 -0
- package/dist/nano/rpc/methods/receivable.d.ts +16 -0
- package/dist/nano/rpc/methods/receivable.js +22 -0
- package/dist/nano/rpc/methods/representatives-online.d.ts +13 -0
- package/dist/nano/rpc/methods/representatives-online.js +18 -0
- package/dist/nano/rpc/methods/representatives.d.ts +16 -0
- package/dist/nano/rpc/methods/representatives.js +7 -0
- package/dist/nano/rpc/methods/republish.d.ts +22 -0
- package/dist/nano/rpc/methods/republish.js +7 -0
- package/dist/nano/rpc/methods/sign.d.ts +13 -0
- package/dist/nano/rpc/methods/sign.js +18 -0
- package/dist/nano/rpc/methods/stats-clear.d.ts +12 -0
- package/dist/nano/rpc/methods/stats-clear.js +7 -0
- package/dist/nano/rpc/methods/stats.d.ts +11 -0
- package/dist/nano/rpc/methods/stats.js +18 -0
- package/dist/nano/rpc/methods/stop.d.ts +12 -0
- package/dist/nano/rpc/methods/stop.js +7 -0
- package/dist/nano/rpc/methods/successors.d.ts +20 -0
- package/dist/nano/rpc/methods/successors.js +7 -0
- package/dist/nano/rpc/methods/telemetry.d.ts +17 -0
- package/dist/nano/rpc/methods/telemetry.js +22 -0
- package/dist/nano/rpc/methods/unchecked-clear.d.ts +12 -0
- package/dist/nano/rpc/methods/unchecked-clear.js +7 -0
- package/dist/nano/rpc/methods/unchecked-get.d.ts +13 -0
- package/dist/nano/rpc/methods/unchecked-get.js +18 -0
- package/dist/nano/rpc/methods/unchecked-keys.d.ts +13 -0
- package/dist/nano/rpc/methods/unchecked-keys.js +18 -0
- package/dist/nano/rpc/methods/unchecked.d.ts +13 -0
- package/dist/nano/rpc/methods/unchecked.js +18 -0
- package/dist/nano/rpc/methods/unopened.d.ts +18 -0
- package/dist/nano/rpc/methods/unopened.js +7 -0
- package/dist/nano/rpc/methods/uptime.d.ts +12 -0
- package/dist/nano/rpc/methods/uptime.js +7 -0
- package/dist/nano/rpc/methods/validate-account-number.d.ts +14 -0
- package/dist/nano/rpc/methods/validate-account-number.js +7 -0
- package/dist/nano/rpc/methods/version.d.ts +26 -0
- package/dist/nano/rpc/methods/version.js +7 -0
- package/dist/nano/rpc/methods/work-cancel.d.ts +14 -0
- package/dist/nano/rpc/methods/work-cancel.js +7 -0
- package/dist/nano/rpc/methods/work-generate.d.ts +82 -0
- package/dist/nano/rpc/methods/work-generate.js +7 -0
- package/dist/nano/rpc/methods/work-peer-add.d.ts +16 -0
- package/dist/nano/rpc/methods/work-peer-add.js +7 -0
- package/dist/nano/rpc/methods/work-peers-clear.d.ts +12 -0
- package/dist/nano/rpc/methods/work-peers-clear.js +7 -0
- package/dist/nano/rpc/methods/work-peers.d.ts +12 -0
- package/dist/nano/rpc/methods/work-peers.js +7 -0
- package/dist/nano/rpc/methods/work-validate.d.ts +26 -0
- package/dist/nano/rpc/methods/work-validate.js +7 -0
- package/dist/nano/rpc/requests/account-balance.d.ts +7 -0
- package/dist/nano/rpc/requests/account-balance.js +13 -0
- package/dist/nano/rpc/requests/account-block-count.d.ts +6 -0
- package/dist/nano/rpc/requests/account-block-count.js +11 -0
- package/dist/nano/rpc/requests/account-get.d.ts +6 -0
- package/dist/nano/rpc/requests/account-get.js +11 -0
- package/dist/nano/rpc/requests/account-history.d.ts +13 -0
- package/dist/nano/rpc/requests/account-history.js +21 -0
- package/dist/nano/rpc/requests/account-info.d.ts +10 -0
- package/dist/nano/rpc/requests/account-info.js +16 -0
- package/dist/nano/rpc/requests/account-key.d.ts +6 -0
- package/dist/nano/rpc/requests/account-key.js +11 -0
- package/dist/nano/rpc/requests/account-representative.d.ts +6 -0
- package/dist/nano/rpc/requests/account-representative.js +11 -0
- package/dist/nano/rpc/requests/account-weight.d.ts +6 -0
- package/dist/nano/rpc/requests/account-weight.js +11 -0
- package/dist/nano/rpc/requests/accounts-balances.d.ts +7 -0
- package/dist/nano/rpc/requests/accounts-balances.js +13 -0
- package/dist/nano/rpc/requests/accounts-frontiers.d.ts +6 -0
- package/dist/nano/rpc/requests/accounts-frontiers.js +11 -0
- package/dist/nano/rpc/requests/accounts-receivable.d.ts +12 -0
- package/dist/nano/rpc/requests/accounts-receivable.js +20 -0
- package/dist/nano/rpc/requests/accounts-representatives.d.ts +6 -0
- package/dist/nano/rpc/requests/accounts-representatives.js +11 -0
- package/dist/nano/rpc/requests/available-supply.d.ts +5 -0
- package/dist/nano/rpc/requests/available-supply.js +9 -0
- package/dist/nano/rpc/requests/block-account.d.ts +6 -0
- package/dist/nano/rpc/requests/block-account.js +11 -0
- package/dist/nano/rpc/requests/block-confirm.d.ts +6 -0
- package/dist/nano/rpc/requests/block-confirm.js +11 -0
- package/dist/nano/rpc/requests/block-count.d.ts +5 -0
- package/dist/nano/rpc/requests/block-count.js +9 -0
- package/dist/nano/rpc/requests/block-create.d.ts +19 -0
- package/dist/nano/rpc/requests/block-create.js +32 -0
- package/dist/nano/rpc/requests/block-hash.d.ts +21 -0
- package/dist/nano/rpc/requests/block-hash.js +19 -0
- package/dist/nano/rpc/requests/block-info.d.ts +8 -0
- package/dist/nano/rpc/requests/block-info.js +14 -0
- package/dist/nano/rpc/requests/blocks-info.d.ts +12 -0
- package/dist/nano/rpc/requests/blocks-info.js +18 -0
- package/dist/nano/rpc/requests/blocks.d.ts +7 -0
- package/dist/nano/rpc/requests/blocks.js +13 -0
- package/dist/nano/rpc/requests/bootstrap-any.d.ts +6 -0
- package/dist/nano/rpc/requests/bootstrap-any.js +11 -0
- package/dist/nano/rpc/requests/bootstrap-lazy.d.ts +6 -0
- package/dist/nano/rpc/requests/bootstrap-lazy.js +11 -0
- package/dist/nano/rpc/requests/bootstrap-priorities.d.ts +5 -0
- package/dist/nano/rpc/requests/bootstrap-priorities.js +9 -0
- package/dist/nano/rpc/requests/bootstrap-reset.d.ts +5 -0
- package/dist/nano/rpc/requests/bootstrap-reset.js +9 -0
- package/dist/nano/rpc/requests/bootstrap-status.d.ts +5 -0
- package/dist/nano/rpc/requests/bootstrap-status.js +9 -0
- package/dist/nano/rpc/requests/bootstrap.d.ts +7 -0
- package/dist/nano/rpc/requests/bootstrap.js +13 -0
- package/dist/nano/rpc/requests/chain.d.ts +9 -0
- package/dist/nano/rpc/requests/chain.js +16 -0
- package/dist/nano/rpc/requests/confirmation-active.d.ts +6 -0
- package/dist/nano/rpc/requests/confirmation-active.js +11 -0
- package/dist/nano/rpc/requests/confirmation-history.d.ts +6 -0
- package/dist/nano/rpc/requests/confirmation-history.js +11 -0
- package/dist/nano/rpc/requests/confirmation-info.d.ts +9 -0
- package/dist/nano/rpc/requests/confirmation-info.js +15 -0
- package/dist/nano/rpc/requests/confirmation-quorum.d.ts +6 -0
- package/dist/nano/rpc/requests/confirmation-quorum.js +11 -0
- package/dist/nano/rpc/requests/database-txn-tracker.d.ts +7 -0
- package/dist/nano/rpc/requests/database-txn-tracker.js +12 -0
- package/dist/nano/rpc/requests/delegators-count.d.ts +6 -0
- package/dist/nano/rpc/requests/delegators-count.js +11 -0
- package/dist/nano/rpc/requests/delegators.d.ts +9 -0
- package/dist/nano/rpc/requests/delegators.js +16 -0
- package/dist/nano/rpc/requests/deterministic-key.d.ts +7 -0
- package/dist/nano/rpc/requests/deterministic-key.js +12 -0
- package/dist/nano/rpc/requests/election-statistics.d.ts +5 -0
- package/dist/nano/rpc/requests/election-statistics.js +9 -0
- package/dist/nano/rpc/requests/epoch-upgrade.d.ts +9 -0
- package/dist/nano/rpc/requests/epoch-upgrade.js +15 -0
- package/dist/nano/rpc/requests/frontier-count.d.ts +5 -0
- package/dist/nano/rpc/requests/frontier-count.js +9 -0
- package/dist/nano/rpc/requests/frontiers.d.ts +7 -0
- package/dist/nano/rpc/requests/frontiers.js +13 -0
- package/dist/nano/rpc/requests/index.d.ts +75 -0
- package/dist/nano/rpc/requests/index.js +91 -0
- package/dist/nano/rpc/requests/keepalive.d.ts +7 -0
- package/dist/nano/rpc/requests/keepalive.js +13 -0
- package/dist/nano/rpc/requests/key-create.d.ts +5 -0
- package/dist/nano/rpc/requests/key-create.js +9 -0
- package/dist/nano/rpc/requests/key-expand.d.ts +6 -0
- package/dist/nano/rpc/requests/key-expand.js +11 -0
- package/dist/nano/rpc/requests/ledger.d.ts +13 -0
- package/dist/nano/rpc/requests/ledger.js +22 -0
- package/dist/nano/rpc/requests/nano-to-raw.d.ts +6 -0
- package/dist/nano/rpc/requests/nano-to-raw.js +11 -0
- package/dist/nano/rpc/requests/node-id.d.ts +5 -0
- package/dist/nano/rpc/requests/node-id.js +9 -0
- package/dist/nano/rpc/requests/peers.d.ts +6 -0
- package/dist/nano/rpc/requests/peers.js +11 -0
- package/dist/nano/rpc/requests/populate-backlog.d.ts +5 -0
- package/dist/nano/rpc/requests/populate-backlog.js +9 -0
- package/dist/nano/rpc/requests/process.d.ts +27 -0
- package/dist/nano/rpc/requests/process.js +27 -0
- package/dist/nano/rpc/requests/raw-to-nano.d.ts +6 -0
- package/dist/nano/rpc/requests/raw-to-nano.js +11 -0
- package/dist/nano/rpc/requests/receivable-exists.d.ts +8 -0
- package/dist/nano/rpc/requests/receivable-exists.js +14 -0
- package/dist/nano/rpc/requests/receivable.d.ts +14 -0
- package/dist/nano/rpc/requests/receivable.js +22 -0
- package/dist/nano/rpc/requests/representatives-online.d.ts +7 -0
- package/dist/nano/rpc/requests/representatives-online.js +13 -0
- package/dist/nano/rpc/requests/representatives.d.ts +7 -0
- package/dist/nano/rpc/requests/representatives.js +13 -0
- package/dist/nano/rpc/requests/republish.d.ts +9 -0
- package/dist/nano/rpc/requests/republish.js +15 -0
- package/dist/nano/rpc/requests/sign.d.ts +55 -0
- package/dist/nano/rpc/requests/sign.js +49 -0
- package/dist/nano/rpc/requests/stats-clear.d.ts +5 -0
- package/dist/nano/rpc/requests/stats-clear.js +9 -0
- package/dist/nano/rpc/requests/stats.d.ts +6 -0
- package/dist/nano/rpc/requests/stats.js +10 -0
- package/dist/nano/rpc/requests/stop.d.ts +5 -0
- package/dist/nano/rpc/requests/stop.js +9 -0
- package/dist/nano/rpc/requests/successors.d.ts +9 -0
- package/dist/nano/rpc/requests/successors.js +16 -0
- package/dist/nano/rpc/requests/telemetry.d.ts +8 -0
- package/dist/nano/rpc/requests/telemetry.js +15 -0
- package/dist/nano/rpc/requests/unchecked-clear.d.ts +5 -0
- package/dist/nano/rpc/requests/unchecked-clear.js +9 -0
- package/dist/nano/rpc/requests/unchecked-get.d.ts +7 -0
- package/dist/nano/rpc/requests/unchecked-get.js +13 -0
- package/dist/nano/rpc/requests/unchecked-keys.d.ts +8 -0
- package/dist/nano/rpc/requests/unchecked-keys.js +15 -0
- package/dist/nano/rpc/requests/unchecked.d.ts +7 -0
- package/dist/nano/rpc/requests/unchecked.js +13 -0
- package/dist/nano/rpc/requests/unopened.d.ts +8 -0
- package/dist/nano/rpc/requests/unopened.js +15 -0
- package/dist/nano/rpc/requests/uptime.d.ts +5 -0
- package/dist/nano/rpc/requests/uptime.js +9 -0
- package/dist/nano/rpc/requests/validate-account-number.d.ts +6 -0
- package/dist/nano/rpc/requests/validate-account-number.js +10 -0
- package/dist/nano/rpc/requests/version.d.ts +5 -0
- package/dist/nano/rpc/requests/version.js +9 -0
- package/dist/nano/rpc/requests/work-cancel.d.ts +6 -0
- package/dist/nano/rpc/requests/work-cancel.js +11 -0
- package/dist/nano/rpc/requests/work-generate.d.ts +37 -0
- package/dist/nano/rpc/requests/work-generate.js +39 -0
- package/dist/nano/rpc/requests/work-peer-add.d.ts +7 -0
- package/dist/nano/rpc/requests/work-peer-add.js +13 -0
- package/dist/nano/rpc/requests/work-peers-clear.d.ts +5 -0
- package/dist/nano/rpc/requests/work-peers-clear.js +9 -0
- package/dist/nano/rpc/requests/work-peers.d.ts +5 -0
- package/dist/nano/rpc/requests/work-peers.js +9 -0
- package/dist/nano/rpc/requests/work-validate.d.ts +8 -0
- package/dist/nano/rpc/requests/work-validate.js +14 -0
- package/dist/nano/rpc/responses/account-balance.d.ts +7 -0
- package/dist/nano/rpc/responses/account-balance.js +12 -0
- package/dist/nano/rpc/responses/account-block-count.d.ts +5 -0
- package/dist/nano/rpc/responses/account-block-count.js +10 -0
- package/dist/nano/rpc/responses/account-get.d.ts +5 -0
- package/dist/nano/rpc/responses/account-get.js +10 -0
- package/dist/nano/rpc/responses/account-history.d.ts +229 -0
- package/dist/nano/rpc/responses/account-history.js +143 -0
- package/dist/nano/rpc/responses/account-info.d.ts +124 -0
- package/dist/nano/rpc/responses/account-info.js +53 -0
- package/dist/nano/rpc/responses/account-key.d.ts +5 -0
- package/dist/nano/rpc/responses/account-key.js +10 -0
- package/dist/nano/rpc/responses/account-representative.d.ts +5 -0
- package/dist/nano/rpc/responses/account-representative.js +10 -0
- package/dist/nano/rpc/responses/account-weight.d.ts +5 -0
- package/dist/nano/rpc/responses/account-weight.js +10 -0
- package/dist/nano/rpc/responses/accounts-balances.d.ts +10 -0
- package/dist/nano/rpc/responses/accounts-balances.js +17 -0
- package/dist/nano/rpc/responses/accounts-frontiers.d.ts +6 -0
- package/dist/nano/rpc/responses/accounts-frontiers.js +12 -0
- package/dist/nano/rpc/responses/accounts-receivable.d.ts +25 -0
- package/dist/nano/rpc/responses/accounts-receivable.js +28 -0
- package/dist/nano/rpc/responses/accounts-representatives.d.ts +6 -0
- package/dist/nano/rpc/responses/accounts-representatives.js +11 -0
- package/dist/nano/rpc/responses/available-supply.d.ts +5 -0
- package/dist/nano/rpc/responses/available-supply.js +10 -0
- package/dist/nano/rpc/responses/block-account.d.ts +5 -0
- package/dist/nano/rpc/responses/block-account.js +10 -0
- package/dist/nano/rpc/responses/block-confirm.d.ts +5 -0
- package/dist/nano/rpc/responses/block-confirm.js +9 -0
- package/dist/nano/rpc/responses/block-count.d.ts +7 -0
- package/dist/nano/rpc/responses/block-count.js +12 -0
- package/dist/nano/rpc/responses/block-create.d.ts +21 -0
- package/dist/nano/rpc/responses/block-create.js +20 -0
- package/dist/nano/rpc/responses/block-hash.d.ts +5 -0
- package/dist/nano/rpc/responses/block-hash.js +10 -0
- package/dist/nano/rpc/responses/block-info.d.ts +249 -0
- package/dist/nano/rpc/responses/block-info.js +41 -0
- package/dist/nano/rpc/responses/blocks-info.d.ts +26 -0
- package/dist/nano/rpc/responses/blocks-info.js +21 -0
- package/dist/nano/rpc/responses/blocks.d.ts +16 -0
- package/dist/nano/rpc/responses/blocks.js +15 -0
- package/dist/nano/rpc/responses/bootstrap-any.d.ts +3 -0
- package/dist/nano/rpc/responses/bootstrap-any.js +7 -0
- package/dist/nano/rpc/responses/bootstrap-lazy.d.ts +3 -0
- package/dist/nano/rpc/responses/bootstrap-lazy.js +7 -0
- package/dist/nano/rpc/responses/bootstrap-priorities.d.ts +13 -0
- package/dist/nano/rpc/responses/bootstrap-priorities.js +26 -0
- package/dist/nano/rpc/responses/bootstrap-reset.d.ts +5 -0
- package/dist/nano/rpc/responses/bootstrap-reset.js +9 -0
- package/dist/nano/rpc/responses/bootstrap-status.d.ts +6 -0
- package/dist/nano/rpc/responses/bootstrap-status.js +64 -0
- package/dist/nano/rpc/responses/bootstrap.d.ts +3 -0
- package/dist/nano/rpc/responses/bootstrap.js +7 -0
- package/dist/nano/rpc/responses/chain.d.ts +5 -0
- package/dist/nano/rpc/responses/chain.js +10 -0
- package/dist/nano/rpc/responses/confirmation-active.d.ts +7 -0
- package/dist/nano/rpc/responses/confirmation-active.js +13 -0
- package/dist/nano/rpc/responses/confirmation-history.d.ts +18 -0
- package/dist/nano/rpc/responses/confirmation-history.js +30 -0
- package/dist/nano/rpc/responses/confirmation-info.d.ts +52 -0
- package/dist/nano/rpc/responses/confirmation-info.js +39 -0
- package/dist/nano/rpc/responses/confirmation-quorum.d.ts +27 -0
- package/dist/nano/rpc/responses/confirmation-quorum.js +25 -0
- package/dist/nano/rpc/responses/database-txn-tracker.d.ts +15 -0
- package/dist/nano/rpc/responses/database-txn-tracker.js +24 -0
- package/dist/nano/rpc/responses/delegators-count.d.ts +5 -0
- package/dist/nano/rpc/responses/delegators-count.js +10 -0
- package/dist/nano/rpc/responses/delegators.d.ts +5 -0
- package/dist/nano/rpc/responses/delegators.js +11 -0
- package/dist/nano/rpc/responses/deterministic-key.d.ts +7 -0
- package/dist/nano/rpc/responses/deterministic-key.js +14 -0
- package/dist/nano/rpc/responses/election-statistics.d.ts +12 -0
- package/dist/nano/rpc/responses/election-statistics.js +19 -0
- package/dist/nano/rpc/responses/epoch-upgrade.d.ts +5 -0
- package/dist/nano/rpc/responses/epoch-upgrade.js +10 -0
- package/dist/nano/rpc/responses/error-response.d.ts +5 -0
- package/dist/nano/rpc/responses/error-response.js +11 -0
- package/dist/nano/rpc/responses/frontier-count.d.ts +5 -0
- package/dist/nano/rpc/responses/frontier-count.js +10 -0
- package/dist/nano/rpc/responses/frontiers.d.ts +5 -0
- package/dist/nano/rpc/responses/frontiers.js +11 -0
- package/dist/nano/rpc/responses/index.d.ts +75 -0
- package/dist/nano/rpc/responses/index.js +91 -0
- package/dist/nano/rpc/responses/keepalive.d.ts +5 -0
- package/dist/nano/rpc/responses/keepalive.js +9 -0
- package/dist/nano/rpc/responses/key-create.d.ts +7 -0
- package/dist/nano/rpc/responses/key-create.js +14 -0
- package/dist/nano/rpc/responses/key-expand.d.ts +7 -0
- package/dist/nano/rpc/responses/key-expand.js +14 -0
- package/dist/nano/rpc/responses/ledger.d.ts +75 -0
- package/dist/nano/rpc/responses/ledger.js +37 -0
- package/dist/nano/rpc/responses/nano-to-raw.d.ts +5 -0
- package/dist/nano/rpc/responses/nano-to-raw.js +10 -0
- package/dist/nano/rpc/responses/node-id.d.ts +7 -0
- package/dist/nano/rpc/responses/node-id.js +14 -0
- package/dist/nano/rpc/responses/peers.d.ts +22 -0
- package/dist/nano/rpc/responses/peers.js +21 -0
- package/dist/nano/rpc/responses/populate-backlog.d.ts +5 -0
- package/dist/nano/rpc/responses/populate-backlog.js +9 -0
- package/dist/nano/rpc/responses/process.d.ts +15 -0
- package/dist/nano/rpc/responses/process.js +14 -0
- package/dist/nano/rpc/responses/raw-to-nano.d.ts +5 -0
- package/dist/nano/rpc/responses/raw-to-nano.js +10 -0
- package/dist/nano/rpc/responses/receivable-exists.d.ts +5 -0
- package/dist/nano/rpc/responses/receivable-exists.js +13 -0
- package/dist/nano/rpc/responses/receivable.d.ts +34 -0
- package/dist/nano/rpc/responses/receivable.js +42 -0
- package/dist/nano/rpc/responses/representatives-online.d.ts +21 -0
- package/dist/nano/rpc/responses/representatives-online.js +19 -0
- package/dist/nano/rpc/responses/representatives.d.ts +5 -0
- package/dist/nano/rpc/responses/representatives.js +11 -0
- package/dist/nano/rpc/responses/republish.d.ts +6 -0
- package/dist/nano/rpc/responses/republish.js +11 -0
- package/dist/nano/rpc/responses/sign.d.ts +17 -0
- package/dist/nano/rpc/responses/sign.js +16 -0
- package/dist/nano/rpc/responses/stats-clear.d.ts +5 -0
- package/dist/nano/rpc/responses/stats-clear.js +9 -0
- package/dist/nano/rpc/responses/stats.d.ts +71 -0
- package/dist/nano/rpc/responses/stats.js +61 -0
- package/dist/nano/rpc/responses/stop.d.ts +5 -0
- package/dist/nano/rpc/responses/stop.js +9 -0
- package/dist/nano/rpc/responses/successors.d.ts +5 -0
- package/dist/nano/rpc/responses/successors.js +10 -0
- package/dist/nano/rpc/responses/telemetry.d.ts +61 -0
- package/dist/nano/rpc/responses/telemetry.js +54 -0
- package/dist/nano/rpc/responses/unchecked-clear.d.ts +5 -0
- package/dist/nano/rpc/responses/unchecked-clear.js +9 -0
- package/dist/nano/rpc/responses/unchecked-get.d.ts +18 -0
- package/dist/nano/rpc/responses/unchecked-get.js +17 -0
- package/dist/nano/rpc/responses/unchecked-keys.d.ts +33 -0
- package/dist/nano/rpc/responses/unchecked-keys.js +30 -0
- package/dist/nano/rpc/responses/unchecked.d.ts +16 -0
- package/dist/nano/rpc/responses/unchecked.js +15 -0
- package/dist/nano/rpc/responses/unopened.d.ts +5 -0
- package/dist/nano/rpc/responses/unopened.js +11 -0
- package/dist/nano/rpc/responses/uptime.d.ts +5 -0
- package/dist/nano/rpc/responses/uptime.js +13 -0
- package/dist/nano/rpc/responses/validate-account-number.d.ts +5 -0
- package/dist/nano/rpc/responses/validate-account-number.js +10 -0
- package/dist/nano/rpc/responses/version.d.ts +12 -0
- package/dist/nano/rpc/responses/version.js +21 -0
- package/dist/nano/rpc/responses/work-cancel.d.ts +5 -0
- package/dist/nano/rpc/responses/work-cancel.js +9 -0
- package/dist/nano/rpc/responses/work-generate.d.ts +8 -0
- package/dist/nano/rpc/responses/work-generate.js +16 -0
- package/dist/nano/rpc/responses/work-peer-add.d.ts +5 -0
- package/dist/nano/rpc/responses/work-peer-add.js +9 -0
- package/dist/nano/rpc/responses/work-peers-clear.d.ts +5 -0
- package/dist/nano/rpc/responses/work-peers-clear.js +9 -0
- package/dist/nano/rpc/responses/work-peers.d.ts +5 -0
- package/dist/nano/rpc/responses/work-peers.js +9 -0
- package/dist/nano/rpc/responses/work-validate.d.ts +9 -0
- package/dist/nano/rpc/responses/work-validate.js +16 -0
- package/dist/nano/types/account.d.ts +10 -0
- package/dist/nano/types/account.js +49 -0
- package/dist/nano/types/amount.d.ts +25 -0
- package/dist/nano/types/amount.js +103 -0
- package/dist/nano/types/binary-boolean-string.d.ts +3 -0
- package/dist/nano/types/binary-boolean-string.js +6 -0
- package/dist/nano/types/boolean-distribution.d.ts +1 -0
- package/dist/nano/types/boolean-distribution.js +2 -0
- package/dist/nano/types/boolean-option.d.ts +1 -0
- package/dist/nano/types/boolean-option.js +2 -0
- package/dist/nano/types/boolean.d.ts +3 -0
- package/dist/nano/types/boolean.js +6 -0
- package/dist/nano/types/byte-array.d.ts +3 -0
- package/dist/nano/types/byte-array.js +9 -0
- package/dist/nano/types/endpoint.d.ts +3 -0
- package/dist/nano/types/endpoint.js +54 -0
- package/dist/nano/types/hash.d.ts +6 -0
- package/dist/nano/types/hash.js +9 -0
- package/dist/nano/types/height.d.ts +9 -0
- package/dist/nano/types/height.js +17 -0
- package/dist/nano/types/hex.d.ts +3 -0
- package/dist/nano/types/hex.js +6 -0
- package/dist/nano/types/index.d.ts +24 -0
- package/dist/nano/types/index.js +77 -0
- package/dist/nano/types/int.d.ts +9 -0
- package/dist/nano/types/int.js +20 -0
- package/dist/nano/types/link.d.ts +3 -0
- package/dist/nano/types/link.js +7 -0
- package/dist/nano/types/lowercase-keys.d.ts +3 -0
- package/dist/nano/types/lowercase-keys.js +2 -0
- package/dist/nano/types/nacl.d.ts +32 -0
- package/dist/nano/types/nacl.js +895 -0
- package/dist/nano/types/node-id.d.ts +3 -0
- package/dist/nano/types/node-id.js +6 -0
- package/dist/nano/types/non-throwing.d.ts +3 -0
- package/dist/nano/types/non-throwing.js +2 -0
- package/dist/nano/types/number.d.ts +3 -0
- package/dist/nano/types/number.js +18 -0
- package/dist/nano/types/port.d.ts +9 -0
- package/dist/nano/types/port.js +17 -0
- package/dist/nano/types/private-key.d.ts +6 -0
- package/dist/nano/types/private-key.js +9 -0
- package/dist/nano/types/public-key.d.ts +6 -0
- package/dist/nano/types/public-key.js +9 -0
- package/dist/nano/types/result.d.ts +16 -0
- package/dist/nano/types/result.js +2 -0
- package/dist/nano/types/root.d.ts +6 -0
- package/dist/nano/types/root.js +9 -0
- package/dist/nano/types/seed.d.ts +9 -0
- package/dist/nano/types/seed.js +13 -0
- package/dist/nano/types/signature.d.ts +6 -0
- package/dist/nano/types/signature.js +9 -0
- package/dist/nano/types/subtype.d.ts +5 -0
- package/dist/nano/types/subtype.js +8 -0
- package/dist/nano/types/throwing.d.ts +3 -0
- package/dist/nano/types/throwing.js +2 -0
- package/dist/nano/types/timestamp.d.ts +11 -0
- package/dist/nano/types/timestamp.js +19 -0
- package/dist/nano/types/type.d.ts +13 -0
- package/dist/nano/types/type.js +20 -0
- package/dist/nano/types/uint.d.ts +9 -0
- package/dist/nano/types/uint.js +20 -0
- package/dist/nano/types/uppercase-keys.d.ts +3 -0
- package/dist/nano/types/uppercase-keys.js +2 -0
- package/dist/nano/types/work-difficulty.d.ts +3 -0
- package/dist/nano/types/work-difficulty.js +6 -0
- package/dist/nano/types/work.d.ts +6 -0
- package/dist/nano/types/work.js +9 -0
- package/dist/nano/web-socket/client/index.d.ts +1 -0
- package/dist/nano/web-socket/client/index.js +17 -0
- package/dist/nano/web-socket/client/web-socket-client.d.ts +334 -0
- package/dist/nano/web-socket/client/web-socket-client.js +630 -0
- package/dist/nano/web-socket/index.d.ts +4 -0
- package/dist/nano/web-socket/index.js +20 -0
- package/dist/nano/web-socket/requests/ack.d.ts +7 -0
- package/dist/nano/web-socket/requests/ack.js +12 -0
- package/dist/nano/web-socket/requests/bootstrap.d.ts +8 -0
- package/dist/nano/web-socket/requests/bootstrap.js +11 -0
- package/dist/nano/web-socket/requests/confirmation.d.ts +20 -0
- package/dist/nano/web-socket/requests/confirmation.js +28 -0
- package/dist/nano/web-socket/requests/index.d.ts +10 -0
- package/dist/nano/web-socket/requests/index.js +26 -0
- package/dist/nano/web-socket/requests/new-unconfirmed-block.d.ts +8 -0
- package/dist/nano/web-socket/requests/new-unconfirmed-block.js +11 -0
- package/dist/nano/web-socket/requests/ping.d.ts +7 -0
- package/dist/nano/web-socket/requests/ping.js +9 -0
- package/dist/nano/web-socket/requests/started-election.d.ts +8 -0
- package/dist/nano/web-socket/requests/started-election.js +11 -0
- package/dist/nano/web-socket/requests/stopped-election.d.ts +8 -0
- package/dist/nano/web-socket/requests/stopped-election.js +11 -0
- package/dist/nano/web-socket/requests/telemetry.d.ts +8 -0
- package/dist/nano/web-socket/requests/telemetry.js +11 -0
- package/dist/nano/web-socket/requests/vote.d.ts +13 -0
- package/dist/nano/web-socket/requests/vote.js +20 -0
- package/dist/nano/web-socket/requests/work.d.ts +8 -0
- package/dist/nano/web-socket/requests/work.js +11 -0
- package/dist/nano/web-socket/responses/ack.d.ts +7 -0
- package/dist/nano/web-socket/responses/ack.js +12 -0
- package/dist/nano/web-socket/responses/bootstrap.d.ts +29 -0
- package/dist/nano/web-socket/responses/bootstrap.js +27 -0
- package/dist/nano/web-socket/responses/confirmation.d.ts +208 -0
- package/dist/nano/web-socket/responses/confirmation.js +72 -0
- package/dist/nano/web-socket/responses/index.d.ts +14 -0
- package/dist/nano/web-socket/responses/index.js +30 -0
- package/dist/nano/web-socket/responses/new-unconfirmed-block.d.ts +84 -0
- package/dist/nano/web-socket/responses/new-unconfirmed-block.js +29 -0
- package/dist/nano/web-socket/responses/pong-ack-response.d.ts +7 -0
- package/dist/nano/web-socket/responses/pong-ack-response.js +11 -0
- package/dist/nano/web-socket/responses/started-election.d.ts +13 -0
- package/dist/nano/web-socket/responses/started-election.js +16 -0
- package/dist/nano/web-socket/responses/stopped-election.d.ts +13 -0
- package/dist/nano/web-socket/responses/stopped-election.js +16 -0
- package/dist/nano/web-socket/responses/subscribe-ack-response.d.ts +7 -0
- package/dist/nano/web-socket/responses/subscribe-ack-response.js +11 -0
- package/dist/nano/web-socket/responses/telemetry.d.ts +51 -0
- package/dist/nano/web-socket/responses/telemetry.js +41 -0
- package/dist/nano/web-socket/responses/topic.d.ts +6 -0
- package/dist/nano/web-socket/responses/topic.js +11 -0
- package/dist/nano/web-socket/responses/unsubscribe-ack-response.d.ts +7 -0
- package/dist/nano/web-socket/responses/unsubscribe-ack-response.js +11 -0
- package/dist/nano/web-socket/responses/update-ack-response.d.ts +7 -0
- package/dist/nano/web-socket/responses/update-ack-response.js +11 -0
- package/dist/nano/web-socket/responses/vote.d.ts +25 -0
- package/dist/nano/web-socket/responses/vote.js +26 -0
- package/dist/nano/web-socket/responses/work.d.ts +43 -0
- package/dist/nano/web-socket/responses/work.js +38 -0
- package/dist/nano/web-socket/types/ack.d.ts +3 -0
- package/dist/nano/web-socket/types/ack.js +7 -0
- package/dist/nano/web-socket/types/action.d.ts +3 -0
- package/dist/nano/web-socket/types/action.js +6 -0
- package/dist/nano/web-socket/types/confirmation-type.d.ts +3 -0
- package/dist/nano/web-socket/types/confirmation-type.js +11 -0
- package/dist/nano/web-socket/types/index.d.ts +5 -0
- package/dist/nano/web-socket/types/index.js +21 -0
- package/dist/nano/web-socket/types/topic.d.ts +3 -0
- package/dist/nano/web-socket/types/topic.js +14 -0
- package/dist/nano/web-socket/types/vote-type.d.ts +3 -0
- package/dist/nano/web-socket/types/vote-type.js +13 -0
- package/package.json +84 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.workToBytes = workToBytes;
|
|
4
|
+
exports.bytesToWork = bytesToWork;
|
|
5
|
+
const work_1 = require("../../types/work");
|
|
6
|
+
const hex_converter_1 = require("./hex-converter");
|
|
7
|
+
function workToBytesThrowing(params) {
|
|
8
|
+
const validatedWork = (0, work_1.WorkString)().safeParse(params.work);
|
|
9
|
+
if (!validatedWork.success) {
|
|
10
|
+
throw new Error("Invalid work value.");
|
|
11
|
+
}
|
|
12
|
+
return (0, hex_converter_1.hexToBytes)({ hex: validatedWork.data, throwOnError: true });
|
|
13
|
+
}
|
|
14
|
+
function workToBytesNonThrowing(params) {
|
|
15
|
+
try {
|
|
16
|
+
return {
|
|
17
|
+
success: true,
|
|
18
|
+
data: workToBytesThrowing({ ...params, throwOnError: true }),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
return {
|
|
23
|
+
success: false,
|
|
24
|
+
error: e instanceof Error ? e : new Error("Unexpected error."),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function workToBytes(params) {
|
|
29
|
+
if (params.throwOnError === false) {
|
|
30
|
+
return workToBytesNonThrowing({ ...params, throwOnError: false });
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
return workToBytesThrowing({ ...params, throwOnError: true });
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function bytesToWorkThrowing(params) {
|
|
37
|
+
const hexResult = (0, hex_converter_1.bytesToHex)({ bytes: params.workBytes, throwOnError: true });
|
|
38
|
+
const workResult = (0, work_1.WorkString)().safeParse(hexResult);
|
|
39
|
+
if (!workResult.success) {
|
|
40
|
+
throw new Error("Invalid work byte array.");
|
|
41
|
+
}
|
|
42
|
+
return workResult.data;
|
|
43
|
+
}
|
|
44
|
+
function bytesToWorkNonThrowing(params) {
|
|
45
|
+
try {
|
|
46
|
+
return {
|
|
47
|
+
success: true,
|
|
48
|
+
data: bytesToWorkThrowing({ ...params, throwOnError: true }),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
catch (e) {
|
|
52
|
+
return {
|
|
53
|
+
success: false,
|
|
54
|
+
error: e instanceof Error ? e : new Error("Unexpected error."),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function bytesToWork(params) {
|
|
59
|
+
if (params.throwOnError === false) {
|
|
60
|
+
return bytesToWorkNonThrowing({ ...params, throwOnError: false });
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
return bytesToWorkThrowing({ ...params, throwOnError: true });
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AccountString } from "../types/account";
|
|
2
|
+
import { LinkString } from "../types/link";
|
|
3
|
+
import { NonThrowing } from "../types/non-throwing";
|
|
4
|
+
import { Result } from "../types/result";
|
|
5
|
+
import { Throwing } from "../types/throwing";
|
|
6
|
+
type DeriveAccountFromLinkParams = {
|
|
7
|
+
link: LinkString;
|
|
8
|
+
} & (Throwing | NonThrowing);
|
|
9
|
+
export declare function deriveAccountFromLink(params: DeriveAccountFromLinkParams & NonThrowing): Result<AccountString>;
|
|
10
|
+
export declare function deriveAccountFromLink(params: DeriveAccountFromLinkParams & Throwing): AccountString;
|
|
11
|
+
export declare function deriveAccountFromLink(params: DeriveAccountFromLinkParams): AccountString | Result<AccountString>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deriveAccountFromLink = deriveAccountFromLink;
|
|
4
|
+
const public_key_1 = require("../types/public-key");
|
|
5
|
+
const derive_account_from_public_key_1 = require("./derive-account-from-public-key");
|
|
6
|
+
function deriveAccountFromLinkThrowing(params) {
|
|
7
|
+
const publicKeyResult = (0, public_key_1.PublicKeyString)().safeParse(params.link);
|
|
8
|
+
if (!publicKeyResult.success) {
|
|
9
|
+
throw new Error("Invalid link: cannot convert to public key.");
|
|
10
|
+
}
|
|
11
|
+
return (0, derive_account_from_public_key_1.deriveAccountFromPublicKey)({ publicKey: publicKeyResult.data, throwOnError: true });
|
|
12
|
+
}
|
|
13
|
+
function deriveAccountFromLinkNonThrowing(params) {
|
|
14
|
+
try {
|
|
15
|
+
return {
|
|
16
|
+
success: true,
|
|
17
|
+
data: deriveAccountFromLinkThrowing({ ...params, throwOnError: true }),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
catch (e) {
|
|
21
|
+
return {
|
|
22
|
+
success: false,
|
|
23
|
+
error: e instanceof Error ? e : new Error("Unexpected error."),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function deriveAccountFromLink(params) {
|
|
28
|
+
if (params.throwOnError === false) {
|
|
29
|
+
return deriveAccountFromLinkNonThrowing({ ...params, throwOnError: false });
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
return deriveAccountFromLinkThrowing({ ...params, throwOnError: true });
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AccountString } from "../types/account";
|
|
2
|
+
import { NonThrowing } from "../types/non-throwing";
|
|
3
|
+
import { PrivateKeyString } from "../types/private-key";
|
|
4
|
+
import { Result } from "../types/result";
|
|
5
|
+
import { Throwing } from "../types/throwing";
|
|
6
|
+
type DeriveAccountFromPrivateKeyParams = {
|
|
7
|
+
privateKey: PrivateKeyString;
|
|
8
|
+
} & (Throwing | NonThrowing);
|
|
9
|
+
export declare function deriveAccountFromPrivateKey(params: DeriveAccountFromPrivateKeyParams & NonThrowing): Result<AccountString>;
|
|
10
|
+
export declare function deriveAccountFromPrivateKey(params: DeriveAccountFromPrivateKeyParams & Throwing): AccountString;
|
|
11
|
+
export declare function deriveAccountFromPrivateKey(params: DeriveAccountFromPrivateKeyParams): AccountString | Result<AccountString>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deriveAccountFromPrivateKey = deriveAccountFromPrivateKey;
|
|
4
|
+
const derive_account_from_public_key_1 = require("./derive-account-from-public-key");
|
|
5
|
+
const derive_public_key_from_private_key_1 = require("./derive-public-key-from-private-key");
|
|
6
|
+
function deriveAccountFromPrivateKeyThrowing(params) {
|
|
7
|
+
const publicKey = (0, derive_public_key_from_private_key_1.derivePublicKeyFromPrivateKey)({ privateKey: params.privateKey, throwOnError: true });
|
|
8
|
+
return (0, derive_account_from_public_key_1.deriveAccountFromPublicKey)({ publicKey, throwOnError: true });
|
|
9
|
+
}
|
|
10
|
+
function deriveAccountFromPrivateKeyNonThrowing(params) {
|
|
11
|
+
try {
|
|
12
|
+
return {
|
|
13
|
+
success: true,
|
|
14
|
+
data: deriveAccountFromPrivateKeyThrowing({ ...params, throwOnError: true }),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
catch (e) {
|
|
18
|
+
return {
|
|
19
|
+
success: false,
|
|
20
|
+
error: e instanceof Error ? e : new Error("Unexpected error."),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function deriveAccountFromPrivateKey(params) {
|
|
25
|
+
if (params.throwOnError === false) {
|
|
26
|
+
return deriveAccountFromPrivateKeyNonThrowing({ ...params, throwOnError: false });
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
return deriveAccountFromPrivateKeyThrowing({ ...params, throwOnError: true });
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AccountPrefix, AccountString } from "../types/account";
|
|
2
|
+
import { NonThrowing } from "../types/non-throwing";
|
|
3
|
+
import { PublicKeyString } from "../types/public-key";
|
|
4
|
+
import { Result } from "../types/result";
|
|
5
|
+
import { Throwing } from "../types/throwing";
|
|
6
|
+
type DeriveAccountFromPublicKeyParams = {
|
|
7
|
+
publicKey: PublicKeyString;
|
|
8
|
+
accountPrefix?: AccountPrefix;
|
|
9
|
+
} & (Throwing | NonThrowing);
|
|
10
|
+
export declare function deriveAccountFromPublicKey(params: DeriveAccountFromPublicKeyParams & NonThrowing): Result<AccountString>;
|
|
11
|
+
export declare function deriveAccountFromPublicKey(params: DeriveAccountFromPublicKeyParams & Throwing): AccountString;
|
|
12
|
+
export declare function deriveAccountFromPublicKey(params: DeriveAccountFromPublicKeyParams): AccountString | Result<AccountString>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deriveAccountFromPublicKey = deriveAccountFromPublicKey;
|
|
4
|
+
const blakejs_1 = require("blakejs");
|
|
5
|
+
const account_1 = require("../types/account");
|
|
6
|
+
const public_key_1 = require("../types/public-key");
|
|
7
|
+
const base32_converter_1 = require("./conversion/base32-converter");
|
|
8
|
+
const public_key_converter_1 = require("./conversion/public-key-converter");
|
|
9
|
+
function deriveAccountFromPublicKeyThrowing(params) {
|
|
10
|
+
const validatedPublicKey = (0, public_key_1.PublicKeyString)().safeParse(params.publicKey);
|
|
11
|
+
if (!validatedPublicKey.success) {
|
|
12
|
+
throw new Error("Invalid public key value.");
|
|
13
|
+
}
|
|
14
|
+
const accountPrefix = params.accountPrefix ?? "nano_";
|
|
15
|
+
const validatedAccountPrefix = (0, account_1.AccountPrefix)({ prefix: accountPrefix }).safeParse(accountPrefix);
|
|
16
|
+
if (!validatedAccountPrefix.success) {
|
|
17
|
+
throw new Error("Invalid account prefix value.");
|
|
18
|
+
}
|
|
19
|
+
const publicKeyBytes = (0, public_key_converter_1.publicKeyToBytes)({ publicKey: validatedPublicKey.data, throwOnError: true });
|
|
20
|
+
let checksumBytes;
|
|
21
|
+
try {
|
|
22
|
+
checksumBytes = (0, blakejs_1.blake2b)(publicKeyBytes, undefined, 5).reverse();
|
|
23
|
+
}
|
|
24
|
+
catch (_err) {
|
|
25
|
+
throw new Error("Failed to determine checksum bytes.");
|
|
26
|
+
}
|
|
27
|
+
const encodedPublicKey = (0, base32_converter_1.encodeBase32)({ bytes: publicKeyBytes, throwOnError: true });
|
|
28
|
+
const encodedChecksum = (0, base32_converter_1.encodeBase32)({ bytes: checksumBytes, throwOnError: true });
|
|
29
|
+
const accountResult = (0, account_1.AccountString)().safeParse(validatedAccountPrefix.data + encodedPublicKey + encodedChecksum);
|
|
30
|
+
if (!accountResult.success) {
|
|
31
|
+
throw new Error("Failed to derive account from public key.");
|
|
32
|
+
}
|
|
33
|
+
return accountResult.data;
|
|
34
|
+
}
|
|
35
|
+
function deriveAccountFromPublicKeyNonThrowing(params) {
|
|
36
|
+
try {
|
|
37
|
+
return {
|
|
38
|
+
success: true,
|
|
39
|
+
data: deriveAccountFromPublicKeyThrowing({ ...params, throwOnError: true }),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
catch (e) {
|
|
43
|
+
return {
|
|
44
|
+
success: false,
|
|
45
|
+
error: e instanceof Error ? e : new Error("Unexpected error."),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function deriveAccountFromPublicKey(params) {
|
|
50
|
+
if (params.throwOnError === false) {
|
|
51
|
+
return deriveAccountFromPublicKeyNonThrowing({ ...params, throwOnError: false });
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
return deriveAccountFromPublicKeyThrowing({ ...params, throwOnError: true });
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { NonThrowing } from "../types/non-throwing";
|
|
2
|
+
import { PrivateKeyString } from "../types/private-key";
|
|
3
|
+
import { Result } from "../types/result";
|
|
4
|
+
import { SeedIndex, SeedString } from "../types/seed";
|
|
5
|
+
import { Throwing } from "../types/throwing";
|
|
6
|
+
type DerivePrivateKeyFromSeedParams = {
|
|
7
|
+
seed: SeedString;
|
|
8
|
+
seedIndex: SeedIndex;
|
|
9
|
+
} & (Throwing | NonThrowing);
|
|
10
|
+
export declare function derivePrivateKeyFromSeed(params: DerivePrivateKeyFromSeedParams & NonThrowing): Result<PrivateKeyString>;
|
|
11
|
+
export declare function derivePrivateKeyFromSeed(params: DerivePrivateKeyFromSeedParams & Throwing): PrivateKeyString;
|
|
12
|
+
export declare function derivePrivateKeyFromSeed(params: DerivePrivateKeyFromSeedParams): PrivateKeyString | Result<PrivateKeyString>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.derivePrivateKeyFromSeed = derivePrivateKeyFromSeed;
|
|
4
|
+
const blakejs_1 = require("blakejs");
|
|
5
|
+
const seed_1 = require("../types/seed");
|
|
6
|
+
const hex_converter_1 = require("./conversion/hex-converter");
|
|
7
|
+
const private_key_converter_1 = require("./conversion/private-key-converter");
|
|
8
|
+
function derivePrivateKeyFromSeedThrowing(params) {
|
|
9
|
+
const validatedSeed = (0, seed_1.SeedString)().safeParse(params.seed);
|
|
10
|
+
if (!validatedSeed.success) {
|
|
11
|
+
throw new Error("Invalid seed value.");
|
|
12
|
+
}
|
|
13
|
+
const validatedIndex = (0, seed_1.SeedIndex)().safeParse(params.seedIndex);
|
|
14
|
+
if (!validatedIndex.success) {
|
|
15
|
+
throw new Error("Invalid seed index.");
|
|
16
|
+
}
|
|
17
|
+
const seedBytes = (0, hex_converter_1.hexToBytes)({ hex: validatedSeed.data, throwOnError: true });
|
|
18
|
+
let privateKeyBytes;
|
|
19
|
+
try {
|
|
20
|
+
const indexBuffer = new ArrayBuffer(4);
|
|
21
|
+
const indexDataView = new DataView(indexBuffer);
|
|
22
|
+
indexDataView.setUint32(0, validatedIndex.data);
|
|
23
|
+
const indexBytes = new Uint8Array(indexBuffer);
|
|
24
|
+
const hashContext = (0, blakejs_1.blake2bInit)(32);
|
|
25
|
+
(0, blakejs_1.blake2bUpdate)(hashContext, seedBytes);
|
|
26
|
+
(0, blakejs_1.blake2bUpdate)(hashContext, indexBytes);
|
|
27
|
+
privateKeyBytes = (0, blakejs_1.blake2bFinal)(hashContext);
|
|
28
|
+
}
|
|
29
|
+
catch (_err) {
|
|
30
|
+
throw new Error("Failed to derive private key bytes from seed.");
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
return (0, private_key_converter_1.bytesToPrivateKey)({ privateKeyBytes, throwOnError: true });
|
|
34
|
+
}
|
|
35
|
+
catch (_err) {
|
|
36
|
+
throw new Error("Derived private key is invalid.");
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function derivePrivateKeyFromSeedNonThrowing(params) {
|
|
40
|
+
try {
|
|
41
|
+
return {
|
|
42
|
+
success: true,
|
|
43
|
+
data: derivePrivateKeyFromSeedThrowing({ ...params, throwOnError: true }),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
catch (e) {
|
|
47
|
+
return {
|
|
48
|
+
success: false,
|
|
49
|
+
error: e instanceof Error ? e : new Error("Unexpected error."),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function derivePrivateKeyFromSeed(params) {
|
|
54
|
+
if (params.throwOnError === false) {
|
|
55
|
+
return derivePrivateKeyFromSeedNonThrowing({ ...params, throwOnError: false });
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
return derivePrivateKeyFromSeedThrowing({ ...params, throwOnError: true });
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AccountString } from "../types/account";
|
|
2
|
+
import { NonThrowing } from "../types/non-throwing";
|
|
3
|
+
import { PublicKeyString } from "../types/public-key";
|
|
4
|
+
import { Result } from "../types/result";
|
|
5
|
+
import { Throwing } from "../types/throwing";
|
|
6
|
+
type DerivePublicKeyFromAccountParams = {
|
|
7
|
+
account: AccountString;
|
|
8
|
+
} & (Throwing | NonThrowing);
|
|
9
|
+
export declare function derivePublicKeyFromAccount(params: DerivePublicKeyFromAccountParams & NonThrowing): Result<PublicKeyString>;
|
|
10
|
+
export declare function derivePublicKeyFromAccount(params: DerivePublicKeyFromAccountParams & Throwing): PublicKeyString;
|
|
11
|
+
export declare function derivePublicKeyFromAccount(params: DerivePublicKeyFromAccountParams): PublicKeyString | Result<PublicKeyString>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.derivePublicKeyFromAccount = derivePublicKeyFromAccount;
|
|
4
|
+
const account_1 = require("../types/account");
|
|
5
|
+
const account_converter_1 = require("./conversion/account-converter");
|
|
6
|
+
const public_key_converter_1 = require("./conversion/public-key-converter");
|
|
7
|
+
function derivePublicKeyFromAccountThrowing(params) {
|
|
8
|
+
const validatedAccount = (0, account_1.AccountString)().safeParse(params.account);
|
|
9
|
+
if (!validatedAccount.success) {
|
|
10
|
+
throw new Error("Invalid account value.");
|
|
11
|
+
}
|
|
12
|
+
const publicKeyBytes = (0, account_converter_1.accountToBytes)({ account: validatedAccount.data, throwOnError: true });
|
|
13
|
+
try {
|
|
14
|
+
return (0, public_key_converter_1.bytesToPublicKey)({ publicKeyBytes, throwOnError: true });
|
|
15
|
+
}
|
|
16
|
+
catch (_err) {
|
|
17
|
+
throw new Error("Failed to derive public key from account.");
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function derivePublicKeyFromAccountNonThrowing(params) {
|
|
21
|
+
try {
|
|
22
|
+
return {
|
|
23
|
+
success: true,
|
|
24
|
+
data: derivePublicKeyFromAccountThrowing({ ...params, throwOnError: true }),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
catch (e) {
|
|
28
|
+
return {
|
|
29
|
+
success: false,
|
|
30
|
+
error: e instanceof Error ? e : new Error("Unexpected error."),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function derivePublicKeyFromAccount(params) {
|
|
35
|
+
if (params.throwOnError === false) {
|
|
36
|
+
return derivePublicKeyFromAccountNonThrowing({ ...params, throwOnError: false });
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
return derivePublicKeyFromAccountThrowing({ ...params, throwOnError: true });
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { NonThrowing } from "../types/non-throwing";
|
|
2
|
+
import { PrivateKeyString } from "../types/private-key";
|
|
3
|
+
import { PublicKeyString } from "../types/public-key";
|
|
4
|
+
import { Result } from "../types/result";
|
|
5
|
+
import { Throwing } from "../types/throwing";
|
|
6
|
+
type DerivePublicKeyFromPrivateKeyParams = {
|
|
7
|
+
privateKey: PrivateKeyString;
|
|
8
|
+
} & (Throwing | NonThrowing);
|
|
9
|
+
export declare function derivePublicKeyFromPrivateKey(params: DerivePublicKeyFromPrivateKeyParams & NonThrowing): Result<PublicKeyString>;
|
|
10
|
+
export declare function derivePublicKeyFromPrivateKey(params: DerivePublicKeyFromPrivateKeyParams & Throwing): PublicKeyString;
|
|
11
|
+
export declare function derivePublicKeyFromPrivateKey(params: DerivePublicKeyFromPrivateKeyParams): PublicKeyString | Result<PublicKeyString>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.derivePublicKeyFromPrivateKey = derivePublicKeyFromPrivateKey;
|
|
4
|
+
const nacl_1 = require("../types/nacl");
|
|
5
|
+
const private_key_1 = require("../types/private-key");
|
|
6
|
+
const private_key_converter_1 = require("./conversion/private-key-converter");
|
|
7
|
+
const public_key_converter_1 = require("./conversion/public-key-converter");
|
|
8
|
+
function derivePublicKeyFromPrivateKeyThrowing(params) {
|
|
9
|
+
const validatedPrivateKey = (0, private_key_1.PrivateKeyString)().safeParse(params.privateKey);
|
|
10
|
+
if (!validatedPrivateKey.success) {
|
|
11
|
+
throw new Error("Invalid private key value.");
|
|
12
|
+
}
|
|
13
|
+
const privateKeyBytes = (0, private_key_converter_1.privateKeyToBytes)({ privateKey: validatedPrivateKey.data, throwOnError: true });
|
|
14
|
+
try {
|
|
15
|
+
return (0, public_key_converter_1.bytesToPublicKey)({ publicKeyBytes: nacl_1.Nacl.derivePublicFromSecret(privateKeyBytes), throwOnError: true });
|
|
16
|
+
}
|
|
17
|
+
catch (_err) {
|
|
18
|
+
throw new Error("Failed to derive public key from private key.");
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function derivePublicKeyFromPrivateKeyNonThrowing(params) {
|
|
22
|
+
try {
|
|
23
|
+
return {
|
|
24
|
+
success: true,
|
|
25
|
+
data: derivePublicKeyFromPrivateKeyThrowing({ ...params, throwOnError: true }),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
catch (e) {
|
|
29
|
+
return {
|
|
30
|
+
success: false,
|
|
31
|
+
error: e instanceof Error ? e : new Error("Unexpected error."),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function derivePublicKeyFromPrivateKey(params) {
|
|
36
|
+
if (params.throwOnError === false) {
|
|
37
|
+
return derivePublicKeyFromPrivateKeyNonThrowing({ ...params, throwOnError: false });
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
return derivePublicKeyFromPrivateKeyThrowing({ ...params, throwOnError: true });
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NonThrowing } from "../types/non-throwing";
|
|
2
|
+
import { PrivateKeyString } from "../types/private-key";
|
|
3
|
+
import { Result } from "../types/result";
|
|
4
|
+
import { Throwing } from "../types/throwing";
|
|
5
|
+
type GeneratePrivateKeyParams = {} & (Throwing | NonThrowing);
|
|
6
|
+
export declare function generatePrivateKey(): PrivateKeyString;
|
|
7
|
+
export declare function generatePrivateKey(params: GeneratePrivateKeyParams & NonThrowing): Result<PrivateKeyString>;
|
|
8
|
+
export declare function generatePrivateKey(params: GeneratePrivateKeyParams & Throwing): PrivateKeyString;
|
|
9
|
+
export declare function generatePrivateKey(params: GeneratePrivateKeyParams): PrivateKeyString | Result<PrivateKeyString>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generatePrivateKey = generatePrivateKey;
|
|
4
|
+
const private_key_1 = require("../types/private-key");
|
|
5
|
+
const generate_seed_1 = require("./generate-seed");
|
|
6
|
+
function generatePrivateKeyThrowing(_params) {
|
|
7
|
+
const privateKeyResult = (0, private_key_1.PrivateKeyString)().safeParse((0, generate_seed_1.generateSeed)({ throwOnError: true }));
|
|
8
|
+
if (!privateKeyResult.success) {
|
|
9
|
+
throw new Error("Generated private key is invalid.");
|
|
10
|
+
}
|
|
11
|
+
return privateKeyResult.data;
|
|
12
|
+
}
|
|
13
|
+
function generatePrivateKeyNonThrowing(params) {
|
|
14
|
+
try {
|
|
15
|
+
return {
|
|
16
|
+
success: true,
|
|
17
|
+
data: generatePrivateKeyThrowing({ ...params, throwOnError: true }),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
catch (e) {
|
|
21
|
+
return {
|
|
22
|
+
success: false,
|
|
23
|
+
error: e instanceof Error ? e : new Error("Unexpected error."),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function generatePrivateKey(params) {
|
|
28
|
+
if (params?.throwOnError === false) {
|
|
29
|
+
return generatePrivateKeyNonThrowing({ ...params, throwOnError: false });
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
return generatePrivateKeyThrowing({ ...params, throwOnError: true });
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NonThrowing } from "../types/non-throwing";
|
|
2
|
+
import { PublicKeyString } from "../types/public-key";
|
|
3
|
+
import { Result } from "../types/result";
|
|
4
|
+
import { Throwing } from "../types/throwing";
|
|
5
|
+
type GeneratePublicKeyParams = {} & (Throwing | NonThrowing);
|
|
6
|
+
export declare function generatePublicKey(): PublicKeyString;
|
|
7
|
+
export declare function generatePublicKey(params: GeneratePublicKeyParams & NonThrowing): Result<PublicKeyString>;
|
|
8
|
+
export declare function generatePublicKey(params: GeneratePublicKeyParams & Throwing): PublicKeyString;
|
|
9
|
+
export declare function generatePublicKey(params: GeneratePublicKeyParams): PublicKeyString | Result<PublicKeyString>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generatePublicKey = generatePublicKey;
|
|
4
|
+
const derive_public_key_from_private_key_1 = require("./derive-public-key-from-private-key");
|
|
5
|
+
const generate_private_key_1 = require("./generate-private-key");
|
|
6
|
+
function generatePublicKeyThrowing(_params) {
|
|
7
|
+
const privateKey = (0, generate_private_key_1.generatePrivateKey)({ throwOnError: true });
|
|
8
|
+
return (0, derive_public_key_from_private_key_1.derivePublicKeyFromPrivateKey)({ privateKey, throwOnError: true });
|
|
9
|
+
}
|
|
10
|
+
function generatePublicKeyNonThrowing(params) {
|
|
11
|
+
try {
|
|
12
|
+
return {
|
|
13
|
+
success: true,
|
|
14
|
+
data: generatePublicKeyThrowing({ ...params, throwOnError: true }),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
catch (e) {
|
|
18
|
+
return {
|
|
19
|
+
success: false,
|
|
20
|
+
error: e instanceof Error ? e : new Error("Unexpected error."),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function generatePublicKey(params) {
|
|
25
|
+
if (params?.throwOnError === false) {
|
|
26
|
+
return generatePublicKeyNonThrowing({ ...params, throwOnError: false });
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
return generatePublicKeyThrowing({ ...params, throwOnError: true });
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NonThrowing } from "../types/non-throwing";
|
|
2
|
+
import { Result } from "../types/result";
|
|
3
|
+
import { Throwing } from "../types/throwing";
|
|
4
|
+
type GenerateRandomBytesParams = {
|
|
5
|
+
count: number;
|
|
6
|
+
} & (Throwing | NonThrowing);
|
|
7
|
+
export declare function generateRandomBytes(params: GenerateRandomBytesParams & NonThrowing): Result<Uint8Array>;
|
|
8
|
+
export declare function generateRandomBytes(params: GenerateRandomBytesParams & Throwing): Uint8Array;
|
|
9
|
+
export declare function generateRandomBytes(params: GenerateRandomBytesParams): Uint8Array | Result<Uint8Array>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateRandomBytes = generateRandomBytes;
|
|
4
|
+
function generateRandomBytesThrowing(params) {
|
|
5
|
+
if (!Number.isInteger(params.count) || params.count <= 0) {
|
|
6
|
+
throw new Error("count must be a positive integer");
|
|
7
|
+
}
|
|
8
|
+
const byteArray = new Uint8Array(params.count);
|
|
9
|
+
try {
|
|
10
|
+
const globalCrypto = globalThis.crypto;
|
|
11
|
+
if (globalCrypto && typeof globalCrypto.getRandomValues === "function") {
|
|
12
|
+
globalCrypto.getRandomValues(byteArray);
|
|
13
|
+
return byteArray;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
catch (_) {
|
|
17
|
+
// Do nothing
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
21
|
+
const nodeCrypto = require("crypto");
|
|
22
|
+
if (typeof nodeCrypto.randomFillSync === "function") {
|
|
23
|
+
nodeCrypto.randomFillSync(byteArray);
|
|
24
|
+
return byteArray;
|
|
25
|
+
}
|
|
26
|
+
if (typeof nodeCrypto.randomBytes === "function") {
|
|
27
|
+
byteArray.set(nodeCrypto.randomBytes(byteArray.length));
|
|
28
|
+
return byteArray;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
catch (_) {
|
|
32
|
+
// Do nothing
|
|
33
|
+
}
|
|
34
|
+
throw new Error("Unable to access a secure random source.");
|
|
35
|
+
}
|
|
36
|
+
function generateRandomBytesNonThrowing(params) {
|
|
37
|
+
try {
|
|
38
|
+
return {
|
|
39
|
+
success: true,
|
|
40
|
+
data: generateRandomBytesThrowing({ ...params, throwOnError: true }),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
catch (e) {
|
|
44
|
+
return {
|
|
45
|
+
success: false,
|
|
46
|
+
error: e instanceof Error ? e : new Error("Unexpected error."),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function generateRandomBytes(params) {
|
|
51
|
+
if (params.throwOnError === false) {
|
|
52
|
+
return generateRandomBytesNonThrowing({ ...params, throwOnError: false });
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
return generateRandomBytesThrowing({ ...params, throwOnError: true });
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NonThrowing } from "../types/non-throwing";
|
|
2
|
+
import { Result } from "../types/result";
|
|
3
|
+
import { SeedString } from "../types/seed";
|
|
4
|
+
import { Throwing } from "../types/throwing";
|
|
5
|
+
type GenerateSeedParams = {} & (Throwing | NonThrowing);
|
|
6
|
+
export declare function generateSeed(): SeedString;
|
|
7
|
+
export declare function generateSeed(params: GenerateSeedParams & NonThrowing): Result<SeedString>;
|
|
8
|
+
export declare function generateSeed(params: GenerateSeedParams & Throwing): SeedString;
|
|
9
|
+
export declare function generateSeed(params: GenerateSeedParams): SeedString | Result<SeedString>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateSeed = generateSeed;
|
|
4
|
+
const seed_converter_1 = require("./conversion/seed-converter");
|
|
5
|
+
const generate_random_bytes_1 = require("./generate-random-bytes");
|
|
6
|
+
function generateSeedThrowing(_params) {
|
|
7
|
+
const randomSeedBytes = (0, generate_random_bytes_1.generateRandomBytes)({ count: 32, throwOnError: true });
|
|
8
|
+
return (0, seed_converter_1.bytesToSeed)({ seedBytes: randomSeedBytes, throwOnError: true });
|
|
9
|
+
}
|
|
10
|
+
function generateSeedNonThrowing(params) {
|
|
11
|
+
try {
|
|
12
|
+
return {
|
|
13
|
+
success: true,
|
|
14
|
+
data: generateSeedThrowing({ ...params, throwOnError: true }),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
catch (e) {
|
|
18
|
+
return {
|
|
19
|
+
success: false,
|
|
20
|
+
error: e instanceof Error ? e : new Error("Unexpected error."),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function generateSeed(params) {
|
|
25
|
+
if (params?.throwOnError === false) {
|
|
26
|
+
return generateSeedNonThrowing({ ...params, throwOnError: false });
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
return generateSeedThrowing({ ...params, throwOnError: true });
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AccountString } from "../types/account";
|
|
2
|
+
import { RawAmountString } from "../types/amount";
|
|
3
|
+
import { HashString } from "../types/hash";
|
|
4
|
+
import { LinkString } from "../types/link";
|
|
5
|
+
import { NonThrowing } from "../types/non-throwing";
|
|
6
|
+
import { Result } from "../types/result";
|
|
7
|
+
import { Throwing } from "../types/throwing";
|
|
8
|
+
type HashBlockParams = {
|
|
9
|
+
account: AccountString;
|
|
10
|
+
previous: HashString;
|
|
11
|
+
representative: AccountString;
|
|
12
|
+
balance: RawAmountString;
|
|
13
|
+
link: LinkString;
|
|
14
|
+
} & (Throwing | NonThrowing);
|
|
15
|
+
export declare function hashBlock(params: HashBlockParams & NonThrowing): Result<HashString>;
|
|
16
|
+
export declare function hashBlock(params: HashBlockParams & Throwing): HashString;
|
|
17
|
+
export declare function hashBlock(params: HashBlockParams): HashString | Result<HashString>;
|
|
18
|
+
export {};
|