hive-stream 3.0.1 → 3.0.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/DOCUMENTATION.md CHANGED
@@ -9,6 +9,8 @@ Hive Stream is a Node.js library for streaming Hive blockchain activity and rout
9
9
 
10
10
  This document focuses on the contract system and how to build robust contracts using the new `defineContract`/`action` API.
11
11
 
12
+ By default, `new Streamer()` registers the SQLite adapter and starts the built-in Express API server on port `5001` when `NODE_ENV !== 'test'`.
13
+
12
14
  ---
13
15
 
14
16
  ## Concepts
@@ -23,7 +25,6 @@ Contracts are registered with the `Streamer` and called when a payload matches `
23
25
 
24
26
  ### Actions
25
27
  An **action** is a handler function plus metadata such as:
26
- - the trigger (`custom_json`, `transfer`, or `time`)
27
28
  - the trigger (`custom_json`, `transfer`, `time`, `escrow_transfer`, `escrow_approve`, `escrow_dispute`, `escrow_release`, or `recurrent_transfer`)
28
29
  - an optional Zod schema to validate payloads
29
30
  - whether it requires an active key signature
@@ -32,6 +33,8 @@ An **action** is a handler function plus metadata such as:
32
33
  Hive Stream extracts payloads from:
33
34
  - **custom_json**: `op[1].json`
34
35
  - **transfer memo**: `op[1].memo`
36
+ - **recurrent transfer memo**: `op[1].memo`
37
+ - **escrow metadata**: `op[1].json_meta`
35
38
 
36
39
  It expects a wrapper object that looks like:
37
40
 
@@ -48,6 +51,19 @@ It expects a wrapper object that looks like:
48
51
 
49
52
  The wrapper key `hive_stream` is the default `PAYLOAD_IDENTIFIER`. You can change it in config.
50
53
 
54
+ Relevant configuration defaults:
55
+
56
+ - `PAYLOAD_IDENTIFIER`: `hive_stream`
57
+ - `JSON_ID`: `hivestream`
58
+ - `HIVE_ENGINE_ID`: `ssc-mainnet-hive`
59
+ - `HIVE_ENGINE_API`: `https://api.hive-engine.com/rpc`
60
+
61
+ ### Event Handlers vs Contracts
62
+ Streamer event handlers (`onTransfer`, `onCustomJson`, `onCustomJsonId`, etc.) and contract actions are different execution paths.
63
+
64
+ - Event handlers fire for matching blockchain operations.
65
+ - Contract actions only run when a valid wrapper exists under `PAYLOAD_IDENTIFIER` and the `contract` + `action` values match a registered contract action.
66
+
51
67
  ---
52
68
 
53
69
  ## Contract API
package/README.md CHANGED
@@ -21,34 +21,55 @@ ss.onCustomJson((op, { sender, isSignedWithActiveKey }, blockNumber, blockId, pr
21
21
  });
