-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement CSV Grain Integration Plugin (#3078)
This plugin outputs a csv file. Each row contains a payout address in the first column and the raw amount to be paid in the second column. The file content is returned to SourceCred, which will handle file I/O on behalf of plugins. grain integrations shall be prefixed in their package.json files with `sc-grainIntegration-*` this will allow for grouping and filtering using lerna and allow for a clean change in the scope of concerns. The output is optimized for https://disperse.app test plan: unit tests are provided
- Loading branch information
Showing
13 changed files
with
1,415 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// @flow | ||
|
||
const presets = [ | ||
[ | ||
"@babel/preset-env", | ||
{ | ||
targets: { | ||
edge: "17", | ||
firefox: "60", | ||
chrome: "67", | ||
safari: "11.1", | ||
node: true, | ||
}, | ||
}, | ||
], | ||
"@babel/preset-flow", | ||
]; | ||
|
||
module.exports = { presets }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// @flow | ||
module.exports = { | ||
parser: "babel-eslint", | ||
plugins: ["flowtype", "react"], | ||
env: { | ||
browser: true, | ||
es6: true, | ||
node: true, | ||
jest: true, | ||
}, | ||
parserOptions: { | ||
ecmaVersion: 2018, | ||
sourceType: "module", | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
}, | ||
extends: [ | ||
"eslint:recommended", | ||
"plugin:react/recommended", | ||
"plugin:flowtype/recommended", | ||
], | ||
rules: { | ||
"prefer-const": ["warn"], | ||
camelcase: [ | ||
"error", | ||
{properties: "never", allow: ["^_unused_.*", "(_\\d+)+"]}, | ||
], | ||
eqeqeq: ["error", "always", {null: "ignore"}], | ||
"no-unused-vars": [ | ||
"warn", | ||
{ | ||
argsIgnorePattern: "^_$|^_unused_", | ||
varsIgnorePattern: "^_$|^_unused_", | ||
caughtErrorsIgnorePattern: "^_$|^_unused_", | ||
}, | ||
], | ||
"no-constant-condition": ["warn", {checkLoops: false}], | ||
"no-inner-declarations": ["off"], | ||
"no-use-before-define": ["off"], | ||
"no-useless-constructor": ["off"], | ||
"no-case-declarations": ["off"], | ||
"react/prop-types": ["off"], | ||
"flowtype/generic-spacing": ["off"], | ||
"flowtype/space-after-type-colon": ["off"], | ||
}, | ||
settings: { | ||
react: { | ||
version: "detect", | ||
}, | ||
}, | ||
globals: { | ||
BigInt: "readonly", | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# If modifying this file, please modify .flowconfig-ci too! | ||
[ignore] | ||
|
||
[include] | ||
|
||
[libs] | ||
flow-typed | ||
|
||
[lints] | ||
|
||
[options] | ||
include_warnings=true | ||
|
||
[strict] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# If modifying this file, please modify .flowconfig too! | ||
[ignore] | ||
|
||
[include] | ||
|
||
[libs] | ||
flow-typed | ||
|
||
[lints] | ||
|
||
[options] | ||
include_warnings=true | ||
server.max_workers=1 | ||
types_first=false | ||
|
||
[strict] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// @flow | ||
|
||
/*:: type PayoutDistributions = $ReadOnlyArray<[string, string]>;*/ | ||
module.exports = function payoutDistributionToCsv( | ||
payoutDistributions /*: PayoutDistributions*/ | ||
) /*: string*/ { | ||
let csvString = ""; | ||
for (const [payoutAddress, amount] of payoutDistributions) { | ||
csvString += `${payoutAddress},${amount}\n`; | ||
} | ||
return csvString; | ||
}; |
Oops, something went wrong.