-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: send tx by type * test: add test * chore: wip * test: add tests BREAKING CHANGE: call and send tx by type
- Loading branch information
1 parent
d4d2449
commit c212997
Showing
16 changed files
with
5,201 additions
and
2,477 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { eth, Contract } from '../dist' | ||
import { fulfillContractMethods } from '../dist/contracts/verification' | ||
|
||
const { abi } = require('./fixtures/MANAToken.json') | ||
|
||
export interface MANAToken { | ||
mintingFinished(): Promise<boolean> | ||
name(): Promise<string> | ||
totalSupply(): Promise<any /* BigNumber */> | ||
transferFrom(from: string, to: string, value): Promise<boolean> | ||
decimals(): Promise<number> | ||
unpause(): Promise<boolean> | ||
mint(to: string, amount): Promise<string> | ||
burn(value): Promise<void> | ||
paused(): Promise<boolean> | ||
finishMinting(): Promise<boolean> | ||
pause(): Promise<boolean> | ||
owner(): Promise<string> | ||
symbol(): Promise<string> | ||
transferOwnership(newOwner: string): Promise<void> | ||
transfer(to: string, value): Promise<boolean> | ||
} | ||
|
||
/** MANAToken contract class */ | ||
export class MANAToken extends Contract { | ||
constructor(address: string) { | ||
super(address, abi) | ||
fulfillContractMethods(this, abi) | ||
} | ||
|
||
getContractName() { | ||
return 'MANAToken' | ||
} | ||
|
||
async approve(spender: string, mana: number) { | ||
return this.sendTransaction('approve', spender, eth.utils.toWei(mana)) | ||
} | ||
|
||
async allowance(owner: string, spender: string) { | ||
const assigned = await this.sendCall('allowance', owner, spender) | ||
return eth.utils.fromWei(assigned) | ||
} | ||
|
||
async balanceOf(owner: string): Promise<number> { | ||
const manaBalance = await this.sendCall('balanceOf', owner) | ||
return eth.utils.fromWei(manaBalance) | ||
} | ||
} |
Oops, something went wrong.