aboutsummaryrefslogtreecommitdiffstats
path: root/src/0x.js.ts
diff options
context:
space:
mode:
authorLeonid <logvinov.leon@gmail.com>2017-06-06 21:14:53 +0800
committerGitHub <noreply@github.com>2017-06-06 21:14:53 +0800
commit692a0fd965f7c0cfc0eef79112d2abffdf9e90db (patch)
treea3a97eb6522bc887966da6575e4b2ac73560fdcf /src/0x.js.ts
parent2eb99f46f53984c1a54315f87059ef18b9d06349 (diff)
parentf54b513935dbba0dd1922566ed2fd4b4acbf6459 (diff)
downloaddexon-sol-tools-692a0fd965f7c0cfc0eef79112d2abffdf9e90db.tar
dexon-sol-tools-692a0fd965f7c0cfc0eef79112d2abffdf9e90db.tar.gz
dexon-sol-tools-692a0fd965f7c0cfc0eef79112d2abffdf9e90db.tar.bz2
dexon-sol-tools-692a0fd965f7c0cfc0eef79112d2abffdf9e90db.tar.lz
dexon-sol-tools-692a0fd965f7c0cfc0eef79112d2abffdf9e90db.tar.xz
dexon-sol-tools-692a0fd965f7c0cfc0eef79112d2abffdf9e90db.tar.zst
dexon-sol-tools-692a0fd965f7c0cfc0eef79112d2abffdf9e90db.zip
Merge pull request #39 from 0xProject/senderAccount
Make methods accept senderAccount
Diffstat (limited to 'src/0x.js.ts')
-rw-r--r--src/0x.js.ts23
1 files changed, 8 insertions, 15 deletions
diff --git a/src/0x.js.ts b/src/0x.js.ts
index 850827fee..0f437e039 100644
--- a/src/0x.js.ts
+++ b/src/0x.js.ts
@@ -122,17 +122,11 @@ export class ZeroEx {
this.token.invalidateContractInstances();
}
/**
- * Sets default account for sending transactions.
+ * Get addresses via the supplied web3 instance available for sending transactions.
*/
- public setTransactionSenderAccount(account: string): void {
- this.web3Wrapper.setDefaultAccount(account);
- }
- /**
- * Get the default account set for sending transactions.
- */
- public async getTransactionSenderAccountIfExistsAsync(): Promise<string|undefined> {
- const senderAccountIfExists = await this.web3Wrapper.getSenderAddressIfExistsAsync();
- return senderAccountIfExists;
+ public async getAvailableAddressesAsync(): Promise<string[]> {
+ const availableAddresses = await this.web3Wrapper.getAvailableAddressesAsync();
+ return availableAddresses;
}
/**
* Computes the orderHash for a given order and returns it as a hex encoded string.
@@ -167,10 +161,9 @@ export class ZeroEx {
* Signs an orderHash and returns it's elliptic curve signature
* This method currently supports TestRPC, Geth and Parity above and below V1.6.6
*/
- public async signOrderHashAsync(orderHashHex: string): Promise<ECSignature> {
+ public async signOrderHashAsync(orderHashHex: string, signerAddress: string): Promise<ECSignature> {
assert.isHexString('orderHashHex', orderHashHex);
-
- const makerAddress = await this.web3Wrapper.getSenderAddressOrThrowAsync();
+ await assert.isSenderAddressAsync('signerAddress', signerAddress, this.web3Wrapper);
let msgHashHex;
const nodeVersion = await this.web3Wrapper.getNodeVersionAsync();
@@ -184,7 +177,7 @@ export class ZeroEx {
msgHashHex = ethUtil.bufferToHex(msgHashBuff);
}
- const signature = await this.web3Wrapper.signTransactionAsync(makerAddress, msgHashHex);
+ const signature = await this.web3Wrapper.signTransactionAsync(signerAddress, msgHashHex);
let signatureData;
const [nodeVersionNumber] = findVersions(nodeVersion);
@@ -214,7 +207,7 @@ export class ZeroEx {
r: ethUtil.bufferToHex(r),
s: ethUtil.bufferToHex(s),
};
- const isValidSignature = ZeroEx.isValidSignature(orderHashHex, ecSignature, makerAddress);
+ const isValidSignature = ZeroEx.isValidSignature(orderHashHex, ecSignature, signerAddress);
if (!isValidSignature) {
throw new Error(ZeroExError.INVALID_SIGNATURE);
}