aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/generated-wrappers/test_lib_bytes.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/contracts/generated-wrappers/test_lib_bytes.ts')
-rw-r--r--packages/contracts/generated-wrappers/test_lib_bytes.ts683
1 files changed, 683 insertions, 0 deletions
diff --git a/packages/contracts/generated-wrappers/test_lib_bytes.ts b/packages/contracts/generated-wrappers/test_lib_bytes.ts
new file mode 100644
index 000000000..ef0003b80
--- /dev/null
+++ b/packages/contracts/generated-wrappers/test_lib_bytes.ts
@@ -0,0 +1,683 @@
+// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
+// tslint:disable:no-unused-variable
+// tslint:disable:no-unbound-method
+import { BaseContract } from '@0xproject/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0xproject/utils';
+import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import * as ethers from 'ethers';
+import * as _ from 'lodash';
+// tslint:enable:no-unused-variable
+
+
+/* istanbul ignore next */
+// tslint:disable:no-parameter-reassignment
+// tslint:disable-next-line:class-name
+export class TestLibBytesContract extends BaseContract {
+ public publicPopLastByte = {
+ async callAsync(
+ b: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<[string, string]
+ > {
+ const self = this as any as TestLibBytesContract;
+ const functionSignature = 'publicPopLastByte(bytes)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [b
+ ] = BaseContract._formatABIDataItemList(inputAbi, [b
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [b
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicPopLastByte;
+ const encodedData = ethersFunction.encode([b
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'publicPopLastByte'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public publicReadBytesWithLength = {
+ async callAsync(
+ b: string,
+ index: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as TestLibBytesContract;
+ const functionSignature = 'publicReadBytesWithLength(bytes,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [b,
+ index
+ ] = BaseContract._formatABIDataItemList(inputAbi, [b,
+ index
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [b,
+ index
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicReadBytesWithLength;
+ const encodedData = ethersFunction.encode([b,
+ index
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'publicReadBytesWithLength'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public publicDeepCopyBytes = {
+ async callAsync(
+ dest: string,
+ source: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as TestLibBytesContract;
+ const functionSignature = 'publicDeepCopyBytes(bytes,bytes)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [dest,
+ source
+ ] = BaseContract._formatABIDataItemList(inputAbi, [dest,
+ source
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [dest,
+ source
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicDeepCopyBytes;
+ const encodedData = ethersFunction.encode([dest,
+ source
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'publicDeepCopyBytes'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public publicWriteAddress = {
+ async callAsync(
+ b: string,
+ index: BigNumber,
+ input: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as TestLibBytesContract;
+ const functionSignature = 'publicWriteAddress(bytes,uint256,address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [b,
+ index,
+ input
+ ] = BaseContract._formatABIDataItemList(inputAbi, [b,
+ index,
+ input
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [b,
+ index,
+ input
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicWriteAddress;
+ const encodedData = ethersFunction.encode([b,
+ index,
+ input
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'publicWriteAddress'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public publicWriteBytesWithLength = {
+ async callAsync(
+ b: string,
+ index: BigNumber,
+ input: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as TestLibBytesContract;
+ const functionSignature = 'publicWriteBytesWithLength(bytes,uint256,bytes)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [b,
+ index,
+ input
+ ] = BaseContract._formatABIDataItemList(inputAbi, [b,
+ index,
+ input
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [b,
+ index,
+ input
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicWriteBytesWithLength;
+ const encodedData = ethersFunction.encode([b,
+ index,
+ input
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'publicWriteBytesWithLength'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public testMemcpy = {
+ async callAsync(
+ mem: string,
+ dest: BigNumber,
+ source: BigNumber,
+ length: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as TestLibBytesContract;
+ const functionSignature = 'testMemcpy(bytes,uint256,uint256,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [mem,
+ dest,
+ source,
+ length
+ ] = BaseContract._formatABIDataItemList(inputAbi, [mem,
+ dest,
+ source,
+ length
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [mem,
+ dest,
+ source,
+ length
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.testMemcpy;
+ const encodedData = ethersFunction.encode([mem,
+ dest,
+ source,
+ length
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'testMemcpy'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public publicReadAddress = {
+ async callAsync(
+ b: string,
+ index: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as TestLibBytesContract;
+ const functionSignature = 'publicReadAddress(bytes,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [b,
+ index
+ ] = BaseContract._formatABIDataItemList(inputAbi, [b,
+ index
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [b,
+ index
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicReadAddress;
+ const encodedData = ethersFunction.encode([b,
+ index
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'publicReadAddress'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public publicWriteBytes32 = {
+ async callAsync(
+ b: string,
+ index: BigNumber,
+ input: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as TestLibBytesContract;
+ const functionSignature = 'publicWriteBytes32(bytes,uint256,bytes32)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [b,
+ index,
+ input
+ ] = BaseContract._formatABIDataItemList(inputAbi, [b,
+ index,
+ input
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [b,
+ index,
+ input
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicWriteBytes32;
+ const encodedData = ethersFunction.encode([b,
+ index,
+ input
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'publicWriteBytes32'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public publicPopLast20Bytes = {
+ async callAsync(
+ b: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<[string, string]
+ > {
+ const self = this as any as TestLibBytesContract;
+ const functionSignature = 'publicPopLast20Bytes(bytes)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [b
+ ] = BaseContract._formatABIDataItemList(inputAbi, [b
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [b
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicPopLast20Bytes;
+ const encodedData = ethersFunction.encode([b
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'publicPopLast20Bytes'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public publicEqualsPop1 = {
+ async callAsync(
+ lhs: string,
+ rhs: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as TestLibBytesContract;
+ const functionSignature = 'publicEqualsPop1(bytes,bytes)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [lhs,
+ rhs
+ ] = BaseContract._formatABIDataItemList(inputAbi, [lhs,
+ rhs
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [lhs,
+ rhs
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicEqualsPop1;
+ const encodedData = ethersFunction.encode([lhs,
+ rhs
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'publicEqualsPop1'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public publicWriteUint256 = {
+ async callAsync(
+ b: string,
+ index: BigNumber,
+ input: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as TestLibBytesContract;
+ const functionSignature = 'publicWriteUint256(bytes,uint256,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [b,
+ index,
+ input
+ ] = BaseContract._formatABIDataItemList(inputAbi, [b,
+ index,
+ input
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [b,
+ index,
+ input
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicWriteUint256;
+ const encodedData = ethersFunction.encode([b,
+ index,
+ input
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'publicWriteUint256'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public publicReadBytes32 = {
+ async callAsync(
+ b: string,
+ index: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as TestLibBytesContract;
+ const functionSignature = 'publicReadBytes32(bytes,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [b,
+ index
+ ] = BaseContract._formatABIDataItemList(inputAbi, [b,
+ index
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [b,
+ index
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicReadBytes32;
+ const encodedData = ethersFunction.encode([b,
+ index
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'publicReadBytes32'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public publicReadBytes4 = {
+ async callAsync(
+ b: string,
+ index: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as TestLibBytesContract;
+ const functionSignature = 'publicReadBytes4(bytes,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [b,
+ index
+ ] = BaseContract._formatABIDataItemList(inputAbi, [b,
+ index
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [b,
+ index
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicReadBytes4;
+ const encodedData = ethersFunction.encode([b,
+ index
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'publicReadBytes4'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public publicReadUint256 = {
+ async callAsync(
+ b: string,
+ index: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as TestLibBytesContract;
+ const functionSignature = 'publicReadUint256(bytes,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [b,
+ index
+ ] = BaseContract._formatABIDataItemList(inputAbi, [b,
+ index
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [b,
+ index
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicReadUint256;
+ const encodedData = ethersFunction.encode([b,
+ index
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'publicReadUint256'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public publicEquals = {
+ async callAsync(
+ lhs: string,
+ rhs: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as TestLibBytesContract;
+ const functionSignature = 'publicEquals(bytes,bytes)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [lhs,
+ rhs
+ ] = BaseContract._formatABIDataItemList(inputAbi, [lhs,
+ rhs
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [lhs,
+ rhs
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicEquals;
+ const encodedData = ethersFunction.encode([lhs,
+ rhs
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'publicEquals'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public static async deployFrom0xArtifactAsync(
+ artifact: ContractArtifact,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<TestLibBytesContract> {
+ if (_.isUndefined(artifact.compilerOutput)) {
+ throw new Error('Compiler output not found in the artifact file');
+ }
+ const bytecode = artifact.compilerOutput.evm.bytecode.object;
+ const abi = artifact.compilerOutput.abi;
+ return TestLibBytesContract.deployAsync(bytecode, abi, provider, txDefaults, );
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<TestLibBytesContract> {
+ const constructorAbi = BaseContract._lookupConstructorAbi(abi);
+ [] = BaseContract._formatABIDataItemList(
+ constructorAbi.inputs,
+ [],
+ BaseContract._bigNumberToString,
+ );
+ const iface = new ethers.Interface(abi);
+ const deployInfo = iface.deployFunction;
+ const txData = deployInfo.encode(bytecode, []);
+ const web3Wrapper = new Web3Wrapper(provider);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {data: txData},
+ txDefaults,
+ web3Wrapper.estimateGasAsync.bind(web3Wrapper),
+ );
+ const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ logUtils.log(`transactionHash: ${txHash}`);
+ const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ logUtils.log(`TestLibBytes successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new TestLibBytesContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('TestLibBytes', abi, address, provider, txDefaults);
+ classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
+ }
+} // tslint:disable:max-file-line-count
+// tslint:enable:no-unbound-method