Skip to content

Commit

Permalink
refactor: use type from erc725.js
Browse files Browse the repository at this point in the history
  • Loading branch information
CJ42 committed Oct 23, 2023
1 parent 143ea7c commit 03b50dc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/lib/classes/lsp7-digital-asset.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { SUPPORTED_HASH_FUNCTION_HASHES } from '@erc725/erc725.js/build/main/src/constants/constants';
import { ERC725YDataKeys } from '@lukso/lsp-smart-contracts';
import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers';
import { providers } from 'ethers';
Expand All @@ -11,7 +12,6 @@ import {
} from '../../../build/main/src/index';
import { testDeployWithSpecifiedCreators } from '../../../test/digital-asset.utils';
import { lsp4DigitalAsset } from '../../../test/lsp4-digital-asset.mock';
import { JSONURL_KNOWN_HASH_FUNCTIONS } from '../helpers/config.helper';

import { ProxyDeployer } from './proxy-deployer';

Expand Down Expand Up @@ -232,7 +232,7 @@ describe('LSP7DigitalAsset', () => {

const data = await digitalAsset.getData(ERC725YDataKeys.LSP4.LSP4Metadata);

expect(data.startsWith(JSONURL_KNOWN_HASH_FUNCTIONS['keccak256(utf8)'])).toBe(true);
expect(data.startsWith(SUPPORTED_HASH_FUNCTION_HASHES.HASH_KECCAK256_UTF8)).toBe(true);
expect(data).toEqual(expectedLSP4Value);
});
it('should have correct name and symbol set', async () => {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/classes/lsp8-identifiable-digital-asset.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { SUPPORTED_HASH_FUNCTION_HASHES } from '@erc725/erc725.js/build/main/src/constants/constants';
import { ERC725YDataKeys, LSP8_TOKEN_ID_TYPES } from '@lukso/lsp-smart-contracts';
import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers';
import { providers } from 'ethers';
Expand All @@ -12,7 +13,6 @@ import {
} from '../../../build/main/src/index';
import { testDeployWithSpecifiedCreators } from '../../../test/digital-asset.utils';
import { lsp4DigitalAsset } from '../../../test/lsp4-digital-asset.mock';
import { JSONURL_KNOWN_HASH_FUNCTIONS } from '../helpers/config.helper';

import { ProxyDeployer } from './proxy-deployer';

Expand Down Expand Up @@ -295,7 +295,7 @@ describe('LSP8IdentifiableDigitalAsset', () => {

const data = await digitalAsset.getData(ERC725YDataKeys.LSP4.LSP4Metadata);

expect(data.startsWith(JSONURL_KNOWN_HASH_FUNCTIONS['keccak256(utf8)'])).toBe(true);
expect(data.startsWith(SUPPORTED_HASH_FUNCTION_HASHES.HASH_KECCAK256_UTF8)).toBe(true);
expect(data).toEqual(expectedLSP4Value);
});

Expand Down
6 changes: 4 additions & 2 deletions src/lib/classes/universal-profile.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ERC725 } from '@erc725/erc725.js';
import { SUPPORTED_HASH_FUNCTION_HASHES } from '@erc725/erc725.js/build/main/src/constants/constants';
import { ALL_PERMISSIONS, ERC725YDataKeys } from '@lukso/lsp-smart-contracts';
import KeyManagerContract from '@lukso/lsp-smart-contracts/artifacts/LSP6KeyManager.json';
import UniversalProfileContract from '@lukso/lsp-smart-contracts/artifacts/UniversalProfile.json';
Expand All @@ -19,7 +20,6 @@ import {
testUPDeployment,
} from '../../../test/test.utils';
import { UniversalProfile } from '../../../types/ethers-v5';
import { JSONURL_KNOWN_HASH_FUNCTIONS } from '../helpers/config.helper';
import { getDeployedByteCode } from '../helpers/deployment.helper';
import { ContractNames, DeployedUniversalProfileContracts, DeploymentEvent } from '../interfaces';

Expand Down Expand Up @@ -67,7 +67,9 @@ describe('UniversalProfile', () => {

const lsp3Data = await universalProfile.getData(ERC725YDataKeys.LSP3.LSP3Profile);

expect(lsp3Data.startsWith(JSONURL_KNOWN_HASH_FUNCTIONS['keccak256(utf8)'])).toBe(true);
expect(lsp3Data.startsWith(SUPPORTED_HASH_FUNCTION_HASHES.HASH_KECCAK256_UTF8)).toBe(
true
);
expect(lsp3Data).toEqual(expectedLSP3Value);
});
});
Expand Down
5 changes: 0 additions & 5 deletions src/lib/helpers/config.helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,5 @@ export const defaultUploadOptions: UploadOptions = {

export const DEFAULT_CONTRACT_VERSION = lspSmartContractsVersion;

// TODO: add this constant inside the `@lukso/lsp-smart-contracts` package
export const JSONURL_KNOWN_HASH_FUNCTIONS = {
'keccak256(utf8)': '0x6f357c6a',
};

export const GAS_PRICE = 10_000_000_000;
export const GAS_BUFFER = 100_000;

0 comments on commit 03b50dc

Please sign in to comment.