Members
# ERC20Events
Enum representing the events emitted by an ERC20 contract.
Enum representing the events emitted by an ERC20 contract.
# constant SEGREGATED_COLLECTION_EXTRACTION_PRIORITY
This priority ensures collections are registered in context before any sequence operations occur, allowing sequences to be replicated to private/shared collections.
Priority for early collection extraction (before pk generation at priority 60)
Methods
# Owner() → {MethodDecorator}
Decorator for marking methods that require ownership authorization.
Decorator for marking methods that require ownership authorization. Checks the owner of the token before allowing the method to be executed.
A method decorator that checks ownership authorization.
MethodDecorator
Example
```typescript
class TokenContract extends Contract {
# decrypt(encryptedText, keyObject)
Util function to decrypt data
Parameters:
| Name | Type | Description |
|---|---|---|
encryptedText |
BufferSource
|
|
keyObject |
keyObject
|
# encrypt(text, keyObject)
Util function to decrypt data
Parameters:
| Name | Type | Description |
|---|---|---|
text |
string
|
|
keyObject |
keyObject
|
# extractMspId(identity)
Extracts the MSP ID from either a string or ClientIdentity object
.Extracts the MSP ID from either a string or ClientIdentity object
Parameters:
| Name | Type | Description |
|---|---|---|
identity |
The identity value which can be a string MSP ID or ClientIdentity object |
The MSP ID as a string, or undefined if not available
# extractSegregatedCollections(context, data, keys, model) → {Promise.<void>}
Runs with priority < 40 to extract collection names before pk generation (priority 60). This allows FabricContractSequence to know which collections to replicate to.
Early handler to extract and register collections in context
Parameters:
| Name | Type | Description |
|---|---|---|
context |
ContextOf.<Repository.<M, any>>
|
The execution context |
data |
SegregatedDataMetadata
|
Array.<SegregatedDataMetadata>
|
The segregated data metadata |
keys |
string
|
Array.<string>
|
The property key(s) being segregated |
model |
M
|
The model instance |
Promise.<void>
# getAkiAndSerialFromCert()
Extracts the certificate Serial Number and the AKI (Authority Key Identifier) in the format Fabric CA expects (plain hex, no colons).
Extracts the certificate Serial Number and the AKI (Authority Key Identifier) in the format Fabric CA expects (plain hex, no colons).
# getDerivationKey(salt, key)
Util function to derive a key from another key
Parameters:
| Name | Type | Description |
|---|---|---|
salt |
string
|
|
key |
CryptoKey
|
Original key |
# getKey(derivation)
Util function to get the key and IV from the CrytoKey array
Parameters:
| Name | Type | Description |
|---|---|---|
derivation |
ArrayBuffer
|
# getMaster(data)
Util function to get a random master key
If data is not passed, a random ArrayBuffer will be generated
Parameters:
| Name | Type | Description |
|---|---|---|
data |
ArrayBuffer
|
encrytion data |
# getVersionOf()
Correctly extracts the version number from a model by inspecting
the property decorated with @version().
Correctly extracts the version number from a model by inspecting
the property decorated with @version().
Model.versionProp() has a bug where it returns Object.keys(meta)[0]
(the first metadata key overall) instead of the actual version property name.
This helper uses Metadata.get() correctly to find the DBKeys.VERSION
entry and then reads the first property name from it.
the version number (>= 1), or undefined if none found.
# normalizeRelationsForAudit()
Returns a shallow-cloned copy of the model where each relation array item is normalised to its string ID.
Returns a shallow-cloned copy of the model where each relation array item
is normalised to its string ID. This ensures that { id: "x" } and "x"
compare as equal so that unchanged relations produce no diff.
# populateRelations()
Returns a shallow-cloned copy of the model with relation properties resolved to their full instances.
Returns a shallow-cloned copy of the model with relation properties resolved to their full instances. The original model is NOT mutated.
# sortKeysOnlyRecursive(obj) → {any}
Recursively sorts object keys without reordering arrays
.Recursively sorts object keys without reordering arrays
Parameters:
| Name | Type | Description |
|---|---|---|
obj |
any
|
The value to process |
A copy with sorted object keys but preserved array order
any