Skip to content

Instantly share code, notes, and snippets.

@niponchi
Created April 30, 2019 16:02
Show Gist options
  • Save niponchi/bb6524d80bcaa7a4bf73f9bca758dfce to your computer and use it in GitHub Desktop.
Save niponchi/bb6524d80bcaa7a4bf73f9bca758dfce to your computer and use it in GitHub Desktop.
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