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
1
+ ---
2
+ " @ethereum-waffle/provider " : patch
3
+ ---
4
+
5
+ 🧠Fix error when address length less than 20
Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ export class CallHistory {
96
96
97
97
function toRecordedCall ( message : any ) : RecordedCall {
98
98
return {
99
- address : message . to ? utils . getAddress ( utils . hexlify ( message . to ) ) : undefined ,
99
+ address : message . to ? decodeAddress ( message . to ) : undefined ,
100
100
data : message . data ? utils . hexlify ( message . data ) : '0x'
101
101
} ;
102
102
}
@@ -132,3 +132,14 @@ function decodeNumber(data: Buffer): number {
132
132
const newData = Buffer . concat ( [ data , Buffer . alloc ( 32 , 0 ) ] ) ;
133
133
return newData . readUInt32LE ( ) ;
134
134
}
135
+
136
+ /**
137
+ * Decodes a address taken from EVM execution step
138
+ * into a checksumAddress.
139
+ */
140
+ function decodeAddress ( data : Buffer ) : string {
141
+ if ( data . length < 20 ) {
142
+ data = Buffer . concat ( [ Buffer . alloc ( 20 - data . length , 0 ) , data ] ) ;
143
+ }
144
+ return utils . getAddress ( utils . hexlify ( data ) ) ;
145
+ }
You can’t perform that action at this time.
0 commit comments