@dashevo/wasm-dpp2 4.2.0-dev.2 → 4.2.0-dev.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.
@@ -1859,7 +1859,7 @@ export class BatchTransition {
1859
1859
  if (Symbol.dispose) BatchTransition.prototype[Symbol.dispose] = BatchTransition.prototype.free;
1860
1860
 
1861
1861
  /**
1862
- * @enum {0 | 1 | 2 | 3 | 4 | 5 | 6}
1862
+ * @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7}
1863
1863
  */
1864
1864
  export const BatchType = Object.freeze({
1865
1865
  Create: 0, "0": "Create",
@@ -1869,6 +1869,7 @@ export const BatchType = Object.freeze({
1869
1869
  Purchase: 4, "4": "Purchase",
1870
1870
  UpdatePrice: 5, "5": "UpdatePrice",
1871
1871
  IgnoreWhileBumpingRevision: 6, "6": "IgnoreWhileBumpingRevision",
1872
+ IndexOnlyDelete: 7, "7": "IndexOnlyDelete",
1872
1873
  });
1873
1874
 
1874
1875
  export class BatchedTransition {
@@ -2493,6 +2494,18 @@ export class ConsensusError {
2493
2494
  const ptr = this.__destroy_into_raw();
2494
2495
  wasm.__wbg_consensuserror_free(ptr, 0);
2495
2496
  }
2497
+ /**
2498
+ * The consensus error code.
2499
+ *
2500
+ * This is the same number that reaches JS as `WasmSdkError.code` when
2501
+ * a state transition is rejected. See [`DocumentReferenceErrorCodeWasm`]
2502
+ * for the reference-validation range.
2503
+ * @returns {number}
2504
+ */
2505
+ get code() {
2506
+ const ret = wasm.consensuserror_code(this.__wbg_ptr);
2507
+ return ret >>> 0;
2508
+ }
2496
2509
  /**
2497
2510
  * @param {Uint8Array} error
2498
2511
  * @returns {ConsensusError}
@@ -2506,6 +2519,15 @@ export class ConsensusError {
2506
2519
  }
2507
2520
  return ConsensusError.__wrap(ret[0]);
2508
2521
  }
2522
+ /**
2523
+ * The reference-validation error this is, or `undefined` when it is
2524
+ * not one of codes 40120-40125.
2525
+ * @returns {DocumentReferenceErrorCode | undefined}
2526
+ */
2527
+ get documentReferenceErrorCode() {
2528
+ const ret = wasm.consensuserror_document_reference_error_code(this.__wbg_ptr);
2529
+ return ret === 0 ? undefined : ret;
2530
+ }
2509
2531
  /**
2510
2532
  * @returns {string}
2511
2533
  */
@@ -3249,6 +3271,47 @@ export class DataContract {
3249
3271
  DataContractFinalization.register(this, this.__wbg_ptr, this);
3250
3272
  return this;
3251
3273
  }
3274
+ /**
3275
+ * All `refersTo` declarations of one document type, in schema property
3276
+ * order.
3277
+ *
3278
+ * Returns an empty array when the document type declares none. Throws
3279
+ * when the contract has no document type by that name — an empty array
3280
+ * would conflate "no such type" with "no references".
3281
+ *
3282
+ * Reference declarations are only parsed from protocol version 14
3283
+ * onward. A contract deserialized against an earlier platform version
3284
+ * reports none, which is exactly what consensus enforced at that
3285
+ * version — but note the trap: `DataContract.fromBytes(bytes, false, 1)`
3286
+ * yields `[]` even for a contract whose raw schema does carry
3287
+ * `refersTo`, and `toJSON()` still shows the raw keyword either way.
3288
+ * @param {string} documentTypeName
3289
+ * @returns {Array<DocumentPropertyReference>}
3290
+ */
3291
+ documentTypeReferences(documentTypeName) {
3292
+ const ptr0 = passStringToWasm0(documentTypeName, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3293
+ const len0 = WASM_VECTOR_LEN;
3294
+ const ret = wasm.datacontract_documentTypeReferences(this.__wbg_ptr, ptr0, len0);
3295
+ if (ret[2]) {
3296
+ throw takeFromExternrefTable0(ret[1]);
3297
+ }
3298
+ return takeFromExternrefTable0(ret[0]);
3299
+ }
3300
+ /**
3301
+ * Every document type that declares at least one reference, keyed by
3302
+ * document type name.
3303
+ *
3304
+ * Document types with no declarations are omitted, so an empty `Map`
3305
+ * means "this contract declares no references at all".
3306
+ * @returns {Map<string, Array<DocumentPropertyReference>>}
3307
+ */
3308
+ get documentReferences() {
3309
+ const ret = wasm.datacontract_document_references(this.__wbg_ptr);
3310
+ if (ret[2]) {
3311
+ throw takeFromExternrefTable0(ret[1]);
3312
+ }
3313
+ return takeFromExternrefTable0(ret[0]);
3314
+ }
3252
3315
  /**
3253
3316
  * @param {string} base64
3254
3317
  * @param {boolean} full_validation
@@ -6251,6 +6314,60 @@ export class DocumentPurchaseTransition {
6251
6314
  }
6252
6315
  if (Symbol.dispose) DocumentPurchaseTransition.prototype[Symbol.dispose] = DocumentPurchaseTransition.prototype.free;
6253
6316
 
6317
+ /**
6318
+ * Consensus error codes emitted by `refersTo` reference validation, which
6319
+ * runs from protocol version 14 onward.
6320
+ *
6321
+ * Branch on an error's `code` against these instead of matching its
6322
+ * message. Both directions work — `DocumentReferenceErrorCode[40123]` is
6323
+ * `"ReferencedIdentityKeyNotFound"`.
6324
+ *
6325
+ * These reach JS on the state-transition broadcast path, where the
6326
+ * consensus code is carried through to `WasmSdkError.code`:
6327
+ *
6328
+ * ```js
6329
+ * try {
6330
+ * await sdk.documents.create({ document, identityKey, signer });
6331
+ * } catch (e) {
6332
+ * if (e.code === DocumentReferenceErrorCode.ReferencedIdentityKeyDisabled) {
6333
+ * // the referenced key exists but was disabled
6334
+ * }
6335
+ * }
6336
+ * ```
6337
+ * @enum {40120 | 40121 | 40122 | 40123 | 40124 | 40125}
6338
+ */
6339
+ export const DocumentReferenceErrorCode = Object.freeze({
6340
+ /**
6341
+ * The referenced identity, contract, token or permanent document does
6342
+ * not exist.
6343
+ */
6344
+ ReferencedEntityNotFound: 40120, "40120": "ReferencedEntityNotFound",
6345
+ /**
6346
+ * A `permanentDocument` reference names a document type the referenced
6347
+ * contract does not define, or the contract itself is missing.
6348
+ */
6349
+ ReferencedDocumentTypeNotFound: 40121, "40121": "ReferencedDocumentTypeNotFound",
6350
+ /**
6351
+ * The referenced document type allows deletion. Only types declaring
6352
+ * `canBeDeleted: false` may be the target of a `permanentDocument`
6353
+ * reference — otherwise the reference could be left dangling.
6354
+ */
6355
+ ReferencedDocumentTypeDeletable: 40122, "40122": "ReferencedDocumentTypeDeletable",
6356
+ /**
6357
+ * The referenced identity public key does not exist.
6358
+ */
6359
+ ReferencedIdentityKeyNotFound: 40123, "40123": "ReferencedIdentityKeyNotFound",
6360
+ /**
6361
+ * The referenced identity public key exists but is disabled.
6362
+ */
6363
+ ReferencedIdentityKeyDisabled: 40124, "40124": "ReferencedIdentityKeyDisabled",
6364
+ /**
6365
+ * The declaration's `keyIdProperty` is missing from the document type,
6366
+ * or names a property that is not an integer.
6367
+ */
6368
+ ReferencedKeyIdPropertyInvalid: 40125, "40125": "ReferencedKeyIdPropertyInvalid",
6369
+ });
6370
+
6254
6371
  export class DocumentReplaceTransition {
6255
6372
  static __wrap(ptr) {
6256
6373
  ptr = ptr >>> 0;
@@ -13680,7 +13797,7 @@ export class PlatformAddressSigner {
13680
13797
  * Creates a new empty PlatformAddressSigner.
13681
13798
  */
13682
13799
  constructor() {
13683
- const ret = wasm.platformaddresssigner_constructor();
13800
+ const ret = wasm.identitysigner_constructor();
13684
13801
  this.__wbg_ptr = ret >>> 0;
13685
13802
  PlatformAddressSignerFinalization.register(this, this.__wbg_ptr, this);
13686
13803
  return this;
@@ -14957,7 +15074,7 @@ export class SharedEncryptedNote {
14957
15074
  constructor(senderKeyIndex, recipientKeyIndex, value) {
14958
15075
  const ptr0 = passArray8ToWasm0(value, wasm.__wbindgen_malloc);
14959
15076
  const len0 = WASM_VECTOR_LEN;
14960
- const ret = wasm.privateencryptednote_constructor(senderKeyIndex, recipientKeyIndex, ptr0, len0);
15077
+ const ret = wasm.sharedencryptednote_constructor(senderKeyIndex, recipientKeyIndex, ptr0, len0);
14961
15078
  this.__wbg_ptr = ret >>> 0;
14962
15079
  SharedEncryptedNoteFinalization.register(this, this.__wbg_ptr, this);
14963
15080
  return this;
@@ -16302,7 +16419,7 @@ export class TimeBasedDistribution {
16302
16419
  * @returns {bigint}
16303
16420
  */
16304
16421
  get interval() {
16305
- const ret = wasm.__wbg_get_timebaseddistribution_interval(this.__wbg_ptr);
16422
+ const ret = wasm.__wbg_get_blockbaseddistribution_interval(this.__wbg_ptr);
16306
16423
  return BigInt.asUintN(64, ret);
16307
16424
  }
16308
16425
  /**
@@ -1859,7 +1859,7 @@ export class BatchTransition {
1859
1859
  if (Symbol.dispose) BatchTransition.prototype[Symbol.dispose] = BatchTransition.prototype.free;
1860
1860
 
1861
1861
  /**
1862
- * @enum {0 | 1 | 2 | 3 | 4 | 5 | 6}
1862
+ * @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7}
1863
1863
  */
1864
1864
  export const BatchType = Object.freeze({
1865
1865
  Create: 0, "0": "Create",
@@ -1869,6 +1869,7 @@ export const BatchType = Object.freeze({
1869
1869
  Purchase: 4, "4": "Purchase",
1870
1870
  UpdatePrice: 5, "5": "UpdatePrice",
1871
1871
  IgnoreWhileBumpingRevision: 6, "6": "IgnoreWhileBumpingRevision",
1872
+ IndexOnlyDelete: 7, "7": "IndexOnlyDelete",
1872
1873
  });
1873
1874
 
1874
1875
  export class BatchedTransition {
@@ -2493,6 +2494,18 @@ export class ConsensusError {
2493
2494
  const ptr = this.__destroy_into_raw();
2494
2495
  wasm.__wbg_consensuserror_free(ptr, 0);
2495
2496
  }
2497
+ /**
2498
+ * The consensus error code.
2499
+ *
2500
+ * This is the same number that reaches JS as `WasmSdkError.code` when
2501
+ * a state transition is rejected. See [`DocumentReferenceErrorCodeWasm`]
2502
+ * for the reference-validation range.
2503
+ * @returns {number}
2504
+ */
2505
+ get code() {
2506
+ const ret = wasm.consensuserror_code(this.__wbg_ptr);
2507
+ return ret >>> 0;
2508
+ }
2496
2509
  /**
2497
2510
  * @param {Uint8Array} error
2498
2511
  * @returns {ConsensusError}
@@ -2506,6 +2519,15 @@ export class ConsensusError {
2506
2519
  }
2507
2520
  return ConsensusError.__wrap(ret[0]);
2508
2521
  }
2522
+ /**
2523
+ * The reference-validation error this is, or `undefined` when it is
2524
+ * not one of codes 40120-40125.
2525
+ * @returns {DocumentReferenceErrorCode | undefined}
2526
+ */
2527
+ get documentReferenceErrorCode() {
2528
+ const ret = wasm.consensuserror_document_reference_error_code(this.__wbg_ptr);
2529
+ return ret === 0 ? undefined : ret;
2530
+ }
2509
2531
  /**
2510
2532
  * @returns {string}
2511
2533
  */
@@ -3249,6 +3271,47 @@ export class DataContract {
3249
3271
  DataContractFinalization.register(this, this.__wbg_ptr, this);
3250
3272
  return this;
3251
3273
  }
3274
+ /**
3275
+ * All `refersTo` declarations of one document type, in schema property
3276
+ * order.
3277
+ *
3278
+ * Returns an empty array when the document type declares none. Throws
3279
+ * when the contract has no document type by that name — an empty array
3280
+ * would conflate "no such type" with "no references".
3281
+ *
3282
+ * Reference declarations are only parsed from protocol version 14
3283
+ * onward. A contract deserialized against an earlier platform version
3284
+ * reports none, which is exactly what consensus enforced at that
3285
+ * version — but note the trap: `DataContract.fromBytes(bytes, false, 1)`
3286
+ * yields `[]` even for a contract whose raw schema does carry
3287
+ * `refersTo`, and `toJSON()` still shows the raw keyword either way.
3288
+ * @param {string} documentTypeName
3289
+ * @returns {Array<DocumentPropertyReference>}
3290
+ */
3291
+ documentTypeReferences(documentTypeName) {
3292
+ const ptr0 = passStringToWasm0(documentTypeName, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3293
+ const len0 = WASM_VECTOR_LEN;
3294
+ const ret = wasm.datacontract_documentTypeReferences(this.__wbg_ptr, ptr0, len0);
3295
+ if (ret[2]) {
3296
+ throw takeFromExternrefTable0(ret[1]);
3297
+ }
3298
+ return takeFromExternrefTable0(ret[0]);
3299
+ }
3300
+ /**
3301
+ * Every document type that declares at least one reference, keyed by
3302
+ * document type name.
3303
+ *
3304
+ * Document types with no declarations are omitted, so an empty `Map`
3305
+ * means "this contract declares no references at all".
3306
+ * @returns {Map<string, Array<DocumentPropertyReference>>}
3307
+ */
3308
+ get documentReferences() {
3309
+ const ret = wasm.datacontract_document_references(this.__wbg_ptr);
3310
+ if (ret[2]) {
3311
+ throw takeFromExternrefTable0(ret[1]);
3312
+ }
3313
+ return takeFromExternrefTable0(ret[0]);
3314
+ }
3252
3315
  /**
3253
3316
  * @param {string} base64
3254
3317
  * @param {boolean} full_validation
@@ -6251,6 +6314,60 @@ export class DocumentPurchaseTransition {
6251
6314
  }
6252
6315
  if (Symbol.dispose) DocumentPurchaseTransition.prototype[Symbol.dispose] = DocumentPurchaseTransition.prototype.free;
6253
6316
 
6317
+ /**
6318
+ * Consensus error codes emitted by `refersTo` reference validation, which
6319
+ * runs from protocol version 14 onward.
6320
+ *
6321
+ * Branch on an error's `code` against these instead of matching its
6322
+ * message. Both directions work — `DocumentReferenceErrorCode[40123]` is
6323
+ * `"ReferencedIdentityKeyNotFound"`.
6324
+ *
6325
+ * These reach JS on the state-transition broadcast path, where the
6326
+ * consensus code is carried through to `WasmSdkError.code`:
6327
+ *
6328
+ * ```js
6329
+ * try {
6330
+ * await sdk.documents.create({ document, identityKey, signer });
6331
+ * } catch (e) {
6332
+ * if (e.code === DocumentReferenceErrorCode.ReferencedIdentityKeyDisabled) {
6333
+ * // the referenced key exists but was disabled
6334
+ * }
6335
+ * }
6336
+ * ```
6337
+ * @enum {40120 | 40121 | 40122 | 40123 | 40124 | 40125}
6338
+ */
6339
+ export const DocumentReferenceErrorCode = Object.freeze({
6340
+ /**
6341
+ * The referenced identity, contract, token or permanent document does
6342
+ * not exist.
6343
+ */
6344
+ ReferencedEntityNotFound: 40120, "40120": "ReferencedEntityNotFound",
6345
+ /**
6346
+ * A `permanentDocument` reference names a document type the referenced
6347
+ * contract does not define, or the contract itself is missing.
6348
+ */
6349
+ ReferencedDocumentTypeNotFound: 40121, "40121": "ReferencedDocumentTypeNotFound",
6350
+ /**
6351
+ * The referenced document type allows deletion. Only types declaring
6352
+ * `canBeDeleted: false` may be the target of a `permanentDocument`
6353
+ * reference — otherwise the reference could be left dangling.
6354
+ */
6355
+ ReferencedDocumentTypeDeletable: 40122, "40122": "ReferencedDocumentTypeDeletable",
6356
+ /**
6357
+ * The referenced identity public key does not exist.
6358
+ */
6359
+ ReferencedIdentityKeyNotFound: 40123, "40123": "ReferencedIdentityKeyNotFound",
6360
+ /**
6361
+ * The referenced identity public key exists but is disabled.
6362
+ */
6363
+ ReferencedIdentityKeyDisabled: 40124, "40124": "ReferencedIdentityKeyDisabled",
6364
+ /**
6365
+ * The declaration's `keyIdProperty` is missing from the document type,
6366
+ * or names a property that is not an integer.
6367
+ */
6368
+ ReferencedKeyIdPropertyInvalid: 40125, "40125": "ReferencedKeyIdPropertyInvalid",
6369
+ });
6370
+
6254
6371
  export class DocumentReplaceTransition {
6255
6372
  static __wrap(ptr) {
6256
6373
  ptr = ptr >>> 0;
@@ -13680,7 +13797,7 @@ export class PlatformAddressSigner {
13680
13797
  * Creates a new empty PlatformAddressSigner.
13681
13798
  */
13682
13799
  constructor() {
13683
- const ret = wasm.platformaddresssigner_constructor();
13800
+ const ret = wasm.identitysigner_constructor();
13684
13801
  this.__wbg_ptr = ret >>> 0;
13685
13802
  PlatformAddressSignerFinalization.register(this, this.__wbg_ptr, this);
13686
13803
  return this;
@@ -14957,7 +15074,7 @@ export class SharedEncryptedNote {
14957
15074
  constructor(senderKeyIndex, recipientKeyIndex, value) {
14958
15075
  const ptr0 = passArray8ToWasm0(value, wasm.__wbindgen_malloc);
14959
15076
  const len0 = WASM_VECTOR_LEN;
14960
- const ret = wasm.privateencryptednote_constructor(senderKeyIndex, recipientKeyIndex, ptr0, len0);
15077
+ const ret = wasm.sharedencryptednote_constructor(senderKeyIndex, recipientKeyIndex, ptr0, len0);
14961
15078
  this.__wbg_ptr = ret >>> 0;
14962
15079
  SharedEncryptedNoteFinalization.register(this, this.__wbg_ptr, this);
14963
15080
  return this;
@@ -16302,7 +16419,7 @@ export class TimeBasedDistribution {
16302
16419
  * @returns {bigint}
16303
16420
  */
16304
16421
  get interval() {
16305
- const ret = wasm.__wbg_get_timebaseddistribution_interval(this.__wbg_ptr);
16422
+ const ret = wasm.__wbg_get_blockbaseddistribution_interval(this.__wbg_ptr);
16306
16423
  return BigInt.asUintN(64, ret);
16307
16424
  }
16308
16425
  /**
Binary file