@idoa/wpis-core 0.1.0 → 0.1.1
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/LICENSE +1 -1
- package/README.md +33 -7
- package/package.json +1 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,29 +1,55 @@
|
|
|
1
1
|
# @idoa/wpis-core
|
|
2
2
|
|
|
3
|
-
Core WPIS
|
|
3
|
+
Core WPIS primitives for deterministic payment intent lifecycle and verification state handling.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npm i @idoa/wpis-core
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Lifecycle Diagram
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
PENDING --(match found)--> DETECTED --(confirmations >= policy)--> CONFIRMED
|
|
15
|
+
| |
|
|
16
|
+
|--(expiresAt reached)------>|-------------------------------> EXPIRED
|
|
17
|
+
|--(verification failure)-----------------------------------> FAILED
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Deterministic State Machine
|
|
21
|
+
The core package enforces legal status transitions and blocks regressions.
|
|
22
|
+
Transition rules are explicit and typed, so downstream tooling gets predictable lifecycle behavior.
|
|
23
|
+
|
|
24
|
+
## Quick Example
|
|
12
25
|
|
|
13
26
|
```ts
|
|
14
|
-
import {
|
|
27
|
+
import { transitionStatus, validateCreateIntentInput, type CreateIntentInput } from "@idoa/wpis-core";
|
|
15
28
|
|
|
16
29
|
const input: CreateIntentInput = {
|
|
17
|
-
chainId: "eip155:
|
|
30
|
+
chainId: "eip155:42161",
|
|
18
31
|
recipient: "0x1111111111111111111111111111111111111111",
|
|
19
32
|
amount: "1000000000000000",
|
|
20
|
-
reference: "
|
|
33
|
+
reference: "order-123",
|
|
21
34
|
expiresAt: new Date(Date.now() + 15 * 60 * 1000).toISOString(),
|
|
22
35
|
asset: { symbol: "ETH", decimals: 18, type: "native" }
|
|
23
36
|
};
|
|
24
37
|
|
|
25
38
|
validateCreateIntentInput(input);
|
|
26
39
|
const next = transitionStatus("PENDING", "DETECTED");
|
|
40
|
+
console.log(next);
|
|
27
41
|
```
|
|
28
42
|
|
|
29
|
-
|
|
43
|
+
## Design Principles
|
|
44
|
+
- Deterministic lifecycle transitions.
|
|
45
|
+
- Strict input validation and explicit error taxonomy.
|
|
46
|
+
- Non-custodial architecture boundaries.
|
|
47
|
+
- Chain adapter separation from core domain logic.
|
|
48
|
+
|
|
49
|
+
## Intended Usage
|
|
50
|
+
Use this package as the typed lifecycle foundation for verifier services, adapters, and integration tooling.
|
|
51
|
+
It is infrastructure-focused and not intended to be a checkout or merchant product layer.
|
|
52
|
+
|
|
53
|
+
## License (MIT)
|
|
54
|
+
|
|
55
|
+
Licensed under the MIT License.
|