MCPcopy Create free account
hub / github.com/ICBNetwork/web3-Wallet / extractEthjsErrorMessage

Function extractEthjsErrorMessage

app/util/extractEthJsErrorMessage.ts:14–24  ·  view source on GitHub ↗
(errorMessage: string)

Source from the content-addressed store, hash-verified

12 * extractEthjsErrorMessage(`Error: [ethjs-rpc] rpc error with payload {"id":3947817945380,"jsonrpc":"2.0","params":["0xf8eb8208708477359400830398539406012c8cf97bead5deae237070f9587f8e7a266d80b8843d7d3f5a0000000000000000000000000000000000000000000000000000000000081d1a000000000000000000000000000000000000000000000000001ff973cafa800000000000000000000000000000000000000000000000000000038d7ea4c68000000000000000000000000000000000000000000000000000000000000003f48025a04c32a9b630e0d9e7ff361562d850c86b7a884908135956a7e4a336fa0300d19ca06830776423f25218e8d19b267161db526e66895567147015b1f3fc47aef9a3c7"],"method":"eth_sendRawTransaction"} Error: replacement transaction underpriced`)
13 */
14export default function extractEthjsErrorMessage(errorMessage: string) {
15 const isEthjsRpcError = errorMessage.includes(ethJsRpcSlug);
16 if (isEthjsRpcError) {
17 const payloadAndError = errorMessage.slice(ethJsRpcSlug.length);
18 const originalError = payloadAndError.slice(
19 payloadAndError.indexOf(errorLabelPrefix) + errorLabelPrefix.length,
20 );
21 return originalError;
22 }
23 return errorMessage;
24}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected