@magnaflow/merchant-utils
v1.0.2
Published
Merchant shared utilities
Readme
@magnaflow/merchant-utils
Shared merchant-facing helpers on top of the core chain and Tron tooling.
What It Provides
- Cross-chain transaction waiting and friendly error helpers
- Tron transaction polling helpers
- TronWeb instance creation from merchant chain config
- EVM selector-based error formatting
- Payout order display helpers
- EIP-712 digest signing utility
Install
npm install @magnaflow/merchant-utilsKey Exports
waitForTransactionCrossChaincreateCrossChainFriendlyErrorMessagepollTronTransactionpollTronTransaction2pollTronTransactionWithBackoffcreateTronWebInstanceparseEvmErrorcreateFriendlyErrorMessageisTronLikeChainisBscLikeChainsignDigestformatPayoutOrderTimegetPayoutTypeColorgetPayoutStatusColorORDER_TITLESTYPE_DISPLAY_NAMES
Example
import {
createCrossChainFriendlyErrorMessage,
waitForTransactionCrossChain,
} from '@magnaflow/merchant-utils';
const result = await waitForTransactionCrossChain({
chainType: 'evm',
hash: '0x1234...',
client: publicClient,
confirmations: 1,
});
const message = createCrossChainFriendlyErrorMessage('evm', new Error('Operation failed'));Notes
- This package is intentionally a helper layer. Full merchant workflows should still live in application services.
@magnaflow/tronsaveremains a separate package for Tron energy rental APIs.
Development
bunx nx run merchant-utils:lint
bunx nx run merchant-utils:test
bunx nx run merchant-utils:buildLicense
This package is part of the merchant-v2-sdk monorepo and is covered by the root MIT license.
See ../../LICENSE for details.
