From 73f34818fe152c3ab5299177adc0eddfed6886c5 Mon Sep 17 00:00:00 2001 From: Yamen Merhi Date: Tue, 15 Aug 2023 12:03:53 +0300 Subject: [PATCH 1/6] refactor!: change LSP3 to SupportedStandards:LSP3Profile (#307) * refactor!: change LSP3 to SupportedStandards:LSP3Profile * test: update tests to reference SupportedStandards:LSP3Profile * chore: update examples to reference SupportedStandards:LSP3Profile * docs: change LSP3 to SupportedStandards:LSP3Profile --- README.md | 22 ++++++------ docs/classes/ERC725.md | 16 ++++----- docs/getting-started.md | 14 ++++---- docs/schemas.md | 4 +-- examples/src/fetchData.js | 4 +-- examples/src/instantiation.js | 6 ++-- ...Metadata.json => LSP3ProfileMetadata.json} | 6 ++-- src/index.test.ts | 18 +++++----- src/lib/encodeKeyName.test.ts | 4 +-- src/lib/schemaParser.test.ts | 8 ++--- src/lib/utils.test.ts | 2 +- src/schemas/index.ts | 4 +-- test/mockSchema.ts | 34 +++++++++---------- 13 files changed, 71 insertions(+), 71 deletions(-) rename schemas/{LSP3UniversalProfileMetadata.json => LSP3ProfileMetadata.json} (90%) diff --git a/README.md b/README.md index 4479d2d8..f3b7a5a3 100644 --- a/README.md +++ b/README.md @@ -44,14 +44,14 @@ If you install it on the backend side, you may need to also install [`isomorphic import { ERC725 } from '@erc725/erc725.js'; import Web3 from 'web3'; -// Part of LSP3-UniversalProfile Schema -// https://github.com/lukso-network/LIPs/blob/master/LSPs/LSP-3-UniversalProfile.md +// Part of LSP3-Profile Schema +// https://github.com/lukso-network/LIPs/blob/master/LSPs/LSP-3-Profile-Metadata.md const schema = [ { - name: 'SupportedStandards:LSP3UniversalProfile', - key: '0xeafec4d89fa9619884b60000abe425d64acd861a49b8ddf5c0b6962110481f38', + name: 'SupportedStandards:LSP3Profile', + key: '0xeafec4d89fa9619884b600005ef83ad9559033e6e941db7d7c495acdce616347', keyType: 'Mapping', - valueContent: '0xabe425d6', + valueContent: '0x5ef83ad9', valueType: 'bytes', }, { @@ -89,9 +89,9 @@ await myErc725.getData(); /** [ { - name: 'SupportedStandards:LSP3UniversalProfile', - key: '0xeafec4d89fa9619884b60000abe425d64acd861a49b8ddf5c0b6962110481f38', - value: '0xabe425d6', + name: 'SupportedStandards:LSP3Profile', + key: '0xeafec4d89fa9619884b600005ef83ad9559033e6e941db7d7c495acdce616347', + value: '0x5ef83ad9', }, { name: 'LSP1UniversalReceiverDelegate', @@ -130,9 +130,9 @@ await myErc725.fetchData(); /** [ { - name: 'SupportedStandards:LSP3UniversalProfile', - key: '0xeafec4d89fa9619884b60000abe425d64acd861a49b8ddf5c0b6962110481f38', - value: '0xabe425d6' + name: 'SupportedStandards:LSP3Profile', + key: '0xeafec4d89fa9619884b600005ef83ad9559033e6e941db7d7c495acdce616347', + value: '0x5ef83ad9' }, { name: 'LSP3Profile', diff --git a/docs/classes/ERC725.md b/docs/classes/ERC725.md index a114880d..8883f2b2 100644 --- a/docs/classes/ERC725.md +++ b/docs/classes/ERC725.md @@ -643,8 +643,8 @@ The hash must be retrievable from the ERC725Y contract via the [getData](#getdat ERC725.encodeKeyName('LSP3Profile'); // '0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5' -ERC725.encodeKeyName('SupportedStandards:LSP3UniversalProfile'); -// '0xeafec4d89fa9619884b60000abe425d64acd861a49b8ddf5c0b6962110481f38' +ERC725.encodeKeyName('SupportedStandards:LSP3Profile'); +// '0xeafec4d89fa9619884b600005ef83ad9559033e6e941db7d7c495acdce616347' ERC725.encodeKeyName( 'AddressPermissions:Permissions:cafecafecafecafecafecafecafecafecafecafe', @@ -883,9 +883,9 @@ await myErc725.fetchData(); /** [ { - name: 'SupportedStandards:LSP3UniversalProfile', - key: '0xeafec4d89fa9619884b60000abe425d64acd861a49b8ddf5c0b6962110481f38', - value: '0xabe425d6' + name: 'SupportedStandards:LSP3Profile', + key: '0xeafec4d89fa9619884b600005ef83ad9559033e6e941db7d7c495acdce616347', + value: '0x5ef83ad9' }, { name: 'LSP3Profile', @@ -1032,9 +1032,9 @@ await myErc725.getData(); /** [ { - name: 'SupportedStandards:LSP3UniversalProfile', - key: '0xeafec4d89fa9619884b60000abe425d64acd861a49b8ddf5c0b6962110481f38', - value: '0xabe425d6', + name: 'SupportedStandards:LSP3Profile', + key: '0xeafec4d89fa9619884b600005ef83ad9559033e6e941db7d7c495acdce616347', + value: '0x5ef83ad9', }, { name: 'LSP1UniversalReceiverDelegate', diff --git a/docs/getting-started.md b/docs/getting-started.md index 063942bd..82261470 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -35,11 +35,11 @@ import Web3 from 'web3'; // https://github.com/lukso-network/LIPs/blob/master/LSPs/LSP-3-UniversalProfile.md const schemas = [ { - name: 'SupportedStandards:LSP3UniversalProfile', - key: '0xeafec4d89fa9619884b60000abe425d64acd861a49b8ddf5c0b6962110481f38', + name: 'SupportedStandards:LSP3Profile', + key: '0xeafec4d89fa9619884b600005ef83ad9559033e6e941db7d7c495acdce616347', keyType: 'Mapping', valueType: 'bytes', - valueContent: '0xabe425d6', + valueContent: '0x5ef83ad9', }, { name: 'LSP3Profile', @@ -72,16 +72,16 @@ const erc725 = new ERC725(schemas, address, RPC_URL, config); await erc725.getOwner(); // > '0x28D25E70819140daF65b724158D00c373D1a18ee' -await erc725.getData('SupportedStandards:LSP3UniversalProfile'); +await erc725.getData('SupportedStandards:LSP3Profile'); /** { - 'SupportedStandards:LSP3UniversalProfile': '0xabe425d6' + 'SupportedStandards:LSP3Profile': '0x5ef83ad9' } */ await erc725.getData([ 'LSP3Profile', - 'SupportedStandards:LSP3UniversalProfile', + 'SupportedStandards:LSP3Profile', ]); /** { @@ -90,7 +90,7 @@ await erc725.getData([ hash: '0xb4f9d72e83bbe7e250ed9ec80332c493b7b3d73e0d72f7b2c7ab01c39216eb1a', hashFunction: 'keccak256(utf8)' }, - 'SupportedStandards:LSP3UniversalProfile': '0xabe425d6' + 'SupportedStandards:LSP3Profile': '0x5ef83ad9' } */ diff --git a/docs/schemas.md b/docs/schemas.md index b8fb1c38..91549769 100644 --- a/docs/schemas.md +++ b/docs/schemas.md @@ -26,7 +26,7 @@ Current provided LSPs are: ``` LSP1UniversalReceiverDelegate.json -LSP3UniversalProfileMetadata.json +LSP3ProfileMetadata.json LSP4DigitalAssetLegacy.json LSP4DigitalAsset.json LSP5ReceivedAssets.json @@ -39,7 +39,7 @@ LSP12IssuedAssets.json You can import them from: ```js -import LSP3 from '@erc725/erc725.js/schemas/LSP3UniversalProfileMetadata.json'; +import LSP3 from '@erc725/erc725.js/schemas/LSP3ProfileMetadata.json'; import LSP5 from '@erc725/erc725.js/schemas/LSP5ReceivedAssets.json'; // ... diff --git a/examples/src/fetchData.js b/examples/src/fetchData.js index 17083f22..64b5e605 100644 --- a/examples/src/fetchData.js +++ b/examples/src/fetchData.js @@ -8,8 +8,8 @@ const dataAllKeys = await myERC725.fetchData(); /** [ { - key: '0xeafec4d89fa9619884b60000abe425d64acd861a49b8ddf5c0b6962110481f38', - name: 'SupportedStandards:LSP3UniversalProfile', + key: '0xeafec4d89fa9619884b600005ef83ad9559033e6e941db7d7c495acdce616347', + name: 'SupportedStandards:LSP3Profile', value: false }, { diff --git a/examples/src/instantiation.js b/examples/src/instantiation.js index 16d9374b..cdaab9b2 100644 --- a/examples/src/instantiation.js +++ b/examples/src/instantiation.js @@ -11,10 +11,10 @@ const IPFS_GATEWAY = 'https://2eff.lukso.dev/ipfs/'; export function getInstance() { const schema = [ { - name: 'SupportedStandards:LSP3UniversalProfile', - key: '0xeafec4d89fa9619884b60000abe425d64acd861a49b8ddf5c0b6962110481f38', + name: 'SupportedStandards:LSP3Profile', + key: '0xeafec4d89fa9619884b600005ef83ad9559033e6e941db7d7c495acdce616347', keyType: 'Mapping', - valueContent: '0xabe425d6', + valueContent: '0x5ef83ad9', valueType: 'bytes', }, { diff --git a/schemas/LSP3UniversalProfileMetadata.json b/schemas/LSP3ProfileMetadata.json similarity index 90% rename from schemas/LSP3UniversalProfileMetadata.json rename to schemas/LSP3ProfileMetadata.json index 10dd9444..191dbd51 100644 --- a/schemas/LSP3UniversalProfileMetadata.json +++ b/schemas/LSP3ProfileMetadata.json @@ -1,10 +1,10 @@ [ { - "name": "SupportedStandards:LSP3UniversalProfile", - "key": "0xeafec4d89fa9619884b60000abe425d64acd861a49b8ddf5c0b6962110481f38", + "name": "SupportedStandards:LSP3Profile", + "key": "0xeafec4d89fa9619884b600005ef83ad9559033e6e941db7d7c495acdce616347", "keyType": "Mapping", "valueType": "bytes4", - "valueContent": "0xabe425d6" + "valueContent": "0x5ef83ad9" }, { "name": "LSP3Profile", diff --git a/src/index.test.ts b/src/index.test.ts index a0567e16..568d2dc5 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -446,9 +446,9 @@ describe('Running @erc725/erc725.js tests...', () => { '0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000141098603b193d276f5fa176cc02007b609f9dae6b000000000000000000000000', }, { - key: '0xeafec4d89fa9619884b60000abe425d64acd861a49b8ddf5c0b6962110481f38', // SupportedStandards:LSP3UniversalProfile + key: '0xeafec4d89fa9619884b600005ef83ad9559033e6e941db7d7c495acdce616347', // SupportedStandards:LSP3Profile value: - '0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000004abe425d600000000000000000000000000000000000000000000000000000000', + '0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000045ef83ad900000000000000000000000000000000000000000000000000000000', }, ], }, @@ -464,10 +464,10 @@ describe('Running @erc725/erc725.js tests...', () => { valueType: 'bytes', }, { - name: 'SupportedStandards:LSP3UniversalProfile', - key: '0xeafec4d89fa9619884b60000abe425d64acd861a49b8ddf5c0b6962110481f38', + name: 'SupportedStandards:LSP3Profile', + key: '0xeafec4d89fa9619884b600005ef83ad9559033e6e941db7d7c495acdce616347', keyType: 'Mapping', - valueContent: '0xabe425d6', + valueContent: '0x5ef83ad9', valueType: 'bytes', }, { @@ -488,7 +488,7 @@ describe('Running @erc725/erc725.js tests...', () => { keyName: 'LSP12IssuedAssetsMap:
', dynamicKeyParts: '0xb74a88C43BCf691bd7A851f6603cb1868f6fc147', }, - 'SupportedStandards:LSP3UniversalProfile', + 'SupportedStandards:LSP3Profile', ]); assert.deepStrictEqual(data, [ { @@ -502,9 +502,9 @@ describe('Running @erc725/erc725.js tests...', () => { value: '0x1098603B193d276f5fA176CC02007B609F9DAE6b', }, { - key: '0xeafec4d89fa9619884b60000abe425d64acd861a49b8ddf5c0b6962110481f38', - name: 'SupportedStandards:LSP3UniversalProfile', - value: '0xabe425d6', + key: '0xeafec4d89fa9619884b600005ef83ad9559033e6e941db7d7c495acdce616347', + name: 'SupportedStandards:LSP3Profile', + value: '0x5ef83ad9', }, ]); }); diff --git a/src/lib/encodeKeyName.test.ts b/src/lib/encodeKeyName.test.ts index b7bd4abc..31e44922 100644 --- a/src/lib/encodeKeyName.test.ts +++ b/src/lib/encodeKeyName.test.ts @@ -43,9 +43,9 @@ describe('encodeKeyName', () => { '0x3a47ab5bd3a594c3a8995f8fa58d0876c96819ca4516bd76100c92462f2f9dc0', }, { - keyName: 'SupportedStandards:LSP3UniversalProfile', + keyName: 'SupportedStandards:LSP3Profile', expectedKey: - '0xeafec4d89fa9619884b60000abe425d64acd861a49b8ddf5c0b6962110481f38', + '0xeafec4d89fa9619884b600005ef83ad9559033e6e941db7d7c495acdce616347', }, { keyName: 'MyCoolAddress:0xcafecafecafecafecafecafecafecafecafecafe', diff --git a/src/lib/schemaParser.test.ts b/src/lib/schemaParser.test.ts index 8731f547..287c12dc 100644 --- a/src/lib/schemaParser.test.ts +++ b/src/lib/schemaParser.test.ts @@ -83,14 +83,14 @@ describe('schemaParser getSchema', () => { describe('Mapping', () => { it('finds known mappings', () => { const schema = getSchema( - '0xeafec4d89fa9619884b60000abe425d64acd861a49b8ddf5c0b6962110481f38', + '0xeafec4d89fa9619884b600005ef83ad9559033e6e941db7d7c495acdce616347', ); assert.deepStrictEqual(schema, { - name: 'SupportedStandards:LSP3UniversalProfile', - key: '0xeafec4d89fa9619884b60000abe425d64acd861a49b8ddf5c0b6962110481f38', + name: 'SupportedStandards:LSP3Profile', + key: '0xeafec4d89fa9619884b600005ef83ad9559033e6e941db7d7c495acdce616347', keyType: 'Mapping', - valueContent: '0xabe425d6', + valueContent: '0x5ef83ad9', valueType: 'bytes4', }); }); diff --git a/src/lib/utils.test.ts b/src/lib/utils.test.ts index c951e626..3365d600 100644 --- a/src/lib/utils.test.ts +++ b/src/lib/utils.test.ts @@ -689,7 +689,7 @@ describe('utils', () => { }, { keyType: 'Mapping', - keyName: 'SupportedStandards:LSP3UniversalProfile', + keyName: 'SupportedStandards:LSP3Profile', }, { keyType: 'Mapping', diff --git a/src/schemas/index.ts b/src/schemas/index.ts index c014e32e..c533aa01 100644 --- a/src/schemas/index.ts +++ b/src/schemas/index.ts @@ -1,14 +1,14 @@ import { ERC725JSONSchema } from '../types/ERC725JSONSchema'; import LSP1UniversalReceiverDelegate from '../../schemas/LSP1UniversalReceiverDelegate.json'; -import LSP3UniversalProfile from '../../schemas/LSP3UniversalProfileMetadata.json'; +import LSP3Profile from '../../schemas/LSP3ProfileMetadata.json'; import LSP4DigitalAssetLegacy from '../../schemas/LSP4DigitalAssetLegacy.json'; import LSP4DigitalAsset from '../../schemas/LSP4DigitalAsset.json'; import LSP5ReceivedAssets from '../../schemas/LSP5ReceivedAssets.json'; import LSP6KeyManager from '../../schemas/LSP6KeyManager.json'; export default LSP1UniversalReceiverDelegate.concat( - LSP3UniversalProfile, + LSP3Profile, LSP4DigitalAssetLegacy, LSP4DigitalAsset, LSP5ReceivedAssets, diff --git a/test/mockSchema.ts b/test/mockSchema.ts index b6fc881e..f434d447 100644 --- a/test/mockSchema.ts +++ b/test/mockSchema.ts @@ -17,16 +17,16 @@ export const mockSchema: (ERC725JSONSchema & { })[] = [ // Case 1 { - name: 'SupportedStandards:LSP3UniversalProfile', - key: '0xeafec4d89fa9619884b60000abe425d64acd861a49b8ddf5c0b6962110481f38', + name: 'SupportedStandards:LSP3Profile', + key: '0xeafec4d89fa9619884b600005ef83ad9559033e6e941db7d7c495acdce616347', keyType: 'Mapping', - valueContent: '0xabe425d6', + valueContent: '0x5ef83ad9', valueType: 'bytes', // Testing data - returnRawData: abiCoder.encodeParameter('bytes', '0xabe425d6'), - returnRawDataArray: abiCoder.encodeParameter('bytes[]', ['0xabe425d6']), - returnGraphData: '0xabe425d6', - expectedResult: '0xabe425d6', + returnRawData: abiCoder.encodeParameter('bytes', '0x5ef83ad9'), + returnRawDataArray: abiCoder.encodeParameter('bytes[]', ['0x5ef83ad9']), + returnGraphData: '0x5ef83ad9', + expectedResult: '0x5ef83ad9', }, // Case 2 @@ -571,25 +571,25 @@ export const mockSchema: (ERC725JSONSchema & { name: 'MyCoolAddress:0xcafecafecafecafecafecafecafecafecafecafe', key: '0x22496f48a493035f0ab40000cafecafecafecafecafecafecafecafecafecafe', keyType: 'Mapping', - valueContent: '0xabe425d6', + valueContent: '0x5ef83ad9', valueType: 'bytes', // Testing data - returnRawData: abiCoder.encodeParameter('bytes', '0xabe425d6'), - returnRawDataArray: abiCoder.encodeParameter('bytes[]', ['0xabe425d6']), - returnGraphData: '0xabe425d6', - expectedResult: '0xabe425d6', + returnRawData: abiCoder.encodeParameter('bytes', '0x5ef83ad9'), + returnRawDataArray: abiCoder.encodeParameter('bytes[]', ['0x5ef83ad9']), + returnGraphData: '0x5ef83ad9', + expectedResult: '0x5ef83ad9', }, { name: 'AddressPermissions:Permissions:cafecafecafecafecafecafecafecafecafecafe', key: '0x4b80742de2bf82acb3630000cafecafecafecafecafecafecafecafecafecafe', keyType: 'MappingWithGrouping', - valueContent: '0xabe425d6', + valueContent: '0x5ef83ad9', valueType: 'bytes', // Testing data - returnRawData: abiCoder.encodeParameter('bytes', '0xabe425d6'), - returnRawDataArray: abiCoder.encodeParameter('bytes[]', ['0xabe425d6']), - returnGraphData: '0xabe425d6', - expectedResult: '0xabe425d6', + returnRawData: abiCoder.encodeParameter('bytes', '0x5ef83ad9'), + returnRawDataArray: abiCoder.encodeParameter('bytes[]', ['0x5ef83ad9']), + returnGraphData: '0x5ef83ad9', + expectedResult: '0x5ef83ad9', }, { name: 'Hello:
', From c2aef177abe2b2d8d9fa6a5105c65a3c7757364c Mon Sep 17 00:00:00 2001 From: CallumGrindle Date: Wed, 16 Aug 2023 11:54:55 +0200 Subject: [PATCH 2/6] ci: add release please workflow --- .github/workflows/release.yml | 88 +++++++++-------------------------- RELEASE.md | 79 ++++++++++++++++--------------- 2 files changed, 64 insertions(+), 103 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8c23b60c..05b2ba39 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,101 +1,59 @@ -# If it detects a version bump on main, it will trigger a release. -# If the workflow is started manually, it will skip the bump detection and attempt to publish. -name: Release and publish +name: Create GitHub release and publish to NPM on: - workflow_dispatch: push: branches: - 'main' +permissions: + contents: write + pull-requests: write + jobs: - release: + release-please: name: 📦 Create GitHub release and publish to NPM runs-on: ubuntu-latest - steps: - - name: Ensure main branch - if: github.ref != 'refs/heads/main' - run: |- - echo "Not running on main - exit" - exit 1 - - uses: actions/checkout@v2 + steps: + - uses: actions/checkout@v3 with: fetch-depth: 0 - - name: 🔍 Check if version changed - uses: EndBug/version-check@v1 - if: github.event_name == 'push' - id: check - - - name: 🔄 Check if should release - run: echo "SHOULD_RELEASE=${{ steps.check.outputs.changed == 'true' || github.event_name == 'workflow_dispatch' }}" >> $GITHUB_ENV - - name: ⚙️ Setup Node.js v16 uses: actions/setup-node@v2 - if: env.SHOULD_RELEASE == 'true' with: node-version: '16.x' registry-url: 'https://registry.npmjs.org' scope: '@erc725' cache: 'npm' - - name: 📝 Set Version - if: env.SHOULD_RELEASE == 'true' - run: |- - APP_VERSION="v$(node -pe "require('./package.json').version")" - echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV - - name: 🧰 Install - if: env.SHOULD_RELEASE == 'true' run: npm ci + - name: 💅 Lint + run: npm run lint + - name: 🎯 Test - if: env.SHOULD_RELEASE == 'true' run: npm test - name: 🛠 Build - if: env.SHOULD_RELEASE == 'true' run: npm run build - # We assume this will be always triggered by a merge from develop - # Therefore we tag the previous commit (the merge commit won't be on develop) - - name: 🏷 Create and push Git Tag - if: env.SHOULD_RELEASE == 'true' - run: |- - git config --global user.email "release@lukso.network" - git config --global user.name "LUKSO Bot" - git tag -a ${{ env.APP_VERSION }} HEAD~ -m "Release Version ${{ env.APP_VERSION }} [CI]" - git push --set-upstream origin tag ${{ env.APP_VERSION }} - - # Create GitHub Release - - name: 📝 Extract release notes from CHANGELOG - if: env.SHOULD_RELEASE == 'true' - id: extract-release-notes - uses: ffurrer2/extract-release-notes@v1 - with: - release_notes_file: RELEASENOTES.md - - - uses: jwalton/gh-find-current-pr@v1 - if: env.SHOULD_RELEASE == 'true' - id: findPR + - uses: google-github-actions/release-please-action@v3 + id: release with: - state: closed + release-type: node + package-name: '@erc725/erc725.js' + bump-minor-pre-major: true + default-branch: main - - name: Add PR body to Release Notes - if: env.SHOULD_RELEASE == 'true' - env: - PR_BODY: ${{ steps.findPR.outputs.body }} - run: |- - echo ${PR_BODY}|cat - RELEASENOTES.md > /tmp/out && mv /tmp/out RELEASENOTES.md + - name: 🔍 Check if version changed + uses: EndBug/version-check@v1 + if: github.event_name == 'push' + id: check - - name: 🚀 Create GitHub release - uses: ncipollo/release-action@v1 - if: env.SHOULD_RELEASE == 'true' - with: - bodyFile: 'RELEASENOTES.md' - token: ${{ secrets.GITHUB_TOKEN }} - tag: ${{ env.APP_VERSION }} + - name: 🔄 Check if should release + run: echo "SHOULD_RELEASE=${{ steps.check.outputs.changed == 'true' }}" >> $GITHUB_ENV - name: 📦 Publish to NPM if: env.SHOULD_RELEASE == 'true' diff --git a/RELEASE.md b/RELEASE.md index 4de47d7f..93b6a9c8 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,60 +1,63 @@ # Release Process -Releases are published to NPM when `develop` is merged into `main` AND when the merged code contains a version bump in the `package.json`. +Releases are published to npm using [Release Please](https://github.com/googleapis/release-please). -## Create and publish a new release: +This package automates CHANGELOG generation, version bumps and npm releases by parsing the +git history, looking for [Conventional Commit messages](https://www.conventionalcommits.org/). -### Bump version +When changes and feature PRs are merged from develop to main, `release-please` will open and maintain a release PR with the updated CHANGELOG and new version number. When this PR is merged, a release will be created and the package published to NPM. -You can manually trigger the [Bump version](https://github.com/ERC725Alliance/erc725.js/actions/workflows/bump-version.yml) workflow from the `develop` branch. +1. Merge develop into main. +2. Release Please will create the release PR going to main. +3. Merge the generated release PR. +4. Package will be published to NPM. -To bump locally: +## Conventional Commit prefixes? -1. Checkout to a new release branch from `develop`. -2. Bump version with [standard-version](https://github.com/conventional-changelog/standard-version). To create pre-release or specific versions, see below. +Commits should follow the [Conventional Commit messages standard](https://www.conventionalcommits.org/). -```bash -npm run release -``` -3. Push the changes to origin. A git tag is created by the release CI so do **not** push tags here. - -```bash -git push origin -``` +The following commit prefixes will result in changes in the CHANGELOG: -4. Open a PR from your release branch to `develop` and merge it. +- `fix:` which represents bug fixes, and correlates to a [SemVer](https://semver.org/) + patch. +- `feat:` which represents a new feature, and correlates to a minor version increase. + (indicated by the `!`) and will result in a SemVer major version increase. +- `feat!:`, or `fix!:`, `refactor!:`, etc., which represent a breaking change +- `build:` Changes that affect the build system or external dependencies. +- `ci:` Changes to our CI configuration files and scripts. +- `docs:` Documentation only changes. +- `perf:` A code change that improves performance. +- `refactor:` A code change that neither fixes a bug nor adds a feature. +- `style:` Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc). +- `test:` Adding missing tests or correcting existing tests. +- `chore:` Other -### Release +## Release with a custom version number -- Merge `develop` into `main` through a PR. -- The CI will create a GitHub release and publish to NPM. +When a commit to the main branch has `Release-As: x.x.x` (case insensitive) in the **commit body**, Release Please will open a new pull request for the specified version. -If it fails, you can manually trigger the workflow from the [Actions](https://github.com/ERC725Alliance/erc725.js/actions/workflows/release.yml) tab. +`git commit --allow-empty -m "chore: release 2.0.0" -m "Release-As: 2.0.0"` results in the following commit message: -## Specific Version Increases +```txt +chore: release 2.0.0 -To ignore the automatic version increase in favour of a custom version use the `--release-as` flag with the argument `major`, `minor` or `patch` or a specific version number: - -```bash -npm run release -- --release-as minor -# Or -npm run release -- --release-as 1.1.0 +Release-As: 2.0.0 ``` -## Prerelease versions +## How can I fix release notes? -To create a pre-release run: +If you have merged a pull request and would like to amend the commit message +used to generate the release notes for that commit, you can edit the body of +the merged pull requests and add a section like: -```bash -npm run release -- --prerelease ``` +BEGIN_COMMIT_OVERRIDE +feat: add ability to override merged commit message -If the lastest version is 1.0.0, the pre-release command will change the version to: `1.0.1-0` - -To name the pre-release, set the name by adding `--prerelease ` - -```bash -npm run release -- --prerelease alpha +fix: another message +chore: a third message +END_COMMIT_OVERRIDE ``` -If the latest version is 1.0.0 this will change the version to: `1.0.1-alpha.0` +The next time Release Please runs, it will use that override section as the +commit message instead of the merged commit message. From 527927812b1a05b13f8dc6b14aecaa6d24e98d61 Mon Sep 17 00:00:00 2001 From: Andreas Richter <708186+richtera@users.noreply.github.com> Date: Thu, 14 Sep 2023 09:17:10 -0400 Subject: [PATCH 3/6] fix: Remove hardcoded require --- src/index.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index 4a6c4940..2acbb8d1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -21,6 +21,7 @@ */ import { hexToNumber, isAddress, leftPad, toHex } from 'web3-utils'; +import HttpProvider from 'web3-providers-http'; import { ProviderWrapper } from './provider/providerWrapper'; @@ -62,9 +63,6 @@ import { getData } from './lib/getData'; import { supportsInterface, checkPermissions } from './lib/detector'; import { decodeMappingKey } from './lib/decodeMappingKey'; -/* eslint-disable-next-line */ -const HttpProvider = require('web3-providers-http'); - export { ERC725JSONSchema, ERC725JSONSchemaKeyType, From 1e8dbf765c6c5e250539b402e9bd5a395966a8c2 Mon Sep 17 00:00:00 2001 From: Jean Cvllr <31145285+CJ42@users.noreply.github.com> Date: Thu, 21 Sep 2023 23:17:03 +0100 Subject: [PATCH 4/6] feat: add schemas for LSP8 + LSP17 (#311) --- schemas/LSP17ContractExtension.json | 9 +++++++ schemas/LSP8IdentifiableDigitalAsset.json | 30 +++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 schemas/LSP17ContractExtension.json create mode 100644 schemas/LSP8IdentifiableDigitalAsset.json diff --git a/schemas/LSP17ContractExtension.json b/schemas/LSP17ContractExtension.json new file mode 100644 index 00000000..67ffa269 --- /dev/null +++ b/schemas/LSP17ContractExtension.json @@ -0,0 +1,9 @@ +[ + { + "name": "LSP17Extension:", + "key": "0xcee78b4094da860110960000", + "keyType": "Mapping", + "valueType": "address", + "valueContent": "Address" + } +] diff --git a/schemas/LSP8IdentifiableDigitalAsset.json b/schemas/LSP8IdentifiableDigitalAsset.json new file mode 100644 index 00000000..ee1c20e7 --- /dev/null +++ b/schemas/LSP8IdentifiableDigitalAsset.json @@ -0,0 +1,30 @@ +[ + { + "name": "LSP8TokenIdType", + "key": "0x715f248956de7ce65e94d9d836bfead479f7e70d69b718d47bfe7b00e05b4fe4", + "keyType": "Singleton", + "valueType": "uint256", + "valueContent": "Number" + }, + { + "name": "LSP8MetadataTokenURI:", + "key": "0x4690256ef7e93288012f0000", + "keyType": "Mapping", + "valueType": "(bytes4,string)", + "valueContent": "(Bytes4,URI)" + }, + { + "name": "LSP8TokenMetadataBaseURI", + "key": "0x1a7628600c3bac7101f53697f48df381ddc36b9015e7d7c9c5633d1252aa2843", + "keyType": "Singleton", + "valueType": "(bytes4,string)", + "valueContent": "(Bytes4,URI)" + }, + { + "name": "LSP8ReferenceContract", + "key": "0x708e7b881795f2e6b6c2752108c177ec89248458de3bf69d0d43480b3e5034e6", + "keyType": "Singleton", + "valueType": "(address,bytes32)", + "valueContent": "(Address,bytes32)" + } +] From 0d28b1317dc085078090a8babacf4db517d91a87 Mon Sep 17 00:00:00 2001 From: Jean Cvllr <31145285+CJ42@users.noreply.github.com> Date: Thu, 21 Sep 2023 23:19:13 +0100 Subject: [PATCH 5/6] fix: incorrect value in schema for array length in `...Map` (#310) --- schemas/LSP10ReceivedVaults.json | 2 +- schemas/LSP12IssuedAssets.json | 2 +- schemas/LSP3ProfileMetadata.json | 4 ++-- schemas/LSP4DigitalAsset.json | 2 +- schemas/LSP5ReceivedAssets.json | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/schemas/LSP10ReceivedVaults.json b/schemas/LSP10ReceivedVaults.json index 121ac6b6..2e6d5c9c 100644 --- a/schemas/LSP10ReceivedVaults.json +++ b/schemas/LSP10ReceivedVaults.json @@ -3,7 +3,7 @@ "name": "LSP10VaultsMap:
", "key": "0x192448c3c0f88c7f238c0000
", "keyType": "Mapping", - "valueType": "(bytes4,bytes8)", + "valueType": "(bytes4,uint128)", "valueContent": "(Bytes4,Number)" }, { diff --git a/schemas/LSP12IssuedAssets.json b/schemas/LSP12IssuedAssets.json index 1618adf6..a413f882 100644 --- a/schemas/LSP12IssuedAssets.json +++ b/schemas/LSP12IssuedAssets.json @@ -10,7 +10,7 @@ "name": "LSP12IssuedAssetsMap:
", "key": "0x74ac2555c10b9349e78f0000
", "keyType": "Mapping", - "valueType": "(bytes4,bytes8)", + "valueType": "(bytes4,uint128)", "valueContent": "(Bytes4,Number)" } ] diff --git a/schemas/LSP3ProfileMetadata.json b/schemas/LSP3ProfileMetadata.json index 191dbd51..1d048987 100644 --- a/schemas/LSP3ProfileMetadata.json +++ b/schemas/LSP3ProfileMetadata.json @@ -24,7 +24,7 @@ "name": "LSP12IssuedAssetsMap:
", "key": "0x74ac2555c10b9349e78f0000
", "keyType": "Mapping", - "valueType": "(bytes4,bytes8)", + "valueType": "(bytes4,uint128)", "valueContent": "(Bytes4,Number)" }, { @@ -38,7 +38,7 @@ "name": "LSP5ReceivedAssetsMap:
", "key": "0x812c4334633eb816c80d0000
", "keyType": "Mapping", - "valueType": "(bytes4,bytes8)", + "valueType": "(bytes4,uint128)", "valueContent": "(Bytes4,Number)" }, { diff --git a/schemas/LSP4DigitalAsset.json b/schemas/LSP4DigitalAsset.json index 862162b7..c57410b2 100644 --- a/schemas/LSP4DigitalAsset.json +++ b/schemas/LSP4DigitalAsset.json @@ -38,7 +38,7 @@ "name": "LSP4CreatorsMap:
", "key": "0x6de85eaf5d982b4e5da00000
", "keyType": "Mapping", - "valueType": "(bytes4,bytes8)", + "valueType": "(bytes4,uint128)", "valueContent": "(Bytes4,Number)" } ] diff --git a/schemas/LSP5ReceivedAssets.json b/schemas/LSP5ReceivedAssets.json index d77382f6..e2fa76b4 100644 --- a/schemas/LSP5ReceivedAssets.json +++ b/schemas/LSP5ReceivedAssets.json @@ -10,7 +10,7 @@ "name": "LSP5ReceivedAssetsMap:
", "key": "0x812c4334633eb816c80d0000
", "keyType": "Mapping", - "valueType": "(bytes4,bytes8)", + "valueType": "(bytes4,uint128)", "valueContent": "(Bytes4,Number)" } ] From 67c0b4f8df88b6ecae7dab342574c2d51281a124 Mon Sep 17 00:00:00 2001 From: Hugo Masclet Date: Tue, 26 Sep 2023 11:39:50 +0200 Subject: [PATCH 6/6] docs: update rpc from l16 to testnet --- docs/classes/ERC725.md | 7 ++++--- docs/getting-started.md | 9 +++------ docs/providers.md | 4 ++-- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/docs/classes/ERC725.md b/docs/classes/ERC725.md index 8883f2b2..bed34ec3 100644 --- a/docs/classes/ERC725.md +++ b/docs/classes/ERC725.md @@ -81,6 +81,7 @@ myErc725.checkPermissions(requiredPermissions, grantedPermissions); ``` --- + ## decodeData ```js @@ -1459,7 +1460,7 @@ myErc725.supportsInterface('0xfd4d5c50'); ERC725.supportsInterface('0xfd4d5c50', { address: '0xe408BDDbBAB1985006A2c481700DD473F932e5cB', - rpcUrl: 'https://rpc.l16.lukso.network', + rpcUrl: 'https://rpc.testnet.lukso.network', }); // false ``` @@ -1469,8 +1470,8 @@ myErc725.supportsInterface('LSP0ERC725Account'); // false ERC725.supportsInterface('LSP0ERC725Account', { - address: '0xe408BDDbBAB1985006A2c481700DD473F932e5cB', - rpcUrl: 'https://rpc.l16.lukso.network', + address: '0x0Dc07C77985fE31996Ed612F568eb441afe5768D', + rpcUrl: 'https://rpc.testnet.lukso.network', }); // true ``` diff --git a/docs/getting-started.md b/docs/getting-started.md index 82261470..cbe47702 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -57,8 +57,8 @@ const schemas = [ }, ]; -const address = '0x0c03fba782b07bcf810deb3b7f0595024a444f4e'; -const RPC_URL = 'https://rpc.l16.lukso.network'; +const address = '0x0Dc07C77985fE31996Ed612F568eb441afe5768D'; +const RPC_URL = 'https://rpc.testnet.lukso.network'; const config = { ipfsGateway: 'https://YOUR-IPFS-GATEWAY/ipfs/', }; @@ -79,10 +79,7 @@ await erc725.getData('SupportedStandards:LSP3Profile'); } */ -await erc725.getData([ - 'LSP3Profile', - 'SupportedStandards:LSP3Profile', -]); +await erc725.getData(['LSP3Profile', 'SupportedStandards:LSP3Profile']); /** { LSP3Profile: { diff --git a/docs/providers.md b/docs/providers.md index b9b29d1d..ec0b69e2 100644 --- a/docs/providers.md +++ b/docs/providers.md @@ -15,7 +15,7 @@ An RPC URL can be passed when instantiating the `ERC725` class. ```javascript import ERC725 from '@erc725/erc725.js'; -const RPC_URL = 'https://rpc.l16.lukso.network'; +const RPC_URL = 'https://rpc.testnet.lukso.network'; const erc725 = new ERC725([], '0x...', RPC_URL); ``` @@ -47,7 +47,7 @@ import Web3 from 'web3'; import ERC725 from '@erc725/erc725.js'; const web3provider = new Web3( - new Web3.providers.HttpProvider('https://rpc.l16.lukso.network'), + new Web3.providers.HttpProvider('https://rpc.testnet.lukso.network'), ); const erc725 = new ERC725([], '0x...', web3provider);