Add proof-measure client + bump to 1.4.0
Some checks failed
Build and Test / build (16.x) (push) Failing after 45s
Build and Test / build (18.x) (push) Failing after 40s
Publish to NPM Registry / publish (release) Successful in 54s
Build and Test / build (20.x) (push) Failing after 38s

proof-measure is a separate, public, unauthenticated Dragonchain service. Adds:
- UnauthHttpClient: HMAC-free transport mirroring DragonchainClient (timeout,
  agent, redirect refusal).
- ProofMeasureClient: getSecurity / report / health; default base URL
  https://proof-measure.dragonchain.com. Standalone (new ProofMeasureClient())
  and via DragonchainSDK.proofMeasure.
- Proof-measure types (decimals as strings, timestamps as numbers).
- jest tests.
This commit is contained in:
2026-06-04 13:45:09 -04:00
parent a35dc508b0
commit 5a943f45a6
7 changed files with 394 additions and 1 deletions

View File

@@ -145,6 +145,37 @@ await sdk.transactionType.delete('my-type');
const block = await sdk.block.get('block-id');
```
### Proof Measure (public, unauthenticated)
`proof-measure` is a separate, **public, unauthenticated** Dragonchain service
(the measured-immutability / "securedBy" metric) at
`https://proof-measure.dragonchain.com`. It needs no credentials. Decimal fields
are returned as strings (full precision) and timestamps as unix-second numbers.
```typescript
// Via the main SDK (targets the default public endpoint):
const sec = await sdk.proofMeasure.getSecurity('BTC', Math.floor(Date.now() / 1000) - 3600);
console.log(`BTC secured by ${sec.valueUsdFormatted} (${sec.raw.value} ${sec.raw.unit})`);
// Or standalone — no prime credentials needed:
import { ProofMeasureClient } from '@dragonchain-inc/prime-sdk';
const pm = new ProofMeasureClient(); // or new ProofMeasureClient({ baseURL: '...' })
const report = await pm.report({
transactionId: 'tx-123',
primeId: 'my-prime',
blockId: '42',
anchors: [
{ network: 'BTC', txHash: '0x...', timestamp: anchorUnix },
{ network: 'ETH', txHash: '0x...', timestamp: anchorUnix },
],
});
console.log(`Secured by ${report.totalValueUsdFormatted} across ${report.anchors.length} anchors`);
await pm.health();
```
## TypeScript Support
This SDK is written in TypeScript and includes complete type definitions: