hive-stream 3.0.2 → 3.0.4

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.
Files changed (202) hide show
  1. package/DOCUMENTATION.md +50 -2
  2. package/README.md +282 -4
  3. package/dist/adapters/base.adapter.d.ts +5 -0
  4. package/dist/adapters/base.adapter.js +9 -0
  5. package/dist/adapters/base.adapter.js.map +1 -1
  6. package/dist/adapters/mongodb.adapter.d.ts +6 -6
  7. package/dist/adapters/mongodb.adapter.js +36 -21
  8. package/dist/adapters/mongodb.adapter.js.map +1 -1
  9. package/dist/adapters/postgresql.adapter.d.ts +7 -0
  10. package/dist/adapters/postgresql.adapter.js +46 -19
  11. package/dist/adapters/postgresql.adapter.js.map +1 -1
  12. package/dist/adapters/sqlite.adapter.d.ts +4 -0
  13. package/dist/adapters/sqlite.adapter.js +10 -0
  14. package/dist/adapters/sqlite.adapter.js.map +1 -1
  15. package/dist/api.d.ts +13 -3
  16. package/dist/api.js +96 -62
  17. package/dist/api.js.map +1 -1
  18. package/dist/builders.d.ts +176 -0
  19. package/dist/builders.js +727 -0
  20. package/dist/builders.js.map +1 -0
  21. package/dist/config.d.ts +16 -1
  22. package/dist/config.js +95 -3
  23. package/dist/config.js.map +1 -1
  24. package/dist/contracts/auctionhouse.contract.d.ts +4 -0
  25. package/dist/contracts/auctionhouse.contract.js +234 -0
  26. package/dist/contracts/auctionhouse.contract.js.map +1 -0
  27. package/dist/contracts/booking.contract.d.ts +4 -0
  28. package/dist/contracts/booking.contract.js +225 -0
  29. package/dist/contracts/booking.contract.js.map +1 -0
  30. package/dist/contracts/bountyboard.contract.d.ts +4 -0
  31. package/dist/contracts/bountyboard.contract.js +233 -0
  32. package/dist/contracts/bountyboard.contract.js.map +1 -0
  33. package/dist/contracts/bundlemarketplace.contract.d.ts +4 -0
  34. package/dist/contracts/bundlemarketplace.contract.js +195 -0
  35. package/dist/contracts/bundlemarketplace.contract.js.map +1 -0
  36. package/dist/contracts/charitymatch.contract.d.ts +4 -0
  37. package/dist/contracts/charitymatch.contract.js +172 -0
  38. package/dist/contracts/charitymatch.contract.js.map +1 -0
  39. package/dist/contracts/coinflip.contract.js +25 -22
  40. package/dist/contracts/coinflip.contract.js.map +1 -1
  41. package/dist/contracts/crowdfund.contract.d.ts +4 -0
  42. package/dist/contracts/crowdfund.contract.js +290 -0
  43. package/dist/contracts/crowdfund.contract.js.map +1 -0
  44. package/dist/contracts/dcabot.contract.d.ts +4 -0
  45. package/dist/contracts/dcabot.contract.js +217 -0
  46. package/dist/contracts/dcabot.contract.js.map +1 -0
  47. package/dist/contracts/dice.contract.js +25 -22
  48. package/dist/contracts/dice.contract.js.map +1 -1
  49. package/dist/contracts/domainregistry.contract.d.ts +4 -0
  50. package/dist/contracts/domainregistry.contract.js +232 -0
  51. package/dist/contracts/domainregistry.contract.js.map +1 -0
  52. package/dist/contracts/exchange.contract.js +209 -168
  53. package/dist/contracts/exchange.contract.js.map +1 -1
  54. package/dist/contracts/fanclub.contract.d.ts +4 -0
  55. package/dist/contracts/fanclub.contract.js +193 -0
  56. package/dist/contracts/fanclub.contract.js.map +1 -0
  57. package/dist/contracts/giftcard.contract.d.ts +4 -0
  58. package/dist/contracts/giftcard.contract.js +158 -0
  59. package/dist/contracts/giftcard.contract.js.map +1 -0
  60. package/dist/contracts/grantrounds.contract.d.ts +4 -0
  61. package/dist/contracts/grantrounds.contract.js +265 -0
  62. package/dist/contracts/grantrounds.contract.js.map +1 -0
  63. package/dist/contracts/groupbuy.contract.d.ts +4 -0
  64. package/dist/contracts/groupbuy.contract.js +198 -0
  65. package/dist/contracts/groupbuy.contract.js.map +1 -0
  66. package/dist/contracts/helpers.d.ts +66 -0
  67. package/dist/contracts/helpers.js +166 -0
  68. package/dist/contracts/helpers.js.map +1 -0
  69. package/dist/contracts/insurancepool.contract.d.ts +4 -0
  70. package/dist/contracts/insurancepool.contract.js +281 -0
  71. package/dist/contracts/insurancepool.contract.js.map +1 -0
  72. package/dist/contracts/invoice.contract.d.ts +4 -0
  73. package/dist/contracts/invoice.contract.js +193 -0
  74. package/dist/contracts/invoice.contract.js.map +1 -0
  75. package/dist/contracts/launchpad.contract.d.ts +4 -0
  76. package/dist/contracts/launchpad.contract.js +225 -0
  77. package/dist/contracts/launchpad.contract.js.map +1 -0
  78. package/dist/contracts/lotto.contract.js +53 -37
  79. package/dist/contracts/lotto.contract.js.map +1 -1
  80. package/dist/contracts/multisigtreasury.contract.d.ts +4 -0
  81. package/dist/contracts/multisigtreasury.contract.js +245 -0
  82. package/dist/contracts/multisigtreasury.contract.js.map +1 -0
  83. package/dist/contracts/nft.contract.d.ts +1 -0
  84. package/dist/contracts/nft.contract.js +234 -195
  85. package/dist/contracts/nft.contract.js.map +1 -1
  86. package/dist/contracts/oraclebounty.contract.d.ts +4 -0
  87. package/dist/contracts/oraclebounty.contract.js +250 -0
  88. package/dist/contracts/oraclebounty.contract.js.map +1 -0
  89. package/dist/contracts/payroll.contract.d.ts +4 -0
  90. package/dist/contracts/payroll.contract.js +232 -0
  91. package/dist/contracts/payroll.contract.js.map +1 -0
  92. package/dist/contracts/paywall.contract.d.ts +4 -0
  93. package/dist/contracts/paywall.contract.js +185 -0
  94. package/dist/contracts/paywall.contract.js.map +1 -0
  95. package/dist/contracts/poll.contract.js +2 -0
  96. package/dist/contracts/poll.contract.js.map +1 -1
  97. package/dist/contracts/predictionmarket.contract.d.ts +4 -0
  98. package/dist/contracts/predictionmarket.contract.js +213 -0
  99. package/dist/contracts/predictionmarket.contract.js.map +1 -0
  100. package/dist/contracts/proposaltimelock.contract.d.ts +4 -0
  101. package/dist/contracts/proposaltimelock.contract.js +250 -0
  102. package/dist/contracts/proposaltimelock.contract.js.map +1 -0
  103. package/dist/contracts/questpass.contract.d.ts +4 -0
  104. package/dist/contracts/questpass.contract.js +214 -0
  105. package/dist/contracts/questpass.contract.js.map +1 -0
  106. package/dist/contracts/referral.contract.d.ts +4 -0
  107. package/dist/contracts/referral.contract.js +238 -0
  108. package/dist/contracts/referral.contract.js.map +1 -0
  109. package/dist/contracts/rental.contract.d.ts +4 -0
  110. package/dist/contracts/rental.contract.js +221 -0
  111. package/dist/contracts/rental.contract.js.map +1 -0
  112. package/dist/contracts/revenuesplit.contract.d.ts +4 -0
  113. package/dist/contracts/revenuesplit.contract.js +211 -0
  114. package/dist/contracts/revenuesplit.contract.js.map +1 -0
  115. package/dist/contracts/rps.contract.js +48 -20
  116. package/dist/contracts/rps.contract.js.map +1 -1
  117. package/dist/contracts/savings.contract.d.ts +4 -0
  118. package/dist/contracts/savings.contract.js +208 -0
  119. package/dist/contracts/savings.contract.js.map +1 -0
  120. package/dist/contracts/subscription.contract.d.ts +4 -0
  121. package/dist/contracts/subscription.contract.js +241 -0
  122. package/dist/contracts/subscription.contract.js.map +1 -0
  123. package/dist/contracts/sweepstakes.contract.d.ts +4 -0
  124. package/dist/contracts/sweepstakes.contract.js +209 -0
  125. package/dist/contracts/sweepstakes.contract.js.map +1 -0
  126. package/dist/contracts/ticketing.contract.d.ts +4 -0
  127. package/dist/contracts/ticketing.contract.js +185 -0
  128. package/dist/contracts/ticketing.contract.js.map +1 -0
  129. package/dist/contracts/tipjar.contract.js +2 -0
  130. package/dist/contracts/tipjar.contract.js.map +1 -1
  131. package/dist/contracts/token.contract.js +135 -125
  132. package/dist/contracts/token.contract.js.map +1 -1
  133. package/dist/index.d.ts +40 -0
  134. package/dist/index.js +72 -1
  135. package/dist/index.js.map +1 -1
  136. package/dist/metadata.d.ts +20 -0
  137. package/dist/metadata.js +320 -1
  138. package/dist/metadata.js.map +1 -1
  139. package/dist/providers/block-provider.d.ts +22 -0
  140. package/dist/providers/block-provider.js +3 -0
  141. package/dist/providers/block-provider.js.map +1 -0
  142. package/dist/providers/haf-client.d.ts +30 -0
  143. package/dist/providers/haf-client.js +119 -0
  144. package/dist/providers/haf-client.js.map +1 -0
  145. package/dist/providers/haf-provider.d.ts +49 -0
  146. package/dist/providers/haf-provider.js +256 -0
  147. package/dist/providers/haf-provider.js.map +1 -0
  148. package/dist/providers/hive-provider.d.ts +13 -0
  149. package/dist/providers/hive-provider.js +25 -0
  150. package/dist/providers/hive-provider.js.map +1 -0
  151. package/dist/providers/index.d.ts +4 -0
  152. package/dist/providers/index.js +21 -0
  153. package/dist/providers/index.js.map +1 -0
  154. package/dist/streamer.d.ts +65 -4
  155. package/dist/streamer.js +768 -72
  156. package/dist/streamer.js.map +1 -1
  157. package/dist/types/hive-stream.d.ts +317 -0
  158. package/dist/utils.d.ts +33 -0
  159. package/dist/utils.js +198 -2
  160. package/dist/utils.js.map +1 -1
  161. package/package.json +16 -1
  162. package/.claude/settings.local.json +0 -12
  163. package/.env.example +0 -3
  164. package/.travis.yml +0 -11
  165. package/AGENTS.md +0 -35
  166. package/CLAUDE.md +0 -75
  167. package/ecosystem.config.js +0 -17
  168. package/examples/contracts/README.md +0 -8
  169. package/examples/contracts/exchange.ts +0 -38
  170. package/examples/contracts/poll.ts +0 -21
  171. package/examples/contracts/rps.ts +0 -19
  172. package/examples/contracts/tipjar.ts +0 -19
  173. package/jest.config.js +0 -9
  174. package/test-contract-block.md +0 -19
  175. package/tests/actions.spec.ts +0 -252
  176. package/tests/adapters/actions-persistence.spec.ts +0 -144
  177. package/tests/adapters/postgresql.adapter.spec.ts +0 -127
  178. package/tests/adapters/sqlite.adapter.spec.ts +0 -181
  179. package/tests/config-input.spec.ts +0 -90
  180. package/tests/contracts/coinflip.contract.spec.ts +0 -94
  181. package/tests/contracts/dice.contract.spec.ts +0 -87
  182. package/tests/contracts/entrants.json +0 -729
  183. package/tests/contracts/exchange.contract.spec.ts +0 -84
  184. package/tests/contracts/lotto.contract.spec.ts +0 -59
  185. package/tests/contracts/nft.contract.spec.ts +0 -948
  186. package/tests/contracts/token.contract.spec.ts +0 -90
  187. package/tests/exchanges/coingecko.exchange.spec.ts +0 -169
  188. package/tests/exchanges/exchange.base.spec.ts +0 -246
  189. package/tests/helpers/mock-adapter.ts +0 -214
  190. package/tests/helpers/mock-fetch.ts +0 -165
  191. package/tests/hive-chain-features.spec.ts +0 -319
  192. package/tests/hive-rates.spec.ts +0 -443
  193. package/tests/integration/hive-rates.integration.spec.ts +0 -35
  194. package/tests/metadata.spec.ts +0 -63
  195. package/tests/setup.ts +0 -30
  196. package/tests/streamer-actions.spec.ts +0 -274
  197. package/tests/streamer.spec.ts +0 -342
  198. package/tests/types/rates.spec.ts +0 -216
  199. package/tests/utils.spec.ts +0 -113
  200. package/tsconfig.build.json +0 -4
  201. package/tslint.json +0 -21
  202. package/wallaby.js +0 -26
