Add proof-measure client + bump to 1.4.0
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:
31
README.md
31
README.md
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user