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

Commit e8d324b

Browse files
authored
Merge pull request #179 from Bitcoin-com/stage
Add OP_RETURN to Badger docs
2 parents 8f24350 + 184eb46 commit e8d324b

2 files changed

Lines changed: 29 additions & 3 deletions

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: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)