Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
AUTH_API_KEY="aHR0cHM6Ly9hdXRoLWRlbi10ZHUudmVyY2VsLmFwcC9hcGk="
41 changes: 22 additions & 19 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
# Public RPC (better to replace with your own from infura, alchemy, etc.)
BASE_MAINNET_RPC_URL='https://base.llamarpc.com'
BASE_TESTNET_RPC_URL='https://base-goerli.publicnode.com'
CELO_MAINNET_RPC_URL='https://forno.celo.org'
CELO_TESTNET_RPC_URL='https://alfajores-forno.celo-testnet.org'
ETHEREUM_MAINNET_RPC_URL='https://eth.llamarpc.com'
ETHEREUM_TESTNET_RPC_URL='https://rpc.sepolia.dev'
POLYGON_MAINNET_RPC_URL='https://polygon.llamarpc.com'
POLYGON_TESTNET_RPC_URL='https://polygon-mumbai-pokt.nodies.app'

# ETHERSCAN API KEYS
ETHEREUM_MAINNET_ETHERSCAN_API_KEY='x'
ETHEREUM_TESTNET_ETHERSCAN_API_KEY='x'
POLYGON_MAINNET_ETHERSCAN_API_KEY='x'
POLYGON_TESTNET_ETHERSCAN_API_KEY='x'
CELO_MAINNET_ETHERSCAN_API_KEY='x'
CELO_TESTNET_ETHERSCAN_API_KEY='x'
BASE_MAINNET_ETHERSCAN_API_KEY='x'
BASE_TESTNET_ETHERSCAN_API_KEY='x'
# Public RPC (better to replace with your own from infura, alchemy, etc.)
BASE_MAINNET_RPC_URL='https://base.llamarpc.com'
BASE_TESTNET_RPC_URL='https://base-sepolia.publicnode.com'
CELO_MAINNET_RPC_URL='https://forno.celo.org'
CELO_TESTNET_RPC_URL='https://alfajores-forno.celo-testnet.org'
ETHEREUM_MAINNET_RPC_URL='https://eth.llamarpc.com'
ETHEREUM_TESTNET_RPC_URL='https://rpc.sepolia.dev'
POLYGON_MAINNET_RPC_URL='https://polygon.llamarpc.com'
POLYGON_TESTNET_RPC_URL='https://polygon-mumbai-pokt.nodies.app'

# ETHERSCAN API KEYS
ETHEREUM_MAINNET_ETHERSCAN_API_KEY='x'
ETHEREUM_TESTNET_ETHERSCAN_API_KEY='x'
POLYGON_MAINNET_ETHERSCAN_API_KEY='x'
POLYGON_TESTNET_ETHERSCAN_API_KEY='x'
CELO_MAINNET_ETHERSCAN_API_KEY='x'
CELO_TESTNET_ETHERSCAN_API_KEY='x'
BASE_MAINNET_ETHERSCAN_API_KEY='x'
BASE_TESTNET_ETHERSCAN_API_KEY='x'

TEST_MINTER_PRIVATE_KEY='0xddb0b27b0a51723bf278beb2e5141c1f0599a3c10de76bfcad3e6b357d917f03'
TEST_USER_PRIVATE_KEY='0x7495065dc20fd9065a792f0fe47e4ebaec77d32da895f94309f32d91e5678406'
22 changes: 22 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Public RPC (better to replace with your own from infura, alchemy, etc.)
BASE_MAINNET_RPC_URL='https://base.llamarpc.com'
BASE_TESTNET_RPC_URL='https://base-sepolia.publicnode.com'
CELO_MAINNET_RPC_URL='https://forno.celo.org'
CELO_TESTNET_RPC_URL='https://alfajores-forno.celo-testnet.org'
ETHEREUM_MAINNET_RPC_URL='https://eth.llamarpc.com'
ETHEREUM_TESTNET_RPC_URL='https://rpc.sepolia.dev'
POLYGON_MAINNET_RPC_URL='https://polygon.llamarpc.com'
POLYGON_TESTNET_RPC_URL='https://polygon-mumbai-pokt.nodies.app'

# ETHERSCAN API KEYS
ETHEREUM_MAINNET_ETHERSCAN_API_KEY='x'
ETHEREUM_TESTNET_ETHERSCAN_API_KEY='x'
POLYGON_MAINNET_ETHERSCAN_API_KEY='x'
POLYGON_TESTNET_ETHERSCAN_API_KEY='x'
CELO_MAINNET_ETHERSCAN_API_KEY='x'
CELO_TESTNET_ETHERSCAN_API_KEY='x'
BASE_MAINNET_ETHERSCAN_API_KEY='x'
BASE_TESTNET_ETHERSCAN_API_KEY='x'

TEST_MINTER_PRIVATE_KEY='0xddb0b27b0a51723bf278beb2e5141c1f0599a3c10de76bfcad3e6b357d917f03'
TEST_USER_PRIVATE_KEY='0x7495065dc20fd9065a792f0fe47e4ebaec77d32da895f94309f32d91e5678406'
172 changes: 86 additions & 86 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,86 +1,86 @@
name: Build and Tag
on:
push:
branches:
- main
concurrency:
group: sdk-deploy
cancel-in-progress: true
jobs:
build-and-tag:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "18"
registry-url: "https://registry.npmjs.org"

- name: Add .env file
run: echo "${{ secrets.ENV }}" > .env

- name: Install dependencies
run: npm ci

- name: Run Tests
run: npm test

- name: Build
run: npm run build

- name: Fetch tags
run: git fetch --tags

- name: Parse Tag
id: parse_tag
run: |
LAST_TAG=$(git tag | sort -V | tail -n 1)
if [ -z "$LAST_TAG" ]; then
LAST_TAG='1.0.0'
fi
IFS='.' read -ra VERSION_PARTS <<< "$LAST_TAG"
MAJOR=${VERSION_PARTS[0]}
MINOR=${VERSION_PARTS[1]}
PATCH=${VERSION_PARTS[2]}
NEW_TAG="$MAJOR.$MINOR.$((PATCH + 1))"
while git rev-parse "$NEW_TAG" >/dev/null 2>&1; do
PATCH=$((PATCH + 1))
NEW_TAG="$MAJOR.$MINOR.$PATCH"
done
echo ::set-output name=tag::${NEW_TAG}

- name: Update package.json version
run: |
npm version --no-git-tag-version $(echo ${{ steps.parse_tag.outputs.tag }})

- name: Commit changes
run: |
git config --local user.email "bot@citizenwallet.xyz"
git config --local user.name "CW Bot"
git add package.json
git commit -m "Add compiled files & tag"
git push origin main

- name: Create tag
run: git tag ${{ steps.parse_tag.outputs.tag }}

- name: Push Tag
run: git push origin ${{ steps.parse_tag.outputs.tag }}

- run: npm ci

- name: Publish to npm
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Notify of successful deploy
run: |
curl --location '${{ secrets.DISCORD_WEBHOOK_URL }}' \
--header 'Content-Type: application/json' \
--data '{
"content": "new sdk update available:\n `npm i @citizenwallet/sdk@'${{ steps.parse_tag.outputs.tag }}'`\n or \n `npm i @citizenwallet/sdk@latest` \n\n https://www.npmjs.com/package/@citizenwallet/sdk?activeTab=readme"
}'
name: Build and Tag
on:
push:
branches:
- main
concurrency:
group: sdk-deploy
cancel-in-progress: true
jobs:
build-and-tag:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "18"
registry-url: "https://registry.npmjs.org"
- name: Add .env file
run: echo "${{ secrets.ENV }}" > .env
- name: Install dependencies
run: npm ci
- name: Run Tests
run: npm test
- name: Build
run: npm run build
- name: Fetch tags
run: git fetch --tags
- name: Parse Tag
id: parse_tag
run: |
LAST_TAG=$(git tag | sort -V | tail -n 1)
if [ -z "$LAST_TAG" ]; then
LAST_TAG='1.0.0'
fi
IFS='.' read -ra VERSION_PARTS <<< "$LAST_TAG"
MAJOR=${VERSION_PARTS[0]}
MINOR=${VERSION_PARTS[1]}
PATCH=${VERSION_PARTS[2]}
NEW_TAG="$MAJOR.$MINOR.$((PATCH + 1))"
while git rev-parse "$NEW_TAG" >/dev/null 2>&1; do
PATCH=$((PATCH + 1))
NEW_TAG="$MAJOR.$MINOR.$PATCH"
done
echo ::set-output name=tag::${NEW_TAG}
- name: Update package.json version
run: |
npm version --no-git-tag-version $(echo ${{ steps.parse_tag.outputs.tag }})
- name: Commit changes
run: |
git config --local user.email "bot@citizenwallet.xyz"
git config --local user.name "CW Bot"
git add package.json
git commit -m "Add compiled files & tag"
git push origin main
- name: Create tag
run: git tag ${{ steps.parse_tag.outputs.tag }}
- name: Push Tag
run: git push origin ${{ steps.parse_tag.outputs.tag }}
- run: npm ci
- name: Publish to npm
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Notify of successful deploy
run: |
curl --location '${{ secrets.DISCORD_WEBHOOK_URL }}' \
--header 'Content-Type: application/json' \
--data '{
"content": "new sdk update available:\n `npm i @citizenwallet/sdk@'${{ steps.parse_tag.outputs.tag }}'`\n or \n `npm i @citizenwallet/sdk@latest` \n\n https://www.npmjs.com/package/@citizenwallet/sdk?activeTab=readme"
}'
40 changes: 21 additions & 19 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
# Dependency directories
node_modules/

# Output of the compiler
dist/

# IDE - VSCode
.vscode/
*.code-workspace

# System Files
.DS_Store
Thumbs.db

.env

cache

artifacts
# Dependency directories
node_modules/

# Output of the compiler
dist/

# IDE - VSCode
.vscode/
*.code-workspace

# System Files
.DS_Store
Thumbs.db

!.env.test
!.env.example

cache

artifacts
config.bat
Loading