Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Feb 13, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "developer.bitcoin.com",
"description": "Bitcoin.com developer resources and documentation",
"version": "3.3.1",
"version": "3.3.2",
"author": "Peter <[email protected]> and Gabriel Cardona <[email protected]>",
"dependencies": {
"badger-components-react": "^0.1.3",
Expand Down
54 changes: 21 additions & 33 deletions src/data/docs/slp/utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,60 +222,48 @@ Validate that txid is an SLP transaction

#### Arguments

1. txid : `String` required. The transaction id to validate
2. network : `String` required. mainnet or testnet
3. getRawTransactions: `Function` optional.
1. txid : `String` or `Array` required. The transaction id(s) to validate

#### Result

isValid : `Boolean`
validated : `Array`

#### Examples

// validate SLP txid
// validate single SLP txid
(async () => {
try {
let isValid = await SLP.Utils.validateTxid(
"df808a41672a0a0ae6475b44f272a107bc9961b90f29dc918d71301f24fe92fb",
"mainnet"
let validated = await SLP.Utils.validateTxid(
"df808a41672a0a0ae6475b44f272a107bc9961b90f29dc918d71301f24fe92fb"
);
console.log(isValid);
console.log(validated);
} catch (error) {
console.error(error);
}
})();

// returns
true

### `createValidator`

Create and return a local validator

#### Arguments

1. network : `String` required. mainnet or testnet
2. getRawTransactions: `Function` optional.
[ { txid:
'df808a41672a0a0ae6475b44f272a107bc9961b90f29dc918d71301f24fe92fb',
valid: true } ]

#### Result

slpValidator : `slpValidator`

#### Examples

// create validator
// validate multiple SLP txids
(async () => {
try {
const slpValidator = SLP.Utils.createValidator(
process.env.NETWORK,
getRawTransactionsFromNode.bind(this)
)
const isValid = await slpValidator.isValidSlpTxid(txid)
console.log(isvalid)
let validated = await SLP.Utils.validateTxid([
"df808a41672a0a0ae6475b44f272a107bc9961b90f29dc918d71301f24fe92fb",
"00ea27261196a411776f81029c0ebe34362936b4a9847deb1f7a40a02b3a1476"
]);
console.log(validated);
} catch (error) {
console.error(error);
}
})();

// returns
// true
[ { txid:
'df808a41672a0a0ae6475b44f272a107bc9961b90f29dc918d71301f24fe92fb',
valid: true },
{ txid:
'00ea27261196a411776f81029c0ebe34362936b4a9847deb1f7a40a02b3a1476',
valid: true } ]