Closed
Description
Ethers Version
6.6.0
Search Terms
No response
Describe the Problem
Priorites are sorted in descending order currently.
Lower numbers represent higher priority, so fallback provider priorities are expected to sort ascending, ie 1, 2, 3 - where priority 1 precedes 2 and 3.
Code Snippet
From fallback-provider.ts:
allConfigs.sort((a, b) => (b.priority - a.priority));
Passing test code to demonstrate the proper effect:
it('Should sort ascending and descending', () => {
const allConfigs = [
{
priority: 3,
},
{
priority: 1,
},
{
priority: 2,
},
];
// Ascending
allConfigs.sort((a, b) => a.priority - b.priority);
expect(allConfigs.map(c => c.priority)).to.deep.equal([1, 2, 3]);
// Descending
allConfigs.sort((a, b) => b.priority - a.priority);
expect(allConfigs.map(c => c.priority)).to.deep.equal([3, 2, 1]);
});
Contract ABI
No response
Errors
No response
Environment
No response
Environment (Other)
No response
Activity