@ottochain/sdk 1.4.1 → 1.5.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/ottochain/normalize.js +23 -12
- package/dist/esm/apps/contracts/index.js +10 -28
- package/dist/esm/apps/corporate/index.js +24 -79
- package/dist/esm/apps/governance/index.js +36 -85
- package/dist/esm/apps/identity/constants.js +22 -27
- package/dist/esm/apps/identity/index.js +7 -35
- package/dist/esm/apps/index.js +6 -32
- package/dist/esm/apps/markets/index.js +6 -27
- package/dist/esm/apps/oracles/index.js +7 -27
- package/dist/esm/errors.js +9 -19
- package/dist/esm/generated/google/protobuf/struct.js +33 -39
- package/dist/esm/generated/google/protobuf/timestamp.js +6 -9
- package/dist/esm/generated/index.js +10 -134
- package/dist/esm/generated/ottochain/apps/contracts/v1/contract.js +48 -54
- package/dist/esm/generated/ottochain/apps/corporate/v1/corporate.js +335 -357
- package/dist/esm/generated/ottochain/apps/governance/v1/governance.js +284 -299
- package/dist/esm/generated/ottochain/apps/identity/v1/agent.js +38 -47
- package/dist/esm/generated/ottochain/apps/identity/v1/attestation.js +44 -50
- package/dist/esm/generated/ottochain/apps/markets/v1/market.js +77 -86
- package/dist/esm/generated/ottochain/apps/oracles/v1/oracle.js +66 -72
- package/dist/esm/generated/ottochain/v1/common.js +1 -4
- package/dist/esm/generated/ottochain/v1/fiber.js +90 -96
- package/dist/esm/generated/ottochain/v1/messages.js +79 -82
- package/dist/esm/generated/ottochain/v1/records.js +137 -140
- package/dist/esm/index.js +13 -70
- package/dist/esm/ottochain/drop-nulls.js +1 -5
- package/dist/esm/ottochain/index.js +6 -54
- package/dist/esm/ottochain/metagraph-client.js +12 -16
- package/dist/esm/ottochain/normalize.js +27 -23
- package/dist/esm/ottochain/snapshot.js +10 -20
- package/dist/esm/ottochain/transaction.js +13 -25
- package/dist/esm/ottochain/types.js +1 -2
- package/dist/esm/types.js +2 -7
- package/dist/esm/validation.js +65 -76
- package/dist/esm/verify.js +3 -7
- package/dist/types/ottochain/normalize.d.ts +7 -8
- package/dist/types/ottochain/types.d.ts +3 -1
- package/package.json +7 -7
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Agent Identity Application
|
|
4
3
|
*
|
|
@@ -17,44 +16,18 @@
|
|
|
17
16
|
*
|
|
18
17
|
* @packageDocumentation
|
|
19
18
|
*/
|
|
20
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
21
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
22
|
-
};
|
|
23
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.getIdentityDefinition = exports.DEFAULT_REPUTATION_CONFIG = exports.getReputationDelta = exports.canTransition = exports.ATTESTATION_DELTAS = exports.AGENT_TRANSITIONS = exports.attestationTypeToJSON = exports.attestationTypeFromJSON = exports.ReputationConfig = exports.ChallengeRequest = exports.VouchRequest = exports.Attestation = exports.ReputationDelta = exports.AttestationType = exports.platformToJSON = exports.platformFromJSON = exports.agentStateToJSON = exports.agentStateFromJSON = exports.AgentIdentityDefinition = exports.AgentIdentity = exports.PlatformLink = exports.Platform = exports.AgentState = void 0;
|
|
25
19
|
// Re-export generated protobuf types (source of truth)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
Object.defineProperty(exports, "Platform", { enumerable: true, get: function () { return agent_js_1.Platform; } });
|
|
29
|
-
Object.defineProperty(exports, "PlatformLink", { enumerable: true, get: function () { return agent_js_1.PlatformLink; } });
|
|
30
|
-
Object.defineProperty(exports, "AgentIdentity", { enumerable: true, get: function () { return agent_js_1.AgentIdentity; } });
|
|
31
|
-
Object.defineProperty(exports, "AgentIdentityDefinition", { enumerable: true, get: function () { return agent_js_1.AgentIdentityDefinition; } });
|
|
32
|
-
Object.defineProperty(exports, "agentStateFromJSON", { enumerable: true, get: function () { return agent_js_1.agentStateFromJSON; } });
|
|
33
|
-
Object.defineProperty(exports, "agentStateToJSON", { enumerable: true, get: function () { return agent_js_1.agentStateToJSON; } });
|
|
34
|
-
Object.defineProperty(exports, "platformFromJSON", { enumerable: true, get: function () { return agent_js_1.platformFromJSON; } });
|
|
35
|
-
Object.defineProperty(exports, "platformToJSON", { enumerable: true, get: function () { return agent_js_1.platformToJSON; } });
|
|
36
|
-
var attestation_js_1 = require("../../generated/ottochain/apps/identity/v1/attestation.js");
|
|
37
|
-
Object.defineProperty(exports, "AttestationType", { enumerable: true, get: function () { return attestation_js_1.AttestationType; } });
|
|
38
|
-
Object.defineProperty(exports, "ReputationDelta", { enumerable: true, get: function () { return attestation_js_1.ReputationDelta; } });
|
|
39
|
-
Object.defineProperty(exports, "Attestation", { enumerable: true, get: function () { return attestation_js_1.Attestation; } });
|
|
40
|
-
Object.defineProperty(exports, "VouchRequest", { enumerable: true, get: function () { return attestation_js_1.VouchRequest; } });
|
|
41
|
-
Object.defineProperty(exports, "ChallengeRequest", { enumerable: true, get: function () { return attestation_js_1.ChallengeRequest; } });
|
|
42
|
-
Object.defineProperty(exports, "ReputationConfig", { enumerable: true, get: function () { return attestation_js_1.ReputationConfig; } });
|
|
43
|
-
Object.defineProperty(exports, "attestationTypeFromJSON", { enumerable: true, get: function () { return attestation_js_1.attestationTypeFromJSON; } });
|
|
44
|
-
Object.defineProperty(exports, "attestationTypeToJSON", { enumerable: true, get: function () { return attestation_js_1.attestationTypeToJSON; } });
|
|
20
|
+
export { AgentState, Platform, PlatformLink, AgentIdentity, AgentIdentityDefinition, agentStateFromJSON, agentStateToJSON, platformFromJSON, platformToJSON, } from '../../generated/ottochain/apps/identity/v1/agent.js';
|
|
21
|
+
export { AttestationType, ReputationDelta, Attestation, VouchRequest, ChallengeRequest, ReputationConfig, attestationTypeFromJSON, attestationTypeToJSON, } from '../../generated/ottochain/apps/identity/v1/attestation.js';
|
|
45
22
|
// Re-export constants and utilities
|
|
46
|
-
|
|
47
|
-
Object.defineProperty(exports, "AGENT_TRANSITIONS", { enumerable: true, get: function () { return constants_js_1.AGENT_TRANSITIONS; } });
|
|
48
|
-
Object.defineProperty(exports, "ATTESTATION_DELTAS", { enumerable: true, get: function () { return constants_js_1.ATTESTATION_DELTAS; } });
|
|
49
|
-
Object.defineProperty(exports, "canTransition", { enumerable: true, get: function () { return constants_js_1.canTransition; } });
|
|
50
|
-
Object.defineProperty(exports, "getReputationDelta", { enumerable: true, get: function () { return constants_js_1.getReputationDelta; } });
|
|
23
|
+
export { AGENT_TRANSITIONS, ATTESTATION_DELTAS, canTransition, getReputationDelta, } from './constants.js';
|
|
51
24
|
// ---------------------------------------------------------------------------
|
|
52
25
|
// Configuration Defaults
|
|
53
26
|
// ---------------------------------------------------------------------------
|
|
54
27
|
/**
|
|
55
28
|
* Default reputation configuration for agent identity
|
|
56
29
|
*/
|
|
57
|
-
|
|
30
|
+
export const DEFAULT_REPUTATION_CONFIG = {
|
|
58
31
|
baseReputation: 10,
|
|
59
32
|
completionDelta: 5,
|
|
60
33
|
vouchDelta: 2,
|
|
@@ -66,13 +39,12 @@ exports.DEFAULT_REPUTATION_CONFIG = {
|
|
|
66
39
|
// ---------------------------------------------------------------------------
|
|
67
40
|
// State Machine JSON Definition
|
|
68
41
|
// ---------------------------------------------------------------------------
|
|
69
|
-
|
|
42
|
+
import agentIdentityDef from './state-machines/agent-identity.json';
|
|
70
43
|
/**
|
|
71
44
|
* Get the agent identity state machine definition.
|
|
72
45
|
*
|
|
73
46
|
* @returns The state machine definition JSON for AgentIdentity
|
|
74
47
|
*/
|
|
75
|
-
function getIdentityDefinition() {
|
|
76
|
-
return
|
|
48
|
+
export function getIdentityDefinition() {
|
|
49
|
+
return agentIdentityDef;
|
|
77
50
|
}
|
|
78
|
-
exports.getIdentityDefinition = getIdentityDefinition;
|
package/dist/esm/apps/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* OttoChain Applications
|
|
4
3
|
*
|
|
@@ -24,35 +23,10 @@
|
|
|
24
23
|
*
|
|
25
24
|
* @packageDocumentation
|
|
26
25
|
*/
|
|
27
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
28
|
-
if (k2 === undefined) k2 = k;
|
|
29
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
30
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
31
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
32
|
-
}
|
|
33
|
-
Object.defineProperty(o, k2, desc);
|
|
34
|
-
}) : (function(o, m, k, k2) {
|
|
35
|
-
if (k2 === undefined) k2 = k;
|
|
36
|
-
o[k2] = m[k];
|
|
37
|
-
}));
|
|
38
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
39
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
40
|
-
}) : function(o, v) {
|
|
41
|
-
o["default"] = v;
|
|
42
|
-
});
|
|
43
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
44
|
-
if (mod && mod.__esModule) return mod;
|
|
45
|
-
var result = {};
|
|
46
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
47
|
-
__setModuleDefault(result, mod);
|
|
48
|
-
return result;
|
|
49
|
-
};
|
|
50
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
-
exports.corporate = exports.governance = exports.oracles = exports.markets = exports.contracts = exports.identity = void 0;
|
|
52
26
|
// Re-export as namespaces for organized access
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
27
|
+
export * as identity from './identity/index.js';
|
|
28
|
+
export * as contracts from './contracts/index.js';
|
|
29
|
+
export * as markets from './markets/index.js';
|
|
30
|
+
export * as oracles from './oracles/index.js';
|
|
31
|
+
export * as governance from './governance/index.js';
|
|
32
|
+
export * as corporate from './corporate/index.js';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Markets Application
|
|
4
3
|
*
|
|
@@ -18,38 +17,18 @@
|
|
|
18
17
|
*
|
|
19
18
|
* @packageDocumentation
|
|
20
19
|
*/
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.getMarketDefinition = exports.MARKET_DEFINITIONS = exports.marketStateToJSON = exports.marketStateFromJSON = exports.marketTypeToJSON = exports.marketTypeFromJSON = exports.MarketDefinition = exports.CancelMarketRequest = exports.SubmitResolutionRequest = exports.CommitToMarketRequest = exports.CreateMarketRequest = exports.Market = exports.Resolution = exports.Commitment = exports.MarketState = exports.MarketType = void 0;
|
|
26
20
|
// Re-export generated protobuf types (source of truth)
|
|
27
|
-
|
|
28
|
-
Object.defineProperty(exports, "MarketType", { enumerable: true, get: function () { return market_js_1.MarketType; } });
|
|
29
|
-
Object.defineProperty(exports, "MarketState", { enumerable: true, get: function () { return market_js_1.MarketState; } });
|
|
30
|
-
Object.defineProperty(exports, "Commitment", { enumerable: true, get: function () { return market_js_1.Commitment; } });
|
|
31
|
-
Object.defineProperty(exports, "Resolution", { enumerable: true, get: function () { return market_js_1.Resolution; } });
|
|
32
|
-
Object.defineProperty(exports, "Market", { enumerable: true, get: function () { return market_js_1.Market; } });
|
|
33
|
-
Object.defineProperty(exports, "CreateMarketRequest", { enumerable: true, get: function () { return market_js_1.CreateMarketRequest; } });
|
|
34
|
-
Object.defineProperty(exports, "CommitToMarketRequest", { enumerable: true, get: function () { return market_js_1.CommitToMarketRequest; } });
|
|
35
|
-
Object.defineProperty(exports, "SubmitResolutionRequest", { enumerable: true, get: function () { return market_js_1.SubmitResolutionRequest; } });
|
|
36
|
-
Object.defineProperty(exports, "CancelMarketRequest", { enumerable: true, get: function () { return market_js_1.CancelMarketRequest; } });
|
|
37
|
-
Object.defineProperty(exports, "MarketDefinition", { enumerable: true, get: function () { return market_js_1.MarketDefinition; } });
|
|
38
|
-
Object.defineProperty(exports, "marketTypeFromJSON", { enumerable: true, get: function () { return market_js_1.marketTypeFromJSON; } });
|
|
39
|
-
Object.defineProperty(exports, "marketTypeToJSON", { enumerable: true, get: function () { return market_js_1.marketTypeToJSON; } });
|
|
40
|
-
Object.defineProperty(exports, "marketStateFromJSON", { enumerable: true, get: function () { return market_js_1.marketStateFromJSON; } });
|
|
41
|
-
Object.defineProperty(exports, "marketStateToJSON", { enumerable: true, get: function () { return market_js_1.marketStateToJSON; } });
|
|
21
|
+
export { MarketType, MarketState, Commitment, Resolution, Market, CreateMarketRequest, CommitToMarketRequest, SubmitResolutionRequest, CancelMarketRequest, MarketDefinition, marketTypeFromJSON, marketTypeToJSON, marketStateFromJSON, marketStateToJSON, } from '../../generated/ottochain/apps/markets/v1/market.js';
|
|
42
22
|
// ---------------------------------------------------------------------------
|
|
43
23
|
// State Machine JSON Definitions
|
|
44
24
|
// ---------------------------------------------------------------------------
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
Universal:
|
|
25
|
+
import marketUniversalDef from './state-machines/market-universal.json';
|
|
26
|
+
export const MARKET_DEFINITIONS = {
|
|
27
|
+
Universal: marketUniversalDef,
|
|
48
28
|
};
|
|
49
29
|
/**
|
|
50
30
|
* Get the market state machine definition.
|
|
51
31
|
*/
|
|
52
|
-
function getMarketDefinition(type = 'Universal') {
|
|
53
|
-
return
|
|
32
|
+
export function getMarketDefinition(type = 'Universal') {
|
|
33
|
+
return MARKET_DEFINITIONS[type];
|
|
54
34
|
}
|
|
55
|
-
exports.getMarketDefinition = getMarketDefinition;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Oracles Application
|
|
4
3
|
*
|
|
@@ -18,44 +17,25 @@
|
|
|
18
17
|
*
|
|
19
18
|
* @packageDocumentation
|
|
20
19
|
*/
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.DEFAULT_ORACLE_CONFIG = exports.getOracleDefinition = exports.ORACLE_DEFINITIONS = exports.oracleStateToJSON = exports.oracleStateFromJSON = exports.OracleDefinition = exports.WithdrawOracleRequest = exports.SlashOracleRequest = exports.WithdrawStakeRequest = exports.AddStakeRequest = exports.ActivateOracleRequest = exports.RegisterOracleRequest = exports.Oracle = exports.SlashingEvent = exports.OracleReputation = exports.OracleState = void 0;
|
|
26
20
|
// Re-export generated protobuf types (source of truth)
|
|
27
|
-
|
|
28
|
-
Object.defineProperty(exports, "OracleState", { enumerable: true, get: function () { return oracle_js_1.OracleState; } });
|
|
29
|
-
Object.defineProperty(exports, "OracleReputation", { enumerable: true, get: function () { return oracle_js_1.OracleReputation; } });
|
|
30
|
-
Object.defineProperty(exports, "SlashingEvent", { enumerable: true, get: function () { return oracle_js_1.SlashingEvent; } });
|
|
31
|
-
Object.defineProperty(exports, "Oracle", { enumerable: true, get: function () { return oracle_js_1.Oracle; } });
|
|
32
|
-
Object.defineProperty(exports, "RegisterOracleRequest", { enumerable: true, get: function () { return oracle_js_1.RegisterOracleRequest; } });
|
|
33
|
-
Object.defineProperty(exports, "ActivateOracleRequest", { enumerable: true, get: function () { return oracle_js_1.ActivateOracleRequest; } });
|
|
34
|
-
Object.defineProperty(exports, "AddStakeRequest", { enumerable: true, get: function () { return oracle_js_1.AddStakeRequest; } });
|
|
35
|
-
Object.defineProperty(exports, "WithdrawStakeRequest", { enumerable: true, get: function () { return oracle_js_1.WithdrawStakeRequest; } });
|
|
36
|
-
Object.defineProperty(exports, "SlashOracleRequest", { enumerable: true, get: function () { return oracle_js_1.SlashOracleRequest; } });
|
|
37
|
-
Object.defineProperty(exports, "WithdrawOracleRequest", { enumerable: true, get: function () { return oracle_js_1.WithdrawOracleRequest; } });
|
|
38
|
-
Object.defineProperty(exports, "OracleDefinition", { enumerable: true, get: function () { return oracle_js_1.OracleDefinition; } });
|
|
39
|
-
Object.defineProperty(exports, "oracleStateFromJSON", { enumerable: true, get: function () { return oracle_js_1.oracleStateFromJSON; } });
|
|
40
|
-
Object.defineProperty(exports, "oracleStateToJSON", { enumerable: true, get: function () { return oracle_js_1.oracleStateToJSON; } });
|
|
21
|
+
export { OracleState, OracleReputation, SlashingEvent, Oracle, RegisterOracleRequest, ActivateOracleRequest, AddStakeRequest, WithdrawStakeRequest, SlashOracleRequest, WithdrawOracleRequest, OracleDefinition, oracleStateFromJSON, oracleStateToJSON, } from '../../generated/ottochain/apps/oracles/v1/oracle.js';
|
|
41
22
|
// ---------------------------------------------------------------------------
|
|
42
23
|
// State Machine JSON Definitions
|
|
43
24
|
// ---------------------------------------------------------------------------
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
Oracle:
|
|
25
|
+
import oracleDef from './state-machines/oracle.json';
|
|
26
|
+
export const ORACLE_DEFINITIONS = {
|
|
27
|
+
Oracle: oracleDef,
|
|
47
28
|
};
|
|
48
29
|
/**
|
|
49
30
|
* Get the oracle state machine definition.
|
|
50
31
|
*/
|
|
51
|
-
function getOracleDefinition(type = 'Oracle') {
|
|
52
|
-
return
|
|
32
|
+
export function getOracleDefinition(type = 'Oracle') {
|
|
33
|
+
return ORACLE_DEFINITIONS[type];
|
|
53
34
|
}
|
|
54
|
-
exports.getOracleDefinition = getOracleDefinition;
|
|
55
35
|
/**
|
|
56
36
|
* Default oracle configuration.
|
|
57
37
|
*/
|
|
58
|
-
|
|
38
|
+
export const DEFAULT_ORACLE_CONFIG = {
|
|
59
39
|
minStake: 100,
|
|
60
40
|
baseReputation: 10,
|
|
61
41
|
reputationDecay: 0.95,
|
package/dist/esm/errors.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Custom Error Classes for OttoChain SDK
|
|
4
3
|
*
|
|
@@ -6,12 +5,10 @@
|
|
|
6
5
|
*
|
|
7
6
|
* @packageDocumentation
|
|
8
7
|
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.wrapError = exports.isErrorCode = exports.TransactionError = exports.SigningError = exports.ValidationError = exports.NetworkError = exports.OttoChainError = exports.ErrorCode = void 0;
|
|
11
8
|
/**
|
|
12
9
|
* Error codes for OttoChain SDK errors
|
|
13
10
|
*/
|
|
14
|
-
var ErrorCode;
|
|
11
|
+
export var ErrorCode;
|
|
15
12
|
(function (ErrorCode) {
|
|
16
13
|
/** Unknown or unclassified error */
|
|
17
14
|
ErrorCode["UNKNOWN"] = "UNKNOWN";
|
|
@@ -37,7 +34,7 @@ var ErrorCode;
|
|
|
37
34
|
ErrorCode["TRANSACTION_NOT_FOUND"] = "TRANSACTION_NOT_FOUND";
|
|
38
35
|
/** Invalid transaction format */
|
|
39
36
|
ErrorCode["INVALID_TRANSACTION"] = "INVALID_TRANSACTION";
|
|
40
|
-
})(ErrorCode || (
|
|
37
|
+
})(ErrorCode || (ErrorCode = {}));
|
|
41
38
|
/**
|
|
42
39
|
* Base error class for all OttoChain SDK errors
|
|
43
40
|
*
|
|
@@ -58,7 +55,7 @@ var ErrorCode;
|
|
|
58
55
|
* }
|
|
59
56
|
* ```
|
|
60
57
|
*/
|
|
61
|
-
class OttoChainError extends Error {
|
|
58
|
+
export class OttoChainError extends Error {
|
|
62
59
|
constructor(code, message, cause) {
|
|
63
60
|
super(message);
|
|
64
61
|
this.name = 'OttoChainError';
|
|
@@ -92,7 +89,6 @@ class OttoChainError extends Error {
|
|
|
92
89
|
};
|
|
93
90
|
}
|
|
94
91
|
}
|
|
95
|
-
exports.OttoChainError = OttoChainError;
|
|
96
92
|
/**
|
|
97
93
|
* Error thrown when network operations fail
|
|
98
94
|
*
|
|
@@ -110,7 +106,7 @@ exports.OttoChainError = OttoChainError;
|
|
|
110
106
|
* }
|
|
111
107
|
* ```
|
|
112
108
|
*/
|
|
113
|
-
class NetworkError extends OttoChainError {
|
|
109
|
+
export class NetworkError extends OttoChainError {
|
|
114
110
|
constructor(message, statusCode, responseBody, cause) {
|
|
115
111
|
const code = statusCode === undefined ? ErrorCode.NETWORK_ERROR : ErrorCode.NETWORK_ERROR;
|
|
116
112
|
super(code, message, cause);
|
|
@@ -134,7 +130,6 @@ class NetworkError extends OttoChainError {
|
|
|
134
130
|
};
|
|
135
131
|
}
|
|
136
132
|
}
|
|
137
|
-
exports.NetworkError = NetworkError;
|
|
138
133
|
/**
|
|
139
134
|
* Error thrown when input validation fails
|
|
140
135
|
*
|
|
@@ -152,7 +147,7 @@ exports.NetworkError = NetworkError;
|
|
|
152
147
|
* }
|
|
153
148
|
* ```
|
|
154
149
|
*/
|
|
155
|
-
class ValidationError extends OttoChainError {
|
|
150
|
+
export class ValidationError extends OttoChainError {
|
|
156
151
|
constructor(message, options) {
|
|
157
152
|
super(ErrorCode.VALIDATION_ERROR, message, options?.cause);
|
|
158
153
|
this.name = 'ValidationError';
|
|
@@ -169,7 +164,6 @@ class ValidationError extends OttoChainError {
|
|
|
169
164
|
};
|
|
170
165
|
}
|
|
171
166
|
}
|
|
172
|
-
exports.ValidationError = ValidationError;
|
|
173
167
|
/**
|
|
174
168
|
* Error thrown when cryptographic signing operations fail
|
|
175
169
|
*
|
|
@@ -186,7 +180,7 @@ exports.ValidationError = ValidationError;
|
|
|
186
180
|
* }
|
|
187
181
|
* ```
|
|
188
182
|
*/
|
|
189
|
-
class SigningError extends OttoChainError {
|
|
183
|
+
export class SigningError extends OttoChainError {
|
|
190
184
|
constructor(message, options) {
|
|
191
185
|
super(ErrorCode.SIGNING_ERROR, message, options?.cause);
|
|
192
186
|
this.name = 'SigningError';
|
|
@@ -199,7 +193,6 @@ class SigningError extends OttoChainError {
|
|
|
199
193
|
};
|
|
200
194
|
}
|
|
201
195
|
}
|
|
202
|
-
exports.SigningError = SigningError;
|
|
203
196
|
/**
|
|
204
197
|
* Error thrown when transaction operations fail
|
|
205
198
|
*
|
|
@@ -217,7 +210,7 @@ exports.SigningError = SigningError;
|
|
|
217
210
|
* }
|
|
218
211
|
* ```
|
|
219
212
|
*/
|
|
220
|
-
class TransactionError extends OttoChainError {
|
|
213
|
+
export class TransactionError extends OttoChainError {
|
|
221
214
|
constructor(code, message, options) {
|
|
222
215
|
super(code, message, options?.cause);
|
|
223
216
|
this.name = 'TransactionError';
|
|
@@ -255,7 +248,6 @@ class TransactionError extends OttoChainError {
|
|
|
255
248
|
};
|
|
256
249
|
}
|
|
257
250
|
}
|
|
258
|
-
exports.TransactionError = TransactionError;
|
|
259
251
|
/**
|
|
260
252
|
* Check if an error is an OttoChain error with a specific code
|
|
261
253
|
*
|
|
@@ -270,10 +262,9 @@ exports.TransactionError = TransactionError;
|
|
|
270
262
|
* }
|
|
271
263
|
* ```
|
|
272
264
|
*/
|
|
273
|
-
function isErrorCode(error, code) {
|
|
265
|
+
export function isErrorCode(error, code) {
|
|
274
266
|
return error instanceof OttoChainError && error.code === code;
|
|
275
267
|
}
|
|
276
|
-
exports.isErrorCode = isErrorCode;
|
|
277
268
|
/**
|
|
278
269
|
* Wrap an unknown error in an OttoChainError
|
|
279
270
|
*
|
|
@@ -281,7 +272,7 @@ exports.isErrorCode = isErrorCode;
|
|
|
281
272
|
* @param defaultMessage - Default message if error has no message
|
|
282
273
|
* @returns OttoChainError wrapping the original error
|
|
283
274
|
*/
|
|
284
|
-
function wrapError(error, defaultMessage = 'An error occurred') {
|
|
275
|
+
export function wrapError(error, defaultMessage = 'An error occurred') {
|
|
285
276
|
if (error instanceof OttoChainError) {
|
|
286
277
|
return error;
|
|
287
278
|
}
|
|
@@ -290,4 +281,3 @@ function wrapError(error, defaultMessage = 'An error occurred') {
|
|
|
290
281
|
}
|
|
291
282
|
return new OttoChainError(ErrorCode.UNKNOWN, String(error) || defaultMessage);
|
|
292
283
|
}
|
|
293
|
-
exports.wrapError = wrapError;
|
|
@@ -1,27 +1,24 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
3
2
|
// versions:
|
|
4
3
|
// protoc-gen-ts_proto v2.11.2
|
|
5
4
|
// protoc unknown
|
|
6
5
|
// source: google/protobuf/struct.proto
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.ListValue = exports.Value = exports.Struct_FieldsEntry = exports.Struct = exports.nullValueToNumber = exports.nullValueToJSON = exports.nullValueFromJSON = exports.NullValue = exports.protobufPackage = void 0;
|
|
9
6
|
/* eslint-disable */
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
8
|
+
export const protobufPackage = "google.protobuf";
|
|
12
9
|
/**
|
|
13
10
|
* `NullValue` is a singleton enumeration to represent the null value for the
|
|
14
11
|
* `Value` type union.
|
|
15
12
|
*
|
|
16
13
|
* The JSON representation for `NullValue` is JSON `null`.
|
|
17
14
|
*/
|
|
18
|
-
var NullValue;
|
|
15
|
+
export var NullValue;
|
|
19
16
|
(function (NullValue) {
|
|
20
17
|
/** NULL_VALUE - Null value. */
|
|
21
18
|
NullValue["NULL_VALUE"] = "NULL_VALUE";
|
|
22
19
|
NullValue["UNRECOGNIZED"] = "UNRECOGNIZED";
|
|
23
|
-
})(NullValue || (
|
|
24
|
-
function nullValueFromJSON(object) {
|
|
20
|
+
})(NullValue || (NullValue = {}));
|
|
21
|
+
export function nullValueFromJSON(object) {
|
|
25
22
|
switch (object) {
|
|
26
23
|
case 0:
|
|
27
24
|
case "NULL_VALUE":
|
|
@@ -32,8 +29,7 @@ function nullValueFromJSON(object) {
|
|
|
32
29
|
return NullValue.UNRECOGNIZED;
|
|
33
30
|
}
|
|
34
31
|
}
|
|
35
|
-
|
|
36
|
-
function nullValueToJSON(object) {
|
|
32
|
+
export function nullValueToJSON(object) {
|
|
37
33
|
switch (object) {
|
|
38
34
|
case NullValue.NULL_VALUE:
|
|
39
35
|
return "NULL_VALUE";
|
|
@@ -42,8 +38,7 @@ function nullValueToJSON(object) {
|
|
|
42
38
|
return "UNRECOGNIZED";
|
|
43
39
|
}
|
|
44
40
|
}
|
|
45
|
-
|
|
46
|
-
function nullValueToNumber(object) {
|
|
41
|
+
export function nullValueToNumber(object) {
|
|
47
42
|
switch (object) {
|
|
48
43
|
case NullValue.NULL_VALUE:
|
|
49
44
|
return 0;
|
|
@@ -52,21 +47,20 @@ function nullValueToNumber(object) {
|
|
|
52
47
|
return -1;
|
|
53
48
|
}
|
|
54
49
|
}
|
|
55
|
-
exports.nullValueToNumber = nullValueToNumber;
|
|
56
50
|
function createBaseStruct() {
|
|
57
51
|
return { fields: {} };
|
|
58
52
|
}
|
|
59
|
-
|
|
60
|
-
encode(message, writer = new
|
|
53
|
+
export const Struct = {
|
|
54
|
+
encode(message, writer = new BinaryWriter()) {
|
|
61
55
|
globalThis.Object.entries(message.fields).forEach(([key, value]) => {
|
|
62
56
|
if (value !== undefined) {
|
|
63
|
-
|
|
57
|
+
Struct_FieldsEntry.encode({ key: key, value }, writer.uint32(10).fork()).join();
|
|
64
58
|
}
|
|
65
59
|
});
|
|
66
60
|
return writer;
|
|
67
61
|
},
|
|
68
62
|
decode(input, length) {
|
|
69
|
-
const reader = input instanceof
|
|
63
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
70
64
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
71
65
|
const message = createBaseStruct();
|
|
72
66
|
while (reader.pos < end) {
|
|
@@ -76,7 +70,7 @@ exports.Struct = {
|
|
|
76
70
|
if (tag !== 10) {
|
|
77
71
|
break;
|
|
78
72
|
}
|
|
79
|
-
const entry1 =
|
|
73
|
+
const entry1 = Struct_FieldsEntry.decode(reader, reader.uint32());
|
|
80
74
|
if (entry1.value !== undefined) {
|
|
81
75
|
message.fields[entry1.key] = entry1.value;
|
|
82
76
|
}
|
|
@@ -114,7 +108,7 @@ exports.Struct = {
|
|
|
114
108
|
return obj;
|
|
115
109
|
},
|
|
116
110
|
create(base) {
|
|
117
|
-
return
|
|
111
|
+
return Struct.fromPartial(base ?? {});
|
|
118
112
|
},
|
|
119
113
|
fromPartial(object) {
|
|
120
114
|
const message = createBaseStruct();
|
|
@@ -148,18 +142,18 @@ exports.Struct = {
|
|
|
148
142
|
function createBaseStruct_FieldsEntry() {
|
|
149
143
|
return { key: "", value: undefined };
|
|
150
144
|
}
|
|
151
|
-
|
|
152
|
-
encode(message, writer = new
|
|
145
|
+
export const Struct_FieldsEntry = {
|
|
146
|
+
encode(message, writer = new BinaryWriter()) {
|
|
153
147
|
if (message.key !== "") {
|
|
154
148
|
writer.uint32(10).string(message.key);
|
|
155
149
|
}
|
|
156
150
|
if (message.value !== undefined) {
|
|
157
|
-
|
|
151
|
+
Value.encode(Value.wrap(message.value), writer.uint32(18).fork()).join();
|
|
158
152
|
}
|
|
159
153
|
return writer;
|
|
160
154
|
},
|
|
161
155
|
decode(input, length) {
|
|
162
|
-
const reader = input instanceof
|
|
156
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
163
157
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
164
158
|
const message = createBaseStruct_FieldsEntry();
|
|
165
159
|
while (reader.pos < end) {
|
|
@@ -176,7 +170,7 @@ exports.Struct_FieldsEntry = {
|
|
|
176
170
|
if (tag !== 18) {
|
|
177
171
|
break;
|
|
178
172
|
}
|
|
179
|
-
message.value =
|
|
173
|
+
message.value = Value.unwrap(Value.decode(reader, reader.uint32()));
|
|
180
174
|
continue;
|
|
181
175
|
}
|
|
182
176
|
}
|
|
@@ -204,7 +198,7 @@ exports.Struct_FieldsEntry = {
|
|
|
204
198
|
return obj;
|
|
205
199
|
},
|
|
206
200
|
create(base) {
|
|
207
|
-
return
|
|
201
|
+
return Struct_FieldsEntry.fromPartial(base ?? {});
|
|
208
202
|
},
|
|
209
203
|
fromPartial(object) {
|
|
210
204
|
const message = createBaseStruct_FieldsEntry();
|
|
@@ -216,8 +210,8 @@ exports.Struct_FieldsEntry = {
|
|
|
216
210
|
function createBaseValue() {
|
|
217
211
|
return { kind: undefined };
|
|
218
212
|
}
|
|
219
|
-
|
|
220
|
-
encode(message, writer = new
|
|
213
|
+
export const Value = {
|
|
214
|
+
encode(message, writer = new BinaryWriter()) {
|
|
221
215
|
switch (message.kind?.$case) {
|
|
222
216
|
case "nullValue":
|
|
223
217
|
writer.uint32(8).int32(nullValueToNumber(message.kind.nullValue));
|
|
@@ -232,16 +226,16 @@ exports.Value = {
|
|
|
232
226
|
writer.uint32(32).bool(message.kind.boolValue);
|
|
233
227
|
break;
|
|
234
228
|
case "structValue":
|
|
235
|
-
|
|
229
|
+
Struct.encode(Struct.wrap(message.kind.structValue), writer.uint32(42).fork()).join();
|
|
236
230
|
break;
|
|
237
231
|
case "listValue":
|
|
238
|
-
|
|
232
|
+
ListValue.encode(ListValue.wrap(message.kind.listValue), writer.uint32(50).fork()).join();
|
|
239
233
|
break;
|
|
240
234
|
}
|
|
241
235
|
return writer;
|
|
242
236
|
},
|
|
243
237
|
decode(input, length) {
|
|
244
|
-
const reader = input instanceof
|
|
238
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
245
239
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
246
240
|
const message = createBaseValue();
|
|
247
241
|
while (reader.pos < end) {
|
|
@@ -279,14 +273,14 @@ exports.Value = {
|
|
|
279
273
|
if (tag !== 42) {
|
|
280
274
|
break;
|
|
281
275
|
}
|
|
282
|
-
message.kind = { $case: "structValue", structValue:
|
|
276
|
+
message.kind = { $case: "structValue", structValue: Struct.unwrap(Struct.decode(reader, reader.uint32())) };
|
|
283
277
|
continue;
|
|
284
278
|
}
|
|
285
279
|
case 6: {
|
|
286
280
|
if (tag !== 50) {
|
|
287
281
|
break;
|
|
288
282
|
}
|
|
289
|
-
message.kind = { $case: "listValue", listValue:
|
|
283
|
+
message.kind = { $case: "listValue", listValue: ListValue.unwrap(ListValue.decode(reader, reader.uint32())) };
|
|
290
284
|
continue;
|
|
291
285
|
}
|
|
292
286
|
}
|
|
@@ -349,7 +343,7 @@ exports.Value = {
|
|
|
349
343
|
return obj;
|
|
350
344
|
},
|
|
351
345
|
create(base) {
|
|
352
|
-
return
|
|
346
|
+
return Value.fromPartial(base ?? {});
|
|
353
347
|
},
|
|
354
348
|
fromPartial(object) {
|
|
355
349
|
const message = createBaseValue();
|
|
@@ -445,15 +439,15 @@ exports.Value = {
|
|
|
445
439
|
function createBaseListValue() {
|
|
446
440
|
return { values: [] };
|
|
447
441
|
}
|
|
448
|
-
|
|
449
|
-
encode(message, writer = new
|
|
442
|
+
export const ListValue = {
|
|
443
|
+
encode(message, writer = new BinaryWriter()) {
|
|
450
444
|
for (const v of message.values) {
|
|
451
|
-
|
|
445
|
+
Value.encode(Value.wrap(v), writer.uint32(10).fork()).join();
|
|
452
446
|
}
|
|
453
447
|
return writer;
|
|
454
448
|
},
|
|
455
449
|
decode(input, length) {
|
|
456
|
-
const reader = input instanceof
|
|
450
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
457
451
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
458
452
|
const message = createBaseListValue();
|
|
459
453
|
while (reader.pos < end) {
|
|
@@ -463,7 +457,7 @@ exports.ListValue = {
|
|
|
463
457
|
if (tag !== 10) {
|
|
464
458
|
break;
|
|
465
459
|
}
|
|
466
|
-
message.values.push(
|
|
460
|
+
message.values.push(Value.unwrap(Value.decode(reader, reader.uint32())));
|
|
467
461
|
continue;
|
|
468
462
|
}
|
|
469
463
|
}
|
|
@@ -485,7 +479,7 @@ exports.ListValue = {
|
|
|
485
479
|
return obj;
|
|
486
480
|
},
|
|
487
481
|
create(base) {
|
|
488
|
-
return
|
|
482
|
+
return ListValue.fromPartial(base ?? {});
|
|
489
483
|
},
|
|
490
484
|
fromPartial(object) {
|
|
491
485
|
const message = createBaseListValue();
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
3
2
|
// versions:
|
|
4
3
|
// protoc-gen-ts_proto v2.11.2
|
|
5
4
|
// protoc unknown
|
|
6
5
|
// source: google/protobuf/timestamp.proto
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.Timestamp = exports.protobufPackage = void 0;
|
|
9
6
|
/* eslint-disable */
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
8
|
+
export const protobufPackage = "google.protobuf";
|
|
12
9
|
function createBaseTimestamp() {
|
|
13
10
|
return { seconds: 0, nanos: 0 };
|
|
14
11
|
}
|
|
15
|
-
|
|
16
|
-
encode(message, writer = new
|
|
12
|
+
export const Timestamp = {
|
|
13
|
+
encode(message, writer = new BinaryWriter()) {
|
|
17
14
|
if (message.seconds !== 0) {
|
|
18
15
|
writer.uint32(8).int64(message.seconds);
|
|
19
16
|
}
|
|
@@ -23,7 +20,7 @@ exports.Timestamp = {
|
|
|
23
20
|
return writer;
|
|
24
21
|
},
|
|
25
22
|
decode(input, length) {
|
|
26
|
-
const reader = input instanceof
|
|
23
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
27
24
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
28
25
|
const message = createBaseTimestamp();
|
|
29
26
|
while (reader.pos < end) {
|
|
@@ -68,7 +65,7 @@ exports.Timestamp = {
|
|
|
68
65
|
return obj;
|
|
69
66
|
},
|
|
70
67
|
create(base) {
|
|
71
|
-
return
|
|
68
|
+
return Timestamp.fromPartial(base ?? {});
|
|
72
69
|
},
|
|
73
70
|
fromPartial(object) {
|
|
74
71
|
const message = createBaseTimestamp();
|