File tree Expand file tree Collapse file tree 4 files changed +37
-4
lines changed Expand file tree Collapse file tree 4 files changed +37
-4
lines changed Original file line number Diff line number Diff line change @@ -3,10 +3,6 @@ yarn-debug.log*
33yarn-error.log *
44node.log
55
6- # Core dumps
7- core
8- core. *
9-
106# Dependency directories
117node_modules /
128.pnpm-store /
Original file line number Diff line number Diff line change 1010
1111- Updated dependencies
1212 - @graphprotocol/address-book @1.1.0
13+ ## 1.0.3
14+
15+ ### Patch Changes
16+
17+ - Add fn to parse custom errors to toolshed package
1318
1419## 1.0.2
1520
Original file line number Diff line number Diff line change 1+ import { getInterface } from '@graphprotocol/interfaces'
2+ import { ErrorDescription } from 'ethers'
3+
4+ export function parseCustomError ( error : string ) : string | null {
5+ const interfaces = [
6+ getInterface ( 'HorizonStaking' ) ,
7+ getInterface ( 'SubgraphService' ) ,
8+ getInterface ( 'PaymentsEscrow' ) ,
9+ getInterface ( 'GraphTallyCollector' ) ,
10+ getInterface ( 'GraphPayments' ) ,
11+ ]
12+
13+ let decodedError : ErrorDescription | null = null
14+ for ( const iface of interfaces ) {
15+ decodedError = iface . parseError ( error )
16+ if ( decodedError ) {
17+ break
18+ }
19+ }
20+
21+ if ( ! decodedError ) {
22+ return null
23+ }
24+
25+ const argStrings = decodedError . fragment . inputs . map ( ( input , i ) => {
26+ const value = decodedError . args [ i ]
27+ return `${ input . name } : ${ value } `
28+ } )
29+
30+ return `${ decodedError . name } (${ argStrings . join ( ', ' ) } )`
31+ }
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ export * from './accounts'
22export * from './allocation'
33export * from './attestations'
44export * from './constants'
5+ export * from './custom-errors'
56export * from './disputes'
67export * from './graph-tally'
78export * from './poi'
You can’t perform that action at this time.
0 commit comments