File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -103,7 +103,9 @@ export const decodeAttestation = (attestationData: string): Attestation => {
103103 attestationBytes ,
104104 )
105105 const sig = Signature . from (
106- hexlify ( attestationBytes . slice ( RECEIPT_SIZE_BYTES , RECEIPT_SIZE_BYTES + SIG_SIZE_BYTES ) )
106+ hexlify (
107+ attestationBytes . slice ( RECEIPT_SIZE_BYTES , RECEIPT_SIZE_BYTES + SIG_SIZE_BYTES ) ,
108+ ) ,
107109 )
108110
109111 return {
Original file line number Diff line number Diff line change 1+ import "ethers"
2+
3+ function commify ( value : string ) : string {
4+ const match = value . match ( / ^ ( - ? ) ( [ 0 - 9 ] * ) ( \. ? ) ( [ 0 - 9 ] * ) $ / ) ;
5+ if ( ! match || ( ! match [ 2 ] && ! match [ 4 ] ) ) {
6+ throw new Error ( `bad formatted number: ${ JSON . stringify ( value ) } ` ) ;
7+ }
8+
9+ const neg = match [ 1 ] ;
10+ const whole = BigInt ( match [ 2 ] || 0 ) . toLocaleString ( "en-us" ) ;
11+ const frac = match [ 4 ] ? ( match [ 4 ] . match ( / ^ ( .* ?) 0 * $ / ) ?. [ 1 ] || "0" ) : "0" ;
12+
13+ return `${ neg } ${ whole } .${ frac } ` ;
14+ }
You can’t perform that action at this time.
0 commit comments