@forgezero/runtime 0.1.14 → 0.1.16
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/README.md +27 -388
- package/dist/jobs.d.ts +5 -6
- package/dist/notify-templates.js +1 -1
- package/dist/schema-typebox.js +116 -7
- package/dist/schema.d.ts +14 -1
- package/dist/schema.js +116 -7
- package/package.json +3 -62
- package/contracts/foundry.toml +0 -9
- package/contracts/src/ColdVault.sol +0 -206
- package/contracts/src/DepositFactory.sol +0 -202
- package/contracts/src/DepositProxy.sol +0 -72
- package/contracts/src/IERC20.sol +0 -7
- package/contracts/src/MockTokens.sol +0 -32
- package/contracts/src/SafeTransferLib.sol +0 -31
- package/contracts/test/Custody.t.sol +0 -361
- package/contracts/test/Vectors.t.sol +0 -45
- package/dist/compliance.d.ts +0 -172
- package/dist/compliance.js +0 -168
- package/dist/finance/chain-addresses.d.ts +0 -130
- package/dist/finance/chain-addresses.js +0 -462
- package/dist/finance/chain-deposits.d.ts +0 -193
- package/dist/finance/chain-deposits.js +0 -600
- package/dist/finance/chain-reconcile.d.ts +0 -112
- package/dist/finance/chain-reconcile.js +0 -76
- package/dist/finance/chain-withdrawals.d.ts +0 -223
- package/dist/finance/chain-withdrawals.js +0 -635
- package/dist/finance/chain.d.ts +0 -116
- package/dist/finance/chain.js +0 -316
- package/dist/finance/commission.d.ts +0 -155
- package/dist/finance/commission.js +0 -423
- package/dist/finance/custody.d.ts +0 -68
- package/dist/finance/custody.js +0 -107
- package/dist/finance/derive.d.ts +0 -115
- package/dist/finance/derive.js +0 -116
- package/dist/finance/ledger.d.ts +0 -227
- package/dist/finance/ledger.js +0 -313
- package/dist/finance/market.d.ts +0 -209
- package/dist/finance/market.js +0 -112
- package/dist/finance/rates.d.ts +0 -178
- package/dist/finance/rates.js +0 -292
- package/dist/finance/transfers.d.ts +0 -153
- package/dist/finance/transfers.js +0 -292
- package/dist/finance/venues.d.ts +0 -190
- package/dist/finance/venues.js +0 -251
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
# @forgezero/runtime
|
|
9
9
|
|
|
10
|
-
The machinery behind a request handler — jobs, queues, an outbox, a hash-chained audit trail, mail, backups, schema validation and exact money.
|
|
10
|
+
The machinery behind a request handler — jobs, queues, an outbox, a hash-chained audit trail, mail, backups, schema validation and exact money. 30 public modules, each imported on its own.
|
|
11
11
|
|
|
12
12
|
## Package overview
|
|
13
13
|
|
|
@@ -44,7 +44,6 @@ These are supported consumer entry points, not every internal module shipped for
|
|
|
44
44
|
| @forgezero/runtime/notify | Render a named template to text and HTML, escaped per part, refusing to send with a blank where a value should be. | portable | [Reference + usage](#forgezero-runtime-notify) |
|
|
45
45
|
| @forgezero/runtime/notify/templates | The six transactional messages ForgeZero sends. | portable | [Reference + usage](#forgezero-runtime-notify-templates) |
|
|
46
46
|
| @forgezero/runtime/calendar | Billing periods computed from an anchor, working days, holidays and due dates. | portable | [Reference + usage](#forgezero-runtime-calendar) |
|
|
47
|
-
| @forgezero/runtime/compliance | Screening as a decision record — tiers, rules and lists, failing closed when a list is unreachable. | portable | [Reference + usage](#forgezero-runtime-compliance) |
|
|
48
47
|
| @forgezero/runtime/totp | RFC 6238 TOTP on the existing HMAC — base32, an asymmetric window, and replay left to the caller. | portable | [Reference + usage](#forgezero-runtime-totp) |
|
|
49
48
|
| @forgezero/runtime/passkey | Passkeys for sites that are not us. A vault-held credential is as unphishable as one in a security chip provided the RP ID check never slips — `evil-example.com` ends with `example.com` and is a different site. | portable | [Reference + usage](#forgezero-runtime-passkey) |
|
|
50
49
|
| @forgezero/runtime/phrase | BIP-39 recovery phrases, and the salted verifier that proves one without being able to reconstruct it. | portable | [Reference + usage](#forgezero-runtime-phrase) |
|
|
@@ -58,25 +57,12 @@ These are supported consumer entry points, not every internal module shipped for
|
|
|
58
57
|
| @forgezero/runtime/schema/typebox | The TypeBox validator behind that interface. | portable | [Reference + usage](#forgezero-runtime-schema-typebox) |
|
|
59
58
|
| @forgezero/runtime/finance/discounts | Promotions as arithmetic over integer minor units. They never stack — one winner — and a percentage rounds down, because rounding a discount up gives away a unit of currency per invoice forever. | portable | [Reference + usage](#forgezero-runtime-finance-discounts) |
|
|
60
59
|
| @forgezero/runtime/finance/money | Exact amounts in minor units with the asset attached, so two currencies cannot be added. | portable | [Reference + usage](#forgezero-runtime-finance-money) |
|
|
61
|
-
| @forgezero/runtime/finance/venues | Trading venues, market types and symbols as data — spot, margin and futures behind one order model. | portable | [Reference + usage](#forgezero-runtime-finance-venues) |
|
|
62
|
-
| @forgezero/runtime/finance/ledger | Double-entry postings and derived balances. A hold is a posting, not a lock — the queue does the ordering. | portable | [Reference + usage](#forgezero-runtime-finance-ledger) |
|
|
63
|
-
| @forgezero/runtime/finance/commission | Profit net of flows, a high-water mark, the tier split and the referral share of our income. | portable | [Reference + usage](#forgezero-runtime-finance-commission) |
|
|
64
|
-
| @forgezero/runtime/finance/rates | What an asset is worth in USD, and how old that answer is. A peg never ages; a quote always does. | portable | [Reference + usage](#forgezero-runtime-finance-rates) |
|
|
65
|
-
| @forgezero/runtime/finance/transfers | Deposits and withdrawals as ordered pipelines, with screening reserved at position zero. | portable | [Reference + usage](#forgezero-runtime-finance-transfers) |
|
|
66
|
-
| @forgezero/runtime/finance/chain | Which chains exist, their confirmation depth by value band, assets and explorers — as data an admin edits. | portable | [Reference + usage](#forgezero-runtime-finance-chain) |
|
|
67
|
-
| @forgezero/runtime/finance/custody | Derive CREATE2 deposit addresses and EIP-712 custody digests — arithmetic over a seed and a salt, needing no credential and no node. | portable | [Reference + usage](#forgezero-runtime-finance-custody) |
|
|
68
|
-
| @forgezero/runtime/finance/derive | Declare a field ForgeZero generates rather than the tenant supplying: BIP-44 path arithmetic, and the choice of who is capable of generating the key. | portable | [Reference + usage](#forgezero-runtime-finance-derive) |
|
|
69
60
|
| @forgezero/runtime/finance/tax | Which jurisdiction may tax a sale, who accounts for it, and the three ways to be zero that report differently. Rates are data. | portable | [Reference + usage](#forgezero-runtime-finance-tax) |
|
|
70
61
|
| @forgezero/runtime/finance/storage | Write an amount so it is both exact and sortable: an authoritative string, and a number that is only an index. | portable | [Reference + usage](#forgezero-runtime-finance-storage) |
|
|
71
62
|
| @forgezero/runtime/realtime | Provider-neutral realtime audience, shard, event and delivery contracts. | portable | [Reference + usage](#forgezero-runtime-realtime) |
|
|
72
63
|
| @forgezero/runtime/passkey-hybrid | Versioned WebAuthn PRF plus ML-DSA companion proof construction and verification. | portable | [Reference + usage](#forgezero-runtime-passkey-hybrid) |
|
|
73
64
|
| @forgezero/runtime/otpauth | Parse and render otpauth URIs without binding enrolment to a UI framework. | portable | [Reference + usage](#forgezero-runtime-otpauth) |
|
|
74
65
|
| @forgezero/runtime/pipeline | Typed ordered application-pipeline execution with explicit evidence. | portable | [Reference + usage](#forgezero-runtime-pipeline) |
|
|
75
|
-
| @forgezero/runtime/finance/chain-addresses | Chain-address derivation records and validation independent of a node provider. | portable | [Reference + usage](#forgezero-runtime-finance-chain-addresses) |
|
|
76
|
-
| @forgezero/runtime/finance/chain-deposits | Provider-neutral deposit observation, confirmation and credit transitions. | portable | [Reference + usage](#forgezero-runtime-finance-chain-deposits) |
|
|
77
|
-
| @forgezero/runtime/finance/chain-withdrawals | Provider-neutral withdrawal approval, broadcast and finality transitions. | portable | [Reference + usage](#forgezero-runtime-finance-chain-withdrawals) |
|
|
78
|
-
| @forgezero/runtime/finance/chain-reconcile | Deterministic reconciliation between chain observations and durable transfer state. | portable | [Reference + usage](#forgezero-runtime-finance-chain-reconcile) |
|
|
79
|
-
| @forgezero/runtime/finance/market | Market order, fill and quote contracts independent of any exchange adapter. | portable | [Reference + usage](#forgezero-runtime-finance-market) |
|
|
80
66
|
| @forgezero/runtime/custody-share | Threshold-share parsing, validation and reconstruction. | portable | [Reference + usage](#forgezero-runtime-custody-share) |
|
|
81
67
|
| @forgezero/runtime/custody-crypto | Hybrid ML-KEM-768 plus X25519 custody-share sealing and opening. | portable | [Reference + usage](#forgezero-runtime-custody-crypto) |
|
|
82
68
|
|
|
@@ -316,29 +302,6 @@ import {
|
|
|
316
302
|
export const selectedCapability = CalendarError;
|
|
317
303
|
```
|
|
318
304
|
|
|
319
|
-
<a id="forgezero-runtime-compliance"></a>
|
|
320
|
-
## @forgezero/runtime/compliance
|
|
321
|
-
|
|
322
|
-
Screening as a decision record — tiers, rules and lists, failing closed when a list is unreachable. This is a supported entry point. Import only the named values used by the adjacent task example; the declaration file remains the complete API reference.
|
|
323
|
-
|
|
324
|
-
```text
|
|
325
|
-
import {
|
|
326
|
-
ComplianceError,
|
|
327
|
-
} from '@forgezero/runtime/compliance';
|
|
328
|
-
```
|
|
329
|
-
|
|
330
|
-
## @forgezero/runtime/compliance — Use this entry point
|
|
331
|
-
|
|
332
|
-
This minimal executable use imports one concrete value from this exact entry point without a wildcard or package-root detour. Keep the value or values the application actually needs; the full named inventory remains directly above it.
|
|
333
|
-
|
|
334
|
-
```text
|
|
335
|
-
import {
|
|
336
|
-
ComplianceError,
|
|
337
|
-
} from '@forgezero/runtime/compliance';
|
|
338
|
-
|
|
339
|
-
export const selectedCapability = ComplianceError;
|
|
340
|
-
```
|
|
341
|
-
|
|
342
305
|
<a id="forgezero-runtime-totp"></a>
|
|
343
306
|
## @forgezero/runtime/totp
|
|
344
307
|
|
|
@@ -658,190 +621,6 @@ import {
|
|
|
658
621
|
export const selectedCapability = ASSETS;
|
|
659
622
|
```
|
|
660
623
|
|
|
661
|
-
<a id="forgezero-runtime-finance-venues"></a>
|
|
662
|
-
## @forgezero/runtime/finance/venues
|
|
663
|
-
|
|
664
|
-
Trading venues, market types and symbols as data — spot, margin and futures behind one order model. This is a supported entry point. Import only the named values used by the adjacent task example; the declaration file remains the complete API reference.
|
|
665
|
-
|
|
666
|
-
```text
|
|
667
|
-
import {
|
|
668
|
-
MARKET_TYPES,
|
|
669
|
-
} from '@forgezero/runtime/finance/venues';
|
|
670
|
-
```
|
|
671
|
-
|
|
672
|
-
## @forgezero/runtime/finance/venues — Use this entry point
|
|
673
|
-
|
|
674
|
-
This minimal executable use imports one concrete value from this exact entry point without a wildcard or package-root detour. Keep the value or values the application actually needs; the full named inventory remains directly above it.
|
|
675
|
-
|
|
676
|
-
```text
|
|
677
|
-
import {
|
|
678
|
-
MARKET_TYPES,
|
|
679
|
-
} from '@forgezero/runtime/finance/venues';
|
|
680
|
-
|
|
681
|
-
export const selectedCapability = MARKET_TYPES;
|
|
682
|
-
```
|
|
683
|
-
|
|
684
|
-
<a id="forgezero-runtime-finance-ledger"></a>
|
|
685
|
-
## @forgezero/runtime/finance/ledger
|
|
686
|
-
|
|
687
|
-
Double-entry postings and derived balances. A hold is a posting, not a lock — the queue does the ordering. This is a supported entry point. Import only the named values used by the adjacent task example; the declaration file remains the complete API reference.
|
|
688
|
-
|
|
689
|
-
```text
|
|
690
|
-
import {
|
|
691
|
-
ACCOUNT_KINDS,
|
|
692
|
-
} from '@forgezero/runtime/finance/ledger';
|
|
693
|
-
```
|
|
694
|
-
|
|
695
|
-
## @forgezero/runtime/finance/ledger — Use this entry point
|
|
696
|
-
|
|
697
|
-
This minimal executable use imports one concrete value from this exact entry point without a wildcard or package-root detour. Keep the value or values the application actually needs; the full named inventory remains directly above it.
|
|
698
|
-
|
|
699
|
-
```text
|
|
700
|
-
import {
|
|
701
|
-
ACCOUNT_KINDS,
|
|
702
|
-
} from '@forgezero/runtime/finance/ledger';
|
|
703
|
-
|
|
704
|
-
export const selectedCapability = ACCOUNT_KINDS;
|
|
705
|
-
```
|
|
706
|
-
|
|
707
|
-
<a id="forgezero-runtime-finance-commission"></a>
|
|
708
|
-
## @forgezero/runtime/finance/commission
|
|
709
|
-
|
|
710
|
-
Profit net of flows, a high-water mark, the tier split and the referral share of our income. This is a supported entry point. Import only the named values used by the adjacent task example; the declaration file remains the complete API reference.
|
|
711
|
-
|
|
712
|
-
```text
|
|
713
|
-
import {
|
|
714
|
-
CommissionError,
|
|
715
|
-
} from '@forgezero/runtime/finance/commission';
|
|
716
|
-
```
|
|
717
|
-
|
|
718
|
-
## @forgezero/runtime/finance/commission — Use this entry point
|
|
719
|
-
|
|
720
|
-
This minimal executable use imports one concrete value from this exact entry point without a wildcard or package-root detour. Keep the value or values the application actually needs; the full named inventory remains directly above it.
|
|
721
|
-
|
|
722
|
-
```text
|
|
723
|
-
import {
|
|
724
|
-
CommissionError,
|
|
725
|
-
} from '@forgezero/runtime/finance/commission';
|
|
726
|
-
|
|
727
|
-
export const selectedCapability = CommissionError;
|
|
728
|
-
```
|
|
729
|
-
|
|
730
|
-
<a id="forgezero-runtime-finance-rates"></a>
|
|
731
|
-
## @forgezero/runtime/finance/rates
|
|
732
|
-
|
|
733
|
-
What an asset is worth in USD, and how old that answer is. A peg never ages; a quote always does. This is a supported entry point. Import only the named values used by the adjacent task example; the declaration file remains the complete API reference.
|
|
734
|
-
|
|
735
|
-
```text
|
|
736
|
-
import {
|
|
737
|
-
BASE_ASSET,
|
|
738
|
-
} from '@forgezero/runtime/finance/rates';
|
|
739
|
-
```
|
|
740
|
-
|
|
741
|
-
## @forgezero/runtime/finance/rates — Use this entry point
|
|
742
|
-
|
|
743
|
-
This minimal executable use imports one concrete value from this exact entry point without a wildcard or package-root detour. Keep the value or values the application actually needs; the full named inventory remains directly above it.
|
|
744
|
-
|
|
745
|
-
```text
|
|
746
|
-
import {
|
|
747
|
-
BASE_ASSET,
|
|
748
|
-
} from '@forgezero/runtime/finance/rates';
|
|
749
|
-
|
|
750
|
-
export const selectedCapability = BASE_ASSET;
|
|
751
|
-
```
|
|
752
|
-
|
|
753
|
-
<a id="forgezero-runtime-finance-transfers"></a>
|
|
754
|
-
## @forgezero/runtime/finance/transfers
|
|
755
|
-
|
|
756
|
-
Deposits and withdrawals as ordered pipelines, with screening reserved at position zero. This is a supported entry point. Import only the named values used by the adjacent task example; the declaration file remains the complete API reference.
|
|
757
|
-
|
|
758
|
-
```text
|
|
759
|
-
import {
|
|
760
|
-
DIRECTIONS,
|
|
761
|
-
} from '@forgezero/runtime/finance/transfers';
|
|
762
|
-
```
|
|
763
|
-
|
|
764
|
-
## @forgezero/runtime/finance/transfers — Use this entry point
|
|
765
|
-
|
|
766
|
-
This minimal executable use imports one concrete value from this exact entry point without a wildcard or package-root detour. Keep the value or values the application actually needs; the full named inventory remains directly above it.
|
|
767
|
-
|
|
768
|
-
```text
|
|
769
|
-
import {
|
|
770
|
-
DIRECTIONS,
|
|
771
|
-
} from '@forgezero/runtime/finance/transfers';
|
|
772
|
-
|
|
773
|
-
export const selectedCapability = DIRECTIONS;
|
|
774
|
-
```
|
|
775
|
-
|
|
776
|
-
<a id="forgezero-runtime-finance-chain"></a>
|
|
777
|
-
## @forgezero/runtime/finance/chain
|
|
778
|
-
|
|
779
|
-
Which chains exist, their confirmation depth by value band, assets and explorers — as data an admin edits. This is a supported entry point. Import only the named values used by the adjacent task example; the declaration file remains the complete API reference.
|
|
780
|
-
|
|
781
|
-
```text
|
|
782
|
-
import {
|
|
783
|
-
ADDRESS_SCHEMES,
|
|
784
|
-
} from '@forgezero/runtime/finance/chain';
|
|
785
|
-
```
|
|
786
|
-
|
|
787
|
-
## @forgezero/runtime/finance/chain — Use this entry point
|
|
788
|
-
|
|
789
|
-
This minimal executable use imports one concrete value from this exact entry point without a wildcard or package-root detour. Keep the value or values the application actually needs; the full named inventory remains directly above it.
|
|
790
|
-
|
|
791
|
-
```text
|
|
792
|
-
import {
|
|
793
|
-
ADDRESS_SCHEMES,
|
|
794
|
-
} from '@forgezero/runtime/finance/chain';
|
|
795
|
-
|
|
796
|
-
export const selectedCapability = ADDRESS_SCHEMES;
|
|
797
|
-
```
|
|
798
|
-
|
|
799
|
-
<a id="forgezero-runtime-finance-custody"></a>
|
|
800
|
-
## @forgezero/runtime/finance/custody
|
|
801
|
-
|
|
802
|
-
Derive CREATE2 deposit addresses and EIP-712 custody digests — arithmetic over a seed and a salt, needing no credential and no node. This is a supported entry point. Import only the named values used by the adjacent task example; the declaration file remains the complete API reference.
|
|
803
|
-
|
|
804
|
-
```text
|
|
805
|
-
import {
|
|
806
|
-
CustodyError,
|
|
807
|
-
} from '@forgezero/runtime/finance/custody';
|
|
808
|
-
```
|
|
809
|
-
|
|
810
|
-
## @forgezero/runtime/finance/custody — Use this entry point
|
|
811
|
-
|
|
812
|
-
This minimal executable use imports one concrete value from this exact entry point without a wildcard or package-root detour. Keep the value or values the application actually needs; the full named inventory remains directly above it.
|
|
813
|
-
|
|
814
|
-
```text
|
|
815
|
-
import {
|
|
816
|
-
CustodyError,
|
|
817
|
-
} from '@forgezero/runtime/finance/custody';
|
|
818
|
-
|
|
819
|
-
export const selectedCapability = CustodyError;
|
|
820
|
-
```
|
|
821
|
-
|
|
822
|
-
<a id="forgezero-runtime-finance-derive"></a>
|
|
823
|
-
## @forgezero/runtime/finance/derive
|
|
824
|
-
|
|
825
|
-
Declare a field ForgeZero generates rather than the tenant supplying: BIP-44 path arithmetic, and the choice of who is capable of generating the key. This is a supported entry point. Import only the named values used by the adjacent task example; the declaration file remains the complete API reference.
|
|
826
|
-
|
|
827
|
-
```text
|
|
828
|
-
import {
|
|
829
|
-
CUSTODY,
|
|
830
|
-
} from '@forgezero/runtime/finance/derive';
|
|
831
|
-
```
|
|
832
|
-
|
|
833
|
-
## @forgezero/runtime/finance/derive — Use this entry point
|
|
834
|
-
|
|
835
|
-
This minimal executable use imports one concrete value from this exact entry point without a wildcard or package-root detour. Keep the value or values the application actually needs; the full named inventory remains directly above it.
|
|
836
|
-
|
|
837
|
-
```text
|
|
838
|
-
import {
|
|
839
|
-
CUSTODY,
|
|
840
|
-
} from '@forgezero/runtime/finance/derive';
|
|
841
|
-
|
|
842
|
-
export const selectedCapability = CUSTODY;
|
|
843
|
-
```
|
|
844
|
-
|
|
845
624
|
<a id="forgezero-runtime-finance-tax"></a>
|
|
846
625
|
## @forgezero/runtime/finance/tax
|
|
847
626
|
|
|
@@ -980,121 +759,6 @@ import {
|
|
|
980
759
|
export const selectedCapability = GIT_PROVIDERS;
|
|
981
760
|
```
|
|
982
761
|
|
|
983
|
-
<a id="forgezero-runtime-finance-chain-addresses"></a>
|
|
984
|
-
## @forgezero/runtime/finance/chain-addresses
|
|
985
|
-
|
|
986
|
-
Chain-address derivation records and validation independent of a node provider. This is a supported entry point. Import only the named values used by the adjacent task example; the declaration file remains the complete API reference.
|
|
987
|
-
|
|
988
|
-
```text
|
|
989
|
-
import {
|
|
990
|
-
AddressError,
|
|
991
|
-
} from '@forgezero/runtime/finance/chain-addresses';
|
|
992
|
-
```
|
|
993
|
-
|
|
994
|
-
## @forgezero/runtime/finance/chain-addresses — Use this entry point
|
|
995
|
-
|
|
996
|
-
This minimal executable use imports one concrete value from this exact entry point without a wildcard or package-root detour. Keep the value or values the application actually needs; the full named inventory remains directly above it.
|
|
997
|
-
|
|
998
|
-
```text
|
|
999
|
-
import {
|
|
1000
|
-
AddressError,
|
|
1001
|
-
} from '@forgezero/runtime/finance/chain-addresses';
|
|
1002
|
-
|
|
1003
|
-
export const selectedCapability = AddressError;
|
|
1004
|
-
```
|
|
1005
|
-
|
|
1006
|
-
<a id="forgezero-runtime-finance-chain-deposits"></a>
|
|
1007
|
-
## @forgezero/runtime/finance/chain-deposits
|
|
1008
|
-
|
|
1009
|
-
Provider-neutral deposit observation, confirmation and credit transitions. This is a supported entry point. Import only the named values used by the adjacent task example; the declaration file remains the complete API reference.
|
|
1010
|
-
|
|
1011
|
-
```text
|
|
1012
|
-
import {
|
|
1013
|
-
DepositError,
|
|
1014
|
-
} from '@forgezero/runtime/finance/chain-deposits';
|
|
1015
|
-
```
|
|
1016
|
-
|
|
1017
|
-
## @forgezero/runtime/finance/chain-deposits — Use this entry point
|
|
1018
|
-
|
|
1019
|
-
This minimal executable use imports one concrete value from this exact entry point without a wildcard or package-root detour. Keep the value or values the application actually needs; the full named inventory remains directly above it.
|
|
1020
|
-
|
|
1021
|
-
```text
|
|
1022
|
-
import {
|
|
1023
|
-
DepositError,
|
|
1024
|
-
} from '@forgezero/runtime/finance/chain-deposits';
|
|
1025
|
-
|
|
1026
|
-
export const selectedCapability = DepositError;
|
|
1027
|
-
```
|
|
1028
|
-
|
|
1029
|
-
<a id="forgezero-runtime-finance-chain-withdrawals"></a>
|
|
1030
|
-
## @forgezero/runtime/finance/chain-withdrawals
|
|
1031
|
-
|
|
1032
|
-
Provider-neutral withdrawal approval, broadcast and finality transitions. This is a supported entry point. Import only the named values used by the adjacent task example; the declaration file remains the complete API reference.
|
|
1033
|
-
|
|
1034
|
-
```text
|
|
1035
|
-
import {
|
|
1036
|
-
WITHDRAWAL_STATES,
|
|
1037
|
-
} from '@forgezero/runtime/finance/chain-withdrawals';
|
|
1038
|
-
```
|
|
1039
|
-
|
|
1040
|
-
## @forgezero/runtime/finance/chain-withdrawals — Use this entry point
|
|
1041
|
-
|
|
1042
|
-
This minimal executable use imports one concrete value from this exact entry point without a wildcard or package-root detour. Keep the value or values the application actually needs; the full named inventory remains directly above it.
|
|
1043
|
-
|
|
1044
|
-
```text
|
|
1045
|
-
import {
|
|
1046
|
-
WITHDRAWAL_STATES,
|
|
1047
|
-
} from '@forgezero/runtime/finance/chain-withdrawals';
|
|
1048
|
-
|
|
1049
|
-
export const selectedCapability = WITHDRAWAL_STATES;
|
|
1050
|
-
```
|
|
1051
|
-
|
|
1052
|
-
<a id="forgezero-runtime-finance-chain-reconcile"></a>
|
|
1053
|
-
## @forgezero/runtime/finance/chain-reconcile
|
|
1054
|
-
|
|
1055
|
-
Deterministic reconciliation between chain observations and durable transfer state. This is a supported entry point. Import only the named values used by the adjacent task example; the declaration file remains the complete API reference.
|
|
1056
|
-
|
|
1057
|
-
```text
|
|
1058
|
-
import {
|
|
1059
|
-
DISCREPANCY_KINDS,
|
|
1060
|
-
} from '@forgezero/runtime/finance/chain-reconcile';
|
|
1061
|
-
```
|
|
1062
|
-
|
|
1063
|
-
## @forgezero/runtime/finance/chain-reconcile — Use this entry point
|
|
1064
|
-
|
|
1065
|
-
This minimal executable use imports one concrete value from this exact entry point without a wildcard or package-root detour. Keep the value or values the application actually needs; the full named inventory remains directly above it.
|
|
1066
|
-
|
|
1067
|
-
```text
|
|
1068
|
-
import {
|
|
1069
|
-
DISCREPANCY_KINDS,
|
|
1070
|
-
} from '@forgezero/runtime/finance/chain-reconcile';
|
|
1071
|
-
|
|
1072
|
-
export const selectedCapability = DISCREPANCY_KINDS;
|
|
1073
|
-
```
|
|
1074
|
-
|
|
1075
|
-
<a id="forgezero-runtime-finance-market"></a>
|
|
1076
|
-
## @forgezero/runtime/finance/market
|
|
1077
|
-
|
|
1078
|
-
Market order, fill and quote contracts independent of any exchange adapter. This is a supported entry point. Import only the named values used by the adjacent task example; the declaration file remains the complete API reference.
|
|
1079
|
-
|
|
1080
|
-
```text
|
|
1081
|
-
import {
|
|
1082
|
-
MarketError,
|
|
1083
|
-
} from '@forgezero/runtime/finance/market';
|
|
1084
|
-
```
|
|
1085
|
-
|
|
1086
|
-
## @forgezero/runtime/finance/market — Use this entry point
|
|
1087
|
-
|
|
1088
|
-
This minimal executable use imports one concrete value from this exact entry point without a wildcard or package-root detour. Keep the value or values the application actually needs; the full named inventory remains directly above it.
|
|
1089
|
-
|
|
1090
|
-
```text
|
|
1091
|
-
import {
|
|
1092
|
-
MarketError,
|
|
1093
|
-
} from '@forgezero/runtime/finance/market';
|
|
1094
|
-
|
|
1095
|
-
export const selectedCapability = MarketError;
|
|
1096
|
-
```
|
|
1097
|
-
|
|
1098
762
|
<a id="forgezero-runtime-custody-share"></a>
|
|
1099
763
|
## @forgezero/runtime/custody-share
|
|
1100
764
|
|
|
@@ -1161,51 +825,38 @@ import {
|
|
|
1161
825
|
|
|
1162
826
|
## What is in it
|
|
1163
827
|
|
|
1164
|
-
Four groups. The service spine
|
|
828
|
+
Four groups. The service spine keeps work ordered after a response; record modules preserve evidence and recovery; identity modules provide portable security primitives; finance modules provide exact USD and multi-currency representation without importing a trading product.
|
|
1165
829
|
|
|
1166
830
|
```text
|
|
1167
|
-
SPINE jobs scheduled work
|
|
1168
|
-
queue
|
|
1169
|
-
outbox
|
|
831
|
+
SPINE jobs fenced scheduled work
|
|
832
|
+
queue parallel keys, sequential within one key
|
|
833
|
+
outbox transactional intent, bounded draining
|
|
1170
834
|
|
|
1171
|
-
RECORD audit append-only
|
|
1172
|
-
backup encrypted
|
|
1173
|
-
|
|
1174
|
-
calendar billing periods, working days, holidays, due dates
|
|
835
|
+
RECORD audit append-only hash-chain verification
|
|
836
|
+
backup encrypted snapshots and verified restore
|
|
837
|
+
calendar periods, working days and due dates
|
|
1175
838
|
|
|
1176
|
-
IDENTITY identity hybrid Ed25519 + ML-DSA-65
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
839
|
+
IDENTITY identity hybrid Ed25519 + ML-DSA-65 signing
|
|
840
|
+
passkey WebAuthn and recovery primitives
|
|
841
|
+
totp bounded RFC 6238 verification
|
|
842
|
+
notify escaped named notification templates
|
|
843
|
+
schema restricted validation and form descriptors
|
|
1180
844
|
|
|
1181
|
-
FINANCE money minor
|
|
1182
|
-
storage
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
rates what an asset is worth, and how old that answer is
|
|
1186
|
-
transfers deposits and withdrawals as ordered pipelines
|
|
1187
|
-
tax who may tax a sale, and who accounts for it
|
|
1188
|
-
chain chains, assets, confirmation depth by value band
|
|
1189
|
-
custody CREATE2 deposit addresses and EIP-712 digests
|
|
1190
|
-
derive declare a key ForgeZero generates, not the tenant
|
|
1191
|
-
venues trading venues, market types and symbols as data
|
|
1192
|
-
binance Binance behind the venue adapter
|
|
845
|
+
FINANCE money exact minor-unit strings with currency and scale
|
|
846
|
+
storage exact authority plus coarse indexed projection
|
|
847
|
+
discounts bounded price adjustments
|
|
848
|
+
tax jurisdiction and accounting decisions
|
|
1193
849
|
```
|
|
1194
850
|
|
|
1195
851
|
## Optional peers — install only what your subpath needs
|
|
1196
852
|
|
|
1197
|
-
Nothing third-party is bundled. Vendoring a crypto library means a fix
|
|
853
|
+
Nothing third-party is bundled. Vendoring a crypto library means a fix cannot reach you until this package republishes, so optional peer imports remain explicit. Most subpaths need nothing.
|
|
1198
854
|
|
|
1199
855
|
```text
|
|
1200
|
-
#
|
|
1201
|
-
|
|
1202
|
-
# finance/custody — CREATE2 and EIP-712 digests
|
|
1203
|
-
bun add @noble/hashes
|
|
1204
|
-
|
|
1205
|
-
# identity — hybrid post-quantum signing
|
|
856
|
+
# identity and hybrid passkeys
|
|
1206
857
|
bun add @noble/curves @noble/post-quantum
|
|
1207
858
|
|
|
1208
|
-
# schema/typebox
|
|
859
|
+
# schema/typebox — only if you validate with TypeBox
|
|
1209
860
|
bun add @sinclair/typebox
|
|
1210
861
|
```
|
|
1211
862
|
|
|
@@ -1234,18 +885,6 @@ const row = toStored(fee);
|
|
|
1234
885
|
rangeBounds(parseAmount('10', 'USD'), null); // { gte: 10 }
|
|
1235
886
|
```
|
|
1236
887
|
|
|
1237
|
-
## The contracts ship with it
|
|
1238
|
-
|
|
1239
|
-
The Solidity behind `finance/custody` is in the package rather than in a repository you have to go find. `finance/custody` computes the counterfactual address; `DepositFactory` is what makes that address real on first sweep, and `ColdVault` is the M-of-N EIP-712 approval the digests are built for. Address arithmetic without the contract that honours it is half an answer.
|
|
1240
|
-
|
|
1241
|
-
```text
|
|
1242
|
-
node_modules/@forgezero/runtime/contracts/src/
|
|
1243
|
-
DepositProxy.sol lazily deployed at first sweep — no key, no gas per address
|
|
1244
|
-
DepositFactory.sol CREATE2, salt opaque to the contract
|
|
1245
|
-
ColdVault.sol M-of-N, signatures ordered by ascending signer
|
|
1246
|
-
SafeTransferLib.sol tokens that do not return a bool
|
|
1247
|
-
```
|
|
1248
|
-
|
|
1249
888
|
## Jobs — background work that never overlaps
|
|
1250
889
|
|
|
1251
890
|
The lock and the cursor store are interfaces, so this runs against a database, Redis, or nothing at all in a test.
|
|
@@ -1289,13 +928,13 @@ Fetch a batch, process every item, then write the cursor — never per item and
|
|
|
1289
928
|
|
|
1290
929
|
```text
|
|
1291
930
|
cursorJob({
|
|
1292
|
-
key: '
|
|
1293
|
-
label: '
|
|
1294
|
-
every: '
|
|
931
|
+
key: 'rotate-provider-credentials',
|
|
932
|
+
label: 'Rotate provider credentials',
|
|
933
|
+
every: '1m',
|
|
1295
934
|
store: cursors,
|
|
1296
935
|
from: '0',
|
|
1297
|
-
fetch: (cursor) =>
|
|
1298
|
-
process: (
|
|
936
|
+
fetch: (cursor) => dueRotations(cursor),
|
|
937
|
+
process: (record) => rotateOnce(record) // keyed and idempotent
|
|
1299
938
|
});
|
|
1300
939
|
```
|
|
1301
940
|
|
|
@@ -1306,7 +945,7 @@ Returning from stop() before in-flight work settles is how a deploy leaves a rec
|
|
|
1306
945
|
```text
|
|
1307
946
|
await scheduler.stop(); // clears timers, aborts, awaits in-flight
|
|
1308
947
|
scheduler.pause(); // stop scheduling, let in-flight finish
|
|
1309
|
-
await scheduler.runNow('
|
|
948
|
+
await scheduler.runNow('rotate-provider-credentials');
|
|
1310
949
|
```
|
|
1311
950
|
|
|
1312
951
|
## Status somebody can read during an incident
|
|
@@ -1315,7 +954,7 @@ Last run, duration, result, error and consecutive failures per job. Without it a
|
|
|
1315
954
|
|
|
1316
955
|
```text
|
|
1317
956
|
scheduler.status();
|
|
1318
|
-
// [{ key: '
|
|
957
|
+
// [{ key: 'rotate-provider-credentials', state: 'idle', runs: 412,
|
|
1319
958
|
// lastDurationMs: 840, lastResult: { processed: 17, batches: 2 },
|
|
1320
959
|
// consecutiveFailures: 0, skippedLocked: 0 }]
|
|
1321
960
|
```
|
package/dist/jobs.d.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Jobs — background work that does not corrupt anything when it goes wrong.
|
|
3
3
|
*
|
|
4
|
-
* ForgeZero needs session and step-up reaping, provider health probes
|
|
5
|
-
* invoice runs.
|
|
6
|
-
* They are the same machinery, and the same four mistakes sink all of them:
|
|
4
|
+
* ForgeZero needs session and step-up reaping, provider health probes, Vault
|
|
5
|
+
* rotations and invoice runs. The same four mistakes sink all of them:
|
|
7
6
|
*
|
|
8
7
|
* OVERLAP `setInterval` fires again while the previous run is still going.
|
|
9
|
-
* Two
|
|
8
|
+
* Two rotation scans may promote competing credential generations.
|
|
10
9
|
* CURSOR the cursor advances past a batch that failed halfway, so the
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* records in it are never seen again and the missed work is found
|
|
11
|
+
* only after an operational failure.
|
|
13
12
|
* DUPLICATE two processes run the same job because nothing coordinated them.
|
|
14
13
|
* SHUTDOWN a deploy kills a run mid-write, leaving a record half-updated.
|
|
15
14
|
*
|
package/dist/notify-templates.js
CHANGED
|
@@ -132,7 +132,7 @@ var invitation = defineTemplate({
|
|
|
132
132
|
data: ["inviter", "organisation", "link", "days"],
|
|
133
133
|
sample: {
|
|
134
134
|
inviter: "Aravind",
|
|
135
|
-
organisation: "
|
|
135
|
+
organisation: "Example Company",
|
|
136
136
|
link: "https://forgezero.net/invite?token=abc",
|
|
137
137
|
days: "7"
|
|
138
138
|
},
|