Closed sidvishnoi closed 3 months ago
Name | Link |
---|---|
Latest commit | 7e3a01b0c0735dbc3abffdc5429c894a9411f540 |
Latest job logs | Run #9562731289 |
Download | |
Download |
Question:
https://webmonetization.org/docs/references/monetizationevent/ says we emit amountSent
with value and currency. There's no assetScale there.
And how's amountSent
different from receiveAmount
?
Question: https://webmonetization.org/docs/references/monetizationevent/ says we emit
amountSent
with value and currency. There's no assetScale there. And how'samountSent
different fromreceiveAmount
?
The current implementation is not following the spec. Based on the spec (https://webmonetization.org/specification/#amountsent-attribute), the currency should only be an ISO4217 string. I forgot about this part when sending the details about a monetization event from the background to the content script. We should convert the amount value to a user readable format:
// We should be careful about floating point precision as well
const amountSent = receiveAmount.value * 10 ** -receiveAmount.assetScale
The monetization event should only contain the following properties:
amountSent
- based on the PaymentCurrencyAcomuntpaymentPointer
incomingPayment
receiveAmount
should not be present.
the currency should only be an ISO4217 string
I think then the concern was crypto currencies not having those codes? Maybe something to figure out later?
the currency should only be an ISO4217 string
I think then the concern was crypto currencies not having those codes? Maybe something to figure out later?
This shouldn't really be an issue at the moment. Most ASE that enable WM for their user will probably run Rafiki, which has a constraint on the asset code as well - ISO4217: https://rafiki.dev/concepts/asset/.
Context
Closes https://github.com/interledger/web-monetization-extension/issues/9
Changes proposed in this pull request
MonetizationEvent
instead ofCustomEvent
with detailevent.detail
access for backward compat, but add a warning on accessing for first time.monetization-v2
to__wm-ext-monetization
, along withonmonetization-attribute-changed
.A sample code: