web3swift icon indicating copy to clipboard operation
web3swift copied to clipboard

I wish I could have a more detailed demo, it's a little difficult for beginners to understand

Open MasterYong opened this issue 3 years ago • 7 comments

I really hope to have a more detailed demo, a little difficult for beginners to understand, thank you

MasterYong avatar Jan 15 '22 13:01 MasterYong

Since current one example, let's say, bellow our guidelines it's a good to have a new one App example that will provide some interactive playground for folks that are wishing to study how to work with our lib.

yaroslavyaroslav avatar Nov 14 '22 10:11 yaroslavyaroslav

100% agree. Currently trying to interact with a custom smart contract and the smaller problems you encounter along the way are seriously difficult to get passed without some more detailed examples.

Currently stuck with "Failed to fetch gas estimate" with no further elaboration

adeneley avatar Nov 22 '22 17:11 adeneley

100% agree. Currently trying to interact with a custom smart contract and the smaller problems you encounter along the way are seriously difficult to get passed without some more detailed examples.

Currently stuck with "Failed to fetch gas estimate" with no further elaboration

This usually means something is configured wrong in your parameters @adeneels. If you search for Failed to fetch gas estimate in closed issues. You might get some ideas what specifically could be wrong.

janndriessen avatar Nov 22 '22 20:11 janndriessen

Hi! I am curious about the scope of this task :)

I have opened myWeb3Wallet.xcworkspace and it seems broken. ❌ Regarding scoping, what would be nice to have?

  1. showcases
  2. wallet

albertopeam avatar Jan 17 '23 18:01 albertopeam

@yaroslavyaroslav @JeneaVranceanu are you interested in define a set of basic features to implement in the example? ie:

  1. show user balances
  2. add token
  3. list transactions
  4. send transaction

I am really interested in create a showcase for a wallet for example. What do you think?

albertopeam avatar Jan 20 '23 19:01 albertopeam

This is something we must have definitely. Things from the top of my head that we must showcase in an example app and/or just have it in documentation with explanations and example code snippets (list needs to be expanded with more topics):

1. Signing

  • What is a keystore? (Note: all of these points are not just theory but explanations/example we should have in the context of web3swift library);
  • What types of keystores web3swift has?
  • How to generate mnemonic phrase?
  • How to create a keystore?
  • How to get private key?
  • How to get public key?
  • How to sign a message with private key?
  • How to sign a personal message? (That is the Ethereum standard)
  • How to hash personal message?
  • Marshalled and unmarshalled signatures. (SECP256K1.UnmarshaledSignature)
  • What other signing methods we support? (e.g. EIP712)

2. Establishing a connection to blockchain

  • What is class Web3 and how to use?
  • What is Web3Provider and how to use?

3. Contracts & contract's ABI

  • How to create a contract?
  • What is EthereumAddress and how to create one? Also cover special contract deployment Ethereum address and how to use it: EthereumAddress.contractDeploymentAddress();
  • What is ABI?
  • How to specify the contract's ABI?
  • How to encode a function call? (with input parameters and no parameters; how to encode read and write operations)
  • How to manually encode/decode ABI, for example, transaction input and output? (Cover ABIEncoder and ABIDecoder)

4. Operations and transactions

  • How to create and execute "read" operation? (An example of a read operation would be good enough with a follow-up that there are also write operations)
    • How to get data back out of the "read" operation?
  • How to create and execute write transactions?
    • How to sign a transaction?
  • How to get the transaction signature, how to get the public key out of the signature and how to get the sender's address?
  • How to estimate gas?
  • How to get gas price?
  • How to get transaction details and receipt?

Additionally, we must keep up to date with all BIPs, EIPs/ERCs we support with links to standards and examples on how to use these standards in the web3swift library.

JeneaVranceanu avatar Jan 23 '23 14:01 JeneaVranceanu

These topics I've mentioned are showing the capabilities of the library. But as @albertopeam mentioned we also must show how to add tokens and give examples of how would you use and communicate with ERC20, ERC777 etc. Basically, cover a separate topic on "How to do common stuff?" that everyone does. This is as well one of the keys to growing the library.

JeneaVranceanu avatar Jan 23 '23 14:01 JeneaVranceanu