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

Commit 0445441

Browse files
authored
Merge pull request #221 from Bitcoin-com/slp-sdk-updates
v4.1.0
2 parents 82f16c7 + 6b2730f commit 0445441

3 files changed

Lines changed: 271 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": "4.0.0",
4+
"version": "4.1.0",
55
"author": "Peter <peter@bitcoin.com> and Gabriel Cardona <gabriel@bitcoin.com>",
66
"dependencies": {
77
"badger-components-react": "^0.3.0",

src/data/docs/rest/slp.md

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,3 +351,135 @@ txid `String`
351351

352352
// returns
353353
7e9ff2924355f890ac45151dbb9aca0802d2b84fd478cc35ad62474d12a93b6b
354+
355+
## Balances by tokenId
356+
357+
List all balances for tokenId
358+
359+
**URL** : `v2/slp/balancesForToken/:tokenId",`
360+
361+
**Method** : `GET`
362+
363+
**Auth required** : NO
364+
365+
#### URL Parameters
366+
367+
1. tokenId `String` (required)
368+
369+
#### Result
370+
371+
balances `Array`
372+
373+
#### Examples
374+
375+
curl -X GET "https://rest.bitcoin.com/v2/slp/balancesForToken/df808a41672a0a0ae6475b44f272a107bc9961b90f29dc918d71301f24fe92fb" -H "accept: */*"
376+
377+
// returns
378+
[
379+
{
380+
"tokenBalance": 1000,
381+
"slpAddress": "simpleledger:qzhfd7ssy9nt4gw7j9w5e7w5mxx5w549rv7mknzqkz"
382+
},
383+
{
384+
"tokenBalance": 1000,
385+
"slpAddress": "simpleledger:qrzt52udhu6w6hh0ff8f54mjek5dkkxvyqym7rfqtc"
386+
}
387+
]
388+
389+
## Token Stats
390+
391+
Stats for token by tokenId
392+
393+
**URL** : `v2/slp/tokenStats/:tokenId",`
394+
395+
**Method** : `GET`
396+
397+
**Auth required** : NO
398+
399+
#### URL Parameters
400+
401+
1. tokenId `String` (required)
402+
403+
#### Result
404+
405+
stats `Object`
406+
407+
#### Examples
408+
409+
curl -X GET "https://rest.bitcoin.com/v2/slp/tokenStats/df808a41672a0a0ae6475b44f272a107bc9961b90f29dc918d71301f24fe92fb" -H "accept: */*"
410+
411+
// returns
412+
{
413+
"tokenId": "df808a41672a0a0ae6475b44f272a107bc9961b90f29dc918d71301f24fe92fb",
414+
"documentUri": "",
415+
"symbol": "NAKAMOTO",
416+
"name": "NAKAMOTO",
417+
"decimals": 8,
418+
"txnsSinceGenesis": 367,
419+
"validUtxos": 248,
420+
"validAddresses": 195,
421+
"circulatingSupply": 20995990,
422+
"totalBurned": 4010,
423+
"totalMinted": 21000000,
424+
"satoshisLockedUp": 135408
425+
}
426+
427+
## Transactions
428+
429+
SLP Transactions by tokenId and address
430+
431+
**URL** : `v2/slp/transactions/:tokenId/:address",`
432+
433+
**Method** : `GET`
434+
435+
**Auth required** : NO
436+
437+
#### URL Parameters
438+
439+
1. tokenId `String` (required)
440+
2. address `String` (required)
441+
442+
#### Result
443+
444+
transactions `Array`
445+
446+
#### Examples
447+
448+
curl -X GET "https://rest.bitcoin.com/v2/slp/transactions/495322b37d6b2eae81f045eda612b95870a0c2b6069c58f70cf8ef4e6a9fd43a/qrhvcy5xlegs858fjqf8ssl6a4f7wpstaqlsy4gusz" -H "accept: */*"
449+
450+
// returns
451+
[
452+
{
453+
"txid": "27e27170b546f05b2af69d6eddff8834038facf5d81302e9e562df09a5c4445f",
454+
"tokenDetails": {
455+
"valid": true,
456+
"detail": {
457+
"decimals": null,
458+
"tokenIdHex": "495322b37d6b2eae81f045eda612b95870a0c2b6069c58f70cf8ef4e6a9fd43a",
459+
"timestamp": null,
460+
"transactionType": "SEND",
461+
"versionType": 1,
462+
"documentUri": null,
463+
"documentSha256Hex": null,
464+
"symbol": null,
465+
"name": null,
466+
"batonVout": null,
467+
"containsBaton": null,
468+
"genesisOrMintQuantity": null,
469+
"sendOutputs": [
470+
{
471+
"$numberDecimal": "0"
472+
},
473+
{
474+
"$numberDecimal": "25"
475+
},
476+
{
477+
"$numberDecimal": "77"
478+
}
479+
]
480+
},
481+
"invalidReason": null,
482+
"schema_version": 30
483+
}
484+
}
485+
]

src/data/docs/slp/utils.md

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,3 +303,141 @@ validated : `Array`
303303
{ txid:
304304
'00ea27261196a411776f81029c0ebe34362936b4a9847deb1f7a40a02b3a1476',
305305
valid: true } ]
306+
307+
### `balancesForToken`
308+
309+
List all balances for tokenId
310+
311+
#### Arguments
312+
313+
1. tokenId: `String` required. The tokenId
314+
315+
#### Result
316+
317+
balances: `Array`
318+
319+
#### Examples
320+
321+
(async () => {
322+
try {
323+
let balances = await SLP.Utils.balancesForToken(
324+
"df808a41672a0a0ae6475b44f272a107bc9961b90f29dc918d71301f24fe92fb"
325+
)
326+
console.log(balances)
327+
} catch (error) {
328+
console.error(error)
329+
}
330+
})()
331+
332+
// returns
333+
[
334+
{ tokenBalance: 20,
335+
slpAddress: 'simpleledger:qp4g0q97tq53pasnxk2rs570c6573qvylunsf5gy9e' },
336+
{ tokenBalance: 335.55,
337+
slpAddress: 'simpleledger:qqcraw7q0ys3kg4z6f2zd267fhg2093c5c0spfk03f' }
338+
]
339+
340+
### `tokenStats`
341+
342+
Stats for token by tokenId
343+
344+
#### Arguments
345+
346+
1. tokenId: `String` required. The tokenId
347+
348+
#### Result
349+
350+
stats: `Object`
351+
352+
#### Examples
353+
354+
(async () => {
355+
try {
356+
let stats = await SLP.Utils.tokenStats(
357+
"df808a41672a0a0ae6475b44f272a107bc9961b90f29dc918d71301f24fe92fb"
358+
)
359+
console.log(stats)
360+
} catch (error) {
361+
console.error(error)
362+
}
363+
})()
364+
365+
// returns
366+
{ tokenId:
367+
'df808a41672a0a0ae6475b44f272a107bc9961b90f29dc918d71301f24fe92fb',
368+
documentUri: '',
369+
symbol: 'NAKAMOTO',
370+
name: 'NAKAMOTO',
371+
decimals: 8,
372+
txnsSinceGenesis: 367,
373+
validUtxos: 248,
374+
validAddresses: 195,
375+
circulatingSupply: 20995990,
376+
totalBurned: 4010,
377+
totalMinted: 21000000,
378+
satoshisLockedUp: 135408
379+
}
380+
381+
### `transactions`
382+
383+
SLP Transactions by tokenId and address
384+
385+
#### Arguments
386+
387+
1. tokenId: `String` required. The tokenId
388+
2. address: `String` required. The address
389+
390+
#### Result
391+
392+
transactions: `Array`
393+
394+
#### Examples
395+
396+
(async () => {
397+
try {
398+
let transactions = await SLP.Utils.transactions(
399+
"495322b37d6b2eae81f045eda612b95870a0c2b6069c58f70cf8ef4e6a9fd43a",
400+
"qrhvcy5xlegs858fjqf8ssl6a4f7wpstaqlsy4gusz"
401+
)
402+
console.log(transactions)
403+
} catch (error) {
404+
console.error(error)
405+
}
406+
})()
407+
408+
// returns
409+
[
410+
{
411+
"txid": "27e27170b546f05b2af69d6eddff8834038facf5d81302e9e562df09a5c4445f",
412+
"tokenDetails": {
413+
"valid": true,
414+
"detail": {
415+
"decimals": null,
416+
"tokenIdHex": "495322b37d6b2eae81f045eda612b95870a0c2b6069c58f70cf8ef4e6a9fd43a",
417+
"timestamp": null,
418+
"transactionType": "SEND",
419+
"versionType": 1,
420+
"documentUri": null,
421+
"documentSha256Hex": null,
422+
"symbol": null,
423+
"name": null,
424+
"batonVout": null,
425+
"containsBaton": null,
426+
"genesisOrMintQuantity": null,
427+
"sendOutputs": [
428+
{
429+
"$numberDecimal": "0"
430+
},
431+
{
432+
"$numberDecimal": "25"
433+
},
434+
{
435+
"$numberDecimal": "77"
436+
}
437+
]
438+
},
439+
"invalidReason": null,
440+
"schema_version": 30
441+
}
442+
}
443+
]

0 commit comments

Comments
 (0)