Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.0.1 #198

Merged
merged 45 commits into from
Sep 1, 2022
Merged

1.0.1 #198

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
b72e6d2
SKALE-4340 Add storage getters to FilestorageContract
DmytroNazarenko Sep 15, 2021
47b7fe4
SKALE-4340 Add getters to index.js
DmytroNazarenko Sep 15, 2021
bd683ed
SKALE-4340 Add totalSpace tests
DmytroNazarenko Sep 15, 2021
e9f1457
SKALE-4340 Fix lint
DmytroNazarenko Sep 15, 2021
c3411d4
SKALE-4340 Add storage getters tests
DmytroNazarenko Sep 15, 2021
7080439
SKALE-4340 Update generate_config script
DmytroNazarenko Sep 15, 2021
04bed23
SKALE-4340 Update README
DmytroNazarenko Sep 16, 2021
5d260b9
Merge pull request #173 from skalenetwork/enhancement/SKALE-4340-gett…
DmytroNazarenko Sep 16, 2021
a882a72
Bump fs version to 1.0.1-develop.0
DmytroNazarenko Sep 22, 2021
df66c2b
Bump fs version to 1.0.1-develop.1
DmytroNazarenko Sep 23, 2021
3aee940
Merge pull request #175 from skalenetwork/enhancement/bump-fs-version…
DmytroNazarenko Sep 23, 2021
2d5fed1
SKALE-2394 Add ws unit test
DmytroNazarenko Oct 7, 2021
c9812aa
Merge pull request #179 from skalenetwork/enhancement/SKALE-2394-hand…
DmytroNazarenko Oct 8, 2021
9e0e090
Update CODEOWNERS
cstrangedk Oct 15, 2021
d0a8770
Move to LGPL
cstrangedk Jan 11, 2022
f433a3b
Merge pull request #182 from skalenetwork/enhancement/move-to-lgpl
DmytroNazarenko Jan 11, 2022
56708ab
Update fs version
DmytroNazarenko Apr 3, 2022
3bec77b
Update config generation
DmytroNazarenko Apr 3, 2022
57f4803
Update run_remote_schain script
DmytroNazarenko Apr 4, 2022
eddd9cf
Grant allocator role to owner
DmytroNazarenko Apr 4, 2022
032b32d
Update reserveTestSpace
DmytroNazarenko Apr 4, 2022
b2c3abf
Increase allocated storage
DmytroNazarenko Apr 4, 2022
f1cf562
Increase allocated storage
DmytroNazarenko Apr 4, 2022
bf98dfe
Update schain version and occupied test
DmytroNazarenko Apr 4, 2022
75bee59
Update base config
DmytroNazarenko Apr 4, 2022
2b0c5c9
Update run schain script
DmytroNazarenko Apr 4, 2022
b37a0d0
Update base config
DmytroNazarenko Apr 4, 2022
14a61ea
Update run_remote_schain
DmytroNazarenko Apr 4, 2022
a09266c
Update 100mb test
DmytroNazarenko Apr 4, 2022
5bb43e5
Update generate cmd
DmytroNazarenko Apr 4, 2022
6d05d0e
Merge pull request #188 from skalenetwork/enhancement/bump-fs-version
DmytroNazarenko Apr 4, 2022
be61c2b
Update README.md
cstrangedk Apr 6, 2022
c24094d
Bump workflow node lts
cstrangedk Apr 11, 2022
9714c4e
Merge pull request #193 from skalenetwork/bump-node-lts
DmytroNazarenko Apr 12, 2022
4396a2c
Add grantAllocatorRole, update reserveSpace in FilestorageContract.js
DmytroNazarenko Apr 14, 2022
fbe0fea
Add grantAllocatorRole to index.js
DmytroNazarenko Apr 14, 2022
41ee8f4
Add grantAllocatorRole test
DmytroNazarenko Apr 14, 2022
85e5158
Update test grantAllocatorRole
DmytroNazarenko Apr 14, 2022
f1a4ec3
Update README
DmytroNazarenko Apr 14, 2022
02ac546
Merge pull request #194 from skalenetwork/enhancement/add-grant-role-api
DmytroNazarenko Apr 14, 2022
c9b757b
Test commit
DmytroNazarenko Aug 3, 2022
12114a7
Update clean schain, fix tests
DmytroNazarenko Aug 3, 2022
f3ece2d
Merge pull request #196 from skalenetwork/enhancement/test-actions
DmytroNazarenko Aug 4, 2022
d429b3d
Merge branch 'beta' into develop
DmytroNazarenko Sep 1, 2022
7480b2d
Merge pull request #197 from skalenetwork/develop
DmytroNazarenko Sep 1, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
* @dmytronazarenko @kladkogex
*.md @cstrangedk
/docs/ @skalenetwork/docowners
*.md @skalenetwork/docowners
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '12.x'
node-version: '14.x'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: |
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node: [10, 12, 14]
node: [12, 14, 16]
os: [ubuntu-latest, windows-latest]
env:
VERSION: 3.9.1-develop.4
ENDPOINT: ${{ secrets.ENDPOINT }}
USER: ${{ secrets.USER }}
SCHEME: ${{ secrets.SCHEME }}
VERSION: ${{ secrets.VERSION }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
SCHAIN_OWNER_PK: ${{ secrets.SCHAIN_OWNER_PK }}
PRIVATEKEY: ${{ secrets.PRIVATEKEY }}
Expand All @@ -24,6 +24,12 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install dependencies
run: |
npm i
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ artifacts.json

# Dependency directories
node_modules/
venv/

# Idea files
.idea/
Expand All @@ -15,3 +16,4 @@ node_modules/
.eslintcache
.nyc_output
coverage

816 changes: 160 additions & 656 deletions LICENSE

Large diffs are not rendered by default.

104 changes: 98 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,27 +253,119 @@ Content `Object` for directory contains:

Reserve space for certain address in Filestorage in bytes.

- **Note**: could be called only by sChain owner
- **Note**: can be called only by ALLOCATOR_ROLE (or schain owner in v1 chains)

```javascript
filestorage.reserveSpace(ownerAddress, addressToReserve, reservedSpace, privateKey);
filestorage.reserveSpace(allocatorAddress, addressToReserve, reservedSpace, privateKey);
```

Create directory using external signing (Metamask etc):
Reserve space using external signing (Metamask etc):

```javascript
filestorage.reserveSpace(ownerAddress, addressToReserve, reservedSpace);
filestorage.reserveSpace(allocatorAddress, addressToReserve, reservedSpace);
```

##### Parameters

| Parameter | Description |
| ------------------------- | ----------------------------------------------------------- |
| `String` ownerAddress | sChain owner address |
| `String` allocatorAddress | Address with ALLOCATOR_ROLE |
| `String` addressToReserve | Address to reserve space for |
| `String` reservedSpace | Reserved space in bytes |
| `String` privateKey | _(optional)_ sChain owner private key, to sign transactions |

#### Grant allocator role

Granting allocator role to be able to reserve space in Filestorage

- **Note**: can be called only by ADMIN_ROLE (on v2+ chains)

```javascript
filestorage.grantAllocatorRole(adminAddress, allocatorAddress, adminPrivateKey);
```

Grant allocator role using external signing (Metamask etc):

```javascript
filestorage.grantAllocatorRole(adminAddress, allocatorAddress, adminPrivateKey);
```

##### Parameters

| Parameter | Description |
| ------------------------- | ----------------------------------------------------------- |
| `String` adminAddress | DEFAULT_ADMIN address |
| `String` allocatorAddress | Address to grant role for |
| `String` adminPrivateKey | _(optional)_ DEFAULT_ADMIN private key, to sign transactions|

#### Get reserved space

Get information about reserved space for account in bytes.

```javascript
filestorage.getReservedSpace(address);
```

##### Parameters

| Parameter | Description |
| ------------------------- | ----------------------------------------------------------- |
| `String` address | Account address |

##### Returns

| Parameter | Description |
| ---------------------- | ------------------------------------------------ |
| `Number` reservedSpace | Reserved space in bytes |

#### Get occupied space

Get information about occupied (actually used) space for account in bytes.

```javascript
filestorage.getOccupiedSpace(address);
```

##### Parameters

| Parameter | Description |
| ------------------------- | ----------------------------------------------------------- |
| `String` address | Account address |

##### Returns

| Parameter | Description |
| ---------------------- | ------------------------------------------------ |
| `Number` occupiedSpace | Occupied space in bytes |

#### Get total space in Filestorage

Get information about total space in Filestorage in bytes.

```javascript
filestorage.getTotalSpace();
```

##### Returns

| Parameter | Description |
| ---------------------- | ------------------------------------------------ |
| `Number` space | Total space in Filestorage in bytes |

#### Get total reserved space

Get information about total reserved space (sum of all reserved spaces) in bytes.

```javascript
filestorage.getTotalReservedSpace();
```

##### Returns

| Parameter | Description |
| ---------------------- | ------------------------------------------------ |
| `Number` reservedSpace | Total reserved space in bytes |

## Development

### Install
Expand Down Expand Up @@ -380,4 +472,4 @@ Example:

![GitHub](https://img.shields.io/github/license/skalenetwork/filestorage.js.svg)

All contributions are made under the [GNU Affero General Public License v3](https://www.gnu.org/licenses/agpl-3.0.en.html). See [LICENSE](LICENSE).
All contributions are made under the [GNU Lesser General Public License v3](https://www.gnu.org/licenses/lgpl-3.0.en.html). See [LICENSE](LICENSE).
92 changes: 39 additions & 53 deletions dist/filestorage.min.js

Large diffs are not rendered by default.

Loading