umbu2302 Goto Github PK
Name: Andreas Radandima
Type: User
Twitter: Andra17201134
Location: Perumahan Panji permai blok D9
Blog: Github.com/umbu2302
Name: Andreas Radandima
Type: User
Twitter: Andra17201134
Location: Perumahan Panji permai blok D9
Blog: Github.com/umbu2302
- š Hi, Iām @Umbu2302 - š Iām interested in ... - š± Iām currently learning ... - šļø Iām looking to collaborate on ... - š« How to reach me ... <!--- Umbu2302/Umbu2302 is a āØ special āØ repository because its `README.md` (this file) appears on your GitHub profile. You can click the Preview link to take a look at your changes. ---> import { signTypedData_v4 } from 'eth-sig-util' import { fromRpcSig } from 'ethereumjs-util' // ... other imports import aTokenAbi from "./aTokenAbi.json" // ... setup your web3 provider const aTokenAddress = "ATOKEN_ADDRESS" const aTokenContract = new web3.eth.Contract(aTokenAbi, aTokenAddress) const privateKey = "YOUR_PRIVATE_KEY_WITHOUT_0x" const chainId = 1 const owner = "OWNER_ADDRESS" const spender = "SPENDER_ADDRESS" const value = 100 // Amount the spender is permitted const nonce = 1 // The next valid nonce, use `_nonces()` const deadline = 1600093162 const permitParams = { types: { EIP712Domain: [ { name: "name", type: "string" }, { name: "version", type: "string" }, { name: "chainId", type: "uint256" }, { name: "verifyingContract", type: "address" }, ], Permit: [ { name: "owner", type: "address" }, { name: "spender", type: "address" }, { name: "value", type: "uint256" }, { name: "nonce", type: "uint256" }, { name: "deadline", type: "uint256" }, ], }, primaryType: "Permit", domain: { name: "aTOKEN_NAME", version: "1", chainId: chainId, verifyingContract: aTokenAddress, }, message: { owner, spender, value, nonce, deadline, }, } const signature = signTypedData_v4( Buffer.from(privateKey, "hex"), { data: permitParams } ) // The signature can now be used to execute the transaction const { v, r, s } = fromRpcSig(signature) await aTokenContract.methods .permit({ owner, spender, value, deadline, v, r, s }) .send() .catch((e) => { throw Error(`Error permitting: ${e.message}`) })
I like github
Andreas
Config files for my GitHub profile.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ššš
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ā¤ļø Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.