Scanner
Mystiko Scanner Related APIs.
Sync
Sync current wallet deposit and spend transaction status. The ScannerSyncOptions concurrency level is enforced to 1 in the SDK.
import mystiko from '@mystikonetwork/node';
import { core } from '@mystikonetwork/protos';
const options = new core.scanner.v1.ScannerSyncOptions({
walletPassword: WalletPassword,
});
const balanceResult = mystiko.scanner?.sync(options);
The parameter list for ScannerSyncOptions
:
Parameter | Required | Description |
---|---|---|
walletPassword | true | The password of the wallet. |
concurrency | false | Concurrency level is enforced to 1 in the SDK. |
Scan
Scan transactions related to the current wallet. The ScannerScanOptions concurrency level is enforced to 1 in the SDK.
import mystiko from '@mystikonetwork/node';
import { core } from '@mystikonetwork/protos';
const options = new core.scanner.v1.ScannerScanOptions({
walletPassword: 'walletPassword',
shieldedAddresses: [],
});
const scanResult = mystiko.scanner?.scan(options);
The parameter list for ScannerScanOptions
:
Parameter | Required | Description |
---|---|---|
walletPassword | true | The password of the wallet. |
batchSize | false | The number of transactions to scan in each batch. |
concurrency | false | Concurrency level is enforced to 1 in the SDK. |
shieldedAddresses | false | The list of shielded addresses to scan. |
Reset
Scanner reset.
import mystiko from '@mystikonetwork/node';
import { core } from '@mystikonetwork/protos';
const options = new core.scanner.v1.ScannerResetOptions({
shieldedAddresses: [],
});
const resetResult = mystiko.scanner?.reset(options);
The parameter list for ScannerResetOptions
:
Parameter | Required | Description |
---|---|---|
resetToId | false | The transaction ID to reset to. |
shieldedAddresses | false | The list of shielded addresses to reset. |
Import
Import asset by transaction.
import mystiko from '@mystikonetwork/node';
import { core } from '@mystikonetwork/protos';
const options = new core.scanner.v1.AssetImportOptions({
walletPassword: WalletPassword,
chains: [
{
chainId: BigInt(11155111),
txHashes: ['0x8e475d89817f12e8aec59cde31320c429cf330337267b1abb628ab4bd6e528ec'],
}
],
});
const importResult = mystiko.scanner?.import(options);
The parameter list for AssetImportOptions
:
Parameter | Required | Description |
---|---|---|
walletPassword | true | The password of the wallet. |
chains | true | The list of chain import options. |
queryTimeoutMs | false | Timeout when query from provider. |
The parameter list for AssetChainImportOptions
:
Parameter | Required | Description |
---|---|---|
chainId | true | The chain id. |
txHashes | true | The list of transactions hash to import. |
Balance
Query account total balance.
import mystiko from '@mystikonetwork/node';
import { core } from '@mystikonetwork/protos';
const options = new core.scanner.v1.BalanceOptions({
shieldedAddresses: [],
chainIds: [BigInt(11155111), BigInt(97)],
assetSymbols: ['MTT'],
});
const balance = mystiko.scanner?.balance(options);
The parameter list for BalanceOptions
:
Parameter | Required | Description |
---|---|---|
withSpent | false | Whether to include spent transactions. |
shieldedAddresses | false | The list of shielded addresses to scan. |
chainIds | false | The list of chain IDs to scan. |
assetSymbols | false | The list of asset symbols to scan. |
contractAddresses | false | The list of contract addresses to scan. |
bridgeTypes | false | The list of bridge types to scan. |
Assets
Query account assets details.
import mystiko from '@mystikonetwork/node';
import { core } from '@mystikonetwork/protos';
const options = new core.scanner.v1.AssetsOptions({
shieldedAddresses: [shieldedAddress],
});
const assets = mystiko.scanner?.assets(options);
The parameter list for AssetsOptions
:
Parameter | Required | Description |
---|---|---|
shieldedAddresses | false | The list of shielded addresses to scan. |
ChainAssets
Query account assets details by chain.
import mystiko from '@mystikonetwork/node';
import { core } from '@mystikonetwork/protos';
const options = new core.scanner.v1.AssetsOptions({
shieldedAddresses: [shieldedAddress],
});
const assets = mystiko.scanner?.chainAssets(BigInt(11155111), options);