dash-platform-sdk 1.4.0 → 1.5.0-dev.2

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.
Files changed (40) hide show
  1. package/README.md +15 -15
  2. package/bundle.min.js +17 -17
  3. package/package.json +2 -2
  4. package/proto/generated/platform.client.d.ts +70 -0
  5. package/proto/generated/platform.client.js +61 -12
  6. package/proto/generated/platform.d.ts +1025 -0
  7. package/proto/generated/platform.js +2074 -1
  8. package/src/DashPlatformSDK.d.ts +2 -0
  9. package/src/DashPlatformSDK.js +3 -0
  10. package/src/constants.d.ts +1 -0
  11. package/src/constants.js +1 -0
  12. package/src/keyPair/index.d.ts +25 -0
  13. package/src/keyPair/index.js +33 -0
  14. package/src/node/{epochs.d.ts → epochInfos.d.ts} +1 -1
  15. package/src/node/{epochs.js → epochInfos.js} +1 -1
  16. package/src/node/finalizedEpochInfos.d.ts +21 -0
  17. package/src/node/finalizedEpochInfos.js +54 -0
  18. package/src/node/index.d.ts +9 -1
  19. package/src/node/index.js +11 -1
  20. package/src/shielded/createStateTransition.d.ts +3 -0
  21. package/src/shielded/createStateTransition.js +55 -0
  22. package/src/shielded/getMostRecentShieldedAnchor.d.ts +2 -0
  23. package/src/shielded/getMostRecentShieldedAnchor.js +36 -0
  24. package/src/shielded/getShieldedAnchors.d.ts +2 -0
  25. package/src/shielded/getShieldedAnchors.js +36 -0
  26. package/src/shielded/getShieldedEncryptedNotes.d.ts +3 -0
  27. package/src/shielded/getShieldedEncryptedNotes.js +43 -0
  28. package/src/shielded/getShieldedNotesCount.d.ts +2 -0
  29. package/src/shielded/getShieldedNotesCount.js +36 -0
  30. package/src/shielded/getShieldedNullifiers.d.ts +3 -0
  31. package/src/shielded/getShieldedNullifiers.js +40 -0
  32. package/src/shielded/getShieldedPoolState.d.ts +2 -0
  33. package/src/shielded/getShieldedPoolState.js +36 -0
  34. package/src/shielded/index.d.ts +130 -0
  35. package/src/shielded/index.js +186 -0
  36. package/test/unit/KeyPair.spec.js +32 -0
  37. package/test/unit/Node.spec.js +6 -0
  38. package/test/unit/Shielded.spec.d.ts +1 -0
  39. package/test/unit/Shielded.spec.js +236 -0
  40. package/types.d.ts +85 -1
package/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { CoreScriptWASM, DocumentWASM, GasFeesPaidByWASM, IdentifierLike, IdentifierWASM, KeyType, PlatformAddressWASM, Purpose, SecurityLevel, TokenEmergencyActionWASM, TokenPricingScheduleWASM } from 'pshenmic-dpp';
1
+ import { AddressFundsFeeStrategyStepWASM, AssetLockProofWASM, CoreScriptWASM, DocumentWASM, GasFeesPaidByWASM, IdentifierLike, IdentifierWASM, InputAddressWASM, KeyType, OrchardAddressWASM, PlatformAddressLike, PlatformAddressWASM, PlatformVersionWASM, PoolingLike, PrivateKeyWASM, Purpose, SecurityLevel, SpendableNoteWASM, TokenEmergencyActionWASM, TokenPricingScheduleWASM } from 'pshenmic-dpp';
2
2
  export { CoreScriptWASM, DocumentWASM, GasFeesPaidByWASM, IdentifierWASM, KeyType, Purpose, SecurityLevel, TokenEmergencyActionWASM, TokenPricingScheduleWASM, StateTransitionWASM, BatchTransitionWASM, IdentityPublicKeyWASM, PrivateKeyWASM, DataContractUpdateTransitionWASM, IdentityWASM, IdentityUpdateTransitionWASM, IdentityCreditTransferWASM, MasternodeVoteTransitionWASM, IdentifierLike, PlatformAddressLike } from 'pshenmic-dpp';
3
3
  export type Network = 'mainnet' | 'testnet';
4
4
  export { DashPlatformSDK } from './src/DashPlatformSDK.js';
@@ -20,6 +20,80 @@ export interface DocumentTransitionParams {
20
20
  gasFeesPaidBy: GasFeesPaidByWASM;
21
21
  };
22
22
  }
