Skip to content

Commit 011e98a

Browse files
committed
Merge remote-tracking branch 'origin/develop' into feat/cleanup
* origin/develop: (96 commits) chore: update stacks-blockchain docker image to `2.0.11.2.0` feat(rosetta): support stacking, delegate stacking and revoke stacking event fix: bugged re-org logic introduced in microblock implementation #670 feat(rosetta): support passing btc address for rosetta stacking op #672 feat: singular tx with STX transfer events endpoint #622 fix(rosetta): contract details in payload stacking transactions fix: preprocess bug to remove network from the dummy transaction fix: remove token_transfer_recipient_address from stacking transactions feat: add get block by burn block height and by burn block hash (#675) feat: new database connection options fix: bundling issues chore: fix json schema doc example type chore: update openapi/json-schema summaries and examples with latest microblock related changes chore: progress on fixing unit tests chore: stacks-node docker image bumps to 2.0.11.2.0-rc1-stretch feat: add parent_burn_block_{time,hash,height} to txs and microblock API responses chore: fix tests fix: include contract-call metadata in mempool/pending transactions feat: add explicit `is_unanchored: boolean` flag to tx responses chore: remove debug code ...
2 parents e203764 + 538d3b1 commit 011e98a

File tree

140 files changed

+12268
-4898
lines changed

Some content is hidden

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

140 files changed

+12268
-4898
lines changed

.env

+9
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@ PG_PORT=5490
33
PG_USER=postgres
44
PG_PASSWORD=postgres
55
PG_DATABASE=stacks_blockchain_api
6+
PG_SCHEMA=public
7+
PG_SSL=false
8+
9+
# The connection URI below can be used in place of the PG variables above,
10+
# but if enabled it must be defined without others or omitted.
11+
# PG_CONNECTION_URI=
12+
13+
# Enable to have stacks-node events streamed to a file while the application is running
14+
# STACKS_EXPORT_EVENTS_FILE=/tmp/stacks-events.tsv
615

716
STACKS_CORE_EVENT_PORT=3700
817
STACKS_CORE_EVENT_HOST=127.0.0.1

.github/workflows/gh-pages.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ jobs:
1313
- uses: actions/checkout@v2
1414

1515
- name: Use Node.js
16-
uses: actions/setup-node@v1
16+
uses: actions/setup-node@v2
1717
with:
18-
node-version: '14.x'
18+
node-version: '14'
19+
check-latest: true
1920

2021
- name: Install client deps
2122
run: npm install

.github/workflows/stacks-blockchain-api.yml

+90-15
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,27 @@ jobs:
3636
- uses: actions/checkout@v2
3737

3838
- name: Use Node.js
39-
uses: actions/setup-node@v1
39+
uses: actions/setup-node@v2
4040
with:
41-
node-version: '14.x'
41+
node-version: '14'
42+
check-latest: true
43+
44+
- name: Cache node modules
45+
uses: actions/cache@v2
46+
env:
47+
cache-name: cache-node-modules
48+
with:
49+
path: |
50+
~/.npm
51+
node_modules
52+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
53+
restore-keys: |
54+
${{ runner.os }}-build-${{ env.cache-name }}-
55+
${{ runner.os }}-build-
56+
${{ runner.os }}-
4257
4358
- name: Install deps
44-
run: npm install
59+
run: npm install --audit=false
4560

4661
- name: Lint ESLint
4762
run: npm run lint:eslint
@@ -58,12 +73,27 @@ jobs:
5873
- uses: actions/checkout@v2
5974

6075
- name: Use Node.js
61-
uses: actions/setup-node@v1
76+
uses: actions/setup-node@v2
77+
with:
78+
node-version: '14'
79+
check-latest: true
80+
81+
- name: Cache node modules
82+
uses: actions/cache@v2
83+
env:
84+
cache-name: cache-node-modules
6285
with:
63-
node-version: '14.x'
86+
path: |
87+
~/.npm
88+
node_modules
89+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
90+
restore-keys: |
91+
${{ runner.os }}-build-${{ env.cache-name }}-
92+
${{ runner.os }}-build-
93+
${{ runner.os }}-
6494
6595
- name: Install deps
66-
run: npm install
96+
run: npm install --audit=false
6797