package/DOCUMENTATION.md CHANGED
@@ -9,7 +9,7 @@ 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'`.
12
+ `new Streamer()` is side-effect free. The default SQLite adapter is initialized lazily, and the built-in Express API only starts when you call `startApiServer()` or enable it through config before `start()`.
13
13
 
14
14
  ---
15
15
 
@@ -302,6 +302,35 @@ export const TipJar = defineContract({
302
302
  - `createPollContract` - Polls and votes
303
303
  - `createTipJarContract` - Tip jar + message log
304
304
  - `createExchangeContract` - Deposits/withdrawals/orders/matching (SQL)
305
+ - `createAuctionHouseContract` - Auctions with bids, reserve prices, and settlement
306
+ - `createSubscriptionContract` - Subscription plans with transfer and recurrent renewals
307
+ - `createCrowdfundContract` - Crowdfunding campaigns with milestones and refund flows
308
+ - `createBountyBoardContract` - Funded bounties, submissions, and award tracking
309
+ - `createInvoiceContract` - Invoices with partial/recurrent payments and overdue sweeps
310
+ - `createSavingsContract` - Savings goals with recurring contributions and withdrawals
311
+ - `createBookingContract` - Booking listings, reservations, confirmations, and cancellations
312
+ - `createGiftCardContract` - Gift card issuance, redemption, and cancellation
313
+ - `createGroupBuyContract` - Group buys with commitments, finalization, and withdrawals
314
+ - `createSweepstakesContract` - Paid-entry sweepstakes with deterministic draws
315
+ - `createDcaBotContract` - Time-driven DCA execution scheduling
316
+ - `createMultisigTreasuryContract` - Multisig vaults with approval queues and ready-to-execute proposals
317
+ - `createRevenueSplitContract` - Revenue splitting with internal balances and withdrawals
318
+ - `createPaywallContract` - Paid access windows and expiries for gated resources
319
+ - `createDomainRegistryContract` - Namespace-based domain registrations, renewals, and transfers
320
+ - `createRentalContract` - Escrow-backed rentals using `escrow_transfer`
321
+ - `createLaunchpadContract` - Fixed-price launchpad sales with allocations and claims
322
+ - `createPredictionMarketContract` - Prediction markets with paid positions and claims
323
+ - `createQuestPassContract` - Seasonal pass sales, point accrual, and tier claims
324
+ - `createCharityMatchContract` - Donation matching campaigns with sponsor-defined caps
325
+ - `createReferralContract` - Affiliate programs, conversion attribution, and payout balances
326
+ - `createInsurancePoolContract` - Insurance pools with premiums, active policies, claims, and reserve accounting
327
+ - `createOracleBountyContract` - Oracle feeds with funded report rounds, medians, and reward withdrawals
328
+ - `createGrantRoundsContract` - Matching grant rounds with project submissions, donations, and grant withdrawals
329
+ - `createPayrollContract` - Recurring payroll budgets with scheduled runs and recipient balances
330
+ - `createProposalTimelockContract` - Timelock approval queues for delayed governance-style actions
331
+ - `createBundleMarketplaceContract` - Bundle storefronts with inventory, purchases, and fulfillment tracking
332
+ - `createTicketingContract` - Event ticket sales with check-ins, refunds, and capacity limits
333
+ - `createFanClubContract` - Paid clubs with member renewals, points, and perk redemptions
305
334
 
306
335
  ### Example Snippets
307
336
 
@@ -312,6 +341,8 @@ Quick-start snippets live in `examples/contracts/`:
312
341
  - `examples/contracts/tipjar.ts`
313
342
  - `examples/contracts/exchange.ts`
314
343
 
344
+ Most built-in contracts use SQL tables internally, so they require a SQL-capable adapter such as SQLite or PostgreSQL. MongoDB remains supported for streamer persistence and custom contracts that do not rely on raw SQL queries.
345
+
315
346
  ---
316
347
 
317
348
  ## Exchange Contract Guide
@@ -378,7 +409,24 @@ createExchangeContract({
378
409
 
379
410
  ### API Endpoints
380
411
 
381
- If you run the built-in API server, the following endpoints are available:
412
+ If you want the built-in API server to start alongside block streaming, configure:
413
+
414
+ ```ts
415
+ const streamer = new Streamer({
416
+ apiEnabled: true,
417
+ apiPort: 5001
418
+ });
419
+
420
+ await streamer.start();
421
+ ```
422
+
423
+ You can also run the API independently:
424
+
425
+ ```ts
426
+ await streamer.startApiServer();
427
+ ```
428
+
429
+ When the built-in API server is running, the following endpoints are available:
382
430
 
383
431
  - `GET /exchange/balances` (optional query `?account=alice`)
384
432
  - `GET /exchange/orders` (query `account`, `base`, `quote`, `status`)
package/README.md CHANGED
@@ -21,7 +21,7 @@ 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'`.
24
+ `new Streamer()` is now side-effect free. The default SQLite adapter is created lazily on first use, and the built-in Express API is opt-in via `apiEnabled: true` on `start()` or an explicit `startApiServer()` call.
25
25
 
26
26
  ## Builder/Tooling Metadata
27
27
 
@@ -48,12 +48,13 @@ To resume automatically from stored state, keep `resumeFromState` enabled (defau
48
48
 
49
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).
50
50
 
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`.
51
+ The `apiNodes` are the Hive API endpoints used for failover. Set `apiEnabled` to `true` if you want `start()` to boot the built-in API server, or call `startApiServer()` manually. If you want verbose logs, set `debugMode` to `true`. The configuration values and their defaults can be found in `src/config.ts`.
52
52
 
53
53
  CamelCase config keys are recommended for readability. Legacy uppercase keys are still supported for backwards compatibility.
54
54
 
55
55
  ```
56
56
  const options = {
57
+ env: true,
57
58
  activeKey: '',
58
59
  postingKey: '',
59
60
  jsonId: 'hivestream',
@@ -69,12 +70,22 @@ const options = {
69
70
  catchUpBatchSize: 50,
70
71
  catchUpDelayMs: 0,
71
72
  apiNodes: ['https://api.hive.blog', 'https://api.openhive.network', 'https://rpc.ausbit.dev'],
72
- debugMode: true
73
+ apiEnabled: false,
74
+ apiPort: 5001,
75
+ debugMode: false
73
76
  }
74
77
 
75
78
  const ss = new Streamer(options);
76
79
  ```
77
80
 
81
+ If you prefer loading credentials from environment variables, pass `env: true`. Hive Stream will read canonical keys like `ACTIVE_KEY` and `USERNAME`, plus Hive-friendly aliases like `HIVE_ACCOUNT` and `HIVE_ACTIVE_KEY`.
82
+
83
+ If you want the built-in API without starting block streaming yet:
84
+
85
+ ```javascript
86
+ await ss.startApiServer();
87
+ ```
88
+
78
89
  The configuration itself can also be overloaded using the `setConfig` method which allows you to pass one or more of the above configuration options, useful in situations where multiple keys might be used for issuing.
79
90
 
80
91
  ```
@@ -94,8 +105,9 @@ These event subscriptions and contract actions are separate paths: subscriptions
94
105
  #### Watch for transfers
95
106
 
96
107
  ```javascript
97
- ss.onTransfer('myaccount', (op, { sender, amount, asset, memo }, blockNumber, blockId, prevBlockId, trxId, blockTime) => {
108
+ ss.onTransfer('myaccount', (op, blockNumber, blockId, prevBlockId, trxId, blockTime) => {
98
109
  // Fires only when op.to === 'myaccount'
110
+ // Parse op.amount yourself, for example: "1.000 HIVE"
99
111
  });
100
112
  ```
101
113
 
@@ -172,6 +184,20 @@ transferHiveTokens(from, to, amount, symbol, memo = '') {
172
184
  }
173
185
  ```
174
186
 
187
+ ### Burn Hive (HIVE or HBD)
188
+ ```javascript
189
+ burnHiveTokens(from, amount, symbol, memo = '') {
190
+
191
+ }
192
+ ```
193
+
194
+ ### Burn A Percentage Of An Incoming Transfer
195
+ ```javascript
196
+ burnTransferPercentage(from, transferOrAmount, percentage, memo = '', allowedSymbols = ['HIVE', 'HBD']) {
197
+
198
+ }
199
+ ```
200
+
175
201
  ### Transfer Hive Engine Tokens
176
202
  ```javascript
177
203
  transferHiveEngineTokens(from, to, symbol, quantity, memo = '') {
@@ -179,6 +205,13 @@ transferHiveEngineTokens(from, to, symbol, quantity, memo = '') {
179
205
  }
180
206
  ```
181
207
 
208
+ ### Burn Hive Engine Tokens
209
+ ```javascript
210
+ burnHiveEngineTokens(from, symbol, quantity, memo = '') {
211
+
212
+ }
213
+ ```
214
+
182
215
  ### Transfer Hive Engine Tokens to Multiple Accounts
183
216
  ```javascript
184
217
  transferHiveEngineTokensMultiple(from, accounts = [], symbol, memo = '', amount = '0') {
@@ -186,6 +219,150 @@ transferHiveEngineTokensMultiple(from, accounts = [], symbol, memo = '', amount
186
219
  }
187
220
  ```
188
221
 
222
+ ### Burn part of an inbound transfer safely
223
+ ```javascript
224
+ const { Streamer } = require('hive-stream');
225
+
226
+ const ss = new Streamer({ env: true });
227
+
228
+ ss.flows.autoBurnIncomingTransfers({
229
+ percentage: 67,
230
+ memo: ({ transaction }) => `Auto-burn 67% of ${transaction.id}`
231
+ });
232
+
233
+ ss.start();
234
+ ```
235
+
236
+ ### Forward inbound transfers automatically
237
+ ```javascript
238
+ const { Streamer } = require('hive-stream');
239
+
240
+ const ss = new Streamer({ env: true });
241
+
242
+ ss.flows.autoForwardIncomingTransfers({
243
+ to: 'treasury',
244
+ percentage: 100,
245
+ memo: ({ transaction }) => `Forwarded from ${transaction.id}`
246
+ });
247
+
248
+ ss.start();
249
+ ```
250
+
251
+ ### Split inbound transfers across multiple accounts
252
+ ```javascript
253
+ const { Streamer } = require('hive-stream');
254
+
255
+ const ss = new Streamer({ env: true });
256
+
257
+ ss.flows.autoSplitIncomingTransfers({
258
+ recipients: [
259
+ { account: 'null', percentage: 69, memo: 'Feel the burn' },
260
+ { account: 'treasury' }
261
+ ]
262
+ });
263
+
264
+ ss.start();
265
+ ```
266
+
267
+ ### Refund inbound transfers automatically
268
+ ```javascript
269
+ const { Streamer } = require('hive-stream');
270
+
271
+ const ss = new Streamer({ env: true });
272
+
273
+ ss.flows.autoRefundIncomingTransfers({
274
+ memo: ({ transfer }) => `Refunded ${transfer.rawAmount} to ${transfer.from}`
275
+ });
276
+
277
+ ss.start();
278
+ ```
279
+
280
+ ### Route inbound transfers with one flow
281
+ ```javascript
282
+ const { Streamer } = require('hive-stream');
283
+
284
+ const ss = new Streamer({ env: true });
285
+
286
+ ss.flows.autoRouteIncomingTransfers({
287
+ routes: [
288
+ { type: 'burn', percentage: 67, memo: 'Auto-burn 67%' },
289
+ { to: 'treasury', memo: 'Treasury remainder' }
290
+ ]
291
+ });
292
+
293
+ ss.start();
294
+ ```
295
+
296
+ ### Route grouped payouts with an optional on-top donation
297
+ ```javascript
298
+ const { Streamer } = require('hive-stream');
299
+
300
+ const ss = new Streamer({ env: true });
301
+
302
+ ss.flows.autoRouteIncomingTransfers({
303
+ account: 'tweet-backup',
304
+ routes: [
305
+ { to: 'tweet-catcher', percentage: 20, memo: 'Tweet watcher share' },
306
+ { group: [{ account: 'node-1' }, { account: 'node-2' }], percentage: 4, memo: 'Node operator share' },
307
+ { group: [{ account: 'wit-1' }, { account: 'wit-2' }], percentage: 6, memo: 'Witness share' },
308
+ { type: 'burn', percentage: 70, memo: 'Burn share' },
309
+ { to: 'platform-op', mode: 'onTop', percentage: 8, memo: 'Optional platform donation' }
310
+ ]
311
+ });
312
+
313
+ ss.start();
314
+ ```
315
+
316
+ ### Chain inbound transfer flows with a builder
317
+ ```javascript
318
+ const { Streamer } = require('hive-stream');
319
+
320
+ const ss = new Streamer({ env: true });
321
+
322
+ ss.flows
323
+ .incomingTransfers()
324
+ .burn(69, 'Feel the burn')
325
+ .remainderTo('treasury', 'Treasury remainder')
326
+ .start();
327
+
328
+ ss.start();
329
+ ```
330
+
331
+ ### Preview a payout plan before the flow starts
332
+ ```javascript
333
+ const { Streamer } = require('hive-stream');
334
+
335
+ const ss = new Streamer({ env: true });
336
+
337
+ const plan = ss.flows
338
+ .incomingTransfers('tweet-backup')
339
+ .forwardTo('tweet-catcher', 20, 'Tweet watcher share')
340
+ .forwardGroup([{ account: 'node-1' }, { account: 'node-2' }], 4, { memo: 'Node operator share' })
341
+ .remainderToGroup([{ account: 'wit-1' }, { account: 'wit-2' }], { memo: 'Witness share' })
342
+ .burn(70, 'Burn share')
343
+ .donateOnTop('platform-op', 8, 'Optional platform donation')
344
+ .plan({ from: 'buyer', to: 'tweet-backup', amount: '1.080 HBD', memo: 'Archive this tweet' });
345
+
346
+ console.log(plan.baseAmount); // "1.000"
347
+ console.log(plan.onTopAmount); // "0.080"
348
+ console.log(plan.routes);
349
+ ```
350
+
351
+ `flows.autoBurnIncomingTransfers()` is the quickest high-level option for the burn case. `flows.autoForwardIncomingTransfers()` covers treasury forwarding, `flows.autoSplitIncomingTransfers()` handles common revenue-sharing, and `flows.autoRefundIncomingTransfers()` is useful for rejecting unsupported payments. `flows.autoRouteIncomingTransfers()` is the general router for mixed burn/transfer/group routes, and `flows.planIncomingTransferRoutes()` previews the same math without broadcasting. In base routes, one destination can omit `percentage`/`basisPoints` and automatically receive the remainder. Routes with `mode: 'onTop'` are treated as a surcharge on the base payout amount, so a `1.000 HBD` base payout with an `8%` donation should arrive as `1.080 HBD`.
352
+
353
+ `flows.incomingTransfers()` is the chainable version of the same idea. Single-step builders compile down to `autoBurnIncomingTransfers()`, `autoForwardIncomingTransfers()`, or `autoRefundIncomingTransfers()`. Multi-step builders compile down to `autoRouteIncomingTransfers()`, and `.plan(...)` gives you the exact rounded output before any transfer is sent.
354
+
355
+ ### Money Namespace
356
+ ```javascript
357
+ const ss = new Streamer();
358
+
359
+ ss.money.parseAssetAmount('1.000 HIVE');
360
+ ss.money.formatAmount('1.2399'); // "1.239"
361
+ ss.money.calculatePercentageAmount('10.000', 12.5); // "1.250"
362
+ ss.money.splitAmountByBasisPoints('1.000', [6900, 3100]); // ["0.690", "0.310"]
363
+ ss.money.splitAmountByWeights('1.080', [10000, 800]); // ["1.000", "0.080"]
364
+ ```
365
+
189
366
  ### Issue Hive Engine Tokens
190
367
  ```javascript
191
368
  issueHiveEngineTokens(from, to, symbol, quantity, memo = '') {
@@ -236,6 +413,59 @@ updateProposalVotes({ voter, proposal_ids, approve }, signingKeys?)
236
413
  removeProposals({ proposal_owner, proposal_ids }, signingKeys?)
237
414
  ```
238
415
 
416
+ ### Operation Builders
417
+ ```javascript
418
+ const { Streamer } = require('hive-stream');
419
+
420
+ const ss = new Streamer({ env: true });
421
+
422
+ await ss.ops
423
+ .transfer()
424
+ .from('alice')
425
+ .to('bob')
426
+ .hive(1.25)
427
+ .memo('Builder transfer example')
428
+ .send();
429
+
430
+ await ss.ops
431
+ .createProposal()
432
+ .creator('alice')
433
+ .receiver('treasury')
434
+ .startDate(new Date('2026-04-01T00:00:00.000Z'))
435
+ .endDate(new Date('2026-05-01T00:00:00.000Z'))
436
+ .dailyHbd(12.5)
437
+ .subject('Builder proposal example')
438
+ .permlink('builder-proposal-example')
439
+ .send();
440
+ ```
441
+
442
+ Additional chainable write builders are available for Hive Engine token ops and governance/voting:
443
+
444
+ ```javascript
445
+ await ss.ops
446
+ .transferEngine()
447
+ .from('alice')
448
+ .to('bob')
449
+ .symbol('BEE')
450
+ .quantity('1.23456')
451
+ .memo('Engine transfer')
452
+ .send();
453
+
454
+ await ss.ops
455
+ .voteProposals()
456
+ .voter('alice')
457
+ .ids(1, 2, 3)
458
+ .approve()
459
+ .send();
460
+
461
+ await ss.ops
462
+ .upvote()
463
+ .author('bob')
464
+ .permlink('my-post')
465
+ .weight(25)
466
+ .send();
467
+ ```
468
+
239
469
  ### Upvote/Downvote Posts
240
470
  ```javascript
241
471
  upvote(votePercentage = '100.0', username, permlink) {
@@ -319,6 +549,35 @@ The library includes several built-in contract examples in the `src/contracts` f
319
549
  - `createPollContract` - A poll/voting contract
320
550
  - `createTipJarContract` - A tip jar + message board contract
321
551
  - `createExchangeContract` - A basic exchange with deposits, withdrawals, balances, and order matching (SQL adapter required)
552
+ - `createAuctionHouseContract` - Auctions with reserve prices, buy-now support, and timed settlement
553
+ - `createSubscriptionContract` - Subscription plans with transfer and recurrent-transfer renewals
554
+ - `createCrowdfundContract` - Crowdfunding campaigns with milestones, finalization, and refund tracking
555
+ - `createBountyBoardContract` - Funded bounties, submissions, and award selection
556
+ - `createInvoiceContract` - Invoices with partial payments, recurring payments, and overdue sweeps
557
+ - `createSavingsContract` - Savings goals with recurring contributions and withdrawal requests
558
+ - `createBookingContract` - Reservable listings with paid booking windows and confirmations
559
+ - `createGiftCardContract` - Gift card issuance, redemption, and cancellation flows
560
+ - `createGroupBuyContract` - Threshold-based pooled purchases and participant commitments
561
+ - `createSweepstakesContract` - Paid-entry sweepstakes with deterministic winner draws
562
+ - `createDcaBotContract` - Time-based DCA bot scheduling and execution request events
563
+ - `createMultisigTreasuryContract` - Multisig vaults, proposal approvals, and execution readiness tracking
564
+ - `createRevenueSplitContract` - Revenue share ledgers and withdrawal requests for collaborators
565
+ - `createPaywallContract` - Paid access control for gated resources and memberships
566
+ - `createDomainRegistryContract` - App-level namespaces with registrations, renewals, transfers, and expiries
567
+ - `createRentalContract` - Escrow-backed rental agreements for items, passes, or assets
568
+ - `createLaunchpadContract` - Launchpad sales with allocations, finalization, and claim flows
569
+ - `createPredictionMarketContract` - Prediction markets with positions, resolution, and winner claims
570
+ - `createQuestPassContract` - Seasonal passes with progress tracking and reward claims
571
+ - `createCharityMatchContract` - Donation campaigns with matched totals and closing summaries
572
+ - `createReferralContract` - Affiliate programs with codes, funded budgets, and payout balances
573
+ - `createInsurancePoolContract` - Insurance pools with premium-backed policies, claims, and reserve management
574
+ - `createOracleBountyContract` - Oracle bounty feeds with report rounds, median finalization, and reporter rewards
575
+ - `createGrantRoundsContract` - Matching grant rounds with project submissions, donations, and post-close allocations
576
+ - `createPayrollContract` - Recurring team payrolls with funded budgets, scheduled runs, and recipient withdrawals
577
+ - `createProposalTimelockContract` - Timelocked governance queues with approvals, delays, and execution requests
578
+ - `createBundleMarketplaceContract` - Fixed-price bundle storefronts with inventory tracking and fulfillment states
579
+ - `createTicketingContract` - Event ticketing with purchases, check-ins, refunds, and capacity enforcement
580
+ - `createFanClubContract` - Paid fan clubs with member renewals, engagement points, and perk redemptions
322
581
 
323
582
  These can be imported and used as examples for building your own contracts:
324
583
 
@@ -326,6 +585,8 @@ These can be imported and used as examples for building your own contracts:
326
585
  import { createDiceContract, createCoinflipContract, createLottoContract } from 'hive-stream';
327
586
  ```
328
587
 
588
+ Most built-in contracts in `src/contracts` persist SQL tables internally, so they require a SQL-capable adapter such as SQLite or PostgreSQL. MongoDB remains supported for streamer persistence and custom contracts that do not depend on raw SQL queries.
589
+
329
590
  ### Example Snippets
330
591
 
331
592
  Sample snippets for the newest contracts live in `examples/contracts/`:
@@ -335,6 +596,21 @@ Sample snippets for the newest contracts live in `examples/contracts/`:
335
596
  - `examples/contracts/tipjar.ts`
336
597
  - `examples/contracts/exchange.ts`
337
598
 
599
+ Higher-level flow examples live in `examples/flows/`:
600
+
601
+ - `examples/flows/auto-burn.ts`
602
+ - `examples/flows/auto-forward.ts`
603
+ - `examples/flows/auto-split.ts`
604
+ - `examples/flows/auto-refund.ts`
605
+ - `examples/flows/builder-burn-route.ts`
606
+ - `examples/flows/grouped-route-on-top.ts`
607
+ - `examples/flows/builder-payout-plan.ts`
608
+
609
+ Chainable operation examples live in `examples/ops/`:
610
+
611
+ - `examples/ops/transfer-builder.ts`
612
+ - `examples/ops/proposal-builder.ts`
613
+
338
614
  ## Time-based Actions
339
615
 
340
616
  It's like a cron job for your contracts. Time-based actions allow you to execute contract functions over a wide variety of different periods. Want to call a function every 3 seconds block time or want to call a function once per day? Time-based actions are an easy way to run time code.
@@ -410,6 +686,8 @@ const adapter = new MongodbAdapter('mongodb://localhost:27017', 'hive_stream');
410
686
  await streamer.registerAdapter(adapter);
411
687
  ```
412
688
 
689
+ MongoDB supports block state, transfers, custom JSON persistence, and custom contracts that manage their own state without SQL. Built-in SQL-backed contracts should use SQLite or PostgreSQL.
690
+
413
691
  ### PostgreSQL Adapter
414
692
  ```javascript
415
693
  import { Streamer, PostgreSQLAdapter } from 'hive-stream';
@@ -4,6 +4,9 @@ import { SignedBlock } from '@hiveio/dhive';
4
4
  export declare class AdapterBase {
5
5
  protected client: any;
6
6
  protected db: any;
7
+ readonly capabilities: {
8
+ sql: boolean;
9
+ };
7
10
  constructor();
8
11
  create(): Promise<boolean>;
9
12
  destroy(): Promise<boolean>;
@@ -19,7 +22,9 @@ export declare class AdapterBase {
19
22
  findOne(table: string, queryObject: Record<string, any>): Promise<any>;
20
23
  insert(table: string, data: any): Promise<any>;
21
24
  replace(table: string, queryObject: Record<string, any>, data: any): Promise<any>;
25
+ runInTransaction<T>(work: (adapter: AdapterBase) => Promise<T>): Promise<T>;
22
26
  query(sql: string, params?: any[]): Promise<any[]>;
27
+ addEvent(date: string | Date, contract: string, action: string, payload: any, data: any): Promise<boolean>;
23
28
  getEvents(): Promise<any[]>;
24
29
  getEventsByContract(contract: string): Promise<any[]>;
25
30
  getEventsByAccount(account: string): Promise<any[]>;
@@ -4,6 +4,9 @@ exports.AdapterBase = void 0;
4
4
  class AdapterBase {
5
5
  client = null;
6
6
  db = null;
7
+ capabilities = {
8
+ sql: false
9
+ };
7
10
  constructor() {
8
11
  this.client = null;
9
12
  this.db = null;
@@ -50,9 +53,15 @@ class AdapterBase {
50
53
  async replace(table, queryObject, data) {
51
54
  return data;
52
55
  }
56
+ async runInTransaction(work) {
57
+ return work(this);
58
+ }
53
59
  async query(sql, params) {
54
60
  throw new Error('Query method not implemented in adapter');
55
61
  }
62
+ async addEvent(date, contract, action, payload, data) {
63
+ return true;
64
+ }
56
65
  async getEvents() {
57
66
  return [];
58
67
  }
@@ -1 +1 @@
1
- {"version":3,"file":"base.adapter.js","sourceRoot":"","sources":["../../src/adapters/base.adapter.ts"],"names":[],"mappings":";;;AAGA,MAAa,WAAW;IACV,MAAM,GAAQ,IAAI,CAAC;IACnB,EAAE,GAAQ,IAAI,CAAC;IAEzB;QACI,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC;IACnB,CAAC;IAEM,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E,QAAgB,EAAE,MAAc,EAAE,OAAY,EAAE,IAAS;QAChG,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,KAAK,CAAC,SAAS;QAClB,OAAO,EAAE,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,mBAAmB,CAAC,QAAgB;QAC7C,OAAO,EAAE,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,kBAAkB,CAAC,OAAe;QAC3C,OAAO,EAAE,CAAC;IACd,CAAC;IAED,kDAAkD;IAC3C,KAAK,CAAC,mBAAmB,CAAC,OAAgB;QAC7C,OAAO,EAAE,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,iBAAiB,CAAC,UAAgF,EAAE;QAC7G,OAAO,EAAE,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,iBAAiB,CAAC,UAA+D,EAAE;QAC5F,OAAO,EAAE,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,6BAA6B,CAAC,UAA6D,EAAE;QACtG,OAAO,EAAE,CAAC;IACd,CAAC;CACJ;AA5GD,kCA4GC"}
@@ -5,16 +5,16 @@ import { MongoClient, Db } from 'mongodb';
5
5
  export declare class MongodbAdapter extends AdapterBase {
6
6
  protected client: MongoClient;
7
7
  protected db: Db;
8
+ readonly capabilities: {
9
+ sql: boolean;
10
+ };
8
11
  private mongo;
9
12
  private blockNumber;
10
13
  private lastBlockNumber;
11
14
  private blockId;
12
15
  private prevBlockId;
13
16
  private transactionId;
14
- constructor(uri: string, database: string, options?: {
15
- useNewUrlParser: boolean;
16
- useUnifiedTopology: boolean;
17
- });
17
+ constructor(uri: string, database: string, options?: {});
18
18
  getDbInstance(): Promise<Db>;
19
19
  create(): Promise<boolean>;
20
20
  loadActions(): Promise<TimeAction[]>;
@@ -26,8 +26,8 @@ export declare class MongodbAdapter extends AdapterBase {
26
26
  destroy(): Promise<boolean>;
27
27
  find(table: string, queryObject: any): Promise<any>;
28
28
  findOne(table: string, queryObject: any): Promise<any>;
29
- insert(table: string, data: any): Promise<import("mongodb").InsertOneResult<import("mongodb").Document>>;
30
- replace(table: string, queryObject: any, data: any): Promise<import("mongodb").UpdateResult<import("mongodb").Document>>;
29
+ insert(table: string, data: any): Promise<boolean>;
30
+ replace(table: string, queryObject: any, data: any): Promise<any>;
31
31
  query(sql: string, params?: any[]): Promise<any[]>;
32
32
  addEvent(date: string, contract: string, action: string, payload: ContractPayload, data: unknown): Promise<boolean>;
33
33
  getEvents(): Promise<any[]>;