Skip to content

Instantly share code, notes, and snippets.

@TechNinjaWeb
Forked from enricomors/app.ts
Created March 22, 2020 19:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TechNinjaWeb/c979f21fddcfcc6adf403464daba2757 to your computer and use it in GitHub Desktop.
Save TechNinjaWeb/c979f21fddcfcc6adf403464daba2757 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