This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"address": "08c7bdf66f0ac29e154e9c05a8c00cc661f35a63a74d6f63dcc290c0d70e18c3" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"address": "ed024cffdfc97dfd3cac1b68ea140bffcd27268cbc4fef3864f52e7c38a6613a", | |
"toAddress": "31c7092554bb804a4e25bd24399859428404c28cbc3b44dea5dc2a9f2314144b", | |
"balance": "", | |
"amount": "11" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"fromAddress": "ed024cffdfc97dfd3cac1b68ea140bffcd27268cbc4fef3864f52e7c38a6613a", | |
"mnemonic": "shoot success friend what custom card chuckle letter fiber artist suspect runway snack cheese soccer latin pull neither obey afraid accident pupil minor define;1", | |
"toAddress": "31c7092554bb804a4e25bd24399859428404c28cbc3b44dea5dc2a9f2314144b", | |
"amount": "11" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const infura_token = '[[YOUR TOKEN]]' // ขอ infura token ได้ที่ infura.io (สมัครฟรี) | |
const privateKey = '0cb9dd3708cb7307eb6895183cafc18b13efd85e5f8f522832ce838da00245c3' | |
const publicKey = '0x19f0685F5FC36cc68328B730c63FD5E81514c704' | |
const gasPrice = '9' // gwei | |
const ethToSend = '0.001' // ether | |
const toAddress = '0x3CC0290E21A1Bf2CD6050a3139D17E6C4EF66416' | |
async function main() { | |
// โหลด web3 | |
const Web3 = require('web3') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sign ด้วย Private key | |
const signedTx = await web3.eth.accounts.signTransaction(rawTransaction, privateKey) | |
console.log('Signed Transaction', signedTx) | |
const receipt = await web3.eth.sendSignedTransaction(signedTx.rawTransaction) | |
console.log("Transaction receipt: ", receipt) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// โหลด web3 | |
const Web3 = require('web3') | |
// เชื่อมต่อไปยัง infura | |
const web3 = new Web3(new Web3.providers.HttpProvider(`https://kovan.infura.io/v3/${infura_token}`)) | |
// อ่านค่า nonce ณ ปัจจุบันเพื่อใช้สร้าง raw tx | |
// ค่า nonce เป็นค่า sequence number ที่จะต้องเรียงต่อกัน ตามจำนวนธุรกรรมของ address ผู้ส่ง | |
const nonce = await web3.eth.getTransactionCount(publicKey) | |
console.log('nonce', nonce) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const infura_token = '[[YOUR TOKEN]]' // ขอ infura token ได้ที่ infura.io (สมัครฟรี) | |
const privateKey = '0cb9dd3708cb7307eb6895183cafc18b13efd85e5f8f522832ce838da00245c3' | |
const publicKey = '0x19f0685F5FC36cc68328B730c63FD5E81514c704' | |
const gasPrice = '9' // gwei | |
const ethToSend = '0.001' // ether | |
const toAddress = '0x3CC0290E21A1Bf2CD6050a3139D17E6C4EF66416' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Controller { | |
lazy var things = [String]() | |
lazy var lines: [Line] = { | |
return [Line(begin: CGPoint(x: 1, y: 1), end: CGPoint(x: 20, y: 20)), | |
Line(begin: CGPoint(x: 50, y: 50), end: CGPoint(x: 10, y: 10))] | |
}() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AppController { | |
static let NotifcationIdentifier = Notification.Name("Notify when something change") | |
func notify(message: String) { | |
NotificationCenter.default.post(name: AppController.NotifcationIdentifier, object: "User Did Open App") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// App Global | |
let appName = "My App Name" | |
let VERSION_NUMBER = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as! String |