23
+ export interface ShieldedTransitionBaseParams {
24
+ /** version of the platform (defaults to the latest supported version) */
25
+ platformVersion?: PlatformVersionWASM;
26
+ }
27
+ /** Spend inputs shared by `shieldedWithdrawal`, `unshield`, `shieldedTransfer` and `identityCreateFromShieldedPool`. */
28
+ export interface ShieldedSpendParams extends ShieldedTransitionBaseParams {
29
+ spends: SpendableNoteWASM[];
30
+ changeAddress: OrchardAddressWASM;
31
+ seed: Uint8Array;
32
+ coinType: number;
33
+ account: number;
34
+ anchor: Uint8Array;
35
+ /** optional UTF-8 memo string (defaults to an empty memo) */
36
+ memo?: string;
37
+ }
38
+ /** Transparent platform addresses -> pool (deposit). */
39
+ export interface ShieldParams extends ShieldedTransitionBaseParams {
40
+ recipient: OrchardAddressWASM;
41
+ shieldAmount: bigint;
42
+ inputs: InputAddressWASM[];
43
+ privateKeys: PrivateKeyWASM[];
44
+ feeStrategy: AddressFundsFeeStrategyStepWASM[];
45
+ userFeeIncrease: number;
46
+ /** optional UTF-8 memo string (defaults to an empty memo) */
47
+ memo?: string;
48
+ senderOvk?: Uint8Array;
49
+ }
50
+ /** Asset lock -> pool (deposit). */
51
+ export interface ShieldFromAssetLockParams extends ShieldedTransitionBaseParams {
52
+ recipient: OrchardAddressWASM;
53
+ shieldAmount: bigint;
54
+ assetLockProof: AssetLockProofWASM;
55
+ privateKey: PrivateKeyWASM;
56
+ /** optional UTF-8 memo string (defaults to an empty memo) */
57
+ memo?: string;
58
+ dummyOutputs: number;
59
+ senderOvk?: Uint8Array;
60
+ surplusOutput?: PlatformAddressLike;
61
+ }
62
+ /** Pool -> core L1 (spend). */
63
+ export interface ShieldedWithdrawalParams extends ShieldedSpendParams {
64
+ withdrawalAmount: bigint;
65
+ outputScript: CoreScriptWASM;
66
+ coreFeePerByte: number;
67
+ pooling: PoolingLike;
68
+ }
69
+ /** Pool -> platform identity balance (spend). */
70
+ export interface UnshieldParams extends ShieldedSpendParams {
71
+ outputAddress: PlatformAddressLike;
72
+ unshieldAmount: bigint;
73
+ }
74
+ /** Pool -> pool (spend). */
75
+ export interface ShieldedTransferParams extends ShieldedSpendParams {
76
+ recipient: OrchardAddressWASM;
77
+ transferAmount: bigint;
78
+ }
79
+ /** Pool -> new identity (spend). */
80
+ export interface IdentityCreateFromShieldedPoolParams extends ShieldedSpendParams {
81
+ publicKeys: IdentityPublicKeyInCreation[];
82
+ privateKeys: PrivateKeyWASM[];
83
+ denomination: bigint;
84
+ sendToAddressOnCreationFailure: PlatformAddressLike;
85
+ }
86
+ /** Maps each shielded transition type to the params it requires. */
87
+ export interface ShieldedTransitionParamsMap {
88
+ shield: ShieldParams;
89
+ shieldFromAssetLock: ShieldFromAssetLockParams;
90
+ shieldedWithdrawal: ShieldedWithdrawalParams;
91
+ unshield: UnshieldParams;
92
+ shieldedTransfer: ShieldedTransferParams;
93
+ identityCreateFromShieldedPool: IdentityCreateFromShieldedPoolParams;
94
+ }
95
+ export type ShieldedTransitionType = keyof ShieldedTransitionParamsMap;
96
+ export type ShieldedTransitionParams = ShieldedTransitionParamsMap[ShieldedTransitionType];
23
97
  export interface MasternodeInfo {
24
98
  proTxHash: string;
25
99
  address: string;
@@ -210,3 +284,13 @@ export interface PlatformAddressInfo {
210
284
  nonce: number;
211
285
  balance: bigint;
212
286
  }
287
+ export interface ShieldedEncryptedNote {
288
+ nullifier: Uint8Array;
289
+ cmx: Uint8Array;
290
+ encryptedNote: Uint8Array;
291
+ cvNet: Uint8Array;
292
+ }
293
+ export interface ShieldedNullifierStatus {
294
+ nullifier: Uint8Array;
295
+ isSpent: boolean;
296
+ }