Skip to content

Write data to the blockchain, with Moneybutton.

Notifications You must be signed in to change notification settings

deeb33/databutton

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Databutton

A Datacash plugin to build Moneybutton

code

Install

Include 3 scripts, in the following order:

<script src="https://api.moneybutton.com/moneybutton.js"></script>
<script src='https://unpkg.com/datacash'></script>
<script src='https://unpkg.com/databutton'></script>

Usage

Similar to datacash syntax, except that the cash part is replaced with button.

databutton.build({
  data: ["0x6d02", "hello world"],
  button: { $el: document.querySelector("#button") }
})

The button.$el can either be:

  • an element
  • selector

For example, you can use the selector notation instead of passing an element:

databutton.build({
  data: ["0x6d02", "hello world"],
  button: { $el: "#button" }
})

Advanced

1. Send Moneybutton attributes

You can pass additional Moneybutton parameters to databutton's button object:

databutton.build({
  data: ["0x6d02", "hello world"],
  button: {
    $el: "#button",
    label: "swipe",
    to: [address],
    amount: "1",
    currency: "USD",
    onPayment: function(msg) {
      console.log(msg)
    }
  }
})

2. Add money transfer options

You can also specify additional cash attribute to send money. This is possible through the $cash attribute.

Currently $cash only has only one attribute: to, which is equivalent to datacash's "cash.to" attribute usage.

Here's an example:

databutton.build({
  data: ["0x6d0c", "topic", "hello world"],
  button: {
    $el: "#button",
    $cash: {
      to: [{
        address: "qq4kp3w3yhhvy4gm4jgeza4vus8vpxgrwc90n8rhxe",
        value: 100000
      }]
    }
  }
})

About

Write data to the blockchain, with Moneybutton.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%