pshenmic-dpp 2.0.0-dev.20 → 2.0.0-dev.22
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/dist/binaries/bindingsTypes.d.ts +307 -0
- package/dist/binaries/native/aarch64-apple-darwin/pshenmic_dpp.node +0 -0
- package/dist/binaries/native/x86_64-apple-darwin/pshenmic_dpp.node +0 -0
- package/dist/binaries/native/x86_64-unknown-linux-gnu/pshenmic_dpp.node +0 -0
- package/dist/binaries/native/x86_64-unknown-linux-musl/pshenmic_dpp.node +0 -0
- package/dist/binaries/pshenmic_dpp.android.node/arm64-v8a/libpshenmic_dpp.so +0 -0
- package/dist/binaries/pshenmic_dpp.apple.node/ios-arm64-simulator/libpshenmic_dpp.framework/libpshenmic_dpp +0 -0
- package/dist/binaries/pshenmic_dpp.d.ts +27 -0
- package/dist/binaries/pshenmic_dpp.js +1 -1
- package/dist/binaries/wasm/wasmBytes.cjs +1 -1
- package/dist/binaries/wasm/wasmBytes.d.cts +1 -1
- package/dist/binaries/wasm.d.ts +27 -0
- package/dist/binaries/wasm.js +1 -1
- package/dist/src/dpp/dpp.d.ts +17 -0
- package/dist/src/dpp/dpp.js +17 -0
- package/dist/src/dpp/structs/Identifier.js +3 -0
- package/dist/src/dpp/structs/Orchard/CommitmentTree.d.ts +14 -0
- package/dist/src/dpp/structs/Orchard/CommitmentTree.js +31 -0
- package/dist/src/dpp/structs/Orchard/IdentityCreateFromShieldedPoolResult.d.ts +21 -0
- package/dist/src/dpp/structs/Orchard/IdentityCreateFromShieldedPoolResult.js +38 -0
- package/dist/src/dpp/structs/Orchard/MerklePath.d.ts +11 -0
- package/dist/src/dpp/structs/Orchard/MerklePath.js +25 -0
- package/dist/src/dpp/structs/Orchard/Note.d.ts +18 -0
- package/dist/src/dpp/structs/Orchard/Note.js +42 -0
- package/dist/src/dpp/structs/Orchard/OrchardAddress.d.ts +15 -0
- package/dist/src/dpp/structs/Orchard/OrchardAddress.js +31 -0
- package/dist/src/dpp/structs/Orchard/OrchardProver.d.ts +12 -0
- package/dist/src/dpp/structs/Orchard/OrchardProver.js +18 -0
- package/dist/src/dpp/structs/Orchard/RecoveredNote.d.ts +18 -0
- package/dist/src/dpp/structs/Orchard/RecoveredNote.js +29 -0
- package/dist/src/dpp/structs/Orchard/ShieldedBuilder.d.ts +40 -0
- package/dist/src/dpp/structs/Orchard/ShieldedBuilder.js +45 -0
- package/dist/src/dpp/structs/Orchard/ShieldedMemo.d.ts +11 -0
- package/dist/src/dpp/structs/Orchard/ShieldedMemo.js +25 -0
- package/dist/src/dpp/structs/Orchard/ShieldedWithdrawalResult.d.ts +11 -0
- package/dist/src/dpp/structs/Orchard/ShieldedWithdrawalResult.js +18 -0
- package/dist/src/dpp/structs/Orchard/SpendableNote.d.ts +13 -0
- package/dist/src/dpp/structs/Orchard/SpendableNote.js +27 -0
- package/dist/src/dpp/types.d.ts +35 -0
- package/dist/src/dpp/verify/Shielded/verifyMostRecentShieldedAnchorProof.d.ts +2 -0
- package/dist/src/dpp/verify/Shielded/verifyMostRecentShieldedAnchorProof.js +9 -0
- package/dist/src/dpp/verify/Shielded/verifyShieldedAnchorsProof.d.ts +2 -0
- package/dist/src/dpp/verify/Shielded/verifyShieldedAnchorsProof.js +9 -0
- package/dist/src/dpp/verify/Shielded/verifyShieldedEncryptedNotesProof.d.ts +2 -0
- package/dist/src/dpp/verify/Shielded/verifyShieldedEncryptedNotesProof.js +15 -0
- package/dist/src/dpp/verify/Shielded/verifyShieldedNotesCountProof.d.ts +2 -0
- package/dist/src/dpp/verify/Shielded/verifyShieldedNotesCountProof.js +9 -0
- package/dist/src/dpp/verify/Shielded/verifyShieldedNullifiersProof.d.ts +2 -0
- package/dist/src/dpp/verify/Shielded/verifyShieldedNullifiersProof.js +12 -0
- package/dist/src/dpp/verify/Shielded/verifyShieldedPoolStateProof.d.ts +2 -0
- package/dist/src/dpp/verify/Shielded/verifyShieldedPoolStateProof.js +9 -0
- package/package.json +1 -1
- package/tests/unit/Shielded.spec.ts +344 -0
package/dist/binaries/wasm.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export const orchardOvkFromSeed: any;
|
|
2
|
+
export const recoverNotes: any;
|
|
1
3
|
export const verifyAddressesInfos: any;
|
|
2
4
|
export const verifyAddressInfo: any;
|
|
3
5
|
export const verifyContractProof: any;
|
|
@@ -10,6 +12,12 @@ export const verifyIdentityByUniqueKeyHashProof: any;
|
|
|
10
12
|
export const verifyIdentityContractNonceProof: any;
|
|
11
13
|
export const verifyIdentityKeysByIdentifierProof: any;
|
|
12
14
|
export const verifyIdentityNonceProof: any;
|
|
15
|
+
export const verifyMostRecentShieldedAnchorProof: any;
|
|
16
|
+
export const verifyShieldedAnchorsProof: any;
|
|
17
|
+
export const verifyShieldedEncryptedNotesProof: any;
|
|
18
|
+
export const verifyShieldedNotesCountProof: any;
|
|
19
|
+
export const verifyShieldedNullifiersProof: any;
|
|
20
|
+
export const verifyShieldedPoolStateProof: any;
|
|
13
21
|
export const verifySignatureDigest: any;
|
|
14
22
|
export const verifyStateTransitionResult: any;
|
|
15
23
|
export const verifyTokenBalancesForIdentitiesProof: any;
|
|
@@ -34,6 +42,7 @@ export const BlockBasedDistributionNAPI: any;
|
|
|
34
42
|
export const BlockInfoNAPI: any;
|
|
35
43
|
export const ChainAssetLockProofNAPI: any;
|
|
36
44
|
export const ChangeControlRulesNAPI: any;
|
|
45
|
+
export const CommitmentTreeNAPI: any;
|
|
37
46
|
export const ConsensusErrorNAPI: any;
|
|
38
47
|
export const ContenderWithSerializedDocumentNAPI: any;
|
|
39
48
|
export const ContestedDocumentVotePollQueryExecutionResultNAPI: any;
|
|
@@ -59,6 +68,7 @@ export const GroupNAPI: any;
|
|
|
59
68
|
export const GroupStateTransitionInfoNAPI: any;
|
|
60
69
|
export const IdentifierNAPI: any;
|
|
61
70
|
export const IdentityCreateFromAddressesTransitionNAPI: any;
|
|
71
|
+
export const IdentityCreateFromShieldedPoolResultNAPI: any;
|
|
62
72
|
export const IdentityCreateFromShieldedPoolTransitionNAPI: any;
|
|
63
73
|
export const IdentityCreateTransitionNAPI: any;
|
|
64
74
|
export const IdentityCreditTransferNAPI: any;
|
|
@@ -77,6 +87,10 @@ export const InputAddressNAPI: any;
|
|
|
77
87
|
export const InstantAssetLockProofNAPI: any;
|
|
78
88
|
export const InstantLockNAPI: any;
|
|
79
89
|
export const MasternodeVoteTransitionNAPI: any;
|
|
90
|
+
export const MerklePathNAPI: any;
|
|
91
|
+
export const NoteNAPI: any;
|
|
92
|
+
export const OrchardAddressNAPI: any;
|
|
93
|
+
export const OrchardProverNAPI: any;
|
|
80
94
|
export const OutPointNAPI: any;
|
|
81
95
|
export const OutputAddressNAPI: any;
|
|
82
96
|
export const OutputAddressNullableCreditsNAPI: any;
|
|
@@ -87,14 +101,19 @@ export const PrefundedVotingBalanceNAPI: any;
|
|
|
87
101
|
export const PrivateEncryptedNoteNAPI: any;
|
|
88
102
|
export const PrivateKeyNAPI: any;
|
|
89
103
|
export const PublicKeyNAPI: any;
|
|
104
|
+
export const RecoveredNoteNAPI: any;
|
|
90
105
|
export const ResourceVoteChoiceNAPI: any;
|
|
91
106
|
export const RewardDistributionTypeNAPI: any;
|
|
92
107
|
export const SerializedActionNAPI: any;
|
|
93
108
|
export const SharedEncryptedNoteNAPI: any;
|
|
109
|
+
export const ShieldedBuilderNAPI: any;
|
|
110
|
+
export const ShieldedMemoNAPI: any;
|
|
94
111
|
export const ShieldedTransferTransitionNAPI: any;
|
|
112
|
+
export const ShieldedWithdrawalResultNAPI: any;
|
|
95
113
|
export const ShieldedWithdrawalTransitionNAPI: any;
|
|
96
114
|
export const ShieldFromAssetLockTransitionNAPI: any;
|
|
97
115
|
export const ShieldTransitionNAPI: any;
|
|
116
|
+
export const SpendableNoteNAPI: any;
|
|
98
117
|
export const StateTransitionNAPI: any;
|
|
99
118
|
export const StoredAssetLockInfoNAPI: any;
|
|
100
119
|
export const TimeBasedDistributionNAPI: any;
|
|
@@ -146,8 +165,16 @@ export const VerifiedIdentityKeysByIdentifierNAPI: any;
|
|
|
146
165
|
export const VerifiedIdentityNonceNAPI: any;
|
|
147
166
|
export const VerifiedIdentityTokenInfoNAPI: any;
|
|
148
167
|
export const VerifiedIdentityWithAddressInfosNAPI: any;
|
|
168
|
+
export const VerifiedMostRecentShieldedAnchorNAPI: any;
|
|
149
169
|
export const VerifiedPlatformAddressesInfosNAPI: any;
|
|
150
170
|
export const VerifiedPlatformAddressInfoNAPI: any;
|
|
171
|
+
export const VerifiedShieldedAnchorsNAPI: any;
|
|
172
|
+
export const VerifiedShieldedEncryptedNoteNAPI: any;
|
|
173
|
+
export const VerifiedShieldedEncryptedNotesNAPI: any;
|
|
174
|
+
export const VerifiedShieldedNotesCountNAPI: any;
|
|
175
|
+
export const VerifiedShieldedNullifierNAPI: any;
|
|
176
|
+
export const VerifiedShieldedNullifiersNAPI: any;
|
|
177
|
+
export const VerifiedShieldedPoolStateNAPI: any;
|
|
151
178
|
export const VerifiedStateTransitionResultNAPI: any;
|
|
152
179
|
export const VerifiedTokenBalancesForIdentitiesNAPI: any;
|
|
153
180
|
export const VerifiedTokenContractInfoNAPI: any;
|
package/dist/binaries/wasm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import * as protocol from "./wasmCreation.cjs";
|
|
2
|
-
export const { verifyAddressesInfos, verifyAddressInfo, verifyContractProof, verifyDocumentsProof, verifyEpochsInfoProof, verifyIdentifierByNonUniquePublicKeyHashProof, verifyIdentityBalanceProof, verifyIdentityByIdentifierProof, verifyIdentityByUniqueKeyHashProof, verifyIdentityContractNonceProof, verifyIdentityKeysByIdentifierProof, verifyIdentityNonceProof, verifySignatureDigest, verifyStateTransitionResult, verifyTokenBalancesForIdentitiesProof, verifyTokenContractInfoProof, verifyTokenDirectPurchasePrices, verifyTokensBalancesForIdentityProof, verifyTokenTotalSupplyProof, verifyTotalCreditsProof, verifyVotePollVoteStateProof, ActionTakerNAPI, AddressCreditWithdrawalTransitionNAPI, AddressFundingFromAssetLockTransitionNAPI, AddressFundsFeeStrategyStepNAPI, AddressFundsTransferTransitionNAPI, AddressWitnessNAPI, AssetLockProofNAPI, AssetLockValueNAPI, AuthorizedActionTakersNAPI, BatchedTransitionNAPI, BatchTransitionNAPI, BlockBasedDistributionNAPI, BlockInfoNAPI, ChainAssetLockProofNAPI, ChangeControlRulesNAPI, ConsensusErrorNAPI, ContenderWithSerializedDocumentNAPI, ContestedDocumentVotePollQueryExecutionResultNAPI, ContractBoundsNAPI, CoreScriptNAPI, DataContractCreateTransitionNAPI, DataContractNAPI, DataContractUpdateTransitionNAPI, DistributionFunctionNAPI, DocumentBaseTransitionNAPI, DocumentCreateTransitionNAPI, DocumentDeleteTransitionNAPI, DocumentNAPI, DocumentPurchaseTransitionNAPI, DocumentReplaceTransitionNAPI, DocumentTransferTransitionNAPI, DocumentTransitionNAPI, DocumentUpdatePriceTransitionNAPI, DynamicValue, EpochBasedDistributionNAPI, ExtendedEpochInfoNAPI, GroupNAPI, GroupStateTransitionInfoNAPI, IdentifierNAPI, IdentityCreateFromAddressesTransitionNAPI, IdentityCreateFromShieldedPoolTransitionNAPI, IdentityCreateTransitionNAPI, IdentityCreditTransferNAPI, IdentityCreditTransferToAddressesTransitionNAPI, IdentityCreditWithdrawalTransitionNAPI, IdentityNAPI, IdentityPublicKeyInCreationNAPI, IdentityPublicKeyNAPI, IdentityTokenBalanceNAPI, IdentityTokenBalanceOptionalNAPI, IdentityTokenInfoNAPI, IdentityTopUpFromAddressesTransitionNAPI, IdentityTopUpTransitionNAPI, IdentityUpdateTransitionNAPI, InputAddressNAPI, InstantAssetLockProofNAPI, InstantLockNAPI, MasternodeVoteTransitionNAPI, OutPointNAPI, OutputAddressNAPI, OutputAddressNullableCreditsNAPI, PartialIdentityNAPI, PlatformAddressInfoNAPI, PlatformAddressNAPI, PrefundedVotingBalanceNAPI, PrivateEncryptedNoteNAPI, PrivateKeyNAPI, PublicKeyNAPI, ResourceVoteChoiceNAPI, RewardDistributionTypeNAPI, SerializedActionNAPI, SharedEncryptedNoteNAPI, ShieldedTransferTransitionNAPI, ShieldedWithdrawalTransitionNAPI, ShieldFromAssetLockTransitionNAPI, ShieldTransitionNAPI, StateTransitionNAPI, StoredAssetLockInfoNAPI, TimeBasedDistributionNAPI, TokenBaseTransitionNAPI, TokenBurnTransitionNAPI, TokenClaimTransitionNAPI, TokenConfigUpdateTransitionNAPI, TokenConfigurationChangeItemNAPI, TokenConfigurationConventionNAPI, TokenConfigurationLocalizationNAPI, TokenConfigurationNAPI, TokenContractInfoNAPI, TokenDestroyFrozenFundsTransitionNAPI, TokenDirectPurchaseTransitionNAPI, TokenDistributionRecipientNAPI, TokenDistributionRulesNAPI, TokenEmergencyActionTransitionNAPI, TokenFreezeTransitionNAPI, TokenKeepsHistoryRulesNAPI, TokenMarketplaceRulesNAPI, TokenMintTransitionNAPI, TokenPaymentInfoNAPI, TokenPerpetualDistributionNAPI, TokenPreProgrammedDistributionNAPI, TokenPricingScheduleNAPI, TokenSetPriceForDirectPurchaseTransitionNAPI, TokenStatusNAPI, TokenTradeModeNAPI, TokenTransferTransitionNAPI, TokenTransitionNAPI, TokenUnFreezeTransitionNAPI, TotalSingleTokenBalanceNAPI, TransactionNAPI, TxInNAPI, TxOutNAPI, UnshieldTransitionNAPI, VerifiedBalanceTransferNAPI, VerifiedContractNAPI, VerifiedDocumentNAPI, VerifiedDocumentsNAPI, VerifiedEpochsInfoNAPI, VerifiedIdentifierByNonUniquePublicKeyHashNAPI, VerifiedIdentityBalanceRootHashNAPI, VerifiedIdentityByIdentifierNAPI, VerifiedIdentityByUniqueKeyHashNAPI, VerifiedIdentityContractNonceNAPI, VerifiedIdentityFullWithAddressInfosNAPI, VerifiedIdentityKeysByIdentifierNAPI, VerifiedIdentityNonceNAPI, VerifiedIdentityTokenInfoNAPI, VerifiedIdentityWithAddressInfosNAPI, VerifiedPlatformAddressesInfosNAPI, VerifiedPlatformAddressInfoNAPI, VerifiedStateTransitionResultNAPI, VerifiedTokenBalancesForIdentitiesNAPI, VerifiedTokenContractInfoNAPI, VerifiedTokenDirectPurchasePricesNAPI, VerifiedTokenGroupActionWithDocumentNAPI, VerifiedTokenGroupActionWithTokenBalanceNAPI, VerifiedTokenGroupActionWithTokenIdentityInfoNAPI, VerifiedTokenGroupActionWithTokenPricingScheduleNAPI, VerifiedTokenPricingScheduleNAPI, VerifiedTokensBalancesForIdentityNAPI, VerifiedTokenTotalSupplyNAPI, VerifiedTotalCreditsNAPI, VerifiedVoteStateNAPI, VoteNAPI, VotePollNAPI, WitnessNAPI, ActionGoalNAPI, AssetLockProofTypeNAPI, BatchTypeNAPI, GasFeesPaidByNAPI, GroupActionStatusNAPI, KeyTypeNAPI, NetworkNAPI, PlatformVersionNAPI, PoolingNAPI, PurposeNAPI, SecurityLevelNAPI, TokenDistributionTypeNAPI, TokenEmergencyActionNAPI, VoteStateResultTypeNAPI } = protocol.default;
|
|
2
|
+
export const { orchardOvkFromSeed, recoverNotes, verifyAddressesInfos, verifyAddressInfo, verifyContractProof, verifyDocumentsProof, verifyEpochsInfoProof, verifyIdentifierByNonUniquePublicKeyHashProof, verifyIdentityBalanceProof, verifyIdentityByIdentifierProof, verifyIdentityByUniqueKeyHashProof, verifyIdentityContractNonceProof, verifyIdentityKeysByIdentifierProof, verifyIdentityNonceProof, verifyMostRecentShieldedAnchorProof, verifyShieldedAnchorsProof, verifyShieldedEncryptedNotesProof, verifyShieldedNotesCountProof, verifyShieldedNullifiersProof, verifyShieldedPoolStateProof, verifySignatureDigest, verifyStateTransitionResult, verifyTokenBalancesForIdentitiesProof, verifyTokenContractInfoProof, verifyTokenDirectPurchasePrices, verifyTokensBalancesForIdentityProof, verifyTokenTotalSupplyProof, verifyTotalCreditsProof, verifyVotePollVoteStateProof, ActionTakerNAPI, AddressCreditWithdrawalTransitionNAPI, AddressFundingFromAssetLockTransitionNAPI, AddressFundsFeeStrategyStepNAPI, AddressFundsTransferTransitionNAPI, AddressWitnessNAPI, AssetLockProofNAPI, AssetLockValueNAPI, AuthorizedActionTakersNAPI, BatchedTransitionNAPI, BatchTransitionNAPI, BlockBasedDistributionNAPI, BlockInfoNAPI, ChainAssetLockProofNAPI, ChangeControlRulesNAPI, CommitmentTreeNAPI, ConsensusErrorNAPI, ContenderWithSerializedDocumentNAPI, ContestedDocumentVotePollQueryExecutionResultNAPI, ContractBoundsNAPI, CoreScriptNAPI, DataContractCreateTransitionNAPI, DataContractNAPI, DataContractUpdateTransitionNAPI, DistributionFunctionNAPI, DocumentBaseTransitionNAPI, DocumentCreateTransitionNAPI, DocumentDeleteTransitionNAPI, DocumentNAPI, DocumentPurchaseTransitionNAPI, DocumentReplaceTransitionNAPI, DocumentTransferTransitionNAPI, DocumentTransitionNAPI, DocumentUpdatePriceTransitionNAPI, DynamicValue, EpochBasedDistributionNAPI, ExtendedEpochInfoNAPI, GroupNAPI, GroupStateTransitionInfoNAPI, IdentifierNAPI, IdentityCreateFromAddressesTransitionNAPI, IdentityCreateFromShieldedPoolResultNAPI, IdentityCreateFromShieldedPoolTransitionNAPI, IdentityCreateTransitionNAPI, IdentityCreditTransferNAPI, IdentityCreditTransferToAddressesTransitionNAPI, IdentityCreditWithdrawalTransitionNAPI, IdentityNAPI, IdentityPublicKeyInCreationNAPI, IdentityPublicKeyNAPI, IdentityTokenBalanceNAPI, IdentityTokenBalanceOptionalNAPI, IdentityTokenInfoNAPI, IdentityTopUpFromAddressesTransitionNAPI, IdentityTopUpTransitionNAPI, IdentityUpdateTransitionNAPI, InputAddressNAPI, InstantAssetLockProofNAPI, InstantLockNAPI, MasternodeVoteTransitionNAPI, MerklePathNAPI, NoteNAPI, OrchardAddressNAPI, OrchardProverNAPI, OutPointNAPI, OutputAddressNAPI, OutputAddressNullableCreditsNAPI, PartialIdentityNAPI, PlatformAddressInfoNAPI, PlatformAddressNAPI, PrefundedVotingBalanceNAPI, PrivateEncryptedNoteNAPI, PrivateKeyNAPI, PublicKeyNAPI, RecoveredNoteNAPI, ResourceVoteChoiceNAPI, RewardDistributionTypeNAPI, SerializedActionNAPI, SharedEncryptedNoteNAPI, ShieldedBuilderNAPI, ShieldedMemoNAPI, ShieldedTransferTransitionNAPI, ShieldedWithdrawalResultNAPI, ShieldedWithdrawalTransitionNAPI, ShieldFromAssetLockTransitionNAPI, ShieldTransitionNAPI, SpendableNoteNAPI, StateTransitionNAPI, StoredAssetLockInfoNAPI, TimeBasedDistributionNAPI, TokenBaseTransitionNAPI, TokenBurnTransitionNAPI, TokenClaimTransitionNAPI, TokenConfigUpdateTransitionNAPI, TokenConfigurationChangeItemNAPI, TokenConfigurationConventionNAPI, TokenConfigurationLocalizationNAPI, TokenConfigurationNAPI, TokenContractInfoNAPI, TokenDestroyFrozenFundsTransitionNAPI, TokenDirectPurchaseTransitionNAPI, TokenDistributionRecipientNAPI, TokenDistributionRulesNAPI, TokenEmergencyActionTransitionNAPI, TokenFreezeTransitionNAPI, TokenKeepsHistoryRulesNAPI, TokenMarketplaceRulesNAPI, TokenMintTransitionNAPI, TokenPaymentInfoNAPI, TokenPerpetualDistributionNAPI, TokenPreProgrammedDistributionNAPI, TokenPricingScheduleNAPI, TokenSetPriceForDirectPurchaseTransitionNAPI, TokenStatusNAPI, TokenTradeModeNAPI, TokenTransferTransitionNAPI, TokenTransitionNAPI, TokenUnFreezeTransitionNAPI, TotalSingleTokenBalanceNAPI, TransactionNAPI, TxInNAPI, TxOutNAPI, UnshieldTransitionNAPI, VerifiedBalanceTransferNAPI, VerifiedContractNAPI, VerifiedDocumentNAPI, VerifiedDocumentsNAPI, VerifiedEpochsInfoNAPI, VerifiedIdentifierByNonUniquePublicKeyHashNAPI, VerifiedIdentityBalanceRootHashNAPI, VerifiedIdentityByIdentifierNAPI, VerifiedIdentityByUniqueKeyHashNAPI, VerifiedIdentityContractNonceNAPI, VerifiedIdentityFullWithAddressInfosNAPI, VerifiedIdentityKeysByIdentifierNAPI, VerifiedIdentityNonceNAPI, VerifiedIdentityTokenInfoNAPI, VerifiedIdentityWithAddressInfosNAPI, VerifiedMostRecentShieldedAnchorNAPI, VerifiedPlatformAddressesInfosNAPI, VerifiedPlatformAddressInfoNAPI, VerifiedShieldedAnchorsNAPI, VerifiedShieldedEncryptedNoteNAPI, VerifiedShieldedEncryptedNotesNAPI, VerifiedShieldedNotesCountNAPI, VerifiedShieldedNullifierNAPI, VerifiedShieldedNullifiersNAPI, VerifiedShieldedPoolStateNAPI, VerifiedStateTransitionResultNAPI, VerifiedTokenBalancesForIdentitiesNAPI, VerifiedTokenContractInfoNAPI, VerifiedTokenDirectPurchasePricesNAPI, VerifiedTokenGroupActionWithDocumentNAPI, VerifiedTokenGroupActionWithTokenBalanceNAPI, VerifiedTokenGroupActionWithTokenIdentityInfoNAPI, VerifiedTokenGroupActionWithTokenPricingScheduleNAPI, VerifiedTokenPricingScheduleNAPI, VerifiedTokensBalancesForIdentityNAPI, VerifiedTokenTotalSupplyNAPI, VerifiedTotalCreditsNAPI, VerifiedVoteStateNAPI, VoteNAPI, VotePollNAPI, WitnessNAPI, ActionGoalNAPI, AssetLockProofTypeNAPI, BatchTypeNAPI, GasFeesPaidByNAPI, GroupActionStatusNAPI, KeyTypeNAPI, NetworkNAPI, PlatformVersionNAPI, PoolingNAPI, PurposeNAPI, SecurityLevelNAPI, TokenDistributionTypeNAPI, TokenEmergencyActionNAPI, VoteStateResultTypeNAPI } = protocol.default;
|
package/dist/src/dpp/dpp.d.ts
CHANGED
|
@@ -117,3 +117,20 @@ export { verifyTokenTotalSupplyProof } from './verify/Tokens/verifyTokenTotalSup
|
|
|
117
117
|
export { verifyTokensBalancesForIdentityProof } from './verify/Tokens/verifyTokensBalancesForIdentityProof.js';
|
|
118
118
|
export { verifyPlatformAddressInfo } from './verify/PlatformAddress/verifyPlatformAddressInfo.js';
|
|
119
119
|
export { verifyPlatformAddressesInfos } from './verify/PlatformAddress/verifyPlatformAddressesInfos.js';
|
|
120
|
+
export { verifyShieldedEncryptedNotesProof } from './verify/Shielded/verifyShieldedEncryptedNotesProof.js';
|
|
121
|
+
export { verifyShieldedAnchorsProof } from './verify/Shielded/verifyShieldedAnchorsProof.js';
|
|
122
|
+
export { verifyMostRecentShieldedAnchorProof } from './verify/Shielded/verifyMostRecentShieldedAnchorProof.js';
|
|
123
|
+
export { verifyShieldedPoolStateProof } from './verify/Shielded/verifyShieldedPoolStateProof.js';
|
|
124
|
+
export { verifyShieldedNotesCountProof } from './verify/Shielded/verifyShieldedNotesCountProof.js';
|
|
125
|
+
export { verifyShieldedNullifiersProof } from './verify/Shielded/verifyShieldedNullifiersProof.js';
|
|
126
|
+
export { OrchardAddressWASM, orchardOvkFromSeed } from './structs/Orchard/OrchardAddress.js';
|
|
127
|
+
export { ShieldedMemoWASM } from './structs/Orchard/ShieldedMemo.js';
|
|
128
|
+
export { NoteWASM } from './structs/Orchard/Note.js';
|
|
129
|
+
export { MerklePathWASM } from './structs/Orchard/MerklePath.js';
|
|
130
|
+
export { SpendableNoteWASM } from './structs/Orchard/SpendableNote.js';
|
|
131
|
+
export { CommitmentTreeWASM } from './structs/Orchard/CommitmentTree.js';
|
|
132
|
+
export { OrchardProverWASM } from './structs/Orchard/OrchardProver.js';
|
|
133
|
+
export { ShieldedWithdrawalResultWASM } from './structs/Orchard/ShieldedWithdrawalResult.js';
|
|
134
|
+
export { RecoveredNoteWASM, recoverNotes } from './structs/Orchard/RecoveredNote.js';
|
|
135
|
+
export { ShieldedBuilderWASM } from './structs/Orchard/ShieldedBuilder.js';
|
|
136
|
+
export { IdentityCreateFromShieldedPoolResultWASM } from './structs/Orchard/IdentityCreateFromShieldedPoolResult.js';
|
package/dist/src/dpp/dpp.js
CHANGED
|
@@ -117,3 +117,20 @@ export { verifyTokenTotalSupplyProof } from './verify/Tokens/verifyTokenTotalSup
|
|
|
117
117
|
export { verifyTokensBalancesForIdentityProof } from './verify/Tokens/verifyTokensBalancesForIdentityProof.js';
|
|
118
118
|
export { verifyPlatformAddressInfo } from './verify/PlatformAddress/verifyPlatformAddressInfo.js';
|
|
119
119
|
export { verifyPlatformAddressesInfos } from './verify/PlatformAddress/verifyPlatformAddressesInfos.js';
|
|
120
|
+
export { verifyShieldedEncryptedNotesProof } from './verify/Shielded/verifyShieldedEncryptedNotesProof.js';
|
|
121
|
+
export { verifyShieldedAnchorsProof } from './verify/Shielded/verifyShieldedAnchorsProof.js';
|
|
122
|
+
export { verifyMostRecentShieldedAnchorProof } from './verify/Shielded/verifyMostRecentShieldedAnchorProof.js';
|
|
123
|
+
export { verifyShieldedPoolStateProof } from './verify/Shielded/verifyShieldedPoolStateProof.js';
|
|
124
|
+
export { verifyShieldedNotesCountProof } from './verify/Shielded/verifyShieldedNotesCountProof.js';
|
|
125
|
+
export { verifyShieldedNullifiersProof } from './verify/Shielded/verifyShieldedNullifiersProof.js';
|
|
126
|
+
export { OrchardAddressWASM, orchardOvkFromSeed } from './structs/Orchard/OrchardAddress.js';
|
|
127
|
+
export { ShieldedMemoWASM } from './structs/Orchard/ShieldedMemo.js';
|
|
128
|
+
export { NoteWASM } from './structs/Orchard/Note.js';
|
|
129
|
+
export { MerklePathWASM } from './structs/Orchard/MerklePath.js';
|
|
130
|
+
export { SpendableNoteWASM } from './structs/Orchard/SpendableNote.js';
|
|
131
|
+
export { CommitmentTreeWASM } from './structs/Orchard/CommitmentTree.js';
|
|
132
|
+
export { OrchardProverWASM } from './structs/Orchard/OrchardProver.js';
|
|
133
|
+
export { ShieldedWithdrawalResultWASM } from './structs/Orchard/ShieldedWithdrawalResult.js';
|
|
134
|
+
export { RecoveredNoteWASM, recoverNotes } from './structs/Orchard/RecoveredNote.js';
|
|
135
|
+
export { ShieldedBuilderWASM } from './structs/Orchard/ShieldedBuilder.js';
|
|
136
|
+
export { IdentityCreateFromShieldedPoolResultWASM } from './structs/Orchard/IdentityCreateFromShieldedPoolResult.js';
|
|
@@ -11,6 +11,9 @@ export class IdentifierWASM {
|
|
|
11
11
|
const id = new dpp.DynamicValue(rawId);
|
|
12
12
|
this._rawIdentifier = new dpp.IdentifierNAPI(id);
|
|
13
13
|
}
|
|
14
|
+
else if (rawId instanceof dpp.IdentifierNAPI) {
|
|
15
|
+
this._rawIdentifier = rawId;
|
|
16
|
+
}
|
|
14
17
|
else {
|
|
15
18
|
throw new Error('Invalid raw ID');
|
|
16
19
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CommitmentTreeNAPI } from '../../../../binaries/bindingsTypes.js';
|
|
2
|
+
import { MerklePathWASM } from './MerklePath.js';
|
|
3
|
+
export declare class CommitmentTreeWASM {
|
|
4
|
+
/** @private **/
|
|
5
|
+
_rawCommitmentTree: CommitmentTreeNAPI;
|
|
6
|
+
constructor(maxCheckpoints?: number);
|
|
7
|
+
/** Appends a note commitment (cmx). `marked` = spendable (can be witnessed). */
|
|
8
|
+
append(cmx: Uint8Array, marked: boolean): void;
|
|
9
|
+
checkpoint(checkpointId: number): boolean;
|
|
10
|
+
maxLeafPosition(): number | null;
|
|
11
|
+
witness(position: number, checkpointDepth?: number): MerklePathWASM | null;
|
|
12
|
+
anchor(): Uint8Array;
|
|
13
|
+
static createFromRawInstance(rawInstance: CommitmentTreeNAPI): CommitmentTreeWASM;
|
|
14
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { dppProvider } from '../../provider.js';
|
|
2
|
+
import { MerklePathWASM } from './MerklePath.js';
|
|
3
|
+
export class CommitmentTreeWASM {
|
|
4
|
+
/** @private **/
|
|
5
|
+
_rawCommitmentTree;
|
|
6
|
+
constructor(maxCheckpoints) {
|
|
7
|
+
this._rawCommitmentTree = new dppProvider.dpp.CommitmentTreeNAPI(maxCheckpoints);
|
|
8
|
+
}
|
|
9
|
+
/** Appends a note commitment (cmx). `marked` = spendable (can be witnessed). */
|
|
10
|
+
append(cmx, marked) {
|
|
11
|
+
this._rawCommitmentTree.append(cmx, marked);
|
|
12
|
+
}
|
|
13
|
+
checkpoint(checkpointId) {
|
|
14
|
+
return this._rawCommitmentTree.checkpoint(checkpointId);
|
|
15
|
+
}
|
|
16
|
+
maxLeafPosition() {
|
|
17
|
+
return this._rawCommitmentTree.maxLeafPosition();
|
|
18
|
+
}
|
|
19
|
+
witness(position, checkpointDepth) {
|
|
20
|
+
const path = this._rawCommitmentTree.witness(position, checkpointDepth);
|
|
21
|
+
return path != null ? MerklePathWASM.createFromRawInstance(path) : null;
|
|
22
|
+
}
|
|
23
|
+
anchor() {
|
|
24
|
+
return this._rawCommitmentTree.anchor();
|
|
25
|
+
}
|
|
26
|
+
static createFromRawInstance(rawInstance) {
|
|
27
|
+
const instance = Object.create(CommitmentTreeWASM.prototype);
|
|
28
|
+
instance._rawCommitmentTree = rawInstance;
|
|
29
|
+
return instance;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { IdentityCreateFromShieldedPoolResultNAPI } from '../../../../binaries/bindingsTypes.js';
|
|
2
|
+
import { IdentifierWASM } from '../Identifier.js';
|
|
3
|
+
import { IdentityPublicKeyInCreationWASM } from '../IdentityPublicKeyInCreation.js';
|
|
4
|
+
import { SerializedActionWASM } from '../ShieldedTransitions/SerializedAction.js';
|
|
5
|
+
/**
|
|
6
|
+
* Result of `identityCreateFromShieldedPool`: the new identity's keys (with
|
|
7
|
+
* proof-of-possession signatures), the proven Orchard bundle fields, the derived
|
|
8
|
+
* identity id, and the client-predicted fee.
|
|
9
|
+
*/
|
|
10
|
+
export declare class IdentityCreateFromShieldedPoolResultWASM {
|
|
11
|
+
/** @private **/
|
|
12
|
+
_rawIdentityCreateFromShieldedPoolResult: IdentityCreateFromShieldedPoolResultNAPI;
|
|
13
|
+
get publicKeys(): IdentityPublicKeyInCreationWASM[];
|
|
14
|
+
get identityId(): IdentifierWASM;
|
|
15
|
+
get predictedFee(): bigint;
|
|
16
|
+
get actions(): SerializedActionWASM[];
|
|
17
|
+
get anchor(): Uint8Array;
|
|
18
|
+
get proof(): Uint8Array;
|
|
19
|
+
get bindingsSignature(): Uint8Array;
|
|
20
|
+
static createFromRawInstance(rawInstance: IdentityCreateFromShieldedPoolResultNAPI): IdentityCreateFromShieldedPoolResultWASM;
|
|
21
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { IdentifierWASM } from '../Identifier.js';
|
|
2
|
+
import { IdentityPublicKeyInCreationWASM } from '../IdentityPublicKeyInCreation.js';
|
|
3
|
+
import { SerializedActionWASM } from '../ShieldedTransitions/SerializedAction.js';
|
|
4
|
+
/**
|
|
5
|
+
* Result of `identityCreateFromShieldedPool`: the new identity's keys (with
|
|
6
|
+
* proof-of-possession signatures), the proven Orchard bundle fields, the derived
|
|
7
|
+
* identity id, and the client-predicted fee.
|
|
8
|
+
*/
|
|
9
|
+
export class IdentityCreateFromShieldedPoolResultWASM {
|
|
10
|
+
/** @private **/
|
|
11
|
+
_rawIdentityCreateFromShieldedPoolResult;
|
|
12
|
+
get publicKeys() {
|
|
13
|
+
return this._rawIdentityCreateFromShieldedPoolResult.publicKeys.map(IdentityPublicKeyInCreationWASM.createFromRawInstance);
|
|
14
|
+
}
|
|
15
|
+
get identityId() {
|
|
16
|
+
return new IdentifierWASM(this._rawIdentityCreateFromShieldedPoolResult.identityId);
|
|
17
|
+
}
|
|
18
|
+
get predictedFee() {
|
|
19
|
+
return BigInt(this._rawIdentityCreateFromShieldedPoolResult.predictedFee);
|
|
20
|
+
}
|
|
21
|
+
get actions() {
|
|
22
|
+
return this._rawIdentityCreateFromShieldedPoolResult.actions.map(SerializedActionWASM.createFromRawInstance);
|
|
23
|
+
}
|
|
24
|
+
get anchor() {
|
|
25
|
+
return this._rawIdentityCreateFromShieldedPoolResult.anchor;
|
|
26
|
+
}
|
|
27
|
+
get proof() {
|
|
28
|
+
return this._rawIdentityCreateFromShieldedPoolResult.proof;
|
|
29
|
+
}
|
|
30
|
+
get bindingsSignature() {
|
|
31
|
+
return this._rawIdentityCreateFromShieldedPoolResult.bindingsSignature;
|
|
32
|
+
}
|
|
33
|
+
static createFromRawInstance(rawInstance) {
|
|
34
|
+
const instance = Object.create(IdentityCreateFromShieldedPoolResultWASM.prototype);
|
|
35
|
+
instance._rawIdentityCreateFromShieldedPoolResult = rawInstance;
|
|
36
|
+
return instance;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { MerklePathNAPI } from '../../../../binaries/bindingsTypes.js';
|
|
2
|
+
export declare class MerklePathWASM {
|
|
3
|
+
/** @private **/
|
|
4
|
+
_rawMerklePath: MerklePathNAPI;
|
|
5
|
+
constructor(position: number, authPath: Uint8Array[]);
|
|
6
|
+
get position(): number;
|
|
7
|
+
set position(value: number);
|
|
8
|
+
get authPath(): Uint8Array[];
|
|
9
|
+
set authPath(value: Uint8Array[]);
|
|
10
|
+
static createFromRawInstance(rawInstance: MerklePathNAPI): MerklePathWASM;
|
|
11
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { dppProvider } from '../../provider.js';
|
|
2
|
+
export class MerklePathWASM {
|
|
3
|
+
/** @private **/
|
|
4
|
+
_rawMerklePath;
|
|
5
|
+
constructor(position, authPath) {
|
|
6
|
+
this._rawMerklePath = new dppProvider.dpp.MerklePathNAPI(position, authPath);
|
|
7
|
+
}
|
|
8
|
+
get position() {
|
|
9
|
+
return this._rawMerklePath.position;
|
|
10
|
+
}
|
|
11
|
+
set position(value) {
|
|
12
|
+
this._rawMerklePath.position = value;
|
|
13
|
+
}
|
|
14
|
+
get authPath() {
|
|
15
|
+
return this._rawMerklePath.authPath;
|
|
16
|
+
}
|
|
17
|
+
set authPath(value) {
|
|
18
|
+
this._rawMerklePath.authPath = value;
|
|
19
|
+
}
|
|
20
|
+
static createFromRawInstance(rawInstance) {
|
|
21
|
+
const instance = Object.create(MerklePathWASM.prototype);
|
|
22
|
+
instance._rawMerklePath = rawInstance;
|
|
23
|
+
return instance;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { NoteNAPI } from '../../../../binaries/bindingsTypes.js';
|
|
2
|
+
import { OrchardAddressWASM } from './OrchardAddress.js';
|
|
3
|
+
export declare class NoteWASM {
|
|
4
|
+
/** @private **/
|
|
5
|
+
_rawNote: NoteNAPI;
|
|
6
|
+
constructor(address: OrchardAddressWASM, value: bigint, rho: Uint8Array, rseed: Uint8Array);
|
|
7
|
+
get address(): OrchardAddressWASM;
|
|
8
|
+
set address(value: OrchardAddressWASM);
|
|
9
|
+
get value(): bigint;
|
|
10
|
+
set value(value: bigint);
|
|
11
|
+
get rho(): Uint8Array;
|
|
12
|
+
set rho(value: Uint8Array);
|
|
13
|
+
get rseed(): Uint8Array;
|
|
14
|
+
set rseed(value: Uint8Array);
|
|
15
|
+
/** The note commitment (cmx, 32 bytes) — its leaf in the commitment tree. */
|
|
16
|
+
get cmx(): Uint8Array;
|
|
17
|
+
static createFromRawInstance(rawInstance: NoteNAPI): NoteWASM;
|
|
18
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { dppProvider } from '../../provider.js';
|
|
2
|
+
import { OrchardAddressWASM } from './OrchardAddress.js';
|
|
3
|
+
export class NoteWASM {
|
|
4
|
+
/** @private **/
|
|
5
|
+
_rawNote;
|
|
6
|
+
constructor(address, value, rho, rseed) {
|
|
7
|
+
this._rawNote = new dppProvider.dpp.NoteNAPI(address._rawOrchardAddress, value.toString(), rho, rseed);
|
|
8
|
+
}
|
|
9
|
+
get address() {
|
|
10
|
+
return OrchardAddressWASM.createFromRawInstance(this._rawNote.address);
|
|
11
|
+
}
|
|
12
|
+
set address(value) {
|
|
13
|
+
this._rawNote.address = value._rawOrchardAddress;
|
|
14
|
+
}
|
|
15
|
+
get value() {
|
|
16
|
+
return BigInt(this._rawNote.value);
|
|
17
|
+
}
|
|
18
|
+
set value(value) {
|
|
19
|
+
this._rawNote.value = value.toString();
|
|
20
|
+
}
|
|
21
|
+
get rho() {
|
|
22
|
+
return this._rawNote.rho;
|
|
23
|
+
}
|
|
24
|
+
set rho(value) {
|
|
25
|
+
this._rawNote.rho = value;
|
|
26
|
+
}
|
|
27
|
+
get rseed() {
|
|
28
|
+
return this._rawNote.rseed;
|
|
29
|
+
}
|
|
30
|
+
set rseed(value) {
|
|
31
|
+
this._rawNote.rseed = value;
|
|
32
|
+
}
|
|
33
|
+
/** The note commitment (cmx, 32 bytes) — its leaf in the commitment tree. */
|
|
34
|
+
get cmx() {
|
|
35
|
+
return this._rawNote.cmx;
|
|
36
|
+
}
|
|
37
|
+
static createFromRawInstance(rawInstance) {
|
|
38
|
+
const instance = Object.create(NoteWASM.prototype);
|
|
39
|
+
instance._rawNote = rawInstance;
|
|
40
|
+
return instance;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { OrchardAddressNAPI } from '../../../../binaries/bindingsTypes.js';
|
|
2
|
+
import { NetworkLike } from '../../types.js';
|
|
3
|
+
export declare class OrchardAddressWASM {
|
|
4
|
+
/** @private **/
|
|
5
|
+
_rawOrchardAddress: OrchardAddressNAPI;
|
|
6
|
+
toBech32m(network: NetworkLike): string;
|
|
7
|
+
bytes(): Uint8Array;
|
|
8
|
+
static fromBech32m(bech32m: string): OrchardAddressWASM;
|
|
9
|
+
static fromBytes(bytes: Uint8Array): OrchardAddressWASM;
|
|
10
|
+
/** Derives the address from a BIP-39 seed via ZIP-32 (m/32'/coinType'/account'). */
|
|
11
|
+
static fromSeed(seed: Uint8Array, coinType: number, account: number, diversifierIndex?: number): OrchardAddressWASM;
|
|
12
|
+
static createFromRawInstance(rawInstance: OrchardAddressNAPI): OrchardAddressWASM;
|
|
13
|
+
}
|
|
14
|
+
/** Derives the sender's Orchard outgoing viewing key (32 bytes) from a BIP-39 seed. */
|
|
15
|
+
export declare function orchardOvkFromSeed(seed: Uint8Array, coinType: number, account: number): Uint8Array;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { dppProvider } from '../../provider.js';
|
|
2
|
+
import { valueToDynamicValue } from '../../utils.js';
|
|
3
|
+
export class OrchardAddressWASM {
|
|
4
|
+
/** @private **/
|
|
5
|
+
_rawOrchardAddress;
|
|
6
|
+
toBech32m(network) {
|
|
7
|
+
return this._rawOrchardAddress.toBech32m(valueToDynamicValue(network));
|
|
8
|
+
}
|
|
9
|
+
bytes() {
|
|
10
|
+
return this._rawOrchardAddress.bytes();
|
|
11
|
+
}
|
|
12
|
+
static fromBech32m(bech32m) {
|
|
13
|
+
return OrchardAddressWASM.createFromRawInstance(dppProvider.dpp.OrchardAddressNAPI.fromBech32m(bech32m));
|
|
14
|
+
}
|
|
15
|
+
static fromBytes(bytes) {
|
|
16
|
+
return OrchardAddressWASM.createFromRawInstance(dppProvider.dpp.OrchardAddressNAPI.fromBytes(bytes));
|
|
17
|
+
}
|
|
18
|
+
/** Derives the address from a BIP-39 seed via ZIP-32 (m/32'/coinType'/account'). */
|
|
19
|
+
static fromSeed(seed, coinType, account, diversifierIndex) {
|
|
20
|
+
return OrchardAddressWASM.createFromRawInstance(dppProvider.dpp.OrchardAddressNAPI.fromSeed(seed, coinType, account, diversifierIndex));
|
|
21
|
+
}
|
|
22
|
+
static createFromRawInstance(rawInstance) {
|
|
23
|
+
const instance = Object.create(OrchardAddressWASM.prototype);
|
|
24
|
+
instance._rawOrchardAddress = rawInstance;
|
|
25
|
+
return instance;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/** Derives the sender's Orchard outgoing viewing key (32 bytes) from a BIP-39 seed. */
|
|
29
|
+
export function orchardOvkFromSeed(seed, coinType, account) {
|
|
30
|
+
return dppProvider.dpp.orchardOvkFromSeed(seed, coinType, account);
|
|
31
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { OrchardProverNAPI } from '../../../../binaries/bindingsTypes.js';
|
|
2
|
+
/**
|
|
3
|
+
* Reusable Orchard prover holding the Halo 2 proving key. Building it is
|
|
4
|
+
* expensive (~seconds); construct once and reuse. (The `ShieldedBuilderWASM`
|
|
5
|
+
* already builds its own prover internally — this is exposed for standalone use.)
|
|
6
|
+
*/
|
|
7
|
+
export declare class OrchardProverWASM {
|
|
8
|
+
/** @private **/
|
|
9
|
+
_rawOrchardProver: OrchardProverNAPI;
|
|
10
|
+
constructor();
|
|
11
|
+
static createFromRawInstance(rawInstance: OrchardProverNAPI): OrchardProverWASM;
|
|
12
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { dppProvider } from '../../provider.js';
|
|
2
|
+
/**
|
|
3
|
+
* Reusable Orchard prover holding the Halo 2 proving key. Building it is
|
|
4
|
+
* expensive (~seconds); construct once and reuse. (The `ShieldedBuilderWASM`
|
|
5
|
+
* already builds its own prover internally — this is exposed for standalone use.)
|
|
6
|
+
*/
|
|
7
|
+
export class OrchardProverWASM {
|
|
8
|
+
/** @private **/
|
|
9
|
+
_rawOrchardProver;
|
|
10
|
+
constructor() {
|
|
11
|
+
this._rawOrchardProver = new dppProvider.dpp.OrchardProverNAPI();
|
|
12
|
+
}
|
|
13
|
+
static createFromRawInstance(rawInstance) {
|
|
14
|
+
const instance = Object.create(OrchardProverWASM.prototype);
|
|
15
|
+
instance._rawOrchardProver = rawInstance;
|
|
16
|
+
return instance;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { RecoveredNoteNAPI } from '../../../../binaries/bindingsTypes.js';
|
|
2
|
+
import { NoteWASM } from './Note.js';
|
|
3
|
+
import { SerializedActionWASM } from '../ShieldedTransitions/SerializedAction.js';
|
|
4
|
+
/** A note recovered from a shielded action by trial-decryption. */
|
|
5
|
+
export declare class RecoveredNoteWASM {
|
|
6
|
+
/** @private **/
|
|
7
|
+
_rawRecoveredNote: RecoveredNoteNAPI;
|
|
8
|
+
/** The action's global leaf position in the commitment tree. */
|
|
9
|
+
get index(): number;
|
|
10
|
+
get note(): NoteWASM;
|
|
11
|
+
static createFromRawInstance(rawInstance: RecoveredNoteNAPI): RecoveredNoteWASM;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Recovers your own notes from a set of shielded actions by trial-decrypting
|
|
15
|
+
* each with the viewing key derived from `seed` (ZIP-32 m/32'/coinType'/account').
|
|
16
|
+
* Only actions addressed to you are returned; `index` is the global leaf position.
|
|
17
|
+
*/
|
|
18
|
+
export declare function recoverNotes(actions: SerializedActionWASM[], seed: Uint8Array, coinType: number, account: number): RecoveredNoteWASM[];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { dppProvider } from '../../provider.js';
|
|
2
|
+
import { NoteWASM } from './Note.js';
|
|
3
|
+
/** A note recovered from a shielded action by trial-decryption. */
|
|
4
|
+
export class RecoveredNoteWASM {
|
|
5
|
+
/** @private **/
|
|
6
|
+
_rawRecoveredNote;
|
|
7
|
+
/** The action's global leaf position in the commitment tree. */
|
|
8
|
+
get index() {
|
|
9
|
+
return this._rawRecoveredNote.index;
|
|
10
|
+
}
|
|
11
|
+
get note() {
|
|
12
|
+
return NoteWASM.createFromRawInstance(this._rawRecoveredNote.note);
|
|
13
|
+
}
|
|
14
|
+
static createFromRawInstance(rawInstance) {
|
|
15
|
+
const instance = Object.create(RecoveredNoteWASM.prototype);
|
|
16
|
+
instance._rawRecoveredNote = rawInstance;
|
|
17
|
+
return instance;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Recovers your own notes from a set of shielded actions by trial-decrypting
|
|
22
|
+
* each with the viewing key derived from `seed` (ZIP-32 m/32'/coinType'/account').
|
|
23
|
+
* Only actions addressed to you are returned; `index` is the global leaf position.
|
|
24
|
+
*/
|
|
25
|
+
export function recoverNotes(actions, seed, coinType, account) {
|
|
26
|
+
return dppProvider.dpp
|
|
27
|
+
.recoverNotes(actions.map(a => a._rawSerializedAction), seed, coinType, account)
|
|
28
|
+
.map(RecoveredNoteWASM.createFromRawInstance);
|
|
29
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { PlatformVersionNAPI, ShieldedBuilderNAPI } from '../../../../binaries/bindingsTypes.js';
|
|
2
|
+
import { PlatformAddressLike, PoolingLike } from '../../types.js';
|
|
3
|
+
import { OrchardAddressWASM } from './OrchardAddress.js';
|
|
4
|
+
import { ShieldedMemoWASM } from './ShieldedMemo.js';
|
|
5
|
+
import { SpendableNoteWASM } from './SpendableNote.js';
|
|
6
|
+
import { ShieldedWithdrawalResultWASM } from './ShieldedWithdrawalResult.js';
|
|
7
|
+
import { AssetLockProofWASM } from '../AssetLockProof/AssetLockProof.js';
|
|
8
|
+
import { PrivateKeyWASM } from '../PrivateKey.js';
|
|
9
|
+
import { CoreScriptWASM } from '../CoreScript.js';
|
|
10
|
+
import { StateTransitionWASM } from '../StateTransition.js';
|
|
11
|
+
import { InputAddressWASM } from '../AddressTransitions/entities/InputAddress.js';
|
|
12
|
+
import { AddressFundsFeeStrategyStepWASM } from '../AddressTransitions/entities/AddressFundsFeeStrategyStep.js';
|
|
13
|
+
import { IdentityPublicKeyInCreationWASM } from '../IdentityPublicKeyInCreation.js';
|
|
14
|
+
import { IdentityCreateFromShieldedPoolResultWASM } from './IdentityCreateFromShieldedPoolResult.js';
|
|
15
|
+
/**
|
|
16
|
+
* Builds and proves shielded (Orchard) state transitions. Construction builds
|
|
17
|
+
* the Halo 2 proving key (~seconds), so create one instance and reuse it.
|
|
18
|
+
*
|
|
19
|
+
* Deposits (`shield`, `shieldFromAssetLock`) don't need pool notes. Spends
|
|
20
|
+
* (`shieldedWithdrawal`, `unshield`, `shieldedTransfer`) need a `SpendableNote`
|
|
21
|
+
* witnessed against an on-chain anchor — rebuild the tree from the full pool
|
|
22
|
+
* note set (getShieldedEncryptedNotes) with `CommitmentTreeWASM`.
|
|
23
|
+
*/
|
|
24
|
+
export declare class ShieldedBuilderWASM {
|
|
25
|
+
/** @private **/
|
|
26
|
+
_rawShieldedBuilder: ShieldedBuilderNAPI;
|
|
27
|
+
constructor();
|
|
28
|
+
/** Asset lock -> pool (deposit). */
|
|
29
|
+
shieldFromAssetLock(recipient: OrchardAddressWASM, shieldAmount: bigint, assetLockProof: AssetLockProofWASM, privateKey: PrivateKeyWASM, memo: ShieldedMemoWASM, dummyOutputs: number, senderOvk?: Uint8Array, surplusOutput?: PlatformAddressLike, platformVersion?: PlatformVersionNAPI): StateTransitionWASM;
|
|
30
|
+
/** Transparent platform addresses -> pool (deposit). One private key per input. */
|
|
31
|
+
shield(recipient: OrchardAddressWASM, shieldAmount: bigint, inputs: InputAddressWASM[], privateKeys: PrivateKeyWASM[], feeStrategy: AddressFundsFeeStrategyStepWASM[], userFeeIncrease: number, memo: ShieldedMemoWASM, senderOvk?: Uint8Array, platformVersion?: PlatformVersionNAPI): StateTransitionWASM;
|
|
32
|
+
/** Pool -> core L1 (spend). */
|
|
33
|
+
shieldedWithdrawal(spends: SpendableNoteWASM[], withdrawalAmount: bigint, outputScript: CoreScriptWASM, coreFeePerByte: number, pooling: PoolingLike, changeAddress: OrchardAddressWASM, seed: Uint8Array, coinType: number, account: number, anchor: Uint8Array, memo: ShieldedMemoWASM, platformVersion?: PlatformVersionNAPI): ShieldedWithdrawalResultWASM;
|
|
34
|
+
/** Pool -> platform identity balance (spend). */
|
|
35
|
+
unshield(spends: SpendableNoteWASM[], outputAddress: PlatformAddressLike, unshieldAmount: bigint, changeAddress: OrchardAddressWASM, seed: Uint8Array, coinType: number, account: number, anchor: Uint8Array, memo: ShieldedMemoWASM, platformVersion?: PlatformVersionNAPI): ShieldedWithdrawalResultWASM;
|
|
36
|
+
/** Pool -> pool (spend). */
|
|
37
|
+
shieldedTransfer(spends: SpendableNoteWASM[], recipient: OrchardAddressWASM, transferAmount: bigint, changeAddress: OrchardAddressWASM, seed: Uint8Array, coinType: number, account: number, anchor: Uint8Array, memo: ShieldedMemoWASM, platformVersion?: PlatformVersionNAPI): ShieldedWithdrawalResultWASM;
|
|
38
|
+
/** Pool -> new identity (spend). One private key per public key, same order. */
|
|
39
|
+
identityCreateFromShieldedPool(publicKeys: IdentityPublicKeyInCreationWASM[], privateKeys: PrivateKeyWASM[], denomination: bigint, sendToAddressOnCreationFailure: PlatformAddressLike, spends: SpendableNoteWASM[], changeAddress: OrchardAddressWASM, seed: Uint8Array, coinType: number, account: number, anchor: Uint8Array, memo: ShieldedMemoWASM, platformVersion?: PlatformVersionNAPI): IdentityCreateFromShieldedPoolResultWASM;
|
|
40
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { dppProvider } from '../../provider.js';
|
|
2
|
+
import { preparePlatformAddressValue, valueToDynamicValue } from '../../utils.js';
|
|
3
|
+
import { ShieldedWithdrawalResultWASM } from './ShieldedWithdrawalResult.js';
|
|
4
|
+
import { StateTransitionWASM } from '../StateTransition.js';
|
|
5
|
+
import { IdentityCreateFromShieldedPoolResultWASM } from './IdentityCreateFromShieldedPoolResult.js';
|
|
6
|
+
/**
|
|
7
|
+
* Builds and proves shielded (Orchard) state transitions. Construction builds
|
|
8
|
+
* the Halo 2 proving key (~seconds), so create one instance and reuse it.
|
|
9
|
+
*
|
|
10
|
+
* Deposits (`shield`, `shieldFromAssetLock`) don't need pool notes. Spends
|
|
11
|
+
* (`shieldedWithdrawal`, `unshield`, `shieldedTransfer`) need a `SpendableNote`
|
|
12
|
+
* witnessed against an on-chain anchor — rebuild the tree from the full pool
|
|
13
|
+
* note set (getShieldedEncryptedNotes) with `CommitmentTreeWASM`.
|
|
14
|
+
*/
|
|
15
|
+
export class ShieldedBuilderWASM {
|
|
16
|
+
/** @private **/
|
|
17
|
+
_rawShieldedBuilder;
|
|
18
|
+
constructor() {
|
|
19
|
+
this._rawShieldedBuilder = new dppProvider.dpp.ShieldedBuilderNAPI();
|
|
20
|
+
}
|
|
21
|
+
/** Asset lock -> pool (deposit). */
|
|
22
|
+
shieldFromAssetLock(recipient, shieldAmount, assetLockProof, privateKey, memo, dummyOutputs, senderOvk, surplusOutput, platformVersion) {
|
|
23
|
+
return StateTransitionWASM.createFromRawInstance(this._rawShieldedBuilder.shieldFromAssetLock(recipient._rawOrchardAddress, shieldAmount.toString(), assetLockProof._rawAssetLockProof, privateKey._rawPrivateKey, memo._rawShieldedMemo, dummyOutputs, senderOvk, surplusOutput != null ? preparePlatformAddressValue(surplusOutput) : undefined, platformVersion));
|
|
24
|
+
}
|
|
25
|
+
/** Transparent platform addresses -> pool (deposit). One private key per input. */
|
|
26
|
+
shield(recipient, shieldAmount, inputs, privateKeys, feeStrategy, userFeeIncrease, memo, senderOvk, platformVersion) {
|
|
27
|
+
return StateTransitionWASM.createFromRawInstance(this._rawShieldedBuilder.shield(recipient._rawOrchardAddress, shieldAmount.toString(), inputs.map(i => i._rawInputAddress), privateKeys.map(k => k._rawPrivateKey), feeStrategy.map(s => s._rawAddressFundsFeeStrategyStep), userFeeIncrease, memo._rawShieldedMemo, senderOvk, platformVersion));
|
|
28
|
+
}
|
|
29
|
+
/** Pool -> core L1 (spend). */
|
|
30
|
+
shieldedWithdrawal(spends, withdrawalAmount, outputScript, coreFeePerByte, pooling, changeAddress, seed, coinType, account, anchor, memo, platformVersion) {
|
|
31
|
+
return ShieldedWithdrawalResultWASM.createFromRawInstance(this._rawShieldedBuilder.shieldedWithdrawal(spends.map(s => s._rawSpendableNote), withdrawalAmount.toString(), outputScript._rawCoreScript, coreFeePerByte, valueToDynamicValue(pooling), changeAddress._rawOrchardAddress, seed, coinType, account, anchor, memo._rawShieldedMemo, platformVersion));
|
|
32
|
+
}
|
|
33
|
+
/** Pool -> platform identity balance (spend). */
|
|
34
|
+
unshield(spends, outputAddress, unshieldAmount, changeAddress, seed, coinType, account, anchor, memo, platformVersion) {
|
|
35
|
+
return ShieldedWithdrawalResultWASM.createFromRawInstance(this._rawShieldedBuilder.unshield(spends.map(s => s._rawSpendableNote), preparePlatformAddressValue(outputAddress), unshieldAmount.toString(), changeAddress._rawOrchardAddress, seed, coinType, account, anchor, memo._rawShieldedMemo, platformVersion));
|
|
36
|
+
}
|
|
37
|
+
/** Pool -> pool (spend). */
|
|
38
|
+
shieldedTransfer(spends, recipient, transferAmount, changeAddress, seed, coinType, account, anchor, memo, platformVersion) {
|
|
39
|
+
return ShieldedWithdrawalResultWASM.createFromRawInstance(this._rawShieldedBuilder.shieldedTransfer(spends.map(s => s._rawSpendableNote), recipient._rawOrchardAddress, transferAmount.toString(), changeAddress._rawOrchardAddress, seed, coinType, account, anchor, memo._rawShieldedMemo, platformVersion));
|
|
40
|
+
}
|
|
41
|
+
/** Pool -> new identity (spend). One private key per public key, same order. */
|
|
42
|
+
identityCreateFromShieldedPool(publicKeys, privateKeys, denomination, sendToAddressOnCreationFailure, spends, changeAddress, seed, coinType, account, anchor, memo, platformVersion) {
|
|
43
|
+
return IdentityCreateFromShieldedPoolResultWASM.createFromRawInstance(this._rawShieldedBuilder.identityCreateFromShieldedPool(publicKeys.map(k => k._rawKeyInCreation), privateKeys.map(k => k._rawPrivateKey), denomination.toString(), preparePlatformAddressValue(sendToAddressOnCreationFailure), spends.map(s => s._rawSpendableNote), changeAddress._rawOrchardAddress, seed, coinType, account, anchor, memo._rawShieldedMemo, platformVersion));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ShieldedMemoNAPI } from '../../../../binaries/bindingsTypes.js';
|
|
2
|
+
export declare class ShieldedMemoWASM {
|
|
3
|
+
/** @private **/
|
|
4
|
+
_rawShieldedMemo: ShieldedMemoNAPI;
|
|
5
|
+
toString(): string;
|
|
6
|
+
toBytes(): Uint8Array;
|
|
7
|
+
static empty(): ShieldedMemoWASM;
|
|
8
|
+
static fromString(value: string): ShieldedMemoWASM;
|
|
9
|
+
static other(kind: number, payload: Uint8Array): ShieldedMemoWASM;
|
|
10
|
+
static createFromRawInstance(rawInstance: ShieldedMemoNAPI): ShieldedMemoWASM;
|
|
11
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { dppProvider } from '../../provider.js';
|
|
2
|
+
export class ShieldedMemoWASM {
|
|
3
|
+
/** @private **/
|
|
4
|
+
_rawShieldedMemo;
|
|
5
|
+
toString() {
|
|
6
|
+
return this._rawShieldedMemo.toString();
|
|
7
|
+
}
|
|
8
|
+
toBytes() {
|
|
9
|
+
return this._rawShieldedMemo.toBytes();
|
|
10
|
+
}
|
|
11
|
+
static empty() {
|
|
12
|
+
return ShieldedMemoWASM.createFromRawInstance(dppProvider.dpp.ShieldedMemoNAPI.empty());
|
|
13
|
+
}
|
|
14
|
+
static fromString(value) {
|
|
15
|
+
return ShieldedMemoWASM.createFromRawInstance(dppProvider.dpp.ShieldedMemoNAPI.fromString(value));
|
|
16
|
+
}
|
|
17
|
+
static other(kind, payload) {
|
|
18
|
+
return ShieldedMemoWASM.createFromRawInstance(dppProvider.dpp.ShieldedMemoNAPI.other(kind, payload));
|
|
19
|
+
}
|
|
20
|
+
static createFromRawInstance(rawInstance) {
|
|
21
|
+
const instance = Object.create(ShieldedMemoWASM.prototype);
|
|
22
|
+
instance._rawShieldedMemo = rawInstance;
|
|
23
|
+
return instance;
|
|
24
|
+
}
|
|
25
|
+
}
|