Skip to content

Instantly share code, notes, and snippets.

View totiz's full-sized avatar

Nattapon Nimakul totiz

View GitHub Profile
pragma solidity ^0.6.0;
interface ERC20Basic {
// uint public totalSupply;
function balanceOf(address who) external view returns (uint);
function transfer(address to, uint value) external;
event Transfer(address indexed from, address indexed to, uint value);
}
contract NattaponV2 is ERC20Basic {
/**
*Submitted for verification at Etherscan.io on 2017-07-05
*/
pragma solidity ^0.4.11;
/**
* Math operations with safety checks
*/
curl --location --request POST "https://libraservice2.kulap.io/createWallet" \
--header "Content-Type: application/json" \
--data "{
\"minting\": true
}"
@totiz
totiz / libra_wallet_query_balance.js
Last active July 28, 2019 18:32
Query Balance in Libra Blockchain with javascript
const { LibraWallet, LibraClient, LibraNetwork } = require('kulap-libra')
const BigNumber = require('bignumber.js')
async function createWallet() {
// Generate an account
const wallet = new LibraWallet()
const account = wallet.newAccount()
return {
address: account.getAddress().toHex(),
@totiz
totiz / libra_create_wallet.js
Last active July 28, 2019 18:31
Create libra wallet with npm i kulap-libra
async function createWallet() {
const { LibraWallet } = require('kulap-libra')
// Generate an account
const wallet = new LibraWallet() // create new wallet with BIP39
const account = wallet.newAccount() // Derivation paths to "LIBRA WALLET: derived key$0"
return {
address: account.getAddress().toHex(), // Get full address
mnemonic: wallet.config.mnemonic // Your super secret key
@totiz
totiz / libra_wallet_mint.js
Last active July 28, 2019 18:30
Libra Wallet Minting
const { LibraWallet, LibraClient, LibraNetwork } = require('kulap-libra')
const BigNumber = require('bignumber.js')
async function createWallet() {
// Generate an account
const wallet = new LibraWallet()
const account = wallet.newAccount()
return {
address: account.getAddress().toHex(),
@totiz
totiz / libra_wallet_transfer.js
Created July 28, 2019 17:35
Libra Transfer with javascript
const { LibraWallet, LibraClient, LibraNetwork } = require('kulap-libra')
const BigNumber = require('bignumber.js')
async function createWallet() {
// Generate/get an account
// const wallet = new LibraWallet()
const wallet = new LibraWallet({mnemonic: 'finish topple cannon hammer eyebrow disorder enter reject long then tragic hammer diagram spy mom weapon amateur cup census sketch review consider galaxy foam'})
const account = wallet.newAccount()
return {
const { LibraWallet, LibraClient, LibraNetwork } = require('kulap-libra')
const axios = require('axios')
const BigNumber = require('bignumber.js')
async function createWallet() {
// Generate an account
// const wallet = new LibraWallet()
const wallet = new LibraWallet({
mnemonic: 'order curtain live pact market tissue rally run dolphin shuffle convince napkin spot main suffer segment excite toilet ceiling cute master six agent narrow'
});
{
"address": "91a6b7e0b194c70df055ee650abf9d3a96aa179ce2bf18ed31a5b1a8878eb865",
"balance": "100",
"mnemonic": "mango region urban belt lonely space grocery enjoy shock mad refuse awful blush shy build observe frozen dinosaur opinion robust frost nose general acoustic;1"
}
{
"address": "08c7bdf66f0ac29e154e9c05a8c00cc661f35a63a74d6f63dcc290c0d70e18c3",
"balance": "100"
}