type Purchase = {
purchaseId: Hash // a unique ID for this purchase
merchantId: Hash // the merchant's ID (or similar, details are unimportant)
metadata: {
// Same as the "metadata" field we have now,
camshowId: 1234
performerId: 5678
...
},
recipients: Array<{
address: EthAddress
amount: uint256
currency: 'ETH' | 'BOOTY' | …
custodialRecipient: EthAddress | null
type: 'TIP' | 'FEE' // We'll need this for accounting
}
}>
}
let tipAmount = new BigNumber(amountBooty)
let tipFees = tipAmount.mul(0.05)
let purchase = await vynos.buy({
type: 'TIP', // do we need this here?
merchantId: config.CAMSITE_MERCHANT_ID,
// The hub will assign this a purchaseId
recipients: [
{
address: show.performerAddress,
type: 'TIP', // Maybe this should be in metadata?
amount: tipAmount.sub(tipFees),
currency: 'BOOTY',
address: config.HUB_WALLET_ADDRESS,
type: 'TIP_FEE', // Maybe this should be in metadata?
amount: tipFees,
],
fields: {
streamId: show.id,
streamName: show.subject,
performerId: show.performerId,
performerName: show.performerUsername,
tipperName: fromUser.username,
type Purchase = {
purchaseId: Hash // a unique ID for this purchase
merchantId: Hash // the merchant's ID (or similar, details are unimportant)
metadata: {
// Same as the "metadata" field we have now,
camshowId: 1234
performerId: 5678
...
},
recipients: Array<{
address: EthAddress
amount: uint256
currency: 'ETH' | 'BOOTY' | …
custodialRecipient: EthAddress | null
metadata: {
type: 'TIP' | 'FEE' // We'll need this for accounting
}
}>
}
Proposed Vynos “buy” API
let tipAmount = new BigNumber(amountBooty)
let tipFees = tipAmount.mul(0.05)
let purchase = await vynos.buy({
type: 'TIP', // do we need this here?
merchantId: config.CAMSITE_MERCHANT_ID,
// The hub will assign this a purchaseId
recipients: [
{
address: show.performerAddress,
type: 'TIP', // Maybe this should be in metadata?
amount: tipAmount.sub(tipFees),
currency: 'BOOTY',
},
{
address: config.HUB_WALLET_ADDRESS,
type: 'TIP_FEE', // Maybe this should be in metadata?
amount: tipFees,
currency: 'BOOTY',
},
],
fields: {
streamId: show.id,
streamName: show.subject,
performerId: show.performerId,
performerName: show.performerUsername,
tipperName: fromUser.username,