pshenmic-dpp 1.0.4 → 1.0.6
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/.github/workflows/build.yml +9 -1
- package/.github/workflows/publish.yml +9 -1
- package/Cargo.lock +222 -76
- package/Cargo.toml +28 -19
- package/README.md +75 -23
- package/babel.config.json +19 -0
- package/dist/wasm/index.d.ts +52 -0
- package/dist/wasm/pshenmic_dpp.d.ts +962 -0
- package/dist/wasm/pshenmic_dpp.js +5565 -966
- package/dist/wasm/pshenmic_dpp_bg.js +1 -1
- package/dist/wasm/pshenmic_dpp_bg.wasm.d.ts +440 -0
- package/docs/AssetLockProof.md +107 -0
- package/docs/Building.md +50 -0
- package/docs/ChainLockProof.md +63 -0
- package/docs/CoreScript.md +17 -0
- package/docs/DataContract.md +192 -0
- package/docs/DataContractCreateTransition.md +84 -0
- package/docs/DataContractUpdateTransition.md +84 -0
- package/docs/Document.md +396 -0
- package/docs/DocumentBaseTransition.md +111 -0
- package/docs/DocumentCreateTransition.md +132 -0
- package/docs/DocumentDeleteTransition.md +82 -0
- package/docs/DocumentPurchaseTransition.md +109 -0
- package/docs/DocumentReplaceTransition.md +112 -0
- package/docs/DocumentTransferTransition.md +96 -0
- package/docs/DocumentTransition.md +125 -0
- package/docs/DocumentUpdatePriceTransition.md +109 -0
- package/docs/DocumentsBatch.md +133 -0
- package/docs/Enums.md +103 -0
- package/docs/Home.md +28 -0
- package/docs/Identifier.md +37 -0
- package/docs/Identity.md +140 -0
- package/docs/IdentityCreateTransition.md +155 -0
- package/docs/IdentityCreditTransfer.md +187 -0
- package/docs/IdentityCreditWithdrawalTransition.md +244 -0
- package/docs/IdentityPublicKey.md +348 -0
- package/docs/IdentityPublicKeyInCreation.md +141 -0
- package/docs/IdentityTopUpTransition.md +166 -0
- package/docs/IdentityUpdateTransition.md +234 -0
- package/docs/InstantAssetLockProof.md +117 -0
- package/docs/InstantLock.md +100 -0
- package/docs/OutPoint.md +80 -0
- package/docs/PrefundedVotingBalance.md +48 -0
- package/docs/PrivateKey.md +112 -0
- package/docs/TxOut.md +93 -0
- package/package.json +15 -8
- package/packages/asset_lock_proof/Cargo.toml +19 -0
- package/packages/asset_lock_proof/src/chain/mod.rs +79 -0
- package/packages/asset_lock_proof/src/instant/instant_lock.rs +111 -0
- package/packages/asset_lock_proof/src/instant/mod.rs +115 -0
- package/packages/asset_lock_proof/src/lib.rs +133 -0
- package/packages/asset_lock_proof/src/outpoint/mod.rs +79 -0
- package/packages/asset_lock_proof/src/tx_out/mod.rs +80 -0
- package/packages/cbor_conversation/Cargo.toml +2 -2
- package/packages/core_script/Cargo.toml +13 -0
- package/packages/core_script/src/lib.rs +69 -0
- package/packages/data_contract/Cargo.toml +4 -3
- package/packages/data_contract/src/lib.rs +209 -33
- package/packages/data_contract_transitions/Cargo.toml +2 -2
- package/packages/data_contract_transitions/src/create/mod.rs +23 -16
- package/packages/data_contract_transitions/src/update/mod.rs +21 -12
- package/packages/document/Cargo.toml +3 -2
- package/packages/document/src/lib.rs +14 -13
- package/packages/document/src/methods/mod.rs +373 -2
- package/packages/{document_batch → documents_batch}/Cargo.toml +7 -4
- package/packages/documents_batch/src/document_base_transition/mod.rs +88 -0
- package/packages/documents_batch/src/document_transition/mod.rs +166 -0
- package/packages/documents_batch/src/generators.rs +122 -0
- package/packages/documents_batch/src/lib.rs +195 -0
- package/packages/documents_batch/src/prefunded_voting_balance/mod.rs +45 -0
- package/packages/documents_batch/src/transitions/create/mod.rs +126 -0
- package/packages/documents_batch/src/transitions/delete/mod.rs +67 -0
- package/packages/documents_batch/src/transitions/mod.rs +6 -0
- package/packages/documents_batch/src/transitions/purchase/mod.rs +91 -0
- package/packages/documents_batch/src/transitions/replace/mod.rs +93 -0
- package/packages/documents_batch/src/transitions/transfer/mod.rs +84 -0
- package/packages/documents_batch/src/transitions/update_price/mod.rs +75 -0
- package/packages/enums/Cargo.toml +4 -4
- package/packages/enums/src/batch/batch_enum.rs +75 -10
- package/packages/enums/src/keys/key_type.rs +46 -0
- package/packages/enums/src/keys/purpose.rs +55 -0
- package/packages/enums/src/keys/security_level.rs +46 -0
- package/packages/enums/src/lib.rs +3 -0
- package/packages/enums/src/lock_types/mod.rs +65 -0
- package/packages/enums/src/network/mod.rs +67 -0
- package/packages/enums/src/platform/mod.rs +68 -8
- package/packages/enums/src/withdrawal/mod.rs +72 -0
- package/packages/identifier/Cargo.toml +9 -0
- package/packages/identifier/src/lib.rs +105 -0
- package/packages/identity/Cargo.toml +5 -5
- package/packages/identity/src/lib.rs +31 -25
- package/packages/{public_key → identity_public_key}/Cargo.toml +2 -2
- package/packages/{public_key → identity_public_key}/src/lib.rs +74 -27
- package/packages/identity_transitions/Cargo.toml +8 -4
- package/packages/identity_transitions/src/create_transition/mod.rs +102 -37
- package/packages/identity_transitions/src/credit_withdrawal_transition/mod.rs +212 -0
- package/packages/identity_transitions/src/identity_credit_transfer_transition/mod.rs +169 -0
- package/packages/identity_transitions/src/lib.rs +6 -1
- package/packages/identity_transitions/src/public_key_in_creation/mod.rs +197 -0
- package/packages/identity_transitions/src/top_up_transition/mod.rs +141 -0
- package/packages/identity_transitions/src/update_transition/mod.rs +213 -0
- package/packages/mock_bls/Cargo.toml +1 -1
- package/packages/private_key/Cargo.toml +4 -3
- package/packages/private_key/src/lib.rs +44 -6
- package/packages/state_transition/Cargo.toml +6 -4
- package/packages/state_transition/src/lib.rs +102 -36
- package/packages/utils/Cargo.toml +3 -4
- package/packages/utils/src/lib.rs +17 -18
- package/scripts/build-js.sh +22 -5
- package/scripts/build.sh +27 -2
- package/src/lib.rs +8 -1
- package/tests/AssetLockProof.spec.js +80 -0
- package/tests/ChainLockProof.spec.js +69 -0
- package/tests/CoreScript.spec.js +37 -0
- package/tests/DataContract.spec.js +178 -0
- package/tests/DataContractCreateStateTransition.spec.js +109 -0
- package/tests/DataContractUpdateStateTransition.spec.js +109 -0
- package/tests/Document.spec.js +238 -0
- package/tests/DocumentBatchTransition.spec.js +109 -0
- package/tests/DocumentTransition.spec.js +97 -0
- package/tests/DocumentsTransitions.spec.js +705 -0
- package/tests/Identifier.spec.js +84 -0
- package/tests/Identity.spec.js +113 -0
- package/tests/IdentityCreateTransition.spec.js +93 -0
- package/tests/IdentityCreditTransferTransition.spec.js +146 -0
- package/tests/IdentityCreditWithdrawalTransition.spec.js +192 -0
- package/tests/IdentityPublicKey.spec.js +132 -0
- package/tests/IdentityTopUpTransition.spec.js +131 -0
- package/tests/IdentityUpdateTransition.spec.js +147 -0
- package/tests/InstantLockProof.spec.js +97 -0
- package/tests/OutPoint.spec.js +55 -0
- package/tests/PrivateKey.spec.js +73 -0
- package/tests/PublicKeyInCreation.spec.js +258 -0
- package/tests/TxOut.spec.js +76 -0
- package/tests/mocks/DataContract/DataContract.json +153 -0
- package/tests/mocks/DataContract/index.js +6 -0
- package/tests/mocks/Document/DataContract.json +23 -0
- package/tests/mocks/Document/document.json +3 -0
- package/tests/mocks/Document/document2.json +3 -0
- package/tests/mocks/Document/index.js +11 -0
- package/tests/mocks/Identity/index.js +7 -0
- package/tests/mocks/Locks/index.js +5 -0
- package/tests/mocks/PrivateKey/index.js +5 -0
- package/tests/mocks/PublicKey/index.js +14 -0
- package/tests/utils/hex.js +15 -0
- package/tests/utils/wasm.js +14 -0
- package/typings/index.d.ts +52 -0
- package/packages/document/src/methods/js.rs +0 -260
- package/packages/document/src/methods/rust.rs +0 -92
- package/packages/document_batch/src/generators.rs +0 -63
- package/packages/document_batch/src/lib.rs +0 -228
- package/packages/identity_transitions/src/create_transition/public_key_in_creation/mod.rs +0 -146
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
use dpp::identity::identity_public_key::v0::IdentityPublicKeyV0;
|
|
2
|
-
use dpp::identity::{IdentityPublicKey, KeyType, Purpose, SecurityLevel};
|
|
3
|
-
use dpp::platform_value::BinaryData;
|
|
4
|
-
use dpp::platform_value::string_encoding::Encoding::Hex;
|
|
5
|
-
use dpp::state_transition::public_key_in_creation::IdentityPublicKeyInCreation;
|
|
6
|
-
use dpp::state_transition::public_key_in_creation::accessors::{
|
|
7
|
-
IdentityPublicKeyInCreationV0Getters, IdentityPublicKeyInCreationV0Setters,
|
|
8
|
-
};
|
|
9
|
-
use dpp::state_transition::public_key_in_creation::v0::IdentityPublicKeyInCreationV0;
|
|
10
|
-
use pshenmic_dpp_enums::keys::key_type::KeyTypeWASM;
|
|
11
|
-
use pshenmic_dpp_enums::keys::purpose::PurposeWASM;
|
|
12
|
-
use pshenmic_dpp_enums::keys::security_level::SecurityLevelWASM;
|
|
13
|
-
use pshenmic_dpp_public_key::IdentityPublicKeyWASM;
|
|
14
|
-
use wasm_bindgen::prelude::wasm_bindgen;
|
|
15
|
-
|
|
16
|
-
#[wasm_bindgen(js_name = "IdentityPublicKeyInCreationWASM")]
|
|
17
|
-
pub struct IdentityPublicKeyInCreationWASM(IdentityPublicKeyInCreation);
|
|
18
|
-
|
|
19
|
-
impl From<IdentityPublicKeyInCreation> for IdentityPublicKeyInCreationWASM {
|
|
20
|
-
fn from(value: IdentityPublicKeyInCreation) -> Self {
|
|
21
|
-
IdentityPublicKeyInCreationWASM(value)
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
impl From<IdentityPublicKeyInCreationWASM> for IdentityPublicKeyInCreation {
|
|
26
|
-
fn from(value: IdentityPublicKeyInCreationWASM) -> Self {
|
|
27
|
-
value.0
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
impl From<IdentityPublicKeyInCreationWASM> for IdentityPublicKey {
|
|
32
|
-
fn from(value: IdentityPublicKeyInCreationWASM) -> Self {
|
|
33
|
-
let contract_bounds = match value.0.contract_bounds() {
|
|
34
|
-
None => None,
|
|
35
|
-
Some(bounds) => Some(bounds.clone()),
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
IdentityPublicKey::V0(IdentityPublicKeyV0 {
|
|
39
|
-
id: value.0.id(),
|
|
40
|
-
purpose: value.0.purpose(),
|
|
41
|
-
security_level: value.0.security_level(),
|
|
42
|
-
contract_bounds,
|
|
43
|
-
key_type: value.0.key_type(),
|
|
44
|
-
read_only: value.0.read_only(),
|
|
45
|
-
data: value.0.data().clone(),
|
|
46
|
-
disabled_at: None,
|
|
47
|
-
})
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
#[wasm_bindgen]
|
|
52
|
-
impl IdentityPublicKeyInCreationWASM {
|
|
53
|
-
#[wasm_bindgen(constructor)]
|
|
54
|
-
pub fn new(
|
|
55
|
-
id: u32,
|
|
56
|
-
purpose: PurposeWASM,
|
|
57
|
-
security_level: SecurityLevelWASM,
|
|
58
|
-
key_type: KeyTypeWASM,
|
|
59
|
-
read_only: bool,
|
|
60
|
-
binary_data: &str,
|
|
61
|
-
signature: &str,
|
|
62
|
-
) -> IdentityPublicKeyInCreationWASM {
|
|
63
|
-
IdentityPublicKeyInCreationWASM(IdentityPublicKeyInCreation::V0(
|
|
64
|
-
IdentityPublicKeyInCreationV0 {
|
|
65
|
-
id,
|
|
66
|
-
key_type: KeyType::from(key_type),
|
|
67
|
-
purpose: Purpose::from(purpose),
|
|
68
|
-
security_level: SecurityLevel::from(security_level),
|
|
69
|
-
contract_bounds: None,
|
|
70
|
-
read_only,
|
|
71
|
-
data: BinaryData::from_string(binary_data, Hex).unwrap(),
|
|
72
|
-
signature: BinaryData::from_string(signature, Hex).unwrap(),
|
|
73
|
-
},
|
|
74
|
-
))
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
#[wasm_bindgen(js_name = toIdentityPublicKey)]
|
|
78
|
-
pub fn to_identity_public_key(&self) -> IdentityPublicKeyWASM {
|
|
79
|
-
IdentityPublicKeyWASM::new(
|
|
80
|
-
self.0.id(),
|
|
81
|
-
self.0.purpose().into(),
|
|
82
|
-
self.0.security_level().into(),
|
|
83
|
-
self.0.key_type().into(),
|
|
84
|
-
self.0.read_only(),
|
|
85
|
-
self.0.data().to_string(Hex).as_str(),
|
|
86
|
-
None,
|
|
87
|
-
)
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
#[wasm_bindgen(js_name = getKeyId)]
|
|
91
|
-
pub fn get_key_id(&self) -> u32 {
|
|
92
|
-
self.0.id()
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
#[wasm_bindgen(js_name = getPurpose)]
|
|
96
|
-
pub fn get_purpose(&self) -> PurposeWASM {
|
|
97
|
-
PurposeWASM::from(self.0.purpose())
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
#[wasm_bindgen(js_name = getSecurityLevel)]
|
|
101
|
-
pub fn get_security_level(&self) -> SecurityLevelWASM {
|
|
102
|
-
SecurityLevelWASM::from(self.0.security_level())
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
#[wasm_bindgen(js_name = getKeyType)]
|
|
106
|
-
pub fn get_key_type(&self) -> KeyTypeWASM {
|
|
107
|
-
KeyTypeWASM::from(self.0.key_type())
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
#[wasm_bindgen(js_name = getReadOnly)]
|
|
111
|
-
pub fn get_read_only(&self) -> bool {
|
|
112
|
-
self.0.read_only()
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
#[wasm_bindgen(js_name = getData)]
|
|
116
|
-
pub fn get_data(&self) -> String {
|
|
117
|
-
self.0.data().to_string(Hex)
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
#[wasm_bindgen(js_name = setKeyId)]
|
|
121
|
-
pub fn set_key_id(&mut self, key_id: u32) {
|
|
122
|
-
self.0.set_id(key_id)
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
#[wasm_bindgen(js_name = setPurpose)]
|
|
126
|
-
pub fn set_purpose(&mut self, purpose: PurposeWASM) {
|
|
127
|
-
self.0.set_purpose(Purpose::from(purpose))
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
#[wasm_bindgen(js_name = setSecurityLevel)]
|
|
131
|
-
pub fn set_security_level(&mut self, security_level: SecurityLevelWASM) {
|
|
132
|
-
self.0
|
|
133
|
-
.set_security_level(SecurityLevel::from(security_level))
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
#[wasm_bindgen(js_name = setReadOnly)]
|
|
137
|
-
pub fn set_read_only(&mut self, read_only: bool) {
|
|
138
|
-
self.0.set_read_only(read_only)
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
#[wasm_bindgen(js_name = setData)]
|
|
142
|
-
pub fn set_data(&mut self, binary_data: &str) {
|
|
143
|
-
let data = BinaryData::from_string(binary_data, Hex).unwrap();
|
|
144
|
-
self.0.set_data(data)
|
|
145
|
-
}
|
|
146
|
-
}
|