22
22
  ```
23
23
 
24
+ `new Streamer()` automatically registers the SQLite adapter and starts the built-in Express API server on port `5001` when `NODE_ENV !== 'test'`.
25
+
26
+ ## Builder/Tooling Metadata
27
+
28
+ For external tooling (like visual builders), Hive Stream now exports a read-only metadata object:
29
+
30
+ ```javascript
31
+ const { HIVE_STREAM_METADATA, getHiveStreamMetadata } = require('hive-stream');
32
+
33
+ console.log(HIVE_STREAM_METADATA.subscriptions);
34
+ console.log(getHiveStreamMetadata().writeOperations);
35
+ ```
36
+
37
+ This metadata is static runtime data (no network calls) and includes config defaults, event callback signatures, write operation signatures, adapter metadata, contract trigger info, and valid `TimeAction` values.
38
+
24
39
  ## Configuration
25
40
 
26
41
  The `Streamer` object can accept an object of configuration values which are all optional. However, some operations like transferring Hive Engine tokens or other operations on the blockchain that are not READ ONLY, will require the active key and/or posting keys supplied as well as a username.
27
42
 
28
- The `BLOCK_CHECK_INTERVAL` value is how often to check for new blocks or in cases of error or falling behind, to poll for new blocks. You should keep this as the default 1000ms value which is one second. This allows you to account for situations where blocks fall behind the main block.
43
+ The `blockCheckInterval` value is how often to check for new blocks or in cases of error or falling behind, to poll for new blocks. You should keep this as the default 1000ms value which is one second. This allows you to account for situations where blocks fall behind the main block.
44
+
45
+ The `blocksBehindWarning` value is a numeric value of the number of blocks your API will fall behind from the master before warning to the console.
29
46
 
30
- The `BLOCKS_BEHIND_WARNING` value is a numeric value of the number of blocks your API will fall behind from the master before warning to the console.
47
+ To resume automatically from stored state, keep `resumeFromState` enabled (default). To force a specific start block, set `resumeFromState` to `false` and supply `lastBlockNumber`.
31
48
 
32
- To resume automatically from stored state, keep `RESUME_FROM_STATE` enabled (default). To force a specific start block, set `RESUME_FROM_STATE` to `false` and supply `LAST_BLOCK_NUMBER`.
49
+ For faster catch-up, `catchUpBatchSize` controls how many blocks are processed per polling cycle, and `catchUpDelayMs` controls the delay between catch-up batches (set to `0` for fastest catch-up).
33
50
 
34
- For faster catch-up, `CATCH_UP_BATCH_SIZE` controls how many blocks are processed per polling cycle, and `CATCH_UP_DELAY_MS` controls the delay between catch-up batches (set to `0` for fastest catch-up).
51
+ The `apiNodes` are the Hive API endpoints used for failover. If you want to enable debug mode, set `debugMode` to `true`. The configuration values and their defaults can be found in `src/config.ts`.
35
52
 
36
- The `API_NODES` are the Hive API endpoints used for failover. If you want to enable debug mode, set `DEBUG_MODE` to `true`. The configuration values and their defaults can be found in `src/config.ts`.
53
+ CamelCase config keys are recommended for readability. Legacy uppercase keys are still supported for backwards compatibility.
37
54
 
38
55
  ```
39
56
  const options = {
40
- ACTIVE_KEY: '',
41
- POSTING_KEY: '',
42
- APP_NAME: 'hive-stream',
43
- USERNAME: '',
44
- LAST_BLOCK_NUMBER: 0,
45
- BLOCK_CHECK_INTERVAL: 1000,
46
- BLOCKS_BEHIND_WARNING: 25,
47
- RESUME_FROM_STATE: true,
48
- CATCH_UP_BATCH_SIZE: 50,
49
- CATCH_UP_DELAY_MS: 0,
50
- API_NODES: ['https://api.hive.blog', 'https://api.openhive.network', 'https://rpc.ausbit.dev'],
51
- DEBUG_MODE: false
57
+ activeKey: '',
58
+ postingKey: '',
59
+ jsonId: 'hivestream',
60
+ hiveEngineApi: 'https://api.hive-engine.com/rpc',
61
+ hiveEngineId: 'ssc-mainnet-hive',
62
+ payloadIdentifier: 'hive_stream',
63
+ appName: 'hive-stream',
64
+ username: '',
65
+ lastBlockNumber: 0,
66
+ blockCheckInterval: 1000,
67
+ blocksBehindWarning: 25,
68
+ resumeFromState: true,
69
+ catchUpBatchSize: 50,
70
+ catchUpDelayMs: 0,
71
+ apiNodes: ['https://api.hive.blog', 'https://api.openhive.network', 'https://rpc.ausbit.dev'],
72
+ debugMode: true
52
73
  }
53
74
 
54
75
  const ss = new Streamer(options);
@@ -58,23 +79,24 @@ The configuration itself can also be overloaded using the `setConfig` method whi
58
79
 
