Skip to content

Commit e66e27b

Browse files
author
Gabriel Cardona
authored
Merge pull request #490 from Bitcoin-com/stage
v3.12.2
2 parents a1f8cea + fea3557 commit e66e27b

47 files changed

Lines changed: 1501 additions & 6549 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ slp-tx-db/
1111
logs/
1212
package-lock.json
1313
yarn-error.log
14+
*.DS_Store
15+
./**/*.DS_STORE

dist/app.js

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ var debug = require("debug")("rest-cloud:server");
1717
var http = require("http");
1818
var cors = require("cors");
1919
var AuthMW = require("./middleware/auth");
20-
// const BitcoinCashZMQDecoder = require("bitcoincash-zmq-decoder")
21-
// const zmq = require("zeromq")
22-
// const sock: any = zmq.socket("sub")
2320
var swStats = require("swagger-stats");
2421
var apiSpec;
2522
if (process.env.NETWORK === "mainnet") {
@@ -28,22 +25,6 @@ if (process.env.NETWORK === "mainnet") {
2825
else {
2926
apiSpec = require("./public/bitcoin-com-testnet-rest-v2.json");
3027
}
31-
// v1
32-
var indexV1 = require("./routes/v1/index");
33-
var healthCheckV1 = require("./routes/v1/health-check");
34-
var addressV1 = require("./routes/v1/address");
35-
var blockV1 = require("./routes/v1/block");
36-
var blockchainV1 = require("./routes/v1/blockchain");
37-
var controlV1 = require("./routes/v1/control");
38-
var generatingV1 = require("./routes/v1/generating");
39-
var miningV1 = require("./routes/v1/mining");
40-
var networkV1 = require("./routes/v1/network");
41-
var rawtransactionsV1 = require("./routes/v1/rawtransactions");
42-
var transactionV1 = require("./routes/v1/transaction");
43-
var utilV1 = require("./routes/v1/util");
44-
var dataRetrievalV1 = require("./routes/v1/dataRetrieval");
45-
var payloadCreationV1 = require("./routes/v1/payloadCreation");
46-
var slpV1 = require("./routes/v1/slp");
4728
// v2
4829
var indexV2 = require("./routes/v2/index");
4930
var healthCheckV2 = require("./routes/v2/health-check");
@@ -83,23 +64,7 @@ app.use(function (req, res, next) {
8364
req.io = io;
8465
next();
8566
});
86-
var v1prefix = "v1";
8767
var v2prefix = "v2";
88-
app.use("/", indexV1);
89-
app.use("/" + v1prefix + "/" + "health-check", healthCheckV1);
90-
app.use("/" + v1prefix + "/" + "address", addressV1);
91-
app.use("/" + v1prefix + "/" + "blockchain", blockchainV1);
92-
app.use("/" + v1prefix + "/" + "block", blockV1);
93-
app.use("/" + v1prefix + "/" + "control", controlV1);
94-
app.use("/" + v1prefix + "/" + "generating", generatingV1);
95-
app.use("/" + v1prefix + "/" + "mining", miningV1);
96-
app.use("/" + v1prefix + "/" + "network", networkV1);
97-
app.use("/" + v1prefix + "/" + "rawtransactions", rawtransactionsV1);
98-
app.use("/" + v1prefix + "/" + "transaction", transactionV1);
99-
app.use("/" + v1prefix + "/" + "util", utilV1);
100-
app.use("/" + v1prefix + "/" + "dataRetrieval", dataRetrievalV1);
101-
app.use("/" + v1prefix + "/" + "payloadCreation", payloadCreationV1);
102-
app.use("/" + v1prefix + "/" + "slp", slpV1);
10368
// Instantiate the authorization middleware, used to implement pro-tier rate limiting.
10469
var auth = new AuthMW();
10570
app.use("/" + v2prefix + "/", auth.mw());
@@ -151,43 +116,6 @@ console.log("rest.bitcoin.com started on port " + port);
151116
*/
152117
var server = http.createServer(app);
153118
var io = require("socket.io").listen(server);
154-
// io.on("connection", (socket: Socket) => {
155-
// // console.log("Socket Connected")
156-
// socket.on("disconnect", () => {
157-
// // console.log("Socket Disconnected")
158-
// })
159-
// })
160-
/**
161-
* Setup ZMQ connections if ZMQ URL and port provided
162-
*/
163-
// if (process.env.ZEROMQ_URL && process.env.ZEROMQ_PORT) {
164-
// console.log(
165-
// `Connecting to BCH ZMQ at ${process.env.ZEROMQ_URL}:${process.env.ZEROMQ_PORT}`
166-
// )
167-
// const bitcoincashZmqDecoder = new BitcoinCashZMQDecoder(process.env.NETWORK)
168-
// sock.connect(`tcp://${process.env.ZEROMQ_URL}:${process.env.ZEROMQ_PORT}`)
169-
// sock.subscribe("raw")
170-
// sock.on("message", (topic: any, message: string) => {
171-
// try {
172-
// const decoded = topic.toString("ascii")
173-
// if (decoded === "rawtx") {
174-
// const txd = bitcoincashZmqDecoder.decodeTransaction(message)
175-
// io.emit("transactions", JSON.stringify(txd, null, 2))
176-
// } else if (decoded === "rawblock") {
177-
// const blck = bitcoincashZmqDecoder.decodeBlock(message)
178-
// io.emit("blocks", JSON.stringify(blck, null, 2))
179-
// }
180-
// } catch (error) {
181-
// const errorMessage = "Error processing ZMQ message"
182-
// console.log(errorMessage, error)
183-
// wlogger.error(errorMessage, error)
184-
// }
185-
// })
186-
// } else {
187-
// console.log(
188-
// "ZEROMQ_URL and ZEROMQ_PORT env vars missing. Skipping ZMQ connection."
189-
// )
190-
// }
191119
/**
192120
* Listen on provided port, on all network interfaces.
193121
*/

dist/public/bitcoin-com-mainnet-rest-v2.json

Lines changed: 168 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22
"components": {
33
"schemas": {
44
"Address": {
5+
"type": "object",
6+
"properties": {
7+
"addresses": {
8+
"type": "string"
9+
},
10+
"tokenIds": {
11+
"type": "string"
12+
}
13+
}
14+
},
15+
"BalanceAddress": {
516
"type": "string"
617
},
718
"Hash": {
@@ -28,6 +39,9 @@
2839
"SLPTokenId": {
2940
"type": "string"
3041
},
42+
"SLPAddress": {
43+
"type": "string"
44+
},
3145
"RawTxid": {
3246
"type": "string"
3347
},
@@ -40,6 +54,13 @@
4054
"Proof": {
4155
"type": "string"
4256
},
57+
"BalanceAddresses": {
58+
"type": "array",
59+
"items": {
60+
"$ref": "#/components/schemas/BalanceAddress"
61+
},
62+
"example": []
63+
},
4364
"Addresses": {
4465
"type": "object",
4566
"properties": {
@@ -179,6 +200,18 @@
179200
}
180201
}
181202
},
203+
"SLPAddresses": {
204+
"type": "object",
205+
"properties": {
206+
"addresses": {
207+
"type": "array",
208+
"items": {
209+
"$ref": "#/components/schemas/SLPAddress"
210+
},
211+
"example": []
212+
}
213+
}
214+
},
182215
"RawTxids": {
183216
"type": "object",
184217
"properties": {
@@ -1201,7 +1234,7 @@
12011234
"openapi": "3.0.0",
12021235
"info": {
12031236
"description": "rest.bitcoin.com is the REST layer for Bitcoin.com's Cloud. More info: [developer.bitcoin.com/rest](https://developer.bitcoin.com/rest). Chatroom [geni.us/CashDev](http://geni.us/CashDev)",
1204-
"version": "3.12.1",
1237+
"version": "3.12.2",
12051238
"title": "REST",
12061239
"license": {
12071240
"name": "MIT",
@@ -2902,9 +2935,9 @@
29022935
"tags": [
29032936
"slp"
29042937
],
2905-
"summary": "list slp balances for address",
2906-
"description": "List SLP token balances for address",
2907-
"operationId": "balancesForAddress",
2938+
"summary": "list slp balances for single address",
2939+
"description": "List SLP token balances for single address",
2940+
"operationId": "balancesForAddressSingle",
29082941
"parameters": [
29092942
{
29102943
"name": "address",
@@ -2924,6 +2957,32 @@
29242957
}
29252958
}
29262959
},
2960+
"/slp/balancesForAddress": {
2961+
"post": {
2962+
"tags": [
2963+
"slp"
2964+
],
2965+
"summary": "list slp balances for bulk addresses",
2966+
"description": "List SLP token balances for bulk addresses",
2967+
"operationId": "balancesForAddressBulk",
2968+
"requestBody": {
2969+
"description": "",
2970+
"required": true,
2971+
"content": {
2972+
"application/json": {
2973+
"schema": {
2974+
"$ref": "#/components/schemas/SLPAddresses"
2975+
}
2976+
}
2977+
}
2978+
},
2979+
"responses": {
2980+
"200": {
2981+
"description": "successful response"
2982+
}
2983+
}
2984+
}
2985+
},
29272986
"/slp/balancesForToken/{tokenId}": {
29282987
"get": {
29292988
"tags": [
@@ -2951,14 +3010,40 @@
29513010
}
29523011
}
29533012
},
3013+
"/slp/balancesForToken": {
3014+
"post": {
3015+
"tags": [
3016+
"slp"
3017+
],
3018+
"summary": "list SLP addresses and balances for bulk tokenIds",
3019+
"description": "List SLP addresses and balances for bulk tokenIds",
3020+
"operationId": "balancesForTokenBulk",
3021+
"requestBody": {
3022+
"description": "",
3023+
"required": true,
3024+
"content": {
3025+
"application/json": {
3026+
"schema": {
3027+
"$ref": "#/components/schemas/SLPTokenIds"
3028+
}
3029+
}
3030+
}
3031+
},
3032+
"responses": {
3033+
"200": {
3034+
"description": "successful response"
3035+
}
3036+
}
3037+
}
3038+
},
29543039
"/slp/balance/{address}/{tokenId}": {
29553040
"get": {
29563041
"tags": [
29573042
"slp"
29583043
],
29593044
"summary": "list single slp token balance for address",
29603045
"description": "List single SLP token balance for address",
2961-
"operationId": "singleBalanceForAddress",
3046+
"operationId": "balanceForAddressSingle",
29623047
"parameters": [
29633048
{
29643049
"name": "address",
@@ -2988,6 +3073,32 @@
29883073
}
29893074
}
29903075
},
3076+
"/slp/balance": {
3077+
"post": {
3078+
"tags": [
3079+
"slp"
3080+
],
3081+
"summary": "list bulk slp token balances for addresses",
3082+
"description": "List bulk SLP token balances for addresses",
3083+
"operationId": "balanceForAddressBulk",
3084+
"requestBody": {
3085+
"description": "",
3086+
"required": true,
3087+
"content": {
3088+
"application/json": {
3089+
"schema": {
3090+
"$ref": "#/components/schemas/BalanceAddresses"
3091+
}
3092+
}
3093+
}
3094+
},
3095+
"responses": {
3096+
"200": {
3097+
"description": "successful response"
3098+
}
3099+
}
3100+
}
3101+
},
29913102
"/slp/validateTxid/{txid}": {
29923103
"get": {
29933104
"tags": [
@@ -3158,6 +3269,32 @@
31583269
}
31593270
}
31603271
},
3272+
"/slp/transactions": {
3273+
"post": {
3274+
"tags": [
3275+
"slp"
3276+
],
3277+
"summary": "Bulk SLP transactions by tokenId and address",
3278+
"description": "Bulk Transactions by tokenId and address.",
3279+
"operationId": "txsTokenIdAddressBulk",
3280+
"requestBody": {
3281+
"description": "",
3282+
"required": true,
3283+
"content": {
3284+
"application/json": {
3285+
"schema": {
3286+
"$ref": "#/components/schemas/BalanceAddresses"
3287+
}
3288+
}
3289+
}
3290+
},
3291+
"responses": {
3292+
"200": {
3293+
"description": "successful response"
3294+
}
3295+
}
3296+
}
3297+
},
31613298
"/slp/burnTotal/{transactionId}": {
31623299
"get": {
31633300
"tags": [
@@ -3185,6 +3322,32 @@
31853322
}
31863323
}
31873324
},
3325+
"/slp/burnTotal": {
3326+
"post": {
3327+
"tags": [
3328+
"slp"
3329+
],
3330+
"summary": "Total burn count for slp transactions",
3331+
"description": "total input, ouput and burn counts by transaction Id.",
3332+
"operationId": "burnTotalBulk",
3333+
"requestBody": {
3334+
"description": "Array of transactionIds",
3335+
"required": true,
3336+
"content": {
3337+
"application/json": {
3338+
"schema": {
3339+
"$ref": "#/components/schemas/Txids"
3340+
}
3341+
}
3342+
}
3343+
},
3344+
"responses": {
3345+
"200": {
3346+
"description": "successful response"
3347+
}
3348+
}
3349+
}
3350+
},
31883351
"/cashAccounts/lookup/{account}/{number}/{collision}": {
31893352
"get": {
31903353
"tags": [

0 commit comments

Comments
 (0)