GithubHelp home page GithubHelp logo

isabella232 / csv-payouts Goto Github PK

View Code? Open in Web Editor NEW

This project forked from w3f/csv-payouts

0.0 0.0 0.0 141 KB

A tool for execution transaction from a CSV list.

License: MIT License

TypeScript 100.00%

csv-payouts's Introduction

CSV Payouts

About

This script reads a list of recipients and the corresonding amounts to be sent and executes each entry as a transaction on substrate based networks.

Config

See config/ for some examples.

Main

endpoint: wss://rpc.polkadot.io
actionFilePath: config/sample.actions.csv
keystore:
  walletFilePath: config/sample.key.json
  password: "p4ssw0rd"

Action / CSV File

The action file contains a list of <RECIPIENT>,<AMOUNT> pairs that dictate what transactions should be executed. For example;

1YgA2g4yVkKcDVktHrgEMT7n6YrU3tebH9Tu3hfpaiMCJJS,4
1PGsXH1HqkBMsQGcyHJscE9VxUnS9XSBHKFmkB8r4Vc7YFW,3.5
16VQH2rDYVGitsifyoNhwQyDQ5xFbR44i6vaQEayEqZ3nnn5,10

This script handles the conversion to the chains base units, e.g. if you specify 4 on Polkadot (implying 4 DOTs to be sent) that the script will convert it automatically to 4000000000 units.

Wallet File

The account that should be used to execute the transaction. It expects a json file exported from polkadot.js.org which is decrypted with the associated password.

Execution

$ yarn
$ yarn start -c config.yaml

Here's an example on the Westend network:

2022-05-11 22:14:25 debug: Reading config from file config.yaml
2022-05-11 22:14:25 debug: Reading from file actions.csv
2022-05-11 22:14:25 info: Parsed 2 CSV entries
2022-05-11 22:14:25 debug: Reading account key from westend_tester.json
2022-05-11 22:14:26 info: There are 2 actions to be executed
2022-05-11 22:14:26 info: To execute: 0.2 to 5G6v76Rc59TLKpUcQPrgaC8iPSVsLSDRNDnmNsGggV6HFwkB
2022-05-11 22:14:26 info: To execute: 0.3 to 5D2jJMny94255JRtHpuyDAddFmPrrUXj1s1ZeUzFg6EeH76Q
2022-05-11 22:14:26 debug: Initializing websocket endpoint at wss://westend-rpc.polkadot.io
2022-05-11 22:14:26 info: Starting transfer progress...
2022-05-11 22:14:27 info: Sent 0.2 (200000000000 units) to 5G6v76Rc59TLKpUcQPrgaC8iPSVsLSDRNDnmNsGggV6HFwkB with hash 0x4587ffa38e47766350014529ae0d2b5834a7ded573210b8a9c7f1f4fa8dda19f
2022-05-11 22:14:27 info: Sent 0.3 (300000000000 units) to 5D2jJMny94255JRtHpuyDAddFmPrrUXj1s1ZeUzFg6EeH76Q with hash 0xc44b33afa5b3f1a69ec59dec4794253b2e0bd95b54a818bb66f6de2773e9583d
2022-05-11 22:14:27 info: Payouts completed.
Done in 1.67s.

Caching

Execution creates a local .action_cache.json file which keeps track of which transactions have already been executed. Aborting the process and restarting will skip the already completed transactions and continue with the remaining entries of the CSV list until all have been successfully executed.

csv-payouts's People

Contributors

ironoa avatar lamafab avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.