pshenmic-dpp 2.0.0-dev.26 → 2.0.0-dev.27
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 +37 -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 +42 -21
- package/dist/binaries/node.d.cts +2 -2
- 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/wasm/wasmBytes.cjs +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/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 -1
- package/dist/src/dpp/structs/MasternodeVote/MasternodeVoteTransition.js +3 -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/StateTransition.d.ts +2 -1
- package/dist/src/dpp/structs/StateTransition.js +3 -0
- package/package.json +1 -1
- package/tests/unit/AddressTransitionsFees.spec.ts +274 -0
- package/tests/unit/Shielded.spec.ts +37 -4
- package/tests/unit/StateTransitionFees.spec.ts +177 -0
|
@@ -31,6 +31,8 @@ export declare class AddressCreditWithdrawalTransitionNAPI {
|
|
|
31
31
|
set feeStrategy(jsFeeStrategy: Array<AddressFundsFeeStrategyStepNAPI>);
|
|
32
32
|
set userFeeIncrease(userFeeIncrease: number);
|
|
33
33
|
set inputWitness(jsInputWitnesses: Array<AddressWitnessNAPI>);
|
|
34
|
+
static estimateMinFee(jsInputCount: number, jsHasChangeOutput: boolean, jsPlatformVersion?: PlatformVersionNAPI | undefined | null): BigIntString;
|
|
35
|
+
calculateMinRequiredFee(jsPlatformVersion?: PlatformVersionNAPI | undefined | null): BigIntString;
|
|
34
36
|
bytes(): Uint8Array;
|
|
35
37
|
hex(): string;
|
|
36
38
|
base64(): string;
|
|
@@ -56,6 +58,7 @@ export declare class AddressFundingFromAssetLockTransitionNAPI {
|
|
|
56
58
|
set feeStrategy(jsFeeStrategy: Array<AddressFundsFeeStrategyStepNAPI>);
|
|
57
59
|
set userFeeIncrease(userFeeIncrease: number);
|
|
58
60
|
set inputWitness(jsInputWitnesses: Array<AddressWitnessNAPI>);
|
|
61
|
+
calculateMinRequiredFee(jsPlatformVersion?: PlatformVersionNAPI | undefined | null): BigIntString;
|
|
59
62
|
bytes(): Uint8Array;
|
|
60
63
|
hex(): string;
|
|
61
64
|
base64(): string;
|
|
@@ -84,6 +87,8 @@ export declare class AddressFundsTransferTransitionNAPI {
|
|
|
84
87
|
set feeStrategy(jsFeeStrategy: Array<AddressFundsFeeStrategyStepNAPI>);
|
|
85
88
|
set userFeeIncrease(userFeeIncrease: number);
|
|
86
89
|
set inputWitness(jsInputWitnesses: Array<AddressWitnessNAPI>);
|
|
90
|
+
static estimateMinFee(jsInputCount: number, jsOutputCount: number, jsPlatformVersion?: PlatformVersionNAPI | undefined | null): BigIntString;
|
|
91
|
+
calculateMinRequiredFee(jsPlatformVersion?: PlatformVersionNAPI | undefined | null): BigIntString;
|
|
87
92
|
bytes(): Uint8Array;
|
|
88
93
|
hex(): string;
|
|
89
94
|
base64(): string;
|
|
@@ -148,6 +153,7 @@ export declare class BatchTransitionNAPI {
|
|
|
148
153
|
setIdentityContractNonce(nonce: BigIntString): void;
|
|
149
154
|
toStateTransition(): StateTransitionNAPI;
|
|
150
155
|
static fromStateTransition(stateTransition: StateTransitionNAPI): BatchTransitionNAPI;
|
|
156
|
+
calculateMinRequiredFee(jsPlatformVersion?: PlatformVersionNAPI | undefined | null): BigIntString;
|
|
151
157
|
bytes(): Uint8Array;
|
|
152
158
|
hex(): string;
|
|
153
159
|
base64(): string;
|
|
@@ -285,6 +291,7 @@ export declare class DataContractCreateTransitionNAPI {
|
|
|
285
291
|
static fromBytes(bytes: Uint8Array): DataContractCreateTransitionNAPI;
|
|
286
292
|
static fromHex(hex: string): DataContractCreateTransitionNAPI;
|
|
287
293
|
static fromBase64(base64: string): DataContractCreateTransitionNAPI;
|
|
294
|
+
calculateMinRequiredFee(jsPlatformVersion?: PlatformVersionNAPI | undefined | null): BigIntString;
|
|
288
295
|
bytes(): Uint8Array;
|
|
289
296
|
hex(): string;
|
|
290
297
|
base64(): string;
|
|
@@ -334,6 +341,7 @@ export declare class DataContractUpdateTransitionNAPI {
|
|
|
334
341
|
static fromBytes(bytes: Uint8Array): DataContractUpdateTransitionNAPI;
|
|
335
342
|
static fromHex(hex: string): DataContractUpdateTransitionNAPI;
|
|
336
343
|
static fromBase64(base64: string): DataContractUpdateTransitionNAPI;
|
|
344
|
+
calculateMinRequiredFee(jsPlatformVersion?: PlatformVersionNAPI | undefined | null): BigIntString;
|
|
337
345
|
bytes(): Uint8Array;
|
|
338
346
|
hex(): string;
|
|
339
347
|
base64(): string;
|
|
@@ -576,6 +584,7 @@ export declare class IdentityCreateFromAddressesTransitionNAPI {
|
|
|
576
584
|
set feeStrategy(jsFeeStrategy: Array<AddressFundsFeeStrategyStepNAPI>);
|
|
577
585
|
set userFeeIncrease(userFeeIncrease: number);
|
|
578
586
|
set inputWitness(jsInputWitnesses: Array<AddressWitnessNAPI>);
|
|
587
|
+
calculateMinRequiredFee(jsPlatformVersion?: PlatformVersionNAPI | undefined | null): BigIntString;
|
|
579
588
|
bytes(): Uint8Array;
|
|
580
589
|
hex(): string;
|
|
581
590
|
base64(): string;
|
|
@@ -626,6 +635,7 @@ export declare class IdentityCreateTransitionNAPI {
|
|
|
626
635
|
static default(jsPlatformVersion: DynamicValue): IdentityCreateTransitionNAPI;
|
|
627
636
|
static fromHex(hex: string): IdentityCreateTransitionNAPI;
|
|
628
637
|
static fromBase64(base64: string): IdentityCreateTransitionNAPI;
|
|
638
|
+
calculateMinRequiredFee(jsPlatformVersion?: PlatformVersionNAPI | undefined | null): BigIntString;
|
|
629
639
|
bytes(): Uint8Array;
|
|
630
640
|
static fromBytes(bytes: Uint8Array): IdentityCreateTransitionNAPI;
|
|
631
641
|
get publicKeys(): Array<IdentityPublicKeyInCreationNAPI>;
|
|
@@ -643,6 +653,7 @@ export declare class IdentityCreateTransitionNAPI {
|
|
|
643
653
|
}
|
|
644
654
|
export declare class IdentityCreditTransferNAPI {
|
|
645
655
|
constructor(jsSender: IdentifierLikeNAPI, amount: BigIntString, jsRecipient: IdentifierLikeNAPI, nonce: BigIntString, userFeeIncrease?: number | undefined | null);
|
|
656
|
+
calculateMinRequiredFee(jsPlatformVersion?: PlatformVersionNAPI | undefined | null): BigIntString;
|
|
646
657
|
bytes(): Uint8Array;
|
|
647
658
|
hex(): string;
|
|
648
659
|
base64(): string;
|
|
@@ -681,6 +692,7 @@ export declare class IdentityCreditTransferToAddressesTransitionNAPI {
|
|
|
681
692
|
set userFeeIncrease(userFeeIncrease: number);
|
|
682
693
|
set signaturePublicKeyId(keyId: number);
|
|
683
694
|
set signature(signature: Uint8Array);
|
|
695
|
+
calculateMinRequiredFee(jsPlatformVersion?: PlatformVersionNAPI | undefined | null): BigIntString;
|
|
684
696
|
bytes(): Uint8Array;
|
|
685
697
|
hex(): string;
|
|
686
698
|
base64(): string;
|
|
@@ -716,6 +728,7 @@ export declare class IdentityCreditWithdrawalTransitionNAPI {
|
|
|
716
728
|
set signaturePublicKeyId(signaturePublicKeyId: number);
|
|
717
729
|
static fromHex(hex: string): IdentityCreditWithdrawalTransitionNAPI;
|
|
718
730
|
static fromBase64(base64: string): IdentityCreditWithdrawalTransitionNAPI;
|
|
731
|
+
calculateMinRequiredFee(jsPlatformVersion?: PlatformVersionNAPI | undefined | null): BigIntString;
|
|
719
732
|
bytes(): Uint8Array;
|
|
720
733
|
hex(): string;
|
|
721
734
|
base64(): string;
|
|
@@ -823,6 +836,7 @@ export declare class IdentityTopUpFromAddressesTransitionNAPI {
|
|
|
823
836
|
set feeStrategy(jsFeeStrategy: Array<AddressFundsFeeStrategyStepNAPI>);
|
|
824
837
|
set userFeeIncrease(userFeeIncrease: number);
|
|
825
838
|
set inputWitness(jsInputWitnesses: Array<AddressWitnessNAPI>);
|
|
839
|
+
calculateMinRequiredFee(jsPlatformVersion?: PlatformVersionNAPI | undefined | null): BigIntString;
|
|
826
840
|
bytes(): Uint8Array;
|
|
827
841
|
hex(): string;
|
|
828
842
|
base64(): string;
|
|
@@ -845,6 +859,7 @@ export declare class IdentityTopUpTransitionNAPI {
|
|
|
845
859
|
get signature(): Uint8Array;
|
|
846
860
|
getSignableBytes(): Uint8Array;
|
|
847
861
|
set signature(signature: Uint8Array);
|
|
862
|
+
calculateMinRequiredFee(jsPlatformVersion?: PlatformVersionNAPI | undefined | null): BigIntString;
|
|
848
863
|
bytes(): Uint8Array;
|
|
849
864
|
hex(): string;
|
|
850
865
|
base64(): string;
|
|
@@ -878,6 +893,7 @@ export declare class IdentityUpdateTransitionNAPI {
|
|
|
878
893
|
set signaturePublicKeyId(signaturePublicKeyId: number);
|
|
879
894
|
static fromHex(hex: string): IdentityUpdateTransitionNAPI;
|
|
880
895
|
static fromBase64(base64: string): IdentityUpdateTransitionNAPI;
|
|
896
|
+
calculateMinRequiredFee(jsPlatformVersion?: PlatformVersionNAPI | undefined | null): BigIntString;
|
|
881
897
|
bytes(): Uint8Array;
|
|
882
898
|
hex(): string;
|
|
883
899
|
base64(): string;
|
|
@@ -936,6 +952,7 @@ export declare class MasternodeVoteTransitionNAPI {
|
|
|
936
952
|
set signature(signature: Uint8Array);
|
|
937
953
|
static fromHex(hex: string): MasternodeVoteTransitionNAPI;
|
|
938
954
|
static fromBase64(base64: string): MasternodeVoteTransitionNAPI;
|
|
955
|
+
calculateMinRequiredFee(jsPlatformVersion?: PlatformVersionNAPI | undefined | null): BigIntString;
|
|
939
956
|
bytes(): Uint8Array;
|
|
940
957
|
hex(): string;
|
|
941
958
|
base64(): string;
|
|
@@ -1039,6 +1056,17 @@ export declare class PlatformAddressInfoNAPI {
|
|
|
1039
1056
|
export declare class PlatformAddressNAPI {
|
|
1040
1057
|
constructor(address: PlatformAddressLikeNAPI);
|
|
1041
1058
|
bytes(): Uint8Array;
|
|
1059
|
+
/**
|
|
1060
|
+
* Storage fee GroveDB charges for creating balance entries for addresses that are not in
|
|
1061
|
+
* state yet.
|
|
1062
|
+
*
|
|
1063
|
+
* Minimum fees price a transition as if every one of its outputs pays a fresh address, but
|
|
1064
|
+
* the fee actually charged is metered: paying an address that already exists writes no new
|
|
1065
|
+
* bytes and costs (close to) nothing in storage, while every address created costs
|
|
1066
|
+
* `PLATFORM_ADDRESS_STORAGE_BYTES` at the disk rate. Add this to a processing estimate when
|
|
1067
|
+
* you know how many of your outputs are new.
|
|
1068
|
+
*/
|
|
1069
|
+
static estimateStorageFeeForNewAddresses(jsAddressCount: number, jsPlatformVersion?: PlatformVersionNAPI | undefined | null): BigIntString;
|
|
1042
1070
|
toAddress(jsNetwork: DynamicValue): string;
|
|
1043
1071
|
toBech32m(jsNetwork: DynamicValue): string;
|
|
1044
1072
|
isP2PKH(): boolean;
|
|
@@ -1359,6 +1387,15 @@ export declare class StateTransitionNAPI {
|
|
|
1359
1387
|
static fromBase64(base64: string): StateTransitionNAPI;
|
|
1360
1388
|
hash(skipSignature: boolean): string;
|
|
1361
1389
|
getActionName(): string;
|
|
1390
|
+
/**
|
|
1391
|
+
* The minimum fee the network requires for this transition to be accepted.
|
|
1392
|
+
*
|
|
1393
|
+
* This is the same value the node checks the payer balance against before execution.
|
|
1394
|
+
* The fee actually charged is metered during execution and depends on state (for
|
|
1395
|
+
* example, paying an address that does not exist yet adds storage cost), so it can
|
|
1396
|
+
* be higher than this minimum.
|
|
1397
|
+
*/
|
|
1398
|
+
calculateMinRequiredFee(jsPlatformVersion?: PlatformVersionNAPI | undefined | null): BigIntString;
|
|
1362
1399
|
getActionType(): string;
|
|
1363
1400
|
getActionTypeNumber(): number;
|
|
1364
1401
|
getOwnerId(): IdentifierNAPI | null;
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/binaries/node.cjs
CHANGED
|
@@ -3,10 +3,17 @@ const path = require('node:path');
|
|
|
3
3
|
function isMusl() {
|
|
4
4
|
if (process.platform !== 'linux')
|
|
5
5
|
return false;
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
try {
|
|
7
|
+
const report = process.report?.getReport?.();
|
|
8
|
+
return !report?.header?.glibcVersionRuntime;
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
// getReport() is unavailable in some embedders/worker contexts; assume
|
|
12
|
+
// glibc, and let the require below fall back to WebAssembly if wrong.
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
8
15
|
}
|
|
9
|
-
function
|
|
16
|
+
function getTarget() {
|
|
10
17
|
const platform = process.platform;
|
|
11
18
|
const arch = process.arch;
|
|
12
19
|
let target = '';
|
|
@@ -24,27 +31,41 @@ function getBinaryPath() {
|
|
|
24
31
|
target = `x86_64-unknown-linux-${libc}`;
|
|
25
32
|
}
|
|
26
33
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
else if (platform === 'win32') {
|
|
35
|
+
if (arch === 'arm64') {
|
|
36
|
+
target = 'aarch64-pc-windows-msvc';
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
target = 'x86_64-pc-windows-msvc';
|
|
40
|
+
}
|
|
41
|
+
}
|
|
35
42
|
else {
|
|
36
43
|
console.error(`Unsupported platform: ${platform} ${arch}. Using WebAssembly instead Node-API`);
|
|
37
44
|
return null;
|
|
38
45
|
}
|
|
39
|
-
|
|
40
|
-
return path.join('native', target, 'pshenmic_dpp.node');
|
|
41
|
-
}
|
|
42
|
-
const binaryPath = getBinaryPath();
|
|
43
|
-
let exportedModule;
|
|
44
|
-
if (binaryPath !== null) {
|
|
45
|
-
exportedModule = require(`./${binaryPath}`);
|
|
46
|
+
return target;
|
|
46
47
|
}
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
// The native addon can be unusable even on a supported platform: the binary may
|
|
49
|
+
// be missing from the package, built for another libc/arch, or fail to link
|
|
50
|
+
// against a system dependency (e.g. the VC++ runtime on Windows). None of that
|
|
51
|
+
// should be fatal — WebAssembly is a complete fallback, so any load failure
|
|
52
|
+
// degrades to it instead of taking the whole import down.
|
|
53
|
+
function loadNative() {
|
|
54
|
+
const target = getTarget();
|
|
55
|
+
if (target === null) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
const nativeModule = require(`./${path.join('native', target, 'pshenmic_dpp.node')}`);
|
|
60
|
+
console.log(`running on native dpp (${target})`);
|
|
61
|
+
return nativeModule;
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
// Only the first line: node appends a multi-line "Require stack" to
|
|
65
|
+
// MODULE_NOT_FOUND messages, which buries the actual reason.
|
|
66
|
+
const reason = String(error?.message ?? error).split('\n')[0];
|
|
67
|
+
console.error(`Failed to load native dpp (${target}): ${reason}. Using WebAssembly instead Node-API`);
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
49
70
|
}
|
|
50
|
-
module.exports =
|
|
71
|
+
module.exports = loadNative() ?? require('./wasmCreation.cjs');
|
package/dist/binaries/node.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
declare const _exports: any;
|
|
2
|
+
export = _exports;
|
|
Binary file
|