59
80
  ```
60
81
  ss.setConfig({
61
- ACTIVE_KEY: 'newactivekey',
62
- USERNAME: 'newusername'
82
+ activeKey: 'newactivekey',
83
+ username: 'newusername'
63
84
  });
64
85
  ```
65
86
 
66
87
  ## Streamer
67
88
 
68
89
  The following subscription methods are read only methods, they allow you to react to certain Hive and Hive Engine events on the blockchain. You do not need to pass in any keys to use these methods as they're purely read only.
90
+ These event subscriptions and contract actions are separate paths: subscriptions fire for matching operations, while contracts only run when a payload wrapper exists under `PAYLOAD_IDENTIFIER`.
69
91
 
70
92
  **The following actions DO require calling the `start` method first to watch the blockchain**
71
93
 
72
94
  #### Watch for transfers
73
95
 
74
96
  ```javascript
75
- ss.onTransfer((op, blockNumber, blockId, prevBlockId, trxId, blockTime) => {
76
-
77
- })
97
+ ss.onTransfer('myaccount', (op, { sender, amount, asset, memo }, blockNumber, blockId, prevBlockId, trxId, blockTime) => {
98
+ // Fires only when op.to === 'myaccount'
99
+ });
78
100
  ```
79
101
 
80
102
  #### Watch for escrow operations
