Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nachomazzara/web3playground
Web3 & Smart contracts Playground
https://github.com/nachomazzara/web3playground
Last synced: 23 days ago
JSON representation
Web3 & Smart contracts Playground
- Host: GitHub
- URL: https://github.com/nachomazzara/web3playground
- Owner: nachomazzara
- Created: 2019-11-23T00:51:31.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-24T03:18:24.000Z (almost 2 years ago)
- Last Synced: 2023-04-10T18:52:08.344Z (almost 2 years ago)
- Language: JavaScript
- Homepage: https://web3playground.io
- Size: 2.44 MB
- Stars: 45
- Watchers: 2
- Forks: 13
- Open Issues: 25
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Ethereum EVM Compatible Playground Automagically typed
Test your contracts by creating your custom code snippets by using [Web3 1.X.X](https://github.com/ethereum/web3.js/) or [Ethers 5.0.X](https://github.com/ethers-io/ethers.js) ready to be used and automagically typed.
### [Try it](https://web3playground.io)
## Table of content
- [How it works](#how-it-works)
- [Share](#share)
- [Examples](#examples)
- [FAQ](#faq)### How it works
- Paste the address of the contract you want to try.
- Choose a name for the variable.
- If the contract is upgradeable by using the proxy pattern, select the checkbox.
- Code.
_( - Right click to rename the files)_### Share
If you want to share what you did or you have an issue and need help, you can upload and share it. It is using IPFS to make it fully decentralized.
- Click on `Save & Share`
- Copy & share the link 🚀### Examples
- Get the name of a contract:
```typescript
async function main() {
const name = await contract.methods.name().call()
return name
}
```- Get NFTs owners:
```typescript
async function main() {
const tokenIds = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
const owners = []for (let i = 0; i < tokenIds.length; i++) {
const owner = await contract.methods.ownerOf(i).call()
owners.push(owner)
}return owners
}
```- Transfer tokens:
```typescript
async function main() {
const to = '0x...'
const value = 1e18const txHash = await contract.methods.transfer(to, value).send()
return txHash
}
```- Get ETH balance:
```typescript
async function main() {
const user = '0x..'
const ethBalance = await web3.eth.getBalance(user)
return ethBalance
}
```#### Methods are typed!!
### FAQ
- #### **Is only javascript available?**
Yes, the snippet runs in the browser.
- #### **Which proxy implementations are supported?**
So far, the ones detected by topics as:
- Event _`Upgrade(address,bytes)`_ = `0xe74baeef5988edac1159d9177ca52f0f3d68f624a1996f77467eb3ebfb316537`.
- Event _`Upgraded(address)`_: `0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b`.
- [EIP-1167 MinimalProxy](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1167.md).
- Implementation made by [OpenZeppelin](https://docs.openzeppelin.com/sdk/2.5/writing-contracts.html). Searching for the storage slot `0x7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3`
- [EIP-1967 Standard Proxy Storage Slots](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1967.md)).
- #### **Which chains are supported?**
Every RCP call is made to the network selected in your provider.
- #### **Which wallets are supported?**
I 've tested it with a few. Also mobile. If you have a wallet and it is not supported, please let me know and I will add it.
- #### **Can I refresh the browser?**
Yes! Contracts and code are stored at localstorage if any. Also, you can save it to IPFS.
- #### **Can I contribute?**
Yes! please, It will be awesome.
- #### **Multiple snippet supports?**
Yeah!!!!!! 🚀
[Donate ❤️](https://etherscan.com/address/0x2FFDbd3e8B682eDC3e7a9ced16Eba60423D3BFb6)