123456789101112131415161718192021222324252627282930313233 |
- const script = async ({ api, keyring, userAddress }) => {
- const sudoAddress = (await api.query.sudo.key()).toString()
- const destination = userAddress || sudoAddress
- let sender
- if (typeof window === 'undefined') {
-
- sender = keyring.getPair(destination)
- } else {
-
- sender = destination
- }
-
- const transfer = api.tx.balances.transfer(destination, 10)
- await transfer.signAndSend(sender)
- }
- if (typeof module === 'undefined') {
-
- script({ api, hashing, keyring, types, util, joy })
- } else {
-
- module.exports = script
- }
|