File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed
src/experimental/erc7811/actions Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " viem " : patch
3+ ---
4+
5+ Fixed ` getAssets ` aggregation duplicates.
Original file line number Diff line number Diff line change @@ -125,12 +125,15 @@ export async function getAssets<
125125 const aggregated = { } as Record < string , getAssets . Asset < boolean > >
126126 for ( const [ chainId , assets ] of Object . entries ( response ) ) {
127127 if ( chainId === '0' ) continue
128+ const seen = new Set < string > ( )
128129 for ( const asset of assets ) {
129130 const key =
130131 typeof aggregate === 'function'
131132 ? aggregate ( asset )
132133 : ( asset . address ?? ethAddress )
133134 const item = ( aggregated [ key ] ?? { } ) as getAssets . Asset < true >
135+ if ( seen . has ( key ) ) continue
136+ seen . add ( key )
134137 aggregated [ key ] = {
135138 ...asset ,
136139 balance : asset . balance + ( item ?. balance ?? 0n ) ,
You can’t perform that action at this time.
0 commit comments