Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
awaitTransactionSuccessAsync(
assetData: string,
from: string,
to: string,
amount: BigNumber,
txData?: Partial,
opts: AwaitTransactionSuccessOpts = { shouldValidate: true },
): PromiseWithTransactionHash {
assert.isString('assetData', assetData);
assert.isString('from', from);
assert.isString('to', to);
assert.isBigNumber('amount', amount);
const self = (this as any) as IAssetProxyContract;
const txHashPromise = self.transferFrom.sendTransactionAsync(
assetData,
from.toLowerCase(),
to.toLowerCase(),
amount,
txData,
opts,
);
return new PromiseWithTransactionHash(
txHashPromise,
(async (): Promise => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
async callAsync(
assetProxyId: string,
callData: Partial = {},
defaultBlock?: BlockParam,
): Promise {
assert.isString('assetProxyId', assetProxyId);
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
schemas.addressSchema,
schemas.numberSchema,
schemas.jsNumber,
]);
if (defaultBlock !== undefined) {
assert.isBlockParam('defaultBlock', defaultBlock);
}
const self = (this as any) as MultiAssetProxyContract;
const encodedData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
public isApprovedForAll(owner: string, operator: string): ContractFunctionObj {
const self = (this as any) as ERC1155MintableContract;
assert.isString('owner', owner);
assert.isString('operator', operator);
const functionSignature = 'isApprovedForAll(address,address)';
return {
async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise {
BaseContract._assertCallParams(callData, defaultBlock);
const rawCallResult = await self._performCallAsync(
{ ...callData, data: this.getABIEncodedTransactionData() },
defaultBlock,
);
const abiEncoder = self._lookupAbiEncoder(functionSignature);
return abiEncoder.strictDecodeReturnValue(rawCallResult);
},
getABIEncodedTransactionData(): string {
return self._strictEncodeArguments(functionSignature, [owner.toLowerCase(), operator.toLowerCase()]);
},
public safeTransferFrom2(
_from: string,
_to: string,
_tokenId: BigNumber,
_data: string,
): ContractTxFunctionObj {
const self = (this as any) as DummyERC721TokenContract;
assert.isString('_from', _from);
assert.isString('_to', _to);
assert.isBigNumber('_tokenId', _tokenId);
assert.isString('_data', _data);
const functionSignature = 'safeTransferFrom(address,address,uint256,bytes)';
return {
async sendTransactionAsync(
txData?: Partial | undefined,
opts: SendTransactionOpts = { shouldValidate: true },
): Promise {
const txDataWithDefaults = await self._applyDefaultsToTxDataAsync(
{ ...txData, data: this.getABIEncodedTransactionData() },
this.estimateGasAsync.bind(this),
);
if (opts.shouldValidate !== false) {
await this.callAsync(txDataWithDefaults);
public allowance(_owner: string, _spender: string): ContractFunctionObj {
const self = (this as any) as ERC20TokenContract;
assert.isString('_owner', _owner);
assert.isString('_spender', _spender);
const functionSignature = 'allowance(address,address)';
return {
async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise {
BaseContract._assertCallParams(callData, defaultBlock);
const rawCallResult = await self._performCallAsync(
{ ...callData, data: this.getABIEncodedTransactionData() },
defaultBlock,
);
const abiEncoder = self._lookupAbiEncoder(functionSignature);
return abiEncoder.strictDecodeReturnValue(rawCallResult);
},
getABIEncodedTransactionData(): string {
return self._strictEncodeArguments(functionSignature, [_owner.toLowerCase(), _spender.toLowerCase()]);
},
public setApprovalForAll(operator: string, approved: boolean): ContractTxFunctionObj {
const self = (this as any) as ERC1155MintableContract;
assert.isString('operator', operator);
assert.isBoolean('approved', approved);
const functionSignature = 'setApprovalForAll(address,bool)';
return {
async sendTransactionAsync(
txData?: Partial | undefined,
opts: SendTransactionOpts = { shouldValidate: true },
): Promise {
const txDataWithDefaults = await self._applyDefaultsToTxDataAsync(
{ ...txData, data: this.getABIEncodedTransactionData() },
this.estimateGasAsync.bind(this),
);
if (opts.shouldValidate !== false) {
await this.callAsync(txDataWithDefaults);
}
return self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
public balanceOf(_owner: string): ContractFunctionObj {
const self = (this as any) as ERC721TokenContract;
assert.isString('_owner', _owner);
const functionSignature = 'balanceOf(address)';
return {
async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise {
BaseContract._assertCallParams(callData, defaultBlock);
const rawCallResult = await self._performCallAsync(
{ ...callData, data: this.getABIEncodedTransactionData() },
defaultBlock,
);
const abiEncoder = self._lookupAbiEncoder(functionSignature);
return abiEncoder.strictDecodeReturnValue(rawCallResult);
},
getABIEncodedTransactionData(): string {
return self._strictEncodeArguments(functionSignature, [_owner.toLowerCase()]);
},
};
public isApprovedForAll(_owner: string, _operator: string): ContractFunctionObj {
const self = (this as any) as DummyERC721TokenContract;
assert.isString('_owner', _owner);
assert.isString('_operator', _operator);
const functionSignature = 'isApprovedForAll(address,address)';
return {
async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise {
BaseContract._assertCallParams(callData, defaultBlock);
const rawCallResult = await self._performCallAsync(
{ ...callData, data: this.getABIEncodedTransactionData() },
defaultBlock,
);
const abiEncoder = self._lookupAbiEncoder(functionSignature);
return abiEncoder.strictDecodeReturnValue(rawCallResult);
},
getABIEncodedTransactionData(): string {
return self._strictEncodeArguments(functionSignature, [_owner.toLowerCase(), _operator.toLowerCase()]);
},
};
public executeTransaction(
transaction: {
salt: BigNumber;
expirationTimeSeconds: BigNumber;
gasPrice: BigNumber;
signerAddress: string;
data: string;
},
txOrigin: string,
transactionSignature: string,
approvalSignatures: string[],
): ContractTxFunctionObj {
const self = (this as any) as CoordinatorContract;
assert.isString('txOrigin', txOrigin);
assert.isString('transactionSignature', transactionSignature);
assert.isArray('approvalSignatures', approvalSignatures);
const functionSignature = 'executeTransaction((uint256,uint256,uint256,address,bytes),address,bytes,bytes[])';
return {
async sendTransactionAsync(
txData?: Partial | undefined,
opts: SendTransactionOpts = { shouldValidate: true },
): Promise {
const txDataWithDefaults = await self._applyDefaultsToTxDataAsync(
{ ...txData, data: this.getABIEncodedTransactionData() },
this.estimateGasAsync.bind(this),
);
if (opts.shouldValidate !== false) {
await this.callAsync(txDataWithDefaults);
}
return self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
public async getOrdersAsync(makerAssetData: string, takerAssetData: string): Promise {
assert.isString('makerAssetData', makerAssetData);
assert.isString('takerAssetData', takerAssetData);
const assetPairKey = OrderStore.getKeyForAssetPair(makerAssetData, takerAssetData);
if (!(await this._orderStore.hasAsync(assetPairKey))) {
await this._orderProvider.createSubscriptionForAssetPairAsync(makerAssetData, takerAssetData);
}
const orders = await this._orderStore.valuesAsync(assetPairKey);
return orders.filter(
o => o.order.makerAssetData === makerAssetData && o.order.takerAssetData === takerAssetData,
);
}
/**