@ledgerhq/coin-framework 0.3.6 → 0.3.7-next.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/.eslintrc.js +8 -46
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +27 -1
- package/lib/account/accountId.d.ts +16 -0
- package/lib/account/accountId.d.ts.map +1 -0
- package/lib/account/accountId.js +67 -0
- package/lib/account/accountId.js.map +1 -0
- package/lib/account/accountName.d.ts +14 -0
- package/lib/account/accountName.d.ts.map +1 -0
- package/lib/account/accountName.js +14 -0
- package/lib/account/accountName.js.map +1 -0
- package/lib/account/balanceHistoryCache.d.ts +28 -0
- package/lib/account/balanceHistoryCache.d.ts.map +1 -0
- package/lib/account/balanceHistoryCache.js +132 -0
- package/lib/account/balanceHistoryCache.js.map +1 -0
- package/lib/account/balanceHistoryCache.test.d.ts +2 -0
- package/lib/account/balanceHistoryCache.test.d.ts.map +1 -0
- package/lib/account/balanceHistoryCache.test.js +21 -0
- package/lib/account/balanceHistoryCache.test.js.map +1 -0
- package/lib/account/groupOperations.d.ts +17 -0
- package/lib/account/groupOperations.d.ts.map +1 -0
- package/lib/account/groupOperations.js +122 -0
- package/lib/account/groupOperations.js.map +1 -0
- package/lib/account/helpers.d.ts +46 -0
- package/lib/account/helpers.d.ts.map +1 -0
- package/lib/account/helpers.js +296 -0
- package/lib/account/helpers.js.map +1 -0
- package/lib/account/helpers.test.d.ts +2 -0
- package/lib/account/helpers.test.d.ts.map +1 -0
- package/lib/account/helpers.test.js +409 -0
- package/lib/account/helpers.test.js.map +1 -0
- package/lib/account/index.d.ts +10 -0
- package/lib/account/index.d.ts.map +1 -0
- package/lib/account/index.js +26 -0
- package/lib/account/index.js.map +1 -0
- package/lib/account/ordering.d.ts +10 -0
- package/lib/account/ordering.d.ts.map +1 -0
- package/lib/account/ordering.js +80 -0
- package/lib/account/ordering.js.map +1 -0
- package/lib/account/pending.d.ts +4 -0
- package/lib/account/pending.d.ts.map +1 -0
- package/lib/account/pending.js +53 -0
- package/lib/account/pending.js.map +1 -0
- package/lib/account/serialization.d.ts +6 -0
- package/lib/account/serialization.d.ts.map +1 -0
- package/lib/account/serialization.js +108 -0
- package/lib/account/serialization.js.map +1 -0
- package/lib/account/support.d.ts +7 -0
- package/lib/account/support.d.ts.map +1 -0
- package/lib/account/support.js +45 -0
- package/lib/account/support.js.map +1 -0
- package/lib/account.test.d.ts +2 -0
- package/lib/account.test.d.ts.map +1 -0
- package/lib/account.test.js +180 -0
- package/lib/account.test.js.map +1 -0
- package/lib/bot/bot-test-context.d.ts +3 -0
- package/lib/bot/bot-test-context.d.ts.map +1 -0
- package/lib/bot/bot-test-context.js +26 -0
- package/lib/bot/bot-test-context.js.map +1 -0
- package/lib/bot/bot-test-context.test.d.ts +2 -0
- package/lib/bot/bot-test-context.test.d.ts.map +1 -0
- package/lib/bot/bot-test-context.test.js +41 -0
- package/lib/bot/bot-test-context.test.js.map +1 -0
- package/lib/bot/formatters.d.ts +2 -0
- package/lib/bot/formatters.d.ts.map +1 -0
- package/lib/bot/formatters.js +30 -0
- package/lib/bot/formatters.js.map +1 -0
- package/lib/bot/specs.d.ts +50 -0
- package/lib/bot/specs.d.ts.map +1 -0
- package/lib/bot/specs.js +181 -0
- package/lib/bot/specs.js.map +1 -0
- package/lib/bot/types.d.ts +177 -0
- package/lib/bot/types.d.ts.map +1 -0
- package/lib/bot/types.js +3 -0
- package/lib/bot/types.js.map +1 -0
- package/lib/bridge/getAddressWrapper.d.ts +5 -0
- package/lib/bridge/getAddressWrapper.d.ts.map +1 -0
- package/lib/bridge/getAddressWrapper.js +36 -0
- package/lib/bridge/getAddressWrapper.js.map +1 -0
- package/lib/bridge/jsHelpers.d.ts +59 -0
- package/lib/bridge/jsHelpers.d.ts.map +1 -0
- package/lib/bridge/jsHelpers.js +390 -0
- package/lib/bridge/jsHelpers.js.map +1 -0
- package/lib/cache.d.ts +11 -0
- package/lib/cache.d.ts.map +1 -0
- package/lib/cache.js +21 -0
- package/lib/cache.js.map +1 -0
- package/lib/currencies/BigNumberToLocaleString.d.ts +8 -0
- package/lib/currencies/BigNumberToLocaleString.d.ts.map +1 -0
- package/lib/currencies/BigNumberToLocaleString.js +62 -0
- package/lib/currencies/BigNumberToLocaleString.js.map +1 -0
- package/lib/currencies/BigNumberToLocaleString.test.d.ts +2 -0
- package/lib/currencies/BigNumberToLocaleString.test.d.ts.map +1 -0
- package/lib/currencies/BigNumberToLocaleString.test.js +108 -0
- package/lib/currencies/BigNumberToLocaleString.test.js.map +1 -0
- package/lib/currencies/CurrencyURIScheme.d.ts +13 -0
- package/lib/currencies/CurrencyURIScheme.d.ts.map +1 -0
- package/lib/currencies/CurrencyURIScheme.js +95 -0
- package/lib/currencies/CurrencyURIScheme.js.map +1 -0
- package/lib/currencies/chopCurrencyUnitDecimals.d.ts +3 -0
- package/lib/currencies/chopCurrencyUnitDecimals.d.ts.map +1 -0
- package/lib/currencies/chopCurrencyUnitDecimals.js +29 -0
- package/lib/currencies/chopCurrencyUnitDecimals.js.map +1 -0
- package/lib/currencies/formatCurrencyUnit.d.ts +33 -0
- package/lib/currencies/formatCurrencyUnit.d.ts.map +1 -0
- package/lib/currencies/formatCurrencyUnit.js +109 -0
- package/lib/currencies/formatCurrencyUnit.js.map +1 -0
- package/lib/currencies/formatShort.d.ts +8 -0
- package/lib/currencies/formatShort.d.ts.map +1 -0
- package/lib/currencies/formatShort.js +27 -0
- package/lib/currencies/formatShort.js.map +1 -0
- package/lib/currencies/index.d.ts +13 -0
- package/lib/currencies/index.d.ts.map +1 -0
- package/lib/currencies/index.js +62 -0
- package/lib/currencies/index.js.map +1 -0
- package/lib/currencies/localeUtility.d.ts +8 -0
- package/lib/currencies/localeUtility.d.ts.map +1 -0
- package/lib/currencies/localeUtility.js +45 -0
- package/lib/currencies/localeUtility.js.map +1 -0
- package/lib/currencies/parseCurrencyUnit.d.ts +4 -0
- package/lib/currencies/parseCurrencyUnit.d.ts.map +1 -0
- package/lib/currencies/parseCurrencyUnit.js +18 -0
- package/lib/currencies/parseCurrencyUnit.js.map +1 -0
- package/lib/currencies/sanitizeValueString.d.ts +6 -0
- package/lib/currencies/sanitizeValueString.d.ts.map +1 -0
- package/lib/currencies/sanitizeValueString.js +56 -0
- package/lib/currencies/sanitizeValueString.js.map +1 -0
- package/lib/currencies/support.d.ts +8 -0
- package/lib/currencies/support.d.ts.map +1 -0
- package/lib/currencies/support.js +98 -0
- package/lib/currencies/support.js.map +1 -0
- package/lib/currencies/valueFromUnit.d.ts +9 -0
- package/lib/currencies/valueFromUnit.d.ts.map +1 -0
- package/lib/currencies/valueFromUnit.js +12 -0
- package/lib/currencies/valueFromUnit.js.map +1 -0
- package/lib/derivation.d.ts +232 -0
- package/lib/derivation.d.ts.map +1 -0
- package/lib/derivation.js +416 -0
- package/lib/derivation.js.map +1 -0
- package/lib/derivation.test.d.ts +2 -0
- package/lib/derivation.test.d.ts.map +1 -0
- package/lib/derivation.test.js +35 -0
- package/lib/derivation.test.js.map +1 -0
- package/lib/errors.d.ts +7 -0
- package/lib/errors.d.ts.map +1 -0
- package/lib/errors.js +7 -0
- package/lib/errors.js.map +1 -0
- package/lib/errors.test.d.ts +2 -0
- package/lib/errors.test.d.ts.map +1 -0
- package/lib/errors.test.js +20 -0
- package/lib/errors.test.js.map +1 -0
- package/lib/mocks/account.d.ts +26 -0
- package/lib/mocks/account.d.ts.map +1 -0
- package/lib/mocks/account.js +334 -0
- package/lib/mocks/account.js.map +1 -0
- package/lib/mocks/fixtures/nfts.d.ts +36 -0
- package/lib/mocks/fixtures/nfts.d.ts.map +1 -0
- package/lib/mocks/fixtures/nfts.js +401 -0
- package/lib/mocks/fixtures/nfts.js.map +1 -0
- package/lib/mocks/fixtures/nfts.test.d.ts +2 -0
- package/lib/mocks/fixtures/nfts.test.d.ts.map +1 -0
- package/lib/mocks/fixtures/nfts.test.js +20 -0
- package/lib/mocks/fixtures/nfts.test.js.map +1 -0
- package/lib/mocks/helpers.d.ts +15 -0
- package/lib/mocks/helpers.d.ts.map +1 -0
- package/lib/mocks/helpers.js +32 -0
- package/lib/mocks/helpers.js.map +1 -0
- package/lib/network.d.ts +9 -0
- package/lib/network.d.ts.map +1 -0
- package/lib/network.js +3 -0
- package/lib/network.js.map +1 -0
- package/lib/nft/nftId.d.ts +8 -0
- package/lib/nft/nftId.d.ts.map +1 -0
- package/lib/nft/nftId.js +18 -0
- package/lib/nft/nftId.js.map +1 -0
- package/lib/operation.d.ts +31 -0
- package/lib/operation.d.ts.map +1 -0
- package/lib/operation.js +211 -0
- package/lib/operation.js.map +1 -0
- package/lib/operation.test.d.ts +2 -0
- package/lib/operation.test.d.ts.map +1 -0
- package/lib/operation.test.js +116 -0
- package/lib/operation.test.js.map +1 -0
- package/lib/signer.d.ts +3 -0
- package/lib/signer.d.ts.map +1 -0
- package/lib/signer.js +3 -0
- package/lib/signer.js.map +1 -0
- package/lib/test-helpers/staticTime.d.ts +2 -0
- package/lib/test-helpers/staticTime.d.ts.map +1 -0
- package/lib/test-helpers/staticTime.js +10 -0
- package/lib/test-helpers/staticTime.js.map +1 -0
- package/lib/transaction/common.d.ts +26 -0
- package/lib/transaction/common.d.ts.map +1 -0
- package/lib/transaction/common.js +101 -0
- package/lib/transaction/common.js.map +1 -0
- package/lib-es/account/accountId.d.ts +16 -0
- package/lib-es/account/accountId.d.ts.map +1 -0
- package/lib-es/account/accountId.js +56 -0
- package/lib-es/account/accountId.js.map +1 -0
- package/lib-es/account/accountName.d.ts +14 -0
- package/lib-es/account/accountName.d.ts.map +1 -0
- package/lib-es/account/accountName.js +9 -0
- package/lib-es/account/accountName.js.map +1 -0
- package/lib-es/account/balanceHistoryCache.d.ts +28 -0
- package/lib-es/account/balanceHistoryCache.d.ts.map +1 -0
- package/lib-es/account/balanceHistoryCache.js +123 -0
- package/lib-es/account/balanceHistoryCache.js.map +1 -0
- package/lib-es/account/balanceHistoryCache.test.d.ts +2 -0
- package/lib-es/account/balanceHistoryCache.test.d.ts.map +1 -0
- package/lib-es/account/balanceHistoryCache.test.js +19 -0
- package/lib-es/account/balanceHistoryCache.test.js.map +1 -0
- package/lib-es/account/groupOperations.d.ts +17 -0
- package/lib-es/account/groupOperations.d.ts.map +1 -0
- package/lib-es/account/groupOperations.js +117 -0
- package/lib-es/account/groupOperations.js.map +1 -0
- package/lib-es/account/helpers.d.ts +46 -0
- package/lib-es/account/helpers.d.ts.map +1 -0
- package/lib-es/account/helpers.js +264 -0
- package/lib-es/account/helpers.js.map +1 -0
- package/lib-es/account/helpers.test.d.ts +2 -0
- package/lib-es/account/helpers.test.d.ts.map +1 -0
- package/lib-es/account/helpers.test.js +404 -0
- package/lib-es/account/helpers.test.js.map +1 -0
- package/lib-es/account/index.d.ts +10 -0
- package/lib-es/account/index.d.ts.map +1 -0
- package/lib-es/account/index.js +10 -0
- package/lib-es/account/index.js.map +1 -0
- package/lib-es/account/ordering.d.ts +10 -0
- package/lib-es/account/ordering.d.ts.map +1 -0
- package/lib-es/account/ordering.js +73 -0
- package/lib-es/account/ordering.js.map +1 -0
- package/lib-es/account/pending.d.ts +4 -0
- package/lib-es/account/pending.d.ts.map +1 -0
- package/lib-es/account/pending.js +48 -0
- package/lib-es/account/pending.js.map +1 -0
- package/lib-es/account/serialization.d.ts +6 -0
- package/lib-es/account/serialization.d.ts.map +1 -0
- package/lib-es/account/serialization.js +102 -0
- package/lib-es/account/serialization.js.map +1 -0
- package/lib-es/account/support.d.ts +7 -0
- package/lib-es/account/support.d.ts.map +1 -0
- package/lib-es/account/support.js +39 -0
- package/lib-es/account/support.js.map +1 -0
- package/lib-es/account.test.d.ts +2 -0
- package/lib-es/account.test.d.ts.map +1 -0
- package/lib-es/account.test.js +175 -0
- package/lib-es/account.test.js.map +1 -0
- package/lib-es/bot/bot-test-context.d.ts +3 -0
- package/lib-es/bot/bot-test-context.d.ts.map +1 -0
- package/lib-es/bot/bot-test-context.js +21 -0
- package/lib-es/bot/bot-test-context.js.map +1 -0
- package/lib-es/bot/bot-test-context.test.d.ts +2 -0
- package/lib-es/bot/bot-test-context.test.d.ts.map +1 -0
- package/lib-es/bot/bot-test-context.test.js +39 -0
- package/lib-es/bot/bot-test-context.test.js.map +1 -0
- package/lib-es/bot/formatters.d.ts +2 -0
- package/lib-es/bot/formatters.d.ts.map +1 -0
- package/lib-es/bot/formatters.js +26 -0
- package/lib-es/bot/formatters.js.map +1 -0
- package/lib-es/bot/specs.d.ts +50 -0
- package/lib-es/bot/specs.d.ts.map +1 -0
- package/lib-es/bot/specs.js +170 -0
- package/lib-es/bot/specs.js.map +1 -0
- package/lib-es/bot/types.d.ts +177 -0
- package/lib-es/bot/types.d.ts.map +1 -0
- package/lib-es/bot/types.js +2 -0
- package/lib-es/bot/types.js.map +1 -0
- package/lib-es/bridge/getAddressWrapper.d.ts +5 -0
- package/lib-es/bridge/getAddressWrapper.d.ts.map +1 -0
- package/lib-es/bridge/getAddressWrapper.js +34 -0
- package/lib-es/bridge/getAddressWrapper.js.map +1 -0
- package/lib-es/bridge/jsHelpers.d.ts +59 -0
- package/lib-es/bridge/jsHelpers.d.ts.map +1 -0
- package/lib-es/bridge/jsHelpers.js +378 -0
- package/lib-es/bridge/jsHelpers.js.map +1 -0
- package/lib-es/cache.d.ts +11 -0
- package/lib-es/cache.d.ts.map +1 -0
- package/lib-es/cache.js +17 -0
- package/lib-es/cache.js.map +1 -0
- package/lib-es/currencies/BigNumberToLocaleString.d.ts +8 -0
- package/lib-es/currencies/BigNumberToLocaleString.d.ts.map +1 -0
- package/lib-es/currencies/BigNumberToLocaleString.js +58 -0
- package/lib-es/currencies/BigNumberToLocaleString.js.map +1 -0
- package/lib-es/currencies/BigNumberToLocaleString.test.d.ts +2 -0
- package/lib-es/currencies/BigNumberToLocaleString.test.d.ts.map +1 -0
- package/lib-es/currencies/BigNumberToLocaleString.test.js +106 -0
- package/lib-es/currencies/BigNumberToLocaleString.test.js.map +1 -0
- package/lib-es/currencies/CurrencyURIScheme.d.ts +13 -0
- package/lib-es/currencies/CurrencyURIScheme.d.ts.map +1 -0
- package/lib-es/currencies/CurrencyURIScheme.js +87 -0
- package/lib-es/currencies/CurrencyURIScheme.js.map +1 -0
- package/lib-es/currencies/chopCurrencyUnitDecimals.d.ts +3 -0
- package/lib-es/currencies/chopCurrencyUnitDecimals.d.ts.map +1 -0
- package/lib-es/currencies/chopCurrencyUnitDecimals.js +25 -0
- package/lib-es/currencies/chopCurrencyUnitDecimals.js.map +1 -0
- package/lib-es/currencies/formatCurrencyUnit.d.ts +33 -0
- package/lib-es/currencies/formatCurrencyUnit.d.ts.map +1 -0
- package/lib-es/currencies/formatCurrencyUnit.js +104 -0
- package/lib-es/currencies/formatCurrencyUnit.js.map +1 -0
- package/lib-es/currencies/formatShort.d.ts +8 -0
- package/lib-es/currencies/formatShort.d.ts.map +1 -0
- package/lib-es/currencies/formatShort.js +20 -0
- package/lib-es/currencies/formatShort.js.map +1 -0
- package/lib-es/currencies/index.d.ts +13 -0
- package/lib-es/currencies/index.d.ts.map +1 -0
- package/lib-es/currencies/index.js +14 -0
- package/lib-es/currencies/index.js.map +1 -0
- package/lib-es/currencies/localeUtility.d.ts +8 -0
- package/lib-es/currencies/localeUtility.d.ts.map +1 -0
- package/lib-es/currencies/localeUtility.js +39 -0
- package/lib-es/currencies/localeUtility.js.map +1 -0
- package/lib-es/currencies/parseCurrencyUnit.d.ts +4 -0
- package/lib-es/currencies/parseCurrencyUnit.d.ts.map +1 -0
- package/lib-es/currencies/parseCurrencyUnit.js +14 -0
- package/lib-es/currencies/parseCurrencyUnit.js.map +1 -0
- package/lib-es/currencies/sanitizeValueString.d.ts +6 -0
- package/lib-es/currencies/sanitizeValueString.d.ts.map +1 -0
- package/lib-es/currencies/sanitizeValueString.js +52 -0
- package/lib-es/currencies/sanitizeValueString.js.map +1 -0
- package/lib-es/currencies/support.d.ts +8 -0
- package/lib-es/currencies/support.d.ts.map +1 -0
- package/lib-es/currencies/support.js +89 -0
- package/lib-es/currencies/support.js.map +1 -0
- package/lib-es/currencies/valueFromUnit.d.ts +9 -0
- package/lib-es/currencies/valueFromUnit.d.ts.map +1 -0
- package/lib-es/currencies/valueFromUnit.js +8 -0
- package/lib-es/currencies/valueFromUnit.js.map +1 -0
- package/lib-es/derivation.d.ts +232 -0
- package/lib-es/derivation.d.ts.map +1 -0
- package/lib-es/derivation.js +388 -0
- package/lib-es/derivation.js.map +1 -0
- package/lib-es/derivation.test.d.ts +2 -0
- package/lib-es/derivation.test.d.ts.map +1 -0
- package/lib-es/derivation.test.js +33 -0
- package/lib-es/derivation.test.js.map +1 -0
- package/lib-es/errors.d.ts +7 -0
- package/lib-es/errors.d.ts.map +1 -0
- package/lib-es/errors.js +4 -0
- package/lib-es/errors.js.map +1 -0
- package/lib-es/errors.test.d.ts +2 -0
- package/lib-es/errors.test.d.ts.map +1 -0
- package/lib-es/errors.test.js +18 -0
- package/lib-es/errors.test.js.map +1 -0
- package/lib-es/mocks/account.d.ts +26 -0
- package/lib-es/mocks/account.d.ts.map +1 -0
- package/lib-es/mocks/account.js +324 -0
- package/lib-es/mocks/account.js.map +1 -0
- package/lib-es/mocks/fixtures/nfts.d.ts +36 -0
- package/lib-es/mocks/fixtures/nfts.d.ts.map +1 -0
- package/lib-es/mocks/fixtures/nfts.js +393 -0
- package/lib-es/mocks/fixtures/nfts.js.map +1 -0
- package/lib-es/mocks/fixtures/nfts.test.d.ts +2 -0
- package/lib-es/mocks/fixtures/nfts.test.d.ts.map +1 -0
- package/lib-es/mocks/fixtures/nfts.test.js +18 -0
- package/lib-es/mocks/fixtures/nfts.test.js.map +1 -0
- package/lib-es/mocks/helpers.d.ts +15 -0
- package/lib-es/mocks/helpers.d.ts.map +1 -0
- package/lib-es/mocks/helpers.js +26 -0
- package/lib-es/mocks/helpers.js.map +1 -0
- package/lib-es/network.d.ts +9 -0
- package/lib-es/network.d.ts.map +1 -0
- package/lib-es/network.js +2 -0
- package/lib-es/network.js.map +1 -0
- package/lib-es/nft/nftId.d.ts +8 -0
- package/lib-es/nft/nftId.d.ts.map +1 -0
- package/lib-es/nft/nftId.js +13 -0
- package/lib-es/nft/nftId.js.map +1 -0
- package/lib-es/operation.d.ts +31 -0
- package/lib-es/operation.d.ts.map +1 -0
- package/lib-es/operation.js +190 -0
- package/lib-es/operation.js.map +1 -0
- package/lib-es/operation.test.d.ts +2 -0
- package/lib-es/operation.test.d.ts.map +1 -0
- package/lib-es/operation.test.js +111 -0
- package/lib-es/operation.test.js.map +1 -0
- package/lib-es/signer.d.ts +3 -0
- package/lib-es/signer.d.ts.map +1 -0
- package/lib-es/signer.js +2 -0
- package/lib-es/signer.js.map +1 -0
- package/lib-es/test-helpers/staticTime.d.ts +2 -0
- package/lib-es/test-helpers/staticTime.d.ts.map +1 -0
- package/lib-es/test-helpers/staticTime.js +5 -0
- package/lib-es/test-helpers/staticTime.js.map +1 -0
- package/lib-es/transaction/common.d.ts +26 -0
- package/lib-es/transaction/common.d.ts.map +1 -0
- package/lib-es/transaction/common.js +93 -0
- package/lib-es/transaction/common.js.map +1 -0
- package/package.json +8 -21
- package/src/account/accountId.ts +20 -30
- package/src/account/accountName.ts +1 -4
- package/src/account/balanceHistoryCache.test.ts +19 -0
- package/src/account/balanceHistoryCache.ts +52 -38
- package/src/account/groupOperations.ts +4 -6
- package/src/account/helpers.test.ts +6 -26
- package/src/account/helpers.ts +28 -60
- package/src/account/ordering.ts +10 -18
- package/src/account/pending.ts +6 -15
- package/src/account/serialization.ts +8 -19
- package/src/account/support.ts +8 -18
- package/src/account.test.ts +25 -40
- package/src/bot/specs.ts +24 -43
- package/src/bot/types.ts +2 -3
- package/src/bridge/getAddressWrapper.ts +7 -15
- package/src/bridge/jsHelpers.ts +228 -293
- package/src/cache.ts +4 -4
- package/src/currencies/BigNumberToLocaleString.test.ts +25 -33
- package/src/currencies/BigNumberToLocaleString.ts +3 -8
- package/src/currencies/CurrencyURIScheme.ts +1 -3
- package/src/currencies/chopCurrencyUnitDecimals.ts +1 -4
- package/src/currencies/formatCurrencyUnit.ts +11 -21
- package/src/currencies/index.ts +1 -4
- package/src/currencies/localeUtility.ts +2 -4
- package/src/currencies/parseCurrencyUnit.ts +1 -4
- package/src/currencies/sanitizeValueString.ts +1 -1
- package/src/currencies/support.ts +3 -9
- package/src/derivation.test.ts +1 -4
- package/src/derivation.ts +45 -95
- package/src/errors.test.ts +1 -1
- package/src/errors.ts +2 -6
- package/src/mocks/account.ts +27 -80
- package/src/mocks/fixtures/nfts.test.ts +2 -6
- package/src/mocks/fixtures/nfts.ts +12 -38
- package/src/mocks/helpers.ts +2 -8
- package/src/nft/nftId.ts +2 -2
- package/src/operation.test.ts +119 -32
- package/src/operation.ts +74 -26
- package/src/signer.ts +5 -0
- package/src/transaction/common.ts +9 -22
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
7
|
+
const _1 = require(".");
|
|
8
|
+
const helpers_1 = require("./helpers");
|
|
9
|
+
const mockAccount = {};
|
|
10
|
+
const childAccount = Object.assign(Object.assign({}, mockAccount), { type: "ChildAccount", parentId: "sampleId", address: "sampleAddress" });
|
|
11
|
+
const tokenAccount = Object.assign(Object.assign({}, mockAccount), { type: "TokenAccount", token: {}, parentId: "sampleId" });
|
|
12
|
+
describe(_1.getAccountCurrency.name, () => {
|
|
13
|
+
describe("given an Account", () => {
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
mockAccount.type = "Account";
|
|
16
|
+
});
|
|
17
|
+
it("should return the currency", () => {
|
|
18
|
+
const sampleCurrency = { family: "bitcoin" };
|
|
19
|
+
mockAccount.currency = sampleCurrency;
|
|
20
|
+
expect((0, _1.getAccountCurrency)(mockAccount)).toEqual(sampleCurrency);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
describe("given a ChildAccount", () => {
|
|
24
|
+
it("should return the currency", () => {
|
|
25
|
+
const sampleCurrency = { family: "bitcoin" };
|
|
26
|
+
childAccount.currency = sampleCurrency;
|
|
27
|
+
expect((0, _1.getAccountCurrency)(childAccount)).toEqual(sampleCurrency);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
describe("given a TokenAccount", () => {
|
|
31
|
+
it("should return the token currency", () => {
|
|
32
|
+
const sampleToken = { id: "tokenId" };
|
|
33
|
+
tokenAccount.token = sampleToken;
|
|
34
|
+
expect((0, _1.getAccountCurrency)(tokenAccount)).toEqual(sampleToken);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
describe("given an unknown type Account", () => {
|
|
38
|
+
beforeEach(() => {
|
|
39
|
+
mockAccount.type = "DefinitelyNotAStandardAccount";
|
|
40
|
+
});
|
|
41
|
+
it("should throw an error", () => {
|
|
42
|
+
expect(() => (0, _1.getAccountCurrency)(mockAccount)).toThrow(Error);
|
|
43
|
+
});
|
|
44
|
+
it("should display the account type in the error message", () => {
|
|
45
|
+
expect.assertions(1);
|
|
46
|
+
try {
|
|
47
|
+
(0, _1.getAccountCurrency)(mockAccount);
|
|
48
|
+
}
|
|
49
|
+
catch (e) {
|
|
50
|
+
expect(e.message.includes(mockAccount.type)).toEqual(true);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
describe(_1.getAccountUnit.name, () => {
|
|
56
|
+
describe("given an Account", () => {
|
|
57
|
+
beforeEach(() => {
|
|
58
|
+
mockAccount.type = "Account";
|
|
59
|
+
});
|
|
60
|
+
it("should return the unit", () => {
|
|
61
|
+
const sampleUnit = { name: "unit" };
|
|
62
|
+
mockAccount.unit = sampleUnit;
|
|
63
|
+
expect((0, _1.getAccountUnit)(mockAccount)).toEqual(sampleUnit);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
describe("given a ChildAccount", () => {
|
|
67
|
+
it("should return the currency unit", () => {
|
|
68
|
+
const sampleUnit = { name: "unit" };
|
|
69
|
+
childAccount.currency = { units: [sampleUnit] };
|
|
70
|
+
expect((0, _1.getAccountUnit)(childAccount)).toEqual(sampleUnit);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
describe("given a TokenAccount", () => {
|
|
74
|
+
it("should return the token unit", () => {
|
|
75
|
+
const sampleUnit = { name: "unit" };
|
|
76
|
+
tokenAccount.token = { units: [sampleUnit] };
|
|
77
|
+
expect((0, _1.getAccountUnit)(tokenAccount)).toEqual(sampleUnit);
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
describe("given an unknown type Account", () => {
|
|
81
|
+
beforeEach(() => {
|
|
82
|
+
mockAccount.type = "DefinitelyNotAStandardAccount";
|
|
83
|
+
});
|
|
84
|
+
it("should throw an error", () => {
|
|
85
|
+
expect(() => (0, _1.getAccountUnit)(mockAccount)).toThrow(Error);
|
|
86
|
+
});
|
|
87
|
+
it("should display the account type in the error message", () => {
|
|
88
|
+
expect.assertions(1);
|
|
89
|
+
try {
|
|
90
|
+
(0, _1.getAccountUnit)(mockAccount);
|
|
91
|
+
}
|
|
92
|
+
catch (e) {
|
|
93
|
+
expect(e.message.includes(mockAccount.type)).toEqual(true);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
describe(_1.getFeesCurrency.name, () => {
|
|
99
|
+
describe("given an Account", () => {
|
|
100
|
+
beforeEach(() => {
|
|
101
|
+
mockAccount.type = "Account";
|
|
102
|
+
});
|
|
103
|
+
describe("without feesCurrency", () => {
|
|
104
|
+
it("should return the account's currency", () => {
|
|
105
|
+
const sampleCurrency = { family: "bitcoin" };
|
|
106
|
+
mockAccount.currency = sampleCurrency;
|
|
107
|
+
expect((0, _1.getFeesCurrency)(mockAccount)).toEqual(sampleCurrency);
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
describe("with feesCurrency", () => {
|
|
111
|
+
it("should return the fees currency", () => {
|
|
112
|
+
const sampleCurrency = { family: "vechain" };
|
|
113
|
+
const sampleFeesCurrency = { id: "VTHO" };
|
|
114
|
+
mockAccount.currency = sampleCurrency;
|
|
115
|
+
mockAccount.feesCurrency = sampleFeesCurrency;
|
|
116
|
+
expect((0, _1.getFeesCurrency)(mockAccount)).toEqual(sampleFeesCurrency);
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
describe("given a ChildAccount", () => {
|
|
121
|
+
it("should return the currency", () => {
|
|
122
|
+
const sampleCurrency = { family: "bitcoin" };
|
|
123
|
+
childAccount.currency = sampleCurrency;
|
|
124
|
+
expect((0, _1.getFeesCurrency)(childAccount)).toEqual(sampleCurrency);
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
describe("given a TokenAccount", () => {
|
|
128
|
+
it("should return the token currency", () => {
|
|
129
|
+
const sampleToken = { id: "tokenId" };
|
|
130
|
+
tokenAccount.token = sampleToken;
|
|
131
|
+
expect((0, _1.getFeesCurrency)(tokenAccount)).toEqual(sampleToken);
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
describe("given an unknown type Account", () => {
|
|
135
|
+
beforeEach(() => {
|
|
136
|
+
mockAccount.type = "DefinitelyNotAStandardAccount";
|
|
137
|
+
});
|
|
138
|
+
it("should throw an error", () => {
|
|
139
|
+
expect(() => (0, _1.getFeesCurrency)(mockAccount)).toThrow(Error);
|
|
140
|
+
});
|
|
141
|
+
it("should display the account type in the error message", () => {
|
|
142
|
+
expect.assertions(1);
|
|
143
|
+
try {
|
|
144
|
+
(0, _1.getFeesCurrency)(mockAccount);
|
|
145
|
+
}
|
|
146
|
+
catch (e) {
|
|
147
|
+
expect(e.message.includes(mockAccount.type)).toEqual(true);
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
describe(_1.getAccountName.name, () => {
|
|
153
|
+
describe("given an Account", () => {
|
|
154
|
+
beforeEach(() => {
|
|
155
|
+
mockAccount.type = "Account";
|
|
156
|
+
});
|
|
157
|
+
it("should return the account name", () => {
|
|
158
|
+
const sampleAccountName = "SampleAccountName";
|
|
159
|
+
mockAccount.name = sampleAccountName;
|
|
160
|
+
expect((0, _1.getAccountName)(mockAccount)).toEqual(sampleAccountName);
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
describe("given a ChildAccount", () => {
|
|
164
|
+
it("should return the account name", () => {
|
|
165
|
+
const sampleAccountName = "SampleAccountName";
|
|
166
|
+
childAccount.name = sampleAccountName;
|
|
167
|
+
expect((0, _1.getAccountName)(childAccount)).toEqual(sampleAccountName);
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
describe("given a TokenAccount", () => {
|
|
171
|
+
it("should return the token account name", () => {
|
|
172
|
+
const sampleAccountName = "SampleAccountName";
|
|
173
|
+
tokenAccount.token = { name: sampleAccountName };
|
|
174
|
+
expect((0, _1.getAccountName)(tokenAccount)).toEqual(sampleAccountName);
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
describe("given an unknown type Account", () => {
|
|
178
|
+
beforeEach(() => {
|
|
179
|
+
mockAccount.type = "DefinitelyNotAStandardAccount";
|
|
180
|
+
});
|
|
181
|
+
it("should throw an error", () => {
|
|
182
|
+
expect(() => (0, _1.getAccountName)(mockAccount)).toThrow(Error);
|
|
183
|
+
});
|
|
184
|
+
it("should display the account type in the error message", () => {
|
|
185
|
+
expect.assertions(1);
|
|
186
|
+
try {
|
|
187
|
+
(0, _1.getAccountName)(mockAccount);
|
|
188
|
+
}
|
|
189
|
+
catch (e) {
|
|
190
|
+
expect(e.message.includes(mockAccount.type)).toEqual(true);
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
describe(_1.getAccountSpendableBalance.name, () => {
|
|
196
|
+
describe("given an Account", () => {
|
|
197
|
+
beforeEach(() => {
|
|
198
|
+
mockAccount.type = "Account";
|
|
199
|
+
});
|
|
200
|
+
it("should return the account spendable balance", () => {
|
|
201
|
+
const sampleAccountBalance = new bignumber_js_1.default(10);
|
|
202
|
+
mockAccount.spendableBalance = sampleAccountBalance;
|
|
203
|
+
expect((0, _1.getAccountSpendableBalance)(mockAccount)).toEqual(sampleAccountBalance);
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
describe("given a ChildAccount", () => {
|
|
207
|
+
it("should return the account balance", () => {
|
|
208
|
+
const sampleAccountBalance = new bignumber_js_1.default(10);
|
|
209
|
+
childAccount.balance = sampleAccountBalance;
|
|
210
|
+
expect((0, _1.getAccountSpendableBalance)(childAccount)).toEqual(sampleAccountBalance);
|
|
211
|
+
});
|
|
212
|
+
});
|
|
213
|
+
describe("given a TokenAccount", () => {
|
|
214
|
+
it("should return the token account spendable balance", () => {
|
|
215
|
+
const sampleAccountBalance = new bignumber_js_1.default(10);
|
|
216
|
+
tokenAccount.spendableBalance = sampleAccountBalance;
|
|
217
|
+
expect((0, _1.getAccountSpendableBalance)(tokenAccount)).toEqual(sampleAccountBalance);
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
describe("given an unknown type Account", () => {
|
|
221
|
+
beforeEach(() => {
|
|
222
|
+
mockAccount.type = "DefinitelyNotAStandardAccount";
|
|
223
|
+
});
|
|
224
|
+
it("should throw an error", () => {
|
|
225
|
+
expect(() => (0, _1.getAccountSpendableBalance)(mockAccount)).toThrow(Error);
|
|
226
|
+
});
|
|
227
|
+
it("should display the account type in the error message", () => {
|
|
228
|
+
expect.assertions(1);
|
|
229
|
+
try {
|
|
230
|
+
(0, _1.getAccountSpendableBalance)(mockAccount);
|
|
231
|
+
}
|
|
232
|
+
catch (e) {
|
|
233
|
+
expect(e.message.includes(mockAccount.type)).toEqual(true);
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
});
|
|
237
|
+
});
|
|
238
|
+
describe(helpers_1.isAccountEmpty.name, () => {
|
|
239
|
+
describe("given an account", () => {
|
|
240
|
+
beforeEach(() => {
|
|
241
|
+
mockAccount.type = "Account";
|
|
242
|
+
mockAccount.currency = { family: "ethereum" };
|
|
243
|
+
});
|
|
244
|
+
describe("when account has no subaccounts", () => {
|
|
245
|
+
beforeEach(() => {
|
|
246
|
+
mockAccount.subAccounts = [];
|
|
247
|
+
});
|
|
248
|
+
describe("and balance is zero", () => {
|
|
249
|
+
beforeEach(() => {
|
|
250
|
+
mockAccount.balance = new bignumber_js_1.default(0);
|
|
251
|
+
});
|
|
252
|
+
it("should return true if operationsCount is 0", () => {
|
|
253
|
+
mockAccount.operationsCount = 0;
|
|
254
|
+
expect((0, helpers_1.isAccountEmpty)(mockAccount)).toEqual(true);
|
|
255
|
+
});
|
|
256
|
+
it("should return false if operationsCount is higher than 0", () => {
|
|
257
|
+
mockAccount.operationsCount = 1;
|
|
258
|
+
expect((0, helpers_1.isAccountEmpty)(mockAccount)).toEqual(false);
|
|
259
|
+
});
|
|
260
|
+
});
|
|
261
|
+
describe("and balance is higher than 0", () => {
|
|
262
|
+
beforeEach(() => {
|
|
263
|
+
mockAccount.balance = new bignumber_js_1.default(42);
|
|
264
|
+
});
|
|
265
|
+
it("should return false if operationsCount is 0", () => {
|
|
266
|
+
mockAccount.operationsCount = 0;
|
|
267
|
+
expect((0, helpers_1.isAccountEmpty)(mockAccount)).toEqual(false);
|
|
268
|
+
});
|
|
269
|
+
it("should return false if operationsCount is higher than 0", () => {
|
|
270
|
+
mockAccount.operationsCount = 1;
|
|
271
|
+
expect((0, helpers_1.isAccountEmpty)(mockAccount)).toEqual(false);
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
});
|
|
275
|
+
describe("when account has subaccounts", () => {
|
|
276
|
+
beforeEach(() => {
|
|
277
|
+
mockAccount.subAccounts = [{}];
|
|
278
|
+
});
|
|
279
|
+
it("should return false", () => {
|
|
280
|
+
expect((0, helpers_1.isAccountEmpty)(mockAccount)).toEqual(false);
|
|
281
|
+
});
|
|
282
|
+
});
|
|
283
|
+
});
|
|
284
|
+
});
|
|
285
|
+
describe(_1.areAllOperationsLoaded.name, () => {
|
|
286
|
+
describe("given an account with subAccounts", () => {
|
|
287
|
+
beforeEach(() => {
|
|
288
|
+
mockAccount.type = "Account";
|
|
289
|
+
mockAccount.operations = [];
|
|
290
|
+
mockAccount.operationsCount = 0;
|
|
291
|
+
mockAccount.subAccounts = [
|
|
292
|
+
{
|
|
293
|
+
operations: [],
|
|
294
|
+
operationsCount: 0,
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
operations: [{}],
|
|
298
|
+
operationsCount: 1,
|
|
299
|
+
},
|
|
300
|
+
];
|
|
301
|
+
});
|
|
302
|
+
describe("when sub account operation aren't loaded", () => {
|
|
303
|
+
beforeEach(() => {
|
|
304
|
+
mockAccount.subAccounts[1].operations = [];
|
|
305
|
+
});
|
|
306
|
+
it("should return false", () => {
|
|
307
|
+
expect((0, _1.areAllOperationsLoaded)(mockAccount)).toEqual(false);
|
|
308
|
+
});
|
|
309
|
+
});
|
|
310
|
+
describe("when sub account operation are loaded", () => {
|
|
311
|
+
it("should return true", () => {
|
|
312
|
+
expect((0, _1.areAllOperationsLoaded)(mockAccount)).toEqual(true);
|
|
313
|
+
});
|
|
314
|
+
});
|
|
315
|
+
});
|
|
316
|
+
describe("given an account without subAccounts", () => {
|
|
317
|
+
describe("when operations count is different from operations length", () => {
|
|
318
|
+
beforeEach(() => {
|
|
319
|
+
childAccount.operationsCount = 2;
|
|
320
|
+
childAccount.operations = [{}];
|
|
321
|
+
});
|
|
322
|
+
it("should return false", () => {
|
|
323
|
+
expect((0, _1.areAllOperationsLoaded)(childAccount)).toEqual(false);
|
|
324
|
+
});
|
|
325
|
+
});
|
|
326
|
+
describe("when operations count is same as operations length", () => {
|
|
327
|
+
beforeEach(() => {
|
|
328
|
+
childAccount.operationsCount = 1;
|
|
329
|
+
childAccount.operations = [{}];
|
|
330
|
+
});
|
|
331
|
+
it("should return true", () => {
|
|
332
|
+
expect((0, _1.areAllOperationsLoaded)(childAccount)).toEqual(true);
|
|
333
|
+
});
|
|
334
|
+
});
|
|
335
|
+
});
|
|
336
|
+
});
|
|
337
|
+
describe(helpers_1.isAccountBalanceSignificant.name, () => {
|
|
338
|
+
describe("when balance is low", () => {
|
|
339
|
+
beforeEach(() => {
|
|
340
|
+
mockAccount.balance = new bignumber_js_1.default(10);
|
|
341
|
+
});
|
|
342
|
+
it("should return false", () => {
|
|
343
|
+
expect((0, helpers_1.isAccountBalanceSignificant)(mockAccount)).toEqual(false);
|
|
344
|
+
});
|
|
345
|
+
});
|
|
346
|
+
describe("when balance is high", () => {
|
|
347
|
+
beforeEach(() => {
|
|
348
|
+
mockAccount.balance = new bignumber_js_1.default(101);
|
|
349
|
+
});
|
|
350
|
+
it("should return true", () => {
|
|
351
|
+
expect((0, helpers_1.isAccountBalanceSignificant)(mockAccount)).toEqual(true);
|
|
352
|
+
});
|
|
353
|
+
});
|
|
354
|
+
});
|
|
355
|
+
describe(helpers_1.clearAccount.name, () => {
|
|
356
|
+
describe("given a TokenAccount", () => {
|
|
357
|
+
const tokenAccount = Object.assign(Object.assign({}, mockAccount), { token: {}, parentId: "sampleId", type: "TokenAccount" });
|
|
358
|
+
it("should clear operations", () => {
|
|
359
|
+
const clearedAccount = (0, helpers_1.clearAccount)(tokenAccount);
|
|
360
|
+
expect(clearedAccount.operations.length).toEqual(0);
|
|
361
|
+
expect(clearedAccount.pendingOperations.length).toEqual(0);
|
|
362
|
+
});
|
|
363
|
+
it("should clear balanceHistory", () => {
|
|
364
|
+
const clearedAccount = (0, helpers_1.clearAccount)(tokenAccount);
|
|
365
|
+
expect(clearedAccount.balanceHistoryCache).toEqual(_1.emptyHistoryCache);
|
|
366
|
+
});
|
|
367
|
+
});
|
|
368
|
+
describe("given a ChildAccount", () => {
|
|
369
|
+
const childAccount = Object.assign(Object.assign({}, mockAccount), { type: "ChildAccount", parentId: "sampleId", address: "sampleAddress" });
|
|
370
|
+
it("should clear operations", () => {
|
|
371
|
+
const clearedAccount = (0, helpers_1.clearAccount)(childAccount);
|
|
372
|
+
expect(clearedAccount.operations.length).toEqual(0);
|
|
373
|
+
expect(clearedAccount.pendingOperations.length).toEqual(0);
|
|
374
|
+
});
|
|
375
|
+
it("should clear balanceHistory", () => {
|
|
376
|
+
const clearedAccount = (0, helpers_1.clearAccount)(childAccount);
|
|
377
|
+
expect(clearedAccount.balanceHistoryCache).toEqual(_1.emptyHistoryCache);
|
|
378
|
+
});
|
|
379
|
+
});
|
|
380
|
+
describe("given an Account", () => {
|
|
381
|
+
const ethereumCurrency = {
|
|
382
|
+
family: "ethereum",
|
|
383
|
+
};
|
|
384
|
+
const withSubAccounts = Object.assign(Object.assign({}, mockAccount), { subAccounts: [
|
|
385
|
+
{
|
|
386
|
+
currency: ethereumCurrency,
|
|
387
|
+
},
|
|
388
|
+
], currency: ethereumCurrency });
|
|
389
|
+
it("should clear operations", () => {
|
|
390
|
+
const clearedAccount = (0, helpers_1.clearAccount)(withSubAccounts);
|
|
391
|
+
expect(clearedAccount.operations.length).toEqual(0);
|
|
392
|
+
expect(clearedAccount.pendingOperations.length).toEqual(0);
|
|
393
|
+
});
|
|
394
|
+
it("should clear balanceHistory", () => {
|
|
395
|
+
const clearedAccount = (0, helpers_1.clearAccount)(withSubAccounts);
|
|
396
|
+
expect(clearedAccount.balanceHistoryCache).toEqual(_1.emptyHistoryCache);
|
|
397
|
+
});
|
|
398
|
+
it("should reset lastSyncDate", () => {
|
|
399
|
+
const clearedAccount = (0, helpers_1.clearAccount)(withSubAccounts);
|
|
400
|
+
expect(clearedAccount.lastSyncDate).toEqual(new Date(0));
|
|
401
|
+
});
|
|
402
|
+
it("should delete nfts attribute", () => {
|
|
403
|
+
withSubAccounts.nfts = [];
|
|
404
|
+
const clearedAccount = (0, helpers_1.clearAccount)(withSubAccounts);
|
|
405
|
+
expect(Object.keys(clearedAccount).indexOf("nfts")).toEqual(-1);
|
|
406
|
+
});
|
|
407
|
+
});
|
|
408
|
+
});
|
|
409
|
+
//# sourceMappingURL=helpers.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.test.js","sourceRoot":"","sources":["../../src/account/helpers.test.ts"],"names":[],"mappings":";;;;;AAEA,gEAAqC;AACrC,wBAQW;AACX,uCAAsF;AAEtF,MAAM,WAAW,GAAG,EAAa,CAAC;AAClC,MAAM,YAAY,GAAG,gCAChB,WAAW,KACd,IAAI,EAAE,cAAc,EACpB,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,eAAe,GACT,CAAC;AAClB,MAAM,YAAY,GAAG,gCAChB,WAAW,KACd,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,EAAmB,EAC1B,QAAQ,EAAE,UAAU,GACL,CAAC;AAElB,QAAQ,CAAC,qBAAkB,CAAC,IAAI,EAAE,GAAG,EAAE;IACrC,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAChC,UAAU,CAAC,GAAG,EAAE;YACd,WAAW,CAAC,IAAI,GAAG,SAAS,CAAC;QAC/B,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;YACpC,MAAM,cAAc,GAAG,EAAE,MAAM,EAAE,SAAS,EAAoB,CAAC;YAC/D,WAAW,CAAC,QAAQ,GAAG,cAAc,CAAC;YACtC,MAAM,CAAC,IAAA,qBAAkB,EAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;QACpC,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;YACpC,MAAM,cAAc,GAAG,EAAE,MAAM,EAAE,SAAS,EAAoB,CAAC;YAC/D,YAAY,CAAC,QAAQ,GAAG,cAAc,CAAC;YACvC,MAAM,CAAC,IAAA,qBAAkB,EAAC,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,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c,GAAG,IAAA,sBAAY,EAAC,eAAe,CAAC,CAAC;YACrD,MAAM,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC,OAAO,CAAC,oBAAiB,CAAC,CAAC;QACxE,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;YACnC,MAAM,cAAc,GAAG,IAAA,sBAAY,EAAC,eAAe,CAAC,CAAC;YACrD,MAAM,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;YACtC,eAAe,CAAC,IAAI,GAAG,EAAE,CAAC;YAC1B,MAAM,cAAc,GAAG,IAAA,sBAAY,EAAC,eAAe,CAAC,CAAC;YACrD,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./accountId";
|
|
2
|
+
export * from "./accountName";
|
|
3
|
+
export * from "./balanceHistoryCache";
|
|
4
|
+
export * from "./groupOperations";
|
|
5
|
+
export * from "./helpers";
|
|
6
|
+
export * from "./ordering";
|
|
7
|
+
export * from "./pending";
|
|
8
|
+
export * from "./serialization";
|
|
9
|
+
export * from "./support";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/account/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./accountId"), exports);
|
|
18
|
+
__exportStar(require("./accountName"), exports);
|
|
19
|
+
__exportStar(require("./balanceHistoryCache"), exports);
|
|
20
|
+
__exportStar(require("./groupOperations"), exports);
|
|
21
|
+
__exportStar(require("./helpers"), exports);
|
|
22
|
+
__exportStar(require("./ordering"), exports);
|
|
23
|
+
__exportStar(require("./pending"), exports);
|
|
24
|
+
__exportStar(require("./serialization"), exports);
|
|
25
|
+
__exportStar(require("./support"), exports);
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/account/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,gDAA8B;AAC9B,wDAAsC;AACtC,oDAAkC;AAClC,4CAA0B;AAC1B,6CAA2B;AAC3B,4CAA0B;AAC1B,kDAAgC;AAChC,4CAA0B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BigNumber } from "bignumber.js";
|
|
2
|
+
import type { FlattenAccountsOptions } from "./helpers";
|
|
3
|
+
import type { Account, AccountLike } from "@ledgerhq/types-live";
|
|
4
|
+
import type { CryptoCurrency, TokenCurrency } from "@ledgerhq/types-cryptoassets";
|
|
5
|
+
export type AccountComparator = (a: AccountLike, b: AccountLike) => number;
|
|
6
|
+
export declare const sortAccountsComparatorFromOrder: (orderAccounts: string, calculateCountervalue: (currency: TokenCurrency | CryptoCurrency, value: BigNumber) => BigNumber | null | undefined) => AccountComparator;
|
|
7
|
+
export declare const comparatorSortAccounts: <TA extends AccountLike>(accounts: TA[], comparator: AccountComparator) => TA[];
|
|
8
|
+
export declare const flattenSortAccounts: (accounts: Account[], comparator: AccountComparator, o?: FlattenAccountsOptions) => AccountLike[];
|
|
9
|
+
export declare const nestedSortAccounts: (topAccounts: Account[], comparator: AccountComparator) => Account[];
|
|
10
|
+
//# sourceMappingURL=ordering.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ordering.d.ts","sourceRoot":"","sources":["../../src/account/ordering.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,WAAW,KAAK,MAAM,CAAC;AAkB3E,eAAO,MAAM,+BAA+B,kBAC3B,MAAM,oCAET,aAAa,GAAG,cAAc,SACjC,SAAS,KACb,SAAS,GAAG,IAAI,GAAG,SAAS,KAChC,iBA0BF,CAAC;AACF,eAAO,MAAM,sBAAsB,uDAErB,iBAAiB,SAgB9B,CAAC;AAEF,eAAO,MAAM,mBAAmB,aACpB,OAAO,EAAE,cACP,iBAAiB,MACzB,sBAAsB,KACzB,WAAW,EAEb,CAAC;AAEF,eAAO,MAAM,kBAAkB,gBAChB,OAAO,EAAE,cACV,iBAAiB,KAC5B,OAAO,EAYT,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.nestedSortAccounts = exports.flattenSortAccounts = exports.comparatorSortAccounts = exports.sortAccountsComparatorFromOrder = void 0;
|
|
4
|
+
const bignumber_js_1 = require("bignumber.js");
|
|
5
|
+
const helpers_1 = require("./helpers");
|
|
6
|
+
const sortNameLense = (a) => {
|
|
7
|
+
switch (a.type) {
|
|
8
|
+
case "Account":
|
|
9
|
+
return a.name;
|
|
10
|
+
case "TokenAccount":
|
|
11
|
+
return a.token.name;
|
|
12
|
+
case "ChildAccount":
|
|
13
|
+
return a.currency.name;
|
|
14
|
+
default:
|
|
15
|
+
return "";
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const sortAccountsComparatorFromOrder = (orderAccounts, calculateCountervalue) => {
|
|
19
|
+
const [order, sort] = orderAccounts.split("|");
|
|
20
|
+
const ascValue = sort === "desc" ? -1 : 1;
|
|
21
|
+
if (order === "name") {
|
|
22
|
+
return (a, b) => ascValue *
|
|
23
|
+
sortNameLense(a).localeCompare(sortNameLense(b), undefined, {
|
|
24
|
+
numeric: true,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
const cvCaches = {};
|
|
28
|
+
const lazyCalcCV = (a) => {
|
|
29
|
+
if (a.id in cvCaches)
|
|
30
|
+
return cvCaches[a.id];
|
|
31
|
+
const v = calculateCountervalue((0, helpers_1.getAccountCurrency)(a), a.balance) || new bignumber_js_1.BigNumber(-1);
|
|
32
|
+
cvCaches[a.id] = v;
|
|
33
|
+
return v;
|
|
34
|
+
};
|
|
35
|
+
return (a, b) => {
|
|
36
|
+
const diff = ascValue * lazyCalcCV(a).minus(lazyCalcCV(b)).toNumber();
|
|
37
|
+
if (diff === 0)
|
|
38
|
+
return sortNameLense(a).localeCompare(sortNameLense(b));
|
|
39
|
+
return diff;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
exports.sortAccountsComparatorFromOrder = sortAccountsComparatorFromOrder;
|
|
43
|
+
const comparatorSortAccounts = (accounts, comparator) => {
|
|
44
|
+
const meta = accounts
|
|
45
|
+
.map((ta, index) => ({
|
|
46
|
+
account: ta,
|
|
47
|
+
index,
|
|
48
|
+
}))
|
|
49
|
+
.sort((a, b) => comparator(a.account, b.account));
|
|
50
|
+
if (meta.every((m, i) => m.index === i)) {
|
|
51
|
+
// account ordering is preserved, we keep the same array reference (this should happen most of the time)
|
|
52
|
+
return accounts;
|
|
53
|
+
}
|
|
54
|
+
// otherwise, need to reorder
|
|
55
|
+
return meta.map(m => accounts[m.index]);
|
|
56
|
+
};
|
|
57
|
+
exports.comparatorSortAccounts = comparatorSortAccounts;
|
|
58
|
+
// flatten accounts and sort between them (used for grid mode)
|
|
59
|
+
const flattenSortAccounts = (accounts, comparator, o) => {
|
|
60
|
+
return (0, exports.comparatorSortAccounts)((0, helpers_1.flattenAccounts)(accounts, o), comparator);
|
|
61
|
+
};
|
|
62
|
+
exports.flattenSortAccounts = flattenSortAccounts;
|
|
63
|
+
// sort top level accounts and the inner sub accounts if necessary (used for lists)
|
|
64
|
+
const nestedSortAccounts = (topAccounts, comparator) => {
|
|
65
|
+
let oneAccountHaveChanged = false;
|
|
66
|
+
// first of all we sort the inner token accounts
|
|
67
|
+
const accounts = topAccounts.map(a => {
|
|
68
|
+
if (!a.subAccounts)
|
|
69
|
+
return a;
|
|
70
|
+
const subAccounts = (0, exports.comparatorSortAccounts)(a.subAccounts, comparator);
|
|
71
|
+
if (subAccounts === a.subAccounts)
|
|
72
|
+
return a;
|
|
73
|
+
oneAccountHaveChanged = true;
|
|
74
|
+
return Object.assign(Object.assign({}, a), { subAccounts });
|
|
75
|
+
});
|
|
76
|
+
// then we sort again between them
|
|
77
|
+
return (0, exports.comparatorSortAccounts)(oneAccountHaveChanged ? accounts : topAccounts, comparator);
|
|
78
|
+
};
|
|
79
|
+
exports.nestedSortAccounts = nestedSortAccounts;
|
|
80
|
+
//# sourceMappingURL=ordering.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ordering.js","sourceRoot":"","sources":["../../src/account/ordering.ts"],"names":[],"mappings":";;;AAAA,+CAAyC;AACzC,uCAAgE;AAOhE,MAAM,aAAa,GAAG,CAAC,CAAc,EAAU,EAAE;IAC/C,QAAQ,CAAC,CAAC,IAAI,EAAE;QACd,KAAK,SAAS;YACZ,OAAO,CAAC,CAAC,IAAI,CAAC;QAEhB,KAAK,cAAc;YACjB,OAAO,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;QAEtB,KAAK,cAAc;YACjB,OAAO,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC;QAEzB;YACE,OAAO,EAAE,CAAC;KACb;AACH,CAAC,CAAC;AAEK,MAAM,+BAA+B,GAAG,CAC7C,aAAqB,EACrB,qBAGiC,EACd,EAAE;IACrB,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC/C,MAAM,QAAQ,GAAG,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAE1C,IAAI,KAAK,KAAK,MAAM,EAAE;QACpB,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACd,QAAQ;YACR,aAAa,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC,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AC5F,CAAC,CAAC;AAfW,QAAA,kBAAkB,sBAe7B"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Account, Operation } from "@ledgerhq/types-live";
|
|
2
|
+
export declare function shouldRetainPendingOperation(account: Account, op: Operation): boolean;
|
|
3
|
+
export declare const addPendingOperation: (account: Account, operation: Operation) => Account;
|
|
4
|
+
//# sourceMappingURL=pending.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pending.d.ts","sourceRoot":"","sources":["../../src/account/pending.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAc,MAAM,sBAAsB,CAAC;AAE3E,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,GAAG,OAAO,CAerF;AAUD,eAAO,MAAM,mBAAmB,YAAa,OAAO,aAAa,SAAS,KAAG,OAgC5E,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addPendingOperation = exports.shouldRetainPendingOperation = void 0;
|
|
4
|
+
const live_env_1 = require("@ledgerhq/live-env");
|
|
5
|
+
function shouldRetainPendingOperation(account, op) {
|
|
6
|
+
// FIXME: valueOf to compare dates in typescript
|
|
7
|
+
const delay = new Date().valueOf() - op.date.valueOf();
|
|
8
|
+
const last = account.operations[0];
|
|
9
|
+
if (last &&
|
|
10
|
+
last.transactionSequenceNumber &&
|
|
11
|
+
op.transactionSequenceNumber &&
|
|
12
|
+
op.transactionSequenceNumber <= last.transactionSequenceNumber) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
return delay < (0, live_env_1.getEnv)("OPERATION_OPTIMISTIC_RETENTION");
|
|
16
|
+
}
|
|
17
|
+
exports.shouldRetainPendingOperation = shouldRetainPendingOperation;
|
|
18
|
+
const appendPendingOp = (ops, op) => {
|
|
19
|
+
const filtered = ops.filter(o => o.transactionSequenceNumber !== op.transactionSequenceNumber);
|
|
20
|
+
filtered.unshift(op);
|
|
21
|
+
return filtered;
|
|
22
|
+
};
|
|
23
|
+
const addPendingOperation = (account, operation) => {
|
|
24
|
+
const accountCopy = Object.assign({}, account);
|
|
25
|
+
const { subOperations } = operation;
|
|
26
|
+
const { subAccounts } = account;
|
|
27
|
+
function addInSubAccount(subaccounts, op) {
|
|
28
|
+
const acc = subaccounts.find(sub => sub.id === op.accountId);
|
|
29
|
+
if (acc) {
|
|
30
|
+
const copy = Object.assign({}, acc);
|
|
31
|
+
copy.pendingOperations = appendPendingOp(acc.pendingOperations, op);
|
|
32
|
+
subaccounts[subaccounts.indexOf(acc)] = copy;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (subOperations && subAccounts) {
|
|
36
|
+
const taCopy = subAccounts.slice(0);
|
|
37
|
+
subOperations.forEach(op => {
|
|
38
|
+
addInSubAccount(taCopy, op);
|
|
39
|
+
});
|
|
40
|
+
accountCopy.subAccounts = taCopy;
|
|
41
|
+
}
|
|
42
|
+
if (accountCopy.id === operation.accountId) {
|
|
43
|
+
accountCopy.pendingOperations = appendPendingOp(accountCopy.pendingOperations, operation);
|
|
44
|
+
}
|
|
45
|
+
else if (subAccounts) {
|
|
46
|
+
const taCopy = subAccounts.slice(0);
|
|
47
|
+
addInSubAccount(taCopy, operation);
|
|
48
|
+
accountCopy.subAccounts = taCopy;
|
|
49
|
+
}
|
|
50
|
+
return accountCopy;
|
|
51
|
+
};
|
|
52
|
+
exports.addPendingOperation = addPendingOperation;
|
|
53
|
+
//# sourceMappingURL=pending.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pending.js","sourceRoot":"","sources":["../../src/account/pending.ts"],"names":[],"mappings":";;;AACA,iDAA4C;AAC5C,SAAgB,4BAA4B,CAAC,OAAgB,EAAE,EAAa;IAC1E,gDAAgD;IAChD,MAAM,KAAK,GAAG,IAAI,IAA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