@integraledger/profile-facilitator 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +256 -76
- package/dist/answers.d.ts +28 -6
- package/dist/answers.js +43 -3
- package/dist/http.d.ts +33 -6
- package/dist/http.js +93 -26
- package/dist/index.d.ts +15 -1
- package/dist/index.js +25 -11
- package/dist/polkadot.d.ts +10 -2
- package/dist/polkadot.js +429 -133
- package/dist/store.d.ts +29 -14
- package/dist/store.js +40 -23
- package/dist/tron.d.ts +2 -2
- package/dist/tron.js +378 -131
- package/dist/unexpected.d.ts +21 -0
- package/dist/unexpected.js +27 -0
- package/package.json +9 -6
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* x402's `unexpected_verify_error` and `unexpected_settle_error`: a failure inside the facilitator, its node or its
|
|
3
|
+
* store stopped a check or a settlement, and the client gets nothing it can act on. Each is first given only here,
|
|
4
|
+
* once its entry is in the operator log; a repeated `/settle` gets the stored answer, whose entry is the one written
|
|
5
|
+
* then.
|
|
6
|
+
*/
|
|
7
|
+
import { type InvalidReason, type OperatorEntry, type OperatorLog, type SettleAnswer } from "./answers.js";
|
|
8
|
+
/** `unexpected_verify_error`, once `entry` is in the operator log, with `cause` when there is one. */
|
|
9
|
+
export declare function unexpectedVerify(log: OperatorLog, entry: OperatorEntry, cause?: unknown): InvalidReason;
|
|
10
|
+
/**
|
|
11
|
+
* `unexpected_settle_error` on `entry.network`, with no transaction, once `entry` is in the operator log, with `cause`
|
|
12
|
+
* when there is one.
|
|
13
|
+
*/
|
|
14
|
+
export declare function unexpectedSettle(log: OperatorLog, entry: OperatorEntry & {
|
|
15
|
+
network: string;
|
|
16
|
+
}, cause?: unknown): SettleAnswer;
|
|
17
|
+
/**
|
|
18
|
+
* A verify reason as a settle answer's: a node or store that could not be read before submission is a settle error.
|
|
19
|
+
* Its entry is the one written where the verify reason is given.
|
|
20
|
+
*/
|
|
21
|
+
export declare function settleReason(r: InvalidReason): string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* x402's `unexpected_verify_error` and `unexpected_settle_error`: a failure inside the facilitator, its node or its
|
|
3
|
+
* store stopped a check or a settlement, and the client gets nothing it can act on. Each is first given only here,
|
|
4
|
+
* once its entry is in the operator log; a repeated `/settle` gets the stored answer, whose entry is the one written
|
|
5
|
+
* then.
|
|
6
|
+
*/
|
|
7
|
+
import { failed } from "./answers.js";
|
|
8
|
+
/** `unexpected_verify_error`, once `entry` is in the operator log, with `cause` when there is one. */
|
|
9
|
+
export function unexpectedVerify(log, entry, cause) {
|
|
10
|
+
log(entry, cause);
|
|
11
|
+
return "unexpected_verify_error";
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* `unexpected_settle_error` on `entry.network`, with no transaction, once `entry` is in the operator log, with `cause`
|
|
15
|
+
* when there is one.
|
|
16
|
+
*/
|
|
17
|
+
export function unexpectedSettle(log, entry, cause) {
|
|
18
|
+
log(entry, cause);
|
|
19
|
+
return failed("unexpected_settle_error", "", entry.network);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A verify reason as a settle answer's: a node or store that could not be read before submission is a settle error.
|
|
23
|
+
* Its entry is the one written where the verify reason is given.
|
|
24
|
+
*/
|
|
25
|
+
export function settleReason(r) {
|
|
26
|
+
return r === "unexpected_verify_error" ? "unexpected_settle_error" : r;
|
|
27
|
+
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@integraledger/profile-facilitator",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "An x402 facilitator for the LCP profiles x402/exact/tron/lcp-trc20-memo and x402/exact/polkadot/lcp-assets-remark: verifies and settles payments whose signed transaction carries the ATR hash.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"engines": {
|
|
7
|
-
"node": ">=26.
|
|
7
|
+
"node": ">=26.11.1"
|
|
8
8
|
},
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -38,15 +38,18 @@
|
|
|
38
38
|
"README.md",
|
|
39
39
|
"LICENSE"
|
|
40
40
|
],
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"@integraledger/lcp": "~0.4.0"
|
|
43
|
+
},
|
|
41
44
|
"dependencies": {
|
|
42
|
-
"@integraledger/lcp": "0.1.0",
|
|
43
45
|
"@noble/curves": "2.4.0",
|
|
44
46
|
"@noble/hashes": "2.4.0",
|
|
45
|
-
"@polkadot/api": "17.0.
|
|
46
|
-
"pg": "8.23.
|
|
47
|
+
"@polkadot/api": "17.0.2",
|
|
48
|
+
"pg": "8.23.1"
|
|
47
49
|
},
|
|
48
50
|
"devDependencies": {
|
|
49
|
-
"
|
|
51
|
+
"@integraledger/lcp": "0.4.0",
|
|
52
|
+
"vitest": "5.0.4"
|
|
50
53
|
},
|
|
51
54
|
"scripts": {
|
|
52
55
|
"build": "tsc -p tsconfig.json",
|