@ottochain/sdk 1.6.0 → 2.0.0
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/cjs/apps/contracts/index.js +18 -13
- package/dist/cjs/apps/contracts/state-machines/index.js +139 -7
- package/dist/cjs/apps/corporate/index.js +18 -20
- package/dist/cjs/apps/corporate/state-machines/index.js +535 -6336
- package/dist/cjs/apps/governance/index.js +32 -31
- package/dist/cjs/apps/governance/state-machines/index.js +498 -2315
- package/dist/cjs/apps/identity/index.js +15 -7
- package/dist/cjs/apps/identity/state-machines/index.js +516 -4
- package/dist/cjs/apps/index.js +15 -13
- package/dist/cjs/apps/markets/index.js +23 -10
- package/dist/cjs/apps/markets/state-machines/index.js +1904 -230
- package/dist/esm/apps/contracts/index.js +16 -13
- package/dist/esm/apps/contracts/state-machines/index.js +138 -6
- package/dist/esm/apps/corporate/index.js +14 -20
- package/dist/esm/apps/corporate/state-machines/index.js +534 -6335
- package/dist/esm/apps/governance/index.js +26 -30
- package/dist/esm/apps/governance/state-machines/index.js +497 -2314
- package/dist/esm/apps/identity/index.js +13 -7
- package/dist/esm/apps/identity/state-machines/index.js +515 -3
- package/dist/esm/apps/index.js +14 -12
- package/dist/esm/apps/markets/index.js +19 -10
- package/dist/esm/apps/markets/state-machines/index.js +1903 -229
- package/dist/types/apps/contracts/index.d.ts +661 -9
- package/dist/types/apps/contracts/state-machines/index.d.ts +109 -6
- package/dist/types/apps/corporate/index.d.ts +4015 -7
- package/dist/types/apps/corporate/state-machines/index.d.ts +472 -5587
- package/dist/types/apps/governance/index.d.ts +2151 -12
- package/dist/types/apps/governance/state-machines/index.d.ts +462 -1875
- package/dist/types/apps/identity/index.d.ts +601 -4
- package/dist/types/apps/identity/state-machines/index.d.ts +393 -3
- package/dist/types/apps/index.d.ts +14 -12
- package/dist/types/apps/markets/index.d.ts +1690 -7
- package/dist/types/apps/markets/state-machines/index.d.ts +1416 -184
- package/package.json +1 -1
- package/dist/cjs/apps/oracles/index.js +0 -59
- package/dist/cjs/apps/oracles/state-machines/index.js +0 -415
- package/dist/esm/apps/oracles/index.js +0 -42
- package/dist/esm/apps/oracles/state-machines/index.js +0 -412
- package/dist/types/apps/oracles/index.d.ts +0 -34
- package/dist/types/apps/oracles/state-machines/index.d.ts +0 -312
|
@@ -9,10 +9,11 @@
|
|
|
9
9
|
* ContractState,
|
|
10
10
|
* Contract,
|
|
11
11
|
* getContractDefinition,
|
|
12
|
-
*
|
|
12
|
+
* CONTRACTS_DEFINITIONS
|
|
13
13
|
* } from '@ottochain/sdk/apps/contracts';
|
|
14
14
|
*
|
|
15
|
-
* const
|
|
15
|
+
* const agreementDef = getContractDefinition('agreement');
|
|
16
|
+
* const escrowDef = getContractDefinition('escrow');
|
|
16
17
|
* ```
|
|
17
18
|
*
|
|
18
19
|
* @packageDocumentation
|
|
@@ -22,20 +23,22 @@ export { ContractState, Contract, ProposeContractRequest, AcceptContractRequest,
|
|
|
22
23
|
// ---------------------------------------------------------------------------
|
|
23
24
|
// State Machine Definitions (generated from JSON at build time)
|
|
24
25
|
// ---------------------------------------------------------------------------
|
|
25
|
-
import {
|
|
26
|
-
export
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
import { contractUniversalDef, contractAgreementDef, contractEscrowDef, } from './state-machines/index.js';
|
|
27
|
+
export { contractUniversalDef, contractAgreementDef, contractEscrowDef };
|
|
28
|
+
/** All contract state machine definitions */
|
|
29
|
+
export const CONTRACTS_DEFINITIONS = {
|
|
30
|
+
universal: contractUniversalDef,
|
|
31
|
+
agreement: contractAgreementDef,
|
|
32
|
+
escrow: contractEscrowDef,
|
|
29
33
|
};
|
|
30
34
|
/**
|
|
31
|
-
* Get
|
|
35
|
+
* Get a contract state machine definition by type.
|
|
36
|
+
* @param type - 'universal' | 'agreement' | 'escrow' (default: 'agreement')
|
|
32
37
|
*/
|
|
33
|
-
export function getContractDefinition() {
|
|
34
|
-
return
|
|
38
|
+
export function getContractDefinition(type = 'agreement') {
|
|
39
|
+
return CONTRACTS_DEFINITIONS[type];
|
|
35
40
|
}
|
|
36
|
-
/**
|
|
37
|
-
* Get the escrow state machine definition.
|
|
38
|
-
*/
|
|
41
|
+
/** @deprecated Use getContractDefinition('escrow') */
|
|
39
42
|
export function getEscrowDefinition() {
|
|
40
|
-
return
|
|
43
|
+
return contractEscrowDef;
|
|
41
44
|
}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* Auto-generated from JSON state machine definitions.
|
|
3
3
|
* DO NOT EDIT - regenerate with: npm run prebuild
|
|
4
4
|
*/
|
|
5
|
-
export const
|
|
5
|
+
export const contractAgreementDef = {
|
|
6
6
|
"metadata": {
|
|
7
|
-
"name": "
|
|
8
|
-
"description": "
|
|
7
|
+
"name": "ContractAgreement",
|
|
8
|
+
"description": "Two-party agreement with mutual completion attestation and dispute resolution",
|
|
9
9
|
"version": "1.0.0",
|
|
10
10
|
"crossReferences": {
|
|
11
11
|
"proposerIdentityId": "Links to proposer's AgentIdentity fiber",
|
|
@@ -354,10 +354,10 @@ export const contractDef = {
|
|
|
354
354
|
}
|
|
355
355
|
]
|
|
356
356
|
};
|
|
357
|
-
export const
|
|
357
|
+
export const contractEscrowDef = {
|
|
358
358
|
"metadata": {
|
|
359
|
-
"name": "
|
|
360
|
-
"description": "Asset custody
|
|
359
|
+
"name": "ContractEscrow",
|
|
360
|
+
"description": "Asset custody with conditional release, dispute resolution, and split payments",
|
|
361
361
|
"version": "1.0.0",
|
|
362
362
|
"crossReferences": {
|
|
363
363
|
"contractId": "Links to Contract SM that created this escrow",
|
|
@@ -708,3 +708,135 @@ export const escrowDef = {
|
|
|
708
708
|
}
|
|
709
709
|
]
|
|
710
710
|
};
|
|
711
|
+
export const contractUniversalDef = {
|
|
712
|
+
"metadata": {
|
|
713
|
+
"name": "ContractUniversal",
|
|
714
|
+
"description": "Minimal contract state machine - extend for custom use cases",
|
|
715
|
+
"version": "1.0.0"
|
|
716
|
+
},
|
|
717
|
+
"states": {
|
|
718
|
+
"PROPOSED": {
|
|
719
|
+
"id": "PROPOSED",
|
|
720
|
+
"isFinal": false,
|
|
721
|
+
"metadata": null
|
|
722
|
+
},
|
|
723
|
+
"ACTIVE": {
|
|
724
|
+
"id": "ACTIVE",
|
|
725
|
+
"isFinal": false,
|
|
726
|
+
"metadata": null
|
|
727
|
+
},
|
|
728
|
+
"COMPLETED": {
|
|
729
|
+
"id": "COMPLETED",
|
|
730
|
+
"isFinal": true,
|
|
731
|
+
"metadata": null
|
|
732
|
+
},
|
|
733
|
+
"CANCELLED": {
|
|
734
|
+
"id": "CANCELLED",
|
|
735
|
+
"isFinal": true,
|
|
736
|
+
"metadata": null
|
|
737
|
+
}
|
|
738
|
+
},
|
|
739
|
+
"initialState": "PROPOSED",
|
|
740
|
+
"transitions": [
|
|
741
|
+
{
|
|
742
|
+
"from": "PROPOSED",
|
|
743
|
+
"to": "ACTIVE",
|
|
744
|
+
"eventName": "accept",
|
|
745
|
+
"guard": {
|
|
746
|
+
"==": [
|
|
747
|
+
1,
|
|
748
|
+
1
|
|
749
|
+
]
|
|
750
|
+
},
|
|
751
|
+
"effect": {
|
|
752
|
+
"merge": [
|
|
753
|
+
{
|
|
754
|
+
"var": "state"
|
|
755
|
+
},
|
|
756
|
+
{
|
|
757
|
+
"status": "ACTIVE",
|
|
758
|
+
"acceptedAt": {
|
|
759
|
+
"var": "$timestamp"
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
]
|
|
763
|
+
},
|
|
764
|
+
"dependencies": []
|
|
765
|
+
},
|
|
766
|
+
{
|
|
767
|
+
"from": "PROPOSED",
|
|
768
|
+
"to": "CANCELLED",
|
|
769
|
+
"eventName": "cancel",
|
|
770
|
+
"guard": {
|
|
771
|
+
"==": [
|
|
772
|
+
1,
|
|
773
|
+
1
|
|
774
|
+
]
|
|
775
|
+
},
|
|
776
|
+
"effect": {
|
|
777
|
+
"merge": [
|
|
778
|
+
{
|
|
779
|
+
"var": "state"
|
|
780
|
+
},
|
|
781
|
+
{
|
|
782
|
+
"status": "CANCELLED",
|
|
783
|
+
"cancelledAt": {
|
|
784
|
+
"var": "$timestamp"
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
]
|
|
788
|
+
},
|
|
789
|
+
"dependencies": []
|
|
790
|
+
},
|
|
791
|
+
{
|
|
792
|
+
"from": "ACTIVE",
|
|
793
|
+
"to": "COMPLETED",
|
|
794
|
+
"eventName": "complete",
|
|
795
|
+
"guard": {
|
|
796
|
+
"==": [
|
|
797
|
+
1,
|
|
798
|
+
1
|
|
799
|
+
]
|
|
800
|
+
},
|
|
801
|
+
"effect": {
|
|
802
|
+
"merge": [
|
|
803
|
+
{
|
|
804
|
+
"var": "state"
|
|
805
|
+
},
|
|
806
|
+
{
|
|
807
|
+
"status": "COMPLETED",
|
|
808
|
+
"completedAt": {
|
|
809
|
+
"var": "$timestamp"
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
]
|
|
813
|
+
},
|
|
814
|
+
"dependencies": []
|
|
815
|
+
},
|
|
816
|
+
{
|
|
817
|
+
"from": "ACTIVE",
|
|
818
|
+
"to": "CANCELLED",
|
|
819
|
+
"eventName": "cancel",
|
|
820
|
+
"guard": {
|
|
821
|
+
"==": [
|
|
822
|
+
1,
|
|
823
|
+
1
|
|
824
|
+
]
|
|
825
|
+
},
|
|
826
|
+
"effect": {
|
|
827
|
+
"merge": [
|
|
828
|
+
{
|
|
829
|
+
"var": "state"
|
|
830
|
+
},
|
|
831
|
+
{
|
|
832
|
+
"status": "CANCELLED",
|
|
833
|
+
"cancelledAt": {
|
|
834
|
+
"var": "$timestamp"
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
]
|
|
838
|
+
},
|
|
839
|
+
"dependencies": []
|
|
840
|
+
}
|
|
841
|
+
]
|
|
842
|
+
};
|
|
@@ -9,11 +9,12 @@
|
|
|
9
9
|
* EntityType,
|
|
10
10
|
* EntityState,
|
|
11
11
|
* CorporateEntity,
|
|
12
|
-
* getCorporateDefinition
|
|
12
|
+
* getCorporateDefinition,
|
|
13
|
+
* CORPORATE_DEFINITIONS
|
|
13
14
|
* } from '@ottochain/sdk/apps/corporate';
|
|
14
15
|
*
|
|
15
|
-
* const entityDef = getCorporateDefinition('
|
|
16
|
-
* const boardDef = getCorporateDefinition('
|
|
16
|
+
* const entityDef = getCorporateDefinition('entity');
|
|
17
|
+
* const boardDef = getCorporateDefinition('board');
|
|
17
18
|
* ```
|
|
18
19
|
*
|
|
19
20
|
* @packageDocumentation
|
|
@@ -23,26 +24,19 @@ export { EntityType, EntityState, DirectorStatus, OfficerStatus, BoardMeetingTyp
|
|
|
23
24
|
// ---------------------------------------------------------------------------
|
|
24
25
|
// State Machine Definitions (generated from JSON at build time)
|
|
25
26
|
// ---------------------------------------------------------------------------
|
|
26
|
-
import {
|
|
27
|
+
import { corpEntityDef, corpBoardDef, corpShareholdersDef, corpSecuritiesDef, } from './state-machines/index.js';
|
|
28
|
+
export { corpEntityDef, corpBoardDef, corpShareholdersDef, corpSecuritiesDef, };
|
|
29
|
+
/** All corporate state machine definitions */
|
|
27
30
|
export const CORPORATE_DEFINITIONS = {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
Securities: corporateSecuritiesDef,
|
|
33
|
-
Compliance: corporateComplianceDef,
|
|
34
|
-
Bylaws: corporateBylawsDef,
|
|
35
|
-
Committee: corporateCommitteeDef,
|
|
36
|
-
Proxy: corporateProxyDef,
|
|
37
|
-
Resolution: corporateResolutionDef,
|
|
31
|
+
entity: corpEntityDef,
|
|
32
|
+
board: corpBoardDef,
|
|
33
|
+
shareholders: corpShareholdersDef,
|
|
34
|
+
securities: corpSecuritiesDef,
|
|
38
35
|
};
|
|
39
36
|
/**
|
|
40
|
-
* Get
|
|
37
|
+
* Get a corporate state machine definition by type.
|
|
38
|
+
* @param type - 'entity' | 'board' | 'shareholders' | 'securities'
|
|
41
39
|
*/
|
|
42
40
|
export function getCorporateDefinition(type) {
|
|
43
|
-
|
|
44
|
-
if (!def) {
|
|
45
|
-
throw new Error(`Unknown corporate type: ${type}`);
|
|
46
|
-
}
|
|
47
|
-
return def;
|
|
41
|
+
return CORPORATE_DEFINITIONS[type];
|
|
48
42
|
}
|