@odatano/core 2.0.0-rc.3 → 2.0.0-rc.5
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/@cds-models/CardanoAgentService/index.d.ts +151 -0
- package/@cds-models/CardanoAgentService/index.js +21 -0
- package/@cds-models/CardanoTransactionService/index.d.ts +9 -9
- package/@cds-models/odatano/cardano/index.d.ts +50 -0
- package/@cds-models/odatano/cardano/index.js +3 -0
- package/README.md +31 -0
- package/db/schema.cds +72 -0
- package/package.json +173 -173
- package/src/index.d.ts +6 -0
- package/src/index.js +17 -1
- package/src/plugin.js +33 -30
- package/srv/blockchain/transaction-building/buildooor-tx.d.ts +20 -0
- package/srv/blockchain/transaction-building/buildooor-tx.js +104 -20
- package/srv/blockchain/wallet-worker/build-request.js +35 -6
- package/srv/blockchain/wallet-worker/confirmation-tracker.d.ts +32 -1
- package/srv/blockchain/wallet-worker/confirmation-tracker.js +91 -29
- package/srv/blockchain/wallet-worker/job-store.d.ts +11 -0
- package/srv/blockchain/wallet-worker/job-store.js +42 -9
- package/srv/cardano-agent-service.cds +84 -0
- package/srv/cardano-agent-service.d.ts +2 -0
- package/srv/cardano-agent-service.js +16 -0
- package/srv/cardano-tx-service.cds +32 -26
- package/srv/cardano-tx-service.js +96 -38
- package/srv/server.d.ts +2 -1
- package/srv/server.js +12 -0
- package/srv/utils/agent-grants-config.d.ts +48 -0
- package/srv/utils/agent-grants-config.js +124 -0
- package/srv/utils/agent-grants.d.ts +211 -0
- package/srv/utils/agent-grants.js +541 -0
- package/srv/utils/agent-token-auth.d.ts +106 -0
- package/srv/utils/agent-token-auth.js +239 -0
- package/srv/utils/rate-limiter.d.ts +57 -0
- package/srv/utils/rate-limiter.js +126 -0
- package/srv/utils/tx-request-parsers.d.ts +13 -0
- package/srv/utils/tx-request-parsers.js +32 -0
- package/srv/utils/types.d.ts +15 -0
package/package.json
CHANGED
|
@@ -1,173 +1,173 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@odatano/core",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
4
|
-
"description": "SAP CAP plugin for Cardano blockchain OData V4 integration",
|
|
5
|
-
"imports": {
|
|
6
|
-
"#cds-models/*": "./@cds-models/*/index.js"
|
|
7
|
-
},
|
|
8
|
-
"main": "src/index.js",
|
|
9
|
-
"types": "src/index.d.ts",
|
|
10
|
-
"files": [
|
|
11
|
-
"cds-plugin.js",
|
|
12
|
-
"src/**/*.js",
|
|
13
|
-
"src/**/*.d.ts",
|
|
14
|
-
"srv/**/*.js",
|
|
15
|
-
"srv/**/*.d.ts",
|
|
16
|
-
"srv/**/*.cds",
|
|
17
|
-
"db/**/*.cds",
|
|
18
|
-
"@cds-models/"
|
|
19
|
-
],
|
|
20
|
-
"engines": {
|
|
21
|
-
"node": ">=22.5"
|
|
22
|
-
},
|
|
23
|
-
"peerDependencies": {
|
|
24
|
-
"@sap/cds": ">=10"
|
|
25
|
-
},
|
|
26
|
-
"dependencies": {
|
|
27
|
-
"@blockfrost/blockfrost-js": "~6.0.0",
|
|
28
|
-
"@cap-js/hana": "^3",
|
|
29
|
-
"@cardano-ogmios/client": "^6.14.0",
|
|
30
|
-
"@harmoniclabs/buildooor": "0.2.9",
|
|
31
|
-
"@harmoniclabs/cardano-costmodels-ts": "~1.6.1",
|
|
32
|
-
"@harmoniclabs/cardano-ledger-ts": "^0.5.6",
|
|
33
|
-
"@harmoniclabs/cbor": "^2.0.1",
|
|
34
|
-
"@harmoniclabs/crypto": "^0.3.0",
|
|
35
|
-
"@harmoniclabs/uint8array-utils": "^1.0.4",
|
|
36
|
-
"@sap/xssec": "^4",
|
|
37
|
-
"axios": "^1.18.0",
|
|
38
|
-
"bech32": "^2.0.0",
|
|
39
|
-
"blake2b": "^2.1.4"
|
|
40
|
-
},
|
|
41
|
-
"optionalDependencies": {
|
|
42
|
-
"pkcs11js": "^2.1.6"
|
|
43
|
-
},
|
|
44
|
-
"overrides": {
|
|
45
|
-
"axios": "^1.18.0",
|
|
46
|
-
"esbuild": "0.28.1",
|
|
47
|
-
"form-data": "^4.0.6",
|
|
48
|
-
"fast-uri": "^3.1.
|
|
49
|
-
"ws": "7.5.11",
|
|
50
|
-
"@sap/approuter": {
|
|
51
|
-
"body-parser": "^2.2.3"
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
"devDependencies": {
|
|
55
|
-
"@cap-js/cds-test": "^0.4.1",
|
|
56
|
-
"@cap-js/cds-typer": "^0.40.0",
|
|
57
|
-
"@cap-js/cds-types": "^0.18.0",
|
|
58
|
-
"@cap-js/sqlite": "^3",
|
|
59
|
-
"@sap/cds": "^10",
|
|
60
|
-
"@sap/cds-dk": "^10",
|
|
61
|
-
"@sap/eslint-plugin-cds": "^4.2.4",
|
|
62
|
-
"@types/blake2b": "^2.1.3",
|
|
63
|
-
"@types/node": "^22.19.7",
|
|
64
|
-
"@typescript-eslint/eslint-plugin": "^8.50.1",
|
|
65
|
-
"@typescript-eslint/parser": "^8.50.1",
|
|
66
|
-
"@vitest/coverage-v8": "^4.1.10",
|
|
67
|
-
"dotenv": "^16.3.1",
|
|
68
|
-
"eslint": "^9.39.2",
|
|
69
|
-
"nock": "^13.5.6",
|
|
70
|
-
"ts-node": "^10.9.2",
|
|
71
|
-
"tsx": "^4.21.0",
|
|
72
|
-
"typescript": "^5.9.3",
|
|
73
|
-
"vitest": "^4.1.10"
|
|
74
|
-
},
|
|
75
|
-
"cds": {
|
|
76
|
-
"typer": {
|
|
77
|
-
"ieee754compatible": true
|
|
78
|
-
},
|
|
79
|
-
"build": {
|
|
80
|
-
"tasks": [
|
|
81
|
-
{
|
|
82
|
-
"for": "node-cf",
|
|
83
|
-
"src": "srv",
|
|
84
|
-
"dest": "../gen/srv"
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
"for": "hana",
|
|
88
|
-
"src": "db",
|
|
89
|
-
"dest": "../gen/db"
|
|
90
|
-
}
|
|
91
|
-
]
|
|
92
|
-
},
|
|
93
|
-
"requires": {
|
|
94
|
-
"db": {
|
|
95
|
-
"kind": "sqlite",
|
|
96
|
-
"credentials": {
|
|
97
|
-
"url": "db.sqlite"
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
"[production]": {
|
|
101
|
-
"db": {
|
|
102
|
-
"kind": "hana",
|
|
103
|
-
"pool": {
|
|
104
|
-
"acquireTimeoutMillis": 30000,
|
|
105
|
-
"min": 0,
|
|
106
|
-
"max": 10
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
"auth": "xsuaa"
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
"scripts": {
|
|
114
|
-
"clean": "node -e \"const fs=require('fs');fs.globSync('{srv,db,src}/**/*.{js,js.map,d.ts,d.ts.map}').filter(f=>!f.includes('node_modules')).forEach(f=>fs.unlinkSync(f));console.log('Clean complete')\"",
|
|
115
|
-
"clean:models": "node -e \"require('fs').rmSync('@cds-models',{recursive:true,force:true});console.log('Removed @cds-models')\"",
|
|
116
|
-
"build": "npm run cds:types && tsc",
|
|
117
|
-
"build:plugin": "npm run cds:types && tsc -p tsconfig.build.json",
|
|
118
|
-
"build:package": "npm run clean && npm run clean:models && npm run build:plugin",
|
|
119
|
-
"prepare": "npm run build:package",
|
|
120
|
-
"start": "cds-serve",
|
|
121
|
-
"cds:watch": "cds watch",
|
|
122
|
-
"cds:serve": "cds serve --with-mocks",
|
|
123
|
-
"cds:types": "cds-typer \"*\" --outputDirectory @cds-models",
|
|
124
|
-
"lint": "eslint .",
|
|
125
|
-
"typecheck": "tsc --noEmit",
|
|
126
|
-
"db:deploy": "cds deploy",
|
|
127
|
-
"pretest": "npm run clean && npm run cds:types && npm run db:deploy",
|
|
128
|
-
"test": "vitest run",
|
|
129
|
-
"pretest:coverage": "npm run clean && npm run cds:types && npm run db:deploy",
|
|
130
|
-
"test:coverage": "vitest run --coverage",
|
|
131
|
-
"pretest:ci": "npm run clean && npm run cds:types && npm run db:deploy",
|
|
132
|
-
"test:ci": "vitest run --exclude \"**/core-ogmios.test.ts\"",
|
|
133
|
-
"pretest:ci:coverage": "npm run clean && npm run cds:types && npm run db:deploy",
|
|
134
|
-
"test:ci:coverage": "vitest run --coverage --exclude \"**/core-ogmios.test.ts\"",
|
|
135
|
-
"pretest:integration": "npm run clean && npm run cds:types && npm run db:deploy",
|
|
136
|
-
"test:integration": "vitest run --project integration",
|
|
137
|
-
"test:integration:blockfrost": "vitest run test/integration/core.blockfrost.test.ts",
|
|
138
|
-
"test:integration:koios": "vitest run test/integration/core.koios.test.ts",
|
|
139
|
-
"test:integration:ogmios": "vitest run test/integration/core-ogmios.test.ts",
|
|
140
|
-
"test:integration:both": "npm run test:integration:blockfrost && npm run test:integration:koios",
|
|
141
|
-
"pretest:unit": "npm run cds:types",
|
|
142
|
-
"test:unit": "vitest run --project unit",
|
|
143
|
-
"watch-odatano": "cds watch --open odatano/index.html?sap-ui-xx-viewCache=false --livereload false",
|
|
144
|
-
"watch-wallet": "cds watch --open wallet/webapp/index.html"
|
|
145
|
-
},
|
|
146
|
-
"sapux": [
|
|
147
|
-
"app/odatano"
|
|
148
|
-
],
|
|
149
|
-
"directories": {
|
|
150
|
-
"doc": "docs",
|
|
151
|
-
"test": "test"
|
|
152
|
-
},
|
|
153
|
-
"repository": {
|
|
154
|
-
"type": "git",
|
|
155
|
-
"url": "git+https://github.com/ODATANO/ODATANO.git"
|
|
156
|
-
},
|
|
157
|
-
"keywords": [
|
|
158
|
-
"CAP",
|
|
159
|
-
"CDS",
|
|
160
|
-
"plugin",
|
|
161
|
-
"Cardano",
|
|
162
|
-
"blockchain",
|
|
163
|
-
"OData",
|
|
164
|
-
"SAP"
|
|
165
|
-
],
|
|
166
|
-
"author": "Maximilian Weber",
|
|
167
|
-
"license": "Apache-2.0",
|
|
168
|
-
"type": "commonjs",
|
|
169
|
-
"bugs": {
|
|
170
|
-
"url": "https://github.com/ODATANO/ODATANO/issues"
|
|
171
|
-
},
|
|
172
|
-
"homepage": "https://github.com/ODATANO/ODATANO#readme"
|
|
173
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@odatano/core",
|
|
3
|
+
"version": "2.0.0-rc.5",
|
|
4
|
+
"description": "SAP CAP plugin for Cardano blockchain OData V4 integration",
|
|
5
|
+
"imports": {
|
|
6
|
+
"#cds-models/*": "./@cds-models/*/index.js"
|
|
7
|
+
},
|
|
8
|
+
"main": "src/index.js",
|
|
9
|
+
"types": "src/index.d.ts",
|
|
10
|
+
"files": [
|
|
11
|
+
"cds-plugin.js",
|
|
12
|
+
"src/**/*.js",
|
|
13
|
+
"src/**/*.d.ts",
|
|
14
|
+
"srv/**/*.js",
|
|
15
|
+
"srv/**/*.d.ts",
|
|
16
|
+
"srv/**/*.cds",
|
|
17
|
+
"db/**/*.cds",
|
|
18
|
+
"@cds-models/"
|
|
19
|
+
],
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=22.5"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"@sap/cds": ">=10"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@blockfrost/blockfrost-js": "~6.0.0",
|
|
28
|
+
"@cap-js/hana": "^3",
|
|
29
|
+
"@cardano-ogmios/client": "^6.14.0",
|
|
30
|
+
"@harmoniclabs/buildooor": "0.2.9",
|
|
31
|
+
"@harmoniclabs/cardano-costmodels-ts": "~1.6.1",
|
|
32
|
+
"@harmoniclabs/cardano-ledger-ts": "^0.5.6",
|
|
33
|
+
"@harmoniclabs/cbor": "^2.0.1",
|
|
34
|
+
"@harmoniclabs/crypto": "^0.3.0",
|
|
35
|
+
"@harmoniclabs/uint8array-utils": "^1.0.4",
|
|
36
|
+
"@sap/xssec": "^4",
|
|
37
|
+
"axios": "^1.18.0",
|
|
38
|
+
"bech32": "^2.0.0",
|
|
39
|
+
"blake2b": "^2.1.4"
|
|
40
|
+
},
|
|
41
|
+
"optionalDependencies": {
|
|
42
|
+
"pkcs11js": "^2.1.6"
|
|
43
|
+
},
|
|
44
|
+
"overrides": {
|
|
45
|
+
"axios": "^1.18.0",
|
|
46
|
+
"esbuild": "0.28.1",
|
|
47
|
+
"form-data": "^4.0.6",
|
|
48
|
+
"fast-uri": "^3.1.7",
|
|
49
|
+
"ws": "7.5.11",
|
|
50
|
+
"@sap/approuter": {
|
|
51
|
+
"body-parser": "^2.2.3"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@cap-js/cds-test": "^0.4.1",
|
|
56
|
+
"@cap-js/cds-typer": "^0.40.0",
|
|
57
|
+
"@cap-js/cds-types": "^0.18.0",
|
|
58
|
+
"@cap-js/sqlite": "^3",
|
|
59
|
+
"@sap/cds": "^10",
|
|
60
|
+
"@sap/cds-dk": "^10",
|
|
61
|
+
"@sap/eslint-plugin-cds": "^4.2.4",
|
|
62
|
+
"@types/blake2b": "^2.1.3",
|
|
63
|
+
"@types/node": "^22.19.7",
|
|
64
|
+
"@typescript-eslint/eslint-plugin": "^8.50.1",
|
|
65
|
+
"@typescript-eslint/parser": "^8.50.1",
|
|
66
|
+
"@vitest/coverage-v8": "^4.1.10",
|
|
67
|
+
"dotenv": "^16.3.1",
|
|
68
|
+
"eslint": "^9.39.2",
|
|
69
|
+
"nock": "^13.5.6",
|
|
70
|
+
"ts-node": "^10.9.2",
|
|
71
|
+
"tsx": "^4.21.0",
|
|
72
|
+
"typescript": "^5.9.3",
|
|
73
|
+
"vitest": "^4.1.10"
|
|
74
|
+
},
|
|
75
|
+
"cds": {
|
|
76
|
+
"typer": {
|
|
77
|
+
"ieee754compatible": true
|
|
78
|
+
},
|
|
79
|
+
"build": {
|
|
80
|
+
"tasks": [
|
|
81
|
+
{
|
|
82
|
+
"for": "node-cf",
|
|
83
|
+
"src": "srv",
|
|
84
|
+
"dest": "../gen/srv"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"for": "hana",
|
|
88
|
+
"src": "db",
|
|
89
|
+
"dest": "../gen/db"
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
},
|
|
93
|
+
"requires": {
|
|
94
|
+
"db": {
|
|
95
|
+
"kind": "sqlite",
|
|
96
|
+
"credentials": {
|
|
97
|
+
"url": "db.sqlite"
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"[production]": {
|
|
101
|
+
"db": {
|
|
102
|
+
"kind": "hana",
|
|
103
|
+
"pool": {
|
|
104
|
+
"acquireTimeoutMillis": 30000,
|
|
105
|
+
"min": 0,
|
|
106
|
+
"max": 10
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"auth": "xsuaa"
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"scripts": {
|
|
114
|
+
"clean": "node -e \"const fs=require('fs');fs.globSync('{srv,db,src}/**/*.{js,js.map,d.ts,d.ts.map}').filter(f=>!f.includes('node_modules')).forEach(f=>fs.unlinkSync(f));console.log('Clean complete')\"",
|
|
115
|
+
"clean:models": "node -e \"require('fs').rmSync('@cds-models',{recursive:true,force:true});console.log('Removed @cds-models')\"",
|
|
116
|
+
"build": "npm run cds:types && tsc",
|
|
117
|
+
"build:plugin": "npm run cds:types && tsc -p tsconfig.build.json",
|
|
118
|
+
"build:package": "npm run clean && npm run clean:models && npm run build:plugin",
|
|
119
|
+
"prepare": "npm run build:package",
|
|
120
|
+
"start": "cds-serve",
|
|
121
|
+
"cds:watch": "cds watch",
|
|
122
|
+
"cds:serve": "cds serve --with-mocks",
|
|
123
|
+
"cds:types": "cds-typer \"*\" --outputDirectory @cds-models",
|
|
124
|
+
"lint": "eslint .",
|
|
125
|
+
"typecheck": "tsc --noEmit",
|
|
126
|
+
"db:deploy": "cds deploy",
|
|
127
|
+
"pretest": "npm run clean && npm run cds:types && npm run db:deploy",
|
|
128
|
+
"test": "vitest run",
|
|
129
|
+
"pretest:coverage": "npm run clean && npm run cds:types && npm run db:deploy",
|
|
130
|
+
"test:coverage": "vitest run --coverage",
|
|
131
|
+
"pretest:ci": "npm run clean && npm run cds:types && npm run db:deploy",
|
|
132
|
+
"test:ci": "vitest run --exclude \"**/core-ogmios.test.ts\"",
|
|
133
|
+
"pretest:ci:coverage": "npm run clean && npm run cds:types && npm run db:deploy",
|
|
134
|
+
"test:ci:coverage": "vitest run --coverage --exclude \"**/core-ogmios.test.ts\"",
|
|
135
|
+
"pretest:integration": "npm run clean && npm run cds:types && npm run db:deploy",
|
|
136
|
+
"test:integration": "vitest run --project integration",
|
|
137
|
+
"test:integration:blockfrost": "vitest run test/integration/core.blockfrost.test.ts",
|
|
138
|
+
"test:integration:koios": "vitest run test/integration/core.koios.test.ts",
|
|
139
|
+
"test:integration:ogmios": "vitest run test/integration/core-ogmios.test.ts",
|
|
140
|
+
"test:integration:both": "npm run test:integration:blockfrost && npm run test:integration:koios",
|
|
141
|
+
"pretest:unit": "npm run cds:types",
|
|
142
|
+
"test:unit": "vitest run --project unit",
|
|
143
|
+
"watch-odatano": "cds watch --open odatano/index.html?sap-ui-xx-viewCache=false --livereload false",
|
|
144
|
+
"watch-wallet": "cds watch --open wallet/webapp/index.html"
|
|
145
|
+
},
|
|
146
|
+
"sapux": [
|
|
147
|
+
"app/odatano"
|
|
148
|
+
],
|
|
149
|
+
"directories": {
|
|
150
|
+
"doc": "docs",
|
|
151
|
+
"test": "test"
|
|
152
|
+
},
|
|
153
|
+
"repository": {
|
|
154
|
+
"type": "git",
|
|
155
|
+
"url": "git+https://github.com/ODATANO/ODATANO.git"
|
|
156
|
+
},
|
|
157
|
+
"keywords": [
|
|
158
|
+
"CAP",
|
|
159
|
+
"CDS",
|
|
160
|
+
"plugin",
|
|
161
|
+
"Cardano",
|
|
162
|
+
"blockchain",
|
|
163
|
+
"OData",
|
|
164
|
+
"SAP"
|
|
165
|
+
],
|
|
166
|
+
"author": "Maximilian Weber",
|
|
167
|
+
"license": "Apache-2.0",
|
|
168
|
+
"type": "commonjs",
|
|
169
|
+
"bugs": {
|
|
170
|
+
"url": "https://github.com/ODATANO/ODATANO/issues"
|
|
171
|
+
},
|
|
172
|
+
"homepage": "https://github.com/ODATANO/ODATANO#readme"
|
|
173
|
+
}
|
package/src/index.d.ts
CHANGED
|
@@ -4,6 +4,12 @@ export { CardanoIndexer } from '../srv/blockchain/cardano-indexer';
|
|
|
4
4
|
export { CardanoTransactionBuilder } from '../srv/blockchain/cardano-tx-builder';
|
|
5
5
|
export { getAppContext, getCardanoIndexer, getCardanoClient, getCardanoTxBuilder, loadConfigFromEnv, loadHsmConfigFromEnv, loadCrawlerConfigFromEnv, startCrawlerIfConfigured, loadWalletWorkerConfigFromEnv, startWalletWorkerIfConfigured, shutdownAppContext, } from '../srv/server';
|
|
6
6
|
export { getHsmSigner } from '../srv/blockchain/signing/hsm-signer';
|
|
7
|
+
export { issueAgentGrant, revokeAgentGrantById, hashAgentToken, AGENT_TOKEN_HEADER, AGENT_TOKEN_PREFIX, AGENT_ROLE, AGENT_ALLOWLISTABLE_ACTIONS, AGENT_ALWAYS_ALLOWED_EVENTS, } from '../srv/utils/agent-grants';
|
|
8
|
+
export type { IssueAgentGrantInput, IssuedAgentGrant, AgentGrantStatus } from '../srv/utils/agent-grants';
|
|
9
|
+
export { registerTransportLane } from '../srv/utils/agent-token-auth';
|
|
10
|
+
export type { TransportLane, LaneOutcome } from '../srv/utils/agent-token-auth';
|
|
11
|
+
export { loadAgentGrantsConfig } from '../srv/utils/agent-grants-config';
|
|
12
|
+
export type { AgentGrantsConfig } from '../srv/utils/agent-grants-config';
|
|
7
13
|
export type { HsmConfig, HsmSignResult } from '../srv/utils/types';
|
|
8
14
|
export { parseTransaction } from '../srv/cbor';
|
|
9
15
|
export type { ParsedTransaction, ParsedInput, ParsedOutput, ParsedAsset, ParsedWitnesses, } from '../srv/cbor';
|
package/src/index.js
CHANGED
|
@@ -36,7 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.parseTransaction = exports.getHsmSigner = exports.shutdownAppContext = exports.startWalletWorkerIfConfigured = exports.loadWalletWorkerConfigFromEnv = exports.startCrawlerIfConfigured = exports.loadCrawlerConfigFromEnv = exports.loadHsmConfigFromEnv = exports.loadConfigFromEnv = exports.getCardanoTxBuilder = exports.getCardanoClient = exports.getCardanoIndexer = exports.getAppContext = exports.CardanoTransactionBuilder = exports.CardanoIndexer = exports.CardanoClient = void 0;
|
|
39
|
+
exports.parseTransaction = exports.loadAgentGrantsConfig = exports.registerTransportLane = exports.AGENT_ALWAYS_ALLOWED_EVENTS = exports.AGENT_ALLOWLISTABLE_ACTIONS = exports.AGENT_ROLE = exports.AGENT_TOKEN_PREFIX = exports.AGENT_TOKEN_HEADER = exports.hashAgentToken = exports.revokeAgentGrantById = exports.issueAgentGrant = exports.getHsmSigner = exports.shutdownAppContext = exports.startWalletWorkerIfConfigured = exports.loadWalletWorkerConfigFromEnv = exports.startCrawlerIfConfigured = exports.loadCrawlerConfigFromEnv = exports.loadHsmConfigFromEnv = exports.loadConfigFromEnv = exports.getCardanoTxBuilder = exports.getCardanoClient = exports.getCardanoIndexer = exports.getAppContext = exports.CardanoTransactionBuilder = exports.CardanoIndexer = exports.CardanoClient = void 0;
|
|
40
40
|
exports.initialize = initialize;
|
|
41
41
|
exports.shutdown = shutdown;
|
|
42
42
|
exports.getStatus = getStatus;
|
|
@@ -65,6 +65,22 @@ Object.defineProperty(exports, "shutdownAppContext", { enumerable: true, get: fu
|
|
|
65
65
|
// Re-export HSM signer for programmatic access
|
|
66
66
|
var hsm_signer_1 = require("../srv/blockchain/signing/hsm-signer");
|
|
67
67
|
Object.defineProperty(exports, "getHsmSigner", { enumerable: true, get: function () { return hsm_signer_1.getHsmSigner; } });
|
|
68
|
+
// Agent grants (v2.0, AGENT_GRANTS_DESIGN.md): the programmatic seams other
|
|
69
|
+
// packages build on — @odatano/x402 sells grants through issueAgentGrant and
|
|
70
|
+
// adds its payment lane through registerTransportLane.
|
|
71
|
+
var agent_grants_1 = require("../srv/utils/agent-grants");
|
|
72
|
+
Object.defineProperty(exports, "issueAgentGrant", { enumerable: true, get: function () { return agent_grants_1.issueAgentGrant; } });
|
|
73
|
+
Object.defineProperty(exports, "revokeAgentGrantById", { enumerable: true, get: function () { return agent_grants_1.revokeAgentGrantById; } });
|
|
74
|
+
Object.defineProperty(exports, "hashAgentToken", { enumerable: true, get: function () { return agent_grants_1.hashAgentToken; } });
|
|
75
|
+
Object.defineProperty(exports, "AGENT_TOKEN_HEADER", { enumerable: true, get: function () { return agent_grants_1.AGENT_TOKEN_HEADER; } });
|
|
76
|
+
Object.defineProperty(exports, "AGENT_TOKEN_PREFIX", { enumerable: true, get: function () { return agent_grants_1.AGENT_TOKEN_PREFIX; } });
|
|
77
|
+
Object.defineProperty(exports, "AGENT_ROLE", { enumerable: true, get: function () { return agent_grants_1.AGENT_ROLE; } });
|
|
78
|
+
Object.defineProperty(exports, "AGENT_ALLOWLISTABLE_ACTIONS", { enumerable: true, get: function () { return agent_grants_1.AGENT_ALLOWLISTABLE_ACTIONS; } });
|
|
79
|
+
Object.defineProperty(exports, "AGENT_ALWAYS_ALLOWED_EVENTS", { enumerable: true, get: function () { return agent_grants_1.AGENT_ALWAYS_ALLOWED_EVENTS; } });
|
|
80
|
+
var agent_token_auth_1 = require("../srv/utils/agent-token-auth");
|
|
81
|
+
Object.defineProperty(exports, "registerTransportLane", { enumerable: true, get: function () { return agent_token_auth_1.registerTransportLane; } });
|
|
82
|
+
var agent_grants_config_1 = require("../srv/utils/agent-grants-config");
|
|
83
|
+
Object.defineProperty(exports, "loadAgentGrantsConfig", { enumerable: true, get: function () { return agent_grants_config_1.loadAgentGrantsConfig; } });
|
|
68
84
|
// Re-export pure CBOR utilities (no CAP round-trip needed)
|
|
69
85
|
var cbor_1 = require("../srv/cbor");
|
|
70
86
|
Object.defineProperty(exports, "parseTransaction", { enumerable: true, get: function () { return cbor_1.parseTransaction; } });
|
package/src/plugin.js
CHANGED
|
@@ -52,32 +52,46 @@ if (!cds_1.default.env.requires) {
|
|
|
52
52
|
if (!cds_1.default.env.requires.kinds) {
|
|
53
53
|
cds_1.default.env.requires.kinds = {};
|
|
54
54
|
}
|
|
55
|
+
/** The schema and the six CDS services this package ships, package-qualified. */
|
|
56
|
+
const PLUGIN_MODEL = [
|
|
57
|
+
'@odatano/core/db/schema',
|
|
58
|
+
'@odatano/core/srv/cardano-service',
|
|
59
|
+
'@odatano/core/srv/cardano-tx-service',
|
|
60
|
+
'@odatano/core/srv/cardano-sign-service',
|
|
61
|
+
'@odatano/core/srv/cardano-indexer-service',
|
|
62
|
+
'@odatano/core/srv/cardano-worker-service',
|
|
63
|
+
'@odatano/core/srv/cardano-agent-service'
|
|
64
|
+
];
|
|
65
|
+
/** Relative `@impl` values used in the CDS files (rewritten in plugin mode, see below). */
|
|
66
|
+
const IMPL_PATHS = [
|
|
67
|
+
'srv/cardano-service',
|
|
68
|
+
'srv/cardano-tx-service',
|
|
69
|
+
'srv/cardano-sign-service',
|
|
70
|
+
'srv/cardano-indexer-service',
|
|
71
|
+
'srv/cardano-worker-service',
|
|
72
|
+
'srv/cardano-agent-service'
|
|
73
|
+
];
|
|
55
74
|
cds_1.default.env.requires.kinds['odatano-core'] = {
|
|
56
75
|
impl: '@odatano/core',
|
|
57
|
-
model: [
|
|
58
|
-
'@odatano/core/db/schema',
|
|
59
|
-
'@odatano/core/srv/cardano-service',
|
|
60
|
-
'@odatano/core/srv/cardano-tx-service',
|
|
61
|
-
'@odatano/core/srv/cardano-sign-service',
|
|
62
|
-
'@odatano/core/srv/cardano-indexer-service',
|
|
63
|
-
'@odatano/core/srv/cardano-worker-service'
|
|
64
|
-
]
|
|
76
|
+
model: [...PLUGIN_MODEL]
|
|
65
77
|
};
|
|
66
78
|
// CRITICAL: Also set model directly on the requires entry.
|
|
67
79
|
// CAP's _link_required_services() merges kind→requires BEFORE cds-plugin.js runs,
|
|
68
80
|
// so the model array on the kind is never merged. Set it directly.
|
|
69
81
|
const req = cds_1.default.env.requires['odatano-core'];
|
|
70
82
|
if (req) {
|
|
71
|
-
req.model = [
|
|
72
|
-
'@odatano/core/db/schema',
|
|
73
|
-
'@odatano/core/srv/cardano-service',
|
|
74
|
-
'@odatano/core/srv/cardano-tx-service',
|
|
75
|
-
'@odatano/core/srv/cardano-sign-service',
|
|
76
|
-
'@odatano/core/srv/cardano-indexer-service',
|
|
77
|
-
'@odatano/core/srv/cardano-worker-service'
|
|
78
|
-
];
|
|
83
|
+
req.model = [...PLUGIN_MODEL];
|
|
79
84
|
}
|
|
80
85
|
logger.debug('Plugin registered');
|
|
86
|
+
/**
|
|
87
|
+
* Agent grants (AGENT_GRANTS_DESIGN.md). Off by default; switched on by
|
|
88
|
+
* cds.requires.odatano-core.agentGrants.enabled / AGENT_GRANTS_ENABLED=true.
|
|
89
|
+
* Has to run at plugin load, before CAP builds its middlewares (the auth impl
|
|
90
|
+
* is swapped here). srv/server.ts makes the same call for standalone mode, where
|
|
91
|
+
* this file is never loaded; the call is idempotent and never throws.
|
|
92
|
+
*/
|
|
93
|
+
require('../srv/utils/agent-grants-config')
|
|
94
|
+
.activateAgentGrants();
|
|
81
95
|
/**
|
|
82
96
|
* Rewrite @impl paths for plugin mode.
|
|
83
97
|
* CDS files use relative @impl (e.g. 'srv/cardano-service') which resolves from cds.root.
|
|
@@ -90,20 +104,9 @@ cds_1.default.on('loaded', (model) => {
|
|
|
90
104
|
return;
|
|
91
105
|
const defs = model.definitions ?? {};
|
|
92
106
|
for (const def of Object.values(defs)) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
else if (def['@impl'] === 'srv/cardano-tx-service') {
|
|
97
|
-
def['@impl'] = '@odatano/core/srv/cardano-tx-service';
|
|
98
|
-
}
|
|
99
|
-
else if (def['@impl'] === 'srv/cardano-sign-service') {
|
|
100
|
-
def['@impl'] = '@odatano/core/srv/cardano-sign-service';
|
|
101
|
-
}
|
|
102
|
-
else if (def['@impl'] === 'srv/cardano-indexer-service') {
|
|
103
|
-
def['@impl'] = '@odatano/core/srv/cardano-indexer-service';
|
|
104
|
-
}
|
|
105
|
-
else if (def['@impl'] === 'srv/cardano-worker-service') {
|
|
106
|
-
def['@impl'] = '@odatano/core/srv/cardano-worker-service';
|
|
107
|
+
const impl = def['@impl'];
|
|
108
|
+
if (impl && IMPL_PATHS.includes(impl)) {
|
|
109
|
+
def['@impl'] = `@odatano/core/${impl}`;
|
|
107
110
|
}
|
|
108
111
|
}
|
|
109
112
|
});
|
|
@@ -140,10 +140,30 @@ export declare class BuildooorTxBuilder implements CardanoTxBuilder {
|
|
|
140
140
|
* Returns empty array when no reference inputs are provided.
|
|
141
141
|
*/
|
|
142
142
|
private _mapReferenceInputs;
|
|
143
|
+
/**
|
|
144
|
+
* Funding requirement contributed by extra outputs on a mint build:
|
|
145
|
+
* the summed lovelace of all entries plus, per asset unit, the demand the
|
|
146
|
+
* transaction's own positive mints do NOT cover. Minted quantities are
|
|
147
|
+
* aggregated per unit and subtracted from the aggregated output demand;
|
|
148
|
+
* only a positive remainder is requested from the wallet (a fully covered
|
|
149
|
+
* unit is not requested at all — it does not exist before this tx).
|
|
150
|
+
*/
|
|
151
|
+
private _extraOutputsFundingAfterMint;
|
|
152
|
+
/**
|
|
153
|
+
* The script an individual mint action executes under: its own
|
|
154
|
+
* per-action policy when set (multi-policy mint FR), else the request's
|
|
155
|
+
* top-level policy script.
|
|
156
|
+
*/
|
|
157
|
+
private _mintActionScript;
|
|
143
158
|
/**
|
|
144
159
|
* Build the Buildooor mint-entry array shared by the mint-only flow and the
|
|
145
160
|
* combined spend+mint flow (Buildooor ignores caller-supplied execution units;
|
|
146
161
|
* they are stamped into the redeemers post-build by _buildScriptTx).
|
|
162
|
+
*
|
|
163
|
+
* Multi-policy mint FR: each action may carry its own policy script and
|
|
164
|
+
* redeemer; absent fields fall back to the request-level ones. The ledger
|
|
165
|
+
* carries ONE redeemer per policy, so actions resolving to the same policy
|
|
166
|
+
* must agree on their redeemer, checked here.
|
|
147
167
|
*/
|
|
148
168
|
private _buildMintEntries;
|
|
149
169
|
/**
|