Skip to content

Commit 4600e17

Browse files
committed
initial commit
0 parents  commit 4600e17

33 files changed

+10254
-0
lines changed

.eslintrc.cjs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/* eslint-env node */
2+
require('@rushstack/eslint-patch/modern-module-resolution')
3+
4+
module.exports = {
5+
root: true,
6+
'extends': [
7+
'plugin:vue/vue3-essential',
8+
'eslint:recommended',
9+
'@vue/eslint-config-prettier/skip-formatting'
10+
],
11+
parserOptions: {
12+
ecmaVersion: 'latest'
13+
}
14+
}

.gitignore

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
.DS_Store
12+
dist
13+
dist-ssr
14+
coverage
15+
*.local
16+
17+
/cypress/videos/
18+
/cypress/screenshots/
19+
20+
# Editor directories and files
21+
.vscode/*
22+
!.vscode/extensions.json
23+
.idea
24+
*.suo
25+
*.ntvs*
26+
*.njsproj
27+
*.sln
28+
*.sw?
29+
30+
*.tsbuildinfo

.prettierrc.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"$schema": "https://json.schemastore.org/prettierrc",
3+
"semi": false,
4+
"tabWidth": 2,
5+
"singleQuote": true,
6+
"printWidth": 100,
7+
"trailingComma": "none"
8+
}

.vscode/extensions.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"recommendations": [
3+
"Vue.volar",
4+
"dbaeumer.vscode-eslint",
5+
"esbenp.prettier-vscode"
6+
]
7+
}

README.md

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# vue-chat
2+
3+
This template should help get you started developing with Vue 3 in Vite.
4+
5+
## Recommended IDE Setup
6+
7+
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).
8+
9+
## Customize configuration
10+
11+
See [Vite Configuration Reference](https://vitejs.dev/config/).
12+
13+
## Project Setup
14+
15+
```sh
16+
npm install
17+
```
18+
19+
### Compile and Hot-Reload for Development
20+
21+
```sh
22+
npm run dev
23+
```
24+
25+
### Compile and Minify for Production
26+
27+
```sh
28+
npm run build
29+
```
30+
31+
### Lint with [ESLint](https://eslint.org/)
32+
33+
```sh
34+
npm run lint
35+
```

artifacts/build-info/31b244a7340aaa028f892e1d049438f1.json

+1
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"_format": "hh-sol-dbg-1",
3+
"buildInfo": "../../build-info/31b244a7340aaa028f892e1d049438f1.json"
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"_format": "hh-sol-artifact-1",
3+
"contractName": "Message",
4+
"sourceName": "contracts/Message.sol",
5+
"abi": [
6+
{
7+
"inputs": [
8+
{
9+
"internalType": "address",
10+
"name": "sender",
11+
"type": "address"
12+
}
13+
],
14+
"name": "getSenderMessages",
15+
"outputs": [
16+
{
17+
"internalType": "uint256[]",
18+
"name": "",
19+
"type": "uint256[]"
20+
}
21+
],
22+
"stateMutability": "view",
23+
"type": "function"
24+
},
25+
{
26+
"inputs": [
27+
{
28+
"internalType": "string",
29+
"name": "_message",
30+
"type": "string"
31+
}
32+
],
33+
"name": "post",
34+
"outputs": [],
35+
"stateMutability": "nonpayable",
36+
"type": "function"
37+
}
38+
],
39+
"bytecode": "0x608060405234801561001057600080fd5b5061064e806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c806337fd9d0b1461003b5780638ee93cf31461006b575b600080fd5b610055600480360381019061005091906103a3565b610087565b60405161006291906104d6565b60405180910390f35b610085600480360381019061008091906103cc565b61011d565b005b60606000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080548060200260200160405190810160405280929190818152602001828054801561011157602002820191906000526020600020905b8154815260200190600101908083116100fd575b50505050509050919050565b3273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461018b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610182906104f8565b60405180910390fd5b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054905090506000811415610244576000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002043908060018154018082558091505060019003906000526020600020016000909190919091505561033f565b436000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001836102909190610562565b815481106102c7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154101561033e576000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000204390806001815401808255809150506001900390600052602060002001600090919091909150555b5b505050565b60008135905061035381610601565b92915050565b60008083601f84011261036b57600080fd5b8235905067ffffffffffffffff81111561038457600080fd5b60208301915083600182028301111561039c57600080fd5b9250929050565b6000602082840312156103b557600080fd5b60006103c384828501610344565b91505092915050565b600080602083850312156103df57600080fd5b600083013567ffffffffffffffff8111156103f957600080fd5b61040585828601610359565b92509250509250929050565b600061041d83836104c7565b60208301905092915050565b600061043482610528565b61043e8185610540565b935061044983610518565b8060005b8381101561047a5781516104618882610411565b975061046c83610533565b92505060018101905061044d565b5085935050505092915050565b6000610494601f83610551565b91507f4f6e6c7920776f726b73207768656e2063616c6c6564206469726563746c79006000830152602082019050919050565b6104d0816105c8565b82525050565b600060208201905081810360008301526104f08184610429565b905092915050565b6000602082019050818103600083015261051181610487565b9050919050565b6000819050602082019050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061056d826105c8565b9150610578836105c8565b92508282101561058b5761058a6105d2565b5b828203905092915050565b60006105a1826105a8565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b61060a81610596565b811461061557600080fd5b5056fea26469706673582212206a03659bba514f1e2af9f39bb3a3f63b549fc70934b6a9d338a14d7dc31a6a6264736f6c63430008000033",
40+
"deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c806337fd9d0b1461003b5780638ee93cf31461006b575b600080fd5b610055600480360381019061005091906103a3565b610087565b60405161006291906104d6565b60405180910390f35b610085600480360381019061008091906103cc565b61011d565b005b60606000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080548060200260200160405190810160405280929190818152602001828054801561011157602002820191906000526020600020905b8154815260200190600101908083116100fd575b50505050509050919050565b3273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461018b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610182906104f8565b60405180910390fd5b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054905090506000811415610244576000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002043908060018154018082558091505060019003906000526020600020016000909190919091505561033f565b436000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001836102909190610562565b815481106102c7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154101561033e576000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000204390806001815401808255809150506001900390600052602060002001600090919091909150555b5b505050565b60008135905061035381610601565b92915050565b60008083601f84011261036b57600080fd5b8235905067ffffffffffffffff81111561038457600080fd5b60208301915083600182028301111561039c57600080fd5b9250929050565b6000602082840312156103b557600080fd5b60006103c384828501610344565b91505092915050565b600080602083850312156103df57600080fd5b600083013567ffffffffffffffff8111156103f957600080fd5b61040585828601610359565b92509250509250929050565b600061041d83836104c7565b60208301905092915050565b600061043482610528565b61043e8185610540565b935061044983610518565b8060005b8381101561047a5781516104618882610411565b975061046c83610533565b92505060018101905061044d565b5085935050505092915050565b6000610494601f83610551565b91507f4f6e6c7920776f726b73207768656e2063616c6c6564206469726563746c79006000830152602082019050919050565b6104d0816105c8565b82525050565b600060208201905081810360008301526104f08184610429565b905092915050565b6000602082019050818103600083015261051181610487565b9050919050565b6000819050602082019050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061056d826105c8565b9150610578836105c8565b92508282101561058b5761058a6105d2565b5b828203905092915050565b60006105a1826105a8565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b61060a81610596565b811461061557600080fd5b5056fea26469706673582212206a03659bba514f1e2af9f39bb3a3f63b549fc70934b6a9d338a14d7dc31a6a6264736f6c63430008000033",
41+
"linkReferences": {},
42+
"deployedLinkReferences": {}
43+
}

cache/solidity-files-cache.json

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"_format": "hh-sol-cache-2",
3+
"files": {
4+
"/home/st3pegor/Projects/blockchain-experiments/vue-chat/contracts/Message.sol": {
5+
"lastModificationDate": 1717916170536,
6+
"contentHash": "0686e36cd2acb9a03fdc2a639ddb52ba",
7+
"sourceName": "contracts/Message.sol",
8+
"solcConfig": {
9+
"version": "0.8.0",
10+
"settings": {
11+
"optimizer": {
12+
"enabled": false,
13+
"runs": 200
14+
},
15+
"outputSelection": {
16+
"*": {
17+
"*": [
18+
"abi",
19+
"evm.bytecode",
20+
"evm.deployedBytecode",
21+
"evm.methodIdentifiers",
22+
"metadata"
23+
],
24+
"": [
25+
"ast"
26+
]
27+
}
28+
}
29+
}
30+
},
31+
"imports": [],
32+
"versionPragmas": [
33+
"^0.8.0"
34+
],
35+
"artifacts": [
36+
"Message"
37+
]
38+
}
39+
}
40+
}

contracts/Message.sol

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// SPDX-License-Identifier: UNLICENSED
2+
pragma solidity ^0.8.0;
3+
4+
contract Message {
5+
// The blocks in which an address posted a message
6+
mapping (address => uint[]) MessageBlocks;
7+
8+
function post(string calldata _message) external {
9+
// We don't need to do anything with the message, we just need it here
10+
// so it becomes part of the transaction.
11+
(_message);
12+
require(msg.sender == tx.origin, "Only works when called directly");
13+
14+
// Only add the block number if we don't already a post in this
15+
// block
16+
uint length = MessageBlocks[msg.sender].length;
17+
if (length == 0) {
18+
MessageBlocks[msg.sender].push(block.number);
19+
} else if (MessageBlocks[msg.sender][length-1] < block.number) {
20+
MessageBlocks[msg.sender].push(block.number);
21+
}
22+
23+
} // function post
24+
25+
function getSenderMessages(address sender) public view
26+
returns (uint[] memory) {
27+
return MessageBlocks[sender];
28+
} // function getSenderMessages
29+
30+
}

contracts/cfg/message_contract.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"address": "0x5FbDB2315678afecb367f032d93F642f64180aa3"
3+
}

hardhat.config.cjs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
require("@nomiclabs/hardhat-ethers");
2+
3+
module.exports = {
4+
solidity: "0.8.0",
5+
};

index.html

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<link rel="icon" href="/favicon.ico">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Vite App</title>
8+
</head>
9+
<body>
10+
<div id="app"></div>
11+
<script type="module" src="/src/main.js"></script>
12+
</body>
13+
</html>

jsconfig.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"compilerOptions": {
3+
"paths": {
4+
"@/*": ["./src/*"]
5+
}
6+
},
7+
"exclude": ["node_modules", "dist"]
8+
}

0 commit comments

Comments
 (0)