-
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathconsumer.ts
More file actions
46 lines (42 loc) · 1.52 KB
/
Copy pathconsumer.ts
File metadata and controls
46 lines (42 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import assert from 'node:assert/strict';
import {
AdamantApi,
admToSats,
createKeypairFromPassphrase,
type AdamantAddress,
type TransactionDirection,
} from 'adamant-api';
import {AdamantApi as ExplicitAdamantApi} from 'adamant-api/adm';
import {AdamantApi as ApiEntryAdamantApi} from 'adamant-api/api';
import {btc} from 'adamant-api/coins/btc';
import {dash} from 'adamant-api/coins/dash';
import {doge} from 'adamant-api/coins/doge';
import {eth} from 'adamant-api/coins/eth';
import {coinMetadata} from 'adamant-api/metadata';
import {getTransactionId} from 'adamant-api/transactions';
const address: AdamantAddress = 'U123456';
const direction: TransactionDirection = 'incoming';
const api = new AdamantApi({
nodes: ['https://node.example'],
checkHealthAtStartup: false,
logLevel: 'debug',
});
assert.equal(AdamantApi, ExplicitAdamantApi);
assert.equal(AdamantApi, ApiEntryAdamantApi);
assert.equal(api.node, 'https://node.example');
assert.equal(address, 'U123456');
assert.equal(direction, 'incoming');
assert.equal(admToSats(1.25), 125000000);
assert.equal(
typeof createKeypairFromPassphrase(
'package test passphrase with enough characters',
).publicKey,
'object',
);
assert.equal(typeof getTransactionId, 'function');
assert.equal(coinMetadata.ADM.decimals, 8);
assert.equal(typeof btc.keys, 'function');
assert.equal(typeof dash.isValidAddress, 'function');
assert.equal(typeof doge.isValidAddress, 'function');
assert.equal(typeof eth.keys, 'function');
console.log('ESM package imports and runtime checks passed.');