Skip to content

Commit 743f07c

Browse files
authored
feat: import delegate statement from safe (#447)
1 parent bf8001d commit 743f07c

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import agora from './agora';
22
import karmahq from './karmahq';
3+
import safe from './safe';
34
import tally from './tally';
45

56
export const PROVIDERS = {
67
tally,
78
karmahq,
8-
agora
9+
agora,
10+
safe
911
};
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import snapshot from '@snapshot-labs/snapshot.js';
2+
import { Provider } from './Provider';
3+
4+
export default class Safe extends Provider {
5+
static readonly MAPPING = {
6+
's:safe.eth': 'https://safe-claiming-app-data.safe.global/guardians/guardians.json'
7+
};
8+
9+
static readonly ID = 'safe';
10+
11+
async _fetch() {
12+
const results = await snapshot.utils.getJSON(Safe.MAPPING[this.spaceId]);
13+
14+
const delegates = results.map((result: any) => {
15+
return this.formatDelegate({
16+
delegate: result.address,
17+
statement: `${result.reason}\n\n${result.contribution}`.trim()
18+
});
19+
});
20+
21+
await this.afterFetchPage(0, delegates);
22+
}
23+
24+
getId(): string {
25+
return Safe.ID;
26+
}
27+
}

0 commit comments

Comments
 (0)