6898
- name: Build schema & docs
6999
run: npm run build
@@ -86,12 +116,27 @@ jobs:
86116
- uses: actions/checkout@v2
87117

88118
- name: Use Node.js
89-
uses: actions/setup-node@v1
119+
uses: actions/setup-node@v2
90120
with:
91-
node-version: '14.x'
121+
node-version: '14'
122+
check-latest: true
123+
124+
- name: Cache node modules
125+
uses: actions/cache@v2
126+
env:
127+
cache-name: cache-node-modules
128+
with:
129+
path: |
130+
~/.npm
131+
node_modules
132+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
133+
restore-keys: |
134+
${{ runner.os }}-build-${{ env.cache-name }}-
135+
${{ runner.os }}-build-
136+
${{ runner.os }}-
92137
93138
- name: Install deps
94-
run: npm install
139+
run: npm install --audit=false
95140

96141
- name: Setup env vars
97142
run: echo "STACKS_CORE_EVENT_HOST=http://0.0.0.0" >> $GITHUB_ENV
@@ -123,12 +168,27 @@ jobs:
123168
- uses: actions/checkout@v2
124169

125170
- name: Use Node.js
126-
uses: actions/setup-node@v1
171+
uses: actions/setup-node@v2
172+
with:
173+
node-version: '14'
174+
check-latest: true
175+
176+
- name: Cache node modules
177+
uses: actions/cache@v2
178+
env:
179+
cache-name: cache-node-modules
127180
with:
128-
node-version: '14.x'
181+
path: |
182+
~/.npm
183+
node_modules
184+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
185+
restore-keys: |
186+
${{ runner.os }}-build-${{ env.cache-name }}-
187+
${{ runner.os }}-build-
188+
${{ runner.os }}-
129189
130190
- name: Install deps
131-
run: npm install
191+
run: npm install --audit=false
132192

133193
- name: Setup env vars
134194
run: echo "STACKS_CORE_EVENT_HOST=http://0.0.0.0" >> $GITHUB_ENV
@@ -160,12 +220,27 @@ jobs:
160220
- uses: actions/checkout@v2
161221

162222
- name: Use Node.js
163-
uses: actions/setup-node@v1
223+
uses: actions/setup-node@v2
224+
with:
225+
node-version: '14'
226+
check-latest: true
227+
228+
- name: Cache node modules
229+
uses: actions/cache@v2
230+
env:
231+
cache-name: cache-node-modules
164232
with:
165-
node-version: '14.x'
233+
path: |
234+
~/.npm
235+
node_modules
236+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
237+
restore-keys: |
238+
${{ runner.os }}-build-${{ env.cache-name }}-
239+
${{ runner.os }}-build-
240+
${{ runner.os }}-
166241
167242
- name: Install deps
168-
run: npm install
243+
run: npm install --audit=false
169244

170245
- name: Setup env vars
171246
run: echo "STACKS_CORE_EVENT_HOST=http://0.0.0.0" >> $GITHUB_ENV

.gitpod.Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM blockstack/stacks-blockchain:latest-stretch as corenode
1+
FROM blockstack/stacks-blockchain:2.0.11.2.0-stretch as corenode
22

33
FROM gitpod/workspace-postgres
44

.prettierignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
src/schemas/*
22
src/migrations/*
3+
src/tests-rosetta/
4+
src/tests-rosetta-cli/
5+
src/tests-bns/

.vscode/launch.json

+34
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,32 @@
6666
"TS_NODE_SKIP_IGNORE": "true"
6767
}
6868
},
69+
{
70+
"type": "node",
71+
"request": "launch",
72+
"name": "Launch: export-events",
73+
"runtimeArgs": ["-r", "ts-node/register/transpile-only", "-r", "tsconfig-paths/register"],
74+
"args": ["${workspaceFolder}/src/index.ts", "export-events", "--file", "/tmp/test-events-export.csv", "--overwrite-file"],
75+
"outputCapture": "std",
76+
"internalConsoleOptions": "openOnSessionStart",
77+
"env": {
78+
"NODE_ENV": "development",
79+
"TS_NODE_SKIP_IGNORE": "true"
80+
}
81+
},
82+
{
83+
"type": "node",
84+
"request": "launch",
85+
"name": "Launch: import-events",
86+
"runtimeArgs": ["-r", "ts-node/register/transpile-only", "-r", "tsconfig-paths/register"],
87+
"args": ["${workspaceFolder}/src/index.ts", "import-events", "--file", "/tmp/test-events-export.csv", "--wipe-db"],
88+
"outputCapture": "std",
89+
"internalConsoleOptions": "openOnSessionStart",
90+
"env": {
91+
"NODE_ENV": "development",
92+
"TS_NODE_SKIP_IGNORE": "true"
93+
}
94+
},
6995
{
7096
"type": "node",
7197
"request": "launch",
@@ -130,6 +156,14 @@
130156
"NODE_ENV": "development",
131157
"TS_NODE_SKIP_IGNORE": "true"
132158
}
159+
},
160+
{
161+
"type": "node",
162+
"request": "launch",
163+
"name": "docs: generate-types",
164+
"runtimeArgs": ["-r", "ts-node/register/transpile-only"],
165+
"cwd": "${workspaceFolder}/docs",
166+
"args": ["${workspaceFolder}/docs/scripts/generate-types.ts"]
133167
}
134168
]
135169
}

client/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"prep-openapi": "rimraf ./.tmp && rimraf ./src/generated && swagger-cli bundle --dereference -o ./.tmp/openapi-temp.json ../docs/openapi.yaml && shx sed -i '^.*\\$schema.*$' '' ./.tmp/openapi-temp.json > ./.tmp/openapi.json",
3131
"generate-openapi": "npm run prep-openapi && openapi-generator-cli generate --skip-validate-spec -g typescript-fetch --additional-properties=withInterfaces=true,typescriptThreePlus=true,supportsES6=true,legacyDiscriminatorBehavior=false,enumPropertyNaming=original,modelPropertyNaming=original -i ./.tmp/openapi.json -o ./src/generated > ./.tmp/gen.log",
3232
"openapi-generator-version": "openapi-generator-cli version-manager list",
33-
"generate:docs": "typedoc"
33+
"generate:docs": "npm run generate-openapi && typedoc src/**/*.ts"
3434
},
3535
"prettier": "@stacks/prettier-config",
3636
"files": [

client/tsconfig.json

-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
},
1515
"include": ["./src/**/*.ts"],
1616
"typedocOptions": {
17-
"inputFiles": ["./src"],
18-
"mode": "file",
1917
"out": "../docs/.tmp/client"
2018
}
2119
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"tx_id": "0x34d79c7cfc2fe525438736733e501a4bf0308a5556e3e080d1e2c0858aad7448",
3+
"tx_type": "contract_call",
4+
"nonce": 11,
5+
"fee_rate": "346",
6+
"sender_address": "SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE",
7+
"sponsored": false,
8+
"post_condition_mode": "deny",
9+
"tx_status": "success",
10+
"block_hash": "0x13d1b4ad35c95bca209397420fb8af104d2929d91993ba056d7a1ca5470095f9",
11+
"block_height": 3246,
12+
"burn_block_time": 1613009951,
13+
"burn_block_time_iso": "2021-02-11T02:19:11.000Z",
14+
"canonical": true,
15+
"is_unanchored": false,
16+
"microblock_hash": "0x590a1bb1d7bcbeafce0a9fc8f8a69e369486192d14687fe95fbe4dc1c71d49df",
17+
"microblock_sequence": 5,
18+
"microblock_canonical": true,
19+
"tx_index": 1,
20+
"tx_result": {
21+
"hex": "0x0703",
22+
"repr": "(ok true)"
23+
},
24+
"post_conditions": [
25+
{
26+
"type": "stx",
27+
"condition_code": "sent_equal_to",
28+
"amount": "350",
29+
"principal": {
30+
"type_id": "principal_standard",
31+
"address": "SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE"
32+
}
33+
}
34+
],
35+
"contract_call": {
36+
"contract_id": "SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE.send-many-memo",
37+
"function_name": "send-many",
38+
"function_signature": "(define-public (send-many (recipients (list 200 (tuple (memo (buff 34)) (to principal) (ustx uint))))))",
39+
"function_args": [
40+
{
41+
"hex": "0x0b000000020c00000003046d656d6f020000000966697273746d656d6f02746f05168c031b2db5895ece0cdfbf76e0b0e8af67226a6f047573747801000000000000000000000000000000960c00000003046d656d6f020000000a7365636f6e646d656d6f02746f05168974da696d74a16d0955bc8e55720dfd39e789cf047573747801000000000000000000000000000000c8",
42+
"repr": "(list (tuple (memo 0x66697273746d656d6f) (to SP26066SDPP4NXKGCVYZQDR5GX2QPE8KADZ0YK2J7) (ustx u150)) (tuple (memo 0x7365636f6e646d656d6f) (to SP24Q9PK9DNTA2V89APY8WNBJ1QYKKSW9SWB04RJP) (ustx u200)))",
43+
"name": "recipients",
44+
"type": "(list 200 (tuple (memo (buff 34)) (to principal) (ustx uint)))"
45+
}
46+
]
47+
},
48+
"events": [],
49+
"event_count": 4
50+
}

