-
-
Save niponchi/bb6524d80bcaa7a4bf73f9bca758dfce to your computer and use it in GitHub Desktop.
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
const distributeXlm = async (masterAccount, amount, ...walletAccounts) => { | |
console.log('distribute xlm') | |
let account = await server.loadAccount(masterAccount.publicKey()) | |
let txBuilder = new TransactionBuilder(account, { fee: 100 }) | |
.setTimeout(TimeoutInfinite) | |
walletAccounts.forEach(w => { | |
txBuilder.addOperation( | |
Operation.payment({ | |
amount: `${amount}`, | |
asset: Asset.native(), | |
destination: w.publicKey(), | |
}) | |
) | |
}) | |
const transaction = txBuilder.build() | |
transaction.sign(masterAccount) | |
return server.submitTransaction(transaction) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment