Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
jnicoulaud-ledger authored Dec 10, 2024
2 parents 76ddf61 + c54acf8 commit 1f5c22e
Show file tree
Hide file tree
Showing 70 changed files with 3,096 additions and 8,105 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
name: 🤖 format descriptors

on:
schedule:
- cron: '0 7 * * *'
workflow_dispatch:

permissions:
id-token: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
BRANCH: "master"

jobs:
format:
name: format descriptors
runs-on: public-ledgerhq-shared-small
timeout-minutes: 60
steps:

- name: Checkout
timeout-minutes: 10
uses: actions/checkout@v4

- name: Get date
timeout-minutes: 10
run: echo "CURRENT_DATE=$(date +"%Y-%m-%d %H:%M")" >> $GITHUB_ENV

- name: Setup python
timeout-minutes: 10
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'

- name: Login to Ledger JFrog
timeout-minutes: 10
uses: LedgerHQ/actions-security/actions/jfrog-login@actions/jfrog-login-1

- name: Setup pip
timeout-minutes: 10
run: jf pipc --global --repo-resolve=virtual-pypi-prod-green

- name: Install ERC-7730 library
timeout-minutes: 10
run: jf pip install erc7730

- name: Format ERC-7730 descriptors
timeout-minutes: 10
run: erc7730 format

- name: Check changes
id: changes
timeout-minutes: 10
shell: bash
run: |
[[ -n "$(git status -s)" ]] && echo "changes=true" >> $GITHUB_OUTPUT || true
- name: Open pull request
if: ${{ !cancelled() && steps.changes.outputs.changes == 'true' }}
timeout-minutes: 10
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.CI_BOT_TOKEN }}
author: ${{ secrets.CI_BOT_USERNAME }} <${{ secrets.CI_BOT_USERNAME }}@users.noreply.github.com>
branch: ${{ env.BRANCH }}-format-descriptors
base: ${{ env.BRANCH }}
delete-branch: false
commit-message: 'chore: format descriptors - ${{ env.CURRENT_DATE }}'
title: 'chore: format descriptors - ${{ env.CURRENT_DATE }}'
body: ${{ steps.submodules.outputs.prBody }}
draft: false
signoff: false
11 changes: 3 additions & 8 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
ETHERSCAN_API_HOST: etherscan.api.live.ledger.com

jobs:
validate_descriptors:
name: 🔎 validate descriptors
Expand All @@ -26,14 +29,6 @@ jobs:
timeout-minutes: 10
uses: actions/checkout@v4

- name: Get API keys
timeout-minutes: 10
shell: bash
run: |
cat << EOF | jq -r 'to_entries[] | select(.key|endswith("_API_KEY")) | "\(.key)=\(.value)"' >> "$GITHUB_ENV"
${{ toJSON(secrets) }}
EOF
- name: Setup python
timeout-minutes: 10
uses: actions/setup-python@v5
Expand Down
12 changes: 3 additions & 9 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
ETHERSCAN_API_HOST: proxyetherscan.api.live.ledger.com

jobs:
validate_descriptors:
name: 🔎 validate descriptors
Expand All @@ -29,15 +32,6 @@ jobs:
registry/**/eip712-*.json
registry/**/calldata-*.json
- name: Get API keys
timeout-minutes: 10
if: steps.changed-descriptor-files.outputs.any_changed == 'true'
shell: bash
run: |
cat << EOF | jq -r 'to_entries[] | select(.key|endswith("_API_KEY")) | "\(.key)=\(.value)"' >> "$GITHUB_ENV"
${{ toJSON(secrets) }}
EOF
- name: Setup python
timeout-minutes: 10
if: steps.changed-descriptor-files.outputs.any_changed == 'true'
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.vscode/
.idea/
.jfrog/
.lh/
174 changes: 61 additions & 113 deletions ercs/calldata-erc20-tokens.json
Original file line number Diff line number Diff line change
@@ -1,117 +1,65 @@
{
"$schema": "../specs/erc7730-v1.schema.json",
"context": {
"contract" : {
"abi": [
{
"constant": false,
"inputs": [
{
"name": "_spender",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_to",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}
]
"$schema": "../specs/erc7730-v1.schema.json",
"context": {
"contract": {
"abi": [
{
"constant": false,
"inputs": [{ "name": "_spender", "type": "address" }, { "name": "_value", "type": "uint256" }],
"name": "approve",
"outputs": [{ "name": "", "type": "bool" }],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [{ "name": "_to", "type": "address" }, { "name": "_value", "type": "uint256" }],
"name": "transfer",
"outputs": [{ "name": "", "type": "bool" }],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}
},

"display": {
"formats": {
"transfer(address,uint256)": {
"intent": "Send",
"fields": [
{
"path": "_to",
"label": "To",
"format": "addressName",
"params": {
"types": [
"eoa"
],
"sources": [
"local",
"ens"
]
}
},
{
"path": "_value",
"label": "Amount",
"format": "tokenAmount",
"params": {
"tokenPath": "$.context.contract.deployments.[0].address"
}
}
],
"required": ["_to", "_value"]
},
"approve(address,uint256)": {
"intent": "Approve",
"fields": [
{
"path": "_spender",
"label": "Spender",
"format": "addressName",
"params": {
"types": [
"eoa"
],
"sources": [
"local",
"ens"
]
}
},
{
"path": "_value",
"label": "Amount",
"format": "tokenAmount",
"params": {
"tokenPath": "$.context.contract.deployments.[0].address",
"threshold": "0x8000000000000000000000000000000000000000000000000000000000000000"
}
}
],
"required": ["_spender", "_value"]
]
}
},
"display": {
"formats": {
"transfer(address,uint256)": {
"intent": "Send",
"fields": [
{ "path": "_to", "label": "To", "format": "addressName", "params": { "types": ["eoa"], "sources": ["local", "ens"] } },
{
"path": "_value",
"label": "Amount",
"format": "tokenAmount",
"params": { "tokenPath": "$.context.contract.deployments.[0].address" }
}
],
"required": ["_to", "_value"]
},
"approve(address,uint256)": {
"intent": "Approve",
"fields": [
{
"path": "_spender",
"label": "Spender",
"format": "addressName",
"params": { "types": ["eoa"], "sources": ["local", "ens"] }
},
{
"path": "_value",
"label": "Amount",
"format": "tokenAmount",
"params": {
"tokenPath": "$.context.contract.deployments.[0].address",
"threshold": "0x8000000000000000000000000000000000000000000000000000000000000000"
}
}
}
],
"required": ["_spender", "_value"]
}
}
}
}
}
Loading

0 comments on commit 1f5c22e

Please sign in to comment.