@xelis/sdk 0.9.11 → 0.10.1
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/dist/cjs/address/address.js +55 -0
- package/dist/cjs/address/bech32.js +167 -0
- package/dist/cjs/config.js +4 -2
- package/dist/cjs/daemon/rpc.js +122 -71
- package/dist/cjs/daemon/types.js +44 -24
- package/dist/cjs/daemon/websocket.js +129 -105
- package/dist/cjs/data/element.js +84 -0
- package/dist/cjs/data/value.js +327 -0
- package/dist/cjs/{lib/rpc.js → rpc/http.js} +68 -18
- package/dist/cjs/rpc/parse_json/parse_json.js +15 -0
- package/dist/cjs/{lib → rpc}/websocket.js +119 -79
- package/dist/cjs/wallet/rpc.js +81 -70
- package/dist/cjs/wallet/types.js +44 -1
- package/dist/cjs/wallet/websocket.js +77 -14
- package/dist/cjs/xswd/websocket.js +3 -3
- package/dist/esm/address/address.js +53 -0
- package/dist/esm/address/bech32.js +161 -0
- package/dist/esm/config.js +3 -1
- package/dist/esm/daemon/rpc.js +122 -71
- package/dist/esm/daemon/types.js +44 -24
- package/dist/esm/daemon/websocket.js +130 -106
- package/dist/esm/data/element.js +81 -0
- package/dist/esm/data/value.js +324 -0
- package/dist/esm/{lib/rpc.js → rpc/http.js} +67 -17
- package/dist/esm/rpc/parse_json/parse_json.js +8 -0
- package/dist/esm/{lib → rpc}/websocket.js +118 -78
- package/dist/esm/wallet/rpc.js +81 -70
- package/dist/esm/wallet/types.js +43 -0
- package/dist/esm/wallet/websocket.js +77 -14
- package/dist/esm/xswd/websocket.js +3 -3
- package/dist/types/address/address.d.ts +12 -0
- package/dist/types/address/bech32.d.ts +6 -0
- package/dist/types/config.d.ts +2 -0
- package/dist/types/daemon/rpc.d.ts +68 -51
- package/dist/types/daemon/types.d.ts +216 -44
- package/dist/types/daemon/websocket.d.ts +77 -56
- package/dist/types/data/element.d.ts +20 -0
- package/dist/types/data/value.d.ts +50 -0
- package/dist/types/rpc/http.d.ts +9 -0
- package/dist/types/rpc/parse_json/parse_json.d.ts +1 -0
- package/dist/types/{lib → rpc}/websocket.d.ts +14 -10
- package/dist/types/wallet/rpc.d.ts +45 -26
- package/dist/types/wallet/types.d.ts +244 -21
- package/dist/types/wallet/websocket.d.ts +47 -22
- package/dist/types/xswd/websocket.d.ts +3 -3
- package/package.json +5 -4
- package/dist/cjs/lib/parse_data.js +0 -15
- package/dist/esm/lib/parse_data.js +0 -11
- package/dist/types/lib/parse_data.d.ts +0 -1
- package/dist/types/lib/rpc.d.ts +0 -7
- /package/dist/cjs/{lib → rpc}/types.js +0 -0
- /package/dist/esm/{lib → rpc}/types.js +0 -0
- /package/dist/types/{lib → rpc}/types.d.ts +0 -0
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
export interface GetInfoResult {
|
|
2
|
-
average_block_time: number;
|
|
3
|
-
block_reward: number;
|
|
4
|
-
block_time_target: number;
|
|
5
|
-
circulating_supply: number;
|
|
6
|
-
difficulty: string;
|
|
7
2
|
height: number;
|
|
8
|
-
|
|
9
|
-
mempool_size: number;
|
|
10
|
-
network: string;
|
|
11
|
-
pruned_topoheight?: number;
|
|
3
|
+
topoheight: number;
|
|
12
4
|
stableheight: number;
|
|
5
|
+
pruned_topoheight?: number;
|
|
13
6
|
top_block_hash: string;
|
|
14
|
-
|
|
7
|
+
circulating_supply: number;
|
|
8
|
+
burned_supply: number;
|
|
9
|
+
maximum_supply: number;
|
|
10
|
+
difficulty: string;
|
|
11
|
+
block_time_target: number;
|
|
12
|
+
average_block_time: number;
|
|
13
|
+
block_reward: number;
|
|
14
|
+
dev_reward: number;
|
|
15
|
+
miner_reward: number;
|
|
16
|
+
mempool_size: number;
|
|
15
17
|
version: string;
|
|
18
|
+
network: string;
|
|
16
19
|
}
|
|
17
20
|
export interface Block {
|
|
18
21
|
hash: string;
|
|
@@ -162,9 +165,28 @@ export interface Burn {
|
|
|
162
165
|
asset: string;
|
|
163
166
|
amount: number;
|
|
164
167
|
}
|
|
168
|
+
export interface MultiSigPayload {
|
|
169
|
+
participants: string[];
|
|
170
|
+
threshold: number;
|
|
171
|
+
}
|
|
172
|
+
export interface ContractDeposit {
|
|
173
|
+
public: number;
|
|
174
|
+
}
|
|
175
|
+
export interface InvokeContractPayload {
|
|
176
|
+
contract: string;
|
|
177
|
+
deposits: {
|
|
178
|
+
[key: string]: ContractDeposit;
|
|
179
|
+
};
|
|
180
|
+
chunk_id: number;
|
|
181
|
+
max_gas: number;
|
|
182
|
+
parameters: number[][];
|
|
183
|
+
}
|
|
165
184
|
export interface TransactionData {
|
|
166
|
-
transfers: Transfer[];
|
|
167
|
-
burn: Burn;
|
|
185
|
+
transfers: Transfer[] | null;
|
|
186
|
+
burn: Burn | null;
|
|
187
|
+
multi_sig: MultiSigPayload | null;
|
|
188
|
+
invoke_contract: InvokeContractPayload | null;
|
|
189
|
+
deploy_contract: Module | null;
|
|
168
190
|
}
|
|
169
191
|
export interface SourceCommitment {
|
|
170
192
|
commitment: number[];
|
|
@@ -184,16 +206,10 @@ export interface Transaction {
|
|
|
184
206
|
nonce: number;
|
|
185
207
|
source_commitments: SourceCommitment[];
|
|
186
208
|
range_proof: number[];
|
|
187
|
-
signature: string;
|
|
188
209
|
reference: Reference;
|
|
210
|
+
signature: string;
|
|
189
211
|
size: number;
|
|
190
212
|
}
|
|
191
|
-
export interface TransactionResponse extends Transaction {
|
|
192
|
-
blocks: string[];
|
|
193
|
-
executed_in_block: string;
|
|
194
|
-
in_mempool: boolean;
|
|
195
|
-
first_seen?: number;
|
|
196
|
-
}
|
|
197
213
|
export interface TransactionExecuted {
|
|
198
214
|
tx_hash: string;
|
|
199
215
|
block_hash: string;
|
|
@@ -360,69 +376,225 @@ export interface SplitAddressResult {
|
|
|
360
376
|
address: string;
|
|
361
377
|
integrated_data: string;
|
|
362
378
|
}
|
|
379
|
+
export interface HardFork {
|
|
380
|
+
height: number;
|
|
381
|
+
version: number;
|
|
382
|
+
changelog: string;
|
|
383
|
+
version_requirement: string | null;
|
|
384
|
+
}
|
|
385
|
+
export interface GetTransactionExecutorResult {
|
|
386
|
+
block_topoheight: number;
|
|
387
|
+
block_timestamp: number;
|
|
388
|
+
block_hash: string;
|
|
389
|
+
}
|
|
390
|
+
export interface FeeRatesEstimated {
|
|
391
|
+
low: number;
|
|
392
|
+
medium: number;
|
|
393
|
+
high: number;
|
|
394
|
+
default: number;
|
|
395
|
+
}
|
|
396
|
+
export interface MakeIntegratedAddressParams {
|
|
397
|
+
address: string;
|
|
398
|
+
integrated_data: any;
|
|
399
|
+
}
|
|
400
|
+
export interface DecryptExtraDataParams {
|
|
401
|
+
shared_key: number[];
|
|
402
|
+
extra_data: number[];
|
|
403
|
+
}
|
|
404
|
+
export interface GetMutilsigAtTopoheightParams {
|
|
405
|
+
address: string;
|
|
406
|
+
topoheight: number;
|
|
407
|
+
}
|
|
408
|
+
export interface HasMultisigAtTopoheightParams {
|
|
409
|
+
address: string;
|
|
410
|
+
topoheight: number;
|
|
411
|
+
}
|
|
412
|
+
export interface GetMutilsigAtTopoheightResult {
|
|
413
|
+
state: string;
|
|
414
|
+
}
|
|
415
|
+
export interface GetMultisigParams {
|
|
416
|
+
address: string;
|
|
417
|
+
}
|
|
418
|
+
export interface GetMultisigResult {
|
|
419
|
+
state: string;
|
|
420
|
+
topoheight: number;
|
|
421
|
+
}
|
|
422
|
+
export interface HasMultisigParams {
|
|
423
|
+
address: string;
|
|
424
|
+
topoheight?: number;
|
|
425
|
+
}
|
|
426
|
+
export interface GetContractOutputsParams {
|
|
427
|
+
transaction: string;
|
|
428
|
+
}
|
|
429
|
+
export interface GetContractModuleParams {
|
|
430
|
+
contract: string;
|
|
431
|
+
}
|
|
432
|
+
export interface GetContractDataPrams {
|
|
433
|
+
contract: string;
|
|
434
|
+
key: any;
|
|
435
|
+
}
|
|
436
|
+
export interface GetContractDataAtTopoheightParams {
|
|
437
|
+
contract: string;
|
|
438
|
+
key: any;
|
|
439
|
+
topoheight: number;
|
|
440
|
+
}
|
|
441
|
+
export interface GetContractBalanceParams {
|
|
442
|
+
contract: string;
|
|
443
|
+
asset: string;
|
|
444
|
+
}
|
|
445
|
+
export interface GetContractBalanceAtTopoheightParams {
|
|
446
|
+
contract: string;
|
|
447
|
+
asset: string;
|
|
448
|
+
topoheight: number;
|
|
449
|
+
}
|
|
450
|
+
export interface Chunk {
|
|
451
|
+
instructions: number[];
|
|
452
|
+
}
|
|
453
|
+
export interface Module {
|
|
454
|
+
constants: any;
|
|
455
|
+
chunks: Chunk[];
|
|
456
|
+
entry_chunk_ids: number[];
|
|
457
|
+
structs: any[];
|
|
458
|
+
enums: any[];
|
|
459
|
+
}
|
|
460
|
+
export interface GetContractModuleResult {
|
|
461
|
+
previous_topoheight: number | null;
|
|
462
|
+
data: Module | null;
|
|
463
|
+
}
|
|
464
|
+
export interface GetContractDataResult {
|
|
465
|
+
previous_topoheight: number | null;
|
|
466
|
+
data: any | null;
|
|
467
|
+
}
|
|
468
|
+
export interface GetContractBalanceAtTopoheightResult {
|
|
469
|
+
data: number;
|
|
470
|
+
previous_topoheight: number | null;
|
|
471
|
+
}
|
|
472
|
+
export interface GetContractBalanceResult {
|
|
473
|
+
topoheight: number;
|
|
474
|
+
amount: number;
|
|
475
|
+
previous_topoheight: number | null;
|
|
476
|
+
}
|
|
477
|
+
export interface ContractOutputRefundGas {
|
|
478
|
+
amount: number;
|
|
479
|
+
}
|
|
480
|
+
export interface ContractOutputTransfer {
|
|
481
|
+
amount: number;
|
|
482
|
+
asset: string;
|
|
483
|
+
destination: string;
|
|
484
|
+
}
|
|
485
|
+
export interface ContractOutputExitCode {
|
|
486
|
+
exit_code: number;
|
|
487
|
+
}
|
|
488
|
+
export interface ContractOutputRefundDeposits {
|
|
489
|
+
}
|
|
490
|
+
export type ContractOutput = ContractOutputRefundGas | ContractOutputTransfer | ContractOutputExitCode | ContractOutputRefundDeposits;
|
|
491
|
+
export interface TransactionResponse extends Transaction {
|
|
492
|
+
blocks: string[];
|
|
493
|
+
executed_in_block: string;
|
|
494
|
+
in_mempool: boolean;
|
|
495
|
+
first_seen?: number;
|
|
496
|
+
}
|
|
497
|
+
export interface StableTopoHeightChanged {
|
|
498
|
+
previous_stable_topoheight: number;
|
|
499
|
+
new_stable_topoheight: number;
|
|
500
|
+
}
|
|
501
|
+
export interface InvokeContractParams {
|
|
502
|
+
contract: string;
|
|
503
|
+
}
|
|
504
|
+
export interface InvokeContract {
|
|
505
|
+
block_hash: string;
|
|
506
|
+
tx_hash: string;
|
|
507
|
+
topoheight: number;
|
|
508
|
+
contract_outputs: ContractOutput[];
|
|
509
|
+
}
|
|
510
|
+
export interface NewContract {
|
|
511
|
+
contract: string;
|
|
512
|
+
block_hash: string;
|
|
513
|
+
topoheight: number;
|
|
514
|
+
}
|
|
363
515
|
export declare enum RPCMethod {
|
|
364
516
|
GetVersion = "get_version",
|
|
365
|
-
GetInfo = "get_info",
|
|
366
517
|
GetHeight = "get_height",
|
|
367
518
|
GetTopoheight = "get_topoheight",
|
|
519
|
+
GetPrunedTopoheight = "get_pruned_topoheight",
|
|
520
|
+
GetInfo = "get_info",
|
|
521
|
+
GetDifficulty = "get_difficulty",
|
|
522
|
+
GetTips = "get_tips",
|
|
523
|
+
GetDevFeeThresholds = "get_dev_fee_thresholds",
|
|
524
|
+
GetSizeOnDisk = "get_size_on_disk",
|
|
368
525
|
GetStableHeight = "get_stable_height",
|
|
369
526
|
GetStableTopoheight = "get_stable_topoheight",
|
|
370
|
-
|
|
371
|
-
GetBlockTemplate = "get_block_template",
|
|
527
|
+
GetHardForks = "get_hard_forks",
|
|
372
528
|
GetBlockAtTopoheight = "get_block_at_topoheight",
|
|
373
529
|
GetBlocksAtHeight = "get_blocks_at_height",
|
|
374
530
|
GetBlockByHash = "get_block_by_hash",
|
|
375
531
|
GetTopBlock = "get_top_block",
|
|
376
|
-
GetNonce = "get_nonce",
|
|
377
|
-
GetNonceAtTopoheight = "get_nonce_at_topoheight",
|
|
378
|
-
HasNonce = "has_nonce",
|
|
379
532
|
GetBalance = "get_balance",
|
|
533
|
+
GetStableBalance = "get_stable_balance",
|
|
380
534
|
HasBalance = "has_balance",
|
|
381
535
|
GetBalanceAtTopoheight = "get_balance_at_topoheight",
|
|
536
|
+
GetNonce = "get_nonce",
|
|
537
|
+
HasNonce = "has_nonce",
|
|
538
|
+
GetNonceAtTopoheight = "get_nonce_at_topoheight",
|
|
382
539
|
GetAsset = "get_asset",
|
|
383
540
|
GetAssets = "get_assets",
|
|
384
541
|
CountAssets = "count_assets",
|
|
385
542
|
CountTransactions = "count_transactions",
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
543
|
+
CountAccounts = "count_accounts",
|
|
544
|
+
CountContracts = "count_contracts",
|
|
545
|
+
SubmitTransaction = "submit_transaction",
|
|
546
|
+
GetTransactionExecutor = "get_transaction_executor",
|
|
390
547
|
GetTransaction = "get_transaction",
|
|
391
548
|
GetTransactions = "get_transactions",
|
|
549
|
+
IsTxExecutedInBlock = "is_tx_executed_in_block",
|
|
550
|
+
P2PStatus = "p2p_status",
|
|
551
|
+
GetPeers = "get_peers",
|
|
552
|
+
GetMempool = "get_mempool",
|
|
553
|
+
GetMempoolCache = "get_mempool_cache",
|
|
554
|
+
GetEstimatedFeeRates = "get_estimated_fee_rates",
|
|
555
|
+
GetDAGOrder = "get_dag_order",
|
|
392
556
|
GetBlocksRangeByTopoheight = "get_blocks_range_by_topoheight",
|
|
393
557
|
GetBlocksRangeByHeight = "get_blocks_range_by_height",
|
|
394
|
-
GetAccounts = "get_accounts",
|
|
395
|
-
SubmitBlock = "submit_block",
|
|
396
|
-
SubmitTransaction = "submit_transaction",
|
|
397
|
-
CountAccounts = "count_accounts",
|
|
398
558
|
GetAccountHistory = "get_account_history",
|
|
399
559
|
GetAccountAssets = "get_account_assets",
|
|
400
|
-
|
|
401
|
-
GetDevFeeThresholds = "get_dev_fee_thresholds",
|
|
402
|
-
GetSizeOnDisk = "get_size_on_disk",
|
|
403
|
-
IsTxExecutedInBlock = "is_tx_executed_in_block",
|
|
404
|
-
GetAccountRegistrationTopoheight = "get_account_registration_topoheight",
|
|
560
|
+
GetAccounts = "get_accounts",
|
|
405
561
|
IsAccountRegistered = "is_account_registered",
|
|
406
|
-
|
|
407
|
-
GetDifficulty = "get_difficulty",
|
|
562
|
+
GetAccountRegistrationTopoheight = "get_account_registration_topoheight",
|
|
408
563
|
ValidateAddress = "validate_address",
|
|
564
|
+
SplitAddress = "split_address",
|
|
409
565
|
ExtractKeyFromAddress = "extract_key_from_address",
|
|
566
|
+
MakeIntegratedAddress = "make_integrated_address",
|
|
567
|
+
DecryptExtraData = "decrypt_extra_data",
|
|
568
|
+
GetMultisigAtTopoheight = "get_multisig_at_topoheight",
|
|
569
|
+
GetMultisig = "get_multisig",
|
|
570
|
+
HasMultisig = "has_multisig",
|
|
571
|
+
HasMultisigAtTopoheight = "has_multisig_at_topoheight",
|
|
572
|
+
GetContractOutputs = "get_contract_outputs",
|
|
573
|
+
GetContractModule = "get_contract_module",
|
|
574
|
+
GetContractData = "get_contract_data",
|
|
575
|
+
GetContractDataAtTopoheight = "get_contract_data_at_topoheight",
|
|
576
|
+
GetContractBalance = "get_contract_balance",
|
|
577
|
+
GetContractBalanceAtTopoheight = "get_contract_balance_at_topoheight",
|
|
578
|
+
GetBlockTemplate = "get_block_template",
|
|
410
579
|
GetMinerWork = "get_miner_work",
|
|
411
|
-
|
|
580
|
+
SubmitBlock = "submit_block"
|
|
412
581
|
}
|
|
413
582
|
export declare enum RPCEvent {
|
|
414
583
|
NewBlock = "new_block",
|
|
415
584
|
BlockOrdered = "block_ordered",
|
|
416
585
|
BlockOrphaned = "block_orphaned",
|
|
417
586
|
StableHeightChanged = "stable_height_changed",
|
|
587
|
+
StableTopoHeightChanged = "stable_topo_height_changed",
|
|
418
588
|
TransactionOrphaned = "transaction_orphaned",
|
|
419
589
|
TransactionAddedInMempool = "transaction_added_in_mempool",
|
|
420
590
|
TransactionExecuted = "transaction_executed",
|
|
421
|
-
|
|
591
|
+
InvokeContract = "invoke_contract",
|
|
592
|
+
DeployContract = "deploy_contract",
|
|
422
593
|
NewAsset = "new_asset",
|
|
423
594
|
PeerConnected = "peer_connected",
|
|
424
595
|
PeerDisconnected = "peer_disconnected",
|
|
425
|
-
PeerPeerListUpdated = "peer_peer_list_updated",
|
|
426
596
|
PeerStateUpdated = "peer_state_updated",
|
|
427
|
-
|
|
597
|
+
PeerPeerListUpdated = "peer_peer_list_updated",
|
|
598
|
+
PeerPeerDisconnected = "peer_peer_disconnected",
|
|
599
|
+
NewBlockTemplate = "new_block_template"
|
|
428
600
|
}
|
|
@@ -1,74 +1,95 @@
|
|
|
1
1
|
import { MessageEvent } from 'ws';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
2
|
+
import * as types from './types';
|
|
3
|
+
import { WSRPC } from '../rpc/websocket';
|
|
4
4
|
export declare class DaemonMethods {
|
|
5
|
-
ws:
|
|
5
|
+
ws: WSRPC;
|
|
6
6
|
prefix: string;
|
|
7
|
-
constructor(ws:
|
|
8
|
-
listenEvent<T>(event: string, onData: (msgEvent: MessageEvent, data?: T, err?: Error) => void): Promise<() => Promise<void>>;
|
|
7
|
+
constructor(ws: WSRPC, prefix?: string);
|
|
9
8
|
dataCall<T>(method: string, params?: any): Promise<T>;
|
|
10
|
-
onNewBlock(onData: (msgEvent: MessageEvent, data?: Block & RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
9
|
+
onNewBlock(onData: (msgEvent: MessageEvent, data?: types.Block & types.RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
|
|
10
|
+
onBlockOrdered(onData: (msgEvent: MessageEvent, data?: types.BlockOrdered & types.RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
|
|
11
|
+
onBlockOrphaned(onData: (msgEvent: MessageEvent, data?: types.BlockOrphaned & types.RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
|
|
12
|
+
onStableHeightChanged(onData: (msgEvent: MessageEvent, data?: types.StableHeightChanged & types.RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
|
|
13
|
+
onStableTopoHeightChanged(onData: (msgEvent: MessageEvent, data?: types.StableTopoHeightChanged & types.RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
|
|
14
|
+
onTransactionOrphaned(onData: (msgEvent: MessageEvent, data?: types.TransactionResponse & types.RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
|
|
15
|
+
onTransactionAddedInMempool(onData: (msgEvent: MessageEvent, data?: types.TransactionResponse & types.RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
|
|
16
|
+
onTransactionExecuted(onData: (msgEvent: MessageEvent, data?: types.TransactionExecuted & types.RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
|
|
17
|
+
onInvokeContract(contract: string, onData: (msgEvent: MessageEvent, data?: types.InvokeContract & types.RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
|
|
18
|
+
onDeployContract(onData: (msgEvent: MessageEvent, data?: types.NewContract & types.RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
|
|
19
|
+
onNewAsset(onData: (msgEvent: MessageEvent, data?: types.AssetWithData & types.RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
|
|
20
|
+
onPeerConnected(onData: (msgEvent: MessageEvent, data?: types.Peer & types.RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
|
|
21
|
+
onPeerDisconnected(onData: (msgEvent: MessageEvent, data?: number & types.RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
|
|
22
|
+
onPeerStateUpdated(onData: (msgEvent: MessageEvent, data?: types.Peer & types.RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
|
|
23
|
+
onPeerPeerListUpdated(onData: (msgEvent: MessageEvent, data?: types.PeerPeerListUpdated & types.RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
|
|
24
|
+
onPeerPeerDisconnected(onData: (msgEvent: MessageEvent, data?: types.PeerPeerDisconnected & types.RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
|
|
25
|
+
onNewBlockTemplate(onData: (msgEvent: MessageEvent, data?: types.GetBlockTemplateResult & types.RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
|
|
23
26
|
getVersion(): Promise<string>;
|
|
24
27
|
getHeight(): Promise<number>;
|
|
25
28
|
getTopoheight(): Promise<number>;
|
|
29
|
+
getPrunedTopoheight(): Promise<number>;
|
|
30
|
+
getInfo(): Promise<types.GetInfoResult>;
|
|
31
|
+
getDifficulty(): Promise<types.GetDifficultyResult>;
|
|
32
|
+
getTips(): Promise<string[]>;
|
|
33
|
+
getDevFeeThresholds(): Promise<types.DevFee[]>;
|
|
34
|
+
getSizeOnDisk(): Promise<types.DiskSize>;
|
|
26
35
|
getStableHeight(): Promise<number>;
|
|
27
36
|
getStableTopoheight(): Promise<number>;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
getAssets(params?: GetAssetsParams): Promise<string[]>;
|
|
37
|
+
getHardForks(): Promise<types.HardFork[]>;
|
|
38
|
+
getBlockAtTopoheight(params: types.GetBlockAtTopoheightParams): Promise<types.Block>;
|
|
39
|
+
getBlocksAtHeight(params: types.GetBlocksAtHeightParams): Promise<types.Block[]>;
|
|
40
|
+
getBlockByHash(params: types.GetBlockByHashParams): Promise<types.Block>;
|
|
41
|
+
getTopBlock(params: types.GetTopBlockParams): Promise<types.Block>;
|
|
42
|
+
getBalance(params: types.GetBalanceParams): Promise<types.GetBalanceResult>;
|
|
43
|
+
getStableBalance(params: types.GetBalanceParams): Promise<types.GetStableBalanceResult>;
|
|
44
|
+
hasBalance(params: types.HasBalanceParams): Promise<types.HasBalanceResult>;
|
|
45
|
+
getBalanceAtTopoheight(params: types.GetBalanceAtTopoheightParams): Promise<types.VersionedBalance>;
|
|
46
|
+
getNonce(params: types.GetNonceParams): Promise<types.GetNonceResult>;
|
|
47
|
+
hasNonce(params: types.HasNonceParams): Promise<types.HasNonceResult>;
|
|
48
|
+
getNonceAtTopoheight(params: types.GetNonceAtTopoheightParams): Promise<types.VersionedNonce>;
|
|
49
|
+
getAsset(params: types.GetAssetParams): Promise<types.AssetData>;
|
|
50
|
+
getAssets(params?: types.GetAssetsParams): Promise<string[]>;
|
|
43
51
|
countAssets(): Promise<number>;
|
|
44
|
-
countAccounts(): Promise<number>;
|
|
45
52
|
countTransactions(): Promise<number>;
|
|
53
|
+
countAccounts(): Promise<number>;
|
|
54
|
+
countContracts(): Promise<number>;
|
|
46
55
|
submitTransaction(hexData: string): Promise<boolean>;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
getTransactionExecutor(hash: string): Promise<types.GetTransactionExecutorResult>;
|
|
57
|
+
getTransaction(hash: string): Promise<types.TransactionResponse>;
|
|
58
|
+
getTransactions(txHashes: string[]): Promise<types.TransactionResponse[]>;
|
|
59
|
+
isTxExecutedInBlock(params: types.IsTxExecutedInBlockParams): Promise<boolean>;
|
|
60
|
+
p2pStatus(): Promise<types.P2PStatusResult>;
|
|
61
|
+
getPeers(): Promise<types.GetPeersResult>;
|
|
62
|
+
getMemPool(): Promise<types.TransactionResponse[]>;
|
|
63
|
+
getMempoolCache(address: string): Promise<types.GetMempoolCacheResult>;
|
|
64
|
+
getEstimatedFeeRates(): Promise<types.FeeRatesEstimated>;
|
|
65
|
+
getDAGOrder(params: types.TopoheightRangeParams): Promise<string[]>;
|
|
66
|
+
getBlocksRangeByTopoheight(params: types.TopoheightRangeParams): Promise<types.Block[]>;
|
|
67
|
+
getBlocksRangeByHeight(params: types.HeightRangeParams): Promise<types.Block[]>;
|
|
68
|
+
getAccountHistory(params: types.GetAccountHistoryParams): Promise<types.AccounHistory[]>;
|
|
57
69
|
getAccountAssets(address: string): Promise<string[]>;
|
|
58
|
-
getAccounts(params: GetAccountsParams): Promise<string[]>;
|
|
59
|
-
|
|
60
|
-
getDevFeeThresholds(): Promise<DevFee[]>;
|
|
61
|
-
getSizeOnDisk(): Promise<DiskSize>;
|
|
70
|
+
getAccounts(params: types.GetAccountsParams): Promise<string[]>;
|
|
71
|
+
isAccountRegistered(params: types.IsAccountRegisteredParams): Promise<boolean>;
|
|
62
72
|
getAccountRegistrationTopoheight(address: String): Promise<Number>;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
73
|
+
validateAddress(params: types.ValidateAddressParams): Promise<types.ValidateAddressResult>;
|
|
74
|
+
splitAddress(params: types.SplitAddressParams): Promise<types.SplitAddressResult>;
|
|
75
|
+
extractKeyFromAddress(params: types.ExtractKeyFromAddressParams): Promise<string | number[]>;
|
|
76
|
+
makeIntegratedAddress(params: types.MakeIntegratedAddressParams): Promise<string>;
|
|
77
|
+
decryptExtraData(params: types.DecryptExtraDataParams): Promise<unknown>;
|
|
78
|
+
getMultisigAtTopoheight(params: types.GetMutilsigAtTopoheightParams): Promise<types.GetMutilsigAtTopoheightResult>;
|
|
79
|
+
getMultisig(params: types.GetMultisigParams): Promise<types.GetMultisigResult>;
|
|
80
|
+
hasMultisig(params: types.HasMultisigParams): Promise<boolean>;
|
|
81
|
+
hasMultisigAtTopoheight(params: types.HasMultisigAtTopoheightParams): Promise<boolean>;
|
|
82
|
+
getContractOutputs(params: types.GetContractOutputsParams): Promise<types.ContractOutput[]>;
|
|
83
|
+
getContractModule(params: types.GetContractModuleParams): Promise<types.GetContractModuleResult>;
|
|
84
|
+
getContractData(params: types.GetContractModuleParams): Promise<unknown>;
|
|
85
|
+
getContractDataAtTopoheight(params: types.GetContractDataAtTopoheightParams): Promise<unknown>;
|
|
86
|
+
getContractBalance(params: types.GetContractBalanceParams): Promise<types.GetContractBalanceResult>;
|
|
87
|
+
getContractBalanceAtTopoheight(params: types.GetContractBalanceAtTopoheightParams): Promise<types.GetContractBalanceAtTopoheightResult>;
|
|
88
|
+
getBlockTemplate(address: string): Promise<string>;
|
|
89
|
+
getMinerWork(params: types.GetMinerWorkParams): Promise<types.GetMinerWorkResult>;
|
|
90
|
+
submitBlock(params: types.SubmitBlockParams): Promise<boolean>;
|
|
70
91
|
}
|
|
71
|
-
export declare class WS extends
|
|
92
|
+
export declare class WS extends WSRPC {
|
|
72
93
|
methods: DaemonMethods;
|
|
73
94
|
constructor();
|
|
74
95
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Value } from "./value";
|
|
2
|
+
export declare enum ElementType {
|
|
3
|
+
Value = 0,
|
|
4
|
+
Array = 1,
|
|
5
|
+
Fields = 2
|
|
6
|
+
}
|
|
7
|
+
export declare class Element {
|
|
8
|
+
value?: Value;
|
|
9
|
+
array?: Element[];
|
|
10
|
+
fields?: Map<Value, Element>;
|
|
11
|
+
constructor();
|
|
12
|
+
static v(data: any): Element;
|
|
13
|
+
static value(value: Value): Element;
|
|
14
|
+
static array(arr: Element[]): Element;
|
|
15
|
+
static fields(fields: Map<Value, Element>): Element;
|
|
16
|
+
validate(): ElementType;
|
|
17
|
+
static fromBytes(data: Uint8Array): Element;
|
|
18
|
+
toBytes(): Uint8Array;
|
|
19
|
+
toObject(): {};
|
|
20
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Element } from "./element";
|
|
2
|
+
export declare enum ValueType {
|
|
3
|
+
Bool = 0,
|
|
4
|
+
String = 1,
|
|
5
|
+
U8 = 2,
|
|
6
|
+
U16 = 3,
|
|
7
|
+
U32 = 4,
|
|
8
|
+
U64 = 5,
|
|
9
|
+
U128 = 6,
|
|
10
|
+
Hash = 7,
|
|
11
|
+
Blob = 8
|
|
12
|
+
}
|
|
13
|
+
export declare class Value {
|
|
14
|
+
vType: ValueType;
|
|
15
|
+
data: any;
|
|
16
|
+
constructor(vType: ValueType, data: any);
|
|
17
|
+
static new(data: any): Value;
|
|
18
|
+
}
|
|
19
|
+
export declare class ValueReader {
|
|
20
|
+
data: number[];
|
|
21
|
+
constructor(data: Uint8Array);
|
|
22
|
+
read(): Element;
|
|
23
|
+
readByte(): number;
|
|
24
|
+
readU16(): number;
|
|
25
|
+
readU32(): number;
|
|
26
|
+
readU64(): bigint;
|
|
27
|
+
readU128(): bigint;
|
|
28
|
+
readString(): string;
|
|
29
|
+
readBool(): boolean;
|
|
30
|
+
readHash(): number[];
|
|
31
|
+
readBlob(): number[];
|
|
32
|
+
readValue(): Value;
|
|
33
|
+
}
|
|
34
|
+
export declare class ValueWriter {
|
|
35
|
+
data: number[];
|
|
36
|
+
constructor();
|
|
37
|
+
write(dataElement: Element): void;
|
|
38
|
+
appendData(data: Uint8Array): void;
|
|
39
|
+
appendBuffer(buf: ArrayBuffer): void;
|
|
40
|
+
writeU8(value: number): void;
|
|
41
|
+
writeU16(value: number): void;
|
|
42
|
+
writeU32(value: number): void;
|
|
43
|
+
writeU64(value: bigint): void;
|
|
44
|
+
writeU128(value: BigInt): void;
|
|
45
|
+
writeString(value: string): void;
|
|
46
|
+
writeBool(value: boolean): void;
|
|
47
|
+
writeBlob(value: []): void;
|
|
48
|
+
writeHash(value: Uint8Array): void;
|
|
49
|
+
writeValue(value: Value): void;
|
|
50
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { RPCRequest } from './types';
|
|
2
|
+
export declare class HttpRPC {
|
|
3
|
+
endpoint: string;
|
|
4
|
+
timeout: number;
|
|
5
|
+
headers: Headers;
|
|
6
|
+
constructor(endpoint: string);
|
|
7
|
+
batchRequest(requests: RPCRequest[]): Promise<any | Error[]>;
|
|
8
|
+
request<T>(method: string, params?: any): Promise<T>;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const parseJSON: (data: string) => any;
|
|
@@ -2,8 +2,15 @@
|
|
|
2
2
|
import { ClientOptions, MessageEvent } from 'ws';
|
|
3
3
|
import WebSocket from 'isomorphic-ws';
|
|
4
4
|
import { ClientRequestArgs } from 'http';
|
|
5
|
-
import {
|
|
6
|
-
export
|
|
5
|
+
import { RPCRequest } from './types';
|
|
6
|
+
export type EventWithParams = {
|
|
7
|
+
[event: string]: {};
|
|
8
|
+
};
|
|
9
|
+
export type EventKey = string | EventWithParams;
|
|
10
|
+
export type IdRefObj = {
|
|
11
|
+
id?: number;
|
|
12
|
+
};
|
|
13
|
+
export declare class WSRPC {
|
|
7
14
|
endpoint: string;
|
|
8
15
|
socket?: WebSocket;
|
|
9
16
|
timeout: number;
|
|
@@ -19,12 +26,9 @@ export declare class WS {
|
|
|
19
26
|
tryReconnect(): void;
|
|
20
27
|
close(): void;
|
|
21
28
|
private clearEvent;
|
|
22
|
-
closeAllListens(event:
|
|
23
|
-
listenEvent<T>(event:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
data: string;
|
|
28
|
-
id: number | null;
|
|
29
|
-
};
|
|
29
|
+
closeAllListens(event: EventKey): Promise<void>;
|
|
30
|
+
listenEvent<T>(event: EventKey, onData: (msgEvent: MessageEvent, data?: T, err?: Error) => void): Promise<() => Promise<void>>;
|
|
31
|
+
batchCall(requests: RPCRequest[]): Promise<any[]>;
|
|
32
|
+
rawCall<T>(id: number, body: string): Promise<T>;
|
|
33
|
+
dataCall<T>(method: string, params?: any, idRefObj?: IdRefObj): Promise<T>;
|
|
30
34
|
}
|