@decentrys/protect 0.1.0 → 0.1.2
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 +279 -39
- package/dist/browser/decentrys-protect.js +1 -1
- package/dist/browser/decentrys-protect.mjs +1 -1
- package/dist/client.d.ts +8 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +8 -1
- package/dist/client.js.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +8 -1
package/README.md
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
# @decentrys/protect
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Tells a user what a transaction actually does, before they sign it — without calling every new project a scam.**
|
|
4
|
+
|
|
5
|
+
You give it a pending transaction, a contract, a token or an address. It returns
|
|
6
|
+
observed facts, what the code *can* do, any threat signals with the evidence
|
|
7
|
+
behind them, and an explicit list of what it could not determine. Your app
|
|
8
|
+
decides what to do with that.
|
|
4
9
|
|
|
5
10
|
> **Lack of evidence is not evidence of malice.**
|
|
6
11
|
>
|
|
7
12
|
> A contract deployed two hours ago by an anonymous wallet with no audit and
|
|
8
|
-
> thin liquidity is *unknown*, not dangerous.
|
|
9
|
-
>
|
|
10
|
-
>
|
|
11
|
-
> to do that, and there is no code path by which newness can raise a risk
|
|
13
|
+
> thin liquidity is *unknown*, not dangerous. Most tooling scores those facts as
|
|
14
|
+
> risk, which taxes every new project and protects incumbents. There is no code
|
|
15
|
+
> path in this package by which newness, anonymity or obscurity can raise a risk
|
|
12
16
|
> level.
|
|
13
17
|
|
|
14
18
|
## Install
|
|
@@ -17,66 +21,302 @@ Evidence-based on-chain risk assessment for wallets and dapps.
|
|
|
17
21
|
npm install @decentrys/protect
|
|
18
22
|
```
|
|
19
23
|
|
|
20
|
-
|
|
24
|
+
Zero dependencies — `package.json` declares none. Node 18+, browsers,
|
|
25
|
+
extensions and React Native. TypeScript types are included.
|
|
26
|
+
|
|
27
|
+
## Getting an API key
|
|
28
|
+
|
|
29
|
+
Sign in at [decentrys.com/developers](https://decentrys.com/developers) and create a key.
|
|
30
|
+
|
|
31
|
+
There are two kinds, and picking the wrong one is the mistake that matters:
|
|
32
|
+
|
|
33
|
+
| Prefix | Where it belongs | Why |
|
|
34
|
+
|---|---|---|
|
|
35
|
+
| `dk_pub_live_…` | **Publishable.** Ships inside a wallet, extension or mobile app. | Bounded to the origins you register and to read-only Protect endpoints. Anyone can extract it from your bundle; that's expected, and it's why it can't do anything dangerous. |
|
|
36
|
+
| `dk_live_…` | **Secret.** Server-side only. | Full scope access. If this ends up in a client bundle it is a leaked credential the moment it ships. |
|
|
37
|
+
|
|
38
|
+
`dk_pub_test_…` and `dk_test_…` are the same two kinds against test data.
|
|
39
|
+
|
|
40
|
+
## First call
|
|
21
41
|
|
|
22
42
|
```ts
|
|
23
43
|
import { Decentrys } from '@decentrys/protect';
|
|
24
44
|
|
|
25
|
-
const decentrys = new Decentrys({
|
|
45
|
+
const decentrys = new Decentrys({
|
|
46
|
+
apiKey: 'dk_pub_live_...',
|
|
47
|
+
failMode: 'warn', // what to do if Decentrys is unreachable
|
|
48
|
+
timeoutMs: 4_000, // a deadline, not a target
|
|
49
|
+
});
|
|
26
50
|
|
|
27
|
-
const
|
|
51
|
+
const result = await decentrys.assessTransaction({
|
|
28
52
|
chain: 'ethereum',
|
|
29
53
|
from: userAddress,
|
|
30
54
|
to: contractAddress,
|
|
31
55
|
data: calldata,
|
|
32
56
|
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Every assessment method resolves to the same `ProtectResult`. **The risk fields
|
|
60
|
+
live under `result.assessment`, not on `result` itself.**
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
const { assessment, decision, subject, cached, demotedSignals } = result;
|
|
64
|
+
|
|
65
|
+
assessment.riskLevel // 'CAUTION'
|
|
66
|
+
assessment.historyStatus // 'LIMITED' ← not a warning; see below
|
|
67
|
+
assessment.confidence // 0.5 — how sure we are of the classification, not how safe it is
|
|
68
|
+
assessment.confirmedMalicious
|
|
69
|
+
assessment.facts // ObservedFact[] — directly verifiable, no accusation
|
|
70
|
+
assessment.capabilities // TechnicalCapability[] — what the code CAN do
|
|
71
|
+
assessment.threatSignals // ThreatSignal[] — the only thing that raises a level
|
|
72
|
+
assessment.unknowns // UnknownField[] — stated, never silently omitted
|
|
73
|
+
assessment.explanation // string[] — never empty; no black-box classifications
|
|
74
|
+
assessment.components // technicalRisk, behavioralRisk, threatIntelligenceRisk, historyConfidence
|
|
75
|
+
assessment.modelVersion // 'protect-1.0.0'
|
|
76
|
+
assessment.assessedAt
|
|
77
|
+
|
|
78
|
+
decision.action // what YOUR policy says to do — advice, never enforced
|
|
79
|
+
decision.reason
|
|
80
|
+
subject // { kind, chain, identifier }
|
|
81
|
+
cached // served from the local TTL cache rather than the network
|
|
82
|
+
demotedSignals // coverage signals the SDK refused to treat as risk
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
A response, abridged to the interesting parts:
|
|
86
|
+
|
|
87
|
+
```jsonc
|
|
88
|
+
{
|
|
89
|
+
"assessment": {
|
|
90
|
+
"riskLevel": "CAUTION",
|
|
91
|
+
"confirmedMalicious": false,
|
|
92
|
+
"confidence": 0.5,
|
|
93
|
+
"historyStatus": "LIMITED",
|
|
94
|
+
|
|
95
|
+
// Directly verifiable. Carry no accusation.
|
|
96
|
+
"facts": [
|
|
97
|
+
{ "type": "DEPLOYED_AT", "value": "2026-09-04",
|
|
98
|
+
"statement": "The contract was deployed on 2026-09-04.",
|
|
99
|
+
"source": "etherscan", "observedAt": "2026-09-06T09:00:00.000Z" },
|
|
100
|
+
// Arrived as a threat signal; demoted here, because newness is history.
|
|
101
|
+
{ "type": "NEW_CONTRACT", "value": null,
|
|
102
|
+
"statement": "The contract was deployed recently.",
|
|
103
|
+
"source": "decentrys", "observedAt": "2026-09-06T09:00:00.000Z" }
|
|
104
|
+
],
|
|
105
|
+
|
|
106
|
+
// What the code CAN do. A capability is not a vulnerability.
|
|
107
|
+
"capabilities": [
|
|
108
|
+
{ "type": "UPGRADEABLE", "severity": "SIGNIFICANT",
|
|
109
|
+
"statement": "The contract is a proxy: whoever holds its upgrade rights can replace its logic after you approve it." }
|
|
110
|
+
],
|
|
111
|
+
|
|
112
|
+
// The only thing that can raise a risk level. Each carries its evidence.
|
|
113
|
+
"threatSignals": [],
|
|
114
|
+
|
|
115
|
+
// Stated, never silently omitted.
|
|
116
|
+
"unknowns": [
|
|
117
|
+
{ "field": "simulation", "reason": "INSUFFICIENT_DATA",
|
|
118
|
+
"statement": "The transaction was not simulated, so its effect on balances is not known here." }
|
|
119
|
+
],
|
|
120
|
+
|
|
121
|
+
"components": { "technicalRisk": 25, "behavioralRisk": 0, "threatIntelligenceRisk": 0, "historyConfidence": 25 },
|
|
122
|
+
"explanation": [
|
|
123
|
+
"The contract is a proxy: …",
|
|
124
|
+
"Little history is available yet. This is normal for anything recently deployed and is not a risk finding.",
|
|
125
|
+
"1 attribute is unknown. Unknown is reported as unknown; it does not contribute to risk."
|
|
126
|
+
],
|
|
127
|
+
"modelVersion": "protect-1.0.0",
|
|
128
|
+
"assessedAt": "2026-09-06T09:00:00.000Z"
|
|
129
|
+
},
|
|
130
|
+
"decision": { "action": "warn", "reason": "The contract is a proxy: …" },
|
|
131
|
+
"subject": { "kind": "transaction", "chain": "ethereum", "identifier": "0xabc…" },
|
|
132
|
+
"cached": false,
|
|
133
|
+
"demotedSignals": ["NEW_CONTRACT"]
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Wiring it into a wallet
|
|
138
|
+
|
|
139
|
+
```ts
|
|
140
|
+
async function beforeSigning(tx: TransactionRequest) {
|
|
141
|
+
// 1. Assess.
|
|
142
|
+
const result = await decentrys.assessTransaction(tx);
|
|
143
|
+
const { assessment, decision } = result;
|
|
144
|
+
|
|
145
|
+
// 2. If nothing was checked, say so. Do not show a green tick.
|
|
146
|
+
if (assessment.unknowns.some((u) => u.reason === 'PROVIDER_UNAVAILABLE')) {
|
|
147
|
+
return showUnavailable(assessment.explanation);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// 3. Say what it does, in words.
|
|
151
|
+
const explained = await decentrys.explainTransaction(tx);
|
|
152
|
+
explained.summary; // "Grant 0x1111… unlimited permission to spend the token at 0xabc… from your wallet."
|
|
153
|
+
explained.actions; // each distinct thing it does, in order
|
|
154
|
+
explained.exposure; // what the signer gives up if this is not what they intended
|
|
155
|
+
explained.undecoded; // anything the decoder could not resolve, stated as unresolved
|
|
156
|
+
|
|
157
|
+
// 4. Act on YOUR policy, not ours.
|
|
158
|
+
switch (decision.action) {
|
|
159
|
+
case 'allow': return sign();
|
|
160
|
+
case 'inform': return showDetails(result);
|
|
161
|
+
case 'warn':
|
|
162
|
+
case 'warn_strong': return showWarning(result);
|
|
163
|
+
case 'require_confirmation': return showWarning(result, { requireTypedConfirm: true });
|
|
164
|
+
case 'block': return refuse(result);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Render it with [`@decentrys/ui-sdk`](https://www.npmjs.com/package/@decentrys/ui-sdk) if you don't want to build the UI yourself.
|
|
170
|
+
|
|
171
|
+
## Every method
|
|
172
|
+
|
|
173
|
+
| Method | Returns | Answers |
|
|
174
|
+
|---|---|---|
|
|
175
|
+
| `assessTransaction(tx)` | `ProtectResult` | Is this transaction worth warning about? |
|
|
176
|
+
| `screenApproval({chain,owner,spender,token,amount?})` | `ProtectResult` | What am I granting, and to whom? |
|
|
177
|
+
| `scanContract({chain,address})` | `ProtectResult` | What can this contract do — upgrade, mint, pause, freeze? |
|
|
178
|
+
| `screenToken({chain,address})` | `ProtectResult` | What is this token, and what powers does it hold? |
|
|
179
|
+
| `screenAddress({chain,address})` | `ProtectResult` | What is known about this address? |
|
|
180
|
+
| `assessDapp({origin,chain?})` | `ProtectResult` | Is this site reported phishing infrastructure? |
|
|
181
|
+
| `explainTransaction(tx)` | `TransactionExplanation` | What does it actually do, in plain language? |
|
|
182
|
+
| `simulateTransaction(tx)` | `SimulationResult` | What would change if I signed it? |
|
|
183
|
+
| `getThreatSignals({chain,address})` | `ThreatSignal[]` | Signals only, for your own presentation. |
|
|
184
|
+
| `clearCache()` | `void` | Drop cached evidence after a user reports a stale result. |
|
|
33
185
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
186
|
+
Every one of them takes an optional second argument: `{ signal?: AbortSignal, skipCache?: boolean }`.
|
|
187
|
+
|
|
188
|
+
```ts
|
|
189
|
+
const sim = await decentrys.simulateTransaction(tx);
|
|
190
|
+
sim.outcome; // 'SUCCESS' | 'REVERT' | 'NOT_SUPPORTED' | 'UNAVAILABLE'
|
|
191
|
+
sim.balanceChanges; // [{ address, asset, symbol?, decimals?, delta, usdValue? }]
|
|
192
|
+
sim.approvalChanges; // [{ owner, spender, token, symbol?, amount, unlimited }]
|
|
193
|
+
sim.contractsCalled; // in call order
|
|
194
|
+
sim.unavailableReason; // stated, rather than an empty result that reads as "nothing happens"
|
|
39
195
|
```
|
|
40
196
|
|
|
41
|
-
|
|
197
|
+
An unrecognised outcome resolves to `UNAVAILABLE`, never `SUCCESS`. Defaulting
|
|
198
|
+
the other way would let a malformed response read as "this transaction is fine".
|
|
42
199
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
200
|
+
## Configuration
|
|
201
|
+
|
|
202
|
+
```ts
|
|
203
|
+
new Decentrys({
|
|
204
|
+
apiKey: 'dk_pub_live_...', // required
|
|
205
|
+
failMode: 'warn', // 'open' | 'warn' | 'closed' (default 'warn')
|
|
206
|
+
timeoutMs: 4_000, // per attempt (default 4000)
|
|
207
|
+
retries: 1, // idempotent lookups only (default 1)
|
|
208
|
+
policy: { HIGH_RISK: 'block', CAUTION: 'inform' }, // merged over DEFAULT_POLICY
|
|
209
|
+
cacheTtlMs: 120_000, // default 120000
|
|
210
|
+
cacheMaxEntries: 500, // default 500
|
|
211
|
+
baseUrl: 'https://api.decentrys.com',
|
|
212
|
+
fetch: myFetch, // injected, so this works in an extension, RN or a test
|
|
213
|
+
transport: myTransport, // route through your own gateway
|
|
214
|
+
});
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
`assessTransaction` and `screenApproval` are never cached: the same spender with
|
|
218
|
+
an unlimited allowance and with a one-off allowance are different decisions.
|
|
219
|
+
|
|
220
|
+
## Two guarantees
|
|
221
|
+
|
|
222
|
+
**No method throws.** This runs between a user and a signing screen. If
|
|
223
|
+
Decentrys is unreachable you get an assessment saying exactly that in
|
|
224
|
+
`unknowns`, with `confidence: 0` and `historyStatus: 'NONE'` — never a
|
|
225
|
+
reassuring result it didn't earn, and never an exception your wallet has to
|
|
226
|
+
catch mid-signature.
|
|
227
|
+
|
|
228
|
+
```ts
|
|
229
|
+
const { assessment } = await decentrys.screenAddress({ chain: 'ethereum', address });
|
|
230
|
+
if (assessment.unknowns.some((u) => u.reason === 'PROVIDER_UNAVAILABLE')) {
|
|
231
|
+
// Nothing was checked. Say so; don't show a green tick.
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
The constructor is the exception, and deliberately: it throws on a missing
|
|
236
|
+
`apiKey`, or when no global `fetch` exists and none was passed. Those are
|
|
237
|
+
wiring errors a developer makes at deploy time, not events during a user's
|
|
238
|
+
transaction.
|
|
47
239
|
|
|
48
240
|
**It never blocks.** Decentrys returns intelligence; your policy decides. The
|
|
49
|
-
default blocks only `KNOWN_MALICIOUS`, which
|
|
50
|
-
evidence because it
|
|
241
|
+
default (`DEFAULT_POLICY`, exported) blocks only `KNOWN_MALICIOUS`, which
|
|
242
|
+
requires analyst-verified evidence because it's the one output that accuses a
|
|
243
|
+
third party.
|
|
244
|
+
|
|
245
|
+
| Level | Default action |
|
|
246
|
+
|---|---|
|
|
247
|
+
| `NO_CRITICAL_RISK_DETECTED` | `allow` |
|
|
248
|
+
| `INFORMATIONAL` | `inform` |
|
|
249
|
+
| `CAUTION` | `warn` |
|
|
250
|
+
| `ELEVATED_RISK` | `warn_strong` |
|
|
251
|
+
| `HIGH_RISK` | `require_confirmation` |
|
|
252
|
+
| `CRITICAL_THREAT` | `require_confirmation` |
|
|
253
|
+
| `KNOWN_MALICIOUS` | `block` |
|
|
254
|
+
|
|
255
|
+
Nothing in this package acts on those words. `decision.action` is a string your
|
|
256
|
+
code switches on.
|
|
51
257
|
|
|
52
258
|
## Risk levels
|
|
53
259
|
|
|
54
|
-
|
|
55
|
-
`
|
|
56
|
-
|
|
57
|
-
evidence go past it
|
|
260
|
+
`NO_CRITICAL_RISK_DETECTED` · `INFORMATIONAL` · `CAUTION` · `ELEVATED_RISK` ·
|
|
261
|
+
`HIGH_RISK` · `CRITICAL_THREAT` · `KNOWN_MALICIOUS`
|
|
262
|
+
|
|
263
|
+
Capabilities can reach `CAUTION`. Only threat signals with evidence go past it,
|
|
264
|
+
and only signals that are `ACTIVE` and at least `MIN_RAISING_CONFIDENCE` (0.5,
|
|
265
|
+
exported) count — a stale or low-confidence signal is still reported, with the
|
|
266
|
+
explanation saying why it did not raise the level.
|
|
267
|
+
|
|
268
|
+
`RISK_LEVEL_MEANING[level]` gives wording safe to show a user;
|
|
269
|
+
`isAtLeast(level, floor)` compares two levels.
|
|
270
|
+
|
|
271
|
+
**`historyStatus: 'LIMITED'` is not a warning.** It measures how much
|
|
272
|
+
*Decentrys* knows, never the subject's danger, and is the correct state for
|
|
273
|
+
anything recently deployed. `HISTORY_STATUS_MEANING[status]` says so in words.
|
|
274
|
+
Render it neutrally.
|
|
58
275
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
276
|
+
Coverage signals — `NEW_CONTRACT`, `NO_AUDIT`, `ANONYMOUS_DEPLOYER`,
|
|
277
|
+
`LOW_LIQUIDITY` and the rest — are demoted to facts at the wire boundary no
|
|
278
|
+
matter who sends them, and listed in `result.demotedSignals` so you can watch
|
|
279
|
+
the rule being applied.
|
|
62
280
|
|
|
63
|
-
##
|
|
281
|
+
## Classification happens on your side
|
|
64
282
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
283
|
+
The API returns **evidence**; `classify()` runs in this package, in code you can
|
|
284
|
+
read. That is why the rule above is a property you can audit rather than a
|
|
285
|
+
promise on a marketing page — and why a future server change cannot undo it.
|
|
68
286
|
|
|
69
|
-
##
|
|
287
|
+
## Browsers and extensions
|
|
70
288
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
289
|
+
```html
|
|
290
|
+
<script src="node_modules/@decentrys/protect/dist/browser/decentrys-protect.js"></script>
|
|
291
|
+
<script>
|
|
292
|
+
const decentrys = new DecentrysProtect.Decentrys({ apiKey: 'dk_pub_live_...' });
|
|
293
|
+
</script>
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
ESM at `@decentrys/protect/browser`. Both bundles are dependency-free, for pages
|
|
297
|
+
with a strict CSP. Use a **publishable** key here — never `dk_live_`.
|
|
298
|
+
|
|
299
|
+
## Read the tests
|
|
300
|
+
|
|
301
|
+
`src/classify.test.ts` ships inside the package and encodes the cases that must
|
|
302
|
+
never regress — including that a brand-new unaudited contract from an anonymous
|
|
303
|
+
deployer is `INFORMATIONAL`, that two hours of age contributes nothing to
|
|
304
|
+
technical risk, and that no absence of reputation can reach `KNOWN_MALICIOUS`.
|
|
305
|
+
You don't have to take the claim on trust.
|
|
306
|
+
|
|
307
|
+
## The rest of the SDK
|
|
308
|
+
|
|
309
|
+
| Package | For |
|
|
310
|
+
|---|---|
|
|
311
|
+
| [`@decentrys/protect`](https://www.npmjs.com/package/@decentrys/protect) | Pre-sign risk assessment for wallets and dapps |
|
|
312
|
+
| [`@decentrys/ui-sdk`](https://www.npmjs.com/package/@decentrys/ui-sdk) | React components that render Protect results |
|
|
313
|
+
| [`@decentrys/sentinel-sdk`](https://www.npmjs.com/package/@decentrys/sentinel-sdk) | Monitoring deployed contracts and treasuries |
|
|
314
|
+
| [`@decentrys/risk-sdk`](https://www.npmjs.com/package/@decentrys/risk-sdk) | Screening for exchanges and custodians |
|
|
315
|
+
| [`@decentrys/dri-sdk`](https://www.npmjs.com/package/@decentrys/dri-sdk) | Fund tracing and recovery intelligence |
|
|
316
|
+
| [`@decentrys/agent`](https://www.npmjs.com/package/@decentrys/agent) | Policy enforcement for autonomous agents |
|
|
74
317
|
|
|
75
318
|
## Licence
|
|
76
319
|
|
|
77
320
|
MIT © Decentrys Labs
|
|
78
321
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
- [decentrys.com](https://decentrys.com) · [SDK overview](https://decentrys.com/sdk) · [Developer API](https://decentrys.com/developers)
|
|
82
|
-
- Source: [github.com/teamdecentrys-byte/Decentrys](https://github.com/teamdecentrys-byte/Decentrys)
|
|
322
|
+
[decentrys.com](https://decentrys.com) · [SDK overview](https://decentrys.com/sdk) · [Developer API](https://decentrys.com/developers) · [Source](https://github.com/teamdecentrys-byte/Decentrys)
|
|
@@ -591,7 +591,7 @@ function cacheKey(kind, parts) {
|
|
|
591
591
|
}
|
|
592
592
|
|
|
593
593
|
// src/client.ts
|
|
594
|
-
var SDK_VERSION = "0.1.
|
|
594
|
+
var SDK_VERSION = "0.1.2";
|
|
595
595
|
var DEFAULT_BASE_URL = "https://api.decentrys.com";
|
|
596
596
|
var DEFAULT_TIMEOUT_MS = 4e3;
|
|
597
597
|
var DEFAULT_CACHE_TTL_MS = 12e4;
|
package/dist/client.d.ts
CHANGED
|
@@ -17,7 +17,14 @@ import { type FailMode, type Policy, type PolicyAction } from './classify';
|
|
|
17
17
|
import { type FetchLike, type Transport } from './transport';
|
|
18
18
|
import { type SubjectRef } from './wire';
|
|
19
19
|
import { type SimulationResult, type TransactionExplanation } from './simulation';
|
|
20
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Sent in the user-agent on every request.
|
|
22
|
+
*
|
|
23
|
+
* Kept in step with package.json by hand — it drifted once already, and a
|
|
24
|
+
* stale value here silently under-reports the real version in server-side
|
|
25
|
+
* telemetry rather than failing in any visible way.
|
|
26
|
+
*/
|
|
27
|
+
export declare const SDK_VERSION = "0.1.2";
|
|
21
28
|
export interface DecentrysConfig {
|
|
22
29
|
apiKey: string;
|
|
23
30
|
baseUrl?: string;
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,MAAM,EAAE,KAAK,YAAY,EAAgD,MAAM,YAAY,CAAC;AACzH,OAAO,EAAiB,KAAK,SAAS,EAAE,KAAK,SAAS,EAAkB,MAAM,aAAa,CAAC;AAE5F,OAAO,EAA2B,KAAK,UAAU,EAAqB,MAAM,QAAQ,CAAC;AACrF,OAAO,EACL,KAAK,gBAAgB,EAAE,KAAK,sBAAsB,EACnD,MAAM,cAAc,CAAC;AAEtB,eAAO,MAAM,WAAW,UAAU,CAAC;AAOnC,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gDAAgD;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,+EAA+E;IAC/E,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,yEAAyE;IACzE,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,C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,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,aAAa,CAAC;IAW3F,UAAU,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,aAAa,CAAC;IAWzF;;;;;;OAMG;IACG,gBAAgB,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAuBnG,iEAAiE;IAC3D,kBAAkB,CACtB,EAAE,EAAE,kBAAkB,EAAE,OAAO,GAAE,WAAgB,GAChD,OAAO,CAAC,sBAAsB,CAAC;IA0BlC,2EAA2E;IACrE,mBAAmB,CACvB,EAAE,EAAE,kBAAkB,EAAE,OAAO,GAAE,WAAgB,GAChD,OAAO,CAAC,gBAAgB,CAAC;IAkB5B,sEAAsE;IACtE,UAAU,IAAI,IAAI;YAQJ,MAAM;IA6CpB,OAAO,CAAC,MAAM;CAqBf;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,qEAAqE;IACrE,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB"}
|
package/dist/client.js
CHANGED
|
@@ -20,7 +20,14 @@ const transport_1 = require("./transport");
|
|
|
20
20
|
const cache_1 = require("./cache");
|
|
21
21
|
const wire_1 = require("./wire");
|
|
22
22
|
const simulation_1 = require("./simulation");
|
|
23
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Sent in the user-agent on every request.
|
|
25
|
+
*
|
|
26
|
+
* Kept in step with package.json by hand — it drifted once already, and a
|
|
27
|
+
* stale value here silently under-reports the real version in server-side
|
|
28
|
+
* telemetry rather than failing in any visible way.
|
|
29
|
+
*/
|
|
30
|
+
exports.SDK_VERSION = '0.1.2';
|
|
24
31
|
const DEFAULT_BASE_URL = 'https://api.decentrys.com';
|
|
25
32
|
const DEFAULT_TIMEOUT_MS = 4_000;
|
|
26
33
|
const DEFAULT_CACHE_TTL_MS = 120_000;
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;AAGH,yCAAyH;AACzH,2CAA4F;AAC5F,mCAA6C;AAC7C,iCAAqF;AACrF,6CAEsB;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;AAGH,yCAAyH;AACzH,2CAA4F;AAC5F,mCAA6C;AAC7C,iCAAqF;AACrF,6CAEsB;AAEtB;;;;;;GAMG;AACU,QAAA,WAAW,GAAG,OAAO,CAAC;AAEnC,MAAM,gBAAgB,GAAG,2BAA2B,CAAC;AACrD,MAAM,kBAAkB,GAAG,KAAK,CAAC;AACjC,MAAM,oBAAoB,GAAG,OAAO,CAAC;AACrC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAyElC,MAAa,SAAS;IACH,SAAS,CAAY;IACrB,QAAQ,CAAW;IACnB,MAAM,CAAS;IACf,KAAK,CAA+B;IAErD,YAAY,MAAuB;QACjC,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;YAC5C,sEAAsE;YACtE,sEAAsE;YACtE,MAAM,IAAI,KAAK,CAAC,mFAAmF,CAAC,CAAC;QACvG,CAAC;QAED,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC;QAC1C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC;QAClC,IAAI,CAAC,KAAK,GAAG,IAAI,gBAAQ,CAAqB;YAC5C,KAAK,EAAE,MAAM,CAAC,UAAU,IAAI,oBAAoB;YAChD,UAAU,EAAE,MAAM,CAAC,eAAe,IAAI,qBAAqB;SAC5D,CAAC,CAAC;QAEH,IAAI,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,CAAC,SAAS;QACpE,iBAAiB,EAAE,OAAO,IAAI,CAAC,iBAAiB,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS;QAClG,WAAW,EAAE,OAAO,IAAI,CAAC,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KAChG,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decentrys/protect",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Evidence-based on-chain risk assessment for wallets and dapps. Unknown is neutral, risk requires evidence, and nothing is ever called a scam without one.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Decentrys Labs",
|
package/src/client.ts
CHANGED
|
@@ -22,7 +22,14 @@ import {
|
|
|
22
22
|
type SimulationResult, type TransactionExplanation, unavailableSimulation,
|
|
23
23
|
} from './simulation';
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Sent in the user-agent on every request.
|
|
27
|
+
*
|
|
28
|
+
* Kept in step with package.json by hand — it drifted once already, and a
|
|
29
|
+
* stale value here silently under-reports the real version in server-side
|
|
30
|
+
* telemetry rather than failing in any visible way.
|
|
31
|
+
*/
|
|
32
|
+
export const SDK_VERSION = '0.1.2';
|
|
26
33
|
|
|
27
34
|
const DEFAULT_BASE_URL = 'https://api.decentrys.com';
|
|
28
35
|
const DEFAULT_TIMEOUT_MS = 4_000;
|