Skip to content

Commit

Permalink
Updated to post request to handle upto 500 addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
0xsarvesh committed Oct 25, 2024
1 parent 22fc6af commit 6ee94e7
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/strategies/moxie/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ export const version = '0.0.2';
const MOXIE_ENDPOINT = 'https://api.moxie.xyz/protocol/address-votes';
const MOXIE_API_KEY = process.env.MOXIE_API_KEY || '';

const buildURL = (addresses, snapshot) => {
const addressesParam = addresses.join(',');
const snapshotParam = snapshot ? `&block=${snapshot}` : '&block=latest';
return `${MOXIE_ENDPOINT}?addresses=${addressesParam}${snapshotParam}`;
};

//Strategy to Compute Voting Power for MoxieDAO
export async function strategy(
space,
Expand All @@ -21,8 +15,12 @@ export async function strategy(
options,
snapshot
) {
const response = await customFetch(buildURL(addresses, snapshot), {
method: 'GET',
const response = await customFetch(MOXIE_ENDPOINT, {
method: 'POST',
body: JSON.stringify({
block: snapshot,
addresses
}),
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
Expand Down

0 comments on commit 6ee94e7

Please sign in to comment.