Skip to content
This repository was archived by the owner on Feb 13, 2024. It is now read-only.

Commit 8e06910

Browse files
authored
Merge pull request #177 from Bitcoin-com/add-op-return-to-badger
Add OP_RETURN to badger docs.
2 parents 1663465 + a80ced4 commit 8e06910

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "developer.bitcoin.com",
33
"description": "Bitcoin.com developer resources and documentation",
4-
"version": "3.2.6",
4+
"version": "3.2.7",
55
"author": "Peter <peter@bitcoin.com> and Gabriel Cardona <gabriel@bitcoin.com>",
66
"dependencies": {
77
"badger-components-react": "^0.1.3",

src/data/docs/badger/send-bch.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ Send a specified amount of BCH to a destination address
1212
- to `String` cashaddr address of BCH destination
1313
- from `String` cashaddr address of user's address
1414
- value `String` 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: ["0x4811", "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

Comments
 (0)