From 25c6f3bedeaca62f07aeb7d12b5954c9035d742e Mon Sep 17 00:00:00 2001 From: Lawrence Forman Date: Mon, 26 Apr 2021 18:40:46 -0400 Subject: [PATCH] export and `EncodingRules` from utils --- abi-gen/CHANGELOG.json | 9 +++++++++ abi-gen/templates/TypeScript/contract.handlebars | 4 ++-- abi-gen/test-cli/output/typescript/abi_gen_dummy.ts | 4 +++- abi-gen/test-cli/output/typescript/lib_dummy.ts | 4 +++- abi-gen/test-cli/output/typescript/test_lib_dummy.ts | 4 +++- utils/CHANGELOG.json | 9 +++++++++ utils/src/index.ts | 1 + 7 files changed, 30 insertions(+), 5 deletions(-) diff --git a/abi-gen/CHANGELOG.json b/abi-gen/CHANGELOG.json index eb00bf659..04e540f5e 100644 --- a/abi-gen/CHANGELOG.json +++ b/abi-gen/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "version": "5.5.2", + "changes": [ + { + "note": "Use `EncodingRules` instead of `AbiEncoder.EncodingRules` in templates", + "pr": 37 + } + ] + }, { "timestamp": 1619466964, "version": "5.5.1", diff --git a/abi-gen/templates/TypeScript/contract.handlebars b/abi-gen/templates/TypeScript/contract.handlebars index 9e3db37b1..849e81508 100644 --- a/abi-gen/templates/TypeScript/contract.handlebars +++ b/abi-gen/templates/TypeScript/contract.handlebars @@ -29,7 +29,7 @@ import { TxAccessListWithGas, SupportedProvider, } from 'ethereum-types'; -import { AbiEncoder, BigNumber, classUtils, hexUtils, logUtils, providerUtils } from '@0x/utils'; +import { AbiEncoder, BigNumber, classUtils, EncodingRules, hexUtils, logUtils, providerUtils } from '@0x/utils'; import { EventCallback, IndexedFilterValues, SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; @@ -381,7 +381,7 @@ export class {{contractName}}Contract extends BaseContract { txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }, deployedBytecode: string | undefined = {{contractName}}Contract.deployedBytecode, - encodingRules?: AbiEncoder.EncodingRules, + encodingRules?: EncodingRules, ) { super('{{contractName}}', {{contractName}}Contract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies, deployedBytecode, encodingRules); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); diff --git a/abi-gen/test-cli/output/typescript/abi_gen_dummy.ts b/abi-gen/test-cli/output/typescript/abi_gen_dummy.ts index 22e165c63..df771c946 100644 --- a/abi-gen/test-cli/output/typescript/abi_gen_dummy.ts +++ b/abi-gen/test-cli/output/typescript/abi_gen_dummy.ts @@ -29,7 +29,7 @@ import { TxAccessListWithGas, SupportedProvider, } from 'ethereum-types'; -import { BigNumber, classUtils, hexUtils, logUtils, providerUtils } from '@0x/utils'; +import { AbiEncoder, BigNumber, classUtils, EncodingRules, hexUtils, logUtils, providerUtils } from '@0x/utils'; import { EventCallback, IndexedFilterValues, SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; @@ -2140,6 +2140,7 @@ export class AbiGenDummyContract extends BaseContract { txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }, deployedBytecode: string | undefined = AbiGenDummyContract.deployedBytecode, + encodingRules?: EncodingRules, ) { super( 'AbiGenDummy', @@ -2149,6 +2150,7 @@ export class AbiGenDummyContract extends BaseContract { txDefaults, logDecodeDependencies, deployedBytecode, + encodingRules, ); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( diff --git a/abi-gen/test-cli/output/typescript/lib_dummy.ts b/abi-gen/test-cli/output/typescript/lib_dummy.ts index b1dbee41d..a23cf2228 100644 --- a/abi-gen/test-cli/output/typescript/lib_dummy.ts +++ b/abi-gen/test-cli/output/typescript/lib_dummy.ts @@ -27,7 +27,7 @@ import { TxAccessListWithGas, SupportedProvider, } from 'ethereum-types'; -import { BigNumber, classUtils, hexUtils, logUtils, providerUtils } from '@0x/utils'; +import { AbiEncoder, BigNumber, classUtils, EncodingRules, hexUtils, logUtils, providerUtils } from '@0x/utils'; import { EventCallback, IndexedFilterValues, SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; @@ -222,6 +222,7 @@ export class LibDummyContract extends BaseContract { txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }, deployedBytecode: string | undefined = LibDummyContract.deployedBytecode, + encodingRules?: EncodingRules, ) { super( 'LibDummy', @@ -231,6 +232,7 @@ export class LibDummyContract extends BaseContract { txDefaults, logDecodeDependencies, deployedBytecode, + encodingRules, ); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); LibDummyContract.ABI().forEach((item, index) => { diff --git a/abi-gen/test-cli/output/typescript/test_lib_dummy.ts b/abi-gen/test-cli/output/typescript/test_lib_dummy.ts index 82f21bba0..0d7ff3646 100644 --- a/abi-gen/test-cli/output/typescript/test_lib_dummy.ts +++ b/abi-gen/test-cli/output/typescript/test_lib_dummy.ts @@ -27,7 +27,7 @@ import { TxAccessListWithGas, SupportedProvider, } from 'ethereum-types'; -import { BigNumber, classUtils, hexUtils, logUtils, providerUtils } from '@0x/utils'; +import { AbiEncoder, BigNumber, classUtils, EncodingRules, hexUtils, logUtils, providerUtils } from '@0x/utils'; import { EventCallback, IndexedFilterValues, SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; @@ -315,6 +315,7 @@ export class TestLibDummyContract extends BaseContract { txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }, deployedBytecode: string | undefined = TestLibDummyContract.deployedBytecode, + encodingRules?: EncodingRules, ) { super( 'TestLibDummy', @@ -324,6 +325,7 @@ export class TestLibDummyContract extends BaseContract { txDefaults, logDecodeDependencies, deployedBytecode, + encodingRules, ); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); TestLibDummyContract.ABI().forEach((item, index) => { diff --git a/utils/CHANGELOG.json b/utils/CHANGELOG.json index f60d9a2ae..8a03a770a 100644 --- a/utils/CHANGELOG.json +++ b/utils/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "version": "6.4.2", + "changes": [ + { + "note": "Export `EncodingRules` and `DecodingRules` at the root level", + "pr": 37 + } + ] + }, { "version": "6.4.1", "changes": [ diff --git a/utils/src/index.ts b/utils/src/index.ts index f836cf9ac..41d01f0f1 100644 --- a/utils/src/index.ts +++ b/utils/src/index.ts @@ -15,6 +15,7 @@ export { fetchAsync } from './fetch_async'; export { signTypedDataUtils } from './sign_typed_data_utils'; export { hexUtils } from './hex_utils'; export import AbiEncoder = require('./abi_encoder'); +export { EncodingRules, DecodingRules } from './abi_encoder'; export * from './types'; export { generatePseudoRandom256BitNumber } from './random'; export {