pshenmic-dpp 1.1.2-dev.8 → 2.0.0-dev.1
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/README.md +14 -99
- package/dist/binaries/bindingsTypes.d.ts +1696 -0
- package/dist/binaries/bindingsTypes.js +98 -0
- package/dist/binaries/pshenmic_dpp.android.node/react-native-node-api-module +0 -0
- package/dist/binaries/pshenmic_dpp.android.node/x86_64/libpshenmic_dpp.so +0 -0
- package/dist/binaries/pshenmic_dpp.d.ts +166 -0
- package/dist/binaries/pshenmic_dpp.js +3 -0
- package/dist/binaries/wasm/wasmBytes.d.ts +2 -0
- package/dist/binaries/wasm/wasmBytes.js +2 -0
- package/dist/binaries/wasm.d.ts +166 -0
- package/dist/binaries/wasm.js +44 -0
- package/dist/src/dpp/constants.d.ts +4 -0
- package/dist/src/dpp/constants.js +19 -0
- package/dist/src/dpp/dpp.d.ts +110 -0
- package/dist/src/dpp/dpp.js +110 -0
- package/dist/src/dpp/enums.d.ts +1 -0
- package/dist/src/dpp/enums.js +1 -0
- package/dist/src/dpp/provider.d.ts +11 -0
- package/dist/src/dpp/provider.js +21 -0
- package/dist/src/dpp/structs/Address/AddressWitness.d.ts +12 -0
- package/dist/src/dpp/structs/Address/AddressWitness.js +23 -0
- package/dist/src/dpp/structs/Address/PlatformAddress.d.ts +14 -0
- package/dist/src/dpp/structs/Address/PlatformAddress.js +32 -0
- package/dist/src/dpp/structs/AddressTransitions/AddressCreditWithdrawalTransition.d.ts +38 -0
- package/dist/src/dpp/structs/AddressTransitions/AddressCreditWithdrawalTransition.js +95 -0
- package/dist/src/dpp/structs/AddressTransitions/AddressFundingFromAssetLockTransition.d.ts +35 -0
- package/dist/src/dpp/structs/AddressTransitions/AddressFundingFromAssetLockTransition.js +85 -0
- package/dist/src/dpp/structs/AddressTransitions/AddressFundsTransferTransition.d.ts +30 -0
- package/dist/src/dpp/structs/AddressTransitions/AddressFundsTransferTransition.js +72 -0
- package/dist/src/dpp/structs/AddressTransitions/IdentityCreateFromAddressesTransition.d.ts +33 -0
- package/dist/src/dpp/structs/AddressTransitions/IdentityCreateFromAddressesTransition.js +82 -0
- package/dist/src/dpp/structs/AddressTransitions/IdentityCreditTransferToAddressesTransition.d.ts +31 -0
- package/dist/src/dpp/structs/AddressTransitions/IdentityCreditTransferToAddressesTransition.js +77 -0
- package/dist/src/dpp/structs/AddressTransitions/IdentityTopUpFromAddressesTransition.d.ts +31 -0
- package/dist/src/dpp/structs/AddressTransitions/IdentityTopUpFromAddressesTransition.js +76 -0
- package/dist/src/dpp/structs/AddressTransitions/entities/AddressFundsFeeStrategyStep.d.ts +12 -0
- package/dist/src/dpp/structs/AddressTransitions/entities/AddressFundsFeeStrategyStep.js +26 -0
- package/dist/src/dpp/structs/AddressTransitions/entities/InputAddress.d.ts +14 -0
- package/dist/src/dpp/structs/AddressTransitions/entities/InputAddress.js +32 -0
- package/dist/src/dpp/structs/AddressTransitions/entities/OutputAddress.d.ts +12 -0
- package/dist/src/dpp/structs/AddressTransitions/entities/OutputAddress.js +26 -0
- package/dist/src/dpp/structs/AddressTransitions/entities/OutputAddressNullableCredits.d.ts +12 -0
- package/dist/src/dpp/structs/AddressTransitions/entities/OutputAddressNullableCredits.js +29 -0
- package/dist/src/dpp/structs/AssetLockProof/AssetLockProof.d.ts +19 -0
- package/dist/src/dpp/structs/AssetLockProof/AssetLockProof.js +51 -0
- package/dist/src/dpp/structs/AssetLockProof/ChainAssetLockProof.d.ts +17 -0
- package/dist/src/dpp/structs/AssetLockProof/ChainAssetLockProof.js +36 -0
- package/dist/src/dpp/structs/AssetLockProof/InstantAssetLockProof.d.ts +24 -0
- package/dist/src/dpp/structs/AssetLockProof/InstantAssetLockProof.js +48 -0
- package/dist/src/dpp/structs/AssetLockProof/OutPoint.d.ts +15 -0
- package/dist/src/dpp/structs/AssetLockProof/OutPoint.js +40 -0
- package/dist/src/dpp/structs/AssetLockProof/Transaction.d.ts +20 -0
- package/dist/src/dpp/structs/AssetLockProof/Transaction.js +49 -0
- package/dist/src/dpp/structs/AssetLockProof/TxIn.d.ts +17 -0
- package/dist/src/dpp/structs/AssetLockProof/TxIn.js +39 -0
- package/dist/src/dpp/structs/AssetLockProof/TxOut.d.ts +13 -0
- package/dist/src/dpp/structs/AssetLockProof/TxOut.js +34 -0
- package/dist/src/dpp/structs/AssetLockProof/Witness.d.ts +11 -0
- package/dist/src/dpp/structs/AssetLockProof/Witness.js +25 -0
- package/dist/src/dpp/structs/Batch/BatchTransition.d.ts +34 -0
- package/dist/src/dpp/structs/Batch/BatchTransition.js +95 -0
- package/dist/src/dpp/structs/Batch/BatchedTransition.d.ts +13 -0
- package/dist/src/dpp/structs/Batch/BatchedTransition.js +39 -0
- package/dist/src/dpp/structs/Batch/DocumentBaseTransition.d.ts +20 -0
- package/dist/src/dpp/structs/Batch/DocumentBaseTransition.js +54 -0
- package/dist/src/dpp/structs/Batch/DocumentTransition.d.ts +32 -0
- package/dist/src/dpp/structs/Batch/DocumentTransition.js +74 -0
- package/dist/src/dpp/structs/Batch/DocumentTransitions/DocumentCreateTransition.d.ts +23 -0
- package/dist/src/dpp/structs/Batch/DocumentTransitions/DocumentCreateTransition.js +58 -0
- package/dist/src/dpp/structs/Batch/DocumentTransitions/DocumentDeleteTransition.d.ts +14 -0
- package/dist/src/dpp/structs/Batch/DocumentTransitions/DocumentDeleteTransition.js +26 -0
- package/dist/src/dpp/structs/Batch/DocumentTransitions/DocumentPurchaseTransition.d.ts +19 -0
- package/dist/src/dpp/structs/Batch/DocumentTransitions/DocumentPurchaseTransition.js +39 -0
- package/dist/src/dpp/structs/Batch/DocumentTransitions/DocumentReplaceTransition.d.ts +19 -0
- package/dist/src/dpp/structs/Batch/DocumentTransitions/DocumentReplaceTransition.js +40 -0
- package/dist/src/dpp/structs/Batch/DocumentTransitions/DocumentTransferTransition.d.ts +19 -0
- package/dist/src/dpp/structs/Batch/DocumentTransitions/DocumentTransferTransition.js +35 -0
- package/dist/src/dpp/structs/Batch/DocumentTransitions/DocumentUpdatePriceTransition.d.ts +17 -0
- package/dist/src/dpp/structs/Batch/DocumentTransitions/DocumentUpdatePriceTransition.js +33 -0
- package/dist/src/dpp/structs/Batch/PrefundedVotingBalance.d.ts +9 -0
- package/dist/src/dpp/structs/Batch/PrefundedVotingBalance.js +19 -0
- package/dist/src/dpp/structs/Batch/TokenBaseTransition.d.ts +20 -0
- package/dist/src/dpp/structs/Batch/TokenBaseTransition.js +49 -0
- package/dist/src/dpp/structs/Batch/TokenPaymentInfo.d.ts +19 -0
- package/dist/src/dpp/structs/Batch/TokenPaymentInfo.js +54 -0
- package/dist/src/dpp/structs/Batch/TokenPricingSchedule.d.ts +17 -0
- package/dist/src/dpp/structs/Batch/TokenPricingSchedule.js +41 -0
- package/dist/src/dpp/structs/Batch/TokenTransition.d.ts +20 -0
- package/dist/src/dpp/structs/Batch/TokenTransition.js +92 -0
- package/dist/src/dpp/structs/Batch/TokenTransitions/TokenBurnTransition.d.ts +14 -0
- package/dist/src/dpp/structs/Batch/TokenTransitions/TokenBurnTransition.js +32 -0
- package/dist/src/dpp/structs/Batch/TokenTransitions/TokenClaimTransition.d.ts +15 -0
- package/dist/src/dpp/structs/Batch/TokenTransitions/TokenClaimTransition.js +33 -0
- package/dist/src/dpp/structs/Batch/TokenTransitions/TokenConfigUpdateTransition.d.ts +15 -0
- package/dist/src/dpp/structs/Batch/TokenTransitions/TokenConfigUpdateTransition.js +33 -0
- package/dist/src/dpp/structs/Batch/TokenTransitions/TokenDestroyFrozenFundsTransition.d.ts +16 -0
- package/dist/src/dpp/structs/Batch/TokenTransitions/TokenDestroyFrozenFundsTransition.js +34 -0
- package/dist/src/dpp/structs/Batch/TokenTransitions/TokenDirectPurchaseTransition.d.ts +14 -0
- package/dist/src/dpp/structs/Batch/TokenTransitions/TokenDirectPurchaseTransition.js +32 -0
- package/dist/src/dpp/structs/Batch/TokenTransitions/TokenEmergencyActionTransition.d.ts +15 -0
- package/dist/src/dpp/structs/Batch/TokenTransitions/TokenEmergencyActionTransition.js +33 -0
- package/dist/src/dpp/structs/Batch/TokenTransitions/TokenFreezeTransition.d.ts +16 -0
- package/dist/src/dpp/structs/Batch/TokenTransitions/TokenFreezeTransition.js +34 -0
- package/dist/src/dpp/structs/Batch/TokenTransitions/TokenMintTransition.d.ts +18 -0
- package/dist/src/dpp/structs/Batch/TokenTransitions/TokenMintTransition.js +43 -0
- package/dist/src/dpp/structs/Batch/TokenTransitions/TokenSetPriceForDirectPurchaseTransition.d.ts +15 -0
- package/dist/src/dpp/structs/Batch/TokenTransitions/TokenSetPriceForDirectPurchaseTransition.js +36 -0
- package/dist/src/dpp/structs/Batch/TokenTransitions/TokenTransferTransition.d.ts +21 -0
- package/dist/src/dpp/structs/Batch/TokenTransitions/TokenTransferTransition.js +53 -0
- package/dist/src/dpp/structs/Batch/TokenTransitions/TokenUnFreezeTransition.d.ts +16 -0
- package/dist/src/dpp/structs/Batch/TokenTransitions/TokenUnFreezeTransition.js +34 -0
- package/dist/src/dpp/structs/ConsensusError.d.ts +8 -0
- package/dist/src/dpp/structs/ConsensusError.js +22 -0
- package/dist/src/dpp/structs/ContractBounds.d.ts +17 -0
- package/dist/src/dpp/structs/ContractBounds.js +39 -0
- package/dist/src/dpp/structs/CoreScript.d.ts +15 -0
- package/dist/src/dpp/structs/CoreScript.js +37 -0
- package/dist/src/dpp/structs/DataContract.d.ts +35 -0
- package/dist/src/dpp/structs/DataContract.js +116 -0
- package/dist/src/dpp/structs/DataContractTransitions/DataContractCreateTransition.d.ts +23 -0
- package/dist/src/dpp/structs/DataContractTransitions/DataContractCreateTransition.js +55 -0
- package/dist/src/dpp/structs/DataContractTransitions/DataContractUpdateTransition.d.ts +23 -0
- package/dist/src/dpp/structs/DataContractTransitions/DataContractUpdateTransition.js +55 -0
- package/dist/src/dpp/structs/Document.d.ts +51 -0
- package/dist/src/dpp/structs/Document.js +184 -0
- package/dist/src/dpp/structs/EncryptedNote/PrivateEncryptedNote.d.ts +13 -0
- package/dist/src/dpp/structs/EncryptedNote/PrivateEncryptedNote.js +31 -0
- package/dist/src/dpp/structs/EncryptedNote/SharedEncryptedNote.d.ts +13 -0
- package/dist/src/dpp/structs/EncryptedNote/SharedEncryptedNote.js +31 -0
- package/dist/src/dpp/structs/GroupStateTransitionInfo.d.ts +15 -0
- package/dist/src/dpp/structs/GroupStateTransitionInfo.js +33 -0
- package/dist/src/dpp/structs/Identifier.d.ts +17 -0
- package/dist/src/dpp/structs/Identifier.js +50 -0
- package/dist/src/dpp/structs/Identity.d.ts +26 -0
- package/dist/src/dpp/structs/Identity.js +73 -0
- package/dist/src/dpp/structs/IdentityPublicKey.d.ts +43 -0
- package/dist/src/dpp/structs/IdentityPublicKey.js +126 -0
- package/dist/src/dpp/structs/IdentityPublicKeyInCreation.d.ts +30 -0
- package/dist/src/dpp/structs/IdentityPublicKeyInCreation.js +77 -0
- package/dist/src/dpp/structs/IdentityTransitions/IdentityCreateTransition.d.ts +29 -0
- package/dist/src/dpp/structs/IdentityTransitions/IdentityCreateTransition.js +69 -0
- package/dist/src/dpp/structs/IdentityTransitions/IdentityCreditTransfer.d.ts +33 -0
- package/dist/src/dpp/structs/IdentityTransitions/IdentityCreditTransfer.js +85 -0
- package/dist/src/dpp/structs/IdentityTransitions/IdentityCreditWithdrawalTransition.d.ts +42 -0
- package/dist/src/dpp/structs/IdentityTransitions/IdentityCreditWithdrawalTransition.js +114 -0
- package/dist/src/dpp/structs/IdentityTransitions/IdentityTopUpTransition.d.ts +30 -0
- package/dist/src/dpp/structs/IdentityTransitions/IdentityTopUpTransition.js +75 -0
- package/dist/src/dpp/structs/IdentityTransitions/IdentityUpdateTransition.d.ts +40 -0
- package/dist/src/dpp/structs/IdentityTransitions/IdentityUpdateTransition.js +108 -0
- package/dist/src/dpp/structs/InstantLock.d.ts +17 -0
- package/dist/src/dpp/structs/InstantLock.js +43 -0
- package/dist/src/dpp/structs/MasternodeVote/MasternodeVoteTransition.d.ts +37 -0
- package/dist/src/dpp/structs/MasternodeVote/MasternodeVoteTransition.js +96 -0
- package/dist/src/dpp/structs/MasternodeVote/ResourceVoteChoice.d.ts +14 -0
- package/dist/src/dpp/structs/MasternodeVote/ResourceVoteChoice.js +29 -0
- package/dist/src/dpp/structs/MasternodeVote/Vote.d.ts +13 -0
- package/dist/src/dpp/structs/MasternodeVote/Vote.js +27 -0
- package/dist/src/dpp/structs/MasternodeVote/VotePoll.d.ts +18 -0
- package/dist/src/dpp/structs/MasternodeVote/VotePoll.js +42 -0
- package/dist/src/dpp/structs/PartialIdentity.d.ts +26 -0
- package/dist/src/dpp/structs/PartialIdentity.js +69 -0
- package/dist/src/dpp/structs/PrivateKey.d.ts +20 -0
- package/dist/src/dpp/structs/PrivateKey.js +48 -0
- package/dist/src/dpp/structs/PublicKey.d.ts +15 -0
- package/dist/src/dpp/structs/PublicKey.js +37 -0
- package/dist/src/dpp/structs/StateTransition.d.ts +38 -0
- package/dist/src/dpp/structs/StateTransition.js +100 -0
- package/dist/src/dpp/structs/TokenConfiguration/ActionTaker.d.ts +12 -0
- package/dist/src/dpp/structs/TokenConfiguration/ActionTaker.js +44 -0
- package/dist/src/dpp/structs/TokenConfiguration/AuthorizedActionTakers.d.ts +16 -0
- package/dist/src/dpp/structs/TokenConfiguration/AuthorizedActionTakers.js +43 -0
- package/dist/src/dpp/structs/TokenConfiguration/ChangeControlRules.d.ts +23 -0
- package/dist/src/dpp/structs/TokenConfiguration/ChangeControlRules.js +52 -0
- package/dist/src/dpp/structs/TokenConfiguration/DistributionFunction.d.ts +19 -0
- package/dist/src/dpp/structs/TokenConfiguration/DistributionFunction.js +57 -0
- package/dist/src/dpp/structs/TokenConfiguration/Group.d.ts +19 -0
- package/dist/src/dpp/structs/TokenConfiguration/Group.js +44 -0
- package/dist/src/dpp/structs/TokenConfiguration/RewardDistributionType.d.ts +13 -0
- package/dist/src/dpp/structs/TokenConfiguration/RewardDistributionType.js +40 -0
- package/dist/src/dpp/structs/TokenConfiguration/TokenConfiguration.d.ts +54 -0
- package/dist/src/dpp/structs/TokenConfiguration/TokenConfiguration.js +139 -0
- package/dist/src/dpp/structs/TokenConfiguration/TokenConfigurationChangeItem.d.ts +47 -0
- package/dist/src/dpp/structs/TokenConfiguration/TokenConfigurationChangeItem.js +140 -0
- package/dist/src/dpp/structs/TokenConfiguration/TokenConfigurationConvention.d.ts +19 -0
- package/dist/src/dpp/structs/TokenConfiguration/TokenConfigurationConvention.js +47 -0
- package/dist/src/dpp/structs/TokenConfiguration/TokenConfigurationLocalization.d.ts +15 -0
- package/dist/src/dpp/structs/TokenConfiguration/TokenConfigurationLocalization.js +34 -0
- package/dist/src/dpp/structs/TokenConfiguration/TokenDistributionRecipient.d.ts +14 -0
- package/dist/src/dpp/structs/TokenConfiguration/TokenDistributionRecipient.js +31 -0
- package/dist/src/dpp/structs/TokenConfiguration/TokenDistributionRules.d.ts +28 -0
- package/dist/src/dpp/structs/TokenConfiguration/TokenDistributionRules.js +75 -0
- package/dist/src/dpp/structs/TokenConfiguration/TokenKeepsHistoryRules.d.ts +19 -0
- package/dist/src/dpp/structs/TokenConfiguration/TokenKeepsHistoryRules.js +49 -0
- package/dist/src/dpp/structs/TokenConfiguration/TokenMarketplaceRules.d.ts +13 -0
- package/dist/src/dpp/structs/TokenConfiguration/TokenMarketplaceRules.js +27 -0
- package/dist/src/dpp/structs/TokenConfiguration/TokenPerpetualDistribution.d.ts +13 -0
- package/dist/src/dpp/structs/TokenConfiguration/TokenPerpetualDistribution.js +27 -0
- package/dist/src/dpp/structs/TokenConfiguration/TokenPreProgrammedDistribution.d.ts +21 -0
- package/dist/src/dpp/structs/TokenConfiguration/TokenPreProgrammedDistribution.js +42 -0
- package/dist/src/dpp/structs/TokenConfiguration/TokenTradeMode.d.ts +9 -0
- package/dist/src/dpp/structs/TokenConfiguration/TokenTradeMode.js +17 -0
- package/dist/src/dpp/types.d.ts +274 -0
- package/dist/src/dpp/types.js +1 -0
- package/dist/src/dpp/utils.d.ts +5 -0
- package/dist/src/dpp/utils.js +64 -0
- package/dist/src/dpp/verify/Contested/verifyVotePollVoteStateProof.d.ts +3 -0
- package/dist/src/dpp/verify/Contested/verifyVotePollVoteStateProof.js +34 -0
- package/dist/src/dpp/verify/Contract/verifyContract.d.ts +2 -0
- package/dist/src/dpp/verify/Contract/verifyContract.js +14 -0
- package/dist/src/dpp/verify/Document/verifyDocumentsProof.d.ts +3 -0
- package/dist/src/dpp/verify/Document/verifyDocumentsProof.js +10 -0
- package/dist/src/dpp/verify/Identity/verifyIdentifierByNonUniquePublicKeyHashProof.d.ts +2 -0
- package/dist/src/dpp/verify/Identity/verifyIdentifierByNonUniquePublicKeyHashProof.js +10 -0
- package/dist/src/dpp/verify/Identity/verifyIdentityBalanceProof.d.ts +2 -0
- package/dist/src/dpp/verify/Identity/verifyIdentityBalanceProof.js +9 -0
- package/dist/src/dpp/verify/Identity/verifyIdentityByIdentifierProof.d.ts +2 -0
- package/dist/src/dpp/verify/Identity/verifyIdentityByIdentifierProof.js +10 -0
- package/dist/src/dpp/verify/Identity/verifyIdentityByUniqueKeyHashProof.d.ts +2 -0
- package/dist/src/dpp/verify/Identity/verifyIdentityByUniqueKeyHashProof.js +10 -0
- package/dist/src/dpp/verify/Identity/verifyIdentityContractNonceProof.d.ts +2 -0
- package/dist/src/dpp/verify/Identity/verifyIdentityContractNonceProof.js +9 -0
- package/dist/src/dpp/verify/Identity/verifyIdentityKeysByIdentifierProof.d.ts +2 -0
- package/dist/src/dpp/verify/Identity/verifyIdentityKeysByIdentifierProof.js +10 -0
- package/dist/src/dpp/verify/Identity/verifyIdentityNonceProof.d.ts +2 -0
- package/dist/src/dpp/verify/Identity/verifyIdentityNonceProof.js +9 -0
- package/dist/src/dpp/verify/StateTransition/utils.d.ts +2 -0
- package/dist/src/dpp/verify/StateTransition/utils.js +115 -0
- package/dist/src/dpp/verify/StateTransition/verifyStateTransitionResult.d.ts +4 -0
- package/dist/src/dpp/verify/StateTransition/verifyStateTransitionResult.js +10 -0
- package/dist/src/dpp/verify/System/verifyEpochsInfoProof.d.ts +2 -0
- package/dist/src/dpp/verify/System/verifyEpochsInfoProof.js +16 -0
- package/dist/src/dpp/verify/System/verifyTotalCreditsProof.d.ts +2 -0
- package/dist/src/dpp/verify/System/verifyTotalCreditsProof.js +9 -0
- package/dist/src/dpp/verify/Tokens/verifyTokenBalancesForIdentitiesProof.d.ts +2 -0
- package/dist/src/dpp/verify/Tokens/verifyTokenBalancesForIdentitiesProof.js +13 -0
- package/dist/src/dpp/verify/Tokens/verifyTokenContractInfoProof.d.ts +2 -0
- package/dist/src/dpp/verify/Tokens/verifyTokenContractInfoProof.js +15 -0
- package/dist/src/dpp/verify/Tokens/verifyTokenDirectPurchasePrices.d.ts +2 -0
- package/dist/src/dpp/verify/Tokens/verifyTokenDirectPurchasePrices.js +14 -0
- package/dist/src/dpp/verify/Tokens/verifyTokenTotalSupplyProof.d.ts +2 -0
- package/dist/src/dpp/verify/Tokens/verifyTokenTotalSupplyProof.js +12 -0
- package/dist/src/dpp/verify/Tokens/verifyTokensBalancesForIdentityProof.d.ts +2 -0
- package/dist/src/dpp/verify/Tokens/verifyTokensBalancesForIdentityProof.js +13 -0
- package/dist/src/dpp/verify/verifySignatureDigest.d.ts +1 -0
- package/dist/src/dpp/verify/verifySignatureDigest.js +4 -0
- package/dist/src/react-native.d.ts +3 -0
- package/dist/src/react-native.js +6 -0
- package/dist/src/wasm.d.ts +3 -0
- package/dist/src/wasm.js +6 -0
- package/dist/utils/base122.d.ts +7 -0
- package/dist/utils/base122.js +63 -0
- package/package.json +30 -27
- package/tests/unit/DynamicValue.spec.ts +86 -0
- package/tests/unit/Identifier.spec.ts +105 -0
- package/tests/unit/Identity.spec.ts +119 -0
- package/tests/unit/IdentityPublicKey.spec.ts +126 -0
- package/dist/wasm/base122.d.ts +0 -1
- package/dist/wasm/base122.js +0 -67
- package/dist/wasm/index.d.ts +0 -148
- package/dist/wasm/index.js +0 -13
- package/dist/wasm/initAsync.d.ts +0 -4
- package/dist/wasm/initAsync.js +0 -20
- package/dist/wasm/initInterface.d.ts +0 -3
- package/dist/wasm/initInterface.js +0 -46
- package/dist/wasm/initWASM.d.ts +0 -1
- package/dist/wasm/initWASM.js +0 -28
- package/dist/wasm/pshenmic_dpp.d.ts +0 -5266
- package/dist/wasm/pshenmic_dpp.js +0 -25608
- package/dist/wasm/pshenmic_dpp_bg.d.ts +0 -3
- package/dist/wasm/pshenmic_dpp_bg.js +0 -2
- package/dist/wasm/pshenmic_dpp_bg.wasm.d.ts +0 -1636
- package/dist/wasm/pshenmic_dpp_zipped.d.ts +0 -3
- package/dist/wasm/pshenmic_dpp_zipped.js +0 -2
- package/dist/wasm/snippets/pshenmic_dpp_utils-23ab7381b198778d/stringify.js +0 -7
- package/tests/AssetLockProof.spec.cjs +0 -96
- package/tests/AsyncImportTest.spec.cjs +0 -930
- package/tests/AuthorizedActionTakers.spec.cjs +0 -75
- package/tests/BatchTransition.spec.cjs +0 -141
- package/tests/ChainLockProof.spec.cjs +0 -63
- package/tests/ChangeControlRules.spec.cjs +0 -184
- package/tests/CoreScript.spec.cjs +0 -37
- package/tests/DataContract.spec.cjs +0 -170
- package/tests/DataContractCreateStateTransition.spec.cjs +0 -102
- package/tests/DataContractUpdateStateTransition.spec.cjs +0 -103
- package/tests/DistributionFunction.spec.cjs +0 -416
- package/tests/Document.spec.cjs +0 -227
- package/tests/DocumentTransition.spec.cjs +0 -94
- package/tests/DocumentsTransitions.spec.cjs +0 -699
- package/tests/Identifier.spec.cjs +0 -82
- package/tests/Identity.spec.cjs +0 -107
- package/tests/IdentityCreateTransition.spec.cjs +0 -87
- package/tests/IdentityCreditTransferTransition.spec.cjs +0 -140
- package/tests/IdentityCreditWithdrawalTransition.spec.cjs +0 -186
- package/tests/IdentityPublicKey.spec.cjs +0 -166
- package/tests/IdentityTopUpTransition.spec.cjs +0 -125
- package/tests/IdentityUpdateTransition.spec.cjs +0 -141
- package/tests/InstantLockProof.spec.cjs +0 -91
- package/tests/OutPoint.spec.cjs +0 -49
- package/tests/PrivateKey.spec.cjs +0 -67
- package/tests/PublicKeyInCreation.spec.cjs +0 -252
- package/tests/RewardDistributionType.spec.cjs +0 -90
- package/tests/TokenBaseTransition.spec.cjs +0 -96
- package/tests/TokenConfiguration.spec.cjs +0 -188
- package/tests/TokenConfigurationConvention.spec.cjs +0 -93
- package/tests/TokenConfigurationLocalization.spec.cjs +0 -59
- package/tests/TokenDistributionRecipient.spec.cjs +0 -49
- package/tests/TokenDistributionRules.spec.cjs +0 -313
- package/tests/TokenKeepsHistoryRules.spec.cjs +0 -67
- package/tests/TokenPerpetualDistribution.spec.cjs +0 -130
- package/tests/TokenPreProgrammedDistribution.spec.cjs +0 -61
- package/tests/TokensTransitions.spec.cjs +0 -509
- package/tests/TxOut.spec.cjs +0 -70
- package/tests/mocks/DataContract/DataContract.json +0 -164
- package/tests/mocks/DataContract/index.js +0 -6
- package/tests/mocks/Document/DataContract.json +0 -23
- package/tests/mocks/Document/document.json +0 -3
- package/tests/mocks/Document/document2.json +0 -3
- package/tests/mocks/Document/index.js +0 -13
- package/tests/mocks/Identity/index.js +0 -13
- package/tests/mocks/Locks/index.js +0 -2
- package/tests/mocks/PrivateKey/index.js +0 -5
- package/tests/mocks/PublicKey/index.js +0 -13
- package/tests/mocks/TokenConfiguration/index.js +0 -5
- package/tests/utils/hex.js +0 -14
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { IdentifierWASM } from "../../dist/src/wasm.js";
|
|
2
|
+
|
|
3
|
+
let identifierBytes: Uint8Array;
|
|
4
|
+
|
|
5
|
+
describe("Identifier", function () {
|
|
6
|
+
beforeAll(async function () {
|
|
7
|
+
identifierBytes = Uint8Array.from([
|
|
8
|
+
9, 40, 40, 237, 192, 129, 211, 186, 26, 84, 240, 67, 37, 155, 148, 19,
|
|
9
|
+
104, 242, 199, 24, 136, 27, 6, 169, 211, 71, 136, 59, 33, 191, 227, 19,
|
|
10
|
+
]);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
describe("serialization / deserialization", function () {
|
|
14
|
+
test("should allows to create Identifier from base58", function () {
|
|
15
|
+
const identifier = IdentifierWASM.fromBase58(
|
|
16
|
+
"ckBqfQe7LU7vwrwXopyCB4n5phZShjA16BGhNGpsD5U",
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
expect(identifier.bytes()).toEqual(identifierBytes);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test("should allows to create Identifier from base64", function () {
|
|
23
|
+
const identifier = IdentifierWASM.fromBase64(
|
|
24
|
+
"CSgo7cCB07oaVPBDJZuUE2jyxxiIGwap00eIOyG/4xM=",
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
expect(identifier.bytes()).toEqual(identifierBytes);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
test("should allows to create Identifier from hex", function () {
|
|
31
|
+
const identifier = IdentifierWASM.fromHex(
|
|
32
|
+
"092828edc081d3ba1a54f043259b941368f2c718881b06a9d347883b21bfe313",
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
expect(identifier.bytes()).toEqual(identifierBytes);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test("should allows to create Identifier from bytes", function () {
|
|
39
|
+
const identifier = IdentifierWASM.fromBytes(identifierBytes);
|
|
40
|
+
|
|
41
|
+
expect(identifier.bytes()).toEqual(identifierBytes);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test("should allows to create Identifier from Identifier", function () {
|
|
45
|
+
const identifier = IdentifierWASM.fromBytes(identifierBytes);
|
|
46
|
+
const identifier2 = new IdentifierWASM(identifier);
|
|
47
|
+
|
|
48
|
+
expect(identifier2.bytes()).toEqual(identifierBytes);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test("should allows to create Identifier from bytes in constructor", function () {
|
|
52
|
+
const identifier = new IdentifierWASM(identifierBytes);
|
|
53
|
+
|
|
54
|
+
expect(identifier.bytes()).toEqual(identifierBytes);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
test("should allows to create Identifier from base58 in constructor", function () {
|
|
58
|
+
const identifier = new IdentifierWASM(
|
|
59
|
+
"ckBqfQe7LU7vwrwXopyCB4n5phZShjA16BGhNGpsD5U",
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
expect(identifier.bytes()).toEqual(identifierBytes);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
describe("getters", function () {
|
|
67
|
+
test("should allow to get identifier base58", function () {
|
|
68
|
+
const identifier = IdentifierWASM.fromBase58(
|
|
69
|
+
"ckBqfQe7LU7vwrwXopyCB4n5phZShjA16BGhNGpsD5U",
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
expect(identifier.base58()).toEqual(
|
|
73
|
+
"ckBqfQe7LU7vwrwXopyCB4n5phZShjA16BGhNGpsD5U",
|
|
74
|
+
);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
test("should allow to get identifier base64", function () {
|
|
78
|
+
const identifier = IdentifierWASM.fromBase58(
|
|
79
|
+
"ckBqfQe7LU7vwrwXopyCB4n5phZShjA16BGhNGpsD5U",
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
expect(identifier.base64()).toEqual(
|
|
83
|
+
"CSgo7cCB07oaVPBDJZuUE2jyxxiIGwap00eIOyG/4xM=",
|
|
84
|
+
);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
test("should allow to get identifier hex", function () {
|
|
88
|
+
const identifier = IdentifierWASM.fromBase58(
|
|
89
|
+
"ckBqfQe7LU7vwrwXopyCB4n5phZShjA16BGhNGpsD5U",
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
expect(identifier.hex()).toEqual(
|
|
93
|
+
"092828edc081d3ba1a54f043259b941368f2c718881b06a9d347883b21bfe313",
|
|
94
|
+
);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
test("should allow to get identifier bytes", function () {
|
|
98
|
+
const identifier = IdentifierWASM.fromBase58(
|
|
99
|
+
"ckBqfQe7LU7vwrwXopyCB4n5phZShjA16BGhNGpsD5U",
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
expect(identifier.bytes()).toEqual(identifierBytes);
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
});
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import {IdentifierWASM, IdentityWASM, PlatformVersionWASM, IdentityPublicKeyWASM} from '../../dist/src/wasm.js'
|
|
2
|
+
|
|
3
|
+
let identifierBytes: Uint8Array
|
|
4
|
+
let identifier: IdentifierWASM
|
|
5
|
+
|
|
6
|
+
describe('Identity', function () {
|
|
7
|
+
beforeAll(function () {
|
|
8
|
+
identifierBytes = Uint8Array.from([9, 40, 40, 237, 192, 129, 211, 186, 26, 84, 240, 67, 37, 155, 148, 19, 104, 242, 199, 24, 136, 27, 6, 169, 211, 71, 136, 59, 33, 191, 227, 19])
|
|
9
|
+
identifier = new IdentifierWASM(identifierBytes)
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
describe('serialization / deserialization', function () {
|
|
13
|
+
test('should generate identity from identifier str', async function () {
|
|
14
|
+
const identity = new IdentityWASM('HEAmUtC72dPcZ59yyLUgfS8pfrEWqzYfDPzTofgWxXRr')
|
|
15
|
+
|
|
16
|
+
expect(identity).toBeInstanceOf(IdentityWASM)
|
|
17
|
+
expect(identity.id.base58()).toEqual('HEAmUtC72dPcZ59yyLUgfS8pfrEWqzYfDPzTofgWxXRr')
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
test('should generate identity from identifier bytes ', async function () {
|
|
21
|
+
const identity = new IdentityWASM(identifierBytes)
|
|
22
|
+
|
|
23
|
+
expect(identity.id.base58()).toEqual(identifier.base58())
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
test('should generate identity from identifier bytes with PlatformVersion', async function () {
|
|
27
|
+
const identity = new IdentityWASM(identifierBytes, PlatformVersionWASM.PLATFORM_V10)
|
|
28
|
+
|
|
29
|
+
expect(identity.id.base58()).toEqual(identifier.base58())
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
test('should generate identity from identifier and return bytes', async function () {
|
|
33
|
+
const identity = new IdentityWASM(identifier)
|
|
34
|
+
|
|
35
|
+
const newIdentity = IdentityWASM.fromBytes(identity.bytes())
|
|
36
|
+
|
|
37
|
+
expect(identity.id.base58()).toEqual(newIdentity.id.base58())
|
|
38
|
+
})
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
describe('getters', function () {
|
|
42
|
+
test('should get id buffer', function () {
|
|
43
|
+
const identity = new IdentityWASM(identifier)
|
|
44
|
+
|
|
45
|
+
expect(identity.id.bytes()).toEqual(identifierBytes)
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
test('should get balance', function () {
|
|
49
|
+
const identity = new IdentityWASM(identifier)
|
|
50
|
+
|
|
51
|
+
expect(identity.balance).toEqual(BigInt(0))
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
test('should get revision', function () {
|
|
55
|
+
const identity = new IdentityWASM(identifier)
|
|
56
|
+
|
|
57
|
+
expect(identity.revision).toEqual(BigInt(0))
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
test('should get public keys', function () {
|
|
61
|
+
const identity = new IdentityWASM(identifier)
|
|
62
|
+
|
|
63
|
+
const pubKey = new IdentityPublicKeyWASM(
|
|
64
|
+
0,
|
|
65
|
+
0,
|
|
66
|
+
0,
|
|
67
|
+
0,
|
|
68
|
+
false,
|
|
69
|
+
'036a394312e40e81d928fde2bde7880070e4fa9c1d1d9b168da707ea468afa2b48')
|
|
70
|
+
|
|
71
|
+
const pubKey2 = new IdentityPublicKeyWASM(
|
|
72
|
+
1,
|
|
73
|
+
0,
|
|
74
|
+
0,
|
|
75
|
+
0,
|
|
76
|
+
false,
|
|
77
|
+
'036a394312e40e81d928fde2bde7880070e4fa9c1d1d9b168da707ea468afa2b48')
|
|
78
|
+
|
|
79
|
+
identity.addPublicKey(pubKey)
|
|
80
|
+
identity.addPublicKey(pubKey2)
|
|
81
|
+
|
|
82
|
+
expect(identity.getPublicKeys().length).toEqual(2)
|
|
83
|
+
})
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
describe('setters', function () {
|
|
87
|
+
test('should allows to set public key', function () {
|
|
88
|
+
const pubKey = new IdentityPublicKeyWASM(
|
|
89
|
+
0,
|
|
90
|
+
0,
|
|
91
|
+
0,
|
|
92
|
+
0,
|
|
93
|
+
false,
|
|
94
|
+
'036a394312e40e81d928fde2bde7880070e4fa9c1d1d9b168da707ea468afa2b48')
|
|
95
|
+
|
|
96
|
+
const identity = new IdentityWASM(identifier)
|
|
97
|
+
|
|
98
|
+
identity.addPublicKey(pubKey)
|
|
99
|
+
|
|
100
|
+
expect(identity.getPublicKeyById(0)?.bytes()).toEqual(pubKey.bytes())
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
test('should allows to set balance', function () {
|
|
104
|
+
const identity = new IdentityWASM(identifier)
|
|
105
|
+
|
|
106
|
+
identity.balance = BigInt(21)
|
|
107
|
+
|
|
108
|
+
expect(identity.balance).toEqual(BigInt(21))
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
test('should allows to set revision', function () {
|
|
112
|
+
const identity = new IdentityWASM(identifier)
|
|
113
|
+
|
|
114
|
+
identity.revision = BigInt(21)
|
|
115
|
+
|
|
116
|
+
expect(identity.revision).toEqual(BigInt(21))
|
|
117
|
+
})
|
|
118
|
+
})
|
|
119
|
+
})
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import {IdentityPublicKeyWASM, Purpose, SecurityLevel, KeyType} from '../../dist/src/wasm.js'
|
|
2
|
+
|
|
3
|
+
let keyId: number
|
|
4
|
+
let purpose: Purpose
|
|
5
|
+
let securityLevel: SecurityLevel
|
|
6
|
+
let keyType: KeyType
|
|
7
|
+
let binaryData: string
|
|
8
|
+
|
|
9
|
+
describe('PublicKey', function () {
|
|
10
|
+
beforeAll(function () {
|
|
11
|
+
keyId = 0
|
|
12
|
+
purpose = Purpose.DECRYPTION
|
|
13
|
+
securityLevel = SecurityLevel.HIGH
|
|
14
|
+
keyType = KeyType.ECDSA_SECP256K1
|
|
15
|
+
binaryData = '036a394312e40e81d928fde2bde7880070e4fa9c1d1d9b168da707ea468afa2b48'
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
describe('serialization / deserialization', function () {
|
|
19
|
+
test('should generate public key from values with type ECDSA_SECP256K1', function () {
|
|
20
|
+
const pubKey = new IdentityPublicKeyWASM(
|
|
21
|
+
keyId,
|
|
22
|
+
purpose,
|
|
23
|
+
securityLevel,
|
|
24
|
+
keyType,
|
|
25
|
+
false,
|
|
26
|
+
binaryData)
|
|
27
|
+
|
|
28
|
+
expect(pubKey.data).toEqual(binaryData)
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
test('should generate public key from values with type ECDSA_SECP256K1 and generate new from self bytes', function () {
|
|
32
|
+
const pubKey = new IdentityPublicKeyWASM(
|
|
33
|
+
keyId,
|
|
34
|
+
purpose,
|
|
35
|
+
securityLevel,
|
|
36
|
+
keyType,
|
|
37
|
+
false,
|
|
38
|
+
binaryData)
|
|
39
|
+
|
|
40
|
+
const bytes = pubKey.bytes()
|
|
41
|
+
|
|
42
|
+
const newPubKey = IdentityPublicKeyWASM.fromBytes(bytes)
|
|
43
|
+
|
|
44
|
+
expect(pubKey.keyId).toEqual(newPubKey.keyId)
|
|
45
|
+
expect(pubKey.purpose).toEqual(newPubKey.purpose)
|
|
46
|
+
expect(pubKey.securityLevel).toEqual(newPubKey.securityLevel)
|
|
47
|
+
expect(pubKey.keyType).toEqual(newPubKey.keyType)
|
|
48
|
+
expect(pubKey.readOnly).toEqual(newPubKey.readOnly)
|
|
49
|
+
expect(pubKey.data).toEqual(newPubKey.data)
|
|
50
|
+
|
|
51
|
+
expect(pubKey.bytes()).toEqual(newPubKey.bytes())
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
test('should return hash of key', function () {
|
|
55
|
+
const pubKey = new IdentityPublicKeyWASM(
|
|
56
|
+
keyId,
|
|
57
|
+
purpose,
|
|
58
|
+
securityLevel,
|
|
59
|
+
keyType,
|
|
60
|
+
false,
|
|
61
|
+
binaryData)
|
|
62
|
+
|
|
63
|
+
const hash = pubKey.getPublicKeyHash()
|
|
64
|
+
|
|
65
|
+
expect(hash).toEqual('d372f096259f72686e18663d7db5f86234dd6f55')
|
|
66
|
+
})
|
|
67
|
+
})
|
|
68
|
+
describe('getters', function () {
|
|
69
|
+
test('should generate public key from values with type ECDSA_SECP256K1 and return all fields', function () {
|
|
70
|
+
const pubKey = new IdentityPublicKeyWASM(
|
|
71
|
+
keyId,
|
|
72
|
+
purpose,
|
|
73
|
+
securityLevel,
|
|
74
|
+
keyType,
|
|
75
|
+
false,
|
|
76
|
+
binaryData)
|
|
77
|
+
|
|
78
|
+
expect(pubKey.keyId).toEqual(keyId)
|
|
79
|
+
expect(pubKey.purpose).toEqual('DECRYPTION')
|
|
80
|
+
expect(pubKey.securityLevel).toEqual('HIGH')
|
|
81
|
+
expect(pubKey.keyType).toEqual('ECDSA_SECP256K1')
|
|
82
|
+
expect(pubKey.readOnly).toEqual(false)
|
|
83
|
+
expect(pubKey.data).toEqual(binaryData)
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
// test('should allow to validate private key', function () {
|
|
87
|
+
// const pubKey = new IdentityPublicKeyWASM(
|
|
88
|
+
// keyId,
|
|
89
|
+
// purpose,
|
|
90
|
+
// securityLevel,
|
|
91
|
+
// keyType,
|
|
92
|
+
// false,
|
|
93
|
+
// binaryData)
|
|
94
|
+
//
|
|
95
|
+
// const privateKey = PrivateKeyWASM.fromWIF(wif)
|
|
96
|
+
//
|
|
97
|
+
// assert.equal(pubKey.validatePrivateKey(privateKey.bytes(), NetworkWASM.Mainnet), false)
|
|
98
|
+
// })
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
describe('setters', function () {
|
|
102
|
+
test('should generate public key from values with type ECDSA_SECP256K1 and return all fields and set another fields', function () {
|
|
103
|
+
const pubKey = new IdentityPublicKeyWASM(
|
|
104
|
+
keyId,
|
|
105
|
+
purpose,
|
|
106
|
+
securityLevel,
|
|
107
|
+
keyType,
|
|
108
|
+
false,
|
|
109
|
+
binaryData)
|
|
110
|
+
|
|
111
|
+
pubKey.keyId = 1
|
|
112
|
+
pubKey.purpose = Purpose.TRANSFER
|
|
113
|
+
pubKey.securityLevel = SecurityLevel.MEDIUM
|
|
114
|
+
pubKey.keyType = KeyType.EDDSA_25519_HASH160
|
|
115
|
+
pubKey.readOnly = true
|
|
116
|
+
pubKey.data = '111a394312e40e81d928fde2bde7880070e4fa9c1d1d9b168da707ea468afa2b48'
|
|
117
|
+
|
|
118
|
+
expect(pubKey.keyId).toEqual(1)
|
|
119
|
+
expect(pubKey.purpose).toEqual('TRANSFER')
|
|
120
|
+
expect(pubKey.securityLevel).toEqual('MEDIUM')
|
|
121
|
+
expect(pubKey.keyType).toEqual('EDDSA_25519_HASH160')
|
|
122
|
+
expect(pubKey.readOnly).toEqual(true)
|
|
123
|
+
expect(pubKey.data).toEqual('111a394312e40e81d928fde2bde7880070e4fa9c1d1d9b168da707ea468afa2b48')
|
|
124
|
+
})
|
|
125
|
+
})
|
|
126
|
+
})
|
package/dist/wasm/base122.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export function decodeBase122 (base122: Uint8Array | string): Uint8Array;
|
package/dist/wasm/base122.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
// Original code: https://github.com/kevinAlbs/Base122
|
|
2
|
-
|
|
3
|
-
// Provides functions for encoding/decoding data to and from base-122.
|
|
4
|
-
|
|
5
|
-
const kIllegals = [
|
|
6
|
-
0, // null
|
|
7
|
-
10, // newline
|
|
8
|
-
13, // carriage return
|
|
9
|
-
34, // double quote
|
|
10
|
-
38, // ampersand
|
|
11
|
-
92 // backslash
|
|
12
|
-
]
|
|
13
|
-
const kShortened = 0b111 // Uses the illegal index to signify the last two-byte char encodes <= 7 bits.
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Decodes base-122 encoded data back to the original data.
|
|
17
|
-
* @param {Uint8Array|String} rawData - The data to be decoded. This can be a Uint8Array
|
|
18
|
-
* with raw data bytes or a string of bytes (i.e. the type of argument to btoa())
|
|
19
|
-
* @returns {Uint8Array} The data in a regular array representing byte values.
|
|
20
|
-
*/
|
|
21
|
-
export function decode (base122Data) {
|
|
22
|
-
const strData = typeof (base122Data) === 'string' ? base122Data : utf8DataToString(base122Data)
|
|
23
|
-
const decoded = []
|
|
24
|
-
let curByte = 0
|
|
25
|
-
let bitOfByte = 0
|
|
26
|
-
|
|
27
|
-
function push7 (byte) {
|
|
28
|
-
byte <<= 1
|
|
29
|
-
// Align this byte to offset for current byte.
|
|
30
|
-
curByte |= (byte >>> bitOfByte)
|
|
31
|
-
bitOfByte += 7
|
|
32
|
-
if (bitOfByte >= 8) {
|
|
33
|
-
decoded.push(curByte)
|
|
34
|
-
bitOfByte -= 8
|
|
35
|
-
// Now, take the remainder, left shift by what has been taken.
|
|
36
|
-
curByte = (byte << (7 - bitOfByte)) & 255
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
for (let i = 0; i < strData.length; i++) {
|
|
41
|
-
const c = strData.charCodeAt(i)
|
|
42
|
-
// Check if this is a two-byte character.
|
|
43
|
-
if (c > 127) {
|
|
44
|
-
// Note, the charCodeAt will give the codePoint, thus
|
|
45
|
-
// 0b110xxxxx 0b10yyyyyy will give => xxxxxyyyyyy
|
|
46
|
-
const illegalIndex = (c >>> 8) & 7 // 7 = 0b111.
|
|
47
|
-
// We have to first check if this is a shortened two-byte character, i.e. if it only
|
|
48
|
-
// encodes <= 7 bits.
|
|
49
|
-
if (illegalIndex !== kShortened) push7(kIllegals[illegalIndex])
|
|
50
|
-
// Always push the rest.
|
|
51
|
-
push7(c & 127)
|
|
52
|
-
} else {
|
|
53
|
-
// One byte characters can be pushed directly.
|
|
54
|
-
push7(c)
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return new Uint8Array(decoded)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Converts a sequence of UTF-8 bytes to a string.
|
|
62
|
-
* @param {Uint8Array} data - The UTF-8 data.
|
|
63
|
-
* @returns {String} A string with each character representing a code point.
|
|
64
|
-
*/
|
|
65
|
-
function utf8DataToString (data) {
|
|
66
|
-
return new TextDecoder().decode(data)
|
|
67
|
-
}
|
package/dist/wasm/index.d.ts
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import * as DPP from './pshenmic_dpp.js';
|
|
2
|
-
import type{
|
|
3
|
-
AddressCreditWithdrawalTransitionWASM, AddressFundingFromAssetLockTransitionWASM,
|
|
4
|
-
AddressFundsFeeStrategyStepWASM, AddressFundsTransferTransitionWASM, AddressWitnessWASM,
|
|
5
|
-
IdentityCreateFromAddressesTransitionWASM, IdentityCreditTransferToAddressesTransitionWASM,
|
|
6
|
-
IdentityTopUpFromAddressesTransitionWASM, InputAddressWASM, OutputAddressWASM,
|
|
7
|
-
PlatformAddressWASM, RecipientAddressWASM
|
|
8
|
-
} from "../wasm/pshenmic_dpp.d.ts";
|
|
9
|
-
|
|
10
|
-
export * from './pshenmic_dpp.js';
|
|
11
|
-
|
|
12
|
-
export * from './base122.js';
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
declare const dpp: DashPlatformProtocolWASM;
|
|
16
|
-
export default dpp;
|
|
17
|
-
|
|
18
|
-
export class DashPlatformProtocolWASM {
|
|
19
|
-
// CLASSES
|
|
20
|
-
AssetLockProofWASM: DPP.AssetLockProofWASM
|
|
21
|
-
ChainAssetLockProofWASM: DPP.ChainAssetLockProofWASM
|
|
22
|
-
CoreScriptWASM: DPP.CoreScriptWASM
|
|
23
|
-
DataContractCreateTransitionWASM: DPP.DataContractCreateTransitionWASM
|
|
24
|
-
DataContractUpdateTransitionWASM: DPP.DataContractUpdateTransitionWASM
|
|
25
|
-
DataContractWASM: DPP.DataContractWASM
|
|
26
|
-
DocumentBaseTransitionWASM: DPP.DocumentBaseTransitionWASM
|
|
27
|
-
DocumentCreateTransitionWASM: DPP.DocumentCreateTransitionWASM
|
|
28
|
-
DocumentDeleteTransitionWASM: DPP.DocumentDeleteTransitionWASM
|
|
29
|
-
DocumentPurchaseTransitionWASM: DPP.DocumentPurchaseTransitionWASM
|
|
30
|
-
DocumentReplaceTransitionWASM: DPP.DocumentReplaceTransitionWASM
|
|
31
|
-
DocumentTransferTransitionWASM: DPP.DocumentTransferTransitionWASM
|
|
32
|
-
DocumentTransitionWASM: DPP.DocumentTransitionWASM
|
|
33
|
-
DocumentUpdatePriceTransitionWASM: DPP.DocumentUpdatePriceTransitionWASM
|
|
34
|
-
DocumentWASM: DPP.DocumentWASM
|
|
35
|
-
BatchTransitionWASM: DPP.BatchTransitionWASM
|
|
36
|
-
BatchedTransitionWASM: DPP.BatchedTransitionWASM
|
|
37
|
-
TokenTransitionWASM: DPP.TokenTransitionWASM
|
|
38
|
-
TokenBaseTransitionWASM: DPP.TokenBaseTransitionWASM
|
|
39
|
-
TokenPricingScheduleWASM: DPP.TokenPricingScheduleWASM
|
|
40
|
-
TokenConfigUpdateTransitionWASM: DPP.TokenConfigUpdateTransitionWASM
|
|
41
|
-
TokenDirectPurchaseTransitionWASM: DPP.TokenDirectPurchaseTransitionWASM
|
|
42
|
-
TokenSetPriceForDirectPurchaseTransitionWASM: DPP.TokenSetPriceForDirectPurchaseTransitionWASM
|
|
43
|
-
TokenBurnTransitionWASM: DPP.TokenBurnTransitionWASM
|
|
44
|
-
TokenClaimTransitionWASM: DPP.TokenClaimTransitionWASM
|
|
45
|
-
TokenDestroyFrozenFundsTransitionWASM: DPP.TokenDestroyFrozenFundsTransitionWASM
|
|
46
|
-
TokenEmergencyActionTransitionWASM: DPP.TokenEmergencyActionTransitionWASM
|
|
47
|
-
TokenFreezeTransitionWASM: DPP.TokenFreezeTransitionWASM
|
|
48
|
-
TokenMintTransitionWASM: DPP.TokenMintTransitionWASM
|
|
49
|
-
TokenTransferTransitionWASM: DPP.TokenTransferTransitionWASM
|
|
50
|
-
TokenUnFreezeTransitionWASM: DPP.TokenUnFreezeTransitionWASM
|
|
51
|
-
GroupStateTransitionInfoWASM: DPP.GroupStateTransitionInfoWASM
|
|
52
|
-
PrivateEncryptedNoteWASM: DPP.PrivateEncryptedNoteWASM
|
|
53
|
-
SharedEncryptedNoteWASM: DPP.SharedEncryptedNoteWASM
|
|
54
|
-
TokenConfigurationChangeItemWASM: DPP.TokenConfigurationChangeItemWASM
|
|
55
|
-
AuthorizedActionTakersWASM: DPP.AuthorizedActionTakersWASM
|
|
56
|
-
DistributionFunctionWASM: DPP.DistributionFunctionWASM
|
|
57
|
-
TokenDistributionRecipientWASM: DPP.TokenDistributionRecipientWASM
|
|
58
|
-
DistributionFixedAmountWASM: DPP.DistributionFixedAmountWASM
|
|
59
|
-
DistributionRandomWASM: DPP.DistributionRandomWASM
|
|
60
|
-
DistributionStepDecreasingAmountWASM: DPP.DistributionStepDecreasingAmountWASM
|
|
61
|
-
DistributionLinearWASM: DPP.DistributionLinearWASM
|
|
62
|
-
DistributionPolynomialWASM: DPP.DistributionPolynomialWASM
|
|
63
|
-
DistributionExponentialWASM: DPP.DistributionExponentialWASM
|
|
64
|
-
DistributionLogarithmicWASM: DPP.DistributionLogarithmicWASM
|
|
65
|
-
DistributionInvertedLogarithmicWASM: DPP.DistributionInvertedLogarithmicWASM
|
|
66
|
-
TokenConfigurationLocalizationWASM: DPP.TokenConfigurationLocalizationWASM
|
|
67
|
-
TokenPerpetualDistributionWASM: DPP.TokenPerpetualDistributionWASM
|
|
68
|
-
RewardDistributionTypeWASM: DPP.RewardDistributionTypeWASM
|
|
69
|
-
TokenConfigurationConventionWASM: DPP.TokenConfigurationConventionWASM
|
|
70
|
-
TokenTradeModeWASM: DPP.TokenTradeModeWASM
|
|
71
|
-
TokenConfigurationWASM: DPP.TokenConfigurationWASM
|
|
72
|
-
ActionTakerWASM: DPP.ActionTakerWASM
|
|
73
|
-
ChangeControlRulesWASM: DPP.ChangeControlRulesWASM
|
|
74
|
-
TokenDistributionRulesWASM: DPP.TokenDistributionRulesWASM
|
|
75
|
-
GroupWASM: DPP.GroupWASM
|
|
76
|
-
TokenKeepsHistoryRulesWASM: DPP.TokenKeepsHistoryRulesWASM
|
|
77
|
-
TokenMarketplaceRulesWASM: DPP.TokenMarketplaceRulesWASM
|
|
78
|
-
TokenPreProgrammedDistributionWASM: DPP.TokenPreProgrammedDistributionWASM
|
|
79
|
-
IdentifierWASM: DPP.IdentifierWASM
|
|
80
|
-
IdentityCreateTransitionWASM: DPP.IdentityCreateTransitionWASM
|
|
81
|
-
IdentityCreditTransferWASM: DPP.IdentityCreditTransferWASM
|
|
82
|
-
IdentityCreditWithdrawalTransitionWASM: DPP.IdentityCreditWithdrawalTransitionWASM
|
|
83
|
-
IdentityPublicKeyInCreationWASM: DPP.IdentityPublicKeyInCreationWASM
|
|
84
|
-
IdentityPublicKeyWASM: DPP.IdentityPublicKeyWASM
|
|
85
|
-
ContractBoundsWASM: DPP.ContractBoundsWASM
|
|
86
|
-
IdentityTopUpTransitionWASM: DPP.IdentityTopUpTransitionWASM
|
|
87
|
-
IdentityUpdateTransitionWASM: DPP.IdentityUpdateTransitionWASM
|
|
88
|
-
IdentityWASM: DPP.IdentityWASM
|
|
89
|
-
InstantAssetLockProofWASM: DPP.InstantAssetLockProofWASM
|
|
90
|
-
InstantLockWASM: DPP.InstantLockWASM
|
|
91
|
-
OutPointWASM: DPP.OutPointWASM
|
|
92
|
-
PrefundedVotingBalanceWASM: DPP.PrefundedVotingBalanceWASM
|
|
93
|
-
PrivateKeyWASM: DPP.PrivateKeyWASM
|
|
94
|
-
StateTransitionWASM: DPP.StateTransitionWASM
|
|
95
|
-
TxOutWASM: DPP.TxOutWASM
|
|
96
|
-
TxInWASM: DPP.TxInWASM
|
|
97
|
-
WitnessWASM: DPP.WitnessWASM
|
|
98
|
-
TransactionWASM: DPP.TransactionWASM
|
|
99
|
-
MasternodeVoteTransitionWASM: DPP.MasternodeVoteTransitionWASM
|
|
100
|
-
VoteWASM: DPP.VoteWASM
|
|
101
|
-
VotePollWASM: DPP.VotePollWASM
|
|
102
|
-
ResourceVoteChoiceWASM: DPP.ResourceVoteChoiceWASM
|
|
103
|
-
AddressCreditWithdrawalTransitionWASM: DPP.AddressCreditWithdrawalTransitionWASM
|
|
104
|
-
AddressFundingFromAssetLockTransitionWASM: DPP.AddressFundingFromAssetLockTransitionWASM
|
|
105
|
-
AddressFundsFeeStrategyStepWASM: DPP.AddressFundsFeeStrategyStepWASM
|
|
106
|
-
AddressFundsTransferTransitionWASM: DPP.AddressFundsTransferTransitionWASM
|
|
107
|
-
IdentityCreateFromAddressesTransitionWASM: DPP.IdentityCreateFromAddressesTransitionWASM
|
|
108
|
-
IdentityCreditTransferToAddressesTransitionWASM: DPP.IdentityCreditTransferToAddressesTransitionWASM
|
|
109
|
-
OutputAddressWASM: DPP.OutputAddressWASM
|
|
110
|
-
InputAddressWASM: DPP.InputAddressWASM
|
|
111
|
-
IdentityTopUpFromAddressesTransitionWASM: DPP.IdentityTopUpFromAddressesTransitionWASM
|
|
112
|
-
RecipientAddressWASM: DPP.RecipientAddressWASM
|
|
113
|
-
AddressWitnessWASM: DPP.AddressWitnessWASM
|
|
114
|
-
PlatformAddressWASM: DPP.PlatformAddressWASM
|
|
115
|
-
|
|
116
|
-
// ENUMS
|
|
117
|
-
AssetLockProofTypeWASM: DPP.AssetLockProofTypeWASM
|
|
118
|
-
BatchType: DPP.BatchType
|
|
119
|
-
KeyType: DPP.KeyType
|
|
120
|
-
NetworkWASM: DPP.NetworkWASM
|
|
121
|
-
PlatformVersionWASM: DPP.PlatformVersionWASM
|
|
122
|
-
PoolingWASM: DPP.PoolingWASM
|
|
123
|
-
Purpose: DPP.Purpose
|
|
124
|
-
SecurityLevel: DPP.SecurityLevel
|
|
125
|
-
ActionGoalWASM: DPP.ActionGoalWASM
|
|
126
|
-
GroupActionStatusWASM: DPP.GroupActionStatusWASM
|
|
127
|
-
// METHODS
|
|
128
|
-
initSync: Function
|
|
129
|
-
verifyVotePollVoteStateProof: Function
|
|
130
|
-
verifyContract: Function
|
|
131
|
-
verifyDocumentsProof: Function
|
|
132
|
-
verifyIdentifierByNonUniquePublicKeyHash: Function
|
|
133
|
-
verifyIdentityBalance: Function
|
|
134
|
-
verifyIdentityByIdentifier: Function
|
|
135
|
-
verifyIdentityByUniqueKeyHash: Function
|
|
136
|
-
verifyIdentityContractNonce: Function
|
|
137
|
-
verifyIdentityKeysByIdentifier: Function
|
|
138
|
-
verifyIdentityNonce: Function
|
|
139
|
-
verifySignatureDigest: Function
|
|
140
|
-
verifyEpochsInfo: Function
|
|
141
|
-
verifyTotalCredits: Function
|
|
142
|
-
verifyTokenBalancesForIdentities: Function
|
|
143
|
-
verifyTokenContractInfo: Function
|
|
144
|
-
verifyTokenTotalSupply: Function
|
|
145
|
-
verifyTokensBalancesForIdentity: Function
|
|
146
|
-
verifyTokenDirectPurchasePrices: Function
|
|
147
|
-
verifyStateTransitionResult: Function
|
|
148
|
-
}
|
package/dist/wasm/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as DPP from './pshenmic_dpp.js'
|
|
2
|
-
import { bytes as wasmBytes } from './pshenmic_dpp_bg.js'
|
|
3
|
-
import { decode } from './base122.js'
|
|
4
|
-
import { decompressSync } from 'fflate'
|
|
5
|
-
|
|
6
|
-
export * from './base122.js'
|
|
7
|
-
export * from './pshenmic_dpp.js'
|
|
8
|
-
|
|
9
|
-
const bytes = new Uint8Array(decode(wasmBytes))
|
|
10
|
-
|
|
11
|
-
DPP.initSync({ module: decompressSync(bytes) })
|
|
12
|
-
|
|
13
|
-
export default DPP
|
package/dist/wasm/initAsync.d.ts
DELETED
package/dist/wasm/initAsync.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import {initWASM} from './initWASM.js'
|
|
2
|
-
import {initInterface} from './initInterface.js'
|
|
3
|
-
|
|
4
|
-
// eslint-disable-next-line
|
|
5
|
-
let dpp
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Asynchronously initialization for compressed module (reduced size)
|
|
9
|
-
* @returns {Promise<*>}
|
|
10
|
-
*/
|
|
11
|
-
async function initModule() {
|
|
12
|
-
const wasm = await initWASM()
|
|
13
|
-
const wasmInterface = await initInterface()
|
|
14
|
-
|
|
15
|
-
dpp = wasmInterface.initSync(wasm)
|
|
16
|
-
|
|
17
|
-
return wasmInterface
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export {initModule}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import {bytes as wasmInterfaceBytes} from './pshenmic_dpp_zipped.js'
|
|
2
|
-
import { decode } from './base122.js'
|
|
3
|
-
|
|
4
|
-
export * from './base122.js'
|
|
5
|
-
|
|
6
|
-
const isNode = () =>
|
|
7
|
-
typeof process !== 'undefined' &&
|
|
8
|
-
!!process.versions &&
|
|
9
|
-
!!process.versions.node
|
|
10
|
-
|
|
11
|
-
const interfaceBytes = new Uint8Array(decode(wasmInterfaceBytes))
|
|
12
|
-
const interfaceBlob = new Blob([interfaceBytes])
|
|
13
|
-
|
|
14
|
-
async function initInterface () {
|
|
15
|
-
const decompressionStream = new DecompressionStream('gzip')
|
|
16
|
-
const decompressedStream = interfaceBlob.stream().pipeThrough(decompressionStream)
|
|
17
|
-
const decompressedResponse = new Response(decompressedStream)
|
|
18
|
-
const moduleText = await decompressedResponse.text()
|
|
19
|
-
|
|
20
|
-
let module
|
|
21
|
-
if (isNode()) {
|
|
22
|
-
const vm = await import('vm')
|
|
23
|
-
|
|
24
|
-
const context = vm.createContext({
|
|
25
|
-
crypto,
|
|
26
|
-
TextDecoder,
|
|
27
|
-
TextEncoder
|
|
28
|
-
})
|
|
29
|
-
const vmModule = new vm.Script(moduleText)
|
|
30
|
-
|
|
31
|
-
vmModule.runInContext(context)
|
|
32
|
-
|
|
33
|
-
module = context['pshenmic-dpp']
|
|
34
|
-
} else {
|
|
35
|
-
const blob = new Blob([moduleText], { type: 'application/javascript' })
|
|
36
|
-
const moduleUrl = URL.createObjectURL(blob)
|
|
37
|
-
|
|
38
|
-
module = await import(moduleUrl)
|
|
39
|
-
|
|
40
|
-
URL.revokeObjectURL(moduleUrl)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return module
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export { initInterface }
|
package/dist/wasm/initWASM.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export function initWASM(): Promise<ArrayBuffer>;
|