@@ -9,9 +9,12 @@ Send a specified amount of BCH to a destination address
99#### Arguments
1010
1111- txParams ` Object ` containing to, from, and value properties
12- - to ` String ` cashaddr address of BCH destination
12+ - to ` String ` optional: cashaddr address of BCH destination
1313 - from ` String ` cashaddr address of user's address
14- - value ` String ` BCH amount to send in satoshis
14+ - value ` String ` optional: BCH amount to send in satoshis
15+ - opReturn ` Object ` optional:
16+ - Properties
17+ - data ` Array ` data to be encoded in ` nulldata ` output
1518- ` Callback ` with error and response parameters
1619
1720#### Result
@@ -39,6 +42,29 @@ Send a specified amount of BCH to a destination address
3942 })
4043 }
4144
45+ #### ` OP_RETURN ` Example
46+
47+ // write a memo post to the blockchain
48+ if (typeof web4bch !== 'undefined') {
49+ web4bch = new Web4Bch(web4bch.currentProvider)
50+
51+ var txParams = {
52+ to: "bitcoincash:pp8skudq3x5hzw8ew7vzsw8tn4k8wxsqsv0lt0mf3g",
53+ from: web4bch.bch.defaultAccount,
54+ value: "1000",
55+ opReturn: {
56+ data: ["0x6d02", "Hello BITBOX"]
57+ }
58+ }
59+ web4bch.bch.sendTransaction(txParams, (err, txid) => {
60+ if (err) {
61+ console.log('send err', err)
62+ } else {
63+ console.log('send success, transaction id:', txid)
64+ }
65+ })
66+ }
67+
4268#### Demo
4369
4470[ Demo Page] ( https://bitcoin-com.github.io/badger-samples/send-bch.html )
0 commit comments