@@ -107,7 +129,14 @@ ss.onCustomJson((op, { sender, isSignedWithActiveKey }, blockNumber, blockId, pr
107
129
  ```javascript
108
130
  ss.onCustomJsonId((op, { sender, isSignedWithActiveKey }, blockNumber, blockId, prevBlockId, trxId, blockTime) => {
109
131
 
110
- })
132
+ }, 'your-custom-json-id');
133
+ ```
134
+
135
+ #### Watch for Hive Engine custom JSON operations
136
+ ```javascript
137
+ ss.onHiveEngine((contractName, contractAction, contractPayload, sender, op, blockNumber, blockId, prevBlockId, trxId, blockTime) => {
138
+
139
+ });
111
140
  ```
112
141
 
113
142
  #### Watch for post operations
@@ -220,7 +249,8 @@ downvote(votePercentage = '100.0', username, permlink) {
220
249
 
221
250
  ## Contracts
222
251
 
223
- Hive Stream allows you to register contract definitions that execute when a transfer memo or custom JSON operation matches. The payload lives under the `PAYLOAD_IDENTIFIER` (default: `hive_stream`).
252
+ Hive Stream allows you to register contract definitions that execute when a transfer memo or custom JSON operation includes a contract wrapper. The payload lives under the `PAYLOAD_IDENTIFIER` key (default: `hive_stream`).
253
+ Regular event handlers like `onTransfer` and `onCustomJson` still run for matching operations even when no contract wrapper is present.
224
254
 
225
255
  The payload shape is:
226
256
 
package/dist/config.d.ts CHANGED
@@ -16,4 +16,27 @@ export interface ConfigInterface {
16
16
  API_NODES: string[];
17
17
  DEBUG_MODE: boolean;
18
18
  }
19
+ export interface ConfigInput extends Partial<ConfigInterface> {
20
+ activeKey?: ConfigInterface['ACTIVE_KEY'];
21
+ postingKey?: ConfigInterface['POSTING_KEY'];
22
+ jsonId?: ConfigInterface['JSON_ID'];
23
+ hiveEngineApi?: ConfigInterface['HIVE_ENGINE_API'];
24
+ hiveEngineId?: ConfigInterface['HIVE_ENGINE_ID'];
25
+ appName?: ConfigInterface['APP_NAME'];
26
+ username?: ConfigInterface['USERNAME'];
27
+ payloadIdentifier?: ConfigInterface['PAYLOAD_IDENTIFIER'];
28
+ lastBlockNumber?: ConfigInterface['LAST_BLOCK_NUMBER'];
29
+ blockCheckInterval?: ConfigInterface['BLOCK_CHECK_INTERVAL'];
30
+ blocksBehindWarning?: ConfigInterface['BLOCKS_BEHIND_WARNING'];
31
+ resumeFromState?: ConfigInterface['RESUME_FROM_STATE'];
32
+ catchUpBatchSize?: ConfigInterface['CATCH_UP_BATCH_SIZE'];
33
+ catchUpDelayMs?: ConfigInterface['CATCH_UP_DELAY_MS'];
34
+ apiNodes?: ConfigInterface['API_NODES'];
35
+ debugMode?: ConfigInterface['DEBUG_MODE'];
36
+ }
37
+ type ConfigAliasKey = keyof Omit<ConfigInput, keyof ConfigInterface>;
38
+ export declare const CONFIG_KEY_ALIASES: Record<ConfigAliasKey, keyof ConfigInterface>;
19
39
  export declare const Config: ConfigInterface;
40
+ export declare function normalizeConfigInput(config?: ConfigInput): Partial<ConfigInterface>;
41
+ export declare function createConfig(config?: ConfigInput): ConfigInterface;
42
+ export {};
package/dist/config.js CHANGED
@@ -1,6 +1,44 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Config = void 0;
3
+ exports.Config = exports.CONFIG_KEY_ALIASES = void 0;
4
+ exports.normalizeConfigInput = normalizeConfigInput;
5
+ exports.createConfig = createConfig;
6
+ const CONFIG_KEYS = [
7
+ 'ACTIVE_KEY',
8
+ 'POSTING_KEY',
9
+ 'JSON_ID',
10
+ 'HIVE_ENGINE_API',
11
+ 'HIVE_ENGINE_ID',
12
+ 'APP_NAME',
13
+ 'USERNAME',
14
+ 'PAYLOAD_IDENTIFIER',
15
+ 'LAST_BLOCK_NUMBER',
16
+ 'BLOCK_CHECK_INTERVAL',
17
+ 'BLOCKS_BEHIND_WARNING',
18
+ 'RESUME_FROM_STATE',
19
+ 'CATCH_UP_BATCH_SIZE',
20
+ 'CATCH_UP_DELAY_MS',
21
+ 'API_NODES',
22
+ 'DEBUG_MODE',
23
+ ];
24
+ exports.CONFIG_KEY_ALIASES = {
25
+ activeKey: 'ACTIVE_KEY',
26
+ postingKey: 'POSTING_KEY',
27
+ jsonId: 'JSON_ID',
28
+ hiveEngineApi: 'HIVE_ENGINE_API',
29
+ hiveEngineId: 'HIVE_ENGINE_ID',
30
+ appName: 'APP_NAME',
31
+ username: 'USERNAME',
32
+ payloadIdentifier: 'PAYLOAD_IDENTIFIER',
33
+ lastBlockNumber: 'LAST_BLOCK_NUMBER',
34
+ blockCheckInterval: 'BLOCK_CHECK_INTERVAL',
35
+ blocksBehindWarning: 'BLOCKS_BEHIND_WARNING',
36
+ resumeFromState: 'RESUME_FROM_STATE',
37
+ catchUpBatchSize: 'CATCH_UP_BATCH_SIZE',
38
+ catchUpDelayMs: 'CATCH_UP_DELAY_MS',
39
+ apiNodes: 'API_NODES',
40
+ debugMode: 'DEBUG_MODE',
41
+ };
4
42
  exports.Config = {
5
43
  ACTIVE_KEY: process.env.ACTIVE_KEY,
6
44
  POSTING_KEY: process.env.POSTING_KEY,
@@ -19,4 +57,35 @@ exports.Config = {
19
57
  API_NODES: ['https://api.hive.blog', 'https://api.openhive.network', 'https://rpc.ausbit.dev'],
20
58
  DEBUG_MODE: true,
21
59
  };
60
+ function normalizeConfigInput(config = {}) {
61
+ const normalized = {};
62
+ const normalizedRecord = normalized;
63
+ const canonicalConfig = config;
64
+ for (const key of CONFIG_KEYS) {
65
+ const value = canonicalConfig[key];
66
+ if (value !== undefined) {
67
+ normalizedRecord[key] = value;
68
+ }
69
+ }
70
+ const aliasEntries = Object.entries(exports.CONFIG_KEY_ALIASES);
71
+ for (const [aliasKey, canonicalKey] of aliasEntries) {
72
+ if (normalized[canonicalKey] !== undefined) {
73
+ continue;
74
+ }
75
+ const aliasValue = config[aliasKey];
76
+ if (aliasValue !== undefined) {
77
+ normalizedRecord[canonicalKey] = aliasValue;
78
+ }
79
+ }
80
+ return normalized;
81
+ }
82
+ function createConfig(config = {}) {
83
+ const normalized = normalizeConfigInput(config);
84
+ const apiNodes = Array.isArray(normalized.API_NODES) ? [...normalized.API_NODES] : [...exports.Config.API_NODES];
85
+ return {
86
+ ...exports.Config,
87
+ ...normalized,
88
+ API_NODES: apiNodes,
89
+ };
90
+ }
22
91
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;AAmBa,QAAA,MAAM,GAAoB;IACnC,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU;IAClC,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW;IAEpC,OAAO,EAAE,YAAY;IAErB,eAAe,EAAE,iCAAiC;IAClD,cAAc,EAAE,kBAAkB;IAElC,QAAQ,EAAE,aAAa;IAEvB,kBAAkB,EAAE,aAAa;IAEjC,QAAQ,EAAE,EAAE;IAEZ,iBAAiB,EAAE,CAA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,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAChD,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,cAAM,CAAC,SAAS,CAAC,CAAC;IAEzG,OAAO;QACH,GAAG,cAAM;QACT,GAAG,UAAU;QACb,SAAS,EAAE,QAAQ;KACtB,CAAC;AACN,CAAC"}
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export * from './config';
2
2
  export * from './streamer';
3
3
  export * from './utils';
4
4
  export * from './actions';
5
+ export * from './metadata';
5
6
  export * from './contracts/contract';
6
7
  export * from './adapters/base.adapter';
7
8
  export * from './adapters/sqlite.adapter';
package/dist/index.js CHANGED
@@ -19,6 +19,7 @@ __exportStar(require("./config"), exports);
19
19
  __exportStar(require("./streamer"), exports);
20
20
  __exportStar(require("./utils"), exports);
21
21
  __exportStar(require("./actions"), exports);
22
+ __exportStar(require("./metadata"), exports);
22
23
  __exportStar(require("./contracts/contract"), exports);
23
24
  __exportStar(require("./adapters/base.adapter"), exports);
24
25
  __exportStar(require("./adapters/sqlite.adapter"), exports);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,6CAA2B;AAC3B,0CAAwB;AACxB,4CAA0B;AAC1B,uDAAqC;AAErC,0DAAwC;AACxC,4DAA0C;AAC1C,6DAA2C;AAC3C,gEAA8C;AAE9C,2DAA+D;AAAtD,mHAAA,kBAAkB,OAAA;AAC3B,6DAAiE;AAAxD,qHAAA,mBAAmB,OAAA;AAC5B,mEAAuE;AAA9D,2HAAA,sBAAsB,OAAA;AAC/B,6DAAiE;AAAxD,qHAAA,mBAAmB,OAAA;AAC5B,yDAA0E;AAAjE,iHAAA,iBAAiB,OAAA;AAAE,2GAAA,WAAW,OAAA;AACvC,yDAA6D;AAApD,iHAAA,iBAAiB,OAAA;AAC1B,2DAA+D;AAAtD,mHAAA,kBAAkB,OAAA;AAC3B,+DAAmE;AAA1D,uHAAA,oBAAoB,OAAA;AAC7B,mEAAuE;AAA9D,2HAAA,sBAAsB,OAAA;AAE/B,QAAQ;AACR,sDAAoC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,6CAA2B;AAC3B,0CAAwB;AACxB,4CAA0B;AAC1B,6CAA2B;AAC3B,uDAAqC;AAErC,0DAAwC;AACxC,4DAA0C;AAC1C,6DAA2C;AAC3C,gEAA8C;AAE9C,2DAA+D;AAAtD,mHAAA,kBAAkB,OAAA;AAC3B,6DAAiE;AAAxD,qHAAA,mBAAmB,OAAA;AAC5B,mEAAuE;AAA9D,2HAAA,sBAAsB,OAAA;AAC/B,6DAAiE;AAAxD,qHAAA,mBAAmB,OAAA;AAC5B,yDAA0E;AAAjE,iHAAA,iBAAiB,OAAA;AAAE,2GAAA,WAAW,OAAA;AACvC,yDAA6D;AAApD,iHAAA,iBAAiB,OAAA;AAC1B,2DAA+D;AAAtD,mHAAA,kBAAkB,OAAA;AAC3B,+DAAmE;AAA1D,uHAAA,oBAAoB,OAAA;AAC7B,mEAAuE;AAA9D,2HAAA,sBAAsB,OAAA;AAE/B,QAAQ;AACR,sDAAoC"}
@@ -0,0 +1,63 @@
1
+ import { ConfigInput, ConfigInterface } from './config';
2
+ import type { ContractTrigger } from './types/hive-stream';
3
+ export type MetadataPrimitive = string | number | boolean | null;
4
+ export interface ConfigOptionMetadata {
5
+ key: keyof ConfigInterface;
6
+ builderKey?: keyof ConfigInput;
7
+ type: 'string' | 'number' | 'boolean' | 'string[]';
8
+ defaultValue: MetadataPrimitive | string[];
9
+ description: string;
10
+ envVar?: string;
11
+ }
12
+ export interface EventHandlerMetadata {
13
+ method: string;
14
+ signature: string;
15
+ callbackSignature: string;
16
+ description: string;
17
+ requiresStart: boolean;
18
+ accountFilterBuiltIn?: boolean;
19
+ idFilterBuiltIn?: boolean;
20
+ }
21
+ export interface WriteOperationMetadata {
22
+ method: string;
23
+ signature: string;
24
+ description: string;
25
+ requiresActiveKey: boolean;
26
+ requiresStart: boolean;
27
+ }
28
+ export interface AdapterMetadata {
29
+ name: string;
30
+ exportName: string;
31
+ constructorSignature: string;
32
+ description: string;
33
+ }
34
+ export interface ContractPayloadMetadata {
35
+ jsonIdDefault: string;
36
+ payloadIdentifierDefault: string;
37
+ shape: {
38
+ contract: string;
39
+ action: string;
40
+ payload: string;
41
+ meta: string;
42
+ };
43
+ supportedTriggers: ContractTrigger[];
44
+ supportedOperations: string[];
45
+ }
46
+ export interface HiveStreamMetadata {
47
+ schemaVersion: number;
48
+ config: {
49
+ options: ConfigOptionMetadata[];
50
+ };
51
+ subscriptions: EventHandlerMetadata[];
52
+ writeOperations: WriteOperationMetadata[];
53
+ contracts: {
54
+ payload: ContractPayloadMetadata;
55
+ helperExports: string[];
56
+ };
57
+ timeAction: {
58
+ validValues: string[];
59
+ };
60
+ adapters: AdapterMetadata[];
61
+ }
62
+ export declare const HIVE_STREAM_METADATA: Readonly<HiveStreamMetadata>;
63
+ export declare function getHiveStreamMetadata(): Readonly<HiveStreamMetadata>;