docs/api/address/get-address-transactions-with-transfers.example.json

+8
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
"burn_block_time": 1613009951,
1919
"burn_block_time_iso": "2021-02-11T02:19:11.000Z",
2020
"canonical": true,
21+
"is_unanchored": false,
22+
"microblock_hash": "0x590a1bb1d7bcbeafce0a9fc8f8a69e369486192d14687fe95fbe4dc1c71d49df",
23+
"microblock_sequence": 5,
24+
"microblock_canonical": true,
2125
"tx_index": 1,
2226
"tx_result": {
2327
"hex": "0x0703",
@@ -80,6 +84,10 @@
8084
"burn_block_time": 1611968237,
8185
"burn_block_time_iso": "2021-01-30T00:57:17.000Z",
8286
"canonical": true,
87+
"is_unanchored": false,
88+
"microblock_hash": "",
89+
"microblock_sequence": 2147483647,
90+
"microblock_canonical": true,
8391
"tx_index": 2,
8492
"tx_result": {
8593
"hex": "0x0703",

docs/api/address/get-address-transactions.example.json

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
"block_height": 5603,
1616
"burn_block_time": 1594335838,
1717
"canonical": true,
18+
"is_unanchored": false,
19+
"microblock_hash": "0x590a1bb1d7bcbeafce0a9fc8f8a69e369486192d14687fe95fbe4dc1c71d49df",
20+
"microblock_sequence": 5,
21+
"microblock_canonical": true,
1822
"tx_index": 0,
1923
"coinbase_payload": {
2024
"data": "0x0000000000000000000000000000000000000000000000000000000000000000"

docs/api/address/get-address-transactions.schema.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"type": "array",
2121
"items": {
2222
"type": "object",
23-
"oneOf": [
23+
"anyOf": [
2424
{
2525
"$ref": "../../entities/mempool-transactions/transaction.schema.json"
2626
},

0 commit comments

Comments
 (0)