@snapshot-labs/snapshot.js 0.12.0-beta.3 → 0.12.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,18 +0,0 @@
1
- export declare const SNAPSHOT_SUBGRAPH_URL: {
2
- 1: string;
3
- 10: string;
4
- 56: string;
5
- 100: string;
6
- 137: string;
7
- 250: string;
8
- 42161: string;
9
- 11155111: string;
10
- };
11
- declare type Delegation = {
12
- delegator: string;
13
- delegate: string;
14
- space: string;
15
- timestamp: number;
16
- };
17
- export default function getDelegatesBySpace(network: string, space: string, snapshot?: string | number, options?: any): Promise<Delegation[]>;
18
- export {};
@@ -1,12 +0,0 @@
1
- import { StaticJsonRpcProvider } from '@ethersproject/providers';
2
- export default class Multicaller {
3
- network: string;
4
- provider: StaticJsonRpcProvider;
5
- abi: any[];
6
- options: any;
7
- calls: any[];
8
- paths: any[];
9
- constructor(network: string, provider: StaticJsonRpcProvider, abi: any[], options?: any);
10
- call(path: any, address: any, fn: any, params?: any): Multicaller;
11
- execute(from?: any): Promise<any>;
12
- }
@@ -1,6 +0,0 @@
1
- export default function getProvider(network: any, { broviderUrl }?: {
2
- broviderUrl?: string | undefined;
3
- }): any;
4
- export declare function getBatchedProvider(network: any, { broviderUrl }?: {
5
- broviderUrl?: string | undefined;
6
- }): any;
@@ -1,2 +0,0 @@
1
- export declare function signMessage(web3: any, msg: any, address: any): Promise<any>;
2
- export declare function getBlockNumber(provider: any): Promise<number>;
package/dist/utils.d.ts DELETED
@@ -1,85 +0,0 @@
1
- import Multicaller from './utils/multicaller';
2
- import { getSnapshots } from './utils/blockfinder';
3
- import getProvider from './utils/provider';
4
- import { signMessage, getBlockNumber } from './utils/web3';
5
- import { getHash, verify } from './sign/utils';
6
- import getDelegatesBySpace, { SNAPSHOT_SUBGRAPH_URL } from './utils/delegation';
7
- interface Options {
8
- url?: string;
9
- headers?: any;
10
- }
11
- interface Strategy {
12
- name: string;
13
- network?: string;
14
- params: any;
15
- }
16
- export declare function call(provider: any, abi: any[], call: any[], options?: any): Promise<any>;
17
- export declare function multicall(network: string, provider: any, abi: any[], calls: any[], options?: any): Promise<any>;
18
- export declare function subgraphRequest(url: string, query: any, options?: any): Promise<any>;
19
- export declare function getUrl(uri: any, gateway?: string): any;
20
- export declare function getJSON(uri: any, options?: any): Promise<any>;
21
- export declare function ipfsGet(gateway: string, ipfsHash: string, protocolType?: string): Promise<any>;
22
- export declare function sendTransaction(web3: any, contractAddress: string, abi: any[], action: string, params: any[], overrides?: {}): Promise<any>;
23
- export declare function getScores(space: string, strategies: Strategy[], network: string, addresses: string[], snapshot?: number | string, scoreApiUrl?: string, options?: any): Promise<any>;
24
- export declare function getVp(address: string, network: string, strategies: Strategy[], snapshot: number | 'latest', space: string, delegation: boolean, options?: Options): Promise<any>;
25
- export declare function validate(validation: string, author: string, space: string, network: string, snapshot: number | 'latest', params: any, options?: Options): Promise<any>;
26
- interface validateSchemaOptions {
27
- snapshotEnv?: string;
28
- spaceType?: string;
29
- }
30
- export declare function validateSchema(schema: any, data: any, options?: validateSchemaOptions): true | import("ajv").ErrorObject<string, Record<string, any>, unknown>[] | null | undefined;
31
- export declare function getEnsTextRecord(ens: string, record: string, network?: string, options?: any): Promise<any>;
32
- export declare function getSpaceUri(id: string, network?: string, options?: any): Promise<string | null>;
33
- export declare function getEnsOwner(ens: string, network?: string, options?: any): Promise<string | null>;
34
- export declare function getSpaceController(id: string, network?: string, options?: any): Promise<string | null>;
35
- export declare function clone(item: any): any;
36
- export declare function sleep(time: any): Promise<unknown>;
37
- export declare function getNumberWithOrdinal(n: any): string;
38
- export { getDelegatesBySpace, SNAPSHOT_SUBGRAPH_URL };
39
- declare const _default: {
40
- call: typeof call;
41
- multicall: typeof multicall;
42
- subgraphRequest: typeof subgraphRequest;
43
- ipfsGet: typeof ipfsGet;
44
- getUrl: typeof getUrl;
45
- getJSON: typeof getJSON;
46
- sendTransaction: typeof sendTransaction;
47
- getScores: typeof getScores;
48
- getVp: typeof getVp;
49
- validateSchema: typeof validateSchema;
50
- getEnsTextRecord: typeof getEnsTextRecord;
51
- getSpaceUri: typeof getSpaceUri;
52
- getEnsOwner: typeof getEnsOwner;
53
- getSpaceController: typeof getSpaceController;
54
- getDelegatesBySpace: typeof getDelegatesBySpace;
55
- clone: typeof clone;
56
- sleep: typeof sleep;
57
- getNumberWithOrdinal: typeof getNumberWithOrdinal;
58
- voting: {
59
- 'single-choice': typeof import("./voting/singleChoice").default;
60
- approval: typeof import("./voting/approval").default;
61
- quadratic: typeof import("./voting/quadratic").default;
62
- 'ranked-choice': typeof import("./voting/rankedChoice").default;
63
- weighted: typeof import("./voting/weighted").default;
64
- basic: typeof import("./voting/singleChoice").default;
65
- };
66
- getProvider: typeof getProvider;
67
- signMessage: typeof signMessage;
68
- getBlockNumber: typeof getBlockNumber;
69
- Multicaller: typeof Multicaller;
70
- getSnapshots: typeof getSnapshots;
71
- getHash: typeof getHash;
72
- verify: typeof verify;
73
- validate: typeof validate;
74
- SNAPSHOT_SUBGRAPH_URL: {
75
- 1: string;
76
- 10: string;
77
- 56: string;
78
- 100: string;
79
- 137: string;
80
- 250: string;
81
- 42161: string;
82
- 11155111: string;
83
- };
84
- };
85
- export default _default;
@@ -1,22 +0,0 @@
1
- import { ApprovalVote, Strategy } from './types';
2
- export default class ApprovalVoting {
3
- proposal: {
4
- choices: string[];
5
- };
6
- votes: ApprovalVote[];
7
- strategies: Strategy[];
8
- selected: number[];
9
- constructor(proposal: {
10
- choices: string[];
11
- }, votes: ApprovalVote[], strategies: Strategy[], selected: number[]);
12
- static isValidChoice(voteChoice: number[], proposalChoices: string[]): boolean;
13
- getValidVotes(): {
14
- choice: number[];
15
- balance: number;
16
- scores: number[];
17
- }[];
18
- getScores(): number[];
19
- getScoresByStrategy(): number[][];
20
- getScoresTotal(): number;
21
- getChoiceString(): string;
22
- }
@@ -1,14 +0,0 @@
1
- import singleChoice from './singleChoice';
2
- import approval from './approval';
3
- import quadratic from './quadratic';
4
- import rankedChoice from './rankedChoice';
5
- import weighted from './weighted';
6
- declare const _default: {
7
- 'single-choice': typeof singleChoice;
8
- approval: typeof approval;
9
- quadratic: typeof quadratic;
10
- 'ranked-choice': typeof rankedChoice;
11
- weighted: typeof weighted;
12
- basic: typeof singleChoice;
13
- };
14
- export default _default;
@@ -1,20 +0,0 @@
1
- import { QuadraticVote, QuadraticChoice, Strategy } from './types';
2
- export declare function calcPercentageOfSum(part: number, wholeArray: number[]): number;
3
- export declare function calcSqrt(percentageWeight: number, votingPower: number): number;
4
- export default class QuadraticVoting {
5
- proposal: {
6
- choices: string[];
7
- };
8
- votes: QuadraticVote[];
9
- strategies: Strategy[];
10
- selected: QuadraticChoice;
11
- constructor(proposal: {
12
- choices: string[];
13
- }, votes: QuadraticVote[], strategies: Strategy[], selected: QuadraticChoice);
14
- static isValidChoice(voteChoice: QuadraticChoice, proposalChoices: string[]): boolean;
15
- getValidVotes(): QuadraticVote[];
16
- getScores(): number[];
17
- getScoresByStrategy(): number[][];
18
- getScoresTotal(): number;
19
- getChoiceString(): string;
20
- }
@@ -1,18 +0,0 @@
1
- import { RankedChoiceVote, Strategy } from './types';
2
- export default class RankedChoiceVoting {
3
- proposal: {
4
- choices: string[];
5
- };
6
- votes: RankedChoiceVote[];
7
- strategies: Strategy[];
8
- selected: number[];
9
- constructor(proposal: {
10
- choices: string[];
11
- }, votes: RankedChoiceVote[], strategies: Strategy[], selected: number[]);
12
- static isValidChoice(voteChoice: number[], proposalChoices: string[]): boolean;
13
- getValidVotes(): RankedChoiceVote[];
14
- getScores(): number[];
15
- getScoresByStrategy(): number[][];
16
- getScoresTotal(): number;
17
- getChoiceString(): string;
18
- }
@@ -1,18 +0,0 @@
1
- import { SingleChoiceVote, Strategy } from './types';
2
- export default class SingleChoiceVoting {
3
- proposal: {
4
- choices: string[];
5
- };
6
- votes: SingleChoiceVote[];
7
- strategies: Strategy[];
8
- selected: number;
9
- constructor(proposal: {
10
- choices: string[];
11
- }, votes: SingleChoiceVote[], strategies: Strategy[], selected: number);
12
- static isValidChoice(voteChoice: number, proposalChoices: string[]): boolean;
13
- getValidVotes(): SingleChoiceVote[];
14
- getScores(): number[];
15
- getScoresByStrategy(): number[][];
16
- getScoresTotal(): number;
17
- getChoiceString(): string;
18
- }
@@ -1,35 +0,0 @@
1
- export interface Strategy {
2
- name: string;
3
- network: string;
4
- params: Record<string, unknown>;
5
- }
6
- export interface SingleChoiceVote {
7
- choice: number;
8
- balance: number;
9
- scores: number[];
10
- }
11
- export interface ApprovalVote {
12
- choice: number[];
13
- balance: number;
14
- scores: number[];
15
- }
16
- export interface RankedChoiceVote {
17
- choice: number[];
18
- balance: number;
19
- scores: number[];
20
- }
21
- export interface QuadraticChoice {
22
- [key: string]: number;
23
- }
24
- export interface QuadraticVote {
25
- choice: QuadraticChoice;
26
- balance: number;
27
- scores: number[];
28
- }
29
- export interface WeightedVote {
30
- choice: {
31
- [key: string]: number;
32
- };
33
- balance: number;
34
- scores: number[];
35
- }
@@ -1,26 +0,0 @@
1
- import { WeightedVote, Strategy } from './types';
2
- export declare function percentageOfTotal(i: any, values: any, total: any): number;
3
- export declare function weightedPower(i: any, choice: any, balance: any): number;
4
- export default class WeightedVoting {
5
- proposal: {
6
- choices: string[];
7
- };
8
- votes: WeightedVote[];
9
- strategies: Strategy[];
10
- selected: {
11
- [key: string]: number;
12
- };
13
- constructor(proposal: {
14
- choices: string[];
15
- }, votes: WeightedVote[], strategies: Strategy[], selected: {
16
- [key: string]: number;
17
- });
18
- static isValidChoice(voteChoice: {
19
- [key: string]: number;
20
- }, proposalChoices: string[]): boolean;
21
- getValidVotes(): WeightedVote[];
22
- getScores(): number[];
23
- getScoresByStrategy(): number[][];
24
- getScoresTotal(): number;
25
- getChoiceString(): string;
26
- }