-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lookupmap for repository permission (#41)
* lookupmap for repository permission replace hashmap with lookupmap * add devcontainer setup * update near-sdk-rs * migration test * compile and deploy contract in workspaces * handle calling init twice * remove invitation functionality * bos widget for setting repository permission * support access for implicit accounts * npm audit fix * relative URL for webworker * add wasm32 target before testing
- Loading branch information
1 parent
6cefdd3
commit 64f5510
Showing
14 changed files
with
5,468 additions
and
833 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"image": "mcr.microsoft.com/devcontainers/universal", | ||
"features": { | ||
"ghcr.io/devcontainers/features/rust:1": {}, | ||
"ghcr.io/devcontainers/features/node:1": {} | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"rust-lang.rust-analyzer" | ||
] | ||
} | ||
}, | ||
"postCreateCommand": ".devcontainer/post-create.sh" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
rustup target add wasm32-unknown-unknown |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
const [repositoryName, setRepositoryName] = useState(""); | ||
const [accountId, setAccountId] = useState(""); | ||
|
||
const permissionmap = { | ||
'none': 0x00, | ||
'owner': 0x01, | ||
'contributor': 0x02, | ||
'reader': 0x04 | ||
}; | ||
|
||
const [permission, setPermission] = useState(permissionmap['owner']); | ||
|
||
function createRepository() { | ||
Near.call("wasmgit.near", "set_permission", { | ||
path: repositoryName, | ||
account_id: accountId, | ||
permission: parseInt(''+permission) | ||
}, | ||
undefined | ||
, "100000000000000000000000" | ||
); | ||
}; | ||
return ( | ||
<> | ||
<h3>Set repository permission</h3> | ||
|
||
<h6>Repository name</h6> | ||
<input | ||
placeholder="Repository name" | ||
value={repositoryName} | ||
onInput={(e) => setRepositoryName(e.target.value)} | ||
></input> | ||
|
||
<h6>Account id</h6> | ||
<input | ||
placeholder="Account id" | ||
value={accountId} | ||
onInput={(e) => setAccountId(e.target.value)} | ||
></input> | ||
<h6>Permission</h6> | ||
<select value={permission} onChange={(e) => setPermission(e.target.value)}> | ||
{ | ||
Object.keys(permissionmap).map(permissionName => | ||
<option value={permissionmap[permissionName]}>{permissionName}</option> | ||
) | ||
} | ||
</select> | ||
<br /> | ||
<button onClick={createRepository}>Create</button> | ||
</> | ||
); |
Oops, something went wrong.