diff --git a/.github/workflows/aws-prod.yaml b/.github/workflows/aws-prod.yaml index 5ea3719..b33c772 100644 --- a/.github/workflows/aws-prod.yaml +++ b/.github/workflows/aws-prod.yaml @@ -16,10 +16,10 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 + uses: aws-actions/configure-aws-credentials@v1-node16 with: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 28670e4..9dea42d 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -13,7 +13,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Start and test chainlog containers id: start-containers diff --git a/index.html b/index.html index 5d6c070..1f17b55 100644 --- a/index.html +++ b/index.html @@ -365,6 +365,34 @@ } }); formatsDiv.append(bash); + const solidity = document.createElement("button"); + solidity.setAttribute("class", "copy"); + solidity.setAttribute("name", "Solidity"); + solidity.innerHTML = "Solidity"; + solidity.style.marginLeft = "5px"; + solidity.addEventListener("click", () => { + solidity.innerHTML = "loading…"; + solidity.setAttribute("disabled", true); + const header = "contract Addresses {\n\n mapping (bytes32 => address) public addr;\n\n constructor() public {\n"; + const footer = " }\n}"; + let text = ""; + for (let i = 0; i < data.length; i += 64) { + const keyHex = data.substring(i, i + 64); + getAddress(keyHex, address => { + const key = hex2a(keyHex); + const space = " ".repeat(40 - key.length); + const statement = ` addr["${key}"]${space}= ${address};\n`; + text += statement; + if (text.match(/addr/g).length === data.length / 64) { + navigator.clipboard.writeText(header + text + footer); + uncopy(); + solidity.innerHTML = "copied"; + solidity.removeAttribute("disabled"); + } + }); + } + }); + formatsDiv.append(solidity); canvas.append(formatsDiv); const table = document.createElement("table"); const header = document.createElement("tr");