How to generate Polygon wallet account in Swift

Issue #871 Use libraries https://github.com/argentlabs/web3.swift https://github.com/bswags/web3keystore import web3 import web3keystore import KeychainAccess private final class KeyStorage: EthereumKeyStorageProtocol { enum Key: String { case privateKey case phrase } private let keychain = Keychain(service: "com.example.myapp") func storePrivateKey(key: Data) throws { try keychain.set(key, key: Key.privateKey.rawValue) } func loadPrivateKey() throws -> Data { if let data = try keychain.getData(Key.privateKey.rawValue) { return data } else { throw EthereumKeyStorageError.failedToLoad } } var phrase: String? { get { try?...

February 24, 2022 · 2 min · 321 words · Khoa

How to learn Polygon programming

Issue #870 Building https://dev.to/dabit3/building-scalable-full-stack-apps-on-ethereum-with-polygon-2cfb Sidechain https://docs.polygon.technology/docs/home/new-to-polygon https://hackernoon.com/what-are-sidechains-and-childchains-7202cc9e5994 USDC Testnet https://mumbai.polygonscan.com/token/0x566368d78dbdec50f04b588e152de3cec0d5889f Mainnet https://polygonscan.com/token/0x2791bca1f2de4661ed88a30c99a7a9449aa84174 Faucet Testnet https://faucet.polygon.technology/

February 24, 2022 · 1 min · 15 words · Khoa

How to send SPL token in Swift

Issue #867 Using https://github.com/ajamaica/Solana.Swift and the sendSPLToken method. Note that the from is the token account address and amount can have decimals solana.action.sendSPLTokens( mintAddress: MINT_ADDRESS, from: SENDER_TOKEN_ACCOUNT_ADDRESS, to: RECEIVER_WALLET_ADDDRESS, amount: UInt64(Float(amount) * units), allowUnfundedRecipient: true, onComplete: { result in continuation.resume(with: result) } ) We can also cross-reference to the solana web3.js library for how to create mint and transfer token import { clusterApiUrl, Connection, Keypair, LAMPORTS_PER_SOL } from '@solana/web3.js'; import { createMint, getOrCreateAssociatedTokenAccount, mintTo, transfer } from '....

February 11, 2022 · 2 min · 296 words · Khoa

How to calculate Solana transaction fee

Issue #866 A simple way is to use a fixed fee of 0.000005 For example from https://solscan.io/tx/5DkApvwTYuMqCiA94MhUVKJoLn8MGma9gAWXhreRJKqAs395P5CqEK3R84m3MWjcTKMem53XcLwYErGkaJAbQC2h?cluster=testnet And call some exchange API, like Coingecko https://api.coingecko.com/api/v3/simple/price?ids=solana&vs_currencies=usd and show the price in USD { "solana": { "usd": 114.13 } }

February 10, 2022 · 1 min · 38 words · Khoa

How to check SPL token balance on Solana

Issue #863 We will check USDC token balance on Solana testnet. Firstly, we will use https://usdcfaucet.com/ to airdrop some USDC tokens into our wallet. Secondly, we check USDC token mint address on testnet cluster using Solana Explorer https://explorer.solana.com/address/CpMah17kQEL2wqyMKt3mZBdTnZbkbfx4nqmQMFDP5vwp?cluster=testnet Then we make an RPC call to POST https://api.testnet.solana.comhttps://api.testnet.solana.com using method getTokenAccountsByOwner, passing our wallet address and the token mint address { "jsonrpc": "2.0", "id": 1, "method": "getTokenAccountsByOwner", "params": [ "53THxwqa9qF3cn46wHVKbGMM8hUpZDJE5jS3T1qVL5bc", { "mint": "CpMah17kQEL2wqyMKt3mZBdTnZbkbfx4nqmQMFDP5vwp" }, { "encoding": "jsonParsed" } ] } The response looks like below....

February 7, 2022 · 2 min · 304 words · Khoa