Skip to main content

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:

ParameterRequiredDescription
walletPasswordtrue
The password of the wallet.
concurrencyfalse
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:

ParameterRequiredDescription
walletPasswordtrue
The password of the wallet.
batchSizefalse
The number of transactions to scan in each batch.
concurrencyfalse
Concurrency level is enforced to 1 in the SDK.
shieldedAddressesfalse
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:

ParameterRequiredDescription
resetToIdfalse
The transaction ID to reset to.
shieldedAddressesfalse
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:

ParameterRequiredDescription
walletPasswordtrue
The password of the wallet.
chainstrue
The list of chain import options.
queryTimeoutMsfalse
Timeout when query from provider.

The parameter list for AssetChainImportOptions:

ParameterRequiredDescription
chainIdtrue
The chain id.
txHashestrue
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:

ParameterRequiredDescription
withSpentfalse
Whether to include spent transactions.
shieldedAddressesfalse
The list of shielded addresses to scan.
chainIdsfalse
The list of chain IDs to scan.
assetSymbolsfalse
The list of asset symbols to scan.
contractAddressesfalse
The list of contract addresses to scan.
bridgeTypesfalse
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:

ParameterRequiredDescription
shieldedAddressesfalse
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);