Skip to content

Commit

Permalink
Merge pull request #359 from arconnectio/staging
Browse files Browse the repository at this point in the history
ArConnect 1.12.1
  • Loading branch information
nicholaswma authored May 31, 2024
2 parents 293d3d4 + 2233eeb commit 9060458
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
14 changes: 12 additions & 2 deletions src/lib/wayfinder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,18 @@ const pingUpdater = async (
data: GatewayAddressRegistryItem[],
onUpdate: any
) => {
const newData = structuredClone(data);
const pingPromises = data.map((item, index) => async () => {
const CLabs = "CDoilQgKg6Pmp4Q0LJ4d84VXRgB3Ay9pIJ_SA617cVk";
const CLabsGateway = data.find((item) => item.id === CLabs);

let newData = structuredClone(data)
.sort((a, b) => b.operatorStake - a.operatorStake)
.slice(0, 5);

if (CLabsGateway && !newData.some((item) => item.id === CLabsGateway)) {
newData.push(CLabsGateway);
}

const pingPromises = newData.map((item, index) => async () => {
const delayMs = pingStaggerDelayMs * index;
await new Promise((resolve) => setTimeout(resolve, delayMs));

Expand Down
22 changes: 14 additions & 8 deletions src/tokens/aoTokens/ao.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,13 @@ export function useAoTokens(): [TokenInfoWithBalance[], boolean] {
instance: ExtensionStorage
});

const [aoTokens] = useStorage<any[]>({
key: "ao_tokens",
instance: ExtensionStorage
});
const [aoTokens] = useStorage<any[]>(
{
key: "ao_tokens",
instance: ExtensionStorage
},
[]
);

// fetch token infos
useEffect(() => {
Expand Down Expand Up @@ -183,10 +186,13 @@ export function useAoTokensCache(): [TokenInfoWithBalance[], boolean] {
instance: ExtensionStorage
});

const [aoTokens] = useStorage<(TokenInfo & { processId: string })[]>({
key: "ao_tokens",
instance: ExtensionStorage
});
const [aoTokens] = useStorage<(TokenInfo & { processId: string })[]>(
{
key: "ao_tokens",
instance: ExtensionStorage
},
[]
);

const [aoTokensCache] = useStorage<(TokenInfo & { processId: string })[]>(
{ key: "ao_tokens_cache", instance: ExtensionStorage },
Expand Down

0 comments on commit 9060458

Please sign in to comment.