pshenmic-dpp 2.0.0-dev.9 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +164 -77
- package/dist/binaries/bindingsTypes.d.ts +903 -18
- package/dist/binaries/bindingsTypes.js +13 -0
- package/dist/binaries/memory.cjs +7 -0
- package/dist/binaries/memory.d.cts +2 -0
- package/dist/binaries/native/aarch64-apple-darwin/pshenmic_dpp.node +0 -0
- package/dist/binaries/native/aarch64-pc-windows-msvc/pshenmic_dpp.node +0 -0
- package/dist/binaries/native/aarch64-unknown-linux-gnu/pshenmic_dpp.node +0 -0
- package/dist/binaries/native/aarch64-unknown-linux-musl/pshenmic_dpp.node +0 -0
- package/dist/binaries/native/x86_64-apple-darwin/pshenmic_dpp.node +0 -0
- package/dist/binaries/native/x86_64-pc-windows-msvc/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/node.cjs +71 -0
- package/dist/binaries/node.d.cts +2 -0
- package/dist/binaries/pshenmic_dpp.android.node/arm64-v8a/libpshenmic_dpp.so +0 -0
- package/dist/binaries/pshenmic_dpp.apple.node/Info.plist +29 -0
- package/dist/binaries/pshenmic_dpp.apple.node/ios-arm64-simulator/libpshenmic_dpp.framework/Info.plist +24 -0
- package/dist/binaries/pshenmic_dpp.apple.node/ios-arm64-simulator/libpshenmic_dpp.framework/libpshenmic_dpp +0 -0
- package/dist/binaries/pshenmic_dpp.apple.node/react-native-node-api-module +0 -0
- package/dist/binaries/pshenmic_dpp.d.ts +60 -0
- package/dist/binaries/pshenmic_dpp.js +1 -1
- package/dist/binaries/wasm/wasmBytes.cjs +4 -0
- package/dist/binaries/wasm/wasmBytes.d.cts +2 -0
- package/dist/binaries/wasm/workerBundle.cjs +6 -0
- package/dist/binaries/wasm/workerBundle.d.cts +2 -0
- package/dist/binaries/wasm.d.ts +60 -0
- package/dist/binaries/wasm.js +2 -44
- package/dist/binaries/wasmCreation.cjs +127 -0
- package/dist/binaries/wasmCreation.d.cts +4 -0
- package/dist/src/dpp/dpp.d.ts +32 -0
- package/dist/src/dpp/dpp.js +32 -0
- package/dist/src/dpp/enums.d.ts +1 -1
- package/dist/src/dpp/enums.js +1 -1
- package/dist/src/dpp/structs/AddressTransitions/AddressCreditWithdrawalTransition.d.ts +3 -1
- package/dist/src/dpp/structs/AddressTransitions/AddressCreditWithdrawalTransition.js +6 -0
- package/dist/src/dpp/structs/AddressTransitions/AddressFundingFromAssetLockTransition.d.ts +2 -1
- package/dist/src/dpp/structs/AddressTransitions/AddressFundingFromAssetLockTransition.js +3 -0
- package/dist/src/dpp/structs/AddressTransitions/AddressFundsTransferTransition.d.ts +3 -1
- package/dist/src/dpp/structs/AddressTransitions/AddressFundsTransferTransition.js +6 -0
- package/dist/src/dpp/structs/AddressTransitions/IdentityCreateFromAddressesTransition.d.ts +2 -1
- package/dist/src/dpp/structs/AddressTransitions/IdentityCreateFromAddressesTransition.js +3 -0
- package/dist/src/dpp/structs/AddressTransitions/IdentityCreditTransferToAddressesTransition.d.ts +2 -1
- package/dist/src/dpp/structs/AddressTransitions/IdentityCreditTransferToAddressesTransition.js +3 -0
- package/dist/src/dpp/structs/AddressTransitions/IdentityTopUpFromAddressesTransition.d.ts +2 -1
- package/dist/src/dpp/structs/AddressTransitions/IdentityTopUpFromAddressesTransition.js +3 -0
- package/dist/src/dpp/structs/Batch/BatchTransition.d.ts +2 -1
- package/dist/src/dpp/structs/Batch/BatchTransition.js +3 -0
- package/dist/src/dpp/structs/DataContractTransitions/DataContractCreateTransition.d.ts +2 -1
- package/dist/src/dpp/structs/DataContractTransitions/DataContractCreateTransition.js +3 -0
- package/dist/src/dpp/structs/DataContractTransitions/DataContractUpdateTransition.d.ts +2 -1
- package/dist/src/dpp/structs/DataContractTransitions/DataContractUpdateTransition.js +3 -0
- package/dist/src/dpp/structs/Identifier.js +3 -0
- package/dist/src/dpp/structs/IdentityTransitions/IdentityCreateTransition.d.ts +2 -1
- package/dist/src/dpp/structs/IdentityTransitions/IdentityCreateTransition.js +3 -0
- package/dist/src/dpp/structs/IdentityTransitions/IdentityCreditTransfer.d.ts +2 -1
- package/dist/src/dpp/structs/IdentityTransitions/IdentityCreditTransfer.js +3 -0
- package/dist/src/dpp/structs/IdentityTransitions/IdentityCreditWithdrawalTransition.d.ts +2 -1
- package/dist/src/dpp/structs/IdentityTransitions/IdentityCreditWithdrawalTransition.js +3 -0
- package/dist/src/dpp/structs/IdentityTransitions/IdentityTopUpTransition.d.ts +2 -1
- package/dist/src/dpp/structs/IdentityTransitions/IdentityTopUpTransition.js +3 -0
- package/dist/src/dpp/structs/IdentityTransitions/IdentityUpdateTransition.d.ts +2 -1
- package/dist/src/dpp/structs/IdentityTransitions/IdentityUpdateTransition.js +3 -0
- package/dist/src/dpp/structs/MasternodeVote/MasternodeVoteTransition.d.ts +2 -3
- package/dist/src/dpp/structs/MasternodeVote/MasternodeVoteTransition.js +3 -6
- 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/FullViewingKey.d.ts +27 -0
- package/dist/src/dpp/structs/Orchard/FullViewingKey.js +45 -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/IncomingViewingKey.d.ts +29 -0
- package/dist/src/dpp/structs/Orchard/IncomingViewingKey.js +44 -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 +27 -0
- package/dist/src/dpp/structs/Orchard/OrchardAddress.js +45 -0
- package/dist/src/dpp/structs/Orchard/OrchardProver.d.ts +19 -0
- package/dist/src/dpp/structs/Orchard/OrchardProver.js +34 -0
- package/dist/src/dpp/structs/Orchard/RecoveredNote.d.ts +19 -0
- package/dist/src/dpp/structs/Orchard/RecoveredNote.js +32 -0
- package/dist/src/dpp/structs/Orchard/ShieldedBuilder.d.ts +64 -0
- package/dist/src/dpp/structs/Orchard/ShieldedBuilder.js +79 -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/ShieldedOutput.d.ts +23 -0
- package/dist/src/dpp/structs/Orchard/ShieldedOutput.js +41 -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/structs/PlatformAddress/PlatformAddress.d.ts +9 -1
- package/dist/src/dpp/structs/PlatformAddress/PlatformAddress.js +10 -0
- package/dist/src/dpp/structs/ShieldedTransitions/IdentityCreateFromShieldedPoolTransition.d.ts +32 -0
- package/dist/src/dpp/structs/ShieldedTransitions/IdentityCreateFromShieldedPoolTransition.js +76 -0
- package/dist/src/dpp/structs/ShieldedTransitions/SerializedAction.d.ts +19 -0
- package/dist/src/dpp/structs/ShieldedTransitions/SerializedAction.js +49 -0
- package/dist/src/dpp/structs/ShieldedTransitions/ShieldFromAssetLockTransition.d.ts +31 -0
- package/dist/src/dpp/structs/ShieldedTransitions/ShieldFromAssetLockTransition.js +80 -0
- package/dist/src/dpp/structs/ShieldedTransitions/ShieldTransition.d.ts +33 -0
- package/dist/src/dpp/structs/ShieldedTransitions/ShieldTransition.js +81 -0
- package/dist/src/dpp/structs/ShieldedTransitions/ShieldedTransferTransition.d.ts +22 -0
- package/dist/src/dpp/structs/ShieldedTransitions/ShieldedTransferTransition.js +54 -0
- package/dist/src/dpp/structs/ShieldedTransitions/ShieldedWithdrawalTransition.d.ts +30 -0
- package/dist/src/dpp/structs/ShieldedTransitions/ShieldedWithdrawalTransition.js +74 -0
- package/dist/src/dpp/structs/ShieldedTransitions/UnshieldTransition.d.ts +26 -0
- package/dist/src/dpp/structs/ShieldedTransitions/UnshieldTransition.js +62 -0
- package/dist/src/dpp/structs/StateTransition.d.ts +2 -1
- package/dist/src/dpp/structs/StateTransition.js +3 -0
- package/dist/src/dpp/types.d.ts +177 -3
- package/dist/src/dpp/verify/AddressFunds/utils.d.ts +5 -0
- package/dist/src/dpp/verify/AddressFunds/utils.js +28 -0
- package/dist/src/dpp/verify/AddressFunds/verifyAddressesBranchState.d.ts +12 -0
- package/dist/src/dpp/verify/AddressFunds/verifyAddressesBranchState.js +29 -0
- package/dist/src/dpp/verify/AddressFunds/verifyAddressesTrunkState.d.ts +9 -0
- package/dist/src/dpp/verify/AddressFunds/verifyAddressesTrunkState.js +30 -0
- package/dist/src/dpp/verify/AddressFunds/verifyRecentAddressBalanceChanges.d.ts +9 -0
- package/dist/src/dpp/verify/AddressFunds/verifyRecentAddressBalanceChanges.js +24 -0
- package/dist/src/dpp/verify/AddressFunds/verifyRecentCompactedAddressBalanceChanges.d.ts +10 -0
- package/dist/src/dpp/verify/AddressFunds/verifyRecentCompactedAddressBalanceChanges.js +30 -0
- package/dist/src/dpp/verify/Contested/verifyVotePollVoteStateProof.d.ts +1 -1
- package/dist/src/dpp/verify/Contested/verifyVotePollVoteStateProof.js +1 -1
- 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/dist/src/dpp/verify/StateTransition/utils.js +76 -11
- package/dist/src/dpp/verify/StateTransition/verifyStateTransitionResult.js +2 -1
- package/dist/src/dpp/verify/System/verifyFinalizedEpochInfosProof.d.ts +2 -0
- package/dist/src/dpp/verify/System/verifyFinalizedEpochInfosProof.js +27 -0
- package/dist/src/native.d.ts +3 -0
- package/dist/src/native.js +8 -0
- package/dist/utils/{base122.js → base122.cjs} +3 -1
- package/package.json +17 -27
- package/tests/unit/AddressTransitionsFees.spec.ts +274 -0
- package/tests/unit/DataContract.spec.ts +281 -0
- package/tests/unit/DynamicValue.spec.ts +2 -2
- package/tests/unit/Identifier.spec.ts +1 -1
- package/tests/unit/Identity.spec.ts +1 -1
- package/tests/unit/IdentityPublicKey.spec.ts +1 -1
- package/tests/unit/NodeApi.spec.ts +49 -0
- package/tests/unit/Shielded.spec.ts +555 -0
- package/tests/unit/ShieldedTransitions.spec.ts +877 -0
- package/tests/unit/StateTransitionFees.spec.ts +177 -0
- package/tests/unit/TokenConfiguration.spec.ts +114 -0
- package/tests/unit/WebAssembly.spec.ts +88 -0
- package/tests/unit/utils/buildTokenConfiguration.ts +66 -0
- package/dist/binaries/pshenmic_dpp.android.node/x86_64/libpshenmic_dpp.so +0 -0
- package/dist/binaries/wasm/wasmBytes.d.ts +0 -2
- package/dist/binaries/wasm/wasmBytes.js +0 -2
- /package/dist/utils/{base122.d.ts → base122.d.cts} +0 -0
|
@@ -79,6 +79,9 @@ export class StateTransitionWASM {
|
|
|
79
79
|
getSignableBytes() {
|
|
80
80
|
return this._rawStateTransition.getSignableBytes();
|
|
81
81
|
}
|
|
82
|
+
calculateMinRequiredFee(platformVersion) {
|
|
83
|
+
return BigInt(this._rawStateTransition.calculateMinRequiredFee(platformVersion));
|
|
84
|
+
}
|
|
82
85
|
bytes() {
|
|
83
86
|
return this._rawStateTransition.bytes();
|
|
84
87
|
}
|
package/dist/src/dpp/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type * as protocol from '../../binaries/bindingsTypes.js';
|
|
2
|
-
import { ActionGoal, AssetLockProofType, GasFeesPaidByWASM, KeyType, NetworkWASM, PlatformVersionWASM, PoolingWASM, Purpose, SecurityLevel, TokenDistributionType, TokenEmergencyActionWASM, VoteStateResultType } from './enums.js';
|
|
2
|
+
import { ActionGoal, AssetLockProofType, GasFeesPaidByWASM, KeyType, NetworkWASM, PlatformVersionWASM, PoolingWASM, Purpose, ScopeWASM, SecurityLevel, TokenDistributionType, TokenEmergencyActionWASM, VoteStateResultType } from './enums.js';
|
|
3
3
|
import { IdentifierWASM } from './structs/Identifier.js';
|
|
4
4
|
import { languageCodes } from './constants.js';
|
|
5
5
|
import { DistributionFunctionWASM } from './structs/TokenConfiguration/DistributionFunction.js';
|
|
@@ -44,6 +44,7 @@ export type TokenEmergencyActionLike = TokenEmergencyActionWASM | keyof typeof T
|
|
|
44
44
|
export type AssetLockProofTypeLike = AssetLockProofType | keyof typeof AssetLockProofType | Lowercase<keyof typeof AssetLockProofType>;
|
|
45
45
|
export type PoolingLike = PoolingWASM | keyof typeof PoolingWASM | Lowercase<keyof typeof PoolingWASM>;
|
|
46
46
|
export type VoteStateResultTypeLike = VoteStateResultType | keyof typeof VoteStateResultType | Lowercase<keyof typeof VoteStateResultType>;
|
|
47
|
+
export type ScopeLike = ScopeWASM | keyof typeof ScopeWASM | Lowercase<keyof typeof ScopeWASM>;
|
|
47
48
|
export type AddressWitnessP2PKH = protocol.AddressWitnessP2pkhNAPI;
|
|
48
49
|
export type AddressWitnessP2SH = protocol.AddressWitnessP2shNAPI;
|
|
49
50
|
export type TokenConfigurationLocalizationJson = protocol.TokenConfigurationLocalizationJsonNAPI;
|
|
@@ -84,10 +85,32 @@ export interface ExtendedEpochInfo {
|
|
|
84
85
|
feeMultiplierPermille: bigint;
|
|
85
86
|
protocolVersion: number;
|
|
86
87
|
}
|
|
88
|
+
export interface FinalizedEpochInfo {
|
|
89
|
+
epochIndex: number;
|
|
90
|
+
firstBlockTime: Date;
|
|
91
|
+
firstBlockHeight: bigint;
|
|
92
|
+
totalBlocksInEpoch: bigint;
|
|
93
|
+
firstCoreBlockHeight: number;
|
|
94
|
+
nextEpochStartCoreBlockHeight: number;
|
|
95
|
+
totalProcessingFees: bigint;
|
|
96
|
+
totalDistributedStorageFees: bigint;
|
|
97
|
+
totalCreatedStorageFees: bigint;
|
|
98
|
+
coreBlockRewards: bigint;
|
|
99
|
+
blockProposers: {
|
|
100
|
+
proposer: IdentifierWASM;
|
|
101
|
+
count: bigint;
|
|
102
|
+
}[];
|
|
103
|
+
feeMultiplierPermille: bigint;
|
|
104
|
+
protocolVersion: number;
|
|
105
|
+
}
|
|
87
106
|
export interface VerifiedEpochsInfo {
|
|
88
107
|
rootHash: Uint8Array;
|
|
89
108
|
epochsInfo: ExtendedEpochInfo[];
|
|
90
109
|
}
|
|
110
|
+
export interface VerifiedFinalizedEpochsInfo {
|
|
111
|
+
rootHash: Uint8Array;
|
|
112
|
+
epochInfos: FinalizedEpochInfo[];
|
|
113
|
+
}
|
|
91
114
|
export interface VerifiedTotalCredits {
|
|
92
115
|
rootHash: Uint8Array;
|
|
93
116
|
totalCredits: bigint;
|
|
@@ -195,11 +218,45 @@ export interface VerifiedIdentityWithAddressInfos {
|
|
|
195
218
|
identity: PartialIdentityWASM;
|
|
196
219
|
infos: VerifiedPlatformAddressInfo[];
|
|
197
220
|
}
|
|
198
|
-
export
|
|
199
|
-
|
|
221
|
+
export interface AssetLockValue {
|
|
222
|
+
initialCreditValue: bigint;
|
|
223
|
+
txOutScript: Uint8Array;
|
|
224
|
+
remainingCreditValue: bigint;
|
|
225
|
+
usedTags: Uint8Array[];
|
|
226
|
+
}
|
|
227
|
+
export type StoredAssetLockInfoType = 'FullyConsumed' | 'PartiallyConsumed' | 'NotPresent';
|
|
228
|
+
export interface StoredAssetLockInfo {
|
|
229
|
+
type: StoredAssetLockInfoType;
|
|
230
|
+
value?: AssetLockValue;
|
|
231
|
+
}
|
|
232
|
+
export type ShieldedNullifier = [Uint8Array, boolean];
|
|
233
|
+
export interface VerifiedShieldedNullifiersWithAddressInfos {
|
|
234
|
+
nullifiers: ShieldedNullifier[];
|
|
235
|
+
infos: VerifiedPlatformAddressInfo[];
|
|
236
|
+
}
|
|
237
|
+
export interface VerifiedShieldedNullifiersWithWithdrawalDocument {
|
|
238
|
+
nullifiers: ShieldedNullifier[];
|
|
239
|
+
documents: VerifiedDocument[];
|
|
240
|
+
}
|
|
241
|
+
export interface VerifiedAssetLockConsumedWithAddressInfos {
|
|
242
|
+
storedAssetLockInfo: StoredAssetLockInfo;
|
|
243
|
+
infos: VerifiedPlatformAddressInfo[];
|
|
244
|
+
}
|
|
245
|
+
export interface VerifiedIdentityWithShieldedNullifiers {
|
|
246
|
+
identity: IdentityWASM;
|
|
247
|
+
nullifiers: ShieldedNullifier[];
|
|
248
|
+
}
|
|
249
|
+
export type VerifiedStateTransitionResultVariants = DataContractWASM | IdentityWASM | IdentifierWASM | VerifiedIdentityBalance | VerifiedIdentityTokenInfo | VerifiedTokenPricingSchedule | TokenStatus | VerifiedIdentityBalance[] | PartialIdentityWASM | VerifiedBalanceTransfer | VerifiedDocument[] | DocumentWASM | VerifiedTokenGroupActionWithDocument | VerifiedTokenGroupActionWithTokenBalance | VerifiedTokenGroupActionWithTokenIdentityInfo | VerifiedTokenGroupActionWithTokenPricingSchedule | VoteWASM | VerifiedPlatformAddressInfo[] | VerifiedIdentityFullWithAddressInfos | VerifiedIdentityWithAddressInfos | StoredAssetLockInfo | ShieldedNullifier[] | VerifiedShieldedNullifiersWithAddressInfos | VerifiedShieldedNullifiersWithWithdrawalDocument | VerifiedAssetLockConsumedWithAddressInfos | VerifiedIdentityWithShieldedNullifiers;
|
|
250
|
+
export type VerifiedStateTransitionResultVariantsRAW = protocol.DataContractNAPI | protocol.IdentityNAPI | protocol.IdentifierNAPI | protocol.VerifiedIdentityBalanceNAPI | protocol.VerifiedIdentityTokenInfoNAPI | protocol.VerifiedTokenPricingScheduleNAPI | protocol.TokenStatusNAPI | protocol.VerifiedIdentityBalanceNAPI[] | protocol.PartialIdentityNAPI | protocol.VerifiedBalanceTransferNAPI | protocol.VerifiedDocumentNAPI[] | protocol.DocumentNAPI | protocol.VerifiedTokenGroupActionWithDocumentNAPI | protocol.VerifiedTokenGroupActionWithTokenBalanceNAPI | protocol.VerifiedTokenGroupActionWithTokenIdentityInfoNAPI | protocol.VerifiedTokenGroupActionWithTokenPricingScheduleNAPI | protocol.VoteNAPI | protocol.PlatformAddressInfoNAPI[] | protocol.VerifiedIdentityFullWithAddressInfosNAPI | protocol.VerifiedIdentityWithAddressInfosNAPI | protocol.StoredAssetLockInfoNAPI | Array<[Uint8Array, boolean]> | [Array<[Uint8Array, boolean]>, protocol.PlatformAddressInfoNAPI[]] | [Array<[Uint8Array, boolean]>, protocol.VerifiedDocumentNAPI[]] | [protocol.StoredAssetLockInfoNAPI, protocol.PlatformAddressInfoNAPI[]] | [protocol.IdentityNAPI, Array<[Uint8Array, boolean]>];
|
|
200
251
|
export interface VerifiedStateTransitionResult {
|
|
201
252
|
rootHash: Uint8Array;
|
|
202
253
|
result: VerifiedStateTransitionResultVariants;
|
|
254
|
+
/**
|
|
255
|
+
* Whether the proof binds the execution of this specific state transition.
|
|
256
|
+
* When false, the result is a height-pinned snapshot of the state the
|
|
257
|
+
* transition affects, not evidence that the transition executed.
|
|
258
|
+
*/
|
|
259
|
+
isExecutionProved: boolean;
|
|
203
260
|
}
|
|
204
261
|
export type WhereOperator = '=' | '==' | '>' | '>=' | '<' | '<=' | 'Between' | 'between' | 'BetweenExcludeBounds' | 'betweenExcludeBounds' | 'betweenexcludebounds' | 'between_exclude_bounds' | 'BetweenExcludeLeft' | 'betweenExcludeLeft' | 'betweenexcludeleft' | 'between_exclude_left' | 'BetweenExcludeRight' | 'betweenExcludeRight' | 'betweenexcluderight' | 'between_exclude_right' | 'In' | 'in' | 'StartsWith' | 'startsWith' | 'startswith' | 'starts_with';
|
|
205
262
|
export type WhereClause = [
|
|
@@ -282,3 +339,120 @@ export interface VerifiedPlatformAddressesInfosWithRootHash {
|
|
|
282
339
|
rootHash: Uint8Array;
|
|
283
340
|
infos: VerifiedPlatformAddressInfo[];
|
|
284
341
|
}
|
|
342
|
+
export interface VerifiedShieldedEncryptedNote {
|
|
343
|
+
cmx: Uint8Array;
|
|
344
|
+
nullifier: Uint8Array;
|
|
345
|
+
cvNet: Uint8Array;
|
|
346
|
+
encryptedNote: Uint8Array;
|
|
347
|
+
}
|
|
348
|
+
export interface VerifiedShieldedEncryptedNotes {
|
|
349
|
+
rootHash: Uint8Array;
|
|
350
|
+
notes: VerifiedShieldedEncryptedNote[];
|
|
351
|
+
totalCount: bigint;
|
|
352
|
+
}
|
|
353
|
+
export interface VerifiedShieldedAnchors {
|
|
354
|
+
rootHash: Uint8Array;
|
|
355
|
+
anchors: Uint8Array[];
|
|
356
|
+
}
|
|
357
|
+
export interface VerifiedMostRecentShieldedAnchor {
|
|
358
|
+
rootHash: Uint8Array;
|
|
359
|
+
anchor?: Uint8Array;
|
|
360
|
+
}
|
|
361
|
+
export interface VerifiedShieldedPoolState {
|
|
362
|
+
rootHash: Uint8Array;
|
|
363
|
+
totalBalance?: bigint;
|
|
364
|
+
}
|
|
365
|
+
export interface VerifiedShieldedNotesCount {
|
|
366
|
+
rootHash: Uint8Array;
|
|
367
|
+
count?: bigint;
|
|
368
|
+
}
|
|
369
|
+
export interface VerifiedShieldedNullifier {
|
|
370
|
+
nullifier: Uint8Array;
|
|
371
|
+
isSpent: boolean;
|
|
372
|
+
}
|
|
373
|
+
export interface VerifiedShieldedNullifiers {
|
|
374
|
+
rootHash: Uint8Array;
|
|
375
|
+
nullifiers: VerifiedShieldedNullifier[];
|
|
376
|
+
}
|
|
377
|
+
export type AddressBalanceOperation = 'setCredits' | 'addToCredits';
|
|
378
|
+
export interface AddressBalanceChange {
|
|
379
|
+
address: PlatformAddressWASM;
|
|
380
|
+
/** `setCredits` means `credits` is the new balance, `addToCredits` means it is the delta. */
|
|
381
|
+
operation: AddressBalanceOperation;
|
|
382
|
+
credits: bigint;
|
|
383
|
+
}
|
|
384
|
+
export interface BlockAddressBalanceChanges {
|
|
385
|
+
blockHeight: bigint;
|
|
386
|
+
changes: AddressBalanceChange[];
|
|
387
|
+
}
|
|
388
|
+
export interface VerifiedRecentAddressBalanceChanges {
|
|
389
|
+
rootHash: Uint8Array;
|
|
390
|
+
blocks: BlockAddressBalanceChanges[];
|
|
391
|
+
}
|
|
392
|
+
export type CompactedAddressBalanceOperation = 'setCredits' | 'addToCreditsOperations';
|
|
393
|
+
export interface BlockHeightCredit {
|
|
394
|
+
blockHeight: bigint;
|
|
395
|
+
credits: bigint;
|
|
396
|
+
}
|
|
397
|
+
export interface CompactedAddressBalanceChange {
|
|
398
|
+
address: PlatformAddressWASM;
|
|
399
|
+
operation: CompactedAddressBalanceOperation;
|
|
400
|
+
/** Populated when `operation` is `setCredits`. */
|
|
401
|
+
setCredits?: bigint;
|
|
402
|
+
/** Populated when `operation` is `addToCreditsOperations`, otherwise empty. */
|
|
403
|
+
addToCreditsOperations: BlockHeightCredit[];
|
|
404
|
+
}
|
|
405
|
+
export interface CompactedBlockAddressBalanceChanges {
|
|
406
|
+
startBlockHeight: bigint;
|
|
407
|
+
endBlockHeight: bigint;
|
|
408
|
+
changes: CompactedAddressBalanceChange[];
|
|
409
|
+
}
|
|
410
|
+
export interface VerifiedRecentCompactedAddressBalanceChanges {
|
|
411
|
+
rootHash: Uint8Array;
|
|
412
|
+
ranges: CompactedBlockAddressBalanceChanges[];
|
|
413
|
+
}
|
|
414
|
+
export type GroveElementType = 'Item' | 'ItemWithSumItem' | 'SumItem' | 'Reference' | 'ReferenceWithSumItem' | 'Tree' | 'SumTree' | 'BigSumTree' | 'ProvableSumTree' | 'CountTree' | 'ProvableCountTree' | 'CountSumTree' | 'ProvableCountSumTree' | 'ProvableCountProvableSumTree' | 'CommitmentTree' | 'MmrTree' | 'BulkAppendTree' | 'DenseAppendOnlyFixedSizeTree';
|
|
415
|
+
export type GroveElementWrapper = 'NonCounted' | 'NotSummed' | 'NotCountedOrSummed';
|
|
416
|
+
export interface GroveElement {
|
|
417
|
+
type: GroveElementType;
|
|
418
|
+
/** Set when the element opts out of its parent's aggregates; `type` still describes the wrapped element. */
|
|
419
|
+
wrapper?: GroveElementWrapper;
|
|
420
|
+
/** An item's payload, or a subtree's root key. Absent for empty subtrees. */
|
|
421
|
+
value?: Uint8Array;
|
|
422
|
+
sum?: bigint;
|
|
423
|
+
count?: bigint;
|
|
424
|
+
}
|
|
425
|
+
export interface GroveElementEntry {
|
|
426
|
+
key: Uint8Array;
|
|
427
|
+
element: GroveElement;
|
|
428
|
+
}
|
|
429
|
+
export interface GroveLeafInfo {
|
|
430
|
+
key: Uint8Array;
|
|
431
|
+
/** Pass as `expectedRootHash` when verifying this key's branch proof. */
|
|
432
|
+
hash: Uint8Array;
|
|
433
|
+
count?: bigint;
|
|
434
|
+
}
|
|
435
|
+
export interface GroveAncestor {
|
|
436
|
+
levelsUp: number;
|
|
437
|
+
count: bigint;
|
|
438
|
+
key: Uint8Array;
|
|
439
|
+
hash: Uint8Array;
|
|
440
|
+
}
|
|
441
|
+
export interface VerifiedAddressesTrunkState {
|
|
442
|
+
rootHash: Uint8Array;
|
|
443
|
+
elements: GroveElementEntry[];
|
|
444
|
+
/** Subtrees the trunk stops at. Empty when the whole tree fit in the trunk. */
|
|
445
|
+
leafKeys: GroveLeafInfo[];
|
|
446
|
+
chunkDepths: number[];
|
|
447
|
+
maxTreeDepth: number;
|
|
448
|
+
/** Which truncated subtree would hold `key`, or undefined if it is already in `elements`. */
|
|
449
|
+
traceKeyToLeaf: (key: Uint8Array) => GroveLeafInfo | undefined;
|
|
450
|
+
getAncestor: (leafKey: Uint8Array, minPrivacyTreeCount: bigint) => GroveAncestor | undefined;
|
|
451
|
+
}
|
|
452
|
+
export interface VerifiedAddressesBranchState {
|
|
453
|
+
elements: GroveElementEntry[];
|
|
454
|
+
leafKeys: GroveLeafInfo[];
|
|
455
|
+
branchRootHash: Uint8Array;
|
|
456
|
+
traceKeyToLeaf: (key: Uint8Array) => GroveLeafInfo | undefined;
|
|
457
|
+
getAncestor: (leafKey: Uint8Array, minPrivacyTreeCount: bigint) => GroveAncestor | undefined;
|
|
458
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type * as protocol from '../../../../binaries/bindingsTypes.js';
|
|
2
|
+
import { GroveAncestor, GroveElementEntry, GroveLeafInfo } from '../../types.js';
|
|
3
|
+
export declare function mapGroveElementEntry(entry: protocol.GroveElementEntryNAPI): GroveElementEntry;
|
|
4
|
+
export declare function mapGroveLeafInfo(info: protocol.GroveLeafInfoNAPI): GroveLeafInfo;
|
|
5
|
+
export declare function mapGroveAncestor(ancestor: protocol.GroveAncestorNAPI): GroveAncestor;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export function mapGroveElementEntry(entry) {
|
|
2
|
+
const { element } = entry;
|
|
3
|
+
return {
|
|
4
|
+
key: entry.key,
|
|
5
|
+
element: {
|
|
6
|
+
type: element.type,
|
|
7
|
+
wrapper: element.wrapper != null ? element.wrapper : undefined,
|
|
8
|
+
value: element.value ?? undefined,
|
|
9
|
+
sum: element.sum != null ? BigInt(element.sum) : undefined,
|
|
10
|
+
count: element.count != null ? BigInt(element.count) : undefined
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export function mapGroveLeafInfo(info) {
|
|
15
|
+
return {
|
|
16
|
+
key: info.key,
|
|
17
|
+
hash: info.hash,
|
|
18
|
+
count: info.count != null ? BigInt(info.count) : undefined
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export function mapGroveAncestor(ancestor) {
|
|
22
|
+
return {
|
|
23
|
+
levelsUp: ancestor.levelsUp,
|
|
24
|
+
count: BigInt(ancestor.count),
|
|
25
|
+
key: ancestor.key,
|
|
26
|
+
hash: ancestor.hash
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PlatformVersionLike, VerifiedAddressesBranchState } from '../../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Verifies a branch chunk proof for the address funds tree.
|
|
4
|
+
*
|
|
5
|
+
* `expectedRootHash` must be the `hash` the parent trunk or branch reported for
|
|
6
|
+
* `key`; it is what anchors this subtree to the proven root, so the result
|
|
7
|
+
* carries no root hash of its own.
|
|
8
|
+
*
|
|
9
|
+
* `depth` is validated against an allowed range, so take it from the parent
|
|
10
|
+
* trunk's `chunkDepths` rather than picking a value.
|
|
11
|
+
*/
|
|
12
|
+
export declare function verifyAddressesBranchState(proof: Uint8Array, key: Uint8Array, depth: number, expectedRootHash: Uint8Array, platformVersion: PlatformVersionLike): VerifiedAddressesBranchState;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { dppProvider } from '../../provider.js';
|
|
2
|
+
import { valueToDynamicValue } from '../../utils.js';
|
|
3
|
+
import { mapGroveAncestor, mapGroveElementEntry, mapGroveLeafInfo } from './utils.js';
|
|
4
|
+
/**
|
|
5
|
+
* Verifies a branch chunk proof for the address funds tree.
|
|
6
|
+
*
|
|
7
|
+
* `expectedRootHash` must be the `hash` the parent trunk or branch reported for
|
|
8
|
+
* `key`; it is what anchors this subtree to the proven root, so the result
|
|
9
|
+
* carries no root hash of its own.
|
|
10
|
+
*
|
|
11
|
+
* `depth` is validated against an allowed range, so take it from the parent
|
|
12
|
+
* trunk's `chunkDepths` rather than picking a value.
|
|
13
|
+
*/
|
|
14
|
+
export function verifyAddressesBranchState(proof, key, depth, expectedRootHash, platformVersion) {
|
|
15
|
+
const result = dppProvider.dpp.verifyAddressesBranchState(proof, key, depth, expectedRootHash, valueToDynamicValue(platformVersion));
|
|
16
|
+
return {
|
|
17
|
+
elements: result.elements.map(mapGroveElementEntry),
|
|
18
|
+
leafKeys: result.leafKeys.map(mapGroveLeafInfo),
|
|
19
|
+
branchRootHash: result.branchRootHash,
|
|
20
|
+
traceKeyToLeaf: (traced) => {
|
|
21
|
+
const leaf = result.traceKeyToLeaf(traced);
|
|
22
|
+
return leaf != null ? mapGroveLeafInfo(leaf) : undefined;
|
|
23
|
+
},
|
|
24
|
+
getAncestor: (leafKey, minPrivacyTreeCount) => {
|
|
25
|
+
const ancestor = result.getAncestor(leafKey, minPrivacyTreeCount.toString());
|
|
26
|
+
return ancestor != null ? mapGroveAncestor(ancestor) : undefined;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PlatformVersionLike, VerifiedAddressesTrunkState } from '../../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Verifies a trunk chunk proof for the address funds tree.
|
|
4
|
+
*
|
|
5
|
+
* The trunk covers the top of the tree only. Subtrees below it are truncated
|
|
6
|
+
* and listed in `leafKeys`; use `traceKeyToLeaf` to find which one holds an
|
|
7
|
+
* address, then fetch it with `verifyAddressesBranchState`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function verifyAddressesTrunkState(proof: Uint8Array, platformVersion: PlatformVersionLike): VerifiedAddressesTrunkState;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { dppProvider } from '../../provider.js';
|
|
2
|
+
import { valueToDynamicValue } from '../../utils.js';
|
|
3
|
+
import { mapGroveAncestor, mapGroveElementEntry, mapGroveLeafInfo } from './utils.js';
|
|
4
|
+
/**
|
|
5
|
+
* Verifies a trunk chunk proof for the address funds tree.
|
|
6
|
+
*
|
|
7
|
+
* The trunk covers the top of the tree only. Subtrees below it are truncated
|
|
8
|
+
* and listed in `leafKeys`; use `traceKeyToLeaf` to find which one holds an
|
|
9
|
+
* address, then fetch it with `verifyAddressesBranchState`.
|
|
10
|
+
*/
|
|
11
|
+
export function verifyAddressesTrunkState(proof, platformVersion) {
|
|
12
|
+
const result = dppProvider.dpp.verifyAddressesTrunkState(proof, valueToDynamicValue(platformVersion));
|
|
13
|
+
return {
|
|
14
|
+
rootHash: result.rootHash,
|
|
15
|
+
elements: result.elements.map(mapGroveElementEntry),
|
|
16
|
+
leafKeys: result.leafKeys.map(mapGroveLeafInfo),
|
|
17
|
+
chunkDepths: result.chunkDepths,
|
|
18
|
+
maxTreeDepth: result.maxTreeDepth,
|
|
19
|
+
// These close over the verified result because tracing walks the proof's
|
|
20
|
+
// reconstructed tree, which is not projected into plain data.
|
|
21
|
+
traceKeyToLeaf: (key) => {
|
|
22
|
+
const leaf = result.traceKeyToLeaf(key);
|
|
23
|
+
return leaf != null ? mapGroveLeafInfo(leaf) : undefined;
|
|
24
|
+
},
|
|
25
|
+
getAncestor: (leafKey, minPrivacyTreeCount) => {
|
|
26
|
+
const ancestor = result.getAncestor(leafKey, minPrivacyTreeCount.toString());
|
|
27
|
+
return ancestor != null ? mapGroveAncestor(ancestor) : undefined;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PlatformVersionLike, VerifiedRecentAddressBalanceChanges } from '../../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Verifies a proof of the address balance changes from a block height onwards.
|
|
4
|
+
*
|
|
5
|
+
* `startHeightExclusive` must match the flag the proof was requested with: it
|
|
6
|
+
* selects a range starting just past `startBlockHeight` rather than at it, and
|
|
7
|
+
* the two produce different queries, so a mismatch fails verification.
|
|
8
|
+
*/
|
|
9
|
+
export declare function verifyRecentAddressBalanceChanges(proof: Uint8Array, startBlockHeight: bigint, startHeightExclusive: boolean, limit: number | undefined, verifySubsetOfProof: boolean, platformVersion: PlatformVersionLike): VerifiedRecentAddressBalanceChanges;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { dppProvider } from '../../provider.js';
|
|
2
|
+
import { valueToDynamicValue } from '../../utils.js';
|
|
3
|
+
import { PlatformAddressWASM } from '../../structs/PlatformAddress/PlatformAddress.js';
|
|
4
|
+
/**
|
|
5
|
+
* Verifies a proof of the address balance changes from a block height onwards.
|
|
6
|
+
*
|
|
7
|
+
* `startHeightExclusive` must match the flag the proof was requested with: it
|
|
8
|
+
* selects a range starting just past `startBlockHeight` rather than at it, and
|
|
9
|
+
* the two produce different queries, so a mismatch fails verification.
|
|
10
|
+
*/
|
|
11
|
+
export function verifyRecentAddressBalanceChanges(proof, startBlockHeight, startHeightExclusive, limit, verifySubsetOfProof, platformVersion) {
|
|
12
|
+
const result = dppProvider.dpp.verifyRecentAddressBalanceChanges(proof, startBlockHeight.toString(), startHeightExclusive, limit, verifySubsetOfProof, valueToDynamicValue(platformVersion));
|
|
13
|
+
return {
|
|
14
|
+
rootHash: result.rootHash,
|
|
15
|
+
blocks: result.blocks.map((block) => ({
|
|
16
|
+
blockHeight: BigInt(block.blockHeight),
|
|
17
|
+
changes: block.changes.map((change) => ({
|
|
18
|
+
address: PlatformAddressWASM.createFromRawInstance(change.address),
|
|
19
|
+
operation: change.operation,
|
|
20
|
+
credits: BigInt(change.credits)
|
|
21
|
+
}))
|
|
22
|
+
}))
|
|
23
|
+
};
|
|
24
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PlatformVersionLike, VerifiedRecentCompactedAddressBalanceChanges } from '../../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Verifies a proof of the compacted address balance changes from a block height
|
|
4
|
+
* onwards, where each entry merges a range of blocks.
|
|
5
|
+
*
|
|
6
|
+
* There is no subset flag here: the proof is a self-contained envelope whose
|
|
7
|
+
* predecessor half authenticates which range covers the requested height, so
|
|
8
|
+
* the forward half has nothing to be a subset of.
|
|
9
|
+
*/
|
|
10
|
+
export declare function verifyRecentCompactedAddressBalanceChanges(proof: Uint8Array, startBlockHeight: bigint, limit: number | undefined, platformVersion: PlatformVersionLike): VerifiedRecentCompactedAddressBalanceChanges;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { dppProvider } from '../../provider.js';
|
|
2
|
+
import { valueToDynamicValue } from '../../utils.js';
|
|
3
|
+
import { PlatformAddressWASM } from '../../structs/PlatformAddress/PlatformAddress.js';
|
|
4
|
+
/**
|
|
5
|
+
* Verifies a proof of the compacted address balance changes from a block height
|
|
6
|
+
* onwards, where each entry merges a range of blocks.
|
|
7
|
+
*
|
|
8
|
+
* There is no subset flag here: the proof is a self-contained envelope whose
|
|
9
|
+
* predecessor half authenticates which range covers the requested height, so
|
|
10
|
+
* the forward half has nothing to be a subset of.
|
|
11
|
+
*/
|
|
12
|
+
export function verifyRecentCompactedAddressBalanceChanges(proof, startBlockHeight, limit, platformVersion) {
|
|
13
|
+
const result = dppProvider.dpp.verifyRecentCompactedAddressBalanceChanges(proof, startBlockHeight.toString(), limit, valueToDynamicValue(platformVersion));
|
|
14
|
+
return {
|
|
15
|
+
rootHash: result.rootHash,
|
|
16
|
+
ranges: result.ranges.map((range) => ({
|
|
17
|
+
startBlockHeight: BigInt(range.startBlockHeight),
|
|
18
|
+
endBlockHeight: BigInt(range.endBlockHeight),
|
|
19
|
+
changes: range.changes.map((change) => ({
|
|
20
|
+
address: PlatformAddressWASM.createFromRawInstance(change.address),
|
|
21
|
+
operation: change.operation,
|
|
22
|
+
setCredits: change.setCredits != null ? BigInt(change.setCredits) : undefined,
|
|
23
|
+
addToCreditsOperations: change.addToCreditsOperations.map((operation) => ({
|
|
24
|
+
blockHeight: BigInt(operation.blockHeight),
|
|
25
|
+
credits: BigInt(operation.credits)
|
|
26
|
+
}))
|
|
27
|
+
}))
|
|
28
|
+
}))
|
|
29
|
+
};
|
|
30
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { PlatformVersionLike, StartAt, VerifiedVoteState, VoteStateResultTypeLike } from '../../types.js';
|
|
2
2
|
import { DataContractWASM } from '../../structs/DataContract.js';
|
|
3
|
-
export declare function verifyVotePollVoteStateProof(proof: Uint8Array, contract: DataContractWASM, documentTypeName: string, indexName: string, indexValues: Uint8Array[], resultType: VoteStateResultTypeLike, allowIncludeLockedAndAbstainingVoteTally: boolean, count: number | undefined, startAt: StartAt | undefined, platformVersion: PlatformVersionLike): VerifiedVoteState;
|
|
3
|
+
export declare function verifyVotePollVoteStateProof(proof: Uint8Array, contract: DataContractWASM, documentTypeName: string, indexName: string, indexValues: Uint8Array[], resultType: VoteStateResultTypeLike, allowIncludeLockedAndAbstainingVoteTally: boolean | undefined, count: number | undefined, startAt: StartAt | undefined, platformVersion: PlatformVersionLike): VerifiedVoteState;
|
|
@@ -2,7 +2,7 @@ import { dppProvider } from '../../provider.js';
|
|
|
2
2
|
import { valueFromDynamicValue, valueToDynamicValue } from '../../utils.js';
|
|
3
3
|
import { IdentifierWASM } from '../../structs/Identifier.js';
|
|
4
4
|
export function verifyVotePollVoteStateProof(proof, contract, documentTypeName, indexName, indexValues, resultType, allowIncludeLockedAndAbstainingVoteTally, count, startAt, platformVersion) {
|
|
5
|
-
const result = dppProvider.dpp.verifyVotePollVoteStateProof(proof, contract._rawDataContract, documentTypeName, indexName, indexValues, valueToDynamicValue(resultType), allowIncludeLockedAndAbstainingVoteTally ??
|
|
5
|
+
const result = dppProvider.dpp.verifyVotePollVoteStateProof(proof, contract._rawDataContract, documentTypeName, indexName, indexValues, valueToDynamicValue(resultType), allowIncludeLockedAndAbstainingVoteTally ?? false, count, valueToDynamicValue(startAt), valueToDynamicValue(platformVersion));
|
|
6
6
|
const winner = valueFromDynamicValue(result.result.winner);
|
|
7
7
|
const winnerBlockInfo = winner?.blockInfo;
|
|
8
8
|
const outWinner = winner != null
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { dppProvider } from '../../provider.js';
|
|
2
|
+
import { valueToDynamicValue } from '../../utils.js';
|
|
3
|
+
export function verifyMostRecentShieldedAnchorProof(proof, verifySubsetOfProof, platformVersion) {
|
|
4
|
+
const result = dppProvider.dpp.verifyMostRecentShieldedAnchorProof(proof, verifySubsetOfProof, valueToDynamicValue(platformVersion));
|
|
5
|
+
return {
|
|
6
|
+
rootHash: result.rootHash,
|
|
7
|
+
anchor: result.anchor ?? undefined
|
|
8
|
+
};
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { dppProvider } from '../../provider.js';
|
|
2
|
+
import { valueToDynamicValue } from '../../utils.js';
|
|
3
|
+
export function verifyShieldedAnchorsProof(proof, verifySubsetOfProof, platformVersion) {
|
|
4
|
+
const result = dppProvider.dpp.verifyShieldedAnchorsProof(proof, verifySubsetOfProof, valueToDynamicValue(platformVersion));
|
|
5
|
+
return {
|
|
6
|
+
rootHash: result.rootHash,
|
|
7
|
+
anchors: result.anchors
|
|
8
|
+
};
|
|
9
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { PlatformVersionLike, VerifiedShieldedEncryptedNotes } from '../../types.js';
|
|
2
|
+
export declare function verifyShieldedEncryptedNotesProof(proof: Uint8Array, startIndex: bigint, count: number, maxElements: number, verifySubsetOfProof: boolean, platformVersion: PlatformVersionLike): VerifiedShieldedEncryptedNotes;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { dppProvider } from '../../provider.js';
|
|
2
|
+
import { valueToDynamicValue } from '../../utils.js';
|
|
3
|
+
export function verifyShieldedEncryptedNotesProof(proof, startIndex, count, maxElements, verifySubsetOfProof, platformVersion) {
|
|
4
|
+
const result = dppProvider.dpp.verifyShieldedEncryptedNotesProof(proof, startIndex.toString(), count, maxElements, verifySubsetOfProof, valueToDynamicValue(platformVersion));
|
|
5
|
+
return {
|
|
6
|
+
rootHash: result.rootHash,
|
|
7
|
+
notes: result.notes.map((note) => ({
|
|
8
|
+
cmx: note.cmx,
|
|
9
|
+
nullifier: note.nullifier,
|
|
10
|
+
cvNet: note.cvNet,
|
|
11
|
+
encryptedNote: note.encryptedNote
|
|
12
|
+
})),
|
|
13
|
+
totalCount: BigInt(result.totalCount)
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { dppProvider } from '../../provider.js';
|
|
2
|
+
import { valueToDynamicValue } from '../../utils.js';
|
|
3
|
+
export function verifyShieldedNotesCountProof(proof, verifySubsetOfProof, platformVersion) {
|
|
4
|
+
const result = dppProvider.dpp.verifyShieldedNotesCountProof(proof, verifySubsetOfProof, valueToDynamicValue(platformVersion));
|
|
5
|
+
return {
|
|
6
|
+
rootHash: result.rootHash,
|
|
7
|
+
count: result.count != null ? BigInt(result.count) : undefined
|
|
8
|
+
};
|
|
9
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { PlatformVersionLike, VerifiedShieldedNullifiers } from '../../types.js';
|
|
2
|
+
export declare function verifyShieldedNullifiersProof(proof: Uint8Array, nullifiers: Uint8Array[], verifySubsetOfProof: boolean, platformVersion: PlatformVersionLike): VerifiedShieldedNullifiers;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { dppProvider } from '../../provider.js';
|
|
2
|
+
import { valueToDynamicValue } from '../../utils.js';
|
|
3
|
+
export function verifyShieldedNullifiersProof(proof, nullifiers, verifySubsetOfProof, platformVersion) {
|
|
4
|
+
const result = dppProvider.dpp.verifyShieldedNullifiersProof(proof, nullifiers, verifySubsetOfProof, valueToDynamicValue(platformVersion));
|
|
5
|
+
return {
|
|
6
|
+
rootHash: result.rootHash,
|
|
7
|
+
nullifiers: result.nullifiers.map((nullifier) => ({
|
|
8
|
+
nullifier: nullifier.nullifier,
|
|
9
|
+
isSpent: nullifier.isSpent
|
|
10
|
+
}))
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { dppProvider } from '../../provider.js';
|
|
2
|
+
import { valueToDynamicValue } from '../../utils.js';
|
|
3
|
+
export function verifyShieldedPoolStateProof(proof, verifySubsetOfProof, platformVersion) {
|
|
4
|
+
const result = dppProvider.dpp.verifyShieldedPoolStateProof(proof, verifySubsetOfProof, valueToDynamicValue(platformVersion));
|
|
5
|
+
return {
|
|
6
|
+
rootHash: result.rootHash,
|
|
7
|
+
totalBalance: result.totalBalance != null ? BigInt(result.totalBalance) : undefined
|
|
8
|
+
};
|
|
9
|
+
}
|