Skip to content

Commit

Permalink
feat: use STX locked_address from stacks-network/stacks-core#2050
Browse files Browse the repository at this point in the history
  • Loading branch information
zone117x committed Nov 12, 2020
1 parent 0e9a0c7 commit 47a4b23
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 53 deletions.
92 changes: 46 additions & 46 deletions docs/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1155,56 +1155,56 @@ paths:
schema:
$ref: ./api/rosetta/rosetta-construction-submit-request.schema.json

/rosetta/v1/construction/payloads:
post:
tags:
- Rosetta
summary: Generate an Unsigned Transaction and Signing Payloads
operationId: rosetta_construction_payloads
description: Generate and unsigned transaction from operations and metadata
responses:
200:
description: Success
content:
application/json:
schema:
$ref: ./api/rosetta/rosetta-construction-payloads-response.schema.json
400:
description: Error
/rosetta/v1/construction/payloads:
post:
tags:
- Rosetta
summary: Generate an Unsigned Transaction and Signing Payloads
operationId: rosetta_construction_payloads
description: Generate and unsigned transaction from operations and metadata
responses:
200:
description: Success
content:
application/json:
schema:
$ref: ./api/rosetta/rosetta-construction-payloads-response.schema.json
400:
description: Error
content:
application/json:
schema:
$ref: ./entities/rosetta/rosetta-error.schema.json
requestBody:
required: true
content:
application/json:
schema:
$ref: ./entities/rosetta/rosetta-error.schema.json
requestBody:
required: true
content:
application/json:
schema:
$ref: ./api/rosetta/rosetta-construction-payloads-request.schema.json
$ref: ./api/rosetta/rosetta-construction-payloads-request.schema.json

/rosetta/v1/construction/combine:
post:
tags:
- Rosetta
summary: Create Network Transaction from Signatures
operationId: rosetta_construction_combine
description: Take unsigned transaction and signature, combine both and return signed transaction
responses:
200:
description: Success
content:
application/json:
schema:
$ref: ./api/rosetta/rosetta-construction-combine-response.schema.json
400:
description: Error
/rosetta/v1/construction/combine:
post:
tags:
- Rosetta
summary: Create Network Transaction from Signatures
operationId: rosetta_construction_combine
description: Take unsigned transaction and signature, combine both and return signed transaction
responses:
200:
description: Success
content:
application/json:
schema:
$ref: ./api/rosetta/rosetta-construction-combine-response.schema.json
400:
description: Error
content:
application/json:
schema:
$ref: ./entities/rosetta/rosetta-error.schema.json
requestBody:
required: true
content:
application/json:
schema:
$ref: ./entities/rosetta/rosetta-error.schema.json
requestBody:
required: true
content:
application/json:
schema:
$ref: ./api/rosetta/rosetta-construction-combine-request.schema.json
$ref: ./api/rosetta/rosetta-construction-combine-request.schema.json
1 change: 0 additions & 1 deletion follower.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ WORKDIR /app
COPY . .
RUN apk add --no-cache --virtual .build-deps alpine-sdk python git openjdk8-jre
RUN echo "GIT_TAG=$(git tag --points-at HEAD)" >> .env
# RUN npm config set unsafe-perm true && npm install --unsafe-perm && npm run build --unsafe-perm && npm prune --production
RUN npm config set unsafe-perm true && npm install && npm run build && npm prune --production

### Fetch stacks-node binary
Expand Down
2 changes: 2 additions & 0 deletions src/event-stream/core-node-message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ export interface StxLockEvent extends CoreNodeEventBase {
locked_amount: string;
/** String quoted base10 integer. */
unlock_height: string;
/** STX principal associated with the locked tokens. */
locked_address: string;
};
}

Expand Down
7 changes: 1 addition & 6 deletions src/event-stream/event-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,17 +145,12 @@ async function handleClientMessage(msg: CoreNodeMessage, db: DataStore): Promise
break;
}
case CoreNodeEventType.StxLockEvent: {
// TODO: THIS IS NOT SAFE. Core needs to add `locked_address` to the event payload.
const sender = assertNotNullish(
parsedMsg.parsed_transactions.find(t => t.core_tx.txid === event.txid),
() => `Failed to match StxLockEvent txid ${event.txid}`
).sender_address;
const entry: DbStxLockEvent = {
...dbEvent,
event_type: DbEventTypeId.StxLock,
locked_amount: BigInt(event.stx_lock_event.locked_amount),
unlock_height: BigInt(event.stx_lock_event.unlock_height),
locked_address: sender,
locked_address: event.stx_lock_event.locked_address,
};
dbTx.stxLockEvents.push(entry);
break;
Expand Down

0 comments on commit 47a4b23

Please sign in to comment.