Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

Commit

Permalink
fix(gql): update types, use ar-io.dev
Browse files Browse the repository at this point in the history
  • Loading branch information
dtfiedler committed Nov 27, 2023
1 parent 4531096 commit 26d8b69
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 27 deletions.
38 changes: 12 additions & 26 deletions src/api/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
import Arweave from 'arweave';
import { ArNSInteraction } from '../types.js';
import { GQLNodeInterface, TagsParser } from 'warp-contracts';
import { GQLEdgeInterface, TagsParser } from 'warp-contracts';

export const MAX_REQUEST_SIZE = 100;

Expand Down Expand Up @@ -169,32 +169,18 @@ export async function getWalletInteractionsForContract(
if (!response.data.data?.transactions?.edges?.length) {
continue;
}
response.data.data.transactions.edges.forEach(
(e: {
cursor: string;
node: {
block: { height: number };
owner: { address: string };
id: string;
tags: { name: string; value: string }[];
};
pageInfo?: { hasNextPage: boolean };
}) => {
const inputTag = parser.getInputTag(
e.node as GQLNodeInterface,
contractTxId,
);
response.data.data.transactions.edges.forEach((e: GQLEdgeInterface) => {
const inputTag = parser.getInputTag(e.node, contractTxId);

const parsedInput = inputTag?.value
? JSON.parse(inputTag.value)
: undefined;
interactions.set(e.node.id, {
height: e.node.block.height,
input: parsedInput,
owner: e.node.owner.address,
});
},
);
const parsedInput = inputTag?.value
? JSON.parse(inputTag.value)
: undefined;
interactions.set(e.node.id, {
height: e.node.block.height,
input: parsedInput,
owner: e.node.owner.address,
});
});
cursor =
response.data.data.transactions.edges[MAX_REQUEST_SIZE - 1]?.cursor ??
undefined;
Expand Down
2 changes: 1 addition & 1 deletion src/middleware/arweave.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import Arweave from 'arweave';
export const arweave = new Arweave({
protocol: process.env.GATEWAY_PROTOCOL ?? 'https',
port: process.env.GATEWAY_PORT ?? 443,
host: process.env.GATEWAY_HOST ?? 'arweave.net',
host: process.env.GATEWAY_HOST ?? 'ar-io.dev',
});

export function arweaveMiddleware(ctx: KoaContext, next: Next) {
Expand Down

0 comments on commit 26d8b69

Please sign in to comment.