Skip to content

Commit 06d2fa1

Browse files
committed
Added 0x prefix to storage viewer
1 parent 5ec957e commit 06d2fa1

File tree

3 files changed

+46
-8
lines changed

3 files changed

+46
-8
lines changed

src/api/service/service/BlockServiceImpl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export class BlockServiceImpl implements BlockService {
1414
const web3 = iWeb3.getInstance()
1515
const block: Block = await web3.eth.getBlock(blockNumber, false)
1616
if (!block) {
17-
logger.info('Block not found in node')
17+
logger.info(`Block ${blockNumber} not found in node`)
1818
}
1919
return block
2020
}

src/client/components/StorageViewer/StorageViewer.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ const StorageViewer = ({ storageResponse }) => {
2424
return (
2525
<div className={styles['storage__body__item']} key={key}>
2626
<div className={styles['storage__body__item__col']}>
27-
<span>{key}</span>
27+
<span>{`0x${key}`}</span>
2828
</div>
2929
<div className={styles['storage__body__item__col']}>
30-
<span>{val.value}</span>
30+
<span>{`0x${val.value}`}</span>
3131
</div>
3232
</div>
33-
)
33+
)
3434
})
3535
}
3636
</div>

src/routes.ts

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,28 @@ const models: TsoaRoute.Models = {
7070
"storage": { "dataType": "any", "default": {} },
7171
},
7272
},
73+
"DeployContractRequest": {
74+
"properties": {
75+
"from": { "dataType": "string" },
76+
"gas": { "dataType": "double" },
77+
"gasPrice": { "dataType": "double" },
78+
"value": { "dataType": "double" },
79+
"blockchainHost": { "dataType": "string" },
80+
"blockchainProtocol": { "dataType": "string" },
81+
"blockchainBasicAuthUsername": { "dataType": "string" },
82+
"blockchainBasicAuthPassword": { "dataType": "string" },
83+
},
84+
},
7385
"RunContractFunctionRequest": {
7486
"properties": {
87+
"from": { "dataType": "string" },
88+
"gas": { "dataType": "double" },
89+
"gasPrice": { "dataType": "double" },
90+
"value": { "dataType": "double" },
91+
"blockchainHost": { "dataType": "string" },
92+
"blockchainProtocol": { "dataType": "string" },
93+
"blockchainBasicAuthUsername": { "dataType": "string" },
94+
"blockchainBasicAuthPassword": { "dataType": "string" },
7595
"abi": { "dataType": "any", "required": true },
7696
"params": { "dataType": "array", "array": { "dataType": "string" }, "required": true },
7797
},
@@ -282,15 +302,33 @@ export function RegisterRoutes(app: any) {
282302
const promise = controller.getAbi.apply(controller, validatedArgs);
283303
promiseHandler(controller, promise, response, next);
284304
});
305+
app.post('/contract/deploy',
306+
function(request: any, response: any, next: any) {
307+
const args = {
308+
deployRequest: { "in": "body", "name": "deployRequest", "required": true, "ref": "DeployContractRequest" },
309+
};
310+
311+
let validatedArgs: any[] = [];
312+
try {
313+
validatedArgs = getValidatedArgs(args, request);
314+
} catch (err) {
315+
return next(err);
316+
}
317+
318+
const controller = iocContainer.get<ContractController>(ContractController);
319+
if (typeof controller['setStatus'] === 'function') {
320+
(<any>controller).setStatus(undefined);
321+
}
322+
323+
324+
const promise = controller.deploy.apply(controller, validatedArgs);
325+
promiseHandler(controller, promise, response, next);
326+
});
285327
app.post('/contract/run/:contractAddress',
286328
function(request: any, response: any, next: any) {
287329
const args = {
288330
contractAddress: { "in": "path", "name": "contractAddress", "required": true, "dataType": "string" },
289331
runFunction: { "in": "body", "name": "runFunction", "required": true, "ref": "RunContractFunctionRequest" },
290-
blockchainHost: { "in": "query", "name": "blockchainHost", "dataType": "string" },
291-
blockchainProtocol: { "in": "query", "name": "blockchainProtocol", "dataType": "string" },
292-
blockchainBasicAuthUsername: { "in": "query", "name": "blockchainBasicAuthUsername", "dataType": "string" },
293-
blockchainBasicAuthPassword: { "in": "query", "name": "blockchainBasicAuthPassword", "dataType": "string" },
294332
};
295333

296334
let validatedArgs: any[] = [];

0 commit comments

Comments
 (0)