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 f7dffbc
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/strategies/moxie/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,8 @@ export const author = '0xsarvesh';
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}`;
};
const MOXIE_API_KEY =
process.env.MOXIE_API_KEY || 'c6ed67f5b6314bd4a5c4dab98cebdd30';

//Strategy to Compute Voting Power for MoxieDAO
export async function strategy(
Expand All @@ -21,8 +16,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 f7dffbc

Please sign in to comment.