-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1825 from aeternity/feature/fix-AeSdkMethods
fix: `onAccount` option in AeSdkMethods
- Loading branch information
Showing
6 changed files
with
94 additions
and
57 deletions.
There are no files selected for viewing
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,39 @@ | ||
import { describe, it, before } from 'mocha'; | ||
import { expect } from 'chai'; | ||
import { getSdk, url, compilerUrl } from '.'; | ||
import { assertNotNull } from '../utils'; | ||
import { | ||
AeSdkMethods, Node, CompilerHttp, AccountBase, | ||
} from '../../src'; | ||
|
||
describe('AeSdkMethods', () => { | ||
let accounts: AccountBase[]; | ||
let aeSdkMethods: AeSdkMethods; | ||
|
||
before(async () => { | ||
accounts = Object.values((await getSdk(2)).accounts); | ||
aeSdkMethods = new AeSdkMethods({ | ||
onAccount: accounts[0], | ||
onNode: new Node(url), | ||
onCompiler: new CompilerHttp(compilerUrl), | ||
}); | ||
}); | ||
|
||
it('spend coins', async () => { | ||
const { tx } = await aeSdkMethods.spend(1, accounts[1].address); | ||
assertNotNull(tx); | ||
expect(tx.senderId).to.equal(accounts[0].address); | ||
expect(tx.recipientId).to.equal(accounts[1].address); | ||
}); | ||
|
||
it('created contract remains connected to sdk', async () => { | ||
const contract = await aeSdkMethods.initializeContract({ | ||
sourceCode: '' | ||
+ 'contract Identity =\n' | ||
+ ' entrypoint getArg(x : int) = x', | ||
}); | ||
expect(contract.$options.onAccount?.address).to.be.eql(accounts[0].address); | ||
[, aeSdkMethods._options.onAccount] = accounts; | ||
expect(contract.$options.onAccount?.address).to.be.eql(accounts[1].address); | ||
}); | ||
}); |
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