@ottochain/sdk 1.7.0-beta.1 → 1.7.0-beta.2
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/identity/constants.js +28 -14
- package/dist/cjs/apps/identity/index.js +40 -17
- package/dist/cjs/generated/google/protobuf/struct.js +1 -1
- package/dist/cjs/generated/google/protobuf/timestamp.js +1 -1
- package/dist/cjs/generated/index.js +19 -22
- package/dist/cjs/generated/ottochain/apps/contracts/v1/contract.js +1 -1
- package/dist/cjs/generated/ottochain/apps/corporate/v1/corporate.js +1 -1
- package/dist/cjs/generated/ottochain/apps/governance/v1/governance.js +1 -1
- package/dist/cjs/generated/ottochain/apps/identity/v1/attestation.js +12 -12
- package/dist/cjs/generated/ottochain/apps/identity/v1/identity.js +1689 -0
- package/dist/cjs/generated/ottochain/apps/markets/v1/market.js +1 -1
- package/dist/cjs/generated/ottochain/v1/common.js +1 -1
- package/dist/cjs/generated/ottochain/v1/fiber.js +1 -1
- package/dist/cjs/generated/ottochain/v1/messages.js +1 -1
- package/dist/cjs/generated/ottochain/v1/records.js +1 -1
- package/dist/esm/apps/identity/constants.js +27 -13
- package/dist/esm/apps/identity/index.js +19 -8
- package/dist/esm/generated/google/protobuf/struct.js +1 -1
- package/dist/esm/generated/google/protobuf/timestamp.js +1 -1
- package/dist/esm/generated/index.js +2 -3
- package/dist/esm/generated/ottochain/apps/contracts/v1/contract.js +1 -1
- package/dist/esm/generated/ottochain/apps/corporate/v1/corporate.js +1 -1
- package/dist/esm/generated/ottochain/apps/governance/v1/governance.js +1 -1
- package/dist/esm/generated/ottochain/apps/identity/v1/attestation.js +2 -2
- package/dist/esm/generated/ottochain/apps/identity/v1/identity.js +1677 -0
- package/dist/esm/generated/ottochain/apps/markets/v1/market.js +1 -1
- package/dist/esm/generated/ottochain/v1/common.js +1 -1
- package/dist/esm/generated/ottochain/v1/fiber.js +1 -1
- package/dist/esm/generated/ottochain/v1/messages.js +1 -1
- package/dist/esm/generated/ottochain/v1/records.js +1 -1
- package/dist/types/apps/identity/constants.d.ts +10 -5
- package/dist/types/apps/identity/index.d.ts +21 -10
- package/dist/types/generated/index.d.ts +1 -2
- package/dist/types/generated/ottochain/apps/identity/v1/attestation.d.ts +1 -1
- package/dist/types/generated/ottochain/apps/identity/v1/identity.d.ts +208 -0
- package/package.json +1 -1
- package/dist/cjs/generated/ottochain/apps/identity/v1/agent.js +0 -619
- package/dist/cjs/generated/ottochain/apps/oracles/v1/oracle.js +0 -1223
- package/dist/esm/generated/ottochain/apps/identity/v1/agent.js +0 -610
- package/dist/esm/generated/ottochain/apps/oracles/v1/oracle.js +0 -1217
- package/dist/types/generated/ottochain/apps/identity/v1/agent.d.ts +0 -94
- package/dist/types/generated/ottochain/apps/oracles/v1/oracle.d.ts +0 -150
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
3
3
|
// versions:
|
|
4
|
-
// protoc-gen-ts_proto v2.11.
|
|
4
|
+
// protoc-gen-ts_proto v2.11.5
|
|
5
5
|
// protoc unknown
|
|
6
6
|
// source: ottochain/apps/markets/v1/market.proto
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
3
3
|
// versions:
|
|
4
|
-
// protoc-gen-ts_proto v2.11.
|
|
4
|
+
// protoc-gen-ts_proto v2.11.5
|
|
5
5
|
// protoc unknown
|
|
6
6
|
// source: ottochain/v1/common.proto
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
3
3
|
// versions:
|
|
4
|
-
// protoc-gen-ts_proto v2.11.
|
|
4
|
+
// protoc-gen-ts_proto v2.11.5
|
|
5
5
|
// protoc unknown
|
|
6
6
|
// source: ottochain/v1/fiber.proto
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
3
3
|
// versions:
|
|
4
|
-
// protoc-gen-ts_proto v2.11.
|
|
4
|
+
// protoc-gen-ts_proto v2.11.5
|
|
5
5
|
// protoc unknown
|
|
6
6
|
// source: ottochain/v1/messages.proto
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
3
3
|
// versions:
|
|
4
|
-
// protoc-gen-ts_proto v2.11.
|
|
4
|
+
// protoc-gen-ts_proto v2.11.5
|
|
5
5
|
// protoc unknown
|
|
6
6
|
// source: ottochain/v1/records.proto
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,29 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Identity Constants
|
|
3
3
|
*
|
|
4
|
-
* State machine transitions and configuration constants for
|
|
4
|
+
* State machine transitions and configuration constants for identities.
|
|
5
5
|
*
|
|
6
6
|
* @packageDocumentation
|
|
7
7
|
*/
|
|
8
|
-
import {
|
|
8
|
+
import { IdentityState, IdentityType } from '../../generated/ottochain/apps/identity/v1/identity.js';
|
|
9
9
|
import { AttestationType } from '../../generated/ottochain/apps/identity/v1/attestation.js';
|
|
10
10
|
// ---------------------------------------------------------------------------
|
|
11
11
|
// State Machine Transitions
|
|
12
12
|
// ---------------------------------------------------------------------------
|
|
13
13
|
/**
|
|
14
|
-
* Valid transitions for each
|
|
14
|
+
* Valid transitions for each identity state.
|
|
15
15
|
* Maps current state to allowed event names.
|
|
16
16
|
*/
|
|
17
|
-
export const
|
|
18
|
-
[
|
|
19
|
-
[
|
|
20
|
-
[
|
|
21
|
-
[
|
|
22
|
-
[
|
|
23
|
-
[
|
|
24
|
-
[
|
|
25
|
-
[
|
|
17
|
+
export const IDENTITY_TRANSITIONS = {
|
|
18
|
+
[IdentityState.IDENTITY_STATE_UNSPECIFIED]: [],
|
|
19
|
+
[IdentityState.IDENTITY_STATE_UNREGISTERED]: ['register'],
|
|
20
|
+
[IdentityState.IDENTITY_STATE_REGISTERED]: ['activate', 'withdraw'],
|
|
21
|
+
[IdentityState.IDENTITY_STATE_ACTIVE]: ['challenge', 'deactivate', 'withdraw', 'penalize'],
|
|
22
|
+
[IdentityState.IDENTITY_STATE_INACTIVE]: ['activate', 'withdraw'],
|
|
23
|
+
[IdentityState.IDENTITY_STATE_CHALLENGED]: ['uphold_challenge', 'dismiss_challenge'],
|
|
24
|
+
[IdentityState.IDENTITY_STATE_SUSPENDED]: ['begin_probation', 'withdraw'],
|
|
25
|
+
[IdentityState.IDENTITY_STATE_PROBATION]: ['complete_probation'],
|
|
26
|
+
[IdentityState.IDENTITY_STATE_WITHDRAWN]: [], // Terminal state
|
|
27
|
+
[IdentityState.UNRECOGNIZED]: [],
|
|
26
28
|
};
|
|
29
|
+
// Legacy alias for backward compatibility
|
|
30
|
+
export const AGENT_TRANSITIONS = IDENTITY_TRANSITIONS;
|
|
27
31
|
// ---------------------------------------------------------------------------
|
|
28
32
|
// Reputation Configuration
|
|
29
33
|
// ---------------------------------------------------------------------------
|
|
@@ -43,7 +47,7 @@ export const ATTESTATION_DELTAS = {
|
|
|
43
47
|
* Check if a transition is valid for the given state.
|
|
44
48
|
*/
|
|
45
49
|
export function canTransition(state, event) {
|
|
46
|
-
return
|
|
50
|
+
return IDENTITY_TRANSITIONS[state]?.includes(event) ?? false;
|
|
47
51
|
}
|
|
48
52
|
/**
|
|
49
53
|
* Get reputation delta for an attestation type.
|
|
@@ -51,3 +55,13 @@ export function canTransition(state, event) {
|
|
|
51
55
|
export function getReputationDelta(type) {
|
|
52
56
|
return ATTESTATION_DELTAS[type] ?? 0;
|
|
53
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Identity type display names
|
|
60
|
+
*/
|
|
61
|
+
export const IDENTITY_TYPE_NAMES = {
|
|
62
|
+
[IdentityType.IDENTITY_TYPE_UNSPECIFIED]: 'Unknown',
|
|
63
|
+
[IdentityType.IDENTITY_TYPE_AGENT]: 'Agent',
|
|
64
|
+
[IdentityType.IDENTITY_TYPE_ORACLE]: 'Oracle',
|
|
65
|
+
[IdentityType.IDENTITY_TYPE_SERVICE]: 'Service',
|
|
66
|
+
[IdentityType.UNRECOGNIZED]: 'Unknown',
|
|
67
|
+
};
|
|
@@ -1,31 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Identity Application
|
|
3
3
|
*
|
|
4
|
-
* Types and utilities for the
|
|
4
|
+
* Types and utilities for the Identity system on OttoChain.
|
|
5
|
+
* Includes agents, oracles, and services.
|
|
5
6
|
*
|
|
6
7
|
* @example
|
|
7
8
|
* ```typescript
|
|
8
9
|
* import {
|
|
9
|
-
*
|
|
10
|
-
*
|
|
10
|
+
* IdentityState,
|
|
11
|
+
* IdentityType,
|
|
11
12
|
* getIdentityDefinition
|
|
12
13
|
* } from '@ottochain/sdk/apps/identity';
|
|
13
14
|
*
|
|
14
|
-
* const
|
|
15
|
+
* const oracleDef = getIdentityDefinition('oracle');
|
|
15
16
|
* ```
|
|
16
17
|
*
|
|
17
18
|
* @packageDocumentation
|
|
18
19
|
*/
|
|
19
20
|
// Re-export generated protobuf types (source of truth)
|
|
20
|
-
export {
|
|
21
|
+
export { IdentityType, IdentityState, Platform, PlatformLink, Reputation, PenaltyEvent, Identity, RegisterIdentityRequest, ActivateIdentityRequest, UpdateStakeRequest, ChallengeIdentityRequest, PenalizeIdentityRequest, WithdrawIdentityRequest, IdentityDefinition, identityTypeFromJSON, identityTypeToJSON, identityStateFromJSON, identityStateToJSON, platformFromJSON, platformToJSON, } from '../../generated/ottochain/apps/identity/v1/identity.js';
|
|
21
22
|
export { AttestationType, ReputationDelta, Attestation, VouchRequest, ChallengeRequest, ReputationConfig, attestationTypeFromJSON, attestationTypeToJSON, } from '../../generated/ottochain/apps/identity/v1/attestation.js';
|
|
22
23
|
// Re-export constants and utilities
|
|
23
|
-
export {
|
|
24
|
+
export { IDENTITY_TRANSITIONS, AGENT_TRANSITIONS, // Legacy alias
|
|
25
|
+
ATTESTATION_DELTAS, IDENTITY_TYPE_NAMES, canTransition, getReputationDelta, } from './constants.js';
|
|
24
26
|
// ---------------------------------------------------------------------------
|
|
25
27
|
// Configuration Defaults
|
|
26
28
|
// ---------------------------------------------------------------------------
|
|
27
29
|
/**
|
|
28
|
-
* Default reputation configuration for
|
|
30
|
+
* Default reputation configuration for identities
|
|
29
31
|
*/
|
|
30
32
|
export const DEFAULT_REPUTATION_CONFIG = {
|
|
31
33
|
baseReputation: 10,
|
|
@@ -36,6 +38,15 @@ export const DEFAULT_REPUTATION_CONFIG = {
|
|
|
36
38
|
minReputation: 0,
|
|
37
39
|
challengeThreshold: 5,
|
|
38
40
|
};
|
|
41
|
+
/**
|
|
42
|
+
* Default oracle configuration
|
|
43
|
+
*/
|
|
44
|
+
export const DEFAULT_ORACLE_CONFIG = {
|
|
45
|
+
minStake: 100,
|
|
46
|
+
slashCooldownEpochs: 7,
|
|
47
|
+
accuracyThreshold: 70,
|
|
48
|
+
maxDisputeRate: 30,
|
|
49
|
+
};
|
|
39
50
|
// ---------------------------------------------------------------------------
|
|
40
51
|
// State Machine Definitions (generated from JSON at build time)
|
|
41
52
|
// ---------------------------------------------------------------------------
|
|
@@ -22,14 +22,13 @@ export { FiberStatus, AccessControlPolicy, PublicAccess, WhitelistAccess, FiberO
|
|
|
22
22
|
export { CreateStateMachine, TransitionStateMachine, ArchiveStateMachine, CreateScript, InvokeScript, OttochainMessage, } from './ottochain/v1/messages.js';
|
|
23
23
|
export { StateMachineFiberRecord, ScriptFiberRecord, FiberCommit, OnChainState, CalculatedState, } from './ottochain/v1/records.js';
|
|
24
24
|
// App: Identity
|
|
25
|
-
export {
|
|
25
|
+
export { IdentityType, IdentityState, Platform, PlatformLink, Reputation, PenaltyEvent, Identity, RegisterIdentityRequest, ActivateIdentityRequest, UpdateStakeRequest, ChallengeIdentityRequest, PenalizeIdentityRequest, WithdrawIdentityRequest, IdentityDefinition, } from './ottochain/apps/identity/v1/identity.js';
|
|
26
26
|
export { AttestationType, ReputationDelta, Attestation, VouchRequest, ChallengeRequest, ReputationConfig, } from './ottochain/apps/identity/v1/attestation.js';
|
|
27
27
|
// App: Contracts
|
|
28
28
|
export { ContractState, Contract, ProposeContractRequest, AcceptContractRequest, CompleteContractRequest, RejectContractRequest, DisputeContractRequest, ContractDefinition, } from './ottochain/apps/contracts/v1/contract.js';
|
|
29
29
|
// App: Markets
|
|
30
30
|
export { MarketType, MarketState, Commitment, Resolution, Market, CreateMarketRequest, CommitToMarketRequest, SubmitResolutionRequest, CancelMarketRequest, MarketDefinition, } from './ottochain/apps/markets/v1/market.js';
|
|
31
|
-
//
|
|
32
|
-
export { OracleState, OracleReputation, SlashingEvent, Oracle, RegisterOracleRequest, ActivateOracleRequest, AddStakeRequest, WithdrawStakeRequest, SlashOracleRequest, WithdrawOracleRequest, OracleDefinition, } from './ottochain/apps/oracles/v1/oracle.js';
|
|
31
|
+
// Note: Oracle types merged into Identity (IdentityType.ORACLE)
|
|
33
32
|
// App: Governance
|
|
34
33
|
export { DAOType, DAOStatus, ProposalStatus, VoteChoice, DAOMetadata, Proposal, Vote, VoteTally, SingleOwnerDAO, SingleOwnerAction, OwnershipTransfer, MultisigDAO, MultisigAction, TokenDAO, TokenProposalResult, ThresholdDAO, ThresholdVotes, ThresholdHistoryEntry, CreateDAORequest, ProposeRequest, VoteRequest, ExecuteRequest, } from './ottochain/apps/governance/v1/governance.js';
|
|
35
34
|
// App: Corporate
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
2
|
// versions:
|
|
3
|
-
// protoc-gen-ts_proto v2.11.
|
|
3
|
+
// protoc-gen-ts_proto v2.11.5
|
|
4
4
|
// protoc unknown
|
|
5
5
|
// source: ottochain/apps/identity/v1/attestation.proto
|
|
6
6
|
/* eslint-disable */
|
|
7
7
|
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
8
8
|
import { Timestamp } from "../../../../google/protobuf/timestamp.js";
|
|
9
|
-
import { Platform, platformFromJSON, platformToJSON, platformToNumber } from "./
|
|
9
|
+
import { Platform, platformFromJSON, platformToJSON, platformToNumber } from "./identity.js";
|
|
10
10
|
export const protobufPackage = "ottochain.apps.identity.v1";
|
|
11
11
|
/** Types of attestations that affect reputation */
|
|
12
12
|
export var AttestationType;
|