Skip to content

Commit

Permalink
Remove unused utility function (#796)
Browse files Browse the repository at this point in the history
  • Loading branch information
steebchen authored Oct 1, 2024
1 parent a57e505 commit 405f469
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions packages/controller/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import equal from "fast-deep-equal";
import { Policy } from "./types";
import { addAddressPadding } from "starknet";

export function diff(a: Policy[], b: Policy[]): Policy[] {
return a.reduce(
Expand All @@ -9,33 +8,3 @@ export function diff(a: Policy[], b: Policy[]): Policy[] {
[] as Policy[],
);
}

export const getAccounts = async (addresses: string[]) => {
const query = addresses.map((addr) => ({
contractAddress: addAddressPadding(addr),
}));

const res = await (
await fetch("https://api.cartridge.gg/query", {
headers: {
"content-type": "application/json",
},
body: `{\"query\":\"query AccountInfo($addresses: [AccountWhereInput!]!) {\\n accounts(where: { or: $addresses}) {\\n edges {\\n node {\\n id\\n contractAddress\\n }\\n }\\n }\\n}\",\"variables\":{\"addresses\":${JSON.stringify(
query,
)}},\"operationName\":\"AccountInfo\"}`,
method: "POST",
mode: "cors",
credentials: "omit",
})
).json();

if (res.errors) {
throw new Error(res.errors[0].message);
}

return res.accounts.edges.map((edge: any) => ({
id: edge.node.id,
name: edge.node.id,
profile_uri: `https://cartridge.gg/profile/${edge.node.contractAddress}`,
}));
};

0 comments on commit 405f469

Please sign in to comment.