diff --git a/src/strategies/ens-domains-owned/examples.json b/src/strategies/ens-domains-owned/examples.json index c2f2842f0..b1f73b304 100644 --- a/src/strategies/ens-domains-owned/examples.json +++ b/src/strategies/ens-domains-owned/examples.json @@ -11,7 +11,8 @@ "network": "1", "addresses": [ "0xaCf4C2950107eF9b1C37faA1F9a866C8F0da88b9", - "0x0239769A1aDF4DeF9f07Da824B80B9C4fCB59593" + "0x0239769A1aDF4DeF9f07Da824B80B9C4fCB59593", + "0x8d2f3a76a76f055D62A931678ab16b042E7BADeb" ], "snapshot": 11414195 } diff --git a/src/strategies/ens-domains-owned/index.ts b/src/strategies/ens-domains-owned/index.ts index b1086827f..a776946e7 100644 --- a/src/strategies/ens-domains-owned/index.ts +++ b/src/strategies/ens-domains-owned/index.ts @@ -27,31 +27,38 @@ export async function strategy( const params = Object.fromEntries( pages .map((page, i) => `_${i}`) - .map((q, i) => [ - q, - { - __aliasFor: 'domains', - __args: { - block: snapshot !== 'latest' ? { number: snapshot } : undefined, - where: { - name: options.domain - }, - first: 1000 + .map((q, i) => { + const args: any = { + where: { + name: options.domain }, - id: true, - labelName: true, - subdomains: { - __args: { - where: { - owner_in: pages[i].map((address) => address.toLowerCase()) + first: 1000 + }; + + if (snapshot !== 'latest') { + args.block = { number: snapshot }; + } + + return [ + q, + { + __aliasFor: 'domains', + __args: args, + id: true, + labelName: true, + subdomains: { + __args: { + where: { + owner_in: pages[i].map((address) => address.toLowerCase()) + } + }, + owner: { + id: true } - }, - owner: { - id: true } } - } - ]) + ]; + }) ); let result = await subgraphRequest(ENS_SUBGRAPH_URL[network], params);