Skip to content

Commit

Permalink
Merge branch 'develop' into feat/new-counter-over-the-fox
Browse files Browse the repository at this point in the history
  • Loading branch information
matteoscurati authored Jun 6, 2024
2 parents 5e262cf + 7331a8a commit 2f4d365
Show file tree
Hide file tree
Showing 251 changed files with 37,618 additions and 7,774 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/check-attributions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Check Attributions

on:
push:
branches: Version-v*
pull_request:
branches: Version-v*
types:
- opened
- reopened
- synchronize
- ready_for_review

jobs:
check-attributions:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- run: corepack enable
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Install dependencies from cache
run: yarn --immutable
- name: Check attributions changes
run: yarn attributions:check
168 changes: 168 additions & 0 deletions .github/workflows/update-attributions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
name: Update Attibutions

on:
issue_comment:
types: created

jobs:
react-to-comment:
name: React to the comment
runs-on: ubuntu-latest
if: ${{ github.event.issue.pull_request && startsWith(github.event.comment.body, '@metamaskbot update-attributions') }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: React to the comment
run: |
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"/repos/${REPO}/issues/comments/${COMMENT_ID}/reactions" \
-f content='+1'
env:
COMMENT_ID: ${{ github.event.comment.id }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}

prepare:
name: Prepare dependencies
runs-on: ubuntu-latest
if: ${{ github.event.issue.pull_request && startsWith(github.event.comment.body, '@metamaskbot update-attributions') }}
outputs:
COMMIT_SHA: ${{ steps.commit-sha.outputs.COMMIT_SHA }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Checkout pull request
run: gh pr checkout "${PR_NUMBER}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.issue.number }}
- run: corepack enable
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Install Yarn dependencies
run: yarn --immutable
- name: Get commit SHA
id: commit-sha
run: echo "COMMIT_SHA=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"

update-attributions:
name: Update Attributions
runs-on: ubuntu-latest
needs:
- prepare
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Checkout pull request
run: gh pr checkout "${PR_NUMBER}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.issue.number }}
- run: corepack enable
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Install dependencies from cache
run: yarn --immutable --immutable-cache
- name: Generate Atributions
run: yarn attributions:generate
- name: Cache attributions file
uses: actions/cache/save@v3
with:
path: attribution.txt
key: cache-build-${{ needs.prepare.outputs.COMMIT_SHA }}

commit-updated-attributions:
name: Commit the updated Attributions
runs-on: ubuntu-latest
needs:
- prepare
- update-attributions
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
# Use PAT to ensure that the commit later can trigger status check workflows
token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout pull request
run: gh pr checkout "${PR_NUMBER}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.issue.number }}
- name: Get commit SHA
id: commit-sha
run: echo "COMMIT_SHA=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
- name: Restore attributions file
uses: actions/cache/restore@v3
with:
path: attribution.txt
key: cache-build-${{ needs.prepare.outputs.COMMIT_SHA }}
fail-on-cache-miss: true
- name: Check whether there are attributions changes
id: attributions-changes
run: |
if git diff --exit-code
then
echo "HAS_CHANGES=false" >> "$GITHUB_OUTPUT"
else
echo "HAS_CHANGES=true" >> "$GITHUB_OUTPUT"
fi
- name: Commit the updated attributions
if: steps.attributions-changes.outputs.HAS_CHANGES == 'true'
run: |
git config --global user.name 'MetaMask Bot'
git config --global user.email 'metamaskbot@users.noreply.github.com'
git commit -am "Update Attributions"
git push
- name: Post comment
run: |
if [[ $HAS_CHANGES == 'true' ]]
then
gh pr comment "${PR_NUMBER}" --body 'Attributions updated'
else
gh pr comment "${PR_NUMBER}" --body 'No attributions changes'
fi
env:
HAS_CHANGES: ${{ steps.attributions-changes.outputs.HAS_CHANGES }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.issue.number }}

check-status:
name: Check whether the attributions update succeeded
runs-on: ubuntu-latest
needs:
- commit-updated-attributions
outputs:
PASSED: ${{ steps.set-output.outputs.PASSED }}
steps:
- name: Set PASSED output
id: set-output
run: echo "PASSED=true" >> "$GITHUB_OUTPUT"

failure-comment:
name: Comment about the attributions update failure
runs-on: ubuntu-latest
needs:
- check-status
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Post comment if the update failed
run: |
passed="${{ needs.check-status.outputs.PASSED }}"
if [[ $passed != "true" ]]; then
gh pr comment "${PR_NUMBER}" --body "Attributions update failed. You can [review the logs or retry the attributions update here](${ACTION_RUN_URL})"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.issue.number }}
ACTION_RUN_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ test-results/
!.yarn/plugins
!.yarn/sdks
!.yarn/versions
**/.yarn/*

# MMI Playwright
public/playwright
Expand All @@ -70,3 +71,6 @@ test/e2e/mmi/specs/**/*-darwin.png
test/e2e/mmi/dist/

lavamoat/**/policy-debug.json

# Attributions
licenseInfos.json
24 changes: 22 additions & 2 deletions .storybook/test-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,28 @@ const state = {
isEns: true,
},
],
contractExchangeRates: {
'0xaD6D458402F60fD3Bd25163575031ACDce07538D': 0,
marketData: {
'0xaa36a7': {
'0xaD6D458402F60fD3Bd25163575031ACDce07538D': {
price: 0,
contractPercentChange1d: 0.004,
priceChange1d: 0.00004,
},
},
'0x1': {
'0xaD6D458402F60fD3Bd25163575031ACDce07538D': {
price: 0,
contractPercentChange1d: 0.004,
priceChange1d: 0.00004,
},
},
'0x5': {
'0xaD6D458402F60fD3Bd25163575031ACDce07538D': {
price: 0,
contractPercentChange1d: 0.004,
priceChange1d: 0.00004,
},
},
},
tokens: [
{
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/dist/chunk-Z6TBQQE5.js b/dist/chunk-Z6TBQQE5.js
index 2f1b66f2c39794d660553bbdc395697775f90e1d..18d7d5620d827419100c75736f6ec809161da212 100644
--- a/dist/chunk-Z6TBQQE5.js
+++ b/dist/chunk-Z6TBQQE5.js
@@ -295,7 +295,7 @@ var CodefiTokenPricesServiceV2 = class {
(obj, tokenAddress) => {
const lowercasedTokenAddress = tokenAddress.toLowerCase();
const marketData = addressCryptoDataMap[lowercasedTokenAddress];
- if (marketData === void 0) {
+ if (!marketData) {
return obj;
}
const { price } = marketData;
40 changes: 0 additions & 40 deletions .yarn/patches/@metamask-assets-controllers-patch-0f46262fea.patch

This file was deleted.

57 changes: 0 additions & 57 deletions .yarn/patches/@metamask-assets-controllers-patch-7616cc1669.patch

This file was deleted.

2 changes: 1 addition & 1 deletion .yarn/plugins/@yarnpkg/plugin-allow-scripts.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module.exports = {
name: "@yarnpkg/plugin-allow-scripts",
factory: function (require) {
var plugin=(()=>{var a=Object.create,l=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var p=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty;var u=e=>l(e,"__esModule",{value:!0});var f=e=>{if(typeof require!="undefined")return require(e);throw new Error('Dynamic require of "'+e+'" is not supported')};var g=(e,o)=>{for(var r in o)l(e,r,{get:o[r],enumerable:!0})},m=(e,o,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of s(o))!c.call(e,t)&&t!=="default"&&l(e,t,{get:()=>o[t],enumerable:!(r=i(o,t))||r.enumerable});return e},x=e=>m(u(l(e!=null?a(p(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var k={};g(k,{default:()=>d});var n=x(f("@yarnpkg/shell")),y={hooks:{afterAllInstalled:async()=>{let e=await(0,n.execute)("yarn run allow-scripts");e!==0&&process.exit(e)}}},d=y;return k;})();
var plugin=(()=>{var a=Object.create,l=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var p=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty;var u=e=>l(e,"__esModule",{value:!0});var f=e=>{if(typeof require!="undefined")return require(e);throw new Error('Dynamic require of "'+e+'" is not supported')};var g=(e,o)=>{for(var r in o)l(e,r,{get:o[r],enumerable:!0})},m=(e,o,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of s(o))!c.call(e,t)&&t!=="default"&&l(e,t,{get:()=>o[t],enumerable:!(r=i(o,t))||r.enumerable});return e},x=e=>m(u(l(e!=null?a(p(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var k={};g(k,{default:()=>d});var n=x(f("@yarnpkg/shell")),y={hooks:{afterAllInstalled:async()=>{let e=await(0,n.execute)("yarn exec allow-scripts");e!==0&&process.exit(e)}}},d=y;return k;})();
return plugin;
}
};
Loading

0 comments on commit 2f4d365

Please sign in to comment.