alephium / alephium-web3 Goto Github PK
View Code? Open in Web Editor NEWA JS/TS library for building dapps on Alephium
License: GNU Lesser General Public License v3.0
A JS/TS library for building dapps on Alephium
License: GNU Lesser General Public License v3.0
@nop33 reported that when contract deployment fails, the error message is something like this:
Loading alephium config file: /Users/ilias/dev/alephium/fetatoken/alephium.config.ts
Failed to deploy contracts, error: SyntaxError: Property assignment expected. (24:9)
22 | function toDeployments(json: any): Deployments {
23 | const contracts = {
> 24 | ,
| ^
25 | }
26 | return {
27 | ...json,
We need to improve the error message.
When debug mode is configure in alephium.config.ts
, all of the HTTP requests would be logged, like Wallet connect
Looks like there is a bug somewhere
Feel free to share any specific suggestions to enhance the overall experience, especially with examples. The dev team is currently busy, but we'll soon have more time to fine-tune things. Your input is valuable!
Example of fetch and use:
const state = contract.fetchState(nodeProvider)
const fieldValue0 = state.fields.fieldName0
const fieldValue1 = state.fields.fieldName1
For example: console.error(chalk.red(...))
When upgrading the deps of the NFT project to the latest (0.10.0-rc.0
), I got this error:
SyntaxError: Named export 'QRCodeModal' not found. The requested module '@alephium/walletconnect-provider' is a CommonJS module, which may not support all module.exports as named exports.
Could do something similar to Hardhat
The order of scripts and imports can change randomly sometimes: https://github.com/alephium/alephium-web3/blob/master/artifacts/ts/scripts.ts
Let's sort them in alphabet order.
When providing name and symbol to deploy a new token, it's very easy to use string instead of hex string in the initialFields
:
initialFields: {
symbol: 'TF', // Buffer.from('TF', 'utf8').toString('hex'),
name: 'TokenFaucet' // Buffer.from('TokenFaucet', 'utf8').toString('hex'),
decimals: 0n,
supply: issueTokenAmount,
balance: issueTokenAmount
}
Typical use cases:
Access to fetch at 'https://wallet-v20.testnet.alephium.org/blockflow/headers/0000003e2585b95d975f303f872bd26d4da5820cc56375b776495b30af1b9b20' from origin 'https://portal-bridge.wormhole-testnet.softfork.se/' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
After the codec PR is merged, we need to fix UnlockScript decoding issue here: https://github.com/alephium/alephium-web3/pull/277/files#diff-3da1144f1b4ed358385dfed035dcfc90cdb5ecc281456624f101a55f4aab5a73R60
I noticed some circular deps in the web3-react package when running the build script:
(!) Circular dependencies
src/components/AlephiumConnect.tsx -> src/components/ConnectModal/index.tsx -> src/components/AlephiumConnect.tsx
src/components/AlephiumConnect.tsx -> src/components/ConnectModal/index.tsx -> src/components/Common/Modal/index.tsx -> src/components/AlephiumConnect.tsx
src/components/AlephiumConnect.tsx -> src/components/ConnectModal/index.tsx -> src/components/Pages/Connectors/index.tsx -> src/components/AlephiumConnect.tsx
...and 7 more
All changes to the ConnectContext would trigger rerender, so we should keep the global context as simple as possible. The following should be removed and devs should use other hooks useAccount
and useBalance
etc.
account?: Account
setAccount: React.Dispatch<React.SetStateAction<Account | undefined>>
displayAccount?: (account: Account) => string
signerProvider?: SignerProvider
setSignerProvider: React.Dispatch<React.SetStateAction<SignerProvider | undefined>>
addressGroup?: number
keyType?: KeyType
network?: NetworkId
connectkit uses local storage to cache all existing connections, and use the last connection automatically.
account?.account?
networkType
to useAccount
Based on the discussion of this issue, we need to:
Not sure if it's necessary
It's a bit heavy and not necessary since tx id is stored
The following explorer endpoints always return null
. I believe this is due to the convertHttpResponse
post-processing. These specific endpoints accept text/plain
media type, in contrary to the usual application/json
. So they require a different kind of post-processing, sth like .then((res) => res.text())
:
getInfosSupplyTotalAlph
getInfosSupplyCirculatingAlph
getInfosTotalTransactions
Right now, even if the const result = await ...
returns the same balance, we call setBalance
, resulting in unnecessary rerendering.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.