Skip to content

Instantly share code, notes, and snippets.

@enricomors
Created February 18, 2020 12:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save enricomors/8049de8627adf44b73b9ab3d122110e1 to your computer and use it in GitHub Desktop.
Save enricomors/8049de8627adf44b73b9ab3d122110e1 to your computer and use it in GitHub Desktop.
async function sendPayment(franchisors: [string], newFranchisor: string, artist: string, bootlegger: string, price: number) {
franchisors.push(bootlegger)
franchisors.push(artist)
const dividedPrice = price/franchisors.length
for (let i = 0; i < franchisors.length; i++) {
const franchisor = franchisors[i]
const franchisorAccount = RadixAccount.fromAddress(franchisor)
const tokenUri = `/${newFranchisor}/BTL`
const res = await pay(franchisorAccount, tokenUri, dividedPrice)
console.log('payment completed')
}
}
async function pay(franchisorAccount: RadixAccount, tokenUri: string, amount: number) {
const transaction = RadixTransactionBuilder
.createTransferAtom(
serverIdentity.account,
franchisorAccount,
tokenUri,
amount
).signAndSubmit(serverIdentity)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment