Skip to content

Commit

Permalink
Merge pull request #322 from ERC725Alliance/develop
Browse files Browse the repository at this point in the history
sync main
  • Loading branch information
CallumGrindle authored Oct 18, 2023
2 parents e4c09c7 + 9f1b5fd commit d9e647c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
17 changes: 10 additions & 7 deletions src/constants/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,25 @@
along with @erc725/erc725.js. If not, see <http://www.gnu.org/licenses/>.
*/

// from @lukso/lsp-smart-contracts v0.10.2, erc725.js should stay independent
export const INTERFACE_IDS_0_10_2 = {
// from @lukso/lsp-smart-contracts v0.12.0, erc725.js should stay independent
export const INTERFACE_IDS_0_12_0 = {
ERC1271: '0x1626ba7e',
ERC725X: '0x7545acac',
ERC725Y: '0x629aa694',
LSP0ERC725Account: '0x3e89ad98',
LSP0ERC725Account: '0x24871b3d',
LSP1UniversalReceiver: '0x6bb56a14',
LSP6KeyManager: '0x38bb3cdb',
LSP7DigitalAsset: '0xda1f85e4',
LSP8IdentifiableDigitalAsset: '0x622e7a01',
LSP1UniversalReceiverDelegate: '0xa245bbda',
LSP6KeyManager: '0x23f34c62',
LSP7DigitalAsset: '0x05519512',
LSP8IdentifiableDigitalAsset: '0x1ae9ba1f',
LSP9Vault: '0x28af17e6',
LSP11BasicSocialRecovery: '0x049a28f1',
LSP14Ownable2Step: '0x94be5999',
LSP17Extendable: '0xa918fa6b',
LSP17Extension: '0xcee78b40',
LSP20CallVerification: '0x1a0eb6a5',
LSP20CallVerifier: '0x480c0ec2',
LSP20CallVerifier: '0x0d6ecac7',
LSP25ExecuteRelayCall: '0x5ac79908',
};

export interface AddressProviderOptions {
Expand Down
4 changes: 2 additions & 2 deletions src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import {
SUPPORTED_HASH_FUNCTION_STRINGS,
} from './constants/constants';
import { decodeKey } from './lib/decodeData';
import { INTERFACE_IDS_0_10_2 } from './constants/interfaces';
import { INTERFACE_IDS_0_12_0 } from './constants/interfaces';

const address = '0x0c03fba782b07bcf810deb3b7f0595024a444f4e';

Expand Down Expand Up @@ -1392,7 +1392,7 @@ describe('supportsInterface', () => {
chaiAssert.typeOf(erc725Instance.supportsInterface, 'function');
});

const interfaceId = INTERFACE_IDS_0_10_2.LSP1UniversalReceiver;
const interfaceId = INTERFACE_IDS_0_12_0.LSP1UniversalReceiver;
const rpcUrl = 'https://my.test.provider';
const contractAddress = '0xcafecafecafecafecafecafecafecafecafecafe';

Expand Down
6 changes: 3 additions & 3 deletions src/lib/detector.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import { expect } from 'chai';
import * as sinon from 'sinon';
import { INTERFACE_IDS_0_10_2 } from '../constants/interfaces';
import { INTERFACE_IDS_0_12_0 } from '../constants/interfaces';

import { supportsInterface, checkPermissions } from './detector';

Expand All @@ -34,7 +34,7 @@ describe('supportsInterface', () => {
const providerStub = { supportsInterface: sinon.stub() };

providerStub.supportsInterface
.withArgs(contractAddress, INTERFACE_IDS_0_10_2[interfaceName])
.withArgs(contractAddress, INTERFACE_IDS_0_12_0[interfaceName])
.returns(Promise.resolve(true));

const doesSupportInterface = await supportsInterface(interfaceName, {
Expand All @@ -47,7 +47,7 @@ describe('supportsInterface', () => {

it('it should return true if the contract supports the interface with interfaceId', async () => {
const contractAddress = '0xcafecafecafecafecafecafecafecafecafecafe';
const interfaceId = INTERFACE_IDS_0_10_2.LSP1UniversalReceiver;
const interfaceId = INTERFACE_IDS_0_12_0.LSP1UniversalReceiver;

const providerStub = { supportsInterface: sinon.stub() };

Expand Down
6 changes: 3 additions & 3 deletions src/lib/detector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { LSP6_DEFAULT_PERMISSIONS } from '../constants/constants';

import {
AddressProviderOptions,
INTERFACE_IDS_0_10_2,
INTERFACE_IDS_0_12_0,
} from '../constants/interfaces';

/**
Expand All @@ -41,8 +41,8 @@ export const supportsInterface = async (
options: AddressProviderOptions,
): Promise<boolean> => {
let plainInterfaceId: string;
if (INTERFACE_IDS_0_10_2[interfaceIdOrName]) {
plainInterfaceId = INTERFACE_IDS_0_10_2[interfaceIdOrName];
if (INTERFACE_IDS_0_12_0[interfaceIdOrName]) {
plainInterfaceId = INTERFACE_IDS_0_12_0[interfaceIdOrName];
} else {
plainInterfaceId = interfaceIdOrName;
}
Expand Down

0 comments on commit d9e647c

Please sign in to comment.