pshenmic-dpp 2.0.0-dev.10 → 2.0.0-dev.11

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.
@@ -0,0 +1,3 @@
1
+ export * from './dpp/enums.js';
2
+ export * from './dpp/dpp.js';
3
+ export * from './dpp/types.js';
@@ -0,0 +1,6 @@
1
+ import * as protocol from '../binaries/native.js';
2
+ import { dppProvider } from './dpp/provider.js';
3
+ dppProvider.setDpp(protocol);
4
+ export * from './dpp/enums.js';
5
+ export * from './dpp/dpp.js';
6
+ export * from './dpp/types.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pshenmic-dpp",
3
- "version": "2.0.0-dev.10",
3
+ "version": "2.0.0-dev.11",
4
4
  "main": "dist/src/wasm.js",
5
5
  "types": "dist/src/wasm.d.ts",
6
6
  "react-native": "./dist/src/react-native.js",
@@ -11,46 +11,35 @@
11
11
  },
12
12
  "scripts": {
13
13
  "build:bin": "node build.cjs",
14
- "build:ts": "tsc && cp -R pkg/**/*.*.node dist/binaries/",
14
+ "build:ts": "tsc && cp -R pkg/**/*.*.node dist/binaries/ && cp -R pkg/binaries/native dist/binaries/",
15
15
  "build:full": "npm run build:bin && npm run build:ts",
16
16
  "ferric:build": "ferric build",
17
17
  "bundle": "rollup -c",
18
- "test": "jest",
18
+ "test": "NODE_OPTIONS=--experimental-vm-modules jest",
19
19
  "docs": "typedoc",
20
20
  "lint:rust": "cargo fmt",
21
21
  "lint:src": "ts-standard --fix ./pkg/src",
22
22
  "lint:tests": "ts-standard --fix ./pkg/src",
23
- "lint": "npm run lint:rust && npm run lint:src && npm run lint:tests"
23
+ "lint": "npm run lint:rust && npm run lint:src && npm run lint:tests",
24
+ "prepack": "npm pkg delete devDependencies"
24
25
  },
25
26
  "files": [
26
27
  "dist/",
27
28
  "tests/"
28
29
  ],
30
+ "exports": {
31
+ ".": {
32
+ "default": "./dist/src/wasm.js",
33
+ "react-native": "./dist/src/react-native.js",
34
+ "node": "./dist/src/native.js"
35
+ },
36
+ "./wasm": "./dist/src/wasm.js",
37
+ "./wasm/utils": "./dist/src/dpp/utils.js",
38
+ "./native": "./dist/src/native.js"
39
+ },
29
40
  "author": "owl352",
30
41
  "license": "ISC",
31
42
  "description": "",
32
- "devDependencies": {
33
- "@babel/core": "^7.28.5",
34
- "@babel/preset-env": "^7.28.5",
35
- "@babel/preset-typescript": "^7.28.5",
36
- "@scure/base": "^1.2.4",
37
- "@types/jest": "^30.0.0",
38
- "@types/node": "^24.0.13",
39
- "babel": "^6.23.0",
40
- "babel-jest": "^30.2.0",
41
- "core-js": "^3.41.0",
42
- "ferric-cli": "0.3.9",
43
- "jest": "^30.2.0",
44
- "mocha": "^11.1.0",
45
- "node-addon-api": "^8.5.0",
46
- "path": "^0.12.7",
47
- "toml": "^3.0.0",
48
- "ts-morph": "^26.0.0",
49
- "tsx": "^4.20.6",
50
- "typedoc": "^0.28.7",
51
- "typescript": "^5.8.3",
52
- "ts-standard": "^12.0.2"
53
- },
54
43
  "dependencies": {
55
44
  "@emnapi/core": "1.9.0",
56
45
  "@emnapi/runtime": "1.9.0",
@@ -1,5 +1,5 @@
1
- import * as dpp from "../../pkg/src/wasm.js";
2
- import {valueFromDynamicValue, valueToDynamicValue} from "../../pkg/src/dpp/utils.js"
1
+ import * as dpp from "pshenmic-dpp";
2
+ import {valueFromDynamicValue, valueToDynamicValue} from "pshenmic-dpp/wasm/utils"
3
3
 
4
4
  describe('DynamicValue', () => {
5
5
  beforeAll(()=>{
@@ -1,4 +1,4 @@
1
- import { IdentifierWASM } from "../../dist/src/wasm.js";
1
+ import { IdentifierWASM } from "pshenmic-dpp";
2
2
 
3
3
  let identifierBytes: Uint8Array;
4
4
 
@@ -1,4 +1,4 @@
1
- import {IdentifierWASM, IdentityWASM, PlatformVersionWASM, IdentityPublicKeyWASM} from '../../dist/src/wasm.js'
1
+ import {IdentifierWASM, IdentityWASM, PlatformVersionWASM, IdentityPublicKeyWASM} from 'pshenmic-dpp'
2
2
 
3
3
  let identifierBytes: Uint8Array
4
4
  let identifier: IdentifierWASM
@@ -1,4 +1,4 @@
1
- import {IdentityPublicKeyWASM, Purpose, SecurityLevel, KeyType} from '../../dist/src/wasm.js'
1
+ import {IdentityPublicKeyWASM, Purpose, SecurityLevel, KeyType} from 'pshenmic-dpp'
2
2
 
3
3
  let keyId: number
4
4
  let purpose: Purpose
@@ -0,0 +1,49 @@
1
+ import * as dpp from "pshenmic-dpp/native";
2
+ import {IdentifierWASM} from "pshenmic-dpp/native";
3
+
4
+ let identifierBytes: Uint8Array;
5
+
6
+ describe("dpp", function () {
7
+ beforeAll(async function () {
8
+ identifierBytes = Uint8Array.from([
9
+ 9, 40, 40, 237, 192, 129, 211, 186, 26, 84, 240, 67, 37, 155, 148, 19,
10
+ 104, 242, 199, 24, 136, 27, 6, 169, 211, 71, 136, 59, 33, 191, 227, 19,
11
+ ]);
12
+ });
13
+
14
+ it('dpp object shouldn\'t be undefined or empty', () => {
15
+ expect(dpp).toBeDefined();
16
+ });
17
+
18
+ describe('classes accesibles', function () {
19
+ test("should allows to create Identifier from base58 via dpp object", function () {
20
+ const identifier = dpp.IdentifierWASM.fromBase58(
21
+ "ckBqfQe7LU7vwrwXopyCB4n5phZShjA16BGhNGpsD5U",
22
+ );
23
+
24
+ expect(identifier.bytes()).toEqual(identifierBytes);
25
+ });
26
+
27
+ test("should allows to create Identifier from base64 via IdentifierWASM import", function () {
28
+ const identifier = IdentifierWASM.fromBase64(
29
+ "CSgo7cCB07oaVPBDJZuUE2jyxxiIGwap00eIOyG/4xM=",
30
+ );
31
+
32
+ expect(identifier.bytes()).toEqual(identifierBytes);
33
+ });
34
+
35
+ test("should allows to create Identifier from hex", function () {
36
+ const identifier = IdentifierWASM.fromHex(
37
+ "092828edc081d3ba1a54f043259b941368f2c718881b06a9d347883b21bfe313",
38
+ );
39
+
40
+ expect(identifier.bytes()).toEqual(identifierBytes);
41
+ });
42
+
43
+ test("should allows to create Identifier from bytes", function () {
44
+ const identifier = IdentifierWASM.fromBytes(identifierBytes);
45
+
46
+ expect(identifier.bytes()).toEqual(identifierBytes);
47
+ });
48
+ })
49
+ });