j"19HxigV4QyBv3tHpQVcUEQyq1pzZVdoAutMÁ<html><head>
<title>Money Button</title>
</head>
<body>
<div id="generation-div">Generation <span id="generation-span">2</span></div>
<div id="money-button"></div>
<div id="results"></div>
<script src="https://www.moneybutton.com/moneybutton.js"></script>
<script type="text/javascript">
function buf2hex(buffer) {
return Array.prototype.map.call(new Uint8Array(buffer), x => ('00' + x.toString(16)).slice(-2)).join('')
}
let count = parseInt(document.getElementById('generation-span').innerHTML, 10)
let html = document.documentElement.outerHTML
html = html.replace(
`<div id="generation-div">Generation <span id="generation-span">${count}</span></div>`,
`<div id="generation-div">Generation <span id="generation-span">${count + 1}</span></div>`
)
let binhtml = new TextEncoder("utf-8").encode(html)
let hexhtml = buf2hex(binhtml)
let script = `OP_RETURN 31394878696756345179427633744870515663554551797131707a5a56646f417574 ${hexhtml} 746578742f68746d6c`
let buttonDiv = document.getElementById('money-button')
let resultDiv = document.getElementById('results')
moneyButton.render(buttonDiv, {
outputs: [{
type: "USER",
userId: "1040",
amount: "0.01",
currency: "USD"
}, {
type: "SCRIPT",
script: script,
amount: "0",
currency: "USD"
}],
label: "Spawn",
clientIdentifier: "a43dc7396506a5ad6a41266b585a223f",
buttonId: "spawn-button",
buttonData: "{}",
type: "tip",
successMessage: "Yummy!",
onPayment: function (arg) {
let txid = arg.txid
resultDiv.innerHTML = `<a href="https://static.pagereturn.com/${txid}">Spawn success! See the new Money Button!</a>`
},
onError: function (arg) {
resultDiv.innterHTML = `Error: ${arg}`
}
})
</script></body></html> text/html
https://whatsonchain.com/tx/d562ee02b41ae73ad79fb4c9d8ec00f29a5f98eaef8443e8ccb586afac506a1e