Created
April 12, 2021 06:10
-
-
Save qianbin/0c10af940e9f33fade99d927179352b2 to your computer and use it in GitHub Desktop.
connex2: demonstrate how to create an contract object like 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
function contract(thor: Connex.Thor, address: string, abis: Array<any>) { | |
const obj: Record<string, Connex.Thor.Account.Method> = {} | |
abis.filter(i => i.type === 'function' && i.name) | |
.forEach(i => { | |
obj[i.name] = thor.account(address).method(i) | |
}) | |
return obj | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment