Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sprint 53 #1205

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 109 additions & 0 deletions .github/actions/create-env-file/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Create_Env_File
description: Create .env file with secrets fetched from API for contracts or SDK

inputs:
api-access-token-1:
description: "API access token for the first API call"
required: true
api-access-token-2:
description: "API access token for the second API call"
required: false
module:
description: "Whether to create .env file for contracts or SDK"
required: true
default: "contracts"

runs:
using: "composite"
steps:
- name: Create .env file for contracts
if: ${{ inputs.module == 'contracts' }}
shell: sh
run: |
# Making API call to fetch secrets
API_RESPONSE=$(curl -s -H "Authorization: Bearer ${{ inputs.api-access-token-1 }}" -H "User-Agent: AppName/1.2.3" https://portal.hedera.com/api/account)

# Extract account details
OPERATOR_PRIVATE_KEY=$(echo $API_RESPONSE | jq -r '.accounts[0].privateKey')
OPERATOR_PUBLIC_KEY=$(echo $API_RESPONSE | jq -r '.accounts[0].publicKey')
OPERATOR_ACCOUNT_NUM=$(echo $API_RESPONSE | jq -r '.accounts[0].accountNum')

NON_OPERATOR_PRIVATE_KEY=$(echo $API_RESPONSE | jq -r '.accounts[1].privateKey')
NON_OPERATOR_PUBLIC_KEY=$(echo $API_RESPONSE | jq -r '.accounts[1].publicKey')
NON_OPERATOR_ACCOUNT_NUM=$(echo $API_RESPONSE | jq -r '.accounts[1].accountNum')

# Write to .env file in a single block
cat <<EOF > .env
TESTNET_HEDERA_OPERATOR_PRIVATEKEY=$OPERATOR_PRIVATE_KEY
TESTNET_HEDERA_OPERATOR_PUBLICKEY=$OPERATOR_PUBLIC_KEY
TESTNET_HEDERA_OPERATOR_ED25519=true
TESTNET_HEDERA_OPERATOR_ACCOUNT=0.0.$OPERATOR_ACCOUNT_NUM
TESTNET_HEDERA_NON_OPERATOR_PRIVATEKEY=$NON_OPERATOR_PRIVATE_KEY
TESTNET_HEDERA_NON_OPERATOR_PUBLICKEY=$NON_OPERATOR_PUBLIC_KEY
TESTNET_HEDERA_NON_OPERATOR_ED25519=false
TESTNET_HEDERA_NON_OPERATOR_ACCOUNT=0.0.$NON_OPERATOR_ACCOUNT_NUM
EOF
working-directory: contracts

- name: Create .env file for SDK
if: ${{ inputs.module == 'sdk' }}
shell: sh
run: |
# Making API call to fetch secrets
API_RESPONSE_1=$(curl -s -H "Authorization: Bearer ${{ inputs.api-access-token-1 }}" -H "User-Agent: AppName/1.2.3" https://portal.hedera.com/api/account)
API_RESPONSE_2=$(curl -s -H "Authorization: Bearer ${{ inputs.api-access-token-2 }}" -H "User-Agent: AppName/1.2.3" https://portal.hedera.com/api/account)

# Extract account details from API_RESPONSE_1
CLIENT_PRIVATE_KEY_ECDSA=$(echo $API_RESPONSE_1 | jq -r '.accounts[1].privateKey')
CLIENT_PUBLIC_KEY_ECDSA=$(echo $API_RESPONSE_1 | jq -r '.accounts[1].publicKey')
CLIENT_ACCOUNT_ID_ECDSA=$(echo $API_RESPONSE_1 | jq -r '.accounts[1].accountNum')
CLIENT_PRIVATE_KEY_ED25519=$(echo $API_RESPONSE_1 | jq -r '.accounts[0].privateKey')
CLIENT_PUBLIC_KEY_ED25519=$(echo $API_RESPONSE_1 | jq -r '.accounts[0].publicKey')
CLIENT_ACCOUNT_ID_ED25519=$(echo $API_RESPONSE_1 | jq -r '.accounts[0].accountNum')

# Extract account details from API_RESPONSE_2
CLIENT_PRIVATE_KEY_ECDSA_2=$(echo $API_RESPONSE_2 | jq -r '.accounts[1].privateKey')
CLIENT_PUBLIC_KEY_ECDSA_2=$(echo $API_RESPONSE_2 | jq -r '.accounts[1].publicKey')
CLIENT_ACCOUNT_ID_ECDSA_2=$(echo $API_RESPONSE_2 | jq -r '.accounts[1].accountNum')
CLIENT_PRIVATE_KEY_ED25519_2=$(echo $API_RESPONSE_2 | jq -r '.accounts[0].privateKey')
CLIENT_PUBLIC_KEY_ED25519_2=$(echo $API_RESPONSE_2 | jq -r '.accounts[0].publicKey')
CLIENT_ACCOUNT_ID_ED25519_2=$(echo $API_RESPONSE_2 | jq -r '.accounts[0].accountNum')

# Fetch EVM addresses from Mirror Node API
CLIENT_EVM_ADDRESS_ECDSA=$(curl -s https://testnet.mirrornode.hedera.com/api/v1/accounts/0.0.$CLIENT_ACCOUNT_ID_ECDSA | jq -r '.evm_address')
CLIENT_EVM_ADDRESS_ED25519=$(curl -s https://testnet.mirrornode.hedera.com/api/v1/accounts/0.0.$CLIENT_ACCOUNT_ID_ED25519 | jq -r '.evm_address')
CLIENT_EVM_ADDRESS_ECDSA_2=$(curl -s https://testnet.mirrornode.hedera.com/api/v1/accounts/0.0.$CLIENT_ACCOUNT_ID_ECDSA_2 | jq -r '.evm_address')
CLIENT_EVM_ADDRESS_ED25519_2=$(curl -s https://testnet.mirrornode.hedera.com/api/v1/accounts/0.0.$CLIENT_ACCOUNT_ID_ED25519_2 | jq -r '.evm_address')

# Write to .env file
cat <<EOF > .env
CLIENT_PRIVATE_KEY_ECDSA=$CLIENT_PRIVATE_KEY_ECDSA
CLIENT_PUBLIC_KEY_ECDSA=$CLIENT_PUBLIC_KEY_ECDSA
CLIENT_ACCOUNT_ID_ECDSA=0.0.$CLIENT_ACCOUNT_ID_ECDSA
CLIENT_EVM_ADDRESS_ECDSA=$CLIENT_EVM_ADDRESS_ECDSA

CLIENT_PRIVATE_KEY_ED25519=$CLIENT_PRIVATE_KEY_ED25519
CLIENT_PUBLIC_KEY_ED25519=$CLIENT_PUBLIC_KEY_ED25519
CLIENT_ACCOUNT_ID_ED25519=0.0.$CLIENT_ACCOUNT_ID_ED25519
CLIENT_EVM_ADDRESS_ED25519=$CLIENT_EVM_ADDRESS_ED25519

CLIENT_PRIVATE_KEY_ECDSA_2=$CLIENT_PRIVATE_KEY_ECDSA_2
CLIENT_PUBLIC_KEY_ECDSA_2=$CLIENT_PUBLIC_KEY_ECDSA_2
CLIENT_ACCOUNT_ID_ECDSA_2=0.0.$CLIENT_ACCOUNT_ID_ECDSA_2
CLIENT_EVM_ADDRESS_ECDSA_2=$CLIENT_EVM_ADDRESS_ECDSA_2

CLIENT_PRIVATE_KEY_ED25519_2=$CLIENT_PRIVATE_KEY_ED25519_2
CLIENT_PUBLIC_KEY_ED25519_2=$CLIENT_PUBLIC_KEY_ED25519_2
CLIENT_ACCOUNT_ID_ED25519_2=0.0.$CLIENT_ACCOUNT_ID_ED25519_2
CLIENT_EVM_ADDRESS_ED25519_2=$CLIENT_EVM_ADDRESS_ED25519_2

FIREBLOCKS_HEDERA_ACCOUNT_ID=0.0.$CLIENT_ACCOUNT_ID_ECDSA_2
FIREBLOCKS_HEDERA_PUBLIC_KEY=$CLIENT_PUBLIC_KEY_ECDSA_2

DFNS_HEDERA_ACCOUNT_ID=0.0.$CLIENT_ACCOUNT_ID_ECDSA_2
DFNS_WALLET_PUBLIC_KEY=$CLIENT_PUBLIC_KEY_ECDSA_2

HEDERA_TOKEN_MANAGER_ADDRESS=0.0.2167020
FACTORY_ADDRESS=0.0.2167166
EOF
working-directory: sdk
47 changes: 47 additions & 0 deletions .github/actions/initial-steps/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Initial_Steps
description: Common initial steps for all workflows, with optional dependency installation.

inputs:
install-dependencies: # Options: "all", "install", "none"
description: "Whether to install dependencies"
required: false
default: "all"
deps-contracts-install: # Options: "true", "false"
description: "Whether to install dependencies for contracts installation"
required: false
default: "false"
deps-create-env-file: # Options: "true", "false"
description: "Whether to install dependencies for creating the .env file"
required: false
default: "false"
deps-change-references: # Options: "true", "false"
description: "Whether to install dependencies for changing references to the repo. execution of 'changeProyectsReferencesToRepo.sh'"
required: false
default: "false"

runs:
using: "composite"
steps:
- name: Harden Runner
uses: step-security/harden-runner@f086349bfa2bd1361f7909c78558e816508cdc10 #v2.8.0
with:
egress-policy: audit

- name: Install glibc in Alpine to add multi-arch support
shell: sh
run: apk add --no-cache gcompat libc6-compat

- name: Install dependencies to install contracts
shell: sh
if: ${{ inputs.deps-contracts-install == 'true' }}
run: apk add --no-cache python3 py3-pip make g++

- name: Install dependencies to create ENV file
shell: sh
if: ${{ inputs.deps-create-env-file == 'true' }}
run: apk add --no-cache curl jq

- name: Install dependencies to change references to the repo
shell: sh
if: ${{ inputs.deps-change-references == 'true' }}
run: apk add --no-cache bash sed
56 changes: 56 additions & 0 deletions .github/actions/install-and-build/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Install_And_Build
description: Install dependencies and build modules as needed

inputs:
module:
description: "The module that is going to be tested"
required: true

runs:
using: composite
steps:
- name: Install Contracts
shell: sh
run: npm ci
working-directory: contracts

- name: Build Contracts
shell: sh
run: npm run compile:force
working-directory: contracts

- name: Install SDK
if: ${{ inputs.module == 'sdk' || inputs.module == 'cli' || inputs.module == 'web' }}
shell: sh
run: npm ci
working-directory: sdk

- name: Build SDK
if: ${{ inputs.module == 'sdk' || inputs.module == 'cli' || inputs.module == 'web' }}
shell: sh
run: npm run build
working-directory: sdk

- name: Install CLI
if: ${{ inputs.module == 'cli' }}
shell: sh
run: npm ci
working-directory: cli

- name: Build CLI
if: ${{ inputs.module == 'cli' }}
shell: sh
run: npm run build
working-directory: cli

- name: Install Web
if: ${{ inputs.module == 'web' }}
shell: sh
run: npm ci
working-directory: web

# - name: Build Web
# if: ${{ inputs.module == 'web' }}
# shell: sh
# run: npm run build
# working-directory: web
171 changes: 0 additions & 171 deletions .github/workflows/all.testWithRpc.yml

This file was deleted.

Loading
Loading