npm.io
1.0.3 • Published 4 years ago

@castframework/transaction-manager

Licence
SEE LICENSE IN LICENSE
Version
1.0.3
Deps
9
Size
53 kB
Vulns
6
Weekly
0

drawing

Typescript libraries to provide blockchain agnostic tools for interacting with Smart Contracts.

Coverage Release status Pre-release status Latest version Next version Dependencies state License

Transaction Manager

Description

The transaction manager is used to add common mechanics such as retry to every blockchain driver implementation.

Usage

import { TezoslockchainDriver } from '@castframework/blockchain-driver-tz';

const transactionManager = new TransactionManager({
  driver: driver, // Your Ethereum or Tezos driver
});

Configuration

Default
Property Type Description Default value
driver BlockchainDriver TODO description -
logger Logger TODO description -
txRetryConfig TxRetryConfig Transaction retry configuration See below
txRetryConfig.initialIntervalInMs number TODO description 1000
txRetryConfig.maxIntervalInMs number TODO description 2000
txRetryConfig.maxRetries number TODO description 50

Example

import { TezosConfig } from '@castframework/blockchain-driver-tz';
import { EthereumBlockchainDriver } from './EthereumBlockchainDriver';
import { getLogger } from 'log4js';

const config: TransactionManagerConfig<EthereumBlockchainDriver> = {
  driver: new EthereumBlockchainDriver,
  logger: getLogger(),
  txRetryConfig: {
    initialIntervalInMs: 1000,
    maxIntervalInMs: 10000,
    maxRetries: 5
  }
}