How to generate Polygon wallet account in Swift

Issue #871 Use libraries 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 路 Khoa Pham

How to learn Polygon programming

Issue #870 Building Sidechain USDC Testnet Mainnet Faucet Testnet

February 24, 2022 路 1 min 路 Khoa Pham

How to send SPL token in Swift

Issue #867 Using 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 路 Khoa Pham

How to calculate Solana transaction fee

Issue #866 A simple way is to use a fixed fee of 0.000005 For example from And call some exchange API, like Coingecko and show the price in USD { "solana": { "usd": 114.13 } }

February 10, 2022 路 1 min 路 Khoa Pham

How to check SPL token balance on Solana

Issue #863 We will check USDC token balance on Solana testnet. Firstly, we will use to airdrop some USDC tokens into our wallet. Secondly, we check USDC token mint address on testnet cluster using Solana Explorer Then we make an RPC call to POST https://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 路 Khoa Pham