pshenmic-dpp 1.1.2-dev.8 → 2.0.0-dev.10
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 +1721 -0
- package/dist/binaries/bindingsTypes.js +99 -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 +171 -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 +171 -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 +112 -0
- package/dist/src/dpp/dpp.js +112 -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/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 +15 -0
- package/dist/src/dpp/structs/AddressTransitions/entities/InputAddress.js +33 -0
- package/dist/src/dpp/structs/AddressTransitions/entities/OutputAddress.d.ts +13 -0
- package/dist/src/dpp/structs/AddressTransitions/entities/OutputAddress.js +27 -0
- package/dist/src/dpp/structs/AddressTransitions/entities/OutputAddressNullableCredits.d.ts +13 -0
- package/dist/src/dpp/structs/AddressTransitions/entities/OutputAddressNullableCredits.js +30 -0
- package/dist/src/dpp/structs/AssetLockProof/AssetLockProof.d.ts +19 -0
- package/dist/src/dpp/structs/AssetLockProof/AssetLockProof.js +50 -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 +14 -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 +33 -0
- package/dist/src/dpp/structs/Batch/DocumentTransition.js +77 -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 +21 -0
- package/dist/src/dpp/structs/Batch/TokenTransition.js +95 -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 +24 -0
- package/dist/src/dpp/structs/Batch/TokenTransitions/TokenTransferTransition.js +60 -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 +38 -0
- package/dist/src/dpp/structs/DataContract.js +125 -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 +44 -0
- package/dist/src/dpp/structs/IdentityPublicKey.js +131 -0
- package/dist/src/dpp/structs/IdentityPublicKeyInCreation.d.ts +31 -0
- package/dist/src/dpp/structs/IdentityPublicKeyInCreation.js +82 -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/PlatformAddress/AddressWitness.d.ts +12 -0
- package/dist/src/dpp/structs/PlatformAddress/AddressWitness.js +23 -0
- package/dist/src/dpp/structs/PlatformAddress/PlatformAddress.d.ts +16 -0
- package/dist/src/dpp/structs/PlatformAddress/PlatformAddress.js +38 -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 +39 -0
- package/dist/src/dpp/structs/StateTransition.js +103 -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 +284 -0
- package/dist/src/dpp/types.js +1 -0
- package/dist/src/dpp/utils.d.ts +6 -0
- package/dist/src/dpp/utils.js +96 -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/PlatformAddress/verifyPlatformAddressInfo.d.ts +2 -0
- package/dist/src/dpp/verify/PlatformAddress/verifyPlatformAddressInfo.js +12 -0
- package/dist/src/dpp/verify/PlatformAddress/verifyPlatformAddressesInfos.d.ts +2 -0
- package/dist/src/dpp/verify/PlatformAddress/verifyPlatformAddressesInfos.js +14 -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 +126 -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,115 @@
|
|
|
1
|
+
import { DataContractWASM } from '../../structs/DataContract.js';
|
|
2
|
+
import { IdentityWASM } from '../../structs/Identity.js';
|
|
3
|
+
import { IdentifierWASM } from '../../structs/Identifier.js';
|
|
4
|
+
import { TokenPricingScheduleWASM } from '../../structs/Batch/TokenPricingSchedule.js';
|
|
5
|
+
import { PartialIdentityWASM } from '../../structs/PartialIdentity.js';
|
|
6
|
+
import { VoteWASM } from '../../structs/MasternodeVote/Vote.js';
|
|
7
|
+
import { DocumentWASM } from '../../structs/Document.js';
|
|
8
|
+
import { PlatformAddressWASM } from '../../structs/PlatformAddress/PlatformAddress.js';
|
|
9
|
+
import { dppProvider } from '../../provider.js';
|
|
10
|
+
const converters = () => {
|
|
11
|
+
return new Map([
|
|
12
|
+
[dppProvider.dpp.DataContractNAPI, v => DataContractWASM.createFromRawInstance(v)],
|
|
13
|
+
[dppProvider.dpp.IdentityNAPI, v => IdentityWASM.createFromRawInstance(v)],
|
|
14
|
+
[dppProvider.dpp.IdentifierNAPI, v => IdentifierWASM.createFromRawInstance(v)],
|
|
15
|
+
[dppProvider.dpp.PartialIdentityNAPI, v => PartialIdentityWASM.createFromRawInstance(v)],
|
|
16
|
+
[dppProvider.dpp.DocumentNAPI, v => DocumentWASM.createFromRawInstance(v)],
|
|
17
|
+
[dppProvider.dpp.VoteNAPI, v => VoteWASM.createFromRawInstance(v)],
|
|
18
|
+
[dppProvider.dpp.IdentityTokenBalanceNAPI, (v) => ({
|
|
19
|
+
id: IdentifierWASM.createFromRawInstance(v.id),
|
|
20
|
+
balance: BigInt(v.balance)
|
|
21
|
+
})],
|
|
22
|
+
[dppProvider.dpp.VerifiedIdentityTokenInfoNAPI, (v) => ({
|
|
23
|
+
tokenId: IdentifierWASM.createFromRawInstance(v.id),
|
|
24
|
+
identityTokenInfo: {
|
|
25
|
+
frozen: v.identityTokenInfo.frozen
|
|
26
|
+
}
|
|
27
|
+
})],
|
|
28
|
+
[dppProvider.dpp.VerifiedTokenPricingScheduleNAPI, (v) => ({
|
|
29
|
+
tokenId: IdentifierWASM.createFromRawInstance(v.id),
|
|
30
|
+
pricingSchedule: v.pricingSchedule != null
|
|
31
|
+
? TokenPricingScheduleWASM.createFromRawInstance(v.pricingSchedule)
|
|
32
|
+
: undefined
|
|
33
|
+
})],
|
|
34
|
+
[dppProvider.dpp.TokenStatusNAPI, (v) => ({
|
|
35
|
+
paused: v.paused
|
|
36
|
+
})],
|
|
37
|
+
[dppProvider.dpp.VerifiedBalanceTransferNAPI, (v) => ({
|
|
38
|
+
sender: PartialIdentityWASM.createFromRawInstance(v.sender),
|
|
39
|
+
recipient: PartialIdentityWASM.createFromRawInstance(v.recipient)
|
|
40
|
+
})],
|
|
41
|
+
[dppProvider.dpp.VerifiedTokenGroupActionWithDocumentNAPI, (v) => ({
|
|
42
|
+
groupSumPower: v.groupSumPower,
|
|
43
|
+
document: v.document != null ? DocumentWASM.createFromRawInstance(v.document) : undefined
|
|
44
|
+
})],
|
|
45
|
+
[dppProvider.dpp.VerifiedTokenGroupActionWithTokenBalanceNAPI, (v) => ({
|
|
46
|
+
groupSumPower: v.groupSumPower,
|
|
47
|
+
groupActionStatus: v.groupActionStatus,
|
|
48
|
+
amount: v.amount != null ? BigInt(v.amount) : undefined
|
|
49
|
+
})],
|
|
50
|
+
[dppProvider.dpp.VerifiedTokenGroupActionWithTokenIdentityInfoNAPI, (v) => ({
|
|
51
|
+
groupSumPower: v.groupSumPower,
|
|
52
|
+
groupActionStatus: v.groupActionStatus,
|
|
53
|
+
identityTokenInfo: v.identityTokenInfo != null ? { frozen: v.identityTokenInfo.frozen } : undefined
|
|
54
|
+
})],
|
|
55
|
+
[dppProvider.dpp.VerifiedTokenGroupActionWithTokenPricingScheduleNAPI, (v) => ({
|
|
56
|
+
groupSumPower: v.groupSumPower,
|
|
57
|
+
groupActionStatus: v.groupActionStatus,
|
|
58
|
+
pricingSchedule: v.pricingSchedule != null ? TokenPricingScheduleWASM.createFromRawInstance(v.pricingSchedule) : undefined
|
|
59
|
+
})],
|
|
60
|
+
[dppProvider.dpp.VerifiedIdentityFullWithAddressInfosNAPI, (v) => ({
|
|
61
|
+
identity: IdentityWASM.createFromRawInstance(v.identity),
|
|
62
|
+
infos: v.infos.map(info => ({
|
|
63
|
+
nonce: info.nonce,
|
|
64
|
+
address: PlatformAddressWASM.createFromRawInstance(info.address),
|
|
65
|
+
balance: info.credits != null ? BigInt(info.credits) : undefined
|
|
66
|
+
}))
|
|
67
|
+
})],
|
|
68
|
+
[dppProvider.dpp.VerifiedIdentityWithAddressInfosNAPI, (v) => ({
|
|
69
|
+
identity: PartialIdentityWASM.createFromRawInstance(v.identity),
|
|
70
|
+
infos: v.infos.map(info => ({
|
|
71
|
+
nonce: info.nonce,
|
|
72
|
+
address: PlatformAddressWASM.createFromRawInstance(info.address),
|
|
73
|
+
balance: info.credits != null ? BigInt(info.credits) : undefined
|
|
74
|
+
}))
|
|
75
|
+
})]
|
|
76
|
+
]);
|
|
77
|
+
};
|
|
78
|
+
function convertArray(result) {
|
|
79
|
+
const [first] = result;
|
|
80
|
+
if (first == null)
|
|
81
|
+
return [];
|
|
82
|
+
if (first instanceof dppProvider.dpp.IdentityTokenBalanceNAPI) {
|
|
83
|
+
return result.map(item => ({
|
|
84
|
+
id: IdentifierWASM.createFromRawInstance(item.id),
|
|
85
|
+
balance: BigInt(item.balance)
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
if (first instanceof dppProvider.dpp.VerifiedDocumentNAPI) {
|
|
89
|
+
return result.map(item => ({
|
|
90
|
+
id: IdentifierWASM.createFromRawInstance(item.id),
|
|
91
|
+
document: item.document != null
|
|
92
|
+
? DocumentWASM.createFromRawInstance(item.document)
|
|
93
|
+
: undefined
|
|
94
|
+
}));
|
|
95
|
+
}
|
|
96
|
+
if (first instanceof dppProvider.dpp.PlatformAddressInfoNAPI) {
|
|
97
|
+
return result.map(item => ({
|
|
98
|
+
nonce: item.nonce,
|
|
99
|
+
address: PlatformAddressWASM.createFromRawInstance(item.address),
|
|
100
|
+
balance: item.credits != null ? BigInt(item.credits) : undefined
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
103
|
+
throw new Error('Unknown array type');
|
|
104
|
+
}
|
|
105
|
+
export function convertResult(result) {
|
|
106
|
+
if (Array.isArray(result)) {
|
|
107
|
+
return convertArray(result);
|
|
108
|
+
}
|
|
109
|
+
for (const [Type, handler] of converters()) {
|
|
110
|
+
if (result instanceof Type) {
|
|
111
|
+
return handler(result);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
throw new Error(`Unknown result type: ${result?.constructor?.name}`);
|
|
115
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { BlockInfo, PlatformVersionLike, VerifiedStateTransitionResult } from '../../types.js';
|
|
2
|
+
import { StateTransitionWASM } from '../../structs/StateTransition.js';
|
|
3
|
+
import { DataContractWASM } from '../../structs/DataContract.js';
|
|
4
|
+
export declare function verifyStateTransitionResult(proof: Uint8Array, stateTransition: StateTransitionWASM, blockInfo: BlockInfo, knownContractsArray: DataContractWASM[], platformVersion: PlatformVersionLike): VerifiedStateTransitionResult;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { dppProvider } from '../../provider.js';
|
|
2
|
+
import { valueToDynamicValue } from '../../utils.js';
|
|
3
|
+
import { convertResult } from './utils.js';
|
|
4
|
+
export function verifyStateTransitionResult(proof, stateTransition, blockInfo, knownContractsArray, platformVersion) {
|
|
5
|
+
const verified = dppProvider.dpp.verifyStateTransitionResult(proof, stateTransition._rawStateTransition, new dppProvider.dpp.BlockInfoNAPI(blockInfo.timeMs.toString(), blockInfo.height.toString(), blockInfo.coreHeight, blockInfo.epoch), knownContractsArray.map(contract => contract._rawDataContract), valueToDynamicValue(platformVersion));
|
|
6
|
+
return {
|
|
7
|
+
rootHash: verified.rootHash,
|
|
8
|
+
result: convertResult(verified.result)
|
|
9
|
+
};
|
|
10
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { PlatformVersionLike, VerifiedEpochsInfo } from '../../types.js';
|
|
2
|
+
export declare function verifyEpochsInfoProof(proof: Uint8Array, currentEpoch: number, startEpoch: number | undefined, count: number, ascending: boolean, platformVersion: PlatformVersionLike): VerifiedEpochsInfo;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { dppProvider } from '../../provider.js';
|
|
2
|
+
import { valueToDynamicValue } from '../../utils.js';
|
|
3
|
+
export function verifyEpochsInfoProof(proof, currentEpoch, startEpoch, count, ascending, platformVersion) {
|
|
4
|
+
const result = dppProvider.dpp.verifyEpochsInfoProof(proof, currentEpoch, startEpoch, count, ascending ?? false, valueToDynamicValue(platformVersion));
|
|
5
|
+
return {
|
|
6
|
+
rootHash: result.rootHash,
|
|
7
|
+
epochsInfo: result.epochsInfo.map(info => ({
|
|
8
|
+
index: info.index,
|
|
9
|
+
firstBlockTime: BigInt(info.firstBlockTime),
|
|
10
|
+
firstBlockHeight: BigInt(info.firstBlockHeight),
|
|
11
|
+
firstCoreBlockHeight: info.firstCoreBlockHeight,
|
|
12
|
+
feeMultiplierPermille: BigInt(info.feeMultiplierPermille),
|
|
13
|
+
protocolVersion: info.protocolVersion
|
|
14
|
+
}))
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { PlatformVersionLike, VerifiedTotalCredits } from '../../types.js';
|
|
2
|
+
export declare function verifyTotalCreditsProof(proof: Uint8Array, coreSubsidyHalvingInterval: number, activationCoreHeight: number, currentCoreHeight: number, platformVersion: PlatformVersionLike): VerifiedTotalCredits;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { dppProvider } from '../../provider.js';
|
|
2
|
+
import { valueToDynamicValue } from '../../utils.js';
|
|
3
|
+
export function verifyTotalCreditsProof(proof, coreSubsidyHalvingInterval, activationCoreHeight, currentCoreHeight, platformVersion) {
|
|
4
|
+
const result = dppProvider.dpp.verifyTotalCreditsProof(proof, coreSubsidyHalvingInterval, activationCoreHeight, currentCoreHeight, valueToDynamicValue(platformVersion));
|
|
5
|
+
return {
|
|
6
|
+
rootHash: result.rootHash,
|
|
7
|
+
totalCredits: BigInt(result.totalCredits)
|
|
8
|
+
};
|
|
9
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { IdentifierLike, PlatformVersionLike, VerifiedTokenBalancesForIdentities } from '../../types.js';
|
|
2
|
+
export declare function verifyTokenBalancesForIdentitiesProof(proof: Uint8Array, tokenId: IdentifierLike, isProofSubset: boolean, identitiesIds: IdentifierLike[], platformVersion: PlatformVersionLike): VerifiedTokenBalancesForIdentities;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { dppProvider } from '../../provider.js';
|
|
2
|
+
import { prepareIdentifierValue, valueToDynamicValue } from '../../utils.js';
|
|
3
|
+
import { IdentifierWASM } from '../../structs/Identifier.js';
|
|
4
|
+
export function verifyTokenBalancesForIdentitiesProof(proof, tokenId, isProofSubset, identitiesIds, platformVersion) {
|
|
5
|
+
const result = dppProvider.dpp.verifyTokenBalancesForIdentitiesProof(proof, prepareIdentifierValue(tokenId), isProofSubset, identitiesIds.map(prepareIdentifierValue), valueToDynamicValue(platformVersion));
|
|
6
|
+
return {
|
|
7
|
+
rootHash: result.rootHash,
|
|
8
|
+
balances: result.balances.map(balance => ({
|
|
9
|
+
balance: balance.balance != null ? BigInt(balance.balance) : undefined,
|
|
10
|
+
id: IdentifierWASM.createFromRawInstance(balance.id)
|
|
11
|
+
}))
|
|
12
|
+
};
|
|
13
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { IdentifierLike, PlatformVersionLike, VerifiedTokenContractInfo } from '../../types.js';
|
|
2
|
+
export declare function verifyTokenContractInfoProof(proof: Uint8Array, tokenId: IdentifierLike, verifySubsetOfProof: boolean, platformVersion: PlatformVersionLike): VerifiedTokenContractInfo;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { dppProvider } from '../../provider.js';
|
|
2
|
+
import { prepareIdentifierValue, valueToDynamicValue } from '../../utils.js';
|
|
3
|
+
import { IdentifierWASM } from '../../structs/Identifier.js';
|
|
4
|
+
export function verifyTokenContractInfoProof(proof, tokenId, verifySubsetOfProof, platformVersion) {
|
|
5
|
+
const result = dppProvider.dpp.verifyTokenContractInfoProof(proof, prepareIdentifierValue(tokenId), verifySubsetOfProof, valueToDynamicValue(platformVersion));
|
|
6
|
+
return {
|
|
7
|
+
rootHash: result.rootHash,
|
|
8
|
+
contractInfo: result.contractInfo != null
|
|
9
|
+
? {
|
|
10
|
+
contractId: IdentifierWASM.createFromRawInstance(result.contractInfo.contractId),
|
|
11
|
+
tokenContractPosition: result.contractInfo.tokenContractPosition
|
|
12
|
+
}
|
|
13
|
+
: undefined
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { IdentifierLike, PlatformVersionLike, VerifiedTokenDirectPurchasePrices } from '../../types.js';
|
|
2
|
+
export declare function verifyTokenDirectPurchasePrices(proof: Uint8Array, tokenIds: IdentifierLike[], verifySubsetOfProof: boolean, platformVersion: PlatformVersionLike): VerifiedTokenDirectPurchasePrices;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { dppProvider } from '../../provider.js';
|
|
2
|
+
import { prepareIdentifierValue, valueToDynamicValue } from '../../utils.js';
|
|
3
|
+
import { IdentifierWASM } from '../../structs/Identifier.js';
|
|
4
|
+
import { TokenPricingScheduleWASM } from '../../structs/Batch/TokenPricingSchedule.js';
|
|
5
|
+
export function verifyTokenDirectPurchasePrices(proof, tokenIds, verifySubsetOfProof, platformVersion) {
|
|
6
|
+
const result = dppProvider.dpp.verifyTokenDirectPurchasePrices(proof, tokenIds.map(prepareIdentifierValue), verifySubsetOfProof, valueToDynamicValue(platformVersion));
|
|
7
|
+
return {
|
|
8
|
+
rootHash: result.rootHash,
|
|
9
|
+
prices: result.prices.map(price => ({
|
|
10
|
+
tokenId: IdentifierWASM.createFromRawInstance(price.id),
|
|
11
|
+
pricingSchedule: price.pricingSchedule != null ? TokenPricingScheduleWASM.createFromRawInstance(price.pricingSchedule) : undefined
|
|
12
|
+
}))
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { IdentifierLike, PlatformVersionLike, VerifiedTokenTotalSupply } from '../../types.js';
|
|
2
|
+
export declare function verifyTokenTotalSupplyProof(proof: Uint8Array, tokenId: IdentifierLike, verifySubsetOfProof: boolean, platformVersion: PlatformVersionLike): VerifiedTokenTotalSupply;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { dppProvider } from '../../provider.js';
|
|
2
|
+
import { prepareIdentifierValue, valueToDynamicValue } from '../../utils.js';
|
|
3
|
+
export function verifyTokenTotalSupplyProof(proof, tokenId, verifySubsetOfProof, platformVersion) {
|
|
4
|
+
const result = dppProvider.dpp.verifyTokenTotalSupplyProof(proof, prepareIdentifierValue(tokenId), verifySubsetOfProof, valueToDynamicValue(platformVersion));
|
|
5
|
+
return {
|
|
6
|
+
rootHash: result.rootHash,
|
|
7
|
+
totalBalance: {
|
|
8
|
+
tokenSupply: BigInt(result.totalBalance.tokenSupply),
|
|
9
|
+
aggregatedTokenAccountBalances: BigInt(result.totalBalance.aggregatedTokenAccountBalances)
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { IdentifierLike, PlatformVersionLike, VerifiedTokensBalancesForIdentity } from '../../types.js';
|
|
2
|
+
export declare function verifyTokensBalancesForIdentityProof(proof: Uint8Array, tokenIds: IdentifierLike[], identityId: IdentifierLike, verifySubsetOfProof: boolean, platformVersion: PlatformVersionLike): VerifiedTokensBalancesForIdentity;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { dppProvider } from '../../provider.js';
|
|
2
|
+
import { prepareIdentifierValue, valueToDynamicValue } from '../../utils.js';
|
|
3
|
+
import { IdentifierWASM } from '../../structs/Identifier.js';
|
|
4
|
+
export function verifyTokensBalancesForIdentityProof(proof, tokenIds, identityId, verifySubsetOfProof, platformVersion) {
|
|
5
|
+
const result = dppProvider.dpp.verifyTokensBalancesForIdentityProof(proof, tokenIds.map(prepareIdentifierValue), prepareIdentifierValue(identityId), verifySubsetOfProof, valueToDynamicValue(platformVersion));
|
|
6
|
+
return {
|
|
7
|
+
rootHash: result.rootHash,
|
|
8
|
+
balances: result.balances.map(balance => ({
|
|
9
|
+
balance: balance.balance != null ? BigInt(balance.balance) : undefined,
|
|
10
|
+
id: IdentifierWASM.createFromRawInstance(balance.id)
|
|
11
|
+
}))
|
|
12
|
+
};
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function verifySignatureDigest(signDigest: Uint8Array, signature: Uint8Array, pubkeyBytes: Uint8Array): boolean;
|
package/dist/src/wasm.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decodes base-122 encoded data back to the original data.
|
|
3
|
+
* @param {Uint8Array|String} rawData - The data to be decoded. This can be a Uint8Array
|
|
4
|
+
* with raw data bytes or a string of bytes (i.e. the type of argument to btoa())
|
|
5
|
+
* @returns {Uint8Array} The data in a regular array representing byte values.
|
|
6
|
+
*/
|
|
7
|
+
export function decode(base122Data: any): Uint8Array;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// Original code: https://github.com/kevinAlbs/Base122
|
|
2
|
+
// Provides functions for encoding/decoding data to and from base-122.
|
|
3
|
+
const kIllegals = [
|
|
4
|
+
0, // null
|
|
5
|
+
10, // newline
|
|
6
|
+
13, // carriage return
|
|
7
|
+
34, // double quote
|
|
8
|
+
38, // ampersand
|
|
9
|
+
92 // backslash
|
|
10
|
+
];
|
|
11
|
+
const kShortened = 0b111; // Uses the illegal index to signify the last two-byte char encodes <= 7 bits.
|
|
12
|
+
/**
|
|
13
|
+
* Decodes base-122 encoded data back to the original data.
|
|
14
|
+
* @param {Uint8Array|String} rawData - The data to be decoded. This can be a Uint8Array
|
|
15
|
+
* with raw data bytes or a string of bytes (i.e. the type of argument to btoa())
|
|
16
|
+
* @returns {Uint8Array} The data in a regular array representing byte values.
|
|
17
|
+
*/
|
|
18
|
+
export function decode(base122Data) {
|
|
19
|
+
const strData = typeof (base122Data) === 'string' ? base122Data : utf8DataToString(base122Data);
|
|
20
|
+
const decoded = [];
|
|
21
|
+
let curByte = 0;
|
|
22
|
+
let bitOfByte = 0;
|
|
23
|
+
function push7(byte) {
|
|
24
|
+
byte <<= 1;
|
|
25
|
+
// Align this byte to offset for current byte.
|
|
26
|
+
curByte |= (byte >>> bitOfByte);
|
|
27
|
+
bitOfByte += 7;
|
|
28
|
+
if (bitOfByte >= 8) {
|
|
29
|
+
decoded.push(curByte);
|
|
30
|
+
bitOfByte -= 8;
|
|
31
|
+
// Now, take the remainder, left shift by what has been taken.
|
|
32
|
+
curByte = (byte << (7 - bitOfByte)) & 255;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
for (let i = 0; i < strData.length; i++) {
|
|
36
|
+
const c = strData.charCodeAt(i);
|
|
37
|
+
// Check if this is a two-byte character.
|
|
38
|
+
if (c > 127) {
|
|
39
|
+
// Note, the charCodeAt will give the codePoint, thus
|
|
40
|
+
// 0b110xxxxx 0b10yyyyyy will give => xxxxxyyyyyy
|
|
41
|
+
const illegalIndex = (c >>> 8) & 7; // 7 = 0b111.
|
|
42
|
+
// We have to first check if this is a shortened two-byte character, i.e. if it only
|
|
43
|
+
// encodes <= 7 bits.
|
|
44
|
+
if (illegalIndex !== kShortened)
|
|
45
|
+
push7(kIllegals[illegalIndex]);
|
|
46
|
+
// Always push the rest.
|
|
47
|
+
push7(c & 127);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
// One byte characters can be pushed directly.
|
|
51
|
+
push7(c);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return new Uint8Array(decoded);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Converts a sequence of UTF-8 bytes to a string.
|
|
58
|
+
* @param {Uint8Array} data - The UTF-8 data.
|
|
59
|
+
* @returns {String} A string with each character representing a code point.
|
|
60
|
+
*/
|
|
61
|
+
function utf8DataToString(data) {
|
|
62
|
+
return new TextDecoder().decode(data);
|
|
63
|
+
}
|
package/package.json
CHANGED
|
@@ -1,57 +1,60 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pshenmic-dpp",
|
|
3
|
-
"version": "
|
|
4
|
-
"main": "dist/wasm
|
|
5
|
-
"types": "dist/wasm
|
|
3
|
+
"version": "2.0.0-dev.10",
|
|
4
|
+
"main": "dist/src/wasm.js",
|
|
5
|
+
"types": "dist/src/wasm.d.ts",
|
|
6
|
+
"react-native": "./dist/src/react-native.js",
|
|
6
7
|
"type": "module",
|
|
7
8
|
"repository": {
|
|
8
9
|
"type": "git",
|
|
9
10
|
"url": "https://github.com/owl352/pshenmic-dpp"
|
|
10
11
|
},
|
|
11
12
|
"scripts": {
|
|
12
|
-
"build:bin": "
|
|
13
|
-
"build:
|
|
14
|
-
"build:full": "
|
|
15
|
-
"build
|
|
13
|
+
"build:bin": "node build.cjs",
|
|
14
|
+
"build:ts": "tsc && cp -R pkg/**/*.*.node dist/binaries/",
|
|
15
|
+
"build:full": "npm run build:bin && npm run build:ts",
|
|
16
|
+
"ferric:build": "ferric build",
|
|
16
17
|
"bundle": "rollup -c",
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"lint": "
|
|
21
|
-
"lint:
|
|
22
|
-
"
|
|
18
|
+
"test": "jest",
|
|
19
|
+
"docs": "typedoc",
|
|
20
|
+
"lint:rust": "cargo fmt",
|
|
21
|
+
"lint:src": "ts-standard --fix ./pkg/src",
|
|
22
|
+
"lint:tests": "ts-standard --fix ./pkg/src",
|
|
23
|
+
"lint": "npm run lint:rust && npm run lint:src && npm run lint:tests"
|
|
23
24
|
},
|
|
24
25
|
"files": [
|
|
25
|
-
"dist/
|
|
26
|
+
"dist/",
|
|
26
27
|
"tests/"
|
|
27
28
|
],
|
|
28
|
-
"exports": {
|
|
29
|
-
".": "./dist/wasm/index.js",
|
|
30
|
-
"./initAsync": "./dist/wasm/initAsync.js",
|
|
31
|
-
"./initInterface": "./dist/wasm/initInterface.js",
|
|
32
|
-
"./initWASM": "./dist/wasm/initWASM.js",
|
|
33
|
-
"./pshenmic_dpp_bg": "./dist/wasm/pshenmic_dpp_bg.js",
|
|
34
|
-
"./pshenmic_dpp": "./dist/wasm/pshenmic_dpp.js",
|
|
35
|
-
"./pshenmic_dpp_zipped": "./dist/wasm/pshenmic_dpp_zipped.js"
|
|
36
|
-
},
|
|
37
29
|
"author": "owl352",
|
|
38
30
|
"license": "ISC",
|
|
39
31
|
"description": "",
|
|
40
32
|
"devDependencies": {
|
|
41
|
-
"@
|
|
33
|
+
"@babel/core": "^7.28.5",
|
|
34
|
+
"@babel/preset-env": "^7.28.5",
|
|
35
|
+
"@babel/preset-typescript": "^7.28.5",
|
|
42
36
|
"@scure/base": "^1.2.4",
|
|
37
|
+
"@types/jest": "^30.0.0",
|
|
43
38
|
"@types/node": "^24.0.13",
|
|
39
|
+
"babel": "^6.23.0",
|
|
40
|
+
"babel-jest": "^30.2.0",
|
|
44
41
|
"core-js": "^3.41.0",
|
|
42
|
+
"ferric-cli": "0.3.9",
|
|
43
|
+
"jest": "^30.2.0",
|
|
45
44
|
"mocha": "^11.1.0",
|
|
45
|
+
"node-addon-api": "^8.5.0",
|
|
46
46
|
"path": "^0.12.7",
|
|
47
|
-
"
|
|
48
|
-
"standard": "^17.1.2",
|
|
47
|
+
"toml": "^3.0.0",
|
|
49
48
|
"ts-morph": "^26.0.0",
|
|
50
49
|
"tsx": "^4.20.6",
|
|
51
50
|
"typedoc": "^0.28.7",
|
|
52
|
-
"typescript": "^5.8.3"
|
|
51
|
+
"typescript": "^5.8.3",
|
|
52
|
+
"ts-standard": "^12.0.2"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
+
"@emnapi/core": "1.9.0",
|
|
56
|
+
"@emnapi/runtime": "1.9.0",
|
|
57
|
+
"@tybys/wasm-util": "^0.10.1",
|
|
55
58
|
"fflate": "^0.8.2"
|
|
56
59
|
}
|
|
57
60
|
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import * as dpp from "../../pkg/src/wasm.js";
|
|
2
|
+
import {valueFromDynamicValue, valueToDynamicValue} from "../../pkg/src/dpp/utils.js"
|
|
3
|
+
|
|
4
|
+
describe('DynamicValue', () => {
|
|
5
|
+
beforeAll(()=>{
|
|
6
|
+
// in real scenarios we cannot call valueFromDynamicValue and valueToDynamicValue from outside of module
|
|
7
|
+
// but tests use these methods and require to import dpp before run,
|
|
8
|
+
// or we can set dpp manually via setDpp()
|
|
9
|
+
dpp
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
describe('serialization / deserialization', function () {
|
|
13
|
+
test('should allow to serialize and deserialize basic types', function () {
|
|
14
|
+
const uint8ArrayValue = new Uint8Array([1, 2, 3, 4])
|
|
15
|
+
const numberValue = 122
|
|
16
|
+
const stringValue = 'bebra'
|
|
17
|
+
const bigIntValue = BigInt('88888888888888888888')
|
|
18
|
+
const boolValue = true
|
|
19
|
+
const nullValue = null
|
|
20
|
+
const undefinedValue = undefined
|
|
21
|
+
const floatValue = 24.2000000000
|
|
22
|
+
const intValue = -567
|
|
23
|
+
|
|
24
|
+
const uint8ArrayDynamicValue = valueToDynamicValue(uint8ArrayValue)
|
|
25
|
+
const numberDynamicValue = valueToDynamicValue(numberValue)
|
|
26
|
+
const stringDynamicValue = valueToDynamicValue(stringValue)
|
|
27
|
+
const bigIntDynamicValue = valueToDynamicValue(bigIntValue)
|
|
28
|
+
const boolDynamicValue = valueToDynamicValue(boolValue)
|
|
29
|
+
const nullDynamicValue = valueToDynamicValue(nullValue)
|
|
30
|
+
const undefinedDynamicValue = valueToDynamicValue(undefinedValue)
|
|
31
|
+
const floatDynamicValue = valueToDynamicValue(floatValue)
|
|
32
|
+
const intDynamicValue = valueToDynamicValue(intValue)
|
|
33
|
+
|
|
34
|
+
expect(uint8ArrayDynamicValue.value).toBeInstanceOf(Uint8Array)
|
|
35
|
+
expect(numberDynamicValue.value).toStrictEqual(numberValue)
|
|
36
|
+
expect(stringDynamicValue.value).toStrictEqual(stringValue)
|
|
37
|
+
expect(bigIntDynamicValue.value).toStrictEqual(bigIntValue.toString())
|
|
38
|
+
expect(boolDynamicValue.value).toStrictEqual(boolValue)
|
|
39
|
+
expect(nullDynamicValue.value).toStrictEqual(nullValue)
|
|
40
|
+
expect(undefinedDynamicValue.value).toStrictEqual(undefinedValue)
|
|
41
|
+
expect(floatDynamicValue.value).toStrictEqual(floatValue)
|
|
42
|
+
expect(intDynamicValue.value).toStrictEqual(intValue)
|
|
43
|
+
|
|
44
|
+
expect(valueFromDynamicValue(uint8ArrayDynamicValue)).toBeInstanceOf(Uint8Array)
|
|
45
|
+
expect(valueFromDynamicValue(numberDynamicValue)).toStrictEqual(numberValue)
|
|
46
|
+
expect(valueFromDynamicValue(stringDynamicValue)).toStrictEqual(stringValue)
|
|
47
|
+
expect(valueFromDynamicValue(bigIntDynamicValue)).toStrictEqual(bigIntValue)
|
|
48
|
+
expect(valueFromDynamicValue(boolDynamicValue)).toStrictEqual(boolValue)
|
|
49
|
+
expect(valueFromDynamicValue(nullDynamicValue)).toStrictEqual(nullValue)
|
|
50
|
+
expect(valueFromDynamicValue(undefinedDynamicValue)).toStrictEqual(undefinedValue)
|
|
51
|
+
expect(valueFromDynamicValue(floatDynamicValue)).toStrictEqual(floatValue)
|
|
52
|
+
expect(valueFromDynamicValue(intDynamicValue)).toStrictEqual(intValue)
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
test('should allow to serialize and deserialize object and array', function () {
|
|
56
|
+
const defaultObjectValue = {
|
|
57
|
+
0: 0,
|
|
58
|
+
1: 3,
|
|
59
|
+
2: "string",
|
|
60
|
+
3: false
|
|
61
|
+
}
|
|
62
|
+
const extendedObjectValue = {
|
|
63
|
+
a: 1,
|
|
64
|
+
b: false,
|
|
65
|
+
c: new Uint8Array([1, 2, 3, 45]),
|
|
66
|
+
v: BigInt('1111'),
|
|
67
|
+
e: {
|
|
68
|
+
bebra: "here",
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const defaultArrayValue = [1, 2, 'b', true]
|
|
73
|
+
const extendedArrayValue = [1, extendedObjectValue]
|
|
74
|
+
|
|
75
|
+
const defaultObjectDynamicValue = valueToDynamicValue(defaultObjectValue)
|
|
76
|
+
const extendedObjectDynamicValue = valueToDynamicValue(extendedObjectValue)
|
|
77
|
+
const defaultArrayDynamicValue = valueToDynamicValue(defaultArrayValue)
|
|
78
|
+
const extendedArrayDynamicValue = valueToDynamicValue(extendedArrayValue)
|
|
79
|
+
|
|
80
|
+
expect(valueFromDynamicValue(defaultObjectDynamicValue)).toStrictEqual(defaultObjectValue)
|
|
81
|
+
expect(valueFromDynamicValue(extendedObjectDynamicValue)).toStrictEqual(extendedObjectValue)
|
|
82
|
+
expect(valueFromDynamicValue(defaultArrayDynamicValue)).toStrictEqual(defaultArrayValue)
|
|
83
|
+
expect(valueFromDynamicValue(extendedArrayDynamicValue)).toStrictEqual(extendedArrayValue)
|
|
84
|
+
})
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
describe('number values in object', function () {
|
|
88
|
+
const mock = {
|
|
89
|
+
uint: 1999,
|
|
90
|
+
int: -293,
|
|
91
|
+
float: 2222.11231,
|
|
92
|
+
smallBigInt: BigInt(2),
|
|
93
|
+
bigBigInt: BigInt(2000000000000),
|
|
94
|
+
stringUint: '11',
|
|
95
|
+
stringInt: '-11',
|
|
96
|
+
stringFloat: '11.2',
|
|
97
|
+
bigStringNumber: '11111111111111111111111111111111'
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const dynValue = valueToDynamicValue(mock)
|
|
101
|
+
|
|
102
|
+
const result = valueFromDynamicValue(dynValue)
|
|
103
|
+
|
|
104
|
+
expect(valueFromDynamicValue(dynValue)).toStrictEqual(mock)
|
|
105
|
+
expect(dynValue.value.uint.getType()).toStrictEqual('u32')
|
|
106
|
+
expect(dynValue.value.int.getType()).toStrictEqual('i64')
|
|
107
|
+
expect(dynValue.value.float.getType()).toStrictEqual('f64')
|
|
108
|
+
expect(dynValue.value.smallBigInt.getType()).toStrictEqual('BigIntString')
|
|
109
|
+
expect(dynValue.value.bigBigInt.getType()).toStrictEqual('BigIntString')
|
|
110
|
+
expect(dynValue.value.stringUint.getType()).toStrictEqual('String')
|
|
111
|
+
expect(dynValue.value.stringInt.getType()).toStrictEqual('String')
|
|
112
|
+
expect(dynValue.value.stringFloat.getType()).toStrictEqual('String')
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
describe('should decode document from state transition in jsonLike', function () {
|
|
116
|
+
const stateTransition = dpp.StateTransitionWASM.fromBase64('AgHv88sfWzscuW2Ob/0v5d+EgqmWG7ZIvlQG7mHWBH7z9gEAAAAB7JH7W+JkM0Vne2U1zlWYVeQNzRPTpdiWRfsgfwNS2UoCCGJsb2dQb3N0KBdMgeznVQ1smUXVFNPfE2PC379wpWVH8cdu2ilzeI0Ah/i2xfrKCm5ACQAbEQkSc+GRUkdLor4Eu7Vzf6oRc9UHBmJsb2dJZAogdhC4nVm3ufPCgdfoOKXtnhqwg7O3axyTS9WB3EFvNBYPY29tbWVudHNFbmFibGVkEwEHY29udGVudAr7AUh4nM2TTWrDMBCFrxK0jkCyJMvqLnRV6A1KFhpplJgotrEVaAi+e8clpdBuvCnNcn7ezPvQ6O3G2siemKgNSGETT8ZarhUm7hpX8yStEpVCk6xlW1auA1L34Ed/GP1wpNQw9sPEnm6s4Ht57nM/UkPE5C+5UBl8OB3G/tLF37VFscvtoTtjV6iSMRU2b1nou/KZIXf3jUvrXUHRrosbv8ltKRk30JbNl2LLpnLNuPiZ5z1NOrY5jtjRqP28vbM656zTleagJHCNXnIQiUIpgozGg2/0N2s4Yji9tlN5KXj+A97FJG1AcpZ8nnANv1wHGo22ASrFXQDJde0SBzDIdQBVRQEoDDw2aLUONPkKtfF0s9bR9bqGkJW3PNYCg/FOgIqPDarWgQrRxKapBXdCJ3pR7TjUVnJrpAo6yhSc/4dv+tPu/gNBt2qtC3B1Ymxpc2hlZEF0Av0AAAGcptJlIwRzbHVnEhV0aGlzLWlzLW15LWZpcnN0LXBvc3QIc3VidGl0bGUSD1dpdGggYSBzdWJ0aXRsZQV0aXRsZRIVVGhpcyBpcyBteSBmaXJzdCBwb3N0AAABQR+H40MbUEmFXQbTPcwy9vMD8EiTwDzMpW3YIkfSIDvHij5ZIAVvqm0ZJScJzKV7EnRUi/f1tZ/wFJfd1+LDtpps')
|
|
117
|
+
|
|
118
|
+
const batch = dpp.BatchTransitionWASM.fromStateTransition(stateTransition)
|
|
119
|
+
|
|
120
|
+
const transition = batch.transitions[0].toTransition() as dpp.DocumentTransitionWASM
|
|
121
|
+
|
|
122
|
+
const publishedAt = transition.createTransition.data.publishedAt
|
|
123
|
+
|
|
124
|
+
expect(typeof publishedAt).toEqual('number')
|
|
125
|
+
})
|
|
126
|
+
})
|