aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-06-06 18:40:58 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-06-06 18:40:58 +0800
commitf7236e7f499f59d883603798cda11d3636b26f4a (patch)
treea4ab3fd3758bc179cb16fea8dfa78700f5d309aa /src
parented3d1a8142e6f65480f95df7c3991ae00c757e38 (diff)
downloaddexon-sol-tools-f7236e7f499f59d883603798cda11d3636b26f4a.tar.gz
dexon-sol-tools-f7236e7f499f59d883603798cda11d3636b26f4a.tar.zst
dexon-sol-tools-f7236e7f499f59d883603798cda11d3636b26f4a.zip
Rename senderAccount to senderAddress
Diffstat (limited to 'src')
-rw-r--r--src/0x.js.ts8
-rw-r--r--src/contract_wrappers/exchange_wrapper.ts16
-rw-r--r--src/contract_wrappers/token_wrapper.ts10
-rw-r--r--src/utils/assert.ts12
4 files changed, 23 insertions, 23 deletions
diff --git a/src/0x.js.ts b/src/0x.js.ts
index 65d363218..0d8e30d8c 100644
--- a/src/0x.js.ts
+++ b/src/0x.js.ts
@@ -161,9 +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, senderAccount: string): Promise<ECSignature> {
+ public async signOrderHashAsync(orderHashHex: string, senderAddress: string): Promise<ECSignature> {
assert.isHexString('orderHashHex', orderHashHex);
- await assert.isSenderAddressHexAsync('senderAccount', senderAccount, this.web3Wrapper);
+ await assert.isSenderAddressHexAsync('senderAddress', senderAddress, this.web3Wrapper);
let msgHashHex;
const nodeVersion = await this.web3Wrapper.getNodeVersionAsync();
@@ -177,7 +177,7 @@ export class ZeroEx {
msgHashHex = ethUtil.bufferToHex(msgHashBuff);
}
- const signature = await this.web3Wrapper.signTransactionAsync(senderAccount, msgHashHex);
+ const signature = await this.web3Wrapper.signTransactionAsync(senderAddress, msgHashHex);
let signatureData;
const [nodeVersionNumber] = findVersions(nodeVersion);
@@ -207,7 +207,7 @@ export class ZeroEx {
r: ethUtil.bufferToHex(r),
s: ethUtil.bufferToHex(s),
};
- const isValidSignature = ZeroEx.isValidSignature(orderHashHex, ecSignature, senderAccount);
+ const isValidSignature = ZeroEx.isValidSignature(orderHashHex, ecSignature, senderAddress);
if (!isValidSignature) {
throw new Error(ZeroExError.INVALID_SIGNATURE);
}
diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts
index 5c5a46a03..dd06830aa 100644
--- a/src/contract_wrappers/exchange_wrapper.ts
+++ b/src/contract_wrappers/exchange_wrapper.ts
@@ -203,11 +203,11 @@ export class ExchangeWrapper extends ContractWrapper {
}
private async validateFillOrderAndThrowIfInvalidAsync(signedOrder: SignedOrder,
fillTakerAmount: BigNumber.BigNumber,
- senderAccount: string): Promise<void> {
+ senderAddress: string): Promise<void> {
if (fillTakerAmount.eq(0)) {
throw new Error(ExchangeContractErrs.ORDER_REMAINING_FILL_AMOUNT_ZERO);
}
- if (signedOrder.taker !== constants.NULL_ADDRESS && signedOrder.taker !== senderAccount) {
+ if (signedOrder.taker !== constants.NULL_ADDRESS && signedOrder.taker !== senderAddress) {
throw new Error(ExchangeContractErrs.TRANSACTION_SENDER_IS_NOT_FILL_ORDER_TAKER);
}
const currentUnixTimestampSec = Date.now() / 1000;
@@ -216,7 +216,7 @@ export class ExchangeWrapper extends ContractWrapper {
}
const zrxTokenAddress = await this.getZRXTokenAddressAsync();
await this.validateFillOrderBalancesAndAllowancesAndThrowIfInvalidAsync(signedOrder, fillTakerAmount,
- senderAccount, zrxTokenAddress);
+ senderAddress, zrxTokenAddress);
const wouldRoundingErrorOccur = await this.isRoundingErrorAsync(
signedOrder.takerTokenAmount, fillTakerAmount, signedOrder.makerTokenAmount,
@@ -237,16 +237,16 @@ export class ExchangeWrapper extends ContractWrapper {
*/
private async validateFillOrderBalancesAndAllowancesAndThrowIfInvalidAsync(signedOrder: SignedOrder,
fillTakerAmount: BigNumber.BigNumber,
- senderAccount: string,
+ senderAddress: string,
zrxTokenAddress: string): Promise<void> {
const makerBalance = await this.tokenWrapper.getBalanceAsync(signedOrder.makerTokenAddress,
signedOrder.maker);
- const takerBalance = await this.tokenWrapper.getBalanceAsync(signedOrder.takerTokenAddress, senderAccount);
+ const takerBalance = await this.tokenWrapper.getBalanceAsync(signedOrder.takerTokenAddress, senderAddress);
const makerAllowance = await this.tokenWrapper.getProxyAllowanceAsync(signedOrder.makerTokenAddress,
signedOrder.maker);
const takerAllowance = await this.tokenWrapper.getProxyAllowanceAsync(signedOrder.takerTokenAddress,
- senderAccount);
+ senderAddress);
// exchangeRate is the price of one maker token denominated in taker tokens
const exchangeRate = signedOrder.takerTokenAmount.div(signedOrder.makerTokenAmount);
@@ -267,11 +267,11 @@ export class ExchangeWrapper extends ContractWrapper {
const makerFeeBalance = await this.tokenWrapper.getBalanceAsync(zrxTokenAddress,
signedOrder.maker);
- const takerFeeBalance = await this.tokenWrapper.getBalanceAsync(zrxTokenAddress, senderAccount);
+ const takerFeeBalance = await this.tokenWrapper.getBalanceAsync(zrxTokenAddress, senderAddress);
const makerFeeAllowance = await this.tokenWrapper.getProxyAllowanceAsync(zrxTokenAddress,
signedOrder.maker);
const takerFeeAllowance = await this.tokenWrapper.getProxyAllowanceAsync(zrxTokenAddress,
- senderAccount);
+ senderAddress);
if (signedOrder.takerFee.greaterThan(takerFeeBalance)) {
throw new Error(ExchangeContractErrs.INSUFFICIENT_TAKER_FEE_BALANCE);
diff --git a/src/contract_wrappers/token_wrapper.ts b/src/contract_wrappers/token_wrapper.ts
index 326bca189..34697d97c 100644
--- a/src/contract_wrappers/token_wrapper.ts
+++ b/src/contract_wrappers/token_wrapper.ts
@@ -115,20 +115,20 @@ export class TokenWrapper extends ContractWrapper {
/**
* Transfers `amountInBaseUnits` ERC20 tokens from `fromAddress` to `toAddress`.
* Requires the fromAddress to have sufficient funds and to have approved an allowance of
- * `amountInBaseUnits` for senderAccount.
+ * `amountInBaseUnits` for senderAddress.
*/
public async transferFromAsync(tokenAddress: string, fromAddress: string, toAddress: string,
- senderAccount: string, amountInBaseUnits: BigNumber.BigNumber):
+ senderAddress: string, amountInBaseUnits: BigNumber.BigNumber):
Promise<void> {
assert.isETHAddressHex('tokenAddress', tokenAddress);
assert.isETHAddressHex('fromAddress', fromAddress);
assert.isETHAddressHex('toAddress', toAddress);
- await assert.isSenderAddressHexAsync('senderAccount', senderAccount, this.web3Wrapper);
+ await assert.isSenderAddressHexAsync('senderAddress', senderAddress, this.web3Wrapper);
assert.isBigNumber('amountInBaseUnits', amountInBaseUnits);
const tokenContract = await this.getTokenContractAsync(tokenAddress);
- const fromAddressAllowance = await this.getAllowanceAsync(tokenAddress, fromAddress, senderAccount);
+ const fromAddressAllowance = await this.getAllowanceAsync(tokenAddress, fromAddress, senderAddress);
if (fromAddressAllowance.lessThan(amountInBaseUnits)) {
throw new Error(ZeroExError.INSUFFICIENT_ALLOWANCE_FOR_TRANSFER);
}
@@ -139,7 +139,7 @@ export class TokenWrapper extends ContractWrapper {
}
await tokenContract.transferFrom(fromAddress, toAddress, amountInBaseUnits, {
- from: senderAccount,
+ from: senderAddress,
});
}
private async getTokenContractAsync(tokenAddress: string): Promise<TokenContract> {
diff --git a/src/utils/assert.ts b/src/utils/assert.ts
index d9cf57d1c..6e10c5d40 100644
--- a/src/utils/assert.ts
+++ b/src/utils/assert.ts
@@ -26,14 +26,14 @@ export const assert = {
const web3 = new Web3();
this.assert(web3.isAddress(value), this.typeAssertionMessage(variableName, 'ETHAddressHex', value));
},
- async isSenderAddressHexAsync(variableName: string, senderAccount: string,
+ async isSenderAddressHexAsync(variableName: string, senderAddress: string,
web3Wrapper: Web3Wrapper): Promise<void> {
- assert.isETHAddressHex(variableName, senderAccount);
- await assert.isSenderAccountAvailableAsync(web3Wrapper, senderAccount);
+ assert.isETHAddressHex(variableName, senderAddress);
+ await assert.isSenderAccountAvailableAsync(web3Wrapper, senderAddress);
},
- async isSenderAccountAvailableAsync(web3Wrapper: Web3Wrapper, senderAccount: string): Promise<void> {
- const isSenderAddressAvailable = await web3Wrapper.isSenderAddressAvailableAsync(senderAccount);
- assert.assert(isSenderAddressAvailable, `Specified sender account ${senderAccount} isn't available through the \
+ async isSenderAccountAvailableAsync(web3Wrapper: Web3Wrapper, senderAddress: string): Promise<void> {
+ const isSenderAddressAvailable = await web3Wrapper.isSenderAddressAvailableAsync(senderAddress);
+ assert.assert(isSenderAddressAvailable, `Specified sender account ${senderAddress} isn't available through the \
supplied web3 instance`);
},
isNumber(variableName: string, value: number): void {