import React from 'react'
import styles from './ErrorBanner.scss'
+import {withNamespaces} from 'react-i18next'
class ErrorBanner extends React.Component {
render() {
+ const {t, i18n} = this.props
const error = this.props.error || ''
+ const codeMessage = error.code && i18n.exists(`btmError.${error.code}`) && t(`btmError.${error.code}`)
const success = this.props.success
- const message = error.chainMessage || error.message || error || success
+ const message = codeMessage || error.chainMessage || error.message || error || success
return (
<div className={success? styles.mainSuccess: styles.main }>
{message &&
<div className={(error.code || error.requestId) ? styles.message : ''}>
- {message}{error.detail ? `: ${error.detail}` : ''}
+ {message}
</div>}
{error.code &&
- <div className={styles.extra}>Error Code: <strong>{error.code}</strong></div>}
+ <div className={styles.extra}>{t('commonWords.errorCode')} <strong>{error.code}</strong></div>}
{error.requestId &&
- <div className={styles.extra}>Request ID: <strong>{error.requestId}</strong></div>}
+ <div className={styles.extra}>{t('commonWords.requestId')} <strong>{error.requestId}</strong></div>}
</div>
)
}
}
-export default ErrorBanner
+export default withNamespaces('translations') (ErrorBanner)
"program":"Program",
"remove":"Remove",
"page":"Page",
- "close":"Close"
+ "close":"Close",
+ "errorCode":"Error Code:",
+ "requestId":"Request ID:"
},
"crumbName":{
"transaction": "transactions",
"CREATE_REGISTER_ACCOUNT": "Default account and key have been initialized successfully.",
"RESTORE_SUCCESS":"Wallet restore successfully",
"UPDATED_ASSET":"Updated asset alias."
+ },
+ "btmError":{
+ "BTM000": "Bytom API Error",
+ "BTM001": "Request timed out",
+ "BTM002": "Invalid request body",
+ "BTM103": "A peer core is operating on a different blockchain network",
+ "BTM200": "Quorum must be greater than 1 and less than or equal to the length of xpubs",
+ "BTM201": "Invalid xpub format",
+ "BTM202": "At least one xpub is required",
+ "BTM203": "Root XPubs cannot contain the same key more than once",
+ "BTM700": "Funds of account are insufficient",
+ "BTM701": "Available funds of account are immature",
+ "BTM702": "Available UTXOs of account have been reserved",
+ "BTM703": "Not found UTXO with given hash",
+ "BTM704": "Invalid action type",
+ "BTM705": "Invalid action object",
+ "BTM706": "Invalid action construction",
+ "BTM707": "One or more fields are missing",
+ "BTM708": "Invalid asset amount",
+ "BTM709": "Not found account",
+ "BTM710": "Not found asset",
+ "BTM730": "Invalid transaction version",
+ "BTM731": "Invalid transaction size",
+ "BTM732": "Invalid transaction time range",
+ "BTM733": "Not standard transaction",
+ "BTM734": "Invalid coinbase transaction",
+ "BTM735": "Invalid coinbase assetID",
+ "BTM736": "Invalid coinbase arbitrary size",
+ "BTM737": "No results in the transaction",
+ "BTM738": "Mismatched assetID",
+ "BTM739": "Mismatched value source/dest position",
+ "BTM740": "Mismatched reference",
+ "BTM741": "Mismatched value",
+ "BTM742": "Missing required field",
+ "BTM743": "No source for value",
+ "BTM744": "Arithmetic overflow/underflow",
+ "BTM745": "Invalid source or destination position",
+ "BTM746": "Unbalanced asset amount between input and output",
+ "BTM747": "Gas credit has been spent",
+ "BTM748": "Gas usage calculate got a math error",
+ "BTM760": "Alt stack underflow",
+ "BTM761": "Bad value",
+ "BTM762": "Wrong context",
+ "BTM763": "Data stack underflow",
+ "BTM764": "Disallowed opcode",
+ "BTM765": "Division by zero",
+ "BTM766": "False result for executing VM",
+ "BTM767": "Program size exceeds max int32",
+ "BTM768": "Arithmetic range error",
+ "BTM769": "RETURN executed",
+ "BTM770": "Run limit exceeded because the BTM Fee is insufficient",
+ "BTM771": "Unexpected end of program",
+ "BTM772": "Unrecognized token",
+ "BTM773": "Unexpected error",
+ "BTM774": "Unsupported VM because the version of VM is mismatched",
+ "BTM775": "VERIFY failed",
+ "BTM800": "Key Alias already exists",
+ "BTM801": "Invalid after in query",
+ "BTM802": "Key not found or wrong password",
+ "BTM803": "Requested key aliases exceeds limit",
+ "BTM804": "Could not decrypt key with given passphrase",
+ "BTM860": "Request could not be authenticated"
}
}
\ No newline at end of file
"program": "合约程序",
"remove":"删除",
"page":"页面",
- "close":"关闭"
+ "close":"关闭",
+ "errorCode":"错误代码:",
+ "requestId":"请求ID:"
},
"crumbName":{
"transaction": "交易",
"CREATE_REGISTER_ACCOUNT": "默认账户和密钥已经初始化成功。",
"RESTORE_SUCCESS":"钱包已经成功恢复。",
"UPDATED_ASSET":"资产别名更改成功。"
+ },
+ "btmError":{
+ "BTM000": "非比原标准错误",
+ "BTM001": "API请求超时",
+ "BTM002": "非法的API请求结构",
+ "BTM103": "区块链网络类型不匹配",
+ "BTM200": "签名数必须大于或者等于1 并且小于或者等于所提供的密钥数",
+ "BTM201": "签名格式错误",
+ "BTM202": "请提供至少一个扩展公钥",
+ "BTM203": "主公钥重复",
+ "BTM700": "账户资产余额不足",
+ "BTM701": "coinbase交易未成熟,币不可花费",
+ "BTM702": "UTXO已经被用来构建交易,导致被临时锁定,不可花费",
+ "BTM703": "UTXO不属于当前钱包",
+ "BTM704": "action类型无效",
+ "BTM705": "action 内容无效",
+ "BTM706": "action结构错误(只有输入或者只有输出)",
+ "BTM707": "action输入内容缺失",
+ "BTM708": "资产数量格式错误(超过最大数量)",
+ "BTM709": "所输入账户不存在",
+ "BTM710": "所输入资产不存在",
+ "BTM730": "交易版本无效",
+ "BTM731": "交易大小无效,不能为0",
+ "BTM732": "超出交易时间范围,用于将停留时间过久的未确认交易作废",
+ "BTM733": "非标准的交易",
+ "BTM734": "非法coinbase交易",
+ "BTM735": "非法的coinbase资产ID",
+ "BTM736": "coinbase尺寸过大,附加数据超过一定限制" ,
+ "BTM737": "交易结构异常",
+ "BTM738": "资产ID无法匹配",
+ "BTM739": "action位置不匹配",
+ "BTM740": "引用不匹配",
+ "BTM741": "不匹配的值,action的资产值不匹配",
+ "BTM742": "缺少所必须的项目",
+ "BTM743": "输入源不存在",
+ "BTM744": "计算溢出,资产计算值超出限制",
+ "BTM745": "源位置或者目标位置无效",
+ "BTM746": "输入数资产数不等于输出资产数",
+ "BTM747": "交易的输入UTXO数量超过上限,最高为20个",
+ "BTM748": "Gas运算错误",
+ "BTM760": "子虚拟机栈溢出",
+ "BTM761": "非法栈数据",
+ "BTM762": "context值错误,context为虚拟机执行上下文",
+ "BTM763": "虚拟机数据溢出",
+ "BTM764": "虚拟机指令不存在",
+ "BTM765": "除零错误",
+ "BTM766": "虚拟机执行结果为Fasle" ,
+ "BTM767": "合约的字节大小超过int32上限",
+ "BTM768": "运算结果溢出",
+ "BTM769": "执行了op FAIL指令,直接返回",
+ "BTM770": "手续费不足,引起合约终止",
+ "BTM771": "异常的program合约程序",
+ "BTM772": "不识别的虚拟机指令数据",
+ "BTM773": "异常错误",
+ "BTM774": "虚拟机版本不匹配",
+ "BTM775": "verify指令执行失败",
+ "BTM800": "密钥别名已经存在,请选择其他名字",
+ "BTM801": "Invalid after in query",
+ "BTM802": "密钥不存在或者密码错误",
+ "BTM803": "Requested key aliases exceeds limit",
+ "BTM804": "无法根据提供的密码进行解密",
+ "BTM860": "请求没有经过认证。一般由Access Token造成"
}
}
\ No newline at end of file