dash-platform-sdk 1.5.0-dev.9 → 1.5.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 +17 -15
- package/bundle.min.js +1 -1
- package/package.json +4 -4
- package/src/documents/query.js +1 -1
- package/src/shielded/createStateTransition.js +5 -0
- package/src/shielded/index.d.ts +4 -3
- package/src/shielded/index.js +4 -3
- package/types.d.ts +6 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dash-platform-sdk",
|
|
3
|
-
"version": "1.5.0
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"description": "Lightweight SDK for accessing Dash Platform blockchain",
|
|
6
6
|
"repository": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@protobuf-ts/plugin": "^2.11.1",
|
|
28
28
|
"@rollup/plugin-alias": "^6.0.0",
|
|
29
29
|
"@rollup/plugin-commonjs": "^29.0.3",
|
|
30
|
-
"@rollup/plugin-node-resolve":
|
|
30
|
+
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
31
31
|
"@rollup/plugin-terser": "^0.4.4",
|
|
32
32
|
"@rollup/plugin-typescript": "^12.1.4",
|
|
33
33
|
"@types/jest": "^29.5.14",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@scure/bip32": "^2.0.0",
|
|
60
60
|
"@scure/bip39": "^2.0.0",
|
|
61
61
|
"@scure/btc-signer": "^2.0.1",
|
|
62
|
-
"
|
|
63
|
-
"pshenmic-dpp": "2.0.0-dev.
|
|
62
|
+
"cbor2": "^2.3.0",
|
|
63
|
+
"pshenmic-dpp": "2.0.0-dev.29"
|
|
64
64
|
}
|
|
65
65
|
}
|
package/src/documents/query.js
CHANGED
|
@@ -4,7 +4,7 @@ import { DAPI_DEFAULT_LIMIT, LATEST_PLATFORM_VERSION } from '../constants.js';
|
|
|
4
4
|
import { getQuorumPublicKey } from '../utils/getQuorumPublicKey.js';
|
|
5
5
|
import bytesToHex from '../utils/bytesToHex.js';
|
|
6
6
|
import verifyTenderdashProof from '../utils/verifyTenderdashProof.js';
|
|
7
|
-
import { encode } from '
|
|
7
|
+
import { encode } from 'cbor2';
|
|
8
8
|
import getDataContractByIdentifier from '../dataContracts/getDataContractByIdentifier.js';
|
|
9
9
|
export default async function query(grpcPool, dataContractId, documentTypeName, where, orderBy, limit = 100, startAt, startAfter) {
|
|
10
10
|
let start;
|
|
@@ -26,6 +26,11 @@ const shieldedTransitionsMap = {
|
|
|
26
26
|
arguments: ['spends', 'recipient', 'transferAmount', 'changeAddress', 'seed', 'coinType', 'account', 'anchor', 'memo'],
|
|
27
27
|
optionalArguments: []
|
|
28
28
|
},
|
|
29
|
+
shieldedTransferMulti: {
|
|
30
|
+
method: ShieldedBuilderWASM.prototype.shieldedTransferMulti,
|
|
31
|
+
arguments: ['spends', 'outputs', 'changeAddress', 'seed', 'coinType', 'account', 'anchor'],
|
|
32
|
+
optionalArguments: []
|
|
33
|
+
},
|
|
29
34
|
identityCreateFromShieldedPool: {
|
|
30
35
|
method: ShieldedBuilderWASM.prototype.identityCreateFromShieldedPool,
|
|
31
36
|
arguments: ['publicKeys', 'privateKeys', 'denomination', 'sendToAddressOnCreationFailure', 'spends', 'changeAddress', 'seed', 'coinType', 'account', 'anchor', 'memo'],
|
package/src/shielded/index.d.ts
CHANGED
|
@@ -110,18 +110,19 @@ export declare class ShieldedController {
|
|
|
110
110
|
};
|
|
111
111
|
/**
|
|
112
112
|
* Helper function for building and proving shielded (Orchard) transitions.
|
|
113
|
-
* It may be used to create any of
|
|
113
|
+
* It may be used to create any of 7 shielded transition actions:
|
|
114
114
|
*
|
|
115
115
|
* 1) shield - transparent platform addresses -> pool (deposit)
|
|
116
116
|
* 2) shieldFromAssetLock - asset lock -> pool (deposit)
|
|
117
117
|
* 3) shieldedWithdrawal - pool -> core L1 (spend)
|
|
118
118
|
* 4) unshield - pool -> platform identity balance (spend)
|
|
119
119
|
* 5) shieldedTransfer - pool -> pool (spend)
|
|
120
|
-
* 6)
|
|
120
|
+
* 6) shieldedTransferMulti - pool -> pool, several recipients, each with its own memo (spend)
|
|
121
|
+
* 7) identityCreateFromShieldedPool - pool -> new identity (spend)
|
|
121
122
|
*
|
|
122
123
|
* Spends require a {SpendableNoteWASM} witnessed against an on-chain anchor.
|
|
123
124
|
*
|
|
124
|
-
* @param type {string} Type of the shielded transition, must be one of ('shield' | 'shieldFromAssetLock' | 'shieldedWithdrawal' | 'unshield' | 'shieldedTransfer' | 'identityCreateFromShieldedPool')
|
|
125
|
+
* @param type {string} Type of the shielded transition, must be one of ('shield' | 'shieldFromAssetLock' | 'shieldedWithdrawal' | 'unshield' | 'shieldedTransfer' | 'shieldedTransferMulti' | 'identityCreateFromShieldedPool')
|
|
125
126
|
* @param params {ShieldedTransitionParams} params
|
|
126
127
|
*
|
|
127
128
|
* @return {StateTransitionWASM}
|
package/src/shielded/index.js
CHANGED
|
@@ -157,18 +157,19 @@ export class ShieldedController {
|
|
|
157
157
|
}
|
|
158
158
|
/**
|
|
159
159
|
* Helper function for building and proving shielded (Orchard) transitions.
|
|
160
|
-
* It may be used to create any of
|
|
160
|
+
* It may be used to create any of 7 shielded transition actions:
|
|
161
161
|
*
|
|
162
162
|
* 1) shield - transparent platform addresses -> pool (deposit)
|
|
163
163
|
* 2) shieldFromAssetLock - asset lock -> pool (deposit)
|
|
164
164
|
* 3) shieldedWithdrawal - pool -> core L1 (spend)
|
|
165
165
|
* 4) unshield - pool -> platform identity balance (spend)
|
|
166
166
|
* 5) shieldedTransfer - pool -> pool (spend)
|
|
167
|
-
* 6)
|
|
167
|
+
* 6) shieldedTransferMulti - pool -> pool, several recipients, each with its own memo (spend)
|
|
168
|
+
* 7) identityCreateFromShieldedPool - pool -> new identity (spend)
|
|
168
169
|
*
|
|
169
170
|
* Spends require a {SpendableNoteWASM} witnessed against an on-chain anchor.
|
|
170
171
|
*
|
|
171
|
-
* @param type {string} Type of the shielded transition, must be one of ('shield' | 'shieldFromAssetLock' | 'shieldedWithdrawal' | 'unshield' | 'shieldedTransfer' | 'identityCreateFromShieldedPool')
|
|
172
|
+
* @param type {string} Type of the shielded transition, must be one of ('shield' | 'shieldFromAssetLock' | 'shieldedWithdrawal' | 'unshield' | 'shieldedTransfer' | 'shieldedTransferMulti' | 'identityCreateFromShieldedPool')
|
|
172
173
|
* @param params {ShieldedTransitionParams} params
|
|
173
174
|
*
|
|
174
175
|
* @return {StateTransitionWASM}
|
package/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AddressFundsFeeStrategyStepWASM, AssetLockProofWASM, CoreScriptWASM, DocumentWASM, GasFeesPaidByWASM, IdentifierLike, IdentifierWASM, InputAddressWASM, KeyType, OrchardAddressWASM, PlatformAddressLike, PlatformAddressWASM, PlatformVersionWASM, PoolingLike, PrivateKeyWASM, Purpose, SecurityLevel, SpendableNoteWASM, TokenEmergencyActionWASM, TokenPricingScheduleWASM, AddressWitnessWASM, IdentityPublicKeyInCreationWASM, OutputAddressWASM, OutputAddressNullableCreditsWASM, VerifiedAddressesTrunkState } from 'pshenmic-dpp';
|
|
1
|
+
import { AddressFundsFeeStrategyStepWASM, AssetLockProofWASM, CoreScriptWASM, DocumentWASM, GasFeesPaidByWASM, IdentifierLike, IdentifierWASM, InputAddressWASM, KeyType, OrchardAddressWASM, PlatformAddressLike, PlatformAddressWASM, PlatformVersionWASM, PoolingLike, PrivateKeyWASM, Purpose, SecurityLevel, ShieldedOutputWASM, SpendableNoteWASM, TokenEmergencyActionWASM, TokenPricingScheduleWASM, AddressWitnessWASM, IdentityPublicKeyInCreationWASM, OutputAddressWASM, OutputAddressNullableCreditsWASM, VerifiedAddressesTrunkState } from 'pshenmic-dpp';
|
|
2
2
|
import { ResponseMetadata } from './proto/generated/platform.js';
|
|
3
3
|
export { CoreScriptWASM, DocumentWASM, GasFeesPaidByWASM, IdentifierWASM, KeyType, Purpose, SecurityLevel, TokenEmergencyActionWASM, TokenPricingScheduleWASM, StateTransitionWASM, BatchTransitionWASM, IdentityPublicKeyWASM, PrivateKeyWASM, DataContractUpdateTransitionWASM, IdentityWASM, IdentityUpdateTransitionWASM, IdentityCreditTransferWASM, MasternodeVoteTransitionWASM, IdentifierLike, PlatformAddressLike, InputAddressWASM, OutputAddressWASM, OutputAddressNullableCreditsWASM, AddressFundsFeeStrategyStepWASM, AddressWitnessWASM, IdentityPublicKeyInCreationWASM, AssetLockProofWASM, IdentityCreditTransferToAddressesTransitionWASM, IdentityCreateFromAddressesTransitionWASM, IdentityTopUpFromAddressesTransitionWASM, AddressFundsTransferTransitionWASM, AddressFundingFromAssetLockTransitionWASM, AddressCreditWithdrawalTransitionWASM } from 'pshenmic-dpp';
|
|
4
4
|
export type Network = 'mainnet' | 'testnet';
|
|
@@ -77,6 +77,10 @@ export interface ShieldedTransferParams extends ShieldedSpendParams {
|
|
|
77
77
|
recipient: OrchardAddressWASM;
|
|
78
78
|
transferAmount: bigint;
|
|
79
79
|
}
|
|
80
|
+
/** Pool -> pool, several recipients (spend). Each output carries its own memo. */
|
|
81
|
+
export interface ShieldedTransferMultiParams extends Omit<ShieldedSpendParams, 'memo'> {
|
|
82
|
+
outputs: ShieldedOutputWASM[];
|
|
83
|
+
}
|
|
80
84
|
/** Pool -> new identity (spend). */
|
|
81
85
|
export interface IdentityCreateFromShieldedPoolParams extends ShieldedSpendParams {
|
|
82
86
|
publicKeys: IdentityPublicKeyInCreation[];
|
|
@@ -91,6 +95,7 @@ export interface ShieldedTransitionParamsMap {
|
|
|
91
95
|
shieldedWithdrawal: ShieldedWithdrawalParams;
|
|
92
96
|
unshield: UnshieldParams;
|
|
93
97
|
shieldedTransfer: ShieldedTransferParams;
|
|
98
|
+
shieldedTransferMulti: ShieldedTransferMultiParams;
|
|
94
99
|
identityCreateFromShieldedPool: IdentityCreateFromShieldedPoolParams;
|
|
95
100
|
}
|
|
96
101
|
export type ShieldedTransitionType = keyof ShieldedTransitionParamsMap;
|