Skip to content

Instantly share code, notes, and snippets.

@qianbin
Created April 12, 2021 06:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qianbin/0c10af940e9f33fade99d927179352b2 to your computer and use it in GitHub Desktop.
Save qianbin/0c10af940e9f33fade99d927179352b2 to your computer and use it in GitHub Desktop.
connex2: demonstrate how to create an contract object like web3
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